@demokit-ui/demokit 0.1.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/README.md +128 -0
- package/dist/app/background-decor.d.ts +1 -0
- package/dist/app/background-decor.js +38 -0
- package/dist/app/container.d.ts +12 -0
- package/dist/app/container.js +29 -0
- package/dist/app/demo1-shell.d.ts +43 -0
- package/dist/app/demo1-shell.js +616 -0
- package/dist/app/tweak-panel.d.ts +22 -0
- package/dist/app/tweak-panel.js +182 -0
- package/dist/components/apexcharts.css +101 -0
- package/dist/components/scrollable.css +120 -0
- package/dist/config/settings.config.d.ts +2 -0
- package/dist/config/settings.config.js +33 -0
- package/dist/config/types.d.ts +50 -0
- package/dist/config.reui.css +337 -0
- package/dist/demos/demo1.css +176 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +484 -0
- package/dist/kit/components/chart/chart/chart.d.ts +57 -0
- package/dist/kit/components/chart/chart/chart.js +206 -0
- package/dist/kit/components/composite/action-bar/action-bar.d.ts +10 -0
- package/dist/kit/components/composite/action-bar/action-bar.js +38 -0
- package/dist/kit/components/composite/action-card/action-card.d.ts +13 -0
- package/dist/kit/components/composite/action-card/action-card.js +35 -0
- package/dist/kit/components/composite/activity-feed/activity-feed.d.ts +17 -0
- package/dist/kit/components/composite/activity-feed/activity-feed.js +26 -0
- package/dist/kit/components/composite/alert-card/alert-card.d.ts +10 -0
- package/dist/kit/components/composite/alert-card/alert-card.js +37 -0
- package/dist/kit/components/composite/approval-flow/approval-flow.d.ts +51 -0
- package/dist/kit/components/composite/approval-flow/approval-flow.js +185 -0
- package/dist/kit/components/composite/auth-shell/auth-shell.d.ts +10 -0
- package/dist/kit/components/composite/auth-shell/auth-shell.js +32 -0
- package/dist/kit/components/composite/board-toolbar/board-toolbar.d.ts +12 -0
- package/dist/kit/components/composite/board-toolbar/board-toolbar.js +44 -0
- package/dist/kit/components/composite/chart-card/chart-card.d.ts +14 -0
- package/dist/kit/components/composite/chart-card/chart-card.js +64 -0
- package/dist/kit/components/composite/chart-toolbar/chart-toolbar.d.ts +17 -0
- package/dist/kit/components/composite/chart-toolbar/chart-toolbar.js +48 -0
- package/dist/kit/components/composite/data-section/data-section.d.ts +17 -0
- package/dist/kit/components/composite/data-section/data-section.js +73 -0
- package/dist/kit/components/composite/description-grid/description-grid.d.ts +12 -0
- package/dist/kit/components/composite/description-grid/description-grid.js +36 -0
- package/dist/kit/components/composite/detail-header/detail-header.d.ts +19 -0
- package/dist/kit/components/composite/detail-header/detail-header.js +43 -0
- package/dist/kit/components/composite/filter-panel/filter-panel.d.ts +18 -0
- package/dist/kit/components/composite/filter-panel/filter-panel.js +86 -0
- package/dist/kit/components/composite/filter-toolbar/filter-toolbar.d.ts +14 -0
- package/dist/kit/components/composite/filter-toolbar/filter-toolbar.js +59 -0
- package/dist/kit/components/composite/forgot-password-form/forgot-password-form.d.ts +9 -0
- package/dist/kit/components/composite/forgot-password-form/forgot-password-form.js +34 -0
- package/dist/kit/components/composite/form-section/form-section.d.ts +9 -0
- package/dist/kit/components/composite/form-section/form-section.js +16 -0
- package/dist/kit/components/composite/kanban-board/kanban-board.d.ts +50 -0
- package/dist/kit/components/composite/kanban-board/kanban-board.js +55 -0
- package/dist/kit/components/composite/login-card/login-card.d.ts +33 -0
- package/dist/kit/components/composite/login-card/login-card.js +138 -0
- package/dist/kit/components/composite/message-list-card/message-list-card.d.ts +20 -0
- package/dist/kit/components/composite/message-list-card/message-list-card.js +83 -0
- package/dist/kit/components/composite/metric-card/metric-card.d.ts +18 -0
- package/dist/kit/components/composite/metric-card/metric-card.js +37 -0
- package/dist/kit/components/composite/milestone-card/milestone-card.d.ts +12 -0
- package/dist/kit/components/composite/milestone-card/milestone-card.js +33 -0
- package/dist/kit/components/composite/oauth-login-buttons/oauth-login-buttons.d.ts +14 -0
- package/dist/kit/components/composite/oauth-login-buttons/oauth-login-buttons.js +32 -0
- package/dist/kit/components/composite/page-header/page-header.d.ts +12 -0
- package/dist/kit/components/composite/page-header/page-header.js +66 -0
- package/dist/kit/components/composite/profile-card/profile-card.d.ts +16 -0
- package/dist/kit/components/composite/profile-card/profile-card.js +28 -0
- package/dist/kit/components/composite/progress-card/progress-card.d.ts +16 -0
- package/dist/kit/components/composite/progress-card/progress-card.js +23 -0
- package/dist/kit/components/composite/project-card/project-card.d.ts +17 -0
- package/dist/kit/components/composite/project-card/project-card.js +46 -0
- package/dist/kit/components/composite/shortcut-card/shortcut-card.d.ts +13 -0
- package/dist/kit/components/composite/shortcut-card/shortcut-card.js +35 -0
- package/dist/kit/components/composite/sprint-summary/sprint-summary.d.ts +15 -0
- package/dist/kit/components/composite/sprint-summary/sprint-summary.js +43 -0
- package/dist/kit/components/composite/state-panel/state-panel.d.ts +12 -0
- package/dist/kit/components/composite/state-panel/state-panel.js +79 -0
- package/dist/kit/components/composite/summary-card/summary-card.d.ts +15 -0
- package/dist/kit/components/composite/summary-card/summary-card.js +25 -0
- package/dist/kit/components/composite/task-card/task-card.d.ts +14 -0
- package/dist/kit/components/composite/task-card/task-card.js +49 -0
- package/dist/kit/components/composite/timeline/timeline.d.ts +46 -0
- package/dist/kit/components/composite/timeline/timeline.js +176 -0
- package/dist/kit/components/composite/todo-card/todo-card.d.ts +26 -0
- package/dist/kit/components/composite/todo-card/todo-card.js +101 -0
- package/dist/kit/components/data-display/avatar/avatar.d.ts +12 -0
- package/dist/kit/components/data-display/avatar/avatar.js +61 -0
- package/dist/kit/components/data-display/avatar-group/avatar-group.d.ts +22 -0
- package/dist/kit/components/data-display/avatar-group/avatar-group.js +184 -0
- package/dist/kit/components/data-display/badge/badge.d.ts +29 -0
- package/dist/kit/components/data-display/badge/badge.js +203 -0
- package/dist/kit/components/data-display/card/card.d.ts +15 -0
- package/dist/kit/components/data-display/card/card.js +119 -0
- package/dist/kit/components/data-display/data-grid/data-grid-column-filter.d.ts +15 -0
- package/dist/kit/components/data-display/data-grid/data-grid-column-filter.js +74 -0
- package/dist/kit/components/data-display/data-grid/data-grid-column-header.d.ts +12 -0
- package/dist/kit/components/data-display/data-grid/data-grid-column-header.js +171 -0
- package/dist/kit/components/data-display/data-grid/data-grid-column-visibility.d.ts +7 -0
- package/dist/kit/components/data-display/data-grid/data-grid-column-visibility.js +24 -0
- package/dist/kit/components/data-display/data-grid/data-grid-pagination.d.ts +15 -0
- package/dist/kit/components/data-display/data-grid/data-grid-pagination.js +132 -0
- package/dist/kit/components/data-display/data-grid/data-grid-table-dnd-rows.d.ts +9 -0
- package/dist/kit/components/data-display/data-grid/data-grid-table-dnd-rows.js +61 -0
- package/dist/kit/components/data-display/data-grid/data-grid-table-dnd.d.ts +5 -0
- package/dist/kit/components/data-display/data-grid/data-grid-table-dnd.js +86 -0
- package/dist/kit/components/data-display/data-grid/data-grid-table.d.ts +59 -0
- package/dist/kit/components/data-display/data-grid/data-grid-table.js +356 -0
- package/dist/kit/components/data-display/data-grid/data-grid.d.ts +87 -0
- package/dist/kit/components/data-display/data-grid/data-grid.js +87 -0
- package/dist/kit/components/data-display/kbd/kbd.d.ts +8 -0
- package/dist/kit/components/data-display/kbd/kbd.js +27 -0
- package/dist/kit/components/data-display/money-amount/money-amount.d.ts +27 -0
- package/dist/kit/components/data-display/money-amount/money-amount.js +91 -0
- package/dist/kit/components/data-display/progress/progress.d.ts +6 -0
- package/dist/kit/components/data-display/progress/progress.js +29 -0
- package/dist/kit/components/data-display/skeleton/skeleton.d.ts +3 -0
- package/dist/kit/components/data-display/skeleton/skeleton.js +8 -0
- package/dist/kit/components/data-display/sliding-number/sliding-number.d.ts +7 -0
- package/dist/kit/components/data-display/sliding-number/sliding-number.js +41 -0
- package/dist/kit/components/data-display/stepper/stepper.d.ts +61 -0
- package/dist/kit/components/data-display/stepper/stepper.js +230 -0
- package/dist/kit/components/data-display/table/table.d.ts +28 -0
- package/dist/kit/components/data-display/table/table.js +156 -0
- package/dist/kit/components/decorative/aurora-background/aurora-background.d.ts +7 -0
- package/dist/kit/components/decorative/aurora-background/aurora-background.js +60 -0
- package/dist/kit/components/decorative/grid-background/grid-background.d.ts +22 -0
- package/dist/kit/components/decorative/grid-background/grid-background.js +46 -0
- package/dist/kit/components/decorative/shimmering-text/shimmering-text.d.ts +29 -0
- package/dist/kit/components/decorative/shimmering-text/shimmering-text.js +64 -0
- package/dist/kit/components/decorative/text-reveal/text-reveal.d.ts +17 -0
- package/dist/kit/components/decorative/text-reveal/text-reveal.js +277 -0
- package/dist/kit/components/feedback/alert/alert.d.ts +21 -0
- package/dist/kit/components/feedback/alert/alert.js +236 -0
- package/dist/kit/components/feedback/alert-dialog/alert-dialog.d.ts +16 -0
- package/dist/kit/components/feedback/alert-dialog/alert-dialog.js +117 -0
- package/dist/kit/components/feedback/context-menu/context-menu.d.ts +24 -0
- package/dist/kit/components/feedback/context-menu/context-menu.js +183 -0
- package/dist/kit/components/feedback/dialog/dialog.d.ts +22 -0
- package/dist/kit/components/feedback/dialog/dialog.js +120 -0
- package/dist/kit/components/feedback/drawer/drawer.d.ts +13 -0
- package/dist/kit/components/feedback/drawer/drawer.js +76 -0
- package/dist/kit/components/feedback/dropdown-menu/dropdown-menu.d.ts +25 -0
- package/dist/kit/components/feedback/dropdown-menu/dropdown-menu.js +200 -0
- package/dist/kit/components/feedback/hover-card/hover-card.d.ts +6 -0
- package/dist/kit/components/feedback/hover-card/hover-card.js +34 -0
- package/dist/kit/components/feedback/popover/popover.d.ts +6 -0
- package/dist/kit/components/feedback/popover/popover.js +34 -0
- package/dist/kit/components/feedback/sheet/sheet.d.ts +22 -0
- package/dist/kit/components/feedback/sheet/sheet.js +128 -0
- package/dist/kit/components/feedback/sonner/sonner.d.ts +5 -0
- package/dist/kit/components/feedback/sonner/sonner.js +21 -0
- package/dist/kit/components/feedback/title-help/title-help.d.ts +10 -0
- package/dist/kit/components/feedback/title-help/title-help.js +44 -0
- package/dist/kit/components/feedback/tooltip/tooltip.d.ts +11 -0
- package/dist/kit/components/feedback/tooltip/tooltip.js +49 -0
- package/dist/kit/components/form/button/button.d.ts +23 -0
- package/dist/kit/components/form/button/button.js +380 -0
- package/dist/kit/components/form/calendar/calendar.d.ts +4 -0
- package/dist/kit/components/form/calendar/calendar.js +47 -0
- package/dist/kit/components/form/checkbox/checkbox.d.ts +8 -0
- package/dist/kit/components/form/checkbox/checkbox.js +39 -0
- package/dist/kit/components/form/command/command.d.ts +21 -0
- package/dist/kit/components/form/command/command.js +116 -0
- package/dist/kit/components/form/datefield/datefield.d.ts +14 -0
- package/dist/kit/components/form/datefield/datefield.js +74 -0
- package/dist/kit/components/form/file-upload/file-upload.d.ts +56 -0
- package/dist/kit/components/form/file-upload/file-upload.js +338 -0
- package/dist/kit/components/form/form/form.d.ts +24 -0
- package/dist/kit/components/form/form/form.js +86 -0
- package/dist/kit/components/form/input/input.d.ts +22 -0
- package/dist/kit/components/form/input/input.js +182 -0
- package/dist/kit/components/form/label/label.d.ts +8 -0
- package/dist/kit/components/form/label/label.js +28 -0
- package/dist/kit/components/form/radio-group/radio-group.d.ts +13 -0
- package/dist/kit/components/form/radio-group/radio-group.js +79 -0
- package/dist/kit/components/form/select/select.d.ts +25 -0
- package/dist/kit/components/form/select/select.js +194 -0
- package/dist/kit/components/form/slider/slider.d.ts +5 -0
- package/dist/kit/components/form/slider/slider.js +34 -0
- package/dist/kit/components/form/switch/switch.d.ts +20 -0
- package/dist/kit/components/form/switch/switch.js +158 -0
- package/dist/kit/components/form/textarea/textarea.d.ts +7 -0
- package/dist/kit/components/form/textarea/textarea.js +34 -0
- package/dist/kit/components/form/toggle/toggle.d.ts +9 -0
- package/dist/kit/components/form/toggle/toggle.js +36 -0
- package/dist/kit/components/form/toggle-group/toggle-group.d.ts +7 -0
- package/dist/kit/components/form/toggle-group/toggle-group.js +62 -0
- package/dist/kit/components/index.d.ts +108 -0
- package/dist/kit/components/layout/accordion/accordion.d.ts +13 -0
- package/dist/kit/components/layout/accordion/accordion.js +124 -0
- package/dist/kit/components/layout/aspect-ratio/aspect-ratio.d.ts +4 -0
- package/dist/kit/components/layout/aspect-ratio/aspect-ratio.js +8 -0
- package/dist/kit/components/layout/collapsible/collapsible.d.ts +6 -0
- package/dist/kit/components/layout/collapsible/collapsible.js +32 -0
- package/dist/kit/components/layout/resizable/resizable.d.ts +24 -0
- package/dist/kit/components/layout/resizable/resizable.js +32 -0
- package/dist/kit/components/layout/scroll-area/scroll-area.d.ts +8 -0
- package/dist/kit/components/layout/scroll-area/scroll-area.js +48 -0
- package/dist/kit/components/layout/separator/separator.d.ts +4 -0
- package/dist/kit/components/layout/separator/separator.js +23 -0
- package/dist/kit/components/navigation/accordion-menu/accordion-menu.d.ts +51 -0
- package/dist/kit/components/navigation/accordion-menu/accordion-menu.js +290 -0
- package/dist/kit/components/navigation/breadcrumb/breadcrumb.d.ts +13 -0
- package/dist/kit/components/navigation/breadcrumb/breadcrumb.js +76 -0
- package/dist/kit/components/navigation/menubar/menubar.d.ts +25 -0
- package/dist/kit/components/navigation/menubar/menubar.js +218 -0
- package/dist/kit/components/navigation/navigation-menu/navigation-menu.d.ts +14 -0
- package/dist/kit/components/navigation/navigation-menu/navigation-menu.js +137 -0
- package/dist/kit/components/navigation/pagination/pagination.d.ts +6 -0
- package/dist/kit/components/navigation/pagination/pagination.js +38 -0
- package/dist/kit/components/navigation/scrollspy/scrollspy.d.ts +14 -0
- package/dist/kit/components/navigation/scrollspy/scrollspy.js +84 -0
- package/dist/kit/components/navigation/tabs/tabs.d.ts +16 -0
- package/dist/kit/components/navigation/tabs/tabs.js +172 -0
- package/dist/kit/themes/theme-toggle.d.ts +1 -0
- package/dist/kit/themes/theme-toggle.js +56 -0
- package/dist/kit/tokens/chart-palette.d.ts +1 -0
- package/dist/kit/tokens/chart-palette.js +12 -0
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.js +8 -0
- package/dist/providers/demokit-provider.d.ts +4 -0
- package/dist/providers/demokit-provider.js +9 -0
- package/dist/providers/settings-provider.d.ts +15 -0
- package/dist/providers/settings-provider.js +78 -0
- package/dist/providers/theme-provider.d.ts +4 -0
- package/dist/providers/theme-provider.js +9 -0
- package/dist/providers/tooltips-provider.d.ts +4 -0
- package/dist/providers/tooltips-provider.js +8 -0
- package/dist/styles.css +237 -0
- package/package.json +72 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { Button as i } from "../../form/button/button.js";
|
|
3
|
+
import { useDataGrid as I } from "./data-grid.js";
|
|
4
|
+
import { Select as y, SelectTrigger as G, SelectValue as L, SelectContent as $, SelectItem as j } from "../../form/select/select.js";
|
|
5
|
+
import { Skeleton as v } from "../skeleton/skeleton.js";
|
|
6
|
+
import { ChevronLeftIcon as B, ChevronRightIcon as M } from "lucide-react";
|
|
7
|
+
import { cn as P } from "../../../../lib/utils.js";
|
|
8
|
+
function H(z) {
|
|
9
|
+
const { table: t, recordCount: d, isLoading: u } = I(), s = { ...{
|
|
10
|
+
sizes: [5, 10, 25, 50, 100],
|
|
11
|
+
sizesLabel: "Show",
|
|
12
|
+
sizesDescription: "per page",
|
|
13
|
+
sizesSkeleton: /* @__PURE__ */ e(v, { className: "h-8 w-44" }),
|
|
14
|
+
moreLimit: 5,
|
|
15
|
+
more: !1,
|
|
16
|
+
info: "{from} - {to} of {count}",
|
|
17
|
+
infoSkeleton: /* @__PURE__ */ e(v, { className: "h-8 w-60" })
|
|
18
|
+
}, ...z }, c = "size-7 p-0 text-sm", h = c + " rtl:transform rtl:rotate-180", a = t.getState().pagination.pageIndex, l = t.getState().pagination.pageSize, x = a * l + 1, N = Math.min((a + 1) * l, d), p = t.getPageCount(), C = s?.info ? s.info.replace("{from}", x.toString()).replace("{to}", N.toString()).replace("{count}", d.toString()) : `${x} - ${N} of ${d}`, g = s?.moreLimit || 5, m = Math.floor(a / g) * g, f = Math.min(m + g, p), w = () => {
|
|
19
|
+
const n = [];
|
|
20
|
+
for (let o = m; o < f; o++)
|
|
21
|
+
n.push(
|
|
22
|
+
/* @__PURE__ */ e(
|
|
23
|
+
i,
|
|
24
|
+
{
|
|
25
|
+
size: "sm",
|
|
26
|
+
mode: "icon",
|
|
27
|
+
variant: "ghost",
|
|
28
|
+
className: P(c, "text-muted-foreground", {
|
|
29
|
+
"bg-accent text-accent-foreground": a === o
|
|
30
|
+
}),
|
|
31
|
+
onClick: () => {
|
|
32
|
+
a !== o && t.setPageIndex(o);
|
|
33
|
+
},
|
|
34
|
+
children: o + 1
|
|
35
|
+
},
|
|
36
|
+
o
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
return n;
|
|
40
|
+
}, b = () => m > 0 ? /* @__PURE__ */ e(
|
|
41
|
+
i,
|
|
42
|
+
{
|
|
43
|
+
size: "sm",
|
|
44
|
+
mode: "icon",
|
|
45
|
+
className: c,
|
|
46
|
+
variant: "ghost",
|
|
47
|
+
onClick: () => t.setPageIndex(m - 1),
|
|
48
|
+
children: "..."
|
|
49
|
+
}
|
|
50
|
+
) : null, k = () => f < p ? /* @__PURE__ */ e(
|
|
51
|
+
i,
|
|
52
|
+
{
|
|
53
|
+
className: c,
|
|
54
|
+
variant: "ghost",
|
|
55
|
+
size: "sm",
|
|
56
|
+
mode: "icon",
|
|
57
|
+
onClick: () => t.setPageIndex(f),
|
|
58
|
+
children: "..."
|
|
59
|
+
}
|
|
60
|
+
) : null;
|
|
61
|
+
return /* @__PURE__ */ r(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
"data-slot": "data-grid-pagination",
|
|
65
|
+
className: P(
|
|
66
|
+
"flex flex-wrap flex-col sm:flex-row justify-between items-center gap-2.5 py-2.5 sm:py-0 grow",
|
|
67
|
+
s?.className
|
|
68
|
+
),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap items-center space-x-2.5 pb-2.5 sm:pb-0 order-2 sm:order-1", children: u ? s?.sizesSkeleton : /* @__PURE__ */ r(S, { children: [
|
|
71
|
+
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: "Rows per page" }),
|
|
72
|
+
/* @__PURE__ */ r(
|
|
73
|
+
y,
|
|
74
|
+
{
|
|
75
|
+
value: `${l}`,
|
|
76
|
+
indicatorPosition: "right",
|
|
77
|
+
onValueChange: (n) => {
|
|
78
|
+
const o = Number(n);
|
|
79
|
+
t.setPageSize(o);
|
|
80
|
+
},
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ e(G, { className: "w-fit", size: "sm", children: /* @__PURE__ */ e(L, { placeholder: `${l}` }) }),
|
|
83
|
+
/* @__PURE__ */ e($, { side: "top", className: "min-w-[50px]", children: s?.sizes?.map((n) => /* @__PURE__ */ e(j, { value: `${n}`, children: n }, n)) })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }) }),
|
|
88
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col sm:flex-row justify-center sm:justify-end items-center gap-2.5 pt-2.5 sm:pt-0 order-1 sm:order-2", children: u ? s?.infoSkeleton : /* @__PURE__ */ r(S, { children: [
|
|
89
|
+
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground text-nowrap order-2 sm:order-1", children: C }),
|
|
90
|
+
p > 1 && /* @__PURE__ */ r("div", { className: "flex items-center space-x-1 order-1 sm:order-2", children: [
|
|
91
|
+
/* @__PURE__ */ r(
|
|
92
|
+
i,
|
|
93
|
+
{
|
|
94
|
+
size: "sm",
|
|
95
|
+
mode: "icon",
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
className: h,
|
|
98
|
+
onClick: () => t.previousPage(),
|
|
99
|
+
disabled: !t.getCanPreviousPage(),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Go to previous page" }),
|
|
102
|
+
/* @__PURE__ */ e(B, { className: "size-4" })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
b(),
|
|
107
|
+
w(),
|
|
108
|
+
k(),
|
|
109
|
+
/* @__PURE__ */ r(
|
|
110
|
+
i,
|
|
111
|
+
{
|
|
112
|
+
size: "sm",
|
|
113
|
+
mode: "icon",
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
className: h,
|
|
116
|
+
onClick: () => t.nextPage(),
|
|
117
|
+
disabled: !t.getCanNextPage(),
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Go to next page" }),
|
|
120
|
+
/* @__PURE__ */ e(M, { className: "size-4" })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] })
|
|
125
|
+
] }) })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
H as DataGridPagination
|
|
132
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UniqueIdentifier, DragEndEvent } from '@dnd-kit/core';
|
|
2
|
+
declare function DataGridTableDndRowHandle({ rowId }: {
|
|
3
|
+
rowId: string;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DataGridTableDndRows<TData>({ handleDragEnd, dataIds, }: {
|
|
6
|
+
handleDragEnd: (event: DragEndEvent) => void;
|
|
7
|
+
dataIds: UniqueIdentifier[];
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { DataGridTableDndRowHandle, DataGridTableDndRows };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useId as g } from "react";
|
|
3
|
+
import { Button as R } from "../../form/button/button.js";
|
|
4
|
+
import { useDataGrid as S } from "./data-grid.js";
|
|
5
|
+
import { DataGridTableBase as T, DataGridTableHead as G, DataGridTableHeadRow as y, DataGridTableHeadRowCell as h, DataGridTableHeadRowCellResize as C, DataGridTableRowSpacer as w, DataGridTableBody as x, DataGridTableBodyRowSkeleton as z, DataGridTableBodyRowSkeletonCell as B, DataGridTableEmpty as H, DataGridTableBodyRow as v, DataGridTableBodyRowCell as L } from "./data-grid-table.js";
|
|
6
|
+
import { useSensors as k, useSensor as p, MouseSensor as M, TouchSensor as N, KeyboardSensor as V, DndContext as j, closestCenter as A } from "@dnd-kit/core";
|
|
7
|
+
import { restrictToVerticalAxis as E } from "@dnd-kit/modifiers";
|
|
8
|
+
import { useSortable as b, SortableContext as I, verticalListSortingStrategy as F } from "@dnd-kit/sortable";
|
|
9
|
+
import { CSS as K } from "@dnd-kit/utilities";
|
|
10
|
+
import { flexRender as D } from "@tanstack/react-table";
|
|
11
|
+
import { GripHorizontal as P } from "lucide-react";
|
|
12
|
+
function te({ rowId: r }) {
|
|
13
|
+
const { attributes: n, listeners: t } = b({
|
|
14
|
+
id: r
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ e(R, { variant: "dim", size: "sm", className: "size-7", ...n, ...t, children: /* @__PURE__ */ e(P, {}) });
|
|
17
|
+
}
|
|
18
|
+
function _({ row: r }) {
|
|
19
|
+
const { transform: n, transition: t, setNodeRef: d, isDragging: i } = b({
|
|
20
|
+
id: r.id
|
|
21
|
+
}), s = {
|
|
22
|
+
transform: K.Transform.toString(n),
|
|
23
|
+
//let dnd-kit do its thing
|
|
24
|
+
transition: t,
|
|
25
|
+
opacity: i ? 0.8 : 1,
|
|
26
|
+
zIndex: i ? 1 : 0,
|
|
27
|
+
position: "relative"
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ e(v, { row: r, dndRef: d, dndStyle: s, children: r.getVisibleCells().map((l, a) => /* @__PURE__ */ e(L, { cell: l, children: D(l.column.columnDef.cell, l.getContext()) }, a)) }, r.id);
|
|
30
|
+
}
|
|
31
|
+
function oe({
|
|
32
|
+
handleDragEnd: r,
|
|
33
|
+
dataIds: n
|
|
34
|
+
}) {
|
|
35
|
+
const { table: t, isLoading: d, props: i } = S(), s = t.getState().pagination, l = k(p(M, {}), p(N, {}), p(V, {}));
|
|
36
|
+
return /* @__PURE__ */ e(
|
|
37
|
+
j,
|
|
38
|
+
{
|
|
39
|
+
id: g(),
|
|
40
|
+
collisionDetection: A,
|
|
41
|
+
modifiers: [E],
|
|
42
|
+
onDragEnd: r,
|
|
43
|
+
sensors: l,
|
|
44
|
+
children: /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ u(T, { children: [
|
|
45
|
+
/* @__PURE__ */ e(G, { children: t.getHeaderGroups().map((a, m) => /* @__PURE__ */ e(y, { headerGroup: a, children: a.headers.map((o, c) => {
|
|
46
|
+
const { column: f } = o;
|
|
47
|
+
return /* @__PURE__ */ u(h, { header: o, children: [
|
|
48
|
+
o.isPlaceholder ? null : D(o.column.columnDef.header, o.getContext()),
|
|
49
|
+
i.tableLayout?.columnsResizable && f.getCanResize() && /* @__PURE__ */ e(C, { header: o })
|
|
50
|
+
] }, c);
|
|
51
|
+
}) }, m)) }),
|
|
52
|
+
(i.tableLayout?.stripped || !i.tableLayout?.rowBorder) && /* @__PURE__ */ e(w, {}),
|
|
53
|
+
/* @__PURE__ */ e(x, { children: i.loadingMode === "skeleton" && d && s?.pageSize ? Array.from({ length: s.pageSize }).map((a, m) => /* @__PURE__ */ e(z, { children: t.getVisibleFlatColumns().map((o, c) => /* @__PURE__ */ e(B, { column: o, children: o.columnDef.meta?.skeleton }, c)) }, m)) : t.getRowModel().rows.length ? /* @__PURE__ */ e(I, { items: n, strategy: F, children: t.getRowModel().rows.map((a) => /* @__PURE__ */ e(_, { row: a }, a.id)) }) : /* @__PURE__ */ e(H, {}) })
|
|
54
|
+
] }) })
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
te as DataGridTableDndRowHandle,
|
|
60
|
+
oe as DataGridTableDndRows
|
|
61
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as e, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as y, useId as T } from "react";
|
|
3
|
+
import { Button as h } from "../../form/button/button.js";
|
|
4
|
+
import { useDataGrid as f } from "./data-grid.js";
|
|
5
|
+
import { DataGridTableBase as R, DataGridTableHead as G, DataGridTableHeadRow as w, DataGridTableRowSpacer as C, DataGridTableBody as x, DataGridTableBodyRowSkeleton as z, DataGridTableBodyRowSkeletonCell as B, DataGridTableBodyRow as v, DataGridTableBodyRowExpandded as H, DataGridTableEmpty as N, DataGridTableHeadRowCell as E, DataGridTableHeadRowCellResize as L, DataGridTableBodyRowCell as k } from "./data-grid-table.js";
|
|
6
|
+
import { useSensors as I, useSensor as c, MouseSensor as M, TouchSensor as O, KeyboardSensor as j, DndContext as V, closestCenter as F } from "@dnd-kit/core";
|
|
7
|
+
import { restrictToParentElement as P } from "@dnd-kit/modifiers";
|
|
8
|
+
import { SortableContext as p, horizontalListSortingStrategy as u, useSortable as b } from "@dnd-kit/sortable";
|
|
9
|
+
import { CSS as D } from "@dnd-kit/utilities";
|
|
10
|
+
import { flexRender as S } from "@tanstack/react-table";
|
|
11
|
+
import { GripVertical as A } from "lucide-react";
|
|
12
|
+
function K({ header: t }) {
|
|
13
|
+
const { props: r } = f(), { column: d } = t, { attributes: i, isDragging: n, listeners: s, setNodeRef: a, transform: l, transition: o } = b({
|
|
14
|
+
id: t.column.id
|
|
15
|
+
}), m = {
|
|
16
|
+
opacity: n ? 0.8 : 1,
|
|
17
|
+
position: "relative",
|
|
18
|
+
transform: D.Translate.toString(l),
|
|
19
|
+
transition: o,
|
|
20
|
+
whiteSpace: "nowrap",
|
|
21
|
+
width: t.column.getSize(),
|
|
22
|
+
zIndex: n ? 1 : 0
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ e(E, { header: t, dndStyle: m, dndRef: a, children: /* @__PURE__ */ g("div", { className: "flex items-center justify-start gap-0.5", children: [
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
h,
|
|
27
|
+
{
|
|
28
|
+
mode: "icon",
|
|
29
|
+
size: "sm",
|
|
30
|
+
variant: "dim",
|
|
31
|
+
className: "-ms-2 size-6",
|
|
32
|
+
...i,
|
|
33
|
+
...s,
|
|
34
|
+
"aria-label": "Drag to reorder",
|
|
35
|
+
children: /* @__PURE__ */ e(A, { className: "opacity-50", "aria-hidden": "true" })
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
t.isPlaceholder ? null : S(t.column.columnDef.header, t.getContext()),
|
|
39
|
+
r.tableLayout?.columnsResizable && d.getCanResize() && /* @__PURE__ */ e(L, { header: t })
|
|
40
|
+
] }) });
|
|
41
|
+
}
|
|
42
|
+
function _({ cell: t }) {
|
|
43
|
+
const { isDragging: r, setNodeRef: d, transform: i, transition: n } = b({
|
|
44
|
+
id: t.column.id
|
|
45
|
+
}), s = {
|
|
46
|
+
opacity: r ? 0.8 : 1,
|
|
47
|
+
position: "relative",
|
|
48
|
+
transform: D.Translate.toString(i),
|
|
49
|
+
transition: n,
|
|
50
|
+
width: t.column.getSize(),
|
|
51
|
+
zIndex: r ? 1 : 0
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ e(k, { cell: t, dndStyle: s, dndRef: d, children: S(t.column.columnDef.cell, t.getContext()) });
|
|
54
|
+
}
|
|
55
|
+
function re({ handleDragEnd: t }) {
|
|
56
|
+
const { table: r, isLoading: d, props: i } = f(), n = r.getState().pagination, s = I(c(M, {}), c(O, {}), c(j, {}));
|
|
57
|
+
return /* @__PURE__ */ e(
|
|
58
|
+
V,
|
|
59
|
+
{
|
|
60
|
+
id: T(),
|
|
61
|
+
collisionDetection: F,
|
|
62
|
+
modifiers: [P],
|
|
63
|
+
onDragEnd: t,
|
|
64
|
+
sensors: s,
|
|
65
|
+
children: /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ g(R, { children: [
|
|
66
|
+
/* @__PURE__ */ e(G, { children: r.getHeaderGroups().map((a, l) => (console.log("table.getState().columnOrder:", r.getState().columnOrder), /* @__PURE__ */ e(w, { headerGroup: a, children: /* @__PURE__ */ e(p, { items: r.getState().columnOrder, strategy: u, children: a.headers.map((o, m) => /* @__PURE__ */ e(K, { header: o }, m)) }) }, l))) }),
|
|
67
|
+
(i.tableLayout?.stripped || !i.tableLayout?.rowBorder) && /* @__PURE__ */ e(C, {}),
|
|
68
|
+
/* @__PURE__ */ e(x, { children: i.loadingMode === "skeleton" && d && n?.pageSize ? Array.from({ length: n.pageSize }).map((a, l) => /* @__PURE__ */ e(z, { children: r.getVisibleFlatColumns().map((o, m) => /* @__PURE__ */ e(B, { column: o, children: o.columnDef.meta?.skeleton }, m)) }, l)) : r.getRowModel().rows.length ? r.getRowModel().rows.map((a, l) => /* @__PURE__ */ g(y, { children: [
|
|
69
|
+
/* @__PURE__ */ e(v, { row: a, children: a.getVisibleCells().map((o) => /* @__PURE__ */ e(
|
|
70
|
+
p,
|
|
71
|
+
{
|
|
72
|
+
items: r.getState().columnOrder,
|
|
73
|
+
strategy: u,
|
|
74
|
+
children: /* @__PURE__ */ e(_, { cell: o })
|
|
75
|
+
},
|
|
76
|
+
o.id
|
|
77
|
+
)) }, l),
|
|
78
|
+
a.getIsExpanded() && /* @__PURE__ */ e(H, { row: a })
|
|
79
|
+
] }, a.id)) : /* @__PURE__ */ e(N, {}) })
|
|
80
|
+
] }) })
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
re as DataGridTableDnd
|
|
86
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { Cell, Column, Header, HeaderGroup, Row } from '@tanstack/react-table';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare function DataGridTableBase({ children }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DataGridTableHead({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function DataGridTableHeadRow<TData>({ children, headerGroup, }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
headerGroup: HeaderGroup<TData>;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DataGridTableHeadRowCell<TData>({ children, header, dndRef, dndStyle, }: {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
header: Header<TData, unknown>;
|
|
17
|
+
dndRef?: React.Ref<HTMLTableCellElement>;
|
|
18
|
+
dndStyle?: CSSProperties;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function DataGridTableHeadRowCellResize<TData>({ header }: {
|
|
21
|
+
header: Header<TData, unknown>;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function DataGridTableRowSpacer(): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function DataGridTableBody({ children }: {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
declare function DataGridTableBodyRowSkeleton({ children }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare function DataGridTableBodyRowSkeletonCell<TData>({ children, column }: {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
column: Column<TData>;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
declare function DataGridTableBodyRow<TData>({ children, row, dndRef, dndStyle, }: {
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
row: Row<TData>;
|
|
37
|
+
dndRef?: React.Ref<HTMLTableRowElement>;
|
|
38
|
+
dndStyle?: CSSProperties;
|
|
39
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare function DataGridTableBodyRowExpandded<TData>({ row }: {
|
|
41
|
+
row: Row<TData>;
|
|
42
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
declare function DataGridTableBodyRowCell<TData>({ children, cell, dndRef, dndStyle, }: {
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
cell: Cell<TData, unknown>;
|
|
46
|
+
dndRef?: React.Ref<HTMLTableCellElement>;
|
|
47
|
+
dndStyle?: CSSProperties;
|
|
48
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
declare function DataGridTableEmpty(): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
declare function DataGridTableLoader(): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare function DataGridTableRowSelect<TData>({ row, size }: {
|
|
52
|
+
row: Row<TData>;
|
|
53
|
+
size?: 'sm' | 'md' | 'lg';
|
|
54
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
declare function DataGridTableRowSelectAll({ size }: {
|
|
56
|
+
size?: 'sm' | 'md' | 'lg';
|
|
57
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
declare function DataGridTable<TData>(): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export { DataGridTable, DataGridTableBase, DataGridTableBody, DataGridTableBodyRow, DataGridTableBodyRowCell, DataGridTableBodyRowExpandded, DataGridTableBodyRowSkeleton, DataGridTableBodyRowSkeletonCell, DataGridTableEmpty, DataGridTableHead, DataGridTableHeadRow, DataGridTableHeadRowCell, DataGridTableHeadRowCellResize, DataGridTableLoader, DataGridTableRowSelect, DataGridTableRowSelectAll, DataGridTableRowSpacer, };
|