@pibit.ai/cure-design-system 0.1.0 → 0.2.1
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/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -20
- package/dist/patterns/index.d.ts +2 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/table/index.d.ts +2 -0
- package/dist/patterns/table/index.d.ts.map +1 -0
- package/dist/patterns/table/table.d.ts +80 -0
- package/dist/patterns/table/table.d.ts.map +1 -0
- package/dist/patterns/table/table.js +319 -0
- package/dist/primitives/avatar/avatar.js +1 -1
- package/dist/primitives/badge/badge.d.ts +1 -1
- package/dist/primitives/badge/badge.js +1 -1
- package/dist/primitives/button/button.d.ts +100 -27
- package/dist/primitives/button/button.d.ts.map +1 -1
- package/dist/primitives/button/button.js +212 -66
- package/dist/primitives/button/index.d.ts +1 -1
- package/dist/primitives/button/index.d.ts.map +1 -1
- package/dist/primitives/heading/heading.js +1 -1
- package/dist/primitives/icon/icons.d.ts +11 -0
- package/dist/primitives/icon/icons.d.ts.map +1 -0
- package/dist/primitives/input/input.js +1 -1
- package/dist/primitives/text/text.d.ts +3 -3
- package/dist/primitives/text/text.js +1 -1
- package/dist/styles/theme.css +1 -0
- package/dist/utils/cn.d.ts +10 -0
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +18 -5
- package/dist/utils/is-react-component.d.ts +20 -0
- package/dist/utils/is-react-component.d.ts.map +1 -0
- package/dist/utils/is-react-component.js +7 -0
- package/package.json +7 -2
- package/dist/components.css +0 -1
- package/dist/node_modules/class-variance-authority/dist/index.js +0 -35
- package/dist/node_modules/clsx/dist/clsx.js +0 -17
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2765
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Button, type ButtonProps } from './primitives/button';
|
|
1
|
+
export { Button, type ButtonProps, type Props as ButtonPropsAll, type CommonProps as ButtonCommonProps, styles as buttonStyles } from './primitives/button';
|
|
2
2
|
export { Input, type InputProps } from './primitives/input';
|
|
3
3
|
export { Checkbox, type CheckboxProps } from './primitives/checkbox';
|
|
4
4
|
export { Toggle, type ToggleProps } from './primitives/toggle';
|
|
@@ -7,5 +7,7 @@ export { Avatar, type AvatarProps } from './primitives/avatar';
|
|
|
7
7
|
export { Icon, type IconProps, type IconName } from './primitives/icon';
|
|
8
8
|
export { Text, type TextProps } from './primitives/text';
|
|
9
9
|
export { Heading, type HeadingProps } from './primitives/heading';
|
|
10
|
-
export {
|
|
10
|
+
export { Table, TableCard, TableCell } from './patterns/table';
|
|
11
|
+
export { cn, cx, sortCx } from './utils/cn';
|
|
12
|
+
export { isReactComponent, isFunctionComponent, isClassComponent, isForwardRefComponent } from './utils/is-react-component';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,KAAK,WAAW,IAAI,iBAAiB,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5J,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
|
+
import "./styles/theme.css";
|
|
1
2
|
/* empty css */
|
|
2
|
-
import { cn as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
3
|
+
import { cn as p, cx as m, sortCx as n } from "./utils/cn.js";
|
|
4
|
+
import { isClassComponent as f, isForwardRefComponent as a, isFunctionComponent as s, isReactComponent as l } from "./utils/is-react-component.js";
|
|
5
|
+
import { Button as i, styles as c } from "./primitives/button/button.js";
|
|
6
|
+
import { Input as T } from "./primitives/input/input.js";
|
|
7
|
+
import { Checkbox as g } from "./primitives/checkbox/checkbox.js";
|
|
8
|
+
import { Toggle as y } from "./primitives/toggle/toggle.js";
|
|
9
|
+
import { Badge as F } from "./primitives/badge/badge.js";
|
|
10
|
+
import { Avatar as R } from "./primitives/avatar/avatar.js";
|
|
11
|
+
import { Icon as k } from "./primitives/icon/icon.js";
|
|
12
|
+
import { Text as w } from "./primitives/text/text.js";
|
|
13
|
+
import { Heading as H } from "./primitives/heading/heading.js";
|
|
14
|
+
import { Table as j, TableCard as q, TableCell as z } from "./patterns/table/table.js";
|
|
12
15
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
R as Avatar,
|
|
17
|
+
F as Badge,
|
|
18
|
+
i as Button,
|
|
19
|
+
g as Checkbox,
|
|
20
|
+
H as Heading,
|
|
21
|
+
k as Icon,
|
|
22
|
+
T as Input,
|
|
23
|
+
j as Table,
|
|
24
|
+
q as TableCard,
|
|
25
|
+
z as TableCell,
|
|
26
|
+
w as Text,
|
|
27
|
+
y as Toggle,
|
|
28
|
+
c as buttonStyles,
|
|
29
|
+
p as cn,
|
|
30
|
+
m as cx,
|
|
31
|
+
f as isClassComponent,
|
|
32
|
+
a as isForwardRefComponent,
|
|
33
|
+
s as isFunctionComponent,
|
|
34
|
+
l as isReactComponent,
|
|
35
|
+
n as sortCx
|
|
23
36
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, HTMLAttributes, ReactNode, Ref, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
2
|
+
import { CellProps as AriaCellProps, ColumnProps as AriaColumnProps, RowProps as AriaRowProps, TableHeaderProps as AriaTableHeaderProps, TableProps as AriaTableProps, TableBody as AriaTableBody } from 'react-aria-components';
|
|
3
|
+
interface TableCardHeaderProps {
|
|
4
|
+
/** The title of the table card header. */
|
|
5
|
+
title: string;
|
|
6
|
+
/** The badge displayed next to the title. */
|
|
7
|
+
badge?: ReactNode;
|
|
8
|
+
/** The description of the table card header. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** The content displayed after the title and badge. */
|
|
11
|
+
contentTrailing?: ReactNode;
|
|
12
|
+
/** The class name of the table card header. */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
interface TableRootProps extends AriaTableProps, Omit<ComponentPropsWithRef<'table'>, 'className' | 'slot' | 'style'> {
|
|
16
|
+
size?: 'sm' | 'md';
|
|
17
|
+
isEditable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const TableRoot: {
|
|
20
|
+
({ className, size, isEditable, ...props }: TableRootProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
interface TableHeaderProps<T extends object> extends AriaTableHeaderProps<T>, Omit<ComponentPropsWithRef<'thead'>, 'children' | 'className' | 'slot' | 'style'> {
|
|
24
|
+
bordered?: boolean;
|
|
25
|
+
/** Whether any rows in the table are expandable */
|
|
26
|
+
hasExpandableRows?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const TableHeader: {
|
|
29
|
+
<T extends object>({ columns, children, bordered, hasExpandableRows, className, ...props }: TableHeaderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
interface TableHeadProps extends AriaColumnProps, Omit<ThHTMLAttributes<HTMLTableCellElement>, 'children' | 'className' | 'style' | 'id'> {
|
|
33
|
+
label?: string;
|
|
34
|
+
sticky?: 'left' | 'right';
|
|
35
|
+
stickyOffset?: number;
|
|
36
|
+
headerCellClass?: string;
|
|
37
|
+
}
|
|
38
|
+
declare const TableHead: {
|
|
39
|
+
({ className, label, children, sticky, stickyOffset, headerCellClass, ...props }: TableHeadProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
interface TableRowProps<T extends object> extends AriaRowProps<T>, Omit<ComponentPropsWithRef<'tr'>, 'children' | 'className' | 'onClick' | 'slot' | 'style' | 'id'> {
|
|
43
|
+
columns?: any[];
|
|
44
|
+
highlightSelectedRow?: boolean;
|
|
45
|
+
/** Whether this row is expandable */
|
|
46
|
+
isExpandable?: boolean;
|
|
47
|
+
/** Content to render when row is expanded */
|
|
48
|
+
renderExpandedContent?: (item: T) => ReactNode;
|
|
49
|
+
}
|
|
50
|
+
declare const TableRow: {
|
|
51
|
+
<T extends object>({ columns, children, className, highlightSelectedRow, isExpandable, renderExpandedContent, ...props }: TableRowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
54
|
+
interface TableCellProps extends AriaCellProps, Omit<TdHTMLAttributes<HTMLTableCellElement>, 'children' | 'className' | 'style' | 'id'> {
|
|
55
|
+
ref?: Ref<HTMLTableCellElement>;
|
|
56
|
+
sticky?: 'left' | 'right';
|
|
57
|
+
stickyOffset?: number;
|
|
58
|
+
}
|
|
59
|
+
declare const TableCell: {
|
|
60
|
+
({ className, children, sticky, stickyOffset, ...props }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
displayName: string;
|
|
62
|
+
};
|
|
63
|
+
declare const TableCard: {
|
|
64
|
+
Root: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
65
|
+
size?: "sm" | "md";
|
|
66
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
67
|
+
Header: {
|
|
68
|
+
({ title, badge, description, contentTrailing, className }: TableCardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
displayName: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
declare const Table: typeof TableRoot & {
|
|
73
|
+
Body: typeof AriaTableBody;
|
|
74
|
+
Cell: typeof TableCell;
|
|
75
|
+
Head: typeof TableHead;
|
|
76
|
+
Header: typeof TableHeader;
|
|
77
|
+
Row: typeof TableRow;
|
|
78
|
+
};
|
|
79
|
+
export { Table, TableCard, TableCell };
|
|
80
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/table.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { jsx as o, jsxs as v, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as W, useContext as y, createContext as F, useState as N, isValidElement as O, useRef as G, useEffect as L, Children as M, cloneElement as I } from "react";
|
|
3
|
+
import { Table as k, useTableOptions as w, Cell as T, TableBody as J, Column as z, Group as Q, TableHeader as X, Collection as A, Row as B } from "react-aria-components";
|
|
4
|
+
import { cn as d } from "../../utils/cn.js";
|
|
5
|
+
import { Badge as Y } from "../../primitives/badge/badge.js";
|
|
6
|
+
import { Icon as S } from "../../primitives/icon/icon.js";
|
|
7
|
+
import { Checkbox as P } from "../../primitives/checkbox/checkbox.js";
|
|
8
|
+
const g = F({
|
|
9
|
+
size: "md",
|
|
10
|
+
expandedRows: /* @__PURE__ */ new Set(),
|
|
11
|
+
toggleRow: () => {
|
|
12
|
+
}
|
|
13
|
+
}), D = W(
|
|
14
|
+
({ children: l, className: s, size: n = "md", ...c }, e) => {
|
|
15
|
+
const i = G(null), [a, f] = N(!1), [h, t] = N(/* @__PURE__ */ new Set());
|
|
16
|
+
L(() => {
|
|
17
|
+
const r = i.current;
|
|
18
|
+
if (!r) return;
|
|
19
|
+
const p = () => {
|
|
20
|
+
const { scrollWidth: R, clientWidth: C } = r;
|
|
21
|
+
f(R > C);
|
|
22
|
+
};
|
|
23
|
+
p();
|
|
24
|
+
const u = new ResizeObserver(p);
|
|
25
|
+
return u.observe(r), () => {
|
|
26
|
+
u.disconnect();
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
const b = (r) => {
|
|
30
|
+
t((p) => {
|
|
31
|
+
const u = new Set(p);
|
|
32
|
+
return u.has(r) ? u.delete(r) : u.add(r), u;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ o(g.Provider, { value: { size: n, hasOverflow: a, expandedRows: h, toggleRow: b }, children: /* @__PURE__ */ o(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
ref: (r) => {
|
|
39
|
+
i.current = r, typeof e == "function" ? e(r) : e && (e.current = r);
|
|
40
|
+
},
|
|
41
|
+
...c,
|
|
42
|
+
className: d("overflow-hidden rounded-lg bg-[var(--color-bg-primary)]", s),
|
|
43
|
+
children: l
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
D.displayName = "TableCardRoot";
|
|
49
|
+
const E = ({ title: l, badge: s, description: n, contentTrailing: c, className: e }) => {
|
|
50
|
+
const { size: i } = y(g);
|
|
51
|
+
return /* @__PURE__ */ v(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: d(
|
|
55
|
+
"relative flex flex-col items-start gap-4 border-b border-[var(--color-border-secondary)] bg-[var(--color-bg-primary)] px-4 md:flex-row",
|
|
56
|
+
i === "sm" ? "py-2 md:px-4" : "py-3 md:px-6",
|
|
57
|
+
e
|
|
58
|
+
),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ v("div", { className: "flex flex-1 flex-col gap-0.5", children: [
|
|
61
|
+
/* @__PURE__ */ v("div", { className: "flex items-center gap-2", children: [
|
|
62
|
+
/* @__PURE__ */ o("h2", { className: d("font-semibold text-[var(--color-text-primary)]", i === "sm" ? "text-md" : "text-lg"), children: l }),
|
|
63
|
+
s ? O(s) ? s : /* @__PURE__ */ o(Y, { variant: "primary", size: "sm", children: s }) : null
|
|
64
|
+
] }),
|
|
65
|
+
n && /* @__PURE__ */ o("p", { className: "text-sm text-[var(--color-text-tertiary)]", children: n })
|
|
66
|
+
] }),
|
|
67
|
+
c
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
E.displayName = "TableCardHeader";
|
|
73
|
+
const q = ({ className: l, size: s = "md", isEditable: n = !1, ...c }) => {
|
|
74
|
+
const e = y(g), [i, a] = N(/* @__PURE__ */ new Set()), f = (e == null ? void 0 : e.expandedRows) ?? i, h = (e == null ? void 0 : e.toggleRow) ?? ((t) => {
|
|
75
|
+
a((b) => {
|
|
76
|
+
const r = new Set(b);
|
|
77
|
+
return r.has(t) ? r.delete(t) : r.add(t), r;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
return /* @__PURE__ */ o(
|
|
81
|
+
g.Provider,
|
|
82
|
+
{
|
|
83
|
+
value: {
|
|
84
|
+
size: (e == null ? void 0 : e.size) ?? s,
|
|
85
|
+
hasOverflow: e == null ? void 0 : e.hasOverflow,
|
|
86
|
+
expandedRows: f,
|
|
87
|
+
toggleRow: h
|
|
88
|
+
},
|
|
89
|
+
children: n ? /* @__PURE__ */ o(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
onKeyDownCapture: (t) => {
|
|
93
|
+
if ((/* @__PURE__ */ new Set([
|
|
94
|
+
"ArrowLeft",
|
|
95
|
+
"ArrowRight",
|
|
96
|
+
"ArrowUp",
|
|
97
|
+
"ArrowDown",
|
|
98
|
+
"Home",
|
|
99
|
+
"End",
|
|
100
|
+
"PageUp",
|
|
101
|
+
"PageDown",
|
|
102
|
+
" "
|
|
103
|
+
// space
|
|
104
|
+
])).has(t.key)) {
|
|
105
|
+
const r = t.target;
|
|
106
|
+
r && (r.closest('[contenteditable]:not([contenteditable="false"])') || r.closest("input, textarea") || r.closest('[role="textbox"]')) && t.stopPropagation();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
children: /* @__PURE__ */ o(
|
|
110
|
+
k,
|
|
111
|
+
{
|
|
112
|
+
className: (t) => d("w-full overflow-x-hidden", typeof l == "function" ? l(t) : l),
|
|
113
|
+
...c
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
) : /* @__PURE__ */ o(
|
|
118
|
+
k,
|
|
119
|
+
{
|
|
120
|
+
className: (t) => d("w-full overflow-x-hidden", typeof l == "function" ? l(t) : l),
|
|
121
|
+
...c
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
q.displayName = "Table";
|
|
128
|
+
const j = ({
|
|
129
|
+
columns: l,
|
|
130
|
+
children: s,
|
|
131
|
+
bordered: n = !1,
|
|
132
|
+
hasExpandableRows: c = !1,
|
|
133
|
+
className: e,
|
|
134
|
+
...i
|
|
135
|
+
}) => {
|
|
136
|
+
const { size: a } = y(g), { selectionBehavior: f, selectionMode: h } = w();
|
|
137
|
+
return /* @__PURE__ */ v(
|
|
138
|
+
X,
|
|
139
|
+
{
|
|
140
|
+
...i,
|
|
141
|
+
className: (t) => d(
|
|
142
|
+
"sticky top-0 z-30 bg-[var(--color-bg-secondary)] rounded-lg h-11",
|
|
143
|
+
// Row border—using an "after" pseudo-element to avoid the border taking up space.
|
|
144
|
+
n && "[&>tr>th]:after:pointer-events-none [&>tr>th]:after:absolute [&>tr>th]:after:inset-x-0 [&>tr>th]:after:bottom-0 [&>tr>th]:after:h-px [&>tr>th]:after:bg-border-tertiary [&>tr>th]:focus-visible:after:bg-transparent",
|
|
145
|
+
typeof e == "function" ? e(t) : e
|
|
146
|
+
),
|
|
147
|
+
children: [
|
|
148
|
+
c && /* @__PURE__ */ o(z, { className: d("relative p-0", a === "sm" ? "w-9" : "w-11") }),
|
|
149
|
+
f === "toggle" && /* @__PURE__ */ o(z, { className: d("relative p-0", a === "sm" ? "w-9" : "w-11"), children: h === "multiple" && /* @__PURE__ */ o("div", { className: "flex items-start", children: /* @__PURE__ */ o(P, { slot: "selection" }) }) }),
|
|
150
|
+
/* @__PURE__ */ o(A, { items: l, children: s })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
j.displayName = "TableHeader";
|
|
156
|
+
const K = ({
|
|
157
|
+
className: l,
|
|
158
|
+
label: s,
|
|
159
|
+
children: n,
|
|
160
|
+
sticky: c,
|
|
161
|
+
stickyOffset: e = 0,
|
|
162
|
+
headerCellClass: i,
|
|
163
|
+
...a
|
|
164
|
+
}) => {
|
|
165
|
+
const { selectionBehavior: f } = w(), { size: h } = y(g);
|
|
166
|
+
return /* @__PURE__ */ o(
|
|
167
|
+
z,
|
|
168
|
+
{
|
|
169
|
+
...a,
|
|
170
|
+
style: (t) => {
|
|
171
|
+
const b = c ? {
|
|
172
|
+
position: "sticky",
|
|
173
|
+
[c]: e,
|
|
174
|
+
zIndex: 30
|
|
175
|
+
} : {};
|
|
176
|
+
return { ...typeof a.style == "function" ? a.style(t) : a.style || {}, ...b };
|
|
177
|
+
},
|
|
178
|
+
className: (t) => d(
|
|
179
|
+
"relative p-0 outline-hidden focus-visible:z-1 focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] focus-visible:ring-offset-[var(--color-bg-primary)] focus-visible:ring-inset",
|
|
180
|
+
h === "sm" && "px-4 py-2",
|
|
181
|
+
h === "md" && "px-6 py-2",
|
|
182
|
+
f === "toggle" && "nth-2:pl-3",
|
|
183
|
+
c && "bg-[var(--color-bg-secondary)]",
|
|
184
|
+
t.allowsSorting && "cursor-pointer",
|
|
185
|
+
typeof l == "function" ? l(t) : l
|
|
186
|
+
),
|
|
187
|
+
children: (t) => /* @__PURE__ */ v(Q, { className: d("flex items-center gap-1", i), children: [
|
|
188
|
+
/* @__PURE__ */ v("div", { className: "flex items-center gap-1 overflow-hidden", children: [
|
|
189
|
+
s && /* @__PURE__ */ o("span", { className: "text-xs font-semibold whitespace-nowrap overflow-hidden text-ellipsis text-[var(--color-text-quaternary)]", children: s }),
|
|
190
|
+
typeof n == "function" ? n(t) : n
|
|
191
|
+
] }),
|
|
192
|
+
t.allowsSorting && (t.sortDirection ? /* @__PURE__ */ o(
|
|
193
|
+
S,
|
|
194
|
+
{
|
|
195
|
+
name: "ArrowDown",
|
|
196
|
+
size: 12,
|
|
197
|
+
className: d(
|
|
198
|
+
"stroke-[3px] text-[var(--color-text-quaternary)]",
|
|
199
|
+
t.sortDirection === "ascending" && "rotate-180"
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
) : /* @__PURE__ */ o(S, { name: "ChevronSelectorVertical", size: 12, className: "text-[var(--color-text-quaternary)]" }))
|
|
203
|
+
] })
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
K.displayName = "TableHead";
|
|
208
|
+
const $ = ({
|
|
209
|
+
columns: l,
|
|
210
|
+
children: s,
|
|
211
|
+
className: n,
|
|
212
|
+
highlightSelectedRow: c = !0,
|
|
213
|
+
isExpandable: e = !1,
|
|
214
|
+
renderExpandedContent: i,
|
|
215
|
+
...a
|
|
216
|
+
}) => {
|
|
217
|
+
const { size: f, expandedRows: h, toggleRow: t } = y(g), { selectionBehavior: b } = w(), r = typeof a.id == "string" ? a.id : String(a.id), p = h.has(r), R = e ? /* @__PURE__ */ o(
|
|
218
|
+
"button",
|
|
219
|
+
{
|
|
220
|
+
type: "button",
|
|
221
|
+
onClick: (m) => {
|
|
222
|
+
m.stopPropagation(), t(r);
|
|
223
|
+
},
|
|
224
|
+
className: d(
|
|
225
|
+
"flex items-center justify-center transition-transform duration-200 ease-in-out cursor-pointer hover:bg-[var(--color-bg-secondary_hover)] rounded p-1 flex-shrink-0 -ml-1 mr-2",
|
|
226
|
+
p && "rotate-90"
|
|
227
|
+
),
|
|
228
|
+
"aria-label": p ? "Collapse row" : "Expand row",
|
|
229
|
+
children: /* @__PURE__ */ o(S, { name: "ChevronRight", size: 16, className: "text-[var(--color-text-quaternary)]" })
|
|
230
|
+
}
|
|
231
|
+
) : null, C = e ? (() => {
|
|
232
|
+
const m = M.toArray(s);
|
|
233
|
+
if (m.length > 0 && O(m[0])) {
|
|
234
|
+
const H = m[0], _ = H.props;
|
|
235
|
+
return [
|
|
236
|
+
I(H, {
|
|
237
|
+
..._,
|
|
238
|
+
children: /* @__PURE__ */ v("div", { className: "flex items-center gap-2", children: [
|
|
239
|
+
R,
|
|
240
|
+
_.children
|
|
241
|
+
] })
|
|
242
|
+
}),
|
|
243
|
+
...m.slice(1)
|
|
244
|
+
];
|
|
245
|
+
}
|
|
246
|
+
return s;
|
|
247
|
+
})() : s;
|
|
248
|
+
return /* @__PURE__ */ v(V, { children: [
|
|
249
|
+
/* @__PURE__ */ v(
|
|
250
|
+
B,
|
|
251
|
+
{
|
|
252
|
+
...a,
|
|
253
|
+
className: (m) => d(
|
|
254
|
+
"relative outline-[var(--color-focus-ring)] transition-colors after:pointer-events-none hover:bg-[var(--color-bg-secondary_hover)] focus-visible:outline-2 focus-visible:-outline-offset-2",
|
|
255
|
+
f === "sm" ? "h-12" : "h-18",
|
|
256
|
+
c && "selected:bg-[var(--color-bg-secondary)]",
|
|
257
|
+
// Row border—using an "after" pseudo-element to avoid the border taking up space.
|
|
258
|
+
!p && "[&>td]:after:absolute [&>td]:after:inset-x-0 [&>td]:after:bottom-0 [&>td]:after:h-px [&>td]:after:w-full [&>td]:after:bg-border-tertiary last:[&>td]:after:hidden [&>td]:focus-visible:after:opacity-0 focus-visible:[&>td]:after:opacity-0",
|
|
259
|
+
typeof n == "function" ? n(m) : n
|
|
260
|
+
),
|
|
261
|
+
children: [
|
|
262
|
+
b === "toggle" && /* @__PURE__ */ o(T, { className: d("relative p-0", f === "sm" ? "w-9" : "w-11"), children: /* @__PURE__ */ o("div", { className: "flex items-end", children: /* @__PURE__ */ o(P, { className: "hidden", slot: "selection" }) }) }),
|
|
263
|
+
/* @__PURE__ */ o(A, { items: l, children: C })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
e && p && i && /* @__PURE__ */ o(B, { id: `${r}-expanded`, className: "relative bg-[var(--color-bg-secondary_hover)]", children: /* @__PURE__ */ o(
|
|
268
|
+
T,
|
|
269
|
+
{
|
|
270
|
+
className: "p-0",
|
|
271
|
+
colSpan: (l == null ? void 0 : l.length) || 0,
|
|
272
|
+
children: /* @__PURE__ */ o("div", { className: d("w-full"), children: i(a.value) })
|
|
273
|
+
}
|
|
274
|
+
) })
|
|
275
|
+
] });
|
|
276
|
+
};
|
|
277
|
+
$.displayName = "TableRow";
|
|
278
|
+
const U = ({ className: l, children: s, sticky: n, stickyOffset: c = 0, ...e }) => {
|
|
279
|
+
const { size: i } = y(g), { selectionBehavior: a } = w();
|
|
280
|
+
return /* @__PURE__ */ o(
|
|
281
|
+
T,
|
|
282
|
+
{
|
|
283
|
+
...e,
|
|
284
|
+
style: (f) => {
|
|
285
|
+
const h = n ? {
|
|
286
|
+
position: "sticky",
|
|
287
|
+
[n]: c,
|
|
288
|
+
zIndex: 20
|
|
289
|
+
} : {};
|
|
290
|
+
return { ...typeof e.style == "function" ? e.style(f) : e.style || {}, ...h };
|
|
291
|
+
},
|
|
292
|
+
className: (f) => d(
|
|
293
|
+
"relative text-sm text-[var(--color-text-tertiary)] outline-[var(--color-focus-ring)] focus-visible:z-1 focus-visible:outline-2 focus-visible:-outline-offset-2",
|
|
294
|
+
i === "sm" && "p-0 px-4 py-2",
|
|
295
|
+
i === "md" && "p-0 px-6 py-2",
|
|
296
|
+
a === "toggle" && "nth-2:pl-3",
|
|
297
|
+
n === "left" && "before:absolute before:top-0 before:right-0 before:h-full before:shadow-[4px_0_8px_2px_rgba(0,0,0,0.15)]",
|
|
298
|
+
n === "right" && "z-[2000] bg-[var(--color-bg-primary)] hover:bg-inherit before:absolute before:top-0 before:left-0 before:h-full before:shadow-[-4px_0_8px_2px_rgba(0,0,0,0.15)]",
|
|
299
|
+
typeof l == "function" ? l(f) : l
|
|
300
|
+
),
|
|
301
|
+
children: s
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
U.displayName = "TableCell";
|
|
306
|
+
const se = {
|
|
307
|
+
Root: D,
|
|
308
|
+
Header: E
|
|
309
|
+
}, x = q;
|
|
310
|
+
x.Body = J;
|
|
311
|
+
x.Cell = U;
|
|
312
|
+
x.Head = K;
|
|
313
|
+
x.Header = j;
|
|
314
|
+
x.Row = $;
|
|
315
|
+
export {
|
|
316
|
+
x as Table,
|
|
317
|
+
se as TableCard,
|
|
318
|
+
U as TableCell
|
|
319
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "@radix-ui/react-avatar";
|
|
3
|
-
import { cva as n } from "
|
|
3
|
+
import { cva as n } from "class-variance-authority";
|
|
4
4
|
import { cn as r } from "../../utils/cn.js";
|
|
5
5
|
const f = n("relative inline-flex shrink-0 overflow-hidden rounded-full", {
|
|
6
6
|
variants: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "primary" | "
|
|
4
|
+
variant?: "primary" | "default" | "error" | "success" | "warning" | "outline" | null | undefined;
|
|
5
5
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface BadgeProps extends VariantProps<typeof badgeVariants> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as n, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { cva as d } from "
|
|
2
|
+
import { cva as d } from "class-variance-authority";
|
|
3
3
|
import { cn as m } from "../../utils/cn.js";
|
|
4
4
|
const g = d(
|
|
5
5
|
"inline-flex items-center gap-1 rounded-md font-medium",
|
|
@@ -1,34 +1,107 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, DetailedHTMLProps, FC, ReactNode } from 'react';
|
|
1
2
|
import { ButtonProps as AriaButtonProps } from 'react-aria-components';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
export declare const styles: {
|
|
4
|
+
common: {
|
|
5
|
+
root: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
};
|
|
8
|
+
sizes: {
|
|
9
|
+
xs: {
|
|
10
|
+
root: string;
|
|
11
|
+
linkRoot: string;
|
|
12
|
+
};
|
|
13
|
+
sm: {
|
|
14
|
+
root: string;
|
|
15
|
+
linkRoot: string;
|
|
16
|
+
};
|
|
17
|
+
md: {
|
|
18
|
+
root: string;
|
|
19
|
+
linkRoot: string;
|
|
20
|
+
};
|
|
21
|
+
lg: {
|
|
22
|
+
root: string;
|
|
23
|
+
linkRoot: string;
|
|
24
|
+
};
|
|
25
|
+
xl: {
|
|
26
|
+
root: string;
|
|
27
|
+
linkRoot: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
colors: {
|
|
31
|
+
primary: {
|
|
32
|
+
root: string;
|
|
33
|
+
};
|
|
34
|
+
secondary: {
|
|
35
|
+
root: string;
|
|
36
|
+
};
|
|
37
|
+
tertiary: {
|
|
38
|
+
root: string;
|
|
39
|
+
};
|
|
40
|
+
'link-gray': {
|
|
41
|
+
root: string;
|
|
42
|
+
};
|
|
43
|
+
'link-color': {
|
|
44
|
+
root: string;
|
|
45
|
+
};
|
|
46
|
+
'primary-destructive': {
|
|
47
|
+
root: string;
|
|
48
|
+
};
|
|
49
|
+
'secondary-destructive': {
|
|
50
|
+
root: string;
|
|
51
|
+
};
|
|
52
|
+
'tertiary-destructive': {
|
|
53
|
+
root: string;
|
|
54
|
+
};
|
|
55
|
+
'link-destructive': {
|
|
56
|
+
root: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Common props shared between button and anchor variants
|
|
62
|
+
*/
|
|
63
|
+
export interface CommonProps {
|
|
64
|
+
/** Disables the button and shows a disabled state */
|
|
65
|
+
isDisabled?: boolean;
|
|
66
|
+
/** Shows a loading spinner and disables the button */
|
|
67
|
+
isLoading?: boolean;
|
|
68
|
+
/** The size variant of the button */
|
|
69
|
+
size?: keyof typeof styles.sizes;
|
|
70
|
+
/** The color variant of the button */
|
|
71
|
+
color?: keyof typeof styles.colors;
|
|
72
|
+
/** Icon component or element to show before the text */
|
|
73
|
+
iconLeading?: FC<{
|
|
74
|
+
className?: string;
|
|
75
|
+
}> | ReactNode;
|
|
76
|
+
/** Icon component or element to show after the text */
|
|
77
|
+
iconTrailing?: FC<{
|
|
78
|
+
className?: string;
|
|
79
|
+
}> | ReactNode;
|
|
80
|
+
/** Removes horizontal padding from the text content */
|
|
81
|
+
noTextPadding?: boolean;
|
|
82
|
+
/** When true, keeps the text visible during loading state */
|
|
83
|
+
showTextWhileLoading?: boolean;
|
|
84
|
+
childrenClassName?: string;
|
|
85
|
+
trailingClassName?: string;
|
|
86
|
+
leadingClassName?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Props for the button variant (non-link)
|
|
90
|
+
*/
|
|
91
|
+
export interface ButtonProps extends CommonProps, DetailedHTMLProps<Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'slot'>, HTMLButtonElement> {
|
|
92
|
+
/** Slot name for react-aria component */
|
|
93
|
+
slot?: AriaButtonProps['slot'];
|
|
14
94
|
}
|
|
15
95
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Features:
|
|
19
|
-
* - Keyboard navigation (Space/Enter)
|
|
20
|
-
* - Disabled state management
|
|
21
|
-
* - Focus management
|
|
22
|
-
* - Multiple variants and sizes
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* <Button>Click me</Button>
|
|
26
|
-
* <Button variant="secondary" size="lg">Large Button</Button>
|
|
27
|
-
* <Button isDisabled>Disabled</Button>
|
|
96
|
+
* Props for the link variant (anchor tag)
|
|
28
97
|
*/
|
|
29
|
-
|
|
30
|
-
export declare namespace Button {
|
|
31
|
-
var displayName: string;
|
|
98
|
+
interface LinkProps extends CommonProps, DetailedHTMLProps<Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'color'>, HTMLAnchorElement> {
|
|
32
99
|
}
|
|
100
|
+
/** Union type of button and link props */
|
|
101
|
+
export type Props = ButtonProps | LinkProps;
|
|
102
|
+
export declare const Button: {
|
|
103
|
+
({ size, color, children, className, noTextPadding, iconLeading: IconLeading, iconTrailing: IconTrailing, isDisabled: disabled, isLoading: loading, showTextWhileLoading, childrenClassName, trailingClassName, leadingClassName, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
104
|
+
displayName: string;
|
|
105
|
+
};
|
|
33
106
|
export {};
|
|
34
107
|
//# sourceMappingURL=button.d.ts.map
|