@tecsinapse/react-core 1.21.7 → 1.21.9-beta.8

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 (233) hide show
  1. package/dist/cjs/components/atoms/BoxContent/BoxContent.js +4 -31
  2. package/dist/cjs/components/atoms/BoxContent/BoxContent.js.map +1 -1
  3. package/dist/cjs/components/atoms/BoxContent/styled.js +1 -1
  4. package/dist/cjs/components/atoms/BoxContent/styled.js.map +1 -1
  5. package/dist/cjs/components/atoms/Button/Button.js +18 -61
  6. package/dist/cjs/components/atoms/Button/Button.js.map +1 -1
  7. package/dist/cjs/components/atoms/Button/States/Error.js +5 -23
  8. package/dist/cjs/components/atoms/Button/States/Error.js.map +1 -1
  9. package/dist/cjs/components/atoms/Button/States/Success.js +3 -21
  10. package/dist/cjs/components/atoms/Button/States/Success.js.map +1 -1
  11. package/dist/cjs/components/atoms/Card/Card.js +12 -45
  12. package/dist/cjs/components/atoms/Card/Card.js.map +1 -1
  13. package/dist/cjs/components/atoms/Checkbox/Checkbox.js +13 -51
  14. package/dist/cjs/components/atoms/Checkbox/Checkbox.js.map +1 -1
  15. package/dist/cjs/components/atoms/Divider/Divider.js +4 -31
  16. package/dist/cjs/components/atoms/Divider/Divider.js.map +1 -1
  17. package/dist/cjs/components/atoms/GroupButton/GroupButton.js +19 -57
  18. package/dist/cjs/components/atoms/GroupButton/GroupButton.js.map +1 -1
  19. package/dist/cjs/components/atoms/GroupButton/styled.js +11 -11
  20. package/dist/cjs/components/atoms/GroupButton/styled.js.map +1 -1
  21. package/dist/cjs/components/atoms/Icon/AntDesign.js +6 -37
  22. package/dist/cjs/components/atoms/Icon/AntDesign.js.map +1 -1
  23. package/dist/cjs/components/atoms/Icon/Entypo.js +6 -37
  24. package/dist/cjs/components/atoms/Icon/Entypo.js.map +1 -1
  25. package/dist/cjs/components/atoms/Icon/Evil.js +6 -37
  26. package/dist/cjs/components/atoms/Icon/Evil.js.map +1 -1
  27. package/dist/cjs/components/atoms/Icon/Feather.js +6 -37
  28. package/dist/cjs/components/atoms/Icon/Feather.js.map +1 -1
  29. package/dist/cjs/components/atoms/Icon/FontAwesome.js +6 -37
  30. package/dist/cjs/components/atoms/Icon/FontAwesome.js.map +1 -1
  31. package/dist/cjs/components/atoms/Icon/FontAwesomeFive.js +6 -37
  32. package/dist/cjs/components/atoms/Icon/FontAwesomeFive.js.map +1 -1
  33. package/dist/cjs/components/atoms/Icon/Fontisto.js +6 -37
  34. package/dist/cjs/components/atoms/Icon/Fontisto.js.map +1 -1
  35. package/dist/cjs/components/atoms/Icon/Foundation.js +6 -37
  36. package/dist/cjs/components/atoms/Icon/Foundation.js.map +1 -1
  37. package/dist/cjs/components/atoms/Icon/Icon.js +13 -54
  38. package/dist/cjs/components/atoms/Icon/Icon.js.map +1 -1
  39. package/dist/cjs/components/atoms/Icon/Ionicon.js +6 -37
  40. package/dist/cjs/components/atoms/Icon/Ionicon.js.map +1 -1
  41. package/dist/cjs/components/atoms/Icon/Material.js +6 -37
  42. package/dist/cjs/components/atoms/Icon/Material.js.map +1 -1
  43. package/dist/cjs/components/atoms/Icon/MaterialCommunity.js +11 -45
  44. package/dist/cjs/components/atoms/Icon/MaterialCommunity.js.map +1 -1
  45. package/dist/cjs/components/atoms/Icon/Octicon.js +6 -37
  46. package/dist/cjs/components/atoms/Icon/Octicon.js.map +1 -1
  47. package/dist/cjs/components/atoms/Icon/SimpleLine.js +6 -37
  48. package/dist/cjs/components/atoms/Icon/SimpleLine.js.map +1 -1
  49. package/dist/cjs/components/atoms/Icon/Zocial.js +6 -37
  50. package/dist/cjs/components/atoms/Icon/Zocial.js.map +1 -1
  51. package/dist/cjs/components/atoms/Icon/functions.d.ts +1 -2
  52. package/dist/cjs/components/atoms/Icon/functions.js +29 -28
  53. package/dist/cjs/components/atoms/Icon/functions.js.map +1 -1
  54. package/dist/cjs/components/atoms/Icon/styled.d.ts +3 -0
  55. package/dist/cjs/components/atoms/Icon/styled.js +17 -0
  56. package/dist/cjs/components/atoms/Icon/styled.js.map +1 -0
  57. package/dist/cjs/components/atoms/Input/InputContainer/InputContainer.js +21 -67
  58. package/dist/cjs/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
  59. package/dist/cjs/components/atoms/Input/InputElement/InputElement.js +11 -47
  60. package/dist/cjs/components/atoms/Input/InputElement/InputElement.js.map +1 -1
  61. package/dist/cjs/components/atoms/Input/InputMaskElement/InputMaskElement.js +15 -52
  62. package/dist/cjs/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -1
  63. package/dist/cjs/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +11 -43
  64. package/dist/cjs/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
  65. package/dist/cjs/components/atoms/Input/hooks/useNumberMask.js +1 -17
  66. package/dist/cjs/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
  67. package/dist/cjs/components/atoms/Input/hooks/useStringMask.js +2 -2
  68. package/dist/cjs/components/atoms/Input/hooks/useStringMask.js.map +1 -1
  69. package/dist/cjs/components/atoms/Input/styled.js +1 -1
  70. package/dist/cjs/components/atoms/Input/styled.js.map +1 -1
  71. package/dist/cjs/components/atoms/Paper/Paper.js +8 -43
  72. package/dist/cjs/components/atoms/Paper/Paper.js.map +1 -1
  73. package/dist/cjs/components/atoms/PressableSurface/PressableSurface.js +12 -49
  74. package/dist/cjs/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
  75. package/dist/cjs/components/atoms/ProgressBar/ProgressBar.js +16 -52
  76. package/dist/cjs/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
  77. package/dist/cjs/components/atoms/RadioButton/RadioButton.js +13 -51
  78. package/dist/cjs/components/atoms/RadioButton/RadioButton.js.map +1 -1
  79. package/dist/cjs/components/atoms/Switch/Switch.js +14 -53
  80. package/dist/cjs/components/atoms/Switch/Switch.js.map +1 -1
  81. package/dist/cjs/components/atoms/Tag/Tag.js +16 -52
  82. package/dist/cjs/components/atoms/Tag/Tag.js.map +1 -1
  83. package/dist/cjs/components/atoms/Text/Text.js +17 -59
  84. package/dist/cjs/components/atoms/Text/Text.js.map +1 -1
  85. package/dist/cjs/components/molecules/Calendar/Calendar.js +20 -60
  86. package/dist/cjs/components/molecules/Calendar/Calendar.js.map +1 -1
  87. package/dist/cjs/components/molecules/Calendar/components/MonthWeek.js +3 -3
  88. package/dist/cjs/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
  89. package/dist/cjs/components/molecules/Calendar/styled.js +5 -8
  90. package/dist/cjs/components/molecules/Calendar/styled.js.map +1 -1
  91. package/dist/cjs/components/molecules/DatePicker/DatePicker.js +30 -81
  92. package/dist/cjs/components/molecules/DatePicker/DatePicker.js.map +1 -1
  93. package/dist/cjs/components/molecules/DatePicker/styled.js +3 -6
  94. package/dist/cjs/components/molecules/DatePicker/styled.js.map +1 -1
  95. package/dist/cjs/components/molecules/DateTimePicker/DateTimePicker.js +42 -104
  96. package/dist/cjs/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
  97. package/dist/cjs/components/molecules/DateTimeSelector/DateTimeSelector.js +26 -72
  98. package/dist/cjs/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
  99. package/dist/cjs/components/molecules/DateTimeSelector/Selector.js +15 -51
  100. package/dist/cjs/components/molecules/DateTimeSelector/Selector.js.map +1 -1
  101. package/dist/cjs/components/molecules/Grid/functions.js +1 -2
  102. package/dist/cjs/components/molecules/Grid/functions.js.map +1 -1
  103. package/dist/cjs/components/molecules/HintInputContainer/HintInputContainer.js +17 -55
  104. package/dist/cjs/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
  105. package/dist/cjs/components/molecules/IconTextButton/IconComponent.js +5 -21
  106. package/dist/cjs/components/molecules/IconTextButton/IconComponent.js.map +1 -1
  107. package/dist/cjs/components/molecules/InputPassword/InputPasswordIcon.js +8 -41
  108. package/dist/cjs/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
  109. package/dist/cjs/components/molecules/InputPassword/styled.js +14 -1
  110. package/dist/cjs/components/molecules/InputPassword/styled.js.map +1 -1
  111. package/dist/cjs/components/molecules/Snackbar/Snackbar.js +27 -37
  112. package/dist/cjs/components/molecules/Snackbar/Snackbar.js.map +1 -1
  113. package/dist/cjs/styles/light.js +7 -20
  114. package/dist/cjs/styles/light.js.map +1 -1
  115. package/dist/cjs/utils/masks.js +2 -2
  116. package/dist/cjs/utils/masks.js.map +1 -1
  117. package/dist/esm/components/atoms/BoxContent/BoxContent.js +4 -31
  118. package/dist/esm/components/atoms/BoxContent/BoxContent.js.map +1 -1
  119. package/dist/esm/components/atoms/BoxContent/styled.js +1 -1
  120. package/dist/esm/components/atoms/BoxContent/styled.js.map +1 -1
  121. package/dist/esm/components/atoms/Button/Button.js +18 -61
  122. package/dist/esm/components/atoms/Button/Button.js.map +1 -1
  123. package/dist/esm/components/atoms/Button/States/Error.js +5 -23
  124. package/dist/esm/components/atoms/Button/States/Error.js.map +1 -1
  125. package/dist/esm/components/atoms/Button/States/Success.js +3 -21
  126. package/dist/esm/components/atoms/Button/States/Success.js.map +1 -1
  127. package/dist/esm/components/atoms/Card/Card.js +12 -45
  128. package/dist/esm/components/atoms/Card/Card.js.map +1 -1
  129. package/dist/esm/components/atoms/Checkbox/Checkbox.js +13 -51
  130. package/dist/esm/components/atoms/Checkbox/Checkbox.js.map +1 -1
  131. package/dist/esm/components/atoms/Divider/Divider.js +4 -31
  132. package/dist/esm/components/atoms/Divider/Divider.js.map +1 -1
  133. package/dist/esm/components/atoms/GroupButton/GroupButton.js +19 -57
  134. package/dist/esm/components/atoms/GroupButton/GroupButton.js.map +1 -1
  135. package/dist/esm/components/atoms/GroupButton/styled.js +11 -11
  136. package/dist/esm/components/atoms/GroupButton/styled.js.map +1 -1
  137. package/dist/esm/components/atoms/Icon/AntDesign.js +5 -36
  138. package/dist/esm/components/atoms/Icon/AntDesign.js.map +1 -1
  139. package/dist/esm/components/atoms/Icon/Entypo.js +5 -36
  140. package/dist/esm/components/atoms/Icon/Entypo.js.map +1 -1
  141. package/dist/esm/components/atoms/Icon/Evil.js +5 -36
  142. package/dist/esm/components/atoms/Icon/Evil.js.map +1 -1
  143. package/dist/esm/components/atoms/Icon/Feather.js +5 -36
  144. package/dist/esm/components/atoms/Icon/Feather.js.map +1 -1
  145. package/dist/esm/components/atoms/Icon/FontAwesome.js +5 -36
  146. package/dist/esm/components/atoms/Icon/FontAwesome.js.map +1 -1
  147. package/dist/esm/components/atoms/Icon/FontAwesomeFive.js +5 -36
  148. package/dist/esm/components/atoms/Icon/FontAwesomeFive.js.map +1 -1
  149. package/dist/esm/components/atoms/Icon/Fontisto.js +5 -36
  150. package/dist/esm/components/atoms/Icon/Fontisto.js.map +1 -1
  151. package/dist/esm/components/atoms/Icon/Foundation.js +5 -36
  152. package/dist/esm/components/atoms/Icon/Foundation.js.map +1 -1
  153. package/dist/esm/components/atoms/Icon/Icon.js +13 -54
  154. package/dist/esm/components/atoms/Icon/Icon.js.map +1 -1
  155. package/dist/esm/components/atoms/Icon/Ionicon.js +5 -36
  156. package/dist/esm/components/atoms/Icon/Ionicon.js.map +1 -1
  157. package/dist/esm/components/atoms/Icon/Material.js +5 -36
  158. package/dist/esm/components/atoms/Icon/Material.js.map +1 -1
  159. package/dist/esm/components/atoms/Icon/MaterialCommunity.js +10 -44
  160. package/dist/esm/components/atoms/Icon/MaterialCommunity.js.map +1 -1
  161. package/dist/esm/components/atoms/Icon/Octicon.js +5 -36
  162. package/dist/esm/components/atoms/Icon/Octicon.js.map +1 -1
  163. package/dist/esm/components/atoms/Icon/SimpleLine.js +5 -36
  164. package/dist/esm/components/atoms/Icon/SimpleLine.js.map +1 -1
  165. package/dist/esm/components/atoms/Icon/Zocial.js +5 -36
  166. package/dist/esm/components/atoms/Icon/Zocial.js.map +1 -1
  167. package/dist/esm/components/atoms/Icon/functions.d.ts +1 -2
  168. package/dist/esm/components/atoms/Icon/functions.js +30 -22
  169. package/dist/esm/components/atoms/Icon/functions.js.map +1 -1
  170. package/dist/esm/components/atoms/Icon/styled.d.ts +3 -0
  171. package/dist/esm/components/atoms/Icon/styled.js +9 -0
  172. package/dist/esm/components/atoms/Icon/styled.js.map +1 -0
  173. package/dist/esm/components/atoms/Input/InputContainer/InputContainer.js +21 -67
  174. package/dist/esm/components/atoms/Input/InputContainer/InputContainer.js.map +1 -1
  175. package/dist/esm/components/atoms/Input/InputElement/InputElement.js +11 -47
  176. package/dist/esm/components/atoms/Input/InputElement/InputElement.js.map +1 -1
  177. package/dist/esm/components/atoms/Input/InputMaskElement/InputMaskElement.js +15 -52
  178. package/dist/esm/components/atoms/Input/InputMaskElement/InputMaskElement.js.map +1 -1
  179. package/dist/esm/components/atoms/Input/PressableInputContainer/PressableInputContainer.js +11 -43
  180. package/dist/esm/components/atoms/Input/PressableInputContainer/PressableInputContainer.js.map +1 -1
  181. package/dist/esm/components/atoms/Input/hooks/useNumberMask.js +1 -17
  182. package/dist/esm/components/atoms/Input/hooks/useNumberMask.js.map +1 -1
  183. package/dist/esm/components/atoms/Input/hooks/useStringMask.js +2 -2
  184. package/dist/esm/components/atoms/Input/hooks/useStringMask.js.map +1 -1
  185. package/dist/esm/components/atoms/Input/styled.js +1 -1
  186. package/dist/esm/components/atoms/Input/styled.js.map +1 -1
  187. package/dist/esm/components/atoms/Paper/Paper.js +8 -43
  188. package/dist/esm/components/atoms/Paper/Paper.js.map +1 -1
  189. package/dist/esm/components/atoms/PressableSurface/PressableSurface.js +12 -49
  190. package/dist/esm/components/atoms/PressableSurface/PressableSurface.js.map +1 -1
  191. package/dist/esm/components/atoms/ProgressBar/ProgressBar.js +16 -52
  192. package/dist/esm/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
  193. package/dist/esm/components/atoms/RadioButton/RadioButton.js +13 -51
  194. package/dist/esm/components/atoms/RadioButton/RadioButton.js.map +1 -1
  195. package/dist/esm/components/atoms/Switch/Switch.js +14 -53
  196. package/dist/esm/components/atoms/Switch/Switch.js.map +1 -1
  197. package/dist/esm/components/atoms/Tag/Tag.js +16 -52
  198. package/dist/esm/components/atoms/Tag/Tag.js.map +1 -1
  199. package/dist/esm/components/atoms/Text/Text.js +17 -59
  200. package/dist/esm/components/atoms/Text/Text.js.map +1 -1
  201. package/dist/esm/components/molecules/Calendar/Calendar.js +20 -60
  202. package/dist/esm/components/molecules/Calendar/Calendar.js.map +1 -1
  203. package/dist/esm/components/molecules/Calendar/components/MonthWeek.js +3 -3
  204. package/dist/esm/components/molecules/Calendar/components/MonthWeek.js.map +1 -1
  205. package/dist/esm/components/molecules/Calendar/styled.js +5 -8
  206. package/dist/esm/components/molecules/Calendar/styled.js.map +1 -1
  207. package/dist/esm/components/molecules/DatePicker/DatePicker.js +30 -81
  208. package/dist/esm/components/molecules/DatePicker/DatePicker.js.map +1 -1
  209. package/dist/esm/components/molecules/DatePicker/styled.js +3 -6
  210. package/dist/esm/components/molecules/DatePicker/styled.js.map +1 -1
  211. package/dist/esm/components/molecules/DateTimePicker/DateTimePicker.js +42 -104
  212. package/dist/esm/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
  213. package/dist/esm/components/molecules/DateTimeSelector/DateTimeSelector.js +26 -72
  214. package/dist/esm/components/molecules/DateTimeSelector/DateTimeSelector.js.map +1 -1
  215. package/dist/esm/components/molecules/DateTimeSelector/Selector.js +15 -51
  216. package/dist/esm/components/molecules/DateTimeSelector/Selector.js.map +1 -1
  217. package/dist/esm/components/molecules/Grid/functions.js +1 -2
  218. package/dist/esm/components/molecules/Grid/functions.js.map +1 -1
  219. package/dist/esm/components/molecules/HintInputContainer/HintInputContainer.js +17 -55
  220. package/dist/esm/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
  221. package/dist/esm/components/molecules/IconTextButton/IconComponent.js +5 -21
  222. package/dist/esm/components/molecules/IconTextButton/IconComponent.js.map +1 -1
  223. package/dist/esm/components/molecules/InputPassword/InputPasswordIcon.js +8 -41
  224. package/dist/esm/components/molecules/InputPassword/InputPasswordIcon.js.map +1 -1
  225. package/dist/esm/components/molecules/InputPassword/styled.js +14 -1
  226. package/dist/esm/components/molecules/InputPassword/styled.js.map +1 -1
  227. package/dist/esm/components/molecules/Snackbar/Snackbar.js +27 -37
  228. package/dist/esm/components/molecules/Snackbar/Snackbar.js.map +1 -1
  229. package/dist/esm/styles/light.js +8 -21
  230. package/dist/esm/styles/light.js.map +1 -1
  231. package/dist/esm/utils/masks.js +2 -2
  232. package/dist/esm/utils/masks.js.map +1 -1
  233. package/package.json +2 -2
@@ -1,47 +1,55 @@
1
- import { lazy } from 'react';
2
- import styled from '@emotion/native';
1
+ import Material from './Material.js';
2
+ import Fontisto from './Fontisto.js';
3
+ import AntDesign from './AntDesign.js';
4
+ import Feather from './Feather.js';
5
+ import SimpleLine from './SimpleLine.js';
6
+ import FontAwesomeFive from './FontAwesomeFive.js';
7
+ import FontAwesome from './FontAwesome.js';
8
+ import Entypo from './Entypo.js';
9
+ import Evil from './Evil.js';
10
+ import Foundation from './Foundation.js';
11
+ import Ionicon from './Ionicon.js';
12
+ import MaterialCommunity from './MaterialCommunity.js';
13
+ import Octicon from './Octicon.js';
14
+ import Zocial from './Zocial.js';
3
15
 
4
16
  const customIcons = {};
5
- const getStyledIcon = (Component, size) => styled(Component)`
6
- font-size: ${({ theme }) => theme == null ? void 0 : theme.iconSize[size]};
7
- text-align: center;
8
- `;
9
17
  const getIconComponent = (type) => {
10
18
  switch (type) {
11
19
  case "zocial":
12
- return lazy(async () => await import('./Zocial.js'));
20
+ return Zocial;
13
21
  case "octicon":
14
- return lazy(async () => await import('./Octicon.js'));
22
+ return Octicon;
15
23
  case "material":
16
- return lazy(async () => await import('./Material.js'));
24
+ return Material;
17
25
  case "material-community":
18
- return lazy(async () => await import('./MaterialCommunity.js'));
26
+ return MaterialCommunity;
19
27
  case "ionicon":
20
- return lazy(async () => await import('./Ionicon.js'));
28
+ return Ionicon;
21
29
  case "foundation":
22
- return lazy(async () => await import('./Foundation.js'));
30
+ return Foundation;
23
31
  case "evilicon":
24
- return lazy(async () => await import('./Evil.js'));
32
+ return Evil;
25
33
  case "entypo":
26
- return lazy(async () => await import('./Entypo.js'));
34
+ return Entypo;
27
35
  case "font-awesome":
28
- return lazy(async () => await import('./FontAwesome.js'));
36
+ return FontAwesome;
29
37
  case "font-awesome-5":
30
- return lazy(async () => await import('./FontAwesomeFive.js'));
38
+ return FontAwesomeFive;
31
39
  case "simple-line-icon":
32
- return lazy(async () => await import('./SimpleLine.js'));
40
+ return SimpleLine;
33
41
  case "feather":
34
- return lazy(async () => await import('./Feather.js'));
42
+ return Feather;
35
43
  case "antdesign":
36
44
  case "ant-design":
37
- return lazy(async () => await import('./AntDesign.js'));
45
+ return AntDesign;
38
46
  case "fontisto":
39
- return lazy(async () => await import('./Fontisto.js'));
47
+ return Fontisto;
40
48
  default:
41
49
  if (Object.prototype.hasOwnProperty.call(customIcons, type)) {
42
50
  return customIcons[type];
43
51
  }
44
- return lazy(async () => await import('./Material.js'));
52
+ return Material;
45
53
  }
46
54
  };
47
55
  const getIconColor = (colorVariant, colorGradation, fontColor, theme) => {
@@ -51,5 +59,5 @@ const getIconColor = (colorVariant, colorGradation, fontColor, theme) => {
51
59
  return theme.font.color[fontColor];
52
60
  };
53
61
 
54
- export { getIconColor, getIconComponent, getStyledIcon };
62
+ export { getIconColor, getIconComponent };
55
63
  //# sourceMappingURL=functions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"functions.js","sources":["../../../../../src/components/atoms/Icon/functions.ts"],"sourcesContent":["import { ComponentType, lazy } from 'react';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n IconSizeType,\n IconType,\n StyleProps,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport styled from '@emotion/native';\nimport { IconInternalProps, IconRNVIProps } from './types';\n\n/* eslint-disable */\nconst customIcons: any = {};\n\nexport const registerCustomIconType = (id: string, customIcon: any) => {\n customIcons[id] = customIcon;\n};\n\nexport const getStyledIcon = (\n Component: ComponentType<IconRNVIProps>,\n size: IconSizeType\n) => styled(Component)<Partial<StyleProps>>`\n font-size: ${({ theme }: StyleProps) => theme?.iconSize[size]};\n text-align: center;\n`;\n\nexport const getIconComponent = (\n type: IconType\n): ComponentType<IconInternalProps> => {\n switch (type) {\n case 'zocial':\n return lazy(async () => await import('./Zocial'));\n case 'octicon':\n return lazy(async () => await import('./Octicon'));\n case 'material':\n return lazy(async () => await import('./Material'));\n case 'material-community':\n return lazy(async () => await import('./MaterialCommunity'));\n case 'ionicon':\n return lazy(async () => await import('./Ionicon'));\n case 'foundation':\n return lazy(async () => await import('./Foundation'));\n case 'evilicon':\n return lazy(async () => await import('./Evil'));\n case 'entypo':\n return lazy(async () => await import('./Entypo'));\n case 'font-awesome':\n return lazy(async () => await import('./FontAwesome'));\n case 'font-awesome-5':\n return lazy(async () => await import('./FontAwesomeFive'));\n case 'simple-line-icon':\n return lazy(async () => await import('./SimpleLine'));\n case 'feather':\n return lazy(async () => await import('./Feather'));\n case 'antdesign':\n case 'ant-design':\n return lazy(async () => await import('./AntDesign'));\n case 'fontisto':\n return lazy(async () => await import('./Fontisto'));\n default:\n if (Object.prototype.hasOwnProperty.call(customIcons, type)) {\n return customIcons[type];\n }\n return lazy(async () => await import('./Material'));\n }\n};\n/* eslint-enable */\nexport const getIconColor = (\n colorVariant: ColorType | undefined,\n colorGradation: ColorGradationType | undefined,\n fontColor: FontColorType,\n theme: ThemeProp\n): string => {\n if (colorVariant && colorGradation) {\n return theme.color[colorVariant][colorGradation];\n }\n return theme.font.color[fontColor];\n};\n"],"names":[],"mappings":";;;AAcA,MAAM,cAAmB,EAAC,CAAA;AAMnB,MAAM,aAAgB,GAAA,CAC3B,SACA,EAAA,IAAA,KACG,OAAO,SAAS,CAAA,CAAA;AAAA,aAAA,EACN,CAAC,EAAE,KAAM,EAAA,KAAkB,+BAAO,QAAS,CAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA;AAI7C,MAAA,gBAAA,GAAmB,CAC9B,IACqC,KAAA;AACrC,EAAA,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,OAAO,IAAK,CAAA,YAAY,MAAM,OAAO,gBAAc,CAAA,CAAA,CAAA;AAAA,IACrD,KAAK,UAAA;AACH,MAAA,OAAO,IAAK,CAAA,YAAY,MAAM,OAAO,eAAa,CAAA,CAAA,CAAA;AAAA,IACpD;AACE,MAAA,IAAI,OAAO,SAAU,CAAA,cAAA,CAAe,IAAK,CAAA,WAAA,EAAa,IAAI,CAAG,EAAA;AAC3D,QAAA,OAAO,WAAY,CAAA,IAAA,CAAA,CAAA;AAAA,OACrB;AACA,MAAA,OAAO,IAAK,CAAA,YAAY,MAAM,OAAO,eAAa,CAAA,CAAA,CAAA;AAAA,GACtD;AACF,EAAA;AAEO,MAAM,YAAe,GAAA,CAC1B,YACA,EAAA,cAAA,EACA,WACA,KACW,KAAA;AACX,EAAA,IAAI,gBAAgB,cAAgB,EAAA;AAClC,IAAO,OAAA,KAAA,CAAM,MAAM,YAAc,CAAA,CAAA,cAAA,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,OAAA,KAAA,CAAM,KAAK,KAAM,CAAA,SAAA,CAAA,CAAA;AAC1B;;;;"}
1
+ {"version":3,"file":"functions.js","sources":["../../../../../src/components/atoms/Icon/functions.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n IconType,\n ThemeProp,\n} from '@tecsinapse/react-core';\nimport { IconInternalProps } from './types';\nimport Material from './Material';\nimport Fontisto from './Fontisto';\nimport AntDesign from './AntDesign';\nimport Feather from './Feather';\nimport SimpleLine from './SimpleLine';\nimport FontAwesomeFive from './FontAwesomeFive';\nimport FontAwesome from './FontAwesome';\nimport Entypo from './Entypo';\nimport Evil from './Evil';\nimport Foundation from './Foundation';\nimport Ionicon from './Ionicon';\nimport MaterialCommunity from './MaterialCommunity';\nimport Octicon from './Octicon';\nimport Zocial from './Zocial';\n\n/* eslint-disable */\nconst customIcons: any = {};\n\nexport const registerCustomIconType = (id: string, customIcon: any) => {\n customIcons[id] = customIcon;\n};\n\nexport const getIconComponent = (\n type: IconType\n): ComponentType<IconInternalProps> => {\n switch (type) {\n case 'zocial':\n return Zocial;\n case 'octicon':\n return Octicon;\n case 'material':\n return Material;\n case 'material-community':\n return MaterialCommunity;\n case 'ionicon':\n return Ionicon;\n case 'foundation':\n return Foundation;\n case 'evilicon':\n return Evil;\n case 'entypo':\n return Entypo;\n case 'font-awesome':\n return FontAwesome;\n case 'font-awesome-5':\n return FontAwesomeFive;\n case 'simple-line-icon':\n return SimpleLine;\n case 'feather':\n return Feather;\n case 'antdesign':\n case 'ant-design':\n return AntDesign;\n case 'fontisto':\n return Fontisto;\n default:\n if (Object.prototype.hasOwnProperty.call(customIcons, type)) {\n return customIcons[type];\n }\n return Material;\n }\n};\n/* eslint-enable */\nexport const getIconColor = (\n colorVariant: ColorType | undefined,\n colorGradation: ColorGradationType | undefined,\n fontColor: FontColorType,\n theme: ThemeProp\n): string => {\n if (colorVariant && colorGradation) {\n return theme.color[colorVariant][colorGradation];\n }\n return theme.font.color[fontColor];\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyBA,MAAM,cAAmB,EAAC,CAAA;AAMb,MAAA,gBAAA,GAAmB,CAC9B,IACqC,KAAA;AACrC,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,QAAA;AACH,MAAO,OAAA,MAAA,CAAA;AAAA,IACT,KAAK,SAAA;AACH,MAAO,OAAA,OAAA,CAAA;AAAA,IACT,KAAK,UAAA;AACH,MAAO,OAAA,QAAA,CAAA;AAAA,IACT,KAAK,oBAAA;AACH,MAAO,OAAA,iBAAA,CAAA;AAAA,IACT,KAAK,SAAA;AACH,MAAO,OAAA,OAAA,CAAA;AAAA,IACT,KAAK,YAAA;AACH,MAAO,OAAA,UAAA,CAAA;AAAA,IACT,KAAK,UAAA;AACH,MAAO,OAAA,IAAA,CAAA;AAAA,IACT,KAAK,QAAA;AACH,MAAO,OAAA,MAAA,CAAA;AAAA,IACT,KAAK,cAAA;AACH,MAAO,OAAA,WAAA,CAAA;AAAA,IACT,KAAK,gBAAA;AACH,MAAO,OAAA,eAAA,CAAA;AAAA,IACT,KAAK,kBAAA;AACH,MAAO,OAAA,UAAA,CAAA;AAAA,IACT,KAAK,SAAA;AACH,MAAO,OAAA,OAAA,CAAA;AAAA,IACT,KAAK,WAAA,CAAA;AAAA,IACL,KAAK,YAAA;AACH,MAAO,OAAA,SAAA,CAAA;AAAA,IACT,KAAK,UAAA;AACH,MAAO,OAAA,QAAA,CAAA;AAAA,IACT;AACE,MAAA,IAAI,OAAO,SAAU,CAAA,cAAA,CAAe,IAAK,CAAA,WAAA,EAAa,IAAI,CAAG,EAAA;AAC3D,QAAA,OAAO,WAAY,CAAA,IAAA,CAAA,CAAA;AAAA,OACrB;AACA,MAAO,OAAA,QAAA,CAAA;AAAA,GACX;AACF,EAAA;AAEO,MAAM,YAAe,GAAA,CAC1B,YACA,EAAA,cAAA,EACA,WACA,KACW,KAAA;AACX,EAAA,IAAI,gBAAgB,cAAgB,EAAA;AAClC,IAAO,OAAA,KAAA,CAAM,MAAM,YAAc,CAAA,CAAA,cAAA,CAAA,CAAA;AAAA,GACnC;AACA,EAAO,OAAA,KAAA,CAAM,KAAK,KAAM,CAAA,SAAA,CAAA,CAAA;AAC1B;;;;"}
@@ -0,0 +1,3 @@
1
+ import { ComponentType } from 'react';
2
+ import { IconRNVIProps } from './types';
3
+ export declare const getStyledIcon: (Component: ComponentType<IconRNVIProps>, size: IconSizeType) => import("@emotion/native").StyledComponent<any, {}, {}>;
@@ -0,0 +1,9 @@
1
+ import styled from '@emotion/native';
2
+
3
+ const getStyledIcon = (Component, size) => styled(Component)`
4
+ font-size: ${({ theme }) => theme?.iconSize[size]};
5
+ text-align: center;
6
+ `;
7
+
8
+ export { getStyledIcon };
9
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styled.js","sources":["../../../../../src/components/atoms/Icon/styled.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport { IconRNVIProps } from './types';\nimport { IconSizeType, StyleProps } from '@tecsinapse/react-core';\nimport styled from '@emotion/native';\n\nexport const getStyledIcon = (\n Component: ComponentType<IconRNVIProps>,\n size: IconSizeType\n) => styled(Component)<Partial<StyleProps>>`\n font-size: ${({ theme }: StyleProps) => theme?.iconSize[size]};\n text-align: center;\n`;\n"],"names":[],"mappings":";;AAKO,MAAM,aAAgB,GAAA,CAC3B,SACA,EAAA,IAAA,KACG,OAAO,SAAS,CAAA,CAAA;AAAA,aAAA,EACN,CAAC,EAAE,KAAM,EAAA,KAAkB,OAAO,QAAS,CAAA,IAAA,CAAA,CAAA;AAAA;AAAA;;;;"}
@@ -2,71 +2,24 @@ import React__default from 'react';
2
2
  import Text from '../../Text/Text.js';
3
3
  import { StyledInputContainer, StyledBorderKeeper, StyledIconContent, StyledLabelContainer } from '../styled.js';
4
4
 
5
- var __defProp = Object.defineProperty;
6
- var __defProps = Object.defineProperties;
7
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
- const InputContainer = (_a) => {
37
- var _b = _a, {
38
- label,
39
- labelColor = "medium",
40
- labelColorTone,
41
- labelColorVariant,
42
- labelTypography = "label",
43
- labelStack = "default",
44
- labelWeight = "bold",
45
- LabelComponent = Text,
46
- leftComponent,
47
- rightComponent,
48
- inputContainerStyle,
49
- disabled,
50
- focused,
51
- variant,
52
- children
53
- } = _b, rest = __objRest(_b, [
54
- "label",
55
- "labelColor",
56
- "labelColorTone",
57
- "labelColorVariant",
58
- "labelTypography",
59
- "labelStack",
60
- "labelWeight",
61
- "LabelComponent",
62
- "leftComponent",
63
- "rightComponent",
64
- "inputContainerStyle",
65
- "disabled",
66
- "focused",
67
- "variant",
68
- "children"
69
- ]);
5
+ const InputContainer = ({
6
+ label,
7
+ labelColor = "medium",
8
+ labelColorTone,
9
+ labelColorVariant,
10
+ labelTypography = "label",
11
+ labelStack = "default",
12
+ labelWeight = "bold",
13
+ LabelComponent = Text,
14
+ leftComponent,
15
+ rightComponent,
16
+ inputContainerStyle,
17
+ disabled,
18
+ focused,
19
+ variant,
20
+ children,
21
+ ...rest
22
+ }) => {
70
23
  let _defaultLabelColor = labelColorVariant;
71
24
  if (variant === "error")
72
25
  _defaultLabelColor = "error";
@@ -74,11 +27,12 @@ const InputContainer = (_a) => {
74
27
  _defaultLabelColor = "success";
75
28
  const _labelColorVariant = disabled ? "secondary" : _defaultLabelColor;
76
29
  const _labelColorTone = disabled ? "light" : labelColorTone;
77
- return /* @__PURE__ */ React__default.createElement(StyledInputContainer, __spreadProps(__spreadValues({}, rest), {
30
+ return /* @__PURE__ */ React__default.createElement(StyledInputContainer, {
31
+ ...rest,
78
32
  style: inputContainerStyle,
79
33
  focused,
80
34
  disabled
81
- }), /* @__PURE__ */ React__default.createElement(StyledBorderKeeper, {
35
+ }, /* @__PURE__ */ React__default.createElement(StyledBorderKeeper, {
82
36
  focused,
83
37
  disabled,
84
38
  borderColor: _defaultLabelColor
@@ -1 +1 @@
1
- {"version":3,"file":"InputContainer.js","sources":["../../../../../../src/components/atoms/Input/InputContainer/InputContainer.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { InputElementProps } from '..';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType,\n} from '@tecsinapse/react-core';\nimport { Text, TextProps } from '../../Text';\nimport {\n StyledBorderKeeper,\n StyledIconContent,\n StyledInputContainer,\n StyledLabelContainer,\n} from '../styled';\n\nexport type InputVariantType = 'default' | 'error' | 'success';\n\nexport interface InputContainerProps {\n label?: string;\n labelColor?: FontColorType;\n labelColorVariant?: ColorType;\n labelColorTone?: ColorGradationType;\n labelTypography?: TypographyVariationType;\n labelStack?: FontStackType;\n LabelComponent?: FC<TextProps>;\n labelWeight?: FontWeightType;\n leftComponent?: JSX.Element;\n rightComponent?: JSX.Element;\n borderColor?: ColorType;\n borderColorGradation?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n inputContainerStyle?: StyleProp<ViewStyle>;\n focused?: boolean;\n disabled?: boolean;\n variant?: InputVariantType;\n hint?: string;\n hintComponent?: JSX.Element;\n}\n\nconst InputContainer: FC<InputContainerProps & Partial<InputElementProps>> = ({\n label,\n labelColor = 'medium',\n labelColorTone,\n labelColorVariant,\n labelTypography = 'label',\n labelStack = 'default',\n labelWeight = 'bold',\n LabelComponent = Text,\n leftComponent,\n rightComponent,\n inputContainerStyle,\n disabled,\n focused,\n variant,\n children,\n ...rest\n}): JSX.Element => {\n let _defaultLabelColor = labelColorVariant;\n if (variant === 'error') _defaultLabelColor = 'error';\n if (variant === 'success') _defaultLabelColor = 'success';\n const _labelColorVariant = disabled ? 'secondary' : _defaultLabelColor;\n const _labelColorTone = disabled ? 'light' : labelColorTone;\n\n return (\n <StyledInputContainer\n {...rest}\n style={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n >\n <StyledBorderKeeper\n focused={focused}\n disabled={disabled}\n borderColor={_defaultLabelColor}\n />\n\n {leftComponent && <StyledIconContent>{leftComponent}</StyledIconContent>}\n\n <StyledLabelContainer\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n >\n {label && (\n <LabelComponent\n fontColor={labelColor}\n colorTone={_labelColorTone}\n colorVariant={_labelColorVariant}\n typography={labelTypography}\n fontWeight={labelWeight}\n fontStack={labelStack}\n >\n {label}\n </LabelComponent>\n )}\n {children}\n </StyledLabelContainer>\n\n {rightComponent && (\n <StyledIconContent>{rightComponent}</StyledIconContent>\n )}\n </StyledInputContainer>\n );\n};\n\nexport default InputContainer;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CM,MAAA,cAAA,GAAuE,CAAC,EAiB3D,KAAA;AAjB2D,EAC5E,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,UAAa,GAAA,QAAA;AAAA,IACb,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,eAAkB,GAAA,OAAA;AAAA,IAClB,UAAa,GAAA,SAAA;AAAA,IACb,WAAc,GAAA,MAAA;AAAA,IACd,cAAiB,GAAA,IAAA;AAAA,IACjB,aAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,GA1DF,GA2C8E,EAgBzE,EAAA,IAAA,GAAA,SAAA,CAhByE,EAgBzE,EAAA;AAAA,IAfH,OAAA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,iBAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,gBAAA;AAAA,IACA,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,qBAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA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atoms/Input/InputContainer/InputContainer.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyleProp, ViewStyle } from 'react-native';\nimport { InputElementProps } from '..';\nimport {\n ColorGradationType,\n ColorType,\n FontColorType,\n FontStackType,\n FontWeightType,\n TypographyVariationType,\n} from '@tecsinapse/react-core';\nimport { Text, TextProps } from '../../Text';\nimport {\n StyledBorderKeeper,\n StyledIconContent,\n StyledInputContainer,\n StyledLabelContainer,\n} from '../styled';\n\nexport type InputVariantType = 'default' | 'error' | 'success';\n\nexport interface InputContainerProps {\n label?: string;\n labelColor?: FontColorType;\n labelColorVariant?: ColorType;\n labelColorTone?: ColorGradationType;\n labelTypography?: TypographyVariationType;\n labelStack?: FontStackType;\n LabelComponent?: FC<TextProps>;\n labelWeight?: FontWeightType;\n leftComponent?: JSX.Element;\n rightComponent?: JSX.Element;\n borderColor?: ColorType;\n borderColorGradation?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n inputContainerStyle?: StyleProp<ViewStyle>;\n focused?: boolean;\n disabled?: boolean;\n variant?: InputVariantType;\n hint?: string;\n hintComponent?: JSX.Element;\n}\n\nconst InputContainer: FC<InputContainerProps & Partial<InputElementProps>> = ({\n label,\n labelColor = 'medium',\n labelColorTone,\n labelColorVariant,\n labelTypography = 'label',\n labelStack = 'default',\n labelWeight = 'bold',\n LabelComponent = Text,\n leftComponent,\n rightComponent,\n inputContainerStyle,\n disabled,\n focused,\n variant,\n children,\n ...rest\n}): JSX.Element => {\n let _defaultLabelColor = labelColorVariant;\n if (variant === 'error') _defaultLabelColor = 'error';\n if (variant === 'success') _defaultLabelColor = 'success';\n const _labelColorVariant = disabled ? 'secondary' : _defaultLabelColor;\n const _labelColorTone = disabled ? 'light' : labelColorTone;\n\n return (\n <StyledInputContainer\n {...rest}\n style={inputContainerStyle}\n focused={focused}\n disabled={disabled}\n >\n <StyledBorderKeeper\n focused={focused}\n disabled={disabled}\n borderColor={_defaultLabelColor}\n />\n\n {leftComponent && <StyledIconContent>{leftComponent}</StyledIconContent>}\n\n <StyledLabelContainer\n leftComponent={leftComponent}\n rightComponent={rightComponent}\n >\n {label && (\n <LabelComponent\n fontColor={labelColor}\n colorTone={_labelColorTone}\n colorVariant={_labelColorVariant}\n typography={labelTypography}\n fontWeight={labelWeight}\n fontStack={labelStack}\n >\n {label}\n </LabelComponent>\n )}\n {children}\n </StyledLabelContainer>\n\n {rightComponent && (\n <StyledIconContent>{rightComponent}</StyledIconContent>\n )}\n </StyledInputContainer>\n );\n};\n\nexport default InputContainer;\n"],"names":["React"],"mappings":";;;;AA2CA,MAAM,iBAAuE,CAAC;AAAA,EAC5E,KAAA;AAAA,EACA,UAAa,GAAA,QAAA;AAAA,EACb,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAkB,GAAA,OAAA;AAAA,EAClB,UAAa,GAAA,SAAA;AAAA,EACb,WAAc,GAAA,MAAA;AAAA,EACd,cAAiB,GAAA,IAAA;AAAA,EACjB,aAAA;AAAA,EACA,cAAA;AAAA,EACA,mBAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACG,GAAA,IAAA;AACL,CAAmB,KAAA;AACjB,EAAA,IAAI,kBAAqB,GAAA,iBAAA,CAAA;AACzB,EAAA,IAAI,OAAY,KAAA,OAAA;AAAS,IAAqB,kBAAA,GAAA,OAAA,CAAA;AAC9C,EAAA,IAAI,OAAY,KAAA,SAAA;AAAW,IAAqB,kBAAA,GAAA,SAAA,CAAA;AAChD,EAAM,MAAA,kBAAA,GAAqB,WAAW,WAAc,GAAA,kBAAA,CAAA;AACpD,EAAM,MAAA,eAAA,GAAkB,WAAW,OAAU,GAAA,cAAA,CAAA;AAE7C,EAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,oBAAA,EAAA;AAAA,IACE,GAAG,IAAA;AAAA,IACJ,KAAO,EAAA,mBAAA;AAAA,IACP,OAAA;AAAA,IACA,QAAA;AAAA,GAAA,kBAECA,cAAA,CAAA,aAAA,CAAA,kBAAA,EAAA;AAAA,IACC,OAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAa,EAAA,kBAAA;AAAA,GACf,GAEC,aAAiB,oBAAAA,cAAA,CAAA,aAAA,CAAC,iBAAmB,EAAA,IAAA,EAAA,aAAc,mBAEnDA,cAAA,CAAA,aAAA,CAAA,oBAAA,EAAA;AAAA,IACC,aAAA;AAAA,IACA,cAAA;AAAA,GAAA,EAEC,yBACEA,cAAA,CAAA,aAAA,CAAA,cAAA,EAAA;AAAA,IACC,SAAW,EAAA,UAAA;AAAA,IACX,SAAW,EAAA,eAAA;AAAA,IACX,YAAc,EAAA,kBAAA;AAAA,IACd,UAAY,EAAA,eAAA;AAAA,IACZ,UAAY,EAAA,WAAA;AAAA,IACZ,SAAW,EAAA,UAAA;AAAA,GAEV,EAAA,KACH,GAED,QACH,CAAA,EAEC,kCACEA,cAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,IAAA,EAAmB,cAAe,CAEvC,CAAA,CAAA;AAEJ;;;;"}
@@ -2,55 +2,19 @@ import { useTheme } from '@emotion/react';
2
2
  import React__default from 'react';
3
3
  import { StyledInputElement } from '../styled.js';
4
4
 
5
- var __defProp = Object.defineProperty;
6
- var __defProps = Object.defineProperties;
7
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
5
  const InputElement = React__default.forwardRef(
37
- (_a, ref) => {
38
- var _b = _a, {
39
- onChange,
40
- placeholder,
41
- value,
42
- disabled = false,
43
- placeholderTextColor
44
- } = _b, rest = __objRest(_b, [
45
- "onChange",
46
- "placeholder",
47
- "value",
48
- "disabled",
49
- "placeholderTextColor"
50
- ]);
6
+ ({
7
+ onChange,
8
+ placeholder,
9
+ value,
10
+ disabled = false,
11
+ placeholderTextColor,
12
+ ...rest
13
+ }, ref) => {
51
14
  const theme = useTheme();
52
15
  const _placeholderColor = placeholderTextColor || theme.font.color.dark;
53
- return /* @__PURE__ */ React__default.createElement(StyledInputElement, __spreadProps(__spreadValues({}, rest), {
16
+ return /* @__PURE__ */ React__default.createElement(StyledInputElement, {
17
+ ...rest,
54
18
  ref,
55
19
  onChangeText: onChange,
56
20
  value,
@@ -58,7 +22,7 @@ const InputElement = React__default.forwardRef(
58
22
  placeholderTextColor: _placeholderColor,
59
23
  disabled,
60
24
  editable: !disabled
61
- }));
25
+ });
62
26
  }
63
27
  );
64
28
  InputElement.displayName = "InputElement";
@@ -1 +1 @@
1
- {"version":3,"file":"InputElement.js","sources":["../../../../../../src/components/atoms/Input/InputElement/InputElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\n\nexport interface InputElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputElement = React.forwardRef<TextInput, InputElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChange}\n value={value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputElement.displayName = 'InputElement';\n\nexport default InputElement;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAM,eAAeA,cAAM,CAAA,UAAA;AAAA,EACzB,CACE,IAQA,GACgB,KAAA;AAThB,IACE,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAW,GAAA,KAAA;AAAA,MACX,oBAAA;AAAA,KAxBN,GAmBI,EAMK,EAAA,IAAA,GAAA,SAAA,CANL,EAMK,EAAA;AAAA,MALH,UAAA;AAAA,MACA,aAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,sBAAA;AAAA,KAAA,CAAA,CAAA;AAKF,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,IAAA,MAAM,iBAAoB,GAAA,oBAAA,IAAwB,KAAM,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAA;AAEnE,IACE,uBAAAA,cAAA,CAAA,aAAA,CAAC,qDACK,IADL,CAAA,EAAA;AAAA,MAEC,GAAA;AAAA,MACA,YAAc,EAAA,QAAA;AAAA,MACd,KAAA;AAAA,MACA,WAAA;AAAA,MACA,oBAAsB,EAAA,iBAAA;AAAA,MACtB,QAAA;AAAA,MACA,UAAU,CAAC,QAAA;AAAA,KACb,CAAA,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,YAAA,CAAa,WAAc,GAAA,cAAA;;;;"}
1
+ {"version":3,"file":"InputElement.js","sources":["../../../../../../src/components/atoms/Input/InputElement/InputElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\n\nexport interface InputElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: string) => void;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputElement = React.forwardRef<TextInput, InputElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChange}\n value={value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputElement.displayName = 'InputElement';\n\nexport default InputElement;\n"],"names":["React"],"mappings":";;;;AAiBA,MAAM,eAAeA,cAAM,CAAA,UAAA;AAAA,EACzB,CACE;AAAA,IACE,QAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,oBAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACgB,KAAA;AAChB,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AACvB,IAAA,MAAM,iBAAoB,GAAA,oBAAA,IAAwB,KAAM,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAA;AAEnE,IAAA,uBACGA,cAAA,CAAA,aAAA,CAAA,kBAAA,EAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,YAAc,EAAA,QAAA;AAAA,MACd,KAAA;AAAA,MACA,WAAA;AAAA,MACA,oBAAsB,EAAA,iBAAA;AAAA,MACtB,QAAA;AAAA,MACA,UAAU,CAAC,QAAA;AAAA,KACb,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,YAAA,CAAa,WAAc,GAAA,cAAA;;;;"}
@@ -4,54 +4,16 @@ import { StyledInputElement } from '../styled.js';
4
4
  import { useStringMask } from '../hooks/useStringMask.js';
5
5
  import { useNumberMask } from '../hooks/useNumberMask.js';
6
6
 
7
- var __defProp = Object.defineProperty;
8
- var __defProps = Object.defineProperties;
9
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues = (a, b) => {
15
- for (var prop in b || (b = {}))
16
- if (__hasOwnProp.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- if (__getOwnPropSymbols)
19
- for (var prop of __getOwnPropSymbols(b)) {
20
- if (__propIsEnum.call(b, prop))
21
- __defNormalProp(a, prop, b[prop]);
22
- }
23
- return a;
24
- };
25
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
- var __objRest = (source, exclude) => {
27
- var target = {};
28
- for (var prop in source)
29
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
- target[prop] = source[prop];
31
- if (source != null && __getOwnPropSymbols)
32
- for (var prop of __getOwnPropSymbols(source)) {
33
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
- target[prop] = source[prop];
35
- }
36
- return target;
37
- };
38
7
  const InputMaskElement = React__default.forwardRef(
39
- (_a, ref) => {
40
- var _b = _a, {
41
- onChange,
42
- placeholder,
43
- value,
44
- disabled = false,
45
- placeholderTextColor,
46
- mask
47
- } = _b, rest = __objRest(_b, [
48
- "onChange",
49
- "placeholder",
50
- "value",
51
- "disabled",
52
- "placeholderTextColor",
53
- "mask"
54
- ]);
8
+ ({
9
+ onChange,
10
+ placeholder,
11
+ value,
12
+ disabled = false,
13
+ placeholderTextColor,
14
+ mask,
15
+ ...rest
16
+ }, ref) => {
55
17
  const theme = useTheme();
56
18
  const _placeholderColor = placeholderTextColor || theme.font.color.dark;
57
19
  const getInputHook = (value2) => {
@@ -65,11 +27,11 @@ const InputMaskElement = React__default.forwardRef(
65
27
  return [void 0, void 0];
66
28
  }
67
29
  };
68
- const [maskValue, setMaskValue] = getInputHook(value != null ? value : "");
69
- const _value = maskValue === void 0 ? value == null ? void 0 : value.toString() : maskValue.formatted ? maskValue.formatted : "";
30
+ const [maskValue, setMaskValue] = getInputHook(value ?? "");
31
+ const _value = maskValue === void 0 ? value?.toString() : maskValue.formatted ? maskValue.formatted : "";
70
32
  useEffect(() => {
71
33
  if (onChange) {
72
- onChange(maskValue == null ? void 0 : maskValue.raw);
34
+ onChange(maskValue?.raw);
73
35
  }
74
36
  }, [maskValue]);
75
37
  const onChangeValue = useCallback(
@@ -90,7 +52,8 @@ const InputMaskElement = React__default.forwardRef(
90
52
  onChangeValue(value);
91
53
  }
92
54
  }, [value]);
93
- return /* @__PURE__ */ React__default.createElement(StyledInputElement, __spreadProps(__spreadValues({}, rest), {
55
+ return /* @__PURE__ */ React__default.createElement(StyledInputElement, {
56
+ ...rest,
94
57
  ref,
95
58
  onChangeText: onChangeValue,
96
59
  value: _value,
@@ -98,7 +61,7 @@ const InputMaskElement = React__default.forwardRef(
98
61
  placeholderTextColor: _placeholderColor,
99
62
  disabled,
100
63
  editable: !disabled
101
- }));
64
+ });
102
65
  }
103
66
  );
104
67
  InputMaskElement.displayName = "InputMaskElement";
@@ -1 +1 @@
1
- {"version":3,"file":"InputMaskElement.js","sources":["../../../../../../src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React, { useCallback, useEffect } from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\nimport { MaskType, useStringMask } from '../hooks/useStringMask';\nimport { CurrencyOptions, useNumberMask } from '../hooks/useNumberMask';\n\nexport interface InputMaskElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string | number;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: any) => void;\n /**\n To use mask for strings you have to pass a MaskType[] or ((value: string) => MaskType[])\n A MaskType can be a string, RegExp, or Array<RegExp>.\n In case we have a string, '9' represents digits, 'a' represents alphabet characters, and any other character represents fixed characters in the mask.\n For example a phone mask can be represented as ['(99) \\\\99999-9999'], or ['(99) ', '/[9]/', '9999-9999'], or ['(', /[0-9]/, /[0-9]/, ') ', '/[9]/', '9999-9999'] and many others.\n To use mask for numbers you have to pass a CurrencyOptions object\n A CurrencyOptions object contains symbol, separator, decimal, precision. For example {symbol: 'R$ ', separator: '.', decimal: ',', precision: 2,}.\n **/\n mask?: (MaskType[] | ((value: string) => MaskType[])) | CurrencyOptions;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputMaskElement = React.forwardRef<TextInput, InputMaskElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n mask,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n const getInputHook = (value: string | number) => {\n if (mask !== undefined) {\n if (Array.isArray(mask) || typeof mask === 'function') {\n return useStringMask(mask, value);\n } else {\n return useNumberMask(mask, value);\n }\n } else {\n return [undefined, undefined];\n }\n };\n\n const [maskValue, setMaskValue] = getInputHook(value ?? '');\n\n const _value =\n maskValue === undefined\n ? value?.toString()\n : maskValue.formatted\n ? maskValue.formatted\n : '';\n\n useEffect(() => {\n if (onChange) {\n onChange(maskValue?.raw);\n }\n }, [maskValue]);\n\n const onChangeValue = useCallback(\n (value: string | number) => {\n if (maskValue !== undefined && setMaskValue !== undefined) {\n setMaskValue(value);\n } else onChange && onChange(value);\n },\n [value]\n );\n\n useEffect(() => {\n /** Used to reinitialize maskValue when the value is updated in the parent component **/\n if (\n maskValue !== undefined &&\n setMaskValue !== undefined &&\n value !== undefined &&\n typeof maskValue === 'object'\n ) {\n /** Case there is a mask **/\n if (\n maskValue.raw !== undefined &&\n maskValue.raw.toString() !== value.toString()\n ) {\n onChangeValue(value);\n }\n } else if (maskValue === undefined && value !== undefined) {\n onChangeValue(value);\n }\n }, [value]);\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChangeValue}\n value={_value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputMaskElement.displayName = 'InputMaskElement';\n\nexport default InputMaskElement;\n"],"names":["React","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,mBAAmBA,cAAM,CAAA,UAAA;AAAA,EAC7B,CACE,IASA,GACgB,KAAA;AAVhB,IACE,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAW,GAAA,KAAA;AAAA,MACX,oBAAA;AAAA,MACA,IAAA;AAAA,KApCN,GA8BI,EAOK,EAAA,IAAA,GAAA,SAAA,CAPL,EAOK,EAAA;AAAA,MANH,UAAA;AAAA,MACA,aAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MAC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AAAO,UAAA,QAAA,IAAY,SAASA,MAAK,CAAA,CAAA;AAAA,OACnC;AAAA,MACA,CAAC,KAAK,CAAA;AAAA,KACR,CAAA;AAEA,IAAA,SAAA,CAAU,MAAM;AAEd,MACE,IAAA,SAAA,KAAc,UACd,YAAiB,KAAA,KAAA,CAAA,IACjB,UAAU,KACV,CAAA,IAAA,OAAO,cAAc,QACrB,EAAA;AAEA,QACE,IAAA,SAAA,CAAU,QAAQ,KAClB,CAAA,IAAA,SAAA,CAAU,IAAI,QAAS,EAAA,KAAM,KAAM,CAAA,QAAA,EACnC,EAAA;AACA,UAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,SACrB;AAAA,OACS,MAAA,IAAA,SAAA,KAAc,KAAa,CAAA,IAAA,KAAA,KAAU,KAAW,CAAA,EAAA;AACzD,QAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,OACrB;AAAA,KACF,EAAG,CAAC,KAAK,CAAC,CAAA,CAAA;AAEV,IACE,uBAAAD,cAAA,CAAA,aAAA,CAAC,qDACK,IADL,CAAA,EAAA;AAAA,MAEC,GAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,KAAO,EAAA,MAAA;AAAA,MACP,WAAA;AAAA,MACA,oBAAsB,EAAA,iBAAA;AAAA,MACtB,QAAA;AAAA,MACA,UAAU,CAAC,QAAA;AAAA,KACb,CAAA,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,gBAAA,CAAiB,WAAc,GAAA,kBAAA;;;;"}
1
+ {"version":3,"file":"InputMaskElement.js","sources":["../../../../../../src/components/atoms/Input/InputMaskElement/InputMaskElement.tsx"],"sourcesContent":["import { useTheme } from '@emotion/react';\nimport { ThemeProp } from '@tecsinapse/react-core';\nimport React, { useCallback, useEffect } from 'react';\nimport { StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport { StyledInputElement } from '../styled';\nimport { MaskType, useStringMask } from '../hooks/useStringMask';\nimport { CurrencyOptions, useNumberMask } from '../hooks/useNumberMask';\n\nexport interface InputMaskElementProps\n extends Omit<TextInputProps, 'onChange' | 'value' | 'ref'> {\n style?: StyleProp<TextStyle>;\n value?: string | number;\n placeholder?: string;\n disabled?: boolean;\n onChange?: (value: any) => void;\n /**\n To use mask for strings you have to pass a MaskType[] or ((value: string) => MaskType[])\n A MaskType can be a string, RegExp, or Array<RegExp>.\n In case we have a string, '9' represents digits, 'a' represents alphabet characters, and any other character represents fixed characters in the mask.\n For example a phone mask can be represented as ['(99) \\\\99999-9999'], or ['(99) ', '/[9]/', '9999-9999'], or ['(', /[0-9]/, /[0-9]/, ') ', '/[9]/', '9999-9999'] and many others.\n To use mask for numbers you have to pass a CurrencyOptions object\n A CurrencyOptions object contains symbol, separator, decimal, precision. For example {symbol: 'R$ ', separator: '.', decimal: ',', precision: 2,}.\n **/\n mask?: (MaskType[] | ((value: string) => MaskType[])) | CurrencyOptions;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst InputMaskElement = React.forwardRef<TextInput, InputMaskElementProps>(\n (\n {\n onChange,\n placeholder,\n value,\n disabled = false,\n placeholderTextColor,\n mask,\n ...rest\n },\n ref\n ): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const _placeholderColor = placeholderTextColor || theme.font.color.dark;\n\n const getInputHook = (value: string | number) => {\n if (mask !== undefined) {\n if (Array.isArray(mask) || typeof mask === 'function') {\n return useStringMask(mask, value);\n } else {\n return useNumberMask(mask, value);\n }\n } else {\n return [undefined, undefined];\n }\n };\n\n const [maskValue, setMaskValue] = getInputHook(value ?? '');\n\n const _value =\n maskValue === undefined\n ? value?.toString()\n : maskValue.formatted\n ? maskValue.formatted\n : '';\n\n useEffect(() => {\n if (onChange) {\n onChange(maskValue?.raw);\n }\n }, [maskValue]);\n\n const onChangeValue = useCallback(\n (value: string | number) => {\n if (maskValue !== undefined && setMaskValue !== undefined) {\n setMaskValue(value);\n } else onChange && onChange(value);\n },\n [value]\n );\n\n useEffect(() => {\n /** Used to reinitialize maskValue when the value is updated in the parent component **/\n if (\n maskValue !== undefined &&\n setMaskValue !== undefined &&\n value !== undefined &&\n typeof maskValue === 'object'\n ) {\n /** Case there is a mask **/\n if (\n maskValue.raw !== undefined &&\n maskValue.raw.toString() !== value.toString()\n ) {\n onChangeValue(value);\n }\n } else if (maskValue === undefined && value !== undefined) {\n onChangeValue(value);\n }\n }, [value]);\n\n return (\n <StyledInputElement\n {...rest}\n ref={ref}\n onChangeText={onChangeValue}\n value={_value}\n placeholder={placeholder}\n placeholderTextColor={_placeholderColor}\n disabled={disabled}\n editable={!disabled}\n />\n );\n }\n);\n\nInputMaskElement.displayName = 'InputMaskElement';\n\nexport default InputMaskElement;\n"],"names":["React","value"],"mappings":";;;;;;AA4BA,MAAM,mBAAmBA,cAAM,CAAA,UAAA;AAAA,EAC7B,CACE;AAAA,IACE,QAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,oBAAA;AAAA,IACA,IAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACgB,KAAA;AAChB,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAA,MAAM,iBAAoB,GAAA,oBAAA,IAAwB,KAAM,CAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAA;AAEnE,IAAM,MAAA,YAAA,GAAe,CAACC,MAA2B,KAAA;AAC/C,MAAA,IAAI,SAAS,KAAW,CAAA,EAAA;AACtB,QAAA,IAAI,MAAM,OAAQ,CAAA,IAAI,CAAK,IAAA,OAAO,SAAS,UAAY,EAAA;AACrD,UAAO,OAAA,aAAA,CAAc,MAAMA,MAAK,CAAA,CAAA;AAAA,SAC3B,MAAA;AACL,UAAO,OAAA,aAAA,CAAc,MAAMA,MAAK,CAAA,CAAA;AAAA,SAClC;AAAA,OACK,MAAA;AACL,QAAO,OAAA,CAAC,QAAW,KAAS,CAAA,CAAA,CAAA;AAAA,OAC9B;AAAA,KACF,CAAA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,aAAA,CAAA,kBAAA,EAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,KAAO,EAAA,MAAA;AAAA,MACP,WAAA;AAAA,MACA,oBAAsB,EAAA,iBAAA;AAAA,MACtB,QAAA;AAAA,MACA,UAAU,CAAC,QAAA;AAAA,KACb,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,gBAAA,CAAiB,WAAc,GAAA,kBAAA;;;;"}
@@ -2,53 +2,21 @@ import * as React from 'react';
2
2
  import InputContainer from '../InputContainer/InputContainer.js';
3
3
  import { StyledPressableSurface } from './styled.js';
4
4
 
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- const PressableInputContainer = (_a) => {
34
- var _b = _a, {
35
- onPress,
36
- disabled,
37
- style,
38
- children
39
- } = _b, rest = __objRest(_b, [
40
- "onPress",
41
- "disabled",
42
- "style",
43
- "children"
44
- ]);
5
+ const PressableInputContainer = ({
6
+ onPress,
7
+ disabled,
8
+ style,
9
+ children,
10
+ ...rest
11
+ }) => {
45
12
  return /* @__PURE__ */ React.createElement(StyledPressableSurface, {
46
13
  onPress,
47
14
  disabled,
48
15
  style
49
- }, /* @__PURE__ */ React.createElement(InputContainer, __spreadValues({
50
- disabled
51
- }, rest), children));
16
+ }, /* @__PURE__ */ React.createElement(InputContainer, {
17
+ disabled,
18
+ ...rest
19
+ }, children));
52
20
  };
53
21
 
54
22
  export { PressableInputContainer as default };
@@ -1 +1 @@
1
- {"version":3,"file":"PressableInputContainer.js","sources":["../../../../../../src/components/atoms/Input/PressableInputContainer/PressableInputContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PressableStateCallbackType, StyleProp, ViewStyle } from 'react-native';\nimport InputContainer, {\n InputContainerProps,\n} from '../InputContainer/InputContainer';\nimport { StyledPressableSurface } from './styled';\n\nexport interface PressableInputContainerProps\n extends Omit<\n InputContainerProps,\n 'value' | 'onChange' | 'onChangeText' | 'disabled' | 'style'\n > {\n onPress?: () => void | never;\n disabled?: boolean;\n style?:\n | StyleProp<ViewStyle>\n | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);\n}\n\nconst PressableInputContainer: React.FC<PressableInputContainerProps> = ({\n onPress,\n disabled,\n style,\n children,\n ...rest\n}) => {\n return (\n <StyledPressableSurface onPress={onPress} disabled={disabled} style={style}>\n <InputContainer disabled={disabled} {...rest}>\n {children}\n </InputContainer>\n </StyledPressableSurface>\n );\n};\n\nexport default PressableInputContainer;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBM,MAAA,uBAAA,GAAkE,CAAC,EAMnE,KAAA;AANmE,EACvE,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,GAvBF,GAmByE,EAKpE,EAAA,IAAA,GAAA,SAAA,CALoE,EAKpE,EAAA;AAAA,IAJH,SAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,GAAA,CAAA,CAAA;AAGA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA;AAAA,IAAuB,OAAA;AAAA,IAAkB,QAAA;AAAA,IAAoB,KAAA;AAAA,GAAA,kBAC3D,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,cAAA,CAAA;AAAA,IAAe,QAAA;AAAA,GAAwB,EAAA,IAAA,CAAA,EACrC,QACH,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"PressableInputContainer.js","sources":["../../../../../../src/components/atoms/Input/PressableInputContainer/PressableInputContainer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { PressableStateCallbackType, StyleProp, ViewStyle } from 'react-native';\nimport InputContainer, {\n InputContainerProps,\n} from '../InputContainer/InputContainer';\nimport { StyledPressableSurface } from './styled';\n\nexport interface PressableInputContainerProps\n extends Omit<\n InputContainerProps,\n 'value' | 'onChange' | 'onChangeText' | 'disabled' | 'style'\n > {\n onPress?: () => void | never;\n disabled?: boolean;\n style?:\n | StyleProp<ViewStyle>\n | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);\n}\n\nconst PressableInputContainer: React.FC<PressableInputContainerProps> = ({\n onPress,\n disabled,\n style,\n children,\n ...rest\n}) => {\n return (\n <StyledPressableSurface onPress={onPress} disabled={disabled} style={style}>\n <InputContainer disabled={disabled} {...rest}>\n {children}\n </InputContainer>\n </StyledPressableSurface>\n );\n};\n\nexport default PressableInputContainer;\n"],"names":[],"mappings":";;;;AAmBA,MAAM,0BAAkE,CAAC;AAAA,EACvE,OAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACG,GAAA,IAAA;AACL,CAAM,KAAA;AACJ,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA;AAAA,IAAuB,OAAA;AAAA,IAAkB,QAAA;AAAA,IAAoB,KAAA;AAAA,GAAA,kBAC3D,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA;AAAA,IAAe,QAAA;AAAA,IAAqB,GAAG,IAAA;AAAA,GAAA,EACrC,QACH,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -2,22 +2,6 @@ import currency from 'currency.js';
2
2
  import { useCallback, useState } from 'react';
3
3
  import { extractNumbersFromString } from '../../../../utils/extractNumbersFromString.js';
4
4
 
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
5
  const DEFAULT_OPTIONS = {
22
6
  symbol: "R$ ",
23
7
  separator: ".",
@@ -26,7 +10,7 @@ const DEFAULT_OPTIONS = {
26
10
  };
27
11
  const getRegex = (precision) => new RegExp(`\\B(?=(\\d{${precision}})(?!\\d))`, "g");
28
12
  const getInternalNumberAndMask = (value, options) => {
29
- const mergedOptions = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options);
13
+ const mergedOptions = { ...DEFAULT_OPTIONS, ...options };
30
14
  const { precision = -1 } = mergedOptions;
31
15
  let internalNumber;
32
16
  if (typeof value === "number") {
@@ -1 +1 @@
1
- {"version":3,"file":"useNumberMask.js","sources":["../../../../../../src/components/atoms/Input/hooks/useNumberMask.ts"],"sourcesContent":["import currency from 'currency.js';\nimport { useCallback, useState } from 'react';\nimport { extractNumbersFromString } from '../../../../utils/extractNumbersFromString';\nimport { MaskValue } from './useStringMask';\n\nexport type CurrencyOptions = currency.Options;\n\nconst DEFAULT_OPTIONS: CurrencyOptions = {\n symbol: 'R$ ',\n separator: '.',\n decimal: ',',\n precision: 2,\n};\n\nconst getRegex = (precision: number) =>\n new RegExp(`\\\\B(?=(\\\\d{${precision}})(?!\\\\d))`, 'g');\n\nexport const getInternalNumberAndMask = (\n value: string | number,\n options?: CurrencyOptions\n): { internalNumber: number; mergedOptions: CurrencyOptions } => {\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const { precision = -1 } = mergedOptions;\n\n let internalNumber;\n\n if (typeof value === 'number') {\n if (precision) {\n let stringValue = String(value);\n const decimalIndex = stringValue.indexOf('.');\n const currentPrecision = decimalIndex + precision;\n if (decimalIndex !== -1 && currentPrecision <= stringValue.length) {\n const zeros = stringValue.length + 1 - currentPrecision;\n for (let i = 0; i < zeros; i++) stringValue = stringValue + `0`;\n }\n internalNumber = Number(stringValue);\n } else {\n internalNumber = value;\n }\n } else {\n const onlyNumbers = String(extractNumbersFromString(value));\n const padZeros = String(onlyNumbers).padStart(precision + 1, '0');\n internalNumber = Number(padZeros.replace(getRegex(precision), '.'));\n }\n\n if (internalNumber > Number.MAX_SAFE_INTEGER) {\n internalNumber = Number.MAX_SAFE_INTEGER;\n }\n\n if (internalNumber < Number.MIN_SAFE_INTEGER) {\n internalNumber = Number.MIN_SAFE_INTEGER;\n }\n\n return {\n internalNumber,\n mergedOptions,\n };\n};\n\n/**\n * TODO:\n * @param options\n * @param defaultValue\n * @returns\n */\nexport const useNumberMask = (\n options?: CurrencyOptions,\n defaultValue?: string | number\n): [MaskValue, (value: string | number) => void] => {\n const applyMask = useCallback(\n (value: string | number = 0): MaskValue => {\n const { internalNumber, mergedOptions } = getInternalNumberAndMask(\n value,\n options\n );\n\n return {\n raw: internalNumber,\n formatted: currency(internalNumber).format(mergedOptions),\n };\n },\n [options, getRegex]\n );\n\n const [value, setValue] = useState<MaskValue>(applyMask(defaultValue));\n\n const handleChangeValue = useCallback(\n (formattedValue: string | number) => {\n const { raw, formatted } = applyMask(formattedValue);\n setValue({\n raw,\n formatted,\n });\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,MAAM,eAAmC,GAAA;AAAA,EACvC,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,GAAA;AAAA,EACX,OAAS,EAAA,GAAA;AAAA,EACT,SAAW,EAAA,CAAA;AACb,CAAA,CAAA;AAEA,MAAM,WAAW,CAAC,SAAA,KAChB,IAAI,MAAO,CAAA,CAAA,WAAA,EAAc,uBAAuB,GAAG,CAAA,CAAA;AAExC,MAAA,wBAAA,GAA2B,CACtC,KAAA,EACA,OAC+D,KAAA;AAC/D,EAAM,MAAA,aAAA,GAAgB,kCAAK,eAAoB,CAAA,EAAA,OAAA,CAAA,CAAA;AAC/C,EAAM,MAAA,EAAE,SAAY,GAAA,CAAA,CAAA,EAAO,GAAA,aAAA,CAAA;AAE3B,EAAI,IAAA,cAAA,CAAA;AAEJ,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAA,IAAI,SAAW,EAAA;AACb,MAAI,IAAA,WAAA,GAAc,OAAO,KAAK,CAAA,CAAA;AAC9B,MAAM,MAAA,YAAA,GAAe,WAAY,CAAA,OAAA,CAAQ,GAAG,CAAA,CAAA;AAC5C,MAAA,MAAM,mBAAmB,YAAe,GAAA,SAAA,CAAA;AACxC,MAAA,IAAI,YAAiB,KAAA,CAAA,CAAA,IAAM,gBAAoB,IAAA,WAAA,CAAY,MAAQ,EAAA;AACjE,QAAM,MAAA,KAAA,GAAQ,WAAY,CAAA,MAAA,GAAS,CAAI,GAAA,gBAAA,CAAA;AACvC,QAAS,KAAA,IAAA,CAAA,GAAI,CAAG,EAAA,CAAA,GAAI,KAAO,EAAA,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AAC,SAAS,QAAQ,CAAA;AAAA,GACpB,CAAA;AAEA,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,IAAI,QAAoB,CAAA,SAAA,CAAU,YAAY,CAAC,CAAA,CAAA;AAErE,EAAA,MAAM,iBAAoB,GAAA,WAAA;AAAA,IACxB,CAAC,cAAoC,KAAA;AACnC,MAAA,MAAM,EAAE,GAAA,EAAK,SAAU,EAAA,GAAI,UAAU,cAAc,CAAA,CAAA;AACnD,MAAS,QAAA,CAAA;AAAA,QACP,GAAA;AAAA,QACA,SAAA;AAAA,OACD,CAAA,CAAA;AAAA,KACH;AAAA,IACA,CAAC,WAAW,QAAQ,CAAA;AAAA,GACtB,CAAA;AAEA,EAAO,OAAA,CAAC,OAAO,iBAAiB,CAAA,CAAA;AAClC;;;;"}
1
+ {"version":3,"file":"useNumberMask.js","sources":["../../../../../../src/components/atoms/Input/hooks/useNumberMask.ts"],"sourcesContent":["import currency from 'currency.js';\nimport { useCallback, useState } from 'react';\nimport { extractNumbersFromString } from '../../../../utils/extractNumbersFromString';\nimport { MaskValue } from './useStringMask';\n\nexport type CurrencyOptions = currency.Options;\n\nconst DEFAULT_OPTIONS: CurrencyOptions = {\n symbol: 'R$ ',\n separator: '.',\n decimal: ',',\n precision: 2,\n};\n\nconst getRegex = (precision: number) =>\n new RegExp(`\\\\B(?=(\\\\d{${precision}})(?!\\\\d))`, 'g');\n\nexport const getInternalNumberAndMask = (\n value: string | number,\n options?: CurrencyOptions\n): { internalNumber: number; mergedOptions: CurrencyOptions } => {\n const mergedOptions = { ...DEFAULT_OPTIONS, ...options };\n const { precision = -1 } = mergedOptions;\n\n let internalNumber;\n\n if (typeof value === 'number') {\n if (precision) {\n let stringValue = String(value);\n const decimalIndex = stringValue.indexOf('.');\n const currentPrecision = decimalIndex + precision;\n if (decimalIndex !== -1 && currentPrecision <= stringValue.length) {\n const zeros = stringValue.length + 1 - currentPrecision;\n for (let i = 0; i < zeros; i++) stringValue = stringValue + `0`;\n }\n internalNumber = Number(stringValue);\n } else {\n internalNumber = value;\n }\n } else {\n const onlyNumbers = String(extractNumbersFromString(value));\n const padZeros = String(onlyNumbers).padStart(precision + 1, '0');\n internalNumber = Number(padZeros.replace(getRegex(precision), '.'));\n }\n\n if (internalNumber > Number.MAX_SAFE_INTEGER) {\n internalNumber = Number.MAX_SAFE_INTEGER;\n }\n\n if (internalNumber < Number.MIN_SAFE_INTEGER) {\n internalNumber = Number.MIN_SAFE_INTEGER;\n }\n\n return {\n internalNumber,\n mergedOptions,\n };\n};\n\n/**\n * TODO:\n * @param options\n * @param defaultValue\n * @returns\n */\nexport const useNumberMask = (\n options?: CurrencyOptions,\n defaultValue?: string | number\n): [MaskValue, (value: string | number) => void] => {\n const applyMask = useCallback(\n (value: string | number = 0): MaskValue => {\n const { internalNumber, mergedOptions } = getInternalNumberAndMask(\n value,\n options\n );\n\n return {\n raw: internalNumber,\n formatted: currency(internalNumber).format(mergedOptions),\n };\n },\n [options, getRegex]\n );\n\n const [value, setValue] = useState<MaskValue>(applyMask(defaultValue));\n\n const handleChangeValue = useCallback(\n (formattedValue: string | number) => {\n const { raw, formatted } = applyMask(formattedValue);\n setValue({\n raw,\n formatted,\n });\n },\n [applyMask, setValue]\n );\n\n return [value, handleChangeValue];\n};\n"],"names":["value"],"mappings":";;;;AAOA,MAAM,eAAmC,GAAA;AAAA,EACvC,MAAQ,EAAA,KAAA;AAAA,EACR,SAAW,EAAA,GAAA;AAAA,EACX,OAAS,EAAA,GAAA;AAAA,EACT,SAAW,EAAA,CAAA;AACb,CAAA,CAAA;AAEA,MAAM,WAAW,CAAC,SAAA,KAChB,IAAI,MAAO,CAAA,CAAA,WAAA,EAAc,uBAAuB,GAAG,CAAA,CAAA;AAExC,MAAA,wBAAA,GAA2B,CACtC,KAAA,EACA,OAC+D,KAAA;AAC/D,EAAA,MAAM,aAAgB,GAAA,EAAE,GAAG,eAAA,EAAiB,GAAG,OAAQ,EAAA,CAAA;AACvD,EAAM,MAAA,EAA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