ng-primitives 0.91.2 → 0.93.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 (55) hide show
  1. package/a11y/index.d.ts +3 -1
  2. package/accordion/index.d.ts +8 -1
  3. package/autofill/index.d.ts +4 -0
  4. package/avatar/index.d.ts +11 -2
  5. package/breadcrumbs/index.d.ts +21 -7
  6. package/button/index.d.ts +3 -1
  7. package/checkbox/index.d.ts +3 -1
  8. package/fesm2022/ng-primitives-checkbox.mjs +7 -8
  9. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  10. package/fesm2022/ng-primitives-file-upload.mjs +209 -202
  11. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  12. package/fesm2022/ng-primitives-focus-trap.mjs +107 -138
  13. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  14. package/fesm2022/ng-primitives-form-field.mjs +323 -399
  15. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  16. package/fesm2022/ng-primitives-interactions.mjs +57 -58
  17. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  18. package/fesm2022/ng-primitives-listbox.mjs +2 -2
  19. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  20. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  21. package/fesm2022/ng-primitives-portal.mjs +5 -1
  22. package/fesm2022/ng-primitives-portal.mjs.map +1 -1
  23. package/fesm2022/ng-primitives-slider.mjs +4 -5
  24. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  25. package/fesm2022/ng-primitives-state.mjs +36 -8
  26. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  27. package/fesm2022/ng-primitives-switch.mjs +4 -5
  28. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  29. package/fesm2022/ng-primitives-tabs.mjs +194 -192
  30. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  31. package/fesm2022/ng-primitives-toggle-group.mjs +4 -5
  32. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  33. package/fesm2022/ng-primitives-toggle.mjs +4 -5
  34. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  35. package/fesm2022/ng-primitives-tooltip.mjs +4 -4
  36. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  37. package/fesm2022/ng-primitives-utils.mjs +23 -14
  38. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  39. package/file-upload/index.d.ts +100 -52
  40. package/focus-trap/index.d.ts +33 -75
  41. package/form-field/index.d.ts +320 -123
  42. package/input/index.d.ts +6 -0
  43. package/interactions/index.d.ts +16 -16
  44. package/package.json +1 -1
  45. package/roving-focus/index.d.ts +6 -2
  46. package/schematics/ng-generate/templates/tabs/tabs.__fileSuffix@dasherize__.ts.template +2 -2
  47. package/slider/index.d.ts +14 -6
  48. package/state/index.d.ts +23 -8
  49. package/switch/index.d.ts +8 -4
  50. package/tabs/index.d.ts +333 -84
  51. package/textarea/index.d.ts +6 -0
  52. package/toggle/index.d.ts +5 -3
  53. package/toggle-group/index.d.ts +6 -2
  54. package/toolbar/index.d.ts +5 -0
  55. package/utils/index.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-switch.mjs","sources":["../../../../packages/ng-primitives/switch/src/switch/switch-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb.ts","../../../../packages/ng-primitives/switch/src/switch/switch.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["import { computed, Signal, signal, WritableSignal } from '@angular/core';\nimport { ngpFormControl } from 'ng-primitives/form-field';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n attrBinding,\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n listener,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Subject } from 'rxjs/internal/Subject';\n\n/**\n * Public state surface for the Switch primitive.\n */\nexport interface NgpSwitchState {\n /**\n * The id of the switch.\n */\n readonly id: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked: WritableSignal<boolean>;\n /**\n * Whether the switch is disabled (includes form control state).\n */\n readonly disabled: WritableSignal<boolean>;\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange: Subject<boolean>;\n /**\n * Toggle the switch state.\n */\n toggle(event?: Event): void;\n /**\n * Update the checked value.\n */\n setChecked(value: boolean): void;\n /**\n * Update the disabled value.\n */\n setDisabled(value: boolean): void;\n}\n\n/**\n * Inputs for configuring the Switch primitive.\n */\nexport interface NgpSwitchProps {\n /**\n * The id of the switch.\n */\n readonly id?: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked?: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback fired when the checked state changes.\n */\n readonly onCheckedChange?: (checked: boolean) => void;\n}\n\nexport const [NgpSwitchStateToken, ngpSwitch, injectSwitchState, provideSwitchState] =\n createPrimitive(\n 'NgpSwitch',\n ({\n id = signal(uniqueId('ngp-switch')),\n checked: _checked = signal(false),\n disabled: _disabled = signal(false),\n onCheckedChange,\n }: NgpSwitchProps): NgpSwitchState => {\n const element = injectElementRef<HTMLElement>();\n const isButton = element.nativeElement.tagName.toLowerCase() === 'button';\n const checked = controlled(_checked);\n const disabledInput = controlled(_disabled);\n\n // Form control and interactions\n const status = ngpFormControl({ id, disabled: disabledInput });\n const disabled = computed(() => status().disabled ?? disabledInput());\n ngpInteractions({ hover: true, press: true, focusVisible: true, disabled });\n\n const checkedChange = new Subject<boolean>();\n const tabindex = computed(() => (disabled() ? -1 : 0));\n\n // Host bindings\n attrBinding(element, 'role', 'switch');\n attrBinding(element, 'id', id);\n attrBinding(element, 'type', () => (isButton ? 'button' : null));\n attrBinding(element, 'aria-checked', checked);\n dataBinding(element, 'data-checked', checked);\n attrBinding(element, 'aria-disabled', disabled);\n dataBinding(element, 'data-disabled', disabled);\n attrBinding(element, 'disabled', () => (isButton && disabled() ? '' : null));\n attrBinding(element, 'tabindex', tabindex);\n\n // Listeners\n listener(element, 'click', event => toggle(event));\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (event.key === ' ' || event.key === 'Space') {\n event.preventDefault();\n if (!isButton) {\n toggle(event);\n }\n }\n });\n\n function toggle(event?: Event): void {\n if (disabled()) {\n return;\n }\n\n event?.preventDefault?.();\n setChecked(!checked());\n }\n\n function setChecked(value: boolean): void {\n checked.set(value);\n onCheckedChange?.(value);\n checkedChange.next(value);\n }\n\n function setDisabled(value: boolean): void {\n disabledInput.set(value);\n }\n\n return {\n id,\n checked: deprecatedSetter(checked, 'setChecked'),\n disabled: deprecatedSetter(disabledInput, 'setDisabled'),\n checkedChange,\n toggle,\n setChecked,\n setDisabled,\n };\n },\n );\n","import { computed, Signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectSwitchState } from '../switch/switch-state';\n\n/**\n * Public state surface for the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbState {\n /**\n * Whether the switch is checked.\n */\n readonly checked: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Inputs for configuring the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbProps {}\n\nexport const [\n NgpSwitchThumbStateToken,\n ngpSwitchThumb,\n injectSwitchThumbState,\n provideSwitchThumbState,\n] = createPrimitive('NgpSwitchThumb', ({}: NgpSwitchThumbProps): NgpSwitchThumbState => {\n const element = injectElementRef();\n const switchState = injectSwitchState();\n\n const checked = computed(() => switchState().checked());\n const disabled = computed(() => switchState().disabled());\n\n // Host bindings\n dataBinding(element, 'data-checked', checked);\n dataBinding(element, 'data-disabled', disabled);\n\n ngpInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled,\n });\n\n return { checked, disabled };\n});\n","import { Directive } from '@angular/core';\nimport { ngpSwitchThumb, provideSwitchThumbState } from './switch-thumb-state';\n\n/**\n * Apply the `ngpSwitchThumb` directive to an element within a switch to represent the thumb.\n */\n@Directive({\n selector: '[ngpSwitchThumb]',\n providers: [provideSwitchThumbState({ inherit: false })],\n})\nexport class NgpSwitchThumb {\n constructor() {\n ngpSwitchThumb({});\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpSwitch, provideSwitchState } from './switch-state';\n\n/**\n * Apply the `ngpSwitch` directive to an element to manage the checked state.\n */\n@Directive({\n selector: '[ngpSwitch]',\n exportAs: 'ngpSwitch',\n providers: [provideSwitchState({ inherit: false })],\n})\nexport class NgpSwitch {\n /**\n * The id of the switch. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-switch'));\n\n /**\n * Determine if the switch is checked.\n * @default false\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchChecked',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpSwitchCheckedChange',\n });\n\n /**\n * Determine if the switch is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The switch state.\n * @internal\n */\n readonly state = ngpSwitch({\n id: this.id,\n checked: this.checked,\n disabled: this.disabled,\n onCheckedChange: value => this.checkedChange.emit(value),\n });\n\n /**\n * Toggle the checked state.\n */\n toggle(): void {\n this.state.toggle();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAuEa,CAAC,mBAAmB,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,G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EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,iBAAA;;;ACZD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-switch.mjs","sources":["../../../../packages/ng-primitives/switch/src/switch/switch-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb-state.ts","../../../../packages/ng-primitives/switch/src/switch-thumb/switch-thumb.ts","../../../../packages/ng-primitives/switch/src/switch/switch.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["import { computed, Signal, signal, WritableSignal } from '@angular/core';\nimport { ngpFormControl } from 'ng-primitives/form-field';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n attrBinding,\n controlled,\n createPrimitive,\n dataBinding,\n deprecatedSetter,\n emitter,\n listener,\n} from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable } from 'rxjs';\n\n/**\n * Public state surface for the Switch primitive.\n */\nexport interface NgpSwitchState {\n /**\n * The id of the switch.\n */\n readonly id: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked: WritableSignal<boolean>;\n /**\n * Whether the switch is disabled (includes form control state).\n */\n readonly disabled: WritableSignal<boolean>;\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange: Observable<boolean>;\n /**\n * Toggle the switch state.\n */\n toggle(event?: Event): void;\n /**\n * Update the checked value.\n */\n setChecked(value: boolean): void;\n /**\n * Update the disabled value.\n */\n setDisabled(value: boolean): void;\n}\n\n/**\n * Inputs for configuring the Switch primitive.\n */\nexport interface NgpSwitchProps {\n /**\n * The id of the switch.\n */\n readonly id?: Signal<string>;\n /**\n * Whether the switch is checked.\n */\n readonly checked?: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Callback fired when the checked state changes.\n */\n readonly onCheckedChange?: (checked: boolean) => void;\n}\n\nexport const [NgpSwitchStateToken, ngpSwitch, injectSwitchState, provideSwitchState] =\n createPrimitive(\n 'NgpSwitch',\n ({\n id = signal(uniqueId('ngp-switch')),\n checked: _checked = signal(false),\n disabled: _disabled = signal(false),\n onCheckedChange,\n }: NgpSwitchProps): NgpSwitchState => {\n const element = injectElementRef<HTMLElement>();\n const isButton = element.nativeElement.tagName.toLowerCase() === 'button';\n const checked = controlled(_checked);\n const disabledInput = controlled(_disabled);\n\n // Form control and interactions\n const status = ngpFormControl({ id, disabled: disabledInput });\n const disabled = computed(() => status().disabled ?? disabledInput());\n ngpInteractions({ hover: true, press: true, focusVisible: true, disabled });\n\n const checkedChange = emitter<boolean>();\n const tabindex = computed(() => (disabled() ? -1 : 0));\n\n // Host bindings\n attrBinding(element, 'role', 'switch');\n attrBinding(element, 'id', id);\n attrBinding(element, 'type', () => (isButton ? 'button' : null));\n attrBinding(element, 'aria-checked', checked);\n dataBinding(element, 'data-checked', checked);\n attrBinding(element, 'aria-disabled', disabled);\n dataBinding(element, 'data-disabled', disabled);\n attrBinding(element, 'disabled', () => (isButton && disabled() ? '' : null));\n attrBinding(element, 'tabindex', tabindex);\n\n // Listeners\n listener(element, 'click', event => toggle(event));\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (event.key === ' ' || event.key === 'Space') {\n event.preventDefault();\n if (!isButton) {\n toggle(event);\n }\n }\n });\n\n function toggle(event?: Event): void {\n if (disabled()) {\n return;\n }\n\n event?.preventDefault?.();\n setChecked(!checked());\n }\n\n function setChecked(value: boolean): void {\n checked.set(value);\n onCheckedChange?.(value);\n checkedChange.emit(value);\n }\n\n function setDisabled(value: boolean): void {\n disabledInput.set(value);\n }\n\n return {\n id,\n checked: deprecatedSetter(checked, 'setChecked'),\n disabled: deprecatedSetter(disabledInput, 'setDisabled'),\n checkedChange: checkedChange.asObservable(),\n toggle,\n setChecked,\n setDisabled,\n };\n },\n );\n","import { computed, Signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { createPrimitive, dataBinding } from 'ng-primitives/state';\nimport { injectSwitchState } from '../switch/switch-state';\n\n/**\n * Public state surface for the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbState {\n /**\n * Whether the switch is checked.\n */\n readonly checked: Signal<boolean>;\n /**\n * Whether the switch is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Inputs for configuring the Switch Thumb primitive.\n */\nexport interface NgpSwitchThumbProps {}\n\nexport const [\n NgpSwitchThumbStateToken,\n ngpSwitchThumb,\n injectSwitchThumbState,\n provideSwitchThumbState,\n] = createPrimitive('NgpSwitchThumb', ({}: NgpSwitchThumbProps): NgpSwitchThumbState => {\n const element = injectElementRef();\n const switchState = injectSwitchState();\n\n const checked = computed(() => switchState().checked());\n const disabled = computed(() => switchState().disabled());\n\n // Host bindings\n dataBinding(element, 'data-checked', checked);\n dataBinding(element, 'data-disabled', disabled);\n\n ngpInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled,\n });\n\n return { checked, disabled };\n});\n","import { Directive } from '@angular/core';\nimport { ngpSwitchThumb, provideSwitchThumbState } from './switch-thumb-state';\n\n/**\n * Apply the `ngpSwitchThumb` directive to an element within a switch to represent the thumb.\n */\n@Directive({\n selector: '[ngpSwitchThumb]',\n providers: [provideSwitchThumbState({ inherit: false })],\n})\nexport class NgpSwitchThumb {\n constructor() {\n ngpSwitchThumb({});\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpSwitch, provideSwitchState } from './switch-state';\n\n/**\n * Apply the `ngpSwitch` directive to an element to manage the checked state.\n */\n@Directive({\n selector: '[ngpSwitch]',\n exportAs: 'ngpSwitch',\n providers: [provideSwitchState({ inherit: false })],\n})\nexport class NgpSwitch {\n /**\n * The id of the switch. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-switch'));\n\n /**\n * Determine if the switch is checked.\n * @default false\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchChecked',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the checked state changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpSwitchCheckedChange',\n });\n\n /**\n * Determine if the switch is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSwitchDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The switch state.\n * @internal\n */\n readonly state = ngpSwitch({\n id: this.id,\n checked: this.checked,\n disabled: this.disabled,\n onCheckedChange: value => this.checkedChange.emit(value),\n });\n\n /**\n * Toggle the checked state.\n */\n toggle(): void {\n this.state.toggle();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAwEa,CAAC,mBAAmB,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,GAClF,eAAe,CACb,WAAW,EACX,CAAC,EACC,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EACnC,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EACjC,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,EACnC,eAAe,GACA,KAAoB;AACnC,IAAA,MAAM,OAAO,GAAG,gBAAgB,EAAe;AAC/C,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,QAAQ;AACzE,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC;AACpC,IAAA,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC;;AAG3C,IAAA,MAAM,MAAM,GAAG,cAAc,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE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AAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,aAAA,EAAA,wBAAA,EAAA,EAAA,SAAA,EAFT,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAExC,SAAS,EAAA,UAAA,EAAA,CAAA;kBALrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,iBAAA;;;ACZD;;AAEG;;;;"}
@@ -1,10 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, HOST_TAG_NAME, input, booleanAttribute, computed, HostListener, Directive, output, signal } from '@angular/core';
2
+ import { InjectionToken, inject, signal, computed, HOST_TAG_NAME, input, booleanAttribute, Directive, output } from '@angular/core';
3
+ import { ngpRovingFocusItem, provideRovingFocusItemState, ngpRovingFocusGroup, provideRovingFocusGroupState } from 'ng-primitives/roving-focus';
3
4
  import { ngpInteractions } from 'ng-primitives/interactions';
4
- import * as i1 from 'ng-primitives/roving-focus';
5
- import { NgpRovingFocusItem, injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';
6
- import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
7
- import { explicitEffect } from 'ng-primitives/internal';
5
+ import { injectElementRef } from 'ng-primitives/internal';
6
+ import { createPrimitive, controlled, attrBinding, dataBinding, deprecatedSetter, listener, onMount, onDestroy } from 'ng-primitives/state';
8
7
  import { uniqueId } from 'ng-primitives/utils';
9
8
 
10
9
  const defaultTabsConfig = {
@@ -34,36 +33,120 @@ function injectTabsConfig() {
34
33
  return inject(NgpTabsConfigToken, { optional: true }) ?? defaultTabsConfig;
35
34
  }
36
35
 
37
- /**
38
- * The state token for the Tabset primitive.
39
- */
40
- const NgpTabsetStateToken = createStateToken('Tabset');
41
- /**
42
- * Provides the Tabset state.
43
- */
44
- const provideTabsetState = createStateProvider(NgpTabsetStateToken);
45
- /**
46
- * Injects the Tabset state.
47
- */
48
- const injectTabsetState = createStateInjector(NgpTabsetStateToken);
49
- /**
50
- * The Tabset state registration function.
51
- */
52
- const tabsetState = createState(NgpTabsetStateToken);
36
+ const [NgpTabsetStateToken, ngpTabset, injectTabsetState, provideTabsetState] = createPrimitive('NgpTabset', ({ id = signal(uniqueId('ngp-tabset')), value: _value = signal(undefined), orientation: _orientation = signal('horizontal'), activateOnFocus = signal(false), onValueChange, }) => {
37
+ const element = injectElementRef();
38
+ const tabs = signal([], ...(ngDevMode ? [{ debugName: "tabs" }] : []));
39
+ const value = controlled(_value);
40
+ const orientation = controlled(_orientation);
41
+ // Host bindings
42
+ attrBinding(element, 'id', id);
43
+ dataBinding(element, 'data-orientation', orientation);
44
+ // Computed selected tab
45
+ const selectedTab = computed(() => {
46
+ const tabList = tabs();
47
+ const currentValue = value();
48
+ // if there are no tabs then return the selected value
49
+ if (tabList.length === 0) {
50
+ return currentValue;
51
+ }
52
+ // if there is a value set and a tab with that value exists, return the value
53
+ if (currentValue && tabList.some(tab => tab.value() === currentValue)) {
54
+ return currentValue;
55
+ }
56
+ // otherwise return the first non-disabled tab's value
57
+ return tabList.find(tab => !tab.disabled())?.value();
58
+ }, ...(ngDevMode ? [{ debugName: "selectedTab" }] : []));
59
+ function select(newValue) {
60
+ // if the value is already selected, do nothing
61
+ if (value() === newValue) {
62
+ return;
63
+ }
64
+ value.set(newValue);
65
+ onValueChange?.(newValue);
66
+ }
67
+ function setOrientation(newOrientation) {
68
+ orientation.set(newOrientation);
69
+ }
70
+ function registerTab(tab) {
71
+ tabs.update(currentTabs => [...currentTabs, tab]);
72
+ }
73
+ function unregisterTab(tabValue) {
74
+ tabs.update(currentTabs => currentTabs.filter(tab => tab.value() !== tabValue));
75
+ }
76
+ return {
77
+ id,
78
+ orientation,
79
+ activateOnFocus,
80
+ value: deprecatedSetter(value, 'select'),
81
+ selectedTab,
82
+ select,
83
+ setOrientation,
84
+ registerTab,
85
+ unregisterTab,
86
+ };
87
+ });
88
+
89
+ const [NgpTabButtonStateToken, ngpTabButton, injectTabButtonState, provideTabButtonState] = createPrimitive('NgpTabButton', ({ value, disabled = signal(false), id }) => {
90
+ const element = injectElementRef();
91
+ const tagName = inject(HOST_TAG_NAME);
92
+ const tabset = injectTabsetState();
93
+ // Computed properties
94
+ const buttonId = computed(() => id?.() ?? `${tabset().id()}-button-${value()}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : []));
95
+ const ariaControls = computed(() => `${tabset().id()}-panel-${value()}`, ...(ngDevMode ? [{ debugName: "ariaControls" }] : []));
96
+ const active = computed(() => tabset().selectedTab() === value(), ...(ngDevMode ? [{ debugName: "active" }] : []));
97
+ // Host bindings
98
+ attrBinding(element, 'role', 'tab');
99
+ attrBinding(element, 'id', buttonId);
100
+ attrBinding(element, 'aria-controls', ariaControls);
101
+ attrBinding(element, 'aria-selected', active);
102
+ dataBinding(element, 'data-active', active);
103
+ dataBinding(element, 'data-disabled', disabled);
104
+ attrBinding(element, 'disabled', () => (tagName === 'button' && disabled() ? '' : null));
105
+ dataBinding(element, 'data-orientation', () => tabset().orientation());
106
+ // Event listeners
107
+ listener(element, 'click', select);
108
+ listener(element, 'focus', activateOnFocus);
109
+ // Setup interactions
110
+ ngpInteractions({
111
+ hover: true,
112
+ press: true,
113
+ focusVisible: true,
114
+ disabled,
115
+ });
116
+ function select() {
117
+ if (disabled?.() === false) {
118
+ tabset().select(value());
119
+ }
120
+ }
121
+ function activateOnFocus() {
122
+ if (tabset().activateOnFocus()) {
123
+ select();
124
+ }
125
+ }
126
+ onMount(() => {
127
+ // we can't use a required input for value as it is used in a computed property before the input is set
128
+ if (value() === undefined) {
129
+ throw new Error('ngpTabButton: value is required');
130
+ }
131
+ // Register with tabset now that inputs are available
132
+ tabset().registerTab({ value, disabled });
133
+ });
134
+ // Unregister on destroy
135
+ onDestroy(() => {
136
+ tabset().unregisterTab(value());
137
+ });
138
+ return {
139
+ id: buttonId,
140
+ active,
141
+ select,
142
+ };
143
+ });
53
144
 
54
145
  /**
55
146
  * 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.
56
147
  */
57
148
  class NgpTabButton {
58
149
  constructor() {
59
- /**
60
- * Access the tag host name
61
- */
62
- this.tagName = inject(HOST_TAG_NAME);
63
- /**
64
- * Access the tabset state
65
- */
66
- this.state = injectTabsetState();
67
150
  /**
68
151
  * The value of the tab this trigger controls
69
152
  * @required
@@ -83,128 +166,97 @@ class NgpTabButton {
83
166
  * @internal
84
167
  */
85
168
  this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
86
- /**
87
- * Determine a unique id for the tab button if not provided
88
- * @internal
89
- */
90
- this.buttonId = computed(() => this.id() ?? `${this.state().id()}-button-${this.value()}`, ...(ngDevMode ? [{ debugName: "buttonId" }] : []));
91
- /**
92
- * Determine the aria-controls of the tab button
93
- * @internal
94
- */
95
- this.ariaControls = computed(() => `${this.state().id()}-panel-${this.value()}`, ...(ngDevMode ? [{ debugName: "ariaControls" }] : []));
169
+ this.state = ngpTabButton({
170
+ value: this.value,
171
+ disabled: this.disabled,
172
+ id: this.id,
173
+ });
96
174
  /**
97
175
  * Whether the tab is active
98
176
  */
99
- this.active = computed(() => this.state().selectedTab() === this.value(), ...(ngDevMode ? [{ debugName: "active" }] : []));
100
- this.state().registerTab(this);
101
- ngpInteractions({
102
- hover: true,
103
- press: true,
104
- focusVisible: true,
105
- disabled: this.disabled,
106
- });
107
- }
108
- ngOnInit() {
109
- if (this.value() === undefined) {
110
- throw new Error('ngpTabButton: value is required');
111
- }
112
- }
113
- ngOnDestroy() {
114
- this.state().unregisterTab(this);
177
+ this.active = this.state.active;
178
+ ngpRovingFocusItem({ disabled: this.disabled });
115
179
  }
116
180
  /**
117
181
  * Select the tab this trigger controls
118
182
  */
119
183
  select() {
120
- if (this.disabled() === false) {
121
- this.state().select(this.value());
122
- }
123
- }
124
- /**
125
- * On focus select the tab this trigger controls if activateOnFocus is true
126
- */
127
- activateOnFocus() {
128
- if (this.state().activateOnFocus()) {
129
- this.select();
130
- }
184
+ this.state.select();
131
185
  }
132
186
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
133
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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.disabled": "tagName === \"button\" && disabled() ? \"\" : null", "attr.data-orientation": "state().orientation()" } }, exportAs: ["ngpTabButton"], hostDirectives: [{ directive: i1.NgpRovingFocusItem, inputs: ["ngpRovingFocusItemDisabled", "ngpTabButtonDisabled"] }], ngImport: i0 }); }
187
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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 } }, providers: [provideTabButtonState(), provideRovingFocusItemState()], exportAs: ["ngpTabButton"], ngImport: i0 }); }
134
188
  }
135
189
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabButton, decorators: [{
136
190
  type: Directive,
137
191
  args: [{
138
192
  selector: '[ngpTabButton]',
139
193
  exportAs: 'ngpTabButton',
140
- host: {
141
- role: 'tab',
142
- '[attr.id]': 'buttonId()',
143
- '[attr.aria-controls]': 'ariaControls()',
144
- '[attr.data-active]': 'active() ? "" : null',
145
- '[attr.data-disabled]': 'disabled() ? "" : null',
146
- '[attr.disabled]': 'tagName === "button" && disabled() ? "" : null',
147
- '[attr.data-orientation]': 'state().orientation()',
148
- },
149
- hostDirectives: [
150
- {
151
- directive: NgpRovingFocusItem,
152
- inputs: ['ngpRovingFocusItemDisabled: ngpTabButtonDisabled'],
153
- },
154
- ],
194
+ providers: [provideTabButtonState(), provideRovingFocusItemState()],
155
195
  }]
156
- }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabButtonValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabButtonDisabled", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], select: [{
157
- type: HostListener,
158
- args: ['click']
159
- }], activateOnFocus: [{
160
- type: HostListener,
161
- args: ['focus']
162
- }] } });
196
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabButtonValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabButtonDisabled", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
197
+
198
+ const [NgpTabListStateToken, ngpTabList, injectTabListState, provideTabListState] = createPrimitive('NgpTabList', ({}) => {
199
+ const element = injectElementRef();
200
+ const tabsetState = injectTabsetState();
201
+ // Host bindings
202
+ attrBinding(element, 'role', 'tablist');
203
+ attrBinding(element, 'aria-orientation', () => tabsetState().orientation());
204
+ dataBinding(element, 'data-orientation', () => tabsetState().orientation());
205
+ return {};
206
+ });
163
207
 
164
208
  /**
165
209
  * Apply the `ngpTabList` directive to an element that represents the list of tab buttons.
166
210
  */
167
211
  class NgpTabList {
168
212
  constructor() {
169
- /**
170
- * Access the tabset state
171
- */
172
- this.state = injectTabsetState();
213
+ ngpTabList({});
173
214
  }
174
215
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabList, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
175
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", 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 }); }
216
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: NgpTabList, isStandalone: true, selector: "[ngpTabList]", providers: [provideTabListState()], exportAs: ["ngpTabList"], ngImport: i0 }); }
176
217
  }
177
218
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabList, decorators: [{
178
219
  type: Directive,
179
220
  args: [{
180
221
  selector: '[ngpTabList]',
181
222
  exportAs: 'ngpTabList',
182
- host: {
183
- role: 'tablist',
184
- '[attr.aria-orientation]': 'state().orientation()',
185
- '[attr.data-orientation]': 'state().orientation()',
186
- },
223
+ providers: [provideTabListState()],
187
224
  }]
188
- }] });
225
+ }], ctorParameters: () => [] });
189
226
 
190
- const NgpTabPanelToken = new InjectionToken('NgpTabPanelToken');
191
- /**
192
- * Inject the TabPanel directive instance
193
- * @returns The TabPanel directive instance
194
- */
195
- function injectTabPanel() {
196
- return inject(NgpTabPanelToken);
197
- }
227
+ const [NgpTabPanelStateToken, ngpTabPanel, injectTabPanelState, provideTabPanelState] = createPrimitive('NgpTabPanel', ({ value, id }) => {
228
+ const element = injectElementRef();
229
+ const tabset = injectTabsetState();
230
+ // Computed properties
231
+ const panelId = computed(() => id?.() ?? `${tabset().id()}-panel-${value?.()}`, ...(ngDevMode ? [{ debugName: "panelId" }] : []));
232
+ const labelledBy = computed(() => `${tabset().id()}-button-${value?.()}`, ...(ngDevMode ? [{ debugName: "labelledBy" }] : []));
233
+ const active = computed(() => tabset().selectedTab() === value?.(), ...(ngDevMode ? [{ debugName: "active" }] : []));
234
+ // Host bindings
235
+ attrBinding(element, 'role', 'tabpanel');
236
+ attrBinding(element, 'tabindex', () => (active() ? '0' : null));
237
+ attrBinding(element, 'aria-hidden', () => (active() ? null : 'true'));
238
+ attrBinding(element, 'id', panelId);
239
+ attrBinding(element, 'aria-labelledby', labelledBy);
240
+ dataBinding(element, 'data-active', active);
241
+ dataBinding(element, 'data-orientation', () => tabset().orientation());
242
+ // Ensure value is provided
243
+ onMount(() => {
244
+ if (value() === undefined) {
245
+ throw new Error('ngpTabPanel: value is required');
246
+ }
247
+ });
248
+ return {
249
+ panelId,
250
+ labelledBy,
251
+ active,
252
+ };
253
+ });
198
254
 
199
255
  /**
200
256
  * Apply the `ngpTabPanel` directive to an element that represents the content of a tab.
201
257
  */
202
258
  class NgpTabPanel {
203
259
  constructor() {
204
- /**
205
- * Access the tabset
206
- */
207
- this.state = injectTabsetState();
208
260
  /**
209
261
  * The value of the tab
210
262
  * @required
@@ -215,43 +267,24 @@ class NgpTabPanel {
215
267
  * @internal
216
268
  */
217
269
  this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
218
- /**
219
- * Determine a unique id for the tab panel if not provided
220
- * @internal
221
- */
222
- this.panelId = computed(() => this.id() ?? `${this.state().id()}-panel-${this.value()}`, ...(ngDevMode ? [{ debugName: "panelId" }] : []));
223
- /**
224
- * Determine the aria-labelledby of the tab panel
225
- * @internal
226
- */
227
- this.labelledBy = computed(() => `${this.state().id()}-button-${this.value()}`, ...(ngDevMode ? [{ debugName: "labelledBy" }] : []));
270
+ this.state = ngpTabPanel({
271
+ value: this.value,
272
+ id: this.id,
273
+ });
228
274
  /**
229
275
  * Whether the tab is active
230
276
  */
231
- this.active = computed(() => this.state().selectedTab() === this.value(), ...(ngDevMode ? [{ debugName: "active" }] : []));
232
- }
233
- ngOnInit() {
234
- if (this.value() === undefined) {
235
- throw new Error('ngpTabPanel: value is required');
236
- }
277
+ this.active = this.state.active;
237
278
  }
238
279
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
239
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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 }); }
280
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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 } }, providers: [provideTabPanelState()], exportAs: ["ngpTabPanel"], ngImport: i0 }); }
240
281
  }
241
282
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabPanel, decorators: [{
242
283
  type: Directive,
243
284
  args: [{
244
285
  selector: '[ngpTabPanel]',
245
286
  exportAs: 'ngpTabPanel',
246
- providers: [{ provide: NgpTabPanelToken, useExisting: NgpTabPanel }],
247
- host: {
248
- role: 'tabpanel',
249
- tabIndex: '0',
250
- '[id]': 'panelId()',
251
- '[attr.aria-labelledby]': 'labelledBy()',
252
- '[attr.data-active]': 'active() ? "" : null',
253
- '[attr.data-orientation]': 'state().orientation()',
254
- },
287
+ providers: [provideTabPanelState()],
255
288
  }]
256
289
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabPanelValue", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
257
290
 
@@ -264,10 +297,6 @@ class NgpTabset {
264
297
  * Access the global tabset configuration
265
298
  */
266
299
  this.config = injectTabsConfig();
267
- /**
268
- * Access the roving focus group state
269
- */
270
- this.rovingFocusGroupState = injectRovingFocusGroupState();
271
300
  /**
272
301
  * Define the id for the tabset
273
302
  */
@@ -299,32 +328,23 @@ class NgpTabset {
299
328
  alias: 'ngpTabsetActivateOnFocus',
300
329
  transform: booleanAttribute,
301
330
  }]));
302
- /**
303
- * Access the tabs within the tabset
304
- * @internal
305
- */
306
- this.buttons = signal([], ...(ngDevMode ? [{ debugName: "buttons" }] : []));
331
+ this.state = ngpTabset({
332
+ id: this.id,
333
+ value: this.value,
334
+ orientation: this.orientation,
335
+ activateOnFocus: this.activateOnFocus,
336
+ onValueChange: value => this.valueChange.emit(value),
337
+ });
307
338
  /**
308
339
  * @internal
309
340
  * Get the id of the selected tab
310
341
  */
311
- this.selectedTab = computed(() => {
312
- const buttons = this.buttons();
313
- // if there are no tabs then return the selected value
314
- // if there is a value set and a tab with that value exists, return the value
315
- if (buttons.length === 0 || buttons.some(button => button.value() === this.state.value())) {
316
- return this.state.value();
317
- }
318
- // otherwise return the first non-disabled tab's value
319
- return buttons.find(button => !button.disabled())?.value();
320
- }, ...(ngDevMode ? [{ debugName: "selectedTab" }] : []));
321
- /**
322
- * The state of the tabset
323
- */
324
- this.state = tabsetState(this);
325
- explicitEffect([this.state.orientation], ([orientation]) => {
326
- const rovingFocusGroupState = this.rovingFocusGroupState();
327
- rovingFocusGroupState?.setOrientation(orientation);
342
+ this.selectedTab = this.state.selectedTab;
343
+ ngpRovingFocusGroup({
344
+ orientation: this.orientation,
345
+ disabled: signal(false),
346
+ wrap: signal(false),
347
+ homeEnd: signal(true),
328
348
  });
329
349
  }
330
350
  /**
@@ -332,41 +352,23 @@ class NgpTabset {
332
352
  * @param value The value of the tab to select
333
353
  */
334
354
  select(value) {
335
- // if the value is already selected, do nothing
336
- if (this.state.value() === value) {
337
- return;
338
- }
339
- this.state.value.set(value);
340
- this.valueChange.emit(value);
341
- }
342
- /**
343
- * @internal
344
- * Register a tab with the tabset
345
- */
346
- registerTab(tab) {
347
- this.buttons.update(buttons => [...buttons, tab]);
348
- }
349
- /**
350
- * @internal
351
- * Unregister a tab with the tabset
352
- */
353
- unregisterTab(tab) {
354
- this.buttons.update(buttons => buttons.filter(button => button !== tab));
355
+ this.state.select(value);
355
356
  }
356
357
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabset, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
357
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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({ inherit: false })], exportAs: ["ngpTabset"], hostDirectives: [{ directive: i1.NgpRovingFocusGroup }], ngImport: i0 }); }
358
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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" }, providers: [
359
+ provideTabsetState({ inherit: false }),
360
+ provideRovingFocusGroupState({ inherit: false }),
361
+ ], exportAs: ["ngpTabset"], ngImport: i0 }); }
358
362
  }
359
363
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpTabset, decorators: [{
360
364
  type: Directive,
361
365
  args: [{
362
366
  selector: '[ngpTabset]',
363
367
  exportAs: 'ngpTabset',
364
- providers: [provideTabsetState({ inherit: false })],
365
- hostDirectives: [NgpRovingFocusGroup],
366
- host: {
367
- '[attr.id]': 'state.id()',
368
- '[attr.data-orientation]': 'state.orientation()',
369
- },
368
+ providers: [
369
+ provideTabsetState({ inherit: false }),
370
+ provideRovingFocusGroupState({ inherit: false }),
371
+ ],
370
372
  }]
371
373
  }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabsetValue", required: false }] }], valueChange: [{ type: i0.Output, args: ["ngpTabsetValueChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabsetOrientation", required: false }] }], activateOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpTabsetActivateOnFocus", required: false }] }] } });
372
374
 
@@ -374,5 +376,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
374
376
  * Generated bundle index. Do not edit.
375
377
  */
376
378
 
377
- export { NgpTabButton, NgpTabList, NgpTabPanel, NgpTabPanelToken, NgpTabset, injectTabPanel, injectTabsetState, provideTabsConfig, provideTabsetState };
379
+ export { NgpTabButton, NgpTabButtonStateToken, NgpTabList, NgpTabListStateToken, NgpTabPanel, NgpTabPanelStateToken, NgpTabset, NgpTabsetStateToken, injectTabButtonState, injectTabListState, injectTabPanelState, injectTabsetState, ngpTabButton, ngpTabList, ngpTabPanel, ngpTabset, provideTabButtonState, provideTabListState, provideTabPanelState, provideTabsConfig, provideTabsetState };
378
380
  //# sourceMappingURL=ng-primitives-tabs.mjs.map