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