@xanui/ui 1.1.37 → 1.1.38
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/Accordion/index.js +19 -21
- package/Accordion/index.js.map +1 -1
- package/Alert/index.js +33 -35
- package/Alert/index.js.map +1 -1
- package/Autocomplete/index.js +23 -25
- package/Autocomplete/index.js.map +1 -1
- package/Avatar/index.js +15 -17
- package/Avatar/index.js.map +1 -1
- package/Badge/index.js +12 -14
- package/Badge/index.js.map +1 -1
- package/Box/index.js +7 -9
- package/Box/index.js.map +1 -1
- package/Button/index.js +17 -19
- package/Button/index.js.map +1 -1
- package/ButtonGroup/index.js +12 -14
- package/ButtonGroup/index.js.map +1 -1
- package/Calendar/index.js +39 -41
- package/Calendar/index.js.map +1 -1
- package/CalendarInput/index.js +19 -21
- package/CalendarInput/index.js.map +1 -1
- package/Checkbox/index.js +14 -16
- package/Checkbox/index.js.map +1 -1
- package/Chip/index.js +12 -14
- package/Chip/index.js.map +1 -1
- package/CircleProgress/index.js +13 -15
- package/CircleProgress/index.js.map +1 -1
- package/ClickOutside/index.js +9 -11
- package/ClickOutside/index.js.map +1 -1
- package/Collaps/index.js +9 -11
- package/Collaps/index.js.map +1 -1
- package/Container/index.js +9 -11
- package/Container/index.js.map +1 -1
- package/DataFilter/index.js +30 -41
- package/DataFilter/index.js.map +1 -1
- package/DataFilter/options/DateFilter.js +16 -18
- package/DataFilter/options/DateFilter.js.map +1 -1
- package/DataFilter/options/DateRangeFilter.js +12 -14
- package/DataFilter/options/DateRangeFilter.js.map +1 -1
- package/DataFilter/options/MultiSelectFilter.js +20 -22
- package/DataFilter/options/MultiSelectFilter.js.map +1 -1
- package/DataFilter/options/NumberFilter.js +11 -13
- package/DataFilter/options/NumberFilter.js.map +1 -1
- package/DataFilter/options/NumberRangeFilter.js +12 -14
- package/DataFilter/options/NumberRangeFilter.js.map +1 -1
- package/DataFilter/options/SelectFilter.js +18 -20
- package/DataFilter/options/SelectFilter.js.map +1 -1
- package/DataFilter/options/TextFilter.js +11 -13
- package/DataFilter/options/TextFilter.js.map +1 -1
- package/Datatable/FilterBox.js +21 -23
- package/Datatable/FilterBox.js.map +1 -1
- package/Datatable/Row.js +19 -21
- package/Datatable/Row.js.map +1 -1
- package/Datatable/SelectedBox.js +10 -12
- package/Datatable/SelectedBox.js.map +1 -1
- package/Datatable/Table.js +8 -10
- package/Datatable/Table.js.map +1 -1
- package/Datatable/TableHead.js +18 -20
- package/Datatable/TableHead.js.map +1 -1
- package/Datatable/index.js +21 -23
- package/Datatable/index.js.map +1 -1
- package/Divider/index.js +8 -10
- package/Divider/index.js.map +1 -1
- package/Drawer/index.js +12 -14
- package/Drawer/index.js.map +1 -1
- package/Form/index.js +8 -10
- package/Form/index.js.map +1 -1
- package/GridContainer/index.js +7 -9
- package/GridContainer/index.js.map +1 -1
- package/GridItem/index.js +7 -9
- package/GridItem/index.js.map +1 -1
- package/IconButton/index.js +12 -14
- package/IconButton/index.js.map +1 -1
- package/Image/index.js +9 -11
- package/Image/index.js.map +1 -1
- package/Input/index.js +18 -20
- package/Input/index.js.map +1 -1
- package/InputNumber/index.js +6 -8
- package/InputNumber/index.js.map +1 -1
- package/Label/index.js +7 -9
- package/Label/index.js.map +1 -1
- package/Layer/index.js +19 -21
- package/Layer/index.js.map +1 -1
- package/LineProgress/index.js +11 -13
- package/LineProgress/index.js.map +1 -1
- package/List/ListContext.js +2 -5
- package/List/ListContext.js.map +1 -1
- package/List/index.js +12 -14
- package/List/index.js.map +1 -1
- package/ListItem/index.js +12 -14
- package/ListItem/index.js.map +1 -1
- package/LoadingBox/index.js +11 -13
- package/LoadingBox/index.js.map +1 -1
- package/Menu/index.js +18 -20
- package/Menu/index.js.map +1 -1
- package/Modal/index.js +15 -17
- package/Modal/index.js.map +1 -1
- package/NoSSR/index.js +4 -6
- package/NoSSR/index.js.map +1 -1
- package/Option/index.js +7 -9
- package/Option/index.js.map +1 -1
- package/Paper/index.js +8 -10
- package/Paper/index.js.map +1 -1
- package/Portal/index.js +9 -11
- package/Portal/index.js.map +1 -1
- package/Radio/index.js +9 -11
- package/Radio/index.js.map +1 -1
- package/Scrollbar/index.js +10 -12
- package/Scrollbar/index.js.map +1 -1
- package/Select/index.js +22 -24
- package/Select/index.js.map +1 -1
- package/Skeleton/index.js +7 -9
- package/Skeleton/index.js.map +1 -1
- package/Stack/index.js +7 -9
- package/Stack/index.js.map +1 -1
- package/Switch/index.js +12 -14
- package/Switch/index.js.map +1 -1
- package/Tab/index.js +9 -11
- package/Tab/index.js.map +1 -1
- package/Table/index.js +13 -15
- package/Table/index.js.map +1 -1
- package/TableBody/index.js +7 -9
- package/TableBody/index.js.map +1 -1
- package/TableCell/index.js +7 -9
- package/TableCell/index.js.map +1 -1
- package/TableFooter/index.js +7 -9
- package/TableFooter/index.js.map +1 -1
- package/TableHead/index.js +7 -9
- package/TableHead/index.js.map +1 -1
- package/TablePagination/index.js +21 -23
- package/TablePagination/index.js.map +1 -1
- package/TableRow/index.js +7 -9
- package/TableRow/index.js.map +1 -1
- package/Tabs/index.js +19 -21
- package/Tabs/index.js.map +1 -1
- package/Text/index.js +8 -10
- package/Text/index.js.map +1 -1
- package/Toast/index.js +18 -20
- package/Toast/index.js.map +1 -1
- package/Tooltip/index.js +11 -13
- package/Tooltip/index.js.map +1 -1
- package/ViewBox/index.js +11 -13
- package/ViewBox/index.js.map +1 -1
- package/index.js +64 -133
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/useAlert/index.js +12 -14
- package/useAlert/index.js.map +1 -1
- package/useBlurCss/index.js +5 -7
- package/useBlurCss/index.js.map +1 -1
- package/useCorner/index.js +1 -3
- package/useCorner/index.js.map +1 -1
- package/useLayer/index.js +7 -9
- package/useLayer/index.js.map +1 -1
- package/useModal/index.js +8 -10
- package/useModal/index.js.map +1 -1
package/DataFilter/index.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var DateFilter = require('./options/DateFilter.js');
|
|
15
|
-
var DateRangeFilter = require('./options/DateRangeFilter.js');
|
|
16
|
-
var React = require('react');
|
|
17
|
-
var core = require('@xanui/core');
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import Stack from '../Stack/index.js';
|
|
5
|
+
import SelectFilter from './options/SelectFilter.js';
|
|
6
|
+
import MultiSelectFilter from './options/MultiSelectFilter.js';
|
|
7
|
+
import NumberFilter from './options/NumberFilter.js';
|
|
8
|
+
import TextFilter from './options/TextFilter.js';
|
|
9
|
+
import NumberRangeFilter from './options/NumberRangeFilter.js';
|
|
10
|
+
import DateFilter from './options/DateFilter.js';
|
|
11
|
+
import DateRangeFilter from './options/DateRangeFilter.js';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Tag } from '@xanui/core';
|
|
18
14
|
|
|
19
15
|
const DataFilter = (_a, ref) => {
|
|
20
|
-
var { inline, options, onChange, value } = _a, props =
|
|
16
|
+
var { inline, options, onChange, value } = _a, props = __rest(_a, ["inline", "options", "onChange", "value"]);
|
|
21
17
|
inline !== null && inline !== void 0 ? inline : (inline = false);
|
|
22
18
|
value !== null && value !== void 0 ? value : (value = {});
|
|
23
19
|
onChange !== null && onChange !== void 0 ? onChange : (onChange = () => { });
|
|
24
|
-
return (
|
|
20
|
+
return (jsx(Tag, Object.assign({}, props, { sxr: {
|
|
25
21
|
flexBox: true,
|
|
26
22
|
flexDirection: inline ? 'row' : 'column',
|
|
27
23
|
alignItems: inline ? 'center' : 'stretch',
|
|
@@ -29,37 +25,37 @@ const DataFilter = (_a, ref) => {
|
|
|
29
25
|
gap: 1,
|
|
30
26
|
p: 2,
|
|
31
27
|
radius: 1,
|
|
32
|
-
}, baseClass: 'data-filter', ref: ref, children: options.map((option, index
|
|
28
|
+
}, baseClass: 'data-filter', ref: ref, children: options.map((option, index) => {
|
|
33
29
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
34
30
|
switch (option.type) {
|
|
35
31
|
case "text":
|
|
36
|
-
return (
|
|
32
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(TextFilter, { option: option, value: (_a = value[option.key]) !== null && _a !== void 0 ? _a : null, onChange: (v) => {
|
|
37
33
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
38
|
-
} }) }, index
|
|
34
|
+
} }) }, index));
|
|
39
35
|
case "number":
|
|
40
|
-
return (
|
|
36
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(NumberFilter, { option: option, value: (_b = value[option.key]) !== null && _b !== void 0 ? _b : null, onChange: (v) => {
|
|
41
37
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
42
|
-
} }) }, index
|
|
38
|
+
} }) }, index));
|
|
43
39
|
case "number-range":
|
|
44
|
-
return (
|
|
40
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(NumberRangeFilter, { option: option, value: (_c = value[option.key]) !== null && _c !== void 0 ? _c : null, onChange: (v) => {
|
|
45
41
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
46
|
-
} }) }, index
|
|
42
|
+
} }) }, index));
|
|
47
43
|
case "select":
|
|
48
|
-
return (
|
|
44
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(SelectFilter, { option: option, value: (_d = value[option.key]) !== null && _d !== void 0 ? _d : null, onChange: (v) => {
|
|
49
45
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
50
|
-
} }) }, index
|
|
46
|
+
} }) }, index));
|
|
51
47
|
case "multi-select":
|
|
52
|
-
return (
|
|
48
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(MultiSelectFilter, { option: option, value: (_e = value[option.key]) !== null && _e !== void 0 ? _e : [], onChange: (v) => {
|
|
53
49
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
54
|
-
} }) }, index
|
|
50
|
+
} }) }, index));
|
|
55
51
|
case "date":
|
|
56
|
-
return (
|
|
52
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(DateFilter, { option: option, value: (_f = value[option.key]) !== null && _f !== void 0 ? _f : null, onChange: (v) => {
|
|
57
53
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
58
|
-
} }) }, index
|
|
54
|
+
} }) }, index));
|
|
59
55
|
case "date-range":
|
|
60
|
-
return (
|
|
56
|
+
return (jsx(Stack, { width: inline ? 300 : "100%", children: jsx(DateRangeFilter, { option: option, value: (_g = value[option.key]) !== null && _g !== void 0 ? _g : null, onChange: (v) => {
|
|
61
57
|
onChange(Object.assign(Object.assign({}, value), { [option.key]: v }));
|
|
62
|
-
} }) }, index
|
|
58
|
+
} }) }, index));
|
|
63
59
|
default:
|
|
64
60
|
return null;
|
|
65
61
|
}
|
|
@@ -67,12 +63,5 @@ const DataFilter = (_a, ref) => {
|
|
|
67
63
|
};
|
|
68
64
|
var DataFilter$1 = React.forwardRef(DataFilter);
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
exports.MultiSelectFilter = MultiSelectFilter;
|
|
72
|
-
exports.NumberFilter = NumberFilter;
|
|
73
|
-
exports.TextFilter = TextFilter;
|
|
74
|
-
exports.NumberRangeFilter = NumberRangeFilter;
|
|
75
|
-
exports.DateFilter = DateFilter;
|
|
76
|
-
exports.DateRangeFilter = DateRangeFilter;
|
|
77
|
-
exports.default = DataFilter$1;
|
|
66
|
+
export { DateFilter, DateRangeFilter, MultiSelectFilter, NumberFilter, NumberRangeFilter, SelectFilter, TextFilter, DataFilter$1 as default };
|
|
78
67
|
//# sourceMappingURL=index.js.map
|
package/DataFilter/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/DataFilter/index.tsx"],"sourcesContent":["\"use client\"\r\nimport Stack from '../Stack'\r\nimport { DataFilterProps } from './types'\r\nimport SelectFilter from './options/SelectFilter'\r\nimport MultiSelectFilter from './options/MultiSelectFilter'\r\nimport NumberFilter from './options/NumberFilter'\r\nimport TextFilter from './options/TextFilter'\r\nimport NumberRangeFilter from './options/NumberRangeFilter'\r\nimport DateFilter from './options/DateFilter'\r\nimport DateRangeFilter from './options/DateRangeFilter'\r\nimport React from 'react'\r\nimport { Tag } from '@xanui/core'\r\n\r\nexport {\r\n SelectFilter,\r\n MultiSelectFilter,\r\n NumberFilter,\r\n TextFilter,\r\n NumberRangeFilter,\r\n DateFilter,\r\n DateRangeFilter,\r\n}\r\n\r\nexport * from './types'\r\n\r\nconst DataFilter = ({ inline, options, onChange, value, ...props }: DataFilterProps, ref: React.Ref<HTMLDivElement>) => {\r\n inline ??= false\r\n value ??= {}\r\n onChange ??= () => { }\r\n\r\n return (\r\n <Tag\r\n {...props}\r\n sxr={{\r\n flexBox: true,\r\n flexDirection: inline ? 'row' : 'column',\r\n alignItems: inline ? 'center' : 'stretch',\r\n flexWrap: inline ? 'wrap' : 'nowrap',\r\n gap: 1,\r\n p: 2,\r\n radius: 1,\r\n }}\r\n baseClass='data-filter'\r\n ref={ref}\r\n >\r\n {\r\n options.map((option, index) => {\r\n switch (option.type) {\r\n case \"text\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <TextFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"number\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <NumberFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"number-range\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <NumberRangeFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"select\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <SelectFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"multi-select\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <MultiSelectFilter\r\n option={option as any}\r\n value={value[option.key] ?? []}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"date\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <DateFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"date-range\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <DateRangeFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n default:\r\n return null\r\n\r\n }\r\n })\r\n }\r\n </Tag>\r\n )\r\n}\r\n\r\nexport default React.forwardRef(DataFilter);\r\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/DataFilter/index.tsx"],"sourcesContent":["\"use client\"\r\nimport Stack from '../Stack'\r\nimport { DataFilterProps } from './types'\r\nimport SelectFilter from './options/SelectFilter'\r\nimport MultiSelectFilter from './options/MultiSelectFilter'\r\nimport NumberFilter from './options/NumberFilter'\r\nimport TextFilter from './options/TextFilter'\r\nimport NumberRangeFilter from './options/NumberRangeFilter'\r\nimport DateFilter from './options/DateFilter'\r\nimport DateRangeFilter from './options/DateRangeFilter'\r\nimport React from 'react'\r\nimport { Tag } from '@xanui/core'\r\n\r\nexport {\r\n SelectFilter,\r\n MultiSelectFilter,\r\n NumberFilter,\r\n TextFilter,\r\n NumberRangeFilter,\r\n DateFilter,\r\n DateRangeFilter,\r\n}\r\n\r\nexport * from './types'\r\n\r\nconst DataFilter = ({ inline, options, onChange, value, ...props }: DataFilterProps, ref: React.Ref<HTMLDivElement>) => {\r\n inline ??= false\r\n value ??= {}\r\n onChange ??= () => { }\r\n\r\n return (\r\n <Tag\r\n {...props}\r\n sxr={{\r\n flexBox: true,\r\n flexDirection: inline ? 'row' : 'column',\r\n alignItems: inline ? 'center' : 'stretch',\r\n flexWrap: inline ? 'wrap' : 'nowrap',\r\n gap: 1,\r\n p: 2,\r\n radius: 1,\r\n }}\r\n baseClass='data-filter'\r\n ref={ref}\r\n >\r\n {\r\n options.map((option, index) => {\r\n switch (option.type) {\r\n case \"text\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <TextFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"number\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <NumberFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"number-range\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <NumberRangeFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"select\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <SelectFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"multi-select\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <MultiSelectFilter\r\n option={option as any}\r\n value={value[option.key] ?? []}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"date\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <DateFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n case \"date-range\":\r\n return (<Stack\r\n width={inline ? 300 : \"100%\"}\r\n key={index}\r\n >\r\n <DateRangeFilter\r\n option={option as any}\r\n value={value[option.key] ?? null}\r\n onChange={(v) => {\r\n onChange({\r\n ...value,\r\n [option.key]: v\r\n })\r\n }}\r\n />\r\n </Stack>\r\n )\r\n default:\r\n return null\r\n\r\n }\r\n })\r\n }\r\n </Tag>\r\n )\r\n}\r\n\r\nexport default React.forwardRef(DataFilter);\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAyBA;AAAoB;;;;AAKjB;AAIS;;;;AAIA;AACA;AACA;AACF;;AAMK;AACG;AACG;;AAYM;AAIT;AACG;;AAYM;AAIT;AACG;;AAYM;AAIT;AACG;;AAYM;AAIT;AACG;;AAYM;AAIT;AACG;;AAYM;AAIT;AACG;;AAYM;AAIT;AACG;;;AAOrB;AAEA;;"}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var index$3 = require('../../Chip/index.js');
|
|
14
|
-
var index$5 = require('../../Calendar/index.js');
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Menu from '../../Menu/index.js';
|
|
5
|
+
import IconButton from '../../IconButton/index.js';
|
|
6
|
+
import Stack from '../../Stack/index.js';
|
|
7
|
+
import Text from '../../Text/index.js';
|
|
8
|
+
import Close from '@xanui/icons/Close';
|
|
9
|
+
import Add from '@xanui/icons/Add';
|
|
10
|
+
import ClearAll from '@xanui/icons/ClearAll';
|
|
11
|
+
import Chip from '../../Chip/index.js';
|
|
12
|
+
import Calendar from '../../Calendar/index.js';
|
|
15
13
|
|
|
16
14
|
const DateFilter = ({ option, onChange, value }) => {
|
|
17
15
|
const [target, setTarget] = React.useState();
|
|
18
16
|
const isValue = value !== null && value !== undefined && value !== "";
|
|
19
|
-
return (
|
|
17
|
+
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: (e) => {
|
|
20
18
|
setTarget(e.currentTarget);
|
|
21
|
-
}, children:
|
|
19
|
+
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
22
20
|
onChange(null);
|
|
23
|
-
}, children:
|
|
21
|
+
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: isValue && jsx(Chip, { size: "small", color: "default", label: new Date(value).toLocaleDateString("en-US"), endIcon: jsx(IconButton, { size: 16, variant: "text", color: "default", onClick: () => {
|
|
24
22
|
onChange(null);
|
|
25
|
-
}, children:
|
|
23
|
+
}, children: jsx(Close, {}) }) }) }), jsx(Menu, { target: target, onClickOutside: () => setTarget(undefined), placement: "bottom-right", children: jsx(Calendar, { value: value ? new Date(value) : null, onChange: (date) => {
|
|
26
24
|
onChange((date === null || date === void 0 ? void 0 : date.toISOString()) || null);
|
|
27
25
|
setTarget(undefined);
|
|
28
26
|
} }) })] }));
|
|
29
27
|
};
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
export { DateFilter as default };
|
|
32
30
|
//# sourceMappingURL=DateFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFilter.js","sources":["../../../src/DataFilter/options/DateFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport React from \"react\";\r\nimport { DataFilterDate } from \"../types\";\r\nimport Menu from \"../../Menu\";\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\nimport Calendar from \"../../Calendar\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterDate;\r\n value: string | null;\r\n onChange: (value: string | null) => void;\r\n}\r\n\r\nconst DateFilter = ({ option, onChange, value }: Props) => {\r\n const [target, setTarget] = React.useState<HTMLElement | undefined>()\r\n const isValue = value !== null && value !== undefined && value !== \"\"\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={(e: any) => {\r\n setTarget(e.currentTarget)\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 && <Chip\r\n size=\"small\"\r\n color=\"default\"\r\n label={new Date(value).toLocaleDateString(\"en-US\")}\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 <Calendar\r\n value={value ? new Date(value) : null}\r\n onChange={(date) => {\r\n onChange(date?.toISOString() || null);\r\n setTarget(undefined);\r\n }}\r\n />\r\n </Menu>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default DateFilter"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateFilter.js","sources":["../../../src/DataFilter/options/DateFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport React from \"react\";\r\nimport { DataFilterDate } from \"../types\";\r\nimport Menu from \"../../Menu\";\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\nimport Calendar from \"../../Calendar\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterDate;\r\n value: string | null;\r\n onChange: (value: string | null) => void;\r\n}\r\n\r\nconst DateFilter = ({ option, onChange, value }: Props) => {\r\n const [target, setTarget] = React.useState<HTMLElement | undefined>()\r\n const isValue = value !== null && value !== undefined && value !== \"\"\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={(e: any) => {\r\n setTarget(e.currentTarget)\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 && <Chip\r\n size=\"small\"\r\n color=\"default\"\r\n label={new Date(value).toLocaleDateString(\"en-US\")}\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 <Calendar\r\n value={value ? new Date(value) : null}\r\n onChange={(date) => {\r\n onChange(date?.toISOString() || null);\r\n setTarget(undefined);\r\n }}\r\n />\r\n </Menu>\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default DateFilter"],"names":[],"mappings":";;;;;;;;;;;;;AAqBA;;AAEG;AAEA;AAwBkB;;;AAYA;;;AAsCH;;AAEH;AAKf;;"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var ClearAll = require('@xanui/icons/ClearAll');
|
|
10
|
-
var index$3 = require('../../CalendarInput/index.js');
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import IconButton from '../../IconButton/index.js';
|
|
4
|
+
import Stack from '../../Stack/index.js';
|
|
5
|
+
import Text from '../../Text/index.js';
|
|
6
|
+
import Add from '@xanui/icons/Add';
|
|
7
|
+
import ClearAll from '@xanui/icons/ClearAll';
|
|
8
|
+
import CalenderInput from '../../CalendarInput/index.js';
|
|
11
9
|
|
|
12
10
|
const DateRangeFilter = ({ option, onChange, value }) => {
|
|
13
11
|
const isValue = value !== null && value !== undefined && value.length === 2;
|
|
14
|
-
return (
|
|
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: () => {
|
|
15
13
|
const d = new Date();
|
|
16
14
|
onChange([d.toISOString(), d.toISOString()]);
|
|
17
|
-
}, children:
|
|
15
|
+
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
18
16
|
onChange(null);
|
|
19
|
-
}, children:
|
|
17
|
+
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: isValue && jsx(Fragment, { children: jsxs(Stack, { p: 1, gap: 1, width: "100%", children: [jsx(CalenderInput, { fullWidth: true, variant: "outline", value: value[0] ? new Date(value[0]) : null, onChange: (date) => {
|
|
20
18
|
onChange([date ? date.toISOString() : "", value ? value[1] : ""]);
|
|
21
|
-
} }),
|
|
19
|
+
} }), jsx(CalenderInput, { fullWidth: true, variant: "outline", value: value[1] ? new Date(value[1]) : null, onChange: (date) => {
|
|
22
20
|
onChange([value ? value[0] : "", date ? date.toISOString() : ""]);
|
|
23
21
|
} })] }) }) })] }));
|
|
24
22
|
};
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
export { DateRangeFilter as default };
|
|
27
25
|
//# sourceMappingURL=DateRangeFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeFilter.js","sources":["../../../src/DataFilter/options/DateRangeFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport { DataFilterDate } 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 CalenderInput from \"../../CalendarInput\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterDate;\r\n value: [string, string] | null;\r\n onChange: (value: [string, string] | null) => void;\r\n}\r\n\r\nconst DateRangeFilter = ({ option, onChange, value }: Props) => {\r\n const isValue = value !== null && value !== undefined && 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 const d = new Date();\r\n onChange([d.toISOString(), d.toISOString()]);\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 && <>\r\n <Stack\r\n p={1}\r\n gap={1}\r\n width={\"100%\"}\r\n >\r\n <CalenderInput\r\n fullWidth\r\n variant={\"outline\"}\r\n value={value![0] ? new Date(value[0]) : null}\r\n onChange={(date) => {\r\n onChange([date ? date.toISOString() : \"\", value ? value[1] : \"\"])\r\n }}\r\n />\r\n\r\n <CalenderInput\r\n fullWidth\r\n variant={\"outline\"}\r\n value={value![1] ? new Date(value[1]) : null}\r\n onChange={(date) => {\r\n onChange([value ? value[0] : \"\", date ? date.toISOString() : \"\"])\r\n }}\r\n />\r\n </Stack>\r\n </>\r\n }\r\n </Stack>\r\n\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default DateRangeFilter"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateRangeFilter.js","sources":["../../../src/DataFilter/options/DateRangeFilter.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport { DataFilterDate } 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 CalenderInput from \"../../CalendarInput\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterDate;\r\n value: [string, string] | null;\r\n onChange: (value: [string, string] | null) => void;\r\n}\r\n\r\nconst DateRangeFilter = ({ option, onChange, value }: Props) => {\r\n const isValue = value !== null && value !== undefined && 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 const d = new Date();\r\n onChange([d.toISOString(), d.toISOString()]);\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 && <>\r\n <Stack\r\n p={1}\r\n gap={1}\r\n width={\"100%\"}\r\n >\r\n <CalenderInput\r\n fullWidth\r\n variant={\"outline\"}\r\n value={value![0] ? new Date(value[0]) : null}\r\n onChange={(date) => {\r\n onChange([date ? date.toISOString() : \"\", value ? value[1] : \"\"])\r\n }}\r\n />\r\n\r\n <CalenderInput\r\n fullWidth\r\n variant={\"outline\"}\r\n value={value![1] ? new Date(value[1]) : null}\r\n onChange={(date) => {\r\n onChange([value ? value[0] : \"\", date ? date.toISOString() : \"\"])\r\n }}\r\n />\r\n </Stack>\r\n </>\r\n }\r\n </Stack>\r\n\r\n </Stack>\r\n )\r\n}\r\n\r\nexport default DateRangeFilter"],"names":[],"mappings":";;;;;;;;;AAiBA;AACG;AAEA;AAwBkB;AACA;;;AAYA;AAwBM;AACH;AAQG;AACH;AASxB;;"}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var index$3 = require('../../Chip/index.js');
|
|
16
|
-
var Close = require('@xanui/icons/Close');
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Menu from '../../Menu/index.js';
|
|
5
|
+
import List from '../../List/index.js';
|
|
6
|
+
import ListItem from '../../ListItem/index.js';
|
|
7
|
+
import Checkbox from '../../Checkbox/index.js';
|
|
8
|
+
import IconButton from '../../IconButton/index.js';
|
|
9
|
+
import Stack from '../../Stack/index.js';
|
|
10
|
+
import Text from '../../Text/index.js';
|
|
11
|
+
import Add from '@xanui/icons/Add';
|
|
12
|
+
import ClearAll from '@xanui/icons/ClearAll';
|
|
13
|
+
import Chip from '../../Chip/index.js';
|
|
14
|
+
import Close from '@xanui/icons/Close';
|
|
17
15
|
|
|
18
16
|
const MultiSelectFilter = ({ option, onChange, value }) => {
|
|
19
17
|
var _a;
|
|
20
18
|
const ref = React.useRef(null);
|
|
21
19
|
const [target, setTarget] = React.useState();
|
|
22
20
|
const isValue = value && value.length > 0;
|
|
23
|
-
return (
|
|
21
|
+
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: (e) => {
|
|
24
22
|
setTarget(e.currentTarget);
|
|
25
|
-
}, children:
|
|
23
|
+
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
26
24
|
onChange([]);
|
|
27
|
-
}, children:
|
|
28
|
-
return (
|
|
25
|
+
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: isValue && value.map((val, index) => {
|
|
26
|
+
return (jsx(Chip, { size: "small", color: "default", label: val, endIcon: jsx(IconButton, { size: 16, variant: "text", color: "default", onClick: () => {
|
|
29
27
|
onChange(value.filter(v => v !== val));
|
|
30
|
-
}, children:
|
|
31
|
-
}) }),
|
|
28
|
+
}, children: jsx(Close, {}) }) }, index));
|
|
29
|
+
}) }), 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 === null || value === void 0 ? void 0 : value.includes(opt.value) }), onClick: () => {
|
|
32
30
|
const has = value === null || value === void 0 ? void 0 : value.includes(opt.value);
|
|
33
31
|
onChange(has ? value === null || value === void 0 ? void 0 : value.filter(v => v !== opt.value) : [...value || [], opt.value]);
|
|
34
32
|
}, children: opt.label }, index))) }) })] }));
|
|
35
33
|
};
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
export { MultiSelectFilter as default };
|
|
38
36
|
//# sourceMappingURL=MultiSelectFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelectFilter.js","sources":["../../../src/DataFilter/options/MultiSelectFilter.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 Add from \"@xanui/icons/Add\";\r\nimport ClearAll from \"@xanui/icons/ClearAll\";\r\nimport Chip from \"../../Chip\";\r\nimport Close from \"@xanui/icons/Close\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterSelect;\r\n value: string[];\r\n onChange: (value: string[]) => void;\r\n}\r\n\r\nconst MultiSelectFilter = ({ option, onChange, value }: Props) => {\r\n const ref: any = React.useRef(null)\r\n const [target, setTarget] = React.useState<HTMLElement | undefined>()\r\n const isValue = value && value.length > 0;\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={(e: any) => {\r\n setTarget(e.currentTarget)\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([]);\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 && value.map((val, index) => {\r\n return (\r\n <Chip\r\n key={index}\r\n size=\"small\"\r\n color=\"default\"\r\n label={val}\r\n endIcon={<IconButton\r\n size={16}\r\n variant={\"text\"}\r\n color=\"default\"\r\n onClick={() => {\r\n onChange(value.filter(v => v !== val));\r\n }}\r\n >\r\n <Close />\r\n </IconButton>}\r\n />\r\n )\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?.includes(opt.value)} />}\r\n onClick={() => {\r\n const has = value?.includes(opt.value)\r\n onChange(has ? value?.filter(v => v !== opt.value) : [...value || [], 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 MultiSelectFilter"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiSelectFilter.js","sources":["../../../src/DataFilter/options/MultiSelectFilter.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 Add from \"@xanui/icons/Add\";\r\nimport ClearAll from \"@xanui/icons/ClearAll\";\r\nimport Chip from \"../../Chip\";\r\nimport Close from \"@xanui/icons/Close\";\r\n\r\n\r\ntype Props = {\r\n option: DataFilterSelect;\r\n value: string[];\r\n onChange: (value: string[]) => void;\r\n}\r\n\r\nconst MultiSelectFilter = ({ option, onChange, value }: Props) => {\r\n const ref: any = React.useRef(null)\r\n const [target, setTarget] = React.useState<HTMLElement | undefined>()\r\n const isValue = value && value.length > 0;\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={(e: any) => {\r\n setTarget(e.currentTarget)\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([]);\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 && value.map((val, index) => {\r\n return (\r\n <Chip\r\n key={index}\r\n size=\"small\"\r\n color=\"default\"\r\n label={val}\r\n endIcon={<IconButton\r\n size={16}\r\n variant={\"text\"}\r\n color=\"default\"\r\n onClick={() => {\r\n onChange(value.filter(v => v !== val));\r\n }}\r\n >\r\n <Close />\r\n </IconButton>}\r\n />\r\n )\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?.includes(opt.value)} />}\r\n onClick={() => {\r\n const has = value?.includes(opt.value)\r\n onChange(has ? value?.filter(v => v !== opt.value) : [...value || [], 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 MultiSelectFilter"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA;;;;;AAIG;AAwBkB;;;AAYA;AAcH;AAWY;;AAOf;AAeY;AACA;AACH;AAUxB;;"}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var ClearAll = require('@xanui/icons/ClearAll');
|
|
10
|
-
var index$3 = require('../../InputNumber/index.js');
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import IconButton from '../../IconButton/index.js';
|
|
4
|
+
import Stack from '../../Stack/index.js';
|
|
5
|
+
import Text from '../../Text/index.js';
|
|
6
|
+
import Add from '@xanui/icons/Add';
|
|
7
|
+
import ClearAll from '@xanui/icons/ClearAll';
|
|
8
|
+
import InputNumber from '../../InputNumber/index.js';
|
|
11
9
|
|
|
12
10
|
const NumberFilter = ({ option, onChange, value }) => {
|
|
13
11
|
const isValue = value !== null && value !== undefined;
|
|
14
|
-
return (
|
|
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: () => {
|
|
15
13
|
onChange(0);
|
|
16
|
-
}, children:
|
|
14
|
+
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
17
15
|
onChange(null);
|
|
18
|
-
}, children:
|
|
16
|
+
}, children: jsx(ClearAll, {}) })] })] }), jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", children: isValue && jsx(InputNumber, { variant: "outline", value: value.toString(), onChange: (e) => {
|
|
19
17
|
onChange(e.target.value);
|
|
20
18
|
}, fullWidth: true }) })] }));
|
|
21
19
|
};
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
export { NumberFilter as default };
|
|
24
22
|
//# sourceMappingURL=NumberFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberFilter.js","sources":["../../../src/DataFilter/options/NumberFilter.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 | null;\r\n onChange: (value: number | null) => void;\r\n}\r\n\r\nconst NumberFilter = ({ 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(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 && <InputNumber\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 NumberFilter"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NumberFilter.js","sources":["../../../src/DataFilter/options/NumberFilter.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 | null;\r\n onChange: (value: number | null) => void;\r\n}\r\n\r\nconst NumberFilter = ({ 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(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 && <InputNumber\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 NumberFilter"],"names":[],"mappings":";;;;;;;;;AAgBA;;AAIG;;;;;AAqDkB;AACH;AAOlB;;"}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var ClearAll = require('@xanui/icons/ClearAll');
|
|
10
|
-
var index$3 = require('../../InputNumber/index.js');
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import IconButton from '../../IconButton/index.js';
|
|
4
|
+
import Stack from '../../Stack/index.js';
|
|
5
|
+
import Text from '../../Text/index.js';
|
|
6
|
+
import Add from '@xanui/icons/Add';
|
|
7
|
+
import ClearAll from '@xanui/icons/ClearAll';
|
|
8
|
+
import InputNumber from '../../InputNumber/index.js';
|
|
11
9
|
|
|
12
10
|
const NumberRangeFilter = ({ option, onChange, value }) => {
|
|
13
11
|
var _a, _b;
|
|
14
12
|
const isValue = value !== null && value !== undefined && Array.isArray(value) && value.length === 2;
|
|
15
|
-
return (
|
|
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: () => {
|
|
16
14
|
onChange([0, 0]);
|
|
17
|
-
}, children:
|
|
15
|
+
}, children: jsx(Add, {}) }), isValue && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
18
16
|
onChange(null);
|
|
19
|
-
}, children:
|
|
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) => {
|
|
20
18
|
const val = e.target.value === '' ? 0 : Number(e.target.value);
|
|
21
19
|
onChange([val, value ? value[1] : 0]);
|
|
22
|
-
} }),
|
|
20
|
+
} }), jsx(InputNumber, { variant: "outline", flex: 1, size: "small", placeholder: "Max", value: (_b = value[1]) !== null && _b !== void 0 ? _b : undefined, onChange: (e) => {
|
|
23
21
|
const val = e.target.value === '' ? 0 : Number(e.target.value);
|
|
24
22
|
onChange([value ? value[0] : 0, val]);
|
|
25
23
|
} })] }) })] }));
|
|
26
24
|
};
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
export { NumberRangeFilter as default };
|
|
29
27
|
//# sourceMappingURL=NumberRangeFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberRangeFilter.js","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":"
|
|
1
|
+
{"version":3,"file":"NumberRangeFilter.js","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,34 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var ClearAll = require('@xanui/icons/ClearAll');
|
|
16
|
-
var index$3 = require('../../Chip/index.js');
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Menu from '../../Menu/index.js';
|
|
5
|
+
import List from '../../List/index.js';
|
|
6
|
+
import ListItem from '../../ListItem/index.js';
|
|
7
|
+
import Checkbox from '../../Checkbox/index.js';
|
|
8
|
+
import IconButton from '../../IconButton/index.js';
|
|
9
|
+
import Stack from '../../Stack/index.js';
|
|
10
|
+
import Text from '../../Text/index.js';
|
|
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.js';
|
|
17
15
|
|
|
18
16
|
const SelectFilter = ({ option, onChange, value }) => {
|
|
19
17
|
var _a;
|
|
20
18
|
const ref = React.useRef(null);
|
|
21
19
|
const [target, setTarget] = React.useState();
|
|
22
|
-
return (
|
|
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) => {
|
|
23
21
|
setTarget(e.currentTarget);
|
|
24
|
-
}, children:
|
|
22
|
+
}, children: jsx(Add, {}) }), !!value && jsx(IconButton, { size: "small", variant: "soft", color: "danger", onClick: () => {
|
|
25
23
|
onChange(null);
|
|
26
|
-
}, children:
|
|
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: () => {
|
|
27
25
|
onChange(null);
|
|
28
|
-
}, children:
|
|
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: () => {
|
|
29
27
|
onChange(opt.value);
|
|
30
28
|
}, children: opt.label }, index))) }) })] }));
|
|
31
29
|
};
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
export { SelectFilter as default };
|
|
34
32
|
//# sourceMappingURL=SelectFilter.js.map
|