@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/Layer/index.cjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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('../useBlurCss/index.cjs');
|
|
9
|
+
var index$1 = require('../ClickOutside/index.cjs');
|
|
10
|
+
|
|
11
|
+
const Layer = (_a) => {
|
|
12
|
+
var _b, _c, _d;
|
|
13
|
+
var { children, open } = _a, props = tslib.__rest(_a, ["children", "open"]);
|
|
14
|
+
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode, onOpen, onOpened, onClose, onClosed, slotProps }] = core.useInterface("Layer", props, {});
|
|
15
|
+
const _p = {};
|
|
16
|
+
if (blur)
|
|
17
|
+
_p.blur = blur;
|
|
18
|
+
if (blurMode)
|
|
19
|
+
_p.blurMode = blurMode;
|
|
20
|
+
const p = core.useBreakpointProps(_p);
|
|
21
|
+
blur = p.blur;
|
|
22
|
+
blurMode = p.blurMode;
|
|
23
|
+
const [closed, setClosed] = React.useState(!open);
|
|
24
|
+
placement = placement || "bottom-left";
|
|
25
|
+
const blurCss = blur ? index(blur, blurMode) : {};
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (closed && open) {
|
|
28
|
+
setClosed(false);
|
|
29
|
+
}
|
|
30
|
+
}, [open]);
|
|
31
|
+
if (closed)
|
|
32
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
33
|
+
let duration = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _b === void 0 ? void 0 : _b.duration) || 300;
|
|
34
|
+
let delay = ((_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _c === void 0 ? void 0 : _c.delay) || 0;
|
|
35
|
+
let content = jsxRuntime.jsx(core.Transition, Object.assign({ duration: duration, delay: delay, easing: "standard", variant: transition || "zoomOver" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition, { open: open, onOpen: onOpen, onOpened: onOpened, onClose: onClose, onClosed: () => {
|
|
36
|
+
setClosed(true);
|
|
37
|
+
onClosed && onClosed();
|
|
38
|
+
}, children: children }));
|
|
39
|
+
return (jsxRuntime.jsx(core.Transition, { duration: duration, delay: delay, easing: "smooth", variant: "fade", open: open, children: jsxRuntime.jsx(core.Tag, Object.assign({ baseClass: "layer" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { sxr: Object.assign(Object.assign(Object.assign({}, (_d = slotProps === null || slotProps === void 0 ? void 0 : slotProps.root) === null || _d === void 0 ? void 0 : _d.sx), { position: "fixed", zIndex: 1500 + (zIndex || 0), top: 0, left: 0, bottom: 0, right: 0, width: "100%", height: "100%" }), blurCss), children: onClickOutside ? jsxRuntime.jsx(index$1, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: content })) : content })) }));
|
|
40
|
+
};
|
|
41
|
+
Layer.open = (children, props) => {
|
|
42
|
+
const l = core.Renderar.render(Layer, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
|
|
43
|
+
core.Renderar.unrender(Layer);
|
|
44
|
+
if (props === null || props === void 0 ? void 0 : props.onClosed) {
|
|
45
|
+
props.onClosed();
|
|
46
|
+
}
|
|
47
|
+
} }));
|
|
48
|
+
return {
|
|
49
|
+
open: () => {
|
|
50
|
+
l.updateProps({ open: true });
|
|
51
|
+
},
|
|
52
|
+
close: () => {
|
|
53
|
+
l.updateProps({ open: false });
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
Layer.close = () => {
|
|
58
|
+
core.Renderar.unrender(Layer);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
module.exports = Layer;
|
|
62
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/Layer/index.tsx"],"sourcesContent":["'use client'\r\nimport { ReactNode, useEffect, useState } from 'react'\r\nimport { Tag, TagProps, useBreakpointProps, useBreakpointPropsType, useInterface, TransitionProps, Transition } from \"@xanui/core\"\r\nimport useBlurCss from '../useBlurCss';\r\nimport { Renderar } from \"@xanui/core\";\r\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\r\n\r\nexport type LayerProps = {\r\n open: boolean;\r\n children: ReactNode;\r\n transition?: TransitionProps['variant'];\r\n zIndex?: number;\r\n blur?: useBreakpointPropsType<number>\r\n blurMode?: useBreakpointPropsType<\"blur\" | \"transparent\">\r\n onClickOutside?: () => void;\r\n onOpen?: Function;\r\n onOpened?: Function;\r\n onClose?: Function;\r\n onClosed?: Function;\r\n slotProps?: {\r\n root?: Omit<TagProps<\"div\">, \"children\">;\r\n transition?: Omit<TransitionProps, \"children\" | \"open\" | \"variant\" | \"onClose\" | \"onClosed\" | \"onOpen\" | \"onOpened\">;\r\n content?: Omit<TagProps<\"div\">, \"children\">;\r\n clickOutside?: Omit<ClickOutsideProps, \"children\" | \"onClickOutside\">;\r\n }\r\n}\r\n\r\nconst Layer = ({ children, open, ...props }: LayerProps) => {\r\n let [{\r\n onClickOutside,\r\n placement,\r\n transition,\r\n zIndex,\r\n blur,\r\n blurMode,\r\n onOpen,\r\n onOpened,\r\n onClose,\r\n onClosed,\r\n slotProps\r\n }] = useInterface<any>(\"Layer\", props, {})\r\n\r\n const _p: any = {}\r\n if (blur) _p.blur = blur\r\n if (blurMode) _p.blurMode = blurMode\r\n const p: any = useBreakpointProps(_p)\r\n\r\n blur = p.blur\r\n blurMode = p.blurMode\r\n\r\n const [closed, setClosed] = useState(!open)\r\n placement = placement || \"bottom-left\"\r\n const blurCss = blur ? useBlurCss(blur, blurMode) : {}\r\n\r\n useEffect(() => {\r\n if (closed && open) {\r\n setClosed(false)\r\n }\r\n }, [open])\r\n\r\n if (closed) return <></>\r\n let duration = slotProps?.transition?.duration || 300\r\n let delay = slotProps?.transition?.delay || 0\r\n\r\n let content = <Transition\r\n duration={duration}\r\n delay={delay}\r\n easing=\"standard\"\r\n variant={transition || \"zoomOver\"}\r\n {...slotProps?.transition}\r\n open={open}\r\n onOpen={onOpen}\r\n onOpened={onOpened}\r\n onClose={onClose}\r\n onClosed={() => {\r\n setClosed(true)\r\n onClosed && onClosed()\r\n }}\r\n >\r\n {children}\r\n </Transition>\r\n\r\n return (\r\n <Transition\r\n duration={duration}\r\n delay={delay}\r\n easing=\"smooth\"\r\n variant={\"fade\"}\r\n open={open}\r\n >\r\n <Tag\r\n baseClass=\"layer\"\r\n {...slotProps?.root}\r\n sxr={{\r\n ...slotProps?.root?.sx,\r\n position: \"fixed\",\r\n zIndex: 1500 + (zIndex || 0),\r\n top: 0,\r\n left: 0,\r\n bottom: 0,\r\n right: 0,\r\n width: \"100%\",\r\n height: \"100%\",\r\n ...blurCss\r\n }}\r\n >\r\n {\r\n onClickOutside ? <ClickOutside\r\n {...slotProps?.clickOutside}\r\n onClickOutside={onClickOutside || (() => { })}\r\n >\r\n {content}\r\n </ClickOutside> : content\r\n }\r\n </Tag>\r\n </Transition>\r\n )\r\n}\r\n\r\n\r\nLayer.open = (children: LayerProps['children'], props?: Partial<Omit<LayerProps, 'children'>>) => {\r\n const l = Renderar.render(Layer as any, {\r\n open: true,\r\n ...props,\r\n children,\r\n onClosed: () => {\r\n Renderar.unrender(Layer as any)\r\n if (props?.onClosed) {\r\n props.onClosed()\r\n }\r\n }\r\n })\r\n return {\r\n open: () => {\r\n l.updateProps({ open: true })\r\n },\r\n close: () => {\r\n l.updateProps({ open: false })\r\n },\r\n }\r\n}\r\nLayer.close = () => {\r\n Renderar.unrender(Layer as any)\r\n}\r\nexport default Layer"],"names":[],"mappings":";;;;;;;;;;AA2BA;;;AACI;;AAeA;AAAU;AACV;AAAc;AACd;AAEA;AACA;;AAGA;AACA;;AAGI;;;AAGJ;AAEA;AAAY;AACZ;AACA;;;;;AAoBA;AAmCJ;AAGA;AACI;AAKQ;;;;AAIJ;;;;;;;;;AAUR;AACA;AACI;AACJ;;"}
|
package/Layer/index.js
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var index = require('../useBlurCss/index.js');
|
|
9
|
-
var index$1 = require('../ClickOutside/index.js');
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
import { useInterface, useBreakpointProps, Transition, Tag, Renderar } from '@xanui/core';
|
|
6
|
+
import useBlurCss from '../useBlurCss/index.js';
|
|
7
|
+
import ClickOutside from '../ClickOutside/index.js';
|
|
10
8
|
|
|
11
9
|
const Layer = (_a) => {
|
|
12
10
|
var _b, _c, _d;
|
|
13
|
-
var { children, open } = _a, props =
|
|
14
|
-
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode, onOpen, onOpened, onClose, onClosed, slotProps }] =
|
|
11
|
+
var { children, open } = _a, props = __rest(_a, ["children", "open"]);
|
|
12
|
+
let [{ onClickOutside, placement, transition, zIndex, blur, blurMode, onOpen, onOpened, onClose, onClosed, slotProps }] = useInterface("Layer", props, {});
|
|
15
13
|
const _p = {};
|
|
16
14
|
if (blur)
|
|
17
15
|
_p.blur = blur;
|
|
18
16
|
if (blurMode)
|
|
19
17
|
_p.blurMode = blurMode;
|
|
20
|
-
const p =
|
|
18
|
+
const p = useBreakpointProps(_p);
|
|
21
19
|
blur = p.blur;
|
|
22
20
|
blurMode = p.blurMode;
|
|
23
|
-
const [closed, setClosed] =
|
|
21
|
+
const [closed, setClosed] = useState(!open);
|
|
24
22
|
placement = placement || "bottom-left";
|
|
25
|
-
const blurCss = blur ?
|
|
26
|
-
|
|
23
|
+
const blurCss = blur ? useBlurCss(blur, blurMode) : {};
|
|
24
|
+
useEffect(() => {
|
|
27
25
|
if (closed && open) {
|
|
28
26
|
setClosed(false);
|
|
29
27
|
}
|
|
30
28
|
}, [open]);
|
|
31
29
|
if (closed)
|
|
32
|
-
return
|
|
30
|
+
return jsx(Fragment, {});
|
|
33
31
|
let duration = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _b === void 0 ? void 0 : _b.duration) || 300;
|
|
34
32
|
let delay = ((_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition) === null || _c === void 0 ? void 0 : _c.delay) || 0;
|
|
35
|
-
let content =
|
|
33
|
+
let content = jsx(Transition, Object.assign({ duration: duration, delay: delay, easing: "standard", variant: transition || "zoomOver" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.transition, { open: open, onOpen: onOpen, onOpened: onOpened, onClose: onClose, onClosed: () => {
|
|
36
34
|
setClosed(true);
|
|
37
35
|
onClosed && onClosed();
|
|
38
36
|
}, children: children }));
|
|
39
|
-
return (
|
|
37
|
+
return (jsx(Transition, { duration: duration, delay: delay, easing: "smooth", variant: "fade", open: open, children: jsx(Tag, Object.assign({ baseClass: "layer" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.root, { sxr: Object.assign(Object.assign(Object.assign({}, (_d = slotProps === null || slotProps === void 0 ? void 0 : slotProps.root) === null || _d === void 0 ? void 0 : _d.sx), { position: "fixed", zIndex: 1500 + (zIndex || 0), top: 0, left: 0, bottom: 0, right: 0, width: "100%", height: "100%" }), blurCss), children: onClickOutside ? jsx(ClickOutside, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.clickOutside, { onClickOutside: onClickOutside || (() => { }), children: content })) : content })) }));
|
|
40
38
|
};
|
|
41
39
|
Layer.open = (children, props) => {
|
|
42
|
-
const l =
|
|
43
|
-
|
|
40
|
+
const l = Renderar.render(Layer, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
|
|
41
|
+
Renderar.unrender(Layer);
|
|
44
42
|
if (props === null || props === void 0 ? void 0 : props.onClosed) {
|
|
45
43
|
props.onClosed();
|
|
46
44
|
}
|
|
@@ -55,8 +53,8 @@ Layer.open = (children, props) => {
|
|
|
55
53
|
};
|
|
56
54
|
};
|
|
57
55
|
Layer.close = () => {
|
|
58
|
-
|
|
56
|
+
Renderar.unrender(Layer);
|
|
59
57
|
};
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
export { Layer as default };
|
|
62
60
|
//# sourceMappingURL=index.js.map
|
package/Layer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Layer/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/Layer/index.tsx"],"sourcesContent":["'use client'\r\nimport { ReactNode, useEffect, useState } from 'react'\r\nimport { Tag, TagProps, useBreakpointProps, useBreakpointPropsType, useInterface, TransitionProps, Transition } from \"@xanui/core\"\r\nimport useBlurCss from '../useBlurCss';\r\nimport { Renderar } from \"@xanui/core\";\r\nimport ClickOutside, { ClickOutsideProps } from '../ClickOutside';\r\n\r\nexport type LayerProps = {\r\n open: boolean;\r\n children: ReactNode;\r\n transition?: TransitionProps['variant'];\r\n zIndex?: number;\r\n blur?: useBreakpointPropsType<number>\r\n blurMode?: useBreakpointPropsType<\"blur\" | \"transparent\">\r\n onClickOutside?: () => void;\r\n onOpen?: Function;\r\n onOpened?: Function;\r\n onClose?: Function;\r\n onClosed?: Function;\r\n slotProps?: {\r\n root?: Omit<TagProps<\"div\">, \"children\">;\r\n transition?: Omit<TransitionProps, \"children\" | \"open\" | \"variant\" | \"onClose\" | \"onClosed\" | \"onOpen\" | \"onOpened\">;\r\n content?: Omit<TagProps<\"div\">, \"children\">;\r\n clickOutside?: Omit<ClickOutsideProps, \"children\" | \"onClickOutside\">;\r\n }\r\n}\r\n\r\nconst Layer = ({ children, open, ...props }: LayerProps) => {\r\n let [{\r\n onClickOutside,\r\n placement,\r\n transition,\r\n zIndex,\r\n blur,\r\n blurMode,\r\n onOpen,\r\n onOpened,\r\n onClose,\r\n onClosed,\r\n slotProps\r\n }] = useInterface<any>(\"Layer\", props, {})\r\n\r\n const _p: any = {}\r\n if (blur) _p.blur = blur\r\n if (blurMode) _p.blurMode = blurMode\r\n const p: any = useBreakpointProps(_p)\r\n\r\n blur = p.blur\r\n blurMode = p.blurMode\r\n\r\n const [closed, setClosed] = useState(!open)\r\n placement = placement || \"bottom-left\"\r\n const blurCss = blur ? useBlurCss(blur, blurMode) : {}\r\n\r\n useEffect(() => {\r\n if (closed && open) {\r\n setClosed(false)\r\n }\r\n }, [open])\r\n\r\n if (closed) return <></>\r\n let duration = slotProps?.transition?.duration || 300\r\n let delay = slotProps?.transition?.delay || 0\r\n\r\n let content = <Transition\r\n duration={duration}\r\n delay={delay}\r\n easing=\"standard\"\r\n variant={transition || \"zoomOver\"}\r\n {...slotProps?.transition}\r\n open={open}\r\n onOpen={onOpen}\r\n onOpened={onOpened}\r\n onClose={onClose}\r\n onClosed={() => {\r\n setClosed(true)\r\n onClosed && onClosed()\r\n }}\r\n >\r\n {children}\r\n </Transition>\r\n\r\n return (\r\n <Transition\r\n duration={duration}\r\n delay={delay}\r\n easing=\"smooth\"\r\n variant={\"fade\"}\r\n open={open}\r\n >\r\n <Tag\r\n baseClass=\"layer\"\r\n {...slotProps?.root}\r\n sxr={{\r\n ...slotProps?.root?.sx,\r\n position: \"fixed\",\r\n zIndex: 1500 + (zIndex || 0),\r\n top: 0,\r\n left: 0,\r\n bottom: 0,\r\n right: 0,\r\n width: \"100%\",\r\n height: \"100%\",\r\n ...blurCss\r\n }}\r\n >\r\n {\r\n onClickOutside ? <ClickOutside\r\n {...slotProps?.clickOutside}\r\n onClickOutside={onClickOutside || (() => { })}\r\n >\r\n {content}\r\n </ClickOutside> : content\r\n }\r\n </Tag>\r\n </Transition>\r\n )\r\n}\r\n\r\n\r\nLayer.open = (children: LayerProps['children'], props?: Partial<Omit<LayerProps, 'children'>>) => {\r\n const l = Renderar.render(Layer as any, {\r\n open: true,\r\n ...props,\r\n children,\r\n onClosed: () => {\r\n Renderar.unrender(Layer as any)\r\n if (props?.onClosed) {\r\n props.onClosed()\r\n }\r\n }\r\n })\r\n return {\r\n open: () => {\r\n l.updateProps({ open: true })\r\n },\r\n close: () => {\r\n l.updateProps({ open: false })\r\n },\r\n }\r\n}\r\nLayer.close = () => {\r\n Renderar.unrender(Layer as any)\r\n}\r\nexport default Layer"],"names":[],"mappings":";;;;;;;;AA2BA;;;AACI;;AAeA;AAAU;AACV;AAAc;AACd;AAEA;AACA;;AAGA;AACA;;AAGI;;;AAGJ;AAEA;AAAY;AACZ;AACA;;;;;AAoBA;AAmCJ;AAGA;AACI;AAKQ;;;;AAIJ;;;;;;;;;AAUR;AACA;AACI;AACJ;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 LineProgress = React.forwardRef((_a, ref) => {
|
|
10
|
+
var _b, _c;
|
|
11
|
+
var { children } = _a, props = tslib.__rest(_a, ["children"]);
|
|
12
|
+
const uid = "line-progress" + React.useId().replace(":", "");
|
|
13
|
+
let [{ color, value, thumbSize, hideTrack, speed }] = core.useInterface("LineProgress", props, {});
|
|
14
|
+
const _p = {};
|
|
15
|
+
if (thumbSize)
|
|
16
|
+
_p.thumbSize = thumbSize;
|
|
17
|
+
if (color)
|
|
18
|
+
_p.color = color;
|
|
19
|
+
if (value)
|
|
20
|
+
_p.value = value;
|
|
21
|
+
if (hideTrack)
|
|
22
|
+
_p.hideTrack = hideTrack;
|
|
23
|
+
if (speed)
|
|
24
|
+
_p.speed = speed;
|
|
25
|
+
const p = core.useBreakpointProps(_p);
|
|
26
|
+
thumbSize = (_b = p.thumbSize) !== null && _b !== void 0 ? _b : 4;
|
|
27
|
+
color = (_c = p.color) !== null && _c !== void 0 ? _c : "brand";
|
|
28
|
+
value = p.value;
|
|
29
|
+
hideTrack = p.hideTrack;
|
|
30
|
+
speed = p.speed;
|
|
31
|
+
let isVal = typeof value === 'number';
|
|
32
|
+
if (isVal && value > 100)
|
|
33
|
+
value = 100;
|
|
34
|
+
return (jsxRuntime.jsx(core.Tag, { baseClass: 'line-progress', sxr: {
|
|
35
|
+
display: "flex",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: thumbSize,
|
|
39
|
+
position: "relative",
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
bgcolor: hideTrack ? "transparent" : (color === 'default' ? `text.primary` : `${color}.soft.primary`),
|
|
42
|
+
radius: 2,
|
|
43
|
+
}, ref: ref, children: jsxRuntime.jsx(core.Tag, { component: "span", baseClass: "line-progress-thumb", sxr: {
|
|
44
|
+
bgcolor: color === 'default' ? `divider` : `${color}`,
|
|
45
|
+
width: isVal ? `${value}%` : "50%",
|
|
46
|
+
height: thumbSize,
|
|
47
|
+
position: "absolute",
|
|
48
|
+
left: 0,
|
|
49
|
+
animation: isVal ? "none" : `${uid} ${speed !== null && speed !== void 0 ? speed : 1}s linear infinite`,
|
|
50
|
+
[`@keyframes ${uid}`]: {
|
|
51
|
+
"0%": { left: "-40%" },
|
|
52
|
+
"50%": { left: "20%", width: "80%" },
|
|
53
|
+
"100%": { left: "100%", width: "100%" }
|
|
54
|
+
}
|
|
55
|
+
} }) }));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
module.exports = LineProgress;
|
|
59
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { ReactElement, useId } from \"react\"\r\nimport { Tag, useBreakpointProps, UseColorTemplateColor, useInterface, useBreakpointPropsType } from '@xanui/core';\r\n\r\nexport type LineProgressProps = {\r\n children?: ReactElement;\r\n thumbSize?: useBreakpointPropsType<number>;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n value?: useBreakpointPropsType<number>;\r\n hideTrack?: useBreakpointPropsType<boolean>;\r\n speed?: useBreakpointPropsType<number>;\r\n}\r\n\r\n\r\nconst LineProgress = React.forwardRef(({ children, ...props }: LineProgressProps, ref: React.Ref<any>) => {\r\n const uid = \"line-progress\" + useId().replace(\":\", \"\")\r\n let [{ color, value, thumbSize, hideTrack, speed }] = useInterface<any>(\"LineProgress\", props, {})\r\n const _p: any = {}\r\n if (thumbSize) _p.thumbSize = thumbSize\r\n if (color) _p.color = color\r\n if (value) _p.value = value\r\n if (hideTrack) _p.hideTrack = hideTrack\r\n if (speed) _p.speed = speed\r\n const p: any = useBreakpointProps(_p)\r\n\r\n thumbSize = p.thumbSize ?? 4\r\n color = p.color ?? \"brand\"\r\n value = p.value\r\n hideTrack = p.hideTrack\r\n speed = p.speed\r\n\r\n let isVal = typeof value === 'number'\r\n if (isVal && (value as number) > 100) value = 100\r\n\r\n return (\r\n <Tag\r\n baseClass='line-progress'\r\n sxr={{\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n width: '100%',\r\n height: thumbSize,\r\n position: \"relative\",\r\n overflow: \"hidden\",\r\n bgcolor: hideTrack ? \"transparent\" : (color === 'default' ? `text.primary` : `${color}.soft.primary`),\r\n radius: 2,\r\n }}\r\n ref={ref}\r\n >\r\n <Tag\r\n component=\"span\"\r\n baseClass=\"line-progress-thumb\"\r\n sxr={{\r\n bgcolor: color === 'default' ? `divider` : `${color}`,\r\n width: isVal ? `${value}%` : \"50%\",\r\n height: thumbSize,\r\n position: \"absolute\",\r\n left: 0,\r\n animation: isVal ? \"none\" : `${uid} ${speed ?? 1}s linear infinite`,\r\n [`@keyframes ${uid}`]: {\r\n \"0%\": { left: \"-40%\" },\r\n \"50%\": { left: \"20%\", width: \"80%\" },\r\n \"100%\": { left: \"100%\", width: \"100%\" }\r\n }\r\n }}\r\n />\r\n </Tag >\r\n )\r\n})\r\n\r\nexport default LineProgress\r\n\r\n"],"names":[],"mappings":";;;;;;;;AAcA;;AAAuC;AACnC;;;AAGA;AAAe;AACf;AAAW;AACX;AAAW;AACX;AAAe;AACf;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAMY;AACA;AACA;AACA;AACA;AACA;;AAEA;AACH;AAOO;;AAEA;AACA;AACA;AACA;AACA;AACI;;;AAGH;;AAKrB;;"}
|
package/LineProgress/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
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, { useId } from 'react';
|
|
5
|
+
import { useInterface, useBreakpointProps, Tag } from '@xanui/core';
|
|
8
6
|
|
|
9
7
|
const LineProgress = React.forwardRef((_a, ref) => {
|
|
10
8
|
var _b, _c;
|
|
11
|
-
var { children } = _a, props =
|
|
12
|
-
const uid = "line-progress" +
|
|
13
|
-
let [{ color, value, thumbSize, hideTrack, speed }] =
|
|
9
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
10
|
+
const uid = "line-progress" + useId().replace(":", "");
|
|
11
|
+
let [{ color, value, thumbSize, hideTrack, speed }] = useInterface("LineProgress", props, {});
|
|
14
12
|
const _p = {};
|
|
15
13
|
if (thumbSize)
|
|
16
14
|
_p.thumbSize = thumbSize;
|
|
@@ -22,7 +20,7 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
22
20
|
_p.hideTrack = hideTrack;
|
|
23
21
|
if (speed)
|
|
24
22
|
_p.speed = speed;
|
|
25
|
-
const p =
|
|
23
|
+
const p = useBreakpointProps(_p);
|
|
26
24
|
thumbSize = (_b = p.thumbSize) !== null && _b !== void 0 ? _b : 4;
|
|
27
25
|
color = (_c = p.color) !== null && _c !== void 0 ? _c : "brand";
|
|
28
26
|
value = p.value;
|
|
@@ -31,7 +29,7 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
31
29
|
let isVal = typeof value === 'number';
|
|
32
30
|
if (isVal && value > 100)
|
|
33
31
|
value = 100;
|
|
34
|
-
return (
|
|
32
|
+
return (jsx(Tag, { baseClass: 'line-progress', sxr: {
|
|
35
33
|
display: "flex",
|
|
36
34
|
alignItems: "center",
|
|
37
35
|
width: '100%',
|
|
@@ -40,7 +38,7 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
40
38
|
overflow: "hidden",
|
|
41
39
|
bgcolor: hideTrack ? "transparent" : (color === 'default' ? `text.primary` : `${color}.soft.primary`),
|
|
42
40
|
radius: 2,
|
|
43
|
-
}, ref: ref, children:
|
|
41
|
+
}, ref: ref, children: jsx(Tag, { component: "span", baseClass: "line-progress-thumb", sxr: {
|
|
44
42
|
bgcolor: color === 'default' ? `divider` : `${color}`,
|
|
45
43
|
width: isVal ? `${value}%` : "50%",
|
|
46
44
|
height: thumbSize,
|
|
@@ -55,5 +53,5 @@ const LineProgress = React.forwardRef((_a, ref) => {
|
|
|
55
53
|
} }) }));
|
|
56
54
|
});
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
export { LineProgress as default };
|
|
59
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/LineProgress/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { ReactElement, useId } from \"react\"\r\nimport { Tag, useBreakpointProps, UseColorTemplateColor, useInterface, useBreakpointPropsType } from '@xanui/core';\r\n\r\nexport type LineProgressProps = {\r\n children?: ReactElement;\r\n thumbSize?: useBreakpointPropsType<number>;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n value?: useBreakpointPropsType<number>;\r\n hideTrack?: useBreakpointPropsType<boolean>;\r\n speed?: useBreakpointPropsType<number>;\r\n}\r\n\r\n\r\nconst LineProgress = React.forwardRef(({ children, ...props }: LineProgressProps, ref: React.Ref<any>) => {\r\n const uid = \"line-progress\" + useId().replace(\":\", \"\")\r\n let [{ color, value, thumbSize, hideTrack, speed }] = useInterface<any>(\"LineProgress\", props, {})\r\n const _p: any = {}\r\n if (thumbSize) _p.thumbSize = thumbSize\r\n if (color) _p.color = color\r\n if (value) _p.value = value\r\n if (hideTrack) _p.hideTrack = hideTrack\r\n if (speed) _p.speed = speed\r\n const p: any = useBreakpointProps(_p)\r\n\r\n thumbSize = p.thumbSize ?? 4\r\n color = p.color ?? \"brand\"\r\n value = p.value\r\n hideTrack = p.hideTrack\r\n speed = p.speed\r\n\r\n let isVal = typeof value === 'number'\r\n if (isVal && (value as number) > 100) value = 100\r\n\r\n return (\r\n <Tag\r\n baseClass='line-progress'\r\n sxr={{\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n width: '100%',\r\n height: thumbSize,\r\n position: \"relative\",\r\n overflow: \"hidden\",\r\n bgcolor: hideTrack ? \"transparent\" : (color === 'default' ? `text.primary` : `${color}.soft.primary`),\r\n radius: 2,\r\n }}\r\n ref={ref}\r\n >\r\n <Tag\r\n component=\"span\"\r\n baseClass=\"line-progress-thumb\"\r\n sxr={{\r\n bgcolor: color === 'default' ? `divider` : `${color}`,\r\n width: isVal ? `${value}%` : \"50%\",\r\n height: thumbSize,\r\n position: \"absolute\",\r\n left: 0,\r\n animation: isVal ? \"none\" : `${uid} ${speed ?? 1}s linear infinite`,\r\n [`@keyframes ${uid}`]: {\r\n \"0%\": { left: \"-40%\" },\r\n \"50%\": { left: \"20%\", width: \"80%\" },\r\n \"100%\": { left: \"100%\", width: \"100%\" }\r\n }\r\n }}\r\n />\r\n </Tag >\r\n )\r\n})\r\n\r\nexport default LineProgress\r\n\r\n"],"names":[],"mappings":";;;;;;AAcA;;AAAuC;AACnC;;;AAGA;AAAe;AACf;AAAW;AACX;AAAW;AACX;AAAe;AACf;AAAW;AACX;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAMY;AACA;AACA;AACA;AACA;AACA;;AAEA;AACH;AAOO;;AAEA;AACA;AACA;AACA;AACA;AACI;;;AAGH;;AAKrB;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
// ListContext.ts
|
|
6
|
+
const ListContext = React.createContext(null);
|
|
7
|
+
const useListContext = () => React.useContext(ListContext);
|
|
8
|
+
|
|
9
|
+
exports.ListContext = ListContext;
|
|
10
|
+
exports.useListContext = useListContext;
|
|
11
|
+
//# sourceMappingURL=ListContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListContext.cjs","sources":["../../src/List/ListContext.ts"],"sourcesContent":["// ListContext.ts\r\nimport React from \"react\"\r\n\r\nexport type ListSize = \"small\" | \"medium\" | \"large\"\r\n\r\nexport interface ListContextValue {\r\n size: ListSize\r\n}\r\n\r\nexport const ListContext = React.createContext<ListContextValue | null>(null)\r\n\r\nexport const useListContext = () => React.useContext(ListContext)\r\n"],"names":[],"mappings":";;;;AAAA;AASO,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAA0B,IAAI;AAErE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,WAAW;;;;;"}
|
package/List/ListContext.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
1
|
+
import React from 'react';
|
|
4
2
|
|
|
5
3
|
// ListContext.ts
|
|
6
4
|
const ListContext = React.createContext(null);
|
|
7
5
|
const useListContext = () => React.useContext(ListContext);
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
exports.useListContext = useListContext;
|
|
7
|
+
export { ListContext, useListContext };
|
|
11
8
|
//# sourceMappingURL=ListContext.js.map
|
package/List/ListContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListContext.js","sources":["../../src/List/ListContext.ts"],"sourcesContent":["// ListContext.ts\r\nimport React from \"react\"\r\n\r\nexport type ListSize = \"small\" | \"medium\" | \"large\"\r\n\r\nexport interface ListContextValue {\r\n size: ListSize\r\n}\r\n\r\nexport const ListContext = React.createContext<ListContextValue | null>(null)\r\n\r\nexport const useListContext = () => React.useContext(ListContext)\r\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ListContext.js","sources":["../../src/List/ListContext.ts"],"sourcesContent":["// ListContext.ts\r\nimport React from \"react\"\r\n\r\nexport type ListSize = \"small\" | \"medium\" | \"large\"\r\n\r\nexport interface ListContextValue {\r\n size: ListSize\r\n}\r\n\r\nexport const ListContext = React.createContext<ListContextValue | null>(null)\r\n\r\nexport const useListContext = () => React.useContext(ListContext)\r\n"],"names":[],"mappings":";;AAAA;AASO,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAA0B,IAAI;AAErE,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,WAAW;;;;"}
|
package/List/index.cjs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
var ListContext = require('./ListContext.cjs');
|
|
8
|
+
|
|
9
|
+
const List = React.forwardRef((_a, ref) => {
|
|
10
|
+
var _b, _c, _d, _e, _f;
|
|
11
|
+
var { children } = _a, rest = tslib.__rest(_a, ["children"]);
|
|
12
|
+
let [_g] = core.useInterface("List", rest, {}), { sx, color, variant, hoverColor, hoverVariant, size } = _g, props = tslib.__rest(_g, ["sx", "color", "variant", "hoverColor", "hoverVariant", "size"]);
|
|
13
|
+
const _p = {};
|
|
14
|
+
if (color)
|
|
15
|
+
_p.color = color;
|
|
16
|
+
if (variant)
|
|
17
|
+
_p.variant = variant;
|
|
18
|
+
if (hoverColor)
|
|
19
|
+
_p.hoverColor = hoverColor;
|
|
20
|
+
if (hoverVariant)
|
|
21
|
+
_p.hoverVariant = hoverVariant;
|
|
22
|
+
if (size)
|
|
23
|
+
_p.size = size;
|
|
24
|
+
const p = core.useBreakpointProps(_p);
|
|
25
|
+
color = (_b = p.color) !== null && _b !== void 0 ? _b : "brand";
|
|
26
|
+
variant = (_c = p.variant) !== null && _c !== void 0 ? _c : "fill";
|
|
27
|
+
hoverColor = (_d = p.hoverColor) !== null && _d !== void 0 ? _d : "default";
|
|
28
|
+
hoverVariant = (_e = p.hoverVariant) !== null && _e !== void 0 ? _e : "soft";
|
|
29
|
+
size = (_f = p.size) !== null && _f !== void 0 ? _f : "medium";
|
|
30
|
+
const template = core.useColorTemplate(color, variant);
|
|
31
|
+
const hoverTemplate = core.useColorTemplate(hoverColor, hoverVariant);
|
|
32
|
+
let sxOutline = {};
|
|
33
|
+
if (hoverVariant == 'outline' || variant === 'outline') {
|
|
34
|
+
sxOutline = {
|
|
35
|
+
"& .list-item": {
|
|
36
|
+
border: "1px solid",
|
|
37
|
+
borderColor: "transparent"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return (jsxRuntime.jsx(ListContext.ListContext.Provider, { value: { size }, children: jsxRuntime.jsx(core.Tag, Object.assign({ component: 'ul' }, props, { baseClass: 'list', sxr: Object.assign(Object.assign(Object.assign({ listStyle: "none", p: 0, m: 0 }, sxOutline), { "& .list-item-icon": {
|
|
42
|
+
color: "text.secondary"
|
|
43
|
+
}, "& .list-item-text": {
|
|
44
|
+
color: "text.primary"
|
|
45
|
+
}, "& .list-item-subtitle": {
|
|
46
|
+
color: "text.secondary"
|
|
47
|
+
}, "& .xui-list-item:not(.list-item-selected):hover": Object.assign(Object.assign({}, hoverTemplate.primary), { "& .list-item-icon": {
|
|
48
|
+
color: hoverTemplate.primary.color
|
|
49
|
+
}, "& .list-item-text": {
|
|
50
|
+
color: hoverTemplate.primary.color
|
|
51
|
+
}, "& .list-item-subtitle": {
|
|
52
|
+
color: hoverColor === 'default' ? "text.secondary" : hoverTemplate.primary.color
|
|
53
|
+
} }), "& .xui-list-item.list-item-selected": Object.assign(Object.assign({}, template.primary), { "& .list-item-icon": {
|
|
54
|
+
color: template.primary.color
|
|
55
|
+
}, "& .list-item-text": {
|
|
56
|
+
color: template.primary.color
|
|
57
|
+
}, "& .list-item-subtitle": {
|
|
58
|
+
color: template.primary.color
|
|
59
|
+
} }) }), (sx || {})), ref: ref, children: children })) }));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
module.exports = List;
|
|
63
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/List/index.tsx"],"sourcesContent":["\r\nimport React from 'react'\r\nimport { Tag, TagProps, TagComponentType, useInterface, useColorTemplate, UseColorTemplateType, UseColorTemplateColor, useBreakpointProps, useBreakpointPropsType } from '@xanui/core'\r\nimport { ListContext } from './ListContext';\r\n\r\nexport type ListProps<T extends TagComponentType = \"ul\"> = Omit<TagProps<T>, 'color' | \"size\"> & {\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n variant?: useBreakpointPropsType<UseColorTemplateType>;\r\n hoverColor?: useBreakpointPropsType<UseColorTemplateColor>;\r\n hoverVariant?: useBreakpointPropsType<UseColorTemplateType>;\r\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\r\n}\r\n\r\n\r\nconst List = React.forwardRef(<T extends TagComponentType = \"ul\">({ children, ...rest }: ListProps<T>, ref: React.Ref<any>) => {\r\n let [{ sx, color, variant, hoverColor, hoverVariant, size, ...props }] = useInterface<any>(\"List\", rest, {})\r\n const _p: any = {}\r\n if (color) _p.color = color\r\n if (variant) _p.variant = variant\r\n if (hoverColor) _p.hoverColor = hoverColor\r\n if (hoverVariant) _p.hoverVariant = hoverVariant\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n\r\n color = p.color ?? \"brand\"\r\n variant = p.variant ?? \"fill\"\r\n hoverColor = p.hoverColor ?? \"default\"\r\n hoverVariant = p.hoverVariant ?? \"soft\"\r\n size = p.size ?? \"medium\"\r\n\r\n const template = useColorTemplate(color, variant)\r\n const hoverTemplate = useColorTemplate(hoverColor, hoverVariant)\r\n\r\n let sxOutline: any = {}\r\n if (hoverVariant == 'outline' || variant === 'outline') {\r\n sxOutline = {\r\n \"& .list-item\": {\r\n border: \"1px solid\",\r\n borderColor: \"transparent\"\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <ListContext.Provider value={{ size }}>\r\n <Tag\r\n component='ul'\r\n {...props}\r\n baseClass='list'\r\n sxr={{\r\n listStyle: \"none\",\r\n p: 0,\r\n m: 0,\r\n ...sxOutline,\r\n \"& .list-item-icon\": {\r\n color: \"text.secondary\"\r\n },\r\n \"& .list-item-text\": {\r\n color: \"text.primary\"\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: \"text.secondary\"\r\n },\r\n \"& .xui-list-item:not(.list-item-selected):hover\": {\r\n ...hoverTemplate.primary,\r\n \"& .list-item-icon\": {\r\n color: hoverTemplate.primary.color\r\n },\r\n \"& .list-item-text\": {\r\n color: hoverTemplate.primary.color\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: hoverColor === 'default' ? \"text.secondary\" : hoverTemplate.primary.color\r\n },\r\n },\r\n \"& .xui-list-item.list-item-selected\": {\r\n ...template.primary,\r\n \"& .list-item-icon\": {\r\n color: template.primary.color\r\n },\r\n \"& .list-item-text\": {\r\n color: template.primary.color\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: template.primary.color\r\n },\r\n },\r\n ...(sx || {} as any)\r\n }}\r\n ref={ref}\r\n >\r\n {children}\r\n </Tag>\r\n </ListContext.Provider>\r\n )\r\n})\r\n\r\nexport default List"],"names":["__rest","useInterface","useBreakpointProps","useColorTemplate","_jsx","ListContext","Tag"],"mappings":"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"}
|
package/List/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var core = require('@xanui/core');
|
|
7
|
-
var ListContext = require('./ListContext.js');
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useInterface, useBreakpointProps, useColorTemplate, Tag } from '@xanui/core';
|
|
5
|
+
import { ListContext } from './ListContext.js';
|
|
8
6
|
|
|
9
7
|
const List = React.forwardRef((_a, ref) => {
|
|
10
8
|
var _b, _c, _d, _e, _f;
|
|
11
|
-
var { children } = _a, rest =
|
|
12
|
-
let [_g] =
|
|
9
|
+
var { children } = _a, rest = __rest(_a, ["children"]);
|
|
10
|
+
let [_g] = useInterface("List", rest, {}), { sx, color, variant, hoverColor, hoverVariant, size } = _g, props = __rest(_g, ["sx", "color", "variant", "hoverColor", "hoverVariant", "size"]);
|
|
13
11
|
const _p = {};
|
|
14
12
|
if (color)
|
|
15
13
|
_p.color = color;
|
|
@@ -21,14 +19,14 @@ const List = React.forwardRef((_a, ref) => {
|
|
|
21
19
|
_p.hoverVariant = hoverVariant;
|
|
22
20
|
if (size)
|
|
23
21
|
_p.size = size;
|
|
24
|
-
const p =
|
|
22
|
+
const p = useBreakpointProps(_p);
|
|
25
23
|
color = (_b = p.color) !== null && _b !== void 0 ? _b : "brand";
|
|
26
24
|
variant = (_c = p.variant) !== null && _c !== void 0 ? _c : "fill";
|
|
27
25
|
hoverColor = (_d = p.hoverColor) !== null && _d !== void 0 ? _d : "default";
|
|
28
26
|
hoverVariant = (_e = p.hoverVariant) !== null && _e !== void 0 ? _e : "soft";
|
|
29
27
|
size = (_f = p.size) !== null && _f !== void 0 ? _f : "medium";
|
|
30
|
-
const template =
|
|
31
|
-
const hoverTemplate =
|
|
28
|
+
const template = useColorTemplate(color, variant);
|
|
29
|
+
const hoverTemplate = useColorTemplate(hoverColor, hoverVariant);
|
|
32
30
|
let sxOutline = {};
|
|
33
31
|
if (hoverVariant == 'outline' || variant === 'outline') {
|
|
34
32
|
sxOutline = {
|
|
@@ -38,7 +36,7 @@ const List = React.forwardRef((_a, ref) => {
|
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
|
-
return (
|
|
39
|
+
return (jsx(ListContext.Provider, { value: { size }, children: jsx(Tag, Object.assign({ component: 'ul' }, props, { baseClass: 'list', sxr: Object.assign(Object.assign(Object.assign({ listStyle: "none", p: 0, m: 0 }, sxOutline), { "& .list-item-icon": {
|
|
42
40
|
color: "text.secondary"
|
|
43
41
|
}, "& .list-item-text": {
|
|
44
42
|
color: "text.primary"
|
|
@@ -59,5 +57,5 @@ const List = React.forwardRef((_a, ref) => {
|
|
|
59
57
|
} }) }), (sx || {})), ref: ref, children: children })) }));
|
|
60
58
|
});
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
export { List as default };
|
|
63
61
|
//# sourceMappingURL=index.js.map
|
package/List/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/List/index.tsx"],"sourcesContent":["\r\nimport React from 'react'\r\nimport { Tag, TagProps, TagComponentType, useInterface, useColorTemplate, UseColorTemplateType, UseColorTemplateColor, useBreakpointProps, useBreakpointPropsType } from '@xanui/core'\r\nimport { ListContext } from './ListContext';\r\n\r\nexport type ListProps<T extends TagComponentType = \"ul\"> = Omit<TagProps<T>, 'color' | \"size\"> & {\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n variant?: useBreakpointPropsType<UseColorTemplateType>;\r\n hoverColor?: useBreakpointPropsType<UseColorTemplateColor>;\r\n hoverVariant?: useBreakpointPropsType<UseColorTemplateType>;\r\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\r\n}\r\n\r\n\r\nconst List = React.forwardRef(<T extends TagComponentType = \"ul\">({ children, ...rest }: ListProps<T>, ref: React.Ref<any>) => {\r\n let [{ sx, color, variant, hoverColor, hoverVariant, size, ...props }] = useInterface<any>(\"List\", rest, {})\r\n const _p: any = {}\r\n if (color) _p.color = color\r\n if (variant) _p.variant = variant\r\n if (hoverColor) _p.hoverColor = hoverColor\r\n if (hoverVariant) _p.hoverVariant = hoverVariant\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n\r\n color = p.color ?? \"brand\"\r\n variant = p.variant ?? \"fill\"\r\n hoverColor = p.hoverColor ?? \"default\"\r\n hoverVariant = p.hoverVariant ?? \"soft\"\r\n size = p.size ?? \"medium\"\r\n\r\n const template = useColorTemplate(color, variant)\r\n const hoverTemplate = useColorTemplate(hoverColor, hoverVariant)\r\n\r\n let sxOutline: any = {}\r\n if (hoverVariant == 'outline' || variant === 'outline') {\r\n sxOutline = {\r\n \"& .list-item\": {\r\n border: \"1px solid\",\r\n borderColor: \"transparent\"\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <ListContext.Provider value={{ size }}>\r\n <Tag\r\n component='ul'\r\n {...props}\r\n baseClass='list'\r\n sxr={{\r\n listStyle: \"none\",\r\n p: 0,\r\n m: 0,\r\n ...sxOutline,\r\n \"& .list-item-icon\": {\r\n color: \"text.secondary\"\r\n },\r\n \"& .list-item-text\": {\r\n color: \"text.primary\"\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: \"text.secondary\"\r\n },\r\n \"& .xui-list-item:not(.list-item-selected):hover\": {\r\n ...hoverTemplate.primary,\r\n \"& .list-item-icon\": {\r\n color: hoverTemplate.primary.color\r\n },\r\n \"& .list-item-text\": {\r\n color: hoverTemplate.primary.color\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: hoverColor === 'default' ? \"text.secondary\" : hoverTemplate.primary.color\r\n },\r\n },\r\n \"& .xui-list-item.list-item-selected\": {\r\n ...template.primary,\r\n \"& .list-item-icon\": {\r\n color: template.primary.color\r\n },\r\n \"& .list-item-text\": {\r\n color: template.primary.color\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: template.primary.color\r\n },\r\n },\r\n ...(sx || {} as any)\r\n }}\r\n ref={ref}\r\n >\r\n {children}\r\n </Tag>\r\n </ListContext.Provider>\r\n )\r\n})\r\n\r\nexport default List"],"names":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/List/index.tsx"],"sourcesContent":["\r\nimport React from 'react'\r\nimport { Tag, TagProps, TagComponentType, useInterface, useColorTemplate, UseColorTemplateType, UseColorTemplateColor, useBreakpointProps, useBreakpointPropsType } from '@xanui/core'\r\nimport { ListContext } from './ListContext';\r\n\r\nexport type ListProps<T extends TagComponentType = \"ul\"> = Omit<TagProps<T>, 'color' | \"size\"> & {\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n variant?: useBreakpointPropsType<UseColorTemplateType>;\r\n hoverColor?: useBreakpointPropsType<UseColorTemplateColor>;\r\n hoverVariant?: useBreakpointPropsType<UseColorTemplateType>;\r\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\r\n}\r\n\r\n\r\nconst List = React.forwardRef(<T extends TagComponentType = \"ul\">({ children, ...rest }: ListProps<T>, ref: React.Ref<any>) => {\r\n let [{ sx, color, variant, hoverColor, hoverVariant, size, ...props }] = useInterface<any>(\"List\", rest, {})\r\n const _p: any = {}\r\n if (color) _p.color = color\r\n if (variant) _p.variant = variant\r\n if (hoverColor) _p.hoverColor = hoverColor\r\n if (hoverVariant) _p.hoverVariant = hoverVariant\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n\r\n color = p.color ?? \"brand\"\r\n variant = p.variant ?? \"fill\"\r\n hoverColor = p.hoverColor ?? \"default\"\r\n hoverVariant = p.hoverVariant ?? \"soft\"\r\n size = p.size ?? \"medium\"\r\n\r\n const template = useColorTemplate(color, variant)\r\n const hoverTemplate = useColorTemplate(hoverColor, hoverVariant)\r\n\r\n let sxOutline: any = {}\r\n if (hoverVariant == 'outline' || variant === 'outline') {\r\n sxOutline = {\r\n \"& .list-item\": {\r\n border: \"1px solid\",\r\n borderColor: \"transparent\"\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <ListContext.Provider value={{ size }}>\r\n <Tag\r\n component='ul'\r\n {...props}\r\n baseClass='list'\r\n sxr={{\r\n listStyle: \"none\",\r\n p: 0,\r\n m: 0,\r\n ...sxOutline,\r\n \"& .list-item-icon\": {\r\n color: \"text.secondary\"\r\n },\r\n \"& .list-item-text\": {\r\n color: \"text.primary\"\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: \"text.secondary\"\r\n },\r\n \"& .xui-list-item:not(.list-item-selected):hover\": {\r\n ...hoverTemplate.primary,\r\n \"& .list-item-icon\": {\r\n color: hoverTemplate.primary.color\r\n },\r\n \"& .list-item-text\": {\r\n color: hoverTemplate.primary.color\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: hoverColor === 'default' ? \"text.secondary\" : hoverTemplate.primary.color\r\n },\r\n },\r\n \"& .xui-list-item.list-item-selected\": {\r\n ...template.primary,\r\n \"& .list-item-icon\": {\r\n color: template.primary.color\r\n },\r\n \"& .list-item-text\": {\r\n color: template.primary.color\r\n },\r\n \"& .list-item-subtitle\": {\r\n color: template.primary.color\r\n },\r\n },\r\n ...(sx || {} as any)\r\n }}\r\n ref={ref}\r\n >\r\n {children}\r\n </Tag>\r\n </ListContext.Provider>\r\n )\r\n})\r\n\r\nexport default List"],"names":["_jsx"],"mappings":";;;;;;AAcA,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAoC,EAAmC,EAAE,GAAmB,KAAI;;AAA5D,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAAyB,EAApB,IAAI,GAAA,MAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AACjF,IAAA,IAAI,CAAA,EAAA,CAAA,GAAqE,YAAY,CAAM,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAvG,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAA,GAAA,EAAY,EAAP,KAAK,GAAA,MAAA,CAAA,EAAA,EAA9D,CAAA,IAAA,EAAA,OAAA,EAAA,SAAA,EAAA,YAAA,EAAA,cAAA,EAAA,MAAA,CAAgE,CAAuC;IAC5G,MAAM,EAAE,GAAQ,EAAE;AAClB,IAAA,IAAI,KAAK;AAAE,QAAA,EAAE,CAAC,KAAK,GAAG,KAAK;AAC3B,IAAA,IAAI,OAAO;AAAE,QAAA,EAAE,CAAC,OAAO,GAAG,OAAO;AACjC,IAAA,IAAI,UAAU;AAAE,QAAA,EAAE,CAAC,UAAU,GAAG,UAAU;AAC1C,IAAA,IAAI,YAAY;AAAE,QAAA,EAAE,CAAC,YAAY,GAAG,YAAY;AAChD,IAAA,IAAI,IAAI;AAAE,QAAA,EAAE,CAAC,IAAI,GAAG,IAAI;AACxB,IAAA,MAAM,CAAC,GAAQ,kBAAkB,CAAC,EAAE,CAAC;AAErC,IAAA,KAAK,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,OAAO;AAC1B,IAAA,OAAO,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,MAAM;AAC7B,IAAA,UAAU,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,SAAS;AACtC,IAAA,YAAY,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,MAAM;AACvC,IAAA,IAAI,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,QAAQ;IAEzB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC;IACjD,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC;IAEhE,IAAI,SAAS,GAAQ,EAAE;IACvB,IAAI,YAAY,IAAI,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE;AACpD,QAAA,SAAS,GAAG;AACR,YAAA,cAAc,EAAE;AACZ,gBAAA,MAAM,EAAE,WAAW;AACnB,gBAAA,WAAW,EAAE;AAChB;SACJ;IACL;AAEA,IAAA,QACIA,GAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAA,QAAA,EACjCA,IAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EACA,SAAS,EAAC,IAAI,IACV,KAAK,EAAA,EACT,SAAS,EAAC,MAAM,EAChB,GAAG,8CACC,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,IACD,SAAS,CAAA,EAAA,EACZ,mBAAmB,EAAE;AACjB,oBAAA,KAAK,EAAE;AACV,iBAAA,EACD,mBAAmB,EAAE;AACjB,oBAAA,KAAK,EAAE;AACV,iBAAA,EACD,uBAAuB,EAAE;AACrB,oBAAA,KAAK,EAAE;AACV,iBAAA,EACD,iDAAiD,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC1C,aAAa,CAAC,OAAO,CAAA,EAAA,EACxB,mBAAmB,EAAE;AACjB,wBAAA,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;AAChC,qBAAA,EACD,mBAAmB,EAAE;AACjB,wBAAA,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;AAChC,qBAAA,EACD,uBAAuB,EAAE;AACrB,wBAAA,KAAK,EAAE,UAAU,KAAK,SAAS,GAAG,gBAAgB,GAAG,aAAa,CAAC,OAAO,CAAC;AAC9E,qBAAA,EAAA,CAAA,EAEL,qCAAqC,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC9B,QAAQ,CAAC,OAAO,CAAA,EAAA,EACnB,mBAAmB,EAAE;AACjB,wBAAA,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;AAC3B,qBAAA,EACD,mBAAmB,EAAE;AACjB,wBAAA,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;AAC3B,qBAAA,EACD,uBAAuB,EAAE;AACrB,wBAAA,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;AAC3B,qBAAA,EAAA,CAAA,EAAA,CAAA,GAED,EAAE,IAAI,EAAS,EAAC,EAExB,GAAG,EAAE,GAAG,EAAA,QAAA,EAEP,QAAQ,EAAA,CAAA,CACP,EAAA,CACa;AAE/B,CAAC;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
var index = require('../Text/index.cjs');
|
|
8
|
+
var ListContext = require('../List/ListContext.cjs');
|
|
9
|
+
|
|
10
|
+
const ListItem = React.forwardRef((_a, ref) => {
|
|
11
|
+
var _b, _c;
|
|
12
|
+
var { children, startIcon, endIcon, subtitle, size } = _a, rest = tslib.__rest(_a, ["children", "startIcon", "endIcon", "subtitle", "size"]);
|
|
13
|
+
let [_d] = core.useInterface("ListItem", rest, {}), { selected } = _d, props = tslib.__rest(_d, ["selected"]);
|
|
14
|
+
const _p = {};
|
|
15
|
+
if (subtitle)
|
|
16
|
+
_p.subtitle = subtitle;
|
|
17
|
+
if (startIcon)
|
|
18
|
+
_p.startIcon = startIcon;
|
|
19
|
+
if (endIcon)
|
|
20
|
+
_p.endIcon = endIcon;
|
|
21
|
+
if (size)
|
|
22
|
+
_p.size = size;
|
|
23
|
+
const p = core.useBreakpointProps(_p);
|
|
24
|
+
const ctx = ListContext.useListContext();
|
|
25
|
+
subtitle = p.subtitle;
|
|
26
|
+
startIcon = p.startIcon;
|
|
27
|
+
endIcon = p.endIcon;
|
|
28
|
+
size = (_c = (_b = p.size) !== null && _b !== void 0 ? _b : ctx === null || ctx === void 0 ? void 0 : ctx.size) !== null && _c !== void 0 ? _c : "medium";
|
|
29
|
+
let sizes = {
|
|
30
|
+
small: {
|
|
31
|
+
fontSize: "button",
|
|
32
|
+
py: 0.5,
|
|
33
|
+
px: 1,
|
|
34
|
+
minHeight: 32,
|
|
35
|
+
},
|
|
36
|
+
medium: {
|
|
37
|
+
fontSize: "text",
|
|
38
|
+
py: 1,
|
|
39
|
+
px: 1.5,
|
|
40
|
+
minHeight: 40,
|
|
41
|
+
},
|
|
42
|
+
large: {
|
|
43
|
+
fontSize: "h6",
|
|
44
|
+
py: 1.5,
|
|
45
|
+
px: 2,
|
|
46
|
+
minHeight: 48,
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return (jsxRuntime.jsxs(core.Tag, Object.assign({ component: 'li' }, props, { sxr: Object.assign({ alignItems: "center", display: "flex", flexDirection: "row", userSelect: "none", cursor: "pointer", lineHeight: 1.4, whiteSpace: "nowrap", flexShrink: "0" }, sizes[size]), baseClass: 'list-item', classNames: [{ "list-item-selected": selected }, ...(props.classNames || [])], ref: ref, children: [startIcon && jsxRuntime.jsx(core.Tag, { mr: 1, component: "span", display: "inline-block", className: 'list-item-icon', children: startIcon }), jsxRuntime.jsxs(core.Tag, { flex: 1, children: [jsxRuntime.jsx(index, { variant: "text", className: 'list-item-text', component: typeof children === "string" || typeof children === "number" ? "p" : "div", children: children }), subtitle && jsxRuntime.jsx(index, { variant: "text", fontSize: "button", className: 'list-item-subtitle', component: typeof subtitle === "string" || typeof subtitle === "number" ? "p" : "div", children: subtitle })] }), endIcon && jsxRuntime.jsx(core.Tag, { ml: 1, component: "span", display: "inline-block", className: 'list-item-icon', children: endIcon })] })));
|
|
50
|
+
});
|
|
51
|
+
ListItem.displayName = "ListItem";
|
|
52
|
+
|
|
53
|
+
module.exports = ListItem;
|
|
54
|
+
//# sourceMappingURL=index.cjs.map
|