@overdoser/react-toolkit 0.18.0 → 0.20.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 +162 -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 +140 -17
- package/components/Table/Table.js +382 -210
- package/components/Table/Table.module.scss.js +68 -46
- package/components/Table/index.d.ts +1 -1
- package/components/Table/useTableSort.d.ts +1 -1
- package/components/ThemeToggle/ThemeToggle.d.ts +40 -0
- package/components/ThemeToggle/ThemeToggle.js +98 -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 +99 -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 +25 -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 +620 -26
- package/manifest.json +1795 -99
- 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 +19 -0
- package/utils/themeScript.js +9 -0
- package/utils/timeAgo.d.ts +33 -0
- package/utils/timeAgo.js +37 -0
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as H, useRef as
|
|
1
|
+
import { jsx as s, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as H, useRef as v, useId as P, useEffect as j, createContext as D, useContext as p } from "react";
|
|
3
3
|
import { createPortal as L } from "react-dom";
|
|
4
4
|
import d from "clsx";
|
|
5
5
|
import { useFocusTrap as O } from "../../hooks/useFocusTrap.js";
|
|
6
6
|
import { useEscapeLayer as U, EscapeLayerProvider as S } from "../../hooks/useEscapeLayer.js";
|
|
7
|
-
import
|
|
8
|
-
const u = D({ classes: {}, titleId: "" }),
|
|
9
|
-
const { classes:
|
|
7
|
+
import t from "./Modal.module.scss.js";
|
|
8
|
+
const u = D({ classes: {}, titleId: "" }), N = ({ children: e, className: a, style: l, onClose: r }) => {
|
|
9
|
+
const { classes: c, titleId: i } = p(u);
|
|
10
10
|
return /* @__PURE__ */ E(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
style: s,
|
|
13
|
+
className: d(t.header, r && t.headerWithClose, c.header, a),
|
|
14
|
+
style: l,
|
|
16
15
|
children: [
|
|
17
|
-
e,
|
|
18
|
-
r && /* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ s("div", { id: i, className: d(t.headerTitle, c.headerTitle), children: e }),
|
|
17
|
+
r && /* @__PURE__ */ s(
|
|
19
18
|
"button",
|
|
20
19
|
{
|
|
21
20
|
type: "button",
|
|
22
|
-
className: d(
|
|
21
|
+
className: d(t.closeButton, c.closeButton),
|
|
23
22
|
onClick: r,
|
|
24
23
|
"aria-label": "Close",
|
|
25
24
|
children: "×"
|
|
@@ -29,37 +28,37 @@ const u = D({ classes: {}, titleId: "" }), M = ({ children: e, className: t, sty
|
|
|
29
28
|
}
|
|
30
29
|
);
|
|
31
30
|
};
|
|
32
|
-
|
|
33
|
-
const
|
|
31
|
+
N.displayName = "Modal.Header";
|
|
32
|
+
const M = ({ children: e, className: a, style: l }) => {
|
|
34
33
|
const { classes: r } = p(u);
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ s("div", { className: d(t.body, r.body, a), style: l, children: e });
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
const B = ({ children: e, className:
|
|
36
|
+
M.displayName = "Modal.Body";
|
|
37
|
+
const B = ({ children: e, className: a, style: l }) => {
|
|
39
38
|
const { classes: r } = p(u);
|
|
40
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ s("div", { className: d(t.footer, r.footer, a), style: l, children: e });
|
|
41
40
|
};
|
|
42
41
|
B.displayName = "Modal.Footer";
|
|
43
42
|
const m = H(
|
|
44
43
|
({
|
|
45
44
|
open: e,
|
|
46
|
-
onClose:
|
|
47
|
-
closeOnBackdrop:
|
|
45
|
+
onClose: a,
|
|
46
|
+
closeOnBackdrop: l = !0,
|
|
48
47
|
closeOnEscape: r = !0,
|
|
49
|
-
size:
|
|
50
|
-
classes:
|
|
48
|
+
size: c = "md",
|
|
49
|
+
classes: i,
|
|
51
50
|
className: w,
|
|
52
51
|
style: x,
|
|
53
52
|
children: k,
|
|
54
53
|
"aria-label": y,
|
|
55
54
|
"aria-labelledby": C
|
|
56
|
-
},
|
|
57
|
-
const b =
|
|
58
|
-
b.current = o, typeof
|
|
59
|
-
},
|
|
55
|
+
}, n) => {
|
|
56
|
+
const b = v(null), T = (o) => {
|
|
57
|
+
b.current = o, typeof n == "function" ? n(o) : n && (n.current = o);
|
|
58
|
+
}, g = P(), h = C ?? `${g}-title`;
|
|
60
59
|
O(b, e);
|
|
61
|
-
const
|
|
62
|
-
r &&
|
|
60
|
+
const I = U(() => {
|
|
61
|
+
r && a();
|
|
63
62
|
}, e);
|
|
64
63
|
j(() => {
|
|
65
64
|
if (!e) return;
|
|
@@ -68,30 +67,30 @@ const m = H(
|
|
|
68
67
|
document.body.style.overflow = o;
|
|
69
68
|
};
|
|
70
69
|
}, [e]);
|
|
71
|
-
const f =
|
|
70
|
+
const f = v(!1), F = (o) => {
|
|
72
71
|
f.current = o.target === o.currentTarget;
|
|
73
|
-
},
|
|
74
|
-
|
|
72
|
+
}, R = (o) => {
|
|
73
|
+
l && f.current && o.target === o.currentTarget && a(), f.current = !1;
|
|
75
74
|
};
|
|
76
75
|
return e ? L(
|
|
77
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ s(
|
|
78
77
|
"div",
|
|
79
78
|
{
|
|
80
|
-
className: d(
|
|
81
|
-
onMouseDown:
|
|
82
|
-
onMouseUp:
|
|
79
|
+
className: d(t.backdrop, i?.backdrop),
|
|
80
|
+
onMouseDown: F,
|
|
81
|
+
onMouseUp: R,
|
|
83
82
|
role: "presentation",
|
|
84
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ s(
|
|
85
84
|
"div",
|
|
86
85
|
{
|
|
87
|
-
ref:
|
|
88
|
-
className: d(
|
|
86
|
+
ref: T,
|
|
87
|
+
className: d(t.modal, t[c], i?.modal, w),
|
|
89
88
|
style: x,
|
|
90
89
|
role: "dialog",
|
|
91
90
|
"aria-modal": "true",
|
|
92
91
|
"aria-label": y,
|
|
93
|
-
"aria-labelledby": y ? void 0 :
|
|
94
|
-
children: /* @__PURE__ */
|
|
92
|
+
"aria-labelledby": y ? void 0 : h,
|
|
93
|
+
children: /* @__PURE__ */ s(u.Provider, { value: { classes: i ?? {}, titleId: h }, children: /* @__PURE__ */ s(S, { value: I, children: k }) })
|
|
95
94
|
}
|
|
96
95
|
)
|
|
97
96
|
}
|
|
@@ -101,8 +100,8 @@ const m = H(
|
|
|
101
100
|
}
|
|
102
101
|
);
|
|
103
102
|
m.displayName = "Modal";
|
|
104
|
-
m.Header =
|
|
105
|
-
m.Body =
|
|
103
|
+
m.Header = N;
|
|
104
|
+
m.Body = M;
|
|
106
105
|
m.Footer = B;
|
|
107
106
|
export {
|
|
108
107
|
m as Modal
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
const o = "crk-backdrop-jYpTA", c = "crk-backdropIn-x5Z-A",
|
|
1
|
+
const o = "crk-backdrop-jYpTA", c = "crk-backdropIn-x5Z-A", e = "crk-modal-yNG-7", r = "crk-modalIn-xFUwm", t = "crk-sm--xyY9", s = "crk-md-ETTfh", d = "crk-lg-5DBb7", n = "crk-fullscreen-b4jQ-", l = "crk-header-NS30G", a = "crk-headerTitle-tJ2Qv", k = "crk-headerWithClose-4davm", m = "crk-closeButton-JX-aq", h = "crk-body-3zIj9", b = "crk-footer-Oyz-R", f = {
|
|
2
2
|
backdrop: o,
|
|
3
3
|
backdropIn: c,
|
|
4
|
-
modal:
|
|
5
|
-
modalIn:
|
|
6
|
-
sm:
|
|
7
|
-
md:
|
|
4
|
+
modal: e,
|
|
5
|
+
modalIn: r,
|
|
6
|
+
sm: t,
|
|
7
|
+
md: s,
|
|
8
8
|
lg: d,
|
|
9
9
|
fullscreen: n,
|
|
10
10
|
header: l,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
headerTitle: a,
|
|
12
|
+
headerWithClose: k,
|
|
13
|
+
closeButton: m,
|
|
14
|
+
body: h,
|
|
14
15
|
footer: b
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
18
|
o as backdrop,
|
|
18
19
|
c as backdropIn,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
h as body,
|
|
21
|
+
m as closeButton,
|
|
22
|
+
f as default,
|
|
22
23
|
b as footer,
|
|
23
24
|
n as fullscreen,
|
|
24
25
|
l as header,
|
|
25
|
-
a as
|
|
26
|
+
a as headerTitle,
|
|
27
|
+
k as headerWithClose,
|
|
26
28
|
d as lg,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
s as md,
|
|
30
|
+
e as modal,
|
|
31
|
+
r as modalIn,
|
|
32
|
+
t as sm
|
|
31
33
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface PageHeaderClasses {
|
|
3
|
+
root: string;
|
|
4
|
+
breadcrumbs: string;
|
|
5
|
+
back: string;
|
|
6
|
+
titleRow: string;
|
|
7
|
+
title: string;
|
|
8
|
+
badge: string;
|
|
9
|
+
subtitle: string;
|
|
10
|
+
description: string;
|
|
11
|
+
meta: string;
|
|
12
|
+
actions: string;
|
|
13
|
+
tabs: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PageHeaderProps extends Omit<ComponentPropsWithRef<'header'>, 'title'> {
|
|
16
|
+
/** Page title. */
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
/** Element used for the title. @default 'h1' */
|
|
19
|
+
as?: 'h1' | 'h2' | 'h3' | 'div';
|
|
20
|
+
/** Muted line under the title. */
|
|
21
|
+
subtitle?: ReactNode;
|
|
22
|
+
/** Longer paragraph under the subtitle (text-secondary, max-width 70ch). */
|
|
23
|
+
description?: ReactNode;
|
|
24
|
+
/** Right-aligned slot for buttons; wraps under the title on narrow widths. */
|
|
25
|
+
actions?: ReactNode;
|
|
26
|
+
/** Slot above the title — pass a `<Breadcrumbs>`. */
|
|
27
|
+
breadcrumbs?: ReactNode;
|
|
28
|
+
/** Renders a "← Back" link before the title block. */
|
|
29
|
+
backHref?: string;
|
|
30
|
+
/** Renders a "← Back" button before the title block (ignored when `backHref` is set). */
|
|
31
|
+
onBack?: () => void;
|
|
32
|
+
/** Text of the back link/button. @default 'Back' */
|
|
33
|
+
backLabel?: string;
|
|
34
|
+
/** Inline slot after the title (a `<Badge>` or `<StatusDot>`). */
|
|
35
|
+
badge?: ReactNode;
|
|
36
|
+
/** Row of small muted metadata under the title ("Updated 3 min ago · 12 members"). */
|
|
37
|
+
meta?: ReactNode;
|
|
38
|
+
/** Slot at the bottom, flush with the bottom border — for a `<Tabs.List>`. */
|
|
39
|
+
tabs?: ReactNode;
|
|
40
|
+
/** Bottom hairline. @default true */
|
|
41
|
+
divider?: boolean;
|
|
42
|
+
/** Title size: xl / 2xl / 3xl. @default 'md' */
|
|
43
|
+
size?: 'sm' | 'md' | 'lg';
|
|
44
|
+
/** Stick to the top of the scroll container. @default false */
|
|
45
|
+
sticky?: boolean;
|
|
46
|
+
/** Override class names on internal elements. */
|
|
47
|
+
classes?: Partial<PageHeaderClasses>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Top-of-page header: breadcrumbs, back link, title with badge, subtitle,
|
|
51
|
+
* description, metadata row, right-aligned actions and an optional tab strip.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* <PageHeader
|
|
55
|
+
* title="Projects"
|
|
56
|
+
* subtitle="Everything your team is working on"
|
|
57
|
+
* actions={<Button>New project</Button>}
|
|
58
|
+
* breadcrumbs={<Breadcrumbs>…</Breadcrumbs>}
|
|
59
|
+
* />
|
|
60
|
+
*/
|
|
61
|
+
export declare const PageHeader: import('react').ForwardRefExoticComponent<Omit<PageHeaderProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as R, createElement as C } from "react";
|
|
3
|
+
import r from "clsx";
|
|
4
|
+
import e from "./PageHeader.module.scss.js";
|
|
5
|
+
const k = /* @__PURE__ */ t("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", width: "1em", height: "1em", children: /* @__PURE__ */ t("path", { d: "M12 4l-6 6 6 6", strokeLinecap: "round", strokeLinejoin: "round" }) }), L = R(
|
|
6
|
+
({
|
|
7
|
+
title: u,
|
|
8
|
+
as: v = "h1",
|
|
9
|
+
subtitle: o,
|
|
10
|
+
description: l,
|
|
11
|
+
actions: n,
|
|
12
|
+
breadcrumbs: c,
|
|
13
|
+
backHref: m,
|
|
14
|
+
onBack: h,
|
|
15
|
+
backLabel: s = "Back",
|
|
16
|
+
badge: N,
|
|
17
|
+
meta: p,
|
|
18
|
+
tabs: d,
|
|
19
|
+
divider: b = !0,
|
|
20
|
+
size: f = "md",
|
|
21
|
+
sticky: w = !1,
|
|
22
|
+
classes: i,
|
|
23
|
+
className: g,
|
|
24
|
+
children: x,
|
|
25
|
+
...y
|
|
26
|
+
}, j) => {
|
|
27
|
+
const B = m !== void 0 ? /* @__PURE__ */ a("a", { href: m, className: r(e.back, i?.back), children: [
|
|
28
|
+
k,
|
|
29
|
+
s
|
|
30
|
+
] }) : h ? /* @__PURE__ */ a("button", { type: "button", onClick: h, className: r(e.back, i?.back), children: [
|
|
31
|
+
k,
|
|
32
|
+
s
|
|
33
|
+
] }) : null;
|
|
34
|
+
return /* @__PURE__ */ a(
|
|
35
|
+
"header",
|
|
36
|
+
{
|
|
37
|
+
ref: j,
|
|
38
|
+
className: r(
|
|
39
|
+
e.root,
|
|
40
|
+
e[f],
|
|
41
|
+
b && e.divider,
|
|
42
|
+
w && e.sticky,
|
|
43
|
+
d && e.hasTabs,
|
|
44
|
+
i?.root,
|
|
45
|
+
g
|
|
46
|
+
),
|
|
47
|
+
...y,
|
|
48
|
+
children: [
|
|
49
|
+
c && /* @__PURE__ */ t("div", { className: r(e.breadcrumbs, i?.breadcrumbs), children: c }),
|
|
50
|
+
B,
|
|
51
|
+
/* @__PURE__ */ a("div", { className: r(e.titleRow, i?.titleRow), children: [
|
|
52
|
+
/* @__PURE__ */ a("div", { className: e.titleBlock, children: [
|
|
53
|
+
/* @__PURE__ */ a("div", { className: e.titleLine, children: [
|
|
54
|
+
C(v, { className: r(e.title, i?.title) }, u),
|
|
55
|
+
N && /* @__PURE__ */ t("span", { className: r(e.badge, i?.badge), children: N })
|
|
56
|
+
] }),
|
|
57
|
+
o && /* @__PURE__ */ t("p", { className: r(e.subtitle, i?.subtitle), children: o }),
|
|
58
|
+
l && /* @__PURE__ */ t("p", { className: r(e.description, i?.description), children: l }),
|
|
59
|
+
p && /* @__PURE__ */ t("div", { className: r(e.meta, i?.meta), children: p })
|
|
60
|
+
] }),
|
|
61
|
+
n && /* @__PURE__ */ t("div", { className: r(e.actions, i?.actions), children: n })
|
|
62
|
+
] }),
|
|
63
|
+
x,
|
|
64
|
+
d && /* @__PURE__ */ t("div", { className: r(e.tabs, i?.tabs), children: d })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
L.displayName = "PageHeader";
|
|
71
|
+
export {
|
|
72
|
+
L as PageHeader
|
|
73
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const t = "crk-root-K-SAd", c = "crk-sm-XJoTL", s = "crk-md-obtrZ", o = "crk-lg--8FAx", e = "crk-divider-q-A5e", i = "crk-hasTabs-YLYqx", r = "crk-sticky-e3pQP", n = "crk-breadcrumbs-rTXxK", k = "crk-back-R4Oq3", a = "crk-titleRow-4-MEi", l = "crk-titleBlock-37A6l", b = "crk-titleLine-oWB7d", d = "crk-title-1nY9v", m = "crk-badge-Uesjc", u = "crk-subtitle-BREZj", g = "crk-description--PNl0", T = "crk-meta-fkWcX", p = "crk-actions-EYOW1", B = "crk-tabs-qDTiN", L = {
|
|
2
|
+
root: t,
|
|
3
|
+
sm: c,
|
|
4
|
+
md: s,
|
|
5
|
+
lg: o,
|
|
6
|
+
divider: e,
|
|
7
|
+
hasTabs: i,
|
|
8
|
+
sticky: r,
|
|
9
|
+
breadcrumbs: n,
|
|
10
|
+
back: k,
|
|
11
|
+
titleRow: a,
|
|
12
|
+
titleBlock: l,
|
|
13
|
+
titleLine: b,
|
|
14
|
+
title: d,
|
|
15
|
+
badge: m,
|
|
16
|
+
subtitle: u,
|
|
17
|
+
description: g,
|
|
18
|
+
meta: T,
|
|
19
|
+
actions: p,
|
|
20
|
+
tabs: B
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
p as actions,
|
|
24
|
+
k as back,
|
|
25
|
+
m as badge,
|
|
26
|
+
n as breadcrumbs,
|
|
27
|
+
L as default,
|
|
28
|
+
g as description,
|
|
29
|
+
e as divider,
|
|
30
|
+
i as hasTabs,
|
|
31
|
+
o as lg,
|
|
32
|
+
s as md,
|
|
33
|
+
T as meta,
|
|
34
|
+
t as root,
|
|
35
|
+
c as sm,
|
|
36
|
+
r as sticky,
|
|
37
|
+
u as subtitle,
|
|
38
|
+
B as tabs,
|
|
39
|
+
d as title,
|
|
40
|
+
l as titleBlock,
|
|
41
|
+
b as titleLine,
|
|
42
|
+
a as titleRow
|
|
43
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export type ProgressBarVariant = 'primary' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
3
|
+
export interface ProgressBarThreshold {
|
|
4
|
+
/** Lower bound (inclusive) from which `variant` applies. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Fill colour used once the current value reaches `value`. */
|
|
7
|
+
variant: ProgressBarVariant;
|
|
8
|
+
}
|
|
9
|
+
export interface ProgressBarClasses {
|
|
10
|
+
root: string;
|
|
11
|
+
header: string;
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
track: string;
|
|
15
|
+
fill: string;
|
|
16
|
+
segment: string;
|
|
17
|
+
segmentFilled: string;
|
|
18
|
+
segmentCurrent: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ProgressBarProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
|
|
21
|
+
/**
|
|
22
|
+
* Current value, clamped to `[0, max]`. Omit it for an indeterminate bar
|
|
23
|
+
* (sliding shimmer; fades in place under `prefers-reduced-motion`).
|
|
24
|
+
*/
|
|
25
|
+
value?: number;
|
|
26
|
+
/** Upper bound of `value`. @default 100 */
|
|
27
|
+
max?: number;
|
|
28
|
+
/** Text shown above the bar, on the left. A string label also becomes the track's `aria-label`. */
|
|
29
|
+
label?: ReactNode;
|
|
30
|
+
/** Show the formatted value above the bar, on the right. Ignored when indeterminate. @default false */
|
|
31
|
+
showValue?: boolean;
|
|
32
|
+
/** Formats the text rendered by `showValue`. @default (v, max) => `${Math.round(v / max * 100)}%` */
|
|
33
|
+
formatValue?: (value: number, max: number) => ReactNode;
|
|
34
|
+
/** Track height. @default 'md' */
|
|
35
|
+
size?: 'sm' | 'md' | 'lg';
|
|
36
|
+
/** Fill colour. Overridden by a matching `thresholds` entry. @default 'primary' */
|
|
37
|
+
variant?: ProgressBarVariant;
|
|
38
|
+
/**
|
|
39
|
+
* Value-driven colour: the entry with the highest `value` that is `<=` the
|
|
40
|
+
* current value wins (`[{ value: 0, variant: 'danger' }, { value: 20, variant: 'warning' }, { value: 50, variant: 'success' }]`
|
|
41
|
+
* is a battery gauge). Below every threshold, `variant` applies.
|
|
42
|
+
*/
|
|
43
|
+
thresholds?: ProgressBarThreshold[];
|
|
44
|
+
/**
|
|
45
|
+
* When `> 1`, renders that many discrete blocks instead of a continuous
|
|
46
|
+
* fill; `Math.round(value / max * segments)` of them are filled from the
|
|
47
|
+
* left. Ignored when indeterminate.
|
|
48
|
+
*/
|
|
49
|
+
segments?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Segmented mode only. Marks the segment right after the last filled one
|
|
52
|
+
* as the *current* step with a mid shade, giving three states: done /
|
|
53
|
+
* current / remaining (`value` = steps completed). @default false
|
|
54
|
+
*/
|
|
55
|
+
showCurrent?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Corner style. `'square'` removes every radius — the flat stepper strip
|
|
58
|
+
* at the top of a survey/wizard page. @default 'rounded'
|
|
59
|
+
*/
|
|
60
|
+
shape?: 'rounded' | 'square';
|
|
61
|
+
/** Override class names on internal elements. */
|
|
62
|
+
classes?: Partial<ProgressBarClasses>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Determinate / indeterminate progress bar with optional label, value text,
|
|
66
|
+
* value-driven colour thresholds and a segmented (stepper) mode.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* <ProgressBar label="Uploading" value={42} showValue />
|
|
70
|
+
* <ProgressBar value={level} thresholds={[{ value: 0, variant: 'danger' }, { value: 20, variant: 'warning' }, { value: 50, variant: 'success' }]} />
|
|
71
|
+
* <ProgressBar value={2} max={5} segments={5} size="lg" />
|
|
72
|
+
* <ProgressBar value={2} max={4} segments={4} showCurrent shape="square" aria-label="Step 3 of 4" />
|
|
73
|
+
*/
|
|
74
|
+
export declare const ProgressBar: import('react').ForwardRefExoticComponent<Omit<ProgressBarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs as M, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as R, useMemo as V } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
import e from "./ProgressBar.module.scss.js";
|
|
5
|
+
const _ = (o, s) => `${Math.round(o / s * 100)}%`, z = R(
|
|
6
|
+
({
|
|
7
|
+
value: o,
|
|
8
|
+
max: s = 100,
|
|
9
|
+
label: l,
|
|
10
|
+
showValue: h = !1,
|
|
11
|
+
formatValue: k = _,
|
|
12
|
+
size: w = "md",
|
|
13
|
+
variant: v = "primary",
|
|
14
|
+
thresholds: g,
|
|
15
|
+
segments: i,
|
|
16
|
+
showCurrent: F = !1,
|
|
17
|
+
shape: j = "rounded",
|
|
18
|
+
classes: r,
|
|
19
|
+
className: q,
|
|
20
|
+
style: B,
|
|
21
|
+
"aria-label": C,
|
|
22
|
+
"aria-labelledby": P,
|
|
23
|
+
...S
|
|
24
|
+
}, $) => {
|
|
25
|
+
const c = s > 0 ? s : 100, a = o === void 0 || Number.isNaN(o), d = a ? 0 : Math.min(c, Math.max(0, o)), N = d / c, A = V(() => {
|
|
26
|
+
if (a || !g?.length) return v;
|
|
27
|
+
const x = [...g].sort((p, L) => p.value - L.value);
|
|
28
|
+
let t = v;
|
|
29
|
+
for (const p of x)
|
|
30
|
+
p.value <= d && (t = p.variant);
|
|
31
|
+
return t;
|
|
32
|
+
}, [a, g, v, d]), u = !a && typeof i == "number" && i > 1, f = u ? Math.round(N * i) : 0, y = u && F && f < i ? f : -1, b = l != null && l !== !1, H = b || h && !a;
|
|
33
|
+
return /* @__PURE__ */ M(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: $,
|
|
37
|
+
className: n(e.root, e[w], e[A], j === "square" && e.square, r?.root, q),
|
|
38
|
+
style: B,
|
|
39
|
+
...S,
|
|
40
|
+
children: [
|
|
41
|
+
H && /* @__PURE__ */ M("div", { className: n(e.header, r?.header), children: [
|
|
42
|
+
b && /* @__PURE__ */ m("span", { className: n(e.label, r?.label), children: l }),
|
|
43
|
+
h && !a && /* @__PURE__ */ m("span", { className: n(e.value, r?.value), children: k(d, c) })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ m(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
role: "progressbar",
|
|
49
|
+
"aria-valuemin": 0,
|
|
50
|
+
"aria-valuemax": c,
|
|
51
|
+
"aria-valuenow": a ? void 0 : d,
|
|
52
|
+
"aria-label": C ?? (typeof l == "string" ? l : void 0),
|
|
53
|
+
"aria-labelledby": P,
|
|
54
|
+
className: n(
|
|
55
|
+
e.track,
|
|
56
|
+
a && e.indeterminate,
|
|
57
|
+
u && e.segmented,
|
|
58
|
+
r?.track
|
|
59
|
+
),
|
|
60
|
+
children: u ? Array.from({ length: i }, (x, t) => /* @__PURE__ */ m(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: n(
|
|
64
|
+
e.segment,
|
|
65
|
+
t < f && e.segmentFilled,
|
|
66
|
+
t === y && e.segmentCurrent,
|
|
67
|
+
r?.segment,
|
|
68
|
+
t < f && r?.segmentFilled,
|
|
69
|
+
t === y && r?.segmentCurrent
|
|
70
|
+
)
|
|
71
|
+
},
|
|
72
|
+
t
|
|
73
|
+
)) : /* @__PURE__ */ m(
|
|
74
|
+
"span",
|
|
75
|
+
{
|
|
76
|
+
className: n(e.fill, r?.fill),
|
|
77
|
+
style: a ? void 0 : { width: `${N * 100}%` }
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
z.displayName = "ProgressBar";
|
|
88
|
+
export {
|
|
89
|
+
z as ProgressBar
|
|
90
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const r = "crk-root-OIfFA", e = "crk-sm-lcp3n", s = "crk-md-6WStK", c = "crk-lg-i8EIC", t = "crk-primary-d7Piz", n = "crk-success-cvbui", o = "crk-warning-T5lWo", l = "crk-danger-43KPI", k = "crk-neutral-8XqGp", a = "crk-header-z7QvW", g = "crk-label-hsH4C", d = "crk-value-lGO18", i = "crk-track-vjybM", m = "crk-fill-MAyGB", u = "crk-indeterminate-D4x08", p = "crk-crk-progress-slide-lJXeI", f = "crk-segmented-4U5CV", P = "crk-segment-kL8tr", v = "crk-segmentFilled-iSzPI", y = "crk-segmentCurrent-H443l", C = "crk-square-6Soi4", F = "crk-crk-progress-fade-748w-", I = {
|
|
2
|
+
root: r,
|
|
3
|
+
sm: e,
|
|
4
|
+
md: s,
|
|
5
|
+
lg: c,
|
|
6
|
+
primary: t,
|
|
7
|
+
success: n,
|
|
8
|
+
warning: o,
|
|
9
|
+
danger: l,
|
|
10
|
+
neutral: k,
|
|
11
|
+
header: a,
|
|
12
|
+
label: g,
|
|
13
|
+
value: d,
|
|
14
|
+
track: i,
|
|
15
|
+
fill: m,
|
|
16
|
+
indeterminate: u,
|
|
17
|
+
"crk-progress-slide": "crk-crk-progress-slide-lJXeI",
|
|
18
|
+
crkProgressSlide: p,
|
|
19
|
+
segmented: f,
|
|
20
|
+
segment: P,
|
|
21
|
+
segmentFilled: v,
|
|
22
|
+
segmentCurrent: y,
|
|
23
|
+
square: C,
|
|
24
|
+
"crk-progress-fade": "crk-crk-progress-fade-748w-",
|
|
25
|
+
crkProgressFade: F
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
F as crkProgressFade,
|
|
29
|
+
p as crkProgressSlide,
|
|
30
|
+
l as danger,
|
|
31
|
+
I as default,
|
|
32
|
+
m as fill,
|
|
33
|
+
a as header,
|
|
34
|
+
u as indeterminate,
|
|
35
|
+
g as label,
|
|
36
|
+
c as lg,
|
|
37
|
+
s as md,
|
|
38
|
+
k as neutral,
|
|
39
|
+
t as primary,
|
|
40
|
+
r as root,
|
|
41
|
+
P as segment,
|
|
42
|
+
y as segmentCurrent,
|
|
43
|
+
v as segmentFilled,
|
|
44
|
+
f as segmented,
|
|
45
|
+
e as sm,
|
|
46
|
+
C as square,
|
|
47
|
+
n as success,
|
|
48
|
+
i as track,
|
|
49
|
+
d as value,
|
|
50
|
+
o as warning
|
|
51
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface RelativeTimeClasses {
|
|
3
|
+
root: string;
|
|
4
|
+
}
|
|
5
|
+
export interface RelativeTimeProps extends Omit<ComponentPropsWithRef<'time'>, 'children' | 'title'> {
|
|
6
|
+
/** The instant to describe: `Date`, epoch ms, or an ISO string. */
|
|
7
|
+
value: Date | number | string;
|
|
8
|
+
/** `Intl.RelativeTimeFormat` style: "3 minutes ago" / "3 min. ago" / "3m ago". @default 'long' */
|
|
9
|
+
format?: 'long' | 'short' | 'narrow';
|
|
10
|
+
/** `'auto'` says "yesterday" / "now"; `'always'` says "1 day ago". @default 'auto' */
|
|
11
|
+
numeric?: 'always' | 'auto';
|
|
12
|
+
/** BCP 47 locale; `undefined` = runtime default. */
|
|
13
|
+
locale?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Keep the label fresh. Ticks every second under a minute, every 30 s under
|
|
16
|
+
* an hour, then every minute. Subscribers share one timer per period.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
live?: boolean;
|
|
20
|
+
/** Fixed reference instant (ms) instead of the live clock — for tests and snapshots. */
|
|
21
|
+
now?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Past this many ms the relative label is replaced by an absolute date
|
|
24
|
+
* (`absoluteFormat`), e.g. `7 * 24 * 3600 * 1000` for "after a week show the date".
|
|
25
|
+
*/
|
|
26
|
+
maxAge?: number;
|
|
27
|
+
/** `Intl.DateTimeFormat` options for the absolute fallback and the `title` tooltip. @default { dateStyle: 'medium', timeStyle: 'short' } */
|
|
28
|
+
absoluteFormat?: Intl.DateTimeFormatOptions;
|
|
29
|
+
/** Tooltip with the absolute time (plain `title`, no underline). `false` disables it. @default true */
|
|
30
|
+
title?: boolean | string;
|
|
31
|
+
/** Rendered instead of the text for an unparsable `value`. @default '—' */
|
|
32
|
+
fallback?: ReactNode;
|
|
33
|
+
/** Override class names on internal elements. */
|
|
34
|
+
classes?: Partial<RelativeTimeClasses>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* "3 minutes ago" / "in 2 hours" as a live-updating `<time>` element with the
|
|
38
|
+
* absolute time in `dateTime` and as a tooltip. Uses `Intl.RelativeTimeFormat`,
|
|
39
|
+
* so no locale tables ship with the toolkit.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <RelativeTime value={comment.createdAt} />
|
|
43
|
+
* <RelativeTime value={deploy.finishedAt} format="short" maxAge={7 * 86_400_000} />
|
|
44
|
+
*/
|
|
45
|
+
export declare const RelativeTime: import('react').ForwardRefExoticComponent<Omit<RelativeTimeProps, "ref"> & import('react').RefAttributes<HTMLTimeElement>>;
|