ng-primitives 0.35.0 → 0.37.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 (138) hide show
  1. package/a11y/visually-hidden/visually-hidden-state.d.ts +1 -1
  2. package/accordion/accordion/accordion-state.d.ts +1 -1
  3. package/accordion/accordion-item/accordion-item-state.d.ts +1 -1
  4. package/accordion/accordion-trigger/accordion-trigger.d.ts +4 -0
  5. package/avatar/avatar/avatar-state.d.ts +1 -1
  6. package/button/button/button-state.d.ts +1 -1
  7. package/checkbox/checkbox/checkbox-state.d.ts +1 -1
  8. package/date-picker/date-picker/date-picker-state.d.ts +1 -1
  9. package/dialog/dialog/dialog-state.d.ts +1 -1
  10. package/dialog/dialog-overlay/dialog-overlay.d.ts +7 -1
  11. package/dialog/dialog-trigger/dialog-trigger.d.ts +0 -2
  12. package/example-theme/index.css +2 -0
  13. package/fesm2022/ng-primitives-a11y.mjs +3 -3
  14. package/fesm2022/ng-primitives-accordion.mjs +18 -13
  15. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  16. package/fesm2022/ng-primitives-autofill.mjs +4 -4
  17. package/fesm2022/ng-primitives-avatar.mjs +9 -9
  18. package/fesm2022/ng-primitives-button.mjs +3 -3
  19. package/fesm2022/ng-primitives-checkbox.mjs +4 -4
  20. package/fesm2022/ng-primitives-common.mjs +3 -3
  21. package/fesm2022/ng-primitives-date-picker.mjs +27 -27
  22. package/fesm2022/ng-primitives-dialog.mjs +30 -22
  23. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-file-upload.mjs +18 -12
  25. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-focus-trap.mjs +31 -8
  27. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-form-field.mjs +15 -15
  29. package/fesm2022/ng-primitives-input.mjs +3 -3
  30. package/fesm2022/ng-primitives-interactions.mjs +15 -15
  31. package/fesm2022/ng-primitives-internal.mjs +66 -70
  32. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  33. package/fesm2022/ng-primitives-listbox.mjs +12 -12
  34. package/fesm2022/ng-primitives-menu.mjs +13 -13
  35. package/fesm2022/ng-primitives-meter.mjs +164 -0
  36. package/fesm2022/ng-primitives-meter.mjs.map +1 -0
  37. package/fesm2022/ng-primitives-pagination.mjs +19 -19
  38. package/fesm2022/ng-primitives-popover.mjs +114 -68
  39. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-progress.mjs +6 -6
  41. package/fesm2022/ng-primitives-radio.mjs +13 -9
  42. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  43. package/fesm2022/ng-primitives-resize.mjs +3 -3
  44. package/fesm2022/ng-primitives-roving-focus.mjs +6 -6
  45. package/fesm2022/ng-primitives-search.mjs +7 -7
  46. package/fesm2022/ng-primitives-select.mjs +3 -3
  47. package/fesm2022/ng-primitives-separator.mjs +3 -3
  48. package/fesm2022/ng-primitives-slider.mjs +12 -12
  49. package/fesm2022/ng-primitives-state.mjs +10 -3
  50. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  51. package/fesm2022/ng-primitives-switch.mjs +6 -6
  52. package/fesm2022/ng-primitives-tabs.mjs +35 -48
  53. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  54. package/fesm2022/ng-primitives-textarea.mjs +3 -3
  55. package/fesm2022/ng-primitives-toast.mjs +3 -3
  56. package/fesm2022/ng-primitives-toggle-group.mjs +9 -14
  57. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  58. package/fesm2022/ng-primitives-toggle.mjs +4 -4
  59. package/fesm2022/ng-primitives-toolbar.mjs +38 -14
  60. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  61. package/fesm2022/ng-primitives-tooltip.mjs +108 -51
  62. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  63. package/fesm2022/ng-primitives-utils.mjs +18 -0
  64. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  65. package/file-upload/file-dropzone/file-dropzone-state.d.ts +2 -2
  66. package/file-upload/file-dropzone/file-dropzone.d.ts +3 -2
  67. package/file-upload/file-upload/file-upload-state.d.ts +2 -2
  68. package/file-upload/file-upload/file-upload.d.ts +3 -2
  69. package/focus-trap/focus-trap/focus-trap-state.d.ts +41 -0
  70. package/focus-trap/focus-trap/focus-trap.d.ts +4 -0
  71. package/focus-trap/index.d.ts +1 -0
  72. package/form-field/form-control/form-control-state.d.ts +24 -24
  73. package/form-field/form-field/form-field-state.d.ts +1 -1
  74. package/input/input/input-state.d.ts +1 -1
  75. package/internal/exit-animation/exit-animation-manager.d.ts +17 -0
  76. package/internal/exit-animation/exit-animation.d.ts +4 -17
  77. package/internal/index.d.ts +2 -1
  78. package/listbox/listbox/listbox-state.d.ts +4 -4
  79. package/meter/README.md +3 -0
  80. package/meter/index.d.ts +6 -0
  81. package/meter/meter/meter-state.d.ts +25 -0
  82. package/meter/meter/meter.d.ts +27 -0
  83. package/meter/meter-indicator/meter-indicator.d.ts +15 -0
  84. package/meter/meter-label/meter-label.d.ts +18 -0
  85. package/meter/meter-track/meter-track.d.ts +5 -0
  86. package/meter/meter-value/meter-value.d.ts +5 -0
  87. package/package.json +13 -9
  88. package/pagination/pagination/pagination-state.d.ts +3 -3
  89. package/pagination/pagination-first/pagination-first.d.ts +2 -2
  90. package/pagination/pagination-next/pagination-next.d.ts +2 -2
  91. package/pagination/pagination-previous/pagination-previous.d.ts +2 -2
  92. package/popover/index.d.ts +1 -0
  93. package/popover/popover/popover-token.d.ts +10 -0
  94. package/popover/popover/popover.d.ts +34 -3
  95. package/popover/popover-trigger/popover-trigger-state.d.ts +5 -3
  96. package/popover/popover-trigger/popover-trigger.d.ts +26 -18
  97. package/progress/progress/progress-state.d.ts +3 -3
  98. package/progress/progress-indicator/progress-indicator.d.ts +2 -2
  99. package/radio/radio-group/radio-group-state.d.ts +1 -1
  100. package/radio/radio-item/radio-item-state.d.ts +1 -1
  101. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +7 -7
  102. package/schematics/ng-generate/schema.d.ts +4 -1
  103. package/schematics/ng-generate/schema.json +4 -1
  104. package/schematics/ng-generate/templates/meter/meter.__fileSuffix@dasherize__.ts.template +78 -0
  105. package/schematics/ng-generate/templates/pagination/pagination.__fileSuffix@dasherize__.ts.template +11 -11
  106. package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +8 -3
  107. package/schematics/ng-generate/templates/toolbar/toolbar-button.__fileSuffix@dasherize__.ts.template +58 -0
  108. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +37 -0
  109. package/schematics/ng-generate/templates/tooltip/tooltip-trigger.__fileSuffix@dasherize__.ts.template +35 -0
  110. package/schematics/ng-generate/templates/tooltip/tooltip.__fileSuffix@dasherize__.ts.template +60 -0
  111. package/search/search/search-state.d.ts +1 -1
  112. package/select/select/select-state.d.ts +1 -1
  113. package/slider/slider/slider-state.d.ts +5 -5
  114. package/slider/slider-range/slider-range.d.ts +4 -4
  115. package/slider/slider-thumb/slider-thumb.d.ts +4 -4
  116. package/slider/slider-track/slider-track.d.ts +4 -4
  117. package/state/index.d.ts +7 -1
  118. package/switch/switch/switch-state.d.ts +1 -1
  119. package/tabs/index.d.ts +1 -2
  120. package/tabs/tab-button/tab-button.d.ts +9 -10
  121. package/tabs/tab-list/tab-list.d.ts +6 -7
  122. package/tabs/tab-panel/tab-panel.d.ts +11 -9
  123. package/tabs/tabset/tabset-state.d.ts +7 -8
  124. package/tabs/tabset/tabset.d.ts +3 -4
  125. package/textarea/textarea/textarea-state.d.ts +1 -1
  126. package/toggle/toggle/toggle-state.d.ts +1 -1
  127. package/toggle-group/toggle-group/toggle-group-state.d.ts +7 -7
  128. package/toggle-group/toggle-group/toggle-group.d.ts +1 -1
  129. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +13 -13
  130. package/toolbar/index.d.ts +1 -0
  131. package/toolbar/toolbar/toolbar-state.d.ts +39 -0
  132. package/toolbar/toolbar/toolbar.d.ts +10 -1
  133. package/tooltip/index.d.ts +1 -0
  134. package/tooltip/tooltip/tooltip-token.d.ts +10 -0
  135. package/tooltip/tooltip/tooltip.d.ts +2 -1
  136. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +3 -3
  137. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +44 -18
  138. package/tabs/tabset/tabset-token.d.ts +0 -11
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, booleanAttribute, computed, Directive, HostListener, output, signal } from '@angular/core';
3
- import * as i2 from 'ng-primitives/interactions';
4
- import { NgpHover, NgpFocusVisible, NgpPress } from 'ng-primitives/interactions';
2
+ import { InjectionToken, inject, input, booleanAttribute, computed, HostListener, Directive, output, signal } from '@angular/core';
3
+ import { setupInteractions, syncState } from 'ng-primitives/internal';
5
4
  import * as i1 from 'ng-primitives/roving-focus';
6
5
  import { NgpRovingFocusItem, injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';
7
6
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
@@ -81,7 +80,7 @@ class NgpTabButton {
81
80
  * Determine a unique id for the tab button if not provided
82
81
  * @internal
83
82
  */
84
- this.defaultId = computed(() => `${this.state().id()}-button-${this.value()}`);
83
+ this.buttonId = computed(() => this.id() ?? `${this.state().id()}-button-${this.value()}`);
85
84
  /**
86
85
  * Determine the aria-controls of the tab button
87
86
  * @internal
@@ -91,6 +90,12 @@ class NgpTabButton {
91
90
  * Whether the tab is active
92
91
  */
93
92
  this.active = computed(() => this.state().selectedTab() === this.value());
93
+ setupInteractions({
94
+ hover: true,
95
+ press: true,
96
+ focusVisible: true,
97
+ disabled: this.disabled,
98
+ });
94
99
  }
95
100
  ngOnInit() {
96
101
  if (this.value() === undefined) {
@@ -111,25 +116,25 @@ class NgpTabButton {
111
116
  this.select();
112
117
  }
113
118
  }
114
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
115
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpTabButton, isStandalone: true, selector: "[ngpTabButton]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabButtonValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpTabButtonDisabled", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tab" }, listeners: { "click": "select()", "focus": "activateOnFocus()" }, properties: { "attr.id": "id() ?? defaultId()", "attr.aria-controls": "ariaControls()", "attr.data-active": "active() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-orientation": "state().orientation()" } }, exportAs: ["ngpTabButton"], hostDirectives: [{ directive: i1.NgpRovingFocusItem }, { directive: i2.NgpHover }, { directive: i2.NgpFocusVisible }, { directive: i2.NgpPress }], ngImport: i0 }); }
119
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
120
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTabButton, isStandalone: true, selector: "[ngpTabButton]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabButtonValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpTabButtonDisabled", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tab" }, listeners: { "click": "select()", "focus": "activateOnFocus()" }, properties: { "attr.id": "buttonId()", "attr.aria-controls": "ariaControls()", "attr.data-active": "active() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-orientation": "state().orientation()" } }, exportAs: ["ngpTabButton"], hostDirectives: [{ directive: i1.NgpRovingFocusItem }], ngImport: i0 }); }
116
121
  }
117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabButton, decorators: [{
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabButton, decorators: [{
118
123
  type: Directive,
119
124
  args: [{
120
125
  selector: '[ngpTabButton]',
121
126
  exportAs: 'ngpTabButton',
122
127
  host: {
123
128
  role: 'tab',
124
- '[attr.id]': 'id() ?? defaultId()',
129
+ '[attr.id]': 'buttonId()',
125
130
  '[attr.aria-controls]': 'ariaControls()',
126
131
  '[attr.data-active]': 'active() ? "" : null',
127
132
  '[attr.data-disabled]': 'disabled() ? "" : null',
128
133
  '[attr.data-orientation]': 'state().orientation()',
129
134
  },
130
- hostDirectives: [NgpRovingFocusItem, NgpHover, NgpFocusVisible, NgpPress],
135
+ hostDirectives: [NgpRovingFocusItem],
131
136
  }]
132
- }], propDecorators: { select: [{
137
+ }], ctorParameters: () => [], propDecorators: { select: [{
133
138
  type: HostListener,
134
139
  args: ['click']
135
140
  }], activateOnFocus: [{
@@ -147,10 +152,10 @@ class NgpTabList {
147
152
  */
148
153
  this.state = injectTabsetState();
149
154
  }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabList, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
151
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpTabList, isStandalone: true, selector: "[ngpTabList]", host: { attributes: { "role": "tablist" }, properties: { "attr.aria-orientation": "state().orientation()", "attr.data-orientation": "state().orientation()" } }, exportAs: ["ngpTabList"], ngImport: i0 }); }
155
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabList, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
156
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: NgpTabList, isStandalone: true, selector: "[ngpTabList]", host: { attributes: { "role": "tablist" }, properties: { "attr.aria-orientation": "state().orientation()", "attr.data-orientation": "state().orientation()" } }, exportAs: ["ngpTabList"], ngImport: i0 }); }
152
157
  }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabList, decorators: [{
158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabList, decorators: [{
154
159
  type: Directive,
155
160
  args: [{
156
161
  selector: '[ngpTabList]',
@@ -194,7 +199,7 @@ class NgpTabPanel {
194
199
  * Determine a unique id for the tab panel if not provided
195
200
  * @internal
196
201
  */
197
- this.defaultId = computed(() => `${this.state().id()}-panel-${this.value()}`);
202
+ this.panelId = computed(() => this.id() ?? `${this.state().id()}-panel-${this.value()}`);
198
203
  /**
199
204
  * Determine the aria-labelledby of the tab panel
200
205
  * @internal
@@ -214,10 +219,10 @@ class NgpTabPanel {
214
219
  ngOnDestroy() {
215
220
  this.state().unregisterTab(this);
216
221
  }
217
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
218
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpTabPanel, isStandalone: true, selector: "[ngpTabPanel]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabPanelValue", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tabpanel", "tabIndex": "0" }, properties: { "attr.aria-labelledby": "labelledBy()", "attr.data-active": "active() ? \"\" : null", "attr.data-orientation": "state().orientation()" } }, providers: [{ provide: NgpTabPanelToken, useExisting: NgpTabPanel }], exportAs: ["ngpTabPanel"], ngImport: i0 }); }
222
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
223
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTabPanel, isStandalone: true, selector: "[ngpTabPanel]", inputs: { value: { classPropertyName: "value", publicName: "ngpTabPanelValue", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tabpanel", "tabIndex": "0" }, properties: { "id": "panelId()", "attr.aria-labelledby": "labelledBy()", "attr.data-active": "active() ? \"\" : null", "attr.data-orientation": "state().orientation()" } }, providers: [{ provide: NgpTabPanelToken, useExisting: NgpTabPanel }], exportAs: ["ngpTabPanel"], ngImport: i0 }); }
219
224
  }
220
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabPanel, decorators: [{
225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabPanel, decorators: [{
221
226
  type: Directive,
222
227
  args: [{
223
228
  selector: '[ngpTabPanel]',
@@ -226,6 +231,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
226
231
  host: {
227
232
  role: 'tabpanel',
228
233
  tabIndex: '0',
234
+ '[id]': 'panelId()',
229
235
  '[attr.aria-labelledby]': 'labelledBy()',
230
236
  '[attr.data-active]': 'active() ? "" : null',
231
237
  '[attr.data-orientation]': 'state().orientation()',
@@ -233,20 +239,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
233
239
  }]
234
240
  }] });
235
241
 
236
- const NgpTabsetToken = new InjectionToken('NgpTabsetToken');
237
- /**
238
- * Inject the Tabset directive instance
239
- */
240
- function injectTabset() {
241
- return inject(NgpTabsetToken);
242
- }
243
- /**
244
- * Provide the Tabset directive instance
245
- */
246
- function provideTabset(type) {
247
- return { provide: NgpTabsetToken, useExisting: type };
248
- }
249
-
250
242
  /**
251
243
  * Apply the `ngpTabset` directive to an element to manage the tabs.
252
244
  */
@@ -312,17 +304,17 @@ class NgpTabset {
312
304
  * The state of the tabset
313
305
  */
314
306
  this.state = tabsetState(this);
315
- }
316
- ngOnInit() {
317
- // the roving focus group defaults to vertical orientation whereas
318
- // the default for the tabset may be different if provided via global config
319
- this.rovingFocusGroupState().orientation.set(this.state.orientation());
307
+ syncState(this.state.orientation, this.rovingFocusGroupState().orientation);
320
308
  }
321
309
  /**
322
310
  * Select a tab by its value
323
311
  * @param value The value of the tab to select
324
312
  */
325
313
  select(value) {
314
+ // if the value is already selected, do nothing
315
+ if (this.state.value() === value) {
316
+ return;
317
+ }
326
318
  this.state.value.set(value);
327
319
  this.valueChange.emit(value);
328
320
  }
@@ -340,31 +332,26 @@ class NgpTabset {
340
332
  unregisterTab(tab) {
341
333
  this.panels.update(panels => panels.filter(panel => panel !== tab));
342
334
  }
343
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabset, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
344
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpTabset, isStandalone: true, selector: "[ngpTabset]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpTabsetValue", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpTabsetOrientation", isSignal: true, isRequired: false, transformFunction: null }, activateOnFocus: { classPropertyName: "activateOnFocus", publicName: "ngpTabsetActivateOnFocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpTabsetValueChange" }, host: { properties: { "attr.id": "state.id()", "attr.data-orientation": "state.orientation()" } }, providers: [provideTabset(NgpTabset), provideTabsetState()], exportAs: ["ngpTabset"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup, inputs: ["ngpRovingFocusGroupOrientation", "ngpTabsetOrientation"] }], ngImport: i0 }); }
335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabset, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
336
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTabset, isStandalone: true, selector: "[ngpTabset]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpTabsetValue", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpTabsetOrientation", isSignal: true, isRequired: false, transformFunction: null }, activateOnFocus: { classPropertyName: "activateOnFocus", publicName: "ngpTabsetActivateOnFocus", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpTabsetValueChange" }, host: { properties: { "attr.id": "state.id()", "attr.data-orientation": "state.orientation()" } }, providers: [provideTabsetState()], exportAs: ["ngpTabset"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup }], ngImport: i0 }); }
345
337
  }
346
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTabset, decorators: [{
338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTabset, decorators: [{
347
339
  type: Directive,
348
340
  args: [{
349
341
  selector: '[ngpTabset]',
350
342
  exportAs: 'ngpTabset',
351
- providers: [provideTabset(NgpTabset), provideTabsetState()],
352
- hostDirectives: [
353
- {
354
- directive: NgpRovingFocusGroup,
355
- inputs: ['ngpRovingFocusGroupOrientation:ngpTabsetOrientation'],
356
- },
357
- ],
343
+ providers: [provideTabsetState()],
344
+ hostDirectives: [NgpRovingFocusGroup],
358
345
  host: {
359
346
  '[attr.id]': 'state.id()',
360
347
  '[attr.data-orientation]': 'state.orientation()',
361
348
  },
362
349
  }]
363
- }] });
350
+ }], ctorParameters: () => [] });
364
351
 
365
352
  /**
366
353
  * Generated bundle index. Do not edit.
367
354
  */
368
355
 
369
- export { NgpTabButton, NgpTabList, NgpTabPanel, NgpTabPanelToken, NgpTabset, NgpTabsetToken, injectTabPanel, injectTabset, injectTabsetState, provideTabsConfig, provideTabsetState };
356
+ export { NgpTabButton, NgpTabList, NgpTabPanel, NgpTabPanelToken, NgpTabset, injectTabPanel, injectTabsetState, provideTabsConfig, provideTabsetState };
370
357
  //# sourceMappingURL=ng-primitives-tabs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-tabs.mjs","sources":["../../../../packages/ng-primitives/tabs/src/config/tabs-config.ts","../../../../packages/ng-primitives/tabs/src/tabset/tabset-state.ts","../../../../packages/ng-primitives/tabs/src/tab-button/tab-button.ts","../../../../packages/ng-primitives/tabs/src/tab-list/tab-list.ts","../../../../packages/ng-primitives/tabs/src/tab-panel/tab-panel-token.ts","../../../../packages/ng-primitives/tabs/src/tab-panel/tab-panel.ts","../../../../packages/ng-primitives/tabs/src/tabset/tabset-token.ts","../../../../packages/ng-primitives/tabs/src/tabset/tabset.ts","../../../../packages/ng-primitives/tabs/src/ng-primitives-tabs.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport interface NgpTabsConfig {\n /**\n * The orientation of the tabset\n * @default 'horizontal'\n */\n orientation: NgpOrientation;\n\n /**\n * Whether tabs should activate on focus\n * @default true\n */\n activateOnFocus: boolean;\n\n /**\n * Whether focus should wrap within the tab list when using the keyboard.\n * @default true\n */\n wrap: boolean;\n}\n\nexport const defaultTabsConfig: NgpTabsConfig = {\n orientation: 'horizontal',\n activateOnFocus: true,\n wrap: true,\n};\n\nexport const NgpTabsConfigToken = new InjectionToken<NgpTabsConfig>('NgpTabsConfigToken');\n\n/**\n * Provide the default Tabs configuration\n * @param config The Tabs configuration\n * @returns The provider\n */\nexport function provideTabsConfig(config: Partial<NgpTabsConfig>): Provider[] {\n return [\n {\n provide: NgpTabsConfigToken,\n useValue: { ...defaultTabsConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tabs configuration\n * @returns The global Tabs configuration\n */\nexport function injectTabsConfig(): NgpTabsConfig {\n return inject(NgpTabsConfigToken, { optional: true }) ?? defaultTabsConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpTabset } from './tabset';\n\n/**\n * The state token for the Tabset primitive.\n */\nexport const NgpTabsetStateToken = createStateToken<NgpTabset>('Tabset');\n\n/**\n * Provides the Tabset state.\n */\nexport const provideTabsetState = createStateProvider(NgpTabsetStateToken);\n\n/**\n * Injects the Tabset state.\n */\nexport const injectTabsetState = createStateInjector(NgpTabsetStateToken);\n\n/**\n * The Tabset state registration function.\n */\nexport const tabsetState = createState(NgpTabsetStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, OnInit, booleanAttribute, computed, input } from '@angular/core';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectTabsetState } from '../tabset/tabset-state';\n\n/**\n * Apply the `ngpTabButton` directive to an element within a tab list to represent a tab button. This directive should be applied to a button element.\n */\n@Directive({\n selector: '[ngpTabButton]',\n exportAs: 'ngpTabButton',\n host: {\n role: 'tab',\n '[attr.id]': 'id() ?? defaultId()',\n '[attr.aria-controls]': 'ariaControls()',\n '[attr.data-active]': 'active() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-orientation]': 'state().orientation()',\n },\n hostDirectives: [NgpRovingFocusItem, NgpHover, NgpFocusVisible, NgpPress],\n})\nexport class NgpTabButton implements OnInit {\n /**\n * Access the tabset state\n */\n protected readonly state = injectTabsetState();\n\n /**\n * The value of the tab this trigger controls\n */\n readonly value = input<string>(undefined, { alias: 'ngpTabButtonValue' });\n\n /**\n * Whether the tab is disabled\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTabButtonDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Determine the id of the tab button\n * @internal\n */\n readonly id = input<string>();\n\n /**\n * Determine a unique id for the tab button if not provided\n * @internal\n */\n readonly defaultId = computed(() => `${this.state().id()}-button-${this.value()}`);\n\n /**\n * Determine the aria-controls of the tab button\n * @internal\n */\n readonly ariaControls = computed(() => `${this.state().id()}-panel-${this.value()}`);\n\n /**\n * Whether the tab is active\n */\n readonly active = computed(() => this.state().selectedTab() === this.value());\n\n ngOnInit(): void {\n if (this.value() === undefined) {\n throw new Error('ngpTabButton: value is required');\n }\n }\n\n /**\n * Select the tab this trigger controls\n */\n @HostListener('click')\n select(): void {\n this.state().select(this.value()!);\n }\n\n /**\n * On focus select the tab this trigger controls if activateOnFocus is true\n */\n @HostListener('focus')\n protected activateOnFocus(): void {\n if (this.state().activateOnFocus()) {\n this.select();\n }\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectTabsetState } from '../tabset/tabset-state';\n\n/**\n * Apply the `ngpTabList` directive to an element that represents the list of tab buttons.\n */\n@Directive({\n selector: '[ngpTabList]',\n exportAs: 'ngpTabList',\n host: {\n role: 'tablist',\n '[attr.aria-orientation]': 'state().orientation()',\n '[attr.data-orientation]': 'state().orientation()',\n },\n})\nexport class NgpTabList {\n /**\n * Access the tabset state\n */\n protected readonly state = injectTabsetState();\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpTabPanel } from './tab-panel';\n\nexport const NgpTabPanelToken = new InjectionToken<NgpTabPanel>('NgpTabPanelToken');\n\n/**\n * Inject the TabPanel directive instance\n * @returns The TabPanel directive instance\n */\nexport function injectTabPanel(): NgpTabPanel {\n return inject(NgpTabPanelToken);\n}\n","import { Directive, OnDestroy, OnInit, computed, input } from '@angular/core';\nimport { injectTabsetState } from '../tabset/tabset-state';\nimport { NgpTabPanelToken } from './tab-panel-token';\n\n/**\n * Apply the `ngpTabPanel` directive to an element that represents the content of a tab.\n */\n@Directive({\n selector: '[ngpTabPanel]',\n exportAs: 'ngpTabPanel',\n providers: [{ provide: NgpTabPanelToken, useExisting: NgpTabPanel }],\n host: {\n role: 'tabpanel',\n tabIndex: '0',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.data-active]': 'active() ? \"\" : null',\n '[attr.data-orientation]': 'state().orientation()',\n },\n})\nexport class NgpTabPanel implements OnInit, OnDestroy {\n /**\n * Access the tabset\n */\n protected readonly state = injectTabsetState();\n\n /**\n * The value of the tab\n */\n readonly value = input<string>(undefined, { alias: 'ngpTabPanelValue' });\n\n /**\n * Determine the id of the tab panel\n * @internal\n */\n readonly id = input<string>();\n\n /**\n * Determine a unique id for the tab panel if not provided\n * @internal\n */\n protected readonly defaultId = computed(() => `${this.state().id()}-panel-${this.value()}`);\n\n /**\n * Determine the aria-labelledby of the tab panel\n * @internal\n */\n protected readonly labelledBy = computed(() => `${this.state().id()}-button-${this.value()}`);\n\n /**\n * Whether the tab is active\n */\n protected readonly active = computed(() => this.state().selectedTab() === this.value());\n\n ngOnInit(): void {\n this.state().registerTab(this);\n\n if (this.value() === undefined) {\n throw new Error('ngpTabPanel: value is required');\n }\n }\n\n ngOnDestroy(): void {\n this.state().unregisterTab(this);\n }\n}\n","import { ExistingProvider, inject, InjectionToken, Type } from '@angular/core';\nimport type { NgpTabset } from './tabset';\n\nexport const NgpTabsetToken = new InjectionToken<NgpTabset>('NgpTabsetToken');\n\n/**\n * Inject the Tabset directive instance\n */\nexport function injectTabset(): NgpTabset {\n return inject(NgpTabsetToken);\n}\n\n/**\n * Provide the Tabset directive instance\n */\nexport function provideTabset(type: Type<NgpTabset>): ExistingProvider {\n return { provide: NgpTabsetToken, useExisting: type };\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n input,\n OnInit,\n output,\n signal,\n} from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectTabsConfig } from '../config/tabs-config';\nimport type { NgpTabPanel } from '../tab-panel/tab-panel';\nimport { provideTabsetState, tabsetState } from './tabset-state';\nimport { provideTabset } from './tabset-token';\n\n/**\n * Apply the `ngpTabset` directive to an element to manage the tabs.\n */\n@Directive({\n selector: '[ngpTabset]',\n exportAs: 'ngpTabset',\n providers: [provideTabset(NgpTabset), provideTabsetState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusGroup,\n inputs: ['ngpRovingFocusGroupOrientation:ngpTabsetOrientation'],\n },\n ],\n host: {\n '[attr.id]': 'state.id()',\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpTabset implements OnInit {\n /**\n * Access the global tabset configuration\n */\n private readonly config = injectTabsConfig();\n\n /**\n * Access the roving focus group state\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * Define the id for the tabset\n */\n readonly id = input<string>(uniqueId('ngp-tabset'));\n\n /**\n * Define the active tab\n */\n readonly value = input<string>(undefined, {\n alias: 'ngpTabsetValue',\n });\n\n /**\n * Emit the value of the selected tab when it changes\n */\n readonly valueChange = output<string | undefined>({\n alias: 'ngpTabsetValueChange',\n });\n\n /**\n * The orientation of the tabset\n * @default 'horizontal'\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpTabsetOrientation',\n });\n\n /**\n * Whether tabs should activate on focus\n */\n readonly activateOnFocus = input<boolean, BooleanInput>(this.config.activateOnFocus, {\n alias: 'ngpTabsetActivateOnFocus',\n transform: booleanAttribute,\n });\n\n /**\n * Access the tabs within the tabset\n * @internal\n */\n readonly panels = signal<NgpTabPanel[]>([]);\n\n /**\n * @internal\n * Get the id of the selected tab\n */\n readonly selectedTab = computed(() => {\n const panels = this.panels();\n\n // if there is a value set and a tab with that value exists, return the value\n if (panels.some(panel => panel.value() === this.state.value())) {\n return this.state.value();\n }\n\n // otherwise return the first tab\n return panels[0]?.value();\n });\n\n /**\n * The state of the tabset\n */\n protected readonly state = tabsetState<NgpTabset>(this);\n\n ngOnInit(): void {\n // the roving focus group defaults to vertical orientation whereas\n // the default for the tabset may be different if provided via global config\n this.rovingFocusGroupState().orientation.set(this.state.orientation());\n }\n\n /**\n * Select a tab by its value\n * @param value The value of the tab to select\n */\n select(value: string): void {\n this.state.value.set(value);\n this.valueChange.emit(value);\n }\n\n /**\n * @internal\n * Register a tab with the tabset\n */\n registerTab(tab: NgpTabPanel): void {\n this.panels.update(panels => [...panels, tab]);\n }\n\n /**\n * @internal\n * Unregister a tab with the tabset\n */\n unregisterTab(tab: NgpTabPanel): void {\n this.panels.update(panels => panels.filter(panel => panel !== tab));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAuBO,MAAM,iBAAiB,GAAkB;AAC9C,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,IAAI,EAAE,IAAI;CACX;AAEM,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAgB,oBAAoB,CAAC;AAEzF;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,MAA8B,EAAA;IAC9D,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,kBAAkB;AAC3B,YAAA,QAAQ,EAAE,EAAE,GAAG,iBAAiB,EAA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IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,sBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,SAAA,EAAA,YAAA,EAAA,uBAAA,EAAA,qBAAA,EAAA,EAAA,EAAA,SAAA,EAZT,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,MAAA,EAAA,CAAA,gCAAA,EAAA,sBAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAYhD,SAAS,EAAA,UAAA,EAAA,CAAA;kBAfrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,aAAa,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAC3D,oBAAA,cAAc,EAAE;AACd,wBAAA;AACE,4BAAA,SAAS,EAAE,mBAAmB;4BAC9B,MAAM,EAAE,CAAC,qDAAqD,CAAC;AAChE,yBAAA;AACF,qBAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,YAAY;AACzB,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;ACnCD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-tabs.mjs","sources":["../../../../packages/ng-primitives/tabs/src/config/tabs-config.ts","../../../../packages/ng-primitives/tabs/src/tabset/tabset-state.ts","../../../../packages/ng-primitives/tabs/src/tab-button/tab-button.ts","../../../../packages/ng-primitives/tabs/src/tab-list/tab-list.ts","../../../../packages/ng-primitives/tabs/src/tab-panel/tab-panel-token.ts","../../../../packages/ng-primitives/tabs/src/tab-panel/tab-panel.ts","../../../../packages/ng-primitives/tabs/src/tabset/tabset.ts","../../../../packages/ng-primitives/tabs/src/ng-primitives-tabs.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport interface NgpTabsConfig {\n /**\n * The orientation of the tabset\n * @default 'horizontal'\n */\n orientation: NgpOrientation;\n\n /**\n * Whether tabs should activate on focus\n * @default true\n */\n activateOnFocus: boolean;\n\n /**\n * Whether focus should wrap within the tab list when using the keyboard.\n * @default true\n */\n wrap: boolean;\n}\n\nexport const defaultTabsConfig: NgpTabsConfig = {\n orientation: 'horizontal',\n activateOnFocus: true,\n wrap: true,\n};\n\nexport const NgpTabsConfigToken = new InjectionToken<NgpTabsConfig>('NgpTabsConfigToken');\n\n/**\n * Provide the default Tabs configuration\n * @param config The Tabs configuration\n * @returns The provider\n */\nexport function provideTabsConfig(config: Partial<NgpTabsConfig>): Provider[] {\n return [\n {\n provide: NgpTabsConfigToken,\n useValue: { ...defaultTabsConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tabs configuration\n * @returns The global Tabs configuration\n */\nexport function injectTabsConfig(): NgpTabsConfig {\n return inject(NgpTabsConfigToken, { optional: true }) ?? defaultTabsConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpTabset } from './tabset';\n\n/**\n * The state token for the Tabset primitive.\n */\nexport const NgpTabsetStateToken = createStateToken<NgpTabset>('Tabset');\n\n/**\n * Provides the Tabset state.\n */\nexport const provideTabsetState = createStateProvider(NgpTabsetStateToken);\n\n/**\n * Injects the Tabset state.\n */\nexport const injectTabsetState = createStateInjector(NgpTabsetStateToken);\n\n/**\n * The Tabset state registration function.\n */\nexport const tabsetState = createState(NgpTabsetStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, OnInit, booleanAttribute, computed, input } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectTabsetState } from '../tabset/tabset-state';\n\n/**\n * Apply the `ngpTabButton` directive to an element within a tab list to represent a tab button. This directive should be applied to a button element.\n */\n@Directive({\n selector: '[ngpTabButton]',\n exportAs: 'ngpTabButton',\n host: {\n role: 'tab',\n '[attr.id]': 'buttonId()',\n '[attr.aria-controls]': 'ariaControls()',\n '[attr.data-active]': 'active() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n '[attr.data-orientation]': 'state().orientation()',\n },\n hostDirectives: [NgpRovingFocusItem],\n})\nexport class NgpTabButton implements OnInit {\n /**\n * Access the tabset state\n */\n protected readonly state = injectTabsetState();\n\n /**\n * The value of the tab this trigger controls\n */\n readonly value = input<string>(undefined, { alias: 'ngpTabButtonValue' });\n\n /**\n * Whether the tab is disabled\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTabButtonDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Determine the id of the tab button\n * @internal\n */\n readonly id = input<string>();\n\n /**\n * Determine a unique id for the tab button if not provided\n * @internal\n */\n readonly buttonId = computed(() => this.id() ?? `${this.state().id()}-button-${this.value()}`);\n\n /**\n * Determine the aria-controls of the tab button\n * @internal\n */\n readonly ariaControls = computed(() => `${this.state().id()}-panel-${this.value()}`);\n\n /**\n * Whether the tab is active\n */\n readonly active = computed(() => this.state().selectedTab() === this.value());\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.disabled,\n });\n }\n\n ngOnInit(): void {\n if (this.value() === undefined) {\n throw new Error('ngpTabButton: value is required');\n }\n }\n\n /**\n * Select the tab this trigger controls\n */\n @HostListener('click')\n select(): void {\n this.state().select(this.value()!);\n }\n\n /**\n * On focus select the tab this trigger controls if activateOnFocus is true\n */\n @HostListener('focus')\n protected activateOnFocus(): void {\n if (this.state().activateOnFocus()) {\n this.select();\n }\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectTabsetState } from '../tabset/tabset-state';\n\n/**\n * Apply the `ngpTabList` directive to an element that represents the list of tab buttons.\n */\n@Directive({\n selector: '[ngpTabList]',\n exportAs: 'ngpTabList',\n host: {\n role: 'tablist',\n '[attr.aria-orientation]': 'state().orientation()',\n '[attr.data-orientation]': 'state().orientation()',\n },\n})\nexport class NgpTabList {\n /**\n * Access the tabset state\n */\n protected readonly state = injectTabsetState();\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpTabPanel } from './tab-panel';\n\nexport const NgpTabPanelToken = new InjectionToken<NgpTabPanel>('NgpTabPanelToken');\n\n/**\n * Inject the TabPanel directive instance\n * @returns The TabPanel directive instance\n */\nexport function injectTabPanel(): NgpTabPanel {\n return inject(NgpTabPanelToken);\n}\n","import { Directive, OnDestroy, OnInit, computed, input } from '@angular/core';\nimport { injectTabsetState } from '../tabset/tabset-state';\nimport { NgpTabPanelToken } from './tab-panel-token';\n\n/**\n * Apply the `ngpTabPanel` directive to an element that represents the content of a tab.\n */\n@Directive({\n selector: '[ngpTabPanel]',\n exportAs: 'ngpTabPanel',\n providers: [{ provide: NgpTabPanelToken, useExisting: NgpTabPanel }],\n host: {\n role: 'tabpanel',\n tabIndex: '0',\n '[id]': 'panelId()',\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.data-active]': 'active() ? \"\" : null',\n '[attr.data-orientation]': 'state().orientation()',\n },\n})\nexport class NgpTabPanel implements OnInit, OnDestroy {\n /**\n * Access the tabset\n */\n protected readonly state = injectTabsetState();\n\n /**\n * The value of the tab\n */\n readonly value = input<string>(undefined, { alias: 'ngpTabPanelValue' });\n\n /**\n * Determine the id of the tab panel\n * @internal\n */\n readonly id = input<string>();\n\n /**\n * Determine a unique id for the tab panel if not provided\n * @internal\n */\n protected readonly panelId = computed(\n () => this.id() ?? `${this.state().id()}-panel-${this.value()}`,\n );\n\n /**\n * Determine the aria-labelledby of the tab panel\n * @internal\n */\n protected readonly labelledBy = computed(() => `${this.state().id()}-button-${this.value()}`);\n\n /**\n * Whether the tab is active\n */\n protected readonly active = computed(() => this.state().selectedTab() === this.value());\n\n ngOnInit(): void {\n this.state().registerTab(this);\n\n if (this.value() === undefined) {\n throw new Error('ngpTabPanel: value is required');\n }\n }\n\n ngOnDestroy(): void {\n this.state().unregisterTab(this);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, output, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { syncState } from 'ng-primitives/internal';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectTabsConfig } from '../config/tabs-config';\nimport type { NgpTabPanel } from '../tab-panel/tab-panel';\nimport { provideTabsetState, tabsetState } from './tabset-state';\n\n/**\n * Apply the `ngpTabset` directive to an element to manage the tabs.\n */\n@Directive({\n selector: '[ngpTabset]',\n exportAs: 'ngpTabset',\n providers: [provideTabsetState()],\n hostDirectives: [NgpRovingFocusGroup],\n host: {\n '[attr.id]': 'state.id()',\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpTabset {\n /**\n * Access the global tabset configuration\n */\n private readonly config = injectTabsConfig();\n\n /**\n * Access the roving focus group state\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * Define the id for the tabset\n */\n readonly id = input<string>(uniqueId('ngp-tabset'));\n\n /**\n * Define the active tab\n */\n readonly value = input<string>(undefined, {\n alias: 'ngpTabsetValue',\n });\n\n /**\n * Emit the value of the selected tab when it changes\n */\n readonly valueChange = output<string | undefined>({\n alias: 'ngpTabsetValueChange',\n });\n\n /**\n * The orientation of the tabset\n * @default 'horizontal'\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpTabsetOrientation',\n });\n\n /**\n * Whether tabs should activate on focus\n */\n readonly activateOnFocus = input<boolean, BooleanInput>(this.config.activateOnFocus, {\n alias: 'ngpTabsetActivateOnFocus',\n transform: booleanAttribute,\n });\n\n /**\n * Access the tabs within the tabset\n * @internal\n */\n readonly panels = signal<NgpTabPanel[]>([]);\n\n /**\n * @internal\n * Get the id of the selected tab\n */\n readonly selectedTab = computed(() => {\n const panels = this.panels();\n\n // if there is a value set and a tab with that value exists, return the value\n if (panels.some(panel => panel.value() === this.state.value())) {\n return this.state.value();\n }\n\n // otherwise return the first tab\n return panels[0]?.value();\n });\n\n /**\n * The state of the tabset\n */\n protected readonly state = tabsetState<NgpTabset>(this);\n\n constructor() {\n syncState(this.state.orientation, this.rovingFocusGroupState().orientation);\n }\n\n /**\n * Select a tab by its value\n * @param value The value of the tab to select\n */\n select(value: string): void {\n // if the value is already selected, do nothing\n if (this.state.value() === value) {\n return;\n }\n\n this.state.value.set(value);\n this.valueChange.emit(value);\n }\n\n /**\n * @internal\n * Register a tab with the tabset\n */\n registerTab(tab: NgpTabPanel): void {\n this.panels.update(panels => [...panels, tab]);\n }\n\n /**\n * @internal\n * Unregister a tab with the tabset\n */\n unregisterTab(tab: NgpTabPanel): void {\n this.panels.update(panels => panels.filter(panel => panel !== tab));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAuBO,MAAM,iBAAiB,GAAkB;AAC9C,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,IAAI,EAAE,IAAI;CACX;AAEM,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAgB,oBAAoB,CAAC;AAEzF;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,MAA8B,EAAA;IAC9D,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,kBAAkB;AAC3B,YAAA,QAAQ,EAAE,EAAE,GAAG,iBAAiB,EAAE,GAAG,MAAM,EAAE;AAC9C,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,gBAAgB,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EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,sBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,SAAA,EAAA,YAAA,EAAA,uBAAA,EAAA,qBAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAOtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBAVrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;oBACjC,cAAc,EAAE,CAAC,mBAAmB,CAAC;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,YAAY;AACzB,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;ACtBD;;AAEG;;;;"}
@@ -42,10 +42,10 @@ class NgpTextarea {
42
42
  });
43
43
  syncFormControl({ disabled: this.state.disabled });
44
44
  }
45
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTextarea, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
46
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpTextarea, isStandalone: true, selector: "[ngpTextarea]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTextareaState()], exportAs: ["ngpTextarea"], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
45
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTextarea, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
46
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpTextarea, isStandalone: true, selector: "[ngpTextarea]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTextareaState()], exportAs: ["ngpTextarea"], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
47
47
  }
48
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpTextarea, decorators: [{
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpTextarea, decorators: [{
49
49
  type: Directive,
50
50
  args: [{
51
51
  selector: '[ngpTextarea]',
@@ -222,10 +222,10 @@ class NgpToast {
222
222
  }
223
223
  }
224
224
  }
225
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToast, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
226
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpToast, isStandalone: true, selector: "[ngpToast]", inputs: { duration: { classPropertyName: "duration", publicName: "ngpToastDuration", isSignal: true, isRequired: false, transformFunction: null }, gravity: { classPropertyName: "gravity", publicName: "ngpToastGravity", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "ngpToastPosition", isSignal: true, isRequired: false, transformFunction: null }, stopOnHover: { classPropertyName: "stopOnHover", publicName: "ngpToastStopOnHover", isSignal: true, isRequired: false, transformFunction: null }, ariaLive: { classPropertyName: "ariaLive", publicName: "ngpToastAriaLive", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["ngpToast"], ngImport: i0 }); }
225
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToast, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
226
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpToast, isStandalone: true, selector: "[ngpToast]", inputs: { duration: { classPropertyName: "duration", publicName: "ngpToastDuration", isSignal: true, isRequired: false, transformFunction: null }, gravity: { classPropertyName: "gravity", publicName: "ngpToastGravity", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "ngpToastPosition", isSignal: true, isRequired: false, transformFunction: null }, stopOnHover: { classPropertyName: "stopOnHover", publicName: "ngpToastStopOnHover", isSignal: true, isRequired: false, transformFunction: null }, ariaLive: { classPropertyName: "ariaLive", publicName: "ngpToastAriaLive", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["ngpToast"], ngImport: i0 }); }
227
227
  }
228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToast, decorators: [{
228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToast, decorators: [{
229
229
  type: Directive,
230
230
  args: [{
231
231
  selector: '[ngpToast]',
@@ -3,6 +3,7 @@ import { InjectionToken, inject, input, booleanAttribute, computed, Directive, o
3
3
  import * as i1 from 'ng-primitives/roving-focus';
4
4
  import { NgpRovingFocusItem, injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';
5
5
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
6
+ import { syncState } from 'ng-primitives/internal';
6
7
 
7
8
  const defaultToggleGroupConfig = {
8
9
  orientation: 'horizontal',
@@ -107,10 +108,10 @@ class NgpToggleGroupItem {
107
108
  }
108
109
  this.toggleGroup().toggle(this.state.value());
109
110
  }
110
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToggleGroupItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
111
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpToggleGroupItem, isStandalone: true, selector: "[ngpToggleGroupItem]", inputs: { value: { classPropertyName: "value", publicName: "ngpToggleGroupItemValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpToggleGroupItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "radio" }, listeners: { "click": "toggle()" }, properties: { "attr.aria-checked": "selected()", "attr.data-selected": "selected() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideToggleGroupItemState()], exportAs: ["ngpToggleGroupItem"], hostDirectives: [{ directive: i1.NgpRovingFocusItem, inputs: ["ngpRovingFocusItemDisabled", "ngpToggleGroupItemDisabled"] }], ngImport: i0 }); }
111
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToggleGroupItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
112
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpToggleGroupItem, isStandalone: true, selector: "[ngpToggleGroupItem]", inputs: { value: { classPropertyName: "value", publicName: "ngpToggleGroupItemValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpToggleGroupItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "radio" }, listeners: { "click": "toggle()" }, properties: { "attr.aria-checked": "selected()", "attr.data-selected": "selected() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideToggleGroupItemState()], exportAs: ["ngpToggleGroupItem"], hostDirectives: [{ directive: i1.NgpRovingFocusItem, inputs: ["ngpRovingFocusItemDisabled", "ngpToggleGroupItemDisabled"] }], ngImport: i0 }); }
112
113
  }
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToggleGroupItem, decorators: [{
114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToggleGroupItem, decorators: [{
114
115
  type: Directive,
115
116
  args: [{
116
117
  selector: '[ngpToggleGroupItem]',
@@ -174,7 +175,7 @@ class NgpToggleGroup {
174
175
  this.state = toggleGroupState(this);
175
176
  // the roving focus group defaults to vertical orientation whereas
176
177
  // the default for the toggle group may be different if provided via global config
177
- this.rovingFocusGroupState().orientation.set(this.state.orientation());
178
+ syncState(this.state.orientation, this.rovingFocusGroupState().orientation);
178
179
  }
179
180
  /**
180
181
  * Select a value in the toggle group.
@@ -220,24 +221,18 @@ class NgpToggleGroup {
220
221
  this.select(value);
221
222
  }
222
223
  }
223
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToggleGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
224
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpToggleGroup, isStandalone: true, selector: "[ngpToggleGroup]", inputs: { orientation: { classPropertyName: "orientation", publicName: "ngpToggleGroupOrientation", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "ngpToggleGroupType", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpToggleGroupValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpToggleGroupDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpToggleGroupValueChange" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-orientation": "state.orientation()", "attr.data-orientation": "state.orientation()", "attr.data-type": "state.type()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideToggleGroupState()], exportAs: ["ngpToggleGroup"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup, inputs: ["ngpRovingFocusGroupOrientation", "ngpToggleGroupOrientation"] }], ngImport: i0 }); }
224
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToggleGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
225
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpToggleGroup, isStandalone: true, selector: "[ngpToggleGroup]", inputs: { orientation: { classPropertyName: "orientation", publicName: "ngpToggleGroupOrientation", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "ngpToggleGroupType", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpToggleGroupValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpToggleGroupDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpToggleGroupValueChange" }, host: { attributes: { "role": "group" }, properties: { "attr.data-orientation": "state.orientation()", "attr.data-type": "state.type()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideToggleGroupState()], exportAs: ["ngpToggleGroup"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup }], ngImport: i0 }); }
225
226
  }
226
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToggleGroup, decorators: [{
227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToggleGroup, decorators: [{
227
228
  type: Directive,
228
229
  args: [{
229
230
  selector: '[ngpToggleGroup]',
230
231
  exportAs: 'ngpToggleGroup',
231
232
  providers: [provideToggleGroupState()],
232
- hostDirectives: [
233
- {
234
- directive: NgpRovingFocusGroup,
235
- inputs: ['ngpRovingFocusGroupOrientation:ngpToggleGroupOrientation'],
236
- },
237
- ],
233
+ hostDirectives: [NgpRovingFocusGroup],
238
234
  host: {
239
235
  role: 'group',
240
- '[attr.aria-orientation]': 'state.orientation()',
241
236
  '[attr.data-orientation]': 'state.orientation()',
242
237
  '[attr.data-type]': 'state.type()',
243
238
  '[attr.data-disabled]': 'state.disabled() ? "" : null',
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-toggle-group.mjs","sources":["../../../../packages/ng-primitives/toggle-group/src/config/toggle-group-config.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group.ts","../../../../packages/ng-primitives/toggle-group/src/ng-primitives-toggle-group.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport interface NgpToggleGroupConfig {\n /**\n * The orientation of the toggle group.\n * @default 'horizontal'\n */\n orientation: NgpOrientation;\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n * @default 'single'\n */\n type: 'single' | 'multiple';\n}\n\nexport const defaultToggleGroupConfig: NgpToggleGroupConfig = {\n orientation: 'horizontal',\n type: 'single',\n};\n\nexport const NgpToggleGroupConfigToken = new InjectionToken<NgpToggleGroupConfig>(\n 'NgpToggleGroupConfigToken',\n);\n\n/**\n * Provide the default ToggleGroup configuration\n * @param config The ToggleGroup configuration\n * @returns The provider\n */\nexport function provideToggleGroupConfig(config: Partial<NgpToggleGroupConfig>): Provider[] {\n return [\n {\n provide: NgpToggleGroupConfigToken,\n useValue: { ...defaultToggleGroupConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the ToggleGroup configuration\n * @returns The global ToggleGroup configuration\n */\nexport function injectToggleGroupConfig(): NgpToggleGroupConfig {\n return inject(NgpToggleGroupConfigToken, { optional: true }) ?? defaultToggleGroupConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroup } from './toggle-group';\n\n/**\n * The state token for the ToggleGroup primitive.\n */\nexport const NgpToggleGroupStateToken = createStateToken<NgpToggleGroup>('ToggleGroup');\n\n/**\n * Provides the ToggleGroup state.\n */\nexport const provideToggleGroupState = createStateProvider(NgpToggleGroupStateToken);\n\n/**\n * Injects the ToggleGroup state.\n */\nexport const injectToggleGroupState = createStateInjector(NgpToggleGroupStateToken);\n\n/**\n * The ToggleGroup state registration function.\n */\nexport const toggleGroupState = createState(NgpToggleGroupStateToken);\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroupItem } from './toggle-group-item';\n\n/**\n * The state token for the ToggleGroupItem primitive.\n */\nexport const NgpToggleGroupItemStateToken = createStateToken<NgpToggleGroupItem>('ToggleGroupItem');\n\n/**\n * Provides the ToggleGroupItem state.\n */\nexport const provideToggleGroupItemState = createStateProvider(NgpToggleGroupItemStateToken);\n\n/**\n * Injects the ToggleGroupItem state.\n */\nexport const injectToggleGroupItemState = createStateInjector(NgpToggleGroupItemStateToken);\n\n/**\n * The ToggleGroupItem state registration function.\n */\nexport const toggleGroupItemState = createState(NgpToggleGroupItemStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, OnInit } from '@angular/core';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupState } from '../toggle-group/toggle-group-state';\nimport { provideToggleGroupItemState, toggleGroupItemState } from './toggle-group-item-state';\n\n@Directive({\n selector: '[ngpToggleGroupItem]',\n exportAs: 'ngpToggleGroupItem',\n providers: [provideToggleGroupItemState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusItem,\n inputs: ['ngpRovingFocusItemDisabled: ngpToggleGroupItemDisabled'],\n },\n ],\n host: {\n role: 'radio',\n '[attr.aria-checked]': 'selected()',\n '[attr.data-selected]': 'selected() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(click)': 'toggle()',\n },\n})\nexport class NgpToggleGroupItem implements OnInit {\n /**\n * Access the group that the item belongs to.\n */\n private readonly toggleGroup = injectToggleGroupState();\n\n /**\n * The value of the item.\n */\n readonly value = input<string>(undefined, {\n alias: 'ngpToggleGroupItemValue',\n });\n\n /**\n * Whether the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the item is selected.\n */\n protected readonly selected = computed(() => this.toggleGroup().isSelected(this.state.value()!));\n\n /**\n * The state of the item.\n */\n protected readonly state = toggleGroupItemState<NgpToggleGroupItem>(this);\n\n ngOnInit(): void {\n // we can't use a required input for value as it is used in a computed property before the input is set\n if (this.state.value() === undefined) {\n throw new Error('The value input is required for the toggle group item.');\n }\n }\n\n /**\n * Toggle the item.\n */\n protected toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.toggleGroup().toggle(this.state.value()!);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupConfig } from '../config/toggle-group-config';\nimport { provideToggleGroupState, toggleGroupState } from './toggle-group-state';\n\n@Directive({\n selector: '[ngpToggleGroup]',\n exportAs: 'ngpToggleGroup',\n providers: [provideToggleGroupState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusGroup,\n inputs: ['ngpRovingFocusGroupOrientation:ngpToggleGroupOrientation'],\n },\n ],\n host: {\n role: 'group',\n '[attr.aria-orientation]': 'state.orientation()',\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-type]': 'state.type()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpToggleGroup {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * Access the global toggle group configuration.\n */\n private readonly config = injectToggleGroupConfig();\n\n /**\n * The orientation of the toggle group.\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpToggleGroupOrientation',\n });\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n */\n readonly type = input<'single' | 'multiple'>(this.config.type, { alias: 'ngpToggleGroupType' });\n\n /**\n * The selected value(s) of the toggle group.\n */\n readonly value = input<string[]>([], { alias: 'ngpToggleGroupValue' });\n\n /**\n * Emits when the value of the toggle group changes.\n */\n readonly valueChange = output<string[]>({ alias: 'ngpToggleGroupValueChange' });\n\n /**\n * Whether the toggle group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the toggle group.\n */\n protected readonly state = toggleGroupState<NgpToggleGroup>(this);\n\n constructor() {\n // the roving focus group defaults to vertical orientation whereas\n // the default for the toggle group may be different if provided via global config\n this.rovingFocusGroupState().orientation.set(this.state.orientation());\n }\n\n /**\n * Select a value in the toggle group.\n */\n private select(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n if (this.state.type() === 'single') {\n this.state.value.set([value]);\n } else {\n this.state.value.set([...this.state.value(), value]);\n }\n\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * De-select a value in the toggle group.\n */\n private deselect(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.value.set(this.state.value().filter(v => v !== value));\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * Check if a value is selected in the toggle group.\n * @internal\n */\n isSelected(value: string): boolean {\n return this.state.value()?.includes(value) ?? false;\n }\n\n /**\n * Toggle a value in the toggle group.\n * @internal\n */\n toggle(value: string): void {\n if (this.isSelected(value)) {\n this.deselect(value);\n } else {\n this.select(value);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAiBO,MAAM,wBAAwB,GAAyB;AAC5D,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,IAAI,EAAE,QAAQ;CACf;AAEM,MAAM,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B,CAC5B;AAED;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAAqC,EAAA;IAC5E,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,yBAAyB;AAClC,YAAA,QAAQ,EAAE,EAAE,GAAG,wBAAwB,EAAE,GAAG,MAAM,EAAE;AACrD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,uBAAuB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,wBAAwB;AAC1F;;ACtCA;;AAEG;AACI,MAAM,wBAAwB,GAAG,gBAAgB,CAAiB,aAAa,CAAC;AAEvF;;AAEG;MACU,uBAAuB,GAAG,mBAAmB,CAAC,wBAAwB;AAEnF;;AAEG;MACU,sBAAsB,GAAG,mBAAmB,CAAC,wBAAwB;AAElF;;AAEG;AACI,MAAM,gBAAgB,GAAG,WAAW,CAAC,wBAAwB,CAAC;;AClBrE;;AAEG;AACI,MAAM,4BAA4B,GAAG,gBAAgB,CAAqB,iBAAiB,CAAC;AAEnG;;AAEG;MACU,2BAA2B,GAAG,mBAAmB,CAAC,4BAA4B;AAE3F;;AAEG;MACU,0BAA0B,GAAG,mBAAmB,CAAC,4BAA4B;AAE1F;;AAEG;AACI,MAAM,oBAAoB,GAAG,WAAW,CAAC,4BAA4B,CAAC;;MCDhE,kBAAkB,CAAA;AAnB/B,IAAA,WAAA,GAAA;AAoBE;;AAEG;QACc,IAAW,CAAA,WAAA,GAAG,sBAAsB,EAAE;AAEvD;;AAEG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A,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAe3B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAlB1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,SAAS,EAAE,CAAC,uBAAuB,EAAE,CAAC;AACtC,oBAAA,cAAc,EAAE;AACd,wBAAA;AACE,4BAAA,SAAS,EAAE,mBAAmB;4BAC9B,MAAM,EAAE,CAAC,0DAA0D,CAAC;AACrE,yBAAA;AACF,qBAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,yBAAyB,EAAE,qBAAqB;AAChD,wBAAA,yBAAyB,EAAE,qBAAqB;AAChD,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,sBAAsB,EAAE,8BAA8B;AACvD,qBAAA;AACF,iBAAA;;;ACxBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-toggle-group.mjs","sources":["../../../../packages/ng-primitives/toggle-group/src/config/toggle-group-config.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group.ts","../../../../packages/ng-primitives/toggle-group/src/ng-primitives-toggle-group.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport interface NgpToggleGroupConfig {\n /**\n * The orientation of the toggle group.\n * @default 'horizontal'\n */\n orientation: NgpOrientation;\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n * @default 'single'\n */\n type: 'single' | 'multiple';\n}\n\nexport const defaultToggleGroupConfig: NgpToggleGroupConfig = {\n orientation: 'horizontal',\n type: 'single',\n};\n\nexport const NgpToggleGroupConfigToken = new InjectionToken<NgpToggleGroupConfig>(\n 'NgpToggleGroupConfigToken',\n);\n\n/**\n * Provide the default ToggleGroup configuration\n * @param config The ToggleGroup configuration\n * @returns The provider\n */\nexport function provideToggleGroupConfig(config: Partial<NgpToggleGroupConfig>): Provider[] {\n return [\n {\n provide: NgpToggleGroupConfigToken,\n useValue: { ...defaultToggleGroupConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the ToggleGroup configuration\n * @returns The global ToggleGroup configuration\n */\nexport function injectToggleGroupConfig(): NgpToggleGroupConfig {\n return inject(NgpToggleGroupConfigToken, { optional: true }) ?? defaultToggleGroupConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroup } from './toggle-group';\n\n/**\n * The state token for the ToggleGroup primitive.\n */\nexport const NgpToggleGroupStateToken = createStateToken<NgpToggleGroup>('ToggleGroup');\n\n/**\n * Provides the ToggleGroup state.\n */\nexport const provideToggleGroupState = createStateProvider(NgpToggleGroupStateToken);\n\n/**\n * Injects the ToggleGroup state.\n */\nexport const injectToggleGroupState = createStateInjector(NgpToggleGroupStateToken);\n\n/**\n * The ToggleGroup state registration function.\n */\nexport const toggleGroupState = createState(NgpToggleGroupStateToken);\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroupItem } from './toggle-group-item';\n\n/**\n * The state token for the ToggleGroupItem primitive.\n */\nexport const NgpToggleGroupItemStateToken = createStateToken<NgpToggleGroupItem>('ToggleGroupItem');\n\n/**\n * Provides the ToggleGroupItem state.\n */\nexport const provideToggleGroupItemState = createStateProvider(NgpToggleGroupItemStateToken);\n\n/**\n * Injects the ToggleGroupItem state.\n */\nexport const injectToggleGroupItemState = createStateInjector(NgpToggleGroupItemStateToken);\n\n/**\n * The ToggleGroupItem state registration function.\n */\nexport const toggleGroupItemState = createState(NgpToggleGroupItemStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, OnInit } from '@angular/core';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupState } from '../toggle-group/toggle-group-state';\nimport { provideToggleGroupItemState, toggleGroupItemState } from './toggle-group-item-state';\n\n@Directive({\n selector: '[ngpToggleGroupItem]',\n exportAs: 'ngpToggleGroupItem',\n providers: [provideToggleGroupItemState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusItem,\n inputs: ['ngpRovingFocusItemDisabled: ngpToggleGroupItemDisabled'],\n },\n ],\n host: {\n role: 'radio',\n '[attr.aria-checked]': 'selected()',\n '[attr.data-selected]': 'selected() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(click)': 'toggle()',\n },\n})\nexport class NgpToggleGroupItem implements OnInit {\n /**\n * Access the group that the item belongs to.\n */\n private readonly toggleGroup = injectToggleGroupState();\n\n /**\n * The value of the item.\n */\n readonly value = input<string>(undefined, {\n alias: 'ngpToggleGroupItemValue',\n });\n\n /**\n * Whether the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the item is selected.\n */\n protected readonly selected = computed(() => this.toggleGroup().isSelected(this.state.value()!));\n\n /**\n * The state of the item.\n */\n protected readonly state = toggleGroupItemState<NgpToggleGroupItem>(this);\n\n ngOnInit(): void {\n // we can't use a required input for value as it is used in a computed property before the input is set\n if (this.state.value() === undefined) {\n throw new Error('The value input is required for the toggle group item.');\n }\n }\n\n /**\n * Toggle the item.\n */\n protected toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.toggleGroup().toggle(this.state.value()!);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { syncState } from 'ng-primitives/internal';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupConfig } from '../config/toggle-group-config';\nimport { provideToggleGroupState, toggleGroupState } from './toggle-group-state';\n\n@Directive({\n selector: '[ngpToggleGroup]',\n exportAs: 'ngpToggleGroup',\n providers: [provideToggleGroupState()],\n hostDirectives: [NgpRovingFocusGroup],\n host: {\n role: 'group',\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-type]': 'state.type()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpToggleGroup {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * Access the global toggle group configuration.\n */\n private readonly config = injectToggleGroupConfig();\n\n /**\n * The orientation of the toggle group.\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpToggleGroupOrientation',\n });\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n */\n readonly type = input<'single' | 'multiple'>(this.config.type, { alias: 'ngpToggleGroupType' });\n\n /**\n * The selected value(s) of the toggle group.\n */\n readonly value = input<string[]>([], { alias: 'ngpToggleGroupValue' });\n\n /**\n * Emits when the value of the toggle group changes.\n */\n readonly valueChange = output<string[]>({ alias: 'ngpToggleGroupValueChange' });\n\n /**\n * Whether the toggle group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the toggle group.\n */\n protected readonly state = toggleGroupState<NgpToggleGroup>(this);\n\n constructor() {\n // the roving focus group defaults to vertical orientation whereas\n // the default for the toggle group may be different if provided via global config\n syncState(this.state.orientation, this.rovingFocusGroupState().orientation);\n }\n\n /**\n * Select a value in the toggle group.\n */\n private select(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n if (this.state.type() === 'single') {\n this.state.value.set([value]);\n } else {\n this.state.value.set([...this.state.value(), value]);\n }\n\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * De-select a value in the toggle group.\n */\n private deselect(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.value.set(this.state.value().filter(v => v !== value));\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * Check if a value is selected in the toggle group.\n * @internal\n */\n isSelected(value: string): boolean {\n return this.state.value()?.includes(value) ?? false;\n }\n\n /**\n * Toggle a value in the toggle group.\n * @internal\n */\n toggle(value: string): void {\n if (this.isSelected(value)) {\n this.deselect(value);\n } else {\n this.select(value);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAiBO,MAAM,wBAAwB,GAAyB;AAC5D,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,IAAI,EAAE,QAAQ;CACf;AAEM,MAAM,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B,CAC5B;AAED;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAAqC,EAAA;IAC5E,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,yBAAyB;AAClC,YAAA,QAAQ,EAAE,EAAE,GAAG,wBAAwB,EAAE,GAAG,MAAM,EAAE;AACrD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,uBAAuB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,wBAAwB;AAC1F;;ACtCA;;AAEG;AACI,MAAM,wBAAwB,GAAG,gBAAgB,CAAiB,aAAa,CAAC;AAEvF;;AAEG;MACU,uBAAuB,GAAG,mBAAmB,CAAC,wBAAwB;AAEnF;;AAEG;MACU,sBAAsB,GAAG,mBAAmB,CAAC,wBAAwB;AAElF;;AAEG;AACI,MAAM,gBAAgB,GAAG,WAAW,CAAC,wBAAwB,CAAC;;AClBrE;;AAEG;AACI,MAAM,4BAA4B,GAAG,gBA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BAAA,EAAA,qBAAA,EAAA,gBAAA,EAAA,cAAA,EAAA,oBAAA,EAAA,gCAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,uBAAuB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAS3B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAZ1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,SAAS,EAAE,CAAC,uBAAuB,EAAE,CAAC;oBACtC,cAAc,EAAE,CAAC,mBAAmB,CAAC;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,yBAAyB,EAAE,qBAAqB;AAChD,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,sBAAsB,EAAE,8BAA8B;AACvD,qBAAA;AACF,iBAAA;;;ACnBD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, input, booleanAttribute, output, Directive, HostListener } from '@angular/core';
2
+ import { inject, ElementRef, input, booleanAttribute, output, HostListener, Directive } from '@angular/core';
3
3
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
4
4
 
5
5
  /**
@@ -79,10 +79,10 @@ class NgpToggle {
79
79
  this.toggle();
80
80
  }
81
81
  }
82
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToggle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
83
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpToggle, isStandalone: true, selector: "[ngpToggle]", inputs: { selected: { classPropertyName: "selected", publicName: "ngpToggleSelected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpToggleDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "ngpToggleSelectedChange" }, host: { listeners: { "click": "toggle()", "keydown.space": "onKeyDown($event)" }, properties: { "attr.type": "isButton ? \"button\" : null", "attr.aria-pressed": "state.selected()", "attr.data-selected": "state.selected() ? \"\" : null", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideToggleState()], exportAs: ["ngpToggle"], ngImport: i0 }); }
82
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToggle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
83
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpToggle, isStandalone: true, selector: "[ngpToggle]", inputs: { selected: { classPropertyName: "selected", publicName: "ngpToggleSelected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpToggleDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "ngpToggleSelectedChange" }, host: { listeners: { "click": "toggle()", "keydown.space": "onKeyDown($event)" }, properties: { "attr.type": "isButton ? \"button\" : null", "attr.aria-pressed": "state.selected()", "attr.data-selected": "state.selected() ? \"\" : null", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideToggleState()], exportAs: ["ngpToggle"], ngImport: i0 }); }
84
84
  }
85
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToggle, decorators: [{
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToggle, decorators: [{
86
86
  type: Directive,
87
87
  args: [{
88
88
  selector: '[ngpToggle]',
@@ -1,42 +1,66 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, Directive } from '@angular/core';
3
+ import { syncState } from 'ng-primitives/internal';
3
4
  import * as i1 from 'ng-primitives/roving-focus';
4
- import { NgpRovingFocusGroup } from 'ng-primitives/roving-focus';
5
+ import { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';
6
+ import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
7
+
8
+ /**
9
+ * The state token for the Toolbar primitive.
10
+ */
11
+ const NgpToolbarStateToken = createStateToken('Toolbar');
12
+ /**
13
+ * Provides the Toolbar state.
14
+ */
15
+ const provideToolbarState = createStateProvider(NgpToolbarStateToken);
16
+ /**
17
+ * Injects the Toolbar state.
18
+ */
19
+ const injectToolbarState = createStateInjector(NgpToolbarStateToken);
20
+ /**
21
+ * The Toolbar state registration function.
22
+ */
23
+ const toolbarState = createState(NgpToolbarStateToken);
5
24
 
6
25
  class NgpToolbar {
7
26
  constructor() {
27
+ /**
28
+ * Access the roving focus group state.
29
+ */
30
+ this.rovingFocusGroup = injectRovingFocusGroupState();
8
31
  /**
9
32
  * The orientation of the toolbar.
10
33
  */
11
34
  this.orientation = input('horizontal', {
12
35
  alias: 'ngpToolbarOrientation',
13
36
  });
37
+ /**
38
+ * The toolbar state.
39
+ */
40
+ this.state = toolbarState(this);
41
+ syncState(this.state.orientation, this.rovingFocusGroup().orientation);
14
42
  }
15
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToolbar, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
16
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpToolbar, isStandalone: true, selector: "[ngpToolbar]", inputs: { orientation: { classPropertyName: "orientation", publicName: "ngpToolbarOrientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "toolbar" }, properties: { "attr.aria-orientation": "orientation()", "attr.data-orientation": "orientation()" } }, exportAs: ["ngpToolbar"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup, inputs: ["ngpRovingFocusGroupOrientation", "ngpToolbarOrientation"] }], ngImport: i0 }); }
43
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToolbar, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
44
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: NgpToolbar, isStandalone: true, selector: "[ngpToolbar]", inputs: { orientation: { classPropertyName: "orientation", publicName: "ngpToolbarOrientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "toolbar" }, properties: { "attr.aria-orientation": "state.orientation()", "attr.data-orientation": "state.orientation()" } }, providers: [provideToolbarState()], exportAs: ["ngpToolbar"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup }], ngImport: i0 }); }
17
45
  }
18
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpToolbar, decorators: [{
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: NgpToolbar, decorators: [{
19
47
  type: Directive,
20
48
  args: [{
21
49
  selector: '[ngpToolbar]',
22
50
  exportAs: 'ngpToolbar',
23
- hostDirectives: [
24
- {
25
- directive: NgpRovingFocusGroup,
26
- inputs: ['ngpRovingFocusGroupOrientation:ngpToolbarOrientation'],
27
- },
28
- ],
51
+ providers: [provideToolbarState()],
52
+ hostDirectives: [NgpRovingFocusGroup],
29
53
  host: {
30
54
  role: 'toolbar',
31
- '[attr.aria-orientation]': 'orientation()',
32
- '[attr.data-orientation]': 'orientation()',
55
+ '[attr.aria-orientation]': 'state.orientation()',
56
+ '[attr.data-orientation]': 'state.orientation()',
33
57
  },
34
58
  }]
35
- }] });
59
+ }], ctorParameters: () => [] });
36
60
 
37
61
  /**
38
62
  * Generated bundle index. Do not edit.
39
63
  */
40
64
 
41
- export { NgpToolbar };
65
+ export { NgpToolbar, injectToolbarState, provideToolbarState };
42
66
  //# sourceMappingURL=ng-primitives-toolbar.mjs.map