@agentero/design-system 0.9.7 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mcp/manifests/components.html +191 -36
- package/mcp/manifests/components.json +1 -1
- package/package.json +8 -3
- package/src/accordion/accordion.d.ts +46 -0
- package/src/accordion/accordion.js +54 -0
- package/src/accordion/icons.d.ts +10 -0
- package/src/accordion/icons.js +16 -0
- package/src/accordion/index.d.ts +2 -0
- package/src/accordion/index.js +2 -0
- package/src/alert/alert.js +30 -30
- package/src/avatar/avatar.js +24 -24
- package/src/button/button.js +11 -11
- package/src/data-table/data-table.js +40 -40
- package/src/data-table/table.js +33 -33
- package/theme/base.css +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentero/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A React component library built with Tailwind CSS v4 and Radix UI primitives",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"radix-ui"
|
|
22
22
|
],
|
|
23
23
|
"exports": {
|
|
24
|
+
"./accordion": {
|
|
25
|
+
"types": "./src/accordion/index.d.ts",
|
|
26
|
+
"import": "./src/accordion/index.js"
|
|
27
|
+
},
|
|
24
28
|
"./alert": {
|
|
25
29
|
"types": "./src/alert/index.d.ts",
|
|
26
30
|
"import": "./src/alert/index.js"
|
|
@@ -69,12 +73,13 @@
|
|
|
69
73
|
"design-system-mcp": "./mcp/server.mjs"
|
|
70
74
|
},
|
|
71
75
|
"peerDependencies": {
|
|
76
|
+
"@tanstack/react-table": "^8.21.3",
|
|
72
77
|
"react": "^19.2.4",
|
|
73
78
|
"react-dom": "^19.2.4",
|
|
74
|
-
"tailwindcss": "^4.0.0"
|
|
75
|
-
"@tanstack/react-table": "^8.21.3"
|
|
79
|
+
"tailwindcss": "^4.0.0"
|
|
76
80
|
},
|
|
77
81
|
"dependencies": {
|
|
82
|
+
"@radix-ui/react-accordion": "^1.2.14",
|
|
78
83
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
79
84
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
80
85
|
"@radix-ui/react-separator": "^1.1.8",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
4
|
+
declare const rootStyles: import('tailwind-variants').TVReturnType<{
|
|
5
|
+
enclosed: {
|
|
6
|
+
true: string;
|
|
7
|
+
};
|
|
8
|
+
}, undefined, undefined, {
|
|
9
|
+
enclosed: {
|
|
10
|
+
true: string;
|
|
11
|
+
};
|
|
12
|
+
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
13
|
+
enclosed: {
|
|
14
|
+
true: string;
|
|
15
|
+
};
|
|
16
|
+
}, undefined, undefined, unknown, unknown, undefined>>;
|
|
17
|
+
export type AccordionRootProps = ComponentProps<typeof AccordionPrimitive.Root> & VariantProps<typeof rootStyles>;
|
|
18
|
+
export type AccordionItemProps = ComponentProps<typeof AccordionPrimitive.Item>;
|
|
19
|
+
export type AccordionTriggerProps = ComponentProps<typeof AccordionPrimitive.Trigger>;
|
|
20
|
+
export type AccordionContentProps = ComponentProps<typeof AccordionPrimitive.Content>;
|
|
21
|
+
/**
|
|
22
|
+
* Stacked, collapsible sections built on Radix UI's Accordion (keyboard nav and
|
|
23
|
+
* ARIA come for free). Compose `Root` with `Item`s, each holding a `Trigger` and
|
|
24
|
+
* `Content`. `type="single"` (optionally `collapsible`) opens one at a time;
|
|
25
|
+
* `type="multiple"` opens sections independently. `enclosed` renders the group
|
|
26
|
+
* as a bordered card.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Accordion: {
|
|
29
|
+
Root: {
|
|
30
|
+
({ className, enclosed, ...props }: AccordionRootProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
33
|
+
Item: {
|
|
34
|
+
({ className, ...props }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
Trigger: {
|
|
38
|
+
({ className, children, asChild, ...props }: AccordionTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
41
|
+
Content: {
|
|
42
|
+
({ className, children, ...props }: AccordionContentProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { IconKeyboardArrowDown as t } from "./icons.js";
|
|
4
|
+
import * as n from "@radix-ui/react-accordion";
|
|
5
|
+
import { tv as r } from "tailwind-variants";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/accordion/accordion.tsx
|
|
8
|
+
var s = r({ variants: { enclosed: { true: "rounded-lg border border-border-default-base-primary shadow-sm" } } }), c = ({ className: t, enclosed: r, ...i }) => /* @__PURE__ */ a(n.Root, {
|
|
9
|
+
"data-slot": "accordion-root",
|
|
10
|
+
className: e(s({ enclosed: r }), t),
|
|
11
|
+
...i
|
|
12
|
+
});
|
|
13
|
+
c.displayName = "Accordion.Root";
|
|
14
|
+
var l = ({ className: t, ...r }) => /* @__PURE__ */ a(n.Item, {
|
|
15
|
+
"data-slot": "accordion-item",
|
|
16
|
+
className: e("border-b border-border-default-base-primary last:border-b-0", t),
|
|
17
|
+
...r
|
|
18
|
+
});
|
|
19
|
+
l.displayName = "Accordion.Item";
|
|
20
|
+
var u = ({ className: t, ...r }) => /* @__PURE__ */ a(n.Header, {
|
|
21
|
+
"data-slot": "accordion-header",
|
|
22
|
+
className: e("flex", t),
|
|
23
|
+
...r
|
|
24
|
+
});
|
|
25
|
+
u.displayName = "Accordion.Header";
|
|
26
|
+
var d = ({ className: r, children: s, asChild: c, ...l }) => /* @__PURE__ */ a(u, { children: /* @__PURE__ */ a(n.Trigger, {
|
|
27
|
+
"data-slot": "accordion-trigger",
|
|
28
|
+
asChild: c,
|
|
29
|
+
className: e("group flex flex-1 cursor-pointer items-center justify-between p-4 transition-colors hover:text-text-default-base-secondary", "focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring-button-primary", "data-disabled:cursor-not-allowed data-disabled:pointer-events-none data-disabled:text-text-default-disable-primary", r),
|
|
30
|
+
...l,
|
|
31
|
+
children: c ? s : /* @__PURE__ */ o(i, { children: [s, /* @__PURE__ */ a(t, {
|
|
32
|
+
"aria-hidden": !0,
|
|
33
|
+
className: "size-4 shrink-0 group-data-[state=open]:rotate-180 motion-safe:transition-transform motion-safe:duration-200"
|
|
34
|
+
})] })
|
|
35
|
+
}) });
|
|
36
|
+
d.displayName = "Accordion.Trigger";
|
|
37
|
+
var f = ({ className: t, children: r, ...i }) => /* @__PURE__ */ a(n.Content, {
|
|
38
|
+
"data-slot": "accordion-content",
|
|
39
|
+
className: e("overflow-hidden px-4 text-sm", "motion-safe:data-[state=open]:animate-[accordionDown_200ms_ease-out]", "motion-safe:data-[state=closed]:animate-[accordionUp_200ms_ease-out]", t),
|
|
40
|
+
...i,
|
|
41
|
+
children: /* @__PURE__ */ a("div", {
|
|
42
|
+
className: "pb-4",
|
|
43
|
+
children: r
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
f.displayName = "Accordion.Content";
|
|
47
|
+
var p = {
|
|
48
|
+
Root: c,
|
|
49
|
+
Item: l,
|
|
50
|
+
Trigger: d,
|
|
51
|
+
Content: f
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { p as Accordion };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Downward chevron glyph rendered inside `Accordion.Trigger` as the
|
|
4
|
+
* expand/collapse affordance. Rotates 180° when its item is expanded (driven
|
|
5
|
+
* by the trigger's `data-state=open` via a `group-data-*` class). The fill
|
|
6
|
+
* follows `currentColor` so it inherits the trigger's text color token.
|
|
7
|
+
*
|
|
8
|
+
* @summary 24px chevron-down icon used as the accordion trigger affordance
|
|
9
|
+
*/
|
|
10
|
+
export declare const IconKeyboardArrowDown: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/accordion/icons.tsx
|
|
3
|
+
var t = (t) => /* @__PURE__ */ e("svg", {
|
|
4
|
+
width: "24",
|
|
5
|
+
height: "24",
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
...t,
|
|
10
|
+
children: /* @__PURE__ */ e("path", {
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
d: "M12 14.677a.83.83 0 0 1-.633-.256L6.873 9.927a.73.73 0 0 1-.212-.522.7.7 0 0 1 .212-.532.72.72 0 0 1 .527-.217q.31 0 .527.217L12 12.946l4.073-4.073a.73.73 0 0 1 .522-.212.7.7 0 0 1 .532.212q.217.217.217.527a.72.72 0 0 1-.217.527l-4.494 4.494a.83.83 0 0 1-.633.256"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { t as IconKeyboardArrowDown };
|
package/src/alert/alert.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
3
|
import { Button as t } from "../button/button.js";
|
|
4
4
|
import { IconCheckCircle as n, IconClose as r, IconErrorOutline as i, IconInfoOutline as a, IconStar as o, IconWarning as s } from "./icons.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { tv as c } from "tailwind-variants";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { Children as d, createContext as f, isValidElement as p, use as m, useId as h } from "react";
|
|
8
8
|
//#region src/alert/alert.tsx
|
|
9
|
-
var g =
|
|
9
|
+
var g = c({
|
|
10
10
|
slots: {
|
|
11
11
|
root: [
|
|
12
12
|
"flex items-start rounded-md",
|
|
@@ -193,8 +193,8 @@ var g = p({
|
|
|
193
193
|
size: "sm",
|
|
194
194
|
ghost: !1
|
|
195
195
|
}
|
|
196
|
-
}), _ =
|
|
197
|
-
let e =
|
|
196
|
+
}), _ = f(null), v = () => {
|
|
197
|
+
let e = m(_);
|
|
198
198
|
if (!e) throw Error("useAlert must be used within an Alert");
|
|
199
199
|
return e;
|
|
200
200
|
}, y = {
|
|
@@ -208,7 +208,7 @@ var g = p({
|
|
|
208
208
|
playful: a
|
|
209
209
|
}, b = ({ className: t, children: n, ...r }) => {
|
|
210
210
|
let { slotsStyles: i, titleId: a } = v();
|
|
211
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ l("h3", {
|
|
212
212
|
id: a,
|
|
213
213
|
"data-slot": "alert-title",
|
|
214
214
|
...r,
|
|
@@ -217,7 +217,7 @@ var g = p({
|
|
|
217
217
|
});
|
|
218
218
|
}, x = ({ className: t, children: n, ...r }) => {
|
|
219
219
|
let { slotsStyles: i } = v();
|
|
220
|
-
return /* @__PURE__ */
|
|
220
|
+
return /* @__PURE__ */ l("p", {
|
|
221
221
|
"data-slot": "alert-paragraph",
|
|
222
222
|
...r,
|
|
223
223
|
className: e(i.paragraph(), t),
|
|
@@ -225,7 +225,7 @@ var g = p({
|
|
|
225
225
|
});
|
|
226
226
|
}, S = ({ html: t, className: n, ...r }) => {
|
|
227
227
|
let { slotsStyles: i } = v();
|
|
228
|
-
return /* @__PURE__ */
|
|
228
|
+
return /* @__PURE__ */ l("div", {
|
|
229
229
|
"data-slot": "alert-paragraph",
|
|
230
230
|
...r,
|
|
231
231
|
className: e(i.paragraph(), n),
|
|
@@ -233,71 +233,71 @@ var g = p({
|
|
|
233
233
|
});
|
|
234
234
|
}, C = ({ className: t, children: n, ...r }) => {
|
|
235
235
|
let { slotsStyles: i } = v();
|
|
236
|
-
return /* @__PURE__ */
|
|
236
|
+
return /* @__PURE__ */ l("div", {
|
|
237
237
|
"data-slot": "alert-content",
|
|
238
238
|
...r,
|
|
239
239
|
className: e(i.content(), t),
|
|
240
240
|
children: n
|
|
241
241
|
});
|
|
242
|
-
}, w = ({ className: t, children: n, ...r }) => /* @__PURE__ */
|
|
242
|
+
}, w = ({ className: t, children: n, ...r }) => /* @__PURE__ */ l("div", {
|
|
243
243
|
"data-slot": "alert-actions",
|
|
244
244
|
...r,
|
|
245
245
|
className: e("ml-auto flex flex-col items-center justify-center gap-2", t),
|
|
246
246
|
children: n
|
|
247
|
-
}), T = ({ className: t, children: n, ...r }) => /* @__PURE__ */
|
|
247
|
+
}), T = ({ className: t, children: n, ...r }) => /* @__PURE__ */ l("div", {
|
|
248
248
|
...r,
|
|
249
249
|
className: e("[&_svg]:h-16! [&_svg]:w-16!", t),
|
|
250
250
|
children: n
|
|
251
|
-
}), E = ({ className: n, ...r }) => /* @__PURE__ */
|
|
251
|
+
}), E = ({ className: n, ...r }) => /* @__PURE__ */ l(t, {
|
|
252
252
|
variant: "link",
|
|
253
253
|
className: e("text-current", n),
|
|
254
254
|
...r
|
|
255
|
-
}), D = (e, t) =>
|
|
256
|
-
if (!
|
|
255
|
+
}), D = (e, t) => d.toArray(e).some((e) => {
|
|
256
|
+
if (!p(e)) return !1;
|
|
257
257
|
if (e.type === t) return !0;
|
|
258
258
|
let n = e.props.children;
|
|
259
259
|
return n ? D(n, t) : !1;
|
|
260
|
-
}), O = ({ children: n, onDismiss: i, hasIcon: a = !0, icon: o, color: s = "neutral", size: c = "sm", ghost:
|
|
261
|
-
let
|
|
260
|
+
}), O = ({ children: n, onDismiss: i, hasIcon: a = !0, icon: o, color: s = "neutral", size: c = "sm", ghost: d = !1, className: f, ...p }) => {
|
|
261
|
+
let m = g({
|
|
262
262
|
color: s,
|
|
263
263
|
size: c,
|
|
264
|
-
ghost:
|
|
265
|
-
}), v =
|
|
266
|
-
return /* @__PURE__ */
|
|
264
|
+
ghost: d
|
|
265
|
+
}), v = h(), C = `${v}-title`, w = `${v}-desc`, T = D(n, b), E = D(n, x) || D(n, S), O = o ?? y[s], k = o ? !0 : a;
|
|
266
|
+
return /* @__PURE__ */ l(_, {
|
|
267
267
|
value: {
|
|
268
268
|
size: c,
|
|
269
|
-
slotsStyles:
|
|
269
|
+
slotsStyles: m,
|
|
270
270
|
titleId: C,
|
|
271
271
|
descId: w
|
|
272
272
|
},
|
|
273
|
-
children: /* @__PURE__ */
|
|
273
|
+
children: /* @__PURE__ */ u("div", {
|
|
274
274
|
role: "alert",
|
|
275
275
|
"aria-labelledby": T ? C : void 0,
|
|
276
276
|
"aria-describedby": E ? w : void 0,
|
|
277
277
|
"data-slot": "alert-root",
|
|
278
|
-
...
|
|
279
|
-
className: e(
|
|
278
|
+
...p,
|
|
279
|
+
className: e(m.root(), f),
|
|
280
280
|
children: [
|
|
281
|
-
i && /* @__PURE__ */
|
|
281
|
+
i && /* @__PURE__ */ l("div", {
|
|
282
282
|
className: e("order-last ml-auto self-center", {
|
|
283
283
|
"pl-2.5": c === "sm",
|
|
284
284
|
"pl-0.5": c === "md"
|
|
285
285
|
}),
|
|
286
|
-
children: /* @__PURE__ */
|
|
286
|
+
children: /* @__PURE__ */ l(t, {
|
|
287
287
|
variant: "ghost",
|
|
288
288
|
size: c,
|
|
289
289
|
iconOnly: !0,
|
|
290
290
|
"aria-label": "Dismiss",
|
|
291
291
|
className: "text-current",
|
|
292
292
|
onClick: i,
|
|
293
|
-
children: /* @__PURE__ */
|
|
293
|
+
children: /* @__PURE__ */ l(r, { className: "[&_path]:fill-current" })
|
|
294
294
|
})
|
|
295
295
|
}),
|
|
296
|
-
k && /* @__PURE__ */
|
|
297
|
-
className:
|
|
296
|
+
k && /* @__PURE__ */ l(O, {
|
|
297
|
+
className: m.icon(),
|
|
298
298
|
"data-slot": "alert-icon"
|
|
299
299
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ l("div", {
|
|
301
301
|
id: w,
|
|
302
302
|
className: "flex w-full items-center gap-10",
|
|
303
303
|
children: n
|
package/src/avatar/avatar.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { tv as t } from "tailwind-variants";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as i, use as a } from "react";
|
|
6
6
|
import * as o from "@radix-ui/react-avatar";
|
|
7
7
|
//#region src/avatar/avatar.tsx
|
|
8
|
-
var s =
|
|
8
|
+
var s = t({
|
|
9
9
|
slots: {
|
|
10
10
|
root: [
|
|
11
11
|
"flex items-center justify-center align-middle",
|
|
@@ -126,43 +126,43 @@ var s = r({
|
|
|
126
126
|
variant: "circle",
|
|
127
127
|
type: "photo"
|
|
128
128
|
}
|
|
129
|
-
}), c =
|
|
130
|
-
let e =
|
|
129
|
+
}), c = i(null), l = () => {
|
|
130
|
+
let e = a(c);
|
|
131
131
|
if (!e) throw Error("useAvatar must be used within an AvatarProvider");
|
|
132
132
|
return e;
|
|
133
|
-
}, u = ({ size: t, variant:
|
|
133
|
+
}, u = ({ size: t, variant: r, type: i, ...a }) => {
|
|
134
134
|
let l = s({
|
|
135
135
|
size: t,
|
|
136
|
-
variant:
|
|
137
|
-
type:
|
|
136
|
+
variant: r,
|
|
137
|
+
type: i
|
|
138
138
|
});
|
|
139
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ n(c, {
|
|
140
140
|
value: {
|
|
141
141
|
size: t,
|
|
142
|
-
variant:
|
|
143
|
-
type:
|
|
142
|
+
variant: r,
|
|
143
|
+
type: i,
|
|
144
144
|
slotsStyles: l
|
|
145
145
|
},
|
|
146
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ n(o.Root, {
|
|
147
147
|
...a,
|
|
148
148
|
className: e(l.root(), a.className)
|
|
149
149
|
})
|
|
150
150
|
});
|
|
151
151
|
}, d = (t) => {
|
|
152
|
-
let { slotsStyles:
|
|
153
|
-
return /* @__PURE__ */
|
|
152
|
+
let { slotsStyles: r } = l();
|
|
153
|
+
return /* @__PURE__ */ n(o.Image, {
|
|
154
154
|
...t,
|
|
155
|
-
className: e(
|
|
155
|
+
className: e(r.image(), t.className)
|
|
156
156
|
});
|
|
157
157
|
}, f = (t) => {
|
|
158
|
-
let { slotsStyles:
|
|
159
|
-
return /* @__PURE__ */
|
|
158
|
+
let { slotsStyles: r } = l();
|
|
159
|
+
return /* @__PURE__ */ n(o.Fallback, {
|
|
160
160
|
...t,
|
|
161
|
-
className: e(
|
|
161
|
+
className: e(r.fallback(), t.className)
|
|
162
162
|
});
|
|
163
|
-
}, p = ({ alt: e, src: t, fallback:
|
|
164
|
-
let m =
|
|
165
|
-
return /* @__PURE__ */
|
|
163
|
+
}, p = ({ alt: e, src: t, fallback: i, colorize: a, size: o, variant: s, type: c, ref: l, ...p }) => {
|
|
164
|
+
let m = a ? g(a) : void 0;
|
|
165
|
+
return /* @__PURE__ */ r(u, {
|
|
166
166
|
...p,
|
|
167
167
|
ref: l,
|
|
168
168
|
size: o,
|
|
@@ -172,10 +172,10 @@ var s = r({
|
|
|
172
172
|
...m,
|
|
173
173
|
...p.style
|
|
174
174
|
},
|
|
175
|
-
children: [/* @__PURE__ */
|
|
175
|
+
children: [/* @__PURE__ */ n(d, {
|
|
176
176
|
alt: e,
|
|
177
177
|
src: t
|
|
178
|
-
}), /* @__PURE__ */
|
|
178
|
+
}), /* @__PURE__ */ n(f, { children: i })]
|
|
179
179
|
});
|
|
180
180
|
}, m = [
|
|
181
181
|
{
|
package/src/button/button.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { tv as t } from "tailwind-variants";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { Children as i, isValidElement as a } from "react";
|
|
6
|
+
import { Slot as o, Slottable as s } from "@radix-ui/react-slot";
|
|
7
7
|
//#region src/button/button.tsx
|
|
8
|
-
var c =
|
|
8
|
+
var c = t({
|
|
9
9
|
base: [
|
|
10
10
|
"relative inline-flex items-center",
|
|
11
11
|
"font-semibold rounded-md cursor-pointer",
|
|
@@ -243,13 +243,13 @@ var c = r({
|
|
|
243
243
|
size: "sm",
|
|
244
244
|
align: "center"
|
|
245
245
|
}
|
|
246
|
-
}), l = () => /* @__PURE__ */
|
|
246
|
+
}), l = () => /* @__PURE__ */ n("span", {
|
|
247
247
|
"aria-label": "loading",
|
|
248
248
|
role: "status",
|
|
249
249
|
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]")
|
|
250
|
-
}), u = ({ children:
|
|
251
|
-
let C = u ? !!y :
|
|
252
|
-
process.env.NODE_ENV !== "production" && (m && d === "link" && console.warn("Button with variant link and loading is not supported"), C && d === "link" && console.warn("Button with no text and variant link is not supported. Use it with variant tertiary instead"), u && y &&
|
|
250
|
+
}), u = ({ children: t, asChild: u, variant: d, size: f, status: p, loading: m, rounded: h, align: g, fitContent: _, disabled: v, iconOnly: y, ref: b, className: x, ...S }) => {
|
|
251
|
+
let C = u ? !!y : i.toArray(t).every((e) => a(e)), w = v || m;
|
|
252
|
+
process.env.NODE_ENV !== "production" && (m && d === "link" && console.warn("Button with variant link and loading is not supported"), C && d === "link" && console.warn("Button with no text and variant link is not supported. Use it with variant tertiary instead"), u && y && 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"));
|
|
253
253
|
let T = e(c({
|
|
254
254
|
variant: d,
|
|
255
255
|
size: f,
|
|
@@ -260,7 +260,7 @@ var c = r({
|
|
|
260
260
|
align: g,
|
|
261
261
|
fitContent: _
|
|
262
262
|
}), x);
|
|
263
|
-
return /* @__PURE__ */
|
|
263
|
+
return /* @__PURE__ */ r(u ? o : "button", {
|
|
264
264
|
"data-slot": "button",
|
|
265
265
|
...u ? {
|
|
266
266
|
"aria-disabled": w || void 0,
|
|
@@ -269,7 +269,7 @@ var c = r({
|
|
|
269
269
|
...S,
|
|
270
270
|
className: T,
|
|
271
271
|
ref: b,
|
|
272
|
-
children: [m && /* @__PURE__ */
|
|
272
|
+
children: [m && /* @__PURE__ */ n(l, {}), u ? /* @__PURE__ */ n(s, { children: t }) : t]
|
|
273
273
|
});
|
|
274
274
|
};
|
|
275
275
|
//#endregion
|
|
@@ -3,49 +3,49 @@ import { cn as e } from "../../lib/utils.js";
|
|
|
3
3
|
import { IconArrowUpward as t, IconSwapVert as n } from "./icons.js";
|
|
4
4
|
import { Table as r } from "./table.js";
|
|
5
5
|
import { Pagination as i } from "../pagination/pagination.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Fragment as u,
|
|
6
|
+
import { tv as a } from "tailwind-variants";
|
|
7
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as l, createContext as u, use as d, useRef as f } from "react";
|
|
9
9
|
import { flexRender as p, getCoreRowModel as m, useReactTable as h } from "@tanstack/react-table";
|
|
10
10
|
//#region src/data-table/data-table.tsx
|
|
11
|
-
var g =
|
|
12
|
-
let e =
|
|
11
|
+
var g = u(null), _ = () => {
|
|
12
|
+
let e = d(g);
|
|
13
13
|
if (!e) throw Error("useDataTable must be used within a DataTable.Root");
|
|
14
14
|
return e;
|
|
15
|
-
}, v = ({ children: e, isLoading: t = !1, onRowClick: n, rowHref: r, linkComponent: i = "a", ...a }) => /* @__PURE__ */
|
|
15
|
+
}, v = ({ children: e, isLoading: t = !1, onRowClick: n, rowHref: r, linkComponent: i = "a", ...a }) => /* @__PURE__ */ s(g, {
|
|
16
16
|
value: {
|
|
17
17
|
table: h({
|
|
18
18
|
...a,
|
|
19
19
|
getCoreRowModel: m()
|
|
20
20
|
}),
|
|
21
21
|
isLoading: t,
|
|
22
|
-
scrollRef:
|
|
22
|
+
scrollRef: f(null),
|
|
23
23
|
onRowClick: n,
|
|
24
24
|
rowHref: r,
|
|
25
25
|
linkComponent: i
|
|
26
26
|
},
|
|
27
|
-
children: /* @__PURE__ */
|
|
27
|
+
children: /* @__PURE__ */ s("div", {
|
|
28
28
|
"data-slot": "data-table-root",
|
|
29
29
|
className: "flex min-h-0 flex-1 flex-col",
|
|
30
30
|
children: e
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
33
|
v.displayName = "DataTable.Root";
|
|
34
|
-
var y = ({ children: e }) => /* @__PURE__ */
|
|
34
|
+
var y = ({ children: e }) => /* @__PURE__ */ s("div", {
|
|
35
35
|
"data-slot": "data-table-toolbar",
|
|
36
36
|
role: "toolbar",
|
|
37
37
|
className: "flex gap-2 border-b border-border-default-base-primary px-4 py-3",
|
|
38
38
|
children: e
|
|
39
39
|
});
|
|
40
40
|
y.displayName = "DataTable.ToolBar";
|
|
41
|
-
var b =
|
|
41
|
+
var b = a({
|
|
42
42
|
base: "size-4 transition-transform duration-200",
|
|
43
43
|
variants: { direction: {
|
|
44
44
|
asc: "",
|
|
45
45
|
desc: "rotate-180",
|
|
46
46
|
false: ""
|
|
47
47
|
} }
|
|
48
|
-
}), x =
|
|
48
|
+
}), x = a({
|
|
49
49
|
base: "flex w-full appearance-none items-center bg-transparent p-0 text-left [font:inherit]",
|
|
50
50
|
variants: {
|
|
51
51
|
canSort: {
|
|
@@ -57,54 +57,54 @@ var b = l({
|
|
|
57
57
|
left: "justify-start"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
}), S = (e) => !!e.closest("a, button, [role=\"menu\"]"), C = ({ children: i = /* @__PURE__ */
|
|
60
|
+
}), S = (e) => !!e.closest("a, button, [role=\"menu\"]"), C = ({ children: i = /* @__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
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
66
|
-
size:
|
|
67
|
-
sticky:
|
|
68
|
-
embed:
|
|
69
|
-
enclosed:
|
|
65
|
+
children: /* @__PURE__ */ c(r.Root, {
|
|
66
|
+
size: a,
|
|
67
|
+
sticky: u,
|
|
68
|
+
embed: d,
|
|
69
|
+
enclosed: f,
|
|
70
70
|
ref: g,
|
|
71
|
-
children: [/* @__PURE__ */
|
|
72
|
-
let i = e.column.columnDef.meta, a = e.column.getCanSort(),
|
|
71
|
+
children: [/* @__PURE__ */ s(r.Head, { children: m.getHeaderGroups().map((e) => /* @__PURE__ */ s(r.Row, { children: e.headers.map((e) => {
|
|
72
|
+
let i = e.column.columnDef.meta, a = e.column.getCanSort(), l = e.column.getIsSorted(), u = i?.style?.textAlign === "right" || i?.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
|
-
children:
|
|
74
|
+
children: l ? /* @__PURE__ */ s(t, { className: b({ direction: l }) }) : /* @__PURE__ */ s(n, { className: "size-4" })
|
|
75
75
|
})] });
|
|
76
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ s(r.Header, {
|
|
77
77
|
...i,
|
|
78
|
-
"aria-sort": a ?
|
|
79
|
-
children: a ? /* @__PURE__ */
|
|
78
|
+
"aria-sort": a ? l === "asc" ? "ascending" : l === "desc" ? "descending" : "none" : void 0,
|
|
79
|
+
children: a ? /* @__PURE__ */ s("button", {
|
|
80
80
|
type: "button",
|
|
81
81
|
className: x({
|
|
82
82
|
canSort: !0,
|
|
83
|
-
align:
|
|
83
|
+
align: u
|
|
84
84
|
}),
|
|
85
85
|
onClick: e.column.getToggleSortingHandler(),
|
|
86
86
|
title: e.column.getNextSortingOrder() === "asc" ? "Sort ascending" : e.column.getNextSortingOrder() === "desc" ? "Sort descending" : "Clear sort",
|
|
87
|
-
children:
|
|
88
|
-
}) : /* @__PURE__ */
|
|
87
|
+
children: d
|
|
88
|
+
}) : /* @__PURE__ */ s("div", {
|
|
89
89
|
className: x({
|
|
90
90
|
canSort: !1,
|
|
91
|
-
align:
|
|
91
|
+
align: u
|
|
92
92
|
}),
|
|
93
|
-
children:
|
|
93
|
+
children: d
|
|
94
94
|
})
|
|
95
95
|
}, e.id);
|
|
96
|
-
}) }, e.id)) }), /* @__PURE__ */
|
|
96
|
+
}) }, e.id)) }), /* @__PURE__ */ s(r.Body, { children: m.getRowModel().rows.length ? m.getRowModel().rows.map((t) => {
|
|
97
97
|
let n = y?.(t.original), i = !!v || !!n;
|
|
98
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(r.Row, {
|
|
99
99
|
className: e("has-aria-expanded:bg-bg-default-base-secondary", i && "cursor-pointer"),
|
|
100
100
|
onClick: i ? (e) => {
|
|
101
101
|
S(e.target) || (v ? v(t.original) : n && e.currentTarget.querySelector("[data-row-link]")?.click());
|
|
102
102
|
} : void 0,
|
|
103
103
|
children: t.getVisibleCells().map((e, t) => {
|
|
104
104
|
let i = e.column.columnDef.meta;
|
|
105
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ c(r.Cell, {
|
|
106
106
|
...i,
|
|
107
|
-
children: [t === 0 && n && /* @__PURE__ */
|
|
107
|
+
children: [t === 0 && n && /* @__PURE__ */ s(C, {
|
|
108
108
|
href: n,
|
|
109
109
|
"data-row-link": !0,
|
|
110
110
|
className: "hidden",
|
|
@@ -114,9 +114,9 @@ var b = l({
|
|
|
114
114
|
}, e.id);
|
|
115
115
|
})
|
|
116
116
|
}) }, t.id);
|
|
117
|
-
}) : h ? null : /* @__PURE__ */
|
|
117
|
+
}) : h ? null : /* @__PURE__ */ s(r.Row, { children: /* @__PURE__ */ s(r.Cell, {
|
|
118
118
|
colSpan: T,
|
|
119
|
-
children: /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ s("div", {
|
|
120
120
|
"data-slot": "table-empty-state",
|
|
121
121
|
className: "whitespace-normal",
|
|
122
122
|
children: i
|
|
@@ -126,13 +126,13 @@ var b = l({
|
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
C.displayName = "DataTable.Table";
|
|
129
|
-
var w = () => /* @__PURE__ */
|
|
129
|
+
var w = () => /* @__PURE__ */ s("div", {
|
|
130
130
|
className: "mb-6 flex flex-col items-center gap-4",
|
|
131
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ s("div", {
|
|
132
132
|
className: "text-lg",
|
|
133
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ s("b", { children: "No results." })
|
|
134
134
|
})
|
|
135
|
-
}), T = ({ children: e }) => /* @__PURE__ */
|
|
135
|
+
}), T = ({ children: e }) => /* @__PURE__ */ s("div", {
|
|
136
136
|
"data-slot": "data-table-pagination",
|
|
137
137
|
className: "flex justify-end border-t border-border-default-base-primary px-6 py-3",
|
|
138
138
|
children: e
|
|
@@ -140,7 +140,7 @@ var w = () => /* @__PURE__ */ d("div", {
|
|
|
140
140
|
T.displayName = "DataTable.Footer";
|
|
141
141
|
var E = (e) => {
|
|
142
142
|
let { scrollRef: t } = _();
|
|
143
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ s(i, {
|
|
144
144
|
...e,
|
|
145
145
|
onPageChange: (n) => {
|
|
146
146
|
t.current?.scrollTo({ top: 0 }), e.onPageChange(n);
|