@stackone/malachite 2.47.1 → 2.47.2

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,29 +1,29 @@
1
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";
2
+ import Dt, { useState as F, useRef as g, useEffect as Pt, 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
- import { getDeepActiveElement as Rt } from "./activeElement.js";
14
+ import { getDeepActiveElement as _t } from "./activeElement.js";
15
15
  import { CONTROL_TEXT_SIZE_CLASS as nt, CONTROL_TEXT_SIZE as me } from "./controlTextSize.js";
16
- import { controlWidthStyle as qt } from "./controlWidth.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
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";
20
+ import { FOCUS_RING as Ee } from "./focusRing.js";
21
21
  import { hasBadge as Lt } from "./hasBadge.js";
22
- import { ensureDropdownPanelStyles as Ce } from "./optionRowStyles.js";
23
- import { usePopupLayer as _e } from "./overlayLayers.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
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(
26
+ const Re = Dt.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text: a, disabled: r }) => /* @__PURE__ */ e(
27
27
  "span",
28
28
  {
29
29
  id: t,
@@ -47,8 +47,8 @@ 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
+ }, Ft = "var(--malachite-font-size-xsmall, 11px)", _e = "[data-dropdown-option]", Wt = (t) => Array.from((t == null ? void 0 : t.querySelectorAll(_e)) ?? []), Le = (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 ? Le(t.subtitle).toLowerCase().includes(r) : !1, S = t.rightSideText ? t.rightSideText.toLowerCase().includes(r) : !1;
52
52
  return u || d || S;
53
53
  }, vt = {
54
54
  small: "h-[var(--malachite-control-height-small,28px)]",
@@ -58,27 +58,27 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
58
58
  small: `${vt.small} px-2.5 py-1.5 ${nt.small}`,
59
59
  medium: `${vt.medium} px-3 py-1.5 ${nt.medium}`,
60
60
  large: `${vt.large} px-4 py-2.5 ${nt.large}`
61
- }, ze = {
61
+ }, Oe = {
62
62
  small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${nt.small}`,
63
63
  medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${nt.medium}`,
64
64
  large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${nt.large}`
65
- }, Ae = {
65
+ }, ze = {
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)]"
77
- }, Qt = () => !1, Pe = ({
77
+ }, Qt = () => !1, Fe = ({
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(bt, { children: r }), Pe = ({ 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 = Dt.forwardRef(
82
82
  ({
83
83
  isOpen: t,
84
84
  onClick: a,
@@ -91,9 +91,9 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
91
91
  showSubtitleInTrigger: T = !1,
92
92
  searchQuery: L = "",
93
93
  onSearchChange: C,
94
- onFocusOpen: _,
94
+ onFocusOpen: k,
95
95
  onArrowDown: y,
96
- onTabAway: k,
96
+ onTabAway: R,
97
97
  size: E = "large",
98
98
  hasClear: m = !1,
99
99
  onClear: P,
@@ -106,13 +106,13 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
106
106
  ariaLabelledBy: yt,
107
107
  hasCallerId: $ = !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 D = T && !p && !!(r != null && r.subtitle), it = D ? Oe[E] : De[E], at = Me[E], G = `${i}-value`, St = `${i}-subtitle`, O = `${i}-tag`, ot = !p || u, j = ot && !!(r != null && r.triggerTag), lt = !ot && !t && !!(r != null && r.triggerTag), st = j ? `${G} ${O}` : G, ct = !c && !w && !$ && (D || j), v = yt ?? (c && !w ? `${c} ${st}` : void 0) ?? (ct ? st : void 0), _ = j && !(v != null && v.split(" ").includes(O)), Tt = (l) => {
110
110
  if (l.key === "Tab") {
111
- k == null || k();
111
+ R == null || R();
112
112
  return;
113
113
  }
114
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 = () => {
115
+ }, H = 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 = D ? r == null ? void 0 : r.subtitle : void 0, I = () => xt(H.current), [tt, A] = F({ value: !1, subtitle: !0 }), Ot = () => {
116
116
  const l = I(), et = xt(J.current);
117
117
  return !l && !et ? !1 : (A({ value: l, subtitle: et }), !0);
118
118
  };
@@ -125,10 +125,11 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
125
125
  relative w-full ${it} ${at}
126
126
  border border-solid
127
127
  transition-all duration-200
128
- flex items-center ${Ee}
128
+ flex items-center
129
129
  `,
130
130
  style: z,
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 }),
@@ -141,7 +142,7 @@ 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: H,
145
146
  className: `min-w-0 block truncate text-[length:inherit]
146
147
  text-[var(--malachite-text-primary)]`,
147
148
  children: K
@@ -158,13 +159,13 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
158
159
  "aria-labelledby": yt,
159
160
  "aria-invalid": d || void 0,
160
161
  "aria-required": f || void 0,
161
- "aria-describedby": [o, lt ? D : void 0].filter(Boolean).join(" ") || void 0,
162
+ "aria-describedby": [o, lt ? O : void 0].filter(Boolean).join(" ") || void 0,
162
163
  value: t ? L : (r == null ? void 0 : r.label) ?? "",
163
164
  onChange: (l) => {
164
165
  l.stopPropagation(), C == null || C(l.target.value), t || a();
165
166
  },
166
167
  onFocus: () => {
167
- _ == null || _();
168
+ k == null || k();
168
169
  },
169
170
  onKeyDown: Tt,
170
171
  placeholder: N ?? "Select Field",
@@ -176,7 +177,7 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
176
177
  ] }) }),
177
178
  lt && (r == null ? void 0 : r.triggerTag) && /* @__PURE__ */ x(bt, { 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: O, text: r.triggerTag })
180
181
  ] }),
181
182
  m && /* @__PURE__ */ e(
182
183
  "button",
@@ -230,7 +231,7 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
230
231
  "aria-describedby": [
231
232
  o,
232
233
  b ? St : void 0,
233
- R ? D : void 0
234
+ _ ? O : void 0
234
235
  ].filter(Boolean).join(" ") || void 0,
235
236
  onClick: (l) => {
236
237
  l.stopPropagation(), a(l.detail === 0);
@@ -243,18 +244,18 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
243
244
  relative w-full ${it} ${at}
244
245
  border border-solid
245
246
  transition-all duration-200
246
- flex ${O ? "items-start" : "items-center"} gap-3
247
+ flex ${D ? "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
255
  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
+ className: `text-left ${j ? "flex-[1_1_auto]" : "flex-1"} min-w-0 flex ${b ? "flex-col gap-1" : "items-center gap-2"}`,
256
257
  children: r ? /* @__PURE__ */ x(bt, { children: [
257
- /* @__PURE__ */ x(Pe, { wrap: !!b, id: G, children: [
258
+ /* @__PURE__ */ x(Fe, { wrap: !!b, id: G, 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,
@@ -266,7 +267,7 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
266
267
  children: /* @__PURE__ */ e(
267
268
  "span",
268
269
  {
269
- ref: j,
270
+ ref: H,
270
271
  className: `min-w-0 block truncate text-[length:inherit] ${u ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-primary)]"}`,
271
272
  children: K
272
273
  }
@@ -292,7 +293,7 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
292
293
  )
293
294
  }
294
295
  ),
295
- (r == null ? void 0 : r.triggerTag) && /* @__PURE__ */ e(Xt, { id: D, text: r.triggerTag, disabled: u }),
296
+ (r == null ? void 0 : r.triggerTag) && /* @__PURE__ */ e(Xt, { id: O, text: r.triggerTag, disabled: u }),
296
297
  m && /* @__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,
@@ -318,7 +319,7 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
318
319
  tt.subtitle && b && /* @__PURE__ */ e(mt, { text: b })
319
320
  ]
320
321
  ]),
321
- shouldShow: b ? Dt : Qt,
322
+ shouldShow: b ? Ot : Qt,
322
323
  fill: !0,
323
324
  describesTrigger: !1,
324
325
  children: ut
@@ -327,15 +328,15 @@ const Re = Ot.lazy(() => import("./ActionMenuTagHost.js")), Xt = ({ id: t, text:
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);
338
+ 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`, k = g(null), y = g(null), R = g(null), [E, m] = F({ label: !0, subtitle: !0, rightSide: !0 }), P = () => {
339
+ const o = xt(k.current), f = xt(y.current), w = xt(R.current);
339
340
  return !o && !f && !w ? !1 : (m({ label: o, subtitle: f, rightSide: w }), !0);
340
341
  }, 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 = (
341
342
  // `role="option"` would be invalid — nothing here declares a `listbox`, and an
@@ -392,7 +393,7 @@ const Ge = ({
392
393
  {
393
394
  style: N ? { 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__ */ x(Pe, { row: N && !!t.icon, children: [
396
397
  t.icon && /* @__PURE__ */ e(
397
398
  "span",
398
399
  {
@@ -409,7 +410,7 @@ const Ge = ({
409
410
  "span",
410
411
  {
411
412
  id: t.subtitle || Lt(t.badge) ? T : void 0,
412
- ref: _,
413
+ ref: k,
413
414
  style: {
414
415
  fontWeight: 400,
415
416
  color: S,
@@ -501,7 +502,7 @@ const Ge = ({
501
502
  children: t.rightSideText && /* @__PURE__ */ e(
502
503
  "span",
503
504
  {
504
- ref: k,
505
+ ref: R,
505
506
  style: {
506
507
  fontSize: "var(--malachite-text-right-side-text-font-size, 12px)",
507
508
  fontWeight: 400,
@@ -516,7 +517,7 @@ const Ge = ({
516
517
  )
517
518
  }
518
519
  ),
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 }) }) })
520
+ Lt(t.badge) && /* @__PURE__ */ e("span", { id: C, style: { flexShrink: 0, display: "flex" }, children: /* @__PURE__ */ e(Dt.Suspense, { fallback: null, children: /* @__PURE__ */ e(Re, { children: t.badge }) }) })
520
521
  ]
521
522
  }
522
523
  )
@@ -541,7 +542,7 @@ const Ge = ({
541
542
  children: c
542
543
  }
543
544
  );
544
- }, re = Ot.forwardRef((t, a) => {
545
+ }, re = Dt.forwardRef((t, a) => {
545
546
  const {
546
547
  items: r,
547
548
  onItemSelected: u,
@@ -552,13 +553,13 @@ const Ge = ({
552
553
  positioned: T,
553
554
  onDismiss: L,
554
555
  keyboardNavigation: C,
555
- onKeyboardNavigation: _,
556
+ onKeyboardNavigation: k,
556
557
  subtitleLayout: y,
557
- size: k,
558
+ size: R,
558
559
  style: E
559
- } = t, m = g(null), P = _e("dropdown", !0, m);
560
+ } = t, m = g(null), P = Ce("dropdown", !0, m);
560
561
  return le(() => {
561
- Ce();
562
+ Ne();
562
563
  }, []), ke(m, !0), Pt(() => {
563
564
  var o;
564
565
  if (!p || !T)
@@ -588,7 +589,7 @@ const Ge = ({
588
589
  Home: 0,
589
590
  End: c.length - 1
590
591
  }[i.key];
591
- f !== void 0 && (i.preventDefault(), _(), (w = c[Math.min(Math.max(f, 0), c.length - 1)]) == null || w.focus());
592
+ f !== void 0 && (i.preventDefault(), k(), (w = c[Math.min(Math.max(f, 0), c.length - 1)]) == null || w.focus());
592
593
  },
593
594
  style: {
594
595
  background: gt.standard.background,
@@ -599,7 +600,7 @@ const Ge = ({
599
600
  overflow: "hidden",
600
601
  display: "flex",
601
602
  flexDirection: "column",
602
- fontSize: me[k],
603
+ fontSize: me[R],
603
604
  ...E
604
605
  },
605
606
  children: S ? /* @__PURE__ */ x("div", { style: Yt, children: [
@@ -635,7 +636,7 @@ const Ge = ({
635
636
  }
636
637
  ),
637
638
  /* @__PURE__ */ e(
638
- Ge,
639
+ We,
639
640
  {
640
641
  item: i,
641
642
  onItemSelected: u,
@@ -652,7 +653,7 @@ const Ge = ({
652
653
  );
653
654
  });
654
655
  re.displayName = "DropdownPanel";
655
- const pr = ({
656
+ const ur = ({
656
657
  items: t,
657
658
  onItemSelected: a,
658
659
  defaultValue: r,
@@ -664,9 +665,9 @@ const pr = ({
664
665
  hint: T,
665
666
  rightSideContent: L,
666
667
  tooltip: C,
667
- name: _,
668
+ name: k,
668
669
  required: y = !1,
669
- requiredIndicator: k,
670
+ requiredIndicator: R,
670
671
  loading: E,
671
672
  menuLoading: m,
672
673
  formControl: P,
@@ -679,39 +680,39 @@ const pr = ({
679
680
  clearable: yt = !1,
680
681
  size: $ = "large",
681
682
  fullWidth: wt = !1,
682
- width: O,
683
+ width: D,
683
684
  minWidth: it,
684
685
  menuAlign: at = "start",
685
686
  id: G,
686
687
  "aria-label": St,
687
- "aria-labelledby": D
688
+ "aria-labelledby": O
688
689
  }) => {
689
- const { controlId: ot, labelId: H, descriptionId: lt, hintId: st, helperTextId: ct } = ue({
690
+ const { controlId: ot, labelId: j, descriptionId: lt, hintId: st, helperTextId: ct } = ue({
690
691
  id: G,
691
692
  label: p,
692
693
  description: W,
693
694
  hint: T,
694
695
  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
+ }), [v, _] = F(!1), [Tt, H] = 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
697
  Pt(() => {
697
- I.current !== r && (I.current = r, j(r));
698
+ I.current !== r && (I.current = r, H(r));
698
699
  }, [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(() => {
700
+ const [tt, A] = F(""), [Ot, 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(() => {
700
701
  const n = Et.current, s = n instanceof HTMLButtonElement ? n : (n == null ? void 0 : n.querySelector("input")) ?? null;
701
- if (!(!s || s === Rt())) {
702
+ if (!(!s || s === _t())) {
702
703
  if (!o) {
703
704
  s.focus();
704
705
  return;
705
706
  }
706
- Nt.current = !1, s.focus(), Rt() !== s && (Nt.current = !0);
707
+ Nt.current = !1, s.focus(), _t() !== s && (Nt.current = !0);
707
708
  }
708
- }, [o]), Ht = Mt(
709
+ }, [o]), jt = Mt(
709
710
  (n) => {
710
711
  var s;
711
- n.stopPropagation(), j(void 0), (s = q.current) == null || s.call(q, At.current), a == null || a(void 0), Z();
712
+ n.stopPropagation(), H(void 0), (s = U.current) == null || s.call(U, At.current), a == null || a(void 0), Z();
712
713
  },
713
714
  [a, Z]
714
- ), U = Mt(() => {
715
+ ), q = Mt(() => {
715
716
  const n = Et.current;
716
717
  n && Gt(
717
718
  ye(B.current, {
@@ -729,46 +730,46 @@ const pr = ({
729
730
  Gt(null), ut(!1);
730
731
  return;
731
732
  }
732
- U();
733
+ q();
733
734
  const n = (X) => {
734
735
  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));
736
+ const M = X.composedPath(), Y = zt.current, Q = B.current, Rt = !!Y && M.includes(Y), Kt = !!Q && M.includes(Q);
737
+ !Rt && !Kt && (_(!1), o && A(""), (ft = B.current) != null && ft.contains(_t()) && Z(), (ht = zt.current) != null && ht.contains(_t()) || (Bt = V.current) == null || Bt.call(V));
737
738
  }, s = be(() => {
738
- R(!1), o && A(""), Z();
739
- }), rt = () => U();
739
+ _(!1), o && A(""), Z();
740
+ }), rt = () => q();
740
741
  let pt = 0, Ct = "";
741
- const _t = () => {
742
+ const kt = () => {
742
743
  const X = Et.current;
743
744
  if (X) {
744
745
  const M = X.getBoundingClientRect();
745
746
  if (we(M, window.innerWidth, window.innerHeight)) {
746
- R(!1), o && A("");
747
+ _(!1), o && A("");
747
748
  return;
748
749
  }
749
750
  const Y = Se(M);
750
- Y !== Ct && (Ct = Y, U());
751
+ Y !== Ct && (Ct = Y, q());
751
752
  }
752
- pt = requestAnimationFrame(_t);
753
+ pt = requestAnimationFrame(kt);
753
754
  };
754
- return pt = requestAnimationFrame(_t), document.addEventListener("mousedown", n), window.addEventListener("scroll", rt, !0), window.addEventListener("resize", rt), () => {
755
+ return pt = requestAnimationFrame(kt), document.addEventListener("mousedown", n), window.addEventListener("scroll", rt, !0), window.addEventListener("resize", rt), () => {
755
756
  cancelAnimationFrame(pt), document.removeEventListener("mousedown", n), s(), window.removeEventListener("scroll", rt, !0), window.removeEventListener("resize", rt);
756
757
  };
757
- }, [v, o, U, Z]), oe(() => {
758
+ }, [v, o, q, Z]), oe(() => {
758
759
  if (!v)
759
760
  return;
760
- U();
761
+ q();
761
762
  const n = B.current;
762
763
  if (!n || typeof ResizeObserver > "u")
763
764
  return;
764
- const s = new ResizeObserver(() => U());
765
+ const s = new ResizeObserver(() => q());
765
766
  return s.observe(n), () => s.disconnect();
766
- }, [v, U]);
767
- const q = g(void 0), V = g(void 0), At = g(""), ne = (n) => {
767
+ }, [v, q]);
768
+ const U = g(void 0), V = g(void 0), At = g(""), ne = (n) => {
768
769
  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();
770
+ H(n == null ? void 0 : n.id), (s = U.current) == null || s.call(U, (n == null ? void 0 : n.id) ?? At.current), _(!1), o && A(""), a == null || a(n == null ? void 0 : n.id), Z();
771
+ }, Ht = () => {
772
+ _(!1), o && A(""), Z();
772
773
  }, ie = () => {
773
774
  et(!0);
774
775
  const n = Wt(B.current)[0];
@@ -776,8 +777,8 @@ const pr = ({
776
777
  n.focus();
777
778
  return;
778
779
  }
779
- ut(!0), R(!0);
780
- }, ae = o && tt ? t.filter((n) => Oe(n, tt)) : t;
780
+ ut(!0), _(!0);
781
+ }, ae = o && tt ? t.filter((n) => $e(n, tt)) : t;
781
782
  return /* @__PURE__ */ e(
782
783
  de,
783
784
  {
@@ -786,25 +787,25 @@ const pr = ({
786
787
  hint: T,
787
788
  rightSideContent: L,
788
789
  tooltip: C,
789
- name: _,
790
+ name: k,
790
791
  required: y,
791
- requiredIndicator: k,
792
+ requiredIndicator: R,
792
793
  loading: E,
793
794
  formControl: P,
794
795
  description: W,
795
796
  controlId: ot,
796
- labelId: H,
797
+ labelId: j,
797
798
  descriptionId: lt,
798
799
  hintId: st,
799
- loadingComponent: O === void 0 ? /* @__PURE__ */ e(
800
- Ut,
800
+ loadingComponent: D === void 0 ? /* @__PURE__ */ e(
801
+ qt,
801
802
  {
802
803
  heightClass: vt[$],
803
804
  helperText: !!i,
804
805
  helperTextMarginTop: !0
805
806
  }
806
- ) : /* @__PURE__ */ e("div", { style: qt(O), children: /* @__PURE__ */ e(
807
- Ut,
807
+ ) : /* @__PURE__ */ e("div", { style: Ut(D), children: /* @__PURE__ */ e(
808
+ qt,
808
809
  {
809
810
  heightClass: vt[$],
810
811
  helperText: !!i,
@@ -812,8 +813,8 @@ const pr = ({
812
813
  }
813
814
  ) }),
814
815
  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 = [
816
+ U.current = rt, V.current = pt, At.current = Ct;
817
+ const kt = S ?? n, X = S === !1 ? void 0 : s, M = `${ct}-error`, Y = [
817
818
  lt,
818
819
  st,
819
820
  i ? ct : void 0,
@@ -825,23 +826,23 @@ const pr = ({
825
826
  {
826
827
  ref: zt,
827
828
  className: "relative w-full",
828
- style: qt(O),
829
+ style: Ut(D),
829
830
  onBlur: (Q) => {
830
831
  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);
832
+ const Rt = Q.relatedTarget;
833
+ Q.currentTarget.contains(Rt) || ((ft = B.current) == null ? void 0 : ft.contains(Rt)) === !0 || (ht = V.current) == null || ht.call(V);
833
834
  },
834
835
  children: [
835
836
  dt && !o && /* @__PURE__ */ e(
836
837
  "button",
837
838
  {
838
839
  type: "button",
839
- onClick: Ht,
840
+ onClick: jt,
840
841
  "aria-label": b,
841
- className: `absolute ${K ? Me[$] : "top-1/2 -translate-y-1/2"} z-10 flex items-center
842
+ className: `absolute ${K ? Ae[$] : "top-1/2 -translate-y-1/2"} z-10 flex items-center
842
843
  justify-center rounded-full text-[var(--malachite-text-placeholder)]
843
844
  hover:text-[var(--malachite-text-primary)] transition-colors
844
- focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${Ae[$]}`,
845
+ focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${ze[$]}`,
845
846
  children: /* @__PURE__ */ e(Jt, { size: 13 })
846
847
  }
847
848
  ),
@@ -849,16 +850,16 @@ const pr = ({
849
850
  ee,
850
851
  {
851
852
  hasClear: dt,
852
- onClear: Ht,
853
+ onClear: jt,
853
854
  clearLabel: b,
854
855
  ref: Et,
855
856
  isOpen: v,
856
857
  onClick: (Q) => {
857
- d || (et(!!Q), R(!v));
858
+ d || (et(!!Q), _(!v));
858
859
  },
859
860
  selectedItem: z,
860
861
  disabled: d,
861
- error: _t,
862
+ error: kt,
862
863
  tone: N,
863
864
  placeholder: c,
864
865
  search: o,
@@ -870,22 +871,22 @@ const pr = ({
870
871
  Nt.current = !0;
871
872
  return;
872
873
  }
873
- R(!0);
874
+ _(!0);
874
875
  },
875
876
  onArrowDown: () => {
876
877
  d || ie();
877
878
  },
878
879
  onTabAway: () => {
879
- v && jt();
880
+ v && Ht();
880
881
  },
881
882
  size: $,
882
883
  controlId: ot,
883
884
  hasCallerId: !!G,
884
- labelId: H,
885
+ labelId: j,
885
886
  describedBy: Y,
886
887
  required: y,
887
888
  ariaLabel: St,
888
- ariaLabelledBy: D
889
+ ariaLabelledBy: O
889
890
  }
890
891
  ),
891
892
  v && ce(
@@ -909,9 +910,9 @@ const pr = ({
909
910
  emptyMessage: t.length === 0 ? "No options available" : "No results found",
910
911
  subtitleLayout: w,
911
912
  size: $,
912
- autoFocus: !o || Dt,
913
+ autoFocus: !o || Ot,
913
914
  positioned: h !== null,
914
- onDismiss: jt,
915
+ onDismiss: Ht,
915
916
  keyboardNavigation: l,
916
917
  onKeyboardNavigation: () => et(!0)
917
918
  }
@@ -936,6 +937,6 @@ const pr = ({
936
937
  );
937
938
  };
938
939
  export {
939
- pr as Dropdown
940
+ ur as Dropdown
940
941
  };
941
942
  //# sourceMappingURL=Dropdown.js.map