@beeq/core 1.13.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/beeq/beeq.esm.js +1 -1
  2. package/dist/beeq/index.esm.js +1 -1
  3. package/dist/beeq/index.esm.js.map +1 -1
  4. package/dist/beeq/p-923da026.entry.js +6 -0
  5. package/dist/beeq/p-923da026.entry.js.map +1 -0
  6. package/dist/beeq/p-DXYHHeJY.js +6 -0
  7. package/dist/beeq/p-DXYHHeJY.js.map +1 -0
  8. package/dist/beeq/{p-2fd6ea70.entry.js → p-d4fa3abb.entry.js} +2 -2
  9. package/dist/beeq/p-d4fa3abb.entry.js.map +1 -0
  10. package/dist/beeq/p-seEHHqwi.js +6 -0
  11. package/dist/beeq/p-seEHHqwi.js.map +1 -0
  12. package/dist/beeq/svg/.icons-meta.json +1 -1
  13. package/dist/beeq.html-custom-data.json +74 -74
  14. package/dist/cjs/beeq.cjs.js +1 -1
  15. package/dist/cjs/bq-dropdown_2.cjs.entry.js +12 -6
  16. package/dist/cjs/bq-dropdown_2.cjs.entry.js.map +1 -1
  17. package/dist/cjs/bq-tooltip.cjs.entry.js +76 -14
  18. package/dist/cjs/bq-tooltip.cjs.entry.js.map +1 -1
  19. package/dist/cjs/{index-CfLTYjba.js → index-CVDzXB4K.js} +213 -189
  20. package/dist/cjs/index-CVDzXB4K.js.map +1 -0
  21. package/dist/cjs/index.cjs.js +2 -0
  22. package/dist/cjs/index.cjs.js.map +1 -1
  23. package/dist/cjs/isPopoverSupported-CfD5YIXR.js +18 -0
  24. package/dist/cjs/isPopoverSupported-CfD5YIXR.js.map +1 -0
  25. package/dist/cjs/loader.cjs.js +1 -1
  26. package/dist/collection/components/empty-state/scss/bq-empty-state.css +1 -1
  27. package/dist/collection/components/icon/svg/.icons-meta.json +1 -1
  28. package/dist/collection/components/panel/bq-panel.js +11 -5
  29. package/dist/collection/components/panel/bq-panel.js.map +1 -1
  30. package/dist/collection/components/progress/scss/bq-progress.css +1 -1
  31. package/dist/collection/components/side-menu-item/scss/bq-side-menu-item.css +1 -1
  32. package/dist/collection/components/slider/scss/bq-slider.css +1 -1
  33. package/dist/collection/components/tooltip/bq-tooltip.js +74 -13
  34. package/dist/collection/components/tooltip/bq-tooltip.js.map +1 -1
  35. package/dist/collection/components/tooltip/scss/bq-tooltip.css +1 -1
  36. package/dist/collection/services/interfaces/floating-ui.js.map +1 -1
  37. package/dist/collection/services/libraries/floating-ui/index.js +93 -64
  38. package/dist/collection/services/libraries/floating-ui/index.js.map +1 -1
  39. package/dist/collection/shared/test-utils/setProperties.js +1 -1
  40. package/dist/collection/shared/test-utils/setProperties.js.map +1 -1
  41. package/dist/collection/shared/utils/index.js +1 -0
  42. package/dist/collection/shared/utils/index.js.map +1 -1
  43. package/dist/collection/shared/utils/isPopoverSupported.js +12 -0
  44. package/dist/collection/shared/utils/isPopoverSupported.js.map +1 -0
  45. package/dist/components/bq-date-picker.js +1 -1
  46. package/dist/components/bq-dropdown.js +1 -1
  47. package/dist/components/bq-empty-state.js +1 -1
  48. package/dist/components/bq-empty-state.js.map +1 -1
  49. package/dist/components/bq-panel.js +1 -1
  50. package/dist/components/bq-progress.js +1 -1
  51. package/dist/components/bq-progress.js.map +1 -1
  52. package/dist/components/bq-select.js +1 -1
  53. package/dist/components/bq-side-menu-item.js +1 -1
  54. package/dist/components/bq-side-menu-item.js.map +1 -1
  55. package/dist/components/bq-slider.js +1 -1
  56. package/dist/components/bq-slider.js.map +1 -1
  57. package/dist/components/bq-tooltip.js +1 -1
  58. package/dist/components/index.js +1 -1
  59. package/dist/components/index.js.map +1 -1
  60. package/dist/components/p-B4jdbg-4.js +6 -0
  61. package/dist/components/p-B4jdbg-4.js.map +1 -0
  62. package/dist/components/p-DXYHHeJY.js +6 -0
  63. package/dist/components/p-DXYHHeJY.js.map +1 -0
  64. package/dist/components/{p-BS8hIETL.js → p-_I8PqzzU.js} +2 -2
  65. package/dist/components/{p-iyX-PhkX.js → p-c6L-z8md.js} +2 -2
  66. package/dist/components/p-c6L-z8md.js.map +1 -0
  67. package/dist/custom-elements.json +776 -736
  68. package/dist/esm/beeq.js +1 -1
  69. package/dist/esm/bq-dropdown_2.entry.js +12 -6
  70. package/dist/esm/bq-dropdown_2.entry.js.map +1 -1
  71. package/dist/esm/bq-tooltip.entry.js +76 -14
  72. package/dist/esm/bq-tooltip.entry.js.map +1 -1
  73. package/dist/esm/{index-CSAZnAFf.js → index-DXYHHeJY.js} +213 -189
  74. package/dist/esm/index-DXYHHeJY.js.map +1 -0
  75. package/dist/esm/index.js +1 -0
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/isPopoverSupported-seEHHqwi.js +16 -0
  78. package/dist/esm/isPopoverSupported-seEHHqwi.js.map +1 -0
  79. package/dist/esm/loader.js +1 -1
  80. package/dist/hydrate/index.js +304 -205
  81. package/dist/hydrate/index.mjs +304 -205
  82. package/dist/types/components/panel/bq-panel.d.ts +1 -0
  83. package/dist/types/components/tooltip/bq-tooltip.d.ts +14 -0
  84. package/dist/types/services/interfaces/floating-ui.d.ts +1 -1
  85. package/dist/types/services/libraries/floating-ui/index.d.ts +37 -14
  86. package/dist/types/shared/test-utils/setProperties.d.ts +1 -1
  87. package/dist/types/shared/utils/index.d.ts +1 -0
  88. package/dist/types/shared/utils/isPopoverSupported.d.ts +2 -0
  89. package/package.json +3 -3
  90. package/dist/beeq/p-2fd6ea70.entry.js.map +0 -1
  91. package/dist/beeq/p-CSAZnAFf.js +0 -6
  92. package/dist/beeq/p-CSAZnAFf.js.map +0 -1
  93. package/dist/beeq/p-a55354ee.entry.js +0 -6
  94. package/dist/beeq/p-a55354ee.entry.js.map +0 -1
  95. package/dist/cjs/index-CfLTYjba.js.map +0 -1
  96. package/dist/components/p-CSAZnAFf.js +0 -6
  97. package/dist/components/p-CSAZnAFf.js.map +0 -1
  98. package/dist/components/p-Dd3v3b2E.js +0 -6
  99. package/dist/components/p-Dd3v3b2E.js.map +0 -1
  100. package/dist/components/p-iyX-PhkX.js.map +0 -1
  101. package/dist/esm/index-CSAZnAFf.js.map +0 -1
  102. /package/dist/components/{p-BS8hIETL.js.map → p-_I8PqzzU.js.map} +0 -0
@@ -55,6 +55,7 @@ export declare class BqPanel {
55
55
  handleOpenChange(): void;
56
56
  onPropChange(): void;
57
57
  componentDidLoad(): void;
58
+ connectedCallback(): void;
58
59
  disconnectedCallback(): void;
59
60
  private showPanel;
60
61
  private hidePanel;
@@ -50,6 +50,16 @@ export declare class BqTooltip {
50
50
  private panel;
51
51
  private arrow;
52
52
  private floatingUI;
53
+ /**
54
+ * Whether the runtime supports the HTML Popover API. When `true`, the
55
+ * panel is promoted to the browser top layer via `showPopover()`, which
56
+ * bypasses containing blocks created by ancestor `transform`, `filter`,
57
+ * `contain`, `will-change`, etc. When `false`, the panel remains a
58
+ * regular `position: fixed` element in the shadow root, which still
59
+ * covers the common case but is subject to those containing-block
60
+ * quirks.
61
+ */
62
+ private readonly supportsPopover;
53
63
  el: HTMLBqTooltipElement;
54
64
  /** If true, the tooltip will always be visible */
55
65
  alwaysVisible?: boolean;
@@ -69,6 +79,7 @@ export declare class BqTooltip {
69
79
  */
70
80
  visible?: boolean;
71
81
  handleVisibleChange(): Promise<void>;
82
+ handleAlwaysVisibleChange(): void;
72
83
  handleFloatingUIOptionsChange(): void;
73
84
  /** Emitted when the tooltip trigger is clicked */
74
85
  bqClick: EventEmitter<HTMLBqTooltipElement>;
@@ -81,6 +92,8 @@ export declare class BqTooltip {
81
92
  /** Emitted when the tooltip trigger is hovered out */
82
93
  bqHoverOut: EventEmitter<HTMLBqTooltipElement>;
83
94
  componentDidLoad(): void;
95
+ componentDidRender(): void;
96
+ connectedCallback(): void;
84
97
  disconnectedCallback(): void;
85
98
  handleDocumentKeyDown(event: KeyboardEvent): void;
86
99
  handleDocumentMouseDown(event: MouseEvent): void;
@@ -96,6 +109,7 @@ export declare class BqTooltip {
96
109
  private handleTriggerFocusout;
97
110
  private showTooltip;
98
111
  private hideTooltip;
112
+ private get floatingStrategy();
99
113
  private get isHidden();
100
114
  render(): any;
101
115
  }
@@ -2,7 +2,7 @@ import type { Placement, Strategy } from '@floating-ui/core';
2
2
  export interface FloatingUIOptions {
3
3
  distance?: number;
4
4
  placement?: Placement;
5
- arrow?: HTMLElement;
5
+ arrow?: HTMLElement | null;
6
6
  strategy: Strategy;
7
7
  sameWidth?: boolean;
8
8
  skidding?: number;
@@ -1,22 +1,45 @@
1
1
  import { type ReferenceElement } from '@floating-ui/dom';
2
2
  import type { FloatingUIOptions } from '../../interfaces';
3
+ /**
4
+ * Thin wrapper around Floating UI that owns the shared middleware pipeline
5
+ * and ensures each instance has at most one `autoUpdate` subscription.
6
+ *
7
+ * Lifecycle:
8
+ * - `start()` starts position tracking and performs an initial reposition.
9
+ * - `stop()` stops tracking and invalidates pending positioning results.
10
+ * - `reposition()` computes and applies the position once.
11
+ * - `configure(options)` updates options and repositions only when active.
12
+ */
3
13
  export declare class FloatingUI {
4
- panel: HTMLElement;
5
- trigger: ReferenceElement;
6
- options: FloatingUIOptions;
7
- cleanUp: () => void;
14
+ readonly panel: HTMLElement;
15
+ readonly trigger: ReferenceElement;
16
+ readonly options: FloatingUIOptions;
17
+ private cleanup;
18
+ private repositionId;
8
19
  constructor(trigger: ReferenceElement, panel: HTMLElement, options?: FloatingUIOptions);
9
- init(options: FloatingUIOptions): void;
10
- update(): void;
11
- destroy(): void;
12
- positionChange(): {
13
- name: string;
14
- fn: ({ placement: position }: {
15
- placement: any;
16
- }) => {};
17
- };
20
+ /**
21
+ * Merges new options into the current configuration. Active instances
22
+ * reposition without recreating their `autoUpdate` subscription; stopped
23
+ * instances apply the options the next time they start.
24
+ */
25
+ configure(options: Partial<FloatingUIOptions>): void;
26
+ /**
27
+ * Opens the `autoUpdate` subscription so the panel keeps tracking the
28
+ * trigger through scroll, resize, layout and ancestor changes. No-op if
29
+ * the subscription is already running.
30
+ */
31
+ start(): void;
32
+ /**
33
+ * Tears down the `autoUpdate` subscription. Idempotent — safe to call
34
+ * multiple times, and before the first `start()`.
35
+ */
36
+ stop(): void;
37
+ /**
38
+ * Runs a single Floating UI `computePosition` pass and applies the
39
+ * resulting styles to the panel (and the arrow, if configured).
40
+ */
41
+ reposition(): Promise<void>;
18
42
  private applyPanelPosition;
19
43
  private applyArrowPosition;
20
44
  private applyVisibility;
21
- private roundByDPR;
22
45
  }
@@ -4,7 +4,7 @@ export type BqHTMLTagNameMap = keyof {
4
4
  };
5
5
  /**
6
6
  * Enhances page to set and retrieve properties based on attributes parameter. It typed against bq web components
7
- * @param {E2EPage} page - stencil instance of puppeteer page
7
+ * @param {E2EPage} page - Stencil E2E page instance
8
8
  * @param {String} element - element selector
9
9
  * @param {Object} attributes - attributes that will be set on element instance
10
10
  * @returns {Object} attributes that were set on element instance
@@ -12,6 +12,7 @@ export * from './isDefined';
12
12
  export * from './isEmpty';
13
13
  export * from './isHTMLElement';
14
14
  export * from './isNil';
15
+ export * from './isPopoverSupported';
15
16
  export * from './isString';
16
17
  export * from './props';
17
18
  export * from './scrollLock';
@@ -0,0 +1,2 @@
1
+ /** Returns whether the current runtime provides the complete HTML Popover API. */
2
+ export declare const isPopoverSupported: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeq/core",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "BEEQ, a Design System components ruled by Endavan developers :)",
6
6
  "main": "./dist/index.cjs.js",
@@ -14,8 +14,8 @@
14
14
  "dist/"
15
15
  ],
16
16
  "dependencies": {
17
- "@floating-ui/core": "^1.7.4",
18
- "@floating-ui/dom": "^1.7.5",
17
+ "@floating-ui/core": "^1.8.0",
18
+ "@floating-ui/dom": "^1.8.0",
19
19
  "@stencil/core": "^4.41.3"
20
20
  },
21
21
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"names":["bqDropdownCss","id","BqDropdown","dropdownPanelId","triggerElem","disableScrollLock","disabled","distance","keepOpenOnSelect","placement","open","panelHeight","sameWidth","skidding","strategy","onOpenChange","this","bqOpen","emit","handleDisabledChange","removeAttribute","setAttribute","componentDidLoad","el","querySelector","addEventListener","togglePanel","disconnectedCallback","removeEventListener","onItemSelect","onClickOutside","event","isEventTargetChildOfElement","onEscape","key","handleScrollEvent","isDisabled","hasAttribute","render","style","h","class","part","name","exportparts","bqPanelCss","BqPanel","panel","floatingUI","trigger","handleOpenChange","hidePanel","showPanel","onPropChange","isClient","init","options","parentTrigger","parentElement","getBoundingClientRect","contextElement","FloatingUI","destroy","unlockBodyScroll","update","lockBodyScroll","hidden","ref"],"sources":["../../packages/beeq/src/components/dropdown/scss/bq-dropdown.scss?tag=bq-dropdown&encapsulation=shadow","../../packages/beeq/src/components/dropdown/bq-dropdown.tsx","../../packages/beeq/src/components/panel/scss/bq-panel.scss?tag=bq-panel&encapsulation=shadow","../../packages/beeq/src/components/panel/bq-panel.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Dropdown styles */\n/* -------------------------------------------------------------------------- */\n\n:host {\n @apply relative inline-block;\n}\n","import type { EventEmitter } from '@stencil/core';\nimport { Component, Element, Event, h, Listen, Prop, Watch } from '@stencil/core';\n\nimport type { Placement } from '../../services/interfaces';\nimport { isEventTargetChildOfElement } from '../../shared/utils';\n\nlet id = 0;\n\n/**\n * The Dropdown Component is commonly used when presenting a list of selectable options that are too numerous to fit comfortably on the screen.\n * They provide an efficient way to save space and present a long list of options in a compact and organized manner.\n *\n * @example How to use it\n * ```html\n * <bq-dropdown placement=\"bottom-start\">\n * <bq-button slot=\"trigger\">Dropdown</bq-button>\n * <bq-option-list>\n * <bq-option value=\"users\">...</bq-option>\n * <bq-option value=\"user\">...</bq-option>\n * <bq-option value=\"dashboard\">...</bq-option>\n * <bq-option value=\"settings\">...</bq-option>\n * <bq-option value=\"logout\">...</bq-option>\n * </bq-option-list>\n * </bq-dropdown>\n * ```\n *\n * @documentation https://www.beeq.design/3d466e231/p/47ff4b-dropdown\n * @status stable\n *\n * @dependency bq-panel\n *\n * @attr {boolean} disabled - If true, the dropdown panel will be visible and won't be shown.\n * @attr {number} distance - Represents the distance (gutter or margin) between the panel and the trigger element.\n * @attr {boolean} keep-open-on-select - If true, the panel will remain open after a selection is made.\n * @attr {\"top\" | \"bottom\" | \"left\" | \"right\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"left-start\" | \"left-end\" | \"right-start\" | \"right-end\"} placement - Position of the panel.\n * @attr {boolean} open - If true, the panel will be visible.\n * @attr {string} panel-height - When set, it will override the height of the dropdown panel.\n * @attr {boolean} same-width - Whether the panel should have the same width as the trigger element.\n * @attr {number} skidding - Represents the skidding between the panel and the trigger element.\n * @attr {\"fixed\" | \"absolute\"} strategy - Defines the strategy to position the panel.\n *\n * @event bqOpen - Callback handler to be called when the dropdown panel is opened or closed.\n *\n * @slot trigger - The trigger element that opens the dropdown panel.\n * @slot - The content of the dropdown panel.\n *\n * @part base - The component's internal wrapper.\n * @part dropdown - The `<bq-panel>` element used under the hood to display the dropdown panel.\n * @part panel - The `<div>` element used to display and style the panel inside the `<bq-panel>` element.\n * @part trigger - The `<div>` element that hosts the trigger element.\n *\n * @cssprop --bq-panel--background - Panel background color\n * @cssprop --bq-panel--border-color - Panel border color\n * @cssprop --bq-panel--border-radius - Panel border radius\n * @cssprop --bq-panel--border-style - Panel border style\n * @cssprop --bq-panel--border-width - Panel border width\n * @cssprop --bq-panel--box-shadow - Panel box shadow\n * @cssprop --bq-panel--padding - Panel padding\n * @cssprop --bq-panel--height - Panel height\n * @cssprop --bq-panel--width - Panel width\n * @cssprop --bq-panel-z-index - Panel z-index applied when opened\n */\n@Component({\n tag: 'bq-dropdown',\n styleUrl: './scss/bq-dropdown.scss',\n shadow: true,\n})\nexport class BqDropdown {\n // Own Properties\n // ====================\n\n private dropdownPanelId = `bq-dropdown-panel-${++id}`;\n private triggerElem: HTMLElement;\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqDropdownElement;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n // Public Property API\n // ========================\n\n /** If true, the dropdown panel will not lock the page body scroll when open. */\n @Prop({ reflect: true }) disableScrollLock?: boolean = false;\n\n /** If true, the dropdown panel will be visible and won't be shown. */\n @Prop({ reflect: true }) disabled?: boolean = false;\n\n /** Represents the distance (gutter or margin) between the panel and the trigger element. */\n @Prop({ reflect: true }) distance?: number = 4;\n\n /** If true, the panel will remain open after a selection is made. */\n @Prop({ reflect: true }) keepOpenOnSelect?: boolean = false;\n\n /** Position of the panel */\n @Prop({ reflect: true }) placement?: Placement = 'bottom-start';\n\n /** If true, the panel will be visible. */\n @Prop({ reflect: true, mutable: true }) open?: boolean = false;\n\n /** When set, it will override the height of the dropdown panel */\n @Prop({ reflect: true }) panelHeight?: string;\n\n /** Whether the panel should have the same width as the trigger element */\n @Prop({ reflect: true }) sameWidth?: boolean = false;\n\n /** Represents the skidding between the panel and the trigger element. */\n @Prop({ reflect: true }) skidding?: number = 0;\n\n /** Defines the strategy to position the panel */\n @Prop({ reflect: true }) strategy?: 'fixed' | 'absolute' = 'fixed';\n\n // Prop lifecycle events\n // =======================\n\n @Watch('open')\n onOpenChange() {\n this.bqOpen.emit({ open: this.open });\n }\n\n @Watch('disabled')\n handleDisabledChange() {\n if (!this.triggerElem) return;\n\n // set 'disabled' attribute based on 'this.disabled' value, ensuring consistent state handling\n if (!this.disabled) {\n this.triggerElem?.removeAttribute('disabled');\n return;\n }\n this.triggerElem?.setAttribute('disabled', 'true');\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler to be called when the dropdown panel is opened or closed. */\n @Event() bqOpen: EventEmitter<{ open: boolean }>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentDidLoad() {\n this.triggerElem = this.el.querySelector('[slot=\"trigger\"]');\n this.triggerElem?.addEventListener('click', this.togglePanel);\n\n this.handleDisabledChange();\n }\n\n disconnectedCallback() {\n this.triggerElem?.removeEventListener('click', this.togglePanel);\n }\n\n // Listeners\n // ==============\n\n @Listen('bqSelect', { passive: true })\n onItemSelect() {\n if (this.keepOpenOnSelect) return;\n\n this.open = false;\n }\n\n /** Listens for the 'click' event on the document object\n * and closes the dropdown panel if the click is outside the component.\n */\n @Listen('click', { target: 'document', passive: true })\n onClickOutside(event: MouseEvent) {\n if (!this.open || isEventTargetChildOfElement(event, this.el)) return;\n\n // Close when clicking outside of the close element\n this.open = false;\n }\n\n @Listen('keyup', { target: 'window', passive: true })\n onEscape(event: KeyboardEvent) {\n if (!this.open) return;\n // Close the panel when pressing Escape or when pressing Tab and the component loses focus.\n if (event.key === 'Escape' || (event.key === 'Tab' && !isEventTargetChildOfElement(event, this.el))) {\n this.open = false;\n }\n }\n\n @Listen('scroll', { target: 'window', passive: true, capture: true })\n handleScrollEvent() {\n if (!this.open || this.disableScrollLock) return;\n\n // Close the panel when the scroll event is triggered.\n // This is useful for those cases where the floating panel is inside a scrollable container.\n // For example, a select inside a dialog, drawer, etc.\n // ⚠️ Notice that document body scroll lock is handled via the `scrollLock` utility.\n this.open = false;\n }\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private togglePanel = (): void => {\n const isDisabled = this.disabled || this.triggerElem?.hasAttribute('disabled');\n if (isDisabled) return;\n\n this.open = !this.open;\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const style = {\n ...(this.panelHeight && { '--bq-panel--height': this.panelHeight }),\n };\n\n return (\n <div class=\"bq-dropdown\" part=\"base\">\n {/* TRIGGER CONTAINER */}\n <div\n aria-controls={this.dropdownPanelId}\n aria-haspopup=\"true\"\n class=\"bq-dropdown__trigger block\"\n part=\"trigger\"\n >\n <slot name=\"trigger\" />\n </div>\n {/* PANEL */}\n <bq-panel\n class=\"bq-dropdown__panel\"\n disableScrollLock={this.disableScrollLock}\n distance={this.distance}\n exportparts=\"panel\"\n id={this.dropdownPanelId}\n open={this.open}\n part=\"dropdown\"\n placement={this.placement}\n sameWidth={this.sameWidth}\n skidding={this.skidding}\n strategy={this.strategy}\n style={style}\n >\n <slot />\n </bq-panel>\n </div>\n );\n }\n}\n","/* -------------------------------------------------------------------------- */\n/* Panel styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-panel.variables';\n\n:host {\n @apply block;\n}\n\n.bq-panel {\n @include animation-fade-in;\n @apply fixed z-[--bq-panel-z-index] overflow-y-auto overflow-x-hidden is-[--bq-panel--width] max-bs-[--bq-panel--height];\n @apply rounded-[--bq-panel--border-radius] bg-[--bq-panel--background] shadow-[shadow:--bq-panel--box-shadow];\n @apply pe-[--bq-panel--padding-end] ps-[--bq-panel--padding-start] p-b-[--bq-panel--paddingY];\n @apply border-[length:--bq-panel--border-width] border-[color:--bq-panel--border-color];\n\n border-style: var(--bq-panel--border-style);\n}\n","import type { ReferenceElement } from '@floating-ui/dom';\nimport { Component, Element, h, Prop, Watch } from '@stencil/core';\n\nimport type { Placement } from '../../services/interfaces';\nimport { FloatingUI } from '../../services/libraries';\nimport { isClient, lockBodyScroll, unlockBodyScroll } from '../../shared/utils';\n\n/**\n * The Panel component is a versatile and essential element used to wrap and display content in a floating panel.\n *\n * @example How to use it\n * ```html\n * <bq-panel open>\n * <div>Panel content</div>\n * </bq-panel>\n * ```\n *\n * @status stable\n *\n * @attr {number} distance - Represents the distance (gutter or margin) between the panel and the trigger element.\n * @attr {\"top\" | \"bottom\" | \"left\" | \"right\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"left-start\" | \"left-end\" | \"right-start\" | \"right-end\"} placement - Position of the panel.\n * @attr {boolean} open - If true, the panel will be visible.\n * @attr {boolean} same-width - Whether the panel should have the same width as the trigger element.\n * @attr {number} skidding - Represents the skidding between the panel and the trigger element.\n * @attr {\"fixed\" | \"absolute\"} strategy - Defines the strategy to position the panel.\n *\n * @slot - The content of the panel.\n *\n * @part panel - The `<div>` element used to display and style the panel\n *\n * @prop --bq-panel--background - Panel background color\n * @prop --bq-panel--border-color - Panel border color\n * @prop --bq-panel--border-radius - Panel border radius\n * @prop --bq-panel--border-style - Panel border style\n * @prop --bq-panel--border-width - Panel border width\n * @prop --bq-panel--box-shadow - Panel box shadow\n * @prop --bq-panel--padding - Panel padding\n * @prop --bq-panel--height - Panel height\n * @prop --bq-panel--width - Panel width\n * @prop --bq-panel-z-index - Panel z-index applied when opened\n */\n@Component({\n tag: 'bq-panel',\n styleUrl: './scss/bq-panel.scss',\n shadow: true,\n})\nexport class BqPanel {\n // Own Properties\n // ====================\n\n private panel: HTMLElement;\n private floatingUI: FloatingUI;\n private trigger: ReferenceElement;\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqPanelElement;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n // Public Property API\n // ========================\n\n /** If true, the panel will not lock the page body scroll when open. */\n @Prop({ reflect: true }) disableScrollLock?: boolean = false;\n\n /** Represents the distance (gutter or margin) between the panel and the trigger element. */\n @Prop({ reflect: true }) distance?: number = 4;\n\n /** Position of the panel */\n @Prop({ reflect: true }) placement?: Placement = 'bottom-start';\n\n /** If true, the panel will be visible. */\n @Prop({ reflect: true, mutable: true }) open?: boolean = false;\n\n /** Whether the panel should have the same width as the trigger element */\n @Prop({ reflect: true }) sameWidth?: boolean = false;\n\n /** Represents the skidding between the panel and the trigger element. */\n @Prop({ reflect: true }) skidding?: number = 0;\n\n /** Defines the strategy to position the panel */\n @Prop({ reflect: true }) strategy?: 'fixed' | 'absolute' = 'fixed';\n\n // Prop lifecycle events\n // =======================\n\n @Watch('open')\n handleOpenChange() {\n if (!this.open) {\n this.hidePanel();\n return;\n }\n\n this.showPanel();\n }\n\n @Watch('distance')\n @Watch('placement')\n @Watch('sameWidth')\n @Watch('skidding')\n @Watch('strategy')\n onPropChange() {\n if (!isClient()) return;\n\n this.floatingUI?.init({ ...this.options });\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentDidLoad() {\n if (!isClient()) return;\n\n // We need to find the trigger element from the parent to position the panel relative to it.\n const parentTrigger = this.el.parentElement.querySelector('div[part=\"trigger\"]');\n\n if (!parentTrigger) return;\n\n this.trigger = {\n getBoundingClientRect: () => parentTrigger.getBoundingClientRect(),\n contextElement: parentTrigger,\n };\n\n this.floatingUI = new FloatingUI(this.trigger, this.panel, { ...this.options });\n this.handleOpenChange();\n }\n\n disconnectedCallback() {\n if (!isClient()) return;\n\n this.floatingUI?.destroy();\n\n // Ensure scroll lock is removed if the component is disconnected while the panel is open.\n if (this.open && !this.disableScrollLock) {\n unlockBodyScroll();\n }\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private showPanel() {\n if (!isClient()) return;\n\n this.floatingUI?.update();\n\n // Lock the body scroll if the disableScrollLock prop is not true.\n if (!this.disableScrollLock) {\n lockBodyScroll();\n }\n }\n\n private async hidePanel() {\n this.open = false;\n\n // Unlock the body scroll if the disableScrollLock prop is not true.\n if (isClient() && !this.disableScrollLock) {\n unlockBodyScroll();\n }\n }\n\n private get options() {\n return {\n distance: this.distance,\n placement: this.placement,\n sameWidth: this.sameWidth,\n skidding: this.skidding,\n strategy: this.strategy,\n };\n }\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div\n aria-hidden={!this.open ? 'true' : 'false'}\n class=\"bq-panel\"\n hidden={!this.open}\n part=\"panel\"\n ref={(el) => {\n this.panel = el;\n }}\n >\n <slot />\n </div>\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Built by Endavans
3
- * © https://beeq.design - Apache 2 License.
4
- */
5
- const t=["top","right","bottom","left"];const n=Math.min;const e=Math.max;const o=Math.round;const i=Math.floor;const s=t=>({x:t,y:t});const r={left:"right",right:"left",bottom:"top",top:"bottom"};function c(t,o,i){return e(t,n(o,i))}function l(t,n){return typeof t==="function"?t(n):t}function a(t){return t.split("-")[0]}function f(t){return t.split("-")[1]}function u(t){return t==="x"?"y":"x"}function d(t){return t==="y"?"height":"width"}function h(t){const n=t[0];return n==="t"||n==="b"?"y":"x"}function m(t){return u(h(t))}function p(t,n,e){if(e===void 0){e=false}const o=f(t);const i=m(t);const s=d(i);let r=i==="x"?o===(e?"end":"start")?"right":"left":o==="start"?"bottom":"top";if(n.reference[s]>n.floating[s]){r=S(r)}return[r,S(r)]}function y(t){const n=S(t);return[w(t),n,w(n)]}function w(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const g=["left","right"];const x=["right","left"];const b=["top","bottom"];const v=["bottom","top"];function A(t,n,e){switch(t){case"top":case"bottom":if(e)return n?x:g;return n?g:x;case"left":case"right":return n?b:v;default:return[]}}function O(t,n,e,o){const i=f(t);let s=A(a(t),e==="start",o);if(i){s=s.map((t=>t+"-"+i));if(n){s=s.concat(s.map(w))}}return s}function S(t){const n=a(t);return r[n]+t.slice(n.length)}function R(t){return{top:0,right:0,bottom:0,left:0,...t}}function F(t){return typeof t!=="number"?R(t):{top:t,right:t,bottom:t,left:t}}function k(t){const{x:n,y:e,width:o,height:i}=t;return{width:o,height:i,top:e,left:n,right:n+o,bottom:e+i,x:n,y:e}}function C(t,n,e){let{reference:o,floating:i}=t;const s=h(n);const r=m(n);const c=d(r);const l=a(n);const u=s==="y";const p=o.x+o.width/2-i.width/2;const y=o.y+o.height/2-i.height/2;const w=o[c]/2-i[c]/2;let g;switch(l){case"top":g={x:p,y:o.y-i.height};break;case"bottom":g={x:p,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y};break;case"left":g={x:o.x-i.width,y};break;default:g={x:o.x,y:o.y}}switch(f(n)){case"start":g[r]-=w*(e&&u?-1:1);break;case"end":g[r]+=w*(e&&u?-1:1);break}return g}async function P(t,n){var e;if(n===void 0){n={}}const{x:o,y:i,platform:s,rects:r,elements:c,strategy:a}=t;const{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=false,padding:m=0}=l(n,t);const p=F(m);const y=d==="floating"?"reference":"floating";const w=c[h?y:d];const g=k(await s.getClippingRect({element:((e=await(s.isElement==null?void 0:s.isElement(w)))!=null?e:true)?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:u,strategy:a}));const x=d==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference;const b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating));const v=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1};const A=k(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:b,strategy:a}):x);return{top:(g.top-A.top+p.top)/v.y,bottom:(A.bottom-g.bottom+p.bottom)/v.y,left:(g.left-A.left+p.left)/v.x,right:(A.right-g.right+p.right)/v.x}}const D=50;const M=async(t,n,e)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=e;const c=r.detectOverflow?r:{...r,detectOverflow:P};const l=await(r.isRTL==null?void 0:r.isRTL(n));let a=await r.getElementRects({reference:t,floating:n,strategy:i});let{x:f,y:u}=C(a,o,l);let d=o;let h=0;const m={};for(let e=0;e<s.length;e++){const p=s[e];if(!p){continue}const{name:y,fn:w}=p;const{x:g,y:x,data:b,reset:v}=await w({x:f,y:u,initialPlacement:o,placement:d,strategy:i,middlewareData:m,rects:a,platform:c,elements:{reference:t,floating:n}});f=g!=null?g:f;u=x!=null?x:u;m[y]={...m[y],...b};if(v&&h<D){h++;if(typeof v==="object"){if(v.placement){d=v.placement}if(v.rects){a=v.rects===true?await r.getElementRects({reference:t,floating:n,strategy:i}):v.rects}({x:f,y:u}=C(a,d,l))}e=-1}}return{x:f,y:u,placement:d,strategy:i,middlewareData:m}};const T=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:i,placement:s,rects:r,platform:a,elements:u,middlewareData:h}=e;const{element:p,padding:y=0}=l(t,e)||{};if(p==null){return{}}const w=F(y);const g={x:o,y:i};const x=m(s);const b=d(x);const v=await a.getDimensions(p);const A=x==="y";const O=A?"top":"left";const S=A?"bottom":"right";const R=A?"clientHeight":"clientWidth";const k=r.reference[b]+r.reference[x]-g[x]-r.floating[b];const C=g[x]-r.reference[x];const P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(p));let D=P?P[R]:0;if(!D||!await(a.isElement==null?void 0:a.isElement(P))){D=u.floating[R]||r.floating[b]}const M=k/2-C/2;const T=D/2-v[b]/2-1;const $=n(w[O],T);const H=n(w[S],T);const j=$;const z=D-v[b]-H;const B=D/2-v[b]/2+M;const L=c(j,B,z);const E=!h.arrow&&f(s)!=null&&B!==L&&r.reference[b]/2-(B<j?$:H)-v[b]/2<0;const I=E?B<j?B-j:B-z:0;return{[x]:g[x]+I,data:{[x]:L,centerOffset:B-L-I,...E&&{alignmentOffset:I}},reset:E}}});const $=function(t){if(t===void 0){t={}}return{name:"flip",options:t,async fn(n){var e,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:f,elements:u}=n;const{mainAxis:d=true,crossAxis:m=true,fallbackPlacements:w,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=true,...v}=l(t,n);if((e=s.arrow)!=null&&e.alignmentOffset){return{}}const A=a(i);const R=h(c);const F=a(c)===c;const k=await(f.isRTL==null?void 0:f.isRTL(u.floating));const C=w||(F||!b?[S(c)]:y(c));const P=x!=="none";if(!w&&P){C.push(...O(c,b,x,k))}const D=[c,...C];const M=await f.detectOverflow(n,v);const T=[];let $=((o=s.flip)==null?void 0:o.overflows)||[];if(d){T.push(M[A])}if(m){const t=p(i,r,k);T.push(M[t[0]],M[t[1]])}$=[...$,{placement:i,overflows:T}];if(!T.every((t=>t<=0))){var H,j;const t=(((H=s.flip)==null?void 0:H.index)||0)+1;const n=D[t];if(n){const e=m==="alignment"?R!==h(n):false;if(!e||$.every((t=>h(t.placement)===R?t.overflows[0]>0:true))){return{data:{index:t,overflows:$},reset:{placement:n}}}}let e=(j=$.filter((t=>t.overflows[0]<=0)).sort(((t,n)=>t.overflows[1]-n.overflows[1]))[0])==null?void 0:j.placement;if(!e){switch(g){case"bestFit":{var z;const t=(z=$.filter((t=>{if(P){const n=h(t.placement);return n===R||n==="y"}return true})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,n)=>t+n),0)])).sort(((t,n)=>t[1]-n[1]))[0])==null?void 0:z[0];if(t){e=t}break}case"initialPlacement":e=c;break}}if(i!==e){return{reset:{placement:e}}}}return{}}}};function H(t,n){return{top:t.top-n.height,right:t.right-n.width,bottom:t.bottom-n.height,left:t.left-n.width}}function j(n){return t.some((t=>n[t]>=0))}const z=function(t){if(t===void 0){t={}}return{name:"hide",options:t,async fn(n){const{rects:e,platform:o}=n;const{strategy:i="referenceHidden",...s}=l(t,n);switch(i){case"referenceHidden":{const t=await o.detectOverflow(n,{...s,elementContext:"reference"});const i=H(t,e.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:j(i)}}}case"escaped":{const t=await o.detectOverflow(n,{...s,altBoundary:true});const i=H(t,e.floating);return{data:{escapedOffsets:i,escaped:j(i)}}}default:{return{}}}}}};const B=new Set(["left","top"]);async function L(t,n){const{placement:e,platform:o,elements:i}=t;const s=await(o.isRTL==null?void 0:o.isRTL(i.floating));const r=a(e);const c=f(e);const u=h(e)==="y";const d=B.has(r)?-1:1;const m=s&&u?-1:1;const p=l(n,t);let{mainAxis:y,crossAxis:w,alignmentAxis:g}=typeof p==="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};if(c&&typeof g==="number"){w=c==="end"?g*-1:g}return u?{x:w*m,y:y*d}:{x:y*d,y:w*m}}const E=function(t){if(t===void 0){t=0}return{name:"offset",options:t,async fn(n){var e,o;const{x:i,y:s,placement:r,middlewareData:c}=n;const l=await L(n,t);if(r===((e=c.offset)==null?void 0:e.placement)&&(o=c.arrow)!=null&&o.alignmentOffset){return{}}return{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}};const I=function(t){if(t===void 0){t={}}return{name:"shift",options:t,async fn(n){const{x:e,y:o,placement:i,platform:s}=n;const{mainAxis:r=true,crossAxis:f=false,limiter:d={fn:t=>{let{x:n,y:e}=t;return{x:n,y:e}}},...m}=l(t,n);const p={x:e,y:o};const y=await s.detectOverflow(n,m);const w=h(a(i));const g=u(w);let x=p[g];let b=p[w];if(r){const t=g==="y"?"top":"left";const n=g==="y"?"bottom":"right";const e=x+y[t];const o=x-y[n];x=c(e,x,o)}if(f){const t=w==="y"?"top":"left";const n=w==="y"?"bottom":"right";const e=b+y[t];const o=b-y[n];b=c(e,b,o)}const v=d.fn({...n,[g]:x,[w]:b});return{...v,data:{x:v.x-e,y:v.y-o,enabled:{[g]:r,[w]:f}}}}}};const N=function(t){if(t===void 0){t={}}return{name:"size",options:t,async fn(o){var i,s;const{placement:r,rects:c,platform:u,elements:d}=o;const{apply:m=()=>{},...p}=l(t,o);const y=await u.detectOverflow(o,p);const w=a(r);const g=f(r);const x=h(r)==="y";const{width:b,height:v}=c.floating;let A;let O;if(w==="top"||w==="bottom"){A=w;O=g===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"}else{O=w;A=g==="end"?"top":"bottom"}const S=v-y.top-y.bottom;const R=b-y.left-y.right;const F=n(v-y[A],S);const k=n(b-y[O],R);const C=!o.middlewareData.shift;let P=F;let D=k;if((i=o.middlewareData.shift)!=null&&i.enabled.x){D=R}if((s=o.middlewareData.shift)!=null&&s.enabled.y){P=S}if(C&&!g){const t=e(y.left,0);const n=e(y.right,0);const o=e(y.top,0);const i=e(y.bottom,0);if(x){D=b-2*(t!==0||n!==0?t+n:e(y.left,y.right))}else{P=v-2*(o!==0||i!==0?o+i:e(y.top,y.bottom))}}await m({...o,availableWidth:D,availableHeight:P});const M=await u.getDimensions(d.floating);if(b!==M.width||v!==M.height){return{reset:{rects:true}}}return{}}}};function W(){return typeof window!=="undefined"}function q(t){if(X(t)){return(t.nodeName||"").toLowerCase()}return"#document"}function V(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function U(t){var n;return(n=(X(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function X(t){if(!W()){return false}return t instanceof Node||t instanceof V(t).Node}function Y(t){if(!W()){return false}return t instanceof Element||t instanceof V(t).Element}function _(t){if(!W()){return false}return t instanceof HTMLElement||t instanceof V(t).HTMLElement}function G(t){if(!W()||typeof ShadowRoot==="undefined"){return false}return t instanceof ShadowRoot||t instanceof V(t).ShadowRoot}function J(t){const{overflow:n,overflowX:e,overflowY:o,display:i}=ct(t);return/auto|scroll|overlay|hidden|clip/.test(n+o+e)&&i!=="inline"&&i!=="contents"}function K(t){return/^(table|td|th)$/.test(q(t))}function Q(t){try{if(t.matches(":popover-open")){return true}}catch(t){}try{return t.matches(":modal")}catch(t){return false}}const Z=/transform|translate|scale|rotate|perspective|filter/;const tt=/paint|layout|strict|content/;const nt=t=>!!t&&t!=="none";let et;function ot(t){const n=Y(t)?ct(t):t;return nt(n.transform)||nt(n.translate)||nt(n.scale)||nt(n.rotate)||nt(n.perspective)||!st()&&(nt(n.backdropFilter)||nt(n.filter))||Z.test(n.willChange||"")||tt.test(n.contain||"")}function it(t){let n=at(t);while(_(n)&&!rt(n)){if(ot(n)){return n}else if(Q(n)){return null}n=at(n)}return null}function st(){if(et==null){et=typeof CSS!=="undefined"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}return et}function rt(t){return/^(html|body|#document)$/.test(q(t))}function ct(t){return V(t).getComputedStyle(t)}function lt(t){if(Y(t)){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}return{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function at(t){if(q(t)==="html"){return t}const n=t.assignedSlot||t.parentNode||G(t)&&t.host||U(t);return G(n)?n.host:n}function ft(t){const n=at(t);if(rt(n)){return t.ownerDocument?t.ownerDocument.body:t.body}if(_(n)&&J(n)){return n}return ft(n)}function ut(t,n,e){var o;if(n===void 0){n=[]}if(e===void 0){e=true}const i=ft(t);const s=i===((o=t.ownerDocument)==null?void 0:o.body);const r=V(i);if(s){const t=dt(r);return n.concat(r,r.visualViewport||[],J(i)?i:[],t&&e?ut(t):[])}else{return n.concat(i,ut(i,[],e))}}function dt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ht(t){const n=ct(t);let e=parseFloat(n.width)||0;let i=parseFloat(n.height)||0;const s=_(t);const r=s?t.offsetWidth:e;const c=s?t.offsetHeight:i;const l=o(e)!==r||o(i)!==c;if(l){e=r;i=c}return{width:e,height:i,$:l}}function mt(t){return!Y(t)?t.contextElement:t}function pt(t){const n=mt(t);if(!_(n)){return s(1)}const e=n.getBoundingClientRect();const{width:i,height:r,$:c}=ht(n);let l=(c?o(e.width):e.width)/i;let a=(c?o(e.height):e.height)/r;if(!l||!Number.isFinite(l)){l=1}if(!a||!Number.isFinite(a)){a=1}return{x:l,y:a}}const yt=s(0);function wt(t){const n=V(t);if(!st()||!n.visualViewport){return yt}return{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function gt(t,n,e){if(n===void 0){n=false}if(!e||n&&e!==V(t)){return false}return n}function xt(t,n,e,o){if(n===void 0){n=false}if(e===void 0){e=false}const i=t.getBoundingClientRect();const r=mt(t);let c=s(1);if(n){if(o){if(Y(o)){c=pt(o)}}else{c=pt(t)}}const l=gt(r,e,o)?wt(r):s(0);let a=(i.left+l.x)/c.x;let f=(i.top+l.y)/c.y;let u=i.width/c.x;let d=i.height/c.y;if(r){const t=V(r);const n=o&&Y(o)?V(o):o;let e=t;let i=dt(e);while(i&&o&&n!==e){const t=pt(i);const n=i.getBoundingClientRect();const o=ct(i);const s=n.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x;const r=n.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;a*=t.x;f*=t.y;u*=t.x;d*=t.y;a+=s;f+=r;e=V(i);i=dt(e)}}return k({width:u,height:d,x:a,y:f})}function bt(t,n){const e=lt(t).scrollLeft;if(!n){return xt(U(t)).left+e}return n.left+e}function vt(t,n){const e=t.getBoundingClientRect();const o=e.left+n.scrollLeft-bt(t,e);const i=e.top+n.scrollTop;return{x:o,y:i}}function At(t){let{elements:n,rect:e,offsetParent:o,strategy:i}=t;const r=i==="fixed";const c=U(o);const l=n?Q(n.floating):false;if(o===c||l&&r){return e}let a={scrollLeft:0,scrollTop:0};let f=s(1);const u=s(0);const d=_(o);if(d||!d&&!r){if(q(o)!=="body"||J(c)){a=lt(o)}if(d){const t=xt(o);f=pt(o);u.x=t.x+o.clientLeft;u.y=t.y+o.clientTop}}const h=c&&!d&&!r?vt(c,a):s(0);return{width:e.width*f.x,height:e.height*f.y,x:e.x*f.x-a.scrollLeft*f.x+u.x+h.x,y:e.y*f.y-a.scrollTop*f.y+u.y+h.y}}function Ot(t){return Array.from(t.getClientRects())}function St(t){const n=U(t);const o=lt(t);const i=t.ownerDocument.body;const s=e(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth);const r=e(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let c=-o.scrollLeft+bt(t);const l=-o.scrollTop;if(ct(i).direction==="rtl"){c+=e(n.clientWidth,i.clientWidth)-s}return{width:s,height:r,x:c,y:l}}const Rt=25;function Ft(t,n){const e=V(t);const o=U(t);const i=e.visualViewport;let s=o.clientWidth;let r=o.clientHeight;let c=0;let l=0;if(i){s=i.width;r=i.height;const t=st();if(!t||t&&n==="fixed"){c=i.offsetLeft;l=i.offsetTop}}const a=bt(o);if(a<=0){const t=o.ownerDocument;const n=t.body;const e=getComputedStyle(n);const i=t.compatMode==="CSS1Compat"?parseFloat(e.marginLeft)+parseFloat(e.marginRight)||0:0;const r=Math.abs(o.clientWidth-n.clientWidth-i);if(r<=Rt){s-=r}}else if(a<=Rt){s+=a}return{width:s,height:r,x:c,y:l}}function kt(t,n){const e=xt(t,true,n==="fixed");const o=e.top+t.clientTop;const i=e.left+t.clientLeft;const r=_(t)?pt(t):s(1);const c=t.clientWidth*r.x;const l=t.clientHeight*r.y;const a=i*r.x;const f=o*r.y;return{width:c,height:l,x:a,y:f}}function Ct(t,n,e){let o;if(n==="viewport"){o=Ft(t,e)}else if(n==="document"){o=St(U(t))}else if(Y(n)){o=kt(n,e)}else{const e=wt(t);o={x:n.x-e.x,y:n.y-e.y,width:n.width,height:n.height}}return k(o)}function Pt(t,n){const e=at(t);if(e===n||!Y(e)||rt(e)){return false}return ct(e).position==="fixed"||Pt(e,n)}function Dt(t,n){const e=n.get(t);if(e){return e}let o=ut(t,[],false).filter((t=>Y(t)&&q(t)!=="body"));let i=null;const s=ct(t).position==="fixed";let r=s?at(t):t;while(Y(r)&&!rt(r)){const n=ct(r);const e=ot(r);if(!e&&n.position==="fixed"){i=null}const c=s?!e&&!i:!e&&n.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||J(r)&&!e&&Pt(t,r);if(c){o=o.filter((t=>t!==r))}else{i=n}r=at(r)}n.set(t,o);return o}function Mt(t){let{element:o,boundary:i,rootBoundary:s,strategy:r}=t;const c=i==="clippingAncestors"?Q(o)?[]:Dt(o,this._c):[].concat(i);const l=[...c,s];const a=Ct(o,l[0],r);let f=a.top;let u=a.right;let d=a.bottom;let h=a.left;for(let t=1;t<l.length;t++){const i=Ct(o,l[t],r);f=e(i.top,f);u=n(i.right,u);d=n(i.bottom,d);h=e(i.left,h)}return{width:u-h,height:d-f,x:h,y:f}}function Tt(t){const{width:n,height:e}=ht(t);return{width:n,height:e}}function $t(t,n,e){const o=_(n);const i=U(n);const r=e==="fixed";const c=xt(t,true,r,n);let l={scrollLeft:0,scrollTop:0};const a=s(0);function f(){a.x=bt(i)}if(o||!o&&!r){if(q(n)!=="body"||J(i)){l=lt(n)}if(o){const t=xt(n,true,r,n);a.x=t.x+n.clientLeft;a.y=t.y+n.clientTop}else if(i){f()}}if(r&&!o&&i){f()}const u=i&&!o&&!r?vt(i,l):s(0);const d=c.left+l.scrollLeft-a.x-u.x;const h=c.top+l.scrollTop-a.y-u.y;return{x:d,y:h,width:c.width,height:c.height}}function Ht(t){return ct(t).position==="static"}function jt(t,n){if(!_(t)||ct(t).position==="fixed"){return null}if(n){return n(t)}let e=t.offsetParent;if(U(t)===e){e=e.ownerDocument.body}return e}function zt(t,n){const e=V(t);if(Q(t)){return e}if(!_(t)){let n=at(t);while(n&&!rt(n)){if(Y(n)&&!Ht(n)){return n}n=at(n)}return e}let o=jt(t,n);while(o&&K(o)&&Ht(o)){o=jt(o,n)}if(o&&rt(o)&&Ht(o)&&!ot(o)){return e}return o||it(t)||e}const Bt=async function(t){const n=this.getOffsetParent||zt;const e=this.getDimensions;const o=await e(t.floating);return{reference:$t(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Lt(t){return ct(t).direction==="rtl"}const Et={convertOffsetParentRelativeRectToViewportRelativeRect:At,getDocumentElement:U,getClippingRect:Mt,getOffsetParent:zt,getElementRects:Bt,getClientRects:Ot,getDimensions:Tt,getScale:pt,isElement:Y,isRTL:Lt};function It(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function Nt(t,o){let s=null;let r;const c=U(t);function l(){var t;clearTimeout(r);(t=s)==null||t.disconnect();s=null}function a(f,u){if(f===void 0){f=false}if(u===void 0){u=1}l();const d=t.getBoundingClientRect();const{left:h,top:m,width:p,height:y}=d;if(!f){o()}if(!p||!y){return}const w=i(m);const g=i(c.clientWidth-(h+p));const x=i(c.clientHeight-(m+y));const b=i(h);const v=-w+"px "+-g+"px "+-x+"px "+-b+"px";const A={rootMargin:v,threshold:e(0,n(1,u))||1};let O=true;function S(n){const e=n[0].intersectionRatio;if(e!==u){if(!O){return a()}if(!e){r=setTimeout((()=>{a(false,1e-7)}),1e3)}else{a(false,e)}}if(e===1&&!It(d,t.getBoundingClientRect())){a()}O=false}try{s=new IntersectionObserver(S,{...A,root:c.ownerDocument})}catch(t){s=new IntersectionObserver(S,A)}s.observe(t)}a(true);return l}function Wt(t,n,e,o){if(o===void 0){o={}}const{ancestorScroll:i=true,ancestorResize:s=true,elementResize:r=typeof ResizeObserver==="function",layoutShift:c=typeof IntersectionObserver==="function",animationFrame:l=false}=o;const a=mt(t);const f=i||s?[...a?ut(a):[],...n?ut(n):[]]:[];f.forEach((t=>{i&&t.addEventListener("scroll",e,{passive:true});s&&t.addEventListener("resize",e)}));const u=a&&c?Nt(a,e):null;let d=-1;let h=null;if(r){h=new ResizeObserver((t=>{let[o]=t;if(o&&o.target===a&&h&&n){h.unobserve(n);cancelAnimationFrame(d);d=requestAnimationFrame((()=>{var t;(t=h)==null||t.observe(n)}))}e()}));if(a&&!l){h.observe(a)}if(n){h.observe(n)}}let m;let p=l?xt(t):null;if(l){y()}function y(){const n=xt(t);if(p&&!It(p,n)){e()}p=n;m=requestAnimationFrame(y)}e();return()=>{var t;f.forEach((t=>{i&&t.removeEventListener("scroll",e);s&&t.removeEventListener("resize",e)}));u==null||u();(t=h)==null||t.disconnect();h=null;if(l){cancelAnimationFrame(m)}}}const qt=E;const Vt=I;const Ut=$;const Xt=N;const Yt=z;const _t=T;const Gt=(t,n,e)=>{const o=new Map;const i={platform:Et,...e};const s={...i.platform,_c:o};return M(t,n,{...i,platform:s})};class Jt{panel;trigger;options;cleanUp;constructor(t,n,e){this.trigger=t;this.panel=n;this.options={distance:20,placement:"bottom",strategy:"absolute",sameWidth:false,...e};this.init(e)}init(t){this.options=Object.assign(this.options,t);this.update()}update(){this.cleanUp=Wt(this.trigger,this.panel,(()=>{(async()=>{const{x:t,y:n,placement:e,middlewareData:o}=await Gt(this.trigger,this.panel,{placement:this.options.placement,strategy:this.options.strategy,middleware:[qt({mainAxis:this.options.distance,crossAxis:this.options.skidding}),Ut(),Vt(),Xt(this.options.sameWidth&&{apply({rects:t,elements:n}){Object.assign(n.floating.style,{width:`${t.reference.width}px`})}}),_t({element:this.options.arrow||null}),this.positionChange(),Yt()]});this.applyPanelPosition(t,n);this.applyArrowPosition(e,o);this.applyVisibility(o)})()}))}destroy(){if(!this.cleanUp)return;this.cleanUp()}positionChange(){return{name:"positionChange",fn:({placement:t})=>{if(typeof this.options.onPositionChange!=="function")return{};this.options.onPositionChange(t);return{}}}}applyPanelPosition(t,n){Object.assign(this.panel.style,{top:"0",left:"0",transform:`translate(${this.roundByDPR(t)}px,${this.roundByDPR(n)}px)`})}applyArrowPosition(t,n){if(!this.options.arrow)return;const{x:e,y:o}=n.arrow;const i={top:"bottom",right:"left",bottom:"top",left:"right"}[t.split("-")[0]];Object.assign(this.options.arrow.style,{left:e!=null?`${e}px`:"",top:o!=null?`${o}px`:"",right:"",bottom:"",[i]:"-4px"})}applyVisibility(t){const{referenceHidden:n}=t.hide;Object.assign(this.panel.style,{visibility:n?"hidden":"visible"})}roundByDPR(t){const n=window.devicePixelRatio||1;return Math.round(t*n)/n}}export{Jt as F};
6
- //# sourceMappingURL=p-CSAZnAFf.js.map