@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.
Files changed (310) hide show
  1. package/Accordion/index.cjs +96 -0
  2. package/Accordion/index.cjs.map +1 -0
  3. package/Accordion/index.js +19 -21
  4. package/Accordion/index.js.map +1 -1
  5. package/Alert/index.cjs +121 -0
  6. package/Alert/index.cjs.map +1 -0
  7. package/Alert/index.js +33 -35
  8. package/Alert/index.js.map +1 -1
  9. package/Autocomplete/index.cjs +136 -0
  10. package/Autocomplete/index.cjs.map +1 -0
  11. package/Autocomplete/index.js +23 -25
  12. package/Autocomplete/index.js.map +1 -1
  13. package/Avatar/index.cjs +50 -0
  14. package/Avatar/index.cjs.map +1 -0
  15. package/Avatar/index.js +15 -17
  16. package/Avatar/index.js.map +1 -1
  17. package/Badge/index.cjs +109 -0
  18. package/Badge/index.cjs.map +1 -0
  19. package/Badge/index.js +12 -14
  20. package/Badge/index.js.map +1 -1
  21. package/Box/index.cjs +14 -0
  22. package/Box/index.cjs.map +1 -0
  23. package/Box/index.js +7 -9
  24. package/Box/index.js.map +1 -1
  25. package/Button/index.cjs +94 -0
  26. package/Button/index.cjs.map +1 -0
  27. package/Button/index.js +17 -19
  28. package/Button/index.js.map +1 -1
  29. package/ButtonGroup/index.cjs +58 -0
  30. package/ButtonGroup/index.cjs.map +1 -0
  31. package/ButtonGroup/index.js +12 -14
  32. package/ButtonGroup/index.js.map +1 -1
  33. package/Calendar/index.cjs +174 -0
  34. package/Calendar/index.cjs.map +1 -0
  35. package/Calendar/index.js +39 -41
  36. package/Calendar/index.js.map +1 -1
  37. package/CalendarInput/index.cjs +34 -0
  38. package/CalendarInput/index.cjs.map +1 -0
  39. package/CalendarInput/index.js +19 -21
  40. package/CalendarInput/index.js.map +1 -1
  41. package/Checkbox/index.cjs +58 -0
  42. package/Checkbox/index.cjs.map +1 -0
  43. package/Checkbox/index.js +14 -16
  44. package/Checkbox/index.js.map +1 -1
  45. package/Chip/index.cjs +76 -0
  46. package/Chip/index.cjs.map +1 -0
  47. package/Chip/index.js +12 -14
  48. package/Chip/index.js.map +1 -1
  49. package/CircleProgress/index.cjs +129 -0
  50. package/CircleProgress/index.cjs.map +1 -0
  51. package/CircleProgress/index.js +13 -15
  52. package/CircleProgress/index.js.map +1 -1
  53. package/ClickOutside/index.cjs +37 -0
  54. package/ClickOutside/index.cjs.map +1 -0
  55. package/ClickOutside/index.js +9 -11
  56. package/ClickOutside/index.js.map +1 -1
  57. package/Collaps/index.cjs +26 -0
  58. package/Collaps/index.cjs.map +1 -0
  59. package/Collaps/index.js +9 -11
  60. package/Collaps/index.js.map +1 -1
  61. package/Container/index.cjs +29 -0
  62. package/Container/index.cjs.map +1 -0
  63. package/Container/index.js +9 -11
  64. package/Container/index.js.map +1 -1
  65. package/DataFilter/index.cjs +78 -0
  66. package/DataFilter/index.cjs.map +1 -0
  67. package/DataFilter/index.js +30 -41
  68. package/DataFilter/index.js.map +1 -1
  69. package/DataFilter/options/DateFilter.cjs +32 -0
  70. package/DataFilter/options/DateFilter.cjs.map +1 -0
  71. package/DataFilter/options/DateFilter.js +16 -18
  72. package/DataFilter/options/DateFilter.js.map +1 -1
  73. package/DataFilter/options/DateRangeFilter.cjs +27 -0
  74. package/DataFilter/options/DateRangeFilter.cjs.map +1 -0
  75. package/DataFilter/options/DateRangeFilter.js +12 -14
  76. package/DataFilter/options/DateRangeFilter.js.map +1 -1
  77. package/DataFilter/options/MultiSelectFilter.cjs +38 -0
  78. package/DataFilter/options/MultiSelectFilter.cjs.map +1 -0
  79. package/DataFilter/options/MultiSelectFilter.js +20 -22
  80. package/DataFilter/options/MultiSelectFilter.js.map +1 -1
  81. package/DataFilter/options/NumberFilter.cjs +24 -0
  82. package/DataFilter/options/NumberFilter.cjs.map +1 -0
  83. package/DataFilter/options/NumberFilter.js +11 -13
  84. package/DataFilter/options/NumberFilter.js.map +1 -1
  85. package/DataFilter/options/NumberRangeFilter.cjs +29 -0
  86. package/DataFilter/options/NumberRangeFilter.cjs.map +1 -0
  87. package/DataFilter/options/NumberRangeFilter.js +12 -14
  88. package/DataFilter/options/NumberRangeFilter.js.map +1 -1
  89. package/DataFilter/options/SelectFilter.cjs +34 -0
  90. package/DataFilter/options/SelectFilter.cjs.map +1 -0
  91. package/DataFilter/options/SelectFilter.js +18 -20
  92. package/DataFilter/options/SelectFilter.js.map +1 -1
  93. package/DataFilter/options/TextFilter.cjs +24 -0
  94. package/DataFilter/options/TextFilter.cjs.map +1 -0
  95. package/DataFilter/options/TextFilter.js +11 -13
  96. package/DataFilter/options/TextFilter.js.map +1 -1
  97. package/Datatable/FilterBox.cjs +39 -0
  98. package/Datatable/FilterBox.cjs.map +1 -0
  99. package/Datatable/FilterBox.js +21 -23
  100. package/Datatable/FilterBox.js.map +1 -1
  101. package/Datatable/Row.cjs +59 -0
  102. package/Datatable/Row.cjs.map +1 -0
  103. package/Datatable/Row.js +19 -21
  104. package/Datatable/Row.js.map +1 -1
  105. package/Datatable/SelectedBox.cjs +21 -0
  106. package/Datatable/SelectedBox.cjs.map +1 -0
  107. package/Datatable/SelectedBox.js +10 -12
  108. package/Datatable/SelectedBox.js.map +1 -1
  109. package/Datatable/Table.cjs +23 -0
  110. package/Datatable/Table.cjs.map +1 -0
  111. package/Datatable/Table.js +8 -10
  112. package/Datatable/Table.js.map +1 -1
  113. package/Datatable/TableHead.cjs +61 -0
  114. package/Datatable/TableHead.cjs.map +1 -0
  115. package/Datatable/TableHead.js +18 -20
  116. package/Datatable/TableHead.js.map +1 -1
  117. package/Datatable/index.cjs +93 -0
  118. package/Datatable/index.cjs.map +1 -0
  119. package/Datatable/index.js +21 -23
  120. package/Datatable/index.js.map +1 -1
  121. package/Divider/index.cjs +31 -0
  122. package/Divider/index.cjs.map +1 -0
  123. package/Divider/index.js +8 -10
  124. package/Divider/index.js.map +1 -1
  125. package/Drawer/index.cjs +78 -0
  126. package/Drawer/index.cjs.map +1 -0
  127. package/Drawer/index.js +12 -14
  128. package/Drawer/index.js.map +1 -1
  129. package/Form/index.cjs +45 -0
  130. package/Form/index.cjs.map +1 -0
  131. package/Form/index.js +8 -10
  132. package/Form/index.js.map +1 -1
  133. package/GridContainer/index.cjs +19 -0
  134. package/GridContainer/index.cjs.map +1 -0
  135. package/GridContainer/index.js +7 -9
  136. package/GridContainer/index.js.map +1 -1
  137. package/GridItem/index.cjs +20 -0
  138. package/GridItem/index.cjs.map +1 -0
  139. package/GridItem/index.js +7 -9
  140. package/GridItem/index.js.map +1 -1
  141. package/IconButton/index.cjs +64 -0
  142. package/IconButton/index.cjs.map +1 -0
  143. package/IconButton/index.js +12 -14
  144. package/IconButton/index.js.map +1 -1
  145. package/Image/index.cjs +27 -0
  146. package/Image/index.cjs.map +1 -0
  147. package/Image/index.js +9 -11
  148. package/Image/index.js.map +1 -1
  149. package/Input/index.cjs +144 -0
  150. package/Input/index.cjs.map +1 -0
  151. package/Input/index.js +18 -20
  152. package/Input/index.js.map +1 -1
  153. package/InputNumber/index.cjs +32 -0
  154. package/InputNumber/index.cjs.map +1 -0
  155. package/InputNumber/index.js +6 -8
  156. package/InputNumber/index.js.map +1 -1
  157. package/Label/index.cjs +24 -0
  158. package/Label/index.cjs.map +1 -0
  159. package/Label/index.js +7 -9
  160. package/Label/index.js.map +1 -1
  161. package/Layer/index.cjs +62 -0
  162. package/Layer/index.cjs.map +1 -0
  163. package/Layer/index.js +19 -21
  164. package/Layer/index.js.map +1 -1
  165. package/LineProgress/index.cjs +59 -0
  166. package/LineProgress/index.cjs.map +1 -0
  167. package/LineProgress/index.js +11 -13
  168. package/LineProgress/index.js.map +1 -1
  169. package/List/ListContext.cjs +11 -0
  170. package/List/ListContext.cjs.map +1 -0
  171. package/List/ListContext.js +2 -5
  172. package/List/ListContext.js.map +1 -1
  173. package/List/index.cjs +63 -0
  174. package/List/index.cjs.map +1 -0
  175. package/List/index.js +12 -14
  176. package/List/index.js.map +1 -1
  177. package/ListItem/index.cjs +54 -0
  178. package/ListItem/index.cjs.map +1 -0
  179. package/ListItem/index.js +12 -14
  180. package/ListItem/index.js.map +1 -1
  181. package/LoadingBox/index.cjs +32 -0
  182. package/LoadingBox/index.cjs.map +1 -0
  183. package/LoadingBox/index.js +11 -13
  184. package/LoadingBox/index.js.map +1 -1
  185. package/Menu/index.cjs +150 -0
  186. package/Menu/index.cjs.map +1 -0
  187. package/Menu/index.js +18 -20
  188. package/Menu/index.js.map +1 -1
  189. package/Modal/index.cjs +59 -0
  190. package/Modal/index.cjs.map +1 -0
  191. package/Modal/index.js +15 -17
  192. package/Modal/index.js.map +1 -1
  193. package/NoSSR/index.cjs +15 -0
  194. package/NoSSR/index.cjs.map +1 -0
  195. package/NoSSR/index.js +4 -6
  196. package/NoSSR/index.js.map +1 -1
  197. package/Option/index.cjs +14 -0
  198. package/Option/index.cjs.map +1 -0
  199. package/Option/index.js +7 -9
  200. package/Option/index.js.map +1 -1
  201. package/Paper/index.cjs +15 -0
  202. package/Paper/index.cjs.map +1 -0
  203. package/Paper/index.js +8 -10
  204. package/Paper/index.js.map +1 -1
  205. package/Portal/index.cjs +27 -0
  206. package/Portal/index.cjs.map +1 -0
  207. package/Portal/index.js +9 -11
  208. package/Portal/index.js.map +1 -1
  209. package/Radio/index.cjs +16 -0
  210. package/Radio/index.cjs.map +1 -0
  211. package/Radio/index.js +9 -11
  212. package/Radio/index.js.map +1 -1
  213. package/Scrollbar/index.cjs +59 -0
  214. package/Scrollbar/index.cjs.map +1 -0
  215. package/Scrollbar/index.js +10 -12
  216. package/Scrollbar/index.js.map +1 -1
  217. package/Select/index.cjs +59 -0
  218. package/Select/index.cjs.map +1 -0
  219. package/Select/index.js +22 -24
  220. package/Select/index.js.map +1 -1
  221. package/Skeleton/index.cjs +60 -0
  222. package/Skeleton/index.cjs.map +1 -0
  223. package/Skeleton/index.js +7 -9
  224. package/Skeleton/index.js.map +1 -1
  225. package/Stack/index.cjs +17 -0
  226. package/Stack/index.cjs.map +1 -0
  227. package/Stack/index.js +7 -9
  228. package/Stack/index.js.map +1 -1
  229. package/Switch/index.cjs +79 -0
  230. package/Switch/index.cjs.map +1 -0
  231. package/Switch/index.js +12 -14
  232. package/Switch/index.js.map +1 -1
  233. package/Tab/index.cjs +17 -0
  234. package/Tab/index.cjs.map +1 -0
  235. package/Tab/index.js +9 -11
  236. package/Tab/index.js.map +1 -1
  237. package/Table/index.cjs +88 -0
  238. package/Table/index.cjs.map +1 -0
  239. package/Table/index.js +13 -15
  240. package/Table/index.js.map +1 -1
  241. package/TableBody/index.cjs +14 -0
  242. package/TableBody/index.cjs.map +1 -0
  243. package/TableBody/index.js +7 -9
  244. package/TableBody/index.js.map +1 -1
  245. package/TableCell/index.cjs +14 -0
  246. package/TableCell/index.cjs.map +1 -0
  247. package/TableCell/index.js +7 -9
  248. package/TableCell/index.js.map +1 -1
  249. package/TableFooter/index.cjs +14 -0
  250. package/TableFooter/index.cjs.map +1 -0
  251. package/TableFooter/index.js +7 -9
  252. package/TableFooter/index.js.map +1 -1
  253. package/TableHead/index.cjs +14 -0
  254. package/TableHead/index.cjs.map +1 -0
  255. package/TableHead/index.js +7 -9
  256. package/TableHead/index.js.map +1 -1
  257. package/TablePagination/index.cjs +59 -0
  258. package/TablePagination/index.cjs.map +1 -0
  259. package/TablePagination/index.js +21 -23
  260. package/TablePagination/index.js.map +1 -1
  261. package/TableRow/index.cjs +14 -0
  262. package/TableRow/index.cjs.map +1 -0
  263. package/TableRow/index.js +7 -9
  264. package/TableRow/index.js.map +1 -1
  265. package/Tabs/index.cjs +201 -0
  266. package/Tabs/index.cjs.map +1 -0
  267. package/Tabs/index.js +19 -21
  268. package/Tabs/index.js.map +1 -1
  269. package/Text/index.cjs +25 -0
  270. package/Text/index.cjs.map +1 -0
  271. package/Text/index.js +8 -10
  272. package/Text/index.js.map +1 -1
  273. package/Toast/index.cjs +120 -0
  274. package/Toast/index.cjs.map +1 -0
  275. package/Toast/index.js +18 -20
  276. package/Toast/index.js.map +1 -1
  277. package/Tooltip/index.cjs +40 -0
  278. package/Tooltip/index.cjs.map +1 -0
  279. package/Tooltip/index.js +11 -13
  280. package/Tooltip/index.js.map +1 -1
  281. package/ViewBox/index.cjs +32 -0
  282. package/ViewBox/index.cjs.map +1 -0
  283. package/ViewBox/index.js +11 -13
  284. package/ViewBox/index.js.map +1 -1
  285. package/index.cjs +134 -0
  286. package/index.cjs.map +1 -0
  287. package/index.js +64 -133
  288. package/index.js.map +1 -1
  289. package/package.json +3 -3
  290. package/readme.md +4 -4
  291. package/useAlert/index.cjs +94 -0
  292. package/useAlert/index.cjs.map +1 -0
  293. package/useAlert/index.js +12 -14
  294. package/useAlert/index.js.map +1 -1
  295. package/useBlurCss/index.cjs +19 -0
  296. package/useBlurCss/index.cjs.map +1 -0
  297. package/useBlurCss/index.js +5 -7
  298. package/useBlurCss/index.js.map +1 -1
  299. package/useCorner/index.cjs +22 -0
  300. package/useCorner/index.cjs.map +1 -0
  301. package/useCorner/index.js +1 -3
  302. package/useCorner/index.js.map +1 -1
  303. package/useLayer/index.cjs +38 -0
  304. package/useLayer/index.cjs.map +1 -0
  305. package/useLayer/index.js +7 -9
  306. package/useLayer/index.js.map +1 -1
  307. package/useModal/index.cjs +37 -0
  308. package/useModal/index.cjs.map +1 -0
  309. package/useModal/index.js +8 -10
  310. package/useModal/index.js.map +1 -1
package/Modal/index.js CHANGED
@@ -1,16 +1,14 @@
1
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 index = require('../useModal/index.js');
8
- var core = require('@xanui/core');
2
+ import { __rest } from 'tslib';
3
+ import { jsx, Fragment } from 'react/jsx-runtime';
4
+ import { useRef, useEffect } from 'react';
5
+ import useModal from '../useModal/index.js';
6
+ import { Tag, Renderar } from '@xanui/core';
9
7
 
10
8
  const Modal = (_a) => {
11
- var { children, open } = _a, props = tslib.__rest(_a, ["children", "open"]);
12
- const ref = React.useRef(null);
13
- const modal = index(jsxRuntime.jsx(jsxRuntime.Fragment, { children: children }), Object.assign(Object.assign({}, props), { onClickOutside: () => {
9
+ var { children, open } = _a, props = __rest(_a, ["children", "open"]);
10
+ const ref = useRef(null);
11
+ const modal = useModal(jsx(Fragment, { children: children }), Object.assign(Object.assign({}, props), { onClickOutside: () => {
14
12
  if (props === null || props === void 0 ? void 0 : props.onClickOutside) {
15
13
  props.onClickOutside();
16
14
  }
@@ -21,7 +19,7 @@ const Modal = (_a) => {
21
19
  }
22
20
  }
23
21
  } }));
24
- React.useEffect(() => {
22
+ useEffect(() => {
25
23
  if (open) {
26
24
  modal.open();
27
25
  }
@@ -29,14 +27,14 @@ const Modal = (_a) => {
29
27
  modal.close();
30
28
  }
31
29
  }, [open]);
32
- return jsxRuntime.jsx(core.Tag, { ref: ref });
30
+ return jsx(Tag, { ref: ref });
33
31
  };
34
32
  const ActionModal = (_a) => {
35
- var { children } = _a, props = tslib.__rest(_a, ["children"]);
36
- return (jsxRuntime.jsx(Modal, Object.assign({}, props, { children: children })));
33
+ var { children } = _a, props = __rest(_a, ["children"]);
34
+ return (jsx(Modal, Object.assign({}, props, { children: children })));
37
35
  };
38
36
  Modal.open = (children, props) => {
39
- const m = core.Renderar.render(ActionModal, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
37
+ const m = Renderar.render(ActionModal, Object.assign(Object.assign({ open: true }, props), { children, onClosed: () => {
40
38
  m.unrender();
41
39
  if (props === null || props === void 0 ? void 0 : props.onClosed) {
42
40
  props.onClosed();
@@ -52,8 +50,8 @@ Modal.open = (children, props) => {
52
50
  };
53
51
  };
54
52
  Modal.close = () => {
55
- core.Renderar.unrender(ActionModal);
53
+ Renderar.unrender(ActionModal);
56
54
  };
57
55
 
58
- module.exports = Modal;
56
+ export { Modal as default };
59
57
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Modal/index.tsx"],"sourcesContent":["\"use client\";\r\nimport { ReactNode, useEffect, useRef } from \"react\";\r\nimport useModal, { UseModalProps } from \"../useModal\";\r\nimport { Renderar, Tag } from \"@xanui/core\";\r\n\r\nexport type ModalProps = UseModalProps & {\r\n children: ReactNode;\r\n open: boolean;\r\n}\r\n\r\nconst Modal = ({ children, open, ...props }: ModalProps) => {\r\n const ref = useRef<HTMLDivElement>(null);\r\n\r\n const modal = useModal(<>{children}</>, {\r\n ...props,\r\n onClickOutside: () => {\r\n if (props?.onClickOutside) {\r\n props.onClickOutside()\r\n }\r\n },\r\n slotProps: {\r\n layer: {\r\n portal: {\r\n container: ref?.current || undefined\r\n }\r\n }\r\n }\r\n })\r\n\r\n useEffect(() => {\r\n if (open) {\r\n modal.open()\r\n } else {\r\n modal.close()\r\n }\r\n }, [open])\r\n return <Tag ref={ref}></Tag>\r\n}\r\n\r\nconst ActionModal = ({ children, ...props }: ModalProps) => {\r\n return (\r\n <Modal {...props}>\r\n {children}\r\n </Modal>\r\n )\r\n}\r\n\r\nModal.open = (children: ModalProps['children'], props?: Omit<ModalProps, 'children' | \"open\">) => {\r\n const m = Renderar.render(ActionModal as any, {\r\n open: true,\r\n ...props,\r\n children,\r\n onClosed: () => {\r\n m.unrender()\r\n if (props?.onClosed) {\r\n props.onClosed()\r\n }\r\n }\r\n })\r\n\r\n return {\r\n open: () => {\r\n m.updateProps({ open: true })\r\n },\r\n close: () => {\r\n m.updateProps({ open: false })\r\n },\r\n }\r\n};\r\n\r\nModal.close = () => {\r\n Renderar.unrender(ActionModal as any)\r\n}\r\n\r\nexport default Modal;"],"names":[],"mappings":";;;;;;;;;AAUA;;AACG;AAEA;;;;;AAQM;AACG;;AAEC;AACH;AACH;;;;;;;;AASJ;AACA;AACH;AAEA;AAAqB;;AAMrB;AAEA;AACG;;;;;AASG;;;;;;;;;AAWN;AAEA;AACG;AACH;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Modal/index.tsx"],"sourcesContent":["'use client'\r\nimport { ReactNode, useEffect, useRef } from \"react\";\r\nimport useModal, { UseModalProps } from \"../useModal\";\r\nimport { Renderar, Tag } from \"@xanui/core\";\r\n\r\nexport type ModalProps = UseModalProps & {\r\n children: ReactNode;\r\n open: boolean;\r\n}\r\n\r\nconst Modal = ({ children, open, ...props }: ModalProps) => {\r\n const ref = useRef<HTMLDivElement>(null);\r\n\r\n const modal = useModal(<>{children}</>, {\r\n ...props,\r\n onClickOutside: () => {\r\n if (props?.onClickOutside) {\r\n props.onClickOutside()\r\n }\r\n },\r\n slotProps: {\r\n layer: {\r\n portal: {\r\n container: ref?.current || undefined\r\n }\r\n }\r\n }\r\n })\r\n\r\n useEffect(() => {\r\n if (open) {\r\n modal.open()\r\n } else {\r\n modal.close()\r\n }\r\n }, [open])\r\n return <Tag ref={ref}></Tag>\r\n}\r\n\r\nconst ActionModal = ({ children, ...props }: ModalProps) => {\r\n return (\r\n <Modal {...props}>\r\n {children}\r\n </Modal>\r\n )\r\n}\r\n\r\nModal.open = (children: ModalProps['children'], props?: Omit<ModalProps, 'children' | \"open\">) => {\r\n const m = Renderar.render(ActionModal as any, {\r\n open: true,\r\n ...props,\r\n children,\r\n onClosed: () => {\r\n m.unrender()\r\n if (props?.onClosed) {\r\n props.onClosed()\r\n }\r\n }\r\n })\r\n\r\n return {\r\n open: () => {\r\n m.updateProps({ open: true })\r\n },\r\n close: () => {\r\n m.updateProps({ open: false })\r\n },\r\n }\r\n};\r\n\r\nModal.close = () => {\r\n Renderar.unrender(ActionModal as any)\r\n}\r\n\r\nexport default Modal;"],"names":[],"mappings":";;;;;;;AAUA;;AACG;AAEA;;;;;AAQM;AACG;;AAEC;AACH;AACH;;;;;;;;AASJ;AACA;AACH;AAEA;AAAqB;;AAMrB;AAEA;AACG;;;;;AASG;;;;;;;;;AAWN;AAEA;AACG;AACH;;"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+
6
+ const NoSSR = ({ children }) => {
7
+ const [isClient, setIsClient] = React.useState(false);
8
+ React.useEffect(() => {
9
+ setIsClient(true);
10
+ }, []);
11
+ return isClient ? children : null;
12
+ };
13
+
14
+ module.exports = NoSSR;
15
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/NoSSR/index.tsx"],"sourcesContent":["'use client'\r\nimport { useEffect, useState } from \"react\";\r\n\r\nconst NoSSR = ({ children }: any) => {\r\n const [isClient, setIsClient] = useState(false);\r\n useEffect(() => {\r\n setIsClient(true);\r\n }, [])\r\n return isClient ? children : null\r\n}\r\n\r\nexport default NoSSR"],"names":[],"mappings":";;;;;AAGA;;;;;;AAMA;;"}
package/NoSSR/index.js CHANGED
@@ -1,15 +1,13 @@
1
1
  "use client";
2
- 'use strict';
3
-
4
- var React = require('react');
2
+ import { useState, useEffect } from 'react';
5
3
 
6
4
  const NoSSR = ({ children }) => {
7
- const [isClient, setIsClient] = React.useState(false);
8
- React.useEffect(() => {
5
+ const [isClient, setIsClient] = useState(false);
6
+ useEffect(() => {
9
7
  setIsClient(true);
10
8
  }, []);
11
9
  return isClient ? children : null;
12
10
  };
13
11
 
14
- module.exports = NoSSR;
12
+ export { NoSSR as default };
15
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/NoSSR/index.tsx"],"sourcesContent":["\"use client\";\r\nimport { useEffect, useState } from \"react\";\r\n\r\nconst NoSSR = ({ children }: any) => {\r\n const [isClient, setIsClient] = useState(false);\r\n useEffect(() => {\r\n setIsClient(true);\r\n }, [])\r\n return isClient ? children : null\r\n}\r\n\r\nexport default NoSSR"],"names":[],"mappings":";;;;;AAGA;;;;;;AAMA;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/NoSSR/index.tsx"],"sourcesContent":["'use client'\r\nimport { useEffect, useState } from \"react\";\r\n\r\nconst NoSSR = ({ children }: any) => {\r\n const [isClient, setIsClient] = useState(false);\r\n useEffect(() => {\r\n setIsClient(true);\r\n }, [])\r\n return isClient ? children : null\r\n}\r\n\r\nexport default NoSSR"],"names":[],"mappings":";;;AAGA;;;;;;AAMA;;"}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var index = require('../ListItem/index.cjs');
7
+
8
+ const Option = React.forwardRef((_a, ref) => {
9
+ var { value, children } = _a, props = tslib.__rest(_a, ["value", "children"]);
10
+ return (jsxRuntime.jsx(index, Object.assign({}, props, { ref: ref, children: children })));
11
+ });
12
+
13
+ module.exports = Option;
14
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Option/index.tsx"],"sourcesContent":["\r\nimport React from 'react'\r\nimport ListItem, { ListItemProps } from '../ListItem'\r\n\r\nexport type OptionProps = ListItemProps & {\r\n value: string | number;\r\n}\r\n\r\nconst Option = React.forwardRef(({ value, children, ...props }: OptionProps, ref: React.Ref<any>) => {\r\n return (\r\n <ListItem {...props} ref={ref}>{children}</ListItem>\r\n )\r\n})\r\n\r\nexport default Option"],"names":["__rest","_jsx","ListItem"],"mappings":";;;;;;;AAQA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAA0C,EAAE,GAAmB,KAAI;QAAnE,EAAE,KAAK,EAAE,QAAQ,EAAA,GAAA,EAAyB,EAApB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAA3B,qBAA6B,CAAF;AACxD,IAAA,QACIC,cAAA,CAACC,KAAQ,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,KAAK,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAA,CAAY;AAE5D,CAAC;;;;"}
package/Option/index.js CHANGED
@@ -1,14 +1,12 @@
1
- 'use strict';
2
-
3
- var tslib = require('tslib');
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var React = require('react');
6
- var index = require('../ListItem/index.js');
1
+ import { __rest } from 'tslib';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import ListItem from '../ListItem/index.js';
7
5
 
8
6
  const Option = React.forwardRef((_a, ref) => {
9
- var { value, children } = _a, props = tslib.__rest(_a, ["value", "children"]);
10
- return (jsxRuntime.jsx(index, Object.assign({}, props, { ref: ref, children: children })));
7
+ var { value, children } = _a, props = __rest(_a, ["value", "children"]);
8
+ return (jsx(ListItem, Object.assign({}, props, { ref: ref, children: children })));
11
9
  });
12
10
 
13
- module.exports = Option;
11
+ export { Option as default };
14
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Option/index.tsx"],"sourcesContent":["\r\nimport React from 'react'\r\nimport ListItem, { ListItemProps } from '../ListItem'\r\n\r\nexport type OptionProps = ListItemProps & {\r\n value: string | number;\r\n}\r\n\r\nconst Option = React.forwardRef(({ value, children, ...props }: OptionProps, ref: React.Ref<any>) => {\r\n return (\r\n <ListItem {...props} ref={ref}>{children}</ListItem>\r\n )\r\n})\r\n\r\nexport default Option"],"names":["__rest","_jsx","ListItem"],"mappings":";;;;;;;AAQA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAA0C,EAAE,GAAmB,KAAI;QAAnE,EAAE,KAAK,EAAE,QAAQ,EAAA,GAAA,EAAyB,EAApB,KAAK,GAAAA,YAAA,CAAA,EAAA,EAA3B,qBAA6B,CAAF;AACxD,IAAA,QACIC,cAAA,CAACC,KAAQ,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,KAAK,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAA,CAAY;AAE5D,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Option/index.tsx"],"sourcesContent":["\r\nimport React from 'react'\r\nimport ListItem, { ListItemProps } from '../ListItem'\r\n\r\nexport type OptionProps = ListItemProps & {\r\n value: string | number;\r\n}\r\n\r\nconst Option = React.forwardRef(({ value, children, ...props }: OptionProps, ref: React.Ref<any>) => {\r\n return (\r\n <ListItem {...props} ref={ref}>{children}</ListItem>\r\n )\r\n})\r\n\r\nexport default Option"],"names":["_jsx"],"mappings":";;;;;AAQA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAA0C,EAAE,GAAmB,KAAI;QAAnE,EAAE,KAAK,EAAE,QAAQ,EAAA,GAAA,EAAyB,EAApB,KAAK,GAAA,MAAA,CAAA,EAAA,EAA3B,qBAA6B,CAAF;AACxD,IAAA,QACIA,GAAA,CAAC,QAAQ,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,KAAK,EAAA,EAAE,GAAG,EAAE,GAAG,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAA,CAAY;AAE5D,CAAC;;;;"}
@@ -0,0 +1,15 @@
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 Paper = React.forwardRef((_a, ref) => {
9
+ var { children } = _a, rest = tslib.__rest(_a, ["children"]);
10
+ let [props] = core.useInterface("Paper", rest, {});
11
+ return (jsxRuntime.jsx(core.Tag, Object.assign({}, props, { sxr: Object.assign({ shadow: 1, radius: 1, p: 1.5, bgcolor: "background.secondary", color: "text.primary" }, props === null || props === void 0 ? void 0 : props.sx), baseClass: 'paper', ref: ref, children: children })));
12
+ });
13
+
14
+ module.exports = Paper;
15
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Paper/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType, useInterface } from '@xanui/core';\r\n\r\nexport type PaperProps<T extends TagComponentType = \"div\"> = TagProps<T>\r\n\r\nconst Paper = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: PaperProps<T>, ref?: React.Ref<any>) => {\r\n let [props] = useInterface<any>(\"Paper\", rest, {})\r\n return (\r\n <Tag\r\n {...props}\r\n sxr={{\r\n shadow: 1,\r\n radius: 1,\r\n p: 1.5,\r\n bgcolor: \"background.secondary\",\r\n color: \"text.primary\",\r\n ...props?.sx\r\n }}\r\n baseClass='paper'\r\n ref={ref}\r\n >{children}</Tag>\r\n )\r\n})\r\n\r\nexport default Paper\r\n"],"names":["__rest","useInterface","_jsx","Tag"],"mappings":";;;;;;;AAMA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAAoC,EAAE,GAAoB,KAAI;AAA9D,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAA0B,EAArB,IAAI,GAAAA,YAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AACnF,IAAA,IAAI,CAAC,KAAK,CAAC,GAAGC,iBAAY,CAAM,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;IAClD,QACIC,eAACC,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,KAAK,EAAA,EACT,GAAG,kBACC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,CAAC,EAAE,GAAG,EACN,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,cAAc,EAAA,EAClB,KAAK,aAAL,KAAK,KAAA,MAAA,GAAA,MAAA,GAAL,KAAK,CAAE,EAAE,CAAA,EAEhB,SAAS,EAAC,OAAO,EACjB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO;AAEzB,CAAC;;;;"}
package/Paper/index.js CHANGED
@@ -1,15 +1,13 @@
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');
1
+ import { __rest } from 'tslib';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import { useInterface, Tag } from '@xanui/core';
7
5
 
8
6
  const Paper = React.forwardRef((_a, ref) => {
9
- var { children } = _a, rest = tslib.__rest(_a, ["children"]);
10
- let [props] = core.useInterface("Paper", rest, {});
11
- return (jsxRuntime.jsx(core.Tag, Object.assign({}, props, { sxr: Object.assign({ shadow: 1, radius: 1, p: 1.5, bgcolor: "background.secondary", color: "text.primary" }, props === null || props === void 0 ? void 0 : props.sx), baseClass: 'paper', ref: ref, children: children })));
7
+ var { children } = _a, rest = __rest(_a, ["children"]);
8
+ let [props] = useInterface("Paper", rest, {});
9
+ return (jsx(Tag, Object.assign({}, props, { sxr: Object.assign({ shadow: 1, radius: 1, p: 1.5, bgcolor: "background.secondary", color: "text.primary" }, props === null || props === void 0 ? void 0 : props.sx), baseClass: 'paper', ref: ref, children: children })));
12
10
  });
13
11
 
14
- module.exports = Paper;
12
+ export { Paper as default };
15
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Paper/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType, useInterface } from '@xanui/core';\r\n\r\nexport type PaperProps<T extends TagComponentType = \"div\"> = TagProps<T>\r\n\r\nconst Paper = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: PaperProps<T>, ref?: React.Ref<any>) => {\r\n let [props] = useInterface<any>(\"Paper\", rest, {})\r\n return (\r\n <Tag\r\n {...props}\r\n sxr={{\r\n shadow: 1,\r\n radius: 1,\r\n p: 1.5,\r\n bgcolor: \"background.secondary\",\r\n color: \"text.primary\",\r\n ...props?.sx\r\n }}\r\n baseClass='paper'\r\n ref={ref}\r\n >{children}</Tag>\r\n )\r\n})\r\n\r\nexport default Paper\r\n"],"names":["__rest","useInterface","_jsx","Tag"],"mappings":";;;;;;;AAMA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAAoC,EAAE,GAAoB,KAAI;AAA9D,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAA0B,EAArB,IAAI,GAAAA,YAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AACnF,IAAA,IAAI,CAAC,KAAK,CAAC,GAAGC,iBAAY,CAAM,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;IAClD,QACIC,eAACC,QAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,KAAK,EAAA,EACT,GAAG,kBACC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,CAAC,EAAE,GAAG,EACN,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,cAAc,EAAA,EAClB,KAAK,aAAL,KAAK,KAAA,MAAA,GAAA,MAAA,GAAL,KAAK,CAAE,EAAE,CAAA,EAEhB,SAAS,EAAC,OAAO,EACjB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO;AAEzB,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Paper/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { Tag, TagProps, TagComponentType, useInterface } from '@xanui/core';\r\n\r\nexport type PaperProps<T extends TagComponentType = \"div\"> = TagProps<T>\r\n\r\nconst Paper = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: PaperProps<T>, ref?: React.Ref<any>) => {\r\n let [props] = useInterface<any>(\"Paper\", rest, {})\r\n return (\r\n <Tag\r\n {...props}\r\n sxr={{\r\n shadow: 1,\r\n radius: 1,\r\n p: 1.5,\r\n bgcolor: \"background.secondary\",\r\n color: \"text.primary\",\r\n ...props?.sx\r\n }}\r\n baseClass='paper'\r\n ref={ref}\r\n >{children}</Tag>\r\n )\r\n})\r\n\r\nexport default Paper\r\n"],"names":["_jsx"],"mappings":";;;;;AAMA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAqC,EAAoC,EAAE,GAAoB,KAAI;AAA9D,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAA0B,EAArB,IAAI,GAAA,MAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;AACnF,IAAA,IAAI,CAAC,KAAK,CAAC,GAAG,YAAY,CAAM,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;IAClD,QACIA,IAAC,GAAG,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACI,KAAK,EAAA,EACT,GAAG,kBACC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,CAAC,EAAE,GAAG,EACN,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,cAAc,EAAA,EAClB,KAAK,aAAL,KAAK,KAAA,MAAA,GAAA,MAAA,GAAL,KAAK,CAAE,EAAE,CAAA,EAEhB,SAAS,EAAC,OAAO,EACjB,GAAG,EAAE,GAAG,EAAA,QAAA,EACV,QAAQ,EAAA,CAAA,CAAO;AAEzB,CAAC;;;;"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var ReactDOM = require('react-dom');
7
+ var core = require('@xanui/core');
8
+
9
+ const Portal = ({ children, appendTo, container }) => {
10
+ const theme = core.useTheme();
11
+ appendTo = appendTo || document.body;
12
+ const c = React.useMemo(() => {
13
+ let _con = container || document.createElement("div");
14
+ appendTo.appendChild(_con);
15
+ _con.className = "xui-portal";
16
+ return _con;
17
+ }, [container]);
18
+ React.useEffect(() => {
19
+ return () => {
20
+ appendTo.removeChild(c);
21
+ };
22
+ }, []);
23
+ return ReactDOM.createPortal(jsxRuntime.jsx(core.ThemeProvider, { theme: theme.name, children: children }), c);
24
+ };
25
+
26
+ module.exports = Portal;
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Portal/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { useEffect, useMemo } from 'react'\r\nimport ReactDOM from 'react-dom';\r\nimport { useTheme, ThemeProvider } from '@xanui/core';\r\nexport type PortalProps = {\r\n children?: React.ReactNode;\r\n appendTo?: HTMLElement;\r\n container?: HTMLElement;\r\n}\r\n\r\nconst Portal = ({ children, appendTo, container }: PortalProps) => {\r\n const theme = useTheme()\r\n appendTo = appendTo || document.body\r\n\r\n const c = useMemo(() => {\r\n let _con: HTMLElement = container || document.createElement(\"div\");\r\n appendTo.appendChild(_con);\r\n _con.className = \"xui-portal\"\r\n return _con\r\n }, [container])\r\n\r\n useEffect(() => {\r\n return () => {\r\n (appendTo as any).removeChild(c);\r\n }\r\n }, [])\r\n\r\n return ReactDOM.createPortal(\r\n <ThemeProvider theme={theme.name}>\r\n {children}\r\n </ThemeProvider>,\r\n c,\r\n );\r\n}\r\n\r\nexport default Portal"],"names":[],"mappings":";;;;;;;;AAUA;AACI;AACA;AAEA;;AAEI;AACA;AACA;AACJ;;AAGI;AACK;AACL;;AAGJ;AAMJ;;"}
package/Portal/index.js CHANGED
@@ -1,27 +1,25 @@
1
1
  "use client";
2
- 'use strict';
3
-
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var React = require('react');
6
- var ReactDOM = require('react-dom');
7
- var core = require('@xanui/core');
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useMemo, useEffect } from 'react';
4
+ import ReactDOM from 'react-dom';
5
+ import { useTheme, ThemeProvider } from '@xanui/core';
8
6
 
9
7
  const Portal = ({ children, appendTo, container }) => {
10
- const theme = core.useTheme();
8
+ const theme = useTheme();
11
9
  appendTo = appendTo || document.body;
12
- const c = React.useMemo(() => {
10
+ const c = useMemo(() => {
13
11
  let _con = container || document.createElement("div");
14
12
  appendTo.appendChild(_con);
15
13
  _con.className = "xui-portal";
16
14
  return _con;
17
15
  }, [container]);
18
- React.useEffect(() => {
16
+ useEffect(() => {
19
17
  return () => {
20
18
  appendTo.removeChild(c);
21
19
  };
22
20
  }, []);
23
- return ReactDOM.createPortal(jsxRuntime.jsx(core.ThemeProvider, { theme: theme.name, children: children }), c);
21
+ return ReactDOM.createPortal(jsx(ThemeProvider, { theme: theme.name, children: children }), c);
24
22
  };
25
23
 
26
- module.exports = Portal;
24
+ export { Portal as default };
27
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Portal/index.tsx"],"sourcesContent":["\"use client\";\r\nimport React, { useEffect, useMemo } from 'react'\r\nimport ReactDOM from 'react-dom';\r\nimport { useTheme, ThemeProvider } from '@xanui/core';\r\nexport type PortalProps = {\r\n children?: React.ReactNode;\r\n appendTo?: HTMLElement;\r\n container?: HTMLElement;\r\n}\r\n\r\nconst Portal = ({ children, appendTo, container }: PortalProps) => {\r\n const theme = useTheme()\r\n appendTo = appendTo || document.body\r\n\r\n const c = useMemo(() => {\r\n let _con: HTMLElement = container || document.createElement(\"div\");\r\n appendTo.appendChild(_con);\r\n _con.className = \"xui-portal\"\r\n return _con\r\n }, [container])\r\n\r\n useEffect(() => {\r\n return () => {\r\n (appendTo as any).removeChild(c);\r\n }\r\n }, [])\r\n\r\n return ReactDOM.createPortal(\r\n <ThemeProvider theme={theme.name}>\r\n {children}\r\n </ThemeProvider>,\r\n c,\r\n );\r\n}\r\n\r\nexport default Portal"],"names":[],"mappings":";;;;;;;;AAUA;AACI;AACA;AAEA;;AAEI;AACA;AACA;AACJ;;AAGI;AACK;AACL;;AAGJ;AAMJ;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Portal/index.tsx"],"sourcesContent":["'use client'\r\nimport React, { useEffect, useMemo } from 'react'\r\nimport ReactDOM from 'react-dom';\r\nimport { useTheme, ThemeProvider } from '@xanui/core';\r\nexport type PortalProps = {\r\n children?: React.ReactNode;\r\n appendTo?: HTMLElement;\r\n container?: HTMLElement;\r\n}\r\n\r\nconst Portal = ({ children, appendTo, container }: PortalProps) => {\r\n const theme = useTheme()\r\n appendTo = appendTo || document.body\r\n\r\n const c = useMemo(() => {\r\n let _con: HTMLElement = container || document.createElement(\"div\");\r\n appendTo.appendChild(_con);\r\n _con.className = \"xui-portal\"\r\n return _con\r\n }, [container])\r\n\r\n useEffect(() => {\r\n return () => {\r\n (appendTo as any).removeChild(c);\r\n }\r\n }, [])\r\n\r\n return ReactDOM.createPortal(\r\n <ThemeProvider theme={theme.name}>\r\n {children}\r\n </ThemeProvider>,\r\n c,\r\n );\r\n}\r\n\r\nexport default Portal"],"names":[],"mappings":";;;;;;AAUA;AACI;AACA;AAEA;;AAEI;AACA;AACA;AACJ;;AAGI;AACK;AACL;;AAGJ;AAMJ;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var core = require('@xanui/core');
6
+ var CheckIcon = require('@xanui/icons/RadioButtonChecked');
7
+ var UnCheckIcon = require('@xanui/icons/RadioButtonUnchecked');
8
+ var index = require('../Checkbox/index.cjs');
9
+
10
+ const Radio = React.forwardRef((props, ref) => {
11
+ let [rest] = core.useInterface("Radio", props, {});
12
+ return jsxRuntime.jsx(index, Object.assign({ checkIcon: jsxRuntime.jsx(CheckIcon, {}), uncheckIcon: jsxRuntime.jsx(UnCheckIcon, {}) }, rest, { type: "radio", ref: ref, classNames: ['radio', ...((rest === null || rest === void 0 ? void 0 : rest.classNames) || [])] }));
13
+ });
14
+
15
+ module.exports = Radio;
16
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Radio/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { useInterface } from '@xanui/core';\r\nimport CheckIcon from '@xanui/icons/RadioButtonChecked'\r\nimport UnCheckIcon from '@xanui/icons/RadioButtonUnchecked'\r\nimport Checkbox, { CheckboxProps } from '../Checkbox';\r\n\r\nexport type RadioProps = CheckboxProps\r\nconst Radio = React.forwardRef((props: RadioProps, ref?: React.Ref<any>) => {\r\n let [rest] = useInterface<any>(\"Radio\", props, {})\r\n return <Checkbox\r\n checkIcon={<CheckIcon />}\r\n uncheckIcon={<UnCheckIcon />}\r\n {...rest}\r\n type=\"radio\"\r\n ref={ref}\r\n classNames={['radio', ...(rest?.classNames || [])]}\r\n />\r\n})\r\n\r\nexport default Radio\r\n"],"names":["useInterface","_jsx","Checkbox"],"mappings":";;;;;;;;;AAQA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAiB,EAAE,GAAoB,KAAI;AACvE,IAAA,IAAI,CAAC,IAAI,CAAC,GAAGA,iBAAY,CAAM,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;IAClD,OAAOC,cAAA,CAACC,KAAQ,EAAA,MAAA,CAAA,MAAA,CAAA,EACZ,SAAS,EAAED,cAAA,CAAC,SAAS,KAAG,EACxB,WAAW,EAAEA,cAAA,CAAC,WAAW,KAAG,EAAA,EACxB,IAAI,IACR,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,CAAC,OAAO,EAAE,IAAI,CAAA,IAAI,aAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,UAAU,KAAI,EAAE,CAAC,CAAC,EAAA,CAAA,CACpD;AACN,CAAC;;;;"}
package/Radio/index.js CHANGED
@@ -1,16 +1,14 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var core = require('@xanui/core');
6
- var CheckIcon = require('@xanui/icons/RadioButtonChecked');
7
- var UnCheckIcon = require('@xanui/icons/RadioButtonUnchecked');
8
- var index = require('../Checkbox/index.js');
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { useInterface } from '@xanui/core';
4
+ import CheckIcon from '@xanui/icons/RadioButtonChecked';
5
+ import UnCheckIcon from '@xanui/icons/RadioButtonUnchecked';
6
+ import Checkbox from '../Checkbox/index.js';
9
7
 
10
8
  const Radio = React.forwardRef((props, ref) => {
11
- let [rest] = core.useInterface("Radio", props, {});
12
- return jsxRuntime.jsx(index, Object.assign({ checkIcon: jsxRuntime.jsx(CheckIcon, {}), uncheckIcon: jsxRuntime.jsx(UnCheckIcon, {}) }, rest, { type: "radio", ref: ref, classNames: ['radio', ...((rest === null || rest === void 0 ? void 0 : rest.classNames) || [])] }));
9
+ let [rest] = useInterface("Radio", props, {});
10
+ return jsx(Checkbox, Object.assign({ checkIcon: jsx(CheckIcon, {}), uncheckIcon: jsx(UnCheckIcon, {}) }, rest, { type: "radio", ref: ref, classNames: ['radio', ...((rest === null || rest === void 0 ? void 0 : rest.classNames) || [])] }));
13
11
  });
14
12
 
15
- module.exports = Radio;
13
+ export { Radio as default };
16
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Radio/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { useInterface } from '@xanui/core';\r\nimport CheckIcon from '@xanui/icons/RadioButtonChecked'\r\nimport UnCheckIcon from '@xanui/icons/RadioButtonUnchecked'\r\nimport Checkbox, { CheckboxProps } from '../Checkbox';\r\n\r\nexport type RadioProps = CheckboxProps\r\nconst Radio = React.forwardRef((props: RadioProps, ref?: React.Ref<any>) => {\r\n let [rest] = useInterface<any>(\"Radio\", props, {})\r\n return <Checkbox\r\n checkIcon={<CheckIcon />}\r\n uncheckIcon={<UnCheckIcon />}\r\n {...rest}\r\n type=\"radio\"\r\n ref={ref}\r\n classNames={['radio', ...(rest?.classNames || [])]}\r\n />\r\n})\r\n\r\nexport default Radio\r\n"],"names":["useInterface","_jsx","Checkbox"],"mappings":";;;;;;;;;AAQA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAiB,EAAE,GAAoB,KAAI;AACvE,IAAA,IAAI,CAAC,IAAI,CAAC,GAAGA,iBAAY,CAAM,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;IAClD,OAAOC,cAAA,CAACC,KAAQ,EAAA,MAAA,CAAA,MAAA,CAAA,EACZ,SAAS,EAAED,cAAA,CAAC,SAAS,KAAG,EACxB,WAAW,EAAEA,cAAA,CAAC,WAAW,KAAG,EAAA,EACxB,IAAI,IACR,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,CAAC,OAAO,EAAE,IAAI,CAAA,IAAI,aAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,UAAU,KAAI,EAAE,CAAC,CAAC,EAAA,CAAA,CACpD;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Radio/index.tsx"],"sourcesContent":["\r\nimport React from 'react';\r\nimport { useInterface } from '@xanui/core';\r\nimport CheckIcon from '@xanui/icons/RadioButtonChecked'\r\nimport UnCheckIcon from '@xanui/icons/RadioButtonUnchecked'\r\nimport Checkbox, { CheckboxProps } from '../Checkbox';\r\n\r\nexport type RadioProps = CheckboxProps\r\nconst Radio = React.forwardRef((props: RadioProps, ref?: React.Ref<any>) => {\r\n let [rest] = useInterface<any>(\"Radio\", props, {})\r\n return <Checkbox\r\n checkIcon={<CheckIcon />}\r\n uncheckIcon={<UnCheckIcon />}\r\n {...rest}\r\n type=\"radio\"\r\n ref={ref}\r\n classNames={['radio', ...(rest?.classNames || [])]}\r\n />\r\n})\r\n\r\nexport default Radio\r\n"],"names":["_jsx"],"mappings":";;;;;;;AAQA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAiB,EAAE,GAAoB,KAAI;AACvE,IAAA,IAAI,CAAC,IAAI,CAAC,GAAG,YAAY,CAAM,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;IAClD,OAAOA,GAAA,CAAC,QAAQ,EAAA,MAAA,CAAA,MAAA,CAAA,EACZ,SAAS,EAAEA,GAAA,CAAC,SAAS,KAAG,EACxB,WAAW,EAAEA,GAAA,CAAC,WAAW,KAAG,EAAA,EACxB,IAAI,IACR,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,CAAC,OAAO,EAAE,IAAI,CAAA,IAAI,aAAJ,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJ,IAAI,CAAE,UAAU,KAAI,EAAE,CAAC,CAAC,EAAA,CAAA,CACpD;AACN,CAAC;;;;"}
@@ -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 core = require('@xanui/core');
7
+ var React = require('react');
8
+
9
+ const Scrollbar = React.forwardRef((_a, ref) => {
10
+ var { children } = _a, rest = tslib.__rest(_a, ["children"]);
11
+ let [_b] = core.useInterface("Scrollbar", rest, {}), { onScroll, onScrollEnd } = _b, props = tslib.__rest(_b, ["onScroll", "onScrollEnd"]);
12
+ const innerRef = React.useRef(null);
13
+ React.useImperativeHandle(ref, () => ({
14
+ scrollTo(pos) {
15
+ var _a;
16
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
17
+ top: pos,
18
+ behavior: "smooth"
19
+ });
20
+ },
21
+ scrollToBottom() {
22
+ if (!innerRef.current)
23
+ return;
24
+ const ele = innerRef.current;
25
+ ele.scrollTo({
26
+ top: ele.scrollHeight,
27
+ behavior: "smooth"
28
+ });
29
+ },
30
+ scrollToTop() {
31
+ var _a;
32
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
33
+ top: 0,
34
+ behavior: "smooth"
35
+ });
36
+ }
37
+ }));
38
+ if (onScroll || onScrollEnd) {
39
+ props.onScroll = (e) => {
40
+ if (onScrollEnd) {
41
+ const ele = e.target;
42
+ const scrollTop = ele.scrollTop;
43
+ const scrollHeight = ele.scrollHeight;
44
+ const clientHeight = ele.clientHeight;
45
+ const isScrollDown = scrollHeight - scrollTop <= clientHeight + 1;
46
+ isScrollDown && onScrollEnd(e);
47
+ }
48
+ onScroll && onScroll(e);
49
+ };
50
+ }
51
+ return (jsxRuntime.jsx(core.Tag, Object.assign({}, props, { ref: innerRef, baseClass: 'scrollbar', sxr: {
52
+ height: "100%",
53
+ width: "100%",
54
+ overflow: "auto",
55
+ }, children: children })));
56
+ });
57
+
58
+ module.exports = Scrollbar;
59
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Scrollbar/index.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { Tag, TagComponentType, TagProps, useInterface } from '@xanui/core';\r\nimport React, { ReactNode, UIEvent, useImperativeHandle, useRef } from 'react'\r\n\r\nexport type ScrollbarProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\r\n children?: ReactNode;\r\n onScrollEnd?: (e: UIEvent<HTMLDivElement>) => void;\r\n}\r\n\r\nexport type ScrollbarHandle = {\r\n scrollTo: (pos: number) => void;\r\n scrollToBottom: () => void;\r\n scrollToTop: () => void;\r\n};\r\n\r\nconst Scrollbar = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: ScrollbarProps<T>, ref: React.Ref<ScrollbarHandle>) => {\r\n let [{ onScroll, onScrollEnd, ...props }] = useInterface<any>(\"Scrollbar\", rest, {})\r\n const innerRef = useRef<HTMLDivElement>(null);\r\n\r\n useImperativeHandle(ref, () => ({\r\n scrollTo(pos: number) {\r\n innerRef.current?.scrollTo({\r\n top: pos,\r\n behavior: \"smooth\"\r\n });\r\n },\r\n scrollToBottom() {\r\n if (!innerRef.current) return;\r\n const ele = innerRef.current;\r\n ele.scrollTo({\r\n top: ele.scrollHeight,\r\n behavior: \"smooth\"\r\n });\r\n },\r\n scrollToTop() {\r\n innerRef.current?.scrollTo({\r\n top: 0,\r\n behavior: \"smooth\"\r\n });\r\n }\r\n }));\r\n\r\n if (onScroll || onScrollEnd) {\r\n props.onScroll = (e: UIEvent<HTMLDivElement>) => {\r\n if (onScrollEnd) {\r\n const ele: any = e.target\r\n const scrollTop = ele.scrollTop\r\n const scrollHeight = ele.scrollHeight\r\n const clientHeight = ele.clientHeight\r\n const isScrollDown = scrollHeight - scrollTop <= clientHeight + 1\r\n isScrollDown && onScrollEnd(e)\r\n }\r\n onScroll && onScroll(e)\r\n }\r\n }\r\n\r\n return (\r\n <Tag\r\n {...props}\r\n ref={innerRef}\r\n baseClass='scrollbar'\r\n sxr={{\r\n height: \"100%\",\r\n width: \"100%\",\r\n overflow: \"auto\",\r\n }}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default Scrollbar "],"names":[],"mappings":";;;;;;;;AAgBA;AAAwE;;AAEpE;AAEA;AACI;;AACI;AACI;AACA;AACH;;;;;AAID;;;AAGI;AACH;;;;AAGD;AACI;AACA;AACH;;AAER;AAED;AACI;;AAEQ;AACA;AACA;AACA;;AAEA;;AAEJ;AACJ;;AAGJ;AAMY;AACA;AACA;;AAMhB;;"}
@@ -1,16 +1,14 @@
1
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 React = require('react');
2
+ import { __rest } from 'tslib';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { useInterface, Tag } from '@xanui/core';
5
+ import React, { useRef, useImperativeHandle } from 'react';
8
6
 
9
7
  const Scrollbar = React.forwardRef((_a, ref) => {
10
- var { children } = _a, rest = tslib.__rest(_a, ["children"]);
11
- let [_b] = core.useInterface("Scrollbar", rest, {}), { onScroll, onScrollEnd } = _b, props = tslib.__rest(_b, ["onScroll", "onScrollEnd"]);
12
- const innerRef = React.useRef(null);
13
- React.useImperativeHandle(ref, () => ({
8
+ var { children } = _a, rest = __rest(_a, ["children"]);
9
+ let [_b] = useInterface("Scrollbar", rest, {}), { onScroll, onScrollEnd } = _b, props = __rest(_b, ["onScroll", "onScrollEnd"]);
10
+ const innerRef = useRef(null);
11
+ useImperativeHandle(ref, () => ({
14
12
  scrollTo(pos) {
15
13
  var _a;
16
14
  (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
@@ -48,12 +46,12 @@ const Scrollbar = React.forwardRef((_a, ref) => {
48
46
  onScroll && onScroll(e);
49
47
  };
50
48
  }
51
- return (jsxRuntime.jsx(core.Tag, Object.assign({}, props, { ref: innerRef, baseClass: 'scrollbar', sxr: {
49
+ return (jsx(Tag, Object.assign({}, props, { ref: innerRef, baseClass: 'scrollbar', sxr: {
52
50
  height: "100%",
53
51
  width: "100%",
54
52
  overflow: "auto",
55
53
  }, children: children })));
56
54
  });
57
55
 
58
- module.exports = Scrollbar;
56
+ export { Scrollbar as default };
59
57
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/Scrollbar/index.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport { Tag, TagComponentType, TagProps, useInterface } from '@xanui/core';\r\nimport React, { ReactNode, UIEvent, useImperativeHandle, useRef } from 'react'\r\n\r\nexport type ScrollbarProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\r\n children?: ReactNode;\r\n onScrollEnd?: (e: UIEvent<HTMLDivElement>) => void;\r\n}\r\n\r\nexport type ScrollbarHandle = {\r\n scrollTo: (pos: number) => void;\r\n scrollToBottom: () => void;\r\n scrollToTop: () => void;\r\n};\r\n\r\nconst Scrollbar = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: ScrollbarProps<T>, ref: React.Ref<ScrollbarHandle>) => {\r\n let [{ onScroll, onScrollEnd, ...props }] = useInterface<any>(\"Scrollbar\", rest, {})\r\n const innerRef = useRef<HTMLDivElement>(null);\r\n\r\n useImperativeHandle(ref, () => ({\r\n scrollTo(pos: number) {\r\n innerRef.current?.scrollTo({\r\n top: pos,\r\n behavior: \"smooth\"\r\n });\r\n },\r\n scrollToBottom() {\r\n if (!innerRef.current) return;\r\n const ele = innerRef.current;\r\n ele.scrollTo({\r\n top: ele.scrollHeight,\r\n behavior: \"smooth\"\r\n });\r\n },\r\n scrollToTop() {\r\n innerRef.current?.scrollTo({\r\n top: 0,\r\n behavior: \"smooth\"\r\n });\r\n }\r\n }));\r\n\r\n if (onScroll || onScrollEnd) {\r\n props.onScroll = (e: UIEvent<HTMLDivElement>) => {\r\n if (onScrollEnd) {\r\n const ele: any = e.target\r\n const scrollTop = ele.scrollTop\r\n const scrollHeight = ele.scrollHeight\r\n const clientHeight = ele.clientHeight\r\n const isScrollDown = scrollHeight - scrollTop <= clientHeight + 1\r\n isScrollDown && onScrollEnd(e)\r\n }\r\n onScroll && onScroll(e)\r\n }\r\n }\r\n\r\n return (\r\n <Tag\r\n {...props}\r\n ref={innerRef}\r\n baseClass='scrollbar'\r\n sxr={{\r\n height: \"100%\",\r\n width: \"100%\",\r\n overflow: \"auto\",\r\n }}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default Scrollbar "],"names":[],"mappings":";;;;;;;;AAgBA;AAAwE;;AAEpE;AAEA;AACI;;AACI;AACI;AACA;AACH;;;;;AAID;;;AAGI;AACH;;;;AAGD;AACI;AACA;AACH;;AAER;AAED;AACI;;AAEQ;AACA;AACA;AACA;;AAEA;;AAEJ;AACJ;;AAGJ;AAMY;AACA;AACA;;AAMhB;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/Scrollbar/index.tsx"],"sourcesContent":["'use client'\r\n\r\nimport { Tag, TagComponentType, TagProps, useInterface } from '@xanui/core';\r\nimport React, { ReactNode, UIEvent, useImperativeHandle, useRef } from 'react'\r\n\r\nexport type ScrollbarProps<T extends TagComponentType = \"div\"> = TagProps<T> & {\r\n children?: ReactNode;\r\n onScrollEnd?: (e: UIEvent<HTMLDivElement>) => void;\r\n}\r\n\r\nexport type ScrollbarHandle = {\r\n scrollTo: (pos: number) => void;\r\n scrollToBottom: () => void;\r\n scrollToTop: () => void;\r\n};\r\n\r\nconst Scrollbar = React.forwardRef(<T extends TagComponentType = \"div\">({ children, ...rest }: ScrollbarProps<T>, ref: React.Ref<ScrollbarHandle>) => {\r\n let [{ onScroll, onScrollEnd, ...props }] = useInterface<any>(\"Scrollbar\", rest, {})\r\n const innerRef = useRef<HTMLDivElement>(null);\r\n\r\n useImperativeHandle(ref, () => ({\r\n scrollTo(pos: number) {\r\n innerRef.current?.scrollTo({\r\n top: pos,\r\n behavior: \"smooth\"\r\n });\r\n },\r\n scrollToBottom() {\r\n if (!innerRef.current) return;\r\n const ele = innerRef.current;\r\n ele.scrollTo({\r\n top: ele.scrollHeight,\r\n behavior: \"smooth\"\r\n });\r\n },\r\n scrollToTop() {\r\n innerRef.current?.scrollTo({\r\n top: 0,\r\n behavior: \"smooth\"\r\n });\r\n }\r\n }));\r\n\r\n if (onScroll || onScrollEnd) {\r\n props.onScroll = (e: UIEvent<HTMLDivElement>) => {\r\n if (onScrollEnd) {\r\n const ele: any = e.target\r\n const scrollTop = ele.scrollTop\r\n const scrollHeight = ele.scrollHeight\r\n const clientHeight = ele.clientHeight\r\n const isScrollDown = scrollHeight - scrollTop <= clientHeight + 1\r\n isScrollDown && onScrollEnd(e)\r\n }\r\n onScroll && onScroll(e)\r\n }\r\n }\r\n\r\n return (\r\n <Tag\r\n {...props}\r\n ref={innerRef}\r\n baseClass='scrollbar'\r\n sxr={{\r\n height: \"100%\",\r\n width: \"100%\",\r\n overflow: \"auto\",\r\n }}\r\n >\r\n {children}\r\n </Tag>\r\n )\r\n})\r\n\r\nexport default Scrollbar "],"names":[],"mappings":";;;;;;AAgBA;AAAwE;;AAEpE;AAEA;AACI;;AACI;AACI;AACA;AACH;;;;;AAID;;;AAGI;AACH;;;;AAGD;AACI;AACA;AACH;;AAER;AAED;AACI;;AAEQ;AACA;AACA;AACA;;AAEA;;AAEJ;AACJ;;AAGJ;AAMY;AACA;AACA;;AAMhB;;"}
@@ -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 index = require('../Input/index.cjs');
8
+ var index$3 = require('../List/index.cjs');
9
+ var index$2 = require('../Menu/index.cjs');
10
+ var index$1 = require('../Stack/index.cjs');
11
+ var DownIcon = require('@xanui/icons/KeyboardArrowDown');
12
+ var UpIcon = require('@xanui/icons/KeyboardArrowUp');
13
+ var core = require('@xanui/core');
14
+
15
+ const Select = React.forwardRef((_a, ref) => {
16
+ var _b, _c, _d, _e, _f, _g;
17
+ var { onChange, value, children, error, helperText, name, refs } = _a, props = tslib.__rest(_a, ["onChange", "value", "children", "error", "helperText", "name", "refs"]);
18
+ let [_h] = core.useInterface("Select", props, {}), { slotProps, color, variant } = _h, inputProps = tslib.__rest(_h, ["slotProps", "color", "variant"]);
19
+ color !== null && color !== void 0 ? color : (color = "brand");
20
+ variant !== null && variant !== void 0 ? variant : (variant = "fill");
21
+ const [target, setTarget] = React.useState();
22
+ const conRef = React.useRef(null);
23
+ const { childs, selectedProps } = React.useMemo(() => {
24
+ let sProps = {};
25
+ const c = React.Children.map(children, (child) => {
26
+ let selected = child.props.value === value;
27
+ if (selected)
28
+ sProps = child.props;
29
+ return React.cloneElement(child, {
30
+ value: undefined,
31
+ selected,
32
+ onClick: () => {
33
+ setTarget(null);
34
+ onChange && onChange(child.props.value);
35
+ }
36
+ });
37
+ });
38
+ return {
39
+ childs: c,
40
+ selectedProps: sProps
41
+ };
42
+ }, [children, value]);
43
+ const mergeRefs = core.useMergeRefs(ref, conRef);
44
+ const toggleMenu = () => setTarget(target ? null : conRef.current);
45
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(index, Object.assign({ ref: mergeRefs, color: color, variant: variant === "soft" ? "fill" : variant, endIcon: jsxRuntime.jsxs(index$1, { flexDirection: "row", component: "span", children: [" ", (target ? jsxRuntime.jsx(UpIcon, {}) : jsxRuntime.jsx(DownIcon, {}))] }), readOnly: true, value: typeof selectedProps.children === 'string' ? selectedProps.children : value, cursor: "pointer", userSelect: "none", startIcon: selectedProps.startIcon, focused: !!target, error: error, helperText: helperText, name: name }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, inputProps, { refs: Object.assign({ input: refs === null || refs === void 0 ? void 0 : refs.input }, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.input) === null || _b === void 0 ? void 0 : _b.refs), slotProps: {
46
+ rootContainer: Object.assign(Object.assign({ cursor: "pointer", userSelect: "none" }, (((_d = (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.input) === null || _c === void 0 ? void 0 : _c.slotProps) === null || _d === void 0 ? void 0 : _d.container) || {})), { onClick: () => {
47
+ if (!target) {
48
+ toggleMenu();
49
+ }
50
+ } })
51
+ } })), jsxRuntime.jsx(index$2, Object.assign({ ref: refs === null || refs === void 0 ? void 0 : refs.menu, target: target, placement: "bottom-left" }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.menu, { slotProps: Object.assign(Object.assign({}, (_e = slotProps === null || slotProps === void 0 ? void 0 : slotProps.menu) === null || _e === void 0 ? void 0 : _e.slotProps), { content: Object.assign(Object.assign({ mt: .5 }, (_f = slotProps === null || slotProps === void 0 ? void 0 : slotProps.menu) === null || _f === void 0 ? void 0 : _f.content), { width: conRef && ((_g = conRef === null || conRef === void 0 ? void 0 : conRef.current) === null || _g === void 0 ? void 0 : _g.clientWidth) }) }), onClickOutside: (e) => {
52
+ if (conRef.current.contains(e.target))
53
+ return;
54
+ toggleMenu();
55
+ }, children: jsxRuntime.jsx(index$3, Object.assign({ ref: refs === null || refs === void 0 ? void 0 : refs.list }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.list, { color: color, variant: variant === "outline" ? "fill" : variant, children: childs })) }))] }));
56
+ });
57
+
58
+ module.exports = Select;
59
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/Select/index.tsx"],"sourcesContent":["'use client'\r\n\r\nimport React, { ReactElement, useMemo, cloneElement, useState, Children, useRef } from 'react'\r\nimport Input, { InputProps } from '../Input'\r\nimport List, { ListProps } from '../List'\r\nimport Menu, { MenuProps } from '../Menu'\r\nimport Stack from '../Stack'\r\nimport { OptionProps } from '../Option'\r\nimport DownIcon from '@xanui/icons/KeyboardArrowDown';\r\nimport UpIcon from '@xanui/icons/KeyboardArrowUp';\r\nimport { useInterface, useMergeRefs } from '@xanui/core'\r\n\r\n\r\nexport type SelectProps = Omit<InputProps, \"onChange\" | \"value\" | \"children\" | \"slotProps\"> & {\r\n value?: string | number;\r\n onChange?: (value: string | number) => void;\r\n children: ReactElement<OptionProps> | ReactElement<OptionProps>[];\r\n\r\n refs?: {\r\n input?: React.Ref<any>;\r\n menu?: React.Ref<any>;\r\n list?: React.Ref<any>;\r\n };\r\n slotProps?: {\r\n menu?: Omit<MenuProps, 'children' | 'target'>;\r\n input?: Omit<InputProps, \"onChange\" | \"value\">;\r\n list?: Omit<ListProps, \"children\">\r\n }\r\n}\r\n\r\nconst Select = React.forwardRef(({ onChange, value, children, error, helperText, name, refs, ...props }: SelectProps, ref: React.Ref<any>) => {\r\n let [{ slotProps, color, variant, ...inputProps }] = useInterface<any>(\"Select\", props, {})\r\n color ??= \"brand\"\r\n variant ??= \"fill\"\r\n const [target, setTarget] = useState<any>()\r\n const conRef = useRef(null)\r\n const { childs, selectedProps } = useMemo(() => {\r\n let sProps: any = {}\r\n const c = Children.map(children, (child: any) => {\r\n let selected = child.props.value === value\r\n if (selected) sProps = child.props\r\n return cloneElement(child, {\r\n value: undefined,\r\n selected,\r\n onClick: () => {\r\n setTarget(null)\r\n onChange && onChange(child.props.value)\r\n }\r\n })\r\n })\r\n return {\r\n childs: c,\r\n selectedProps: sProps as OptionProps\r\n }\r\n }, [children, value])\r\n\r\n const mergeRefs = useMergeRefs(ref, conRef)\r\n const toggleMenu = () => setTarget(target ? null : conRef.current)\r\n\r\n return (\r\n <>\r\n <Input\r\n ref={mergeRefs}\r\n color={color}\r\n variant={variant === \"soft\" ? \"fill\" : variant}\r\n endIcon={<Stack flexDirection=\"row\" component=\"span\" > {(target ? <UpIcon /> : <DownIcon />)}</Stack>}\r\n readOnly\r\n value={typeof selectedProps.children === 'string' ? selectedProps.children : value}\r\n cursor=\"pointer\"\r\n userSelect=\"none\"\r\n startIcon={selectedProps.startIcon}\r\n focused={!!target}\r\n error={error}\r\n helperText={helperText}\r\n name={name}\r\n {...slotProps?.input}\r\n {...inputProps}\r\n refs={{\r\n input: refs?.input,\r\n ...slotProps?.input?.refs\r\n }}\r\n slotProps={{\r\n rootContainer: {\r\n cursor: \"pointer\",\r\n userSelect: \"none\",\r\n ...(slotProps?.input?.slotProps?.container || {}),\r\n onClick: () => {\r\n if (!target) {\r\n toggleMenu()\r\n }\r\n },\r\n }\r\n }}\r\n />\r\n <Menu\r\n ref={refs?.menu}\r\n target={target}\r\n placement=\"bottom-left\"\r\n {...slotProps?.menu}\r\n slotProps={{\r\n ...slotProps?.menu?.slotProps,\r\n content: {\r\n mt: .5,\r\n ...slotProps?.menu?.content,\r\n width: conRef && (conRef?.current as any)?.clientWidth,\r\n }\r\n }}\r\n onClickOutside={(e) => {\r\n if ((conRef.current as any).contains(e.target)) return;\r\n toggleMenu()\r\n }}\r\n >\r\n <List\r\n ref={refs?.list}\r\n {...slotProps?.list}\r\n color={color}\r\n variant={variant === \"outline\" ? \"fill\" : variant}\r\n >\r\n {childs}\r\n </List>\r\n </Menu>\r\n </>\r\n )\r\n})\r\n\r\nexport default Select"],"names":[],"mappings":";;;;;;;;;;;;;;AA8BA;;AAAiC;;;;;AAK7B;;;;;AAKQ;AAAc;;AAEV;;;;;;AAMH;AACL;;AAEI;AACA;;AAER;;AAGA;AAEA;AAuBgB;;AAMY;;AAER;AAEP;;;AAiBG;;AAcpB;;"}