@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.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- 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
|
|
1430
|
-
- `closeOnSelect?: boolean` — default `true
|
|
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
|
-
- `
|
|
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
package/utils/formatBytes.js
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 };
|
package/utils/themeScript.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
11
|
-
|
|
32
|
+
function t(e) {
|
|
33
|
+
return e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime();
|
|
12
34
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
function r(e) {
|
|
47
|
+
let t = Math.abs(e);
|
|
48
|
+
return t < 6e4 ? 1e3 : t < 36e5 ? 3e4 : 6e4;
|
|
23
49
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 };
|