@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
|
@@ -6,8 +6,11 @@ export interface AlertClasses {
|
|
|
6
6
|
content: string;
|
|
7
7
|
title: string;
|
|
8
8
|
message: string;
|
|
9
|
+
action: string;
|
|
9
10
|
close: string;
|
|
10
11
|
}
|
|
12
|
+
export type AlertLayout = 'inline' | 'banner';
|
|
13
|
+
export type AlertSize = 'sm' | 'md';
|
|
11
14
|
export interface AlertProps extends Omit<ComponentPropsWithRef<'div'>, 'title'> {
|
|
12
15
|
/** Color/semantics. @default 'info' */
|
|
13
16
|
variant?: AlertVariant;
|
|
@@ -19,16 +22,41 @@ export interface AlertProps extends Omit<ComponentPropsWithRef<'div'>, 'title'>
|
|
|
19
22
|
onClose?: () => void;
|
|
20
23
|
/** Accessible label for the dismiss button. @default 'Dismiss' */
|
|
21
24
|
closeLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Slot for a button or link rendered after the message (a "Retry",
|
|
27
|
+
* "Undo", "View details"). Inline layout places it at the end of the
|
|
28
|
+
* content and lets it wrap under the message on narrow widths; banner
|
|
29
|
+
* layout pushes it to the right edge, before the dismiss button.
|
|
30
|
+
*/
|
|
31
|
+
action?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* `'inline'` is the in-flow card (rounded, accent left border).
|
|
34
|
+
* `'banner'` is a full-width strip for the top of a page or app shell: no
|
|
35
|
+
* radius, no side border, everything on one row (icon · text · action ·
|
|
36
|
+
* close). @default 'inline'
|
|
37
|
+
*/
|
|
38
|
+
layout?: AlertLayout;
|
|
39
|
+
/** `'sm'` tightens padding and uses the small font size — for hints inside forms and cards. @default 'md' */
|
|
40
|
+
size?: AlertSize;
|
|
22
41
|
/** Override class names on internal elements. */
|
|
23
42
|
classes?: Partial<AlertClasses>;
|
|
24
43
|
}
|
|
25
44
|
/**
|
|
26
45
|
* Inline status message — info, success, warning, or danger. Optionally titled,
|
|
27
|
-
* dismissible,
|
|
46
|
+
* dismissible, with a leading icon and an `action` slot. `layout="banner"`
|
|
47
|
+
* turns it into a full-width strip for the top of a page.
|
|
48
|
+
*
|
|
49
|
+
* The root has `role="alert"`; pass `role="status"` for non-urgent
|
|
50
|
+
* messages that should not interrupt a screen reader.
|
|
28
51
|
*
|
|
29
52
|
* @example
|
|
30
53
|
* <Alert variant="success" title="Saved" onClose={() => setShown(false)}>
|
|
31
54
|
* Your changes were saved.
|
|
32
55
|
* </Alert>
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <Alert layout="banner" variant="warning" action={<Button size="sm">Renew</Button>} onClose={dismiss}>
|
|
59
|
+
* Your trial ends in 3 days.
|
|
60
|
+
* </Alert>
|
|
33
61
|
*/
|
|
34
62
|
export declare const Alert: import('react').ForwardRefExoticComponent<Omit<AlertProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as x } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
4
|
import l from "./Alert.module.scss.js";
|
|
5
|
-
const
|
|
5
|
+
const L = {
|
|
6
6
|
info: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e(
|
|
7
7
|
"path",
|
|
8
8
|
{
|
|
@@ -35,39 +35,53 @@ const p = {
|
|
|
35
35
|
clipRule: "evenodd"
|
|
36
36
|
}
|
|
37
37
|
) })
|
|
38
|
-
},
|
|
38
|
+
}, g = x(
|
|
39
39
|
({
|
|
40
|
-
variant:
|
|
41
|
-
title:
|
|
42
|
-
icon:
|
|
43
|
-
onClose:
|
|
44
|
-
closeLabel:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
variant: o = "info",
|
|
41
|
+
title: t,
|
|
42
|
+
icon: a = !0,
|
|
43
|
+
onClose: c,
|
|
44
|
+
closeLabel: h = "Dismiss",
|
|
45
|
+
action: s,
|
|
46
|
+
layout: r = "inline",
|
|
47
|
+
size: f = "md",
|
|
48
|
+
classes: i,
|
|
49
|
+
className: p,
|
|
50
|
+
children: u,
|
|
51
|
+
...z
|
|
52
|
+
}, N) => {
|
|
53
|
+
const m = a === !0 ? L[o] : a === !1 ? null : a, v = s != null ? /* @__PURE__ */ e("div", { className: n(l.action, i?.action), children: s }) : null;
|
|
54
|
+
return /* @__PURE__ */ d(
|
|
52
55
|
"div",
|
|
53
56
|
{
|
|
54
|
-
ref:
|
|
57
|
+
ref: N,
|
|
55
58
|
role: "alert",
|
|
56
|
-
className:
|
|
57
|
-
|
|
59
|
+
className: n(
|
|
60
|
+
l.root,
|
|
61
|
+
l[o],
|
|
62
|
+
r === "banner" && l.banner,
|
|
63
|
+
f === "sm" && l.sm,
|
|
64
|
+
i?.root,
|
|
65
|
+
p
|
|
66
|
+
),
|
|
67
|
+
...z,
|
|
58
68
|
children: [
|
|
59
|
-
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
m != null && /* @__PURE__ */ e("span", { className: n(l.icon, i?.icon), "aria-hidden": "true", children: m }),
|
|
70
|
+
/* @__PURE__ */ d("div", { className: n(l.content, i?.content), children: [
|
|
71
|
+
/* @__PURE__ */ d("div", { className: l.text, children: [
|
|
72
|
+
t != null && /* @__PURE__ */ e("div", { className: n(l.title, i?.title), children: t }),
|
|
73
|
+
u != null && /* @__PURE__ */ e("div", { className: n(l.message, i?.message), children: u })
|
|
74
|
+
] }),
|
|
75
|
+
r === "inline" && v
|
|
63
76
|
] }),
|
|
64
|
-
|
|
77
|
+
r === "banner" && v,
|
|
78
|
+
c && /* @__PURE__ */ e(
|
|
65
79
|
"button",
|
|
66
80
|
{
|
|
67
81
|
type: "button",
|
|
68
|
-
className:
|
|
69
|
-
onClick:
|
|
70
|
-
"aria-label":
|
|
82
|
+
className: n(l.close, i?.close),
|
|
83
|
+
onClick: c,
|
|
84
|
+
"aria-label": h,
|
|
71
85
|
children: /* @__PURE__ */ e("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ e("path", { d: "M6.3 6.3a1 1 0 011.4 0L10 8.6l2.3-2.3a1 1 0 111.4 1.4L11.4 10l2.3 2.3a1 1 0 01-1.4 1.4L10 11.4l-2.3 2.3a1 1 0 01-1.4-1.4L8.6 10 6.3 7.7a1 1 0 010-1.4z" }) })
|
|
72
86
|
}
|
|
73
87
|
)
|
|
@@ -76,7 +90,7 @@ const p = {
|
|
|
76
90
|
);
|
|
77
91
|
}
|
|
78
92
|
);
|
|
79
|
-
|
|
93
|
+
g.displayName = "Alert";
|
|
80
94
|
export {
|
|
81
|
-
|
|
95
|
+
g as Alert
|
|
82
96
|
};
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
const c = "crk-root-KIhSk",
|
|
1
|
+
const c = "crk-root-KIhSk", n = "crk-info--J-F1", t = "crk-success-lftZT", s = "crk-warning-uOpos", o = "crk-danger-53-01", e = "crk-icon-RUu7X", r = "crk-content-9Fty2", a = "crk-text--Oyu2", i = "crk-action-a5XCP", k = "crk-banner-epaT8", g = "crk-sm-jB88A", l = "crk-title-QHuwO", u = "crk-message-Wd9FZ", m = "crk-close-yMuK-", d = {
|
|
2
2
|
root: c,
|
|
3
|
-
info:
|
|
4
|
-
success:
|
|
5
|
-
warning:
|
|
6
|
-
danger:
|
|
3
|
+
info: n,
|
|
4
|
+
success: t,
|
|
5
|
+
warning: s,
|
|
6
|
+
danger: o,
|
|
7
7
|
icon: e,
|
|
8
8
|
content: r,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
text: a,
|
|
10
|
+
action: i,
|
|
11
|
+
banner: k,
|
|
12
|
+
sm: g,
|
|
13
|
+
title: l,
|
|
14
|
+
message: u,
|
|
15
|
+
close: m
|
|
12
16
|
};
|
|
13
17
|
export {
|
|
14
|
-
|
|
18
|
+
i as action,
|
|
19
|
+
k as banner,
|
|
20
|
+
m as close,
|
|
15
21
|
r as content,
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
o as danger,
|
|
23
|
+
d as default,
|
|
18
24
|
e as icon,
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
n as info,
|
|
26
|
+
u as message,
|
|
21
27
|
c as root,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
g as sm,
|
|
29
|
+
t as success,
|
|
30
|
+
a as text,
|
|
31
|
+
l as title,
|
|
32
|
+
s as warning
|
|
25
33
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Alert } from './Alert';
|
|
2
|
-
export type { AlertProps, AlertClasses, AlertVariant } from './Alert';
|
|
2
|
+
export type { AlertProps, AlertClasses, AlertVariant, AlertLayout, AlertSize } from './Alert';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { forwardRef, ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface CardClasses {
|
|
3
|
+
root: string;
|
|
4
|
+
header: string;
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
actions: string;
|
|
8
|
+
body: string;
|
|
9
|
+
footer: string;
|
|
10
|
+
}
|
|
11
|
+
export type CardVariant = 'outlined' | 'elevated' | 'filled';
|
|
12
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
13
|
+
export interface CardTitleProps extends ComponentPropsWithRef<'h3'> {
|
|
14
|
+
/** Heading element to render. @default 'h3' */
|
|
15
|
+
as?: 'h2' | 'h3' | 'h4' | 'div';
|
|
16
|
+
}
|
|
17
|
+
declare const Title: import('react').ForwardRefExoticComponent<Omit<CardTitleProps, "ref"> & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
18
|
+
export interface CardHeaderProps extends Omit<ComponentPropsWithRef<'div'>, 'title'> {
|
|
19
|
+
/** Title text, rendered through `Card.Title` (replaces the native `title` attribute). */
|
|
20
|
+
title?: ReactNode;
|
|
21
|
+
/** Secondary line under the title. */
|
|
22
|
+
subtitle?: ReactNode;
|
|
23
|
+
/** Right-aligned slot (icon buttons, a menu, a badge). */
|
|
24
|
+
actions?: ReactNode;
|
|
25
|
+
/** Draw a bottom border between the header and the body. @default false */
|
|
26
|
+
divider?: boolean;
|
|
27
|
+
/** Custom content; rendered after the title block when both are given. */
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const Header: import('react').ForwardRefExoticComponent<Omit<CardHeaderProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export type CardBodyProps = ComponentPropsWithRef<'div'>;
|
|
32
|
+
declare const Body: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export interface CardFooterProps extends ComponentPropsWithRef<'div'> {
|
|
34
|
+
/** Horizontal alignment of the footer content. @default 'end' */
|
|
35
|
+
align?: 'start' | 'end' | 'between';
|
|
36
|
+
/** Draw a top border between the body and the footer. @default false */
|
|
37
|
+
divider?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare const Footer: import('react').ForwardRefExoticComponent<Omit<CardFooterProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
40
|
+
export interface CardProps extends ComponentPropsWithRef<'div'> {
|
|
41
|
+
/** Surface style. @default 'outlined' */
|
|
42
|
+
variant?: CardVariant;
|
|
43
|
+
/**
|
|
44
|
+
* Inner padding applied by `Card.Header` / `Card.Body` / `Card.Footer`
|
|
45
|
+
* (exposed as the `--crk-card-padding` variable). @default 'md'
|
|
46
|
+
*/
|
|
47
|
+
padding?: CardPadding;
|
|
48
|
+
/**
|
|
49
|
+
* Hover lift + pointer cursor + focus ring. With an `onClick` and no
|
|
50
|
+
* `href` the card also becomes a keyboard-operable `role="button"`.
|
|
51
|
+
* Implied by `href`. @default false
|
|
52
|
+
*/
|
|
53
|
+
interactive?: boolean;
|
|
54
|
+
/** Highlight the card as the current selection (primary border + ring). @default false */
|
|
55
|
+
selected?: boolean;
|
|
56
|
+
/** CSS colour of a 3px accent stripe on the left edge (e.g. `'var(--crk-color-success)'`). */
|
|
57
|
+
accent?: string;
|
|
58
|
+
/** Render the card as an `<a>` pointing here. Implies `interactive`. */
|
|
59
|
+
href?: string;
|
|
60
|
+
/** Anchor `target` (only with `href`). */
|
|
61
|
+
target?: string;
|
|
62
|
+
/** Anchor `rel` (only with `href`). */
|
|
63
|
+
rel?: string;
|
|
64
|
+
/** Override class names on internal elements. */
|
|
65
|
+
classes?: Partial<CardClasses>;
|
|
66
|
+
}
|
|
67
|
+
type CardComponent = ReturnType<typeof forwardRef<HTMLDivElement | HTMLAnchorElement, CardProps>> & {
|
|
68
|
+
Header: typeof Header;
|
|
69
|
+
Title: typeof Title;
|
|
70
|
+
Body: typeof Body;
|
|
71
|
+
Footer: typeof Footer;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Bordered content surface. Compose with `Card.Header` (title / subtitle /
|
|
75
|
+
* actions), `Card.Body` and `Card.Footer`; `Card.Title` is also exposed for
|
|
76
|
+
* custom headers. Renders an `<a>` when `href` is given.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* <Card interactive selected={id === current} onClick={() => select(id)}>
|
|
80
|
+
* <Card.Header title="Plan" subtitle="Billed yearly" actions={<Badge>Popular</Badge>} />
|
|
81
|
+
* <Card.Body>€9 / month</Card.Body>
|
|
82
|
+
* <Card.Footer><Button size="sm">Choose</Button></Card.Footer>
|
|
83
|
+
* </Card>
|
|
84
|
+
*/
|
|
85
|
+
export declare const Card: CardComponent;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as d, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, createContext as M, useContext as h } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
import e from "./Card.module.scss.js";
|
|
5
|
+
const f = M({ classes: {} }), b = v(
|
|
6
|
+
({ as: t = "h3", className: a, children: o, ...s }, r) => {
|
|
7
|
+
const { classes: l } = h(f);
|
|
8
|
+
return /* @__PURE__ */ d(t, { ref: r, className: n(e.title, l.title, a), ...s, children: o });
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
b.displayName = "Card.Title";
|
|
12
|
+
const P = v(
|
|
13
|
+
({ title: t, subtitle: a, actions: o, divider: s = !1, className: r, children: l, ...i }, p) => {
|
|
14
|
+
const { classes: c } = h(f), x = t != null || a != null;
|
|
15
|
+
return /* @__PURE__ */ T(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
ref: p,
|
|
19
|
+
className: n(e.header, s && e.headerDivider, c.header, r),
|
|
20
|
+
...i,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ T("div", { className: e.headerMain, children: [
|
|
23
|
+
x && /* @__PURE__ */ T("div", { className: e.titleBlock, children: [
|
|
24
|
+
t != null && /* @__PURE__ */ d(b, { children: t }),
|
|
25
|
+
a != null && /* @__PURE__ */ d("div", { className: n(e.subtitle, c.subtitle), children: a })
|
|
26
|
+
] }),
|
|
27
|
+
l
|
|
28
|
+
] }),
|
|
29
|
+
o != null && /* @__PURE__ */ d("div", { className: n(e.actions, c.actions), children: o })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
P.displayName = "Card.Header";
|
|
36
|
+
const $ = v(({ className: t, children: a, ...o }, s) => {
|
|
37
|
+
const { classes: r } = h(f);
|
|
38
|
+
return /* @__PURE__ */ d("div", { ref: s, className: n(e.body, r.body, t), ...o, children: a });
|
|
39
|
+
});
|
|
40
|
+
$.displayName = "Card.Body";
|
|
41
|
+
const w = v(
|
|
42
|
+
({ align: t = "end", divider: a = !1, className: o, children: s, ...r }, l) => {
|
|
43
|
+
const { classes: i } = h(f);
|
|
44
|
+
return /* @__PURE__ */ d(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
ref: l,
|
|
48
|
+
className: n(
|
|
49
|
+
e.footer,
|
|
50
|
+
e[`footer-${t}`],
|
|
51
|
+
a && e.footerDivider,
|
|
52
|
+
i.footer,
|
|
53
|
+
o
|
|
54
|
+
),
|
|
55
|
+
...r,
|
|
56
|
+
children: s
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
w.displayName = "Card.Footer";
|
|
62
|
+
const y = v(
|
|
63
|
+
({
|
|
64
|
+
variant: t = "outlined",
|
|
65
|
+
padding: a = "md",
|
|
66
|
+
interactive: o = !1,
|
|
67
|
+
selected: s = !1,
|
|
68
|
+
accent: r,
|
|
69
|
+
href: l,
|
|
70
|
+
target: i,
|
|
71
|
+
rel: p,
|
|
72
|
+
classes: c,
|
|
73
|
+
className: x,
|
|
74
|
+
style: g,
|
|
75
|
+
onClick: N,
|
|
76
|
+
onKeyDown: C,
|
|
77
|
+
children: E,
|
|
78
|
+
...k
|
|
79
|
+
}, D) => {
|
|
80
|
+
const B = l != null, F = o || B, u = F && !B && typeof N == "function", H = r != null ? { ...g, "--crk-card-accent": r } : g, j = n(
|
|
81
|
+
e.root,
|
|
82
|
+
e[t],
|
|
83
|
+
e[`padding-${a}`],
|
|
84
|
+
F && e.interactive,
|
|
85
|
+
s && e.selected,
|
|
86
|
+
r != null && e.accented,
|
|
87
|
+
c?.root,
|
|
88
|
+
x
|
|
89
|
+
), L = (m) => {
|
|
90
|
+
C?.(m), !(!u || m.defaultPrevented) && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), N?.(m));
|
|
91
|
+
}, I = /* @__PURE__ */ d(f.Provider, { value: { classes: c ?? {} }, children: E });
|
|
92
|
+
return B ? /* @__PURE__ */ d(
|
|
93
|
+
"a",
|
|
94
|
+
{
|
|
95
|
+
ref: D,
|
|
96
|
+
href: l,
|
|
97
|
+
target: i,
|
|
98
|
+
rel: p,
|
|
99
|
+
className: j,
|
|
100
|
+
style: H,
|
|
101
|
+
"data-selected": s || void 0,
|
|
102
|
+
onClick: N,
|
|
103
|
+
onKeyDown: C,
|
|
104
|
+
...k,
|
|
105
|
+
children: I
|
|
106
|
+
}
|
|
107
|
+
) : /* @__PURE__ */ d(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
ref: D,
|
|
111
|
+
className: j,
|
|
112
|
+
style: H,
|
|
113
|
+
"data-selected": s || void 0,
|
|
114
|
+
role: u ? "button" : void 0,
|
|
115
|
+
tabIndex: u ? 0 : void 0,
|
|
116
|
+
"aria-pressed": u && s ? !0 : void 0,
|
|
117
|
+
onClick: N,
|
|
118
|
+
onKeyDown: u ? L : C,
|
|
119
|
+
...k,
|
|
120
|
+
children: I
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
y.displayName = "Card";
|
|
126
|
+
y.Header = P;
|
|
127
|
+
y.Title = b;
|
|
128
|
+
y.Body = $;
|
|
129
|
+
y.Footer = w;
|
|
130
|
+
export {
|
|
131
|
+
y as Card
|
|
132
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const e = "crk-root-rJfoz", t = "crk-outlined-SPAas", o = "crk-elevated-SpUsJ", d = "crk-filled-63Znw", r = "crk-padding-none-E-idy", n = "crk-padding-sm-wEesL", c = "crk-padding-md-PxKrw", i = "crk-padding-lg-HGAEB", a = "crk-interactive-rmnPM", s = "crk-selected-h8Mud", k = "crk-accented-y-KUi", l = "crk-header-j-c-9", f = "crk-headerDivider-VkECC", g = "crk-headerMain-caD6k", p = "crk-titleBlock-2Gsho", v = "crk-title-DzwNA", h = "crk-subtitle-RVMlO", w = "crk-actions-kVLYd", b = "crk-body-v78vB", m = "crk-footer-FjLbG", u = "crk-footer-start-D2qu0", B = "crk-footer-end-oKz5B", D = "crk-footer-between-zPeGc", E = "crk-footerDivider-jOmZZ", M = {
|
|
2
|
+
root: e,
|
|
3
|
+
outlined: t,
|
|
4
|
+
elevated: o,
|
|
5
|
+
filled: d,
|
|
6
|
+
"padding-none": "crk-padding-none-E-idy",
|
|
7
|
+
paddingNone: r,
|
|
8
|
+
"padding-sm": "crk-padding-sm-wEesL",
|
|
9
|
+
paddingSm: n,
|
|
10
|
+
"padding-md": "crk-padding-md-PxKrw",
|
|
11
|
+
paddingMd: c,
|
|
12
|
+
"padding-lg": "crk-padding-lg-HGAEB",
|
|
13
|
+
paddingLg: i,
|
|
14
|
+
interactive: a,
|
|
15
|
+
selected: s,
|
|
16
|
+
accented: k,
|
|
17
|
+
header: l,
|
|
18
|
+
headerDivider: f,
|
|
19
|
+
headerMain: g,
|
|
20
|
+
titleBlock: p,
|
|
21
|
+
title: v,
|
|
22
|
+
subtitle: h,
|
|
23
|
+
actions: w,
|
|
24
|
+
body: b,
|
|
25
|
+
footer: m,
|
|
26
|
+
"footer-start": "crk-footer-start-D2qu0",
|
|
27
|
+
footerStart: u,
|
|
28
|
+
"footer-end": "crk-footer-end-oKz5B",
|
|
29
|
+
footerEnd: B,
|
|
30
|
+
"footer-between": "crk-footer-between-zPeGc",
|
|
31
|
+
footerBetween: D,
|
|
32
|
+
footerDivider: E
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
k as accented,
|
|
36
|
+
w as actions,
|
|
37
|
+
b as body,
|
|
38
|
+
M as default,
|
|
39
|
+
o as elevated,
|
|
40
|
+
d as filled,
|
|
41
|
+
m as footer,
|
|
42
|
+
D as footerBetween,
|
|
43
|
+
E as footerDivider,
|
|
44
|
+
B as footerEnd,
|
|
45
|
+
u as footerStart,
|
|
46
|
+
l as header,
|
|
47
|
+
f as headerDivider,
|
|
48
|
+
g as headerMain,
|
|
49
|
+
a as interactive,
|
|
50
|
+
t as outlined,
|
|
51
|
+
i as paddingLg,
|
|
52
|
+
c as paddingMd,
|
|
53
|
+
r as paddingNone,
|
|
54
|
+
n as paddingSm,
|
|
55
|
+
e as root,
|
|
56
|
+
s as selected,
|
|
57
|
+
h as subtitle,
|
|
58
|
+
v as title,
|
|
59
|
+
p as titleBlock
|
|
60
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export type ChipColor = 'neutral' | 'primary' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface ChipClasses {
|
|
4
|
+
root: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
avatar: string;
|
|
7
|
+
label: string;
|
|
8
|
+
remove: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ChipProps extends Omit<ComponentPropsWithRef<'button'>, 'color' | 'type'> {
|
|
11
|
+
/** Leading icon (hidden from assistive tech). */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** Leading round slot, e.g. `<Avatar size="xs" />`. */
|
|
14
|
+
avatar?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Renders a trailing "×" button that calls this. `Backspace` / `Delete` on a
|
|
17
|
+
* focused chip also removes it.
|
|
18
|
+
*/
|
|
19
|
+
onRemove?: () => void;
|
|
20
|
+
/** Accessible label of the remove button (the chip text is appended when it is a string). @default 'Remove' */
|
|
21
|
+
removeLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Makes the chip a toggle (`aria-pressed`). `true`/`false` is the current
|
|
24
|
+
* state; leave `undefined` for a plain chip.
|
|
25
|
+
*/
|
|
26
|
+
selected?: boolean;
|
|
27
|
+
/** Fires with the next toggle state when a `selected` chip is clicked. */
|
|
28
|
+
onSelectedChange?: (next: boolean) => void;
|
|
29
|
+
/** Non-interactive, muted; blocks click and remove. @default false */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Colour intent (same token trio as `Badge`). @default 'neutral' */
|
|
32
|
+
color?: ChipColor;
|
|
33
|
+
/** Fill style. @default 'soft' */
|
|
34
|
+
appearance?: 'soft' | 'outline';
|
|
35
|
+
/** Chip size. @default 'md' */
|
|
36
|
+
size?: 'sm' | 'md';
|
|
37
|
+
/** Corner style. @default 'pill' */
|
|
38
|
+
shape?: 'pill' | 'rounded';
|
|
39
|
+
/** Override class names on internal elements. */
|
|
40
|
+
classes?: Partial<ChipClasses>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interactive tag: removable (`onRemove`), toggleable (`selected` +
|
|
44
|
+
* `onSelectedChange`) or clickable (`onClick`). Renders a `<button>` when it
|
|
45
|
+
* is clickable, a `<span role="button">` when it is clickable *and* removable
|
|
46
|
+
* (the "×" is the only real button inside), and a plain `<span>` otherwise. For a read-only status pill use
|
|
47
|
+
* `Badge`; for a fixed set of toggle chips use `CheckboxGroup variant="chips"`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* <Chip onRemove={() => remove(tag)}>{tag}</Chip>
|
|
51
|
+
* <Chip selected={active} onSelectedChange={setActive} color="primary">Open</Chip>
|
|
52
|
+
*/
|
|
53
|
+
export declare const Chip: import('react').ForwardRefExoticComponent<Omit<ChipProps, "ref"> & import('react').RefAttributes<HTMLButtonElement | HTMLSpanElement>>;
|
|
54
|
+
export interface ChipGroupClasses {
|
|
55
|
+
root: string;
|
|
56
|
+
overflow: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ChipGroupProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
|
|
59
|
+
/** The chips. */
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
/** Show at most this many chips, then a "+N" overflow chip. */
|
|
62
|
+
max?: number;
|
|
63
|
+
/** Text of the overflow chip. @default (n) => `+${n}` */
|
|
64
|
+
overflowLabel?: (hidden: number) => ReactNode;
|
|
65
|
+
/** Makes the overflow chip a button (e.g. open a popover with the rest). */
|
|
66
|
+
onOverflowClick?: () => void;
|
|
67
|
+
/** Clicking "+N" reveals every chip; clicking the trailing "Show less" collapses again. @default false */
|
|
68
|
+
expandable?: boolean;
|
|
69
|
+
/** Label of the collapse chip when `expandable`. @default 'Show less' */
|
|
70
|
+
collapseLabel?: ReactNode;
|
|
71
|
+
/** Gap between chips. @default 'sm' */
|
|
72
|
+
gap?: 'sm' | 'md';
|
|
73
|
+
/** Wrap onto multiple lines. @default true */
|
|
74
|
+
wrap?: boolean;
|
|
75
|
+
/** Override class names on internal elements. */
|
|
76
|
+
classes?: Partial<ChipGroupClasses>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Lays out chips in a row with an optional `max` + "+N" overflow.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* <ChipGroup max={3} expandable>
|
|
83
|
+
* {tags.map((t) => <Chip key={t}>{t}</Chip>)}
|
|
84
|
+
* </ChipGroup>
|
|
85
|
+
*/
|
|
86
|
+
export declare const ChipGroup: import('react').ForwardRefExoticComponent<Omit<ChipGroupProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|