@overdoser/react-toolkit 0.18.0 → 0.19.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 +51 -7
- package/CHANGELOG.md +129 -0
- package/components/Accordion/Accordion.d.ts +94 -0
- package/components/Accordion/Accordion.js +180 -0
- package/components/Accordion/Accordion.module.scss.js +36 -0
- package/components/Accordion/index.d.ts +2 -0
- package/components/Alert/Alert.d.ts +29 -1
- package/components/Alert/Alert.js +44 -30
- package/components/Alert/Alert.module.scss.js +24 -16
- package/components/Alert/index.d.ts +1 -1
- package/components/Card/Card.d.ts +86 -0
- package/components/Card/Card.js +132 -0
- package/components/Card/Card.module.scss.js +60 -0
- package/components/Card/index.d.ts +2 -0
- package/components/Chip/Chip.d.ts +86 -0
- package/components/Chip/Chip.js +141 -0
- package/components/Chip/Chip.module.scss.js +59 -0
- package/components/Chip/index.d.ts +2 -0
- package/components/CodeBlock/CodeBlock.d.ts +78 -0
- package/components/CodeBlock/CodeBlock.js +120 -0
- package/components/CodeBlock/CodeBlock.module.scss.js +43 -0
- package/components/CodeBlock/index.d.ts +2 -0
- package/components/CommandPalette/CommandPalette.d.ts +141 -0
- package/components/CommandPalette/CommandPalette.js +397 -0
- package/components/CommandPalette/CommandPalette.module.scss.js +49 -0
- package/components/CommandPalette/index.d.ts +2 -0
- package/components/ConfirmDialog/ConfirmDialog.d.ts +119 -0
- package/components/ConfirmDialog/ConfirmDialog.js +201 -0
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +21 -0
- package/components/ConfirmDialog/index.d.ts +2 -0
- package/components/Drawer/Drawer.d.ts +1 -0
- package/components/Drawer/Drawer.js +35 -36
- package/components/Drawer/Drawer.module.scss.js +20 -18
- package/components/Dropdown/Dropdown.d.ts +47 -7
- package/components/Dropdown/Dropdown.js +174 -81
- package/components/Dropdown/Dropdown.module.scss.js +40 -22
- package/components/Dropdown/DropdownItem.d.ts +31 -2
- package/components/Dropdown/DropdownItem.js +54 -27
- package/components/Dropdown/DropdownLabel.d.ts +11 -0
- package/components/Dropdown/DropdownLabel.js +11 -0
- package/components/Dropdown/DropdownSeparator.d.ts +12 -0
- package/components/Dropdown/DropdownSeparator.js +11 -0
- package/components/Dropdown/dropdownContext.d.ts +6 -0
- package/components/Dropdown/dropdownContext.js +5 -0
- package/components/Dropdown/index.d.ts +8 -2
- package/components/Dropdown/useContextMenu.d.ts +32 -0
- package/components/Dropdown/useContextMenu.js +18 -0
- package/components/EmptyState/EmptyState.d.ts +53 -0
- package/components/EmptyState/EmptyState.js +55 -0
- package/components/EmptyState/EmptyState.module.scss.js +25 -0
- package/components/EmptyState/index.d.ts +2 -0
- package/components/Form/FormField.js +25 -24
- package/components/ImageViewer/ImageViewer.d.ts +105 -0
- package/components/ImageViewer/ImageViewer.js +201 -0
- package/components/ImageViewer/ImageViewer.module.scss.js +47 -0
- package/components/ImageViewer/index.d.ts +4 -0
- package/components/ImageViewer/useZoomPan.d.ts +94 -0
- package/components/ImageViewer/useZoomPan.js +141 -0
- package/components/Kbd/Kbd.d.ts +26 -0
- package/components/Kbd/Kbd.js +22 -0
- package/components/Kbd/Kbd.module.scss.js +17 -0
- package/components/Kbd/index.d.ts +2 -0
- package/components/KeyValueList/KeyValueList.d.ts +84 -0
- package/components/KeyValueList/KeyValueList.js +127 -0
- package/components/KeyValueList/KeyValueList.module.scss.js +43 -0
- package/components/KeyValueList/index.d.ts +2 -0
- package/components/Modal/Modal.d.ts +1 -0
- package/components/Modal/Modal.js +40 -41
- package/components/Modal/Modal.module.scss.js +18 -16
- package/components/PageHeader/PageHeader.d.ts +61 -0
- package/components/PageHeader/PageHeader.js +73 -0
- package/components/PageHeader/PageHeader.module.scss.js +43 -0
- package/components/PageHeader/index.d.ts +2 -0
- package/components/ProgressBar/ProgressBar.d.ts +74 -0
- package/components/ProgressBar/ProgressBar.js +90 -0
- package/components/ProgressBar/ProgressBar.module.scss.js +51 -0
- package/components/ProgressBar/index.d.ts +2 -0
- package/components/RelativeTime/RelativeTime.d.ts +45 -0
- package/components/RelativeTime/RelativeTime.js +43 -0
- package/components/RelativeTime/RelativeTime.module.scss.js +7 -0
- package/components/RelativeTime/index.d.ts +2 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +84 -0
- package/components/SegmentedControl/SegmentedControl.js +131 -0
- package/components/SegmentedControl/SegmentedControl.module.scss.js +39 -0
- package/components/SegmentedControl/index.d.ts +2 -0
- package/components/SplitPane/SplitPane.d.ts +61 -0
- package/components/SplitPane/SplitPane.js +171 -0
- package/components/SplitPane/SplitPane.module.scss.js +25 -0
- package/components/SplitPane/index.d.ts +2 -0
- package/components/StatCard/StatCard.d.ts +105 -0
- package/components/StatCard/StatCard.js +127 -0
- package/components/StatCard/StatCard.module.scss.js +72 -0
- package/components/StatCard/index.d.ts +2 -0
- package/components/StatusDot/StatusDot.d.ts +33 -0
- package/components/StatusDot/StatusDot.js +39 -0
- package/components/StatusDot/StatusDot.module.scss.js +32 -0
- package/components/StatusDot/index.d.ts +2 -0
- package/components/Table/Table.d.ts +100 -2
- package/components/Table/Table.js +371 -210
- package/components/Table/Table.module.scss.js +68 -46
- package/components/Table/index.d.ts +1 -1
- package/components/ThemeToggle/ThemeToggle.d.ts +38 -0
- package/components/ThemeToggle/ThemeToggle.js +97 -0
- package/components/ThemeToggle/ThemeToggle.module.scss.js +23 -0
- package/components/ThemeToggle/index.d.ts +2 -0
- package/components/inputs/Checkbox/Checkbox.d.ts +2 -0
- package/components/inputs/Checkbox/Checkbox.js +29 -28
- package/components/inputs/Checkbox/Checkbox.module.scss.js +8 -6
- package/components/inputs/Input/Input.d.ts +33 -1
- package/components/inputs/Input/Input.js +94 -35
- package/components/inputs/Input/Input.module.scss.js +14 -12
- package/components/inputs/Radio/Radio.d.ts +5 -4
- package/components/inputs/Radio/Radio.js +55 -50
- package/components/inputs/Radio/Radio.module.scss.js +12 -10
- package/components/inputs/SearchInput/SearchInput.d.ts +57 -0
- package/components/inputs/SearchInput/SearchInput.js +116 -0
- package/components/inputs/SearchInput/SearchInput.module.scss.js +13 -0
- package/components/inputs/SearchInput/index.d.ts +2 -0
- package/components/inputs/Select/Select.d.ts +52 -0
- package/components/inputs/Select/Select.js +494 -385
- package/components/inputs/Select/Select.module.scss.js +34 -30
- package/components/inputs/Switch/Switch.d.ts +15 -0
- package/components/inputs/Switch/Switch.js +8 -0
- package/components/inputs/Switch/index.d.ts +2 -0
- package/hooks/useDebouncedValue.d.ts +15 -0
- package/hooks/useDebouncedValue.js +15 -0
- package/hooks/useElementSize.d.ts +20 -0
- package/hooks/useElementSize.js +23 -0
- package/hooks/useKeyboard.d.ts +49 -5
- package/hooks/useKeyboard.js +66 -16
- package/hooks/useMediaQuery.d.ts +14 -0
- package/hooks/useMediaQuery.js +16 -0
- package/hooks/useNow.d.ts +14 -0
- package/hooks/useNow.js +35 -0
- package/hooks/usePersistedState.d.ts +30 -0
- package/hooks/usePersistedState.js +96 -0
- package/hooks/useResizable.d.ts +66 -0
- package/hooks/useResizable.js +105 -0
- package/hooks/useTheme.d.ts +33 -0
- package/hooks/useTheme.js +27 -0
- package/index.css +1 -1
- package/index.d.ts +58 -4
- package/index.js +208 -132
- package/index.layered.css +1 -1
- package/llms.txt +619 -25
- package/manifest.json +1739 -91
- package/package.json +1 -1
- package/recipes/confirm-modal.tsx +65 -53
- package/recipes/floating-copy-button.tsx +32 -28
- package/utils/formatBytes.d.ts +21 -0
- package/utils/formatBytes.js +14 -0
- package/utils/index.d.ts +6 -0
- package/utils/themeScript.d.ts +17 -0
- package/utils/themeScript.js +9 -0
- package/utils/timeAgo.d.ts +33 -0
- package/utils/timeAgo.js +37 -0
|
@@ -1,59 +1,81 @@
|
|
|
1
|
-
const
|
|
2
|
-
wrapper:
|
|
1
|
+
const e = "crk-wrapper-zxjMt", r = "crk-scrollable-Apjbs", t = "crk-root-Gf85-", o = "crk-paginator-UlYIY", c = "crk-dragging-dAaIR", l = "crk-headerCell-ePPZW", a = "crk-headerCellSticky-Qwz3q", s = "crk-cellSticky-LwmbD", n = "crk-headerCellSortable-NMybk", k = "crk-sortIndicator-WGD2S", i = "crk-sortArrow-1-ok4", p = "crk-sortArrowActive-yhWrO", d = "crk-sortIndex-HGoca", g = "crk-row-H0wL1", b = "crk-cell-ZfnbG", w = "crk-emptyRow-AoPfj", u = "crk-emptyCell-99-7C", C = "crk-loaderWrap-Bug3B", S = "crk-loadingRow-i25F2", y = "crk-rowClickable--9VTD", A = "crk-rowSelected-ucID4", h = "crk-hoverable-ljU9B", B = "crk-selectHeaderCell-sK1ej", m = "crk-selectCell-4A3ho", v = "crk-layoutFixed-PUK1R", I = "crk-bulkBar-OPem5", x = "crk-bulkLabel-Z5fZQ", f = "crk-bulkClear--wKbf", R = "crk-bulkActions-jm9bq", W = "crk-striped-6Qckq", j = "crk-compact-2-UWr", D = "crk-paginatorInfo-BVca4", P = "crk-paginatorText-sqWS0", q = "crk-pageSizeSelect-yhqJQ", z = "crk-paginatorNav-MDSui", H = "crk-pageButton-1PX-g", L = "crk-pageButtonActive--D7Q7", Q = "crk-pageEllipsis-en59J", F = {
|
|
2
|
+
wrapper: e,
|
|
3
3
|
scrollable: r,
|
|
4
|
-
root:
|
|
4
|
+
root: t,
|
|
5
5
|
paginator: o,
|
|
6
6
|
dragging: c,
|
|
7
|
-
headerCell:
|
|
8
|
-
headerCellSticky:
|
|
9
|
-
cellSticky:
|
|
10
|
-
headerCellSortable:
|
|
11
|
-
sortIndicator:
|
|
7
|
+
headerCell: l,
|
|
8
|
+
headerCellSticky: a,
|
|
9
|
+
cellSticky: s,
|
|
10
|
+
headerCellSortable: n,
|
|
11
|
+
sortIndicator: k,
|
|
12
12
|
sortArrow: i,
|
|
13
|
-
sortArrowActive:
|
|
14
|
-
sortIndex:
|
|
15
|
-
row:
|
|
16
|
-
cell:
|
|
17
|
-
emptyRow:
|
|
18
|
-
emptyCell:
|
|
19
|
-
|
|
13
|
+
sortArrowActive: p,
|
|
14
|
+
sortIndex: d,
|
|
15
|
+
row: g,
|
|
16
|
+
cell: b,
|
|
17
|
+
emptyRow: w,
|
|
18
|
+
emptyCell: u,
|
|
19
|
+
loaderWrap: C,
|
|
20
|
+
loadingRow: S,
|
|
21
|
+
rowClickable: y,
|
|
22
|
+
rowSelected: A,
|
|
20
23
|
hoverable: h,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
selectHeaderCell: B,
|
|
25
|
+
selectCell: m,
|
|
26
|
+
layoutFixed: v,
|
|
27
|
+
bulkBar: I,
|
|
28
|
+
bulkLabel: x,
|
|
29
|
+
bulkClear: f,
|
|
30
|
+
bulkActions: R,
|
|
31
|
+
striped: W,
|
|
32
|
+
compact: j,
|
|
33
|
+
paginatorInfo: D,
|
|
34
|
+
paginatorText: P,
|
|
35
|
+
pageSizeSelect: q,
|
|
36
|
+
paginatorNav: z,
|
|
37
|
+
pageButton: H,
|
|
38
|
+
pageButtonActive: L,
|
|
39
|
+
pageEllipsis: Q
|
|
29
40
|
};
|
|
30
41
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
R as bulkActions,
|
|
43
|
+
I as bulkBar,
|
|
44
|
+
f as bulkClear,
|
|
45
|
+
x as bulkLabel,
|
|
46
|
+
b as cell,
|
|
47
|
+
s as cellSticky,
|
|
48
|
+
j as compact,
|
|
49
|
+
F as default,
|
|
35
50
|
c as dragging,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
u as emptyCell,
|
|
52
|
+
w as emptyRow,
|
|
53
|
+
l as headerCell,
|
|
54
|
+
n as headerCellSortable,
|
|
55
|
+
a as headerCellSticky,
|
|
41
56
|
h as hoverable,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
v as layoutFixed,
|
|
58
|
+
C as loaderWrap,
|
|
59
|
+
S as loadingRow,
|
|
60
|
+
H as pageButton,
|
|
61
|
+
L as pageButtonActive,
|
|
62
|
+
Q as pageEllipsis,
|
|
63
|
+
q as pageSizeSelect,
|
|
46
64
|
o as paginator,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
D as paginatorInfo,
|
|
66
|
+
z as paginatorNav,
|
|
67
|
+
P as paginatorText,
|
|
68
|
+
t as root,
|
|
69
|
+
g as row,
|
|
70
|
+
y as rowClickable,
|
|
71
|
+
A as rowSelected,
|
|
52
72
|
r as scrollable,
|
|
73
|
+
m as selectCell,
|
|
74
|
+
B as selectHeaderCell,
|
|
53
75
|
i as sortArrow,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
p as sortArrowActive,
|
|
77
|
+
d as sortIndex,
|
|
78
|
+
k as sortIndicator,
|
|
79
|
+
W as striped,
|
|
80
|
+
e as wrapper
|
|
59
81
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Table } from './Table';
|
|
2
|
-
export type { TableProps, TableClasses, ColumnDef, PaginationConfig } from './Table';
|
|
2
|
+
export type { TableProps, TableClasses, ColumnDef, PaginationConfig, TableRowKey, TableBulkActionsContext } from './Table';
|
|
3
3
|
export { useTableSort } from './useTableSort';
|
|
4
4
|
export type { SortConfig } from './useTableSort';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { Theme } from '../../hooks/useTheme';
|
|
3
|
+
export interface ThemeToggleClasses {
|
|
4
|
+
root: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
label: string;
|
|
7
|
+
option: string;
|
|
8
|
+
optionSelected: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ThemeToggleProps extends Omit<ComponentPropsWithRef<'button'>, 'onChange'> {
|
|
11
|
+
/** Offer "system" (follow the OS) as a third state. @default true */
|
|
12
|
+
allowSystem?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* `'icon'`: one button cycling light → dark → system.
|
|
15
|
+
* `'segmented'`: a radiogroup with one option per theme.
|
|
16
|
+
* @default 'icon'
|
|
17
|
+
*/
|
|
18
|
+
variant?: 'icon' | 'segmented';
|
|
19
|
+
/** @default 'md' */
|
|
20
|
+
size?: 'sm' | 'md';
|
|
21
|
+
/** Human labels per theme (also used for aria). @default { light: 'Light', dark: 'Dark', system: 'System' } */
|
|
22
|
+
labels?: Partial<Record<Theme, string>>;
|
|
23
|
+
/** Render the label text next to the icon. @default false */
|
|
24
|
+
showLabel?: boolean;
|
|
25
|
+
/** localStorage key passed to `useTheme`. @default 'crk-theme' */
|
|
26
|
+
storageKey?: string;
|
|
27
|
+
/** Override class names on internal elements. */
|
|
28
|
+
classes?: Partial<ThemeToggleClasses>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Light / dark / system switch wired to `useTheme`. Drop it in a header;
|
|
32
|
+
* every instance on the page stays in sync and the choice persists.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <ThemeToggle />
|
|
36
|
+
* <ThemeToggle variant="segmented" showLabel />
|
|
37
|
+
*/
|
|
38
|
+
export declare const ThemeToggle: import('react').ForwardRefExoticComponent<Omit<ThemeToggleProps, "ref"> & import('react').RefAttributes<HTMLButtonElement | HTMLDivElement>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as D } from "react";
|
|
3
|
+
import a from "clsx";
|
|
4
|
+
import t from "./ThemeToggle.module.scss.js";
|
|
5
|
+
import { useTheme as S } from "../../hooks/useTheme.js";
|
|
6
|
+
const B = { light: "Light", dark: "Dark", system: "System" }, T = {
|
|
7
|
+
light: /* @__PURE__ */ p("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
8
|
+
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "4" }),
|
|
9
|
+
/* @__PURE__ */ r("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" })
|
|
10
|
+
] }),
|
|
11
|
+
dark: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
12
|
+
system: /* @__PURE__ */ p("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
13
|
+
/* @__PURE__ */ r("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
14
|
+
/* @__PURE__ */ r("path", { d: "M8 21h8M12 17v4" })
|
|
15
|
+
] })
|
|
16
|
+
}, $ = D(
|
|
17
|
+
({
|
|
18
|
+
allowSystem: w = !0,
|
|
19
|
+
variant: L = "icon",
|
|
20
|
+
size: g = "md",
|
|
21
|
+
labels: A,
|
|
22
|
+
showLabel: c = !1,
|
|
23
|
+
storageKey: N,
|
|
24
|
+
classes: n,
|
|
25
|
+
className: k,
|
|
26
|
+
style: f,
|
|
27
|
+
onClick: j,
|
|
28
|
+
...v
|
|
29
|
+
}, x) => {
|
|
30
|
+
const { theme: y, setTheme: u } = S({ storageKey: N }), i = { ...B, ...A }, e = w ? ["light", "dark", "system"] : ["light", "dark"], l = e.includes(y) ? y : "light", b = e[(e.indexOf(l) + 1) % e.length];
|
|
31
|
+
if (L === "segmented") {
|
|
32
|
+
const { "aria-label": s, ...C } = v;
|
|
33
|
+
return /* @__PURE__ */ r(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: x,
|
|
37
|
+
role: "radiogroup",
|
|
38
|
+
"aria-label": s ?? "Theme",
|
|
39
|
+
className: a(t.group, t[g], n?.root, k),
|
|
40
|
+
style: f,
|
|
41
|
+
...C,
|
|
42
|
+
children: e.map((o) => {
|
|
43
|
+
const m = o === l;
|
|
44
|
+
return /* @__PURE__ */ p(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
role: "radio",
|
|
49
|
+
"aria-checked": m,
|
|
50
|
+
"aria-label": c ? void 0 : i[o],
|
|
51
|
+
title: c ? void 0 : i[o],
|
|
52
|
+
tabIndex: m ? 0 : -1,
|
|
53
|
+
className: a(t.option, m && t.optionSelected, n?.option, m && n?.optionSelected),
|
|
54
|
+
onClick: () => u(o),
|
|
55
|
+
onKeyDown: (d) => {
|
|
56
|
+
const M = e.indexOf(o);
|
|
57
|
+
let h;
|
|
58
|
+
(d.key === "ArrowRight" || d.key === "ArrowDown") && (h = e[(M + 1) % e.length]), (d.key === "ArrowLeft" || d.key === "ArrowUp") && (h = e[(M - 1 + e.length) % e.length]), h && (d.preventDefault(), u(h), d.currentTarget.parentElement?.querySelector(`[data-theme-option="${h}"]`)?.focus());
|
|
59
|
+
},
|
|
60
|
+
"data-theme-option": o,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ r("span", { className: a(t.icon, n?.icon), children: T[o] }),
|
|
63
|
+
c && /* @__PURE__ */ r("span", { className: a(t.label, n?.label), children: i[o] })
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
o
|
|
67
|
+
);
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ p(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
ref: x,
|
|
76
|
+
type: "button",
|
|
77
|
+
"aria-label": `Theme: ${i[l]}, switch to ${i[b]}`,
|
|
78
|
+
title: `Theme: ${i[l]}`,
|
|
79
|
+
"data-theme-value": l,
|
|
80
|
+
className: a(t.root, t[g], c && t.withLabel, n?.root, k),
|
|
81
|
+
style: f,
|
|
82
|
+
onClick: (s) => {
|
|
83
|
+
j?.(s), s.defaultPrevented || u(b);
|
|
84
|
+
},
|
|
85
|
+
...v,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ r("span", { className: a(t.icon, n?.icon), children: T[l] }),
|
|
88
|
+
c && /* @__PURE__ */ r("span", { className: a(t.label, n?.label), children: i[l] })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
$.displayName = "ThemeToggle";
|
|
95
|
+
export {
|
|
96
|
+
$ as ThemeToggle
|
|
97
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const o = "crk-root-UhmGj", t = "crk-option-NaLkU", c = "crk-sm-7EFQ8", n = "crk-icon--PHn2", e = "crk-md-xWcBl", l = "crk-withLabel-QbVAa", r = "crk-label-C5ZXw", s = "crk-group-ZLXl1", i = "crk-optionSelected-Qi1Pu", a = {
|
|
2
|
+
root: o,
|
|
3
|
+
option: t,
|
|
4
|
+
sm: c,
|
|
5
|
+
icon: n,
|
|
6
|
+
md: e,
|
|
7
|
+
withLabel: l,
|
|
8
|
+
label: r,
|
|
9
|
+
group: s,
|
|
10
|
+
optionSelected: i
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
a as default,
|
|
14
|
+
s as group,
|
|
15
|
+
n as icon,
|
|
16
|
+
r as label,
|
|
17
|
+
e as md,
|
|
18
|
+
t as option,
|
|
19
|
+
i as optionSelected,
|
|
20
|
+
o as root,
|
|
21
|
+
c as sm,
|
|
22
|
+
l as withLabel
|
|
23
|
+
};
|
|
@@ -15,6 +15,8 @@ export interface CheckboxProps extends ComponentPropsWithRef<'input'> {
|
|
|
15
15
|
variant?: 'checkbox' | 'switch';
|
|
16
16
|
/** Sets the DOM `indeterminate` property; visually distinct from checked/unchecked. Ignored when `variant="switch"`. @default false */
|
|
17
17
|
indeterminate?: boolean;
|
|
18
|
+
/** Apply error styling (set automatically by `FormField` when the field is invalid). @default false */
|
|
19
|
+
error?: boolean;
|
|
18
20
|
/** Override class names on internal elements. */
|
|
19
21
|
classes?: Partial<CheckboxClasses>;
|
|
20
22
|
}
|
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as b, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d, useRef as w, useEffect as k } from "react";
|
|
3
3
|
import s from "clsx";
|
|
4
|
-
import
|
|
5
|
-
const
|
|
4
|
+
import e from "./Checkbox.module.scss.js";
|
|
5
|
+
const y = d(
|
|
6
6
|
({
|
|
7
|
-
label:
|
|
8
|
-
variant:
|
|
9
|
-
indeterminate:
|
|
7
|
+
label: a,
|
|
8
|
+
variant: l = "checkbox",
|
|
9
|
+
indeterminate: m = !1,
|
|
10
|
+
error: p = !1,
|
|
10
11
|
classes: r,
|
|
11
|
-
className:
|
|
12
|
-
style:
|
|
13
|
-
...
|
|
14
|
-
},
|
|
15
|
-
const i =
|
|
16
|
-
return
|
|
17
|
-
i.current && (i.current.indeterminate =
|
|
18
|
-
}, [
|
|
12
|
+
className: u,
|
|
13
|
+
style: h,
|
|
14
|
+
...x
|
|
15
|
+
}, t) => {
|
|
16
|
+
const i = w(null), n = l === "switch", o = m && !n;
|
|
17
|
+
return k(() => {
|
|
18
|
+
i.current && (i.current.indeterminate = o);
|
|
19
|
+
}, [o]), /* @__PURE__ */ b(
|
|
19
20
|
"label",
|
|
20
21
|
{
|
|
21
22
|
className: s(
|
|
22
|
-
|
|
23
|
-
n &&
|
|
24
|
-
|
|
23
|
+
e.root,
|
|
24
|
+
n && e.switchRoot,
|
|
25
|
+
o && e.indeterminate,
|
|
25
26
|
r?.root,
|
|
26
|
-
|
|
27
|
+
u
|
|
27
28
|
),
|
|
28
|
-
style:
|
|
29
|
+
style: h,
|
|
29
30
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ f(
|
|
31
32
|
"input",
|
|
32
33
|
{
|
|
33
|
-
ref: (
|
|
34
|
-
i.current =
|
|
34
|
+
ref: (c) => {
|
|
35
|
+
i.current = c, typeof t == "function" ? t(c) : t && (t.current = c);
|
|
35
36
|
},
|
|
36
37
|
type: "checkbox",
|
|
37
|
-
className: s(
|
|
38
|
-
...
|
|
38
|
+
className: s(e.input, n && e.switchInput, p && e.error, r?.input),
|
|
39
|
+
...x
|
|
39
40
|
}
|
|
40
41
|
),
|
|
41
|
-
|
|
42
|
+
a && /* @__PURE__ */ f("span", { className: s(e.label, r?.label), children: a })
|
|
42
43
|
]
|
|
43
44
|
}
|
|
44
45
|
);
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
|
-
|
|
48
|
+
y.displayName = "Checkbox";
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
+
y as Checkbox
|
|
50
51
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
const t = "crk-root-61cKD",
|
|
1
|
+
const t = "crk-root-61cKD", r = "crk-input-bAjPU", e = "crk-error-8Cdk6", n = "crk-switchInput-Ichse", c = "crk-label-W9IeS", o = "crk-indeterminate-mLarv", s = {
|
|
2
2
|
root: t,
|
|
3
|
-
input:
|
|
4
|
-
|
|
3
|
+
input: r,
|
|
4
|
+
error: e,
|
|
5
|
+
switchInput: n,
|
|
5
6
|
label: c,
|
|
6
7
|
indeterminate: o
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
s as default,
|
|
11
|
+
e as error,
|
|
10
12
|
o as indeterminate,
|
|
11
|
-
|
|
13
|
+
r as input,
|
|
12
14
|
c as label,
|
|
13
15
|
t as root,
|
|
14
|
-
|
|
16
|
+
n as switchInput
|
|
15
17
|
};
|
|
@@ -4,6 +4,10 @@ export interface InputClasses {
|
|
|
4
4
|
wrapper: string;
|
|
5
5
|
prefix: string;
|
|
6
6
|
suffix: string;
|
|
7
|
+
/** The show/hide password toggle (`revealable`). */
|
|
8
|
+
reveal: string;
|
|
9
|
+
/** The clear button (`clearable`). */
|
|
10
|
+
clear: string;
|
|
7
11
|
}
|
|
8
12
|
export interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'prefix'> {
|
|
9
13
|
/** Toolkit size scale (independent of the native `size` HTML attribute). @default 'md' */
|
|
@@ -14,12 +18,40 @@ export interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'prefix
|
|
|
14
18
|
prefix?: ReactNode;
|
|
15
19
|
/** Content rendered inside the input wrapper, after the field. */
|
|
16
20
|
suffix?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* For `type="password"`: render a show/hide toggle after the field that
|
|
23
|
+
* switches it between `password` and `text`. Uncontrolled (hidden by
|
|
24
|
+
* default) unless `revealed` is passed. @default false
|
|
25
|
+
*/
|
|
26
|
+
revealable?: boolean;
|
|
27
|
+
/** Controlled reveal state (`revealable` only). */
|
|
28
|
+
revealed?: boolean;
|
|
29
|
+
/** Fires when the reveal toggle is used (`revealable` only). */
|
|
30
|
+
onRevealedChange?: (revealed: boolean) => void;
|
|
31
|
+
/** Accessible labels for the reveal toggle. @default { show: 'Show password', hide: 'Hide password' } */
|
|
32
|
+
revealLabels?: {
|
|
33
|
+
show: string;
|
|
34
|
+
hide: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Render a "×" button after the field while it has a value. Clearing fires
|
|
38
|
+
* `onChange` with an empty value (so controlled inputs and `FormField`
|
|
39
|
+
* update) and `onClear`. Hidden while `disabled` or `readOnly`. @default false
|
|
40
|
+
*/
|
|
41
|
+
clearable?: boolean;
|
|
42
|
+
/** Accessible label for the clear button. @default 'Clear' */
|
|
43
|
+
clearLabel?: string;
|
|
44
|
+
/** Fires after the field was cleared through the clear button. */
|
|
45
|
+
onClear?: () => void;
|
|
17
46
|
/** Override class names on internal elements. */
|
|
18
47
|
classes?: Partial<InputClasses>;
|
|
19
48
|
}
|
|
20
49
|
/**
|
|
21
|
-
* Themed text input with optional `prefix`/`suffix` slots
|
|
50
|
+
* Themed text input with optional `prefix`/`suffix` slots, a show/hide
|
|
51
|
+
* toggle for passwords (`revealable`) and a clear button (`clearable`).
|
|
22
52
|
*
|
|
23
53
|
* @example <Input type="email" inputSize="lg" prefix="@" placeholder="username" />
|
|
54
|
+
* @example <Input type="password" revealable autoComplete="current-password" />
|
|
55
|
+
* @example <Input clearable value={q} onChange={(e) => setQ(e.target.value)} placeholder="Search" />
|
|
24
56
|
*/
|
|
25
57
|
export declare const Input: import('react').ForwardRefExoticComponent<Omit<InputProps, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,50 +1,109 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as K, useRef as Q, useCallback as U, useState as E } from "react";
|
|
3
|
+
import r from "clsx";
|
|
4
|
+
import t from "./Input.module.scss.js";
|
|
5
|
+
const X = /* @__PURE__ */ f("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", children: [
|
|
6
|
+
/* @__PURE__ */ n("path", { d: "M1.5 10S4.5 4.5 10 4.5 18.5 10 18.5 10 15.5 15.5 10 15.5 1.5 10 1.5 10z", strokeLinejoin: "round" }),
|
|
7
|
+
/* @__PURE__ */ n("circle", { cx: "10", cy: "10", r: "2.5" })
|
|
8
|
+
] }), Y = /* @__PURE__ */ f("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", children: [
|
|
9
|
+
/* @__PURE__ */ n("path", { d: "M3 3l14 14", strokeLinecap: "round" }),
|
|
10
|
+
/* @__PURE__ */ n("path", { d: "M8.2 5.1A8.6 8.6 0 0110 4.9c5.5 0 8.5 5.1 8.5 5.1a14.4 14.4 0 01-2.6 3.1M11.9 11.9a2.5 2.5 0 01-3.6-3.5M5.1 6.3C2.8 7.9 1.5 10 1.5 10S4.5 15.1 10 15.1c1.2 0 2.3-.2 3.3-.6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
11
|
+
] }), Z = /* @__PURE__ */ n("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ n("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" }) }), _ = K(
|
|
6
12
|
({
|
|
7
|
-
inputSize:
|
|
8
|
-
error:
|
|
9
|
-
prefix:
|
|
10
|
-
suffix:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
inputSize: v = "md",
|
|
14
|
+
error: w = !1,
|
|
15
|
+
prefix: l,
|
|
16
|
+
suffix: i,
|
|
17
|
+
revealable: N = !1,
|
|
18
|
+
revealed: m,
|
|
19
|
+
onRevealedChange: S,
|
|
20
|
+
revealLabels: j,
|
|
21
|
+
clearable: c = !1,
|
|
22
|
+
clearLabel: D = "Clear",
|
|
23
|
+
onClear: O,
|
|
24
|
+
classes: o,
|
|
25
|
+
className: g,
|
|
26
|
+
style: b,
|
|
27
|
+
type: k,
|
|
28
|
+
onChange: x,
|
|
29
|
+
...y
|
|
30
|
+
}, a) => {
|
|
31
|
+
const I = Q(null), V = U(
|
|
32
|
+
(e) => {
|
|
33
|
+
I.current = e, typeof a == "function" ? a(e) : a && (a.current = e);
|
|
34
|
+
},
|
|
35
|
+
[a]
|
|
36
|
+
), d = N && k === "password", [H, W] = E(!1), s = m ?? H, z = () => {
|
|
37
|
+
const e = !s;
|
|
38
|
+
m === void 0 && W(e), S?.(e);
|
|
39
|
+
}, P = d && s ? "text" : k, C = j ?? { show: "Show password", hide: "Hide password" }, { value: u, defaultValue: p, disabled: M, readOnly: T } = y, [A, L] = E(
|
|
40
|
+
() => p != null && String(p).length > 0
|
|
41
|
+
), F = u != null ? String(u).length > 0 : A, q = c && F && !M && !T, G = c ? (e) => {
|
|
42
|
+
L(e.target.value.length > 0), x?.(e);
|
|
43
|
+
} : x, J = () => {
|
|
44
|
+
const e = I.current;
|
|
45
|
+
if (!e) return;
|
|
46
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), L(!1), O?.(), e.focus();
|
|
47
|
+
}, R = (e) => e.preventDefault(), h = !!(l || i || d || c), B = /* @__PURE__ */ n(
|
|
17
48
|
"input",
|
|
18
49
|
{
|
|
19
|
-
ref:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
50
|
+
ref: V,
|
|
51
|
+
type: P,
|
|
52
|
+
className: r(
|
|
53
|
+
t.root,
|
|
54
|
+
t[v],
|
|
55
|
+
w && t.error,
|
|
56
|
+
(l || void 0) && t.hasPrefix,
|
|
57
|
+
(i || d || c) && t.hasSuffix,
|
|
58
|
+
o?.root,
|
|
59
|
+
!h && g
|
|
28
60
|
),
|
|
29
|
-
style:
|
|
30
|
-
|
|
61
|
+
style: h ? void 0 : b,
|
|
62
|
+
onChange: G,
|
|
63
|
+
...y
|
|
31
64
|
}
|
|
32
65
|
);
|
|
33
|
-
return
|
|
66
|
+
return h ? /* @__PURE__ */ f(
|
|
34
67
|
"div",
|
|
35
68
|
{
|
|
36
|
-
className:
|
|
37
|
-
style:
|
|
69
|
+
className: r(t.wrapper, t[v], w && t.error, o?.wrapper, g),
|
|
70
|
+
style: b,
|
|
38
71
|
children: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
72
|
+
l && /* @__PURE__ */ n("span", { className: r(t.prefix, o?.prefix), children: l }),
|
|
73
|
+
B,
|
|
74
|
+
i && /* @__PURE__ */ n("span", { className: r(t.suffix, o?.suffix), children: i }),
|
|
75
|
+
q && /* @__PURE__ */ n(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
className: r(t.sideButton, t.clear, o?.clear),
|
|
80
|
+
"aria-label": D,
|
|
81
|
+
onMouseDown: R,
|
|
82
|
+
onClick: J,
|
|
83
|
+
tabIndex: -1,
|
|
84
|
+
children: Z
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
d && /* @__PURE__ */ n(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
className: r(t.sideButton, t.reveal, o?.reveal),
|
|
92
|
+
"aria-label": s ? C.hide : C.show,
|
|
93
|
+
"aria-pressed": s,
|
|
94
|
+
onMouseDown: R,
|
|
95
|
+
onClick: z,
|
|
96
|
+
disabled: M,
|
|
97
|
+
tabIndex: 0,
|
|
98
|
+
children: s ? Y : X
|
|
99
|
+
}
|
|
100
|
+
)
|
|
42
101
|
]
|
|
43
102
|
}
|
|
44
|
-
) :
|
|
103
|
+
) : B;
|
|
45
104
|
}
|
|
46
105
|
);
|
|
47
|
-
|
|
106
|
+
_.displayName = "Input";
|
|
48
107
|
export {
|
|
49
|
-
|
|
108
|
+
_ as Input
|
|
50
109
|
};
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
const r = "crk-root-rSgdy", s = "crk-wrapper-GHy8V", c = "crk-sm-DptM5",
|
|
1
|
+
const r = "crk-root-rSgdy", s = "crk-wrapper-GHy8V", c = "crk-sm-DptM5", o = "crk-md-F4B0G", t = "crk-lg-pBxwX", f = "crk-error-fucxe", e = "crk-prefix-w53Md", n = "crk-suffix-fcNgR", i = "crk-hasPrefix--bqPD", x = "crk-hasSuffix-zO0nX", p = "crk-sideButton-H3GC-", a = {
|
|
2
2
|
root: r,
|
|
3
3
|
wrapper: s,
|
|
4
4
|
sm: c,
|
|
5
|
-
md:
|
|
6
|
-
lg:
|
|
7
|
-
error:
|
|
5
|
+
md: o,
|
|
6
|
+
lg: t,
|
|
7
|
+
error: f,
|
|
8
8
|
prefix: e,
|
|
9
|
-
suffix:
|
|
9
|
+
suffix: n,
|
|
10
10
|
hasPrefix: i,
|
|
11
|
-
hasSuffix:
|
|
11
|
+
hasSuffix: x,
|
|
12
|
+
sideButton: p
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
a as default,
|
|
16
|
+
f as error,
|
|
16
17
|
i as hasPrefix,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
x as hasSuffix,
|
|
19
|
+
t as lg,
|
|
20
|
+
o as md,
|
|
20
21
|
e as prefix,
|
|
21
22
|
r as root,
|
|
23
|
+
p as sideButton,
|
|
22
24
|
c as sm,
|
|
23
|
-
|
|
25
|
+
n as suffix,
|
|
24
26
|
s as wrapper
|
|
25
27
|
};
|