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