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