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