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

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 (203) 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
  203. package/{index.esm.css → charts.esm.css} +4 -4
@@ -0,0 +1,169 @@
1
+ import 'core-js/modules/es.iterator.constructor.js';
2
+ import 'core-js/modules/es.iterator.filter.js';
3
+ import 'core-js/modules/es.iterator.map.js';
4
+ import { __rest } from 'tslib';
5
+ import * as React from 'react';
6
+ import { useState, useRef, useLayoutEffect, createElement } from 'react';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+ import { useCombobox } from 'downshift';
9
+ import { SelectContainer, SelectBox, OptionWrapper, SelectOption, SelectItem, Input } from '../InputSelect/InputSelect.esm.js';
10
+ import { Portal } from '@majoo-ui/helpers';
11
+ import { InputGroup } from '../InputGroup/InputGroup.esm.js';
12
+ import { InputLeftElement, InputRightElement } from '../InputElement/InputElement.esm.js';
13
+ import { SearchOutline, CloseFilled } from '@majoo-ui/icons';
14
+ import { Popover, PopoverTrigger, PopoverContent } from '../../../popover/Popover.esm.js';
15
+
16
+ const SelectInputSearch = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
17
+ var {
18
+ showLeadingIcon = false,
19
+ showClearIcon = true,
20
+ disabled,
21
+ placeholder,
22
+ readOnly,
23
+ inputProps,
24
+ handleInputValue,
25
+ noStyling,
26
+ onChange
27
+ } = _a,
28
+ props = __rest(_a, ["showLeadingIcon", "showClearIcon", "disabled", "placeholder", "readOnly", "inputProps", "handleInputValue", "noStyling", "onChange"]);
29
+ const inputRef = React.useRef(null);
30
+ return jsxs(InputGroup, {
31
+ css: !noStyling && {
32
+ height: '100%',
33
+ border: 'none',
34
+ '&:hover': {
35
+ border: 'none'
36
+ }
37
+ },
38
+ disabled: disabled,
39
+ children: [jsx(InputLeftElement, {
40
+ children: showLeadingIcon && jsx(SearchOutline, {}),
41
+ css: !showLeadingIcon ? {
42
+ width: '$spacing-05',
43
+ padding: 0
44
+ } : undefined
45
+ }), jsx(Input, Object.assign({}, inputProps, props, {
46
+ placeholder: placeholder,
47
+ readOnly: readOnly,
48
+ isReadOnly: readOnly,
49
+ ref: node => {
50
+ if (forwardedRef) {
51
+ if (typeof forwardedRef === 'function') forwardedRef(node);else forwardedRef.current = node;
52
+ }
53
+ inputRef.current = node;
54
+ },
55
+ disabled: disabled,
56
+ css: {
57
+ marginLeft: 0,
58
+ height: 'fit-content'
59
+ }
60
+ })), jsx(InputRightElement, {
61
+ children: showClearIcon && (inputProps.value || '').length > 0 && !disabled ? jsx(CloseFilled, {}) : jsx("div", {}),
62
+ onClick: e => {
63
+ if (!disabled) {
64
+ inputProps.onChange(Object.assign(Object.assign({}, e), {
65
+ target: Object.assign(Object.assign({}, e.target), {
66
+ value: ''
67
+ })
68
+ }));
69
+ if (handleInputValue) handleInputValue('');
70
+ if (inputRef.current) inputRef.current.focus();
71
+ }
72
+ }
73
+ })]
74
+ });
75
+ });
76
+ const InputCombobox = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
77
+ var {
78
+ options: items = [],
79
+ defaultValue,
80
+ disabled,
81
+ placeholder = 'Select Item',
82
+ showLeadingIcon = false,
83
+ placement = 'bottom',
84
+ size = 'lg',
85
+ isInvalid,
86
+ css,
87
+ onValueChange
88
+ } = _a,
89
+ props = __rest(_a, ["options", "defaultValue", "disabled", "placeholder", "showLeadingIcon", "placement", "size", "isInvalid", "css", "onValueChange"]);
90
+ const [inputItems, setInputItems] = useState(items);
91
+ const [openOptions, setOpenOptions] = useState(false);
92
+ const selectBoxRef = useRef(null);
93
+ const [optionsWidth, setOptionsWidth] = useState(0);
94
+ useLayoutEffect(() => {
95
+ var _a, _b;
96
+ setOptionsWidth((_b = (_a = selectBoxRef === null || selectBoxRef === void 0 ? void 0 : selectBoxRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0);
97
+ }, [selectBoxRef]);
98
+ const {
99
+ isOpen,
100
+ getMenuProps,
101
+ getInputProps,
102
+ getComboboxProps,
103
+ highlightedIndex,
104
+ getItemProps
105
+ } = useCombobox({
106
+ items: inputItems,
107
+ defaultInputValue: defaultValue,
108
+ onInputValueChange: ({
109
+ inputValue = ''
110
+ }) => {
111
+ if (onValueChange) onValueChange(inputValue);
112
+ setInputItems(items.filter(item => item.toLowerCase().startsWith(inputValue.toLowerCase())));
113
+ }
114
+ });
115
+ return jsx(Popover, {
116
+ open: openOptions || isOpen,
117
+ onOpenChange: setOpenOptions,
118
+ placement: placement,
119
+ hideOnScroll: true,
120
+ children: jsxs(SelectContainer, {
121
+ css: css,
122
+ ref: selectBoxRef,
123
+ children: [jsx(PopoverTrigger, {
124
+ children: jsx(SelectBox, Object.assign({}, getComboboxProps(), {
125
+ size: size,
126
+ disabled: disabled,
127
+ isInvalid: isInvalid,
128
+ children: jsx(SelectInputSearch, Object.assign({
129
+ showLeadingIcon: showLeadingIcon,
130
+ disabled: disabled,
131
+ placeholder: placeholder,
132
+ inputProps: getInputProps({}, {
133
+ suppressRefError: true
134
+ })
135
+ }, props, {
136
+ ref: forwardedRef
137
+ }))
138
+ }))
139
+ }), jsx(Portal, {
140
+ children: jsx(PopoverContent, {
141
+ style: {
142
+ width: optionsWidth
143
+ },
144
+ children: inputItems.length > 0 && jsx(OptionWrapper, Object.assign({}, getMenuProps(), {
145
+ css: {
146
+ display: isOpen ? 'block' : 'none',
147
+ pointerEvents: 'auto'
148
+ },
149
+ placement: placement,
150
+ children: jsx(SelectOption, {
151
+ children: inputItems.map((item, index) => (/*#__PURE__*/createElement(SelectItem, Object.assign({}, getItemProps({
152
+ item,
153
+ index
154
+ }), {
155
+ key: `${item}${index}`,
156
+ css: {
157
+ backgroundColor: highlightedIndex === index ? '$bgGray' : 'white',
158
+ fontWeight: 'normal'
159
+ }
160
+ }), item)))
161
+ })
162
+ }))
163
+ })
164
+ })]
165
+ })
166
+ });
167
+ });
168
+
169
+ export { InputCombobox };
@@ -0,0 +1,226 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useState, useEffect } from 'react';
3
+ import { Button as Button$1 } from '../../../button/Button.esm.js';
4
+ import Flex from '../../../../layout/flex/Flex.esm.js';
5
+ import { styled, colors } from '../../../../config/stitches.config.esm.js';
6
+ import { MinusOutline, PlusOutline } from '@majoo-ui/icons';
7
+ import { InputNumber } from '../InputNumber/InputNumber.esm.js';
8
+
9
+ const Input = styled(InputNumber, {
10
+ border: `1px solid $gray150`,
11
+ borderLeft: 'none',
12
+ borderRight: 'none',
13
+ borderRadius: 0,
14
+ textAlign: 'center',
15
+ fontSize: 16,
16
+ fontWeight: 600,
17
+ color: '$textPrimary',
18
+ userSelect: 'none',
19
+ '&:disabled': {
20
+ backgroundColor: '$btnDisable',
21
+ border: `1px solid $gray150`,
22
+ '&:hover': {
23
+ borderColor: '$gray150'
24
+ }
25
+ },
26
+ variants: {
27
+ disabledChange: {
28
+ true: {
29
+ backgroundColor: '$bgWhite !important',
30
+ border: `1px solid $gray150`,
31
+ color: '$textPrimary !important',
32
+ '&:hover': {
33
+ borderColor: '$gray150'
34
+ }
35
+ }
36
+ }
37
+ }
38
+ });
39
+ const Button = styled(Button$1, {
40
+ border: `1px solid $gray150 !important`,
41
+ paddingRight: '16px !important',
42
+ paddingLeft: '16px !important',
43
+ minWidth: '54px !important',
44
+ '&:hover': {
45
+ backgroundColor: '$primary50',
46
+ border: '1px solid $btnPrimary !important'
47
+ },
48
+ '&:active': {
49
+ backgroundColor: '$primary100',
50
+ border: '1px solid $btnPrimary !important'
51
+ },
52
+ '&:focus': {
53
+ outline: 0,
54
+ backgroundColor: '$primary50',
55
+ border: '1px solid $btnPrimary !important'
56
+ },
57
+ '&:disabled': {
58
+ '&:hover': {
59
+ borderColor: '$gray150 !important'
60
+ }
61
+ },
62
+ variants: {
63
+ counterType: {
64
+ minus: {
65
+ borderRight: 'none !important',
66
+ borderTopRightRadius: '0px !important',
67
+ borderBottomRightRadius: '0px !important',
68
+ '&:disabled': {
69
+ border: `1px solid $gray150 !important`
70
+ }
71
+ },
72
+ plus: {
73
+ borderLeft: 'none !important',
74
+ borderTopLeftRadius: '0px !important',
75
+ borderBottomLeftRadius: '0px !important',
76
+ '&:disabled': {
77
+ border: `1px solid $gray150 !important`
78
+ }
79
+ }
80
+ },
81
+ buttonSize: {
82
+ sm: {
83
+ height: '32px !important',
84
+ padding: '4px 16px !important'
85
+ },
86
+ md: {
87
+ height: '36px !important',
88
+ padding: '4px 16px !important'
89
+ },
90
+ lg: {
91
+ height: '40px !important',
92
+ padding: '7px 16px !important'
93
+ }
94
+ }
95
+ }
96
+ });
97
+ const InputCounter = /*#__PURE__*/forwardRef((props, ref) => {
98
+ var _a;
99
+ const {
100
+ css,
101
+ value,
102
+ onChange,
103
+ allowNegative,
104
+ min,
105
+ max,
106
+ disabled,
107
+ disabledIncrement,
108
+ disabledDecrement,
109
+ prefix,
110
+ suffix,
111
+ size,
112
+ disableManualInput,
113
+ step = 1,
114
+ decimalScale
115
+ } = props;
116
+ const [inputValue, setInputValue] = useState((_a = value !== null && value !== void 0 ? value : min) !== null && _a !== void 0 ? _a : 0);
117
+ useEffect(() => {
118
+ if (min && inputValue < min) {
119
+ setInputValue(min);
120
+ onChange === null || onChange === void 0 ? void 0 : onChange(min);
121
+ }
122
+ if (max && inputValue > max) {
123
+ setInputValue(max);
124
+ onChange === null || onChange === void 0 ? void 0 : onChange(max);
125
+ }
126
+ }, [inputValue, min, max, onChange]);
127
+ useEffect(() => {
128
+ if (value) {
129
+ setInputValue(value);
130
+ }
131
+ }, [value]);
132
+ /**
133
+ * Rounds a number to avoid floating-point precision issues.
134
+ */
135
+ function roundToDecimalScale(num) {
136
+ if (decimalScale === undefined) {
137
+ return Math.round(num);
138
+ }
139
+ const factor = Math.pow(10, decimalScale);
140
+ return Math.round(num * factor) / factor;
141
+ }
142
+ function handleUp() {
143
+ const newValue = roundToDecimalScale(inputValue + step);
144
+ if (!max || newValue <= max) {
145
+ setInputValue(newValue);
146
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
147
+ }
148
+ }
149
+ function handleDown() {
150
+ if (inputValue !== 0 || allowNegative) {
151
+ const newValue = roundToDecimalScale(inputValue - step);
152
+ if (!min || newValue >= min) {
153
+ setInputValue(newValue);
154
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
155
+ }
156
+ }
157
+ }
158
+ function handleChange(e) {
159
+ // Get the raw value and handle locale-specific decimal separator
160
+ // Indonesian locale uses comma (,) as decimal separator and dot (.) as thousands separator
161
+ let rawValue = e.target.value;
162
+ // Remove thousands separators (dots) and replace decimal separator (comma) with dot for parsing
163
+ rawValue = rawValue.replace(/\./g, '').replace(',', '.');
164
+ const parsedValue = parseFloat(rawValue);
165
+ // Only update if we have a valid number
166
+ if (!isNaN(parsedValue)) {
167
+ const roundedValue = roundToDecimalScale(parsedValue);
168
+ setInputValue(roundedValue);
169
+ onChange === null || onChange === void 0 ? void 0 : onChange(roundedValue);
170
+ } else if (rawValue === '' || rawValue === '-') {
171
+ // Handle empty input or just a negative sign
172
+ setInputValue(0);
173
+ onChange === null || onChange === void 0 ? void 0 : onChange(0);
174
+ }
175
+ }
176
+ return jsxs(Flex, {
177
+ direction: "row",
178
+ align: "center",
179
+ css: css,
180
+ children: [jsx(Button, {
181
+ type: "button",
182
+ disabled: disabled || disabledDecrement,
183
+ buttonType: "secondary",
184
+ buttonSize: size,
185
+ counterType: "minus",
186
+ icon: true,
187
+ onClick: handleDown,
188
+ children: jsx(MinusOutline, {
189
+ size: 24,
190
+ color: disabled || disabledDecrement ? colors.iconDisable : colors.primary500
191
+ })
192
+ }), jsx(Input, {
193
+ ref: ref,
194
+ disabled: disabled || disabledIncrement || disabledDecrement || disableManualInput,
195
+ disabledChange: disabledIncrement || disabledDecrement || disableManualInput,
196
+ value: inputValue,
197
+ allowNegative: allowNegative,
198
+ onChange: handleChange,
199
+ prefix: prefix,
200
+ suffix: suffix,
201
+ size: size,
202
+ decimalScale: decimalScale,
203
+ fixedDecimalScale: decimalScale !== undefined
204
+ }), jsx(Button, {
205
+ type: "button",
206
+ disabled: disabled || disabledIncrement,
207
+ buttonType: "secondary",
208
+ buttonSize: size,
209
+ counterType: "plus",
210
+ icon: true,
211
+ onClick: handleUp,
212
+ children: jsx(PlusOutline, {
213
+ size: 24,
214
+ color: disabled || disabledIncrement ? colors.iconDisable : colors.primary500
215
+ })
216
+ })]
217
+ });
218
+ });
219
+ InputCounter.defaultProps = {
220
+ allowNegative: false,
221
+ disabled: false,
222
+ size: 'lg',
223
+ step: 1
224
+ };
225
+
226
+ export { InputCounter as default };
@@ -0,0 +1,229 @@
1
+ import React__default from 'react';
2
+ import { CirclePlusOutline } from '@majoo-ui/icons';
3
+ import { colors, styled } from '../../../../config/stitches.config.esm.js';
4
+ import PropTypes from 'prop-types';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ const Wrapper = styled('div', {
9
+ margin: 0,
10
+ flexDirection: 'column',
11
+ display: 'block',
12
+ position: 'relative',
13
+ fontFamily: 'inherit',
14
+ fontVariantNumeric: 'tabular-nums',
15
+ fontSize: '$short-content-regular',
16
+ fontWeight: '400',
17
+ textAlign: 'left',
18
+ alignItems: 'center',
19
+ letterSpacing: '$short-content-regular',
20
+ lineHeight: '$short-content-regular',
21
+ color: '$textDisable',
22
+ width: '100%'
23
+ });
24
+ const InputWrapper = styled('div', {
25
+ display: 'flex',
26
+ position: 'relative',
27
+ flexWrap: 'wrap',
28
+ width: '100%',
29
+ margin: '0',
30
+ appearance: 'none',
31
+ backgroundolor: 'none',
32
+ boxSizing: 'border-box',
33
+ border: '1px solid $bgOutline',
34
+ borderRadius: '$md',
35
+ color: '$textPrimary',
36
+ lineHeight: '$short-content-regular',
37
+ fontSize: '$short-content-regular',
38
+ fontWeight: '400',
39
+ '&:focus-within': {
40
+ border: '1px solid $formActive'
41
+ },
42
+ '&:hover': {
43
+ border: '1px solid $gray500'
44
+ },
45
+ variants: {
46
+ disabled: {
47
+ true: {
48
+ backgroundColor: '$formDisable',
49
+ color: '$textDisable',
50
+ cursor: 'not-allowed',
51
+ '&:hover': {
52
+ border: '1px solid $formDefault'
53
+ }
54
+ }
55
+ },
56
+ size: {
57
+ sm: {
58
+ height: 'auto',
59
+ minheight: 32,
60
+ padding: '8px 16px'
61
+ },
62
+ lg: {
63
+ height: 'auto',
64
+ minheight: 40,
65
+ padding: '8px 16px'
66
+ }
67
+ },
68
+ isInvalid: {
69
+ true: {
70
+ border: '1px solid $formError',
71
+ '&:focus-within': {
72
+ border: '1px solid $formError'
73
+ },
74
+ '&:hover': {
75
+ border: '1px solid $formError'
76
+ }
77
+ }
78
+ }
79
+ }
80
+ });
81
+ const Input = styled('input', {
82
+ display: 'flex',
83
+ position: 'relative',
84
+ flex: 'auto',
85
+ flexWrap: 'wrap',
86
+ maxWidth: '100%',
87
+ appearance: 'none',
88
+ backgroundolor: 'none',
89
+ border: 'none',
90
+ fontSize: '$short-content-regular',
91
+ lineHeight: '$short-content-regular',
92
+ cursor: 'text',
93
+ outline: 'none',
94
+ letterSpacing: '$short-content-regular',
95
+ '&:disabled': {
96
+ backgroundColor: 'transparent',
97
+ color: '$textDisable',
98
+ cursor: 'not-allowed',
99
+ '&::placeholder': {
100
+ color: '$textDisable'
101
+ }
102
+ },
103
+ variants: {
104
+ readOnly: {
105
+ true: {
106
+ color: '$textPrimary',
107
+ backgroundColor: '$formDisable',
108
+ cursor: 'not-allowed'
109
+ }
110
+ }
111
+ }
112
+ });
113
+ const OptionWrapper = styled('div', {
114
+ display: 'none',
115
+ overflow: 'auto',
116
+ padding: '4px 16px',
117
+ zIndex: 1,
118
+ borderRadius: '$sm',
119
+ backgroundColor: '$bgWhite',
120
+ boxShadow: '0px 2px 12px #00000014',
121
+ width: '100%',
122
+ maxHeight: '36px',
123
+ position: 'absolute',
124
+ float: 'left',
125
+ top: '45px',
126
+ left: '0'
127
+ });
128
+ const ItemWrapper = styled('div', {
129
+ display: 'flex',
130
+ position: 'relative',
131
+ flex: 'auto',
132
+ flexWrap: 'wrap',
133
+ maxWidth: '100%',
134
+ alignItems: 'center',
135
+ marginLeft: '10px',
136
+ fontSize: '$content-button',
137
+ fontWeight: 600,
138
+ color: '$textBrand',
139
+ height: '100%'
140
+ });
141
+ const Item = styled('div', {
142
+ backgroundColor: '$bgWhite',
143
+ cursor: 'pointer',
144
+ lineHeight: '20px'
145
+ });
146
+ function InputCreatable({
147
+ size,
148
+ isInvalid,
149
+ placeholder,
150
+ onChange,
151
+ value,
152
+ disabled,
153
+ readOnly,
154
+ maxChar,
155
+ onClickItem
156
+ }) {
157
+ const {
158
+ t
159
+ } = useTranslation(['MajooUI/inputCreatable', 'translation']);
160
+ const [inputValue, setInputValue] = React__default.useState(value || '');
161
+ const [isOpen, setOpen] = React__default.useState(false);
162
+ React__default.useEffect(() => {
163
+ setInputValue(value);
164
+ }, [value]);
165
+ React__default.useEffect(() => {
166
+ onChange && onChange(inputValue);
167
+ }, [inputValue]);
168
+ const handleInputValue = value => {
169
+ if (value === '') {
170
+ setInputValue('');
171
+ setOpen(false);
172
+ } else {
173
+ setOpen(true);
174
+ setInputValue(value);
175
+ }
176
+ };
177
+ return /*#__PURE__*/jsxs(Wrapper, {
178
+ children: [/*#__PURE__*/jsx(InputWrapper, {
179
+ size: size,
180
+ isInvalid: isInvalid,
181
+ disabled: disabled || readOnly,
182
+ children: /*#__PURE__*/jsx(Input, {
183
+ type: "text",
184
+ placeholder: placeholder,
185
+ disabled: disabled,
186
+ readOnly: readOnly,
187
+ maxLength: maxChar,
188
+ value: inputValue,
189
+ onChange: event => handleInputValue(event.target.value)
190
+ })
191
+ }), /*#__PURE__*/jsx(OptionWrapper, {
192
+ css: {
193
+ display: isOpen ? 'block' : 'none'
194
+ },
195
+ children: /*#__PURE__*/jsxs(ItemWrapper, {
196
+ children: [/*#__PURE__*/jsx(CirclePlusOutline, {
197
+ color: colors.iconBrand
198
+ }), /*#__PURE__*/jsxs(Item, {
199
+ onClick: () => {
200
+ if (onClickItem) onClickItem();
201
+ setOpen(false);
202
+ },
203
+ children: [t('addText', 'Tambah'), " \"", inputValue, "\""]
204
+ })]
205
+ })
206
+ })]
207
+ });
208
+ }
209
+ InputCreatable.propTypes = {
210
+ placeholder: PropTypes.string,
211
+ size: PropTypes.string,
212
+ value: PropTypes.string,
213
+ onChange: PropTypes.func,
214
+ onClickItem: PropTypes.func,
215
+ maxChar: PropTypes.number,
216
+ isInvalid: PropTypes.bool,
217
+ disabled: PropTypes.bool,
218
+ readOnly: PropTypes.bool
219
+ };
220
+ InputCreatable.defaultProps = {
221
+ placeholder: 'Placeholder',
222
+ size: 'lg',
223
+ isInvalid: false,
224
+ disabled: false,
225
+ readOnly: false,
226
+ value: ''
227
+ };
228
+
229
+ export { InputCreatable, InputCreatable as default };
@@ -0,0 +1,46 @@
1
+ import 'core-js/modules/es.iterator.constructor.js';
2
+ import 'core-js/modules/es.iterator.map.js';
3
+ import { __rest } from 'tslib';
4
+ import { jsx } from 'react/jsx-runtime';
5
+ import * as React from 'react';
6
+ import { InputSelect } from '../InputSelect/InputSelect.esm.js';
7
+ import { useTranslation } from 'react-i18next';
8
+ import { advancePickerDate, advancePickerOptionsId, advancePickerOptionsEn } from '../../../datePicker/state/reducer.esm.js';
9
+
10
+ const InputDateRange = /*#__PURE__*/React.forwardRef((_a, ref) => {
11
+ var {
12
+ onChange,
13
+ placeholder,
14
+ size = 'sm',
15
+ disabled = false,
16
+ placement = 'bottom',
17
+ readOnly = false,
18
+ isInvalid = false,
19
+ css
20
+ } = _a,
21
+ props = __rest(_a, ["onChange", "placeholder", "size", "disabled", "placement", "readOnly", "isInvalid", "css"]);
22
+ const {
23
+ t,
24
+ i18n
25
+ } = useTranslation('translation');
26
+ const language = i18n.language;
27
+ const pickerOptions = language === 'id' ? advancePickerOptionsId : advancePickerOptionsEn;
28
+ return jsx(InputSelect, Object.assign({}, props, {
29
+ option: pickerOptions.map(option => ({
30
+ name: option.label,
31
+ value: option.value
32
+ })),
33
+ onChange: selectedOption => {
34
+ if (onChange) onChange(advancePickerDate(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value, undefined));
35
+ },
36
+ placeholder: placeholder || t('placeholder.select', 'Pilih'),
37
+ size: size,
38
+ disabled: disabled,
39
+ placement: placement,
40
+ readOnly: readOnly,
41
+ isInvalid: isInvalid,
42
+ css: css
43
+ }));
44
+ });
45
+
46
+ export { InputDateRange, InputDateRange as default };
@@ -0,0 +1,35 @@
1
+ import 'react';
2
+ import { styled } from '../../../../config/stitches.config.esm.js';
3
+ import PropTypes from 'prop-types';
4
+ import { InputPrefix, InputSuffix } from '../InputLetter/InputLetter.esm.js';
5
+
6
+ const InputLeftElement = styled(InputPrefix, {
7
+ paddingRight: 8
8
+ });
9
+ InputLeftElement.defaultProps = {
10
+ as: 'div',
11
+ color: 'primary',
12
+ size: 'lg'
13
+ };
14
+ InputLeftElement.propTypes = {
15
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]),
16
+ color: PropTypes.string,
17
+ size: PropTypes.string
18
+ };
19
+ InputLeftElement.name = 'InputLeftElement';
20
+ const InputRightElement = styled(InputSuffix, {
21
+ paddingLeft: 8
22
+ });
23
+ InputRightElement.defaultProps = {
24
+ as: 'div',
25
+ color: 'primary',
26
+ size: 'lg'
27
+ };
28
+ InputRightElement.propTypes = {
29
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]),
30
+ color: PropTypes.string,
31
+ size: PropTypes.string
32
+ };
33
+ InputRightElement.name = 'InputRightElement';
34
+
35
+ export { InputLeftElement, InputRightElement };