@stackone/malachite 2.86.0 → 2.88.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/COMPONENTS.md +5 -4
- package/dist/components/Accordion.js +206 -179
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Button.js +118 -81
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +128 -75
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Chat/ChatModelPicker.js +70 -67
- package/dist/components/Chat/ChatModelPicker.js.map +1 -1
- package/dist/components/FilterSearch.js +237 -232
- package/dist/components/FilterSearch.js.map +1 -1
- package/dist/components/FrameHeader.js +36 -0
- package/dist/components/FrameHeader.js.map +1 -0
- package/dist/components/LoadingBar.js +5 -5
- package/dist/components/LoadingBar.js.map +1 -1
- package/dist/components/MultiSelect.js +438 -388
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/PinnedCornerCap.js +32 -19
- package/dist/components/PinnedCornerCap.js.map +1 -1
- package/dist/components/QueryInput.js +95 -92
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/SplitButton.js +62 -61
- package/dist/components/SplitButton.js.map +1 -1
- package/dist/components/Surface.js +98 -94
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +630 -606
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
- package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
- package/dist/components/TimeBarChart/stackLayout.js +25 -0
- package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
- package/dist/components/TimeBarChart/timeBuckets.js +133 -0
- package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
- package/dist/components/TimeBarChart/tones.js +10 -0
- package/dist/components/TimeBarChart/tones.js.map +1 -0
- package/dist/components/Tooltip.js +93 -90
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/activeElement.js +5 -1
- package/dist/components/activeElement.js.map +1 -1
- package/dist/components/dateMath.js +1 -0
- package/dist/components/dateMath.js.map +1 -1
- package/dist/components/filterSearchModel.js +53 -45
- package/dist/components/filterSearchModel.js.map +1 -1
- package/dist/components/frameStyles.js +14 -0
- package/dist/components/frameStyles.js.map +1 -0
- package/dist/components/headerContent.js +10 -0
- package/dist/components/headerContent.js.map +1 -0
- package/dist/components/useFollowTrigger.js +28 -0
- package/dist/components/useFollowTrigger.js.map +1 -0
- package/dist/index.d.ts +131 -9
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +340 -340
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,82 +1,86 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
1
|
+
import { jsx as r, jsxs as I, Fragment as je } from "react/jsx-runtime";
|
|
2
|
+
import pe, { useId as Ve, useState as $, useRef as k, useMemo as W, useCallback as x, useEffect as Be, useLayoutEffect as It, useInsertionEffect as Et } from "react";
|
|
3
|
+
import { createPortal as St } from "react-dom";
|
|
4
|
+
import Tt, { useFormFieldIds as kt } from "./BaseFormComponent.js";
|
|
5
|
+
import Rt from "./CustomIcons/CaretDownIcon.js";
|
|
6
|
+
import _t from "./CustomIcons/InfoFilledIcon.js";
|
|
7
|
+
import Lt from "./CustomIcons/SearchIcon.js";
|
|
8
|
+
import { FieldMessage as Ot } from "./FieldMessage.js";
|
|
9
|
+
import { FormItem as Nt } from "./FormItem.js";
|
|
10
|
+
import Ge from "./LoadingInput.js";
|
|
11
|
+
import At from "./Spinner.js";
|
|
12
|
+
import { Tag as Mt } from "./Tag.js";
|
|
13
|
+
import ze from "./Tooltip.js";
|
|
14
|
+
import { getDeepActiveNode as Ke } from "./activeElement.js";
|
|
15
|
+
import { CONTROL_TEXT_SIZE_CLASS as me, CONTROL_TEXT_SIZE as Dt } from "./controlTextSize.js";
|
|
16
|
+
import { controlWidthStyle as Ye } from "./controlWidth.js";
|
|
17
|
+
import { getTriggerVisual as Ht, DROPDOWN_TRIGGER_ATTR as Ct } from "./dropdownTriggerStyle.js";
|
|
18
|
+
import { pushEscapeLayer as Pt } from "./escapeLayers.js";
|
|
19
|
+
import { measureMenuGeometry as Wt, MENU_MAX_HEIGHT_PX as $t, MENU_SPECS as F } from "./floatingMenuGeometry.js";
|
|
20
|
+
import { FOCUS_RING as Bt } from "./focusRing.js";
|
|
21
|
+
import { hasBadge as Gt } from "./hasBadge.js";
|
|
22
|
+
import { ensureMultiSelectPanelStyles as zt } from "./optionRowStyles.js";
|
|
23
|
+
import { usePopupLayer as Kt } from "./overlayLayers.js";
|
|
24
|
+
import { useTopLayer as Yt } from "./topLayer.js";
|
|
25
|
+
import { tooltipLines as Ft, isCut as Ut, isClamped as jt } from "./truncatedLines.js";
|
|
26
|
+
import { useFollowTrigger as Vt } from "./useFollowTrigger.js";
|
|
27
|
+
import { useLatestRef as Xt } from "./useLatestRef.js";
|
|
28
|
+
const qt = pe.lazy(() => import("./ActionMenuTagHost.js")), Zt = {
|
|
25
29
|
padding: "8px 10px",
|
|
26
30
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
|
|
27
|
-
},
|
|
31
|
+
}, U = {
|
|
28
32
|
small: "h-[var(--malachite-control-height-small,28px)]",
|
|
29
33
|
medium: "h-[var(--malachite-control-height-medium,32px)]",
|
|
30
34
|
large: "h-[var(--malachite-control-height-large,42px)]"
|
|
31
|
-
},
|
|
32
|
-
small: `${
|
|
33
|
-
medium: `${
|
|
34
|
-
large: `${
|
|
35
|
-
},
|
|
36
|
-
({ triggerRole: n, disabled:
|
|
35
|
+
}, Jt = {
|
|
36
|
+
small: `${U.small} gap-[6px] px-2.5 ${me.small} rounded-[var(--malachite-radius-10,10px)]`,
|
|
37
|
+
medium: `${U.medium} gap-[8px] px-3 ${me.medium} rounded-xl`,
|
|
38
|
+
large: `${U.large} gap-[10px] px-4 ${me.large} rounded-[var(--malachite-radius-xxl,14px)]`
|
|
39
|
+
}, Qt = 10, Xe = "ArrowDown", qe = "ArrowUp", Ze = "Enter", er = "Backspace", tr = /* @__PURE__ */ new Set([Xe, qe, Ze]), Je = pe.forwardRef(
|
|
40
|
+
({ triggerRole: n, disabled: y, children: E, ...s }, b) => n !== "button" ? /* @__PURE__ */ r(
|
|
37
41
|
"div",
|
|
38
42
|
{
|
|
39
43
|
ref: b,
|
|
40
44
|
role: n,
|
|
41
|
-
tabIndex:
|
|
42
|
-
...
|
|
43
|
-
children:
|
|
45
|
+
tabIndex: y ? -1 : 0,
|
|
46
|
+
...s,
|
|
47
|
+
children: E
|
|
44
48
|
}
|
|
45
49
|
) : /* @__PURE__ */ r(
|
|
46
50
|
"button",
|
|
47
51
|
{
|
|
48
52
|
ref: b,
|
|
49
53
|
type: "button",
|
|
50
|
-
disabled:
|
|
51
|
-
...
|
|
52
|
-
children:
|
|
54
|
+
disabled: y,
|
|
55
|
+
...s,
|
|
56
|
+
children: E
|
|
53
57
|
}
|
|
54
58
|
)
|
|
55
59
|
);
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
return !
|
|
61
|
-
},
|
|
62
|
-
|
|
60
|
+
Je.displayName = "TriggerElement";
|
|
61
|
+
const Fe = 0.6, Ue = 420, rr = ({ option: n }) => {
|
|
62
|
+
const y = k(null), E = k(null), s = n.description ? n.descriptionMode ?? "icon" : null, b = s === "subtitle", [R, B] = $({ label: !0, subtitle: !0 }), O = () => {
|
|
63
|
+
const v = Ut(y.current), i = jt(E.current);
|
|
64
|
+
return !v && !i && s !== "hover" ? !1 : (B({ label: v, subtitle: i }), !0);
|
|
65
|
+
}, _ = s === "hover" || b && R.subtitle, M = (v) => /* @__PURE__ */ r(
|
|
66
|
+
ze,
|
|
63
67
|
{
|
|
64
|
-
text:
|
|
65
|
-
["label",
|
|
66
|
-
["description",
|
|
68
|
+
text: Ft([
|
|
69
|
+
["label", R.label && n.label],
|
|
70
|
+
["description", _ && n.description]
|
|
67
71
|
]),
|
|
68
|
-
shouldShow:
|
|
69
|
-
delay:
|
|
70
|
-
maxWidth:
|
|
72
|
+
shouldShow: O,
|
|
73
|
+
delay: Fe,
|
|
74
|
+
maxWidth: Ue,
|
|
71
75
|
triggerAs: "span",
|
|
72
76
|
isShrinkable: !0,
|
|
73
|
-
describesTrigger:
|
|
74
|
-
children:
|
|
77
|
+
describesTrigger: s === "hover",
|
|
78
|
+
children: v
|
|
75
79
|
}
|
|
76
|
-
),
|
|
80
|
+
), d = /* @__PURE__ */ r(
|
|
77
81
|
"span",
|
|
78
82
|
{
|
|
79
|
-
ref:
|
|
83
|
+
ref: y,
|
|
80
84
|
style: {
|
|
81
85
|
display: "block",
|
|
82
86
|
overflow: "hidden",
|
|
@@ -86,8 +90,8 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
86
90
|
children: n.label
|
|
87
91
|
}
|
|
88
92
|
);
|
|
89
|
-
return b ?
|
|
90
|
-
/* @__PURE__ */
|
|
93
|
+
return b ? M(
|
|
94
|
+
/* @__PURE__ */ I(
|
|
91
95
|
"span",
|
|
92
96
|
{
|
|
93
97
|
style: {
|
|
@@ -99,11 +103,11 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
99
103
|
gap: 2
|
|
100
104
|
},
|
|
101
105
|
children: [
|
|
102
|
-
|
|
106
|
+
d,
|
|
103
107
|
/* @__PURE__ */ r(
|
|
104
108
|
"span",
|
|
105
109
|
{
|
|
106
|
-
ref:
|
|
110
|
+
ref: E,
|
|
107
111
|
style: {
|
|
108
112
|
fontSize: 12,
|
|
109
113
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
@@ -122,7 +126,7 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
122
126
|
]
|
|
123
127
|
}
|
|
124
128
|
)
|
|
125
|
-
) : /* @__PURE__ */
|
|
129
|
+
) : /* @__PURE__ */ I(
|
|
126
130
|
"span",
|
|
127
131
|
{
|
|
128
132
|
style: {
|
|
@@ -133,13 +137,13 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
133
137
|
gap: 6
|
|
134
138
|
},
|
|
135
139
|
children: [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
M(d),
|
|
141
|
+
s === "icon" && /* @__PURE__ */ r(
|
|
142
|
+
ze,
|
|
139
143
|
{
|
|
140
144
|
text: n.description,
|
|
141
|
-
delay:
|
|
142
|
-
maxWidth:
|
|
145
|
+
delay: Fe,
|
|
146
|
+
maxWidth: Ue,
|
|
143
147
|
children: /* @__PURE__ */ r(
|
|
144
148
|
"span",
|
|
145
149
|
{
|
|
@@ -148,8 +152,8 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
148
152
|
color: "var(--malachite-text-placeholder, rgb(187, 187, 187))"
|
|
149
153
|
},
|
|
150
154
|
"aria-label": "More information",
|
|
151
|
-
onClick: (
|
|
152
|
-
children: n.descriptionIcon ?? /* @__PURE__ */ r(
|
|
155
|
+
onClick: (v) => v.stopPropagation(),
|
|
156
|
+
children: n.descriptionIcon ?? /* @__PURE__ */ r(_t, { size: 14 })
|
|
153
157
|
}
|
|
154
158
|
)
|
|
155
159
|
}
|
|
@@ -157,375 +161,393 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
157
161
|
]
|
|
158
162
|
}
|
|
159
163
|
);
|
|
160
|
-
},
|
|
164
|
+
}, Qe = ({
|
|
161
165
|
options: n,
|
|
162
|
-
value:
|
|
163
|
-
defaultValue:
|
|
164
|
-
onChange:
|
|
166
|
+
value: y,
|
|
167
|
+
defaultValue: E,
|
|
168
|
+
onChange: s,
|
|
165
169
|
placeholder: b = "Select",
|
|
166
|
-
renderTrigger:
|
|
167
|
-
searchable:
|
|
168
|
-
size:
|
|
169
|
-
width:
|
|
170
|
-
minWidth:
|
|
171
|
-
disabled:
|
|
172
|
-
error:
|
|
173
|
-
loading:
|
|
174
|
-
label:
|
|
175
|
-
name:
|
|
176
|
-
description:
|
|
177
|
-
tooltip:
|
|
178
|
-
hint:
|
|
179
|
-
hintIcon:
|
|
180
|
-
rightSideContent:
|
|
181
|
-
required:
|
|
182
|
-
requiredIndicator:
|
|
183
|
-
formControl:
|
|
184
|
-
chips:
|
|
185
|
-
chipsRemovable:
|
|
186
|
-
chipsMax:
|
|
187
|
-
inlineSearch:
|
|
188
|
-
onSearchChange:
|
|
189
|
-
localFilter:
|
|
190
|
-
className:
|
|
191
|
-
style:
|
|
192
|
-
id:
|
|
193
|
-
"aria-label":
|
|
194
|
-
"aria-labelledby":
|
|
170
|
+
renderTrigger: R,
|
|
171
|
+
searchable: B,
|
|
172
|
+
size: O = "large",
|
|
173
|
+
width: _ = "auto",
|
|
174
|
+
minWidth: M,
|
|
175
|
+
disabled: d = !1,
|
|
176
|
+
error: v = !1,
|
|
177
|
+
loading: i = !1,
|
|
178
|
+
label: j,
|
|
179
|
+
name: he,
|
|
180
|
+
description: Q,
|
|
181
|
+
tooltip: ge,
|
|
182
|
+
hint: ee,
|
|
183
|
+
hintIcon: et,
|
|
184
|
+
rightSideContent: be,
|
|
185
|
+
required: te = !1,
|
|
186
|
+
requiredIndicator: tt,
|
|
187
|
+
formControl: ve,
|
|
188
|
+
chips: re = !1,
|
|
189
|
+
chipsRemovable: ne = !0,
|
|
190
|
+
chipsMax: xe = "auto",
|
|
191
|
+
inlineSearch: S = !1,
|
|
192
|
+
onSearchChange: G,
|
|
193
|
+
localFilter: ye = !0,
|
|
194
|
+
className: rt = "",
|
|
195
|
+
style: nt,
|
|
196
|
+
id: ot,
|
|
197
|
+
"aria-label": we,
|
|
198
|
+
"aria-labelledby": at,
|
|
199
|
+
errorMessageId: lt,
|
|
200
|
+
onFieldLeave: st
|
|
195
201
|
}) => {
|
|
196
|
-
const
|
|
197
|
-
id:
|
|
198
|
-
label:
|
|
199
|
-
description:
|
|
200
|
-
hint:
|
|
201
|
-
}), [
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
() => n.filter((e) =>
|
|
205
|
-
[n,
|
|
206
|
-
),
|
|
207
|
-
if (!
|
|
208
|
-
const e =
|
|
202
|
+
const Ie = Ve(), Ee = `${Ie}-listbox`, Se = (e) => `${Ie}-option-${e}`, { controlId: Te, labelId: ke, descriptionId: it, hintId: ct, describedBy: dt } = kt({
|
|
203
|
+
id: ot,
|
|
204
|
+
label: j,
|
|
205
|
+
description: Q,
|
|
206
|
+
hint: ee
|
|
207
|
+
}), [ut, ft] = $(() => E ?? []), oe = y !== void 0, h = oe ? y : ut, [l, ae] = $(!1), [m, Re] = $(null), [N, mt] = $(""), [T, P] = $(-1), z = k(null), le = k(null), D = Xt(st), K = k(null), A = k(null), _e = k(null);
|
|
208
|
+
Yt(A, l);
|
|
209
|
+
const pt = Kt("multiselect", l, A), Le = k([]), se = W(() => new Set(h), [h]), c = W(
|
|
210
|
+
() => n.filter((e) => se.has(e.value)),
|
|
211
|
+
[n, se]
|
|
212
|
+
), ie = typeof xe == "number" ? xe : void 0, H = W(() => {
|
|
213
|
+
if (!ye) return n;
|
|
214
|
+
const e = N.trim().toLowerCase();
|
|
209
215
|
return e ? n.filter((t) => (t.searchText ?? (typeof t.label == "string" ? t.label : "")).toLowerCase().includes(e)) : n;
|
|
210
|
-
}, [n,
|
|
216
|
+
}, [n, N, ye]), ce = k(!1), Oe = k(""), V = x(
|
|
211
217
|
(e, t) => {
|
|
212
|
-
|
|
218
|
+
Oe.current !== e && (Oe.current = e, t && (ce.current = !0), mt(e), G == null || G(e));
|
|
213
219
|
},
|
|
214
|
-
[
|
|
215
|
-
),
|
|
216
|
-
(e) =>
|
|
217
|
-
[
|
|
218
|
-
),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}, [
|
|
222
|
-
const
|
|
223
|
-
var e, t;
|
|
224
|
-
|
|
225
|
-
}, []),
|
|
226
|
-
const e =
|
|
220
|
+
[G]
|
|
221
|
+
), de = x(
|
|
222
|
+
(e) => V(e, !0),
|
|
223
|
+
[V]
|
|
224
|
+
), Y = x(() => V("", !1), [V]);
|
|
225
|
+
Be(() => {
|
|
226
|
+
ce.current && (P(-1), ce.current = !1);
|
|
227
|
+
}, [N]);
|
|
228
|
+
const ht = B ?? (G !== void 0 || n.length > Qt), Ne = S ? !1 : ht, X = x(() => {
|
|
229
|
+
var e, t, o, u;
|
|
230
|
+
ae(!1), (e = A.current) != null && e.contains(Ke()) && ((t = z.current) == null || t.focus({ preventScroll: !0 })), (o = le.current) != null && o.contains(Ke()) || (u = D.current) == null || u.call(D);
|
|
231
|
+
}, [D]), C = x(() => {
|
|
232
|
+
const e = z.current;
|
|
227
233
|
if (!e) return;
|
|
228
|
-
const t =
|
|
234
|
+
const t = Wt(A.current, {
|
|
229
235
|
triggerRect: e.getBoundingClientRect(),
|
|
230
236
|
preset: "standard",
|
|
231
|
-
minWidth:
|
|
237
|
+
minWidth: M,
|
|
232
238
|
viewportWidth: window.innerWidth,
|
|
233
239
|
viewportHeight: window.innerHeight
|
|
234
240
|
});
|
|
235
|
-
|
|
236
|
-
}, [
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
if (!
|
|
240
|
-
|
|
241
|
+
Re(t);
|
|
242
|
+
}, [M]);
|
|
243
|
+
Vt(l, z, C, X), Be(() => {
|
|
244
|
+
var u;
|
|
245
|
+
if (!l) {
|
|
246
|
+
Y(), P(-1), Re(null);
|
|
241
247
|
return;
|
|
242
248
|
}
|
|
243
|
-
|
|
244
|
-
const e = () =>
|
|
245
|
-
const
|
|
246
|
-
(!a || !
|
|
247
|
-
},
|
|
248
|
-
return window.addEventListener("
|
|
249
|
-
window.removeEventListener("
|
|
249
|
+
C(), S && ((u = K.current) == null || u.focus());
|
|
250
|
+
const e = () => C(), t = (g) => {
|
|
251
|
+
const p = g.composedPath(), a = z.current, f = A.current;
|
|
252
|
+
(!a || !p.includes(a)) && (!f || !p.includes(f)) && X();
|
|
253
|
+
}, o = Pt(X);
|
|
254
|
+
return window.addEventListener("resize", e), document.addEventListener("mousedown", t), () => {
|
|
255
|
+
window.removeEventListener("resize", e), document.removeEventListener("mousedown", t), o();
|
|
250
256
|
};
|
|
251
|
-
}, [
|
|
252
|
-
if (!
|
|
257
|
+
}, [l, C, S, Y, X]), It(() => {
|
|
258
|
+
if (!l)
|
|
253
259
|
return;
|
|
254
|
-
|
|
255
|
-
const e =
|
|
260
|
+
C();
|
|
261
|
+
const e = A.current;
|
|
256
262
|
if (!e || typeof ResizeObserver > "u")
|
|
257
263
|
return;
|
|
258
|
-
const t = new ResizeObserver(() =>
|
|
264
|
+
const t = new ResizeObserver(() => C());
|
|
259
265
|
return t.observe(e), () => t.disconnect();
|
|
260
|
-
}, [
|
|
261
|
-
const
|
|
266
|
+
}, [l, C]);
|
|
267
|
+
const L = x(
|
|
262
268
|
(e) => {
|
|
263
|
-
|
|
269
|
+
oe || ft(e), s == null || s(e);
|
|
264
270
|
},
|
|
265
|
-
[
|
|
266
|
-
),
|
|
271
|
+
[oe, s]
|
|
272
|
+
), q = x(
|
|
267
273
|
(e) => n.some((t) => t.value === e && t.disabled),
|
|
268
274
|
[n]
|
|
269
|
-
),
|
|
275
|
+
), ue = x(
|
|
270
276
|
(e) => {
|
|
271
|
-
|
|
277
|
+
q(e) || (h.includes(e) ? L(h.filter((t) => t !== e)) : L([...h, e]));
|
|
272
278
|
},
|
|
273
|
-
[
|
|
274
|
-
),
|
|
279
|
+
[h, L, q]
|
|
280
|
+
), Z = W(() => {
|
|
275
281
|
const e = /* @__PURE__ */ new Set();
|
|
276
282
|
for (const t of n)
|
|
277
283
|
t.disabled && e.add(t.value);
|
|
278
284
|
return e;
|
|
279
|
-
}, [n]),
|
|
285
|
+
}, [n]), gt = x(
|
|
280
286
|
(e) => {
|
|
281
287
|
e.stopPropagation();
|
|
282
|
-
const t =
|
|
283
|
-
|
|
288
|
+
const t = h.filter((o) => Z.has(o));
|
|
289
|
+
L(t);
|
|
284
290
|
},
|
|
285
|
-
[
|
|
286
|
-
),
|
|
291
|
+
[L, h, Z]
|
|
292
|
+
), Ae = x(
|
|
287
293
|
(e, t) => {
|
|
288
|
-
t.stopPropagation(), !
|
|
294
|
+
t.stopPropagation(), !q(e) && L(h.filter((o) => o !== e));
|
|
289
295
|
},
|
|
290
|
-
[
|
|
291
|
-
),
|
|
296
|
+
[h, L, q]
|
|
297
|
+
), J = x(
|
|
292
298
|
(e) => {
|
|
293
|
-
if (!
|
|
294
|
-
if (e.preventDefault(), e.stopPropagation(), !
|
|
295
|
-
|
|
299
|
+
if (!tr.has(e.key)) return;
|
|
300
|
+
if (e.preventDefault(), e.stopPropagation(), !l) {
|
|
301
|
+
ae(!0);
|
|
296
302
|
return;
|
|
297
303
|
}
|
|
298
|
-
const t =
|
|
304
|
+
const t = H.length;
|
|
299
305
|
if (t === 0) return;
|
|
300
|
-
const
|
|
306
|
+
const o = (p) => {
|
|
301
307
|
requestAnimationFrame(() => {
|
|
302
|
-
const a = Le.current[
|
|
303
|
-
if (!a || !
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
top:
|
|
308
|
+
const a = Le.current[p], f = _e.current;
|
|
309
|
+
if (!a || !f) return;
|
|
310
|
+
const w = a.offsetTop, We = w + a.offsetHeight, $e = f.scrollTop, wt = $e + f.clientHeight;
|
|
311
|
+
We > wt ? f.scrollTo({
|
|
312
|
+
top: We - f.clientHeight,
|
|
307
313
|
behavior: "smooth"
|
|
308
|
-
}) :
|
|
314
|
+
}) : w < $e && f.scrollTo({ top: w, behavior: "smooth" });
|
|
309
315
|
});
|
|
310
|
-
},
|
|
311
|
-
var
|
|
312
|
-
let a =
|
|
313
|
-
for (let
|
|
314
|
-
if (a =
|
|
315
|
-
|
|
316
|
+
}, u = (p) => {
|
|
317
|
+
var f;
|
|
318
|
+
let a = T;
|
|
319
|
+
for (let w = 0; w < t; w++)
|
|
320
|
+
if (a = p === 1 ? a < t - 1 ? a + 1 : 0 : a > 0 ? a - 1 : t - 1, !((f = H[a]) != null && f.disabled)) {
|
|
321
|
+
o(a), P(a);
|
|
316
322
|
return;
|
|
317
323
|
}
|
|
318
|
-
},
|
|
319
|
-
var
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
const a = n.findIndex((
|
|
324
|
-
|
|
325
|
-
var
|
|
326
|
-
return (
|
|
324
|
+
}, g = () => {
|
|
325
|
+
var f;
|
|
326
|
+
if (T < 0 || T >= t || (f = H[T]) != null && f.disabled) return;
|
|
327
|
+
const p = H[T].value;
|
|
328
|
+
ue(p), Y();
|
|
329
|
+
const a = n.findIndex((w) => w.value === p);
|
|
330
|
+
P(a >= 0 ? a : -1), o(a >= 0 ? a : 0), requestAnimationFrame(() => {
|
|
331
|
+
var w;
|
|
332
|
+
return (w = K.current) == null ? void 0 : w.focus();
|
|
327
333
|
});
|
|
328
334
|
};
|
|
329
335
|
switch (e.key) {
|
|
330
|
-
case
|
|
331
|
-
|
|
336
|
+
case Xe:
|
|
337
|
+
u(1);
|
|
332
338
|
break;
|
|
333
|
-
case
|
|
334
|
-
|
|
339
|
+
case qe:
|
|
340
|
+
u(-1);
|
|
335
341
|
break;
|
|
336
|
-
case
|
|
337
|
-
|
|
342
|
+
case Ze:
|
|
343
|
+
g();
|
|
338
344
|
break;
|
|
339
345
|
}
|
|
340
346
|
},
|
|
341
|
-
[
|
|
342
|
-
),
|
|
347
|
+
[l, H, T, ue, n, Y]
|
|
348
|
+
), Me = x(
|
|
343
349
|
(e) => {
|
|
344
|
-
if (e.key ===
|
|
345
|
-
e.preventDefault(),
|
|
350
|
+
if (e.key === er && N === "" && h.length > 0) {
|
|
351
|
+
e.preventDefault(), L(h.slice(0, -1)), requestAnimationFrame(() => {
|
|
346
352
|
var t;
|
|
347
|
-
return (t =
|
|
353
|
+
return (t = K.current) == null ? void 0 : t.focus();
|
|
348
354
|
});
|
|
349
355
|
return;
|
|
350
356
|
}
|
|
351
|
-
|
|
357
|
+
J(e);
|
|
352
358
|
},
|
|
353
|
-
[
|
|
354
|
-
),
|
|
355
|
-
disabled:
|
|
356
|
-
error:
|
|
357
|
-
open:
|
|
358
|
-
loading:
|
|
359
|
-
hasSelection:
|
|
360
|
-
}),
|
|
359
|
+
[J, N, h, L]
|
|
360
|
+
), De = c.length > 0 && !d && !i, bt = Ht({
|
|
361
|
+
disabled: d,
|
|
362
|
+
error: v,
|
|
363
|
+
open: l,
|
|
364
|
+
loading: i,
|
|
365
|
+
hasSelection: c.length > 0
|
|
366
|
+
}), fe = W(() => S ? /* @__PURE__ */ r(
|
|
361
367
|
"input",
|
|
362
368
|
{
|
|
363
|
-
ref:
|
|
369
|
+
ref: K,
|
|
364
370
|
type: "text",
|
|
365
|
-
value:
|
|
366
|
-
onChange: (e) =>
|
|
367
|
-
onKeyDown:
|
|
368
|
-
disabled:
|
|
369
|
-
placeholder:
|
|
371
|
+
value: N,
|
|
372
|
+
onChange: (e) => de(e.target.value),
|
|
373
|
+
onKeyDown: Me,
|
|
374
|
+
disabled: d || i,
|
|
375
|
+
placeholder: c.length === 0 ? b : "",
|
|
370
376
|
className: "flex-1 w-full min-w-[40px] border-none outline-none bg-transparent text-[length:inherit] p-0 text-[var(--malachite-text-primary,rgb(10,10,10))]",
|
|
371
377
|
onMouseDown: (e) => {
|
|
372
378
|
e.preventDefault();
|
|
373
379
|
}
|
|
374
380
|
}
|
|
375
381
|
) : null, [
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
S,
|
|
383
|
+
N,
|
|
384
|
+
de,
|
|
385
|
+
Me,
|
|
386
|
+
d,
|
|
387
|
+
i,
|
|
388
|
+
c.length,
|
|
383
389
|
b
|
|
384
|
-
]),
|
|
385
|
-
if (
|
|
386
|
-
return
|
|
387
|
-
if (
|
|
388
|
-
const e =
|
|
389
|
-
return /* @__PURE__ */
|
|
390
|
+
]), vt = W(() => {
|
|
391
|
+
if (R && c.length > 0)
|
|
392
|
+
return R(c);
|
|
393
|
+
if (re && c.length > 0) {
|
|
394
|
+
const e = ie != null ? c.slice(0, ie) : c, t = c.length - e.length;
|
|
395
|
+
return /* @__PURE__ */ I(
|
|
390
396
|
"div",
|
|
391
397
|
{
|
|
392
398
|
className: "flex items-center gap-1 overflow-hidden min-w-0 flex-1",
|
|
393
399
|
style: { flexWrap: "nowrap" },
|
|
394
400
|
children: [
|
|
395
|
-
e.map((
|
|
396
|
-
const
|
|
401
|
+
e.map((o) => {
|
|
402
|
+
const u = Z.has(o.value);
|
|
397
403
|
return /* @__PURE__ */ r(
|
|
398
|
-
|
|
404
|
+
Mt,
|
|
399
405
|
{
|
|
400
|
-
value:
|
|
406
|
+
value: o.label,
|
|
401
407
|
type: "default",
|
|
402
408
|
textTransform: "none",
|
|
403
|
-
onRemove:
|
|
409
|
+
onRemove: ne && !d && !u ? (g) => Ae(o.value, g) : void 0,
|
|
404
410
|
className: "shrink-0"
|
|
405
411
|
},
|
|
406
|
-
|
|
412
|
+
o.value
|
|
407
413
|
);
|
|
408
414
|
}),
|
|
409
|
-
t > 0 && /* @__PURE__ */
|
|
415
|
+
t > 0 && /* @__PURE__ */ I("span", { className: "shrink-0 text-xs text-[var(--malachite-text-secondary,rgb(123,123,123))]", children: [
|
|
410
416
|
"+",
|
|
411
417
|
t
|
|
412
418
|
] }),
|
|
413
|
-
|
|
419
|
+
fe
|
|
414
420
|
]
|
|
415
421
|
}
|
|
416
422
|
);
|
|
417
423
|
}
|
|
418
|
-
return
|
|
424
|
+
return S && c.length === 0 ? fe : c.length === 0 ? /* @__PURE__ */ r("span", { className: "text-[var(--malachite-text-placeholder)]", children: b }) : c.length === 1 ? /* @__PURE__ */ r("span", { children: c[0].label }) : /* @__PURE__ */ r("span", { children: `${c.length} selected` });
|
|
419
425
|
}, [
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
c,
|
|
427
|
+
R,
|
|
428
|
+
re,
|
|
429
|
+
ie,
|
|
430
|
+
ne,
|
|
431
|
+
d,
|
|
432
|
+
Ae,
|
|
433
|
+
S,
|
|
434
|
+
fe,
|
|
429
435
|
b,
|
|
430
|
-
|
|
431
|
-
]),
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}, [
|
|
435
|
-
const
|
|
436
|
+
Z
|
|
437
|
+
]), xt = n.length === 0 ? "No options available" : "No results found";
|
|
438
|
+
Et(() => {
|
|
439
|
+
l && zt();
|
|
440
|
+
}, [l]);
|
|
441
|
+
const yt = {
|
|
436
442
|
position: "fixed",
|
|
437
|
-
top: (
|
|
438
|
-
left: (
|
|
439
|
-
width:
|
|
440
|
-
background:
|
|
441
|
-
border:
|
|
442
|
-
borderRadius:
|
|
443
|
-
boxShadow:
|
|
444
|
-
padding:
|
|
443
|
+
top: (m == null ? void 0 : m.top) ?? 0,
|
|
444
|
+
left: (m == null ? void 0 : m.left) ?? 0,
|
|
445
|
+
width: m == null ? void 0 : m.width,
|
|
446
|
+
background: F.standard.background,
|
|
447
|
+
border: F.standard.border,
|
|
448
|
+
borderRadius: F.standard.radius,
|
|
449
|
+
boxShadow: F.standard.shadow,
|
|
450
|
+
padding: F.standard.padding,
|
|
445
451
|
display: "flex",
|
|
446
452
|
flexDirection: "column",
|
|
447
453
|
gap: 4,
|
|
448
|
-
maxHeight: (
|
|
449
|
-
fontSize:
|
|
450
|
-
visibility:
|
|
451
|
-
opacity:
|
|
452
|
-
},
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
"
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
454
|
+
maxHeight: (m == null ? void 0 : m.maxHeight) ?? $t,
|
|
455
|
+
fontSize: Dt[O],
|
|
456
|
+
visibility: m ? "visible" : "hidden",
|
|
457
|
+
opacity: m ? 1 : 0
|
|
458
|
+
}, He = !!(Q || ge || ee || be || he || ve || te), Ce = He && !!j, Pe = /* @__PURE__ */ I(je, { children: [
|
|
459
|
+
/* @__PURE__ */ I(
|
|
460
|
+
"div",
|
|
461
|
+
{
|
|
462
|
+
ref: le,
|
|
463
|
+
className: "relative",
|
|
464
|
+
style: Ye(_),
|
|
465
|
+
onBlur: (e) => {
|
|
466
|
+
var o;
|
|
467
|
+
const t = e.relatedTarget;
|
|
468
|
+
t && ((o = le.current) != null && o.contains(t)) || queueMicrotask(() => {
|
|
469
|
+
var u, g;
|
|
470
|
+
t && ((u = A.current) != null && u.contains(t)) || (g = D.current) == null || g.call(D);
|
|
471
|
+
});
|
|
472
|
+
},
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ I(
|
|
475
|
+
Je,
|
|
476
|
+
{
|
|
477
|
+
ref: z,
|
|
478
|
+
id: Te,
|
|
479
|
+
triggerRole: S ? "combobox" : re && ne ? "group" : "button",
|
|
480
|
+
disabled: d || i,
|
|
481
|
+
[Ct]: "",
|
|
482
|
+
"data-open": l || void 0,
|
|
483
|
+
"aria-haspopup": "listbox",
|
|
484
|
+
"aria-expanded": l,
|
|
485
|
+
"aria-controls": l ? Ee : void 0,
|
|
486
|
+
"aria-activedescendant": S && l && T >= 0 ? Se(T) : void 0,
|
|
487
|
+
"aria-labelledby": at ?? (Ce && !we ? ke : void 0),
|
|
488
|
+
"aria-label": we ?? (Ce ? void 0 : j),
|
|
489
|
+
"aria-invalid": v || void 0,
|
|
490
|
+
"aria-required": te || void 0,
|
|
491
|
+
"aria-describedby": [dt, lt].filter(Boolean).join(" ") || void 0,
|
|
492
|
+
"aria-busy": i || void 0,
|
|
493
|
+
onClick: () => {
|
|
494
|
+
d || i || ae((e) => !e);
|
|
495
|
+
},
|
|
496
|
+
onKeyDown: J,
|
|
497
|
+
style: {
|
|
498
|
+
transition: "border-color 0.15s ease, box-shadow 0.15s ease",
|
|
499
|
+
...bt,
|
|
500
|
+
...nt
|
|
501
|
+
},
|
|
502
|
+
className: `w-full ${Jt[O]} border border-solid flex items-center font-normal text-[var(--malachite-text-primary)] ${d || i ? "cursor-not-allowed" : "cursor-pointer"} ${Bt} ${rt}`,
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ r(
|
|
505
|
+
"span",
|
|
506
|
+
{
|
|
507
|
+
className: `flex-1 min-w-0 text-left ${S ? "flex" : "truncate"} ${De ? "pr-[18px]" : ""}`,
|
|
508
|
+
children: vt
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
i ? /* @__PURE__ */ r("span", { className: "flex items-center justify-center shrink-0 size-[14px]", children: /* @__PURE__ */ r(At, { size: "xxxsmall" }) }) : /* @__PURE__ */ r(
|
|
512
|
+
Rt,
|
|
513
|
+
{
|
|
514
|
+
size: 13,
|
|
515
|
+
className: "shrink-0",
|
|
516
|
+
style: {
|
|
517
|
+
color: l ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
|
|
518
|
+
transition: "transform 0.2s ease, color 0.2s ease",
|
|
519
|
+
transform: l ? "rotate(180deg)" : "rotate(0deg)"
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
De && /* @__PURE__ */ r(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
type: "button",
|
|
530
|
+
"aria-label": "Clear selection",
|
|
531
|
+
onClick: gt,
|
|
532
|
+
className: "absolute top-0 bottom-0 right-[28px] flex items-center justify-center px-[2px] leading-none bg-transparent border-none text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer",
|
|
533
|
+
children: "×"
|
|
534
|
+
}
|
|
535
|
+
)
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
l && St(
|
|
540
|
+
/* @__PURE__ */ I(
|
|
519
541
|
"div",
|
|
520
542
|
{
|
|
521
|
-
ref:
|
|
522
|
-
id:
|
|
543
|
+
ref: A,
|
|
544
|
+
id: Ee,
|
|
523
545
|
role: "listbox",
|
|
524
546
|
"aria-multiselectable": "true",
|
|
525
|
-
...
|
|
526
|
-
style:
|
|
547
|
+
...pt,
|
|
548
|
+
style: yt,
|
|
527
549
|
children: [
|
|
528
|
-
|
|
550
|
+
Ne && /* @__PURE__ */ I(
|
|
529
551
|
"div",
|
|
530
552
|
{
|
|
531
553
|
style: {
|
|
@@ -540,7 +562,7 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
540
562
|
},
|
|
541
563
|
children: [
|
|
542
564
|
/* @__PURE__ */ r(
|
|
543
|
-
|
|
565
|
+
Lt,
|
|
544
566
|
{
|
|
545
567
|
size: 13,
|
|
546
568
|
style: {
|
|
@@ -553,9 +575,9 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
553
575
|
"input",
|
|
554
576
|
{
|
|
555
577
|
type: "text",
|
|
556
|
-
value:
|
|
557
|
-
onChange: (e) =>
|
|
558
|
-
onKeyDown:
|
|
578
|
+
value: N,
|
|
579
|
+
onChange: (e) => de(e.target.value),
|
|
580
|
+
onKeyDown: J,
|
|
559
581
|
placeholder: "Search",
|
|
560
582
|
"aria-label": "Search options",
|
|
561
583
|
autoFocus: !0,
|
|
@@ -573,7 +595,7 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
573
595
|
]
|
|
574
596
|
}
|
|
575
597
|
),
|
|
576
|
-
|
|
598
|
+
Ne && /* @__PURE__ */ r(
|
|
577
599
|
"div",
|
|
578
600
|
{
|
|
579
601
|
"aria-hidden": "true",
|
|
@@ -588,7 +610,7 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
588
610
|
/* @__PURE__ */ r(
|
|
589
611
|
"div",
|
|
590
612
|
{
|
|
591
|
-
ref:
|
|
613
|
+
ref: _e,
|
|
592
614
|
style: {
|
|
593
615
|
display: "flex",
|
|
594
616
|
flexDirection: "column",
|
|
@@ -600,34 +622,34 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
600
622
|
scrollbarWidth: "thin",
|
|
601
623
|
scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent"
|
|
602
624
|
},
|
|
603
|
-
children:
|
|
625
|
+
children: H.length === 0 ? (
|
|
604
626
|
// `role="listbox"` admits only option/group children.
|
|
605
|
-
/* @__PURE__ */ r("div", { role: "presentation", style:
|
|
606
|
-
) :
|
|
607
|
-
const
|
|
608
|
-
return /* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ r("div", { role: "presentation", style: Zt, children: xt })
|
|
628
|
+
) : H.map((e, t) => {
|
|
629
|
+
const o = se.has(e.value), u = t === T, g = !!e.disabled;
|
|
630
|
+
return /* @__PURE__ */ I(
|
|
609
631
|
"button",
|
|
610
632
|
{
|
|
611
|
-
id:
|
|
612
|
-
ref: (
|
|
613
|
-
Le.current[t] =
|
|
633
|
+
id: Se(t),
|
|
634
|
+
ref: (p) => {
|
|
635
|
+
Le.current[t] = p;
|
|
614
636
|
},
|
|
615
637
|
type: "button",
|
|
616
638
|
role: "option",
|
|
617
|
-
"aria-selected":
|
|
618
|
-
"aria-disabled":
|
|
639
|
+
"aria-selected": o,
|
|
640
|
+
"aria-disabled": g || void 0,
|
|
619
641
|
onClick: () => {
|
|
620
|
-
var
|
|
621
|
-
|
|
642
|
+
var p;
|
|
643
|
+
ue(e.value), Y(), (p = K.current) == null || p.focus();
|
|
622
644
|
},
|
|
623
|
-
onMouseEnter: () =>
|
|
645
|
+
onMouseEnter: () => P(t),
|
|
624
646
|
onMouseLeave: () => {
|
|
625
|
-
|
|
647
|
+
T === t && P(-1);
|
|
626
648
|
},
|
|
627
649
|
className: "malachite-multiselect-option",
|
|
628
|
-
"data-checked":
|
|
629
|
-
"data-highlighted":
|
|
630
|
-
"data-disabled":
|
|
650
|
+
"data-checked": o,
|
|
651
|
+
"data-highlighted": u,
|
|
652
|
+
"data-disabled": g,
|
|
631
653
|
style: {
|
|
632
654
|
display: "flex",
|
|
633
655
|
alignItems: "center",
|
|
@@ -639,13 +661,13 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
639
661
|
borderRadius: 8,
|
|
640
662
|
padding: "8px 10px",
|
|
641
663
|
font: "inherit",
|
|
642
|
-
cursor:
|
|
643
|
-
opacity:
|
|
644
|
-
color:
|
|
664
|
+
cursor: g ? "not-allowed" : "pointer",
|
|
665
|
+
opacity: g ? 0.6 : 1,
|
|
666
|
+
color: o ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))"
|
|
645
667
|
},
|
|
646
668
|
children: [
|
|
647
|
-
/* @__PURE__ */ r(
|
|
648
|
-
|
|
669
|
+
/* @__PURE__ */ r(rr, { option: e }),
|
|
670
|
+
Gt(e.badge) && /* @__PURE__ */ r(
|
|
649
671
|
"span",
|
|
650
672
|
{
|
|
651
673
|
style: {
|
|
@@ -653,7 +675,7 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
653
675
|
flexShrink: 0,
|
|
654
676
|
paddingLeft: 8
|
|
655
677
|
},
|
|
656
|
-
children: /* @__PURE__ */ r(
|
|
678
|
+
children: /* @__PURE__ */ r(pe.Suspense, { fallback: null, children: /* @__PURE__ */ r(qt, { children: e.badge }) })
|
|
657
679
|
}
|
|
658
680
|
)
|
|
659
681
|
]
|
|
@@ -669,30 +691,58 @@ const ze = 0.6, Fe = 420, Vt = ({ option: n }) => {
|
|
|
669
691
|
document.body
|
|
670
692
|
)
|
|
671
693
|
] });
|
|
672
|
-
return
|
|
673
|
-
|
|
694
|
+
return He ? /* @__PURE__ */ r(
|
|
695
|
+
Tt,
|
|
674
696
|
{
|
|
675
|
-
label:
|
|
676
|
-
hint:
|
|
677
|
-
hintIcon:
|
|
678
|
-
rightSideContent:
|
|
679
|
-
tooltip:
|
|
680
|
-
name:
|
|
681
|
-
required:
|
|
682
|
-
requiredIndicator:
|
|
683
|
-
loading:
|
|
684
|
-
formControl:
|
|
685
|
-
description:
|
|
686
|
-
controlId:
|
|
687
|
-
labelId:
|
|
688
|
-
descriptionId:
|
|
689
|
-
hintId:
|
|
690
|
-
loadingComponent:
|
|
691
|
-
children:
|
|
697
|
+
label: j,
|
|
698
|
+
hint: ee,
|
|
699
|
+
hintIcon: et,
|
|
700
|
+
rightSideContent: be,
|
|
701
|
+
tooltip: ge,
|
|
702
|
+
name: he ?? "",
|
|
703
|
+
required: te,
|
|
704
|
+
requiredIndicator: tt,
|
|
705
|
+
loading: i,
|
|
706
|
+
formControl: ve,
|
|
707
|
+
description: Q,
|
|
708
|
+
controlId: Te,
|
|
709
|
+
labelId: ke,
|
|
710
|
+
descriptionId: it,
|
|
711
|
+
hintId: ct,
|
|
712
|
+
loadingComponent: _ === void 0 ? /* @__PURE__ */ r(Ge, { heightClass: U[O] }) : /* @__PURE__ */ r("div", { style: Ye(_), children: /* @__PURE__ */ r(Ge, { heightClass: U[O] }) }),
|
|
713
|
+
children: Pe
|
|
692
714
|
}
|
|
693
|
-
) :
|
|
694
|
-
}
|
|
715
|
+
) : Pe;
|
|
716
|
+
}, nr = ({
|
|
717
|
+
formControl: n,
|
|
718
|
+
name: y,
|
|
719
|
+
error: E,
|
|
720
|
+
onChange: s,
|
|
721
|
+
...b
|
|
722
|
+
}) => {
|
|
723
|
+
const R = `${Ve()}-error`;
|
|
724
|
+
return /* @__PURE__ */ r(Nt, { control: n, name: y, children: ({ error: B, message: O, onFieldChange: _, onFieldBlur: M, value: d }) => {
|
|
725
|
+
const v = E === !1 ? void 0 : O;
|
|
726
|
+
return /* @__PURE__ */ I(je, { children: [
|
|
727
|
+
/* @__PURE__ */ r(
|
|
728
|
+
Qe,
|
|
729
|
+
{
|
|
730
|
+
...b,
|
|
731
|
+
name: y,
|
|
732
|
+
value: Array.isArray(d) ? d : [],
|
|
733
|
+
error: E ?? B,
|
|
734
|
+
errorMessageId: v ? R : void 0,
|
|
735
|
+
onFieldLeave: M,
|
|
736
|
+
onChange: (i) => {
|
|
737
|
+
_ == null || _(i), s == null || s(i);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
/* @__PURE__ */ r(Ot, { id: R, message: v, spaced: !0 })
|
|
742
|
+
] });
|
|
743
|
+
} });
|
|
744
|
+
}, Nr = (n) => n.formControl ? /* @__PURE__ */ r(nr, { ...n }) : /* @__PURE__ */ r(Qe, { ...n });
|
|
695
745
|
export {
|
|
696
|
-
|
|
746
|
+
Nr as default
|
|
697
747
|
};
|
|
698
748
|
//# sourceMappingURL=MultiSelect.js.map
|