@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/Image/index.js CHANGED
@@ -1,27 +1,25 @@
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 core = require('@xanui/core');
2
+ import { __rest } from 'tslib';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React, { useState } from 'react';
5
+ import { Tag } from '@xanui/core';
8
6
 
9
7
  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();
8
+ var { children, src, alt, errorView } = _a, rest = __rest(_a, ["children", "src", "alt", "errorView"]);
9
+ const [faild, setFaild] = useState();
12
10
  if (faild === false) {
13
11
  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: {
12
+ return (jsx(Tag, Object.assign({ src: src }, rest, { sxr: {
15
13
  display: "inline-flex",
16
14
  justifyContent: "center",
17
15
  alignItems: "center",
18
16
  }, component: "div", baseClass: 'image', ref: ref, children: t })));
19
17
  }
20
- return (jsxRuntime.jsx(core.Tag, Object.assign({ objectFit: "cover" }, rest, { component: "img", alt: alt, src: src, baseClass: 'image', onError: (e) => {
18
+ return (jsx(Tag, Object.assign({ objectFit: "cover" }, rest, { component: "img", alt: alt, src: src, baseClass: 'image', onError: (e) => {
21
19
  setFaild(false);
22
20
  rest.onError && rest.onError(e);
23
21
  }, ref: ref })));
24
22
  });
25
23
 
26
- module.exports = Image;
24
+ export { Image as default };
27
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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;;"}
1
+ {"version":3,"file":"index.js","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;;"}
package/Input/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 core = require('@xanui/core');
8
- var index = require('../Label/index.js');
2
+ import { __rest } from 'tslib';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import React, { useState, useEffect, useMemo } from 'react';
5
+ import { useInterface, useBreakpointProps, useMergeRefs, Tag } from '@xanui/core';
6
+ import Label from '../Label/index.js';
9
7
 
10
8
  const Input = React.forwardRef((_a, ref) => {
11
9
  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"]);
10
+ var { value, refs } = _a, props = __rest(_a, ["value", "refs"]);
11
+ let [_e, theme] = 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 = __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
12
  const _p = {};
15
13
  if (startIcon)
16
14
  _p.startIcon = startIcon;
@@ -32,7 +30,7 @@ const Input = React.forwardRef((_a, ref) => {
32
30
  _p.minRows = minRows;
33
31
  if (maxRows)
34
32
  _p.maxRows = maxRows;
35
- const p = core.useBreakpointProps(_p);
33
+ const p = useBreakpointProps(_p);
36
34
  startIcon = p.startIcon;
37
35
  endIcon = p.endIcon;
38
36
  iconPlacement = p.iconPlacement;
@@ -46,11 +44,11 @@ const Input = React.forwardRef((_a, ref) => {
46
44
  iconPlacement !== null && iconPlacement !== void 0 ? iconPlacement : (iconPlacement = multiline ? "end" : "center");
47
45
  if (!value)
48
46
  iconPlacement = 'center';
49
- const [_focused, setFocused] = React.useState(false);
47
+ const [_focused, setFocused] = useState(false);
50
48
  let _focus = focused || _focused;
51
49
  const inputRef = React.useRef(null);
52
- const inputMergeRef = core.useMergeRefs(inputRef, refs === null || refs === void 0 ? void 0 : refs.input);
53
- React.useEffect(() => {
50
+ const inputMergeRef = useMergeRefs(inputRef, refs === null || refs === void 0 ? void 0 : refs.input);
51
+ useEffect(() => {
54
52
  if (autoFocus) {
55
53
  setTimeout(() => {
56
54
  var _a;
@@ -58,7 +56,7 @@ const Input = React.forwardRef((_a, ref) => {
58
56
  }, 100);
59
57
  }
60
58
  }, [autoFocus]);
61
- let _rows = React.useMemo(() => {
59
+ let _rows = useMemo(() => {
62
60
  if (rows)
63
61
  return rows;
64
62
  if (value && multiline) {
@@ -103,20 +101,20 @@ const Input = React.forwardRef((_a, ref) => {
103
101
  }
104
102
  };
105
103
  }
106
- return (jsxRuntime.jsxs(core.Tag, Object.assign({ width: fullWidth ? "100%" : "auto" }, rest, { ref: ref, baseClass: "input-wrapper", sxr: {
104
+ return (jsxs(Tag, Object.assign({ width: fullWidth ? "100%" : "auto" }, rest, { ref: ref, baseClass: "input-wrapper", sxr: {
107
105
  display: 'flex',
108
106
  flexDirection: 'column',
109
107
  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: {
108
+ }, children: [!!label && jsx(Label, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.label, { ref: refs === null || refs === void 0 ? void 0 : refs.label, children: label })), jsxs(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
109
  width: "100%",
112
110
  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": {
111
+ }, children: [jsxs(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
112
  "-webkit-text-fill-color": "text.primary",
115
113
  "box-shadow": `0 0 0px 1000px ${variant === "fill" ? theme.colors.background.secondary : theme.colors.background.primary} inset`,
116
114
  transition: "background-color 5000s ease-in-out 0s"
117
115
  }, "& textarea": {
118
116
  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: {
117
+ } }), disabled: disabled || false, children: [startIcon, jsx(Tag, Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, { ref: inputMergeRef, baseClass: 'input', component: multiline ? 'textarea' : 'input' }, multiprops, { sxr: {
120
118
  border: 0,
121
119
  outline: 0,
122
120
  bgcolor: "transparent",
@@ -131,7 +129,7 @@ const Input = React.forwardRef((_a, ref) => {
131
129
  }, onBlur: (e) => {
132
130
  focused !== null && focused !== void 0 ? focused : setFocused(false);
133
131
  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: {
132
+ }, onKeyDown: onKeyDown, onKeyUp: onKeyUp, name: name, placeholder: placeholder, type: type, readOnly: readOnly, autoComplete: autoComplete })), endIcon] })), helperText && jsx(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
133
  color: error ? "danger.primary" : "text.primary",
136
134
  fontSize: "small",
137
135
  lineHeight: "text",
@@ -140,5 +138,5 @@ const Input = React.forwardRef((_a, ref) => {
140
138
  }, children: helperText }))] }))] })));
141
139
  });
142
140
 
143
- module.exports = Input;
141
+ export { Input as default };
144
142
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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;;"}
1
+ {"version":3,"file":"index.js","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;;"}
@@ -1,10 +1,8 @@
1
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.js');
7
- var UnfoldMore = require('@xanui/icons/UnfoldMore');
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import Input from '../Input/index.js';
5
+ import UnfoldMore from '@xanui/icons/UnfoldMore';
8
6
 
9
7
  const InputNumber = React.forwardRef((props, ref) => {
10
8
  const isNumeric = !isNaN(Number(props.value));
@@ -13,7 +11,7 @@ const InputNumber = React.forwardRef((props, ref) => {
13
11
  p.error = true;
14
12
  p.helperText = "Value must be numeric";
15
13
  }
16
- return (jsxRuntime.jsx(index, Object.assign({}, props, p, { ref: ref, endIcon: jsxRuntime.jsx(UnfoldMore, {}), onKeyDown: (e) => {
14
+ return (jsx(Input, Object.assign({}, props, p, { ref: ref, endIcon: jsx(UnfoldMore, {}), onKeyDown: (e) => {
17
15
  props.onKeyDown && props.onKeyDown(e);
18
16
  if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown')
19
17
  return;
@@ -28,5 +26,5 @@ const InputNumber = React.forwardRef((props, ref) => {
28
26
  } })));
29
27
  });
30
28
 
31
- module.exports = InputNumber;
29
+ export { InputNumber as default };
32
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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;;"}
1
+ {"version":3,"file":"index.js","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;;;;"}
package/Label/index.js CHANGED
@@ -1,13 +1,11 @@
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 { Tag } from '@xanui/core';
7
5
 
8
6
  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: {
7
+ var { children } = _a, rest = __rest(_a, ["children"]);
8
+ return jsx(Tag, Object.assign({ component: 'label' }, rest, { sxr: {
11
9
  display: "inline-flex",
12
10
  alignItems: "center",
13
11
  verticalAlign: "middle",
@@ -20,5 +18,5 @@ const Label = React.forwardRef((_a, ref) => {
20
18
  }, baseClass: 'label', ref: ref, children: children }));
21
19
  });
22
20
 
23
- module.exports = Label;
21
+ export { Label as default };
24
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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;;;;"}
1
+ {"version":3,"file":"index.js","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":["_jsx"],"mappings":";;;;;AAMA,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAuC,EAAoC,EAAE,GAAmB,KAAI;AAA7D,IAAA,IAAA,EAAE,QAAQ,EAAA,GAAA,EAA0B,EAArB,IAAI,GAAA,MAAA,CAAA,EAAA,EAAnB,YAAqB,CAAF;IACrF,OAAOA,GAAA,CAAC,GAAG,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;;;;"}