asma-ui-core 3.68.1 → 3.68.3
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.
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
var e = "
|
|
1
|
+
var e = "_root_1k8wv_1", _ = "_shell_1k8wv_5", a = "_shellCompact_1k8wv_9", v = "_shellExpanded_1k8wv_13", r = "_content_1k8wv_17", t = "_compactItems_1k8wv_21", o = "_compactItemsStacked_1k8wv_25", m = "_expandedItems_1k8wv_29", s = "_measureRow_1k8wv_33", c = "_measureLayer_1k8wv_37", l = "_chevron_1k8wv_41", d = {
|
|
2
2
|
root: e,
|
|
3
3
|
shell: _,
|
|
4
4
|
shellCompact: a,
|
|
5
|
-
shellExpanded:
|
|
6
|
-
content:
|
|
7
|
-
compactItems:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
shellExpanded: v,
|
|
6
|
+
content: r,
|
|
7
|
+
compactItems: t,
|
|
8
|
+
compactItemsStacked: o,
|
|
9
|
+
expandedItems: m,
|
|
10
|
+
measureRow: s,
|
|
11
|
+
measureLayer: c,
|
|
12
|
+
chevron: l
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
15
|
d as default
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { ChevronUpIcon as
|
|
1
|
+
import { cn as b } from "../../../helpers/cn.js";
|
|
2
|
+
import { ChevronDownIcon as F } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { ChevronUpIcon as O } from "../../icons/chevron-up-icon/ChevronUpIcon.js";
|
|
4
4
|
import h from "./Pathfinder.module.js";
|
|
5
|
-
import { useCallback as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
const [i, n] = x(null), d =
|
|
5
|
+
import { useCallback as I, useEffect as M, useLayoutEffect as j, useMemo as y, useRef as R, useState as x, useSyncExternalStore as P } from "react";
|
|
6
|
+
import { Fragment as D, jsx as e, jsxs as k } from "react/jsx-runtime";
|
|
7
|
+
var _ = typeof window < "u" ? j : M;
|
|
8
|
+
function q() {
|
|
9
|
+
const [i, n] = x(null), d = I((t) => {
|
|
10
10
|
n(t);
|
|
11
|
-
}, []), s =
|
|
11
|
+
}, []), s = I(() => i ? Math.floor(i.getBoundingClientRect().width) : 0, [i]);
|
|
12
12
|
return {
|
|
13
13
|
ref: d,
|
|
14
|
-
width:
|
|
14
|
+
width: P(I((t) => {
|
|
15
15
|
if (!i || typeof ResizeObserver > "u") return () => {
|
|
16
16
|
console.log("Node is missing or ResizeObserver is undefined");
|
|
17
17
|
};
|
|
@@ -25,33 +25,33 @@ function D() {
|
|
|
25
25
|
}, [i]), s, () => 0)
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function A(i) {
|
|
29
29
|
return [...i].sort((n, d) => {
|
|
30
30
|
const s = n.order ?? 0, t = d.order ?? 0;
|
|
31
31
|
return s !== t ? s - t : n.id.localeCompare(d.id);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const { items: n, leadSlot: d, actionSlot: s } = i, t =
|
|
34
|
+
function K(i) {
|
|
35
|
+
const { items: n, leadSlot: d, actionSlot: s } = i, t = R({}), a = R(null), o = R(null), [l, v] = x({
|
|
36
36
|
itemWidths: {},
|
|
37
37
|
leadWidth: 0,
|
|
38
38
|
actionWidth: 0
|
|
39
|
-
}), f =
|
|
40
|
-
|
|
39
|
+
}), f = R(l);
|
|
40
|
+
M(() => {
|
|
41
41
|
f.current = l;
|
|
42
42
|
}, [l]);
|
|
43
|
-
const
|
|
44
|
-
t.current[
|
|
43
|
+
const p = I((r) => (m) => {
|
|
44
|
+
t.current[r] = m;
|
|
45
45
|
}, []);
|
|
46
|
-
return
|
|
47
|
-
const
|
|
46
|
+
return _(() => {
|
|
47
|
+
const r = {};
|
|
48
48
|
for (const u of n) {
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
const w = t.current[u.id], N = Math.ceil(w?.getBoundingClientRect().width ?? u.estimatedWidth ?? 0);
|
|
50
|
+
r[u.id] = N;
|
|
51
51
|
}
|
|
52
52
|
const m = d ? Math.ceil(a.current?.getBoundingClientRect().width ?? 0) : 0, g = s ? Math.ceil(o.current?.getBoundingClientRect().width ?? 0) : 0, W = f.current;
|
|
53
|
-
(!(Object.keys(W.itemWidths).length === Object.keys(
|
|
54
|
-
itemWidths:
|
|
53
|
+
(!(Object.keys(W.itemWidths).length === Object.keys(r).length && n.every((u) => W.itemWidths[u.id] === r[u.id])) || W.leadWidth !== m || W.actionWidth !== g) && v({
|
|
54
|
+
itemWidths: r,
|
|
55
55
|
leadWidth: m,
|
|
56
56
|
actionWidth: g
|
|
57
57
|
});
|
|
@@ -61,84 +61,84 @@ function _(i) {
|
|
|
61
61
|
s
|
|
62
62
|
]), {
|
|
63
63
|
measurements: l,
|
|
64
|
-
registerItemRef:
|
|
64
|
+
registerItemRef: p,
|
|
65
65
|
leadRef: a,
|
|
66
66
|
actionRef: o
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function U(i) {
|
|
70
70
|
const { items: n, availableWidth: d, gapPx: s, itemWidths: t } = i, a = [];
|
|
71
71
|
let o = 0;
|
|
72
|
-
for (const l of
|
|
73
|
-
const
|
|
72
|
+
for (const l of A(n)) {
|
|
73
|
+
const v = Math.max(0, t[l.id] ?? l.estimatedWidth ?? 0), f = a.length === 0 ? v : o + s + v;
|
|
74
74
|
if (f > d) break;
|
|
75
75
|
a.push(l), o = f;
|
|
76
76
|
}
|
|
77
77
|
return a;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
return /* @__PURE__ */ e(
|
|
79
|
+
function C({ item: i, compact: n }) {
|
|
80
|
+
return /* @__PURE__ */ e(D, { children: i.render({ compact: n }) });
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
const { ref:
|
|
84
|
-
items:
|
|
82
|
+
function Y({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot: t, className: a, leadReservePx: o = 140, actionReservePx: l = 44 }) {
|
|
83
|
+
const { ref: v, width: f } = q(), p = !n, r = y(() => A(i), [i]), { measurements: m, registerItemRef: g, leadRef: W, actionRef: u } = K({
|
|
84
|
+
items: r,
|
|
85
85
|
leadSlot: s,
|
|
86
86
|
actionSlot: t
|
|
87
|
-
}),
|
|
88
|
-
if (n) return
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
items:
|
|
92
|
-
availableWidth: Math.max(0, f -
|
|
87
|
+
}), w = y(() => {
|
|
88
|
+
if (n) return r;
|
|
89
|
+
const c = 24, L = 24, z = s ? Math.max(o, m.leadWidth + 12) : 0, B = t ? Math.max(l, m.actionWidth) : 0;
|
|
90
|
+
return U({
|
|
91
|
+
items: r,
|
|
92
|
+
availableWidth: Math.max(0, f - c - L - z - B - 24),
|
|
93
93
|
gapPx: 12,
|
|
94
94
|
itemWidths: m.itemWidths
|
|
95
95
|
});
|
|
96
96
|
}, [
|
|
97
97
|
n,
|
|
98
|
-
|
|
98
|
+
r,
|
|
99
99
|
f,
|
|
100
100
|
s,
|
|
101
101
|
t,
|
|
102
102
|
o,
|
|
103
103
|
l,
|
|
104
104
|
m
|
|
105
|
-
]);
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
ref:
|
|
108
|
-
className:
|
|
105
|
+
]), N = p && w.length < Math.min(2, r.length), E = N ? r.slice(0, 2) : w;
|
|
106
|
+
return /* @__PURE__ */ k("div", {
|
|
107
|
+
ref: v,
|
|
108
|
+
className: b(h.root, p ? "overflow-hidden" : "overflow-visible", a),
|
|
109
109
|
"aria-expanded": n,
|
|
110
110
|
role: "button",
|
|
111
111
|
tabIndex: 0,
|
|
112
112
|
onClick: d,
|
|
113
|
-
onKeyDown: (
|
|
114
|
-
(
|
|
113
|
+
onKeyDown: (c) => {
|
|
114
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), d());
|
|
115
115
|
},
|
|
116
116
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
className:
|
|
117
|
+
/* @__PURE__ */ k("div", {
|
|
118
|
+
className: b(h.shell, p ? h.shellCompact : h.shellExpanded),
|
|
119
119
|
children: [s ? /* @__PURE__ */ e("div", {
|
|
120
120
|
className: "shrink-0",
|
|
121
121
|
children: s
|
|
122
122
|
}) : null, /* @__PURE__ */ e("div", {
|
|
123
123
|
className: h.content,
|
|
124
|
-
children:
|
|
125
|
-
className: h.compactItems,
|
|
126
|
-
children:
|
|
124
|
+
children: p ? /* @__PURE__ */ e("div", {
|
|
125
|
+
className: b(h.compactItems, N && h.compactItemsStacked),
|
|
126
|
+
children: E.map((c) => /* @__PURE__ */ e("div", {
|
|
127
127
|
className: "shrink-0 whitespace-nowrap",
|
|
128
|
-
children: /* @__PURE__ */ e(
|
|
129
|
-
item:
|
|
130
|
-
compact:
|
|
128
|
+
children: /* @__PURE__ */ e(C, {
|
|
129
|
+
item: c,
|
|
130
|
+
compact: p
|
|
131
131
|
})
|
|
132
|
-
},
|
|
133
|
-
}) : /* @__PURE__ */
|
|
132
|
+
}, c.id))
|
|
133
|
+
}) : /* @__PURE__ */ k("div", {
|
|
134
134
|
className: h.expandedItems,
|
|
135
|
-
children: [
|
|
135
|
+
children: [r.map((c) => /* @__PURE__ */ e("div", {
|
|
136
136
|
className: "shrink-0 whitespace-nowrap",
|
|
137
|
-
children: /* @__PURE__ */ e(
|
|
138
|
-
item:
|
|
139
|
-
compact:
|
|
137
|
+
children: /* @__PURE__ */ e(C, {
|
|
138
|
+
item: c,
|
|
139
|
+
compact: p
|
|
140
140
|
})
|
|
141
|
-
},
|
|
141
|
+
}, c.id)), t ? /* @__PURE__ */ e("div", {
|
|
142
142
|
className: "shrink-0",
|
|
143
143
|
children: /* @__PURE__ */ e("div", {
|
|
144
144
|
ref: u,
|
|
@@ -150,12 +150,12 @@ function Q({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot
|
|
|
150
150
|
}),
|
|
151
151
|
/* @__PURE__ */ e("div", {
|
|
152
152
|
className: h.chevron,
|
|
153
|
-
children: n ? /* @__PURE__ */ e(
|
|
153
|
+
children: n ? /* @__PURE__ */ e(O, { className: "size-6" }) : /* @__PURE__ */ e(F, { className: "size-6" })
|
|
154
154
|
}),
|
|
155
155
|
/* @__PURE__ */ e("div", {
|
|
156
156
|
"aria-hidden": !0,
|
|
157
157
|
className: h.measureLayer,
|
|
158
|
-
children: /* @__PURE__ */
|
|
158
|
+
children: /* @__PURE__ */ k("div", {
|
|
159
159
|
className: h.measureRow,
|
|
160
160
|
children: [
|
|
161
161
|
s ? /* @__PURE__ */ e("div", {
|
|
@@ -165,14 +165,14 @@ function Q({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot
|
|
|
165
165
|
children: s
|
|
166
166
|
})
|
|
167
167
|
}) : null,
|
|
168
|
-
|
|
169
|
-
ref: g(
|
|
168
|
+
r.map((c) => /* @__PURE__ */ e("div", {
|
|
169
|
+
ref: g(c.id),
|
|
170
170
|
className: "shrink-0 whitespace-nowrap",
|
|
171
|
-
children: /* @__PURE__ */ e(
|
|
172
|
-
item:
|
|
171
|
+
children: /* @__PURE__ */ e(C, {
|
|
172
|
+
item: c,
|
|
173
173
|
compact: !0
|
|
174
174
|
})
|
|
175
|
-
},
|
|
175
|
+
}, c.id)),
|
|
176
176
|
t ? /* @__PURE__ */ e("div", {
|
|
177
177
|
className: "shrink-0",
|
|
178
178
|
children: /* @__PURE__ */ e("div", {
|
|
@@ -187,5 +187,5 @@ function Q({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
export {
|
|
190
|
-
|
|
190
|
+
Y as PathfinderCard
|
|
191
191
|
};
|