@stackone/malachite 2.116.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.
Files changed (48) hide show
  1. package/COMPONENTS.md +18 -8
  2. package/dist/assets/icons/caret_down.svg.js +2 -2
  3. package/dist/assets/icons/caret_down.svg.js.map +1 -1
  4. package/dist/assets/icons/caret_up.svg.js +2 -2
  5. package/dist/assets/icons/caret_up.svg.js.map +1 -1
  6. package/dist/assets/icons/minus.svg.js +6 -0
  7. package/dist/assets/icons/minus.svg.js.map +1 -0
  8. package/dist/assets/icons/warning_circle_filled.svg.js +3 -3
  9. package/dist/assets/icons/warning_circle_filled.svg.js.map +1 -1
  10. package/dist/components/Alert.js +3 -3
  11. package/dist/components/Alert.js.map +1 -1
  12. package/dist/components/BaseFormComponent.js +84 -64
  13. package/dist/components/BaseFormComponent.js.map +1 -1
  14. package/dist/components/ClampText.js +89 -15
  15. package/dist/components/ClampText.js.map +1 -1
  16. package/dist/components/CustomIcons/MinusIcon.js +16 -0
  17. package/dist/components/CustomIcons/MinusIcon.js.map +1 -0
  18. package/dist/components/CustomIcons/index.js +150 -147
  19. package/dist/components/CustomIcons/index.js.map +1 -1
  20. package/dist/components/Dropdown.js +449 -439
  21. package/dist/components/Dropdown.js.map +1 -1
  22. package/dist/components/FieldBlock.js +32 -21
  23. package/dist/components/FieldBlock.js.map +1 -1
  24. package/dist/components/GuideTimeline/GuideJumpMenu.js +74 -0
  25. package/dist/components/GuideTimeline/GuideJumpMenu.js.map +1 -0
  26. package/dist/components/GuideTimeline/GuideProgress.js +81 -0
  27. package/dist/components/GuideTimeline/GuideProgress.js.map +1 -0
  28. package/dist/components/GuideTimeline/GuideTimeline.js +313 -0
  29. package/dist/components/GuideTimeline/GuideTimeline.js.map +1 -0
  30. package/dist/components/GuideTimeline/guideTimelinePositions.js +23 -0
  31. package/dist/components/GuideTimeline/guideTimelinePositions.js.map +1 -0
  32. package/dist/components/MultiSelect.js +1 -1
  33. package/dist/components/MultiSelect.js.map +1 -1
  34. package/dist/components/SidePanel.js +382 -227
  35. package/dist/components/SidePanel.js.map +1 -1
  36. package/dist/components/Tooltip.js +1 -1
  37. package/dist/components/Tooltip.js.map +1 -1
  38. package/dist/components/TruncatedTooltip.js +1 -1
  39. package/dist/components/TruncatedTooltip.js.map +1 -1
  40. package/dist/components/ZoomableImage.js +144 -32
  41. package/dist/components/ZoomableImage.js.map +1 -1
  42. package/dist/components/sidePanelOverlay.js +7 -0
  43. package/dist/components/sidePanelOverlay.js.map +1 -0
  44. package/dist/index.d.ts +147 -11
  45. package/dist/index.js +265 -255
  46. package/dist/index.js.map +1 -1
  47. package/dist/tailwind.css.js +1 -1
  48. package/package.json +1 -1
@@ -1,38 +1,38 @@
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(
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(we, { value: i, paddingSize: "compact", fontSize: "xsmall", textTransform: "none" })
32
+ children: /* @__PURE__ */ e(Te, { value: o, paddingSize: "compact", fontSize: "xsmall", textTransform: "none" })
33
33
  }
34
- ), ae = /[*`[<&\\]/, yt = ({ text: t }) => ae.test(t) ? /* @__PURE__ */ e(
35
- Se,
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, ee = {
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
- }, 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 = {
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
- }, Be = {
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
- }, Ze = {
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
- }, re = () => !1, qe = ({
78
+ }, ie = () => !1, Ue = ({
79
79
  wrap: t,
80
- id: i,
80
+ id: o,
81
81
  children: r
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
+ }) => 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: i,
85
+ onClick: o,
86
86
  selectedItem: r,
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",
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: J,
102
+ onClear: H,
102
103
  clearLabel: a,
103
104
  controlId: l,
104
- labelId: d,
105
- describedBy: o,
106
- required: w = !1,
107
- ariaLabel: z,
105
+ labelId: i,
106
+ describedBy: v,
107
+ required: b = !1,
108
+ ariaLabel: P,
108
109
  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) => {
112
- if (s.key === "Tab") {
113
- k == null || k();
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
- 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);
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 (u && !h)
122
+ if (d && !p)
122
123
  return /* @__PURE__ */ m(
123
124
  "div",
124
125
  {
125
- ref: O,
126
+ ref: wt,
126
127
  className: `
127
- relative w-full ${tt} ${ot}
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: rt,
133
- [It]: "",
133
+ style: et,
134
+ [ee]: "",
134
135
  "data-open": t || void 0,
135
- onClick: (s) => s.stopPropagation(),
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(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
+ /* @__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: dt,
148
+ ref: y,
148
149
  className: `min-w-0 block truncate text-[length:inherit]
149
150
  text-[var(--malachite-text-primary)]`,
150
- children: W
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": z,
161
+ "aria-label": P,
161
162
  "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) ?? "",
166
- onChange: (s) => {
167
- s.stopPropagation(), $ == null || $(s.target.value), t || i();
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
- E == null || E();
171
+ N == null || N();
171
172
  },
172
173
  onClick: () => {
173
- t || N == null || N();
174
+ t || T == null || T();
174
175
  },
175
- onKeyDown: S,
176
- placeholder: _ ?? "Select Field",
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)] ${F ? "text-transparent" : "text-[var(--malachite-text-primary)]"}`
180
+ placeholder:text-[var(--malachite-text-dimmed)] ${rt ? "text-transparent" : "text-[var(--malachite-text-primary)]"}`
180
181
  }
181
182
  )
182
183
  ] }) }),
183
- st && (r == null ? void 0 : r.triggerTag) && /* @__PURE__ */ m(St, { children: [
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(te, { id: P, text: r.triggerTag })
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: J,
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(ne, { size: 13 })
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: (s) => {
207
- s.stopPropagation(), i();
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
- Qt,
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 ft = /* @__PURE__ */ m(
227
+ const Lt = /* @__PURE__ */ m(
227
228
  "button",
228
229
  {
229
- ref: O,
230
+ ref: wt,
230
231
  id: l,
231
232
  type: "button",
232
- "aria-label": z,
233
- "aria-labelledby": M,
234
- "aria-invalid": f || void 0,
235
- "aria-required": w || void 0,
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
- o,
238
- T ? lt : void 0,
239
- L ? P : void 0
238
+ v,
239
+ w ? at : void 0,
240
+ st ? M : void 0
240
241
  ].filter(Boolean).join(" ") || void 0,
241
- onClick: (s) => {
242
- s.stopPropagation(), i(s.detail === 0);
242
+ onClick: (c) => {
243
+ c.stopPropagation(), o(c.detail === 0);
243
244
  },
244
- onKeyDown: S,
245
- disabled: h,
246
- style: rt,
247
- [It]: "",
245
+ onKeyDown: E,
246
+ disabled: p,
247
+ style: et,
248
+ [ee]: "",
248
249
  className: `
249
- relative w-full ${tt} ${ot}
250
+ relative w-full ${St} ${I}
250
251
  border border-solid
251
252
  transition-all duration-200
252
- flex ${I ? "items-start" : "items-center"} gap-3
253
+ flex ${k ? "items-start" : "items-center"} gap-3
253
254
  cursor-pointer
254
- disabled:cursor-not-allowed ${De}
255
+ disabled:cursor-not-allowed ${Ae}
255
256
  `,
256
257
  children: [
257
258
  /* @__PURE__ */ e(
258
259
  "span",
259
260
  {
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: [
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
- zt,
267
+ Pt,
267
268
  {
268
- text: W,
269
- shouldShow: T ? re : nt,
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: 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
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
- T && /* @__PURE__ */ e(
284
+ w && /* @__PURE__ */ e(
284
285
  "span",
285
286
  {
286
- id: lt,
287
- ref: et,
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(yt, { text: T })
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] ${h ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-dimmed)]"}`,
296
- children: _ ?? "Select Field"
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(te, { id: P, text: r.triggerTag, disabled: h }),
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
- Qt,
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 b && !u ? /* @__PURE__ */ e(
318
- zt,
318
+ return x && !d && W ? /* @__PURE__ */ e(
319
+ Pt,
319
320
  {
320
- text: ie([
321
- ["value", ut.value && W],
321
+ text: oe([
322
+ ["value", dt.value && L],
322
323
  [
323
324
  "subtitle",
324
- ut.subtitle && T && /* @__PURE__ */ e(yt, { text: T })
325
+ dt.subtitle && w && /* @__PURE__ */ e(vt, { text: w })
325
326
  ]
326
327
  ]),
327
- shouldShow: T ? Ft : re,
328
+ shouldShow: w ? kt : ie,
328
329
  fill: !0,
329
330
  describesTrigger: !1,
330
- children: ft
331
+ children: Lt
331
332
  }
332
- ) : ft;
333
+ ) : Lt;
333
334
  }
334
335
  );
335
- oe.displayName = "DropdownTrigger";
336
- const Ue = ({
336
+ se.displayName = "DropdownTrigger";
337
+ const Qe = ({
337
338
  item: t,
338
- selected: i,
339
+ selected: o,
339
340
  showTooltipOnFocus: r,
340
- subtitleLayout: h,
341
- onItemSelected: f
341
+ subtitleLayout: p,
342
+ wrapSubtitle: u = !1,
343
+ onItemSelected: S
342
344
  }) => {
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 = (
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": i,
358
- "aria-current": i || void 0,
359
- "aria-labelledby": t.subtitle || Dt(t.badge) ? b : void 0,
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 ? A : void 0,
362
- Dt(t.badge) ? $ : void 0
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: (w) => {
366
- w.stopPropagation(), f(t);
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: _ ? { display: "flex", flexDirection: "column", gap: 2 } : { display: "flex", alignItems: "center", gap: 8 },
401
+ style: d ? { display: "flex", flexDirection: "column", gap: 2 } : { display: "flex", alignItems: "center", gap: 8 },
400
402
  children: [
401
- /* @__PURE__ */ m(Ve, { row: _ && (!!t.icon || E && !!N), children: [
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 || Dt(t.badge) ? b : void 0,
418
- ref: C,
419
+ id: t.subtitle || Ot(t.badge) ? W : void 0,
420
+ ref: $,
419
421
  style: {
420
422
  fontWeight: 400,
421
- color: v,
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
- E && N
432
+ N && T
431
433
  ] }),
432
- t.subtitle && (_ ? /* @__PURE__ */ e(
434
+ t.subtitle && (d ? /* @__PURE__ */ e(
433
435
  "span",
434
436
  {
435
- id: A,
436
- ref: k,
437
+ id: O,
438
+ ref: C,
437
439
  style: {
438
- fontSize: Ht,
440
+ fontSize: Bt,
439
441
  fontWeight: 400,
440
442
  lineHeight: 1.4,
441
- color: i ? v : "var(--malachite-text-dimmed, rgb(161, 161, 161))",
442
- whiteSpace: "nowrap",
443
- overflow: "hidden",
444
- textOverflow: "ellipsis"
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(yt, { text: t.subtitle })
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: Ht,
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: A,
478
- ref: k,
481
+ id: O,
482
+ ref: C,
479
483
  style: {
480
- fontSize: Ht,
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(yt, { text: t.subtitle })
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: d
510
+ justifyContent: i
507
511
  },
508
512
  children: t.rightSideText && /* @__PURE__ */ e(
509
513
  "span",
510
514
  {
511
- ref: p,
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
- !E && N
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
- zt,
538
+ Pt,
535
539
  {
536
- text: ie([
540
+ text: oe([
537
541
  ["label", D.label && t.label],
538
542
  [
539
543
  "subtitle",
540
- D.subtitle && t.subtitle && /* @__PURE__ */ e(yt, { text: t.subtitle })
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: o
552
+ children: v
549
553
  }
550
554
  );
551
- }, le = Pt.forwardRef((t, i) => {
555
+ }, ce = Ft.forwardRef((t, o) => {
552
556
  const {
553
557
  items: r,
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,
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
- 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)
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 = At(p.current);
574
- (d = a.find((o) => o.dataset.selected === "true") ?? a[0] ?? p.current) == null || d.focus();
575
- }, [u, b]), Ot(() => {
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
- 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(
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
- p.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
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 w;
592
+ var b;
588
593
  if (a.key === "Tab") {
589
- A();
594
+ W();
590
595
  return;
591
596
  }
592
- const l = At(p.current);
597
+ const l = Mt(f.current);
593
598
  if (l.length === 0)
594
599
  return;
595
- const d = l.indexOf(document.activeElement), o = {
596
- ArrowDown: d + 1,
597
- ArrowUp: d - 1,
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
- o !== void 0 && (a.preventDefault(), E(), (w = l[Math.min(Math.max(o, 0), l.length - 1)]) == null || w.focus());
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: vt.standard.background,
605
- border: vt.standard.border,
606
- borderRadius: vt.standard.radius,
607
- boxShadow: vt.standard.shadow,
608
- maxHeight: $e,
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: Ee[C],
613
- ...k
617
+ fontSize: Ce[$],
618
+ ...C
614
619
  },
615
- children: v ? /* @__PURE__ */ m("div", { style: ee, children: [
616
- /* @__PURE__ */ e(ye, { size: "xxxsmall" }),
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: ee, children: _ }) : /* @__PURE__ */ e(
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: vt.standard.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 d = r[l - 1], o = !!a.group && (!d || d.group !== a.group);
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
- o && /* @__PURE__ */ e(
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
- Ue,
653
+ Qe,
649
654
  {
650
655
  item: a,
651
- onItemSelected: h,
656
+ onItemSelected: p,
652
657
  subtitleLayout: N,
653
- selected: a.id === (f == null ? void 0 : f.id) || !1,
654
- showTooltipOnFocus: $
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
- le.displayName = "DropdownPanel";
665
- const wr = ({
670
+ ce.displayName = "DropdownPanel";
671
+ const Tr = ({
666
672
  items: t,
667
- onItemSelected: i,
673
+ onItemSelected: o,
668
674
  defaultValue: r,
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,
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: 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,
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
- clearable: Mt = !1,
692
- size: O = "large",
693
- fullWidth: I = !1,
694
- width: tt,
695
- minWidth: ot,
696
- menuAlign: B = "start",
697
- id: lt,
698
- "aria-label": P,
699
- "aria-labelledby": Tt
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: Z, labelId: st, descriptionId: ct, hintId: Et, helperTextId: M } = ve({
702
- id: lt,
703
- label: u,
704
- description: a,
705
- hint: b,
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
- }), [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));
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 [Nt, Ft] = H(""), ft = x(""), s = Pe(w), y = mt(
719
+ const [kt, Lt] = j(""), c = g(""), q = We(v), z = gt(
712
720
  (n) => {
713
- var c;
714
- ft.current !== n && (ft.current = n, Ft(n), (c = s.current) == null || c.call(s, n));
721
+ var s;
722
+ c.current !== n && (c.current = n, Lt(n), (s = q.current) == null || s.call(q, n));
715
723
  },
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) {
721
- c.focus();
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
- pt.current = !1, c.focus(), $t() !== c && (pt.current = !0);
732
+ ut.current = !1, s.focus(), At() !== s && (ut.current = !0);
725
733
  }
726
- }, [o]), kt = mt(() => {
727
- S(!1), o && y(""), G();
728
- }, [o, G, y]), Zt = mt(
734
+ }, [i]), _t = gt(() => {
735
+ y(!1), i && z(""), F();
736
+ }, [i, F, z]), Vt = gt(
729
737
  (n) => {
730
- var c;
731
- n.stopPropagation(), et(void 0), o && y(""), (c = U.current) == null || c.call(U, jt.current), i == null || i(void 0), G();
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
- [i, G, o, y]
734
- ), V = mt(() => {
735
- const n = Ct.current;
736
- n && Bt(
737
- Le(q.current, {
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: ot,
741
- align: B === "end" ? "right" : "left",
748
+ minWidth: B,
749
+ align: at === "end" ? "right" : "left",
742
750
  viewportWidth: window.innerWidth,
743
751
  viewportHeight: window.innerHeight
744
752
  })
745
753
  );
746
- }, [ot, B]);
747
- Ot(() => {
748
- if (!L) {
749
- Bt(null), Kt(!1);
754
+ }, [B, at]);
755
+ Wt(() => {
756
+ if (!E) {
757
+ qt(null), Zt(!1);
750
758
  return;
751
759
  }
752
- V();
753
- const n = (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;
761
- if (Q) {
762
- const j = Q.getBoundingClientRect();
763
- if (Re(j, window.innerWidth, window.innerHeight)) {
764
- S(!1), o && y("");
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 Y = _e(j);
768
- Y !== Lt && (Lt = Y, V());
775
+ const J = De(G);
776
+ J !== $t && ($t = J, U());
769
777
  }
770
- ht = requestAnimationFrame(Rt);
778
+ ft = requestAnimationFrame(Dt);
771
779
  };
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);
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
- }, [L, o, V, G, kt, y]), pe(() => {
776
- if (!L)
783
+ }, [E, i, U, F, _t, z]), ge(() => {
784
+ if (!E)
777
785
  return;
778
- V();
779
- const n = q.current;
786
+ U();
787
+ const n = V.current;
780
788
  if (!n || typeof ResizeObserver > "u")
781
789
  return;
782
- const c = new ResizeObserver(() => V());
783
- return c.observe(n), () => c.disconnect();
784
- }, [L, V]);
785
- const U = x(void 0), X = x(void 0), jt = x(""), de = (n) => {
786
- var c;
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];
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
- Kt(!0), S(!0);
798
- }, Vt = Nt.trim(), fe = o && Vt ? t.filter((n) => Ge(n, Vt)) : t;
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
- me,
808
+ be,
801
809
  {
802
- fullWidth: I,
803
- label: u,
804
- hint: b,
805
- hintIcon: A,
806
- rightSideContent: $,
807
- tooltip: E,
810
+ fullWidth: St,
811
+ label: d,
812
+ hint: x,
813
+ hintIcon: W,
814
+ rightSideContent: O,
815
+ tooltip: _,
808
816
  name: N,
809
- required: C,
810
- requiredIndicator: k,
811
- loading: p,
812
- formControl: J,
813
- description: a,
814
- controlId: Z,
815
- labelId: st,
816
- descriptionId: ct,
817
- hintId: Et,
818
- loadingComponent: tt === void 0 ? /* @__PURE__ */ e(
819
- Yt,
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: wt[O],
822
- helperText: !!l,
829
+ heightClass: bt[k],
830
+ helperText: !!a,
823
831
  helperTextMarginTop: !0
824
832
  }
825
- ) : /* @__PURE__ */ e("div", { style: Jt(tt), children: /* @__PURE__ */ e(
826
- Yt,
833
+ ) : /* @__PURE__ */ e("div", { style: te(I), children: /* @__PURE__ */ e(
834
+ It,
827
835
  {
828
- heightClass: wt[O],
829
- helperText: !!l,
836
+ heightClass: bt[k],
837
+ helperText: !!a,
830
838
  helperTextMarginTop: !0
831
839
  }
832
840
  ) }),
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 = [
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
- l ? M : void 0,
839
- Q ? j : void 0
845
+ Z,
846
+ a ? st : void 0,
847
+ Y ? G : void 0
840
848
  ].filter(Boolean).join(" ") || void 0;
841
- return /* @__PURE__ */ m(St, { children: [
849
+ return /* @__PURE__ */ m(yt, { children: [
842
850
  /* @__PURE__ */ m(
843
851
  "div",
844
852
  {
845
- ref: Gt,
853
+ ref: Ht,
846
854
  className: "relative w-full",
847
- style: Jt(tt),
855
+ style: te(I),
848
856
  onKeyDown: (R) => {
849
- R.key !== "Escape" || !L || R.defaultPrevented || !ke(kt) || (R.stopPropagation(), kt());
857
+ R.key !== "Escape" || !E || R.defaultPrevented || !Re(_t) || (R.stopPropagation(), _t());
850
858
  },
851
859
  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);
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
- W && !o && /* @__PURE__ */ e(
865
+ w && !i && /* @__PURE__ */ e(
858
866
  "button",
859
867
  {
860
868
  type: "button",
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
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 ${Ke[O]}`,
867
- children: /* @__PURE__ */ e(ne, { size: 13 })
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
- oe,
879
+ se,
872
880
  {
873
- hasClear: W,
874
- onClear: Zt,
875
- clearLabel: nt,
876
- ref: Ct,
877
- isOpen: L,
881
+ hasClear: w,
882
+ onClear: Vt,
883
+ clearLabel: dt,
884
+ ref: Rt,
885
+ isOpen: E,
878
886
  onClick: (R) => {
879
- f || (Wt(!!R), S(!L));
887
+ u || (jt(!!R), y(!E));
880
888
  },
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,
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 (!pt.current) {
892
- pt.current = !0;
900
+ if (!ut.current) {
901
+ ut.current = !0;
893
902
  return;
894
903
  }
895
- S(!0);
904
+ y(!0);
896
905
  },
897
906
  onClickOpen: () => {
898
- pt.current = !0, S(!0);
907
+ ut.current = !0, y(!0);
899
908
  },
900
909
  onArrowDown: () => {
901
- f || ue();
910
+ u || pe();
902
911
  },
903
912
  onTabAway: () => {
904
- L && qt();
913
+ E && Ut();
905
914
  },
906
- size: O,
907
- controlId: Z,
908
- hasCallerId: !!lt,
909
- labelId: st,
910
- describedBy: Y,
911
- required: C,
912
- ariaLabel: P,
913
- ariaLabelledBy: Tt
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
- L && xe(
925
+ E && ve(
917
926
  /* @__PURE__ */ e(
918
- le,
927
+ ce,
919
928
  {
920
- ref: q,
929
+ ref: V,
921
930
  style: {
922
931
  position: "fixed",
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
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: fe,
931
- onItemSelected: de,
932
- selectedItem: F,
933
- menuLoading: D,
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
- size: O,
937
- autoFocus: !o || se,
938
- positioned: g !== null,
939
- onDismiss: qt,
940
- keyboardNavigation: ce,
941
- onKeyboardNavigation: () => Wt(!0)
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
- l && /* @__PURE__ */ e(
959
+ a && /* @__PURE__ */ e(
950
960
  "div",
951
961
  {
952
- id: M,
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: l
964
+ children: a
955
965
  }
956
966
  ),
957
- /* @__PURE__ */ e(be, { id: j, message: Q, spaced: !0 })
967
+ /* @__PURE__ */ e(we, { id: G, message: Y, spaced: !0 })
958
968
  ] });
959
969
  }
960
970
  }
961
971
  );
962
972
  };
963
973
  export {
964
- wr as Dropdown
974
+ Tr as Dropdown
965
975
  };
966
976
  //# sourceMappingURL=Dropdown.js.map