mcr-design-systems 1.0.19 → 1.0.20
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,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, Fragment as te, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import { Root as re, Trigger as ae, Portal as ne, Content as le, Label as L, Separator as T } from "../../node_modules/@radix-ui/react-dropdown-menu/dist/index.js";
|
|
4
4
|
import { useVirtualizer as oe } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
@@ -31,43 +31,43 @@ const ce = s.forwardRef(
|
|
|
31
31
|
variant: q,
|
|
32
32
|
fullWidth: B,
|
|
33
33
|
state: G,
|
|
34
|
-
enableVirtualization:
|
|
34
|
+
enableVirtualization: m,
|
|
35
35
|
itemHeight: J = 40,
|
|
36
36
|
maxHeight: K = 300,
|
|
37
|
-
search:
|
|
37
|
+
search: h = !1,
|
|
38
38
|
searchPlaceholder: O = "Search...",
|
|
39
39
|
onSearchChange: z,
|
|
40
40
|
width: b,
|
|
41
41
|
...Q
|
|
42
42
|
}, U) => {
|
|
43
|
-
const n = ie({ size: S, variant: q, fullWidth: B, state: G }), d = s.useMemo(() =>
|
|
43
|
+
const n = ie({ size: S, variant: q, fullWidth: B, state: G }), d = s.useMemo(() => m !== void 0 ? m : c === void 0 ? (console.warn(
|
|
44
44
|
"Dropdown is not open, virtualization will not be applied. Please ensure the dropdown is open when using virtualization."
|
|
45
|
-
), !1) : a.reduce((t, l) => t + ("items" in l ? l.items.length : 1), 0) > 50, [
|
|
45
|
+
), !1) : a.reduce((t, l) => t + ("items" in l ? l.items.length : 1), 0) > 50, [m, a, c]), u = s.useMemo(() => {
|
|
46
46
|
if (!d) return [];
|
|
47
47
|
const e = [];
|
|
48
48
|
let t = 0;
|
|
49
|
-
return a.forEach((l,
|
|
49
|
+
return a.forEach((l, p) => {
|
|
50
50
|
"items" in l ? (l.label && e.push({
|
|
51
51
|
type: "group-label",
|
|
52
52
|
groupLabel: l.label,
|
|
53
53
|
index: t++,
|
|
54
|
-
key: `group-label-${
|
|
54
|
+
key: `group-label-${p}`
|
|
55
55
|
}), l.items.forEach((_, ee) => {
|
|
56
56
|
e.push({
|
|
57
57
|
type: "item",
|
|
58
58
|
data: _,
|
|
59
59
|
index: t++,
|
|
60
|
-
key: `group-${
|
|
60
|
+
key: `group-${p}-item-${ee}`
|
|
61
61
|
});
|
|
62
|
-
}),
|
|
62
|
+
}), p < a.length - 1 && e.push({
|
|
63
63
|
type: "separator",
|
|
64
64
|
index: t++,
|
|
65
|
-
key: `separator-${
|
|
65
|
+
key: `separator-${p}`
|
|
66
66
|
})) : e.push({
|
|
67
67
|
type: "item",
|
|
68
68
|
data: l,
|
|
69
69
|
index: t++,
|
|
70
|
-
key: `item-${
|
|
70
|
+
key: `item-${p}`
|
|
71
71
|
});
|
|
72
72
|
}), e;
|
|
73
73
|
}, [d, a]), y = s.useRef(null), g = oe({
|
|
@@ -124,7 +124,7 @@ const ce = s.forwardRef(
|
|
|
124
124
|
default:
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
}, X = () => H ? /* @__PURE__ */
|
|
127
|
+
}, X = () => H ? /* @__PURE__ */ f("div", { className: n.emptyState(), children: [
|
|
128
128
|
/* @__PURE__ */ r(k, { name: "loading-01", size: 16, className: "animate-spin mr-2" }),
|
|
129
129
|
"Loading..."
|
|
130
130
|
] }) : a.length === 0 ? /* @__PURE__ */ r("div", { className: n.emptyState(), children: Y }) : d && u.length > 0 ? /* @__PURE__ */ r(
|
|
@@ -154,11 +154,11 @@ const ce = s.forwardRef(
|
|
|
154
154
|
) : null;
|
|
155
155
|
})
|
|
156
156
|
}
|
|
157
|
-
) : a.map((e, t) => "items" in e ? /* @__PURE__ */
|
|
157
|
+
) : a.map((e, t) => "items" in e ? /* @__PURE__ */ f(s.Fragment, { children: [
|
|
158
158
|
e.label && /* @__PURE__ */ r(L, { className: n.label(), children: e.label }),
|
|
159
159
|
e.items.map(v),
|
|
160
160
|
t < a.length - 1 && /* @__PURE__ */ r(T, { className: n.separator() })
|
|
161
|
-
] }, `group-${t}`) : v(e)), Z = /* @__PURE__ */
|
|
161
|
+
] }, `group-${t}`) : v(e)), Z = /* @__PURE__ */ f(te, { children: [
|
|
162
162
|
/* @__PURE__ */ r(
|
|
163
163
|
"span",
|
|
164
164
|
{
|
|
@@ -171,9 +171,9 @@ const ce = s.forwardRef(
|
|
|
171
171
|
),
|
|
172
172
|
/* @__PURE__ */ r(k, { name: "chevron-down", size: 16, className: n.chevron() })
|
|
173
173
|
] });
|
|
174
|
-
return
|
|
174
|
+
return m && c === void 0 ? (console.error(
|
|
175
175
|
"Virtualization is enabled but the dropdown is not open. Please ensure the dropdown is open when using virtualization."
|
|
176
|
-
), null) : /* @__PURE__ */
|
|
176
|
+
), null) : /* @__PURE__ */ f(
|
|
177
177
|
re,
|
|
178
178
|
{
|
|
179
179
|
open: c,
|
|
@@ -193,10 +193,10 @@ const ce = s.forwardRef(
|
|
|
193
193
|
children: F || D || Z
|
|
194
194
|
}
|
|
195
195
|
),
|
|
196
|
-
/* @__PURE__ */ r(ne, { children: /* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ r(ne, { children: /* @__PURE__ */ f(
|
|
197
197
|
le,
|
|
198
198
|
{
|
|
199
|
-
className: n.content({ search:
|
|
199
|
+
className: n.content({ search: h }),
|
|
200
200
|
side: j,
|
|
201
201
|
align: A,
|
|
202
202
|
sideOffset: I,
|
|
@@ -205,7 +205,7 @@ const ce = s.forwardRef(
|
|
|
205
205
|
},
|
|
206
206
|
...i && R(`${i}-content`),
|
|
207
207
|
children: [
|
|
208
|
-
|
|
208
|
+
h && /* @__PURE__ */ r("div", { className: "px-xs-3 py-xs-3", children: /* @__PURE__ */ r(
|
|
209
209
|
"input",
|
|
210
210
|
{
|
|
211
211
|
autoFocus: !0,
|
|
@@ -221,11 +221,9 @@ const ce = s.forwardRef(
|
|
|
221
221
|
"div",
|
|
222
222
|
{
|
|
223
223
|
ref: y,
|
|
224
|
-
className: w("overflow-auto",
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
style: { maxHeight: `${K - (p ? 46 : 0)}px` },
|
|
228
|
-
"data-search": p ? "true" : "false",
|
|
224
|
+
className: w("overflow-auto p-xs-3"),
|
|
225
|
+
style: { maxHeight: `${K - (h ? 46 : 0)}px` },
|
|
226
|
+
"data-search": h ? "true" : "false",
|
|
229
227
|
children: X()
|
|
230
228
|
}
|
|
231
229
|
)
|
|
@@ -34,7 +34,8 @@ const s = e(
|
|
|
34
34
|
"data-[disabled]:opacity-50",
|
|
35
35
|
"data-[disabled]:cursor-not-allowed",
|
|
36
36
|
"data-[disabled]:pointer-events-none",
|
|
37
|
-
"data-[disabled]:text-fg-neutral-disabled"
|
|
37
|
+
"data-[disabled]:text-fg-neutral-disabled",
|
|
38
|
+
"rounded-sm"
|
|
38
39
|
],
|
|
39
40
|
indicator: [
|
|
40
41
|
"absolute",
|