ng-primitives 0.124.0 → 0.125.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/date-time-date-fns/README.md +3 -0
- package/fesm2022/ng-primitives-avatar.mjs +4 -2
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs +4 -2
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs +42 -44
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-time-date-fns.mjs +95 -0
- package/fesm2022/ng-primitives-date-time-date-fns.mjs.map +1 -0
- package/fesm2022/ng-primitives-date-time-luxon.mjs +21 -3
- package/fesm2022/ng-primitives-date-time-luxon.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-time.mjs +18 -3
- package/fesm2022/ng-primitives-date-time.mjs.map +1 -1
- package/fesm2022/ng-primitives-dialog.mjs +11 -4
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +3 -0
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input-otp.mjs +15 -7
- package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +5 -4
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs +8 -0
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-meter.mjs +20 -5
- package/fesm2022/ng-primitives-meter.mjs.map +1 -1
- package/fesm2022/ng-primitives-number-field.mjs +10 -0
- package/fesm2022/ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs +16 -6
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-popover.mjs +4 -0
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +36 -11
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs +13 -2
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs +2 -1
- package/fesm2022/ng-primitives-search.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +38 -18
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +18 -8
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +22 -6
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +10 -8
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +3 -0
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +31 -8
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/package.json +8 -1
- package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -1
- package/schematics/ng-generate/templates/combobox/combobox.__fileSuffix@dasherize__.ts.template +3 -2
- package/schematics/ng-generate/templates/date-picker/date-picker.__fileSuffix@dasherize__.ts.template +2 -1
- package/schematics/ng-generate/templates/listbox/listbox.__fileSuffix@dasherize__.ts.template +9 -4
- package/schematics/ng-generate/templates/pagination/pagination.__fileSuffix@dasherize__.ts.template +7 -1
- package/schematics/ng-generate/templates/range-slider/range-slider.__fileSuffix@dasherize__.ts.template +4 -3
- package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +2 -1
- package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -1
- package/types/ng-primitives-checkbox.d.ts +5 -1
- package/types/ng-primitives-date-picker.d.ts +7 -9
- package/types/ng-primitives-date-time-date-fns.d.ts +30 -0
- package/types/ng-primitives-date-time.d.ts +15 -3
- package/types/ng-primitives-dialog.d.ts +4 -0
- package/types/ng-primitives-input-otp.d.ts +5 -5
- package/types/ng-primitives-meter.d.ts +9 -2
- package/types/ng-primitives-pagination.d.ts +34 -8
- package/types/ng-primitives-progress.d.ts +4 -2
- package/types/ng-primitives-roving-focus.d.ts +7 -0
- package/types/ng-primitives-slider.d.ts +5 -4
- package/types/ng-primitives-switch.d.ts +14 -4
- package/types/ng-primitives-tabs.d.ts +6 -1
- package/types/ng-primitives-toggle-group.d.ts +51 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { inject, signal, Signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { controlled, createPrimitive, injectInheritedState } from 'ng-primitives/state';\nimport type { NgpRovingFocusItemState } from '../roving-focus-item/roving-focus-item-state';\n\nexport interface NgpRovingFocusGroupState {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The id of the currently active item.\n */\n readonly activeItem: Signal<string | null>;\n /**\n * Handle keyboard navigation.\n * @param event The keyboard event\n */\n onKeydown(event: KeyboardEvent): void;\n /**\n * Set the active item by id.\n * @param id The id of the item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(id: string | null, origin?: FocusOrigin): void;\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n */\n register(item: NgpRovingFocusItemState): void;\n /**\n * Unregister an item from the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItemState): void;\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation value\n */\n setOrientation(orientation: NgpOrientation): void;\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateFirst(origin?: FocusOrigin): void;\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateLast(origin?: FocusOrigin): void;\n}\n\nexport interface NgpRovingFocusGroupProps {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation?: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap?: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd?: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Whether to inherit state from a parent roving focus group.\n */\n readonly inherit?: boolean;\n}\n\nexport const [\n NgpRovingFocusGroupStateToken,\n ngpRovingFocusGroup,\n injectRovingFocusGroupState,\n provideRovingFocusGroupState,\n] = createPrimitive(\n 'NgpRovingFocusGroup',\n ({\n orientation: _orientation = signal('vertical'),\n wrap = signal(false),\n homeEnd = signal(true),\n disabled = signal(false),\n inherit = true,\n }: NgpRovingFocusGroupProps): NgpRovingFocusGroupState => {\n const parentGroup = inherit\n ? injectInheritedState(() => NgpRovingFocusGroupStateToken)?.()\n : null;\n\n if (parentGroup) {\n return parentGroup;\n }\n\n const directionality = inject(Directionality);\n const items = signal<NgpRovingFocusItemState[]>([]);\n const orientation = controlled(_orientation);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n function getSortedItems() {\n return items().sort((a, b) => {\n // sort the items by their position in the document\n return a.element.nativeElement.compareDocumentPosition(b.element.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group.\n */\n const activeItem = signal<string | null>(null);\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n function setActiveItem(id: string | null, origin: FocusOrigin = 'program'): void {\n activeItem.set(id);\n const item = items().find(i => i.id() === id) ?? null;\n\n if (item) {\n item.focus(origin);\n }\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = getSortedItems().find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...getSortedItems()].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateNextItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the first item\n if (!currentActiveItem) {\n activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the next item that is not disabled\n const item = sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && wrap()) {\n activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activatePreviousItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the last item\n if (!currentActiveItem) {\n activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the previous item that is not disabled\n const item =\n sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && wrap()) {\n activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n */\n function onKeydown(event: KeyboardEvent): void {\n if (disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activatePreviousItem('keyboard');\n } else {\n activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activateNextItem('keyboard');\n } else {\n activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (homeEnd()) {\n event.preventDefault();\n activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (homeEnd()) {\n event.preventDefault();\n activateLastItem('keyboard');\n }\n break;\n }\n }\n\n function register(item: NgpRovingFocusItemState): void {\n items.update(items => [...items, item]);\n\n // if there is no active item, make the first item the tabbable item\n if (!activeItem()) {\n activeItem.set(item.id());\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n function unregister(item: NgpRovingFocusItemState): void {\n items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (activeItem() === item.id()) {\n // if the active item is unregistered, activate the first item\n activeItem.set(items()[0]?.id() ?? null);\n }\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param value The orientation value\n */\n function setOrientation(value: NgpOrientation): void {\n orientation.set(value);\n }\n\n return {\n orientation: orientation.asReadonly(),\n wrap,\n homeEnd,\n disabled,\n activeItem,\n setActiveItem,\n setOrientation,\n onKeydown,\n register,\n unregister,\n activateFirst: activateFirstItem,\n activateLast: activateLastItem,\n } satisfies NgpRovingFocusGroupState;\n },\n);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n /**\n * Whether we should inherit the focus group from the parent\n * @default true\n */\n inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n type: Type<NgpRovingFocusGroup>,\n { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n return {\n provide: NgpRovingFocusGroupToken,\n // Roving focus groups may be nested, in this case, the parent group should be used\n useFactory: () => {\n if (!inherit) {\n return inject(type, { self: true });\n }\n\n // If the parent group is not found, return the current group\n // This is useful for nested groups\n return (\n inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n inject(type, { self: true })\n );\n },\n };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { ngpRovingFocusGroup, provideRovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [\n provideRovingFocusGroup(NgpRovingFocusGroup),\n provideRovingFocusGroupState({ inherit: true }),\n ],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = input<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * The state of the roving focus group.\n */\n readonly state = ngpRovingFocusGroup({\n orientation: this.orientation,\n wrap: this.wrap,\n homeEnd: this.homeEnd,\n disabled: this.disabled,\n });\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n if (item) {\n this.state.setActiveItem(item.id(), origin);\n }\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { computed, effect, ElementRef, inject, signal, Signal, untracked } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, listener } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectRovingFocusGroupState } from '../roving-focus-group/roving-focus-group-state';\n\n/**\n * The state interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemState {\n /**\n * The unique id of the roving focus item.\n */\n readonly id: Signal<string>;\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The tabindex of the roving focus item.\n */\n readonly tabindex: Signal<number>;\n /**\n * The element reference of the roving focus item.\n */\n readonly element: ElementRef<HTMLElement>;\n /**\n * Focus the roving focus item.\n * @param origin The focus origin\n */\n focus(origin: FocusOrigin): void;\n}\n\n/**\n * The props interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemProps {\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\nexport const [\n NgpRovingFocusItemStateToken,\n ngpRovingFocusItem,\n injectRovingFocusItemState,\n provideRovingFocusItemState,\n] = createPrimitive(\n 'NgpRovingFocusItem',\n ({ disabled = signal(false) }: NgpRovingFocusItemProps) => {\n const element = injectElementRef();\n const group = injectRovingFocusGroupState();\n const focusMonitor = inject(FocusMonitor);\n\n // genertate a unique id for the roving focus item - this is not a DOM id but an internal identifier\n const id = uniqueId('ngp-roving-focus-item');\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n const tabindex = computed(() =>\n !group()?.disabled() && group()?.activeItem() === id ? 0 : -1,\n );\n\n // Setup host attribute bindings\n attrBinding(element, 'tabindex', () => tabindex().toString());\n\n // Setup keyboard event listener\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (disabled()) {\n return;\n }\n group()?.onKeydown(event);\n });\n\n // Setup click event listener\n listener(element, 'click', () => {\n if (disabled()) {\n return;\n }\n group()?.setActiveItem(id, 'mouse');\n });\n\n function focus(origin: FocusOrigin): void {\n focusMonitor.focusVia(element, origin);\n }\n\n const state: NgpRovingFocusItemState = {\n id: signal(id),\n disabled,\n tabindex,\n focus,\n element,\n };\n\n // Projected items may construct before the parent populates the shared group signal,\n // so register reactively once it becomes available.\n // See https://github.com/ng-primitives/ng-primitives/issues/735\n effect(onCleanup => {\n const groupState = group();\n if (!groupState) return;\n untracked(() => groupState.register(state));\n onCleanup(() => groupState.unregister(state));\n });\n\n return state satisfies NgpRovingFocusItemState;\n },\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input } from '@angular/core';\nimport { ngpRovingFocusItem, provideRovingFocusItemState } from './roving-focus-item-state';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n providers: [provideRovingFocusItemState()],\n})\nexport class NgpRovingFocusItem {\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n private readonly state = ngpRovingFocusItem({ disabled: this.disabled });\n\n /**\n * Expose the internal id of the roving focus item.\n * @internal\n */\n readonly id = computed(() => this.state.id());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AA0FO,MAAM,CACX,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,GAAG,eAAe,CACjB,qBAAqB,EACrB,CAAC,EACC,WAAW,EAAE,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,EAC9C,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EACpB,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EACtB,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EACxB,OAAO,GAAG,IAAI,GACW,KAA8B;IACvD,MAAM,WAAW,GAAG;UAChB,oBAAoB,CAAC,MAAM,6BAA6B,CA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AA;;4FAE/B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,SAAS,EAAE,CAAC,2BAA2B,EAAE,CAAC;AAC3C,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { inject, signal, Signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { controlled, createPrimitive, injectInheritedState } from 'ng-primitives/state';\nimport type { NgpRovingFocusItemState } from '../roving-focus-item/roving-focus-item-state';\n\nexport interface NgpRovingFocusGroupState {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The id of the currently active item.\n */\n readonly activeItem: Signal<string | null>;\n /**\n * Handle keyboard navigation.\n * @param event The keyboard event\n */\n onKeydown(event: KeyboardEvent): void;\n /**\n * Set the active item by id.\n * @param id The id of the item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(id: string | null, origin?: FocusOrigin): void;\n /**\n * Set which item holds the tab stop without moving focus. Used by items that\n * declare themselves active (e.g. the selected tab) to claim the tab stop\n * without stealing focus.\n * @param id The id of the item that should hold the tab stop.\n */\n setTabStop(id: string | null): void;\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n */\n register(item: NgpRovingFocusItemState): void;\n /**\n * Unregister an item from the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItemState): void;\n /**\n * Set the orientation of the roving focus group.\n * @param orientation The orientation value\n */\n setOrientation(orientation: NgpOrientation): void;\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateFirst(origin?: FocusOrigin): void;\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n activateLast(origin?: FocusOrigin): void;\n}\n\nexport interface NgpRovingFocusGroupProps {\n /**\n * The orientation of the roving focus group.\n */\n readonly orientation?: Signal<NgpOrientation>;\n /**\n * Whether the roving focus group should wrap around.\n */\n readonly wrap?: Signal<boolean>;\n /**\n * Whether the Home and End keys are enabled.\n */\n readonly homeEnd?: Signal<boolean>;\n /**\n * Whether the roving focus group is disabled.\n */\n readonly disabled?: Signal<boolean>;\n /**\n * Whether to inherit state from a parent roving focus group.\n */\n readonly inherit?: boolean;\n}\n\nexport const [\n NgpRovingFocusGroupStateToken,\n ngpRovingFocusGroup,\n injectRovingFocusGroupState,\n provideRovingFocusGroupState,\n] = createPrimitive(\n 'NgpRovingFocusGroup',\n ({\n orientation: _orientation = signal('vertical'),\n wrap = signal(false),\n homeEnd = signal(true),\n disabled = signal(false),\n inherit = true,\n }: NgpRovingFocusGroupProps): NgpRovingFocusGroupState => {\n const parentGroup = inherit\n ? injectInheritedState(() => NgpRovingFocusGroupStateToken)?.()\n : null;\n\n if (parentGroup) {\n return parentGroup;\n }\n\n const directionality = inject(Directionality);\n const items = signal<NgpRovingFocusItemState[]>([]);\n const orientation = controlled(_orientation);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n function getSortedItems() {\n return items().sort((a, b) => {\n // sort the items by their position in the document\n return a.element.nativeElement.compareDocumentPosition(b.element.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group. This is the single source\n * of truth for the tab stop; items push to it via setActiveItem when they\n * become active (e.g. the selected tab), and roving navigation updates it too.\n */\n const activeItem = signal<string | null>(null);\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n function setActiveItem(id: string | null, origin: FocusOrigin = 'program'): void {\n activeItem.set(id);\n const item = items().find(i => i.id() === id) ?? null;\n\n if (item) {\n item.focus(origin);\n }\n }\n\n // set the tab stop without moving focus (see interface docs)\n function setTabStop(id: string | null): void {\n activeItem.set(id);\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = getSortedItems().find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...getSortedItems()].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n if (item) {\n setActiveItem(item.id(), origin);\n }\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activateNextItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the first item\n if (!currentActiveItem) {\n activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the next item that is not disabled\n const item = sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && wrap()) {\n activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n function activatePreviousItem(origin: FocusOrigin): void {\n const currentActiveItem = activeItem();\n\n // if there is no active item, activate the last item\n if (!currentActiveItem) {\n activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const sortedItems = getSortedItems();\n const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n // find the previous item that is not disabled\n const item =\n sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && wrap()) {\n activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n setActiveItem(item.id(), origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n */\n function onKeydown(event: KeyboardEvent): void {\n if (disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (orientation() === 'vertical') {\n event.preventDefault();\n activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activatePreviousItem('keyboard');\n } else {\n activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (orientation() === 'horizontal') {\n event.preventDefault();\n\n if (directionality.value === 'ltr') {\n activateNextItem('keyboard');\n } else {\n activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (homeEnd()) {\n event.preventDefault();\n activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (homeEnd()) {\n event.preventDefault();\n activateLastItem('keyboard');\n }\n break;\n }\n }\n\n function register(item: NgpRovingFocusItemState): void {\n items.update(items => [...items, item]);\n\n // seed the first non-disabled item as the tab stop; an active item (e.g. the\n // selected tab) overrides this by pushing to setActiveItem once it registers.\n if (item.disabled()) {\n return;\n }\n if (!activeItem()) {\n activeItem.set(item.id());\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n function unregister(item: NgpRovingFocusItemState): void {\n items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (activeItem() === item.id()) {\n // if the active item is unregistered, activate the first item\n activeItem.set(items()[0]?.id() ?? null);\n }\n }\n\n /**\n * Set the orientation of the roving focus group.\n * @param value The orientation value\n */\n function setOrientation(value: NgpOrientation): void {\n orientation.set(value);\n }\n\n return {\n orientation: orientation.asReadonly(),\n wrap,\n homeEnd,\n disabled,\n activeItem,\n setActiveItem,\n setTabStop,\n setOrientation,\n onKeydown,\n register,\n unregister,\n activateFirst: activateFirstItem,\n activateLast: activateLastItem,\n } satisfies NgpRovingFocusGroupState;\n },\n);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n /**\n * Whether we should inherit the focus group from the parent\n * @default true\n */\n inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n type: Type<NgpRovingFocusGroup>,\n { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n return {\n provide: NgpRovingFocusGroupToken,\n // Roving focus groups may be nested, in this case, the parent group should be used\n useFactory: () => {\n if (!inherit) {\n return inject(type, { self: true });\n }\n\n // If the parent group is not found, return the current group\n // This is useful for nested groups\n return (\n inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n inject(type, { self: true })\n );\n },\n };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { ngpRovingFocusGroup, provideRovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [\n provideRovingFocusGroup(NgpRovingFocusGroup),\n provideRovingFocusGroupState({ inherit: true }),\n ],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = input<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * The state of the roving focus group.\n */\n readonly state = ngpRovingFocusGroup({\n orientation: this.orientation,\n wrap: this.wrap,\n homeEnd: this.homeEnd,\n disabled: this.disabled,\n });\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n if (item) {\n this.state.setActiveItem(item.id(), origin);\n }\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { computed, effect, ElementRef, inject, signal, Signal, untracked } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, listener } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectRovingFocusGroupState } from '../roving-focus-group/roving-focus-group-state';\n\n/**\n * The state interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemState {\n /**\n * The unique id of the roving focus item.\n */\n readonly id: Signal<string>;\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n /**\n * The tabindex of the roving focus item.\n */\n readonly tabindex: Signal<number>;\n /**\n * The element reference of the roving focus item.\n */\n readonly element: ElementRef<HTMLElement>;\n /**\n * Focus the roving focus item.\n * @param origin The focus origin\n */\n focus(origin: FocusOrigin): void;\n}\n\n/**\n * The props interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemProps {\n /**\n * Whether the item is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\nexport const [\n NgpRovingFocusItemStateToken,\n ngpRovingFocusItem,\n injectRovingFocusItemState,\n provideRovingFocusItemState,\n] = createPrimitive(\n 'NgpRovingFocusItem',\n ({ disabled = signal(false) }: NgpRovingFocusItemProps) => {\n const element = injectElementRef();\n const group = injectRovingFocusGroupState();\n const focusMonitor = inject(FocusMonitor);\n\n // genertate a unique id for the roving focus item - this is not a DOM id but an internal identifier\n const id = uniqueId('ngp-roving-focus-item');\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n const tabindex = computed(() =>\n !group()?.disabled() && group()?.activeItem() === id ? 0 : -1,\n );\n\n // Setup host attribute bindings\n attrBinding(element, 'tabindex', () => tabindex().toString());\n\n // Setup keyboard event listener\n listener(element, 'keydown', (event: KeyboardEvent) => {\n if (disabled()) {\n return;\n }\n group()?.onKeydown(event);\n });\n\n // Setup click event listener\n listener(element, 'click', () => {\n if (disabled()) {\n return;\n }\n group()?.setActiveItem(id, 'mouse');\n });\n\n function focus(origin: FocusOrigin): void {\n focusMonitor.focusVia(element, origin);\n }\n\n const state: NgpRovingFocusItemState = {\n id: signal(id),\n disabled,\n tabindex,\n focus,\n element,\n };\n\n // Projected items may construct before the parent populates the shared group signal,\n // so register reactively once it becomes available.\n // See https://github.com/ng-primitives/ng-primitives/issues/735\n effect(onCleanup => {\n const groupState = group();\n if (!groupState) return;\n untracked(() => groupState.register(state));\n onCleanup(() => groupState.unregister(state));\n });\n\n return state satisfies NgpRovingFocusItemState;\n },\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input } from '@angular/core';\nimport { ngpRovingFocusItem, provideRovingFocusItemState } from './roving-focus-item-state';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n providers: [provideRovingFocusItemState()],\n})\nexport class NgpRovingFocusItem {\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n private readonly state = ngpRovingFocusItem({ disabled: this.disabled });\n\n /**\n * Expose the internal id of the roving focus item.\n * @internal\n */\n readonly id = computed(() => this.state.id());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAiGO,MAAM,CACX,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,GAAG,eAAe,CACjB,qBAAqB,EACrB,CAAC,EACC,WAAW,EAAE,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,E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AAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,4BAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,SAAA,EAFlB,CAAC,2BAA2B,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAE/B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,SAAS,EAAE,CAAC,2BAA2B,EAAE,CAAC;AAC3C,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search/search-state.ts","../../../../packages/ng-primitives/search/src/search-clear/search-clear.ts","../../../../packages/ng-primitives/search/src/search/search.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSearch } from './search';\n\n/**\n * The state token for the Search primitive.\n */\nexport const NgpSearchStateToken = createStateToken<NgpSearch>('Search');\n\n/**\n * Provides the Search state.\n */\nexport const provideSearchState = createStateProvider(NgpSearchStateToken);\n\n/**\n * Injects the Search state.\n */\nexport const injectSearchState = createStateInjector<NgpSearch>(NgpSearchStateToken);\n\n/**\n * The Search state registration function.\n */\nexport const searchState = createState(NgpSearchStateToken);\n","import { Directive, HostListener } from '@angular/core';\nimport { injectSearchState } from '../search/search-state';\n\n/**\n * The `NgpSearchClear` directive is can be added to a button to clear the search field on click.\n */\n@Directive({\n selector: '[ngpSearchClear]',\n exportAs: 'ngpSearchClear',\n host: {\n '[tabindex]': '-1',\n '[attr.data-empty]': 'search().empty() ? \"\" : null',\n },\n})\nexport class NgpSearchClear {\n /**\n * Access the Search instance.\n */\n protected readonly search = injectSearchState();\n\n /**\n * Clear the input field.\n */\n @HostListener('click')\n protected clear(): void {\n this.search().clear();\n }\n}\n","import { computed, DestroyRef, Directive, HostListener, inject, signal } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromEvent } from 'rxjs';\nimport { provideSearchState, searchState } from './search-state';\n\n/**\n * The `NgpSearch` directive is a container for the search field components.\n */\n@Directive({\n selector: '[ngpSearch]',\n exportAs: 'ngpSearch',\n providers: [provideSearchState()],\n host: {\n '[attr.data-empty]': 'empty() ? \"\" : null',\n },\n})\nexport class NgpSearch {\n /**\n * The destroy reference.\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The input field.\n */\n private readonly input = signal<HTMLInputElement | null>(null);\n\n /**\n * The value of the input.\n */\n private readonly value = signal<string>('');\n\n /**\n * Whether the input field is empty.\n * @internal\n */\n readonly empty = computed(() => this.value() === '');\n\n /**\n * The search field state.\n */\n protected readonly state = searchState<NgpSearch>(this);\n\n @HostListener('keydown.escape')\n clear(): void {\n const input = this.input();\n\n if (!input) {\n return;\n }\n\n input.value = '';\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n /**\n * Register the input field.\n * @param input The input field.\n * @internal\n */\n registerInput(input: HTMLInputElement): void {\n this.input.set(input);\n this.value.set(input.value);\n\n fromEvent(input, 'input')\n .pipe(safeTakeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.value.set(input.value));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY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hD;;AAEG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAA0B,IAAI,4EAAC;AAE9D;;AAEG;AACc,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAS,EAAE,4EAAC;AAE3C;;;AAGG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,4EAAC;AAEpD;;AAEG;AACgB,QAAA,IAAA,CAAA,KAAK,GAAG,WAAW,CAAY,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search/search-state.ts","../../../../packages/ng-primitives/search/src/search-clear/search-clear.ts","../../../../packages/ng-primitives/search/src/search/search.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpSearch } from './search';\n\n/**\n * The state token for the Search primitive.\n */\nexport const NgpSearchStateToken = createStateToken<NgpSearch>('Search');\n\n/**\n * Provides the Search state.\n */\nexport const provideSearchState = createStateProvider(NgpSearchStateToken);\n\n/**\n * Injects the Search state.\n */\nexport const injectSearchState = createStateInjector<NgpSearch>(NgpSearchStateToken);\n\n/**\n * The Search state registration function.\n */\nexport const searchState = createState(NgpSearchStateToken);\n","import { Directive, HostListener } from '@angular/core';\nimport { injectSearchState } from '../search/search-state';\n\n/**\n * The `NgpSearchClear` directive is can be added to a button to clear the search field on click.\n */\n@Directive({\n selector: '[ngpSearchClear]',\n exportAs: 'ngpSearchClear',\n host: {\n '[tabindex]': '-1',\n '[attr.data-empty]': 'search().empty() ? \"\" : null',\n },\n})\nexport class NgpSearchClear {\n /**\n * Access the Search instance.\n */\n protected readonly search = injectSearchState();\n\n /**\n * Clear the input field.\n */\n @HostListener('click')\n protected clear(): void {\n this.search().clear();\n }\n}\n","import { computed, DestroyRef, Directive, HostListener, inject, signal } from '@angular/core';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { fromEvent } from 'rxjs';\nimport { provideSearchState, searchState } from './search-state';\n\n/**\n * The `NgpSearch` directive is a container for the search field components.\n */\n@Directive({\n selector: '[ngpSearch]',\n exportAs: 'ngpSearch',\n providers: [provideSearchState()],\n host: {\n '[attr.data-empty]': 'empty() ? \"\" : null',\n },\n})\nexport class NgpSearch {\n /**\n * The destroy reference.\n */\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The input field.\n */\n private readonly input = signal<HTMLInputElement | null>(null);\n\n /**\n * The value of the input.\n */\n private readonly value = signal<string>('');\n\n /**\n * Whether the input field is empty.\n * @internal\n */\n readonly empty = computed(() => this.value() === '');\n\n /**\n * The search field state.\n */\n protected readonly state = searchState<NgpSearch>(this);\n\n @HostListener('keydown.escape')\n clear(): void {\n const input = this.input();\n\n // a disabled input must not be clearable (via Escape or the clear button)\n if (!input || input.disabled) {\n return;\n }\n\n input.value = '';\n input.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n /**\n * Register the input field.\n * @param input The input field.\n * @internal\n */\n registerInput(input: HTMLInputElement): void {\n this.input.set(input);\n this.value.set(input.value);\n\n fromEvent(input, 'input')\n .pipe(safeTakeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.value.set(input.value));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAQA;;AAEG;AACI,MAAM,mBAAmB,GAAG,gBAAgB,CAAY,QAAQ,CAAC;AAExE;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAC,mBAAmB;AAEzE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAY,mBAAmB;AAEnF;;AAEG;AACI,MAAM,WAAW,GAAG,WAAW,CAAC,mBAAmB,CAAC;;ACvB3D;;AAEG;MASU,cAAc,CAAA;AAR3B,IAAA,WAAA,GAAA;AASE;;AAEG;QACgB,IAAA,CAAA,MAAM,GAAG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A,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;;sBA4BE,YAAY;uBAAC,gBAAgB;;;AC3ChC;;AAEG;;;;"}
|
|
@@ -43,13 +43,15 @@ const [NgpSliderStateToken, ngpSlider, injectSliderState, provideSliderState] =
|
|
|
43
43
|
focusMonitor.focusVia(el, origin, { preventScroll: true });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function setValue(newValue) {
|
|
46
|
+
function setValue(newValue, options) {
|
|
47
47
|
const clamped = Math.min(max(), Math.max(min(), newValue));
|
|
48
48
|
const stepped = Math.round((clamped - min()) / step()) * step() + min();
|
|
49
49
|
const finalValue = Math.min(max(), Math.max(min(), stepped));
|
|
50
50
|
value.set(finalValue);
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (options?.emit !== false) {
|
|
52
|
+
onValueChange?.(finalValue);
|
|
53
|
+
valueChange.emit(finalValue);
|
|
54
|
+
}
|
|
53
55
|
}
|
|
54
56
|
function setDisabled(isDisabled) {
|
|
55
57
|
disabled.set(isDisabled);
|
|
@@ -118,7 +120,9 @@ const [NgpSliderThumbStateToken, ngpSliderThumb, injectSliderThumbState, provide
|
|
|
118
120
|
let dragging = false;
|
|
119
121
|
let activePointerId = null;
|
|
120
122
|
let cleanupDocumentListeners = [];
|
|
121
|
-
|
|
123
|
+
// aria-valuenow must stay within [min, max] even if the bound value is out of
|
|
124
|
+
// range, so it never disagrees with the thumb position (ARIA slider pattern)
|
|
125
|
+
const ariaValueNow = computed(() => Math.min(slider().max(), Math.max(slider().min(), slider().value())), ...(ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []));
|
|
122
126
|
const tabindex = computed(() => (slider().disabled() ? -1 : 0), ...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
123
127
|
// Host bindings
|
|
124
128
|
attrBinding(elementRef, 'role', 'slider');
|
|
@@ -195,6 +199,9 @@ const [NgpSliderThumbStateToken, ngpSliderThumb, injectSliderThumbState, provide
|
|
|
195
199
|
}
|
|
196
200
|
// Keyboard interactions
|
|
197
201
|
listener(elementRef, 'keydown', (event) => {
|
|
202
|
+
if (slider().disabled()) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
198
205
|
const multiplier = event.shiftKey ? 10 : 1;
|
|
199
206
|
const step = slider().step() * multiplier;
|
|
200
207
|
const currentValue = slider().value();
|
|
@@ -219,10 +226,12 @@ const [NgpSliderThumbStateToken, ngpSliderThumb, injectSliderThumbState, provide
|
|
|
219
226
|
newValue = Math.min(currentValue + step, slider().max());
|
|
220
227
|
break;
|
|
221
228
|
case 'Home':
|
|
222
|
-
|
|
229
|
+
// Home is value-based (first allowed value = minimum), not visual
|
|
230
|
+
newValue = slider().min();
|
|
223
231
|
break;
|
|
224
232
|
case 'End':
|
|
225
|
-
|
|
233
|
+
// End is value-based (last allowed value = maximum), not visual
|
|
234
|
+
newValue = slider().max();
|
|
226
235
|
break;
|
|
227
236
|
default:
|
|
228
237
|
return;
|
|
@@ -397,8 +406,8 @@ class NgpSlider {
|
|
|
397
406
|
/**
|
|
398
407
|
* Set the value of the slider.
|
|
399
408
|
*/
|
|
400
|
-
setValue(value) {
|
|
401
|
-
this.state.setValue(value);
|
|
409
|
+
setValue(value, options) {
|
|
410
|
+
this.state.setValue(value, options);
|
|
402
411
|
}
|
|
403
412
|
/**
|
|
404
413
|
* Set the disabled state.
|
|
@@ -454,19 +463,23 @@ const [NgpRangeSliderStateToken, ngpRangeSlider, injectRangeSliderState, provide
|
|
|
454
463
|
attrBinding(element, 'id', id);
|
|
455
464
|
dataBinding(element, 'data-orientation', orientation);
|
|
456
465
|
dataBinding(element, 'data-disabled', status().disabled);
|
|
457
|
-
function setLowValue(value) {
|
|
466
|
+
function setLowValue(value, options) {
|
|
458
467
|
const clampedValue = Math.max(min(), Math.min(value, high()));
|
|
459
468
|
const steppedValue = Math.round((clampedValue - min()) / step()) * step() + min();
|
|
460
469
|
low.set(steppedValue);
|
|
461
|
-
|
|
462
|
-
|
|
470
|
+
if (options?.emit !== false) {
|
|
471
|
+
onLowChange?.(steppedValue);
|
|
472
|
+
lowChange.emit(steppedValue);
|
|
473
|
+
}
|
|
463
474
|
}
|
|
464
|
-
function setHighValue(value) {
|
|
475
|
+
function setHighValue(value, options) {
|
|
465
476
|
const clampedValue = Math.min(max(), Math.max(value, low()));
|
|
466
477
|
const steppedValue = Math.round((clampedValue - min()) / step()) * step() + min();
|
|
467
478
|
high.set(steppedValue);
|
|
468
|
-
|
|
469
|
-
|
|
479
|
+
if (options?.emit !== false) {
|
|
480
|
+
onHighChange?.(steppedValue);
|
|
481
|
+
highChange.emit(steppedValue);
|
|
482
|
+
}
|
|
470
483
|
}
|
|
471
484
|
function getClosestThumb(percentage) {
|
|
472
485
|
const value = min() + (max() - min()) * (percentage / 100);
|
|
@@ -672,6 +685,9 @@ const [NgpRangeSliderThumbStateToken, ngpRangeSliderThumb, injectRangeSliderThum
|
|
|
672
685
|
}
|
|
673
686
|
}
|
|
674
687
|
function handleKeydown(event) {
|
|
688
|
+
if (rangeSlider().disabled()) {
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
675
691
|
const multiplier = event.shiftKey ? 10 : 1;
|
|
676
692
|
const currentValue = value();
|
|
677
693
|
const step = rangeSlider().step() * multiplier;
|
|
@@ -680,26 +696,30 @@ const [NgpRangeSliderThumbStateToken, ngpRangeSliderThumb, injectRangeSliderThum
|
|
|
680
696
|
let newValue;
|
|
681
697
|
switch (event.key) {
|
|
682
698
|
case 'ArrowLeft':
|
|
699
|
+
// in RTL the max end is on the left, so ArrowLeft increases the value
|
|
683
700
|
newValue = isRTL
|
|
684
|
-
? Math.min(currentValue
|
|
701
|
+
? Math.min(currentValue + step, rangeSlider().max())
|
|
685
702
|
: Math.max(currentValue - step, rangeSlider().min());
|
|
686
703
|
break;
|
|
687
704
|
case 'ArrowDown':
|
|
688
705
|
newValue = Math.max(currentValue - step, rangeSlider().min());
|
|
689
706
|
break;
|
|
690
707
|
case 'ArrowRight':
|
|
708
|
+
// in RTL the min end is on the right, so ArrowRight decreases the value
|
|
691
709
|
newValue = isRTL
|
|
692
|
-
? Math.max(currentValue
|
|
710
|
+
? Math.max(currentValue - step, rangeSlider().min())
|
|
693
711
|
: Math.min(currentValue + step, rangeSlider().max());
|
|
694
712
|
break;
|
|
695
713
|
case 'ArrowUp':
|
|
696
714
|
newValue = Math.min(currentValue + step, rangeSlider().max());
|
|
697
715
|
break;
|
|
698
716
|
case 'Home':
|
|
699
|
-
|
|
717
|
+
// Home is value-based (first allowed value = minimum), not visual
|
|
718
|
+
newValue = rangeSlider().min();
|
|
700
719
|
break;
|
|
701
720
|
case 'End':
|
|
702
|
-
|
|
721
|
+
// End is value-based (last allowed value = maximum), not visual
|
|
722
|
+
newValue = rangeSlider().max();
|
|
703
723
|
break;
|
|
704
724
|
default:
|
|
705
725
|
return;
|