{"version":3,"file":"ng-primitives-rating.mjs","sources":["../../../../packages/ng-primitives/rating/src/config/rating-config.ts","../../../../packages/ng-primitives/rating/src/rating/rating-state.ts","../../../../packages/ng-primitives/rating/src/rating/rating.ts","../../../../packages/ng-primitives/rating/src/rating-item/rating-item-state.ts","../../../../packages/ng-primitives/rating/src/rating-item/rating-item.ts","../../../../packages/ng-primitives/rating/src/ng-primitives-rating.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\n\nexport interface NgpRatingConfig {\n  /**\n   * The default number of items in the rating.\n   */\n  count: number;\n  /**\n   * Whether re-selecting the current value clears the rating to 0 (deselection).\n   */\n  clearable: boolean;\n  /**\n   * Produce the `aria-valuetext` announced to assistive technology. Override\n   * for localisation.\n   */\n  valueText: (value: number, count: number) => string;\n}\n\nexport const defaultRatingConfig: NgpRatingConfig = {\n  count: 5,\n  clearable: false,\n  valueText: (value, count) => `${value} out of ${count}`,\n};\n\nexport const NgpRatingConfigToken = new InjectionToken<NgpRatingConfig>('NgpRatingConfigToken');\n\n/**\n * Provide the default Rating configuration\n * @param config The Rating configuration\n * @returns The provider\n */\nexport function provideRatingConfig(config: Partial<NgpRatingConfig>): Provider[] {\n  return [\n    {\n      provide: NgpRatingConfigToken,\n      useValue: { ...defaultRatingConfig, ...config },\n    },\n  ];\n}\n\n/**\n * Inject the Rating configuration\n * @returns The global Rating configuration\n */\nexport function injectRatingConfig(): NgpRatingConfig {\n  return inject(NgpRatingConfigToken, { optional: true }) ?? defaultRatingConfig;\n}\n","import { Signal, WritableSignal, computed, signal } from '@angular/core';\nimport { ngpFormControl } from 'ng-primitives/form-field';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n  SetterOptions,\n  attrBinding,\n  controlled,\n  controlledState,\n  createPrimitive,\n  dataBinding,\n  deprecatedSetter,\n  listener,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable } from 'rxjs';\n\n/**\n * The derived render state for a single rating item (star).\n */\nexport interface NgpRatingItemState {\n  /** The 1-based position of the item. */\n  readonly index: number;\n  /** Whether the item is fully filled. */\n  readonly checked: boolean;\n  /** Whether the item is half filled (only when `allowHalf`). */\n  readonly half: boolean;\n  /** The fill amount of the item, 0-1 (for fractional/readonly averages). */\n  readonly fraction: number;\n  /** Whether the item is part of the current hover preview. */\n  readonly highlighted: boolean;\n}\n\n/**\n * Public state surface for the Rating primitive.\n */\nexport interface NgpRatingState {\n  /** The id of the rating. */\n  readonly id: Signal<string>;\n  /** The committed rating value. */\n  readonly value: WritableSignal<number>;\n  /** The number of items. */\n  readonly count: Signal<number>;\n  /** Whether half values are allowed. */\n  readonly allowHalf: Signal<boolean>;\n  /** Whether the rating is disabled (includes form control state). */\n  readonly disabled: Signal<boolean>;\n  /** Whether the rating is read-only. */\n  readonly readonly: Signal<boolean>;\n  /** Emits when the committed value changes. */\n  readonly valueChange: Observable<number>;\n  /** Set the committed value (clamped to `[0, count]`). */\n  setValue(value: number, options?: SetterOptions): void;\n  /** Set the default value used in uncontrolled mode. */\n  setDefaultValue(value: number): void;\n  /** Set the disabled state (merged with any form control disabled state). */\n  setDisabled(disabled: boolean): void;\n  /**\n   * @internal Commit an interactive value, clearing to 0 when re-selecting the\n   * current value.\n   */\n  commit(value: number): void;\n  /**\n   * @internal Set the hover preview value.\n   */\n  preview(value: number): void;\n  /**\n   * @internal Derive the render state for the item at `index` (1-based).\n   */\n  itemState(index: number): NgpRatingItemState;\n}\n\n/**\n * Inputs for configuring the Rating primitive.\n */\nexport interface NgpRatingProps {\n  /** The id of the rating. */\n  readonly id?: Signal<string>;\n  /** The committed rating value. When defined the rating is controlled. */\n  readonly value?: Signal<number | undefined>;\n  /** The default rating value for uncontrolled usage. */\n  readonly defaultValue?: Signal<number>;\n  /** The number of items. */\n  readonly count?: Signal<number>;\n  /** Whether half values are allowed. */\n  readonly allowHalf?: Signal<boolean>;\n  /** Whether the rating is disabled. */\n  readonly disabled?: Signal<boolean>;\n  /** Whether the rating is read-only. */\n  readonly readonly?: Signal<boolean>;\n  /** Whether re-selecting the current value clears the rating to 0. */\n  readonly clearable?: Signal<boolean>;\n  /** Produce the `aria-valuetext` string. */\n  readonly valueText?: Signal<(value: number, count: number) => string>;\n  /** Callback fired when the committed value changes. */\n  readonly onValueChange?: (value: number) => void;\n}\n\nexport const [NgpRatingStateToken, ngpRating, injectRatingState, provideRatingState] =\n  createPrimitive(\n    'NgpRating',\n    ({\n      id = signal(uniqueId('ngp-rating')),\n      value: _value = signal<number | undefined>(undefined),\n      defaultValue: _defaultValue,\n      count = signal(5),\n      allowHalf = signal(false),\n      disabled: _disabled = signal(false),\n      readonly = signal(false),\n      clearable = signal(false),\n      valueText = signal<(value: number, count: number) => string>(\n        (value, count) => `${value} out of ${count}`,\n      ),\n      onValueChange,\n    }: NgpRatingProps): NgpRatingState => {\n      const element = injectElementRef<HTMLElement>();\n      const defaultValue = controlled(_defaultValue, 0);\n      const [value, setValueInternal, valueChange] = controlledState<number>({\n        value: _value,\n        defaultValue,\n        onChange: onValueChange,\n      });\n      const disabledInput = controlled(_disabled);\n      const hovered = signal<number | null>(null);\n\n      // Merge the input disabled state with the form control (NgControl) state.\n      const status = ngpFormControl({ id, disabled: disabledInput });\n      const disabled = computed(() => status().disabled ?? false);\n\n      const displayValue = computed(() => {\n        const preview = hovered();\n        return preview !== null ? preview : value();\n      });\n\n      function itemState(index: number): NgpRatingItemState {\n        const fraction = Math.min(1, Math.max(0, displayValue() - (index - 1)));\n        return {\n          index,\n          checked: fraction >= 1,\n          half: allowHalf() && fraction >= 0.5 && fraction < 1,\n          fraction,\n          highlighted: hovered() !== null && fraction > 0,\n        };\n      }\n\n      function setValue(newValue: number, options?: SetterOptions): void {\n        const clamped = Math.min(count(), Math.max(0, newValue));\n        setValueInternal(clamped, options);\n      }\n\n      function setDisabled(isDisabled: boolean): void {\n        disabledInput.set(isDisabled);\n      }\n\n      function isInteractive(): boolean {\n        return !disabled() && !readonly();\n      }\n\n      function commit(newValue: number): void {\n        if (!isInteractive()) {\n          return;\n        }\n        // Re-selecting the current value clears the rating, when clearable.\n        if (newValue === value()) {\n          if (clearable()) {\n            setValue(0);\n          }\n          return;\n        }\n        setValue(newValue);\n      }\n\n      function preview(newValue: number): void {\n        if (!isInteractive()) {\n          return;\n        }\n        hovered.set(newValue);\n      }\n\n      function clearPreview(): void {\n        hovered.set(null);\n      }\n\n      function onKeydown(event: KeyboardEvent): void {\n        if (!isInteractive()) {\n          return;\n        }\n\n        const step = allowHalf() ? 0.5 : 1;\n        const isRTL = getComputedStyle(element.nativeElement).direction === 'rtl';\n        const current = value();\n        let next = current;\n\n        switch (event.key) {\n          case 'ArrowUp':\n            next = current + step;\n            break;\n          case 'ArrowDown':\n            next = current - step;\n            break;\n          case 'ArrowRight':\n            next = isRTL ? current - step : current + step;\n            break;\n          case 'ArrowLeft':\n            next = isRTL ? current + step : current - step;\n            break;\n          case 'Home':\n            next = 0;\n            break;\n          case 'End':\n            next = count();\n            break;\n          default:\n            return;\n        }\n\n        event.preventDefault();\n        // When not clearable, an existing rating can't be decreased to 0.\n        const floor = !clearable() && current > 0 ? 1 : 0;\n        next = Math.min(count(), Math.max(floor, next));\n        if (next !== current) {\n          setValue(next);\n        }\n      }\n\n      // Host bindings\n      attrBinding(element, 'role', 'slider');\n      attrBinding(element, 'id', id);\n      attrBinding(element, 'tabindex', () => (disabled() ? '-1' : '0'));\n      attrBinding(element, 'aria-valuemin', '0');\n      attrBinding(element, 'aria-valuemax', () => String(count()));\n      attrBinding(element, 'aria-valuenow', () => String(value()));\n      attrBinding(element, 'aria-valuetext', () => valueText()(value(), count()));\n      attrBinding(element, 'aria-readonly', () => (readonly() ? 'true' : null));\n      attrBinding(element, 'aria-disabled', () => (disabled() ? 'true' : null));\n      dataBinding(element, 'data-readonly', readonly);\n      dataBinding(element, 'data-hovered', () => hovered() !== null);\n\n      // Listeners\n      listener(element, 'keydown', onKeydown);\n      listener(element, 'pointerleave', clearPreview);\n\n      return {\n        id,\n        value: deprecatedSetter(value, 'setValue', setValue),\n        count,\n        allowHalf,\n        disabled,\n        readonly,\n        valueChange,\n        setValue,\n        setDefaultValue: defaultValue.set,\n        setDisabled,\n        commit,\n        preview,\n        itemState,\n      } satisfies NgpRatingState;\n    },\n  );\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, input, numberAttribute, output } from '@angular/core';\nimport { SetterOptions } from 'ng-primitives/state';\nimport { coerceNumberOrUndefined, uniqueId } from 'ng-primitives/utils';\nimport { injectRatingConfig } from '../config/rating-config';\nimport { ngpRating, provideRatingState } from './rating-state';\n\n/**\n * Apply the `ngpRating` directive to an element that represents the rating. It\n * exposes the slider role and owns the value, keyboard, and form integration.\n * Project the star markup once via the `*ngpRatingItem` structural directive.\n */\n@Directive({\n  selector: '[ngpRating]',\n  exportAs: 'ngpRating',\n  providers: [provideRatingState()],\n})\nexport class NgpRating {\n  private readonly config = injectRatingConfig();\n\n  /**\n   * The id of the rating. If not provided, a unique id will be generated.\n   */\n  readonly id = input<string>(uniqueId('ngp-rating'));\n\n  /**\n   * The value of the rating. When defined the rating is controlled.\n   */\n  readonly value = input<number | undefined, NumberInput>(undefined, {\n    alias: 'ngpRatingValue',\n    transform: coerceNumberOrUndefined,\n  });\n\n  /**\n   * The default value of the rating for uncontrolled usage.\n   * @default 0\n   */\n  readonly defaultValue = input<number, NumberInput>(0, {\n    alias: 'ngpRatingDefaultValue',\n    transform: (value: NumberInput) => numberAttribute(value, 0),\n  });\n\n  /**\n   * Emits when the value changes.\n   */\n  readonly valueChange = output<number>({\n    alias: 'ngpRatingValueChange',\n  });\n\n  /**\n   * The number of items in the rating.\n   */\n  readonly count = input<number, NumberInput>(this.config.count, {\n    alias: 'ngpRatingCount',\n    transform: numberAttribute,\n  });\n\n  /**\n   * Whether half values are allowed.\n   */\n  readonly allowHalf = input<boolean, BooleanInput>(false, {\n    alias: 'ngpRatingAllowHalf',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Whether the rating is disabled.\n   */\n  readonly disabled = input<boolean, BooleanInput>(false, {\n    alias: 'ngpRatingDisabled',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Whether the rating is read-only.\n   */\n  readonly readonly = input<boolean, BooleanInput>(false, {\n    alias: 'ngpRatingReadonly',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Whether re-selecting the current value clears the rating to 0 (deselection).\n   */\n  readonly clearable = input<boolean, BooleanInput>(this.config.clearable, {\n    alias: 'ngpRatingClearable',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Produce the `aria-valuetext` announced to assistive technology.\n   */\n  readonly valueText = input<(value: number, count: number) => string>(this.config.valueText, {\n    alias: 'ngpRatingValueText',\n  });\n\n  /**\n   * The state of the rating.\n   */\n  protected readonly state = ngpRating({\n    id: this.id,\n    value: this.value,\n    defaultValue: this.defaultValue,\n    count: this.count,\n    allowHalf: this.allowHalf,\n    disabled: this.disabled,\n    readonly: this.readonly,\n    clearable: this.clearable,\n    valueText: this.valueText,\n    onValueChange: value => this.valueChange.emit(value),\n  });\n\n  /**\n   * Set the value of the rating.\n   */\n  setValue(value: number, options?: SetterOptions): void {\n    this.state.setValue(value, options);\n  }\n}\n","import { Signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding, listener } from 'ng-primitives/state';\nimport { NgpRatingItemState } from '../rating/rating-state';\n\n/**\n * Inputs for the rating item state function. The parent passes exactly what the\n * item needs - the item never reaches back into the rating state.\n */\nexport interface NgpRatingItemProps {\n  /** The 1-based position of the item. */\n  readonly index: number;\n  /** Whether the item is fully filled. */\n  readonly checked: Signal<boolean>;\n  /** Whether the item is half filled. */\n  readonly half: Signal<boolean>;\n  /** The fill amount of the item, 0-1. */\n  readonly fraction: Signal<number>;\n  /** Whether the item is part of the current hover preview. */\n  readonly highlighted: Signal<boolean>;\n  /** Whether half values are allowed (for pointer half-detection). */\n  readonly allowHalf: Signal<boolean>;\n  /** Preview the value the pointer is over. */\n  readonly preview: (value: number) => void;\n  /** Commit the value the pointer selects. */\n  readonly commit: (value: number) => void;\n}\n\n/**\n * The state function for a single rendered rating item. Reflects the item's\n * state onto the element as data attributes, wires the pointer interactions\n * (hover preview + click, with half-value detection), and returns the item's\n * render state - which `renderList` exposes as the `*ngpRatingItem` context.\n *\n * Runs inside the render-pass injection context provided by `renderList`, so its\n * element is available via `injectElementRef()` and its `dataBinding` effects and\n * listeners are cleaned up automatically.\n */\nexport const [\n  NgpRatingItemStateToken,\n  ngpRatingItem,\n  injectRatingItemState,\n  provideRatingItemState,\n] = createPrimitive(\n  'NgpRatingItem',\n  ({\n    index,\n    checked,\n    half,\n    fraction,\n    highlighted,\n    allowHalf,\n    preview,\n    commit,\n  }: NgpRatingItemProps): NgpRatingItemState => {\n    const element = injectElementRef<HTMLElement>();\n\n    dataBinding(element, 'data-checked', checked);\n    dataBinding(element, 'data-half', half);\n    dataBinding(element, 'data-highlighted', highlighted);\n\n    listener(element, 'pointermove', event =>\n      preview(valueAt(element.nativeElement, index, allowHalf(), event)),\n    );\n    listener(element, 'click', event =>\n      commit(valueAt(element.nativeElement, index, allowHalf(), event)),\n    );\n\n    // Getters so each template read re-derives from the live signals.\n    return {\n      index,\n      get checked() {\n        return checked();\n      },\n      get half() {\n        return half();\n      },\n      get fraction() {\n        return fraction();\n      },\n      get highlighted() {\n        return highlighted();\n      },\n    } satisfies NgpRatingItemState;\n  },\n);\n\n/** Resolve the value the pointer is currently over, honouring half steps. */\nfunction valueAt(\n  element: HTMLElement,\n  index: number,\n  allowHalf: boolean,\n  event: { clientX: number },\n): number {\n  if (!allowHalf) {\n    return index;\n  }\n\n  const rect = element.getBoundingClientRect();\n  const isRTL = getComputedStyle(element).direction === 'rtl';\n  const ratio = isRTL\n    ? (rect.right - event.clientX) / rect.width\n    : (event.clientX - rect.left) / rect.width;\n  return ratio <= 0.5 ? index - 0.5 : index;\n}\n","import { Directive, TemplateRef, ViewContainerRef, computed, inject } from '@angular/core';\nimport { renderList } from 'ng-primitives/internal';\nimport { NgpRatingItemState, injectRatingState } from '../rating/rating-state';\nimport { ngpRatingItem, provideRatingItemState } from './rating-item-state';\n\n/**\n * The render context exposed to the `*ngpRatingItem` template. Every field is\n * derived reactively from the rating value / hover state, so the template\n * updates automatically as the rating changes.\n */\nexport interface NgpRatingItemContext {\n  $implicit: NgpRatingItemState;\n}\n\n/**\n * A structural directive that renders one item (star) per `count`, driven by the\n * parent `ngpRating`. Each generated element automatically receives the\n * `data-checked`, `data-half` and `data-highlighted` attributes and has its\n * pointer interactions wired up via the `ngpRatingItem` state function.\n */\n@Directive({\n  selector: '[ngpRatingItem]',\n  exportAs: 'ngpRatingItem',\n})\nexport class NgpRatingItem {\n  private readonly template = inject<TemplateRef<NgpRatingItemContext>>(TemplateRef);\n  private readonly viewContainer = inject(ViewContainerRef);\n  private readonly state = injectRatingState();\n\n  // Make sure the template checker knows the type of the context.\n  static ngTemplateContextGuard(\n    _: NgpRatingItem,\n    context: unknown,\n  ): context is NgpRatingItemContext {\n    return true;\n  }\n\n  constructor() {\n    renderList<number>({\n      viewContainer: this.viewContainer,\n      template: this.template,\n      items: () => Array.from({ length: this.state().count() }, (_, i) => i + 1),\n      // Register each item's state so it can be injected within the item view.\n      providers: () => [provideRatingItemState()],\n      // The item factory's returned state becomes the `let star` context.\n      setup: index => {\n        const item = computed(() => this.state().itemState(index));\n        return ngpRatingItem({\n          index,\n          checked: computed(() => item().checked),\n          half: computed(() => item().half),\n          fraction: computed(() => item().fraction),\n          highlighted: computed(() => item().highlighted),\n          allowHalf: this.state().allowHalf,\n          preview: value => this.state().preview(value),\n          commit: value => this.state().commit(value),\n        });\n      },\n    });\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC,K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