ng-primitives 0.124.0 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/date-time-date-fns/README.md +3 -0
  2. package/fesm2022/ng-primitives-avatar.mjs +4 -2
  3. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  4. package/fesm2022/ng-primitives-checkbox.mjs +4 -2
  5. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  6. package/fesm2022/ng-primitives-date-picker.mjs +42 -44
  7. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  8. package/fesm2022/ng-primitives-date-time-date-fns.mjs +95 -0
  9. package/fesm2022/ng-primitives-date-time-date-fns.mjs.map +1 -0
  10. package/fesm2022/ng-primitives-date-time-luxon.mjs +21 -3
  11. package/fesm2022/ng-primitives-date-time-luxon.mjs.map +1 -1
  12. package/fesm2022/ng-primitives-date-time.mjs +18 -3
  13. package/fesm2022/ng-primitives-date-time.mjs.map +1 -1
  14. package/fesm2022/ng-primitives-dialog.mjs +11 -4
  15. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  16. package/fesm2022/ng-primitives-form-field.mjs +3 -0
  17. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  18. package/fesm2022/ng-primitives-input-otp.mjs +15 -7
  19. package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
  20. package/fesm2022/ng-primitives-listbox.mjs +5 -4
  21. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-menu.mjs +8 -0
  23. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-meter.mjs +20 -5
  25. package/fesm2022/ng-primitives-meter.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-number-field.mjs +10 -0
  27. package/fesm2022/ng-primitives-number-field.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-pagination.mjs +16 -6
  29. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-password.mjs +293 -0
  31. package/fesm2022/ng-primitives-password.mjs.map +1 -0
  32. package/fesm2022/ng-primitives-popover.mjs +4 -0
  33. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-progress.mjs +36 -11
  35. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  36. package/fesm2022/ng-primitives-roving-focus.mjs +13 -2
  37. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-search.mjs +2 -1
  39. package/fesm2022/ng-primitives-search.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-slider.mjs +38 -18
  41. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-switch.mjs +18 -8
  43. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-tabs.mjs +22 -6
  45. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-textarea.mjs +10 -8
  47. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-toast.mjs +3 -0
  49. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  50. package/fesm2022/ng-primitives-toggle-group.mjs +31 -8
  51. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  52. package/package.json +12 -1
  53. package/password/README.md +3 -0
  54. package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -1
  55. package/schematics/ng-generate/templates/combobox/combobox.__fileSuffix@dasherize__.ts.template +3 -2
  56. package/schematics/ng-generate/templates/date-picker/date-picker.__fileSuffix@dasherize__.ts.template +2 -1
  57. package/schematics/ng-generate/templates/listbox/listbox.__fileSuffix@dasherize__.ts.template +9 -4
  58. package/schematics/ng-generate/templates/pagination/pagination.__fileSuffix@dasherize__.ts.template +7 -1
  59. package/schematics/ng-generate/templates/password/password.__fileSuffix@dasherize__.ts.template +141 -0
  60. package/schematics/ng-generate/templates/range-slider/range-slider.__fileSuffix@dasherize__.ts.template +4 -3
  61. package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +2 -1
  62. package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -1
  63. package/types/ng-primitives-checkbox.d.ts +5 -1
  64. package/types/ng-primitives-date-picker.d.ts +7 -9
  65. package/types/ng-primitives-date-time-date-fns.d.ts +30 -0
  66. package/types/ng-primitives-date-time.d.ts +15 -3
  67. package/types/ng-primitives-dialog.d.ts +4 -0
  68. package/types/ng-primitives-input-otp.d.ts +5 -5
  69. package/types/ng-primitives-meter.d.ts +9 -2
  70. package/types/ng-primitives-pagination.d.ts +34 -8
  71. package/types/ng-primitives-password.d.ts +296 -0
  72. package/types/ng-primitives-progress.d.ts +4 -2
  73. package/types/ng-primitives-roving-focus.d.ts +7 -0
  74. package/types/ng-primitives-slider.d.ts +5 -4
  75. package/types/ng-primitives-switch.d.ts +14 -4
  76. package/types/ng-primitives-tabs.d.ts +6 -1
  77. package/types/ng-primitives-toggle-group.d.ts +51 -37
@@ -4,7 +4,7 @@ import { injectElementRef } from 'ng-primitives/internal';
4
4
  import { createPrimitive, controlled, attrBinding, dataBinding, deprecatedSetter, styleBinding } from 'ng-primitives/state';
5
5
  import { uniqueId } from 'ng-primitives/utils';
6
6
 
7
- const [NgpProgressStateToken, ngpProgress, injectProgressState, provideProgressState] = createPrimitive('NgpProgress', ({ valueLabel: _valueLabel = signal((value, max) => `${Math.round((value / max) * 100)}%`), value: _value = signal(null), min: _min = signal(0), max: _max = signal(100), id = signal(uniqueId('ngp-progress')), }) => {
7
+ const [NgpProgressStateToken, ngpProgress, injectProgressState, provideProgressState] = createPrimitive('NgpProgress', ({ valueLabel: _valueLabel = signal((value, max, min) => `${max === min ? 0 : Math.round(((value - min) / (max - min)) * 100)}%`), value: _value = signal(null), min: _min = signal(0), max: _max = signal(100), id = signal(uniqueId('ngp-progress')), }) => {
8
8
  const element = injectElementRef();
9
9
  // Controlled properties
10
10
  const value = controlled(_value);
@@ -19,20 +19,35 @@ const [NgpProgressStateToken, ngpProgress, injectProgressState, provideProgressS
19
19
  /**
20
20
  * Determine if the progress is in a progressing state.
21
21
  */
22
- const progressing = computed(() => value() != null && value() > 0 && value() < max(), ...(ngDevMode ? [{ debugName: "progressing" }] : /* istanbul ignore next */ []));
22
+ const progressing = computed(() => !indeterminate() && valueNow() > min() && valueNow() < max(), ...(ngDevMode ? [{ debugName: "progressing" }] : /* istanbul ignore next */ []));
23
23
  /**
24
24
  * Determine if the progress is complete.
25
25
  */
26
- const complete = computed(() => !!(value() && max() && value() === max()), ...(ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []));
26
+ const complete = computed(() => !indeterminate() && valueNow() >= max() && max() > min(), ...(ngDevMode ? [{ debugName: "complete" }] : /* istanbul ignore next */ []));
27
27
  /**
28
- * Get the progress value text.
28
+ * The raw value exposed via `aria-valuenow`, clamped to the [min, max] range.
29
+ * Per the ARIA progressbar pattern, `aria-valuenow` is the actual value on the
30
+ * same scale as `aria-valuemin`/`aria-valuemax`, not a 0-100 percentage. It is
31
+ * omitted entirely (null) while the progress is indeterminate.
29
32
  */
30
- const valueText = computed(() => {
33
+ const valueNow = computed(() => {
31
34
  const currentValue = value();
35
+ if (currentValue == null) {
36
+ return null;
37
+ }
38
+ return Math.min(Math.max(currentValue, min()), max());
39
+ }, ...(ngDevMode ? [{ debugName: "valueNow" }] : /* istanbul ignore next */ []));
40
+ /**
41
+ * Get the progress value text. Empty while indeterminate; the
42
+ * aria-valuetext binding omits the attribute in that case.
43
+ */
44
+ const valueText = computed(() => {
45
+ const currentValue = valueNow();
32
46
  if (currentValue == null) {
33
47
  return '';
34
48
  }
35
- return valueLabel()(currentValue, max());
49
+ // use the clamped value so aria-valuetext stays consistent with aria-valuenow
50
+ return valueLabel()(currentValue, max(), min());
36
51
  }, ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
37
52
  const labelId = signal(undefined, ...(ngDevMode ? [{ debugName: "labelId" }] : /* istanbul ignore next */ []));
38
53
  function setLabel(id) {
@@ -42,9 +57,10 @@ const [NgpProgressStateToken, ngpProgress, injectProgressState, provideProgressS
42
57
  attrBinding(element, 'role', 'progressbar');
43
58
  attrBinding(element, 'id', id);
44
59
  attrBinding(element, 'aria-valuemax', max);
45
- attrBinding(element, 'aria-valuemin', 0);
46
- attrBinding(element, 'aria-valuenow', value);
47
- attrBinding(element, 'aria-valuetext', valueText);
60
+ attrBinding(element, 'aria-valuemin', min);
61
+ attrBinding(element, 'aria-valuenow', valueNow);
62
+ // omit the attribute entirely while indeterminate rather than binding an empty string
63
+ attrBinding(element, 'aria-valuetext', () => (indeterminate() ? null : valueText()));
48
64
  attrBinding(element, 'aria-labelledby', () => (labelId() ? labelId() : null));
49
65
  dataBinding(element, 'data-progressing', () => progressing());
50
66
  dataBinding(element, 'data-indeterminate', () => indeterminate());
@@ -82,7 +98,15 @@ const [NgpProgressIndicatorStateToken, ngpProgressIndicator] = createPrimitive('
82
98
  const min = state().min();
83
99
  const max = state().max();
84
100
  const value = state().value();
85
- return value === null ? null : ((value - min) / (max - min)) * 100;
101
+ if (value === null) {
102
+ return null;
103
+ }
104
+ // guard the zero-length range so we never divide by zero (NaN width)
105
+ if (max <= min) {
106
+ return value >= max ? 100 : 0;
107
+ }
108
+ // clamp so an out-of-range value can't push the bar past its track or negative
109
+ return Math.min(100, Math.max(0, ((value - min) / (max - min)) * 100));
86
110
  }, ...(ngDevMode ? [{ debugName: "percentage" }] : /* istanbul ignore next */ []));
87
111
  styleBinding(element, 'width.%', percentage);
88
112
  return {};
@@ -213,9 +237,10 @@ class NgpProgress {
213
237
  * Define a function that returns the progress value label.
214
238
  * @param value The current value
215
239
  * @param max The maximum value
240
+ * @param min The minimum value
216
241
  * @returns The value label
217
242
  */
218
- this.valueLabel = input((value, max) => `${Math.round((value / max) * 100)}%`, { ...(ngDevMode ? { debugName: "valueLabel" } : /* istanbul ignore next */ {}), alias: 'ngpProgressValueLabel' });
243
+ this.valueLabel = input((value, max, min) => `${max === min ? 0 : Math.round(((value - min) / (max - min)) * 100)}%`, { ...(ngDevMode ? { debugName: "valueLabel" } : /* istanbul ignore next */ {}), alias: 'ngpProgressValueLabel' });
219
244
  /**
220
245
  * The unique identifier for the progress.
221
246
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-progress.mjs","sources":["../../../../packages/ng-primitives/progress/src/progress/progress-state.ts","../../../../packages/ng-primitives/progress/src/progress-indicator/progress-indicator-state.ts","../../../../packages/ng-primitives/progress/src/progress-indicator/progress-indicator.ts","../../../../packages/ng-primitives/progress/src/progress-label/progress-label-state.ts","../../../../packages/ng-primitives/progress/src/progress-label/progress-label.ts","../../../../packages/ng-primitives/progress/src/progress-track/progress-track-state.ts","../../../../packages/ng-primitives/progress/src/progress-track/progress-track.ts","../../../../packages/ng-primitives/progress/src/progress-value/progress-value-state.ts","../../../../packages/ng-primitives/progress/src/progress-value/progress-value.ts","../../../../packages/ng-primitives/progress/src/progress/progress.ts","../../../../packages/ng-primitives/progress/src/ng-primitives-progress.ts"],"sourcesContent":["import { computed, signal, Signal, WritableSignal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n attrBinding,\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { NgpProgressValueTextFn } from './progress';\n\nexport interface NgpProgressProps {\n /**\n * The unique identifier for the progress.\n */\n readonly id?: Signal<string>;\n\n /**\n * Define the progress value.\n */\n readonly value?: Signal<number | null>;\n\n /**\n * Define the progress min value.\n * @default '0'\n */\n readonly min?: Signal<number>;\n\n /**\n * Define the progress max value.\n * @default 100\n */\n readonly max?: Signal<number>;\n\n /**\n * Define a function that returns the progress value label.\n * @param value The current value\n * @param max The maximum value\n * @returns The value label\n */\n readonly valueLabel?: Signal<NgpProgressValueTextFn>;\n}\n\nexport interface NgpProgressState {\n /**\n * The unique identifier for the progress.\n */\n readonly id: Signal<string>;\n\n /**\n * Define the progress value.\n */\n readonly value: WritableSignal<number | null>;\n\n /**\n * Define the progress min value.\n * @default '0'\n */\n readonly min: WritableSignal<number>;\n\n /**\n * Define the progress max value.\n * @default 100\n */\n readonly max: WritableSignal<number>;\n\n /**\n * Get the progress value text.\n */\n readonly valueText: Signal<string>;\n\n /**\n * The id of label associated with the progress bar.\n * @internal\n */\n readonly labelId: Signal<string | undefined>;\n\n /**\n * Determine if the progress is indeterminate.\n * @internal\n */\n readonly indeterminate: Signal<boolean>;\n\n /**\n * Determine if the progress is in a progressing state.\n * @internal\n */\n readonly progressing: Signal<boolean>;\n\n /**\n * Determine if the progress is complete.\n * @internal\n */\n readonly complete: Signal<boolean>;\n\n /**\n * Set the label of the progress bar.\n */\n setLabel(id: string): void;\n\n /**\n * Set the value of the progress bar.\n * @param value The progress value\n */\n setValue(value: number | null): void;\n\n /**\n * Set the minimum value of the progress bar.\n * @param min The minimum value\n */\n setMin(min: number): void;\n\n /**\n * Set the maximum value of the progress bar.\n * @param max The maximum value\n */\n setMax(max: number): void;\n}\n\nexport const [NgpProgressStateToken, ngpProgress, injectProgressState, provideProgressState] =\n createPrimitive(\n 'NgpProgress',\n ({\n valueLabel: _valueLabel = signal((value, max) => `${Math.round((value / max) * 100)}%`),\n value: _value = signal(null),\n min: _min = signal(0),\n max: _max = signal(100),\n id = signal(uniqueId('ngp-progress')),\n }: NgpProgressProps) => {\n const element = injectElementRef();\n\n // Controlled properties\n const value = controlled(_value);\n const min = controlled(_min);\n const max = controlled(_max);\n const valueLabel = controlled(_valueLabel);\n\n /**\n * Determine if the progress is indeterminate.\n * @internal\n */\n const indeterminate = computed(() => value() === null);\n\n /**\n * Determine if the progress is in a progressing state.\n */\n const progressing = computed(() => value() != null && value()! > 0 && value()! < max());\n\n /**\n * Determine if the progress is complete.\n */\n const complete = computed(() => !!(value() && max() && value() === max()));\n\n /**\n * Get the progress value text.\n */\n const valueText = computed(() => {\n const currentValue = value();\n\n if (currentValue == null) {\n return '';\n }\n\n return valueLabel()(currentValue, max());\n });\n\n const labelId = signal<string | undefined>(undefined);\n\n function setLabel(id: string) {\n labelId.set(id);\n }\n\n // Attribute bindings\n attrBinding(element, 'role', 'progressbar');\n attrBinding(element, 'id', id);\n attrBinding(element, 'aria-valuemax', max);\n attrBinding(element, 'aria-valuemin', 0);\n attrBinding(element, 'aria-valuenow', value);\n attrBinding(element, 'aria-valuetext', valueText);\n attrBinding(element, 'aria-labelledby', () => (labelId() ? labelId() : null));\n dataBinding(element, 'data-progressing', () => progressing());\n dataBinding(element, 'data-indeterminate', () => indeterminate());\n dataBinding(element, 'data-complete', () => complete());\n\n function setMax(newMax: number): void {\n max.set(newMax);\n }\n\n function setMin(newMin: number): void {\n min.set(newMin);\n }\n\n function setValue(newValue: number | null): void {\n value.set(newValue);\n }\n\n return {\n max: deprecatedSetter(max, 'setMax'),\n min: deprecatedSetter(min, 'setMin'),\n value: deprecatedSetter(value, 'setValue'),\n labelId: deprecatedSetter(labelId, 'setLabel'),\n valueText,\n id,\n indeterminate,\n progressing,\n complete,\n setLabel,\n setValue,\n setMin,\n setMax,\n } satisfies NgpProgressState;\n },\n );\n","import { computed } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, styleBinding } from 'ng-primitives/state';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressIndicatorState {}\n\nexport interface NgpProgressIndicatorProps {}\n\nexport const [NgpProgressIndicatorStateToken, ngpProgressIndicator] = createPrimitive(\n 'NgpProgressIndicator',\n ({}: NgpProgressIndicatorProps) => {\n const element = injectElementRef();\n\n const state = injectProgressState();\n\n const percentage = computed(() => {\n const min = state().min();\n const max = state().max();\n const value = state().value();\n return value === null ? null : ((value - min) / (max - min)) * 100;\n });\n\n styleBinding(element, 'width.%', percentage);\n\n return {} satisfies NgpProgressIndicatorState;\n },\n);\n","import { Directive } from '@angular/core';\nimport { ngpProgressIndicator } from './progress-indicator-state';\n\n/**\n * Apply the `ngpProgressIndicator` directive to an element that represents the current progress.\n * The width of this element can be set to the percentage of the progress value.\n */\n@Directive({\n selector: '[ngpProgressIndicator]',\n})\nexport class NgpProgressIndicator {\n constructor() {\n ngpProgressIndicator({});\n }\n}\n","import { signal, Signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressLabelState {}\n\nexport interface NgpProgressLabelProps {\n /**\n * The unique identifier for the progress label.\n */\n readonly id?: Signal<string>;\n}\n\nexport const [NgpProgressLabelStateToken, ngpProgressLabel] = createPrimitive(\n 'NgpProgressLabel',\n ({ id = signal(uniqueId('ngp-progress-label')) }: NgpProgressLabelProps) => {\n const element = injectElementRef();\n\n const state = injectProgressState();\n\n attrBinding(element, 'id', id);\n attrBinding(element, 'for', element.nativeElement.tagName === 'LABEL' ? state().id?.() : null);\n dataBinding(element, 'data-progressing', () => state().progressing());\n dataBinding(element, 'data-indeterminate', () => state().indeterminate());\n dataBinding(element, 'data-complete', () => state().complete());\n\n state().labelId.set(id());\n\n return {} satisfies NgpProgressLabelState;\n },\n);\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpProgressLabel } from './progress-label-state';\n\n@Directive({\n selector: '[ngpProgressLabel]',\n exportAs: 'ngpProgressLabel',\n})\nexport class NgpProgressLabel {\n /**\n * The unique identifier for the progress label.\n */\n readonly id = input<string>(uniqueId('ngp-progress-label'));\n\n constructor() {\n ngpProgressLabel({ id: this.id });\n }\n}\n","import { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressTrackState {}\n\nexport interface NgpProgressTrackProps {}\n\nexport const [NgpProgressTrackStateToken, ngpProgressTrack] = createPrimitive(\n 'NgpProgressTrack',\n ({}: NgpProgressTrackProps) => {\n const element = injectElementRef();\n const state = injectProgressState();\n\n dataBinding(element, 'data-progressing', () => state().progressing());\n dataBinding(element, 'data-indeterminate', () => state().indeterminate());\n dataBinding(element, 'data-complete', () => state().complete());\n\n return {} satisfies NgpProgressTrackState;\n },\n);\n","import { Directive } from '@angular/core';\nimport { ngpProgressTrack } from './progress-track-state';\n\n@Directive({\n selector: '[ngpProgressTrack]',\n exportAs: 'ngpProgressTrack',\n})\nexport class NgpProgressTrack {\n constructor() {\n ngpProgressTrack({});\n }\n}\n","import { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressValueState {}\n\nexport interface NgpProgressValueProps {}\n\nexport const [NgpProgressValueStateToken, ngpProgressValue] = createPrimitive(\n 'NgpProgressValue',\n ({}: NgpProgressValueProps) => {\n const element = injectElementRef();\n\n const state = injectProgressState();\n // Host bindings using helper functions\n attrBinding(element, 'aria-hidden', 'true');\n dataBinding(element, 'data-progressing', () => state().progressing());\n dataBinding(element, 'data-indeterminate', () => state().indeterminate());\n dataBinding(element, 'data-complete', () => state().complete());\n\n return {} satisfies NgpProgressValueState;\n },\n);\n","import { Directive } from '@angular/core';\nimport { ngpProgressValue } from './progress-value-state';\n\n@Directive({\n selector: '[ngpProgressValue]',\n exportAs: 'ngpProgressValue',\n})\nexport class NgpProgressValue {\n constructor() {\n ngpProgressValue({});\n }\n}\n","import { NumberInput } from '@angular/cdk/coercion';\nimport { Directive, input, numberAttribute } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpProgress, provideProgressState } from './progress-state';\n\n/**\n * Apply the `ngpProgress` directive to an element that represents the progress bar.\n */\n@Directive({\n selector: '[ngpProgress]',\n providers: [provideProgressState()],\n})\nexport class NgpProgress {\n /**\n * Define the progress value.\n */\n readonly value = input<number | null, NumberInput>(0, {\n alias: 'ngpProgressValue',\n transform: v => (v == null ? null : numberAttribute(v)),\n });\n\n /**\n * Define the progress min value.\n * @default '0'\n */\n readonly min = input<number, NumberInput>(0, {\n alias: 'ngpProgressMin',\n transform: numberAttribute,\n });\n\n /**\n * Define the progress max value.\n * @default 100\n */\n readonly max = input<number, NumberInput>(100, {\n alias: 'ngpProgressMax',\n transform: numberAttribute,\n });\n\n /**\n * Define a function that returns the progress value label.\n * @param value The current value\n * @param max The maximum value\n * @returns The value label\n */\n readonly valueLabel = input<NgpProgressValueTextFn>(\n (value, max) => `${Math.round((value / max) * 100)}%`,\n {\n alias: 'ngpProgressValueLabel',\n },\n );\n\n /**\n * The unique identifier for the progress.\n */\n readonly id = input<string>(uniqueId('ngp-progress'));\n\n /**\n * The state of the progress bar.\n * @internal\n */\n private readonly state = ngpProgress({\n value: this.value,\n min: this.min,\n max: this.max,\n valueLabel: this.valueLabel,\n id: this.id,\n });\n\n /**\n * Get the progress value text.\n */\n protected readonly valueText = this.state.valueText;\n}\n\nexport type NgpProgressValueTextFn = (value: number, max: number) => string;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAwHO,MAAM,CAAC,qBAAqB,EAAE,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,GAC1F,eAAe,CACb,aAAa,EACb,CAAC,EACC,UAAU,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,CAAA,EAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,EACvF,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,EAC5B,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,EACvB,EAAE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A,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAFX,CAAC,oBAAoB,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAExB,WAAW,EAAA,UAAA,EAAA,CAAA;kBAJvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;AACpC,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-progress.mjs","sources":["../../../../packages/ng-primitives/progress/src/progress/progress-state.ts","../../../../packages/ng-primitives/progress/src/progress-indicator/progress-indicator-state.ts","../../../../packages/ng-primitives/progress/src/progress-indicator/progress-indicator.ts","../../../../packages/ng-primitives/progress/src/progress-label/progress-label-state.ts","../../../../packages/ng-primitives/progress/src/progress-label/progress-label.ts","../../../../packages/ng-primitives/progress/src/progress-track/progress-track-state.ts","../../../../packages/ng-primitives/progress/src/progress-track/progress-track.ts","../../../../packages/ng-primitives/progress/src/progress-value/progress-value-state.ts","../../../../packages/ng-primitives/progress/src/progress-value/progress-value.ts","../../../../packages/ng-primitives/progress/src/progress/progress.ts","../../../../packages/ng-primitives/progress/src/ng-primitives-progress.ts"],"sourcesContent":["import { computed, signal, Signal, WritableSignal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n attrBinding,\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { NgpProgressValueTextFn } from './progress';\n\nexport interface NgpProgressProps {\n /**\n * The unique identifier for the progress.\n */\n readonly id?: Signal<string>;\n\n /**\n * Define the progress value.\n */\n readonly value?: Signal<number | null>;\n\n /**\n * Define the progress min value.\n * @default '0'\n */\n readonly min?: Signal<number>;\n\n /**\n * Define the progress max value.\n * @default 100\n */\n readonly max?: Signal<number>;\n\n /**\n * Define a function that returns the progress value label.\n * @param value The current value\n * @param max The maximum value\n * @returns The value label\n */\n readonly valueLabel?: Signal<NgpProgressValueTextFn>;\n}\n\nexport interface NgpProgressState {\n /**\n * The unique identifier for the progress.\n */\n readonly id: Signal<string>;\n\n /**\n * Define the progress value.\n */\n readonly value: WritableSignal<number | null>;\n\n /**\n * Define the progress min value.\n * @default '0'\n */\n readonly min: WritableSignal<number>;\n\n /**\n * Define the progress max value.\n * @default 100\n */\n readonly max: WritableSignal<number>;\n\n /**\n * Get the progress value text. An empty string while the progress is\n * indeterminate (the `aria-valuetext` attribute is omitted in that case).\n */\n readonly valueText: Signal<string>;\n\n /**\n * The id of label associated with the progress bar.\n * @internal\n */\n readonly labelId: Signal<string | undefined>;\n\n /**\n * Determine if the progress is indeterminate.\n * @internal\n */\n readonly indeterminate: Signal<boolean>;\n\n /**\n * Determine if the progress is in a progressing state.\n * @internal\n */\n readonly progressing: Signal<boolean>;\n\n /**\n * Determine if the progress is complete.\n * @internal\n */\n readonly complete: Signal<boolean>;\n\n /**\n * Set the label of the progress bar.\n */\n setLabel(id: string): void;\n\n /**\n * Set the value of the progress bar.\n * @param value The progress value\n */\n setValue(value: number | null): void;\n\n /**\n * Set the minimum value of the progress bar.\n * @param min The minimum value\n */\n setMin(min: number): void;\n\n /**\n * Set the maximum value of the progress bar.\n * @param max The maximum value\n */\n setMax(max: number): void;\n}\n\nexport const [NgpProgressStateToken, ngpProgress, injectProgressState, provideProgressState] =\n createPrimitive(\n 'NgpProgress',\n ({\n valueLabel: _valueLabel = signal(\n (value, max, min) =>\n `${max === min ? 0 : Math.round(((value - min) / (max - min)) * 100)}%`,\n ),\n value: _value = signal(null),\n min: _min = signal(0),\n max: _max = signal(100),\n id = signal(uniqueId('ngp-progress')),\n }: NgpProgressProps) => {\n const element = injectElementRef();\n\n // Controlled properties\n const value = controlled(_value);\n const min = controlled(_min);\n const max = controlled(_max);\n const valueLabel = controlled(_valueLabel);\n\n /**\n * Determine if the progress is indeterminate.\n * @internal\n */\n const indeterminate = computed(() => value() === null);\n\n /**\n * Determine if the progress is in a progressing state.\n */\n const progressing = computed(\n () => !indeterminate() && valueNow()! > min() && valueNow()! < max(),\n );\n\n /**\n * Determine if the progress is complete.\n */\n const complete = computed(() => !indeterminate() && valueNow()! >= max() && max() > min());\n\n /**\n * The raw value exposed via `aria-valuenow`, clamped to the [min, max] range.\n * Per the ARIA progressbar pattern, `aria-valuenow` is the actual value on the\n * same scale as `aria-valuemin`/`aria-valuemax`, not a 0-100 percentage. It is\n * omitted entirely (null) while the progress is indeterminate.\n */\n const valueNow = computed(() => {\n const currentValue = value();\n\n if (currentValue == null) {\n return null;\n }\n\n return Math.min(Math.max(currentValue, min()), max());\n });\n\n /**\n * Get the progress value text. Empty while indeterminate; the\n * aria-valuetext binding omits the attribute in that case.\n */\n const valueText = computed(() => {\n const currentValue = valueNow();\n\n if (currentValue == null) {\n return '';\n }\n\n // use the clamped value so aria-valuetext stays consistent with aria-valuenow\n return valueLabel()(currentValue, max(), min());\n });\n\n const labelId = signal<string | undefined>(undefined);\n\n function setLabel(id: string) {\n labelId.set(id);\n }\n\n // Attribute bindings\n attrBinding(element, 'role', 'progressbar');\n attrBinding(element, 'id', id);\n attrBinding(element, 'aria-valuemax', max);\n attrBinding(element, 'aria-valuemin', min);\n attrBinding(element, 'aria-valuenow', valueNow);\n // omit the attribute entirely while indeterminate rather than binding an empty string\n attrBinding(element, 'aria-valuetext', () => (indeterminate() ? null : valueText()));\n attrBinding(element, 'aria-labelledby', () => (labelId() ? labelId() : null));\n dataBinding(element, 'data-progressing', () => progressing());\n dataBinding(element, 'data-indeterminate', () => indeterminate());\n dataBinding(element, 'data-complete', () => complete());\n\n function setMax(newMax: number): void {\n max.set(newMax);\n }\n\n function setMin(newMin: number): void {\n min.set(newMin);\n }\n\n function setValue(newValue: number | null): void {\n value.set(newValue);\n }\n\n return {\n max: deprecatedSetter(max, 'setMax'),\n min: deprecatedSetter(min, 'setMin'),\n value: deprecatedSetter(value, 'setValue'),\n labelId: deprecatedSetter(labelId, 'setLabel'),\n valueText,\n id,\n indeterminate,\n progressing,\n complete,\n setLabel,\n setValue,\n setMin,\n setMax,\n } satisfies NgpProgressState;\n },\n );\n","import { computed } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, styleBinding } from 'ng-primitives/state';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressIndicatorState {}\n\nexport interface NgpProgressIndicatorProps {}\n\nexport const [NgpProgressIndicatorStateToken, ngpProgressIndicator] = createPrimitive(\n 'NgpProgressIndicator',\n ({}: NgpProgressIndicatorProps) => {\n const element = injectElementRef();\n\n const state = injectProgressState();\n\n const percentage = computed(() => {\n const min = state().min();\n const max = state().max();\n const value = state().value();\n if (value === null) {\n return null;\n }\n // guard the zero-length range so we never divide by zero (NaN width)\n if (max <= min) {\n return value >= max ? 100 : 0;\n }\n // clamp so an out-of-range value can't push the bar past its track or negative\n return Math.min(100, Math.max(0, ((value - min) / (max - min)) * 100));\n });\n\n styleBinding(element, 'width.%', percentage);\n\n return {} satisfies NgpProgressIndicatorState;\n },\n);\n","import { Directive } from '@angular/core';\nimport { ngpProgressIndicator } from './progress-indicator-state';\n\n/**\n * Apply the `ngpProgressIndicator` directive to an element that represents the current progress.\n * The width of this element can be set to the percentage of the progress value.\n */\n@Directive({\n selector: '[ngpProgressIndicator]',\n})\nexport class NgpProgressIndicator {\n constructor() {\n ngpProgressIndicator({});\n }\n}\n","import { signal, Signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressLabelState {}\n\nexport interface NgpProgressLabelProps {\n /**\n * The unique identifier for the progress label.\n */\n readonly id?: Signal<string>;\n}\n\nexport const [NgpProgressLabelStateToken, ngpProgressLabel] = createPrimitive(\n 'NgpProgressLabel',\n ({ id = signal(uniqueId('ngp-progress-label')) }: NgpProgressLabelProps) => {\n const element = injectElementRef();\n\n const state = injectProgressState();\n\n attrBinding(element, 'id', id);\n attrBinding(element, 'for', element.nativeElement.tagName === 'LABEL' ? state().id?.() : null);\n dataBinding(element, 'data-progressing', () => state().progressing());\n dataBinding(element, 'data-indeterminate', () => state().indeterminate());\n dataBinding(element, 'data-complete', () => state().complete());\n\n state().labelId.set(id());\n\n return {} satisfies NgpProgressLabelState;\n },\n);\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpProgressLabel } from './progress-label-state';\n\n@Directive({\n selector: '[ngpProgressLabel]',\n exportAs: 'ngpProgressLabel',\n})\nexport class NgpProgressLabel {\n /**\n * The unique identifier for the progress label.\n */\n readonly id = input<string>(uniqueId('ngp-progress-label'));\n\n constructor() {\n ngpProgressLabel({ id: this.id });\n }\n}\n","import { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressTrackState {}\n\nexport interface NgpProgressTrackProps {}\n\nexport const [NgpProgressTrackStateToken, ngpProgressTrack] = createPrimitive(\n 'NgpProgressTrack',\n ({}: NgpProgressTrackProps) => {\n const element = injectElementRef();\n const state = injectProgressState();\n\n dataBinding(element, 'data-progressing', () => state().progressing());\n dataBinding(element, 'data-indeterminate', () => state().indeterminate());\n dataBinding(element, 'data-complete', () => state().complete());\n\n return {} satisfies NgpProgressTrackState;\n },\n);\n","import { Directive } from '@angular/core';\nimport { ngpProgressTrack } from './progress-track-state';\n\n@Directive({\n selector: '[ngpProgressTrack]',\n exportAs: 'ngpProgressTrack',\n})\nexport class NgpProgressTrack {\n constructor() {\n ngpProgressTrack({});\n }\n}\n","import { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectProgressState } from '../progress/progress-state';\n\nexport interface NgpProgressValueState {}\n\nexport interface NgpProgressValueProps {}\n\nexport const [NgpProgressValueStateToken, ngpProgressValue] = createPrimitive(\n 'NgpProgressValue',\n ({}: NgpProgressValueProps) => {\n const element = injectElementRef();\n\n const state = injectProgressState();\n // Host bindings using helper functions\n attrBinding(element, 'aria-hidden', 'true');\n dataBinding(element, 'data-progressing', () => state().progressing());\n dataBinding(element, 'data-indeterminate', () => state().indeterminate());\n dataBinding(element, 'data-complete', () => state().complete());\n\n return {} satisfies NgpProgressValueState;\n },\n);\n","import { Directive } from '@angular/core';\nimport { ngpProgressValue } from './progress-value-state';\n\n@Directive({\n selector: '[ngpProgressValue]',\n exportAs: 'ngpProgressValue',\n})\nexport class NgpProgressValue {\n constructor() {\n ngpProgressValue({});\n }\n}\n","import { NumberInput } from '@angular/cdk/coercion';\nimport { Directive, input, numberAttribute } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpProgress, provideProgressState } from './progress-state';\n\n/**\n * Apply the `ngpProgress` directive to an element that represents the progress bar.\n */\n@Directive({\n selector: '[ngpProgress]',\n providers: [provideProgressState()],\n})\nexport class NgpProgress {\n /**\n * Define the progress value.\n */\n readonly value = input<number | null, NumberInput>(0, {\n alias: 'ngpProgressValue',\n transform: v => (v == null ? null : numberAttribute(v)),\n });\n\n /**\n * Define the progress min value.\n * @default '0'\n */\n readonly min = input<number, NumberInput>(0, {\n alias: 'ngpProgressMin',\n transform: numberAttribute,\n });\n\n /**\n * Define the progress max value.\n * @default 100\n */\n readonly max = input<number, NumberInput>(100, {\n alias: 'ngpProgressMax',\n transform: numberAttribute,\n });\n\n /**\n * Define a function that returns the progress value label.\n * @param value The current value\n * @param max The maximum value\n * @param min The minimum value\n * @returns The value label\n */\n readonly valueLabel = input<NgpProgressValueTextFn>(\n (value, max, min) => `${max === min ? 0 : Math.round(((value - min) / (max - min)) * 100)}%`,\n {\n alias: 'ngpProgressValueLabel',\n },\n );\n\n /**\n * The unique identifier for the progress.\n */\n readonly id = input<string>(uniqueId('ngp-progress'));\n\n /**\n * The state of the progress bar.\n * @internal\n */\n private readonly state = ngpProgress({\n value: this.value,\n min: this.min,\n max: this.max,\n valueLabel: this.valueLabel,\n id: this.id,\n });\n\n /**\n * Get the progress value text.\n */\n protected readonly valueText = this.state.valueText;\n}\n\nexport type NgpProgressValueTextFn = (value: number, max: number, min: number) => string;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAyHa,CAAC,qBAAqB,EAAE,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,GAC1F,eAAe,CACb,aAAa,EACb,CAAC,EACC,UAAU,EAAE,WAAW,GAAG,MAAM,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,KACd,CAAA,EAAG,GAAG,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA,CAAA,CAAG,CAC1E,EACD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,EAC5B,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,EACrB,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,EACvB,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,GACpB,KAAI;AACrB,IAAA,MAAM,OAAO,GAAG,gBAAgB,EAAE;;AAGlC,IAAA,MAAM,KAAK,GAAG,UAAU,CAA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EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,GAAA,EAAA,EAAA,iBAAA,EAAA,KAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,GAAA,EAAA,EAAA,iBAAA,EAAA,KAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAFX,CAAC,oBAAoB,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAExB,WAAW,EAAA,UAAA,EAAA,CAAA;kBAJvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;AACpC,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -29,7 +29,9 @@ const [NgpRovingFocusGroupStateToken, ngpRovingFocusGroup, injectRovingFocusGrou
29
29
  });
30
30
  }
31
31
  /**
32
- * Store the active item in the roving focus group.
32
+ * Store the active item in the roving focus group. This is the single source
33
+ * of truth for the tab stop; items push to it via setActiveItem when they
34
+ * become active (e.g. the selected tab), and roving navigation updates it too.
33
35
  */
34
36
  const activeItem = signal(null, ...(ngDevMode ? [{ debugName: "activeItem" }] : /* istanbul ignore next */ []));
35
37
  /**
@@ -44,6 +46,10 @@ const [NgpRovingFocusGroupStateToken, ngpRovingFocusGroup, injectRovingFocusGrou
44
46
  item.focus(origin);
45
47
  }
46
48
  }
49
+ // set the tab stop without moving focus (see interface docs)
50
+ function setTabStop(id) {
51
+ activeItem.set(id);
52
+ }
47
53
  /**
48
54
  * Activate the first item in the roving focus group.
49
55
  * @param origin The origin of the focus change
@@ -186,7 +192,11 @@ const [NgpRovingFocusGroupStateToken, ngpRovingFocusGroup, injectRovingFocusGrou
186
192
  }
187
193
  function register(item) {
188
194
  items.update(items => [...items, item]);
189
- // if there is no active item, make the first item the tabbable item
195
+ // seed the first non-disabled item as the tab stop; an active item (e.g. the
196
+ // selected tab) overrides this by pushing to setActiveItem once it registers.
197
+ if (item.disabled()) {
198
+ return;
199
+ }
190
200
  if (!activeItem()) {
191
201
  activeItem.set(item.id());
192
202
  }
@@ -218,6 +228,7 @@ const [NgpRovingFocusGroupStateToken, ngpRovingFocusGroup, injectRovingFocusGrou
218
228
  disabled,
219
229
  activeItem,
220
230
  setActiveItem,
231
+ setTabStop,
221
232
  setOrientation,
222
233
  onKeydown,
223
234
  register,
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { inject, signal, Signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { controlled, createPrimitive, injectInheritedState } from 'ng-primitives/state';\nimport type { NgpRovingFocusItemState } from '../roving-focus-item/roving-focus-item-state';\n\nexport interface NgpRovingFocusGroupState {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The id of the currently active item.\n */\n readonly activeItem: Signal<string | null>;\n /**\n * Handle keyboard navigation.\n * @param event The keyboard event\n */\n onKeydown(event: KeyboardEvent): void;\n /**\n * Set the active item by id.\n * @param id The id of the item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(id: string | null, origin?: FocusOrigin): void;\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n */\n register(item: NgpRovingFocusItemState): void;\n /**\n * Unregister an item from the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItemState): void;\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation value\n */\n setOrientation(orientation: NgpOrientation): void;\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateFirst(origin?: FocusOrigin): void;\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateLast(origin?: FocusOrigin): void;\n}\n\nexport interface NgpRovingFocusGroupProps {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation?: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap?: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd?: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Whether to inherit state from a parent roving focus group.\n */\n readonly inherit?: boolean;\n}\n\nexport const [\n NgpRovingFocusGroupStateToken,\n ngpRovingFocusGroup,\n injectRovingFocusGroupState,\n provideRovingFocusGroupState,\n] = createPrimitive(\n 'NgpRovingFocusGroup',\n ({\n orientation: _orientation = signal('vertical'),\n wrap = signal(false),\n homeEnd = signal(true),\n disabled = signal(false),\n inherit = true,\n }: NgpRovingFocusGroupProps): NgpRovingFocusGroupState => {\n const parentGroup = inherit\n ? injectInheritedState(() => NgpRovingFocusGroupStateToken)?.()\n : null;\n\n if (parentGroup) {\n return parentGroup;\n }\n\n const directionality = inject(Directionality);\n const items = signal<NgpRovingFocusItemState[]>([]);\n const orientation = controlled(_orientation);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n function getSortedItems() {\n return items().sort((a, b) => {\n // sort the items by their position in the document\n return a.element.nativeElement.compareDocumentPosition(b.element.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group.\n */\n const activeItem = signal<string | null>(null);\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n function setActiveItem(id: string | null, origin: FocusOrigin = 'program'): void {\n activeItem.set(id);\n const item = items().find(i => i.id() === id) ?? null;\n\n if (item) {\n item.focus(origin);\n }\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = getSortedItems().find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...getSortedItems()].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateNextItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the first item\n if (!currentActiveItem) {\n activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the next item that is not disabled\n const item = sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && wrap()) {\n activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activatePreviousItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the last item\n if (!currentActiveItem) {\n activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the previous item that is not disabled\n const item =\n sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && wrap()) {\n activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n */\n function onKeydown(event: KeyboardEvent): void {\n if (disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activatePreviousItem('keyboard');\n } else {\n activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activateNextItem('keyboard');\n } else {\n activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (homeEnd()) {\n event.preventDefault();\n activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (homeEnd()) {\n event.preventDefault();\n activateLastItem('keyboard');\n }\n break;\n }\n }\n\n function register(item: NgpRovingFocusItemState): void {\n items.update(items => [...items, item]);\n\n // if there is no active item, make the first item the tabbable item\n if (!activeItem()) {\n activeItem.set(item.id());\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n function unregister(item: NgpRovingFocusItemState): void {\n items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (activeItem() === item.id()) {\n // if the active item is unregistered, activate the first item\n activeItem.set(items()[0]?.id() ?? null);\n }\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param value The orientation value\n */\n function setOrientation(value: NgpOrientation): void {\n orientation.set(value);\n }\n\n return {\n orientation: orientation.asReadonly(),\n wrap,\n homeEnd,\n disabled,\n activeItem,\n setActiveItem,\n setOrientation,\n onKeydown,\n register,\n unregister,\n activateFirst: activateFirstItem,\n activateLast: activateLastItem,\n } satisfies NgpRovingFocusGroupState;\n },\n);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n /**\n * Whether we should inherit the focus group from the parent\n * @default true\n */\n inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n type: Type<NgpRovingFocusGroup>,\n { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n return {\n provide: NgpRovingFocusGroupToken,\n // Roving focus groups may be nested, in this case, the parent group should be used\n useFactory: () => {\n if (!inherit) {\n return inject(type, { self: true });\n }\n\n // If the parent group is not found, return the current group\n // This is useful for nested groups\n return (\n inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n inject(type, { self: true })\n );\n },\n };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { ngpRovingFocusGroup, provideRovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [\n provideRovingFocusGroup(NgpRovingFocusGroup),\n provideRovingFocusGroupState({ inherit: true }),\n ],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = input<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * The state of the roving focus group.\n */\n readonly state = ngpRovingFocusGroup({\n orientation: this.orientation,\n wrap: this.wrap,\n homeEnd: this.homeEnd,\n disabled: this.disabled,\n });\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n if (item) {\n this.state.setActiveItem(item.id(), origin);\n }\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { computed, effect, ElementRef, inject, signal, Signal, untracked } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, listener } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectRovingFocusGroupState } from '../roving-focus-group/roving-focus-group-state';\n\n/**\n * The state interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemState {\n /**\n * The unique id of the roving focus item.\n */\n readonly id: Signal<string>;\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The tabindex of the roving focus item.\n */\n readonly tabindex: Signal<number>;\n /**\n * The element reference of the roving focus item.\n */\n readonly element: ElementRef<HTMLElement>;\n /**\n * Focus the roving focus item.\n * @param origin The focus origin\n */\n focus(origin: FocusOrigin): void;\n}\n\n/**\n * The props interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemProps {\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\nexport const [\n NgpRovingFocusItemStateToken,\n ngpRovingFocusItem,\n injectRovingFocusItemState,\n provideRovingFocusItemState,\n] = createPrimitive(\n 'NgpRovingFocusItem',\n ({ disabled = signal(false) }: NgpRovingFocusItemProps) => {\n const element = injectElementRef();\n const group = injectRovingFocusGroupState();\n const focusMonitor = inject(FocusMonitor);\n\n // genertate a unique id for the roving focus item - this is not a DOM id but an internal identifier\n const id = uniqueId('ngp-roving-focus-item');\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n const tabindex = computed(() =>\n !group()?.disabled() && group()?.activeItem() === id ? 0 : -1,\n );\n\n // Setup host attribute bindings\n attrBinding(element, 'tabindex', () => tabindex().toString());\n\n // Setup keyboard event listener\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (disabled()) {\n return;\n }\n group()?.onKeydown(event);\n });\n\n // Setup click event listener\n listener(element, 'click', () => {\n if (disabled()) {\n return;\n }\n group()?.setActiveItem(id, 'mouse');\n });\n\n function focus(origin: FocusOrigin): void {\n focusMonitor.focusVia(element, origin);\n }\n\n const state: NgpRovingFocusItemState = {\n id: signal(id),\n disabled,\n tabindex,\n focus,\n element,\n };\n\n // Projected items may construct before the parent populates the shared group signal,\n // so register reactively once it becomes available.\n // See https://github.com/ng-primitives/ng-primitives/issues/735\n effect(onCleanup => {\n const groupState = group();\n if (!groupState) return;\n untracked(() => groupState.register(state));\n onCleanup(() => groupState.unregister(state));\n });\n\n return state satisfies NgpRovingFocusItemState;\n },\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input } from '@angular/core';\nimport { ngpRovingFocusItem, provideRovingFocusItemState } from './roving-focus-item-state';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n providers: [provideRovingFocusItemState()],\n})\nexport class NgpRovingFocusItem {\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n private readonly state = ngpRovingFocusItem({ disabled: this.disabled });\n\n /**\n * Expose the internal id of the roving focus item.\n * @internal\n */\n readonly id = computed(() => this.state.id());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AA0FO,MAAM,CACX,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,GAAG,eAAe,CACjB,qBAAqB,EACrB,CAAC,EACC,WAAW,EAAE,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,EAC9C,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EACpB,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EACtB,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EACxB,OAAO,GAAG,IAAI,GACW,KAA8B;IACvD,MAAM,WAAW,GAAG;UAChB,oBAAoB,CAAC,MAAM,6BAA6B,CAAC;UACzD,IAAI;IAER,IAAI,WAAW,EAAE;AACf,QAAA,OAAO,WAAW;IACpB;AAEA,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAC7C,IAAA,MAAM,KAAK,GAAG,MAAM,CAA4B,EAAE,4EAAC;AACnD,IAAA,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,CAAC;AAE5C;;AAEG;AACH,IAAA,SAAS,cAAc,GAAA;QACrB,OAAO,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAI;;AAE3B,YAAA,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;AAC7E,gBAAA,IAAI,CAAC;kBACH,CAAC;kBACD,CAAC;AACP,QAAA,CAAC,CAAC;IACJ;AAEA;;AAEG;AACH,IAAA,MAAM,UAAU,GAAG,MAAM,CAAgB,IAAI,iFAAC;AAE9C;;;;AAIG;AACH,IAAA,SAAS,aAAa,CAAC,EAAiB,EAAE,SAAsB,SAAS,EAAA;AACvE,QAAA,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,M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A,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,4BAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAFlB,CAAC,2BAA2B,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAE/B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,SAAS,EAAE,CAAC,2BAA2B,EAAE,CAAC;AAC3C,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { inject, signal, Signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { controlled, createPrimitive, injectInheritedState } from 'ng-primitives/state';\nimport type { NgpRovingFocusItemState } from '../roving-focus-item/roving-focus-item-state';\n\nexport interface NgpRovingFocusGroupState {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The id of the currently active item.\n */\n readonly activeItem: Signal<string | null>;\n /**\n * Handle keyboard navigation.\n * @param event The keyboard event\n */\n onKeydown(event: KeyboardEvent): void;\n /**\n * Set the active item by id.\n * @param id The id of the item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(id: string | null, origin?: FocusOrigin): void;\n /**\n * Set which item holds the tab stop without moving focus. Used by items that\n * declare themselves active (e.g. the selected tab) to claim the tab stop\n * without stealing focus.\n * @param id The id of the item that should hold the tab stop.\n */\n setTabStop(id: string | null): void;\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n */\n register(item: NgpRovingFocusItemState): void;\n /**\n * Unregister an item from the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItemState): void;\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation value\n */\n setOrientation(orientation: NgpOrientation): void;\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateFirst(origin?: FocusOrigin): void;\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateLast(origin?: FocusOrigin): void;\n}\n\nexport interface NgpRovingFocusGroupProps {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation?: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap?: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd?: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Whether to inherit state from a parent roving focus group.\n */\n readonly inherit?: boolean;\n}\n\nexport const [\n NgpRovingFocusGroupStateToken,\n ngpRovingFocusGroup,\n injectRovingFocusGroupState,\n provideRovingFocusGroupState,\n] = createPrimitive(\n 'NgpRovingFocusGroup',\n ({\n orientation: _orientation = signal('vertical'),\n wrap = signal(false),\n homeEnd = signal(true),\n disabled = signal(false),\n inherit = true,\n }: NgpRovingFocusGroupProps): NgpRovingFocusGroupState => {\n const parentGroup = inherit\n ? injectInheritedState(() => NgpRovingFocusGroupStateToken)?.()\n : null;\n\n if (parentGroup) {\n return parentGroup;\n }\n\n const directionality = inject(Directionality);\n const items = signal<NgpRovingFocusItemState[]>([]);\n const orientation = controlled(_orientation);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n function getSortedItems() {\n return items().sort((a, b) => {\n // sort the items by their position in the document\n return a.element.nativeElement.compareDocumentPosition(b.element.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group. This is the single source\n * of truth for the tab stop; items push to it via setActiveItem when they\n * become active (e.g. the selected tab), and roving navigation updates it too.\n */\n const activeItem = signal<string | null>(null);\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n function setActiveItem(id: string | null, origin: FocusOrigin = 'program'): void {\n activeItem.set(id);\n const item = items().find(i => i.id() === id) ?? null;\n\n if (item) {\n item.focus(origin);\n }\n }\n\n // set the tab stop without moving focus (see interface docs)\n function setTabStop(id: string | null): void {\n activeItem.set(id);\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = getSortedItems().find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...getSortedItems()].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateNextItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the first item\n if (!currentActiveItem) {\n activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the next item that is not disabled\n const item = sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && wrap()) {\n activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activatePreviousItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the last item\n if (!currentActiveItem) {\n activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the previous item that is not disabled\n const item =\n sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && wrap()) {\n activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n */\n function onKeydown(event: KeyboardEvent): void {\n if (disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activatePreviousItem('keyboard');\n } else {\n activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activateNextItem('keyboard');\n } else {\n activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (homeEnd()) {\n event.preventDefault();\n activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (homeEnd()) {\n event.preventDefault();\n activateLastItem('keyboard');\n }\n break;\n }\n }\n\n function register(item: NgpRovingFocusItemState): void {\n items.update(items => [...items, item]);\n\n // seed the first non-disabled item as the tab stop; an active item (e.g. the\n // selected tab) overrides this by pushing to setActiveItem once it registers.\n if (item.disabled()) {\n return;\n }\n if (!activeItem()) {\n activeItem.set(item.id());\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n function unregister(item: NgpRovingFocusItemState): void {\n items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (activeItem() === item.id()) {\n // if the active item is unregistered, activate the first item\n activeItem.set(items()[0]?.id() ?? null);\n }\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param value The orientation value\n */\n function setOrientation(value: NgpOrientation): void {\n orientation.set(value);\n }\n\n return {\n orientation: orientation.asReadonly(),\n wrap,\n homeEnd,\n disabled,\n activeItem,\n setActiveItem,\n setTabStop,\n setOrientation,\n onKeydown,\n register,\n unregister,\n activateFirst: activateFirstItem,\n activateLast: activateLastItem,\n } satisfies NgpRovingFocusGroupState;\n },\n);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n /**\n * Whether we should inherit the focus group from the parent\n * @default true\n */\n inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n type: Type<NgpRovingFocusGroup>,\n { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n return {\n provide: NgpRovingFocusGroupToken,\n // Roving focus groups may be nested, in this case, the parent group should be used\n useFactory: () => {\n if (!inherit) {\n return inject(type, { self: true });\n }\n\n // If the parent group is not found, return the current group\n // This is useful for nested groups\n return (\n inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n inject(type, { self: true })\n );\n },\n };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { ngpRovingFocusGroup, provideRovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [\n provideRovingFocusGroup(NgpRovingFocusGroup),\n provideRovingFocusGroupState({ inherit: true }),\n ],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = input<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * The state of the roving focus group.\n */\n readonly state = ngpRovingFocusGroup({\n orientation: this.orientation,\n wrap: this.wrap,\n homeEnd: this.homeEnd,\n disabled: this.disabled,\n });\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n if (item) {\n this.state.setActiveItem(item.id(), origin);\n }\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { computed, effect, ElementRef, inject, signal, Signal, untracked } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, listener } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectRovingFocusGroupState } from '../roving-focus-group/roving-focus-group-state';\n\n/**\n * The state interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemState {\n /**\n * The unique id of the roving focus item.\n */\n readonly id: Signal<string>;\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The tabindex of the roving focus item.\n */\n readonly tabindex: Signal<number>;\n /**\n * The element reference of the roving focus item.\n */\n readonly element: ElementRef<HTMLElement>;\n /**\n * Focus the roving focus item.\n * @param origin The focus origin\n */\n focus(origin: FocusOrigin): void;\n}\n\n/**\n * The props interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemProps {\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\nexport const [\n NgpRovingFocusItemStateToken,\n ngpRovingFocusItem,\n injectRovingFocusItemState,\n provideRovingFocusItemState,\n] = createPrimitive(\n 'NgpRovingFocusItem',\n ({ disabled = signal(false) }: NgpRovingFocusItemProps) => {\n const element = injectElementRef();\n const group = injectRovingFocusGroupState();\n const focusMonitor = inject(FocusMonitor);\n\n // genertate a unique id for the roving focus item - this is not a DOM id but an internal identifier\n const id = uniqueId('ngp-roving-focus-item');\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n const tabindex = computed(() =>\n !group()?.disabled() && group()?.activeItem() === id ? 0 : -1,\n );\n\n // Setup host attribute bindings\n attrBinding(element, 'tabindex', () => tabindex().toString());\n\n // Setup keyboard event listener\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (disabled()) {\n return;\n }\n group()?.onKeydown(event);\n });\n\n // Setup click event listener\n listener(element, 'click', () => {\n if (disabled()) {\n return;\n }\n group()?.setActiveItem(id, 'mouse');\n });\n\n function focus(origin: FocusOrigin): void {\n focusMonitor.focusVia(element, origin);\n }\n\n const state: NgpRovingFocusItemState = {\n id: signal(id),\n disabled,\n tabindex,\n focus,\n element,\n };\n\n // Projected items may construct before the parent populates the shared group signal,\n // so register reactively once it becomes available.\n // See https://github.com/ng-primitives/ng-primitives/issues/735\n effect(onCleanup => {\n const groupState = group();\n if (!groupState) return;\n untracked(() => groupState.register(state));\n onCleanup(() => groupState.unregister(state));\n });\n\n return state satisfies NgpRovingFocusItemState;\n },\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input } from '@angular/core';\nimport { ngpRovingFocusItem, provideRovingFocusItemState } from './roving-focus-item-state';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n providers: [provideRovingFocusItemState()],\n})\nexport class NgpRovingFocusItem {\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n private readonly state = ngpRovingFocusItem({ disabled: this.disabled });\n\n /**\n * Expose the internal id of the roving focus item.\n * @internal\n */\n readonly id = computed(() => this.state.id());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAiGO,MAAM,CACX,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,GAAG,eAAe,CACjB,qBAAqB,EACrB,CAAC,EACC,WAAW,EAAE,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,EAC9C,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EACpB,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EACtB,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EACxB,OAAO,GAAG,IAAI,GACW,KAA8B;IACvD,MAAM,WAAW,GAAG;UAChB,oBAAoB,CAAC,MAAM,6BAA6B,CAAC;UACzD,IAAI;IAER,IAAI,WAAW,EAAE;AACf,QAAA,OAAO,WAAW;IACpB;AAEA,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAC7C,IAAA,MAAM,KAAK,GAAG,MAAM,CAA4B,EAAE,4EAAC;AACnD,IAAA,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,CAAC;AAE5C;;AAEG;AACH,IAAA,SAAS,cAAc,GAAA;QACrB,OAAO,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAI;;AAE3B,YAAA,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;AAC7E,gBAAA,IAAI,CAAC;kBACH,CAAC;kBACD,CAAC;AACP,QAAA,CA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or the clear button)
88
+ if (!input || input.disabled) {
88
89
  return;
89
90
  }
90
91
  input.value = '';
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search/search-state.ts","../../../../packages/ng-primitives/search/src/search-clear/search-clear.ts","../../../../packages/ng-primitives/search/src/search/search.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSearch } from './search';\n\n/**\n * The state token for the Search primitive.\n */\nexport const NgpSearchStateToken = createStateToken<NgpSearch>('Search');\n\n/**\n * Provides the Search state.\n */\nexport const provideSearchState = createStateProvider(NgpSearchStateToken);\n\n/**\n * Injects the Search state.\n */\nexport const injectSearchState = createStateInjector<NgpSearch>(NgpSearchStateToken);\n\n/**\n * The Search state registration function.\n */\nexport const searchState = createState(NgpSearchStateToken);\n","import { Directive, HostListener } from '@angular/core';\nimport { injectSearchState } from '../search/search-state';\n\n/**\n * The `NgpSearchClear` directive is can be added to a button to clear the search field on click.\n */\n@Directive({\n selector: '[ngpSearchClear]',\n exportAs: 'ngpSearchClear',\n host: {\n '[tabindex]': '-1',\n '[attr.data-empty]': 'search().empty() ? \"\" : null',\n },\n})\nexport class NgpSearchClear {\n /**\n * Access the Search instance.\n */\n protected readonly search = injectSearchState();\n\n /**\n * Clear the input field.\n */\n @HostListener('click')\n protected clear(): void {\n this.search().clear();\n }\n}\n","import { computed, DestroyRef, Directive, HostListener, inject, signal } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromEvent } from 'rxjs';\nimport { provideSearchState, searchState } from './search-state';\n\n/**\n * The `NgpSearch` directive is a container for the search field components.\n */\n@Directive({\n selector: '[ngpSearch]',\n exportAs: 'ngpSearch',\n providers: [provideSearchState()],\n host: {\n '[attr.data-empty]': 'empty() ? \"\" : null',\n },\n})\nexport class NgpSearch {\n /**\n * The destroy reference.\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The input field.\n */\n private readonly input = signal<HTMLInputElement | null>(null);\n\n /**\n * The value of the input.\n */\n private readonly value = signal<string>('');\n\n /**\n * Whether the input field is empty.\n * @internal\n */\n readonly empty = computed(() => this.value() === '');\n\n /**\n * The search field state.\n */\n protected readonly state = searchState<NgpSearch>(this);\n\n @HostListener('keydown.escape')\n clear(): void {\n const input = this.input();\n\n if (!input) {\n return;\n }\n\n input.value = '';\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n /**\n * Register the input field.\n * @param input The input field.\n * @internal\n */\n registerInput(input: HTMLInputElement): void {\n this.input.set(input);\n this.value.set(input.value);\n\n fromEvent(input, 'input')\n .pipe(safeTakeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.value.set(input.value));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACvB3D;;AAEG;MASU,cAAc,CAAA;AAR3B,IAAA,WAAA,GAAA;AASE;;AAEG;QACgB,IAAA,CAAA,MAAM,GAAG,iBAAiB,EAAE;AAShD,IAAA;AAPC;;AAEG;IAEO,KAAK,GAAA;AACb,QAAA,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACvB;+GAZW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAA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AA;;sBA4BE,YAAY;uBAAC,gBAAgB;;;AC3ChC;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search/search-state.ts","../../../../packages/ng-primitives/search/src/search-clear/search-clear.ts","../../../../packages/ng-primitives/search/src/search/search.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSearch } from './search';\n\n/**\n * The state token for the Search primitive.\n */\nexport const NgpSearchStateToken = createStateToken<NgpSearch>('Search');\n\n/**\n * Provides the Search state.\n */\nexport const provideSearchState = createStateProvider(NgpSearchStateToken);\n\n/**\n * Injects the Search state.\n */\nexport const injectSearchState = createStateInjector<NgpSearch>(NgpSearchStateToken);\n\n/**\n * The Search state registration function.\n */\nexport const searchState = createState(NgpSearchStateToken);\n","import { Directive, HostListener } from '@angular/core';\nimport { injectSearchState } from '../search/search-state';\n\n/**\n * The `NgpSearchClear` directive is can be added to a button to clear the search field on click.\n */\n@Directive({\n selector: '[ngpSearchClear]',\n exportAs: 'ngpSearchClear',\n host: {\n '[tabindex]': '-1',\n '[attr.data-empty]': 'search().empty() ? \"\" : null',\n },\n})\nexport class NgpSearchClear {\n /**\n * Access the Search instance.\n */\n protected readonly search = injectSearchState();\n\n /**\n * Clear the input field.\n */\n @HostListener('click')\n protected clear(): void {\n this.search().clear();\n }\n}\n","import { computed, DestroyRef, Directive, HostListener, inject, signal } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromEvent } from 'rxjs';\nimport { provideSearchState, searchState } from './search-state';\n\n/**\n * The `NgpSearch` directive is a container for the search field components.\n */\n@Directive({\n selector: '[ngpSearch]',\n exportAs: 'ngpSearch',\n providers: [provideSearchState()],\n host: {\n '[attr.data-empty]': 'empty() ? \"\" : null',\n },\n})\nexport class NgpSearch {\n /**\n * The destroy reference.\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The input field.\n */\n private readonly input = signal<HTMLInputElement | null>(null);\n\n /**\n * The value of the input.\n */\n private readonly value = signal<string>('');\n\n /**\n * Whether the input field is empty.\n * @internal\n */\n readonly empty = computed(() => this.value() === '');\n\n /**\n * The search field state.\n */\n protected readonly state = searchState<NgpSearch>(this);\n\n @HostListener('keydown.escape')\n clear(): void {\n const input = this.input();\n\n // a disabled input must not be clearable (via Escape or the clear button)\n if (!input || input.disabled) {\n return;\n }\n\n input.value = '';\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n /**\n * Register the input field.\n * @param input The input field.\n * @internal\n */\n registerInput(input: HTMLInputElement): void {\n this.input.set(input);\n this.value.set(input.value);\n\n fromEvent(input, 'input')\n .pipe(safeTakeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.value.set(input.value));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACvB3D;;AAEG;MASU,cAAc,CAAA;AAR3B,IAAA,WAAA,GAAA;AASE;;AAEG;QACgB,IAAA,CAAA,MAAM,GAAG,iBAAiB,EAAE;AAShD,IAAA;AAPC;;AAEG;IAEO,KAAK,GAAA;AACb,QAAA,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACvB;+GAZW,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA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J,wBAAA,mBAAmB,EAAE,qBAAqB;AAC3C,qBAAA;AACF,iBAAA;;sBA4BE,YAAY;uBAAC,gBAAgB;;;AC3ChC;;AAEG;;;;"}
@@ -43,13 +43,15 @@ const [NgpSliderStateToken, ngpSlider, injectSliderState, provideSliderState] =
43
43
  focusMonitor.focusVia(el, origin, { preventScroll: true });
44
44
  }
45
45
  }
46
- function setValue(newValue) {
46
+ function setValue(newValue, options) {
47
47
  const clamped = Math.min(max(), Math.max(min(), newValue));
48
48
  const stepped = Math.round((clamped - min()) / step()) * step() + min();
49
49
  const finalValue = Math.min(max(), Math.max(min(), stepped));
50
50
  value.set(finalValue);
51
- onValueChange?.(finalValue);
52
- valueChange.emit(finalValue);
51
+ if (options?.emit !== false) {
52
+ onValueChange?.(finalValue);
53
+ valueChange.emit(finalValue);
54
+ }
53
55
  }
54
56
  function setDisabled(isDisabled) {
55
57
  disabled.set(isDisabled);
@@ -118,7 +120,9 @@ const [NgpSliderThumbStateToken, ngpSliderThumb, injectSliderThumbState, provide
118
120
  let dragging = false;
119
121
  let activePointerId = null;
120
122
  let cleanupDocumentListeners = [];
121
- const ariaValueNow = computed(() => slider().value(), ...(ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []));
123
+ // aria-valuenow must stay within [min, max] even if the bound value is out of
124
+ // range, so it never disagrees with the thumb position (ARIA slider pattern)
125
+ const ariaValueNow = computed(() => Math.min(slider().max(), Math.max(slider().min(), slider().value())), ...(ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []));
122
126
  const tabindex = computed(() => (slider().disabled() ? -1 : 0), ...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
123
127
  // Host bindings
124
128
  attrBinding(elementRef, 'role', 'slider');
@@ -195,6 +199,9 @@ const [NgpSliderThumbStateToken, ngpSliderThumb, injectSliderThumbState, provide
195
199
  }
196
200
  // Keyboard interactions
197
201
  listener(elementRef, 'keydown', (event) => {
202
+ if (slider().disabled()) {
203
+ return;
204
+ }
198
205
  const multiplier = event.shiftKey ? 10 : 1;
199
206
  const step = slider().step() * multiplier;
200
207
  const currentValue = slider().value();
@@ -219,10 +226,12 @@ const [NgpSliderThumbStateToken, ngpSliderThumb, injectSliderThumbState, provide
219
226
  newValue = Math.min(currentValue + step, slider().max());
220
227
  break;
221
228
  case 'Home':
222
- newValue = isRTL ? slider().max() : slider().min();
229
+ // Home is value-based (first allowed value = minimum), not visual
230
+ newValue = slider().min();
223
231
  break;
224
232
  case 'End':
225
- newValue = isRTL ? slider().min() : slider().max();
233
+ // End is value-based (last allowed value = maximum), not visual
234
+ newValue = slider().max();
226
235
  break;
227
236
  default:
228
237
  return;
@@ -397,8 +406,8 @@ class NgpSlider {
397
406
  /**
398
407
  * Set the value of the slider.
399
408
  */
400
- setValue(value) {
401
- this.state.setValue(value);
409
+ setValue(value, options) {
410
+ this.state.setValue(value, options);
402
411
  }
403
412
  /**
404
413
  * Set the disabled state.
@@ -454,19 +463,23 @@ const [NgpRangeSliderStateToken, ngpRangeSlider, injectRangeSliderState, provide
454
463
  attrBinding(element, 'id', id);
455
464
  dataBinding(element, 'data-orientation', orientation);
456
465
  dataBinding(element, 'data-disabled', status().disabled);
457
- function setLowValue(value) {
466
+ function setLowValue(value, options) {
458
467
  const clampedValue = Math.max(min(), Math.min(value, high()));
459
468
  const steppedValue = Math.round((clampedValue - min()) / step()) * step() + min();
460
469
  low.set(steppedValue);
461
- onLowChange?.(steppedValue);
462
- lowChange.emit(steppedValue);
470
+ if (options?.emit !== false) {
471
+ onLowChange?.(steppedValue);
472
+ lowChange.emit(steppedValue);
473
+ }
463
474
  }
464
- function setHighValue(value) {
475
+ function setHighValue(value, options) {
465
476
  const clampedValue = Math.min(max(), Math.max(value, low()));
466
477
  const steppedValue = Math.round((clampedValue - min()) / step()) * step() + min();
467
478
  high.set(steppedValue);
468
- onHighChange?.(steppedValue);
469
- highChange.emit(steppedValue);
479
+ if (options?.emit !== false) {
480
+ onHighChange?.(steppedValue);
481
+ highChange.emit(steppedValue);
482
+ }
470
483
  }
471
484
  function getClosestThumb(percentage) {
472
485
  const value = min() + (max() - min()) * (percentage / 100);
@@ -672,6 +685,9 @@ const [NgpRangeSliderThumbStateToken, ngpRangeSliderThumb, injectRangeSliderThum
672
685
  }
673
686
  }
674
687
  function handleKeydown(event) {
688
+ if (rangeSlider().disabled()) {
689
+ return;
690
+ }
675
691
  const multiplier = event.shiftKey ? 10 : 1;
676
692
  const currentValue = value();
677
693
  const step = rangeSlider().step() * multiplier;
@@ -680,26 +696,30 @@ const [NgpRangeSliderThumbStateToken, ngpRangeSliderThumb, injectRangeSliderThum
680
696
  let newValue;
681
697
  switch (event.key) {
682
698
  case 'ArrowLeft':
699
+ // in RTL the max end is on the left, so ArrowLeft increases the value
683
700
  newValue = isRTL
684
- ? Math.min(currentValue - step, rangeSlider().max())
701
+ ? Math.min(currentValue + step, rangeSlider().max())
685
702
  : Math.max(currentValue - step, rangeSlider().min());
686
703
  break;
687
704
  case 'ArrowDown':
688
705
  newValue = Math.max(currentValue - step, rangeSlider().min());
689
706
  break;
690
707
  case 'ArrowRight':
708
+ // in RTL the min end is on the right, so ArrowRight decreases the value
691
709
  newValue = isRTL
692
- ? Math.max(currentValue + step, rangeSlider().min())
710
+ ? Math.max(currentValue - step, rangeSlider().min())
693
711
  : Math.min(currentValue + step, rangeSlider().max());
694
712
  break;
695
713
  case 'ArrowUp':
696
714
  newValue = Math.min(currentValue + step, rangeSlider().max());
697
715
  break;
698
716
  case 'Home':
699
- newValue = isRTL ? rangeSlider().max() : rangeSlider().min();
717
+ // Home is value-based (first allowed value = minimum), not visual
718
+ newValue = rangeSlider().min();
700
719
  break;
701
720
  case 'End':
702
- newValue = isRTL ? rangeSlider().min() : rangeSlider().max();
721
+ // End is value-based (last allowed value = maximum), not visual
722
+ newValue = rangeSlider().max();
703
723
  break;
704
724
  default:
705
725
  return;