@overdoser/react-toolkit 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +41 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.scss.js +19 -35
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.scss.js +24 -46
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +93 -96
  9. package/components/Alert/Alert.module.scss.js +17 -32
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.scss.js +22 -42
  12. package/components/Badge/Badge.js +15 -37
  13. package/components/Badge/Badge.module.scss.js +16 -30
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.scss.js +24 -46
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.scss.js +34 -59
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.scss.js +31 -60
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +45 -40
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.scss.js +31 -58
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.scss.js +16 -30
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.scss.js +9 -16
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.scss.js +65 -118
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.scss.js +28 -52
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +13 -11
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.scss.js +11 -20
  71. package/components/EmptyState/EmptyState.js +57 -54
  72. package/components/EmptyState/EmptyState.module.scss.js +13 -24
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +31 -34
  75. package/components/Form/Form.module.scss.js +15 -28
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +24 -21
  85. package/components/Kbd/Kbd.module.scss.js +9 -16
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.scss.js +9 -15
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.scss.js +11 -20
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.scss.js +39 -69
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.scss.js +17 -32
  96. package/components/PageHeader/PageHeader.js +79 -73
  97. package/components/PageHeader/PageHeader.module.scss.js +22 -42
  98. package/components/Pagination/Pagination.js +62 -83
  99. package/components/Pagination/Pagination.module.scss.js +12 -22
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.scss.js +11 -20
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +56 -89
  105. package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
  108. package/components/SegmentedControl/SegmentedControl.js +93 -129
  109. package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.scss.js +14 -24
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.scss.js +11 -19
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.scss.js +30 -56
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.scss.js +13 -24
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.scss.js +41 -71
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.scss.js +17 -31
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.scss.js +41 -80
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.scss.js +27 -52
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.scss.js +28 -54
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
  134. package/components/Timeline/Timeline.module.scss.js +75 -140
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +244 -177
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.scss.js +97 -188
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.scss.js +28 -54
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.scss.js +36 -61
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +36 -58
  153. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.scss.js +16 -29
  157. package/components/Typography/Typography.js +10 -35
  158. package/components/Typography/Typography.module.scss.js +29 -52
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.scss.js +14 -26
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.scss.js +8 -14
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
  183. package/components/inputs/Select/Select.d.ts +55 -3
  184. package/components/inputs/Select/Select.js +696 -682
  185. package/components/inputs/Select/Select.module.scss.js +49 -72
  186. package/components/inputs/Slider/Slider.js +97 -128
  187. package/components/inputs/Slider/Slider.module.scss.js +8 -14
  188. package/components/inputs/Switch/Switch.js +11 -8
  189. package/components/inputs/Textarea/Textarea.js +42 -58
  190. package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
  191. package/hooks/useClickOutside.js +17 -14
  192. package/hooks/useDebouncedValue.js +13 -14
  193. package/hooks/useElementSize.js +27 -22
  194. package/hooks/useEscapeLayer.js +28 -29
  195. package/hooks/useFocusTrap.js +27 -38
  196. package/hooks/useKeyboard.js +76 -64
  197. package/hooks/useMediaQuery.js +10 -15
  198. package/hooks/useNow.js +28 -33
  199. package/hooks/usePersistedState.js +98 -94
  200. package/hooks/usePortalPosition.d.ts +2 -1
  201. package/hooks/usePortalPosition.js +28 -19
  202. package/hooks/useResizable.js +106 -104
  203. package/hooks/useTheme.js +28 -23
  204. package/index.css +2 -1
  205. package/index.js +96 -214
  206. package/index.layered.css +2 -3
  207. package/llms.txt +28 -4
  208. package/manifest.json +41 -4
  209. package/package.json +1 -1
  210. package/utils/formatBytes.js +29 -13
  211. package/utils/themeScript.js +6 -8
  212. package/utils/timeAgo.js +59 -32
@@ -1,73 +1,50 @@
1
- import { jsxs as y, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as h, useContext as R, createContext as G } from "react";
3
- import n from "clsx";
4
- import a from "./Radio.module.scss.js";
5
- const f = G(null), j = h(
6
- ({
7
- name: l,
8
- value: r,
9
- onChange: o,
10
- className: i,
11
- style: d,
12
- children: s,
13
- id: c,
14
- "aria-label": p,
15
- "aria-labelledby": m,
16
- required: u,
17
- error: b = !1
18
- }, e) => /* @__PURE__ */ t(f.Provider, { value: { name: l, value: r, onChange: o, error: b }, children: /* @__PURE__ */ t(
19
- "div",
20
- {
21
- ref: e,
22
- id: c,
23
- className: n(a.group, i),
24
- style: d,
25
- role: "radiogroup",
26
- tabIndex: -1,
27
- "aria-label": p,
28
- "aria-labelledby": m,
29
- "aria-required": u || void 0,
30
- children: s
31
- }
32
- ) })
33
- );
34
- j.displayName = "RadioGroup";
35
- const k = h(
36
- ({
37
- label: l,
38
- value: r,
39
- classes: o,
40
- className: i,
41
- style: d,
42
- onChange: s,
43
- checked: c,
44
- name: p,
45
- error: m = !1,
46
- ...u
47
- }, b) => {
48
- const e = R(f), x = e?.name ?? p, C = e ? e.value === r : c, N = m || !!e?.error, g = (v) => {
49
- e?.onChange?.(r), s?.(v);
50
- };
51
- return /* @__PURE__ */ y("label", { className: n(a.root, o?.root, i), style: d, children: [
52
- /* @__PURE__ */ t(
53
- "input",
54
- {
55
- ref: b,
56
- type: "radio",
57
- className: n(a.input, N && a.error, o?.input),
58
- name: x,
59
- value: r,
60
- checked: C,
61
- onChange: g,
62
- ...u
63
- }
64
- ),
65
- l && /* @__PURE__ */ t("span", { className: n(a.label, o?.label), children: l })
66
- ] });
67
- }
68
- );
69
- k.displayName = "Radio";
70
- export {
71
- k as Radio,
72
- j as RadioGroup
73
- };
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
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ // src/components/inputs/Radio/Radio.tsx
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
+ value: {
8
+ name: e,
9
+ value: t,
10
+ onChange: n,
11
+ error: m
12
+ },
13
+ children: /* @__PURE__ */ a("div", {
14
+ ref: h,
15
+ id: u,
16
+ className: r(i.group, o),
17
+ style: c,
18
+ role: "radiogroup",
19
+ tabIndex: -1,
20
+ "aria-label": d,
21
+ "aria-labelledby": f,
22
+ "aria-required": p || void 0,
23
+ children: l
24
+ })
25
+ }));
26
+ c.displayName = "RadioGroup";
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
+ return /* @__PURE__ */ o("label", {
30
+ className: r(i.root, c?.root, l),
31
+ style: u,
32
+ children: [/* @__PURE__ */ a("input", {
33
+ ref: g,
34
+ type: "radio",
35
+ className: r(i.input, b && i.error, c?.input),
36
+ name: v,
37
+ value: t,
38
+ checked: y,
39
+ onChange: (e) => {
40
+ _?.onChange?.(t), d?.(e);
41
+ },
42
+ ...h
43
+ }), e && /* @__PURE__ */ a("span", {
44
+ className: r(i.label, c?.label),
45
+ children: e
46
+ })]
47
+ });
48
+ });
49
+ l.displayName = "Radio";
50
+ export { l as Radio, c as RadioGroup };
@@ -1,15 +1,9 @@
1
- const r = "crk-group-NNwCD", o = "crk-root-7fGik", t = "crk-input-43PQW", c = "crk-error-Xb8Jc", e = "crk-label-aW30x", n = {
2
- group: r,
3
- root: o,
4
- input: t,
5
- error: c,
6
- label: e
7
- };
8
- export {
9
- n as default,
10
- c as error,
11
- r as group,
12
- t as input,
13
- e as label,
14
- o as root
1
+ // src/components/inputs/Radio/Radio.module.scss
2
+ var e = "crk-group-NNwCD", t = "crk-root-7fGik", n = "crk-input-43PQW", r = "crk-error-Xb8Jc", i = "crk-label-aW30x", a = {
3
+ group: e,
4
+ root: t,
5
+ input: n,
6
+ error: r,
7
+ label: i
15
8
  };
9
+ export { a as default, r as error, e as group, n as input, i as label, t as root };
@@ -1,116 +1,99 @@
1
- import { jsxs as F, Fragment as X, jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as Y, useRef as g, useCallback as S, useState as B, useEffect as Z } from "react";
3
- import m from "clsx";
4
- import d from "./SearchInput.module.scss.js";
5
- import { Input as _ } from "../Input/Input.js";
6
- import { Spinner as $ } from "../../Spinner/Spinner.js";
7
- import { Kbd as V } from "../../Kbd/Kbd.js";
8
- import { useDebouncedValue as q } from "../../../hooks/useDebouncedValue.js";
9
- import { useKeyboard as ee } from "../../../hooks/useKeyboard.js";
10
- const te = ({ className: o }) => /* @__PURE__ */ F(
11
- "svg",
12
- {
13
- className: o,
14
- viewBox: "0 0 20 20",
15
- fill: "none",
16
- stroke: "currentColor",
17
- strokeWidth: "1.8",
18
- "aria-hidden": "true",
19
- children: [
20
- /* @__PURE__ */ c("circle", { cx: "8.5", cy: "8.5", r: "5.5" }),
21
- /* @__PURE__ */ c("path", { d: "M12.8 12.8L17 17", strokeLinecap: "round" })
22
- ]
23
- }
24
- ), re = () => typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform ?? "");
25
- function ne(o) {
26
- const n = re(), i = o.split("+").map((r) => r.trim()).filter(Boolean);
27
- return o.endsWith("+") && i.push("+"), i.map((r) => {
28
- const t = r.toLowerCase();
29
- return t === "mod" ? n ? "⌘" : "Ctrl" : t === "meta" || t === "cmd" || t === "command" ? n ? "⌘" : "Win" : t === "ctrl" || t === "control" ? n ? "⌃" : "Ctrl" : t === "alt" || t === "option" ? n ? "⌥" : "Alt" : t === "shift" ? n ? "⇧" : "Shift" : t === "esc" || t === "escape" ? "Esc" : t === "space" ? "Space" : r.length === 1 ? r.toUpperCase() : r;
30
- }).join(n ? "" : " ");
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
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
+ // src/components/inputs/SearchInput/SearchInput.tsx
11
+ var h = ({ className: e }) => /* @__PURE__ */ m("svg", {
12
+ className: e,
13
+ viewBox: "0 0 20 20",
14
+ fill: "none",
15
+ stroke: "currentColor",
16
+ strokeWidth: "1.8",
17
+ "aria-hidden": "true",
18
+ children: [/* @__PURE__ */ p("circle", {
19
+ cx: "8.5",
20
+ cy: "8.5",
21
+ r: "5.5"
22
+ }), /* @__PURE__ */ p("path", {
23
+ d: "M12.8 12.8L17 17",
24
+ strokeLinecap: "round"
25
+ })]
26
+ }), g = () => typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform ?? "");
27
+ function _(e) {
28
+ let t = g(), n = e.split("+").map((e) => e.trim()).filter(Boolean);
29
+ return e.endsWith("+") && n.push("+"), n.map((e) => {
30
+ let n = e.toLowerCase();
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
+ }).join(t ? "" : " ");
31
33
  }
32
- const oe = Y(
33
- ({
34
- onValueChange: o,
35
- onSearch: n,
36
- debounce: i = 300,
37
- loading: h = !1,
38
- hotkey: r = !1,
39
- showHotkeyHint: t = !0,
40
- onEscape: y = "clear",
41
- searchLabel: L = "Search",
42
- classes: l,
43
- suffix: C,
44
- value: u,
45
- defaultValue: b,
46
- onChange: P,
47
- onClear: R,
48
- onKeyDown: j,
49
- onFocus: K,
50
- onBlur: M,
51
- ...f
52
- }, a) => {
53
- const p = g(null), T = S(
54
- (e) => {
55
- p.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
56
- },
57
- [a]
58
- ), [k, H] = B(() => b == null ? "" : String(b)), x = u != null, v = x ? String(u) : k, D = g(v), w = g(n);
59
- w.current = n;
60
- const s = S((e) => {
61
- D.current !== e && (D.current = e, w.current?.(e));
62
- }, []), E = q(v, i);
63
- Z(() => {
64
- s(E);
65
- }, [E, s]);
66
- const [O, I] = B(!1), W = (e) => {
67
- x || H(e.target.value), P?.(e), o?.(e.target.value);
68
- }, z = () => {
69
- s(""), R?.();
70
- }, A = () => {
71
- const e = p.current;
72
- if (!e) return;
73
- Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), s("");
74
- }, U = (e) => {
75
- j?.(e), !e.defaultPrevented && (e.key === "Enter" ? (e.preventDefault(), s(e.currentTarget.value)) : e.key === "Escape" && y !== "none" && (y === "clear" && e.currentTarget.value.length > 0 ? (e.preventDefault(), A()) : e.currentTarget.blur()));
76
- }, G = S(() => {
77
- p.current?.focus(), p.current?.select();
78
- }, []);
79
- ee(r ? { [r]: G } : {}, { active: !!r, preventDefault: !0 });
80
- const N = !!r && t && v.length === 0 && !O, J = h || N || C ? /* @__PURE__ */ F(X, { children: [
81
- h && /* @__PURE__ */ c($, { size: "sm", label: "Searching", className: m(d.spinner, l?.spinner) }),
82
- N && /* @__PURE__ */ c(V, { size: "sm", className: m(d.hint, l?.hint), "aria-hidden": "true", children: ne(r) }),
83
- C
84
- ] }) : void 0, Q = f["aria-label"] !== void 0 || f["aria-labelledby"] !== void 0;
85
- return /* @__PURE__ */ c(
86
- _,
87
- {
88
- ref: T,
89
- type: "search",
90
- clearable: !0,
91
- prefix: /* @__PURE__ */ c(te, { className: m(d.icon, l?.icon) }),
92
- suffix: J,
93
- value: u,
94
- defaultValue: b,
95
- onChange: W,
96
- onClear: z,
97
- onKeyDown: U,
98
- onFocus: (e) => {
99
- I(!0), K?.(e);
100
- },
101
- onBlur: (e) => {
102
- I(!1), M?.(e);
103
- },
104
- "aria-label": Q ? void 0 : L,
105
- classes: l,
106
- ...f,
107
- className: m(d.root, f.className)
108
- }
109
- );
110
- }
111
- );
112
- oe.displayName = "SearchInput";
113
- export {
114
- oe as SearchInput,
115
- ne as formatHotkey
116
- };
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
+ F.current = e, typeof P == "function" ? P(e) : P && (P.current = e);
37
+ }, [P]), [L, R] = i(() => D == null ? "" : String(D)), z = E != null, B = z ? String(E) : L, V = r(B), H = r(g);
38
+ H.current = g;
39
+ let U = t((e) => {
40
+ V.current !== e && (V.current = e, H.current?.(e));
41
+ }, []), W = u(B, v);
42
+ n(() => {
43
+ U(W);
44
+ }, [W, U]);
45
+ let [G, K] = i(!1), q = (t) => {
46
+ z || R(t.target.value), O?.(t), e?.(t.target.value);
47
+ }, J = () => {
48
+ U(""), k?.();
49
+ }, Y = () => {
50
+ let e = F.current;
51
+ e && ((Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), U(""));
52
+ }, X = (e) => {
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 = t(() => {
55
+ F.current?.focus(), F.current?.select();
56
+ }, []);
57
+ d(b ? { [b]: Z } : {}, {
58
+ active: !!b,
59
+ preventDefault: !0
60
+ });
61
+ let Q = !!b && x && B.length === 0 && !G, $ = y || Q || T ? /* @__PURE__ */ m(f, { children: [
62
+ y && /* @__PURE__ */ p(c, {
63
+ size: "sm",
64
+ label: "Searching",
65
+ className: a(o.spinner, w?.spinner)
66
+ }),
67
+ Q && /* @__PURE__ */ p(l, {
68
+ size: "sm",
69
+ className: a(o.hint, w?.hint),
70
+ "aria-hidden": "true",
71
+ children: _(b)
72
+ }),
73
+ T
74
+ ] }) : void 0, ee = N["aria-label"] !== void 0 || N["aria-labelledby"] !== void 0;
75
+ return /* @__PURE__ */ p(s, {
76
+ ref: I,
77
+ type: "search",
78
+ clearable: !0,
79
+ prefix: /* @__PURE__ */ p(h, { className: a(o.icon, w?.icon) }),
80
+ suffix: $,
81
+ value: E,
82
+ defaultValue: D,
83
+ onChange: q,
84
+ onClear: J,
85
+ onKeyDown: X,
86
+ onFocus: (e) => {
87
+ K(!0), j?.(e);
88
+ },
89
+ onBlur: (e) => {
90
+ K(!1), M?.(e);
91
+ },
92
+ "aria-label": ee ? void 0 : C,
93
+ classes: w,
94
+ ...N,
95
+ className: a(o.root, N.className)
96
+ });
97
+ });
98
+ v.displayName = "SearchInput";
99
+ export { v as SearchInput, _ as formatHotkey };
@@ -1,13 +1,8 @@
1
- const n = "crk-root-J798f", o = "crk-icon-qlYVE", t = "crk-spinner-2Q0Ra", c = "crk-hint-V22-E", r = {
2
- root: n,
3
- icon: o,
4
- spinner: t,
5
- hint: c
6
- };
7
- export {
8
- r as default,
9
- c as hint,
10
- o as icon,
11
- n as root,
12
- t as spinner
1
+ // src/components/inputs/SearchInput/SearchInput.module.scss
2
+ var e = "crk-root-J798f", t = "crk-icon-qlYVE", n = "crk-spinner-2Q0Ra", r = "crk-hint-V22-E", i = {
3
+ root: e,
4
+ icon: t,
5
+ spinner: n,
6
+ hint: r
13
7
  };
8
+ export { i as default, r as hint, t as icon, e as root, n as spinner };
@@ -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>>;