@stackone/malachite 2.87.0 → 2.88.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,49 +1,50 @@
1
- import { jsx as r, jsxs as E, Fragment as je } from "react/jsx-runtime";
2
- import pe, { useId as Ve, useState as $, useRef as k, useMemo as W, useCallback as x, useEffect as Be, useLayoutEffect as Et, useInsertionEffect as It } from "react";
1
+ import { jsx as r, jsxs as I, Fragment as je } from "react/jsx-runtime";
2
+ import pe, { useId as Ve, useState as $, useRef as k, useMemo as W, useCallback as x, useEffect as Be, useLayoutEffect as It, useInsertionEffect as Et } from "react";
3
3
  import { createPortal as St } from "react-dom";
4
4
  import Tt, { useFormFieldIds as kt } from "./BaseFormComponent.js";
5
- import Lt from "./CustomIcons/CaretDownIcon.js";
6
- import Rt from "./CustomIcons/InfoFilledIcon.js";
7
- import Ot from "./CustomIcons/SearchIcon.js";
8
- import { FieldMessage as _t } from "./FieldMessage.js";
5
+ import Rt from "./CustomIcons/CaretDownIcon.js";
6
+ import _t from "./CustomIcons/InfoFilledIcon.js";
7
+ import Lt from "./CustomIcons/SearchIcon.js";
8
+ import { FieldMessage as Ot } from "./FieldMessage.js";
9
9
  import { FormItem as Nt } from "./FormItem.js";
10
10
  import Ge from "./LoadingInput.js";
11
11
  import At from "./Spinner.js";
12
12
  import { Tag as Mt } from "./Tag.js";
13
13
  import ze from "./Tooltip.js";
14
- import { getDeepActiveElement as Ke } from "./activeElement.js";
14
+ import { getDeepActiveNode as Ke } from "./activeElement.js";
15
15
  import { CONTROL_TEXT_SIZE_CLASS as me, CONTROL_TEXT_SIZE as Dt } from "./controlTextSize.js";
16
16
  import { controlWidthStyle as Ye } from "./controlWidth.js";
17
17
  import { getTriggerVisual as Ht, DROPDOWN_TRIGGER_ATTR as Ct } from "./dropdownTriggerStyle.js";
18
18
  import { pushEscapeLayer as Pt } from "./escapeLayers.js";
19
- import { measureMenuGeometry as Wt, MENU_MAX_HEIGHT_PX as $t, MENU_SPECS as Y } from "./floatingMenuGeometry.js";
19
+ import { measureMenuGeometry as Wt, MENU_MAX_HEIGHT_PX as $t, MENU_SPECS as F } from "./floatingMenuGeometry.js";
20
20
  import { FOCUS_RING as Bt } from "./focusRing.js";
21
21
  import { hasBadge as Gt } from "./hasBadge.js";
22
22
  import { ensureMultiSelectPanelStyles as zt } from "./optionRowStyles.js";
23
23
  import { usePopupLayer as Kt } from "./overlayLayers.js";
24
24
  import { useTopLayer as Yt } from "./topLayer.js";
25
- import { useLatestRef as Ut } from "./useLatestRef.js";
26
- import { tooltipLines as Ft, isCut as jt, isClamped as Vt } from "./truncatedLines.js";
27
- const Xt = pe.lazy(() => import("./ActionMenuTagHost.js")), qt = {
25
+ import { tooltipLines as Ft, isCut as Ut, isClamped as jt } from "./truncatedLines.js";
26
+ import { useFollowTrigger as Vt } from "./useFollowTrigger.js";
27
+ import { useLatestRef as Xt } from "./useLatestRef.js";
28
+ const qt = pe.lazy(() => import("./ActionMenuTagHost.js")), Zt = {
28
29
  padding: "8px 10px",
29
30
  color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
30
31
  }, U = {
31
32
  small: "h-[var(--malachite-control-height-small,28px)]",
32
33
  medium: "h-[var(--malachite-control-height-medium,32px)]",
33
34
  large: "h-[var(--malachite-control-height-large,42px)]"
34
- }, Zt = {
35
+ }, Jt = {
35
36
  small: `${U.small} gap-[6px] px-2.5 ${me.small} rounded-[var(--malachite-radius-10,10px)]`,
36
37
  medium: `${U.medium} gap-[8px] px-3 ${me.medium} rounded-xl`,
37
38
  large: `${U.large} gap-[10px] px-4 ${me.large} rounded-[var(--malachite-radius-xxl,14px)]`
38
- }, Jt = 10, Xe = "ArrowDown", qe = "ArrowUp", Ze = "Enter", Qt = "Backspace", er = /* @__PURE__ */ new Set([Xe, qe, Ze]), Je = pe.forwardRef(
39
- ({ triggerRole: n, disabled: y, children: I, ...s }, b) => n !== "button" ? /* @__PURE__ */ r(
39
+ }, Qt = 10, Xe = "ArrowDown", qe = "ArrowUp", Ze = "Enter", er = "Backspace", tr = /* @__PURE__ */ new Set([Xe, qe, Ze]), Je = pe.forwardRef(
40
+ ({ triggerRole: n, disabled: y, children: E, ...s }, b) => n !== "button" ? /* @__PURE__ */ r(
40
41
  "div",
41
42
  {
42
43
  ref: b,
43
44
  role: n,
44
45
  tabIndex: y ? -1 : 0,
45
46
  ...s,
46
- children: I
47
+ children: E
47
48
  }
48
49
  ) : /* @__PURE__ */ r(
49
50
  "button",
@@ -52,25 +53,25 @@ const Xt = pe.lazy(() => import("./ActionMenuTagHost.js")), qt = {
52
53
  type: "button",
53
54
  disabled: y,
54
55
  ...s,
55
- children: I
56
+ children: E
56
57
  }
57
58
  )
58
59
  );
59
60
  Je.displayName = "TriggerElement";
60
- const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
61
- const y = k(null), I = k(null), s = n.description ? n.descriptionMode ?? "icon" : null, b = s === "subtitle", [L, B] = $({ label: !0, subtitle: !0 }), _ = () => {
62
- const v = jt(y.current), i = Vt(I.current);
61
+ const Fe = 0.6, Ue = 420, rr = ({ option: n }) => {
62
+ const y = k(null), E = k(null), s = n.description ? n.descriptionMode ?? "icon" : null, b = s === "subtitle", [R, B] = $({ label: !0, subtitle: !0 }), O = () => {
63
+ const v = Ut(y.current), i = jt(E.current);
63
64
  return !v && !i && s !== "hover" ? !1 : (B({ label: v, subtitle: i }), !0);
64
- }, R = s === "hover" || b && L.subtitle, M = (v) => /* @__PURE__ */ r(
65
+ }, _ = s === "hover" || b && R.subtitle, M = (v) => /* @__PURE__ */ r(
65
66
  ze,
66
67
  {
67
68
  text: Ft([
68
- ["label", L.label && n.label],
69
- ["description", R && n.description]
69
+ ["label", R.label && n.label],
70
+ ["description", _ && n.description]
70
71
  ]),
71
- shouldShow: _,
72
- delay: Ue,
73
- maxWidth: Fe,
72
+ shouldShow: O,
73
+ delay: Fe,
74
+ maxWidth: Ue,
74
75
  triggerAs: "span",
75
76
  isShrinkable: !0,
76
77
  describesTrigger: s === "hover",
@@ -90,7 +91,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
90
91
  }
91
92
  );
92
93
  return b ? M(
93
- /* @__PURE__ */ E(
94
+ /* @__PURE__ */ I(
94
95
  "span",
95
96
  {
96
97
  style: {
@@ -106,7 +107,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
106
107
  /* @__PURE__ */ r(
107
108
  "span",
108
109
  {
109
- ref: I,
110
+ ref: E,
110
111
  style: {
111
112
  fontSize: 12,
112
113
  color: "var(--malachite-text-secondary, rgb(123, 123, 123))",
@@ -125,7 +126,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
125
126
  ]
126
127
  }
127
128
  )
128
- ) : /* @__PURE__ */ E(
129
+ ) : /* @__PURE__ */ I(
129
130
  "span",
130
131
  {
131
132
  style: {
@@ -141,8 +142,8 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
141
142
  ze,
142
143
  {
143
144
  text: n.description,
144
- delay: Ue,
145
- maxWidth: Fe,
145
+ delay: Fe,
146
+ maxWidth: Ue,
146
147
  children: /* @__PURE__ */ r(
147
148
  "span",
148
149
  {
@@ -152,7 +153,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
152
153
  },
153
154
  "aria-label": "More information",
154
155
  onClick: (v) => v.stopPropagation(),
155
- children: n.descriptionIcon ?? /* @__PURE__ */ r(Rt, { size: 14 })
156
+ children: n.descriptionIcon ?? /* @__PURE__ */ r(_t, { size: 14 })
156
157
  }
157
158
  )
158
159
  }
@@ -163,29 +164,29 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
163
164
  }, Qe = ({
164
165
  options: n,
165
166
  value: y,
166
- defaultValue: I,
167
+ defaultValue: E,
167
168
  onChange: s,
168
169
  placeholder: b = "Select",
169
- renderTrigger: L,
170
+ renderTrigger: R,
170
171
  searchable: B,
171
- size: _ = "large",
172
- width: R = "auto",
172
+ size: O = "large",
173
+ width: _ = "auto",
173
174
  minWidth: M,
174
175
  disabled: d = !1,
175
176
  error: v = !1,
176
177
  loading: i = !1,
177
- label: F,
178
+ label: j,
178
179
  name: he,
179
- description: J,
180
+ description: Q,
180
181
  tooltip: ge,
181
- hint: Q,
182
+ hint: ee,
182
183
  hintIcon: et,
183
184
  rightSideContent: be,
184
- required: ee = !1,
185
+ required: te = !1,
185
186
  requiredIndicator: tt,
186
187
  formControl: ve,
187
- chips: te = !1,
188
- chipsRemovable: re = !0,
188
+ chips: re = !1,
189
+ chipsRemovable: ne = !0,
189
190
  chipsMax: xe = "auto",
190
191
  inlineSearch: S = !1,
191
192
  onSearchChange: G,
@@ -194,41 +195,41 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
194
195
  style: nt,
195
196
  id: ot,
196
197
  "aria-label": we,
197
- "aria-labelledby": lt,
198
- errorMessageId: at,
198
+ "aria-labelledby": at,
199
+ errorMessageId: lt,
199
200
  onFieldLeave: st
200
201
  }) => {
201
- const Ee = Ve(), Ie = `${Ee}-listbox`, Se = (e) => `${Ee}-option-${e}`, { controlId: Te, labelId: ke, descriptionId: it, hintId: ct, describedBy: dt } = kt({
202
+ const Ie = Ve(), Ee = `${Ie}-listbox`, Se = (e) => `${Ie}-option-${e}`, { controlId: Te, labelId: ke, descriptionId: it, hintId: ct, describedBy: dt } = kt({
202
203
  id: ot,
203
- label: F,
204
- description: J,
205
- hint: Q
206
- }), [ut, ft] = $(() => I ?? []), ne = y !== void 0, h = ne ? y : ut, [a, oe] = $(!1), [m, Le] = $(null), [N, mt] = $(""), [T, C] = $(-1), j = k(null), le = k(null), D = Ut(st), z = k(null), A = k(null), Re = k(null);
207
- Yt(A, a);
208
- const pt = Kt("multiselect", a, A), Oe = k([]), ae = W(() => new Set(h), [h]), c = W(
209
- () => n.filter((e) => ae.has(e.value)),
210
- [n, ae]
211
- ), se = typeof xe == "number" ? xe : void 0, H = W(() => {
204
+ label: j,
205
+ description: Q,
206
+ hint: ee
207
+ }), [ut, ft] = $(() => E ?? []), oe = y !== void 0, h = oe ? y : ut, [l, ae] = $(!1), [m, Re] = $(null), [N, mt] = $(""), [T, P] = $(-1), z = k(null), le = k(null), D = Xt(st), K = k(null), A = k(null), _e = k(null);
208
+ Yt(A, l);
209
+ const pt = Kt("multiselect", l, A), Le = k([]), se = W(() => new Set(h), [h]), c = W(
210
+ () => n.filter((e) => se.has(e.value)),
211
+ [n, se]
212
+ ), ie = typeof xe == "number" ? xe : void 0, H = W(() => {
212
213
  if (!ye) return n;
213
214
  const e = N.trim().toLowerCase();
214
215
  return e ? n.filter((t) => (t.searchText ?? (typeof t.label == "string" ? t.label : "")).toLowerCase().includes(e)) : n;
215
- }, [n, N, ye]), ie = k(!1), _e = k(""), V = x(
216
+ }, [n, N, ye]), ce = k(!1), Oe = k(""), V = x(
216
217
  (e, t) => {
217
- _e.current !== e && (_e.current = e, t && (ie.current = !0), mt(e), G == null || G(e));
218
+ Oe.current !== e && (Oe.current = e, t && (ce.current = !0), mt(e), G == null || G(e));
218
219
  },
219
220
  [G]
220
- ), ce = x(
221
+ ), de = x(
221
222
  (e) => V(e, !0),
222
223
  [V]
223
- ), K = x(() => V("", !1), [V]);
224
+ ), Y = x(() => V("", !1), [V]);
224
225
  Be(() => {
225
- ie.current && (C(-1), ie.current = !1);
226
+ ce.current && (P(-1), ce.current = !1);
226
227
  }, [N]);
227
- const ht = B ?? (G !== void 0 || n.length > Jt), Ne = S ? !1 : ht, de = x(() => {
228
+ const ht = B ?? (G !== void 0 || n.length > Qt), Ne = S ? !1 : ht, X = x(() => {
228
229
  var e, t, o, u;
229
- oe(!1), (e = A.current) != null && e.contains(Ke()) && ((t = j.current) == null || t.focus()), (o = le.current) != null && o.contains(Ke()) || (u = D.current) == null || u.call(D);
230
- }, [D]), P = x(() => {
231
- const e = j.current;
230
+ ae(!1), (e = A.current) != null && e.contains(Ke()) && ((t = z.current) == null || t.focus({ preventScroll: !0 })), (o = le.current) != null && o.contains(Ke()) || (u = D.current) == null || u.call(D);
231
+ }, [D]), C = x(() => {
232
+ const e = z.current;
232
233
  if (!e) return;
233
234
  const t = Wt(A.current, {
234
235
  triggerRect: e.getBoundingClientRect(),
@@ -237,46 +238,46 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
237
238
  viewportWidth: window.innerWidth,
238
239
  viewportHeight: window.innerHeight
239
240
  });
240
- Le(t);
241
+ Re(t);
241
242
  }, [M]);
242
- Be(() => {
243
+ Vt(l, z, C, X), Be(() => {
243
244
  var u;
244
- if (!a) {
245
- K(), C(-1), Le(null);
245
+ if (!l) {
246
+ Y(), P(-1), Re(null);
246
247
  return;
247
248
  }
248
- P(), S && ((u = z.current) == null || u.focus());
249
- const e = () => P(), t = (g) => {
250
- const p = g.composedPath(), l = j.current, f = A.current;
251
- (!l || !p.includes(l)) && (!f || !p.includes(f)) && de();
252
- }, o = Pt(de);
253
- return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), document.addEventListener("mousedown", t), () => {
254
- window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), document.removeEventListener("mousedown", t), o();
249
+ C(), S && ((u = K.current) == null || u.focus());
250
+ const e = () => C(), t = (g) => {
251
+ const p = g.composedPath(), a = z.current, f = A.current;
252
+ (!a || !p.includes(a)) && (!f || !p.includes(f)) && X();
253
+ }, o = Pt(X);
254
+ return window.addEventListener("resize", e), document.addEventListener("mousedown", t), () => {
255
+ window.removeEventListener("resize", e), document.removeEventListener("mousedown", t), o();
255
256
  };
256
- }, [a, P, S, K, de]), Et(() => {
257
- if (!a)
257
+ }, [l, C, S, Y, X]), It(() => {
258
+ if (!l)
258
259
  return;
259
- P();
260
+ C();
260
261
  const e = A.current;
261
262
  if (!e || typeof ResizeObserver > "u")
262
263
  return;
263
- const t = new ResizeObserver(() => P());
264
+ const t = new ResizeObserver(() => C());
264
265
  return t.observe(e), () => t.disconnect();
265
- }, [a, P]);
266
- const O = x(
266
+ }, [l, C]);
267
+ const L = x(
267
268
  (e) => {
268
- ne || ft(e), s == null || s(e);
269
+ oe || ft(e), s == null || s(e);
269
270
  },
270
- [ne, s]
271
- ), X = x(
271
+ [oe, s]
272
+ ), q = x(
272
273
  (e) => n.some((t) => t.value === e && t.disabled),
273
274
  [n]
274
275
  ), ue = x(
275
276
  (e) => {
276
- X(e) || (h.includes(e) ? O(h.filter((t) => t !== e)) : O([...h, e]));
277
+ q(e) || (h.includes(e) ? L(h.filter((t) => t !== e)) : L([...h, e]));
277
278
  },
278
- [h, O, X]
279
- ), q = W(() => {
279
+ [h, L, q]
280
+ ), Z = W(() => {
280
281
  const e = /* @__PURE__ */ new Set();
281
282
  for (const t of n)
282
283
  t.disabled && e.add(t.value);
@@ -284,29 +285,29 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
284
285
  }, [n]), gt = x(
285
286
  (e) => {
286
287
  e.stopPropagation();
287
- const t = h.filter((o) => q.has(o));
288
- O(t);
288
+ const t = h.filter((o) => Z.has(o));
289
+ L(t);
289
290
  },
290
- [O, h, q]
291
+ [L, h, Z]
291
292
  ), Ae = x(
292
293
  (e, t) => {
293
- t.stopPropagation(), !X(e) && O(h.filter((o) => o !== e));
294
+ t.stopPropagation(), !q(e) && L(h.filter((o) => o !== e));
294
295
  },
295
- [h, O, X]
296
- ), Z = x(
296
+ [h, L, q]
297
+ ), J = x(
297
298
  (e) => {
298
- if (!er.has(e.key)) return;
299
- if (e.preventDefault(), e.stopPropagation(), !a) {
300
- oe(!0);
299
+ if (!tr.has(e.key)) return;
300
+ if (e.preventDefault(), e.stopPropagation(), !l) {
301
+ ae(!0);
301
302
  return;
302
303
  }
303
304
  const t = H.length;
304
305
  if (t === 0) return;
305
306
  const o = (p) => {
306
307
  requestAnimationFrame(() => {
307
- const l = Oe.current[p], f = Re.current;
308
- if (!l || !f) return;
309
- const w = l.offsetTop, We = w + l.offsetHeight, $e = f.scrollTop, wt = $e + f.clientHeight;
308
+ const a = Le.current[p], f = _e.current;
309
+ if (!a || !f) return;
310
+ const w = a.offsetTop, We = w + a.offsetHeight, $e = f.scrollTop, wt = $e + f.clientHeight;
310
311
  We > wt ? f.scrollTo({
311
312
  top: We - f.clientHeight,
312
313
  behavior: "smooth"
@@ -314,21 +315,21 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
314
315
  });
315
316
  }, u = (p) => {
316
317
  var f;
317
- let l = T;
318
+ let a = T;
318
319
  for (let w = 0; w < t; w++)
319
- if (l = p === 1 ? l < t - 1 ? l + 1 : 0 : l > 0 ? l - 1 : t - 1, !((f = H[l]) != null && f.disabled)) {
320
- o(l), C(l);
320
+ if (a = p === 1 ? a < t - 1 ? a + 1 : 0 : a > 0 ? a - 1 : t - 1, !((f = H[a]) != null && f.disabled)) {
321
+ o(a), P(a);
321
322
  return;
322
323
  }
323
324
  }, g = () => {
324
325
  var f;
325
326
  if (T < 0 || T >= t || (f = H[T]) != null && f.disabled) return;
326
327
  const p = H[T].value;
327
- ue(p), K();
328
- const l = n.findIndex((w) => w.value === p);
329
- C(l >= 0 ? l : -1), o(l >= 0 ? l : 0), requestAnimationFrame(() => {
328
+ ue(p), Y();
329
+ const a = n.findIndex((w) => w.value === p);
330
+ P(a >= 0 ? a : -1), o(a >= 0 ? a : 0), requestAnimationFrame(() => {
330
331
  var w;
331
- return (w = z.current) == null ? void 0 : w.focus();
332
+ return (w = K.current) == null ? void 0 : w.focus();
332
333
  });
333
334
  };
334
335
  switch (e.key) {
@@ -343,32 +344,32 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
343
344
  break;
344
345
  }
345
346
  },
346
- [a, H, T, ue, n, K]
347
+ [l, H, T, ue, n, Y]
347
348
  ), Me = x(
348
349
  (e) => {
349
- if (e.key === Qt && N === "" && h.length > 0) {
350
- e.preventDefault(), O(h.slice(0, -1)), requestAnimationFrame(() => {
350
+ if (e.key === er && N === "" && h.length > 0) {
351
+ e.preventDefault(), L(h.slice(0, -1)), requestAnimationFrame(() => {
351
352
  var t;
352
- return (t = z.current) == null ? void 0 : t.focus();
353
+ return (t = K.current) == null ? void 0 : t.focus();
353
354
  });
354
355
  return;
355
356
  }
356
- Z(e);
357
+ J(e);
357
358
  },
358
- [Z, N, h, O]
359
+ [J, N, h, L]
359
360
  ), De = c.length > 0 && !d && !i, bt = Ht({
360
361
  disabled: d,
361
362
  error: v,
362
- open: a,
363
+ open: l,
363
364
  loading: i,
364
365
  hasSelection: c.length > 0
365
366
  }), fe = W(() => S ? /* @__PURE__ */ r(
366
367
  "input",
367
368
  {
368
- ref: z,
369
+ ref: K,
369
370
  type: "text",
370
371
  value: N,
371
- onChange: (e) => ce(e.target.value),
372
+ onChange: (e) => de(e.target.value),
372
373
  onKeyDown: Me,
373
374
  disabled: d || i,
374
375
  placeholder: c.length === 0 ? b : "",
@@ -380,38 +381,38 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
380
381
  ) : null, [
381
382
  S,
382
383
  N,
383
- ce,
384
+ de,
384
385
  Me,
385
386
  d,
386
387
  i,
387
388
  c.length,
388
389
  b
389
390
  ]), vt = W(() => {
390
- if (L && c.length > 0)
391
- return L(c);
392
- if (te && c.length > 0) {
393
- const e = se != null ? c.slice(0, se) : c, t = c.length - e.length;
394
- return /* @__PURE__ */ E(
391
+ if (R && c.length > 0)
392
+ return R(c);
393
+ if (re && c.length > 0) {
394
+ const e = ie != null ? c.slice(0, ie) : c, t = c.length - e.length;
395
+ return /* @__PURE__ */ I(
395
396
  "div",
396
397
  {
397
398
  className: "flex items-center gap-1 overflow-hidden min-w-0 flex-1",
398
399
  style: { flexWrap: "nowrap" },
399
400
  children: [
400
401
  e.map((o) => {
401
- const u = q.has(o.value);
402
+ const u = Z.has(o.value);
402
403
  return /* @__PURE__ */ r(
403
404
  Mt,
404
405
  {
405
406
  value: o.label,
406
407
  type: "default",
407
408
  textTransform: "none",
408
- onRemove: re && !d && !u ? (g) => Ae(o.value, g) : void 0,
409
+ onRemove: ne && !d && !u ? (g) => Ae(o.value, g) : void 0,
409
410
  className: "shrink-0"
410
411
  },
411
412
  o.value
412
413
  );
413
414
  }),
414
- t > 0 && /* @__PURE__ */ E("span", { className: "shrink-0 text-xs text-[var(--malachite-text-secondary,rgb(123,123,123))]", children: [
415
+ t > 0 && /* @__PURE__ */ I("span", { className: "shrink-0 text-xs text-[var(--malachite-text-secondary,rgb(123,123,123))]", children: [
415
416
  "+",
416
417
  t
417
418
  ] }),
@@ -423,44 +424,44 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
423
424
  return S && c.length === 0 ? fe : c.length === 0 ? /* @__PURE__ */ r("span", { className: "text-[var(--malachite-text-placeholder)]", children: b }) : c.length === 1 ? /* @__PURE__ */ r("span", { children: c[0].label }) : /* @__PURE__ */ r("span", { children: `${c.length} selected` });
424
425
  }, [
425
426
  c,
426
- L,
427
- te,
428
- se,
427
+ R,
429
428
  re,
429
+ ie,
430
+ ne,
430
431
  d,
431
432
  Ae,
432
433
  S,
433
434
  fe,
434
435
  b,
435
- q
436
+ Z
436
437
  ]), xt = n.length === 0 ? "No options available" : "No results found";
437
- It(() => {
438
- a && zt();
439
- }, [a]);
438
+ Et(() => {
439
+ l && zt();
440
+ }, [l]);
440
441
  const yt = {
441
442
  position: "fixed",
442
443
  top: (m == null ? void 0 : m.top) ?? 0,
443
444
  left: (m == null ? void 0 : m.left) ?? 0,
444
445
  width: m == null ? void 0 : m.width,
445
- background: Y.standard.background,
446
- border: Y.standard.border,
447
- borderRadius: Y.standard.radius,
448
- boxShadow: Y.standard.shadow,
449
- padding: Y.standard.padding,
446
+ background: F.standard.background,
447
+ border: F.standard.border,
448
+ borderRadius: F.standard.radius,
449
+ boxShadow: F.standard.shadow,
450
+ padding: F.standard.padding,
450
451
  display: "flex",
451
452
  flexDirection: "column",
452
453
  gap: 4,
453
454
  maxHeight: (m == null ? void 0 : m.maxHeight) ?? $t,
454
- fontSize: Dt[_],
455
+ fontSize: Dt[O],
455
456
  visibility: m ? "visible" : "hidden",
456
457
  opacity: m ? 1 : 0
457
- }, He = !!(J || ge || Q || be || he || ve || ee), Ce = He && !!F, Pe = /* @__PURE__ */ E(je, { children: [
458
- /* @__PURE__ */ E(
458
+ }, He = !!(Q || ge || ee || be || he || ve || te), Ce = He && !!j, Pe = /* @__PURE__ */ I(je, { children: [
459
+ /* @__PURE__ */ I(
459
460
  "div",
460
461
  {
461
462
  ref: le,
462
463
  className: "relative",
463
- style: Ye(R),
464
+ style: Ye(_),
464
465
  onBlur: (e) => {
465
466
  var o;
466
467
  const t = e.relatedTarget;
@@ -470,35 +471,35 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
470
471
  });
471
472
  },
472
473
  children: [
473
- /* @__PURE__ */ E(
474
+ /* @__PURE__ */ I(
474
475
  Je,
475
476
  {
476
- ref: j,
477
+ ref: z,
477
478
  id: Te,
478
- triggerRole: S ? "combobox" : te && re ? "group" : "button",
479
+ triggerRole: S ? "combobox" : re && ne ? "group" : "button",
479
480
  disabled: d || i,
480
481
  [Ct]: "",
481
- "data-open": a || void 0,
482
+ "data-open": l || void 0,
482
483
  "aria-haspopup": "listbox",
483
- "aria-expanded": a,
484
- "aria-controls": a ? Ie : void 0,
485
- "aria-activedescendant": S && a && T >= 0 ? Se(T) : void 0,
486
- "aria-labelledby": lt ?? (Ce && !we ? ke : void 0),
487
- "aria-label": we ?? (Ce ? void 0 : F),
484
+ "aria-expanded": l,
485
+ "aria-controls": l ? Ee : void 0,
486
+ "aria-activedescendant": S && l && T >= 0 ? Se(T) : void 0,
487
+ "aria-labelledby": at ?? (Ce && !we ? ke : void 0),
488
+ "aria-label": we ?? (Ce ? void 0 : j),
488
489
  "aria-invalid": v || void 0,
489
- "aria-required": ee || void 0,
490
- "aria-describedby": [dt, at].filter(Boolean).join(" ") || void 0,
490
+ "aria-required": te || void 0,
491
+ "aria-describedby": [dt, lt].filter(Boolean).join(" ") || void 0,
491
492
  "aria-busy": i || void 0,
492
493
  onClick: () => {
493
- d || i || oe((e) => !e);
494
+ d || i || ae((e) => !e);
494
495
  },
495
- onKeyDown: Z,
496
+ onKeyDown: J,
496
497
  style: {
497
498
  transition: "border-color 0.15s ease, box-shadow 0.15s ease",
498
499
  ...bt,
499
500
  ...nt
500
501
  },
501
- className: `w-full ${Zt[_]} border border-solid flex items-center font-normal text-[var(--malachite-text-primary)] ${d || i ? "cursor-not-allowed" : "cursor-pointer"} ${Bt} ${rt}`,
502
+ className: `w-full ${Jt[O]} border border-solid flex items-center font-normal text-[var(--malachite-text-primary)] ${d || i ? "cursor-not-allowed" : "cursor-pointer"} ${Bt} ${rt}`,
502
503
  children: [
503
504
  /* @__PURE__ */ r(
504
505
  "span",
@@ -508,14 +509,14 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
508
509
  }
509
510
  ),
510
511
  i ? /* @__PURE__ */ r("span", { className: "flex items-center justify-center shrink-0 size-[14px]", children: /* @__PURE__ */ r(At, { size: "xxxsmall" }) }) : /* @__PURE__ */ r(
511
- Lt,
512
+ Rt,
512
513
  {
513
514
  size: 13,
514
515
  className: "shrink-0",
515
516
  style: {
516
- color: a ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
517
+ color: l ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
517
518
  transition: "transform 0.2s ease, color 0.2s ease",
518
- transform: a ? "rotate(180deg)" : "rotate(0deg)"
519
+ transform: l ? "rotate(180deg)" : "rotate(0deg)"
519
520
  }
520
521
  }
521
522
  )
@@ -535,18 +536,18 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
535
536
  ]
536
537
  }
537
538
  ),
538
- a && St(
539
- /* @__PURE__ */ E(
539
+ l && St(
540
+ /* @__PURE__ */ I(
540
541
  "div",
541
542
  {
542
543
  ref: A,
543
- id: Ie,
544
+ id: Ee,
544
545
  role: "listbox",
545
546
  "aria-multiselectable": "true",
546
547
  ...pt,
547
548
  style: yt,
548
549
  children: [
549
- Ne && /* @__PURE__ */ E(
550
+ Ne && /* @__PURE__ */ I(
550
551
  "div",
551
552
  {
552
553
  style: {
@@ -561,7 +562,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
561
562
  },
562
563
  children: [
563
564
  /* @__PURE__ */ r(
564
- Ot,
565
+ Lt,
565
566
  {
566
567
  size: 13,
567
568
  style: {
@@ -575,8 +576,8 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
575
576
  {
576
577
  type: "text",
577
578
  value: N,
578
- onChange: (e) => ce(e.target.value),
579
- onKeyDown: Z,
579
+ onChange: (e) => de(e.target.value),
580
+ onKeyDown: J,
580
581
  placeholder: "Search",
581
582
  "aria-label": "Search options",
582
583
  autoFocus: !0,
@@ -609,7 +610,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
609
610
  /* @__PURE__ */ r(
610
611
  "div",
611
612
  {
612
- ref: Re,
613
+ ref: _e,
613
614
  style: {
614
615
  display: "flex",
615
616
  flexDirection: "column",
@@ -623,15 +624,15 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
623
624
  },
624
625
  children: H.length === 0 ? (
625
626
  // `role="listbox"` admits only option/group children.
626
- /* @__PURE__ */ r("div", { role: "presentation", style: qt, children: xt })
627
+ /* @__PURE__ */ r("div", { role: "presentation", style: Zt, children: xt })
627
628
  ) : H.map((e, t) => {
628
- const o = ae.has(e.value), u = t === T, g = !!e.disabled;
629
- return /* @__PURE__ */ E(
629
+ const o = se.has(e.value), u = t === T, g = !!e.disabled;
630
+ return /* @__PURE__ */ I(
630
631
  "button",
631
632
  {
632
633
  id: Se(t),
633
634
  ref: (p) => {
634
- Oe.current[t] = p;
635
+ Le.current[t] = p;
635
636
  },
636
637
  type: "button",
637
638
  role: "option",
@@ -639,11 +640,11 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
639
640
  "aria-disabled": g || void 0,
640
641
  onClick: () => {
641
642
  var p;
642
- ue(e.value), K(), (p = z.current) == null || p.focus();
643
+ ue(e.value), Y(), (p = K.current) == null || p.focus();
643
644
  },
644
- onMouseEnter: () => C(t),
645
+ onMouseEnter: () => P(t),
645
646
  onMouseLeave: () => {
646
- T === t && C(-1);
647
+ T === t && P(-1);
647
648
  },
648
649
  className: "malachite-multiselect-option",
649
650
  "data-checked": o,
@@ -665,7 +666,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
665
666
  color: o ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))"
666
667
  },
667
668
  children: [
668
- /* @__PURE__ */ r(tr, { option: e }),
669
+ /* @__PURE__ */ r(rr, { option: e }),
669
670
  Gt(e.badge) && /* @__PURE__ */ r(
670
671
  "span",
671
672
  {
@@ -674,7 +675,7 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
674
675
  flexShrink: 0,
675
676
  paddingLeft: 8
676
677
  },
677
- children: /* @__PURE__ */ r(pe.Suspense, { fallback: null, children: /* @__PURE__ */ r(Xt, { children: e.badge }) })
678
+ children: /* @__PURE__ */ r(pe.Suspense, { fallback: null, children: /* @__PURE__ */ r(qt, { children: e.badge }) })
678
679
  }
679
680
  )
680
681
  ]
@@ -693,55 +694,55 @@ const Ue = 0.6, Fe = 420, tr = ({ option: n }) => {
693
694
  return He ? /* @__PURE__ */ r(
694
695
  Tt,
695
696
  {
696
- label: F,
697
- hint: Q,
697
+ label: j,
698
+ hint: ee,
698
699
  hintIcon: et,
699
700
  rightSideContent: be,
700
701
  tooltip: ge,
701
702
  name: he ?? "",
702
- required: ee,
703
+ required: te,
703
704
  requiredIndicator: tt,
704
705
  loading: i,
705
706
  formControl: ve,
706
- description: J,
707
+ description: Q,
707
708
  controlId: Te,
708
709
  labelId: ke,
709
710
  descriptionId: it,
710
711
  hintId: ct,
711
- loadingComponent: R === void 0 ? /* @__PURE__ */ r(Ge, { heightClass: U[_] }) : /* @__PURE__ */ r("div", { style: Ye(R), children: /* @__PURE__ */ r(Ge, { heightClass: U[_] }) }),
712
+ loadingComponent: _ === void 0 ? /* @__PURE__ */ r(Ge, { heightClass: U[O] }) : /* @__PURE__ */ r("div", { style: Ye(_), children: /* @__PURE__ */ r(Ge, { heightClass: U[O] }) }),
712
713
  children: Pe
713
714
  }
714
715
  ) : Pe;
715
- }, rr = ({
716
+ }, nr = ({
716
717
  formControl: n,
717
718
  name: y,
718
- error: I,
719
+ error: E,
719
720
  onChange: s,
720
721
  ...b
721
722
  }) => {
722
- const L = `${Ve()}-error`;
723
- return /* @__PURE__ */ r(Nt, { control: n, name: y, children: ({ error: B, message: _, onFieldChange: R, onFieldBlur: M, value: d }) => {
724
- const v = I === !1 ? void 0 : _;
725
- return /* @__PURE__ */ E(je, { children: [
723
+ const R = `${Ve()}-error`;
724
+ return /* @__PURE__ */ r(Nt, { control: n, name: y, children: ({ error: B, message: O, onFieldChange: _, onFieldBlur: M, value: d }) => {
725
+ const v = E === !1 ? void 0 : O;
726
+ return /* @__PURE__ */ I(je, { children: [
726
727
  /* @__PURE__ */ r(
727
728
  Qe,
728
729
  {
729
730
  ...b,
730
731
  name: y,
731
732
  value: Array.isArray(d) ? d : [],
732
- error: I ?? B,
733
- errorMessageId: v ? L : void 0,
733
+ error: E ?? B,
734
+ errorMessageId: v ? R : void 0,
734
735
  onFieldLeave: M,
735
736
  onChange: (i) => {
736
- R == null || R(i), s == null || s(i);
737
+ _ == null || _(i), s == null || s(i);
737
738
  }
738
739
  }
739
740
  ),
740
- /* @__PURE__ */ r(_t, { id: L, message: v, spaced: !0 })
741
+ /* @__PURE__ */ r(Ot, { id: R, message: v, spaced: !0 })
741
742
  ] });
742
743
  } });
743
- }, Or = (n) => n.formControl ? /* @__PURE__ */ r(rr, { ...n }) : /* @__PURE__ */ r(Qe, { ...n });
744
+ }, Nr = (n) => n.formControl ? /* @__PURE__ */ r(nr, { ...n }) : /* @__PURE__ */ r(Qe, { ...n });
744
745
  export {
745
- Or as default
746
+ Nr as default
746
747
  };
747
748
  //# sourceMappingURL=MultiSelect.js.map