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