@xanui/ui 1.1.38 → 1.1.41

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.
Files changed (157) hide show
  1. package/Accordion/index.cjs +96 -0
  2. package/Accordion/index.cjs.map +1 -0
  3. package/Accordion/index.js.map +1 -1
  4. package/Alert/index.cjs +121 -0
  5. package/Alert/index.cjs.map +1 -0
  6. package/Autocomplete/index.cjs +136 -0
  7. package/Autocomplete/index.cjs.map +1 -0
  8. package/Avatar/index.cjs +50 -0
  9. package/Avatar/index.cjs.map +1 -0
  10. package/Badge/index.cjs +109 -0
  11. package/Badge/index.cjs.map +1 -0
  12. package/Box/index.cjs +14 -0
  13. package/Box/index.cjs.map +1 -0
  14. package/Button/index.cjs +94 -0
  15. package/Button/index.cjs.map +1 -0
  16. package/ButtonGroup/index.cjs +58 -0
  17. package/ButtonGroup/index.cjs.map +1 -0
  18. package/Calendar/index.cjs +174 -0
  19. package/Calendar/index.cjs.map +1 -0
  20. package/CalendarInput/index.cjs +34 -0
  21. package/CalendarInput/index.cjs.map +1 -0
  22. package/Checkbox/index.cjs +58 -0
  23. package/Checkbox/index.cjs.map +1 -0
  24. package/Chip/index.cjs +76 -0
  25. package/Chip/index.cjs.map +1 -0
  26. package/CircleProgress/index.cjs +129 -0
  27. package/CircleProgress/index.cjs.map +1 -0
  28. package/ClickOutside/index.cjs +37 -0
  29. package/ClickOutside/index.cjs.map +1 -0
  30. package/Collaps/index.cjs +26 -0
  31. package/Collaps/index.cjs.map +1 -0
  32. package/Container/index.cjs +29 -0
  33. package/Container/index.cjs.map +1 -0
  34. package/DataFilter/index.cjs +78 -0
  35. package/DataFilter/index.cjs.map +1 -0
  36. package/DataFilter/options/DateFilter.cjs +32 -0
  37. package/DataFilter/options/DateFilter.cjs.map +1 -0
  38. package/DataFilter/options/DateRangeFilter.cjs +27 -0
  39. package/DataFilter/options/DateRangeFilter.cjs.map +1 -0
  40. package/DataFilter/options/MultiSelectFilter.cjs +38 -0
  41. package/DataFilter/options/MultiSelectFilter.cjs.map +1 -0
  42. package/DataFilter/options/NumberFilter.cjs +24 -0
  43. package/DataFilter/options/NumberFilter.cjs.map +1 -0
  44. package/DataFilter/options/NumberRangeFilter.cjs +29 -0
  45. package/DataFilter/options/NumberRangeFilter.cjs.map +1 -0
  46. package/DataFilter/options/SelectFilter.cjs +34 -0
  47. package/DataFilter/options/SelectFilter.cjs.map +1 -0
  48. package/DataFilter/options/TextFilter.cjs +24 -0
  49. package/DataFilter/options/TextFilter.cjs.map +1 -0
  50. package/Datatable/FilterBox.cjs +39 -0
  51. package/Datatable/FilterBox.cjs.map +1 -0
  52. package/Datatable/Row.cjs +59 -0
  53. package/Datatable/Row.cjs.map +1 -0
  54. package/Datatable/SelectedBox.cjs +21 -0
  55. package/Datatable/SelectedBox.cjs.map +1 -0
  56. package/Datatable/Table.cjs +23 -0
  57. package/Datatable/Table.cjs.map +1 -0
  58. package/Datatable/TableHead.cjs +61 -0
  59. package/Datatable/TableHead.cjs.map +1 -0
  60. package/Datatable/index.cjs +93 -0
  61. package/Datatable/index.cjs.map +1 -0
  62. package/Divider/index.cjs +31 -0
  63. package/Divider/index.cjs.map +1 -0
  64. package/Drawer/index.cjs +78 -0
  65. package/Drawer/index.cjs.map +1 -0
  66. package/Form/index.cjs +45 -0
  67. package/Form/index.cjs.map +1 -0
  68. package/GridContainer/index.cjs +19 -0
  69. package/GridContainer/index.cjs.map +1 -0
  70. package/GridItem/index.cjs +20 -0
  71. package/GridItem/index.cjs.map +1 -0
  72. package/IconButton/index.cjs +64 -0
  73. package/IconButton/index.cjs.map +1 -0
  74. package/Image/index.cjs +27 -0
  75. package/Image/index.cjs.map +1 -0
  76. package/Input/index.cjs +144 -0
  77. package/Input/index.cjs.map +1 -0
  78. package/InputNumber/index.cjs +32 -0
  79. package/InputNumber/index.cjs.map +1 -0
  80. package/Label/index.cjs +24 -0
  81. package/Label/index.cjs.map +1 -0
  82. package/Layer/index.cjs +62 -0
  83. package/Layer/index.cjs.map +1 -0
  84. package/LineProgress/index.cjs +59 -0
  85. package/LineProgress/index.cjs.map +1 -0
  86. package/List/ListContext.cjs +11 -0
  87. package/List/ListContext.cjs.map +1 -0
  88. package/List/index.cjs +63 -0
  89. package/List/index.cjs.map +1 -0
  90. package/ListItem/index.cjs +54 -0
  91. package/ListItem/index.cjs.map +1 -0
  92. package/LoadingBox/index.cjs +32 -0
  93. package/LoadingBox/index.cjs.map +1 -0
  94. package/Menu/index.cjs +150 -0
  95. package/Menu/index.cjs.map +1 -0
  96. package/Modal/index.cjs +59 -0
  97. package/Modal/index.cjs.map +1 -0
  98. package/NoSSR/index.cjs +15 -0
  99. package/NoSSR/index.cjs.map +1 -0
  100. package/Option/index.cjs +14 -0
  101. package/Option/index.cjs.map +1 -0
  102. package/Paper/index.cjs +15 -0
  103. package/Paper/index.cjs.map +1 -0
  104. package/Portal/index.cjs +27 -0
  105. package/Portal/index.cjs.map +1 -0
  106. package/Radio/index.cjs +16 -0
  107. package/Radio/index.cjs.map +1 -0
  108. package/Scrollbar/index.cjs +59 -0
  109. package/Scrollbar/index.cjs.map +1 -0
  110. package/Select/index.cjs +59 -0
  111. package/Select/index.cjs.map +1 -0
  112. package/Skeleton/index.cjs +60 -0
  113. package/Skeleton/index.cjs.map +1 -0
  114. package/Stack/index.cjs +17 -0
  115. package/Stack/index.cjs.map +1 -0
  116. package/Switch/index.cjs +79 -0
  117. package/Switch/index.cjs.map +1 -0
  118. package/Tab/index.cjs +17 -0
  119. package/Tab/index.cjs.map +1 -0
  120. package/Table/index.cjs +88 -0
  121. package/Table/index.cjs.map +1 -0
  122. package/TableBody/index.cjs +14 -0
  123. package/TableBody/index.cjs.map +1 -0
  124. package/TableCell/index.cjs +14 -0
  125. package/TableCell/index.cjs.map +1 -0
  126. package/TableFooter/index.cjs +14 -0
  127. package/TableFooter/index.cjs.map +1 -0
  128. package/TableHead/index.cjs +14 -0
  129. package/TableHead/index.cjs.map +1 -0
  130. package/TablePagination/index.cjs +59 -0
  131. package/TablePagination/index.cjs.map +1 -0
  132. package/TableRow/index.cjs +14 -0
  133. package/TableRow/index.cjs.map +1 -0
  134. package/Tabs/index.cjs +201 -0
  135. package/Tabs/index.cjs.map +1 -0
  136. package/Text/index.cjs +25 -0
  137. package/Text/index.cjs.map +1 -0
  138. package/Toast/index.cjs +120 -0
  139. package/Toast/index.cjs.map +1 -0
  140. package/Tooltip/index.cjs +40 -0
  141. package/Tooltip/index.cjs.map +1 -0
  142. package/ViewBox/index.cjs +32 -0
  143. package/ViewBox/index.cjs.map +1 -0
  144. package/index.cjs +134 -0
  145. package/index.cjs.map +1 -0
  146. package/package.json +3 -3
  147. package/readme.md +4 -4
  148. package/useAlert/index.cjs +94 -0
  149. package/useAlert/index.cjs.map +1 -0
  150. package/useBlurCss/index.cjs +19 -0
  151. package/useBlurCss/index.cjs.map +1 -0
  152. package/useCorner/index.cjs +22 -0
  153. package/useCorner/index.cjs.map +1 -0
  154. package/useLayer/index.cjs +38 -0
  155. package/useLayer/index.cjs.map +1 -0
  156. package/useModal/index.cjs +37 -0
  157. package/useModal/index.cjs.map +1 -0
@@ -0,0 +1,31 @@
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 Divider = React.forwardRef((_a, ref) => {
9
+ var _b, _c, _d;
10
+ var { children, direction, color, size } = _a, rest = tslib.__rest(_a, ["children", "direction", "color", "size"]);
11
+ const _p = {};
12
+ if (direction)
13
+ _p.direction = direction;
14
+ if (color)
15
+ _p.color = color;
16
+ if (size)
17
+ _p.size = size;
18
+ const p = core.useBreakpointProps(_p);
19
+ direction = (_b = p.direction) !== null && _b !== void 0 ? _b : "horizental";
20
+ color = (_c = p.color) !== null && _c !== void 0 ? _c : "default";
21
+ size = (_d = p.size) !== null && _d !== void 0 ? _d : 1;
22
+ let isHori = direction === 'horizental';
23
+ return (jsxRuntime.jsx(core.Tag, Object.assign({}, rest, { baseClass: 'divider', sxr: {
24
+ width: isHori ? "100%" : size,
25
+ height: isHori ? size : "100%",
26
+ bgcolor: color === 'default' ? `background.secondary` : `${color}.secondary`,
27
+ }, ref: ref, children: children })));
28
+ });
29
+
30
+ module.exports = Divider;
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Divider/index.tsx"],"sourcesContent":["import React from 'react';\r\nimport { Tag, TagProps, TagComponentType, UseColorTemplateColor, useBreakpointProps, useBreakpointPropsType } from '@xanui/core';\r\n\r\n\r\nexport type DividerProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, \"color\"> & {\r\n direction?: useBreakpointPropsType<\"verticle\" | \"horizental\">;\r\n color?: useBreakpointPropsType<UseColorTemplateColor>;\r\n size?: useBreakpointPropsType<number>;\r\n}\r\n\r\nconst Divider = React.forwardRef(<T extends TagComponentType = \"div\">({ children, direction, color, size, ...rest }: DividerProps<T>, ref: React.Ref<any>) => {\r\n const _p: any = {}\r\n if (direction) _p.direction = direction\r\n if (color) _p.color = color\r\n if (size) _p.size = size\r\n const p: any = useBreakpointProps(_p)\r\n direction = p.direction ?? \"horizental\"\r\n color = p.color ?? \"default\"\r\n size = p.size ?? 1\r\n\r\n let isHori = direction === 'horizental'\r\n\r\n return (\r\n <Tag\r\n {...rest}\r\n baseClass='divider'\r\n sxr={{\r\n width: isHori ? \"100%\" : size,\r\n height: isHori ? size : \"100%\",\r\n bgcolor: color === 'default' ? `background.secondary` : `${color}.secondary`,\r\n }}\r\n ref={ref}\r\n >{children}</Tag>\r\n )\r\n})\r\n\r\nexport default Divider\r\n\r\n"],"names":["__rest","useBreakpointProps","_jsx","Tag"],"mappings":";;;;;;;AAUA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAA8D,EAAE,GAAmB,KAAI;;AAAvF,IAAA,IAAA,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAA,GAAA,EAA4B,EAAvB,IAAI,GAAAA,YAAA,CAAA,EAAA,EAA3C,CAAA,UAAA,EAAA,WAAA,EAAA,OAAA,EAAA,MAAA,CAA6C,CAAF;IAC7G,MAAM,EAAE,GAAQ,EAAE;AAClB,IAAA,IAAI,SAAS;AAAE,QAAA,EAAE,CAAC,SAAS,GAAG,SAAS;AACvC,IAAA,IAAI,KAAK;AAAE,QAAA,EAAE,CAAC,KAAK,GAAG,KAAK;AAC3B,IAAA,IAAI,IAAI;AAAE,QAAA,EAAE,CAAC,IAAI,GAAG,IAAI;AACxB,IAAA,MAAM,CAAC,GAAQC,uBAAkB,CAAC,EAAE,CAAC;AACrC,IAAA,SAAS,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,YAAY;AACvC,IAAA,KAAK,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,KAAK,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,SAAS;AAC5B,IAAA,IAAI,GAAG,CAAA,EAAA,GAAA,CAAC,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,CAAC;AAElB,IAAA,IAAI,MAAM,GAAG,SAAS,KAAK,YAAY;IAEvC,QACIC,cAAA,CAACC,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,IAAI,EAAA,EACR,SAAS,EAAC,SAAS,EACnB,GAAG,EAAE;YACD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;YAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;AAC9B,YAAA,OAAO,EAAE,KAAK,KAAK,SAAS,GAAG,CAAA,oBAAA,CAAsB,GAAG,CAAA,EAAG,KAAK,CAAA,UAAA,CAAY;AAC/E,SAAA,EACD,GAAG,EAAE,GAAG,YACV,QAAQ,EAAA,CAAA,CAAO;AAEzB,CAAC;;;;"}
@@ -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/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;;"}
@@ -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;;;;"}
@@ -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;;;;"}
@@ -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;;"}
@@ -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;;"}
@@ -0,0 +1,144 @@
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('../Label/index.cjs');
9
+
10
+ const Input = React.forwardRef((_a, ref) => {
11
+ var _b, _c, _d;
12
+ var { value, refs } = _a, props = tslib.__rest(_a, ["value", "refs"]);
13
+ let [_e, theme] = core.useInterface("Input", props, {}), { startIcon, endIcon, iconPlacement, color, label, name, placeholder, type, readOnly, autoFocus, autoComplete, onFocus, onBlur, onChange, onKeyDown, onKeyUp, focused, disabled, variant, error, helperText, multiline, size, rows, minRows, maxRows, fullWidth, slotProps } = _e, rest = tslib.__rest(_e, ["startIcon", "endIcon", "iconPlacement", "color", "label", "name", "placeholder", "type", "readOnly", "autoFocus", "autoComplete", "onFocus", "onBlur", "onChange", "onKeyDown", "onKeyUp", "focused", "disabled", "variant", "error", "helperText", "multiline", "size", "rows", "minRows", "maxRows", "fullWidth", "slotProps"]);
14
+ const _p = {};
15
+ if (startIcon)
16
+ _p.startIcon = startIcon;
17
+ if (endIcon)
18
+ _p.endIcon = endIcon;
19
+ if (iconPlacement)
20
+ _p.iconPlacement = iconPlacement;
21
+ if (color)
22
+ _p.color = color;
23
+ if (variant)
24
+ _p.variant = variant;
25
+ if (helperText)
26
+ _p.helperText = helperText;
27
+ if (size)
28
+ _p.size = size;
29
+ if (rows)
30
+ _p.rows = rows;
31
+ if (minRows)
32
+ _p.minRows = minRows;
33
+ if (maxRows)
34
+ _p.maxRows = maxRows;
35
+ const p = core.useBreakpointProps(_p);
36
+ startIcon = p.startIcon;
37
+ endIcon = p.endIcon;
38
+ iconPlacement = p.iconPlacement;
39
+ color = (_b = p.color) !== null && _b !== void 0 ? _b : "brand";
40
+ variant = (_c = p.variant) !== null && _c !== void 0 ? _c : "fill";
41
+ helperText = p.helperText;
42
+ size = (_d = p.size) !== null && _d !== void 0 ? _d : 'medium';
43
+ rows = p.rows;
44
+ minRows = p.minRows;
45
+ maxRows = p.maxRows;
46
+ iconPlacement !== null && iconPlacement !== void 0 ? iconPlacement : (iconPlacement = multiline ? "end" : "center");
47
+ if (!value)
48
+ iconPlacement = 'center';
49
+ const [_focused, setFocused] = React.useState(false);
50
+ let _focus = focused || _focused;
51
+ const inputRef = React.useRef(null);
52
+ const inputMergeRef = core.useMergeRefs(inputRef, refs === null || refs === void 0 ? void 0 : refs.input);
53
+ React.useEffect(() => {
54
+ if (autoFocus) {
55
+ setTimeout(() => {
56
+ var _a;
57
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
58
+ }, 100);
59
+ }
60
+ }, [autoFocus]);
61
+ let _rows = React.useMemo(() => {
62
+ if (rows)
63
+ return rows;
64
+ if (value && multiline) {
65
+ let lines = value.split(`\n`).length;
66
+ if (minRows && minRows > lines) {
67
+ return minRows;
68
+ }
69
+ else if (maxRows && maxRows < lines) {
70
+ return maxRows;
71
+ }
72
+ else {
73
+ return lines;
74
+ }
75
+ }
76
+ }, [value]) || 1;
77
+ const sizes = {
78
+ small: {
79
+ height: 38,
80
+ gap: .5,
81
+ fontSize: 'button',
82
+ },
83
+ medium: {
84
+ height: 46,
85
+ gap: 1,
86
+ fontSize: "text"
87
+ },
88
+ large: {
89
+ height: 52,
90
+ gap: 1,
91
+ fontSize: 'big'
92
+ }
93
+ };
94
+ const _size = sizes[size];
95
+ let borderColor = _focus ? color : (variant === "fill" ? "transparent" : "divider");
96
+ borderColor = error ? "danger.primary" : borderColor;
97
+ let multiprops = {};
98
+ if (multiline) {
99
+ multiprops = {
100
+ rows: _rows,
101
+ sx: {
102
+ resize: "none"
103
+ }
104
+ };
105
+ }
106
+ return (jsxRuntime.jsxs(core.Tag, Object.assign({ width: fullWidth ? "100%" : "auto" }, rest, { ref: ref, baseClass: "input-wrapper", sxr: {
107
+ display: 'flex',
108
+ flexDirection: 'column',
109
+ gap: .5,
110
+ }, children: [!!label && jsxRuntime.jsx(index, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.label, { ref: refs === null || refs === void 0 ? void 0 : refs.label, children: label })), jsxRuntime.jsxs(core.Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputRoot, { ref: refs === null || refs === void 0 ? void 0 : refs.inputRoot, baseClass: 'input-root', sxr: {
111
+ width: "100%",
112
+ overflow: "hidden",
113
+ }, children: [jsxRuntime.jsxs(core.Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.rootContainer, { ref: refs === null || refs === void 0 ? void 0 : refs.rootContainer, baseClass: 'input-root-container', sxr: Object.assign(Object.assign({ width: "100%", display: "flex", flexDirection: "row", alignItems: iconPlacement === 'center' ? iconPlacement : `flex-${iconPlacement}`, flexWrap: "nowrap", transitionProperty: "border, box-shadow, background", bgcolor: error ? "danger.soft.primary" : variant === "fill" ? "background.secondary" : "background.primary", border: variant === "text" ? 0 : "1px solid", borderColor: borderColor, borderRadius: 1, px: 1 }, _size), { height: multiline ? "auto" : _size.height, minHeight: _size.height, "& input:-webkit-autofill,& input:-webkit-autofill:hover, & input:-webkit-autofill:focus,& input:-webkit-autofill:active": {
114
+ "-webkit-text-fill-color": "text.primary",
115
+ "box-shadow": `0 0 0px 1000px ${variant === "fill" ? theme.colors.background.secondary : theme.colors.background.primary} inset`,
116
+ transition: "background-color 5000s ease-in-out 0s"
117
+ }, "& textarea": {
118
+ resize: "none"
119
+ } }), disabled: disabled || false, children: [startIcon, jsxRuntime.jsx(core.Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, { ref: inputMergeRef, baseClass: 'input', component: multiline ? 'textarea' : 'input' }, multiprops, { sxr: {
120
+ border: 0,
121
+ outline: 0,
122
+ bgcolor: "transparent",
123
+ color: error ? "danger.primary" : "text.primary",
124
+ fontSize: _size.fontSize,
125
+ height: multiline ? "auto" : _size.height + "px!important",
126
+ width: "100%",
127
+ maxHeight: 200,
128
+ }, value: value, onChange: onChange, onFocus: (e) => {
129
+ focused !== null && focused !== void 0 ? focused : setFocused(true);
130
+ onFocus && onFocus(e);
131
+ }, onBlur: (e) => {
132
+ focused !== null && focused !== void 0 ? focused : setFocused(false);
133
+ onBlur && onBlur(e);
134
+ }, onKeyDown: onKeyDown, onKeyUp: onKeyUp, name: name, placeholder: placeholder, type: type, readOnly: readOnly, autoComplete: autoComplete })), endIcon] })), helperText && jsxRuntime.jsx(core.Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.helperText, { ref: refs === null || refs === void 0 ? void 0 : refs.helperText, baseClass: "input-helper-text", sxr: {
135
+ color: error ? "danger.primary" : "text.primary",
136
+ fontSize: "small",
137
+ lineHeight: "text",
138
+ fontWeight: 'text',
139
+ pl: .5,
140
+ }, children: helperText }))] }))] })));
141
+ });
142
+
143
+ module.exports = Input;
144
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Input/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { ReactElement, useEffect, useMemo, useState } from 'react';\r\nimport { Tag, TagProps, TagComponentType, UseColorTemplateColor, useBreakpointPropsType, useInterface, useBreakpointProps, useMergeRefs } from '@xanui/core';\r\nimport Label, { LabelProps } from '../Label';\r\n\r\nexport type InputProps<T extends TagComponentType = \"div\"> = Omit<TagProps<T>, \"size\" | \"color\" | \"label\"> & {\r\n value?: string;\r\n type?: TagProps<'input'>['type'];\r\n name?: string;\r\n placeholder?: string;\r\n readOnly?: boolean;\r\n autoFocus?: boolean;\r\n autoComplete?: string;\r\n label?: useBreakpointPropsType<string>;\r\n\r\n onFocus?: (e: React.FocusEvent<any>) => void;\r\n onBlur?: (e: React.FocusEvent<any>) => void;\r\n onChange?: (e: React.ChangeEvent<any>) => void;\r\n onInput?: (e: React.FormEvent<any>) => void;\r\n onKeyDown?: (e: React.KeyboardEvent<any>) => void;\r\n onKeyUp?: (e: React.KeyboardEvent<any>) => void;\r\n\r\n rows?: useBreakpointPropsType<number>;\r\n minRows?: useBreakpointPropsType<number>;\r\n maxRows?: useBreakpointPropsType<number>;\r\n fullWidth?: boolean;\r\n\r\n startIcon?: useBreakpointPropsType<ReactElement>;\r\n endIcon?: useBreakpointPropsType<ReactElement>;\r\n iconPlacement?: useBreakpointPropsType<\"start\" | \"center\" | \"end\">;\r\n focused?: boolean;\r\n color?: useBreakpointPropsType<Omit<UseColorTemplateColor, \"default\">>;\r\n variant?: useBreakpointPropsType<\"fill\" | \"outline\" | \"text\">;\r\n error?: boolean;\r\n helperText?: useBreakpointPropsType<string>;\r\n multiline?: boolean;\r\n size?: useBreakpointPropsType<\"small\" | \"medium\" | \"large\">;\r\n\r\n refs?: {\r\n inputRoot?: React.Ref<\"div\">;\r\n label?: React.Ref<\"label\">;\r\n rootContainer?: React.Ref<\"div\">;\r\n // startIcon?: React.Ref<ReactElement>;\r\n // endIcon?: React.Ref<ReactElement>;\r\n // inputContainer?: React.Ref<\"div\">;\r\n input?: React.Ref<'input' | 'textarea'>;\r\n helperText?: React.Ref<\"div\">;\r\n };\r\n\r\n slotProps?: {\r\n inputRoot?: Omit<TagProps<\"div\">, \"children\">;\r\n label?: Omit<LabelProps, \"children\">;\r\n rootContainer?: Omit<TagProps<\"div\">, \"children\">;\r\n // startIcon?: Omit<TagProps<'div'>, \"children\">;\r\n // endIcon?: Omit<TagProps<'div'>, \"children\">;\r\n // inputContainer?: Omit<TagProps<\"div\">, \"children\">;\r\n helperText?: Omit<TagProps<\"div\">, \"children\">;\r\n input?: Partial<TagProps<T>>;\r\n }\r\n}\r\n\r\nconst Input = React.forwardRef(<T extends TagComponentType = \"div\">({ value, refs, ...props }: InputProps<T>, ref?: React.Ref<any>) => {\r\n let [{\r\n startIcon,\r\n endIcon,\r\n iconPlacement,\r\n color,\r\n label,\r\n name,\r\n placeholder,\r\n type,\r\n readOnly,\r\n autoFocus,\r\n autoComplete,\r\n onFocus,\r\n onBlur,\r\n onChange,\r\n onKeyDown,\r\n onKeyUp,\r\n\r\n focused,\r\n disabled,\r\n variant,\r\n error,\r\n helperText,\r\n multiline,\r\n size,\r\n rows,\r\n minRows,\r\n maxRows,\r\n fullWidth,\r\n slotProps,\r\n\r\n ...rest\r\n }, theme] = useInterface<any>(\"Input\", props, {})\r\n\r\n const _p: any = {}\r\n if (startIcon) _p.startIcon = startIcon\r\n if (endIcon) _p.endIcon = endIcon\r\n if (iconPlacement) _p.iconPlacement = iconPlacement\r\n if (color) _p.color = color\r\n if (variant) _p.variant = variant\r\n if (helperText) _p.helperText = helperText\r\n if (size) _p.size = size\r\n if (rows) _p.rows = rows\r\n if (minRows) _p.minRows = minRows\r\n if (maxRows) _p.maxRows = maxRows\r\n const p: any = useBreakpointProps(_p)\r\n startIcon = p.startIcon\r\n endIcon = p.endIcon\r\n iconPlacement = p.iconPlacement\r\n color = p.color ?? \"brand\"\r\n variant = p.variant ?? \"fill\"\r\n helperText = p.helperText\r\n size = p.size ?? 'medium'\r\n rows = p.rows\r\n minRows = p.minRows\r\n maxRows = p.maxRows\r\n\r\n iconPlacement ??= multiline ? \"end\" : \"center\"\r\n if (!value) iconPlacement = 'center'\r\n\r\n const [_focused, setFocused] = useState(false)\r\n let _focus = focused || _focused\r\n const inputRef = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);\r\n const inputMergeRef = useMergeRefs(inputRef, refs?.input as any);\r\n\r\n useEffect(() => {\r\n if (autoFocus) {\r\n setTimeout(() => {\r\n inputRef.current?.focus()\r\n }, 100);\r\n }\r\n }, [autoFocus])\r\n\r\n let _rows = useMemo(() => {\r\n if (rows) return rows\r\n if (value && multiline) {\r\n let lines = (value as string).split(`\\n`).length\r\n if (minRows && minRows > lines) {\r\n return minRows\r\n } else if (maxRows && maxRows < lines) {\r\n return maxRows\r\n } else {\r\n return lines\r\n }\r\n }\r\n }, [value]) || 1\r\n\r\n const sizes: any = {\r\n small: {\r\n height: 38,\r\n gap: .5,\r\n fontSize: 'button',\r\n },\r\n medium: {\r\n height: 46,\r\n gap: 1,\r\n fontSize: \"text\"\r\n },\r\n large: {\r\n height: 52,\r\n gap: 1,\r\n fontSize: 'big'\r\n }\r\n }\r\n\r\n const _size = sizes[size]\r\n let borderColor = _focus ? color : (variant === \"fill\" ? \"transparent\" : \"divider\")\r\n borderColor = error ? \"danger.primary\" : borderColor\r\n let multiprops: any = {}\r\n if (multiline) {\r\n multiprops = {\r\n rows: _rows,\r\n sx: {\r\n resize: \"none\"\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <Tag\r\n width={fullWidth ? \"100%\" : \"auto\"}\r\n {...rest}\r\n ref={ref}\r\n baseClass=\"input-wrapper\"\r\n sxr={{\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: .5,\r\n }}\r\n >\r\n {!!label && <Label {...slotProps?.label} ref={refs?.label}>{label}</Label>}\r\n <Tag\r\n {...slotProps?.inputRoot}\r\n ref={refs?.inputRoot}\r\n baseClass={'input-root'}\r\n sxr={{\r\n width: \"100%\",\r\n overflow: \"hidden\",\r\n }}\r\n >\r\n <Tag\r\n {...slotProps?.rootContainer}\r\n ref={refs?.rootContainer}\r\n baseClass='input-root-container'\r\n sxr={{\r\n width: \"100%\",\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n alignItems: iconPlacement === 'center' ? iconPlacement : `flex-${iconPlacement}`,\r\n flexWrap: \"nowrap\",\r\n transitionProperty: \"border, box-shadow, background\",\r\n bgcolor: error ? \"danger.soft.primary\" : variant === \"fill\" ? \"background.secondary\" : \"background.primary\",\r\n border: variant === \"text\" ? 0 : \"1px solid\",\r\n borderColor: borderColor,\r\n borderRadius: 1,\r\n px: 1,\r\n // py: .5,\r\n ..._size,\r\n height: multiline ? \"auto\" : _size.height,\r\n minHeight: _size.height,\r\n \"& input:-webkit-autofill,& input:-webkit-autofill:hover, & input:-webkit-autofill:focus,& input:-webkit-autofill:active\": {\r\n \"-webkit-text-fill-color\": \"text.primary\",\r\n \"box-shadow\": `0 0 0px 1000px ${variant === \"fill\" ? theme.colors.background.secondary : theme.colors.background.primary} inset`,\r\n transition: \"background-color 5000s ease-in-out 0s\"\r\n } as any,\r\n \"& textarea\": {\r\n resize: \"none\"\r\n },\r\n\r\n // ...(!!startIcon && {\r\n // \"& :first-child\": {\r\n // height: \"100%\",\r\n // alignItems: 'center',\r\n // justifyContent: \"center\",\r\n // display: \"flex\",\r\n // color: error ? \"danger.primary\" : \"text.secondary\",\r\n // flex: \"0 0 auto\",\r\n // },\r\n // }),\r\n\r\n // ...(!!endIcon && {\r\n // \"& :last-child\": {\r\n // height: \"100%\",\r\n // alignItems: 'center',\r\n // justifyContent: \"center\",\r\n // display: 'flex',\r\n // color: error ? \"danger.primary\" : \"text.secondary\",\r\n // flex: \"0 0 auto\",\r\n // },\r\n // })\r\n\r\n }}\r\n disabled={disabled || false}\r\n >\r\n {/* {startIcon && <Tag\r\n {...slotProps?.startIcon}\r\n ref={refs?.startIcon}\r\n flex={\"0 0 auto\"}\r\n sxr={{\r\n height: \"100%\",\r\n alignItems: 'center',\r\n justifyContent: \"center\",\r\n display: \"flex\",\r\n color: error ? \"danger.primary\" : \"text.secondary\",\r\n }}\r\n baseClass=\"input-start-icon\"\r\n >{startIcon}</Tag>} */}\r\n {startIcon}\r\n {/* <Tag\r\n {...slotProps?.inputContainer}\r\n ref={refs?.inputContainer}\r\n baseClass='input-container'\r\n flex={1}\r\n sxr={{\r\n width: \"100%\",\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n flex: 1,\r\n minHeight: _size.height,\r\n \"& textarea\": {\r\n resize: \"none\"\r\n },\r\n \"& input:-webkit-autofill,& input:-webkit-autofill:hover, & input:-webkit-autofill:focus,& input:-webkit-autofill:active\": {\r\n \"-webkit-text-fill-color\": \"text.primary\",\r\n \"box-shadow\": `0 0 0px 1000px ${variant === \"fill\" ? theme.colors.background.secondary : theme.colors.background.primary} inset`,\r\n transition: \"background-color 5000s ease-in-out 0s\"\r\n } as any\r\n }}\r\n >\r\n \r\n </Tag> */}\r\n <Tag\r\n {...slotProps?.input}\r\n ref={inputMergeRef}\r\n baseClass='input'\r\n component={multiline ? 'textarea' : 'input'}\r\n {...multiprops}\r\n sxr={{\r\n border: 0,\r\n outline: 0,\r\n bgcolor: \"transparent\",\r\n color: error ? \"danger.primary\" : \"text.primary\",\r\n fontSize: _size.fontSize,\r\n height: multiline ? \"auto\" : _size.height + \"px!important\",\r\n width: \"100%\",\r\n maxHeight: 200,\r\n }}\r\n value={value}\r\n onChange={onChange}\r\n onFocus={(e: any) => {\r\n focused ?? setFocused(true)\r\n onFocus && onFocus(e)\r\n }}\r\n onBlur={(e: any) => {\r\n focused ?? setFocused(false)\r\n onBlur && onBlur(e)\r\n }}\r\n onKeyDown={onKeyDown}\r\n onKeyUp={onKeyUp}\r\n name={name}\r\n placeholder={placeholder}\r\n type={type}\r\n readOnly={readOnly}\r\n autoComplete={autoComplete}\r\n />\r\n {/* {endIcon && <Tag\r\n {...slotProps?.endIcon}\r\n ref={refs?.endIcon}\r\n flex={\"0 0 auto\"}\r\n sxr={{\r\n height: \"100%\",\r\n alignItems: 'center',\r\n justifyContent: \"center\",\r\n display: 'flex',\r\n color: error ? \"danger.primary\" : \"text.secondary\",\r\n }}\r\n baseClass=\"input-end-icon\"\r\n >{endIcon}</Tag>} */}\r\n {endIcon}\r\n </Tag>\r\n {helperText && <Tag\r\n {...slotProps?.helperText}\r\n ref={refs?.helperText}\r\n baseClass=\"input-helper-text\"\r\n sxr={{\r\n color: error ? \"danger.primary\" : \"text.primary\",\r\n fontSize: \"small\",\r\n lineHeight: \"text\",\r\n fontWeight: 'text',\r\n pl: .5,\r\n }}\r\n >{helperText}</Tag>}\r\n </Tag>\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default Input\r\n"],"names":[],"mappings":";;;;;;;;;AA6DA;;;AACI;;AAmCA;AAAe;AACf;AAAa;AACb;AAAmB;AACnB;AAAW;AACX;AAAa;AACb;AAAgB;AAChB;AAAU;AACV;AAAU;AACV;AAAa;AACb;AAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;;;AAGA;;AAEA;;;;;AAKY;;;AAGZ;AAEA;AACI;AAAU;AACV;;AAEI;AACI;;AACG;AACH;;;AAEA;;;AAGZ;AAEA;AACI;AACI;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACH;AACD;AACI;AACA;AACA;AACH;;AAGL;;;;;AAKI;AACI;AACA;AACI;AACH;;;;AAWG;AACA;AACA;;AASI;AACA;AACH;AAuBW;;AAEA;AACI;AAEJ;AACH;AAuEG;AACA;AACA;;;AAGA;AACA;AACA;AACH;;AAKG;AACJ;;AAGI;AACJ;;AA8BA;AACA;AACA;AACA;AACH;AAKrB;;"}
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var index = require('../Input/index.cjs');
7
+ var UnfoldMore = require('@xanui/icons/UnfoldMore');
8
+
9
+ const InputNumber = React.forwardRef((props, ref) => {
10
+ const isNumeric = !isNaN(Number(props.value));
11
+ let p = {};
12
+ if (!isNumeric) {
13
+ p.error = true;
14
+ p.helperText = "Value must be numeric";
15
+ }
16
+ return (jsxRuntime.jsx(index, Object.assign({}, props, p, { ref: ref, endIcon: jsxRuntime.jsx(UnfoldMore, {}), onKeyDown: (e) => {
17
+ props.onKeyDown && props.onKeyDown(e);
18
+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown')
19
+ return;
20
+ e.preventDefault();
21
+ let val = parseInt(props.value || '0');
22
+ val = e.key === 'ArrowUp' ? val + 1 : val - 1;
23
+ e.target.value = String(val);
24
+ props.onChange && props.onChange(e);
25
+ }, value: props.value, onChange: e => {
26
+ e.target.value = e.target.value.replace(/\D/g, '');
27
+ props.onChange && props.onChange(e);
28
+ } })));
29
+ });
30
+
31
+ module.exports = InputNumber;
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/InputNumber/index.tsx"],"sourcesContent":["\"use client\"\r\nimport React from 'react'\r\nimport Input, { InputProps } from '../Input'\r\nimport UnfoldMore from '@xanui/icons/UnfoldMore'\r\n\r\nexport type InputNumberProps = InputProps\r\n\r\nconst InputNumber = React.forwardRef((props: InputNumberProps, ref: React.Ref<any>) => {\r\n const isNumeric = !isNaN(Number(props.value));\r\n\r\n let p: any = {}\r\n if (!isNumeric) {\r\n p.error = true;\r\n p.helperText = \"Value must be numeric\";\r\n }\r\n\r\n return (\r\n <Input\r\n {...props}\r\n {...p}\r\n ref={ref}\r\n endIcon={<UnfoldMore />}\r\n onKeyDown={(e: any) => {\r\n props.onKeyDown && props.onKeyDown(e);\r\n if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;\r\n e.preventDefault();\r\n let val = parseInt(props.value || '0');\r\n val = e.key === 'ArrowUp' ? val + 1 : val - 1;\r\n e.target.value = String(val);\r\n props.onChange && props.onChange(e);\r\n }}\r\n value={props.value}\r\n onChange={e => {\r\n e.target.value = e.target.value.replace(/\\D/g, '')\r\n props.onChange && props.onChange(e);\r\n }}\r\n />\r\n )\r\n})\r\n\r\nexport default InputNumber\r\n"],"names":[],"mappings":";;;;;;;;AAOA;AACG;;;AAIG;AACA;;;;;;;;AAcM;;;;AAMA;;;AAKZ;;"}
@@ -0,0 +1,24 @@
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 Label = React.forwardRef((_a, ref) => {
9
+ var { children } = _a, rest = tslib.__rest(_a, ["children"]);
10
+ return jsxRuntime.jsx(core.Tag, Object.assign({ component: 'label' }, rest, { sxr: {
11
+ display: "inline-flex",
12
+ alignItems: "center",
13
+ verticalAlign: "middle",
14
+ fontSize: "text",
15
+ gap: .4,
16
+ color: "text.primary",
17
+ userSelect: "none",
18
+ cursor: "pointer",
19
+ fontWeight: "500",
20
+ }, baseClass: 'label', ref: ref, children: children }));
21
+ });
22
+
23
+ module.exports = Label;
24
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Label/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType } from '@xanui/core';\r\n\r\nexport type LabelProps<T extends TagComponentType = \"label\"> = TagProps<T>\r\n\r\nconst Label = React.forwardRef(<T extends TagComponentType = \"label\">({ children, ...rest }: LabelProps<T>, ref: React.Ref<any>) => {\r\n return <Tag\r\n component='label'\r\n {...rest}\r\n sxr={{\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n verticalAlign: \"middle\",\r\n fontSize: \"text\",\r\n gap: .4,\r\n color: \"text.primary\",\r\n userSelect: \"none\",\r\n cursor: \"pointer\",\r\n fontWeight: \"500\",\r\n }}\r\n baseClass='label'\r\n ref={ref}\r\n >{children}</Tag>\r\n})\r\n\r\nexport default Label"],"names":["__rest","_jsx","Tag"],"mappings":";;;;;;;AAMA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAuC,EAAoC,EAAE,GAAmB,KAAI;AAA7D,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAA0B,EAArB,IAAI,GAAAA,YAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;IACrF,OAAOC,cAAA,CAACC,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EACP,SAAS,EAAC,OAAO,EAAA,EACb,IAAI,EAAA,EACR,GAAG,EAAE;AACD,YAAA,OAAO,EAAE,aAAa;AACtB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,aAAa,EAAE,QAAQ;AACvB,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,GAAG,EAAE,EAAE;AACP,YAAA,KAAK,EAAE,cAAc;AACrB,YAAA,UAAU,EAAE,MAAM;AAClB,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,UAAU,EAAE,KAAK;SACpB,EACD,SAAS,EAAC,OAAO,EACjB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO;AACrB,CAAC;;;;"}