@vonage/vivid 3.32.0 → 3.35.0

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 (221) hide show
  1. package/accordion/index.js +5 -5
  2. package/accordion-item/index.js +4 -4
  3. package/action-group/index.js +1 -1
  4. package/alert/index.js +6 -6
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +5 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +4 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +3 -3
  14. package/checkbox/index.js +5 -3
  15. package/combobox/index.js +8 -8
  16. package/custom-elements.json +256 -18
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +9 -9
  19. package/dialog/index.js +6 -6
  20. package/divider/index.js +1 -1
  21. package/elevation/index.js +1 -1
  22. package/empty-state/index.js +2 -2
  23. package/fab/index.js +4 -4
  24. package/file-picker/index.js +5 -5
  25. package/focus/index.js +1 -1
  26. package/header/index.js +2 -2
  27. package/icon/index.js +1 -1
  28. package/index.js +59 -59
  29. package/layout/index.js +1 -1
  30. package/lib/avatar/avatar.d.ts +1 -1
  31. package/lib/calendar/calendar.d.ts +1 -1
  32. package/lib/date-picker/calendar/dateStr.d.ts +1 -0
  33. package/lib/date-picker/calendar/month.d.ts +1 -0
  34. package/lib/date-picker/calendar/year.d.ts +2 -0
  35. package/lib/date-picker/date-picker.d.ts +2 -0
  36. package/lib/icon/icon.d.ts +0 -1
  37. package/lib/listbox/listbox.d.ts +9 -1
  38. package/lib/progress-ring/progress-ring.d.ts +1 -1
  39. package/lib/text-field/text-field.d.ts +1 -0
  40. package/listbox/index.js +20 -16
  41. package/locales/en-GB.js +48 -14
  42. package/locales/en-US.js +48 -14
  43. package/locales/ja-JP.js +48 -14
  44. package/locales/zh-CN.js +48 -14
  45. package/menu/index.js +8 -8
  46. package/menu-item/index.js +4 -4
  47. package/nav/index.js +1 -1
  48. package/nav-disclosure/index.js +3 -3
  49. package/nav-item/index.js +3 -3
  50. package/note/index.js +2 -3
  51. package/number-field/index.js +6 -6
  52. package/option/index.js +3 -3
  53. package/package.json +2 -16
  54. package/pagination/index.js +5 -5
  55. package/popup/index.js +6 -6
  56. package/progress/index.js +1 -1
  57. package/progress-ring/index.js +1 -1
  58. package/radio/index.js +2 -2
  59. package/radio-group/index.js +1 -1
  60. package/select/index.js +8 -8
  61. package/shared/affix.js +25 -9
  62. package/shared/apply-mixins.js +1 -1
  63. package/shared/breadcrumb-item.js +5 -5
  64. package/shared/button.js +13 -13
  65. package/shared/calendar-event.js +36 -16
  66. package/shared/definition.js +133 -194
  67. package/shared/definition10.js +225 -40
  68. package/shared/definition11.js +36 -32
  69. package/shared/definition12.js +763 -98
  70. package/shared/definition13.js +125 -89
  71. package/shared/definition14.js +207 -27
  72. package/shared/definition15.js +710 -731
  73. package/shared/definition16.js +1289 -47
  74. package/shared/definition17.js +6113 -93
  75. package/shared/definition18.js +242 -164
  76. package/shared/definition19.js +47 -692
  77. package/shared/definition2.js +199 -117
  78. package/shared/definition20.js +59 -1671
  79. package/shared/definition21.js +95 -255
  80. package/shared/definition22.js +2218 -1167
  81. package/shared/definition23.js +61 -5784
  82. package/shared/definition24.js +28 -117
  83. package/shared/definition25.js +52 -66
  84. package/shared/definition26.js +391 -214
  85. package/shared/definition27.js +441 -34
  86. package/shared/definition28.js +85 -73
  87. package/shared/definition29.js +21 -2283
  88. package/shared/definition3.js +61 -24
  89. package/shared/definition30.js +13 -49
  90. package/shared/definition31.js +54 -39
  91. package/shared/definition32.js +413 -375
  92. package/shared/definition33.js +223 -304
  93. package/shared/definition34.js +197 -13
  94. package/shared/definition35.js +88 -73
  95. package/shared/definition36.js +75 -25
  96. package/shared/definition37.js +434 -34
  97. package/shared/definition38.js +32 -432
  98. package/shared/definition39.js +677 -187
  99. package/shared/definition4.js +157 -12
  100. package/shared/definition40.js +95 -48
  101. package/shared/definition41.js +577 -31
  102. package/shared/definition42.js +126 -424
  103. package/shared/definition43.js +114 -618
  104. package/shared/definition44.js +24 -80
  105. package/shared/definition45.js +71 -543
  106. package/shared/definition46.js +499 -92
  107. package/shared/definition47.js +19 -133
  108. package/shared/definition48.js +129 -52
  109. package/shared/definition49.js +281 -17
  110. package/shared/definition5.js +71 -36
  111. package/shared/definition50.js +153 -484
  112. package/shared/definition51.js +131 -98
  113. package/shared/definition52.js +131 -16
  114. package/shared/definition53.js +80 -264
  115. package/shared/definition54.js +293 -118
  116. package/shared/definition55.js +12 -117
  117. package/shared/definition56.js +39 -68
  118. package/shared/definition57.js +166 -288
  119. package/shared/definition6.js +56 -111
  120. package/shared/definition7.js +120 -195
  121. package/shared/definition8.js +58 -23
  122. package/shared/definition9.js +92 -66
  123. package/shared/focus.js +2 -1
  124. package/shared/focus2.js +1 -1
  125. package/shared/form-associated.js +2 -2
  126. package/shared/icon.js +48 -27
  127. package/shared/index.js +7 -27
  128. package/shared/index2.js +108 -80
  129. package/shared/key-codes.js +1 -1
  130. package/shared/listbox.js +88 -11
  131. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  132. package/shared/radio.js +23 -7
  133. package/shared/repeat.js +1 -1
  134. package/shared/text-anchor.js +21 -4
  135. package/shared/text-anchor.template.js +37 -40
  136. package/shared/text-field.js +2 -2
  137. package/shared/text-field2.js +15 -15
  138. package/shared/tree-item.js +12 -12
  139. package/side-drawer/index.js +1 -1
  140. package/slider/index.js +2 -2
  141. package/split-button/index.js +3 -3
  142. package/style.css +6106 -0
  143. package/styles/core/all.css +1 -1
  144. package/styles/core/theme.css +1 -1
  145. package/styles/core/typography.css +1 -1
  146. package/styles/tokens/theme-dark.css +4 -4
  147. package/styles/tokens/theme-light.css +4 -4
  148. package/styles/tokens/vivid-2-compat.css +1 -1
  149. package/switch/index.js +3 -3
  150. package/tab/index.js +3 -3
  151. package/tab-panel/index.js +1 -1
  152. package/tabs/index.js +5 -5
  153. package/tag/index.js +3 -3
  154. package/tag-group/index.js +1 -1
  155. package/text-anchor/index.js +1 -1
  156. package/text-area/index.js +3 -3
  157. package/text-field/index.js +3 -3
  158. package/toggletip/index.js +7 -7
  159. package/tooltip/index.js +7 -7
  160. package/tree-item/index.js +3 -3
  161. package/tree-view/index.js +1 -1
  162. package/vivid.api.json +10 -1
  163. package/lib/accordion/index.d.ts +0 -1
  164. package/lib/accordion-item/index.d.ts +0 -1
  165. package/lib/action-group/index.d.ts +0 -1
  166. package/lib/alert/index.d.ts +0 -1
  167. package/lib/avatar/index.d.ts +0 -1
  168. package/lib/badge/index.d.ts +0 -1
  169. package/lib/banner/index.d.ts +0 -1
  170. package/lib/breadcrumb/index.d.ts +0 -1
  171. package/lib/breadcrumb-item/index.d.ts +0 -1
  172. package/lib/button/index.d.ts +0 -1
  173. package/lib/calendar/index.d.ts +0 -1
  174. package/lib/calendar-event/index.d.ts +0 -1
  175. package/lib/card/index.d.ts +0 -1
  176. package/lib/checkbox/index.d.ts +0 -1
  177. package/lib/combobox/index.d.ts +0 -1
  178. package/lib/data-grid/index.d.ts +0 -1
  179. package/lib/date-picker/index.d.ts +0 -1
  180. package/lib/dialog/index.d.ts +0 -1
  181. package/lib/divider/index.d.ts +0 -1
  182. package/lib/elevation/index.d.ts +0 -1
  183. package/lib/empty-state/index.d.ts +0 -1
  184. package/lib/fab/index.d.ts +0 -1
  185. package/lib/file-picker/index.d.ts +0 -1
  186. package/lib/focus/index.d.ts +0 -1
  187. package/lib/header/index.d.ts +0 -1
  188. package/lib/icon/index.d.ts +0 -1
  189. package/lib/layout/index.d.ts +0 -1
  190. package/lib/listbox/index.d.ts +0 -1
  191. package/lib/menu/index.d.ts +0 -1
  192. package/lib/menu-item/index.d.ts +0 -1
  193. package/lib/nav/index.d.ts +0 -1
  194. package/lib/nav-disclosure/index.d.ts +0 -1
  195. package/lib/nav-item/index.d.ts +0 -1
  196. package/lib/note/index.d.ts +0 -1
  197. package/lib/number-field/index.d.ts +0 -1
  198. package/lib/option/index.d.ts +0 -1
  199. package/lib/pagination/index.d.ts +0 -1
  200. package/lib/popup/index.d.ts +0 -1
  201. package/lib/progress/index.d.ts +0 -1
  202. package/lib/progress-ring/index.d.ts +0 -1
  203. package/lib/radio/index.d.ts +0 -1
  204. package/lib/radio-group/index.d.ts +0 -1
  205. package/lib/select/index.d.ts +0 -1
  206. package/lib/side-drawer/index.d.ts +0 -1
  207. package/lib/slider/index.d.ts +0 -1
  208. package/lib/split-button/index.d.ts +0 -1
  209. package/lib/switch/index.d.ts +0 -1
  210. package/lib/tab/index.d.ts +0 -1
  211. package/lib/tab-panel/index.d.ts +0 -1
  212. package/lib/tabs/index.d.ts +0 -1
  213. package/lib/tag/index.d.ts +0 -1
  214. package/lib/tag-group/index.d.ts +0 -1
  215. package/lib/text-anchor/index.d.ts +0 -1
  216. package/lib/text-area/index.d.ts +0 -1
  217. package/lib/text-field/index.d.ts +0 -1
  218. package/lib/toggletip/index.d.ts +0 -1
  219. package/lib/tooltip/index.d.ts +0 -1
  220. package/lib/tree-item/index.d.ts +0 -1
  221. package/lib/tree-view/index.d.ts +0 -1
@@ -1,1682 +1,70 @@
1
- import { F as FoundationElement, d as __classPrivateFieldGet, f as __classPrivateFieldSet, _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { B as Button, b as buttonRegistries } from './definition7.js';
3
- import { E as Elevation, e as elevationRegistries } from './definition8.js';
4
- import { r as ref } from './ref.js';
1
+ import { F as FoundationElement, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition24.js';
3
+ import { I as Icon } from './icon.js';
5
4
  import { w as when } from './when.js';
5
+ import { s as slotted } from './slotted.js';
6
6
  import { c as classNames } from './class-names.js';
7
7
 
8
- function getAlignment(placement) {
9
- return placement.split('-')[1];
10
- }
11
-
12
- function getLengthFromAxis(axis) {
13
- return axis === 'y' ? 'height' : 'width';
14
- }
15
-
16
- function getSide(placement) {
17
- return placement.split('-')[0];
18
- }
19
-
20
- function getMainAxisFromPlacement(placement) {
21
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
22
- }
23
-
24
- function computeCoordsFromPlacement(_ref, placement, rtl) {
25
- let {
26
- reference,
27
- floating
28
- } = _ref;
29
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
30
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
31
- const mainAxis = getMainAxisFromPlacement(placement);
32
- const length = getLengthFromAxis(mainAxis);
33
- const commonAlign = reference[length] / 2 - floating[length] / 2;
34
- const side = getSide(placement);
35
- const isVertical = mainAxis === 'x';
36
- let coords;
37
- switch (side) {
38
- case 'top':
39
- coords = {
40
- x: commonX,
41
- y: reference.y - floating.height
42
- };
43
- break;
44
- case 'bottom':
45
- coords = {
46
- x: commonX,
47
- y: reference.y + reference.height
48
- };
49
- break;
50
- case 'right':
51
- coords = {
52
- x: reference.x + reference.width,
53
- y: commonY
54
- };
55
- break;
56
- case 'left':
57
- coords = {
58
- x: reference.x - floating.width,
59
- y: commonY
60
- };
61
- break;
62
- default:
63
- coords = {
64
- x: reference.x,
65
- y: reference.y
66
- };
67
- }
68
- switch (getAlignment(placement)) {
69
- case 'start':
70
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
71
- break;
72
- case 'end':
73
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
74
- break;
75
- }
76
- return coords;
77
- }
78
-
79
- /**
80
- * Computes the `x` and `y` coordinates that will place the floating element
81
- * next to a reference element when it is given a certain positioning strategy.
82
- *
83
- * This export does not have any `platform` interface logic. You will need to
84
- * write one for the platform you are using Floating UI with.
85
- */
86
- const computePosition$1 = async (reference, floating, config) => {
87
- const {
88
- placement = 'bottom',
89
- strategy = 'absolute',
90
- middleware = [],
91
- platform
92
- } = config;
93
- const validMiddleware = middleware.filter(Boolean);
94
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
95
- let rects = await platform.getElementRects({
96
- reference,
97
- floating,
98
- strategy
99
- });
100
- let {
101
- x,
102
- y
103
- } = computeCoordsFromPlacement(rects, placement, rtl);
104
- let statefulPlacement = placement;
105
- let middlewareData = {};
106
- let resetCount = 0;
107
- for (let i = 0; i < validMiddleware.length; i++) {
108
- const {
109
- name,
110
- fn
111
- } = validMiddleware[i];
112
- const {
113
- x: nextX,
114
- y: nextY,
115
- data,
116
- reset
117
- } = await fn({
118
- x,
119
- y,
120
- initialPlacement: placement,
121
- placement: statefulPlacement,
122
- strategy,
123
- middlewareData,
124
- rects,
125
- platform,
126
- elements: {
127
- reference,
128
- floating
129
- }
130
- });
131
- x = nextX != null ? nextX : x;
132
- y = nextY != null ? nextY : y;
133
- middlewareData = {
134
- ...middlewareData,
135
- [name]: {
136
- ...middlewareData[name],
137
- ...data
138
- }
139
- };
140
- if (reset && resetCount <= 50) {
141
- resetCount++;
142
- if (typeof reset === 'object') {
143
- if (reset.placement) {
144
- statefulPlacement = reset.placement;
145
- }
146
- if (reset.rects) {
147
- rects = reset.rects === true ? await platform.getElementRects({
148
- reference,
149
- floating,
150
- strategy
151
- }) : reset.rects;
152
- }
153
- ({
154
- x,
155
- y
156
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
157
- }
158
- i = -1;
159
- continue;
160
- }
161
- }
162
- return {
163
- x,
164
- y,
165
- placement: statefulPlacement,
166
- strategy,
167
- middlewareData
168
- };
169
- };
170
-
171
- function evaluate(value, param) {
172
- return typeof value === 'function' ? value(param) : value;
173
- }
174
-
175
- function expandPaddingObject(padding) {
176
- return {
177
- top: 0,
178
- right: 0,
179
- bottom: 0,
180
- left: 0,
181
- ...padding
182
- };
183
- }
184
-
185
- function getSideObjectFromPadding(padding) {
186
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
187
- top: padding,
188
- right: padding,
189
- bottom: padding,
190
- left: padding
191
- };
192
- }
193
-
194
- function rectToClientRect(rect) {
195
- return {
196
- ...rect,
197
- top: rect.y,
198
- left: rect.x,
199
- right: rect.x + rect.width,
200
- bottom: rect.y + rect.height
201
- };
202
- }
203
-
204
- /**
205
- * Resolves with an object of overflow side offsets that determine how much the
206
- * element is overflowing a given clipping boundary on each side.
207
- * - positive = overflowing the boundary by that number of pixels
208
- * - negative = how many pixels left before it will overflow
209
- * - 0 = lies flush with the boundary
210
- * @see https://floating-ui.com/docs/detectOverflow
211
- */
212
- async function detectOverflow(state, options) {
213
- var _await$platform$isEle;
214
- if (options === void 0) {
215
- options = {};
216
- }
217
- const {
218
- x,
219
- y,
220
- platform,
221
- rects,
222
- elements,
223
- strategy
224
- } = state;
225
- const {
226
- boundary = 'clippingAncestors',
227
- rootBoundary = 'viewport',
228
- elementContext = 'floating',
229
- altBoundary = false,
230
- padding = 0
231
- } = evaluate(options, state);
232
- const paddingObject = getSideObjectFromPadding(padding);
233
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
234
- const element = elements[altBoundary ? altContext : elementContext];
235
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
236
- 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))),
237
- boundary,
238
- rootBoundary,
239
- strategy
240
- }));
241
- const rect = elementContext === 'floating' ? {
242
- ...rects.floating,
243
- x,
244
- y
245
- } : rects.reference;
246
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
247
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
248
- x: 1,
249
- y: 1
250
- } : {
251
- x: 1,
252
- y: 1
253
- };
254
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
255
- rect,
256
- offsetParent,
257
- strategy
258
- }) : rect);
259
- return {
260
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
261
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
262
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
263
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
264
- };
265
- }
266
-
267
- const min$1 = Math.min;
268
- const max$1 = Math.max;
269
-
270
- function within(min$1$1, value, max$1$1) {
271
- return max$1(min$1$1, min$1(value, max$1$1));
272
- }
273
-
274
- /**
275
- * Provides data to position an inner element of the floating element so that it
276
- * appears centered to the reference element.
277
- * @see https://floating-ui.com/docs/arrow
278
- */
279
- const arrow = options => ({
280
- name: 'arrow',
281
- options,
282
- async fn(state) {
283
- const {
284
- x,
285
- y,
286
- placement,
287
- rects,
288
- platform,
289
- elements
290
- } = state;
291
- // Since `element` is required, we don't Partial<> the type.
292
- const {
293
- element,
294
- padding = 0
295
- } = evaluate(options, state) || {};
296
- if (element == null) {
297
- return {};
298
- }
299
- const paddingObject = getSideObjectFromPadding(padding);
300
- const coords = {
301
- x,
302
- y
303
- };
304
- const axis = getMainAxisFromPlacement(placement);
305
- const length = getLengthFromAxis(axis);
306
- const arrowDimensions = await platform.getDimensions(element);
307
- const isYAxis = axis === 'y';
308
- const minProp = isYAxis ? 'top' : 'left';
309
- const maxProp = isYAxis ? 'bottom' : 'right';
310
- const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
311
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
312
- const startDiff = coords[axis] - rects.reference[axis];
313
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
314
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
315
-
316
- // DOM platform can return `window` as the `offsetParent`.
317
- if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
318
- clientSize = elements.floating[clientProp] || rects.floating[length];
319
- }
320
- const centerToReference = endDiff / 2 - startDiff / 2;
321
-
322
- // If the padding is large enough that it causes the arrow to no longer be
323
- // centered, modify the padding so that it is centered.
324
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
325
- const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
326
- const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
327
-
328
- // Make sure the arrow doesn't overflow the floating element if the center
329
- // point is outside the floating element's bounds.
330
- const min$1$1 = minPadding;
331
- const max = clientSize - arrowDimensions[length] - maxPadding;
332
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
333
- const offset = within(min$1$1, center, max);
334
-
335
- // If the reference is small enough that the arrow's padding causes it to
336
- // to point to nothing for an aligned placement, adjust the offset of the
337
- // floating element itself. This stops `shift()` from taking action, but can
338
- // be worked around by calling it again after the `arrow()` if desired.
339
- const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
340
- const alignmentOffset = shouldAddOffset ? center < min$1$1 ? min$1$1 - center : max - center : 0;
341
- return {
342
- [axis]: coords[axis] - alignmentOffset,
343
- data: {
344
- [axis]: offset,
345
- centerOffset: center - offset + alignmentOffset
346
- }
347
- };
348
- }
349
- });
350
-
351
- const sides = ['top', 'right', 'bottom', 'left'];
352
-
353
- const oppositeSideMap = {
354
- left: 'right',
355
- right: 'left',
356
- bottom: 'top',
357
- top: 'bottom'
358
- };
359
- function getOppositePlacement(placement) {
360
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
361
- }
362
-
363
- function getAlignmentSides(placement, rects, rtl) {
364
- if (rtl === void 0) {
365
- rtl = false;
366
- }
367
- const alignment = getAlignment(placement);
368
- const mainAxis = getMainAxisFromPlacement(placement);
369
- const length = getLengthFromAxis(mainAxis);
370
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
371
- if (rects.reference[length] > rects.floating[length]) {
372
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
373
- }
374
- return {
375
- main: mainAlignmentSide,
376
- cross: getOppositePlacement(mainAlignmentSide)
377
- };
378
- }
379
-
380
- const oppositeAlignmentMap = {
381
- start: 'end',
382
- end: 'start'
383
- };
384
- function getOppositeAlignmentPlacement(placement) {
385
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
386
- }
387
-
388
- function getExpandedPlacements(placement) {
389
- const oppositePlacement = getOppositePlacement(placement);
390
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
391
- }
392
-
393
- function getSideList(side, isStart, rtl) {
394
- const lr = ['left', 'right'];
395
- const rl = ['right', 'left'];
396
- const tb = ['top', 'bottom'];
397
- const bt = ['bottom', 'top'];
398
- switch (side) {
399
- case 'top':
400
- case 'bottom':
401
- if (rtl) return isStart ? rl : lr;
402
- return isStart ? lr : rl;
403
- case 'left':
404
- case 'right':
405
- return isStart ? tb : bt;
406
- default:
407
- return [];
408
- }
409
- }
410
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
411
- const alignment = getAlignment(placement);
412
- let list = getSideList(getSide(placement), direction === 'start', rtl);
413
- if (alignment) {
414
- list = list.map(side => side + "-" + alignment);
415
- if (flipAlignment) {
416
- list = list.concat(list.map(getOppositeAlignmentPlacement));
417
- }
418
- }
419
- return list;
420
- }
421
-
422
- /**
423
- * Optimizes the visibility of the floating element by flipping the `placement`
424
- * in order to keep it in view when the preferred placement(s) will overflow the
425
- * clipping boundary. Alternative to `autoPlacement`.
426
- * @see https://floating-ui.com/docs/flip
427
- */
428
- const flip = function (options) {
429
- if (options === void 0) {
430
- options = {};
431
- }
432
- return {
433
- name: 'flip',
434
- options,
435
- async fn(state) {
436
- var _middlewareData$flip;
437
- const {
438
- placement,
439
- middlewareData,
440
- rects,
441
- initialPlacement,
442
- platform,
443
- elements
444
- } = state;
445
- const {
446
- mainAxis: checkMainAxis = true,
447
- crossAxis: checkCrossAxis = true,
448
- fallbackPlacements: specifiedFallbackPlacements,
449
- fallbackStrategy = 'bestFit',
450
- fallbackAxisSideDirection = 'none',
451
- flipAlignment = true,
452
- ...detectOverflowOptions
453
- } = evaluate(options, state);
454
- const side = getSide(placement);
455
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
456
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
457
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
458
- if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
459
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
460
- }
461
- const placements = [initialPlacement, ...fallbackPlacements];
462
- const overflow = await detectOverflow(state, detectOverflowOptions);
463
- const overflows = [];
464
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
465
- if (checkMainAxis) {
466
- overflows.push(overflow[side]);
467
- }
468
- if (checkCrossAxis) {
469
- const {
470
- main,
471
- cross
472
- } = getAlignmentSides(placement, rects, rtl);
473
- overflows.push(overflow[main], overflow[cross]);
474
- }
475
- overflowsData = [...overflowsData, {
476
- placement,
477
- overflows
478
- }];
479
-
480
- // One or more sides is overflowing.
481
- if (!overflows.every(side => side <= 0)) {
482
- var _middlewareData$flip2, _overflowsData$filter;
483
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
484
- const nextPlacement = placements[nextIndex];
485
- if (nextPlacement) {
486
- // Try next placement and re-run the lifecycle.
487
- return {
488
- data: {
489
- index: nextIndex,
490
- overflows: overflowsData
491
- },
492
- reset: {
493
- placement: nextPlacement
494
- }
495
- };
496
- }
497
-
498
- // First, find the candidates that fit on the mainAxis side of overflow,
499
- // then find the placement that fits the best on the main crossAxis side.
500
- let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
501
-
502
- // Otherwise fallback.
503
- if (!resetPlacement) {
504
- switch (fallbackStrategy) {
505
- case 'bestFit':
506
- {
507
- var _overflowsData$map$so;
508
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, 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];
509
- if (placement) {
510
- resetPlacement = placement;
511
- }
512
- break;
513
- }
514
- case 'initialPlacement':
515
- resetPlacement = initialPlacement;
516
- break;
517
- }
518
- }
519
- if (placement !== resetPlacement) {
520
- return {
521
- reset: {
522
- placement: resetPlacement
523
- }
524
- };
525
- }
526
- }
527
- return {};
528
- }
529
- };
530
- };
531
-
532
- function getSideOffsets(overflow, rect) {
533
- return {
534
- top: overflow.top - rect.height,
535
- right: overflow.right - rect.width,
536
- bottom: overflow.bottom - rect.height,
537
- left: overflow.left - rect.width
538
- };
539
- }
540
- function isAnySideFullyClipped(overflow) {
541
- return sides.some(side => overflow[side] >= 0);
542
- }
543
- /**
544
- * Provides data to hide the floating element in applicable situations, such as
545
- * when it is not in the same clipping context as the reference element.
546
- * @see https://floating-ui.com/docs/hide
547
- */
548
- const hide = function (options) {
549
- if (options === void 0) {
550
- options = {};
551
- }
552
- return {
553
- name: 'hide',
554
- options,
555
- async fn(state) {
556
- const {
557
- rects
558
- } = state;
559
- const {
560
- strategy = 'referenceHidden',
561
- ...detectOverflowOptions
562
- } = evaluate(options, state);
563
- switch (strategy) {
564
- case 'referenceHidden':
565
- {
566
- const overflow = await detectOverflow(state, {
567
- ...detectOverflowOptions,
568
- elementContext: 'reference'
569
- });
570
- const offsets = getSideOffsets(overflow, rects.reference);
571
- return {
572
- data: {
573
- referenceHiddenOffsets: offsets,
574
- referenceHidden: isAnySideFullyClipped(offsets)
575
- }
576
- };
577
- }
578
- case 'escaped':
579
- {
580
- const overflow = await detectOverflow(state, {
581
- ...detectOverflowOptions,
582
- altBoundary: true
583
- });
584
- const offsets = getSideOffsets(overflow, rects.floating);
585
- return {
586
- data: {
587
- escapedOffsets: offsets,
588
- escaped: isAnySideFullyClipped(offsets)
589
- }
590
- };
591
- }
592
- default:
593
- {
594
- return {};
595
- }
596
- }
597
- }
598
- };
599
- };
600
-
601
- function getBoundingRect(rects) {
602
- const minX = min$1(...rects.map(rect => rect.left));
603
- const minY = min$1(...rects.map(rect => rect.top));
604
- const maxX = max$1(...rects.map(rect => rect.right));
605
- const maxY = max$1(...rects.map(rect => rect.bottom));
606
- return {
607
- x: minX,
608
- y: minY,
609
- width: maxX - minX,
610
- height: maxY - minY
611
- };
612
- }
613
- function getRectsByLine(rects) {
614
- const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
615
- const groups = [];
616
- let prevRect = null;
617
- for (let i = 0; i < sortedRects.length; i++) {
618
- const rect = sortedRects[i];
619
- if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
620
- groups.push([rect]);
621
- } else {
622
- groups[groups.length - 1].push(rect);
623
- }
624
- prevRect = rect;
625
- }
626
- return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
627
- }
628
- /**
629
- * Provides improved positioning for inline reference elements that can span
630
- * over multiple lines, such as hyperlinks or range selections.
631
- * @see https://floating-ui.com/docs/inline
632
- */
633
- const inline = function (options) {
634
- if (options === void 0) {
635
- options = {};
636
- }
637
- return {
638
- name: 'inline',
639
- options,
640
- async fn(state) {
641
- const {
642
- placement,
643
- elements,
644
- rects,
645
- platform,
646
- strategy
647
- } = state;
648
- // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
649
- // ClientRect's bounds, despite the event listener being triggered. A
650
- // padding of 2 seems to handle this issue.
651
- const {
652
- padding = 2,
653
- x,
654
- y
655
- } = evaluate(options, state);
656
- const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
657
- const clientRects = getRectsByLine(nativeClientRects);
658
- const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
659
- const paddingObject = getSideObjectFromPadding(padding);
660
- function getBoundingClientRect() {
661
- // There are two rects and they are disjoined.
662
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
663
- // Find the first rect in which the point is fully inside.
664
- return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
665
- }
666
-
667
- // There are 2 or more connected rects.
668
- if (clientRects.length >= 2) {
669
- if (getMainAxisFromPlacement(placement) === 'x') {
670
- const firstRect = clientRects[0];
671
- const lastRect = clientRects[clientRects.length - 1];
672
- const isTop = getSide(placement) === 'top';
673
- const top = firstRect.top;
674
- const bottom = lastRect.bottom;
675
- const left = isTop ? firstRect.left : lastRect.left;
676
- const right = isTop ? firstRect.right : lastRect.right;
677
- const width = right - left;
678
- const height = bottom - top;
679
- return {
680
- top,
681
- bottom,
682
- left,
683
- right,
684
- width,
685
- height,
686
- x: left,
687
- y: top
688
- };
689
- }
690
- const isLeftSide = getSide(placement) === 'left';
691
- const maxRight = max$1(...clientRects.map(rect => rect.right));
692
- const minLeft = min$1(...clientRects.map(rect => rect.left));
693
- const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
694
- const top = measureRects[0].top;
695
- const bottom = measureRects[measureRects.length - 1].bottom;
696
- const left = minLeft;
697
- const right = maxRight;
698
- const width = right - left;
699
- const height = bottom - top;
700
- return {
701
- top,
702
- bottom,
703
- left,
704
- right,
705
- width,
706
- height,
707
- x: left,
708
- y: top
709
- };
710
- }
711
- return fallback;
712
- }
713
- const resetRects = await platform.getElementRects({
714
- reference: {
715
- getBoundingClientRect
716
- },
717
- floating: elements.floating,
718
- strategy
719
- });
720
- 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) {
721
- return {
722
- reset: {
723
- rects: resetRects
724
- }
725
- };
726
- }
727
- return {};
728
- }
729
- };
730
- };
731
-
732
- async function convertValueToCoords(state, options) {
733
- const {
734
- placement,
735
- platform,
736
- elements
737
- } = state;
738
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
739
- const side = getSide(placement);
740
- const alignment = getAlignment(placement);
741
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
742
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
743
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
744
- const rawValue = evaluate(options, state);
745
-
746
- // eslint-disable-next-line prefer-const
747
- let {
748
- mainAxis,
749
- crossAxis,
750
- alignmentAxis
751
- } = typeof rawValue === 'number' ? {
752
- mainAxis: rawValue,
753
- crossAxis: 0,
754
- alignmentAxis: null
755
- } : {
756
- mainAxis: 0,
757
- crossAxis: 0,
758
- alignmentAxis: null,
759
- ...rawValue
760
- };
761
- if (alignment && typeof alignmentAxis === 'number') {
762
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
763
- }
764
- return isVertical ? {
765
- x: crossAxis * crossAxisMulti,
766
- y: mainAxis * mainAxisMulti
767
- } : {
768
- x: mainAxis * mainAxisMulti,
769
- y: crossAxis * crossAxisMulti
770
- };
771
- }
772
-
773
- /**
774
- * Modifies the placement by translating the floating element along the
775
- * specified axes.
776
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
777
- * object may be passed.
778
- * @see https://floating-ui.com/docs/offset
779
- */
780
- const offset = function (options) {
781
- if (options === void 0) {
782
- options = 0;
783
- }
784
- return {
785
- name: 'offset',
786
- options,
787
- async fn(state) {
788
- const {
789
- x,
790
- y
791
- } = state;
792
- const diffCoords = await convertValueToCoords(state, options);
793
- return {
794
- x: x + diffCoords.x,
795
- y: y + diffCoords.y,
796
- data: diffCoords
797
- };
798
- }
799
- };
800
- };
801
-
802
- function getWindow(node) {
803
- var _node$ownerDocument;
804
- return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
805
- }
806
-
807
- function getComputedStyle$1(element) {
808
- return getWindow(element).getComputedStyle(element);
809
- }
810
-
811
- function isNode(value) {
812
- return value instanceof getWindow(value).Node;
813
- }
814
- function getNodeName(node) {
815
- if (isNode(node)) {
816
- return (node.nodeName || '').toLowerCase();
817
- }
818
- // Mocked nodes in testing environments may not be instances of Node. By
819
- // returning `#document` an infinite loop won't occur.
820
- // https://github.com/floating-ui/floating-ui/issues/2317
821
- return '#document';
822
- }
823
-
824
- function isHTMLElement(value) {
825
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
826
- }
827
- function isShadowRoot(node) {
828
- // Browsers without `ShadowRoot` support.
829
- if (typeof ShadowRoot === 'undefined') {
830
- return false;
831
- }
832
- return node instanceof getWindow(node).ShadowRoot || node instanceof ShadowRoot;
833
- }
834
- function isOverflowElement(element) {
835
- const {
836
- overflow,
837
- overflowX,
838
- overflowY,
839
- display
840
- } = getComputedStyle$1(element);
841
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
842
- }
843
- function isTableElement(element) {
844
- return ['table', 'td', 'th'].includes(getNodeName(element));
845
- }
846
- function isContainingBlock(element) {
847
- const safari = isSafari();
848
- const css = getComputedStyle$1(element);
849
-
850
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
851
- return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !safari && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !safari && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
852
- }
853
- function isSafari() {
854
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
855
- return CSS.supports('-webkit-backdrop-filter', 'none');
856
- }
857
- function isLastTraversableNode(node) {
858
- return ['html', 'body', '#document'].includes(getNodeName(node));
859
- }
860
-
861
- const min = Math.min;
862
- const max = Math.max;
863
- const round = Math.round;
864
- const floor = Math.floor;
865
- const createCoords = v => ({
866
- x: v,
867
- y: v
868
- });
869
-
870
- function getCssDimensions(element) {
871
- const css = getComputedStyle$1(element);
872
- // In testing environments, the `width` and `height` properties are empty
873
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
874
- let width = parseFloat(css.width) || 0;
875
- let height = parseFloat(css.height) || 0;
876
- const hasOffset = isHTMLElement(element);
877
- const offsetWidth = hasOffset ? element.offsetWidth : width;
878
- const offsetHeight = hasOffset ? element.offsetHeight : height;
879
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
880
- if (shouldFallback) {
881
- width = offsetWidth;
882
- height = offsetHeight;
883
- }
884
- return {
885
- width,
886
- height,
887
- $: shouldFallback
888
- };
889
- }
890
-
891
- function isElement(value) {
892
- return value instanceof Element || value instanceof getWindow(value).Element;
893
- }
894
-
895
- function unwrapElement(element) {
896
- return !isElement(element) ? element.contextElement : element;
897
- }
898
-
899
- function getScale(element) {
900
- const domElement = unwrapElement(element);
901
- if (!isHTMLElement(domElement)) {
902
- return createCoords(1);
903
- }
904
- const rect = domElement.getBoundingClientRect();
905
- const {
906
- width,
907
- height,
908
- $
909
- } = getCssDimensions(domElement);
910
- let x = ($ ? round(rect.width) : rect.width) / width;
911
- let y = ($ ? round(rect.height) : rect.height) / height;
912
-
913
- // 0, NaN, or Infinity should always fallback to 1.
914
-
915
- if (!x || !Number.isFinite(x)) {
916
- x = 1;
917
- }
918
- if (!y || !Number.isFinite(y)) {
919
- y = 1;
920
- }
921
- return {
922
- x,
923
- y
924
- };
925
- }
926
-
927
- const noOffsets = /*#__PURE__*/createCoords(0);
928
- function getVisualOffsets(element) {
929
- const win = getWindow(element);
930
- if (!isSafari() || !win.visualViewport) {
931
- return noOffsets;
932
- }
933
- return {
934
- x: win.visualViewport.offsetLeft,
935
- y: win.visualViewport.offsetTop
936
- };
937
- }
938
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
939
- if (isFixed === void 0) {
940
- isFixed = false;
941
- }
942
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
943
- return false;
944
- }
945
- return isFixed;
946
- }
947
-
948
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
949
- if (includeScale === void 0) {
950
- includeScale = false;
951
- }
952
- if (isFixedStrategy === void 0) {
953
- isFixedStrategy = false;
954
- }
955
- const clientRect = element.getBoundingClientRect();
956
- const domElement = unwrapElement(element);
957
- let scale = createCoords(1);
958
- if (includeScale) {
959
- if (offsetParent) {
960
- if (isElement(offsetParent)) {
961
- scale = getScale(offsetParent);
962
- }
963
- } else {
964
- scale = getScale(element);
965
- }
966
- }
967
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
968
- let x = (clientRect.left + visualOffsets.x) / scale.x;
969
- let y = (clientRect.top + visualOffsets.y) / scale.y;
970
- let width = clientRect.width / scale.x;
971
- let height = clientRect.height / scale.y;
972
- if (domElement) {
973
- const win = getWindow(domElement);
974
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
975
- let currentIFrame = win.frameElement;
976
- while (currentIFrame && offsetParent && offsetWin !== win) {
977
- const iframeScale = getScale(currentIFrame);
978
- const iframeRect = currentIFrame.getBoundingClientRect();
979
- const css = getComputedStyle(currentIFrame);
980
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
981
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
982
- x *= iframeScale.x;
983
- y *= iframeScale.y;
984
- width *= iframeScale.x;
985
- height *= iframeScale.y;
986
- x += left;
987
- y += top;
988
- currentIFrame = getWindow(currentIFrame).frameElement;
989
- }
990
- }
991
- return rectToClientRect({
992
- width,
993
- height,
994
- x,
995
- y
996
- });
997
- }
998
-
999
- function getNodeScroll(element) {
1000
- if (isElement(element)) {
1001
- return {
1002
- scrollLeft: element.scrollLeft,
1003
- scrollTop: element.scrollTop
1004
- };
1005
- }
1006
- return {
1007
- scrollLeft: element.pageXOffset,
1008
- scrollTop: element.pageYOffset
1009
- };
1010
- }
1011
-
1012
- function getDocumentElement(node) {
1013
- var _ref;
1014
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1015
- }
1016
-
1017
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1018
- let {
1019
- rect,
1020
- offsetParent,
1021
- strategy
1022
- } = _ref;
1023
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1024
- const documentElement = getDocumentElement(offsetParent);
1025
- if (offsetParent === documentElement) {
1026
- return rect;
1027
- }
1028
- let scroll = {
1029
- scrollLeft: 0,
1030
- scrollTop: 0
1031
- };
1032
- let scale = createCoords(1);
1033
- const offsets = createCoords(0);
1034
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1035
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1036
- scroll = getNodeScroll(offsetParent);
1037
- }
1038
- if (isHTMLElement(offsetParent)) {
1039
- const offsetRect = getBoundingClientRect(offsetParent);
1040
- scale = getScale(offsetParent);
1041
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1042
- offsets.y = offsetRect.y + offsetParent.clientTop;
1043
- }
1044
- }
1045
- return {
1046
- width: rect.width * scale.x,
1047
- height: rect.height * scale.y,
1048
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1049
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1050
- };
1051
- }
1052
-
1053
- function getClientRects(element) {
1054
- return Array.from(element.getClientRects());
1055
- }
1056
-
1057
- function getWindowScrollBarX(element) {
1058
- // If <html> has a CSS width greater than the viewport, then this will be
1059
- // incorrect for RTL.
1060
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1061
- }
1062
-
1063
- // Gets the entire size of the scrollable document area, even extending outside
1064
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1065
- function getDocumentRect(element) {
1066
- const html = getDocumentElement(element);
1067
- const scroll = getNodeScroll(element);
1068
- const body = element.ownerDocument.body;
1069
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1070
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1071
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1072
- const y = -scroll.scrollTop;
1073
- if (getComputedStyle$1(body).direction === 'rtl') {
1074
- x += max(html.clientWidth, body.clientWidth) - width;
1075
- }
1076
- return {
1077
- width,
1078
- height,
1079
- x,
1080
- y
1081
- };
1082
- }
1083
-
1084
- function getParentNode(node) {
1085
- if (getNodeName(node) === 'html') {
1086
- return node;
1087
- }
1088
- const result =
1089
- // Step into the shadow DOM of the parent of a slotted node.
1090
- node.assignedSlot ||
1091
- // DOM Element detected.
1092
- node.parentNode ||
1093
- // ShadowRoot detected.
1094
- isShadowRoot(node) && node.host ||
1095
- // Fallback.
1096
- getDocumentElement(node);
1097
- return isShadowRoot(result) ? result.host : result;
1098
- }
1099
-
1100
- function getNearestOverflowAncestor(node) {
1101
- const parentNode = getParentNode(node);
1102
- if (isLastTraversableNode(parentNode)) {
1103
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1104
- }
1105
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1106
- return parentNode;
1107
- }
1108
- return getNearestOverflowAncestor(parentNode);
1109
- }
1110
-
1111
- function getOverflowAncestors(node, list) {
1112
- var _node$ownerDocument;
1113
- if (list === void 0) {
1114
- list = [];
1115
- }
1116
- const scrollableAncestor = getNearestOverflowAncestor(node);
1117
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1118
- const win = getWindow(scrollableAncestor);
1119
- if (isBody) {
1120
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
1121
- }
1122
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
1123
- }
1124
-
1125
- function getViewportRect(element, strategy) {
1126
- const win = getWindow(element);
1127
- const html = getDocumentElement(element);
1128
- const visualViewport = win.visualViewport;
1129
- let width = html.clientWidth;
1130
- let height = html.clientHeight;
1131
- let x = 0;
1132
- let y = 0;
1133
- if (visualViewport) {
1134
- width = visualViewport.width;
1135
- height = visualViewport.height;
1136
- const visualViewportBased = isSafari();
1137
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1138
- x = visualViewport.offsetLeft;
1139
- y = visualViewport.offsetTop;
1140
- }
1141
- }
1142
- return {
1143
- width,
1144
- height,
1145
- x,
1146
- y
1147
- };
1148
- }
1149
-
1150
- // Returns the inner client rect, subtracting scrollbars if present.
1151
- function getInnerBoundingClientRect(element, strategy) {
1152
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1153
- const top = clientRect.top + element.clientTop;
1154
- const left = clientRect.left + element.clientLeft;
1155
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1156
- const width = element.clientWidth * scale.x;
1157
- const height = element.clientHeight * scale.y;
1158
- const x = left * scale.x;
1159
- const y = top * scale.y;
1160
- return {
1161
- width,
1162
- height,
1163
- x,
1164
- y
1165
- };
1166
- }
1167
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1168
- let rect;
1169
- if (clippingAncestor === 'viewport') {
1170
- rect = getViewportRect(element, strategy);
1171
- } else if (clippingAncestor === 'document') {
1172
- rect = getDocumentRect(getDocumentElement(element));
1173
- } else if (isElement(clippingAncestor)) {
1174
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1175
- } else {
1176
- const visualOffsets = getVisualOffsets(element);
1177
- rect = {
1178
- ...clippingAncestor,
1179
- x: clippingAncestor.x - visualOffsets.x,
1180
- y: clippingAncestor.y - visualOffsets.y
1181
- };
1182
- }
1183
- return rectToClientRect(rect);
1184
- }
1185
- function hasFixedPositionAncestor(element, stopNode) {
1186
- const parentNode = getParentNode(element);
1187
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1188
- return false;
1189
- }
1190
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1191
- }
1192
-
1193
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1194
- // clipping (or hiding) child elements. This returns all clipping ancestors
1195
- // of the given element up the tree.
1196
- function getClippingElementAncestors(element, cache) {
1197
- const cachedResult = cache.get(element);
1198
- if (cachedResult) {
1199
- return cachedResult;
1200
- }
1201
- let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
1202
- let currentContainingBlockComputedStyle = null;
1203
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1204
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1205
-
1206
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1207
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1208
- const computedStyle = getComputedStyle$1(currentNode);
1209
- const currentNodeIsContaining = isContainingBlock(currentNode);
1210
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1211
- currentContainingBlockComputedStyle = null;
1212
- }
1213
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1214
- if (shouldDropCurrentNode) {
1215
- // Drop non-containing blocks.
1216
- result = result.filter(ancestor => ancestor !== currentNode);
1217
- } else {
1218
- // Record last containing block for next iteration.
1219
- currentContainingBlockComputedStyle = computedStyle;
1220
- }
1221
- currentNode = getParentNode(currentNode);
1222
- }
1223
- cache.set(element, result);
8
+ const styles = "/**\n * Do not edit directly\n * Generated on Wed, 06 Sep 2023 09:40:36 GMT\n */\n:host {\n display: block;\n}\n\n.base {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n block-size: 100%;\n gap: 24px;\n}\n\n.icon-container {\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--vvd-color-neutral-100);\n block-size: 120px;\n border-radius: 50%;\n inline-size: 120px;\n}\n\n.content {\n display: flex;\n flex-direction: column;\n font: var(--vvd-typography-base);\n gap: 8px;\n text-align: center;\n}\n\nheader {\n font: var(--vvd-typography-base-bold);\n}\n\n.actions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: 8px;\n}\n.base.no-actions .actions {\n display: none;\n}";
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __decorateClass = (decorators, target, key, kind) => {
13
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
+ if (decorator = decorators[i])
16
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
+ if (kind && result)
18
+ __defProp(target, key, result);
1224
19
  return result;
1225
- }
1226
-
1227
- // Gets the maximum area that the element is visible in due to any number of
1228
- // clipping ancestors.
1229
- function getClippingRect(_ref) {
1230
- let {
1231
- element,
1232
- boundary,
1233
- rootBoundary,
1234
- strategy
1235
- } = _ref;
1236
- const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
1237
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1238
- const firstClippingAncestor = clippingAncestors[0];
1239
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1240
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1241
- accRect.top = max(rect.top, accRect.top);
1242
- accRect.right = min(rect.right, accRect.right);
1243
- accRect.bottom = min(rect.bottom, accRect.bottom);
1244
- accRect.left = max(rect.left, accRect.left);
1245
- return accRect;
1246
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1247
- return {
1248
- width: clippingRect.right - clippingRect.left,
1249
- height: clippingRect.bottom - clippingRect.top,
1250
- x: clippingRect.left,
1251
- y: clippingRect.top
1252
- };
1253
- }
1254
-
1255
- function getDimensions(element) {
1256
- return getCssDimensions(element);
1257
- }
1258
-
1259
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1260
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1261
- const documentElement = getDocumentElement(offsetParent);
1262
- const isFixed = strategy === 'fixed';
1263
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1264
- let scroll = {
1265
- scrollLeft: 0,
1266
- scrollTop: 0
1267
- };
1268
- const offsets = createCoords(0);
1269
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1270
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1271
- scroll = getNodeScroll(offsetParent);
1272
- }
1273
- if (isHTMLElement(offsetParent)) {
1274
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1275
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1276
- offsets.y = offsetRect.y + offsetParent.clientTop;
1277
- } else if (documentElement) {
1278
- offsets.x = getWindowScrollBarX(documentElement);
1279
- }
1280
- }
1281
- return {
1282
- x: rect.left + scroll.scrollLeft - offsets.x,
1283
- y: rect.top + scroll.scrollTop - offsets.y,
1284
- width: rect.width,
1285
- height: rect.height
1286
- };
1287
- }
1288
-
1289
- function getTrueOffsetParent(element, polyfill) {
1290
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1291
- return null;
1292
- }
1293
- if (polyfill) {
1294
- return polyfill(element);
1295
- }
1296
- return element.offsetParent;
1297
- }
1298
- function getContainingBlock(element) {
1299
- let currentNode = getParentNode(element);
1300
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1301
- if (isContainingBlock(currentNode)) {
1302
- return currentNode;
1303
- } else {
1304
- currentNode = getParentNode(currentNode);
1305
- }
1306
- }
1307
- return null;
1308
- }
1309
-
1310
- // Gets the closest ancestor positioned element. Handles some edge cases,
1311
- // such as table ancestors and cross browser bugs.
1312
- function getOffsetParent(element, polyfill) {
1313
- const window = getWindow(element);
1314
- if (!isHTMLElement(element)) {
1315
- return window;
1316
- }
1317
- let offsetParent = getTrueOffsetParent(element, polyfill);
1318
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
1319
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1320
- }
1321
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1322
- return window;
1323
- }
1324
- return offsetParent || getContainingBlock(element) || window;
1325
- }
1326
-
1327
- const getElementRects = async function (_ref) {
1328
- let {
1329
- reference,
1330
- floating,
1331
- strategy
1332
- } = _ref;
1333
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1334
- const getDimensionsFn = this.getDimensions;
1335
- return {
1336
- reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
1337
- floating: {
1338
- x: 0,
1339
- y: 0,
1340
- ...(await getDimensionsFn(floating))
1341
- }
1342
- };
1343
- };
1344
-
1345
- function isRTL(element) {
1346
- return getComputedStyle(element).direction === 'rtl';
1347
- }
1348
-
1349
- const platform = {
1350
- convertOffsetParentRelativeRectToViewportRelativeRect,
1351
- getDocumentElement,
1352
- getClippingRect,
1353
- getOffsetParent,
1354
- getElementRects,
1355
- getClientRects,
1356
- getDimensions,
1357
- getScale,
1358
- isElement,
1359
- isRTL
1360
20
  };
1361
-
1362
- // https://samthor.au/2021/observing-dom/
1363
- function observeMove(element, onMove) {
1364
- let io = null;
1365
- let timeoutId;
1366
- const root = getDocumentElement(element);
1367
- function cleanup() {
1368
- clearTimeout(timeoutId);
1369
- io && io.disconnect();
1370
- io = null;
1371
- }
1372
- function refresh(skip, threshold) {
1373
- if (skip === void 0) {
1374
- skip = false;
1375
- }
1376
- if (threshold === void 0) {
1377
- threshold = 1;
1378
- }
1379
- cleanup();
1380
- const {
1381
- left,
1382
- top,
1383
- width,
1384
- height
1385
- } = element.getBoundingClientRect();
1386
- if (!skip) {
1387
- onMove();
1388
- }
1389
- if (!width || !height) {
1390
- return;
1391
- }
1392
- const insetTop = floor(top);
1393
- const insetRight = floor(root.clientWidth - (left + width));
1394
- const insetBottom = floor(root.clientHeight - (top + height));
1395
- const insetLeft = floor(left);
1396
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1397
- const options = {
1398
- rootMargin,
1399
- threshold: max(0, min(1, threshold)) || 1
1400
- };
1401
- let isFirstUpdate = true;
1402
- function handleObserve(entries) {
1403
- const ratio = entries[0].intersectionRatio;
1404
- if (ratio !== threshold) {
1405
- if (!isFirstUpdate) {
1406
- return refresh();
1407
- }
1408
- if (!ratio) {
1409
- timeoutId = setTimeout(() => {
1410
- refresh(false, 1e-7);
1411
- }, 100);
1412
- } else {
1413
- refresh(false, ratio);
1414
- }
1415
- }
1416
- isFirstUpdate = false;
1417
- }
1418
-
1419
- // Older browsers don't support a `document` as the root and will throw an
1420
- // error.
1421
- try {
1422
- io = new IntersectionObserver(handleObserve, {
1423
- ...options,
1424
- // Handle <iframe>s
1425
- root: root.ownerDocument
1426
- });
1427
- } catch (e) {
1428
- io = new IntersectionObserver(handleObserve, options);
1429
- }
1430
- io.observe(element);
1431
- }
1432
- refresh(true);
1433
- return cleanup;
1434
- }
1435
-
1436
- /**
1437
- * Automatically updates the position of the floating element when necessary.
1438
- * Should only be called when the floating element is mounted on the DOM or
1439
- * visible on the screen.
1440
- * @returns cleanup function that should be invoked when the floating element is
1441
- * removed from the DOM or hidden from the screen.
1442
- * @see https://floating-ui.com/docs/autoUpdate
1443
- */
1444
- function autoUpdate(reference, floating, update, options) {
1445
- if (options === void 0) {
1446
- options = {};
1447
- }
1448
- const {
1449
- ancestorScroll = true,
1450
- ancestorResize = true,
1451
- elementResize = typeof ResizeObserver === 'function',
1452
- layoutShift = typeof IntersectionObserver === 'function',
1453
- animationFrame = false
1454
- } = options;
1455
- const referenceEl = unwrapElement(reference);
1456
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1457
- ancestors.forEach(ancestor => {
1458
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1459
- passive: true
1460
- });
1461
- ancestorResize && ancestor.addEventListener('resize', update);
1462
- });
1463
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1464
- let reobserveFrame = -1;
1465
- let resizeObserver = null;
1466
- if (elementResize) {
1467
- resizeObserver = new ResizeObserver(_ref => {
1468
- let [firstEntry] = _ref;
1469
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1470
- // Prevent update loops when using the `size` middleware.
1471
- // https://github.com/floating-ui/floating-ui/issues/1740
1472
- resizeObserver.unobserve(floating);
1473
- cancelAnimationFrame(reobserveFrame);
1474
- reobserveFrame = requestAnimationFrame(() => {
1475
- resizeObserver && resizeObserver.observe(floating);
1476
- });
1477
- }
1478
- update();
1479
- });
1480
- if (referenceEl && !animationFrame) {
1481
- resizeObserver.observe(referenceEl);
1482
- }
1483
- resizeObserver.observe(floating);
1484
- }
1485
- let frameId;
1486
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1487
- if (animationFrame) {
1488
- frameLoop();
1489
- }
1490
- function frameLoop() {
1491
- const nextRefRect = getBoundingClientRect(reference);
1492
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1493
- update();
1494
- }
1495
- prevRefRect = nextRefRect;
1496
- frameId = requestAnimationFrame(frameLoop);
1497
- }
1498
- update();
1499
- return () => {
1500
- ancestors.forEach(ancestor => {
1501
- ancestorScroll && ancestor.removeEventListener('scroll', update);
1502
- ancestorResize && ancestor.removeEventListener('resize', update);
1503
- });
1504
- cleanupIo && cleanupIo();
1505
- resizeObserver && resizeObserver.disconnect();
1506
- resizeObserver = null;
1507
- if (animationFrame) {
1508
- cancelAnimationFrame(frameId);
1509
- }
1510
- };
1511
- }
1512
-
1513
- /**
1514
- * Computes the `x` and `y` coordinates that will place the floating element
1515
- * next to a reference element when it is given a certain CSS positioning
1516
- * strategy.
1517
- */
1518
- const computePosition = (reference, floating, options) => {
1519
- // This caches the expensive `getClippingElementAncestors` function so that
1520
- // multiple lifecycle resets re-use the same result. It only lives for a
1521
- // single call. If other functions become expensive, we can add them as well.
1522
- const cache = new Map();
1523
- const mergedOptions = {
1524
- platform,
1525
- ...options
1526
- };
1527
- const platformWithCache = {
1528
- ...mergedOptions.platform,
1529
- _c: cache
1530
- };
1531
- return computePosition$1(reference, floating, {
1532
- ...mergedOptions,
1533
- platform: platformWithCache
1534
- });
1535
- };
1536
-
1537
- var _Popup_instances, _Popup_middleware_get, _Popup_cleanup, _Popup_assignPopupPosition, _Popup_assignArrowPosition;
1538
- class Popup extends FoundationElement {
1539
- constructor() {
1540
- super(...arguments);
1541
- _Popup_instances.add(this);
1542
- _Popup_cleanup.set(this, void 0);
1543
- this.open = false;
1544
- this.dismissible = false;
1545
- this.arrow = false;
1546
- this.alternate = false;
1547
- this.strategy = 'fixed';
1548
- }
1549
- openChanged(_, newValue) {
1550
- newValue ? this.$emit('vwc-popup:open') : this.$emit('vwc-popup:close');
1551
- }
1552
- disconnectedCallback() {
1553
- var _a;
1554
- super.disconnectedCallback();
1555
- (_a = __classPrivateFieldGet(this, _Popup_cleanup, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
1556
- }
1557
- attributeChangedCallback(name, oldValue, newValue) {
1558
- var _a;
1559
- super.attributeChangedCallback(name, oldValue, newValue);
1560
- (_a = __classPrivateFieldGet(this, _Popup_cleanup, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
1561
- if (this.anchorEl && this.popupEl) {
1562
- __classPrivateFieldSet(this, _Popup_cleanup, autoUpdate(this.anchorEl, this.popupEl, () => this.updatePosition()), "f");
1563
- }
1564
- }
1565
- async updatePosition() {
1566
- if (!this.open || !this.anchorEl) {
1567
- return;
1568
- }
1569
- const positionData = await computePosition(this.anchorEl, this.popupEl, {
1570
- placement: this.placement,
1571
- strategy: this.strategy,
1572
- middleware: __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_middleware_get)
1573
- });
1574
- __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_assignPopupPosition).call(this, positionData);
1575
- if (this.arrow) {
1576
- __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_assignArrowPosition).call(this, positionData);
1577
- }
1578
- }
1579
- get anchorEl() {
1580
- return this.anchor instanceof HTMLElement ? this.anchor : document.getElementById(this.anchor ? this.anchor : '');
1581
- }
1582
- show() {
1583
- this.open = true;
1584
- }
1585
- hide() {
1586
- this.open = false;
1587
- }
1588
- }
1589
- _Popup_cleanup = new WeakMap(), _Popup_instances = new WeakSet(), _Popup_middleware_get = function _Popup_middleware_get() {
1590
- let middleware = [inline(), flip(), hide()];
1591
- if (this.arrow) {
1592
- middleware = [offset(12), ...middleware, arrow({
1593
- element: this.arrowEl,
1594
- padding: 10
1595
- })];
1596
- }
1597
- return middleware;
1598
- }, _Popup_assignPopupPosition = function _Popup_assignPopupPosition(data) {
1599
- const {
1600
- x: popupX,
1601
- y: popupY
1602
- } = data;
1603
- const {
1604
- referenceHidden
1605
- } = data.middlewareData.hide;
1606
- Object.assign(this.popupEl.style, {
1607
- left: `${popupX}px`,
1608
- top: `${popupY}px`,
1609
- visibility: referenceHidden ? 'hidden' : 'visible'
1610
- });
1611
- }, _Popup_assignArrowPosition = function _Popup_assignArrowPosition(data) {
1612
- const {
1613
- x: arrowX,
1614
- y: arrowY
1615
- } = data.middlewareData.arrow;
1616
- const styles = {
1617
- 'left': 'calc(100% - 4px)',
1618
- 'right': '-4px',
1619
- 'top': 'calc(100% - 4px)',
1620
- 'bottom': '-4px'
1621
- };
1622
- const staticAxis = data.placement.split('-')[0];
1623
- Object.assign(this.arrowEl.style, {
1624
- left: arrowX ? `${arrowX}px` : styles[staticAxis],
1625
- top: arrowY ? `${arrowY}px` : styles[staticAxis]
1626
- });
1627
- };
1628
- __decorate([attr({
1629
- mode: 'boolean'
1630
- }), __metadata("design:type", Object)], Popup.prototype, "open", void 0);
1631
- __decorate([attr({
1632
- mode: 'boolean'
1633
- }), __metadata("design:type", Object)], Popup.prototype, "dismissible", void 0);
1634
- __decorate([attr({
1635
- mode: 'boolean'
1636
- }), __metadata("design:type", Object)], Popup.prototype, "arrow", void 0);
1637
- __decorate([attr({
1638
- mode: 'boolean'
1639
- }), __metadata("design:type", Object)], Popup.prototype, "alternate", void 0);
1640
- __decorate([attr({
1641
- mode: 'fromView'
1642
- }), __metadata("design:type", String)], Popup.prototype, "placement", void 0);
1643
- __decorate([attr({
1644
- mode: 'fromView'
1645
- }), __metadata("design:type", String)], Popup.prototype, "strategy", void 0);
1646
- __decorate([attr, __metadata("design:type", Object)], Popup.prototype, "anchor", void 0);
1647
-
1648
- var css_248z = ".control {\n background: var(--vvd-color-surface-4dp);\n border-radius: inherit;\n contain: layout;\n}\n.control:not(.open) {\n display: none;\n}\n\n.popup-wrapper {\n z-index: 10;\n border-radius: 6px;\n inline-size: fit-content;\n}\n.popup-wrapper:not(.absolute) {\n position: fixed;\n}\n.popup-wrapper.absolute {\n position: absolute;\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}";
1649
-
1650
- const getClasses = ({
1651
- open,
1652
- dismissible,
1653
- alternate
1654
- }) => classNames('control', ['open', Boolean(open)], ['dismissible', Boolean(dismissible)], ['alternate', Boolean(alternate)]);
1655
- const popupTemplate = context => {
1656
- const elevationTag = context.tagFor(Elevation);
1657
- const buttonTag = context.tagFor(Button);
21
+ class EmptyState extends FoundationElement {
22
+ }
23
+ __decorateClass([
24
+ attr
25
+ ], EmptyState.prototype, "headline", 2);
26
+ __decorateClass([
27
+ attr
28
+ ], EmptyState.prototype, "icon", 2);
29
+ __decorateClass([
30
+ observable
31
+ ], EmptyState.prototype, "slottedActionItems", 2);
32
+
33
+ const getClasses = (x) => classNames(
34
+ "base",
35
+ ["no-actions", x.slottedActionItems?.length === 0]
36
+ );
37
+ const EmptyStateTemplate = (context) => {
38
+ const iconTag = context.tagFor(Icon);
1658
39
  return html`
1659
- <${elevationTag}>
1660
- <div class="popup-wrapper ${x => x.strategy}" ${ref('popupEl')} part="popup-base">
1661
- <div class="${getClasses}" aria-hidden="${x => x.open ? 'false' : 'true'}"
1662
- part="${x => x.alternate ? 'vvd-theme-alternate' : ''}">
1663
- <div class="popup-content">
1664
- <slot></slot>
1665
- ${when(x => x.dismissible, html`<${buttonTag} size="condensed" @click="${x => x.open = false}"
1666
- class="dismissible-button" icon="close-small-solid" shape="pill"></${buttonTag}>`)}
1667
- </div>
1668
- ${when(x => x.arrow, html`<div class="arrow" ${ref('arrowEl')}></div>`)}
40
+ <div class="${getClasses}">
41
+ <slot name="graphic">
42
+ ${when(
43
+ (x) => x.icon,
44
+ html`<div class="icon-container">
45
+ <${iconTag} class="icon" name="${(x) => x.icon}" size="5"></${iconTag}>
46
+ </div>`
47
+ )}
48
+ </slot>
49
+ <div class="content">
50
+ ${when(
51
+ (x) => x.headline,
52
+ html`<header>${(x) => x.headline}</header>`
53
+ )}
54
+ <slot></slot>
55
+ </div>
56
+ <div class="actions">
57
+ <slot name="action-items" ${slotted("slottedActionItems")}></slot>
1669
58
  </div>
1670
- </div>
1671
- </${elevationTag}>`;
59
+ </div>`;
1672
60
  };
1673
61
 
1674
- const popupDefinition = Popup.compose({
1675
- baseName: 'popup',
1676
- template: popupTemplate,
1677
- styles: css_248z
62
+ const emptyStateDefinition = EmptyState.compose({
63
+ baseName: "empty-state",
64
+ template: EmptyStateTemplate,
65
+ styles
1678
66
  });
1679
- const popupRegistries = [popupDefinition(), ...elevationRegistries, ...buttonRegistries];
1680
- const registerPopup = registerFactory(popupRegistries);
67
+ const emptyStateRegistries = [emptyStateDefinition(), ...iconRegistries];
68
+ const registerEmptyState = registerFactory(emptyStateRegistries);
1681
69
 
1682
- export { Popup as P, popupRegistries as p, registerPopup as r };
70
+ export { emptyStateRegistries as a, emptyStateDefinition as e, registerEmptyState as r };