@xanui/ui 1.1.37 → 1.1.40
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.cjs +96 -0
- package/Accordion/index.cjs.map +1 -0
- package/Accordion/index.js +19 -21
- package/Accordion/index.js.map +1 -1
- package/Alert/index.cjs +121 -0
- package/Alert/index.cjs.map +1 -0
- package/Alert/index.js +33 -35
- package/Alert/index.js.map +1 -1
- package/Autocomplete/index.cjs +136 -0
- package/Autocomplete/index.cjs.map +1 -0
- package/Autocomplete/index.js +23 -25
- package/Autocomplete/index.js.map +1 -1
- package/Avatar/index.cjs +50 -0
- package/Avatar/index.cjs.map +1 -0
- package/Avatar/index.js +15 -17
- package/Avatar/index.js.map +1 -1
- package/Badge/index.cjs +109 -0
- package/Badge/index.cjs.map +1 -0
- package/Badge/index.js +12 -14
- package/Badge/index.js.map +1 -1
- package/Box/index.cjs +14 -0
- package/Box/index.cjs.map +1 -0
- package/Box/index.js +7 -9
- package/Box/index.js.map +1 -1
- package/Button/index.cjs +94 -0
- package/Button/index.cjs.map +1 -0
- package/Button/index.js +17 -19
- package/Button/index.js.map +1 -1
- package/ButtonGroup/index.cjs +58 -0
- package/ButtonGroup/index.cjs.map +1 -0
- package/ButtonGroup/index.js +12 -14
- package/ButtonGroup/index.js.map +1 -1
- package/Calendar/index.cjs +174 -0
- package/Calendar/index.cjs.map +1 -0
- package/Calendar/index.js +39 -41
- package/Calendar/index.js.map +1 -1
- package/CalendarInput/index.cjs +34 -0
- package/CalendarInput/index.cjs.map +1 -0
- package/CalendarInput/index.js +19 -21
- package/CalendarInput/index.js.map +1 -1
- package/Checkbox/index.cjs +58 -0
- package/Checkbox/index.cjs.map +1 -0
- package/Checkbox/index.js +14 -16
- package/Checkbox/index.js.map +1 -1
- package/Chip/index.cjs +76 -0
- package/Chip/index.cjs.map +1 -0
- package/Chip/index.js +12 -14
- package/Chip/index.js.map +1 -1
- package/CircleProgress/index.cjs +129 -0
- package/CircleProgress/index.cjs.map +1 -0
- package/CircleProgress/index.js +13 -15
- package/CircleProgress/index.js.map +1 -1
- package/ClickOutside/index.cjs +37 -0
- package/ClickOutside/index.cjs.map +1 -0
- package/ClickOutside/index.js +9 -11
- package/ClickOutside/index.js.map +1 -1
- package/Collaps/index.cjs +26 -0
- package/Collaps/index.cjs.map +1 -0
- package/Collaps/index.js +9 -11
- package/Collaps/index.js.map +1 -1
- package/Container/index.cjs +29 -0
- package/Container/index.cjs.map +1 -0
- package/Container/index.js +9 -11
- package/Container/index.js.map +1 -1
- package/DataFilter/index.cjs +78 -0
- package/DataFilter/index.cjs.map +1 -0
- package/DataFilter/index.js +30 -41
- package/DataFilter/index.js.map +1 -1
- package/DataFilter/options/DateFilter.cjs +32 -0
- package/DataFilter/options/DateFilter.cjs.map +1 -0
- package/DataFilter/options/DateFilter.js +16 -18
- package/DataFilter/options/DateFilter.js.map +1 -1
- package/DataFilter/options/DateRangeFilter.cjs +27 -0
- package/DataFilter/options/DateRangeFilter.cjs.map +1 -0
- package/DataFilter/options/DateRangeFilter.js +12 -14
- package/DataFilter/options/DateRangeFilter.js.map +1 -1
- package/DataFilter/options/MultiSelectFilter.cjs +38 -0
- package/DataFilter/options/MultiSelectFilter.cjs.map +1 -0
- package/DataFilter/options/MultiSelectFilter.js +20 -22
- package/DataFilter/options/MultiSelectFilter.js.map +1 -1
- package/DataFilter/options/NumberFilter.cjs +24 -0
- package/DataFilter/options/NumberFilter.cjs.map +1 -0
- package/DataFilter/options/NumberFilter.js +11 -13
- package/DataFilter/options/NumberFilter.js.map +1 -1
- package/DataFilter/options/NumberRangeFilter.cjs +29 -0
- package/DataFilter/options/NumberRangeFilter.cjs.map +1 -0
- package/DataFilter/options/NumberRangeFilter.js +12 -14
- package/DataFilter/options/NumberRangeFilter.js.map +1 -1
- package/DataFilter/options/SelectFilter.cjs +34 -0
- package/DataFilter/options/SelectFilter.cjs.map +1 -0
- package/DataFilter/options/SelectFilter.js +18 -20
- package/DataFilter/options/SelectFilter.js.map +1 -1
- package/DataFilter/options/TextFilter.cjs +24 -0
- package/DataFilter/options/TextFilter.cjs.map +1 -0
- package/DataFilter/options/TextFilter.js +11 -13
- package/DataFilter/options/TextFilter.js.map +1 -1
- package/Datatable/FilterBox.cjs +39 -0
- package/Datatable/FilterBox.cjs.map +1 -0
- package/Datatable/FilterBox.js +21 -23
- package/Datatable/FilterBox.js.map +1 -1
- package/Datatable/Row.cjs +59 -0
- package/Datatable/Row.cjs.map +1 -0
- package/Datatable/Row.js +19 -21
- package/Datatable/Row.js.map +1 -1
- package/Datatable/SelectedBox.cjs +21 -0
- package/Datatable/SelectedBox.cjs.map +1 -0
- package/Datatable/SelectedBox.js +10 -12
- package/Datatable/SelectedBox.js.map +1 -1
- package/Datatable/Table.cjs +23 -0
- package/Datatable/Table.cjs.map +1 -0
- package/Datatable/Table.js +8 -10
- package/Datatable/Table.js.map +1 -1
- package/Datatable/TableHead.cjs +61 -0
- package/Datatable/TableHead.cjs.map +1 -0
- package/Datatable/TableHead.js +18 -20
- package/Datatable/TableHead.js.map +1 -1
- package/Datatable/index.cjs +93 -0
- package/Datatable/index.cjs.map +1 -0
- package/Datatable/index.js +21 -23
- package/Datatable/index.js.map +1 -1
- package/Divider/index.cjs +31 -0
- package/Divider/index.cjs.map +1 -0
- package/Divider/index.js +8 -10
- package/Divider/index.js.map +1 -1
- package/Drawer/index.cjs +78 -0
- package/Drawer/index.cjs.map +1 -0
- package/Drawer/index.js +12 -14
- package/Drawer/index.js.map +1 -1
- package/Form/index.cjs +45 -0
- package/Form/index.cjs.map +1 -0
- package/Form/index.js +8 -10
- package/Form/index.js.map +1 -1
- package/GridContainer/index.cjs +19 -0
- package/GridContainer/index.cjs.map +1 -0
- package/GridContainer/index.js +7 -9
- package/GridContainer/index.js.map +1 -1
- package/GridItem/index.cjs +20 -0
- package/GridItem/index.cjs.map +1 -0
- package/GridItem/index.js +7 -9
- package/GridItem/index.js.map +1 -1
- package/IconButton/index.cjs +64 -0
- package/IconButton/index.cjs.map +1 -0
- package/IconButton/index.js +12 -14
- package/IconButton/index.js.map +1 -1
- package/Image/index.cjs +27 -0
- package/Image/index.cjs.map +1 -0
- package/Image/index.js +9 -11
- package/Image/index.js.map +1 -1
- package/Input/index.cjs +144 -0
- package/Input/index.cjs.map +1 -0
- package/Input/index.js +18 -20
- package/Input/index.js.map +1 -1
- package/InputNumber/index.cjs +32 -0
- package/InputNumber/index.cjs.map +1 -0
- package/InputNumber/index.js +6 -8
- package/InputNumber/index.js.map +1 -1
- package/Label/index.cjs +24 -0
- package/Label/index.cjs.map +1 -0
- package/Label/index.js +7 -9
- package/Label/index.js.map +1 -1
- package/Layer/index.cjs +62 -0
- package/Layer/index.cjs.map +1 -0
- package/Layer/index.js +19 -21
- package/Layer/index.js.map +1 -1
- package/LineProgress/index.cjs +59 -0
- package/LineProgress/index.cjs.map +1 -0
- package/LineProgress/index.js +11 -13
- package/LineProgress/index.js.map +1 -1
- package/List/ListContext.cjs +11 -0
- package/List/ListContext.cjs.map +1 -0
- package/List/ListContext.js +2 -5
- package/List/ListContext.js.map +1 -1
- package/List/index.cjs +63 -0
- package/List/index.cjs.map +1 -0
- package/List/index.js +12 -14
- package/List/index.js.map +1 -1
- package/ListItem/index.cjs +54 -0
- package/ListItem/index.cjs.map +1 -0
- package/ListItem/index.js +12 -14
- package/ListItem/index.js.map +1 -1
- package/LoadingBox/index.cjs +32 -0
- package/LoadingBox/index.cjs.map +1 -0
- package/LoadingBox/index.js +11 -13
- package/LoadingBox/index.js.map +1 -1
- package/Menu/index.cjs +150 -0
- package/Menu/index.cjs.map +1 -0
- package/Menu/index.js +18 -20
- package/Menu/index.js.map +1 -1
- package/Modal/index.cjs +59 -0
- package/Modal/index.cjs.map +1 -0
- package/Modal/index.js +15 -17
- package/Modal/index.js.map +1 -1
- package/NoSSR/index.cjs +15 -0
- package/NoSSR/index.cjs.map +1 -0
- package/NoSSR/index.js +4 -6
- package/NoSSR/index.js.map +1 -1
- package/Option/index.cjs +14 -0
- package/Option/index.cjs.map +1 -0
- package/Option/index.js +7 -9
- package/Option/index.js.map +1 -1
- package/Paper/index.cjs +15 -0
- package/Paper/index.cjs.map +1 -0
- package/Paper/index.js +8 -10
- package/Paper/index.js.map +1 -1
- package/Portal/index.cjs +27 -0
- package/Portal/index.cjs.map +1 -0
- package/Portal/index.js +9 -11
- package/Portal/index.js.map +1 -1
- package/Radio/index.cjs +16 -0
- package/Radio/index.cjs.map +1 -0
- package/Radio/index.js +9 -11
- package/Radio/index.js.map +1 -1
- package/Scrollbar/index.cjs +59 -0
- package/Scrollbar/index.cjs.map +1 -0
- package/Scrollbar/index.js +10 -12
- package/Scrollbar/index.js.map +1 -1
- package/Select/index.cjs +59 -0
- package/Select/index.cjs.map +1 -0
- package/Select/index.js +22 -24
- package/Select/index.js.map +1 -1
- package/Skeleton/index.cjs +60 -0
- package/Skeleton/index.cjs.map +1 -0
- package/Skeleton/index.js +7 -9
- package/Skeleton/index.js.map +1 -1
- package/Stack/index.cjs +17 -0
- package/Stack/index.cjs.map +1 -0
- package/Stack/index.js +7 -9
- package/Stack/index.js.map +1 -1
- package/Switch/index.cjs +79 -0
- package/Switch/index.cjs.map +1 -0
- package/Switch/index.js +12 -14
- package/Switch/index.js.map +1 -1
- package/Tab/index.cjs +17 -0
- package/Tab/index.cjs.map +1 -0
- package/Tab/index.js +9 -11
- package/Tab/index.js.map +1 -1
- package/Table/index.cjs +88 -0
- package/Table/index.cjs.map +1 -0
- package/Table/index.js +13 -15
- package/Table/index.js.map +1 -1
- package/TableBody/index.cjs +14 -0
- package/TableBody/index.cjs.map +1 -0
- package/TableBody/index.js +7 -9
- package/TableBody/index.js.map +1 -1
- package/TableCell/index.cjs +14 -0
- package/TableCell/index.cjs.map +1 -0
- package/TableCell/index.js +7 -9
- package/TableCell/index.js.map +1 -1
- package/TableFooter/index.cjs +14 -0
- package/TableFooter/index.cjs.map +1 -0
- package/TableFooter/index.js +7 -9
- package/TableFooter/index.js.map +1 -1
- package/TableHead/index.cjs +14 -0
- package/TableHead/index.cjs.map +1 -0
- package/TableHead/index.js +7 -9
- package/TableHead/index.js.map +1 -1
- package/TablePagination/index.cjs +59 -0
- package/TablePagination/index.cjs.map +1 -0
- package/TablePagination/index.js +21 -23
- package/TablePagination/index.js.map +1 -1
- package/TableRow/index.cjs +14 -0
- package/TableRow/index.cjs.map +1 -0
- package/TableRow/index.js +7 -9
- package/TableRow/index.js.map +1 -1
- package/Tabs/index.cjs +201 -0
- package/Tabs/index.cjs.map +1 -0
- package/Tabs/index.js +19 -21
- package/Tabs/index.js.map +1 -1
- package/Text/index.cjs +25 -0
- package/Text/index.cjs.map +1 -0
- package/Text/index.js +8 -10
- package/Text/index.js.map +1 -1
- package/Toast/index.cjs +120 -0
- package/Toast/index.cjs.map +1 -0
- package/Toast/index.js +18 -20
- package/Toast/index.js.map +1 -1
- package/Tooltip/index.cjs +40 -0
- package/Tooltip/index.cjs.map +1 -0
- package/Tooltip/index.js +11 -13
- package/Tooltip/index.js.map +1 -1
- package/ViewBox/index.cjs +32 -0
- package/ViewBox/index.cjs.map +1 -0
- package/ViewBox/index.js +11 -13
- package/ViewBox/index.js.map +1 -1
- package/index.cjs +134 -0
- package/index.cjs.map +1 -0
- package/index.js +64 -133
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/readme.md +4 -4
- package/useAlert/index.cjs +94 -0
- package/useAlert/index.cjs.map +1 -0
- package/useAlert/index.js +12 -14
- package/useAlert/index.js.map +1 -1
- package/useBlurCss/index.cjs +19 -0
- package/useBlurCss/index.cjs.map +1 -0
- package/useBlurCss/index.js +5 -7
- package/useBlurCss/index.js.map +1 -1
- package/useCorner/index.cjs +22 -0
- package/useCorner/index.cjs.map +1 -0
- package/useCorner/index.js +1 -3
- package/useCorner/index.js.map +1 -1
- package/useLayer/index.cjs +38 -0
- package/useLayer/index.cjs.map +1 -0
- package/useLayer/index.js +7 -9
- package/useLayer/index.js.map +1 -1
- package/useModal/index.cjs +37 -0
- package/useModal/index.cjs.map +1 -0
- package/useModal/index.js +8 -10
- package/useModal/index.js.map +1 -1
package/Drawer/index.cjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var core = require('@xanui/core');
|
|
7
|
+
var index = require('../Layer/index.cjs');
|
|
8
|
+
var index$1 = require('../ClickOutside/index.cjs');
|
|
9
|
+
|
|
10
|
+
const getVariant = (placement) => {
|
|
11
|
+
switch (placement) {
|
|
12
|
+
case "right":
|
|
13
|
+
return "fadeLeft";
|
|
14
|
+
case "top":
|
|
15
|
+
return "fadeDown";
|
|
16
|
+
case "bottom":
|
|
17
|
+
return "fadeUp";
|
|
18
|
+
default:
|
|
19
|
+
return "fadeRight";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const Drawer = (_a) => {
|
|
23
|
+
var _b;
|
|
24
|
+
var { children, placement, size, slotProps, onClickOutside } = _a, layerProps = tslib.__rest(_a, ["children", "placement", "size", "slotProps", "onClickOutside"]);
|
|
25
|
+
const _p = {};
|
|
26
|
+
if (placement)
|
|
27
|
+
_p.placement = placement;
|
|
28
|
+
if (size)
|
|
29
|
+
_p.size = size;
|
|
30
|
+
const p = core.useBreakpointProps(_p);
|
|
31
|
+
placement = (_b = p.placement) !== null && _b !== void 0 ? _b : 'left';
|
|
32
|
+
size = p.size || "medium";
|
|
33
|
+
let isSide = placement === 'left' || placement === 'right';
|
|
34
|
+
let sizes = {
|
|
35
|
+
small: 220,
|
|
36
|
+
medium: 330,
|
|
37
|
+
large: 440
|
|
38
|
+
};
|
|
39
|
+
let _size = sizes[size] || size;
|
|
40
|
+
return (jsxRuntime.jsx(index, Object.assign({}, layerProps, slotProps === null || slotProps === void 0 ? void 0 : slotProps.layer, { transition: getVariant(placement), children: jsxRuntime.jsx(core.Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { baseClass: 'drawer', sxr: {
|
|
41
|
+
width: "100vw",
|
|
42
|
+
height: "100vh",
|
|
43
|
+
display: "flex",
|
|
44
|
+
direction: isSide ? "row" : "column",
|
|
45
|
+
justifyContent: placement === 'left' || placement === 'top' ? "flex-start" : "flex-end"
|
|
46
|
+
}, children: jsxRuntime.jsx(index$1, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: jsxRuntime.jsx(core.Tag, { sxr: {
|
|
47
|
+
width: isSide ? _size : "100%",
|
|
48
|
+
height: isSide ? "100%" : _size,
|
|
49
|
+
bgcolor: "background.primary",
|
|
50
|
+
shadow: 20
|
|
51
|
+
}, baseClass: 'drawer-content', children: children }) })) })) })));
|
|
52
|
+
};
|
|
53
|
+
Drawer.open = (children, props) => {
|
|
54
|
+
const d = core.Renderar.render(Drawer, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
|
|
55
|
+
d.unrender();
|
|
56
|
+
}, onClickOutside: () => {
|
|
57
|
+
if (props === null || props === void 0 ? void 0 : props.onClickOutside) {
|
|
58
|
+
props.onClickOutside();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
d.updateProps({ open: false });
|
|
62
|
+
}
|
|
63
|
+
} }));
|
|
64
|
+
return {
|
|
65
|
+
open: () => {
|
|
66
|
+
d.updateProps({ open: true });
|
|
67
|
+
},
|
|
68
|
+
close: () => {
|
|
69
|
+
d.updateProps({ open: false });
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
Drawer.close = () => {
|
|
74
|
+
core.Renderar.unrender(Drawer);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
module.exports = Drawer;
|
|
78
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Drawer/index.tsx"],"sourcesContent":["'use client'\r\nimport { Renderar, Tag, TagProps, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\r\nimport Layer, { LayerProps } from '../Layer';\r\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\r\n\r\n\r\nexport type DrawerProps = Omit<LayerProps, \"transition\" | \"slotProps\"> & {\r\n placement?: useBreakpointPropsType<\"left\" | \"right\" | \"bottom\" | \"top\">;\r\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\r\n onClickOutside?: () => void;\r\n slotProps?: {\r\n layer?: Partial<Omit<LayerProps, \"children\">>\r\n root?: TagProps<\"div\">;\r\n content?: TagProps<\"div\">;\r\n clickOutside?: Omit<ClickOutsideProps, \"children\" | \"onClickOutside\">;\r\n }\r\n}\r\n\r\nconst getVariant = (placement?: any) => {\r\n switch (placement) {\r\n case \"right\":\r\n return \"fadeLeft\"\r\n case \"top\":\r\n return \"fadeDown\"\r\n case \"bottom\":\r\n return \"fadeUp\"\r\n default:\r\n return \"fadeRight\"\r\n }\r\n}\r\n\r\nconst Drawer = ({ children, placement, size, slotProps, onClickOutside, ...layerProps }: DrawerProps) => {\r\n const _p: any = {}\r\n if (placement) _p.placement = placement\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n\r\n placement = p.placement ?? 'left'\r\n size = p.size || \"medium\"\r\n\r\n let isSide = placement === 'left' || placement === 'right'\r\n let sizes: any = {\r\n small: 220,\r\n medium: 330,\r\n large: 440\r\n }\r\n\r\n let _size = sizes[size as any] || size\r\n\r\n return (\r\n <Layer\r\n {...layerProps}\r\n {...slotProps?.layer}\r\n transition={getVariant(placement)}\r\n >\r\n <Tag\r\n {...slotProps?.root}\r\n baseClass='drawer'\r\n sxr={{\r\n width: \"100vw\",\r\n height: \"100vh\",\r\n display: \"flex\",\r\n direction: isSide ? \"row\" : \"column\" as any,\r\n justifyContent: placement === 'left' || placement === 'top' ? \"flex-start\" : \"flex-end\"\r\n }}\r\n >\r\n <ClickOutside\r\n {...slotProps?.clickOutside}\r\n onClickOutside={onClickOutside || (() => { })}\r\n >\r\n <Tag\r\n sxr={{\r\n width: isSide ? _size : \"100%\",\r\n height: isSide ? \"100%\" : _size,\r\n bgcolor: \"background.primary\",\r\n shadow: 20\r\n }}\r\n baseClass='drawer-content'\r\n >\r\n {children}\r\n </Tag>\r\n </ClickOutside>\r\n </Tag>\r\n </Layer>\r\n )\r\n}\r\n\r\n\r\nDrawer.open = (children: DrawerProps[\"children\"], props?: Omit<DrawerProps, \"children\" | \"open\">) => {\r\n const d = Renderar.render(Drawer as any, {\r\n open: true,\r\n ...props,\r\n children,\r\n onClosed: () => {\r\n d.unrender()\r\n },\r\n onClickOutside: () => {\r\n if (props?.onClickOutside) {\r\n props.onClickOutside()\r\n } else {\r\n d.updateProps({ open: false })\r\n }\r\n }\r\n })\r\n\r\n return {\r\n open: () => {\r\n d.updateProps({ open: true })\r\n },\r\n close: () => {\r\n d.updateProps({ open: false })\r\n },\r\n }\r\n}\r\n\r\nDrawer.close = () => {\r\n Renderar.unrender(Drawer as any)\r\n}\r\n\r\nexport default Drawer"],"names":[],"mappings":";;;;;;;;;AAkBA;;AAEQ;AACI;AACJ;AACI;AACJ;AACI;AACJ;AACI;;AAEZ;AAEA;;AAAgB;;AAEZ;AAAe;AACf;AAAU;AACV;AAEA;AACA;;AAGA;AACI;AACA;AACA;;;AAKJ;AAUgB;AACA;AACA;;AAEA;;;;AAWQ;AACA;;AAU5B;AAGA;AACI;;AAMI;;;;;;;AAOA;;;;;;;;;AAWR;AAEA;AACI;AACJ;;"}
|
package/Drawer/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var index = require('../Layer/index.js');
|
|
8
|
-
var index$1 = require('../ClickOutside/index.js');
|
|
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.js';
|
|
6
|
+
import ClickOutside from '../ClickOutside/index.js';
|
|
9
7
|
|
|
10
8
|
const getVariant = (placement) => {
|
|
11
9
|
switch (placement) {
|
|
@@ -21,13 +19,13 @@ const getVariant = (placement) => {
|
|
|
21
19
|
};
|
|
22
20
|
const Drawer = (_a) => {
|
|
23
21
|
var _b;
|
|
24
|
-
var { children, placement, size, slotProps, onClickOutside } = _a, layerProps =
|
|
22
|
+
var { children, placement, size, slotProps, onClickOutside } = _a, layerProps = __rest(_a, ["children", "placement", "size", "slotProps", "onClickOutside"]);
|
|
25
23
|
const _p = {};
|
|
26
24
|
if (placement)
|
|
27
25
|
_p.placement = placement;
|
|
28
26
|
if (size)
|
|
29
27
|
_p.size = size;
|
|
30
|
-
const p =
|
|
28
|
+
const p = useBreakpointProps(_p);
|
|
31
29
|
placement = (_b = p.placement) !== null && _b !== void 0 ? _b : 'left';
|
|
32
30
|
size = p.size || "medium";
|
|
33
31
|
let isSide = placement === 'left' || placement === 'right';
|
|
@@ -37,13 +35,13 @@ const Drawer = (_a) => {
|
|
|
37
35
|
large: 440
|
|
38
36
|
};
|
|
39
37
|
let _size = sizes[size] || size;
|
|
40
|
-
return (
|
|
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: {
|
|
41
39
|
width: "100vw",
|
|
42
40
|
height: "100vh",
|
|
43
41
|
display: "flex",
|
|
44
42
|
direction: isSide ? "row" : "column",
|
|
45
43
|
justifyContent: placement === 'left' || placement === 'top' ? "flex-start" : "flex-end"
|
|
46
|
-
}, children:
|
|
44
|
+
}, children: jsx(ClickOutside, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: jsx(Tag, { sxr: {
|
|
47
45
|
width: isSide ? _size : "100%",
|
|
48
46
|
height: isSide ? "100%" : _size,
|
|
49
47
|
bgcolor: "background.primary",
|
|
@@ -51,7 +49,7 @@ const Drawer = (_a) => {
|
|
|
51
49
|
}, baseClass: 'drawer-content', children: children }) })) })) })));
|
|
52
50
|
};
|
|
53
51
|
Drawer.open = (children, props) => {
|
|
54
|
-
const d =
|
|
52
|
+
const d = Renderar.render(Drawer, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
|
|
55
53
|
d.unrender();
|
|
56
54
|
}, onClickOutside: () => {
|
|
57
55
|
if (props === null || props === void 0 ? void 0 : props.onClickOutside) {
|
|
@@ -71,8 +69,8 @@ Drawer.open = (children, props) => {
|
|
|
71
69
|
};
|
|
72
70
|
};
|
|
73
71
|
Drawer.close = () => {
|
|
74
|
-
|
|
72
|
+
Renderar.unrender(Drawer);
|
|
75
73
|
};
|
|
76
74
|
|
|
77
|
-
|
|
75
|
+
export { Drawer as default };
|
|
78
76
|
//# sourceMappingURL=index.js.map
|
package/Drawer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Drawer/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Drawer/index.tsx"],"sourcesContent":["'use client'\r\nimport { Renderar, Tag, TagProps, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\r\nimport Layer, { LayerProps } from '../Layer';\r\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\r\n\r\n\r\nexport type DrawerProps = Omit<LayerProps, \"transition\" | \"slotProps\"> & {\r\n placement?: useBreakpointPropsType<\"left\" | \"right\" | \"bottom\" | \"top\">;\r\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\r\n onClickOutside?: () => void;\r\n slotProps?: {\r\n layer?: Partial<Omit<LayerProps, \"children\">>\r\n root?: TagProps<\"div\">;\r\n content?: TagProps<\"div\">;\r\n clickOutside?: Omit<ClickOutsideProps, \"children\" | \"onClickOutside\">;\r\n }\r\n}\r\n\r\nconst getVariant = (placement?: any) => {\r\n switch (placement) {\r\n case \"right\":\r\n return \"fadeLeft\"\r\n case \"top\":\r\n return \"fadeDown\"\r\n case \"bottom\":\r\n return \"fadeUp\"\r\n default:\r\n return \"fadeRight\"\r\n }\r\n}\r\n\r\nconst Drawer = ({ children, placement, size, slotProps, onClickOutside, ...layerProps }: DrawerProps) => {\r\n const _p: any = {}\r\n if (placement) _p.placement = placement\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n\r\n placement = p.placement ?? 'left'\r\n size = p.size || \"medium\"\r\n\r\n let isSide = placement === 'left' || placement === 'right'\r\n let sizes: any = {\r\n small: 220,\r\n medium: 330,\r\n large: 440\r\n }\r\n\r\n let _size = sizes[size as any] || size\r\n\r\n return (\r\n <Layer\r\n {...layerProps}\r\n {...slotProps?.layer}\r\n transition={getVariant(placement)}\r\n >\r\n <Tag\r\n {...slotProps?.root}\r\n baseClass='drawer'\r\n sxr={{\r\n width: \"100vw\",\r\n height: \"100vh\",\r\n display: \"flex\",\r\n direction: isSide ? \"row\" : \"column\" as any,\r\n justifyContent: placement === 'left' || placement === 'top' ? \"flex-start\" : \"flex-end\"\r\n }}\r\n >\r\n <ClickOutside\r\n {...slotProps?.clickOutside}\r\n onClickOutside={onClickOutside || (() => { })}\r\n >\r\n <Tag\r\n sxr={{\r\n width: isSide ? _size : \"100%\",\r\n height: isSide ? \"100%\" : _size,\r\n bgcolor: \"background.primary\",\r\n shadow: 20\r\n }}\r\n baseClass='drawer-content'\r\n >\r\n {children}\r\n </Tag>\r\n </ClickOutside>\r\n </Tag>\r\n </Layer>\r\n )\r\n}\r\n\r\n\r\nDrawer.open = (children: DrawerProps[\"children\"], props?: Omit<DrawerProps, \"children\" | \"open\">) => {\r\n const d = Renderar.render(Drawer as any, {\r\n open: true,\r\n ...props,\r\n children,\r\n onClosed: () => {\r\n d.unrender()\r\n },\r\n onClickOutside: () => {\r\n if (props?.onClickOutside) {\r\n props.onClickOutside()\r\n } else {\r\n d.updateProps({ open: false })\r\n }\r\n }\r\n })\r\n\r\n return {\r\n open: () => {\r\n d.updateProps({ open: true })\r\n },\r\n close: () => {\r\n d.updateProps({ open: false })\r\n },\r\n }\r\n}\r\n\r\nDrawer.close = () => {\r\n Renderar.unrender(Drawer as any)\r\n}\r\n\r\nexport default Drawer"],"names":[],"mappings":";;;;;;;AAkBA;;AAEQ;AACI;AACJ;AACI;AACJ;AACI;AACJ;AACI;;AAEZ;AAEA;;AAAgB;;AAEZ;AAAe;AACf;AAAU;AACV;AAEA;AACA;;AAGA;AACI;AACA;AACA;;;AAKJ;AAUgB;AACA;AACA;;AAEA;;;;AAWQ;AACA;;AAU5B;AAGA;AACI;;AAMI;;;;;;;AAOA;;;;;;;;;AAWR;AAEA;AACI;AACJ;;"}
|
package/Form/index.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var core = require('@xanui/core');
|
|
8
|
+
|
|
9
|
+
const Form = React.forwardRef((_a, ref) => {
|
|
10
|
+
var { children } = _a, rest = tslib.__rest(_a, ["children"]);
|
|
11
|
+
let formRef = ref || React.useRef(null);
|
|
12
|
+
const cloneAllChildren = (childs) => {
|
|
13
|
+
return React.Children.map(childs, (child) => {
|
|
14
|
+
let c = child;
|
|
15
|
+
if (React.isValidElement(child) && c.props.name) {
|
|
16
|
+
const form = formRef.current;
|
|
17
|
+
const formData = new FormData(form);
|
|
18
|
+
return React.cloneElement(child, {
|
|
19
|
+
onChange: () => {
|
|
20
|
+
console.log(formData.get(c.props.name));
|
|
21
|
+
},
|
|
22
|
+
value: formData.get(c.props.name),
|
|
23
|
+
children: cloneAllChildren(c.props.children),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return child;
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({ component: "form" }, rest, { onSubmit: (e) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
const form = formRef.current;
|
|
32
|
+
const formData = new FormData(form);
|
|
33
|
+
formData.forEach((value, key) => {
|
|
34
|
+
console.log(key + ": " + value);
|
|
35
|
+
});
|
|
36
|
+
}, sxr: {
|
|
37
|
+
bgcolor: "default",
|
|
38
|
+
p: 2,
|
|
39
|
+
maxWidth: 400,
|
|
40
|
+
radius: 1,
|
|
41
|
+
}, baseClass: 'form', ref: formRef, children: cloneAllChildren(children) })));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
module.exports = Form;
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Form/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { useRef } from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type FormProps<T extends TagComponentType = \"form\"> = TagProps<T> & {\r\n\r\n}\r\n\r\n\r\nconst Form = React.forwardRef(<T extends TagComponentType = \"form\">({ children, ...rest }: FormProps<T>, ref: React.Ref<any>) => {\r\n let formRef: any = ref || useRef(null)\r\n\r\n const cloneAllChildren: any = (childs: any) => {\r\n return React.Children.map(childs, (child: any) => {\r\n let c: any = child;\r\n if (React.isValidElement(child) && c.props.name) {\r\n const form = formRef.current\r\n const formData = new FormData(form);\r\n return React.cloneElement(child, {\r\n onChange: () => {\r\n console.log(formData.get(c.props.name));\r\n },\r\n value: formData.get(c.props.name),\r\n children: cloneAllChildren(c.props.children),\r\n } as any);\r\n }\r\n return child;\r\n });\r\n };\r\n\r\n return (\r\n <Tag\r\n component=\"form\"\r\n {...rest}\r\n onSubmit={(e) => {\r\n e.preventDefault()\r\n const form = formRef.current\r\n\r\n const formData = new FormData(form);\r\n\r\n formData.forEach((value, key) => {\r\n console.log(key + \": \" + value);\r\n });\r\n }}\r\n sxr={{\r\n bgcolor: \"default\",\r\n p: 2,\r\n maxWidth: 400,\r\n radius: 1,\r\n }}\r\n baseClass='form'\r\n ref={formRef}\r\n >\r\n {cloneAllChildren(children)}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default Form\r\n\r\n"],"names":[],"mappings":";;;;;;;;AASA;AAAoE;;AAGhE;;;AAGQ;AACI;AACA;AACA;;AAEQ;;;;AAIA;;AAEZ;AACJ;AACJ;AAEA;;AAMY;AAEA;;;AAIA;;AAGA;AACA;AACA;AACA;AACH;AAOb;;"}
|
package/Form/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var core = require('@xanui/core');
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import { Tag } from '@xanui/core';
|
|
8
6
|
|
|
9
7
|
const Form = React.forwardRef((_a, ref) => {
|
|
10
|
-
var { children } = _a, rest =
|
|
11
|
-
let formRef = ref ||
|
|
8
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
9
|
+
let formRef = ref || useRef(null);
|
|
12
10
|
const cloneAllChildren = (childs) => {
|
|
13
11
|
return React.Children.map(childs, (child) => {
|
|
14
12
|
let c = child;
|
|
@@ -26,7 +24,7 @@ const Form = React.forwardRef((_a, ref) => {
|
|
|
26
24
|
return child;
|
|
27
25
|
});
|
|
28
26
|
};
|
|
29
|
-
return (
|
|
27
|
+
return (jsx(Tag, Object.assign({ component: "form" }, rest, { onSubmit: (e) => {
|
|
30
28
|
e.preventDefault();
|
|
31
29
|
const form = formRef.current;
|
|
32
30
|
const formData = new FormData(form);
|
|
@@ -41,5 +39,5 @@ const Form = React.forwardRef((_a, ref) => {
|
|
|
41
39
|
}, baseClass: 'form', ref: formRef, children: cloneAllChildren(children) })));
|
|
42
40
|
});
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
export { Form as default };
|
|
45
43
|
//# sourceMappingURL=index.js.map
|
package/Form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Form/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Form/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { useRef } from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type FormProps<T extends TagComponentType = \"form\"> = TagProps<T> & {\r\n\r\n}\r\n\r\n\r\nconst Form = React.forwardRef(<T extends TagComponentType = \"form\">({ children, ...rest }: FormProps<T>, ref: React.Ref<any>) => {\r\n let formRef: any = ref || useRef(null)\r\n\r\n const cloneAllChildren: any = (childs: any) => {\r\n return React.Children.map(childs, (child: any) => {\r\n let c: any = child;\r\n if (React.isValidElement(child) && c.props.name) {\r\n const form = formRef.current\r\n const formData = new FormData(form);\r\n return React.cloneElement(child, {\r\n onChange: () => {\r\n console.log(formData.get(c.props.name));\r\n },\r\n value: formData.get(c.props.name),\r\n children: cloneAllChildren(c.props.children),\r\n } as any);\r\n }\r\n return child;\r\n });\r\n };\r\n\r\n return (\r\n <Tag\r\n component=\"form\"\r\n {...rest}\r\n onSubmit={(e) => {\r\n e.preventDefault()\r\n const form = formRef.current\r\n\r\n const formData = new FormData(form);\r\n\r\n formData.forEach((value, key) => {\r\n console.log(key + \": \" + value);\r\n });\r\n }}\r\n sxr={{\r\n bgcolor: \"default\",\r\n p: 2,\r\n maxWidth: 400,\r\n radius: 1,\r\n }}\r\n baseClass='form'\r\n ref={formRef}\r\n >\r\n {cloneAllChildren(children)}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default Form\r\n\r\n"],"names":[],"mappings":";;;;;;AASA;AAAoE;;AAGhE;;;AAGQ;AACI;AACA;AACA;;AAEQ;;;;AAIA;;AAEZ;AACJ;AACJ;AAEA;;AAMY;AAEA;;;AAIA;;AAGA;AACA;AACA;AACA;AACH;AAOb;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var core = require('@xanui/core');
|
|
7
|
+
|
|
8
|
+
const GridContainer = React.forwardRef((_a, ref) => {
|
|
9
|
+
var { children } = _a, rest = tslib.__rest(_a, ["children"]);
|
|
10
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({}, rest, { sxr: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
flexWrap: 'wrap',
|
|
14
|
+
width: '100%',
|
|
15
|
+
}, baseClass: 'grid-container', ref: ref, children: children })));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
module.exports = GridContainer;
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/GridContainer/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type GridContainerProps<T extends TagComponentType = \"div\"> = TagProps<T>\r\nconst GridContainer = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: GridContainerProps<T>, ref?: React.Ref<any>) => {\r\n return (\r\n <Tag\r\n {...rest}\r\n sxr={{\r\n display: \"flex\",\r\n flexDirection: 'row',\r\n flexWrap: 'wrap',\r\n width: '100%',\r\n }}\r\n baseClass='grid-container'\r\n ref={ref}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default GridContainer"],"names":["__rest","_jsx","Tag"],"mappings":";;;;;;;AAKA,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA4C,EAAE,GAAoB,KAAI;AAAtE,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAAkC,EAA7B,IAAI,GAAAA,YAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AAC3F,IAAA,QACIC,cAAA,CAACC,QAAG,oBACI,IAAI,EAAA,EACR,GAAG,EAAE;AACD,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,KAAK;AACpB,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,KAAK,EAAE,MAAM;SAChB,EACD,SAAS,EAAC,gBAAgB,EAC1B,GAAG,EAAE,GAAG,EAAA,QAAA,EAEP,QAAQ,EAAA,CAAA,CACP;AAEd,CAAC;;;;"}
|
package/GridContainer/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var core = require('@xanui/core');
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Tag } from '@xanui/core';
|
|
7
5
|
|
|
8
6
|
const GridContainer = React.forwardRef((_a, ref) => {
|
|
9
|
-
var { children } = _a, rest =
|
|
10
|
-
return (
|
|
7
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
8
|
+
return (jsx(Tag, Object.assign({}, rest, { sxr: {
|
|
11
9
|
display: "flex",
|
|
12
10
|
flexDirection: 'row',
|
|
13
11
|
flexWrap: 'wrap',
|
|
@@ -15,5 +13,5 @@ const GridContainer = React.forwardRef((_a, ref) => {
|
|
|
15
13
|
}, baseClass: 'grid-container', ref: ref, children: children })));
|
|
16
14
|
});
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
export { GridContainer as default };
|
|
19
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/GridContainer/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type GridContainerProps<T extends TagComponentType = \"div\"> = TagProps<T>\r\nconst GridContainer = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: GridContainerProps<T>, ref?: React.Ref<any>) => {\r\n return (\r\n <Tag\r\n {...rest}\r\n sxr={{\r\n display: \"flex\",\r\n flexDirection: 'row',\r\n flexWrap: 'wrap',\r\n width: '100%',\r\n }}\r\n baseClass='grid-container'\r\n ref={ref}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default GridContainer"],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/GridContainer/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type GridContainerProps<T extends TagComponentType = \"div\"> = TagProps<T>\r\nconst GridContainer = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: GridContainerProps<T>, ref?: React.Ref<any>) => {\r\n return (\r\n <Tag\r\n {...rest}\r\n sxr={{\r\n display: \"flex\",\r\n flexDirection: 'row',\r\n flexWrap: 'wrap',\r\n width: '100%',\r\n }}\r\n baseClass='grid-container'\r\n ref={ref}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default GridContainer"],"names":["_jsx"],"mappings":";;;;;AAKA,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA4C,EAAE,GAAoB,KAAI;AAAtE,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAAkC,EAA7B,IAAI,GAAA,MAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AAC3F,IAAA,QACIA,GAAA,CAAC,GAAG,oBACI,IAAI,EAAA,EACR,GAAG,EAAE;AACD,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,aAAa,EAAE,KAAK;AACpB,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,KAAK,EAAE,MAAM;SAChB,EACD,SAAS,EAAC,gBAAgB,EAC1B,GAAG,EAAE,GAAG,EAAA,QAAA,EAEP,QAAQ,EAAA,CAAA,CACP;AAEd,CAAC;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var core = require('@xanui/core');
|
|
7
|
+
|
|
8
|
+
const GridItem = React.forwardRef((_a, ref) => {
|
|
9
|
+
var { children, xs, sm, md, lg, xl } = _a, rest = tslib.__rest(_a, ["children", "xs", "sm", "md", "lg", "xl"]);
|
|
10
|
+
let w = {};
|
|
11
|
+
xs && (w.xs = (100 / 12 * xs) + "%");
|
|
12
|
+
sm && (w.sm = (100 / 12 * sm) + "%");
|
|
13
|
+
md && (w.md = (100 / 12 * md) + "%");
|
|
14
|
+
lg && (w.lg = (100 / 12 * lg) + "%");
|
|
15
|
+
xl && (w.xl = (100 / 12 * xl) + "%");
|
|
16
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({ ref: ref }, rest, { maxWidth: w, flexBasis: w, flexGrow: 0, baseClass: "grid-item", children: children })));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
module.exports = GridItem;
|
|
20
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/GridItem/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type GridItemProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\r\n xs?: number;\r\n sm?: number;\r\n md?: number;\r\n lg?: number;\r\n xl?: number;\r\n}\r\n\r\nconst GridItem = React.forwardRef(<T extends TagComponentType = \"div\">({ children, xs, sm, md, lg, xl, ...rest }: GridItemProps<T>, ref?: React.Ref<any>) => {\r\n\r\n let w: any = {}\r\n\r\n xs && (w.xs = (100 / 12 * xs) + \"%\")\r\n sm && (w.sm = (100 / 12 * sm) + \"%\")\r\n md && (w.md = (100 / 12 * md) + \"%\")\r\n lg && (w.lg = (100 / 12 * lg) + \"%\")\r\n xl && (w.xl = (100 / 12 * xl) + \"%\")\r\n\r\n return (\r\n <Tag\r\n ref={ref}\r\n {...rest}\r\n maxWidth={w}\r\n flexBasis={w}\r\n flexGrow={0}\r\n baseClass=\"grid-item\"\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default GridItem"],"names":["__rest","_jsx","Tag"],"mappings":";;;;;;;AAYA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA2D,EAAE,GAAoB,KAAI;AAArF,IAAA,IAAA,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAA,GAAA,EAA6B,EAAxB,IAAI,GAAAA,YAAA,CAAA,EAAA,EAAvC,0CAAyC,CAAF;IAE1G,IAAI,CAAC,GAAQ,EAAE;AAEf,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AAEpC,IAAA,QACIC,cAAA,CAACC,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EACA,GAAG,EAAE,GAAG,EAAA,EACJ,IAAI,EAAA,EACR,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,EACX,SAAS,EAAC,WAAW,EAAA,QAAA,EAEpB,QAAQ,EAAA,CAAA,CACP;AAEd,CAAC;;;;"}
|
package/GridItem/index.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var core = require('@xanui/core');
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Tag } from '@xanui/core';
|
|
7
5
|
|
|
8
6
|
const GridItem = React.forwardRef((_a, ref) => {
|
|
9
|
-
var { children, xs, sm, md, lg, xl } = _a, rest =
|
|
7
|
+
var { children, xs, sm, md, lg, xl } = _a, rest = __rest(_a, ["children", "xs", "sm", "md", "lg", "xl"]);
|
|
10
8
|
let w = {};
|
|
11
9
|
xs && (w.xs = (100 / 12 * xs) + "%");
|
|
12
10
|
sm && (w.sm = (100 / 12 * sm) + "%");
|
|
13
11
|
md && (w.md = (100 / 12 * md) + "%");
|
|
14
12
|
lg && (w.lg = (100 / 12 * lg) + "%");
|
|
15
13
|
xl && (w.xl = (100 / 12 * xl) + "%");
|
|
16
|
-
return (
|
|
14
|
+
return (jsx(Tag, Object.assign({ ref: ref }, rest, { maxWidth: w, flexBasis: w, flexGrow: 0, baseClass: "grid-item", children: children })));
|
|
17
15
|
});
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
export { GridItem as default };
|
|
20
18
|
//# sourceMappingURL=index.js.map
|
package/GridItem/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/GridItem/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type GridItemProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\r\n xs?: number;\r\n sm?: number;\r\n md?: number;\r\n lg?: number;\r\n xl?: number;\r\n}\r\n\r\nconst GridItem = React.forwardRef(<T extends TagComponentType = \"div\">({ children, xs, sm, md, lg, xl, ...rest }: GridItemProps<T>, ref?: React.Ref<any>) => {\r\n\r\n let w: any = {}\r\n\r\n xs && (w.xs = (100 / 12 * xs) + \"%\")\r\n sm && (w.sm = (100 / 12 * sm) + \"%\")\r\n md && (w.md = (100 / 12 * md) + \"%\")\r\n lg && (w.lg = (100 / 12 * lg) + \"%\")\r\n xl && (w.xl = (100 / 12 * xl) + \"%\")\r\n\r\n return (\r\n <Tag\r\n ref={ref}\r\n {...rest}\r\n maxWidth={w}\r\n flexBasis={w}\r\n flexGrow={0}\r\n baseClass=\"grid-item\"\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default GridItem"],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/GridItem/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type GridItemProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\r\n xs?: number;\r\n sm?: number;\r\n md?: number;\r\n lg?: number;\r\n xl?: number;\r\n}\r\n\r\nconst GridItem = React.forwardRef(<T extends TagComponentType = \"div\">({ children, xs, sm, md, lg, xl, ...rest }: GridItemProps<T>, ref?: React.Ref<any>) => {\r\n\r\n let w: any = {}\r\n\r\n xs && (w.xs = (100 / 12 * xs) + \"%\")\r\n sm && (w.sm = (100 / 12 * sm) + \"%\")\r\n md && (w.md = (100 / 12 * md) + \"%\")\r\n lg && (w.lg = (100 / 12 * lg) + \"%\")\r\n xl && (w.xl = (100 / 12 * xl) + \"%\")\r\n\r\n return (\r\n <Tag\r\n ref={ref}\r\n {...rest}\r\n maxWidth={w}\r\n flexBasis={w}\r\n flexGrow={0}\r\n baseClass=\"grid-item\"\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default GridItem"],"names":["_jsx"],"mappings":";;;;;AAYA,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA2D,EAAE,GAAoB,KAAI;AAArF,IAAA,IAAA,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAA,GAAA,EAA6B,EAAxB,IAAI,GAAA,MAAA,CAAA,EAAA,EAAvC,0CAAyC,CAAF;IAE1G,IAAI,CAAC,GAAQ,EAAE;AAEf,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AACpC,IAAA,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC;AAEpC,IAAA,QACIA,GAAA,CAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EACA,GAAG,EAAE,GAAG,EAAA,EACJ,IAAI,EAAA,EACR,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,EACX,SAAS,EAAC,WAAW,EAAA,QAAA,EAEpB,QAAQ,EAAA,CAAA,CACP;AAEd,CAAC;;;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var core = require('@xanui/core');
|
|
8
|
+
var index = require('../useCorner/index.cjs');
|
|
9
|
+
|
|
10
|
+
const IconButton = React.forwardRef((_a, ref) => {
|
|
11
|
+
var _b, _c;
|
|
12
|
+
var { children } = _a, rest = tslib.__rest(_a, ["children"]);
|
|
13
|
+
rest.sx = rest.sx || {};
|
|
14
|
+
let [_d] = core.useInterface("IconButton", rest, {}), { variant, corner, color, size } = _d, _props = tslib.__rest(_d, ["variant", "corner", "color", "size"]);
|
|
15
|
+
const _p = {};
|
|
16
|
+
if (size)
|
|
17
|
+
_p.size = size;
|
|
18
|
+
if (color)
|
|
19
|
+
_p.color = color;
|
|
20
|
+
if (variant)
|
|
21
|
+
_p.variant = variant;
|
|
22
|
+
if (corner)
|
|
23
|
+
_p.corner = corner;
|
|
24
|
+
const p = core.useBreakpointProps(_p);
|
|
25
|
+
size = (_b = p.size) !== null && _b !== void 0 ? _b : "medium";
|
|
26
|
+
color = p.color;
|
|
27
|
+
variant = p.variant;
|
|
28
|
+
corner = (_c = p.corner) !== null && _c !== void 0 ? _c : "circle";
|
|
29
|
+
let template = core.useColorTemplate(color || "brand", variant || "fill");
|
|
30
|
+
const cornerCss = index(corner);
|
|
31
|
+
if (size === 'small') {
|
|
32
|
+
size = 28;
|
|
33
|
+
}
|
|
34
|
+
else if (size === 'medium') {
|
|
35
|
+
size = 34;
|
|
36
|
+
}
|
|
37
|
+
else if (size === 'large') {
|
|
38
|
+
size = 52;
|
|
39
|
+
}
|
|
40
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({ component: 'button', ref: ref }, cornerCss, _props, template.primary, { baseClass: 'icon-button', sxr: {
|
|
41
|
+
border: 0,
|
|
42
|
+
radius: size,
|
|
43
|
+
height: size,
|
|
44
|
+
width: size,
|
|
45
|
+
cursor: "pointer",
|
|
46
|
+
fontFamily: "inherit",
|
|
47
|
+
display: "inline-flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "center",
|
|
50
|
+
lineHeight: 1,
|
|
51
|
+
fontSize: "button",
|
|
52
|
+
bgcolor: "transparent",
|
|
53
|
+
"& svg": {
|
|
54
|
+
fontSize: Math.round((size / 3) * 1.8),
|
|
55
|
+
display: "block",
|
|
56
|
+
width: "1em",
|
|
57
|
+
height: "1em",
|
|
58
|
+
flexShrink: 0,
|
|
59
|
+
},
|
|
60
|
+
}, hover: Object.assign(Object.assign({}, template.secondary), ((_props === null || _props === void 0 ? void 0 : _props.hover) || {})), children: children })));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
module.exports = IconButton;
|
|
64
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/IconButton/index.tsx"],"sourcesContent":["'use client'\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType, useInterface, UseColorTemplateColor, UseColorTemplateType, useColorTemplate, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\r\nimport useCorner from '../useCorner'\r\n\r\n\r\nexport type IconButtonProps<T extends TagComponentType = 'button'> = Omit<TagProps<T>, \"color\" | \"size\"> & {\r\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n variant?: useBreakpointPropsType<UseColorTemplateType>;\r\n corner?: useBreakpointPropsType<\"square\" | \"rounded\" | \"circle\">;\r\n}\r\n\r\nconst IconButton = React.forwardRef(<T extends TagComponentType = 'button'>({ children, ...rest }: IconButtonProps<T>, ref: React.Ref<any>) => {\r\n rest.sx = (rest as any).sx || {};\r\n let [{ variant, corner, color, size, ..._props }] = useInterface<any>(\"IconButton\", rest, {})\r\n\r\n const _p: any = {}\r\n if (size) _p.size = size\r\n if (color) _p.color = color\r\n if (variant) _p.variant = variant\r\n if (corner) _p.corner = corner\r\n const p: any = useBreakpointProps(_p)\r\n\r\n size = p.size ?? \"medium\"\r\n color = p.color\r\n variant = p.variant\r\n corner = p.corner ?? \"circle\"\r\n\r\n let template = useColorTemplate(color || \"brand\", variant || \"fill\")\r\n const cornerCss = useCorner(corner)\r\n\r\n if (size === 'small') {\r\n size = 28\r\n } else if (size === 'medium') {\r\n size = 34\r\n } else if (size === 'large') {\r\n size = 52\r\n }\r\n\r\n return (\r\n <Tag\r\n component='button'\r\n ref={ref}\r\n {...cornerCss}\r\n {..._props}\r\n {...template.primary}\r\n baseClass='icon-button'\r\n sxr={{\r\n border: 0,\r\n radius: size,\r\n height: size,\r\n width: size,\r\n cursor: \"pointer\",\r\n fontFamily: \"inherit\",\r\n\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n\r\n lineHeight: 1,\r\n fontSize: \"button\",\r\n\r\n bgcolor: \"transparent\",\r\n\r\n \"& svg\": {\r\n fontSize: Math.round((size / 3) * 1.8),\r\n display: \"block\",\r\n width: \"1em\",\r\n height: \"1em\",\r\n flexShrink: 0,\r\n },\r\n }}\r\n hover={{\r\n ...template.secondary,\r\n ...((_props as any)?.hover || {})\r\n }}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n// const IconButton = forwardRef(_IconButton) as unknown as typeof _IconButton\r\nexport default IconButton\r\n"],"names":[],"mappings":";;;;;;;;;AAaA;;AAA4E;;;;AAKxE;AAAU;AACV;AAAW;AACX;AAAa;AACb;AAAY;AACZ;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;;;AAEO;;;AAEA;;;;AAaK;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AACI;AACA;AACA;AACA;AACA;AACH;;AAUjB;;"}
|
package/IconButton/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var core = require('@xanui/core');
|
|
8
|
-
var index = require('../useCorner/index.js');
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useInterface, useBreakpointProps, useColorTemplate, Tag } from '@xanui/core';
|
|
6
|
+
import useCorner from '../useCorner/index.js';
|
|
9
7
|
|
|
10
8
|
const IconButton = React.forwardRef((_a, ref) => {
|
|
11
9
|
var _b, _c;
|
|
12
|
-
var { children } = _a, rest =
|
|
10
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
13
11
|
rest.sx = rest.sx || {};
|
|
14
|
-
let [_d] =
|
|
12
|
+
let [_d] = useInterface("IconButton", rest, {}), { variant, corner, color, size } = _d, _props = __rest(_d, ["variant", "corner", "color", "size"]);
|
|
15
13
|
const _p = {};
|
|
16
14
|
if (size)
|
|
17
15
|
_p.size = size;
|
|
@@ -21,13 +19,13 @@ const IconButton = React.forwardRef((_a, ref) => {
|
|
|
21
19
|
_p.variant = variant;
|
|
22
20
|
if (corner)
|
|
23
21
|
_p.corner = corner;
|
|
24
|
-
const p =
|
|
22
|
+
const p = useBreakpointProps(_p);
|
|
25
23
|
size = (_b = p.size) !== null && _b !== void 0 ? _b : "medium";
|
|
26
24
|
color = p.color;
|
|
27
25
|
variant = p.variant;
|
|
28
26
|
corner = (_c = p.corner) !== null && _c !== void 0 ? _c : "circle";
|
|
29
|
-
let template =
|
|
30
|
-
const cornerCss =
|
|
27
|
+
let template = useColorTemplate(color || "brand", variant || "fill");
|
|
28
|
+
const cornerCss = useCorner(corner);
|
|
31
29
|
if (size === 'small') {
|
|
32
30
|
size = 28;
|
|
33
31
|
}
|
|
@@ -37,7 +35,7 @@ const IconButton = React.forwardRef((_a, ref) => {
|
|
|
37
35
|
else if (size === 'large') {
|
|
38
36
|
size = 52;
|
|
39
37
|
}
|
|
40
|
-
return (
|
|
38
|
+
return (jsx(Tag, Object.assign({ component: 'button', ref: ref }, cornerCss, _props, template.primary, { baseClass: 'icon-button', sxr: {
|
|
41
39
|
border: 0,
|
|
42
40
|
radius: size,
|
|
43
41
|
height: size,
|
|
@@ -60,5 +58,5 @@ const IconButton = React.forwardRef((_a, ref) => {
|
|
|
60
58
|
}, hover: Object.assign(Object.assign({}, template.secondary), ((_props === null || _props === void 0 ? void 0 : _props.hover) || {})), children: children })));
|
|
61
59
|
});
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
export { IconButton as default };
|
|
64
62
|
//# sourceMappingURL=index.js.map
|
package/IconButton/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/IconButton/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/IconButton/index.tsx"],"sourcesContent":["'use client'\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType, useInterface, UseColorTemplateColor, UseColorTemplateType, useColorTemplate, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\r\nimport useCorner from '../useCorner'\r\n\r\n\r\nexport type IconButtonProps<T extends TagComponentType = 'button'> = Omit<TagProps<T>, \"color\" | \"size\"> & {\r\n size?: useBreakpointPropsType<number | \"small\" | \"medium\" | \"large\">;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n variant?: useBreakpointPropsType<UseColorTemplateType>;\r\n corner?: useBreakpointPropsType<\"square\" | \"rounded\" | \"circle\">;\r\n}\r\n\r\nconst IconButton = React.forwardRef(<T extends TagComponentType = 'button'>({ children, ...rest }: IconButtonProps<T>, ref: React.Ref<any>) => {\r\n rest.sx = (rest as any).sx || {};\r\n let [{ variant, corner, color, size, ..._props }] = useInterface<any>(\"IconButton\", rest, {})\r\n\r\n const _p: any = {}\r\n if (size) _p.size = size\r\n if (color) _p.color = color\r\n if (variant) _p.variant = variant\r\n if (corner) _p.corner = corner\r\n const p: any = useBreakpointProps(_p)\r\n\r\n size = p.size ?? \"medium\"\r\n color = p.color\r\n variant = p.variant\r\n corner = p.corner ?? \"circle\"\r\n\r\n let template = useColorTemplate(color || \"brand\", variant || \"fill\")\r\n const cornerCss = useCorner(corner)\r\n\r\n if (size === 'small') {\r\n size = 28\r\n } else if (size === 'medium') {\r\n size = 34\r\n } else if (size === 'large') {\r\n size = 52\r\n }\r\n\r\n return (\r\n <Tag\r\n component='button'\r\n ref={ref}\r\n {...cornerCss}\r\n {..._props}\r\n {...template.primary}\r\n baseClass='icon-button'\r\n sxr={{\r\n border: 0,\r\n radius: size,\r\n height: size,\r\n width: size,\r\n cursor: \"pointer\",\r\n fontFamily: \"inherit\",\r\n\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n\r\n lineHeight: 1,\r\n fontSize: \"button\",\r\n\r\n bgcolor: \"transparent\",\r\n\r\n \"& svg\": {\r\n fontSize: Math.round((size / 3) * 1.8),\r\n display: \"block\",\r\n width: \"1em\",\r\n height: \"1em\",\r\n flexShrink: 0,\r\n },\r\n }}\r\n hover={{\r\n ...template.secondary,\r\n ...((_props as any)?.hover || {})\r\n }}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n// const IconButton = forwardRef(_IconButton) as unknown as typeof _IconButton\r\nexport default IconButton\r\n"],"names":[],"mappings":";;;;;;;AAaA;;AAA4E;;;;AAKxE;AAAU;AACV;AAAW;AACX;AAAa;AACb;AAAY;AACZ;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;;;AAEO;;;AAEA;;;;AAaK;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AACI;AACA;AACA;AACA;AACA;AACH;;AAUjB;;"}
|
package/Image/index.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var tslib = require('tslib');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var core = require('@xanui/core');
|
|
8
|
+
|
|
9
|
+
const Image = React.forwardRef((_a, ref) => {
|
|
10
|
+
var { children, src, alt, errorView } = _a, rest = tslib.__rest(_a, ["children", "src", "alt", "errorView"]);
|
|
11
|
+
const [faild, setFaild] = React.useState();
|
|
12
|
+
if (faild === false) {
|
|
13
|
+
let t = errorView || (alt === null || alt === void 0 ? void 0 : alt.charAt(0).toUpperCase()) || children;
|
|
14
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({ src: src }, rest, { sxr: {
|
|
15
|
+
display: "inline-flex",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
}, component: "div", baseClass: 'image', ref: ref, children: t })));
|
|
19
|
+
}
|
|
20
|
+
return (jsxRuntime.jsx(core.Tag, Object.assign({ objectFit: "cover" }, rest, { component: "img", alt: alt, src: src, baseClass: 'image', onError: (e) => {
|
|
21
|
+
setFaild(false);
|
|
22
|
+
rest.onError && rest.onError(e);
|
|
23
|
+
}, ref: ref })));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
module.exports = Image;
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Image/index.tsx"],"sourcesContent":["'use client'\r\n\r\nimport React, { ReactElement, useState } from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type ImageProps<T extends TagComponentType = \"img\"> = TagProps<T> & {\r\n errorView?: ReactElement\r\n}\r\n\r\nconst Image = React.forwardRef(<T extends TagComponentType = \"img\">({ children, src, alt, errorView, ...rest }: ImageProps<T>, ref: any) => {\r\n const [faild, setFaild] = useState<boolean>()\r\n\r\n if (faild === false) {\r\n let t = errorView || alt?.charAt(0).toUpperCase() || children\r\n return (\r\n <Tag\r\n src={src}\r\n {...rest as any}\r\n sxr={{\r\n display: \"inline-flex\",\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n }}\r\n component=\"div\"\r\n baseClass='image'\r\n ref={ref}\r\n >{t}</Tag>\r\n )\r\n }\r\n return (\r\n <Tag\r\n objectFit=\"cover\"\r\n {...rest as any}\r\n component=\"img\"\r\n alt={alt}\r\n src={src}\r\n baseClass='image'\r\n onError={(e) => {\r\n setFaild(false)\r\n rest.onError && rest.onError(e as any)\r\n }}\r\n ref={ref}\r\n />\r\n )\r\n})\r\n\r\nexport default Image\r\n\r\n\r\n"],"names":[],"mappings":";;;;;;;;AASA;AAAoE;;AAGhE;AACI;;AAMY;AACA;AACA;AACH;;AAOb;;;AAWQ;AAIZ;;"}
|