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