ng-primitives 0.48.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/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-button/combobox-button.d.ts +1 -44
- package/combobox/combobox-dropdown/combobox-dropdown.d.ts +1 -44
- package/combobox/combobox-input/combobox-input.d.ts +1 -45
- 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.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.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 +8 -2
- package/fesm2022/ng-primitives-input.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-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 +8 -2
- 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/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/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/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 -1
- 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-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,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BAAyB,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 => pan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jC,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;;;;"}
|
|
@@ -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
|
/**
|
|
@@ -23,6 +24,10 @@ const textareaState = createState(NgpTextareaStateToken);
|
|
|
23
24
|
|
|
24
25
|
class NgpTextarea {
|
|
25
26
|
constructor() {
|
|
27
|
+
/**
|
|
28
|
+
* The id of the textarea. If not provided, a unique id will be generated.
|
|
29
|
+
*/
|
|
30
|
+
this.id = input(uniqueId('ngp-textarea'));
|
|
26
31
|
/**
|
|
27
32
|
* Whether the element is disabled.
|
|
28
33
|
*/
|
|
@@ -39,10 +44,10 @@ class NgpTextarea {
|
|
|
39
44
|
focus: true,
|
|
40
45
|
disabled: this.state.disabled,
|
|
41
46
|
});
|
|
42
|
-
setupFormControl({ disabled: this.state.disabled });
|
|
47
|
+
setupFormControl({ id: this.state.id, disabled: this.state.disabled });
|
|
43
48
|
}
|
|
44
49
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpTextarea, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
45
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpTextarea, isStandalone: true, selector: "[ngpTextarea]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideTextareaState()], exportAs: ["ngpTextarea"], ngImport: i0 }); }
|
|
50
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpTextarea, isStandalone: true, selector: "[ngpTextarea]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.disabled": "disabled() ? \"\" : null" } }, providers: [provideTextareaState()], exportAs: ["ngpTextarea"], ngImport: i0 }); }
|
|
46
51
|
}
|
|
47
52
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpTextarea, decorators: [{
|
|
48
53
|
type: Directive,
|
|
@@ -50,6 +55,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
50
55
|
selector: '[ngpTextarea]',
|
|
51
56
|
exportAs: 'ngpTextarea',
|
|
52
57
|
providers: [provideTextareaState()],
|
|
58
|
+
host: {
|
|
59
|
+
'[id]': 'id()',
|
|
60
|
+
'[attr.disabled]': 'disabled() ? "" : null',
|
|
61
|
+
},
|
|
53
62
|
}]
|
|
54
63
|
}], ctorParameters: () => [] });
|
|
55
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-textarea.mjs","sources":["../../../../packages/ng-primitives/textarea/src/textarea/textarea-state.ts","../../../../packages/ng-primitives/textarea/src/textarea/textarea.ts","../../../../packages/ng-primitives/textarea/src/ng-primitives-textarea.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpTextarea } from './textarea';\n\n/**\n * The state token for the Textarea primitive.\n */\nexport const NgpTextareaStateToken = createStateToken<NgpTextarea>('Textarea');\n\n/**\n * Provides the Textarea state.\n */\nexport const provideTextareaState = createStateProvider(NgpTextareaStateToken);\n\n/**\n * Injects the Textarea state.\n */\nexport const injectTextareaState = createStateInjector(NgpTextareaStateToken);\n\n/**\n * The Textarea state registration function.\n */\nexport const textareaState = createState(NgpTextareaStateToken);\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 { provideTextareaState, textareaState } from './textarea-state';\n\n@Directive({\n selector: '[ngpTextarea]',\n exportAs: 'ngpTextarea',\n providers: [provideTextareaState()],\n})\nexport class NgpTextarea {\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The state of the textarea.\n */\n protected readonly state = textareaState<NgpTextarea>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: 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-textarea.mjs","sources":["../../../../packages/ng-primitives/textarea/src/textarea/textarea-state.ts","../../../../packages/ng-primitives/textarea/src/textarea/textarea.ts","../../../../packages/ng-primitives/textarea/src/ng-primitives-textarea.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpTextarea } from './textarea';\n\n/**\n * The state token for the Textarea primitive.\n */\nexport const NgpTextareaStateToken = createStateToken<NgpTextarea>('Textarea');\n\n/**\n * Provides the Textarea state.\n */\nexport const provideTextareaState = createStateProvider(NgpTextareaStateToken);\n\n/**\n * Injects the Textarea state.\n */\nexport const injectTextareaState = createStateInjector<NgpTextarea>(NgpTextareaStateToken);\n\n/**\n * The Textarea state registration function.\n */\nexport const textareaState = createState(NgpTextareaStateToken);\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 { provideTextareaState, textareaState } from './textarea-state';\n\n@Directive({\n selector: '[ngpTextarea]',\n exportAs: 'ngpTextarea',\n providers: [provideTextareaState()],\n host: {\n '[id]': 'id()',\n '[attr.disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpTextarea {\n /**\n * The id of the textarea. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-textarea'));\n\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The state of the textarea.\n */\n protected readonly state = textareaState<NgpTextarea>(this);\n\n constructor() {\n setupInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\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,qBAAqB,GAAG,gBAAgB,CAAc,UAAU,CAAC;AAE9E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,qBAAqB;AAE7E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAc,qBAAqB;AAEzF;;AAEG;AACI,MAAM,aAAa,GAAG,WAAW,CAAC,qBAAqB,CAAC;;MCVlD,WAAW,CAAA;AAkBtB,IAAA,WAAA,GAAA;AAjBA;;AAEG;QACM,IAAE,CAAA,EAAA,GAAG,KAAK,CAAS,QAAQ,CAAC,cAAc,CAAC,CAAC;AAErD;;AAEG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;AACgB,QAAA,IAAA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A,CAAA;kBATvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;AACnC,oBAAA,IAAI,EAAE;AACJ,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,iBAAiB,EAAE,wBAAwB;AAC5C,qBAAA;AACF,iBAAA;;;ACfD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-toggle-group.mjs","sources":["../../../../packages/ng-primitives/toggle-group/src/config/toggle-group-config.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group.ts","../../../../packages/ng-primitives/toggle-group/src/ng-primitives-toggle-group.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport interface NgpToggleGroupConfig {\n /**\n * The orientation of the toggle group.\n * @default 'horizontal'\n */\n orientation: NgpOrientation;\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n * @default 'single'\n */\n type: 'single' | 'multiple';\n}\n\nexport const defaultToggleGroupConfig: NgpToggleGroupConfig = {\n orientation: 'horizontal',\n type: 'single',\n};\n\nexport const NgpToggleGroupConfigToken = new InjectionToken<NgpToggleGroupConfig>(\n 'NgpToggleGroupConfigToken',\n);\n\n/**\n * Provide the default ToggleGroup configuration\n * @param config The ToggleGroup configuration\n * @returns The provider\n */\nexport function provideToggleGroupConfig(config: Partial<NgpToggleGroupConfig>): Provider[] {\n return [\n {\n provide: NgpToggleGroupConfigToken,\n useValue: { ...defaultToggleGroupConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the ToggleGroup configuration\n * @returns The global ToggleGroup configuration\n */\nexport function injectToggleGroupConfig(): NgpToggleGroupConfig {\n return inject(NgpToggleGroupConfigToken, { optional: true }) ?? defaultToggleGroupConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroup } from './toggle-group';\n\n/**\n * The state token for the ToggleGroup primitive.\n */\nexport const NgpToggleGroupStateToken = createStateToken<NgpToggleGroup>('ToggleGroup');\n\n/**\n * Provides the ToggleGroup state.\n */\nexport const provideToggleGroupState = createStateProvider(NgpToggleGroupStateToken);\n\n/**\n * Injects the ToggleGroup state.\n */\nexport const injectToggleGroupState = createStateInjector(NgpToggleGroupStateToken);\n\n/**\n * The ToggleGroup state registration function.\n */\nexport const toggleGroupState = createState(NgpToggleGroupStateToken);\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroupItem } from './toggle-group-item';\n\n/**\n * The state token for the ToggleGroupItem primitive.\n */\nexport const NgpToggleGroupItemStateToken = createStateToken<NgpToggleGroupItem>('ToggleGroupItem');\n\n/**\n * Provides the ToggleGroupItem state.\n */\nexport const provideToggleGroupItemState = createStateProvider(NgpToggleGroupItemStateToken);\n\n/**\n * Injects the ToggleGroupItem state.\n */\nexport const injectToggleGroupItemState = createStateInjector(NgpToggleGroupItemStateToken);\n\n/**\n * The ToggleGroupItem state registration function.\n */\nexport const toggleGroupItemState = createState(NgpToggleGroupItemStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, OnInit } from '@angular/core';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupState } from '../toggle-group/toggle-group-state';\nimport { provideToggleGroupItemState, toggleGroupItemState } from './toggle-group-item-state';\n\n@Directive({\n selector: '[ngpToggleGroupItem]',\n exportAs: 'ngpToggleGroupItem',\n providers: [provideToggleGroupItemState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusItem,\n inputs: ['ngpRovingFocusItemDisabled: ngpToggleGroupItemDisabled'],\n },\n ],\n host: {\n role: 'radio',\n '[attr.aria-checked]': 'selected()',\n '[attr.data-selected]': 'selected() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(click)': 'toggle()',\n },\n})\nexport class NgpToggleGroupItem implements OnInit {\n /**\n * Access the group that the item belongs to.\n */\n private readonly toggleGroup = injectToggleGroupState();\n\n /**\n * The value of the item.\n */\n readonly value = input<string>(undefined, {\n alias: 'ngpToggleGroupItemValue',\n });\n\n /**\n * Whether the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the item is selected.\n */\n protected readonly selected = computed(() => this.toggleGroup().isSelected(this.state.value()!));\n\n /**\n * The state of the item.\n */\n protected readonly state = toggleGroupItemState<NgpToggleGroupItem>(this);\n\n ngOnInit(): void {\n // we can't use a required input for value as it is used in a computed property before the input is set\n if (this.state.value() === undefined) {\n throw new Error('The value input is required for the toggle group item.');\n }\n }\n\n /**\n * Toggle the item.\n */\n protected toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.toggleGroup().toggle(this.state.value()!);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { syncState } from 'ng-primitives/internal';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupConfig } from '../config/toggle-group-config';\nimport { provideToggleGroupState, toggleGroupState } from './toggle-group-state';\n\n@Directive({\n selector: '[ngpToggleGroup]',\n exportAs: 'ngpToggleGroup',\n providers: [provideToggleGroupState()],\n hostDirectives: [NgpRovingFocusGroup],\n host: {\n role: 'group',\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-type]': 'state.type()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpToggleGroup {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * Access the global toggle group configuration.\n */\n private readonly config = injectToggleGroupConfig();\n\n /**\n * The orientation of the toggle group.\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpToggleGroupOrientation',\n });\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n */\n readonly type = input<'single' | 'multiple'>(this.config.type, { alias: 'ngpToggleGroupType' });\n\n /**\n * The selected value(s) of the toggle group.\n */\n readonly value = input<string[]>([], { alias: 'ngpToggleGroupValue' });\n\n /**\n * Emits when the value of the toggle group changes.\n */\n readonly valueChange = output<string[]>({ alias: 'ngpToggleGroupValueChange' });\n\n /**\n * Whether the toggle group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the toggle group.\n */\n protected readonly state = toggleGroupState<NgpToggleGroup>(this);\n\n constructor() {\n // the roving focus group defaults to vertical orientation whereas\n // the default for the toggle group may be different if provided via global config\n syncState(this.state.orientation, this.rovingFocusGroupState().orientation);\n }\n\n /**\n * Select a value in the toggle group.\n */\n private select(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n if (this.state.type() === 'single') {\n this.state.value.set([value]);\n } else {\n this.state.value.set([...this.state.value(), value]);\n }\n\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * De-select a value in the toggle group.\n */\n private deselect(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.value.set(this.state.value().filter(v => v !== value));\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * Check if a value is selected in the toggle group.\n * @internal\n */\n isSelected(value: string): boolean {\n return this.state.value()?.includes(value) ?? false;\n }\n\n /**\n * Toggle a value in the toggle group.\n * @internal\n */\n toggle(value: string): void {\n if (this.isSelected(value)) {\n this.deselect(value);\n } else {\n this.select(value);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAiBO,MAAM,wBAAwB,GAAyB;AAC5D,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,IAAI,EAAE,QAAQ;CACf;AAEM,MAAM,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B,CAC5B;AAED;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAAqC,EAAA;IAC5E,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,yBAAyB;AAClC,YAAA,QAAQ,EAAE,EAAE,GAAG,wBAAwB,EAAE,GAAG,MAAM,EAAE;AACrD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,uBAAuB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,wBAAwB;AAC1F;;ACtCA;;AAEG;AACI,MAAM,wBAAwB,GAAG,gBAAgB,CAAiB,aAAa,CAAC;AAEvF;;AAEG;MACU,uBAAuB,GAAG,mBAAmB,CAAC,wBAAwB;AAEnF;;AAEG;MACU,sBAAsB,GAAG,mBAAmB,CAAC,wBAAwB;AAElF;;AAEG;AACI,MAAM,gBAAgB,GAAG,WAAW,CAAC,wBAAwB,CAAC;;AClBrE;;AAEG;AACI,MAAM,4BAA4B,GAAG,gBAAgB,CAAqB,iBAAiB,CAAC;AAEnG;;AAEG;MACU,2BAA2B,GAAG,mBAAmB,CAAC,4BAA4B;AAE3F;;AAEG;MACU,0BAA0B,GAAG,mBAAmB,CAAC,4BAA4B;AAE1F;;AAEG;AACI,MAAM,oBAAoB,GAAG,WAAW,CAAC,4BAA4B,CAAC;;MCDhE,kBAAkB,CAAA;AAnB/B,IAAA,WAAA,GAAA;AAoBE;;AAEG;QACc,IAAW,CAAA,WAAA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AAc,EAAA,UAAA,EAAA,CAAA;kBAZ1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,SAAS,EAAE,CAAC,uBAAuB,EAAE,CAAC;oBACtC,cAAc,EAAE,CAAC,mBAAmB,CAAC;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,yBAAyB,EAAE,qBAAqB;AAChD,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,sBAAsB,EAAE,8BAA8B;AACvD,qBAAA;AACF,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-toggle-group.mjs","sources":["../../../../packages/ng-primitives/toggle-group/src/config/toggle-group-config.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item-state.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group-item/toggle-group-item.ts","../../../../packages/ng-primitives/toggle-group/src/toggle-group/toggle-group.ts","../../../../packages/ng-primitives/toggle-group/src/ng-primitives-toggle-group.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport interface NgpToggleGroupConfig {\n /**\n * The orientation of the toggle group.\n * @default 'horizontal'\n */\n orientation: NgpOrientation;\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n * @default 'single'\n */\n type: 'single' | 'multiple';\n}\n\nexport const defaultToggleGroupConfig: NgpToggleGroupConfig = {\n orientation: 'horizontal',\n type: 'single',\n};\n\nexport const NgpToggleGroupConfigToken = new InjectionToken<NgpToggleGroupConfig>(\n 'NgpToggleGroupConfigToken',\n);\n\n/**\n * Provide the default ToggleGroup configuration\n * @param config The ToggleGroup configuration\n * @returns The provider\n */\nexport function provideToggleGroupConfig(config: Partial<NgpToggleGroupConfig>): Provider[] {\n return [\n {\n provide: NgpToggleGroupConfigToken,\n useValue: { ...defaultToggleGroupConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the ToggleGroup configuration\n * @returns The global ToggleGroup configuration\n */\nexport function injectToggleGroupConfig(): NgpToggleGroupConfig {\n return inject(NgpToggleGroupConfigToken, { optional: true }) ?? defaultToggleGroupConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroup } from './toggle-group';\n\n/**\n * The state token for the ToggleGroup primitive.\n */\nexport const NgpToggleGroupStateToken = createStateToken<NgpToggleGroup>('ToggleGroup');\n\n/**\n * Provides the ToggleGroup state.\n */\nexport const provideToggleGroupState = createStateProvider(NgpToggleGroupStateToken);\n\n/**\n * Injects the ToggleGroup state.\n */\nexport const injectToggleGroupState = createStateInjector<NgpToggleGroup>(NgpToggleGroupStateToken);\n\n/**\n * The ToggleGroup state registration function.\n */\nexport const toggleGroupState = createState(NgpToggleGroupStateToken);\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggleGroupItem } from './toggle-group-item';\n\n/**\n * The state token for the ToggleGroupItem primitive.\n */\nexport const NgpToggleGroupItemStateToken = createStateToken<NgpToggleGroupItem>('ToggleGroupItem');\n\n/**\n * Provides the ToggleGroupItem state.\n */\nexport const provideToggleGroupItemState = createStateProvider(NgpToggleGroupItemStateToken);\n\n/**\n * Injects the ToggleGroupItem state.\n */\nexport const injectToggleGroupItemState = createStateInjector<NgpToggleGroupItem>(\n NgpToggleGroupItemStateToken,\n);\n\n/**\n * The ToggleGroupItem state registration function.\n */\nexport const toggleGroupItemState = createState(NgpToggleGroupItemStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, OnInit } from '@angular/core';\nimport { NgpRovingFocusItem } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupState } from '../toggle-group/toggle-group-state';\nimport { provideToggleGroupItemState, toggleGroupItemState } from './toggle-group-item-state';\n\n@Directive({\n selector: '[ngpToggleGroupItem]',\n exportAs: 'ngpToggleGroupItem',\n providers: [provideToggleGroupItemState()],\n hostDirectives: [\n {\n directive: NgpRovingFocusItem,\n inputs: ['ngpRovingFocusItemDisabled: ngpToggleGroupItemDisabled'],\n },\n ],\n host: {\n role: 'radio',\n '[attr.aria-checked]': 'selected()',\n '[attr.data-selected]': 'selected() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(click)': 'toggle()',\n },\n})\nexport class NgpToggleGroupItem implements OnInit {\n /**\n * Access the group that the item belongs to.\n */\n private readonly toggleGroup = injectToggleGroupState();\n\n /**\n * The value of the item.\n */\n readonly value = input<string>(undefined, {\n alias: 'ngpToggleGroupItemValue',\n });\n\n /**\n * Whether the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Whether the item is selected.\n */\n protected readonly selected = computed(() => this.toggleGroup().isSelected(this.state.value()!));\n\n /**\n * The state of the item.\n */\n protected readonly state = toggleGroupItemState<NgpToggleGroupItem>(this);\n\n ngOnInit(): void {\n // we can't use a required input for value as it is used in a computed property before the input is set\n if (this.state.value() === undefined) {\n throw new Error('The value input is required for the toggle group item.');\n }\n }\n\n /**\n * Toggle the item.\n */\n protected toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.toggleGroup().toggle(this.state.value()!);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { syncState } from 'ng-primitives/internal';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { injectToggleGroupConfig } from '../config/toggle-group-config';\nimport { provideToggleGroupState, toggleGroupState } from './toggle-group-state';\n\n@Directive({\n selector: '[ngpToggleGroup]',\n exportAs: 'ngpToggleGroup',\n providers: [provideToggleGroupState()],\n hostDirectives: [NgpRovingFocusGroup],\n host: {\n role: 'group',\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-type]': 'state.type()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpToggleGroup {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroupState = injectRovingFocusGroupState();\n\n /**\n * Access the global toggle group configuration.\n */\n private readonly config = injectToggleGroupConfig();\n\n /**\n * The orientation of the toggle group.\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpToggleGroupOrientation',\n });\n\n /**\n * The type of the toggle group, whether only one item can be selected or multiple.\n */\n readonly type = input<'single' | 'multiple'>(this.config.type, { alias: 'ngpToggleGroupType' });\n\n /**\n * The selected value(s) of the toggle group.\n */\n readonly value = input<string[]>([], { alias: 'ngpToggleGroupValue' });\n\n /**\n * Emits when the value of the toggle group changes.\n */\n readonly valueChange = output<string[]>({ alias: 'ngpToggleGroupValueChange' });\n\n /**\n * Whether the toggle group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the toggle group.\n */\n protected readonly state = toggleGroupState<NgpToggleGroup>(this);\n\n constructor() {\n // the roving focus group defaults to vertical orientation whereas\n // the default for the toggle group may be different if provided via global config\n syncState(this.state.orientation, this.rovingFocusGroupState().orientation);\n }\n\n /**\n * Select a value in the toggle group.\n */\n private select(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n if (this.state.type() === 'single') {\n this.state.value.set([value]);\n } else {\n this.state.value.set([...this.state.value(), value]);\n }\n\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * De-select a value in the toggle group.\n */\n private deselect(value: string): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.value.set(this.state.value().filter(v => v !== value));\n this.valueChange.emit(this.state.value());\n }\n\n /**\n * Check if a value is selected in the toggle group.\n * @internal\n */\n isSelected(value: string): boolean {\n return this.state.value()?.includes(value) ?? false;\n }\n\n /**\n * Toggle a value in the toggle group.\n * @internal\n */\n toggle(value: string): void {\n if (this.isSelected(value)) {\n this.deselect(value);\n } else {\n this.select(value);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAiBO,MAAM,wBAAwB,GAAyB;AAC5D,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,IAAI,EAAE,QAAQ;CACf;AAEM,MAAM,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B,CAC5B;AAED;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAAqC,EAAA;IAC5E,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,yBAAyB;AAClC,YAAA,QAAQ,EAAE,EAAE,GAAG,wBAAwB,EAAE,GAAG,MAAM,EAAE;AACrD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,uBAAuB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,wBAAwB;AAC1F;;ACtCA;;AAEG;AACI,MAAM,wBAAwB,GAAG,gBAAgB,CAAiB,aAAa,CAAC;AAEvF;;AAEG;MACU,uBAAuB,GAAG,mBAAmB,CAAC,wBAAwB;AAEnF;;AAEG;MACU,sBAAsB,GAAG,mBAAmB,CAAiB,wBAAwB;AAElG;;AAEG;AACI,MAAM,gBAAgB,GAAG,WAAW,CAAC,wBAAwB,CAAC;;AClBrE;;AAEG;AACI,MAAM,4BAA4B,GAAG,gBAAgB,CAAqB,iBAAiB,CAAC;AAEnG;;AAEG;MACU,2BAA2B,GAAG,mBAAmB,CAAC,4BAA4B;AAE3F;;AAEG;MACU,0BAA0B,GAAG,mBAAmB,CAC3D,4BAA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AA,EAAA,CAAA,gBAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAS3B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAZ1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,SAAS,EAAE,CAAC,uBAAuB,EAAE,CAAC;oBACtC,cAAc,EAAE,CAAC,mBAAmB,CAAC;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,OAAO;AACb,wBAAA,yBAAyB,EAAE,qBAAqB;AAChD,wBAAA,kBAAkB,EAAE,cAAc;AAClC,wBAAA,sBAAsB,EAAE,8BAA8B;AACvD,qBAAA;AACF,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-toggle.mjs","sources":["../../../../packages/ng-primitives/toggle/src/toggle/toggle-state.ts","../../../../packages/ng-primitives/toggle/src/toggle/toggle.ts","../../../../packages/ng-primitives/toggle/src/ng-primitives-toggle.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggle } from './toggle';\n\n/**\n * The state token for the Toggle primitive.\n */\nexport const NgpToggleStateToken = createStateToken<NgpToggle>('Toggle');\n\n/**\n * Provides the Toggle state.\n */\nexport const provideToggleState = createStateProvider(NgpToggleStateToken);\n\n/**\n * Injects the Toggle state.\n */\nexport const injectToggleState = createStateInjector(NgpToggleStateToken);\n\n/**\n * The Toggle state registration function.\n */\nexport const toggleState = createState(NgpToggleStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n booleanAttribute,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { provideToggleState, toggleState } from './toggle-state';\n\n/**\n * Apply the `ngpToggle` directive to an element to manage the toggle state. This must be applied to a `button` element.\n */\n@Directive({\n selector: '[ngpToggle]',\n exportAs: 'ngpToggle',\n providers: [provideToggleState()],\n host: {\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-pressed]': 'state.selected()',\n '[attr.data-selected]': 'state.selected() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpToggle {\n /**\n * Access the element.\n */\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Whether the toggle is selected.\n * @default false\n */\n readonly selected = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleSelected',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the selected state changes.\n */\n readonly selectedChange = output<boolean>({\n alias: 'ngpToggleSelectedChange',\n });\n\n /**\n * Whether the toggle is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the element is a button.\n */\n protected isButton = this.element.nativeElement.tagName === 'BUTTON';\n\n /**\n * The state for the toggle primitive.\n * @internal\n */\n protected readonly state = toggleState<NgpToggle>(this);\n\n /**\n * Toggle the selected state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.selected.set(!this.state.selected());\n this.selectedChange.emit(this.state.selected());\n }\n\n /**\n * If the element is not a button or a link the space key should toggle the selected state.\n */\n @HostListener('keydown.space', ['$event'])\n protected onKeyDown(event: KeyboardEvent): void {\n if (!this.isButton && this.element.nativeElement.tagName !== 'A') {\n event.preventDefault();\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,
|
|
1
|
+
{"version":3,"file":"ng-primitives-toggle.mjs","sources":["../../../../packages/ng-primitives/toggle/src/toggle/toggle-state.ts","../../../../packages/ng-primitives/toggle/src/toggle/toggle.ts","../../../../packages/ng-primitives/toggle/src/ng-primitives-toggle.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToggle } from './toggle';\n\n/**\n * The state token for the Toggle primitive.\n */\nexport const NgpToggleStateToken = createStateToken<NgpToggle>('Toggle');\n\n/**\n * Provides the Toggle state.\n */\nexport const provideToggleState = createStateProvider(NgpToggleStateToken);\n\n/**\n * Injects the Toggle state.\n */\nexport const injectToggleState = createStateInjector<NgpToggle>(NgpToggleStateToken);\n\n/**\n * The Toggle state registration function.\n */\nexport const toggleState = createState(NgpToggleStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n booleanAttribute,\n inject,\n input,\n output,\n} from '@angular/core';\nimport { provideToggleState, toggleState } from './toggle-state';\n\n/**\n * Apply the `ngpToggle` directive to an element to manage the toggle state. This must be applied to a `button` element.\n */\n@Directive({\n selector: '[ngpToggle]',\n exportAs: 'ngpToggle',\n providers: [provideToggleState()],\n host: {\n '[attr.type]': 'isButton ? \"button\" : null',\n '[attr.aria-pressed]': 'state.selected()',\n '[attr.data-selected]': 'state.selected() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpToggle {\n /**\n * Access the element.\n */\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Whether the toggle is selected.\n * @default false\n */\n readonly selected = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleSelected',\n transform: booleanAttribute,\n });\n\n /**\n * Emits when the selected state changes.\n */\n readonly selectedChange = output<boolean>({\n alias: 'ngpToggleSelectedChange',\n });\n\n /**\n * Whether the toggle is disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpToggleDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the element is a button.\n */\n protected isButton = this.element.nativeElement.tagName === 'BUTTON';\n\n /**\n * The state for the toggle primitive.\n * @internal\n */\n protected readonly state = toggleState<NgpToggle>(this);\n\n /**\n * Toggle the selected state.\n */\n @HostListener('click')\n toggle(): void {\n if (this.state.disabled()) {\n return;\n }\n\n this.state.selected.set(!this.state.selected());\n this.selectedChange.emit(this.state.selected());\n }\n\n /**\n * If the element is not a button or a link the space key should toggle the selected state.\n */\n @HostListener('keydown.space', ['$event'])\n protected onKeyDown(event: KeyboardEvent): void {\n if (!this.isButton && this.element.nativeElement.tagName !== 'A') {\n event.preventDefault();\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;;ACd3D;;AAEG;MAYU,SAAS,CAAA;AAXtB,IAAA,WAAA,GAAA;AAYE;;AAEG;AACc,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAA0B,UAAU,CAAC;AAEtE;;;AAGG;AACM,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AACtD,YAAA,KAAK,EAAE,mBAAmB;AAC1B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;QACM,IAAc,CAAA,cAAA,GAAG,MAAM,CAAU;AACxC,YAAA,KAAK,EAAE,yBAAyB;AAC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|
|
|
1
|
-
{"version":3,"file":"ng-primitives-toolbar.mjs","sources":["../../../../packages/ng-primitives/toolbar/src/toolbar/toolbar-state.ts","../../../../packages/ng-primitives/toolbar/src/toolbar/toolbar.ts","../../../../packages/ng-primitives/toolbar/src/ng-primitives-toolbar.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToolbar } from './toolbar';\n\n/**\n * The state token for the Toolbar primitive.\n */\nexport const NgpToolbarStateToken = createStateToken<NgpToolbar>('Toolbar');\n\n/**\n * Provides the Toolbar state.\n */\nexport const provideToolbarState = createStateProvider(NgpToolbarStateToken);\n\n/**\n * Injects the Toolbar state.\n */\nexport const injectToolbarState = createStateInjector(NgpToolbarStateToken);\n\n/**\n * The Toolbar state registration function.\n */\nexport const toolbarState = createState(NgpToolbarStateToken);\n","import { Directive, input } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { syncState } from 'ng-primitives/internal';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { provideToolbarState, toolbarState } from './toolbar-state';\n\n@Directive({\n selector: '[ngpToolbar]',\n exportAs: 'ngpToolbar',\n providers: [provideToolbarState()],\n hostDirectives: [NgpRovingFocusGroup],\n host: {\n role: 'toolbar',\n '[attr.aria-orientation]': 'state.orientation()',\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpToolbar {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroup = injectRovingFocusGroupState();\n\n /**\n * The orientation of the toolbar.\n */\n readonly orientation = input<NgpOrientation>('horizontal', {\n alias: 'ngpToolbarOrientation',\n });\n\n /**\n * The toolbar state.\n */\n protected readonly state = toolbarState<NgpToolbar>(this);\n\n constructor() {\n syncState(this.state.orientation, this.rovingFocusGroup().orientation);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,oBAAoB,GAAG,gBAAgB,CAAa,SAAS,CAAC;AAE3E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAC,oBAAoB;AAE3E;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ng-primitives-toolbar.mjs","sources":["../../../../packages/ng-primitives/toolbar/src/toolbar/toolbar-state.ts","../../../../packages/ng-primitives/toolbar/src/toolbar/toolbar.ts","../../../../packages/ng-primitives/toolbar/src/ng-primitives-toolbar.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpToolbar } from './toolbar';\n\n/**\n * The state token for the Toolbar primitive.\n */\nexport const NgpToolbarStateToken = createStateToken<NgpToolbar>('Toolbar');\n\n/**\n * Provides the Toolbar state.\n */\nexport const provideToolbarState = createStateProvider(NgpToolbarStateToken);\n\n/**\n * Injects the Toolbar state.\n */\nexport const injectToolbarState = createStateInjector<NgpToolbar>(NgpToolbarStateToken);\n\n/**\n * The Toolbar state registration function.\n */\nexport const toolbarState = createState(NgpToolbarStateToken);\n","import { Directive, input } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { syncState } from 'ng-primitives/internal';\nimport { injectRovingFocusGroupState, NgpRovingFocusGroup } from 'ng-primitives/roving-focus';\nimport { provideToolbarState, toolbarState } from './toolbar-state';\n\n@Directive({\n selector: '[ngpToolbar]',\n exportAs: 'ngpToolbar',\n providers: [provideToolbarState()],\n hostDirectives: [NgpRovingFocusGroup],\n host: {\n role: 'toolbar',\n '[attr.aria-orientation]': 'state.orientation()',\n '[attr.data-orientation]': 'state.orientation()',\n },\n})\nexport class NgpToolbar {\n /**\n * Access the roving focus group state.\n */\n private readonly rovingFocusGroup = injectRovingFocusGroupState();\n\n /**\n * The orientation of the toolbar.\n */\n readonly orientation = input<NgpOrientation>('horizontal', {\n alias: 'ngpToolbarOrientation',\n });\n\n /**\n * The toolbar state.\n */\n protected readonly state = toolbarState<NgpToolbar>(this);\n\n constructor() {\n syncState(this.state.orientation, this.rovingFocusGroup().orientation);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,oBAAoB,GAAG,gBAAgB,CAAa,SAAS,CAAC;AAE3E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAC,oBAAoB;AAE3E;;AAEG;MACU,kBAAkB,GAAG,mBAAmB,CAAa,oBAAoB;AAEtF;;AAEG;AACI,MAAM,YAAY,GAAG,WAAW,CAAC,oBAAoB,CAAC;;MCThD,UAAU,CAAA;AAkBrB,IAAA,WAAA,GAAA;AAjBA;;AAEG;QACc,IAAgB,CAAA,gBAAA,GAAG,2BAA2B,EAAE;AAEjE;;AAEG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAiB,YAAY,EAAE;AACzD,YAAA,KAAK,EAAE,uBAAuB;AAC/B,SAAA,CAAC;AAEF;;AAEG;AACgB,QAAA,IAAA,CAAA,KAAK,GAAG,YAAY,CAAa,IAAI,CAAC;AAGvD,QAAA,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC;;+GAnB7D,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAV,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,UAAU,EARV,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,EAAA,uBAAA,EAAA,qBAAA,EAAA,uBAAA,EAAA,qBAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,mBAAmB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAQvB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAXtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,SAAS,EAAE,CAAC,mBAAmB,EAAE,CAAC;oBAClC,cAAc,EAAE,CAAC,mBAAmB,CAAC;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,yBAAyB,EAAE,qBAAqB;AAChD,wBAAA,yBAAyB,EAAE,qBAAqB;AACjD,qBAAA;AACF,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-tooltip.mjs","sources":["../../../../packages/ng-primitives/tooltip/src/config/tooltip-config.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger-state.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/ng-primitives-tooltip.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpTooltipConfig {\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n placement: Placement;\n\n /**\n * Define the delay before the tooltip is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the tooltip should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n};\n\nexport const NgpTooltipConfigToken = new InjectionToken<NgpTooltipConfig>('NgpTooltipConfigToken');\n\n/**\n * Provide the default Tooltip configuration\n * @param config The Tooltip configuration\n * @returns The provider\n */\nexport function provideTooltipConfig(config: Partial<NgpTooltipConfig>): Provider[] {\n return [\n {\n provide: NgpTooltipConfigToken,\n useValue: { ...defaultTooltipConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tooltip configuration\n * @returns The global Tooltip configuration\n */\nexport function injectTooltipConfig(): NgpTooltipConfig {\n return inject(NgpTooltipConfigToken, { optional: true }) ?? defaultTooltipConfig;\n}\n","import { Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpTooltipTrigger } from './tooltip-trigger';\n\n/**\n * The state token for the TooltipTrigger primitive.\n */\nexport const NgpTooltipTriggerStateToken =\n createStateToken<NgpTooltipTrigger<unknown>>('TooltipTrigger');\n\n/**\n * Provides the TooltipTrigger state.\n */\nexport const provideTooltipTriggerState = createStateProvider(NgpTooltipTriggerStateToken);\n\n/**\n * Injects the TooltipTrigger state.\n */\nexport const injectTooltipTriggerState = createStateInjector(NgpTooltipTriggerStateToken) as <\n T,\n>() => Signal<State<NgpTooltipTrigger<T>>>;\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n numberAttribute,\n OnDestroy,\n signal,\n ViewContainerRef,\n} from '@angular/core';\nimport { Placement } from '@floating-ui/dom';\nimport {\n createOverlay,\n NgpOverlay,\n NgpOverlayConfig,\n NgpOverlayContent,\n} from 'ng-primitives/portal';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltipTrigger` directive to an element that triggers the tooltip to show.\n */\n@Directive({\n selector: '[ngpTooltipTrigger]',\n exportAs: 'ngpTooltipTrigger',\n providers: [provideTooltipTriggerState()],\n host: {\n '[attr.data-open]': 'open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(mouseenter)': 'show()',\n '(mouseleave)': 'hide()',\n '(focus)': 'show()',\n '(blur)': 'hide()',\n },\n})\nexport class NgpTooltipTrigger<T = null> implements OnDestroy {\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the view container reference.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpOverlayContent<T>>(undefined, {\n alias: 'ngpTooltipTrigger',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpTooltipTriggerPlacement',\n });\n\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpTooltipTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpTooltipTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpTooltipTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpTooltipTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the tooltip should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Provide context to the tooltip. This can be used to pass data to the tooltip content.\n */\n readonly context = input<T>(undefined, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * The overlay that manages the tooltip\n * @internal\n */\n readonly overlay = signal<NgpOverlay<T> | null>(null);\n\n /**\n * The open state of the tooltip.\n * @internal\n */\n readonly open = computed(() => this.overlay()?.isOpen() ?? false);\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n ngOnDestroy(): void {\n this.overlay()?.destroy();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // If the trigger is disabled, do not show the tooltip\n if (this.state.disabled() || this.open()) {\n return;\n }\n\n // Create the overlay if it doesn't exist yet\n if (!this.overlay()) {\n this.createOverlay();\n }\n\n this.overlay()?.show();\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // If the trigger is disabled, do nothing\n if (this.state.disabled()) {\n return;\n }\n\n this.overlay()?.hide();\n }\n\n /**\n * Create the overlay that will contain the tooltip\n */\n private createOverlay(): void {\n const tooltip = this.state.tooltip();\n\n if (!tooltip) {\n throw new Error('Tooltip must be either a TemplateRef or a ComponentType');\n }\n\n // Create config for the overlay\n const config: NgpOverlayConfig<T> = {\n content: tooltip,\n triggerElement: this.trigger.nativeElement,\n injector: this.injector,\n context: this.state.context(),\n container: this.state.container(),\n placement: this.state.placement(),\n offset: this.state.offset(),\n flip: this.state.flip(),\n showDelay: this.state.showDelay(),\n hideDelay: this.state.hideDelay(),\n closeOnEscape: true,\n closeOnOutsideClick: true,\n viewContainerRef: this.viewContainerRef,\n };\n\n // Create the overlay instance\n this.overlay.set(createOverlay(config));\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectOverlay } from 'ng-primitives/portal';\n\n/**\n * Apply the `ngpTooltip` directive to an element that represents the tooltip. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpTooltip]',\n exportAs: 'ngpTooltip',\n host: {\n role: 'tooltip',\n '[style.left.px]': 'overlay.position().x',\n '[style.top.px]': 'overlay.position().y',\n '[style.--ngp-tooltip-trigger-width.px]': 'overlay.triggerWidth()',\n '[style.--ngp-tooltip-transform-origin]': 'overlay.transformOrigin()',\n },\n})\nexport class NgpTooltip {\n /**\n * Access the overlay.\n */\n protected readonly overlay = injectOverlay();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAyCO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,IAAI;CAChB;AAEM,MAAM,qBAAqB,GAAG,IAAI,cAAc,CAAmB,uBAAuB,CAAC;AAElG;;;;AAIG;AACG,SAAU,oBAAoB,CAAC,MAAiC,EAAA;IACpE,OAAO;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ACF,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-tooltip.mjs","sources":["../../../../packages/ng-primitives/tooltip/src/config/tooltip-config.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger-state.ts","../../../../packages/ng-primitives/tooltip/src/tooltip-trigger/tooltip-trigger.ts","../../../../packages/ng-primitives/tooltip/src/tooltip/tooltip.ts","../../../../packages/ng-primitives/tooltip/src/ng-primitives-tooltip.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpTooltipConfig {\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n placement: Placement;\n\n /**\n * Define the delay before the tooltip is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the tooltip should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n}\n\nexport const defaultTooltipConfig: NgpTooltipConfig = {\n offset: 4,\n placement: 'top',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n};\n\nexport const NgpTooltipConfigToken = new InjectionToken<NgpTooltipConfig>('NgpTooltipConfigToken');\n\n/**\n * Provide the default Tooltip configuration\n * @param config The Tooltip configuration\n * @returns The provider\n */\nexport function provideTooltipConfig(config: Partial<NgpTooltipConfig>): Provider[] {\n return [\n {\n provide: NgpTooltipConfigToken,\n useValue: { ...defaultTooltipConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Tooltip configuration\n * @returns The global Tooltip configuration\n */\nexport function injectTooltipConfig(): NgpTooltipConfig {\n return inject(NgpTooltipConfigToken, { optional: true }) ?? defaultTooltipConfig;\n}\n","import { Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpTooltipTrigger } from './tooltip-trigger';\n\n/**\n * The state token for the TooltipTrigger primitive.\n */\nexport const NgpTooltipTriggerStateToken =\n createStateToken<NgpTooltipTrigger<unknown>>('TooltipTrigger');\n\n/**\n * Provides the TooltipTrigger state.\n */\nexport const provideTooltipTriggerState = createStateProvider(NgpTooltipTriggerStateToken);\n\n/**\n * Injects the TooltipTrigger state.\n */\nexport const injectTooltipTriggerState = createStateInjector<NgpTooltipTrigger<unknown>>(\n NgpTooltipTriggerStateToken,\n);\n\n/**\n * The TooltipTrigger state registration function.\n */\nexport const tooltipTriggerState = createState(NgpTooltipTriggerStateToken);\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n Injector,\n input,\n numberAttribute,\n OnDestroy,\n signal,\n ViewContainerRef,\n} from '@angular/core';\nimport { Placement } from '@floating-ui/dom';\nimport {\n createOverlay,\n NgpOverlay,\n NgpOverlayConfig,\n NgpOverlayContent,\n} from 'ng-primitives/portal';\nimport { injectTooltipConfig } from '../config/tooltip-config';\nimport { provideTooltipTriggerState, tooltipTriggerState } from './tooltip-trigger-state';\n\n/**\n * Apply the `ngpTooltipTrigger` directive to an element that triggers the tooltip to show.\n */\n@Directive({\n selector: '[ngpTooltipTrigger]',\n exportAs: 'ngpTooltipTrigger',\n providers: [provideTooltipTriggerState()],\n host: {\n '[attr.data-open]': 'open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(mouseenter)': 'show()',\n '(mouseleave)': 'hide()',\n '(focus)': 'show()',\n '(blur)': 'hide()',\n },\n})\nexport class NgpTooltipTrigger<T = null> implements OnDestroy {\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the view container reference.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the global tooltip configuration.\n */\n private readonly config = injectTooltipConfig();\n\n /**\n * Access the tooltip template ref.\n */\n readonly tooltip = input<NgpOverlayContent<T>>(undefined, {\n alias: 'ngpTooltipTrigger',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpTooltipTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the tooltip relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpTooltipTriggerPlacement',\n });\n\n /**\n * Define the offset of the tooltip relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpTooltipTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpTooltipTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the tooltip is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpTooltipTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the tooltip should flip when there is not enough space for the tooltip.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpTooltipTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the tooltip should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpTooltipTriggerContainer',\n });\n\n /**\n * Provide context to the tooltip. This can be used to pass data to the tooltip content.\n */\n readonly context = input<T>(undefined, {\n alias: 'ngpTooltipTriggerContext',\n });\n\n /**\n * The overlay that manages the tooltip\n * @internal\n */\n readonly overlay = signal<NgpOverlay<T> | null>(null);\n\n /**\n * The open state of the tooltip.\n * @internal\n */\n readonly open = computed(() => this.overlay()?.isOpen() ?? false);\n\n /**\n * Store the state of the tooltip.\n * @internal\n */\n readonly state = tooltipTriggerState<NgpTooltipTrigger<T>>(this);\n\n ngOnDestroy(): void {\n this.overlay()?.destroy();\n }\n\n /**\n * Show the tooltip.\n */\n show(): void {\n // If the trigger is disabled, do not show the tooltip\n if (this.state.disabled() || this.open()) {\n return;\n }\n\n // Create the overlay if it doesn't exist yet\n if (!this.overlay()) {\n this.createOverlay();\n }\n\n this.overlay()?.show();\n }\n\n /**\n * Hide the tooltip.\n */\n hide(): void {\n // If the trigger is disabled, do nothing\n if (this.state.disabled()) {\n return;\n }\n\n this.overlay()?.hide();\n }\n\n /**\n * Create the overlay that will contain the tooltip\n */\n private createOverlay(): void {\n const tooltip = this.state.tooltip();\n\n if (!tooltip) {\n throw new Error('Tooltip must be either a TemplateRef or a ComponentType');\n }\n\n // Create config for the overlay\n const config: NgpOverlayConfig<T> = {\n content: tooltip,\n triggerElement: this.trigger.nativeElement,\n injector: this.injector,\n context: this.state.context(),\n container: this.state.container(),\n placement: this.state.placement(),\n offset: this.state.offset(),\n flip: this.state.flip(),\n showDelay: this.state.showDelay(),\n hideDelay: this.state.hideDelay(),\n closeOnEscape: true,\n closeOnOutsideClick: true,\n viewContainerRef: this.viewContainerRef,\n };\n\n // Create the overlay instance\n this.overlay.set(createOverlay(config));\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectOverlay } from 'ng-primitives/portal';\n\n/**\n * Apply the `ngpTooltip` directive to an element that represents the tooltip. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpTooltip]',\n exportAs: 'ngpTooltip',\n host: {\n role: 'tooltip',\n '[style.left.px]': 'overlay.position().x',\n '[style.top.px]': 'overlay.position().y',\n '[style.--ngp-tooltip-trigger-width.px]': 'overlay.triggerWidth()',\n '[style.--ngp-tooltip-transform-origin]': 'overlay.transformOrigin()',\n },\n})\nexport class NgpTooltip {\n /**\n * Access the overlay.\n */\n protected readonly overlay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CAAA,YAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBAXtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,iBAAiB,EAAE,sBAAsB;AACzC,wBAAA,gBAAgB,EAAE,sBAAsB;AACxC,wBAAA,wCAAwC,EAAE,wBAAwB;AAClE,wBAAA,wCAAwC,EAAE,2BAA2B;AACtE,qBAAA;AACF,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
@@ -10,22 +10,7 @@ export declare const provideFileDropzoneState: (options?: import("ng-primitives/
|
|
|
10
10
|
/**
|
|
11
11
|
* Injects the FileDropzone state.
|
|
12
12
|
*/
|
|
13
|
-
export declare const injectFileDropzoneState: <U =
|
|
14
|
-
readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
|
|
15
|
-
readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string | string[]>;
|
|
16
|
-
readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
17
|
-
readonly directory: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
18
|
-
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
19
|
-
readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
|
|
20
|
-
readonly rejected: import("@angular/core").OutputEmitterRef<void>;
|
|
21
|
-
readonly dragOver: import("@angular/core").OutputEmitterRef<boolean>;
|
|
22
|
-
readonly isDragOver: import("@angular/core").WritableSignal<boolean>;
|
|
23
|
-
readonly state: import("ng-primitives/state").CreatedState<NgpFileDropzone>;
|
|
24
|
-
onDragEnter: (event: DragEvent) => void;
|
|
25
|
-
onDragOver: (event: DragEvent) => void;
|
|
26
|
-
onDragLeave: (event: DragEvent) => void;
|
|
27
|
-
onDrop: (event: DragEvent) => void;
|
|
28
|
-
}>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
13
|
+
export declare const injectFileDropzoneState: <U = NgpFileDropzone>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
29
14
|
/**
|
|
30
15
|
* The FileDropzone state registration function.
|
|
31
16
|
*/
|
|
@@ -10,27 +10,7 @@ export declare const provideFileUploadState: (options?: import("ng-primitives/st
|
|
|
10
10
|
/**
|
|
11
11
|
* Injects the FileUpload state.
|
|
12
12
|
*/
|
|
13
|
-
export declare const injectFileUploadState: <U =
|
|
14
|
-
readonly document: Document;
|
|
15
|
-
readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
|
|
16
|
-
readonly fileTypes: import("@angular/core").InputSignalWithTransform<string[] | undefined, string | string[]>;
|
|
17
|
-
readonly multiple: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
18
|
-
readonly directory: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
19
|
-
readonly dragAndDrop: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
20
|
-
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
21
|
-
readonly selected: import("@angular/core").OutputEmitterRef<FileList | null>;
|
|
22
|
-
readonly canceled: import("@angular/core").OutputEmitterRef<void>;
|
|
23
|
-
readonly rejected: import("@angular/core").OutputEmitterRef<void>;
|
|
24
|
-
readonly dragOver: import("@angular/core").OutputEmitterRef<boolean>;
|
|
25
|
-
readonly isDragOver: import("@angular/core").WritableSignal<boolean>;
|
|
26
|
-
input: HTMLInputElement;
|
|
27
|
-
readonly state: import("ng-primitives/state").CreatedState<NgpFileUpload>;
|
|
28
|
-
showFileDialog: () => void;
|
|
29
|
-
onDragEnter: (event: DragEvent) => void;
|
|
30
|
-
onDragOver: (event: DragEvent) => void;
|
|
31
|
-
onDragLeave: (event: DragEvent) => void;
|
|
32
|
-
onDrop: (event: DragEvent) => void;
|
|
33
|
-
}>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
13
|
+
export declare const injectFileUploadState: <U = NgpFileUpload>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
34
14
|
/**
|
|
35
15
|
* The FileUpload state registration function.
|
|
36
16
|
*/
|
|
@@ -10,34 +10,7 @@ export declare const provideFocusTrapState: (options?: import("ng-primitives/sta
|
|
|
10
10
|
/**
|
|
11
11
|
* Injects the FocusTrap state.
|
|
12
12
|
*/
|
|
13
|
-
export declare const injectFocusTrapState: <U =
|
|
14
|
-
readonly overlay: import("ng-primitives/portal").NgpOverlay<any> | null;
|
|
15
|
-
readonly focusTrap: {
|
|
16
|
-
active: boolean;
|
|
17
|
-
activate(): void;
|
|
18
|
-
deactivate(): void;
|
|
19
|
-
};
|
|
20
|
-
readonly injector: import("@angular/core").Injector;
|
|
21
|
-
readonly focusMonitor: import("@angular/cdk/focus-monitor.d-CvvJeQRc").e;
|
|
22
|
-
readonly interactivityChecker: import("@angular/cdk/a11y-module.d-DBHGyKoh").I;
|
|
23
|
-
readonly elementRef: import("@angular/core").ElementRef<HTMLElement>;
|
|
24
|
-
readonly ngZone: import("@angular/core").NgZone;
|
|
25
|
-
mutationObserver: MutationObserver | null;
|
|
26
|
-
lastFocusedElement: HTMLElement | null;
|
|
27
|
-
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
28
|
-
readonly state: import("ng-primitives/state").CreatedState<NgpFocusTrap>;
|
|
29
|
-
ngOnInit: () => void;
|
|
30
|
-
ngOnDestroy: () => void;
|
|
31
|
-
handleFocusIn: (event: FocusEvent) => void;
|
|
32
|
-
handleFocusOut: (event: FocusEvent) => void;
|
|
33
|
-
handleMutations: (mutations: MutationRecord[]) => void;
|
|
34
|
-
handleKeyDown: (event: KeyboardEvent) => void;
|
|
35
|
-
getTabbableEdges: (container: HTMLElement) => readonly [HTMLElement | null, HTMLElement | null];
|
|
36
|
-
getTabbableCandidates: (container: HTMLElement) => HTMLElement[];
|
|
37
|
-
findVisible: (elements: HTMLElement[]) => HTMLElement | null;
|
|
38
|
-
focus: (element: HTMLElement | null) => void;
|
|
39
|
-
focusFirst: () => void;
|
|
40
|
-
}>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
13
|
+
export declare const injectFocusTrapState: <U = NgpFocusTrap>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
41
14
|
/**
|
|
42
15
|
* The FocusTrap state registration function.
|
|
43
16
|
*/
|
|
@@ -10,31 +10,7 @@ export declare class NgpDescription {
|
|
|
10
10
|
/**
|
|
11
11
|
* Access the form field that the description is associated with.
|
|
12
12
|
*/
|
|
13
|
-
protected readonly formField: import("@angular/core").Signal<import("ng-primitives/state").State<
|
|
14
|
-
readonly labels: import("@angular/core").WritableSignal<string[]>;
|
|
15
|
-
readonly descriptions: import("@angular/core").WritableSignal<string[]>;
|
|
16
|
-
readonly formControl: import("@angular/core").WritableSignal<string | null>;
|
|
17
|
-
readonly ngControl: import("@angular/core").Signal<import("@angular/forms").NgControl | undefined>;
|
|
18
|
-
readonly errors: import("@angular/core").WritableSignal<string[]>;
|
|
19
|
-
readonly pristine: import("@angular/core").WritableSignal<boolean | null>;
|
|
20
|
-
readonly touched: import("@angular/core").WritableSignal<boolean | null>;
|
|
21
|
-
readonly dirty: import("@angular/core").WritableSignal<boolean | null>;
|
|
22
|
-
readonly valid: import("@angular/core").WritableSignal<boolean | null>;
|
|
23
|
-
readonly invalid: import("@angular/core").WritableSignal<boolean | null>;
|
|
24
|
-
readonly pending: import("@angular/core").WritableSignal<boolean | null>;
|
|
25
|
-
readonly disabled: import("@angular/core").WritableSignal<boolean | null>;
|
|
26
|
-
subscription?: import("rxjs").Subscription | undefined;
|
|
27
|
-
readonly state: import("ng-primitives/state").CreatedState<import("ng-primitives/form-field").NgpFormField>;
|
|
28
|
-
ngOnDestroy: () => void;
|
|
29
|
-
setupSubscriptions: (control: import("@angular/forms").NgControl | null | undefined) => void;
|
|
30
|
-
updateStatus: () => void;
|
|
31
|
-
setFormControl: (id: string) => void;
|
|
32
|
-
addLabel: (label: string) => void;
|
|
33
|
-
addDescription: (description: string) => void;
|
|
34
|
-
removeFormControl: () => void;
|
|
35
|
-
removeLabel: (label: string) => void;
|
|
36
|
-
removeDescription: (description: string) => void;
|
|
37
|
-
}>>;
|
|
13
|
+
protected readonly formField: import("@angular/core").Signal<import("ng-primitives/state").State<import("ng-primitives/form-field").NgpFormField>>;
|
|
38
14
|
constructor();
|
|
39
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpDescription, never>;
|
|
40
16
|
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDescription, "[ngpDescription]", ["ngpDescription"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -7,31 +7,7 @@ export declare class NgpError implements OnChanges, OnDestroy {
|
|
|
7
7
|
/**
|
|
8
8
|
* Access the form field that the description is associated with.
|
|
9
9
|
*/
|
|
10
|
-
protected readonly formField: import("@angular/core").Signal<import("ng-primitives/state").State<
|
|
11
|
-
readonly labels: import("@angular/core").WritableSignal<string[]>;
|
|
12
|
-
readonly descriptions: import("@angular/core").WritableSignal<string[]>;
|
|
13
|
-
readonly formControl: import("@angular/core").WritableSignal<string | null>;
|
|
14
|
-
readonly ngControl: import("@angular/core").Signal<import("@angular/forms").NgControl | undefined>;
|
|
15
|
-
readonly errors: import("@angular/core").WritableSignal<string[]>;
|
|
16
|
-
readonly pristine: import("@angular/core").WritableSignal<boolean | null>;
|
|
17
|
-
readonly touched: import("@angular/core").WritableSignal<boolean | null>;
|
|
18
|
-
readonly dirty: import("@angular/core").WritableSignal<boolean | null>;
|
|
19
|
-
readonly valid: import("@angular/core").WritableSignal<boolean | null>;
|
|
20
|
-
readonly invalid: import("@angular/core").WritableSignal<boolean | null>;
|
|
21
|
-
readonly pending: import("@angular/core").WritableSignal<boolean | null>;
|
|
22
|
-
readonly disabled: import("@angular/core").WritableSignal<boolean | null>;
|
|
23
|
-
subscription?: import("rxjs").Subscription | undefined;
|
|
24
|
-
readonly state: import("ng-primitives/state").CreatedState<import("ng-primitives/form-field").NgpFormField>;
|
|
25
|
-
ngOnDestroy: () => void;
|
|
26
|
-
setupSubscriptions: (control: import("@angular/forms").NgControl | null | undefined) => void;
|
|
27
|
-
updateStatus: () => void;
|
|
28
|
-
setFormControl: (id: string) => void;
|
|
29
|
-
addLabel: (label: string) => void;
|
|
30
|
-
addDescription: (description: string) => void;
|
|
31
|
-
removeFormControl: () => void;
|
|
32
|
-
removeLabel: (label: string) => void;
|
|
33
|
-
removeDescription: (description: string) => void;
|
|
34
|
-
}>>;
|
|
10
|
+
protected readonly formField: import("@angular/core").Signal<import("ng-primitives/state").State<import("ng-primitives/form-field").NgpFormField>>;
|
|
35
11
|
/**
|
|
36
12
|
* The id of the error message. If not provided, a unique id will be generated.
|
|
37
13
|
*/
|
|
@@ -10,11 +10,7 @@ export declare const provideFormControlState: (options?: import("ng-primitives/s
|
|
|
10
10
|
/**
|
|
11
11
|
* Injects the FormControl state.
|
|
12
12
|
*/
|
|
13
|
-
export declare const injectFormControlState: <U =
|
|
14
|
-
readonly id: import("@angular/core").InputSignal<string>;
|
|
15
|
-
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, import("@angular/cdk/coercion").BooleanInput>;
|
|
16
|
-
readonly state: import("ng-primitives/state").CreatedState<NgpFormControl>;
|
|
17
|
-
}>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
13
|
+
export declare const injectFormControlState: <U = NgpFormControl>(injectOptions?: import("@angular/core").InjectOptions) => import("@angular/core").Signal<import("ng-primitives/state").State<U>>;
|
|
18
14
|
/**
|
|
19
15
|
* The FormControl state registration function.
|
|
20
16
|
*/
|
|
@@ -24,8 +24,8 @@ export declare class NgpFormControl {
|
|
|
24
24
|
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpFormControl, "[ngpFormControl]", ["ngpFormControl"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFormControlDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
25
25
|
}
|
|
26
26
|
interface FormControlState {
|
|
27
|
-
id
|
|
27
|
+
id: Signal<string>;
|
|
28
28
|
disabled?: Signal<boolean>;
|
|
29
29
|
}
|
|
30
|
-
export declare function setupFormControl({ id, disabled
|
|
30
|
+
export declare function setupFormControl({ id, disabled }: FormControlState): void;
|
|
31
31
|
export {};
|