@bzync/rui 0.0.3
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/LICENSE +15 -0
- package/README.md +115 -0
- package/dist/autocomplete-CaysJRpk.cjs +1 -0
- package/dist/autocomplete-CfbfpcO4.js +453 -0
- package/dist/calendar-Bnld4G59.cjs +1 -0
- package/dist/calendar-CdICOROs.js +573 -0
- package/dist/charts-CxEy2c3M.js +1248 -0
- package/dist/charts-UDqS1BH1.cjs +1 -0
- package/dist/cn-BdjraxxU.cjs +1 -0
- package/dist/cn-DpgY2leY.js +1736 -0
- package/dist/component-styles-Ce56hn9T.js +16 -0
- package/dist/component-styles-TkZ7v6Ef.cjs +1 -0
- package/dist/components/accordion.cjs +1 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +122 -0
- package/dist/components/alert.cjs +1 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +165 -0
- package/dist/components/auth-backdrop.cjs +1 -0
- package/dist/components/auth-backdrop.d.ts +7 -0
- package/dist/components/auth-backdrop.js +10 -0
- package/dist/components/autocomplete/dropdown.d.ts +21 -0
- package/dist/components/autocomplete/icons.d.ts +8 -0
- package/dist/components/autocomplete/multi-trigger.d.ts +25 -0
- package/dist/components/autocomplete/single-trigger.d.ts +21 -0
- package/dist/components/autocomplete/types.d.ts +34 -0
- package/dist/components/autocomplete.cjs +1 -0
- package/dist/components/autocomplete.d.ts +5 -0
- package/dist/components/autocomplete.js +3 -0
- package/dist/components/avatar.cjs +1 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +56 -0
- package/dist/components/badge.cjs +1 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/billing-interval-toggle.cjs +1 -0
- package/dist/components/billing-interval-toggle.d.ts +18 -0
- package/dist/components/billing-interval-toggle.js +39 -0
- package/dist/components/breadcrumb.cjs +1 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +52 -0
- package/dist/components/button.cjs +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +90 -0
- package/dist/components/calendar/month-view.d.ts +17 -0
- package/dist/components/calendar/types.d.ts +54 -0
- package/dist/components/calendar/week-view.d.ts +17 -0
- package/dist/components/calendar.cjs +1 -0
- package/dist/components/calendar.d.ts +3 -0
- package/dist/components/calendar.js +3 -0
- package/dist/components/callout.cjs +1 -0
- package/dist/components/callout.d.ts +9 -0
- package/dist/components/callout.js +131 -0
- package/dist/components/card.cjs +1 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +59 -0
- package/dist/components/charts/bar-chart.d.ts +16 -0
- package/dist/components/charts/donut-chart.d.ts +10 -0
- package/dist/components/charts/funnel-chart.d.ts +8 -0
- package/dist/components/charts/gantt-chart.d.ts +15 -0
- package/dist/components/charts/heatmap-chart.d.ts +10 -0
- package/dist/components/charts/index.d.ts +11 -0
- package/dist/components/charts/line-chart.d.ts +16 -0
- package/dist/components/charts/multi-line-chart.d.ts +18 -0
- package/dist/components/charts/radar-chart.d.ts +13 -0
- package/dist/components/charts/scatter-chart.d.ts +24 -0
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts/waterfall-chart.d.ts +14 -0
- package/dist/components/charts.cjs +1 -0
- package/dist/components/charts.d.ts +2 -0
- package/dist/components/charts.js +2 -0
- package/dist/components/checkbox.cjs +1 -0
- package/dist/components/checkbox.d.ts +9 -0
- package/dist/components/checkbox.js +135 -0
- package/dist/components/code.cjs +7 -0
- package/dist/components/code.d.ts +23 -0
- package/dist/components/code.js +276 -0
- package/dist/components/command.cjs +1 -0
- package/dist/components/command.d.ts +29 -0
- package/dist/components/command.js +208 -0
- package/dist/components/confirm-dialog.cjs +1 -0
- package/dist/components/confirm-dialog.d.ts +14 -0
- package/dist/components/confirm-dialog.js +69 -0
- package/dist/components/copy-button.cjs +1 -0
- package/dist/components/copy-button.d.ts +8 -0
- package/dist/components/copy-button.js +87 -0
- package/dist/components/datatable/pagination-footer.d.ts +10 -0
- package/dist/components/datatable/rows-dropdown.d.ts +5 -0
- package/dist/components/datatable/skeleton-row.d.ts +3 -0
- package/dist/components/datatable/sort-icon.d.ts +4 -0
- package/dist/components/datatable/types.d.ts +30 -0
- package/dist/components/datatable.cjs +1 -0
- package/dist/components/datatable.d.ts +9 -0
- package/dist/components/datatable.js +3 -0
- package/dist/components/datepicker.cjs +1 -0
- package/dist/components/datepicker.d.ts +14 -0
- package/dist/components/datepicker.js +267 -0
- package/dist/components/drawer.cjs +1 -0
- package/dist/components/drawer.d.ts +18 -0
- package/dist/components/drawer.js +3 -0
- package/dist/components/dropdown-menu.cjs +1 -0
- package/dist/components/dropdown-menu.d.ts +26 -0
- package/dist/components/dropdown-menu.js +122 -0
- package/dist/components/empty-state.cjs +1 -0
- package/dist/components/empty-state.d.ts +10 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/error-state.cjs +1 -0
- package/dist/components/error-state.d.ts +10 -0
- package/dist/components/error-state.js +80 -0
- package/dist/components/file-upload.cjs +1 -0
- package/dist/components/file-upload.d.ts +10 -0
- package/dist/components/file-upload.js +173 -0
- package/dist/components/form-field.cjs +1 -0
- package/dist/components/form-field.d.ts +10 -0
- package/dist/components/form-field.js +36 -0
- package/dist/components/info-button.cjs +1 -0
- package/dist/components/info-button.d.ts +4 -0
- package/dist/components/info-button.js +32 -0
- package/dist/components/input.cjs +1 -0
- package/dist/components/input.d.ts +19 -0
- package/dist/components/input.js +117 -0
- package/dist/components/kbd.cjs +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +16 -0
- package/dist/components/label.cjs +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +31 -0
- package/dist/components/layout.cjs +1 -0
- package/dist/components/layout.d.ts +51 -0
- package/dist/components/layout.js +117 -0
- package/dist/components/link.cjs +1 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +48 -0
- package/dist/components/list.cjs +1 -0
- package/dist/components/list.d.ts +13 -0
- package/dist/components/list.js +46 -0
- package/dist/components/modal.cjs +1 -0
- package/dist/components/modal.d.ts +31 -0
- package/dist/components/modal.js +219 -0
- package/dist/components/navigation.cjs +1 -0
- package/dist/components/navigation.d.ts +42 -0
- package/dist/components/navigation.js +127 -0
- package/dist/components/number-input.cjs +1 -0
- package/dist/components/number-input.d.ts +16 -0
- package/dist/components/number-input.js +142 -0
- package/dist/components/otp-input.cjs +1 -0
- package/dist/components/otp-input.d.ts +13 -0
- package/dist/components/otp-input.js +71 -0
- package/dist/components/pagination.cjs +1 -0
- package/dist/components/pagination.d.ts +8 -0
- package/dist/components/pagination.js +77 -0
- package/dist/components/popover.cjs +1 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +115 -0
- package/dist/components/progressbar.cjs +1 -0
- package/dist/components/progressbar.d.ts +15 -0
- package/dist/components/progressbar.js +108 -0
- package/dist/components/radio.cjs +1 -0
- package/dist/components/radio.d.ts +22 -0
- package/dist/components/radio.js +96 -0
- package/dist/components/richtext.cjs +1 -0
- package/dist/components/richtext.d.ts +10 -0
- package/dist/components/richtext.js +370 -0
- package/dist/components/select/option-list.d.ts +16 -0
- package/dist/components/select/select-multi.d.ts +2 -0
- package/dist/components/select/select-single.d.ts +2 -0
- package/dist/components/select/types.d.ts +54 -0
- package/dist/components/select/utils.d.ts +10 -0
- package/dist/components/select.cjs +1 -0
- package/dist/components/select.d.ts +3 -0
- package/dist/components/select.js +2 -0
- package/dist/components/seo.cjs +1 -0
- package/dist/components/seo.d.ts +45 -0
- package/dist/components/seo.js +64 -0
- package/dist/components/separator.cjs +1 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/skeleton.cjs +1 -0
- package/dist/components/skeleton.d.ts +37 -0
- package/dist/components/skeleton.js +146 -0
- package/dist/components/slider.cjs +1 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +72 -0
- package/dist/components/snackbar.cjs +1 -0
- package/dist/components/snackbar.d.ts +35 -0
- package/dist/components/snackbar.js +220 -0
- package/dist/components/spinner.cjs +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.js +31 -0
- package/dist/components/stat.cjs +1 -0
- package/dist/components/stat.d.ts +18 -0
- package/dist/components/stat.js +90 -0
- package/dist/components/status-dot.cjs +1 -0
- package/dist/components/status-dot.d.ts +10 -0
- package/dist/components/status-dot.js +29 -0
- package/dist/components/stepper.cjs +1 -0
- package/dist/components/stepper.d.ts +11 -0
- package/dist/components/stepper.js +67 -0
- package/dist/components/switch.cjs +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +79 -0
- package/dist/components/table.cjs +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +54 -0
- package/dist/components/tabs.cjs +1 -0
- package/dist/components/tabs.d.ts +22 -0
- package/dist/components/tabs.js +120 -0
- package/dist/components/tag.cjs +1 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/terminal/fs.d.ts +10 -0
- package/dist/components/terminal/shell-commands-sim.d.ts +5 -0
- package/dist/components/terminal/shell-commands.d.ts +16 -0
- package/dist/components/terminal/shell-run.d.ts +11 -0
- package/dist/components/terminal/terminal-block.d.ts +13 -0
- package/dist/components/terminal/terminal-emulator.d.ts +10 -0
- package/dist/components/terminal/types.d.ts +35 -0
- package/dist/components/terminal.cjs +1 -0
- package/dist/components/terminal.d.ts +2 -0
- package/dist/components/terminal.js +2 -0
- package/dist/components/textarea.cjs +1 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/theme-provider.cjs +1 -0
- package/dist/components/theme-provider.d.ts +89 -0
- package/dist/components/theme-provider.js +93 -0
- package/dist/components/theme-toggle.cjs +1 -0
- package/dist/components/theme-toggle.d.ts +9 -0
- package/dist/components/theme-toggle.js +4 -0
- package/dist/components/timeline.cjs +1 -0
- package/dist/components/timeline.d.ts +14 -0
- package/dist/components/timeline.js +54 -0
- package/dist/components/tooltip.cjs +1 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +84 -0
- package/dist/components/tree.cjs +1 -0
- package/dist/components/tree.d.ts +16 -0
- package/dist/components/tree.js +92 -0
- package/dist/createLucideIcon-DDY8HuQR.js +42 -0
- package/dist/createLucideIcon-b_X_3fj-.cjs +1 -0
- package/dist/datatable-BB3v__r5.cjs +1 -0
- package/dist/datatable-DlBhUhuO.js +316 -0
- package/dist/drawer-Cbuh6qdL.cjs +1 -0
- package/dist/drawer-CqkVZT9Y.js +189 -0
- package/dist/focus-Dk1YWVPN.js +42 -0
- package/dist/focus-DmG6Ge7X.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +215 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/component-styles.d.ts +10 -0
- package/dist/select-Ch5fp1GT.js +461 -0
- package/dist/select-q0YCMhBP.cjs +1 -0
- package/dist/styles.css +3 -0
- package/dist/terminal-BOR2cFi1.js +1060 -0
- package/dist/terminal-CpraMs50.cjs +77 -0
- package/dist/theme-toggle-CnoiorKV.js +71 -0
- package/dist/theme-toggle-Dp1-24zH.cjs +1 -0
- package/dist/use-event-callback-DGkfO_uu.js +10 -0
- package/dist/use-event-callback-Du9_9eAi.cjs +1 -0
- package/dist/utils-CQ8pvCtk.js +72 -0
- package/dist/utils-DOFJTw8o.cjs +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import { AnimatePresence as t, motion as n } from "framer-motion";
|
|
4
|
+
import { cloneElement as r, isValidElement as i, useEffect as a, useId as o, useRef as s, useState as c } from "react";
|
|
5
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/tooltip.tsx
|
|
7
|
+
var d = {
|
|
8
|
+
top: {
|
|
9
|
+
container: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
10
|
+
initial: { y: 4 }
|
|
11
|
+
},
|
|
12
|
+
bottom: {
|
|
13
|
+
container: "top-full left-1/2 -translate-x-1/2 mt-2",
|
|
14
|
+
initial: { y: -4 }
|
|
15
|
+
},
|
|
16
|
+
left: {
|
|
17
|
+
container: "right-full top-1/2 -translate-y-1/2 mr-2",
|
|
18
|
+
initial: { x: 4 }
|
|
19
|
+
},
|
|
20
|
+
right: {
|
|
21
|
+
container: "left-full top-1/2 -translate-y-1/2 ml-2",
|
|
22
|
+
initial: { x: -4 }
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function f({ content: f, children: p, position: m = "top", delayMs: h = 0, className: g }) {
|
|
26
|
+
let [_, v] = c(!1), y = s(null), b = o(), { container: x, initial: S } = d[m];
|
|
27
|
+
function C() {
|
|
28
|
+
h > 0 ? y.current = setTimeout(() => v(!0), h) : v(!0);
|
|
29
|
+
}
|
|
30
|
+
function w() {
|
|
31
|
+
y.current && clearTimeout(y.current), v(!1);
|
|
32
|
+
}
|
|
33
|
+
a(() => () => {
|
|
34
|
+
y.current && clearTimeout(y.current);
|
|
35
|
+
}, []);
|
|
36
|
+
let T = i(p) ? r(p, {
|
|
37
|
+
"aria-describedby": _ ? b : void 0,
|
|
38
|
+
onMouseEnter: (e) => {
|
|
39
|
+
p.props.onMouseEnter?.(e), e.defaultPrevented || C();
|
|
40
|
+
},
|
|
41
|
+
onMouseLeave: (e) => {
|
|
42
|
+
p.props.onMouseLeave?.(e), w();
|
|
43
|
+
},
|
|
44
|
+
onFocus: (e) => {
|
|
45
|
+
p.props.onFocus?.(e), e.defaultPrevented || C();
|
|
46
|
+
},
|
|
47
|
+
onBlur: (e) => {
|
|
48
|
+
p.props.onBlur?.(e), w();
|
|
49
|
+
}
|
|
50
|
+
}) : /* @__PURE__ */ l("span", {
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
"aria-describedby": _ ? b : void 0,
|
|
53
|
+
onMouseEnter: C,
|
|
54
|
+
onMouseLeave: w,
|
|
55
|
+
onFocus: C,
|
|
56
|
+
onBlur: w,
|
|
57
|
+
children: p
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ u("div", {
|
|
60
|
+
className: "relative inline-flex",
|
|
61
|
+
children: [T, /* @__PURE__ */ l(t, { children: _ && /* @__PURE__ */ l(n.div, {
|
|
62
|
+
id: b,
|
|
63
|
+
role: "tooltip",
|
|
64
|
+
initial: {
|
|
65
|
+
opacity: 0,
|
|
66
|
+
...S
|
|
67
|
+
},
|
|
68
|
+
animate: {
|
|
69
|
+
opacity: 1,
|
|
70
|
+
y: 0,
|
|
71
|
+
x: 0
|
|
72
|
+
},
|
|
73
|
+
exit: {
|
|
74
|
+
opacity: 0,
|
|
75
|
+
...S
|
|
76
|
+
},
|
|
77
|
+
transition: { duration: .12 },
|
|
78
|
+
className: e("absolute z-50 pointer-events-none", "max-w-[min(20rem,calc(100vw-2rem))] rounded-md px-2.5 py-1.5 text-xs font-medium leading-4", "border border-slate-700 bg-slate-900 text-slate-50 shadow-floating dark:border-border-strong dark:bg-surface-raised dark:text-foreground", x, g),
|
|
79
|
+
children: f
|
|
80
|
+
}) })]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { f as Tooltip };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");let t=require("framer-motion"),n=require("react"),r=require("react/jsx-runtime");function i({nodes:t,selected:i,onSelect:o,defaultExpanded:s=[],className:c}){let[l,u]=(0,n.useState)(new Set(s));function d(e){u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,r.jsx)(`div`,{className:e.t(`select-none`,c),children:(0,r.jsx)(a,{nodes:t,expanded:l,selected:i,onToggle:d,onSelect:o,depth:0})})}function a({nodes:n,expanded:i,selected:o,onToggle:s,onSelect:c,depth:l}){return(0,r.jsx)(`ul`,{children:n.map(n=>{let u=i.has(n.id),d=o===n.id,f=!!n.children?.length;return(0,r.jsxs)(`li`,{children:[(0,r.jsxs)(`div`,{style:{paddingLeft:l*16+4},onClick:()=>{n.disabled||(f&&s(n.id),c?.(n.id))},className:e.t(`flex items-center gap-1.5 h-8 pr-2 rounded-lg cursor-pointer transition-colors group`,d?`bg-accent-500/10 text-accent-400`:`text-slate-600 dark:text-slate-300 hover:bg-black/6 dark:hover:bg-white/6`,n.disabled&&`opacity-40 cursor-not-allowed`),children:[f?(0,r.jsx)(t.motion.span,{animate:{rotate:u?90:0},transition:{duration:.15},className:`shrink-0 w-4 flex items-center justify-center text-slate-500`,children:(0,r.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}):(0,r.jsx)(`span`,{className:`w-4 shrink-0`}),n.icon&&(0,r.jsx)(`span`,{className:e.t(`shrink-0 w-4 h-4 flex items-center justify-center`,d?`text-accent-400`:`text-slate-500`),children:n.icon}),(0,r.jsx)(`span`,{className:`flex-1 min-w-0 text-sm truncate`,children:n.label})]}),(0,r.jsx)(t.AnimatePresence,{initial:!1,children:f&&u&&(0,r.jsx)(t.motion.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:`overflow-hidden`,children:(0,r.jsx)(a,{nodes:n.children,expanded:i,selected:o,onToggle:s,onSelect:c,depth:l+1})})})]},n.id)})})}exports.Tree=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TreeNode {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
children?: TreeNode[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TreeProps {
|
|
10
|
+
nodes: TreeNode[];
|
|
11
|
+
selected?: string;
|
|
12
|
+
onSelect?: (id: string) => void;
|
|
13
|
+
defaultExpanded?: string[];
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function Tree({ nodes, selected, onSelect, defaultExpanded, className }: TreeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import { AnimatePresence as t, motion as n } from "framer-motion";
|
|
4
|
+
import { useState as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/tree.tsx
|
|
7
|
+
function o({ nodes: t, selected: n, onSelect: a, defaultExpanded: o = [], className: c }) {
|
|
8
|
+
let [l, u] = r(new Set(o));
|
|
9
|
+
function d(e) {
|
|
10
|
+
u((t) => {
|
|
11
|
+
let n = new Set(t);
|
|
12
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ i("div", {
|
|
16
|
+
className: e("select-none", c),
|
|
17
|
+
children: /* @__PURE__ */ i(s, {
|
|
18
|
+
nodes: t,
|
|
19
|
+
expanded: l,
|
|
20
|
+
selected: n,
|
|
21
|
+
onToggle: d,
|
|
22
|
+
onSelect: a,
|
|
23
|
+
depth: 0
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function s({ nodes: r, expanded: o, selected: c, onToggle: l, onSelect: u, depth: d }) {
|
|
28
|
+
return /* @__PURE__ */ i("ul", { children: r.map((r) => {
|
|
29
|
+
let f = o.has(r.id), p = c === r.id, m = !!r.children?.length;
|
|
30
|
+
return /* @__PURE__ */ a("li", { children: [/* @__PURE__ */ a("div", {
|
|
31
|
+
style: { paddingLeft: d * 16 + 4 },
|
|
32
|
+
onClick: () => {
|
|
33
|
+
r.disabled || (m && l(r.id), u?.(r.id));
|
|
34
|
+
},
|
|
35
|
+
className: e("flex items-center gap-1.5 h-8 pr-2 rounded-lg cursor-pointer transition-colors group", p ? "bg-accent-500/10 text-accent-400" : "text-slate-600 dark:text-slate-300 hover:bg-black/6 dark:hover:bg-white/6", r.disabled && "opacity-40 cursor-not-allowed"),
|
|
36
|
+
children: [
|
|
37
|
+
m ? /* @__PURE__ */ i(n.span, {
|
|
38
|
+
animate: { rotate: f ? 90 : 0 },
|
|
39
|
+
transition: { duration: .15 },
|
|
40
|
+
className: "shrink-0 w-4 flex items-center justify-center text-slate-500",
|
|
41
|
+
children: /* @__PURE__ */ i("svg", {
|
|
42
|
+
width: "12",
|
|
43
|
+
height: "12",
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
fill: "none",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: "2.5",
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
strokeLinejoin: "round",
|
|
50
|
+
children: /* @__PURE__ */ i("path", { d: "m9 18 6-6-6-6" })
|
|
51
|
+
})
|
|
52
|
+
}) : /* @__PURE__ */ i("span", { className: "w-4 shrink-0" }),
|
|
53
|
+
r.icon && /* @__PURE__ */ i("span", {
|
|
54
|
+
className: e("shrink-0 w-4 h-4 flex items-center justify-center", p ? "text-accent-400" : "text-slate-500"),
|
|
55
|
+
children: r.icon
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ i("span", {
|
|
58
|
+
className: "flex-1 min-w-0 text-sm truncate",
|
|
59
|
+
children: r.label
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}), /* @__PURE__ */ i(t, {
|
|
63
|
+
initial: !1,
|
|
64
|
+
children: m && f && /* @__PURE__ */ i(n.div, {
|
|
65
|
+
initial: {
|
|
66
|
+
height: 0,
|
|
67
|
+
opacity: 0
|
|
68
|
+
},
|
|
69
|
+
animate: {
|
|
70
|
+
height: "auto",
|
|
71
|
+
opacity: 1
|
|
72
|
+
},
|
|
73
|
+
exit: {
|
|
74
|
+
height: 0,
|
|
75
|
+
opacity: 0
|
|
76
|
+
},
|
|
77
|
+
transition: { duration: .15 },
|
|
78
|
+
className: "overflow-hidden",
|
|
79
|
+
children: /* @__PURE__ */ i(s, {
|
|
80
|
+
nodes: r.children,
|
|
81
|
+
expanded: o,
|
|
82
|
+
selected: c,
|
|
83
|
+
onToggle: l,
|
|
84
|
+
onSelect: u,
|
|
85
|
+
depth: d + 1
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
})] }, r.id);
|
|
89
|
+
}) });
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { o as Tree };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createContext as e, createElement as t, forwardRef as n, useContext as r } from "react";
|
|
2
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
3
|
+
var i = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), a = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), o = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), s = (e) => {
|
|
4
|
+
let t = o(e);
|
|
5
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
6
|
+
}, c = {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: 24,
|
|
9
|
+
height: 24,
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: 2,
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round"
|
|
16
|
+
}, l = (e) => {
|
|
17
|
+
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
18
|
+
return !1;
|
|
19
|
+
}, u = e({}), d = () => r(u), f = n(({ color: e, size: n, strokeWidth: r, absoluteStrokeWidth: a, className: o = "", children: s, iconNode: u, ...f }, p) => {
|
|
20
|
+
let { size: m = 24, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, color: _ = "currentColor", className: v = "" } = d() ?? {}, y = a ?? g ? Number(r ?? h) * 24 / Number(n ?? m) : r ?? h;
|
|
21
|
+
return t("svg", {
|
|
22
|
+
ref: p,
|
|
23
|
+
...c,
|
|
24
|
+
width: n ?? m ?? c.width,
|
|
25
|
+
height: n ?? m ?? c.height,
|
|
26
|
+
stroke: e ?? _,
|
|
27
|
+
strokeWidth: y,
|
|
28
|
+
className: i("lucide", v, o),
|
|
29
|
+
...!s && !l(f) && { "aria-hidden": "true" },
|
|
30
|
+
...f
|
|
31
|
+
}, [...u.map(([e, n]) => t(e, n)), ...Array.isArray(s) ? s : [s]]);
|
|
32
|
+
}), p = (e, r) => {
|
|
33
|
+
let o = n(({ className: n, ...o }, c) => t(f, {
|
|
34
|
+
ref: c,
|
|
35
|
+
iconNode: r,
|
|
36
|
+
className: i(`lucide-${a(s(e))}`, `lucide-${e}`, n),
|
|
37
|
+
...o
|
|
38
|
+
}));
|
|
39
|
+
return o.displayName = s(e), o;
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { p as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react");var t=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),n=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),r=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),i=e=>{let t=r(e);return t.charAt(0).toUpperCase()+t.slice(1)},a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},o=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},s=(0,e.createContext)({}),c=()=>(0,e.useContext)(s),l=(0,e.forwardRef)(({color:n,size:r,strokeWidth:i,absoluteStrokeWidth:s,className:l=``,children:u,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=c()??{},y=s??g?Number(i??h)*24/Number(r??m):i??h;return(0,e.createElement)(`svg`,{ref:p,...a,width:r??m??a.width,height:r??m??a.height,stroke:n??_,strokeWidth:y,className:t(`lucide`,v,l),...!u&&!o(f)&&{"aria-hidden":`true`},...f},[...d.map(([t,n])=>(0,e.createElement)(t,n)),...Array.isArray(u)?u:[u]])}),u=(r,a)=>{let o=(0,e.forwardRef)(({className:o,...s},c)=>(0,e.createElement)(l,{ref:c,iconNode:a,className:t(`lucide-${n(i(r))}`,`lucide-${r}`,o),...s}));return o.displayName=i(r),o};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./cn-BdjraxxU.cjs"),t=require("./component-styles-TkZ7v6Ef.cjs");let n=require("react"),r=require("react/jsx-runtime");function i({loading:n,sortedLength:i,pageSizeOptions:a,pageSize:o,page:s,totalPages:c,hasPagination:l,setPage:u}){return(0,r.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,r.jsx)(`span`,{children:n?`Loading…`:i===0?`0 results`:a!==!1&&o!==1/0?`${(s-1)*o+1}–${Math.min(s*o,i)} of ${i}`:`${i} row${i===1?``:`s`}`}),l&&(0,r.jsxs)(`nav`,{"aria-label":`Table pagination`,className:`flex items-center gap-1`,children:[(0,r.jsx)(`button`,{type:`button`,onClick:()=>u(1),disabled:s===1,className:e.t(t.c,`size-7 max-sm:hidden`),"aria-label":`First page`,children:(0,r.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,r.jsx)(`path`,{d:`m11 17-5-5 5-5`}),(0,r.jsx)(`path`,{d:`m18 17-5-5 5-5`})]})}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>u(e=>Math.max(1,e-1)),disabled:s===1,className:e.t(t.c,`size-7`),"aria-label":`Previous page`,children:(0,r.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`path`,{d:`m15 18-6-6 6-6`})})}),Array.from({length:Math.min(5,c)},(n,i)=>{let a;return a=c<=5||s<=3?i+1:s>=c-2?c-4+i:s-2+i,(0,r.jsx)(`button`,{type:`button`,onClick:()=>u(a),"aria-label":`Page ${a}`,"aria-current":s===a?`page`:void 0,className:e.t(t.c,`size-7 text-xs font-medium`,s===a?`bg-accent-50 text-accent-700 dark:bg-accent-500/15 dark:text-accent-300`:`text-muted-foreground`),children:a},a)}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>u(e=>Math.min(c,e+1)),disabled:s===c,className:e.t(t.c,`size-7`),"aria-label":`Next page`,children:(0,r.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>u(c),disabled:s===c,className:e.t(t.c,`size-7 max-sm:hidden`),"aria-label":`Last page`,children:(0,r.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,r.jsx)(`path`,{d:`m13 17 5-5-5-5`}),(0,r.jsx)(`path`,{d:`m6 17 5-5-5-5`})]})})]})]})}function a({options:e,value:t,onChange:n}){return(0,r.jsxs)(`label`,{className:`flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,r.jsx)(`span`,{children:`Rows`}),(0,r.jsx)(`select`,{value:t,onChange:e=>n(Number(e.target.value)),className:`h-8 rounded-[var(--radius-md)] border border-border bg-surface px-2 text-xs text-foreground focus:border-accent-500 focus:outline-none focus:ring-2 focus:ring-focus-ring/20`,children:e.map(e=>(0,r.jsx)(`option`,{value:e,children:e},e))})]})}function o({cols:e}){return(0,r.jsx)(`tr`,{children:Array.from({length:e}).map((e,t)=>(0,r.jsx)(`td`,{className:`px-4 py-3`,children:(0,r.jsx)(`div`,{className:`h-4 rounded-md bg-black/6 dark:bg-white/6 animate-pulse`,style:{width:`${60+t*17%40}%`}})},t))})}function s({dir:t}){return(0,r.jsxs)(`span`,{className:`inline-flex flex-col ml-1.5 gap-[2px] shrink-0`,children:[(0,r.jsx)(`svg`,{"aria-hidden":`true`,width:`8`,height:`5`,viewBox:`0 0 8 5`,className:e.t(t===`asc`?`text-accent-600`:`text-muted-foreground/60`),children:(0,r.jsx)(`path`,{d:`M4 0L8 5H0L4 0Z`,fill:`currentColor`})}),(0,r.jsx)(`svg`,{"aria-hidden":`true`,width:`8`,height:`5`,viewBox:`0 0 8 5`,className:e.t(t===`desc`?`text-accent-600`:`text-muted-foreground/60`),children:(0,r.jsx)(`path`,{d:`M4 5L0 0H8L4 5Z`,fill:`currentColor`})})]})}var c={left:`text-left`,center:`text-center`,right:`text-right`};function l({columns:t,data:l,loading:u=!1,emptyMessage:d=`No data`,onRowClick:f,className:p,toolbarClassName:m,tableClassName:h,searchable:g=!1,searchPlaceholder:_=`Search…`,pageSizeOptions:v=[10,25,50],defaultPageSize:y,density:b=`comfortable`,ariaLabel:x=`Data table`,getRowLabel:S,unstyled:C=!1}){let[w,T]=(0,n.useState)(null),[E,D]=(0,n.useState)(null),[O,k]=(0,n.useState)(``),[A,j]=(0,n.useState)(1),[M,N]=(0,n.useState)(y??(v===!1?1/0:v[0]??10)),P=(0,n.useCallback)(e=>{w===e?E===`asc`?D(`desc`):(T(null),D(null)):(T(e),D(`asc`)),j(1)},[E,w]),F=(0,n.useMemo)(()=>t.filter(e=>e.searchable!==!1&&e.key),[t]),I=(0,n.useMemo)(()=>{let e=O.trim().toLowerCase();return e?l.filter(t=>F.some(n=>{let r=t[n.key];return String(r??``).toLowerCase().includes(e)})):l},[l,O,F]),L=(0,n.useMemo)(()=>!w||!E?I:[...I].sort((e,t)=>{let n=e[w],r=t[w],i=String(n??``).localeCompare(String(r??``),void 0,{numeric:!0});return E===`asc`?i:-i}),[I,w,E]),R=(0,n.useMemo)(()=>{if(v===!1||M===1/0)return L;let e=(A-1)*M;return L.slice(e,e+M)},[L,A,M,v]),z=(0,n.useMemo)(()=>v!==!1&&M!==1/0?Math.max(1,Math.ceil(L.length/M)):1,[L.length,M,v]),B=v!==!1&&M!==1/0&&z>1,V=g||v!==!1&&Array.isArray(v)&&v.length>1,H=(0,n.useCallback)(e=>{k(e.target.value),j(1)},[]),U=(0,n.useCallback)(e=>{N(e),j(1)},[]);return C?(0,r.jsxs)(`div`,{className:e.t(`w-full`,p),children:[g&&(0,r.jsx)(`input`,{"aria-label":_,value:O,onChange:H,placeholder:_}),(0,r.jsx)(`table`,{"aria-label":x,className:h,children:(0,r.jsx)(`tbody`,{children:R.map(e=>(0,r.jsx)(`tr`,{onClick:f?()=>f(e):void 0,children:t.map(t=>(0,r.jsx)(`td`,{children:t.cell(e)},t.key))},e.id))})})]}):(0,r.jsxs)(`div`,{className:e.t(`w-full min-w-0 max-w-full flex flex-col gap-3`,p),children:[V&&(0,r.jsxs)(`div`,{className:e.t(`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,m),children:[g?(0,r.jsxs)(`div`,{className:`relative flex-1 sm:max-w-xs`,children:[(0,r.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,r.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,r.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,r.jsx)(`input`,{"aria-label":_,type:`search`,value:O,onChange:H,placeholder:_,className:`h-8 w-full rounded-[var(--radius-md)] border border-border bg-surface pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-accent-500 focus:outline-none focus:ring-2 focus:ring-focus-ring/20`})]}):(0,r.jsx)(`div`,{}),v!==!1&&Array.isArray(v)&&v.length>1&&(0,r.jsx)(a,{options:v,value:M,onChange:U})]}),(0,r.jsx)(`div`,{style:{contain:`inline-size paint`},className:e.t(`w-full min-w-0 max-w-full overflow-hidden rounded-[var(--radius-lg)] border border-border bg-surface`,h),children:(0,r.jsx)(`div`,{className:`w-full min-w-0 max-w-full overflow-x-auto overscroll-x-contain scrollbar-thin`,children:(0,r.jsxs)(`table`,{"aria-label":x,"data-density":b,className:`group/table w-full text-sm border-collapse`,children:[(0,r.jsx)(`thead`,{className:`border-b border-border bg-surface-muted`,children:(0,r.jsx)(`tr`,{children:t.map(t=>(0,r.jsx)(`th`,{scope:`col`,"aria-sort":w===t.key?E===`asc`?`ascending`:E===`desc`?`descending`:`none`:void 0,style:{width:t.width},className:e.t(`px-4 py-2.5 text-xs font-medium text-muted-foreground group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2`,c[t.align??`left`]),children:t.sortable?(0,r.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35`,onClick:()=>P(t.key),children:[t.header,(0,r.jsx)(s,{dir:w===t.key?E:null})]}):t.header},t.key))})}),(0,r.jsx)(`tbody`,{className:`divide-y divide-border`,children:u?Array.from({length:5}).map((e,n)=>(0,r.jsx)(o,{cols:t.length},n)):R.length===0?(0,r.jsx)(`tr`,{children:(0,r.jsx)(`td`,{colSpan:t.length,className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:O?`No results for “${O}”`:d})}):R.map(n=>(0,r.jsx)(`tr`,{tabIndex:f?0:void 0,"aria-label":S?.(n),className:e.t(`transition-colors duration-100 hover:bg-surface-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring/35`,f&&`cursor-pointer`),onClick:f?()=>f(n):void 0,onKeyDown:f?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(n))}:void 0,children:t.map(t=>(0,r.jsx)(`td`,{className:e.t(`px-4 py-3 text-sm text-foreground group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2`,c[t.align??`left`]),children:t.cell(n)},t.key))},n.id))})]})})}),(B||!u&&L.length>0)&&(0,r.jsx)(i,{loading:u,sortedLength:L.length,pageSizeOptions:v,pageSize:M,page:A,totalPages:z,hasPagination:B,setPage:j})]})}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { t as e } from "./cn-DpgY2leY.js";
|
|
2
|
+
import { c as t } from "./component-styles-Ce56hn9T.js";
|
|
3
|
+
import { useCallback as n, useMemo as r, useState as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/datatable/pagination-footer.tsx
|
|
6
|
+
function s({ loading: n, sortedLength: r, pageSizeOptions: i, pageSize: s, page: c, totalPages: l, hasPagination: u, setPage: d }) {
|
|
7
|
+
return /* @__PURE__ */ o("div", {
|
|
8
|
+
className: "flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground",
|
|
9
|
+
children: [/* @__PURE__ */ a("span", { children: n ? "Loading…" : r === 0 ? "0 results" : i !== !1 && s !== Infinity ? `${(c - 1) * s + 1}–${Math.min(c * s, r)} of ${r}` : `${r} row${r === 1 ? "" : "s"}` }), u && /* @__PURE__ */ o("nav", {
|
|
10
|
+
"aria-label": "Table pagination",
|
|
11
|
+
className: "flex items-center gap-1",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ a("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
onClick: () => d(1),
|
|
16
|
+
disabled: c === 1,
|
|
17
|
+
className: e(t, "size-7 max-sm:hidden"),
|
|
18
|
+
"aria-label": "First page",
|
|
19
|
+
children: /* @__PURE__ */ o("svg", {
|
|
20
|
+
width: "12",
|
|
21
|
+
height: "12",
|
|
22
|
+
viewBox: "0 0 24 24",
|
|
23
|
+
fill: "none",
|
|
24
|
+
stroke: "currentColor",
|
|
25
|
+
strokeWidth: "2",
|
|
26
|
+
strokeLinecap: "round",
|
|
27
|
+
strokeLinejoin: "round",
|
|
28
|
+
children: [/* @__PURE__ */ a("path", { d: "m11 17-5-5 5-5" }), /* @__PURE__ */ a("path", { d: "m18 17-5-5 5-5" })]
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ a("button", {
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: () => d((e) => Math.max(1, e - 1)),
|
|
34
|
+
disabled: c === 1,
|
|
35
|
+
className: e(t, "size-7"),
|
|
36
|
+
"aria-label": "Previous page",
|
|
37
|
+
children: /* @__PURE__ */ a("svg", {
|
|
38
|
+
width: "12",
|
|
39
|
+
height: "12",
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
fill: "none",
|
|
42
|
+
stroke: "currentColor",
|
|
43
|
+
strokeWidth: "2",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
children: /* @__PURE__ */ a("path", { d: "m15 18-6-6 6-6" })
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
Array.from({ length: Math.min(5, l) }, (n, r) => {
|
|
50
|
+
let i;
|
|
51
|
+
return i = l <= 5 || c <= 3 ? r + 1 : c >= l - 2 ? l - 4 + r : c - 2 + r, /* @__PURE__ */ a("button", {
|
|
52
|
+
type: "button",
|
|
53
|
+
onClick: () => d(i),
|
|
54
|
+
"aria-label": `Page ${i}`,
|
|
55
|
+
"aria-current": c === i ? "page" : void 0,
|
|
56
|
+
className: e(t, "size-7 text-xs font-medium", c === i ? "bg-accent-50 text-accent-700 dark:bg-accent-500/15 dark:text-accent-300" : "text-muted-foreground"),
|
|
57
|
+
children: i
|
|
58
|
+
}, i);
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ a("button", {
|
|
61
|
+
type: "button",
|
|
62
|
+
onClick: () => d((e) => Math.min(l, e + 1)),
|
|
63
|
+
disabled: c === l,
|
|
64
|
+
className: e(t, "size-7"),
|
|
65
|
+
"aria-label": "Next page",
|
|
66
|
+
children: /* @__PURE__ */ a("svg", {
|
|
67
|
+
width: "12",
|
|
68
|
+
height: "12",
|
|
69
|
+
viewBox: "0 0 24 24",
|
|
70
|
+
fill: "none",
|
|
71
|
+
stroke: "currentColor",
|
|
72
|
+
strokeWidth: "2",
|
|
73
|
+
strokeLinecap: "round",
|
|
74
|
+
strokeLinejoin: "round",
|
|
75
|
+
children: /* @__PURE__ */ a("path", { d: "m9 18 6-6-6-6" })
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ a("button", {
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick: () => d(l),
|
|
81
|
+
disabled: c === l,
|
|
82
|
+
className: e(t, "size-7 max-sm:hidden"),
|
|
83
|
+
"aria-label": "Last page",
|
|
84
|
+
children: /* @__PURE__ */ o("svg", {
|
|
85
|
+
width: "12",
|
|
86
|
+
height: "12",
|
|
87
|
+
viewBox: "0 0 24 24",
|
|
88
|
+
fill: "none",
|
|
89
|
+
stroke: "currentColor",
|
|
90
|
+
strokeWidth: "2",
|
|
91
|
+
strokeLinecap: "round",
|
|
92
|
+
strokeLinejoin: "round",
|
|
93
|
+
children: [/* @__PURE__ */ a("path", { d: "m13 17 5-5-5-5" }), /* @__PURE__ */ a("path", { d: "m6 17 5-5-5-5" })]
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/components/datatable/rows-dropdown.tsx
|
|
102
|
+
function c({ options: e, value: t, onChange: n }) {
|
|
103
|
+
return /* @__PURE__ */ o("label", {
|
|
104
|
+
className: "flex shrink-0 items-center gap-2 text-xs text-muted-foreground",
|
|
105
|
+
children: [/* @__PURE__ */ a("span", { children: "Rows" }), /* @__PURE__ */ a("select", {
|
|
106
|
+
value: t,
|
|
107
|
+
onChange: (e) => n(Number(e.target.value)),
|
|
108
|
+
className: "h-8 rounded-[var(--radius-md)] border border-border bg-surface px-2 text-xs text-foreground focus:border-accent-500 focus:outline-none focus:ring-2 focus:ring-focus-ring/20",
|
|
109
|
+
children: e.map((e) => /* @__PURE__ */ a("option", {
|
|
110
|
+
value: e,
|
|
111
|
+
children: e
|
|
112
|
+
}, e))
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/components/datatable/skeleton-row.tsx
|
|
118
|
+
function l({ cols: e }) {
|
|
119
|
+
return /* @__PURE__ */ a("tr", { children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ a("td", {
|
|
120
|
+
className: "px-4 py-3",
|
|
121
|
+
children: /* @__PURE__ */ a("div", {
|
|
122
|
+
className: "h-4 rounded-md bg-black/6 dark:bg-white/6 animate-pulse",
|
|
123
|
+
style: { width: `${60 + t * 17 % 40}%` }
|
|
124
|
+
})
|
|
125
|
+
}, t)) });
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/components/datatable/sort-icon.tsx
|
|
129
|
+
function u({ dir: t }) {
|
|
130
|
+
return /* @__PURE__ */ o("span", {
|
|
131
|
+
className: "inline-flex flex-col ml-1.5 gap-[2px] shrink-0",
|
|
132
|
+
children: [/* @__PURE__ */ a("svg", {
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
width: "8",
|
|
135
|
+
height: "5",
|
|
136
|
+
viewBox: "0 0 8 5",
|
|
137
|
+
className: e(t === "asc" ? "text-accent-600" : "text-muted-foreground/60"),
|
|
138
|
+
children: /* @__PURE__ */ a("path", {
|
|
139
|
+
d: "M4 0L8 5H0L4 0Z",
|
|
140
|
+
fill: "currentColor"
|
|
141
|
+
})
|
|
142
|
+
}), /* @__PURE__ */ a("svg", {
|
|
143
|
+
"aria-hidden": "true",
|
|
144
|
+
width: "8",
|
|
145
|
+
height: "5",
|
|
146
|
+
viewBox: "0 0 8 5",
|
|
147
|
+
className: e(t === "desc" ? "text-accent-600" : "text-muted-foreground/60"),
|
|
148
|
+
children: /* @__PURE__ */ a("path", {
|
|
149
|
+
d: "M4 5L0 0H8L4 5Z",
|
|
150
|
+
fill: "currentColor"
|
|
151
|
+
})
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/datatable.tsx
|
|
157
|
+
var d = {
|
|
158
|
+
left: "text-left",
|
|
159
|
+
center: "text-center",
|
|
160
|
+
right: "text-right"
|
|
161
|
+
};
|
|
162
|
+
function f({ columns: t, data: f, loading: p = !1, emptyMessage: m = "No data", onRowClick: h, className: g, toolbarClassName: _, tableClassName: v, searchable: y = !1, searchPlaceholder: b = "Search…", pageSizeOptions: x = [
|
|
163
|
+
10,
|
|
164
|
+
25,
|
|
165
|
+
50
|
|
166
|
+
], defaultPageSize: S, density: C = "comfortable", ariaLabel: w = "Data table", getRowLabel: T, unstyled: E = !1 }) {
|
|
167
|
+
let [D, O] = i(null), [k, A] = i(null), [j, M] = i(""), [N, P] = i(1), [F, I] = i(S ?? (x === !1 ? Infinity : x[0] ?? 10)), L = n((e) => {
|
|
168
|
+
D === e ? k === "asc" ? A("desc") : (O(null), A(null)) : (O(e), A("asc")), P(1);
|
|
169
|
+
}, [k, D]), R = r(() => t.filter((e) => e.searchable !== !1 && e.key), [t]), z = r(() => {
|
|
170
|
+
let e = j.trim().toLowerCase();
|
|
171
|
+
return e ? f.filter((t) => R.some((n) => {
|
|
172
|
+
let r = t[n.key];
|
|
173
|
+
return String(r ?? "").toLowerCase().includes(e);
|
|
174
|
+
})) : f;
|
|
175
|
+
}, [
|
|
176
|
+
f,
|
|
177
|
+
j,
|
|
178
|
+
R
|
|
179
|
+
]), B = r(() => !D || !k ? z : [...z].sort((e, t) => {
|
|
180
|
+
let n = e[D], r = t[D], i = String(n ?? "").localeCompare(String(r ?? ""), void 0, { numeric: !0 });
|
|
181
|
+
return k === "asc" ? i : -i;
|
|
182
|
+
}), [
|
|
183
|
+
z,
|
|
184
|
+
D,
|
|
185
|
+
k
|
|
186
|
+
]), V = r(() => {
|
|
187
|
+
if (x === !1 || F === Infinity) return B;
|
|
188
|
+
let e = (N - 1) * F;
|
|
189
|
+
return B.slice(e, e + F);
|
|
190
|
+
}, [
|
|
191
|
+
B,
|
|
192
|
+
N,
|
|
193
|
+
F,
|
|
194
|
+
x
|
|
195
|
+
]), H = r(() => x !== !1 && F !== Infinity ? Math.max(1, Math.ceil(B.length / F)) : 1, [
|
|
196
|
+
B.length,
|
|
197
|
+
F,
|
|
198
|
+
x
|
|
199
|
+
]), U = x !== !1 && F !== Infinity && H > 1, W = y || x !== !1 && Array.isArray(x) && x.length > 1, G = n((e) => {
|
|
200
|
+
M(e.target.value), P(1);
|
|
201
|
+
}, []), K = n((e) => {
|
|
202
|
+
I(e), P(1);
|
|
203
|
+
}, []);
|
|
204
|
+
return E ? /* @__PURE__ */ o("div", {
|
|
205
|
+
className: e("w-full", g),
|
|
206
|
+
children: [y && /* @__PURE__ */ a("input", {
|
|
207
|
+
"aria-label": b,
|
|
208
|
+
value: j,
|
|
209
|
+
onChange: G,
|
|
210
|
+
placeholder: b
|
|
211
|
+
}), /* @__PURE__ */ a("table", {
|
|
212
|
+
"aria-label": w,
|
|
213
|
+
className: v,
|
|
214
|
+
children: /* @__PURE__ */ a("tbody", { children: V.map((e) => /* @__PURE__ */ a("tr", {
|
|
215
|
+
onClick: h ? () => h(e) : void 0,
|
|
216
|
+
children: t.map((t) => /* @__PURE__ */ a("td", { children: t.cell(e) }, t.key))
|
|
217
|
+
}, e.id)) })
|
|
218
|
+
})]
|
|
219
|
+
}) : /* @__PURE__ */ o("div", {
|
|
220
|
+
className: e("w-full min-w-0 max-w-full flex flex-col gap-3", g),
|
|
221
|
+
children: [
|
|
222
|
+
W && /* @__PURE__ */ o("div", {
|
|
223
|
+
className: e("flex flex-col sm:flex-row sm:items-center justify-between gap-3", _),
|
|
224
|
+
children: [y ? /* @__PURE__ */ o("div", {
|
|
225
|
+
className: "relative flex-1 sm:max-w-xs",
|
|
226
|
+
children: [/* @__PURE__ */ o("svg", {
|
|
227
|
+
"aria-hidden": "true",
|
|
228
|
+
className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none",
|
|
229
|
+
width: "13",
|
|
230
|
+
height: "13",
|
|
231
|
+
viewBox: "0 0 24 24",
|
|
232
|
+
fill: "none",
|
|
233
|
+
stroke: "currentColor",
|
|
234
|
+
strokeWidth: "2",
|
|
235
|
+
strokeLinecap: "round",
|
|
236
|
+
strokeLinejoin: "round",
|
|
237
|
+
children: [/* @__PURE__ */ a("circle", {
|
|
238
|
+
cx: "11",
|
|
239
|
+
cy: "11",
|
|
240
|
+
r: "8"
|
|
241
|
+
}), /* @__PURE__ */ a("path", { d: "m21 21-4.3-4.3" })]
|
|
242
|
+
}), /* @__PURE__ */ a("input", {
|
|
243
|
+
"aria-label": b,
|
|
244
|
+
type: "search",
|
|
245
|
+
value: j,
|
|
246
|
+
onChange: G,
|
|
247
|
+
placeholder: b,
|
|
248
|
+
className: "h-8 w-full rounded-[var(--radius-md)] border border-border bg-surface pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-accent-500 focus:outline-none focus:ring-2 focus:ring-focus-ring/20"
|
|
249
|
+
})]
|
|
250
|
+
}) : /* @__PURE__ */ a("div", {}), x !== !1 && Array.isArray(x) && x.length > 1 && /* @__PURE__ */ a(c, {
|
|
251
|
+
options: x,
|
|
252
|
+
value: F,
|
|
253
|
+
onChange: K
|
|
254
|
+
})]
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ a("div", {
|
|
257
|
+
style: { contain: "inline-size paint" },
|
|
258
|
+
className: e("w-full min-w-0 max-w-full overflow-hidden rounded-[var(--radius-lg)] border border-border bg-surface", v),
|
|
259
|
+
children: /* @__PURE__ */ a("div", {
|
|
260
|
+
className: "w-full min-w-0 max-w-full overflow-x-auto overscroll-x-contain scrollbar-thin",
|
|
261
|
+
children: /* @__PURE__ */ o("table", {
|
|
262
|
+
"aria-label": w,
|
|
263
|
+
"data-density": C,
|
|
264
|
+
className: "group/table w-full text-sm border-collapse",
|
|
265
|
+
children: [/* @__PURE__ */ a("thead", {
|
|
266
|
+
className: "border-b border-border bg-surface-muted",
|
|
267
|
+
children: /* @__PURE__ */ a("tr", { children: t.map((t) => /* @__PURE__ */ a("th", {
|
|
268
|
+
scope: "col",
|
|
269
|
+
"aria-sort": D === t.key ? k === "asc" ? "ascending" : k === "desc" ? "descending" : "none" : void 0,
|
|
270
|
+
style: { width: t.width },
|
|
271
|
+
className: e("px-4 py-2.5 text-xs font-medium text-muted-foreground group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2", d[t.align ?? "left"]),
|
|
272
|
+
children: t.sortable ? /* @__PURE__ */ o("button", {
|
|
273
|
+
type: "button",
|
|
274
|
+
className: "inline-flex items-center gap-1 rounded-sm transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35",
|
|
275
|
+
onClick: () => L(t.key),
|
|
276
|
+
children: [t.header, /* @__PURE__ */ a(u, { dir: D === t.key ? k : null })]
|
|
277
|
+
}) : t.header
|
|
278
|
+
}, t.key)) })
|
|
279
|
+
}), /* @__PURE__ */ a("tbody", {
|
|
280
|
+
className: "divide-y divide-border",
|
|
281
|
+
children: p ? Array.from({ length: 5 }).map((e, n) => /* @__PURE__ */ a(l, { cols: t.length }, n)) : V.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", {
|
|
282
|
+
colSpan: t.length,
|
|
283
|
+
className: "px-4 py-12 text-center text-sm text-muted-foreground",
|
|
284
|
+
children: j ? `No results for “${j}”` : m
|
|
285
|
+
}) }) : V.map((n) => /* @__PURE__ */ a("tr", {
|
|
286
|
+
tabIndex: h ? 0 : void 0,
|
|
287
|
+
"aria-label": T?.(n),
|
|
288
|
+
className: e("transition-colors duration-100 hover:bg-surface-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring/35", h && "cursor-pointer"),
|
|
289
|
+
onClick: h ? () => h(n) : void 0,
|
|
290
|
+
onKeyDown: h ? (e) => {
|
|
291
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h(n));
|
|
292
|
+
} : void 0,
|
|
293
|
+
children: t.map((t) => /* @__PURE__ */ a("td", {
|
|
294
|
+
className: e("px-4 py-3 text-sm text-foreground group-data-[density=compact]/table:px-3 group-data-[density=compact]/table:py-2", d[t.align ?? "left"]),
|
|
295
|
+
children: t.cell(n)
|
|
296
|
+
}, t.key))
|
|
297
|
+
}, n.id))
|
|
298
|
+
})]
|
|
299
|
+
})
|
|
300
|
+
})
|
|
301
|
+
}),
|
|
302
|
+
(U || !p && B.length > 0) && /* @__PURE__ */ a(s, {
|
|
303
|
+
loading: p,
|
|
304
|
+
sortedLength: B.length,
|
|
305
|
+
pageSizeOptions: x,
|
|
306
|
+
pageSize: F,
|
|
307
|
+
page: N,
|
|
308
|
+
totalPages: H,
|
|
309
|
+
hasPagination: U,
|
|
310
|
+
setPage: P
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
export { f as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./cn-BdjraxxU.cjs"),t=require("./component-styles-TkZ7v6Ef.cjs"),n=require("./use-event-callback-Du9_9eAi.cjs"),r=require("./focus-DmG6Ge7X.cjs"),i=require("./createLucideIcon-b_X_3fj-.cjs");let a=require("framer-motion"),o=require("react"),s=require("react/jsx-runtime"),c=require("react-dom");var l=i.t(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function u({open:i,onClose:u,position:d=`left`,title:f,children:p,width:m=320,className:h,overlayClassName:g,panelClassName:_,unstyled:v=!1,ariaLabel:y=`Drawer`,closeAriaLabel:b=`Close drawer`,closeOnEscape:x=!0,closeOnOverlayClick:S=!0}){let C=n.t(u),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(i),D=(0,o.useId)();i&&!E.current&&typeof document<`u`&&document.activeElement instanceof HTMLElement&&(T.current=document.activeElement),E.current=i,(0,o.useEffect)(()=>{if(i)return;let e=e=>{e.target instanceof HTMLElement&&(T.current=e.target)};return!T.current&&document.activeElement instanceof HTMLElement&&(T.current=document.activeElement),document.addEventListener(`focusin`,e),()=>document.removeEventListener(`focusin`,e)},[i]),(0,o.useEffect)(()=>{if(!i)return;!T.current&&document.activeElement instanceof HTMLElement&&(T.current=document.activeElement);let e=document.body.style.overflow,t=e=>{if(e.key===`Escape`&&x){e.preventDefault(),C();return}if(e.key===`Tab`&&w.current){let t=r.t(w.current);if(t.length===0){e.preventDefault(),w.current.focus();return}let n=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),n.focus())}};document.addEventListener(`keydown`,t),document.body.style.overflow=`hidden`;let n=window.setTimeout(()=>{(w.current?.querySelector(`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`)??w.current)?.focus()},0);return()=>{clearTimeout(n),document.removeEventListener(`keydown`,t),document.body.style.overflow=e}},[x,i,C]),(0,o.useEffect)(()=>{if(i||!T.current)return;let e=T.current,t=window.setTimeout(()=>e.focus(),240);return()=>window.clearTimeout(t)},[i]);let O=()=>{let e=T.current;T.current=null,window.setTimeout(()=>e?.focus(),0)};if(typeof document>`u`)return null;if(v&&i)return(0,c.createPortal)((0,s.jsx)(`div`,{ref:w,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":typeof f==`string`?f:y,className:e.t(h,_),children:p}),document.body);if(d===`bottom`)return(0,c.createPortal)((0,s.jsx)(a.AnimatePresence,{onExitComplete:O,children:i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},className:e.t(`fixed inset-0 z-[100] bg-overlay`,g),onClick:S?C:void 0},`drawer-backdrop`),(0,s.jsxs)(a.motion.div,{ref:w,tabIndex:-1,initial:{y:`100%`},animate:{y:0},exit:{y:`100%`},transition:{duration:.22,ease:[.16,1,.3,1]},role:`dialog`,"aria-modal":`true`,"aria-labelledby":f?D:void 0,"aria-label":f?void 0:y,className:e.t(`fixed bottom-0 left-0 right-0 z-[101] flex max-h-[80dvh] flex-col rounded-t-[var(--radius-xl)] border-t border-border bg-surface-raised shadow-overlay`,_,h),children:[(0,s.jsx)(`div`,{className:`flex justify-center pb-1 pt-3 shrink-0`,"aria-hidden":`true`,children:(0,s.jsx)(`div`,{className:`h-1 w-9 rounded-full bg-border-strong`})}),f&&(0,s.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-3 shrink-0`,children:[(0,s.jsx)(`h2`,{id:D,className:`text-sm font-semibold text-foreground`,children:f}),(0,s.jsx)(`button`,{type:`button`,onClick:C,className:t.c,"aria-label":b,children:(0,s.jsx)(l,{size:14,"aria-hidden":`true`})})]}),(0,s.jsx)(`div`,{className:`flex-1 overflow-y-auto pb-safe-bottom`,children:p})]},`drawer-panel`)]})}),document.body);let k=d===`left`?`-100%`:`100%`;return(0,c.createPortal)((0,s.jsx)(a.AnimatePresence,{onExitComplete:O,children:i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},className:e.t(`fixed inset-0 z-[100] bg-overlay`,g),onClick:S?C:void 0},`drawer-backdrop`),(0,s.jsxs)(a.motion.div,{ref:w,tabIndex:-1,initial:{x:k},animate:{x:0},exit:{x:k},transition:{duration:.22,ease:[.16,1,.3,1]},role:`dialog`,"aria-modal":`true`,"aria-labelledby":f?D:void 0,"aria-label":f?void 0:y,className:e.t(`fixed top-0 bottom-0 z-[101] flex max-w-[100vw] flex-col bg-surface-raised shadow-overlay`,d===`left`?`left-0 border-r border-border`:`right-0 border-l border-border`,_,h),style:{width:m},children:[f&&(0,s.jsxs)(`div`,{className:`flex h-14 items-center justify-between gap-3 border-b border-border px-5 shrink-0`,children:[(0,s.jsx)(`h2`,{id:D,className:`min-w-0 truncate text-sm font-semibold text-foreground`,children:f}),(0,s.jsx)(`button`,{type:`button`,onClick:C,className:t.c,"aria-label":b,children:(0,s.jsx)(l,{size:14,"aria-hidden":`true`})})]}),(0,s.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:p})]},`drawer-panel`)]})}),document.body)}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|