@tint-ui/data-table 0.3.5
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 +21 -0
- package/README.md +9 -0
- package/adapters/boolean.d.ts +10 -0
- package/adapters/boolean.js +38 -0
- package/adapters/index.d.ts +6 -0
- package/adapters/index.js +18 -0
- package/adapters/number-format.d.ts +1 -0
- package/adapters/number-format.js +42 -0
- package/adapters/number.d.ts +12 -0
- package/adapters/number.js +51 -0
- package/adapters/text.d.ts +4 -0
- package/adapters/text.js +9 -0
- package/cell-adapter-type.d.ts +43 -0
- package/cell-adapter-type.js +306 -0
- package/cjs/adapters/boolean.js +43 -0
- package/cjs/adapters/index.js +21 -0
- package/cjs/adapters/number-format.js +46 -0
- package/cjs/adapters/number.js +56 -0
- package/cjs/adapters/text.js +13 -0
- package/cjs/cell-adapter-type.js +312 -0
- package/cjs/classes.js +27 -0
- package/cjs/context.js +14 -0
- package/cjs/data-table-content.js +105 -0
- package/cjs/data-table-pagination.js +38 -0
- package/cjs/data-table-text-filter.js +83 -0
- package/cjs/data-table-toolbar.js +103 -0
- package/cjs/data-table-views-options.js +137 -0
- package/cjs/data-table.js +63 -0
- package/cjs/filter-adapter-type.js +162 -0
- package/cjs/filter-adapters/index.js +10 -0
- package/cjs/filter-adapters/option.js +152 -0
- package/cjs/filter-adapters/use-option-filter.js +195 -0
- package/cjs/filter-classes.js +26 -0
- package/cjs/filter-fn.js +84 -0
- package/cjs/index.js +99 -0
- package/cjs/package.json +3 -0
- package/cjs/pagination-arrow.js +93 -0
- package/cjs/pagination-classes.js +20 -0
- package/cjs/pagination-number.js +66 -0
- package/cjs/pagination-size-options.js +48 -0
- package/cjs/row-button-menu.js +49 -0
- package/cjs/row-popover-menu.js +52 -0
- package/cjs/toolbar-classes.js +24 -0
- package/cjs/types.js +3 -0
- package/cjs/use-data-table.js +768 -0
- package/cjs/use-lexicon.js +155 -0
- package/cjs/use-row-menu.js +60 -0
- package/cjs/use-visibility-column.js +105 -0
- package/cjs/use-visibility-filter.js +149 -0
- package/cjs/utils.js +136 -0
- package/classes.d.ts +34 -0
- package/classes.js +23 -0
- package/context.d.ts +5 -0
- package/context.js +9 -0
- package/data-table-content.d.ts +9 -0
- package/data-table-content.js +98 -0
- package/data-table-pagination.d.ts +5 -0
- package/data-table-pagination.js +31 -0
- package/data-table-text-filter.d.ts +7 -0
- package/data-table-text-filter.js +76 -0
- package/data-table-toolbar.d.ts +5 -0
- package/data-table-toolbar.js +95 -0
- package/data-table-views-options.d.ts +2 -0
- package/data-table-views-options.js +133 -0
- package/data-table.d.ts +18 -0
- package/data-table.js +56 -0
- package/filter-adapter-type.d.ts +9 -0
- package/filter-adapter-type.js +155 -0
- package/filter-adapters/index.d.ts +5 -0
- package/filter-adapters/index.js +7 -0
- package/filter-adapters/option.d.ts +3 -0
- package/filter-adapters/option.js +147 -0
- package/filter-adapters/use-option-filter.d.ts +27 -0
- package/filter-adapters/use-option-filter.js +192 -0
- package/filter-classes.d.ts +32 -0
- package/filter-classes.js +22 -0
- package/filter-fn.d.ts +7 -0
- package/filter-fn.js +76 -0
- package/index.d.ts +16 -0
- package/index.js +16 -0
- package/package.json +97 -0
- package/pagination-arrow.d.ts +5 -0
- package/pagination-arrow.js +86 -0
- package/pagination-classes.d.ts +20 -0
- package/pagination-classes.js +16 -0
- package/pagination-number.d.ts +5 -0
- package/pagination-number.js +59 -0
- package/pagination-size-options.d.ts +3 -0
- package/pagination-size-options.js +44 -0
- package/row-button-menu.d.ts +5 -0
- package/row-button-menu.js +45 -0
- package/row-popover-menu.d.ts +5 -0
- package/row-popover-menu.js +48 -0
- package/styles-filter.css +1 -0
- package/styles-filter.module.css +64 -0
- package/styles-filter.module.scss +65 -0
- package/styles-pagination.css +1 -0
- package/styles-pagination.module.css +28 -0
- package/styles-pagination.module.scss +31 -0
- package/styles-toolbar.css +1 -0
- package/styles-toolbar.module.css +70 -0
- package/styles-toolbar.module.scss +67 -0
- package/styles.css +1 -0
- package/styles.json +8 -0
- package/styles.module.css +39 -0
- package/styles.module.scss +38 -0
- package/toolbar-classes.d.ts +26 -0
- package/toolbar-classes.js +20 -0
- package/types.d.ts +226 -0
- package/types.js +2 -0
- package/use-data-table.d.ts +3 -0
- package/use-data-table.js +768 -0
- package/use-lexicon.d.ts +12 -0
- package/use-lexicon.js +151 -0
- package/use-row-menu.d.ts +7 -0
- package/use-row-menu.js +58 -0
- package/use-visibility-column.d.ts +7 -0
- package/use-visibility-column.js +101 -0
- package/use-visibility-filter.d.ts +7 -0
- package/use-visibility-filter.js +145 -0
- package/utils.d.ts +14 -0
- package/utils.js +128 -0
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./classes.js";
|
|
2
|
+
export * from "./filter-classes.js";
|
|
3
|
+
export * from "./toolbar-classes.js";
|
|
4
|
+
export * from "./pagination-classes.js";
|
|
5
|
+
export * from "./context.js";
|
|
6
|
+
export * from "./cell-adapter-type.js";
|
|
7
|
+
export * from "./filter-adapter-type.js";
|
|
8
|
+
export * from "./data-table-content.js";
|
|
9
|
+
export * from "./data-table-pagination.js";
|
|
10
|
+
export * from "./data-table-toolbar.js";
|
|
11
|
+
export * from "./data-table-views-options.js";
|
|
12
|
+
export * from "./data-table.js";
|
|
13
|
+
export * from "./pagination-arrow.js";
|
|
14
|
+
export * from "./pagination-number.js";
|
|
15
|
+
export * from "./pagination-size-options.js";
|
|
16
|
+
export * from "./types.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tint-ui/data-table",
|
|
3
|
+
"version": "0.3.5",
|
|
4
|
+
"author": "phragon@websoftlab.com",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@babel/runtime": "^7.20.1",
|
|
8
|
+
"@tint-ui/button": "^0.3.0",
|
|
9
|
+
"@tint-ui/input": "^0.3.0",
|
|
10
|
+
"@tint-ui/input-checkbox": "^0.3.0",
|
|
11
|
+
"@tint-ui/slide-navigator": "^0.3.0",
|
|
12
|
+
"@tint-ui/svg-icon": "^0.3.0",
|
|
13
|
+
"@tint-ui/table": "^0.3.0",
|
|
14
|
+
"@tint-ui/theme": "^0.3.0",
|
|
15
|
+
"@tint-ui/tools": "^0.3.0",
|
|
16
|
+
"clsx": "^2.1.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@tanstack/react-table": "^8.21.3",
|
|
20
|
+
"@types/react": "^18.0.12"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/websoftlab/tint-ui.git",
|
|
25
|
+
"directory": "packages/data-table"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@tanstack/react-table": "^8.21.3",
|
|
29
|
+
"react": "^16.8.0 || ^17 || ^18 || ^19"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"require": "./cjs/index.js",
|
|
34
|
+
"default": "./index.js"
|
|
35
|
+
},
|
|
36
|
+
"./styles.module.scss": {
|
|
37
|
+
"require": "./styles.module.scss",
|
|
38
|
+
"default": "./styles.module.scss"
|
|
39
|
+
},
|
|
40
|
+
"./styles.module.css": {
|
|
41
|
+
"require": "./styles.module.css",
|
|
42
|
+
"default": "./styles.module.css"
|
|
43
|
+
},
|
|
44
|
+
"./styles.css": {
|
|
45
|
+
"require": "./styles.css",
|
|
46
|
+
"default": "./styles.css"
|
|
47
|
+
},
|
|
48
|
+
"./styles-filter.module.scss": {
|
|
49
|
+
"require": "./styles-filter.module.scss",
|
|
50
|
+
"default": "./styles-filter.module.scss"
|
|
51
|
+
},
|
|
52
|
+
"./styles-filter.module.css": {
|
|
53
|
+
"require": "./styles-filter.module.css",
|
|
54
|
+
"default": "./styles-filter.module.css"
|
|
55
|
+
},
|
|
56
|
+
"./styles-filter.css": {
|
|
57
|
+
"require": "./styles-filter.css",
|
|
58
|
+
"default": "./styles-filter.css"
|
|
59
|
+
},
|
|
60
|
+
"./styles-pagination.module.scss": {
|
|
61
|
+
"require": "./styles-pagination.module.scss",
|
|
62
|
+
"default": "./styles-pagination.module.scss"
|
|
63
|
+
},
|
|
64
|
+
"./styles-pagination.module.css": {
|
|
65
|
+
"require": "./styles-pagination.module.css",
|
|
66
|
+
"default": "./styles-pagination.module.css"
|
|
67
|
+
},
|
|
68
|
+
"./styles-pagination.css": {
|
|
69
|
+
"require": "./styles-pagination.css",
|
|
70
|
+
"default": "./styles-pagination.css"
|
|
71
|
+
},
|
|
72
|
+
"./styles-toolbar.module.scss": {
|
|
73
|
+
"require": "./styles-toolbar.module.scss",
|
|
74
|
+
"default": "./styles-toolbar.module.scss"
|
|
75
|
+
},
|
|
76
|
+
"./styles-toolbar.module.css": {
|
|
77
|
+
"require": "./styles-toolbar.module.css",
|
|
78
|
+
"default": "./styles-toolbar.module.css"
|
|
79
|
+
},
|
|
80
|
+
"./styles-toolbar.css": {
|
|
81
|
+
"require": "./styles-toolbar.css",
|
|
82
|
+
"default": "./styles-toolbar.css"
|
|
83
|
+
},
|
|
84
|
+
"./styles.json": {
|
|
85
|
+
"require": "./styles.json",
|
|
86
|
+
"default": "./styles.json"
|
|
87
|
+
},
|
|
88
|
+
"./package.json": {
|
|
89
|
+
"require": "./package.json",
|
|
90
|
+
"default": "./package.json"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"main": "./cjs/index.js",
|
|
94
|
+
"type": "module",
|
|
95
|
+
"module": "./index.js",
|
|
96
|
+
"types": "./index.d.ts"
|
|
97
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const PaginationArrow: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
type PaginationArrowProps = React.ComponentProps<typeof PaginationArrow>;
|
|
4
|
+
export { PaginationArrow };
|
|
5
|
+
export type { PaginationArrowProps };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { Button } from "@tint-ui/button";
|
|
7
|
+
import { SvgThemeIcon } from "@tint-ui/svg-icon";
|
|
8
|
+
import { useDataTableContext } from "./context.js";
|
|
9
|
+
import { useDataTablePaginationClasses } from "./pagination-classes.js";
|
|
10
|
+
const PaginationArrow = /*#__PURE__*/React.forwardRef(({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) => {
|
|
14
|
+
const classes = useDataTablePaginationClasses();
|
|
15
|
+
const {
|
|
16
|
+
loading,
|
|
17
|
+
table,
|
|
18
|
+
lexicon,
|
|
19
|
+
navbar: {
|
|
20
|
+
size
|
|
21
|
+
}
|
|
22
|
+
} = useDataTableContext();
|
|
23
|
+
const pageCount = table.getPageCount();
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
25
|
+
className: clsx(classes.group, className),
|
|
26
|
+
ref: ref
|
|
27
|
+
}), pageCount > 1 && /*#__PURE__*/React.createElement("span", null, lexicon.pageOf), /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
"aria-label": lexicon.pageFirst,
|
|
29
|
+
variant: "outline",
|
|
30
|
+
size: size,
|
|
31
|
+
className: classes.firstLast,
|
|
32
|
+
onClick: () => {
|
|
33
|
+
table.setPageIndex(0);
|
|
34
|
+
},
|
|
35
|
+
disabled: loading || !table.getCanPreviousPage(),
|
|
36
|
+
iconOnly: true,
|
|
37
|
+
iconLeft: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
38
|
+
icon: "pagination-first",
|
|
39
|
+
"aria-hidden": "true"
|
|
40
|
+
})
|
|
41
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
42
|
+
"aria-label": lexicon.pagePrevious,
|
|
43
|
+
variant: "outline",
|
|
44
|
+
size: size,
|
|
45
|
+
className: classes.previousNext,
|
|
46
|
+
onClick: () => {
|
|
47
|
+
table.previousPage();
|
|
48
|
+
},
|
|
49
|
+
disabled: loading || !table.getCanPreviousPage(),
|
|
50
|
+
iconOnly: true,
|
|
51
|
+
iconLeft: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
52
|
+
icon: "pagination-previous",
|
|
53
|
+
"aria-hidden": "true"
|
|
54
|
+
})
|
|
55
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
56
|
+
"aria-label": lexicon.pageNext,
|
|
57
|
+
variant: "outline",
|
|
58
|
+
size: size,
|
|
59
|
+
className: classes.previousNext,
|
|
60
|
+
onClick: () => {
|
|
61
|
+
table.nextPage();
|
|
62
|
+
},
|
|
63
|
+
disabled: loading || !table.getCanNextPage(),
|
|
64
|
+
iconOnly: true,
|
|
65
|
+
iconRight: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
66
|
+
icon: "pagination-next",
|
|
67
|
+
"aria-hidden": "true"
|
|
68
|
+
})
|
|
69
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
70
|
+
"aria-label": lexicon.pageLast,
|
|
71
|
+
variant: "outline",
|
|
72
|
+
size: size,
|
|
73
|
+
className: classes.firstLast,
|
|
74
|
+
onClick: () => {
|
|
75
|
+
table.setPageIndex(table.getPageCount() - 1);
|
|
76
|
+
},
|
|
77
|
+
disabled: loading || !table.getCanNextPage(),
|
|
78
|
+
iconOnly: true,
|
|
79
|
+
iconRight: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
80
|
+
icon: "pagination-last",
|
|
81
|
+
"aria-hidden": "true"
|
|
82
|
+
})
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
85
|
+
PaginationArrow.displayName = "PaginationArrow";
|
|
86
|
+
export { PaginationArrow };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const paginationClasses: {
|
|
2
|
+
pagination: string;
|
|
3
|
+
divider: string;
|
|
4
|
+
group: string;
|
|
5
|
+
separator: string;
|
|
6
|
+
firstLast: string;
|
|
7
|
+
previousNext: string;
|
|
8
|
+
};
|
|
9
|
+
declare const useDataTablePaginationClasses: () => {
|
|
10
|
+
pagination: string;
|
|
11
|
+
divider: string;
|
|
12
|
+
group: string;
|
|
13
|
+
separator: string;
|
|
14
|
+
firstLast: string;
|
|
15
|
+
previousNext: string;
|
|
16
|
+
};
|
|
17
|
+
type DataTablePaginationClassesType = keyof typeof paginationClasses;
|
|
18
|
+
type DataTablePaginationClasses = Record<DataTablePaginationClassesType, string>;
|
|
19
|
+
export { paginationClasses, useDataTablePaginationClasses };
|
|
20
|
+
export type { DataTablePaginationClassesType, DataTablePaginationClasses };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { classGroup } from "@tint-ui/tools/class-group";
|
|
2
|
+
import { useClasses } from "@tint-ui/theme";
|
|
3
|
+
const {
|
|
4
|
+
base,
|
|
5
|
+
b
|
|
6
|
+
} = classGroup("data-table-pagination");
|
|
7
|
+
const paginationClasses = {
|
|
8
|
+
pagination: base,
|
|
9
|
+
divider: b("divider"),
|
|
10
|
+
group: b("group"),
|
|
11
|
+
separator: b("separator"),
|
|
12
|
+
firstLast: b("first-last"),
|
|
13
|
+
previousNext: b("previous-next")
|
|
14
|
+
};
|
|
15
|
+
const useDataTablePaginationClasses = () => useClasses("data-table-pagination", paginationClasses);
|
|
16
|
+
export { paginationClasses, useDataTablePaginationClasses };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const PaginationNumber: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
type PaginationNumberProps = React.ComponentProps<typeof PaginationNumber>;
|
|
4
|
+
export { PaginationNumber };
|
|
5
|
+
export type { PaginationNumberProps };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { Button } from "@tint-ui/button";
|
|
7
|
+
import { SvgThemeIcon } from "@tint-ui/svg-icon";
|
|
8
|
+
import { useDataTableContext } from "./context.js";
|
|
9
|
+
import { useDataTablePaginationClasses } from "./pagination-classes.js";
|
|
10
|
+
import { getPaginationNumber } from "./utils.js";
|
|
11
|
+
const PaginationNumber = /*#__PURE__*/React.forwardRef(({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}, ref) => {
|
|
15
|
+
const classes = useDataTablePaginationClasses();
|
|
16
|
+
const {
|
|
17
|
+
loading,
|
|
18
|
+
loadingTarget,
|
|
19
|
+
table,
|
|
20
|
+
lexicon,
|
|
21
|
+
navbar: {
|
|
22
|
+
size,
|
|
23
|
+
numberSize
|
|
24
|
+
}
|
|
25
|
+
} = useDataTableContext();
|
|
26
|
+
const pageNumber = table.getState().pagination.pageIndex + 1;
|
|
27
|
+
const pageCount = table.getPageCount();
|
|
28
|
+
const pages = React.useMemo(() => getPaginationNumber(pageNumber, pageCount, numberSize), [pageNumber, pageCount, numberSize]);
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
30
|
+
className: clsx(classes.group, className),
|
|
31
|
+
ref: ref
|
|
32
|
+
}), pages.map((item, index) => {
|
|
33
|
+
if (item.divider) {
|
|
34
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
className: classes.separator,
|
|
36
|
+
key: index
|
|
37
|
+
}, /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
38
|
+
icon: "dots"
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
const {
|
|
42
|
+
page
|
|
43
|
+
} = item;
|
|
44
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
45
|
+
key: index,
|
|
46
|
+
"aria-label": item.page === 1 ? lexicon.pageFirst : page === pageCount ? lexicon.pageLast : String(page),
|
|
47
|
+
variant: item.selected ? "primary" : "outline",
|
|
48
|
+
size: size,
|
|
49
|
+
onClick: () => {
|
|
50
|
+
table.setPageIndex(page - 1);
|
|
51
|
+
},
|
|
52
|
+
disabled: loading || item.selected,
|
|
53
|
+
loading: loading && loadingTarget === `pagination:${page}`,
|
|
54
|
+
iconOnly: true
|
|
55
|
+
}, page);
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
PaginationNumber.displayName = "PaginationNumber";
|
|
59
|
+
export { PaginationNumber };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Button } from "@tint-ui/button";
|
|
5
|
+
import { DropdownMenu, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuContent, DropdownMenuTrigger, DropdownMenuPortal } from "@tint-ui/dropdown-menu";
|
|
6
|
+
import { useDataTableContext } from "./context.js";
|
|
7
|
+
import { SvgThemeIcon } from "@tint-ui/svg-icon";
|
|
8
|
+
const PaginationSizeOptions = () => {
|
|
9
|
+
const {
|
|
10
|
+
loading,
|
|
11
|
+
loadingTarget,
|
|
12
|
+
navbar: {
|
|
13
|
+
pageSize,
|
|
14
|
+
pageSizeOptions,
|
|
15
|
+
size,
|
|
16
|
+
onPageSizeChange
|
|
17
|
+
}
|
|
18
|
+
} = useDataTableContext();
|
|
19
|
+
if (pageSizeOptions.length < 2) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, null, /*#__PURE__*/React.createElement(DropdownMenuTrigger, {
|
|
23
|
+
asChild: true
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
25
|
+
variant: "outline",
|
|
26
|
+
disabled: loading,
|
|
27
|
+
loading: loading && loadingTarget === "page-size",
|
|
28
|
+
size: size,
|
|
29
|
+
iconRight: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
30
|
+
icon: "selector"
|
|
31
|
+
})
|
|
32
|
+
}, pageSize)), /*#__PURE__*/React.createElement(DropdownMenuPortal, null, /*#__PURE__*/React.createElement(DropdownMenuContent, {
|
|
33
|
+
align: "end"
|
|
34
|
+
}, /*#__PURE__*/React.createElement(DropdownMenuRadioGroup, {
|
|
35
|
+
value: String(pageSize),
|
|
36
|
+
onValueChange: value => {
|
|
37
|
+
onPageSizeChange(parseInt(value));
|
|
38
|
+
}
|
|
39
|
+
}, pageSizeOptions.map(option => /*#__PURE__*/React.createElement(DropdownMenuRadioItem, {
|
|
40
|
+
key: option,
|
|
41
|
+
value: String(option)
|
|
42
|
+
}, option))))));
|
|
43
|
+
};
|
|
44
|
+
export { PaginationSizeOptions };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CellContext } from "@tanstack/react-table";
|
|
2
|
+
import type { RowMenuOption } from "./types";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
declare const rowButtonMenu: <TData>(info: CellContext<TData, unknown>, menu: RowMenuOption<TData>[]) => React.JSX.Element;
|
|
5
|
+
export { rowButtonMenu };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Button } from "@tint-ui/button";
|
|
5
|
+
import { TooltipText } from "@tint-ui/tooltip";
|
|
6
|
+
import { SvgThemeIcon } from "@tint-ui/svg-icon";
|
|
7
|
+
import { useRowMenu } from "./use-row-menu.js";
|
|
8
|
+
import { useDataTableClasses } from "./classes.js";
|
|
9
|
+
import { useDataTableContext } from "./context.js";
|
|
10
|
+
const rowButtonMenu = (info, menu) => {
|
|
11
|
+
const classes = useDataTableClasses();
|
|
12
|
+
const {
|
|
13
|
+
loading
|
|
14
|
+
} = useDataTableContext();
|
|
15
|
+
const rowHandler = useRowMenu(info);
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: classes.menuGroup
|
|
18
|
+
}, menu.map(item => {
|
|
19
|
+
const {
|
|
20
|
+
icon,
|
|
21
|
+
label,
|
|
22
|
+
id,
|
|
23
|
+
destructive
|
|
24
|
+
} = item;
|
|
25
|
+
const {
|
|
26
|
+
disabled,
|
|
27
|
+
onClick
|
|
28
|
+
} = rowHandler(item);
|
|
29
|
+
return /*#__PURE__*/React.createElement(TooltipText, {
|
|
30
|
+
key: id,
|
|
31
|
+
tooltip: label,
|
|
32
|
+
asChild: true
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
34
|
+
disabled: disabled || loading,
|
|
35
|
+
onClick: onClick,
|
|
36
|
+
iconOnly: true,
|
|
37
|
+
size: "xs",
|
|
38
|
+
variant: destructive ? "destructive" : "outline",
|
|
39
|
+
iconLeft: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
40
|
+
icon: icon || "data-table-row-menu"
|
|
41
|
+
})
|
|
42
|
+
}));
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
export { rowButtonMenu };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CellContext } from "@tanstack/react-table";
|
|
2
|
+
import type { RowMenuOption } from "./types";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
declare const rowPopoverMenu: <TData>(info: CellContext<TData, unknown>, menu: RowMenuOption<TData>[]) => React.JSX.Element;
|
|
5
|
+
export { rowPopoverMenu };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Button } from "@tint-ui/button";
|
|
5
|
+
import { SvgThemeIcon } from "@tint-ui/svg-icon";
|
|
6
|
+
import { DropdownMenu, DropdownMenuItem, DropdownMenuContent, DropdownMenuTrigger, DropdownMenuPortal } from "@tint-ui/dropdown-menu";
|
|
7
|
+
import { useRowMenu } from "./use-row-menu.js";
|
|
8
|
+
import { useDataTableContext } from "./context.js";
|
|
9
|
+
import { useDataTableClasses } from "./classes.js";
|
|
10
|
+
const rowPopoverMenu = (info, menu) => {
|
|
11
|
+
const classes = useDataTableClasses();
|
|
12
|
+
const {
|
|
13
|
+
loading
|
|
14
|
+
} = useDataTableContext();
|
|
15
|
+
const rowMenu = useRowMenu(info);
|
|
16
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, null, /*#__PURE__*/React.createElement(DropdownMenuTrigger, {
|
|
17
|
+
asChild: true
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
19
|
+
variant: "ghost",
|
|
20
|
+
disabled: loading,
|
|
21
|
+
size: "xs",
|
|
22
|
+
iconOnly: true,
|
|
23
|
+
rounded: true,
|
|
24
|
+
iconRight: /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
25
|
+
icon: "data-table-row-menu"
|
|
26
|
+
})
|
|
27
|
+
})), /*#__PURE__*/React.createElement(DropdownMenuPortal, null, /*#__PURE__*/React.createElement(DropdownMenuContent, null, menu.map(item => {
|
|
28
|
+
const {
|
|
29
|
+
icon,
|
|
30
|
+
label,
|
|
31
|
+
id,
|
|
32
|
+
destructive
|
|
33
|
+
} = item;
|
|
34
|
+
const {
|
|
35
|
+
disabled,
|
|
36
|
+
onClick
|
|
37
|
+
} = rowMenu(item);
|
|
38
|
+
return /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
39
|
+
key: id,
|
|
40
|
+
className: destructive ? classes.menuItemDestructive : undefined,
|
|
41
|
+
disabled: disabled,
|
|
42
|
+
onSelect: onClick
|
|
43
|
+
}, icon != null && /*#__PURE__*/React.createElement(SvgThemeIcon, {
|
|
44
|
+
icon: icon
|
|
45
|
+
}), label);
|
|
46
|
+
}))));
|
|
47
|
+
};
|
|
48
|
+
export { rowPopoverMenu };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tui-data-table-filter_badges{align-items:center;gap:.5rem}.tui-data-table-filter_badges [data-size=sm]{gap:.25rem}.tui-data-table-filter_badge{border-radius:calc(var(--radius) - 4px);display:inline-block;font-weight:400;max-width:120px;overflow:hidden;padding-left:.25rem;padding-right:.25rem;text-overflow:ellipsis;white-space:nowrap}.tui-data-table-filter_popover{max-width:200px;padding:0}.tui-data-table-filter{border-style:dashed}.tui-data-table-filter>.tui-data-table-filter_badge,.tui-data-table-filter>.tui-data-table-filter_badges{margin-left:.25rem;margin-right:-.5rem}.tui-data-table-filter:hover .tui-data-table-filter_badge{background-color:hsl(var(--background))}.tui-data-table-filter_mobile{display:inline-flex}@media (min-width:1024px){.tui-data-table-filter_mobile{display:none}}.tui-data-table-filter_mobile.tui-data-table-filter_badge{display:flow-root}@media (min-width:1024px){.tui-data-table-filter_mobile.tui-data-table-filter_badge{display:none}}.tui-data-table-filter_desktop{display:none}@media (min-width:1024px){.tui-data-table-filter_desktop{display:inline-flex}}.tui-data-table-filter_checkbox{align-items:center;border:1px dashed #64748b80;border-radius:calc(var(--radius) - 4px);display:inline-flex;height:1rem;justify-content:center;opacity:.5;width:1rem}.tui-data-table-filter_checkbox svg{height:1rem;visibility:hidden;width:1rem}.tui-data-table-filter_checkbox.tui-data-table-filter_selected{border-color:#0000;opacity:1}.tui-data-table-filter_checkbox.tui-data-table-filter_selected svg{visibility:visible}.tui-data-table-filter_text{width:180px}@media (min-width:1024px){.tui-data-table-filter_text{width:220px}}.tui-data-table-filter_text.tui-data-table-filter_text--mobile{width:100%}.tui-data-table-filter_icon{color:hsl(var(--muted-foreground));height:1rem;margin-right:.5rem;width:1rem}.tui-data-table-filter_label{margin-right:auto}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.badges {
|
|
2
|
+
@apply gap-2 items-center;
|
|
3
|
+
}
|
|
4
|
+
.badges [data-size=sm] {
|
|
5
|
+
@apply gap-1;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.badge {
|
|
9
|
+
@apply inline-block rounded-sm px-1 font-normal truncate max-w-[120px];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.popover {
|
|
13
|
+
@apply max-w-[200px] p-0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.button {
|
|
17
|
+
@apply border-dashed;
|
|
18
|
+
}
|
|
19
|
+
.button > .badges,
|
|
20
|
+
.button > .badge {
|
|
21
|
+
@apply ml-1 -mr-2;
|
|
22
|
+
}
|
|
23
|
+
.button:hover .badge {
|
|
24
|
+
@apply bg-background;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.mobile {
|
|
28
|
+
@apply inline-flex lg:hidden;
|
|
29
|
+
}
|
|
30
|
+
.mobile.badge {
|
|
31
|
+
@apply flow-root lg:hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.desktop {
|
|
35
|
+
@apply hidden lg:inline-flex;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.checkbox {
|
|
39
|
+
@apply inline-flex size-4 items-center justify-center rounded-sm border border-dashed border-slate-500/50 opacity-50;
|
|
40
|
+
}
|
|
41
|
+
.checkbox svg {
|
|
42
|
+
@apply size-4 invisible;
|
|
43
|
+
}
|
|
44
|
+
.checkbox.selected {
|
|
45
|
+
@apply border-transparent opacity-100;
|
|
46
|
+
}
|
|
47
|
+
.checkbox.selected svg {
|
|
48
|
+
@apply visible;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.text {
|
|
52
|
+
@apply w-[180px] lg:w-[220px];
|
|
53
|
+
}
|
|
54
|
+
.text.textMobile {
|
|
55
|
+
@apply w-full;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon {
|
|
59
|
+
@apply mr-2 h-4 w-4 text-muted-foreground;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.label {
|
|
63
|
+
@apply mr-auto;
|
|
64
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.badges {
|
|
2
|
+
@apply gap-2 items-center;
|
|
3
|
+
[data-size="sm"] {
|
|
4
|
+
@apply gap-1;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.badge {
|
|
9
|
+
@apply inline-block rounded-sm px-1 font-normal truncate max-w-[120px];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.popover {
|
|
13
|
+
@apply max-w-[200px] p-0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.button {
|
|
17
|
+
@apply border-dashed;
|
|
18
|
+
> .badges,
|
|
19
|
+
> .badge {
|
|
20
|
+
@apply ml-1 -mr-2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:hover .badge {
|
|
24
|
+
@apply bg-background;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.mobile {
|
|
29
|
+
@apply inline-flex lg:hidden;
|
|
30
|
+
&.badge {
|
|
31
|
+
@apply flow-root lg:hidden;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.desktop {
|
|
36
|
+
@apply hidden lg:inline-flex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.checkbox {
|
|
40
|
+
@apply inline-flex size-4 items-center justify-center rounded-sm border border-dashed border-slate-500/50 opacity-50;
|
|
41
|
+
svg {
|
|
42
|
+
@apply size-4 invisible;
|
|
43
|
+
}
|
|
44
|
+
&.selected {
|
|
45
|
+
@apply border-transparent opacity-100;
|
|
46
|
+
svg {
|
|
47
|
+
@apply visible;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.text {
|
|
53
|
+
@apply w-[180px] lg:w-[220px];
|
|
54
|
+
&.textMobile {
|
|
55
|
+
@apply w-full;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.icon {
|
|
60
|
+
@apply mr-2 h-4 w-4 text-muted-foreground;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.label {
|
|
64
|
+
@apply mr-auto;
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tui-data-table-pagination{align-items:center;display:flex;flex-direction:column;gap:1rem;justify-content:space-between;margin-top:.75rem;max-width:100%;width:100%}@media (min-width:640px){.tui-data-table-pagination{flex-direction:row;gap:.75rem}}.tui-data-table-pagination .tui-data-table-pagination_divider{margin-left:auto}.tui-data-table-pagination_divider{height:0;overflow:hidden;position:relative;width:0}.tui-data-table-pagination_group{align-items:center;display:flex;gap:.5rem}.tui-data-table-pagination_first-last{display:none}@media (min-width:1024px){.tui-data-table-pagination_first-last{display:inline-flex}}.tui-data-table-pagination_separator{align-items:center;color:#64748b80;display:inline-flex;height:1.25rem;justify-content:center;width:1.25rem}.tui-data-table-pagination_separator>svg{height:100%;vertical-align:top;width:100%}[data-navbar-size=sm] .tui-data-table-pagination_separator{height:1rem;width:1rem}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.pagination {
|
|
2
|
+
@apply flex max-w-full w-full flex-col items-center justify-between gap-4 sm:flex-row sm:gap-3 mt-3;
|
|
3
|
+
}
|
|
4
|
+
.pagination .divider {
|
|
5
|
+
@apply ml-auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.divider {
|
|
9
|
+
@apply relative size-0 overflow-hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.group {
|
|
13
|
+
@apply flex items-center gap-2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.firstLast {
|
|
17
|
+
@apply hidden lg:inline-flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.separator {
|
|
21
|
+
@apply inline-flex justify-center items-center size-5 text-slate-500/50;
|
|
22
|
+
}
|
|
23
|
+
.separator > svg {
|
|
24
|
+
@apply size-[100%] align-top;
|
|
25
|
+
}
|
|
26
|
+
[data-navbar-size=sm] .separator {
|
|
27
|
+
@apply size-4;
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.pagination {
|
|
2
|
+
@apply flex max-w-full w-full flex-col items-center justify-between gap-4 sm:flex-row sm:gap-3 mt-3;
|
|
3
|
+
.divider {
|
|
4
|
+
@apply ml-auto;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.divider {
|
|
9
|
+
@apply relative size-0 overflow-hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.group {
|
|
13
|
+
@apply flex items-center gap-2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.firstLast {
|
|
17
|
+
@apply hidden lg:inline-flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.previousNext {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.separator {
|
|
24
|
+
@apply inline-flex justify-center items-center size-5 text-slate-500/50;
|
|
25
|
+
> svg {
|
|
26
|
+
@apply size-[100%] align-top;
|
|
27
|
+
}
|
|
28
|
+
[data-navbar-size="sm"] & {
|
|
29
|
+
@apply size-4;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tui-data-table-toolbar{align-items:center;container-name:toolbar;container-type:inline-size;display:flex;gap:.75rem;justify-content:space-between;margin-bottom:.75rem;max-width:100%;width:100%}.tui-data-table-toolbar_heading{align-self:center;color:hsl(var(--muted-foreground));font-size:1rem;font-weight:500;line-height:1.5rem;line-height:1.25;margin-left:1.25rem}[data-size=sm] .tui-data-table-toolbar_heading{font-size:.875rem;line-height:1.25rem;line-height:1.25}.tui-data-table-toolbar--with-filter{display:grid;gap:0;grid-template-columns:min-content minmax(0,1fr) min-content min-content}.tui-data-table-toolbar--with-filter>.tui-data-table-toolbar_heading{margin-left:0;visibility:hidden;white-space:nowrap;width:0}.tui-data-table-toolbar--with-filter-group{flex-direction:column}.tui-data-table-toolbar_filters,.tui-data-table-toolbar_reset,.tui-data-table-toolbar_search{margin-right:.75rem}.tui-data-table-toolbar_filters:empty,.tui-data-table-toolbar_reset:empty,.tui-data-table-toolbar_search:empty{margin-right:0;min-width:0;width:0}.tui-data-table-toolbar_filters [data-type=slider-viewport]{margin:-.25rem}.tui-data-table-toolbar_mobile{max-width:100%;width:100%}.tui-data-table-toolbar_mobile:first-child{display:grid;grid-template-columns:minmax(0,1fr) min-content min-content}@container toolbar (max-width: 1023px){button[data-type=toolbar-button-options]{padding-left:0;padding-right:0}button[data-type=toolbar-button-options]>span{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}button[data-type=toolbar-button-options]>svg{margin-left:0!important;margin-right:0!important}}@container toolbar (max-width: 767px){button[data-type=toolbar-button-reset]{padding-left:0;padding-right:0}button[data-type=toolbar-button-reset]>span{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}button[data-type=toolbar-button-reset]>svg{margin-left:0!important;margin-right:0!important}}
|