frontile 0.18.0-beta.1 → 0.18.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/-private/deprecated-args.d.ts +18 -0
- package/declarations/-private/notification.d.ts +4 -4
- package/declarations/-private/types.d.ts +10 -8
- package/declarations/components/buttons/button-group.d.ts +3 -1
- package/declarations/components/buttons/button.d.ts +12 -3
- package/declarations/components/buttons/chip.d.ts +15 -8
- package/declarations/components/buttons/close-button.d.ts +5 -2
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts +9 -9
- package/declarations/components/buttons/toggle-button.d.ts +9 -1
- package/declarations/components/collections/calendar/calendar.d.ts +49 -49
- package/declarations/components/collections/calendar/utils.d.ts +1 -0
- package/declarations/components/collections/dropdown/dropdown.d.ts +13 -2
- package/declarations/components/collections/dropdown/menu-context.d.ts +3 -3
- package/declarations/components/collections/listbox/group.d.ts +7 -2
- package/declarations/components/collections/listbox/item.d.ts +27 -6
- package/declarations/components/collections/listbox/listbox.d.ts +31 -4
- package/declarations/components/collections/simple-table/body.d.ts +68 -68
- package/declarations/components/collections/simple-table/cell.d.ts +68 -68
- package/declarations/components/collections/simple-table/column.d.ts +68 -68
- package/declarations/components/collections/simple-table/footer.d.ts +68 -68
- package/declarations/components/collections/simple-table/header.d.ts +68 -68
- package/declarations/components/collections/simple-table/index.d.ts +68 -68
- package/declarations/components/collections/simple-table/row.d.ts +68 -68
- package/declarations/components/collections/table/column-visibility.d.ts +68 -68
- package/declarations/components/collections/table/sort-button.d.ts +68 -68
- package/declarations/components/collections/table/table.d.ts +68 -68
- package/declarations/components/disclosure/accordion/accordion.d.ts +23 -23
- package/declarations/components/forms/autocomplete.d.ts +24 -12
- package/declarations/components/forms/date-picker/date-picker.d.ts +268 -0
- package/declarations/components/forms/date-picker/end-content.d.ts +29 -0
- package/declarations/components/forms/date-picker/trigger.d.ts +40 -0
- package/declarations/components/forms/date-picker/types.d.ts +149 -0
- package/declarations/components/forms/date-picker/value.d.ts +43 -0
- package/declarations/components/forms/date-picker.d.ts +3 -0
- package/declarations/components/forms/field.d.ts +5 -0
- package/declarations/components/forms/form-control.d.ts +1 -1
- package/declarations/components/forms/form-feedback.d.ts +17 -2
- package/declarations/components/forms/icons.d.ts +4 -1
- package/declarations/components/forms/index.d.ts +2 -0
- package/declarations/components/forms/input.d.ts +10 -10
- package/declarations/components/forms/native-select.d.ts +7 -7
- package/declarations/components/forms/select/select.d.ts +30 -17
- package/declarations/components/forms/select/types.d.ts +42 -12
- package/declarations/components/forms/switch.d.ts +22 -18
- package/declarations/components/forms/textarea.d.ts +6 -6
- package/declarations/components/navigation/pagination/pagination.d.ts +18 -18
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts +12 -12
- package/declarations/components/navigation/tabs/tabs.d.ts +12 -12
- package/declarations/components/notifications/index.d.ts +2 -2
- package/declarations/components/notifications/notification-card.d.ts +5 -5
- package/declarations/components/notifications/notifications-container.d.ts +2 -2
- package/declarations/components/overlays/drawer.d.ts +32 -32
- package/declarations/components/overlays/popover.d.ts +1 -1
- package/declarations/components/overlays/tooltip.d.ts +2 -2
- package/declarations/components/status/alert.d.ts +10 -10
- package/declarations/components/status/progress-bar.d.ts +5 -1
- package/declarations/components/utilities/kbd.d.ts +4 -4
- package/declarations/components/utilities/spinner.d.ts +14 -7
- package/declarations/index.d.ts +1 -1
- package/declarations/template-registry.d.ts +2 -1
- package/dist/components/buttons/button-group.js +26 -1
- package/dist/components/buttons/button-group.js.map +1 -1
- package/dist/components/buttons/button.js +21 -2
- package/dist/components/buttons/button.js.map +1 -1
- package/dist/components/buttons/chip.js +19 -2
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/close-button.js +17 -1
- package/dist/components/buttons/close-button.js.map +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/buttons/toggle-button.js +36 -2
- package/dist/components/buttons/toggle-button.js.map +1 -1
- package/dist/components/collections/calendar/calendar.js +36 -3
- package/dist/components/collections/calendar/calendar.js.map +1 -1
- package/dist/components/collections/calendar/utils.js +1 -1
- package/dist/components/collections/calendar/utils.js.map +1 -1
- package/dist/components/collections/command/footer.js +1 -1
- package/dist/components/collections/command/footer.js.map +1 -1
- package/dist/components/collections/command/list.js +1 -1
- package/dist/components/collections/command/list.js.map +1 -1
- package/dist/components/collections/dropdown/dropdown.js +45 -7
- package/dist/components/collections/dropdown/dropdown.js.map +1 -1
- package/dist/components/collections/dropdown/menu-context.js.map +1 -1
- package/dist/components/collections/listbox/group.js +1 -1
- package/dist/components/collections/listbox/group.js.map +1 -1
- package/dist/components/collections/listbox/item.js +47 -8
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js +53 -2
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +1 -1
- package/dist/components/collections/table/column-visibility.js.map +1 -1
- package/dist/components/disclosure/accordion/accordion.js.map +1 -1
- package/dist/components/forms/autocomplete.js +47 -2
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/date-picker/date-picker.js +301 -0
- package/dist/components/forms/date-picker/date-picker.js.map +1 -0
- package/dist/components/forms/date-picker/end-content.js +21 -0
- package/dist/components/forms/date-picker/end-content.js.map +1 -0
- package/dist/components/forms/date-picker/trigger.js +14 -0
- package/dist/components/forms/date-picker/trigger.js.map +1 -0
- package/dist/components/forms/date-picker/types.js +2 -0
- package/dist/components/forms/date-picker/types.js.map +1 -0
- package/dist/components/forms/date-picker/value.js +97 -0
- package/dist/components/forms/date-picker/value.js.map +1 -0
- package/dist/components/forms/date-picker.js +2 -0
- package/dist/components/forms/date-picker.js.map +1 -0
- package/dist/components/forms/field.js +3 -1
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form-control.js +1 -1
- package/dist/components/forms/form-control.js.map +1 -1
- package/dist/components/forms/form-feedback.js +25 -2
- package/dist/components/forms/form-feedback.js.map +1 -1
- package/dist/components/forms/icons.js +4 -1
- package/dist/components/forms/icons.js.map +1 -1
- package/dist/components/forms/index.js +2 -0
- package/dist/components/forms/index.js.map +1 -1
- package/dist/components/forms/input.js +1 -1
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/select/end-content.js +1 -1
- package/dist/components/forms/select/end-content.js.map +1 -1
- package/dist/components/forms/select/select.js +61 -7
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/selected-items.js +1 -1
- package/dist/components/forms/select/selected-items.js.map +1 -1
- package/dist/components/forms/switch.js +9 -1
- package/dist/components/forms/switch.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +1 -1
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
- package/dist/components/navigation/tabs/tabs.js +1 -1
- package/dist/components/navigation/tabs/tabs.js.map +1 -1
- package/dist/components/notifications/index.js +2 -2
- package/dist/components/notifications/notification-card.js +1 -1
- package/dist/components/notifications/notifications-container.js +1 -1
- package/dist/components/notifications/notifications-container.js.map +1 -1
- package/dist/components/overlays/drawer.js +3 -3
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/overlays/tooltip.js +1 -1
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/alert.js +19 -15
- package/dist/components/status/alert.js.map +1 -1
- package/dist/components/status/progress-bar.js +9 -1
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/kbd.js +2 -2
- package/dist/components/utilities/kbd.js.map +1 -1
- package/dist/components/utilities/spinner.js +26 -7
- package/dist/components/utilities/spinner.js.map +1 -1
- package/dist/deprecated-args-BIUjLA8y.js +32 -0
- package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
- package/dist/forms.js +2 -0
- package/dist/forms.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{manager-CDIZzrQ9.js → manager-B-PnYqDs.js} +28 -22
- package/dist/manager-B-PnYqDs.js.map +1 -0
- package/dist/{notification-card-BHTra4Zh.js → notification-card-CYmWQ35W.js} +25 -22
- package/dist/notification-card-CYmWQ35W.js.map +1 -0
- package/dist/notifications.js +2 -2
- package/dist/services/notifications.js +1 -1
- package/package.json +3 -3
- package/dist/manager-CDIZzrQ9.js.map +0 -1
- package/dist/notification-card-BHTra4Zh.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sources":["../../../../src/components/navigation/tabs/tabs.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { guidFor } from '@ember/object/internals';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport {\n selectionIndicator,\n type SelectionIndicator\n} from '../../../utils/selection-indicator';\nimport { rovingFocus, type RovingFocus } from '../../../utils/roving-focus';\nimport TabsTab from './tab';\nimport TabsPanel from './panel';\nimport type { TabsSlots, TabsVariants } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface TabsArgs<T> {\n /**\n * The visual style of the tab list.\n *\n * @defaultValue 'solid'\n */\n variant?: TabsVariants['variant'];\n\n /**\n * The colour intent applied to the indicator.\n *\n * @defaultValue 'default'\n */\n intent?: TabsVariants['intent'];\n\n /**\n * The size of the tabs, driving padding and text size.\n *\n * @defaultValue 'md'\n */\n size?: TabsVariants['size'];\n\n /**\n * Lays the tabs out in a row or a column, and switches the arrow keys that\n * move between them to match.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: TabsVariants['orientation'];\n\n /**\n * Stretches the tab list to its container and gives every tab equal width.\n *\n * @defaultValue false\n */\n isFullWidth?: boolean;\n\n /**\n * Disables every tab.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * The currently selected value. Compared against each tab's `@value` with\n * `===`, so object values must be referentially stable.\n *\n * *Passing* this argument at all puts the component in controlled mode --\n * passing it as `undefined` included. Omit it entirely to let `Tabs` track\n * the selection itself, seeded by `@defaultValue`.\n */\n value?: T;\n\n /** Sets the initially selected value when uncontrolled. */\n defaultValue?: T;\n\n /** Called with the newly selected value when a tab is chosen. */\n onChange?: (value: T) => void;\n\n /**\n * `automatic` moves selection with focus, which the APG recommends when\n * panel content is already loaded. `manual` moves focus only and waits for\n * Enter or Space.\n *\n * @defaultValue 'automatic'\n */\n activationMode?: 'automatic' | 'manual';\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<TabsSlots>;\n}\n\ninterface TabsContext<T> {\n indicator: SelectionIndicator;\n orientation: 'horizontal' | 'vertical';\n listClass: string;\n indicatorClass: string;\n tabClass: string;\n panelClass: string;\n isGroupDisabled: boolean;\n isSelected: (value: T) => boolean;\n select: (value: T) => void;\n registerValue: (element: HTMLElement, value: T) => void;\n unregisterValue: (element: HTMLElement) => void;\n idFor: (value: T, kind: 'tab' | 'panel') => string;\n roving: RovingFocus;\n}\n\ninterface TabsListArgs<T> {\n /** Accessible name for the tab list. */\n label?: string;\n\n /**\n * Supplied by Tabs. Not part of the public API.\n *\n * @internal\n */\n context: TabsContext<T>;\n}\n\ninterface TabsListSignature<T> {\n Args: TabsListArgs<T>;\n Blocks: { default: [] };\n Element: HTMLDivElement;\n}\n\n// A class rather than a template-only component: `TOC` values are not\n// themselves generic, so `WithBoundArgs<typeof TabsList<T>, 'context'>` below\n// would not type-check against a `TOC`-typed constant. A plain class with no\n// state, mirroring how `Tab` is generic, gives Glint something it can\n// actually parameterize.\nclass TabsList<T> extends Component<TabsListSignature<T>> {\n <template>\n <div\n data-part=\"list\"\n role=\"tablist\"\n aria-orientation={{@context.orientation}}\n aria-label={{@label}}\n class=\"group/tabs {{@context.listClass}}\"\n {{@context.indicator.setupContainer}}\n ...attributes\n >\n <span\n data-part=\"indicator\"\n aria-hidden=\"true\"\n class={{@context.indicatorClass}}\n ></span>\n {{yield}}\n </div>\n </template>\n}\n\ninterface TabsSignature<T> {\n Args: TabsArgs<T>;\n Blocks: {\n default: [\n {\n List: WithBoundArgs<typeof TabsList<T>, 'context'>;\n Tab: WithBoundArgs<typeof TabsTab<T>, 'context'>;\n Panel: WithBoundArgs<typeof TabsPanel<T>, 'context'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nclass Tabs<T> extends Component<TabsSignature<T>> {\n indicator = selectionIndicator();\n\n roving = rovingFocus(() => ({\n orientation: this.orientation,\n activationMode: this.args.activationMode ?? 'automatic',\n onActivate: this.activateElement\n }));\n\n // Uncontrolled mode's own selection, seeded from `@defaultValue`. Written on\n // every `select` regardless of mode -- the getter ignores it when controlled\n // -- so both modes share one code path, exactly as `SegmentedControl` does.\n @tracked _value: T | undefined;\n\n #values = new Map<HTMLElement, T>();\n\n // Values are given an index on first sight and ids are derived from it,\n // rather than from the value's `String()` form: two distinct values that\n // stringify alike would otherwise collide into one id and silently break the\n // `aria-controls` round trip. Untracked, so populating it during render\n // raises no backtracking assertion.\n #indices = new Map<T, number>();\n\n constructor(owner: Owner, args: TabsSignature<T>['Args']) {\n super(owner, args);\n this._value = this.args.defaultValue;\n }\n\n @cached\n get styles() {\n const { tabs } = useStyles();\n\n return tabs({\n variant: this.args.variant,\n intent: this.args.intent,\n size: this.args.size,\n orientation: this.args.orientation,\n isFullWidth: this.args.isFullWidth,\n isDisabled: this.args.isDisabled\n });\n }\n\n get orientation(): 'horizontal' | 'vertical' {\n return this.args.orientation ?? 'horizontal';\n }\n\n /**\n * Whether `@value` was *passed* decides the mode -- not whether it holds a\n * value. `T` is generic, so `undefined` is a legitimate selection meaning\n * \"nothing is selected\". Glimmer's named-args object carries a key for every\n * argument written in the invoking template, so `in` distinguishes\n * `@value={{undefined}}` from an omitted `@value`.\n */\n get isControlled(): boolean {\n return 'value' in this.args;\n }\n\n get selectedValue(): T | undefined {\n return this.isControlled ? this.args.value : this._value;\n }\n\n isSelected = (value: T): boolean => this.selectedValue === value;\n\n select = (value: T): void => {\n if (this.args.isDisabled) {\n return;\n }\n this._value = value;\n this.args.onChange?.(value);\n };\n\n registerValue = (element: HTMLElement, value: T): void => {\n this.#values.set(element, value);\n };\n\n unregisterValue = (element: HTMLElement): void => {\n this.#values.delete(element);\n };\n\n activateElement = (element: HTMLElement): void => {\n // `has`, not a `!== undefined` check: `T` may itself be `undefined`, so\n // only membership distinguishes \"not registered\" from \"registered against\n // an undefined value\".\n if (!this.#values.has(element)) {\n return;\n }\n this.select(this.#values.get(element) as T);\n };\n\n idFor = (value: T, kind: 'tab' | 'panel'): string => {\n let index = this.#indices.get(value);\n if (index === undefined) {\n index = this.#indices.size;\n this.#indices.set(value, index);\n }\n return `${guidFor(this)}-${kind}-${index}`;\n };\n\n @cached\n get context(): TabsContext<T> {\n return {\n indicator: this.indicator,\n orientation: this.orientation,\n listClass: this.styles.list({ class: this.args.classes?.list }),\n indicatorClass: this.styles.indicator({\n class: this.args.classes?.indicator\n }),\n tabClass: this.styles.tab({ class: this.args.classes?.tab }),\n panelClass: this.styles.panel({ class: this.args.classes?.panel }),\n isGroupDisabled: this.args.isDisabled ?? false,\n isSelected: this.isSelected,\n select: this.select,\n registerValue: this.registerValue,\n unregisterValue: this.unregisterValue,\n idFor: this.idFor,\n roving: this.roving\n };\n }\n\n <template>\n <div\n data-component=\"tabs\"\n data-part=\"base\"\n class={{this.styles.base class=@classes.base}}\n ...attributes\n >\n {{#let\n (component TabsList context=this.context)\n (component TabsTab context=this.context)\n (component TabsPanel context=this.context)\n as |TabList TabItem TabPanel|\n }}\n {{! @glint-ignore: WithBoundArgs vs. a generic component }}\n {{yield (hash List=TabList Tab=TabItem Panel=TabPanel)}}\n {{/let}}\n </div>\n </template>\n}\n\nexport { Tabs, TabsList, type TabsSignature, type TabsArgs, type TabsContext };\nexport default Tabs;\n"],"names":["TabsList","Component","setComponentTemplate","precompileTemplate","strictMode","Tabs","indicator","selectionIndicator","roving","rovingFocus","orientation","activationMode","args","onActivate","activateElement","g","prototype","tracked","i","Map","constructor","owner","_value","defaultValue","styles","tabs","useStyles","variant","intent","size","isFullWidth","isDisabled","n","cached","isControlled","selectedValue","value","isSelected","select","onChange","registerValue","element","set","unregisterValue","delete","has","get","idFor","kind","index","undefined","guidFor","context","listClass","list","class","classes","indicatorClass","tabClass","tab","panelClass","panel","isGroupDisabled","scope","TabsTab","TabsPanel","hash"],"mappings":";;;;;;;;;;;;;AA2HA;AACA;AACA;AACA;AACA;AACA,MAAMA,QAAA,SAAoBC,SAAA,CAA4B;AACpD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,gUAAA,EAiBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAgBA,MAAMC,IAAA,SAAgBJ,SAAA,CAAwB;EAC5CK,SAAA,GAAYC,kBAAA,EAAA;EAEZC,MAAA,GAASC,WAAA,CAAY,OAAO;IAC1BC,WAAA,EAAa,IAAI,CAACA,WAAW;AAC7BC,IAAAA,cAAA,EAAgB,IAAI,CAACC,IAAI,CAACD,cAAc,IAAI,WAAA;IAC5CE,UAAA,EAAY,IAAI,CAACC;AACnB,GAAC,CAAA,CAAA;AAED;AACA;AACA;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CACCC,OAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AAED,EAAA,OAAO,GAAG,IAAIC,GAAA,EAAiB;AAE/B;AACA;AACA;AACA;AACA;AACA,EAAA,QAAQ,GAAG,IAAIA,GAAA,EAAa;AAE5BC,EAAAA,WAAAA,CAAYC,KAAY,EAAET,IAA8B,EAAE;AACxD,IAAA,KAAK,CAACS,KAAA,EAAOT,IAAA,CAAA;AACb,IAAA,IAAI,CAACU,MAAM,GAAG,IAAI,CAAC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AAAA,cAAA,EAAgB,IAAI,CAACjC,MAAM,CAAClB,SAAS,CAAC;AACpCiD,QAAAA,KAAA,EAAO,IAAI,CAAC3C,IAAI,CAAC4C,OAAO,EAAElD;AAC5B,OAAA,CAAA;AACAoD,MAAAA,QAAA,EAAU,IAAI,CAAClC,MAAM,CAACmC,GAAG,CAAC;AAAEJ,QAAAA,KAAA,EAAO,IAAI,CAAC3C,IAAI,CAAC4C,OAAO,EAAEG;AAAI,OAAA,CAAA;AAC1DC,MAAAA,UAAA,EAAY,IAAI,CAACpC,MAAM,CAACqC,KAAK,CAAC;AAAEN,QAAAA,KAAA,EAAO,IAAI,CAAC3C,IAAI,CAAC4C,OAAO,EAAEK;AAAM,OAAA,CAAA;AAChEC,MAAAA,eAAA,EAAiB,IAAI,CAAClD,IAAI,CAACmB,UAAU,IAAI,KAAA;MACzCM,UAAA,EAAY,IAAI,CAACA,UAAU;MAC3BC,MAAA,EAAQ,IAAI,CAACA,MAAM;MACnBE,aAAA,EAAe,IAAI,CAACA,aAAa;MACjCG,eAAA,EAAiB,IAAI,CAACA,eAAe;MACrCI,KAAA,EAAO,IAAI,CAACA,KAAK;MACjBvC,MAAA,EAAQ,IAAI,CAACA;KACf;AACF,EAAA;AAAA,EAAA;IAAAwB,gBAAA,CAAA,IAAA,CAAAhB,SAAA,EAAA,SAAA,EAAA,CAnBCiB,MAAA,CAAA,CAAA;AAAA;AAqBD,EAAA;IAAA/B,oBAAA,CAAAC,kBAAA,CAAA,8aAAA,EAiBA;MAAAC,UAAA,EAAA,IAAA;AAAA2D,MAAAA,KAAA,EAAAA,OAAA;QAAA/D,QAAA;QAAAgE,OAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"tabs.js","sources":["../../../../src/components/navigation/tabs/tabs.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { guidFor } from '@ember/object/internals';\nimport { useStyles, type SlotsToClasses } from '@frontile/theme';\nimport {\n selectionIndicator,\n type SelectionIndicator\n} from '../../../utils/selection-indicator';\nimport { rovingFocus, type RovingFocus } from '../../../utils/roving-focus';\nimport TabsTab from './tab';\nimport TabsPanel from './panel';\nimport type { TabsSlots, TabsVariants } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface TabsArgs<T> {\n /**\n * The visual style of the tab list.\n *\n * @defaultValue 'solid'\n */\n variant?: TabsVariants['variant'];\n\n /**\n * The colour intent applied to the indicator.\n *\n * @defaultValue 'neutral'\n */\n color?: TabsVariants['color'];\n\n /**\n * The size of the tabs, driving padding and text size.\n *\n * @defaultValue 'md'\n */\n size?: TabsVariants['size'];\n\n /**\n * Lays the tabs out in a row or a column, and switches the arrow keys that\n * move between them to match.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: TabsVariants['orientation'];\n\n /**\n * Stretches the tab list to its container and gives every tab equal width.\n *\n * @defaultValue false\n */\n isFullWidth?: boolean;\n\n /**\n * Disables every tab.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n\n /**\n * The currently selected value. Compared against each tab's `@value` with\n * `===`, so object values must be referentially stable.\n *\n * *Passing* this argument at all puts the component in controlled mode --\n * passing it as `undefined` included. Omit it entirely to let `Tabs` track\n * the selection itself, seeded by `@defaultValue`.\n */\n value?: T;\n\n /** Sets the initially selected value when uncontrolled. */\n defaultValue?: T;\n\n /** Called with the newly selected value when a tab is chosen. */\n onChange?: (value: T) => void;\n\n /**\n * `automatic` moves selection with focus, which the APG recommends when\n * panel content is already loaded. `manual` moves focus only and waits for\n * Enter or Space.\n *\n * @defaultValue 'automatic'\n */\n activationMode?: 'automatic' | 'manual';\n\n /** Class names for each slot of the component, merged with the theme's. */\n classes?: SlotsToClasses<TabsSlots>;\n}\n\ninterface TabsContext<T> {\n indicator: SelectionIndicator;\n orientation: 'horizontal' | 'vertical';\n listClass: string;\n indicatorClass: string;\n tabClass: string;\n panelClass: string;\n isGroupDisabled: boolean;\n isSelected: (value: T) => boolean;\n select: (value: T) => void;\n registerValue: (element: HTMLElement, value: T) => void;\n unregisterValue: (element: HTMLElement) => void;\n idFor: (value: T, kind: 'tab' | 'panel') => string;\n roving: RovingFocus;\n}\n\ninterface TabsListArgs<T> {\n /** Accessible name for the tab list. */\n label?: string;\n\n /**\n * Supplied by Tabs. Not part of the public API.\n *\n * @internal\n */\n context: TabsContext<T>;\n}\n\ninterface TabsListSignature<T> {\n Args: TabsListArgs<T>;\n Blocks: { default: [] };\n Element: HTMLDivElement;\n}\n\n// A class rather than a template-only component: `TOC` values are not\n// themselves generic, so `WithBoundArgs<typeof TabsList<T>, 'context'>` below\n// would not type-check against a `TOC`-typed constant. A plain class with no\n// state, mirroring how `Tab` is generic, gives Glint something it can\n// actually parameterize.\nclass TabsList<T> extends Component<TabsListSignature<T>> {\n <template>\n <div\n data-part=\"list\"\n role=\"tablist\"\n aria-orientation={{@context.orientation}}\n aria-label={{@label}}\n class=\"group/tabs {{@context.listClass}}\"\n {{@context.indicator.setupContainer}}\n ...attributes\n >\n <span\n data-part=\"indicator\"\n aria-hidden=\"true\"\n class={{@context.indicatorClass}}\n ></span>\n {{yield}}\n </div>\n </template>\n}\n\ninterface TabsSignature<T> {\n Args: TabsArgs<T>;\n Blocks: {\n default: [\n {\n List: WithBoundArgs<typeof TabsList<T>, 'context'>;\n Tab: WithBoundArgs<typeof TabsTab<T>, 'context'>;\n Panel: WithBoundArgs<typeof TabsPanel<T>, 'context'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nclass Tabs<T> extends Component<TabsSignature<T>> {\n indicator = selectionIndicator();\n\n roving = rovingFocus(() => ({\n orientation: this.orientation,\n activationMode: this.args.activationMode ?? 'automatic',\n onActivate: this.activateElement\n }));\n\n // Uncontrolled mode's own selection, seeded from `@defaultValue`. Written on\n // every `select` regardless of mode -- the getter ignores it when controlled\n // -- so both modes share one code path, exactly as `SegmentedControl` does.\n @tracked _value: T | undefined;\n\n #values = new Map<HTMLElement, T>();\n\n // Values are given an index on first sight and ids are derived from it,\n // rather than from the value's `String()` form: two distinct values that\n // stringify alike would otherwise collide into one id and silently break the\n // `aria-controls` round trip. Untracked, so populating it during render\n // raises no backtracking assertion.\n #indices = new Map<T, number>();\n\n constructor(owner: Owner, args: TabsSignature<T>['Args']) {\n super(owner, args);\n this._value = this.args.defaultValue;\n }\n\n @cached\n get styles() {\n const { tabs } = useStyles();\n\n return tabs({\n variant: this.args.variant,\n color: this.args.color,\n size: this.args.size,\n orientation: this.args.orientation,\n isFullWidth: this.args.isFullWidth,\n isDisabled: this.args.isDisabled\n });\n }\n\n get orientation(): 'horizontal' | 'vertical' {\n return this.args.orientation ?? 'horizontal';\n }\n\n /**\n * Whether `@value` was *passed* decides the mode -- not whether it holds a\n * value. `T` is generic, so `undefined` is a legitimate selection meaning\n * \"nothing is selected\". Glimmer's named-args object carries a key for every\n * argument written in the invoking template, so `in` distinguishes\n * `@value={{undefined}}` from an omitted `@value`.\n */\n get isControlled(): boolean {\n return 'value' in this.args;\n }\n\n get selectedValue(): T | undefined {\n return this.isControlled ? this.args.value : this._value;\n }\n\n isSelected = (value: T): boolean => this.selectedValue === value;\n\n select = (value: T): void => {\n if (this.args.isDisabled) {\n return;\n }\n this._value = value;\n this.args.onChange?.(value);\n };\n\n registerValue = (element: HTMLElement, value: T): void => {\n this.#values.set(element, value);\n };\n\n unregisterValue = (element: HTMLElement): void => {\n this.#values.delete(element);\n };\n\n activateElement = (element: HTMLElement): void => {\n // `has`, not a `!== undefined` check: `T` may itself be `undefined`, so\n // only membership distinguishes \"not registered\" from \"registered against\n // an undefined value\".\n if (!this.#values.has(element)) {\n return;\n }\n this.select(this.#values.get(element) as T);\n };\n\n idFor = (value: T, kind: 'tab' | 'panel'): string => {\n let index = this.#indices.get(value);\n if (index === undefined) {\n index = this.#indices.size;\n this.#indices.set(value, index);\n }\n return `${guidFor(this)}-${kind}-${index}`;\n };\n\n @cached\n get context(): TabsContext<T> {\n return {\n indicator: this.indicator,\n orientation: this.orientation,\n listClass: this.styles.list({ class: this.args.classes?.list }),\n indicatorClass: this.styles.indicator({\n class: this.args.classes?.indicator\n }),\n tabClass: this.styles.tab({ class: this.args.classes?.tab }),\n panelClass: this.styles.panel({ class: this.args.classes?.panel }),\n isGroupDisabled: this.args.isDisabled ?? false,\n isSelected: this.isSelected,\n select: this.select,\n registerValue: this.registerValue,\n unregisterValue: this.unregisterValue,\n idFor: this.idFor,\n roving: this.roving\n };\n }\n\n <template>\n <div\n data-component=\"tabs\"\n data-part=\"base\"\n class={{this.styles.base class=@classes.base}}\n ...attributes\n >\n {{#let\n (component TabsList context=this.context)\n (component TabsTab context=this.context)\n (component TabsPanel context=this.context)\n as |TabList TabItem TabPanel|\n }}\n {{! @glint-ignore: WithBoundArgs vs. a generic component }}\n {{yield (hash List=TabList Tab=TabItem Panel=TabPanel)}}\n {{/let}}\n </div>\n </template>\n}\n\nexport { Tabs, TabsList, type TabsSignature, type TabsArgs, type TabsContext };\nexport default Tabs;\n"],"names":["TabsList","Component","setComponentTemplate","precompileTemplate","strictMode","Tabs","indicator","selectionIndicator","roving","rovingFocus","orientation","activationMode","args","onActivate","activateElement","g","prototype","tracked","i","Map","constructor","owner","_value","defaultValue","styles","tabs","useStyles","variant","color","size","isFullWidth","isDisabled","n","cached","isControlled","selectedValue","value","isSelected","select","onChange","registerValue","element","set","unregisterValue","delete","has","get","idFor","kind","index","undefined","guidFor","context","listClass","list","class","classes","indicatorClass","tabClass","tab","panelClass","panel","isGroupDisabled","scope","TabsTab","TabsPanel","hash"],"mappings":";;;;;;;;;;;;;AA2HA;AACA;AACA;AACA;AACA;AACA,MAAMA,QAAA,SAAoBC,SAAA,CAA4B;AACpD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,gUAAA,EAiBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EA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IAAI,CAAClD,IAAI,CAACmB,UAAU,IAAI,KAAA;MACzCM,UAAA,EAAY,IAAI,CAACA,UAAU;MAC3BC,MAAA,EAAQ,IAAI,CAACA,MAAM;MACnBE,aAAA,EAAe,IAAI,CAACA,aAAa;MACjCG,eAAA,EAAiB,IAAI,CAACA,eAAe;MACrCI,KAAA,EAAO,IAAI,CAACA,KAAK;MACjBvC,MAAA,EAAQ,IAAI,CAACA;KACf;AACF,EAAA;AAAA,EAAA;IAAAwB,gBAAA,CAAA,IAAA,CAAAhB,SAAA,EAAA,SAAA,EAAA,CAnBCiB,MAAA,CAAA,CAAA;AAAA;AAqBD,EAAA;IAAA/B,oBAAA,CAAAC,kBAAA,CAAA,8aAAA,EAiBA;MAAAC,UAAA,EAAA,IAAA;AAAA2D,MAAAA,KAAA,EAAAA,OAAA;QAAA/D,QAAA;QAAAgE,OAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { N as Notification, T as Timer } from '../../manager-
|
|
1
|
+
export { N as Notification, T as Timer } from '../../manager-B-PnYqDs.js';
|
|
2
2
|
import '@ember/service';
|
|
3
|
-
export { N as NotificationCard, a as NotificationStack } from '../../notification-card-
|
|
3
|
+
export { N as NotificationCard, a as NotificationStack } from '../../notification-card-CYmWQ35W.js';
|
|
4
4
|
export { NotificationsContainer } from './notifications-container.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -9,7 +9,7 @@ import '../buttons/button.js';
|
|
|
9
9
|
import '../utilities/spinner.js';
|
|
10
10
|
import '../../intent-icons-DpEViO8C.js';
|
|
11
11
|
import '@frontile/theme';
|
|
12
|
-
export { N as NotificationCard, N as default } from '../../notification-card-
|
|
12
|
+
export { N as NotificationCard, N as default } from '../../notification-card-CYmWQ35W.js';
|
|
13
13
|
import '@ember/template-compilation';
|
|
14
14
|
import '@ember/component';
|
|
15
15
|
import '../../runtime--fcdnjmJ-BOdRhmsS.js';
|
|
@@ -7,7 +7,7 @@ import { on } from '@ember/modifier';
|
|
|
7
7
|
import { modifier } from 'ember-modifier';
|
|
8
8
|
import { htmlSafe } from '@ember/template';
|
|
9
9
|
import { registerDestructor } from '@ember/destroyable';
|
|
10
|
-
import { a as NotificationStack, N as NotificationCard } from '../../notification-card-
|
|
10
|
+
import { a as NotificationStack, N as NotificationCard } from '../../notification-card-CYmWQ35W.js';
|
|
11
11
|
import { useStyles } from '@frontile/theme';
|
|
12
12
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
13
|
import { setComponentTemplate } from '@ember/component';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-container.js","sources":["../../../src/components/notifications/notifications-container.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport { service } from '@ember/service';\nimport { next } from '@ember/runloop';\nimport { fn } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { htmlSafe } from '@ember/template';\nimport { registerDestructor } from '@ember/destroyable';\nimport NotificationCard from './notification-card';\nimport { NotificationStack } from '../../-private/notification-stack';\nimport type NotificationsService from '../../services/notifications';\nimport type Notification from '../../-private/notification';\nimport { type containerPlacement } from '../../-private/types';\nimport { useStyles } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport type { SafeString } from '@ember/template';\n\n/**\n * Defers `fn` to the next runloop turn, skipping it if the component has\n * started (or finished) being destroyed by then. Shared by `measure` and\n * `syncTimers`, which each write a tracked property from a place Glimmer\n * still considers \"rendering\" (a modifier's install, or a callback invoked\n * synchronously during render) — writing immediately there trips the\n * \"attempted to update a value after using it in this computation\"\n * assertion, so the write has to land one runloop turn later instead.\n */\nfunction deferWhileAlive(\n component: { isDestroying: boolean; isDestroyed: boolean },\n fn: () => void\n): void {\n next(() => {\n if (component.isDestroying || component.isDestroyed) {\n return;\n }\n\n fn();\n });\n}\n\ninterface NotificationsContainerSignature {\n Args: {\n /**\n * The placement of the notifications\n *\n * @defaultValue 'bottom-right'\n */\n placement?: containerPlacement;\n\n /**\n * The peek offset between collapsed cards, and the gap between expanded\n * cards, in px.\n *\n * @defaultValue 16\n */\n spacing?: number;\n\n /**\n * The visual style applied to every card.\n *\n * @defaultValue 'default'\n */\n variant?: 'default' | 'tonal' | 'solid';\n\n /**\n * How many cards stay visible while the stack is collapsed.\n *\n * @defaultValue 3\n */\n visibleToasts?: number;\n\n /**\n * Keep the stack expanded instead of collapsing it when not hovered.\n *\n * @defaultValue false\n */\n expand?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * Callback called when a notification is dismissed\n */\n onDismiss?: (notification: Notification<Record<string, unknown>>) => void;\n };\n Element: HTMLDivElement;\n}\n\nclass NotificationsContainer extends Component<NotificationsContainerSignature> {\n @service notifications!: NotificationsService;\n\n @tracked isHovered = false;\n\n /**\n * Measured card heights, keyed by notification. Reassigned rather than\n * mutated so reads stay tracked.\n */\n @tracked heights: Map<Notification<Record<string, unknown>>, number> =\n new Map();\n\n constructor(owner: Owner, args: NotificationsContainerSignature['Args']) {\n super(owner, args);\n\n // Register a stable callback that delegates to the current `@onDismiss`,\n // so a change to the argument is picked up without re-registering.\n this.notifications.setOnRemoveCallback(this.handleDismiss);\n\n // Clean up when component is destroyed, but only if we are still the\n // registered owner: the service holds a single callback slot, so another\n // container might have taken it over in the meantime.\n registerDestructor(this, () => {\n if (this.notifications.onRemoveCallback === this.handleDismiss) {\n this.notifications.setOnRemoveCallback(undefined);\n }\n });\n }\n\n handleDismiss = (notification: Notification<Record<string, unknown>>) => {\n // Prune immediately rather than waiting for the next `measure` call —\n // if the dismissed notification was the last one, nothing would ever\n // trigger a rebuild otherwise, and its height entry (with its strong\n // reference to the `Notification` and its `metadata`) would linger\n // forever.\n if (this.heights.has(notification)) {\n const nextHeights = new Map(this.heights);\n nextHeights.delete(notification);\n this.heights = nextHeights;\n }\n\n this.args.onDismiss?.(notification);\n };\n\n get placement(): containerPlacement {\n return this.args.placement || 'bottom-right';\n }\n\n get spacing(): number {\n return typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n }\n\n get visibleToasts(): number {\n return typeof this.args.visibleToasts === 'undefined'\n ? 3\n : this.args.visibleToasts;\n }\n\n get isExpanded(): boolean {\n return this.args.expand === true || this.isHovered;\n }\n\n /**\n * `data-expanded` as a string, computed here rather than with an inline\n * `{{if}}`: the template-side form needs quoted string literals, and\n * prettier and ember-template-lint disagree about which quotes those may\n * be, so neither linter can be satisfied inside the template.\n */\n get expandedAttribute(): 'true' | 'false' {\n return this.isExpanded ? 'true' : 'false';\n }\n\n /**\n * Newest first, for every placement. The placement only decides which edge\n * the stack is pinned to and which way it grows, never the order.\n */\n @cached\n get stackOrder(): Notification<Record<string, unknown>>[] {\n return this.notifications.notifications.slice().reverse();\n }\n\n @cached\n get stack(): NotificationStack {\n return new NotificationStack({\n heights: this.stackOrder.map(\n (notification) => this.heights.get(notification) ?? 0\n ),\n isExpanded: this.isExpanded,\n gap: this.spacing,\n visibleToasts: this.visibleToasts,\n placement: this.placement\n });\n }\n\n get stackStyle(): SafeString {\n return htmlSafe(`height: ${this.stack.containerHeight}px`);\n }\n\n /**\n * Glint rejects calling a class method with an argument directly from the\n * template, so this arrow-function property is the call site instead.\n */\n geometryFor = (index: number) => this.stack.geometryFor(index);\n\n measure = (\n notification: Notification<Record<string, unknown>>,\n height: number\n ) => {\n // Skip scheduling entirely when the height hasn't actually changed, so a\n // redundant ResizeObserver tick doesn't cost a runloop turn.\n if (this.heights.get(notification) === height) {\n return;\n }\n\n // The card's measure modifier calls this synchronously while installing,\n // i.e. mid-render, while other cards' geometry is still being read from\n // `this.heights` in the same computation — see `deferWhileAlive`. Note\n // that `next()` schedules via a 1ms `_backburner.later(...)` timer, which\n // lands *after* the current frame paints — so the first painted frame\n // still renders with `heights` empty (`containerHeight: 0px`, every\n // collapsed card at `height: 0px`), corrected one macrotask later. Since\n // the stack carries `transition-[height] duration-400`, that correction\n // is a visible height animation from 0 on first appearance.\n deferWhileAlive(this, () => {\n if (this.heights.get(notification) === height) {\n return;\n }\n\n // Rebuild rather than mutate in place (`Map` mutation isn't tracked),\n // and prune any notification no longer live while we're at it — a\n // dismissed notification is never measured again, so without this the\n // map (and its strong reference to every past `Notification` and its\n // `metadata`) would grow for the container's entire lifetime, and\n // every future rebuild would keep copying all of that dead weight.\n const live = new Set(this.notifications.notifications);\n const nextHeights = new Map(\n Array.from(this.heights).filter(([n]) => live.has(n))\n );\n nextHeights.set(notification, height);\n this.heights = nextHeights;\n });\n };\n\n /**\n * Expanding the stack pauses every timer, not just the hovered card's:\n * the user is reading the whole stack, so none of it should time out.\n */\n expand = () => {\n if (this.isHovered) {\n return;\n }\n\n this.isHovered = true;\n this.notifications.notifications.forEach((notification) => {\n notification.timer?.pause();\n });\n };\n\n collapse = () => {\n if (!this.isHovered) {\n return;\n }\n\n this.isHovered = false;\n this.notifications.notifications.forEach((notification) => {\n notification.timer?.resume();\n });\n };\n\n /**\n * `focusout` bubbles from every element inside the container, and fires\n * before the next element's `focusin` — so tabbing from one card's close\n * button to the next card's close button collapses the stack for one\n * tick and re-expands it immediately after, right in the middle of the\n * exact keyboard journey the focus-expand behavior exists to support.\n *\n * A containment check fixes it: only collapse when focus is actually\n * leaving the container, i.e. `relatedTarget` (the element about to\n * receive focus) is not inside it. `relatedTarget` is `null` when focus\n * moves somewhere that isn't focus-trackable (e.g. the browser chrome),\n * which is also a real \"focus left the container\" case.\n */\n handleFocusOut = (event: FocusEvent) => {\n const container = event.currentTarget as HTMLElement;\n const related = event.relatedTarget as Node | null;\n\n if (related && container.contains(related)) {\n return;\n }\n\n this.collapse();\n };\n\n /**\n * `expand()`/`collapse()` only touch the timers that exist at the moment\n * the pointer enters or leaves the stack. That leaves two gaps: a toast\n * added (or a `promise()` settling into its own timer) while the stack is\n * already expanded starts *running*, and can auto-dismiss under the\n * cursor; and with `@expand={{true}}`, `isExpanded` is permanently true\n * but `expand()`'s hover handler never runs at all, so nothing ever pauses\n * those timers either.\n *\n * This modifier reconciles the invariant \"a timer runs iff the stack is\n * not expanded\" for every straggler. It re-runs whenever `stackOrder` or\n * `isExpanded` — passed as *positional arguments* (see the template)\n * rather than only read off `this` inside the callback, since a\n * function-based modifier only re-runs when Glimmer sees its own args\n * change — but the deferred pass below reads `this.isExpanded` fresh\n * rather than trusting the `isExpanded` captured here: without that, a\n * collapse landing in the window between this being scheduled and it\n * actually running would have its resume silently undone by a stale\n * pause queued moments earlier.\n */\n syncTimers = modifier(\n (\n _element: Element,\n [stackOrder]: [Notification<Record<string, unknown>>[], boolean]\n ) => {\n deferWhileAlive(this, () => {\n const shouldPause = this.isExpanded;\n\n stackOrder.forEach((notification) => {\n if (shouldPause) {\n notification.timer?.pause();\n } else {\n notification.timer?.resume();\n }\n });\n });\n }\n );\n\n /**\n * The number of entries in the `heights` map. Not used for rendering —\n * exposed (via a `data-*` attribute below) purely so tests can assert the\n * map is actually pruned on dismiss/measure, rather than only checking\n * that pruning doesn't throw.\n *\n * @internal\n */\n get heightsSize(): number {\n return this.heights.size;\n }\n\n get classes() {\n const { notificationsContainer } = useStyles();\n\n const { base, stack } = notificationsContainer({\n placement: this.placement,\n class: this.args.class\n });\n\n return { base: base(), stack: stack() };\n }\n\n <template>\n {{! template-lint-disable no-inline-styles }}\n <div\n data-component=\"notifications-container\"\n data-part=\"base\"\n class={{this.classes.base}}\n role=\"region\"\n aria-label=\"Notifications\"\n aria-live=\"polite\"\n data-test-heights-size={{this.heightsSize}}\n {{on \"mouseenter\" this.expand}}\n {{on \"mouseleave\" this.collapse}}\n {{on \"focusin\" this.expand}}\n {{on \"focusout\" this.handleFocusOut}}\n ...attributes\n >\n <div\n data-part=\"stack\"\n class={{this.classes.stack}}\n style={{this.stackStyle}}\n data-expanded={{this.expandedAttribute}}\n {{this.syncTimers this.stackOrder this.isExpanded}}\n >\n {{#each this.stackOrder key=\"@identity\" as |notification index|}}\n <NotificationCard\n @notification={{notification}}\n @placement={{this.placement}}\n @variant={{@variant}}\n @geometry={{this.geometryFor index}}\n @onMeasure={{fn this.measure notification}}\n />\n {{/each}}\n </div>\n </div>\n </template>\n}\n\nexport { NotificationsContainer, type NotificationsContainerSignature };\nexport default NotificationsContainer;\n"],"names":["deferWhileAlive","component","fn","next","isDestroying","isDestroyed","NotificationsContainer","Component","g","prototype","service","i","tracked","Map","constructor","owner","args","notifications","setOnRemoveCallback","handleDismiss","registerDestructor","onRemoveCallback","undefined","notification","heights","has","nextHeights","delete","onDismiss","placement","spacing","visibleToasts","isExpanded","expand","isHovered","expandedAttribute","stackOrder","slice","reverse","n","cached","stack","NotificationStack","map","get","gap","stackStyle","htmlSafe","containerHeight","geometryFor","index","measure","height","live","Set","Array","from","filter","set","forEach","timer","pause","collapse","resume","handleFocusOut","event","container","currentTarget","related","relatedTarget","contains","syncTimers","modifier","_element","shouldPause","heightsSize","size","classes","notificationsContainer","useStyles","base","class","setComponentTemplate","precompileTemplate","strictMode","scope","on","NotificationCard"],"mappings":";;;;;;;;;;;;;;;AA2BA,SAASA,eAAAA,CACPC,SAA0D,EAC1DC,EAAc,EACT;AACLC,EAAAA,IAAA,CAAK,MAAA;AACH,IAAA,IAAIF,SAAA,CAAUG,YAAY,IAAIH,SAAA,CAAUI,WAAW,EAAE;AACnD,MAAA;AACF,IAAA;AAEAH,IAAAA,EAAA,EAAA;AACF,EAAA,CAAA,CAAA;AACF;AAqDA,MAAMI,+BAA+BC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAC5CC,OAAA,CAAA,CAAA;AAAA;EAAA,cAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,eAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAEAG,OAAA,CAAA,E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;;;;EAQA,IAAIY,WAAAA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAACnD,OAAO,CAACoD,IAAI;AAC1B,EAAA;EAEA,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAwB,GAAGC,SAAA,EAAA;IAEnC,MAAM;MAAEC,IAAI;AAAEvC,MAAAA;KAAO,GAAGqC,sBAAA,CAAuB;MAC7CjD,SAAA,EAAW,IAAI,CAACA,SAAS;AACzBoD,MAAAA,KAAA,EAAO,IAAI,CAACjE,IAAI,CAACiE;AACnB,KAAA,CAAA;IAEA,OAAO;MAAED,IAAA,EAAMA,IAAA,EAAA;MAAQvC,KAAA,EAAOA,KAAA;KAAQ;AACxC,EAAA;AAEA,EAAA;IAAAyC,oBAAA,CAAAC,kBAAA,CAAA,w3BAAA,EAkCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,gBAAA;AAAArF,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"notifications-container.js","sources":["../../../src/components/notifications/notifications-container.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport { service } from '@ember/service';\nimport { next } from '@ember/runloop';\nimport { fn } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { htmlSafe } from '@ember/template';\nimport { registerDestructor } from '@ember/destroyable';\nimport NotificationCard from './notification-card';\nimport { NotificationStack } from '../../-private/notification-stack';\nimport type NotificationsService from '../../services/notifications';\nimport type Notification from '../../-private/notification';\nimport { type containerPlacement } from '../../-private/types';\nimport { useStyles } from '@frontile/theme';\nimport type Owner from '@ember/owner';\nimport type { SafeString } from '@ember/template';\n\n/**\n * Defers `fn` to the next runloop turn, skipping it if the component has\n * started (or finished) being destroyed by then. Shared by `measure` and\n * `syncTimers`, which each write a tracked property from a place Glimmer\n * still considers \"rendering\" (a modifier's install, or a callback invoked\n * synchronously during render) — writing immediately there trips the\n * \"attempted to update a value after using it in this computation\"\n * assertion, so the write has to land one runloop turn later instead.\n */\nfunction deferWhileAlive(\n component: { isDestroying: boolean; isDestroyed: boolean },\n fn: () => void\n): void {\n next(() => {\n if (component.isDestroying || component.isDestroyed) {\n return;\n }\n\n fn();\n });\n}\n\ninterface NotificationsContainerSignature {\n Args: {\n /**\n * The placement of the notifications\n *\n * @defaultValue 'bottom-right'\n */\n placement?: containerPlacement;\n\n /**\n * The peek offset between collapsed cards, and the gap between expanded\n * cards, in px.\n *\n * @defaultValue 16\n */\n spacing?: number;\n\n /**\n * The visual style applied to every card.\n *\n * @defaultValue 'surface'\n */\n variant?: 'surface' | 'soft' | 'solid';\n\n /**\n * How many cards stay visible while the stack is collapsed.\n *\n * @defaultValue 3\n */\n visibleToasts?: number;\n\n /**\n * Keep the stack expanded instead of collapsing it when not hovered.\n *\n * @defaultValue false\n */\n expand?: boolean;\n\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */\n class?: string;\n\n /**\n * Callback called when a notification is dismissed\n */\n onDismiss?: (notification: Notification<Record<string, unknown>>) => void;\n };\n Element: HTMLDivElement;\n}\n\nclass NotificationsContainer extends Component<NotificationsContainerSignature> {\n @service notifications!: NotificationsService;\n\n @tracked isHovered = false;\n\n /**\n * Measured card heights, keyed by notification. Reassigned rather than\n * mutated so reads stay tracked.\n */\n @tracked heights: Map<Notification<Record<string, unknown>>, number> =\n new Map();\n\n constructor(owner: Owner, args: NotificationsContainerSignature['Args']) {\n super(owner, args);\n\n // Register a stable callback that delegates to the current `@onDismiss`,\n // so a change to the argument is picked up without re-registering.\n this.notifications.setOnRemoveCallback(this.handleDismiss);\n\n // Clean up when component is destroyed, but only if we are still the\n // registered owner: the service holds a single callback slot, so another\n // container might have taken it over in the meantime.\n registerDestructor(this, () => {\n if (this.notifications.onRemoveCallback === this.handleDismiss) {\n this.notifications.setOnRemoveCallback(undefined);\n }\n });\n }\n\n handleDismiss = (notification: Notification<Record<string, unknown>>) => {\n // Prune immediately rather than waiting for the next `measure` call —\n // if the dismissed notification was the last one, nothing would ever\n // trigger a rebuild otherwise, and its height entry (with its strong\n // reference to the `Notification` and its `metadata`) would linger\n // forever.\n if (this.heights.has(notification)) {\n const nextHeights = new Map(this.heights);\n nextHeights.delete(notification);\n this.heights = nextHeights;\n }\n\n this.args.onDismiss?.(notification);\n };\n\n get placement(): containerPlacement {\n return this.args.placement || 'bottom-right';\n }\n\n get spacing(): number {\n return typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n }\n\n get visibleToasts(): number {\n return typeof this.args.visibleToasts === 'undefined'\n ? 3\n : this.args.visibleToasts;\n }\n\n get isExpanded(): boolean {\n return this.args.expand === true || this.isHovered;\n }\n\n /**\n * `data-expanded` as a string, computed here rather than with an inline\n * `{{if}}`: the template-side form needs quoted string literals, and\n * prettier and ember-template-lint disagree about which quotes those may\n * be, so neither linter can be satisfied inside the template.\n */\n get expandedAttribute(): 'true' | 'false' {\n return this.isExpanded ? 'true' : 'false';\n }\n\n /**\n * Newest first, for every placement. The placement only decides which edge\n * the stack is pinned to and which way it grows, never the order.\n */\n @cached\n get stackOrder(): Notification<Record<string, unknown>>[] {\n return this.notifications.notifications.slice().reverse();\n }\n\n @cached\n get stack(): NotificationStack {\n return new NotificationStack({\n heights: this.stackOrder.map(\n (notification) => this.heights.get(notification) ?? 0\n ),\n isExpanded: this.isExpanded,\n gap: this.spacing,\n visibleToasts: this.visibleToasts,\n placement: this.placement\n });\n }\n\n get stackStyle(): SafeString {\n return htmlSafe(`height: ${this.stack.containerHeight}px`);\n }\n\n /**\n * Glint rejects calling a class method with an argument directly from the\n * template, so this arrow-function property is the call site instead.\n */\n geometryFor = (index: number) => this.stack.geometryFor(index);\n\n measure = (\n notification: Notification<Record<string, unknown>>,\n height: number\n ) => {\n // Skip scheduling entirely when the height hasn't actually changed, so a\n // redundant ResizeObserver tick doesn't cost a runloop turn.\n if (this.heights.get(notification) === height) {\n return;\n }\n\n // The card's measure modifier calls this synchronously while installing,\n // i.e. mid-render, while other cards' geometry is still being read from\n // `this.heights` in the same computation — see `deferWhileAlive`. Note\n // that `next()` schedules via a 1ms `_backburner.later(...)` timer, which\n // lands *after* the current frame paints — so the first painted frame\n // still renders with `heights` empty (`containerHeight: 0px`, every\n // collapsed card at `height: 0px`), corrected one macrotask later. Since\n // the stack carries `transition-[height] duration-400`, that correction\n // is a visible height animation from 0 on first appearance.\n deferWhileAlive(this, () => {\n if (this.heights.get(notification) === height) {\n return;\n }\n\n // Rebuild rather than mutate in place (`Map` mutation isn't tracked),\n // and prune any notification no longer live while we're at it — a\n // dismissed notification is never measured again, so without this the\n // map (and its strong reference to every past `Notification` and its\n // `metadata`) would grow for the container's entire lifetime, and\n // every future rebuild would keep copying all of that dead weight.\n const live = new Set(this.notifications.notifications);\n const nextHeights = new Map(\n Array.from(this.heights).filter(([n]) => live.has(n))\n );\n nextHeights.set(notification, height);\n this.heights = nextHeights;\n });\n };\n\n /**\n * Expanding the stack pauses every timer, not just the hovered card's:\n * the user is reading the whole stack, so none of it should time out.\n */\n expand = () => {\n if (this.isHovered) {\n return;\n }\n\n this.isHovered = true;\n this.notifications.notifications.forEach((notification) => {\n notification.timer?.pause();\n });\n };\n\n collapse = () => {\n if (!this.isHovered) {\n return;\n }\n\n this.isHovered = false;\n this.notifications.notifications.forEach((notification) => {\n notification.timer?.resume();\n });\n };\n\n /**\n * `focusout` bubbles from every element inside the container, and fires\n * before the next element's `focusin` — so tabbing from one card's close\n * button to the next card's close button collapses the stack for one\n * tick and re-expands it immediately after, right in the middle of the\n * exact keyboard journey the focus-expand behavior exists to support.\n *\n * A containment check fixes it: only collapse when focus is actually\n * leaving the container, i.e. `relatedTarget` (the element about to\n * receive focus) is not inside it. `relatedTarget` is `null` when focus\n * moves somewhere that isn't focus-trackable (e.g. the browser chrome),\n * which is also a real \"focus left the container\" case.\n */\n handleFocusOut = (event: FocusEvent) => {\n const container = event.currentTarget as HTMLElement;\n const related = event.relatedTarget as Node | null;\n\n if (related && container.contains(related)) {\n return;\n }\n\n this.collapse();\n };\n\n /**\n * `expand()`/`collapse()` only touch the timers that exist at the moment\n * the pointer enters or leaves the stack. That leaves two gaps: a toast\n * added (or a `promise()` settling into its own timer) while the stack is\n * already expanded starts *running*, and can auto-dismiss under the\n * cursor; and with `@expand={{true}}`, `isExpanded` is permanently true\n * but `expand()`'s hover handler never runs at all, so nothing ever pauses\n * those timers either.\n *\n * This modifier reconciles the invariant \"a timer runs iff the stack is\n * not expanded\" for every straggler. It re-runs whenever `stackOrder` or\n * `isExpanded` — passed as *positional arguments* (see the template)\n * rather than only read off `this` inside the callback, since a\n * function-based modifier only re-runs when Glimmer sees its own args\n * change — but the deferred pass below reads `this.isExpanded` fresh\n * rather than trusting the `isExpanded` captured here: without that, a\n * collapse landing in the window between this being scheduled and it\n * actually running would have its resume silently undone by a stale\n * pause queued moments earlier.\n */\n syncTimers = modifier(\n (\n _element: Element,\n [stackOrder]: [Notification<Record<string, unknown>>[], boolean]\n ) => {\n deferWhileAlive(this, () => {\n const shouldPause = this.isExpanded;\n\n stackOrder.forEach((notification) => {\n if (shouldPause) {\n notification.timer?.pause();\n } else {\n notification.timer?.resume();\n }\n });\n });\n }\n );\n\n /**\n * The number of entries in the `heights` map. Not used for rendering —\n * exposed (via a `data-*` attribute below) purely so tests can assert the\n * map is actually pruned on dismiss/measure, rather than only checking\n * that pruning doesn't throw.\n *\n * @internal\n */\n get heightsSize(): number {\n return this.heights.size;\n }\n\n get classes() {\n const { notificationsContainer } = useStyles();\n\n const { base, stack } = notificationsContainer({\n placement: this.placement,\n class: this.args.class\n });\n\n return { base: base(), stack: stack() };\n }\n\n <template>\n {{! template-lint-disable no-inline-styles }}\n <div\n data-component=\"notifications-container\"\n data-part=\"base\"\n class={{this.classes.base}}\n role=\"region\"\n aria-label=\"Notifications\"\n aria-live=\"polite\"\n data-test-heights-size={{this.heightsSize}}\n {{on \"mouseenter\" this.expand}}\n {{on \"mouseleave\" this.collapse}}\n {{on \"focusin\" this.expand}}\n {{on \"focusout\" this.handleFocusOut}}\n ...attributes\n >\n <div\n data-part=\"stack\"\n class={{this.classes.stack}}\n style={{this.stackStyle}}\n data-expanded={{this.expandedAttribute}}\n {{this.syncTimers this.stackOrder this.isExpanded}}\n >\n {{#each this.stackOrder key=\"@identity\" as |notification index|}}\n <NotificationCard\n @notification={{notification}}\n @placement={{this.placement}}\n @variant={{@variant}}\n @geometry={{this.geometryFor index}}\n @onMeasure={{fn this.measure notification}}\n />\n {{/each}}\n </div>\n </div>\n </template>\n}\n\nexport { NotificationsContainer, type NotificationsContainerSignature };\nexport default NotificationsContainer;\n"],"names":["deferWhileAlive","component","fn","next","isDestroying","isDestroyed","NotificationsContainer","Component","g","prototype","service","i","tracked","Map","constructor","owner","args","notifications","setOnRemoveCallback","handleDismiss","registerDestructor","onRemoveCallback","undefined","notification","heights","has","nextHeights","delete","onDismiss","placement","spacing","visibleToasts","isExpanded","expand","isHovered","expandedAttribute","stackOrder","slice","reverse","n","cached","stack","NotificationStack","map","get","gap","stackStyle","htmlSafe","containerHeight","geometryFor","index","measure","height","live","Set","Array","from","filter","set","forEach","timer","pause","collapse","resume","handleFocusOut","event","container","currentTarget","related","relatedTarget","contains","syncTimers","modifier","_element","shouldPause","heightsSize","size","classes","notificationsContainer","useStyles","base","class","setComponentTemplate","precompileTemplate","strictMode","scope","on","NotificationCard"],"mappings":";;;;;;;;;;;;;;;AA2BA,SAASA,eAAAA,CACPC,SAA0D,EAC1DC,EAAc,EACT;AACLC,EAAAA,IAAA,CAAK,MAAA;AACH,IAAA,IAAIF,SAAA,CAAUG,YAAY,IAAIH,SAAA,CAAUI,WAAW,EAAE;AACnD,MAAA;AACF,IAAA;AAEAH,IAAAA,EAAA,EAAA;AACF,EAAA,CAAA,CAAA;AACF;AAqDA,MAAMI,+BAA+BC,SAAA,CAAU;AAAA,EAAA;IAAAC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AAImD,WAAA,EAAa;AACfnD,UAAAA,YAAA,CAAaqC,KAAK,EAAEC,KAAA,EAAA;AACtB,QAAA,CAAA,MAAO;AACLtC,UAAAA,YAAA,CAAaqC,KAAK,EAAEG,MAAA,EAAA;AACtB,QAAA;AACF,MAAA,CAAA,CAAA;AACF,IAAA,CAAA,CAAA;AACF,EAAA,CAAA,CAAA;AAGF;;;;;;;;EAQA,IAAIY,WAAAA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAACnD,OAAO,CAACoD,IAAI;AAC1B,EAAA;EAEA,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAwB,GAAGC,SAAA,EAAA;IAEnC,MAAM;MAAEC,IAAI;AAAEvC,MAAAA;KAAO,GAAGqC,sBAAA,CAAuB;MAC7CjD,SAAA,EAAW,IAAI,CAACA,SAAS;AACzBoD,MAAAA,KAAA,EAAO,IAAI,CAACjE,IAAI,CAACiE;AACnB,KAAA,CAAA;IAEA,OAAO;MAAED,IAAA,EAAMA,IAAA,EAAA;MAAQvC,KAAA,EAAOA,KAAA;KAAQ;AACxC,EAAA;AAEA,EAAA;IAAAyC,oBAAA,CAAAC,kBAAA,CAAA,w3BAAA,EAkCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,gBAAA;AAAArF,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -103,8 +103,8 @@ class Drawer extends Component {
|
|
|
103
103
|
get placement() {
|
|
104
104
|
return this.args.placement || 'right';
|
|
105
105
|
}
|
|
106
|
-
get
|
|
107
|
-
return this.args.
|
|
106
|
+
get variant() {
|
|
107
|
+
return this.args.variant || 'sectioned';
|
|
108
108
|
}
|
|
109
109
|
get isVerticalPlacement() {
|
|
110
110
|
return this.placement === 'top' || this.placement === 'bottom';
|
|
@@ -136,7 +136,7 @@ class Drawer extends Component {
|
|
|
136
136
|
return drawer({
|
|
137
137
|
placement: this.placement,
|
|
138
138
|
size: this.args.size || 'md',
|
|
139
|
-
|
|
139
|
+
variant: this.variant,
|
|
140
140
|
hasCloseButton: this.showCloseButton
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","sources":["../../../src/components/overlays/drawer.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { warnIfDialogHasNoAccessibleName } from '../../-private/dialog';\nimport Overlay, { type OverlaySignature } from './overlay';\nimport DrawerBody, { type DrawerBodySignature } from './drawer/body';\nimport DrawerFooter, { type DrawerFooterSignature } from './drawer/footer';\nimport DrawerHeader, { type DrawerHeaderSignature } from './drawer/header';\nimport DrawerDragHandle from './drawer/drag-handle';\nimport {\n DRAWER_BODY_SELECTOR,\n DRAWER_DRAG_HANDLE_SELECTOR\n} from './drawer/selectors';\nimport dragToDismiss, {\n type DragAxis,\n type DragDirection\n} from '../../modifiers/drag-to-dismiss';\nimport {\n CloseButton,\n type CloseButtonSignature\n} from '../buttons/close-button';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\nimport {\n useStyles,\n type SlotsToClasses,\n type DrawerSlots,\n type DrawerVariants\n} from '@frontile/theme';\n\nexport interface DrawerArgs extends Pick<\n OverlaySignature['Args'],\n | 'isOpen'\n | 'onOpen'\n | 'onClose'\n | 'didClose'\n | 'renderInPlace'\n | 'target'\n | 'transitionDuration'\n | 'backdrop'\n | 'disableTransitions'\n | 'animateOnMount'\n | 'disableFocusTrap'\n | 'focusTrapOptions'\n | 'closeOnOutsideClick'\n | 'closeOnEscapeKey'\n | 'backdropTransition'\n | 'preventAutoFocus'\n> {\n /**\n * The transition to be used in the Drawer.\n *\n * @defaultValue {name: 'overlay-transition--slide-from-[placement]'}\n */\n transition?: OverlaySignature['Args']['transition'];\n\n /**\n * If set to false, the close button will not be displayed,\n * closeOnOutsideClick will be set to false, and closeOnEscapeKey will also be set\n * to false.\n *\n * @defaultValue true\n */\n allowClosing?: boolean;\n\n /**\n * If set to false, the close button will not be displayed.\n *\n * @defaultValue true\n */\n allowCloseButton?: boolean;\n\n /**\n * The Close Button size.\n *\n * @defaultValue 'lg'\n */\n closeButtonSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n /**\n * The Drawer can appear from any side of the screen. The 'placement'\n * option allows to choose where it appears from.\n *\n * @defaultValue 'right'\n */\n placement?: DrawerVariants['placement'];\n\n /**\n * The Drawer size.\n *\n * @defaultValue 'md'\n */\n size?: DrawerVariants['size'];\n\n /**\n * The Drawer visual appearance.\n *\n * `default` gives the drawer a black header band, a distinct body surface and\n * a solid footer. `ghost` keeps every region on the modal surface.\n *\n * @defaultValue 'default'\n */\n appearance?: DrawerVariants['appearance'];\n\n /**\n * Enables the drag-to-close gesture and its grab handle.\n *\n * Omit it and the gesture is on for `top` and `bottom` placements and off for\n * `left` and `right`. Pass `true` to opt a side drawer in, or `false` to turn\n * it off entirely. Always off when `allowClosing` is `false`.\n *\n * @defaultValue true for `top`/`bottom`, false for `left`/`right`\n */\n allowDragToClose?: boolean;\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<DrawerSlots>;\n}\n\nexport interface DrawerSignature {\n Args: DrawerArgs;\n Blocks: {\n default: [\n {\n CloseButton: WithBoundArgs<\n ComponentLike<CloseButtonSignature>,\n 'onPress' | 'class'\n >;\n Header: WithBoundArgs<\n ComponentLike<DrawerHeaderSignature>,\n | 'labelledById'\n | 'classFromParent'\n | 'registerSelf'\n | 'iconClass'\n | 'titleClass'\n | 'descriptionClass'\n | 'contentClass'\n | 'actionsClass'\n | 'closeButton'\n >;\n Body: WithBoundArgs<\n ComponentLike<DrawerBodySignature>,\n 'classFromParent'\n >;\n Footer: WithBoundArgs<\n ComponentLike<DrawerFooterSignature>,\n 'classFromParent'\n >;\n headerId: string;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class Drawer extends Component<DrawerSignature> {\n headerId = `${guidFor(this)}-header`;\n\n // `aria-labelledby` is only useful if it points at an element that actually\n // exists — a dangling reference leaves the dialog with no accessible name at\n // all. The yielded `Header` reports when it is rendered and when it goes\n // away, which keeps the reference correct even for a conditional header.\n // The count itself is deliberately untracked: registration happens while the\n // header's modifier is installing, and reading a tracked value there before\n // writing it trips Glimmer's backtracking assertion. Only the derived flag is\n // tracked, and it is always written, never read, from the callback.\n //\n // The `ref` utility looks like it should replace all of this, and it was\n // tried. It cannot: `Ref.setup` clears `current` unconditionally on teardown,\n // so it answers \"what is the current element?\" where this needs \"does any\n // header exist?\" — and those diverge when a header is *replaced* rather than\n // added or removed. Glimmer installs the modifiers of newly rendered elements\n // before tearing down the ones they replace (see the comments in\n // `utils/listManager.ts`), so with a `ref` a header swapped between the\n // branches of an `{{#if}}` leaves `current` undefined and the dialog silently\n // loses its accessible name. A `+1/-1` count is order-independent, which is\n // the whole point of it being a count.\n renderedHeaders = 0;\n @tracked hasHeader = false;\n\n registerHeader = (isRendered: boolean): void => {\n if (this.isDestroying || this.isDestroyed) {\n return;\n }\n\n this.renderedHeaders += isRendered ? 1 : -1;\n this.hasHeader = this.renderedHeaders > 0;\n };\n\n get labelledById(): string | undefined {\n return this.hasHeader ? this.headerId : undefined;\n }\n\n // What makes reading `hasHeader` here safe is *when* modifiers run, not in\n // what order: modifier install happens after the render transaction has\n // closed, so the template has already consumed `hasHeader` (through\n // `labelledById`) before any modifier hook fires. The header's write during\n // its own install therefore cannot invalidate a value still being rendered,\n // which is what would trip Glimmer's backtracking assertion.\n //\n // Whether the header's registration precedes this modifier is a separate,\n // unspecified Glimmer implementation detail. All it decides is whether this\n // first-render check already sees a registered header; if that order ever\n // inverted, the failure mode is a spurious development warning on a dialog\n // that does have a `Header` — not a broken render.\n //\n // Consumer-supplied names come through `...attributes`, which we cannot see\n // in args, hence inspecting the element itself.\n warnIfUnnamed = modifier((element: HTMLElement) => {\n warnIfDialogHasNoAccessibleName(element, this.hasHeader, 'drawer');\n });\n\n /**\n * `aria-modal=\"true\"` promises assistive technology that the rest of the page\n * is unreachable while this dialog is open. That promise only holds while the\n * overlay's focus trap is active, so when the consumer turns the trap off we\n * omit the attribute rather than lie about it — screen readers then keep\n * exposing the page behind, which is what actually happens.\n */\n get ariaModal(): 'true' | undefined {\n return this.args.disableFocusTrap === true ? undefined : 'true';\n }\n\n get preventClosing(): boolean {\n return this.args.allowClosing === false;\n }\n\n get showCloseButton(): boolean {\n return (\n this.args.allowClosing !== false && this.args.allowCloseButton !== false\n );\n }\n\n // When a header is rendered, the close button lives inside it (see\n // `DrawerHeader`'s `@closeButton` arg below) so it can be centred against\n // the header's actual height. The standalone, absolutely-positioned close\n // button is only needed as a fallback for drawers with no header at all --\n // rendering both at once would show two close buttons.\n get showStandaloneCloseButton(): boolean {\n return this.showCloseButton && !this.hasHeader;\n }\n\n get closeButtonSize(): NonNullable<DrawerArgs['closeButtonSize']> {\n return this.args.closeButtonSize || 'lg';\n }\n\n get placement() {\n return this.args.placement || 'right';\n }\n\n get appearance(): NonNullable<DrawerVariants['appearance']> {\n return this.args.appearance || 'default';\n }\n\n get isVerticalPlacement(): boolean {\n return this.placement === 'top' || this.placement === 'bottom';\n }\n\n get allowDragToClose(): boolean {\n if (this.args.allowClosing === false) {\n return false;\n }\n\n if (typeof this.args.allowDragToClose === 'boolean') {\n return this.args.allowDragToClose;\n }\n\n return this.isVerticalPlacement;\n }\n\n get dragAxis(): DragAxis {\n return this.isVerticalPlacement ? 'y' : 'x';\n }\n\n // The drawer is dismissed by pushing it back toward the edge it came from:\n // a bottom drawer moves down (+y), a top drawer up (-y).\n get dragDirection(): DragDirection {\n return this.placement === 'bottom' || this.placement === 'right' ? 1 : -1;\n }\n\n handleDragDismiss = (): void => {\n this.args.onClose?.();\n };\n\n get classes() {\n const { drawer } = useStyles();\n\n return drawer({\n placement: this.placement,\n size: this.args.size || 'md',\n appearance: this.appearance,\n hasCloseButton: this.showCloseButton\n });\n }\n get transition() {\n let options: OverlaySignature['Args']['transition'] = {\n name: `overlay-transition--slide-from-${this.placement}`\n };\n\n if (typeof this.args.transition === 'object') {\n return { ...options, ...this.args.transition };\n }\n\n return options;\n }\n\n <template>\n <Overlay\n @isOpen={{@isOpen}}\n @onClose={{@onClose}}\n @onOpen={{@onOpen}}\n @didClose={{@didClose}}\n @renderInPlace={{@renderInPlace}}\n @target={{@target}}\n @transitionDuration={{@transitionDuration}}\n @backdrop={{@backdrop}}\n @disableTransitions={{@disableTransitions}}\n @animateOnMount={{@animateOnMount}}\n @disableFocusTrap={{@disableFocusTrap}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{if this.preventClosing false @closeOnOutsideClick}}\n @closeOnEscapeKey={{if this.preventClosing false @closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @transition={{this.transition}}\n @closeOnOverlayElementClick={{true}}\n @preventAutoFocus={{@preventAutoFocus}}\n >\n <div\n data-component=\"drawer\"\n data-part=\"base\"\n class={{this.classes.base class=@classes.base}}\n tabindex=\"0\"\n role=\"dialog\"\n aria-modal={{this.ariaModal}}\n aria-labelledby={{this.labelledById}}\n {{dragToDismiss\n axis=this.dragAxis\n direction=this.dragDirection\n isEnabled=this.allowDragToClose\n onDismiss=this.handleDragDismiss\n handleSelector=DRAWER_DRAG_HANDLE_SELECTOR\n scrollSelector=DRAWER_BODY_SELECTOR\n }}\n {{this.warnIfUnnamed}}\n ...attributes\n >\n {{#if this.allowDragToClose}}\n <DrawerDragHandle\n data-part=\"drag-handle\"\n @onPress={{@onClose}}\n @class={{this.classes.dragHandle class=@classes.dragHandle}}\n @barClass={{this.classes.dragHandleBar\n class=@classes.dragHandleBar\n }}\n />\n {{/if}}\n\n {{#if this.showStandaloneCloseButton}}\n <CloseButton\n data-part=\"close-button\"\n @onPress={{@onClose}}\n @size={{this.closeButtonSize}}\n @class={{this.classes.closeButton class=@classes.closeButton}}\n />\n {{/if}}\n\n {{yield\n (hash\n CloseButton=(component\n CloseButton\n onPress=@onClose\n size=this.closeButtonSize\n class=(this.classes.closeButton class=@classes.closeButton)\n )\n Header=(component\n DrawerHeader\n labelledById=this.headerId\n registerSelf=this.registerHeader\n classFromParent=(this.classes.header class=@classes.header)\n iconClass=(this.classes.icon class=@classes.icon)\n titleClass=(this.classes.title class=@classes.title)\n descriptionClass=(this.classes.description\n class=@classes.description\n )\n contentClass=(this.classes.headerContent\n class=@classes.headerContent\n )\n actionsClass=(this.classes.headerActions\n class=@classes.headerActions\n )\n closeButton=(if\n this.showCloseButton\n (component\n CloseButton\n onPress=@onClose\n size=this.closeButtonSize\n class=(this.classes.headerCloseButton\n class=@classes.headerCloseButton\n )\n )\n )\n )\n Body=(component\n DrawerBody\n placement=this.placement\n classFromParent=(this.classes.body class=@classes.body)\n )\n Footer=(component\n DrawerFooter\n placement=this.placement\n classFromParent=(this.classes.footer class=@classes.footer)\n )\n headerId=this.headerId\n )\n }}\n </div>\n </Overlay>\n </template>\n}\n"],"names":["Drawer","Component","headerId","guidFor","renderedHeaders","g","prototype","tracked","i","registerHeader","isRendered","isDestroying","isDestroyed","hasHeader","labelledById","undefined","warnIfUnnamed","modifier","element","warnIfDialogHasNoAccessibleName","ariaModal","args","disableFocusTrap","preventClosing","allowClosing","showCloseButton","allowCloseButton","showStandaloneCloseButton","closeButtonSize","placement","appearance","isVerticalPlacement","allowDragToClose","dragAxis","dragDirection","handleDragDismiss","onClose","classes","drawer","useStyles","size","hasCloseButton","transition","options","name","setComponentTemplate","precompileTemplate","strictMode","scope","Overlay","dragToDismiss","DRAWER_DRAG_HANDLE_SELECTOR","DRAWER_BODY_SELECTOR","DrawerDragHandle","CloseButton","hash","DrawerHeader","DrawerBody","DrawerFooter"],"mappings":";;;;;;;;;;;;;;;;;;;AA8Je,MAAMA,eAAeC,SAAA,CAAU;AAC5CC,EAAAA,QAAA,GAAW,CAA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EAAC;AAC1E,EAAA;EAEAM,iBAAA,GAAoBA,MAAQ;AAC1B,IAAA,IAAI,CAACd,IAAI,CAACe,OAAO,IAAA;EACnB,CAAA;EAEA,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAQ,GAAGC,SAAA,EAAA;AAEnB,IAAA,OAAOD,MAAA,CAAO;MACZT,SAAA,EAAW,IAAI,CAACA,SAAS;AACzBW,MAAAA,IAAA,EAAM,IAAI,CAACnB,IAAI,CAACmB,IAAI,IAAI,IAAA;MACxBV,UAAA,EAAY,IAAI,CAACA,UAAU;MAC3BW,cAAA,EAAgB,IAAI,CAAChB;AACvB,KAAA,CAAA;AACF,EAAA;EACA,IAAIiB,UAAAA,GAAa;AACf,IAAA,IAAIC,OAAkC,GAAgB;AACpDC,MAAAA,IAAA,EAAM,CAAA,+BAAA,EAAkC,IAAI,CAACf,SAAS,CAAA;KACxD;IAEA,IAAI,OAAO,IAAI,CAACR,IAAI,CAACqB,UAAU,KAAK,QAAA,EAAU;MAC5C,OAAO;AAAE,QAAA,GAAGC,OAAO;QAAE,GAAG,IAAI,CAACtB,IAAI,CAACqB;OAAW;AAC/C,IAAA;AAEA,IAAA,OAAOC,OAAA;AACT,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,2nFAAA,EA+GA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,OAAA;QAAAC,aAAA;QAAAC,2BAAA;QAAAC,oBAAA;QAAAC,gBAAA;QAAAC,WAAA;QAAAC,IAAA;QAAAC,YAAA;QAAAC,UAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"drawer.js","sources":["../../../src/components/overlays/drawer.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport { modifier } from 'ember-modifier';\nimport { warnIfDialogHasNoAccessibleName } from '../../-private/dialog';\nimport Overlay, { type OverlaySignature } from './overlay';\nimport DrawerBody, { type DrawerBodySignature } from './drawer/body';\nimport DrawerFooter, { type DrawerFooterSignature } from './drawer/footer';\nimport DrawerHeader, { type DrawerHeaderSignature } from './drawer/header';\nimport DrawerDragHandle from './drawer/drag-handle';\nimport {\n DRAWER_BODY_SELECTOR,\n DRAWER_DRAG_HANDLE_SELECTOR\n} from './drawer/selectors';\nimport dragToDismiss, {\n type DragAxis,\n type DragDirection\n} from '../../modifiers/drag-to-dismiss';\nimport {\n CloseButton,\n type CloseButtonSignature\n} from '../buttons/close-button';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\nimport {\n useStyles,\n type SlotsToClasses,\n type DrawerSlots,\n type DrawerVariants\n} from '@frontile/theme';\n\nexport interface DrawerArgs extends Pick<\n OverlaySignature['Args'],\n | 'isOpen'\n | 'onOpen'\n | 'onClose'\n | 'didClose'\n | 'renderInPlace'\n | 'target'\n | 'transitionDuration'\n | 'backdrop'\n | 'disableTransitions'\n | 'animateOnMount'\n | 'disableFocusTrap'\n | 'focusTrapOptions'\n | 'closeOnOutsideClick'\n | 'closeOnEscapeKey'\n | 'backdropTransition'\n | 'preventAutoFocus'\n> {\n /**\n * The transition to be used in the Drawer.\n *\n * @defaultValue {name: 'overlay-transition--slide-from-[placement]'}\n */\n transition?: OverlaySignature['Args']['transition'];\n\n /**\n * If set to false, the close button will not be displayed,\n * closeOnOutsideClick will be set to false, and closeOnEscapeKey will also be set\n * to false.\n *\n * @defaultValue true\n */\n allowClosing?: boolean;\n\n /**\n * If set to false, the close button will not be displayed.\n *\n * @defaultValue true\n */\n allowCloseButton?: boolean;\n\n /**\n * The Close Button size.\n *\n * @defaultValue 'lg'\n */\n closeButtonSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n /**\n * The Drawer can appear from any side of the screen. The 'placement'\n * option allows to choose where it appears from.\n *\n * @defaultValue 'right'\n */\n placement?: DrawerVariants['placement'];\n\n /**\n * The Drawer size.\n *\n * @defaultValue 'md'\n */\n size?: DrawerVariants['size'];\n\n /**\n * The Drawer visual variant.\n *\n * `sectioned` gives the drawer a black header band, a distinct body surface and\n * a solid footer. `flat` keeps every region on the modal surface.\n *\n * @defaultValue 'sectioned'\n */\n variant?: DrawerVariants['variant'];\n\n /**\n * Enables the drag-to-close gesture and its grab handle.\n *\n * Omit it and the gesture is on for `top` and `bottom` placements and off for\n * `left` and `right`. Pass `true` to opt a side drawer in, or `false` to turn\n * it off entirely. Always off when `allowClosing` is `false`.\n *\n * @defaultValue true for `top`/`bottom`, false for `left`/`right`\n */\n allowDragToClose?: boolean;\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<DrawerSlots>;\n}\n\nexport interface DrawerSignature {\n Args: DrawerArgs;\n Blocks: {\n default: [\n {\n CloseButton: WithBoundArgs<\n ComponentLike<CloseButtonSignature>,\n 'onPress' | 'class'\n >;\n Header: WithBoundArgs<\n ComponentLike<DrawerHeaderSignature>,\n | 'labelledById'\n | 'classFromParent'\n | 'registerSelf'\n | 'iconClass'\n | 'titleClass'\n | 'descriptionClass'\n | 'contentClass'\n | 'actionsClass'\n | 'closeButton'\n >;\n Body: WithBoundArgs<\n ComponentLike<DrawerBodySignature>,\n 'classFromParent'\n >;\n Footer: WithBoundArgs<\n ComponentLike<DrawerFooterSignature>,\n 'classFromParent'\n >;\n headerId: string;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class Drawer extends Component<DrawerSignature> {\n headerId = `${guidFor(this)}-header`;\n\n // `aria-labelledby` is only useful if it points at an element that actually\n // exists — a dangling reference leaves the dialog with no accessible name at\n // all. The yielded `Header` reports when it is rendered and when it goes\n // away, which keeps the reference correct even for a conditional header.\n // The count itself is deliberately untracked: registration happens while the\n // header's modifier is installing, and reading a tracked value there before\n // writing it trips Glimmer's backtracking assertion. Only the derived flag is\n // tracked, and it is always written, never read, from the callback.\n //\n // The `ref` utility looks like it should replace all of this, and it was\n // tried. It cannot: `Ref.setup` clears `current` unconditionally on teardown,\n // so it answers \"what is the current element?\" where this needs \"does any\n // header exist?\" — and those diverge when a header is *replaced* rather than\n // added or removed. Glimmer installs the modifiers of newly rendered elements\n // before tearing down the ones they replace (see the comments in\n // `utils/listManager.ts`), so with a `ref` a header swapped between the\n // branches of an `{{#if}}` leaves `current` undefined and the dialog silently\n // loses its accessible name. A `+1/-1` count is order-independent, which is\n // the whole point of it being a count.\n renderedHeaders = 0;\n @tracked hasHeader = false;\n\n registerHeader = (isRendered: boolean): void => {\n if (this.isDestroying || this.isDestroyed) {\n return;\n }\n\n this.renderedHeaders += isRendered ? 1 : -1;\n this.hasHeader = this.renderedHeaders > 0;\n };\n\n get labelledById(): string | undefined {\n return this.hasHeader ? this.headerId : undefined;\n }\n\n // What makes reading `hasHeader` here safe is *when* modifiers run, not in\n // what order: modifier install happens after the render transaction has\n // closed, so the template has already consumed `hasHeader` (through\n // `labelledById`) before any modifier hook fires. The header's write during\n // its own install therefore cannot invalidate a value still being rendered,\n // which is what would trip Glimmer's backtracking assertion.\n //\n // Whether the header's registration precedes this modifier is a separate,\n // unspecified Glimmer implementation detail. All it decides is whether this\n // first-render check already sees a registered header; if that order ever\n // inverted, the failure mode is a spurious development warning on a dialog\n // that does have a `Header` — not a broken render.\n //\n // Consumer-supplied names come through `...attributes`, which we cannot see\n // in args, hence inspecting the element itself.\n warnIfUnnamed = modifier((element: HTMLElement) => {\n warnIfDialogHasNoAccessibleName(element, this.hasHeader, 'drawer');\n });\n\n /**\n * `aria-modal=\"true\"` promises assistive technology that the rest of the page\n * is unreachable while this dialog is open. That promise only holds while the\n * overlay's focus trap is active, so when the consumer turns the trap off we\n * omit the attribute rather than lie about it — screen readers then keep\n * exposing the page behind, which is what actually happens.\n */\n get ariaModal(): 'true' | undefined {\n return this.args.disableFocusTrap === true ? undefined : 'true';\n }\n\n get preventClosing(): boolean {\n return this.args.allowClosing === false;\n }\n\n get showCloseButton(): boolean {\n return (\n this.args.allowClosing !== false && this.args.allowCloseButton !== false\n );\n }\n\n // When a header is rendered, the close button lives inside it (see\n // `DrawerHeader`'s `@closeButton` arg below) so it can be centred against\n // the header's actual height. The standalone, absolutely-positioned close\n // button is only needed as a fallback for drawers with no header at all --\n // rendering both at once would show two close buttons.\n get showStandaloneCloseButton(): boolean {\n return this.showCloseButton && !this.hasHeader;\n }\n\n get closeButtonSize(): NonNullable<DrawerArgs['closeButtonSize']> {\n return this.args.closeButtonSize || 'lg';\n }\n\n get placement() {\n return this.args.placement || 'right';\n }\n\n get variant(): NonNullable<DrawerVariants['variant']> {\n return this.args.variant || 'sectioned';\n }\n\n get isVerticalPlacement(): boolean {\n return this.placement === 'top' || this.placement === 'bottom';\n }\n\n get allowDragToClose(): boolean {\n if (this.args.allowClosing === false) {\n return false;\n }\n\n if (typeof this.args.allowDragToClose === 'boolean') {\n return this.args.allowDragToClose;\n }\n\n return this.isVerticalPlacement;\n }\n\n get dragAxis(): DragAxis {\n return this.isVerticalPlacement ? 'y' : 'x';\n }\n\n // The drawer is dismissed by pushing it back toward the edge it came from:\n // a bottom drawer moves down (+y), a top drawer up (-y).\n get dragDirection(): DragDirection {\n return this.placement === 'bottom' || this.placement === 'right' ? 1 : -1;\n }\n\n handleDragDismiss = (): void => {\n this.args.onClose?.();\n };\n\n get classes() {\n const { drawer } = useStyles();\n\n return drawer({\n placement: this.placement,\n size: this.args.size || 'md',\n variant: this.variant,\n hasCloseButton: this.showCloseButton\n });\n }\n get transition() {\n let options: OverlaySignature['Args']['transition'] = {\n name: `overlay-transition--slide-from-${this.placement}`\n };\n\n if (typeof this.args.transition === 'object') {\n return { ...options, ...this.args.transition };\n }\n\n return options;\n }\n\n <template>\n <Overlay\n @isOpen={{@isOpen}}\n @onClose={{@onClose}}\n @onOpen={{@onOpen}}\n @didClose={{@didClose}}\n @renderInPlace={{@renderInPlace}}\n @target={{@target}}\n @transitionDuration={{@transitionDuration}}\n @backdrop={{@backdrop}}\n @disableTransitions={{@disableTransitions}}\n @animateOnMount={{@animateOnMount}}\n @disableFocusTrap={{@disableFocusTrap}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{if this.preventClosing false @closeOnOutsideClick}}\n @closeOnEscapeKey={{if this.preventClosing false @closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @transition={{this.transition}}\n @closeOnOverlayElementClick={{true}}\n @preventAutoFocus={{@preventAutoFocus}}\n >\n <div\n data-component=\"drawer\"\n data-part=\"base\"\n class={{this.classes.base class=@classes.base}}\n tabindex=\"0\"\n role=\"dialog\"\n aria-modal={{this.ariaModal}}\n aria-labelledby={{this.labelledById}}\n {{dragToDismiss\n axis=this.dragAxis\n direction=this.dragDirection\n isEnabled=this.allowDragToClose\n onDismiss=this.handleDragDismiss\n handleSelector=DRAWER_DRAG_HANDLE_SELECTOR\n scrollSelector=DRAWER_BODY_SELECTOR\n }}\n {{this.warnIfUnnamed}}\n ...attributes\n >\n {{#if this.allowDragToClose}}\n <DrawerDragHandle\n data-part=\"drag-handle\"\n @onPress={{@onClose}}\n @class={{this.classes.dragHandle class=@classes.dragHandle}}\n @barClass={{this.classes.dragHandleBar\n class=@classes.dragHandleBar\n }}\n />\n {{/if}}\n\n {{#if this.showStandaloneCloseButton}}\n <CloseButton\n data-part=\"close-button\"\n @onPress={{@onClose}}\n @size={{this.closeButtonSize}}\n @class={{this.classes.closeButton class=@classes.closeButton}}\n />\n {{/if}}\n\n {{yield\n (hash\n CloseButton=(component\n CloseButton\n onPress=@onClose\n size=this.closeButtonSize\n class=(this.classes.closeButton class=@classes.closeButton)\n )\n Header=(component\n DrawerHeader\n labelledById=this.headerId\n registerSelf=this.registerHeader\n classFromParent=(this.classes.header class=@classes.header)\n iconClass=(this.classes.icon class=@classes.icon)\n titleClass=(this.classes.title class=@classes.title)\n descriptionClass=(this.classes.description\n class=@classes.description\n )\n contentClass=(this.classes.headerContent\n class=@classes.headerContent\n )\n actionsClass=(this.classes.headerActions\n class=@classes.headerActions\n )\n closeButton=(if\n this.showCloseButton\n (component\n CloseButton\n onPress=@onClose\n size=this.closeButtonSize\n class=(this.classes.headerCloseButton\n class=@classes.headerCloseButton\n )\n )\n )\n )\n Body=(component\n DrawerBody\n placement=this.placement\n classFromParent=(this.classes.body class=@classes.body)\n )\n Footer=(component\n DrawerFooter\n placement=this.placement\n classFromParent=(this.classes.footer class=@classes.footer)\n )\n headerId=this.headerId\n )\n }}\n </div>\n </Overlay>\n </template>\n}\n"],"names":["Drawer","Component","headerId","guidFor","renderedHeaders","g","prototype","tracked","i","registerHeader","isRendered","isDestroying","isDestroyed","hasHeader","labelledById","undefined","warnIfUnnamed","modifier","element","warnIfDialogHasNoAccessibleName","ariaModal","args","disableFocusTrap","preventClosing","allowClosing","showCloseButton","allowCloseButton","showStandaloneCloseButton","closeButtonSize","placement","variant","isVerticalPlacement","allowDragToClose","dragAxis","dragDirection","handleDragDismiss","onClose","classes","drawer","useStyles","size","hasCloseButton","transition","options","name","setComponentTemplate","precompileTemplate","strictMode","scope","Overlay","dragToDismiss","DRAWER_DRAG_HANDLE_SELECTOR","DRAWER_BODY_SELECTOR","DrawerDragHandle","CloseButton","hash","DrawerHeader","DrawerBody","DrawerFooter"],"mappings":";;;;;;;;;;;;;;;;;;;AA8Je,MAAMA,eAAeC,SAAA,CAAU;AAC5CC,EAAAA,QAAA,GAAW,CAAA,EAAGC,OAAA,CAAQ,IAAI,CAAA,CAAA,OAAA,CAAU;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAC,EAAAA,eAAA,GAAkB,CAAA;AAAE,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CACnBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CA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AAA;MACxBV,OAAA,EAAS,IAAI,CAACA,OAAO;MACrBW,cAAA,EAAgB,IAAI,CAAChB;AACvB,KAAA,CAAA;AACF,EAAA;EACA,IAAIiB,UAAAA,GAAa;AACf,IAAA,IAAIC,OAAkC,GAAgB;AACpDC,MAAAA,IAAA,EAAM,CAAA,+BAAA,EAAkC,IAAI,CAACf,SAAS,CAAA;KACxD;IAEA,IAAI,OAAO,IAAI,CAACR,IAAI,CAACqB,UAAU,KAAK,QAAA,EAAU;MAC5C,OAAO;AAAE,QAAA,GAAGC,OAAO;QAAE,GAAG,IAAI,CAACtB,IAAI,CAACqB;OAAW;AAC/C,IAAA;AAEA,IAAA,OAAOC,OAAA;AACT,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,2nFAAA,EA+GA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,OAAA;QAAAC,aAAA;QAAAC,2BAAA;QAAAC,oBAAA;QAAAC,gBAAA;QAAAC,WAAA;QAAAC,IAAA;QAAAC,YAAA;QAAAC,UAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../../src/components/overlays/popover.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Overlay, type OverlaySignature } from './overlay';\nimport { tracked, cached } from '@glimmer/tracking';\nimport { Velcro } from 'ember-velcro';\nimport { arrow as arrowMiddleware } from '@floating-ui/dom';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport { modifier } from 'ember-modifier';\nimport { debounce, later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport type { ModifierLike } from '@glint/template';\nimport type { WithBoundArgs } from '@glint/template';\nimport type { Signature as VelcroSignature } from 'ember-velcro/modifiers/velcro';\nimport type { MiddlewareArguments } from '@floating-ui/dom';\n\ninterface PopoverSignature {\n Args: {\n /**\n * Placement of the menu when open\n *\n * @defaultValue 'bottom-start'\n */\n placement?:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\n /**\n * Options for the floating-ui flip middleware, which moves the content to\n * the opposite side when it would overflow the viewport.\n */\n flipOptions?: VelcroSignature['Args']['Named']['flipOptions'];\n\n /**\n * Additional floating-ui middleware, for positioning behavior beyond what\n * `placement`, `offsetOptions`, `flipOptions`, and `shiftOptions` cover.\n */\n middleware?: VelcroSignature['Args']['Named']['middleware'];\n\n /**\n * Options for the floating-ui shift middleware, which nudges the content\n * along its axis to keep it in view.\n */\n shiftOptions?: VelcroSignature['Args']['Named']['shiftOptions'];\n\n /**\n * @defaultValue 5\n */\n offsetOptions?: VelcroSignature['Args']['Named']['offsetOptions'];\n\n /**\n * @defaultValue 'absolute'\n */\n strategy?: VelcroSignature['Args']['Named']['strategy'];\n\n /**\n * Whether the popover is open. Pair with `onOpenChange` to control it;\n * leave it unset to let the popover manage its own state.\n */\n isOpen?: boolean;\n\n /**\n * Callback when the popover opens or closes, receiving the new state.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Callback when closing has finished, including any exit transition.\n */\n didClose?: () => void;\n\n /**\n * Milliseconds to wait before opening on hover or keyboard focus. Only\n * applies to a `trigger` installed in hover mode.\n *\n * @defaultValue 100\n */\n openDelay?: number;\n\n /**\n * Milliseconds to wait before closing after the pointer leaves the trigger\n * or the content. Only applies to a `trigger` installed in hover mode.\n *\n * This is also the window the pointer has to cross the gap between the\n * trigger and the content, so setting it to 0 makes content hover\n * unreachable in practice.\n *\n * @defaultValue 100\n */\n closeDelay?: number;\n };\n Element: HTMLUListElement;\n Blocks: {\n default: [\n {\n anchor: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Nominates the element it is placed on as the width reference for\n * `@size=\"trigger\"` content, instead of the element carrying `trigger`.\n */\n measureWidth: ModifierLike<{ Element: HTMLElement }>;\n isOpen: boolean;\n toggle: () => void;\n open: () => void;\n close: () => void;\n trigger: ModifierLike<{\n Element: HTMLElement;\n Args: {\n Positional: [eventType?: 'click' | 'hover'];\n Named: { aria?: 'menu' | 'describedby' | 'none' };\n };\n }>;\n\n /**\n * The floating-ui middleware data for the current position, including\n * the placement actually resolved after `flip`.\n */\n data: MiddlewareArguments;\n Content: WithBoundArgs<\n typeof Content,\n | 'loop'\n | 'isOpen'\n | 'id'\n | 'toggle'\n | 'internalDidClose'\n | 'blockScroll'\n | 'backdrop'\n | 'triggerWidth'\n | 'preventAutoFocus'\n | 'isHoverTrigger'\n | 'onContentHoverStart'\n | 'onContentHoverEnd'\n | 'registerArrow'\n | 'velcroData'\n >;\n }\n ];\n };\n}\n\nclass Popover extends Component<PopoverSignature> {\n /**\n * The element `measureWidth` is watching, when a consumer opts into measuring\n * something other than the trigger. Its presence is what gives `measureWidth`\n * precedence over `trigger` as the source of `triggerWidth`.\n */\n widthEl?: HTMLElement;\n\n menuId = guidFor(this);\n\n /**\n * Whether the consumer is still owed a `@didClose`. Set by `close()` when a\n * popover that was actually open was closed, and cleared either by `didClose`\n * once it has fired the callback -- so it can only ever fire once per close --\n * or by `open()`, which means the close it was armed for never completed.\n */\n isDidClosePending = false;\n\n @tracked _isOpen = false;\n @tracked isClosing = false;\n @tracked preventFocusRestore = false;\n\n /**\n * Whether a `trigger` is installed in hover mode. Hover popovers must not\n * take focus -- `Overlay` focuses its content when the focus trap is\n * disabled, which for a hover popover means the pointer silently moves focus\n * and scrolls the content into view.\n */\n @tracked isHoverTrigger = false;\n @tracked triggerWidth?: number;\n\n /**\n * The arrow element, once `Content` has rendered one. Tracked because the\n * middleware array is derived from it -- `Velcro` re-runs when the array\n * identity changes, so the arrow is picked up whenever it appears, in either\n * render order.\n */\n @tracked arrowEl?: HTMLElement;\n\n registerArrow = modifier((el: HTMLElement) => {\n this.arrowEl = el;\n\n return () => {\n if (this.arrowEl === el) {\n this.arrowEl = undefined;\n }\n };\n });\n\n /**\n * `@cached` is load-bearing, not decorative: without it this getter would\n * build a brand-new array (and a brand-new `arrowMiddleware(...)` instance)\n * on every access. `{{this.middleware}}` sits in the same template block\n * that yields `velcro.data`, so a `Velcro`-driven position update re-renders\n * that block, which re-invokes the getter -- an unmemoized array would read\n * to `Velcro` as changed middleware and retrigger positioning, looping\n * forever. Caching keeps the array's identity stable across re-renders that\n * don't touch `this.args.middleware` or `this.arrowEl`, while still\n * producing a new array when either of those tracked dependencies changes\n * (e.g. when the arrow element first appears).\n */\n @cached\n get middleware(): VelcroSignature['Args']['Named']['middleware'] {\n const consumer = this.args.middleware ?? [];\n\n if (!this.arrowEl) {\n return this.args.middleware;\n }\n\n // `padding` keeps the arrow off the content's rounded corners, where it\n // would poke out past the radius.\n return [\n ...consumer,\n arrowMiddleware({ element: this.arrowEl, padding: 4 })\n ];\n }\n\n get isOpen(): boolean {\n if (\n typeof this.args.isOpen !== 'undefined' &&\n typeof this.args.onOpenChange === 'function'\n ) {\n return this.args.isOpen;\n }\n\n return this._isOpen;\n }\n\n toggle = (event?: Event) => {\n // stops event bubbling to prevent parent click event\n if (typeof event?.stopPropagation === 'function') {\n event.stopPropagation();\n }\n\n if (this.isOpen) {\n this.close();\n } else {\n this.open();\n }\n };\n\n open = () => {\n if (this.isClosing) {\n return;\n }\n\n // Opening settles any close that never finished. In controlled mode\n // `close()` only *asks* -- it calls `onOpenChange(false)` and the consumer\n // decides -- so a consumer that declines leaves the content mounted with\n // the callback still owed. Nothing clears that but `didClose`, which never\n // runs while the content stays up, so without this the debt would sit armed\n // and be paid out by whatever unrelated teardown came next.\n this.isDidClosePending = false;\n\n if (typeof this.args.onOpenChange === 'function') {\n this.args.onOpenChange(true);\n } else {\n this._isOpen = true;\n }\n };\n\n close = () => {\n // Only a popover that was actually open has a close to finish, and so a\n // `@didClose` to owe. `close()` is reachable with nothing open -- a stray\n // `mouseleave`, a consumer calling the yielded `close` -- and firing the\n // callback for those would be a lie.\n const wasOpen = this.isOpen;\n\n this.isClosing = true;\n if (typeof this.args.onOpenChange === 'function') {\n this.args.onOpenChange(false);\n } else {\n this._isOpen = false;\n }\n\n if (wasOpen) {\n this.isDidClosePending = true;\n }\n\n debounce(this, this.resetIsClosing, 90);\n };\n\n /**\n * The single pending hover intent, or `undefined`. One field rather than two\n * debounces: `debounce` keys on the target/method pair, so debouncing\n * `open` from `mouseenter` and `close` from `mouseleave` left the two unable\n * to cancel each other -- a leave-then-re-enter inside the window queued\n * both, and the close won.\n *\n * Scheduled with `@ember/runloop`'s `later`/`cancel`, like the rest of this\n * codebase (`-private/timer.ts`, `control-blur.ts`, `-private/manager.ts`,\n * `utils/listManager.ts`, `resetIsClosing` below), rather than a raw\n * `setTimeout`/`clearTimeout`. Run-loop tracking is what makes `settled()`\n * -- and so `await triggerEvent(...)`/`await click(...)` in\n * `@ember/test-helpers` -- wait out a pending hover open or close, the same\n * way every other timed transition in this component already does. Tests\n * that need to prove a pending close gets cancelled by a second event\n * (e.g. the pointer arriving on the content) dispatch the raw DOM events\n * directly and `await settled()` once afterward, instead of relying on\n * `await triggerEvent(...)`'s auto-wait -- see the \"hover: leaving and\n * re-entering\" tests below.\n */\n hoverTimer?: { id: EmberTimer; intent: 'open' | 'close' };\n\n get openDelay(): number {\n return typeof this.args.openDelay === 'number' ? this.args.openDelay : 100;\n }\n\n get closeDelay(): number {\n return typeof this.args.closeDelay === 'number'\n ? this.args.closeDelay\n : 100;\n }\n\n clearHoverTimer = () => {\n if (this.hoverTimer) {\n cancel(this.hoverTimer.id);\n this.hoverTimer = undefined;\n }\n };\n\n scheduleOpen = () => {\n this.clearHoverTimer();\n\n if (this.isOpen) {\n return;\n }\n\n const run = () => {\n this.hoverTimer = undefined;\n if (this.isDestroyed || this.isDestroying) return;\n // A hover open is never part of the click cascade `isClosing` guards\n // against, so it must not be gated by it -- that gate is what swallowed\n // opens on an adjacent trigger.\n this.isClosing = false;\n this.open();\n };\n\n if (this.openDelay === 0) {\n run();\n return;\n }\n\n this.hoverTimer = { id: later(run, this.openDelay), intent: 'open' };\n };\n\n scheduleClose = () => {\n this.clearHoverTimer();\n\n if (!this.isOpen) {\n return;\n }\n\n const run = () => {\n this.hoverTimer = undefined;\n if (this.isDestroyed || this.isDestroying) return;\n this.close();\n };\n\n if (this.closeDelay === 0) {\n run();\n return;\n }\n\n this.hoverTimer = { id: later(run, this.closeDelay), intent: 'close' };\n };\n\n /**\n * `Escape` must close a hover popover (WCAG 1.4.13), but in hover mode focus\n * is typically nowhere near the trigger, so a trigger-level `keydown` would\n * never see the key. Installed on the document while open in hover mode.\n */\n escapeListener?: (event: KeyboardEvent) => void;\n\n setupEscapeListener = () => {\n if (this.escapeListener) return;\n\n this.escapeListener = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && this.isOpen) {\n this.clearHoverTimer();\n this.close();\n }\n };\n\n document.addEventListener('keydown', this.escapeListener);\n };\n\n teardownEscapeListener = () => {\n if (this.escapeListener) {\n document.removeEventListener('keydown', this.escapeListener);\n this.escapeListener = undefined;\n }\n };\n\n willDestroy(): void {\n super.willDestroy();\n this.clearHoverTimer();\n this.teardownEscapeListener();\n }\n\n trigger = modifier(\n (\n el: HTMLElement,\n [eventType]: [eventType?: 'click' | 'hover'],\n { aria }: { aria?: 'menu' | 'describedby' | 'none' } = {}\n ) => {\n // The trigger is only the width reference when nothing more specific was\n // nominated. `widthEl` is checked when the measurement happens rather than\n // when the modifier installs, so the two modifiers can install in either\n // order.\n requestAnimationFrame(() => {\n if (!this.widthEl) {\n this.triggerWidth = Math.round(el.offsetWidth);\n }\n });\n\n let observer: ResizeObserver;\n if (eventType !== 'hover') {\n observer = new ResizeObserver((entries) => {\n for (let entry of entries) {\n if (this.widthEl) {\n continue;\n }\n this.triggerWidth = Math.round(\n (entry.target as HTMLElement).offsetWidth\n );\n }\n });\n observer.observe(el);\n }\n\n const onFocusIn = () => {\n if (el.matches(':focus-visible')) {\n this.scheduleOpen();\n }\n };\n\n const onKeydown = (event: KeyboardEvent) => {\n if (this.isOpen && event.key === 'Escape') {\n this.close();\n event.stopPropagation();\n }\n if (\n !this.isOpen &&\n (event.key === 'ArrowDown' || event.key === 'ArrowUp')\n ) {\n this.open();\n event.stopPropagation();\n }\n\n if (this.isOpen && event.key === 'Tab') {\n this.preventFocusRestore = true;\n this.close();\n }\n\n // Open when a letter is pressed, so the content can be typed into.\n // Modifier combos belong to the browser or the OS (Cmd+R, Ctrl+F,\n // Alt+C) and still deliver a letter `key`, so without this check the\n // popover would pop open over whatever the shortcut does. Shift stays\n // allowed: a capital letter is legitimate type-ahead.\n if (\n !this.isOpen &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey &&\n event.code === `Key${event.key.toUpperCase()}`\n ) {\n this.open();\n }\n };\n\n if (eventType === 'hover') {\n this.preventFocusRestore = true;\n this.isHoverTrigger = true;\n // The modifier body re-runs on every open/close (it reads\n // `this.isOpen` below to keep whichever ARIA attribute the trigger's\n // `aria` mode owns in sync -- `aria-expanded` in `'menu'` mode,\n // `aria-describedby` in `'describedby'` mode), and the returned\n // cleanup below always tears the listener down first -- so gating\n // the install on `isOpen` here is what keeps the document listener\n // attached only while open, matching the doc comment on\n // `escapeListener`.\n if (this.isOpen) {\n this.setupEscapeListener();\n }\n\n el.addEventListener('mouseenter', this.scheduleOpen);\n el.addEventListener('mouseleave', this.scheduleClose);\n // Keyboard-only: a mouse click also fires `focusin`, and opening on\n // that would leave content up after the pointer had already left.\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', this.scheduleClose);\n } else {\n el.addEventListener('keydown', onKeydown);\n el.addEventListener('click', this.toggle);\n }\n\n // Reading `this.isOpen` here is what keeps these attributes in sync: the\n // modifier consumes the tracked state, so its whole body re-runs on every\n // open and close. That is more work than an attribute needs -- the\n // listeners are rebuilt too -- but it is the only mechanism that covers\n // `@isOpen` being flipped from outside in controlled mode, which an\n // imperative update from `open()`/`close()` would miss.\n const ariaMode = aria ?? 'menu';\n\n if (ariaMode === 'menu') {\n el.setAttribute('aria-haspopup', 'true');\n el.setAttribute('aria-controls', this.menuId);\n el.setAttribute('aria-expanded', this.isOpen.toString());\n } else if (ariaMode === 'describedby') {\n // A tooltip is its trigger's description, not a popup it owns. The\n // attribute only exists while there is something to describe --\n // pointing at an unrendered id is worse than pointing at nothing.\n if (this.isOpen) {\n el.setAttribute('aria-describedby', this.menuId);\n } else {\n el.removeAttribute('aria-describedby');\n }\n }\n\n return () => {\n if (eventType === 'hover') {\n this.isHoverTrigger = false;\n this.clearHoverTimer();\n this.teardownEscapeListener();\n el.removeEventListener('mouseenter', this.scheduleOpen);\n el.removeEventListener('mouseleave', this.scheduleClose);\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', this.scheduleClose);\n } else {\n el.removeEventListener('click', this.toggle);\n el.removeEventListener('keydown', onKeydown);\n }\n if (observer) {\n observer.disconnect();\n }\n };\n }\n );\n\n /**\n * Nominates the element it is placed on as the popover's width reference,\n * instead of the element carrying `trigger`.\n *\n * `@size=\"trigger\"` content is sized from `--trigger-width`, which is normally\n * the trigger's own width. That is only right while the toggle and the box the\n * content should line up with are the same element. When they are not -- a\n * field whose trigger is one of several things inside it, say -- put this on\n * the element the content should match.\n *\n * It takes precedence over `trigger`'s own measurement for as long as it is\n * installed, so the two never race.\n */\n measureWidth = modifier((el: HTMLElement) => {\n this.widthEl = el;\n\n requestAnimationFrame(() => {\n if (this.widthEl === el) {\n this.triggerWidth = Math.round(el.offsetWidth);\n }\n });\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (this.widthEl !== el) {\n continue;\n }\n this.triggerWidth = Math.round(\n (entry.target as HTMLElement).offsetWidth\n );\n }\n });\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n if (this.widthEl === el) {\n this.widthEl = undefined;\n }\n };\n });\n\n /**\n * Clears the short window during which `open()` refuses to re-open.\n *\n * The 90ms this is debounced by is deliberately unrelated to the transition\n * duration (the default `scale` transition runs 200ms in and 100ms out):\n * the window exists to absorb a single event cascade -- the Overlay's\n * outside-click handler closing while the trigger's own click handler is\n * about to re-open -- not to wait for the animation out. Stretching it to the\n * transition would leave the trigger feeling dead for a fifth of a second\n * after every close, which is far more noticeable than a re-click inside 90ms\n * being dropped.\n */\n resetIsClosing = () => {\n if (!this.isDestroyed && !this.isDestroying) {\n this.isClosing = false;\n }\n };\n\n /**\n * Passed to `Content` as `internalDidClose`, so it runs once the Overlay has\n * finished tearing down -- that is, after the exit transition. That is the\n * moment `@didClose` documents, which is why the consumer's callback is fired\n * from here and not from `close()`.\n *\n * A popover whose `Content` never mounted never gets here, and never owes the\n * callback: there was no overlay, so there was no close to finish.\n */\n didClose = () => {\n this.resetIsClosing();\n\n if (this.isDidClosePending) {\n this.isDidClosePending = false;\n\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n }\n };\n\n <template>\n <Velcro\n @placement={{if @placement @placement \"bottom-start\"}}\n @strategy={{if @strategy @strategy \"absolute\"}}\n @offsetOptions={{if @offsetOptions @offsetOptions 5}}\n @flipOptions={{@flipOptions}}\n @middleware={{this.middleware}}\n @shiftOptions={{@shiftOptions}}\n as |velcro|\n >\n {{yield\n (hash\n anchor=velcro.hook\n measureWidth=this.measureWidth\n isOpen=this.isOpen\n open=this.open\n close=this.close\n toggle=this.toggle\n trigger=this.trigger\n data=velcro.data\n Content=(component\n Content\n id=this.menuId\n loop=velcro.loop\n isOpen=this.isOpen\n toggle=this.toggle\n internalDidClose=this.didClose\n preventFocusRestore=this.preventFocusRestore\n preventAutoFocus=this.isHoverTrigger\n triggerWidth=this.triggerWidth\n isHoverTrigger=this.isHoverTrigger\n onContentHoverStart=this.clearHoverTimer\n onContentHoverEnd=this.scheduleClose\n registerArrow=this.registerArrow\n velcroData=velcro.data\n )\n )\n }}\n </Velcro>\n </template>\n}\n\ninterface ContentArgs extends Pick<\n OverlaySignature['Args'],\n | 'onOpen'\n | 'didClose'\n | 'renderInPlace'\n | 'target'\n | 'transitionDuration'\n | 'backdrop'\n | 'disableTransitions'\n | 'focusTrapOptions'\n | 'closeOnOutsideClick'\n | 'closeOnEscapeKey'\n | 'backdropTransition'\n | 'blockScroll'\n | 'preventAutoFocus'\n> {\n /**\n * @internal\n */\n loop: ModifierLike<{ Element: HTMLElement }>;\n /**\n * @internal\n */\n isOpen: boolean;\n\n /**\n * @internal\n */\n toggle: () => void;\n\n /**\n * @ignore\n */\n internalDidClose: () => void;\n\n /**\n * @internal\n */\n id: string;\n\n /**\n * @internal\n */\n preventFocusRestore?: boolean;\n\n /**\n * @internal\n */\n triggerWidth?: number;\n\n /**\n * @internal\n */\n isHoverTrigger?: boolean;\n\n /**\n * @internal\n */\n onContentHoverStart?: () => void;\n\n /**\n * @internal\n */\n onContentHoverEnd?: () => void;\n\n /**\n * Renders an arrow pointing at the anchor.\n *\n * @defaultValue false\n */\n arrow?: boolean;\n\n /**\n * @internal\n */\n registerArrow?: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * @internal\n * Additional classes for the arrow element, merged with `overlayArrow`'s\n * defaults via Tailwind Merge. Lets a consumer that composes `Content`\n * (e.g. `Tooltip`) give the arrow an intent-specific border; not meant as\n * public `Popover` API.\n */\n arrowClass?: string;\n\n /**\n * @internal\n */\n velcroData?: MiddlewareArguments;\n\n /**\n * Closes as soon as the pointer leaves the trigger, instead of letting it\n * move into the content. Only meaningful for a hover trigger.\n *\n * @defaultValue false\n */\n disableInteractive?: boolean;\n\n /**\n * Custom class name for the content element, merged with the default ones\n * using Tailwind Merge.\n */\n class?: string;\n\n /**\n * The transition to be used in the Modal.\n *\n * @defaultValue {name: 'overlay-transition--scale'}\n */\n transition?: OverlaySignature['Args']['transition'];\n\n /**\n * @defaultValue true\n */\n disableFocusTrap?: boolean;\n\n /**\n * The size of the content.\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'trigger';\n}\n\ninterface ContentSignature {\n Args: ContentArgs;\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\n/**\n * Component yielded from Popover\n */\nclass Content extends Component<ContentSignature> {\n get loop() {\n assert(\n 'The Popover is not properly configured; the @loop is undefined. This issue may arise from failing to set up the anchor.',\n this.args.loop\n );\n return this.args.loop;\n }\n\n get classNames() {\n const { popover } = useStyles();\n return popover({\n size: this.args.size,\n // Scoped to `@arrow`, not applied unconditionally: an unrelated\n // popover may rely on `overflow-auto` (the `overlay` tv base) to\n // scroll long content, and `@arrow` is new, so gating on it here\n // can't regress an existing popover. Without this, the arrow's\n // protruding half is clipped by that inherited `overflow-auto` --\n // see the `tooltip` theme base for the same fix, unconditional there\n // because a tooltip should never scroll.\n class: [this.args.arrow ? 'overflow-visible' : undefined, this.args.class]\n });\n }\n\n get backdrop(): OverlaySignature['Args']['backdrop'] {\n return this.args.backdrop || 'none';\n }\n\n get transition() {\n let options: OverlaySignature['Args']['transition'] = {\n name: 'overlay-transition--scale'\n };\n\n if (typeof this.args.transition === 'object') {\n return { ...options, ...this.args.transition };\n }\n\n return options;\n }\n\n get blockScroll() {\n if (typeof this.args.blockScroll !== 'undefined') {\n return this.args.blockScroll;\n }\n return false;\n }\n\n get disableFocusTrap() {\n if (this.args.disableFocusTrap === false) {\n return false;\n }\n return true;\n }\n\n didClose = () => {\n if (typeof this.args.internalDidClose === 'function') {\n this.args.internalDidClose();\n }\n\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n };\n\n updateTriggerWidth = modifier((el: HTMLDivElement) => {\n if (el && this.args.triggerWidth) {\n el.style.setProperty('--trigger-width', `${this.args.triggerWidth}px`);\n }\n });\n\n /**\n * `{{#if}}` cannot guard a modifier, so the decision lives inside it: when\n * the trigger is not in hover mode, or the consumer opted out, this installs\n * no listeners at all.\n *\n * Also tracks focus, not just the pointer: a keyboard user tabbing from the\n * trigger into a focusable element inside the content triggers the\n * trigger's own `focusout`, which unconditionally schedules a close. With\n * nothing here to cancel it, that close would fire out from under a\n * keyboard user after `closeDelay`, even though the pointer analogue --\n * moving onto the content -- keeps it open. `focusin`/`focusout` reuse the\n * same callbacks as `mouseenter`/`mouseleave` because they need to do\n * exactly the same thing: cancel or (re)schedule the one pending hover\n * intent.\n */\n trackContentHover = modifier((el: HTMLElement) => {\n if (\n this.args.isHoverTrigger !== true ||\n this.args.disableInteractive === true\n ) {\n return;\n }\n\n const enter = () => this.args.onContentHoverStart?.();\n const leave = () => this.args.onContentHoverEnd?.();\n\n el.addEventListener('mouseenter', enter);\n el.addEventListener('mouseleave', leave);\n el.addEventListener('focusin', enter);\n el.addEventListener('focusout', leave);\n\n return () => {\n el.removeEventListener('mouseenter', enter);\n el.removeEventListener('mouseleave', leave);\n el.removeEventListener('focusin', enter);\n el.removeEventListener('focusout', leave);\n };\n });\n\n get placement(): string | undefined {\n return this.args.velcroData?.placement;\n }\n\n get arrowClass(): string {\n const { overlayArrow } = useStyles();\n return overlayArrow({ class: this.args.arrowClass });\n }\n\n /**\n * Positions the arrow from the floating-ui `arrow` middleware: it supplies\n * the offset along the content's edge (`x` for a top/bottom placement, `y`\n * for left/right), and the side the arrow sits on is the one opposite the\n * resolved placement. Inline styles rather than classes -- the offset is a\n * computed pixel value that changes on every reposition.\n *\n * Also clears two of the arrow's four borders (`overlayArrow` draws all\n * four, since a rotated square has no \"outer edge\" of its own to target\n * with a class). Half the arrow sits inside the content box, half sits\n * outside pointing at the anchor; the half inside draws two border lines\n * straight across the content's fill, which reads as a stray diagonal\n * seam. Only the two edges meeting at the *outward* vertex (the one\n * pointing away from the box, at the anchor) should keep a border --\n * those are the visible \"point\" of the arrow against the page background.\n *\n * Worked out for a `rotate: 45deg` square with corners TL/TR/BR/BL: that\n * rotation carries TL to the top vertex, TR to the right vertex, BR to the\n * bottom vertex, and BL to the left vertex, so `border-top` (the TL-TR\n * edge) and `border-left` (the BL-TL edge) are the two edges meeting at\n * the *top* vertex, and so on around. Which vertex is \"outward\" depends on\n * `staticSide` (the box edge the arrow sits on): outward is the same\n * direction as `staticSide` itself (e.g. `top` placement puts the box\n * above the anchor, so the arrow sits on the box's own bottom edge and\n * points further down, toward the anchor -- the bottom vertex, made of\n * `border-right`+`border-bottom`, so the *top* vertex's\n * `border-top`+`border-left` are the ones to clear).\n */\n positionArrow = modifier((el: HTMLElement) => {\n const data = this.args.velcroData;\n const offset = data?.middlewareData?.arrow;\n const placement = data?.placement;\n\n if (!offset || !placement) {\n return;\n }\n\n const staticSides: Record<string, string> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left'\n };\n const side = placement.split('-')[0] as string;\n const staticSide = staticSides[side] ?? 'bottom';\n\n el.style.left = typeof offset.x === 'number' ? `${offset.x}px` : '';\n el.style.top = typeof offset.y === 'number' ? `${offset.y}px` : '';\n el.style.right = '';\n el.style.bottom = '';\n // Half the arrow's 8px box, so the rotated square straddles the edge.\n el.style[staticSide as 'top' | 'bottom' | 'left' | 'right'] = '-4px';\n\n type BorderWidthProp =\n | 'borderTopWidth'\n | 'borderRightWidth'\n | 'borderBottomWidth'\n | 'borderLeftWidth';\n\n // The two edges meeting at the *inward* vertex (the one poking into the\n // content box), keyed by `side` -- see the doc comment above for the\n // derivation.\n const innerBorders: Record<string, [BorderWidthProp, BorderWidthProp]> = {\n top: ['borderTopWidth', 'borderLeftWidth'],\n bottom: ['borderRightWidth', 'borderBottomWidth'],\n left: ['borderBottomWidth', 'borderLeftWidth'],\n right: ['borderTopWidth', 'borderRightWidth']\n };\n\n const allBorderProps: BorderWidthProp[] = [\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth'\n ];\n // Reset every side first: the resolved placement (and so `side`) can\n // change at runtime -- e.g. the flip middleware -- and a border cleared\n // for a previous placement must not stay cleared for the new one.\n for (const prop of allBorderProps) {\n el.style[prop] = '';\n }\n const toClear = innerBorders[side] ?? innerBorders['top'];\n for (const prop of toClear as [BorderWidthProp, BorderWidthProp]) {\n el.style[prop] = '0';\n }\n });\n\n <template>\n <Overlay\n @blockScroll={{this.blockScroll}}\n @transition={{this.transition}}\n @backdrop={{this.backdrop}}\n @customContentModifier={{this.loop}}\n @disableFlexContent={{true}}\n @isOpen={{@isOpen}}\n @onClose={{@toggle}}\n @onOpen={{@onOpen}}\n @didClose={{this.didClose}}\n @renderInPlace={{@renderInPlace}}\n @target={{@target}}\n @transitionDuration={{@transitionDuration}}\n @disableTransitions={{@disableTransitions}}\n @disableFocusTrap={{this.disableFocusTrap}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @class={{this.classNames}}\n @preventFocusRestore={{@preventFocusRestore}}\n @preventAutoFocus={{@preventAutoFocus}}\n @closeOnOverlayElementClick={{false}}\n id={{@id}}\n data-placement={{this.placement}}\n ...attributes\n {{this.updateTriggerWidth @triggerWidth}}\n {{this.trackContentHover @isHoverTrigger @disableInteractive}}\n >\n {{yield}}\n {{#if @arrow}}\n <span\n class={{this.arrowClass}}\n data-part=\"arrow\"\n {{@registerArrow}}\n {{! @velcroData is passed but never read by the modifier body: supplying\n it is what makes ember-modifier re-run this on every reposition.\n Remove the argument and the arrow positions once, then never moves. }}\n {{this.positionArrow @velcroData}}\n ></span>\n {{/if}}\n </Overlay>\n </template>\n}\n\nexport {\n Popover,\n Content as PopoverContent,\n type PopoverSignature,\n type ContentSignature\n};\nexport default Popover;\n"],"names":["Popover","Component","widthEl","menuId","guidFor","isDidClosePending","g","prototype","tracked","i","registerArrow","modifier","el","arrowEl","undefined","middleware","consumer","args","arrowMiddleware","element","padding","n","cached","isOpen","onOpenChange","_isOpen","toggle","event","stopPropagation","close","open","isClosing","wasOpen","debounce","resetIsClosing","hoverTimer","openDelay","closeDelay","clearHoverTimer","cancel","id","scheduleOpen","run","isDestroyed","isDestroying","later","intent","scheduleClose","escapeListener","setupEscapeListener","key","document","addEventListener","teardownEscapeListener","removeEventListener","willDestroy","trigger","eventType","aria","requestAnimationFrame","triggerWidth","Math","round","offsetWidth","observer","ResizeObserver","entries","entry","target","observe","onFocusIn","matches","onKeydown","preventFocusRestore","metaKey","ctrlKey","altKey","code","toUpperCase","isHoverTrigger","ariaMode","setAttribute","toString","removeAttribute","disconnect","measureWidth","didClose","setComponentTemplate","precompileTemplate","strictMode","scope","Velcro","hash","Content","loop","assert","classNames","popover","useStyles","size","class","arrow","backdrop","transition","options","name","blockScroll","disableFocusTrap","internalDidClose","updateTriggerWidth","style","setProperty","trackContentHover","disableInteractive","enter","onContentHoverStart","leave","onContentHoverEnd","placement","velcroData","arrowClass","overlayArrow","positionArrow","data","offset","middlewareData","staticSides","top","bottom","left","right","side","split","staticSide","x","y","innerBorders","allBorderProps","prop","toClear","Overlay"],"mappings":";;;;;;;;;;;;;;;AAwJA,MAAMA,gBAAgBC,SAAA,CAAU;AAC9B;;;;AAIC;EACDC;AAEAC,EAAAA,MAAA,GAASC,OAAA,CAAQ,IAAI,CAAA;AAErB;;;;;AAKC;AACDC,EAAAA,oBAAoB,KAAA;AAAM,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CAEzBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAkB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAClBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,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IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAkD,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../../src/components/overlays/popover.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Overlay, type OverlaySignature } from './overlay';\nimport { tracked, cached } from '@glimmer/tracking';\nimport { Velcro } from 'ember-velcro';\nimport { arrow as arrowMiddleware } from '@floating-ui/dom';\nimport { assert } from '@ember/debug';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport { modifier } from 'ember-modifier';\nimport { debounce, later, cancel } from '@ember/runloop';\nimport type { Timer as EmberTimer } from '@ember/runloop';\nimport type { ModifierLike } from '@glint/template';\nimport type { WithBoundArgs } from '@glint/template';\nimport type { Signature as VelcroSignature } from 'ember-velcro/modifiers/velcro';\nimport type { MiddlewareArguments } from '@floating-ui/dom';\n\ninterface PopoverSignature {\n Args: {\n /**\n * Placement of the menu when open\n *\n * @defaultValue 'bottom-start'\n */\n placement?:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\n /**\n * Options for the floating-ui flip middleware, which moves the content to\n * the opposite side when it would overflow the viewport.\n */\n flipOptions?: VelcroSignature['Args']['Named']['flipOptions'];\n\n /**\n * Additional floating-ui middleware, for positioning behavior beyond what\n * `placement`, `offsetOptions`, `flipOptions`, and `shiftOptions` cover.\n */\n middleware?: VelcroSignature['Args']['Named']['middleware'];\n\n /**\n * Options for the floating-ui shift middleware, which nudges the content\n * along its axis to keep it in view.\n */\n shiftOptions?: VelcroSignature['Args']['Named']['shiftOptions'];\n\n /**\n * @defaultValue 5\n */\n offsetOptions?: VelcroSignature['Args']['Named']['offsetOptions'];\n\n /**\n * @defaultValue 'absolute'\n */\n strategy?: VelcroSignature['Args']['Named']['strategy'];\n\n /**\n * Whether the popover is open. Pair with `onOpenChange` to control it;\n * leave it unset to let the popover manage its own state.\n */\n isOpen?: boolean;\n\n /**\n * Callback when the popover opens or closes, receiving the new state.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /**\n * Callback when closing has finished, including any exit transition.\n */\n didClose?: () => void;\n\n /**\n * Milliseconds to wait before opening on hover or keyboard focus. Only\n * applies to a `trigger` installed in hover mode.\n *\n * @defaultValue 100\n */\n openDelay?: number;\n\n /**\n * Milliseconds to wait before closing after the pointer leaves the trigger\n * or the content. Only applies to a `trigger` installed in hover mode.\n *\n * This is also the window the pointer has to cross the gap between the\n * trigger and the content, so setting it to 0 makes content hover\n * unreachable in practice.\n *\n * @defaultValue 100\n */\n closeDelay?: number;\n };\n Element: HTMLUListElement;\n Blocks: {\n default: [\n {\n anchor: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Nominates the element it is placed on as the width reference for\n * `@size=\"trigger\"` content, instead of the element carrying `trigger`.\n */\n measureWidth: ModifierLike<{ Element: HTMLElement }>;\n isOpen: boolean;\n toggle: () => void;\n open: () => void;\n close: () => void;\n trigger: ModifierLike<{\n Element: HTMLElement;\n Args: {\n Positional: [eventType?: 'click' | 'hover'];\n Named: { aria?: 'menu' | 'describedby' | 'none' };\n };\n }>;\n\n /**\n * The floating-ui middleware data for the current position, including\n * the placement actually resolved after `flip`.\n */\n data: MiddlewareArguments;\n Content: WithBoundArgs<\n typeof Content,\n | 'loop'\n | 'isOpen'\n | 'id'\n | 'toggle'\n | 'internalDidClose'\n | 'blockScroll'\n | 'backdrop'\n | 'triggerWidth'\n | 'preventAutoFocus'\n | 'isHoverTrigger'\n | 'onContentHoverStart'\n | 'onContentHoverEnd'\n | 'registerArrow'\n | 'velcroData'\n >;\n }\n ];\n };\n}\n\nclass Popover extends Component<PopoverSignature> {\n /**\n * The element `measureWidth` is watching, when a consumer opts into measuring\n * something other than the trigger. Its presence is what gives `measureWidth`\n * precedence over `trigger` as the source of `triggerWidth`.\n */\n widthEl?: HTMLElement;\n\n menuId = guidFor(this);\n\n /**\n * Whether the consumer is still owed a `@didClose`. Set by `close()` when a\n * popover that was actually open was closed, and cleared either by `didClose`\n * once it has fired the callback -- so it can only ever fire once per close --\n * or by `open()`, which means the close it was armed for never completed.\n */\n isDidClosePending = false;\n\n @tracked _isOpen = false;\n @tracked isClosing = false;\n @tracked preventFocusRestore = false;\n\n /**\n * Whether a `trigger` is installed in hover mode. Hover popovers must not\n * take focus -- `Overlay` focuses its content when the focus trap is\n * disabled, which for a hover popover means the pointer silently moves focus\n * and scrolls the content into view.\n */\n @tracked isHoverTrigger = false;\n @tracked triggerWidth?: number;\n\n /**\n * The arrow element, once `Content` has rendered one. Tracked because the\n * middleware array is derived from it -- `Velcro` re-runs when the array\n * identity changes, so the arrow is picked up whenever it appears, in either\n * render order.\n */\n @tracked arrowEl?: HTMLElement;\n\n registerArrow = modifier((el: HTMLElement) => {\n this.arrowEl = el;\n\n return () => {\n if (this.arrowEl === el) {\n this.arrowEl = undefined;\n }\n };\n });\n\n /**\n * `@cached` is load-bearing, not decorative: without it this getter would\n * build a brand-new array (and a brand-new `arrowMiddleware(...)` instance)\n * on every access. `{{this.middleware}}` sits in the same template block\n * that yields `velcro.data`, so a `Velcro`-driven position update re-renders\n * that block, which re-invokes the getter -- an unmemoized array would read\n * to `Velcro` as changed middleware and retrigger positioning, looping\n * forever. Caching keeps the array's identity stable across re-renders that\n * don't touch `this.args.middleware` or `this.arrowEl`, while still\n * producing a new array when either of those tracked dependencies changes\n * (e.g. when the arrow element first appears).\n */\n @cached\n get middleware(): VelcroSignature['Args']['Named']['middleware'] {\n const consumer = this.args.middleware ?? [];\n\n if (!this.arrowEl) {\n return this.args.middleware;\n }\n\n // `padding` keeps the arrow off the content's rounded corners, where it\n // would poke out past the radius.\n return [\n ...consumer,\n arrowMiddleware({ element: this.arrowEl, padding: 4 })\n ];\n }\n\n get isOpen(): boolean {\n if (\n typeof this.args.isOpen !== 'undefined' &&\n typeof this.args.onOpenChange === 'function'\n ) {\n return this.args.isOpen;\n }\n\n return this._isOpen;\n }\n\n toggle = (event?: Event) => {\n // stops event bubbling to prevent parent click event\n if (typeof event?.stopPropagation === 'function') {\n event.stopPropagation();\n }\n\n if (this.isOpen) {\n this.close();\n } else {\n this.open();\n }\n };\n\n open = () => {\n if (this.isClosing) {\n return;\n }\n\n // Opening settles any close that never finished. In controlled mode\n // `close()` only *asks* -- it calls `onOpenChange(false)` and the consumer\n // decides -- so a consumer that declines leaves the content mounted with\n // the callback still owed. Nothing clears that but `didClose`, which never\n // runs while the content stays up, so without this the debt would sit armed\n // and be paid out by whatever unrelated teardown came next.\n this.isDidClosePending = false;\n\n if (typeof this.args.onOpenChange === 'function') {\n this.args.onOpenChange(true);\n } else {\n this._isOpen = true;\n }\n };\n\n close = () => {\n // Only a popover that was actually open has a close to finish, and so a\n // `@didClose` to owe. `close()` is reachable with nothing open -- a stray\n // `mouseleave`, a consumer calling the yielded `close` -- and firing the\n // callback for those would be a lie.\n const wasOpen = this.isOpen;\n\n this.isClosing = true;\n if (typeof this.args.onOpenChange === 'function') {\n this.args.onOpenChange(false);\n } else {\n this._isOpen = false;\n }\n\n if (wasOpen) {\n this.isDidClosePending = true;\n }\n\n debounce(this, this.resetIsClosing, 90);\n };\n\n /**\n * The single pending hover intent, or `undefined`. One field rather than two\n * debounces: `debounce` keys on the target/method pair, so debouncing\n * `open` from `mouseenter` and `close` from `mouseleave` left the two unable\n * to cancel each other -- a leave-then-re-enter inside the window queued\n * both, and the close won.\n *\n * Scheduled with `@ember/runloop`'s `later`/`cancel`, like the rest of this\n * codebase (`-private/timer.ts`, `control-blur.ts`, `-private/manager.ts`,\n * `utils/listManager.ts`, `resetIsClosing` below), rather than a raw\n * `setTimeout`/`clearTimeout`. Run-loop tracking is what makes `settled()`\n * -- and so `await triggerEvent(...)`/`await click(...)` in\n * `@ember/test-helpers` -- wait out a pending hover open or close, the same\n * way every other timed transition in this component already does. Tests\n * that need to prove a pending close gets cancelled by a second event\n * (e.g. the pointer arriving on the content) dispatch the raw DOM events\n * directly and `await settled()` once afterward, instead of relying on\n * `await triggerEvent(...)`'s auto-wait -- see the \"hover: leaving and\n * re-entering\" tests below.\n */\n hoverTimer?: { id: EmberTimer; intent: 'open' | 'close' };\n\n get openDelay(): number {\n return typeof this.args.openDelay === 'number' ? this.args.openDelay : 100;\n }\n\n get closeDelay(): number {\n return typeof this.args.closeDelay === 'number'\n ? this.args.closeDelay\n : 100;\n }\n\n clearHoverTimer = () => {\n if (this.hoverTimer) {\n cancel(this.hoverTimer.id);\n this.hoverTimer = undefined;\n }\n };\n\n scheduleOpen = () => {\n this.clearHoverTimer();\n\n if (this.isOpen) {\n return;\n }\n\n const run = () => {\n this.hoverTimer = undefined;\n if (this.isDestroyed || this.isDestroying) return;\n // A hover open is never part of the click cascade `isClosing` guards\n // against, so it must not be gated by it -- that gate is what swallowed\n // opens on an adjacent trigger.\n this.isClosing = false;\n this.open();\n };\n\n if (this.openDelay === 0) {\n run();\n return;\n }\n\n this.hoverTimer = { id: later(run, this.openDelay), intent: 'open' };\n };\n\n scheduleClose = () => {\n this.clearHoverTimer();\n\n if (!this.isOpen) {\n return;\n }\n\n const run = () => {\n this.hoverTimer = undefined;\n if (this.isDestroyed || this.isDestroying) return;\n this.close();\n };\n\n if (this.closeDelay === 0) {\n run();\n return;\n }\n\n this.hoverTimer = { id: later(run, this.closeDelay), intent: 'close' };\n };\n\n /**\n * `Escape` must close a hover popover (WCAG 1.4.13), but in hover mode focus\n * is typically nowhere near the trigger, so a trigger-level `keydown` would\n * never see the key. Installed on the document while open in hover mode.\n */\n escapeListener?: (event: KeyboardEvent) => void;\n\n setupEscapeListener = () => {\n if (this.escapeListener) return;\n\n this.escapeListener = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && this.isOpen) {\n this.clearHoverTimer();\n this.close();\n }\n };\n\n document.addEventListener('keydown', this.escapeListener);\n };\n\n teardownEscapeListener = () => {\n if (this.escapeListener) {\n document.removeEventListener('keydown', this.escapeListener);\n this.escapeListener = undefined;\n }\n };\n\n willDestroy(): void {\n super.willDestroy();\n this.clearHoverTimer();\n this.teardownEscapeListener();\n }\n\n trigger = modifier(\n (\n el: HTMLElement,\n [eventType]: [eventType?: 'click' | 'hover'],\n { aria }: { aria?: 'menu' | 'describedby' | 'none' } = {}\n ) => {\n // The trigger is only the width reference when nothing more specific was\n // nominated. `widthEl` is checked when the measurement happens rather than\n // when the modifier installs, so the two modifiers can install in either\n // order.\n requestAnimationFrame(() => {\n if (!this.widthEl) {\n this.triggerWidth = Math.round(el.offsetWidth);\n }\n });\n\n let observer: ResizeObserver;\n if (eventType !== 'hover') {\n observer = new ResizeObserver((entries) => {\n for (let entry of entries) {\n if (this.widthEl) {\n continue;\n }\n this.triggerWidth = Math.round(\n (entry.target as HTMLElement).offsetWidth\n );\n }\n });\n observer.observe(el);\n }\n\n const onFocusIn = () => {\n if (el.matches(':focus-visible')) {\n this.scheduleOpen();\n }\n };\n\n const onKeydown = (event: KeyboardEvent) => {\n if (this.isOpen && event.key === 'Escape') {\n this.close();\n event.stopPropagation();\n }\n if (\n !this.isOpen &&\n (event.key === 'ArrowDown' || event.key === 'ArrowUp')\n ) {\n this.open();\n event.stopPropagation();\n }\n\n if (this.isOpen && event.key === 'Tab') {\n this.preventFocusRestore = true;\n this.close();\n }\n\n // Open when a letter is pressed, so the content can be typed into.\n // Modifier combos belong to the browser or the OS (Cmd+R, Ctrl+F,\n // Alt+C) and still deliver a letter `key`, so without this check the\n // popover would pop open over whatever the shortcut does. Shift stays\n // allowed: a capital letter is legitimate type-ahead.\n if (\n !this.isOpen &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.altKey &&\n event.code === `Key${event.key.toUpperCase()}`\n ) {\n this.open();\n }\n };\n\n if (eventType === 'hover') {\n this.preventFocusRestore = true;\n this.isHoverTrigger = true;\n // The modifier body re-runs on every open/close (it reads\n // `this.isOpen` below to keep whichever ARIA attribute the trigger's\n // `aria` mode owns in sync -- `aria-expanded` in `'menu'` mode,\n // `aria-describedby` in `'describedby'` mode), and the returned\n // cleanup below always tears the listener down first -- so gating\n // the install on `isOpen` here is what keeps the document listener\n // attached only while open, matching the doc comment on\n // `escapeListener`.\n if (this.isOpen) {\n this.setupEscapeListener();\n }\n\n el.addEventListener('mouseenter', this.scheduleOpen);\n el.addEventListener('mouseleave', this.scheduleClose);\n // Keyboard-only: a mouse click also fires `focusin`, and opening on\n // that would leave content up after the pointer had already left.\n el.addEventListener('focusin', onFocusIn);\n el.addEventListener('focusout', this.scheduleClose);\n } else {\n el.addEventListener('keydown', onKeydown);\n el.addEventListener('click', this.toggle);\n }\n\n // Reading `this.isOpen` here is what keeps these attributes in sync: the\n // modifier consumes the tracked state, so its whole body re-runs on every\n // open and close. That is more work than an attribute needs -- the\n // listeners are rebuilt too -- but it is the only mechanism that covers\n // `@isOpen` being flipped from outside in controlled mode, which an\n // imperative update from `open()`/`close()` would miss.\n const ariaMode = aria ?? 'menu';\n\n if (ariaMode === 'menu') {\n el.setAttribute('aria-haspopup', 'true');\n el.setAttribute('aria-controls', this.menuId);\n el.setAttribute('aria-expanded', this.isOpen.toString());\n } else if (ariaMode === 'describedby') {\n // A tooltip is its trigger's description, not a popup it owns. The\n // attribute only exists while there is something to describe --\n // pointing at an unrendered id is worse than pointing at nothing.\n if (this.isOpen) {\n el.setAttribute('aria-describedby', this.menuId);\n } else {\n el.removeAttribute('aria-describedby');\n }\n }\n\n return () => {\n if (eventType === 'hover') {\n this.isHoverTrigger = false;\n this.clearHoverTimer();\n this.teardownEscapeListener();\n el.removeEventListener('mouseenter', this.scheduleOpen);\n el.removeEventListener('mouseleave', this.scheduleClose);\n el.removeEventListener('focusin', onFocusIn);\n el.removeEventListener('focusout', this.scheduleClose);\n } else {\n el.removeEventListener('click', this.toggle);\n el.removeEventListener('keydown', onKeydown);\n }\n if (observer) {\n observer.disconnect();\n }\n };\n }\n );\n\n /**\n * Nominates the element it is placed on as the popover's width reference,\n * instead of the element carrying `trigger`.\n *\n * `@size=\"trigger\"` content is sized from `--trigger-width`, which is normally\n * the trigger's own width. That is only right while the toggle and the box the\n * content should line up with are the same element. When they are not -- a\n * field whose trigger is one of several things inside it, say -- put this on\n * the element the content should match.\n *\n * It takes precedence over `trigger`'s own measurement for as long as it is\n * installed, so the two never race.\n */\n measureWidth = modifier((el: HTMLElement) => {\n this.widthEl = el;\n\n requestAnimationFrame(() => {\n if (this.widthEl === el) {\n this.triggerWidth = Math.round(el.offsetWidth);\n }\n });\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (this.widthEl !== el) {\n continue;\n }\n this.triggerWidth = Math.round(\n (entry.target as HTMLElement).offsetWidth\n );\n }\n });\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n if (this.widthEl === el) {\n this.widthEl = undefined;\n }\n };\n });\n\n /**\n * Clears the short window during which `open()` refuses to re-open.\n *\n * The 90ms this is debounced by is deliberately unrelated to the transition\n * duration (the default `scale` transition runs 200ms in and 100ms out):\n * the window exists to absorb a single event cascade -- the Overlay's\n * outside-click handler closing while the trigger's own click handler is\n * about to re-open -- not to wait for the animation out. Stretching it to the\n * transition would leave the trigger feeling dead for a fifth of a second\n * after every close, which is far more noticeable than a re-click inside 90ms\n * being dropped.\n */\n resetIsClosing = () => {\n if (!this.isDestroyed && !this.isDestroying) {\n this.isClosing = false;\n }\n };\n\n /**\n * Passed to `Content` as `internalDidClose`, so it runs once the Overlay has\n * finished tearing down -- that is, after the exit transition. That is the\n * moment `@didClose` documents, which is why the consumer's callback is fired\n * from here and not from `close()`.\n *\n * A popover whose `Content` never mounted never gets here, and never owes the\n * callback: there was no overlay, so there was no close to finish.\n */\n didClose = () => {\n this.resetIsClosing();\n\n if (this.isDidClosePending) {\n this.isDidClosePending = false;\n\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n }\n };\n\n <template>\n <Velcro\n @placement={{if @placement @placement \"bottom-start\"}}\n @strategy={{if @strategy @strategy \"absolute\"}}\n @offsetOptions={{if @offsetOptions @offsetOptions 5}}\n @flipOptions={{@flipOptions}}\n @middleware={{this.middleware}}\n @shiftOptions={{@shiftOptions}}\n as |velcro|\n >\n {{yield\n (hash\n anchor=velcro.hook\n measureWidth=this.measureWidth\n isOpen=this.isOpen\n open=this.open\n close=this.close\n toggle=this.toggle\n trigger=this.trigger\n data=velcro.data\n Content=(component\n Content\n id=this.menuId\n loop=velcro.loop\n isOpen=this.isOpen\n toggle=this.toggle\n internalDidClose=this.didClose\n preventFocusRestore=this.preventFocusRestore\n preventAutoFocus=this.isHoverTrigger\n triggerWidth=this.triggerWidth\n isHoverTrigger=this.isHoverTrigger\n onContentHoverStart=this.clearHoverTimer\n onContentHoverEnd=this.scheduleClose\n registerArrow=this.registerArrow\n velcroData=velcro.data\n )\n )\n }}\n </Velcro>\n </template>\n}\n\ninterface ContentArgs extends Pick<\n OverlaySignature['Args'],\n | 'onOpen'\n | 'didClose'\n | 'renderInPlace'\n | 'target'\n | 'transitionDuration'\n | 'backdrop'\n | 'disableTransitions'\n | 'focusTrapOptions'\n | 'closeOnOutsideClick'\n | 'closeOnEscapeKey'\n | 'backdropTransition'\n | 'blockScroll'\n | 'preventAutoFocus'\n> {\n /**\n * @internal\n */\n loop: ModifierLike<{ Element: HTMLElement }>;\n /**\n * @internal\n */\n isOpen: boolean;\n\n /**\n * @internal\n */\n toggle: () => void;\n\n /**\n * @ignore\n */\n internalDidClose: () => void;\n\n /**\n * @internal\n */\n id: string;\n\n /**\n * @internal\n */\n preventFocusRestore?: boolean;\n\n /**\n * @internal\n */\n triggerWidth?: number;\n\n /**\n * @internal\n */\n isHoverTrigger?: boolean;\n\n /**\n * @internal\n */\n onContentHoverStart?: () => void;\n\n /**\n * @internal\n */\n onContentHoverEnd?: () => void;\n\n /**\n * Renders an arrow pointing at the anchor.\n *\n * @defaultValue false\n */\n arrow?: boolean;\n\n /**\n * @internal\n */\n registerArrow?: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * @internal\n * Additional classes for the arrow element, merged with `overlayArrow`'s\n * defaults via Tailwind Merge. Lets a consumer that composes `Content`\n * (e.g. `Tooltip`) give the arrow an intent-specific border; not meant as\n * public `Popover` API.\n */\n arrowClass?: string;\n\n /**\n * @internal\n */\n velcroData?: MiddlewareArguments;\n\n /**\n * Closes as soon as the pointer leaves the trigger, instead of letting it\n * move into the content. Only meaningful for a hover trigger.\n *\n * @defaultValue false\n */\n disableInteractive?: boolean;\n\n /**\n * Custom class name for the content element, merged with the default ones\n * using Tailwind Merge.\n */\n class?: string;\n\n /**\n * The transition to be used in the Modal.\n *\n * @defaultValue {name: 'overlay-transition--scale'}\n */\n transition?: OverlaySignature['Args']['transition'];\n\n /**\n * @defaultValue true\n */\n disableFocusTrap?: boolean;\n\n /**\n * The size of the content.\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'trigger' | 'auto';\n}\n\ninterface ContentSignature {\n Args: ContentArgs;\n Element: HTMLDivElement;\n Blocks: { default: [] };\n}\n\n/**\n * Component yielded from Popover\n */\nclass Content extends Component<ContentSignature> {\n get loop() {\n assert(\n 'The Popover is not properly configured; the @loop is undefined. This issue may arise from failing to set up the anchor.',\n this.args.loop\n );\n return this.args.loop;\n }\n\n get classNames() {\n const { popover } = useStyles();\n return popover({\n size: this.args.size,\n // Scoped to `@arrow`, not applied unconditionally: an unrelated\n // popover may rely on `overflow-auto` (the `overlay` tv base) to\n // scroll long content, and `@arrow` is new, so gating on it here\n // can't regress an existing popover. Without this, the arrow's\n // protruding half is clipped by that inherited `overflow-auto` --\n // see the `tooltip` theme base for the same fix, unconditional there\n // because a tooltip should never scroll.\n class: [this.args.arrow ? 'overflow-visible' : undefined, this.args.class]\n });\n }\n\n get backdrop(): OverlaySignature['Args']['backdrop'] {\n return this.args.backdrop || 'none';\n }\n\n get transition() {\n let options: OverlaySignature['Args']['transition'] = {\n name: 'overlay-transition--scale'\n };\n\n if (typeof this.args.transition === 'object') {\n return { ...options, ...this.args.transition };\n }\n\n return options;\n }\n\n get blockScroll() {\n if (typeof this.args.blockScroll !== 'undefined') {\n return this.args.blockScroll;\n }\n return false;\n }\n\n get disableFocusTrap() {\n if (this.args.disableFocusTrap === false) {\n return false;\n }\n return true;\n }\n\n didClose = () => {\n if (typeof this.args.internalDidClose === 'function') {\n this.args.internalDidClose();\n }\n\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n };\n\n updateTriggerWidth = modifier((el: HTMLDivElement) => {\n if (el && this.args.triggerWidth) {\n el.style.setProperty('--trigger-width', `${this.args.triggerWidth}px`);\n }\n });\n\n /**\n * `{{#if}}` cannot guard a modifier, so the decision lives inside it: when\n * the trigger is not in hover mode, or the consumer opted out, this installs\n * no listeners at all.\n *\n * Also tracks focus, not just the pointer: a keyboard user tabbing from the\n * trigger into a focusable element inside the content triggers the\n * trigger's own `focusout`, which unconditionally schedules a close. With\n * nothing here to cancel it, that close would fire out from under a\n * keyboard user after `closeDelay`, even though the pointer analogue --\n * moving onto the content -- keeps it open. `focusin`/`focusout` reuse the\n * same callbacks as `mouseenter`/`mouseleave` because they need to do\n * exactly the same thing: cancel or (re)schedule the one pending hover\n * intent.\n */\n trackContentHover = modifier((el: HTMLElement) => {\n if (\n this.args.isHoverTrigger !== true ||\n this.args.disableInteractive === true\n ) {\n return;\n }\n\n const enter = () => this.args.onContentHoverStart?.();\n const leave = () => this.args.onContentHoverEnd?.();\n\n el.addEventListener('mouseenter', enter);\n el.addEventListener('mouseleave', leave);\n el.addEventListener('focusin', enter);\n el.addEventListener('focusout', leave);\n\n return () => {\n el.removeEventListener('mouseenter', enter);\n el.removeEventListener('mouseleave', leave);\n el.removeEventListener('focusin', enter);\n el.removeEventListener('focusout', leave);\n };\n });\n\n get placement(): string | undefined {\n return this.args.velcroData?.placement;\n }\n\n get arrowClass(): string {\n const { overlayArrow } = useStyles();\n return overlayArrow({ class: this.args.arrowClass });\n }\n\n /**\n * Positions the arrow from the floating-ui `arrow` middleware: it supplies\n * the offset along the content's edge (`x` for a top/bottom placement, `y`\n * for left/right), and the side the arrow sits on is the one opposite the\n * resolved placement. Inline styles rather than classes -- the offset is a\n * computed pixel value that changes on every reposition.\n *\n * Also clears two of the arrow's four borders (`overlayArrow` draws all\n * four, since a rotated square has no \"outer edge\" of its own to target\n * with a class). Half the arrow sits inside the content box, half sits\n * outside pointing at the anchor; the half inside draws two border lines\n * straight across the content's fill, which reads as a stray diagonal\n * seam. Only the two edges meeting at the *outward* vertex (the one\n * pointing away from the box, at the anchor) should keep a border --\n * those are the visible \"point\" of the arrow against the page background.\n *\n * Worked out for a `rotate: 45deg` square with corners TL/TR/BR/BL: that\n * rotation carries TL to the top vertex, TR to the right vertex, BR to the\n * bottom vertex, and BL to the left vertex, so `border-top` (the TL-TR\n * edge) and `border-left` (the BL-TL edge) are the two edges meeting at\n * the *top* vertex, and so on around. Which vertex is \"outward\" depends on\n * `staticSide` (the box edge the arrow sits on): outward is the same\n * direction as `staticSide` itself (e.g. `top` placement puts the box\n * above the anchor, so the arrow sits on the box's own bottom edge and\n * points further down, toward the anchor -- the bottom vertex, made of\n * `border-right`+`border-bottom`, so the *top* vertex's\n * `border-top`+`border-left` are the ones to clear).\n */\n positionArrow = modifier((el: HTMLElement) => {\n const data = this.args.velcroData;\n const offset = data?.middlewareData?.arrow;\n const placement = data?.placement;\n\n if (!offset || !placement) {\n return;\n }\n\n const staticSides: Record<string, string> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left'\n };\n const side = placement.split('-')[0] as string;\n const staticSide = staticSides[side] ?? 'bottom';\n\n el.style.left = typeof offset.x === 'number' ? `${offset.x}px` : '';\n el.style.top = typeof offset.y === 'number' ? `${offset.y}px` : '';\n el.style.right = '';\n el.style.bottom = '';\n // Half the arrow's 8px box, so the rotated square straddles the edge.\n el.style[staticSide as 'top' | 'bottom' | 'left' | 'right'] = '-4px';\n\n type BorderWidthProp =\n | 'borderTopWidth'\n | 'borderRightWidth'\n | 'borderBottomWidth'\n | 'borderLeftWidth';\n\n // The two edges meeting at the *inward* vertex (the one poking into the\n // content box), keyed by `side` -- see the doc comment above for the\n // derivation.\n const innerBorders: Record<string, [BorderWidthProp, BorderWidthProp]> = {\n top: ['borderTopWidth', 'borderLeftWidth'],\n bottom: ['borderRightWidth', 'borderBottomWidth'],\n left: ['borderBottomWidth', 'borderLeftWidth'],\n right: ['borderTopWidth', 'borderRightWidth']\n };\n\n const allBorderProps: BorderWidthProp[] = [\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth'\n ];\n // Reset every side first: the resolved placement (and so `side`) can\n // change at runtime -- e.g. the flip middleware -- and a border cleared\n // for a previous placement must not stay cleared for the new one.\n for (const prop of allBorderProps) {\n el.style[prop] = '';\n }\n const toClear = innerBorders[side] ?? innerBorders['top'];\n for (const prop of toClear as [BorderWidthProp, BorderWidthProp]) {\n el.style[prop] = '0';\n }\n });\n\n <template>\n <Overlay\n @blockScroll={{this.blockScroll}}\n @transition={{this.transition}}\n @backdrop={{this.backdrop}}\n @customContentModifier={{this.loop}}\n @disableFlexContent={{true}}\n @isOpen={{@isOpen}}\n @onClose={{@toggle}}\n @onOpen={{@onOpen}}\n @didClose={{this.didClose}}\n @renderInPlace={{@renderInPlace}}\n @target={{@target}}\n @transitionDuration={{@transitionDuration}}\n @disableTransitions={{@disableTransitions}}\n @disableFocusTrap={{this.disableFocusTrap}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @class={{this.classNames}}\n @preventFocusRestore={{@preventFocusRestore}}\n @preventAutoFocus={{@preventAutoFocus}}\n @closeOnOverlayElementClick={{false}}\n id={{@id}}\n data-placement={{this.placement}}\n ...attributes\n {{this.updateTriggerWidth @triggerWidth}}\n {{this.trackContentHover @isHoverTrigger @disableInteractive}}\n >\n {{yield}}\n {{#if @arrow}}\n <span\n class={{this.arrowClass}}\n data-part=\"arrow\"\n {{@registerArrow}}\n {{! @velcroData is passed but never read by the modifier body: supplying\n it is what makes ember-modifier re-run this on every reposition.\n Remove the argument and the arrow positions once, then never moves. }}\n {{this.positionArrow @velcroData}}\n ></span>\n {{/if}}\n </Overlay>\n </template>\n}\n\nexport {\n Popover,\n Content as PopoverContent,\n type PopoverSignature,\n type ContentSignature\n};\nexport default Popover;\n"],"names":["Popover","Component","widthEl","menuId","guidFor","isDidClosePending","g","prototype","tracked","i","registerArrow","modifier","el","arrowEl","undefined","middleware","consumer","args","arrowMiddleware","element","padding","n","cached","isOpen","onOpenChange","_isOpen","toggle","event","stopPropagation","close","open","isClosing","wasOpen","debounce","resetIsClosing","hoverTimer","openDelay","closeDelay","clearHoverTimer","cancel","id","scheduleOpen","run","isDestroyed","isDestroying","later","intent","scheduleClose","escapeListener","setupEscapeListener","key","document","addEventListener","teardownEscapeListener","removeEventListener","willDestroy","trigger","eventType","aria","requestAnimationFrame","triggerWidth","Math","round","offsetWidth","observer","ResizeObserver","entries","entry","target","observe","onFocusIn","matches","onKeydown","preventFocusRestore","metaKey","ctrlKey","altKey","code","toUpperCase","isHoverTrigger","ariaMode","setAttribute","toString","removeAttribute","disconnect","measureWidth","didClose","setComponentTemplate","precompileTemplate","strictMode","scope","Velcro","hash","Content","loop","assert","classNames","popover","useStyles","size","class","arrow","backdrop","transition","options","name","blockScroll","disableFocusTrap","internalDidClose","updateTriggerWidth","style","setProperty","trackContentHover","disableInteractive","enter","onContentHoverStart","leave","onContentHoverEnd","placement","velcroData","arrowClass","overlayArrow","positionArrow","data","offset","middlewareData","staticSides","top","bottom","left","right","side","split","staticSide","x","y","innerBorders","allBorderProps","prop","toClear","Overlay"],"mappings":";;;;;;;;;;;;;;;AAwJA,MAAMA,gBAAgBC,SAAA,CAAU;AAC9B;;;;AAIC;EACDC;AAEAC,EAAAA,MAAA,GAASC,O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