@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.
Files changed (156) hide show
  1. package/AGENTS.md +51 -7
  2. package/CHANGELOG.md +129 -0
  3. package/components/Accordion/Accordion.d.ts +94 -0
  4. package/components/Accordion/Accordion.js +180 -0
  5. package/components/Accordion/Accordion.module.scss.js +36 -0
  6. package/components/Accordion/index.d.ts +2 -0
  7. package/components/Alert/Alert.d.ts +29 -1
  8. package/components/Alert/Alert.js +44 -30
  9. package/components/Alert/Alert.module.scss.js +24 -16
  10. package/components/Alert/index.d.ts +1 -1
  11. package/components/Card/Card.d.ts +86 -0
  12. package/components/Card/Card.js +132 -0
  13. package/components/Card/Card.module.scss.js +60 -0
  14. package/components/Card/index.d.ts +2 -0
  15. package/components/Chip/Chip.d.ts +86 -0
  16. package/components/Chip/Chip.js +141 -0
  17. package/components/Chip/Chip.module.scss.js +59 -0
  18. package/components/Chip/index.d.ts +2 -0
  19. package/components/CodeBlock/CodeBlock.d.ts +78 -0
  20. package/components/CodeBlock/CodeBlock.js +120 -0
  21. package/components/CodeBlock/CodeBlock.module.scss.js +43 -0
  22. package/components/CodeBlock/index.d.ts +2 -0
  23. package/components/CommandPalette/CommandPalette.d.ts +141 -0
  24. package/components/CommandPalette/CommandPalette.js +397 -0
  25. package/components/CommandPalette/CommandPalette.module.scss.js +49 -0
  26. package/components/CommandPalette/index.d.ts +2 -0
  27. package/components/ConfirmDialog/ConfirmDialog.d.ts +119 -0
  28. package/components/ConfirmDialog/ConfirmDialog.js +201 -0
  29. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +21 -0
  30. package/components/ConfirmDialog/index.d.ts +2 -0
  31. package/components/Drawer/Drawer.d.ts +1 -0
  32. package/components/Drawer/Drawer.js +35 -36
  33. package/components/Drawer/Drawer.module.scss.js +20 -18
  34. package/components/Dropdown/Dropdown.d.ts +47 -7
  35. package/components/Dropdown/Dropdown.js +174 -81
  36. package/components/Dropdown/Dropdown.module.scss.js +40 -22
  37. package/components/Dropdown/DropdownItem.d.ts +31 -2
  38. package/components/Dropdown/DropdownItem.js +54 -27
  39. package/components/Dropdown/DropdownLabel.d.ts +11 -0
  40. package/components/Dropdown/DropdownLabel.js +11 -0
  41. package/components/Dropdown/DropdownSeparator.d.ts +12 -0
  42. package/components/Dropdown/DropdownSeparator.js +11 -0
  43. package/components/Dropdown/dropdownContext.d.ts +6 -0
  44. package/components/Dropdown/dropdownContext.js +5 -0
  45. package/components/Dropdown/index.d.ts +8 -2
  46. package/components/Dropdown/useContextMenu.d.ts +32 -0
  47. package/components/Dropdown/useContextMenu.js +18 -0
  48. package/components/EmptyState/EmptyState.d.ts +53 -0
  49. package/components/EmptyState/EmptyState.js +55 -0
  50. package/components/EmptyState/EmptyState.module.scss.js +25 -0
  51. package/components/EmptyState/index.d.ts +2 -0
  52. package/components/Form/FormField.js +25 -24
  53. package/components/ImageViewer/ImageViewer.d.ts +105 -0
  54. package/components/ImageViewer/ImageViewer.js +201 -0
  55. package/components/ImageViewer/ImageViewer.module.scss.js +47 -0
  56. package/components/ImageViewer/index.d.ts +4 -0
  57. package/components/ImageViewer/useZoomPan.d.ts +94 -0
  58. package/components/ImageViewer/useZoomPan.js +141 -0
  59. package/components/Kbd/Kbd.d.ts +26 -0
  60. package/components/Kbd/Kbd.js +22 -0
  61. package/components/Kbd/Kbd.module.scss.js +17 -0
  62. package/components/Kbd/index.d.ts +2 -0
  63. package/components/KeyValueList/KeyValueList.d.ts +84 -0
  64. package/components/KeyValueList/KeyValueList.js +127 -0
  65. package/components/KeyValueList/KeyValueList.module.scss.js +43 -0
  66. package/components/KeyValueList/index.d.ts +2 -0
  67. package/components/Modal/Modal.d.ts +1 -0
  68. package/components/Modal/Modal.js +40 -41
  69. package/components/Modal/Modal.module.scss.js +18 -16
  70. package/components/PageHeader/PageHeader.d.ts +61 -0
  71. package/components/PageHeader/PageHeader.js +73 -0
  72. package/components/PageHeader/PageHeader.module.scss.js +43 -0
  73. package/components/PageHeader/index.d.ts +2 -0
  74. package/components/ProgressBar/ProgressBar.d.ts +74 -0
  75. package/components/ProgressBar/ProgressBar.js +90 -0
  76. package/components/ProgressBar/ProgressBar.module.scss.js +51 -0
  77. package/components/ProgressBar/index.d.ts +2 -0
  78. package/components/RelativeTime/RelativeTime.d.ts +45 -0
  79. package/components/RelativeTime/RelativeTime.js +43 -0
  80. package/components/RelativeTime/RelativeTime.module.scss.js +7 -0
  81. package/components/RelativeTime/index.d.ts +2 -0
  82. package/components/SegmentedControl/SegmentedControl.d.ts +84 -0
  83. package/components/SegmentedControl/SegmentedControl.js +131 -0
  84. package/components/SegmentedControl/SegmentedControl.module.scss.js +39 -0
  85. package/components/SegmentedControl/index.d.ts +2 -0
  86. package/components/SplitPane/SplitPane.d.ts +61 -0
  87. package/components/SplitPane/SplitPane.js +171 -0
  88. package/components/SplitPane/SplitPane.module.scss.js +25 -0
  89. package/components/SplitPane/index.d.ts +2 -0
  90. package/components/StatCard/StatCard.d.ts +105 -0
  91. package/components/StatCard/StatCard.js +127 -0
  92. package/components/StatCard/StatCard.module.scss.js +72 -0
  93. package/components/StatCard/index.d.ts +2 -0
  94. package/components/StatusDot/StatusDot.d.ts +33 -0
  95. package/components/StatusDot/StatusDot.js +39 -0
  96. package/components/StatusDot/StatusDot.module.scss.js +32 -0
  97. package/components/StatusDot/index.d.ts +2 -0
  98. package/components/Table/Table.d.ts +100 -2
  99. package/components/Table/Table.js +371 -210
  100. package/components/Table/Table.module.scss.js +68 -46
  101. package/components/Table/index.d.ts +1 -1
  102. package/components/ThemeToggle/ThemeToggle.d.ts +38 -0
  103. package/components/ThemeToggle/ThemeToggle.js +97 -0
  104. package/components/ThemeToggle/ThemeToggle.module.scss.js +23 -0
  105. package/components/ThemeToggle/index.d.ts +2 -0
  106. package/components/inputs/Checkbox/Checkbox.d.ts +2 -0
  107. package/components/inputs/Checkbox/Checkbox.js +29 -28
  108. package/components/inputs/Checkbox/Checkbox.module.scss.js +8 -6
  109. package/components/inputs/Input/Input.d.ts +33 -1
  110. package/components/inputs/Input/Input.js +94 -35
  111. package/components/inputs/Input/Input.module.scss.js +14 -12
  112. package/components/inputs/Radio/Radio.d.ts +5 -4
  113. package/components/inputs/Radio/Radio.js +55 -50
  114. package/components/inputs/Radio/Radio.module.scss.js +12 -10
  115. package/components/inputs/SearchInput/SearchInput.d.ts +57 -0
  116. package/components/inputs/SearchInput/SearchInput.js +116 -0
  117. package/components/inputs/SearchInput/SearchInput.module.scss.js +13 -0
  118. package/components/inputs/SearchInput/index.d.ts +2 -0
  119. package/components/inputs/Select/Select.d.ts +52 -0
  120. package/components/inputs/Select/Select.js +494 -385
  121. package/components/inputs/Select/Select.module.scss.js +34 -30
  122. package/components/inputs/Switch/Switch.d.ts +15 -0
  123. package/components/inputs/Switch/Switch.js +8 -0
  124. package/components/inputs/Switch/index.d.ts +2 -0
  125. package/hooks/useDebouncedValue.d.ts +15 -0
  126. package/hooks/useDebouncedValue.js +15 -0
  127. package/hooks/useElementSize.d.ts +20 -0
  128. package/hooks/useElementSize.js +23 -0
  129. package/hooks/useKeyboard.d.ts +49 -5
  130. package/hooks/useKeyboard.js +66 -16
  131. package/hooks/useMediaQuery.d.ts +14 -0
  132. package/hooks/useMediaQuery.js +16 -0
  133. package/hooks/useNow.d.ts +14 -0
  134. package/hooks/useNow.js +35 -0
  135. package/hooks/usePersistedState.d.ts +30 -0
  136. package/hooks/usePersistedState.js +96 -0
  137. package/hooks/useResizable.d.ts +66 -0
  138. package/hooks/useResizable.js +105 -0
  139. package/hooks/useTheme.d.ts +33 -0
  140. package/hooks/useTheme.js +27 -0
  141. package/index.css +1 -1
  142. package/index.d.ts +58 -4
  143. package/index.js +208 -132
  144. package/index.layered.css +1 -1
  145. package/llms.txt +619 -25
  146. package/manifest.json +1739 -91
  147. package/package.json +1 -1
  148. package/recipes/confirm-modal.tsx +65 -53
  149. package/recipes/floating-copy-button.tsx +32 -28
  150. package/utils/formatBytes.d.ts +21 -0
  151. package/utils/formatBytes.js +14 -0
  152. package/utils/index.d.ts +6 -0
  153. package/utils/themeScript.d.ts +17 -0
  154. package/utils/themeScript.js +9 -0
  155. package/utils/timeAgo.d.ts +33 -0
  156. package/utils/timeAgo.js +37 -0
@@ -1,8 +1,8 @@
1
- import { jsxs as u, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
3
- import a from "clsx";
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 p = {
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
- }, z = f(
38
+ }, g = x(
39
39
  ({
40
- variant: d = "info",
41
- title: o,
42
- icon: i = !0,
43
- onClose: n,
44
- closeLabel: s = "Dismiss",
45
- classes: r,
46
- className: v,
47
- children: t,
48
- ...m
49
- }, h) => {
50
- const c = i === !0 ? p[d] : i === !1 ? null : i;
51
- return /* @__PURE__ */ u(
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: h,
57
+ ref: N,
55
58
  role: "alert",
56
- className: a(l.root, l[d], r?.root, v),
57
- ...m,
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
- c != null && /* @__PURE__ */ e("span", { className: a(l.icon, r?.icon), "aria-hidden": "true", children: c }),
60
- /* @__PURE__ */ u("div", { className: a(l.content, r?.content), children: [
61
- o != null && /* @__PURE__ */ e("div", { className: a(l.title, r?.title), children: o }),
62
- t != null && /* @__PURE__ */ e("div", { className: a(l.message, r?.message), children: t })
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
- n && /* @__PURE__ */ e(
77
+ r === "banner" && v,
78
+ c && /* @__PURE__ */ e(
65
79
  "button",
66
80
  {
67
81
  type: "button",
68
- className: a(l.close, r?.close),
69
- onClick: n,
70
- "aria-label": s,
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
- z.displayName = "Alert";
93
+ g.displayName = "Alert";
80
94
  export {
81
- z as Alert
95
+ g as Alert
82
96
  };
@@ -1,25 +1,33 @@
1
- const c = "crk-root-KIhSk", s = "crk-info--J-F1", n = "crk-success-lftZT", o = "crk-warning-uOpos", t = "crk-danger-53-01", e = "crk-icon-RUu7X", r = "crk-content-9Fty2", i = "crk-title-QHuwO", a = "crk-message-Wd9FZ", k = "crk-close-yMuK-", g = {
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: s,
4
- success: n,
5
- warning: o,
6
- danger: t,
3
+ info: n,
4
+ success: t,
5
+ warning: s,
6
+ danger: o,
7
7
  icon: e,
8
8
  content: r,
9
- title: i,
10
- message: a,
11
- close: k
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
- k as close,
18
+ i as action,
19
+ k as banner,
20
+ m as close,
15
21
  r as content,
16
- t as danger,
17
- g as default,
22
+ o as danger,
23
+ d as default,
18
24
  e as icon,
19
- s as info,
20
- a as message,
25
+ n as info,
26
+ u as message,
21
27
  c as root,
22
- n as success,
23
- i as title,
24
- o as warning
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,2 @@
1
+ export { Card } from './Card';
2
+ export type { CardProps, CardClasses, CardVariant, CardPadding, CardHeaderProps, CardTitleProps, CardBodyProps, CardFooterProps, } from './Card';
@@ -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>>;
@@ -0,0 +1,141 @@
1
+ import { jsxs as P, Fragment as j, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as S, useState as B, Children as E } from "react";
3
+ import l from "clsx";
4
+ import o from "./Chip.module.scss.js";
5
+ const K = S(
6
+ ({
7
+ icon: w,
8
+ avatar: a,
9
+ onRemove: s,
10
+ removeLabel: v = "Remove",
11
+ selected: e,
12
+ onSelectedChange: N,
13
+ disabled: n = !1,
14
+ color: k = "neutral",
15
+ appearance: u = "soft",
16
+ size: C = "md",
17
+ shape: D = "pill",
18
+ classes: d,
19
+ className: f,
20
+ children: h,
21
+ onClick: c,
22
+ onKeyDown: g,
23
+ ...y
24
+ }, m) => {
25
+ const i = e !== void 0, p = i || !!c, b = (t) => {
26
+ n || (i && N?.(!e), c?.(t));
27
+ }, $ = (t) => {
28
+ g?.(t), !t.defaultPrevented && s && !n && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), s());
29
+ }, x = l(
30
+ o.root,
31
+ o[k],
32
+ o[u],
33
+ o[C],
34
+ o[D],
35
+ p && o.interactive,
36
+ i && o.toggle,
37
+ e && o.selected,
38
+ n && o.disabled,
39
+ d?.root,
40
+ f
41
+ ), I = typeof h == "string" ? h : void 0, L = /* @__PURE__ */ P(j, { children: [
42
+ i && // Always rendered so it can transition; zero width when unselected,
43
+ // and the padding shrinks to match when selected — constant chip width.
44
+ /* @__PURE__ */ r("span", { className: l(o.check, e && o.checkVisible), "aria-hidden": "true" }),
45
+ a !== void 0 && /* @__PURE__ */ r("span", { className: l(o.avatar, d?.avatar), children: a }),
46
+ w !== void 0 && /* @__PURE__ */ r("span", { className: l(o.icon, d?.icon), "aria-hidden": "true", children: w }),
47
+ /* @__PURE__ */ r("span", { className: l(o.label, d?.label), children: h }),
48
+ s && /* @__PURE__ */ r(
49
+ "button",
50
+ {
51
+ type: "button",
52
+ className: l(o.remove, d?.remove),
53
+ "aria-label": I ? `${v} ${I}` : v,
54
+ disabled: n,
55
+ tabIndex: -1,
56
+ onClick: (t) => {
57
+ t.stopPropagation(), n || s();
58
+ },
59
+ children: /* @__PURE__ */ r("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M6.3 5.3a1 1 0 0 0-1.4 1.4L8.6 10l-3.7 3.3a1 1 0 1 0 1.4 1.4L10 11.4l3.3 3.3a1 1 0 0 0 1.4-1.4L11.4 10l3.3-3.3a1 1 0 0 0-1.4-1.4L10 8.6 6.3 5.3z" }) })
60
+ }
61
+ )
62
+ ] });
63
+ return p && !s ? /* @__PURE__ */ r(
64
+ "button",
65
+ {
66
+ ref: m,
67
+ type: "button",
68
+ className: x,
69
+ "aria-pressed": i ? e : void 0,
70
+ disabled: n,
71
+ onClick: b,
72
+ onKeyDown: $,
73
+ ...y,
74
+ children: L
75
+ }
76
+ ) : /* @__PURE__ */ r(
77
+ "span",
78
+ {
79
+ ref: m,
80
+ className: x,
81
+ role: p ? "button" : void 0,
82
+ "aria-pressed": i ? e : void 0,
83
+ "aria-disabled": n || void 0,
84
+ tabIndex: (p || s) && !n ? 0 : void 0,
85
+ onClick: p ? b : void 0,
86
+ onKeyDown: (t) => {
87
+ $(t), !(t.defaultPrevented || !p) && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), b(t));
88
+ },
89
+ ...y,
90
+ children: L
91
+ }
92
+ );
93
+ }
94
+ );
95
+ K.displayName = "Chip";
96
+ const G = S(
97
+ ({
98
+ children: w,
99
+ max: a,
100
+ overflowLabel: s = (f) => `+${f}`,
101
+ onOverflowClick: v,
102
+ expandable: e = !1,
103
+ collapseLabel: N = "Show less",
104
+ gap: n = "sm",
105
+ wrap: k = !0,
106
+ classes: u,
107
+ className: C,
108
+ ...D
109
+ }, d) => {
110
+ const [f, h] = B(!1), c = E.toArray(w), g = a !== void 0 && a >= 0 && !f && c.length > a, y = g ? c.slice(0, a) : c, m = c.length - y.length, i = e || !!v, p = () => {
111
+ e && h(!0), v?.();
112
+ };
113
+ return /* @__PURE__ */ P(
114
+ "div",
115
+ {
116
+ ref: d,
117
+ role: "group",
118
+ className: l(o.group, o[`gap-${n}`], k ? o.wrap : o.nowrap, u?.root, C),
119
+ ...D,
120
+ children: [
121
+ y,
122
+ g && /* @__PURE__ */ r(
123
+ K,
124
+ {
125
+ className: l(o.overflow, u?.overflow),
126
+ onClick: i ? p : void 0,
127
+ "aria-label": i ? `Show ${m} more` : void 0,
128
+ children: s(m)
129
+ }
130
+ ),
131
+ e && f && a !== void 0 && c.length > a && /* @__PURE__ */ r(K, { className: l(o.overflow, u?.overflow), onClick: () => h(!1), children: N })
132
+ ]
133
+ }
134
+ );
135
+ }
136
+ );
137
+ G.displayName = "ChipGroup";
138
+ export {
139
+ K as Chip,
140
+ G as ChipGroup
141
+ };