frontile 0.18.0-beta.1 → 0.18.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/declarations/-private/deprecated-args.d.ts +18 -0
  2. package/declarations/-private/notification.d.ts +4 -4
  3. package/declarations/-private/types.d.ts +10 -8
  4. package/declarations/components/buttons/button-group.d.ts +3 -1
  5. package/declarations/components/buttons/button.d.ts +12 -3
  6. package/declarations/components/buttons/chip.d.ts +15 -8
  7. package/declarations/components/buttons/close-button.d.ts +5 -2
  8. package/declarations/components/buttons/segmented-control/segmented-control.d.ts +9 -9
  9. package/declarations/components/buttons/toggle-button.d.ts +9 -1
  10. package/declarations/components/collections/calendar/calendar.d.ts +49 -49
  11. package/declarations/components/collections/calendar/utils.d.ts +1 -0
  12. package/declarations/components/collections/dropdown/dropdown.d.ts +13 -2
  13. package/declarations/components/collections/dropdown/menu-context.d.ts +3 -3
  14. package/declarations/components/collections/listbox/group.d.ts +7 -2
  15. package/declarations/components/collections/listbox/item.d.ts +27 -6
  16. package/declarations/components/collections/listbox/listbox.d.ts +31 -4
  17. package/declarations/components/collections/simple-table/body.d.ts +68 -68
  18. package/declarations/components/collections/simple-table/cell.d.ts +68 -68
  19. package/declarations/components/collections/simple-table/column.d.ts +68 -68
  20. package/declarations/components/collections/simple-table/footer.d.ts +68 -68
  21. package/declarations/components/collections/simple-table/header.d.ts +68 -68
  22. package/declarations/components/collections/simple-table/index.d.ts +68 -68
  23. package/declarations/components/collections/simple-table/row.d.ts +68 -68
  24. package/declarations/components/collections/table/column-visibility.d.ts +68 -68
  25. package/declarations/components/collections/table/sort-button.d.ts +68 -68
  26. package/declarations/components/collections/table/table.d.ts +68 -68
  27. package/declarations/components/disclosure/accordion/accordion.d.ts +23 -23
  28. package/declarations/components/forms/autocomplete.d.ts +24 -12
  29. package/declarations/components/forms/date-picker/date-picker.d.ts +268 -0
  30. package/declarations/components/forms/date-picker/end-content.d.ts +29 -0
  31. package/declarations/components/forms/date-picker/trigger.d.ts +40 -0
  32. package/declarations/components/forms/date-picker/types.d.ts +149 -0
  33. package/declarations/components/forms/date-picker/value.d.ts +43 -0
  34. package/declarations/components/forms/date-picker.d.ts +3 -0
  35. package/declarations/components/forms/field.d.ts +5 -0
  36. package/declarations/components/forms/form-control.d.ts +1 -1
  37. package/declarations/components/forms/form-feedback.d.ts +17 -2
  38. package/declarations/components/forms/icons.d.ts +4 -1
  39. package/declarations/components/forms/index.d.ts +2 -0
  40. package/declarations/components/forms/input.d.ts +10 -10
  41. package/declarations/components/forms/native-select.d.ts +7 -7
  42. package/declarations/components/forms/select/select.d.ts +30 -17
  43. package/declarations/components/forms/select/types.d.ts +42 -12
  44. package/declarations/components/forms/switch.d.ts +22 -18
  45. package/declarations/components/forms/textarea.d.ts +6 -6
  46. package/declarations/components/navigation/pagination/pagination.d.ts +18 -18
  47. package/declarations/components/navigation/tab-nav/tab-nav.d.ts +12 -12
  48. package/declarations/components/navigation/tabs/tabs.d.ts +12 -12
  49. package/declarations/components/notifications/index.d.ts +2 -2
  50. package/declarations/components/notifications/notification-card.d.ts +5 -5
  51. package/declarations/components/notifications/notifications-container.d.ts +2 -2
  52. package/declarations/components/overlays/drawer.d.ts +32 -32
  53. package/declarations/components/overlays/popover.d.ts +1 -1
  54. package/declarations/components/overlays/tooltip.d.ts +2 -2
  55. package/declarations/components/status/alert.d.ts +10 -10
  56. package/declarations/components/status/progress-bar.d.ts +5 -1
  57. package/declarations/components/utilities/kbd.d.ts +4 -4
  58. package/declarations/components/utilities/spinner.d.ts +14 -7
  59. package/declarations/index.d.ts +1 -1
  60. package/declarations/template-registry.d.ts +2 -1
  61. package/dist/components/buttons/button-group.js +26 -1
  62. package/dist/components/buttons/button-group.js.map +1 -1
  63. package/dist/components/buttons/button.js +21 -2
  64. package/dist/components/buttons/button.js.map +1 -1
  65. package/dist/components/buttons/chip.js +19 -2
  66. package/dist/components/buttons/chip.js.map +1 -1
  67. package/dist/components/buttons/close-button.js +17 -1
  68. package/dist/components/buttons/close-button.js.map +1 -1
  69. package/dist/components/buttons/segmented-control/segmented-control.js +1 -1
  70. package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
  71. package/dist/components/buttons/toggle-button.js +36 -2
  72. package/dist/components/buttons/toggle-button.js.map +1 -1
  73. package/dist/components/collections/calendar/calendar.js +36 -3
  74. package/dist/components/collections/calendar/calendar.js.map +1 -1
  75. package/dist/components/collections/calendar/utils.js +1 -1
  76. package/dist/components/collections/calendar/utils.js.map +1 -1
  77. package/dist/components/collections/command/footer.js +1 -1
  78. package/dist/components/collections/command/footer.js.map +1 -1
  79. package/dist/components/collections/command/list.js +1 -1
  80. package/dist/components/collections/command/list.js.map +1 -1
  81. package/dist/components/collections/dropdown/dropdown.js +45 -7
  82. package/dist/components/collections/dropdown/dropdown.js.map +1 -1
  83. package/dist/components/collections/dropdown/menu-context.js.map +1 -1
  84. package/dist/components/collections/listbox/group.js +1 -1
  85. package/dist/components/collections/listbox/group.js.map +1 -1
  86. package/dist/components/collections/listbox/item.js +47 -8
  87. package/dist/components/collections/listbox/item.js.map +1 -1
  88. package/dist/components/collections/listbox/listbox.js +53 -2
  89. package/dist/components/collections/listbox/listbox.js.map +1 -1
  90. package/dist/components/collections/table/column-visibility.js +1 -1
  91. package/dist/components/collections/table/column-visibility.js.map +1 -1
  92. package/dist/components/disclosure/accordion/accordion.js.map +1 -1
  93. package/dist/components/forms/autocomplete.js +47 -2
  94. package/dist/components/forms/autocomplete.js.map +1 -1
  95. package/dist/components/forms/date-picker/date-picker.js +301 -0
  96. package/dist/components/forms/date-picker/date-picker.js.map +1 -0
  97. package/dist/components/forms/date-picker/end-content.js +21 -0
  98. package/dist/components/forms/date-picker/end-content.js.map +1 -0
  99. package/dist/components/forms/date-picker/trigger.js +14 -0
  100. package/dist/components/forms/date-picker/trigger.js.map +1 -0
  101. package/dist/components/forms/date-picker/types.js +2 -0
  102. package/dist/components/forms/date-picker/types.js.map +1 -0
  103. package/dist/components/forms/date-picker/value.js +97 -0
  104. package/dist/components/forms/date-picker/value.js.map +1 -0
  105. package/dist/components/forms/date-picker.js +2 -0
  106. package/dist/components/forms/date-picker.js.map +1 -0
  107. package/dist/components/forms/field.js +3 -1
  108. package/dist/components/forms/field.js.map +1 -1
  109. package/dist/components/forms/form-control.js +1 -1
  110. package/dist/components/forms/form-control.js.map +1 -1
  111. package/dist/components/forms/form-feedback.js +25 -2
  112. package/dist/components/forms/form-feedback.js.map +1 -1
  113. package/dist/components/forms/icons.js +4 -1
  114. package/dist/components/forms/icons.js.map +1 -1
  115. package/dist/components/forms/index.js +2 -0
  116. package/dist/components/forms/index.js.map +1 -1
  117. package/dist/components/forms/input.js +1 -1
  118. package/dist/components/forms/input.js.map +1 -1
  119. package/dist/components/forms/select/end-content.js +1 -1
  120. package/dist/components/forms/select/end-content.js.map +1 -1
  121. package/dist/components/forms/select/select.js +61 -7
  122. package/dist/components/forms/select/select.js.map +1 -1
  123. package/dist/components/forms/select/selected-items.js +1 -1
  124. package/dist/components/forms/select/selected-items.js.map +1 -1
  125. package/dist/components/forms/switch.js +9 -1
  126. package/dist/components/forms/switch.js.map +1 -1
  127. package/dist/components/navigation/pagination/pagination.js +1 -1
  128. package/dist/components/navigation/pagination/pagination.js.map +1 -1
  129. package/dist/components/navigation/tab-nav/tab-nav.js +1 -1
  130. package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
  131. package/dist/components/navigation/tabs/tabs.js +1 -1
  132. package/dist/components/navigation/tabs/tabs.js.map +1 -1
  133. package/dist/components/notifications/index.js +2 -2
  134. package/dist/components/notifications/notification-card.js +1 -1
  135. package/dist/components/notifications/notifications-container.js +1 -1
  136. package/dist/components/notifications/notifications-container.js.map +1 -1
  137. package/dist/components/overlays/drawer.js +3 -3
  138. package/dist/components/overlays/drawer.js.map +1 -1
  139. package/dist/components/overlays/popover.js.map +1 -1
  140. package/dist/components/overlays/tooltip.js +1 -1
  141. package/dist/components/overlays/tooltip.js.map +1 -1
  142. package/dist/components/status/alert.js +19 -15
  143. package/dist/components/status/alert.js.map +1 -1
  144. package/dist/components/status/progress-bar.js +9 -1
  145. package/dist/components/status/progress-bar.js.map +1 -1
  146. package/dist/components/utilities/kbd.js +2 -2
  147. package/dist/components/utilities/kbd.js.map +1 -1
  148. package/dist/components/utilities/spinner.js +26 -7
  149. package/dist/components/utilities/spinner.js.map +1 -1
  150. package/dist/deprecated-args-BIUjLA8y.js +32 -0
  151. package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
  152. package/dist/forms.js +2 -0
  153. package/dist/forms.js.map +1 -1
  154. package/dist/index.js +4 -2
  155. package/dist/index.js.map +1 -1
  156. package/dist/{manager-CDIZzrQ9.js → manager-B-PnYqDs.js} +28 -22
  157. package/dist/manager-B-PnYqDs.js.map +1 -0
  158. package/dist/{notification-card-BHTra4Zh.js → notification-card-CYmWQ35W.js} +25 -22
  159. package/dist/notification-card-CYmWQ35W.js.map +1 -0
  160. package/dist/notifications.js +2 -2
  161. package/dist/services/notifications.js +1 -1
  162. package/package.json +3 -3
  163. package/dist/manager-CDIZzrQ9.js.map +0 -1
  164. package/dist/notification-card-BHTra4Zh.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sources":["../../../../src/components/forms/select/select.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport type Owner from '@ember/owner';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\n\nimport type { ListItem } from '../native-select';\nimport { Listbox } from '../../collections/listbox';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { Popover } from '../../overlays/popover';\nimport { FormControl } from '../form-control';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport { canDeselectKey, keyAndLabelForItem } from '../../../utils/listManager';\nimport { filterAndRankItems } from '../../../utils/filter';\n\nimport { SelectNativeMirror } from './native-mirror';\nimport { SelectTrigger } from './trigger';\nimport { SelectedChips } from './selected-items';\nimport { SelectEndContent } from './end-content';\nimport type {\n DefaultSingleSelectArgs,\n ExplicitSingleSelectArgs,\n ResolvedSelectChipOptions,\n SelectArgs,\n SelectChipOptions,\n SelectSignature,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n// Import helper function directly instead of using ember-truth-helpers\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\n\n/*\n * Internal: selection state architecture\n *\n * This component uses a **two-way data binding pattern** for managing selection state:\n *\n * ### Data Flow\n * 1. **External → Internal (Initialization & Updates)**\n * - Parent passes `@selectedKey` or `@selectedKeys` as arguments\n * - Constructor initializes internal tracked properties (`_selectedKey` or `_selectedKeys`)\n * - Modifiers (`updateSingleSelectValue`, `updateMultipleSelectValue`) sync internal state\n * when parent updates the arguments\n *\n * 2. **Internal State Management**\n * - `_selectedKey` / `_selectedKeys`: Internal tracked state (prefixed with underscore)\n * - These serve as the \"source of truth\" for rendering and reactivity\n * - Getters (`getSelectedKey`, `selectedKeys`) expose this internal state to the template\n *\n * 3. **Internal → External (User Interactions)**\n * - User interactions trigger selection change handlers\n * - Handlers update internal `_selectedKey` / `_selectedKeys` for immediate UI update\n * - Handlers call parent's `@onSelectionChange` callback to notify of state change\n * - Parent updates its state, which flows back through step 1\n *\n * ### Why Both Internal State AND Callbacks?\n * - **Internal state:** Enables immediate, responsive UI updates (`_selectedKey` / `_selectedKeys`)\n * - **Parent callback:** Enables parent to take action when changes occur (`@onSelectionChange`)\n * - This pattern provides both responsive UX and parent inclusion over state\n *\n * ### Example Flow\n * ```\n * User clicks item\n * → onSelectionChange handler\n * → Updates _selectedKey (immediate UI update)\n * → Calls parent's @onSelectionChange callback\n * → Parent updates its @selectedKey state\n * → updateSingleSelectValue modifier syncs _selectedKey with new arg value\n * ```\n */\n/**\n * A dropdown selection component: a custom listbox in a popover, backed by a\n * visually hidden native `<select>` so the value submits with a form.\n *\n * Selection can be controlled with `@selectedKey` / `@selectedKeys` plus\n * `@onSelectionChange`, or left uncontrolled.\n */\nclass Select<T = unknown> extends Component<SelectSignature<T>> {\n /**\n * Every item registered by the hidden native `<select>`, in item order.\n *\n * The hidden select is deliberately given the *unfiltered* `@items` — it\n * carries the form value, which must not shrink to the filter — so this\n * covers the whole list even while the listbox is filtered down. Chips and\n * the joined text value can therefore be resolved straight from it.\n */\n @tracked nodes: ListItem[] = [];\n\n @tracked isOpen = false;\n /**\n * Internal tracked state for single selection mode.\n * Source of truth for rendering. Synced with @selectedKey via the updateSingleSelectValue modifier.\n */\n @tracked _selectedKey: string | null = null;\n\n /**\n * Internal tracked state for multiple selection mode.\n * Source of truth for rendering. Synced with @selectedKeys via the updateMultipleSelectValue modifier.\n */\n @tracked _selectedKeys: string[] = [];\n\n /**\n * Initializes the component and sets up initial selection state.\n *\n * **Initialization:**\n * 1. Determines selection mode (single vs multiple)\n * 2. Copies external arg values (@selectedKey or @selectedKeys) to internal tracked state\n * 3. Logs warnings if incorrect args are used for the selection mode\n *\n * Note: After instantiation, modifiers keep internal state synced with external arguments.\n */\n constructor(owner: Owner, args: SelectArgs<T>) {\n super(owner, args);\n\n // Initialize based on mode\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = this.args.selectedKeys || [];\n } else {\n this._selectedKey =\n (this.args as ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T>)\n .selectedKey || null;\n }\n\n // Runtime warnings for incorrect API usage\n this.validateArgs();\n }\n\n validateArgs() {\n if (this.args.selectionMode === 'multiple') {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKey'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKey is not supported in multiple selection mode. Use selectedKeys instead.'\n );\n }\n } else {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKeys'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKeys is deprecated for single selection mode. Use selectedKey instead.'\n );\n }\n }\n }\n\n @tracked filterValue?: string;\n\n containerRef = ref<HTMLDivElement>();\n triggerRef = ref<HTMLInputElement | HTMLButtonElement>();\n chipsContainerRef = ref<HTMLDivElement>();\n\n /**\n * Handles selection changes from the Listbox component.\n *\n * **Flow:**\n * 1. Updates internal state (`_selectedKey` or `_selectedKeys`) for immediate UI updates\n * 2. Calls parent's `@onSelectionChange` callback to notify of the change\n * 3. Parent updates its state, which flows back via modifier to complete the cycle\n *\n * **Side effects:**\n * - Clears filter value (for searchable selects)\n * - Triggers form input event for native form integration\n *\n * @param keys - Array of selected keys from Listbox (converted to single value in single mode)\n */\n onSelectionChange = (keys: string[]) => {\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = keys;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (keys: string[]) => void)(keys);\n }\n } else {\n const singleKey: string | null = keys.length > 0 ? keys[0] || null : null;\n this._selectedKey = singleKey;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(\n singleKey\n );\n }\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n /**\n * Handles selection changes from the native <select> element.\n *\n * This is similar to `onSelectionChange` but accepts a single key directly\n * rather than an array, matching the native select's single-value API.\n *\n * **Flow:**\n * 1. Updates internal `_selectedKey` for immediate UI update\n * 2. Calls parent's `@onSelectionChange` callback\n *\n * @param key - The selected key, or null if cleared\n */\n onSingleSelectionChange = (key: string | null) => {\n this._selectedKey = key;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(key);\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n onOpenChange = (isOpen: boolean) => {\n this.isOpen = isOpen;\n };\n\n onFilterChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.filterValue = target.value;\n };\n\n /**\n * Backspace on an empty filter removes the last chip — the familiar tag-input\n * gesture. With text in the filter, Backspace edits the text as usual.\n */\n handleFilterKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'Backspace' || !this.showChips) {\n return;\n }\n const target = event.target as HTMLInputElement;\n if (target.value !== '') {\n return;\n }\n this.removeLastSelectedKey();\n };\n\n /**\n * The non-filterable counterpart of {@link handleFilterKeydown}.\n *\n * Chip close buttons are deliberately outside the tab order (they would\n * otherwise cost a Tab stop each before the combobox is reached), so\n * Backspace/Delete on the trigger is the *only* keyboard route to removing a\n * chip here. There is no text to edit on a button trigger, so both keys act\n * immediately; `preventDefault` keeps Backspace from navigating back.\n */\n handleTriggerKeydown = (event: KeyboardEvent) => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n if (event.key !== 'Backspace' && event.key !== 'Delete') {\n return;\n }\n event.preventDefault();\n this.removeLastSelectedKey();\n };\n\n /**\n * Removes the trailing chip. `removeSelectedKey` applies the same\n * `@allowEmpty` rule the chip close buttons follow, so the last required\n * selection stays put.\n */\n removeLastSelectedKey(): void {\n const items = this.selectedItems;\n const last = items[items.length - 1];\n if (last) {\n this.removeSelectedKey(last.key);\n }\n }\n\n /**\n * Returns current selection as an array for template rendering.\n *\n * Normalizes both single and multiple selection modes to a consistent array interface:\n * - Multiple mode: Returns `_selectedKeys` directly\n * - Single mode: Converts `_selectedKey` to array format (or empty array if null)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns Array of selected keys (empty array if none selected)\n */\n get selectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this._selectedKeys;\n } else {\n // Single mode: convert selectedKey to array for internal use\n const key = this.getSelectedKey;\n return key ? [key] : [];\n }\n }\n\n /**\n * Returns the selected key for single selection mode.\n *\n * **Returns:**\n * - Single mode: Returns `_selectedKey` (string or null)\n * - Multiple mode: Returns null (not applicable)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns The selected key, or null if none selected or in multiple mode\n */\n get getSelectedKey(): string | null {\n return this._selectedKey;\n }\n\n get blockScroll() {\n if (this.args.blockScroll === false) {\n return false;\n }\n return true;\n }\n\n get disableFocusTrap() {\n if (this.args.disableFocusTrap === false) {\n return false;\n }\n return true;\n }\n\n onAction = (key: string) => {\n if (typeof this.args.onAction === 'function') {\n this.args.onAction(key);\n }\n\n if (\n this.args.closeOnItemSelect !== false &&\n this.args.selectionMode !== 'multiple'\n ) {\n this.isOpen = false;\n }\n\n // Deliberately does not touch `@onBlur`. Selecting is not blurring: this\n // runs on every option click, including the ones that leave the dropdown\n // open in multiple selection mode. Focus loss is reported by\n // `blurTracker` instead, from the trigger's own `focusout`.\n };\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * dropdown -- rather than the trigger, which blurs on the way into the\n * dropdown and on every option click. See `ControlBlurTracker`.\n */\n blurTracker = new ControlBlurTracker({\n trigger: () => this.triggerRef.current,\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * In chips mode the trigger is only as wide as the room left over beside the\n * chips, so the field's padding -- and the strip under the chevron -- are not\n * part of it, and with a single selection the trigger can be a narrow sliver.\n * Without this, clicking anywhere else in the field would do nothing, while\n * the same click anywhere on a non-chips field opens the dropdown (there the\n * trigger *is* the whole field). Forwards such a click to the trigger,\n * including clicks on a chip's own body, so the whole field is a click\n * target. The one exception is a chip's close button: within the chips\n * container the only `<button>` elements a chip ever renders are its close\n * button (see chip.gts / close-button.gts), so `closest('button')` combined\n * with containment against `chipsContainerRef` identifies it without relying\n * on any test-only attribute. Clicks on the trigger itself are left alone\n * too, since it already handles its own clicks.\n */\n handleFieldClick = (event: MouseEvent): void => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n\n const trigger = this.triggerRef.current;\n const target = event.target;\n\n if (!trigger || !(target instanceof Element)) {\n return;\n }\n\n // The trigger handles its own clicks; this listener also sees them bubble.\n if (trigger === target || trigger.contains(target)) {\n return;\n }\n\n const chipsContainer = this.chipsContainerRef.current;\n\n if (chipsContainer && chipsContainer.contains(target)) {\n const closeButton = target.closest('button');\n if (closeButton && chipsContainer.contains(closeButton)) {\n return;\n }\n }\n\n trigger.focus();\n trigger.click();\n };\n\n /**\n * Wipes the selection from the clear button.\n *\n * Unlike the chips and the listbox options, this deliberately does *not*\n * consult `@allowEmpty`. `@allowEmpty` governs deselecting *an option* --\n * the listbox refuses to let the last one be toggled off, and\n * `chipsRemovable` mirrors that -- whereas `@isClearable` is a separate,\n * explicit affordance the consumer opts into for exactly this purpose. It\n * also defaults to `false`, so honouring it here would render the clear\n * button dead in every default configuration. Documented as an override on\n * `@isClearable` itself; the two must keep saying the same thing.\n *\n * A disabled Select renders no clear button at all (see `isClearable`), so\n * there is nothing to guard here.\n */\n clearSelectedKeys = () => {\n this.onSelectionChange([]);\n };\n\n /**\n * Resolved chip appearance: `@chip` wins, then the Select's own `@intent`,\n * then chip defaults tuned for sitting inside a field.\n */\n get chipOptions(): ResolvedSelectChipOptions {\n const chip =\n this.args.selectionMode === 'multiple' ? this.args.chip : undefined;\n return {\n appearance: chip?.appearance ?? 'faded',\n intent: chip?.intent ?? this.args.intent ?? 'default',\n size: chip?.size ?? 'sm',\n radius: chip?.radius,\n withDot: chip?.withDot ?? false\n };\n }\n\n /**\n * Whether chips may be removed. Mirrors the listbox: with `@allowEmpty`\n * false — the default — the final selection cannot be deselected, so its\n * chip renders without a close button rather than with a dead one.\n */\n get chipsRemovable(): boolean {\n // Asks `canDeselectKey` — the rule the listbox itself applies when an\n // already-selected option is clicked — rather than restating it, so a chip\n // and its option can never disagree about the same removal.\n //\n // Asked of `selectedItems`, the collection the chips render from, so the\n // decision cannot disagree with what is on screen either (a selected key\n // with no remembered item would otherwise be counted but never render a\n // chip at all). Every chip's key is in that collection by construction, so\n // the rule's answer is the same for all of them; it is asked of the last\n // chip, the one Backspace removes.\n const keys = this.selectedItems.map((item) => item.key);\n const lastKey = keys[keys.length - 1];\n\n // With nothing selected there is no chip, so nothing reads this today --\n // but the answer is deliberately `@allowEmpty`, not `false`. That is what\n // this getter has always returned for an empty selection, and keeping it\n // means the answer never depends on whether a chip happens to exist right\n // now. `canDeselectKey` cannot be asked here (it needs a key), so the\n // empty case is answered directly. Do not \"simplify\" this away.\n if (lastKey === undefined) {\n return this.args.allowEmpty === true;\n }\n\n return canDeselectKey(keys, lastKey, this.args.allowEmpty);\n }\n\n /**\n * Removes a single selection from a chip's close button. Routes through\n * `onSelectionChange`, which already syncs internal state, notifies the\n * parent and dispatches the form input event.\n */\n removeSelectedKey = (key: string) => {\n if (this.args.isDisabled || !this.chipsRemovable) {\n return;\n }\n this.onSelectionChange(this.selectedKeys.filter((k) => k !== key));\n };\n\n onItemsChange = (nodes: ListItem[], _: 'add' | 'remove') => {\n // `onItemsChange` runs while a modifier installs, i.e. inside a render\n // pass. Reading a tracked field here and writing it in the same\n // computation would trip Glimmer's read-then-write assertion, so `nodes`\n // is only ever written, never read, in this callback.\n this.nodes = nodes;\n };\n\n didClose = () => {\n this.filterValue = undefined;\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n };\n\n /**\n * Whether selections render as chips. Chips are the default presentation for\n * multiple selection mode; `@selectedItemsDisplay=\"text\"` opts back out to the\n * comma-joined string.\n */\n get showChips(): boolean {\n return (\n this.args.selectionMode === 'multiple' &&\n this.args.selectedItemsDisplay !== 'text'\n );\n }\n\n get hasSelection(): boolean {\n return this.selectedKeys.length > 0;\n }\n\n /**\n * The accessible name for the trigger when its own text cannot supply one.\n *\n * Left to itself the trigger names itself from its own text -- the selected\n * label, or the placeholder -- and that is still what happens in the plain\n * case; see the trigger, which only applies this when it has to.\n *\n * Two cases need it:\n *\n * - **Chips mode.** The trigger renders nothing; the chips are its siblings\n * and are read separately. Naming the *control* is both enough and\n * correct here -- appending the selection would have it read twice -- so\n * this returns the bare name.\n * - **A `:selectedItem` block.** The block owns the trigger's content and may\n * render nothing readable at all (an avatar, an icon), which would leave\n * the combobox announced as an unnamed button. The selection is not\n * readable anywhere else in that case, so the name carries it: the control\n * name *and* the selected options' text.\n *\n * The two halves are composed so that the separator only appears when both\n * are there. A selected key with no registered option behind it resolves to\n * no text at all, and `\"Owner, \"` is announced as \"Owner comma\"; and with\n * neither `@label` nor `@placeholder` the only control name available is the\n * hardcoded, unlocalizable `Select options`, so the selected text is left to\n * name the control on its own rather than be prefixed by English.\n */\n get triggerAccessibleName(): string {\n const name = this.args.label || this.args.placeholder;\n\n // Chips mode names the *control* only -- the chips are read separately --\n // and has no better fallback than the literal.\n if (this.showChips) {\n return name || 'Select options';\n }\n\n const selectedText = this.hasSelection ? this.selectedTextValue : '';\n\n if (!name) {\n return selectedText || 'Select options';\n }\n\n return selectedText ? `${name}, ${selectedText}` : name;\n }\n\n /**\n * The selected options in item order (not click order) so chips do not\n * reorder underneath the user as they select.\n *\n * Resolved against `nodes`, which the hidden native `<select>` populates from\n * the unfiltered `@items`, so a chip stays put while a filter hides the item\n * it came from.\n */\n get selectedItems(): SelectedItem[] {\n const keys = this.selectedKeys;\n return this.nodes\n .filter((node) => keys.includes(node.key))\n .map((node) => ({\n key: node.key,\n textValue: node.textValue,\n item: node.item\n }));\n }\n\n /**\n * The same selection `selectedItems` describes, rendered as text.\n *\n * Chips and this string are two presentations of one thing, so they read one\n * projection: walking `nodes` a second time here is how a fix to the\n * selection's contents once landed in the chips and not in the text.\n */\n get selectedTextValue(): string {\n return this.selectedItems.map((item) => item.textValue).join(', ');\n }\n\n get backdrop() {\n if (typeof this.args.backdrop === 'undefined') {\n return 'transparent';\n }\n return this.args.backdrop;\n }\n\n get classes() {\n const { select } = useStyles();\n return select({\n size: this.args.inputSize,\n hasChips: this.showChips,\n isFilterable: !!this.args.isFilterable\n });\n }\n\n /**\n * Whether the clear button takes the chevron's place: something to clear,\n * and a control that can act on it. A disabled Select never shows it -- the\n * end-content cluster is not pointer-transparent to it and it carries no\n * disabled state of its own, so it would otherwise be a focusable button\n * that clears a field the user is not allowed to change.\n */\n get isClearable() {\n return (\n this.args.isClearable &&\n !this.args.isDisabled &&\n this.selectedKeys &&\n this.selectedKeys.length > 0\n );\n }\n\n get filterFieldValue() {\n if (this.filterValue !== undefined) {\n return this.filterValue;\n }\n // With chips, the selection is already visible beside the input. Echoing\n // the joined text here would fill the box and block typing.\n if (this.showChips) {\n return '';\n }\n return this.selectedTextValue;\n }\n\n get filteredItems() {\n if (this.filterValue === undefined) {\n return this.args.items;\n }\n\n return filterAndRankItems(\n this.args.items,\n this.filterValue || '',\n (item) => keyAndLabelForItem(item).label,\n this.args.filter\n );\n }\n\n get showEmptyContent() {\n return this.filteredItems?.length === 0 && !this.args.hideEmptyContent;\n }\n\n get autoActivateMode(): 'first' | 'selected' {\n if (this.filterValue === undefined || this.filterValue === '') {\n return 'selected';\n }\n return 'first';\n }\n\n /**\n * Syncs internal `_selectedKeys` with external `@selectedKeys` argument.\n *\n * Runs whenever `@selectedKeys` changes:\n * - Updates `_selectedKeys` to match the new external value\n * - Normalizes undefined/null to empty array\n *\n * This enables UI updates when the external value changes.\n */\n updateMultipleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKeys]: [string[] | null | undefined]) => {\n if (selectedKeys !== undefined && selectedKeys !== null) {\n this._selectedKeys = selectedKeys;\n } else {\n // NOTE: is this the right behavior?\n this._selectedKeys = [];\n }\n }\n );\n\n /**\n * Syncs internal `_selectedKey` with external `@selectedKey` argument.\n *\n * Runs whenever `@selectedKey` changes:\n * - Updates `_selectedKey` to match the new external value\n * - Handles null values for cleared selections\n *\n * This enables UI updates when the external value changes.\n */\n updateSingleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKey]: [string | null | undefined]) => {\n if (selectedKey !== undefined) {\n this._selectedKey = selectedKey;\n }\n }\n );\n\n <template>\n <div\n {{this.updateMultipleSelectValue @selectedKeys}}\n {{this.updateSingleSelectValue @selectedKey}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"select\"\n data-part=\"base\"\n ...attributes\n >\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{this.didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <VisuallyHidden>\n <SelectNativeMirror\n @items={{@items}}\n @allowEmpty={{@allowEmpty}}\n @disabledKeys={{@disabledKeys}}\n @selectionMode={{@selectionMode}}\n @selectedKeys={{this.selectedKeys}}\n @selectedKey={{this.getSelectedKey}}\n @onSelectionChange={{this.onSelectionChange}}\n @onSingleSelectionChange={{this.onSingleSelectionChange}}\n @onItemsChange={{this.onItemsChange}}\n @placeholder={{@placeholder}}\n @id={{c.id}}\n @name={{@name}}\n @isDisabled={{@isDisabled}}\n >\n <:default as |l|>\n {{! @glint-expect-error: the signature of the native select is not the same as the listbox}}\n {{yield l to=\"default\"}}\n </:default>\n </SelectNativeMirror>\n </VisuallyHidden>\n\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{! The wrapper, not the trigger, is the popover's width reference:\n in chips mode the trigger is only as wide as the space left over\n inside the field. The wrapper is a real full-width box in both\n modes, so the dropdown matches the field either way. }}\n <div\n {{p.anchor}}\n {{p.measureWidth}}\n {{on \"click\" this.handleFieldClick}}\n data-test-id={{if this.showChips \"chips-field\"}}\n data-part=\"chips-field\"\n {{! These flags are stringified rather than handed the boolean.\n Glimmer renders a true boolean attribute as an empty value, so\n passing isInvalid straight through produced an empty data-invalid\n and the theme selector keyed on the value true never matched. }}\n data-has-chips={{if this.showChips \"true\" \"false\"}}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n class={{this.classes.chipsField\n class=@classes.chipsField\n hasStartContent=(has-block \"startContent\")\n hasEndContent=true\n }}\n >\n {{#if (and this.showChips this.hasSelection)}}\n {{! A block cannot be passed conditionally in Glimmer, so the\n :item block below is always supplied and the branch lives\n inside it: with no :selectedItem block from the consumer, both\n it and the trigger render exactly what they rendered before. }}\n <SelectedChips\n @containerRef={{this.chipsContainerRef.setup}}\n @items={{this.selectedItems}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @chipOptions={{this.chipOptions}}\n @isDisabled={{@isDisabled}}\n @isRemovable={{this.chipsRemovable}}\n @onRemove={{this.removeSelectedKey}}\n >\n <:item as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:item>\n </SelectedChips>\n {{/if}}\n <SelectTrigger\n @isFilterable={{@isFilterable}}\n @trigger={{p.trigger}}\n @triggerRef={{this.triggerRef.setup}}\n @isDisabled={{@isDisabled}}\n @showChips={{this.showChips}}\n @accessibleName={{this.triggerAccessibleName}}\n @placeholder={{@placeholder}}\n @hasSelection={{this.hasSelection}}\n @hasStartContent={{has-block \"startContent\"}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @items={{this.selectedItems}}\n @filterValue={{this.filterFieldValue}}\n @onFilterInput={{this.onFilterChange}}\n @onFilterKeydown={{this.handleFilterKeydown}}\n @onKeydown={{this.handleTriggerKeydown}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n @hasCustomContent={{has-block \"selectedItem\"}}\n >\n <:selectedItem as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:selectedItem>\n </SelectTrigger>\n </div>\n <SelectEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{@endContentPointerEvents}}\n @inputSize={{@inputSize}}\n @isLoading={{@isLoading}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clearSelectedKeys}}\n >\n {{yield to=\"endContent\"}}\n </SelectEndContent>\n </div>\n\n <p.Content\n @size={{if @popoverSize @popoverSize \"trigger\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @disableFocusTrap={{this.disableFocusTrap}}\n @blockScroll={{this.blockScroll}}\n @transitionDuration={{@transitionDuration}}\n @backdrop={{this.backdrop}}\n @disableTransitions={{@disableTransitions}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @transition={{@transition}}\n @preventAutoFocus={{true}}\n >\n <Listbox\n @items={{this.filteredItems}}\n @allowEmpty={{@allowEmpty}}\n @appearance={{@appearance}}\n @disabledKeys={{@disabledKeys}}\n @intent={{@intent}}\n @isKeyboardEventsEnabled={{true}}\n @onAction={{this.onAction}}\n @onSelectionChange={{this.onSelectionChange}}\n @selectedKeys={{this.selectedKeys}}\n @selectionMode={{if @selectionMode @selectionMode \"single\"}}\n @type=\"listbox\"\n @class={{this.classes.listbox class=@classes.listbox}}\n @elementToAddKeyboardEvents={{this.triggerRef.current}}\n @autoActivateMode={{this.autoActivateMode}}\n data-part=\"listbox\"\n >\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item\n @key={{l.key}}\n @appearance={{@appearance}}\n @intent={{@intent}}\n >\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if this.showEmptyContent}}\n <div\n class={{this.classes.emptyContent class=@classes.emptyContent}}\n data-part=\"empty-content\"\n >\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport {\n Select,\n type SelectSignature,\n type SelectChipOptions,\n type SelectedItem,\n type SelectedItemBlockArg\n};\nexport default Select;\n"],"names":["and","a","b","Boolean","Select","Component","g","prototype","tracked","i","constructor","owner","args","selectionMode","_selectedKeys","selectedKeys","_selectedKey","selectedKey","validateArgs","console","warn","containerRef","ref","triggerRef","chipsContainerRef","onSelectionChange","keys","singleKey","length","filterValue","undefined","triggerFormInputEvent","current","onSingleSelectionChange","key","onOpenChange","isOpen","onFilterChange","event","target","value","handleFilterKeydown","showChips","removeLastSelectedKey","handleTriggerKeydown","isDisabled","preventDefault","items","selectedItems","last","removeSelectedKey","getSelectedKey","blockScroll","disableFocusTrap","onAction","closeOnItemSelect","blurTracker","ControlBlurTracker","trigger","container","isDestroyed","isDestroying","onBlur","willDestroy","cancel","handleFieldClick","Element","contains","chipsContainer","closeButton","closest","focus","click","clearSelectedKeys","chipOptions","chip","appearance","intent","size","radius","withDot","chipsRemovable","map","item","lastKey","allowEmpty","canDeselectKey","filter","k","onItemsChange","nodes","_","didClose","selectedItemsDisplay","hasSelection","triggerAccessibleName","name","label","placeholder","selectedText","selectedTextValue","node","includes","textValue","join","backdrop","classes","select","useStyles","inputSize","hasChips","isFilterable","isClearable","filterFieldValue","filteredItems","filterAndRankItems","keyAndLabelForItem","showEmptyContent","hideEmptyContent","autoActivateMode","updateMultipleSelectValue","modifier","updateSingleSelectValue","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Popover","VisuallyHidden","SelectNativeMirror","on","SelectedChips","SelectTrigger","SelectEndContent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AA;AACtB,IAAA;AACF,EAAA,CAAA,CAAA;AAGF,EAAA;IAAA0G,oBAAA,CAAAC,kBAAA,CAAA,q/NAAA,EAmOA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,cAAA;QAAAC,kBAAA;QAAAC,EAAA;QAAAnI,GAAA;QAAAoI,aAAA;QAAAC,aAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"select.js","sources":["../../../../src/components/forms/select/select.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport type Owner from '@ember/owner';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\nimport { renamedArgValue } from '../../../-private/deprecated-args';\n\nimport type { ListItem } from '../native-select';\nimport { Listbox } from '../../collections/listbox';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { Popover } from '../../overlays/popover';\nimport { FormControl } from '../form-control';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport { canDeselectKey, keyAndLabelForItem } from '../../../utils/listManager';\nimport { filterAndRankItems } from '../../../utils/filter';\n\nimport { SelectNativeMirror } from './native-mirror';\nimport { SelectTrigger } from './trigger';\nimport { SelectedChips } from './selected-items';\nimport { SelectEndContent } from './end-content';\nimport type {\n DefaultSingleSelectArgs,\n ExplicitSingleSelectArgs,\n ResolvedSelectChipOptions,\n SelectArgs,\n SelectChipOptions,\n SelectSignature,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n// Import helper function directly instead of using ember-truth-helpers\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\n\n/*\n * Internal: selection state architecture\n *\n * This component uses a **two-way data binding pattern** for managing selection state:\n *\n * ### Data Flow\n * 1. **External → Internal (Initialization & Updates)**\n * - Parent passes `@selectedKey` or `@selectedKeys` as arguments\n * - Constructor initializes internal tracked properties (`_selectedKey` or `_selectedKeys`)\n * - Modifiers (`updateSingleSelectValue`, `updateMultipleSelectValue`) sync internal state\n * when parent updates the arguments\n *\n * 2. **Internal State Management**\n * - `_selectedKey` / `_selectedKeys`: Internal tracked state (prefixed with underscore)\n * - These serve as the \"source of truth\" for rendering and reactivity\n * - Getters (`getSelectedKey`, `selectedKeys`) expose this internal state to the template\n *\n * 3. **Internal → External (User Interactions)**\n * - User interactions trigger selection change handlers\n * - Handlers update internal `_selectedKey` / `_selectedKeys` for immediate UI update\n * - Handlers call parent's `@onSelectionChange` callback to notify of state change\n * - Parent updates its state, which flows back through step 1\n *\n * ### Why Both Internal State AND Callbacks?\n * - **Internal state:** Enables immediate, responsive UI updates (`_selectedKey` / `_selectedKeys`)\n * - **Parent callback:** Enables parent to take action when changes occur (`@onSelectionChange`)\n * - This pattern provides both responsive UX and parent inclusion over state\n *\n * ### Example Flow\n * ```\n * User clicks item\n * → onSelectionChange handler\n * → Updates _selectedKey (immediate UI update)\n * → Calls parent's @onSelectionChange callback\n * → Parent updates its @selectedKey state\n * → updateSingleSelectValue modifier syncs _selectedKey with new arg value\n * ```\n */\n/**\n * A dropdown selection component: a custom listbox in a popover, backed by a\n * visually hidden native `<select>` so the value submits with a form.\n *\n * Selection can be controlled with `@selectedKey` / `@selectedKeys` plus\n * `@onSelectionChange`, or left uncontrolled.\n */\nclass Select<T = unknown> extends Component<SelectSignature<T>> {\n /**\n * Every item registered by the hidden native `<select>`, in item order.\n *\n * The hidden select is deliberately given the *unfiltered* `@items` — it\n * carries the form value, which must not shrink to the filter — so this\n * covers the whole list even while the listbox is filtered down. Chips and\n * the joined text value can therefore be resolved straight from it.\n */\n @tracked nodes: ListItem[] = [];\n\n @tracked isOpen = false;\n /**\n * Internal tracked state for single selection mode.\n * Source of truth for rendering. Synced with @selectedKey via the updateSingleSelectValue modifier.\n */\n @tracked _selectedKey: string | null = null;\n\n /**\n * Internal tracked state for multiple selection mode.\n * Source of truth for rendering. Synced with @selectedKeys via the updateMultipleSelectValue modifier.\n */\n @tracked _selectedKeys: string[] = [];\n\n /**\n * Initializes the component and sets up initial selection state.\n *\n * **Initialization:**\n * 1. Determines selection mode (single vs multiple)\n * 2. Copies external arg values (@selectedKey or @selectedKeys) to internal tracked state\n * 3. Logs warnings if incorrect args are used for the selection mode\n *\n * Note: After instantiation, modifiers keep internal state synced with external arguments.\n */\n constructor(owner: Owner, args: SelectArgs<T>) {\n super(owner, args);\n\n // Initialize based on mode\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = this.args.selectedKeys || [];\n } else {\n this._selectedKey =\n (this.args as ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T>)\n .selectedKey || null;\n }\n\n // Runtime warnings for incorrect API usage\n this.validateArgs();\n }\n\n validateArgs() {\n if (this.args.selectionMode === 'multiple') {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKey'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKey is not supported in multiple selection mode. Use selectedKeys instead.'\n );\n }\n } else {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKeys'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKeys is deprecated for single selection mode. Use selectedKey instead.'\n );\n }\n }\n }\n\n @tracked filterValue?: string;\n\n containerRef = ref<HTMLDivElement>();\n triggerRef = ref<HTMLInputElement | HTMLButtonElement>();\n chipsContainerRef = ref<HTMLDivElement>();\n\n /**\n * Handles selection changes from the Listbox component.\n *\n * **Flow:**\n * 1. Updates internal state (`_selectedKey` or `_selectedKeys`) for immediate UI updates\n * 2. Calls parent's `@onSelectionChange` callback to notify of the change\n * 3. Parent updates its state, which flows back via modifier to complete the cycle\n *\n * **Side effects:**\n * - Clears filter value (for searchable selects)\n * - Triggers form input event for native form integration\n *\n * @param keys - Array of selected keys from Listbox (converted to single value in single mode)\n */\n onSelectionChange = (keys: string[]) => {\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = keys;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (keys: string[]) => void)(keys);\n }\n } else {\n const singleKey: string | null = keys.length > 0 ? keys[0] || null : null;\n this._selectedKey = singleKey;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(\n singleKey\n );\n }\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n /**\n * Handles selection changes from the native <select> element.\n *\n * This is similar to `onSelectionChange` but accepts a single key directly\n * rather than an array, matching the native select's single-value API.\n *\n * **Flow:**\n * 1. Updates internal `_selectedKey` for immediate UI update\n * 2. Calls parent's `@onSelectionChange` callback\n *\n * @param key - The selected key, or null if cleared\n */\n onSingleSelectionChange = (key: string | null) => {\n this._selectedKey = key;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(key);\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n onOpenChange = (isOpen: boolean) => {\n this.isOpen = isOpen;\n };\n\n onFilterChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.filterValue = target.value;\n };\n\n /**\n * Backspace on an empty filter removes the last chip — the familiar tag-input\n * gesture. With text in the filter, Backspace edits the text as usual.\n */\n handleFilterKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'Backspace' || !this.showChips) {\n return;\n }\n const target = event.target as HTMLInputElement;\n if (target.value !== '') {\n return;\n }\n this.removeLastSelectedKey();\n };\n\n /**\n * The non-filterable counterpart of {@link handleFilterKeydown}.\n *\n * Chip close buttons are deliberately outside the tab order (they would\n * otherwise cost a Tab stop each before the combobox is reached), so\n * Backspace/Delete on the trigger is the *only* keyboard route to removing a\n * chip here. There is no text to edit on a button trigger, so both keys act\n * immediately; `preventDefault` keeps Backspace from navigating back.\n */\n handleTriggerKeydown = (event: KeyboardEvent) => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n if (event.key !== 'Backspace' && event.key !== 'Delete') {\n return;\n }\n event.preventDefault();\n this.removeLastSelectedKey();\n };\n\n /**\n * Removes the trailing chip. `removeSelectedKey` applies the same\n * `@allowEmpty` rule the chip close buttons follow, so the last required\n * selection stays put.\n */\n removeLastSelectedKey(): void {\n const items = this.selectedItems;\n const last = items[items.length - 1];\n if (last) {\n this.removeSelectedKey(last.key);\n }\n }\n\n /**\n * Returns current selection as an array for template rendering.\n *\n * Normalizes both single and multiple selection modes to a consistent array interface:\n * - Multiple mode: Returns `_selectedKeys` directly\n * - Single mode: Converts `_selectedKey` to array format (or empty array if null)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns Array of selected keys (empty array if none selected)\n */\n get selectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this._selectedKeys;\n } else {\n // Single mode: convert selectedKey to array for internal use\n const key = this.getSelectedKey;\n return key ? [key] : [];\n }\n }\n\n /**\n * Returns the selected key for single selection mode.\n *\n * **Returns:**\n * - Single mode: Returns `_selectedKey` (string or null)\n * - Multiple mode: Returns null (not applicable)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns The selected key, or null if none selected or in multiple mode\n */\n get getSelectedKey(): string | null {\n return this._selectedKey;\n }\n\n get blockScroll() {\n if (this.args.blockScroll === false) {\n return false;\n }\n return true;\n }\n\n get disableFocusTrap() {\n if (this.args.disableFocusTrap === false) {\n return false;\n }\n return true;\n }\n\n onAction = (key: string) => {\n if (typeof this.args.onAction === 'function') {\n this.args.onAction(key);\n }\n\n if (\n this.args.closeOnItemSelect !== false &&\n this.args.selectionMode !== 'multiple'\n ) {\n this.isOpen = false;\n }\n\n // Deliberately does not touch `@onBlur`. Selecting is not blurring: this\n // runs on every option click, including the ones that leave the dropdown\n // open in multiple selection mode. Focus loss is reported by\n // `blurTracker` instead, from the trigger's own `focusout`.\n };\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * dropdown -- rather than the trigger, which blurs on the way into the\n * dropdown and on every option click. See `ControlBlurTracker`.\n */\n blurTracker = new ControlBlurTracker({\n trigger: () => this.triggerRef.current,\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * In chips mode the trigger is only as wide as the room left over beside the\n * chips, so the field's padding -- and the strip under the chevron -- are not\n * part of it, and with a single selection the trigger can be a narrow sliver.\n * Without this, clicking anywhere else in the field would do nothing, while\n * the same click anywhere on a non-chips field opens the dropdown (there the\n * trigger *is* the whole field). Forwards such a click to the trigger,\n * including clicks on a chip's own body, so the whole field is a click\n * target. The one exception is a chip's close button: within the chips\n * container the only `<button>` elements a chip ever renders are its close\n * button (see chip.gts / close-button.gts), so `closest('button')` combined\n * with containment against `chipsContainerRef` identifies it without relying\n * on any test-only attribute. Clicks on the trigger itself are left alone\n * too, since it already handles its own clicks.\n */\n handleFieldClick = (event: MouseEvent): void => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n\n const trigger = this.triggerRef.current;\n const target = event.target;\n\n if (!trigger || !(target instanceof Element)) {\n return;\n }\n\n // The trigger handles its own clicks; this listener also sees them bubble.\n if (trigger === target || trigger.contains(target)) {\n return;\n }\n\n const chipsContainer = this.chipsContainerRef.current;\n\n if (chipsContainer && chipsContainer.contains(target)) {\n const closeButton = target.closest('button');\n if (closeButton && chipsContainer.contains(closeButton)) {\n return;\n }\n }\n\n trigger.focus();\n trigger.click();\n };\n\n /**\n * Wipes the selection from the clear button.\n *\n * Unlike the chips and the listbox options, this deliberately does *not*\n * consult `@allowEmpty`. `@allowEmpty` governs deselecting *an option* --\n * the listbox refuses to let the last one be toggled off, and\n * `chipsRemovable` mirrors that -- whereas `@isClearable` is a separate,\n * explicit affordance the consumer opts into for exactly this purpose. It\n * also defaults to `false`, so honouring it here would render the clear\n * button dead in every default configuration. Documented as an override on\n * `@isClearable` itself; the two must keep saying the same thing.\n *\n * A disabled Select renders no clear button at all (see `isClearable`), so\n * there is nothing to guard here.\n */\n clearSelectedKeys = () => {\n this.onSelectionChange([]);\n };\n\n /**\n * Resolved once (`@cached`) and forwarded to the internal `Listbox` as\n * `@variant` only -- never `@appearance` as well, which would make the\n * inner `Listbox` raise its own deprecation for the same usage.\n */\n @cached\n get variant() {\n return renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'subtle' } as const,\n {\n component: 'Select',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.select.appearance'\n }\n );\n }\n\n /**\n * Resolved once (`@cached`) and forwarded to the internal `Listbox` as\n * `@color` only -- never `@intent` as well, which would make the inner\n * `Listbox` raise its own deprecation for the same usage.\n */\n @cached\n get color() {\n return renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Select',\n from: 'intent',\n to: 'color',\n id: 'frontile.select.intent'\n }\n );\n }\n\n /**\n * Resolved chip appearance: `@chip` wins, then the Select's own `@color`\n * (or deprecated `@intent`), then chip defaults tuned for sitting inside a\n * field.\n */\n get chipOptions(): ResolvedSelectChipOptions {\n const chip =\n this.args.selectionMode === 'multiple' ? this.args.chip : undefined;\n return {\n // `appearance` is passed through only when the consumer set it. Giving\n // it a default would make Chip's deprecation fire on every chip render.\n variant: chip?.variant ?? (chip?.appearance ? undefined : 'soft'),\n appearance: chip?.appearance,\n // `intent` is passed through only when the consumer (or Select's own\n // deprecated `@intent`) actually set it. Defaulting it would fire\n // Chip's `intent` deprecation on every chip render, for a prop nobody\n // wrote.\n color:\n chip?.color ??\n this.args.color ??\n ((chip?.intent ?? this.args.intent) ? undefined : 'neutral'),\n intent: chip?.intent ?? this.args.intent,\n size: chip?.size ?? 'sm',\n radius: chip?.radius,\n withDot: chip?.withDot ?? false\n };\n }\n\n /**\n * Whether chips may be removed. Mirrors the listbox: with `@allowEmpty`\n * false — the default — the final selection cannot be deselected, so its\n * chip renders without a close button rather than with a dead one.\n */\n get chipsRemovable(): boolean {\n // Asks `canDeselectKey` — the rule the listbox itself applies when an\n // already-selected option is clicked — rather than restating it, so a chip\n // and its option can never disagree about the same removal.\n //\n // Asked of `selectedItems`, the collection the chips render from, so the\n // decision cannot disagree with what is on screen either (a selected key\n // with no remembered item would otherwise be counted but never render a\n // chip at all). Every chip's key is in that collection by construction, so\n // the rule's answer is the same for all of them; it is asked of the last\n // chip, the one Backspace removes.\n const keys = this.selectedItems.map((item) => item.key);\n const lastKey = keys[keys.length - 1];\n\n // With nothing selected there is no chip, so nothing reads this today --\n // but the answer is deliberately `@allowEmpty`, not `false`. That is what\n // this getter has always returned for an empty selection, and keeping it\n // means the answer never depends on whether a chip happens to exist right\n // now. `canDeselectKey` cannot be asked here (it needs a key), so the\n // empty case is answered directly. Do not \"simplify\" this away.\n if (lastKey === undefined) {\n return this.args.allowEmpty === true;\n }\n\n return canDeselectKey(keys, lastKey, this.args.allowEmpty);\n }\n\n /**\n * Removes a single selection from a chip's close button. Routes through\n * `onSelectionChange`, which already syncs internal state, notifies the\n * parent and dispatches the form input event.\n */\n removeSelectedKey = (key: string) => {\n if (this.args.isDisabled || !this.chipsRemovable) {\n return;\n }\n this.onSelectionChange(this.selectedKeys.filter((k) => k !== key));\n };\n\n onItemsChange = (nodes: ListItem[], _: 'add' | 'remove') => {\n // `onItemsChange` runs while a modifier installs, i.e. inside a render\n // pass. Reading a tracked field here and writing it in the same\n // computation would trip Glimmer's read-then-write assertion, so `nodes`\n // is only ever written, never read, in this callback.\n this.nodes = nodes;\n };\n\n didClose = () => {\n this.filterValue = undefined;\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n };\n\n /**\n * Whether selections render as chips. Chips are the default presentation for\n * multiple selection mode; `@selectedItemsDisplay=\"text\"` opts back out to the\n * comma-joined string.\n */\n get showChips(): boolean {\n return (\n this.args.selectionMode === 'multiple' &&\n this.args.selectedItemsDisplay !== 'text'\n );\n }\n\n get hasSelection(): boolean {\n return this.selectedKeys.length > 0;\n }\n\n /**\n * The accessible name for the trigger when its own text cannot supply one.\n *\n * Left to itself the trigger names itself from its own text -- the selected\n * label, or the placeholder -- and that is still what happens in the plain\n * case; see the trigger, which only applies this when it has to.\n *\n * Two cases need it:\n *\n * - **Chips mode.** The trigger renders nothing; the chips are its siblings\n * and are read separately. Naming the *control* is both enough and\n * correct here -- appending the selection would have it read twice -- so\n * this returns the bare name.\n * - **A `:selectedItem` block.** The block owns the trigger's content and may\n * render nothing readable at all (an avatar, an icon), which would leave\n * the combobox announced as an unnamed button. The selection is not\n * readable anywhere else in that case, so the name carries it: the control\n * name *and* the selected options' text.\n *\n * The two halves are composed so that the separator only appears when both\n * are there. A selected key with no registered option behind it resolves to\n * no text at all, and `\"Owner, \"` is announced as \"Owner comma\"; and with\n * neither `@label` nor `@placeholder` the only control name available is the\n * hardcoded, unlocalizable `Select options`, so the selected text is left to\n * name the control on its own rather than be prefixed by English.\n */\n get triggerAccessibleName(): string {\n const name = this.args.label || this.args.placeholder;\n\n // Chips mode names the *control* only -- the chips are read separately --\n // and has no better fallback than the literal.\n if (this.showChips) {\n return name || 'Select options';\n }\n\n const selectedText = this.hasSelection ? this.selectedTextValue : '';\n\n if (!name) {\n return selectedText || 'Select options';\n }\n\n return selectedText ? `${name}, ${selectedText}` : name;\n }\n\n /**\n * The selected options in item order (not click order) so chips do not\n * reorder underneath the user as they select.\n *\n * Resolved against `nodes`, which the hidden native `<select>` populates from\n * the unfiltered `@items`, so a chip stays put while a filter hides the item\n * it came from.\n */\n get selectedItems(): SelectedItem[] {\n const keys = this.selectedKeys;\n return this.nodes\n .filter((node) => keys.includes(node.key))\n .map((node) => ({\n key: node.key,\n textValue: node.textValue,\n item: node.item\n }));\n }\n\n /**\n * The same selection `selectedItems` describes, rendered as text.\n *\n * Chips and this string are two presentations of one thing, so they read one\n * projection: walking `nodes` a second time here is how a fix to the\n * selection's contents once landed in the chips and not in the text.\n */\n get selectedTextValue(): string {\n return this.selectedItems.map((item) => item.textValue).join(', ');\n }\n\n get backdrop() {\n if (typeof this.args.backdrop === 'undefined') {\n return 'transparent';\n }\n return this.args.backdrop;\n }\n\n get classes() {\n const { select } = useStyles();\n // Referenced here, on the always-rendered root, so `@appearance`/\n // `@variant` (and `@intent`/`@color`) raises its deprecation regardless\n // of whether the popover content (and so the internal `Listbox`) is\n // currently mounted.\n void this.variant;\n void this.color;\n return select({\n size: this.args.inputSize,\n hasChips: this.showChips,\n isFilterable: !!this.args.isFilterable\n });\n }\n\n /**\n * Whether the clear button takes the chevron's place: something to clear,\n * and a control that can act on it. A disabled Select never shows it -- the\n * end-content cluster is not pointer-transparent to it and it carries no\n * disabled state of its own, so it would otherwise be a focusable button\n * that clears a field the user is not allowed to change.\n */\n get isClearable() {\n return (\n this.args.isClearable &&\n !this.args.isDisabled &&\n this.selectedKeys &&\n this.selectedKeys.length > 0\n );\n }\n\n get filterFieldValue() {\n if (this.filterValue !== undefined) {\n return this.filterValue;\n }\n // With chips, the selection is already visible beside the input. Echoing\n // the joined text here would fill the box and block typing.\n if (this.showChips) {\n return '';\n }\n return this.selectedTextValue;\n }\n\n get filteredItems() {\n if (this.filterValue === undefined) {\n return this.args.items;\n }\n\n return filterAndRankItems(\n this.args.items,\n this.filterValue || '',\n (item) => keyAndLabelForItem(item).label,\n this.args.filter\n );\n }\n\n get showEmptyContent() {\n return this.filteredItems?.length === 0 && !this.args.hideEmptyContent;\n }\n\n get autoActivateMode(): 'first' | 'selected' {\n if (this.filterValue === undefined || this.filterValue === '') {\n return 'selected';\n }\n return 'first';\n }\n\n /**\n * Syncs internal `_selectedKeys` with external `@selectedKeys` argument.\n *\n * Runs whenever `@selectedKeys` changes:\n * - Updates `_selectedKeys` to match the new external value\n * - Normalizes undefined/null to empty array\n *\n * This enables UI updates when the external value changes.\n */\n updateMultipleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKeys]: [string[] | null | undefined]) => {\n if (selectedKeys !== undefined && selectedKeys !== null) {\n this._selectedKeys = selectedKeys;\n } else {\n // NOTE: is this the right behavior?\n this._selectedKeys = [];\n }\n }\n );\n\n /**\n * Syncs internal `_selectedKey` with external `@selectedKey` argument.\n *\n * Runs whenever `@selectedKey` changes:\n * - Updates `_selectedKey` to match the new external value\n * - Handles null values for cleared selections\n *\n * This enables UI updates when the external value changes.\n */\n updateSingleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKey]: [string | null | undefined]) => {\n if (selectedKey !== undefined) {\n this._selectedKey = selectedKey;\n }\n }\n );\n\n <template>\n <div\n {{this.updateMultipleSelectValue @selectedKeys}}\n {{this.updateSingleSelectValue @selectedKey}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"select\"\n data-part=\"base\"\n ...attributes\n >\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{this.didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <VisuallyHidden>\n <SelectNativeMirror\n @items={{@items}}\n @allowEmpty={{@allowEmpty}}\n @disabledKeys={{@disabledKeys}}\n @selectionMode={{@selectionMode}}\n @selectedKeys={{this.selectedKeys}}\n @selectedKey={{this.getSelectedKey}}\n @onSelectionChange={{this.onSelectionChange}}\n @onSingleSelectionChange={{this.onSingleSelectionChange}}\n @onItemsChange={{this.onItemsChange}}\n @placeholder={{@placeholder}}\n @id={{c.id}}\n @name={{@name}}\n @isDisabled={{@isDisabled}}\n >\n <:default as |l|>\n {{! @glint-expect-error: the signature of the native select is not the same as the listbox}}\n {{yield l to=\"default\"}}\n </:default>\n </SelectNativeMirror>\n </VisuallyHidden>\n\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{! The wrapper, not the trigger, is the popover's width reference:\n in chips mode the trigger is only as wide as the space left over\n inside the field. The wrapper is a real full-width box in both\n modes, so the dropdown matches the field either way. }}\n <div\n {{p.anchor}}\n {{p.measureWidth}}\n {{on \"click\" this.handleFieldClick}}\n data-test-id={{if this.showChips \"chips-field\"}}\n data-part=\"chips-field\"\n {{! These flags are stringified rather than handed the boolean.\n Glimmer renders a true boolean attribute as an empty value, so\n passing isInvalid straight through produced an empty data-invalid\n and the theme selector keyed on the value true never matched. }}\n data-has-chips={{if this.showChips \"true\" \"false\"}}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n class={{this.classes.chipsField\n class=@classes.chipsField\n hasStartContent=(has-block \"startContent\")\n hasEndContent=true\n }}\n >\n {{#if (and this.showChips this.hasSelection)}}\n {{! A block cannot be passed conditionally in Glimmer, so the\n :item block below is always supplied and the branch lives\n inside it: with no :selectedItem block from the consumer, both\n it and the trigger render exactly what they rendered before. }}\n <SelectedChips\n @containerRef={{this.chipsContainerRef.setup}}\n @items={{this.selectedItems}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @chipOptions={{this.chipOptions}}\n @isDisabled={{@isDisabled}}\n @isRemovable={{this.chipsRemovable}}\n @onRemove={{this.removeSelectedKey}}\n >\n <:item as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:item>\n </SelectedChips>\n {{/if}}\n <SelectTrigger\n @isFilterable={{@isFilterable}}\n @trigger={{p.trigger}}\n @triggerRef={{this.triggerRef.setup}}\n @isDisabled={{@isDisabled}}\n @showChips={{this.showChips}}\n @accessibleName={{this.triggerAccessibleName}}\n @placeholder={{@placeholder}}\n @hasSelection={{this.hasSelection}}\n @hasStartContent={{has-block \"startContent\"}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @items={{this.selectedItems}}\n @filterValue={{this.filterFieldValue}}\n @onFilterInput={{this.onFilterChange}}\n @onFilterKeydown={{this.handleFilterKeydown}}\n @onKeydown={{this.handleTriggerKeydown}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n @hasCustomContent={{has-block \"selectedItem\"}}\n >\n <:selectedItem as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:selectedItem>\n </SelectTrigger>\n </div>\n <SelectEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{@endContentPointerEvents}}\n @inputSize={{@inputSize}}\n @isLoading={{@isLoading}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clearSelectedKeys}}\n >\n {{yield to=\"endContent\"}}\n </SelectEndContent>\n </div>\n\n <p.Content\n @size={{if @popoverSize @popoverSize \"trigger\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @disableFocusTrap={{this.disableFocusTrap}}\n @blockScroll={{this.blockScroll}}\n @transitionDuration={{@transitionDuration}}\n @backdrop={{this.backdrop}}\n @disableTransitions={{@disableTransitions}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @transition={{@transition}}\n @preventAutoFocus={{true}}\n >\n <Listbox\n @items={{this.filteredItems}}\n @allowEmpty={{@allowEmpty}}\n @variant={{this.variant}}\n @disabledKeys={{@disabledKeys}}\n @color={{this.color}}\n @isKeyboardEventsEnabled={{true}}\n @onAction={{this.onAction}}\n @onSelectionChange={{this.onSelectionChange}}\n @selectedKeys={{this.selectedKeys}}\n @selectionMode={{if @selectionMode @selectionMode \"single\"}}\n @type=\"listbox\"\n @class={{this.classes.listbox class=@classes.listbox}}\n @elementToAddKeyboardEvents={{this.triggerRef.current}}\n @autoActivateMode={{this.autoActivateMode}}\n data-part=\"listbox\"\n >\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item\n @key={{l.key}}\n @variant={{this.variant}}\n @color={{this.color}}\n >\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if this.showEmptyContent}}\n <div\n class={{this.classes.emptyContent class=@classes.emptyContent}}\n data-part=\"empty-content\"\n >\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport {\n Select,\n type SelectSignature,\n type SelectChipOptions,\n type SelectedItem,\n type SelectedItemBlockArg\n};\nexport default Select;\n"],"names":["and","a","b","Boolean","Select","Component","g","prototype","tracked","i","constructor","owner","args","selectionMode","_selectedKeys","selectedKeys","_selectedKey","selectedKey","validateArgs","console","warn","containerRef","ref","triggerRef","chipsContainerRef","onSelectionChange","keys","singleKey","length","filterValue","undefined","triggerFormInputEvent","current","onSingleSelectionChange","key","onOpenChange","isOpen","onFilterChange","event","target","value","handleFilterKeydown","showChips","removeLastSelectedKey","handleTriggerKeydown","isDisabled","preventDefault","items","selectedItems","last","removeSelectedKey","getSelectedKey","blockScroll","disableFocusTrap","onAction","closeOnItemSelect","blurTracker","ControlBlurTracker","trigger","container","isDestroyed","isDestroying","onBlur","willDestroy","cancel","handleFieldClick","Element","contains","chipsContainer","closeButton","closest","focus","click","clearSelectedKeys","variant","renamedArgValue","appearance","default","outlined","faded","component","from","to","id","n","cached","color","intent","chipOptions","chip","size","radius","withDot","chipsRemovable","map","item","lastKey","allowEmpty","canDeselectKey","filter","k","onItemsChange","nodes","_","didClose","selectedItemsDisplay","hasSelection","triggerAccessibleName","name","label","placeholder","selectedText","selectedTextValue","node","includes","textValue","join","backdrop","classes","select","useStyles","inputSize","hasChips","isFilterable","isClearable","filterFieldValue","filteredItems","filterAndRankItems","keyAndLabelForItem","showEmptyContent","hideEmptyContent","autoActivateMode","updateMultipleSelectValue","modifier","updateSingleSelectValue","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Popover","VisuallyHidden","SelectNativeMirror","on","SelectedChips","SelectTrigger","SelectEndContent","Listbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CC;AACD,MAAME,MAAA,SAA4BC,UAA0B;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CASzDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAA4B,EAAE;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA;AAR/B;;;;;;;AAOC;AAPD,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAUCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA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GAAyC;IAC3C,IAAI,IAAI,CAACtG,WAAW,KAAKC,aAAa,IAAI,CAACD,WAAW,KAAK,EAAA,EAAI;AAC7D,MAAA,OAAO,UAAA;AACT,IAAA;AACA,IAAA,OAAO,OAAA;AACT,EAAA;AAEA;;;;;;;;AAQC;EACDuG,yBAAA,GAA4BC,QAAA,CAC1B,CAAC9B,CAAG,EAAgB,CAACxF,YAAA,CAA4C,KAAA;AAC/D,IAAA,IAAIA,YAAA,KAAiBe,SAAA,IAAaf,YAAA,KAAiB,IAAA,EAAM;MACvD,IAAI,CAACD,aAAa,GAAGC,YAAA;AACvB,IAAA,CAAA,MAAO;AACL;MACA,IAAI,CAACD,aAAa,GAAG,EAAE;AACzB,IAAA;AACF,EAAA,CAAA,CAAA;AAGF;;;;;;;;AAQC;EACDwH,uBAAA,GAA0BD,QAAA,CACxB,CAAC9B,CAAG,EAAgB,CAACtF,WAAA,CAAyC,KAAA;IAC5D,IAAIA,gBAAgBa,SAAA,EAAW;MAC7B,IAAI,CAACd,YAAY,GAAGC,WAAA;AACtB,IAAA;AACF,EAAA,CAAA,CAAA;AAGF,EAAA;IAAAsH,oBAAA,CAAAC,kBAAA,CAAA,q/NAAA,EAmOA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,cAAA;QAAAC,kBAAA;QAAAC,EAAA;QAAA/I,GAAA;QAAAgJ,aAAA;QAAAC,aAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -49,7 +49,7 @@ const SelectedText = setComponentTemplate(precompileTemplate("<span ...attribute
49
49
  * The close button's title is built from `textValue`, never from the block, so
50
50
  * a chip whose body is purely graphical is still announced as "Remove <label>".
51
51
  */
52
- const SelectedChips = setComponentTemplate(precompileTemplate("<div {{@containerRef}} data-part=\"chips-container\" class={{@classes.chipsContainer class=@userClasses.chipsContainer}} ...attributes>\n {{#each @items key=\"key\" as |item|}}\n <Chip data-part=\"chip\" data-key={{item.key}} @class={{@classes.chip class=@userClasses.chip}} @appearance={{@chipOptions.appearance}} @intent={{@chipOptions.intent}} @size={{@chipOptions.size}} @radius={{@chipOptions.radius}} @withDot={{@chipOptions.withDot}} @isDisabled={{@isDisabled}} @closeButtonTitle={{concat \"Remove \" item.textValue}} @closeButtonTabIndex=\"-1\" @onClose={{if @isRemovable (fn @onRemove item.key)}}>\n {{yield (toBlockArg item) to=\"item\"}}\n </Chip>\n {{/each}}\n</div>", {
52
+ const SelectedChips = setComponentTemplate(precompileTemplate("<div {{@containerRef}} data-part=\"chips-container\" class={{@classes.chipsContainer class=@userClasses.chipsContainer}} ...attributes>\n {{#each @items key=\"key\" as |item|}}\n <Chip data-part=\"chip\" data-key={{item.key}} @class={{@classes.chip class=@userClasses.chip}} @variant={{@chipOptions.variant}} @appearance={{@chipOptions.appearance}} @color={{@chipOptions.color}} @intent={{@chipOptions.intent}} @size={{@chipOptions.size}} @radius={{@chipOptions.radius}} @withDot={{@chipOptions.withDot}} @isDisabled={{@isDisabled}} @closeButtonTitle={{concat \"Remove \" item.textValue}} @closeButtonTabIndex=\"-1\" @onClose={{if @isRemovable (fn @onRemove item.key)}}>\n {{yield (toBlockArg item) to=\"item\"}}\n </Chip>\n {{/each}}\n</div>", {
53
53
  strictMode: true,
54
54
  scope: () => ({
55
55
  Chip,
@@ -1 +1 @@
1
- {"version":3,"file":"selected-items.js","sources":["../../../../src/components/forms/select/selected-items.gts"],"sourcesContent":["import { concat, fn } from '@ember/helper';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { Chip } from '../../buttons/chip';\nimport type {\n ResolvedSelectChipOptions,\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n/**\n * The selection rendered as text: one string, so a `<span>` holding it stays a\n * single text node.\n */\nconst joinTextValues = (items: SelectedItem[]): string =>\n items.map((item) => item.textValue).join(', ');\n\n/**\n * Maps the internal {@link SelectedItem} projection onto what the `:item`\n * block here -- and, through it, the Select's `:selectedItem` block -- is\n * handed: `{ item, key, label }`, the same shape the `:item` block of the\n * listbox yields, so markup moves between the two unchanged.\n *\n * `item` is `unknown` at this level (it comes off the registered option\n * nodes), so it is typed `never` to stay assignable to the consumer's own `T`\n * when Select re-yields it. It is optional either way: an option written in\n * block form has no collection entry behind it.\n */\nconst toBlockArg = (item: SelectedItem): SelectedItemBlockArg<never> => ({\n item: item.item as never,\n key: item.key,\n label: item.textValue\n});\n\n/** Whether a comma separator is needed before this selection. */\nconst isNotFirst = (index: number): boolean => index > 0;\n\ninterface SelectedTextSignature {\n Args: {\n /** The selection, in item order. */\n items: SelectedItem[];\n\n /**\n * Whether the `:item` block is the consumer's own content rather than the\n * fallback the Select fills it with.\n *\n * A block cannot be passed conditionally in Glimmer, so the Select always\n * supplies one; this is how the plain presentation stays *exactly* what it\n * was -- the whole selection as one joined string in a single text node --\n * instead of becoming a per-item loop that merely renders the same\n * characters.\n */\n hasCustomContent?: boolean;\n };\n Blocks: {\n /** Content for one selected option, in place of its text. */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * The selection presented as a comma-joined string, inside the trigger.\n *\n * The text presentation and the chips presentation are the two renderings of\n * one selection, so they live in one file and read the same\n * {@link SelectedItem} projection.\n */\nconst SelectedText: TOC<SelectedTextSignature> = <template>\n <span ...attributes>\n {{#if @hasCustomContent}}\n {{#each @items key=\"key\" as |item index|}}\n {{~#if (isNotFirst index)}}, {{/if~}}\n {{~yield (toBlockArg item) to=\"item\"~}}\n {{/each}}\n {{else}}\n {{joinTextValues @items}}\n {{/if}}\n </span>\n</template>;\n\ninterface SelectedChipsSignature {\n Args: {\n /** The selection, in item order, so chips do not reorder as they are picked. */\n items: SelectedItem[];\n\n /**\n * Installed on the chips container. The field click forwarder reads this\n * ref to tell a chip body apart from a chip close button structurally,\n * without depending on any attribute.\n */\n containerRef: ModifierLike<{ Element: HTMLDivElement }>;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n chipOptions: ResolvedSelectChipOptions;\n isDisabled?: boolean;\n\n /**\n * Whether a chip may be removed at all. When false the chip renders with no\n * close button rather than a dead one.\n */\n isRemovable: boolean;\n\n onRemove: (key: string) => void;\n };\n Blocks: {\n /**\n * The body of one chip, in place of the option's text. The chip chrome --\n * its appearance, its dot and its close button -- is not the block's to\n * replace, so it stays put around whatever is rendered here.\n */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The selection presented as a row of removable {@link Chip}s beside the\n * trigger.\n *\n * The close buttons are deliberately outside the tab order\n * (`@closeButtonTabIndex=\"-1\"`) so the trigger keeps the first Tab stop in the\n * field; Backspace on the field is the keyboard route to removal.\n *\n * The close button's title is built from `textValue`, never from the block, so\n * a chip whose body is purely graphical is still announced as \"Remove <label>\".\n */\nconst SelectedChips: TOC<SelectedChipsSignature> = <template>\n <div\n {{@containerRef}}\n data-part=\"chips-container\"\n class={{@classes.chipsContainer class=@userClasses.chipsContainer}}\n ...attributes\n >\n {{#each @items key=\"key\" as |item|}}\n <Chip\n data-part=\"chip\"\n data-key={{item.key}}\n @class={{@classes.chip class=@userClasses.chip}}\n @appearance={{@chipOptions.appearance}}\n @intent={{@chipOptions.intent}}\n @size={{@chipOptions.size}}\n @radius={{@chipOptions.radius}}\n @withDot={{@chipOptions.withDot}}\n @isDisabled={{@isDisabled}}\n @closeButtonTitle={{concat \"Remove \" item.textValue}}\n @closeButtonTabIndex=\"-1\"\n @onClose={{if @isRemovable (fn @onRemove item.key)}}\n >\n {{yield (toBlockArg item) to=\"item\"}}\n </Chip>\n {{/each}}\n </div>\n</template>;\n\nexport {\n SelectedChips,\n SelectedText,\n type SelectedChipsSignature,\n type SelectedTextSignature\n};\n"],"names":["joinTextValues","items","map","item","textValue","join","toBlockArg","key","label","isNotFirst","index","SelectedText","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","SelectedChips","Chip","concat","fn"],"mappings":";;;;;;AAgBA,MAAMA,cAAA,GAAkBC,KAAO,IAC7BA,KAAA,CAAMC,GAAG,CAAEC,IAAA,IAASA,IAAA,CAAKC,SAAS,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA;AAE3C;;;;;;;;;;;AAWA,MAAMC,aAAcH,SAAqD;EACvEA,IAAA,EAAMA,IAAA,CAAKA,IAAa;EACxBI,GAAA,EAAKJ,KAAKI,GAAG;EACbC,KAAA,EAAOL,KAAKC;AACd,CAAC,CAAA;AAED;AACA,MAAMK,UAAA,GAAcC,KAAa,IAAcA,KAAA,GAAQ,CAAA;AA0BvD;;;;;;AAMC;AACD,MAAMC,YAAkB,GAAAC,oBAAA,CAAyBC,kBAAA,CAAA,iRAAA,EAWjD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAN,UAAA;IAAAH,UAAA;AAAAN,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAgB,YAAA,EAAA;AAsCV;;;;;;;;;;AAUC;AACD,MAAMC,aAAmB,GAAAL,oBAAA,CAA0BC,kBAAA,CAAA,qrBAAA,EA0BnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAG,IAAA;IAAAC,MAAA;IAAAC,EAAA;AAAAd,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAU,YAAA,EAAA;;;;"}
1
+ {"version":3,"file":"selected-items.js","sources":["../../../../src/components/forms/select/selected-items.gts"],"sourcesContent":["import { concat, fn } from '@ember/helper';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { Chip } from '../../buttons/chip';\nimport type {\n ResolvedSelectChipOptions,\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n/**\n * The selection rendered as text: one string, so a `<span>` holding it stays a\n * single text node.\n */\nconst joinTextValues = (items: SelectedItem[]): string =>\n items.map((item) => item.textValue).join(', ');\n\n/**\n * Maps the internal {@link SelectedItem} projection onto what the `:item`\n * block here -- and, through it, the Select's `:selectedItem` block -- is\n * handed: `{ item, key, label }`, the same shape the `:item` block of the\n * listbox yields, so markup moves between the two unchanged.\n *\n * `item` is `unknown` at this level (it comes off the registered option\n * nodes), so it is typed `never` to stay assignable to the consumer's own `T`\n * when Select re-yields it. It is optional either way: an option written in\n * block form has no collection entry behind it.\n */\nconst toBlockArg = (item: SelectedItem): SelectedItemBlockArg<never> => ({\n item: item.item as never,\n key: item.key,\n label: item.textValue\n});\n\n/** Whether a comma separator is needed before this selection. */\nconst isNotFirst = (index: number): boolean => index > 0;\n\ninterface SelectedTextSignature {\n Args: {\n /** The selection, in item order. */\n items: SelectedItem[];\n\n /**\n * Whether the `:item` block is the consumer's own content rather than the\n * fallback the Select fills it with.\n *\n * A block cannot be passed conditionally in Glimmer, so the Select always\n * supplies one; this is how the plain presentation stays *exactly* what it\n * was -- the whole selection as one joined string in a single text node --\n * instead of becoming a per-item loop that merely renders the same\n * characters.\n */\n hasCustomContent?: boolean;\n };\n Blocks: {\n /** Content for one selected option, in place of its text. */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * The selection presented as a comma-joined string, inside the trigger.\n *\n * The text presentation and the chips presentation are the two renderings of\n * one selection, so they live in one file and read the same\n * {@link SelectedItem} projection.\n */\nconst SelectedText: TOC<SelectedTextSignature> = <template>\n <span ...attributes>\n {{#if @hasCustomContent}}\n {{#each @items key=\"key\" as |item index|}}\n {{~#if (isNotFirst index)}}, {{/if~}}\n {{~yield (toBlockArg item) to=\"item\"~}}\n {{/each}}\n {{else}}\n {{joinTextValues @items}}\n {{/if}}\n </span>\n</template>;\n\ninterface SelectedChipsSignature {\n Args: {\n /** The selection, in item order, so chips do not reorder as they are picked. */\n items: SelectedItem[];\n\n /**\n * Installed on the chips container. The field click forwarder reads this\n * ref to tell a chip body apart from a chip close button structurally,\n * without depending on any attribute.\n */\n containerRef: ModifierLike<{ Element: HTMLDivElement }>;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n chipOptions: ResolvedSelectChipOptions;\n isDisabled?: boolean;\n\n /**\n * Whether a chip may be removed at all. When false the chip renders with no\n * close button rather than a dead one.\n */\n isRemovable: boolean;\n\n onRemove: (key: string) => void;\n };\n Blocks: {\n /**\n * The body of one chip, in place of the option's text. The chip chrome --\n * its appearance, its dot and its close button -- is not the block's to\n * replace, so it stays put around whatever is rendered here.\n */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The selection presented as a row of removable {@link Chip}s beside the\n * trigger.\n *\n * The close buttons are deliberately outside the tab order\n * (`@closeButtonTabIndex=\"-1\"`) so the trigger keeps the first Tab stop in the\n * field; Backspace on the field is the keyboard route to removal.\n *\n * The close button's title is built from `textValue`, never from the block, so\n * a chip whose body is purely graphical is still announced as \"Remove <label>\".\n */\nconst SelectedChips: TOC<SelectedChipsSignature> = <template>\n <div\n {{@containerRef}}\n data-part=\"chips-container\"\n class={{@classes.chipsContainer class=@userClasses.chipsContainer}}\n ...attributes\n >\n {{#each @items key=\"key\" as |item|}}\n <Chip\n data-part=\"chip\"\n data-key={{item.key}}\n @class={{@classes.chip class=@userClasses.chip}}\n @variant={{@chipOptions.variant}}\n @appearance={{@chipOptions.appearance}}\n @color={{@chipOptions.color}}\n @intent={{@chipOptions.intent}}\n @size={{@chipOptions.size}}\n @radius={{@chipOptions.radius}}\n @withDot={{@chipOptions.withDot}}\n @isDisabled={{@isDisabled}}\n @closeButtonTitle={{concat \"Remove \" item.textValue}}\n @closeButtonTabIndex=\"-1\"\n @onClose={{if @isRemovable (fn @onRemove item.key)}}\n >\n {{yield (toBlockArg item) to=\"item\"}}\n </Chip>\n {{/each}}\n </div>\n</template>;\n\nexport {\n SelectedChips,\n SelectedText,\n type SelectedChipsSignature,\n type SelectedTextSignature\n};\n"],"names":["joinTextValues","items","map","item","textValue","join","toBlockArg","key","label","isNotFirst","index","SelectedText","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","SelectedChips","Chip","concat","fn"],"mappings":";;;;;;AAgBA,MAAMA,cAAA,GAAkBC,KAAO,IAC7BA,KAAA,CAAMC,GAAG,CAAEC,IAAA,IAASA,IAAA,CAAKC,SAAS,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA;AAE3C;;;;;;;;;;;AAWA,MAAMC,aAAcH,SAAqD;EACvEA,IAAA,EAAMA,IAAA,CAAKA,IAAa;EACxBI,GAAA,EAAKJ,KAAKI,GAAG;EACbC,KAAA,EAAOL,KAAKC;AACd,CAAC,CAAA;AAED;AACA,MAAMK,UAAA,GAAcC,KAAa,IAAcA,KAAA,GAAQ,CAAA;AA0BvD;;;;;;AAMC;AACD,MAAMC,YAAkB,GAAAC,oBAAA,CAAyBC,kBAAA,CAAA,iRAAA,EAWjD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAN,UAAA;IAAAH,UAAA;AAAAN,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAgB,YAAA,EAAA;AAsCV;;;;;;;;;;AAUC;AACD,MAAMC,aAAmB,GAAAL,oBAAA,CAA0BC,kBAAA,CAAA,qvBAAA,EA4BnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAG,IAAA;IAAAC,MAAA;IAAAC,EAAA;AAAAd,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAU,YAAA,EAAA;;;;"}
@@ -4,6 +4,7 @@ import { FormControl } from './form-control.js';
4
4
  import { useStyles } from '@frontile/theme';
5
5
  import { tracked } from '@ember/-internals/metal';
6
6
  import { hash } from '@ember/helper';
7
+ import { r as renamedArgValue } from '../../deprecated-args-BIUjLA8y.js';
7
8
  import { precompileTemplate } from '@ember/template-compilation';
8
9
  import { setComponentTemplate } from '@ember/component';
9
10
  import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../../runtime--fcdnjmJ-BOdRhmsS.js';
@@ -43,7 +44,14 @@ class Switch extends Component {
43
44
  } = useStyles();
44
45
  return switchInput({
45
46
  size: this.args.size,
46
- intent: this.args.intent,
47
+ color: renamedArgValue(this.args.color, this.args.intent, {
48
+ default: 'neutral'
49
+ }, {
50
+ component: 'Switch',
51
+ from: 'intent',
52
+ to: 'color',
53
+ id: 'frontile.switch.intent'
54
+ }),
47
55
  isDisabled: this.args.isDisabled
48
56
  });
49
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sources":["../../../src/components/forms/switch.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SwitchVariants,\n type SwitchSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { tracked } from '@ember/-internals/metal';\nimport type Owner from '@ember/owner';\nimport { hash } from '@ember/helper';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Controls the current selected state of the Switch.\n * When provided a boolean value, the component operates in a controlled mode.\n */\n isSelected?: boolean;\n\n /**\n * Sets the initial selected state of the Switch when used in uncontrolled mode.\n * @defaultValue false\n */\n defaultSelected?: boolean;\n\n /**\n * The name attribute for the input element.\n * Useful for form submissions.\n */\n name?: string;\n\n /**\n * The size of the Switch.\n */\n size?: SwitchVariants['size'];\n\n /**\n * The visual intent (e.g., color or style) of the Switch.\n * @defaultValue 'primary'\n */\n intent?: SwitchVariants['intent'];\n\n /**\n * Custom classes to style different slots of the Switch component.\n */\n classes?: SlotsToClasses<SwitchSlots>;\n\n /**\n * Whether the Switch is disabled.\n * When true, user interaction is prevented.\n */\n isDisabled?: boolean;\n\n /**\n * Callback triggered when the Switch value changes.\n * Receives the new boolean value and, optionally, the triggering Event.\n */\n onChange?:\n ((value: boolean, event: Event) => void) | ((value: boolean) => void);\n\n /**\n * Callback triggered when the Switch loses focus (blur event).\n */\n onBlur?: () => void;\n}\n\ninterface SwitchSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n thumbContent: [{ isSelected: boolean }];\n endContent: [];\n };\n\n Element: HTMLInputElement;\n}\n\nclass Switch extends Component<SwitchSignature> {\n @tracked _isSelected;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n this._isSelected = this.args.defaultSelected ? true : false;\n }\n\n get isControlled(): boolean {\n return typeof this.args.isSelected === 'boolean';\n }\n\n get isSelected(): boolean {\n if (this.isControlled) {\n return !!this.args.isSelected;\n }\n return this._isSelected;\n }\n\n handleChange = (event: Event) => {\n event.preventDefault();\n\n const value = !this.isSelected;\n this._isSelected = value;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n };\n\n handleBlur = (): void => {\n this.args.onBlur?.();\n };\n\n get classes() {\n const { switchInput } = useStyles();\n return switchInput({\n size: this.args.size,\n intent: this.args.intent,\n isDisabled: this.args.isDisabled\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"switch-input\"\n data-part=\"base\"\n data-selected=\"{{this.isSelected}}\"\n data-disabled=\"{{@isDisabled}}\"\n as |c|\n >\n <span\n class={{this.classes.wrapper class=@classes.wrapper}}\n data-part=\"wrapper\"\n >\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isSelected}}\n class={{this.classes.hiddenInput class=@classes.hiddenInput}}\n type=\"checkbox\"\n disabled={{@isDisabled}}\n data-part=\"hidden-input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent class=@classes.startContent}}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n\n <span\n class={{this.classes.thumb class=@classes.thumb}}\n data-part=\"thumb\"\n >\n {{#if (has-block \"thumbContent\")}}\n {{yield (hash isSelected=this.isSelected) to=\"thumbContent\"}}\n {{/if}}\n\n </span>\n {{#if (has-block \"endContent\")}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n {{yield to=\"endContent\"}}\n </div>\n {{/if}}\n </span>\n\n <div\n class={{this.classes.labelContainer class=@classes.labelContainer}}\n data-part=\"label-container\"\n >\n {{#if @label}}\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Switch, type SwitchSignature };\nexport default Switch;\n"],"names":["Switch","Component","g","prototype","tracked","i","constructor","owner","args","_isSelected","defaultSelected","isControlled","isSelected","handleChange","event","preventDefault","value","onChange","handleBlur","onBlur","classes","switchInput","useStyles","size","intent","isDisabled","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","hash"],"mappings":";;;;;;;;;;AA8EA,MAAMA,eAAeC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAC5BC,OAAA,CAAA,CAAA;AAAA;EAAA,YAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,aAAA,CAAA,EAAA,MAAA;AAEDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAU,EAAE;AACpC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;IAEb,IAAI,CAACC,WAAW,GAAG,IAAI,CAACD,IAAI,CAACE,eAAe,GAAG,IAAA,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AA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"switch.js","sources":["../../../src/components/forms/switch.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SwitchVariants,\n type SwitchSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { tracked } from '@ember/-internals/metal';\nimport type Owner from '@ember/owner';\nimport { hash } from '@ember/helper';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Controls the current selected state of the Switch.\n * When provided a boolean value, the component operates in a controlled mode.\n */\n isSelected?: boolean;\n\n /**\n * Sets the initial selected state of the Switch when used in uncontrolled mode.\n * @defaultValue false\n */\n defaultSelected?: boolean;\n\n /**\n * The name attribute for the input element.\n * Useful for form submissions.\n */\n name?: string;\n\n /**\n * The size of the Switch.\n */\n size?: SwitchVariants['size'];\n\n /**\n * The color of the Switch.\n * @defaultValue 'primary'\n */\n color?: SwitchVariants['color'];\n\n /**\n * @deprecated Use `color`. `default` is now `neutral`.\n */\n intent?:\n | 'default'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * Custom classes to style different slots of the Switch component.\n */\n classes?: SlotsToClasses<SwitchSlots>;\n\n /**\n * Whether the Switch is disabled.\n * When true, user interaction is prevented.\n */\n isDisabled?: boolean;\n\n /**\n * Callback triggered when the Switch value changes.\n * Receives the new boolean value and, optionally, the triggering Event.\n */\n onChange?:\n ((value: boolean, event: Event) => void) | ((value: boolean) => void);\n\n /**\n * Callback triggered when the Switch loses focus (blur event).\n */\n onBlur?: () => void;\n}\n\ninterface SwitchSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n thumbContent: [{ isSelected: boolean }];\n endContent: [];\n };\n\n Element: HTMLInputElement;\n}\n\nclass Switch extends Component<SwitchSignature> {\n @tracked _isSelected;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n this._isSelected = this.args.defaultSelected ? true : false;\n }\n\n get isControlled(): boolean {\n return typeof this.args.isSelected === 'boolean';\n }\n\n get isSelected(): boolean {\n if (this.isControlled) {\n return !!this.args.isSelected;\n }\n return this._isSelected;\n }\n\n handleChange = (event: Event) => {\n event.preventDefault();\n\n const value = !this.isSelected;\n this._isSelected = value;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n };\n\n handleBlur = (): void => {\n this.args.onBlur?.();\n };\n\n get classes() {\n const { switchInput } = useStyles();\n return switchInput({\n size: this.args.size,\n color: renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Switch',\n from: 'intent',\n to: 'color',\n id: 'frontile.switch.intent'\n }\n ),\n isDisabled: this.args.isDisabled\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"switch-input\"\n data-part=\"base\"\n data-selected=\"{{this.isSelected}}\"\n data-disabled=\"{{@isDisabled}}\"\n as |c|\n >\n <span\n class={{this.classes.wrapper class=@classes.wrapper}}\n data-part=\"wrapper\"\n >\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isSelected}}\n class={{this.classes.hiddenInput class=@classes.hiddenInput}}\n type=\"checkbox\"\n disabled={{@isDisabled}}\n data-part=\"hidden-input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent class=@classes.startContent}}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n\n <span\n class={{this.classes.thumb class=@classes.thumb}}\n data-part=\"thumb\"\n >\n {{#if (has-block \"thumbContent\")}}\n {{yield (hash isSelected=this.isSelected) to=\"thumbContent\"}}\n {{/if}}\n\n </span>\n {{#if (has-block \"endContent\")}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n {{yield to=\"endContent\"}}\n </div>\n {{/if}}\n </span>\n\n <div\n class={{this.classes.labelContainer class=@classes.labelContainer}}\n data-part=\"label-container\"\n >\n {{#if @label}}\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Switch, type SwitchSignature };\nexport default Switch;\n"],"names":["Switch","Component","g","prototype","tracked","i","constructor","owner","args","_isSelected","defaultSelected","isControlled","isSelected","handleChange","event","preventDefault","value","onChange","handleBlur","onBlur","classes","switchInput","useStyles","size","color","renamedArgValue","intent","default","component","from","to","id","isDisabled","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","hash"],"mappings":";;;;;;;;;;;AA2FA,MAAMA,eAAeC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAC5BC,OAAA,CAAA,CAAA;AAAA;EAAA,YAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,aAAA,CAAA,EAAA,MAAA;AAEDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAU,EAAE;AACpC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;IAEb,IAAI,CAACC,WAAW,GAAG,IAAI,CAACD,IAAI,CAACE,eAAe,GAAG,IAAA,GAAO,KAAA;AACxD,EAAA;EAEA,IAAIC,YAAAA,GAAwB;AAC1B,IAAA,OAAO,OAAO,IAAI,CAACH,IAAI,CAACI,UAAU,KAAK,SAAA;AACzC,EAAA;EAEA,IAAIA,UAAAA,GAAsB;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AC,WAAA;QAAAC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -153,7 +153,7 @@ class Pagination extends Component {
153
153
  } = useStyles();
154
154
  return pagination({
155
155
  size: this.args.size,
156
- intent: this.args.intent,
156
+ color: this.args.color,
157
157
  isDisabled: this.isDisabled
158
158
  });
159
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sources":["../../../../src/components/navigation/pagination/pagination.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { fn } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport { press } from '../../../modifiers/press';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { paginationRange } from './range';\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronDoubleLeftIcon,\n ChevronDoubleRightIcon\n} from './icons';\nimport type { PaginationSlots, PaginationVariants } from '@frontile/theme';\nimport type { ModifierLike } from '@glint/template';\n\n/** What the `summary` block receives. */\ninterface PaginationSummary {\n /** 1-based index of the first item on the current page; 0 when empty. */\n from: number;\n /** 1-based index of the last item on the current page; 0 when empty. */\n to: number;\n total: number;\n page: number;\n totalPages: number;\n}\n\n/** What the `item` block receives, once per page chip. */\ninterface PaginationItemContext {\n page: number;\n isActive: boolean;\n classNames: string;\n setupItem: ModifierLike<{\n Element: HTMLElement;\n Args: { Positional: [boolean] };\n }>;\n}\n\n/**\n * One rendered slot. `isEllipsis` is a precomputed boolean rather than a\n * `type` string compared in the template: `eq` is not available to `.gts`\n * templates in this codebase, so every comparison is done here.\n */\ninterface RenderedItem {\n key: string;\n isEllipsis: boolean;\n value: number;\n isActive: boolean;\n label: string;\n /**\n * Prebuilt so the template can `{{yield item.context to=\"item\"}}` rather\n * than calling a function in a sub-expression position.\n */\n context: PaginationItemContext;\n}\n\ninterface PaginationArgs {\n /**\n * Total number of items across all pages -- an *item* count, not a page\n * count. `@pageSize` divides it. This is what lets the `summary` block be\n * handed a real item range instead of making the caller compute one.\n *\n * @defaultValue 0\n */\n total?: number;\n\n /**\n * Items shown per page. Values below 1 are treated as 1.\n *\n * @defaultValue 10\n */\n pageSize?: number;\n\n /**\n * The current page, 1-based.\n *\n * *Passing* this argument at all puts the component in controlled mode: the\n * rendered page then only ever reflects what you pass, so pair it with\n * `@onChange` and update your own state. Omit it entirely to let the\n * component track the page itself, seeded by `@defaultPage`.\n */\n page?: number;\n\n /**\n * The page to start on when uncontrolled. Ignored in controlled mode.\n *\n * @defaultValue 1\n */\n defaultPage?: number;\n\n /**\n * Called with the new page on every navigation, in both modes. Never called\n * with an out-of-range page, and never called when the page would not\n * change.\n */\n onChange?: (page: number) => void;\n\n /**\n * How many page chips to show either side of the current one. The first and\n * last pages are always shown; that boundary is not configurable.\n *\n * @defaultValue 1\n */\n siblingCount?: number;\n\n /**\n * Adds jump-to-first and jump-to-last controls at the ends of the row.\n *\n * @defaultValue false\n */\n showEdges?: boolean;\n\n /**\n * Set to false for compact page-number navigation with previous and next\n * controls but no page chips. `@total` and `@pageSize` still determine the\n * first and last pages.\n *\n * @defaultValue true\n */\n showPages?: boolean;\n\n /** @defaultValue 'md' */\n size?: PaginationVariants['size'];\n\n /**\n * The colour of the active page chip.\n *\n * @defaultValue 'default'\n */\n intent?: PaginationVariants['intent'];\n\n /**\n * Disables every control.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Accessible name for the nav landmark. Worth setting when a page has more\n * than one pagination on it.\n *\n * @defaultValue 'pagination'\n */\n label?: string;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<PaginationSlots>;\n}\n\ninterface PaginationSignature {\n Args: PaginationArgs;\n Blocks: {\n summary?: [PaginationSummary];\n item?: [PaginationItemContext];\n };\n Element: HTMLElement;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * A row of controls for moving through a paged list.\n *\n * It deliberately does **not** use `rovingFocus`: these are navigation\n * targets, not a composite widget, so every control stays individually\n * reachable by Tab. The ARIA tabs pattern does not apply, and applying it\n * would remove destinations from the tab order for no gain -- the same\n * reasoning `TabNav` documents.\n */\nclass Pagination extends Component<PaginationSignature> {\n /**\n * Uncontrolled mode's own page, seeded from `@defaultPage`. Written on every\n * navigation regardless of mode -- see `goTo` -- so the two modes stay on one\n * code path, the way `SegmentedControl` does it. In controlled mode nothing\n * reads it.\n */\n @tracked _page: number;\n\n constructor(owner: Owner, args: PaginationSignature['Args']) {\n super(owner, args);\n this._page = this.args.defaultPage ?? 1;\n }\n\n get pageSize(): number {\n return Math.max(1, Math.floor(this.args.pageSize ?? 10));\n }\n\n get total(): number {\n return Math.max(0, this.args.total ?? 0);\n }\n\n /** Never below 1: an empty list still has one (empty) page to sit on. */\n get totalPages(): number {\n return Math.max(1, Math.ceil(this.total / this.pageSize));\n }\n\n get siblingCount(): number {\n return Math.max(0, Math.floor(this.args.siblingCount ?? 1));\n }\n\n get showPages(): boolean {\n return this.args.showPages ?? true;\n }\n\n get label(): string {\n return this.args.label ?? 'pagination';\n }\n\n /**\n * Whether `@page` was *passed* decides the mode, not what it holds -- the\n * same rule as `SegmentedControl`. Glimmer's named-args object carries a key\n * for every argument written in the invoking template, so `in` distinguishes\n * an omitted `@page` from one that happens to be `undefined`.\n */\n get isControlled(): boolean {\n return 'page' in this.args;\n }\n\n /**\n * Clamped, so a caller who passes `@page={{99}}` for a three-page list gets\n * page 3 rather than a row with nothing marked current.\n */\n get currentPage(): number {\n const raw = this.isControlled ? (this.args.page ?? 1) : this._page;\n\n return clamp(Math.floor(raw) || 1, 1, this.totalPages);\n }\n\n get isFirstPage(): boolean {\n return this.currentPage <= 1;\n }\n\n get isLastPage(): boolean {\n return this.currentPage >= this.totalPages;\n }\n\n get isDisabled(): boolean {\n return this.args.isDisabled ?? false;\n }\n\n get isPrevDisabled(): boolean {\n return this.isDisabled || this.isFirstPage;\n }\n\n get isNextDisabled(): boolean {\n return this.isDisabled || this.isLastPage;\n }\n\n @cached\n get renderedItems(): RenderedItem[] {\n const items = paginationRange({\n page: this.currentPage,\n totalPages: this.totalPages,\n siblingCount: this.siblingCount\n });\n\n const classNames = this.pageClass;\n const setupItem = this\n .setupItem as unknown as PaginationItemContext['setupItem'];\n\n // The ellipsis key is positional because a row can hold two of them and\n // neither has a page number to key on.\n return items.map((item, index) => {\n if (item.type === 'ellipsis') {\n return {\n key: `ellipsis-${index}`,\n isEllipsis: true,\n value: 0,\n isActive: false,\n label: '',\n context: { page: 0, isActive: false, classNames, setupItem }\n };\n }\n\n const isActive = item.value === this.currentPage;\n\n return {\n key: `page-${item.value}`,\n isEllipsis: false,\n value: item.value,\n isActive,\n label: `Go to page ${item.value}`,\n context: { page: item.value, isActive, classNames, setupItem }\n };\n });\n }\n\n @cached\n get summary(): PaginationSummary {\n const empty = this.total === 0;\n\n return {\n from: empty ? 0 : (this.currentPage - 1) * this.pageSize + 1,\n to: empty ? 0 : Math.min(this.currentPage * this.pageSize, this.total),\n total: this.total,\n page: this.currentPage,\n totalPages: this.totalPages\n };\n }\n\n @cached\n get styles() {\n const { pagination } = useStyles();\n\n return pagination({\n size: this.args.size,\n intent: this.args.intent,\n isDisabled: this.isDisabled\n });\n }\n\n @cached\n get pageClass(): string {\n return this.styles.page({ class: this.args.classes?.page });\n }\n\n /**\n * Writes the active state onto whatever element the `item` block rendered,\n * so a consumer bringing their own `<a>` or `LinkTo` gets the same ARIA the\n * built-in chip does without having to know the contract. Same pattern as\n * `TabNav`'s yielded `setupItem`.\n */\n setupItem = modifier((element: HTMLElement, [isActive]: [boolean]) => {\n element.setAttribute('data-active', String(Boolean(isActive)));\n\n if (isActive) {\n element.setAttribute('aria-current', 'page');\n } else {\n element.removeAttribute('aria-current');\n }\n });\n\n goTo = (page: number): void => {\n const next = clamp(page, 1, this.totalPages);\n\n if (next === this.currentPage) {\n return;\n }\n\n this._page = next;\n this.args.onChange?.(next);\n };\n\n goToPrevious = (): void => {\n this.goTo(this.currentPage - 1);\n };\n\n goToNext = (): void => {\n this.goTo(this.currentPage + 1);\n };\n\n <template>\n <nav\n data-component=\"pagination\"\n data-part=\"base\"\n aria-label={{this.label}}\n class={{this.styles.base class=@classes.base}}\n ...attributes\n >\n {{#if (has-block \"summary\")}}\n <div\n data-part=\"summary\"\n class={{this.styles.summary class=@classes.summary}}\n data-pagination-summary\n >\n {{yield this.summary to=\"summary\"}}\n </div>\n {{/if}}\n\n <ul data-part=\"list\" class={{this.styles.list class=@classes.list}}>\n {{#if @showEdges}}\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"prev\"\n class={{this.styles.prev class=@classes.prev}}\n aria-label=\"Go to first page\"\n disabled={{this.isPrevDisabled}}\n data-test-first\n {{press (fn this.goTo 1)}}\n >\n <ChevronDoubleLeftIcon />\n </button>\n </li>\n {{/if}}\n\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"prev\"\n class={{this.styles.prev class=@classes.prev}}\n aria-label=\"Go to previous page\"\n disabled={{this.isPrevDisabled}}\n data-test-prev\n {{press this.goToPrevious}}\n >\n <ChevronLeftIcon />\n Previous\n </button>\n </li>\n\n {{#if this.showPages}}\n {{#each this.renderedItems key=\"key\" as |item|}}\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n {{#if item.isEllipsis}}\n <span\n data-part=\"ellipsis\"\n class={{this.styles.ellipsis class=@classes.ellipsis}}\n aria-hidden=\"true\"\n data-test-ellipsis\n >&hellip;</span>\n <VisuallyHidden>More pages</VisuallyHidden>\n {{else if (has-block \"item\")}}\n {{yield item.context to=\"item\"}}\n {{else}}\n <button\n type=\"button\"\n data-part=\"page\"\n class={{this.pageClass}}\n aria-label={{item.label}}\n aria-current={{if item.isActive \"page\"}}\n data-active={{if item.isActive \"true\" \"false\"}}\n disabled={{this.isDisabled}}\n data-test-page={{item.value}}\n {{press (fn this.goTo item.value)}}\n >{{item.value}}</button>\n {{/if}}\n </li>\n {{/each}}\n {{/if}}\n\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"next\"\n class={{this.styles.next class=@classes.next}}\n aria-label=\"Go to next page\"\n disabled={{this.isNextDisabled}}\n data-test-next\n {{press this.goToNext}}\n >\n Next\n <ChevronRightIcon />\n </button>\n </li>\n\n {{#if @showEdges}}\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"next\"\n class={{this.styles.next class=@classes.next}}\n aria-label=\"Go to last page\"\n disabled={{this.isNextDisabled}}\n data-test-last\n {{press (fn this.goTo this.totalPages)}}\n >\n <ChevronDoubleRightIcon />\n </button>\n </li>\n {{/if}}\n </ul>\n </nav>\n </template>\n}\n\nexport {\n Pagination,\n type PaginationSignature,\n type PaginationArgs,\n type PaginationSummary,\n type PaginationItemContext\n};\nexport default Pagination;\n"],"names":["clamp","value","min","max","Math","Pagination","Component","g","prototype","tracked","i","constructor","owner","args","_page","defaultPage","pageSize","floor","total","totalPages","ceil","siblingCount","showPages","label","isControlled","currentPage","raw","page","isFirstPage","isLastPage","isDisabled","isPrevDisabled","isNextDisabled","renderedItems","items","paginationRange","classNames","pageClass","setupItem","map","item","index","type","key","isEllipsis","isActive","context","n","cached","summary","empty","from","to","styles","pagination","useStyles","size","intent","class","classes","modifier","element","setAttribute","String","Boolean","removeAttribute","goTo","next","onChange","goToPrevious","goToNext","setComponentTemplate","precompileTemplate","strictMode","scope","press","fn","ChevronDoubleLeftIcon","ChevronLeftIcon","VisuallyHidden","ChevronRightIcon","ChevronDoubleRightIcon"],"mappings":";;;;;;;;;;;;;AAiKA,SAASA,KAAAA,CAAMC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAS;AAC7D,EAAA,OAAOC,KAAKF,GAAG,CAACE,KAAKD,GAAG,C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oB,KAAA;AAC/DgB,IAAAA,OAAA,CAAQC,YAAY,CAAC,aAAA,EAAeC,MAAA,CAAOC,OAAA,CAAQnB,QAAA,CAAA,CAAA,CAAA;AAEnD,IAAA,IAAIA,QAAA,EAAU;AACZgB,MAAAA,OAAA,CAAQC,YAAY,CAAC,cAAA,EAAgB,MAAA,CAAA;AACvC,IAAA,CAAA,MAAO;AACLD,MAAAA,OAAA,CAAQI,eAAe,CAAC,cAAA,CAAA;AAC1B,IAAA;AACF,EAAA,CAAA,CAAA;EAEAC,IAAA,GAAQvC,IAAY,IAAO;IACzB,MAAMwC,OAAOnE,KAAA,CAAM2B,IAAA,EAAM,CAAA,EAAG,IAAI,CAACR,UAAU,CAAA;AAE3C,IAAA,IAAIgD,IAAA,KAAS,IAAI,CAAC1C,WAAW,EAAE;AAC7B,MAAA;AACF,IAAA;IAEA,IAAI,CAACX,KAAK,GAAGqD,IAAA;AACb,IAAA,IAAI,CAACtD,IAAI,CAACuD,QAAQ,GAAGD,IAAA,CAAA;EACvB,CAAA;EAEAE,YAAA,GAAeA,MAAQ;IACrB,IAAI,CAACH,IAAI,CAAC,IAAI,CAACzC,WAAW,GAAG,CAAA,CAAA;EAC/B,CAAA;EAEA6C,QAAA,GAAWA,MAAQ;IACjB,IAAI,CAACJ,IAAI,CAAC,IAAI,CAACzC,WAAW,GAAG,CAAA,CAAA;EAC/B,CAAA;AAEA,EAAA;IAAA8C,oBAAA,CAAAC,kBAAA,CAAA,uzFAAA,EAgHA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,KAAA;QAAAC,EAAA;QAAAC,qBAAA;QAAAC,eAAA;QAAAC,cAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"pagination.js","sources":["../../../../src/components/navigation/pagination/pagination.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { fn } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport { press } from '../../../modifiers/press';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { paginationRange } from './range';\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronDoubleLeftIcon,\n ChevronDoubleRightIcon\n} from './icons';\nimport type { PaginationSlots, PaginationVariants } from '@frontile/theme';\nimport type { ModifierLike } from '@glint/template';\n\n/** What the `summary` block receives. */\ninterface PaginationSummary {\n /** 1-based index of the first item on the current page; 0 when empty. */\n from: number;\n /** 1-based index of the last item on the current page; 0 when empty. */\n to: number;\n total: number;\n page: number;\n totalPages: number;\n}\n\n/** What the `item` block receives, once per page chip. */\ninterface PaginationItemContext {\n page: number;\n isActive: boolean;\n classNames: string;\n setupItem: ModifierLike<{\n Element: HTMLElement;\n Args: { Positional: [boolean] };\n }>;\n}\n\n/**\n * One rendered slot. `isEllipsis` is a precomputed boolean rather than a\n * `type` string compared in the template: `eq` is not available to `.gts`\n * templates in this codebase, so every comparison is done here.\n */\ninterface RenderedItem {\n key: string;\n isEllipsis: boolean;\n value: number;\n isActive: boolean;\n label: string;\n /**\n * Prebuilt so the template can `{{yield item.context to=\"item\"}}` rather\n * than calling a function in a sub-expression position.\n */\n context: PaginationItemContext;\n}\n\ninterface PaginationArgs {\n /**\n * Total number of items across all pages -- an *item* count, not a page\n * count. `@pageSize` divides it. This is what lets the `summary` block be\n * handed a real item range instead of making the caller compute one.\n *\n * @defaultValue 0\n */\n total?: number;\n\n /**\n * Items shown per page. Values below 1 are treated as 1.\n *\n * @defaultValue 10\n */\n pageSize?: number;\n\n /**\n * The current page, 1-based.\n *\n * *Passing* this argument at all puts the component in controlled mode: the\n * rendered page then only ever reflects what you pass, so pair it with\n * `@onChange` and update your own state. Omit it entirely to let the\n * component track the page itself, seeded by `@defaultPage`.\n */\n page?: number;\n\n /**\n * The page to start on when uncontrolled. Ignored in controlled mode.\n *\n * @defaultValue 1\n */\n defaultPage?: number;\n\n /**\n * Called with the new page on every navigation, in both modes. Never called\n * with an out-of-range page, and never called when the page would not\n * change.\n */\n onChange?: (page: number) => void;\n\n /**\n * How many page chips to show either side of the current one. The first and\n * last pages are always shown; that boundary is not configurable.\n *\n * @defaultValue 1\n */\n siblingCount?: number;\n\n /**\n * Adds jump-to-first and jump-to-last controls at the ends of the row.\n *\n * @defaultValue false\n */\n showEdges?: boolean;\n\n /**\n * Set to false for compact page-number navigation with previous and next\n * controls but no page chips. `@total` and `@pageSize` still determine the\n * first and last pages.\n *\n * @defaultValue true\n */\n showPages?: boolean;\n\n /** @defaultValue 'md' */\n size?: PaginationVariants['size'];\n\n /**\n * The colour of the active page chip.\n *\n * @defaultValue 'neutral'\n */\n color?: PaginationVariants['color'];\n\n /**\n * Disables every control.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * Accessible name for the nav landmark. Worth setting when a page has more\n * than one pagination on it.\n *\n * @defaultValue 'pagination'\n */\n label?: string;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<PaginationSlots>;\n}\n\ninterface PaginationSignature {\n Args: PaginationArgs;\n Blocks: {\n summary?: [PaginationSummary];\n item?: [PaginationItemContext];\n };\n Element: HTMLElement;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * A row of controls for moving through a paged list.\n *\n * It deliberately does **not** use `rovingFocus`: these are navigation\n * targets, not a composite widget, so every control stays individually\n * reachable by Tab. The ARIA tabs pattern does not apply, and applying it\n * would remove destinations from the tab order for no gain -- the same\n * reasoning `TabNav` documents.\n */\nclass Pagination extends Component<PaginationSignature> {\n /**\n * Uncontrolled mode's own page, seeded from `@defaultPage`. Written on every\n * navigation regardless of mode -- see `goTo` -- so the two modes stay on one\n * code path, the way `SegmentedControl` does it. In controlled mode nothing\n * reads it.\n */\n @tracked _page: number;\n\n constructor(owner: Owner, args: PaginationSignature['Args']) {\n super(owner, args);\n this._page = this.args.defaultPage ?? 1;\n }\n\n get pageSize(): number {\n return Math.max(1, Math.floor(this.args.pageSize ?? 10));\n }\n\n get total(): number {\n return Math.max(0, this.args.total ?? 0);\n }\n\n /** Never below 1: an empty list still has one (empty) page to sit on. */\n get totalPages(): number {\n return Math.max(1, Math.ceil(this.total / this.pageSize));\n }\n\n get siblingCount(): number {\n return Math.max(0, Math.floor(this.args.siblingCount ?? 1));\n }\n\n get showPages(): boolean {\n return this.args.showPages ?? true;\n }\n\n get label(): string {\n return this.args.label ?? 'pagination';\n }\n\n /**\n * Whether `@page` was *passed* decides the mode, not what it holds -- the\n * same rule as `SegmentedControl`. Glimmer's named-args object carries a key\n * for every argument written in the invoking template, so `in` distinguishes\n * an omitted `@page` from one that happens to be `undefined`.\n */\n get isControlled(): boolean {\n return 'page' in this.args;\n }\n\n /**\n * Clamped, so a caller who passes `@page={{99}}` for a three-page list gets\n * page 3 rather than a row with nothing marked current.\n */\n get currentPage(): number {\n const raw = this.isControlled ? (this.args.page ?? 1) : this._page;\n\n return clamp(Math.floor(raw) || 1, 1, this.totalPages);\n }\n\n get isFirstPage(): boolean {\n return this.currentPage <= 1;\n }\n\n get isLastPage(): boolean {\n return this.currentPage >= this.totalPages;\n }\n\n get isDisabled(): boolean {\n return this.args.isDisabled ?? false;\n }\n\n get isPrevDisabled(): boolean {\n return this.isDisabled || this.isFirstPage;\n }\n\n get isNextDisabled(): boolean {\n return this.isDisabled || this.isLastPage;\n }\n\n @cached\n get renderedItems(): RenderedItem[] {\n const items = paginationRange({\n page: this.currentPage,\n totalPages: this.totalPages,\n siblingCount: this.siblingCount\n });\n\n const classNames = this.pageClass;\n const setupItem = this\n .setupItem as unknown as PaginationItemContext['setupItem'];\n\n // The ellipsis key is positional because a row can hold two of them and\n // neither has a page number to key on.\n return items.map((item, index) => {\n if (item.type === 'ellipsis') {\n return {\n key: `ellipsis-${index}`,\n isEllipsis: true,\n value: 0,\n isActive: false,\n label: '',\n context: { page: 0, isActive: false, classNames, setupItem }\n };\n }\n\n const isActive = item.value === this.currentPage;\n\n return {\n key: `page-${item.value}`,\n isEllipsis: false,\n value: item.value,\n isActive,\n label: `Go to page ${item.value}`,\n context: { page: item.value, isActive, classNames, setupItem }\n };\n });\n }\n\n @cached\n get summary(): PaginationSummary {\n const empty = this.total === 0;\n\n return {\n from: empty ? 0 : (this.currentPage - 1) * this.pageSize + 1,\n to: empty ? 0 : Math.min(this.currentPage * this.pageSize, this.total),\n total: this.total,\n page: this.currentPage,\n totalPages: this.totalPages\n };\n }\n\n @cached\n get styles() {\n const { pagination } = useStyles();\n\n return pagination({\n size: this.args.size,\n color: this.args.color,\n isDisabled: this.isDisabled\n });\n }\n\n @cached\n get pageClass(): string {\n return this.styles.page({ class: this.args.classes?.page });\n }\n\n /**\n * Writes the active state onto whatever element the `item` block rendered,\n * so a consumer bringing their own `<a>` or `LinkTo` gets the same ARIA the\n * built-in chip does without having to know the contract. Same pattern as\n * `TabNav`'s yielded `setupItem`.\n */\n setupItem = modifier((element: HTMLElement, [isActive]: [boolean]) => {\n element.setAttribute('data-active', String(Boolean(isActive)));\n\n if (isActive) {\n element.setAttribute('aria-current', 'page');\n } else {\n element.removeAttribute('aria-current');\n }\n });\n\n goTo = (page: number): void => {\n const next = clamp(page, 1, this.totalPages);\n\n if (next === this.currentPage) {\n return;\n }\n\n this._page = next;\n this.args.onChange?.(next);\n };\n\n goToPrevious = (): void => {\n this.goTo(this.currentPage - 1);\n };\n\n goToNext = (): void => {\n this.goTo(this.currentPage + 1);\n };\n\n <template>\n <nav\n data-component=\"pagination\"\n data-part=\"base\"\n aria-label={{this.label}}\n class={{this.styles.base class=@classes.base}}\n ...attributes\n >\n {{#if (has-block \"summary\")}}\n <div\n data-part=\"summary\"\n class={{this.styles.summary class=@classes.summary}}\n data-pagination-summary\n >\n {{yield this.summary to=\"summary\"}}\n </div>\n {{/if}}\n\n <ul data-part=\"list\" class={{this.styles.list class=@classes.list}}>\n {{#if @showEdges}}\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"prev\"\n class={{this.styles.prev class=@classes.prev}}\n aria-label=\"Go to first page\"\n disabled={{this.isPrevDisabled}}\n data-test-first\n {{press (fn this.goTo 1)}}\n >\n <ChevronDoubleLeftIcon />\n </button>\n </li>\n {{/if}}\n\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"prev\"\n class={{this.styles.prev class=@classes.prev}}\n aria-label=\"Go to previous page\"\n disabled={{this.isPrevDisabled}}\n data-test-prev\n {{press this.goToPrevious}}\n >\n <ChevronLeftIcon />\n Previous\n </button>\n </li>\n\n {{#if this.showPages}}\n {{#each this.renderedItems key=\"key\" as |item|}}\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n {{#if item.isEllipsis}}\n <span\n data-part=\"ellipsis\"\n class={{this.styles.ellipsis class=@classes.ellipsis}}\n aria-hidden=\"true\"\n data-test-ellipsis\n >&hellip;</span>\n <VisuallyHidden>More pages</VisuallyHidden>\n {{else if (has-block \"item\")}}\n {{yield item.context to=\"item\"}}\n {{else}}\n <button\n type=\"button\"\n data-part=\"page\"\n class={{this.pageClass}}\n aria-label={{item.label}}\n aria-current={{if item.isActive \"page\"}}\n data-active={{if item.isActive \"true\" \"false\"}}\n disabled={{this.isDisabled}}\n data-test-page={{item.value}}\n {{press (fn this.goTo item.value)}}\n >{{item.value}}</button>\n {{/if}}\n </li>\n {{/each}}\n {{/if}}\n\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"next\"\n class={{this.styles.next class=@classes.next}}\n aria-label=\"Go to next page\"\n disabled={{this.isNextDisabled}}\n data-test-next\n {{press this.goToNext}}\n >\n Next\n <ChevronRightIcon />\n </button>\n </li>\n\n {{#if @showEdges}}\n <li data-part=\"item\" class={{this.styles.item class=@classes.item}}>\n <button\n type=\"button\"\n data-part=\"next\"\n class={{this.styles.next class=@classes.next}}\n aria-label=\"Go to last page\"\n disabled={{this.isNextDisabled}}\n data-test-last\n {{press (fn this.goTo this.totalPages)}}\n >\n <ChevronDoubleRightIcon />\n </button>\n </li>\n {{/if}}\n </ul>\n </nav>\n </template>\n}\n\nexport {\n Pagination,\n type PaginationSignature,\n type PaginationArgs,\n type PaginationSummary,\n type PaginationItemContext\n};\nexport default Pagination;\n"],"names":["clamp","value","min","max","Math","Pagination","Component","g","prototype","tracked","i","constructor","owner","args","_page","defaultPage","pageSize","floor","total","totalPages","ceil","siblingCount","showPages","label","isControlled","currentPage","raw","page","isFirstPage","isLastPage","isDisabled","isPrevDisabled","isNextDisabled","renderedItems","items","paginationRange","classNames","pageClass","setupItem","map","item","index","type","key","isEllipsis","isActive","context","n","cached","summary","empty","from","to","styles","pagination","useStyles","size","color","class","classes","modifier","element","setAttribute","String","Boolean","removeAttribute","goTo","next","onChange","goToPrevious","goToNext","setComponentTemplate","precompileTemplate","strictMode","scope","press","fn","ChevronDoubleLeftIcon","ChevronLeftIcon","VisuallyHidden","ChevronRightIcon","ChevronDoubleRightIcon"],"mappings":";;;;;;;;;;;;;AAiKA,SAASA,KAAAA,CAAMC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAS;AAC7D,EAAA,OAAOC,KAAKF,GAAG,CAACE,KAAKD,GAAG,CAACF,OAAOC,GAAA,CAAA,EAAMC,GAAA,CAAA;AACxC;AAEA;;;;;;;;;AASA,MAAME,mBAAmBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CAOhCC,OAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA;AAND;;;;;AAKC;AAGDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAiC,EAAE;AAC3D,IAAA,KAAK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;IACzB,MAAMwC,OAAOnE,KAAA,CAAM2B,IAAA,EAAM,CAAA,EAAG,IAAI,CAACR,UAAU,CAAA;AAE3C,IAAA,IAAIgD,IAAA,KAAS,IAAI,CAAC1C,WAAW,EAAE;AAC7B,MAAA;AACF,IAAA;IAEA,IAAI,CAACX,KAAK,GAAGqD,IAAA;AACb,IAAA,IAAI,CAACtD,IAAI,CAACuD,QAAQ,GAAGD,IAAA,CAAA;EACvB,CAAA;EAEAE,YAAA,GAAeA,MAAQ;IACrB,IAAI,CAACH,IAAI,CAAC,IAAI,CAACzC,WAAW,GAAG,CAAA,CAAA;EAC/B,CAAA;EAEA6C,QAAA,GAAWA,MAAQ;IACjB,IAAI,CAACJ,IAAI,CAAC,IAAI,CAACzC,WAAW,GAAG,CAAA,CAAA;EAC/B,CAAA;AAEA,EAAA;IAAA8C,oBAAA,CAAAC,kBAAA,CAAA,uzFAAA,EAgHA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,KAAA;QAAAC,EAAA;QAAAC,qBAAA;QAAAC,eAAA;QAAAC,cAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -25,7 +25,7 @@ class TabNav extends Component {
25
25
  } = useStyles();
26
26
  return tabs({
27
27
  variant: this.args.variant,
28
- intent: this.args.intent,
28
+ color: this.args.color,
29
29
  size: this.args.size,
30
30
  orientation: this.args.orientation,
31
31
  isFullWidth: this.args.isFullWidth
@@ -1 +1 @@
1
- {"version":3,"file":"tab-nav.js","sources":["../../../../src/components/navigation/tab-nav/tab-nav.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport { selectionIndicator } from '../../../utils/selection-indicator';\nimport TabNavItem from './item';\nimport type { TabsSlots, TabsVariants } from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface TabNavArgs {\n /** Accessible name for the navigation landmark. */\n label?: string;\n\n /**\n * The visual style of the navigation bar.\n *\n * @defaultValue 'solid'\n */\n variant?: TabsVariants['variant'];\n\n /**\n * The colour intent applied to the indicator.\n *\n * @defaultValue 'default'\n */\n intent?: TabsVariants['intent'];\n\n /**\n * The size of the links, driving padding and text size.\n *\n * @defaultValue 'md'\n */\n size?: TabsVariants['size'];\n\n /**\n * Lays the links out in a row or a column.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: TabsVariants['orientation'];\n\n /**\n * Stretches the bar to its container and gives every link equal width.\n *\n * @defaultValue false\n */\n isFullWidth?: boolean;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<TabsSlots>;\n}\n\ninterface TabNavSignature {\n Args: TabNavArgs;\n Blocks: {\n default: [\n {\n Item: WithBoundArgs<typeof TabNavItem, 'itemClass' | 'setupItem'>;\n itemClass: string;\n setupItem: TabNav['setupItem'];\n }\n ];\n };\n Element: HTMLElement;\n}\n\n/**\n * A navigation bar styled like `Tabs`, for links that change the page.\n *\n * It deliberately does **not** use `rovingFocus`: these are links, so every one\n * of them stays individually reachable by Tab and the arrow keys are left to\n * the browser. The ARIA tabs pattern covers in-page panel switching only, and\n * applying it to navigation would remove links from the tab order for no gain.\n */\nclass TabNav extends Component<TabNavSignature> {\n indicator = selectionIndicator();\n\n @cached\n get styles() {\n const { tabs } = useStyles();\n\n return tabs({\n variant: this.args.variant,\n intent: this.args.intent,\n size: this.args.size,\n orientation: this.args.orientation,\n isFullWidth: this.args.isFullWidth\n });\n }\n\n @cached\n get itemClass(): string {\n return this.styles.tab({ class: this.args.classes?.tab });\n }\n\n /**\n * Marks an element as the active link and hands its geometry to the\n * indicator. Yielded so a consumer can bring their own link component --\n * `ember-link`, a custom `<AppLink>`, a plain `<a>` -- and still get both the\n * animation and the correct ARIA. `TabNav.Item` applies this internally, so\n * there is exactly one definition of what \"active\" writes to the DOM.\n */\n setupItem = modifier((element: HTMLElement, [isActive]: [boolean]) => {\n element.setAttribute('data-selected', String(Boolean(isActive)));\n\n if (isActive) {\n // Ember's `LinkTo` has never set `aria-current` -- it publishes only a\n // CSS class -- so this is the component's own contribution, not a\n // duplicate of something the framework already does.\n element.setAttribute('aria-current', 'page');\n this.indicator.claim(element);\n } else {\n element.removeAttribute('aria-current');\n }\n\n return (): void => {\n this.indicator.release(element);\n };\n });\n\n <template>\n <nav\n data-component=\"tabs\"\n data-part=\"list\"\n aria-label={{@label}}\n class=\"group/tabs {{this.styles.list class=@classes.list}}\"\n {{this.indicator.setupContainer}}\n ...attributes\n >\n <span\n data-part=\"indicator\"\n aria-hidden=\"true\"\n class={{this.styles.indicator class=@classes.indicator}}\n ></span>\n\n {{yield\n (hash\n Item=(component\n TabNavItem itemClass=this.itemClass setupItem=this.setupItem\n )\n itemClass=this.itemClass\n setupItem=this.setupItem\n )\n }}\n </nav>\n </template>\n}\n\nexport { TabNav, type TabNavSignature, type TabNavArgs };\nexport default TabNav;\n"],"names":["TabNav","Component","indicator","selectionIndicator","styles","tabs","useStyles","variant","args","intent","size","orientation","isFullWidth","n","prototype","cached","itemClass","tab","class","classes","setupItem","modifier","element","isActive","setAttribute","String","Boolean","claim","removeAttribute","release","setComponentTemplate","precompileTemplate","strictMode","scope","hash","TabNavItem"],"mappings":";;;;;;;;;;;AAmEA;;;;;;;;AAQA,MAAMA,eAAeC,SAAA,CAAU;EAC7BC,SAAA,GAAYC,kBAAA,EAAA;EAEZ,IACIC,MAAAA,GAAS;IACX,MAAM;AAAEC,MAAAA;KAAM,GAAGC,SAAA,EAAA;AAEjB,IAAA,OAAOD,IAAA,CAAK;AACVE,MAAAA,OAAA,EAAS,IAAI,CAACC,IAAI,CAACD,OAAO;AAC1BE,MAAAA,MAAA,EAAQ,IAAI,CAACD,IAAI,CAACC,MAAM;AACxBC,MAAAA,IAAA,EAAM,IAAI,CAACF,I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AA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"tab-nav.js","sources":["../../../../src/components/navigation/tab-nav/tab-nav.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport { selectionIndicator } from '../../../utils/selection-indicator';\nimport TabNavItem from './item';\nimport type { TabsSlots, TabsVariants } from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface TabNavArgs {\n /** Accessible name for the navigation landmark. */\n label?: string;\n\n /**\n * The visual style of the navigation bar.\n *\n * @defaultValue 'solid'\n */\n variant?: TabsVariants['variant'];\n\n /**\n * The colour intent applied to the indicator.\n *\n * @defaultValue 'neutral'\n */\n color?: TabsVariants['color'];\n\n /**\n * The size of the links, driving padding and text size.\n *\n * @defaultValue 'md'\n */\n size?: TabsVariants['size'];\n\n /**\n * Lays the links out in a row or a column.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: TabsVariants['orientation'];\n\n /**\n * Stretches the bar to its container and gives every link equal width.\n *\n * @defaultValue false\n */\n isFullWidth?: boolean;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<TabsSlots>;\n}\n\ninterface TabNavSignature {\n Args: TabNavArgs;\n Blocks: {\n default: [\n {\n Item: WithBoundArgs<typeof TabNavItem, 'itemClass' | 'setupItem'>;\n itemClass: string;\n setupItem: TabNav['setupItem'];\n }\n ];\n };\n Element: HTMLElement;\n}\n\n/**\n * A navigation bar styled like `Tabs`, for links that change the page.\n *\n * It deliberately does **not** use `rovingFocus`: these are links, so every one\n * of them stays individually reachable by Tab and the arrow keys are left to\n * the browser. The ARIA tabs pattern covers in-page panel switching only, and\n * applying it to navigation would remove links from the tab order for no gain.\n */\nclass TabNav extends Component<TabNavSignature> {\n indicator = selectionIndicator();\n\n @cached\n get styles() {\n const { tabs } = useStyles();\n\n return tabs({\n variant: this.args.variant,\n color: this.args.color,\n size: this.args.size,\n orientation: this.args.orientation,\n isFullWidth: this.args.isFullWidth\n });\n }\n\n @cached\n get itemClass(): string {\n return this.styles.tab({ class: this.args.classes?.tab });\n }\n\n /**\n * Marks an element as the active link and hands its geometry to the\n * indicator. Yielded so a consumer can bring their own link component --\n * `ember-link`, a custom `<AppLink>`, a plain `<a>` -- and still get both the\n * animation and the correct ARIA. `TabNav.Item` applies this internally, so\n * there is exactly one definition of what \"active\" writes to the DOM.\n */\n setupItem = modifier((element: HTMLElement, [isActive]: [boolean]) => {\n element.setAttribute('data-selected', String(Boolean(isActive)));\n\n if (isActive) {\n // Ember's `LinkTo` has never set `aria-current` -- it publishes only a\n // CSS class -- so this is the component's own contribution, not a\n // duplicate of something the framework already does.\n element.setAttribute('aria-current', 'page');\n this.indicator.claim(element);\n } else {\n element.removeAttribute('aria-current');\n }\n\n return (): void => {\n this.indicator.release(element);\n };\n });\n\n <template>\n <nav\n data-component=\"tabs\"\n data-part=\"list\"\n aria-label={{@label}}\n class=\"group/tabs {{this.styles.list class=@classes.list}}\"\n {{this.indicator.setupContainer}}\n ...attributes\n >\n <span\n data-part=\"indicator\"\n aria-hidden=\"true\"\n class={{this.styles.indicator class=@classes.indicator}}\n ></span>\n\n {{yield\n (hash\n Item=(component\n TabNavItem itemClass=this.itemClass setupItem=this.setupItem\n )\n itemClass=this.itemClass\n setupItem=this.setupItem\n )\n }}\n </nav>\n </template>\n}\n\nexport { TabNav, type TabNavSignature, type TabNavArgs };\nexport default TabNav;\n"],"names":["TabNav","Component","indicator","selectionIndicator","styles","tabs","useStyles","variant","args","color","size","orientation","isFullWidth","n","prototype","cached","itemClass","tab","class","classes","setupItem","modifier","element","isActive","setAttribute","String","Boolean","claim","removeAttribute","release","setComponentTemplate","precompileTemplate","strictMode","scope","hash","TabNavItem"],"mappings":";;;;;;;;;;;AAmEA;;;;;;;;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AAA,MAAO;AACLA,MAAAA,OAAA,CAAQM,eAAe,CAAC,cAAA,CAAA;AAC1B,IAAA;AAEA,IAAA,OAAO,MAAQ;AACb,MAAA,IAAI,CAAC1B,SAAS,CAAC2B,OAAO,CAACP,OAAA,CAAA;IACzB,CAAA;AACF,EAAA,CAAA,CAAA;AAEA,EAAA;IAAAQ,oBAAA,CAAAC,kBAAA,CAAA,2cAAA,EAyBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -54,7 +54,7 @@ class Tabs extends Component {
54
54
  } = useStyles();
55
55
  return tabs({
56
56
  variant: this.args.variant,
57
- intent: this.args.intent,
57
+ color: this.args.color,
58
58
  size: this.args.size,
59
59
  orientation: this.args.orientation,
60
60
  isFullWidth: this.args.isFullWidth,