@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
package/llms.txt CHANGED
@@ -1049,6 +1049,8 @@ Element: a `<div>` root (forwards ref); the track is `role="progressbar"` with `
1049
1049
  - `segments?: number` — when `> 1`, N discrete blocks filled from the left (`round(value / max * segments)`); wizard-step progress.
1050
1050
  - `showCurrent?: boolean` — default `false`. Segmented only: the block after the last filled one gets a mid shade → three states (done / current / remaining; `value` = steps completed).
1051
1051
  - `shape?: 'rounded' | 'square'` — default `'rounded'`. `'square'` removes every radius (flat survey/wizard strip).
1052
+ - `onSegmentClick?: (index: number, event: MouseEvent<HTMLButtonElement>) => void` — segmented only. Each block becomes a `<button type="button">` (hover tint, focus ring) and the callback receives its zero-based index → jump-to-step. The track becomes `role="group"` (keeps the `aria-label`) instead of `role="progressbar"`, since progressbar children are presentational; the current step (with `showCurrent`) gets `aria-current="step"`.
1053
+ - `segmentLabel?: (index: number, segments: number) => string` — accessible name per clickable segment. Default `` `Step ${index + 1} of ${segments}` ``.
1052
1054
  - `classes?: Partial<ProgressBarClasses>` where `ProgressBarClasses = { root, header, label, value, track, fill, segment, segmentFilled, segmentCurrent }`.
1053
1055
  CSS vars: `--crk-progress-fill`, `--crk-progress-track`, `--crk-progress-height`.
1054
1056
 
@@ -1057,6 +1059,7 @@ CSS vars: `--crk-progress-fill`, `--crk-progress-track`, `--crk-progress-height`
1057
1059
  <ProgressBar value={level} thresholds={[{ value: 0, variant: 'danger' }, { value: 20, variant: 'warning' }, { value: 50, variant: 'success' }]} />
1058
1060
  <ProgressBar value={2} max={5} segments={5} size="lg" />
1059
1061
  <ProgressBar value={2} max={4} segments={4} showCurrent shape="square" aria-label="Step 3 of 4" /> // done · current · remaining
1062
+ <ProgressBar value={done} max={4} segments={4} showCurrent onSegmentClick={(i) => goToStep(i)} /> // clickable steps
1060
1063
  <ProgressBar label="Working…" /> // indeterminate
1061
1064
  ```
1062
1065
 
@@ -1412,7 +1415,7 @@ Import: `import { Select } from '@overdoser/react-toolkit'`
1412
1415
  Three internal modes, picked automatically:
1413
1416
  1. **Native** (default) — wraps `<select>`.
1414
1417
  2. **Searchable** — set `searchable`. Custom dropdown with text filter.
1415
- 3. **Multi** — set `multiple`. Chip-based multi-select with text filter.
1418
+ 3. **Multi** — set `multiple`. Chip-based multi-select with text filter. Add `checklist` for the AWS-console style picker (see below).
1416
1419
 
1417
1420
  Props:
1418
1421
  - `inputSize?: 'sm' | 'md' | 'lg'` — default `'md'`. Toolkit size scale.
@@ -1426,8 +1429,8 @@ Props:
1426
1429
  - `onChange?: (e: ChangeEvent<HTMLSelectElement>) => void` — fires for native + searchable (synthetic for searchable).
1427
1430
  - `onValueChange?: (value: string) => void` — single-mode value-only callback.
1428
1431
  - `onValuesChange?: (values: string[]) => void` — multi-mode callback.
1429
- - `clearSearchOnSelect?: boolean` — default `true`. Multi-mode only.
1430
- - `closeOnSelect?: boolean` — default `true`. Multi-mode only. The menu closes after each add/remove (and after a `Create` row click). Set to `false` for the "stay open until done" pattern when picking many values rapidly.
1432
+ - `clearSearchOnSelect?: boolean` — default `true` (`false` with `checklist`). Multi-mode only.
1433
+ - `closeOnSelect?: boolean` — default `true` (`false` with `checklist`). Multi-mode only. The menu closes after each add/remove (and after a `Create` row click). Set to `false` for the "stay open until done" pattern when picking many values rapidly.
1431
1434
  - `allowCreate?: boolean` — default `false`. Multi-mode only. Adds a "Create '<query>'" row when the search query doesn't match an existing option. Pressing Enter (or clicking the row) pushes the trimmed query into `onValuesChange` and fires `onCreate`.
1432
1435
  - `onCreate?: (value: string) => void` — Multi-mode only, paired with `allowCreate`. Fires with the new value; consumers typically persist it (e.g. push it back into `options`).
1433
1436
  - `createLabel?: (query: string) => ReactNode` — Multi-mode only. Custom render for the create row. Default: `Create "<query>"`.
@@ -1438,7 +1441,10 @@ Props:
1438
1441
  - `noResultsMessage?: ReactNode` — default `'No results'`.
1439
1442
  - `highlightMatches?: boolean` — default `false`. Local filter mode: the matched substring of string labels is wrapped in `<mark>` (semibold, inherits colour).
1440
1443
  - `selectedLabels?: Record<string, ReactNode>` — fallback label per value when its option isn't in `options` any more (remote results moved on, `allowCreate`). Keeps chips / the trigger labelled.
1441
- - `classes?: Partial<SelectClasses>` where `SelectClasses = { wrapper, root, arrow, search, menu, item, chip, chipRemove, spinner, match, message }`
1444
+ - `checklist?: boolean` — default `false`. Multi-mode only. Picker for selecting many values while filtering (the AWS CloudWatch log-group pattern): the search box moves into the menu, every row gets a checkbox, chips show the plain `label` (a rich `content` is used only in the menu rows), and selected options stay listed when they don't match the query, in their `options` order. A row unchecked while filtered stays put until the query changes, so nothing jumps under the pointer. A header offers "Select all" (every matching, enabled option, not the rows kept only because they were selected; reads "Select all matching" while a query is typed) and "Deselect all" (keeps values of disabled options). The menu stays open while picking; a click outside, Escape (focus returns to the trigger) or Tab past the last header action closes it. The trigger is a `<button role="combobox">` that takes `id`; ArrowDown opens it, Backspace removes the last value. Selected values missing from `options` (remote results that moved on) are listed last, labelled from `selectedLabels`.
1445
+ - `selectAllLabel?: ReactNode` — default `'Select all'` / `'Select all matching'`. `deselectAllLabel?: ReactNode` — default `'Deselect all'`. Checklist mode.
1446
+ - `maxVisibleChips?: number` — Multi-mode only. At most N chips in the control, then a "+N more" chip whose `title` lists the rest. `moreChipsLabel?: (hiddenCount) => ReactNode` — default `` (n) => `+${n} more` ``.
1447
+ - `classes?: Partial<SelectClasses>` where `SelectClasses = { wrapper, root, arrow, search, menu, item, chip, chipRemove, spinner, match, message, checkbox, menuHeader, menuAction, moreChip }` (`search` is the menu search box in checklist mode)
1442
1448
  - Native props in searchable/multi modes: `name` and `form` go to a hidden native `<select>`, so the value is submitted with native `FormData` (multi submits one entry per value, including `allowCreate` values not yet in `options`). `aria-*`, `data-*`, `title`, `autoFocus`, `tabIndex` go to the visible control; `required` becomes `aria-required` there (no native constraint validation — validate through `FormField` rules). While a searchable Select is open, its search input carries the same `aria-*` props and takes over `id`, so `<label htmlFor>` keeps naming the focused element. `onFocus` / `onBlur` fire when focus enters / leaves the whole widget (trigger, search input and portaled menu count as inside), so blur-based `FormField` validation works.
1443
1449
 
1444
1450
  Searchable example:
@@ -1462,6 +1468,24 @@ Multi example:
1462
1468
  />
1463
1469
  ```
1464
1470
 
1471
+ Checklist example (two-line rows via `content`; `label` is the filter text and the chip text):
1472
+ ```tsx
1473
+ <Select
1474
+ multiple
1475
+ checklist
1476
+ maxVisibleChips={3}
1477
+ options={logGroups.map(g => ({
1478
+ value: g.arn,
1479
+ label: g.name,
1480
+ content: <div><div>{g.name}</div><small>{g.class} · {g.account}</small></div>,
1481
+ }))}
1482
+ value={selected}
1483
+ onValuesChange={setSelected}
1484
+ placeholder="Select log groups"
1485
+ searchPlaceholder="Filter log groups"
1486
+ />
1487
+ ```
1488
+
1465
1489
  Async (remote) search — no separate Combobox needed:
1466
1490
  ```tsx
1467
1491
  <Select searchable options={results} loading={isFetching} onSearch={fetchUsers}
package/manifest.json CHANGED
@@ -1713,6 +1713,14 @@
1713
1713
  "shape": {
1714
1714
  "type": "'rounded' | 'square'",
1715
1715
  "default": "rounded"
1716
+ },
1717
+ "onSegmentClick": {
1718
+ "type": "(index: number, event: MouseEvent<HTMLButtonElement>) => void",
1719
+ "notes": "Segmented only: each block becomes a button; callback gets the zero-based index. Track switches to role=group; current step gets aria-current=step."
1720
+ },
1721
+ "segmentLabel": {
1722
+ "type": "(index: number, segments: number) => string",
1723
+ "notes": "Accessible name per clickable segment. Default `Step ${index + 1} of ${segments}`."
1716
1724
  }
1717
1725
  }
1718
1726
  },
@@ -3703,7 +3711,8 @@
3703
3711
  "modes": {
3704
3712
  "native": "Default — wraps a native <select>.",
3705
3713
  "searchable": "When `searchable=true`. Custom dropdown with text filter.",
3706
- "multi": "When `multiple=true`. Chip-based multi with text filter."
3714
+ "multi": "When `multiple=true`. Chip-based multi with text filter.",
3715
+ "checklist": "When `multiple` + `checklist`. AWS-console style picker: search inside the menu, a checkbox per row, selected rows stay listed while filtering, Select all / Deselect all header, stays open until outside click / Escape / Tab."
3707
3716
  },
3708
3717
  "props": {
3709
3718
  "inputSize": {
@@ -3756,12 +3765,12 @@
3756
3765
  },
3757
3766
  "clearSearchOnSelect": {
3758
3767
  "type": "boolean",
3759
- "default": true,
3768
+ "default": "true (false with checklist)",
3760
3769
  "notes": "Multi-mode only."
3761
3770
  },
3762
3771
  "closeOnSelect": {
3763
3772
  "type": "boolean",
3764
- "default": true,
3773
+ "default": "true (false with checklist)",
3765
3774
  "notes": "Multi-mode only. Menu closes after each add/remove/create. Set false for the stay-open pattern."
3766
3775
  },
3767
3776
  "allowCreate": {
@@ -3795,7 +3804,11 @@
3795
3804
  "chipRemove",
3796
3805
  "spinner",
3797
3806
  "match",
3798
- "message"
3807
+ "message",
3808
+ "checkbox",
3809
+ "menuHeader",
3810
+ "menuAction",
3811
+ "moreChip"
3799
3812
  ]
3800
3813
  },
3801
3814
  "onSearch": {
@@ -3834,6 +3847,30 @@
3834
3847
  "selectedLabels": {
3835
3848
  "type": "Record<string, ReactNode>",
3836
3849
  "notes": "Fallback label per value when its option is absent from options."
3850
+ },
3851
+ "checklist": {
3852
+ "type": "boolean",
3853
+ "default": false,
3854
+ "notes": "Multi-mode only. Search moves into the menu, every row gets a checkbox, chips show the plain label (content only in menu rows), selected options stay listed (in options order) when they don't match the query; a row unchecked while filtered stays until the query changes. Header: Select all (every matching enabled option) / Deselect all (keeps values of disabled options). Selected values missing from options (remote) are listed last, labelled from selectedLabels."
3855
+ },
3856
+ "selectAllLabel": {
3857
+ "type": "ReactNode",
3858
+ "default": "query ? 'Select all matching' : 'Select all'",
3859
+ "notes": "Checklist mode."
3860
+ },
3861
+ "deselectAllLabel": {
3862
+ "type": "ReactNode",
3863
+ "default": "Deselect all",
3864
+ "notes": "Checklist mode."
3865
+ },
3866
+ "maxVisibleChips": {
3867
+ "type": "number",
3868
+ "notes": "Multi-mode only. Show at most N chips, then a '+N more' chip whose title lists the rest. Unlimited when omitted."
3869
+ },
3870
+ "moreChipsLabel": {
3871
+ "type": "(hiddenCount: number) => ReactNode",
3872
+ "default": "(n) => `+${n} more`",
3873
+ "notes": "Multi-mode only. Text of the overflow chip."
3837
3874
  }
3838
3875
  }
3839
3876
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overdoser/react-toolkit",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "homepage": "https://react-toolkit.overdoser.org",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -1,14 +1,30 @@
1
- const u = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], g = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"];
2
- function f(t, B = {}) {
3
- const { decimals: c = 1, base: n = 1024, iec: a = !1, locale: m } = B;
4
- if (!Number.isFinite(t)) return "—";
5
- const e = n === 1024 && a ? g : u, r = t < 0 ? "-" : "";
6
- let s = Math.abs(t), i = 0;
7
- for (; s >= n && i < e.length - 1; )
8
- s /= n, i++;
9
- const o = i === 0 ? 0 : Math.max(0, c), l = s.toLocaleString(m, { minimumFractionDigits: o, maximumFractionDigits: o });
10
- return `${r}${l} ${e[i]}`;
1
+ // src/utils/formatBytes.ts
2
+ var e = [
3
+ "B",
4
+ "KB",
5
+ "MB",
6
+ "GB",
7
+ "TB",
8
+ "PB",
9
+ "EB"
10
+ ], t = [
11
+ "B",
12
+ "KiB",
13
+ "MiB",
14
+ "GiB",
15
+ "TiB",
16
+ "PiB",
17
+ "EiB"
18
+ ];
19
+ function n(n, r = {}) {
20
+ let { decimals: i = 1, base: a = 1024, iec: o = !1, locale: s } = r;
21
+ if (!Number.isFinite(n)) return "—";
22
+ let c = a === 1024 && o ? t : e, l = n < 0 ? "-" : "", u = Math.abs(n), d = 0;
23
+ for (; u >= a && d < c.length - 1;) u /= a, d++;
24
+ let f = d === 0 ? 0 : Math.max(0, i);
25
+ return `${l}${u.toLocaleString(s, {
26
+ minimumFractionDigits: f,
27
+ maximumFractionDigits: f
28
+ })} ${c[d]}`;
11
29
  }
12
- export {
13
- f as formatBytes
14
- };
30
+ export { n as formatBytes };
@@ -1,9 +1,7 @@
1
- function c(t = {}) {
2
- const e = JSON.stringify(t.storageKey ?? "crk-theme"), r = JSON.stringify(t.attribute ?? "data-theme"), a = JSON.stringify(t.defaultTheme ?? "system");
3
- return "(function(){var k=" + e + ",a=" + r + ",f=" + a + ',v=null;try{v=localStorage.getItem(k);if(v){try{v=JSON.parse(v)}catch(e){}}}catch(e){}try{document.documentElement.setAttribute(a,v==="dark"||v==="light"||v==="system"?v:f)}catch(e){}})();';
1
+ // src/utils/themeScript.ts
2
+ function e(e = {}) {
3
+ let t = JSON.stringify(e.storageKey ?? "crk-theme"), n = JSON.stringify(e.attribute ?? "data-theme"), r = JSON.stringify(e.defaultTheme ?? "system");
4
+ return "(function(){var k=" + t + ",a=" + n + ",f=" + r + ",v=null;try{v=localStorage.getItem(k);if(v){try{v=JSON.parse(v)}catch(e){}}}catch(e){}try{document.documentElement.setAttribute(a,v===\"dark\"||v===\"light\"||v===\"system\"?v:f)}catch(e){}})();";
4
5
  }
5
- const n = c();
6
- export {
7
- n as THEME_INIT_SCRIPT,
8
- c as getThemeInitScript
9
- };
6
+ var t = e();
7
+ export { t as THEME_INIT_SCRIPT, e as getThemeInitScript };
package/utils/timeAgo.js CHANGED
@@ -1,37 +1,64 @@
1
- const f = [
2
- { unit: "year", ms: 31536e6 },
3
- { unit: "month", ms: 2592e6 },
4
- { unit: "week", ms: 6048e5 },
5
- { unit: "day", ms: 864e5 },
6
- { unit: "hour", ms: 36e5 },
7
- { unit: "minute", ms: 6e4 },
8
- { unit: "second", ms: 1e3 }
1
+ // src/utils/timeAgo.ts
2
+ var e = [
3
+ {
4
+ unit: "year",
5
+ ms: 31536e6
6
+ },
7
+ {
8
+ unit: "month",
9
+ ms: 2592e6
10
+ },
11
+ {
12
+ unit: "week",
13
+ ms: 6048e5
14
+ },
15
+ {
16
+ unit: "day",
17
+ ms: 864e5
18
+ },
19
+ {
20
+ unit: "hour",
21
+ ms: 36e5
22
+ },
23
+ {
24
+ unit: "minute",
25
+ ms: 6e4
26
+ },
27
+ {
28
+ unit: "second",
29
+ ms: 1e3
30
+ }
9
31
  ];
10
- function l(t) {
11
- return t instanceof Date ? t.getTime() : typeof t == "number" ? t : new Date(t).getTime();
32
+ function t(e) {
33
+ return e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime();
12
34
  }
13
- function h(t) {
14
- const e = Math.abs(t);
15
- for (const n of f)
16
- if (e >= n.ms || n.unit === "second")
17
- return { unit: n.unit, value: Math.sign(t) * Math.round(e / n.ms) };
18
- return { unit: "second", value: 0 };
35
+ function n(t) {
36
+ let n = Math.abs(t);
37
+ for (let r of e) if (n >= r.ms || r.unit === "second") return {
38
+ unit: r.unit,
39
+ value: Math.sign(t) * Math.round(n / r.ms)
40
+ };
41
+ return {
42
+ unit: "second",
43
+ value: 0
44
+ };
19
45
  }
20
- function b(t) {
21
- const e = Math.abs(t);
22
- return e < 6e4 ? 1e3 : e < 36e5 ? 3e4 : 6e4;
46
+ function r(e) {
47
+ let t = Math.abs(e);
48
+ return t < 6e4 ? 1e3 : t < 36e5 ? 3e4 : 6e4;
23
49
  }
24
- function d(t, e = {}) {
25
- const { now: n = Date.now(), locale: r, format: i = "long", numeric: o = "auto", maxAge: u } = e, s = l(t);
26
- if (!Number.isFinite(s)) return null;
27
- const a = s - n;
28
- if (u !== void 0 && Math.abs(a) > u) return null;
29
- const { unit: m, value: c } = h(a);
30
- return m === "second" && Math.abs(c) < 5 && o === "auto" ? new Intl.RelativeTimeFormat(r, { style: i, numeric: "auto" }).format(0, "second") : new Intl.RelativeTimeFormat(r, { style: i, numeric: o }).format(c, m);
50
+ function i(e, r = {}) {
51
+ let { now: i = Date.now(), locale: a, format: o = "long", numeric: s = "auto", maxAge: c } = r, l = t(e);
52
+ if (!Number.isFinite(l)) return null;
53
+ let u = l - i;
54
+ if (c !== void 0 && Math.abs(u) > c) return null;
55
+ let { unit: d, value: f } = n(u);
56
+ return d === "second" && Math.abs(f) < 5 && s === "auto" ? new Intl.RelativeTimeFormat(a, {
57
+ style: o,
58
+ numeric: "auto"
59
+ }).format(0, "second") : new Intl.RelativeTimeFormat(a, {
60
+ style: o,
61
+ numeric: s
62
+ }).format(f, d);
31
63
  }
32
- export {
33
- b as refreshIntervalFor,
34
- h as relativeParts,
35
- d as timeAgo,
36
- l as toTimestamp
37
- };
64
+ export { r as refreshIntervalFor, n as relativeParts, i as timeAgo, t as toTimestamp };