@pibit.ai/cure-design-system 0.3.15 → 0.3.17
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/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -18
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +387 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +313 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +132 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +105 -0
- package/dist/patterns/table/TableWrapper.d.ts +0 -11
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +72 -150
- package/dist/patterns/table/index.d.ts +2 -1
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/table.d.ts.map +1 -1
- package/dist/patterns/table/table.js +50 -44
- package/dist/patterns/tree-view/tree-view.d.ts +7 -1
- package/dist/patterns/tree-view/tree-view.d.ts.map +1 -1
- package/dist/patterns/tree-view/tree-view.js +77 -70
- package/dist/primitives/button/button-utility.js +7 -7
- package/dist/primitives/button/button.js +2 -2
- package/dist/primitives/tooltip/ellipsis-content.d.ts +12 -0
- package/dist/primitives/tooltip/ellipsis-content.d.ts.map +1 -0
- package/dist/primitives/tooltip/ellipsis-content.js +113 -0
- package/dist/primitives/tooltip/index.d.ts +1 -0
- package/dist/primitives/tooltip/index.d.ts.map +1 -1
- package/dist/styles/components.css +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export { Icon, type IconProps, type IconName } from './primitives/icon';
|
|
|
8
8
|
export { Text, type TextProps } from './primitives/text';
|
|
9
9
|
export { Heading, type HeadingProps } from './primitives/heading';
|
|
10
10
|
export { Select, type SelectProps, SearchableSelect, type SearchableSelectProps, MultiSelect, type MultiSelectProps, Popover, type PopoverProps, ExpandableSearchInput, type ExpandableSearchInputProps, } from './primitives/select';
|
|
11
|
-
export { Tooltip, type TooltipProps, TooltipTrigger, type TooltipTriggerProps, } from './primitives/tooltip';
|
|
11
|
+
export { Tooltip, type TooltipProps, TooltipTrigger, type TooltipTriggerProps, EllipsisContentWithTooltip, createEllipsisContent, type EllipsisContentWithTooltipProps, } from './primitives/tooltip';
|
|
12
12
|
export { CustomIcon, ICONS, type CustomIconProps, type CustomIconType } from './primitives/custom-icon';
|
|
13
|
-
export { Table, TableCard, TableCell, TableWrapper,
|
|
13
|
+
export { Table, TableCard, TableCell, TableWrapper, type TableWrapperProps, } from './patterns/table';
|
|
14
14
|
export { TreeView, buildTreeViewNodes, type TreeViewNode, type TreeViewProps, type TreeViewBuildConfig, } from './patterns/tree-view';
|
|
15
15
|
export { cn, cx, sortCx } from './utils/cn';
|
|
16
16
|
export { isReactComponent, isFunctionComponent, isClassComponent, isForwardRefComponent, } from './utils/is-react-component';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,KAAK,IAAI,cAAc,EAC5B,KAAK,WAAW,IAAI,iBAAiB,EACrC,MAAM,IAAI,YAAY,EACtB,aAAa,EACb,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,SAAS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K,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGxG,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./styles/theme.css";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { cn as p, cx as m, sortCx as i } from "./utils/cn.js";
|
|
4
|
-
import { isClassComponent as
|
|
4
|
+
import { isClassComponent as x, isForwardRefComponent as a, isFunctionComponent as n, isReactComponent as f } from "./utils/is-react-component.js";
|
|
5
5
|
import { Button as c, styles as d } from "./primitives/button/button.js";
|
|
6
6
|
import { ButtonUtility as C } from "./primitives/button/button-utility.js";
|
|
7
7
|
import { Input as u } from "./primitives/input/input.js";
|
|
@@ -18,11 +18,12 @@ import { MultiSelect as J } from "./primitives/select/multi-select.js";
|
|
|
18
18
|
import { Popover as L } from "./primitives/select/popover.js";
|
|
19
19
|
import { ExpandableSearchInput as X } from "./primitives/select/ExpandableSearchInput.js";
|
|
20
20
|
import { Tooltip as Z, TooltipTrigger as _ } from "./primitives/tooltip/tooltip.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
21
|
+
import { EllipsisContentWithTooltip as oo, createEllipsisContent as eo } from "./primitives/tooltip/ellipsis-content.js";
|
|
22
|
+
import { CustomIcon as ro } from "./primitives/custom-icon/custom-icon.js";
|
|
23
|
+
import { ICONS as mo } from "./primitives/custom-icon/registry.js";
|
|
24
|
+
import { Table as lo, TableCard as xo, TableCell as ao } from "./patterns/table/table.js";
|
|
25
|
+
import { TableWrapper as fo } from "./patterns/table/TableWrapper.js";
|
|
26
|
+
import { TreeView as co, buildTreeViewNodes as go } from "./patterns/tree-view/tree-view.js";
|
|
26
27
|
export {
|
|
27
28
|
k as Avatar,
|
|
28
29
|
W as Badge,
|
|
@@ -35,34 +36,34 @@ export {
|
|
|
35
36
|
c as Button,
|
|
36
37
|
C as ButtonUtility,
|
|
37
38
|
b as Checkbox,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
ro as CustomIcon,
|
|
40
|
+
oo as EllipsisContentWithTooltip,
|
|
40
41
|
X as ExpandableSearchInput,
|
|
41
42
|
P as Heading,
|
|
42
|
-
|
|
43
|
+
mo as ICONS,
|
|
43
44
|
D as Icon,
|
|
44
45
|
u as Input,
|
|
45
46
|
J as MultiSelect,
|
|
46
47
|
L as Popover,
|
|
47
48
|
z as SearchableSelect,
|
|
48
49
|
j as Select,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
lo as Table,
|
|
51
|
+
xo as TableCard,
|
|
52
|
+
ao as TableCell,
|
|
53
|
+
fo as TableWrapper,
|
|
53
54
|
M as Text,
|
|
54
55
|
I as Toggle,
|
|
55
56
|
Z as Tooltip,
|
|
56
57
|
_ as TooltipTrigger,
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
co as TreeView,
|
|
59
|
+
go as buildTreeViewNodes,
|
|
59
60
|
d as buttonStyles,
|
|
60
61
|
p as cn,
|
|
61
|
-
|
|
62
|
+
eo as createEllipsisContent,
|
|
62
63
|
m as cx,
|
|
63
64
|
R as filledColors,
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
x as isClassComponent,
|
|
66
|
+
a as isForwardRefComponent,
|
|
66
67
|
n as isFunctionComponent,
|
|
67
68
|
f as isReactComponent,
|
|
68
69
|
i as sortCx
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { getSideAxis as $, getAlignmentAxis as j, getSide as D, getAlignment as S, evaluate as E, getPaddingObject as H, rectToClientRect as k, getAxisLength as X, placements as V, getAlignmentSides as Y, min as B, max as C, clamp as F, getOppositeAlignmentPlacement as z, getOppositeAxis as I } from "../../utils/dist/floating-ui.utils.js";
|
|
2
|
+
function W(t, e, c) {
|
|
3
|
+
let {
|
|
4
|
+
reference: i,
|
|
5
|
+
floating: n
|
|
6
|
+
} = t;
|
|
7
|
+
const s = $(e), a = j(e), d = X(a), u = D(e), h = s === "y", o = i.x + i.width / 2 - n.width / 2, l = i.y + i.height / 2 - n.height / 2, r = i[d] / 2 - n[d] / 2;
|
|
8
|
+
let m;
|
|
9
|
+
switch (u) {
|
|
10
|
+
case "top":
|
|
11
|
+
m = {
|
|
12
|
+
x: o,
|
|
13
|
+
y: i.y - n.height
|
|
14
|
+
};
|
|
15
|
+
break;
|
|
16
|
+
case "bottom":
|
|
17
|
+
m = {
|
|
18
|
+
x: o,
|
|
19
|
+
y: i.y + i.height
|
|
20
|
+
};
|
|
21
|
+
break;
|
|
22
|
+
case "right":
|
|
23
|
+
m = {
|
|
24
|
+
x: i.x + i.width,
|
|
25
|
+
y: l
|
|
26
|
+
};
|
|
27
|
+
break;
|
|
28
|
+
case "left":
|
|
29
|
+
m = {
|
|
30
|
+
x: i.x - n.width,
|
|
31
|
+
y: l
|
|
32
|
+
};
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
m = {
|
|
36
|
+
x: i.x,
|
|
37
|
+
y: i.y
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
switch (S(e)) {
|
|
41
|
+
case "start":
|
|
42
|
+
m[a] -= r * (c && h ? -1 : 1);
|
|
43
|
+
break;
|
|
44
|
+
case "end":
|
|
45
|
+
m[a] += r * (c && h ? -1 : 1);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return m;
|
|
49
|
+
}
|
|
50
|
+
async function N(t, e) {
|
|
51
|
+
var c;
|
|
52
|
+
e === void 0 && (e = {});
|
|
53
|
+
const {
|
|
54
|
+
x: i,
|
|
55
|
+
y: n,
|
|
56
|
+
platform: s,
|
|
57
|
+
rects: a,
|
|
58
|
+
elements: d,
|
|
59
|
+
strategy: u
|
|
60
|
+
} = t, {
|
|
61
|
+
boundary: h = "clippingAncestors",
|
|
62
|
+
rootBoundary: o = "viewport",
|
|
63
|
+
elementContext: l = "floating",
|
|
64
|
+
altBoundary: r = !1,
|
|
65
|
+
padding: m = 0
|
|
66
|
+
} = E(e, t), f = H(m), p = d[r ? l === "floating" ? "reference" : "floating" : l], g = k(await s.getClippingRect({
|
|
67
|
+
element: (c = await (s.isElement == null ? void 0 : s.isElement(p))) == null || c ? p : p.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(d.floating)),
|
|
68
|
+
boundary: h,
|
|
69
|
+
rootBoundary: o,
|
|
70
|
+
strategy: u
|
|
71
|
+
})), w = l === "floating" ? {
|
|
72
|
+
x: i,
|
|
73
|
+
y: n,
|
|
74
|
+
width: a.floating.width,
|
|
75
|
+
height: a.floating.height
|
|
76
|
+
} : a.reference, v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(d.floating)), y = await (s.isElement == null ? void 0 : s.isElement(v)) ? await (s.getScale == null ? void 0 : s.getScale(v)) || {
|
|
77
|
+
x: 1,
|
|
78
|
+
y: 1
|
|
79
|
+
} : {
|
|
80
|
+
x: 1,
|
|
81
|
+
y: 1
|
|
82
|
+
}, b = k(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
83
|
+
elements: d,
|
|
84
|
+
rect: w,
|
|
85
|
+
offsetParent: v,
|
|
86
|
+
strategy: u
|
|
87
|
+
}) : w);
|
|
88
|
+
return {
|
|
89
|
+
top: (g.top - b.top + f.top) / y.y,
|
|
90
|
+
bottom: (b.bottom - g.bottom + f.bottom) / y.y,
|
|
91
|
+
left: (g.left - b.left + f.left) / y.x,
|
|
92
|
+
right: (b.right - g.right + f.right) / y.x
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const U = 50, Q = async (t, e, c) => {
|
|
96
|
+
const {
|
|
97
|
+
placement: i = "bottom",
|
|
98
|
+
strategy: n = "absolute",
|
|
99
|
+
middleware: s = [],
|
|
100
|
+
platform: a
|
|
101
|
+
} = c, d = a.detectOverflow ? a : {
|
|
102
|
+
...a,
|
|
103
|
+
detectOverflow: N
|
|
104
|
+
}, u = await (a.isRTL == null ? void 0 : a.isRTL(e));
|
|
105
|
+
let h = await a.getElementRects({
|
|
106
|
+
reference: t,
|
|
107
|
+
floating: e,
|
|
108
|
+
strategy: n
|
|
109
|
+
}), {
|
|
110
|
+
x: o,
|
|
111
|
+
y: l
|
|
112
|
+
} = W(h, i, u), r = i, m = 0;
|
|
113
|
+
const f = {};
|
|
114
|
+
for (let x = 0; x < s.length; x++) {
|
|
115
|
+
const p = s[x];
|
|
116
|
+
if (!p)
|
|
117
|
+
continue;
|
|
118
|
+
const {
|
|
119
|
+
name: g,
|
|
120
|
+
fn: w
|
|
121
|
+
} = p, {
|
|
122
|
+
x: v,
|
|
123
|
+
y,
|
|
124
|
+
data: b,
|
|
125
|
+
reset: O
|
|
126
|
+
} = await w({
|
|
127
|
+
x: o,
|
|
128
|
+
y: l,
|
|
129
|
+
initialPlacement: i,
|
|
130
|
+
placement: r,
|
|
131
|
+
strategy: n,
|
|
132
|
+
middlewareData: f,
|
|
133
|
+
rects: h,
|
|
134
|
+
platform: d,
|
|
135
|
+
elements: {
|
|
136
|
+
reference: t,
|
|
137
|
+
floating: e
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
o = v ?? o, l = y ?? l, f[g] = {
|
|
141
|
+
...f[g],
|
|
142
|
+
...b
|
|
143
|
+
}, O && m < U && (m++, typeof O == "object" && (O.placement && (r = O.placement), O.rects && (h = O.rects === !0 ? await a.getElementRects({
|
|
144
|
+
reference: t,
|
|
145
|
+
floating: e,
|
|
146
|
+
strategy: n
|
|
147
|
+
}) : O.rects), {
|
|
148
|
+
x: o,
|
|
149
|
+
y: l
|
|
150
|
+
} = W(h, r, u)), x = -1);
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
x: o,
|
|
154
|
+
y: l,
|
|
155
|
+
placement: r,
|
|
156
|
+
strategy: n,
|
|
157
|
+
middlewareData: f
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
function q(t, e, c) {
|
|
161
|
+
return (t ? [...c.filter((n) => S(n) === t), ...c.filter((n) => S(n) !== t)] : c.filter((n) => D(n) === n)).filter((n) => t ? S(n) === t || (e ? z(n) !== n : !1) : !0);
|
|
162
|
+
}
|
|
163
|
+
const Z = function(t) {
|
|
164
|
+
return t === void 0 && (t = {}), {
|
|
165
|
+
name: "autoPlacement",
|
|
166
|
+
options: t,
|
|
167
|
+
async fn(e) {
|
|
168
|
+
var c, i, n;
|
|
169
|
+
const {
|
|
170
|
+
rects: s,
|
|
171
|
+
middlewareData: a,
|
|
172
|
+
placement: d,
|
|
173
|
+
platform: u,
|
|
174
|
+
elements: h
|
|
175
|
+
} = e, {
|
|
176
|
+
crossAxis: o = !1,
|
|
177
|
+
alignment: l,
|
|
178
|
+
allowedPlacements: r = V,
|
|
179
|
+
autoAlignment: m = !0,
|
|
180
|
+
...f
|
|
181
|
+
} = E(t, e), x = l !== void 0 || r === V ? q(l || null, m, r) : r, p = await u.detectOverflow(e, f), g = ((c = a.autoPlacement) == null ? void 0 : c.index) || 0, w = x[g];
|
|
182
|
+
if (w == null)
|
|
183
|
+
return {};
|
|
184
|
+
const v = Y(w, s, await (u.isRTL == null ? void 0 : u.isRTL(h.floating)));
|
|
185
|
+
if (d !== w)
|
|
186
|
+
return {
|
|
187
|
+
reset: {
|
|
188
|
+
placement: x[0]
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const y = [p[D(w)], p[v[0]], p[v[1]]], b = [...((i = a.autoPlacement) == null ? void 0 : i.overflows) || [], {
|
|
192
|
+
placement: w,
|
|
193
|
+
overflows: y
|
|
194
|
+
}], O = x[g + 1];
|
|
195
|
+
if (O)
|
|
196
|
+
return {
|
|
197
|
+
data: {
|
|
198
|
+
index: g + 1,
|
|
199
|
+
overflows: b
|
|
200
|
+
},
|
|
201
|
+
reset: {
|
|
202
|
+
placement: O
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const P = b.map((A) => {
|
|
206
|
+
const R = S(A.placement);
|
|
207
|
+
return [A.placement, R && o ? (
|
|
208
|
+
// Check along the mainAxis and main crossAxis side.
|
|
209
|
+
A.overflows.slice(0, 2).reduce((M, _) => M + _, 0)
|
|
210
|
+
) : (
|
|
211
|
+
// Check only the mainAxis.
|
|
212
|
+
A.overflows[0]
|
|
213
|
+
), A.overflows];
|
|
214
|
+
}).sort((A, R) => A[1] - R[1]), T = ((n = P.filter((A) => A[2].slice(
|
|
215
|
+
0,
|
|
216
|
+
// Aligned placements should not check their opposite crossAxis
|
|
217
|
+
// side.
|
|
218
|
+
S(A[0]) ? 2 : 3
|
|
219
|
+
).every((R) => R <= 0))[0]) == null ? void 0 : n[0]) || P[0][0];
|
|
220
|
+
return T !== d ? {
|
|
221
|
+
data: {
|
|
222
|
+
index: g + 1,
|
|
223
|
+
overflows: b
|
|
224
|
+
},
|
|
225
|
+
reset: {
|
|
226
|
+
placement: T
|
|
227
|
+
}
|
|
228
|
+
} : {};
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}, G = /* @__PURE__ */ new Set(["left", "top"]);
|
|
232
|
+
async function J(t, e) {
|
|
233
|
+
const {
|
|
234
|
+
placement: c,
|
|
235
|
+
platform: i,
|
|
236
|
+
elements: n
|
|
237
|
+
} = t, s = await (i.isRTL == null ? void 0 : i.isRTL(n.floating)), a = D(c), d = S(c), u = $(c) === "y", h = G.has(a) ? -1 : 1, o = s && u ? -1 : 1, l = E(e, t);
|
|
238
|
+
let {
|
|
239
|
+
mainAxis: r,
|
|
240
|
+
crossAxis: m,
|
|
241
|
+
alignmentAxis: f
|
|
242
|
+
} = typeof l == "number" ? {
|
|
243
|
+
mainAxis: l,
|
|
244
|
+
crossAxis: 0,
|
|
245
|
+
alignmentAxis: null
|
|
246
|
+
} : {
|
|
247
|
+
mainAxis: l.mainAxis || 0,
|
|
248
|
+
crossAxis: l.crossAxis || 0,
|
|
249
|
+
alignmentAxis: l.alignmentAxis
|
|
250
|
+
};
|
|
251
|
+
return d && typeof f == "number" && (m = d === "end" ? f * -1 : f), u ? {
|
|
252
|
+
x: m * o,
|
|
253
|
+
y: r * h
|
|
254
|
+
} : {
|
|
255
|
+
x: r * h,
|
|
256
|
+
y: m * o
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const tt = function(t) {
|
|
260
|
+
return t === void 0 && (t = 0), {
|
|
261
|
+
name: "offset",
|
|
262
|
+
options: t,
|
|
263
|
+
async fn(e) {
|
|
264
|
+
var c, i;
|
|
265
|
+
const {
|
|
266
|
+
x: n,
|
|
267
|
+
y: s,
|
|
268
|
+
placement: a,
|
|
269
|
+
middlewareData: d
|
|
270
|
+
} = e, u = await J(e, t);
|
|
271
|
+
return a === ((c = d.offset) == null ? void 0 : c.placement) && (i = d.arrow) != null && i.alignmentOffset ? {} : {
|
|
272
|
+
x: n + u.x,
|
|
273
|
+
y: s + u.y,
|
|
274
|
+
data: {
|
|
275
|
+
...u,
|
|
276
|
+
placement: a
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
}, et = function(t) {
|
|
282
|
+
return t === void 0 && (t = {}), {
|
|
283
|
+
name: "shift",
|
|
284
|
+
options: t,
|
|
285
|
+
async fn(e) {
|
|
286
|
+
const {
|
|
287
|
+
x: c,
|
|
288
|
+
y: i,
|
|
289
|
+
placement: n,
|
|
290
|
+
platform: s
|
|
291
|
+
} = e, {
|
|
292
|
+
mainAxis: a = !0,
|
|
293
|
+
crossAxis: d = !1,
|
|
294
|
+
limiter: u = {
|
|
295
|
+
fn: (g) => {
|
|
296
|
+
let {
|
|
297
|
+
x: w,
|
|
298
|
+
y: v
|
|
299
|
+
} = g;
|
|
300
|
+
return {
|
|
301
|
+
x: w,
|
|
302
|
+
y: v
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
...h
|
|
307
|
+
} = E(t, e), o = {
|
|
308
|
+
x: c,
|
|
309
|
+
y: i
|
|
310
|
+
}, l = await s.detectOverflow(e, h), r = $(D(n)), m = I(r);
|
|
311
|
+
let f = o[m], x = o[r];
|
|
312
|
+
if (a) {
|
|
313
|
+
const g = m === "y" ? "top" : "left", w = m === "y" ? "bottom" : "right", v = f + l[g], y = f - l[w];
|
|
314
|
+
f = F(v, f, y);
|
|
315
|
+
}
|
|
316
|
+
if (d) {
|
|
317
|
+
const g = r === "y" ? "top" : "left", w = r === "y" ? "bottom" : "right", v = x + l[g], y = x - l[w];
|
|
318
|
+
x = F(v, x, y);
|
|
319
|
+
}
|
|
320
|
+
const p = u.fn({
|
|
321
|
+
...e,
|
|
322
|
+
[m]: f,
|
|
323
|
+
[r]: x
|
|
324
|
+
});
|
|
325
|
+
return {
|
|
326
|
+
...p,
|
|
327
|
+
data: {
|
|
328
|
+
x: p.x - c,
|
|
329
|
+
y: p.y - i,
|
|
330
|
+
enabled: {
|
|
331
|
+
[m]: a,
|
|
332
|
+
[r]: d
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}, nt = function(t) {
|
|
339
|
+
return t === void 0 && (t = {}), {
|
|
340
|
+
name: "size",
|
|
341
|
+
options: t,
|
|
342
|
+
async fn(e) {
|
|
343
|
+
var c, i;
|
|
344
|
+
const {
|
|
345
|
+
placement: n,
|
|
346
|
+
rects: s,
|
|
347
|
+
platform: a,
|
|
348
|
+
elements: d
|
|
349
|
+
} = e, {
|
|
350
|
+
apply: u = () => {
|
|
351
|
+
},
|
|
352
|
+
...h
|
|
353
|
+
} = E(t, e), o = await a.detectOverflow(e, h), l = D(n), r = S(n), m = $(n) === "y", {
|
|
354
|
+
width: f,
|
|
355
|
+
height: x
|
|
356
|
+
} = s.floating;
|
|
357
|
+
let p, g;
|
|
358
|
+
l === "top" || l === "bottom" ? (p = l, g = r === (await (a.isRTL == null ? void 0 : a.isRTL(d.floating)) ? "start" : "end") ? "left" : "right") : (g = l, p = r === "end" ? "top" : "bottom");
|
|
359
|
+
const w = x - o.top - o.bottom, v = f - o.left - o.right, y = B(x - o[p], w), b = B(f - o[g], v), O = !e.middlewareData.shift;
|
|
360
|
+
let P = y, L = b;
|
|
361
|
+
if ((c = e.middlewareData.shift) != null && c.enabled.x && (L = v), (i = e.middlewareData.shift) != null && i.enabled.y && (P = w), O && !r) {
|
|
362
|
+
const A = C(o.left, 0), R = C(o.right, 0), M = C(o.top, 0), _ = C(o.bottom, 0);
|
|
363
|
+
m ? L = f - 2 * (A !== 0 || R !== 0 ? A + R : C(o.left, o.right)) : P = x - 2 * (M !== 0 || _ !== 0 ? M + _ : C(o.top, o.bottom));
|
|
364
|
+
}
|
|
365
|
+
await u({
|
|
366
|
+
...e,
|
|
367
|
+
availableWidth: L,
|
|
368
|
+
availableHeight: P
|
|
369
|
+
});
|
|
370
|
+
const T = await a.getDimensions(d.floating);
|
|
371
|
+
return f !== T.width || x !== T.height ? {
|
|
372
|
+
reset: {
|
|
373
|
+
rects: !0
|
|
374
|
+
}
|
|
375
|
+
} : {};
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
export {
|
|
380
|
+
Z as autoPlacement,
|
|
381
|
+
Q as computePosition,
|
|
382
|
+
N as detectOverflow,
|
|
383
|
+
tt as offset,
|
|
384
|
+
k as rectToClientRect,
|
|
385
|
+
et as shift,
|
|
386
|
+
nt as size
|
|
387
|
+
};
|