frontile 0.18.7 → 0.18.9
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/buttons/chip.d.ts +2 -3
- package/declarations/components/buttons/chip.d.ts.map +1 -1
- package/declarations/components/collections/command/dialog.d.ts.map +1 -1
- package/declarations/components/collections/listbox/listbox.d.ts.map +1 -1
- package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -1
- package/declarations/components/forms/date-picker/time-columns.d.ts.map +1 -1
- package/declarations/components/forms/form.d.ts +3 -2
- 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.map +1 -1
- package/declarations/components/forms/select/trigger.d.ts +8 -0
- package/declarations/components/forms/select/trigger.d.ts.map +1 -1
- package/declarations/components/forms/select/types.d.ts +8 -4
- package/declarations/components/forms/select/types.d.ts.map +1 -1
- package/declarations/components/layout/app-layout.d.ts +345 -1
- package/declarations/components/layout/app-layout.d.ts.map +1 -1
- package/declarations/components/layout/aside.d.ts +295 -1
- package/declarations/components/layout/aside.d.ts.map +1 -1
- package/declarations/components/layout/context.d.ts +10 -1
- package/declarations/components/layout/context.d.ts.map +1 -1
- package/declarations/components/layout/navbar.d.ts +1001 -0
- package/declarations/components/layout/navbar.d.ts.map +1 -1
- package/declarations/components/layout/sidebar.d.ts +312 -1
- package/declarations/components/layout/sidebar.d.ts.map +1 -1
- package/declarations/components/overlays/popover.d.ts.map +1 -1
- package/declarations/components/status/badge.d.ts +83 -0
- package/declarations/components/status/badge.d.ts.map +1 -0
- package/declarations/components/status/index.d.ts +1 -0
- package/declarations/components/status/index.d.ts.map +1 -1
- package/declarations/modifiers/press.d.ts.map +1 -1
- package/declarations/utils/keyboard-event.d.ts +11 -0
- package/declarations/utils/keyboard-event.d.ts.map +1 -0
- package/dist/components/buttons/chip.js +12 -1
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/collections/command/dialog.js +2 -1
- package/dist/components/collections/command/dialog.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js +2 -1
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/forms/date-input/segment-group.js +2 -0
- package/dist/components/forms/date-input/segment-group.js.map +1 -1
- package/dist/components/forms/date-picker/time-columns.js +2 -0
- package/dist/components/forms/date-picker/time-columns.js.map +1 -1
- package/dist/components/forms/form.js.map +1 -1
- package/dist/components/forms/native-select.js +1 -1
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/select/select.js +1 -1
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/trigger.js +1 -1
- package/dist/components/forms/select/trigger.js.map +1 -1
- package/dist/components/layout/app-layout.js +39 -14
- package/dist/components/layout/app-layout.js.map +1 -1
- package/dist/components/layout/aside.js +2 -4
- package/dist/components/layout/aside.js.map +1 -1
- package/dist/components/layout/context.js +15 -1
- package/dist/components/layout/context.js.map +1 -1
- package/dist/components/layout/navbar.js +24 -3
- package/dist/components/layout/navbar.js.map +1 -1
- package/dist/components/layout/sidebar.js +7 -4
- package/dist/components/layout/sidebar.js.map +1 -1
- package/dist/components/overlays/popover.js +2 -0
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/status/badge.js +52 -0
- package/dist/components/status/badge.js.map +1 -0
- package/dist/components/status/index.js +1 -0
- package/dist/components/status/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modifiers/press.js +57 -0
- package/dist/modifiers/press.js.map +1 -1
- package/dist/status.js +1 -0
- package/dist/status.js.map +1 -1
- package/dist/utils/keyboard-event.js +15 -0
- package/dist/utils/keyboard-event.js.map +1 -0
- 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 { assert } from '@ember/debug';\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 {\n filterAndRankItems,\n limitItems,\n type DisplayLimitContentArgs\n} 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 every selected item even while the listbox is filtered down\n * (`mirroredItems` keeps them past `@displayLimit` too). Chips and the\n * 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 * Enter in the open filter picks the active option (the Listbox handles\n * that), so it must not also submit a wrapping form, the same guard\n * Autocomplete has. Closed, Enter is left to the form.\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 === 'Enter' && this.isOpen) {\n event.preventDefault();\n return;\n }\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 * With nothing selected the placeholder is the trigger's visible text, so\n * it joins the name (`Merchant, All merchants`) rather than being dropped.\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 // Nothing selected: the placeholder is the visible text, so it joins the\n // name (WCAG 2.5.3 Label in Name).\n if (!this.hasSelection && this.args.label && this.args.placeholder) {\n return this.args.label === this.args.placeholder\n ? this.args.label\n : `${this.args.label}, ${this.args.placeholder}`;\n }\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 hasSelection: this.hasSelection\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 // Cached: the listbox, the empty content and the display limit read it, and\n // filtering a long list on every read would repeat the work per keystroke.\n @cached\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 /**\n * The matches the listbox renders: `filteredItems`, capped by\n * `@displayLimit`.\n */\n @cached\n get displayedItems() {\n const { displayLimit, isFilterable } = this.args;\n assert(\n `Select: @displayLimit must be a positive integer, received ${String(displayLimit)}`,\n displayLimit === undefined ||\n (Number.isInteger(displayLimit) && displayLimit > 0)\n );\n assert(\n 'Select: @displayLimit requires @isFilterable, otherwise the options past the limit cannot be reached',\n displayLimit === undefined || isFilterable\n );\n\n const selectedKeys = this.selectedKeys;\n return limitItems(this.filteredItems, displayLimit, (item) =>\n selectedKeys.includes(keyAndLabelForItem(item).key)\n );\n }\n\n /**\n * The options the hidden native `<select>` holds: the unfiltered `@items`,\n * capped by `@displayLimit` like the listbox, plus every selected option.\n *\n * The form value is the selected options, so it never needs the others.\n * Holding every item instead costs the same rendering the limit saves in\n * the listbox, and it is paid while the Select is closed: a page with a\n * hundred Selects over a thousand items each built a hundred thousand\n * hidden options. Unfiltered, so a filter can't change what the form sees.\n */\n @cached\n get mirroredItems() {\n const selectedKeys = this.selectedKeys;\n return limitItems(this.args.items, this.args.displayLimit, (item) =>\n selectedKeys.includes(keyAndLabelForItem(item).key)\n );\n }\n\n /**\n * What the display limit content reports, or `undefined` when nothing is\n * left out.\n */\n get displayLimitContent(): DisplayLimitContentArgs | undefined {\n const shown = this.displayedItems?.length ?? 0;\n const total = this.filteredItems?.length ?? 0;\n if (shown === total || this.args.hideDisplayLimitContent) {\n return undefined;\n }\n return { shown, total };\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={{this.mirroredItems}}\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.displayedItems}}\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 {{#if this.displayLimitContent}}\n <div\n class={{this.classes.displayLimitContent\n class=@classes.displayLimitContent\n }}\n data-part=\"display-limit-content\"\n >\n {{#if (has-block \"displayLimitContent\")}}\n {{yield this.displayLimitContent to=\"displayLimitContent\"}}\n {{else}}\n Showing\n {{this.displayLimitContent.shown}}\n of\n {{this.displayLimitContent.total}}. Type to narrow down.\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 type DisplayLimitContentArgs\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","preventDefault","showChips","removeLastSelectedKey","handleTriggerKeydown","isDisabled","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","displayedItems","displayLimit","assert","String","Number","isInteger","limitItems","mirroredItems","displayLimitContent","shown","total","hideDisplayLimitContent","autoActivateMode","updateMultipleSelectValue","modifier","updateSingleSelectValue","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Popover","VisuallyHidden","SelectNativeMirror","on","SelectedChips","SelectTrigger","SelectEndContent","Listbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,GAAA,GAAMA,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;IACA,OAAO;MAAE8G,KAAA;AAAOC,MAAAA;KAAM;AACxB,EAAA;EAEA,IAAIE,gBAAAA,GAAyC;IAC3C,IAAI,IAAI,CAAClH,WAAW,KAAKC,aAAa,IAAI,CAACD,WAAW,KAAK,EAAA,EAAI;AAC7D,MAAA,OAAO,UAAA;AACT,IAAA;AACA,IAAA,OAAO,OAAA;AACT,EAAA;AAEA;EACAmH,yBAAA,GAA4BC,QAAA,CAC1B,CAAC1C,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;EACAoI,uBAAA,GAA0BD,QAAA,CACxB,CAAC1C,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;IAAAkI,oBAAA,CAAAC,kBAAA,CAAA,siPAAA,EAoPA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,cAAA;QAAAC,kBAAA;QAAAC,EAAA;QAAA3J,GAAA;QAAA4J,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 { assert } from '@ember/debug';\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 {\n filterAndRankItems,\n limitItems,\n type DisplayLimitContentArgs\n} 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 every selected item even while the listbox is filtered down\n * (`mirroredItems` keeps them past `@displayLimit` too). Chips and the\n * 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 * Enter in the open filter picks the active option (the Listbox handles\n * that), so it must not also submit a wrapping form, the same guard\n * Autocomplete has. Closed, Enter is left to the form.\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 === 'Enter' && this.isOpen) {\n event.preventDefault();\n return;\n }\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 * With nothing selected the placeholder is the trigger's visible text, so\n * it joins the name (`Merchant, All merchants`) rather than being dropped.\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 // Nothing selected: the placeholder is the visible text, so it joins the\n // name (WCAG 2.5.3 Label in Name).\n if (!this.hasSelection && this.args.label && this.args.placeholder) {\n return this.args.label === this.args.placeholder\n ? this.args.label\n : `${this.args.label}, ${this.args.placeholder}`;\n }\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 hasSelection: this.hasSelection\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 // Cached: the listbox, the empty content and the display limit read it, and\n // filtering a long list on every read would repeat the work per keystroke.\n @cached\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 /**\n * The matches the listbox renders: `filteredItems`, capped by\n * `@displayLimit`.\n */\n @cached\n get displayedItems() {\n const { displayLimit, isFilterable } = this.args;\n assert(\n `Select: @displayLimit must be a positive integer, received ${String(displayLimit)}`,\n displayLimit === undefined ||\n (Number.isInteger(displayLimit) && displayLimit > 0)\n );\n assert(\n 'Select: @displayLimit requires @isFilterable, otherwise the options past the limit cannot be reached',\n displayLimit === undefined || isFilterable\n );\n\n const selectedKeys = this.selectedKeys;\n return limitItems(this.filteredItems, displayLimit, (item) =>\n selectedKeys.includes(keyAndLabelForItem(item).key)\n );\n }\n\n /**\n * The options the hidden native `<select>` holds: the unfiltered `@items`,\n * capped by `@displayLimit` like the listbox, plus every selected option.\n *\n * The form value is the selected options, so it never needs the others.\n * Holding every item instead costs the same rendering the limit saves in\n * the listbox, and it is paid while the Select is closed: a page with a\n * hundred Selects over a thousand items each built a hundred thousand\n * hidden options. Unfiltered, so a filter can't change what the form sees.\n */\n @cached\n get mirroredItems() {\n const selectedKeys = this.selectedKeys;\n return limitItems(this.args.items, this.args.displayLimit, (item) =>\n selectedKeys.includes(keyAndLabelForItem(item).key)\n );\n }\n\n /**\n * What the display limit content reports, or `undefined` when nothing is\n * left out.\n */\n get displayLimitContent(): DisplayLimitContentArgs | undefined {\n const shown = this.displayedItems?.length ?? 0;\n const total = this.filteredItems?.length ?? 0;\n if (shown === total || this.args.hideDisplayLimitContent) {\n return undefined;\n }\n return { shown, total };\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={{this.mirroredItems}}\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 @isInvalid={{c.isInvalid}}\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.displayedItems}}\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 {{#if this.displayLimitContent}}\n <div\n class={{this.classes.displayLimitContent\n class=@classes.displayLimitContent\n }}\n data-part=\"display-limit-content\"\n >\n {{#if (has-block \"displayLimitContent\")}}\n {{yield this.displayLimitContent to=\"displayLimitContent\"}}\n {{else}}\n Showing\n {{this.displayLimitContent.shown}}\n of\n {{this.displayLimitContent.total}}. Type to narrow down.\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 type DisplayLimitContentArgs\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","preventDefault","showChips","removeLastSelectedKey","handleTriggerKeydown","isDisabled","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","displayedItems","displayLimit","assert","String","Number","isInteger","limitItems","mirroredItems","displayLimitContent","shown","total","hideDisplayLimitContent","autoActivateMode","updateMultipleSelectValue","modifier","updateSingleSelectValue","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Popover","VisuallyHidden","SelectNativeMirror","on","SelectedChips","SelectTrigger","SelectEndContent","Listbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAE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8G,KAAA;AAAOC,MAAAA;KAAM;AACxB,EAAA;EAEA,IAAIE,gBAAAA,GAAyC;IAC3C,IAAI,IAAI,CAAClH,WAAW,KAAKC,aAAa,IAAI,CAACD,WAAW,KAAK,EAAA,EAAI;AAC7D,MAAA,OAAO,UAAA;AACT,IAAA;AACA,IAAA,OAAO,OAAA;AACT,EAAA;AAEA;EACAmH,yBAAA,GAA4BC,QAAA,CAC1B,CAAC1C,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;EACAoI,uBAAA,GAA0BD,QAAA,CACxB,CAAC1C,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;IAAAkI,oBAAA,CAAAC,kBAAA,CAAA,ikPAAA,EAqPA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,cAAA;QAAAC,kBAAA;QAAAC,EAAA;QAAA3J,GAAA;QAAA4J,aAAA;QAAAC,aAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -17,7 +17,7 @@ const valueUnless = (condition, value) => condition ? undefined : value;
|
|
|
17
17
|
* hittable box when it has to share a flex line with the chips instead of
|
|
18
18
|
* being the whole field.
|
|
19
19
|
*/
|
|
20
|
-
const SelectTrigger = setComponentTemplate(precompileTemplate("{{#if @isFilterable}}\n {{!-- The filterable trigger is an input: the selectedItem block cannot\n render here, so the input always has its own value as its accessible text.\n Naming it from the selection as well would duplicate that value and make\n the combobox name change as the user types, so only chips mode, where the\n input shows nothing of the selection, names it. --}}\n <input type=\"text\" {{@trigger}} {{@triggerRef}} data-part=\"input\" disabled={{@isDisabled}} aria-label={{if @showChips @accessibleName}} placeholder={{valueUnless (and @showChips @hasSelection) @placeholder}} class={{@classes.input class=@userClasses.input hasStartContent=@hasStartContent hasEndContent=true hasChips=@showChips}} value={{@filterValue}} {{on \"input\" @onFilterInput}} {{on \"keydown\" @onFilterKeydown}} {{on \"focusout\" @onFocusOut}} />\n{{else}}\n <button type=\"button\" {{@trigger}} {{@triggerRef}} data-part=\"input\" disabled={{@isDisabled}} aria-label={{if (or @showChips @hasCustomContent) @accessibleName}} class={{@classes.input class=@userClasses.input hasStartContent=@hasStartContent hasEndContent=true hasChips=@showChips}} {{on \"keydown\" @onKeydown}} {{on \"focusout\" @onFocusOut}}>\n {{#if @hasSelection}}\n {{#unless @showChips}}\n <SelectedText @items={{@items}} @hasCustomContent={{@hasCustomContent}}>\n <:item as |selected|>{{yield selected to=\"selectedItem\"}}</:item>\n </SelectedText>\n {{/unless}}\n {{else}}\n <span data-part=\"placeholder\" class={{@classes.placeholder class=@userClasses.placeholder}}>\n {{#if @placeholder}}{{@placeholder}}{{else}} {{/if}}\n </span>\n {{/if}}\n </button>\n{{/if}}", {
|
|
20
|
+
const SelectTrigger = setComponentTemplate(precompileTemplate("{{#if @isFilterable}}\n {{!-- The filterable trigger is an input: the selectedItem block cannot\n render here, so the input always has its own value as its accessible text.\n Naming it from the selection as well would duplicate that value and make\n the combobox name change as the user types, so only chips mode, where the\n input shows nothing of the selection, names it. --}}\n <input type=\"text\" {{@trigger}} {{@triggerRef}} data-part=\"input\" disabled={{@isDisabled}} aria-invalid={{if @isInvalid \"true\"}} aria-label={{if @showChips @accessibleName}} placeholder={{valueUnless (and @showChips @hasSelection) @placeholder}} class={{@classes.input class=@userClasses.input hasStartContent=@hasStartContent hasEndContent=true hasChips=@showChips}} value={{@filterValue}} {{on \"input\" @onFilterInput}} {{on \"keydown\" @onFilterKeydown}} {{on \"focusout\" @onFocusOut}} />\n{{else}}\n <button type=\"button\" {{@trigger}} {{@triggerRef}} data-part=\"input\" disabled={{@isDisabled}} data-invalid={{if @isInvalid \"true\" \"false\"}} aria-label={{if (or @showChips @hasCustomContent) @accessibleName}} class={{@classes.input class=@userClasses.input hasStartContent=@hasStartContent hasEndContent=true hasChips=@showChips}} {{on \"keydown\" @onKeydown}} {{on \"focusout\" @onFocusOut}}>\n {{#if @hasSelection}}\n {{#unless @showChips}}\n <SelectedText @items={{@items}} @hasCustomContent={{@hasCustomContent}}>\n <:item as |selected|>{{yield selected to=\"selectedItem\"}}</:item>\n </SelectedText>\n {{/unless}}\n {{else}}\n <span data-part=\"placeholder\" class={{@classes.placeholder class=@userClasses.placeholder}}>\n {{#if @placeholder}}{{@placeholder}}{{else}} {{/if}}\n </span>\n {{/if}}\n </button>\n{{/if}}", {
|
|
21
21
|
strictMode: true,
|
|
22
22
|
scope: () => ({
|
|
23
23
|
valueUnless,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sources":["../../../../src/components/forms/select/trigger.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { SelectedText } from './selected-items';\nimport type {\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\nconst or = (a: unknown, b: unknown) => Boolean(a) || Boolean(b);\nconst valueUnless = <T,>(condition: unknown, value: T): T | undefined =>\n condition ? undefined : value;\n\ninterface SelectTriggerSignature {\n Args: {\n /** Whether the trigger is a filter input rather than a button. */\n isFilterable?: boolean;\n\n /** The popover's `trigger` modifier: what opens the dropdown. */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Records the trigger element. The field click forwarder and the listbox's\n * keyboard-event host both need the live element.\n */\n triggerRef: ModifierLike<{\n Element: HTMLInputElement | HTMLButtonElement;\n }>;\n\n isDisabled?: boolean;\n showChips: boolean;\n\n /**\n * Names the trigger when its own text cannot.\n *\n * In chips mode the trigger renders no text of its own (the chips are its\n * siblings and are read separately), so without this the combobox would be\n * announced unnamed. The same is true whenever `@hasCustomContent` is set:\n * the block may render nothing readable at all.\n */\n accessibleName: string;\n\n /**\n * Whether the consumer supplied a `:selectedItem` block, i.e. whether the\n * text inside the trigger is theirs rather than the option's label.\n *\n * Two things hang off this: the `<button>` trigger stops trusting its own\n * text content for its accessible name, and {@link SelectedText} switches\n * from the joined string to a per-selection loop. The filterable\n * `<input>` trigger ignores it -- the block never renders there, so the\n * input's own value still names it.\n */\n hasCustomContent?: boolean;\n\n placeholder?: string;\n hasSelection: boolean;\n hasStartContent: boolean;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /** The selection, for the text presentation inside a button trigger. */\n items: SelectedItem[];\n\n /** Current value of the filter input. */\n filterValue: string;\n onFilterInput: (event: Event) => void;\n onFilterKeydown: (event: KeyboardEvent) => void;\n onKeydown: (event: KeyboardEvent) => void;\n\n /**\n * Reports the trigger losing focus, as `focusout` rather than `blur`: the\n * Select decides whether focus actually left the control from the event's\n * `relatedTarget`, and browsers only guarantee that on `focusout`.\n */\n onFocusOut: (event: FocusEvent) => void;\n };\n Blocks: {\n /**\n * Content for one selected option, forwarded straight through to\n * {@link SelectedText}. Always supplied by the Select -- a block cannot be\n * passed conditionally -- so `@hasCustomContent` is what says whether it\n * holds the consumer's markup or the plain-label fallback.\n */\n selectedItem: [SelectedItemBlockArg<never>];\n };\n}\n\n/**\n * The Select's trigger: a filter `<input>` when `@isFilterable`, otherwise a\n * `<button>`.\n *\n * Both carry `data-part=\"input\"` (the Select's own `input` slot -- this is a\n * part of the `select` component, not a component of its own) and the same\n * `input` slot classes, whose `hasChips` variant is what gives the trigger a\n * hittable box when it has to share a flex line with the chips instead of\n * being the whole field.\n */\nconst SelectTrigger: TOC<SelectTriggerSignature> = <template>\n {{#if @isFilterable}}\n {{! The filterable trigger is an input: the selectedItem block cannot\n render here, so the input always has its own value as its accessible text.\n Naming it from the selection as well would duplicate that value and make\n the combobox name change as the user types, so only chips mode, where the\n input shows nothing of the selection, names it. }}\n <input\n type=\"text\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-label={{if @showChips @accessibleName}}\n placeholder={{valueUnless (and @showChips @hasSelection) @placeholder}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n value={{@filterValue}}\n {{on \"input\" @onFilterInput}}\n {{on \"keydown\" @onFilterKeydown}}\n {{on \"focusout\" @onFocusOut}}\n />\n {{else}}\n <button\n type=\"button\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-label={{if (or @showChips @hasCustomContent) @accessibleName}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n {{on \"keydown\" @onKeydown}}\n {{on \"focusout\" @onFocusOut}}\n >\n {{#if @hasSelection}}\n {{#unless @showChips}}\n <SelectedText\n @items={{@items}}\n @hasCustomContent={{@hasCustomContent}}\n >\n <:item as |selected|>{{yield selected to=\"selectedItem\"}}</:item>\n </SelectedText>\n {{/unless}}\n {{else}}\n <span\n data-part=\"placeholder\"\n class={{@classes.placeholder class=@userClasses.placeholder}}\n >\n {{#if @placeholder}}{{@placeholder}}{{else}} {{/if}}\n </span>\n {{/if}}\n </button>\n {{/if}}\n</template>;\n\nexport { SelectTrigger, type SelectTriggerSignature };\nexport default SelectTrigger;\n"],"names":["and","a","b","Boolean","or","valueUnless","condition","value","undefined","SelectTrigger","setComponentTemplate","precompileTemplate","strictMode","scope","on","SelectedText","templateOnly"],"mappings":";;;;;;AAWA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC9D,MAAME,EAAA,GAAKA,CAACH,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC7D,MAAMG,WAAA,GAAcA,CAAKC,SAAkB,EAAEC,KAAO,KAClDD,SAAA,GAAYE,SAAA,GAAYD,KAAA;
|
|
1
|
+
{"version":3,"file":"trigger.js","sources":["../../../../src/components/forms/select/trigger.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { SelectedText } from './selected-items';\nimport type {\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\nconst or = (a: unknown, b: unknown) => Boolean(a) || Boolean(b);\nconst valueUnless = <T,>(condition: unknown, value: T): T | undefined =>\n condition ? undefined : value;\n\ninterface SelectTriggerSignature {\n Args: {\n /** Whether the trigger is a filter input rather than a button. */\n isFilterable?: boolean;\n\n /** The popover's `trigger` modifier: what opens the dropdown. */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Records the trigger element. The field click forwarder and the listbox's\n * keyboard-event host both need the live element.\n */\n triggerRef: ModifierLike<{\n Element: HTMLInputElement | HTMLButtonElement;\n }>;\n\n isDisabled?: boolean;\n\n /**\n * Whether the field is invalid, as FormControl resolves it from `@isInvalid`\n * and `@errors`. The filterable trigger is a text input and takes\n * `aria-invalid`. The button trigger cannot: `aria-invalid` is not\n * supported on the button role, so it gets `data-invalid`, which the\n * theme's `select` recipe keys the same invalid border off.\n */\n isInvalid?: boolean;\n\n showChips: boolean;\n\n /**\n * Names the trigger when its own text cannot.\n *\n * In chips mode the trigger renders no text of its own (the chips are its\n * siblings and are read separately), so without this the combobox would be\n * announced unnamed. The same is true whenever `@hasCustomContent` is set:\n * the block may render nothing readable at all.\n */\n accessibleName: string;\n\n /**\n * Whether the consumer supplied a `:selectedItem` block, i.e. whether the\n * text inside the trigger is theirs rather than the option's label.\n *\n * Two things hang off this: the `<button>` trigger stops trusting its own\n * text content for its accessible name, and {@link SelectedText} switches\n * from the joined string to a per-selection loop. The filterable\n * `<input>` trigger ignores it -- the block never renders there, so the\n * input's own value still names it.\n */\n hasCustomContent?: boolean;\n\n placeholder?: string;\n hasSelection: boolean;\n hasStartContent: boolean;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /** The selection, for the text presentation inside a button trigger. */\n items: SelectedItem[];\n\n /** Current value of the filter input. */\n filterValue: string;\n onFilterInput: (event: Event) => void;\n onFilterKeydown: (event: KeyboardEvent) => void;\n onKeydown: (event: KeyboardEvent) => void;\n\n /**\n * Reports the trigger losing focus, as `focusout` rather than `blur`: the\n * Select decides whether focus actually left the control from the event's\n * `relatedTarget`, and browsers only guarantee that on `focusout`.\n */\n onFocusOut: (event: FocusEvent) => void;\n };\n Blocks: {\n /**\n * Content for one selected option, forwarded straight through to\n * {@link SelectedText}. Always supplied by the Select -- a block cannot be\n * passed conditionally -- so `@hasCustomContent` is what says whether it\n * holds the consumer's markup or the plain-label fallback.\n */\n selectedItem: [SelectedItemBlockArg<never>];\n };\n}\n\n/**\n * The Select's trigger: a filter `<input>` when `@isFilterable`, otherwise a\n * `<button>`.\n *\n * Both carry `data-part=\"input\"` (the Select's own `input` slot -- this is a\n * part of the `select` component, not a component of its own) and the same\n * `input` slot classes, whose `hasChips` variant is what gives the trigger a\n * hittable box when it has to share a flex line with the chips instead of\n * being the whole field.\n */\nconst SelectTrigger: TOC<SelectTriggerSignature> = <template>\n {{#if @isFilterable}}\n {{! The filterable trigger is an input: the selectedItem block cannot\n render here, so the input always has its own value as its accessible text.\n Naming it from the selection as well would duplicate that value and make\n the combobox name change as the user types, so only chips mode, where the\n input shows nothing of the selection, names it. }}\n <input\n type=\"text\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-invalid={{if @isInvalid \"true\"}}\n aria-label={{if @showChips @accessibleName}}\n placeholder={{valueUnless (and @showChips @hasSelection) @placeholder}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n value={{@filterValue}}\n {{on \"input\" @onFilterInput}}\n {{on \"keydown\" @onFilterKeydown}}\n {{on \"focusout\" @onFocusOut}}\n />\n {{else}}\n <button\n type=\"button\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n data-invalid={{if @isInvalid \"true\" \"false\"}}\n aria-label={{if (or @showChips @hasCustomContent) @accessibleName}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n {{on \"keydown\" @onKeydown}}\n {{on \"focusout\" @onFocusOut}}\n >\n {{#if @hasSelection}}\n {{#unless @showChips}}\n <SelectedText\n @items={{@items}}\n @hasCustomContent={{@hasCustomContent}}\n >\n <:item as |selected|>{{yield selected to=\"selectedItem\"}}</:item>\n </SelectedText>\n {{/unless}}\n {{else}}\n <span\n data-part=\"placeholder\"\n class={{@classes.placeholder class=@userClasses.placeholder}}\n >\n {{#if @placeholder}}{{@placeholder}}{{else}} {{/if}}\n </span>\n {{/if}}\n </button>\n {{/if}}\n</template>;\n\nexport { SelectTrigger, type SelectTriggerSignature };\nexport default SelectTrigger;\n"],"names":["and","a","b","Boolean","or","valueUnless","condition","value","undefined","SelectTrigger","setComponentTemplate","precompileTemplate","strictMode","scope","on","SelectedText","templateOnly"],"mappings":";;;;;;AAWA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC9D,MAAME,EAAA,GAAKA,CAACH,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC7D,MAAMG,WAAA,GAAcA,CAAKC,SAAkB,EAAEC,KAAO,KAClDD,SAAA,GAAYE,SAAA,GAAYD,KAAA;AAuF1B;;;;;;;;;AASC;AACD,MAAME,aAAmB,GAAAC,oBAAA,CAA0BC,kBAAA,CAAA,qwDAAA,EAgEnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAR,WAAA;IAAAL,GAAA;IAAAc,EAAA;IAAAV,EAAA;AAAAW,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;"}
|
|
@@ -10,7 +10,7 @@ import { useStyles } from '@frontile/theme';
|
|
|
10
10
|
import { isBelowBreakpoint, watchBreakpoint } from '../../utils/breakpoint.js';
|
|
11
11
|
import { globalDocument } from '../../utils/document-listener.js';
|
|
12
12
|
import { AppLayoutState } from './app-layout-state.js';
|
|
13
|
-
import { ControlledAppLayoutState } from './context.js';
|
|
13
|
+
import { ControlledAppLayoutState, layoutVariants } from './context.js';
|
|
14
14
|
import { Aside } from './aside.js';
|
|
15
15
|
import { AsideToggle } from './aside-toggle.js';
|
|
16
16
|
import { BottomNav } from './bottom-nav.js';
|
|
@@ -210,6 +210,22 @@ class AppLayout extends Component {
|
|
|
210
210
|
get navbarPlacement() {
|
|
211
211
|
return this.args.navbarPlacement ?? 'frame';
|
|
212
212
|
}
|
|
213
|
+
get color() {
|
|
214
|
+
return this.args.color ?? 'neutral';
|
|
215
|
+
}
|
|
216
|
+
get sidebarSurface() {
|
|
217
|
+
return this.args.sidebarSurface ?? 'plain';
|
|
218
|
+
}
|
|
219
|
+
get navbarSurface() {
|
|
220
|
+
return this.args.navbarSurface ?? 'plain';
|
|
221
|
+
}
|
|
222
|
+
get frameGradient() {
|
|
223
|
+
return this.args.frameGradient ?? false;
|
|
224
|
+
}
|
|
225
|
+
get cardSurface() {
|
|
226
|
+
// A gradient pairs with a card it shows through; a flat frame keeps it solid.
|
|
227
|
+
return this.args.cardSurface ?? (this.frameGradient ? 'translucent' : 'solid');
|
|
228
|
+
}
|
|
213
229
|
get breakpoint() {
|
|
214
230
|
return this.args.breakpoint ?? 'md';
|
|
215
231
|
}
|
|
@@ -230,12 +246,27 @@ class AppLayout extends Component {
|
|
|
230
246
|
appLayout
|
|
231
247
|
} = useStyles();
|
|
232
248
|
return appLayout({
|
|
249
|
+
...layoutVariants(this.config),
|
|
250
|
+
variant: this.variant,
|
|
251
|
+
cardSurface: this.cardSurface,
|
|
252
|
+
color: this.color
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/** What the layout tells its parts, which build their own styles from it. */
|
|
256
|
+
static {
|
|
257
|
+
decorateMethodV2(this.prototype, "styles", [cached]);
|
|
258
|
+
}
|
|
259
|
+
get config() {
|
|
260
|
+
return {
|
|
233
261
|
variant: this.variant,
|
|
234
262
|
navbarPlacement: this.navbarPlacement,
|
|
235
263
|
breakpoint: this.breakpoint,
|
|
236
264
|
scrollMode: this.scrollMode,
|
|
237
|
-
sidebarSide: this.sidebarSide
|
|
238
|
-
|
|
265
|
+
sidebarSide: this.sidebarSide,
|
|
266
|
+
color: this.color,
|
|
267
|
+
sidebarSurface: this.sidebarSurface,
|
|
268
|
+
navbarSurface: this.navbarSurface
|
|
269
|
+
};
|
|
239
270
|
}
|
|
240
271
|
/**
|
|
241
272
|
* The root's classes. Kept out of `styles`, which the context shares with
|
|
@@ -243,17 +274,17 @@ class AppLayout extends Component {
|
|
|
243
274
|
* state comes from that context, so putting it there would be a cycle.
|
|
244
275
|
*/
|
|
245
276
|
static {
|
|
246
|
-
decorateMethodV2(this.prototype, "
|
|
277
|
+
decorateMethodV2(this.prototype, "config", [cached]);
|
|
247
278
|
}
|
|
248
279
|
get rootClass() {
|
|
249
280
|
const {
|
|
250
281
|
appLayout
|
|
251
282
|
} = useStyles();
|
|
252
283
|
return appLayout({
|
|
284
|
+
...layoutVariants(this.config),
|
|
253
285
|
variant: this.variant,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
scrollMode: this.scrollMode,
|
|
286
|
+
color: this.color,
|
|
287
|
+
frameGradient: this.frameGradient,
|
|
257
288
|
sidebarColumn: this.sidebarColumn,
|
|
258
289
|
sidebarSize: this.registeredSidebar?.size,
|
|
259
290
|
bottomNavRow: this.bottomNavShown ? 'shown' : 'none'
|
|
@@ -291,13 +322,7 @@ class AppLayout extends Component {
|
|
|
291
322
|
asideId: this.asideId,
|
|
292
323
|
asideDrawerId: this.asideDrawerId,
|
|
293
324
|
styles: this.styles,
|
|
294
|
-
config:
|
|
295
|
-
variant: this.variant,
|
|
296
|
-
navbarPlacement: this.navbarPlacement,
|
|
297
|
-
breakpoint: this.breakpoint,
|
|
298
|
-
scrollMode: this.scrollMode,
|
|
299
|
-
sidebarSide: this.sidebarSide
|
|
300
|
-
},
|
|
325
|
+
config: this.config,
|
|
301
326
|
classes: this.args.classes,
|
|
302
327
|
get belowBreakpoint() {
|
|
303
328
|
return layout.belowBreakpoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-layout.js","sources":["../../../src/components/layout/app-layout.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { guidFor } from '@ember/object/internals';\nimport { schedule } from '@ember/runloop';\nimport { isDestroying } from '@ember/destroyable';\nimport { modifier } from 'ember-modifier';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport {\n isBelowBreakpoint,\n watchBreakpoint,\n type Breakpoint\n} from '../../utils/breakpoint';\nimport { globalDocument } from '../../utils/document-listener';\nimport { AppLayoutState } from './app-layout-state';\nimport {\n ControlledAppLayoutState,\n type AppLayoutContext,\n type RegisteredSidebar\n} from './context';\nimport Aside from './aside';\nimport AsideToggle from './aside-toggle';\nimport BottomNav from './bottom-nav';\nimport Main from './main';\nimport MenuToggle from './menu-toggle';\nimport Navbar from './navbar';\nimport PageHeader from './page-header';\nimport Sidebar from './sidebar';\nimport SidebarToggle from './sidebar-toggle';\nimport type { AppLayoutSlots, AppLayoutVariants } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface AppLayoutArgs {\n /**\n * `inset` draws the content in a rounded card on a tinted frame.\n * `attached` runs the content edge to edge, with no card.\n *\n * @defaultValue 'inset'\n */\n variant?: AppLayoutVariants['variant'];\n\n /**\n * Where the navbar sits in the `inset` variant. `frame` puts it on the\n * tinted frame above the card; `content` makes it the card's first row.\n *\n * @defaultValue 'frame'\n */\n navbarPlacement?: AppLayoutVariants['navbarPlacement'];\n\n /**\n * The viewport width (`sm` 40rem, `md` 48rem, `lg` 64rem) below which the\n * sidebar becomes a drawer opened by `MenuToggle`. Growing past it closes\n * an open drawer. Without `window.matchMedia` the layout stays desktop.\n *\n * @defaultValue 'md'\n */\n breakpoint?: AppLayoutVariants['breakpoint'];\n\n /**\n * How navigation is shown below `@breakpoint`. `drawer` moves the sidebar\n * into a drawer opened by `MenuToggle`. `bottom` shows the yielded\n * `BottomNav` as a bar along the bottom instead, and renders no sidebar,\n * `MenuToggle` or `SidebarToggle` there. At or above `@breakpoint` both are\n * the desktop sidebar, and `BottomNav` renders nothing. Place `BottomNav`\n * after `Main`.\n *\n * @defaultValue 'drawer'\n */\n mobileNav?: 'drawer' | 'bottom';\n\n /**\n * Which side the sidebar sits on. Logical, so `start` is the right side in\n * a right-to-left document.\n *\n * @defaultValue 'start'\n */\n sidebarSide?: 'start' | 'end';\n\n /**\n * `content` fills the viewport and scrolls `Main` on its own. `page` lets\n * the document scroll instead.\n *\n * @defaultValue 'content'\n */\n scrollMode?: AppLayoutVariants['scrollMode'];\n\n /**\n * Renders a \"Skip to main content\" link as the first focusable element.\n *\n * @defaultValue true\n */\n skipLink?: boolean;\n\n /**\n * The text of the skip link.\n *\n * @defaultValue 'Skip to main content'\n */\n skipLinkLabel?: string;\n\n /**\n * Whether the desktop sidebar is collapsed. Passing it makes the value\n * controlled: toggles call `@onSidebarCollapsedChange` and wait for the\n * argument to change. Ignored when `@state` is passed.\n */\n sidebarCollapsed?: boolean;\n\n /**\n * The initial `sidebarCollapsed` when uncontrolled.\n *\n * @defaultValue false\n */\n defaultSidebarCollapsed?: boolean;\n\n /** Called with the new value when the sidebar is collapsed or expanded. */\n onSidebarCollapsedChange?: (value: boolean) => void;\n\n /**\n * Whether the mobile sidebar drawer is open. Passing it makes the value\n * controlled. Ignored when `@state` is passed.\n */\n mobileSidebarOpen?: boolean;\n\n /**\n * The initial `mobileSidebarOpen` when uncontrolled.\n *\n * @defaultValue false\n */\n defaultMobileSidebarOpen?: boolean;\n\n /** Called with the new value when the mobile drawer opens or closes. */\n onMobileSidebarOpenChange?: (value: boolean) => void;\n\n /**\n * Whether the aside is open. Passing it makes the value controlled.\n * Ignored when `@state` is passed.\n */\n asideOpen?: boolean;\n\n /**\n * The initial `asideOpen` when uncontrolled.\n *\n * @defaultValue false\n */\n defaultAsideOpen?: boolean;\n\n /** Called with the new value when the aside opens or closes. */\n onAsideOpenChange?: (value: boolean) => void;\n\n /**\n * A shared `AppLayoutState` to drive the layout from elsewhere in the app.\n * When passed, it is the only source of state: the individual state\n * arguments and their callbacks are ignored.\n */\n state?: AppLayoutState;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<AppLayoutSlots>;\n}\n\ninterface AppLayoutSignature {\n Args: AppLayoutArgs;\n Blocks: {\n default: [\n {\n state: AppLayoutState;\n Aside: WithBoundArgs<typeof Aside, 'layout'>;\n AsideToggle: WithBoundArgs<typeof AsideToggle, 'layout'>;\n BottomNav: WithBoundArgs<typeof BottomNav, 'layout'>;\n Main: WithBoundArgs<typeof Main, 'layout'>;\n MenuToggle: WithBoundArgs<typeof MenuToggle, 'layout'>;\n Navbar: WithBoundArgs<typeof Navbar, 'layout'>;\n PageHeader: WithBoundArgs<typeof PageHeader, 'layout'>;\n Sidebar: WithBoundArgs<typeof Sidebar, 'layout'>;\n SidebarToggle: WithBoundArgs<typeof SidebarToggle, 'layout'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * A part registered with the layout. It is written after render: the parts\n * that read it may already have rendered in this pass, and writing it\n * synchronously would trip Glimmer's backtracking assertion.\n */\nclass RegisteredPart<T extends object> {\n #owner: object;\n @tracked current?: T;\n\n constructor(owner: object) {\n this.#owner = owner;\n }\n\n register = (part: T): (() => void) => {\n schedule('afterRender', () => {\n if (!isDestroying(this.#owner)) {\n this.current = part;\n }\n });\n return () => {\n schedule('afterRender', () => {\n if (!isDestroying(this.#owner) && this.current === part) {\n this.current = undefined;\n }\n });\n };\n };\n}\n\n/**\n * The application shell. Its root is a grid that the yielded parts place\n * themselves in, so they can be written in any order.\n */\nclass AppLayout extends Component<AppLayoutSignature> {\n #controlled: ControlledAppLayoutState;\n\n constructor(owner: Owner, args: AppLayoutArgs) {\n super(owner, args);\n const own = new AppLayoutState({\n sidebarCollapsed: args.defaultSidebarCollapsed,\n mobileSidebarOpen: args.defaultMobileSidebarOpen,\n asideOpen: args.defaultAsideOpen\n });\n this.#controlled = new ControlledAppLayoutState(own, () => this.args);\n }\n\n willDestroy(): void {\n super.willDestroy();\n stopWatcher(watchers, this);\n stopWatcher(asideWatchers, this);\n }\n\n /**\n * The root's direction, read once it is in the DOM. Until then `isRtl`\n * falls back to the document's. Tracked so drawer placements computed on\n * the first render (an aside drawer mounts closed) pick up an RTL\n * ancestor of the root. Set after render, where changing state is safe.\n */\n @tracked rootRtl?: boolean;\n\n captureRoot = modifier((element: HTMLElement) => {\n schedule('afterRender', () => {\n if (this.isDestroying) {\n return;\n }\n const rtl = getComputedStyle(element).direction === 'rtl';\n if (rtl !== this.rootRtl) {\n this.rootRtl = rtl;\n }\n });\n });\n\n /**\n * Rebuilt only when `@breakpoint` changes; the previous watcher stops.\n */\n @cached\n get breakpointWatcher(): BreakpointWatcher {\n return replaceWatcher(\n watchers,\n this,\n this.breakpoint,\n this.closeDrawerWhenWide\n );\n }\n\n closeDrawerWhenWide = (below: boolean): void => {\n if (!below && this.state.mobileSidebarOpen) {\n this.state.mobileSidebarOpen = false;\n }\n };\n\n get belowBreakpoint(): boolean {\n return this.breakpointWatcher.below;\n }\n\n /** The aside is a drawer below `lg`, whatever `@breakpoint` is. */\n @cached\n get asideWatcher(): BreakpointWatcher {\n return replaceWatcher(asideWatchers, this, 'lg', this.closeAsideWhenNarrow);\n }\n\n /**\n * An aside open beside `Main` closes when the viewport narrows below `lg`,\n * rather than reappearing as a modal drawer the user did not ask for.\n */\n closeAsideWhenNarrow = (below: boolean): void => {\n if (below && this.state.asideOpen) {\n this.state.asideOpen = false;\n }\n };\n\n get belowAsideBreakpoint(): boolean {\n return this.asideWatcher.below;\n }\n\n // The Sidebar, BottomNav and Aside register with the layout; see\n // `RegisteredPart`. The toggles read the Sidebar and Aside, the root the\n // BottomNav for its bottom row.\n sidebarPart = new RegisteredPart<RegisteredSidebar>(this);\n bottomNavPart = new RegisteredPart<object>(this);\n asidePart = new RegisteredPart<object>(this);\n\n registerSidebar = this.sidebarPart.register;\n registerBottomNav = this.bottomNavPart.register;\n registerAside = this.asidePart.register;\n\n get registeredSidebar(): RegisteredSidebar | undefined {\n return this.sidebarPart.current;\n }\n\n get registeredBottomNav(): object | undefined {\n return this.bottomNavPart.current;\n }\n\n get registeredAside(): object | undefined {\n return this.asidePart.current;\n }\n\n get mobileNav(): 'drawer' | 'bottom' {\n return this.args.mobileNav ?? 'drawer';\n }\n\n /** The bottom bar replaces the sidebar: bottom mode, below the breakpoint. */\n get bottomNavMode(): boolean {\n return this.mobileNav === 'bottom' && this.belowBreakpoint;\n }\n\n /**\n * There is no drawer in bottom mode below the breakpoint, so an open flag\n * (seeded, set through `@state`, or left over) is cleared rather than\n * opening a drawer later. Deferred to after render, where changing state\n * is safe.\n */\n closeDrawerInBottomMode = modifier(\n (_element: HTMLElement, [active, open]: [boolean, boolean]) => {\n if (active && open) {\n schedule('afterRender', () => {\n if (!this.isDestroying && this.bottomNavMode) {\n this.state.mobileSidebarOpen = false;\n }\n });\n }\n }\n );\n\n get bottomNavShown(): boolean {\n return this.bottomNavMode && this.registeredBottomNav !== undefined;\n }\n\n get effectiveSidebarCollapsed(): boolean {\n return this.registeredSidebar\n ? this.registeredSidebar.collapsed\n : this.state.sidebarCollapsed;\n }\n\n isRtl = (): boolean => {\n if (this.rootRtl !== undefined) {\n return this.rootRtl;\n }\n const element = globalDocument()?.documentElement;\n return element ? getComputedStyle(element).direction === 'rtl' : false;\n };\n\n get state(): AppLayoutState {\n return this.args.state ?? this.#controlled;\n }\n\n get mainId(): string {\n return `${guidFor(this)}-main`;\n }\n\n get sidebarId(): string {\n return `${guidFor(this)}-sidebar`;\n }\n\n get menuToggleId(): string {\n return `${guidFor(this)}-menu-toggle`;\n }\n\n get drawerId(): string {\n return `${guidFor(this)}-drawer`;\n }\n\n get asideId(): string {\n return `${guidFor(this)}-aside`;\n }\n\n get asideDrawerId(): string {\n return `${guidFor(this)}-aside-drawer`;\n }\n\n get variant(): 'inset' | 'attached' {\n return this.args.variant ?? 'inset';\n }\n\n get navbarPlacement(): 'frame' | 'content' {\n return this.args.navbarPlacement ?? 'frame';\n }\n\n get breakpoint(): 'sm' | 'md' | 'lg' {\n return this.args.breakpoint ?? 'md';\n }\n\n get scrollMode(): 'content' | 'page' {\n return this.args.scrollMode ?? 'content';\n }\n\n get sidebarSide(): 'start' | 'end' {\n return this.args.sidebarSide ?? 'start';\n }\n\n get hasCard(): boolean {\n return this.variant === 'inset';\n }\n\n get showSkipLink(): boolean {\n return this.args.skipLink ?? true;\n }\n\n @cached\n get styles() {\n const { appLayout } = useStyles();\n\n return appLayout({\n variant: this.variant,\n navbarPlacement: this.navbarPlacement,\n breakpoint: this.breakpoint,\n scrollMode: this.scrollMode,\n sidebarSide: this.sidebarSide\n });\n }\n\n /**\n * The root's classes. Kept out of `styles`, which the context shares with\n * the parts: `sidebarColumn` reads the registered `Sidebar`, whose own\n * state comes from that context, so putting it there would be a cycle.\n */\n get rootClass(): string {\n const { appLayout } = useStyles();\n\n return appLayout({\n variant: this.variant,\n navbarPlacement: this.navbarPlacement,\n breakpoint: this.breakpoint,\n scrollMode: this.scrollMode,\n sidebarColumn: this.sidebarColumn,\n sidebarSize: this.registeredSidebar?.size,\n bottomNavRow: this.bottomNavShown ? 'shown' : 'none'\n }).base({ class: this.args.classes?.base });\n }\n\n /**\n * What the root publishes as `--app-sidebar-width` (see the `base` slot in\n * the theme): the width of the sidebar column, or none when there is no\n * column: no Sidebar registered, the sidebar is a drawer below the\n * breakpoint, or it is collapsed off-canvas. A published token only: it\n * settles after the first render (`none` until a Sidebar registers), and\n * the sidebar's own width does not read it.\n */\n get sidebarColumn(): 'shown' | 'collapsed' | 'none' {\n const sidebar = this.registeredSidebar;\n if (!sidebar || this.belowBreakpoint) {\n return 'none';\n }\n if (sidebar.collapsed) {\n return sidebar.collapsible === 'offcanvas' ? 'none' : 'collapsed';\n }\n return 'shown';\n }\n\n @cached\n get context(): AppLayoutContext {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const layout = this;\n return {\n state: this.state,\n mainId: this.mainId,\n sidebarId: this.sidebarId,\n menuToggleId: this.menuToggleId,\n drawerId: this.drawerId,\n asideId: this.asideId,\n asideDrawerId: this.asideDrawerId,\n styles: this.styles,\n config: {\n variant: this.variant,\n navbarPlacement: this.navbarPlacement,\n breakpoint: this.breakpoint,\n scrollMode: this.scrollMode,\n sidebarSide: this.sidebarSide\n },\n classes: this.args.classes,\n get belowBreakpoint() {\n return layout.belowBreakpoint;\n },\n get belowAsideBreakpoint() {\n return layout.belowAsideBreakpoint;\n },\n get sidebarCollapsed() {\n return layout.effectiveSidebarCollapsed;\n },\n get mobileNav() {\n return layout.mobileNav;\n },\n get bottomNavMode() {\n return layout.bottomNavMode;\n },\n get bottomNavShown() {\n return layout.bottomNavShown;\n },\n get hasSidebar() {\n return layout.registeredSidebar !== undefined;\n },\n get canToggleSidebar() {\n return layout.registeredSidebar !== undefined && !layout.bottomNavMode;\n },\n get hasAside() {\n return layout.registeredAside !== undefined;\n },\n isRtl: this.isRtl,\n registerSidebar: this.registerSidebar,\n registerBottomNav: this.registerBottomNav,\n registerAside: this.registerAside\n };\n }\n\n focusMain = (event: Event): void => {\n const main = document.getElementById(this.mainId);\n if (main) {\n event.preventDefault();\n main.focus();\n }\n };\n\n // Browsers activate a link on Enter with a click, but a synthetic key\n // event does not; handling Enter directly makes both paths the same.\n focusMainOnEnter = (event: KeyboardEvent): void => {\n if (event.key === 'Enter') {\n this.focusMain(event);\n }\n };\n\n <template>\n <div\n data-component=\"app-layout\"\n data-part=\"base\"\n data-variant={{this.variant}}\n data-navbar-placement={{this.navbarPlacement}}\n data-scroll-mode={{this.scrollMode}}\n data-breakpoint={{this.breakpoint}}\n data-sidebar-side={{this.sidebarSide}}\n data-mobile-nav={{this.mobileNav}}\n data-sidebar-collapsed={{boolString this.effectiveSidebarCollapsed}}\n data-mobile-sidebar-open={{boolString this.state.mobileSidebarOpen}}\n data-aside-open={{boolString this.state.asideOpen}}\n class={{this.rootClass}}\n {{this.captureRoot}}\n {{this.closeDrawerInBottomMode\n this.bottomNavMode\n this.state.mobileSidebarOpen\n }}\n ...attributes\n >\n {{#if this.showSkipLink}}\n <a\n href=\"#{{this.mainId}}\"\n data-part=\"skip-link\"\n class={{this.styles.skipLink class=@classes.skipLink}}\n {{on \"click\" this.focusMain}}\n {{on \"keydown\" this.focusMainOnEnter}}\n >\n {{if @skipLinkLabel @skipLinkLabel \"Skip to main content\"}}\n </a>\n {{/if}}\n {{#if this.hasCard}}\n <div\n data-part=\"main-card\"\n aria-hidden=\"true\"\n class={{this.styles.mainCard class=@classes.mainCard}}\n ></div>\n {{/if}}\n {{yield\n (hash\n state=this.state\n Aside=(component Aside layout=this.context)\n AsideToggle=(component AsideToggle layout=this.context)\n BottomNav=(component BottomNav layout=this.context)\n Main=(component Main layout=this.context)\n MenuToggle=(component MenuToggle layout=this.context)\n Navbar=(component Navbar layout=this.context)\n PageHeader=(component PageHeader layout=this.context)\n Sidebar=(component Sidebar layout=this.context)\n SidebarToggle=(component SidebarToggle layout=this.context)\n )\n }}\n </div>\n </template>\n}\n\nfunction boolString(value: boolean): 'true' | 'false' {\n return value ? 'true' : 'false';\n}\n\n/** Tracks whether the viewport is below one breakpoint. */\nclass BreakpointWatcher {\n @tracked below: boolean;\n #stop: () => void;\n\n constructor(breakpoint: Breakpoint, onChange: (below: boolean) => void) {\n this.below = isBelowBreakpoint(breakpoint);\n this.#stop = watchBreakpoint(breakpoint, (below) => {\n onChange(below);\n this.below = below;\n });\n }\n\n stop(): void {\n this.#stop();\n }\n}\n\nconst watchers = new WeakMap<object, BreakpointWatcher>();\nconst asideWatchers = new WeakMap<object, BreakpointWatcher>();\n\n/**\n * Stops `owner`'s current watcher, if any, and starts one for `breakpoint`.\n * Once `owner` is being torn down it returns a watcher that is not listening\n * and not registered, so a late read cannot leak a listener.\n */\nfunction replaceWatcher(\n registry: WeakMap<object, BreakpointWatcher>,\n owner: Component<AppLayoutSignature>,\n breakpoint: Breakpoint,\n onChange: (below: boolean) => void\n): BreakpointWatcher {\n stopWatcher(registry, owner);\n const watcher = new BreakpointWatcher(breakpoint, onChange);\n if (owner.isDestroying) {\n watcher.stop();\n return watcher;\n }\n registry.set(owner, watcher);\n return watcher;\n}\n\nfunction stopWatcher(\n registry: WeakMap<object, BreakpointWatcher>,\n owner: object\n): void {\n registry.get(owner)?.stop();\n registry.delete(owner);\n}\n\nexport { AppLayout, type AppLayoutSignature, type AppLayoutArgs };\nexport default AppLayout;\n"],"names":["RegisteredPart","g","prototype","tracked","i","constructor","owner","register","part","schedule","isDestroying","current","undefined","AppLayout","Component","args","own","AppLayoutState","sidebarCollapsed","defaultSidebarCollapsed","mobileSidebarOpen","defaultMobileSidebarOpen","asideOpen","defaultAsideOpen","ControlledAppLayoutState","willDestroy","stopWatcher","watchers","asideWatchers","captureRoot","modifier","element","rtl","getComputedStyle","direction","rootRtl","breakpointWatcher","replaceWatcher","breakpoint","closeDrawerWhenWide","n","cached","below","state","belowBreakpoint","asideWatcher","closeAsideWhenNarrow","belowAsideBreakpoint","sidebarPart","bottomNavPart","asidePart","registerSidebar","registerBottomNav","registerAside","registeredSidebar","registeredBottomNav","registeredAside","mobileNav","bottomNavMode","closeDrawerInBottomMode","_element","active","open","bottomNavShown","effectiveSidebarCollapsed","collapsed","isRtl","globalDocument","documentElement","mainId","guidFor","sidebarId","menuToggleId","drawerId","asideId","asideDrawerId","variant","navbarPlacement","scrollMode","sidebarSide","hasCard","showSkipLink","skipLink","styles","appLayout","useStyles","rootClass","sidebarColumn","sidebarSize","size","bottomNavRow","base","class","classes","sidebar","collapsible","context","layout","config","hasSidebar","canToggleSidebar","hasAside","focusMain","event","main","document","getElementById","preventDefault","focus","focusMainOnEnter","key","setComponentTemplate","precompileTemplate","strictMode","scope","boolString","on","hash","Aside","AsideToggle","BottomNav","Main","MenuToggle","Navbar","PageHeader","Sidebar","SidebarToggle","value","BreakpointWatcher","onChange","isBelowBreakpoint","watchBreakpoint","stop","WeakMap","registry","watcher","set","get","delete"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuLA;;;;;AAKA,MAAMA,cAAA,CAA+B;AACnC,EAAA,MAAM;AAAS,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACdC,OAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;EAEDC,WAAAA,CAAYC,KAAa,EAAE;AACzB,IAAA,IAAI,CAAC,MAAM,GAAGA,KAAA;AAChB,EAAA;EAEAC,QAAA,GAAYC,IAAM,IAAe;IAC/BC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AAA,CAAA;AAClB;;"}
|
|
1
|
+
{"version":3,"file":"app-layout.js","sources":["../../../src/components/layout/app-layout.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { guidFor } from '@ember/object/internals';\nimport { schedule } from '@ember/runloop';\nimport { isDestroying } from '@ember/destroyable';\nimport { modifier } from 'ember-modifier';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport {\n isBelowBreakpoint,\n watchBreakpoint,\n type Breakpoint\n} from '../../utils/breakpoint';\nimport { globalDocument } from '../../utils/document-listener';\nimport { AppLayoutState } from './app-layout-state';\nimport {\n ControlledAppLayoutState,\n layoutVariants,\n type AppLayoutConfig,\n type AppLayoutContext,\n type RegisteredSidebar\n} from './context';\nimport Aside from './aside';\nimport AsideToggle from './aside-toggle';\nimport BottomNav from './bottom-nav';\nimport Main from './main';\nimport MenuToggle from './menu-toggle';\nimport Navbar from './navbar';\nimport PageHeader from './page-header';\nimport Sidebar from './sidebar';\nimport SidebarToggle from './sidebar-toggle';\nimport type { AppLayoutSlots, AppLayoutVariants } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface AppLayoutArgs {\n /**\n * `inset` draws the content in a rounded card on a tinted frame.\n * `attached` runs the content edge to edge, with no card.\n *\n * @defaultValue 'inset'\n */\n variant?: AppLayoutVariants['variant'];\n\n /**\n * Where the navbar sits in the `inset` variant. `frame` puts it on the\n * tinted frame above the card; `content` makes it the card's first row.\n *\n * @defaultValue 'frame'\n */\n navbarPlacement?: AppLayoutVariants['navbarPlacement'];\n\n /**\n * The shell's color, one of the theme's semantic categories. It tints the\n * sidebar's rows (hover and the current page), colors a `solid` sidebar or\n * navbar, and is the frame gradient's tint. `neutral` is the plain shell.\n * A `Sidebar` or `Navbar` can take its own `@color`. Published as the\n * `--app-layout-color`, `--app-layout-color-strong` and\n * `--app-layout-on-color` properties on the root, which an app can set\n * itself for a color outside the theme.\n *\n * @defaultValue 'neutral'\n */\n color?: AppLayoutVariants['color'];\n\n /**\n * How the sidebar wears `@color`: `plain` keeps its ground and tints its\n * rows; `solid` fills it with the color, with rows in its contrast color.\n * The phone drawer always tints. A `Sidebar`'s own `@surface` wins.\n *\n * @defaultValue 'plain'\n */\n sidebarSurface?: AppLayoutVariants['sidebarSurface'];\n\n /**\n * How the navbar wears `@color`: `plain` keeps its ground; `solid` fills\n * it with the color. A `Navbar`'s own `@surface` wins.\n *\n * @defaultValue 'plain'\n */\n navbarSurface?: AppLayoutVariants['navbarSurface'];\n\n /**\n * Whether the frame carries a faint left-to-right tint of `@color`, fading\n * to a neutral grey across the content. The stops are the\n * `--app-frame-gradient-from` and `--app-frame-gradient-to` properties.\n *\n * @defaultValue false\n */\n frameGradient?: boolean;\n\n /**\n * Whether the `inset` card is opaque (`solid`) or lets the frame's gradient\n * show through (`translucent`, `surface-app` at 50%). No effect on\n * `attached`, which has no card.\n *\n * @defaultValue 'translucent' with `@frameGradient`, else 'solid'\n */\n cardSurface?: AppLayoutVariants['cardSurface'];\n\n /**\n * The viewport width (`sm` 40rem, `md` 48rem, `lg` 64rem) below which the\n * sidebar becomes a drawer opened by `MenuToggle`. Growing past it closes\n * an open drawer. Without `window.matchMedia` the layout stays desktop.\n *\n * @defaultValue 'md'\n */\n breakpoint?: AppLayoutVariants['breakpoint'];\n\n /**\n * How navigation is shown below `@breakpoint`. `drawer` moves the sidebar\n * into a drawer opened by `MenuToggle`. `bottom` shows the yielded\n * `BottomNav` as a bar along the bottom instead, and renders no sidebar,\n * `MenuToggle` or `SidebarToggle` there. At or above `@breakpoint` both are\n * the desktop sidebar, and `BottomNav` renders nothing. Place `BottomNav`\n * after `Main`.\n *\n * @defaultValue 'drawer'\n */\n mobileNav?: 'drawer' | 'bottom';\n\n /**\n * Which side the sidebar sits on. Logical, so `start` is the right side in\n * a right-to-left document.\n *\n * @defaultValue 'start'\n */\n sidebarSide?: 'start' | 'end';\n\n /**\n * `content` fills the viewport and scrolls `Main` on its own. `page` lets\n * the document scroll instead.\n *\n * @defaultValue 'content'\n */\n scrollMode?: AppLayoutVariants['scrollMode'];\n\n /**\n * Renders a \"Skip to main content\" link as the first focusable element.\n *\n * @defaultValue true\n */\n skipLink?: boolean;\n\n /**\n * The text of the skip link.\n *\n * @defaultValue 'Skip to main content'\n */\n skipLinkLabel?: string;\n\n /**\n * Whether the desktop sidebar is collapsed. Passing it makes the value\n * controlled: toggles call `@onSidebarCollapsedChange` and wait for the\n * argument to change. Ignored when `@state` is passed.\n */\n sidebarCollapsed?: boolean;\n\n /**\n * The initial `sidebarCollapsed` when uncontrolled.\n *\n * @defaultValue false\n */\n defaultSidebarCollapsed?: boolean;\n\n /** Called with the new value when the sidebar is collapsed or expanded. */\n onSidebarCollapsedChange?: (value: boolean) => void;\n\n /**\n * Whether the mobile sidebar drawer is open. Passing it makes the value\n * controlled. Ignored when `@state` is passed.\n */\n mobileSidebarOpen?: boolean;\n\n /**\n * The initial `mobileSidebarOpen` when uncontrolled.\n *\n * @defaultValue false\n */\n defaultMobileSidebarOpen?: boolean;\n\n /** Called with the new value when the mobile drawer opens or closes. */\n onMobileSidebarOpenChange?: (value: boolean) => void;\n\n /**\n * Whether the aside is open. Passing it makes the value controlled.\n * Ignored when `@state` is passed.\n */\n asideOpen?: boolean;\n\n /**\n * The initial `asideOpen` when uncontrolled.\n *\n * @defaultValue false\n */\n defaultAsideOpen?: boolean;\n\n /** Called with the new value when the aside opens or closes. */\n onAsideOpenChange?: (value: boolean) => void;\n\n /**\n * A shared `AppLayoutState` to drive the layout from elsewhere in the app.\n * When passed, it is the only source of state: the individual state\n * arguments and their callbacks are ignored.\n */\n state?: AppLayoutState;\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<AppLayoutSlots>;\n}\n\ninterface AppLayoutSignature {\n Args: AppLayoutArgs;\n Blocks: {\n default: [\n {\n state: AppLayoutState;\n Aside: WithBoundArgs<typeof Aside, 'layout'>;\n AsideToggle: WithBoundArgs<typeof AsideToggle, 'layout'>;\n BottomNav: WithBoundArgs<typeof BottomNav, 'layout'>;\n Main: WithBoundArgs<typeof Main, 'layout'>;\n MenuToggle: WithBoundArgs<typeof MenuToggle, 'layout'>;\n Navbar: WithBoundArgs<typeof Navbar, 'layout'>;\n PageHeader: WithBoundArgs<typeof PageHeader, 'layout'>;\n Sidebar: WithBoundArgs<typeof Sidebar, 'layout'>;\n SidebarToggle: WithBoundArgs<typeof SidebarToggle, 'layout'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * A part registered with the layout. It is written after render: the parts\n * that read it may already have rendered in this pass, and writing it\n * synchronously would trip Glimmer's backtracking assertion.\n */\nclass RegisteredPart<T extends object> {\n #owner: object;\n @tracked current?: T;\n\n constructor(owner: object) {\n this.#owner = owner;\n }\n\n register = (part: T): (() => void) => {\n schedule('afterRender', () => {\n if (!isDestroying(this.#owner)) {\n this.current = part;\n }\n });\n return () => {\n schedule('afterRender', () => {\n if (!isDestroying(this.#owner) && this.current === part) {\n this.current = undefined;\n }\n });\n };\n };\n}\n\n/**\n * The application shell. Its root is a grid that the yielded parts place\n * themselves in, so they can be written in any order.\n */\nclass AppLayout extends Component<AppLayoutSignature> {\n #controlled: ControlledAppLayoutState;\n\n constructor(owner: Owner, args: AppLayoutArgs) {\n super(owner, args);\n const own = new AppLayoutState({\n sidebarCollapsed: args.defaultSidebarCollapsed,\n mobileSidebarOpen: args.defaultMobileSidebarOpen,\n asideOpen: args.defaultAsideOpen\n });\n this.#controlled = new ControlledAppLayoutState(own, () => this.args);\n }\n\n willDestroy(): void {\n super.willDestroy();\n stopWatcher(watchers, this);\n stopWatcher(asideWatchers, this);\n }\n\n /**\n * The root's direction, read once it is in the DOM. Until then `isRtl`\n * falls back to the document's. Tracked so drawer placements computed on\n * the first render (an aside drawer mounts closed) pick up an RTL\n * ancestor of the root. Set after render, where changing state is safe.\n */\n @tracked rootRtl?: boolean;\n\n captureRoot = modifier((element: HTMLElement) => {\n schedule('afterRender', () => {\n if (this.isDestroying) {\n return;\n }\n const rtl = getComputedStyle(element).direction === 'rtl';\n if (rtl !== this.rootRtl) {\n this.rootRtl = rtl;\n }\n });\n });\n\n /**\n * Rebuilt only when `@breakpoint` changes; the previous watcher stops.\n */\n @cached\n get breakpointWatcher(): BreakpointWatcher {\n return replaceWatcher(\n watchers,\n this,\n this.breakpoint,\n this.closeDrawerWhenWide\n );\n }\n\n closeDrawerWhenWide = (below: boolean): void => {\n if (!below && this.state.mobileSidebarOpen) {\n this.state.mobileSidebarOpen = false;\n }\n };\n\n get belowBreakpoint(): boolean {\n return this.breakpointWatcher.below;\n }\n\n /** The aside is a drawer below `lg`, whatever `@breakpoint` is. */\n @cached\n get asideWatcher(): BreakpointWatcher {\n return replaceWatcher(asideWatchers, this, 'lg', this.closeAsideWhenNarrow);\n }\n\n /**\n * An aside open beside `Main` closes when the viewport narrows below `lg`,\n * rather than reappearing as a modal drawer the user did not ask for.\n */\n closeAsideWhenNarrow = (below: boolean): void => {\n if (below && this.state.asideOpen) {\n this.state.asideOpen = false;\n }\n };\n\n get belowAsideBreakpoint(): boolean {\n return this.asideWatcher.below;\n }\n\n // The Sidebar, BottomNav and Aside register with the layout; see\n // `RegisteredPart`. The toggles read the Sidebar and Aside, the root the\n // BottomNav for its bottom row.\n sidebarPart = new RegisteredPart<RegisteredSidebar>(this);\n bottomNavPart = new RegisteredPart<object>(this);\n asidePart = new RegisteredPart<object>(this);\n\n registerSidebar = this.sidebarPart.register;\n registerBottomNav = this.bottomNavPart.register;\n registerAside = this.asidePart.register;\n\n get registeredSidebar(): RegisteredSidebar | undefined {\n return this.sidebarPart.current;\n }\n\n get registeredBottomNav(): object | undefined {\n return this.bottomNavPart.current;\n }\n\n get registeredAside(): object | undefined {\n return this.asidePart.current;\n }\n\n get mobileNav(): 'drawer' | 'bottom' {\n return this.args.mobileNav ?? 'drawer';\n }\n\n /** The bottom bar replaces the sidebar: bottom mode, below the breakpoint. */\n get bottomNavMode(): boolean {\n return this.mobileNav === 'bottom' && this.belowBreakpoint;\n }\n\n /**\n * There is no drawer in bottom mode below the breakpoint, so an open flag\n * (seeded, set through `@state`, or left over) is cleared rather than\n * opening a drawer later. Deferred to after render, where changing state\n * is safe.\n */\n closeDrawerInBottomMode = modifier(\n (_element: HTMLElement, [active, open]: [boolean, boolean]) => {\n if (active && open) {\n schedule('afterRender', () => {\n if (!this.isDestroying && this.bottomNavMode) {\n this.state.mobileSidebarOpen = false;\n }\n });\n }\n }\n );\n\n get bottomNavShown(): boolean {\n return this.bottomNavMode && this.registeredBottomNav !== undefined;\n }\n\n get effectiveSidebarCollapsed(): boolean {\n return this.registeredSidebar\n ? this.registeredSidebar.collapsed\n : this.state.sidebarCollapsed;\n }\n\n isRtl = (): boolean => {\n if (this.rootRtl !== undefined) {\n return this.rootRtl;\n }\n const element = globalDocument()?.documentElement;\n return element ? getComputedStyle(element).direction === 'rtl' : false;\n };\n\n get state(): AppLayoutState {\n return this.args.state ?? this.#controlled;\n }\n\n get mainId(): string {\n return `${guidFor(this)}-main`;\n }\n\n get sidebarId(): string {\n return `${guidFor(this)}-sidebar`;\n }\n\n get menuToggleId(): string {\n return `${guidFor(this)}-menu-toggle`;\n }\n\n get drawerId(): string {\n return `${guidFor(this)}-drawer`;\n }\n\n get asideId(): string {\n return `${guidFor(this)}-aside`;\n }\n\n get asideDrawerId(): string {\n return `${guidFor(this)}-aside-drawer`;\n }\n\n get variant(): 'inset' | 'attached' {\n return this.args.variant ?? 'inset';\n }\n\n get navbarPlacement(): 'frame' | 'content' {\n return this.args.navbarPlacement ?? 'frame';\n }\n\n get color(): NonNullable<AppLayoutVariants['color']> {\n return this.args.color ?? 'neutral';\n }\n\n get sidebarSurface(): NonNullable<AppLayoutVariants['sidebarSurface']> {\n return this.args.sidebarSurface ?? 'plain';\n }\n\n get navbarSurface(): NonNullable<AppLayoutVariants['navbarSurface']> {\n return this.args.navbarSurface ?? 'plain';\n }\n\n get frameGradient(): boolean {\n return this.args.frameGradient ?? false;\n }\n\n get cardSurface(): NonNullable<AppLayoutVariants['cardSurface']> {\n // A gradient pairs with a card it shows through; a flat frame keeps it solid.\n return (\n this.args.cardSurface ?? (this.frameGradient ? 'translucent' : 'solid')\n );\n }\n\n get breakpoint(): 'sm' | 'md' | 'lg' {\n return this.args.breakpoint ?? 'md';\n }\n\n get scrollMode(): 'content' | 'page' {\n return this.args.scrollMode ?? 'content';\n }\n\n get sidebarSide(): 'start' | 'end' {\n return this.args.sidebarSide ?? 'start';\n }\n\n get hasCard(): boolean {\n return this.variant === 'inset';\n }\n\n get showSkipLink(): boolean {\n return this.args.skipLink ?? true;\n }\n\n @cached\n get styles() {\n const { appLayout } = useStyles();\n\n return appLayout({\n ...layoutVariants(this.config),\n variant: this.variant,\n cardSurface: this.cardSurface,\n color: this.color\n });\n }\n\n /** What the layout tells its parts, which build their own styles from it. */\n @cached\n get config(): AppLayoutConfig {\n return {\n variant: this.variant,\n navbarPlacement: this.navbarPlacement,\n breakpoint: this.breakpoint,\n scrollMode: this.scrollMode,\n sidebarSide: this.sidebarSide,\n color: this.color,\n sidebarSurface: this.sidebarSurface,\n navbarSurface: this.navbarSurface\n };\n }\n\n /**\n * The root's classes. Kept out of `styles`, which the context shares with\n * the parts: `sidebarColumn` reads the registered `Sidebar`, whose own\n * state comes from that context, so putting it there would be a cycle.\n */\n get rootClass(): string {\n const { appLayout } = useStyles();\n\n return appLayout({\n ...layoutVariants(this.config),\n variant: this.variant,\n color: this.color,\n frameGradient: this.frameGradient,\n sidebarColumn: this.sidebarColumn,\n sidebarSize: this.registeredSidebar?.size,\n bottomNavRow: this.bottomNavShown ? 'shown' : 'none'\n }).base({ class: this.args.classes?.base });\n }\n\n /**\n * What the root publishes as `--app-sidebar-width` (see the `base` slot in\n * the theme): the width of the sidebar column, or none when there is no\n * column: no Sidebar registered, the sidebar is a drawer below the\n * breakpoint, or it is collapsed off-canvas. A published token only: it\n * settles after the first render (`none` until a Sidebar registers), and\n * the sidebar's own width does not read it.\n */\n get sidebarColumn(): 'shown' | 'collapsed' | 'none' {\n const sidebar = this.registeredSidebar;\n if (!sidebar || this.belowBreakpoint) {\n return 'none';\n }\n if (sidebar.collapsed) {\n return sidebar.collapsible === 'offcanvas' ? 'none' : 'collapsed';\n }\n return 'shown';\n }\n\n @cached\n get context(): AppLayoutContext {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const layout = this;\n return {\n state: this.state,\n mainId: this.mainId,\n sidebarId: this.sidebarId,\n menuToggleId: this.menuToggleId,\n drawerId: this.drawerId,\n asideId: this.asideId,\n asideDrawerId: this.asideDrawerId,\n styles: this.styles,\n config: this.config,\n classes: this.args.classes,\n get belowBreakpoint() {\n return layout.belowBreakpoint;\n },\n get belowAsideBreakpoint() {\n return layout.belowAsideBreakpoint;\n },\n get sidebarCollapsed() {\n return layout.effectiveSidebarCollapsed;\n },\n get mobileNav() {\n return layout.mobileNav;\n },\n get bottomNavMode() {\n return layout.bottomNavMode;\n },\n get bottomNavShown() {\n return layout.bottomNavShown;\n },\n get hasSidebar() {\n return layout.registeredSidebar !== undefined;\n },\n get canToggleSidebar() {\n return layout.registeredSidebar !== undefined && !layout.bottomNavMode;\n },\n get hasAside() {\n return layout.registeredAside !== undefined;\n },\n isRtl: this.isRtl,\n registerSidebar: this.registerSidebar,\n registerBottomNav: this.registerBottomNav,\n registerAside: this.registerAside\n };\n }\n\n focusMain = (event: Event): void => {\n const main = document.getElementById(this.mainId);\n if (main) {\n event.preventDefault();\n main.focus();\n }\n };\n\n // Browsers activate a link on Enter with a click, but a synthetic key\n // event does not; handling Enter directly makes both paths the same.\n focusMainOnEnter = (event: KeyboardEvent): void => {\n if (event.key === 'Enter') {\n this.focusMain(event);\n }\n };\n\n <template>\n <div\n data-component=\"app-layout\"\n data-part=\"base\"\n data-variant={{this.variant}}\n data-navbar-placement={{this.navbarPlacement}}\n data-scroll-mode={{this.scrollMode}}\n data-breakpoint={{this.breakpoint}}\n data-sidebar-side={{this.sidebarSide}}\n data-mobile-nav={{this.mobileNav}}\n data-sidebar-collapsed={{boolString this.effectiveSidebarCollapsed}}\n data-mobile-sidebar-open={{boolString this.state.mobileSidebarOpen}}\n data-aside-open={{boolString this.state.asideOpen}}\n class={{this.rootClass}}\n {{this.captureRoot}}\n {{this.closeDrawerInBottomMode\n this.bottomNavMode\n this.state.mobileSidebarOpen\n }}\n ...attributes\n >\n {{#if this.showSkipLink}}\n <a\n href=\"#{{this.mainId}}\"\n data-part=\"skip-link\"\n class={{this.styles.skipLink class=@classes.skipLink}}\n {{on \"click\" this.focusMain}}\n {{on \"keydown\" this.focusMainOnEnter}}\n >\n {{if @skipLinkLabel @skipLinkLabel \"Skip to main content\"}}\n </a>\n {{/if}}\n {{#if this.hasCard}}\n <div\n data-part=\"main-card\"\n aria-hidden=\"true\"\n class={{this.styles.mainCard class=@classes.mainCard}}\n ></div>\n {{/if}}\n {{yield\n (hash\n state=this.state\n Aside=(component Aside layout=this.context)\n AsideToggle=(component AsideToggle layout=this.context)\n BottomNav=(component BottomNav layout=this.context)\n Main=(component Main layout=this.context)\n MenuToggle=(component MenuToggle layout=this.context)\n Navbar=(component Navbar layout=this.context)\n PageHeader=(component PageHeader layout=this.context)\n Sidebar=(component Sidebar layout=this.context)\n SidebarToggle=(component SidebarToggle layout=this.context)\n )\n }}\n </div>\n </template>\n}\n\nfunction boolString(value: boolean): 'true' | 'false' {\n return value ? 'true' : 'false';\n}\n\n/** Tracks whether the viewport is below one breakpoint. */\nclass BreakpointWatcher {\n @tracked below: boolean;\n #stop: () => void;\n\n constructor(breakpoint: Breakpoint, onChange: (below: boolean) => void) {\n this.below = isBelowBreakpoint(breakpoint);\n this.#stop = watchBreakpoint(breakpoint, (below) => {\n onChange(below);\n this.below = below;\n });\n }\n\n stop(): void {\n this.#stop();\n }\n}\n\nconst watchers = new WeakMap<object, BreakpointWatcher>();\nconst asideWatchers = new WeakMap<object, BreakpointWatcher>();\n\n/**\n * Stops `owner`'s current watcher, if any, and starts one for `breakpoint`.\n * Once `owner` is being torn down it returns a watcher that is not listening\n * and not registered, so a late read cannot leak a listener.\n */\nfunction replaceWatcher(\n registry: WeakMap<object, BreakpointWatcher>,\n owner: Component<AppLayoutSignature>,\n breakpoint: Breakpoint,\n onChange: (below: boolean) => void\n): BreakpointWatcher {\n stopWatcher(registry, owner);\n const watcher = new BreakpointWatcher(breakpoint, onChange);\n if (owner.isDestroying) {\n watcher.stop();\n return watcher;\n }\n registry.set(owner, watcher);\n return watcher;\n}\n\nfunction stopWatcher(\n registry: WeakMap<object, BreakpointWatcher>,\n owner: object\n): void {\n registry.get(owner)?.stop();\n registry.delete(owner);\n}\n\nexport { AppLayout, type AppLayoutSignature, type AppLayoutArgs };\nexport default AppLayout;\n"],"names":["RegisteredPart","g","prototype","tracked","i","constructor","owner","register","part","schedule","isDestroying","current","undefined","AppLayout","Component","args","own","AppLayoutState","sidebarCollapsed","defaultSidebarCollapsed","mobileSidebarOpen","defaultMobileSidebarOpen","asideOpen","defaultAsideOpen","ControlledAppLayoutState","willDestroy","stopWatcher","watchers","asideWatchers","captureRoot","modifier","element","rtl","getComputedStyle","direction","rootRtl","breakpointWatcher","replaceWatcher","breakpoint","closeDrawerWhenWide","n","cached","below","state","belowBreakpoint","asideWatcher","closeAsideWhenNarrow","belowAsideBreakpoint","sidebarPart","bottomNavPart","asidePart","registerSidebar","registerBottomNav","registerAside","registeredSidebar","registeredBottomNav","registeredAside","mobileNav","bottomNavMode","closeDrawerInBottomMode","_element","active","open","bottomNavShown","effectiveSidebarCollapsed","collapsed","isRtl","globalDocument","documentElement","mainId","guidFor","sidebarId","menuToggleId","drawerId","asideId","asideDrawerId","variant","navbarPlacement","color","sidebarSurface","navbarSurface","frameGradient","cardSurface","scrollMode","sidebarSide","hasCard","showSkipLink","skipLink","styles","appLayout","useStyles","layoutVariants","config","rootClass","sidebarColumn","sidebarSize","size","bottomNavRow","base","class","classes","sidebar","collapsible","context","layout","hasSidebar","canToggleSidebar","hasAside","focusMain","event","main","document","getElementById","preventDefault","focus","focusMainOnEnter","key","setComponentTemplate","precompileTemplate","strictMode","scope","boolString","on","hash","Aside","AsideToggle","BottomNav","Main","MenuToggle","Navbar","PageHeader","Sidebar","SidebarToggle","value","BreakpointWatcher","onChange","isBelowBreakpoint","watchBreakpoint","stop","WeakMap","registry","watcher","set","get","delete"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyOA;;;;;AAKA,MAAMA,cAAA,CAA+B;AACnC,EAAA,MAAM;AAAS,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACdC,OAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;EAEDC,WAAAA,CAAYC,KAAa,EAAE;AACzB,IAAA,IAAI,CAAC,MAAM,GAAGA,KAAA;AAChB,EAAA;EAEAC,QAAA,GAAYC,IAAM,IAAe;IAC/BC,QAAA,CAAS,aAAA,EAAe,MAAA;MACtB,IAAI,CAACC,YAAA,CAAa,IAAI,CAAC,MAAM,CAAA,EAAG;QAC9B,IAAI,CAACC,OAAO,GAAGH,IAAA;AACjB,MAAA;AACF,IAAA,CAAA,CAAA;AACA,IAAA,OAAO,MAAA;MACLC,QAAA,CAAS,aAAA,EAAe,MAAA;AACtB,QAAA,IAAI,CAACC,YAAA,CAAa,IAAI,CAAC,MAAM,CAAA,IAAK,IAAI,CAACC,OAAO,KAAKH,IAAA,EAAM;UACvD,IAAI,CAACG,OAAO,GAAGC,SAAA;AACjB,QAAA;AACF,MAAA,CAAA,CAAA;IACF,CAAA;EACF,CAAA;AACF;AAEA;;;;AAIA,MAAMC,kBAAkBC,SAAA,CAAU;AAChC,EAAA,WAAW;AAEXT,EAAAA,WAAAA,CAAYC,KAAY,EAAES,IAAmB,EAAE;AAC7C,IAAA,KAAK,CAACT,KAAA,EAAOS,IAA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