@stackone/malachite 2.48.1 → 2.49.1

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