@redvars/peacock 3.8.4 → 3.8.6

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 (62) hide show
  1. package/dist/accordion-item.js +28 -38
  2. package/dist/accordion-item.js.map +1 -1
  3. package/dist/accordion.js +8 -0
  4. package/dist/accordion.js.map +1 -1
  5. package/dist/button.js +21 -17
  6. package/dist/button.js.map +1 -1
  7. package/dist/custom-elements-jsdocs.json +212 -33
  8. package/dist/custom-elements.json +852 -143
  9. package/dist/floating-controller-CZYwnRVu.js +185 -0
  10. package/dist/floating-controller-CZYwnRVu.js.map +1 -0
  11. package/dist/{floating-controller-CnUZnOhK.js → floating-ui.dom-oQieRCpS.js} +2 -183
  12. package/dist/floating-ui.dom-oQieRCpS.js.map +1 -0
  13. package/dist/html-editor.js +3 -21091
  14. package/dist/html-editor.js.map +1 -1
  15. package/dist/index-DcbiqHpf.js +21091 -0
  16. package/dist/index-DcbiqHpf.js.map +1 -0
  17. package/dist/index.js +5 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/loader.js +7 -2
  20. package/dist/loader.js.map +1 -1
  21. package/dist/markdown-editor.js +4439 -0
  22. package/dist/markdown-editor.js.map +1 -0
  23. package/dist/menu.js +2 -1
  24. package/dist/menu.js.map +1 -1
  25. package/dist/pagination.js +15 -10
  26. package/dist/pagination.js.map +1 -1
  27. package/dist/popover.js +2 -1
  28. package/dist/popover.js.map +1 -1
  29. package/dist/{select-D85kpjUt.js → select-CnnPbvpQ.js} +68 -71
  30. package/dist/select-CnnPbvpQ.js.map +1 -0
  31. package/dist/src/accordion/accordion-item.d.ts +0 -6
  32. package/dist/src/accordion/accordion.d.ts +5 -0
  33. package/dist/src/button/button/button.d.ts +16 -16
  34. package/dist/src/index.d.ts +1 -0
  35. package/dist/src/input/input.d.ts +5 -5
  36. package/dist/src/markdown-editor/index.d.ts +2 -0
  37. package/dist/src/markdown-editor/markdown-editor.d.ts +116 -0
  38. package/dist/sub-menu.js +2 -1
  39. package/dist/sub-menu.js.map +1 -1
  40. package/dist/table.js +4 -9
  41. package/dist/table.js.map +1 -1
  42. package/dist/tooltip.js +2 -1
  43. package/dist/tooltip.js.map +1 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +5 -1
  46. package/readme.md +2 -2
  47. package/src/accordion/accordion-item.scss +34 -12
  48. package/src/accordion/accordion-item.ts +27 -38
  49. package/src/accordion/accordion.ts +7 -0
  50. package/src/button/button/button-sizes.scss +4 -0
  51. package/src/button/button/button.ts +17 -17
  52. package/src/index.ts +1 -0
  53. package/src/input/input.ts +85 -82
  54. package/src/loader.ts +4 -0
  55. package/src/markdown-editor/index.ts +3 -0
  56. package/src/markdown-editor/markdown-editor.scss +378 -0
  57. package/src/markdown-editor/markdown-editor.ts +994 -0
  58. package/src/pagination/pagination.scss +15 -10
  59. package/src/table/table.scss +3 -9
  60. package/src/table/table.ts +1 -1
  61. package/dist/floating-controller-CnUZnOhK.js.map +0 -1
  62. package/dist/select-D85kpjUt.js.map +0 -1
@@ -0,0 +1,185 @@
1
+ import { a as autoUpdate, o as offset, f as flip, s as shift, b as arrow, c as computePosition } from './floating-ui.dom-oQieRCpS.js';
2
+
3
+ class FloatingController {
4
+ constructor(host, options = {}) {
5
+ this.reference = null;
6
+ this.floating = null;
7
+ this.arrowElement = null;
8
+ this.cleanup = null;
9
+ this.isHostConnected = false;
10
+ this.isOpen = false;
11
+ this.toggle = () => {
12
+ this.isOpen ? this.close() : this.open();
13
+ };
14
+ this.handleContextMenu = (e) => {
15
+ e.preventDefault();
16
+ this.open();
17
+ };
18
+ this.handleFocusOut = (e) => {
19
+ if (!this.reference || this.reference.contains(e.relatedTarget))
20
+ return;
21
+ this.close();
22
+ };
23
+ this.handleOutsideClick = (e) => {
24
+ if (this.isOpen &&
25
+ this.reference &&
26
+ this.floating &&
27
+ !this.isEventInsideElement(e, this.reference) &&
28
+ !this.isEventInsideElement(e, this.floating)) {
29
+ this.close();
30
+ }
31
+ };
32
+ this.open = () => {
33
+ if (this.isOpen)
34
+ return;
35
+ this.isOpen = true;
36
+ this.options.onOpenChange(this.isOpen);
37
+ this.host.requestUpdate();
38
+ this.updatePosition();
39
+ };
40
+ this.close = () => {
41
+ if (!this.isOpen)
42
+ return;
43
+ this.isOpen = false;
44
+ this.options.onOpenChange(this.isOpen);
45
+ this.cleanup?.();
46
+ this.cleanup = null;
47
+ this.host.requestUpdate();
48
+ };
49
+ this.options = {
50
+ placement: options.placement || 'bottom',
51
+ strategy: options.strategy || 'absolute',
52
+ offset: options.offset ?? 8,
53
+ trigger: options.trigger || 'hover',
54
+ closeOnClickOutside: options.closeOnClickOutside ?? true,
55
+ onOpenChange: options.onOpenChange ?? (() => undefined),
56
+ };
57
+ this.host = host;
58
+ this.host.addController(this);
59
+ }
60
+ hostConnected() {
61
+ this.isHostConnected = true;
62
+ if (this.options.closeOnClickOutside) {
63
+ document.addEventListener('mousedown', this.handleOutsideClick);
64
+ }
65
+ }
66
+ hostDisconnected() {
67
+ this.isHostConnected = false;
68
+ this.cleanup?.();
69
+ this.removeEventListeners();
70
+ document.removeEventListener('mousedown', this.handleOutsideClick);
71
+ }
72
+ setElements(reference, floating, arrowElement) {
73
+ this.cleanup?.();
74
+ this.cleanup = null;
75
+ this.removeEventListeners();
76
+ this.reference = reference;
77
+ this.floating = floating;
78
+ this.arrowElement = arrowElement || null;
79
+ this.setupEventListeners();
80
+ if (this.isOpen) {
81
+ this.updatePosition();
82
+ }
83
+ }
84
+ setOptions(options) {
85
+ const previousTrigger = this.options.trigger;
86
+ const previousCloseOnClickOutside = this.options.closeOnClickOutside;
87
+ this.options = {
88
+ ...this.options,
89
+ ...options,
90
+ onOpenChange: options.onOpenChange ?? this.options.onOpenChange,
91
+ };
92
+ if (this.reference && previousTrigger !== this.options.trigger) {
93
+ this.removeEventListeners();
94
+ this.setupEventListeners();
95
+ }
96
+ if (this.isHostConnected && previousCloseOnClickOutside !== this.options.closeOnClickOutside) {
97
+ document.removeEventListener('mousedown', this.handleOutsideClick);
98
+ if (this.options.closeOnClickOutside) {
99
+ document.addEventListener('mousedown', this.handleOutsideClick);
100
+ }
101
+ }
102
+ if (this.isOpen) {
103
+ this.updatePosition();
104
+ }
105
+ }
106
+ setupEventListeners() {
107
+ if (!this.reference)
108
+ return;
109
+ if (this.options.trigger === 'hover' || this.options.trigger === 'hover-focus') {
110
+ this.reference.addEventListener('mouseenter', this.open);
111
+ this.reference.addEventListener('mouseleave', this.close);
112
+ }
113
+ if (this.options.trigger === 'click') {
114
+ this.reference.addEventListener('click', this.toggle);
115
+ }
116
+ if (this.options.trigger === 'context-menu') {
117
+ this.reference.addEventListener('contextmenu', this.handleContextMenu);
118
+ }
119
+ if (this.options.trigger === 'focus' || this.options.trigger === 'hover-focus') {
120
+ this.reference.addEventListener('focusin', this.open);
121
+ this.reference.addEventListener('focusout', this.handleFocusOut);
122
+ }
123
+ }
124
+ removeEventListeners() {
125
+ if (!this.reference)
126
+ return;
127
+ this.reference.removeEventListener('mouseenter', this.open);
128
+ this.reference.removeEventListener('mouseleave', this.close);
129
+ this.reference.removeEventListener('click', this.toggle);
130
+ this.reference.removeEventListener('contextmenu', this.handleContextMenu);
131
+ this.reference.removeEventListener('focusin', this.open);
132
+ this.reference.removeEventListener('focusout', this.handleFocusOut);
133
+ }
134
+ isEventInsideElement(event, element) {
135
+ return event.composedPath().some(target => target === element);
136
+ }
137
+ updatePosition() {
138
+ if (!this.reference || !this.floating)
139
+ return;
140
+ this.cleanup = autoUpdate(this.reference, this.floating, () => {
141
+ if (!this.reference || !this.floating)
142
+ return;
143
+ const middleware = [
144
+ offset(this.options.offset),
145
+ flip(),
146
+ shift({ padding: 5 }),
147
+ ];
148
+ if (this.arrowElement) {
149
+ middleware.push(arrow({ element: this.arrowElement }));
150
+ }
151
+ computePosition(this.reference, this.floating, {
152
+ placement: this.options.placement,
153
+ strategy: this.options.strategy,
154
+ middleware,
155
+ }).then(({ x, y, placement, middlewareData }) => {
156
+ if (!this.floating)
157
+ return;
158
+ Object.assign(this.floating.style, {
159
+ left: `${x}px`,
160
+ top: `${y}px`,
161
+ position: this.options.strategy,
162
+ });
163
+ if (this.arrowElement && middlewareData.arrow) {
164
+ const { x: ax, y: ay } = middlewareData.arrow;
165
+ const staticSide = {
166
+ top: 'bottom',
167
+ right: 'left',
168
+ bottom: 'top',
169
+ left: 'right',
170
+ }[placement.split('-')[0]];
171
+ Object.assign(this.arrowElement.style, {
172
+ left: ax != null ? `${ax}px` : '',
173
+ top: ay != null ? `${ay}px` : '',
174
+ right: '',
175
+ bottom: '',
176
+ [staticSide]: '-4px',
177
+ });
178
+ }
179
+ });
180
+ });
181
+ }
182
+ }
183
+
184
+ export { FloatingController as F };
185
+ //# sourceMappingURL=floating-controller-CZYwnRVu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating-controller-CZYwnRVu.js","sources":["../../src/__internal/controllers/floating-controller.ts"],"sourcesContent":["import {\n computePosition,\n autoUpdate,\n offset,\n flip,\n shift,\n arrow,\n Placement,\n Strategy,\n Middleware,\n} from '@floating-ui/dom';\nimport { ReactiveController, ReactiveControllerHost } from 'lit';\n\nexport type TriggerType =\n | 'hover'\n | 'click'\n | 'context-menu'\n | 'manual'\n | 'focus'\n | 'hover-focus';\n\nexport interface FloatingOptions {\n placement?: Placement;\n strategy?: Strategy;\n offset?: number;\n trigger?: TriggerType;\n closeOnClickOutside?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport class FloatingController implements ReactiveController {\n private host: ReactiveControllerHost;\n \n private reference: HTMLElement | null = null;\n \n private floating: HTMLElement | null = null;\n \n private arrowElement: HTMLElement | null = null;\n\n private cleanup: (() => void) | null = null;\n\n private options: Required<FloatingOptions>;\n\n private isHostConnected = false;\n \n public isOpen = false;\n\n constructor(host: ReactiveControllerHost, options: FloatingOptions = {}) {\n this.options = {\n placement: options.placement || 'bottom',\n strategy: options.strategy || 'absolute',\n offset: options.offset ?? 8,\n trigger: options.trigger || 'hover',\n closeOnClickOutside: options.closeOnClickOutside ?? true,\n onOpenChange: options.onOpenChange ?? (() => undefined),\n };\n this.host = host;\n this.host.addController(this);\n }\n\n hostConnected() {\n this.isHostConnected = true;\n if (this.options.closeOnClickOutside) {\n document.addEventListener('mousedown', this.handleOutsideClick);\n }\n }\n\n hostDisconnected() {\n this.isHostConnected = false;\n this.cleanup?.();\n this.removeEventListeners();\n document.removeEventListener('mousedown', this.handleOutsideClick);\n }\n\n setElements(reference: HTMLElement, floating: HTMLElement, arrowElement?: HTMLElement) {\n this.cleanup?.();\n this.cleanup = null;\n this.removeEventListeners();\n this.reference = reference;\n this.floating = floating;\n this.arrowElement = arrowElement || null;\n this.setupEventListeners();\n if (this.isOpen) {\n this.updatePosition();\n }\n }\n\n setOptions(options: Partial<FloatingOptions>) {\n const previousTrigger = this.options.trigger;\n const previousCloseOnClickOutside = this.options.closeOnClickOutside;\n\n this.options = {\n ...this.options,\n ...options,\n onOpenChange: options.onOpenChange ?? this.options.onOpenChange,\n };\n\n if (this.reference && previousTrigger !== this.options.trigger) {\n this.removeEventListeners();\n this.setupEventListeners();\n }\n\n if (this.isHostConnected && previousCloseOnClickOutside !== this.options.closeOnClickOutside) {\n document.removeEventListener('mousedown', this.handleOutsideClick);\n if (this.options.closeOnClickOutside) {\n document.addEventListener('mousedown', this.handleOutsideClick);\n }\n }\n\n if (this.isOpen) {\n this.updatePosition();\n }\n }\n\n private setupEventListeners() {\n if (!this.reference) return;\n\n if (this.options.trigger === 'hover' || this.options.trigger === 'hover-focus') {\n this.reference.addEventListener('mouseenter', this.open);\n this.reference.addEventListener('mouseleave', this.close);\n }\n\n if (this.options.trigger === 'click') {\n this.reference.addEventListener('click', this.toggle);\n }\n\n if (this.options.trigger === 'context-menu') {\n this.reference.addEventListener('contextmenu', this.handleContextMenu);\n }\n\n if (this.options.trigger === 'focus' || this.options.trigger === 'hover-focus') {\n this.reference.addEventListener('focusin', this.open);\n this.reference.addEventListener('focusout', this.handleFocusOut);\n }\n }\n\n private removeEventListeners() {\n if (!this.reference) return;\n this.reference.removeEventListener('mouseenter', this.open);\n this.reference.removeEventListener('mouseleave', this.close);\n this.reference.removeEventListener('click', this.toggle);\n this.reference.removeEventListener('contextmenu', this.handleContextMenu);\n this.reference.removeEventListener('focusin', this.open);\n this.reference.removeEventListener('focusout', this.handleFocusOut);\n }\n\n private toggle = () => {\n this.isOpen ? this.close() : this.open()\n };\n\n private handleContextMenu = (e: MouseEvent) => {\n e.preventDefault();\n this.open();\n };\n\n private handleFocusOut = (e: FocusEvent) => {\n if (!this.reference || this.reference.contains(e.relatedTarget as Node)) return;\n this.close();\n };\n\n private isEventInsideElement(event: Event, element: HTMLElement) {\n return event.composedPath().some(target => target === element);\n }\n\n private handleOutsideClick = (e: MouseEvent) => {\n if (\n this.isOpen &&\n this.reference &&\n this.floating &&\n !this.isEventInsideElement(e, this.reference) &&\n !this.isEventInsideElement(e, this.floating)\n ) {\n this.close();\n }\n };\n\n open = () => {\n if (this.isOpen) return;\n this.isOpen = true;\n this.options.onOpenChange(this.isOpen);\n this.host.requestUpdate();\n this.updatePosition();\n };\n\n close = () => {\n if (!this.isOpen) return;\n this.isOpen = false;\n this.options.onOpenChange(this.isOpen);\n this.cleanup?.();\n this.cleanup = null;\n this.host.requestUpdate();\n };\n\n private updatePosition() {\n if (!this.reference || !this.floating) return;\n\n this.cleanup = autoUpdate(this.reference, this.floating, () => {\n if (!this.reference || !this.floating) return;\n\n const middleware: Middleware[] = [\n offset(this.options.offset),\n flip(),\n shift({ padding: 5 }),\n ];\n\n if (this.arrowElement) {\n middleware.push(arrow({ element: this.arrowElement }));\n }\n\n computePosition(this.reference, this.floating, {\n placement: this.options.placement,\n strategy: this.options.strategy,\n middleware,\n }).then(({ x, y, placement, middlewareData }) => {\n if (!this.floating) return;\n\n Object.assign(this.floating.style, {\n left: `${x}px`,\n top: `${y}px`,\n position: this.options.strategy,\n });\n\n if (this.arrowElement && middlewareData.arrow) {\n const { x: ax, y: ay } = middlewareData.arrow;\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]]!;\n\n Object.assign(this.arrowElement.style, {\n left: ax != null ? `${ax}px` : '',\n top: ay != null ? `${ay}px` : '',\n right: '',\n bottom: '',\n [staticSide]: '-4px',\n });\n }\n });\n });\n }\n}\n"],"names":[],"mappings":";;MA8Ba,kBAAkB,CAAA;IAiB7B,WAAA,CAAY,IAA4B,EAAE,OAAA,GAA2B,EAAE,EAAA;QAd/D,IAAA,CAAA,SAAS,GAAuB,IAAI;QAEpC,IAAA,CAAA,QAAQ,GAAuB,IAAI;QAEnC,IAAA,CAAA,YAAY,GAAuB,IAAI;QAEvC,IAAA,CAAA,OAAO,GAAwB,IAAI;QAInC,IAAA,CAAA,eAAe,GAAG,KAAK;QAExB,IAAA,CAAA,MAAM,GAAG,KAAK;QAqGb,IAAA,CAAA,MAAM,GAAG,MAAK;AACpB,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;AAC1C,QAAA,CAAC;AAEO,QAAA,IAAA,CAAA,iBAAiB,GAAG,CAAC,CAAa,KAAI;YAC5C,CAAC,CAAC,cAAc,EAAE;YAClB,IAAI,CAAC,IAAI,EAAE;AACb,QAAA,CAAC;AAEO,QAAA,IAAA,CAAA,cAAc,GAAG,CAAC,CAAa,KAAI;AACzC,YAAA,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAqB,CAAC;gBAAE;YACzE,IAAI,CAAC,KAAK,EAAE;AACd,QAAA,CAAC;AAMO,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,CAAa,KAAI;YAC7C,IACE,IAAI,CAAC,MAAM;AACX,gBAAA,IAAI,CAAC,SAAS;AACd,gBAAA,IAAI,CAAC,QAAQ;gBACb,CAAC,IAAI,CAAC,oBAAo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OAAO;qBACd,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE;oBAE3B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;AACrC,wBAAA,IAAI,EAAE,EAAE,IAAI,IAAI,GAAG,CAAA,EAAG,EAAE,CAAA,EAAA,CAAI,GAAG,EAAE;AACjC,wBAAA,GAAG,EAAE,EAAE,IAAI,IAAI,GAAG,CAAA,EAAG,EAAE,CAAA,EAAA,CAAI,GAAG,EAAE;AAChC,wBAAA,KAAK,EAAE,EAAE;AACT,wBAAA,MAAM,EAAE,EAAE;wBACV,CAAC,UAAU,GAAG,MAAM;AACrB,qBAAA,CAAC;gBACJ;AACF,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;IACJ;AACD;;;;"}
@@ -1622,186 +1622,5 @@ const computePosition = (reference, floating, options) => {
1622
1622
  });
1623
1623
  };
1624
1624
 
1625
- class FloatingController {
1626
- constructor(host, options = {}) {
1627
- this.reference = null;
1628
- this.floating = null;
1629
- this.arrowElement = null;
1630
- this.cleanup = null;
1631
- this.isHostConnected = false;
1632
- this.isOpen = false;
1633
- this.toggle = () => {
1634
- this.isOpen ? this.close() : this.open();
1635
- };
1636
- this.handleContextMenu = (e) => {
1637
- e.preventDefault();
1638
- this.open();
1639
- };
1640
- this.handleFocusOut = (e) => {
1641
- if (!this.reference || this.reference.contains(e.relatedTarget))
1642
- return;
1643
- this.close();
1644
- };
1645
- this.handleOutsideClick = (e) => {
1646
- if (this.isOpen &&
1647
- this.reference &&
1648
- this.floating &&
1649
- !this.isEventInsideElement(e, this.reference) &&
1650
- !this.isEventInsideElement(e, this.floating)) {
1651
- this.close();
1652
- }
1653
- };
1654
- this.open = () => {
1655
- if (this.isOpen)
1656
- return;
1657
- this.isOpen = true;
1658
- this.options.onOpenChange(this.isOpen);
1659
- this.host.requestUpdate();
1660
- this.updatePosition();
1661
- };
1662
- this.close = () => {
1663
- if (!this.isOpen)
1664
- return;
1665
- this.isOpen = false;
1666
- this.options.onOpenChange(this.isOpen);
1667
- this.cleanup?.();
1668
- this.cleanup = null;
1669
- this.host.requestUpdate();
1670
- };
1671
- this.options = {
1672
- placement: options.placement || 'bottom',
1673
- strategy: options.strategy || 'absolute',
1674
- offset: options.offset ?? 8,
1675
- trigger: options.trigger || 'hover',
1676
- closeOnClickOutside: options.closeOnClickOutside ?? true,
1677
- onOpenChange: options.onOpenChange ?? (() => undefined),
1678
- };
1679
- this.host = host;
1680
- this.host.addController(this);
1681
- }
1682
- hostConnected() {
1683
- this.isHostConnected = true;
1684
- if (this.options.closeOnClickOutside) {
1685
- document.addEventListener('mousedown', this.handleOutsideClick);
1686
- }
1687
- }
1688
- hostDisconnected() {
1689
- this.isHostConnected = false;
1690
- this.cleanup?.();
1691
- this.removeEventListeners();
1692
- document.removeEventListener('mousedown', this.handleOutsideClick);
1693
- }
1694
- setElements(reference, floating, arrowElement) {
1695
- this.cleanup?.();
1696
- this.cleanup = null;
1697
- this.removeEventListeners();
1698
- this.reference = reference;
1699
- this.floating = floating;
1700
- this.arrowElement = arrowElement || null;
1701
- this.setupEventListeners();
1702
- if (this.isOpen) {
1703
- this.updatePosition();
1704
- }
1705
- }
1706
- setOptions(options) {
1707
- const previousTrigger = this.options.trigger;
1708
- const previousCloseOnClickOutside = this.options.closeOnClickOutside;
1709
- this.options = {
1710
- ...this.options,
1711
- ...options,
1712
- onOpenChange: options.onOpenChange ?? this.options.onOpenChange,
1713
- };
1714
- if (this.reference && previousTrigger !== this.options.trigger) {
1715
- this.removeEventListeners();
1716
- this.setupEventListeners();
1717
- }
1718
- if (this.isHostConnected && previousCloseOnClickOutside !== this.options.closeOnClickOutside) {
1719
- document.removeEventListener('mousedown', this.handleOutsideClick);
1720
- if (this.options.closeOnClickOutside) {
1721
- document.addEventListener('mousedown', this.handleOutsideClick);
1722
- }
1723
- }
1724
- if (this.isOpen) {
1725
- this.updatePosition();
1726
- }
1727
- }
1728
- setupEventListeners() {
1729
- if (!this.reference)
1730
- return;
1731
- if (this.options.trigger === 'hover' || this.options.trigger === 'hover-focus') {
1732
- this.reference.addEventListener('mouseenter', this.open);
1733
- this.reference.addEventListener('mouseleave', this.close);
1734
- }
1735
- if (this.options.trigger === 'click') {
1736
- this.reference.addEventListener('click', this.toggle);
1737
- }
1738
- if (this.options.trigger === 'context-menu') {
1739
- this.reference.addEventListener('contextmenu', this.handleContextMenu);
1740
- }
1741
- if (this.options.trigger === 'focus' || this.options.trigger === 'hover-focus') {
1742
- this.reference.addEventListener('focusin', this.open);
1743
- this.reference.addEventListener('focusout', this.handleFocusOut);
1744
- }
1745
- }
1746
- removeEventListeners() {
1747
- if (!this.reference)
1748
- return;
1749
- this.reference.removeEventListener('mouseenter', this.open);
1750
- this.reference.removeEventListener('mouseleave', this.close);
1751
- this.reference.removeEventListener('click', this.toggle);
1752
- this.reference.removeEventListener('contextmenu', this.handleContextMenu);
1753
- this.reference.removeEventListener('focusin', this.open);
1754
- this.reference.removeEventListener('focusout', this.handleFocusOut);
1755
- }
1756
- isEventInsideElement(event, element) {
1757
- return event.composedPath().some(target => target === element);
1758
- }
1759
- updatePosition() {
1760
- if (!this.reference || !this.floating)
1761
- return;
1762
- this.cleanup = autoUpdate(this.reference, this.floating, () => {
1763
- if (!this.reference || !this.floating)
1764
- return;
1765
- const middleware = [
1766
- offset(this.options.offset),
1767
- flip(),
1768
- shift({ padding: 5 }),
1769
- ];
1770
- if (this.arrowElement) {
1771
- middleware.push(arrow({ element: this.arrowElement }));
1772
- }
1773
- computePosition(this.reference, this.floating, {
1774
- placement: this.options.placement,
1775
- strategy: this.options.strategy,
1776
- middleware,
1777
- }).then(({ x, y, placement, middlewareData }) => {
1778
- if (!this.floating)
1779
- return;
1780
- Object.assign(this.floating.style, {
1781
- left: `${x}px`,
1782
- top: `${y}px`,
1783
- position: this.options.strategy,
1784
- });
1785
- if (this.arrowElement && middlewareData.arrow) {
1786
- const { x: ax, y: ay } = middlewareData.arrow;
1787
- const staticSide = {
1788
- top: 'bottom',
1789
- right: 'left',
1790
- bottom: 'top',
1791
- left: 'right',
1792
- }[placement.split('-')[0]];
1793
- Object.assign(this.arrowElement.style, {
1794
- left: ax != null ? `${ax}px` : '',
1795
- top: ay != null ? `${ay}px` : '',
1796
- right: '',
1797
- bottom: '',
1798
- [staticSide]: '-4px',
1799
- });
1800
- }
1801
- });
1802
- });
1803
- }
1804
- }
1805
-
1806
- export { FloatingController as F };
1807
- //# sourceMappingURL=floating-controller-CnUZnOhK.js.map
1625
+ export { autoUpdate as a, arrow as b, computePosition as c, flip as f, offset as o, shift as s };
1626
+ //# sourceMappingURL=floating-ui.dom-oQieRCpS.js.map