@vonage/vivid 3.0.0-next.12 → 3.0.0-next.120

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 (291) hide show
  1. package/README.md +170 -4
  2. package/accordion/index.js +4 -60
  3. package/accordion-item/index.js +14 -118
  4. package/action-group/index.js +5 -0
  5. package/avatar/index.js +11 -0
  6. package/badge/index.js +9 -53
  7. package/banner/index.js +20 -210
  8. package/breadcrumb/index.js +7 -96
  9. package/breadcrumb-item/index.js +15 -46
  10. package/button/index.js +19 -751
  11. package/calendar/index.js +5 -1520
  12. package/calendar-event/index.js +9 -0
  13. package/card/index.js +13 -0
  14. package/checkbox/index.js +16 -0
  15. package/custom-elements.json +5784 -0
  16. package/dialog/index.js +24 -0
  17. package/divider/index.js +6 -0
  18. package/elevation/index.js +4 -30
  19. package/fab/index.js +22 -0
  20. package/focus/index.js +4 -2
  21. package/header/index.js +58 -0
  22. package/icon/index.js +8 -36
  23. package/index.js +65 -26
  24. package/layout/index.js +4 -52
  25. package/lib/accordion/definition.d.ts +3 -0
  26. package/lib/accordion/index.d.ts +1 -2
  27. package/lib/accordion-item/definition.d.ts +3 -0
  28. package/lib/accordion-item/index.d.ts +1 -3
  29. package/lib/action-group/action-group.d.ts +10 -0
  30. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  31. package/lib/action-group/definition.d.ts +3 -0
  32. package/lib/action-group/index.d.ts +1 -0
  33. package/lib/avatar/avatar.d.ts +15 -0
  34. package/lib/avatar/avatar.template.d.ts +4 -0
  35. package/lib/avatar/definition.d.ts +3 -0
  36. package/lib/avatar/index.d.ts +1 -0
  37. package/lib/badge/badge.d.ts +2 -4
  38. package/lib/badge/definition.d.ts +3 -0
  39. package/lib/badge/index.d.ts +1 -3
  40. package/lib/banner/banner.d.ts +1 -1
  41. package/lib/banner/banner.template.d.ts +0 -2
  42. package/lib/banner/definition.d.ts +3 -0
  43. package/lib/banner/index.d.ts +1 -2
  44. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  45. package/lib/breadcrumb/definition.d.ts +3 -0
  46. package/lib/breadcrumb/index.d.ts +1 -2
  47. package/lib/breadcrumb-item/definition.d.ts +3 -0
  48. package/lib/breadcrumb-item/index.d.ts +1 -3
  49. package/lib/button/button.d.ts +3 -2
  50. package/lib/button/definition.d.ts +3 -0
  51. package/lib/button/index.d.ts +1 -21
  52. package/lib/calendar/calendar.d.ts +3 -1
  53. package/lib/calendar/definition.d.ts +3 -0
  54. package/lib/calendar/index.d.ts +1 -3
  55. package/lib/calendar-event/calendar-event.d.ts +14 -0
  56. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  57. package/lib/calendar-event/definition.d.ts +3 -0
  58. package/lib/calendar-event/index.d.ts +1 -0
  59. package/lib/card/card.d.ts +10 -0
  60. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  61. package/lib/card/definition.d.ts +3 -0
  62. package/lib/card/index.d.ts +1 -0
  63. package/lib/checkbox/checkbox.d.ts +5 -0
  64. package/lib/checkbox/checkbox.template.d.ts +4 -0
  65. package/lib/checkbox/definition.d.ts +3 -0
  66. package/lib/checkbox/index.d.ts +1 -0
  67. package/lib/components.d.ts +38 -16
  68. package/lib/dialog/definition.d.ts +3 -0
  69. package/lib/dialog/dialog.d.ts +23 -0
  70. package/lib/dialog/dialog.template.d.ts +4 -0
  71. package/lib/dialog/index.d.ts +1 -0
  72. package/lib/divider/definition.d.ts +3 -0
  73. package/lib/divider/divider.d.ts +3 -0
  74. package/lib/divider/divider.template.d.ts +4 -0
  75. package/lib/divider/index.d.ts +1 -0
  76. package/lib/elevation/definition.d.ts +3 -0
  77. package/lib/elevation/elevation.d.ts +1 -0
  78. package/lib/elevation/index.d.ts +1 -2
  79. package/lib/enums.d.ts +19 -6
  80. package/lib/fab/definition.d.ts +3 -0
  81. package/lib/fab/fab.d.ts +13 -0
  82. package/lib/fab/fab.template.d.ts +4 -0
  83. package/lib/fab/index.d.ts +1 -0
  84. package/lib/focus/definition.d.ts +3 -0
  85. package/lib/focus/index.d.ts +1 -2
  86. package/lib/header/definition.d.ts +3 -0
  87. package/lib/header/header.d.ts +5 -0
  88. package/lib/header/header.template.d.ts +4 -0
  89. package/lib/header/index.d.ts +1 -0
  90. package/lib/icon/definition.d.ts +3 -0
  91. package/lib/icon/icon.d.ts +5 -6
  92. package/lib/icon/index.d.ts +1 -2
  93. package/lib/layout/definition.d.ts +3 -0
  94. package/lib/layout/index.d.ts +1 -2
  95. package/lib/layout/layout.d.ts +4 -4
  96. package/lib/listbox/definition.d.ts +3 -0
  97. package/lib/listbox/index.d.ts +1 -0
  98. package/lib/listbox/listbox.d.ts +9 -0
  99. package/lib/listbox/listbox.template.d.ts +4 -0
  100. package/lib/menu/definition.d.ts +7 -0
  101. package/lib/menu/index.d.ts +1 -0
  102. package/lib/menu/menu.d.ts +10 -0
  103. package/lib/menu/menu.template.d.ts +3 -0
  104. package/lib/menu-item/definition.d.ts +3 -0
  105. package/lib/menu-item/index.d.ts +1 -0
  106. package/lib/menu-item/menu-item.d.ts +7 -0
  107. package/lib/menu-item/menu-item.template.d.ts +5 -0
  108. package/lib/nav/definition.d.ts +3 -0
  109. package/lib/nav/index.d.ts +1 -0
  110. package/lib/nav/nav.d.ts +3 -0
  111. package/lib/nav/nav.template.d.ts +4 -0
  112. package/lib/nav-disclosure/definition.d.ts +3 -0
  113. package/lib/nav-disclosure/index.d.ts +1 -0
  114. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  115. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  116. package/lib/nav-item/definition.d.ts +3 -0
  117. package/lib/nav-item/index.d.ts +1 -0
  118. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  119. package/lib/nav-item/nav-item.template.d.ts +4 -0
  120. package/lib/note/definition.d.ts +3 -0
  121. package/lib/note/index.d.ts +1 -0
  122. package/lib/note/note.d.ts +10 -0
  123. package/lib/note/note.template.d.ts +4 -0
  124. package/lib/number-field/definition.d.ts +3 -0
  125. package/lib/number-field/index.d.ts +1 -0
  126. package/lib/number-field/number-field.d.ts +14 -0
  127. package/lib/number-field/number-field.template.d.ts +4 -0
  128. package/lib/option/definition.d.ts +3 -0
  129. package/lib/option/index.d.ts +1 -0
  130. package/lib/option/option.d.ts +9 -0
  131. package/lib/option/option.template.d.ts +4 -0
  132. package/lib/popup/definition.d.ts +4 -0
  133. package/lib/popup/index.d.ts +1 -4
  134. package/lib/popup/popup.d.ts +6 -4
  135. package/lib/progress/definition.d.ts +3 -0
  136. package/lib/progress/index.d.ts +1 -2
  137. package/lib/progress/progress.d.ts +1 -1
  138. package/lib/progress-ring/definition.d.ts +3 -0
  139. package/lib/progress-ring/index.d.ts +1 -2
  140. package/lib/progress-ring/progress-ring.d.ts +2 -1
  141. package/lib/radio/definition.d.ts +3 -0
  142. package/lib/radio/index.d.ts +1 -0
  143. package/lib/radio/radio.d.ts +4 -0
  144. package/lib/radio/radio.template.d.ts +4 -0
  145. package/lib/radio-group/definition.d.ts +7 -0
  146. package/lib/radio-group/index.d.ts +1 -0
  147. package/lib/radio-group/radio-group.d.ts +4 -0
  148. package/lib/radio-group/radio-group.template.d.ts +4 -0
  149. package/lib/side-drawer/definition.d.ts +3 -0
  150. package/lib/side-drawer/index.d.ts +1 -2
  151. package/lib/side-drawer/side-drawer.d.ts +3 -2
  152. package/lib/slider/definition.d.ts +3 -0
  153. package/lib/slider/index.d.ts +1 -0
  154. package/lib/slider/slider.d.ts +4 -0
  155. package/lib/slider/slider.template.d.ts +4 -0
  156. package/lib/switch/definition.d.ts +3 -0
  157. package/lib/switch/index.d.ts +1 -0
  158. package/lib/switch/switch.d.ts +7 -0
  159. package/lib/switch/switch.template.d.ts +4 -0
  160. package/lib/text-anchor/definition.d.ts +3 -0
  161. package/lib/text-anchor/index.d.ts +1 -2
  162. package/lib/text-area/definition.d.ts +3 -0
  163. package/lib/text-area/index.d.ts +1 -0
  164. package/lib/text-area/text-area.d.ts +9 -0
  165. package/lib/text-area/text-area.template.d.ts +4 -0
  166. package/lib/text-field/definition.d.ts +3 -0
  167. package/lib/text-field/index.d.ts +1 -0
  168. package/lib/text-field/text-field.d.ts +14 -0
  169. package/lib/text-field/text-field.template.d.ts +4 -0
  170. package/lib/tooltip/definition.d.ts +3 -0
  171. package/lib/tooltip/index.d.ts +1 -3
  172. package/lib/tooltip/tooltip.d.ts +6 -6
  173. package/listbox/index.js +24 -0
  174. package/menu/index.js +30 -0
  175. package/menu-item/index.js +20 -0
  176. package/nav/index.js +4 -0
  177. package/nav-disclosure/index.js +17 -0
  178. package/nav-item/index.js +22 -0
  179. package/note/index.js +15 -0
  180. package/number-field/index.js +458 -0
  181. package/option/index.js +20 -0
  182. package/package.json +62 -10
  183. package/popup/index.js +21 -2062
  184. package/progress/index.js +6 -98
  185. package/progress-ring/index.js +6 -75
  186. package/radio/index.js +12 -0
  187. package/radio-group/index.js +11 -0
  188. package/shared/affix.js +2 -8
  189. package/shared/anchor.js +11 -3
  190. package/shared/apply-mixins.js +5 -4
  191. package/shared/aria-global.js +2 -86
  192. package/shared/aria.js +9 -0
  193. package/shared/base-progress.js +6 -1
  194. package/shared/breadcrumb-item.js +2 -2
  195. package/shared/button.js +200 -0
  196. package/shared/calendar-event.js +19 -0
  197. package/shared/definition.js +53 -0
  198. package/shared/definition10.js +99 -0
  199. package/shared/definition11.js +48 -0
  200. package/shared/definition12.js +1523 -0
  201. package/shared/definition13.js +111 -0
  202. package/shared/definition14.js +114 -0
  203. package/shared/definition15.js +32 -0
  204. package/shared/definition16.js +172 -0
  205. package/shared/definition17.js +223 -0
  206. package/shared/definition18.js +78 -0
  207. package/shared/definition19.js +87 -0
  208. package/shared/definition2.js +106 -0
  209. package/shared/definition20.js +44 -0
  210. package/shared/definition21.js +1078 -0
  211. package/shared/definition22.js +261 -0
  212. package/shared/definition23.js +348 -0
  213. package/shared/definition24.js +1529 -0
  214. package/shared/definition25.js +351 -0
  215. package/shared/definition26.js +18 -0
  216. package/shared/definition27.js +75 -0
  217. package/shared/definition28.js +31 -0
  218. package/shared/definition29.js +56 -0
  219. package/shared/definition3.js +29 -0
  220. package/shared/definition30.js +94 -0
  221. package/shared/definition31.js +77 -0
  222. package/shared/definition32.js +45 -0
  223. package/shared/definition33.js +435 -0
  224. package/shared/definition34.js +86 -0
  225. package/shared/definition35.js +592 -0
  226. package/shared/definition36.js +147 -0
  227. package/shared/definition37.js +279 -0
  228. package/shared/definition38.js +119 -0
  229. package/shared/definition39.js +77 -0
  230. package/shared/definition4.js +19 -0
  231. package/shared/definition5.js +38 -0
  232. package/shared/definition6.js +60 -0
  233. package/shared/definition7.js +45 -0
  234. package/shared/definition8.js +113 -0
  235. package/shared/definition9.js +107 -0
  236. package/shared/design-system/index.d.ts +1 -2
  237. package/shared/dialog-polyfill.esm.js +858 -0
  238. package/shared/direction.js +20 -0
  239. package/shared/dom.js +8 -0
  240. package/shared/enums.js +70 -0
  241. package/shared/es.object.assign.js +2 -3
  242. package/shared/es.regexp.to-string.js +59 -0
  243. package/shared/focus.js +5 -0
  244. package/shared/focus2.js +11 -0
  245. package/shared/form-associated.js +466 -0
  246. package/shared/form-elements.js +343 -0
  247. package/shared/icon.js +538 -567
  248. package/shared/index.js +1664 -83
  249. package/shared/key-codes.js +97 -0
  250. package/shared/numbers.js +25 -0
  251. package/shared/patterns/affix.d.ts +1 -1
  252. package/shared/patterns/focus.d.ts +3 -0
  253. package/shared/patterns/form-elements/form-elements.d.ts +31 -0
  254. package/shared/patterns/form-elements/index.d.ts +1 -0
  255. package/shared/patterns/index.d.ts +2 -0
  256. package/shared/radio.js +127 -0
  257. package/shared/ref.js +41 -0
  258. package/shared/slotted.js +1 -1
  259. package/shared/start-end.js +50 -0
  260. package/shared/string-trim.js +40 -0
  261. package/shared/text-anchor.js +0 -2
  262. package/shared/text-anchor.template.js +6 -5
  263. package/shared/to-string.js +51 -0
  264. package/side-drawer/index.js +5 -81
  265. package/slider/index.js +17 -0
  266. package/styles/core/all.css +86 -0
  267. package/styles/core/theme.css +11 -0
  268. package/styles/core/typography.css +80 -0
  269. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
  270. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
  271. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
  272. package/styles/fonts/spezia.css +9 -12
  273. package/styles/tokens/theme-dark.css +230 -0
  274. package/styles/tokens/theme-light.css +230 -0
  275. package/switch/index.js +17 -0
  276. package/text-anchor/index.js +12 -7
  277. package/text-area/index.js +22 -0
  278. package/text-field/index.js +22 -0
  279. package/tooltip/index.js +18 -55
  280. package/vivid.api.json +3769 -0
  281. package/lib/sidenav-item/index.d.ts +0 -3
  282. package/lib/text/index.d.ts +0 -2
  283. package/lib/text/text.d.ts +0 -10
  284. package/shared/index2.js +0 -21
  285. package/shared/object-set-prototype-of.js +0 -1009
  286. package/shared/style-inject.es.js +0 -28
  287. package/shared/web.dom-collections.iterator.js +0 -473
  288. package/sidenav-item/index.js +0 -39
  289. package/styles/themes/dark.css +0 -205
  290. package/styles/themes/light.css +0 -205
  291. package/text/index.js +0 -46
@@ -0,0 +1,1529 @@
1
+ import { F as FoundationElement, Q as __classPrivateFieldGet, a5 as __classPrivateFieldSet, _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactorial } from './index.js';
2
+ import { B as Button, b as buttonElements } from './definition9.js';
3
+ import { E as Elevation, e as elevationElements } from './definition15.js';
4
+ import './icon.js';
5
+ import './es.object.assign.js';
6
+ import { b as keyEscape } from './key-codes.js';
7
+ import { w as when } from './when.js';
8
+ import { r as ref } from './ref.js';
9
+ import { c as classNames } from './class-names.js';
10
+
11
+ function getSide(placement) {
12
+ return placement.split('-')[0];
13
+ }
14
+
15
+ function getAlignment(placement) {
16
+ return placement.split('-')[1];
17
+ }
18
+
19
+ function getMainAxisFromPlacement(placement) {
20
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
21
+ }
22
+
23
+ function getLengthFromAxis(axis) {
24
+ return axis === 'y' ? 'height' : 'width';
25
+ }
26
+
27
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
28
+ let {
29
+ reference,
30
+ floating
31
+ } = _ref;
32
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
33
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
34
+ const mainAxis = getMainAxisFromPlacement(placement);
35
+ const length = getLengthFromAxis(mainAxis);
36
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
37
+ const side = getSide(placement);
38
+ const isVertical = mainAxis === 'x';
39
+ let coords;
40
+
41
+ switch (side) {
42
+ case 'top':
43
+ coords = {
44
+ x: commonX,
45
+ y: reference.y - floating.height
46
+ };
47
+ break;
48
+
49
+ case 'bottom':
50
+ coords = {
51
+ x: commonX,
52
+ y: reference.y + reference.height
53
+ };
54
+ break;
55
+
56
+ case 'right':
57
+ coords = {
58
+ x: reference.x + reference.width,
59
+ y: commonY
60
+ };
61
+ break;
62
+
63
+ case 'left':
64
+ coords = {
65
+ x: reference.x - floating.width,
66
+ y: commonY
67
+ };
68
+ break;
69
+
70
+ default:
71
+ coords = {
72
+ x: reference.x,
73
+ y: reference.y
74
+ };
75
+ }
76
+
77
+ switch (getAlignment(placement)) {
78
+ case 'start':
79
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
80
+ break;
81
+
82
+ case 'end':
83
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
84
+ break;
85
+ }
86
+
87
+ return coords;
88
+ }
89
+
90
+ /**
91
+ * Computes the `x` and `y` coordinates that will place the floating element
92
+ * next to a reference element when it is given a certain positioning strategy.
93
+ *
94
+ * This export does not have any `platform` interface logic. You will need to
95
+ * write one for the platform you are using Floating UI with.
96
+ */
97
+
98
+ const computePosition$1 = async (reference, floating, config) => {
99
+ const {
100
+ placement = 'bottom',
101
+ strategy = 'absolute',
102
+ middleware = [],
103
+ platform
104
+ } = config;
105
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
106
+
107
+ let rects = await platform.getElementRects({
108
+ reference,
109
+ floating,
110
+ strategy
111
+ });
112
+ let {
113
+ x,
114
+ y
115
+ } = computeCoordsFromPlacement(rects, placement, rtl);
116
+ let statefulPlacement = placement;
117
+ let middlewareData = {};
118
+ let resetCount = 0;
119
+
120
+ for (let i = 0; i < middleware.length; i++) {
121
+ const {
122
+ name,
123
+ fn
124
+ } = middleware[i];
125
+ const {
126
+ x: nextX,
127
+ y: nextY,
128
+ data,
129
+ reset
130
+ } = await fn({
131
+ x,
132
+ y,
133
+ initialPlacement: placement,
134
+ placement: statefulPlacement,
135
+ strategy,
136
+ middlewareData,
137
+ rects,
138
+ platform,
139
+ elements: {
140
+ reference,
141
+ floating
142
+ }
143
+ });
144
+ x = nextX != null ? nextX : x;
145
+ y = nextY != null ? nextY : y;
146
+ middlewareData = { ...middlewareData,
147
+ [name]: { ...middlewareData[name],
148
+ ...data
149
+ }
150
+ };
151
+
152
+ if (reset && resetCount <= 50) {
153
+ resetCount++;
154
+
155
+ if (typeof reset === 'object') {
156
+ if (reset.placement) {
157
+ statefulPlacement = reset.placement;
158
+ }
159
+
160
+ if (reset.rects) {
161
+ rects = reset.rects === true ? await platform.getElementRects({
162
+ reference,
163
+ floating,
164
+ strategy
165
+ }) : reset.rects;
166
+ }
167
+
168
+ ({
169
+ x,
170
+ y
171
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
172
+ }
173
+
174
+ i = -1;
175
+ continue;
176
+ }
177
+ }
178
+
179
+ return {
180
+ x,
181
+ y,
182
+ placement: statefulPlacement,
183
+ strategy,
184
+ middlewareData
185
+ };
186
+ };
187
+
188
+ function expandPaddingObject(padding) {
189
+ return {
190
+ top: 0,
191
+ right: 0,
192
+ bottom: 0,
193
+ left: 0,
194
+ ...padding
195
+ };
196
+ }
197
+
198
+ function getSideObjectFromPadding(padding) {
199
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
200
+ top: padding,
201
+ right: padding,
202
+ bottom: padding,
203
+ left: padding
204
+ };
205
+ }
206
+
207
+ function rectToClientRect(rect) {
208
+ return { ...rect,
209
+ top: rect.y,
210
+ left: rect.x,
211
+ right: rect.x + rect.width,
212
+ bottom: rect.y + rect.height
213
+ };
214
+ }
215
+
216
+ /**
217
+ * Resolves with an object of overflow side offsets that determine how much the
218
+ * element is overflowing a given clipping boundary.
219
+ * - positive = overflowing the boundary by that number of pixels
220
+ * - negative = how many pixels left before it will overflow
221
+ * - 0 = lies flush with the boundary
222
+ * @see https://floating-ui.com/docs/detectOverflow
223
+ */
224
+ async function detectOverflow(middlewareArguments, options) {
225
+ var _await$platform$isEle;
226
+
227
+ if (options === void 0) {
228
+ options = {};
229
+ }
230
+
231
+ const {
232
+ x,
233
+ y,
234
+ platform,
235
+ rects,
236
+ elements,
237
+ strategy
238
+ } = middlewareArguments;
239
+ const {
240
+ boundary = 'clippingAncestors',
241
+ rootBoundary = 'viewport',
242
+ elementContext = 'floating',
243
+ altBoundary = false,
244
+ padding = 0
245
+ } = options;
246
+ const paddingObject = getSideObjectFromPadding(padding);
247
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
248
+ const element = elements[altBoundary ? altContext : elementContext];
249
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
250
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
251
+ boundary,
252
+ rootBoundary,
253
+ strategy
254
+ }));
255
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
256
+ rect: elementContext === 'floating' ? { ...rects.floating,
257
+ x,
258
+ y
259
+ } : rects.reference,
260
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
261
+ strategy
262
+ }) : rects[elementContext]);
263
+ return {
264
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
265
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
266
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
267
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
268
+ };
269
+ }
270
+
271
+ const min$1 = Math.min;
272
+ const max$1 = Math.max;
273
+
274
+ function within(min$1$1, value, max$1$1) {
275
+ return max$1(min$1$1, min$1(value, max$1$1));
276
+ }
277
+
278
+ /**
279
+ * Positions an inner element of the floating element such that it is centered
280
+ * to the reference element.
281
+ * @see https://floating-ui.com/docs/arrow
282
+ */
283
+ const arrow = options => ({
284
+ name: 'arrow',
285
+ options,
286
+
287
+ async fn(middlewareArguments) {
288
+ // Since `element` is required, we don't Partial<> the type
289
+ const {
290
+ element,
291
+ padding = 0
292
+ } = options != null ? options : {};
293
+ const {
294
+ x,
295
+ y,
296
+ placement,
297
+ rects,
298
+ platform
299
+ } = middlewareArguments;
300
+
301
+ if (element == null) {
302
+
303
+ return {};
304
+ }
305
+
306
+ const paddingObject = getSideObjectFromPadding(padding);
307
+ const coords = {
308
+ x,
309
+ y
310
+ };
311
+ const axis = getMainAxisFromPlacement(placement);
312
+ const alignment = getAlignment(placement);
313
+ const length = getLengthFromAxis(axis);
314
+ const arrowDimensions = await platform.getDimensions(element);
315
+ const minProp = axis === 'y' ? 'top' : 'left';
316
+ const maxProp = axis === 'y' ? 'bottom' : 'right';
317
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
318
+ const startDiff = coords[axis] - rects.reference[axis];
319
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
320
+ let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
321
+
322
+ if (clientSize === 0) {
323
+ clientSize = rects.floating[length];
324
+ }
325
+
326
+ const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
327
+ // point is outside the floating element's bounds
328
+
329
+ const min = paddingObject[minProp];
330
+ const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
331
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
332
+ const offset = within(min, center, max); // Make sure that arrow points at the reference
333
+
334
+ const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
335
+ const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
336
+ const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
337
+ return {
338
+ [axis]: coords[axis] - alignmentOffset,
339
+ data: {
340
+ [axis]: offset,
341
+ centerOffset: center - offset
342
+ }
343
+ };
344
+ }
345
+
346
+ });
347
+
348
+ const hash$1 = {
349
+ left: 'right',
350
+ right: 'left',
351
+ bottom: 'top',
352
+ top: 'bottom'
353
+ };
354
+ function getOppositePlacement(placement) {
355
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
356
+ }
357
+
358
+ function getAlignmentSides(placement, rects, rtl) {
359
+ if (rtl === void 0) {
360
+ rtl = false;
361
+ }
362
+
363
+ const alignment = getAlignment(placement);
364
+ const mainAxis = getMainAxisFromPlacement(placement);
365
+ const length = getLengthFromAxis(mainAxis);
366
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
367
+
368
+ if (rects.reference[length] > rects.floating[length]) {
369
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
370
+ }
371
+
372
+ return {
373
+ main: mainAlignmentSide,
374
+ cross: getOppositePlacement(mainAlignmentSide)
375
+ };
376
+ }
377
+
378
+ const hash = {
379
+ start: 'end',
380
+ end: 'start'
381
+ };
382
+ function getOppositeAlignmentPlacement(placement) {
383
+ return placement.replace(/start|end/g, matched => hash[matched]);
384
+ }
385
+
386
+ const sides = ['top', 'right', 'bottom', 'left'];
387
+
388
+ function getExpandedPlacements(placement) {
389
+ const oppositePlacement = getOppositePlacement(placement);
390
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
391
+ }
392
+
393
+ /**
394
+ * Changes the placement of the floating element to one that will fit if the
395
+ * initially specified `placement` does not.
396
+ * @see https://floating-ui.com/docs/flip
397
+ */
398
+ const flip = function (options) {
399
+ if (options === void 0) {
400
+ options = {};
401
+ }
402
+
403
+ return {
404
+ name: 'flip',
405
+ options,
406
+
407
+ async fn(middlewareArguments) {
408
+ var _middlewareData$flip;
409
+
410
+ const {
411
+ placement,
412
+ middlewareData,
413
+ rects,
414
+ initialPlacement,
415
+ platform,
416
+ elements
417
+ } = middlewareArguments;
418
+ const {
419
+ mainAxis: checkMainAxis = true,
420
+ crossAxis: checkCrossAxis = true,
421
+ fallbackPlacements: specifiedFallbackPlacements,
422
+ fallbackStrategy = 'bestFit',
423
+ flipAlignment = true,
424
+ ...detectOverflowOptions
425
+ } = options;
426
+ const side = getSide(placement);
427
+ const isBasePlacement = side === initialPlacement;
428
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
429
+ const placements = [initialPlacement, ...fallbackPlacements];
430
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
431
+ const overflows = [];
432
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
433
+
434
+ if (checkMainAxis) {
435
+ overflows.push(overflow[side]);
436
+ }
437
+
438
+ if (checkCrossAxis) {
439
+ const {
440
+ main,
441
+ cross
442
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
443
+ overflows.push(overflow[main], overflow[cross]);
444
+ }
445
+
446
+ overflowsData = [...overflowsData, {
447
+ placement,
448
+ overflows
449
+ }]; // One or more sides is overflowing
450
+
451
+ if (!overflows.every(side => side <= 0)) {
452
+ var _middlewareData$flip$, _middlewareData$flip2;
453
+
454
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
455
+ const nextPlacement = placements[nextIndex];
456
+
457
+ if (nextPlacement) {
458
+ // Try next placement and re-run the lifecycle
459
+ return {
460
+ data: {
461
+ index: nextIndex,
462
+ overflows: overflowsData
463
+ },
464
+ reset: {
465
+ placement: nextPlacement
466
+ }
467
+ };
468
+ }
469
+
470
+ let resetPlacement = 'bottom';
471
+
472
+ switch (fallbackStrategy) {
473
+ case 'bestFit':
474
+ {
475
+ var _overflowsData$map$so;
476
+
477
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
478
+
479
+ if (placement) {
480
+ resetPlacement = placement;
481
+ }
482
+
483
+ break;
484
+ }
485
+
486
+ case 'initialPlacement':
487
+ resetPlacement = initialPlacement;
488
+ break;
489
+ }
490
+
491
+ if (placement !== resetPlacement) {
492
+ return {
493
+ reset: {
494
+ placement: resetPlacement
495
+ }
496
+ };
497
+ }
498
+ }
499
+
500
+ return {};
501
+ }
502
+
503
+ };
504
+ };
505
+
506
+ function getSideOffsets(overflow, rect) {
507
+ return {
508
+ top: overflow.top - rect.height,
509
+ right: overflow.right - rect.width,
510
+ bottom: overflow.bottom - rect.height,
511
+ left: overflow.left - rect.width
512
+ };
513
+ }
514
+
515
+ function isAnySideFullyClipped(overflow) {
516
+ return sides.some(side => overflow[side] >= 0);
517
+ }
518
+
519
+ /**
520
+ * Provides data to hide the floating element in applicable situations, such as
521
+ * when it is not in the same clipping context as the reference element.
522
+ * @see https://floating-ui.com/docs/hide
523
+ */
524
+ const hide = function (_temp) {
525
+ let {
526
+ strategy = 'referenceHidden',
527
+ ...detectOverflowOptions
528
+ } = _temp === void 0 ? {} : _temp;
529
+ return {
530
+ name: 'hide',
531
+
532
+ async fn(middlewareArguments) {
533
+ const {
534
+ rects
535
+ } = middlewareArguments;
536
+
537
+ switch (strategy) {
538
+ case 'referenceHidden':
539
+ {
540
+ const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
541
+ elementContext: 'reference'
542
+ });
543
+ const offsets = getSideOffsets(overflow, rects.reference);
544
+ return {
545
+ data: {
546
+ referenceHiddenOffsets: offsets,
547
+ referenceHidden: isAnySideFullyClipped(offsets)
548
+ }
549
+ };
550
+ }
551
+
552
+ case 'escaped':
553
+ {
554
+ const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
555
+ altBoundary: true
556
+ });
557
+ const offsets = getSideOffsets(overflow, rects.floating);
558
+ return {
559
+ data: {
560
+ escapedOffsets: offsets,
561
+ escaped: isAnySideFullyClipped(offsets)
562
+ }
563
+ };
564
+ }
565
+
566
+ default:
567
+ {
568
+ return {};
569
+ }
570
+ }
571
+ }
572
+
573
+ };
574
+ };
575
+
576
+ async function convertValueToCoords(middlewareArguments, value) {
577
+ const {
578
+ placement,
579
+ platform,
580
+ elements
581
+ } = middlewareArguments;
582
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
583
+ const side = getSide(placement);
584
+ const alignment = getAlignment(placement);
585
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
586
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
587
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
588
+ const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
589
+
590
+ let {
591
+ mainAxis,
592
+ crossAxis,
593
+ alignmentAxis
594
+ } = typeof rawValue === 'number' ? {
595
+ mainAxis: rawValue,
596
+ crossAxis: 0,
597
+ alignmentAxis: null
598
+ } : {
599
+ mainAxis: 0,
600
+ crossAxis: 0,
601
+ alignmentAxis: null,
602
+ ...rawValue
603
+ };
604
+
605
+ if (alignment && typeof alignmentAxis === 'number') {
606
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
607
+ }
608
+
609
+ return isVertical ? {
610
+ x: crossAxis * crossAxisMulti,
611
+ y: mainAxis * mainAxisMulti
612
+ } : {
613
+ x: mainAxis * mainAxisMulti,
614
+ y: crossAxis * crossAxisMulti
615
+ };
616
+ }
617
+ /**
618
+ * Displaces the floating element from its reference element.
619
+ * @see https://floating-ui.com/docs/offset
620
+ */
621
+
622
+ const offset = function (value) {
623
+ if (value === void 0) {
624
+ value = 0;
625
+ }
626
+
627
+ return {
628
+ name: 'offset',
629
+ options: value,
630
+
631
+ async fn(middlewareArguments) {
632
+ const {
633
+ x,
634
+ y
635
+ } = middlewareArguments;
636
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
637
+ return {
638
+ x: x + diffCoords.x,
639
+ y: y + diffCoords.y,
640
+ data: diffCoords
641
+ };
642
+ }
643
+
644
+ };
645
+ };
646
+
647
+ /**
648
+ * Provides improved positioning for inline reference elements that can span
649
+ * over multiple lines, such as hyperlinks or range selections.
650
+ * @see https://floating-ui.com/docs/inline
651
+ */
652
+ const inline = function (options) {
653
+ if (options === void 0) {
654
+ options = {};
655
+ }
656
+
657
+ return {
658
+ name: 'inline',
659
+ options,
660
+
661
+ async fn(middlewareArguments) {
662
+ var _await$platform$getCl;
663
+
664
+ const {
665
+ placement,
666
+ elements,
667
+ rects,
668
+ platform,
669
+ strategy
670
+ } = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
671
+ // ClientRect's bounds, despite the event listener being triggered. A
672
+ // padding of 2 seems to handle this issue.
673
+
674
+ const {
675
+ padding = 2,
676
+ x,
677
+ y
678
+ } = options;
679
+ const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
680
+ rect: rects.reference,
681
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
682
+ strategy
683
+ }) : rects.reference);
684
+ const clientRects = (_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
685
+ const paddingObject = getSideObjectFromPadding(padding);
686
+
687
+ function getBoundingClientRect() {
688
+ // There are two rects and they are disjoined
689
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
690
+ var _clientRects$find;
691
+
692
+ // Find the first rect in which the point is fully inside
693
+ return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
694
+ } // There are 2 or more connected rects
695
+
696
+
697
+ if (clientRects.length >= 2) {
698
+ if (getMainAxisFromPlacement(placement) === 'x') {
699
+ const firstRect = clientRects[0];
700
+ const lastRect = clientRects[clientRects.length - 1];
701
+ const isTop = getSide(placement) === 'top';
702
+ const top = firstRect.top;
703
+ const bottom = lastRect.bottom;
704
+ const left = isTop ? firstRect.left : lastRect.left;
705
+ const right = isTop ? firstRect.right : lastRect.right;
706
+ const width = right - left;
707
+ const height = bottom - top;
708
+ return {
709
+ top,
710
+ bottom,
711
+ left,
712
+ right,
713
+ width,
714
+ height,
715
+ x: left,
716
+ y: top
717
+ };
718
+ }
719
+
720
+ const isLeftSide = getSide(placement) === 'left';
721
+ const maxRight = max$1(...clientRects.map(rect => rect.right));
722
+ const minLeft = min$1(...clientRects.map(rect => rect.left));
723
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
724
+ const top = measureRects[0].top;
725
+ const bottom = measureRects[measureRects.length - 1].bottom;
726
+ const left = minLeft;
727
+ const right = maxRight;
728
+ const width = right - left;
729
+ const height = bottom - top;
730
+ return {
731
+ top,
732
+ bottom,
733
+ left,
734
+ right,
735
+ width,
736
+ height,
737
+ x: left,
738
+ y: top
739
+ };
740
+ }
741
+
742
+ return fallback;
743
+ }
744
+
745
+ const resetRects = await platform.getElementRects({
746
+ reference: {
747
+ getBoundingClientRect
748
+ },
749
+ floating: elements.floating,
750
+ strategy
751
+ });
752
+
753
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
754
+ return {
755
+ reset: {
756
+ rects: resetRects
757
+ }
758
+ };
759
+ }
760
+
761
+ return {};
762
+ }
763
+
764
+ };
765
+ };
766
+
767
+ function isWindow(value) {
768
+ return value && value.document && value.location && value.alert && value.setInterval;
769
+ }
770
+ function getWindow(node) {
771
+ if (node == null) {
772
+ return window;
773
+ }
774
+
775
+ if (!isWindow(node)) {
776
+ const ownerDocument = node.ownerDocument;
777
+ return ownerDocument ? ownerDocument.defaultView || window : window;
778
+ }
779
+
780
+ return node;
781
+ }
782
+
783
+ function getComputedStyle$1(element) {
784
+ return getWindow(element).getComputedStyle(element);
785
+ }
786
+
787
+ function getNodeName(node) {
788
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
789
+ }
790
+
791
+ function getUAString() {
792
+ const uaData = navigator.userAgentData;
793
+
794
+ if (uaData != null && uaData.brands) {
795
+ return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
796
+ }
797
+
798
+ return navigator.userAgent;
799
+ }
800
+
801
+ function isHTMLElement(value) {
802
+ return value instanceof getWindow(value).HTMLElement;
803
+ }
804
+ function isElement(value) {
805
+ return value instanceof getWindow(value).Element;
806
+ }
807
+ function isNode(value) {
808
+ return value instanceof getWindow(value).Node;
809
+ }
810
+ function isShadowRoot(node) {
811
+ // Browsers without `ShadowRoot` support
812
+ if (typeof ShadowRoot === 'undefined') {
813
+ return false;
814
+ }
815
+
816
+ const OwnElement = getWindow(node).ShadowRoot;
817
+ return node instanceof OwnElement || node instanceof ShadowRoot;
818
+ }
819
+ function isOverflowElement(element) {
820
+ // Firefox wants us to check `-x` and `-y` variations as well
821
+ const {
822
+ overflow,
823
+ overflowX,
824
+ overflowY
825
+ } = getComputedStyle$1(element);
826
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
827
+ }
828
+ function isTableElement(element) {
829
+ return ['table', 'td', 'th'].includes(getNodeName(element));
830
+ }
831
+ function isContainingBlock(element) {
832
+ // TODO: Try and use feature detection here instead
833
+ const isFirefox = /firefox/i.test(getUAString());
834
+ const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
835
+ // create a containing block.
836
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
837
+
838
+ return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
839
+ css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
840
+ }
841
+ function isLayoutViewport() {
842
+ // Not Safari
843
+ return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
844
+ // • Always-visible scrollbar or not
845
+ // • Width of <html>, etc.
846
+ // const vV = win.visualViewport;
847
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
848
+ }
849
+
850
+ const min = Math.min;
851
+ const max = Math.max;
852
+ const round = Math.round;
853
+
854
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
855
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
856
+
857
+ if (includeScale === void 0) {
858
+ includeScale = false;
859
+ }
860
+
861
+ if (isFixedStrategy === void 0) {
862
+ isFixedStrategy = false;
863
+ }
864
+
865
+ const clientRect = element.getBoundingClientRect();
866
+ let scaleX = 1;
867
+ let scaleY = 1;
868
+
869
+ if (includeScale && isHTMLElement(element)) {
870
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
871
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
872
+ }
873
+
874
+ const win = isElement(element) ? getWindow(element) : window;
875
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
876
+ const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
877
+ const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
878
+ const width = clientRect.width / scaleX;
879
+ const height = clientRect.height / scaleY;
880
+ return {
881
+ width,
882
+ height,
883
+ top: y,
884
+ right: x + width,
885
+ bottom: y + height,
886
+ left: x,
887
+ x,
888
+ y
889
+ };
890
+ }
891
+
892
+ function getDocumentElement(node) {
893
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
894
+ }
895
+
896
+ function getNodeScroll(element) {
897
+ if (isElement(element)) {
898
+ return {
899
+ scrollLeft: element.scrollLeft,
900
+ scrollTop: element.scrollTop
901
+ };
902
+ }
903
+
904
+ return {
905
+ scrollLeft: element.pageXOffset,
906
+ scrollTop: element.pageYOffset
907
+ };
908
+ }
909
+
910
+ function getWindowScrollBarX(element) {
911
+ // If <html> has a CSS width greater than the viewport, then this will be
912
+ // incorrect for RTL.
913
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
914
+ }
915
+
916
+ function isScaled(element) {
917
+ const rect = getBoundingClientRect(element);
918
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
919
+ }
920
+
921
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
922
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
923
+ const documentElement = getDocumentElement(offsetParent);
924
+ const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
925
+ isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
926
+ let scroll = {
927
+ scrollLeft: 0,
928
+ scrollTop: 0
929
+ };
930
+ const offsets = {
931
+ x: 0,
932
+ y: 0
933
+ };
934
+
935
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
936
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
937
+ scroll = getNodeScroll(offsetParent);
938
+ }
939
+
940
+ if (isHTMLElement(offsetParent)) {
941
+ const offsetRect = getBoundingClientRect(offsetParent, true);
942
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
943
+ offsets.y = offsetRect.y + offsetParent.clientTop;
944
+ } else if (documentElement) {
945
+ offsets.x = getWindowScrollBarX(documentElement);
946
+ }
947
+ }
948
+
949
+ return {
950
+ x: rect.left + scroll.scrollLeft - offsets.x,
951
+ y: rect.top + scroll.scrollTop - offsets.y,
952
+ width: rect.width,
953
+ height: rect.height
954
+ };
955
+ }
956
+
957
+ function getParentNode(node) {
958
+ if (getNodeName(node) === 'html') {
959
+ return node;
960
+ }
961
+
962
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
963
+ // @ts-ignore
964
+ node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
965
+ node.parentNode || ( // DOM Element detected
966
+ isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
967
+ getDocumentElement(node) // fallback
968
+
969
+ );
970
+ }
971
+
972
+ function getTrueOffsetParent(element) {
973
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
974
+ return null;
975
+ }
976
+
977
+ return element.offsetParent;
978
+ }
979
+
980
+ function getContainingBlock(element) {
981
+ let currentNode = getParentNode(element);
982
+
983
+ if (isShadowRoot(currentNode)) {
984
+ currentNode = currentNode.host;
985
+ }
986
+
987
+ while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
988
+ if (isContainingBlock(currentNode)) {
989
+ return currentNode;
990
+ } else {
991
+ currentNode = currentNode.parentNode;
992
+ }
993
+ }
994
+
995
+ return null;
996
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
997
+ // such as table ancestors and cross browser bugs.
998
+
999
+
1000
+ function getOffsetParent(element) {
1001
+ const window = getWindow(element);
1002
+ let offsetParent = getTrueOffsetParent(element);
1003
+
1004
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1005
+ offsetParent = getTrueOffsetParent(offsetParent);
1006
+ }
1007
+
1008
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1009
+ return window;
1010
+ }
1011
+
1012
+ return offsetParent || getContainingBlock(element) || window;
1013
+ }
1014
+
1015
+ function getDimensions(element) {
1016
+ if (isHTMLElement(element)) {
1017
+ return {
1018
+ width: element.offsetWidth,
1019
+ height: element.offsetHeight
1020
+ };
1021
+ }
1022
+
1023
+ const rect = getBoundingClientRect(element);
1024
+ return {
1025
+ width: rect.width,
1026
+ height: rect.height
1027
+ };
1028
+ }
1029
+
1030
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1031
+ let {
1032
+ rect,
1033
+ offsetParent,
1034
+ strategy
1035
+ } = _ref;
1036
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1037
+ const documentElement = getDocumentElement(offsetParent);
1038
+
1039
+ if (offsetParent === documentElement) {
1040
+ return rect;
1041
+ }
1042
+
1043
+ let scroll = {
1044
+ scrollLeft: 0,
1045
+ scrollTop: 0
1046
+ };
1047
+ const offsets = {
1048
+ x: 0,
1049
+ y: 0
1050
+ };
1051
+
1052
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1053
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1054
+ scroll = getNodeScroll(offsetParent);
1055
+ }
1056
+
1057
+ if (isHTMLElement(offsetParent)) {
1058
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1059
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1060
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1061
+ } // This doesn't appear to be need to be negated.
1062
+ // else if (documentElement) {
1063
+ // offsets.x = getWindowScrollBarX(documentElement);
1064
+ // }
1065
+
1066
+ }
1067
+
1068
+ return { ...rect,
1069
+ x: rect.x - scroll.scrollLeft + offsets.x,
1070
+ y: rect.y - scroll.scrollTop + offsets.y
1071
+ };
1072
+ }
1073
+
1074
+ function getViewportRect(element, strategy) {
1075
+ const win = getWindow(element);
1076
+ const html = getDocumentElement(element);
1077
+ const visualViewport = win.visualViewport;
1078
+ let width = html.clientWidth;
1079
+ let height = html.clientHeight;
1080
+ let x = 0;
1081
+ let y = 0;
1082
+
1083
+ if (visualViewport) {
1084
+ width = visualViewport.width;
1085
+ height = visualViewport.height;
1086
+ const layoutViewport = isLayoutViewport();
1087
+
1088
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1089
+ x = visualViewport.offsetLeft;
1090
+ y = visualViewport.offsetTop;
1091
+ }
1092
+ }
1093
+
1094
+ return {
1095
+ width,
1096
+ height,
1097
+ x,
1098
+ y
1099
+ };
1100
+ }
1101
+
1102
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1103
+
1104
+ function getDocumentRect(element) {
1105
+ var _element$ownerDocumen;
1106
+
1107
+ const html = getDocumentElement(element);
1108
+ const scroll = getNodeScroll(element);
1109
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1110
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1111
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1112
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1113
+ const y = -scroll.scrollTop;
1114
+
1115
+ if (getComputedStyle$1(body || html).direction === 'rtl') {
1116
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1117
+ }
1118
+
1119
+ return {
1120
+ width,
1121
+ height,
1122
+ x,
1123
+ y
1124
+ };
1125
+ }
1126
+
1127
+ function getNearestOverflowAncestor(node) {
1128
+ const parentNode = getParentNode(node);
1129
+
1130
+ if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
1131
+ // @ts-ignore assume body is always available
1132
+ return node.ownerDocument.body;
1133
+ }
1134
+
1135
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1136
+ return parentNode;
1137
+ }
1138
+
1139
+ return getNearestOverflowAncestor(parentNode);
1140
+ }
1141
+
1142
+ function getOverflowAncestors(node, list) {
1143
+ var _node$ownerDocument;
1144
+
1145
+ if (list === void 0) {
1146
+ list = [];
1147
+ }
1148
+
1149
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1150
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1151
+ const win = getWindow(scrollableAncestor);
1152
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1153
+ const updatedList = list.concat(target);
1154
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1155
+ updatedList.concat(getOverflowAncestors(target));
1156
+ }
1157
+
1158
+ function contains(parent, child) {
1159
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1160
+
1161
+ if (parent.contains(child)) {
1162
+ return true;
1163
+ } // then fallback to custom implementation with Shadow DOM support
1164
+ else if (rootNode && isShadowRoot(rootNode)) {
1165
+ let next = child;
1166
+
1167
+ do {
1168
+ // use `===` replace node.isSameNode()
1169
+ if (next && parent === next) {
1170
+ return true;
1171
+ } // @ts-ignore: need a better way to handle this...
1172
+
1173
+
1174
+ next = next.parentNode || next.host;
1175
+ } while (next);
1176
+ }
1177
+
1178
+ return false;
1179
+ }
1180
+
1181
+ function getInnerBoundingClientRect(element, strategy) {
1182
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1183
+ const top = clientRect.top + element.clientTop;
1184
+ const left = clientRect.left + element.clientLeft;
1185
+ return {
1186
+ top,
1187
+ left,
1188
+ x: left,
1189
+ y: top,
1190
+ right: left + element.clientWidth,
1191
+ bottom: top + element.clientHeight,
1192
+ width: element.clientWidth,
1193
+ height: element.clientHeight
1194
+ };
1195
+ }
1196
+
1197
+ function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1198
+ if (clippingParent === 'viewport') {
1199
+ return rectToClientRect(getViewportRect(element, strategy));
1200
+ }
1201
+
1202
+ if (isElement(clippingParent)) {
1203
+ return getInnerBoundingClientRect(clippingParent, strategy);
1204
+ }
1205
+
1206
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1207
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
1208
+ // clipping (or hiding) overflowing elements with a position different from
1209
+ // `initial`
1210
+
1211
+
1212
+ function getClippingAncestors(element) {
1213
+ const clippingAncestors = getOverflowAncestors(element);
1214
+ const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
1215
+ const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1216
+
1217
+ if (!isElement(clipperElement)) {
1218
+ return [];
1219
+ } // @ts-ignore isElement check ensures we return Array<Element>
1220
+
1221
+
1222
+ return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
1223
+ } // Gets the maximum area that the element is visible in due to any number of
1224
+ // clipping ancestors
1225
+
1226
+
1227
+ function getClippingRect(_ref) {
1228
+ let {
1229
+ element,
1230
+ boundary,
1231
+ rootBoundary,
1232
+ strategy
1233
+ } = _ref;
1234
+ const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1235
+ const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1236
+ const firstClippingAncestor = clippingAncestors[0];
1237
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1238
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1239
+ accRect.top = max(rect.top, accRect.top);
1240
+ accRect.right = min(rect.right, accRect.right);
1241
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1242
+ accRect.left = max(rect.left, accRect.left);
1243
+ return accRect;
1244
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1245
+ return {
1246
+ width: clippingRect.right - clippingRect.left,
1247
+ height: clippingRect.bottom - clippingRect.top,
1248
+ x: clippingRect.left,
1249
+ y: clippingRect.top
1250
+ };
1251
+ }
1252
+
1253
+ const platform = {
1254
+ getClippingRect,
1255
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1256
+ isElement,
1257
+ getDimensions,
1258
+ getOffsetParent,
1259
+ getDocumentElement,
1260
+ getElementRects: _ref => {
1261
+ let {
1262
+ reference,
1263
+ floating,
1264
+ strategy
1265
+ } = _ref;
1266
+ return {
1267
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1268
+ floating: { ...getDimensions(floating),
1269
+ x: 0,
1270
+ y: 0
1271
+ }
1272
+ };
1273
+ },
1274
+ getClientRects: element => Array.from(element.getClientRects()),
1275
+ isRTL: element => getComputedStyle$1(element).direction === 'rtl'
1276
+ };
1277
+
1278
+ /**
1279
+ * Automatically updates the position of the floating element when necessary.
1280
+ * @see https://floating-ui.com/docs/autoUpdate
1281
+ */
1282
+ function autoUpdate(reference, floating, update, options) {
1283
+ if (options === void 0) {
1284
+ options = {};
1285
+ }
1286
+
1287
+ const {
1288
+ ancestorScroll: _ancestorScroll = true,
1289
+ ancestorResize: _ancestorResize = true,
1290
+ elementResize = true,
1291
+ animationFrame = false
1292
+ } = options;
1293
+ const ancestorScroll = _ancestorScroll && !animationFrame;
1294
+ const ancestorResize = _ancestorResize && !animationFrame;
1295
+ const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1296
+ ancestors.forEach(ancestor => {
1297
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1298
+ passive: true
1299
+ });
1300
+ ancestorResize && ancestor.addEventListener('resize', update);
1301
+ });
1302
+ let observer = null;
1303
+
1304
+ if (elementResize) {
1305
+ let initialUpdate = true;
1306
+ observer = new ResizeObserver(() => {
1307
+ if (!initialUpdate) {
1308
+ update();
1309
+ }
1310
+
1311
+ initialUpdate = false;
1312
+ });
1313
+ isElement(reference) && !animationFrame && observer.observe(reference);
1314
+ observer.observe(floating);
1315
+ }
1316
+
1317
+ let frameId;
1318
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1319
+
1320
+ if (animationFrame) {
1321
+ frameLoop();
1322
+ }
1323
+
1324
+ function frameLoop() {
1325
+ const nextRefRect = getBoundingClientRect(reference);
1326
+
1327
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1328
+ update();
1329
+ }
1330
+
1331
+ prevRefRect = nextRefRect;
1332
+ frameId = requestAnimationFrame(frameLoop);
1333
+ }
1334
+
1335
+ update();
1336
+ return () => {
1337
+ var _observer;
1338
+
1339
+ ancestors.forEach(ancestor => {
1340
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1341
+ ancestorResize && ancestor.removeEventListener('resize', update);
1342
+ });
1343
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
1344
+ observer = null;
1345
+
1346
+ if (animationFrame) {
1347
+ cancelAnimationFrame(frameId);
1348
+ }
1349
+ };
1350
+ }
1351
+
1352
+ /**
1353
+ * Computes the `x` and `y` coordinates that will place the floating element
1354
+ * next to a reference element when it is given a certain CSS positioning
1355
+ * strategy.
1356
+ */
1357
+
1358
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1359
+ platform,
1360
+ ...options
1361
+ });
1362
+
1363
+ var _Popup_instances, _Popup_arrowPosition_get, _Popup_padding_get, _Popup_distance_get, _Popup_middleware_get, _Popup_cleanup, _Popup_assignPopupPosition, _Popup_assignArrowPosition, _Popup_getAnchor, _Popup_handleKeydown;
1364
+ class Popup extends FoundationElement {
1365
+ constructor() {
1366
+ super(...arguments);
1367
+ _Popup_instances.add(this);
1368
+ _Popup_cleanup.set(this, void 0);
1369
+ this.open = false;
1370
+ this.dismissible = false;
1371
+ this.arrow = false;
1372
+ this.alternate = false;
1373
+ this.strategy = 'fixed';
1374
+ _Popup_handleKeydown.set(this, event => {
1375
+ if (event.key === keyEscape) {
1376
+ this.open = false;
1377
+ }
1378
+ });
1379
+ }
1380
+ openChanged(_, newValue) {
1381
+ newValue ? this.$emit('open') : this.$emit('close');
1382
+ }
1383
+ disconnectedCallback() {
1384
+ var _a, _b;
1385
+ super.disconnectedCallback();
1386
+ (_a = this.anchorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', __classPrivateFieldGet(this, _Popup_handleKeydown, "f"));
1387
+ (_b = __classPrivateFieldGet(this, _Popup_cleanup, "f")) === null || _b === void 0 ? void 0 : _b.call(this);
1388
+ }
1389
+ attributeChangedCallback(name, oldValue, newValue) {
1390
+ var _a, _b, _c;
1391
+ super.attributeChangedCallback(name, oldValue, newValue);
1392
+ switch (name) {
1393
+ case 'anchor':
1394
+ {
1395
+ (_a = this.anchorEl) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', __classPrivateFieldGet(this, _Popup_handleKeydown, "f"));
1396
+ this.anchorEl = __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_getAnchor).call(this);
1397
+ (_b = this.anchorEl) === null || _b === void 0 ? void 0 : _b.addEventListener('keydown', __classPrivateFieldGet(this, _Popup_handleKeydown, "f"));
1398
+ break;
1399
+ }
1400
+ }
1401
+ if (this.anchorEl && this.popupEl) {
1402
+ __classPrivateFieldSet(this, _Popup_cleanup, autoUpdate(this.anchorEl, this.popupEl, () => this.updatePosition()), "f");
1403
+ } else {
1404
+ (_c = __classPrivateFieldGet(this, _Popup_cleanup, "f")) === null || _c === void 0 ? void 0 : _c.call(this);
1405
+ }
1406
+ }
1407
+ async updatePosition() {
1408
+ if (!this.open || !this.anchorEl) {
1409
+ return;
1410
+ }
1411
+ const positionData = await computePosition(this.anchorEl, this.popupEl, {
1412
+ placement: this.placement,
1413
+ strategy: this.strategy,
1414
+ middleware: __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_middleware_get)
1415
+ });
1416
+ __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_assignPopupPosition).call(this, positionData);
1417
+ if (this.arrow) {
1418
+ __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_assignArrowPosition).call(this, positionData);
1419
+ }
1420
+ }
1421
+ }
1422
+ _Popup_cleanup = new WeakMap(), _Popup_handleKeydown = new WeakMap(), _Popup_instances = new WeakSet(), _Popup_arrowPosition_get = function _Popup_arrowPosition_get() {
1423
+ return {
1424
+ top: 'bottom',
1425
+ right: 'left',
1426
+ bottom: 'top',
1427
+ left: 'right'
1428
+ };
1429
+ }, _Popup_padding_get = function _Popup_padding_get() {
1430
+ return 0;
1431
+ }, _Popup_distance_get = function _Popup_distance_get() {
1432
+ return 12;
1433
+ }, _Popup_middleware_get = function _Popup_middleware_get() {
1434
+ const middleware = [flip(), hide(), inline()];
1435
+ if (this.arrow) {
1436
+ middleware.push(arrow({
1437
+ element: this.arrowEl,
1438
+ padding: __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_padding_get)
1439
+ }), offset(__classPrivateFieldGet(this, _Popup_instances, "a", _Popup_distance_get)));
1440
+ }
1441
+ return middleware;
1442
+ }, _Popup_assignPopupPosition = function _Popup_assignPopupPosition(data) {
1443
+ const {
1444
+ x: popupX,
1445
+ y: popupY
1446
+ } = data;
1447
+ const {
1448
+ referenceHidden
1449
+ } = data.middlewareData.hide;
1450
+ Object.assign(this.popupEl.style, {
1451
+ left: `${popupX}px`,
1452
+ top: `${popupY}px`,
1453
+ visibility: referenceHidden ? 'hidden' : 'visible'
1454
+ });
1455
+ }, _Popup_assignArrowPosition = function _Popup_assignArrowPosition(data) {
1456
+ const {
1457
+ x: arrowX,
1458
+ y: arrowY
1459
+ } = data.middlewareData.arrow;
1460
+ const side = __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_arrowPosition_get)[data.placement.split('-')[0]];
1461
+ Object.assign(this.arrowEl.style, {
1462
+ left: `${arrowX}px`,
1463
+ top: `${arrowY}px`,
1464
+ right: '',
1465
+ bottom: '',
1466
+ [side]: '-4px'
1467
+ });
1468
+ }, _Popup_getAnchor = function _Popup_getAnchor() {
1469
+ return this.anchor instanceof HTMLElement ? this.anchor : document.getElementById(this.anchor);
1470
+ };
1471
+ __decorate([attr({
1472
+ mode: 'boolean'
1473
+ }), __metadata("design:type", Object)], Popup.prototype, "open", void 0);
1474
+ __decorate([attr({
1475
+ mode: 'boolean'
1476
+ }), __metadata("design:type", Object)], Popup.prototype, "dismissible", void 0);
1477
+ __decorate([attr({
1478
+ mode: 'boolean'
1479
+ }), __metadata("design:type", Object)], Popup.prototype, "arrow", void 0);
1480
+ __decorate([attr({
1481
+ mode: 'boolean'
1482
+ }), __metadata("design:type", Object)], Popup.prototype, "alternate", void 0);
1483
+ __decorate([attr({
1484
+ mode: 'fromView'
1485
+ }), __metadata("design:type", String)], Popup.prototype, "placement", void 0);
1486
+ __decorate([attr({
1487
+ mode: 'fromView'
1488
+ }), __metadata("design:type", String)], Popup.prototype, "strategy", void 0);
1489
+ __decorate([attr, __metadata("design:type", Object)], Popup.prototype, "anchor", void 0);
1490
+
1491
+ var css_248z = ".control {\n background: var(--vvd-color-surface-4dp);\n border-radius: inherit;\n contain: layout;\n inline-size: var(--_popup-width, fit-content);\n}\n.control:not(.open) {\n display: none;\n}\n\n.popup-wrapper {\n border-radius: 6px;\n}\n.popup-wrapper:not(.absolute) {\n position: fixed;\n}\n.popup-wrapper.absolute {\n position: absolute;\n inline-size: var(--_popup-width);\n}\n\n.popup-content {\n display: grid;\n color: var(--vvd-color-canvas-text); /* neutral-100 */\n}\n.dismissible .popup-content {\n align-content: start;\n grid-template-columns: 1fr auto;\n}\n\n.arrow {\n position: absolute;\n z-index: -1;\n width: 8px;\n height: 8px;\n background: var(--vvd-color-surface-4dp);\n transform: rotate(45deg);\n}\n\n.dismissible-button {\n align-self: flex-start;\n margin-block-start: 4px;\n margin-inline-end: 4px;\n}";
1492
+
1493
+ let _ = t => t,
1494
+ _t,
1495
+ _t2,
1496
+ _t3;
1497
+ const getClasses = ({
1498
+ open,
1499
+ dismissible,
1500
+ alternate
1501
+ }) => classNames('control', ['open', Boolean(open)], ['dismissible', Boolean(dismissible)], ['alternate', Boolean(alternate)]);
1502
+ const popupTemplate = context => {
1503
+ const elevationTag = context.tagFor(Elevation);
1504
+ const buttonTag = context.tagFor(Button);
1505
+ return html(_t || (_t = _`
1506
+ <${0}>
1507
+ <div class="popup-wrapper ${0}" ${0}>
1508
+ <div class="${0}" aria-hidden="${0}"
1509
+ part="${0}">
1510
+ <div class="popup-content">
1511
+ <slot></slot>
1512
+ ${0}
1513
+ </div>
1514
+ ${0}
1515
+ </div>
1516
+ </div>
1517
+ </${0}>`), elevationTag, x => x.strategy, ref('popupEl'), getClasses, x => x.open ? 'false' : 'true', x => x.alternate ? 'vvd-theme-alternate' : '', when(x => x.dismissible, html(_t2 || (_t2 = _`<${0} size="condensed" @click="${0}"
1518
+ class="dismissible-button" icon="close-small-solid" shape="pill"></${0}>`), buttonTag, x => x.open = false, buttonTag)), when(x => x.arrow, html(_t3 || (_t3 = _`<div class="arrow" ${0}></div>`), ref('arrowEl'))), elevationTag);
1519
+ };
1520
+
1521
+ const popup = Popup.compose({
1522
+ baseName: 'popup',
1523
+ template: popupTemplate,
1524
+ styles: css_248z
1525
+ })();
1526
+ const popupElements = [popup, ...elevationElements, ...buttonElements];
1527
+ const registerPopup = registerFactorial(popupElements);
1528
+
1529
+ export { Popup as P, popup as a, popupElements as p, registerPopup as r };