@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.
- package/css/carbon.css +17 -4
- package/css/carbon.css.map +1 -1
- package/css/index-full-carbon.css +106 -33
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +54 -29
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +89 -29
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +104 -32
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/AboutModal/AboutModal.d.ts.map +1 -1
- package/es/components/AboutModal/AboutModal.js +2 -2
- package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts +17 -0
- package/es/components/Coachmark/next/Coachmark/Coachmark.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/Coachmark.js +35 -5
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +1 -9
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/CoachmarkContent.js +48 -47
- package/es/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.js +4 -1
- package/es/components/Coachmark/next/Coachmark/ContentHeader.d.ts.map +1 -1
- package/es/components/Coachmark/next/Coachmark/ContentHeader.js +26 -11
- package/es/components/Coachmark/next/Coachmark/context.d.ts +1 -0
- package/es/components/Coachmark/next/Coachmark/context.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +4 -15
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -15
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +6 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -3
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts.map +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -14
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -1
- package/es/components/DelimitedList/DelimitedList.d.ts +1 -0
- package/es/components/DelimitedList/DelimitedList.d.ts.map +1 -1
- package/es/components/DelimitedList/DelimitedList.js +6 -0
- package/es/components/StringFormatter/StringFormatter.d.ts +1 -0
- package/es/components/StringFormatter/StringFormatter.d.ts.map +1 -1
- package/es/components/StringFormatter/StringFormatter.js +6 -0
- package/es/components/Tearsheet/next/Tearsheet.d.ts.map +1 -1
- package/es/components/Tearsheet/next/Tearsheet.js +6 -9
- package/es/components/Tearsheet/next/TearsheetBody.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetBody.js +5 -2
- package/es/components/Tearsheet/next/TearsheetHeader.d.ts +1 -1
- package/es/components/Tearsheet/next/TearsheetHeader.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetHeader.js +11 -10
- package/es/components/Tearsheet/next/TearsheetHeaderContent.d.ts.map +1 -1
- package/es/components/Tearsheet/next/TearsheetHeaderContent.js +26 -7
- package/es/components/Tearsheet/next/context.d.ts +4 -2
- package/es/components/Tearsheet/next/context.d.ts.map +1 -1
- package/es/components/Tearsheet/next/context.js +4 -2
- package/es/global/js/hooks/useCollapsible.d.ts.map +1 -1
- package/es/global/js/hooks/useCollapsible.js +7 -5
- package/es/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/es/index.js +1 -1
- package/es/node_modules/@carbon/icons-react/es/Icon.js +1 -1
- package/es/settings.js +8 -2
- package/lib/components/AboutModal/AboutModal.d.ts.map +1 -1
- package/lib/components/AboutModal/AboutModal.js +1 -1
- package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts +17 -0
- package/lib/components/Coachmark/next/Coachmark/Coachmark.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/Coachmark.js +35 -5
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts +1 -9
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/CoachmarkContent.js +47 -46
- package/lib/components/Coachmark/next/Coachmark/CoachmarkTagline/CoachmarkTagline.js +4 -1
- package/lib/components/Coachmark/next/Coachmark/ContentHeader.d.ts.map +1 -1
- package/lib/components/Coachmark/next/Coachmark/ContentHeader.js +26 -11
- package/lib/components/Coachmark/next/Coachmark/context.d.ts +1 -0
- package/lib/components/Coachmark/next/Coachmark/context.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +3 -14
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +22 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +6 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -3
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +3 -13
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +1 -1
- package/lib/components/DelimitedList/DelimitedList.d.ts +1 -0
- package/lib/components/DelimitedList/DelimitedList.d.ts.map +1 -1
- package/lib/components/DelimitedList/DelimitedList.js +6 -0
- package/lib/components/StringFormatter/StringFormatter.d.ts +1 -0
- package/lib/components/StringFormatter/StringFormatter.d.ts.map +1 -1
- package/lib/components/StringFormatter/StringFormatter.js +6 -0
- package/lib/components/Tearsheet/next/Tearsheet.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/Tearsheet.js +6 -9
- package/lib/components/Tearsheet/next/TearsheetBody.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetBody.js +4 -1
- package/lib/components/Tearsheet/next/TearsheetHeader.d.ts +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeader.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeader.js +11 -10
- package/lib/components/Tearsheet/next/TearsheetHeaderContent.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/TearsheetHeaderContent.js +24 -5
- package/lib/components/Tearsheet/next/context.d.ts +4 -2
- package/lib/components/Tearsheet/next/context.d.ts.map +1 -1
- package/lib/components/Tearsheet/next/context.js +4 -2
- package/lib/global/js/hooks/useCollapsible.d.ts.map +1 -1
- package/lib/global/js/hooks/useCollapsible.js +7 -5
- package/lib/node_modules/@carbon/{icons-react/node_modules/@carbon/icon-helpers → icon-helpers}/lib/index.js +2 -2
- package/lib/node_modules/@carbon/icons-react/lib/Icon.js +1 -1
- package/lib/settings.js +8 -1
- package/package.json +15 -15
- package/scss/components/Coachmark/_coachmark.scss +25 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +16 -0
- package/scss/components/PageHeader/_page-header.scss +30 -22
- package/scss/components/Tearsheet/_tearsheet_next.scss +40 -7
- package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +0 -110
- package/es/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.js +0 -32
- package/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -416
- package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -509
- package/es/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -86
- package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -145
- package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -130
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubble.js +0 -111
- package/lib/components/Coachmark/next/Coachmark/CoachmarkBubble/CoachmarkBubbleHeader.js +0 -33
- package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -420
- package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -515
- package/lib/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -92
- package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -162
- package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -149
|
@@ -1,162 +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
|
-
|
|
9
|
-
//#region ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
10
|
-
function hasWindow() {
|
|
11
|
-
return typeof window !== "undefined";
|
|
12
|
-
}
|
|
13
|
-
function getNodeName(node) {
|
|
14
|
-
if (isNode(node)) return (node.nodeName || "").toLowerCase();
|
|
15
|
-
return "#document";
|
|
16
|
-
}
|
|
17
|
-
function getWindow(node) {
|
|
18
|
-
var _node$ownerDocument;
|
|
19
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
20
|
-
}
|
|
21
|
-
function getDocumentElement(node) {
|
|
22
|
-
var _ref;
|
|
23
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
24
|
-
}
|
|
25
|
-
function isNode(value) {
|
|
26
|
-
if (!hasWindow()) return false;
|
|
27
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
28
|
-
}
|
|
29
|
-
function isElement(value) {
|
|
30
|
-
if (!hasWindow()) return false;
|
|
31
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
32
|
-
}
|
|
33
|
-
function isHTMLElement(value) {
|
|
34
|
-
if (!hasWindow()) return false;
|
|
35
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
36
|
-
}
|
|
37
|
-
function isShadowRoot(value) {
|
|
38
|
-
if (!hasWindow() || typeof ShadowRoot === "undefined") return false;
|
|
39
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
40
|
-
}
|
|
41
|
-
function isOverflowElement(element) {
|
|
42
|
-
const { overflow, overflowX, overflowY, display } = getComputedStyle(element);
|
|
43
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
44
|
-
}
|
|
45
|
-
function isTableElement(element) {
|
|
46
|
-
return [
|
|
47
|
-
"table",
|
|
48
|
-
"td",
|
|
49
|
-
"th"
|
|
50
|
-
].includes(getNodeName(element));
|
|
51
|
-
}
|
|
52
|
-
function isTopLayer(element) {
|
|
53
|
-
return [":popover-open", ":modal"].some((selector) => {
|
|
54
|
-
try {
|
|
55
|
-
return element.matches(selector);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function isContainingBlock(elementOrCss) {
|
|
62
|
-
const webkit = isWebKit();
|
|
63
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
64
|
-
return [
|
|
65
|
-
"transform",
|
|
66
|
-
"translate",
|
|
67
|
-
"scale",
|
|
68
|
-
"rotate",
|
|
69
|
-
"perspective"
|
|
70
|
-
].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) || [
|
|
71
|
-
"transform",
|
|
72
|
-
"translate",
|
|
73
|
-
"scale",
|
|
74
|
-
"rotate",
|
|
75
|
-
"perspective",
|
|
76
|
-
"filter"
|
|
77
|
-
].some((value) => (css.willChange || "").includes(value)) || [
|
|
78
|
-
"paint",
|
|
79
|
-
"layout",
|
|
80
|
-
"strict",
|
|
81
|
-
"content"
|
|
82
|
-
].some((value) => (css.contain || "").includes(value));
|
|
83
|
-
}
|
|
84
|
-
function getContainingBlock(element) {
|
|
85
|
-
let currentNode = getParentNode(element);
|
|
86
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
87
|
-
if (isContainingBlock(currentNode)) return currentNode;
|
|
88
|
-
else if (isTopLayer(currentNode)) return null;
|
|
89
|
-
currentNode = getParentNode(currentNode);
|
|
90
|
-
}
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
function isWebKit() {
|
|
94
|
-
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
95
|
-
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
96
|
-
}
|
|
97
|
-
function isLastTraversableNode(node) {
|
|
98
|
-
return [
|
|
99
|
-
"html",
|
|
100
|
-
"body",
|
|
101
|
-
"#document"
|
|
102
|
-
].includes(getNodeName(node));
|
|
103
|
-
}
|
|
104
|
-
function getComputedStyle(element) {
|
|
105
|
-
return getWindow(element).getComputedStyle(element);
|
|
106
|
-
}
|
|
107
|
-
function getNodeScroll(element) {
|
|
108
|
-
if (isElement(element)) return {
|
|
109
|
-
scrollLeft: element.scrollLeft,
|
|
110
|
-
scrollTop: element.scrollTop
|
|
111
|
-
};
|
|
112
|
-
return {
|
|
113
|
-
scrollLeft: element.scrollX,
|
|
114
|
-
scrollTop: element.scrollY
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function getParentNode(node) {
|
|
118
|
-
if (getNodeName(node) === "html") return node;
|
|
119
|
-
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
|
120
|
-
return isShadowRoot(result) ? result.host : result;
|
|
121
|
-
}
|
|
122
|
-
function getNearestOverflowAncestor(node) {
|
|
123
|
-
const parentNode = getParentNode(node);
|
|
124
|
-
if (isLastTraversableNode(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
125
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
|
|
126
|
-
return getNearestOverflowAncestor(parentNode);
|
|
127
|
-
}
|
|
128
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
129
|
-
var _node$ownerDocument2;
|
|
130
|
-
if (list === void 0) list = [];
|
|
131
|
-
if (traverseIframes === void 0) traverseIframes = true;
|
|
132
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
133
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
134
|
-
const win = getWindow(scrollableAncestor);
|
|
135
|
-
if (isBody) {
|
|
136
|
-
const frameElement = getFrameElement(win);
|
|
137
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
138
|
-
}
|
|
139
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
140
|
-
}
|
|
141
|
-
function getFrameElement(win) {
|
|
142
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
//#endregion
|
|
146
|
-
exports.getComputedStyle = getComputedStyle;
|
|
147
|
-
exports.getContainingBlock = getContainingBlock;
|
|
148
|
-
exports.getDocumentElement = getDocumentElement;
|
|
149
|
-
exports.getFrameElement = getFrameElement;
|
|
150
|
-
exports.getNodeName = getNodeName;
|
|
151
|
-
exports.getNodeScroll = getNodeScroll;
|
|
152
|
-
exports.getOverflowAncestors = getOverflowAncestors;
|
|
153
|
-
exports.getParentNode = getParentNode;
|
|
154
|
-
exports.getWindow = getWindow;
|
|
155
|
-
exports.isContainingBlock = isContainingBlock;
|
|
156
|
-
exports.isElement = isElement;
|
|
157
|
-
exports.isHTMLElement = isHTMLElement;
|
|
158
|
-
exports.isLastTraversableNode = isLastTraversableNode;
|
|
159
|
-
exports.isOverflowElement = isOverflowElement;
|
|
160
|
-
exports.isTableElement = isTableElement;
|
|
161
|
-
exports.isTopLayer = isTopLayer;
|
|
162
|
-
exports.isWebKit = isWebKit;
|
|
@@ -1,149 +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
|
-
|
|
9
|
-
//#region ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
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
|
-
function getSideAxis(placement) {
|
|
47
|
-
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
48
|
-
}
|
|
49
|
-
function getAlignmentAxis(placement) {
|
|
50
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
51
|
-
}
|
|
52
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
53
|
-
if (rtl === void 0) rtl = false;
|
|
54
|
-
const alignment = getAlignment(placement);
|
|
55
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
56
|
-
const length = getAxisLength(alignmentAxis);
|
|
57
|
-
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
58
|
-
if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
59
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
60
|
-
}
|
|
61
|
-
function getExpandedPlacements(placement) {
|
|
62
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
63
|
-
return [
|
|
64
|
-
getOppositeAlignmentPlacement(placement),
|
|
65
|
-
oppositePlacement,
|
|
66
|
-
getOppositeAlignmentPlacement(oppositePlacement)
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
70
|
-
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
71
|
-
}
|
|
72
|
-
function getSideList(side, isStart, rtl) {
|
|
73
|
-
const lr = ["left", "right"];
|
|
74
|
-
const rl = ["right", "left"];
|
|
75
|
-
const tb = ["top", "bottom"];
|
|
76
|
-
const bt = ["bottom", "top"];
|
|
77
|
-
switch (side) {
|
|
78
|
-
case "top":
|
|
79
|
-
case "bottom":
|
|
80
|
-
if (rtl) return isStart ? rl : lr;
|
|
81
|
-
return isStart ? lr : rl;
|
|
82
|
-
case "left":
|
|
83
|
-
case "right": return isStart ? tb : bt;
|
|
84
|
-
default: return [];
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
88
|
-
const alignment = getAlignment(placement);
|
|
89
|
-
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
90
|
-
if (alignment) {
|
|
91
|
-
list = list.map((side) => side + "-" + alignment);
|
|
92
|
-
if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
93
|
-
}
|
|
94
|
-
return list;
|
|
95
|
-
}
|
|
96
|
-
function getOppositePlacement(placement) {
|
|
97
|
-
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
98
|
-
}
|
|
99
|
-
function expandPaddingObject(padding) {
|
|
100
|
-
return {
|
|
101
|
-
top: 0,
|
|
102
|
-
right: 0,
|
|
103
|
-
bottom: 0,
|
|
104
|
-
left: 0,
|
|
105
|
-
...padding
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function getPaddingObject(padding) {
|
|
109
|
-
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
110
|
-
top: padding,
|
|
111
|
-
right: padding,
|
|
112
|
-
bottom: padding,
|
|
113
|
-
left: padding
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function rectToClientRect(rect) {
|
|
117
|
-
const { x, y, width, height } = rect;
|
|
118
|
-
return {
|
|
119
|
-
width,
|
|
120
|
-
height,
|
|
121
|
-
top: y,
|
|
122
|
-
left: x,
|
|
123
|
-
right: x + width,
|
|
124
|
-
bottom: y + height,
|
|
125
|
-
x,
|
|
126
|
-
y
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
//#endregion
|
|
131
|
-
exports.clamp = clamp;
|
|
132
|
-
exports.createCoords = createCoords;
|
|
133
|
-
exports.evaluate = evaluate;
|
|
134
|
-
exports.floor = floor;
|
|
135
|
-
exports.getAlignment = getAlignment;
|
|
136
|
-
exports.getAlignmentAxis = getAlignmentAxis;
|
|
137
|
-
exports.getAlignmentSides = getAlignmentSides;
|
|
138
|
-
exports.getAxisLength = getAxisLength;
|
|
139
|
-
exports.getExpandedPlacements = getExpandedPlacements;
|
|
140
|
-
exports.getOppositeAxis = getOppositeAxis;
|
|
141
|
-
exports.getOppositeAxisPlacements = getOppositeAxisPlacements;
|
|
142
|
-
exports.getOppositePlacement = getOppositePlacement;
|
|
143
|
-
exports.getPaddingObject = getPaddingObject;
|
|
144
|
-
exports.getSide = getSide;
|
|
145
|
-
exports.getSideAxis = getSideAxis;
|
|
146
|
-
exports.max = max;
|
|
147
|
-
exports.min = min;
|
|
148
|
-
exports.rectToClientRect = rectToClientRect;
|
|
149
|
-
exports.round = round;
|