@jobber/components 9.10.0 → 9.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/Autocomplete/index.cjs +0 -2
  2. package/dist/Autocomplete/index.mjs +0 -2
  3. package/dist/Autocomplete-cjs.js +4 -5
  4. package/dist/Autocomplete-es.js +1 -2
  5. package/dist/Card/index.cjs +1 -2
  6. package/dist/Card/index.mjs +1 -2
  7. package/dist/Chip/index.cjs +0 -2
  8. package/dist/Chip/index.mjs +0 -2
  9. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -2
  10. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -2
  11. package/dist/Chips/InternalChipDismissible/index.cjs +0 -2
  12. package/dist/Chips/InternalChipDismissible/index.mjs +0 -2
  13. package/dist/Chips/index.cjs +0 -2
  14. package/dist/Chips/index.mjs +0 -2
  15. package/dist/Combobox/index.cjs +2 -4
  16. package/dist/Combobox/index.mjs +2 -4
  17. package/dist/ComboboxPrimitive-cjs.js +29 -30
  18. package/dist/ComboboxPrimitive-es.js +2 -3
  19. package/dist/{ComboboxChipRemove-cjs.js → ComboboxSeparator-cjs.js} +501 -455
  20. package/dist/{ComboboxChipRemove-es.js → ComboboxSeparator-es.js} +500 -456
  21. package/dist/ConfirmationModal/index.cjs +0 -2
  22. package/dist/ConfirmationModal/index.mjs +0 -2
  23. package/dist/DataDump/index.cjs +1 -2
  24. package/dist/DataDump/index.mjs +1 -2
  25. package/dist/DataList/components/DataListActions/index.cjs +0 -2
  26. package/dist/DataList/components/DataListActions/index.mjs +0 -2
  27. package/dist/DataList/components/DataListBulkActions/index.cjs +0 -2
  28. package/dist/DataList/components/DataListBulkActions/index.mjs +0 -2
  29. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -2
  30. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -2
  31. package/dist/DataList/components/DataListFilters/index.cjs +0 -2
  32. package/dist/DataList/components/DataListFilters/index.mjs +0 -2
  33. package/dist/DataList/components/DataListHeader/index.cjs +0 -2
  34. package/dist/DataList/components/DataListHeader/index.mjs +0 -2
  35. package/dist/DataList/components/DataListItem/index.cjs +0 -2
  36. package/dist/DataList/components/DataListItem/index.mjs +0 -2
  37. package/dist/DataList/components/DataListItemActions/index.cjs +0 -2
  38. package/dist/DataList/components/DataListItemActions/index.mjs +0 -2
  39. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -2
  40. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -2
  41. package/dist/DataList/components/DataListItems/index.cjs +0 -2
  42. package/dist/DataList/components/DataListItems/index.mjs +0 -2
  43. package/dist/DataList/components/DataListLayout/index.cjs +0 -2
  44. package/dist/DataList/components/DataListLayout/index.mjs +0 -2
  45. package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -2
  46. package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -2
  47. package/dist/DataList/index.cjs +0 -2
  48. package/dist/DataList/index.mjs +0 -2
  49. package/dist/DatePicker/index.cjs +0 -2
  50. package/dist/DatePicker/index.mjs +0 -2
  51. package/dist/DatePicker-cjs.js +4 -5
  52. package/dist/DatePicker-es.js +1 -2
  53. package/dist/Dialog/index.cjs +1 -2
  54. package/dist/Dialog/index.mjs +1 -2
  55. package/dist/DrawerDescription-cjs.js +268 -99
  56. package/dist/DrawerDescription-es.js +270 -103
  57. package/dist/DrawerTitle-cjs.js +2 -6
  58. package/dist/DrawerTitle-es.js +3 -7
  59. package/dist/FieldDescription-cjs.js +184 -181
  60. package/dist/FieldDescription-es.js +187 -184
  61. package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +0 -2
  62. package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +0 -2
  63. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +0 -2
  64. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +0 -2
  65. package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +0 -2
  66. package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +0 -2
  67. package/dist/FilterPicker/index.cjs +0 -2
  68. package/dist/FilterPicker/index.mjs +0 -2
  69. package/dist/FilterPickerContent-cjs.js +4 -5
  70. package/dist/FilterPickerContent-es.js +1 -2
  71. package/dist/FormatFile/index.cjs +0 -2
  72. package/dist/FormatFile/index.mjs +0 -2
  73. package/dist/Gallery/index.cjs +1 -2
  74. package/dist/Gallery/index.mjs +1 -2
  75. package/dist/InputDate/index.cjs +0 -2
  76. package/dist/InputDate/index.mjs +0 -2
  77. package/dist/InputNumber/index.cjs +1 -2
  78. package/dist/InputNumber/index.mjs +1 -2
  79. package/dist/LightBox/index.cjs +1 -2
  80. package/dist/LightBox/index.mjs +1 -2
  81. package/dist/Menu/index.cjs +1 -2
  82. package/dist/Menu/index.mjs +1 -2
  83. package/dist/Menu-cjs.js +4 -5
  84. package/dist/Menu-es.js +1 -2
  85. package/dist/MenuSubmenuTrigger-cjs.js +206 -164
  86. package/dist/MenuSubmenuTrigger-es.js +194 -152
  87. package/dist/Modal/index.cjs +0 -2
  88. package/dist/Modal/index.mjs +1 -3
  89. package/dist/NumberFieldInput-cjs.js +187 -308
  90. package/dist/NumberFieldInput-es.js +187 -308
  91. package/dist/Page/index.cjs +1 -2
  92. package/dist/Page/index.mjs +1 -2
  93. package/dist/Popover/index.cjs +0 -2
  94. package/dist/Popover/index.mjs +0 -2
  95. package/dist/Popover-cjs.js +7 -8
  96. package/dist/Popover-es.js +1 -2
  97. package/dist/ScrollAreaViewport-cjs.js +747 -1093
  98. package/dist/ScrollAreaViewport-es.js +734 -1081
  99. package/dist/Select/index.cjs +1 -2
  100. package/dist/Select/index.mjs +1 -2
  101. package/dist/SelectGroupLabel-cjs.js +207 -306
  102. package/dist/SelectGroupLabel-es.js +203 -302
  103. package/dist/Tooltip/index.cjs +0 -2
  104. package/dist/Tooltip/index.mjs +0 -2
  105. package/dist/Tooltip-cjs.js +6 -7
  106. package/dist/Tooltip-es.js +1 -2
  107. package/dist/dialogReturnFocus-cjs.js +1 -1
  108. package/dist/dialogReturnFocus-es.js +2 -2
  109. package/dist/floating-ui.react-cjs.js +2557 -185
  110. package/dist/floating-ui.react-es.js +2512 -149
  111. package/dist/index.cjs +3 -4
  112. package/dist/index.mjs +3 -4
  113. package/dist/primitives/BottomSheet/index.cjs +1 -1
  114. package/dist/primitives/BottomSheet/index.mjs +1 -1
  115. package/dist/primitives/ComboboxPrimitive/index.cjs +2 -4
  116. package/dist/primitives/ComboboxPrimitive/index.mjs +2 -4
  117. package/dist/primitives/SelectPrimitive/index.cjs +0 -2
  118. package/dist/primitives/SelectPrimitive/index.mjs +0 -2
  119. package/dist/primitives/index.cjs +2 -3
  120. package/dist/primitives/index.mjs +2 -3
  121. package/dist/scrollEdges-cjs.js +1 -11
  122. package/dist/scrollEdges-es.js +1 -11
  123. package/dist/scrollable-cjs.js +58 -0
  124. package/dist/scrollable-es.js +54 -0
  125. package/dist/unstyledPrimitives/index.cjs +720 -478
  126. package/dist/unstyledPrimitives/index.mjs +663 -421
  127. package/dist/useCompositeListItem-cjs.js +2108 -361
  128. package/dist/useCompositeListItem-es.js +2076 -331
  129. package/dist/useLabel-cjs.js +2 -3
  130. package/dist/useLabel-es.js +2 -3
  131. package/dist/useRenderElement-cjs.js +9 -7
  132. package/dist/useRenderElement-es.js +9 -7
  133. package/dist/useScrollLock-cjs.js +819 -344
  134. package/dist/useScrollLock-es.js +732 -296
  135. package/dist/useScrollToActive-cjs.js +4 -5
  136. package/dist/useScrollToActive-es.js +1 -2
  137. package/package.json +3 -3
  138. package/dist/floating-ui.react-dom-cjs.js +0 -2103
  139. package/dist/floating-ui.react-dom-es.js +0 -2072
  140. package/dist/floating-ui.utils-cjs.js +0 -342
  141. package/dist/floating-ui.utils-es.js +0 -300
@@ -1,342 +0,0 @@
1
- 'use strict';
2
-
3
- function hasWindow() {
4
- return typeof window !== 'undefined';
5
- }
6
- function getNodeName(node) {
7
- if (isNode(node)) {
8
- return (node.nodeName || '').toLowerCase();
9
- }
10
- // Mocked nodes in testing environments may not be instances of Node. By
11
- // returning `#document` an infinite loop won't occur.
12
- // https://github.com/floating-ui/floating-ui/issues/2317
13
- return '#document';
14
- }
15
- function getWindow(node) {
16
- var _node$ownerDocument;
17
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
18
- }
19
- function getDocumentElement(node) {
20
- var _ref;
21
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
22
- }
23
- function isNode(value) {
24
- if (!hasWindow()) {
25
- return false;
26
- }
27
- return value instanceof Node || value instanceof getWindow(value).Node;
28
- }
29
- function isElement(value) {
30
- if (!hasWindow()) {
31
- return false;
32
- }
33
- return value instanceof Element || value instanceof getWindow(value).Element;
34
- }
35
- function isHTMLElement(value) {
36
- if (!hasWindow()) {
37
- return false;
38
- }
39
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
40
- }
41
- function isShadowRoot(value) {
42
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
43
- return false;
44
- }
45
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
46
- }
47
- function isOverflowElement(element) {
48
- const {
49
- overflow,
50
- overflowX,
51
- overflowY,
52
- display
53
- } = getComputedStyle(element);
54
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
55
- }
56
- function isTableElement(element) {
57
- return /^(table|td|th)$/.test(getNodeName(element));
58
- }
59
- function isTopLayer(element) {
60
- try {
61
- if (element.matches(':popover-open')) {
62
- return true;
63
- }
64
- } catch (_e) {
65
- // no-op
66
- }
67
- try {
68
- return element.matches(':modal');
69
- } catch (_e) {
70
- return false;
71
- }
72
- }
73
- const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
74
- const containRe = /paint|layout|strict|content/;
75
- const isNotNone = value => !!value && value !== 'none';
76
- let isWebKitValue;
77
- function isContainingBlock(elementOrCss) {
78
- const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
79
-
80
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
81
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
82
- return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
83
- }
84
- function getContainingBlock(element) {
85
- let currentNode = getParentNode(element);
86
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
87
- if (isContainingBlock(currentNode)) {
88
- return currentNode;
89
- } else if (isTopLayer(currentNode)) {
90
- return null;
91
- }
92
- currentNode = getParentNode(currentNode);
93
- }
94
- return null;
95
- }
96
- function isWebKit() {
97
- if (isWebKitValue == null) {
98
- isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
99
- }
100
- return isWebKitValue;
101
- }
102
- function isLastTraversableNode(node) {
103
- return /^(html|body|#document)$/.test(getNodeName(node));
104
- }
105
- function getComputedStyle(element) {
106
- return getWindow(element).getComputedStyle(element);
107
- }
108
- function getNodeScroll(element) {
109
- if (isElement(element)) {
110
- return {
111
- scrollLeft: element.scrollLeft,
112
- scrollTop: element.scrollTop
113
- };
114
- }
115
- return {
116
- scrollLeft: element.scrollX,
117
- scrollTop: element.scrollY
118
- };
119
- }
120
- function getParentNode(node) {
121
- if (getNodeName(node) === 'html') {
122
- return node;
123
- }
124
- const result =
125
- // Step into the shadow DOM of the parent of a slotted node.
126
- node.assignedSlot ||
127
- // DOM Element detected.
128
- node.parentNode ||
129
- // ShadowRoot detected.
130
- isShadowRoot(node) && node.host ||
131
- // Fallback.
132
- getDocumentElement(node);
133
- return isShadowRoot(result) ? result.host : result;
134
- }
135
- function getNearestOverflowAncestor(node) {
136
- const parentNode = getParentNode(node);
137
- if (isLastTraversableNode(parentNode)) {
138
- return node.ownerDocument ? node.ownerDocument.body : node.body;
139
- }
140
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
141
- return parentNode;
142
- }
143
- return getNearestOverflowAncestor(parentNode);
144
- }
145
- function getOverflowAncestors(node, list, traverseIframes) {
146
- var _node$ownerDocument2;
147
- if (list === void 0) {
148
- list = [];
149
- }
150
- if (traverseIframes === void 0) {
151
- traverseIframes = true;
152
- }
153
- const scrollableAncestor = getNearestOverflowAncestor(node);
154
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
155
- const win = getWindow(scrollableAncestor);
156
- if (isBody) {
157
- const frameElement = getFrameElement(win);
158
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
159
- } else {
160
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
161
- }
162
- }
163
- function getFrameElement(win) {
164
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
165
- }
166
-
167
- /**
168
- * Custom positioning reference element.
169
- * @see https://floating-ui.com/docs/virtual-elements
170
- */
171
-
172
- const sides = ['top', 'right', 'bottom', 'left'];
173
- const alignments = ['start', 'end'];
174
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
175
- const min = Math.min;
176
- const max = Math.max;
177
- const round = Math.round;
178
- const floor = Math.floor;
179
- const createCoords = v => ({
180
- x: v,
181
- y: v
182
- });
183
- const oppositeSideMap = {
184
- left: 'right',
185
- right: 'left',
186
- bottom: 'top',
187
- top: 'bottom'
188
- };
189
- function clamp(start, value, end) {
190
- return max(start, min(value, end));
191
- }
192
- function evaluate(value, param) {
193
- return typeof value === 'function' ? value(param) : value;
194
- }
195
- function getSide(placement) {
196
- return placement.split('-')[0];
197
- }
198
- function getAlignment(placement) {
199
- return placement.split('-')[1];
200
- }
201
- function getOppositeAxis(axis) {
202
- return axis === 'x' ? 'y' : 'x';
203
- }
204
- function getAxisLength(axis) {
205
- return axis === 'y' ? 'height' : 'width';
206
- }
207
- function getSideAxis(placement) {
208
- const firstChar = placement[0];
209
- return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
210
- }
211
- function getAlignmentAxis(placement) {
212
- return getOppositeAxis(getSideAxis(placement));
213
- }
214
- function getAlignmentSides(placement, rects, rtl) {
215
- if (rtl === void 0) {
216
- rtl = false;
217
- }
218
- const alignment = getAlignment(placement);
219
- const alignmentAxis = getAlignmentAxis(placement);
220
- const length = getAxisLength(alignmentAxis);
221
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
222
- if (rects.reference[length] > rects.floating[length]) {
223
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
224
- }
225
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
226
- }
227
- function getExpandedPlacements(placement) {
228
- const oppositePlacement = getOppositePlacement(placement);
229
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
230
- }
231
- function getOppositeAlignmentPlacement(placement) {
232
- return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
233
- }
234
- const lrPlacement = ['left', 'right'];
235
- const rlPlacement = ['right', 'left'];
236
- const tbPlacement = ['top', 'bottom'];
237
- const btPlacement = ['bottom', 'top'];
238
- function getSideList(side, isStart, rtl) {
239
- switch (side) {
240
- case 'top':
241
- case 'bottom':
242
- if (rtl) return isStart ? rlPlacement : lrPlacement;
243
- return isStart ? lrPlacement : rlPlacement;
244
- case 'left':
245
- case 'right':
246
- return isStart ? tbPlacement : btPlacement;
247
- default:
248
- return [];
249
- }
250
- }
251
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
252
- const alignment = getAlignment(placement);
253
- let list = getSideList(getSide(placement), direction === 'start', rtl);
254
- if (alignment) {
255
- list = list.map(side => side + "-" + alignment);
256
- if (flipAlignment) {
257
- list = list.concat(list.map(getOppositeAlignmentPlacement));
258
- }
259
- }
260
- return list;
261
- }
262
- function getOppositePlacement(placement) {
263
- const side = getSide(placement);
264
- return oppositeSideMap[side] + placement.slice(side.length);
265
- }
266
- function expandPaddingObject(padding) {
267
- return {
268
- top: 0,
269
- right: 0,
270
- bottom: 0,
271
- left: 0,
272
- ...padding
273
- };
274
- }
275
- function getPaddingObject(padding) {
276
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
277
- top: padding,
278
- right: padding,
279
- bottom: padding,
280
- left: padding
281
- };
282
- }
283
- function rectToClientRect(rect) {
284
- const {
285
- x,
286
- y,
287
- width,
288
- height
289
- } = rect;
290
- return {
291
- width,
292
- height,
293
- top: y,
294
- left: x,
295
- right: x + width,
296
- bottom: y + height,
297
- x,
298
- y
299
- };
300
- }
301
-
302
- exports.clamp = clamp;
303
- exports.createCoords = createCoords;
304
- exports.evaluate = evaluate;
305
- exports.floor = floor;
306
- exports.getAlignment = getAlignment;
307
- exports.getAlignmentAxis = getAlignmentAxis;
308
- exports.getAlignmentSides = getAlignmentSides;
309
- exports.getAxisLength = getAxisLength;
310
- exports.getComputedStyle = getComputedStyle;
311
- exports.getContainingBlock = getContainingBlock;
312
- exports.getDocumentElement = getDocumentElement;
313
- exports.getExpandedPlacements = getExpandedPlacements;
314
- exports.getFrameElement = getFrameElement;
315
- exports.getNodeName = getNodeName;
316
- exports.getNodeScroll = getNodeScroll;
317
- exports.getOppositeAlignmentPlacement = getOppositeAlignmentPlacement;
318
- exports.getOppositeAxis = getOppositeAxis;
319
- exports.getOppositeAxisPlacements = getOppositeAxisPlacements;
320
- exports.getOppositePlacement = getOppositePlacement;
321
- exports.getOverflowAncestors = getOverflowAncestors;
322
- exports.getPaddingObject = getPaddingObject;
323
- exports.getParentNode = getParentNode;
324
- exports.getSide = getSide;
325
- exports.getSideAxis = getSideAxis;
326
- exports.getWindow = getWindow;
327
- exports.isContainingBlock = isContainingBlock;
328
- exports.isElement = isElement;
329
- exports.isHTMLElement = isHTMLElement;
330
- exports.isLastTraversableNode = isLastTraversableNode;
331
- exports.isNode = isNode;
332
- exports.isOverflowElement = isOverflowElement;
333
- exports.isShadowRoot = isShadowRoot;
334
- exports.isTableElement = isTableElement;
335
- exports.isTopLayer = isTopLayer;
336
- exports.isWebKit = isWebKit;
337
- exports.max = max;
338
- exports.min = min;
339
- exports.placements = placements;
340
- exports.rectToClientRect = rectToClientRect;
341
- exports.round = round;
342
- exports.sides = sides;
@@ -1,300 +0,0 @@
1
- function hasWindow() {
2
- return typeof window !== 'undefined';
3
- }
4
- function getNodeName(node) {
5
- if (isNode(node)) {
6
- return (node.nodeName || '').toLowerCase();
7
- }
8
- // Mocked nodes in testing environments may not be instances of Node. By
9
- // returning `#document` an infinite loop won't occur.
10
- // https://github.com/floating-ui/floating-ui/issues/2317
11
- return '#document';
12
- }
13
- function getWindow(node) {
14
- var _node$ownerDocument;
15
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
16
- }
17
- function getDocumentElement(node) {
18
- var _ref;
19
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
20
- }
21
- function isNode(value) {
22
- if (!hasWindow()) {
23
- return false;
24
- }
25
- return value instanceof Node || value instanceof getWindow(value).Node;
26
- }
27
- function isElement(value) {
28
- if (!hasWindow()) {
29
- return false;
30
- }
31
- return value instanceof Element || value instanceof getWindow(value).Element;
32
- }
33
- function isHTMLElement(value) {
34
- if (!hasWindow()) {
35
- return false;
36
- }
37
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
38
- }
39
- function isShadowRoot(value) {
40
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
41
- return false;
42
- }
43
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
44
- }
45
- function isOverflowElement(element) {
46
- const {
47
- overflow,
48
- overflowX,
49
- overflowY,
50
- display
51
- } = getComputedStyle(element);
52
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
53
- }
54
- function isTableElement(element) {
55
- return /^(table|td|th)$/.test(getNodeName(element));
56
- }
57
- function isTopLayer(element) {
58
- try {
59
- if (element.matches(':popover-open')) {
60
- return true;
61
- }
62
- } catch (_e) {
63
- // no-op
64
- }
65
- try {
66
- return element.matches(':modal');
67
- } catch (_e) {
68
- return false;
69
- }
70
- }
71
- const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
72
- const containRe = /paint|layout|strict|content/;
73
- const isNotNone = value => !!value && value !== 'none';
74
- let isWebKitValue;
75
- function isContainingBlock(elementOrCss) {
76
- const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
77
-
78
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
79
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
80
- return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
81
- }
82
- function getContainingBlock(element) {
83
- let currentNode = getParentNode(element);
84
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
85
- if (isContainingBlock(currentNode)) {
86
- return currentNode;
87
- } else if (isTopLayer(currentNode)) {
88
- return null;
89
- }
90
- currentNode = getParentNode(currentNode);
91
- }
92
- return null;
93
- }
94
- function isWebKit() {
95
- if (isWebKitValue == null) {
96
- isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
97
- }
98
- return isWebKitValue;
99
- }
100
- function isLastTraversableNode(node) {
101
- return /^(html|body|#document)$/.test(getNodeName(node));
102
- }
103
- function getComputedStyle(element) {
104
- return getWindow(element).getComputedStyle(element);
105
- }
106
- function getNodeScroll(element) {
107
- if (isElement(element)) {
108
- return {
109
- scrollLeft: element.scrollLeft,
110
- scrollTop: element.scrollTop
111
- };
112
- }
113
- return {
114
- scrollLeft: element.scrollX,
115
- scrollTop: element.scrollY
116
- };
117
- }
118
- function getParentNode(node) {
119
- if (getNodeName(node) === 'html') {
120
- return node;
121
- }
122
- const result =
123
- // Step into the shadow DOM of the parent of a slotted node.
124
- node.assignedSlot ||
125
- // DOM Element detected.
126
- node.parentNode ||
127
- // ShadowRoot detected.
128
- isShadowRoot(node) && node.host ||
129
- // Fallback.
130
- getDocumentElement(node);
131
- return isShadowRoot(result) ? result.host : result;
132
- }
133
- function getNearestOverflowAncestor(node) {
134
- const parentNode = getParentNode(node);
135
- if (isLastTraversableNode(parentNode)) {
136
- return node.ownerDocument ? node.ownerDocument.body : node.body;
137
- }
138
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
139
- return parentNode;
140
- }
141
- return getNearestOverflowAncestor(parentNode);
142
- }
143
- function getOverflowAncestors(node, list, traverseIframes) {
144
- var _node$ownerDocument2;
145
- if (list === void 0) {
146
- list = [];
147
- }
148
- if (traverseIframes === void 0) {
149
- traverseIframes = true;
150
- }
151
- const scrollableAncestor = getNearestOverflowAncestor(node);
152
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
153
- const win = getWindow(scrollableAncestor);
154
- if (isBody) {
155
- const frameElement = getFrameElement(win);
156
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
157
- } else {
158
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
159
- }
160
- }
161
- function getFrameElement(win) {
162
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
163
- }
164
-
165
- /**
166
- * Custom positioning reference element.
167
- * @see https://floating-ui.com/docs/virtual-elements
168
- */
169
-
170
- const sides = ['top', 'right', 'bottom', 'left'];
171
- const alignments = ['start', 'end'];
172
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
173
- const min = Math.min;
174
- const max = Math.max;
175
- const round = Math.round;
176
- const floor = Math.floor;
177
- const createCoords = v => ({
178
- x: v,
179
- y: v
180
- });
181
- const oppositeSideMap = {
182
- left: 'right',
183
- right: 'left',
184
- bottom: 'top',
185
- top: 'bottom'
186
- };
187
- function clamp(start, value, end) {
188
- return max(start, min(value, end));
189
- }
190
- function evaluate(value, param) {
191
- return typeof value === 'function' ? value(param) : value;
192
- }
193
- function getSide(placement) {
194
- return placement.split('-')[0];
195
- }
196
- function getAlignment(placement) {
197
- return placement.split('-')[1];
198
- }
199
- function getOppositeAxis(axis) {
200
- return axis === 'x' ? 'y' : 'x';
201
- }
202
- function getAxisLength(axis) {
203
- return axis === 'y' ? 'height' : 'width';
204
- }
205
- function getSideAxis(placement) {
206
- const firstChar = placement[0];
207
- return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
208
- }
209
- function getAlignmentAxis(placement) {
210
- return getOppositeAxis(getSideAxis(placement));
211
- }
212
- function getAlignmentSides(placement, rects, rtl) {
213
- if (rtl === void 0) {
214
- rtl = false;
215
- }
216
- const alignment = getAlignment(placement);
217
- const alignmentAxis = getAlignmentAxis(placement);
218
- const length = getAxisLength(alignmentAxis);
219
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
220
- if (rects.reference[length] > rects.floating[length]) {
221
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
222
- }
223
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
224
- }
225
- function getExpandedPlacements(placement) {
226
- const oppositePlacement = getOppositePlacement(placement);
227
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
228
- }
229
- function getOppositeAlignmentPlacement(placement) {
230
- return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
231
- }
232
- const lrPlacement = ['left', 'right'];
233
- const rlPlacement = ['right', 'left'];
234
- const tbPlacement = ['top', 'bottom'];
235
- const btPlacement = ['bottom', 'top'];
236
- function getSideList(side, isStart, rtl) {
237
- switch (side) {
238
- case 'top':
239
- case 'bottom':
240
- if (rtl) return isStart ? rlPlacement : lrPlacement;
241
- return isStart ? lrPlacement : rlPlacement;
242
- case 'left':
243
- case 'right':
244
- return isStart ? tbPlacement : btPlacement;
245
- default:
246
- return [];
247
- }
248
- }
249
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
250
- const alignment = getAlignment(placement);
251
- let list = getSideList(getSide(placement), direction === 'start', rtl);
252
- if (alignment) {
253
- list = list.map(side => side + "-" + alignment);
254
- if (flipAlignment) {
255
- list = list.concat(list.map(getOppositeAlignmentPlacement));
256
- }
257
- }
258
- return list;
259
- }
260
- function getOppositePlacement(placement) {
261
- const side = getSide(placement);
262
- return oppositeSideMap[side] + placement.slice(side.length);
263
- }
264
- function expandPaddingObject(padding) {
265
- return {
266
- top: 0,
267
- right: 0,
268
- bottom: 0,
269
- left: 0,
270
- ...padding
271
- };
272
- }
273
- function getPaddingObject(padding) {
274
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
275
- top: padding,
276
- right: padding,
277
- bottom: padding,
278
- left: padding
279
- };
280
- }
281
- function rectToClientRect(rect) {
282
- const {
283
- x,
284
- y,
285
- width,
286
- height
287
- } = rect;
288
- return {
289
- width,
290
- height,
291
- top: y,
292
- left: x,
293
- right: x + width,
294
- bottom: y + height,
295
- x,
296
- y
297
- };
298
- }
299
-
300
- export { sides as A, getOppositeAxis as B, placements as C, getOppositeAlignmentPlacement as D, getDocumentElement as E, createCoords as F, round as G, isTopLayer as H, isOverflowElement as I, getNodeScroll as J, getWindow as K, isTableElement as L, isContainingBlock as M, getContainingBlock as N, getFrameElement as O, isShadowRoot as a, isElement as b, isNode as c, isLastTraversableNode as d, getParentNode as e, floor as f, getNodeName as g, getComputedStyle as h, isHTMLElement as i, getOverflowAncestors as j, isWebKit as k, getSideAxis as l, getAlignmentAxis as m, getSide as n, getAlignment as o, evaluate as p, getPaddingObject as q, rectToClientRect as r, getOppositePlacement as s, getExpandedPlacements as t, getOppositeAxisPlacements as u, getAlignmentSides as v, clamp as w, min as x, max as y, getAxisLength as z };