@stackone/malachite 2.34.0 → 2.36.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,75 +1,87 @@
1
- import { jsx as t, jsxs as b, Fragment as ye } from "react/jsx-runtime";
2
- import He, { useState as j, useRef as g, useEffect as Le, useCallback as Ce, useLayoutEffect as Qe, useInsertionEffect as Ye, useId as Je } from "react";
3
- import { createPortal as et } from "react-dom";
4
- import tt, { useFormFieldIds as rt } from "./BaseFormComponent.js";
5
- import ze from "./CustomIcons/CaretDownIcon.js";
6
- import je from "./CustomIcons/CloseIcon.js";
7
- import { FieldMessage as nt } from "./FieldMessage.js";
8
- import Pe from "./LoadingInput.js";
9
- import it from "./Spinner.js";
10
- import be from "./Tooltip.js";
11
- import { CONTROL_TEXT_SIZE_CLASS as Y, CONTROL_TEXT_SIZE as at } from "./controlTextSize.js";
12
- import { controlWidthStyle as We } from "./controlWidth.js";
13
- import { getTriggerVisual as ot, DROPDOWN_TRIGGER_ATTR as Me } from "./dropdownTriggerStyle.js";
14
- import { pushEscapeLayer as lt } from "./escapeLayers.js";
15
- import { measureMenuGeometry as st, isTriggerOffscreen as ct, rectSignature as dt, MENU_MAX_HEIGHT_PX as ut, MENU_SPECS as oe } from "./floatingMenuGeometry.js";
16
- import { ensureDropdownPanelStyles as pt } from "./optionRowStyles.js";
17
- import { overlayIdentity as ft } from "./portalOverlay.js";
18
- import { useTopLayer as ht } from "./topLayer.js";
19
- import { tooltipLines as Ze, isCut as le } from "./truncatedLines.js";
20
- const Fe = {
1
+ import { jsx as t, jsxs as y, Fragment as we } from "react/jsx-runtime";
2
+ import je, { useState as j, useRef as g, useEffect as Le, useCallback as Ne, useLayoutEffect as Je, useInsertionEffect as et, useId as tt } from "react";
3
+ import { createPortal as rt } from "react-dom";
4
+ import nt, { useFormFieldIds as it } from "./BaseFormComponent.js";
5
+ import Me from "./CustomIcons/CaretDownIcon.js";
6
+ import Ze from "./CustomIcons/CloseIcon.js";
7
+ import { FieldMessage as at } from "./FieldMessage.js";
8
+ import We from "./LoadingInput.js";
9
+ import ot from "./Spinner.js";
10
+ import ye from "./Tooltip.js";
11
+ import lt from "./Typography/MarkdownBlock.js";
12
+ import { inlineMarkdownText as st } from "./Typography/inlineMarkdown.js";
13
+ import { CONTROL_TEXT_SIZE_CLASS as Q, CONTROL_TEXT_SIZE as ct } from "./controlTextSize.js";
14
+ import { controlWidthStyle as Pe } from "./controlWidth.js";
15
+ import { getTriggerVisual as dt, DROPDOWN_TRIGGER_ATTR as Fe } from "./dropdownTriggerStyle.js";
16
+ import { pushEscapeLayer as ut } from "./escapeLayers.js";
17
+ import { measureMenuGeometry as pt, isTriggerOffscreen as ft, rectSignature as ht, MENU_MAX_HEIGHT_PX as gt, MENU_SPECS as oe } from "./floatingMenuGeometry.js";
18
+ import { ensureDropdownPanelStyles as mt } from "./optionRowStyles.js";
19
+ import { overlayIdentity as xt } from "./portalOverlay.js";
20
+ import { useTopLayer as vt } from "./topLayer.js";
21
+ import { tooltipLines as Ie, isCut as le } from "./truncatedLines.js";
22
+ const Ke = /[*`[<&\\]/, se = ({ text: e }) => Ke.test(e) ? /* @__PURE__ */ t(
23
+ lt,
24
+ {
25
+ text: e,
26
+ variant: "inline",
27
+ color: "inherit",
28
+ size: "inherit",
29
+ links: "inert",
30
+ omitMargin: !0
31
+ }
32
+ ) : e, Ge = {
21
33
  display: "flex",
22
34
  alignItems: "center",
23
35
  justifyContent: "center",
24
36
  gap: 8,
25
37
  padding: "24px 16px",
26
38
  color: "var(--malachite-text-dimmed, rgb(161, 161, 161))"
27
- }, Re = "var(--malachite-font-size-xsmall, 11px)", gt = "[data-dropdown-option]", Ne = (e) => Array.from((e == null ? void 0 : e.querySelectorAll(gt)) ?? []), mt = (e, i) => {
28
- const r = i.toLowerCase(), m = e.label.toLowerCase().includes(r), c = e.subtitle ? e.subtitle.toLowerCase().includes(r) : !1, y = e.rightSideText ? e.rightSideText.toLowerCase().includes(r) : !1;
29
- return m || c || y;
30
- }, se = {
39
+ }, Re = "var(--malachite-font-size-xsmall, 11px)", bt = "[data-dropdown-option]", _e = (e) => Array.from((e == null ? void 0 : e.querySelectorAll(bt)) ?? []), yt = (e) => Ke.test(e) ? st(e) : e.replace(/\s+/g, " "), wt = (e, i) => {
40
+ const r = i.toLowerCase(), m = e.label.toLowerCase().includes(r), c = e.subtitle ? yt(e.subtitle).toLowerCase().includes(r) : !1, w = e.rightSideText ? e.rightSideText.toLowerCase().includes(r) : !1;
41
+ return m || c || w;
42
+ }, ce = {
31
43
  small: "h-[var(--malachite-control-height-small,28px)]",
32
44
  medium: "h-[var(--malachite-control-height-medium,32px)]",
33
45
  large: "h-[var(--malachite-control-height-large,42px)]"
34
- }, xt = {
35
- small: `${se.small} px-2.5 py-1.5 ${Y.small}`,
36
- medium: `${se.medium} px-3 py-1.5 ${Y.medium}`,
37
- large: `${se.large} px-4 py-2.5 ${Y.large}`
38
- }, vt = {
39
- small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${Y.small}`,
40
- medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${Y.medium}`,
41
- large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${Y.large}`
42
- }, bt = {
46
+ }, St = {
47
+ small: `${ce.small} px-2.5 py-1.5 ${Q.small}`,
48
+ medium: `${ce.medium} px-3 py-1.5 ${Q.medium}`,
49
+ large: `${ce.large} px-4 py-2.5 ${Q.large}`
50
+ }, Tt = {
51
+ small: `min-h-[var(--malachite-control-height-small,28px)] px-2.5 py-1.5 ${Q.small}`,
52
+ medium: `min-h-[var(--malachite-control-height-medium,32px)] px-3 py-1.5 ${Q.medium}`,
53
+ large: `min-h-[var(--malachite-control-height-large,42px)] px-4 py-2.5 ${Q.large}`
54
+ }, Et = {
43
55
  small: "right-[26px] size-4",
44
56
  medium: "right-[30px] size-4",
45
57
  large: "right-[38px] size-4"
46
- }, yt = {
58
+ }, Ct = {
47
59
  small: "top-[calc(var(--malachite-control-height-small,28px)/2)] -translate-y-1/2",
48
60
  medium: "top-[calc(var(--malachite-control-height-medium,32px)/2)] -translate-y-1/2",
49
61
  large: "top-[calc(var(--malachite-control-height-large,42px)/2)] -translate-y-1/2"
50
- }, wt = {
62
+ }, Nt = {
51
63
  small: "rounded-[var(--malachite-radius-10,10px)]",
52
64
  medium: "rounded-xl",
53
65
  large: "rounded-[var(--malachite-radius-xxl,14px)]"
54
- }, Ge = () => !1, St = ({
66
+ }, He = () => !1, Rt = ({
55
67
  wrap: e,
56
68
  id: i,
57
69
  children: r
58
- }) => e ? /* @__PURE__ */ t("span", { id: i, className: "min-w-0 flex items-center gap-2", children: r }) : /* @__PURE__ */ t(ye, { children: r }), Tt = ({ row: e, children: i }) => e ? /* @__PURE__ */ t("span", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: i }) : /* @__PURE__ */ t(ye, { children: i }), Ke = He.forwardRef(
70
+ }) => e ? /* @__PURE__ */ t("span", { id: i, className: "min-w-0 flex items-center gap-2", children: r }) : /* @__PURE__ */ t(we, { children: r }), Lt = ({ row: e, children: i }) => e ? /* @__PURE__ */ t("span", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: i }) : /* @__PURE__ */ t(we, { children: i }), Be = je.forwardRef(
59
71
  ({
60
72
  isOpen: e,
61
73
  onClick: i,
62
74
  selectedItem: r,
63
75
  disabled: m = !1,
64
76
  error: c = !1,
65
- tone: y,
66
- placeholder: N,
77
+ tone: w,
78
+ placeholder: L,
67
79
  search: x = !1,
68
- showSubtitleInTrigger: w = !1,
80
+ showSubtitleInTrigger: S = !1,
69
81
  searchQuery: k = "",
70
82
  onSearchChange: E,
71
- onFocusOpen: R,
72
- onArrowDown: S,
83
+ onFocusOpen: N,
84
+ onArrowDown: T,
73
85
  size: v = "large",
74
86
  hasClear: $ = !1,
75
87
  onClear: a,
@@ -79,33 +91,33 @@ const Fe = {
79
91
  describedBy: C,
80
92
  required: l = !1,
81
93
  ariaLabel: D,
82
- ariaLabelledBy: ce,
83
- hasCallerId: we = !1
94
+ ariaLabelledBy: de,
95
+ hasCallerId: Se = !1
84
96
  }, _) => {
85
- const Z = w && !x && !!(r != null && r.subtitle), K = Z ? vt[v] : xt[v], J = wt[v], O = `${s}-value`, de = `${s}-subtitle`, Se = !o && !D && !we && Z, ue = ce ?? (o && !D ? `${o} ${O}` : void 0) ?? (Se ? O : void 0), ee = (d) => {
86
- d.key === "ArrowDown" && (d.preventDefault(), S == null || S());
87
- }, q = g(null), te = g(null), B = ot({ disabled: m, error: c, tone: y, open: e }), L = !e && !!r, h = (r == null ? void 0 : r.triggerLabel) ?? (r == null ? void 0 : r.label), T = Z ? r == null ? void 0 : r.subtitle : void 0, z = () => le(q.current), [V, P] = j({ value: !1, subtitle: !0 }), pe = () => {
97
+ const Z = S && !x && !!(r != null && r.subtitle), I = Z ? Tt[v] : St[v], J = Nt[v], O = `${s}-value`, ue = `${s}-subtitle`, Te = !o && !D && !Se && Z, pe = de ?? (o && !D ? `${o} ${O}` : void 0) ?? (Te ? O : void 0), ee = (d) => {
98
+ d.key === "ArrowDown" && (d.preventDefault(), T == null || T());
99
+ }, K = g(null), te = g(null), B = dt({ disabled: m, error: c, tone: w, open: e }), R = !e && !!r, h = (r == null ? void 0 : r.triggerLabel) ?? (r == null ? void 0 : r.label), b = Z ? r == null ? void 0 : r.subtitle : void 0, z = () => le(K.current), [q, M] = j({ value: !1, subtitle: !0 }), fe = () => {
88
100
  const d = z(), re = le(te.current);
89
- return !d && !re ? !1 : (P({ value: d, subtitle: re }), !0);
101
+ return !d && !re ? !1 : (M({ value: d, subtitle: re }), !0);
90
102
  };
91
103
  if (x && !m)
92
- return /* @__PURE__ */ b(
104
+ return /* @__PURE__ */ y(
93
105
  "div",
94
106
  {
95
107
  ref: _,
96
108
  className: `
97
- relative w-full ${K} ${J}
109
+ relative w-full ${I} ${J}
98
110
  border border-solid
99
111
  transition-all duration-200
100
112
  flex items-center
101
113
  `,
102
114
  style: B,
103
- [Me]: "",
115
+ [Fe]: "",
104
116
  onClick: (d) => d.stopPropagation(),
105
117
  children: [
106
118
  (r == null ? void 0 : r.icon) && /* @__PURE__ */ t("span", { className: "flex shrink-0 items-center justify-center pr-2", children: r.icon }),
107
- /* @__PURE__ */ t(be, { text: h, shouldShow: z, isShrinkable: !0, fill: !0, children: /* @__PURE__ */ b("div", { className: "relative flex-1 flex items-center min-w-0", children: [
108
- L && /* @__PURE__ */ t(
119
+ /* @__PURE__ */ t(ye, { text: h, shouldShow: z, isShrinkable: !0, fill: !0, children: /* @__PURE__ */ y("div", { className: "relative flex-1 flex items-center min-w-0", children: [
120
+ R && /* @__PURE__ */ t(
109
121
  "span",
110
122
  {
111
123
  "aria-hidden": "true",
@@ -113,7 +125,7 @@ const Fe = {
113
125
  children: /* @__PURE__ */ t(
114
126
  "span",
115
127
  {
116
- ref: q,
128
+ ref: K,
117
129
  className: `min-w-0 block truncate text-[length:inherit]
118
130
  text-[var(--malachite-text-primary)]`,
119
131
  children: h
@@ -127,7 +139,7 @@ const Fe = {
127
139
  id: s,
128
140
  type: "text",
129
141
  "aria-label": D,
130
- "aria-labelledby": ce,
142
+ "aria-labelledby": de,
131
143
  "aria-invalid": c || void 0,
132
144
  "aria-required": l || void 0,
133
145
  "aria-describedby": C,
@@ -136,13 +148,13 @@ const Fe = {
136
148
  d.stopPropagation(), E == null || E(d.target.value), e || i();
137
149
  },
138
150
  onFocus: () => {
139
- R == null || R();
151
+ N == null || N();
140
152
  },
141
153
  onKeyDown: ee,
142
- placeholder: N ?? "Select Field",
154
+ placeholder: L ?? "Select Field",
143
155
  className: `flex-1 min-w-0 bg-transparent outline-none
144
156
  text-[length:inherit] font-normal
145
- placeholder:text-[var(--malachite-text-dimmed)] ${L ? "text-transparent" : "text-[var(--malachite-text-primary)]"}`
157
+ placeholder:text-[var(--malachite-text-dimmed)] ${R ? "text-transparent" : "text-[var(--malachite-text-primary)]"}`
146
158
  }
147
159
  )
148
160
  ] }) }),
@@ -156,7 +168,7 @@ const Fe = {
156
168
  bg-transparent border-none p-0 text-[var(--malachite-text-placeholder)]
157
169
  hover:text-[var(--malachite-text-primary)] transition-colors
158
170
  rounded-full focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2`,
159
- children: /* @__PURE__ */ t(je, { size: 13 })
171
+ children: /* @__PURE__ */ t(Ze, { size: 13 })
160
172
  }
161
173
  ),
162
174
  /* @__PURE__ */ t("div", { className: "flex items-center justify-center pl-2", children: /* @__PURE__ */ t(
@@ -170,7 +182,7 @@ const Fe = {
170
182
  },
171
183
  className: "flex items-center justify-center cursor-pointer bg-transparent border-none p-0",
172
184
  children: /* @__PURE__ */ t(
173
- ze,
185
+ Me,
174
186
  {
175
187
  size: 13,
176
188
  style: {
@@ -185,26 +197,26 @@ const Fe = {
185
197
  ]
186
198
  }
187
199
  );
188
- const fe = /* @__PURE__ */ b(
200
+ const he = /* @__PURE__ */ y(
189
201
  "button",
190
202
  {
191
203
  ref: _,
192
204
  id: s,
193
205
  type: "button",
194
206
  "aria-label": D,
195
- "aria-labelledby": ue,
207
+ "aria-labelledby": pe,
196
208
  "aria-invalid": c || void 0,
197
209
  "aria-required": l || void 0,
198
- "aria-describedby": [C, T ? de : void 0].filter(Boolean).join(" ") || void 0,
210
+ "aria-describedby": [C, b ? ue : void 0].filter(Boolean).join(" ") || void 0,
199
211
  onClick: (d) => {
200
212
  d.stopPropagation(), i();
201
213
  },
202
214
  onKeyDown: ee,
203
215
  disabled: m,
204
216
  style: B,
205
- [Me]: "",
217
+ [Fe]: "",
206
218
  className: `
207
- relative w-full ${K} ${J}
219
+ relative w-full ${I} ${J}
208
220
  border border-solid
209
221
  transition-all duration-200
210
222
  flex ${Z ? "items-start" : "items-center"} gap-3
@@ -215,22 +227,22 @@ const Fe = {
215
227
  /* @__PURE__ */ t(
216
228
  "span",
217
229
  {
218
- id: T ? void 0 : O,
219
- className: `text-left flex-1 min-w-0 flex ${T ? "flex-col gap-1" : "items-center gap-2"}`,
220
- children: r ? /* @__PURE__ */ b(ye, { children: [
221
- /* @__PURE__ */ b(St, { wrap: !!T, id: O, children: [
230
+ id: b ? void 0 : O,
231
+ className: `text-left flex-1 min-w-0 flex ${b ? "flex-col gap-1" : "items-center gap-2"}`,
232
+ children: r ? /* @__PURE__ */ y(we, { children: [
233
+ /* @__PURE__ */ y(Rt, { wrap: !!b, id: O, children: [
222
234
  r.icon && /* @__PURE__ */ t("span", { className: "flex items-center justify-center shrink-0", children: r.icon }),
223
235
  /* @__PURE__ */ t(
224
- be,
236
+ ye,
225
237
  {
226
238
  text: h,
227
- shouldShow: T ? Ge : z,
228
- triggerAs: T ? "span" : "div",
239
+ shouldShow: b ? He : z,
240
+ triggerAs: b ? "span" : "div",
229
241
  isShrinkable: !0,
230
242
  children: /* @__PURE__ */ t(
231
243
  "span",
232
244
  {
233
- ref: q,
245
+ ref: K,
234
246
  className: `min-w-0 block truncate text-[length:inherit] ${m ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-primary)]"}`,
235
247
  children: h
236
248
  }
@@ -238,27 +250,27 @@ const Fe = {
238
250
  }
239
251
  )
240
252
  ] }),
241
- T && /* @__PURE__ */ t(
253
+ b && /* @__PURE__ */ t(
242
254
  "span",
243
255
  {
244
- id: de,
256
+ id: ue,
245
257
  ref: te,
246
258
  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",
247
- children: T
259
+ children: /* @__PURE__ */ t(se, { text: b })
248
260
  }
249
261
  )
250
262
  ] }) : /* @__PURE__ */ t(
251
263
  "span",
252
264
  {
253
265
  className: `flex-1 min-w-0 truncate text-[length:inherit] ${m ? "text-[var(--malachite-text-placeholder)]" : "text-[var(--malachite-text-dimmed)]"}`,
254
- children: N ?? "Select Field"
266
+ children: L ?? "Select Field"
255
267
  }
256
268
  )
257
269
  }
258
270
  ),
259
271
  $ && /* @__PURE__ */ t("span", { "aria-hidden": "true", className: "shrink-0 w-4" }),
260
272
  /* @__PURE__ */ t("span", { className: "flex items-center justify-center shrink-0", children: /* @__PURE__ */ t(
261
- ze,
273
+ Me,
262
274
  {
263
275
  size: 13,
264
276
  style: {
@@ -271,30 +283,33 @@ const Fe = {
271
283
  ]
272
284
  }
273
285
  );
274
- return w && !x ? /* @__PURE__ */ t(
275
- be,
286
+ return S && !x ? /* @__PURE__ */ t(
287
+ ye,
276
288
  {
277
- text: Ze([
278
- ["value", V.value && h],
279
- ["subtitle", V.subtitle && T]
289
+ text: Ie([
290
+ ["value", q.value && h],
291
+ [
292
+ "subtitle",
293
+ q.subtitle && b && /* @__PURE__ */ t(se, { text: b })
294
+ ]
280
295
  ]),
281
- shouldShow: T ? pe : Ge,
296
+ shouldShow: b ? fe : He,
282
297
  fill: !0,
283
298
  describesTrigger: !1,
284
- children: fe
299
+ children: he
285
300
  }
286
- ) : fe;
301
+ ) : he;
287
302
  }
288
303
  );
289
- Ke.displayName = "DropdownTrigger";
290
- const Et = ({
304
+ Be.displayName = "DropdownTrigger";
305
+ const _t = ({
291
306
  item: e,
292
307
  selected: i,
293
308
  subtitleLayout: r,
294
309
  onItemSelected: m
295
310
  }) => {
296
- const c = i ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))", y = r === "stacked" && !!e.subtitle, N = `mal-${Je().replace(/[^a-zA-Z0-9_-]/g, "")}`, x = `${N}-label`, w = `${N}-subtitle`, k = g(null), E = g(null), R = g(null), [S, v] = j({ label: !0, subtitle: !0, rightSide: !0 }), $ = () => {
297
- const o = le(k.current), C = le(E.current), l = le(R.current);
311
+ const c = i ? "var(--malachite-accent-foreground, rgb(2, 122, 66))" : "var(--malachite-text-primary, rgb(10, 10, 10))", w = r === "stacked" && !!e.subtitle, L = `mal-${tt().replace(/[^a-zA-Z0-9_-]/g, "")}`, x = `${L}-label`, S = `${L}-subtitle`, k = g(null), E = g(null), N = g(null), [T, v] = j({ label: !0, subtitle: !0, rightSide: !0 }), $ = () => {
312
+ const o = le(k.current), C = le(E.current), l = le(N.current);
298
313
  return !o && !C && !l ? !1 : (v({ label: o, subtitle: C, rightSide: l }), !0);
299
314
  }, a = e.rightSideTextVariant === "primary" ? "var(--malachite-text-right-side-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-right-side-text-muted, rgb(123, 123, 123))", f = e.rightSideTextAlignment === "left" ? "flex-start" : "flex-end", s = (
300
315
  // `role="option"` would be invalid — nothing here declares a `listbox`, and an
@@ -310,7 +325,7 @@ const Et = ({
310
325
  "data-selected": i,
311
326
  "aria-current": i || void 0,
312
327
  "aria-labelledby": e.subtitle ? x : void 0,
313
- "aria-describedby": e.subtitle ? w : void 0,
328
+ "aria-describedby": e.subtitle ? S : void 0,
314
329
  tabIndex: -1,
315
330
  onClick: (o) => {
316
331
  o.stopPropagation(), m(e);
@@ -332,7 +347,7 @@ const Et = ({
332
347
  font: "inherit",
333
348
  color: "inherit"
334
349
  },
335
- children: /* @__PURE__ */ b(
350
+ children: /* @__PURE__ */ y(
336
351
  "span",
337
352
  {
338
353
  style: {
@@ -343,12 +358,12 @@ const Et = ({
343
358
  minWidth: 0
344
359
  },
345
360
  children: [
346
- /* @__PURE__ */ t("span", { style: { flex: "1 1 auto", display: "block", minWidth: 0 }, children: /* @__PURE__ */ b(
361
+ /* @__PURE__ */ t("span", { style: { flex: "1 1 auto", display: "block", minWidth: 0 }, children: /* @__PURE__ */ y(
347
362
  "span",
348
363
  {
349
- style: y ? { display: "flex", flexDirection: "column", gap: 2 } : { display: "flex", alignItems: "center", gap: 8 },
364
+ style: w ? { display: "flex", flexDirection: "column", gap: 2 } : { display: "flex", alignItems: "center", gap: 8 },
350
365
  children: [
351
- /* @__PURE__ */ b(Tt, { row: y && !!e.icon, children: [
366
+ /* @__PURE__ */ y(Lt, { row: w && !!e.icon, children: [
352
367
  e.icon && /* @__PURE__ */ t(
353
368
  "span",
354
369
  {
@@ -378,10 +393,10 @@ const Et = ({
378
393
  }
379
394
  )
380
395
  ] }),
381
- e.subtitle && (y ? /* @__PURE__ */ t(
396
+ e.subtitle && (w ? /* @__PURE__ */ t(
382
397
  "span",
383
398
  {
384
- id: w,
399
+ id: S,
385
400
  ref: E,
386
401
  style: {
387
402
  fontSize: Re,
@@ -392,9 +407,9 @@ const Et = ({
392
407
  overflow: "hidden",
393
408
  textOverflow: "ellipsis"
394
409
  },
395
- children: e.subtitle
410
+ children: /* @__PURE__ */ t(se, { text: e.subtitle })
396
411
  }
397
- ) : /* @__PURE__ */ b(
412
+ ) : /* @__PURE__ */ y(
398
413
  "span",
399
414
  {
400
415
  style: {
@@ -423,7 +438,7 @@ const Et = ({
423
438
  /* @__PURE__ */ t(
424
439
  "span",
425
440
  {
426
- id: w,
441
+ id: S,
427
442
  ref: E,
428
443
  style: {
429
444
  fontSize: Re,
@@ -434,7 +449,7 @@ const Et = ({
434
449
  textOverflow: "ellipsis",
435
450
  minWidth: 0
436
451
  },
437
- children: e.subtitle
452
+ children: /* @__PURE__ */ t(se, { text: e.subtitle })
438
453
  }
439
454
  )
440
455
  ]
@@ -457,7 +472,7 @@ const Et = ({
457
472
  children: e.rightSideText && /* @__PURE__ */ t(
458
473
  "span",
459
474
  {
460
- ref: R,
475
+ ref: N,
461
476
  style: {
462
477
  fontSize: "var(--malachite-text-right-side-text-font-size, 12px)",
463
478
  fontWeight: 400,
@@ -479,12 +494,15 @@ const Et = ({
479
494
  )
480
495
  );
481
496
  return /* @__PURE__ */ t(
482
- be,
497
+ ye,
483
498
  {
484
- text: Ze([
485
- ["label", S.label && e.label],
486
- ["subtitle", S.subtitle && e.subtitle],
487
- ["rightSide", S.rightSide && e.rightSideText]
499
+ text: Ie([
500
+ ["label", T.label && e.label],
501
+ [
502
+ "subtitle",
503
+ T.subtitle && e.subtitle && /* @__PURE__ */ t(se, { text: e.subtitle })
504
+ ],
505
+ ["rightSide", T.rightSide && e.rightSideText]
488
506
  ]),
489
507
  shouldShow: $,
490
508
  isShrinkable: !0,
@@ -492,36 +510,36 @@ const Et = ({
492
510
  children: s
493
511
  }
494
512
  );
495
- }, qe = He.forwardRef((e, i) => {
513
+ }, qe = je.forwardRef((e, i) => {
496
514
  const {
497
515
  items: r,
498
516
  onItemSelected: m,
499
517
  selectedItem: c,
500
- menuLoading: y,
501
- emptyMessage: N,
518
+ menuLoading: w,
519
+ emptyMessage: L,
502
520
  autoFocus: x,
503
- positioned: w,
521
+ positioned: S,
504
522
  onDismiss: k,
505
523
  subtitleLayout: E,
506
- size: R,
507
- style: S
524
+ size: N,
525
+ style: T
508
526
  } = e, v = g(null);
509
- Ye(() => {
510
- pt();
511
- }, []), ht(v, !0), Le(() => {
527
+ et(() => {
528
+ mt();
529
+ }, []), vt(v, !0), Le(() => {
512
530
  var s;
513
- if (!x || !w)
531
+ if (!x || !S)
514
532
  return;
515
- const a = Ne(v.current);
533
+ const a = _e(v.current);
516
534
  (s = a.find((o) => o.dataset.selected === "true") ?? a[0] ?? v.current) == null || s.focus();
517
- }, [x, w]);
535
+ }, [x, S]);
518
536
  const $ = (a) => {
519
537
  var C;
520
538
  if (a.key === "Tab") {
521
539
  k();
522
540
  return;
523
541
  }
524
- const f = Ne(v.current);
542
+ const f = _e(v.current);
525
543
  if (f.length === 0)
526
544
  return;
527
545
  const s = f.indexOf(document.activeElement), o = {
@@ -538,7 +556,7 @@ const Et = ({
538
556
  ref: (a) => {
539
557
  v.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
540
558
  },
541
- ...ft("dropdown"),
559
+ ...xt("dropdown"),
542
560
  tabIndex: -1,
543
561
  onKeyDown: $,
544
562
  style: {
@@ -546,17 +564,17 @@ const Et = ({
546
564
  border: oe.standard.border,
547
565
  borderRadius: oe.standard.radius,
548
566
  boxShadow: oe.standard.shadow,
549
- maxHeight: ut,
567
+ maxHeight: gt,
550
568
  overflow: "hidden",
551
569
  display: "flex",
552
570
  flexDirection: "column",
553
- fontSize: at[R],
554
- ...S
571
+ fontSize: ct[N],
572
+ ...T
555
573
  },
556
- children: y ? /* @__PURE__ */ b("div", { style: Fe, children: [
557
- /* @__PURE__ */ t(it, { size: "xxxsmall" }),
574
+ children: w ? /* @__PURE__ */ y("div", { style: Ge, children: [
575
+ /* @__PURE__ */ t(ot, { size: "xxxsmall" }),
558
576
  /* @__PURE__ */ t("span", { children: "Loading…" })
559
- ] }) : r.length === 0 ? /* @__PURE__ */ t("div", { style: Fe, children: N }) : /* @__PURE__ */ t(
577
+ ] }) : r.length === 0 ? /* @__PURE__ */ t("div", { style: Ge, children: L }) : /* @__PURE__ */ t(
560
578
  "div",
561
579
  {
562
580
  style: {
@@ -570,7 +588,7 @@ const Et = ({
570
588
  },
571
589
  children: r.map((a, f) => {
572
590
  const s = r[f - 1], o = !!a.group && (!s || s.group !== a.group);
573
- return /* @__PURE__ */ b("div", { style: { flexShrink: 0 }, children: [
591
+ return /* @__PURE__ */ y("div", { style: { flexShrink: 0 }, children: [
574
592
  o && /* @__PURE__ */ t(
575
593
  "div",
576
594
  {
@@ -586,7 +604,7 @@ const Et = ({
586
604
  }
587
605
  ),
588
606
  /* @__PURE__ */ t(
589
- Et,
607
+ _t,
590
608
  {
591
609
  item: a,
592
610
  onItemSelected: m,
@@ -602,20 +620,20 @@ const Et = ({
602
620
  );
603
621
  });
604
622
  qe.displayName = "DropdownPanel";
605
- const Kt = ({
623
+ const Yt = ({
606
624
  items: e,
607
625
  onItemSelected: i,
608
626
  defaultValue: r,
609
627
  value: m,
610
628
  disabled: c = !1,
611
- error: y,
612
- tone: N,
629
+ error: w,
630
+ tone: L,
613
631
  label: x,
614
- hint: w,
632
+ hint: S,
615
633
  rightSideContent: k,
616
634
  tooltip: E,
617
- name: R,
618
- required: S = !1,
635
+ name: N,
636
+ required: T = !1,
619
637
  requiredIndicator: v,
620
638
  loading: $,
621
639
  menuLoading: a,
@@ -625,40 +643,40 @@ const Kt = ({
625
643
  placeholder: C,
626
644
  search: l = !1,
627
645
  showSubtitleInTrigger: D = !1,
628
- subtitleLayout: ce = "inline",
629
- clearable: we = !1,
646
+ subtitleLayout: de = "inline",
647
+ clearable: Se = !1,
630
648
  size: _ = "large",
631
649
  fullWidth: Z = !1,
632
- width: K,
650
+ width: I,
633
651
  minWidth: J,
634
652
  id: O,
635
- "aria-label": de,
636
- "aria-labelledby": Se
653
+ "aria-label": ue,
654
+ "aria-labelledby": Te
637
655
  }) => {
638
- const { controlId: ue, labelId: ee, descriptionId: q, hintId: te, helperTextId: B } = rt({
656
+ const { controlId: pe, labelId: ee, descriptionId: K, hintId: te, helperTextId: B } = it({
639
657
  id: O,
640
658
  label: x,
641
659
  description: s,
642
- hint: w,
660
+ hint: S,
643
661
  helperText: !0
644
- }), [L, h] = j(!1), [T, z] = j(r), V = m ?? T, P = e.find((n) => n.id === V), pe = we && V !== void 0 && V !== "" && !c, fe = D && !l && !!(P != null && P.subtitle), d = `Clear ${x ?? C ?? "selection"}`, re = g(r);
662
+ }), [R, h] = j(!1), [b, z] = j(r), q = m ?? b, M = e.find((n) => n.id === q), fe = Se && q !== void 0 && q !== "" && !c, he = D && !l && !!(M != null && M.subtitle), d = `Clear ${x ?? C ?? "selection"}`, re = g(r);
645
663
  Le(() => {
646
664
  re.current !== r && (re.current = r, z(r));
647
665
  }, [r]);
648
- const [Te, I] = j(""), [Be, _e] = j(!1), ke = g(null), he = g(null), U = g(null), [u, $e] = j(null), ge = g(!0), X = Ce(() => {
666
+ const [Ee, V] = j(""), [Ve, ke] = j(!1), $e = g(null), ge = g(null), X = g(null), [u, Ae] = j(null), me = g(!0), U = Ne(() => {
649
667
  var p;
650
- const n = he.current;
668
+ const n = ge.current;
651
669
  n && ((p = n instanceof HTMLButtonElement ? n : n.querySelector("input")) == null || p.focus());
652
- }, []), Ae = Ce(
670
+ }, []), De = Ne(
653
671
  (n) => {
654
672
  var p;
655
- n.stopPropagation(), z(void 0), (p = M.current) == null || p.call(M, Ee.current), i == null || i(void 0), l && (ge.current = !1), X();
673
+ n.stopPropagation(), z(void 0), (p = P.current) == null || p.call(P, Ce.current), i == null || i(void 0), l && (me.current = !1), U();
656
674
  },
657
- [i, l, X]
658
- ), W = Ce(() => {
659
- const n = he.current;
660
- n && $e(
661
- st(U.current, {
675
+ [i, l, U]
676
+ ), W = Ne(() => {
677
+ const n = ge.current;
678
+ n && Ae(
679
+ pt(X.current, {
662
680
  triggerRect: n.getBoundingClientRect(),
663
681
  preset: "standard",
664
682
  minWidth: J,
@@ -668,168 +686,168 @@ const Kt = ({
668
686
  );
669
687
  }, [J]);
670
688
  Le(() => {
671
- if (!L) {
672
- $e(null), _e(!1);
689
+ if (!R) {
690
+ Ae(null), ke(!1);
673
691
  return;
674
692
  }
675
693
  W();
676
694
  const n = (G) => {
677
695
  var ae;
678
- const A = G.composedPath(), H = ke.current, ie = U.current, ve = !!H && A.includes(H), De = !!ie && A.includes(ie);
679
- !ve && !De && (h(!1), l && I(""), (ae = F.current) == null || ae.call(F));
680
- }, p = lt(() => {
681
- h(!1), l && I(""), X();
682
- }), Q = () => W();
683
- let ne = 0, me = "";
684
- const xe = () => {
685
- const G = he.current;
696
+ const A = G.composedPath(), H = $e.current, ie = X.current, be = !!H && A.includes(H), Oe = !!ie && A.includes(ie);
697
+ !be && !Oe && (h(!1), l && V(""), (ae = F.current) == null || ae.call(F));
698
+ }, p = ut(() => {
699
+ h(!1), l && V(""), U();
700
+ }), Y = () => W();
701
+ let ne = 0, xe = "";
702
+ const ve = () => {
703
+ const G = ge.current;
686
704
  if (G) {
687
705
  const A = G.getBoundingClientRect();
688
- if (ct(A, window.innerWidth, window.innerHeight)) {
689
- h(!1), l && I("");
706
+ if (ft(A, window.innerWidth, window.innerHeight)) {
707
+ h(!1), l && V("");
690
708
  return;
691
709
  }
692
- const H = dt(A);
693
- H !== me && (me = H, W());
710
+ const H = ht(A);
711
+ H !== xe && (xe = H, W());
694
712
  }
695
- ne = requestAnimationFrame(xe);
713
+ ne = requestAnimationFrame(ve);
696
714
  };
697
- return ne = requestAnimationFrame(xe), document.addEventListener("mousedown", n), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q), () => {
698
- cancelAnimationFrame(ne), document.removeEventListener("mousedown", n), p(), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
715
+ return ne = requestAnimationFrame(ve), document.addEventListener("mousedown", n), window.addEventListener("scroll", Y, !0), window.addEventListener("resize", Y), () => {
716
+ cancelAnimationFrame(ne), document.removeEventListener("mousedown", n), p(), window.removeEventListener("scroll", Y, !0), window.removeEventListener("resize", Y);
699
717
  };
700
- }, [L, l, W, X]), Qe(() => {
701
- if (!L)
718
+ }, [R, l, W, U]), Je(() => {
719
+ if (!R)
702
720
  return;
703
721
  W();
704
- const n = U.current;
722
+ const n = X.current;
705
723
  if (!n || typeof ResizeObserver > "u")
706
724
  return;
707
725
  const p = new ResizeObserver(() => W());
708
726
  return p.observe(n), () => p.disconnect();
709
- }, [L, W]);
710
- const M = g(void 0), F = g(void 0), Ee = g(""), Ve = (n) => {
727
+ }, [R, W]);
728
+ const P = g(void 0), F = g(void 0), Ce = g(""), Xe = (n) => {
711
729
  var p;
712
- z(n == null ? void 0 : n.id), (p = M.current) == null || p.call(M, (n == null ? void 0 : n.id) ?? Ee.current), h(!1), l && (I(""), ge.current = !1), i == null || i(n == null ? void 0 : n.id), X();
713
- }, Ie = () => {
714
- h(!1), l && I(""), X();
730
+ z(n == null ? void 0 : n.id), (p = P.current) == null || p.call(P, (n == null ? void 0 : n.id) ?? Ce.current), h(!1), l && (V(""), me.current = !1), i == null || i(n == null ? void 0 : n.id), U();
715
731
  }, Ue = () => {
716
- const n = Ne(U.current)[0];
732
+ h(!1), l && V(""), U();
733
+ }, Ye = () => {
734
+ const n = _e(X.current)[0];
717
735
  if (n) {
718
736
  n.focus();
719
737
  return;
720
738
  }
721
- _e(!0), h(!0);
722
- }, Xe = l && Te ? e.filter((n) => mt(n, Te)) : e;
739
+ ke(!0), h(!0);
740
+ }, Qe = l && Ee ? e.filter((n) => wt(n, Ee)) : e;
723
741
  return /* @__PURE__ */ t(
724
- tt,
742
+ nt,
725
743
  {
726
744
  fullWidth: Z,
727
745
  label: x,
728
- hint: w,
746
+ hint: S,
729
747
  rightSideContent: k,
730
748
  tooltip: E,
731
- name: R,
732
- required: S,
749
+ name: N,
750
+ required: T,
733
751
  requiredIndicator: v,
734
752
  loading: $,
735
753
  formControl: f,
736
754
  description: s,
737
- controlId: ue,
755
+ controlId: pe,
738
756
  labelId: ee,
739
- descriptionId: q,
757
+ descriptionId: K,
740
758
  hintId: te,
741
- loadingComponent: K === void 0 ? /* @__PURE__ */ t(
742
- Pe,
759
+ loadingComponent: I === void 0 ? /* @__PURE__ */ t(
760
+ We,
743
761
  {
744
- heightClass: se[_],
762
+ heightClass: ce[_],
745
763
  helperText: !!o,
746
764
  helperTextMarginTop: !0
747
765
  }
748
- ) : /* @__PURE__ */ t("div", { style: We(K), children: /* @__PURE__ */ t(
749
- Pe,
766
+ ) : /* @__PURE__ */ t("div", { style: Pe(I), children: /* @__PURE__ */ t(
767
+ We,
750
768
  {
751
- heightClass: se[_],
769
+ heightClass: ce[_],
752
770
  helperText: !!o,
753
771
  helperTextMarginTop: !0
754
772
  }
755
773
  ) }),
756
- children: ({ error: n, message: p, onFieldChange: Q, onFieldBlur: ne, emptyValue: me }) => {
757
- M.current = Q, F.current = ne, Ee.current = me;
758
- const xe = y ?? n, G = y === !1 ? void 0 : p, A = `${B}-error`, H = [
759
- q,
774
+ children: ({ error: n, message: p, onFieldChange: Y, onFieldBlur: ne, emptyValue: xe }) => {
775
+ P.current = Y, F.current = ne, Ce.current = xe;
776
+ const ve = w ?? n, G = w === !1 ? void 0 : p, A = `${B}-error`, H = [
777
+ K,
760
778
  te,
761
779
  o ? B : void 0,
762
780
  G ? A : void 0
763
781
  ].filter(Boolean).join(" ") || void 0;
764
- return /* @__PURE__ */ b(ye, { children: [
765
- /* @__PURE__ */ b(
782
+ return /* @__PURE__ */ y(we, { children: [
783
+ /* @__PURE__ */ y(
766
784
  "div",
767
785
  {
768
- ref: ke,
786
+ ref: $e,
769
787
  className: "relative w-full",
770
- style: We(K),
788
+ style: Pe(I),
771
789
  onBlur: (ie) => {
772
- var ae, Oe;
773
- const ve = ie.relatedTarget;
774
- ie.currentTarget.contains(ve) || ((ae = U.current) == null ? void 0 : ae.contains(ve)) === !0 || (Oe = F.current) == null || Oe.call(F);
790
+ var ae, ze;
791
+ const be = ie.relatedTarget;
792
+ ie.currentTarget.contains(be) || ((ae = X.current) == null ? void 0 : ae.contains(be)) === !0 || (ze = F.current) == null || ze.call(F);
775
793
  },
776
794
  children: [
777
- pe && !l && /* @__PURE__ */ t(
795
+ fe && !l && /* @__PURE__ */ t(
778
796
  "button",
779
797
  {
780
798
  type: "button",
781
- onClick: Ae,
799
+ onClick: De,
782
800
  "aria-label": d,
783
- className: `absolute ${fe ? yt[_] : "top-1/2 -translate-y-1/2"} z-10 flex items-center
801
+ className: `absolute ${he ? Ct[_] : "top-1/2 -translate-y-1/2"} z-10 flex items-center
784
802
  justify-center rounded-full text-[var(--malachite-text-placeholder)]
785
803
  hover:text-[var(--malachite-text-primary)] transition-colors
786
- focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${bt[_]}`,
787
- children: /* @__PURE__ */ t(je, { size: 13 })
804
+ focus-visible:[outline:2px_solid_var(--malachite-text-primary)] focus-visible:outline-offset-2 ${Et[_]}`,
805
+ children: /* @__PURE__ */ t(Ze, { size: 13 })
788
806
  }
789
807
  ),
790
808
  /* @__PURE__ */ t(
791
- Ke,
809
+ Be,
792
810
  {
793
- hasClear: pe,
794
- onClear: Ae,
811
+ hasClear: fe,
812
+ onClear: De,
795
813
  clearLabel: d,
796
- ref: he,
797
- isOpen: L,
798
- onClick: () => !c && h(!L),
799
- selectedItem: P,
814
+ ref: ge,
815
+ isOpen: R,
816
+ onClick: () => !c && h(!R),
817
+ selectedItem: M,
800
818
  disabled: c,
801
- error: xe,
802
- tone: N,
819
+ error: ve,
820
+ tone: L,
803
821
  placeholder: C,
804
822
  search: l,
805
823
  showSubtitleInTrigger: D,
806
- searchQuery: Te,
807
- onSearchChange: I,
824
+ searchQuery: Ee,
825
+ onSearchChange: V,
808
826
  onFocusOpen: () => {
809
- if (!ge.current) {
810
- ge.current = !0;
827
+ if (!me.current) {
828
+ me.current = !0;
811
829
  return;
812
830
  }
813
831
  h(!0);
814
832
  },
815
833
  onArrowDown: () => {
816
- c || Ue();
834
+ c || Ye();
817
835
  },
818
836
  size: _,
819
- controlId: ue,
837
+ controlId: pe,
820
838
  hasCallerId: !!O,
821
839
  labelId: ee,
822
840
  describedBy: H,
823
- required: S,
824
- ariaLabel: de,
825
- ariaLabelledBy: Se
841
+ required: T,
842
+ ariaLabel: ue,
843
+ ariaLabelledBy: Te
826
844
  }
827
845
  ),
828
- L && et(
846
+ R && rt(
829
847
  /* @__PURE__ */ t(
830
848
  qe,
831
849
  {
832
- ref: U,
850
+ ref: X,
833
851
  style: {
834
852
  position: "fixed",
835
853
  top: (u == null ? void 0 : u.top) ?? 0,
@@ -839,16 +857,16 @@ const Kt = ({
839
857
  visibility: u ? "visible" : "hidden",
840
858
  opacity: u ? 1 : 0
841
859
  },
842
- items: Xe,
843
- onItemSelected: Ve,
844
- selectedItem: P,
860
+ items: Qe,
861
+ onItemSelected: Xe,
862
+ selectedItem: M,
845
863
  menuLoading: a,
846
864
  emptyMessage: e.length === 0 ? "No options available" : "No results found",
847
- subtitleLayout: ce,
865
+ subtitleLayout: de,
848
866
  size: _,
849
- autoFocus: !l || Be,
867
+ autoFocus: !l || Ve,
850
868
  positioned: u !== null,
851
- onDismiss: Ie
869
+ onDismiss: Ue
852
870
  }
853
871
  ),
854
872
  document.body
@@ -864,13 +882,13 @@ const Kt = ({
864
882
  children: o
865
883
  }
866
884
  ),
867
- /* @__PURE__ */ t(nt, { id: A, message: G, spaced: !0 })
885
+ /* @__PURE__ */ t(at, { id: A, message: G, spaced: !0 })
868
886
  ] });
869
887
  }
870
888
  }
871
889
  );
872
890
  };
873
891
  export {
874
- Kt as Dropdown
892
+ Yt as Dropdown
875
893
  };
876
894
  //# sourceMappingURL=Dropdown.js.map