@travel-match/ui 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/components/AccountMenu/AccountMenu.cjs +1 -1
  2. package/dist/components/AccountMenu/AccountMenu.cjs.map +1 -1
  3. package/dist/components/AccountMenu/AccountMenu.js +1 -1
  4. package/dist/components/AccountMenu/AccountMenu.js.map +1 -1
  5. package/dist/components/ConfirmationDialog/ConfirmationDialog.cjs +1 -1
  6. package/dist/components/ConfirmationDialog/ConfirmationDialog.cjs.map +1 -1
  7. package/dist/components/ConfirmationDialog/ConfirmationDialog.js +1 -0
  8. package/dist/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
  9. package/dist/components/CtaRequestFlow/CtaRequestFlow.cjs +1 -1
  10. package/dist/components/CtaRequestFlow/CtaRequestFlow.cjs.map +1 -1
  11. package/dist/components/CtaRequestFlow/CtaRequestFlow.js +72 -37
  12. package/dist/components/CtaRequestFlow/CtaRequestFlow.js.map +1 -1
  13. package/dist/components/ExampleRequests/ExampleRequests.cjs +1 -1
  14. package/dist/components/ExampleRequests/ExampleRequests.cjs.map +1 -1
  15. package/dist/components/ExampleRequests/ExampleRequests.js +18 -17
  16. package/dist/components/ExampleRequests/ExampleRequests.js.map +1 -1
  17. package/dist/components/FaqItem/FaqItem.cjs +1 -1
  18. package/dist/components/FaqItem/FaqItem.cjs.map +1 -1
  19. package/dist/components/FaqItem/FaqItem.js +79 -34
  20. package/dist/components/FaqItem/FaqItem.js.map +1 -1
  21. package/dist/components/Field/Field.cjs +1 -1
  22. package/dist/components/Field/Field.cjs.map +1 -1
  23. package/dist/components/Field/Field.js +10 -8
  24. package/dist/components/Field/Field.js.map +1 -1
  25. package/dist/components/InlineAlert/InlineAlert.cjs +1 -1
  26. package/dist/components/InlineAlert/InlineAlert.cjs.map +1 -1
  27. package/dist/components/InlineAlert/InlineAlert.js +9 -8
  28. package/dist/components/InlineAlert/InlineAlert.js.map +1 -1
  29. package/dist/components/NewRequestOverlay/NewRequestOverlay.cjs +1 -1
  30. package/dist/components/NewRequestOverlay/NewRequestOverlay.cjs.map +1 -1
  31. package/dist/components/NewRequestOverlay/NewRequestOverlay.js +67 -48
  32. package/dist/components/NewRequestOverlay/NewRequestOverlay.js.map +1 -1
  33. package/dist/components/NotificationsDropdown/NotificationsMenu.cjs +1 -1
  34. package/dist/components/NotificationsDropdown/NotificationsMenu.cjs.map +1 -1
  35. package/dist/components/NotificationsDropdown/NotificationsMenu.js +1 -1
  36. package/dist/components/NotificationsDropdown/NotificationsMenu.js.map +1 -1
  37. package/dist/components/PartnerCarousel/PartnerCarousel.cjs.map +1 -1
  38. package/dist/components/PartnerCarousel/PartnerCarousel.js.map +1 -1
  39. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  40. package/dist/components/PhoneInput/PhoneInput.cjs.map +1 -1
  41. package/dist/components/PhoneInput/PhoneInput.js +8 -5
  42. package/dist/components/PhoneInput/PhoneInput.js.map +1 -1
  43. package/dist/components/PopularQuestions/PopularQuestions.cjs +1 -1
  44. package/dist/components/PopularQuestions/PopularQuestions.cjs.map +1 -1
  45. package/dist/components/PopularQuestions/PopularQuestions.js +22 -21
  46. package/dist/components/PopularQuestions/PopularQuestions.js.map +1 -1
  47. package/dist/components/RegionMap/RegionMap.cjs +2 -0
  48. package/dist/components/RegionMap/RegionMap.cjs.map +1 -0
  49. package/dist/components/RegionMap/RegionMap.js +55 -0
  50. package/dist/components/RegionMap/RegionMap.js.map +1 -0
  51. package/dist/components/RegionMap/mapPaths.cjs +2 -0
  52. package/dist/components/RegionMap/mapPaths.cjs.map +1 -0
  53. package/dist/components/RegionMap/mapPaths.js +86 -0
  54. package/dist/components/RegionMap/mapPaths.js.map +1 -0
  55. package/dist/components/RequestSearch/RequestSearch.cjs +2 -0
  56. package/dist/components/RequestSearch/RequestSearch.cjs.map +1 -0
  57. package/dist/components/RequestSearch/RequestSearch.js +36 -0
  58. package/dist/components/RequestSearch/RequestSearch.js.map +1 -0
  59. package/dist/components/RequestSummary/RequestSummary.cjs +1 -1
  60. package/dist/components/RequestSummary/RequestSummary.cjs.map +1 -1
  61. package/dist/components/RequestSummary/RequestSummary.js +31 -32
  62. package/dist/components/RequestSummary/RequestSummary.js.map +1 -1
  63. package/dist/components/RequestTypeOption/RequestTypeOption.cjs +2 -0
  64. package/dist/components/RequestTypeOption/RequestTypeOption.cjs.map +1 -0
  65. package/dist/components/RequestTypeOption/RequestTypeOption.js +52 -0
  66. package/dist/components/RequestTypeOption/RequestTypeOption.js.map +1 -0
  67. package/dist/components/Select/Select.cjs +1 -1
  68. package/dist/components/Select/Select.cjs.map +1 -1
  69. package/dist/components/Select/Select.js +127 -121
  70. package/dist/components/Select/Select.js.map +1 -1
  71. package/dist/components/ShowMore/ShowMore.cjs +2 -0
  72. package/dist/components/ShowMore/ShowMore.cjs.map +1 -0
  73. package/dist/components/ShowMore/ShowMore.js +34 -0
  74. package/dist/components/ShowMore/ShowMore.js.map +1 -0
  75. package/dist/components/SiteHeader/SiteHeader.cjs.map +1 -1
  76. package/dist/components/SiteHeader/SiteHeader.js.map +1 -1
  77. package/dist/components/SortSelect/SortSelect.cjs +2 -0
  78. package/dist/components/SortSelect/SortSelect.cjs.map +1 -0
  79. package/dist/components/SortSelect/SortSelect.js +18 -0
  80. package/dist/components/SortSelect/SortSelect.js.map +1 -0
  81. package/dist/components/StatusFilter/StatusFilter.cjs +2 -0
  82. package/dist/components/StatusFilter/StatusFilter.cjs.map +1 -0
  83. package/dist/components/StatusFilter/StatusFilter.js +37 -0
  84. package/dist/components/StatusFilter/StatusFilter.js.map +1 -0
  85. package/dist/components/StatusTag/StatusTag.cjs.map +1 -1
  86. package/dist/components/StatusTag/StatusTag.js.map +1 -1
  87. package/dist/components/StepCard/StepCard.cjs +1 -1
  88. package/dist/components/StepCard/StepCard.cjs.map +1 -1
  89. package/dist/components/StepCard/StepCard.js +9 -6
  90. package/dist/components/StepCard/StepCard.js.map +1 -1
  91. package/dist/components/StepProgress/StepProgress.cjs +2 -0
  92. package/dist/components/StepProgress/StepProgress.cjs.map +1 -0
  93. package/dist/components/StepProgress/StepProgress.js +43 -0
  94. package/dist/components/StepProgress/StepProgress.js.map +1 -0
  95. package/dist/components/TelegramConnect/TelegramConnect.cjs +2 -0
  96. package/dist/components/TelegramConnect/TelegramConnect.cjs.map +1 -0
  97. package/dist/components/TelegramConnect/TelegramConnect.js +57 -0
  98. package/dist/components/TelegramConnect/TelegramConnect.js.map +1 -0
  99. package/dist/components/TextInput/TextInput.cjs +1 -1
  100. package/dist/components/TextInput/TextInput.cjs.map +1 -1
  101. package/dist/components/TextInput/TextInput.js +21 -19
  102. package/dist/components/TextInput/TextInput.js.map +1 -1
  103. package/dist/components/Textarea/Textarea.cjs +1 -1
  104. package/dist/components/Textarea/Textarea.cjs.map +1 -1
  105. package/dist/components/Textarea/Textarea.js +18 -16
  106. package/dist/components/Textarea/Textarea.js.map +1 -1
  107. package/dist/components/Toast/Toast.cjs +2 -0
  108. package/dist/components/Toast/Toast.cjs.map +1 -0
  109. package/dist/components/Toast/Toast.js +57 -0
  110. package/dist/components/Toast/Toast.js.map +1 -0
  111. package/dist/icons/generated/CheckmarkIcon.cjs +1 -1
  112. package/dist/icons/generated/CheckmarkIcon.cjs.map +1 -1
  113. package/dist/icons/generated/CheckmarkIcon.js +19 -2
  114. package/dist/icons/generated/CheckmarkIcon.js.map +1 -1
  115. package/dist/icons/generated/InfoIcon.cjs +2 -0
  116. package/dist/icons/generated/InfoIcon.cjs.map +1 -0
  117. package/dist/icons/generated/InfoIcon.js +35 -0
  118. package/dist/icons/generated/InfoIcon.js.map +1 -0
  119. package/dist/icons/generated/SendIcon.cjs +2 -0
  120. package/dist/icons/generated/SendIcon.cjs.map +1 -0
  121. package/dist/icons/generated/SendIcon.js +23 -0
  122. package/dist/icons/generated/SendIcon.js.map +1 -0
  123. package/dist/icons/generated/index.cjs +1 -1
  124. package/dist/icons/generated/index.cjs.map +1 -1
  125. package/dist/icons/generated/index.js +71 -67
  126. package/dist/icons/generated/index.js.map +1 -1
  127. package/dist/index.cjs +1 -1
  128. package/dist/index.d.cts +618 -32
  129. package/dist/index.d.ts +618 -32
  130. package/dist/index.js +146 -135
  131. package/dist/styles.css +1 -1
  132. package/dist/tailwind.css +0 -6
  133. package/dist/tokens/generated.cjs +1 -1
  134. package/dist/tokens/generated.cjs.map +1 -1
  135. package/dist/tokens/generated.js +1 -7
  136. package/dist/tokens/generated.js.map +1 -1
  137. package/dist/tokens.css +0 -12
  138. package/dist/tokens.d.cts +2 -26
  139. package/dist/tokens.d.ts +2 -26
  140. package/dist/tokens.json +1 -7
  141. package/package.json +1 -1
@@ -3,61 +3,63 @@ import { DownArrowIcon as e } from "../../icons/generated/DownArrowIcon.js";
3
3
  import { SearchIcon as t } from "../../icons/generated/SearchIcon.js";
4
4
  import { UpArrowIcon as n } from "../../icons/generated/UpArrowIcon.js";
5
5
  import { cn as r } from "../../utils/cn.js";
6
- import { FormField as i, useFieldIds as a } from "../Field/Field.js";
7
- import { Option as o, OptionList as s } from "../OptionList/OptionList.js";
8
- import { SelectedItem as ee } from "./SelectedItem.js";
6
+ import { FormField as i, useFieldIds as ee } from "../Field/Field.js";
7
+ import { Option as a, OptionList as o } from "../OptionList/OptionList.js";
8
+ import { SelectedItem as te } from "./SelectedItem.js";
9
9
  /* empty css */
10
- import { forwardRef as c, useEffect as l, useMemo as te, useRef as u, useState as d } from "react";
11
- import { Fragment as ne, jsx as f, jsxs as p } from "react/jsx-runtime";
12
- import * as m from "@radix-ui/react-popover";
10
+ import { forwardRef as s, useEffect as c, useMemo as ne, useRef as l, useState as u } from "react";
11
+ import { Fragment as re, jsx as d, jsxs as f } from "react/jsx-runtime";
12
+ import * as p from "@radix-ui/react-popover";
13
13
  // src/components/Select/Select.tsx
14
- var h = (e) => Array.isArray(e) ? e : e == null || e === "" ? [] : [e], g = (e) => typeof e == "string" || typeof e == "number" ? String(e) : "", _ = (e) => e.textValue ?? (g(e.label) || e.value), v = (e, t) => [
15
- _(e),
16
- g(e.detail),
17
- g(e.description)
18
- ].some((e) => e.toLowerCase().includes(t)), y = (e) => e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey, re = (e) => `Remove ${e}`, b = /* @__PURE__ */ c(function({ label: c, helperText: g, error: b, required: ie, optional: ae, size: x = "md", options: S, placeholder: oe = "Select option", name: C, invalid: se, searchable: w = !1, searchPlaceholder: T = "Search", emptyText: ce = "No results", startIcon: le, renderValue: ue, checkmark: de = !0, fullWidth: fe = !0, align: pe = "start", open: me, defaultOpen: he = !1, onOpenChange: ge, portalContainer: _e, panelAnchor: E, panelClassName: ve, removeLabel: ye = re, multiple: D = !1, value: O, defaultValue: be, onValueChange: xe, disabled: k = !1, id: Se, className: Ce, style: we, onKeyDown: Te, onKeyUp: Ee, "aria-describedby": De, "aria-labelledby": A, ...Oe }, ke) {
19
- let j = a(Se, !!(b || g)), M = `${j.controlId}-list`, Ae = (e) => `${j.controlId}-option-${e}`, [je, Me] = d(he), [Ne, Pe] = d(() => h(be)), [Fe, N] = d(""), [P, F] = d(null), I = u(null), L = u(!1), R = u({
14
+ var m = (e) => Array.isArray(e) ? e : e == null || e === "" ? [] : [e], h = (e) => typeof e == "string" || typeof e == "number" ? String(e) : "", g = (e) => e.textValue ?? (h(e.label) || e.value), _ = (e, t) => [
15
+ g(e),
16
+ h(e.detail),
17
+ h(e.description)
18
+ ].some((e) => e.toLowerCase().includes(t)), v = (e) => e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey, ie = (e) => `Remove ${e}`, y = /* @__PURE__ */ s(function({ label: s, helperText: h, error: y, required: ae, optional: oe, errorColor: se, errorBox: ce, size: b = "md", options: x, placeholder: le = "Select option", name: S, invalid: ue, searchable: C = !1, searchPlaceholder: w = "Search", emptyText: de = "No results", startIcon: fe, renderValue: T, checkmark: pe = !0, fullWidth: me = !0, align: he = "start", open: ge, defaultOpen: _e = !1, onOpenChange: ve, portalContainer: ye, panelAnchor: E, panelClassName: be, listSize: xe, removeLabel: Se = ie, multiple: D = !1, value: O, defaultValue: Ce, onValueChange: we, disabled: k = !1, readOnly: A = !1, id: Te, className: Ee, style: De, onKeyDown: Oe, onKeyUp: ke, "aria-describedby": Ae, "aria-labelledby": j, ...je }, Me) {
19
+ let M = ee(Te, !!(y || h)), N = `${M.controlId}-list`, Ne = (e) => `${M.controlId}-option-${e}`, [Pe, Fe] = u(_e), [Ie, Le] = u(() => m(Ce)), [P, F] = u(""), [I, L] = u(null), R = l(null), z = l(!1), B = l({
20
20
  text: "",
21
21
  timer: 0
22
- }), z = (me ?? je) && !k, [Ie, Le] = d(0);
23
- l(() => {
24
- E && Le((e) => e + 1);
25
- }, [E, z]);
26
- let Re = te(() => ({ current: {
22
+ }), V = (ge ?? Pe) && !k && !A, [Re, ze] = u(0);
23
+ c(() => {
24
+ E && ze((e) => e + 1);
25
+ }, [E, V]);
26
+ let Be = ne(() => ({ current: {
27
27
  getBoundingClientRect: () => E?.current?.getBoundingClientRect() ?? new DOMRect(),
28
28
  contextElement: E?.current ?? void 0
29
- } }), [E, Ie]), B = O === void 0 ? Ne : h(O), V = B.map((e) => S.find((t) => t.value === e)).filter((e) => e !== void 0), H = !!b || !!se, U = w ? Fe.trim().toLowerCase() : "", W = U ? S.filter((e) => v(e, U)) : S, G = W.filter((e) => !e.disabled), K = G.find((e) => e.value === P), q = K ? Ae(S.indexOf(K)) : void 0;
30
- l(() => {
31
- z && q && document.getElementById(q)?.scrollIntoView?.({ block: "nearest" });
32
- }, [z, q]), l(() => () => window.clearTimeout(R.current.timer), []);
29
+ } }), [E, Re]), H = O === void 0 ? Ie : m(O), U = H.map((e) => x.find((t) => t.value === e)).filter((e) => e !== void 0), Ve = !!y || !!ue, He = C ? P.trim().toLowerCase() : "", W = He ? x.filter((e) => _(e, He)) : x, G = W.filter((e) => !e.disabled), K = G.find((e) => e.value === I), q = K ? Ne(x.indexOf(K)) : void 0;
30
+ c(() => {
31
+ V && q && document.getElementById(q)?.scrollIntoView?.({ block: "nearest" });
32
+ }, [V, q]), c(() => () => window.clearTimeout(B.current.timer), []);
33
33
  let J = (e, t = "none") => {
34
- if (e) {
35
- let e = S.filter((e) => !e.disabled), n = e.find((e) => B.includes(e.value)), r = t === "none" ? void 0 : t === "last" ? e[e.length - 1] : t === "first" ? e[0] : n ?? e[0];
36
- N(""), F(r?.value ?? null);
34
+ if (!(e && A)) {
35
+ if (e) {
36
+ let e = x.filter((e) => !e.disabled), n = e.find((e) => H.includes(e.value)), r = t === "none" ? void 0 : t === "last" ? e[e.length - 1] : t === "first" ? e[0] : n ?? e[0];
37
+ F(""), L(r?.value ?? null);
38
+ }
39
+ ge === void 0 && Fe(e), ve?.(e);
37
40
  }
38
- me === void 0 && Me(e), ge?.(e);
39
- }, ze = (e) => {
40
- O === void 0 && Pe(e);
41
- let t = xe;
41
+ }, Ue = (e) => {
42
+ O === void 0 && Le(e);
43
+ let t = we;
42
44
  D ? t?.(e) : e[0] !== void 0 && t?.(e[0]);
43
- }, Be = (e) => ze(B.includes(e) ? B.filter((t) => t !== e) : [...B, e]), Y = (e) => {
44
- e.disabled || (D ? (Be(e.value), F(e.value)) : (B[0] !== e.value && ze([e.value]), J(!1)));
45
+ }, We = (e) => Ue(H.includes(e) ? H.filter((t) => t !== e) : [...H, e]), Y = (e) => {
46
+ e.disabled || (D ? (We(e.value), L(e.value)) : (H[0] !== e.value && Ue([e.value]), J(!1)));
45
47
  }, X = (e) => {
46
48
  if (G.length === 0) return;
47
49
  let t = K ? G.indexOf(K) : -1, n;
48
50
  if (e === "first") n = 0;
49
51
  else if (e === "last") n = G.length - 1;
50
52
  else if (t === -1) {
51
- let t = G.findIndex((e) => B.includes(e.value));
53
+ let t = G.findIndex((e) => H.includes(e.value));
52
54
  n = t === -1 ? e === 1 ? 0 : G.length - 1 : t;
53
55
  } else n = Math.min(G.length - 1, Math.max(0, t + e));
54
- F(G[n].value);
56
+ L(G[n].value);
55
57
  }, Z = (e) => {
56
- let t = R.current;
58
+ let t = B.current;
57
59
  window.clearTimeout(t.timer), t.text += e.toLowerCase(), t.timer = window.setTimeout(() => t.text = "", 500);
58
- let n = S.filter((e) => !e.disabled), r = n.findIndex((e) => e.value === P), i = t.text.split("").every((e) => e === t.text[0]), a = i ? t.text[0] : t.text, o = i || t.text.length === 1 ? r + 1 : Math.max(r, 0), s = [...n.slice(o), ...n.slice(0, o)].find((e) => _(e).toLowerCase().startsWith(a));
59
- s && F(s.value);
60
- }, Ve = (e, t) => {
60
+ let n = x.filter((e) => !e.disabled), r = n.findIndex((e) => e.value === I), i = t.text.split("").every((e) => e === t.text[0]), ee = i ? t.text[0] : t.text, a = i || t.text.length === 1 ? r + 1 : Math.max(r, 0), o = [...n.slice(a), ...n.slice(0, a)].find((e) => g(e).toLowerCase().startsWith(ee));
61
+ o && L(o.value);
62
+ }, Ge = (e, t) => {
61
63
  switch (e.key) {
62
64
  case "ArrowDown":
63
65
  e.preventDefault(), X(1);
@@ -72,168 +74,172 @@ var h = (e) => Array.isArray(e) ? e : e == null || e === "" ? [] : [e], g = (e)
72
74
  case "Enter":
73
75
  e.preventDefault(), K && Y(K);
74
76
  break;
75
- case "Tab": t === "search" ? e.preventDefault() : L.current = !0, J(!1);
77
+ case "Tab": t === "search" ? e.preventDefault() : z.current = !0, J(!1);
76
78
  }
77
- }, He = (e) => {
78
- Te?.(e), e.defaultPrevented || (z ? e.key === " " ? (e.preventDefault(), R.current.text ? Z(" ") : K && Y(K)) : y(e) && !w ? (e.preventDefault(), Z(e.key)) : Ve(e, "trigger") : [
79
+ }, Ke = (e) => {
80
+ Oe?.(e), e.defaultPrevented || A || (V ? e.key === " " ? (e.preventDefault(), B.current.text ? Z(" ") : K && Y(K)) : v(e) && !C ? (e.preventDefault(), Z(e.key)) : Ge(e, "trigger") : [
79
81
  "ArrowDown",
80
82
  "ArrowUp",
81
83
  "Enter",
82
84
  " ",
83
85
  "Home",
84
86
  "End"
85
- ].includes(e.key) ? (e.preventDefault(), J(!0, e.key === "Home" ? "first" : e.key === "End" ? "last" : "selected")) : y(e) && (e.preventDefault(), J(!0), w ? Ue(e.key) : Z(e.key)));
86
- }, Ue = (e) => {
87
+ ].includes(e.key) ? (e.preventDefault(), J(!0, e.key === "Home" ? "first" : e.key === "End" ? "last" : "selected")) : v(e) && (e.preventDefault(), J(!0), C ? qe(e.key) : Z(e.key)));
88
+ }, qe = (e) => {
87
89
  let t = e.trim().toLowerCase();
88
- N(e), F(S.find((e) => !e.disabled && (!t || v(e, t)))?.value ?? null);
89
- }, Q = D ? void 0 : V[0], $ = D && V.length > 0, We = z ? n : e, Ge = /* @__PURE__ */ p("div", {
90
+ F(e), L(x.find((e) => !e.disabled && (!t || _(e, t)))?.value ?? null);
91
+ }, Q = D ? void 0 : U[0], $ = D && U.length > 0, Je = V ? n : e, Ye = /* @__PURE__ */ f("div", {
90
92
  className: "tm-field tm-select__control",
91
- "data-size": x,
92
- "data-tm-icon-size": x,
93
- "data-invalid": H ? "" : void 0,
93
+ "data-size": b,
94
+ "data-tm-icon-size": b,
95
+ "data-invalid": Ve ? "" : void 0,
94
96
  "data-disabled": k ? "" : void 0,
95
- "data-focus": z ? "" : void 0,
97
+ "data-readonly": A && !k ? "" : void 0,
98
+ "data-focus": V ? "" : void 0,
96
99
  "data-has-chips": $ ? "" : void 0,
97
- children: [$ ? /* @__PURE__ */ f("span", {
100
+ children: [$ ? /* @__PURE__ */ d("span", {
98
101
  className: "tm-select__chips",
99
- children: V.map((e) => /* @__PURE__ */ f(ee, {
100
- size: x,
102
+ children: U.map((e) => /* @__PURE__ */ d(te, {
103
+ size: b,
101
104
  disabled: k,
102
- removeLabel: ye(_(e)),
103
- onRemove: () => Be(e.value),
105
+ removeLabel: Se(g(e)),
106
+ onRemove: A ? void 0 : () => We(e.value),
104
107
  children: e.label
105
108
  }, e.value))
106
- }) : null, /* @__PURE__ */ f(m.Trigger, {
109
+ }) : null, /* @__PURE__ */ d(p.Trigger, {
107
110
  asChild: !0,
108
- children: /* @__PURE__ */ p("button", {
109
- ref: ke,
111
+ children: /* @__PURE__ */ f("button", {
112
+ ref: Me,
110
113
  type: "button",
111
- id: j.controlId,
114
+ id: M.controlId,
112
115
  className: "tm-select__trigger",
113
116
  role: "combobox",
114
117
  "aria-haspopup": "listbox",
115
- "aria-expanded": z,
116
- "aria-controls": z ? M : void 0,
117
- "aria-activedescendant": z && !w ? q : void 0,
118
- "aria-labelledby": A ?? (c ? j.labelId : void 0),
119
- "aria-describedby": r(De, j.messageId) || void 0,
120
- "aria-invalid": H || void 0,
121
- "aria-required": ie || void 0,
118
+ "aria-expanded": V,
119
+ "aria-controls": V ? N : void 0,
120
+ "aria-activedescendant": V && !C ? q : void 0,
121
+ "aria-labelledby": j ?? (s ? M.labelId : void 0),
122
+ "aria-describedby": r(Ae, M.messageId) || void 0,
123
+ "aria-invalid": Ve || void 0,
124
+ "aria-required": ae || void 0,
125
+ "aria-readonly": A || void 0,
122
126
  disabled: k,
123
- onKeyDown: He,
127
+ onKeyDown: Ke,
124
128
  onKeyUp: (e) => {
125
- Ee?.(e), e.key === " " && e.preventDefault();
129
+ ke?.(e), e.key === " " && e.preventDefault();
126
130
  },
127
- ...Oe,
131
+ ...je,
128
132
  children: [
129
- le,
130
- Q ? /* @__PURE__ */ f("span", {
133
+ fe,
134
+ Q ? /* @__PURE__ */ d("span", {
131
135
  className: "tm-select__value",
132
- children: ue ? ue(Q) : Q.label
133
- }) : $ ? /* @__PURE__ */ f("span", {
136
+ children: T ? T(Q) : Q.label
137
+ }) : $ ? /* @__PURE__ */ d("span", {
134
138
  className: "tm-select__value tm-select__value--hidden",
135
- children: V.map(_).join(", ")
136
- }) : /* @__PURE__ */ f("span", {
139
+ children: U.map(g).join(", ")
140
+ }) : /* @__PURE__ */ d("span", {
137
141
  className: "tm-select__value",
138
142
  "data-placeholder": "",
139
- children: oe
143
+ children: le
140
144
  }),
141
- /* @__PURE__ */ f(We, { className: "tm-select__chevron" })
145
+ /* @__PURE__ */ d(Je, { className: "tm-select__chevron" })
142
146
  ]
143
147
  })
144
148
  })]
145
149
  });
146
- return /* @__PURE__ */ p(m.Root, {
147
- open: z,
150
+ return /* @__PURE__ */ f(p.Root, {
151
+ open: V,
148
152
  onOpenChange: (e) => J(e),
149
- children: [/* @__PURE__ */ p(i, {
150
- ids: j,
151
- label: c,
152
- helperText: g,
153
- error: b,
154
- required: ie,
155
- optional: ae,
156
- size: x,
157
- className: r("tm-select", Ce),
158
- style: we,
159
- "data-full-width": fe ? "" : void 0,
160
- children: [E ? /* @__PURE__ */ p(ne, { children: [/* @__PURE__ */ f(m.Anchor, { virtualRef: Re }), Ge] }) : /* @__PURE__ */ f(m.Anchor, {
153
+ children: [/* @__PURE__ */ f(i, {
154
+ ids: M,
155
+ label: s,
156
+ helperText: h,
157
+ error: y,
158
+ required: ae,
159
+ optional: oe,
160
+ size: b,
161
+ errorColor: se,
162
+ errorBox: ce,
163
+ className: r("tm-select", Ee),
164
+ style: De,
165
+ "data-full-width": me ? "" : void 0,
166
+ children: [E ? /* @__PURE__ */ f(re, { children: [/* @__PURE__ */ d(p.Anchor, { virtualRef: Be }), Ye] }) : /* @__PURE__ */ d(p.Anchor, {
161
167
  asChild: !0,
162
- children: Ge
163
- }), C ? (D ? B : [B[0] ?? ""]).map((e) => /* @__PURE__ */ f("input", {
168
+ children: Ye
169
+ }), S ? (D ? H : [H[0] ?? ""]).map((e) => /* @__PURE__ */ d("input", {
164
170
  type: "hidden",
165
- name: C,
171
+ name: S,
166
172
  value: e,
167
173
  disabled: k
168
174
  }, e)) : null]
169
- }), /* @__PURE__ */ f(m.Portal, {
170
- container: _e,
171
- children: /* @__PURE__ */ p(m.Content, {
175
+ }), /* @__PURE__ */ d(p.Portal, {
176
+ container: ye,
177
+ children: /* @__PURE__ */ f(p.Content, {
172
178
  role: "presentation",
173
- className: r("tm-option-panel tm-select__panel", ve),
174
- "data-size": x,
175
- "data-fit": fe ? "field" : "content",
176
- align: pe,
179
+ className: r("tm-option-panel tm-select__panel", be),
180
+ "data-size": b,
181
+ "data-fit": me ? "field" : "content",
182
+ align: he,
177
183
  sideOffset: 8,
178
184
  collisionPadding: 8,
179
185
  onOpenAutoFocus: (e) => {
180
- e.preventDefault(), I.current?.focus();
186
+ e.preventDefault(), R.current?.focus();
181
187
  },
182
188
  onCloseAutoFocus: (e) => {
183
- L.current && e.preventDefault(), L.current = !1;
189
+ z.current && e.preventDefault(), z.current = !1;
184
190
  },
185
191
  children: [
186
- w ? /* @__PURE__ */ p("div", {
192
+ C ? /* @__PURE__ */ f("div", {
187
193
  className: "tm-select__search",
188
- children: [/* @__PURE__ */ f(t, { size: "sm" }), /* @__PURE__ */ f("input", {
189
- ref: I,
194
+ children: [/* @__PURE__ */ d(t, { size: "sm" }), /* @__PURE__ */ d("input", {
195
+ ref: R,
190
196
  className: "tm-select__search-input",
191
197
  type: "text",
192
198
  role: "combobox",
193
- "aria-label": T,
199
+ "aria-label": w,
194
200
  "aria-expanded": "true",
195
- "aria-controls": M,
201
+ "aria-controls": N,
196
202
  "aria-autocomplete": "list",
197
203
  "aria-activedescendant": q,
198
204
  autoComplete: "off",
199
205
  spellCheck: !1,
200
- placeholder: T,
201
- value: Fe,
202
- onChange: (e) => Ue(e.target.value),
203
- onKeyDown: (e) => Ve(e, "search")
206
+ placeholder: w,
207
+ value: P,
208
+ onChange: (e) => qe(e.target.value),
209
+ onKeyDown: (e) => Ge(e, "search")
204
210
  })]
205
211
  }) : null,
206
- /* @__PURE__ */ f(s, {
207
- id: M,
208
- size: x,
212
+ /* @__PURE__ */ d(o, {
213
+ id: N,
214
+ size: xe ?? b,
209
215
  multiple: D,
210
216
  surface: !1,
211
- "aria-labelledby": A ?? (c ? j.labelId : void 0),
212
- "aria-label": A || c ? void 0 : Oe["aria-label"],
217
+ "aria-labelledby": j ?? (s ? M.labelId : void 0),
218
+ "aria-label": j || s ? void 0 : je["aria-label"],
213
219
  onMouseDown: (e) => e.preventDefault(),
214
- children: W.map((e) => /* @__PURE__ */ f(o, {
215
- id: Ae(S.indexOf(e)),
216
- selected: B.includes(e.value),
220
+ children: W.map((e) => /* @__PURE__ */ d(a, {
221
+ id: Ne(x.indexOf(e)),
222
+ selected: H.includes(e.value),
217
223
  active: e === K,
218
224
  disabled: e.disabled,
219
225
  icon: e.icon,
220
226
  detail: e.detail,
221
227
  description: e.description,
222
- indicator: D ? "checkbox" : de ? "check" : "none",
228
+ indicator: D ? "checkbox" : pe ? "check" : "none",
223
229
  onClick: () => Y(e),
224
230
  children: e.label
225
231
  }, e.value))
226
232
  }),
227
- W.length === 0 ? /* @__PURE__ */ f("p", {
233
+ W.length === 0 ? /* @__PURE__ */ d("p", {
228
234
  className: "tm-select__empty",
229
235
  role: "status",
230
- children: ce
236
+ children: de
231
237
  }) : null
232
238
  ]
233
239
  })
234
240
  })]
235
241
  });
236
242
  });
237
- export { b as Select };
243
+ export { y as Select };
238
244
 
239
245
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["_Fragment","Fragment$1","Popover","toArray","value","asText","node","optionText","option","matches","text","query","isPrintable","event","defaultRemoveLabel","Select","invalidProp","openProp","ariaDescribedBy","ariaLabelledBy","props","ids","useFieldIds","id","error","helperText","listId","optionId","index","internalOpen","setInternalOpen","useState","defaultOpen","internalValue","setInternalValue","defaultValue","setQuery","activeValue","setActiveValue","searchRef","useRef","keepFocusOnClose","typed","isOpen","disabled","anchorVersion","setAnchorVersion","panelAnchor","version","virtualAnchor","useMemo","selectedValues","selectedOptions","options","selected","invalid","needle","searchable","visible","enabled","activeOption","activeId","useEffect","setOpen","next","candidates","initial","focus","onOpenChange","emit","notify","onValueChange","multiple","toggle","optionValue","commit","move","current","to","typeAhead","state","char","repeated","letter","term","from","match","handleListKeys","source","handleTriggerKeyDown","onKeyDown","search","single","hasChips","Chevron","UpArrowIcon","DownArrowIcon","control","size","SelectedItem","removeLabel","label","cn","required","onKeyUp","startIcon","renderValue","placeholder","FormField","className","fullWidth","name","portalContainer","panelClassName","SearchIcon","searchPlaceholder","OptionList","Option","checkmark","emptyText"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { DownArrowIcon, SearchIcon, UpArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { FormField, useFieldIds, type FieldSize, type FormFieldProps } from '../Field';\nimport { Option, OptionList } from '../OptionList';\nimport { SelectedItem } from './SelectedItem';\nimport './Select.css';\n\nexport interface SelectOption {\n /** What `value` / `onValueChange` carry and what a form submits. */\n value: string;\n /** Text in the list and in the field, e.g. \"Armenia\", \"EN\", \"AMD\". */\n label: ReactNode;\n /** Regular-weight text after the label in the list only, e.g. \"English\" after \"EN\". */\n detail?: ReactNode;\n /** Small second line in the list (Figma \"Caption\"). */\n description?: ReactNode;\n /** Icon or flag before the label in the list (Figma \"Icon\"). */\n icon?: ReactNode;\n /** The option is shown but cannot be chosen. */\n disabled?: boolean;\n /** Plain text for type-ahead, search and the remove button when `label` is not a string. */\n textValue?: string;\n}\n\ntype TriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children' | 'type' | 'name' | 'role'>;\n\ninterface SelectBaseProps extends FormFieldProps, TriggerProps {\n /** The options, in display order. */\n options: SelectOption[];\n /** Shown in the field while nothing is selected. */\n placeholder?: ReactNode;\n /** Figma \"Size\": `lg` 52px · `md` 46px (default) · `sm` 42px. */\n size?: FieldSize;\n /** Adds hidden inputs so the value is submitted with a native form (one per value when `multiple`). */\n name?: string;\n /** Invalid look without a message of its own — for composite fields that show one message for several controls. */\n invalid?: boolean;\n /** Adds a search box above the list (Figma \"Type=Currency, State=Open\"); typing filters by label, detail and description. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown instead of the list when the search matches nothing. */\n emptyText?: ReactNode;\n /** Icon in front of the value, e.g. `<LanguageIcon />`. */\n startIcon?: ReactNode;\n /** Custom content for the selected option in the field (single select), e.g. flag + dial code. Defaults to its `label`. */\n renderValue?: (option: SelectOption) => ReactNode;\n /** Shows the check mark on the selected option (Figma \"Done\"). Ignored when `multiple`, which uses checkboxes. */\n checkmark?: boolean;\n /** `false` makes the field hug its content (Figma \"Both-icon-drop-down\", \"Language\", \"Type=Currency\"); the list is then as wide as its options. */\n fullWidth?: boolean;\n /** How the list lines up with the field. */\n align?: 'start' | 'center' | 'end';\n /** Whether the list is open (controlled; Figma \"State=Clicked\" / \"Open\"). */\n open?: boolean;\n /** Opens the list initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Element the list is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Element the list aligns to and takes its width from, when that is not the field itself (e.g. a whole phone-number row). */\n panelAnchor?: RefObject<HTMLElement | null>;\n /** Class for the list panel, which is rendered in a portal outside the root. */\n panelClassName?: string;\n /** Accessible name of a chip's × button (`multiple`), given the option's text. */\n removeLabel?: (optionText: string) => string;\n}\n\nexport interface SelectSingleProps extends SelectBaseProps {\n /** `true` turns the field into a multi-select (Figma \"Type=Checkbox\"): checkboxes in the list, removable chips in the field. */\n multiple?: false;\n /** Selected option value (controlled); `null` or `''` for none. */\n value?: string | null;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Called with the chosen option's value. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface SelectMultipleProps extends SelectBaseProps {\n multiple: true;\n /** Selected option values (controlled). */\n value?: string[];\n /** Initially selected values (uncontrolled). */\n defaultValue?: string[];\n /** Called with all selected values after one is added or removed. */\n onValueChange?: (value: string[]) => void;\n}\n\nexport type SelectProps = SelectSingleProps | SelectMultipleProps;\n\nconst toArray = (value: string | string[] | null | undefined): string[] => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);\nconst asText = (node: ReactNode): string => (typeof node === 'string' || typeof node === 'number' ? String(node) : '');\nconst optionText = (option: SelectOption): string => option.textValue ?? (asText(option.label) || option.value);\nconst matches = (option: SelectOption, query: string): boolean =>\n [optionText(option), asText(option.detail), asText(option.description)].some((text) => text.toLowerCase().includes(query));\nconst isPrintable = (event: KeyboardEvent): boolean => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\nconst defaultRemoveLabel = (optionText: string) => `Remove ${optionText}`;\n\ntype InitialFocus = 'selected' | 'first' | 'last' | 'none';\n\n/**\n * Figma component set \"Drop down inputs\" (Type=Select · Checkbox, and the base of Language · Phone · Currency):\n * a field that opens a list of options. Keyboard support follows the WAI-ARIA select-only combobox pattern.\n * The ref and any extra props go to the trigger `<button role=\"combobox\">`; `className` goes to the root.\n */\nexport const Select = /* @__PURE__ */ forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n label,\n helperText,\n error,\n required,\n optional,\n size = 'md',\n options,\n placeholder = 'Select option',\n name,\n invalid: invalidProp,\n searchable = false,\n searchPlaceholder = 'Search',\n emptyText = 'No results',\n startIcon,\n renderValue,\n checkmark = true,\n fullWidth = true,\n align = 'start',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n portalContainer,\n panelAnchor,\n panelClassName,\n removeLabel = defaultRemoveLabel,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n id,\n className,\n style,\n onKeyDown,\n onKeyUp,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n) {\n const ids = useFieldIds(id, Boolean(error || helperText));\n const listId = `${ids.controlId}-list`;\n const optionId = (index: number) => `${ids.controlId}-option-${index}`;\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalValue, setInternalValue] = useState<string[]>(() => toArray(defaultValue));\n const [query, setQuery] = useState('');\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const keepFocusOnClose = useRef(false);\n const typed = useRef({ text: '', timer: 0 });\n\n const isOpen = (openProp ?? internalOpen) && !disabled;\n\n // `panelAnchor`: the list is positioned against a \"virtual\" element that measures the anchor each time it is asked.\n // Radix registers a virtual anchor only when its object changes, and it can end up holding the trigger instead:\n // on mount the trigger briefly registers itself as the anchor and is then replaced by a new button, which leaves\n // a removed element (measured as 0 × 0 at the top left of the page, so the list opened there; seen with React\n // Strict Mode and server rendering). A fresh object after mount and whenever the list opens or closes makes Radix\n // take the right anchor again.\n const [anchorVersion, setAnchorVersion] = useState(0);\n useEffect(() => {\n if (panelAnchor) setAnchorVersion((version) => version + 1);\n }, [panelAnchor, isOpen]);\n const virtualAnchor = useMemo(\n () => ({\n current: {\n getBoundingClientRect: () => panelAnchor?.current?.getBoundingClientRect() ?? new DOMRect(),\n // lets the positioning follow the anchor's scrolling ancestors\n contextElement: panelAnchor?.current ?? undefined,\n },\n }),\n // anchorVersion is listed on purpose: a new object per version\n [panelAnchor, anchorVersion],\n );\n const selectedValues = value !== undefined ? toArray(value) : internalValue;\n const selectedOptions = selectedValues.map((selected) => options.find((option) => option.value === selected)).filter((option) => option !== undefined);\n const invalid = Boolean(error) || Boolean(invalidProp);\n\n const needle = searchable ? query.trim().toLowerCase() : '';\n const visible = needle ? options.filter((option) => matches(option, needle)) : options;\n const enabled = visible.filter((option) => !option.disabled);\n const activeOption = enabled.find((option) => option.value === activeValue);\n const activeId = activeOption ? optionId(options.indexOf(activeOption)) : undefined;\n\n useEffect(() => {\n if (isOpen && activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: 'nearest' });\n }, [isOpen, activeId]);\n\n useEffect(() => () => window.clearTimeout(typed.current.timer), []);\n\n const setOpen = (next: boolean, focus: InitialFocus = 'none') => {\n if (next) {\n const candidates = options.filter((option) => !option.disabled);\n const selected = candidates.find((option) => selectedValues.includes(option.value));\n const initial = focus === 'none' ? undefined : focus === 'last' ? candidates[candidates.length - 1] : focus === 'first' ? candidates[0] : (selected ?? candidates[0]);\n setQuery('');\n setActiveValue(initial?.value ?? null);\n }\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const emit = (next: string[]) => {\n if (value === undefined) setInternalValue(next);\n const notify = onValueChange as ((next: string | string[]) => void) | undefined;\n if (multiple) notify?.(next);\n else if (next[0] !== undefined) notify?.(next[0]);\n };\n\n const toggle = (optionValue: string) =>\n emit(selectedValues.includes(optionValue) ? selectedValues.filter((selected) => selected !== optionValue) : [...selectedValues, optionValue]);\n\n const commit = (option: SelectOption) => {\n if (option.disabled) return;\n if (multiple) {\n toggle(option.value);\n setActiveValue(option.value);\n return;\n }\n if (selectedValues[0] !== option.value) emit([option.value]);\n setOpen(false);\n };\n\n const move = (to: 1 | -1 | 'first' | 'last') => {\n if (enabled.length === 0) return;\n const current = activeOption ? enabled.indexOf(activeOption) : -1;\n let next: number;\n if (to === 'first') next = 0;\n else if (to === 'last') next = enabled.length - 1;\n else if (current === -1) {\n // Opened with the pointer: start from the selected option, like a native select.\n const selected = enabled.findIndex((option) => selectedValues.includes(option.value));\n next = selected !== -1 ? selected : to === 1 ? 0 : enabled.length - 1;\n } else next = Math.min(enabled.length - 1, Math.max(0, current + to));\n setActiveValue(enabled[next].value);\n };\n\n /** Type-ahead: the typed characters jump to the next option starting with them; repeating one letter cycles. */\n const typeAhead = (char: string) => {\n const state = typed.current;\n window.clearTimeout(state.timer);\n state.text += char.toLowerCase();\n state.timer = window.setTimeout(() => (state.text = ''), 500);\n const candidates = options.filter((option) => !option.disabled);\n const current = candidates.findIndex((option) => option.value === activeValue);\n const repeated = state.text.split('').every((letter) => letter === state.text[0]);\n const term = repeated ? state.text[0] : state.text;\n const from = repeated || state.text.length === 1 ? current + 1 : Math.max(current, 0);\n const ordered = [...candidates.slice(from), ...candidates.slice(0, from)];\n const match = ordered.find((option) => optionText(option).toLowerCase().startsWith(term));\n if (match) setActiveValue(match.value);\n };\n\n const handleListKeys = (event: KeyboardEvent<HTMLElement>, source: 'trigger' | 'search') => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) setOpen(false);\n else move(-1);\n break;\n case 'Home':\n case 'End':\n // In the search box these keys move the caret.\n if (source === 'trigger') {\n event.preventDefault();\n move(event.key === 'Home' ? 'first' : 'last');\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (activeOption) commit(activeOption);\n break;\n case 'Tab':\n if (source === 'search') {\n // The panel lives in a portal at the end of the document: go back to the field instead of tabbing out of the page.\n event.preventDefault();\n } else keepFocusOnClose.current = true;\n setOpen(false);\n break;\n default:\n }\n };\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' ', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n setOpen(true, event.key === 'Home' ? 'first' : event.key === 'End' ? 'last' : 'selected');\n } else if (isPrintable(event)) {\n event.preventDefault();\n setOpen(true);\n if (searchable) search(event.key);\n else typeAhead(event.key);\n }\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n // A space while typing ahead belongs to the search text (\"New York\").\n if (typed.current.text) typeAhead(' ');\n else if (activeOption) commit(activeOption);\n } else if (isPrintable(event) && !searchable) {\n event.preventDefault();\n typeAhead(event.key);\n } else handleListKeys(event, 'trigger');\n };\n\n /** Filters the list and puts the keyboard on the first match. */\n const search = (next: string) => {\n const term = next.trim().toLowerCase();\n setQuery(next);\n setActiveValue(options.find((option) => !option.disabled && (!term || matches(option, term)))?.value ?? null);\n };\n\n const single = !multiple ? selectedOptions[0] : undefined;\n const hasChips = multiple && selectedOptions.length > 0;\n const Chevron = isOpen ? UpArrowIcon : DownArrowIcon;\n\n const control = (\n <div\n className=\"tm-field tm-select__control\"\n data-size={size}\n data-tm-icon-size={size}\n data-invalid={invalid ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n data-focus={isOpen ? '' : undefined}\n data-has-chips={hasChips ? '' : undefined}\n >\n {hasChips ? (\n <span className=\"tm-select__chips\">\n {selectedOptions.map((option) => (\n <SelectedItem\n key={option.value}\n size={size}\n disabled={disabled}\n removeLabel={removeLabel(optionText(option))}\n onRemove={() => toggle(option.value)}\n >\n {option.label}\n </SelectedItem>\n ))}\n </span>\n ) : null}\n <Popover.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n id={ids.controlId}\n className=\"tm-select__trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && !searchable ? activeId : undefined}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-describedby={cn(ariaDescribedBy, ids.messageId) || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n disabled={disabled}\n onKeyDown={handleTriggerKeyDown}\n onKeyUp={(event) => {\n onKeyUp?.(event);\n // Firefox clicks a button on Space keyup; the keydown handler has already acted on it.\n if (event.key === ' ') event.preventDefault();\n }}\n {...props}\n >\n {startIcon}\n {single ? (\n <span className=\"tm-select__value\">{renderValue ? renderValue(single) : single.label}</span>\n ) : hasChips ? (\n // The chips sit outside the button; this keeps the selection in the combobox's own text for assistive technology.\n <span className=\"tm-select__value tm-select__value--hidden\">{selectedOptions.map(optionText).join(', ')}</span>\n ) : (\n <span className=\"tm-select__value\" data-placeholder=\"\">\n {placeholder}\n </span>\n )}\n <Chevron className=\"tm-select__chevron\" />\n </button>\n </Popover.Trigger>\n </div>\n );\n\n return (\n <Popover.Root open={isOpen} onOpenChange={(next) => setOpen(next)}>\n <FormField\n ids={ids}\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n optional={optional}\n size={size}\n className={cn('tm-select', className)}\n style={style}\n data-full-width={fullWidth ? '' : undefined}\n >\n {panelAnchor ? (\n <>\n <Popover.Anchor virtualRef={virtualAnchor} />\n {control}\n </>\n ) : (\n <Popover.Anchor asChild>{control}</Popover.Anchor>\n )}\n {name\n ? (multiple ? selectedValues : [selectedValues[0] ?? '']).map((selected) => (\n <input key={selected} type=\"hidden\" name={name} value={selected} disabled={disabled} />\n ))\n : null}\n </FormField>\n <Popover.Portal container={portalContainer}>\n <Popover.Content\n // The combobox owns the listbox directly; the popover wrapper is only a surface.\n role=\"presentation\"\n className={cn('tm-option-panel tm-select__panel', panelClassName)}\n data-size={size}\n data-fit={fullWidth ? 'field' : 'content'}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n onOpenAutoFocus={(event) => {\n // Select-only combobox: focus stays on the field (or moves to the search box) and the active option is announced through aria-activedescendant.\n event.preventDefault();\n searchRef.current?.focus();\n }}\n onCloseAutoFocus={(event) => {\n if (keepFocusOnClose.current) event.preventDefault();\n keepFocusOnClose.current = false;\n }}\n >\n {searchable ? (\n <div className=\"tm-select__search\">\n <SearchIcon size=\"sm\" />\n <input\n ref={searchRef}\n className=\"tm-select__search-input\"\n type=\"text\"\n role=\"combobox\"\n aria-label={searchPlaceholder}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeId}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(event) => search(event.target.value)}\n onKeyDown={(event) => handleListKeys(event, 'search')}\n />\n </div>\n ) : null}\n <OptionList\n id={listId}\n size={size}\n multiple={multiple}\n surface={false}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : props['aria-label']}\n // Keeps focus on the field (or the search box) while the pointer picks an option.\n onMouseDown={(event) => event.preventDefault()}\n >\n {visible.map((option) => (\n <Option\n key={option.value}\n id={optionId(options.indexOf(option))}\n selected={selectedValues.includes(option.value)}\n active={option === activeOption}\n disabled={option.disabled}\n icon={option.icon}\n detail={option.detail}\n description={option.description}\n indicator={multiple ? 'checkbox' : checkmark ? 'check' : 'none'}\n onClick={() => commit(option)}\n >\n {option.label}\n </Option>\n ))}\n </OptionList>\n {visible.length === 0 ? (\n <p className=\"tm-select__empty\" role=\"status\">\n {emptyText}\n </p>\n ) : null}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":";;;;;;;;;;;;;AAwGA,IAAMG,KAAW,MAA2D,MAAM,QAAQC,CAAK,IAAIA,IAAQA,KAAS,QAAQA,MAAU,KAAK,CAAC,IAAI,CAACA,CAAK,GAChJC,KAAU,MAA6B,OAAOC,KAAS,YAAY,OAAOA,KAAS,WAAW,OAAOA,CAAI,IAAI,IAC7GC,KAAc,MAAiCC,EAAO,cAAcH,EAAOG,EAAO,KAAK,KAAKA,EAAO,QACnGC,KAAW,GAAsB,MACrC;CAACF,EAAWC,CAAM;CAAGH,EAAOG,EAAO,MAAM;CAAGH,EAAOG,EAAO,WAAW;AAAC,CAAC,CAAC,MAAM,MAASE,EAAK,YAAY,CAAC,CAAC,SAASC,CAAK,CAAC,GACrHC,KAAe,MAAkCC,EAAM,IAAI,WAAW,KAAK,CAACA,EAAM,WAAW,CAACA,EAAM,WAAW,CAACA,EAAM,QACtHC,MAAsB,MAAuB,UAAUP,KAShDQ,IAAyB,kBAA2C,SAC/E,EACE,UACA,eACA,UACA,cACA,cACA,UAAO,MACP,YACA,kBAAc,iBACd,SACA,SAASC,IACT,gBAAa,IACb,uBAAoB,UACpB,gBAAY,cACZ,eACA,iBACA,gBAAY,IACZ,gBAAY,IACZ,YAAQ,SACR,MAAMC,IACN,kBAAc,IACd,kBACA,qBACA,gBACA,oBACA,kBAAcH,IACd,cAAW,IACX,UACA,kBACA,mBACA,cAAW,IACX,QACA,eACA,WACA,eACA,aACA,oBAAoBI,IACpB,mBAAmBC,GACnB,GAAGC,MAEL,IACA;CACA,IAAMC,IAAMC,EAAYC,IAAI,GAAQC,KAASC,EAAW,GAClDC,IAAS,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Select.js","names":["_Fragment","Fragment$1","Popover","toArray","value","asText","node","optionText","option","matches","text","query","isPrintable","event","defaultRemoveLabel","Select","invalidProp","openProp","ariaDescribedBy","ariaLabelledBy","props","ids","useFieldIds","id","error","helperText","listId","optionId","index","internalOpen","setInternalOpen","useState","defaultOpen","internalValue","setInternalValue","defaultValue","setQuery","activeValue","setActiveValue","searchRef","useRef","keepFocusOnClose","typed","isOpen","disabled","readOnly","anchorVersion","setAnchorVersion","panelAnchor","version","virtualAnchor","useMemo","selectedValues","selectedOptions","options","selected","invalid","needle","searchable","visible","enabled","activeOption","activeId","useEffect","setOpen","next","candidates","initial","focus","onOpenChange","emit","notify","onValueChange","multiple","toggle","optionValue","commit","move","current","to","typeAhead","state","char","repeated","letter","term","from","match","handleListKeys","source","handleTriggerKeyDown","onKeyDown","search","single","hasChips","Chevron","UpArrowIcon","DownArrowIcon","control","size","SelectedItem","removeLabel","label","cn","required","onKeyUp","startIcon","renderValue","placeholder","FormField","className","fullWidth","name","portalContainer","panelClassName","SearchIcon","searchPlaceholder","OptionList","listSize","Option","checkmark","emptyText"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { DownArrowIcon, SearchIcon, UpArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { FormField, useFieldIds, type FieldErrorAppearanceProps, type FieldSize, type FormFieldProps } from '../Field';\nimport { Option, OptionList } from '../OptionList';\nimport { SelectedItem } from './SelectedItem';\nimport './Select.css';\n\nexport interface SelectOption {\n /** What `value` / `onValueChange` carry and what a form submits. */\n value: string;\n /** Text in the list and in the field, e.g. \"Armenia\", \"EN\", \"AMD\". */\n label: ReactNode;\n /** Regular-weight text after the label in the list only, e.g. \"English\" after \"EN\". */\n detail?: ReactNode;\n /** Small second line in the list (Figma \"Caption\"). */\n description?: ReactNode;\n /** Icon or flag before the label in the list (Figma \"Icon\"). */\n icon?: ReactNode;\n /** The option is shown but cannot be chosen. */\n disabled?: boolean;\n /** Plain text for type-ahead, search and the remove button when `label` is not a string. */\n textValue?: string;\n}\n\ntype TriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children' | 'type' | 'name' | 'role'>;\n\ninterface SelectBaseProps extends FormFieldProps, FieldErrorAppearanceProps, TriggerProps {\n /** The options, in display order. */\n options: SelectOption[];\n /** Shown in the field while nothing is selected. */\n placeholder?: ReactNode;\n /** Figma \"Size\": `lg` 52px · `md` 46px (default) · `sm` 42px. */\n size?: FieldSize;\n /** Adds hidden inputs so the value is submitted with a native form (one per value when `multiple`). */\n name?: string;\n /** Invalid look without a message of its own — for composite fields that show one message for several controls. */\n invalid?: boolean;\n /** Adds a search box above the list (Figma \"Type=Currency, State=Open\"); typing filters by label, detail and description. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown instead of the list when the search matches nothing. */\n emptyText?: ReactNode;\n /** Icon in front of the value, e.g. `<LanguageIcon />`. */\n startIcon?: ReactNode;\n /** Custom content for the selected option in the field (single select), e.g. flag + dial code. Defaults to its `label`. */\n renderValue?: (option: SelectOption) => ReactNode;\n /** Shows the check mark on the selected option (Figma \"Done\"). Ignored when `multiple`, which uses checkboxes. */\n checkmark?: boolean;\n /** `false` makes the field hug its content (Figma \"Both-icon-drop-down\", \"Language\", \"Type=Currency\"); the list is then as wide as its options. */\n fullWidth?: boolean;\n /** How the list lines up with the field. */\n align?: 'start' | 'center' | 'end';\n /** Whether the list is open (controlled; Figma \"State=Clicked\" / \"Open\"). */\n open?: boolean;\n /** Opens the list initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Element the list is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Element the list aligns to and takes its width from, when that is not the field itself (e.g. a whole phone-number row). */\n panelAnchor?: RefObject<HTMLElement | null>;\n /** Class for the list panel, which is rendered in a portal outside the root. */\n panelClassName?: string;\n /** Size of the rows in the list when it differs from the field's `size` (e.g. Figma \"Type=Phone, State=Open\" keeps M rows at every size). Defaults to `size`. */\n listSize?: FieldSize;\n /** Accessible name of a chip's × button (`multiple`), given the option's text. */\n removeLabel?: (optionText: string) => string;\n /**\n * Figma \"Read-only\" (the last State column of \"Drop down inputs\"): the value is shown but cannot be changed —\n * the field stays focusable and is announced as read-only, the list does not open and chips have no × button.\n * Unlike `disabled`, the value is still submitted with a form.\n */\n readOnly?: boolean;\n}\n\nexport interface SelectSingleProps extends SelectBaseProps {\n /** `true` turns the field into a multi-select (Figma \"Type=Checkbox\"): checkboxes in the list, removable chips in the field. */\n multiple?: false;\n /** Selected option value (controlled); `null` or `''` for none. */\n value?: string | null;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Called with the chosen option's value. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface SelectMultipleProps extends SelectBaseProps {\n multiple: true;\n /** Selected option values (controlled). */\n value?: string[];\n /** Initially selected values (uncontrolled). */\n defaultValue?: string[];\n /** Called with all selected values after one is added or removed. */\n onValueChange?: (value: string[]) => void;\n}\n\nexport type SelectProps = SelectSingleProps | SelectMultipleProps;\n\nconst toArray = (value: string | string[] | null | undefined): string[] => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);\nconst asText = (node: ReactNode): string => (typeof node === 'string' || typeof node === 'number' ? String(node) : '');\nconst optionText = (option: SelectOption): string => option.textValue ?? (asText(option.label) || option.value);\nconst matches = (option: SelectOption, query: string): boolean =>\n [optionText(option), asText(option.detail), asText(option.description)].some((text) => text.toLowerCase().includes(query));\nconst isPrintable = (event: KeyboardEvent): boolean => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\nconst defaultRemoveLabel = (optionText: string) => `Remove ${optionText}`;\n\ntype InitialFocus = 'selected' | 'first' | 'last' | 'none';\n\n/**\n * Figma component set \"Drop down inputs\" (Type=Select · Checkbox, and the base of Language · Phone · Currency):\n * a field that opens a list of options. Keyboard support follows the WAI-ARIA select-only combobox pattern.\n * The ref and any extra props go to the trigger `<button role=\"combobox\">`; `className` goes to the root.\n */\nexport const Select = /* @__PURE__ */ forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n label,\n helperText,\n error,\n required,\n optional,\n errorColor,\n errorBox,\n size = 'md',\n options,\n placeholder = 'Select option',\n name,\n invalid: invalidProp,\n searchable = false,\n searchPlaceholder = 'Search',\n emptyText = 'No results',\n startIcon,\n renderValue,\n checkmark = true,\n fullWidth = true,\n align = 'start',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n portalContainer,\n panelAnchor,\n panelClassName,\n listSize,\n removeLabel = defaultRemoveLabel,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n readOnly = false,\n id,\n className,\n style,\n onKeyDown,\n onKeyUp,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n) {\n const ids = useFieldIds(id, Boolean(error || helperText));\n const listId = `${ids.controlId}-list`;\n const optionId = (index: number) => `${ids.controlId}-option-${index}`;\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalValue, setInternalValue] = useState<string[]>(() => toArray(defaultValue));\n const [query, setQuery] = useState('');\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const keepFocusOnClose = useRef(false);\n const typed = useRef({ text: '', timer: 0 });\n\n const isOpen = (openProp ?? internalOpen) && !disabled && !readOnly;\n\n // `panelAnchor`: the list is positioned against a \"virtual\" element that measures the anchor each time it is asked.\n // Radix registers a virtual anchor only when its object changes, and it can end up holding the trigger instead:\n // on mount the trigger briefly registers itself as the anchor and is then replaced by a new button, which leaves\n // a removed element (measured as 0 × 0 at the top left of the page, so the list opened there; seen with React\n // Strict Mode and server rendering). A fresh object after mount and whenever the list opens or closes makes Radix\n // take the right anchor again.\n const [anchorVersion, setAnchorVersion] = useState(0);\n useEffect(() => {\n if (panelAnchor) setAnchorVersion((version) => version + 1);\n }, [panelAnchor, isOpen]);\n const virtualAnchor = useMemo(\n () => ({\n current: {\n getBoundingClientRect: () => panelAnchor?.current?.getBoundingClientRect() ?? new DOMRect(),\n // lets the positioning follow the anchor's scrolling ancestors\n contextElement: panelAnchor?.current ?? undefined,\n },\n }),\n // anchorVersion is listed on purpose: a new object per version\n [panelAnchor, anchorVersion],\n );\n const selectedValues = value !== undefined ? toArray(value) : internalValue;\n const selectedOptions = selectedValues.map((selected) => options.find((option) => option.value === selected)).filter((option) => option !== undefined);\n const invalid = Boolean(error) || Boolean(invalidProp);\n\n const needle = searchable ? query.trim().toLowerCase() : '';\n const visible = needle ? options.filter((option) => matches(option, needle)) : options;\n const enabled = visible.filter((option) => !option.disabled);\n const activeOption = enabled.find((option) => option.value === activeValue);\n const activeId = activeOption ? optionId(options.indexOf(activeOption)) : undefined;\n\n useEffect(() => {\n if (isOpen && activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: 'nearest' });\n }, [isOpen, activeId]);\n\n useEffect(() => () => window.clearTimeout(typed.current.timer), []);\n\n const setOpen = (next: boolean, focus: InitialFocus = 'none') => {\n if (next && readOnly) return;\n if (next) {\n const candidates = options.filter((option) => !option.disabled);\n const selected = candidates.find((option) => selectedValues.includes(option.value));\n const initial = focus === 'none' ? undefined : focus === 'last' ? candidates[candidates.length - 1] : focus === 'first' ? candidates[0] : (selected ?? candidates[0]);\n setQuery('');\n setActiveValue(initial?.value ?? null);\n }\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const emit = (next: string[]) => {\n if (value === undefined) setInternalValue(next);\n const notify = onValueChange as ((next: string | string[]) => void) | undefined;\n if (multiple) notify?.(next);\n else if (next[0] !== undefined) notify?.(next[0]);\n };\n\n const toggle = (optionValue: string) =>\n emit(selectedValues.includes(optionValue) ? selectedValues.filter((selected) => selected !== optionValue) : [...selectedValues, optionValue]);\n\n const commit = (option: SelectOption) => {\n if (option.disabled) return;\n if (multiple) {\n toggle(option.value);\n setActiveValue(option.value);\n return;\n }\n if (selectedValues[0] !== option.value) emit([option.value]);\n setOpen(false);\n };\n\n const move = (to: 1 | -1 | 'first' | 'last') => {\n if (enabled.length === 0) return;\n const current = activeOption ? enabled.indexOf(activeOption) : -1;\n let next: number;\n if (to === 'first') next = 0;\n else if (to === 'last') next = enabled.length - 1;\n else if (current === -1) {\n // Opened with the pointer: start from the selected option, like a native select.\n const selected = enabled.findIndex((option) => selectedValues.includes(option.value));\n next = selected !== -1 ? selected : to === 1 ? 0 : enabled.length - 1;\n } else next = Math.min(enabled.length - 1, Math.max(0, current + to));\n setActiveValue(enabled[next].value);\n };\n\n /** Type-ahead: the typed characters jump to the next option starting with them; repeating one letter cycles. */\n const typeAhead = (char: string) => {\n const state = typed.current;\n window.clearTimeout(state.timer);\n state.text += char.toLowerCase();\n state.timer = window.setTimeout(() => (state.text = ''), 500);\n const candidates = options.filter((option) => !option.disabled);\n const current = candidates.findIndex((option) => option.value === activeValue);\n const repeated = state.text.split('').every((letter) => letter === state.text[0]);\n const term = repeated ? state.text[0] : state.text;\n const from = repeated || state.text.length === 1 ? current + 1 : Math.max(current, 0);\n const ordered = [...candidates.slice(from), ...candidates.slice(0, from)];\n const match = ordered.find((option) => optionText(option).toLowerCase().startsWith(term));\n if (match) setActiveValue(match.value);\n };\n\n const handleListKeys = (event: KeyboardEvent<HTMLElement>, source: 'trigger' | 'search') => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) setOpen(false);\n else move(-1);\n break;\n case 'Home':\n case 'End':\n // In the search box these keys move the caret.\n if (source === 'trigger') {\n event.preventDefault();\n move(event.key === 'Home' ? 'first' : 'last');\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (activeOption) commit(activeOption);\n break;\n case 'Tab':\n if (source === 'search') {\n // The panel lives in a portal at the end of the document: go back to the field instead of tabbing out of the page.\n event.preventDefault();\n } else keepFocusOnClose.current = true;\n setOpen(false);\n break;\n default:\n }\n };\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || readOnly) return;\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' ', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n setOpen(true, event.key === 'Home' ? 'first' : event.key === 'End' ? 'last' : 'selected');\n } else if (isPrintable(event)) {\n event.preventDefault();\n setOpen(true);\n if (searchable) search(event.key);\n else typeAhead(event.key);\n }\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n // A space while typing ahead belongs to the search text (\"New York\").\n if (typed.current.text) typeAhead(' ');\n else if (activeOption) commit(activeOption);\n } else if (isPrintable(event) && !searchable) {\n event.preventDefault();\n typeAhead(event.key);\n } else handleListKeys(event, 'trigger');\n };\n\n /** Filters the list and puts the keyboard on the first match. */\n const search = (next: string) => {\n const term = next.trim().toLowerCase();\n setQuery(next);\n setActiveValue(options.find((option) => !option.disabled && (!term || matches(option, term)))?.value ?? null);\n };\n\n const single = !multiple ? selectedOptions[0] : undefined;\n const hasChips = multiple && selectedOptions.length > 0;\n const Chevron = isOpen ? UpArrowIcon : DownArrowIcon;\n\n const control = (\n <div\n className=\"tm-field tm-select__control\"\n data-size={size}\n data-tm-icon-size={size}\n data-invalid={invalid ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n data-readonly={readOnly && !disabled ? '' : undefined}\n data-focus={isOpen ? '' : undefined}\n data-has-chips={hasChips ? '' : undefined}\n >\n {hasChips ? (\n <span className=\"tm-select__chips\">\n {selectedOptions.map((option) => (\n <SelectedItem\n key={option.value}\n size={size}\n disabled={disabled}\n removeLabel={removeLabel(optionText(option))}\n // Read-only chips cannot be removed, so they get no × button.\n onRemove={readOnly ? undefined : () => toggle(option.value)}\n >\n {option.label}\n </SelectedItem>\n ))}\n </span>\n ) : null}\n <Popover.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n id={ids.controlId}\n className=\"tm-select__trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && !searchable ? activeId : undefined}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-describedby={cn(ariaDescribedBy, ids.messageId) || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n aria-readonly={readOnly || undefined}\n disabled={disabled}\n onKeyDown={handleTriggerKeyDown}\n onKeyUp={(event) => {\n onKeyUp?.(event);\n // Firefox clicks a button on Space keyup; the keydown handler has already acted on it.\n if (event.key === ' ') event.preventDefault();\n }}\n {...props}\n >\n {startIcon}\n {single ? (\n <span className=\"tm-select__value\">{renderValue ? renderValue(single) : single.label}</span>\n ) : hasChips ? (\n // The chips sit outside the button; this keeps the selection in the combobox's own text for assistive technology.\n <span className=\"tm-select__value tm-select__value--hidden\">{selectedOptions.map(optionText).join(', ')}</span>\n ) : (\n <span className=\"tm-select__value\" data-placeholder=\"\">\n {placeholder}\n </span>\n )}\n <Chevron className=\"tm-select__chevron\" />\n </button>\n </Popover.Trigger>\n </div>\n );\n\n return (\n <Popover.Root open={isOpen} onOpenChange={(next) => setOpen(next)}>\n <FormField\n ids={ids}\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n optional={optional}\n size={size}\n errorColor={errorColor}\n errorBox={errorBox}\n className={cn('tm-select', className)}\n style={style}\n data-full-width={fullWidth ? '' : undefined}\n >\n {panelAnchor ? (\n <>\n <Popover.Anchor virtualRef={virtualAnchor} />\n {control}\n </>\n ) : (\n <Popover.Anchor asChild>{control}</Popover.Anchor>\n )}\n {name\n ? (multiple ? selectedValues : [selectedValues[0] ?? '']).map((selected) => (\n <input key={selected} type=\"hidden\" name={name} value={selected} disabled={disabled} />\n ))\n : null}\n </FormField>\n <Popover.Portal container={portalContainer}>\n <Popover.Content\n // The combobox owns the listbox directly; the popover wrapper is only a surface.\n role=\"presentation\"\n className={cn('tm-option-panel tm-select__panel', panelClassName)}\n data-size={size}\n data-fit={fullWidth ? 'field' : 'content'}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n onOpenAutoFocus={(event) => {\n // Select-only combobox: focus stays on the field (or moves to the search box) and the active option is announced through aria-activedescendant.\n event.preventDefault();\n searchRef.current?.focus();\n }}\n onCloseAutoFocus={(event) => {\n if (keepFocusOnClose.current) event.preventDefault();\n keepFocusOnClose.current = false;\n }}\n >\n {searchable ? (\n <div className=\"tm-select__search\">\n <SearchIcon size=\"sm\" />\n <input\n ref={searchRef}\n className=\"tm-select__search-input\"\n type=\"text\"\n role=\"combobox\"\n aria-label={searchPlaceholder}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeId}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(event) => search(event.target.value)}\n onKeyDown={(event) => handleListKeys(event, 'search')}\n />\n </div>\n ) : null}\n <OptionList\n id={listId}\n size={listSize ?? size}\n multiple={multiple}\n surface={false}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : props['aria-label']}\n // Keeps focus on the field (or the search box) while the pointer picks an option.\n onMouseDown={(event) => event.preventDefault()}\n >\n {visible.map((option) => (\n <Option\n key={option.value}\n id={optionId(options.indexOf(option))}\n selected={selectedValues.includes(option.value)}\n active={option === activeOption}\n disabled={option.disabled}\n icon={option.icon}\n detail={option.detail}\n description={option.description}\n indicator={multiple ? 'checkbox' : checkmark ? 'check' : 'none'}\n onClick={() => commit(option)}\n >\n {option.label}\n </Option>\n ))}\n </OptionList>\n {visible.length === 0 ? (\n <p className=\"tm-select__empty\" role=\"status\">\n {emptyText}\n </p>\n ) : null}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":";;;;;;;;;;;;;AAgHA,IAAMG,KAAW,MAA2D,MAAM,QAAQC,CAAK,IAAIA,IAAQA,KAAS,QAAQA,MAAU,KAAK,CAAC,IAAI,CAACA,CAAK,GAChJC,KAAU,MAA6B,OAAOC,KAAS,YAAY,OAAOA,KAAS,WAAW,OAAOA,CAAI,IAAI,IAC7GC,KAAc,MAAiCC,EAAO,cAAcH,EAAOG,EAAO,KAAK,KAAKA,EAAO,QACnGC,KAAW,GAAsB,MACrC;CAACF,EAAWC,CAAM;CAAGH,EAAOG,EAAO,MAAM;CAAGH,EAAOG,EAAO,WAAW;AAAC,CAAC,CAAC,MAAM,MAASE,EAAK,YAAY,CAAC,CAAC,SAASC,CAAK,CAAC,GACrHC,KAAe,MAAkCC,EAAM,IAAI,WAAW,KAAK,CAACA,EAAM,WAAW,CAACA,EAAM,WAAW,CAACA,EAAM,QACtHC,MAAsB,MAAuB,UAAUP,KAShDQ,IAAyB,kBAA2C,SAC/E,EACE,UACA,eACA,UACA,cACA,cACA,gBACA,cACA,UAAO,MACP,YACA,kBAAc,iBACd,SACA,SAASC,IACT,gBAAa,IACb,uBAAoB,UACpB,gBAAY,cACZ,eACA,gBACA,gBAAY,IACZ,gBAAY,IACZ,YAAQ,SACR,MAAMC,IACN,kBAAc,IACd,kBACA,qBACA,gBACA,oBACA,cACA,kBAAcH,IACd,cAAW,IACX,UACA,kBACA,mBACA,cAAW,IACX,cAAW,IACX,QACA,eACA,WACA,eACA,aACA,oBAAoBI,IACpB,mBAAmBC,GACnB,GAAGC,MAEL,IACA;CACA,IAAMC,IAAMC,GAAYC,IAAI,GAAQC,KAASC,EAAW,GAClDC,IAAS,GAAGL,EAAI,UAAU,QAC1BM,MAAY,MAAkB,GAAGN,EAAI,UAAU,UAAUO,KAEzD,CAACC,IAAcC,MAAmBC,EAASC,EAAW,GACtD,CAACC,IAAeC,MAAo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;EACH,CAAA,CACJ;;AAElB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../utils/cn.cjs"),t=require("../Button/Button.cjs");;/* empty css */let n=require("react"),r=require("react/jsx-runtime");var i=(0,n.forwardRef)(function({summary:n,children:i,loading:a=!1,loadingLabel:o=`Loading…`,onShowMore:s,disabled:c,className:l,...u},d){return(0,r.jsxs)(`div`,{ref:d,className:e.cn(`tm-show-more`,l),"data-state":a?`loading`:`default`,...u,children:[n!=null&&n!==!1?(0,r.jsx)(`p`,{className:`tm-show-more__summary`,"aria-live":`polite`,children:n}):null,(0,r.jsx)(t.Button,{className:`tm-show-more__button`,variant:`outline`,size:`md`,disabled:c,"aria-disabled":a||void 0,"aria-busy":a||void 0,onClick:e=>{a||s?.(e)},children:a?o:i})]})});exports.ShowMore=i;
2
+ //# sourceMappingURL=ShowMore.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShowMore.cjs","names":["cn","Button","require_cn","require_Button","react","react_jsx_runtime","ShowMore","props","className","loading","summary","onShowMore","event","loadingLabel","children"],"sources":["../../../src/components/ShowMore/ShowMore.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type MouseEvent, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\nimport './ShowMore.css';\n\nexport interface ShowMoreProps extends HTMLAttributes<HTMLDivElement> {\n /** How much is showing, e.g. \"Showing 5 of 24 requests\" (Figma layer \"Count\"). Announced politely when it changes. */\n summary?: ReactNode;\n /** Text of the button, e.g. \"Show more requests\". */\n children: ReactNode;\n /** Figma \"State=Loading\": the button turns inactive and reads `loadingLabel`; it keeps focus but ignores clicks. */\n loading?: boolean;\n /** Button text while loading — translate it. */\n loadingLabel?: ReactNode;\n /** Called by the button (not while loading or disabled). */\n onShowMore?: (event: MouseEvent<HTMLButtonElement>) => void;\n /** Disables the button, e.g. when everything is already showing. */\n disabled?: boolean;\n}\n\n/**\n * Figma component set \"Show more\" (2724:37170): the \"Showing 5 of 24 requests\" line and the Outline M button that\n * loads the next batch under a list (My Requests). The app does the loading and passes `loading` meanwhile.\n */\nexport const ShowMore = /* @__PURE__ */ forwardRef<HTMLDivElement, ShowMoreProps>(function ShowMore(\n { summary, children, loading = false, loadingLabel = 'Loading…', onShowMore, disabled, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cn('tm-show-more', className)} data-state={loading ? 'loading' : 'default'} {...props}>\n {summary != null && summary !== false ? (\n <p className=\"tm-show-more__summary\" aria-live=\"polite\">\n {summary}\n </p>\n ) : null}\n <Button\n className=\"tm-show-more__button\"\n variant=\"outline\"\n size=\"md\"\n disabled={disabled}\n // Figma draws Loading as the Inactive button with new text, not a spinner. aria-disabled (not `disabled`)\n // keeps keyboard focus on the button while the next batch loads.\n aria-disabled={loading || undefined}\n aria-busy={loading || undefined}\n onClick={(event) => {\n if (loading) return;\n onShowMore?.(event);\n }}\n >\n {loading ? loadingLabel : children}\n </Button>\n </div>\n );\n});\n"],"mappings":"A,yKAwBA,IAAaM,GAA2B,EAAAF,EAAA,WAAA,CAA0C,SAChF,CAAE,UAAS,WAAU,UAAU,GAAO,eAAe,WAAY,aAAY,WAAU,YAAW,GAAGG,GACrG,EACA,CACA,OACE,EAAAF,EAAA,KAAA,CAAC,MAAD,CAAU,MAAK,UAAWL,EAAAA,GAAG,eAAgBQ,CAAS,EAAG,aAAYC,EAAU,UAAY,UAAW,GAAIF,EAA1G,SAAA,CACGG,GAAW,MAAQA,IAAY,IAC9B,EAAAL,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,wBAAwB,YAAU,SAC5C,SAAAK,CACA,CAAA,EACD,MACJ,EAAAL,EAAA,IAAA,CAACJ,EAAAA,OAAD,CACE,UAAU,uBACV,QAAQ,UACR,KAAK,KACK,WAGV,gBAAeQ,GAAW,IAAA,GAC1B,YAAWA,GAAW,IAAA,GACtB,QAAU,GAAU,CACdA,GACJE,IAAaC,CAAK,CACpB,EAEC,SAAAH,EAAUI,EAAeC,CACpB,CAAA,CACL,C,EAET,CAAC,E"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { cn as e } from "../../utils/cn.js";
3
+ import { Button as t } from "../Button/Button.js";
4
+ /* empty css */
5
+ import { forwardRef as n } from "react";
6
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
7
+ // src/components/ShowMore/ShowMore.tsx
8
+ var a = /* @__PURE__ */ n(function({ summary: n, children: a, loading: o = !1, loadingLabel: s = "Loading…", onShowMore: c, disabled: l, className: u, ...d }, f) {
9
+ return /* @__PURE__ */ i("div", {
10
+ ref: f,
11
+ className: e("tm-show-more", u),
12
+ "data-state": o ? "loading" : "default",
13
+ ...d,
14
+ children: [n != null && n !== !1 ? /* @__PURE__ */ r("p", {
15
+ className: "tm-show-more__summary",
16
+ "aria-live": "polite",
17
+ children: n
18
+ }) : null, /* @__PURE__ */ r(t, {
19
+ className: "tm-show-more__button",
20
+ variant: "outline",
21
+ size: "md",
22
+ disabled: l,
23
+ "aria-disabled": o || void 0,
24
+ "aria-busy": o || void 0,
25
+ onClick: (e) => {
26
+ o || c?.(e);
27
+ },
28
+ children: o ? s : a
29
+ })]
30
+ });
31
+ });
32
+ export { a as ShowMore };
33
+
34
+ //# sourceMappingURL=ShowMore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShowMore.js","names":["ShowMore","props","cn","className","loading","summary","Button","onShowMore","event","loadingLabel","children"],"sources":["../../../src/components/ShowMore/ShowMore.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type MouseEvent, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Button } from '../Button';\nimport './ShowMore.css';\n\nexport interface ShowMoreProps extends HTMLAttributes<HTMLDivElement> {\n /** How much is showing, e.g. \"Showing 5 of 24 requests\" (Figma layer \"Count\"). Announced politely when it changes. */\n summary?: ReactNode;\n /** Text of the button, e.g. \"Show more requests\". */\n children: ReactNode;\n /** Figma \"State=Loading\": the button turns inactive and reads `loadingLabel`; it keeps focus but ignores clicks. */\n loading?: boolean;\n /** Button text while loading — translate it. */\n loadingLabel?: ReactNode;\n /** Called by the button (not while loading or disabled). */\n onShowMore?: (event: MouseEvent<HTMLButtonElement>) => void;\n /** Disables the button, e.g. when everything is already showing. */\n disabled?: boolean;\n}\n\n/**\n * Figma component set \"Show more\" (2724:37170): the \"Showing 5 of 24 requests\" line and the Outline M button that\n * loads the next batch under a list (My Requests). The app does the loading and passes `loading` meanwhile.\n */\nexport const ShowMore = /* @__PURE__ */ forwardRef<HTMLDivElement, ShowMoreProps>(function ShowMore(\n { summary, children, loading = false, loadingLabel = 'Loading…', onShowMore, disabled, className, ...props },\n ref,\n) {\n return (\n <div ref={ref} className={cn('tm-show-more', className)} data-state={loading ? 'loading' : 'default'} {...props}>\n {summary != null && summary !== false ? (\n <p className=\"tm-show-more__summary\" aria-live=\"polite\">\n {summary}\n </p>\n ) : null}\n <Button\n className=\"tm-show-more__button\"\n variant=\"outline\"\n size=\"md\"\n disabled={disabled}\n // Figma draws Loading as the Inactive button with new text, not a spinner. aria-disabled (not `disabled`)\n // keeps keyboard focus on the button while the next batch loads.\n aria-disabled={loading || undefined}\n aria-busy={loading || undefined}\n onClick={(event) => {\n if (loading) return;\n onShowMore?.(event);\n }}\n >\n {loading ? loadingLabel : children}\n </Button>\n </div>\n );\n});\n"],"mappings":";;;;;;;AAwBA,IAAaA,IAA2B,kBAA0C,SAChF,EAAE,YAAS,aAAU,aAAU,IAAO,kBAAe,YAAY,eAAY,aAAU,cAAW,GAAGC,KACrG,GACA;CACA,OACE,kBAAC,OAAD;EAAU;EAAK,WAAWC,EAAG,gBAAgBC,CAAS;EAAG,cAAYC,IAAU,YAAY;EAAW,GAAIH;EAA1G,UAAA,CACGI,KAAW,QAAQA,MAAY,KAC9B,kBAAC,KAAD;GAAG,WAAU;GAAwB,aAAU;GAC5C,UAAAA;EACA,CAAA,IACD,MACJ,kBAACC,GAAD;GACE,WAAU;GACV,SAAQ;GACR,MAAK;GACK;GAGV,iBAAeF,KAAW,KAAA;GAC1B,aAAWA,KAAW,KAAA;GACtB,UAAU,MAAU;IAClB,AAAIA,KACJG,IAAaC,CAAK;GACpB;GAEC,UAAAJ,IAAUK,IAAeC;EACpB,CAAA,CACL;;AAET,CAAC"}