@stackone/malachite 2.23.3 → 2.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +7 -7
- package/dist/components/ActionMenu.js +103 -87
- package/dist/components/ActionMenu.js.map +1 -1
- package/dist/components/AppLogo.js.map +1 -1
- package/dist/components/CodeBlockHighlighter.js +4 -3
- package/dist/components/CodeBlockHighlighter.js.map +1 -1
- package/dist/components/Dropdown.js +374 -360
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/MultiSelect.js +295 -284
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/Search.js +17 -14
- package/dist/components/Search.js.map +1 -1
- package/dist/components/Tabs.js +52 -31
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Toolbar.js +47 -14
- package/dist/components/Toolbar.js.map +1 -1
- package/dist/components/Tooltip.js +55 -55
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Typography/EllipsisText.js +32 -17
- package/dist/components/Typography/EllipsisText.js.map +1 -1
- package/dist/components/controlWidth.js +5 -0
- package/dist/components/controlWidth.js.map +1 -0
- package/dist/components/floatingMenuGeometry.js +71 -0
- package/dist/components/floatingMenuGeometry.js.map +1 -0
- package/dist/components/portalOverlay.js +25 -23
- package/dist/components/portalOverlay.js.map +1 -1
- package/dist/components/queryInputGeometry.js +6 -6
- package/dist/components/queryInputGeometry.js.map +1 -1
- package/dist/index.d.ts +52 -3
- package/dist/index.js +360 -356
- package/package.json +1 -1
- package/dist/components/dropdownPanelPosition.js +0 -38
- package/dist/components/dropdownPanelPosition.js.map +0 -1
|
@@ -1,122 +1,123 @@
|
|
|
1
|
-
import { jsx as e, jsxs as m, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { FieldMessage as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { CONTROL_TEXT_SIZE_CLASS as
|
|
12
|
-
import {
|
|
13
|
-
import { getTriggerVisual as
|
|
14
|
-
import { pushEscapeLayer as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
1
|
+
import { jsx as e, jsxs as m, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import Ge, { useState as Y, useRef as T, useEffect as Ne, useCallback as Ee, useLayoutEffect as Ue, useInsertionEffect as Xe, useId as Ye } from "react";
|
|
3
|
+
import { createPortal as Qe } from "react-dom";
|
|
4
|
+
import Je, { useFormFieldIds as et } from "./BaseFormComponent.js";
|
|
5
|
+
import Oe from "./CustomIcons/CaretDownIcon.js";
|
|
6
|
+
import He from "./CustomIcons/CloseIcon.js";
|
|
7
|
+
import { FieldMessage as tt } from "./FieldMessage.js";
|
|
8
|
+
import We from "./LoadingInput.js";
|
|
9
|
+
import rt from "./Spinner.js";
|
|
10
|
+
import ye from "./Tooltip.js";
|
|
11
|
+
import { CONTROL_TEXT_SIZE_CLASS as Q, CONTROL_TEXT_SIZE as nt } from "./controlTextSize.js";
|
|
12
|
+
import { controlWidthStyle as ze } from "./controlWidth.js";
|
|
13
|
+
import { getTriggerVisual as it, DROPDOWN_TRIGGER_ATTR as Pe } from "./dropdownTriggerStyle.js";
|
|
14
|
+
import { pushEscapeLayer as at } from "./escapeLayers.js";
|
|
15
|
+
import { measureMenuGeometry as ot, isTriggerOffscreen as lt, rectSignature as st, MENU_MAX_HEIGHT_PX as ct, MENU_SPECS as le } from "./floatingMenuGeometry.js";
|
|
16
|
+
import { ensureDropdownPanelStyles as dt } from "./optionRowStyles.js";
|
|
17
|
+
import { overlayIdentity as ut } from "./portalOverlay.js";
|
|
18
|
+
import { useTopLayer as pt } from "./topLayer.js";
|
|
19
|
+
const Me = {
|
|
19
20
|
display: "flex",
|
|
20
21
|
alignItems: "center",
|
|
21
22
|
justifyContent: "center",
|
|
22
23
|
gap: 8,
|
|
23
24
|
padding: "24px 16px",
|
|
24
25
|
color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
|
|
25
|
-
},
|
|
26
|
-
const r =
|
|
27
|
-
return x || l ||
|
|
28
|
-
},
|
|
26
|
+
}, Ce = "var(--malachite-font-size-xsmall, 11px)", ht = "[data-dropdown-option]", _e = (t) => Array.from((t == null ? void 0 : t.querySelectorAll(ht)) ?? []), ft = (t, i) => {
|
|
27
|
+
const r = i.toLowerCase(), x = t.label.toLowerCase().includes(r), l = t.subtitle ? t.subtitle.toLowerCase().includes(r) : !1, u = t.rightSideText ? t.rightSideText.toLowerCase().includes(r) : !1;
|
|
28
|
+
return x || l || u;
|
|
29
|
+
}, se = {
|
|
29
30
|
small: "h-[var(--malachite-control-height-small,28px)]",
|
|
30
31
|
medium: "h-[var(--malachite-control-height-medium,32px)]",
|
|
31
32
|
large: "h-[var(--malachite-control-height-large,42px)]"
|
|
32
|
-
},
|
|
33
|
-
small: `${
|
|
34
|
-
medium: `${
|
|
35
|
-
large: `${
|
|
36
|
-
},
|
|
37
|
-
small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${
|
|
38
|
-
medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${
|
|
39
|
-
large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${
|
|
40
|
-
},
|
|
33
|
+
}, gt = {
|
|
34
|
+
small: `${se.small} px-2.5 py-1.5 ${Q.small}`,
|
|
35
|
+
medium: `${se.medium} px-3 py-1.5 ${Q.medium}`,
|
|
36
|
+
large: `${se.large} px-4 py-2.5 ${Q.large}`
|
|
37
|
+
}, mt = {
|
|
38
|
+
small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${Q.small}`,
|
|
39
|
+
medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${Q.medium}`,
|
|
40
|
+
large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${Q.large}`
|
|
41
|
+
}, xt = {
|
|
41
42
|
small: "right-[26px] size-4",
|
|
42
43
|
medium: "right-[30px] size-4",
|
|
43
44
|
large: "right-[38px] size-4"
|
|
44
|
-
},
|
|
45
|
+
}, vt = {
|
|
45
46
|
small: "top-[calc(var(--malachite-control-height-small,28px)/2)] -translate-y-1/2",
|
|
46
47
|
medium: "top-[calc(var(--malachite-control-height-medium,32px)/2)] -translate-y-1/2",
|
|
47
48
|
large: "top-[calc(var(--malachite-control-height-large,42px)/2)] -translate-y-1/2"
|
|
48
|
-
},
|
|
49
|
+
}, yt = {
|
|
49
50
|
small: "rounded-[var(--malachite-radius-10,10px)]",
|
|
50
51
|
medium: "rounded-xl",
|
|
51
52
|
large: "rounded-[var(--malachite-radius-xxl,14px)]"
|
|
52
|
-
},
|
|
53
|
+
}, Fe = () => !1, bt = {
|
|
53
54
|
display: "flex",
|
|
54
55
|
flexDirection: "column",
|
|
55
56
|
gap: 4
|
|
56
|
-
},
|
|
57
|
-
/* @__PURE__ */ e("span", { children:
|
|
57
|
+
}, wt = (t, i, r) => t === "value" ? i : t === "subtitle" ? r : /* @__PURE__ */ m("span", { style: bt, children: [
|
|
58
|
+
/* @__PURE__ */ e("span", { children: i }),
|
|
58
59
|
/* @__PURE__ */ e("span", { children: r })
|
|
59
|
-
] }),
|
|
60
|
+
] }), St = ({
|
|
60
61
|
wrap: t,
|
|
61
|
-
id:
|
|
62
|
+
id: i,
|
|
62
63
|
children: r
|
|
63
|
-
}) => t ? /* @__PURE__ */ e("span", { id:
|
|
64
|
+
}) => t ? /* @__PURE__ */ e("span", { id: i, className: "min-w-0 flex items-center gap-2", children: r }) : /* @__PURE__ */ e(ce, { children: r }), Tt = ({ row: t, children: i }) => t ? /* @__PURE__ */ e("span", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: i }) : /* @__PURE__ */ e(ce, { children: i }), je = Ge.forwardRef(
|
|
64
65
|
({
|
|
65
66
|
isOpen: t,
|
|
66
|
-
onClick:
|
|
67
|
+
onClick: i,
|
|
67
68
|
selectedItem: r,
|
|
68
69
|
disabled: x = !1,
|
|
69
70
|
error: l = !1,
|
|
70
|
-
tone:
|
|
71
|
-
placeholder:
|
|
71
|
+
tone: u,
|
|
72
|
+
placeholder: N,
|
|
72
73
|
search: v = !1,
|
|
73
74
|
showSubtitleInTrigger: y = !1,
|
|
74
|
-
searchQuery:
|
|
75
|
+
searchQuery: k = "",
|
|
75
76
|
onSearchChange: _,
|
|
76
|
-
onFocusOpen:
|
|
77
|
-
onArrowDown:
|
|
78
|
-
size:
|
|
79
|
-
hasClear:
|
|
77
|
+
onFocusOpen: L,
|
|
78
|
+
onArrowDown: E,
|
|
79
|
+
size: f = "large",
|
|
80
|
+
hasClear: b = !1,
|
|
80
81
|
onClear: o,
|
|
81
|
-
clearLabel:
|
|
82
|
+
clearLabel: w,
|
|
82
83
|
controlId: s,
|
|
83
|
-
labelId:
|
|
84
|
-
describedBy:
|
|
85
|
-
required:
|
|
86
|
-
ariaLabel:
|
|
87
|
-
ariaLabelledBy:
|
|
88
|
-
hasCallerId:
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
a.key === "ArrowDown" && (a.preventDefault(),
|
|
92
|
-
},
|
|
93
|
-
const a =
|
|
84
|
+
labelId: c,
|
|
85
|
+
describedBy: $,
|
|
86
|
+
required: d = !1,
|
|
87
|
+
ariaLabel: D,
|
|
88
|
+
ariaLabelledBy: de,
|
|
89
|
+
hasCallerId: be = !1
|
|
90
|
+
}, R) => {
|
|
91
|
+
const j = y && !v && !!(r != null && r.subtitle), Z = j ? mt[f] : gt[f], J = yt[f], O = `${s}-value`, ue = `${s}-subtitle`, we = !c && !D && !be && j, pe = de ?? (c && !D ? `${c} ${O}` : void 0) ?? (we ? O : void 0), ee = (a) => {
|
|
92
|
+
a.key === "ArrowDown" && (a.preventDefault(), E == null || E());
|
|
93
|
+
}, K = T(null), te = T(null), q = it({ disabled: x, error: l, tone: u, open: t }), C = !t && !!r, g = (r == null ? void 0 : r.triggerLabel) ?? (r == null ? void 0 : r.label), S = j ? r == null ? void 0 : r.subtitle : void 0, W = () => {
|
|
94
|
+
const a = K.current;
|
|
94
95
|
return !!a && a.scrollWidth > a.clientWidth;
|
|
95
|
-
},
|
|
96
|
-
const a =
|
|
96
|
+
}, re = () => {
|
|
97
|
+
const a = te.current;
|
|
97
98
|
return !!a && a.scrollWidth > a.clientWidth;
|
|
98
|
-
}, [
|
|
99
|
-
const a =
|
|
100
|
-
return !a && !
|
|
99
|
+
}, [z, he] = Y("subtitle"), Se = () => {
|
|
100
|
+
const a = W(), I = re();
|
|
101
|
+
return !a && !I ? !1 : (he(a && I ? "both" : a ? "value" : "subtitle"), !0);
|
|
101
102
|
};
|
|
102
103
|
if (v && !x)
|
|
103
104
|
return /* @__PURE__ */ m(
|
|
104
105
|
"div",
|
|
105
106
|
{
|
|
106
|
-
ref:
|
|
107
|
+
ref: R,
|
|
107
108
|
className: `
|
|
108
|
-
relative w-full ${
|
|
109
|
+
relative w-full ${Z} ${J}
|
|
109
110
|
border border-solid
|
|
110
111
|
transition-all duration-200
|
|
111
112
|
flex items-center
|
|
112
113
|
`,
|
|
113
|
-
style:
|
|
114
|
-
[
|
|
114
|
+
style: q,
|
|
115
|
+
[Pe]: "",
|
|
115
116
|
onClick: (a) => a.stopPropagation(),
|
|
116
117
|
children: [
|
|
117
118
|
(r == null ? void 0 : r.icon) && /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center justify-center pr-2", children: r.icon }),
|
|
118
|
-
/* @__PURE__ */ e(
|
|
119
|
-
|
|
119
|
+
/* @__PURE__ */ e(ye, { text: g, shouldShow: W, isShrinkable: !0, fill: !0, children: /* @__PURE__ */ m("div", { className: "relative flex-1 flex items-center min-w-0", children: [
|
|
120
|
+
C && /* @__PURE__ */ e(
|
|
120
121
|
"span",
|
|
121
122
|
{
|
|
122
123
|
"aria-hidden": "true",
|
|
@@ -124,10 +125,10 @@ const Ft = {
|
|
|
124
125
|
children: /* @__PURE__ */ e(
|
|
125
126
|
"span",
|
|
126
127
|
{
|
|
127
|
-
ref:
|
|
128
|
+
ref: K,
|
|
128
129
|
className: `min-w-0 block truncate text-[length:inherit]
|
|
129
130
|
text-[var(--malachite-text-primary)]`,
|
|
130
|
-
children:
|
|
131
|
+
children: g
|
|
131
132
|
}
|
|
132
133
|
)
|
|
133
134
|
}
|
|
@@ -137,37 +138,37 @@ const Ft = {
|
|
|
137
138
|
{
|
|
138
139
|
id: s,
|
|
139
140
|
type: "text",
|
|
140
|
-
"aria-label":
|
|
141
|
-
"aria-labelledby":
|
|
141
|
+
"aria-label": D,
|
|
142
|
+
"aria-labelledby": de,
|
|
142
143
|
"aria-invalid": l || void 0,
|
|
143
|
-
"aria-required":
|
|
144
|
-
"aria-describedby":
|
|
145
|
-
value: t ?
|
|
144
|
+
"aria-required": d || void 0,
|
|
145
|
+
"aria-describedby": $,
|
|
146
|
+
value: t ? k : (r == null ? void 0 : r.label) ?? "",
|
|
146
147
|
onChange: (a) => {
|
|
147
|
-
a.stopPropagation(), _ == null || _(a.target.value), t ||
|
|
148
|
+
a.stopPropagation(), _ == null || _(a.target.value), t || i();
|
|
148
149
|
},
|
|
149
150
|
onFocus: () => {
|
|
150
|
-
|
|
151
|
+
L == null || L();
|
|
151
152
|
},
|
|
152
|
-
onKeyDown:
|
|
153
|
-
placeholder:
|
|
154
|
-
className: `flex-1 bg-transparent outline-none
|
|
153
|
+
onKeyDown: ee,
|
|
154
|
+
placeholder: N ?? "Select Field",
|
|
155
|
+
className: `flex-1 min-w-0 bg-transparent outline-none
|
|
155
156
|
text-[length:inherit] font-normal
|
|
156
|
-
placeholder:text-[var(--malachite-text-dimmed)] ${
|
|
157
|
+
placeholder:text-[var(--malachite-text-dimmed)] ${C ? "text-transparent" : "text-[var(--malachite-text-primary)]"}`
|
|
157
158
|
}
|
|
158
159
|
)
|
|
159
160
|
] }) }),
|
|
160
|
-
|
|
161
|
+
b && /* @__PURE__ */ e(
|
|
161
162
|
"button",
|
|
162
163
|
{
|
|
163
164
|
type: "button",
|
|
164
|
-
"aria-label":
|
|
165
|
+
"aria-label": w,
|
|
165
166
|
onClick: o,
|
|
166
167
|
className: `flex shrink-0 items-center justify-center pl-2 cursor-pointer
|
|
167
168
|
bg-transparent border-none p-0 text-[var(--malachite-text-placeholder)]
|
|
168
169
|
hover:text-[var(--malachite-text-primary)] transition-colors
|
|
169
170
|
rounded-full focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2`,
|
|
170
|
-
children: /* @__PURE__ */ e(
|
|
171
|
+
children: /* @__PURE__ */ e(He, { size: 13 })
|
|
171
172
|
}
|
|
172
173
|
),
|
|
173
174
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-center pl-2", children: /* @__PURE__ */ e(
|
|
@@ -177,11 +178,11 @@ const Ft = {
|
|
|
177
178
|
tabIndex: -1,
|
|
178
179
|
"aria-label": t ? "Close options" : "Open options",
|
|
179
180
|
onClick: (a) => {
|
|
180
|
-
a.stopPropagation(),
|
|
181
|
+
a.stopPropagation(), i();
|
|
181
182
|
},
|
|
182
183
|
className: "flex items-center justify-center cursor-pointer bg-transparent border-none p-0",
|
|
183
184
|
children: /* @__PURE__ */ e(
|
|
184
|
-
|
|
185
|
+
Oe,
|
|
185
186
|
{
|
|
186
187
|
size: 13,
|
|
187
188
|
style: {
|
|
@@ -196,29 +197,29 @@ const Ft = {
|
|
|
196
197
|
]
|
|
197
198
|
}
|
|
198
199
|
);
|
|
199
|
-
const
|
|
200
|
+
const ne = /* @__PURE__ */ m(
|
|
200
201
|
"button",
|
|
201
202
|
{
|
|
202
|
-
ref:
|
|
203
|
+
ref: R,
|
|
203
204
|
id: s,
|
|
204
205
|
type: "button",
|
|
205
|
-
"aria-label":
|
|
206
|
-
"aria-labelledby":
|
|
206
|
+
"aria-label": D,
|
|
207
|
+
"aria-labelledby": pe,
|
|
207
208
|
"aria-invalid": l || void 0,
|
|
208
|
-
"aria-required":
|
|
209
|
-
"aria-describedby": [
|
|
209
|
+
"aria-required": d || void 0,
|
|
210
|
+
"aria-describedby": [$, S ? ue : void 0].filter(Boolean).join(" ") || void 0,
|
|
210
211
|
onClick: (a) => {
|
|
211
|
-
a.stopPropagation(),
|
|
212
|
+
a.stopPropagation(), i();
|
|
212
213
|
},
|
|
213
|
-
onKeyDown:
|
|
214
|
+
onKeyDown: ee,
|
|
214
215
|
disabled: x,
|
|
215
|
-
style:
|
|
216
|
-
[
|
|
216
|
+
style: q,
|
|
217
|
+
[Pe]: "",
|
|
217
218
|
className: `
|
|
218
|
-
relative w-full ${
|
|
219
|
+
relative w-full ${Z} ${J}
|
|
219
220
|
border border-solid
|
|
220
221
|
transition-all duration-200
|
|
221
|
-
flex ${
|
|
222
|
+
flex ${j ? "items-start" : "items-center"} gap-3
|
|
222
223
|
cursor-pointer
|
|
223
224
|
disabled:cursor-not-allowed
|
|
224
225
|
`,
|
|
@@ -226,50 +227,50 @@ const Ft = {
|
|
|
226
227
|
/* @__PURE__ */ e(
|
|
227
228
|
"span",
|
|
228
229
|
{
|
|
229
|
-
id:
|
|
230
|
-
className: `text-left flex-1 min-w-0 flex ${
|
|
231
|
-
children: r ? /* @__PURE__ */ m(
|
|
232
|
-
/* @__PURE__ */ m(
|
|
230
|
+
id: S ? void 0 : O,
|
|
231
|
+
className: `text-left flex-1 min-w-0 flex ${S ? "flex-col gap-1" : "items-center gap-2"}`,
|
|
232
|
+
children: r ? /* @__PURE__ */ m(ce, { children: [
|
|
233
|
+
/* @__PURE__ */ m(St, { wrap: !!S, id: O, children: [
|
|
233
234
|
r.icon && /* @__PURE__ */ e("span", { className: "flex items-center justify-center shrink-0", children: r.icon }),
|
|
234
235
|
/* @__PURE__ */ e(
|
|
235
|
-
|
|
236
|
+
ye,
|
|
236
237
|
{
|
|
237
|
-
text:
|
|
238
|
-
shouldShow:
|
|
239
|
-
triggerAs:
|
|
238
|
+
text: g,
|
|
239
|
+
shouldShow: S ? Fe : W,
|
|
240
|
+
triggerAs: S ? "span" : "div",
|
|
240
241
|
isShrinkable: !0,
|
|
241
242
|
children: /* @__PURE__ */ e(
|
|
242
243
|
"span",
|
|
243
244
|
{
|
|
244
|
-
ref:
|
|
245
|
+
ref: K,
|
|
245
246
|
className: `min-w-0 block truncate text-[length:inherit] ${x ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-primary)]"}`,
|
|
246
|
-
children:
|
|
247
|
+
children: g
|
|
247
248
|
}
|
|
248
249
|
)
|
|
249
250
|
}
|
|
250
251
|
)
|
|
251
252
|
] }),
|
|
252
|
-
|
|
253
|
+
S && /* @__PURE__ */ e(
|
|
253
254
|
"span",
|
|
254
255
|
{
|
|
255
|
-
id:
|
|
256
|
-
ref:
|
|
256
|
+
id: ue,
|
|
257
|
+
ref: te,
|
|
257
258
|
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",
|
|
258
|
-
children:
|
|
259
|
+
children: S
|
|
259
260
|
}
|
|
260
261
|
)
|
|
261
262
|
] }) : /* @__PURE__ */ e(
|
|
262
263
|
"span",
|
|
263
264
|
{
|
|
264
265
|
className: `flex-1 min-w-0 truncate text-[length:inherit] ${x ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-dimmed)]"}`,
|
|
265
|
-
children:
|
|
266
|
+
children: N ?? "Select Field"
|
|
266
267
|
}
|
|
267
268
|
)
|
|
268
269
|
}
|
|
269
270
|
),
|
|
270
|
-
|
|
271
|
+
b && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "shrink-0 w-4" }),
|
|
271
272
|
/* @__PURE__ */ e("span", { className: "flex items-center justify-center shrink-0", children: /* @__PURE__ */ e(
|
|
272
|
-
|
|
273
|
+
Oe,
|
|
273
274
|
{
|
|
274
275
|
size: 13,
|
|
275
276
|
style: {
|
|
@@ -283,28 +284,28 @@ const Ft = {
|
|
|
283
284
|
}
|
|
284
285
|
);
|
|
285
286
|
return y && !v ? /* @__PURE__ */ e(
|
|
286
|
-
|
|
287
|
+
ye,
|
|
287
288
|
{
|
|
288
|
-
text:
|
|
289
|
-
shouldShow:
|
|
289
|
+
text: wt(z, g, S),
|
|
290
|
+
shouldShow: S ? Se : Fe,
|
|
290
291
|
fill: !0,
|
|
291
292
|
describesTrigger: !1,
|
|
292
|
-
children:
|
|
293
|
+
children: ne
|
|
293
294
|
}
|
|
294
|
-
) :
|
|
295
|
+
) : ne;
|
|
295
296
|
}
|
|
296
297
|
);
|
|
297
|
-
|
|
298
|
-
const
|
|
298
|
+
je.displayName = "DropdownTrigger";
|
|
299
|
+
const Et = ({
|
|
299
300
|
item: t,
|
|
300
|
-
selected:
|
|
301
|
+
selected: i,
|
|
301
302
|
subtitleLayout: r,
|
|
302
303
|
onItemSelected: x
|
|
303
304
|
}) => {
|
|
304
|
-
const l =
|
|
305
|
-
const
|
|
306
|
-
return !!
|
|
307
|
-
},
|
|
305
|
+
const l = i ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))", u = r === "stacked" && !!t.subtitle, N = `mal-${Ye().replace(/[^a-zA-Z0-9_-]/g, "")}`, v = `${N}-label`, y = `${N}-subtitle`, k = T(null), _ = () => {
|
|
306
|
+
const b = k.current;
|
|
307
|
+
return !!b && b.scrollWidth > b.clientWidth + 1;
|
|
308
|
+
}, 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))", E = t.rightSideTextAlignment === "left" ? "flex-start" : "flex-end", f = (
|
|
308
309
|
// `role="option"` would be invalid — nothing here declares a `listbox`, and an
|
|
309
310
|
// orphaned option is dropped from the a11y tree. `aria-current`, not
|
|
310
311
|
// `aria-pressed`: these are one-of-many choices, not toggles. tabIndex={-1}
|
|
@@ -315,13 +316,13 @@ const Te = ({
|
|
|
315
316
|
{
|
|
316
317
|
type: "button",
|
|
317
318
|
"data-dropdown-option": "",
|
|
318
|
-
"data-selected":
|
|
319
|
-
"aria-current":
|
|
319
|
+
"data-selected": i,
|
|
320
|
+
"aria-current": i || void 0,
|
|
320
321
|
"aria-labelledby": t.subtitle ? v : void 0,
|
|
321
322
|
"aria-describedby": t.subtitle ? y : void 0,
|
|
322
323
|
tabIndex: -1,
|
|
323
|
-
onClick: (
|
|
324
|
-
|
|
324
|
+
onClick: (b) => {
|
|
325
|
+
b.stopPropagation(), x(t);
|
|
325
326
|
},
|
|
326
327
|
className: "malachite-dropdown-option",
|
|
327
328
|
style: {
|
|
@@ -348,15 +349,15 @@ const Te = ({
|
|
|
348
349
|
display: "flex",
|
|
349
350
|
alignItems: "center",
|
|
350
351
|
gap: 12,
|
|
351
|
-
...
|
|
352
|
+
...u ? { minWidth: 0 } : {}
|
|
352
353
|
},
|
|
353
354
|
children: [
|
|
354
|
-
/* @__PURE__ */ e("span", { style: { flex: 1, display: "block", ...
|
|
355
|
+
/* @__PURE__ */ e("span", { style: { flex: 1, display: "block", ...u ? { minWidth: 0 } : {} }, children: /* @__PURE__ */ m(
|
|
355
356
|
"span",
|
|
356
357
|
{
|
|
357
|
-
style:
|
|
358
|
+
style: u ? { display: "flex", flexDirection: "column", gap: 2 } : { display: "flex", alignItems: "center", gap: 8 },
|
|
358
359
|
children: [
|
|
359
|
-
/* @__PURE__ */ m(
|
|
360
|
+
/* @__PURE__ */ m(Tt, { row: u && !!t.icon, children: [
|
|
360
361
|
t.icon && /* @__PURE__ */ e(
|
|
361
362
|
"span",
|
|
362
363
|
{
|
|
@@ -385,28 +386,28 @@ const Te = ({
|
|
|
385
386
|
}
|
|
386
387
|
)
|
|
387
388
|
] }),
|
|
388
|
-
t.subtitle && (
|
|
389
|
+
t.subtitle && (u ? /* @__PURE__ */ e(
|
|
389
390
|
"span",
|
|
390
391
|
{
|
|
391
392
|
id: y,
|
|
392
|
-
ref:
|
|
393
|
+
ref: k,
|
|
393
394
|
style: {
|
|
394
|
-
fontSize:
|
|
395
|
+
fontSize: Ce,
|
|
395
396
|
fontWeight: 400,
|
|
396
397
|
lineHeight: 1.4,
|
|
397
|
-
color:
|
|
398
|
+
color: i ? l : "var(--malachite-text-dimmed, rgb(161, 161, 161))",
|
|
398
399
|
whiteSpace: "nowrap",
|
|
399
400
|
overflow: "hidden",
|
|
400
401
|
textOverflow: "ellipsis"
|
|
401
402
|
},
|
|
402
403
|
children: t.subtitle
|
|
403
404
|
}
|
|
404
|
-
) : /* @__PURE__ */ m(
|
|
405
|
+
) : /* @__PURE__ */ m(ce, { children: [
|
|
405
406
|
/* @__PURE__ */ e(
|
|
406
407
|
"span",
|
|
407
408
|
{
|
|
408
409
|
style: {
|
|
409
|
-
fontSize:
|
|
410
|
+
fontSize: Ce,
|
|
410
411
|
fontWeight: 400,
|
|
411
412
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
412
413
|
flexShrink: 0
|
|
@@ -419,7 +420,7 @@ const Te = ({
|
|
|
419
420
|
{
|
|
420
421
|
id: y,
|
|
421
422
|
style: {
|
|
422
|
-
fontSize:
|
|
423
|
+
fontSize: Ce,
|
|
423
424
|
fontWeight: 400,
|
|
424
425
|
color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
425
426
|
whiteSpace: "nowrap",
|
|
@@ -443,7 +444,7 @@ const Te = ({
|
|
|
443
444
|
minWidth: t.rightSideText ? "var(--malachite-text-right-side-text-min-width, 80px)" : 0,
|
|
444
445
|
flexShrink: 1,
|
|
445
446
|
display: "flex",
|
|
446
|
-
justifyContent:
|
|
447
|
+
justifyContent: E
|
|
447
448
|
},
|
|
448
449
|
children: t.rightSideText && /* @__PURE__ */ e(
|
|
449
450
|
"span",
|
|
@@ -451,7 +452,7 @@ const Te = ({
|
|
|
451
452
|
style: {
|
|
452
453
|
fontSize: "var(--malachite-text-right-side-text-font-size, 12px)",
|
|
453
454
|
fontWeight: 400,
|
|
454
|
-
color:
|
|
455
|
+
color: L,
|
|
455
456
|
whiteSpace: "nowrap",
|
|
456
457
|
overflow: "hidden",
|
|
457
458
|
textOverflow: "ellipsis",
|
|
@@ -468,95 +469,96 @@ const Te = ({
|
|
|
468
469
|
}
|
|
469
470
|
)
|
|
470
471
|
);
|
|
471
|
-
return
|
|
472
|
-
|
|
472
|
+
return u ? /* @__PURE__ */ e(
|
|
473
|
+
ye,
|
|
473
474
|
{
|
|
474
475
|
text: t.subtitle,
|
|
475
476
|
shouldShow: _,
|
|
476
477
|
isShrinkable: !0,
|
|
477
478
|
describesTrigger: !1,
|
|
478
|
-
children:
|
|
479
|
+
children: f
|
|
479
480
|
}
|
|
480
|
-
) :
|
|
481
|
-
},
|
|
481
|
+
) : f;
|
|
482
|
+
}, Ze = Ge.forwardRef((t, i) => {
|
|
482
483
|
const {
|
|
483
484
|
items: r,
|
|
484
485
|
onItemSelected: x,
|
|
485
486
|
selectedItem: l,
|
|
486
|
-
menuLoading:
|
|
487
|
-
emptyMessage:
|
|
487
|
+
menuLoading: u,
|
|
488
|
+
emptyMessage: N,
|
|
488
489
|
autoFocus: v,
|
|
489
490
|
positioned: y,
|
|
490
|
-
onDismiss:
|
|
491
|
+
onDismiss: k,
|
|
491
492
|
subtitleLayout: _,
|
|
492
|
-
size:
|
|
493
|
-
style:
|
|
494
|
-
} = t,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}, []),
|
|
493
|
+
size: L,
|
|
494
|
+
style: E
|
|
495
|
+
} = t, f = T(null);
|
|
496
|
+
Xe(() => {
|
|
497
|
+
dt();
|
|
498
|
+
}, []), pt(f, !0), Ne(() => {
|
|
498
499
|
var s;
|
|
499
500
|
if (!v || !y)
|
|
500
501
|
return;
|
|
501
|
-
const o =
|
|
502
|
-
(s = o.find((
|
|
502
|
+
const o = _e(f.current);
|
|
503
|
+
(s = o.find((c) => c.dataset.selected === "true") ?? o[0] ?? f.current) == null || s.focus();
|
|
503
504
|
}, [v, y]);
|
|
504
|
-
const
|
|
505
|
-
var
|
|
505
|
+
const b = (o) => {
|
|
506
|
+
var $;
|
|
506
507
|
if (o.key === "Tab") {
|
|
507
|
-
|
|
508
|
+
k();
|
|
508
509
|
return;
|
|
509
510
|
}
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
511
|
+
const w = _e(f.current);
|
|
512
|
+
if (w.length === 0)
|
|
512
513
|
return;
|
|
513
|
-
const s =
|
|
514
|
+
const s = w.indexOf(document.activeElement), c = {
|
|
514
515
|
ArrowDown: s + 1,
|
|
515
516
|
ArrowUp: s - 1,
|
|
516
517
|
Home: 0,
|
|
517
|
-
End:
|
|
518
|
+
End: w.length - 1
|
|
518
519
|
}[o.key];
|
|
519
|
-
|
|
520
|
+
c !== void 0 && (o.preventDefault(), ($ = w[Math.min(Math.max(c, 0), w.length - 1)]) == null || $.focus());
|
|
520
521
|
};
|
|
521
522
|
return /* @__PURE__ */ e(
|
|
522
523
|
"div",
|
|
523
524
|
{
|
|
524
525
|
ref: (o) => {
|
|
525
|
-
|
|
526
|
+
f.current = o, typeof i == "function" ? i(o) : i && (i.current = o);
|
|
526
527
|
},
|
|
527
|
-
...
|
|
528
|
+
...ut("dropdown"),
|
|
528
529
|
tabIndex: -1,
|
|
529
|
-
onKeyDown:
|
|
530
|
+
onKeyDown: b,
|
|
530
531
|
style: {
|
|
531
|
-
background:
|
|
532
|
-
border:
|
|
533
|
-
borderRadius:
|
|
534
|
-
boxShadow:
|
|
535
|
-
maxHeight:
|
|
532
|
+
background: le.standard.background,
|
|
533
|
+
border: le.standard.border,
|
|
534
|
+
borderRadius: le.standard.radius,
|
|
535
|
+
boxShadow: le.standard.shadow,
|
|
536
|
+
maxHeight: ct,
|
|
536
537
|
overflow: "hidden",
|
|
537
|
-
|
|
538
|
-
|
|
538
|
+
display: "flex",
|
|
539
|
+
flexDirection: "column",
|
|
540
|
+
fontSize: nt[L],
|
|
541
|
+
...E
|
|
539
542
|
},
|
|
540
|
-
children:
|
|
541
|
-
/* @__PURE__ */ e(
|
|
543
|
+
children: u ? /* @__PURE__ */ m("div", { style: Me, children: [
|
|
544
|
+
/* @__PURE__ */ e(rt, { size: "xxxsmall" }),
|
|
542
545
|
/* @__PURE__ */ e("span", { children: "Loading…" })
|
|
543
|
-
] }) : r.length === 0 ? /* @__PURE__ */ e("div", { style:
|
|
546
|
+
] }) : r.length === 0 ? /* @__PURE__ */ e("div", { style: Me, children: N }) : /* @__PURE__ */ e(
|
|
544
547
|
"div",
|
|
545
548
|
{
|
|
546
549
|
style: {
|
|
547
550
|
display: "flex",
|
|
548
551
|
flexDirection: "column",
|
|
549
552
|
gap: 4,
|
|
550
|
-
padding:
|
|
551
|
-
maxHeight: 400,
|
|
553
|
+
padding: le.standard.padding,
|
|
552
554
|
overflowY: "auto",
|
|
553
555
|
scrollbarWidth: "thin",
|
|
554
556
|
scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent"
|
|
555
557
|
},
|
|
556
|
-
children: r.map((o,
|
|
557
|
-
const s = r[
|
|
558
|
+
children: r.map((o, w) => {
|
|
559
|
+
const s = r[w - 1], c = !!o.group && (!s || s.group !== o.group);
|
|
558
560
|
return /* @__PURE__ */ m("div", { style: { flexShrink: 0 }, children: [
|
|
559
|
-
|
|
561
|
+
c && /* @__PURE__ */ e(
|
|
560
562
|
"div",
|
|
561
563
|
{
|
|
562
564
|
style: {
|
|
@@ -571,7 +573,7 @@ const Te = ({
|
|
|
571
573
|
}
|
|
572
574
|
),
|
|
573
575
|
/* @__PURE__ */ e(
|
|
574
|
-
|
|
576
|
+
Et,
|
|
575
577
|
{
|
|
576
578
|
item: o,
|
|
577
579
|
onItemSelected: x,
|
|
@@ -586,242 +588,254 @@ const Te = ({
|
|
|
586
588
|
}
|
|
587
589
|
);
|
|
588
590
|
});
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
+
Ze.displayName = "DropdownPanel";
|
|
592
|
+
const Zt = ({
|
|
591
593
|
items: t,
|
|
592
|
-
onItemSelected:
|
|
594
|
+
onItemSelected: i,
|
|
593
595
|
defaultValue: r,
|
|
594
596
|
value: x,
|
|
595
597
|
disabled: l = !1,
|
|
596
|
-
error:
|
|
597
|
-
tone:
|
|
598
|
+
error: u,
|
|
599
|
+
tone: N,
|
|
598
600
|
label: v,
|
|
599
601
|
hint: y,
|
|
600
|
-
rightSideContent:
|
|
602
|
+
rightSideContent: k,
|
|
601
603
|
tooltip: _,
|
|
602
|
-
name:
|
|
603
|
-
required:
|
|
604
|
-
requiredIndicator:
|
|
605
|
-
loading:
|
|
604
|
+
name: L,
|
|
605
|
+
required: E = !1,
|
|
606
|
+
requiredIndicator: f,
|
|
607
|
+
loading: b,
|
|
606
608
|
menuLoading: o,
|
|
607
|
-
formControl:
|
|
609
|
+
formControl: w,
|
|
608
610
|
description: s,
|
|
609
|
-
helperText:
|
|
610
|
-
placeholder:
|
|
611
|
-
search:
|
|
612
|
-
showSubtitleInTrigger:
|
|
613
|
-
subtitleLayout:
|
|
614
|
-
clearable:
|
|
615
|
-
size:
|
|
616
|
-
fullWidth:
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
611
|
+
helperText: c,
|
|
612
|
+
placeholder: $,
|
|
613
|
+
search: d = !1,
|
|
614
|
+
showSubtitleInTrigger: D = !1,
|
|
615
|
+
subtitleLayout: de = "inline",
|
|
616
|
+
clearable: be = !1,
|
|
617
|
+
size: R = "large",
|
|
618
|
+
fullWidth: j = !1,
|
|
619
|
+
width: Z,
|
|
620
|
+
minWidth: J,
|
|
621
|
+
id: O,
|
|
622
|
+
"aria-label": ue,
|
|
623
|
+
"aria-labelledby": we
|
|
620
624
|
}) => {
|
|
621
|
-
const { controlId:
|
|
622
|
-
id:
|
|
625
|
+
const { controlId: pe, labelId: ee, descriptionId: K, hintId: te, helperTextId: q } = et({
|
|
626
|
+
id: O,
|
|
623
627
|
label: v,
|
|
624
628
|
description: s,
|
|
625
629
|
hint: y,
|
|
626
630
|
helperText: !0
|
|
627
|
-
}), [
|
|
628
|
-
|
|
629
|
-
|
|
631
|
+
}), [C, g] = Y(!1), [S, W] = Y(r), re = x ?? S, z = t.find((n) => n.id === re), he = be && re !== void 0 && re !== "" && !l, Se = D && !d && !!(z != null && z.subtitle), ne = `Clear ${v ?? $ ?? "selection"}`, a = T(r);
|
|
632
|
+
Ne(() => {
|
|
633
|
+
a.current !== r && (a.current = r, W(r));
|
|
630
634
|
}, [r]);
|
|
631
|
-
const [
|
|
632
|
-
var
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
}, []),
|
|
636
|
-
(
|
|
637
|
-
var
|
|
638
|
-
|
|
635
|
+
const [I, V] = Y(""), [Ke, Le] = Y(!1), Re = T(null), fe = T(null), B = T(null), [p, ke] = Y(null), ge = T(!0), U = Ee(() => {
|
|
636
|
+
var h;
|
|
637
|
+
const n = fe.current;
|
|
638
|
+
n && ((h = n instanceof HTMLButtonElement ? n : n.querySelector("input")) == null || h.focus());
|
|
639
|
+
}, []), $e = Ee(
|
|
640
|
+
(n) => {
|
|
641
|
+
var h;
|
|
642
|
+
n.stopPropagation(), W(void 0), (h = M.current) == null || h.call(M, Te.current), i == null || i(void 0), d && (ge.current = !1), U();
|
|
639
643
|
},
|
|
640
|
-
[
|
|
641
|
-
),
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
panelHeight: ((D = j.current) == null ? void 0 : D.offsetHeight) ?? 0,
|
|
649
|
-
size: kt.current,
|
|
650
|
-
fullWidth: $t.current,
|
|
644
|
+
[i, d, U]
|
|
645
|
+
), P = Ee(() => {
|
|
646
|
+
const n = fe.current;
|
|
647
|
+
n && ke(
|
|
648
|
+
ot(B.current, {
|
|
649
|
+
triggerRect: n.getBoundingClientRect(),
|
|
650
|
+
preset: "standard",
|
|
651
|
+
minWidth: J,
|
|
651
652
|
viewportWidth: window.innerWidth,
|
|
652
653
|
viewportHeight: window.innerHeight
|
|
653
654
|
})
|
|
654
655
|
);
|
|
655
|
-
}, []);
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
if (!T) {
|
|
660
|
-
Rt(null), Lt(!1);
|
|
656
|
+
}, [J]);
|
|
657
|
+
Ne(() => {
|
|
658
|
+
if (!C) {
|
|
659
|
+
ke(null), Le(!1);
|
|
661
660
|
return;
|
|
662
661
|
}
|
|
663
|
-
|
|
664
|
-
const
|
|
665
|
-
var
|
|
666
|
-
const
|
|
667
|
-
!
|
|
668
|
-
},
|
|
669
|
-
|
|
670
|
-
}),
|
|
671
|
-
let
|
|
672
|
-
const
|
|
673
|
-
const
|
|
674
|
-
if (
|
|
675
|
-
const
|
|
676
|
-
if (
|
|
677
|
-
|
|
662
|
+
P();
|
|
663
|
+
const n = (G) => {
|
|
664
|
+
var oe;
|
|
665
|
+
const A = G.composedPath(), H = Re.current, ae = B.current, ve = !!H && A.includes(H), Ae = !!ae && A.includes(ae);
|
|
666
|
+
!ve && !Ae && (g(!1), d && V(""), (oe = F.current) == null || oe.call(F));
|
|
667
|
+
}, h = at(() => {
|
|
668
|
+
g(!1), d && V(""), U();
|
|
669
|
+
}), X = () => P();
|
|
670
|
+
let ie = 0, me = "";
|
|
671
|
+
const xe = () => {
|
|
672
|
+
const G = fe.current;
|
|
673
|
+
if (G) {
|
|
674
|
+
const A = G.getBoundingClientRect();
|
|
675
|
+
if (lt(A, window.innerWidth, window.innerHeight)) {
|
|
676
|
+
g(!1), d && V("");
|
|
678
677
|
return;
|
|
679
678
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
679
|
+
const H = st(A);
|
|
680
|
+
H !== me && (me = H, P());
|
|
682
681
|
}
|
|
683
|
-
|
|
682
|
+
ie = requestAnimationFrame(xe);
|
|
684
683
|
};
|
|
685
|
-
return
|
|
686
|
-
cancelAnimationFrame(
|
|
684
|
+
return ie = requestAnimationFrame(xe), document.addEventListener("mousedown", n), window.addEventListener("scroll", X, !0), window.addEventListener("resize", X), () => {
|
|
685
|
+
cancelAnimationFrame(ie), document.removeEventListener("mousedown", n), h(), window.removeEventListener("scroll", X, !0), window.removeEventListener("resize", X);
|
|
687
686
|
};
|
|
688
|
-
}, [
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
687
|
+
}, [C, d, P, U]), Ue(() => {
|
|
688
|
+
if (!C)
|
|
689
|
+
return;
|
|
690
|
+
P();
|
|
691
|
+
const n = B.current;
|
|
692
|
+
if (!n || typeof ResizeObserver > "u")
|
|
693
|
+
return;
|
|
694
|
+
const h = new ResizeObserver(() => P());
|
|
695
|
+
return h.observe(n), () => h.disconnect();
|
|
696
|
+
}, [C, P]);
|
|
697
|
+
const M = T(void 0), F = T(void 0), Te = T(""), qe = (n) => {
|
|
698
|
+
var h;
|
|
699
|
+
W(n == null ? void 0 : n.id), (h = M.current) == null || h.call(M, (n == null ? void 0 : n.id) ?? Te.current), g(!1), d && (V(""), ge.current = !1), i == null || i(n == null ? void 0 : n.id), U();
|
|
700
|
+
}, Ie = () => {
|
|
701
|
+
g(!1), d && V(""), U();
|
|
702
|
+
}, Ve = () => {
|
|
703
|
+
const n = _e(B.current)[0];
|
|
704
|
+
if (n) {
|
|
705
|
+
n.focus();
|
|
700
706
|
return;
|
|
701
707
|
}
|
|
702
|
-
|
|
703
|
-
},
|
|
708
|
+
Le(!0), g(!0);
|
|
709
|
+
}, Be = d && I ? t.filter((n) => ft(n, I)) : t;
|
|
704
710
|
return /* @__PURE__ */ e(
|
|
705
|
-
|
|
711
|
+
Je,
|
|
706
712
|
{
|
|
707
|
-
fullWidth:
|
|
713
|
+
fullWidth: j,
|
|
708
714
|
label: v,
|
|
709
715
|
hint: y,
|
|
710
|
-
rightSideContent:
|
|
716
|
+
rightSideContent: k,
|
|
711
717
|
tooltip: _,
|
|
712
|
-
name:
|
|
713
|
-
required:
|
|
714
|
-
requiredIndicator:
|
|
715
|
-
loading:
|
|
716
|
-
formControl:
|
|
718
|
+
name: L,
|
|
719
|
+
required: E,
|
|
720
|
+
requiredIndicator: f,
|
|
721
|
+
loading: b,
|
|
722
|
+
formControl: w,
|
|
717
723
|
description: s,
|
|
718
|
-
controlId:
|
|
719
|
-
labelId:
|
|
720
|
-
descriptionId:
|
|
721
|
-
hintId:
|
|
722
|
-
loadingComponent: /* @__PURE__ */ e(
|
|
723
|
-
|
|
724
|
+
controlId: pe,
|
|
725
|
+
labelId: ee,
|
|
726
|
+
descriptionId: K,
|
|
727
|
+
hintId: te,
|
|
728
|
+
loadingComponent: Z === void 0 ? /* @__PURE__ */ e(
|
|
729
|
+
We,
|
|
730
|
+
{
|
|
731
|
+
heightClass: se[R],
|
|
732
|
+
helperText: !!c,
|
|
733
|
+
helperTextMarginTop: !0
|
|
734
|
+
}
|
|
735
|
+
) : /* @__PURE__ */ e("div", { style: ze(Z), children: /* @__PURE__ */ e(
|
|
736
|
+
We,
|
|
724
737
|
{
|
|
725
|
-
heightClass:
|
|
726
|
-
helperText: !!
|
|
738
|
+
heightClass: se[R],
|
|
739
|
+
helperText: !!c,
|
|
727
740
|
helperTextMarginTop: !0
|
|
728
741
|
}
|
|
729
|
-
),
|
|
730
|
-
children: ({ error:
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
742
|
+
) }),
|
|
743
|
+
children: ({ error: n, message: h, onFieldChange: X, onFieldBlur: ie, emptyValue: me }) => {
|
|
744
|
+
M.current = X, F.current = ie, Te.current = me;
|
|
745
|
+
const xe = u ?? n, G = u === !1 ? void 0 : h, A = `${q}-error`, H = [
|
|
746
|
+
K,
|
|
747
|
+
te,
|
|
748
|
+
c ? q : void 0,
|
|
749
|
+
G ? A : void 0
|
|
737
750
|
].filter(Boolean).join(" ") || void 0;
|
|
738
|
-
return /* @__PURE__ */ m(
|
|
751
|
+
return /* @__PURE__ */ m(ce, { children: [
|
|
739
752
|
/* @__PURE__ */ m(
|
|
740
753
|
"div",
|
|
741
754
|
{
|
|
742
|
-
ref:
|
|
755
|
+
ref: Re,
|
|
743
756
|
className: "relative w-full",
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
757
|
+
style: ze(Z),
|
|
758
|
+
onBlur: (ae) => {
|
|
759
|
+
var oe, De;
|
|
760
|
+
const ve = ae.relatedTarget;
|
|
761
|
+
ae.currentTarget.contains(ve) || ((oe = B.current) == null ? void 0 : oe.contains(ve)) === !0 || (De = F.current) == null || De.call(F);
|
|
748
762
|
},
|
|
749
763
|
children: [
|
|
750
|
-
|
|
764
|
+
he && !d && /* @__PURE__ */ e(
|
|
751
765
|
"button",
|
|
752
766
|
{
|
|
753
767
|
type: "button",
|
|
754
|
-
onClick:
|
|
755
|
-
"aria-label":
|
|
756
|
-
className: `absolute ${
|
|
768
|
+
onClick: $e,
|
|
769
|
+
"aria-label": ne,
|
|
770
|
+
className: `absolute ${Se ? vt[R] : "top-1/2 -translate-y-1/2"} z-10 flex items-center
|
|
757
771
|
justify-center rounded-full text-[var(--malachite-text-placeholder)]
|
|
758
772
|
hover:text-[var(--malachite-text-primary)] transition-colors
|
|
759
|
-
focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${
|
|
760
|
-
children: /* @__PURE__ */ e(
|
|
773
|
+
focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${xt[R]}`,
|
|
774
|
+
children: /* @__PURE__ */ e(He, { size: 13 })
|
|
761
775
|
}
|
|
762
776
|
),
|
|
763
777
|
/* @__PURE__ */ e(
|
|
764
|
-
|
|
778
|
+
je,
|
|
765
779
|
{
|
|
766
|
-
hasClear:
|
|
767
|
-
onClear:
|
|
768
|
-
clearLabel:
|
|
769
|
-
ref:
|
|
770
|
-
isOpen:
|
|
771
|
-
onClick: () => !l &&
|
|
772
|
-
selectedItem:
|
|
780
|
+
hasClear: he,
|
|
781
|
+
onClear: $e,
|
|
782
|
+
clearLabel: ne,
|
|
783
|
+
ref: fe,
|
|
784
|
+
isOpen: C,
|
|
785
|
+
onClick: () => !l && g(!C),
|
|
786
|
+
selectedItem: z,
|
|
773
787
|
disabled: l,
|
|
774
|
-
error:
|
|
775
|
-
tone:
|
|
776
|
-
placeholder:
|
|
777
|
-
search:
|
|
778
|
-
showSubtitleInTrigger:
|
|
779
|
-
searchQuery:
|
|
780
|
-
onSearchChange:
|
|
788
|
+
error: xe,
|
|
789
|
+
tone: N,
|
|
790
|
+
placeholder: $,
|
|
791
|
+
search: d,
|
|
792
|
+
showSubtitleInTrigger: D,
|
|
793
|
+
searchQuery: I,
|
|
794
|
+
onSearchChange: V,
|
|
781
795
|
onFocusOpen: () => {
|
|
782
|
-
if (!
|
|
783
|
-
|
|
796
|
+
if (!ge.current) {
|
|
797
|
+
ge.current = !0;
|
|
784
798
|
return;
|
|
785
799
|
}
|
|
786
|
-
|
|
800
|
+
g(!0);
|
|
787
801
|
},
|
|
788
802
|
onArrowDown: () => {
|
|
789
|
-
l ||
|
|
803
|
+
l || Ve();
|
|
790
804
|
},
|
|
791
|
-
size:
|
|
792
|
-
controlId:
|
|
793
|
-
hasCallerId: !!
|
|
794
|
-
labelId:
|
|
795
|
-
describedBy:
|
|
796
|
-
required:
|
|
797
|
-
ariaLabel:
|
|
798
|
-
ariaLabelledBy:
|
|
805
|
+
size: R,
|
|
806
|
+
controlId: pe,
|
|
807
|
+
hasCallerId: !!O,
|
|
808
|
+
labelId: ee,
|
|
809
|
+
describedBy: H,
|
|
810
|
+
required: E,
|
|
811
|
+
ariaLabel: ue,
|
|
812
|
+
ariaLabelledBy: we
|
|
799
813
|
}
|
|
800
814
|
),
|
|
801
|
-
|
|
815
|
+
C && Qe(
|
|
802
816
|
/* @__PURE__ */ e(
|
|
803
|
-
|
|
817
|
+
Ze,
|
|
804
818
|
{
|
|
805
|
-
ref:
|
|
819
|
+
ref: B,
|
|
806
820
|
style: {
|
|
807
821
|
position: "fixed",
|
|
808
|
-
top: (
|
|
809
|
-
left: (
|
|
810
|
-
width:
|
|
811
|
-
|
|
812
|
-
visibility:
|
|
813
|
-
opacity:
|
|
822
|
+
top: (p == null ? void 0 : p.top) ?? 0,
|
|
823
|
+
left: (p == null ? void 0 : p.left) ?? 0,
|
|
824
|
+
width: p == null ? void 0 : p.width,
|
|
825
|
+
maxHeight: p == null ? void 0 : p.maxHeight,
|
|
826
|
+
visibility: p ? "visible" : "hidden",
|
|
827
|
+
opacity: p ? 1 : 0
|
|
814
828
|
},
|
|
815
|
-
items:
|
|
816
|
-
onItemSelected:
|
|
817
|
-
selectedItem:
|
|
829
|
+
items: Be,
|
|
830
|
+
onItemSelected: qe,
|
|
831
|
+
selectedItem: z,
|
|
818
832
|
menuLoading: o,
|
|
819
833
|
emptyMessage: t.length === 0 ? "No options available" : "No results found",
|
|
820
|
-
subtitleLayout:
|
|
821
|
-
size:
|
|
822
|
-
autoFocus: !
|
|
823
|
-
positioned:
|
|
824
|
-
onDismiss:
|
|
834
|
+
subtitleLayout: de,
|
|
835
|
+
size: R,
|
|
836
|
+
autoFocus: !d || Ke,
|
|
837
|
+
positioned: p !== null,
|
|
838
|
+
onDismiss: Ie
|
|
825
839
|
}
|
|
826
840
|
),
|
|
827
841
|
document.body
|
|
@@ -829,21 +843,21 @@ const He = ({
|
|
|
829
843
|
]
|
|
830
844
|
}
|
|
831
845
|
),
|
|
832
|
-
|
|
846
|
+
c && /* @__PURE__ */ e(
|
|
833
847
|
"div",
|
|
834
848
|
{
|
|
835
|
-
id:
|
|
849
|
+
id: q,
|
|
836
850
|
className: "mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))]",
|
|
837
|
-
children:
|
|
851
|
+
children: c
|
|
838
852
|
}
|
|
839
853
|
),
|
|
840
|
-
/* @__PURE__ */ e(
|
|
854
|
+
/* @__PURE__ */ e(tt, { id: A, message: G, spaced: !0 })
|
|
841
855
|
] });
|
|
842
856
|
}
|
|
843
857
|
}
|
|
844
858
|
);
|
|
845
859
|
};
|
|
846
860
|
export {
|
|
847
|
-
|
|
861
|
+
Zt as Dropdown
|
|
848
862
|
};
|
|
849
863
|
//# sourceMappingURL=Dropdown.js.map
|