@yuno-payments/dashboard-design-system 2.0.4 → 2.0.6
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/filter/filter-date-range.d.ts +31 -1
- package/dist/components/atoms/filter/filter-date-range.js +139 -143
- package/dist/components/atoms/filter/filter-multi-input.d.ts +11 -0
- package/dist/components/atoms/filter/filter-multi-input.js +42 -36
- package/dist/components/atoms/filter/filter-translations.d.ts +75 -0
- package/dist/components/atoms/filter/filter-translations.js +450 -0
- package/dist/components/atoms/filter/filter.d.ts +30 -0
- package/dist/components/atoms/filter/filter.js +191 -171
- package/dist/components/atoms/filter/index.d.ts +2 -2
- package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +17 -2
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +160 -151
- package/dist/components/atoms/icon/directional-icons.d.ts +12 -0
- package/dist/components/atoms/icon/directional-icons.js +38 -0
- package/dist/components/atoms/icon/icon.d.ts +6 -0
- package/dist/components/atoms/icon/icon.js +27 -21
- package/dist/components/atoms/icon/index.d.ts +1 -0
- package/dist/components/atoms/index.d.ts +1 -1
- package/dist/components/atoms/radio-group/radio-group-option.js +7 -7
- package/dist/components/atoms/select/select.js +2 -2
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.d.ts +3 -1
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.js +28 -27
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js +44 -41
- package/dist/components/organisms/data-table/components/dialogs/data-table-manage-columns-dialog.d.ts +3 -1
- package/dist/components/organisms/data-table/components/dialogs/data-table-manage-columns-dialog.js +45 -44
- package/dist/components/organisms/data-table/data-table.d.ts +27 -2
- package/dist/components/organisms/data-table/data-table.js +146 -134
- package/dist/components/organisms/data-table/data-table.types.d.ts +68 -0
- package/dist/components/organisms/data-table/data-table.types.js +252 -0
- package/dist/components/organisms/data-table/index.d.ts +2 -1
- package/dist/components/organisms/data-table/utils/data-table-utils.js +11 -8
- package/dist/dashboard-design-system.css +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.min.js +9244 -8451
- package/dist/index.js +208 -202
- package/dist/index.umd.min.js +19 -19
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.js +34 -10
- package/dist/vendor/shadcn/pagination.js +27 -28
- package/dist/vendor/shadcn/select.js +33 -33
- package/dist/vendor/shadcn/switch.js +1 -1
- package/package.json +4 -2
- package/registry/components-registry.json +16 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { IconList as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
|
+
import { cva as z } from "../../../node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { cn as I } from "../../../lib/utils.js";
|
|
5
|
+
import { IconList as h } from "./icon-list.js";
|
|
6
|
+
import { Tooltip as j } from "../tooltip/tooltip.js";
|
|
7
|
+
import { DIRECTIONAL_ICONS as C } from "./directional-icons.js";
|
|
8
|
+
const N = z("inline-flex items-center justify-center shrink-0", {
|
|
8
9
|
variants: {
|
|
9
10
|
size: {
|
|
10
11
|
xs: "size-3",
|
|
@@ -17,34 +18,39 @@ const j = u("inline-flex items-center justify-center shrink-0", {
|
|
|
17
18
|
defaultVariants: {
|
|
18
19
|
size: "md"
|
|
19
20
|
}
|
|
20
|
-
}), g =
|
|
21
|
+
}), g = d(
|
|
21
22
|
({
|
|
22
23
|
name: r,
|
|
23
|
-
weight:
|
|
24
|
+
weight: n = "light",
|
|
24
25
|
size: e,
|
|
25
26
|
className: c,
|
|
26
27
|
color: l,
|
|
27
|
-
tooltip:
|
|
28
|
+
tooltip: o,
|
|
28
29
|
tooltipProps: m,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
autoMirrorRtl: a,
|
|
31
|
+
...f
|
|
32
|
+
}, u) => {
|
|
31
33
|
if (!r)
|
|
32
34
|
return null;
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
+
const i = h?.[r];
|
|
36
|
+
if (!i)
|
|
35
37
|
return console.error("Missing icon", r), null;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
+
const p = C.has(r), x = a ?? p, s = /* @__PURE__ */ t.jsx(
|
|
39
|
+
i,
|
|
38
40
|
{
|
|
39
|
-
ref:
|
|
41
|
+
ref: u,
|
|
40
42
|
"aria-label": r,
|
|
41
|
-
className:
|
|
43
|
+
className: I(
|
|
44
|
+
N({ size: e }),
|
|
45
|
+
x && "rtl:scale-x-[-1]",
|
|
46
|
+
c
|
|
47
|
+
),
|
|
42
48
|
color: l || "currentColor",
|
|
43
|
-
weight:
|
|
44
|
-
...
|
|
49
|
+
weight: n,
|
|
50
|
+
...f
|
|
45
51
|
}
|
|
46
52
|
);
|
|
47
|
-
return
|
|
53
|
+
return o ? /* @__PURE__ */ t.jsx(j, { content: o, ...m, children: s }) : s;
|
|
48
54
|
}
|
|
49
55
|
);
|
|
50
56
|
g.displayName = "Icon";
|
|
@@ -10,7 +10,7 @@ export { CurrencyField, type CurrencyFieldProps } from './currency-field';
|
|
|
10
10
|
export { DatePicker, type DatePickerProps } from './date-picker';
|
|
11
11
|
export { DateRangePicker, type DateRangePickerProps, } from './date-range-picker';
|
|
12
12
|
export { TimePicker, type TimePickerProps } from './time-picker';
|
|
13
|
-
export { FilterButton, FilterTag, FilterSection, FilterCheckboxOption, FilterRadioOption, FilterContent, FilterDateRange, FilterDateRangeOption, FilterDateRangeValue, FilterMultiInput, type FilterButtonProps, type FilterTagProps, type FilterSectionProps, type FilterCheckboxOptionProps, type FilterRadioOptionProps, type FilterContentProps, type FilterDateRangeProps, type FilterDateRangeOptionProps, type FilterMultiInputProps, } from './filter';
|
|
13
|
+
export { FilterButton, FilterTag, FilterSection, FilterCheckboxOption, FilterRadioOption, FilterContent, FilterDateRange, FilterDateRangeOption, FilterDateRangeValue, FilterMultiInput, type FilterButtonProps, type FilterTagProps, type FilterSectionProps, type FilterCheckboxOptionProps, type FilterRadioOptionProps, type FilterContentProps, type FilterDateRangeProps, type FilterDateRangeOptionProps, type FilterDateRangeLabels, type FilterMultiInputProps, } from './filter';
|
|
14
14
|
export { FilterDropdown, FilterMenu, FilterMenuItem, type FilterDropdownProps, type FilterConfig, type FilterMenuProps, type FilterMenuItemProps, type FilterDeferredContext, } from './filter-dropdown';
|
|
15
15
|
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, type DropdownMenuProps, type DropdownMenuPortalProps, type DropdownMenuTriggerProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuLabelProps, type DropdownMenuItemProps, type DropdownMenuCheckboxItemProps, type DropdownMenuRadioGroupProps, type DropdownMenuRadioItemProps, type DropdownMenuSeparatorProps, type DropdownMenuShortcutProps, type DropdownMenuSubProps, type DropdownMenuSubTriggerProps, type DropdownMenuSubContentProps, } from './dropdown-menu';
|
|
16
16
|
export { DotsMenu, type DotsMenuProps, type DotsMenuAction, type DotsMenuOptions, } from './dots-menu';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { RadioGroupItem as d } from "../../../vendor/shadcn/radio-group.js";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Label as
|
|
3
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
4
|
+
import { Label as l } from "../label/label.js";
|
|
5
5
|
const o = ({
|
|
6
6
|
option: e,
|
|
7
7
|
radioId: s,
|
|
@@ -22,23 +22,23 @@ const o = ({
|
|
|
22
22
|
),
|
|
23
23
|
t ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
24
24
|
/* @__PURE__ */ r.jsx(
|
|
25
|
-
|
|
25
|
+
l,
|
|
26
26
|
{
|
|
27
27
|
htmlFor: s,
|
|
28
|
-
className:
|
|
28
|
+
className: a(
|
|
29
29
|
"cursor-pointer",
|
|
30
30
|
e.disabled && "text-muted-foreground"
|
|
31
31
|
),
|
|
32
32
|
children: e.label
|
|
33
33
|
}
|
|
34
34
|
),
|
|
35
|
-
e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground
|
|
35
|
+
e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground ms-auto", children: e.description })
|
|
36
36
|
] }) : /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-1.5 flex-1", children: [
|
|
37
37
|
/* @__PURE__ */ r.jsx(
|
|
38
|
-
|
|
38
|
+
l,
|
|
39
39
|
{
|
|
40
40
|
htmlFor: s,
|
|
41
|
-
className:
|
|
41
|
+
className: a(
|
|
42
42
|
"cursor-pointer",
|
|
43
43
|
e.disabled && "text-muted-foreground"
|
|
44
44
|
),
|
|
@@ -72,14 +72,14 @@ const $ = G.forwardRef(
|
|
|
72
72
|
j.map((l, C) => /* @__PURE__ */ e.jsxs(V, { children: [
|
|
73
73
|
l.label && /* @__PURE__ */ e.jsx(E, { children: l.label }),
|
|
74
74
|
l.options.map((s) => /* @__PURE__ */ e.jsxs(f, { value: s.value, children: [
|
|
75
|
-
s.icon && /* @__PURE__ */ e.jsx("span", { className: "
|
|
75
|
+
s.icon && /* @__PURE__ */ e.jsx("span", { className: "me-2 inline-flex items-center", children: s.icon }),
|
|
76
76
|
s.label
|
|
77
77
|
] }, s.value))
|
|
78
78
|
] }, C))
|
|
79
79
|
) : w ? (
|
|
80
80
|
// Render flat options
|
|
81
81
|
h.map((l) => /* @__PURE__ */ e.jsx(f, { value: l.value, children: /* @__PURE__ */ e.jsxs("span", { className: "flex items-center", children: [
|
|
82
|
-
l.icon && /* @__PURE__ */ e.jsx("span", { className: "
|
|
82
|
+
l.icon && /* @__PURE__ */ e.jsx("span", { className: "me-2 inline-flex items-center", children: l.icon }),
|
|
83
83
|
l.label
|
|
84
84
|
] }) }, l.value))
|
|
85
85
|
) : null })
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Column } from '@tanstack/react-table';
|
|
2
|
+
import { DataTableTranslations } from '../../data-table.types';
|
|
2
3
|
interface DataTableColumnHeaderMenuProps<TData, TValue> {
|
|
3
4
|
column: Column<TData, TValue>;
|
|
4
5
|
isLastVisibleColumn: boolean;
|
|
5
6
|
onManageColumnsClick: () => void;
|
|
7
|
+
translations: Required<DataTableTranslations>;
|
|
6
8
|
}
|
|
7
|
-
export declare function DataTableColumnHeaderMenu<TData, TValue>({ column, isLastVisibleColumn, onManageColumnsClick, }: DataTableColumnHeaderMenuProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function DataTableColumnHeaderMenu<TData, TValue>({ column, isLastVisibleColumn, onManageColumnsClick, translations, }: DataTableColumnHeaderMenuProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -1,75 +1,76 @@
|
|
|
1
1
|
import { j as e } from "../../../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { Icon as n } from "../../../../atoms/icon/icon.js";
|
|
3
|
-
import { DropdownMenuContent as
|
|
4
|
-
function
|
|
3
|
+
import { DropdownMenuContent as c, DropdownMenuItem as r, DropdownMenuSeparator as o } from "../../../../atoms/dropdown-menu/dropdown-menu.js";
|
|
4
|
+
function C({
|
|
5
5
|
column: s,
|
|
6
|
-
isLastVisibleColumn:
|
|
7
|
-
onManageColumnsClick:
|
|
6
|
+
isLastVisibleColumn: d,
|
|
7
|
+
onManageColumnsClick: x,
|
|
8
|
+
translations: i
|
|
8
9
|
}) {
|
|
9
|
-
const l = s.getCanSort(),
|
|
10
|
-
return /* @__PURE__ */ e.jsxs(
|
|
10
|
+
const l = s.getCanSort(), a = s.getCanPin(), g = s.getCanHide(), t = s.getIsPinned(), m = s.getIsSorted();
|
|
11
|
+
return /* @__PURE__ */ e.jsxs(c, { align: "start", children: [
|
|
11
12
|
l && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
12
|
-
/* @__PURE__ */ e.jsxs(
|
|
13
|
+
/* @__PURE__ */ e.jsxs(r, { onClick: () => s.toggleSorting(!1), children: [
|
|
13
14
|
/* @__PURE__ */ e.jsx(n, { name: "ArrowUp", size: "sm" }),
|
|
14
|
-
|
|
15
|
+
i.ascending
|
|
15
16
|
] }),
|
|
16
|
-
/* @__PURE__ */ e.jsxs(
|
|
17
|
+
/* @__PURE__ */ e.jsxs(r, { onClick: () => s.toggleSorting(!0), children: [
|
|
17
18
|
/* @__PURE__ */ e.jsx(n, { name: "ArrowDown", size: "sm" }),
|
|
18
|
-
|
|
19
|
+
i.descending
|
|
19
20
|
] }),
|
|
20
|
-
|
|
21
|
+
m && /* @__PURE__ */ e.jsxs(r, { onClick: () => s.clearSorting(), children: [
|
|
21
22
|
/* @__PURE__ */ e.jsx(n, { name: "X", size: "sm" }),
|
|
22
|
-
|
|
23
|
+
i.clearSorting
|
|
23
24
|
] }),
|
|
24
25
|
/* @__PURE__ */ e.jsx(o, {})
|
|
25
26
|
] }),
|
|
26
|
-
|
|
27
|
+
a && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
27
28
|
/* @__PURE__ */ e.jsxs(
|
|
28
|
-
|
|
29
|
+
r,
|
|
29
30
|
{
|
|
30
31
|
onClick: () => s.pin("left"),
|
|
31
32
|
disabled: t === "left",
|
|
32
33
|
children: [
|
|
33
34
|
/* @__PURE__ */ e.jsx(n, { name: "PushPinSimple", size: "sm" }),
|
|
34
|
-
|
|
35
|
+
i.pinToLeft
|
|
35
36
|
]
|
|
36
37
|
}
|
|
37
38
|
),
|
|
38
39
|
/* @__PURE__ */ e.jsxs(
|
|
39
|
-
|
|
40
|
+
r,
|
|
40
41
|
{
|
|
41
42
|
onClick: () => s.pin("right"),
|
|
42
43
|
disabled: t === "right",
|
|
43
44
|
children: [
|
|
44
45
|
/* @__PURE__ */ e.jsx(n, { name: "PushPinSimple", size: "sm" }),
|
|
45
|
-
|
|
46
|
+
i.pinToRight
|
|
46
47
|
]
|
|
47
48
|
}
|
|
48
49
|
),
|
|
49
|
-
t && /* @__PURE__ */ e.jsxs(
|
|
50
|
+
t && /* @__PURE__ */ e.jsxs(r, { onClick: () => s.pin(!1), children: [
|
|
50
51
|
/* @__PURE__ */ e.jsx(n, { name: "PushPinSimpleSlash", size: "sm" }),
|
|
51
|
-
|
|
52
|
+
i.unpin
|
|
52
53
|
] }),
|
|
53
54
|
/* @__PURE__ */ e.jsx(o, {})
|
|
54
55
|
] }),
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
g && /* @__PURE__ */ e.jsxs(
|
|
57
|
+
r,
|
|
57
58
|
{
|
|
58
59
|
onClick: () => s.toggleVisibility(!1),
|
|
59
|
-
disabled:
|
|
60
|
+
disabled: d,
|
|
60
61
|
children: [
|
|
61
62
|
/* @__PURE__ */ e.jsx(n, { name: "EyeSlash", size: "sm" }),
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
i.hide,
|
|
64
|
+
d && /* @__PURE__ */ e.jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: i.lastColumn })
|
|
64
65
|
]
|
|
65
66
|
}
|
|
66
67
|
),
|
|
67
|
-
/* @__PURE__ */ e.jsxs(
|
|
68
|
+
/* @__PURE__ */ e.jsxs(r, { onClick: x, children: [
|
|
68
69
|
/* @__PURE__ */ e.jsx(n, { name: "Columns", size: "sm" }),
|
|
69
|
-
|
|
70
|
+
i.manageColumns
|
|
70
71
|
] })
|
|
71
72
|
] });
|
|
72
73
|
}
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
+
C as DataTableColumnHeaderMenu
|
|
75
76
|
};
|
package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { j as e } from "../../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useColumnHeader as
|
|
5
|
-
import { DataTableColumnHeaderMenu as
|
|
2
|
+
import { Icon as h } from "../../../../atoms/icon/icon.js";
|
|
3
|
+
import { cn as u } from "../../../../../lib/utils.js";
|
|
4
|
+
import { useColumnHeader as O } from "../../hooks/use-column-header.js";
|
|
5
|
+
import { DataTableColumnHeaderMenu as b } from "./data-table-column-header-menu.js";
|
|
6
6
|
import { DataTableManageColumnsDialog as v } from "../dialogs/data-table-manage-columns-dialog.js";
|
|
7
|
-
import { DataTableColumnHeaderContent as
|
|
7
|
+
import { DataTableColumnHeaderContent as A } from "./data-table-column-header-content.js";
|
|
8
|
+
import { DEFAULT_DATA_TABLE_TRANSLATIONS as H } from "../../data-table.types.js";
|
|
8
9
|
import { DropdownMenu as I } from "../../../../atoms/dropdown-menu/dropdown-menu.js";
|
|
9
|
-
function
|
|
10
|
+
function w({
|
|
10
11
|
column: o,
|
|
11
|
-
table:
|
|
12
|
-
title:
|
|
13
|
-
className:
|
|
12
|
+
table: s,
|
|
13
|
+
title: a,
|
|
14
|
+
className: r,
|
|
14
15
|
info: n
|
|
15
16
|
}) {
|
|
16
17
|
const {
|
|
17
|
-
isHovered:
|
|
18
|
-
setIsHovered:
|
|
19
|
-
isMenuOpen:
|
|
20
|
-
setIsMenuOpen:
|
|
21
|
-
isManageColumnsOpen:
|
|
18
|
+
isHovered: p,
|
|
19
|
+
setIsHovered: t,
|
|
20
|
+
isMenuOpen: i,
|
|
21
|
+
setIsMenuOpen: d,
|
|
22
|
+
isManageColumnsOpen: c,
|
|
22
23
|
setIsManageColumnsOpen: C,
|
|
23
|
-
isPinned:
|
|
24
|
-
canPin:
|
|
25
|
-
canSort:
|
|
24
|
+
isPinned: x,
|
|
25
|
+
canPin: f,
|
|
26
|
+
canSort: m,
|
|
26
27
|
isSorted: g,
|
|
27
|
-
toggleableColumns:
|
|
28
|
-
visibleColumnsCount:
|
|
29
|
-
isLastVisibleColumn:
|
|
30
|
-
handleManageColumnsClick:
|
|
31
|
-
} =
|
|
32
|
-
return !
|
|
28
|
+
toggleableColumns: j,
|
|
29
|
+
visibleColumnsCount: M,
|
|
30
|
+
isLastVisibleColumn: D,
|
|
31
|
+
handleManageColumnsClick: T
|
|
32
|
+
} = O(o, s), l = s.options.meta?.translations ?? H;
|
|
33
|
+
return !m && !f ? /* @__PURE__ */ e.jsxs("div", { className: u("flex items-center gap-2", r), children: [
|
|
33
34
|
n && /* @__PURE__ */ e.jsx(
|
|
34
|
-
|
|
35
|
+
h,
|
|
35
36
|
{
|
|
36
37
|
name: "Info",
|
|
37
38
|
size: "sm",
|
|
@@ -39,43 +40,45 @@ function z({
|
|
|
39
40
|
tooltip: n
|
|
40
41
|
}
|
|
41
42
|
),
|
|
42
|
-
/* @__PURE__ */ e.jsx("span", { children:
|
|
43
|
+
/* @__PURE__ */ e.jsx("span", { children: a })
|
|
43
44
|
] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
44
|
-
/* @__PURE__ */ e.jsx("div", { className:
|
|
45
|
+
/* @__PURE__ */ e.jsx("div", { className: u("flex items-center gap-2", r), children: /* @__PURE__ */ e.jsxs(I, { open: i, onOpenChange: d, children: [
|
|
45
46
|
/* @__PURE__ */ e.jsx(
|
|
46
|
-
|
|
47
|
+
A,
|
|
47
48
|
{
|
|
48
|
-
title:
|
|
49
|
+
title: a,
|
|
49
50
|
info: n,
|
|
50
|
-
isPinned:
|
|
51
|
-
canSort:
|
|
51
|
+
isPinned: x,
|
|
52
|
+
canSort: m,
|
|
52
53
|
sortDirection: g,
|
|
53
|
-
isHovered:
|
|
54
|
-
isMenuOpen:
|
|
55
|
-
onMouseEnter: () =>
|
|
56
|
-
onMouseLeave: () =>
|
|
54
|
+
isHovered: p,
|
|
55
|
+
isMenuOpen: i,
|
|
56
|
+
onMouseEnter: () => t(!0),
|
|
57
|
+
onMouseLeave: () => t(!1)
|
|
57
58
|
}
|
|
58
59
|
),
|
|
59
60
|
/* @__PURE__ */ e.jsx(
|
|
60
|
-
|
|
61
|
+
b,
|
|
61
62
|
{
|
|
62
63
|
column: o,
|
|
63
|
-
isLastVisibleColumn:
|
|
64
|
-
onManageColumnsClick:
|
|
64
|
+
isLastVisibleColumn: D,
|
|
65
|
+
onManageColumnsClick: T,
|
|
66
|
+
translations: l
|
|
65
67
|
}
|
|
66
68
|
)
|
|
67
69
|
] }) }),
|
|
68
70
|
/* @__PURE__ */ e.jsx(
|
|
69
71
|
v,
|
|
70
72
|
{
|
|
71
|
-
isOpen:
|
|
73
|
+
isOpen: c,
|
|
72
74
|
onOpenChange: C,
|
|
73
|
-
toggleableColumns:
|
|
74
|
-
visibleColumnsCount:
|
|
75
|
+
toggleableColumns: j,
|
|
76
|
+
visibleColumnsCount: M,
|
|
77
|
+
translations: l
|
|
75
78
|
}
|
|
76
79
|
)
|
|
77
80
|
] });
|
|
78
81
|
}
|
|
79
82
|
export {
|
|
80
|
-
|
|
83
|
+
w as DataTableColumnHeader
|
|
81
84
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Column } from '@tanstack/react-table';
|
|
2
|
+
import { DataTableTranslations } from '../../data-table.types';
|
|
2
3
|
interface DataTableManageColumnsDialogProps<TData> {
|
|
3
4
|
isOpen: boolean;
|
|
4
5
|
onOpenChange: (open: boolean) => void;
|
|
5
6
|
toggleableColumns: Column<TData, unknown>[];
|
|
6
7
|
visibleColumnsCount: number;
|
|
8
|
+
translations: Required<DataTableTranslations>;
|
|
7
9
|
}
|
|
8
|
-
export declare function DataTableManageColumnsDialog<TData>({ isOpen, onOpenChange, toggleableColumns, visibleColumnsCount, }: DataTableManageColumnsDialogProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function DataTableManageColumnsDialog<TData>({ isOpen, onOpenChange, toggleableColumns, visibleColumnsCount, translations, }: DataTableManageColumnsDialogProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
package/dist/components/organisms/data-table/components/dialogs/data-table-manage-columns-dialog.js
CHANGED
|
@@ -1,68 +1,69 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { getColumnDisplayName as
|
|
4
|
-
import { Dialog as
|
|
5
|
-
import { SearchField as
|
|
6
|
-
import { Switch as
|
|
1
|
+
import { j as l } from "../../../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useState as y } from "react";
|
|
3
|
+
import { getColumnDisplayName as d } from "../../utils/data-table-utils.js";
|
|
4
|
+
import { Dialog as C } from "../../../dialog/dialog.js";
|
|
5
|
+
import { SearchField as V } from "../../../../atoms/search-field/search-field.js";
|
|
6
|
+
import { Switch as j } from "../../../../atoms/switch/switch.js";
|
|
7
7
|
function D({
|
|
8
|
-
isOpen:
|
|
9
|
-
onOpenChange:
|
|
10
|
-
toggleableColumns:
|
|
11
|
-
visibleColumnsCount:
|
|
8
|
+
isOpen: m,
|
|
9
|
+
onOpenChange: h,
|
|
10
|
+
toggleableColumns: t,
|
|
11
|
+
visibleColumnsCount: a,
|
|
12
|
+
translations: i
|
|
12
13
|
}) {
|
|
13
|
-
const [
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
const e =
|
|
19
|
-
(
|
|
14
|
+
const [o, r] = y(""), u = () => {
|
|
15
|
+
r(""), h(!1);
|
|
16
|
+
}, n = t.filter((e) => d(e).toLowerCase().includes(o.toLowerCase())), p = () => {
|
|
17
|
+
t.forEach((e) => e.toggleVisibility(!0));
|
|
18
|
+
}, f = () => {
|
|
19
|
+
const e = t.filter(
|
|
20
|
+
(s) => s.getIsVisible()
|
|
20
21
|
);
|
|
21
|
-
e.length <= 1 || e.slice(1).forEach((
|
|
22
|
-
},
|
|
22
|
+
e.length <= 1 || e.slice(1).forEach((s) => s.toggleVisibility(!1));
|
|
23
|
+
}, b = t.every(
|
|
23
24
|
(e) => e.getIsVisible()
|
|
24
|
-
),
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
25
|
+
), g = a <= 1;
|
|
26
|
+
return /* @__PURE__ */ l.jsx(
|
|
27
|
+
C,
|
|
27
28
|
{
|
|
28
|
-
open:
|
|
29
|
-
closeIcon:
|
|
30
|
-
title:
|
|
29
|
+
open: m,
|
|
30
|
+
closeIcon: u,
|
|
31
|
+
title: i.manageColumns,
|
|
31
32
|
widthContainer: 400,
|
|
32
33
|
buttons: [
|
|
33
34
|
{
|
|
34
|
-
children:
|
|
35
|
+
children: i.hideAll,
|
|
35
36
|
variant: "link",
|
|
36
|
-
onClick:
|
|
37
|
-
disabled:
|
|
37
|
+
onClick: f,
|
|
38
|
+
disabled: g
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
|
-
children:
|
|
41
|
+
children: i.showAll,
|
|
41
42
|
variant: "link",
|
|
42
|
-
onClick:
|
|
43
|
-
disabled:
|
|
43
|
+
onClick: p,
|
|
44
|
+
disabled: b
|
|
44
45
|
}
|
|
45
46
|
],
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
47
|
+
children: /* @__PURE__ */ l.jsxs("div", { className: "space-y-4", children: [
|
|
48
|
+
/* @__PURE__ */ l.jsx(
|
|
49
|
+
V,
|
|
49
50
|
{
|
|
50
|
-
placeholder:
|
|
51
|
-
value:
|
|
52
|
-
onSearch:
|
|
51
|
+
placeholder: i.searchColumns,
|
|
52
|
+
value: o,
|
|
53
|
+
onSearch: r,
|
|
53
54
|
className: "mb-6"
|
|
54
55
|
}
|
|
55
56
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
|
|
57
|
+
/* @__PURE__ */ l.jsx("div", { className: "space-y-4 max-h-[300px] overflow-y-auto", children: n.length === 0 ? /* @__PURE__ */ l.jsx("p", { className: "text-sm text-muted-foreground text-center py-4", children: i.noColumnsFound }) : n.map((e) => {
|
|
58
|
+
const s = d(e), c = a === 1 && e.getIsVisible();
|
|
59
|
+
return /* @__PURE__ */ l.jsx(
|
|
60
|
+
j,
|
|
60
61
|
{
|
|
61
62
|
id: `column-${e.id}`,
|
|
62
63
|
checked: e.getIsVisible(),
|
|
63
|
-
disabled:
|
|
64
|
-
label: `${
|
|
65
|
-
onChange: (
|
|
64
|
+
disabled: c,
|
|
65
|
+
label: `${s}${c ? ` ${i.lastColumn}` : ""}`,
|
|
66
|
+
onChange: (x) => e.toggleVisibility(x.target.checked)
|
|
66
67
|
},
|
|
67
68
|
e.id
|
|
68
69
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnResizeMode } from '@tanstack/react-table';
|
|
2
|
-
import { DataTableActionsConfig, DataTableColumnDef } from './data-table.types';
|
|
2
|
+
import { DataTableActionsConfig, DataTableColumnDef, DataTableTranslations, DataTableLanguage } from './data-table.types';
|
|
3
3
|
import { EmptyProps } from '../../molecules';
|
|
4
4
|
/**
|
|
5
5
|
* Props for the DataTable component
|
|
@@ -117,6 +117,31 @@ export interface DataTableProps<TData, TValue> {
|
|
|
117
117
|
* @default false
|
|
118
118
|
*/
|
|
119
119
|
enableColumnDragDrop?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Language code for translations.
|
|
122
|
+
* When provided, uses built-in translations for the specified language.
|
|
123
|
+
* @default "en"
|
|
124
|
+
*/
|
|
125
|
+
lang?: DataTableLanguage;
|
|
126
|
+
/**
|
|
127
|
+
* Translation strings for the column menu and dialogs.
|
|
128
|
+
* All fields are optional with English defaults.
|
|
129
|
+
* Overrides lang-based translations if both are provided.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* <DataTable
|
|
134
|
+
* lang="es"
|
|
135
|
+
* translations={{
|
|
136
|
+
* ascending: t('table.ascending'),
|
|
137
|
+
* descending: t('table.descending'),
|
|
138
|
+
* clearSorting: t('table.clearSorting'),
|
|
139
|
+
* // ...
|
|
140
|
+
* }}
|
|
141
|
+
* />
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
translations?: DataTableTranslations;
|
|
120
145
|
}
|
|
121
146
|
/**
|
|
122
147
|
* Advanced data table component built on TanStack Table.
|
|
@@ -134,4 +159,4 @@ export interface DataTableProps<TData, TValue> {
|
|
|
134
159
|
* />
|
|
135
160
|
* ```
|
|
136
161
|
*/
|
|
137
|
-
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, rowSelection: externalRowSelection, onRowSelectionChange, enableSorting, manualSorting, sorting: externalSorting, onSortingChange: externalOnSortingChange, enableColumnFilters, enableColumnResizing, columnResizeMode, enableColumnPinning, onRowClick, actions, height, rowHeight, className, persistKey, initialSettings, onUpdate, enableColumnDragDrop, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
162
|
+
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, rowSelection: externalRowSelection, onRowSelectionChange, enableSorting, manualSorting, sorting: externalSorting, onSortingChange: externalOnSortingChange, enableColumnFilters, enableColumnResizing, columnResizeMode, enableColumnPinning, onRowClick, actions, height, rowHeight, className, persistKey, initialSettings, onUpdate, enableColumnDragDrop, lang, translations, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|