ng-primitives 0.47.0 → 0.49.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.
- package/a11y/active-descendant/active-descendant.d.ts +5 -1
- package/a11y/visually-hidden/visually-hidden-state.d.ts +1 -36
- package/accordion/accordion/accordion-state.d.ts +1 -12
- package/accordion/accordion-content/accordion-content.d.ts +1 -12
- package/accordion/accordion-item/accordion-item-state.d.ts +1 -12
- package/avatar/avatar/avatar-state.d.ts +1 -5
- package/avatar/avatar-image/avatar-image.d.ts +1 -36
- package/button/button/button-state.d.ts +1 -6
- package/checkbox/checkbox/checkbox-state.d.ts +1 -12
- package/combobox/combobox/combobox-state.d.ts +1 -44
- package/combobox/combobox/combobox.d.ts +1 -1
- package/combobox/combobox-button/combobox-button.d.ts +2 -45
- package/combobox/combobox-dropdown/combobox-dropdown.d.ts +1 -44
- package/combobox/combobox-input/combobox-input.d.ts +2 -50
- package/combobox/combobox-option/combobox-option.d.ts +1 -44
- package/dialog/dialog/dialog-state.d.ts +1 -17
- package/fesm2022/ng-primitives-a11y.mjs +32 -10
- package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
- package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-button.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-combobox.mjs +23 -18
- package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +2 -2
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input.mjs +11 -2
- package/fesm2022/ng-primitives-input.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +9 -1
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +3 -1
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-meter.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-portal.mjs +128 -2
- package/fesm2022/ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-radio.mjs +8 -2
- package/fesm2022/ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs.map +1 -1
- package/fesm2022/ng-primitives-select.mjs +8 -2
- package/fesm2022/ng-primitives-select.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +8 -2
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +9 -4
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +11 -2
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/file-upload/file-dropzone/file-dropzone-state.d.ts +1 -16
- package/file-upload/file-upload/file-upload-state.d.ts +1 -21
- package/focus-trap/focus-trap/focus-trap-state.d.ts +1 -28
- package/form-field/description/description.d.ts +1 -25
- package/form-field/error/error.d.ts +1 -25
- package/form-field/form-control/form-control-state.d.ts +1 -5
- package/form-field/form-control/form-control.d.ts +2 -2
- package/form-field/form-field/form-field-state.d.ts +1 -25
- package/form-field/label/label.d.ts +1 -25
- package/input/input/input-state.d.ts +1 -14
- package/input/input/input.d.ts +5 -1
- package/internal/style-injector/style-injector.d.ts +4 -0
- package/listbox/listbox/listbox-state.d.ts +1 -25
- package/menu/menu-trigger/menu-trigger-state.d.ts +1 -22
- package/menu/submenu-trigger/submenu-trigger-state.d.ts +1 -20
- package/meter/meter/meter-state.d.ts +1 -9
- package/meter/meter-indicator/meter-indicator.d.ts +1 -9
- package/meter/meter-label/meter-label.d.ts +1 -9
- package/package.json +5 -5
- package/pagination/pagination/pagination-state.d.ts +1 -10
- package/pagination/pagination-button/pagination-button.d.ts +1 -10
- package/pagination/pagination-first/pagination-first.d.ts +1 -10
- package/pagination/pagination-next/pagination-next.d.ts +1 -10
- package/pagination/pagination-previous/pagination-previous.d.ts +1 -10
- package/portal/index.d.ts +1 -0
- package/portal/scroll-strategy.d.ts +23 -0
- package/progress/progress/progress-state.d.ts +1 -12
- package/progress/progress-indicator/progress-indicator.d.ts +1 -12
- package/progress/progress-label/progress-label.d.ts +1 -12
- package/progress/progress-track/progress-track.d.ts +1 -12
- package/progress/progress-value/progress-value.d.ts +1 -12
- package/radio/radio-group/radio-group.d.ts +5 -1
- package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +1 -19
- package/schematics/ng-generate/schema.d.ts +1 -0
- package/schematics/ng-generate/schema.json +1 -0
- package/schematics/ng-generate/templates/combobox/combobox.__fileSuffix@dasherize__.ts.template +11 -16
- package/schematics/ng-generate/templates/menu/menu-item.__fileSuffix@dasherize__.ts.template +40 -0
- package/schematics/ng-generate/templates/menu/menu.__fileSuffix@dasherize__.ts.template +53 -0
- package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +3 -3
- package/search/search/search-state.d.ts +1 -9
- package/search/search-clear/search-clear.d.ts +1 -9
- package/select/select/select-state.d.ts +1 -4
- package/select/select/select.d.ts +5 -1
- package/slider/slider/slider-state.d.ts +1 -12
- package/slider/slider/slider.d.ts +5 -1
- package/slider/slider-range/slider-range.d.ts +1 -12
- package/slider/slider-thumb/slider-thumb.d.ts +1 -12
- package/slider/slider-track/slider-track.d.ts +1 -12
- package/switch/switch/switch-state.d.ts +1 -10
- package/switch/switch/switch.d.ts +5 -2
- package/switch/switch-thumb/switch-thumb.d.ts +1 -10
- package/tabs/tab-button/tab-button.d.ts +1 -36
- package/tabs/tab-list/tab-list.d.ts +1 -33
- package/tabs/tab-panel/tab-panel.d.ts +1 -33
- package/tabs/tabset/tabset-state.d.ts +1 -33
- package/textarea/textarea/textarea-state.d.ts +1 -4
- package/textarea/textarea/textarea.d.ts +5 -1
- package/toggle/toggle/toggle-state.d.ts +1 -10
- package/toggle-group/toggle-group/toggle-group-state.d.ts +1 -32
- package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +1 -22
- package/toolbar/toolbar/toolbar-state.d.ts +1 -23
- package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpRovingFocusGroup } from './roving-focus-group';\n\n/**\n * The state token for the RovingFocusGroup primitive.\n */\nexport const NgpRovingFocusGroupStateToken =\n createStateToken<NgpRovingFocusGroup>('RovingFocusGroup');\n\n/**\n * Provides the RovingFocusGroup state.\n */\nexport const provideRovingFocusGroupState = createStateProvider(NgpRovingFocusGroupStateToken);\n\n/**\n * Injects the RovingFocusGroup state.\n */\nexport const injectRovingFocusGroupState = createStateInjector(NgpRovingFocusGroupStateToken);\n\n/**\n * The RovingFocusGroup state registration function.\n */\nexport const rovingFocusGroupState = createState(NgpRovingFocusGroupStateToken);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n /**\n * Whether we should inherit the focus group from the parent\n * @default true\n */\n inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n type: Type<NgpRovingFocusGroup>,\n { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n return {\n provide: NgpRovingFocusGroupToken,\n // Roving focus groups may be nested, in this case, the parent group should be used\n useFactory: () => {\n if (!inherit) {\n return inject(type, { self: true });\n }\n\n // If the parent group is not found, return the current group\n // This is useful for nested groups\n return (\n inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n inject(type, { self: true })\n );\n },\n };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, inject, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { provideRovingFocusGroupState, rovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [provideRovingFocusGroup(NgpRovingFocusGroup), provideRovingFocusGroupState()],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Access the directionality service.\n */\n private readonly directionality = inject(Directionality);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = input<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the items in the roving focus group.\n */\n private readonly items = signal<NgpRovingFocusItem[]>([]);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n private get sortedItems() {\n return this.items().sort((a, b) => {\n // sort the items by their position in the document\n return a.elementRef.nativeElement.compareDocumentPosition(b.elementRef.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * The state of the roving focus group.\n */\n readonly state = rovingFocusGroupState<NgpRovingFocusGroup>(this);\n\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n * @internal\n */\n register(item: NgpRovingFocusItem): void {\n this.items.update(items => [...items, item]);\n\n // if there is no active item, make the first item the tabbable item\n if (!this.activeItem()) {\n this.activeItem.set(item);\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItem): void {\n this.items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (this.activeItem() === item) {\n // if the active item is unregistered, activate the first item\n this.activeItem.set(this.items()[0] ?? null);\n }\n }\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n this.activeItem.set(item);\n item?.focus(origin);\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = this.sortedItems.find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...this.sortedItems].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateNextItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the first item\n if (!activeItem) {\n this.activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the next item that is not disabled\n const item = this.sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && this.state.wrap()) {\n this.activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activatePreviousItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the last item\n if (!activeItem) {\n this.activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the previous item that is not disabled\n const item =\n this.sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && this.state.wrap()) {\n this.activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (this.state.orientation() === 'vertical') {\n event.preventDefault();\n this.activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (this.state.orientation() === 'vertical') {\n event.preventDefault();\n this.activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (this.state.orientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activatePreviousItem('keyboard');\n } else {\n this.activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (this.state.orientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activateNextItem('keyboard');\n } else {\n this.activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (this.state.homeEnd()) {\n event.preventDefault();\n this.activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (this.state.homeEnd()) {\n event.preventDefault();\n this.activateLastItem('keyboard');\n }\n break;\n }\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n OnInit,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { injectRovingFocusGroup } from '../roving-focus-group/roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n host: {\n '[attr.tabindex]': 'tabindex()',\n },\n})\nexport class NgpRovingFocusItem implements OnInit, OnDestroy {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the focus monitor service.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the element the roving focus item is attached to.\n */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n readonly tabindex = computed(() =>\n !this.group.disabled() && this.group.activeItem() === this ? 0 : -1,\n );\n\n /**\n * Initialize the roving focus item.\n */\n ngOnInit(): void {\n this.group.register(this);\n }\n\n /**\n * Clean up the roving focus item.\n */\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Forward the keydown event to the roving focus group.\n * @param event The keyboard event\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.onKeydown(event);\n }\n\n /**\n * Activate the roving focus item on click.\n */\n @HostListener('click')\n protected activate(): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.setActiveItem(this, 'mouse');\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus\n */\n focus(origin: FocusOrigin): void {\n this.focusMonitor.focusVia(this.elementRef, origin);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,6BAA6B,GACxC,gBAAgB,CAAsB,kBAAkB,CAAC;AAE3D;;AAEG;MACU,4BAA4B,GAAG,mBAAmB,CAAC,6BAA6B;AAE7F;;AAEG;MACU,2BAA2B,GAAG,mBAAmB,CAAC,6BAA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A3E1C,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,4BAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,OAAA,EAAA,YAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,YAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,IAAI,EAAE;AACJ,wBAAA,iBAAiB,EAAE,YAAY;AAChC,qBAAA;AACF,iBAAA;8BAmDW,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC;gBAazB,QAAQ,EAAA,CAAA;sBADjB,YAAY;uBAAC,OAAO;;;ACtFvB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpRovingFocusGroup } from './roving-focus-group';\n\n/**\n * The state token for the RovingFocusGroup primitive.\n */\nexport const NgpRovingFocusGroupStateToken =\n createStateToken<NgpRovingFocusGroup>('RovingFocusGroup');\n\n/**\n * Provides the RovingFocusGroup state.\n */\nexport const provideRovingFocusGroupState = createStateProvider(NgpRovingFocusGroupStateToken);\n\n/**\n * Injects the RovingFocusGroup state.\n */\nexport const injectRovingFocusGroupState = createStateInjector<NgpRovingFocusGroup>(\n NgpRovingFocusGroupStateToken,\n);\n\n/**\n * The RovingFocusGroup state registration function.\n */\nexport const rovingFocusGroupState = createState(NgpRovingFocusGroupStateToken);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n /**\n * Whether we should inherit the focus group from the parent\n * @default true\n */\n inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n type: Type<NgpRovingFocusGroup>,\n { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n return {\n provide: NgpRovingFocusGroupToken,\n // Roving focus groups may be nested, in this case, the parent group should be used\n useFactory: () => {\n if (!inherit) {\n return inject(type, { self: true });\n }\n\n // If the parent group is not found, return the current group\n // This is useful for nested groups\n return (\n inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n inject(type, { self: true })\n );\n },\n };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, inject, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { provideRovingFocusGroupState, rovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [provideRovingFocusGroup(NgpRovingFocusGroup), provideRovingFocusGroupState()],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Access the directionality service.\n */\n private readonly directionality = inject(Directionality);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = input<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the items in the roving focus group.\n */\n private readonly items = signal<NgpRovingFocusItem[]>([]);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n private get sortedItems() {\n return this.items().sort((a, b) => {\n // sort the items by their position in the document\n return a.elementRef.nativeElement.compareDocumentPosition(b.elementRef.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * The state of the roving focus group.\n */\n readonly state = rovingFocusGroupState<NgpRovingFocusGroup>(this);\n\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n * @internal\n */\n register(item: NgpRovingFocusItem): void {\n this.items.update(items => [...items, item]);\n\n // if there is no active item, make the first item the tabbable item\n if (!this.activeItem()) {\n this.activeItem.set(item);\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItem): void {\n this.items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (this.activeItem() === item) {\n // if the active item is unregistered, activate the first item\n this.activeItem.set(this.items()[0] ?? null);\n }\n }\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n this.activeItem.set(item);\n item?.focus(origin);\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = this.sortedItems.find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...this.sortedItems].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateNextItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the first item\n if (!activeItem) {\n this.activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the next item that is not disabled\n const item = this.sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && this.state.wrap()) {\n this.activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activatePreviousItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the last item\n if (!activeItem) {\n this.activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the previous item that is not disabled\n const item =\n this.sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && this.state.wrap()) {\n this.activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n if (this.state.disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (this.state.orientation() === 'vertical') {\n event.preventDefault();\n this.activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (this.state.orientation() === 'vertical') {\n event.preventDefault();\n this.activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (this.state.orientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activatePreviousItem('keyboard');\n } else {\n this.activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (this.state.orientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activateNextItem('keyboard');\n } else {\n this.activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (this.state.homeEnd()) {\n event.preventDefault();\n this.activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (this.state.homeEnd()) {\n event.preventDefault();\n this.activateLastItem('keyboard');\n }\n break;\n }\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n OnInit,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { injectRovingFocusGroup } from '../roving-focus-group/roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n host: {\n '[attr.tabindex]': 'tabindex()',\n },\n})\nexport class NgpRovingFocusItem implements OnInit, OnDestroy {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the focus monitor service.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the element the roving focus item is attached to.\n */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n readonly tabindex = computed(() =>\n !this.group.disabled() && this.group.activeItem() === this ? 0 : -1,\n );\n\n /**\n * Initialize the roving focus item.\n */\n ngOnInit(): void {\n this.group.register(this);\n }\n\n /**\n * Clean up the roving focus item.\n */\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Forward the keydown event to the roving focus group.\n * @param event The keyboard event\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.onKeydown(event);\n }\n\n /**\n * Activate the roving focus item on click.\n */\n @HostListener('click')\n protected activate(): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.setActiveItem(this, 'mouse');\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus\n */\n focus(origin: FocusOrigin): void {\n this.focusMonitor.focusVia(this.elementRef, origin);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,6BAA6B,GACxC,gBAAgB,CAAsB,kBAAkB,CAAC;AAE3D;;AAEG;MACU,4BAA4B,GAAG,mBAAmB,CAAC,6BAA6B;AAE7F;;AAEG;MACU,2BAA2B,GAAG,mBAAmB,CAC5D,6BAA6B;AAG/B;;AAEG;AACI,MAAM,qBAAqB,GAAG,WAAW,CAAC,6BAA6B,CAAC;;MC1BlE,wBAAwB,GAAG,IAAI,cAAc,CACxD,0BAA0B;AAG5B;;;AAGG;SACa,sBAAsB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC;AACzC;AAUA;;;;AAIG;AACG,SAAU,uBAAuB,CACrC,IAA+B,EAC/B,EAAE,OAAO,GAAG,IAAI,EAAA,GAAiC,EAAE,EAAA;IAEnD,OAAO;AACL,QAAA,OAAO,EAAE,wBAAwB;;QAEjC,UAAU,EAAE,MAAK;YACf,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;AAKrC,YAAA,QACE,MAAM,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gBACpE,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;SAE/B;KACF;AACH;;ACvCA;;AAEG;MAMU,mBAAmB,CAAA;AALhC,IAAA,WAAA,GAAA;AAME;;AAEG;AACc,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAExD;;;AAGG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG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AAS,EAAE,CAAC,QAAQ,CAAC;gBAazB,QAAQ,EAAA,CAAA;sBADjB,YAAY;uBAAC,OAAO;;;ACtFvB;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search/search-state.ts","../../../../packages/ng-primitives/search/src/search-clear/search-clear.ts","../../../../packages/ng-primitives/search/src/search/search.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSearch } from './search';\n\n/**\n * The state token for the Search primitive.\n */\nexport const NgpSearchStateToken = createStateToken<NgpSearch>('Search');\n\n/**\n * Provides the Search state.\n */\nexport const provideSearchState = createStateProvider(NgpSearchStateToken);\n\n/**\n * Injects the Search state.\n */\nexport const injectSearchState = createStateInjector(NgpSearchStateToken);\n\n/**\n * The Search state registration function.\n */\nexport const searchState = createState(NgpSearchStateToken);\n","import { Directive, HostListener } from '@angular/core';\nimport { injectSearchState } from '../search/search-state';\n\n/**\n * The `NgpSearchClear` directive is can be added to a button to clear the search field on click.\n */\n@Directive({\n selector: '[ngpSearchClear]',\n exportAs: 'ngpSearchClear',\n host: {\n '[tabindex]': '-1',\n '[attr.data-empty]': 'search().empty() ? \"\" : null',\n },\n})\nexport class NgpSearchClear {\n /**\n * Access the Search instance.\n */\n protected readonly search = injectSearchState();\n\n /**\n * Clear the input field.\n */\n @HostListener('click')\n protected clear(): void {\n this.search().clear();\n }\n}\n","import { computed, DestroyRef, Directive, HostListener, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\nimport { provideSearchState, searchState } from './search-state';\n\n/**\n * The `NgpSearch` directive is a container for the search field components.\n */\n@Directive({\n selector: '[ngpSearch]',\n exportAs: 'ngpSearch',\n providers: [provideSearchState()],\n host: {\n '[attr.data-empty]': 'empty() ? \"\" : null',\n },\n})\nexport class NgpSearch {\n /**\n * The destroy reference.\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The input field.\n */\n private readonly input = signal<HTMLInputElement | null>(null);\n\n /**\n * The value of the input.\n */\n private readonly value = signal<string>('');\n\n /**\n * Whether the input field is empty.\n * @internal\n */\n protected readonly empty = computed(() => this.value() === '');\n\n /**\n * The search field state.\n */\n protected readonly state = searchState<NgpSearch>(this);\n\n @HostListener('keydown.escape')\n clear(): void {\n const input = this.input();\n\n if (!input) {\n return;\n }\n\n input.value = '';\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n /**\n * Register the input field.\n * @param input The input field.\n * @internal\n */\n registerInput(input: HTMLInputElement): void {\n this.input.set(input);\n this.value.set(input.value);\n\n fromEvent(input, 'input')\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.value.set(input.value));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search/search-state.ts","../../../../packages/ng-primitives/search/src/search-clear/search-clear.ts","../../../../packages/ng-primitives/search/src/search/search.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSearch } from './search';\n\n/**\n * The state token for the Search primitive.\n */\nexport const NgpSearchStateToken = createStateToken<NgpSearch>('Search');\n\n/**\n * Provides the Search state.\n */\nexport const provideSearchState = createStateProvider(NgpSearchStateToken);\n\n/**\n * Injects the Search state.\n */\nexport const injectSearchState = createStateInjector<NgpSearch>(NgpSearchStateToken);\n\n/**\n * The Search state registration function.\n */\nexport const searchState = createState(NgpSearchStateToken);\n","import { Directive, HostListener } from '@angular/core';\nimport { injectSearchState } from '../search/search-state';\n\n/**\n * The `NgpSearchClear` directive is can be added to a button to clear the search field on click.\n */\n@Directive({\n selector: '[ngpSearchClear]',\n exportAs: 'ngpSearchClear',\n host: {\n '[tabindex]': '-1',\n '[attr.data-empty]': 'search().empty() ? \"\" : null',\n },\n})\nexport class NgpSearchClear {\n /**\n * Access the Search instance.\n */\n protected readonly search = injectSearchState();\n\n /**\n * Clear the input field.\n */\n @HostListener('click')\n protected clear(): void {\n this.search().clear();\n }\n}\n","import { computed, DestroyRef, Directive, HostListener, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\nimport { provideSearchState, searchState } from './search-state';\n\n/**\n * The `NgpSearch` directive is a container for the search field components.\n */\n@Directive({\n selector: '[ngpSearch]',\n exportAs: 'ngpSearch',\n providers: [provideSearchState()],\n host: {\n '[attr.data-empty]': 'empty() ? \"\" : null',\n },\n})\nexport class NgpSearch {\n /**\n * The destroy reference.\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The input field.\n */\n private readonly input = signal<HTMLInputElement | null>(null);\n\n /**\n * The value of the input.\n */\n private readonly value = signal<string>('');\n\n /**\n * Whether the input field is empty.\n * @internal\n */\n protected readonly empty = computed(() => this.value() === '');\n\n /**\n * The search field state.\n */\n protected readonly state = searchState<NgpSearch>(this);\n\n @HostListener('keydown.escape')\n clear(): void {\n const input = this.input();\n\n if (!input) {\n return;\n }\n\n input.value = '';\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n /**\n * Register the input field.\n * @param input The input field.\n * @internal\n */\n registerInput(input: HTMLInputElement): void {\n this.input.set(input);\n this.value.set(input.value);\n\n fromEvent(input, 'input')\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this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A,CAAA;AAAT,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,SAAS,EALT,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,gBAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,uBAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAKtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBARrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;AACjC,oBAAA,IAAI,EAAE;AACJ,wBAAA,mBAAmB,EAAE,qBAAqB;AAC3C,qBAAA;AACF,iBAAA;8BA6BC,KAAK,EAAA,CAAA;sBADJ,YAAY;uBAAC,gBAAgB;;;AC3ChC;;AAEG;;;;"}
|
|
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, booleanAttribute, Directive } from '@angular/core';
|
|
3
3
|
import { setupFormControl } from 'ng-primitives/form-field';
|
|
4
4
|
import { setupInteractions } from 'ng-primitives/internal';
|
|
5
|
+
import { uniqueId } from 'ng-primitives/utils';
|
|
5
6
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -26,6 +27,10 @@ const selectState = createState(NgpSelectStateToken);
|
|
|
26
27
|
*/
|
|
27
28
|
class NgpSelect {
|
|
28
29
|
constructor() {
|
|
30
|
+
/**
|
|
31
|
+
* The id of the select. If not provided, a unique id will be generated.
|
|
32
|
+
*/
|
|
33
|
+
this.id = input(uniqueId('ngp-select'));
|
|
29
34
|
/**
|
|
30
35
|
* Whether the select is disabled.
|
|
31
36
|
*/
|
|
@@ -44,10 +49,10 @@ class NgpSelect {
|
|
|
44
49
|
focusVisible: true,
|
|
45
50
|
disabled: this.state.disabled,
|
|
46
51
|
});
|
|
47
|
-
setupFormControl({ disabled: this.state.disabled });
|
|
52
|
+
setupFormControl({ id: this.state.id, disabled: this.state.disabled });
|
|
48
53
|
}
|
|
49
54
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
50
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpSelect, isStandalone: true, selector: "select[ngpSelect]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpSelectDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.disabled": "disabled() || null" } }, providers: [provideSelectState()], exportAs: ["ngpSelect"], ngImport: i0 }); }
|
|
55
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpSelect, isStandalone: true, selector: "select[ngpSelect]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSelectDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.disabled": "disabled() || null" } }, providers: [provideSelectState()], exportAs: ["ngpSelect"], ngImport: i0 }); }
|
|
51
56
|
}
|
|
52
57
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpSelect, decorators: [{
|
|
53
58
|
type: Directive,
|
|
@@ -56,6 +61,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
56
61
|
exportAs: 'ngpSelect',
|
|
57
62
|
providers: [provideSelectState()],
|
|
58
63
|
host: {
|
|
64
|
+
'[id]': 'id()',
|
|
59
65
|
'[attr.disabled]': 'disabled() || null',
|
|
60
66
|
},
|
|
61
67
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-select.mjs","sources":["../../../../packages/ng-primitives/select/src/select/select-state.ts","../../../../packages/ng-primitives/select/src/select/select.ts","../../../../packages/ng-primitives/select/src/ng-primitives-select.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSelect } from './select';\n\n/**\n * The state token for the Select primitive.\n */\nexport const NgpSelectStateToken = createStateToken<NgpSelect>('Select');\n\n/**\n * Provides the Select state.\n */\nexport const provideSelectState = createStateProvider(NgpSelectStateToken);\n\n/**\n * Injects the Select state.\n */\nexport const injectSelectState = createStateInjector(NgpSelectStateToken);\n\n/**\n * The Select state registration function.\n */\nexport const selectState = createState(NgpSelectStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { provideSelectState, selectState } from './select-state';\n\n/**\n * Apply the `ngpSelect` directive to a select element that you want to enhance.\n */\n@Directive({\n selector: 'select[ngpSelect]',\n exportAs: 'ngpSelect',\n providers: [provideSelectState()],\n host: {\n '[attr.disabled]': 'disabled() || null',\n },\n})\nexport class NgpSelect {\n /**\n * Whether the select is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSelectDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The select state.\n */\n private readonly state = selectState<NgpSelect>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n setupFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ng-primitives-select.mjs","sources":["../../../../packages/ng-primitives/select/src/select/select-state.ts","../../../../packages/ng-primitives/select/src/select/select.ts","../../../../packages/ng-primitives/select/src/ng-primitives-select.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSelect } from './select';\n\n/**\n * The state token for the Select primitive.\n */\nexport const NgpSelectStateToken = createStateToken<NgpSelect>('Select');\n\n/**\n * Provides the Select state.\n */\nexport const provideSelectState = createStateProvider(NgpSelectStateToken);\n\n/**\n * Injects the Select state.\n */\nexport const injectSelectState = createStateInjector<NgpSelect>(NgpSelectStateToken);\n\n/**\n * The Select state registration function.\n */\nexport const selectState = createState(NgpSelectStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { provideSelectState, selectState } from './select-state';\n\n/**\n * Apply the `ngpSelect` directive to a select element that you want to enhance.\n */\n@Directive({\n selector: 'select[ngpSelect]',\n exportAs: 'ngpSelect',\n providers: [provideSelectState()],\n host: {\n '[id]': 'id()',\n '[attr.disabled]': 'disabled() || null',\n },\n})\nexport class NgpSelect {\n /**\n * The id of the select. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-select'));\n\n /**\n * Whether the select is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSelectDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The select state.\n */\n private readonly state = selectState<NgpSelect>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n setupFormControl({ id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,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,SAAS,EANT,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,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,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,eAAA,EAAA,oBAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAMtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBATrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;AACjC,oBAAA,IAAI,EAAE;AACJ,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,iBAAiB,EAAE,oBAAoB;AACxC,qBAAA;AACF,iBAAA;;;AClBD;;AAEG;;;;"}
|
|
@@ -3,6 +3,7 @@ import { Directive, HostListener, input, numberAttribute, output, booleanAttribu
|
|
|
3
3
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
4
4
|
import { setupInteractions, injectElementRef } from 'ng-primitives/internal';
|
|
5
5
|
import { setupFormControl } from 'ng-primitives/form-field';
|
|
6
|
+
import { uniqueId } from 'ng-primitives/utils';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The state token for the Slider primitive.
|
|
@@ -219,6 +220,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
219
220
|
*/
|
|
220
221
|
class NgpSlider {
|
|
221
222
|
constructor() {
|
|
223
|
+
/**
|
|
224
|
+
* The id of the slider. If not provided, a unique id will be generated.
|
|
225
|
+
*/
|
|
226
|
+
this.id = input(uniqueId('ngp-slider'));
|
|
222
227
|
/**
|
|
223
228
|
* The value of the slider.
|
|
224
229
|
*/
|
|
@@ -280,10 +285,10 @@ class NgpSlider {
|
|
|
280
285
|
* @internal
|
|
281
286
|
*/
|
|
282
287
|
this.state = sliderState(this);
|
|
283
|
-
setupFormControl({ disabled: this.state.disabled });
|
|
288
|
+
setupFormControl({ id: this.state.id, disabled: this.state.disabled });
|
|
284
289
|
}
|
|
285
290
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpSlider, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
286
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpSlider, isStandalone: true, selector: "[ngpSlider]", inputs: { value: { classPropertyName: "value", publicName: "ngpSliderValue", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "ngpSliderMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpSliderMax", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "ngpSliderStep", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpSliderOrientation", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSliderDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpSliderValueChange" }, host: { properties: { "attr.data-orientation": "state.orientation()" } }, providers: [provideSliderState()], exportAs: ["ngpSlider"], ngImport: i0 }); }
|
|
291
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpSlider, isStandalone: true, selector: "[ngpSlider]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpSliderValue", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "ngpSliderMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpSliderMax", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "ngpSliderStep", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "ngpSliderOrientation", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSliderDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpSliderValueChange" }, host: { properties: { "id": "id()", "attr.data-orientation": "state.orientation()" } }, providers: [provideSliderState()], exportAs: ["ngpSlider"], ngImport: i0 }); }
|
|
287
292
|
}
|
|
288
293
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpSlider, decorators: [{
|
|
289
294
|
type: Directive,
|
|
@@ -292,6 +297,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
292
297
|
exportAs: 'ngpSlider',
|
|
293
298
|
providers: [provideSliderState()],
|
|
294
299
|
host: {
|
|
300
|
+
'[id]': 'id()',
|
|
295
301
|
'[attr.data-orientation]': 'state.orientation()',
|
|
296
302
|
},
|
|
297
303
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-slider.mjs","sources":["../../../../packages/ng-primitives/slider/src/slider/slider-state.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.ts","../../../../packages/ng-primitives/slider/src/slider/slider.ts","../../../../packages/ng-primitives/slider/src/ng-primitives-slider.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSlider } from './slider';\n\n/**\n * The state token for the Slider primitive.\n */\nexport const NgpSliderStateToken = createStateToken<NgpSlider>('Slider');\n\n/**\n * Provides the Slider state.\n */\nexport const provideSliderState = createStateProvider(NgpSliderStateToken);\n\n/**\n * Injects the Slider state.\n */\nexport const injectSliderState = createStateInjector(NgpSliderStateToken);\n\n/**\n * The Slider state registration function.\n */\nexport const sliderState = createState(NgpSliderStateToken);\n","import { Directive } from '@angular/core';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderRange` directive to an element that represents the range of the slider.\n */\n@Directive({\n selector: '[ngpSliderRange]',\n exportAs: 'ngpSliderRange',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.width.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.height.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderRange {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderThumb` directive to an element that represents the thumb of the slider.\n */\n@Directive({\n selector: '[ngpSliderThumb]',\n exportAs: 'ngpSliderThumb',\n host: {\n role: 'slider',\n '[attr.aria-valuemin]': 'sliderState().min()',\n '[attr.aria-valuemax]': 'sliderState().max()',\n '[attr.aria-valuenow]': 'sliderState().value()',\n '[attr.aria-orientation]': 'sliderState().orientation()',\n '[tabindex]': 'sliderState().disabled() ? -1 : 0',\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.inset-inline-start.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.inset-block-start.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderThumb {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * Store the dragging state.\n */\n protected dragging = false;\n\n constructor() {\n setupInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled: this.sliderState().disabled,\n });\n }\n\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n event.preventDefault();\n\n if (this.sliderState().disabled()) {\n return;\n }\n\n this.dragging = true;\n }\n\n @HostListener('document:pointerup')\n protected handlePointerUp(): void {\n if (this.sliderState().disabled()) {\n return;\n }\n\n this.dragging = false;\n }\n\n @HostListener('document:pointermove', ['$event'])\n protected handlePointerMove(event: PointerEvent): void {\n if (this.sliderState().disabled() || !this.dragging) {\n return;\n }\n\n const rect = this.sliderState().track()?.element.nativeElement.getBoundingClientRect();\n\n if (!rect) {\n return;\n }\n\n const percentage =\n this.sliderState().orientation() === 'horizontal'\n ? (event.clientX - rect.left) / rect.width\n : 1 - (event.clientY - rect.top) / rect.height;\n\n this.sliderState().value.set(\n this.sliderState().min() +\n (this.sliderState().max() - this.sliderState().min()) *\n Math.max(0, Math.min(1, percentage)),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n }\n\n /**\n * Handle keyboard events.\n * @param event\n */\n @HostListener('keydown', ['$event'])\n protected handleKeydown(event: KeyboardEvent): void {\n const multiplier = event.shiftKey ? 10 : 1;\n const value = this.sliderState().value();\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n this.sliderState().value.set(\n Math.max(value - this.sliderState().step() * multiplier, this.sliderState().min()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n this.sliderState().value.set(\n Math.min(value + this.sliderState().step() * multiplier, this.sliderState().max()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'Home':\n this.sliderState().value.set(this.sliderState().min());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'End':\n this.sliderState().value.set(this.sliderState().max());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n }\n }\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderTrack` directive to an element that represents the track of the slider.\n */\n@Directive({\n selector: '[ngpSliderTrack]',\n exportAs: 'ngpSliderTrack',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n },\n})\nexport class NgpSliderTrack {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * The element that represents the slider track.\n */\n readonly element = injectElementRef<HTMLElement>();\n\n constructor() {\n this.sliderState().track.set(this);\n }\n\n /**\n * When the slider track is clicked, update the value.\n * @param event The click event.\n */\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n if (this.sliderState().disabled()) {\n return;\n }\n\n // get the position the click occurred within the slider track\n const position =\n this.sliderState().orientation() === 'horizontal' ? event.clientX : event.clientY;\n const rect = this.element.nativeElement.getBoundingClientRect();\n const percentage =\n (position - (this.sliderState().orientation() === 'horizontal' ? rect.left : rect.top)) /\n (this.sliderState().orientation() === 'horizontal' ? rect.width : rect.height);\n\n // update the value based on the position\n this.sliderState().value.set(\n this.sliderState().min() + (this.sliderState().max() - this.sliderState().min()) * percentage,\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n }\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n booleanAttribute,\n computed,\n input,\n numberAttribute,\n output,\n signal,\n} from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport type { NgpSliderTrack } from '../slider-track/slider-track';\nimport { provideSliderState, sliderState } from './slider-state';\n\n/**\n * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.\n */\n@Directive({\n selector: '[ngpSlider]',\n exportAs: 'ngpSlider',\n providers: [provideSliderState()],\n host: {\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpSlider {\n /**\n * The value of the slider.\n */\n readonly value = input<number, NumberInput>(0, {\n alias: 'ngpSliderValue',\n transform: numberAttribute,\n });\n\n /**\n * Emits when the value changes.\n */\n readonly valueChange = output<number>({\n alias: 'ngpSliderValueChange',\n });\n\n /**\n * The minimum value of the slider.\n */\n readonly min = input<number, NumberInput>(0, {\n alias: 'ngpSliderMin',\n transform: numberAttribute,\n });\n\n /**\n * The maximum value of the slider.\n */\n readonly max = input<number, NumberInput>(100, {\n alias: 'ngpSliderMax',\n transform: numberAttribute,\n });\n\n /**\n * The step value of the slider.\n */\n readonly step = input<number, NumberInput>(1, {\n alias: 'ngpSliderStep',\n transform: numberAttribute,\n });\n\n /**\n * The orientation of the slider.\n */\n readonly orientation = input<NgpOrientation>('horizontal', {\n alias: 'ngpSliderOrientation',\n });\n\n /**\n * The disabled state of the slider.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSliderDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the slider track.\n * @internal\n */\n readonly track = signal<NgpSliderTrack | undefined>(undefined);\n\n /**\n * The value as a percentage based on the min and max values.\n */\n protected readonly percentage = computed(\n () => ((this.state.value() - this.state.min()) / (this.state.max() - this.state.min())) * 100,\n );\n\n /**\n * The state of the slider. We use this for the slider state rather than relying on the inputs.\n * @internal\n */\n protected readonly state = sliderState<NgpSlider>(this);\n\n constructor() {\n setupFormControl({ disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB;AAExE;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACvB3D;;AAEG;MAaU,cAAc,CAAA;AAZ3B,IAAA,WAAA,GAAA;AAaE;;AAEG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AACrD;+GALY,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,uBAAA,EAAA,6BAAA,EAAA,oBAAA,EAAA,wCAAA,EAAA,eAAA,EAAA,yFAAA,EAAA,gBAAA,EAAA,uFAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAZ1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE,6BAA6B;AACxD,wBAAA,sBAAsB,EAAE,sCAAsC;AAC9D,wBAAA,iBAAiB,EACf,uFAAuF;AACzF,wBAAA,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QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAKtB,SAAS,EAAA,UAAA,EAAA,CAAA;kBARrB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,SAAS,EAAE,CAAC,kBAAkB,EAAE,CAAC;AACjC,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;ACzBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-slider.mjs","sources":["../../../../packages/ng-primitives/slider/src/slider/slider-state.ts","../../../../packages/ng-primitives/slider/src/slider-range/slider-range.ts","../../../../packages/ng-primitives/slider/src/slider-thumb/slider-thumb.ts","../../../../packages/ng-primitives/slider/src/slider-track/slider-track.ts","../../../../packages/ng-primitives/slider/src/slider/slider.ts","../../../../packages/ng-primitives/slider/src/ng-primitives-slider.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSlider } from './slider';\n\n/**\n * The state token for the Slider primitive.\n */\nexport const NgpSliderStateToken = createStateToken<NgpSlider>('Slider');\n\n/**\n * Provides the Slider state.\n */\nexport const provideSliderState = createStateProvider(NgpSliderStateToken);\n\n/**\n * Injects the Slider state.\n */\nexport const injectSliderState = createStateInjector<NgpSlider>(NgpSliderStateToken);\n\n/**\n * The Slider state registration function.\n */\nexport const sliderState = createState(NgpSliderStateToken);\n","import { Directive } from '@angular/core';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderRange` directive to an element that represents the range of the slider.\n */\n@Directive({\n selector: '[ngpSliderRange]',\n exportAs: 'ngpSliderRange',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.width.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.height.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderRange {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderThumb` directive to an element that represents the thumb of the slider.\n */\n@Directive({\n selector: '[ngpSliderThumb]',\n exportAs: 'ngpSliderThumb',\n host: {\n role: 'slider',\n '[attr.aria-valuemin]': 'sliderState().min()',\n '[attr.aria-valuemax]': 'sliderState().max()',\n '[attr.aria-valuenow]': 'sliderState().value()',\n '[attr.aria-orientation]': 'sliderState().orientation()',\n '[tabindex]': 'sliderState().disabled() ? -1 : 0',\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n '[style.inset-inline-start.%]':\n 'sliderState().orientation() === \"horizontal\" ? sliderState().percentage() : undefined',\n '[style.inset-block-start.%]':\n 'sliderState().orientation() === \"vertical\" ? sliderState().percentage() : undefined',\n },\n})\nexport class NgpSliderThumb {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * Store the dragging state.\n */\n protected dragging = false;\n\n constructor() {\n setupInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled: this.sliderState().disabled,\n });\n }\n\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n event.preventDefault();\n\n if (this.sliderState().disabled()) {\n return;\n }\n\n this.dragging = true;\n }\n\n @HostListener('document:pointerup')\n protected handlePointerUp(): void {\n if (this.sliderState().disabled()) {\n return;\n }\n\n this.dragging = false;\n }\n\n @HostListener('document:pointermove', ['$event'])\n protected handlePointerMove(event: PointerEvent): void {\n if (this.sliderState().disabled() || !this.dragging) {\n return;\n }\n\n const rect = this.sliderState().track()?.element.nativeElement.getBoundingClientRect();\n\n if (!rect) {\n return;\n }\n\n const percentage =\n this.sliderState().orientation() === 'horizontal'\n ? (event.clientX - rect.left) / rect.width\n : 1 - (event.clientY - rect.top) / rect.height;\n\n this.sliderState().value.set(\n this.sliderState().min() +\n (this.sliderState().max() - this.sliderState().min()) *\n Math.max(0, Math.min(1, percentage)),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n }\n\n /**\n * Handle keyboard events.\n * @param event\n */\n @HostListener('keydown', ['$event'])\n protected handleKeydown(event: KeyboardEvent): void {\n const multiplier = event.shiftKey ? 10 : 1;\n const value = this.sliderState().value();\n\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n this.sliderState().value.set(\n Math.max(value - this.sliderState().step() * multiplier, this.sliderState().min()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n this.sliderState().value.set(\n Math.min(value + this.sliderState().step() * multiplier, this.sliderState().max()),\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'Home':\n this.sliderState().value.set(this.sliderState().min());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n case 'End':\n this.sliderState().value.set(this.sliderState().max());\n this.sliderState().valueChange.emit(this.sliderState().value());\n event.preventDefault();\n break;\n }\n }\n}\n","import { Directive, HostListener } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectSliderState } from '../slider/slider-state';\n\n/**\n * Apply the `ngpSliderTrack` directive to an element that represents the track of the slider.\n */\n@Directive({\n selector: '[ngpSliderTrack]',\n exportAs: 'ngpSliderTrack',\n host: {\n '[attr.data-orientation]': 'sliderState().orientation()',\n '[attr.data-disabled]': 'sliderState().disabled() ? \"\" : null',\n },\n})\nexport class NgpSliderTrack {\n /**\n * Access the slider state.\n */\n protected readonly sliderState = injectSliderState();\n\n /**\n * The element that represents the slider track.\n */\n readonly element = injectElementRef<HTMLElement>();\n\n constructor() {\n this.sliderState().track.set(this);\n }\n\n /**\n * When the slider track is clicked, update the value.\n * @param event The click event.\n */\n @HostListener('pointerdown', ['$event'])\n protected handlePointerDown(event: PointerEvent): void {\n if (this.sliderState().disabled()) {\n return;\n }\n\n // get the position the click occurred within the slider track\n const position =\n this.sliderState().orientation() === 'horizontal' ? event.clientX : event.clientY;\n const rect = this.element.nativeElement.getBoundingClientRect();\n const percentage =\n (position - (this.sliderState().orientation() === 'horizontal' ? rect.left : rect.top)) /\n (this.sliderState().orientation() === 'horizontal' ? rect.width : rect.height);\n\n // update the value based on the position\n this.sliderState().value.set(\n this.sliderState().min() + (this.sliderState().max() - this.sliderState().min()) * percentage,\n );\n this.sliderState().valueChange.emit(this.sliderState().value());\n }\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n booleanAttribute,\n computed,\n input,\n numberAttribute,\n output,\n signal,\n} from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { uniqueId } from 'ng-primitives/utils';\nimport type { NgpSliderTrack } from '../slider-track/slider-track';\nimport { provideSliderState, sliderState } from './slider-state';\n\n/**\n * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.\n */\n@Directive({\n selector: '[ngpSlider]',\n exportAs: 'ngpSlider',\n providers: [provideSliderState()],\n host: {\n '[id]': 'id()',\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpSlider {\n /**\n * The id of the slider. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-slider'));\n\n /**\n * The value of the slider.\n */\n readonly value = input<number, NumberInput>(0, {\n alias: 'ngpSliderValue',\n transform: numberAttribute,\n });\n\n /**\n * Emits when the value changes.\n */\n readonly valueChange = output<number>({\n alias: 'ngpSliderValueChange',\n });\n\n /**\n * The minimum value of the slider.\n */\n readonly min = input<number, NumberInput>(0, {\n alias: 'ngpSliderMin',\n transform: numberAttribute,\n });\n\n /**\n * The maximum value of the slider.\n */\n readonly max = input<number, NumberInput>(100, {\n alias: 'ngpSliderMax',\n transform: numberAttribute,\n });\n\n /**\n * The step value of the slider.\n */\n readonly step = input<number, NumberInput>(1, {\n alias: 'ngpSliderStep',\n transform: numberAttribute,\n });\n\n /**\n * The orientation of the slider.\n */\n readonly orientation = input<NgpOrientation>('horizontal', {\n alias: 'ngpSliderOrientation',\n });\n\n /**\n * The disabled state of the slider.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpSliderDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the slider track.\n * @internal\n */\n readonly track = signal<NgpSliderTrack | undefined>(undefined);\n\n /**\n * The value as a percentage based on the min and max values.\n */\n protected readonly percentage = computed(\n () => ((this.state.value() - this.state.min()) / (this.state.max() - this.state.min())) * 100,\n );\n\n /**\n * The state of the slider. We use this for the slider state rather than relying on the inputs.\n * @internal\n */\n protected readonly state = sliderState<NgpSlider>(this);\n\n constructor() {\n setupFormControl({ id: this.state.id, disabled: this.state.disabled });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACvB3D;;AAEG;MAaU,cAAc,CAAA;AAZ3B,IAAA,WAAA,GAAA;AAaE;;AAEG;QACgB,IAAW,CAAA,WAAA,GAAG,iBAAiB,EAAE;AACrD;+GALY,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CA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,MAAM;AACd,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;AC3BD;;AAEG;;;;"}
|
|
@@ -2,8 +2,8 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Directive, input, booleanAttribute, output, HostListener } from '@angular/core';
|
|
3
3
|
import { setupInteractions, injectElementRef } from 'ng-primitives/internal';
|
|
4
4
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
5
|
+
import { setupFormControl } from 'ng-primitives/form-field';
|
|
6
|
+
import { uniqueId } from 'ng-primitives/utils';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The state token for the Switch primitive.
|
|
@@ -65,6 +65,10 @@ class NgpSwitch {
|
|
|
65
65
|
* Determine if the switch is a button
|
|
66
66
|
*/
|
|
67
67
|
this.isButton = this.elementRef.nativeElement.tagName === 'BUTTON';
|
|
68
|
+
/**
|
|
69
|
+
* The id of the switch. If not provided, a unique id will be generated.
|
|
70
|
+
*/
|
|
71
|
+
this.id = input(uniqueId('ngp-switch'));
|
|
68
72
|
/**
|
|
69
73
|
* Determine if the switch is checked.
|
|
70
74
|
* @default false
|
|
@@ -98,6 +102,7 @@ class NgpSwitch {
|
|
|
98
102
|
focusVisible: true,
|
|
99
103
|
disabled: this.state.disabled,
|
|
100
104
|
});
|
|
105
|
+
setupFormControl({ id: this.state.id, disabled: this.state.disabled });
|
|
101
106
|
}
|
|
102
107
|
/**
|
|
103
108
|
* Toggle the checked state.
|
|
@@ -122,7 +127,7 @@ class NgpSwitch {
|
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
125
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpSwitch, isStandalone: true, selector: "[ngpSwitch]", inputs: { checked: { classPropertyName: "checked", publicName: "ngpSwitchChecked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSwitchDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpSwitchCheckedChange" }, host: { attributes: { "role": "switch" }, listeners: { "click": "toggle()", "keydown.space": "onKeyDown($event)" }, properties: { "attr.type": "isButton ? \"button\" : null", "attr.aria-checked": "state.checked()", "attr.data-checked": "state.checked() ? \"\" : null", "attr.disabled": "isButton && state.disabled() ? \"\" : null", "attr.data-disabled": "state.disabled() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "attr.tabindex": "state.disabled() ? -1 : 0" } }, providers: [provideSwitchState()], exportAs: ["ngpSwitch"],
|
|
130
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpSwitch, isStandalone: true, selector: "[ngpSwitch]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "ngpSwitchChecked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpSwitchDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpSwitchCheckedChange" }, host: { attributes: { "role": "switch" }, listeners: { "click": "toggle()", "keydown.space": "onKeyDown($event)" }, properties: { "id": "id()", "attr.type": "isButton ? \"button\" : null", "attr.aria-checked": "state.checked()", "attr.data-checked": "state.checked() ? \"\" : null", "attr.disabled": "isButton && state.disabled() ? \"\" : null", "attr.data-disabled": "state.disabled() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "attr.tabindex": "state.disabled() ? -1 : 0" } }, providers: [provideSwitchState()], exportAs: ["ngpSwitch"], ngImport: i0 }); }
|
|
126
131
|
}
|
|
127
132
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpSwitch, decorators: [{
|
|
128
133
|
type: Directive,
|
|
@@ -130,9 +135,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
130
135
|
selector: '[ngpSwitch]',
|
|
131
136
|
exportAs: 'ngpSwitch',
|
|
132
137
|
providers: [provideSwitchState()],
|
|
133
|
-
hostDirectives: [NgpFormControl],
|
|
134
138
|
host: {
|
|
135
139
|
role: 'switch',
|
|
140
|
+
'[id]': 'id()',
|
|
136
141
|
'[attr.type]': 'isButton ? "button" : null',
|
|
137
142
|
'[attr.aria-checked]': 'state.checked()',
|
|
138
143
|
'[attr.data-checked]': 'state.checked() ? "" : null',
|
|
@@ -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.ts","../../../../packages/ng-primitives/switch/src/switch/switch.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSwitch } from './switch';\n\n/**\n * The state token for the Switch primitive.\n */\nexport const NgpSwitchStateToken = createStateToken<NgpSwitch>('Switch');\n\n/**\n * Provides the Switch state.\n */\nexport const provideSwitchState = createStateProvider(NgpSwitchStateToken);\n\n/**\n * Injects the Switch state.\n */\nexport const injectSwitchState = createStateInjector(NgpSwitchStateToken);\n\n/**\n * The Switch state registration function.\n */\nexport const switchState = createState(NgpSwitchStateToken);\n","import { Directive } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { injectSwitchState } from '../switch/switch-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 host: {\n '[attr.data-checked]': 'state().checked() ? \"\" : null',\n '[attr.data-disabled]': 'state().disabled() ? \"\" : null',\n },\n})\nexport class NgpSwitchThumb {\n /**\n * Access the switch state.\n */\n protected readonly state = injectSwitchState();\n\n constructor() {\n setupInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled: this.state().disabled,\n });\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, output } from '@angular/core';\nimport {
|
|
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.ts","../../../../packages/ng-primitives/switch/src/switch/switch.ts","../../../../packages/ng-primitives/switch/src/ng-primitives-switch.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSwitch } from './switch';\n\n/**\n * The state token for the Switch primitive.\n */\nexport const NgpSwitchStateToken = createStateToken<NgpSwitch>('Switch');\n\n/**\n * Provides the Switch state.\n */\nexport const provideSwitchState = createStateProvider(NgpSwitchStateToken);\n\n/**\n * Injects the Switch state.\n */\nexport const injectSwitchState = createStateInjector<NgpSwitch>(NgpSwitchStateToken);\n\n/**\n * The Switch state registration function.\n */\nexport const switchState = createState(NgpSwitchStateToken);\n","import { Directive } from '@angular/core';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { injectSwitchState } from '../switch/switch-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 host: {\n '[attr.data-checked]': 'state().checked() ? \"\" : null',\n '[attr.data-disabled]': 'state().disabled() ? \"\" : null',\n },\n})\nexport class NgpSwitchThumb {\n /**\n * Access the switch state.\n */\n protected readonly state = injectSwitchState();\n\n constructor() {\n setupInteractions({\n hover: true,\n focusVisible: true,\n press: true,\n disabled: this.state().disabled,\n });\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, output } from '@angular/core';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { injectElementRef, setupInteractions } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { provideSwitchState, switchState } 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()],\n host: {\n role: 'switch',\n '[id]': 'id()',\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-checked]': 'state.checked()',\n '[attr.data-checked]': 'state.checked() ? \"\" : null',\n '[attr.disabled]': 'isButton && state.disabled() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[attr.tabindex]': 'state.disabled() ? -1 : 0',\n },\n})\nexport class NgpSwitch {\n /**\n * Access the element ref.\n */\n private readonly elementRef = injectElementRef();\n\n /**\n * Determine if the switch is a button\n */\n protected isButton = this.elementRef.nativeElement.tagName === 'BUTTON';\n\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 = switchState<NgpSwitch>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n setupFormControl({ id: this.state.id, disabled: this.state.disabled });\n }\n\n /**\n * Toggle the checked state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.checked.set(!this.state.checked());\n this.checkedChange.emit(this.state.checked());\n }\n\n /**\n * Handle the keydown event.\n */\n @HostListener('keydown.space', ['$event'])\n protected onKeyDown(event: KeyboardEvent): void {\n // Prevent the default action of the space key, which is to scroll the page.\n event.preventDefault();\n\n // If the switch is not a button then the space key will not toggle the checked state automatically,\n // so we need to do it manually.\n if (!this.isButton) {\n this.toggle();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACtB3D;;AAEG;MAQU,cAAc,CAAA;AAMzB,IAAA,WAAA,GAAA;AALA;;AAEG;QACgB,IAAK,CAAA,KAAA,GAAG,iBAAiB,EAAE;AAG5C,QAAA,iBAAiB,CAAC;AAChB,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ;AAChC,SAAA,CAAC;;+GAZO,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAd,cAAc,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,kBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,mBAAA,EAAA,iCAAA,EAAA,oBAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4F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AAA;AACF,iBAAA;wDA8DC,MAAM,EAAA,CAAA;sBADL,YAAY;uBAAC,OAAO;gBAcX,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;;;ACnG3C;;AAEG;;;;"}
|
|
@@ -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.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 {\n Directive,\n HOST_TAG_NAME,\n HostListener,\n OnInit,\n booleanAttribute,\n computed,\n inject,\n input,\n} 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.disabled]': 'tagName === \"button\" && disabled() ? \"\" : null',\n '[attr.data-orientation]': 'state().orientation()',\n },\n hostDirectives: [NgpRovingFocusItem],\n})\nexport class NgpTabButton implements OnInit {\n /**\n * Access the tag host name\n */\n protected readonly tagName = inject(HOST_TAG_NAME);\n\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 are no tabs then return the selected value\n // if there is a value set and a tab with that value exists, return the value\n if (panels.length === 0 || 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,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,iBAAiB;AAC5E;;AC3CA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,mBAAmB;AAExE;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACX3D;;AAEG;MAeU,YAAY,CAAA;AAgDvB,IAAA,WAAA,GAAA;AA/CA;;AAEG;AACgB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC;AAElD;;AAEG;QACgB,IAAK,CAAA,KAAA,GAAG,iBAAiB,EAAE;AAE9C;;AAEG;QACM,IAAK,CAAA,KAAA,GAAG,KAAK,CAAS,SAAS,EAAE,EAAE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AA,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;;;;"}
|
|
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<NgpTabset>(NgpTabsetStateToken);\n\n/**\n * The Tabset state registration function.\n */\nexport const tabsetState = createState(NgpTabsetStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n HOST_TAG_NAME,\n HostListener,\n OnInit,\n booleanAttribute,\n computed,\n inject,\n input,\n} 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.disabled]': 'tagName === \"button\" && disabled() ? \"\" : null',\n '[attr.data-orientation]': 'state().orientation()',\n },\n hostDirectives: [NgpRovingFocusItem],\n})\nexport class NgpTabButton implements OnInit {\n /**\n * Access the tag host name\n */\n protected readonly tagName = inject(HOST_TAG_NAME);\n\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 are no tabs then return the selected value\n // if there is a value set and a tab with that value exists, return the value\n if (panels.length === 0 || 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,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,iBAAiB;AAC5E;;AC3CA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACX3D;;AAEG;MAeU,YAAY,CAAA;AAgDvB,IAAA,WAAA,GAAA;AA/CA;;AAEG;AACgB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC;AAElD;;AAEG;QACgB,IAA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