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