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