@stackone/malachite 2.45.0 → 2.46.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 +1 -1
- package/dist/components/ActionMenuTagHost.js +11 -11
- package/dist/components/ActionMenuTagHost.js.map +1 -1
- package/dist/components/Dropdown.js +290 -286
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/MultiSelect.js +132 -131
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/floatingMenuGeometry.js +51 -50
- package/dist/components/floatingMenuGeometry.js.map +1 -1
- package/dist/components/hasBadge.js +5 -0
- package/dist/components/hasBadge.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/package.json +1 -1
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { FieldMessage as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as b, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import Ce, { useState as A, useRef as h, useEffect as ze, useCallback as Oe, useLayoutEffect as at, useInsertionEffect as ot, useId as lt } from "react";
|
|
3
|
+
import { createPortal as st } from "react-dom";
|
|
4
|
+
import ct, { useFormFieldIds as dt } from "./BaseFormComponent.js";
|
|
5
|
+
import Ie from "./CustomIcons/CaretDownIcon.js";
|
|
6
|
+
import Ve from "./CustomIcons/CloseIcon.js";
|
|
7
|
+
import { FieldMessage as ut } from "./FieldMessage.js";
|
|
8
|
+
import Ke from "./LoadingInput.js";
|
|
9
|
+
import pt from "./Spinner.js";
|
|
10
10
|
import Ee from "./Tooltip.js";
|
|
11
|
-
import
|
|
12
|
-
import { inlineMarkdownText as
|
|
11
|
+
import ft from "./Typography/MarkdownBlock.js";
|
|
12
|
+
import { inlineMarkdownText as ht } from "./Typography/inlineMarkdown.js";
|
|
13
13
|
import { getDeepActiveElement as Te } from "./activeElement.js";
|
|
14
|
-
import { CONTROL_TEXT_SIZE_CLASS as
|
|
15
|
-
import { controlWidthStyle as
|
|
16
|
-
import { getTriggerVisual as
|
|
17
|
-
import { pushEscapeLayer as
|
|
18
|
-
import { measureMenuGeometry as
|
|
19
|
-
import { FOCUS_RING_WITHIN_INPUT as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
import { CONTROL_TEXT_SIZE_CLASS as J, CONTROL_TEXT_SIZE as gt } from "./controlTextSize.js";
|
|
15
|
+
import { controlWidthStyle as Be } from "./controlWidth.js";
|
|
16
|
+
import { getTriggerVisual as mt, DROPDOWN_TRIGGER_ATTR as Ze } from "./dropdownTriggerStyle.js";
|
|
17
|
+
import { pushEscapeLayer as xt } from "./escapeLayers.js";
|
|
18
|
+
import { measureMenuGeometry as vt, isTriggerOffscreen as bt, rectSignature as yt, MENU_MAX_HEIGHT_PX as wt, MENU_SPECS as se } from "./floatingMenuGeometry.js";
|
|
19
|
+
import { FOCUS_RING_WITHIN_INPUT as St, FOCUS_RING as Tt } from "./focusRing.js";
|
|
20
|
+
import { hasBadge as De } from "./hasBadge.js";
|
|
21
|
+
import { ensureDropdownPanelStyles as Et } from "./optionRowStyles.js";
|
|
22
|
+
import { usePopupLayer as Nt } from "./overlayLayers.js";
|
|
23
|
+
import { useTopLayer as Ct } from "./topLayer.js";
|
|
24
|
+
import { tooltipLines as Xe, isCut as ce } from "./truncatedLines.js";
|
|
25
|
+
const Rt = Ce.lazy(() => import("./ActionMenuTagHost.js")), Ye = /[*`[<&\\]/, de = ({ text: e }) => Ye.test(e) ? /* @__PURE__ */ t(
|
|
26
|
+
ft,
|
|
26
27
|
{
|
|
27
28
|
text: e,
|
|
28
29
|
variant: "inline",
|
|
@@ -31,99 +32,99 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
31
32
|
links: "inert",
|
|
32
33
|
omitMargin: !0
|
|
33
34
|
}
|
|
34
|
-
) : e,
|
|
35
|
+
) : e, Ue = {
|
|
35
36
|
display: "flex",
|
|
36
37
|
alignItems: "center",
|
|
37
38
|
justifyContent: "center",
|
|
38
39
|
gap: 8,
|
|
39
40
|
padding: "24px 16px",
|
|
40
41
|
color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
|
|
41
|
-
},
|
|
42
|
-
const r = a.toLowerCase(), g = e.label.toLowerCase().includes(r), d = e.subtitle ?
|
|
43
|
-
return g || d ||
|
|
42
|
+
}, Ae = "var(--malachite-font-size-xsmall, 11px)", _t = "[data-dropdown-option]", Me = (e) => Array.from((e == null ? void 0 : e.querySelectorAll(_t)) ?? []), kt = (e) => Ye.test(e) ? ht(e) : e.replace(/\s+/g, " "), Lt = (e, a) => {
|
|
43
|
+
const r = a.toLowerCase(), g = e.label.toLowerCase().includes(r), d = e.subtitle ? kt(e.subtitle).toLowerCase().includes(r) : !1, y = e.rightSideText ? e.rightSideText.toLowerCase().includes(r) : !1;
|
|
44
|
+
return g || d || y;
|
|
44
45
|
}, ue = {
|
|
45
46
|
small: "h-[var(--malachite-control-height-small,28px)]",
|
|
46
47
|
medium: "h-[var(--malachite-control-height-medium,32px)]",
|
|
47
48
|
large: "h-[var(--malachite-control-height-large,42px)]"
|
|
48
|
-
},
|
|
49
|
-
small: `${ue.small} px-2.5 py-1.5 ${
|
|
50
|
-
medium: `${ue.medium} px-3 py-1.5 ${
|
|
51
|
-
large: `${ue.large} px-4 py-2.5 ${
|
|
52
|
-
},
|
|
53
|
-
small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${
|
|
54
|
-
medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${
|
|
55
|
-
large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${
|
|
56
|
-
},
|
|
49
|
+
}, $t = {
|
|
50
|
+
small: `${ue.small} px-2.5 py-1.5 ${J.small}`,
|
|
51
|
+
medium: `${ue.medium} px-3 py-1.5 ${J.medium}`,
|
|
52
|
+
large: `${ue.large} px-4 py-2.5 ${J.large}`
|
|
53
|
+
}, Ot = {
|
|
54
|
+
small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${J.small}`,
|
|
55
|
+
medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${J.medium}`,
|
|
56
|
+
large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${J.large}`
|
|
57
|
+
}, Dt = {
|
|
57
58
|
small: "right-[26px] size-4",
|
|
58
59
|
medium: "right-[30px] size-4",
|
|
59
60
|
large: "right-[38px] size-4"
|
|
60
|
-
},
|
|
61
|
+
}, At = {
|
|
61
62
|
small: "top-[calc(var(--malachite-control-height-small,28px)/2)] -translate-y-1/2",
|
|
62
63
|
medium: "top-[calc(var(--malachite-control-height-medium,32px)/2)] -translate-y-1/2",
|
|
63
64
|
large: "top-[calc(var(--malachite-control-height-large,42px)/2)] -translate-y-1/2"
|
|
64
|
-
},
|
|
65
|
+
}, zt = {
|
|
65
66
|
small: "rounded-[var(--malachite-radius-10,10px)]",
|
|
66
67
|
medium: "rounded-xl",
|
|
67
68
|
large: "rounded-[var(--malachite-radius-xxl,14px)]"
|
|
68
|
-
},
|
|
69
|
+
}, qe = () => !1, Mt = ({
|
|
69
70
|
wrap: e,
|
|
70
71
|
id: a,
|
|
71
72
|
children: r
|
|
72
|
-
}) => e ? /* @__PURE__ */ t("span", { id: a, className: "min-w-0 flex items-center gap-2", children: r }) : /* @__PURE__ */ t(Ne, { children: r }),
|
|
73
|
+
}) => e ? /* @__PURE__ */ t("span", { id: a, className: "min-w-0 flex items-center gap-2", children: r }) : /* @__PURE__ */ t(Ne, { children: r }), Ft = ({ row: e, children: a }) => e ? /* @__PURE__ */ t("span", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: a }) : /* @__PURE__ */ t(Ne, { children: a }), Qe = Ce.forwardRef(
|
|
73
74
|
({
|
|
74
75
|
isOpen: e,
|
|
75
76
|
onClick: a,
|
|
76
77
|
selectedItem: r,
|
|
77
78
|
disabled: g = !1,
|
|
78
79
|
error: d = !1,
|
|
79
|
-
tone:
|
|
80
|
+
tone: y,
|
|
80
81
|
placeholder: C,
|
|
81
82
|
search: m = !1,
|
|
82
|
-
showSubtitleInTrigger:
|
|
83
|
+
showSubtitleInTrigger: w = !1,
|
|
83
84
|
searchQuery: _ = "",
|
|
84
85
|
onSearchChange: R,
|
|
85
|
-
onFocusOpen:
|
|
86
|
-
onArrowDown:
|
|
87
|
-
onTabAway:
|
|
88
|
-
size:
|
|
86
|
+
onFocusOpen: S,
|
|
87
|
+
onArrowDown: T,
|
|
88
|
+
onTabAway: E,
|
|
89
|
+
size: k = "large",
|
|
89
90
|
hasClear: x = !1,
|
|
90
|
-
onClear:
|
|
91
|
-
clearLabel:
|
|
91
|
+
onClear: z,
|
|
92
|
+
clearLabel: M,
|
|
92
93
|
controlId: i,
|
|
93
94
|
labelId: l,
|
|
94
95
|
describedBy: o,
|
|
95
96
|
required: u = !1,
|
|
96
|
-
ariaLabel:
|
|
97
|
+
ariaLabel: L,
|
|
97
98
|
ariaLabelledBy: pe,
|
|
98
99
|
hasCallerId: $ = !1
|
|
99
100
|
}, fe) => {
|
|
100
|
-
const O =
|
|
101
|
+
const O = w && !m && !!(r != null && r.subtitle), ee = O ? Ot[k] : $t[k], te = zt[k], F = `${i}-value`, he = `${i}-subtitle`, Re = !l && !L && !$ && O, ge = pe ?? (l && !L ? `${l} ${F}` : void 0) ?? (Re ? F : void 0), re = (s) => {
|
|
101
102
|
if (s.key === "Tab") {
|
|
102
|
-
|
|
103
|
+
E == null || E();
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
|
-
s.key === "ArrowDown" && (s.preventDefault(),
|
|
106
|
-
},
|
|
107
|
-
const s =
|
|
108
|
-
return !s && !
|
|
106
|
+
s.key === "ArrowDown" && (s.preventDefault(), T == null || T());
|
|
107
|
+
}, q = h(null), ne = h(null), V = mt({ disabled: g, error: d, tone: y, open: e }), N = !e && !!r, f = (r == null ? void 0 : r.triggerLabel) ?? (r == null ? void 0 : r.label), v = O ? r == null ? void 0 : r.subtitle : void 0, P = () => ce(q.current), [X, W] = A({ value: !1, subtitle: !0 }), me = () => {
|
|
108
|
+
const s = P(), ie = ce(ne.current);
|
|
109
|
+
return !s && !ie ? !1 : (W({ value: s, subtitle: ie }), !0);
|
|
109
110
|
};
|
|
110
111
|
if (m && !g)
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ b(
|
|
112
113
|
"div",
|
|
113
114
|
{
|
|
114
115
|
ref: fe,
|
|
115
116
|
className: `
|
|
116
|
-
relative w-full ${
|
|
117
|
+
relative w-full ${ee} ${te}
|
|
117
118
|
border border-solid
|
|
118
119
|
transition-all duration-200
|
|
119
|
-
flex items-center ${
|
|
120
|
+
flex items-center ${St}
|
|
120
121
|
`,
|
|
121
|
-
style:
|
|
122
|
-
[
|
|
122
|
+
style: V,
|
|
123
|
+
[Ze]: "",
|
|
123
124
|
onClick: (s) => s.stopPropagation(),
|
|
124
125
|
children: [
|
|
125
126
|
(r == null ? void 0 : r.icon) && /* @__PURE__ */ t("span", { className: "flex shrink-0 items-center justify-center pr-2", children: r.icon }),
|
|
126
|
-
/* @__PURE__ */ t(Ee, { text:
|
|
127
|
+
/* @__PURE__ */ t(Ee, { text: f, shouldShow: P, isShrinkable: !0, fill: !0, children: /* @__PURE__ */ b("div", { className: "relative flex-1 flex items-center min-w-0", children: [
|
|
127
128
|
N && /* @__PURE__ */ t(
|
|
128
129
|
"span",
|
|
129
130
|
{
|
|
@@ -132,10 +133,10 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
132
133
|
children: /* @__PURE__ */ t(
|
|
133
134
|
"span",
|
|
134
135
|
{
|
|
135
|
-
ref:
|
|
136
|
+
ref: q,
|
|
136
137
|
className: `min-w-0 block truncate text-[length:inherit]
|
|
137
138
|
text-[var(--malachite-text-primary)]`,
|
|
138
|
-
children:
|
|
139
|
+
children: f
|
|
139
140
|
}
|
|
140
141
|
)
|
|
141
142
|
}
|
|
@@ -145,7 +146,7 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
145
146
|
{
|
|
146
147
|
id: i,
|
|
147
148
|
type: "text",
|
|
148
|
-
"aria-label":
|
|
149
|
+
"aria-label": L,
|
|
149
150
|
"aria-labelledby": pe,
|
|
150
151
|
"aria-invalid": d || void 0,
|
|
151
152
|
"aria-required": u || void 0,
|
|
@@ -155,9 +156,9 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
155
156
|
s.stopPropagation(), R == null || R(s.target.value), e || a();
|
|
156
157
|
},
|
|
157
158
|
onFocus: () => {
|
|
158
|
-
|
|
159
|
+
S == null || S();
|
|
159
160
|
},
|
|
160
|
-
onKeyDown:
|
|
161
|
+
onKeyDown: re,
|
|
161
162
|
placeholder: C ?? "Select Field",
|
|
162
163
|
className: `flex-1 min-w-0 bg-transparent outline-none
|
|
163
164
|
text-[length:inherit] font-normal
|
|
@@ -169,13 +170,13 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
169
170
|
"button",
|
|
170
171
|
{
|
|
171
172
|
type: "button",
|
|
172
|
-
"aria-label":
|
|
173
|
-
onClick:
|
|
173
|
+
"aria-label": M,
|
|
174
|
+
onClick: z,
|
|
174
175
|
className: `flex shrink-0 items-center justify-center pl-2 cursor-pointer
|
|
175
176
|
bg-transparent border-none p-0 text-[var(--malachite-text-placeholder)]
|
|
176
177
|
hover:text-[var(--malachite-text-primary)] transition-colors
|
|
177
178
|
rounded-full focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2`,
|
|
178
|
-
children: /* @__PURE__ */ t(
|
|
179
|
+
children: /* @__PURE__ */ t(Ve, { size: 13 })
|
|
179
180
|
}
|
|
180
181
|
),
|
|
181
182
|
/* @__PURE__ */ t("div", { className: "flex items-center justify-center pl-2", children: /* @__PURE__ */ t(
|
|
@@ -189,7 +190,7 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
189
190
|
},
|
|
190
191
|
className: "flex items-center justify-center cursor-pointer bg-transparent border-none p-0",
|
|
191
192
|
children: /* @__PURE__ */ t(
|
|
192
|
-
|
|
193
|
+
Ie,
|
|
193
194
|
{
|
|
194
195
|
size: 13,
|
|
195
196
|
style: {
|
|
@@ -204,66 +205,66 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
204
205
|
]
|
|
205
206
|
}
|
|
206
207
|
);
|
|
207
|
-
const
|
|
208
|
+
const xe = /* @__PURE__ */ b(
|
|
208
209
|
"button",
|
|
209
210
|
{
|
|
210
211
|
ref: fe,
|
|
211
212
|
id: i,
|
|
212
213
|
type: "button",
|
|
213
|
-
"aria-label":
|
|
214
|
-
"aria-labelledby":
|
|
214
|
+
"aria-label": L,
|
|
215
|
+
"aria-labelledby": ge,
|
|
215
216
|
"aria-invalid": d || void 0,
|
|
216
217
|
"aria-required": u || void 0,
|
|
217
|
-
"aria-describedby": [o,
|
|
218
|
+
"aria-describedby": [o, v ? he : void 0].filter(Boolean).join(" ") || void 0,
|
|
218
219
|
onClick: (s) => {
|
|
219
220
|
s.stopPropagation(), a(s.detail === 0);
|
|
220
221
|
},
|
|
221
|
-
onKeyDown:
|
|
222
|
+
onKeyDown: re,
|
|
222
223
|
disabled: g,
|
|
223
|
-
style:
|
|
224
|
-
[
|
|
224
|
+
style: V,
|
|
225
|
+
[Ze]: "",
|
|
225
226
|
className: `
|
|
226
|
-
relative w-full ${
|
|
227
|
+
relative w-full ${ee} ${te}
|
|
227
228
|
border border-solid
|
|
228
229
|
transition-all duration-200
|
|
229
230
|
flex ${O ? "items-start" : "items-center"} gap-3
|
|
230
231
|
cursor-pointer
|
|
231
|
-
disabled:cursor-not-allowed ${
|
|
232
|
+
disabled:cursor-not-allowed ${Tt}
|
|
232
233
|
`,
|
|
233
234
|
children: [
|
|
234
235
|
/* @__PURE__ */ t(
|
|
235
236
|
"span",
|
|
236
237
|
{
|
|
237
|
-
id:
|
|
238
|
-
className: `text-left flex-1 min-w-0 flex ${
|
|
239
|
-
children: r ? /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
238
|
+
id: v ? void 0 : F,
|
|
239
|
+
className: `text-left flex-1 min-w-0 flex ${v ? "flex-col gap-1" : "items-center gap-2"}`,
|
|
240
|
+
children: r ? /* @__PURE__ */ b(Ne, { children: [
|
|
241
|
+
/* @__PURE__ */ b(Mt, { wrap: !!v, id: F, children: [
|
|
241
242
|
r.icon && /* @__PURE__ */ t("span", { className: "flex items-center justify-center shrink-0", children: r.icon }),
|
|
242
243
|
/* @__PURE__ */ t(
|
|
243
244
|
Ee,
|
|
244
245
|
{
|
|
245
|
-
text:
|
|
246
|
-
shouldShow:
|
|
247
|
-
triggerAs:
|
|
246
|
+
text: f,
|
|
247
|
+
shouldShow: v ? qe : P,
|
|
248
|
+
triggerAs: v ? "span" : "div",
|
|
248
249
|
isShrinkable: !0,
|
|
249
250
|
children: /* @__PURE__ */ t(
|
|
250
251
|
"span",
|
|
251
252
|
{
|
|
252
|
-
ref:
|
|
253
|
+
ref: q,
|
|
253
254
|
className: `min-w-0 block truncate text-[length:inherit] ${g ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-primary)]"}`,
|
|
254
|
-
children:
|
|
255
|
+
children: f
|
|
255
256
|
}
|
|
256
257
|
)
|
|
257
258
|
}
|
|
258
259
|
)
|
|
259
260
|
] }),
|
|
260
|
-
|
|
261
|
+
v && /* @__PURE__ */ t(
|
|
261
262
|
"span",
|
|
262
263
|
{
|
|
263
264
|
id: he,
|
|
264
|
-
ref:
|
|
265
|
+
ref: ne,
|
|
265
266
|
className: "min-w-0 block truncate text-[length:var(--malachite-font-size-xsmall,11px)] text-[var(--malachite-text-secondary,rgb(123,123,123))] leading-normal",
|
|
266
|
-
children: /* @__PURE__ */ t(de, { text:
|
|
267
|
+
children: /* @__PURE__ */ t(de, { text: v })
|
|
267
268
|
}
|
|
268
269
|
)
|
|
269
270
|
] }) : /* @__PURE__ */ t(
|
|
@@ -277,7 +278,7 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
277
278
|
),
|
|
278
279
|
x && /* @__PURE__ */ t("span", { "aria-hidden": "true", className: "shrink-0 w-4" }),
|
|
279
280
|
/* @__PURE__ */ t("span", { className: "flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(
|
|
280
|
-
|
|
281
|
+
Ie,
|
|
281
282
|
{
|
|
282
283
|
size: 13,
|
|
283
284
|
style: {
|
|
@@ -290,36 +291,36 @@ const Ve = /[*`[<&\\]/, de = ({ text: e }) => Ve.test(e) ? /* @__PURE__ */ t(
|
|
|
290
291
|
]
|
|
291
292
|
}
|
|
292
293
|
);
|
|
293
|
-
return
|
|
294
|
+
return w && !m ? /* @__PURE__ */ t(
|
|
294
295
|
Ee,
|
|
295
296
|
{
|
|
296
|
-
text:
|
|
297
|
-
["value",
|
|
297
|
+
text: Xe([
|
|
298
|
+
["value", X.value && f],
|
|
298
299
|
[
|
|
299
300
|
"subtitle",
|
|
300
|
-
|
|
301
|
+
X.subtitle && v && /* @__PURE__ */ t(de, { text: v })
|
|
301
302
|
]
|
|
302
303
|
]),
|
|
303
|
-
shouldShow:
|
|
304
|
+
shouldShow: v ? me : qe,
|
|
304
305
|
fill: !0,
|
|
305
306
|
describesTrigger: !1,
|
|
306
|
-
children:
|
|
307
|
+
children: xe
|
|
307
308
|
}
|
|
308
|
-
) :
|
|
309
|
+
) : xe;
|
|
309
310
|
}
|
|
310
311
|
);
|
|
311
|
-
|
|
312
|
-
const
|
|
312
|
+
Qe.displayName = "DropdownTrigger";
|
|
313
|
+
const Pt = ({
|
|
313
314
|
item: e,
|
|
314
315
|
selected: a,
|
|
315
316
|
showTooltipOnFocus: r,
|
|
316
317
|
subtitleLayout: g,
|
|
317
318
|
onItemSelected: d
|
|
318
319
|
}) => {
|
|
319
|
-
const
|
|
320
|
-
const l = ce(R.current), o = ce(
|
|
321
|
-
return !l && !o && !u ? !1 : (
|
|
322
|
-
},
|
|
320
|
+
const y = a ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))", C = g === "stacked" && !!e.subtitle, m = `mal-${lt().replace(/[^a-zA-Z0-9_-]/g, "")}`, w = `${m}-label`, _ = `${m}-subtitle`, R = h(null), S = h(null), T = h(null), [E, k] = A({ label: !0, subtitle: !0, rightSide: !0 }), x = () => {
|
|
321
|
+
const l = ce(R.current), o = ce(S.current), u = ce(T.current);
|
|
322
|
+
return !l && !o && !u ? !1 : (k({ label: l, subtitle: o, rightSide: u }), !0);
|
|
323
|
+
}, z = e.rightSideTextVariant === "primary" ? "var(--malachite-text-right-side-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-right-side-text-muted, rgb(123, 123, 123))", M = e.rightSideTextAlignment === "left" ? "flex-start" : "flex-end", i = (
|
|
323
324
|
// `role="option"` would be invalid — nothing here declares a `listbox`, and an
|
|
324
325
|
// orphaned option is dropped from the a11y tree. `aria-current`, not
|
|
325
326
|
// `aria-pressed`: these are one-of-many choices, not toggles. tabIndex={-1}
|
|
@@ -332,7 +333,7 @@ const zt = ({
|
|
|
332
333
|
"data-dropdown-option": "",
|
|
333
334
|
"data-selected": a,
|
|
334
335
|
"aria-current": a || void 0,
|
|
335
|
-
"aria-labelledby": e.subtitle ?
|
|
336
|
+
"aria-labelledby": e.subtitle || De(e.badge) ? w : void 0,
|
|
336
337
|
"aria-describedby": e.subtitle ? _ : void 0,
|
|
337
338
|
tabIndex: -1,
|
|
338
339
|
onClick: (l) => {
|
|
@@ -355,7 +356,7 @@ const zt = ({
|
|
|
355
356
|
font: "inherit",
|
|
356
357
|
color: "inherit"
|
|
357
358
|
},
|
|
358
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ b(
|
|
359
360
|
"span",
|
|
360
361
|
{
|
|
361
362
|
style: {
|
|
@@ -366,12 +367,12 @@ const zt = ({
|
|
|
366
367
|
minWidth: 0
|
|
367
368
|
},
|
|
368
369
|
children: [
|
|
369
|
-
/* @__PURE__ */ t("span", { style: { flex: "1 1 auto", display: "block", minWidth: 0 }, children: /* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ t("span", { style: { flex: "1 1 auto", display: "block", minWidth: 0 }, children: /* @__PURE__ */ b(
|
|
370
371
|
"span",
|
|
371
372
|
{
|
|
372
373
|
style: C ? { display: "flex", flexDirection: "column", gap: 2 } : { display: "flex", alignItems: "center", gap: 8 },
|
|
373
374
|
children: [
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ b(Ft, { row: C && !!e.icon, children: [
|
|
375
376
|
e.icon && /* @__PURE__ */ t(
|
|
376
377
|
"span",
|
|
377
378
|
{
|
|
@@ -387,11 +388,11 @@ const zt = ({
|
|
|
387
388
|
/* @__PURE__ */ t(
|
|
388
389
|
"span",
|
|
389
390
|
{
|
|
390
|
-
id: e.subtitle ?
|
|
391
|
+
id: e.subtitle || De(e.badge) ? w : void 0,
|
|
391
392
|
ref: R,
|
|
392
393
|
style: {
|
|
393
394
|
fontWeight: 400,
|
|
394
|
-
color:
|
|
395
|
+
color: y,
|
|
395
396
|
whiteSpace: "nowrap",
|
|
396
397
|
overflow: "hidden",
|
|
397
398
|
textOverflow: "ellipsis",
|
|
@@ -405,19 +406,19 @@ const zt = ({
|
|
|
405
406
|
"span",
|
|
406
407
|
{
|
|
407
408
|
id: _,
|
|
408
|
-
ref:
|
|
409
|
+
ref: S,
|
|
409
410
|
style: {
|
|
410
|
-
fontSize:
|
|
411
|
+
fontSize: Ae,
|
|
411
412
|
fontWeight: 400,
|
|
412
413
|
lineHeight: 1.4,
|
|
413
|
-
color: a ?
|
|
414
|
+
color: a ? y : "var(--malachite-text-dimmed, rgb(161, 161, 161))",
|
|
414
415
|
whiteSpace: "nowrap",
|
|
415
416
|
overflow: "hidden",
|
|
416
417
|
textOverflow: "ellipsis"
|
|
417
418
|
},
|
|
418
419
|
children: /* @__PURE__ */ t(de, { text: e.subtitle })
|
|
419
420
|
}
|
|
420
|
-
) : /* @__PURE__ */
|
|
421
|
+
) : /* @__PURE__ */ b(
|
|
421
422
|
"span",
|
|
422
423
|
{
|
|
423
424
|
style: {
|
|
@@ -435,7 +436,7 @@ const zt = ({
|
|
|
435
436
|
"span",
|
|
436
437
|
{
|
|
437
438
|
style: {
|
|
438
|
-
fontSize:
|
|
439
|
+
fontSize: Ae,
|
|
439
440
|
fontWeight: 400,
|
|
440
441
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
441
442
|
flexShrink: 0
|
|
@@ -447,9 +448,9 @@ const zt = ({
|
|
|
447
448
|
"span",
|
|
448
449
|
{
|
|
449
450
|
id: _,
|
|
450
|
-
ref:
|
|
451
|
+
ref: S,
|
|
451
452
|
style: {
|
|
452
|
-
fontSize:
|
|
453
|
+
fontSize: Ae,
|
|
453
454
|
fontWeight: 400,
|
|
454
455
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
455
456
|
whiteSpace: "nowrap",
|
|
@@ -475,16 +476,16 @@ const zt = ({
|
|
|
475
476
|
minWidth: e.rightSideText ? "var(--malachite-text-right-side-text-min-width, 80px)" : 0,
|
|
476
477
|
flexShrink: 1,
|
|
477
478
|
display: "flex",
|
|
478
|
-
justifyContent:
|
|
479
|
+
justifyContent: M
|
|
479
480
|
},
|
|
480
481
|
children: e.rightSideText && /* @__PURE__ */ t(
|
|
481
482
|
"span",
|
|
482
483
|
{
|
|
483
|
-
ref:
|
|
484
|
+
ref: T,
|
|
484
485
|
style: {
|
|
485
486
|
fontSize: "var(--malachite-text-right-side-text-font-size, 12px)",
|
|
486
487
|
fontWeight: 400,
|
|
487
|
-
color:
|
|
488
|
+
color: z,
|
|
488
489
|
whiteSpace: "nowrap",
|
|
489
490
|
overflow: "hidden",
|
|
490
491
|
textOverflow: "ellipsis",
|
|
@@ -494,7 +495,8 @@ const zt = ({
|
|
|
494
495
|
}
|
|
495
496
|
)
|
|
496
497
|
}
|
|
497
|
-
)
|
|
498
|
+
),
|
|
499
|
+
De(e.badge) && /* @__PURE__ */ t("span", { style: { flexShrink: 0, display: "flex" }, children: /* @__PURE__ */ t(Ce.Suspense, { fallback: null, children: /* @__PURE__ */ t(Rt, { children: e.badge }) }) })
|
|
498
500
|
]
|
|
499
501
|
}
|
|
500
502
|
)
|
|
@@ -504,13 +506,13 @@ const zt = ({
|
|
|
504
506
|
return /* @__PURE__ */ t(
|
|
505
507
|
Ee,
|
|
506
508
|
{
|
|
507
|
-
text:
|
|
508
|
-
["label",
|
|
509
|
+
text: Xe([
|
|
510
|
+
["label", E.label && e.label],
|
|
509
511
|
[
|
|
510
512
|
"subtitle",
|
|
511
|
-
|
|
513
|
+
E.subtitle && e.subtitle && /* @__PURE__ */ t(de, { text: e.subtitle })
|
|
512
514
|
],
|
|
513
|
-
["rightSide",
|
|
515
|
+
["rightSide", E.rightSide && e.rightSideText]
|
|
514
516
|
]),
|
|
515
517
|
shouldShow: x,
|
|
516
518
|
showOnFocus: r,
|
|
@@ -519,45 +521,45 @@ const zt = ({
|
|
|
519
521
|
children: i
|
|
520
522
|
}
|
|
521
523
|
);
|
|
522
|
-
},
|
|
524
|
+
}, Je = Ce.forwardRef((e, a) => {
|
|
523
525
|
const {
|
|
524
526
|
items: r,
|
|
525
527
|
onItemSelected: g,
|
|
526
528
|
selectedItem: d,
|
|
527
|
-
menuLoading:
|
|
529
|
+
menuLoading: y,
|
|
528
530
|
emptyMessage: C,
|
|
529
531
|
autoFocus: m,
|
|
530
|
-
positioned:
|
|
532
|
+
positioned: w,
|
|
531
533
|
onDismiss: _,
|
|
532
534
|
keyboardNavigation: R,
|
|
533
|
-
onKeyboardNavigation:
|
|
534
|
-
subtitleLayout:
|
|
535
|
-
size:
|
|
536
|
-
style:
|
|
537
|
-
} = e, x = h(null),
|
|
538
|
-
return
|
|
539
|
-
|
|
540
|
-
}, []),
|
|
535
|
+
onKeyboardNavigation: S,
|
|
536
|
+
subtitleLayout: T,
|
|
537
|
+
size: E,
|
|
538
|
+
style: k
|
|
539
|
+
} = e, x = h(null), z = Nt("dropdown", !0, x);
|
|
540
|
+
return ot(() => {
|
|
541
|
+
Et();
|
|
542
|
+
}, []), Ct(x, !0), ze(() => {
|
|
541
543
|
var o;
|
|
542
|
-
if (!m || !
|
|
544
|
+
if (!m || !w)
|
|
543
545
|
return;
|
|
544
|
-
const i =
|
|
546
|
+
const i = Me(x.current);
|
|
545
547
|
(o = i.find((u) => u.dataset.selected === "true") ?? i[0] ?? x.current) == null || o.focus();
|
|
546
|
-
}, [m,
|
|
548
|
+
}, [m, w]), /* @__PURE__ */ t(
|
|
547
549
|
"div",
|
|
548
550
|
{
|
|
549
551
|
ref: (i) => {
|
|
550
552
|
x.current = i, typeof a == "function" ? a(i) : a && (a.current = i);
|
|
551
553
|
},
|
|
552
|
-
...
|
|
554
|
+
...z,
|
|
553
555
|
tabIndex: -1,
|
|
554
556
|
onKeyDown: (i) => {
|
|
555
|
-
var
|
|
557
|
+
var L;
|
|
556
558
|
if (i.key === "Tab") {
|
|
557
559
|
_();
|
|
558
560
|
return;
|
|
559
561
|
}
|
|
560
|
-
const l =
|
|
562
|
+
const l = Me(x.current);
|
|
561
563
|
if (l.length === 0)
|
|
562
564
|
return;
|
|
563
565
|
const o = l.indexOf(document.activeElement), u = {
|
|
@@ -566,24 +568,24 @@ const zt = ({
|
|
|
566
568
|
Home: 0,
|
|
567
569
|
End: l.length - 1
|
|
568
570
|
}[i.key];
|
|
569
|
-
u !== void 0 && (i.preventDefault(),
|
|
571
|
+
u !== void 0 && (i.preventDefault(), S(), (L = l[Math.min(Math.max(u, 0), l.length - 1)]) == null || L.focus());
|
|
570
572
|
},
|
|
571
573
|
style: {
|
|
572
574
|
background: se.standard.background,
|
|
573
575
|
border: se.standard.border,
|
|
574
576
|
borderRadius: se.standard.radius,
|
|
575
577
|
boxShadow: se.standard.shadow,
|
|
576
|
-
maxHeight:
|
|
578
|
+
maxHeight: wt,
|
|
577
579
|
overflow: "hidden",
|
|
578
580
|
display: "flex",
|
|
579
581
|
flexDirection: "column",
|
|
580
|
-
fontSize:
|
|
581
|
-
...
|
|
582
|
+
fontSize: gt[E],
|
|
583
|
+
...k
|
|
582
584
|
},
|
|
583
|
-
children:
|
|
584
|
-
/* @__PURE__ */ t(
|
|
585
|
+
children: y ? /* @__PURE__ */ b("div", { style: Ue, children: [
|
|
586
|
+
/* @__PURE__ */ t(pt, { size: "xxxsmall" }),
|
|
585
587
|
/* @__PURE__ */ t("span", { children: "Loading…" })
|
|
586
|
-
] }) : r.length === 0 ? /* @__PURE__ */ t("div", { style:
|
|
588
|
+
] }) : r.length === 0 ? /* @__PURE__ */ t("div", { style: Ue, children: C }) : /* @__PURE__ */ t(
|
|
587
589
|
"div",
|
|
588
590
|
{
|
|
589
591
|
style: {
|
|
@@ -597,7 +599,7 @@ const zt = ({
|
|
|
597
599
|
},
|
|
598
600
|
children: r.map((i, l) => {
|
|
599
601
|
const o = r[l - 1], u = !!i.group && (!o || o.group !== i.group);
|
|
600
|
-
return /* @__PURE__ */
|
|
602
|
+
return /* @__PURE__ */ b("div", { style: { flexShrink: 0 }, children: [
|
|
601
603
|
u && /* @__PURE__ */ t(
|
|
602
604
|
"div",
|
|
603
605
|
{
|
|
@@ -613,11 +615,11 @@ const zt = ({
|
|
|
613
615
|
}
|
|
614
616
|
),
|
|
615
617
|
/* @__PURE__ */ t(
|
|
616
|
-
|
|
618
|
+
Pt,
|
|
617
619
|
{
|
|
618
620
|
item: i,
|
|
619
621
|
onItemSelected: g,
|
|
620
|
-
subtitleLayout:
|
|
622
|
+
subtitleLayout: T,
|
|
621
623
|
selected: i.id === (d == null ? void 0 : d.id) || !1,
|
|
622
624
|
showTooltipOnFocus: R
|
|
623
625
|
}
|
|
@@ -629,51 +631,52 @@ const zt = ({
|
|
|
629
631
|
}
|
|
630
632
|
);
|
|
631
633
|
});
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
+
Je.displayName = "DropdownPanel";
|
|
635
|
+
const cr = ({
|
|
634
636
|
items: e,
|
|
635
637
|
onItemSelected: a,
|
|
636
638
|
defaultValue: r,
|
|
637
639
|
value: g,
|
|
638
640
|
disabled: d = !1,
|
|
639
|
-
error:
|
|
641
|
+
error: y,
|
|
640
642
|
tone: C,
|
|
641
643
|
label: m,
|
|
642
|
-
hint:
|
|
644
|
+
hint: w,
|
|
643
645
|
rightSideContent: _,
|
|
644
646
|
tooltip: R,
|
|
645
|
-
name:
|
|
646
|
-
required:
|
|
647
|
-
requiredIndicator:
|
|
648
|
-
loading:
|
|
647
|
+
name: S,
|
|
648
|
+
required: T = !1,
|
|
649
|
+
requiredIndicator: E,
|
|
650
|
+
loading: k,
|
|
649
651
|
menuLoading: x,
|
|
650
|
-
formControl:
|
|
651
|
-
description:
|
|
652
|
+
formControl: z,
|
|
653
|
+
description: M,
|
|
652
654
|
helperText: i,
|
|
653
655
|
placeholder: l,
|
|
654
656
|
search: o = !1,
|
|
655
657
|
showSubtitleInTrigger: u = !1,
|
|
656
|
-
subtitleLayout:
|
|
658
|
+
subtitleLayout: L = "inline",
|
|
657
659
|
clearable: pe = !1,
|
|
658
660
|
size: $ = "large",
|
|
659
661
|
fullWidth: fe = !1,
|
|
660
662
|
width: O,
|
|
661
|
-
minWidth:
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
"aria-
|
|
663
|
+
minWidth: ee,
|
|
664
|
+
menuAlign: te = "start",
|
|
665
|
+
id: F,
|
|
666
|
+
"aria-label": he,
|
|
667
|
+
"aria-labelledby": Re
|
|
665
668
|
}) => {
|
|
666
|
-
const { controlId: ge, labelId:
|
|
667
|
-
id:
|
|
669
|
+
const { controlId: ge, labelId: re, descriptionId: q, hintId: ne, helperTextId: V } = dt({
|
|
670
|
+
id: F,
|
|
668
671
|
label: m,
|
|
669
|
-
description:
|
|
670
|
-
hint:
|
|
672
|
+
description: M,
|
|
673
|
+
hint: w,
|
|
671
674
|
helperText: !0
|
|
672
|
-
}), [
|
|
673
|
-
|
|
674
|
-
|
|
675
|
+
}), [N, f] = A(!1), [v, P] = A(r), X = g ?? v, W = e.find((n) => n.id === X), me = pe && X !== void 0 && X !== "" && !d, xe = u && !o && !!(W != null && W.subtitle), s = `Clear ${m ?? l ?? "selection"}`, ie = h(r);
|
|
676
|
+
ze(() => {
|
|
677
|
+
ie.current !== r && (ie.current = r, P(r));
|
|
675
678
|
}, [r]);
|
|
676
|
-
const [
|
|
679
|
+
const [_e, Y] = A(""), [et, Fe] = A(!1), [tt, ke] = A(!1), Le = h(null), ve = h(null), G = h(null), [p, Pe] = A(null), be = h(!0), H = Oe(() => {
|
|
677
680
|
const n = ve.current, c = n instanceof HTMLButtonElement ? n : (n == null ? void 0 : n.querySelector("input")) ?? null;
|
|
678
681
|
if (!(!c || c === Te())) {
|
|
679
682
|
if (!o) {
|
|
@@ -682,56 +685,57 @@ const ar = ({
|
|
|
682
685
|
}
|
|
683
686
|
be.current = !1, c.focus(), Te() !== c && (be.current = !0);
|
|
684
687
|
}
|
|
685
|
-
}, [o]),
|
|
688
|
+
}, [o]), We = Oe(
|
|
686
689
|
(n) => {
|
|
687
690
|
var c;
|
|
688
|
-
n.stopPropagation(),
|
|
691
|
+
n.stopPropagation(), P(void 0), (c = I.current) == null || c.call(I, $e.current), a == null || a(void 0), H();
|
|
689
692
|
},
|
|
690
693
|
[a, H]
|
|
691
|
-
), j =
|
|
694
|
+
), j = Oe(() => {
|
|
692
695
|
const n = ve.current;
|
|
693
|
-
n &&
|
|
694
|
-
|
|
696
|
+
n && Pe(
|
|
697
|
+
vt(G.current, {
|
|
695
698
|
triggerRect: n.getBoundingClientRect(),
|
|
696
699
|
preset: "standard",
|
|
697
|
-
minWidth:
|
|
700
|
+
minWidth: ee,
|
|
701
|
+
align: te === "end" ? "right" : "left",
|
|
698
702
|
viewportWidth: window.innerWidth,
|
|
699
703
|
viewportHeight: window.innerHeight
|
|
700
704
|
})
|
|
701
705
|
);
|
|
702
|
-
}, [te]);
|
|
703
|
-
|
|
704
|
-
if (!
|
|
705
|
-
|
|
706
|
+
}, [ee, te]);
|
|
707
|
+
ze(() => {
|
|
708
|
+
if (!N) {
|
|
709
|
+
Pe(null), Fe(!1);
|
|
706
710
|
return;
|
|
707
711
|
}
|
|
708
712
|
j();
|
|
709
|
-
const n = (
|
|
710
|
-
var oe, le,
|
|
711
|
-
const
|
|
712
|
-
!Se && !
|
|
713
|
-
}, c =
|
|
714
|
-
|
|
715
|
-
}),
|
|
713
|
+
const n = (B) => {
|
|
714
|
+
var oe, le, je;
|
|
715
|
+
const D = B.composedPath(), Z = Le.current, U = G.current, Se = !!Z && D.includes(Z), He = !!U && D.includes(U);
|
|
716
|
+
!Se && !He && (f(!1), o && Y(""), (oe = G.current) != null && oe.contains(Te()) && H(), (le = Le.current) != null && le.contains(Te()) || (je = K.current) == null || je.call(K));
|
|
717
|
+
}, c = xt(() => {
|
|
718
|
+
f(!1), o && Y(""), H();
|
|
719
|
+
}), Q = () => j();
|
|
716
720
|
let ae = 0, ye = "";
|
|
717
721
|
const we = () => {
|
|
718
|
-
const
|
|
719
|
-
if (
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
722
|
-
|
|
722
|
+
const B = ve.current;
|
|
723
|
+
if (B) {
|
|
724
|
+
const D = B.getBoundingClientRect();
|
|
725
|
+
if (bt(D, window.innerWidth, window.innerHeight)) {
|
|
726
|
+
f(!1), o && Y("");
|
|
723
727
|
return;
|
|
724
728
|
}
|
|
725
|
-
const
|
|
726
|
-
|
|
729
|
+
const Z = yt(D);
|
|
730
|
+
Z !== ye && (ye = Z, j());
|
|
727
731
|
}
|
|
728
732
|
ae = requestAnimationFrame(we);
|
|
729
733
|
};
|
|
730
|
-
return ae = requestAnimationFrame(we), document.addEventListener("mousedown", n), window.addEventListener("scroll",
|
|
731
|
-
cancelAnimationFrame(ae), document.removeEventListener("mousedown", n), c(), window.removeEventListener("scroll",
|
|
734
|
+
return ae = requestAnimationFrame(we), document.addEventListener("mousedown", n), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q), () => {
|
|
735
|
+
cancelAnimationFrame(ae), document.removeEventListener("mousedown", n), c(), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
|
|
732
736
|
};
|
|
733
|
-
}, [
|
|
734
|
-
if (!
|
|
737
|
+
}, [N, o, j, H]), at(() => {
|
|
738
|
+
if (!N)
|
|
735
739
|
return;
|
|
736
740
|
j();
|
|
737
741
|
const n = G.current;
|
|
@@ -739,157 +743,157 @@ const ar = ({
|
|
|
739
743
|
return;
|
|
740
744
|
const c = new ResizeObserver(() => j());
|
|
741
745
|
return c.observe(n), () => c.disconnect();
|
|
742
|
-
}, [
|
|
743
|
-
const I = h(void 0), K = h(void 0),
|
|
746
|
+
}, [N, j]);
|
|
747
|
+
const I = h(void 0), K = h(void 0), $e = h(""), rt = (n) => {
|
|
744
748
|
var c;
|
|
745
|
-
|
|
746
|
-
},
|
|
747
|
-
|
|
748
|
-
},
|
|
749
|
-
|
|
750
|
-
const n =
|
|
749
|
+
P(n == null ? void 0 : n.id), (c = I.current) == null || c.call(I, (n == null ? void 0 : n.id) ?? $e.current), f(!1), o && Y(""), a == null || a(n == null ? void 0 : n.id), H();
|
|
750
|
+
}, Ge = () => {
|
|
751
|
+
f(!1), o && Y(""), H();
|
|
752
|
+
}, nt = () => {
|
|
753
|
+
ke(!0);
|
|
754
|
+
const n = Me(G.current)[0];
|
|
751
755
|
if (n) {
|
|
752
756
|
n.focus();
|
|
753
757
|
return;
|
|
754
758
|
}
|
|
755
|
-
|
|
756
|
-
},
|
|
759
|
+
Fe(!0), f(!0);
|
|
760
|
+
}, it = o && _e ? e.filter((n) => Lt(n, _e)) : e;
|
|
757
761
|
return /* @__PURE__ */ t(
|
|
758
|
-
|
|
762
|
+
ct,
|
|
759
763
|
{
|
|
760
764
|
fullWidth: fe,
|
|
761
765
|
label: m,
|
|
762
|
-
hint:
|
|
766
|
+
hint: w,
|
|
763
767
|
rightSideContent: _,
|
|
764
768
|
tooltip: R,
|
|
765
|
-
name:
|
|
766
|
-
required:
|
|
767
|
-
requiredIndicator:
|
|
768
|
-
loading:
|
|
769
|
-
formControl:
|
|
770
|
-
description:
|
|
769
|
+
name: S,
|
|
770
|
+
required: T,
|
|
771
|
+
requiredIndicator: E,
|
|
772
|
+
loading: k,
|
|
773
|
+
formControl: z,
|
|
774
|
+
description: M,
|
|
771
775
|
controlId: ge,
|
|
772
|
-
labelId:
|
|
773
|
-
descriptionId:
|
|
774
|
-
hintId:
|
|
776
|
+
labelId: re,
|
|
777
|
+
descriptionId: q,
|
|
778
|
+
hintId: ne,
|
|
775
779
|
loadingComponent: O === void 0 ? /* @__PURE__ */ t(
|
|
776
|
-
|
|
780
|
+
Ke,
|
|
777
781
|
{
|
|
778
782
|
heightClass: ue[$],
|
|
779
783
|
helperText: !!i,
|
|
780
784
|
helperTextMarginTop: !0
|
|
781
785
|
}
|
|
782
|
-
) : /* @__PURE__ */ t("div", { style:
|
|
783
|
-
|
|
786
|
+
) : /* @__PURE__ */ t("div", { style: Be(O), children: /* @__PURE__ */ t(
|
|
787
|
+
Ke,
|
|
784
788
|
{
|
|
785
789
|
heightClass: ue[$],
|
|
786
790
|
helperText: !!i,
|
|
787
791
|
helperTextMarginTop: !0
|
|
788
792
|
}
|
|
789
793
|
) }),
|
|
790
|
-
children: ({ error: n, message: c, onFieldChange:
|
|
791
|
-
I.current =
|
|
792
|
-
const we =
|
|
794
|
+
children: ({ error: n, message: c, onFieldChange: Q, onFieldBlur: ae, emptyValue: ye }) => {
|
|
795
|
+
I.current = Q, K.current = ae, $e.current = ye;
|
|
796
|
+
const we = y ?? n, B = y === !1 ? void 0 : c, D = `${V}-error`, Z = [
|
|
797
|
+
q,
|
|
793
798
|
ne,
|
|
794
|
-
V,
|
|
795
|
-
|
|
796
|
-
Z ? A : void 0
|
|
799
|
+
i ? V : void 0,
|
|
800
|
+
B ? D : void 0
|
|
797
801
|
].filter(Boolean).join(" ") || void 0;
|
|
798
|
-
return /* @__PURE__ */
|
|
799
|
-
/* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ b(Ne, { children: [
|
|
803
|
+
/* @__PURE__ */ b(
|
|
800
804
|
"div",
|
|
801
805
|
{
|
|
802
|
-
ref:
|
|
806
|
+
ref: Le,
|
|
803
807
|
className: "relative w-full",
|
|
804
|
-
style:
|
|
805
|
-
onBlur: (
|
|
808
|
+
style: Be(O),
|
|
809
|
+
onBlur: (U) => {
|
|
806
810
|
var oe, le;
|
|
807
|
-
const Se =
|
|
808
|
-
|
|
811
|
+
const Se = U.relatedTarget;
|
|
812
|
+
U.currentTarget.contains(Se) || ((oe = G.current) == null ? void 0 : oe.contains(Se)) === !0 || (le = K.current) == null || le.call(K);
|
|
809
813
|
},
|
|
810
814
|
children: [
|
|
811
|
-
|
|
815
|
+
me && !o && /* @__PURE__ */ t(
|
|
812
816
|
"button",
|
|
813
817
|
{
|
|
814
818
|
type: "button",
|
|
815
|
-
onClick:
|
|
816
|
-
"aria-label":
|
|
817
|
-
className: `absolute ${
|
|
819
|
+
onClick: We,
|
|
820
|
+
"aria-label": s,
|
|
821
|
+
className: `absolute ${xe ? At[$] : "top-1/2 -translate-y-1/2"} z-10 flex items-center
|
|
818
822
|
justify-center rounded-full text-[var(--malachite-text-placeholder)]
|
|
819
823
|
hover:text-[var(--malachite-text-primary)] transition-colors
|
|
820
|
-
focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${
|
|
821
|
-
children: /* @__PURE__ */ t(
|
|
824
|
+
focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${Dt[$]}`,
|
|
825
|
+
children: /* @__PURE__ */ t(Ve, { size: 13 })
|
|
822
826
|
}
|
|
823
827
|
),
|
|
824
828
|
/* @__PURE__ */ t(
|
|
825
|
-
|
|
829
|
+
Qe,
|
|
826
830
|
{
|
|
827
|
-
hasClear:
|
|
828
|
-
onClear:
|
|
829
|
-
clearLabel:
|
|
831
|
+
hasClear: me,
|
|
832
|
+
onClear: We,
|
|
833
|
+
clearLabel: s,
|
|
830
834
|
ref: ve,
|
|
831
|
-
isOpen:
|
|
832
|
-
onClick: (
|
|
833
|
-
d || (
|
|
835
|
+
isOpen: N,
|
|
836
|
+
onClick: (U) => {
|
|
837
|
+
d || (ke(!!U), f(!N));
|
|
834
838
|
},
|
|
835
|
-
selectedItem:
|
|
839
|
+
selectedItem: W,
|
|
836
840
|
disabled: d,
|
|
837
841
|
error: we,
|
|
838
842
|
tone: C,
|
|
839
843
|
placeholder: l,
|
|
840
844
|
search: o,
|
|
841
845
|
showSubtitleInTrigger: u,
|
|
842
|
-
searchQuery:
|
|
843
|
-
onSearchChange:
|
|
846
|
+
searchQuery: _e,
|
|
847
|
+
onSearchChange: Y,
|
|
844
848
|
onFocusOpen: () => {
|
|
845
849
|
if (!be.current) {
|
|
846
850
|
be.current = !0;
|
|
847
851
|
return;
|
|
848
852
|
}
|
|
849
|
-
|
|
853
|
+
f(!0);
|
|
850
854
|
},
|
|
851
855
|
onArrowDown: () => {
|
|
852
|
-
d ||
|
|
856
|
+
d || nt();
|
|
853
857
|
},
|
|
854
858
|
onTabAway: () => {
|
|
855
|
-
|
|
859
|
+
N && Ge();
|
|
856
860
|
},
|
|
857
861
|
size: $,
|
|
858
862
|
controlId: ge,
|
|
859
|
-
hasCallerId: !!
|
|
860
|
-
labelId:
|
|
861
|
-
describedBy:
|
|
862
|
-
required:
|
|
863
|
-
ariaLabel:
|
|
864
|
-
ariaLabelledBy:
|
|
863
|
+
hasCallerId: !!F,
|
|
864
|
+
labelId: re,
|
|
865
|
+
describedBy: Z,
|
|
866
|
+
required: T,
|
|
867
|
+
ariaLabel: he,
|
|
868
|
+
ariaLabelledBy: Re
|
|
865
869
|
}
|
|
866
870
|
),
|
|
867
|
-
|
|
871
|
+
N && st(
|
|
868
872
|
/* @__PURE__ */ t(
|
|
869
|
-
|
|
873
|
+
Je,
|
|
870
874
|
{
|
|
871
875
|
ref: G,
|
|
872
876
|
style: {
|
|
873
877
|
position: "fixed",
|
|
874
|
-
top: (
|
|
875
|
-
left: (
|
|
876
|
-
width:
|
|
877
|
-
maxHeight:
|
|
878
|
-
visibility:
|
|
879
|
-
opacity:
|
|
878
|
+
top: (p == null ? void 0 : p.top) ?? 0,
|
|
879
|
+
left: (p == null ? void 0 : p.left) ?? 0,
|
|
880
|
+
width: p == null ? void 0 : p.width,
|
|
881
|
+
maxHeight: p == null ? void 0 : p.maxHeight,
|
|
882
|
+
visibility: p ? "visible" : "hidden",
|
|
883
|
+
opacity: p ? 1 : 0
|
|
880
884
|
},
|
|
881
|
-
items:
|
|
882
|
-
onItemSelected:
|
|
883
|
-
selectedItem:
|
|
885
|
+
items: it,
|
|
886
|
+
onItemSelected: rt,
|
|
887
|
+
selectedItem: W,
|
|
884
888
|
menuLoading: x,
|
|
885
889
|
emptyMessage: e.length === 0 ? "No options available" : "No results found",
|
|
886
|
-
subtitleLayout:
|
|
890
|
+
subtitleLayout: L,
|
|
887
891
|
size: $,
|
|
888
|
-
autoFocus: !o ||
|
|
889
|
-
positioned:
|
|
890
|
-
onDismiss:
|
|
891
|
-
keyboardNavigation:
|
|
892
|
-
onKeyboardNavigation: () =>
|
|
892
|
+
autoFocus: !o || et,
|
|
893
|
+
positioned: p !== null,
|
|
894
|
+
onDismiss: Ge,
|
|
895
|
+
keyboardNavigation: tt,
|
|
896
|
+
onKeyboardNavigation: () => ke(!0)
|
|
893
897
|
}
|
|
894
898
|
),
|
|
895
899
|
document.body
|
|
@@ -900,18 +904,18 @@ const ar = ({
|
|
|
900
904
|
i && /* @__PURE__ */ t(
|
|
901
905
|
"div",
|
|
902
906
|
{
|
|
903
|
-
id:
|
|
907
|
+
id: V,
|
|
904
908
|
className: "mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))]",
|
|
905
909
|
children: i
|
|
906
910
|
}
|
|
907
911
|
),
|
|
908
|
-
/* @__PURE__ */ t(
|
|
912
|
+
/* @__PURE__ */ t(ut, { id: D, message: B, spaced: !0 })
|
|
909
913
|
] });
|
|
910
914
|
}
|
|
911
915
|
}
|
|
912
916
|
);
|
|
913
917
|
};
|
|
914
918
|
export {
|
|
915
|
-
|
|
919
|
+
cr as Dropdown
|
|
916
920
|
};
|
|
917
921
|
//# sourceMappingURL=Dropdown.js.map
|