@rededor/cura 1.8.2-alpha.0 → 2.0.0-alpha.4

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 (72) hide show
  1. package/dist/cjs/{cura-accordion_20.cjs.entry.js → cura-accordion_21.cjs.entry.js} +1815 -20
  2. package/dist/cjs/cura-accordion_21.cjs.entry.js.map +1 -0
  3. package/dist/cjs/cura-modal.cjs.entry.js +10 -2
  4. package/dist/cjs/cura-modal.cjs.entry.js.map +1 -1
  5. package/dist/cjs/cura-modal.entry.cjs.js.map +1 -1
  6. package/dist/cjs/cura.cjs.js +1 -1
  7. package/dist/cjs/index-BK9MSAiE.js.map +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.css +1 -1
  10. package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.js +24 -4
  11. package/dist/collection/components/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
  12. package/dist/collection/components/cura-modal/cura-modal.js +30 -2
  13. package/dist/collection/components/cura-modal/cura-modal.js.map +1 -1
  14. package/dist/collection/components/cura-modal/cura-modal.stories.js +10 -0
  15. package/dist/collection/components/cura-modal/cura-modal.stories.js.map +1 -1
  16. package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
  17. package/dist/collection/components/forms/cura-select/cura-select.css +3 -148
  18. package/dist/collection/components/forms/cura-select/cura-select.js +103 -11
  19. package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -1
  20. package/dist/collection/components/forms/cura-select-options/cura-select-option.css +15 -0
  21. package/dist/components/cura-calendar.js +1 -1
  22. package/dist/components/cura-dropdown-search.js +25 -5
  23. package/dist/components/cura-dropdown-search.js.map +1 -1
  24. package/dist/components/cura-input-date.js +3 -3
  25. package/dist/components/cura-modal.js +11 -2
  26. package/dist/components/cura-modal.js.map +1 -1
  27. package/dist/components/cura-select-option.js +1 -1
  28. package/dist/components/cura-select.js +1 -1
  29. package/dist/components/p-CvdWbsfO.js +2147 -0
  30. package/dist/components/p-CvdWbsfO.js.map +1 -0
  31. package/dist/components/p-D1cPOZpG.js.map +1 -1
  32. package/dist/components/{p-BGnJiNyu.js → p-DETZu2ie.js} +4 -4
  33. package/dist/components/{p-BGnJiNyu.js.map → p-DETZu2ie.js.map} +1 -1
  34. package/dist/components/{p-DpIu_Oxz.js → p-Dt450DkQ.js} +3 -3
  35. package/dist/components/p-Dt450DkQ.js.map +1 -0
  36. package/dist/cura/cura-modal.entry.esm.js.map +1 -1
  37. package/dist/cura/cura.esm.js +1 -1
  38. package/dist/cura/p-2ab58335.entry.js +2 -0
  39. package/dist/cura/p-2ab58335.entry.js.map +1 -0
  40. package/dist/cura/p-5ed7ce95.entry.js +2 -0
  41. package/dist/cura/p-5ed7ce95.entry.js.map +1 -0
  42. package/dist/cura/p-PPMZr_VE.js.map +1 -1
  43. package/dist/esm/{cura-accordion_20.entry.js → cura-accordion_21.entry.js} +1815 -21
  44. package/dist/esm/cura-accordion_21.entry.js.map +1 -0
  45. package/dist/esm/cura-modal.entry.js +10 -2
  46. package/dist/esm/cura-modal.entry.js.map +1 -1
  47. package/dist/esm/cura.js +1 -1
  48. package/dist/esm/index-OdKytJIH.js.map +1 -1
  49. package/dist/esm/loader.js +1 -1
  50. package/dist/types/components/cura-dropdown-search/cura-dropdown-search.d.ts +2 -0
  51. package/dist/types/components/cura-modal/cura-modal.d.ts +5 -0
  52. package/dist/types/components/cura-modal/cura-modal.stories.d.ts +11 -0
  53. package/dist/types/components/forms/cura-select/cura-select.d.ts +21 -0
  54. package/dist/types/components.d.ts +10 -0
  55. package/package.json +3 -2
  56. package/dist/cjs/cura-accordion_20.cjs.entry.js.map +0 -1
  57. package/dist/cjs/cura-card.cjs.entry.js +0 -81
  58. package/dist/cjs/cura-card.cjs.entry.js.map +0 -1
  59. package/dist/cjs/cura-card.entry.cjs.js.map +0 -1
  60. package/dist/components/p-BTt-pVTn.js +0 -442
  61. package/dist/components/p-BTt-pVTn.js.map +0 -1
  62. package/dist/components/p-DpIu_Oxz.js.map +0 -1
  63. package/dist/cura/cura-card.entry.esm.js.map +0 -1
  64. package/dist/cura/p-d8aeca82.entry.js +0 -2
  65. package/dist/cura/p-d8aeca82.entry.js.map +0 -1
  66. package/dist/cura/p-deb0b764.entry.js +0 -2
  67. package/dist/cura/p-deb0b764.entry.js.map +0 -1
  68. package/dist/cura/p-df7cb250.entry.js +0 -2
  69. package/dist/cura/p-df7cb250.entry.js.map +0 -1
  70. package/dist/esm/cura-accordion_20.entry.js.map +0 -1
  71. package/dist/esm/cura-card.entry.js +0 -79
  72. package/dist/esm/cura-card.entry.js.map +0 -1
@@ -0,0 +1,2147 @@
1
+ import { p as proxyCustomElement, H, e as createEvent, h, d as Host } from './p-D1cPOZpG.js';
2
+ import { d as defineCustomElement$2 } from './p-B5aO1chh.js';
3
+ import { d as defineCustomElement$1 } from './p-DR1RHrEX.js';
4
+
5
+ /**
6
+ * Custom positioning reference element.
7
+ * @see https://floating-ui.com/docs/virtual-elements
8
+ */
9
+
10
+ const min = Math.min;
11
+ const max = Math.max;
12
+ const round = Math.round;
13
+ const floor = Math.floor;
14
+ const createCoords = v => ({
15
+ x: v,
16
+ y: v
17
+ });
18
+ const oppositeSideMap = {
19
+ left: 'right',
20
+ right: 'left',
21
+ bottom: 'top',
22
+ top: 'bottom'
23
+ };
24
+ const oppositeAlignmentMap = {
25
+ start: 'end',
26
+ end: 'start'
27
+ };
28
+ function clamp(start, value, end) {
29
+ return max(start, min(value, end));
30
+ }
31
+ function evaluate(value, param) {
32
+ return typeof value === 'function' ? value(param) : value;
33
+ }
34
+ function getSide(placement) {
35
+ return placement.split('-')[0];
36
+ }
37
+ function getAlignment(placement) {
38
+ return placement.split('-')[1];
39
+ }
40
+ function getOppositeAxis(axis) {
41
+ return axis === 'x' ? 'y' : 'x';
42
+ }
43
+ function getAxisLength(axis) {
44
+ return axis === 'y' ? 'height' : 'width';
45
+ }
46
+ const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
47
+ function getSideAxis(placement) {
48
+ return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
49
+ }
50
+ function getAlignmentAxis(placement) {
51
+ return getOppositeAxis(getSideAxis(placement));
52
+ }
53
+ function getAlignmentSides(placement, rects, rtl) {
54
+ if (rtl === void 0) {
55
+ rtl = false;
56
+ }
57
+ const alignment = getAlignment(placement);
58
+ const alignmentAxis = getAlignmentAxis(placement);
59
+ const length = getAxisLength(alignmentAxis);
60
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
61
+ if (rects.reference[length] > rects.floating[length]) {
62
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
63
+ }
64
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
65
+ }
66
+ function getExpandedPlacements(placement) {
67
+ const oppositePlacement = getOppositePlacement(placement);
68
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
69
+ }
70
+ function getOppositeAlignmentPlacement(placement) {
71
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
72
+ }
73
+ const lrPlacement = ['left', 'right'];
74
+ const rlPlacement = ['right', 'left'];
75
+ const tbPlacement = ['top', 'bottom'];
76
+ const btPlacement = ['bottom', 'top'];
77
+ function getSideList(side, isStart, rtl) {
78
+ switch (side) {
79
+ case 'top':
80
+ case 'bottom':
81
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
82
+ return isStart ? lrPlacement : rlPlacement;
83
+ case 'left':
84
+ case 'right':
85
+ return isStart ? tbPlacement : btPlacement;
86
+ default:
87
+ return [];
88
+ }
89
+ }
90
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
91
+ const alignment = getAlignment(placement);
92
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
93
+ if (alignment) {
94
+ list = list.map(side => side + "-" + alignment);
95
+ if (flipAlignment) {
96
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
97
+ }
98
+ }
99
+ return list;
100
+ }
101
+ function getOppositePlacement(placement) {
102
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
103
+ }
104
+ function expandPaddingObject(padding) {
105
+ return {
106
+ top: 0,
107
+ right: 0,
108
+ bottom: 0,
109
+ left: 0,
110
+ ...padding
111
+ };
112
+ }
113
+ function getPaddingObject(padding) {
114
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
115
+ top: padding,
116
+ right: padding,
117
+ bottom: padding,
118
+ left: padding
119
+ };
120
+ }
121
+ function rectToClientRect(rect) {
122
+ const {
123
+ x,
124
+ y,
125
+ width,
126
+ height
127
+ } = rect;
128
+ return {
129
+ width,
130
+ height,
131
+ top: y,
132
+ left: x,
133
+ right: x + width,
134
+ bottom: y + height,
135
+ x,
136
+ y
137
+ };
138
+ }
139
+
140
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
141
+ let {
142
+ reference,
143
+ floating
144
+ } = _ref;
145
+ const sideAxis = getSideAxis(placement);
146
+ const alignmentAxis = getAlignmentAxis(placement);
147
+ const alignLength = getAxisLength(alignmentAxis);
148
+ const side = getSide(placement);
149
+ const isVertical = sideAxis === 'y';
150
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
151
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
152
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
153
+ let coords;
154
+ switch (side) {
155
+ case 'top':
156
+ coords = {
157
+ x: commonX,
158
+ y: reference.y - floating.height
159
+ };
160
+ break;
161
+ case 'bottom':
162
+ coords = {
163
+ x: commonX,
164
+ y: reference.y + reference.height
165
+ };
166
+ break;
167
+ case 'right':
168
+ coords = {
169
+ x: reference.x + reference.width,
170
+ y: commonY
171
+ };
172
+ break;
173
+ case 'left':
174
+ coords = {
175
+ x: reference.x - floating.width,
176
+ y: commonY
177
+ };
178
+ break;
179
+ default:
180
+ coords = {
181
+ x: reference.x,
182
+ y: reference.y
183
+ };
184
+ }
185
+ switch (getAlignment(placement)) {
186
+ case 'start':
187
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
188
+ break;
189
+ case 'end':
190
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
191
+ break;
192
+ }
193
+ return coords;
194
+ }
195
+
196
+ /**
197
+ * Computes the `x` and `y` coordinates that will place the floating element
198
+ * next to a given reference element.
199
+ *
200
+ * This export does not have any `platform` interface logic. You will need to
201
+ * write one for the platform you are using Floating UI with.
202
+ */
203
+ const computePosition$1 = async (reference, floating, config) => {
204
+ const {
205
+ placement = 'bottom',
206
+ strategy = 'absolute',
207
+ middleware = [],
208
+ platform
209
+ } = config;
210
+ const validMiddleware = middleware.filter(Boolean);
211
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
212
+ let rects = await platform.getElementRects({
213
+ reference,
214
+ floating,
215
+ strategy
216
+ });
217
+ let {
218
+ x,
219
+ y
220
+ } = computeCoordsFromPlacement(rects, placement, rtl);
221
+ let statefulPlacement = placement;
222
+ let middlewareData = {};
223
+ let resetCount = 0;
224
+ for (let i = 0; i < validMiddleware.length; i++) {
225
+ const {
226
+ name,
227
+ fn
228
+ } = validMiddleware[i];
229
+ const {
230
+ x: nextX,
231
+ y: nextY,
232
+ data,
233
+ reset
234
+ } = await fn({
235
+ x,
236
+ y,
237
+ initialPlacement: placement,
238
+ placement: statefulPlacement,
239
+ strategy,
240
+ middlewareData,
241
+ rects,
242
+ platform,
243
+ elements: {
244
+ reference,
245
+ floating
246
+ }
247
+ });
248
+ x = nextX != null ? nextX : x;
249
+ y = nextY != null ? nextY : y;
250
+ middlewareData = {
251
+ ...middlewareData,
252
+ [name]: {
253
+ ...middlewareData[name],
254
+ ...data
255
+ }
256
+ };
257
+ if (reset && resetCount <= 50) {
258
+ resetCount++;
259
+ if (typeof reset === 'object') {
260
+ if (reset.placement) {
261
+ statefulPlacement = reset.placement;
262
+ }
263
+ if (reset.rects) {
264
+ rects = reset.rects === true ? await platform.getElementRects({
265
+ reference,
266
+ floating,
267
+ strategy
268
+ }) : reset.rects;
269
+ }
270
+ ({
271
+ x,
272
+ y
273
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
274
+ }
275
+ i = -1;
276
+ }
277
+ }
278
+ return {
279
+ x,
280
+ y,
281
+ placement: statefulPlacement,
282
+ strategy,
283
+ middlewareData
284
+ };
285
+ };
286
+
287
+ /**
288
+ * Resolves with an object of overflow side offsets that determine how much the
289
+ * element is overflowing a given clipping boundary on each side.
290
+ * - positive = overflowing the boundary by that number of pixels
291
+ * - negative = how many pixels left before it will overflow
292
+ * - 0 = lies flush with the boundary
293
+ * @see https://floating-ui.com/docs/detectOverflow
294
+ */
295
+ async function detectOverflow(state, options) {
296
+ var _await$platform$isEle;
297
+ if (options === void 0) {
298
+ options = {};
299
+ }
300
+ const {
301
+ x,
302
+ y,
303
+ platform,
304
+ rects,
305
+ elements,
306
+ strategy
307
+ } = state;
308
+ const {
309
+ boundary = 'clippingAncestors',
310
+ rootBoundary = 'viewport',
311
+ elementContext = 'floating',
312
+ altBoundary = false,
313
+ padding = 0
314
+ } = evaluate(options, state);
315
+ const paddingObject = getPaddingObject(padding);
316
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
317
+ const element = elements[altBoundary ? altContext : elementContext];
318
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
319
+ 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))),
320
+ boundary,
321
+ rootBoundary,
322
+ strategy
323
+ }));
324
+ const rect = elementContext === 'floating' ? {
325
+ x,
326
+ y,
327
+ width: rects.floating.width,
328
+ height: rects.floating.height
329
+ } : rects.reference;
330
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
331
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
332
+ x: 1,
333
+ y: 1
334
+ } : {
335
+ x: 1,
336
+ y: 1
337
+ };
338
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
339
+ elements,
340
+ rect,
341
+ offsetParent,
342
+ strategy
343
+ }) : rect);
344
+ return {
345
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
346
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
347
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
348
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
349
+ };
350
+ }
351
+
352
+ /**
353
+ * Optimizes the visibility of the floating element by flipping the `placement`
354
+ * in order to keep it in view when the preferred placement(s) will overflow the
355
+ * clipping boundary. Alternative to `autoPlacement`.
356
+ * @see https://floating-ui.com/docs/flip
357
+ */
358
+ const flip$1 = function (options) {
359
+ if (options === void 0) {
360
+ options = {};
361
+ }
362
+ return {
363
+ name: 'flip',
364
+ options,
365
+ async fn(state) {
366
+ var _middlewareData$arrow, _middlewareData$flip;
367
+ const {
368
+ placement,
369
+ middlewareData,
370
+ rects,
371
+ initialPlacement,
372
+ platform,
373
+ elements
374
+ } = state;
375
+ const {
376
+ mainAxis: checkMainAxis = true,
377
+ crossAxis: checkCrossAxis = true,
378
+ fallbackPlacements: specifiedFallbackPlacements,
379
+ fallbackStrategy = 'bestFit',
380
+ fallbackAxisSideDirection = 'none',
381
+ flipAlignment = true,
382
+ ...detectOverflowOptions
383
+ } = evaluate(options, state);
384
+
385
+ // If a reset by the arrow was caused due to an alignment offset being
386
+ // added, we should skip any logic now since `flip()` has already done its
387
+ // work.
388
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
389
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
390
+ return {};
391
+ }
392
+ const side = getSide(placement);
393
+ const initialSideAxis = getSideAxis(initialPlacement);
394
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
395
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
396
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
397
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
398
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
399
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
400
+ }
401
+ const placements = [initialPlacement, ...fallbackPlacements];
402
+ const overflow = await detectOverflow(state, detectOverflowOptions);
403
+ const overflows = [];
404
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
405
+ if (checkMainAxis) {
406
+ overflows.push(overflow[side]);
407
+ }
408
+ if (checkCrossAxis) {
409
+ const sides = getAlignmentSides(placement, rects, rtl);
410
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
411
+ }
412
+ overflowsData = [...overflowsData, {
413
+ placement,
414
+ overflows
415
+ }];
416
+
417
+ // One or more sides is overflowing.
418
+ if (!overflows.every(side => side <= 0)) {
419
+ var _middlewareData$flip2, _overflowsData$filter;
420
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
421
+ const nextPlacement = placements[nextIndex];
422
+ if (nextPlacement) {
423
+ const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
424
+ if (!ignoreCrossAxisOverflow ||
425
+ // We leave the current main axis only if every placement on that axis
426
+ // overflows the main axis.
427
+ overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
428
+ // Try next placement and re-run the lifecycle.
429
+ return {
430
+ data: {
431
+ index: nextIndex,
432
+ overflows: overflowsData
433
+ },
434
+ reset: {
435
+ placement: nextPlacement
436
+ }
437
+ };
438
+ }
439
+ }
440
+
441
+ // First, find the candidates that fit on the mainAxis side of overflow,
442
+ // then find the placement that fits the best on the main crossAxis side.
443
+ 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;
444
+
445
+ // Otherwise fallback.
446
+ if (!resetPlacement) {
447
+ switch (fallbackStrategy) {
448
+ case 'bestFit':
449
+ {
450
+ var _overflowsData$filter2;
451
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
452
+ if (hasFallbackAxisSideDirection) {
453
+ const currentSideAxis = getSideAxis(d.placement);
454
+ return currentSideAxis === initialSideAxis ||
455
+ // Create a bias to the `y` side axis due to horizontal
456
+ // reading directions favoring greater width.
457
+ currentSideAxis === 'y';
458
+ }
459
+ return true;
460
+ }).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$filter2[0];
461
+ if (placement) {
462
+ resetPlacement = placement;
463
+ }
464
+ break;
465
+ }
466
+ case 'initialPlacement':
467
+ resetPlacement = initialPlacement;
468
+ break;
469
+ }
470
+ }
471
+ if (placement !== resetPlacement) {
472
+ return {
473
+ reset: {
474
+ placement: resetPlacement
475
+ }
476
+ };
477
+ }
478
+ }
479
+ return {};
480
+ }
481
+ };
482
+ };
483
+
484
+ const originSides = /*#__PURE__*/new Set(['left', 'top']);
485
+
486
+ // For type backwards-compatibility, the `OffsetOptions` type was also
487
+ // Derivable.
488
+
489
+ async function convertValueToCoords(state, options) {
490
+ const {
491
+ placement,
492
+ platform,
493
+ elements
494
+ } = state;
495
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
496
+ const side = getSide(placement);
497
+ const alignment = getAlignment(placement);
498
+ const isVertical = getSideAxis(placement) === 'y';
499
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
500
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
501
+ const rawValue = evaluate(options, state);
502
+
503
+ // eslint-disable-next-line prefer-const
504
+ let {
505
+ mainAxis,
506
+ crossAxis,
507
+ alignmentAxis
508
+ } = typeof rawValue === 'number' ? {
509
+ mainAxis: rawValue,
510
+ crossAxis: 0,
511
+ alignmentAxis: null
512
+ } : {
513
+ mainAxis: rawValue.mainAxis || 0,
514
+ crossAxis: rawValue.crossAxis || 0,
515
+ alignmentAxis: rawValue.alignmentAxis
516
+ };
517
+ if (alignment && typeof alignmentAxis === 'number') {
518
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
519
+ }
520
+ return isVertical ? {
521
+ x: crossAxis * crossAxisMulti,
522
+ y: mainAxis * mainAxisMulti
523
+ } : {
524
+ x: mainAxis * mainAxisMulti,
525
+ y: crossAxis * crossAxisMulti
526
+ };
527
+ }
528
+
529
+ /**
530
+ * Modifies the placement by translating the floating element along the
531
+ * specified axes.
532
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
533
+ * object may be passed.
534
+ * @see https://floating-ui.com/docs/offset
535
+ */
536
+ const offset$1 = function (options) {
537
+ if (options === void 0) {
538
+ options = 0;
539
+ }
540
+ return {
541
+ name: 'offset',
542
+ options,
543
+ async fn(state) {
544
+ var _middlewareData$offse, _middlewareData$arrow;
545
+ const {
546
+ x,
547
+ y,
548
+ placement,
549
+ middlewareData
550
+ } = state;
551
+ const diffCoords = await convertValueToCoords(state, options);
552
+
553
+ // If the placement is the same and the arrow caused an alignment offset
554
+ // then we don't need to change the positioning coordinates.
555
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
556
+ return {};
557
+ }
558
+ return {
559
+ x: x + diffCoords.x,
560
+ y: y + diffCoords.y,
561
+ data: {
562
+ ...diffCoords,
563
+ placement
564
+ }
565
+ };
566
+ }
567
+ };
568
+ };
569
+
570
+ /**
571
+ * Optimizes the visibility of the floating element by shifting it in order to
572
+ * keep it in view when it will overflow the clipping boundary.
573
+ * @see https://floating-ui.com/docs/shift
574
+ */
575
+ const shift$1 = function (options) {
576
+ if (options === void 0) {
577
+ options = {};
578
+ }
579
+ return {
580
+ name: 'shift',
581
+ options,
582
+ async fn(state) {
583
+ const {
584
+ x,
585
+ y,
586
+ placement
587
+ } = state;
588
+ const {
589
+ mainAxis: checkMainAxis = true,
590
+ crossAxis: checkCrossAxis = false,
591
+ limiter = {
592
+ fn: _ref => {
593
+ let {
594
+ x,
595
+ y
596
+ } = _ref;
597
+ return {
598
+ x,
599
+ y
600
+ };
601
+ }
602
+ },
603
+ ...detectOverflowOptions
604
+ } = evaluate(options, state);
605
+ const coords = {
606
+ x,
607
+ y
608
+ };
609
+ const overflow = await detectOverflow(state, detectOverflowOptions);
610
+ const crossAxis = getSideAxis(getSide(placement));
611
+ const mainAxis = getOppositeAxis(crossAxis);
612
+ let mainAxisCoord = coords[mainAxis];
613
+ let crossAxisCoord = coords[crossAxis];
614
+ if (checkMainAxis) {
615
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
616
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
617
+ const min = mainAxisCoord + overflow[minSide];
618
+ const max = mainAxisCoord - overflow[maxSide];
619
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
620
+ }
621
+ if (checkCrossAxis) {
622
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
623
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
624
+ const min = crossAxisCoord + overflow[minSide];
625
+ const max = crossAxisCoord - overflow[maxSide];
626
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
627
+ }
628
+ const limitedCoords = limiter.fn({
629
+ ...state,
630
+ [mainAxis]: mainAxisCoord,
631
+ [crossAxis]: crossAxisCoord
632
+ });
633
+ return {
634
+ ...limitedCoords,
635
+ data: {
636
+ x: limitedCoords.x - x,
637
+ y: limitedCoords.y - y,
638
+ enabled: {
639
+ [mainAxis]: checkMainAxis,
640
+ [crossAxis]: checkCrossAxis
641
+ }
642
+ }
643
+ };
644
+ }
645
+ };
646
+ };
647
+
648
+ /**
649
+ * Provides data that allows you to change the size of the floating element —
650
+ * for instance, prevent it from overflowing the clipping boundary or match the
651
+ * width of the reference element.
652
+ * @see https://floating-ui.com/docs/size
653
+ */
654
+ const size$1 = function (options) {
655
+ if (options === void 0) {
656
+ options = {};
657
+ }
658
+ return {
659
+ name: 'size',
660
+ options,
661
+ async fn(state) {
662
+ var _state$middlewareData, _state$middlewareData2;
663
+ const {
664
+ placement,
665
+ rects,
666
+ platform,
667
+ elements
668
+ } = state;
669
+ const {
670
+ apply = () => {},
671
+ ...detectOverflowOptions
672
+ } = evaluate(options, state);
673
+ const overflow = await detectOverflow(state, detectOverflowOptions);
674
+ const side = getSide(placement);
675
+ const alignment = getAlignment(placement);
676
+ const isYAxis = getSideAxis(placement) === 'y';
677
+ const {
678
+ width,
679
+ height
680
+ } = rects.floating;
681
+ let heightSide;
682
+ let widthSide;
683
+ if (side === 'top' || side === 'bottom') {
684
+ heightSide = side;
685
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
686
+ } else {
687
+ widthSide = side;
688
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
689
+ }
690
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
691
+ const maximumClippingWidth = width - overflow.left - overflow.right;
692
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
693
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
694
+ const noShift = !state.middlewareData.shift;
695
+ let availableHeight = overflowAvailableHeight;
696
+ let availableWidth = overflowAvailableWidth;
697
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
698
+ availableWidth = maximumClippingWidth;
699
+ }
700
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
701
+ availableHeight = maximumClippingHeight;
702
+ }
703
+ if (noShift && !alignment) {
704
+ const xMin = max(overflow.left, 0);
705
+ const xMax = max(overflow.right, 0);
706
+ const yMin = max(overflow.top, 0);
707
+ const yMax = max(overflow.bottom, 0);
708
+ if (isYAxis) {
709
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
710
+ } else {
711
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
712
+ }
713
+ }
714
+ await apply({
715
+ ...state,
716
+ availableWidth,
717
+ availableHeight
718
+ });
719
+ const nextDimensions = await platform.getDimensions(elements.floating);
720
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
721
+ return {
722
+ reset: {
723
+ rects: true
724
+ }
725
+ };
726
+ }
727
+ return {};
728
+ }
729
+ };
730
+ };
731
+
732
+ function hasWindow() {
733
+ return typeof window !== 'undefined';
734
+ }
735
+ function getNodeName(node) {
736
+ if (isNode(node)) {
737
+ return (node.nodeName || '').toLowerCase();
738
+ }
739
+ // Mocked nodes in testing environments may not be instances of Node. By
740
+ // returning `#document` an infinite loop won't occur.
741
+ // https://github.com/floating-ui/floating-ui/issues/2317
742
+ return '#document';
743
+ }
744
+ function getWindow(node) {
745
+ var _node$ownerDocument;
746
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
747
+ }
748
+ function getDocumentElement(node) {
749
+ var _ref;
750
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
751
+ }
752
+ function isNode(value) {
753
+ if (!hasWindow()) {
754
+ return false;
755
+ }
756
+ return value instanceof Node || value instanceof getWindow(value).Node;
757
+ }
758
+ function isElement(value) {
759
+ if (!hasWindow()) {
760
+ return false;
761
+ }
762
+ return value instanceof Element || value instanceof getWindow(value).Element;
763
+ }
764
+ function isHTMLElement(value) {
765
+ if (!hasWindow()) {
766
+ return false;
767
+ }
768
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
769
+ }
770
+ function isShadowRoot(value) {
771
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
772
+ return false;
773
+ }
774
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
775
+ }
776
+ const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
777
+ function isOverflowElement(element) {
778
+ const {
779
+ overflow,
780
+ overflowX,
781
+ overflowY,
782
+ display
783
+ } = getComputedStyle$1(element);
784
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
785
+ }
786
+ const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
787
+ function isTableElement(element) {
788
+ return tableElements.has(getNodeName(element));
789
+ }
790
+ const topLayerSelectors = [':popover-open', ':modal'];
791
+ function isTopLayer(element) {
792
+ return topLayerSelectors.some(selector => {
793
+ try {
794
+ return element.matches(selector);
795
+ } catch (_e) {
796
+ return false;
797
+ }
798
+ });
799
+ }
800
+ const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
801
+ const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
802
+ const containValues = ['paint', 'layout', 'strict', 'content'];
803
+ function isContainingBlock(elementOrCss) {
804
+ const webkit = isWebKit();
805
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
806
+
807
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
808
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
809
+ return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
810
+ }
811
+ function getContainingBlock(element) {
812
+ let currentNode = getParentNode(element);
813
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
814
+ if (isContainingBlock(currentNode)) {
815
+ return currentNode;
816
+ } else if (isTopLayer(currentNode)) {
817
+ return null;
818
+ }
819
+ currentNode = getParentNode(currentNode);
820
+ }
821
+ return null;
822
+ }
823
+ function isWebKit() {
824
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
825
+ return CSS.supports('-webkit-backdrop-filter', 'none');
826
+ }
827
+ const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
828
+ function isLastTraversableNode(node) {
829
+ return lastTraversableNodeNames.has(getNodeName(node));
830
+ }
831
+ function getComputedStyle$1(element) {
832
+ return getWindow(element).getComputedStyle(element);
833
+ }
834
+ function getNodeScroll(element) {
835
+ if (isElement(element)) {
836
+ return {
837
+ scrollLeft: element.scrollLeft,
838
+ scrollTop: element.scrollTop
839
+ };
840
+ }
841
+ return {
842
+ scrollLeft: element.scrollX,
843
+ scrollTop: element.scrollY
844
+ };
845
+ }
846
+ function getParentNode(node) {
847
+ if (getNodeName(node) === 'html') {
848
+ return node;
849
+ }
850
+ const result =
851
+ // Step into the shadow DOM of the parent of a slotted node.
852
+ node.assignedSlot ||
853
+ // DOM Element detected.
854
+ node.parentNode ||
855
+ // ShadowRoot detected.
856
+ isShadowRoot(node) && node.host ||
857
+ // Fallback.
858
+ getDocumentElement(node);
859
+ return isShadowRoot(result) ? result.host : result;
860
+ }
861
+ function getNearestOverflowAncestor(node) {
862
+ const parentNode = getParentNode(node);
863
+ if (isLastTraversableNode(parentNode)) {
864
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
865
+ }
866
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
867
+ return parentNode;
868
+ }
869
+ return getNearestOverflowAncestor(parentNode);
870
+ }
871
+ function getOverflowAncestors(node, list, traverseIframes) {
872
+ var _node$ownerDocument2;
873
+ if (list === void 0) {
874
+ list = [];
875
+ }
876
+ if (traverseIframes === void 0) {
877
+ traverseIframes = true;
878
+ }
879
+ const scrollableAncestor = getNearestOverflowAncestor(node);
880
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
881
+ const win = getWindow(scrollableAncestor);
882
+ if (isBody) {
883
+ const frameElement = getFrameElement(win);
884
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
885
+ }
886
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
887
+ }
888
+ function getFrameElement(win) {
889
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
890
+ }
891
+
892
+ function getCssDimensions(element) {
893
+ const css = getComputedStyle$1(element);
894
+ // In testing environments, the `width` and `height` properties are empty
895
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
896
+ let width = parseFloat(css.width) || 0;
897
+ let height = parseFloat(css.height) || 0;
898
+ const hasOffset = isHTMLElement(element);
899
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
900
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
901
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
902
+ if (shouldFallback) {
903
+ width = offsetWidth;
904
+ height = offsetHeight;
905
+ }
906
+ return {
907
+ width,
908
+ height,
909
+ $: shouldFallback
910
+ };
911
+ }
912
+
913
+ function unwrapElement(element) {
914
+ return !isElement(element) ? element.contextElement : element;
915
+ }
916
+
917
+ function getScale(element) {
918
+ const domElement = unwrapElement(element);
919
+ if (!isHTMLElement(domElement)) {
920
+ return createCoords(1);
921
+ }
922
+ const rect = domElement.getBoundingClientRect();
923
+ const {
924
+ width,
925
+ height,
926
+ $
927
+ } = getCssDimensions(domElement);
928
+ let x = ($ ? round(rect.width) : rect.width) / width;
929
+ let y = ($ ? round(rect.height) : rect.height) / height;
930
+
931
+ // 0, NaN, or Infinity should always fallback to 1.
932
+
933
+ if (!x || !Number.isFinite(x)) {
934
+ x = 1;
935
+ }
936
+ if (!y || !Number.isFinite(y)) {
937
+ y = 1;
938
+ }
939
+ return {
940
+ x,
941
+ y
942
+ };
943
+ }
944
+
945
+ const noOffsets = /*#__PURE__*/createCoords(0);
946
+ function getVisualOffsets(element) {
947
+ const win = getWindow(element);
948
+ if (!isWebKit() || !win.visualViewport) {
949
+ return noOffsets;
950
+ }
951
+ return {
952
+ x: win.visualViewport.offsetLeft,
953
+ y: win.visualViewport.offsetTop
954
+ };
955
+ }
956
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
957
+ if (isFixed === void 0) {
958
+ isFixed = false;
959
+ }
960
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
961
+ return false;
962
+ }
963
+ return isFixed;
964
+ }
965
+
966
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
967
+ if (includeScale === void 0) {
968
+ includeScale = false;
969
+ }
970
+ if (isFixedStrategy === void 0) {
971
+ isFixedStrategy = false;
972
+ }
973
+ const clientRect = element.getBoundingClientRect();
974
+ const domElement = unwrapElement(element);
975
+ let scale = createCoords(1);
976
+ if (includeScale) {
977
+ if (offsetParent) {
978
+ if (isElement(offsetParent)) {
979
+ scale = getScale(offsetParent);
980
+ }
981
+ } else {
982
+ scale = getScale(element);
983
+ }
984
+ }
985
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
986
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
987
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
988
+ let width = clientRect.width / scale.x;
989
+ let height = clientRect.height / scale.y;
990
+ if (domElement) {
991
+ const win = getWindow(domElement);
992
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
993
+ let currentWin = win;
994
+ let currentIFrame = getFrameElement(currentWin);
995
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
996
+ const iframeScale = getScale(currentIFrame);
997
+ const iframeRect = currentIFrame.getBoundingClientRect();
998
+ const css = getComputedStyle$1(currentIFrame);
999
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1000
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1001
+ x *= iframeScale.x;
1002
+ y *= iframeScale.y;
1003
+ width *= iframeScale.x;
1004
+ height *= iframeScale.y;
1005
+ x += left;
1006
+ y += top;
1007
+ currentWin = getWindow(currentIFrame);
1008
+ currentIFrame = getFrameElement(currentWin);
1009
+ }
1010
+ }
1011
+ return rectToClientRect({
1012
+ width,
1013
+ height,
1014
+ x,
1015
+ y
1016
+ });
1017
+ }
1018
+
1019
+ // If <html> has a CSS width greater than the viewport, then this will be
1020
+ // incorrect for RTL.
1021
+ function getWindowScrollBarX(element, rect) {
1022
+ const leftScroll = getNodeScroll(element).scrollLeft;
1023
+ if (!rect) {
1024
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1025
+ }
1026
+ return rect.left + leftScroll;
1027
+ }
1028
+
1029
+ function getHTMLOffset(documentElement, scroll) {
1030
+ const htmlRect = documentElement.getBoundingClientRect();
1031
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1032
+ const y = htmlRect.top + scroll.scrollTop;
1033
+ return {
1034
+ x,
1035
+ y
1036
+ };
1037
+ }
1038
+
1039
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1040
+ let {
1041
+ elements,
1042
+ rect,
1043
+ offsetParent,
1044
+ strategy
1045
+ } = _ref;
1046
+ const isFixed = strategy === 'fixed';
1047
+ const documentElement = getDocumentElement(offsetParent);
1048
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1049
+ if (offsetParent === documentElement || topLayer && isFixed) {
1050
+ return rect;
1051
+ }
1052
+ let scroll = {
1053
+ scrollLeft: 0,
1054
+ scrollTop: 0
1055
+ };
1056
+ let scale = createCoords(1);
1057
+ const offsets = createCoords(0);
1058
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1059
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1060
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1061
+ scroll = getNodeScroll(offsetParent);
1062
+ }
1063
+ if (isHTMLElement(offsetParent)) {
1064
+ const offsetRect = getBoundingClientRect(offsetParent);
1065
+ scale = getScale(offsetParent);
1066
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1067
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1068
+ }
1069
+ }
1070
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1071
+ return {
1072
+ width: rect.width * scale.x,
1073
+ height: rect.height * scale.y,
1074
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1075
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1076
+ };
1077
+ }
1078
+
1079
+ function getClientRects(element) {
1080
+ return Array.from(element.getClientRects());
1081
+ }
1082
+
1083
+ // Gets the entire size of the scrollable document area, even extending outside
1084
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1085
+ function getDocumentRect(element) {
1086
+ const html = getDocumentElement(element);
1087
+ const scroll = getNodeScroll(element);
1088
+ const body = element.ownerDocument.body;
1089
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1090
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1091
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1092
+ const y = -scroll.scrollTop;
1093
+ if (getComputedStyle$1(body).direction === 'rtl') {
1094
+ x += max(html.clientWidth, body.clientWidth) - width;
1095
+ }
1096
+ return {
1097
+ width,
1098
+ height,
1099
+ x,
1100
+ y
1101
+ };
1102
+ }
1103
+
1104
+ // Safety check: ensure the scrollbar space is reasonable in case this
1105
+ // calculation is affected by unusual styles.
1106
+ // Most scrollbars leave 15-18px of space.
1107
+ const SCROLLBAR_MAX = 25;
1108
+ function getViewportRect(element, strategy) {
1109
+ const win = getWindow(element);
1110
+ const html = getDocumentElement(element);
1111
+ const visualViewport = win.visualViewport;
1112
+ let width = html.clientWidth;
1113
+ let height = html.clientHeight;
1114
+ let x = 0;
1115
+ let y = 0;
1116
+ if (visualViewport) {
1117
+ width = visualViewport.width;
1118
+ height = visualViewport.height;
1119
+ const visualViewportBased = isWebKit();
1120
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1121
+ x = visualViewport.offsetLeft;
1122
+ y = visualViewport.offsetTop;
1123
+ }
1124
+ }
1125
+ const windowScrollbarX = getWindowScrollBarX(html);
1126
+ // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1127
+ // visual width of the <html> but this is not considered in the size
1128
+ // of `html.clientWidth`.
1129
+ if (windowScrollbarX <= 0) {
1130
+ const doc = html.ownerDocument;
1131
+ const body = doc.body;
1132
+ const bodyStyles = getComputedStyle(body);
1133
+ const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1134
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1135
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1136
+ width -= clippingStableScrollbarWidth;
1137
+ }
1138
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1139
+ // If the <body> scrollbar is on the left, the width needs to be extended
1140
+ // by the scrollbar amount so there isn't extra space on the right.
1141
+ width += windowScrollbarX;
1142
+ }
1143
+ return {
1144
+ width,
1145
+ height,
1146
+ x,
1147
+ y
1148
+ };
1149
+ }
1150
+
1151
+ const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1152
+ // Returns the inner client rect, subtracting scrollbars if present.
1153
+ function getInnerBoundingClientRect(element, strategy) {
1154
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1155
+ const top = clientRect.top + element.clientTop;
1156
+ const left = clientRect.left + element.clientLeft;
1157
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1158
+ const width = element.clientWidth * scale.x;
1159
+ const height = element.clientHeight * scale.y;
1160
+ const x = left * scale.x;
1161
+ const y = top * scale.y;
1162
+ return {
1163
+ width,
1164
+ height,
1165
+ x,
1166
+ y
1167
+ };
1168
+ }
1169
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1170
+ let rect;
1171
+ if (clippingAncestor === 'viewport') {
1172
+ rect = getViewportRect(element, strategy);
1173
+ } else if (clippingAncestor === 'document') {
1174
+ rect = getDocumentRect(getDocumentElement(element));
1175
+ } else if (isElement(clippingAncestor)) {
1176
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1177
+ } else {
1178
+ const visualOffsets = getVisualOffsets(element);
1179
+ rect = {
1180
+ x: clippingAncestor.x - visualOffsets.x,
1181
+ y: clippingAncestor.y - visualOffsets.y,
1182
+ width: clippingAncestor.width,
1183
+ height: clippingAncestor.height
1184
+ };
1185
+ }
1186
+ return rectToClientRect(rect);
1187
+ }
1188
+ function hasFixedPositionAncestor(element, stopNode) {
1189
+ const parentNode = getParentNode(element);
1190
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1191
+ return false;
1192
+ }
1193
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1194
+ }
1195
+
1196
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1197
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1198
+ // of the given element up the tree.
1199
+ function getClippingElementAncestors(element, cache) {
1200
+ const cachedResult = cache.get(element);
1201
+ if (cachedResult) {
1202
+ return cachedResult;
1203
+ }
1204
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1205
+ let currentContainingBlockComputedStyle = null;
1206
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1207
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1208
+
1209
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1210
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1211
+ const computedStyle = getComputedStyle$1(currentNode);
1212
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1213
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1214
+ currentContainingBlockComputedStyle = null;
1215
+ }
1216
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1217
+ if (shouldDropCurrentNode) {
1218
+ // Drop non-containing blocks.
1219
+ result = result.filter(ancestor => ancestor !== currentNode);
1220
+ } else {
1221
+ // Record last containing block for next iteration.
1222
+ currentContainingBlockComputedStyle = computedStyle;
1223
+ }
1224
+ currentNode = getParentNode(currentNode);
1225
+ }
1226
+ cache.set(element, result);
1227
+ return result;
1228
+ }
1229
+
1230
+ // Gets the maximum area that the element is visible in due to any number of
1231
+ // clipping ancestors.
1232
+ function getClippingRect(_ref) {
1233
+ let {
1234
+ element,
1235
+ boundary,
1236
+ rootBoundary,
1237
+ strategy
1238
+ } = _ref;
1239
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1240
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1241
+ const firstClippingAncestor = clippingAncestors[0];
1242
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1243
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1244
+ accRect.top = max(rect.top, accRect.top);
1245
+ accRect.right = min(rect.right, accRect.right);
1246
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1247
+ accRect.left = max(rect.left, accRect.left);
1248
+ return accRect;
1249
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1250
+ return {
1251
+ width: clippingRect.right - clippingRect.left,
1252
+ height: clippingRect.bottom - clippingRect.top,
1253
+ x: clippingRect.left,
1254
+ y: clippingRect.top
1255
+ };
1256
+ }
1257
+
1258
+ function getDimensions(element) {
1259
+ const {
1260
+ width,
1261
+ height
1262
+ } = getCssDimensions(element);
1263
+ return {
1264
+ width,
1265
+ height
1266
+ };
1267
+ }
1268
+
1269
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1270
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1271
+ const documentElement = getDocumentElement(offsetParent);
1272
+ const isFixed = strategy === 'fixed';
1273
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1274
+ let scroll = {
1275
+ scrollLeft: 0,
1276
+ scrollTop: 0
1277
+ };
1278
+ const offsets = createCoords(0);
1279
+
1280
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1281
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1282
+ function setLeftRTLScrollbarOffset() {
1283
+ offsets.x = getWindowScrollBarX(documentElement);
1284
+ }
1285
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1286
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1287
+ scroll = getNodeScroll(offsetParent);
1288
+ }
1289
+ if (isOffsetParentAnElement) {
1290
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1291
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1292
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1293
+ } else if (documentElement) {
1294
+ setLeftRTLScrollbarOffset();
1295
+ }
1296
+ }
1297
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1298
+ setLeftRTLScrollbarOffset();
1299
+ }
1300
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1301
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1302
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1303
+ return {
1304
+ x,
1305
+ y,
1306
+ width: rect.width,
1307
+ height: rect.height
1308
+ };
1309
+ }
1310
+
1311
+ function isStaticPositioned(element) {
1312
+ return getComputedStyle$1(element).position === 'static';
1313
+ }
1314
+
1315
+ function getTrueOffsetParent(element, polyfill) {
1316
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1317
+ return null;
1318
+ }
1319
+ if (polyfill) {
1320
+ return polyfill(element);
1321
+ }
1322
+ let rawOffsetParent = element.offsetParent;
1323
+
1324
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1325
+ // while Chrome and Safari return the <body> element. The <body> element must
1326
+ // be used to perform the correct calculations even if the <html> element is
1327
+ // non-static.
1328
+ if (getDocumentElement(element) === rawOffsetParent) {
1329
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1330
+ }
1331
+ return rawOffsetParent;
1332
+ }
1333
+
1334
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1335
+ // such as table ancestors and cross browser bugs.
1336
+ function getOffsetParent(element, polyfill) {
1337
+ const win = getWindow(element);
1338
+ if (isTopLayer(element)) {
1339
+ return win;
1340
+ }
1341
+ if (!isHTMLElement(element)) {
1342
+ let svgOffsetParent = getParentNode(element);
1343
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1344
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1345
+ return svgOffsetParent;
1346
+ }
1347
+ svgOffsetParent = getParentNode(svgOffsetParent);
1348
+ }
1349
+ return win;
1350
+ }
1351
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1352
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1353
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1354
+ }
1355
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1356
+ return win;
1357
+ }
1358
+ return offsetParent || getContainingBlock(element) || win;
1359
+ }
1360
+
1361
+ const getElementRects = async function (data) {
1362
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1363
+ const getDimensionsFn = this.getDimensions;
1364
+ const floatingDimensions = await getDimensionsFn(data.floating);
1365
+ return {
1366
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1367
+ floating: {
1368
+ x: 0,
1369
+ y: 0,
1370
+ width: floatingDimensions.width,
1371
+ height: floatingDimensions.height
1372
+ }
1373
+ };
1374
+ };
1375
+
1376
+ function isRTL(element) {
1377
+ return getComputedStyle$1(element).direction === 'rtl';
1378
+ }
1379
+
1380
+ const platform = {
1381
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1382
+ getDocumentElement,
1383
+ getClippingRect,
1384
+ getOffsetParent,
1385
+ getElementRects,
1386
+ getClientRects,
1387
+ getDimensions,
1388
+ getScale,
1389
+ isElement,
1390
+ isRTL
1391
+ };
1392
+
1393
+ function rectsAreEqual(a, b) {
1394
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1395
+ }
1396
+
1397
+ // https://samthor.au/2021/observing-dom/
1398
+ function observeMove(element, onMove) {
1399
+ let io = null;
1400
+ let timeoutId;
1401
+ const root = getDocumentElement(element);
1402
+ function cleanup() {
1403
+ var _io;
1404
+ clearTimeout(timeoutId);
1405
+ (_io = io) == null || _io.disconnect();
1406
+ io = null;
1407
+ }
1408
+ function refresh(skip, threshold) {
1409
+ if (skip === void 0) {
1410
+ skip = false;
1411
+ }
1412
+ if (threshold === void 0) {
1413
+ threshold = 1;
1414
+ }
1415
+ cleanup();
1416
+ const elementRectForRootMargin = element.getBoundingClientRect();
1417
+ const {
1418
+ left,
1419
+ top,
1420
+ width,
1421
+ height
1422
+ } = elementRectForRootMargin;
1423
+ if (!skip) {
1424
+ onMove();
1425
+ }
1426
+ if (!width || !height) {
1427
+ return;
1428
+ }
1429
+ const insetTop = floor(top);
1430
+ const insetRight = floor(root.clientWidth - (left + width));
1431
+ const insetBottom = floor(root.clientHeight - (top + height));
1432
+ const insetLeft = floor(left);
1433
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1434
+ const options = {
1435
+ rootMargin,
1436
+ threshold: max(0, min(1, threshold)) || 1
1437
+ };
1438
+ let isFirstUpdate = true;
1439
+ function handleObserve(entries) {
1440
+ const ratio = entries[0].intersectionRatio;
1441
+ if (ratio !== threshold) {
1442
+ if (!isFirstUpdate) {
1443
+ return refresh();
1444
+ }
1445
+ if (!ratio) {
1446
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1447
+ // to prevent an infinite loop of updates.
1448
+ timeoutId = setTimeout(() => {
1449
+ refresh(false, 1e-7);
1450
+ }, 1000);
1451
+ } else {
1452
+ refresh(false, ratio);
1453
+ }
1454
+ }
1455
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1456
+ // It's possible that even though the ratio is reported as 1, the
1457
+ // element is not actually fully within the IntersectionObserver's root
1458
+ // area anymore. This can happen under performance constraints. This may
1459
+ // be a bug in the browser's IntersectionObserver implementation. To
1460
+ // work around this, we compare the element's bounding rect now with
1461
+ // what it was at the time we created the IntersectionObserver. If they
1462
+ // are not equal then the element moved, so we refresh.
1463
+ refresh();
1464
+ }
1465
+ isFirstUpdate = false;
1466
+ }
1467
+
1468
+ // Older browsers don't support a `document` as the root and will throw an
1469
+ // error.
1470
+ try {
1471
+ io = new IntersectionObserver(handleObserve, {
1472
+ ...options,
1473
+ // Handle <iframe>s
1474
+ root: root.ownerDocument
1475
+ });
1476
+ } catch (_e) {
1477
+ io = new IntersectionObserver(handleObserve, options);
1478
+ }
1479
+ io.observe(element);
1480
+ }
1481
+ refresh(true);
1482
+ return cleanup;
1483
+ }
1484
+
1485
+ /**
1486
+ * Automatically updates the position of the floating element when necessary.
1487
+ * Should only be called when the floating element is mounted on the DOM or
1488
+ * visible on the screen.
1489
+ * @returns cleanup function that should be invoked when the floating element is
1490
+ * removed from the DOM or hidden from the screen.
1491
+ * @see https://floating-ui.com/docs/autoUpdate
1492
+ */
1493
+ function autoUpdate(reference, floating, update, options) {
1494
+ if (options === void 0) {
1495
+ options = {};
1496
+ }
1497
+ const {
1498
+ ancestorScroll = true,
1499
+ ancestorResize = true,
1500
+ elementResize = typeof ResizeObserver === 'function',
1501
+ layoutShift = typeof IntersectionObserver === 'function',
1502
+ animationFrame = false
1503
+ } = options;
1504
+ const referenceEl = unwrapElement(reference);
1505
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1506
+ ancestors.forEach(ancestor => {
1507
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1508
+ passive: true
1509
+ });
1510
+ ancestorResize && ancestor.addEventListener('resize', update);
1511
+ });
1512
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1513
+ let reobserveFrame = -1;
1514
+ let resizeObserver = null;
1515
+ if (elementResize) {
1516
+ resizeObserver = new ResizeObserver(_ref => {
1517
+ let [firstEntry] = _ref;
1518
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1519
+ // Prevent update loops when using the `size` middleware.
1520
+ // https://github.com/floating-ui/floating-ui/issues/1740
1521
+ resizeObserver.unobserve(floating);
1522
+ cancelAnimationFrame(reobserveFrame);
1523
+ reobserveFrame = requestAnimationFrame(() => {
1524
+ var _resizeObserver;
1525
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1526
+ });
1527
+ }
1528
+ update();
1529
+ });
1530
+ if (referenceEl && !animationFrame) {
1531
+ resizeObserver.observe(referenceEl);
1532
+ }
1533
+ resizeObserver.observe(floating);
1534
+ }
1535
+ let frameId;
1536
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1537
+ if (animationFrame) {
1538
+ frameLoop();
1539
+ }
1540
+ function frameLoop() {
1541
+ const nextRefRect = getBoundingClientRect(reference);
1542
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1543
+ update();
1544
+ }
1545
+ prevRefRect = nextRefRect;
1546
+ frameId = requestAnimationFrame(frameLoop);
1547
+ }
1548
+ update();
1549
+ return () => {
1550
+ var _resizeObserver2;
1551
+ ancestors.forEach(ancestor => {
1552
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1553
+ ancestorResize && ancestor.removeEventListener('resize', update);
1554
+ });
1555
+ cleanupIo == null || cleanupIo();
1556
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1557
+ resizeObserver = null;
1558
+ if (animationFrame) {
1559
+ cancelAnimationFrame(frameId);
1560
+ }
1561
+ };
1562
+ }
1563
+
1564
+ /**
1565
+ * Modifies the placement by translating the floating element along the
1566
+ * specified axes.
1567
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1568
+ * object may be passed.
1569
+ * @see https://floating-ui.com/docs/offset
1570
+ */
1571
+ const offset = offset$1;
1572
+
1573
+ /**
1574
+ * Optimizes the visibility of the floating element by shifting it in order to
1575
+ * keep it in view when it will overflow the clipping boundary.
1576
+ * @see https://floating-ui.com/docs/shift
1577
+ */
1578
+ const shift = shift$1;
1579
+
1580
+ /**
1581
+ * Optimizes the visibility of the floating element by flipping the `placement`
1582
+ * in order to keep it in view when the preferred placement(s) will overflow the
1583
+ * clipping boundary. Alternative to `autoPlacement`.
1584
+ * @see https://floating-ui.com/docs/flip
1585
+ */
1586
+ const flip = flip$1;
1587
+
1588
+ /**
1589
+ * Provides data that allows you to change the size of the floating element —
1590
+ * for instance, prevent it from overflowing the clipping boundary or match the
1591
+ * width of the reference element.
1592
+ * @see https://floating-ui.com/docs/size
1593
+ */
1594
+ const size = size$1;
1595
+
1596
+ /**
1597
+ * Computes the `x` and `y` coordinates that will place the floating element
1598
+ * next to a given reference element.
1599
+ */
1600
+ const computePosition = (reference, floating, options) => {
1601
+ // This caches the expensive `getClippingElementAncestors` function so that
1602
+ // multiple lifecycle resets re-use the same result. It only lives for a
1603
+ // single call. If other functions become expensive, we can add them as well.
1604
+ const cache = new Map();
1605
+ const mergedOptions = {
1606
+ platform,
1607
+ ...options
1608
+ };
1609
+ const platformWithCache = {
1610
+ ...mergedOptions.platform,
1611
+ _c: cache
1612
+ };
1613
+ return computePosition$1(reference, floating, {
1614
+ ...mergedOptions,
1615
+ platform: platformWithCache
1616
+ });
1617
+ };
1618
+
1619
+ const curaSelectCss = ":host{display:block;position:relative;font-family:var(--font-family)}.wrapper{width:100%;user-select:none;text-align:left !important}.wrapper cura-label{margin-bottom:8px}.wrapper .helper-text{margin-top:8px;color:var(--neutral-dark)}.wrapper .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper .cura-input-field .feedback-icon{padding-left:12px}.wrapper .cura-input-field .up-down-icon{order:3;padding-right:6px;cursor:pointer;pointer-events:all}.wrapper .cura-input-field .up-down-button{background-color:transparent;border:none}.wrapper .cura-input-field input{padding:0px 12px 0px 8px;cursor:pointer}.wrapper .cura-input-field.open{border-radius:4px 4px 0 0 !important}.wrapper.transparent{background-color:transparent;padding:0px;max-height:80px}.wrapper.transparent .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;background-color:transparent !important;border:none !important;border-radius:0;height:27px}.wrapper.transparent .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.transparent .cura-input-field .feedback-icon{padding-left:12px}.wrapper.transparent .cura-input-field input{color:var(--neutral-black) !important;font-size:16px;font-weight:var(--font-weight-bold) !important;padding:0}.wrapper.transparent .cura-input-field input::placeholder{color:var(--neutral-black)}.wrapper.transparent .cura-input-field .feedback-icon{order:3;margin:0 20px 0 0}.wrapper.transparent:focus-within .cura-input-field{border:none !important;background-color:transparent !important}.wrapper.transparent:focus-within .cura-input-field input{border:none !important;outline:none}.wrapper.transparent .helper-text{margin-top:0px}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field{border-color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input{color:var(--neutral-dark)}.wrapper:hover:not(.disabled):not(.isLoading):not(.success):not(.error):not(.isFocused):not(.readOnly):not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper:focus-within:not(.selection) .cura-input-field{border:2px solid var(--info-base) !important;background-color:var(--neutral-purewhite);outline:none}.wrapper:focus-within:not(.selection) .cura-input-field input{color:var(--neutral-black) !important}.wrapper:focus-within.selection .cura-input-field{border-radius:4px 4px 0px 0px}.wrapper.success .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.success .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success .cura-input-field .feedback-icon{padding-left:12px}.wrapper.success .cura-input-field input{color:var(--success-darker) !important}.wrapper.success .cura-input-field input::placeholder{color:var(--success-darker) !important}.wrapper.success:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--success-dark) !important;background-color:var(--success-lighter) !important}.wrapper.success:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.success:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.success:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box}.wrapper.error .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error .cura-input-field .feedback-icon{padding-left:12px}.wrapper.error .cura-input-field input{color:var(--error-darker) !important}.wrapper.error .cura-input-field input::placeholder{color:var(--error-darker) !important}.wrapper.error:not(.transparent) .cura-input-field{width:100%;height:40px;display:flex;flex-direction:row;align-items:center;background-color:var(--neutral-purewhite);border:2px solid var(--neutral-medium);border-radius:4px;color:var(--primary-base);letter-spacing:0.32px;line-height:20px;overflow:hidden;box-sizing:border-box;border:2px solid var(--error-dark) !important;background-color:var(--error-lighter) !important}.wrapper.error:not(.transparent) .cura-input-field input{flex:1;width:100%;height:100%;background:transparent;border:none;outline:none;color:var(--neutral-dark);font-family:var(--font-family);font-weight:var(--font-weight-medium);font-size:14px;box-sizing:border-box;padding:0px 12px 0px 8px}.wrapper.error:not(.transparent) .cura-input-field input::placeholder{color:var(--neutral-dark)}.wrapper.error:not(.transparent) .cura-input-field .feedback-icon{padding-left:12px}.wrapper.disabled .cura-input-field{background-color:var(--neutral-white);border:2px solid var(--neutral-base)}.wrapper.disabled .cura-input-field input{color:var(--neutral-medium)}.wrapper.disabled .cura-input-field input::placeholder{color:var(--neutral-medium)}.required{color:red}.menu{position:fixed;left:0;top:0;box-sizing:border-box;background:#fff;border:2px solid var(--neutral-light);border-radius:4px;z-index:1000;max-height:var(--max-height);overflow:hidden;border-top:transparent;align-items:center;scrollbar-color:var(--neutral-medium) var(--neutral-black-20);overflow-y:auto;box-shadow:0px 4px 8px 0px rgba(38, 38, 38, 0.16)}.menu.open{border-radius:0 !important;padding:12px}";
1620
+
1621
+ const CuraSelect = /*@__PURE__*/ proxyCustomElement(class CuraSelect extends H {
1622
+ constructor() {
1623
+ super();
1624
+ this.__registerHost();
1625
+ this.__attachShadow();
1626
+ this.selected = createEvent(this, "selected");
1627
+ this.searchTermInput = createEvent(this, "searchTermInput");
1628
+ this.internals = this.attachInternals();
1629
+ /**
1630
+ * The label text for the select component.
1631
+ * Reflects as an attribute in the DOM.
1632
+ */
1633
+ this.label = '';
1634
+ /**
1635
+ * Placeholder text for the input field.
1636
+ * Reflects as an attribute in the DOM.
1637
+ */
1638
+ this.placeholder = '';
1639
+ /**
1640
+ * Current value of the select component.
1641
+ * Reflects as an attribute in the DOM and is mutable.
1642
+ */
1643
+ this.value = '';
1644
+ /**
1645
+ * Display mode of the select component.
1646
+ * Can be 'default' or 'transparent'.
1647
+ */
1648
+ this.mode = 'default';
1649
+ /**
1650
+ * Size of the select component.
1651
+ * Can be 'small', 'medium', or 'large'.
1652
+ */
1653
+ this.size = 'medium';
1654
+ /**
1655
+ * Status of the select component.
1656
+ * Can be 'success', 'error', or 'default'.
1657
+ */
1658
+ this.status = 'default';
1659
+ /**
1660
+ * Whether the select component is disabled.
1661
+ * Reflects as an attribute in the DOM.
1662
+ */
1663
+ this.disabled = false;
1664
+ /**
1665
+ * Whether the select component is required.
1666
+ * Reflects as an attribute in the DOM.
1667
+ */
1668
+ this.required = false;
1669
+ /**
1670
+ * Enable / Disable search at options by term.
1671
+ * Default: false
1672
+ */
1673
+ this.searchBehavior = false;
1674
+ /**
1675
+ * The search will be sensitive to accents.
1676
+ * Default: true
1677
+ */
1678
+ this.caseSensitive = true;
1679
+ /**
1680
+ * CSS max-height property for dropdown item.
1681
+ * Can also be used by css property --max-height.
1682
+ * Default: 285px
1683
+ */
1684
+ this.maxHeight = '285px';
1685
+ /**
1686
+ * Internal state: Whether the input is hovered.
1687
+ * Default: false
1688
+ */
1689
+ this.isHovered = false;
1690
+ /**
1691
+ * Internal state: Whether the input is focused.
1692
+ * Default: false
1693
+ */
1694
+ this.isFocused = false;
1695
+ /**
1696
+ * Internal state: Whether the dropdown menu is open.
1697
+ * Default: false
1698
+ */
1699
+ this.isOpen = false;
1700
+ this.isPositioned = false;
1701
+ this.menuStyle = {
1702
+ top: '0px',
1703
+ left: '0px',
1704
+ width: '0px',
1705
+ maxHeight: this.maxHeight,
1706
+ };
1707
+ this.activeIndex = -1;
1708
+ this.preferredPlacement = 'bottom';
1709
+ this.textInput = '';
1710
+ this.floatingPlacement = 'bottom-start';
1711
+ /**
1712
+ * Styles to be applied to the component.
1713
+ */
1714
+ this.styles = {};
1715
+ /**
1716
+ * Theme object containing font and color information.
1717
+ */
1718
+ this.theme = window.CuraAPI.theme;
1719
+ /**
1720
+ * Handles mutations observed by the MutationObserver.
1721
+ * Updates the selected option or filters options based on the mutation type.
1722
+ */
1723
+ this.handleMutations = (mutations) => {
1724
+ mutations.forEach(mutation => {
1725
+ if (mutation.type === 'attributes') {
1726
+ if (mutation.attributeName === 'selected')
1727
+ this.updateSelectedOption();
1728
+ }
1729
+ });
1730
+ };
1731
+ /**
1732
+ * Handles the selection of an option.
1733
+ */
1734
+ this.onOptiselected = (event) => {
1735
+ const selectedOption = event.target;
1736
+ this.clearSelectedAttributes();
1737
+ selectedOption.setAttribute('selected', 'true');
1738
+ };
1739
+ this.handleKeyNavigation = (event) => {
1740
+ var _a;
1741
+ const { code: keyCode } = event;
1742
+ if (!this.isOpen && keyCode === 'ArrowDown') {
1743
+ this.openMenu();
1744
+ this.activeIndex = 0;
1745
+ return;
1746
+ }
1747
+ if (keyCode === 'ArrowDown') {
1748
+ event.preventDefault();
1749
+ this.updateActiveIndex(1);
1750
+ }
1751
+ if (keyCode === 'ArrowUp') {
1752
+ event.preventDefault();
1753
+ this.updateActiveIndex(-1);
1754
+ }
1755
+ if (keyCode === 'Enter' || keyCode === 'Space') {
1756
+ (_a = this.options[this.activeIndex]) === null || _a === void 0 ? void 0 : _a.click();
1757
+ }
1758
+ if (keyCode === 'Escape') {
1759
+ this.closeMenu();
1760
+ }
1761
+ };
1762
+ this.handleInputChange = (e) => {
1763
+ this.textInput = e.target.value;
1764
+ if (this.searchBehavior) {
1765
+ if (this.textInput.length > 0 && !this.isOpen)
1766
+ this.openMenu();
1767
+ if (this.textInput.length === 0 && this.isOpen)
1768
+ this.closeMenu();
1769
+ }
1770
+ this.internals.setFormValue(this.textInput);
1771
+ };
1772
+ this.handleClick = (event) => {
1773
+ if (this.disabled)
1774
+ return event.preventDefault();
1775
+ const target = event.target;
1776
+ if (target.tagName === 'CURA-SELECT-OPTION')
1777
+ return this.onOptiselected(event);
1778
+ this.isOpen ? this.closeMenu() : this.openMenu();
1779
+ };
1780
+ this.handleClickOutside = (event) => {
1781
+ const path = (event.composedPath && event.composedPath()) || [];
1782
+ const clickedOutside = !path.includes(this.host) && !(this.menuElement && path.includes(this.menuElement));
1783
+ if (clickedOutside) {
1784
+ this.closeMenu();
1785
+ }
1786
+ };
1787
+ this.handleViewportChange = () => {
1788
+ if (!this.isOpen)
1789
+ return;
1790
+ this.updateMenuPosition();
1791
+ };
1792
+ }
1793
+ updateOptionHighlights(newActiveINdex) {
1794
+ this.options.forEach((option, index) => (option.active = index === newActiveINdex));
1795
+ }
1796
+ /**
1797
+ * Filters the options based on the current input value.
1798
+ */
1799
+ filterOptions(newText) {
1800
+ this.searchTermInput.emit(newText);
1801
+ if (!this.isOpen || !this.searchBehavior) {
1802
+ return;
1803
+ }
1804
+ const removeAccents = (str) => {
1805
+ return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
1806
+ };
1807
+ let searchTerm = newText;
1808
+ if (!this.caseSensitive) {
1809
+ searchTerm = removeAccents(searchTerm).toLocaleLowerCase();
1810
+ }
1811
+ this.options.forEach(option => {
1812
+ let optionValue = option.textContent || '';
1813
+ if (!this.caseSensitive) {
1814
+ optionValue = removeAccents(optionValue === null || optionValue === void 0 ? void 0 : optionValue.toLowerCase());
1815
+ }
1816
+ const isVisible = optionValue.includes(searchTerm);
1817
+ option.style.display = isVisible ? 'block' : 'none';
1818
+ });
1819
+ }
1820
+ /**
1821
+ * Callback for form association.
1822
+ */
1823
+ formAssociatedCallback(form) {
1824
+ form.ariaLabel = this.label;
1825
+ }
1826
+ /**
1827
+ * Callback to restore the switch state from the form.
1828
+ */
1829
+ formStateRestoreCallback(state) {
1830
+ this.textInput = state.value;
1831
+ this.updateSelectedOption();
1832
+ }
1833
+ /**
1834
+ * Callback to reset the switch state when the form is reset.
1835
+ */
1836
+ formResetCallback() {
1837
+ this.textInput = '';
1838
+ this.clearSelectedAttributes();
1839
+ this.internals.setFormValue('');
1840
+ this.internals.setValidity({});
1841
+ }
1842
+ /**
1843
+ * Callback to update the switch's disabled state when the form's disabled state changes.
1844
+ */
1845
+ formDisabledCallback(disabled) {
1846
+ this.disabled = disabled;
1847
+ }
1848
+ /**
1849
+ * Lifecycle method called before the component is rendered.
1850
+ * Initializes the options for the select component.
1851
+ */
1852
+ componentWillLoad() {
1853
+ this.initializeOptions();
1854
+ }
1855
+ /**
1856
+ * Lifecycle method called after the component is rendered.
1857
+ * Initializes select-related functionality.
1858
+ */
1859
+ componentDidLoad() {
1860
+ // this.initializeOptions();
1861
+ this.setupMutationObserver();
1862
+ this.addOutsideClickListener();
1863
+ this.addPositionListeners();
1864
+ }
1865
+ /**
1866
+ * Lifecycle method called when the component is connected to the DOM.
1867
+ * Applies styles based on the theme.
1868
+ */
1869
+ connectedCallback() {
1870
+ this.applyStyles();
1871
+ }
1872
+ /**
1873
+ * Lifecycle method called when the component is disconnected from the DOM.
1874
+ * Disconnects the MutationObserver if it exists.
1875
+ */
1876
+ disconnectedCallback() {
1877
+ var _a, _b;
1878
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1879
+ this.removeOutsideClickListener();
1880
+ this.removePositionListeners();
1881
+ (_b = this.cleanupAutoUpdate) === null || _b === void 0 ? void 0 : _b.call(this);
1882
+ }
1883
+ initializeOptions() {
1884
+ var _a;
1885
+ this.options = this.host.querySelectorAll('cura-select-option');
1886
+ this.options.forEach(option => {
1887
+ option.setAttribute('size', this.size);
1888
+ const isSelected = this.value === option.value;
1889
+ option.setAttribute('selected', JSON.stringify(isSelected));
1890
+ if (isSelected) {
1891
+ this.value = option.value;
1892
+ this.internals.setFormValue(option.value);
1893
+ }
1894
+ });
1895
+ this.textInput = ((_a = Array.from(this.options).find(option => option.value === this.value)) === null || _a === void 0 ? void 0 : _a.textContent) || this.textInput;
1896
+ }
1897
+ /**
1898
+ * Applies styles to the component based on the theme.
1899
+ */
1900
+ applyStyles() {
1901
+ const { fonts, colors } = this.theme;
1902
+ const fontWeights = fonts.getWeights();
1903
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--font-weight-medium': fontWeights.medium, '--font-weight-bold': fontWeights.bold, '--font-weight-regular': fontWeights.regular, '--font-color': fonts.getColor(), '--font-family': fonts.getFamily(), '--font-size': fonts.getSize() });
1904
+ const colorKeys = [
1905
+ 'primary-base',
1906
+ 'neutral-purewhite',
1907
+ 'neutral-white',
1908
+ 'neutral-black',
1909
+ 'neutral-medium',
1910
+ 'neutral-light',
1911
+ 'neutral-base',
1912
+ 'neutral-dark',
1913
+ 'success-dark',
1914
+ 'success-darker',
1915
+ 'success-lighter',
1916
+ 'error-lighter',
1917
+ 'error-dark',
1918
+ 'error-darker',
1919
+ 'error-base',
1920
+ 'info-base',
1921
+ ];
1922
+ colorKeys.forEach(key => {
1923
+ this.styles[`--${key}`] = colors.getColor(key);
1924
+ });
1925
+ }
1926
+ /**
1927
+ * Sets up a MutationObserver to watch for changes in the component.
1928
+ */
1929
+ setupMutationObserver() {
1930
+ this.mutationObserver = new MutationObserver(this.handleMutations);
1931
+ this.mutationObserver.observe(this.host, { attributes: true, subtree: true, attributeFilter: ['selected', 'value'] });
1932
+ }
1933
+ handleValueChange(newValue) {
1934
+ this.clearSelectedAttributes();
1935
+ const selectedOption = this.host.querySelector(`cura-select-option[value="${newValue}"]`);
1936
+ if (!selectedOption) {
1937
+ return;
1938
+ }
1939
+ selectedOption.setAttribute('selected', 'true');
1940
+ }
1941
+ updateSelectedOption() {
1942
+ const selectedOptionElement = this.host.querySelector('cura-select-option[selected]');
1943
+ if (!selectedOptionElement) {
1944
+ return;
1945
+ }
1946
+ this.value = selectedOptionElement.value;
1947
+ this.internals.setFormValue(this.value);
1948
+ if (this.textInput !== selectedOptionElement.textContent) {
1949
+ this.textInput = selectedOptionElement.textContent;
1950
+ this.closeMenu();
1951
+ this.selected.emit(selectedOptionElement.value);
1952
+ }
1953
+ }
1954
+ /**
1955
+ * Clears the 'selected' attribute from all options.
1956
+ */
1957
+ clearSelectedAttributes() {
1958
+ this.options.forEach(option => option.removeAttribute('selected'));
1959
+ }
1960
+ updateActiveIndex(direction) {
1961
+ if (this.options.length === 0)
1962
+ return;
1963
+ this.activeIndex = (this.activeIndex + direction + this.options.length) % this.options.length;
1964
+ }
1965
+ getClasses() {
1966
+ return {
1967
+ wrapper: true,
1968
+ label: !!this.label,
1969
+ disabled: this.disabled,
1970
+ transparent: this.mode === 'transparent',
1971
+ [this.size.toLowerCase()]: true,
1972
+ [this.status.toLowerCase()]: true,
1973
+ };
1974
+ }
1975
+ /**
1976
+ * Determines the color based on the item type and component state.
1977
+ */
1978
+ getColor(item) {
1979
+ if (this.disabled)
1980
+ return 'neutral-medium';
1981
+ const isStatusDefault = this.status === 'default';
1982
+ const isHoveredOrFocused = this.isFocused || this.isHovered;
1983
+ if (item === 'label') {
1984
+ if (!isStatusDefault || isHoveredOrFocused)
1985
+ return 'neutral-black';
1986
+ return 'neutral-dark';
1987
+ }
1988
+ if (isHoveredOrFocused && isStatusDefault)
1989
+ return 'neutral-black';
1990
+ if (this.status === 'success')
1991
+ return 'success-dark';
1992
+ if (this.status === 'error')
1993
+ return 'error-dark';
1994
+ return 'neutral-dark';
1995
+ }
1996
+ /**
1997
+ * Renders the icon based on the component's status.
1998
+ */
1999
+ renderIcon() {
2000
+ if (this.status === 'default' && !this.iconName)
2001
+ return null;
2002
+ const icon = { default: this.iconName, success: 'checkCircle', error: 'alertCircle' }[this.status];
2003
+ return h("cura-icon", { class: "feedback-icon", name: icon, iconset: "default", size: this.size === 'large' ? 20 : 16, color: this.getColor('icon'), style: this.styles });
2004
+ }
2005
+ openMenu() {
2006
+ this.isOpen = true;
2007
+ this.isPositioned = false;
2008
+ requestAnimationFrame(() => this.setupFloating());
2009
+ }
2010
+ closeMenu() {
2011
+ var _a;
2012
+ this.isOpen = false;
2013
+ this.isPositioned = false;
2014
+ (_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
2015
+ }
2016
+ addOutsideClickListener() {
2017
+ document.addEventListener('click', this.handleClickOutside);
2018
+ }
2019
+ removeOutsideClickListener() {
2020
+ document.removeEventListener('click', this.handleClickOutside);
2021
+ }
2022
+ addPositionListeners() {
2023
+ window.addEventListener('resize', this.handleViewportChange, { passive: true });
2024
+ window.addEventListener('scroll', this.handleViewportChange, true);
2025
+ }
2026
+ removePositionListeners() {
2027
+ window.removeEventListener('resize', this.handleViewportChange);
2028
+ window.removeEventListener('scroll', this.handleViewportChange, true);
2029
+ }
2030
+ parseMaxHeight() {
2031
+ const numeric = parseFloat(this.maxHeight);
2032
+ return Number.isFinite(numeric) ? numeric : 285;
2033
+ }
2034
+ setupFloating() {
2035
+ var _a;
2036
+ if (!this.inputWrapper || !this.menuElement)
2037
+ return;
2038
+ (_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
2039
+ this.cleanupAutoUpdate = autoUpdate(this.inputWrapper, this.menuElement, () => {
2040
+ this.updateMenuPosition();
2041
+ });
2042
+ this.updateMenuPosition();
2043
+ }
2044
+ updateMenuPosition() {
2045
+ if (!this.inputWrapper || !this.menuElement)
2046
+ return;
2047
+ computePosition(this.inputWrapper, this.menuElement, {
2048
+ strategy: 'fixed',
2049
+ placement: this.floatingPlacement,
2050
+ middleware: [
2051
+ offset(0),
2052
+ flip(),
2053
+ shift({ padding: 8 }),
2054
+ size({
2055
+ apply: ({ rects, availableHeight }) => {
2056
+ this.menuStyle = Object.assign(Object.assign({}, this.menuStyle), { width: `${rects.reference.width}px`, maxHeight: `${Math.min(availableHeight, this.parseMaxHeight())}px` });
2057
+ },
2058
+ }),
2059
+ ],
2060
+ }).then(({ x, y, placement }) => {
2061
+ this.preferredPlacement = placement.startsWith('top') ? 'top' : 'bottom';
2062
+ this.menuStyle = Object.assign(Object.assign({}, this.menuStyle), { top: `${y}px`, left: `${x}px` });
2063
+ this.isPositioned = true;
2064
+ });
2065
+ }
2066
+ render() {
2067
+ return (h(Host, { key: '8a05e5365062b5a2da4f10d7e3ca04f9d3136fba', style: this.styles, role: "combobox", "aria-label": this.label, "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error') }, h("div", { key: 'ab28fd73d68ccdc5ad6dd6cc7f79d879eaf25818', class: this.getClasses(), onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), onClick: this.handleClick }, this.label && (h("cura-label", { key: '5405aa3706b07640fdfdaa681ad22ea9c5fd9997', class: "label", weight: "bold", size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && h("span", { key: '39b37aefbf4e61572607d891eb63c737c332793c', class: "required" }, "* "))), h("div", { key: 'c339ab1ff49699fb0a348a169ba7f545b89bd593', class: {
2068
+ 'cura-input-field': true,
2069
+ 'open': this.isOpen,
2070
+ }, ref: el => (this.inputWrapper = el) }, this.renderIcon(), h("input", { key: '5118ad409b6b9c48c856670857d3cae26d28fd46', type: "text", autocomplete: "off", onFocus: () => (this.isFocused = true), onBlur: () => (this.isFocused = false), onKeyDown: this.handleKeyNavigation, "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error'), onInput: this.handleInputChange, style: this.styles, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.textInput, readonly: this.searchBehavior ? null : true }), h("button", { key: '53bddc2b1e56462a9181ce99749d98568f1c5dd9', class: "up-down-button" }, h("cura-icon", { key: '01cb20504d2e0506e7210d33e3ca75978a598eff', name: this.isOpen ? 'up' : 'down', class: "up-down-icon", color: this.disabled ? 'neutral-dark' : 'primary-base', size: 16, iconset: "default" }))), h("cura-label", { key: '550c24779f690ebd16bec881770b200ce06f5390', class: "helper-text", size: "xsmall", color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, h("slot", { key: '530f64f99df6328d3a49a449f8f924e57bb03f21' })), this.isOpen && (h("div", { key: '3ee7a6439c98a0837a3f39d27646ed7a55c630b3', class: {
2071
+ menu: true,
2072
+ open: this.isOpen,
2073
+ [this.preferredPlacement]: true,
2074
+ }, ref: el => (this.menuElement = el), style: {
2075
+ '--max-height': this.maxHeight,
2076
+ top: this.menuStyle.top,
2077
+ left: this.menuStyle.left,
2078
+ width: this.menuStyle.width,
2079
+ maxHeight: this.menuStyle.maxHeight,
2080
+ visibility: this.isPositioned ? 'visible' : 'hidden',
2081
+ opacity: this.isPositioned ? '1' : '0',
2082
+ pointerEvents: this.isPositioned ? 'auto' : 'none',
2083
+ } }, h("slot", { key: '84c3bb501966175635102b2ccbfa0cf43d2112f1', name: "option" }))))));
2084
+ }
2085
+ static get formAssociated() { return true; }
2086
+ get host() { return this; }
2087
+ static get watchers() { return {
2088
+ "activeIndex": ["updateOptionHighlights"],
2089
+ "textInput": ["filterOptions"],
2090
+ "value": ["handleValueChange"]
2091
+ }; }
2092
+ static get style() { return curaSelectCss; }
2093
+ }, [65, "cura-select", {
2094
+ "label": [513],
2095
+ "placeholder": [513],
2096
+ "value": [1537],
2097
+ "mode": [513],
2098
+ "size": [513],
2099
+ "iconName": [1, "icon-name"],
2100
+ "status": [1537],
2101
+ "disabled": [516],
2102
+ "required": [516],
2103
+ "searchBehavior": [516, "search-behavior"],
2104
+ "caseSensitive": [516, "case-sensitive"],
2105
+ "maxHeight": [513, "max-height"],
2106
+ "isHovered": [32],
2107
+ "isFocused": [32],
2108
+ "isOpen": [32],
2109
+ "isPositioned": [32],
2110
+ "menuStyle": [32],
2111
+ "options": [32],
2112
+ "activeIndex": [32],
2113
+ "preferredPlacement": [32],
2114
+ "textInput": [32]
2115
+ }, undefined, {
2116
+ "activeIndex": ["updateOptionHighlights"],
2117
+ "textInput": ["filterOptions"],
2118
+ "value": ["handleValueChange"]
2119
+ }]);
2120
+ function defineCustomElement() {
2121
+ if (typeof customElements === "undefined") {
2122
+ return;
2123
+ }
2124
+ const components = ["cura-select", "cura-icon", "cura-label"];
2125
+ components.forEach(tagName => { switch (tagName) {
2126
+ case "cura-select":
2127
+ if (!customElements.get(tagName)) {
2128
+ customElements.define(tagName, CuraSelect);
2129
+ }
2130
+ break;
2131
+ case "cura-icon":
2132
+ if (!customElements.get(tagName)) {
2133
+ defineCustomElement$2();
2134
+ }
2135
+ break;
2136
+ case "cura-label":
2137
+ if (!customElements.get(tagName)) {
2138
+ defineCustomElement$1();
2139
+ }
2140
+ break;
2141
+ } });
2142
+ }
2143
+
2144
+ export { CuraSelect as C, defineCustomElement as d };
2145
+ //# sourceMappingURL=p-CvdWbsfO.js.map
2146
+
2147
+ //# sourceMappingURL=p-CvdWbsfO.js.map