@stackone/malachite 2.84.0 → 2.85.0

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