@carbon/ibm-products 2.88.0 → 2.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/css/carbon.css +17 -4
  2. package/css/carbon.css.map +1 -1
  3. package/css/index-full-carbon.css +106 -33
  4. package/css/index-full-carbon.css.map +1 -1
  5. package/css/index-full-carbon.min.css +1 -1
  6. package/css/index-full-carbon.min.css.map +1 -1
  7. package/css/index-without-carbon-released-only.css +54 -29
  8. package/css/index-without-carbon-released-only.css.map +1 -1
  9. package/css/index-without-carbon-released-only.min.css +1 -1
  10. package/css/index-without-carbon-released-only.min.css.map +1 -1
  11. package/css/index-without-carbon.css +89 -29
  12. package/css/index-without-carbon.css.map +1 -1
  13. package/css/index-without-carbon.min.css +1 -1
  14. package/css/index-without-carbon.min.css.map +1 -1
  15. package/css/index.css +104 -32
  16. package/css/index.css.map +1 -1
  17. package/css/index.min.css +1 -1
  18. package/css/index.min.css.map +1 -1
  19. package/es/components/AboutModal/AboutModal.d.ts.map +1 -1
  20. package/es/components/AboutModal/AboutModal.js +2 -2
  21. package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts +17 -0
  22. package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts.map +1 -1
  23. package/es/components/Coachmark/next/Coachmark/Coachmark.js +35 -5
  24. package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +1 -9
  25. package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts.map +1 -1
  26. package/es/components/Coachmark/next/Coachmark/CoachmarkContent.js +48 -47
  27. package/es/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.js +4 -1
  28. package/es/components/Coachmark/next/Coachmark/ContentHeader.d.ts.map +1 -1
  29. package/es/components/Coachmark/next/Coachmark/ContentHeader.js +26 -11
  30. package/es/components/Coachmark/next/Coachmark/context.d.ts +1 -0
  31. package/es/components/Coachmark/next/Coachmark/context.d.ts.map +1 -1
  32. package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
  33. package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts.map +1 -1
  34. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts.map +1 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +4 -15
  36. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -1
  37. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts.map +1 -1
  38. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -15
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts.map +1 -1
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +6 -3
  41. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts.map +1 -1
  42. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -3
  43. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts.map +1 -1
  44. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -14
  45. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -1
  46. package/es/components/DelimitedList/DelimitedList.d.ts +1 -0
  47. package/es/components/DelimitedList/DelimitedList.d.ts.map +1 -1
  48. package/es/components/DelimitedList/DelimitedList.js +6 -0
  49. package/es/components/StringFormatter/StringFormatter.d.ts +1 -0
  50. package/es/components/StringFormatter/StringFormatter.d.ts.map +1 -1
  51. package/es/components/StringFormatter/StringFormatter.js +6 -0
  52. package/es/components/Tearsheet/next/Tearsheet.d.ts.map +1 -1
  53. package/es/components/Tearsheet/next/Tearsheet.js +6 -9
  54. package/es/components/Tearsheet/next/TearsheetBody.d.ts.map +1 -1
  55. package/es/components/Tearsheet/next/TearsheetBody.js +5 -2
  56. package/es/components/Tearsheet/next/TearsheetHeader.d.ts +1 -1
  57. package/es/components/Tearsheet/next/TearsheetHeader.d.ts.map +1 -1
  58. package/es/components/Tearsheet/next/TearsheetHeader.js +11 -10
  59. package/es/components/Tearsheet/next/TearsheetHeaderContent.d.ts.map +1 -1
  60. package/es/components/Tearsheet/next/TearsheetHeaderContent.js +26 -7
  61. package/es/components/Tearsheet/next/context.d.ts +4 -2
  62. package/es/components/Tearsheet/next/context.d.ts.map +1 -1
  63. package/es/components/Tearsheet/next/context.js +4 -2
  64. package/es/global/js/hooks/useCollapsible.d.ts.map +1 -1
  65. package/es/global/js/hooks/useCollapsible.js +7 -5
  66. package/es/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/es/index.js +1 -1
  67. package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
  68. package/es/settings.js +8 -2
  69. package/lib/components/AboutModal/AboutModal.d.ts.map +1 -1
  70. package/lib/components/AboutModal/AboutModal.js +1 -1
  71. package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts +17 -0
  72. package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts.map +1 -1
  73. package/lib/components/Coachmark/next/Coachmark/Coachmark.js +35 -5
  74. package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +1 -9
  75. package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts.map +1 -1
  76. package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.js +47 -46
  77. package/lib/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.js +4 -1
  78. package/lib/components/Coachmark/next/Coachmark/ContentHeader.d.ts.map +1 -1
  79. package/lib/components/Coachmark/next/Coachmark/ContentHeader.js +26 -11
  80. package/lib/components/Coachmark/next/Coachmark/context.d.ts +1 -0
  81. package/lib/components/Coachmark/next/Coachmark/context.d.ts.map +1 -1
  82. package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
  83. package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts.map +1 -1
  84. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts.map +1 -1
  85. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +3 -14
  86. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -1
  87. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts.map +1 -1
  88. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -15
  89. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts.map +1 -1
  90. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +6 -3
  91. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts.map +1 -1
  92. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -3
  93. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts.map +1 -1
  94. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +3 -13
  95. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -1
  96. package/lib/components/DelimitedList/DelimitedList.d.ts +1 -0
  97. package/lib/components/DelimitedList/DelimitedList.d.ts.map +1 -1
  98. package/lib/components/DelimitedList/DelimitedList.js +6 -0
  99. package/lib/components/StringFormatter/StringFormatter.d.ts +1 -0
  100. package/lib/components/StringFormatter/StringFormatter.d.ts.map +1 -1
  101. package/lib/components/StringFormatter/StringFormatter.js +6 -0
  102. package/lib/components/Tearsheet/next/Tearsheet.d.ts.map +1 -1
  103. package/lib/components/Tearsheet/next/Tearsheet.js +6 -9
  104. package/lib/components/Tearsheet/next/TearsheetBody.d.ts.map +1 -1
  105. package/lib/components/Tearsheet/next/TearsheetBody.js +4 -1
  106. package/lib/components/Tearsheet/next/TearsheetHeader.d.ts +1 -1
  107. package/lib/components/Tearsheet/next/TearsheetHeader.d.ts.map +1 -1
  108. package/lib/components/Tearsheet/next/TearsheetHeader.js +11 -10
  109. package/lib/components/Tearsheet/next/TearsheetHeaderContent.d.ts.map +1 -1
  110. package/lib/components/Tearsheet/next/TearsheetHeaderContent.js +24 -5
  111. package/lib/components/Tearsheet/next/context.d.ts +4 -2
  112. package/lib/components/Tearsheet/next/context.d.ts.map +1 -1
  113. package/lib/components/Tearsheet/next/context.js +4 -2
  114. package/lib/global/js/hooks/useCollapsible.d.ts.map +1 -1
  115. package/lib/global/js/hooks/useCollapsible.js +7 -5
  116. package/lib/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/lib/index.js +2 -2
  117. package/lib/node_modules/@carbon/icons-react/lib/Icon.js +1 -1
  118. package/lib/settings.js +8 -1
  119. package/package.json +15 -15
  120. package/scss/components/Coachmark/_coachmark.scss +25 -1
  121. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +16 -0
  122. package/scss/components/PageHeader/_page-header.scss +30 -22
  123. package/scss/components/Tearsheet/_tearsheet_next.scss +40 -7
  124. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +0 -110
  125. package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.js +0 -32
  126. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -416
  127. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -509
  128. package/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -86
  129. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -145
  130. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -130
  131. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +0 -111
  132. package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.js +0 -33
  133. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -420
  134. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -515
  135. package/lib/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -92
  136. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -162
  137. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -149
@@ -1,420 +0,0 @@
1
- /**
2
- * Copyright IBM Corp. 2020, 2026
3
- *
4
- * This source code is licensed under the Apache-2.0 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- const require_floating_ui_utils = require('../../utils/dist/floating-ui.utils.js');
9
-
10
- //#region ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
11
- function computeCoordsFromPlacement(_ref, placement, rtl) {
12
- let { reference, floating } = _ref;
13
- const sideAxis = require_floating_ui_utils.getSideAxis(placement);
14
- const alignmentAxis = require_floating_ui_utils.getAlignmentAxis(placement);
15
- const alignLength = require_floating_ui_utils.getAxisLength(alignmentAxis);
16
- const side = require_floating_ui_utils.getSide(placement);
17
- const isVertical = sideAxis === "y";
18
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
19
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
20
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
21
- let coords;
22
- switch (side) {
23
- case "top":
24
- coords = {
25
- x: commonX,
26
- y: reference.y - floating.height
27
- };
28
- break;
29
- case "bottom":
30
- coords = {
31
- x: commonX,
32
- y: reference.y + reference.height
33
- };
34
- break;
35
- case "right":
36
- coords = {
37
- x: reference.x + reference.width,
38
- y: commonY
39
- };
40
- break;
41
- case "left":
42
- coords = {
43
- x: reference.x - floating.width,
44
- y: commonY
45
- };
46
- break;
47
- default: coords = {
48
- x: reference.x,
49
- y: reference.y
50
- };
51
- }
52
- switch (require_floating_ui_utils.getAlignment(placement)) {
53
- case "start":
54
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
55
- break;
56
- case "end":
57
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
58
- break;
59
- }
60
- return coords;
61
- }
62
- /**
63
- * Computes the `x` and `y` coordinates that will place the floating element
64
- * next to a given reference element.
65
- *
66
- * This export does not have any `platform` interface logic. You will need to
67
- * write one for the platform you are using Floating UI with.
68
- */
69
- const computePosition = async (reference, floating, config) => {
70
- const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
71
- const validMiddleware = middleware.filter(Boolean);
72
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
73
- let rects = await platform.getElementRects({
74
- reference,
75
- floating,
76
- strategy
77
- });
78
- let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
79
- let statefulPlacement = placement;
80
- let middlewareData = {};
81
- let resetCount = 0;
82
- for (let i = 0; i < validMiddleware.length; i++) {
83
- const { name, fn } = validMiddleware[i];
84
- const { x: nextX, y: nextY, data, reset } = await fn({
85
- x,
86
- y,
87
- initialPlacement: placement,
88
- placement: statefulPlacement,
89
- strategy,
90
- middlewareData,
91
- rects,
92
- platform,
93
- elements: {
94
- reference,
95
- floating
96
- }
97
- });
98
- x = nextX != null ? nextX : x;
99
- y = nextY != null ? nextY : y;
100
- middlewareData = {
101
- ...middlewareData,
102
- [name]: {
103
- ...middlewareData[name],
104
- ...data
105
- }
106
- };
107
- if (reset && resetCount <= 50) {
108
- resetCount++;
109
- if (typeof reset === "object") {
110
- if (reset.placement) statefulPlacement = reset.placement;
111
- if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
112
- reference,
113
- floating,
114
- strategy
115
- }) : reset.rects;
116
- ({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
117
- }
118
- i = -1;
119
- }
120
- }
121
- return {
122
- x,
123
- y,
124
- placement: statefulPlacement,
125
- strategy,
126
- middlewareData
127
- };
128
- };
129
- /**
130
- * Resolves with an object of overflow side offsets that determine how much the
131
- * element is overflowing a given clipping boundary on each side.
132
- * - positive = overflowing the boundary by that number of pixels
133
- * - negative = how many pixels left before it will overflow
134
- * - 0 = lies flush with the boundary
135
- * @see https://floating-ui.com/docs/detectOverflow
136
- */
137
- async function detectOverflow(state, options) {
138
- var _await$platform$isEle;
139
- if (options === void 0) options = {};
140
- const { x, y, platform, rects, elements, strategy } = state;
141
- const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = require_floating_ui_utils.evaluate(options, state);
142
- const paddingObject = require_floating_ui_utils.getPaddingObject(padding);
143
- const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
144
- const clippingClientRect = require_floating_ui_utils.rectToClientRect(await platform.getClippingRect({
145
- 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)),
146
- boundary,
147
- rootBoundary,
148
- strategy
149
- }));
150
- const rect = elementContext === "floating" ? {
151
- x,
152
- y,
153
- width: rects.floating.width,
154
- height: rects.floating.height
155
- } : rects.reference;
156
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
157
- const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
158
- x: 1,
159
- y: 1
160
- } : {
161
- x: 1,
162
- y: 1
163
- };
164
- const elementClientRect = require_floating_ui_utils.rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
165
- elements,
166
- rect,
167
- offsetParent,
168
- strategy
169
- }) : rect);
170
- return {
171
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
172
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
173
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
174
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
175
- };
176
- }
177
- /**
178
- * Provides data to position an inner element of the floating element so that it
179
- * appears centered to the reference element.
180
- * @see https://floating-ui.com/docs/arrow
181
- */
182
- const arrow = (options) => ({
183
- name: "arrow",
184
- options,
185
- async fn(state) {
186
- const { x, y, placement, rects, platform, elements, middlewareData } = state;
187
- const { element, padding = 0 } = require_floating_ui_utils.evaluate(options, state) || {};
188
- if (element == null) return {};
189
- const paddingObject = require_floating_ui_utils.getPaddingObject(padding);
190
- const coords = {
191
- x,
192
- y
193
- };
194
- const axis = require_floating_ui_utils.getAlignmentAxis(placement);
195
- const length = require_floating_ui_utils.getAxisLength(axis);
196
- const arrowDimensions = await platform.getDimensions(element);
197
- const isYAxis = axis === "y";
198
- const minProp = isYAxis ? "top" : "left";
199
- const maxProp = isYAxis ? "bottom" : "right";
200
- const clientProp = isYAxis ? "clientHeight" : "clientWidth";
201
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
202
- const startDiff = coords[axis] - rects.reference[axis];
203
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
204
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
205
- if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length];
206
- const centerToReference = endDiff / 2 - startDiff / 2;
207
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
208
- const minPadding = require_floating_ui_utils.min(paddingObject[minProp], largestPossiblePadding);
209
- const maxPadding = require_floating_ui_utils.min(paddingObject[maxProp], largestPossiblePadding);
210
- const min$1 = minPadding;
211
- const max = clientSize - arrowDimensions[length] - maxPadding;
212
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
213
- const offset = require_floating_ui_utils.clamp(min$1, center, max);
214
- const shouldAddOffset = !middlewareData.arrow && require_floating_ui_utils.getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
215
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
216
- return {
217
- [axis]: coords[axis] + alignmentOffset,
218
- data: {
219
- [axis]: offset,
220
- centerOffset: center - offset - alignmentOffset,
221
- ...shouldAddOffset && { alignmentOffset }
222
- },
223
- reset: shouldAddOffset
224
- };
225
- }
226
- });
227
- /**
228
- * Optimizes the visibility of the floating element by flipping the `placement`
229
- * in order to keep it in view when the preferred placement(s) will overflow the
230
- * clipping boundary. Alternative to `autoPlacement`.
231
- * @see https://floating-ui.com/docs/flip
232
- */
233
- const flip = function(options) {
234
- if (options === void 0) options = {};
235
- return {
236
- name: "flip",
237
- options,
238
- async fn(state) {
239
- var _middlewareData$arrow, _middlewareData$flip;
240
- const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
241
- const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = require_floating_ui_utils.evaluate(options, state);
242
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
243
- const side = require_floating_ui_utils.getSide(placement);
244
- const initialSideAxis = require_floating_ui_utils.getSideAxis(initialPlacement);
245
- const isBasePlacement = require_floating_ui_utils.getSide(initialPlacement) === initialPlacement;
246
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
247
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [require_floating_ui_utils.getOppositePlacement(initialPlacement)] : require_floating_ui_utils.getExpandedPlacements(initialPlacement));
248
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
249
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...require_floating_ui_utils.getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
250
- const placements = [initialPlacement, ...fallbackPlacements];
251
- const overflow = await detectOverflow(state, detectOverflowOptions);
252
- const overflows = [];
253
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
254
- if (checkMainAxis) overflows.push(overflow[side]);
255
- if (checkCrossAxis) {
256
- const sides = require_floating_ui_utils.getAlignmentSides(placement, rects, rtl);
257
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
258
- }
259
- overflowsData = [...overflowsData, {
260
- placement,
261
- overflows
262
- }];
263
- if (!overflows.every((side) => side <= 0)) {
264
- var _middlewareData$flip2, _overflowsData$filter;
265
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
266
- const nextPlacement = placements[nextIndex];
267
- if (nextPlacement) return {
268
- data: {
269
- index: nextIndex,
270
- overflows: overflowsData
271
- },
272
- reset: { placement: nextPlacement }
273
- };
274
- 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;
275
- if (!resetPlacement) switch (fallbackStrategy) {
276
- case "bestFit": {
277
- var _overflowsData$filter2;
278
- const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
279
- if (hasFallbackAxisSideDirection) {
280
- const currentSideAxis = require_floating_ui_utils.getSideAxis(d.placement);
281
- return currentSideAxis === initialSideAxis || currentSideAxis === "y";
282
- }
283
- return true;
284
- }).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];
285
- if (placement) resetPlacement = placement;
286
- break;
287
- }
288
- case "initialPlacement":
289
- resetPlacement = initialPlacement;
290
- break;
291
- }
292
- if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
293
- }
294
- return {};
295
- }
296
- };
297
- };
298
- async function convertValueToCoords(state, options) {
299
- const { placement, platform, elements } = state;
300
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
301
- const side = require_floating_ui_utils.getSide(placement);
302
- const alignment = require_floating_ui_utils.getAlignment(placement);
303
- const isVertical = require_floating_ui_utils.getSideAxis(placement) === "y";
304
- const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
305
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
306
- const rawValue = require_floating_ui_utils.evaluate(options, state);
307
- let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
308
- mainAxis: rawValue,
309
- crossAxis: 0,
310
- alignmentAxis: null
311
- } : {
312
- mainAxis: rawValue.mainAxis || 0,
313
- crossAxis: rawValue.crossAxis || 0,
314
- alignmentAxis: rawValue.alignmentAxis
315
- };
316
- if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
317
- return isVertical ? {
318
- x: crossAxis * crossAxisMulti,
319
- y: mainAxis * mainAxisMulti
320
- } : {
321
- x: mainAxis * mainAxisMulti,
322
- y: crossAxis * crossAxisMulti
323
- };
324
- }
325
- /**
326
- * Modifies the placement by translating the floating element along the
327
- * specified axes.
328
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
329
- * object may be passed.
330
- * @see https://floating-ui.com/docs/offset
331
- */
332
- const offset = function(options) {
333
- if (options === void 0) options = 0;
334
- return {
335
- name: "offset",
336
- options,
337
- async fn(state) {
338
- var _middlewareData$offse, _middlewareData$arrow;
339
- const { x, y, placement, middlewareData } = state;
340
- const diffCoords = await convertValueToCoords(state, options);
341
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
342
- return {
343
- x: x + diffCoords.x,
344
- y: y + diffCoords.y,
345
- data: {
346
- ...diffCoords,
347
- placement
348
- }
349
- };
350
- }
351
- };
352
- };
353
- /**
354
- * Optimizes the visibility of the floating element by shifting it in order to
355
- * keep it in view when it will overflow the clipping boundary.
356
- * @see https://floating-ui.com/docs/shift
357
- */
358
- const shift = function(options) {
359
- if (options === void 0) options = {};
360
- return {
361
- name: "shift",
362
- options,
363
- async fn(state) {
364
- const { x, y, placement } = state;
365
- const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
366
- let { x, y } = _ref;
367
- return {
368
- x,
369
- y
370
- };
371
- } }, ...detectOverflowOptions } = require_floating_ui_utils.evaluate(options, state);
372
- const coords = {
373
- x,
374
- y
375
- };
376
- const overflow = await detectOverflow(state, detectOverflowOptions);
377
- const crossAxis = require_floating_ui_utils.getSideAxis(require_floating_ui_utils.getSide(placement));
378
- const mainAxis = require_floating_ui_utils.getOppositeAxis(crossAxis);
379
- let mainAxisCoord = coords[mainAxis];
380
- let crossAxisCoord = coords[crossAxis];
381
- if (checkMainAxis) {
382
- const minSide = mainAxis === "y" ? "top" : "left";
383
- const maxSide = mainAxis === "y" ? "bottom" : "right";
384
- const min = mainAxisCoord + overflow[minSide];
385
- const max = mainAxisCoord - overflow[maxSide];
386
- mainAxisCoord = require_floating_ui_utils.clamp(min, mainAxisCoord, max);
387
- }
388
- if (checkCrossAxis) {
389
- const minSide = crossAxis === "y" ? "top" : "left";
390
- const maxSide = crossAxis === "y" ? "bottom" : "right";
391
- const min = crossAxisCoord + overflow[minSide];
392
- const max = crossAxisCoord - overflow[maxSide];
393
- crossAxisCoord = require_floating_ui_utils.clamp(min, crossAxisCoord, max);
394
- }
395
- const limitedCoords = limiter.fn({
396
- ...state,
397
- [mainAxis]: mainAxisCoord,
398
- [crossAxis]: crossAxisCoord
399
- });
400
- return {
401
- ...limitedCoords,
402
- data: {
403
- x: limitedCoords.x - x,
404
- y: limitedCoords.y - y,
405
- enabled: {
406
- [mainAxis]: checkMainAxis,
407
- [crossAxis]: checkCrossAxis
408
- }
409
- }
410
- };
411
- }
412
- };
413
- };
414
-
415
- //#endregion
416
- exports.arrow = arrow;
417
- exports.computePosition = computePosition;
418
- exports.flip = flip;
419
- exports.offset = offset;
420
- exports.shift = shift;