@agentero/design-system 0.25.2 → 0.25.4
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/mcp/manifests/components.html +36 -18
- package/mcp/manifests/components.json +25 -6
- package/package.json +1 -1
- package/src/button/button.d.ts +25 -4
- package/src/button/button.js +17 -16
- package/src/data-table/data-table.js +22 -22
- package/src/data-table/index.d.ts +4 -143
- package/src/data-table/index.js +8 -10
- package/src/pagination/pagination.js +1 -3
- package/src/table/index.d.ts +1 -0
|
@@ -594,7 +594,7 @@
|
|
|
594
594
|
<main>
|
|
595
595
|
<div class="wrap">
|
|
596
596
|
<div class="note ok" style="margin-bottom: 16px;">
|
|
597
|
-
Using <code>react-component-meta</code>. Generation took <strong>3.
|
|
597
|
+
Using <code>react-component-meta</code>. Generation took <strong>3.3s</strong>.
|
|
598
598
|
</div>
|
|
599
599
|
<h2 class="section-title">Components</h2>
|
|
600
600
|
<div class="grid" role="list">
|
|
@@ -2019,7 +2019,7 @@ variant?: "circle" | "square" | "pillow" | "p
|
|
|
2019
2019
|
<div class="title">
|
|
2020
2020
|
<h2><span class="status-dot dot-ok"></span> Button</h2>
|
|
2021
2021
|
<div class="badges">
|
|
2022
|
-
<label for="c-4-components-button-props" class="badge ok as-toggle">
|
|
2022
|
+
<label for="c-4-components-button-props" class="badge ok as-toggle">13 prop types</label>
|
|
2023
2023
|
|
|
2024
2024
|
<label for="c-4-components-button-stories" class="badge ok as-toggle">11 stories</label>
|
|
2025
2025
|
|
|
@@ -2061,7 +2061,7 @@ without Button binding to any particular framework.</div>
|
|
|
2061
2061
|
<div class="note ok">
|
|
2062
2062
|
<div class="row">
|
|
2063
2063
|
<span class="ex-name">Prop types <small>(react-component-meta)</small></span>
|
|
2064
|
-
<span class="badge ok">
|
|
2064
|
+
<span class="badge ok">13 prop types</span>
|
|
2065
2065
|
</div>
|
|
2066
2066
|
<pre><code>Component: src/button/button.tsx::Button</code></pre>
|
|
2067
2067
|
<pre><code>Props:</code></pre>
|
|
@@ -2139,6 +2139,18 @@ ref?: Ref<HTMLButtonElement | HTMLAnchorElement> | undefined
|
|
|
2139
2139
|
*/
|
|
2140
2140
|
rounded?: boolean
|
|
2141
2141
|
|
|
2142
|
+
/**
|
|
2143
|
+
* When `true`, the button dips to 97% while held so the control answers the
|
|
2144
|
+
* pointer instead of only changing color. Defaults to `false`.
|
|
2145
|
+
*
|
|
2146
|
+
* Has no effect with `variant="link"` (scaling bare text with no padding or
|
|
2147
|
+
* background reads as a wobble) or while the button is disabled or loading,
|
|
2148
|
+
* including the `asChild` anchor form, which stays keyboard-focusable and
|
|
2149
|
+
* would otherwise dip on Enter. The dip is gated behind `motion-safe`, so it
|
|
2150
|
+
* disappears under `prefers-reduced-motion`.
|
|
2151
|
+
*/
|
|
2152
|
+
scaleOnPress?: boolean
|
|
2153
|
+
|
|
2142
2154
|
/**
|
|
2143
2155
|
* Control size. Defaults to `'sm'`.
|
|
2144
2156
|
* - `xs` (24px) — dense toolbars, compact inline actions.
|
|
@@ -2186,8 +2198,8 @@ variant?: "link" | "ghost" | "primary" | "sec
|
|
|
2186
2198
|
</div>
|
|
2187
2199
|
<div>Default args playground for Button</div>
|
|
2188
2200
|
<div class="hint">Args-controlled playground. Toggle `variant`, `size`, `status`, `loading`,
|
|
2189
|
-
`disabled`, and `
|
|
2190
|
-
combination of the Button.</div>
|
|
2201
|
+
`disabled`, `rounded`, and `scaleOnPress` from the Controls panel to explore
|
|
2202
|
+
every visual combination of the Button.</div>
|
|
2191
2203
|
<pre><code>const Default = () => <Button variant="primary" size="sm">{TEXT}</Button>;</code></pre>
|
|
2192
2204
|
</div>
|
|
2193
2205
|
<div class="note ok">
|
|
@@ -2412,31 +2424,37 @@ router. In app code, swap the plain `<a>` below for your framework's L
|
|
|
2412
2424
|
<span class="ex-name">Pressed</span>
|
|
2413
2425
|
<span class="badge ok">story ok</span>
|
|
2414
2426
|
</div>
|
|
2415
|
-
<div>
|
|
2416
|
-
<div class="hint">
|
|
2417
|
-
only changing color. Press and hold one below to
|
|
2418
|
-
deliberately small, and if a quick click draws the
|
|
2427
|
+
<div>Opt-in press feedback via `scaleOnPress`, excluding `link` and disabled</div>
|
|
2428
|
+
<div class="hint">With `scaleOnPress`, a button dips to 97% while held so the control answers
|
|
2429
|
+
the pointer rather than only changing color. Press and hold one below to
|
|
2430
|
+
feel it — the effect is deliberately small, and if a quick click draws the
|
|
2431
|
+
eye it is too strong. It is off by default: pass the prop where the extra
|
|
2432
|
+
feedback is wanted.
|
|
2419
2433
|
|
|
2420
|
-
`variant="link"` is excluded: it has no padding or
|
|
2421
|
-
bare text reads as a wobble rather than a button
|
|
2422
|
-
buttons are excluded too, including the `asChild`
|
|
2423
|
-
keyboard-focusable and would otherwise dip on
|
|
2424
|
-
gated behind `motion-safe`, so it disappears
|
|
2434
|
+
`variant="link"` is excluded even with the prop set: it has no padding or
|
|
2435
|
+
background, so scaling bare text reads as a wobble rather than a button
|
|
2436
|
+
being pushed. Disabled buttons are excluded too, including the `asChild`
|
|
2437
|
+
anchor form, which stays keyboard-focusable and would otherwise dip on
|
|
2438
|
+
Enter. The whole effect is gated behind `motion-safe`, so it disappears
|
|
2439
|
+
under `prefers-reduced-motion`.</div>
|
|
2425
2440
|
<pre><code>const Pressed = () => (
|
|
2426
2441
|
<Stack>
|
|
2427
2442
|
<Row>
|
|
2428
2443
|
{NON_LINK_VARIANTS.map(variant => (
|
|
2429
|
-
<Button key={variant} variant={variant}>
|
|
2444
|
+
<Button key={variant} variant={variant} scaleOnPress>
|
|
2430
2445
|
Press {variant}
|
|
2431
2446
|
</Button>
|
|
2432
2447
|
))}
|
|
2433
2448
|
</Row>
|
|
2434
2449
|
<Row>
|
|
2435
|
-
<Button variant="
|
|
2436
|
-
<Button variant="
|
|
2450
|
+
<Button variant="primary">Opted out stays still</Button>
|
|
2451
|
+
<Button variant="link" scaleOnPress>
|
|
2452
|
+
Link stays still
|
|
2453
|
+
</Button>
|
|
2454
|
+
<Button variant="primary" scaleOnPress disabled>
|
|
2437
2455
|
Disabled stays still
|
|
2438
2456
|
</Button>
|
|
2439
|
-
<Button asChild variant="secondary" disabled>
|
|
2457
|
+
<Button asChild variant="secondary" scaleOnPress disabled>
|
|
2440
2458
|
<a href="/dashboard">Disabled anchor stays still</a>
|
|
2441
2459
|
</Button>
|
|
2442
2460
|
</Row>
|
|
@@ -1248,7 +1248,7 @@
|
|
|
1248
1248
|
"displayName": "Button",
|
|
1249
1249
|
"exportName": "Button",
|
|
1250
1250
|
"filePath": "/home/runner/work/design-system/design-system/src/button/button.tsx",
|
|
1251
|
-
"description": "Button is the design system's primary actionable control. Use it for any\ninteraction that triggers behavior, submits a form, or navigates the user.\nBy default Button renders a `<button>`; pass `asChild` to render its single\nchild element as the underlying tag instead — Button merges its styles,\n`className`, `ref`, and props onto whatever the consumer nests. This keeps\nthe design system framework-agnostic: route a plain `<a>`, a Next.js\n`<Link>`, a React Router `<Link>`, or any custom element through the same\nvisual treatment.\n\nPick `variant` to express hierarchy (`primary` for the main CTA,\n`secondary` / `tertiary` for supporting actions, `ghost` for low-emphasis\ninline actions, `link` for text-only actions). Use `status=\"danger\"` for\ndestructive actions and `loading` to block interaction while async work\nresolves.\n\nDo **not** use Button for toggle states (prefer a Switch or ToggleButton),\nfor passive decorative anchors without action intent (use a plain `<a>`),\nor with `variant=\"link\"` when loading or when the button has no text\nchildren — both combinations log a dev-only warning (silent in production).",
|
|
1251
|
+
"description": "Button is the design system's primary actionable control. Use it for any\ninteraction that triggers behavior, submits a form, or navigates the user.\nBy default Button renders a `<button>`; pass `asChild` to render its single\nchild element as the underlying tag instead — Button merges its styles,\n`className`, `ref`, and props onto whatever the consumer nests. This keeps\nthe design system framework-agnostic: route a plain `<a>`, a Next.js\n`<Link>`, a React Router `<Link>`, or any custom element through the same\nvisual treatment.\n\nPick `variant` to express hierarchy (`primary` for the main CTA,\n`secondary` / `tertiary` for supporting actions, `ghost` for low-emphasis\ninline actions, `link` for text-only actions). Use `status=\"danger\"` for\ndestructive actions and `loading` to block interaction while async work\nresolves. Press feedback is opt-in: set `scaleOnPress` to make the button\ndip while held.\n\nDo **not** use Button for toggle states (prefer a Switch or ToggleButton),\nfor passive decorative anchors without action intent (use a plain `<a>`),\nor with `variant=\"link\"` when loading or when the button has no text\nchildren — both combinations log a dev-only warning (silent in production).",
|
|
1252
1252
|
"jsDocTags": {
|
|
1253
1253
|
"summary": [
|
|
1254
1254
|
"Primary actionable control; renders a `<button>` or, with `asChild`, any nested element"
|
|
@@ -1513,6 +1513,25 @@
|
|
|
1513
1513
|
}
|
|
1514
1514
|
]
|
|
1515
1515
|
},
|
|
1516
|
+
"scaleOnPress": {
|
|
1517
|
+
"name": "scaleOnPress",
|
|
1518
|
+
"required": false,
|
|
1519
|
+
"type": {
|
|
1520
|
+
"name": "boolean"
|
|
1521
|
+
},
|
|
1522
|
+
"description": "When `true`, the button dips to 97% while held so the control answers the\npointer instead of only changing color. Defaults to `false`.\n\nHas no effect with `variant=\"link\"` (scaling bare text with no padding or\nbackground reads as a wobble) or while the button is disabled or loading,\nincluding the `asChild` anchor form, which stays keyboard-focusable and\nwould otherwise dip on Enter. The dip is gated behind `motion-safe`, so it\ndisappears under `prefers-reduced-motion`.",
|
|
1523
|
+
"defaultValue": null,
|
|
1524
|
+
"parent": {
|
|
1525
|
+
"name": "ButtonBaseProps",
|
|
1526
|
+
"fileName": "src/button/button.tsx"
|
|
1527
|
+
},
|
|
1528
|
+
"declarations": [
|
|
1529
|
+
{
|
|
1530
|
+
"name": "TypeLiteral",
|
|
1531
|
+
"fileName": "src/button/button.tsx"
|
|
1532
|
+
}
|
|
1533
|
+
]
|
|
1534
|
+
},
|
|
1516
1535
|
"ref": {
|
|
1517
1536
|
"name": "ref",
|
|
1518
1537
|
"required": false,
|
|
@@ -1558,7 +1577,7 @@
|
|
|
1558
1577
|
"id": "components-button--default",
|
|
1559
1578
|
"name": "Default",
|
|
1560
1579
|
"snippet": "const Default = () => <Button variant=\"primary\" size=\"sm\">{TEXT}</Button>;",
|
|
1561
|
-
"description": "Args-controlled playground. Toggle `variant`, `size`, `status`, `loading`,\n`disabled`, and `
|
|
1580
|
+
"description": "Args-controlled playground. Toggle `variant`, `size`, `status`, `loading`,\n`disabled`, `rounded`, and `scaleOnPress` from the Controls panel to explore\nevery visual combination of the Button.",
|
|
1562
1581
|
"summary": "Default args playground for Button"
|
|
1563
1582
|
},
|
|
1564
1583
|
{
|
|
@@ -1627,9 +1646,9 @@
|
|
|
1627
1646
|
{
|
|
1628
1647
|
"id": "components-button--pressed",
|
|
1629
1648
|
"name": "Pressed",
|
|
1630
|
-
"snippet": "const Pressed = () => (\n <Stack>\n <Row>\n {NON_LINK_VARIANTS.map(variant => (\n <Button key={variant} variant={variant}>\n Press {variant}\n </Button>\n ))}\n </Row>\n <Row>\n <Button variant=\"link\"
|
|
1631
|
-
"description": "
|
|
1632
|
-
"summary": "
|
|
1649
|
+
"snippet": "const Pressed = () => (\n <Stack>\n <Row>\n {NON_LINK_VARIANTS.map(variant => (\n <Button key={variant} variant={variant} scaleOnPress>\n Press {variant}\n </Button>\n ))}\n </Row>\n <Row>\n <Button variant=\"primary\">Opted out stays still</Button>\n <Button variant=\"link\" scaleOnPress>\n Link stays still\n </Button>\n <Button variant=\"primary\" scaleOnPress disabled>\n Disabled stays still\n </Button>\n <Button asChild variant=\"secondary\" scaleOnPress disabled>\n <a href=\"/dashboard\">Disabled anchor stays still</a>\n </Button>\n </Row>\n </Stack>\n);",
|
|
1650
|
+
"description": "With `scaleOnPress`, a button dips to 97% while held so the control answers\nthe pointer rather than only changing color. Press and hold one below to\nfeel it — the effect is deliberately small, and if a quick click draws the\neye it is too strong. It is off by default: pass the prop where the extra\nfeedback is wanted.\n\n`variant=\"link\"` is excluded even with the prop set: it has no padding or\nbackground, so scaling bare text reads as a wobble rather than a button\nbeing pushed. Disabled buttons are excluded too, including the `asChild`\nanchor form, which stays keyboard-focusable and would otherwise dip on\nEnter. The whole effect is gated behind `motion-safe`, so it disappears\nunder `prefers-reduced-motion`.",
|
|
1651
|
+
"summary": "Opt-in press feedback via `scaleOnPress`, excluding `link` and disabled"
|
|
1633
1652
|
}
|
|
1634
1653
|
],
|
|
1635
1654
|
"import": "import { Button } from \"@agentero/design-system\";"
|
|
@@ -6994,6 +7013,6 @@
|
|
|
6994
7013
|
},
|
|
6995
7014
|
"meta": {
|
|
6996
7015
|
"docgen": "react-component-meta",
|
|
6997
|
-
"durationMs":
|
|
7016
|
+
"durationMs": 3272
|
|
6998
7017
|
}
|
|
6999
7018
|
}
|
package/package.json
CHANGED
package/src/button/button.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ButtonHTMLAttributes, ReactNode, Ref } from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Style recipe for Button using tailwind-variants. Single-slot recipe whose
|
|
4
4
|
* variants (`variant`, `size`, `status`, `hasOnlyIcon`, `disabled`, `rounded`,
|
|
5
|
-
* `align`, `fitContent`) plus compound variants drive
|
|
6
|
-
* treatments. All colors route through design-system tokens defined in
|
|
5
|
+
* `align`, `fitContent`, `scaleOnPress`) plus compound variants drive
|
|
6
|
+
* destructive and disabled treatments. All colors route through design-system tokens defined in
|
|
7
7
|
* `themes/base.css`.
|
|
8
8
|
*
|
|
9
9
|
* Exported for advanced composition (e.g., styling a link or custom element
|
|
@@ -12,6 +12,9 @@ import { ButtonHTMLAttributes, ReactNode, Ref } from 'react';
|
|
|
12
12
|
* @summary tailwind-variants recipe backing the Button component styles
|
|
13
13
|
*/
|
|
14
14
|
export declare const buttonRecipe: import('tailwind-variants').TVReturnType<{
|
|
15
|
+
scaleOnPress: {
|
|
16
|
+
true: string[];
|
|
17
|
+
};
|
|
15
18
|
variant: {
|
|
16
19
|
primary: string[];
|
|
17
20
|
secondary: string[];
|
|
@@ -47,6 +50,9 @@ export declare const buttonRecipe: import('tailwind-variants').TVReturnType<{
|
|
|
47
50
|
true: string;
|
|
48
51
|
};
|
|
49
52
|
}, undefined, string[], {
|
|
53
|
+
scaleOnPress: {
|
|
54
|
+
true: string[];
|
|
55
|
+
};
|
|
50
56
|
variant: {
|
|
51
57
|
primary: string[];
|
|
52
58
|
secondary: string[];
|
|
@@ -82,6 +88,9 @@ export declare const buttonRecipe: import('tailwind-variants').TVReturnType<{
|
|
|
82
88
|
true: string;
|
|
83
89
|
};
|
|
84
90
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
91
|
+
scaleOnPress: {
|
|
92
|
+
true: string[];
|
|
93
|
+
};
|
|
85
94
|
variant: {
|
|
86
95
|
primary: string[];
|
|
87
96
|
secondary: string[];
|
|
@@ -201,6 +210,17 @@ type ButtonBaseProps = {
|
|
|
201
210
|
* its content. Useful for inline actions inside tight containers.
|
|
202
211
|
*/
|
|
203
212
|
fitContent?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* When `true`, the button dips to 97% while held so the control answers the
|
|
215
|
+
* pointer instead of only changing color. Defaults to `false`.
|
|
216
|
+
*
|
|
217
|
+
* Has no effect with `variant="link"` (scaling bare text with no padding or
|
|
218
|
+
* background reads as a wobble) or while the button is disabled or loading,
|
|
219
|
+
* including the `asChild` anchor form, which stays keyboard-focusable and
|
|
220
|
+
* would otherwise dip on Enter. The dip is gated behind `motion-safe`, so it
|
|
221
|
+
* disappears under `prefers-reduced-motion`.
|
|
222
|
+
*/
|
|
223
|
+
scaleOnPress?: boolean;
|
|
204
224
|
/**
|
|
205
225
|
* Ref forwarded to the underlying element. Typed as a union covering both
|
|
206
226
|
* `<button>` and `<a>` because `asChild` lets consumers render either tag
|
|
@@ -245,7 +265,8 @@ export type ButtonProps = ButtonBaseProps & ButtonHTMLAttributes<HTMLButtonEleme
|
|
|
245
265
|
* `secondary` / `tertiary` for supporting actions, `ghost` for low-emphasis
|
|
246
266
|
* inline actions, `link` for text-only actions). Use `status="danger"` for
|
|
247
267
|
* destructive actions and `loading` to block interaction while async work
|
|
248
|
-
* resolves.
|
|
268
|
+
* resolves. Press feedback is opt-in: set `scaleOnPress` to make the button
|
|
269
|
+
* dip while held.
|
|
249
270
|
*
|
|
250
271
|
* Do **not** use Button for toggle states (prefer a Switch or ToggleButton),
|
|
251
272
|
* for passive decorative anchors without action intent (use a plain `<a>`),
|
|
@@ -275,5 +296,5 @@ export type ButtonProps = ButtonBaseProps & ButtonHTMLAttributes<HTMLButtonEleme
|
|
|
275
296
|
* Delete account
|
|
276
297
|
* </Button>
|
|
277
298
|
*/
|
|
278
|
-
export declare const Button: ({ children, asChild, variant, size, status, loading, rounded, align, fitContent, disabled, iconOnly, ref, className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
299
|
+
export declare const Button: ({ children, asChild, variant, size, status, loading, rounded, align, fitContent, scaleOnPress, disabled, iconOnly, ref, className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
279
300
|
export {};
|
package/src/button/button.js
CHANGED
|
@@ -11,8 +11,6 @@ var c = t({
|
|
|
11
11
|
"bg-transparent no-underline",
|
|
12
12
|
"border border-solid border-transparent",
|
|
13
13
|
"transition-[background-color,border-color,color,transform] duration-150",
|
|
14
|
-
"motion-safe:active:[transform:scale(0.97)]",
|
|
15
|
-
"motion-safe:active:ease-out-expo",
|
|
16
14
|
"[-webkit-tap-highlight-color:transparent]",
|
|
17
15
|
"[&_svg]:[flex:0_0_fit-content]",
|
|
18
16
|
"[&_svg_path[fill]]:fill-current",
|
|
@@ -22,6 +20,7 @@ var c = t({
|
|
|
22
20
|
"focus-visible:outline-focus-ring-button-primary"
|
|
23
21
|
],
|
|
24
22
|
variants: {
|
|
23
|
+
scaleOnPress: { true: ["motion-safe:active:[transform:scale(0.97)]", "motion-safe:active:ease-out-expo"] },
|
|
25
24
|
variant: {
|
|
26
25
|
primary: [
|
|
27
26
|
"bg-bg-button-primary-enable border-bg-button-primary-enable",
|
|
@@ -241,6 +240,7 @@ var c = t({
|
|
|
241
240
|
}
|
|
242
241
|
],
|
|
243
242
|
defaultVariants: {
|
|
243
|
+
scaleOnPress: !1,
|
|
244
244
|
variant: "primary",
|
|
245
245
|
size: "sm",
|
|
246
246
|
align: "center"
|
|
@@ -249,28 +249,29 @@ var c = t({
|
|
|
249
249
|
"aria-label": "loading",
|
|
250
250
|
role: "status",
|
|
251
251
|
className: e("absolute inset-0 grid place-items-center", "rounded-[inherit] bg-inherit", "before:content-[\"\"] before:block before:size-[1em]", "before:border-2 before:border-solid before:rounded-full", "before:border-current before:border-t-transparent", "before:animate-spin before:[animation-duration:0.5s]")
|
|
252
|
-
}), u = ({ children: t, asChild: u, variant: d, size: f, status: p, loading: m, rounded: h, align: g, fitContent: _,
|
|
253
|
-
let
|
|
254
|
-
process.env.NODE_ENV !== "production" && (m && d === "link" && console.warn("Button with variant link and loading is not supported"),
|
|
255
|
-
let
|
|
252
|
+
}), u = ({ children: t, asChild: u, variant: d, size: f, status: p, loading: m, rounded: h, align: g, fitContent: _, scaleOnPress: v, disabled: y, iconOnly: b, ref: x, className: S, ...C }) => {
|
|
253
|
+
let w = u ? !!b : i.toArray(t).every((e) => a(e)), T = y || m;
|
|
254
|
+
process.env.NODE_ENV !== "production" && (m && d === "link" && console.warn("Button with variant link and loading is not supported"), w && d === "link" && console.warn("Button with no text and variant link is not supported. Use it with variant tertiary instead"), u && b && a(t) && i.toArray(t.props.children).some((e) => !a(e)) && console.warn("Button with asChild and iconOnly should only contain icon children; text found inside the wrapper element"));
|
|
255
|
+
let E = e(c({
|
|
256
256
|
variant: d,
|
|
257
257
|
size: f,
|
|
258
|
-
hasOnlyIcon:
|
|
259
|
-
disabled:
|
|
258
|
+
hasOnlyIcon: w,
|
|
259
|
+
disabled: T,
|
|
260
260
|
status: p,
|
|
261
261
|
rounded: h,
|
|
262
262
|
align: g,
|
|
263
|
-
fitContent: _
|
|
264
|
-
|
|
263
|
+
fitContent: _,
|
|
264
|
+
scaleOnPress: v
|
|
265
|
+
}), S);
|
|
265
266
|
return /* @__PURE__ */ r(u ? o : "button", {
|
|
266
267
|
"data-slot": "button",
|
|
267
268
|
...u ? {
|
|
268
|
-
"aria-disabled":
|
|
269
|
-
"data-disabled":
|
|
270
|
-
} : { disabled:
|
|
271
|
-
...
|
|
272
|
-
className:
|
|
273
|
-
ref:
|
|
269
|
+
"aria-disabled": T || void 0,
|
|
270
|
+
"data-disabled": T || void 0
|
|
271
|
+
} : { disabled: T },
|
|
272
|
+
...C,
|
|
273
|
+
className: E,
|
|
274
|
+
ref: x,
|
|
274
275
|
children: [m && /* @__PURE__ */ n(l, {}), u ? /* @__PURE__ */ n(s, { children: t }) : t]
|
|
275
276
|
});
|
|
276
277
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Pagination as t } from "../pagination/pagination.js";
|
|
4
|
+
import { Table as n } from "../table/index.js";
|
|
5
5
|
import { IconArrowUpward as r, IconSwapVert as i } from "./icons.js";
|
|
6
6
|
import { tv as a } from "tailwind-variants";
|
|
7
7
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
@@ -57,24 +57,24 @@ var b = a({
|
|
|
57
57
|
left: "justify-start"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
}), S = (e) => !!e.closest("a, button, [role=\"menu\"]"), C = ({ children:
|
|
60
|
+
}), S = (e) => !!e.closest("a, button, [role=\"menu\"]"), C = ({ children: t = /* @__PURE__ */ s(w, {}), size: a = "md", sticky: u = "header", embed: d = !0, enclosed: f = !1 }) => {
|
|
61
61
|
let { table: m, isLoading: h, scrollRef: g, onRowClick: v, rowHref: y, linkComponent: C } = _(), T = m.getAllColumns().length;
|
|
62
62
|
return /* @__PURE__ */ s("div", {
|
|
63
63
|
"data-slot": "data-table-loading-overlay",
|
|
64
64
|
className: e("flex min-h-0 flex-1 flex-col transition-opacity duration-150", h && "opacity-50"),
|
|
65
|
-
children: /* @__PURE__ */ c(
|
|
65
|
+
children: /* @__PURE__ */ c(n.Root, {
|
|
66
66
|
size: a,
|
|
67
67
|
sticky: u,
|
|
68
68
|
embed: d,
|
|
69
69
|
enclosed: f,
|
|
70
70
|
ref: g,
|
|
71
|
-
children: [/* @__PURE__ */ s(
|
|
72
|
-
let
|
|
71
|
+
children: [/* @__PURE__ */ s(n.Head, { children: m.getHeaderGroups().map((e) => /* @__PURE__ */ s(n.Row, { children: e.headers.map((e) => {
|
|
72
|
+
let t = e.column.columnDef.meta, a = e.column.getCanSort(), l = e.column.getIsSorted(), u = t?.style?.textAlign === "right" || t?.className?.includes("text-right") ? "right" : "left", d = e.isPlaceholder ? null : /* @__PURE__ */ c(o, { children: [p(e.column.columnDef.header, e.getContext()), a && /* @__PURE__ */ s("span", {
|
|
73
73
|
className: "size-4",
|
|
74
74
|
children: l ? /* @__PURE__ */ s(r, { className: b({ direction: l }) }) : /* @__PURE__ */ s(i, { className: "size-4" })
|
|
75
75
|
})] });
|
|
76
|
-
return /* @__PURE__ */ s(
|
|
77
|
-
...
|
|
76
|
+
return /* @__PURE__ */ s(n.Header, {
|
|
77
|
+
...t,
|
|
78
78
|
"aria-sort": a ? l === "asc" ? "ascending" : l === "desc" ? "descending" : "none" : void 0,
|
|
79
79
|
children: a ? /* @__PURE__ */ s("button", {
|
|
80
80
|
type: "button",
|
|
@@ -93,18 +93,18 @@ var b = a({
|
|
|
93
93
|
children: d
|
|
94
94
|
})
|
|
95
95
|
}, e.id);
|
|
96
|
-
}) }, e.id)) }), /* @__PURE__ */ s(
|
|
97
|
-
let r = y?.(
|
|
98
|
-
return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(
|
|
96
|
+
}) }, e.id)) }), /* @__PURE__ */ s(n.Body, { children: m.getRowModel().rows.length ? m.getRowModel().rows.map((t) => {
|
|
97
|
+
let r = y?.(t.original), i = !!v || !!r;
|
|
98
|
+
return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(n.Row, {
|
|
99
99
|
className: e("has-aria-expanded:bg-bg-default-base-secondary", i && "cursor-pointer"),
|
|
100
100
|
onClick: i ? (e) => {
|
|
101
|
-
S(e.target) || !e.currentTarget.contains(e.target) || (v ? v(
|
|
101
|
+
S(e.target) || !e.currentTarget.contains(e.target) || (v ? v(t.original) : r && e.currentTarget.querySelector("[data-row-link]")?.click());
|
|
102
102
|
} : void 0,
|
|
103
|
-
children:
|
|
103
|
+
children: t.getVisibleCells().map((e, t) => {
|
|
104
104
|
let i = e.column.columnDef.meta;
|
|
105
|
-
return /* @__PURE__ */ c(
|
|
105
|
+
return /* @__PURE__ */ c(n.Cell, {
|
|
106
106
|
...i,
|
|
107
|
-
children: [
|
|
107
|
+
children: [t === 0 && r && /* @__PURE__ */ s(C, {
|
|
108
108
|
href: r,
|
|
109
109
|
"data-row-link": !0,
|
|
110
110
|
className: "hidden",
|
|
@@ -113,13 +113,13 @@ var b = a({
|
|
|
113
113
|
}), p(e.column.columnDef.cell, e.getContext())]
|
|
114
114
|
}, e.id);
|
|
115
115
|
})
|
|
116
|
-
}) },
|
|
117
|
-
}) : h ? null : /* @__PURE__ */ s(
|
|
116
|
+
}) }, t.id);
|
|
117
|
+
}) : h ? null : /* @__PURE__ */ s(n.Row, { children: /* @__PURE__ */ s(n.Cell, {
|
|
118
118
|
colSpan: T,
|
|
119
119
|
children: /* @__PURE__ */ s("div", {
|
|
120
120
|
"data-slot": "table-empty-state",
|
|
121
121
|
className: "whitespace-normal",
|
|
122
|
-
children:
|
|
122
|
+
children: t
|
|
123
123
|
})
|
|
124
124
|
}) }) })]
|
|
125
125
|
})
|
|
@@ -139,11 +139,11 @@ var w = () => /* @__PURE__ */ s("div", {
|
|
|
139
139
|
});
|
|
140
140
|
T.displayName = "DataTable.Footer";
|
|
141
141
|
var E = (e) => {
|
|
142
|
-
let { scrollRef:
|
|
143
|
-
return /* @__PURE__ */ s(
|
|
142
|
+
let { scrollRef: n } = _();
|
|
143
|
+
return /* @__PURE__ */ s(t, {
|
|
144
144
|
...e,
|
|
145
|
-
onPageChange: (
|
|
146
|
-
|
|
145
|
+
onPageChange: (t) => {
|
|
146
|
+
n.current?.scrollTo({ top: 0 }), e.onPageChange(t);
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
};
|
|
@@ -1,144 +1,5 @@
|
|
|
1
1
|
export { useDataTable } from './data-table';
|
|
2
2
|
export type { DataTableColumnMeta, PaginationState } from './data-table';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Import from `@agentero/design-system/table` instead — that entry
|
|
5
|
-
* point carries no `@tanstack/react-table` dependency.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Table: {
|
|
8
|
-
Root: {
|
|
9
|
-
({ children, ref, ...variants }: import('react').PropsWithChildren<import('.').TableRootProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
displayName: string;
|
|
11
|
-
};
|
|
12
|
-
Head: {
|
|
13
|
-
({ children, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableSectionElement>>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
Body: {
|
|
17
|
-
({ children, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableSectionElement>>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
displayName: string;
|
|
19
|
-
};
|
|
20
|
-
Row: {
|
|
21
|
-
({ className, ...props }: import('react').ComponentProps<"tr">): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
displayName: string;
|
|
23
|
-
};
|
|
24
|
-
Header: {
|
|
25
|
-
({ className, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableCellElement>>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
displayName: string;
|
|
27
|
-
};
|
|
28
|
-
Cell: {
|
|
29
|
-
({ className, ...props }: import('react').PropsWithChildren<import('react').TdHTMLAttributes<HTMLTableCellElement>>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
displayName: string;
|
|
31
|
-
};
|
|
32
|
-
ExpandButton: {
|
|
33
|
-
({ toggleExpanded, isExpanded, className, ...props }: {
|
|
34
|
-
toggleExpanded: () => void;
|
|
35
|
-
isExpanded: boolean;
|
|
36
|
-
} & {
|
|
37
|
-
children?: import('react').ReactNode;
|
|
38
|
-
variant?: import('../button').ButtonVariantType;
|
|
39
|
-
size?: import('../button').ButtonSizeType;
|
|
40
|
-
status?: "danger";
|
|
41
|
-
loading?: boolean;
|
|
42
|
-
disabled?: boolean;
|
|
43
|
-
iconOnly?: boolean;
|
|
44
|
-
rounded?: boolean;
|
|
45
|
-
align?: "center" | "start" | "end" | "justify";
|
|
46
|
-
fitContent?: boolean;
|
|
47
|
-
ref?: import('react').Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
48
|
-
} & import('react').ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
49
|
-
asChild?: boolean;
|
|
50
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
51
|
-
displayName: string;
|
|
52
|
-
};
|
|
53
|
-
ExpandedRow: {
|
|
54
|
-
({ className, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableRowElement>>): import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
displayName: string;
|
|
56
|
-
};
|
|
57
|
-
RowActions: {
|
|
58
|
-
({ children }: import('react').PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
59
|
-
displayName: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Import from `@agentero/design-system/table` instead.
|
|
64
|
-
*/
|
|
65
|
-
export declare const tableRecipe: import('tailwind-variants').TVReturnType<{
|
|
66
|
-
size: {
|
|
67
|
-
sm: {};
|
|
68
|
-
md: {};
|
|
69
|
-
lg: {};
|
|
70
|
-
};
|
|
71
|
-
embed: {
|
|
72
|
-
true: {
|
|
73
|
-
root: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
enclosed: {
|
|
77
|
-
true: {
|
|
78
|
-
root: string;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
sticky: {
|
|
82
|
-
header: {};
|
|
83
|
-
headerAndFooter: {};
|
|
84
|
-
};
|
|
85
|
-
}, {
|
|
86
|
-
root: string[];
|
|
87
|
-
scroll: string;
|
|
88
|
-
table: string;
|
|
89
|
-
}, undefined, {
|
|
90
|
-
size: {
|
|
91
|
-
sm: {};
|
|
92
|
-
md: {};
|
|
93
|
-
lg: {};
|
|
94
|
-
};
|
|
95
|
-
embed: {
|
|
96
|
-
true: {
|
|
97
|
-
root: string;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
enclosed: {
|
|
101
|
-
true: {
|
|
102
|
-
root: string;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
sticky: {
|
|
106
|
-
header: {};
|
|
107
|
-
headerAndFooter: {};
|
|
108
|
-
};
|
|
109
|
-
}, {
|
|
110
|
-
root: string[];
|
|
111
|
-
scroll: string;
|
|
112
|
-
table: string;
|
|
113
|
-
}, import('tailwind-variants').TVReturnType<{
|
|
114
|
-
size: {
|
|
115
|
-
sm: {};
|
|
116
|
-
md: {};
|
|
117
|
-
lg: {};
|
|
118
|
-
};
|
|
119
|
-
embed: {
|
|
120
|
-
true: {
|
|
121
|
-
root: string;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
enclosed: {
|
|
125
|
-
true: {
|
|
126
|
-
root: string;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
sticky: {
|
|
130
|
-
header: {};
|
|
131
|
-
headerAndFooter: {};
|
|
132
|
-
};
|
|
133
|
-
}, {
|
|
134
|
-
root: string[];
|
|
135
|
-
scroll: string;
|
|
136
|
-
table: string;
|
|
137
|
-
}, undefined, unknown, unknown, undefined>>;
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Import from `@agentero/design-system/table` instead.
|
|
140
|
-
*/
|
|
141
|
-
export type { TableRootProps } from '../table';
|
|
142
3
|
export declare const DataTable: {
|
|
143
4
|
Root: {
|
|
144
5
|
<TData extends import('@tanstack/table-core').RowData>({ children, isLoading, onRowClick, rowHref, linkComponent, ...tableOptions }: import('react').PropsWithChildren<{
|
|
@@ -239,10 +100,10 @@ export declare const DataTable: {
|
|
|
239
100
|
};
|
|
240
101
|
Table: {
|
|
241
102
|
({ children, size, sticky, embed, enclosed }: {
|
|
242
|
-
size?: import('
|
|
243
|
-
sticky?: import('
|
|
244
|
-
embed?: import('
|
|
245
|
-
enclosed?: import('
|
|
103
|
+
size?: import('../table').TableRootProps["size"];
|
|
104
|
+
sticky?: import('../table').TableRootProps["sticky"];
|
|
105
|
+
embed?: import('../table').TableRootProps["embed"];
|
|
106
|
+
enclosed?: import('../table').TableRootProps["enclosed"];
|
|
246
107
|
} & {
|
|
247
108
|
children?: import('react').ReactNode | undefined;
|
|
248
109
|
}): import("react/jsx-runtime").JSX.Element;
|
package/src/data-table/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Table as t } from "../table/index.js";
|
|
3
|
-
import { DataTablePagination as n, DataTableTable as r, Footer as i, Root as a, ToolBar as o, useDataTable as s } from "./data-table.js";
|
|
1
|
+
import { DataTablePagination as e, DataTableTable as t, Footer as n, Root as r, ToolBar as i, useDataTable as a } from "./data-table.js";
|
|
4
2
|
//#region src/data-table/index.ts
|
|
5
|
-
var
|
|
6
|
-
Root:
|
|
7
|
-
ToolBar:
|
|
8
|
-
Table:
|
|
9
|
-
Footer:
|
|
10
|
-
Pagination:
|
|
3
|
+
var o = {
|
|
4
|
+
Root: r,
|
|
5
|
+
ToolBar: i,
|
|
6
|
+
Table: t,
|
|
7
|
+
Footer: n,
|
|
8
|
+
Pagination: e
|
|
11
9
|
};
|
|
12
10
|
//#endregion
|
|
13
|
-
export {
|
|
11
|
+
export { o as DataTable, a as useDataTable };
|
|
@@ -17,9 +17,7 @@ var l = o({
|
|
|
17
17
|
"min-w-8 h-8 px-1",
|
|
18
18
|
"border border-solid border-transparent",
|
|
19
19
|
"bg-bg-button-ghost-enable text-text-button-ghost-enable",
|
|
20
|
-
"transition-[background-color,border-color,color
|
|
21
|
-
"motion-safe:active:[transform:scale(0.97)]",
|
|
22
|
-
"motion-safe:active:ease-out-expo",
|
|
20
|
+
"transition-[background-color,border-color,color] duration-150",
|
|
23
21
|
"disabled:pointer-events-none disabled:opacity-30",
|
|
24
22
|
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-[0.0625rem] focus-visible:outline-focus-ring-button-primary",
|
|
25
23
|
"hover:not-aria-[current=page]:border-border-button-secondary-enable hover:not-aria-[current=page]:shadow-1",
|
package/src/table/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const Table: {
|
|
|
40
40
|
rounded?: boolean;
|
|
41
41
|
align?: "center" | "start" | "end" | "justify";
|
|
42
42
|
fitContent?: boolean;
|
|
43
|
+
scaleOnPress?: boolean;
|
|
43
44
|
ref?: import('react').Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
44
45
|
} & import('react').ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
45
46
|
asChild?: boolean;
|