@yuno-payments/dashboard-design-system 1.3.5 → 1.4.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/dist/components/atoms/radio-group/radio-group.d.ts +1 -1
- package/dist/components/atoms/select/search-select.d.ts +1 -1
- package/dist/components/atoms/select/search-select.js +8 -1
- package/dist/components/atoms/select/select.d.ts +1 -1
- package/dist/components/atoms/typography/typography.js +1 -1
- package/dist/components/molecules/file-upload/file-upload.js +1 -8
- package/dist/components/molecules/index.d.ts +1 -0
- package/dist/components/molecules/stepper/index.d.ts +1 -0
- package/dist/components/molecules/stepper/stepper.d.ts +50 -0
- package/dist/components/molecules/stepper/stepper.js +74 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.constants.d.ts +3 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.constants.js +12 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.d.ts +6 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.helpers.d.ts +3 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.helpers.js +31 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.js +125 -0
- package/dist/components/organisms/aggregated-table/aggregated-table.types.d.ts +35 -0
- package/dist/components/organisms/aggregated-table/aggregation-functions.helpers.d.ts +6 -0
- package/dist/components/organisms/aggregated-table/aggregation-functions.helpers.js +23 -0
- package/dist/components/organisms/aggregated-table/index.d.ts +4 -0
- package/dist/components/organisms/index.d.ts +2 -0
- package/dist/components/organisms/transfer-list/index.d.ts +3 -0
- package/dist/components/organisms/transfer-list/transfer-list-box.d.ts +17 -0
- package/dist/components/organisms/transfer-list/transfer-list-box.js +65 -0
- package/dist/components/organisms/transfer-list/transfer-list-empty-state.d.ts +7 -0
- package/dist/components/organisms/transfer-list/transfer-list-empty-state.js +14 -0
- package/dist/components/organisms/transfer-list/transfer-list-item.d.ts +15 -0
- package/dist/components/organisms/transfer-list/transfer-list-item.js +76 -0
- package/dist/components/organisms/transfer-list/transfer-list.d.ts +40 -0
- package/dist/components/organisms/transfer-list/transfer-list.js +123 -0
- package/dist/components/organisms/transfer-list/transfer-list.types.d.ts +9 -0
- package/dist/components/organisms/tutorial/tutorial.js +2 -3
- package/dist/dashboard-design-system.css +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.min.js +18575 -12590
- package/dist/index.js +180 -164
- package/dist/index.umd.min.js +90 -25
- package/dist/node_modules/@dnd-kit/abstract/index.js +1142 -0
- package/dist/node_modules/@dnd-kit/collision/dist/index.js +72 -0
- package/dist/node_modules/@dnd-kit/dom/index.js +1554 -0
- package/dist/node_modules/@dnd-kit/dom/sortable.js +631 -0
- package/dist/node_modules/@dnd-kit/dom/utilities.js +943 -0
- package/dist/node_modules/@dnd-kit/geometry/dist/index.js +200 -0
- package/dist/node_modules/@dnd-kit/helpers/dist/index.js +126 -0
- package/dist/node_modules/@dnd-kit/react/hooks.js +94 -0
- package/dist/node_modules/@dnd-kit/react/index.js +380 -0
- package/dist/node_modules/@dnd-kit/react/sortable.js +129 -0
- package/dist/node_modules/@dnd-kit/react/utilities.js +11 -0
- package/dist/node_modules/@dnd-kit/state/dist/index.js +181 -0
- package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js +265 -0
- package/package.json +7 -1
|
@@ -24,7 +24,7 @@ interface RadioOption {
|
|
|
24
24
|
/**
|
|
25
25
|
* Props for the RadioGroup component
|
|
26
26
|
*/
|
|
27
|
-
interface RadioGroupProps extends Omit<ComponentProps<typeof ShadcnRadioGroup>, "children" | "onValueChange"> {
|
|
27
|
+
interface RadioGroupProps extends Omit<ComponentProps<typeof ShadcnRadioGroup>, "children" | "onValueChange" | "onChange"> {
|
|
28
28
|
/**
|
|
29
29
|
* Array of radio options to display
|
|
30
30
|
*/
|
|
@@ -72,7 +72,14 @@ const W = r.forwardRef(
|
|
|
72
72
|
}, O = R();
|
|
73
73
|
return /* @__PURE__ */ e.jsxs("div", { className: a("w-full", E), children: [
|
|
74
74
|
j && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1 mb-2", children: [
|
|
75
|
-
/* @__PURE__ */ e.jsx(
|
|
75
|
+
/* @__PURE__ */ e.jsx(
|
|
76
|
+
A,
|
|
77
|
+
{
|
|
78
|
+
htmlFor: g,
|
|
79
|
+
className: a(f && "text-muted-foreground"),
|
|
80
|
+
children: j
|
|
81
|
+
}
|
|
82
|
+
),
|
|
76
83
|
L && /* @__PURE__ */ e.jsx(x, { variant: "sm", className: "text-muted-foreground", children: "(Optional)" })
|
|
77
84
|
] }),
|
|
78
85
|
N && !u && /* @__PURE__ */ e.jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva as s } from "../../../node_modules/class-variance-authority/dist/index.js";
|
|
2
2
|
import { cn as i } from "../../../lib/utils.js";
|
|
3
3
|
import { forwardRef as m, createElement as c } from "react";
|
|
4
|
-
const d = s("font-[var(--font-family)]", {
|
|
4
|
+
const d = s("font-[var(--font-family-inter)]", {
|
|
5
5
|
variants: {
|
|
6
6
|
variant: {
|
|
7
7
|
h1: "scroll-m-20 text-4xl tracking-tight lg:text-5xl",
|
|
@@ -92,14 +92,7 @@ function ee({
|
|
|
92
92
|
className: "object-contain",
|
|
93
93
|
"aria-hidden": "true"
|
|
94
94
|
}
|
|
95
|
-
) : /* @__PURE__ */ r.jsx(
|
|
96
|
-
b,
|
|
97
|
-
{
|
|
98
|
-
name: "UploadSimple",
|
|
99
|
-
size: "xl",
|
|
100
|
-
className: "text-muted-foreground"
|
|
101
|
-
}
|
|
102
|
-
),
|
|
95
|
+
) : /* @__PURE__ */ r.jsx(b, { name: "UploadSimple", size: "xl", className: "text-muted-foreground" }),
|
|
103
96
|
/* @__PURE__ */ r.jsxs("p", { className: "text-sm text-center text-foreground font-semibold", children: [
|
|
104
97
|
/* @__PURE__ */ r.jsx("span", { className: "text-primary cursor-pointer", children: "Select" }),
|
|
105
98
|
" ",
|
|
@@ -9,3 +9,4 @@ export { HighlightBanner, type HighlightBannerProps } from './highlight-banner';
|
|
|
9
9
|
export { Empty, type EmptyProps } from './empty';
|
|
10
10
|
export { EmptyIcon, type EmptyIconProps } from './empty';
|
|
11
11
|
export { FileUpload, type FileUploadProps, type UploadFile, } from './file-upload';
|
|
12
|
+
export { Stepper, type StepperProps, type StepperStep } from './stepper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stepper, type StepperProps, type StepperStep } from './stepper';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface StepperStep {
|
|
3
|
+
/** Unique identifier for the step */
|
|
4
|
+
key: string | number;
|
|
5
|
+
/** Display label for the step */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Optional subtitle shown below the label */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Marks step with error styling */
|
|
10
|
+
status?: "error";
|
|
11
|
+
}
|
|
12
|
+
export interface StepperProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
/**
|
|
14
|
+
* Zero-based index of the currently active step.
|
|
15
|
+
* Steps before this index are marked as completed,
|
|
16
|
+
* steps after are marked as inactive.
|
|
17
|
+
*/
|
|
18
|
+
activeStep: number;
|
|
19
|
+
/**
|
|
20
|
+
* Array of steps to display in the stepper.
|
|
21
|
+
* Each step must have a unique `key` and a `label`.
|
|
22
|
+
*/
|
|
23
|
+
steps: StepperStep[];
|
|
24
|
+
/** Layout orientation. Defaults to "horizontal". */
|
|
25
|
+
orientation?: "horizontal" | "vertical";
|
|
26
|
+
/** When provided, completed and inactive steps become clickable. */
|
|
27
|
+
onStepClick?: (index: number) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A stepper component that displays progress through a sequence of steps.
|
|
31
|
+
* Each step shows a numbered circle (or checkmark when completed) and a label.
|
|
32
|
+
* Steps are connected by lines that reflect the current progress.
|
|
33
|
+
*
|
|
34
|
+
* Supports horizontal (default) and vertical orientations, optional step descriptions,
|
|
35
|
+
* error states, and clickable steps via `onStepClick`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <Stepper
|
|
40
|
+
* activeStep={1}
|
|
41
|
+
* steps={[
|
|
42
|
+
* { key: "details", label: "Details" },
|
|
43
|
+
* { key: "review", label: "Review" },
|
|
44
|
+
* { key: "confirm", label: "Confirm" },
|
|
45
|
+
* ]}
|
|
46
|
+
* />
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare const Stepper: import('react').ForwardRefExoticComponent<StepperProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
50
|
+
export { Stepper };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as b, Fragment as h } from "react";
|
|
3
|
+
import { cn as i } from "../../../lib/utils.js";
|
|
4
|
+
import { Icon as d } from "../../atoms/icon/icon.js";
|
|
5
|
+
function j(t, e, o) {
|
|
6
|
+
return t.status === "error" ? "error" : e < o ? "completed" : e === o ? "active" : "inactive";
|
|
7
|
+
}
|
|
8
|
+
const N = ({ index: t, state: e }) => {
|
|
9
|
+
const o = i(
|
|
10
|
+
"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-bold",
|
|
11
|
+
(e === "completed" || e === "active") && "bg-primary text-primary-foreground",
|
|
12
|
+
e === "inactive" && "bg-border text-muted-foreground",
|
|
13
|
+
e === "error" && "bg-destructive text-destructive-foreground"
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ r.jsx("div", { className: o, children: e === "completed" ? /* @__PURE__ */ r.jsx(d, { name: "Check", size: "xs", className: "text-primary-foreground", weight: "bold" }) : e === "error" ? /* @__PURE__ */ r.jsx(d, { name: "X", size: "xs", className: "text-destructive-foreground", weight: "bold" }) : /* @__PURE__ */ r.jsx("span", { children: t + 1 }) });
|
|
16
|
+
}, y = ({
|
|
17
|
+
state: t,
|
|
18
|
+
orientation: e
|
|
19
|
+
}) => {
|
|
20
|
+
const o = t === "completed" || t === "active";
|
|
21
|
+
return e === "vertical" ? /* @__PURE__ */ r.jsx("div", { className: i("w-0.5 h-6 ml-3 my-1", o ? "bg-primary" : "bg-border") }) : /* @__PURE__ */ r.jsx("div", { className: i("mx-2 h-0.5 flex-1 rounded-sm", o ? "bg-primary" : "bg-border") });
|
|
22
|
+
}, w = b(
|
|
23
|
+
({ activeStep: t, steps: e, orientation: o = "horizontal", onStepClick: l, className: u, ...x }, f) => {
|
|
24
|
+
const a = o === "vertical";
|
|
25
|
+
return /* @__PURE__ */ r.jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
ref: f,
|
|
29
|
+
className: i(
|
|
30
|
+
a ? "flex flex-col w-full" : "flex w-full items-center",
|
|
31
|
+
u
|
|
32
|
+
),
|
|
33
|
+
...x,
|
|
34
|
+
children: e.map((c, s) => {
|
|
35
|
+
const n = j(c, s, t), p = c.status === "error" ? "inactive" : s < t ? "completed" : s === t ? "active" : "inactive", v = i(
|
|
36
|
+
"text-xs",
|
|
37
|
+
n === "completed" || n === "active" ? "font-bold text-foreground" : n === "error" ? "font-bold text-destructive" : "font-normal text-muted-foreground"
|
|
38
|
+
), m = l != null && n !== "active";
|
|
39
|
+
return /* @__PURE__ */ r.jsxs(h, { children: [
|
|
40
|
+
/* @__PURE__ */ r.jsxs(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: i(
|
|
44
|
+
"flex flex-row gap-2",
|
|
45
|
+
a ? "items-start" : "items-center",
|
|
46
|
+
m && "cursor-pointer hover:opacity-80"
|
|
47
|
+
),
|
|
48
|
+
"aria-current": n === "active" ? "step" : void 0,
|
|
49
|
+
...m ? {
|
|
50
|
+
role: "button",
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
onClick: () => l(s),
|
|
53
|
+
onKeyDown: (g) => g.key === "Enter" && l(s)
|
|
54
|
+
} : {},
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ r.jsx(N, { index: s, state: n }),
|
|
57
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-col", children: [
|
|
58
|
+
/* @__PURE__ */ r.jsx("span", { className: v, children: c.label }),
|
|
59
|
+
c.description && /* @__PURE__ */ r.jsx("span", { className: "text-xs text-muted-foreground font-normal", children: c.description })
|
|
60
|
+
] })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
s < e.length - 1 && /* @__PURE__ */ r.jsx(y, { state: p, orientation: o })
|
|
65
|
+
] }, c.key);
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
w.displayName = "Stepper";
|
|
72
|
+
export {
|
|
73
|
+
w as Stepper
|
|
74
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { maxAggregation as g, minAggregation as A, sizeAggregation as i, avgAggregation as o, sumAggregation as a } from "./aggregation-functions.helpers.js";
|
|
2
|
+
const t = "__AGGREGATION_TOTALS_ROW__", _ = {
|
|
3
|
+
sum: a,
|
|
4
|
+
avg: o,
|
|
5
|
+
size: i,
|
|
6
|
+
min: A,
|
|
7
|
+
max: g
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
_ as AGGREGATION_FUNCTIONS,
|
|
11
|
+
t as TOTALS_ROW_ID
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { AggregatedTableProps } from './aggregated-table.types';
|
|
3
|
+
declare const AggregatedTable: <T extends object = Record<string, any>>(props: AggregatedTableProps<T> & Omit<HTMLAttributes<HTMLDivElement>, "onRowClick"> & {
|
|
4
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
5
|
+
}) => React.ReactElement | null;
|
|
6
|
+
export { AggregatedTable };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AggregatedColumn, CalculateTotalsRowParams } from './aggregated-table.types';
|
|
2
|
+
export declare const isActionsColumn: <T extends Record<string, any>>(col: AggregatedColumn<T>) => boolean;
|
|
3
|
+
export declare const calculateTotalsRow: <T extends object>({ rows, columns, aggregationLabel, }: CalculateTotalsRowParams<T>) => Record<string, any>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AGGREGATION_FUNCTIONS as c, TOTALS_ROW_ID as y } from "./aggregated-table.constants.js";
|
|
2
|
+
const d = (e) => "accessorKey" in e && typeof e.accessorKey == "string" ? e.accessorKey : e.id, F = (e) => e.meta?.isActions === !0, p = ({
|
|
3
|
+
rows: e,
|
|
4
|
+
columns: s,
|
|
5
|
+
aggregationLabel: u
|
|
6
|
+
}) => {
|
|
7
|
+
const o = e;
|
|
8
|
+
return s.reduce(
|
|
9
|
+
(r, n, f) => {
|
|
10
|
+
const t = d(n);
|
|
11
|
+
if (!t) return r;
|
|
12
|
+
if (f === 0 && !n.aggregationFn)
|
|
13
|
+
return r[t] = u, r;
|
|
14
|
+
if (!n.aggregationFn) return r;
|
|
15
|
+
const a = o.map((i) => i[t]);
|
|
16
|
+
let g;
|
|
17
|
+
if (typeof n.aggregationFn == "function")
|
|
18
|
+
g = n.aggregationFn({ values: a, field: t });
|
|
19
|
+
else {
|
|
20
|
+
const i = c[n.aggregationFn];
|
|
21
|
+
g = i ? i(a) : 0;
|
|
22
|
+
}
|
|
23
|
+
return r[t] = n.aggregationCell ? n.aggregationCell(g) : g, r;
|
|
24
|
+
},
|
|
25
|
+
{ id: y }
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
p as calculateTotalsRow,
|
|
30
|
+
F as isActionsColumn
|
|
31
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as N, useMemo as h, useCallback as R } from "react";
|
|
3
|
+
import { useReactTable as v, flexRender as x } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { cn as n } from "../../../lib/utils.js";
|
|
5
|
+
import { TableHeader as C, TableRow as m, TableHead as k, TableBody as D, TableCell as f, TableFooter as w } from "../../../vendor/shadcn/table.js";
|
|
6
|
+
import { calculateTotalsRow as z, isActionsColumn as M } from "./aggregated-table.helpers.js";
|
|
7
|
+
import { getCoreRowModel as H } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
8
|
+
function K({
|
|
9
|
+
rows: c,
|
|
10
|
+
columns: l,
|
|
11
|
+
aggregationLabel: d = "Total",
|
|
12
|
+
onRowClick: i,
|
|
13
|
+
className: p,
|
|
14
|
+
...j
|
|
15
|
+
}, y) {
|
|
16
|
+
const g = h(
|
|
17
|
+
() => l.some((t) => t.aggregationFn),
|
|
18
|
+
[l]
|
|
19
|
+
), u = h(() => g ? z({ rows: c, columns: l, aggregationLabel: d }) : null, [c, l, d, g]), b = v({
|
|
20
|
+
data: c,
|
|
21
|
+
columns: l,
|
|
22
|
+
getCoreRowModel: H()
|
|
23
|
+
}), A = R(
|
|
24
|
+
(t, e) => {
|
|
25
|
+
e.target.closest('[data-column="actions"]') || i?.(t);
|
|
26
|
+
},
|
|
27
|
+
[i]
|
|
28
|
+
);
|
|
29
|
+
return /* @__PURE__ */ r.jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
ref: y,
|
|
33
|
+
className: n(
|
|
34
|
+
"h-full rounded-lg border border-border overflow-auto",
|
|
35
|
+
p
|
|
36
|
+
),
|
|
37
|
+
...j,
|
|
38
|
+
children: /* @__PURE__ */ r.jsxs("table", { className: "w-full h-full border-collapse", children: [
|
|
39
|
+
/* @__PURE__ */ r.jsx(C, { className: "sticky top-0 z-10", children: b.getHeaderGroups().map((t) => /* @__PURE__ */ r.jsx(
|
|
40
|
+
m,
|
|
41
|
+
{
|
|
42
|
+
className: "border-b border-border bg-muted hover:bg-muted",
|
|
43
|
+
children: t.headers.map((e, s) => {
|
|
44
|
+
const o = e.column.columnDef.meta, a = o?.isActions;
|
|
45
|
+
return /* @__PURE__ */ r.jsx(
|
|
46
|
+
k,
|
|
47
|
+
{
|
|
48
|
+
className: n(
|
|
49
|
+
"h-12 px-4 text-sm font-medium text-muted-foreground bg-muted",
|
|
50
|
+
s === 0 && "pl-6",
|
|
51
|
+
o?.headerAlign === "right" && "text-right",
|
|
52
|
+
a && "sticky right-0 px-0"
|
|
53
|
+
),
|
|
54
|
+
style: {
|
|
55
|
+
minWidth: e.column.columnDef.minSize,
|
|
56
|
+
width: e.column.columnDef.size
|
|
57
|
+
},
|
|
58
|
+
children: e.isPlaceholder ? null : x(
|
|
59
|
+
e.column.columnDef.header,
|
|
60
|
+
e.getContext()
|
|
61
|
+
)
|
|
62
|
+
},
|
|
63
|
+
e.id
|
|
64
|
+
);
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
t.id
|
|
68
|
+
)) }),
|
|
69
|
+
/* @__PURE__ */ r.jsxs(D, { children: [
|
|
70
|
+
b.getRowModel().rows.map((t) => /* @__PURE__ */ r.jsx(
|
|
71
|
+
m,
|
|
72
|
+
{
|
|
73
|
+
className: n(
|
|
74
|
+
"h-12 border-b border-border bg-card text-foreground",
|
|
75
|
+
"hover:bg-muted",
|
|
76
|
+
i && "cursor-pointer"
|
|
77
|
+
),
|
|
78
|
+
onClick: i ? (e) => A(t.original, e) : void 0,
|
|
79
|
+
children: t.getVisibleCells().map((e, s) => {
|
|
80
|
+
const o = e.column.columnDef.meta, a = o?.isActions;
|
|
81
|
+
return /* @__PURE__ */ r.jsx(
|
|
82
|
+
f,
|
|
83
|
+
{
|
|
84
|
+
className: n(
|
|
85
|
+
"px-4 text-sm",
|
|
86
|
+
s === 0 && "pl-6",
|
|
87
|
+
o?.headerAlign === "right" && "text-right",
|
|
88
|
+
a && "sticky right-0 bg-card px-0"
|
|
89
|
+
),
|
|
90
|
+
...a ? { "data-column": "actions" } : {},
|
|
91
|
+
children: x(e.column.columnDef.cell, e.getContext())
|
|
92
|
+
},
|
|
93
|
+
e.id
|
|
94
|
+
);
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
t.id
|
|
98
|
+
)),
|
|
99
|
+
/* @__PURE__ */ r.jsx("tr", { "aria-hidden": "true" })
|
|
100
|
+
] }),
|
|
101
|
+
u && /* @__PURE__ */ r.jsx(w, { className: "sticky bottom-0 z-10 bg-muted", children: /* @__PURE__ */ r.jsx(m, { className: "h-12 bg-muted text-foreground hover:bg-muted", children: l.map((t, e) => {
|
|
102
|
+
const s = M(t), o = ("accessorKey" in t && typeof t.accessorKey == "string" ? t.accessorKey : t.id) || String(e), a = s ? null : u[o], T = t.meta;
|
|
103
|
+
return /* @__PURE__ */ r.jsx(
|
|
104
|
+
f,
|
|
105
|
+
{
|
|
106
|
+
className: n(
|
|
107
|
+
"px-4 text-sm font-bold bg-muted",
|
|
108
|
+
e === 0 && "pl-6",
|
|
109
|
+
T?.headerAlign === "right" && "text-right",
|
|
110
|
+
s && "sticky right-0 px-0"
|
|
111
|
+
),
|
|
112
|
+
children: a ?? ""
|
|
113
|
+
},
|
|
114
|
+
o
|
|
115
|
+
);
|
|
116
|
+
}) }) })
|
|
117
|
+
] })
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
const F = N(K);
|
|
122
|
+
F.displayName = "AggregatedTable";
|
|
123
|
+
export {
|
|
124
|
+
F as AggregatedTable
|
|
125
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
3
|
+
export type AggregationFn = "sum" | "avg" | "size" | "min" | "max" | ((params: {
|
|
4
|
+
values: unknown[];
|
|
5
|
+
field: string;
|
|
6
|
+
}) => number | string);
|
|
7
|
+
export type AggregatedColumn<T extends object = Record<string, any>> = ColumnDef<T, unknown> & {
|
|
8
|
+
aggregationFn?: AggregationFn;
|
|
9
|
+
aggregationCell?: (value: number | string) => string | ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type AggregationBuiltInFn = (values: unknown[]) => number;
|
|
12
|
+
export type CalculateTotalsRowParams<T extends object = Record<string, any>> = {
|
|
13
|
+
rows: T[];
|
|
14
|
+
columns: AggregatedColumn<any>[];
|
|
15
|
+
aggregationLabel: string;
|
|
16
|
+
};
|
|
17
|
+
export interface AggregatedColumnMeta {
|
|
18
|
+
headerAlign?: "left" | "center" | "right";
|
|
19
|
+
isActions?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface AggregatedTableProps<T extends object = Record<string, any>> {
|
|
22
|
+
/** Data rows */
|
|
23
|
+
rows: T[];
|
|
24
|
+
/**
|
|
25
|
+
* Column definitions. Decoupled from T so callers can pass AggregatedColumn[]
|
|
26
|
+
* without needing to parameterize with the exact row type.
|
|
27
|
+
*/
|
|
28
|
+
columns: AggregatedColumn<any>[];
|
|
29
|
+
/** Label to display in the first column of the footer (default: 'Total') */
|
|
30
|
+
aggregationLabel?: string;
|
|
31
|
+
/** Row click handler — receives the typed row directly */
|
|
32
|
+
onRowClick?: (row: T) => void;
|
|
33
|
+
/** Additional CSS classes */
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AggregationBuiltInFn } from './aggregated-table.types';
|
|
2
|
+
export declare const sumAggregation: AggregationBuiltInFn;
|
|
3
|
+
export declare const avgAggregation: AggregationBuiltInFn;
|
|
4
|
+
export declare const sizeAggregation: AggregationBuiltInFn;
|
|
5
|
+
export declare const minAggregation: AggregationBuiltInFn;
|
|
6
|
+
export declare const maxAggregation: AggregationBuiltInFn;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const s = (e) => {
|
|
2
|
+
const n = e.reduce((t, r) => {
|
|
3
|
+
const u = Number(r);
|
|
4
|
+
return t + (isNaN(u) ? 0 : u);
|
|
5
|
+
}, 0);
|
|
6
|
+
return Math.round(n * 100) / 100;
|
|
7
|
+
}, g = (e) => {
|
|
8
|
+
const n = e.filter((r) => r != null && !isNaN(Number(r)));
|
|
9
|
+
return n.length === 0 ? 0 : n.reduce((r, u) => r + Number(u), 0) / n.length;
|
|
10
|
+
}, a = (e) => e.filter((n) => n != null && n !== "").length, i = (e) => {
|
|
11
|
+
const n = e.map((t) => Number(t)).filter((t) => !isNaN(t));
|
|
12
|
+
return n.length > 0 ? Math.min(...n) : 0;
|
|
13
|
+
}, m = (e) => {
|
|
14
|
+
const n = e.map((t) => Number(t)).filter((t) => !isNaN(t));
|
|
15
|
+
return n.length > 0 ? Math.max(...n) : 0;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
g as avgAggregation,
|
|
19
|
+
m as maxAggregation,
|
|
20
|
+
i as minAggregation,
|
|
21
|
+
a as sizeAggregation,
|
|
22
|
+
s as sumAggregation
|
|
23
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AggregatedTable } from './aggregated-table';
|
|
2
|
+
export type { AggregatedTableProps, AggregatedColumn, AggregatedColumnMeta, AggregationFn } from './aggregated-table.types';
|
|
3
|
+
export { sumAggregation, avgAggregation, sizeAggregation, minAggregation, maxAggregation, } from './aggregation-functions.helpers';
|
|
4
|
+
export { TOTALS_ROW_ID } from './aggregated-table.constants';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export * from './aggregated-table';
|
|
1
2
|
export * from './data-table';
|
|
2
3
|
export { Dialog } from './dialog';
|
|
3
4
|
export { Sheet } from './sheet';
|
|
4
5
|
export { Tutorial } from './tutorial';
|
|
5
6
|
export type { TutorialProps, TutorialButtonProps } from './tutorial';
|
|
7
|
+
export * from './transfer-list';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TransferItem } from './transfer-list.types';
|
|
2
|
+
import { IconName } from '../../atoms/icon';
|
|
3
|
+
export interface TransferListBoxProps {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
items: TransferItem[];
|
|
7
|
+
height: number;
|
|
8
|
+
showSearch: boolean;
|
|
9
|
+
search: string;
|
|
10
|
+
searchPlaceholder: string;
|
|
11
|
+
onSearchChange: (value: string) => void;
|
|
12
|
+
onMove?: (item: TransferItem) => void;
|
|
13
|
+
moveIconName?: IconName;
|
|
14
|
+
emptyState?: React.ReactNode;
|
|
15
|
+
isSelected?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const TransferListBox: ({ id, title, items, height, showSearch, search, searchPlaceholder, onSearchChange, onMove, moveIconName, emptyState, isSelected, }: TransferListBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useDroppable as j } from "../../../node_modules/@dnd-kit/react/index.js";
|
|
3
|
+
import { TransferListItem as I } from "./transfer-list-item.js";
|
|
4
|
+
import { TransferListEmptyState as y } from "./transfer-list-empty-state.js";
|
|
5
|
+
import { Field as N } from "../../atoms/field/field.js";
|
|
6
|
+
const v = 1, R = ({
|
|
7
|
+
id: l,
|
|
8
|
+
title: t,
|
|
9
|
+
items: o,
|
|
10
|
+
height: n,
|
|
11
|
+
showSearch: m,
|
|
12
|
+
search: s,
|
|
13
|
+
searchPlaceholder: f,
|
|
14
|
+
onSearchChange: p,
|
|
15
|
+
onMove: c,
|
|
16
|
+
moveIconName: x,
|
|
17
|
+
emptyState: d,
|
|
18
|
+
isSelected: u = !1
|
|
19
|
+
}) => {
|
|
20
|
+
const a = `${l}-title`, i = o.length === 0, { ref: b } = j({ id: l, collisionPriority: v }), g = d ?? /* @__PURE__ */ e.jsx(y, {});
|
|
21
|
+
return /* @__PURE__ */ e.jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: "border border-border rounded-lg p-4 w-full flex flex-col gap-2",
|
|
25
|
+
style: { height: n },
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ e.jsx("p", { id: a, className: "text-sm text-foreground mb-2", children: t }),
|
|
28
|
+
m && (!i || s.length > 0) && /* @__PURE__ */ e.jsx(
|
|
29
|
+
N,
|
|
30
|
+
{
|
|
31
|
+
placeholder: f,
|
|
32
|
+
value: s,
|
|
33
|
+
onChange: (r) => p(r.target.value),
|
|
34
|
+
"aria-label": `${t} search`
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ e.jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref: b,
|
|
41
|
+
className: "h-full overflow-auto w-full flex flex-col gap-2",
|
|
42
|
+
role: "listbox",
|
|
43
|
+
"aria-labelledby": a,
|
|
44
|
+
"aria-multiselectable": !0,
|
|
45
|
+
children: i ? g : o.map((r, h) => /* @__PURE__ */ e.jsx(
|
|
46
|
+
I,
|
|
47
|
+
{
|
|
48
|
+
item: r,
|
|
49
|
+
index: h,
|
|
50
|
+
group: l,
|
|
51
|
+
onMove: c,
|
|
52
|
+
moveIconName: x,
|
|
53
|
+
isSelected: u
|
|
54
|
+
},
|
|
55
|
+
r.id
|
|
56
|
+
))
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
R as TransferListBox
|
|
65
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IconName } from '../../atoms/icon';
|
|
2
|
+
export interface TransferListEmptyStateProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
iconName?: IconName;
|
|
6
|
+
}
|
|
7
|
+
export declare const TransferListEmptyState: ({ title, description, iconName, }: TransferListEmptyStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { Icon as o } from "../../atoms/icon/icon.js";
|
|
3
|
+
const l = ({
|
|
4
|
+
title: t = "No items",
|
|
5
|
+
description: r = "No items available",
|
|
6
|
+
iconName: s = "TextColumns"
|
|
7
|
+
}) => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center h-full gap-4 border border-border rounded-lg p-4 bg-muted", children: [
|
|
8
|
+
/* @__PURE__ */ e.jsx(o, { name: s, className: "text-muted-foreground", size: "xl" }),
|
|
9
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-base text-center text-foreground font-bold", children: t }),
|
|
10
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-xs text-center text-muted-foreground", children: r })
|
|
11
|
+
] });
|
|
12
|
+
export {
|
|
13
|
+
l as TransferListEmptyState
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TransferItem } from './transfer-list.types';
|
|
2
|
+
import { IconName } from '../../atoms/icon';
|
|
3
|
+
export interface TransferListItemViewProps {
|
|
4
|
+
item: TransferItem;
|
|
5
|
+
onMove?: (item: TransferItem) => void;
|
|
6
|
+
moveIconName?: IconName;
|
|
7
|
+
isSelected?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TransferListItemProps extends TransferListItemViewProps {
|
|
10
|
+
index: number;
|
|
11
|
+
group: string;
|
|
12
|
+
}
|
|
13
|
+
/** Presentational-only item — used inside DragOverlay (no dnd hooks). */
|
|
14
|
+
export declare const TransferListItemView: ({ item, onMove, moveIconName, isSelected, }: TransferListItemViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const TransferListItem: ({ item, index, group, onMove, moveIconName, isSelected, }: TransferListItemProps) => import("react/jsx-runtime").JSX.Element;
|