@overdoser/react-toolkit 0.21.0 → 0.22.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 (161) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +35 -0
  3. package/components/Accordion/Accordion.js +48 -48
  4. package/components/ActionButton/ActionButton.js +23 -23
  5. package/components/ActionButton/CopyButton.js +5 -5
  6. package/components/Alert/Alert.js +13 -13
  7. package/components/Avatar/Avatar.js +12 -12
  8. package/components/Badge/Badge.js +6 -6
  9. package/components/Breadcrumbs/Breadcrumbs.js +15 -15
  10. package/components/Button/Button.js +14 -14
  11. package/components/Card/Card.js +26 -26
  12. package/components/Chart/AreaChart.js +103 -103
  13. package/components/Chart/Axis.js +7 -7
  14. package/components/Chart/BarChart.js +62 -62
  15. package/components/Chart/ChartContainer.js +11 -11
  16. package/components/Chart/ChartLegend.js +7 -7
  17. package/components/Chart/ChartTooltip.js +13 -13
  18. package/components/Chart/LineChart.js +88 -88
  19. package/components/Chart/PieChart.js +25 -25
  20. package/components/Chart/RadarChart.js +42 -42
  21. package/components/Chart/Sparkline.js +11 -11
  22. package/components/Chart/TradingChart.js +126 -126
  23. package/components/Chart/trading/period.js +3 -3
  24. package/components/Chip/Chip.js +24 -24
  25. package/components/CodeBlock/CodeBlock.js +31 -31
  26. package/components/CommandPalette/CommandPalette.js +166 -166
  27. package/components/ConfirmDialog/ConfirmDialog.js +60 -60
  28. package/components/Divider/Divider.js +10 -10
  29. package/components/Draggable/Draggable.js +29 -29
  30. package/components/Drawer/Drawer.js +53 -53
  31. package/components/Dropdown/Dropdown.js +66 -66
  32. package/components/Dropdown/DropdownItem.js +13 -13
  33. package/components/Dropdown/DropdownLabel.js +5 -5
  34. package/components/Dropdown/DropdownSeparator.js +5 -5
  35. package/components/Dropzone/Dropzone.js +15 -15
  36. package/components/EmptyState/EmptyState.js +11 -11
  37. package/components/Form/Form.js +17 -17
  38. package/components/Form/FormField.js +21 -21
  39. package/components/Form/FormRow.js +3 -3
  40. package/components/ImageViewer/ImageViewer.js +118 -118
  41. package/components/Kbd/Kbd.js +11 -11
  42. package/components/KeyValueList/KeyValueList.js +32 -32
  43. package/components/Link/Link.js +7 -7
  44. package/components/List/List.js +7 -7
  45. package/components/Loader/Loader.js +39 -39
  46. package/components/Modal/Modal.js +48 -48
  47. package/components/PageHeader/PageHeader.js +18 -18
  48. package/components/Pagination/Pagination.js +23 -23
  49. package/components/Popover/Popover.js +25 -25
  50. package/components/ProgressBar/ProgressBar.js +17 -17
  51. package/components/RelativeTime/RelativeTime.js +10 -10
  52. package/components/SegmentedControl/SegmentedControl.js +38 -38
  53. package/components/Skeleton/Skeleton.js +10 -10
  54. package/components/Spinner/Spinner.js +7 -7
  55. package/components/SplitButton/SplitButton.js +63 -63
  56. package/components/SplitPane/SplitPane.js +50 -50
  57. package/components/StatCard/StatCard.js +32 -32
  58. package/components/StatusDot/StatusDot.js +7 -7
  59. package/components/Table/Table.js +174 -174
  60. package/components/Tabs/Tabs.js +47 -47
  61. package/components/ThemeToggle/ThemeToggle.js +31 -31
  62. package/components/Timeline/GanttTimeline.js +213 -213
  63. package/components/Timeline/HistoryTimeline.js +306 -306
  64. package/components/Timeline/TimelineShared.js +103 -103
  65. package/components/Timeline/TraceEventDetails.js +103 -103
  66. package/components/Timeline/TraceTimeline.js +546 -546
  67. package/components/Timeline/historyLayout.js +2 -2
  68. package/components/Timer/Timer.js +39 -39
  69. package/components/Toast/Toast.js +59 -59
  70. package/components/ToggleIconButton/ToggleIconButton.js +9 -9
  71. package/components/Tooltip/Tooltip.js +16 -16
  72. package/components/Typography/Typography.js +5 -5
  73. package/components/inputs/Checkbox/Checkbox.js +11 -11
  74. package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
  75. package/components/inputs/DatePicker/CalendarPanel.js +113 -113
  76. package/components/inputs/DatePicker/DatePicker.js +39 -39
  77. package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
  78. package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
  79. package/components/inputs/DateTimePicker/TimeField.js +34 -34
  80. package/components/inputs/Input/Input.js +13 -13
  81. package/components/inputs/NumberInput/NumberInput.js +16 -16
  82. package/components/inputs/Radio/Radio.js +17 -17
  83. package/components/inputs/SearchInput/SearchInput.js +25 -25
  84. package/components/inputs/Select/Select.d.ts +55 -3
  85. package/components/inputs/Select/Select.js +485 -344
  86. package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
  87. package/components/inputs/Slider/Slider.js +21 -21
  88. package/components/inputs/Switch/Switch.js +4 -4
  89. package/components/inputs/Textarea/Textarea.js +8 -8
  90. package/hooks/usePortalPosition.d.ts +2 -1
  91. package/hooks/usePortalPosition.js +6 -3
  92. package/hooks/useResizable.js +1 -1
  93. package/hooks/useTheme.js +7 -7
  94. package/index.css +1 -1
  95. package/index.js +1 -1
  96. package/index.layered.css +1 -1
  97. package/llms.txt +25 -4
  98. package/manifest.json +33 -4
  99. package/package.json +1 -1
  100. /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
  101. /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
  102. /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
  103. /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
  104. /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
  105. /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
  106. /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
  107. /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
  108. /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
  109. /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
  110. /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
  111. /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
  112. /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
  113. /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
  114. /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
  115. /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
  116. /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
  117. /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
  118. /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
  119. /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
  120. /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
  121. /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
  122. /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
  123. /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
  124. /package/components/List/{List.module.js → List.module.scss.js} +0 -0
  125. /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
  126. /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
  127. /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
  128. /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
  129. /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
  130. /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
  131. /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
  132. /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
  133. /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
  134. /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
  135. /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
  136. /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
  137. /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
  138. /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
  139. /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
  140. /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
  141. /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
  142. /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
  143. /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
  144. /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
  145. /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
  146. /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
  147. /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
  148. /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
  149. /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
  150. /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
  151. /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
  152. /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
  153. /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
  154. /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
  155. /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
  156. /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
  157. /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
  158. /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
  159. /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
  160. /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
  161. /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
@@ -1,6 +1,6 @@
1
- import e from "./DateTimePicker.module.js";
2
- import { useEffect as t, useMemo as n, useRef as r } from "react";
3
- import i from "clsx";
1
+ import { useEffect as e, useMemo as t, useRef as n } from "react";
2
+ import r from "clsx";
3
+ import i from "./DateTimePicker.module.scss.js";
4
4
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
5
  // src/components/inputs/DateTimePicker/TimeField.tsx
6
6
  var s = (e) => String(e).padStart(2, "0");
@@ -12,12 +12,12 @@ function c(e, t, n) {
12
12
  label: s(e)
13
13
  }));
14
14
  }
15
- function l({ label: n, items: o, selected: s, onSelect: c, disabled: l, classes: u }) {
16
- let d = r(null), f = r(!1);
17
- return t(() => {
15
+ function l({ label: t, items: o, selected: s, onSelect: c, disabled: l, classes: u }) {
16
+ let d = n(null), f = n(!1);
17
+ return e(() => {
18
18
  let e = d.current, t = e?.querySelector("[aria-selected=\"true\"]");
19
19
  e && t && (e.scrollTop = t.offsetTop - e.clientHeight / 2 + t.offsetHeight / 2);
20
- }, []), t(() => {
20
+ }, []), e(() => {
21
21
  if (!f.current) return;
22
22
  f.current = !1;
23
23
  let e = d.current?.querySelector("[aria-selected=\"true\"]");
@@ -25,8 +25,8 @@ function l({ label: n, items: o, selected: s, onSelect: c, disabled: l, classes:
25
25
  }, [s]), /* @__PURE__ */ a("div", {
26
26
  ref: d,
27
27
  role: "listbox",
28
- "aria-label": n,
29
- className: i(e.column, u?.column),
28
+ "aria-label": t,
29
+ className: r(i.column, u?.column),
30
30
  onKeyDown: (e) => {
31
31
  let t = o.findIndex((e) => e.value === s), n = t;
32
32
  switch (e.key) {
@@ -46,29 +46,29 @@ function l({ label: n, items: o, selected: s, onSelect: c, disabled: l, classes:
46
46
  }
47
47
  e.preventDefault(), n !== t && (f.current = !0, c(o[n].value));
48
48
  },
49
- children: o.map((t) => {
50
- let n = t.value === s;
49
+ children: o.map((e) => {
50
+ let t = e.value === s;
51
51
  return /* @__PURE__ */ a("button", {
52
52
  type: "button",
53
53
  role: "option",
54
- "aria-selected": n,
55
- tabIndex: n ? 0 : -1,
54
+ "aria-selected": t,
55
+ tabIndex: t ? 0 : -1,
56
56
  disabled: l,
57
- className: i(e.option, n && e.optionSelected, u?.option, n && u?.optionSelected),
58
- onClick: () => c(t.value),
59
- children: t.label
60
- }, t.value);
57
+ className: r(i.option, t && i.optionSelected, u?.option, t && u?.optionSelected),
58
+ onClick: () => c(e.value),
59
+ children: e.label
60
+ }, e.value);
61
61
  })
62
62
  });
63
63
  }
64
- function u({ hour: t, minute: r, second: u, onChange: d, hourCycle: f, showSeconds: p, minuteStep: m, disabled: h, classes: g }) {
65
- let _ = f === 12, v = t >= 12, y = n(() => _ ? Array.from({ length: 12 }, (e, t) => ({
64
+ function u({ hour: e, minute: n, second: u, onChange: d, hourCycle: f, showSeconds: p, minuteStep: m, disabled: h, classes: g }) {
65
+ let _ = f === 12, v = e >= 12, y = t(() => _ ? Array.from({ length: 12 }, (e, t) => ({
66
66
  value: t + (v ? 12 : 0),
67
67
  label: s(t === 0 ? 12 : t)
68
68
  })) : Array.from({ length: 24 }, (e, t) => ({
69
69
  value: t,
70
70
  label: s(t)
71
- })), [_, v]), b = n(() => c(59, m, r), [m, r]), x = n(() => c(59, 1, u), [u]), S = n(() => [{
71
+ })), [_, v]), b = t(() => c(59, m, n), [m, n]), x = t(() => c(59, 1, u), [u]), S = t(() => [{
72
72
  value: 0,
73
73
  label: "AM"
74
74
  }, {
@@ -76,17 +76,17 @@ function u({ hour: t, minute: r, second: u, onChange: d, hourCycle: f, showSecon
76
76
  label: "PM"
77
77
  }], []);
78
78
  return /* @__PURE__ */ o("div", {
79
- className: i(e.time, g?.time),
79
+ className: r(i.time, g?.time),
80
80
  role: "group",
81
81
  "aria-label": "Time",
82
82
  children: [
83
83
  /* @__PURE__ */ a(l, {
84
84
  label: "Hours",
85
85
  items: y,
86
- selected: t,
86
+ selected: e,
87
87
  onSelect: (e) => d({
88
88
  hour: e,
89
- minute: r,
89
+ minute: n,
90
90
  second: u
91
91
  }),
92
92
  disabled: h,
@@ -95,10 +95,10 @@ function u({ hour: t, minute: r, second: u, onChange: d, hourCycle: f, showSecon
95
95
  /* @__PURE__ */ a(l, {
96
96
  label: "Minutes",
97
97
  items: b,
98
- selected: r,
99
- onSelect: (e) => d({
100
- hour: t,
101
- minute: e,
98
+ selected: n,
99
+ onSelect: (t) => d({
100
+ hour: e,
101
+ minute: t,
102
102
  second: u
103
103
  }),
104
104
  disabled: h,
@@ -108,10 +108,10 @@ function u({ hour: t, minute: r, second: u, onChange: d, hourCycle: f, showSecon
108
108
  label: "Seconds",
109
109
  items: x,
110
110
  selected: u,
111
- onSelect: (e) => d({
112
- hour: t,
113
- minute: r,
114
- second: e
111
+ onSelect: (t) => d({
112
+ hour: e,
113
+ minute: n,
114
+ second: t
115
115
  }),
116
116
  disabled: h,
117
117
  classes: g
@@ -120,9 +120,9 @@ function u({ hour: t, minute: r, second: u, onChange: d, hourCycle: f, showSecon
120
120
  label: "AM/PM",
121
121
  items: S,
122
122
  selected: +!!v,
123
- onSelect: (e) => d({
124
- hour: t % 12 + (e ? 12 : 0),
125
- minute: r,
123
+ onSelect: (t) => d({
124
+ hour: e % 12 + (t ? 12 : 0),
125
+ minute: n,
126
126
  second: u
127
127
  }),
128
128
  disabled: h,
@@ -1,6 +1,6 @@
1
- import e from "./Input.module.js";
2
- import { forwardRef as t, useCallback as n, useRef as r, useState as i } from "react";
3
- import a from "clsx";
1
+ import { forwardRef as e, useCallback as t, useRef as n, useState as r } from "react";
2
+ import i from "clsx";
3
+ import a from "./Input.module.scss.js";
4
4
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
5
  // src/components/inputs/Input/Input.tsx
6
6
  var c = /* @__PURE__ */ s("svg", {
@@ -36,16 +36,16 @@ var c = /* @__PURE__ */ s("svg", {
36
36
  fill: "currentColor",
37
37
  "aria-hidden": "true",
38
38
  children: /* @__PURE__ */ o("path", { d: "M10 18a8 8 0 100-16 8 8 0 000 16zM7.3 7.3a1 1 0 011.4 0L10 8.6l1.3-1.3a1 1 0 111.4 1.4L11.4 10l1.3 1.3a1 1 0 01-1.4 1.4L10 11.4l-1.3 1.3a1 1 0 01-1.4-1.4L8.6 10 7.3 8.7a1 1 0 010-1.4z" })
39
- }), d = t(({ inputSize: t = "md", error: d = !1, prefix: f, suffix: p, revealable: m = !1, revealed: h, onRevealedChange: g, revealLabels: _, clearable: v = !1, clearLabel: y = "Clear", onClear: b, classes: x, className: S, style: C, type: w, onChange: T, ...E }, D) => {
40
- let O = r(null), k = n((e) => {
39
+ }), d = e(({ inputSize: e = "md", error: d = !1, prefix: f, suffix: p, revealable: m = !1, revealed: h, onRevealedChange: g, revealLabels: _, clearable: v = !1, clearLabel: y = "Clear", onClear: b, classes: x, className: S, style: C, type: w, onChange: T, ...E }, D) => {
40
+ let O = n(null), k = t((e) => {
41
41
  O.current = e, typeof D == "function" ? D(e) : D && (D.current = e);
42
- }, [D]), A = m && w === "password", [j, M] = i(!1), N = h ?? j, P = () => {
42
+ }, [D]), A = m && w === "password", [j, M] = r(!1), N = h ?? j, P = () => {
43
43
  let e = !N;
44
44
  h === void 0 && M(e), g?.(e);
45
45
  }, F = A && N ? "text" : w, I = _ ?? {
46
46
  show: "Show password",
47
47
  hide: "Hide password"
48
- }, { value: L, defaultValue: R, disabled: z, readOnly: B } = E, [V, H] = i(() => R != null && String(R).length > 0), U = L == null ? V : String(L).length > 0, W = v && U && !z && !B, G = v ? (e) => {
48
+ }, { value: L, defaultValue: R, disabled: z, readOnly: B } = E, [V, H] = r(() => R != null && String(R).length > 0), U = L == null ? V : String(L).length > 0, W = v && U && !z && !B, G = v ? (e) => {
49
49
  H(e.target.value.length > 0), T?.(e);
50
50
  } : T, K = () => {
51
51
  let e = O.current;
@@ -53,27 +53,27 @@ var c = /* @__PURE__ */ s("svg", {
53
53
  }, q = (e) => e.preventDefault(), J = !!(f || p || A || v), Y = /* @__PURE__ */ o("input", {
54
54
  ref: k,
55
55
  type: F,
56
- className: a(e.root, e[t], d && e.error, (f || void 0) && e.hasPrefix, (p || A || v) && e.hasSuffix, x?.root, !J && S),
56
+ className: i(a.root, a[e], d && a.error, (f || void 0) && a.hasPrefix, (p || A || v) && a.hasSuffix, x?.root, !J && S),
57
57
  style: J ? void 0 : C,
58
58
  onChange: G,
59
59
  ...E
60
60
  });
61
61
  return J ? /* @__PURE__ */ s("div", {
62
- className: a(e.wrapper, e[t], d && e.error, x?.wrapper, S),
62
+ className: i(a.wrapper, a[e], d && a.error, x?.wrapper, S),
63
63
  style: C,
64
64
  children: [
65
65
  f && /* @__PURE__ */ o("span", {
66
- className: a(e.prefix, x?.prefix),
66
+ className: i(a.prefix, x?.prefix),
67
67
  children: f
68
68
  }),
69
69
  Y,
70
70
  p && /* @__PURE__ */ o("span", {
71
- className: a(e.suffix, x?.suffix),
71
+ className: i(a.suffix, x?.suffix),
72
72
  children: p
73
73
  }),
74
74
  W && /* @__PURE__ */ o("button", {
75
75
  type: "button",
76
- className: a(e.sideButton, e.clear, x?.clear),
76
+ className: i(a.sideButton, a.clear, x?.clear),
77
77
  "aria-label": y,
78
78
  onMouseDown: q,
79
79
  onClick: K,
@@ -82,7 +82,7 @@ var c = /* @__PURE__ */ s("svg", {
82
82
  }),
83
83
  A && /* @__PURE__ */ o("button", {
84
84
  type: "button",
85
- className: a(e.sideButton, e.reveal, x?.reveal),
85
+ className: i(a.sideButton, a.reveal, x?.reveal),
86
86
  "aria-label": N ? I.hide : I.show,
87
87
  "aria-pressed": N,
88
88
  onMouseDown: q,
@@ -1,18 +1,18 @@
1
- import e from "./NumberInput.module.js";
2
- import { forwardRef as t, useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
3
- import o from "clsx";
1
+ import { forwardRef as e, useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
2
+ import a from "clsx";
3
+ import o from "./NumberInput.module.scss.js";
4
4
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
5
  // src/components/inputs/NumberInput/NumberInput.tsx
6
6
  var l = (e) => {
7
7
  if (e.trim() === "") return null;
8
8
  let t = Number(e);
9
9
  return Number.isNaN(t) ? null : t;
10
- }, u = t(({ value: t, defaultValue: u, onChange: d, min: f, max: p, step: m = 1, precision: h, inputSize: g = "md", error: _ = !1, hideControls: v = !1, disabled: y, readOnly: b, classes: x, className: S, style: C, onKeyDown: w, onBlur: T, ...E }, D) => {
11
- let O = t !== void 0, k = (O ? t : u) ?? null, [A, j] = a(k == null ? "" : String(k)), M = i(!1), N = i(!1), P = O ? t ?? null : l(A);
12
- r(() => {
13
- O && (!M.current || N.current) && j(t == null ? "" : String(t)), N.current = !1;
14
- }, [O, t]);
15
- let F = n((e) => {
10
+ }, u = e(({ value: e, defaultValue: u, onChange: d, min: f, max: p, step: m = 1, precision: h, inputSize: g = "md", error: _ = !1, hideControls: v = !1, disabled: y, readOnly: b, classes: x, className: S, style: C, onKeyDown: w, onBlur: T, ...E }, D) => {
11
+ let O = e !== void 0, k = (O ? e : u) ?? null, [A, j] = i(k == null ? "" : String(k)), M = r(!1), N = r(!1), P = O ? e ?? null : l(A);
12
+ n(() => {
13
+ O && (!M.current || N.current) && j(e == null ? "" : String(e)), N.current = !1;
14
+ }, [O, e]);
15
+ let F = t((e) => {
16
16
  let t = e;
17
17
  if (f != null && (t = Math.max(f, t)), p != null && (t = Math.min(p, t)), h != null) {
18
18
  let e = 10 ** h;
@@ -23,9 +23,9 @@ var l = (e) => {
23
23
  f,
24
24
  p,
25
25
  h
26
- ]), I = n((e) => {
26
+ ]), I = t((e) => {
27
27
  O ? N.current = !0 : j(e == null ? "" : String(e)), d?.(e);
28
- }, [O, d]), L = n((e) => {
28
+ }, [O, d]), L = t((e) => {
29
29
  y || b || I(F((P ?? f ?? 0) + e * m));
30
30
  }, [
31
31
  y,
@@ -37,14 +37,14 @@ var l = (e) => {
37
37
  I
38
38
  ]), R = p != null && P != null && P >= p, z = f != null && P != null && P <= f;
39
39
  return /* @__PURE__ */ c("div", {
40
- className: o(e.root, e[g], _ && e.error, y && e.disabled, x?.root, S),
40
+ className: a(o.root, o[g], _ && o.error, y && o.disabled, x?.root, S),
41
41
  style: C,
42
42
  "data-disabled": y || void 0,
43
43
  children: [/* @__PURE__ */ s("input", {
44
44
  ref: D,
45
45
  type: "text",
46
46
  inputMode: "decimal",
47
- className: o(e.input, x?.input),
47
+ className: a(o.input, x?.input),
48
48
  value: A,
49
49
  disabled: y,
50
50
  readOnly: b,
@@ -65,11 +65,11 @@ var l = (e) => {
65
65
  },
66
66
  ...E
67
67
  }), !v && /* @__PURE__ */ c("div", {
68
- className: o(e.controls, x?.controls),
68
+ className: a(o.controls, x?.controls),
69
69
  children: [/* @__PURE__ */ s("button", {
70
70
  type: "button",
71
71
  tabIndex: -1,
72
- className: o(e.increment, x?.increment),
72
+ className: a(o.increment, x?.increment),
73
73
  onClick: () => L(1),
74
74
  disabled: y || b || R,
75
75
  "aria-label": "Increment",
@@ -88,7 +88,7 @@ var l = (e) => {
88
88
  }), /* @__PURE__ */ s("button", {
89
89
  type: "button",
90
90
  tabIndex: -1,
91
- className: o(e.decrement, x?.decrement),
91
+ className: a(o.decrement, x?.decrement),
92
92
  onClick: () => L(-1),
93
93
  disabled: y || b || z,
94
94
  "aria-label": "Decrement",
@@ -1,19 +1,19 @@
1
- import e from "./Radio.module.js";
2
- import { createContext as t, forwardRef as n, useContext as r } from "react";
3
- import i from "clsx";
1
+ import { createContext as e, forwardRef as t, useContext as n } from "react";
2
+ import r from "clsx";
3
+ import i from "./Radio.module.scss.js";
4
4
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
5
  // src/components/inputs/Radio/Radio.tsx
6
- var s = t(null), c = n(({ name: t, value: n, onChange: r, className: o, style: c, children: l, id: u, "aria-label": d, "aria-labelledby": f, required: p, error: m = !1 }, h) => /* @__PURE__ */ a(s.Provider, {
6
+ var s = e(null), c = t(({ name: e, value: t, onChange: n, className: o, style: c, children: l, id: u, "aria-label": d, "aria-labelledby": f, required: p, error: m = !1 }, h) => /* @__PURE__ */ a(s.Provider, {
7
7
  value: {
8
- name: t,
9
- value: n,
10
- onChange: r,
8
+ name: e,
9
+ value: t,
10
+ onChange: n,
11
11
  error: m
12
12
  },
13
13
  children: /* @__PURE__ */ a("div", {
14
14
  ref: h,
15
15
  id: u,
16
- className: i(e.group, o),
16
+ className: r(i.group, o),
17
17
  style: c,
18
18
  role: "radiogroup",
19
19
  tabIndex: -1,
@@ -24,25 +24,25 @@ var s = t(null), c = n(({ name: t, value: n, onChange: r, className: o, style: c
24
24
  })
25
25
  }));
26
26
  c.displayName = "RadioGroup";
27
- var l = n(({ label: t, value: n, classes: c, className: l, style: u, onChange: d, checked: f, name: p, error: m = !1, ...h }, g) => {
28
- let _ = r(s), v = _?.name ?? p, y = _ ? _.value === n : f, b = m || !!_?.error;
27
+ var l = t(({ label: e, value: t, classes: c, className: l, style: u, onChange: d, checked: f, name: p, error: m = !1, ...h }, g) => {
28
+ let _ = n(s), v = _?.name ?? p, y = _ ? _.value === t : f, b = m || !!_?.error;
29
29
  return /* @__PURE__ */ o("label", {
30
- className: i(e.root, c?.root, l),
30
+ className: r(i.root, c?.root, l),
31
31
  style: u,
32
32
  children: [/* @__PURE__ */ a("input", {
33
33
  ref: g,
34
34
  type: "radio",
35
- className: i(e.input, b && e.error, c?.input),
35
+ className: r(i.input, b && i.error, c?.input),
36
36
  name: v,
37
- value: n,
37
+ value: t,
38
38
  checked: y,
39
39
  onChange: (e) => {
40
- _?.onChange?.(n), d?.(e);
40
+ _?.onChange?.(t), d?.(e);
41
41
  },
42
42
  ...h
43
- }), t && /* @__PURE__ */ a("span", {
44
- className: i(e.label, c?.label),
45
- children: t
43
+ }), e && /* @__PURE__ */ a("span", {
44
+ className: r(i.label, c?.label),
45
+ children: e
46
46
  })]
47
47
  });
48
48
  });
@@ -1,11 +1,11 @@
1
- import e from "./SearchInput.module.js";
2
- import { Input as t } from "../Input/Input.js";
3
- import { Spinner as n } from "../../Spinner/Spinner.js";
4
- import { Kbd as r } from "../../Kbd/Kbd.js";
5
- import { useDebouncedValue as i } from "../../../hooks/useDebouncedValue.js";
6
- import { useKeyboard as a } from "../../../hooks/useKeyboard.js";
7
- import { forwardRef as o, useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
8
- import d from "clsx";
1
+ import { forwardRef as e, useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
2
+ import a from "clsx";
3
+ import o from "./SearchInput.module.scss.js";
4
+ import { Input as s } from "../Input/Input.js";
5
+ import { Spinner as c } from "../../Spinner/Spinner.js";
6
+ import { Kbd as l } from "../../Kbd/Kbd.js";
7
+ import { useDebouncedValue as u } from "../../../hooks/useDebouncedValue.js";
8
+ import { useKeyboard as d } from "../../../hooks/useKeyboard.js";
9
9
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
10
  // src/components/inputs/SearchInput/SearchInput.tsx
11
11
  var h = ({ className: e }) => /* @__PURE__ */ m("svg", {
@@ -31,19 +31,19 @@ function _(e) {
31
31
  return n === "mod" ? t ? "⌘" : "Ctrl" : n === "meta" || n === "cmd" || n === "command" ? t ? "⌘" : "Win" : n === "ctrl" || n === "control" ? t ? "⌃" : "Ctrl" : n === "alt" || n === "option" ? t ? "⌥" : "Alt" : n === "shift" ? t ? "⇧" : "Shift" : n === "esc" || n === "escape" ? "Esc" : n === "space" ? "Space" : e.length === 1 ? e.toUpperCase() : e;
32
32
  }).join(t ? "" : " ");
33
33
  }
34
- var v = o(({ onValueChange: o, onSearch: g, debounce: v = 300, loading: y = !1, hotkey: b = !1, showHotkeyHint: x = !0, onEscape: S = "clear", searchLabel: C = "Search", classes: w, suffix: T, value: E, defaultValue: D, onChange: O, onClear: k, onKeyDown: A, onFocus: j, onBlur: M, ...N }, P) => {
35
- let F = l(null), I = s((e) => {
34
+ var v = e(({ onValueChange: e, onSearch: g, debounce: v = 300, loading: y = !1, hotkey: b = !1, showHotkeyHint: x = !0, onEscape: S = "clear", searchLabel: C = "Search", classes: w, suffix: T, value: E, defaultValue: D, onChange: O, onClear: k, onKeyDown: A, onFocus: j, onBlur: M, ...N }, P) => {
35
+ let F = r(null), I = t((e) => {
36
36
  F.current = e, typeof P == "function" ? P(e) : P && (P.current = e);
37
- }, [P]), [L, R] = u(() => D == null ? "" : String(D)), z = E != null, B = z ? String(E) : L, V = l(B), H = l(g);
37
+ }, [P]), [L, R] = i(() => D == null ? "" : String(D)), z = E != null, B = z ? String(E) : L, V = r(B), H = r(g);
38
38
  H.current = g;
39
- let U = s((e) => {
39
+ let U = t((e) => {
40
40
  V.current !== e && (V.current = e, H.current?.(e));
41
- }, []), W = i(B, v);
42
- c(() => {
41
+ }, []), W = u(B, v);
42
+ n(() => {
43
43
  U(W);
44
44
  }, [W, U]);
45
- let [G, K] = u(!1), q = (e) => {
46
- z || R(e.target.value), O?.(e), o?.(e.target.value);
45
+ let [G, K] = i(!1), q = (t) => {
46
+ z || R(t.target.value), O?.(t), e?.(t.target.value);
47
47
  }, J = () => {
48
48
  U(""), k?.();
49
49
  }, Y = () => {
@@ -51,32 +51,32 @@ var v = o(({ onValueChange: o, onSearch: g, debounce: v = 300, loading: y = !1,
51
51
  e && ((Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), U(""));
52
52
  }, X = (e) => {
53
53
  A?.(e), e.defaultPrevented || (e.key === "Enter" ? (e.preventDefault(), U(e.currentTarget.value)) : e.key === "Escape" && S !== "none" && (S === "clear" && e.currentTarget.value.length > 0 ? (e.preventDefault(), Y()) : e.currentTarget.blur()));
54
- }, Z = s(() => {
54
+ }, Z = t(() => {
55
55
  F.current?.focus(), F.current?.select();
56
56
  }, []);
57
- a(b ? { [b]: Z } : {}, {
57
+ d(b ? { [b]: Z } : {}, {
58
58
  active: !!b,
59
59
  preventDefault: !0
60
60
  });
61
61
  let Q = !!b && x && B.length === 0 && !G, $ = y || Q || T ? /* @__PURE__ */ m(f, { children: [
62
- y && /* @__PURE__ */ p(n, {
62
+ y && /* @__PURE__ */ p(c, {
63
63
  size: "sm",
64
64
  label: "Searching",
65
- className: d(e.spinner, w?.spinner)
65
+ className: a(o.spinner, w?.spinner)
66
66
  }),
67
- Q && /* @__PURE__ */ p(r, {
67
+ Q && /* @__PURE__ */ p(l, {
68
68
  size: "sm",
69
- className: d(e.hint, w?.hint),
69
+ className: a(o.hint, w?.hint),
70
70
  "aria-hidden": "true",
71
71
  children: _(b)
72
72
  }),
73
73
  T
74
74
  ] }) : void 0, ee = N["aria-label"] !== void 0 || N["aria-labelledby"] !== void 0;
75
- return /* @__PURE__ */ p(t, {
75
+ return /* @__PURE__ */ p(s, {
76
76
  ref: I,
77
77
  type: "search",
78
78
  clearable: !0,
79
- prefix: /* @__PURE__ */ p(h, { className: d(e.icon, w?.icon) }),
79
+ prefix: /* @__PURE__ */ p(h, { className: a(o.icon, w?.icon) }),
80
80
  suffix: $,
81
81
  value: E,
82
82
  defaultValue: D,
@@ -92,7 +92,7 @@ var v = o(({ onValueChange: o, onSearch: g, debounce: v = 300, loading: y = !1,
92
92
  "aria-label": ee ? void 0 : C,
93
93
  classes: w,
94
94
  ...N,
95
- className: d(e.root, N.className)
95
+ className: a(o.root, N.className)
96
96
  });
97
97
  });
98
98
  v.displayName = "SearchInput";
@@ -24,6 +24,14 @@ export interface SelectClasses {
24
24
  match: string;
25
25
  /** Non-option rows in the menu: "No results", "Loading…", the search prompt. */
26
26
  message: string;
27
+ /** Checklist mode: the box at the start of every row. */
28
+ checkbox: string;
29
+ /** Checklist mode: the bar under the search box holding the select/deselect actions. */
30
+ menuHeader: string;
31
+ /** Checklist mode: the "Select all" and "Deselect all" buttons. */
32
+ menuAction: string;
33
+ /** The "+N more" chip shown when `maxVisibleChips` hides some chips. */
34
+ moreChip: string;
27
35
  }
28
36
  export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onChange' | 'value'> {
29
37
  /** Toolkit size scale (independent of the native `size` HTML attribute). @default 'md' */
@@ -38,7 +46,7 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
38
46
  classes?: Partial<SelectClasses>;
39
47
  /** Replaces the native `<select>` with a filterable dropdown. @default false */
40
48
  searchable?: boolean;
41
- /** Placeholder for the search input (searchable mode). @default 'Search...' */
49
+ /** Placeholder for the search input (searchable and checklist modes). @default 'Search...' */
42
50
  searchPlaceholder?: string;
43
51
  /** Native + searchable mode change event (synthetic in searchable mode). */
44
52
  onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
@@ -50,12 +58,16 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
50
58
  multiple?: boolean;
51
59
  /** Multi-mode callback. */
52
60
  onValuesChange?: (values: string[]) => void;
53
- /** Clear the search query after each toggle in multi mode. @default true */
61
+ /**
62
+ * Clear the search query after each toggle in multi mode.
63
+ * @default true, or false with `checklist`
64
+ */
54
65
  clearSearchOnSelect?: boolean;
55
66
  /**
56
67
  * Multi-mode only. When `true`, the menu closes after each add/remove (and
57
68
  * after a `Create` row click) — the user has to reopen to pick another.
58
- * Set to `false` for the "stay open until done" pattern. @default true
69
+ * Set to `false` for the "stay open until done" pattern.
70
+ * @default true, or false with `checklist`
59
71
  */
60
72
  closeOnSelect?: boolean;
61
73
  /**
@@ -123,12 +135,51 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
123
135
  * the menu. @default true
124
136
  */
125
137
  portal?: boolean;
138
+ /**
139
+ * Multi-mode only. Checklist picker for selecting many values while filtering.
140
+ *
141
+ * The search box moves into the menu and every row gets a checkbox.
142
+ * Chips show the plain `label`; a rich `content` is used only in the menu rows.
143
+ * Selected options stay listed when they don't match the query, in their `options` order.
144
+ * An option unchecked while filtered stays listed until the query changes, so rows never jump under the pointer.
145
+ * A header offers "Select all" (every matching option) and "Deselect all".
146
+ * The menu stays open while picking: `closeOnSelect` and `clearSearchOnSelect` default to `false`.
147
+ * A click outside, Escape or Tab closes it.
148
+ * @default false
149
+ */
150
+ checklist?: boolean;
151
+ /**
152
+ * Checklist mode: label of the header action that selects every matching option.
153
+ * @default query ? 'Select all matching' : 'Select all'
154
+ */
155
+ selectAllLabel?: React.ReactNode;
156
+ /**
157
+ * Checklist mode: label of the header action that clears the selection.
158
+ * @default 'Deselect all'
159
+ */
160
+ deselectAllLabel?: React.ReactNode;
161
+ /**
162
+ * Multi-mode only. Show at most this many chips in the control.
163
+ *
164
+ * The rest collapse into a "+N more" chip whose tooltip lists them.
165
+ * Unlimited when omitted.
166
+ */
167
+ maxVisibleChips?: number;
168
+ /**
169
+ * Multi-mode only. Text of the overflow chip shown by `maxVisibleChips`.
170
+ * @default (n) => `+${n} more`
171
+ */
172
+ moreChipsLabel?: (hiddenCount: number) => React.ReactNode;
126
173
  }
127
174
  /**
128
175
  * Three internal modes, picked automatically:
129
176
  * - **Native** (default): wraps `<select>`. Use `onChange` or pass options as `children`.
130
177
  * - **Searchable**: set `searchable`. Custom dropdown with text filter.
131
178
  * - **Multi**: set `multiple`. Chip-based multi-select with text filter.
179
+ * Add `checklist` for the AWS-console style picker: search inside the menu,
180
+ * a checkbox per row, selected rows kept while filtering, and
181
+ * "Select all" / "Deselect all" actions.
182
+ * `maxVisibleChips` collapses long selections into a "+N more" chip.
132
183
  *
133
184
  * The searchable and multi modes filter `options` locally by default. Pass
134
185
  * `onSearch` for **remote** search: the query (debounced by `searchDebounce`)
@@ -145,6 +196,7 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
145
196
  * @example Native: <Select options={[{ value: 'a', label: 'A' }]} onValueChange={setValue} />
146
197
  * @example Searchable: <Select searchable options={users} value={id} onValueChange={setId} />
147
198
  * @example Multi: <Select multiple options={tags} value={selected} onValuesChange={setSelected} />
199
+ * @example Checklist: <Select multiple checklist maxVisibleChips={3} options={logGroups} value={groups} onValuesChange={setGroups} />
148
200
  * @example Remote: <Select searchable options={results} loading={isFetching} onSearch={fetchUsers} value={id} onValueChange={setId} selectedLabels={{ [id]: name }} />
149
201
  */
150
202
  export declare const Select: import('react').ForwardRefExoticComponent<Omit<SelectProps, "ref"> & import('react').RefAttributes<HTMLSelectElement>>;