frontile 0.18.0-beta.4 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/components/collections/dropdown/menu-context.d.ts +10 -0
- package/declarations/components/collections/dropdown/menu-context.d.ts.map +1 -1
- package/declarations/components/collections/dropdown/sub.d.ts +34 -0
- package/declarations/components/collections/dropdown/sub.d.ts.map +1 -1
- package/declarations/components/collections/table/cell-default.d.ts.map +1 -1
- package/declarations/components/collections/table/index.d.ts.map +1 -1
- package/declarations/components/collections/table/table.d.ts.map +1 -1
- package/declarations/components/collections/table/types.d.ts.map +1 -1
- package/declarations/components/collections/table/utils.d.ts.map +1 -1
- package/declarations/components/forms/field.d.ts.map +1 -1
- package/declarations/components/forms/form.d.ts.map +1 -1
- package/declarations/components/forms/native-select.d.ts.map +1 -1
- package/declarations/components/forms/select/select.d.ts +4 -76
- package/declarations/components/forms/select/select.d.ts.map +1 -1
- package/declarations/components/forms/select/types.d.ts.map +1 -1
- package/declarations/components/navigation/breadcrumbs/breadcrumbs.d.ts +251 -0
- package/declarations/components/navigation/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/declarations/components/navigation/breadcrumbs/collapse.d.ts +52 -0
- package/declarations/components/navigation/breadcrumbs/collapse.d.ts.map +1 -0
- package/declarations/components/navigation/breadcrumbs/ellipsis.d.ts +56 -0
- package/declarations/components/navigation/breadcrumbs/ellipsis.d.ts.map +1 -0
- package/declarations/components/navigation/breadcrumbs/item.d.ts +100 -0
- package/declarations/components/navigation/breadcrumbs/item.d.ts.map +1 -0
- package/declarations/components/navigation/breadcrumbs/separator.d.ts +27 -0
- package/declarations/components/navigation/breadcrumbs/separator.d.ts.map +1 -0
- package/declarations/components/navigation/breadcrumbs.d.ts +6 -0
- package/declarations/components/navigation/breadcrumbs.d.ts.map +1 -0
- package/declarations/components/navigation/index.d.ts +1 -0
- package/declarations/components/navigation/index.d.ts.map +1 -1
- package/declarations/components/overlays/overlay.d.ts.map +1 -1
- package/declarations/components/overlays/tooltip.d.ts +18 -19
- package/declarations/components/overlays/tooltip.d.ts.map +1 -1
- package/declarations/components/status/progress-bar.d.ts.map +1 -1
- package/declarations/components/utilities/collapsible.d.ts.map +1 -1
- package/declarations/utils/deferred-work.d.ts +4 -1
- package/declarations/utils/deferred-work.d.ts.map +1 -1
- package/dist/components/collections/dropdown/menu-context.js.map +1 -1
- package/dist/components/collections/dropdown/sub.js +78 -13
- package/dist/components/collections/dropdown/sub.js.map +1 -1
- package/dist/components/collections/simple-table/index.js.map +1 -1
- package/dist/components/collections/table/cell-default.js +0 -2
- package/dist/components/collections/table/cell-default.js.map +1 -1
- package/dist/components/collections/table/table.js +4 -46
- package/dist/components/collections/table/table.js.map +1 -1
- package/dist/components/collections/table/utils.js +0 -2
- package/dist/components/collections/table/utils.js.map +1 -1
- package/dist/components/forms/field.js +0 -1
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form.js +1 -39
- package/dist/components/forms/form.js.map +1 -1
- package/dist/components/forms/native-select.js +0 -3
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/select/select.js +9 -116
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/navigation/breadcrumbs/breadcrumbs.js +208 -0
- package/dist/components/navigation/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/components/navigation/breadcrumbs/collapse.js +49 -0
- package/dist/components/navigation/breadcrumbs/collapse.js.map +1 -0
- package/dist/components/navigation/breadcrumbs/ellipsis.js +40 -0
- package/dist/components/navigation/breadcrumbs/ellipsis.js.map +1 -0
- package/dist/components/navigation/breadcrumbs/item.js +102 -0
- package/dist/components/navigation/breadcrumbs/item.js.map +1 -0
- package/dist/components/navigation/breadcrumbs/separator.js +24 -0
- package/dist/components/navigation/breadcrumbs/separator.js.map +1 -0
- package/dist/components/navigation/breadcrumbs.js +4 -0
- package/dist/components/navigation/breadcrumbs.js.map +1 -0
- package/dist/components/navigation/index.js +3 -0
- package/dist/components/navigation/index.js.map +1 -1
- package/dist/components/overlays/overlay.js +0 -1
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/components/overlays/tooltip.js +19 -21
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/progress-bar.js +0 -3
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/collapsible.js +2 -4
- package/dist/components/utilities/collapsible.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/navigation.js +3 -0
- package/dist/navigation.js.map +1 -1
- package/dist/utils/deferred-work.js +27 -2
- package/dist/utils/deferred-work.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
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,CA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,CAAC,IAAI,CAAChB,IAAI,CAACsH,gBAAgB;AACxE,EAAA;EAEA,IAAIC,gBAAAA,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;;"}
|
|
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 `_selectedKey` / `_selectedKeys` are the source of truth for\n * rendering. `@selectedKey(s)` seeds them in the constructor and the\n * `updateSingle/MultipleSelectValue` modifiers keep them synced whenever the\n * arg changes; user interactions update them directly for an immediate UI\n * response, then call `@onSelectionChange` so the parent can update its copy.\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 constructor(owner: Owner, args: SelectArgs<T>) {\n super(owner, args);\n\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 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 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 * Like `onSelectionChange`, but for the native `<select>`'s single-value API.\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 /** Current selection normalized to an array, for template rendering. */\n get selectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this._selectedKeys;\n } else {\n const key = this.getSelectedKey;\n return key ? [key] : [];\n }\n }\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 /** Syncs internal `_selectedKeys` whenever `@selectedKeys` changes. */\n updateMultipleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKeys]: [string[] | null | undefined]) => {\n if (selectedKeys !== undefined && selectedKeys !== null) {\n this._selectedKeys = selectedKeys;\n } else {\n this._selectedKeys = [];\n }\n }\n );\n\n /** Syncs internal `_selectedKey` whenever `@selectedKey` changes. */\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;;;;;;;;;;;;AAaC;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,OAAA,IAAAC,2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A;AACT,IAAA;AACA,IAAA,OAAO,OAAA;AACT,EAAA;AAEA;EACAuG,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;MACL,IAAI,CAACD,aAAa,GAAG,EAAE;AACzB,IAAA;AACF,EAAA,CAAA,CAAA;AAGF;EACAwH,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;;"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { cached } from '@glimmer/tracking';
|
|
3
|
+
import { hash } from '@ember/helper';
|
|
4
|
+
import { modifier } from 'ember-modifier';
|
|
5
|
+
import { warn } from '@ember/debug';
|
|
6
|
+
import { useStyles } from '@frontile/theme';
|
|
7
|
+
import { BreadcrumbsItem } from './item.js';
|
|
8
|
+
import { BreadcrumbsEllipsis } from './ellipsis.js';
|
|
9
|
+
import { collapseBreadcrumbs } from './collapse.js';
|
|
10
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
11
|
+
import { setComponentTemplate } from '@ember/component';
|
|
12
|
+
import { a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An ordered trail of links ending in the current page.
|
|
16
|
+
*
|
|
17
|
+
* Like `TabNav`, it deliberately does **not** use roving focus: these are
|
|
18
|
+
* links, so every one of them stays individually reachable by Tab and the
|
|
19
|
+
* arrow keys are left to the browser.
|
|
20
|
+
*/
|
|
21
|
+
class Breadcrumbs extends Component {
|
|
22
|
+
get label() {
|
|
23
|
+
return this.args.label ?? 'Breadcrumb';
|
|
24
|
+
}
|
|
25
|
+
get styles() {
|
|
26
|
+
const {
|
|
27
|
+
breadcrumbs
|
|
28
|
+
} = useStyles();
|
|
29
|
+
return breadcrumbs({
|
|
30
|
+
size: this.args.size,
|
|
31
|
+
color: this.args.color,
|
|
32
|
+
underline: this.args.underline
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
decorateMethodV2(this.prototype, "styles", [cached]);
|
|
37
|
+
}
|
|
38
|
+
get itemClass() {
|
|
39
|
+
return this.styles.item({
|
|
40
|
+
class: this.args.classes?.item
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static {
|
|
44
|
+
decorateMethodV2(this.prototype, "itemClass", [cached]);
|
|
45
|
+
}
|
|
46
|
+
get linkClass() {
|
|
47
|
+
return this.styles.link({
|
|
48
|
+
class: this.args.classes?.link
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
static {
|
|
52
|
+
decorateMethodV2(this.prototype, "linkClass", [cached]);
|
|
53
|
+
}
|
|
54
|
+
get separatorClass() {
|
|
55
|
+
return this.styles.separator({
|
|
56
|
+
class: this.args.classes?.separator
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
static {
|
|
60
|
+
decorateMethodV2(this.prototype, "separatorClass", [cached]);
|
|
61
|
+
}
|
|
62
|
+
get ellipsisClass() {
|
|
63
|
+
return this.styles.ellipsis({
|
|
64
|
+
class: this.args.classes?.ellipsis
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Presence, not truthiness: Glimmer treats an empty array as falsy, so
|
|
69
|
+
* `{{#if @items}}` would send `@items={{(array)}}` down the block-form
|
|
70
|
+
* branch and silently render nothing rather than an empty trail.
|
|
71
|
+
*/
|
|
72
|
+
static {
|
|
73
|
+
decorateMethodV2(this.prototype, "ellipsisClass", [cached]);
|
|
74
|
+
}
|
|
75
|
+
get usesItemsForm() {
|
|
76
|
+
return this.args.items !== undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The indices the root can see as current *without* consulting the router:
|
|
80
|
+
* an explicit `isCurrent: true`, or a crumb with no link target at all
|
|
81
|
+
* *and* no explicit `isCurrent` of its own. The no-target fallback must not
|
|
82
|
+
* override an explicit `isCurrent: false` -- that would make the `@items`
|
|
83
|
+
* form disagree with the block form, where `@isCurrent={{false}}` always
|
|
84
|
+
* wins (see the "in both directions" test on `Breadcrumbs.Item`).
|
|
85
|
+
* Router-derived currency stays with `Item`, so this deliberately does not
|
|
86
|
+
* cover `route` crumbs.
|
|
87
|
+
*/
|
|
88
|
+
get staticallyCurrentIndices() {
|
|
89
|
+
return (this.args.items ?? []).reduce((found, item, index) => {
|
|
90
|
+
if (item.isCurrent === true || item.isCurrent === undefined && !item.route && !item.href) {
|
|
91
|
+
found.push(index);
|
|
92
|
+
}
|
|
93
|
+
return found;
|
|
94
|
+
}, []);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Last wins. Two unlinked crumbs would otherwise render two
|
|
98
|
+
* `aria-current="page"` elements, which is invalid; the root can see the
|
|
99
|
+
* whole array, so it fixes the trail rather than only complaining about it.
|
|
100
|
+
* The warning is there so the author still learns about the ambiguity.
|
|
101
|
+
*/
|
|
102
|
+
static {
|
|
103
|
+
decorateMethodV2(this.prototype, "staticallyCurrentIndices", [cached]);
|
|
104
|
+
}
|
|
105
|
+
get currentIndex() {
|
|
106
|
+
const indices = this.staticallyCurrentIndices;
|
|
107
|
+
warn(`<Breadcrumbs>: @items has ${indices.length} crumbs that resolve to the current page. ` + `Only the last one will be marked aria-current="page".`, indices.length <= 1, {
|
|
108
|
+
id: 'frontile.breadcrumbs.multiple-current'
|
|
109
|
+
});
|
|
110
|
+
return indices.at(-1);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A placeholder satisfying `RenderedSlot.context`'s required type for an
|
|
114
|
+
* ellipsis slot, which never actually yields it -- see the field doc on
|
|
115
|
+
* `RenderedSlot.context` for why the field can't be optional instead. Named
|
|
116
|
+
* so its unreachability is obvious at the one place it's constructed,
|
|
117
|
+
* rather than only in a comment several lines above.
|
|
118
|
+
*/
|
|
119
|
+
get unreachableEllipsisContext() {
|
|
120
|
+
return {
|
|
121
|
+
item: {},
|
|
122
|
+
index: -1,
|
|
123
|
+
isCurrent: false,
|
|
124
|
+
itemClass: this.itemClass,
|
|
125
|
+
linkClass: this.linkClass,
|
|
126
|
+
separatorClass: this.separatorClass
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
static {
|
|
130
|
+
decorateMethodV2(this.prototype, "unreachableEllipsisContext", [cached]);
|
|
131
|
+
}
|
|
132
|
+
get slots() {
|
|
133
|
+
const collapsed = collapseBreadcrumbs(this.args.items ?? [], {
|
|
134
|
+
maxItems: this.args.maxItems,
|
|
135
|
+
itemsBeforeCollapse: this.args.itemsBeforeCollapse,
|
|
136
|
+
itemsAfterCollapse: this.args.itemsAfterCollapse
|
|
137
|
+
});
|
|
138
|
+
const currentIndex = this.currentIndex;
|
|
139
|
+
// Read once, not once per crumb: each is a `@cached` getter over a
|
|
140
|
+
// Tailwind-Variants slot function, and `pagination.gts`'s `renderedItems`
|
|
141
|
+
// hoists the same way.
|
|
142
|
+
const itemClass = this.itemClass;
|
|
143
|
+
const linkClass = this.linkClass;
|
|
144
|
+
const separatorClass = this.separatorClass;
|
|
145
|
+
return collapsed.map(slot => {
|
|
146
|
+
if (slot.type === 'ellipsis') {
|
|
147
|
+
return {
|
|
148
|
+
key: 'ellipsis',
|
|
149
|
+
isEllipsis: true,
|
|
150
|
+
hiddenCount: slot.hiddenItems.length,
|
|
151
|
+
hiddenItems: slot.hiddenItems,
|
|
152
|
+
context: this.unreachableEllipsisContext
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// Whether the root is entitled to decide this crumb's currency at all.
|
|
156
|
+
// An explicit `isCurrent` (either value) and a crumb with no target both
|
|
157
|
+
// qualify; a bare `route` crumb does not, and gets `undefined`.
|
|
158
|
+
const isRootsToJudge = slot.item.isCurrent !== undefined || !(slot.item.route || slot.item.href);
|
|
159
|
+
const resolvedIsCurrent = isRootsToJudge ? slot.index === currentIndex : undefined;
|
|
160
|
+
return {
|
|
161
|
+
key: `item-${slot.index}`,
|
|
162
|
+
isEllipsis: false,
|
|
163
|
+
hiddenItems: [],
|
|
164
|
+
item: slot.item,
|
|
165
|
+
resolvedIsCurrent,
|
|
166
|
+
context: {
|
|
167
|
+
item: slot.item,
|
|
168
|
+
index: slot.index,
|
|
169
|
+
isCurrent: resolvedIsCurrent ?? false,
|
|
170
|
+
itemClass,
|
|
171
|
+
linkClass,
|
|
172
|
+
separatorClass
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Marks an element as the current page. Yielded so a consumer can bring
|
|
179
|
+
* their own link component -- `ember-link`, a custom `<AppLink>`, a plain
|
|
180
|
+
* `<a>` -- and still get the correct ARIA. `Breadcrumbs.Item` applies this
|
|
181
|
+
* internally, so there is exactly one definition of what "current" writes to
|
|
182
|
+
* the DOM.
|
|
183
|
+
*/
|
|
184
|
+
static {
|
|
185
|
+
decorateMethodV2(this.prototype, "slots", [cached]);
|
|
186
|
+
}
|
|
187
|
+
setupItem = modifier((element, [isCurrent]) => {
|
|
188
|
+
element.setAttribute('data-current', String(Boolean(isCurrent)));
|
|
189
|
+
if (isCurrent) {
|
|
190
|
+
element.setAttribute('aria-current', 'page');
|
|
191
|
+
} else {
|
|
192
|
+
element.removeAttribute('aria-current');
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
static {
|
|
196
|
+
setComponentTemplate(precompileTemplate("<nav data-component=\"breadcrumbs\" data-part=\"base\" aria-label={{this.label}} class={{this.styles.base class=@classes.base}} ...attributes>\n <ol data-part=\"list\" class={{this.styles.list class=@classes.list}}>\n {{#if this.usesItemsForm}}\n {{#each this.slots key=\"key\" as |slot|}}\n {{#if slot.isEllipsis}}\n {{#if (has-block \"ellipsis\")}}\n <BreadcrumbsEllipsisComponent @hiddenCount={{slot.hiddenCount}} @hiddenItems={{slot.hiddenItems}} @itemClass={{this.itemClass}} @ellipsisClass={{this.ellipsisClass}} @separatorClass={{this.separatorClass}} @separator={{@separator}}>\n {{yield (hash hiddenCount=slot.hiddenCount hiddenItems=slot.hiddenItems) to=\"ellipsis\"}}\n </BreadcrumbsEllipsisComponent>\n {{else}}\n <BreadcrumbsEllipsisComponent @hiddenCount={{slot.hiddenCount}} @hiddenItems={{slot.hiddenItems}} @itemClass={{this.itemClass}} @ellipsisClass={{this.ellipsisClass}} @separatorClass={{this.separatorClass}} @separator={{@separator}} />\n {{/if}}\n {{else if (has-block \"item\")}}\n {{yield slot.context to=\"item\"}}\n {{else}}\n <BreadcrumbsItemComponent @route={{slot.item.route}} @model={{slot.item.model}} @models={{slot.item.models}} @query={{slot.item.query}} @href={{slot.item.href}} @isCurrent={{slot.resolvedIsCurrent}} @isDisabled={{slot.item.isDisabled}} @itemClass={{this.itemClass}} @linkClass={{this.linkClass}} @separatorClass={{this.separatorClass}} @separator={{@separator}} @setupItem={{this.setupItem}}>{{slot.item.label}}</BreadcrumbsItemComponent>\n {{/if}}\n {{/each}}\n {{else}}\n {{yield (hash Item=(component BreadcrumbsItemComponent itemClass=this.itemClass linkClass=this.linkClass separatorClass=this.separatorClass separator=@separator setupItem=this.setupItem) Ellipsis=(component BreadcrumbsEllipsisComponent itemClass=this.itemClass ellipsisClass=this.ellipsisClass separatorClass=this.separatorClass separator=@separator) itemClass=this.itemClass linkClass=this.linkClass separatorClass=this.separatorClass setupItem=this.setupItem)}}\n {{/if}}\n </ol>\n</nav>", {
|
|
197
|
+
strictMode: true,
|
|
198
|
+
scope: () => ({
|
|
199
|
+
BreadcrumbsEllipsisComponent: BreadcrumbsEllipsis,
|
|
200
|
+
hash,
|
|
201
|
+
BreadcrumbsItemComponent: BreadcrumbsItem
|
|
202
|
+
})
|
|
203
|
+
}), this);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export { Breadcrumbs, Breadcrumbs as default };
|
|
208
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sources":["../../../../src/components/navigation/breadcrumbs/breadcrumbs.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { warn } from '@ember/debug';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport BreadcrumbsItemComponent from './item';\nimport BreadcrumbsEllipsisComponent from './ellipsis';\nimport {\n collapseBreadcrumbs,\n type BreadcrumbsItemData,\n type BreadcrumbsSlot\n} from './collapse';\nimport type { BreadcrumbsSlots, BreadcrumbsVariants } from '@frontile/theme';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface BreadcrumbsArgs {\n /**\n * Accessible name for the navigation landmark.\n *\n * @defaultValue 'Breadcrumb'\n */\n label?: string;\n\n /**\n * @defaultValue 'md'\n */\n size?: BreadcrumbsVariants['size'];\n\n /**\n * The colour of the hover and current-page ink.\n *\n * Three categories rather than the usual seven: the others are fill colours,\n * meant to carry `text-on-*` on top of them, and as ink on a light surface\n * they fall below the contrast a reader needs. See `breadcrumbs.ts` in the\n * theme for the measurements.\n *\n * @defaultValue 'neutral'\n */\n color?: BreadcrumbsVariants['color'];\n\n /**\n * @defaultValue 'hover'\n */\n underline?: BreadcrumbsVariants['underline'];\n\n /**\n * Replaces the separator glyph. A component argument rather than a named\n * block because the separator is rendered inside each `<li>`, which `Item`\n * owns -- a named block on this component cannot be handed down to a child.\n *\n * @defaultValue ChevronRightIcon\n */\n separator?: ComponentLike<{ Element: SVGElement }>;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<BreadcrumbsSlots>;\n\n /**\n * Renders the trail from an array instead of from blocks. Passing it is what\n * makes `@maxItems` meaningful -- yielded blocks cannot be counted before\n * they render, so in the block form there is nothing for it to divide.\n */\n items?: BreadcrumbsItemData[];\n\n /**\n * Collapses the middle of the trail once there are more crumbs than this.\n * `@items` form only.\n */\n maxItems?: number;\n\n /** @defaultValue 1 */\n itemsBeforeCollapse?: number;\n\n /** @defaultValue 1 */\n itemsAfterCollapse?: number;\n}\n\n/** What the `item` block receives, once per rendered crumb. */\ninterface BreadcrumbsItemContext {\n item: BreadcrumbsItemData;\n index: number;\n isCurrent: boolean;\n itemClass: string;\n linkClass: string;\n separatorClass: string;\n}\n\n/** One rendered slot, prebuilt so the template needs no sub-expression calls. */\ninterface RenderedSlot {\n key: string;\n isEllipsis: boolean;\n item?: BreadcrumbsItemData;\n /**\n * `true`/`false` for a crumb the root could judge on its own; `undefined`\n * for a `@route` crumb it could not, so `Item`'s own precedence takes over\n * and asks the router -- exactly as in the block form.\n */\n resolvedIsCurrent?: boolean;\n hiddenCount?: number;\n /**\n * Required, not optional: it is yielded to the `ellipsis` block, whose\n * contract promises consumers a real array, and Glint will not narrow it\n * through the template's branch.\n */\n hiddenItems: BreadcrumbsItemData[];\n /**\n * Always populated, even for an ellipsis slot -- Glimmer's `{{#if\n * slot.isEllipsis}}...{{else if (has-block \"item\")}}` does not narrow this\n * field's type the way a plain TS `if` would, so making it optional here\n * would make every `{{yield slot.context to=\"item\"}}` a type error despite\n * being reached only for a non-ellipsis slot at runtime.\n */\n context: BreadcrumbsItemContext;\n}\n\ninterface BreadcrumbsSignature {\n Args: BreadcrumbsArgs;\n Blocks: {\n default: [\n {\n Item: WithBoundArgs<\n typeof BreadcrumbsItemComponent,\n | 'itemClass'\n | 'linkClass'\n | 'separatorClass'\n | 'separator'\n | 'setupItem'\n >;\n Ellipsis: WithBoundArgs<\n typeof BreadcrumbsEllipsisComponent,\n 'itemClass' | 'ellipsisClass' | 'separatorClass' | 'separator'\n >;\n itemClass: string;\n linkClass: string;\n separatorClass: string;\n setupItem: Breadcrumbs['setupItem'];\n }\n ];\n item: [BreadcrumbsItemContext];\n ellipsis: [{ hiddenCount?: number; hiddenItems: BreadcrumbsItemData[] }];\n };\n Element: HTMLElement;\n}\n\n/**\n * An ordered trail of links ending in the current page.\n *\n * Like `TabNav`, it deliberately does **not** use roving focus: these are\n * links, so every one of them stays individually reachable by Tab and the\n * arrow keys are left to the browser.\n */\nclass Breadcrumbs extends Component<BreadcrumbsSignature> {\n get label(): string {\n return this.args.label ?? 'Breadcrumb';\n }\n\n @cached\n get styles() {\n const { breadcrumbs } = useStyles();\n\n return breadcrumbs({\n size: this.args.size,\n color: this.args.color,\n underline: this.args.underline\n });\n }\n\n @cached\n get itemClass(): string {\n return this.styles.item({ class: this.args.classes?.item });\n }\n\n @cached\n get linkClass(): string {\n return this.styles.link({ class: this.args.classes?.link });\n }\n\n @cached\n get separatorClass(): string {\n return this.styles.separator({ class: this.args.classes?.separator });\n }\n\n @cached\n get ellipsisClass(): string {\n return this.styles.ellipsis({ class: this.args.classes?.ellipsis });\n }\n\n /**\n * Presence, not truthiness: Glimmer treats an empty array as falsy, so\n * `{{#if @items}}` would send `@items={{(array)}}` down the block-form\n * branch and silently render nothing rather than an empty trail.\n */\n get usesItemsForm(): boolean {\n return this.args.items !== undefined;\n }\n\n /**\n * The indices the root can see as current *without* consulting the router:\n * an explicit `isCurrent: true`, or a crumb with no link target at all\n * *and* no explicit `isCurrent` of its own. The no-target fallback must not\n * override an explicit `isCurrent: false` -- that would make the `@items`\n * form disagree with the block form, where `@isCurrent={{false}}` always\n * wins (see the \"in both directions\" test on `Breadcrumbs.Item`).\n * Router-derived currency stays with `Item`, so this deliberately does not\n * cover `route` crumbs.\n */\n @cached\n get staticallyCurrentIndices(): number[] {\n return (this.args.items ?? []).reduce<number[]>((found, item, index) => {\n if (\n item.isCurrent === true ||\n (item.isCurrent === undefined && !item.route && !item.href)\n ) {\n found.push(index);\n }\n\n return found;\n }, []);\n }\n\n /**\n * Last wins. Two unlinked crumbs would otherwise render two\n * `aria-current=\"page\"` elements, which is invalid; the root can see the\n * whole array, so it fixes the trail rather than only complaining about it.\n * The warning is there so the author still learns about the ambiguity.\n */\n get currentIndex(): number | undefined {\n const indices = this.staticallyCurrentIndices;\n\n warn(\n `<Breadcrumbs>: @items has ${indices.length} crumbs that resolve to the current page. ` +\n `Only the last one will be marked aria-current=\"page\".`,\n indices.length <= 1,\n { id: 'frontile.breadcrumbs.multiple-current' }\n );\n\n return indices.at(-1);\n }\n\n /**\n * A placeholder satisfying `RenderedSlot.context`'s required type for an\n * ellipsis slot, which never actually yields it -- see the field doc on\n * `RenderedSlot.context` for why the field can't be optional instead. Named\n * so its unreachability is obvious at the one place it's constructed,\n * rather than only in a comment several lines above.\n */\n @cached\n get unreachableEllipsisContext(): BreadcrumbsItemContext {\n return {\n item: {},\n index: -1,\n isCurrent: false,\n itemClass: this.itemClass,\n linkClass: this.linkClass,\n separatorClass: this.separatorClass\n };\n }\n\n @cached\n get slots(): RenderedSlot[] {\n const collapsed: BreadcrumbsSlot[] = collapseBreadcrumbs(\n this.args.items ?? [],\n {\n maxItems: this.args.maxItems,\n itemsBeforeCollapse: this.args.itemsBeforeCollapse,\n itemsAfterCollapse: this.args.itemsAfterCollapse\n }\n );\n const currentIndex = this.currentIndex;\n\n // Read once, not once per crumb: each is a `@cached` getter over a\n // Tailwind-Variants slot function, and `pagination.gts`'s `renderedItems`\n // hoists the same way.\n const itemClass = this.itemClass;\n const linkClass = this.linkClass;\n const separatorClass = this.separatorClass;\n\n return collapsed.map((slot): RenderedSlot => {\n if (slot.type === 'ellipsis') {\n return {\n key: 'ellipsis',\n isEllipsis: true,\n hiddenCount: slot.hiddenItems.length,\n hiddenItems: slot.hiddenItems,\n context: this.unreachableEllipsisContext\n };\n }\n\n // Whether the root is entitled to decide this crumb's currency at all.\n // An explicit `isCurrent` (either value) and a crumb with no target both\n // qualify; a bare `route` crumb does not, and gets `undefined`.\n const isRootsToJudge =\n slot.item.isCurrent !== undefined ||\n !(slot.item.route || slot.item.href);\n\n const resolvedIsCurrent = isRootsToJudge\n ? slot.index === currentIndex\n : undefined;\n\n return {\n key: `item-${slot.index}`,\n isEllipsis: false,\n hiddenItems: [],\n item: slot.item,\n resolvedIsCurrent,\n context: {\n item: slot.item,\n index: slot.index,\n isCurrent: resolvedIsCurrent ?? false,\n itemClass,\n linkClass,\n separatorClass\n }\n };\n });\n }\n\n /**\n * Marks an element as the current page. Yielded so a consumer can bring\n * their own link component -- `ember-link`, a custom `<AppLink>`, a plain\n * `<a>` -- and still get the correct ARIA. `Breadcrumbs.Item` applies this\n * internally, so there is exactly one definition of what \"current\" writes to\n * the DOM.\n */\n setupItem = modifier((element: HTMLElement, [isCurrent]: [boolean]) => {\n element.setAttribute('data-current', String(Boolean(isCurrent)));\n\n if (isCurrent) {\n element.setAttribute('aria-current', 'page');\n } else {\n element.removeAttribute('aria-current');\n }\n });\n\n <template>\n <nav\n data-component=\"breadcrumbs\"\n data-part=\"base\"\n aria-label={{this.label}}\n class={{this.styles.base class=@classes.base}}\n ...attributes\n >\n <ol data-part=\"list\" class={{this.styles.list class=@classes.list}}>\n {{#if this.usesItemsForm}}\n {{#each this.slots key=\"key\" as |slot|}}\n {{#if slot.isEllipsis}}\n {{#if (has-block \"ellipsis\")}}\n <BreadcrumbsEllipsisComponent\n @hiddenCount={{slot.hiddenCount}}\n @hiddenItems={{slot.hiddenItems}}\n @itemClass={{this.itemClass}}\n @ellipsisClass={{this.ellipsisClass}}\n @separatorClass={{this.separatorClass}}\n @separator={{@separator}}\n >\n {{yield\n (hash\n hiddenCount=slot.hiddenCount hiddenItems=slot.hiddenItems\n )\n to=\"ellipsis\"\n }}\n </BreadcrumbsEllipsisComponent>\n {{else}}\n <BreadcrumbsEllipsisComponent\n @hiddenCount={{slot.hiddenCount}}\n @hiddenItems={{slot.hiddenItems}}\n @itemClass={{this.itemClass}}\n @ellipsisClass={{this.ellipsisClass}}\n @separatorClass={{this.separatorClass}}\n @separator={{@separator}}\n />\n {{/if}}\n {{else if (has-block \"item\")}}\n {{yield slot.context to=\"item\"}}\n {{else}}\n <BreadcrumbsItemComponent\n @route={{slot.item.route}}\n @model={{slot.item.model}}\n @models={{slot.item.models}}\n @query={{slot.item.query}}\n @href={{slot.item.href}}\n @isCurrent={{slot.resolvedIsCurrent}}\n @isDisabled={{slot.item.isDisabled}}\n @itemClass={{this.itemClass}}\n @linkClass={{this.linkClass}}\n @separatorClass={{this.separatorClass}}\n @separator={{@separator}}\n @setupItem={{this.setupItem}}\n >{{slot.item.label}}</BreadcrumbsItemComponent>\n {{/if}}\n {{/each}}\n {{else}}\n {{yield\n (hash\n Item=(component\n BreadcrumbsItemComponent\n itemClass=this.itemClass\n linkClass=this.linkClass\n separatorClass=this.separatorClass\n separator=@separator\n setupItem=this.setupItem\n )\n Ellipsis=(component\n BreadcrumbsEllipsisComponent\n itemClass=this.itemClass\n ellipsisClass=this.ellipsisClass\n separatorClass=this.separatorClass\n separator=@separator\n )\n itemClass=this.itemClass\n linkClass=this.linkClass\n separatorClass=this.separatorClass\n setupItem=this.setupItem\n )\n }}\n {{/if}}\n </ol>\n </nav>\n </template>\n}\n\nexport {\n Breadcrumbs,\n type BreadcrumbsSignature,\n type BreadcrumbsArgs,\n type BreadcrumbsItemContext\n};\nexport default Breadcrumbs;\n"],"names":["Breadcrumbs","Component","label","args","styles","breadcrumbs","useStyles","size","color","underline","n","prototype","cached","itemClass","item","class","classes","linkClass","link","separatorClass","separator","ellipsisClass","ellipsis","usesItemsForm","items","undefined","staticallyCurrentIndices","reduce","found","index","isCurrent","route","href","push","currentIndex","indices","warn","length","id","at","unreachableEllipsisContext","slots","collapsed","collapseBreadcrumbs","maxItems","itemsBeforeCollapse","itemsAfterCollapse","map","slot","type","key","isEllipsis","hiddenCount","hiddenItems","context","isRootsToJudge","resolvedIsCurrent","setupItem","modifier","element","setAttribute","String","Boolean","removeAttribute","setComponentTemplate","precompileTemplate","strictMode","scope","BreadcrumbsEllipsisComponent","hash","BreadcrumbsItemComponent"],"mappings":";;;;;;;;;;;;;AAiJA;;;;;;;AAOA,MAAMA,oBAAoBC,SAAA,CAAU;EAClC,IAAIC,KAAAA,GAAgB;AAClB,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,KAAK,IAAI,YAAA;AAC5B,EAAA;EAEA,IACIE,MAAAA,GAAS;IACX,MAAM;AAAEC,MAAAA;KAAa,GAAGC,SAAA,EAAA;AAExB,IAAA,OAAOD,WAAA,CAAY;AACjBE,MAAAA,IAAA,EAAM,IAAI,CAACJ,IAAI,CAACI,IAAI;AACpBC,MAAAA,KAAA,EAAO,IAAI,CAACL,IAAI,CAACK,KAAK;AACtBC,MAAAA,SAAA,EAAW,IAAI,CAACN,IAAI,CAACM;AACvB,KAAA,CAAA;AACF,EAAA;AAAA,EAAA;IAAAC,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CATCC,MAAA,CAAA,CAAA;AAAA;EAWD,IACIC,SAAAA,GAAoB;AACtB,IAAA,OAAO,IAAI,CAACT,MAAM,CAACU,IAAI,CAAC;AAAEC,MAAAA,KAAA,EAAO,IAAI,CAACZ,IAAI,CAACa,OAAO,EAAEF;AAAK,KAAA,CAAA;AAC3D,EAAA;AAAA,EAAA;IAAAJ,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAHCC,MAAA,CAAA,CAAA;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W0B,iBAAA,IAAqB,KAAA;UAChC3C,SAAA;UACAI,SAAA;AACAE,UAAAA;AACF;OACF;AACF,IAAA,CAAA,CAAA;AACF,EAAA;AAEA;;;;;;;AAAA,EAAA;IAAAT,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CA3DCC,MAAA,CAAA,CAAA;AAAA;EAkED6C,SAAA,GAAYC,SAAS,CAACC,SAAsB,CAAC7B,SAAA,CAAqB,KAAA;AAChE6B,IAAAA,OAAA,CAAQC,YAAY,CAAC,cAAA,EAAgBC,MAAA,CAAOC,OAAA,CAAQhC,SAAA,CAAA,CAAA,CAAA;AAEpD,IAAA,IAAIA,SAAA,EAAW;AACb6B,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;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,snEAAA,EAoFA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;sCAAAC,mBAAA;QAAAC,IAAA;AAAAC,kCAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One entry in `Breadcrumbs`' `@items` array.
|
|
3
|
+
*
|
|
4
|
+
* The index signature is deliberate: it lets a consumer carry extra data (an
|
|
5
|
+
* icon name, the record the crumb came from) through to the `item` block,
|
|
6
|
+
* which is yielded the original object alongside the computed context.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One rendered slot: either a crumb, or the gap marker standing in for the run
|
|
11
|
+
* of crumbs that did not fit. `index` is the crumb's position in the original
|
|
12
|
+
* array, not in the rendered list -- the `item` block needs the former.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Splits a trail into the crumbs that render and the ones an ellipsis stands
|
|
17
|
+
* in for.
|
|
18
|
+
*
|
|
19
|
+
* Unlike `paginationRange`, this needs no special case for a gap of exactly
|
|
20
|
+
* one: clamping `maxItems` up to `before + after + 1` means `items.length >
|
|
21
|
+
* max` implies `items.length >= before + after + 2`, so a rendered ellipsis
|
|
22
|
+
* always hides at least two crumbs. Clamping rather than throwing because a
|
|
23
|
+
* `@maxItems` smaller than the crumbs that are always kept is a caller
|
|
24
|
+
* mistake that has an obvious correct reading.
|
|
25
|
+
*/
|
|
26
|
+
function collapseBreadcrumbs(items, options = {}) {
|
|
27
|
+
const asSlot = (item, index) => ({
|
|
28
|
+
type: 'item',
|
|
29
|
+
item,
|
|
30
|
+
index
|
|
31
|
+
});
|
|
32
|
+
if (options.maxItems === undefined) {
|
|
33
|
+
return items.map(asSlot);
|
|
34
|
+
}
|
|
35
|
+
const before = Math.max(0, Math.trunc(options.itemsBeforeCollapse ?? 1));
|
|
36
|
+
const after = Math.max(0, Math.trunc(options.itemsAfterCollapse ?? 1));
|
|
37
|
+
const max = Math.max(Math.trunc(options.maxItems), before + after + 1);
|
|
38
|
+
if (items.length <= max) {
|
|
39
|
+
return items.map(asSlot);
|
|
40
|
+
}
|
|
41
|
+
const tailStart = items.length - after;
|
|
42
|
+
return [...items.slice(0, before).map(asSlot), {
|
|
43
|
+
type: 'ellipsis',
|
|
44
|
+
hiddenItems: items.slice(before, tailStart)
|
|
45
|
+
}, ...items.slice(tailStart).map((item, offset) => asSlot(item, tailStart + offset))];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { collapseBreadcrumbs };
|
|
49
|
+
//# sourceMappingURL=collapse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapse.js","sources":["../../../../src/components/navigation/breadcrumbs/collapse.ts"],"sourcesContent":["/**\n * One entry in `Breadcrumbs`' `@items` array.\n *\n * The index signature is deliberate: it lets a consumer carry extra data (an\n * icon name, the record the crumb came from) through to the `item` block,\n * which is yielded the original object alongside the computed context.\n */\nexport interface BreadcrumbsItemData {\n label?: string;\n route?: string;\n model?: unknown;\n models?: unknown[];\n query?: Record<string, unknown>;\n href?: string;\n isCurrent?: boolean;\n isDisabled?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * One rendered slot: either a crumb, or the gap marker standing in for the run\n * of crumbs that did not fit. `index` is the crumb's position in the original\n * array, not in the rendered list -- the `item` block needs the former.\n */\nexport type BreadcrumbsSlot<\n T extends BreadcrumbsItemData = BreadcrumbsItemData\n> =\n | { type: 'item'; item: T; index: number }\n | { type: 'ellipsis'; hiddenItems: T[] };\n\nexport interface CollapseOptions {\n /** Omitted, nothing collapses. */\n maxItems?: number;\n /** @defaultValue 1 */\n itemsBeforeCollapse?: number;\n /** @defaultValue 1 */\n itemsAfterCollapse?: number;\n}\n\n/**\n * Splits a trail into the crumbs that render and the ones an ellipsis stands\n * in for.\n *\n * Unlike `paginationRange`, this needs no special case for a gap of exactly\n * one: clamping `maxItems` up to `before + after + 1` means `items.length >\n * max` implies `items.length >= before + after + 2`, so a rendered ellipsis\n * always hides at least two crumbs. Clamping rather than throwing because a\n * `@maxItems` smaller than the crumbs that are always kept is a caller\n * mistake that has an obvious correct reading.\n */\nexport function collapseBreadcrumbs<T extends BreadcrumbsItemData>(\n items: T[],\n options: CollapseOptions = {}\n): BreadcrumbsSlot<T>[] {\n const asSlot = (item: T, index: number): BreadcrumbsSlot<T> => ({\n type: 'item',\n item,\n index\n });\n\n if (options.maxItems === undefined) {\n return items.map(asSlot);\n }\n\n const before = Math.max(0, Math.trunc(options.itemsBeforeCollapse ?? 1));\n const after = Math.max(0, Math.trunc(options.itemsAfterCollapse ?? 1));\n const max = Math.max(Math.trunc(options.maxItems), before + after + 1);\n\n if (items.length <= max) {\n return items.map(asSlot);\n }\n\n const tailStart = items.length - after;\n\n return [\n ...items.slice(0, before).map(asSlot),\n { type: 'ellipsis', hiddenItems: items.slice(before, tailStart) },\n ...items\n .slice(tailStart)\n .map((item, offset) => asSlot(item, tailStart + offset))\n ];\n}\n"],"names":["collapseBreadcrumbs","items","options","asSlot","item","index","type","maxItems","undefined","map","before","Math","max","trunc","itemsBeforeCollapse","after","itemsAfterCollapse","length","tailStart","slice","hiddenItems","offset"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAmBA,CACjCC,KAAU,EACVC,OAAwB,GAAG,EAAE,EACP;AACtB,EAAA,MAAMC,MAAM,GAAGA,CAACC,IAAO,EAAEC,KAAa,MAA0B;AAC9DC,IAAAA,IAAI,EAAE,MAAM;IACZF,IAAI;AACJC,IAAAA;AACF,GAAC,CAAC;AAEF,EAAA,IAAIH,OAAO,CAACK,QAAQ,KAAKC,SAAS,EAAE;AAClC,IAAA,OAAOP,KAAK,CAACQ,GAAG,CAACN,MAAM,CAAC;AAC1B,EAAA;AAEA,EAAA,MAAMO,MAAM,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAACX,OAAO,CAACY,mBAAmB,IAAI,CAAC,CAAC,CAAC;AACxE,EAAA,MAAMC,KAAK,GAAGJ,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAACX,OAAO,CAACc,kBAAkB,IAAI,CAAC,CAAC,CAAC;EACtE,MAAMJ,GAAG,GAAGD,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,KAAK,CAACX,OAAO,CAACK,QAAQ,CAAC,EAAEG,MAAM,GAAGK,KAAK,GAAG,CAAC,CAAC;AAEtE,EAAA,IAAId,KAAK,CAACgB,MAAM,IAAIL,GAAG,EAAE;AACvB,IAAA,OAAOX,KAAK,CAACQ,GAAG,CAACN,MAAM,CAAC;AAC1B,EAAA;AAEA,EAAA,MAAMe,SAAS,GAAGjB,KAAK,CAACgB,MAAM,GAAGF,KAAK;AAEtC,EAAA,OAAO,CACL,GAAGd,KAAK,CAACkB,KAAK,CAAC,CAAC,EAAET,MAAM,CAAC,CAACD,GAAG,CAACN,MAAM,CAAC,EACrC;AAAEG,IAAAA,IAAI,EAAE,UAAU;AAAEc,IAAAA,WAAW,EAAEnB,KAAK,CAACkB,KAAK,CAACT,MAAM,EAAEQ,SAAS;GAAG,EACjE,GAAGjB,KAAK,CACLkB,KAAK,CAACD,SAAS,CAAC,CAChBT,GAAG,CAAC,CAACL,IAAI,EAAEiB,MAAM,KAAKlB,MAAM,CAACC,IAAI,EAAEc,SAAS,GAAGG,MAAM,CAAC,CAAC,CAC3D;AACH;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { hash } from '@ember/helper';
|
|
3
|
+
import { VisuallyHidden } from '../../utilities/visually-hidden.js';
|
|
4
|
+
import { BreadcrumbsSeparator } from './separator.js';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The gap marker standing in for a run of crumbs.
|
|
10
|
+
*
|
|
11
|
+
* It renders its own `<li>` including a separator, structurally identical to
|
|
12
|
+
* what `Item` renders -- a bare `<span>` would fall outside the
|
|
13
|
+
* `group-last/item:hidden` scheme that hides the trailing separator, and the
|
|
14
|
+
* trail would end in a dangling chevron whenever an ellipsis came last.
|
|
15
|
+
*/
|
|
16
|
+
class BreadcrumbsEllipsis extends Component {
|
|
17
|
+
get hiddenItems() {
|
|
18
|
+
return this.args.hiddenItems ?? [];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* `undefined` rather than a number when the count is unknown, so the template
|
|
22
|
+
* can pick between the two announcements without an `eq` helper.
|
|
23
|
+
*/
|
|
24
|
+
get hiddenCount() {
|
|
25
|
+
return this.args.hiddenCount;
|
|
26
|
+
}
|
|
27
|
+
static {
|
|
28
|
+
setComponentTemplate(precompileTemplate("<li data-part=\"item\" class={{@itemClass}}>\n {{#if (has-block)}}\n {{!-- A supplied block carries its own accessible name -- a Dropdown\n trigger, typically -- so the built-in announcement is suppressed\n rather than read alongside it. --}}\n <span data-part=\"ellipsis\" class=\"{{@ellipsisClass}} {{@class}}\" ...attributes>\n {{yield (hash hiddenCount=this.hiddenCount hiddenItems=this.hiddenItems)}}\n </span>\n {{else}}\n <span data-part=\"ellipsis\" aria-hidden=\"true\" class=\"{{@ellipsisClass}} {{@class}}\" ...attributes>…</span>\n {{#if this.hiddenCount}}\n <VisuallyHidden>{{this.hiddenCount}} more levels</VisuallyHidden>\n {{else}}\n <VisuallyHidden>More levels</VisuallyHidden>\n {{/if}}\n {{/if}}\n\n <BreadcrumbsSeparator @class={{@separatorClass}} @separator={{@separator}} />\n</li>", {
|
|
29
|
+
strictMode: true,
|
|
30
|
+
scope: () => ({
|
|
31
|
+
hash,
|
|
32
|
+
VisuallyHidden,
|
|
33
|
+
BreadcrumbsSeparator
|
|
34
|
+
})
|
|
35
|
+
}), this);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { BreadcrumbsEllipsis, BreadcrumbsEllipsis as default };
|
|
40
|
+
//# sourceMappingURL=ellipsis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsis.js","sources":["../../../../src/components/navigation/breadcrumbs/ellipsis.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { BreadcrumbsSeparator } from './separator';\nimport type { BreadcrumbsItemData } from './collapse';\nimport type { ComponentLike } from '@glint/template';\n\ninterface BreadcrumbsEllipsisArgs {\n /**\n * Drives the visually-hidden announcement. The `@items` form passes it; in\n * the block form an author may supply it, and without it the announcement\n * falls back to an uncounted one rather than making the author count their\n * own crumbs.\n */\n hiddenCount?: number;\n\n /** The crumbs this marker stands in for. Yielded straight back to the block. */\n hiddenItems?: BreadcrumbsItemData[];\n\n /** Class names appended to this marker's theme classes. */\n class?: string;\n\n /** @internal */\n itemClass: string;\n\n /** @internal */\n ellipsisClass: string;\n\n /** @internal */\n separatorClass: string;\n\n /** @internal */\n separator?: ComponentLike<{ Element: SVGElement }>;\n}\n\ninterface BreadcrumbsEllipsisSignature {\n Args: BreadcrumbsEllipsisArgs;\n Blocks: {\n /** Replaces the glyph. This is where a `Dropdown` goes. */\n default: [{ hiddenCount?: number; hiddenItems: BreadcrumbsItemData[] }];\n };\n Element: HTMLElement;\n}\n\n/**\n * The gap marker standing in for a run of crumbs.\n *\n * It renders its own `<li>` including a separator, structurally identical to\n * what `Item` renders -- a bare `<span>` would fall outside the\n * `group-last/item:hidden` scheme that hides the trailing separator, and the\n * trail would end in a dangling chevron whenever an ellipsis came last.\n */\nclass BreadcrumbsEllipsis extends Component<BreadcrumbsEllipsisSignature> {\n get hiddenItems(): BreadcrumbsItemData[] {\n return this.args.hiddenItems ?? [];\n }\n\n /**\n * `undefined` rather than a number when the count is unknown, so the template\n * can pick between the two announcements without an `eq` helper.\n */\n get hiddenCount(): number | undefined {\n return this.args.hiddenCount;\n }\n\n <template>\n <li data-part=\"item\" class={{@itemClass}}>\n {{#if (has-block)}}\n {{! A supplied block carries its own accessible name -- a Dropdown\n trigger, typically -- so the built-in announcement is suppressed\n rather than read alongside it. }}\n <span\n data-part=\"ellipsis\"\n class=\"{{@ellipsisClass}} {{@class}}\"\n ...attributes\n >\n {{yield\n (hash hiddenCount=this.hiddenCount hiddenItems=this.hiddenItems)\n }}\n </span>\n {{else}}\n <span\n data-part=\"ellipsis\"\n aria-hidden=\"true\"\n class=\"{{@ellipsisClass}} {{@class}}\"\n ...attributes\n >…</span>\n {{#if this.hiddenCount}}\n <VisuallyHidden>{{this.hiddenCount}} more levels</VisuallyHidden>\n {{else}}\n <VisuallyHidden>More levels</VisuallyHidden>\n {{/if}}\n {{/if}}\n\n <BreadcrumbsSeparator\n @class={{@separatorClass}}\n @separator={{@separator}}\n />\n </li>\n </template>\n}\n\nexport {\n BreadcrumbsEllipsis,\n type BreadcrumbsEllipsisSignature,\n type BreadcrumbsEllipsisArgs\n};\nexport default BreadcrumbsEllipsis;\n"],"names":["BreadcrumbsEllipsis","Component","hiddenItems","args","hiddenCount","setComponentTemplate","precompileTemplate","strictMode","scope","hash","VisuallyHidden","BreadcrumbsSeparator"],"mappings":";;;;;;;AA4CA;;;;;;;;AAQA,MAAMA,4BAA4BC,SAAA,CAAU;EAC1C,IAAIC,cAAqC;AACvC,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,WAAW,IAAI,EAAE;AACpC,EAAA;AAEA;;;AAGC;EACD,IAAIE,WAAAA,GAAkC;AACpC,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,WAAW;AAC9B,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,k2BAAA,EAkCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,cAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|