@xanui/ui 1.1.34 → 1.1.36
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/DataFilter/index.js +3 -3
- package/package.json +10 -3
- package/Accordion/index.mjs +0 -94
- package/Accordion/index.mjs.map +0 -1
- package/Alert/index.mjs +0 -119
- package/Alert/index.mjs.map +0 -1
- package/Autocomplete/index.mjs +0 -134
- package/Autocomplete/index.mjs.map +0 -1
- package/Avatar/index.mjs +0 -48
- package/Avatar/index.mjs.map +0 -1
- package/Badge/index.mjs +0 -107
- package/Badge/index.mjs.map +0 -1
- package/Box/index.mjs +0 -12
- package/Box/index.mjs.map +0 -1
- package/Button/index.mjs +0 -92
- package/Button/index.mjs.map +0 -1
- package/ButtonGroup/index.mjs +0 -56
- package/ButtonGroup/index.mjs.map +0 -1
- package/Calendar/index.mjs +0 -172
- package/Calendar/index.mjs.map +0 -1
- package/CalendarInput/index.mjs +0 -32
- package/CalendarInput/index.mjs.map +0 -1
- package/Checkbox/index.mjs +0 -56
- package/Checkbox/index.mjs.map +0 -1
- package/Chip/index.mjs +0 -74
- package/Chip/index.mjs.map +0 -1
- package/CircleProgress/index.mjs +0 -127
- package/CircleProgress/index.mjs.map +0 -1
- package/ClickOutside/index.mjs +0 -35
- package/ClickOutside/index.mjs.map +0 -1
- package/Collaps/index.mjs +0 -24
- package/Collaps/index.mjs.map +0 -1
- package/Container/index.mjs +0 -27
- package/Container/index.mjs.map +0 -1
- package/DataFilter/index.mjs +0 -67
- package/DataFilter/index.mjs.map +0 -1
- package/DataFilter/options/DateFilter.mjs +0 -30
- package/DataFilter/options/DateFilter.mjs.map +0 -1
- package/DataFilter/options/DateRangeFilter.mjs +0 -25
- package/DataFilter/options/DateRangeFilter.mjs.map +0 -1
- package/DataFilter/options/MultiSelectFilter.mjs +0 -36
- package/DataFilter/options/MultiSelectFilter.mjs.map +0 -1
- package/DataFilter/options/NumberFilter.mjs +0 -22
- package/DataFilter/options/NumberFilter.mjs.map +0 -1
- package/DataFilter/options/NumberRangeFilter.mjs +0 -27
- package/DataFilter/options/NumberRangeFilter.mjs.map +0 -1
- package/DataFilter/options/SelectFilter.mjs +0 -32
- package/DataFilter/options/SelectFilter.mjs.map +0 -1
- package/DataFilter/options/TextFilter.mjs +0 -22
- package/DataFilter/options/TextFilter.mjs.map +0 -1
- package/Datatable/FilterBox.mjs +0 -37
- package/Datatable/FilterBox.mjs.map +0 -1
- package/Datatable/Row.mjs +0 -57
- package/Datatable/Row.mjs.map +0 -1
- package/Datatable/SelectedBox.mjs +0 -19
- package/Datatable/SelectedBox.mjs.map +0 -1
- package/Datatable/Table.mjs +0 -21
- package/Datatable/Table.mjs.map +0 -1
- package/Datatable/TableHead.mjs +0 -59
- package/Datatable/TableHead.mjs.map +0 -1
- package/Datatable/index.mjs +0 -91
- package/Datatable/index.mjs.map +0 -1
- package/Divider/index.mjs +0 -29
- package/Divider/index.mjs.map +0 -1
- package/Drawer/index.mjs +0 -76
- package/Drawer/index.mjs.map +0 -1
- package/Form/index.mjs +0 -43
- package/Form/index.mjs.map +0 -1
- package/GridContainer/index.mjs +0 -17
- package/GridContainer/index.mjs.map +0 -1
- package/GridItem/index.mjs +0 -18
- package/GridItem/index.mjs.map +0 -1
- package/IconButton/index.mjs +0 -62
- package/IconButton/index.mjs.map +0 -1
- package/Image/index.mjs +0 -25
- package/Image/index.mjs.map +0 -1
- package/Input/index.mjs +0 -142
- package/Input/index.mjs.map +0 -1
- package/InputNumber/index.mjs +0 -30
- package/InputNumber/index.mjs.map +0 -1
- package/Label/index.mjs +0 -22
- package/Label/index.mjs.map +0 -1
- package/Layer/index.mjs +0 -60
- package/Layer/index.mjs.map +0 -1
- package/LineProgress/index.mjs +0 -57
- package/LineProgress/index.mjs.map +0 -1
- package/List/ListContext.mjs +0 -8
- package/List/ListContext.mjs.map +0 -1
- package/List/index.mjs +0 -61
- package/List/index.mjs.map +0 -1
- package/ListItem/index.mjs +0 -52
- package/ListItem/index.mjs.map +0 -1
- package/LoadingBox/index.mjs +0 -30
- package/LoadingBox/index.mjs.map +0 -1
- package/Menu/index.mjs +0 -148
- package/Menu/index.mjs.map +0 -1
- package/Modal/index.mjs +0 -57
- package/Modal/index.mjs.map +0 -1
- package/NoSSR/index.mjs +0 -13
- package/NoSSR/index.mjs.map +0 -1
- package/Option/index.mjs +0 -12
- package/Option/index.mjs.map +0 -1
- package/Paper/index.mjs +0 -13
- package/Paper/index.mjs.map +0 -1
- package/Portal/index.mjs +0 -25
- package/Portal/index.mjs.map +0 -1
- package/Radio/index.mjs +0 -14
- package/Radio/index.mjs.map +0 -1
- package/Scrollbar/index.mjs +0 -57
- package/Scrollbar/index.mjs.map +0 -1
- package/Select/index.mjs +0 -57
- package/Select/index.mjs.map +0 -1
- package/Skeleton/index.mjs +0 -58
- package/Skeleton/index.mjs.map +0 -1
- package/Stack/index.mjs +0 -15
- package/Stack/index.mjs.map +0 -1
- package/Switch/index.mjs +0 -77
- package/Switch/index.mjs.map +0 -1
- package/Tab/index.mjs +0 -15
- package/Tab/index.mjs.map +0 -1
- package/Table/index.mjs +0 -86
- package/Table/index.mjs.map +0 -1
- package/TableBody/index.mjs +0 -12
- package/TableBody/index.mjs.map +0 -1
- package/TableCell/index.mjs +0 -12
- package/TableCell/index.mjs.map +0 -1
- package/TableFooter/index.mjs +0 -12
- package/TableFooter/index.mjs.map +0 -1
- package/TableHead/index.mjs +0 -12
- package/TableHead/index.mjs.map +0 -1
- package/TablePagination/index.mjs +0 -57
- package/TablePagination/index.mjs.map +0 -1
- package/TableRow/index.mjs +0 -12
- package/TableRow/index.mjs.map +0 -1
- package/Tabs/index.mjs +0 -199
- package/Tabs/index.mjs.map +0 -1
- package/Text/index.mjs +0 -23
- package/Text/index.mjs.map +0 -1
- package/Toast/index.mjs +0 -118
- package/Toast/index.mjs.map +0 -1
- package/Tooltip/index.mjs +0 -38
- package/Tooltip/index.mjs.map +0 -1
- package/ViewBox/index.mjs +0 -30
- package/ViewBox/index.mjs.map +0 -1
- package/index.mjs +0 -65
- package/index.mjs.map +0 -1
- package/useAlert/index.mjs +0 -92
- package/useAlert/index.mjs.map +0 -1
- package/useBlurCss/index.mjs +0 -17
- package/useBlurCss/index.mjs.map +0 -1
- package/useCorner/index.mjs +0 -20
- package/useCorner/index.mjs.map +0 -1
- package/useLayer/index.mjs +0 -36
- package/useLayer/index.mjs.map +0 -1
- package/useModal/index.mjs +0 -35
- package/useModal/index.mjs.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import IconButton from '../../IconButton/index.mjs';
|
|
4
|
-
import Stack from '../../Stack/index.mjs';
|
|
5
|
-
import Text from '../../Text/index.mjs';
|
|
6
|
-
import Add from '@xanui/icons/Add';
|
|
7
|
-
import ClearAll from '@xanui/icons/ClearAll';
|
|
8
|
-
import InputNumber from '../../InputNumber/index.mjs';
|
|
9
|
-
|
|
10
|
-
const NumberRangeFilter = ({ option, onChange, value }) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const isValue = value !== null && value !== undefined && Array.isArray(value) && value.length === 2;
|
|
13
|
-
return (jsxs(Stack, { width: "100%", bgcolor: "background.secondary", p: 1, radius: 1, children: [jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, mb: isValue ? .5 : 0, children: [jsx(Text, { children: option.label }), jsxs(Stack, { direction: "row", gap: 0.5, children: [jsx(IconButton, { size: "small", variant: "soft", color: "default", onClick: () => {
|
|
14
|
-
onChange([0, 0]);
|
|
15
|
-
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
16
|
-
onChange(null);
|
|
17
|
-
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: isValue && jsxs(Stack, { direction: "row", gap: 0.5, flex: 1, children: [jsx(InputNumber, { flex: 1, variant: "outline", size: "small", placeholder: "Min", value: (_a = value[0]) !== null && _a !== void 0 ? _a : '', onChange: (e) => {
|
|
18
|
-
const val = e.target.value === '' ? 0 : Number(e.target.value);
|
|
19
|
-
onChange([val, value ? value[1] : 0]);
|
|
20
|
-
} }), jsx(InputNumber, { variant: "outline", flex: 1, size: "small", placeholder: "Max", value: (_b = value[1]) !== null && _b !== void 0 ? _b : undefined, onChange: (e) => {
|
|
21
|
-
const val = e.target.value === '' ? 0 : Number(e.target.value);
|
|
22
|
-
onChange([value ? value[0] : 0, val]);
|
|
23
|
-
} })] }) })] }));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { NumberRangeFilter as default };
|
|
27
|
-
//# sourceMappingURL=NumberRangeFilter.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumberRangeFilter.mjs","sources":["../../../src/DataFilter/options/NumberRangeFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport { DataFilterSelect } from \"../types\";\r\nimport IconButton from \"../../IconButton\";\r\nimport Stack from \"../../Stack\";\r\nimport Text from \"../../Text\";\r\nimport Add from \"@xanui/icons/Add\";\r\nimport ClearAll from \"@xanui/icons/ClearAll\";\r\nimport InputNumber from \"../../InputNumber\";\r\n\r\ntype Props = {\r\n option: DataFilterSelect;\r\n value: [number, number] | null;\r\n onChange: (value: [number, number] | null) => void;\r\n}\r\n\r\nconst NumberRangeFilter = ({ option, onChange, value }: Props) => {\r\n\r\n const isValue = value !== null && value !== undefined && Array.isArray(value) && value.length === 2;\r\n\r\n return (\r\n <Stack\r\n width={\"100%\"}\r\n bgcolor=\"background.secondary\"\r\n p={1}\r\n radius={1}\r\n >\r\n <Stack\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justifyContent={\"space-between\"}\r\n gap={0.5}\r\n mb={isValue ? .5 : 0}\r\n >\r\n <Text>{option.label}</Text>\r\n <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n >\r\n <IconButton\r\n size=\"small\"\r\n variant=\"soft\"\r\n color={\"default\"}\r\n onClick={() => {\r\n onChange([0, 0]);\r\n }}\r\n >\r\n <Add />\r\n </IconButton>\r\n {\r\n isValue && <IconButton\r\n size=\"small\"\r\n variant=\"soft\"\r\n color={\"danger\"}\r\n onClick={() => {\r\n onChange(null);\r\n }}\r\n >\r\n <ClearAll />\r\n </IconButton>\r\n }\r\n </Stack>\r\n </Stack>\r\n <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n flexWrap=\"wrap\"\r\n >\r\n {\r\n isValue && <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n flex={1}\r\n >\r\n <InputNumber\r\n flex={1}\r\n variant={\"outline\"}\r\n size=\"small\"\r\n placeholder=\"Min\"\r\n value={value[0] as any ?? ''}\r\n onChange={(e) => {\r\n const val = e.target.value === '' ? 0 : Number(e.target.value);\r\n onChange([val, value ? value[1] : 0]);\r\n }}\r\n />\r\n <InputNumber\r\n variant={\"outline\"}\r\n flex={1}\r\n size=\"small\"\r\n placeholder=\"Max\"\r\n value={value[1] as any ?? undefined}\r\n onChange={(e) => {\r\n const val = e.target.value === '' ? 0 : Number(e.target.value);\r\n onChange([value ? value[0] : 0, val]);\r\n }}\r\n />\r\n </Stack>\r\n }\r\n </Stack>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default NumberRangeFilter"],"names":[],"mappings":";;;;;;;;;AAgBA;;;AAIG;AAwBkB;;;AAYA;;AA0BG;AACH;;AAUG;AACH;AAOrB;;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Menu from '../../Menu/index.mjs';
|
|
5
|
-
import List from '../../List/index.mjs';
|
|
6
|
-
import ListItem from '../../ListItem/index.mjs';
|
|
7
|
-
import Checkbox from '../../Checkbox/index.mjs';
|
|
8
|
-
import IconButton from '../../IconButton/index.mjs';
|
|
9
|
-
import Stack from '../../Stack/index.mjs';
|
|
10
|
-
import Text from '../../Text/index.mjs';
|
|
11
|
-
import Close from '@xanui/icons/Close';
|
|
12
|
-
import Add from '@xanui/icons/Add';
|
|
13
|
-
import ClearAll from '@xanui/icons/ClearAll';
|
|
14
|
-
import Chip from '../../Chip/index.mjs';
|
|
15
|
-
|
|
16
|
-
const SelectFilter = ({ option, onChange, value }) => {
|
|
17
|
-
var _a;
|
|
18
|
-
const ref = React.useRef(null);
|
|
19
|
-
const [target, setTarget] = React.useState();
|
|
20
|
-
return (jsxs(Stack, { width: "100%", bgcolor: "background.secondary", p: 1, radius: 1, children: [jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, mb: value ? .5 : 0, children: [jsx(Text, { children: option.label }), jsxs(Stack, { direction: "row", gap: 0.5, children: [jsx(IconButton, { size: "small", variant: "soft", color: "default", onClick: (e) => {
|
|
21
|
-
setTarget(e.currentTarget);
|
|
22
|
-
}, children: jsx(Add, {}) }), !!value && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
23
|
-
onChange(null);
|
|
24
|
-
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: !!value && jsx(Chip, { size: "small", color: "default", label: value, endIcon: jsx(IconButton, { size: 16, variant: "text", color: "default", onClick: () => {
|
|
25
|
-
onChange(null);
|
|
26
|
-
}, children: jsx(Close, {}) }) }) }), jsx(Menu, { target: target, onClickOutside: () => setTarget(undefined), placement: "bottom-right", children: jsx(List, { width: ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 200, size: "small", children: option.options.map((opt, index) => (jsx(ListItem, { startIcon: jsx(Checkbox, { checked: value === opt.value }), onClick: () => {
|
|
27
|
-
onChange(opt.value);
|
|
28
|
-
}, children: opt.label }, index))) }) })] }));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export { SelectFilter as default };
|
|
32
|
-
//# sourceMappingURL=SelectFilter.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectFilter.mjs","sources":["../../../src/DataFilter/options/SelectFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport React from \"react\";\r\nimport { DataFilterSelect } from \"../types\";\r\nimport Menu from \"../../Menu\";\r\nimport List from \"../../List\";\r\nimport ListItem from \"../../ListItem\";\r\nimport Checkbox from \"../../Checkbox\";\r\nimport IconButton from \"../../IconButton\";\r\nimport Stack from \"../../Stack\";\r\nimport Text from \"../../Text\";\r\nimport Close from \"@xanui/icons/Close\";\r\nimport Add from \"@xanui/icons/Add\";\r\nimport ClearAll from \"@xanui/icons/ClearAll\";\r\nimport Chip from \"../../Chip\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterSelect;\r\n value: string | null;\r\n onChange: (value: string | null) => void;\r\n}\r\n\r\nconst SelectFilter = ({ option, onChange, value }: Props) => {\r\n const ref: any = React.useRef(null)\r\n const [target, setTarget] = React.useState<HTMLElement | undefined>()\r\n return (\r\n <Stack\r\n width={\"100%\"}\r\n bgcolor=\"background.secondary\"\r\n p={1}\r\n radius={1}\r\n >\r\n <Stack\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justifyContent={\"space-between\"}\r\n gap={0.5}\r\n mb={value ? .5 : 0}\r\n >\r\n <Text>{option.label}</Text>\r\n <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n >\r\n <IconButton\r\n size=\"small\"\r\n variant=\"soft\"\r\n color={\"default\"}\r\n onClick={(e: any) => {\r\n setTarget(e.currentTarget)\r\n }}\r\n >\r\n <Add />\r\n </IconButton>\r\n {\r\n !!value && <IconButton\r\n size=\"small\"\r\n variant=\"soft\"\r\n color={\"danger\"}\r\n onClick={() => {\r\n onChange(null);\r\n }}\r\n >\r\n <ClearAll />\r\n </IconButton>\r\n }\r\n </Stack>\r\n </Stack>\r\n <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n flexWrap=\"wrap\"\r\n >\r\n {\r\n !!value && <Chip\r\n size=\"small\"\r\n color=\"default\"\r\n label={value}\r\n endIcon={<IconButton\r\n size={16}\r\n variant={\"text\"}\r\n color=\"default\"\r\n onClick={() => {\r\n onChange(null);\r\n }}\r\n >\r\n <Close />\r\n </IconButton>}\r\n />\r\n }\r\n </Stack>\r\n <Menu\r\n target={target}\r\n onClickOutside={() => setTarget(undefined)}\r\n placement={\"bottom-right\"}\r\n >\r\n <List width={ref?.current?.offsetWidth || 200} size=\"small\">\r\n {\r\n option.options.map((opt, index) => (\r\n <ListItem\r\n key={index}\r\n startIcon={<Checkbox checked={value === opt.value} />}\r\n onClick={() => {\r\n onChange(opt.value);\r\n }}\r\n >\r\n {opt.label}\r\n </ListItem>\r\n ))\r\n }\r\n </List>\r\n </Menu>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default SelectFilter"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA;;;;AAGG;AAwBkB;AACH;;AAWG;;AAuBA;AAmBM;AACH;AAUxB;;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import IconButton from '../../IconButton/index.mjs';
|
|
4
|
-
import Stack from '../../Stack/index.mjs';
|
|
5
|
-
import Text from '../../Text/index.mjs';
|
|
6
|
-
import Add from '@xanui/icons/Add';
|
|
7
|
-
import ClearAll from '@xanui/icons/ClearAll';
|
|
8
|
-
import Input from '../../Input/index.mjs';
|
|
9
|
-
|
|
10
|
-
const TextFilter = ({ option, onChange, value }) => {
|
|
11
|
-
const isValue = value !== null && value !== undefined;
|
|
12
|
-
return (jsxs(Stack, { width: "100%", bgcolor: "background.secondary", p: 1, radius: 1, children: [jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, mb: isValue ? .5 : 0, children: [jsx(Text, { children: option.label }), jsxs(Stack, { direction: "row", gap: 0.5, children: [jsx(IconButton, { size: "small", variant: "soft", color: "default", onClick: () => {
|
|
13
|
-
onChange('');
|
|
14
|
-
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
15
|
-
onChange(null);
|
|
16
|
-
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: isValue && jsx(Input, { variant: "outline", value: value.toString(), onChange: (e) => {
|
|
17
|
-
onChange(e.target.value);
|
|
18
|
-
}, fullWidth: true }) })] }));
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { TextFilter as default };
|
|
22
|
-
//# sourceMappingURL=TextFilter.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextFilter.mjs","sources":["../../../src/DataFilter/options/TextFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport { DataFilterSelect } from \"../types\";\r\nimport IconButton from \"../../IconButton\";\r\nimport Stack from \"../../Stack\";\r\nimport Text from \"../../Text\";\r\nimport Add from \"@xanui/icons/Add\";\r\nimport ClearAll from \"@xanui/icons/ClearAll\";\r\nimport Input from \"../../Input\";\r\n\r\ntype Props = {\r\n option: DataFilterSelect;\r\n value: string | null;\r\n onChange: (value: string | null) => void;\r\n}\r\n\r\nconst TextFilter = ({ option, onChange, value }: Props) => {\r\n\r\n const isValue = value !== null && value !== undefined;\r\n\r\n return (\r\n <Stack\r\n width={\"100%\"}\r\n bgcolor=\"background.secondary\"\r\n p={1}\r\n radius={1}\r\n >\r\n <Stack\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justifyContent={\"space-between\"}\r\n gap={0.5}\r\n mb={isValue ? .5 : 0}\r\n >\r\n <Text>{option.label}</Text>\r\n <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n >\r\n <IconButton\r\n size=\"small\"\r\n variant=\"soft\"\r\n color={\"default\"}\r\n onClick={() => {\r\n onChange('');\r\n }}\r\n >\r\n <Add />\r\n </IconButton>\r\n {\r\n isValue && <IconButton\r\n size=\"small\"\r\n variant=\"soft\"\r\n color={\"danger\"}\r\n onClick={() => {\r\n onChange(null);\r\n }}\r\n >\r\n <ClearAll />\r\n </IconButton>\r\n }\r\n </Stack>\r\n </Stack>\r\n <Stack\r\n direction=\"row\"\r\n gap={0.5}\r\n flexWrap=\"wrap\"\r\n >\r\n {\r\n isValue && <Input\r\n variant={\"outline\"}\r\n value={value.toString()}\r\n onChange={(e: any) => {\r\n onChange(e.target.value);\r\n }}\r\n fullWidth\r\n />\r\n }\r\n </Stack>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default TextFilter"],"names":[],"mappings":";;;;;;;;;AAgBA;;AAIG;;;;;AAqDkB;AACH;AAOlB;;"}
|
package/Datatable/FilterBox.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import Stack from '../Stack/index.mjs';
|
|
4
|
-
import Tabs from '../Tabs/index.mjs';
|
|
5
|
-
import Tab from '../Tab/index.mjs';
|
|
6
|
-
import Input from '../Input/index.mjs';
|
|
7
|
-
import IconSearch from '@xanui/icons/Search';
|
|
8
|
-
import IconButton from '../IconButton/index.mjs';
|
|
9
|
-
import FilterListOutlined from '@xanui/icons/FilterListOutlined';
|
|
10
|
-
import Drawer from '../Drawer/index.mjs';
|
|
11
|
-
import Text from '../Text/index.mjs';
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import CloseOutlined from '@xanui/icons/CloseOutlined';
|
|
14
|
-
import ViewBox from '../ViewBox/index.mjs';
|
|
15
|
-
import DataFilter from '../DataFilter/index.mjs';
|
|
16
|
-
|
|
17
|
-
const FilterBox = (props) => {
|
|
18
|
-
let { tabs, filters, hideSearch, slotProps, skeleton, state, update, } = props;
|
|
19
|
-
const [openFilter, setOpenFilter] = React.useState(false);
|
|
20
|
-
let checked = state.selectAll || !!state.selected.length;
|
|
21
|
-
if (checked)
|
|
22
|
-
return jsx(Fragment, {});
|
|
23
|
-
return (jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", zIndex: 1, radius: 1, mb: 1, height: 50, width: "100%", children: [jsx(Stack, { gap: 2.4, flexRow: true, children: tabs && jsx(Tabs, { disabled: skeleton ? true : false, onChange: (value) => {
|
|
24
|
-
update({ tab: value });
|
|
25
|
-
}, value: state.tab, children: tabs.map(t => jsx(Tab, { value: t.value || t.label.toLowerCase(), children: t.label }, t.label)) }) }), jsxs(Stack, { flexRow: true, gap: 2, className: 'datatable-header-right-area', alignItems: "center", children: [!hideSearch && jsx(Input, Object.assign({ disabled: skeleton ? true : false, endIcon: jsx(IconSearch, {}), placeholder: 'Search...' }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.search, { value: state.search, onChange: (e) => {
|
|
26
|
-
update({ search: e.target.value });
|
|
27
|
-
} })), filters && jsxs(Stack, { children: [jsx(IconButton, { color: "default", variant: "text", onClick: () => {
|
|
28
|
-
setOpenFilter(true);
|
|
29
|
-
}, children: jsx(FilterListOutlined, {}) }), jsx(Drawer, { open: openFilter, onClickOutside: () => { }, placement: "right", children: jsx(ViewBox, { height: "100%", p: 1, startContent: jsxs(Stack, { mb: 2, px: 2, flexRow: true, justifyContent: "space-between", alignItems: "center", children: [jsx(Text, { fontWeight: 600, fontSize: "h6", children: "Filters" }), jsx(IconButton, { size: "small", color: "default", variant: "text", onClick: () => {
|
|
30
|
-
setOpenFilter(false);
|
|
31
|
-
}, children: jsx(CloseOutlined, {}) })] }), children: jsx(Stack, { gap: 2, children: jsx(DataFilter, { options: filters, value: state.filters, onChange: (s) => {
|
|
32
|
-
update({ filters: s });
|
|
33
|
-
} }) }) }) })] })] })] }));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { FilterBox as default };
|
|
37
|
-
//# sourceMappingURL=FilterBox.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBox.mjs","sources":["../../src/Datatable/FilterBox.tsx"],"sourcesContent":["\"use client\";\r\nimport Stack from '../Stack'\r\nimport Tabs from '../Tabs'\r\nimport Tab from '../Tab'\r\nimport Input from '../Input'\r\nimport IconSearch from '@xanui/icons/Search'\r\nimport { DatatablePropsWithState } from './types';\r\nimport IconButton from '../IconButton';\r\nimport FilterListOutlined from '@xanui/icons/FilterListOutlined';\r\nimport Drawer from '../Drawer';\r\nimport Text from '../Text';\r\nimport React from 'react';\r\nimport CloseOutlined from '@xanui/icons/CloseOutlined';\r\nimport ViewBox from '../ViewBox';\r\nimport DataFilter from '../DataFilter';\r\n\r\nconst FilterBox = (props: DatatablePropsWithState) => {\r\n let {\r\n tabs,\r\n filters,\r\n hideSearch,\r\n slotProps,\r\n skeleton,\r\n state,\r\n update,\r\n } = props\r\n const [openFilter, setOpenFilter] = React.useState(false)\r\n let checked = state.selectAll || !!state.selected.length\r\n\r\n if (checked) return <></>\r\n\r\n return (\r\n <Stack\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justifyContent=\"space-between\"\r\n zIndex={1}\r\n radius={1}\r\n mb={1}\r\n height={50}\r\n width=\"100%\"\r\n >\r\n <Stack gap={2.4} flexRow>\r\n {\r\n tabs && <Tabs\r\n disabled={skeleton ? true : false}\r\n onChange={(value: any) => {\r\n update({ tab: value })\r\n }}\r\n value={state.tab}\r\n >\r\n {\r\n tabs.map(t => <Tab key={t.label} value={t.value || t.label.toLowerCase()}>{t.label}</Tab>)\r\n }\r\n </Tabs>\r\n }\r\n </Stack>\r\n <Stack\r\n flexRow\r\n gap={2}\r\n className='datatable-header-right-area'\r\n alignItems={\"center\"}\r\n >\r\n {!hideSearch && <Input\r\n disabled={skeleton ? true : false}\r\n endIcon={<IconSearch />}\r\n placeholder='Search...'\r\n {...slotProps?.search}\r\n value={state.search}\r\n onChange={(e: any) => {\r\n update({ search: e.target.value })\r\n }}\r\n />}\r\n {\r\n filters && <Stack>\r\n <IconButton\r\n color=\"default\"\r\n variant={\"text\"}\r\n onClick={() => {\r\n setOpenFilter(true)\r\n }}\r\n >\r\n <FilterListOutlined />\r\n </IconButton>\r\n <Drawer\r\n open={openFilter}\r\n onClickOutside={() => { }}\r\n placement={\"right\"}\r\n >\r\n <ViewBox\r\n height=\"100%\"\r\n p={1}\r\n startContent={<Stack mb={2} px={2} flexRow justifyContent={\"space-between\"} alignItems=\"center\">\r\n <Text fontWeight={600} fontSize=\"h6\">Filters</Text>\r\n <IconButton\r\n size=\"small\"\r\n color=\"default\"\r\n variant=\"text\"\r\n onClick={() => {\r\n setOpenFilter(false)\r\n }}\r\n >\r\n <CloseOutlined />\r\n </IconButton>\r\n </Stack>}\r\n >\r\n <Stack\r\n gap={2}\r\n >\r\n <DataFilter\r\n options={filters}\r\n value={state.filters}\r\n onChange={(s) => {\r\n update({ filters: s })\r\n }}\r\n />\r\n </Stack>\r\n </ViewBox>\r\n </Drawer>\r\n </Stack>\r\n }\r\n </Stack>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default FilterBox"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBA;AACG;AASA;AACA;AAEA;AAAa;AAEb;AAgBkB;;;;;AAiCA;;AAoBS;AAaG;;AAWjC;;"}
|
package/Datatable/Row.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import TableRow from '../TableRow/index.mjs';
|
|
6
|
-
import TableCell from '../TableCell/index.mjs';
|
|
7
|
-
import Checkbox from '../Checkbox/index.mjs';
|
|
8
|
-
import IconButton from '../IconButton/index.mjs';
|
|
9
|
-
import List from '../List/index.mjs';
|
|
10
|
-
import ListItem from '../ListItem/index.mjs';
|
|
11
|
-
import ActionIcon from '@xanui/icons/MoreVert';
|
|
12
|
-
import Menu from '../Menu/index.mjs';
|
|
13
|
-
|
|
14
|
-
const Row = ({ rows, rawRow, row, rowAction, disableRow, hideCheckbox, columns, compact, state, update }) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const selected = row.id ? state.selected.includes(row === null || row === void 0 ? void 0 : row.id) : false;
|
|
17
|
-
let selectedColor = selected ? "primary.soft" : "transparent";
|
|
18
|
-
const [target, setTarget] = useState();
|
|
19
|
-
const isDisable = (disableRow ? disableRow(rawRow, state) : false) || false;
|
|
20
|
-
return (jsxs(TableRow, { children: [!hideCheckbox && jsx(TableCell, { width: 40, bgcolor: selectedColor, children: !!row.id && jsx(Checkbox, { size: compact ? "small" : "medium", checked: selected, onChange: () => {
|
|
21
|
-
if (isDisable || !row.id)
|
|
22
|
-
return;
|
|
23
|
-
let ids = [...state.selected];
|
|
24
|
-
ids.includes(row.id) ? ids.splice(ids.indexOf(row.id), 1) : ids.push(row.id);
|
|
25
|
-
let selectedLength = 0;
|
|
26
|
-
rows.forEach(r => {
|
|
27
|
-
const isDisable = (disableRow ? disableRow(r, state) : false) || false;
|
|
28
|
-
if (!isDisable)
|
|
29
|
-
selectedLength++;
|
|
30
|
-
});
|
|
31
|
-
update({
|
|
32
|
-
selectAll: selectedLength === ids.length,
|
|
33
|
-
selected: ids
|
|
34
|
-
});
|
|
35
|
-
} }) }), columns.map((_a, idx) => {
|
|
36
|
-
var { label, field, sortable } = _a, rest = __rest(_a, ["label", "field", "sortable"]);
|
|
37
|
-
field = field || label;
|
|
38
|
-
if (!row[field])
|
|
39
|
-
return jsx(TableCell, {}, idx);
|
|
40
|
-
return (jsx(TableCell, Object.assign({ textAlign: "left" }, rest, { bgcolor: selectedColor, children: row[field] }), idx));
|
|
41
|
-
}), !!(rows.length && rowAction && ((_a = rowAction(rows[0])) === null || _a === void 0 ? void 0 : _a.length)) && jsxs(TableCell, { width: 30, bgcolor: selectedColor, borderColor: "divider", children: [jsx(IconButton, { disabled: isDisable || selected, onClick: (e) => setTarget(e.currentTarget), variant: "text", color: "default", children: jsx(ActionIcon, {}) }), jsx(Menu, { target: target, placement: "bottom-right", onClickOutside: () => setTarget(null), children: jsx(List, { bgcolor: "background.primary", minWidth: 160, sx: {
|
|
42
|
-
'& > li': {
|
|
43
|
-
borderBottom: 1,
|
|
44
|
-
'&:last-child': {
|
|
45
|
-
borderBottom: 0
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, children: rowAction({ row, state }).map(({ label, icon, onClick }) => {
|
|
49
|
-
return (jsx(ListItem, { startIcon: icon, onClick: (e) => {
|
|
50
|
-
onClick && onClick(e);
|
|
51
|
-
setTarget(null);
|
|
52
|
-
}, children: label }, label));
|
|
53
|
-
}) }) })] })] }));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { Row as default };
|
|
57
|
-
//# sourceMappingURL=Row.mjs.map
|
package/Datatable/Row.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Row.mjs","sources":["../../src/Datatable/Row.tsx"],"sourcesContent":["\"use client\";\r\nimport { useState } from 'react'\r\nimport TableRow from '../TableRow'\r\nimport TableCell from '../TableCell'\r\nimport Checkbox from '../Checkbox'\r\nimport IconButton from '../IconButton'\r\nimport List from '../List'\r\nimport ListItem from '../ListItem'\r\nimport ActionIcon from '@xanui/icons/MoreVert'\r\nimport Menu from '../Menu'\r\nimport { DataTableDefaultRow, DatatablePropsWithState } from './types';\r\n\r\n\r\ntype Props = DatatablePropsWithState & {\r\n rawRow: DataTableDefaultRow;\r\n row: DataTableDefaultRow;\r\n}\r\n\r\nconst Row = ({ rows, rawRow, row, rowAction, disableRow, hideCheckbox, columns, compact, state, update }: Props) => {\r\n const selected = row.id ? state.selected.includes(row?.id) : false\r\n let selectedColor = selected ? \"primary.soft\" : \"transparent\"\r\n const [target, setTarget] = useState<any>()\r\n const isDisable = (disableRow ? disableRow(rawRow, state) : false) || false\r\n\r\n return (\r\n <TableRow >\r\n {!hideCheckbox && <TableCell width={40} bgcolor={selectedColor}>\r\n {\r\n !!row.id && <Checkbox\r\n size={compact ? \"small\" : \"medium\"}\r\n checked={selected}\r\n onChange={() => {\r\n if (isDisable || !row.id) return\r\n let ids = [...state.selected]\r\n ids.includes(row.id) ? ids.splice(ids.indexOf(row.id), 1) : ids.push(row.id)\r\n let selectedLength = 0\r\n rows.forEach(r => {\r\n const isDisable = (disableRow ? disableRow(r, state) : false) || false\r\n if (!isDisable) selectedLength++\r\n })\r\n\r\n update({\r\n selectAll: selectedLength === ids.length,\r\n selected: ids\r\n })\r\n }}\r\n />\r\n }\r\n\r\n </TableCell>}\r\n {\r\n columns.map(({ label, field, sortable, ...rest }, idx) => {\r\n field = field || label\r\n if (!row[field]) return <TableCell key={idx}></TableCell>\r\n return (\r\n <TableCell\r\n key={idx}\r\n textAlign=\"left\"\r\n {...rest}\r\n bgcolor={selectedColor}\r\n >\r\n {row[field]}\r\n </TableCell>\r\n )\r\n })\r\n }\r\n {!!(rows.length && rowAction && rowAction((rows as any)[0])?.length) && <TableCell width={30} bgcolor={selectedColor} borderColor=\"divider\">\r\n <IconButton\r\n disabled={isDisable || selected}\r\n onClick={(e: any) => setTarget(e.currentTarget)}\r\n variant=\"text\"\r\n color=\"default\"\r\n >\r\n <ActionIcon />\r\n </IconButton>\r\n <Menu target={target} placement=\"bottom-right\" onClickOutside={() => setTarget(null)}>\r\n <List\r\n bgcolor=\"background.primary\"\r\n minWidth={160}\r\n sx={{\r\n '& > li': {\r\n borderBottom: 1,\r\n '&:last-child': {\r\n borderBottom: 0\r\n }\r\n }\r\n }}\r\n >\r\n {rowAction({ row, state }).map(({ label, icon, onClick }) => {\r\n return (\r\n <ListItem\r\n key={label}\r\n startIcon={icon}\r\n onClick={(e: any) => {\r\n onClick && onClick(e)\r\n setTarget(null)\r\n }}\r\n >{label}</ListItem>\r\n )\r\n })}\r\n </List>\r\n </Menu>\r\n </TableCell>\r\n }\r\n </TableRow>\r\n )\r\n}\r\n\r\nexport default Row"],"names":[],"mappings":";;;;;;;;;;;;;AAkBA;;;;;;;AAc4B;;;AAEA;;AAEA;;AAEI;AAAgB;AACpB;AAEA;AACI;AACA;AACH;AACL;;AAOJ;AACA;AAAiB;;;AA2BT;AACI;AACA;AACI;AACH;AACJ;;AAID;AAKY;;AAEJ;AAGZ;AAOxB;;"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { __rest } from 'tslib';
|
|
2
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import IconButton from '../IconButton/index.mjs';
|
|
4
|
-
import Stack from '../Stack/index.mjs';
|
|
5
|
-
import Text from '../Text/index.mjs';
|
|
6
|
-
|
|
7
|
-
const SelectedBox = (props) => {
|
|
8
|
-
let { state, rowAction } = props;
|
|
9
|
-
let checked = state.selectAll || !!state.selected.length;
|
|
10
|
-
if (!checked)
|
|
11
|
-
return jsx(Fragment, {});
|
|
12
|
-
return (jsxs(Stack, { bgcolor: "background.secondary", direction: "row", alignItems: "center", justifyContent: "space-between", zIndex: 1, radius: 1, mb: 1, height: 50, width: "100%", px: 1.5, children: [jsxs(Text, { fontWeight: 600, children: ["Selected: ", state.selected.length] }), jsx(Stack, { flexRow: true, gap: 1, children: rowAction && rowAction({ row: null, state }).map((_a) => {
|
|
13
|
-
var { label, icon } = _a, bprops = __rest(_a, ["label", "icon"]);
|
|
14
|
-
return (jsx(IconButton, Object.assign({ variant: "soft", color: "brand" }, bprops, { children: icon }), label));
|
|
15
|
-
}) })] }));
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { SelectedBox as default };
|
|
19
|
-
//# sourceMappingURL=SelectedBox.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectedBox.mjs","sources":["../../src/Datatable/SelectedBox.tsx"],"sourcesContent":["import IconButton from '../IconButton'\r\nimport Stack from '../Stack'\r\nimport Text from '../Text'\r\nimport { DatatablePropsWithState } from './types'\r\n\r\nconst SelectedBox = (props: DatatablePropsWithState) => {\r\n let {\r\n state,\r\n rowAction\r\n } = props\r\n\r\n let checked = state.selectAll || !!state.selected.length\r\n if (!checked) return <></>\r\n\r\n return (\r\n <Stack\r\n bgcolor=\"background.secondary\"\r\n direction=\"row\"\r\n alignItems=\"center\"\r\n justifyContent=\"space-between\"\r\n zIndex={1}\r\n radius={1}\r\n mb={1}\r\n height={50}\r\n width=\"100%\"\r\n px={1.5}\r\n >\r\n <Text fontWeight={600}>Selected: {state.selected.length}</Text>\r\n <Stack\r\n flexRow\r\n gap={1}\r\n >\r\n {rowAction && rowAction({ row: null, state }).map(({ label, icon, ...bprops }) => {\r\n return (\r\n <IconButton\r\n key={label}\r\n variant=\"soft\"\r\n color=\"brand\"\r\n {...bprops}\r\n >\r\n {icon}\r\n </IconButton>\r\n )\r\n })}\r\n </Stack>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default SelectedBox"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAKA,MAAM,WAAW,GAAG,CAAC,KAA8B,KAAI;AACpD,IAAA,IAAI,EACD,KAAK,EACL,SAAS,EACX,GAAG,KAAK;AAET,IAAA,IAAI,OAAO,GAAG,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;AACxD,IAAA,IAAI,CAAC,OAAO;AAAE,QAAA,OAAOA,iBAAK;AAE1B,IAAA,QACGC,IAAA,CAAC,KAAK,IACH,OAAO,EAAC,sBAAsB,EAC9B,SAAS,EAAC,KAAK,EACf,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,eAAe,EAC9B,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,CAAC,EACL,MAAM,EAAE,EAAE,EACV,KAAK,EAAC,MAAM,EACZ,EAAE,EAAE,GAAG,EAAA,QAAA,EAAA,CAEPA,KAAC,IAAI,EAAA,EAAC,UAAU,EAAE,GAAG,2BAAa,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAA,EAAA,CAAQ,EAC/DD,IAAC,KAAK,EAAA,EACH,OAAO,EAAA,IAAA,EACP,GAAG,EAAE,CAAC,YAEL,SAAS,IAAI,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAA0B,KAAI;wBAA9B,EAAE,KAAK,EAAE,IAAI,EAAA,GAAA,EAAa,EAAR,MAAM,GAAA,MAAA,CAAA,EAAA,EAAxB,iBAA0B,CAAF;AACxE,oBAAA,QACGA,GAAA,CAAC,UAAU,kBAER,OAAO,EAAC,MAAM,EACd,KAAK,EAAC,OAAO,EAAA,EACT,MAAM,EAAA,EAAA,QAAA,EAET,IAAI,KALA,KAAK,CAMA;AAEnB,gBAAA,CAAC,CAAC,EAAA,CACG,CAAA,EAAA,CACH;AAEd;;;;"}
|
package/Datatable/Table.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import TableHeadRender from './TableHead.mjs';
|
|
4
|
-
import Table from '../Table/index.mjs';
|
|
5
|
-
import TableBody from '../TableBody/index.mjs';
|
|
6
|
-
import Row from './Row.mjs';
|
|
7
|
-
|
|
8
|
-
const TableArea = (props) => {
|
|
9
|
-
let { rows, compact, renderRow, state, update, slotProps } = props;
|
|
10
|
-
return (jsxs(Table, Object.assign({ width: "100%", size: compact ? "small" : "medium", border: "1px solid", borderColor: "divider" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.table, { children: [jsx(TableHeadRender, Object.assign({}, props, { update: update, state: state })), jsx(TableBody, { sx: {
|
|
11
|
-
'& tr:last-child td': {
|
|
12
|
-
borderBottom: 0
|
|
13
|
-
}
|
|
14
|
-
}, children: rows === null || rows === void 0 ? void 0 : rows.map((row, idx) => {
|
|
15
|
-
let _row = renderRow ? renderRow(Object.assign({}, row), state) : row;
|
|
16
|
-
return jsx(Row, Object.assign({ rawRow: row, row: _row }, props, { update: update, state: state }), `dt-row-${row.id}-${idx}`);
|
|
17
|
-
}) })] })));
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { TableArea as default };
|
|
21
|
-
//# sourceMappingURL=Table.mjs.map
|
package/Datatable/Table.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.mjs","sources":["../../src/Datatable/Table.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport TableHead from './TableHead'\r\nimport Table from '../Table'\r\nimport TableBody from '../TableBody'\r\nimport Row from './Row'\r\nimport { DatatablePropsWithState } from './types';\r\n\r\nconst TableArea = (props: DatatablePropsWithState) => {\r\n let {\r\n rows,\r\n compact,\r\n renderRow,\r\n state,\r\n update,\r\n slotProps\r\n } = props\r\n\r\n return (\r\n <Table width=\"100%\" size={compact ? \"small\" : \"medium\"} border=\"1px solid\" borderColor=\"divider\" {...slotProps?.table}>\r\n <TableHead {...props} update={update} state={state} />\r\n <TableBody\r\n sx={{\r\n '& tr:last-child td': {\r\n borderBottom: 0\r\n }\r\n }}\r\n >\r\n {\r\n rows?.map((row: any, idx) => {\r\n let _row = renderRow ? renderRow({ ...row }, state) : row\r\n return <Row\r\n key={`dt-row-${row.id}-${idx}`}\r\n rawRow={row}\r\n row={_row}\r\n {...props}\r\n update={update}\r\n state={state}\r\n />\r\n })\r\n }\r\n </TableBody>\r\n </Table>\r\n )\r\n}\r\n\r\nexport default TableArea"],"names":[],"mappings":";;;;;;;AAQA;AACG;;AAcY;AACG;AACF;AACH;AAIK;AACA;AAQH;AAKf;;"}
|
package/Datatable/TableHead.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import TableHead from '../TableHead/index.mjs';
|
|
5
|
-
import TableRow from '../TableRow/index.mjs';
|
|
6
|
-
import TableCell from '../TableCell/index.mjs';
|
|
7
|
-
import Checkbox from '../Checkbox/index.mjs';
|
|
8
|
-
import IndeterminateCheckBoxIcon from '@xanui/icons/IndeterminateCheckBox';
|
|
9
|
-
import Stack from '../Stack/index.mjs';
|
|
10
|
-
import ArrowDropDown from '@xanui/icons/ArrowDropDown';
|
|
11
|
-
import ArrowDropUp from '@xanui/icons/ArrowDropUp';
|
|
12
|
-
import Text from '../Text/index.mjs';
|
|
13
|
-
|
|
14
|
-
const TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, compact, skeleton, state, update }) => {
|
|
15
|
-
var _a;
|
|
16
|
-
if (!columns.length)
|
|
17
|
-
return jsx(Fragment, {});
|
|
18
|
-
let checked = state.selectAll || !!state.selected.length;
|
|
19
|
-
const sortables = state.sortable || {};
|
|
20
|
-
return (jsx(TableHead, { position: "relative", children: jsxs(TableRow, { bgcolor: "default", borderBottom: 1, children: [!hideCheckbox && jsx(TableCell, { th: true, width: 40, children: jsx(Checkbox, { size: compact ? "small" : "medium", checkIcon: state.selected.length && !state.selectAll ? jsx(IndeterminateCheckBoxIcon, {}) : undefined, checked: checked, onChange: () => {
|
|
21
|
-
let ids = [];
|
|
22
|
-
let undefinedCount = 0;
|
|
23
|
-
for (let i = 0; i < rows.length; i++) {
|
|
24
|
-
const row = rows[i];
|
|
25
|
-
const isDisable = (disableRow ? disableRow(row, state) : false) || false;
|
|
26
|
-
if (!isDisable && row.id) {
|
|
27
|
-
ids.push(row.id);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
undefinedCount += 1;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (undefinedCount) {
|
|
34
|
-
update({
|
|
35
|
-
selected: state.selected.length ? [] : ids,
|
|
36
|
-
selectAll: !state.selected.length
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
update({
|
|
41
|
-
selected: state.selectAll ? [] : ids,
|
|
42
|
-
selectAll: !state.selectAll
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
} }) }), columns.map((_a, idx) => {
|
|
46
|
-
var { label, field: _f, sortable } = _a, rest = __rest(_a, ["label", "field", "sortable"]);
|
|
47
|
-
return jsx(TableCell, Object.assign({ th: true, textAlign: "left" }, rest, { children: jsxs(Stack, { disabled: skeleton ? true : false, flexRow: true, alignItems: "center", cursor: sortable ? "pointer" : "default", userSelect: "none", onClick: () => {
|
|
48
|
-
if (sortable) {
|
|
49
|
-
let newSort = sortables[_f] === 'asc' ? 'desc' : 'asc';
|
|
50
|
-
update({
|
|
51
|
-
sortable: Object.assign(Object.assign({}, sortables), { [_f]: newSort })
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}, children: [jsx(Text, { color: "text.secondary", children: label }), sortable && jsx(Fragment, { children: sortables[_f] === 'asc' ? jsx(ArrowDropDown, {}) : jsx(ArrowDropUp, {}) })] }) }), idx);
|
|
55
|
-
}), !!(rows.length && rowAction && ((_a = rowAction(rows[0])) === null || _a === void 0 ? void 0 : _a.length)) && jsx(TableCell, { th: true, width: 30 })] }) }));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export { TableHeadRender as default };
|
|
59
|
-
//# sourceMappingURL=TableHead.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TableHead.mjs","sources":["../../src/Datatable/TableHead.tsx"],"sourcesContent":["\"use client\";\r\nimport TableHead from '../TableHead'\r\nimport TableRow from '../TableRow'\r\nimport TableCell from '../TableCell'\r\nimport Checkbox from '../Checkbox'\r\nimport IntermidiatIcon from '@xanui/icons/IndeterminateCheckBox'\r\nimport { DatatablePropsWithState } from './types';\r\nimport Stack from '../Stack';\r\nimport ArrowDropDown from '@xanui/icons/ArrowDropDown';\r\nimport ArrowDropUp from '@xanui/icons/ArrowDropUp';\r\nimport Text from '../Text';\r\n\r\n\r\nconst TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, compact, skeleton, state, update }: DatatablePropsWithState) => {\r\n if (!columns.length) return <></>\r\n let checked = state.selectAll || !!state.selected.length\r\n const sortables = state.sortable || {}\r\n\r\n return (\r\n <TableHead position=\"relative\">\r\n <TableRow bgcolor=\"default\" borderBottom={1} >\r\n {!hideCheckbox && <TableCell th width={40}>\r\n <Checkbox\r\n size={compact ? \"small\" : \"medium\"}\r\n checkIcon={state.selected.length && !state.selectAll ? <IntermidiatIcon /> : undefined}\r\n checked={checked}\r\n onChange={() => {\r\n let ids: any = []\r\n let undefinedCount = 0\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i]\r\n const isDisable = (disableRow ? disableRow(row, state) : false) || false\r\n if (!isDisable && row.id) {\r\n ids.push(row.id)\r\n } else {\r\n undefinedCount += 1\r\n }\r\n }\r\n\r\n if (undefinedCount) {\r\n update({\r\n selected: state.selected.length ? [] : ids,\r\n selectAll: !state.selected.length\r\n })\r\n } else {\r\n update({\r\n selected: state.selectAll ? [] : ids,\r\n selectAll: !state.selectAll\r\n })\r\n }\r\n }}\r\n />\r\n </TableCell>}\r\n {\r\n columns.map(({ label, field: _f, sortable, ...rest }, idx) => <TableCell\r\n key={idx}\r\n th\r\n textAlign=\"left\"\r\n {...rest}\r\n >\r\n <Stack\r\n disabled={skeleton ? true : false}\r\n flexRow\r\n alignItems=\"center\"\r\n cursor={sortable ? \"pointer\" : \"default\"}\r\n userSelect={\"none\"}\r\n onClick={() => {\r\n\r\n if (sortable) {\r\n let newSort: any = sortables[_f as any] === 'asc' ? 'desc' : 'asc'\r\n update({\r\n sortable: {\r\n ...sortables,\r\n [_f as any]: newSort\r\n }\r\n })\r\n }\r\n }}\r\n >\r\n <Text color=\"text.secondary\">{label}</Text>\r\n {sortable && <>\r\n {\r\n sortables[_f as any] === 'asc' ? <ArrowDropDown /> : <ArrowDropUp />\r\n }\r\n </>}\r\n </Stack>\r\n </TableCell>)\r\n }\r\n {\r\n !!(rows.length && rowAction && rowAction((rows as any)[0])?.length) && <TableCell th width={30} />\r\n }\r\n </TableRow>\r\n </TableHead>\r\n )\r\n}\r\n\r\nexport default TableHeadRender\r\n"],"names":[],"mappings":";;;;;;;;;;;;;AAaA;;;AACyB;AACrB;AACA;AAEA;;;AAWwB;AACI;;AAEA;AACI;;;;;;;AAOJ;AACI;AACA;AACH;;;AAED;;AAEI;AACH;;AAET;AAIS;;;AAeG;AACA;;AAKC;;AAET;AASI;AAQhC;;"}
|
package/Datatable/index.mjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import React, { useMemo, useState, useEffect } from 'react';
|
|
5
|
-
import ViewBox from '../ViewBox/index.mjs';
|
|
6
|
-
import { useInterface, Tag } from '@xanui/core';
|
|
7
|
-
import SelectedBox from './SelectedBox.mjs';
|
|
8
|
-
import TableArea from './Table.mjs';
|
|
9
|
-
import FilterBox from './FilterBox.mjs';
|
|
10
|
-
import TablePagination from '../TablePagination/index.mjs';
|
|
11
|
-
import Stack from '../Stack/index.mjs';
|
|
12
|
-
import Skeleton from '../Skeleton/index.mjs';
|
|
13
|
-
|
|
14
|
-
const DataTable = React.forwardRef((props, ref) => {
|
|
15
|
-
let [p] = useInterface("Datatable", props, {});
|
|
16
|
-
let _props = useMemo(() => {
|
|
17
|
-
let np = Object.assign({}, p);
|
|
18
|
-
if (typeof np.skeleton === 'number' || np.skeleton === true) {
|
|
19
|
-
const limit = np.perpages && np.perpages.length > 0 ? np.perpages[0] : 10;
|
|
20
|
-
let length = np.skeleton === true ? limit : np.skeleton;
|
|
21
|
-
if (!np.hideCheckbox) {
|
|
22
|
-
np.columns = [{
|
|
23
|
-
label: '', field: "__checkbox", width: 34
|
|
24
|
-
}, ...np.columns];
|
|
25
|
-
}
|
|
26
|
-
if (np.rowAction) {
|
|
27
|
-
np.columns = [...np.columns, { label: "", field: "__actions", width: 34 }];
|
|
28
|
-
}
|
|
29
|
-
let columns = np.columns || [];
|
|
30
|
-
np.rows = [];
|
|
31
|
-
for (let i = 0; i < length; i++) {
|
|
32
|
-
let r = { id: i };
|
|
33
|
-
for (let col of columns) {
|
|
34
|
-
r[col.field] = "";
|
|
35
|
-
}
|
|
36
|
-
np.rows.push(r);
|
|
37
|
-
}
|
|
38
|
-
np.renderRow = (r) => {
|
|
39
|
-
for (let col of columns) {
|
|
40
|
-
r[col.field] = jsx(Skeleton, { animation: "wave", height: 16, radius: .5, width: "100%" });
|
|
41
|
-
}
|
|
42
|
-
return r;
|
|
43
|
-
};
|
|
44
|
-
np.hideCheckbox = true;
|
|
45
|
-
np.rowAction = undefined;
|
|
46
|
-
}
|
|
47
|
-
return np;
|
|
48
|
-
}, [p.skeleton, props.columns, props.rowAction, p.hideCheckbox, p.rows]);
|
|
49
|
-
let { rows, tabs, pagination: { perpages = [30, 50, 100], total = 0 } = {}, defaultState = {}, onStateChange, fixedHeader, hidePagination, slotProps,
|
|
50
|
-
// skip props for ViewBox
|
|
51
|
-
skeleton, rowAction, disableRow, renderRow, filters, hideCheckbox, hideSearch, columns, compact } = _props, viewBoxProps = __rest(_props, ["rows", "tabs", "pagination", "defaultState", "onStateChange", "fixedHeader", "hidePagination", "slotProps", "skeleton", "rowAction", "disableRow", "renderRow", "filters", "hideCheckbox", "hideSearch", "columns", "compact"]);
|
|
52
|
-
const [state, setState] = useState({
|
|
53
|
-
selected: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.selected) || [],
|
|
54
|
-
selectAll: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.selectAll) || false,
|
|
55
|
-
pagination: {
|
|
56
|
-
page: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.page) || 1,
|
|
57
|
-
perpage: perpages && perpages.length > 0 ? perpages[0] : 10,
|
|
58
|
-
from: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.from) || 1,
|
|
59
|
-
to: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.to) || (perpages && perpages.length > 0 ? perpages[0] : 10),
|
|
60
|
-
},
|
|
61
|
-
tab: tabs ? ((defaultState === null || defaultState === void 0 ? void 0 : defaultState.tab) || tabs[0].value || tabs[0].label.toLowerCase()) : "",
|
|
62
|
-
search: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.search) || "",
|
|
63
|
-
sortable: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.sortable) || {},
|
|
64
|
-
filters: (defaultState === null || defaultState === void 0 ? void 0 : defaultState.filter) || {}
|
|
65
|
-
});
|
|
66
|
-
const update = (s) => setState(o => (Object.assign(Object.assign({}, o), s)));
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (onStateChange) {
|
|
69
|
-
onStateChange(state);
|
|
70
|
-
}
|
|
71
|
-
}, [state]);
|
|
72
|
-
return (jsxs(ViewBox, Object.assign({ height: "100%" }, viewBoxProps, { baseClass: 'datatable', ref: ref, sx: Object.assign(Object.assign({}, viewBoxProps === null || viewBoxProps === void 0 ? void 0 : viewBoxProps.sx), { '& thead': fixedHeader ? {
|
|
73
|
-
position: "sticky",
|
|
74
|
-
top: 0,
|
|
75
|
-
bgcolor: "background.primary",
|
|
76
|
-
zIndex: 1
|
|
77
|
-
} : {} }), startContent: (jsxs(Tag, { baseClass: 'datatable-header', sxr: {
|
|
78
|
-
display: "flex",
|
|
79
|
-
flexDirection: "row",
|
|
80
|
-
justifyContent: "space-between"
|
|
81
|
-
}, children: [jsx(SelectedBox, Object.assign({}, _props, { update: update, state: state })), jsx(FilterBox, Object.assign({}, _props, { update: update, state: state }))] })), children: [jsx(TableArea, Object.assign({}, _props, { update: update, state: state })), jsx(Stack, { p: 1, alignItems: "flex-end", children: !hidePagination && jsx(TablePagination, Object.assign({ disabled: _props.skeleton ? true : false }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.pagination, { total: total || rows.length, page: state.pagination.page, perpage: state.pagination.perpage, perpages: perpages, slotProps: {
|
|
82
|
-
select: {
|
|
83
|
-
size: "small",
|
|
84
|
-
}
|
|
85
|
-
}, onChange: (state) => {
|
|
86
|
-
update({ pagination: state });
|
|
87
|
-
} })) })] })));
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
export { DataTable as default };
|
|
91
|
-
//# sourceMappingURL=index.mjs.map
|
package/Datatable/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/Datatable/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect, useMemo, useState } from 'react'\r\nimport ViewBox from '../ViewBox'\r\nimport { Tag, useInterface } from '@xanui/core';\r\nimport SelectedBox from './SelectedBox'\r\nimport TableArea from './Table'\r\nimport FilterBox from './FilterBox'\r\nimport TablePagination, { TablePaginationState } from '../TablePagination'\r\nimport Stack from '../Stack'\r\nimport { DatatableProps, DatatableState } from './types';\r\nimport Skeleton from '../Skeleton';\r\n\r\n\r\nconst DataTable = React.forwardRef((props: DatatableProps, ref: React.Ref<HTMLDivElement>) => {\r\n let [p] = useInterface<any>(\"Datatable\", props, {})\r\n\r\n let _props = useMemo(() => {\r\n let np = { ...p }\r\n\r\n if (typeof np.skeleton === 'number' || np.skeleton === true) {\r\n const limit = np.perpages && np.perpages.length > 0 ? np.perpages[0] : 10\r\n let length = np.skeleton === true ? limit : np.skeleton\r\n\r\n if (!np.hideCheckbox) {\r\n np.columns = [{\r\n label: '', field: \"__checkbox\", width: 34\r\n }, ...np.columns]\r\n }\r\n\r\n if (np.rowAction) {\r\n np.columns = [...np.columns, { label: \"\", field: \"__actions\", width: 34 }]\r\n }\r\n\r\n let columns = np.columns || []\r\n\r\n np.rows = []\r\n for (let i = 0; i < length; i++) {\r\n let r: any = { id: i }\r\n for (let col of columns) {\r\n r[col.field] = \"\"\r\n }\r\n np.rows.push(r)\r\n }\r\n\r\n np.renderRow = (r: any) => {\r\n for (let col of columns) {\r\n r[col.field] = <Skeleton\r\n animation={\"wave\"}\r\n height={16}\r\n radius={.5}\r\n width={\"100%\"}\r\n />\r\n }\r\n return r\r\n }\r\n np.hideCheckbox = true\r\n np.rowAction = undefined\r\n }\r\n return np\r\n }, [p.skeleton, props.columns, props.rowAction, p.hideCheckbox, p.rows])\r\n\r\n let {\r\n rows,\r\n tabs,\r\n\r\n pagination: { perpages = [30, 50, 100], total = 0 } = {},\r\n defaultState = {},\r\n onStateChange,\r\n\r\n fixedHeader,\r\n hidePagination,\r\n slotProps,\r\n\r\n\r\n // skip props for ViewBox\r\n skeleton,\r\n rowAction,\r\n disableRow,\r\n renderRow,\r\n filters,\r\n hideCheckbox,\r\n hideSearch,\r\n columns,\r\n compact,\r\n\r\n ...viewBoxProps\r\n } = _props\r\n\r\n const [state, setState] = useState<DatatableState>({\r\n selected: defaultState?.selected || [],\r\n selectAll: defaultState?.selectAll || false,\r\n pagination: {\r\n page: defaultState?.page || 1,\r\n perpage: perpages && perpages.length > 0 ? perpages[0] : 10,\r\n from: defaultState?.from || 1,\r\n to: defaultState?.to || (perpages && perpages.length > 0 ? perpages[0] : 10),\r\n },\r\n tab: tabs ? (defaultState?.tab || tabs[0].value || tabs[0].label.toLowerCase()) : \"\",\r\n search: defaultState?.search || \"\",\r\n sortable: defaultState?.sortable || {},\r\n filters: defaultState?.filter || {}\r\n })\r\n\r\n const update = (s: Partial<DatatableState>) => setState(o => ({ ...o, ...s }))\r\n\r\n useEffect(() => {\r\n if (onStateChange) {\r\n onStateChange(state)\r\n }\r\n }, [state])\r\n\r\n return (\r\n <ViewBox\r\n height=\"100%\"\r\n {...viewBoxProps}\r\n baseClass='datatable'\r\n ref={ref as any}\r\n sx={{\r\n ...viewBoxProps?.sx,\r\n '& thead': fixedHeader ? {\r\n position: \"sticky\",\r\n top: 0,\r\n bgcolor: \"background.primary\",\r\n zIndex: 1\r\n } : {},\r\n }}\r\n startContent={(\r\n <Tag\r\n baseClass='datatable-header'\r\n sxr={{\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n justifyContent: \"space-between\"\r\n }}\r\n >\r\n <SelectedBox {..._props} update={update} state={state} />\r\n <FilterBox {..._props} update={update} state={state} />\r\n </Tag>\r\n )}\r\n >\r\n <TableArea\r\n {..._props}\r\n update={update}\r\n state={state}\r\n />\r\n <Stack\r\n p={1}\r\n alignItems=\"flex-end\"\r\n >\r\n {!hidePagination && <TablePagination\r\n disabled={_props.skeleton ? true : false}\r\n {...slotProps?.pagination}\r\n total={total || rows.length}\r\n page={state.pagination.page}\r\n perpage={state.pagination.perpage}\r\n perpages={perpages}\r\n slotProps={{\r\n select: {\r\n size: \"small\",\r\n }\r\n }}\r\n onChange={(state: TablePaginationState) => {\r\n update({ pagination: state })\r\n }}\r\n />}\r\n </Stack>\r\n </ViewBox>\r\n )\r\n})\r\n\r\nexport default DataTable"],"names":[],"mappings":";;;;;;;;;;;;;AAaA;AACI;AAEA;AACI;AAEA;;AAEI;AAEA;;;AAGK;;AAGL;;;AAIA;AAEA;AACA;AACI;AACA;AACI;;AAEJ;;AAGJ;AACI;;;AAQA;AACJ;AACA;AACA;;AAEJ;;AAGJ;;;AA2BA;;;AAGI;;AAEI;;AAEA;AACH;AACD;;;;AAIH;AAED;;;;;AAMA;AAEA;AASgB;AACA;AACA;AACA;AACH;AAMO;AACA;AACA;;AAyBA;AACI;AACH;AACJ;AAEG;AACJ;AAKpB;;"}
|
package/Divider/index.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { __rest } from 'tslib';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useBreakpointProps, Tag } from '@xanui/core';
|
|
5
|
-
|
|
6
|
-
const Divider = React.forwardRef((_a, ref) => {
|
|
7
|
-
var _b, _c, _d;
|
|
8
|
-
var { children, direction, color, size } = _a, rest = __rest(_a, ["children", "direction", "color", "size"]);
|
|
9
|
-
const _p = {};
|
|
10
|
-
if (direction)
|
|
11
|
-
_p.direction = direction;
|
|
12
|
-
if (color)
|
|
13
|
-
_p.color = color;
|
|
14
|
-
if (size)
|
|
15
|
-
_p.size = size;
|
|
16
|
-
const p = useBreakpointProps(_p);
|
|
17
|
-
direction = (_b = p.direction) !== null && _b !== void 0 ? _b : "horizental";
|
|
18
|
-
color = (_c = p.color) !== null && _c !== void 0 ? _c : "default";
|
|
19
|
-
size = (_d = p.size) !== null && _d !== void 0 ? _d : 1;
|
|
20
|
-
let isHori = direction === 'horizental';
|
|
21
|
-
return (jsx(Tag, Object.assign({}, rest, { baseClass: 'divider', sxr: {
|
|
22
|
-
width: isHori ? "100%" : size,
|
|
23
|
-
height: isHori ? size : "100%",
|
|
24
|
-
bgcolor: color === 'default' ? `background.secondary` : `${color}.secondary`,
|
|
25
|
-
}, ref: ref, children: children })));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export { Divider as default };
|
|
29
|
-
//# sourceMappingURL=index.mjs.map
|
package/Divider/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/Divider/index.tsx"],"sourcesContent":["import React from 'react';\r\nimport { Tag, TagProps, TagComponentType, UseColorTemplateColor, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\r\n\r\n\r\nexport type DividerProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, \"color\"> & {\r\n direction?: useBreakpointPropsType<\"verticle\" | \"horizental\">;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n size?: useBreakpointPropsType<number>;\r\n}\r\n\r\nconst Divider = React.forwardRef(<T extends TagComponentType = \"div\">({ children, direction, color, size, ...rest }: DividerProps<T>, ref: React.Ref<any>) => {\r\n const _p: any = {}\r\n if (direction) _p.direction = direction\r\n if (color) _p.color = color\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n direction = p.direction ?? \"horizental\"\r\n color = p.color ?? \"default\"\r\n size = p.size ?? 1\r\n\r\n let isHori = direction === 'horizental'\r\n\r\n return (\r\n <Tag\r\n {...rest}\r\n baseClass='divider'\r\n sxr={{\r\n width: isHori ? \"100%\" : size,\r\n height: isHori ? size : \"100%\",\r\n bgcolor: color === 'default' ? `background.secondary` : `${color}.secondary`,\r\n }}\r\n ref={ref}\r\n >{children}</Tag>\r\n )\r\n})\r\n\r\nexport default Divider\r\n\r\n"],"names":["_jsx"],"mappings":";;;;;AAUA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA8D,EAAE,GAAmB,KAAI;;AAAvF,IAAA,IAAA,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAA,MAAA,CAAA,EAAA,EAA3C,CAAA,UAAA,EAAA,WAAA,EAAA,OAAA,EAAA,MAAA,CAA6C,CAAF;IAC7G,MAAM,EAAE,GAAQ,EAAE;AAClB,IAAA,IAAI,SAAS;AAAE,QAAA,EAAE,CAAC,SAAS,GAAG,SAAS;AACvC,IAAA,IAAI,KAAK;AAAE,QAAA,EAAE,CAAC,KAAK,GAAG,KAAK;AAC3B,IAAA,IAAI,IAAI;AAAE,QAAA,EAAE,CAAC,IAAI,GAAG,IAAI;AACxB,IAAA,MAAM,CAAC,GAAQ,kBAAkB,CAAC,EAAE,CAAC;AACrC,IAAA,SAAS,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,YAAY;AACvC,IAAA,KAAK,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,SAAS;AAC5B,IAAA,IAAI,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,CAAC;AAElB,IAAA,IAAI,MAAM,GAAG,SAAS,KAAK,YAAY;IAEvC,QACIA,GAAA,CAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,IAAI,EAAA,EACR,SAAS,EAAC,SAAS,EACnB,GAAG,EAAE;YACD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;YAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;AAC9B,YAAA,OAAO,EAAE,KAAK,KAAK,SAAS,GAAG,CAAA,oBAAA,CAAsB,GAAG,CAAA,EAAG,KAAK,CAAA,UAAA,CAAY;AAC/E,SAAA,EACD,GAAG,EAAE,GAAG,YACV,QAAQ,EAAA,CAAA,CAAO;AAEzB,CAAC;;;;"}
|
package/Drawer/index.mjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from 'tslib';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { useBreakpointProps, Tag, Renderar } from '@xanui/core';
|
|
5
|
-
import Layer from '../Layer/index.mjs';
|
|
6
|
-
import ClickOutside from '../ClickOutside/index.mjs';
|
|
7
|
-
|
|
8
|
-
const getVariant = (placement) => {
|
|
9
|
-
switch (placement) {
|
|
10
|
-
case "right":
|
|
11
|
-
return "fadeLeft";
|
|
12
|
-
case "top":
|
|
13
|
-
return "fadeDown";
|
|
14
|
-
case "bottom":
|
|
15
|
-
return "fadeUp";
|
|
16
|
-
default:
|
|
17
|
-
return "fadeRight";
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const Drawer = (_a) => {
|
|
21
|
-
var _b;
|
|
22
|
-
var { children, placement, size, slotProps, onClickOutside } = _a, layerProps = __rest(_a, ["children", "placement", "size", "slotProps", "onClickOutside"]);
|
|
23
|
-
const _p = {};
|
|
24
|
-
if (placement)
|
|
25
|
-
_p.placement = placement;
|
|
26
|
-
if (size)
|
|
27
|
-
_p.size = size;
|
|
28
|
-
const p = useBreakpointProps(_p);
|
|
29
|
-
placement = (_b = p.placement) !== null && _b !== void 0 ? _b : 'left';
|
|
30
|
-
size = p.size || "medium";
|
|
31
|
-
let isSide = placement === 'left' || placement === 'right';
|
|
32
|
-
let sizes = {
|
|
33
|
-
small: 220,
|
|
34
|
-
medium: 330,
|
|
35
|
-
large: 440
|
|
36
|
-
};
|
|
37
|
-
let _size = sizes[size] || size;
|
|
38
|
-
return (jsx(Layer, Object.assign({}, layerProps, slotProps === null || slotProps === void 0 ? void 0 : slotProps.layer, { transition: getVariant(placement), children: jsx(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { baseClass: 'drawer', sxr: {
|
|
39
|
-
width: "100vw",
|
|
40
|
-
height: "100vh",
|
|
41
|
-
display: "flex",
|
|
42
|
-
direction: isSide ? "row" : "column",
|
|
43
|
-
justifyContent: placement === 'left' || placement === 'top' ? "flex-start" : "flex-end"
|
|
44
|
-
}, children: jsx(ClickOutside, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: jsx(Tag, { sxr: {
|
|
45
|
-
width: isSide ? _size : "100%",
|
|
46
|
-
height: isSide ? "100%" : _size,
|
|
47
|
-
bgcolor: "background.primary",
|
|
48
|
-
shadow: 20
|
|
49
|
-
}, baseClass: 'drawer-content', children: children }) })) })) })));
|
|
50
|
-
};
|
|
51
|
-
Drawer.open = (children, props) => {
|
|
52
|
-
const d = Renderar.render(Drawer, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
|
|
53
|
-
d.unrender();
|
|
54
|
-
}, onClickOutside: () => {
|
|
55
|
-
if (props === null || props === void 0 ? void 0 : props.onClickOutside) {
|
|
56
|
-
props.onClickOutside();
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
d.updateProps({ open: false });
|
|
60
|
-
}
|
|
61
|
-
} }));
|
|
62
|
-
return {
|
|
63
|
-
open: () => {
|
|
64
|
-
d.updateProps({ open: true });
|
|
65
|
-
},
|
|
66
|
-
close: () => {
|
|
67
|
-
d.updateProps({ open: false });
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
Drawer.close = () => {
|
|
72
|
-
Renderar.unrender(Drawer);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export { Drawer as default };
|
|
76
|
-
//# sourceMappingURL=index.mjs.map
|