@majoo-ui/react 2.0.1 → 2.1.0-rc.1

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 (202) hide show
  1. package/charts.esm.js +3 -1453
  2. package/colors/Colors.esm.js +93 -0
  3. package/components/accordion/Accordion.esm.js +109 -0
  4. package/components/alertDialog/AlertDialog.esm.js +440 -0
  5. package/components/avatar/Avatar.esm.js +83 -0
  6. package/components/badge/Badge.esm.js +255 -0
  7. package/components/banner/Banner.esm.js +341 -0
  8. package/components/barChart/BarChart.esm.js +212 -0
  9. package/components/breadcrumb/Breadcrumb.esm.js +65 -0
  10. package/components/breadcrumb/index.esm.js +19 -0
  11. package/components/button/Button.esm.js +331 -0
  12. package/components/buttonGroup/ButtonGroup.esm.js +350 -0
  13. package/components/card/Card.esm.js +236 -0
  14. package/components/chart/assets/data_kosong.png.esm.js +3 -0
  15. package/components/chart/lineChart/LineChart.esm.js +358 -0
  16. package/components/chart/lineChart/components/Comparator.esm.js +82 -0
  17. package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
  18. package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
  19. package/components/chart/lineChart/components/ProductList.esm.js +78 -0
  20. package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
  21. package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
  22. package/components/chart/utils/index.esm.js +109 -0
  23. package/components/checkboxTable/CheckboxTable.esm.js +287 -0
  24. package/components/colorPicker/ColorPicker.esm.js +342 -0
  25. package/components/colorPicker/InputColorPicker.esm.js +120 -0
  26. package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
  27. package/components/colorPicker/components/ColorFields.esm.js +144 -0
  28. package/components/colorPicker/components/ColorMap.esm.js +1188 -0
  29. package/components/contentEditor/ContentEditor.esm.js +251 -0
  30. package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
  31. package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
  32. package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
  33. package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
  34. package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
  35. package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
  36. package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
  37. package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
  38. package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
  39. package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
  40. package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
  41. package/components/contextMenu/ContextMenu.esm.js +298 -0
  42. package/components/datePicker/AdvancedOption.esm.js +37 -0
  43. package/components/datePicker/CustomDatePicker.esm.js +121 -0
  44. package/components/datePicker/DatePicker.esm.js +244 -0
  45. package/components/datePicker/DatePickerMulti.esm.js +70 -0
  46. package/components/datePicker/InputDatePicker.esm.js +290 -0
  47. package/components/datePicker/InputDateRangePicker.esm.js +174 -0
  48. package/components/datePicker/components/Calendar.esm.js +654 -0
  49. package/components/datePicker/components/CalendarMulti.esm.js +407 -0
  50. package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
  51. package/components/datePicker/components/DateNumber.esm.js +89 -0
  52. package/components/datePicker/components/MobileCalendar.esm.js +522 -0
  53. package/components/datePicker/state/reducer.esm.js +286 -0
  54. package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
  55. package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
  56. package/components/devicePreview/DevicePreview.esm.js +631 -0
  57. package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
  58. package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
  59. package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
  60. package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
  61. package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
  62. package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
  63. package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
  64. package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
  65. package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
  66. package/components/dialog/Dialog.esm.js +106 -0
  67. package/components/drawer/Drawer.esm.js +294 -0
  68. package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
  69. package/components/editableTable/EditableMobile.esm.js +361 -0
  70. package/components/editableTable/EditableTable.esm.js +618 -0
  71. package/components/editableTable/transition.esm.js +37 -0
  72. package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
  73. package/components/form/components/FormHelper/Helper.esm.js +50 -0
  74. package/components/form/components/FormLabel/Label.esm.js +90 -0
  75. package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
  76. package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
  77. package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
  78. package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
  79. package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
  80. package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
  81. package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
  82. package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
  83. package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
  84. package/components/form/components/InputElement/InputElement.esm.js +35 -0
  85. package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
  86. package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
  87. package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
  88. package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
  89. package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
  90. package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
  91. package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
  92. package/components/form/components/InputRadio/context.esm.js +5 -0
  93. package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
  94. package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
  95. package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
  96. package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
  97. package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
  98. package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
  99. package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
  100. package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
  101. package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
  102. package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
  103. package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
  104. package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
  105. package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
  106. package/components/form/components/InputTags/InputTags.esm.js +268 -0
  107. package/components/form/components/InputText/InputText.esm.js +197 -0
  108. package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
  109. package/components/heading/Heading.esm.js +64 -0
  110. package/components/iconButton/IconButton.esm.js +71 -0
  111. package/components/image/Image.esm.js +141 -0
  112. package/components/link/Link.esm.js +59 -0
  113. package/components/loadingBar/LoadingBar.esm.js +113 -0
  114. package/components/mapPicker/InputMapPicker.esm.js +160 -0
  115. package/components/mapPicker/MapPicker.esm.js +122 -0
  116. package/components/mapPicker/MapPicker.styles.esm.js +70 -0
  117. package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
  118. package/components/mapPicker/components/AddressCard.esm.js +25 -0
  119. package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
  120. package/components/mapPicker/components/ChangeView.esm.js +20 -0
  121. package/components/mapPicker/components/InputSearch.esm.js +74 -0
  122. package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
  123. package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
  124. package/components/mapPicker/components/ZoomControls.esm.js +36 -0
  125. package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
  126. package/components/modalDialog/ModalDialog.esm.js +247 -0
  127. package/components/notificationBadge/NotificationBadge.esm.js +149 -0
  128. package/components/pageDialog/PageDialog.esm.js +291 -0
  129. package/components/pageDialog/logo.svg.esm.js +3 -0
  130. package/components/pagination/Pagination.esm.js +94 -0
  131. package/components/pagination/PaginationButton.esm.js +346 -0
  132. package/components/pagination/PaginationInfo.esm.js +146 -0
  133. package/components/paper/Paper.esm.js +76 -0
  134. package/components/paragraph/Paragraph.esm.js +52 -0
  135. package/components/pieChart/PieChart.esm.js +287 -0
  136. package/components/popover/Popover.esm.js +142 -0
  137. package/components/progress/Progress.esm.js +170 -0
  138. package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
  139. package/components/scrollSync/ScrollSync.esm.js +172 -0
  140. package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
  141. package/components/scrollSync/utils.esm.js +9 -0
  142. package/components/separator/Separator.esm.js +43 -0
  143. package/components/skeleton/Skeleton.esm.js +131 -0
  144. package/components/slider/Slider.esm.js +345 -0
  145. package/components/stepWizard/StepWizard.esm.js +451 -0
  146. package/components/stepWizard/index.esm.js +14 -0
  147. package/components/table/MobileTable.esm.js +415 -0
  148. package/components/table/Table.esm.js +1472 -0
  149. package/components/table/components/columns/DateColumn.esm.js +26 -0
  150. package/components/table/components/columns/DecimalColumn.esm.js +36 -0
  151. package/components/table/components/columns/PriceColumn.esm.js +57 -0
  152. package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
  153. package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
  154. package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
  155. package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
  156. package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
  157. package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
  158. package/components/table/images/img-emptydata.webp.esm.js +3 -0
  159. package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
  160. package/components/tableOfContent/TableOfContent.esm.js +267 -0
  161. package/components/tableOfContent/index.esm.js +18 -0
  162. package/components/tableOfContent/transition.esm.js +38 -0
  163. package/components/tabs/Tabs.esm.js +282 -0
  164. package/components/tag/Tag.esm.js +161 -0
  165. package/components/tagList/TagList.esm.js +90 -0
  166. package/components/tagStatus/TagStatus.esm.js +134 -0
  167. package/components/text/Text.esm.js +140 -0
  168. package/components/toast/Toast.esm.js +297 -0
  169. package/components/toast/ToastContainer.esm.js +73 -0
  170. package/components/toast/context/ToastContext.esm.js +5 -0
  171. package/components/toast/context/ToastProvider.esm.js +96 -0
  172. package/components/tooltip/Tooltip.esm.js +175 -0
  173. package/components/upload/Upload.esm.js +1103 -0
  174. package/components/upload/utils/canvasPreview.esm.js +39 -0
  175. package/components/upload/utils/imgPreview.esm.js +21 -0
  176. package/config/stitches.config.esm.js +216 -0
  177. package/editor.esm.js +1 -264
  178. package/hooks/useListOption/useListOption.esm.js +56 -0
  179. package/hooks/useToggle/useToggle.esm.js +8 -0
  180. package/index.esm.js +106 -42293
  181. package/layout/box/Box.esm.js +24 -0
  182. package/layout/flex/Flex.esm.js +135 -0
  183. package/layout/grid/Grid.esm.js +270 -0
  184. package/layout/pageContainer/PageContainer.esm.js +60 -0
  185. package/majoo-provider/MajooProvider.esm.js +42 -0
  186. package/majoo-provider/ThemeProvider.esm.js +41 -0
  187. package/majoo-provider/globalStyles.esm.js +242 -0
  188. package/majoo-provider/styles/modern-normalize.esm.js +95 -0
  189. package/map.esm.js +2 -734
  190. package/package.json +8 -4
  191. package/utils/calendar.esm.js +26 -0
  192. package/utils/element.esm.js +21 -0
  193. package/utils/object.esm.js +12 -0
  194. package/utils/request.esm.js +74 -0
  195. package/utils/strings.esm.js +6 -0
  196. package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
  197. package/utils/useNavigatorOnline.esm.js +19 -0
  198. package/utils/variant.esm.js +12 -0
  199. package/wrapper/ConditionalWrapper.esm.js +9 -0
  200. package/ModalDialog.esm.js +0 -2669
  201. package/Separator.esm.js +0 -3002
  202. package/stitches.config.esm.js +0 -2284
@@ -0,0 +1,188 @@
1
+ import 'core-js/modules/es.iterator.constructor.js';
2
+ import 'core-js/modules/es.iterator.map.js';
3
+ import 'core-js/modules/es.iterator.some.js';
4
+ import React__default from 'react';
5
+ import { styled } from '../../../../config/stitches.config.esm.js';
6
+ import PropTypes from 'prop-types';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ const InputGroupStyle = styled('div', {
10
+ display: 'flex',
11
+ width: '100%',
12
+ position: 'relative',
13
+ alignItems: 'center',
14
+ '& > input:last-child': {
15
+ borderStartStartRadius: 0,
16
+ borderEndStartRadius: 0
17
+ },
18
+ '& > input:first-child': {
19
+ borderEndEndRadius: 0,
20
+ borderStartEndRadius: 0
21
+ },
22
+ '& > input:not(:first-child):not(:last-child)': {
23
+ borderRadius: 0
24
+ },
25
+ variants: {
26
+ readOnly: {
27
+ true: {
28
+ backgroundColor: '$formDisable'
29
+ }
30
+ },
31
+ disabled: {
32
+ true: {
33
+ backgroundColor: '$formDisable',
34
+ color: '$textDisable',
35
+ cursor: 'not-allowed',
36
+ '&::placeholder': {
37
+ color: '$textDisable'
38
+ },
39
+ '&:hover': {
40
+ border: '1px solid $bgOutline',
41
+ borderRadius: '$lg',
42
+ '& > .addon': {
43
+ border: '1px solid $bgOutline'
44
+ }
45
+ },
46
+ '& > input': {
47
+ color: '$textDisable !important',
48
+ cursor: 'not-allowed !important',
49
+ border: 'none !important',
50
+ '&:hover': {
51
+ border: 'none !important'
52
+ }
53
+ }
54
+ }
55
+ },
56
+ isInvalid: {
57
+ true: {
58
+ border: '1px solid $red400',
59
+ '&:focus': {
60
+ border: '1px solid $red400'
61
+ },
62
+ '&:hover': {
63
+ border: '1px solid $red400'
64
+ }
65
+ }
66
+ },
67
+ size: {
68
+ sm: {
69
+ height: 32
70
+ },
71
+ lg: {
72
+ height: 40
73
+ }
74
+ },
75
+ isElement: {
76
+ true: {
77
+ '& > input:last-child': {
78
+ paddingLeft: 0,
79
+ border: 'none',
80
+ backgroundColor: 'transparent'
81
+ },
82
+ '& > input:first-child': {
83
+ paddingRight: 0,
84
+ border: 'none',
85
+ backgroundColor: 'transparent'
86
+ },
87
+ '& > input:not(:first-child):not(:last-child)': {
88
+ paddingLeft: 0,
89
+ paddingRight: 0,
90
+ border: 'none',
91
+ backgroundColor: 'transparent'
92
+ }
93
+ }
94
+ },
95
+ isLetter: {
96
+ true: {
97
+ borderRadius: '$lg',
98
+ border: '1px solid $bgOutline',
99
+ '&:focus': {
100
+ border: '1px solid $primary400'
101
+ },
102
+ '&:active': {
103
+ border: '1px solid $primary400'
104
+ },
105
+ '&:hover': {
106
+ border: '1px solid $primary400'
107
+ },
108
+ '&:disabled': {
109
+ backgroundColor: '$formDisable',
110
+ color: '$textDisable',
111
+ cursor: 'not-allowed',
112
+ '&::placeholder': {
113
+ color: '$textDisable'
114
+ },
115
+ '&:hover': {
116
+ border: '1px solid $bgOutline'
117
+ }
118
+ }
119
+ }
120
+ },
121
+ mobileOnly: {
122
+ true: {
123
+ '@lg': {
124
+ display: 'none !important'
125
+ }
126
+ }
127
+ },
128
+ desktopOnly: {
129
+ true: {
130
+ display: 'none !important',
131
+ '@lg': {
132
+ display: 'flex !important'
133
+ }
134
+ }
135
+ }
136
+ },
137
+ defaultVariants: {
138
+ isLetter: false,
139
+ size: 'lg'
140
+ }
141
+ });
142
+ const InputGroup = ({
143
+ children,
144
+ size = 'lg',
145
+ ...rest
146
+ }) => {
147
+ const isLetter = children.some(child => child && (child.type.name === 'InputPrefix' || child.type.name === 'InputSuffix' || child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
148
+ const isElement = children.some(child => child && (child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
149
+ const clone = children.map((child, index) => {
150
+ if (child === null) return null;
151
+ return isLetter ? child.type.name === 'InputText' ? /*#__PURE__*/React__default.cloneElement(child, {
152
+ inputGroup: true,
153
+ size: size,
154
+ key: index
155
+ }) : /*#__PURE__*/React__default.cloneElement(child, {
156
+ size: size,
157
+ key: index
158
+ }) : /*#__PURE__*/React__default.cloneElement(child, {
159
+ size: size,
160
+ key: index
161
+ });
162
+ });
163
+ return /*#__PURE__*/jsx(InputGroupStyle, {
164
+ ...rest,
165
+ children: clone,
166
+ isLetter: isLetter,
167
+ size: size,
168
+ isElement: isElement
169
+ });
170
+ };
171
+ InputGroup.propTypes = {
172
+ /**
173
+ Adjust Input Text Size
174
+ */
175
+ size: PropTypes.oneOf(['sm', 'lg']),
176
+ /**
177
+ Children must be InputText, InputAddon, or InputPrefixes
178
+ */
179
+ children: PropTypes.node.isRequired,
180
+ /** Error state */
181
+ isInvalid: PropTypes.bool,
182
+ /** read-only state */
183
+ readOnly: PropTypes.bool,
184
+ /** disabled state */
185
+ disabled: PropTypes.bool
186
+ };
187
+
188
+ export { InputGroup };
@@ -0,0 +1,68 @@
1
+ import 'react';
2
+ import { styled } from '../../../../config/stitches.config.esm.js';
3
+ import Text from '../../../text/Text.esm.js';
4
+ import PropTypes from 'prop-types';
5
+
6
+ const InputLetter = styled(Text, {
7
+ flex: '0 0 auto',
8
+ width: 'auto',
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ padding: '6px $spacing-05',
12
+ variants: {
13
+ size: {
14
+ sm: {
15
+ height: 32
16
+ },
17
+ lg: {
18
+ height: 40
19
+ }
20
+ },
21
+ color: {
22
+ primary: {
23
+ color: '$iconPrimary'
24
+ },
25
+ disabled: {
26
+ color: '$iconDisable'
27
+ }
28
+ }
29
+ },
30
+ defaultVariants: {
31
+ size: 'lg',
32
+ color: 'primary'
33
+ }
34
+ });
35
+ const InputPrefix = styled(InputLetter, {
36
+ padding: '6px 0px 6px $spacing-05',
37
+ defaultVariants: {
38
+ variant: 'placeholder',
39
+ color: 'secondary',
40
+ as: 'div'
41
+ }
42
+ });
43
+ InputPrefix.name = 'InputPrefix';
44
+ InputPrefix.displayName = 'InputPrefix';
45
+ InputPrefix.defaultProps = {
46
+ as: 'div'
47
+ };
48
+ InputPrefix.propTypes = {
49
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
50
+ };
51
+ const InputSuffix = styled(InputLetter, {
52
+ padding: '6px $spacing-05 6px 0px',
53
+ defaultVariants: {
54
+ variant: 'placeholder',
55
+ color: 'secondary',
56
+ as: 'div'
57
+ }
58
+ });
59
+ InputSuffix.name = 'InputSuffix';
60
+ InputSuffix.displayName = 'InputSuffix';
61
+ InputSuffix.defaultProps = {
62
+ as: 'div'
63
+ };
64
+ InputSuffix.propTypes = {
65
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
66
+ };
67
+
68
+ export { InputPrefix, InputSuffix };
@@ -0,0 +1,248 @@
1
+ import React__default, { cloneElement } from 'react';
2
+ import { styled } from '../../../../config/stitches.config.esm.js';
3
+ import PropTypes from 'prop-types';
4
+ import NumberFormat from './NumberFormat.esm.js';
5
+ import { Controller } from 'react-hook-form';
6
+ import { ConditionalWrapper } from '../../../../wrapper/ConditionalWrapper.esm.js';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ const StyledInput = styled(NumberFormat, {
10
+ // Reset
11
+ appearance: 'none',
12
+ boxSizing: 'border-box',
13
+ fontFamily: 'inherit',
14
+ margin: '0',
15
+ outline: 'none',
16
+ width: '100%',
17
+ WebkitTapHighlightColor: 'rgba(0,0,0,0)',
18
+ '&::before': {
19
+ boxSizing: 'border-box'
20
+ },
21
+ '&::after': {
22
+ boxSizing: 'border-box'
23
+ },
24
+ // Custom
25
+ background: 'none',
26
+ color: '$textPrimary',
27
+ fontVariantNumeric: 'tabular-nums',
28
+ fontSize: '$short-content-regular',
29
+ letterSpacing: '$short-content-regular',
30
+ lineHeight: '$short-content-regular',
31
+ fontWeight: '400',
32
+ padding: '10px $spacing-05',
33
+ border: '1px solid $bgOutline',
34
+ borderRadius: '$lg',
35
+ '&:focus': {
36
+ border: '1px solid $colors$primary400'
37
+ },
38
+ '&:active': {
39
+ border: '1px solid $colors$primary400'
40
+ },
41
+ '&:hover': {
42
+ border: '1px solid $colors$primary600'
43
+ },
44
+ '&:disabled': {
45
+ backgroundColor: '$formDisable',
46
+ color: '$textDisable',
47
+ cursor: 'not-allowed',
48
+ '&::placeholder': {
49
+ color: '$textDisable'
50
+ },
51
+ '&:hover': {
52
+ border: '1px solid $colors$gray300'
53
+ }
54
+ },
55
+ '&::placeholder': {
56
+ color: '$textDisable'
57
+ },
58
+ compoundVariants: [{
59
+ inputGroup: true,
60
+ isInvalid: true,
61
+ css: {
62
+ border: 'none',
63
+ '&:focus': {
64
+ border: 'none'
65
+ },
66
+ '&:hover': {
67
+ border: 'none'
68
+ }
69
+ }
70
+ }, {
71
+ asChild: true,
72
+ isInvalid: true,
73
+ css: {
74
+ border: 'none',
75
+ '&:focus': {
76
+ border: 'none'
77
+ },
78
+ '&:hover': {
79
+ border: 'none'
80
+ }
81
+ }
82
+ }],
83
+ variants: {
84
+ isReadOnly: {
85
+ true: {
86
+ backgroundColor: '$formDisable'
87
+ }
88
+ },
89
+ inputGroup: {
90
+ true: {
91
+ border: 'none',
92
+ borderRadius: '$lg',
93
+ '&:focus': {
94
+ border: 'none'
95
+ },
96
+ '&:active': {
97
+ border: 'none'
98
+ },
99
+ '&:hover': {
100
+ border: 'none'
101
+ },
102
+ '&:disabled': {
103
+ backgroundColor: 'transparent',
104
+ color: '$textDisable',
105
+ cursor: 'default',
106
+ '&::placeholder': {
107
+ color: '$textDisable'
108
+ },
109
+ '&:hover': {
110
+ border: '1px solid $colors$gray300'
111
+ }
112
+ }
113
+ }
114
+ },
115
+ asChild: {
116
+ true: {
117
+ paddingLeft: 0,
118
+ paddingRight: 0,
119
+ border: 'none',
120
+ borderRadius: '$lg',
121
+ '&:focus': {
122
+ border: 'none'
123
+ },
124
+ '&:active': {
125
+ border: 'none'
126
+ },
127
+ '&:hover': {
128
+ border: 'none'
129
+ },
130
+ '&:disabled': {
131
+ backgroundColor: 'transparent',
132
+ color: '$textDisable',
133
+ cursor: 'default',
134
+ '&::placeholder': {
135
+ color: '$textDisable'
136
+ },
137
+ '&:hover': {
138
+ border: 'none'
139
+ }
140
+ }
141
+ }
142
+ },
143
+ size: {
144
+ sm: {
145
+ height: 32
146
+ },
147
+ md: {
148
+ height: 36
149
+ },
150
+ lg: {
151
+ height: 40
152
+ }
153
+ },
154
+ isInvalid: {
155
+ true: {
156
+ border: '1px solid $colors$red400',
157
+ '&:focus': {
158
+ border: '1px solid $colors$red400'
159
+ },
160
+ '&:hover': {
161
+ border: '1px solid $colors$red400'
162
+ }
163
+ }
164
+ },
165
+ isPicker: {
166
+ true: {
167
+ fontSize: '$placeholder',
168
+ letterSpacing: '$placeholder',
169
+ lineHeight: '$placeholder',
170
+ fontVariantNumeric: 'unset',
171
+ caretColor: 'transparent',
172
+ cursor: 'pointer',
173
+ padding: '0'
174
+ }
175
+ }
176
+ },
177
+ defaultVariants: {
178
+ size: 'lg'
179
+ }
180
+ });
181
+ function countThousandSeparatorsByLength(numberLength) {
182
+ const separatorCount = Math.floor((numberLength - 1) / 3);
183
+ return separatorCount;
184
+ }
185
+ function getMaxValueLength(maxValue, prefix = '', suffix = '', thousandSeparator) {
186
+ const tsLength = thousandSeparator ? countThousandSeparatorsByLength(maxValue) : 0;
187
+ return maxValue + prefix?.length + suffix?.length + tsLength;
188
+ }
189
+ const InputNumber = /*#__PURE__*/React__default.forwardRef(({
190
+ placeholder,
191
+ value,
192
+ size,
193
+ isInvalid,
194
+ readOnly,
195
+ disabled,
196
+ control,
197
+ name,
198
+ maxValueLength,
199
+ maxLength,
200
+ thousandSeparator,
201
+ ...props
202
+ }, ref) => /*#__PURE__*/jsx(ConditionalWrapper, {
203
+ condition: Boolean(control),
204
+ wrapper: child => /*#__PURE__*/jsx(Controller, {
205
+ control: control,
206
+ name: name,
207
+ render: ({
208
+ field: {
209
+ name: controlName,
210
+ ref: controlRef
211
+ }
212
+ }) => /*#__PURE__*/cloneElement(child, {
213
+ ref,
214
+ getInputRef: controlRef,
215
+ name: controlName
216
+ })
217
+ }),
218
+ children: /*#__PURE__*/jsx(StyledInput, {
219
+ ref: ref,
220
+ placeholder: placeholder,
221
+ value: value,
222
+ size: size,
223
+ isInvalid: isInvalid,
224
+ readOnly: readOnly,
225
+ isReadOnly: readOnly && !props?.inputGroup && !props?.asChild,
226
+ disabled: disabled,
227
+ maxLength: maxValueLength ? getMaxValueLength(maxValueLength, props?.prefix, props?.suffix, thousandSeparator) : maxLength,
228
+ thousandSeparator: thousandSeparator,
229
+ ...props
230
+ })
231
+ }));
232
+ InputNumber.propTypes = {
233
+ placeholder: PropTypes.string,
234
+ value: PropTypes.string,
235
+ size: PropTypes.oneOf(['sm', 'lg']),
236
+ isInvalid: PropTypes.bool,
237
+ readOnly: PropTypes.bool,
238
+ disabled: PropTypes.bool
239
+ };
240
+ InputNumber.defaultProps = {
241
+ size: 'lg',
242
+ thousandSeparator: '.',
243
+ decimalSeparator: ','
244
+ };
245
+ InputNumber.name = 'InputText';
246
+ InputNumber.displayName = 'InputNumber';
247
+
248
+ export { InputNumber };