@majoo-ui/react 2.0.0 → 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 +16 -5
  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
package/Separator.esm.js DELETED
@@ -1,3002 +0,0 @@
1
- import * as React from 'react';
2
- import React__default, { useState, createContext, useContext, useEffect, useCallback, cloneElement, useRef, createElement } from 'react';
3
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
4
- import { q as iteratorHelperThrowsOnInvalidIterator$1, r as iteratorCreateProxy, t as callWithSafeIterationClosing$1, T as Text, P as PropTypes, F as Flex, C as ConditionalWrapper, _ as __rest, l as __awaiter, a as Paragraph, B as Box, M as ModalDialog, c as ModalDialogTitle, d as ModalDialogContent } from './ModalDialog.esm.js';
5
- import { a as aCallable$2, i as iteratorHelperWithoutClosingOnEarlyError$2, _ as _export, b as anObject$2, c as iteratorClose$2, f as functionCall, g as getIteratorDirect$2, s as styled, k as keyframes, d as iterate$1, J as objectDefineProperty, K as wellKnownSymbol$1, L as objectCreate, M as arrayIncludes, p as fails$2, w as classofRaw, B as descriptors, N as toObject$1, A as lengthOfArrayLike$1, h as colors$1, H as commonjsGlobal, I as getDefaultExportFromCjs } from './stitches.config.esm.js';
6
- import * as LabelPrimitive from '@radix-ui/react-label';
7
- import { CircleQuestionOutline, CloseOutline, CircleInfoOutline, SearchOutline, CloseFilled, CaretDownOutline } from '@majoo-ui/icons';
8
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
- import { renderToString } from 'react-dom/server';
10
- import Downshift from 'downshift';
11
- import debounce from 'lodash.debounce';
12
- import { useTranslation } from 'react-i18next';
13
- import { foundations } from '@majoo-ui/core';
14
- import InfiniteScroll from 'react-infinite-scroller';
15
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
16
- import { Portal } from '@majoo-ui/helpers';
17
- import { useFloating, offset, shift, flip, useInteractions, useClick, useDismiss, FloatingFocusManager, FloatingPortal } from '@floating-ui/react';
18
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
19
-
20
- var $$3 = _export;
21
- var call$1 = functionCall;
22
- var aCallable$1 = aCallable$2;
23
- var anObject$1 = anObject$2;
24
- var getIteratorDirect$1 = getIteratorDirect$2;
25
- var createIteratorProxy = iteratorCreateProxy;
26
- var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
27
- var iteratorClose$1 = iteratorClose$2;
28
- var iteratorHelperThrowsOnInvalidIterator = iteratorHelperThrowsOnInvalidIterator$1;
29
- var iteratorHelperWithoutClosingOnEarlyError$1 = iteratorHelperWithoutClosingOnEarlyError$2;
30
-
31
- var FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !iteratorHelperThrowsOnInvalidIterator('filter', function () { /* empty */ });
32
- var filterWithoutClosingOnEarlyError = !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR
33
- && iteratorHelperWithoutClosingOnEarlyError$1('filter', TypeError);
34
-
35
- var FORCED$1 = FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError;
36
-
37
- var IteratorProxy = createIteratorProxy(function () {
38
- var iterator = this.iterator;
39
- var predicate = this.predicate;
40
- var next = this.next;
41
- var result, done, value;
42
- while (true) {
43
- result = anObject$1(call$1(next, iterator));
44
- done = this.done = !!result.done;
45
- if (done) return;
46
- value = result.value;
47
- if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;
48
- }
49
- });
50
-
51
- // `Iterator.prototype.filter` method
52
- // https://tc39.es/ecma262/#sec-iterator.prototype.filter
53
- $$3({ target: 'Iterator', proto: true, real: true, forced: FORCED$1 }, {
54
- filter: function filter(predicate) {
55
- anObject$1(this);
56
- try {
57
- aCallable$1(predicate);
58
- } catch (error) {
59
- iteratorClose$1(this, 'throw', error);
60
- }
61
-
62
- if (filterWithoutClosingOnEarlyError) return call$1(filterWithoutClosingOnEarlyError, this, predicate);
63
-
64
- return new IteratorProxy(getIteratorDirect$1(this), {
65
- predicate: predicate
66
- });
67
- }
68
- });
69
-
70
- const Badge = styled(Text, {
71
- // Reset
72
- alignItems: 'center',
73
- appearance: 'none',
74
- borderWidth: '0',
75
- boxSizing: 'border-box',
76
- display: 'inline-flex',
77
- flexShrink: 0,
78
- fontFamily: 'inherit',
79
- fontSize: '$caption',
80
- fontWeight: 600,
81
- justifyContent: 'center',
82
- lineHeight: '1',
83
- verticalAlign: 'middle',
84
- outline: 'none',
85
- padding: '$spacing-01 $spacing-02',
86
- textDecoration: 'none',
87
- userSelect: 'none',
88
- WebkitTapHighlightColor: 'rgba(0,0,0,0)',
89
- '&:disabled': {
90
- backgroundColor: '$btnDisable',
91
- pointerEvents: 'none',
92
- color: '$textDisable'
93
- },
94
- // Custom
95
- borderRadius: '$md',
96
- color: '$textPrimary',
97
- whiteSpace: 'nowrap',
98
- fontVariantNumeric: 'tabular-nums',
99
- backgroundColor: '$btnDisable',
100
- variants: {
101
- colorScheme: {
102
- gray: {
103
- subtleColor: 'gray'
104
- },
105
- primary: {
106
- subtleColor: 'primary'
107
- },
108
- secondary: {
109
- subtleColor: 'secondary'
110
- },
111
- blue: {
112
- subtleColor: 'blue'
113
- },
114
- orange: {
115
- subtleColor: 'orange'
116
- },
117
- red: {
118
- subtleColor: 'red'
119
- },
120
- purple: {
121
- subtleColor: 'purple'
122
- },
123
- green: {
124
- subtleColor: 'green'
125
- }
126
- },
127
- badgeVariant: {
128
- outline: {
129
- backgroundColor: 'transparent',
130
- border: '1px solid CurrentColor'
131
- },
132
- solid: {
133
- color: '$white'
134
- },
135
- subtle: {},
136
- alpha: {}
137
- }
138
- },
139
- compoundVariants: [{
140
- badgeVariant: 'outline',
141
- css: {
142
- backgroundColor: 'transparent',
143
- border: '1px solid CurrentColor'
144
- }
145
- }, {
146
- colorScheme: 'gray',
147
- badgeVariant: 'outline',
148
- css: {
149
- color: '$gray500'
150
- }
151
- }, {
152
- colorScheme: 'primary',
153
- badgeVariant: 'outline',
154
- css: {
155
- color: '$bgBrand'
156
- }
157
- }, {
158
- colorScheme: 'secondary',
159
- badgeVariant: 'outline',
160
- css: {
161
- color: '$secondary500'
162
- }
163
- }, {
164
- colorScheme: 'blue',
165
- badgeVariant: 'outline',
166
- css: {
167
- color: '$blue500'
168
- }
169
- }, {
170
- colorScheme: 'orange',
171
- badgeVariant: 'outline',
172
- css: {
173
- color: '$orange500'
174
- }
175
- }, {
176
- colorScheme: 'red',
177
- badgeVariant: 'outline',
178
- css: {
179
- color: '$red500'
180
- }
181
- }, {
182
- colorScheme: 'purple',
183
- badgeVariant: 'outline',
184
- css: {
185
- color: '$purple500'
186
- }
187
- }, {
188
- colorScheme: 'green',
189
- badgeVariant: 'outline',
190
- css: {
191
- color: '$green500'
192
- }
193
- }, {
194
- colorScheme: 'dark',
195
- badgeVariant: 'outline',
196
- css: {
197
- color: '$borderActive'
198
- }
199
- }, {
200
- colorScheme: 'gray',
201
- badgeVariant: 'solid',
202
- css: {
203
- backgroundColor: '$gray500'
204
- }
205
- }, {
206
- colorScheme: 'primary',
207
- badgeVariant: 'solid',
208
- css: {
209
- backgroundColor: '$bgBrand'
210
- }
211
- }, {
212
- colorScheme: 'secondary',
213
- badgeVariant: 'solid',
214
- css: {
215
- backgroundColor: '$secondary500'
216
- }
217
- }, {
218
- colorScheme: 'blue',
219
- badgeVariant: 'solid',
220
- css: {
221
- backgroundColor: '$blue500'
222
- }
223
- }, {
224
- colorScheme: 'orange',
225
- badgeVariant: 'solid',
226
- css: {
227
- backgroundColor: '$orange500'
228
- }
229
- }, {
230
- colorScheme: 'red',
231
- badgeVariant: 'solid',
232
- css: {
233
- backgroundColor: '$red500'
234
- }
235
- }, {
236
- colorScheme: 'purple',
237
- badgeVariant: 'solid',
238
- css: {
239
- backgroundColor: '$purple500'
240
- }
241
- }, {
242
- colorScheme: 'green',
243
- badgeVariant: 'solid',
244
- css: {
245
- backgroundColor: '$green500'
246
- }
247
- }, {
248
- colorScheme: 'dark',
249
- badgeVariant: 'solid',
250
- css: {
251
- backgroundColor: '$borderActive'
252
- }
253
- }, {
254
- colorScheme: 'gray',
255
- badgeVariant: 'alpha',
256
- css: {
257
- backgroundColor: 'color-mix(in srgb, var(--colors-gray500) 50%, transparent)'
258
- }
259
- }, {
260
- colorScheme: 'primary',
261
- badgeVariant: 'alpha',
262
- css: {
263
- backgroundColor: 'color-mix(in srgb, var(--colors-bgBrand) 50%, transparent)'
264
- }
265
- }, {
266
- colorScheme: 'secondary',
267
- badgeVariant: 'alpha',
268
- css: {
269
- backgroundColor: 'color-mix(in srgb, var(--colors-secondary500) 50%, transparent)'
270
- }
271
- }, {
272
- colorScheme: 'blue',
273
- badgeVariant: 'alpha',
274
- css: {
275
- backgroundColor: 'color-mix(in srgb, var(--colors-blue500) 50%, transparent)'
276
- }
277
- }, {
278
- colorScheme: 'orange',
279
- badgeVariant: 'alpha',
280
- css: {
281
- backgroundColor: 'color-mix(in srgb, var(--colors-orange500) 50%, transparent)'
282
- }
283
- }, {
284
- colorScheme: 'red',
285
- badgeVariant: 'alpha',
286
- css: {
287
- backgroundColor: 'color-mix(in srgb, var(--colors-red500) 50%, transparent)'
288
- }
289
- }, {
290
- colorScheme: 'purple',
291
- badgeVariant: 'alpha',
292
- css: {
293
- backgroundColor: 'color-mix(in srgb, var(--colors-purple500) 50%, transparent)'
294
- }
295
- }, {
296
- colorScheme: 'green',
297
- badgeVariant: 'alpha',
298
- css: {
299
- backgroundColor: 'color-mix(in srgb, var(--colors-green500) 50%, transparent)'
300
- }
301
- }, {
302
- colorScheme: 'dark',
303
- badgeVariant: 'alpha',
304
- css: {
305
- backgroundColor: 'color-mix(in srgb, var(--colors-borderActive) 50%, transparent)'
306
- }
307
- }],
308
- defaultVariants: {
309
- colorScheme: 'grey',
310
- badgeVariant: 'subtle'
311
- }
312
- });
313
- Badge.defaultProps = {
314
- as: 'span',
315
- colorScheme: 'grey',
316
- badgeVariant: 'subtle'
317
- };
318
- Badge.displayName = 'Badge';
319
-
320
- const {
321
- zIndices: zIndices$2
322
- } = foundations;
323
- const slideUpAndFade = keyframes({
324
- '0%': {
325
- opacity: 0,
326
- transform: 'translateY(2px)'
327
- },
328
- '100%': {
329
- opacity: 1,
330
- transform: 'translateY(0)'
331
- }
332
- });
333
- const slideRightAndFade = keyframes({
334
- '0%': {
335
- opacity: 0,
336
- transform: 'translateX(-2px)'
337
- },
338
- '100%': {
339
- opacity: 1,
340
- transform: 'translateX(0)'
341
- }
342
- });
343
- const slideDownAndFade = keyframes({
344
- '0%': {
345
- opacity: 0,
346
- transform: 'translateY(-2px)'
347
- },
348
- '100%': {
349
- opacity: 1,
350
- transform: 'translateY(0)'
351
- }
352
- });
353
- const slideLeftAndFade = keyframes({
354
- '0%': {
355
- opacity: 0,
356
- transform: 'translateX(2px)'
357
- },
358
- '100%': {
359
- opacity: 1,
360
- transform: 'translateX(0)'
361
- }
362
- });
363
- const StyledContent = styled(TooltipPrimitive.Content, {
364
- zIndex: zIndices$2.tooltip,
365
- borderRadius: 8,
366
- padding: '8px',
367
- fontSize: '$helper',
368
- letterSpacing: '$helper',
369
- lineHeight: '$helper',
370
- fontWeight: '400',
371
- backgroundColor: '$white',
372
- boxShadow: '$large',
373
- '@media (prefers-reduced-motion: no-preference)': {
374
- animationDuration: '400ms',
375
- animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
376
- animationFillMode: 'forwards',
377
- willChange: 'transform, opacity',
378
- '&[data-state="delayed-open"]': {
379
- '&[data-side="top"]': {
380
- animationName: slideDownAndFade
381
- },
382
- '&[data-side="right"]': {
383
- animationName: slideLeftAndFade
384
- },
385
- '&[data-side="bottom"]': {
386
- animationName: slideUpAndFade
387
- },
388
- '&[data-side="left"]': {
389
- animationName: slideRightAndFade
390
- }
391
- }
392
- },
393
- maxWidth: '100vw'
394
- });
395
- const TriggerSpan = styled('span', {
396
- display: 'flex'
397
- });
398
- const StyledArrow = styled(TooltipPrimitive.Arrow, {
399
- boxShadow: '$large'
400
- });
401
- const TooltipBase = styled(TooltipPrimitive.Root, {
402
- defaultVariants: {
403
- color: 'ligth'
404
- }
405
- });
406
-
407
- // Exports
408
- const Provider = TooltipPrimitive.Provider;
409
- const TooltipTrigger = TooltipPrimitive.Trigger;
410
- const dark = {
411
- color: foundations.colors.white,
412
- backgroundColor: foundations.colors.gray800
413
- };
414
- const ligth = {
415
- color: foundations.colors.textPrimary,
416
- backgroundColor: foundations.colors.bgWhite
417
- };
418
- const darkArrow = {
419
- fill: foundations.colors.gray800
420
- };
421
- const lightArrow = {
422
- fill: foundations.colors.bgWhite
423
- };
424
- const Tooltip = ({
425
- children,
426
- label,
427
- color,
428
- css,
429
- withClick,
430
- side,
431
- align,
432
- delayDuration,
433
- ...rest
434
- }) => {
435
- const [open, setOpen] = useState(false);
436
- return /*#__PURE__*/jsx(Provider, {
437
- children: /*#__PURE__*/jsxs(TooltipBase, {
438
- ...rest,
439
- open: withClick ? open : undefined,
440
- delayDuration: delayDuration,
441
- children: [/*#__PURE__*/jsx(TooltipTrigger, {
442
- asChild: true,
443
- children: /*#__PURE__*/jsx(TriggerSpan, {
444
- onClick: () => withClick && !open && setOpen(prev => !prev),
445
- children: children
446
- })
447
- }), /*#__PURE__*/jsx(TooltipPrimitive.Portal, {
448
- children: /*#__PURE__*/jsxs(StyledContent, {
449
- align: align,
450
- side: side,
451
- sideOffset: 5,
452
- css: color === 'dark' ? {
453
- ...dark,
454
- ...css
455
- } : {
456
- ...ligth,
457
- ...css
458
- },
459
- onPointerDownOutside: () => setTimeout(() => {
460
- setOpen(false);
461
- }, 200),
462
- children: [label, /*#__PURE__*/jsx(StyledArrow, {
463
- offset: 10,
464
- css: color === 'dark' ? darkArrow : lightArrow
465
- })]
466
- })
467
- })]
468
- })
469
- });
470
- };
471
- Tooltip.propTypes = {
472
- children: PropTypes.node,
473
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
474
- color: PropTypes.string,
475
- side: PropTypes.oneOf(['top', 'bottom', 'right', 'left']),
476
- align: PropTypes.oneOf(['start', 'center', 'end'])
477
- };
478
- Tooltip.defaultProps = {
479
- color: 'dark',
480
- side: 'bottom',
481
- align: 'center',
482
- label: '',
483
- children: /*#__PURE__*/jsx("div", {}),
484
- delayDuration: 200
485
- };
486
-
487
- var $$2 = _export;
488
- var call = functionCall;
489
- var iterate = iterate$1;
490
- var aCallable = aCallable$2;
491
- var anObject = anObject$2;
492
- var getIteratorDirect = getIteratorDirect$2;
493
- var iteratorClose = iteratorClose$2;
494
- var iteratorHelperWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$2;
495
-
496
- var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);
497
-
498
- // `Iterator.prototype.some` method
499
- // https://tc39.es/ecma262/#sec-iterator.prototype.some
500
- $$2({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {
501
- some: function some(predicate) {
502
- anObject(this);
503
- try {
504
- aCallable(predicate);
505
- } catch (error) {
506
- iteratorClose(this, 'throw', error);
507
- }
508
-
509
- if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);
510
-
511
- var record = getIteratorDirect(this);
512
- var counter = 0;
513
- return iterate(record, function (value, stop) {
514
- if (predicate(value, counter++)) return stop();
515
- }, { IS_RECORD: true, INTERRUPTED: true }).stopped;
516
- }
517
- });
518
-
519
- var wellKnownSymbol = wellKnownSymbol$1;
520
- var create = objectCreate;
521
- var defineProperty = objectDefineProperty.f;
522
-
523
- var UNSCOPABLES = wellKnownSymbol('unscopables');
524
- var ArrayPrototype = Array.prototype;
525
-
526
- // Array.prototype[@@unscopables]
527
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
528
- if (ArrayPrototype[UNSCOPABLES] === undefined) {
529
- defineProperty(ArrayPrototype, UNSCOPABLES, {
530
- configurable: true,
531
- value: create(null)
532
- });
533
- }
534
-
535
- // add a key to Array.prototype[@@unscopables]
536
- var addToUnscopables$1 = function (key) {
537
- ArrayPrototype[UNSCOPABLES][key] = true;
538
- };
539
-
540
- var $$1 = _export;
541
- var $includes = arrayIncludes.includes;
542
- var fails$1 = fails$2;
543
- var addToUnscopables = addToUnscopables$1;
544
-
545
- // FF99+ bug
546
- var BROKEN_ON_SPARSE = fails$1(function () {
547
- // eslint-disable-next-line es/no-array-prototype-includes -- detection
548
- return !Array(1).includes();
549
- });
550
-
551
- // Safari 26.4- bug
552
- var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails$1(function () {
553
- // eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
554
- return [, 1].includes(undefined, 1);
555
- });
556
-
557
- // `Array.prototype.includes` method
558
- // https://tc39.es/ecma262/#sec-array.prototype.includes
559
- $$1({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
560
- includes: function includes(el /* , fromIndex = 0 */) {
561
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
562
- }
563
- });
564
-
565
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
566
- addToUnscopables('includes');
567
-
568
- const StyledLabel = styled(LabelPrimitive.Root, Text, {
569
- display: 'inline-block',
570
- fontSize: '$label',
571
- lineHeight: '$label',
572
- fontWeight: '500',
573
- variants: {
574
- variant: {
575
- required: {
576
- '&::after': {
577
- color: '$textRed',
578
- content: '*'
579
- }
580
- }
581
- }
582
- }
583
- });
584
- const StyledHelpIcon = styled(CircleQuestionOutline, {
585
- size: '16px'
586
- });
587
- const LabelVariantsEnum = ['required', 'optional', 'with-tooltip'];
588
- const FormLabel = ({
589
- children,
590
- htmlFor,
591
- variant,
592
- variants,
593
- tooltipLabel,
594
- count,
595
- maxCount,
596
- labelCss,
597
- ...props
598
- }) => {
599
- return /*#__PURE__*/jsxs(Flex, {
600
- justify: "between",
601
- className: "form-label",
602
- children: [/*#__PURE__*/jsxs(Flex, {
603
- align: "center",
604
- gap: 3,
605
- ...props,
606
- children: [/*#__PURE__*/jsx(StyledLabel, {
607
- htmlFor: htmlFor,
608
- variant: variant,
609
- css: labelCss,
610
- children: children
611
- }), (variant === LabelVariantsEnum[1] || variants.includes(LabelVariantsEnum[1])) && /*#__PURE__*/jsx(Badge, {
612
- css: {
613
- padding: '$spacing-02 $spacing-03',
614
- color: '$gray600',
615
- backgroundColor: '$gray150',
616
- borderRadius: '100px',
617
- fontSize: '$label',
618
- lineHeight: '$label'
619
- },
620
- children: "Opsional"
621
- }), (variant === LabelVariantsEnum[2] || variants.includes(LabelVariantsEnum[2])) && /*#__PURE__*/jsx(Tooltip, {
622
- label: tooltipLabel,
623
- children: /*#__PURE__*/jsx(StyledHelpIcon, {})
624
- })]
625
- }), maxCount && /*#__PURE__*/jsxs(Text, {
626
- variant: "label",
627
- color: "disable",
628
- children: [count, "/", maxCount]
629
- })]
630
- });
631
- };
632
- FormLabel.propTypes = {
633
- variant: PropTypes.oneOf(LabelVariantsEnum),
634
- variants: PropTypes.array,
635
- htmlFor: PropTypes.string,
636
- tooltipLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
637
- count: PropTypes.number,
638
- maxCount: PropTypes.number
639
- };
640
- FormLabel.defaultProps = {
641
- variants: []
642
- };
643
- FormLabel.displayName = 'FormLabel';
644
-
645
- const CheckboxContext = /*#__PURE__*/createContext();
646
- const CheckboxGroup = ({
647
- children,
648
- onChange,
649
- value,
650
- defaultValue,
651
- disabled
652
- }) => {
653
- const [selectedItems, setSelectedItems] = useState(defaultValue);
654
- const checkItem = (item, index) => {
655
- if (!value) {
656
- setSelectedItems(current => {
657
- const items = [...current, item];
658
- if (onChange) onChange(items);
659
- return items;
660
- });
661
- } else {
662
- if (onChange) onChange([...value, item], index);
663
- }
664
- };
665
- const uncheckItem = (item, index) => {
666
- if (!value) {
667
- setSelectedItems(current => {
668
- const items = current.filter(currItem => currItem !== item);
669
- if (onChange) onChange(items);
670
- return items;
671
- });
672
- } else {
673
- if (onChange) onChange(value.filter(currItem => currItem !== item), index);
674
- }
675
- };
676
- const values = {
677
- checkItem,
678
- uncheckItem,
679
- checkedItems: value || selectedItems
680
- };
681
- return /*#__PURE__*/jsx(CheckboxContext.Provider, {
682
- value: values,
683
- children: React__default.Children.map(children, child => /*#__PURE__*/React__default.cloneElement(child, {
684
- disabled: child.props.disabled || disabled
685
- }))
686
- });
687
- };
688
- CheckboxGroup.propTypes = {
689
- onChange: PropTypes.func.isRequired,
690
- defaultValue: PropTypes.array
691
- };
692
- CheckboxGroup.defaultProps = {
693
- defaultValue: []
694
- };
695
- CheckboxGroup.displayName = 'CheckboxGroup';
696
-
697
- const CheckOutline = props => /*#__PURE__*/jsxs("svg", {
698
- xmlns: "http://www.w3.org/2000/svg",
699
- xmlSpace: "preserve",
700
- width: "1em",
701
- height: "1em",
702
- style: {
703
- shapeRendering: 'geometricPrecision',
704
- textRendering: 'geometricPrecision',
705
- imageRendering: 'optimizeQuality',
706
- fillRule: 'evenodd',
707
- clipRule: 'evenodd'
708
- },
709
- viewBox: "0 0 13.06 13.06",
710
- ...props,
711
- children: [/*#__PURE__*/jsx("path", {
712
- d: "M0 2.5A2.5 2.5 0 0 1 2.5 0h8.05a2.5 2.5 0 0 1 2.5 2.5v8.05a2.5 2.5 0 0 1-2.5 2.5H2.5c-.66 0-1.3-.26-1.77-.73S0 11.21 0 10.55V2.5z",
713
- style: {
714
- fill: 'none',
715
- fillRule: 'nonzero'
716
- }
717
- }), /*#__PURE__*/jsx("path", {
718
- d: "M10.12 4.53a.47.47 0 0 0 .14-.33.47.47 0 0 0-.14-.33.47.47 0 0 0-.33-.14.47.47 0 0 0-.33.14L5.13 8.2 3.6 6.66a.47.47 0 0 0-.33-.14.47.47 0 0 0-.33.14.47.47 0 0 0-.14.33c0 .12.05.24.14.33l1.87 1.87c.04.04.09.08.15.1.06.02.12.04.18.04s.12-.01.18-.04c.06-.02.11-.06.15-.1l4.66-4.66z",
719
- style: {
720
- fill: '#fefefe',
721
- fillRule: 'nonzero'
722
- }
723
- })]
724
- });
725
-
726
- const SvgMinusOutline = props => /*#__PURE__*/jsxs("svg", {
727
- xmlns: "http://www.w3.org/2000/svg",
728
- xmlSpace: "preserve",
729
- width: "1em",
730
- height: "1em",
731
- style: {
732
- shapeRendering: 'geometricPrecision',
733
- textRendering: 'geometricPrecision',
734
- imageRendering: 'optimizeQuality',
735
- fillRule: 'evenodd',
736
- clipRule: 'evenodd'
737
- },
738
- viewBox: "0 0 18.22 18.22",
739
- ...props,
740
- children: [/*#__PURE__*/jsx("path", {
741
- d: "M15.61 0H2.6A2.595 2.595 0 0 0 0 2.6v13.01a2.595 2.595 0 0 0 2.6 2.6h13.01a2.595 2.595 0 0 0 2.6-2.6V2.6a2.595 2.595 0 0 0-2.6-2.6z",
742
- style: {
743
- fill: 'none',
744
- fillRule: 'nonzero'
745
- }
746
- }), /*#__PURE__*/jsx("path", {
747
- style: {
748
- fill: '#fefefe',
749
- fillRule: 'nonzero'
750
- },
751
- d: "M14.31 10.41H3.9v-2.6h10.41z"
752
- })]
753
- });
754
-
755
- const StyledIndicator = styled(CheckboxPrimitive.Indicator, {
756
- alignItems: 'center',
757
- display: 'flex',
758
- height: '125%',
759
- justifyContent: 'center',
760
- width: '125%'
761
- });
762
- const StyledCheckbox = styled(CheckboxPrimitive.Root, {
763
- all: 'unset',
764
- cursor: 'pointer',
765
- backgroundColor: 'white',
766
- $$cbSize: '13px',
767
- minWidth: '$$cbSize',
768
- minHeight: '$$cbSize',
769
- width: '$$cbSize',
770
- height: '$$cbSize',
771
- border: '1.5px solid $bgOutline',
772
- borderRadius: '3px',
773
- display: 'flex',
774
- alignItems: 'center',
775
- justifyContent: 'center',
776
- '&:hover': {
777
- border: '1.5px solid $primary400'
778
- },
779
- '&:focus': {
780
- outline: '1.5px solid #82C4E0',
781
- outlineOffset: '1px'
782
- },
783
- '&[data-state=checked]': {
784
- backgroundColor: '$primary500',
785
- border: '1.5px solid $primary500',
786
- color: 'white',
787
- '&:hover': {
788
- backgroundColor: '$primary600',
789
- border: '1.5px solid $primary600'
790
- },
791
- '&:focus': {}
792
- },
793
- '&:disabled': {
794
- pointerEvents: 'none',
795
- border: '1.5px solid $gray200',
796
- '&[data-state=checked]': {
797
- backgroundColor: '$gray200',
798
- color: 'white'
799
- }
800
- }
801
- });
802
- const Checkbox = ({
803
- id,
804
- checked,
805
- indeterminate,
806
- disabled,
807
- onCheckedChange,
808
- label,
809
- index,
810
- value,
811
- ...props
812
- }) => {
813
- const context = useContext(CheckboxContext);
814
- const [isChecked, setChecked] = useState(false);
815
- useEffect(() => {
816
- const checkValue = context && context.checkedItems.includes(value) || checked || indeterminate;
817
- setChecked(checkValue ?? false);
818
- }, [checked, indeterminate, context]);
819
- return /*#__PURE__*/jsx(StyledCheckbox, {
820
- id: id,
821
- disabled: disabled,
822
- checked: isChecked,
823
- onCheckedChange: isChecked => {
824
- if (context) {
825
- if (isChecked) context.checkItem(value, index);
826
- if (!isChecked) context.uncheckItem(value, index);
827
- }
828
- if (onCheckedChange) onCheckedChange(isChecked);
829
- },
830
- ...props,
831
- children: /*#__PURE__*/jsx(StyledIndicator, {
832
- children: indeterminate ? /*#__PURE__*/jsx(SvgMinusOutline, {}) : /*#__PURE__*/jsx(CheckOutline, {})
833
- })
834
- });
835
- };
836
- const InputCheckbox = ({
837
- ...props
838
- }) => {
839
- return props.label ? /*#__PURE__*/jsxs(Flex, {
840
- align: "center",
841
- gap: 4,
842
- children: [/*#__PURE__*/jsx(Checkbox, {
843
- ...props
844
- }), /*#__PURE__*/jsx(FormLabel, {
845
- htmlFor: props.id,
846
- labelCss: {
847
- fontSize: '$long-content-regular',
848
- lineHeight: '$long-content-regular',
849
- letterSpacing: '$long-content-regular',
850
- fontWeight: '400',
851
- color: props.disabled ? '$textDisable' : '$textPrimary',
852
- cursor: 'default'
853
- },
854
- children: props.label
855
- })]
856
- }) : /*#__PURE__*/jsx(Checkbox, {
857
- ...props
858
- });
859
- };
860
- InputCheckbox.propTypes = {
861
- checked: PropTypes.bool,
862
- indeterminate: PropTypes.bool,
863
- disabled: PropTypes.bool,
864
- onCheckedChange: PropTypes.func,
865
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
866
- index: PropTypes.number,
867
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])
868
- };
869
- InputCheckbox.displayName = 'InputCheckbox';
870
-
871
- const InputGroupStyle = styled('div', {
872
- display: 'flex',
873
- width: '100%',
874
- position: 'relative',
875
- alignItems: 'center',
876
- '& > input:last-child': {
877
- borderStartStartRadius: 0,
878
- borderEndStartRadius: 0
879
- },
880
- '& > input:first-child': {
881
- borderEndEndRadius: 0,
882
- borderStartEndRadius: 0
883
- },
884
- '& > input:not(:first-child):not(:last-child)': {
885
- borderRadius: 0
886
- },
887
- variants: {
888
- readOnly: {
889
- true: {
890
- backgroundColor: '$formDisable'
891
- }
892
- },
893
- disabled: {
894
- true: {
895
- backgroundColor: '$formDisable',
896
- color: '$textDisable',
897
- cursor: 'not-allowed',
898
- '&::placeholder': {
899
- color: '$textDisable'
900
- },
901
- '&:hover': {
902
- border: '1px solid $bgOutline',
903
- borderRadius: '$lg',
904
- '& > .addon': {
905
- border: '1px solid $bgOutline'
906
- }
907
- },
908
- '& > input': {
909
- color: '$textDisable !important',
910
- cursor: 'not-allowed !important',
911
- border: 'none !important',
912
- '&:hover': {
913
- border: 'none !important'
914
- }
915
- }
916
- }
917
- },
918
- isInvalid: {
919
- true: {
920
- border: '1px solid $red400',
921
- '&:focus': {
922
- border: '1px solid $red400'
923
- },
924
- '&:hover': {
925
- border: '1px solid $red400'
926
- }
927
- }
928
- },
929
- size: {
930
- sm: {
931
- height: 32
932
- },
933
- lg: {
934
- height: 40
935
- }
936
- },
937
- isElement: {
938
- true: {
939
- '& > input:last-child': {
940
- paddingLeft: 0,
941
- border: 'none',
942
- backgroundColor: 'transparent'
943
- },
944
- '& > input:first-child': {
945
- paddingRight: 0,
946
- border: 'none',
947
- backgroundColor: 'transparent'
948
- },
949
- '& > input:not(:first-child):not(:last-child)': {
950
- paddingLeft: 0,
951
- paddingRight: 0,
952
- border: 'none',
953
- backgroundColor: 'transparent'
954
- }
955
- }
956
- },
957
- isLetter: {
958
- true: {
959
- borderRadius: '$lg',
960
- border: '1px solid $bgOutline',
961
- '&:focus': {
962
- border: '1px solid $primary400'
963
- },
964
- '&:active': {
965
- border: '1px solid $primary400'
966
- },
967
- '&:hover': {
968
- border: '1px solid $primary400'
969
- },
970
- '&:disabled': {
971
- backgroundColor: '$formDisable',
972
- color: '$textDisable',
973
- cursor: 'not-allowed',
974
- '&::placeholder': {
975
- color: '$textDisable'
976
- },
977
- '&:hover': {
978
- border: '1px solid $bgOutline'
979
- }
980
- }
981
- }
982
- },
983
- mobileOnly: {
984
- true: {
985
- '@lg': {
986
- display: 'none !important'
987
- }
988
- }
989
- },
990
- desktopOnly: {
991
- true: {
992
- display: 'none !important',
993
- '@lg': {
994
- display: 'flex !important'
995
- }
996
- }
997
- }
998
- },
999
- defaultVariants: {
1000
- isLetter: false,
1001
- size: 'lg'
1002
- }
1003
- });
1004
- const InputGroup = ({
1005
- children,
1006
- size = 'lg',
1007
- ...rest
1008
- }) => {
1009
- const isLetter = children.some(child => child && (child.type.name === 'InputPrefix' || child.type.name === 'InputSuffix' || child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
1010
- const isElement = children.some(child => child && (child.type.name === 'InputLeftElement' || child.type.name === 'InputRightElement'));
1011
- const clone = children.map((child, index) => {
1012
- if (child === null) return null;
1013
- return isLetter ? child.type.name === 'InputText' ? /*#__PURE__*/React__default.cloneElement(child, {
1014
- inputGroup: true,
1015
- size: size,
1016
- key: index
1017
- }) : /*#__PURE__*/React__default.cloneElement(child, {
1018
- size: size,
1019
- key: index
1020
- }) : /*#__PURE__*/React__default.cloneElement(child, {
1021
- size: size,
1022
- key: index
1023
- });
1024
- });
1025
- return /*#__PURE__*/jsx(InputGroupStyle, {
1026
- ...rest,
1027
- children: clone,
1028
- isLetter: isLetter,
1029
- size: size,
1030
- isElement: isElement
1031
- });
1032
- };
1033
- InputGroup.propTypes = {
1034
- /**
1035
- Adjust Input Text Size
1036
- */
1037
- size: PropTypes.oneOf(['sm', 'lg']),
1038
- /**
1039
- Children must be InputText, InputAddon, or InputPrefixes
1040
- */
1041
- children: PropTypes.node.isRequired,
1042
- /** Error state */
1043
- isInvalid: PropTypes.bool,
1044
- /** read-only state */
1045
- readOnly: PropTypes.bool,
1046
- /** disabled state */
1047
- disabled: PropTypes.bool
1048
- };
1049
-
1050
- const InputLetter = styled(Text, {
1051
- flex: '0 0 auto',
1052
- width: 'auto',
1053
- display: 'flex',
1054
- alignItems: 'center',
1055
- padding: '6px $spacing-05',
1056
- variants: {
1057
- size: {
1058
- sm: {
1059
- height: 32
1060
- },
1061
- lg: {
1062
- height: 40
1063
- }
1064
- },
1065
- color: {
1066
- primary: {
1067
- color: '$iconPrimary'
1068
- },
1069
- disabled: {
1070
- color: '$iconDisable'
1071
- }
1072
- }
1073
- },
1074
- defaultVariants: {
1075
- size: 'lg',
1076
- color: 'primary'
1077
- }
1078
- });
1079
- const InputPrefix = styled(InputLetter, {
1080
- padding: '6px 0px 6px $spacing-05',
1081
- defaultVariants: {
1082
- variant: 'placeholder',
1083
- color: 'secondary',
1084
- as: 'div'
1085
- }
1086
- });
1087
- InputPrefix.name = 'InputPrefix';
1088
- InputPrefix.displayName = 'InputPrefix';
1089
- InputPrefix.defaultProps = {
1090
- as: 'div'
1091
- };
1092
- InputPrefix.propTypes = {
1093
- children: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
1094
- };
1095
- const InputSuffix = styled(InputLetter, {
1096
- padding: '6px $spacing-05 6px 0px',
1097
- defaultVariants: {
1098
- variant: 'placeholder',
1099
- color: 'secondary',
1100
- as: 'div'
1101
- }
1102
- });
1103
- InputSuffix.name = 'InputSuffix';
1104
- InputSuffix.displayName = 'InputSuffix';
1105
- InputSuffix.defaultProps = {
1106
- as: 'div'
1107
- };
1108
- InputSuffix.propTypes = {
1109
- children: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
1110
- };
1111
-
1112
- const disabledStyle = {
1113
- backgroundColor: '$formDisable',
1114
- color: '$textDisable',
1115
- cursor: 'not-allowed',
1116
- '&::placeholder': {
1117
- color: '$textDisable'
1118
- },
1119
- '&:hover': {
1120
- border: '1px solid $bgOutline'
1121
- }
1122
- };
1123
- const StyledInput = styled('input', {
1124
- // Reset
1125
- appearance: 'none',
1126
- boxSizing: 'border-box',
1127
- fontFamily: 'inherit',
1128
- margin: '0',
1129
- outline: 'none',
1130
- width: '100%',
1131
- WebkitTapHighlightColor: 'rgba(0,0,0,0)',
1132
- '&::before': {
1133
- boxSizing: 'border-box'
1134
- },
1135
- '&::after': {
1136
- boxSizing: 'border-box'
1137
- },
1138
- // Custom
1139
- background: 'none',
1140
- color: '$textPrimary',
1141
- fontVariantNumeric: 'tabular-nums',
1142
- fontSize: '$short-content-regular',
1143
- letterSpacing: '$short-content-regular',
1144
- lineHeight: '$short-content-regular',
1145
- fontWeight: '400',
1146
- padding: '10px $spacing-05',
1147
- border: '1px solid $bgOutline',
1148
- borderRadius: '$lg',
1149
- '&:focus': {
1150
- border: '1px solid $primary400'
1151
- },
1152
- '&:active': {
1153
- border: '1px solid $primary400'
1154
- },
1155
- '&:hover': {
1156
- border: '1px solid $primary600'
1157
- },
1158
- '&:disabled': disabledStyle,
1159
- '&[data-state="readonly"]': {
1160
- backgroundColor: '$formDisable'
1161
- },
1162
- '&::placeholder': {
1163
- color: '$textDisable'
1164
- },
1165
- compoundVariants: [{
1166
- inputGroup: true,
1167
- isInvalid: true,
1168
- css: {
1169
- border: 'none',
1170
- '&:focus': {
1171
- border: 'none'
1172
- },
1173
- '&:hover': {
1174
- border: 'none'
1175
- }
1176
- }
1177
- }],
1178
- variants: {
1179
- isDisabled: {
1180
- true: disabledStyle
1181
- },
1182
- isReadOnly: {
1183
- true: {
1184
- backgroundColor: '$formDisable'
1185
- }
1186
- },
1187
- inputGroup: {
1188
- true: {
1189
- border: 'none',
1190
- borderRadius: '$lg',
1191
- '&:focus': {
1192
- border: 'none'
1193
- },
1194
- '&:active': {
1195
- border: 'none'
1196
- },
1197
- '&:hover': {
1198
- border: 'none'
1199
- },
1200
- '&:disabled': {
1201
- backgroundColor: 'transparent',
1202
- color: '$textDisable',
1203
- cursor: 'default',
1204
- '&::placeholder': {
1205
- color: '$textDisable'
1206
- },
1207
- '&:hover': {
1208
- border: '1px solid $bgOutline'
1209
- }
1210
- }
1211
- }
1212
- },
1213
- asChild: {
1214
- true: {
1215
- paddingLeft: 0,
1216
- paddingRight: 0,
1217
- border: 'none',
1218
- borderRadius: '$lg',
1219
- '&:focus': {
1220
- border: 'none'
1221
- },
1222
- '&:active': {
1223
- border: 'none'
1224
- },
1225
- '&:hover': {
1226
- border: 'none'
1227
- },
1228
- '&:disabled': {
1229
- backgroundColor: 'transparent',
1230
- color: '$textDisable',
1231
- cursor: 'default',
1232
- '&::placeholder': {
1233
- color: '$textDisable'
1234
- },
1235
- '&:hover': {
1236
- border: 'none'
1237
- }
1238
- }
1239
- }
1240
- },
1241
- /**
1242
- * Please insert size with string 'sm' | 'lg'
1243
- */
1244
- size: {
1245
- sm: {
1246
- height: 32
1247
- },
1248
- lg: {
1249
- height: 40
1250
- }
1251
- },
1252
- isInvalid: {
1253
- true: {
1254
- border: '1px solid $red400',
1255
- '&:focus': {
1256
- border: '1px solid $red400'
1257
- },
1258
- '&:hover': {
1259
- border: '1px solid $red400'
1260
- }
1261
- }
1262
- },
1263
- isPicker: {
1264
- true: {
1265
- fontSize: '$placeholder',
1266
- letterSpacing: '$placeholder',
1267
- lineHeight: '$placeholder',
1268
- fontVariantNumeric: 'unset',
1269
- caretColor: 'transparent',
1270
- cursor: 'pointer',
1271
- padding: '0'
1272
- }
1273
- }
1274
- },
1275
- defaultVariants: {
1276
- size: 'lg'
1277
- }
1278
- });
1279
- const InputText = /*#__PURE__*/React__default.forwardRef(({
1280
- disabled,
1281
- readOnly,
1282
- ...props
1283
- }, ref) => /*#__PURE__*/jsx(StyledInput, {
1284
- ref: ref,
1285
- disabled: disabled,
1286
- isDisabled: disabled,
1287
- readOnly: readOnly,
1288
- isReadOnly: readOnly,
1289
- ...props
1290
- }));
1291
- InputText.propTypes = {
1292
- placeholder: PropTypes.string,
1293
- value: PropTypes.string,
1294
- onChange: PropTypes.func,
1295
- disabled: PropTypes.bool,
1296
- readOnly: PropTypes.bool,
1297
- isInvalid: PropTypes.bool,
1298
- size: PropTypes.string,
1299
- isPicker: PropTypes.bool
1300
- };
1301
- InputText.displayName = 'InputText';
1302
-
1303
- var classof = classofRaw;
1304
-
1305
- // `IsArray` abstract operation
1306
- // https://tc39.es/ecma262/#sec-isarray
1307
- // eslint-disable-next-line es/no-array-isarray -- safe
1308
- var isArray$1 = Array.isArray || function isArray(argument) {
1309
- return classof(argument) === 'Array';
1310
- };
1311
-
1312
- var DESCRIPTORS = descriptors;
1313
- var isArray = isArray$1;
1314
-
1315
- var $TypeError$1 = TypeError;
1316
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1317
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1318
-
1319
- // Safari < 13 does not throw an error in this case
1320
- var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
1321
- // makes no sense without proper strict mode support
1322
- if (this !== undefined) return true;
1323
- try {
1324
- // eslint-disable-next-line es/no-object-defineproperty -- safe
1325
- Object.defineProperty([], 'length', { writable: false }).length = 1;
1326
- } catch (error) {
1327
- return error instanceof TypeError;
1328
- }
1329
- }();
1330
-
1331
- var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
1332
- if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
1333
- throw new $TypeError$1('Cannot set read only .length');
1334
- } return O.length = length;
1335
- } : function (O, length) {
1336
- return O.length = length;
1337
- };
1338
-
1339
- var $TypeError = TypeError;
1340
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
1341
-
1342
- var doesNotExceedSafeInteger$1 = function (it) {
1343
- if (it > MAX_SAFE_INTEGER) throw new $TypeError('Maximum allowed index exceeded');
1344
- return it;
1345
- };
1346
-
1347
- var $ = _export;
1348
- var toObject = toObject$1;
1349
- var lengthOfArrayLike = lengthOfArrayLike$1;
1350
- var setArrayLength = arraySetLength;
1351
- var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
1352
- var fails = fails$2;
1353
-
1354
- var INCORRECT_TO_LENGTH = fails(function () {
1355
- return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
1356
- });
1357
-
1358
- // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
1359
- // https://bugs.chromium.org/p/v8/issues/detail?id=12681
1360
- var properErrorOnNonWritableLength = function () {
1361
- try {
1362
- // eslint-disable-next-line es/no-object-defineproperty -- safe
1363
- Object.defineProperty([], 'length', { writable: false }).push();
1364
- } catch (error) {
1365
- return error instanceof TypeError;
1366
- }
1367
- };
1368
-
1369
- var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
1370
-
1371
- // `Array.prototype.push` method
1372
- // https://tc39.es/ecma262/#sec-array.prototype.push
1373
- $({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
1374
- // eslint-disable-next-line no-unused-vars -- required for `.length`
1375
- push: function push(item) {
1376
- var O = toObject(this);
1377
- var len = lengthOfArrayLike(O);
1378
- var argCount = arguments.length;
1379
- doesNotExceedSafeInteger(len + argCount);
1380
- for (var i = 0; i < argCount; i++) {
1381
- O[len] = arguments[i];
1382
- len++;
1383
- }
1384
- setArrayLength(O, len);
1385
- return len;
1386
- }
1387
- });
1388
-
1389
- const InputLeftElement = styled(InputPrefix, {
1390
- paddingRight: 8
1391
- });
1392
- InputLeftElement.defaultProps = {
1393
- as: 'div',
1394
- color: 'primary',
1395
- size: 'lg'
1396
- };
1397
- InputLeftElement.propTypes = {
1398
- children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]),
1399
- color: PropTypes.string,
1400
- size: PropTypes.string
1401
- };
1402
- InputLeftElement.name = 'InputLeftElement';
1403
- const InputRightElement = styled(InputSuffix, {
1404
- paddingLeft: 8
1405
- });
1406
- InputRightElement.defaultProps = {
1407
- as: 'div',
1408
- color: 'primary',
1409
- size: 'lg'
1410
- };
1411
- InputRightElement.propTypes = {
1412
- children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.node]),
1413
- color: PropTypes.string,
1414
- size: PropTypes.string
1415
- };
1416
- InputRightElement.name = 'InputRightElement';
1417
-
1418
- const TagWrapper = styled('div', {
1419
- boxSizing: 'border-box',
1420
- listStyle: 'none',
1421
- display: 'inline-flex',
1422
- alignItems: 'center',
1423
- height: 'auto',
1424
- width: 'auto',
1425
- justifyContent: 'center',
1426
- fontSize: '12px',
1427
- fontWeight: 500,
1428
- lineHeight: '16px',
1429
- borderRadius: '$sm',
1430
- background: '$bgGray',
1431
- color: '$textPrimary',
1432
- variants: {
1433
- size: {
1434
- sm: {
1435
- minWidth: '45px',
1436
- maxWidth: '118px',
1437
- height: '20px',
1438
- padding: '2px 4px'
1439
- },
1440
- lg: {
1441
- minWidth: '53px',
1442
- maxWidth: '126px',
1443
- height: '24px',
1444
- padding: '4px 8px'
1445
- }
1446
- },
1447
- disabled: {
1448
- true: {
1449
- background: '$bgInactive',
1450
- cursor: 'not-allowed',
1451
- color: '$textDisable'
1452
- }
1453
- },
1454
- readOnly: {
1455
- true: {
1456
- cursor: 'not-allowed'
1457
- }
1458
- },
1459
- type: {
1460
- success: {
1461
- background: '$bgSuccess',
1462
- color: '$textGreen'
1463
- },
1464
- error: {
1465
- background: '$bgFailed',
1466
- color: '$textRed'
1467
- },
1468
- primary: {
1469
- background: '$bgAccent',
1470
- color: '$textBrand'
1471
- },
1472
- varian: {
1473
- background: '$bgWhite',
1474
- color: '$textBrand',
1475
- border: '1px solid $bgBorder'
1476
- }
1477
- }
1478
- }
1479
- });
1480
- const TagComponent = styled('span', {
1481
- textAlign: 'center',
1482
- whiteSpace: 'nowrap',
1483
- overflow: 'hidden',
1484
- textOverflow: 'ellipsis'
1485
- });
1486
- const StyledIconRight = styled('div', {
1487
- marginLeft: '6px',
1488
- display: 'flex',
1489
- verticalAlign: 'middle',
1490
- alignItems: 'center',
1491
- cursor: 'pointer',
1492
- variants: {
1493
- disabled: {
1494
- true: {
1495
- background: '$bgInactive',
1496
- cursor: 'not-allowed'
1497
- }
1498
- },
1499
- readOnly: {
1500
- true: {
1501
- cursor: 'not-allowed'
1502
- }
1503
- }
1504
- }
1505
- });
1506
- const StyledIconLeft = styled('div', {
1507
- margin: '0 3px',
1508
- display: 'flex',
1509
- verticalAlign: 'middle',
1510
- alignItems: 'center',
1511
- color: 'inherit'
1512
- });
1513
- const Tag = /*#__PURE__*/React__default.forwardRef(({
1514
- className,
1515
- children,
1516
- onClick,
1517
- size,
1518
- icon,
1519
- isRemovable,
1520
- disabled,
1521
- type,
1522
- onRemove,
1523
- readOnly,
1524
- ...props
1525
- }, ref) => {
1526
- return /*#__PURE__*/jsxs(TagWrapper, {
1527
- ref: ref,
1528
- onClick: onClick,
1529
- size: size,
1530
- disabled: disabled,
1531
- type: type,
1532
- readOnly: readOnly,
1533
- css: {
1534
- ...props.css
1535
- },
1536
- ...props,
1537
- children: [icon !== undefined ? /*#__PURE__*/jsx(StyledIconLeft, {
1538
- children: icon
1539
- }) : null, /*#__PURE__*/jsx(TagComponent, {
1540
- children: children
1541
- }), isRemovable ? /*#__PURE__*/jsx(StyledIconRight, {
1542
- disabled: disabled,
1543
- onClick: onRemove,
1544
- readOnly: readOnly,
1545
- children: /*#__PURE__*/jsx(CloseOutline, {
1546
- size: 16,
1547
- color: colors$1.iconSecondary,
1548
- style: {
1549
- verticalAlign: 'middle'
1550
- }
1551
- })
1552
- }) : null]
1553
- });
1554
- });
1555
- Tag.propTypes = {
1556
- size: PropTypes.string,
1557
- disabled: PropTypes.bool,
1558
- type: PropTypes.string,
1559
- icon: PropTypes.element,
1560
- isRemovable: PropTypes.bool,
1561
- onRemove: PropTypes.func,
1562
- onClick: PropTypes.func,
1563
- readOnly: PropTypes.bool
1564
- };
1565
- Tag.defaultProps = {
1566
- size: 'sm',
1567
- isRemovable: false,
1568
- disabled: false,
1569
- readOnly: false
1570
- };
1571
-
1572
- const SvgCloseFilled = props => /*#__PURE__*/jsxs("svg", {
1573
- width: props.size,
1574
- height: props.size,
1575
- viewBox: "0 0 24 24",
1576
- fill: "none",
1577
- ...props,
1578
- children: [/*#__PURE__*/jsx("mask", {
1579
- id: "path-1-inside-1_2883_7918",
1580
- fill: "white",
1581
- children: /*#__PURE__*/jsx("path", {
1582
- fillRule: "evenodd",
1583
- clipRule: "evenodd",
1584
- d: "M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM8.54289 8.54289C8.93342 8.15237 9.56658 8.15237 9.95711 8.54289L12 10.5858L14.0429 8.54289C14.4334 8.15237 15.0666 8.15237 15.4571 8.54289C15.8476 8.93342 15.8476 9.56658 15.4571 9.95711L13.4142 12L15.4571 14.0429C15.8476 14.4334 15.8476 15.0666 15.4571 15.4571C15.0666 15.8476 14.4334 15.8476 14.0429 15.4571L12 13.4142L9.95711 15.4571C9.56658 15.8476 8.93342 15.8476 8.54289 15.4571C8.15237 15.0666 8.15237 14.4334 8.54289 14.0429L10.5858 12L8.54289 9.95711C8.15237 9.56658 8.15237 8.93342 8.54289 8.54289Z"
1585
- })
1586
- }), /*#__PURE__*/jsx("path", {
1587
- fillRule: "evenodd",
1588
- clipRule: "evenodd",
1589
- d: "M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM8.54289 8.54289C8.93342 8.15237 9.56658 8.15237 9.95711 8.54289L12 10.5858L14.0429 8.54289C14.4334 8.15237 15.0666 8.15237 15.4571 8.54289C15.8476 8.93342 15.8476 9.56658 15.4571 9.95711L13.4142 12L15.4571 14.0429C15.8476 14.4334 15.8476 15.0666 15.4571 15.4571C15.0666 15.8476 14.4334 15.8476 14.0429 15.4571L12 13.4142L9.95711 15.4571C9.56658 15.8476 8.93342 15.8476 8.54289 15.4571C8.15237 15.0666 8.15237 14.4334 8.54289 14.0429L10.5858 12L8.54289 9.95711C8.15237 9.56658 8.15237 8.93342 8.54289 8.54289Z",
1590
- fill: props.color
1591
- }), /*#__PURE__*/jsx("path", {
1592
- d: "M9.95711 8.54289L8.54289 9.95711L8.54289 9.95711L9.95711 8.54289ZM8.54289 8.54289L9.95711 9.95711L9.95711 9.95711L8.54289 8.54289ZM12 10.5858L10.5858 12L12 13.4142L13.4142 12L12 10.5858ZM14.0429 8.54289L15.4571 9.95711L15.4571 9.95711L14.0429 8.54289ZM15.4571 8.54289L14.0429 9.95711L14.0429 9.95711L15.4571 8.54289ZM15.4571 9.95711L14.0429 8.54289L14.0429 8.54289L15.4571 9.95711ZM13.4142 12L12 10.5858L10.5858 12L12 13.4142L13.4142 12ZM15.4571 14.0429L16.8713 12.6287L16.8713 12.6287L15.4571 14.0429ZM15.4571 15.4571L16.8713 16.8713L16.8713 16.8713L15.4571 15.4571ZM14.0429 15.4571L12.6287 16.8713L12.6287 16.8713L14.0429 15.4571ZM12 13.4142L13.4142 12L12 10.5858L10.5858 12L12 13.4142ZM9.95711 15.4571L11.3713 16.8713L11.3713 16.8713L9.95711 15.4571ZM8.54289 15.4571L7.12868 16.8713L7.12868 16.8713L8.54289 15.4571ZM8.54289 14.0429L7.12868 12.6287L7.12868 12.6287L8.54289 14.0429ZM10.5858 12L12 13.4142L13.4142 12L12 10.5858L10.5858 12ZM8.54289 9.95711L9.95711 8.54289L9.95711 8.54289L8.54289 9.95711ZM19 12C19 15.866 15.866 19 12 19V23C18.0751 23 23 18.0751 23 12H19ZM12 5C15.866 5 19 8.13401 19 12H23C23 5.92487 18.0751 1 12 1V5ZM5 12C5 8.13401 8.13401 5 12 5V1C5.92487 1 1 5.92487 1 12H5ZM12 19C8.13401 19 5 15.866 5 12H1C1 18.0751 5.92487 23 12 23V19ZM11.3713 7.12868C10.1997 5.95711 8.30025 5.95711 7.12868 7.12868L9.95711 9.95711C9.56658 10.3476 8.93342 10.3476 8.54289 9.95711L11.3713 7.12868ZM13.4142 9.17157L11.3713 7.12868L8.54289 9.95711L10.5858 12L13.4142 9.17157ZM12.6287 7.12868L10.5858 9.17157L13.4142 12L15.4571 9.95711L12.6287 7.12868ZM16.8713 7.12868C15.6997 5.95711 13.8003 5.95711 12.6287 7.12868L15.4571 9.95711C15.0666 10.3476 14.4334 10.3476 14.0429 9.95711L16.8713 7.12868ZM16.8713 11.3713C18.0429 10.1997 18.0429 8.30025 16.8713 7.12868L14.0429 9.95711C13.6524 9.56658 13.6524 8.93342 14.0429 8.54289L16.8713 11.3713ZM14.8284 13.4142L16.8713 11.3713L14.0429 8.54289L12 10.5858L14.8284 13.4142ZM16.8713 12.6287L14.8284 10.5858L12 13.4142L14.0429 15.4571L16.8713 12.6287ZM16.8713 16.8713C18.0429 15.6997 18.0429 13.8003 16.8713 12.6287L14.0429 15.4571C13.6524 15.0666 13.6524 14.4334 14.0429 14.0429L16.8713 16.8713ZM12.6287 16.8713C13.8003 18.0429 15.6997 18.0429 16.8713 16.8713L14.0429 14.0429C14.4334 13.6524 15.0666 13.6524 15.4571 14.0429L12.6287 16.8713ZM10.5858 14.8284L12.6287 16.8713L15.4571 14.0429L13.4142 12L10.5858 14.8284ZM11.3713 16.8713L13.4142 14.8284L10.5858 12L8.54289 14.0429L11.3713 16.8713ZM7.12868 16.8713C8.30025 18.0429 10.1997 18.0429 11.3713 16.8713L8.54289 14.0429C8.93342 13.6524 9.56658 13.6524 9.95711 14.0429L7.12868 16.8713ZM7.12868 12.6287C5.95711 13.8003 5.95711 15.6997 7.12868 16.8713L9.95711 14.0429C10.3476 14.4334 10.3476 15.0666 9.95711 15.4571L7.12868 12.6287ZM9.17157 10.5858L7.12868 12.6287L9.95711 15.4571L12 13.4142L9.17157 10.5858ZM7.12868 11.3713L9.17157 13.4142L12 10.5858L9.95711 8.54289L7.12868 11.3713ZM7.12868 7.12868C5.95711 8.30025 5.95711 10.1997 7.12868 11.3713L9.95711 8.54289C10.3476 8.93342 10.3476 9.56658 9.95711 9.95711L7.12868 7.12868Z",
1593
- fill: props.color,
1594
- mask: "url(#path-1-inside-1_2883_7918)"
1595
- })]
1596
- });
1597
- SvgCloseFilled.defaultProps = {
1598
- color: '#404545',
1599
- size: 24
1600
- };
1601
-
1602
- const SvgSearchOutline = props => /*#__PURE__*/jsxs("svg", {
1603
- width: props.size,
1604
- height: props.size,
1605
- viewBox: "0 0 24 24",
1606
- fill: "none",
1607
- ...props,
1608
- children: [/*#__PURE__*/jsx("circle", {
1609
- cx: 11.3091,
1610
- cy: 11.3091,
1611
- r: 6.30911,
1612
- stroke: props.color,
1613
- strokeWidth: 2
1614
- }), /*#__PURE__*/jsx("path", {
1615
- d: "M16.5249 15.1049C16.1345 14.7142 15.5014 14.7139 15.1106 15.1042C14.7199 15.4945 14.7196 16.1277 15.1099 16.5184L16.5249 15.1049ZM19.2939 20.7067C19.6842 21.0974 20.3173 21.0977 20.7081 20.7074C21.0988 20.3171 21.0991 19.6839 20.7088 19.2932L19.2939 20.7067ZM15.1099 16.5184L19.2939 20.7067L20.7088 19.2932L16.5249 15.1049L15.1099 16.5184Z",
1616
- fill: props.color
1617
- })]
1618
- });
1619
- SvgSearchOutline.defaultProps = {
1620
- color: '#404545',
1621
- size: 24
1622
- };
1623
-
1624
- const {
1625
- colors
1626
- } = foundations;
1627
- const InputSearchbox = ({
1628
- size,
1629
- onChange,
1630
- css,
1631
- disabled,
1632
- withDebounce,
1633
- defaultValue,
1634
- mobileOnly,
1635
- desktopOnly,
1636
- ...props
1637
- }) => {
1638
- const {
1639
- t
1640
- } = useTranslation(['MajooUI/inputSearchbox', 'translation']);
1641
- const [value, setValue] = useState(defaultValue);
1642
- const inputValue = props?.value ?? value;
1643
- const debounceChange = useCallback(debounce(e => onChange?.(e), 1000), [onChange]);
1644
- const handleChange = useCallback(e => {
1645
- setValue(e.target.value);
1646
- if (withDebounce) {
1647
- debounceChange(e.target.value);
1648
- } else {
1649
- onChange?.(e.target.value);
1650
- }
1651
- }, [onChange, debounceChange, withDebounce]);
1652
- const handleClearButtonClick = e => {
1653
- e.preventDefault();
1654
- if (!disabled) {
1655
- setValue('');
1656
- if (onChange) onChange('');
1657
- }
1658
- };
1659
- return /*#__PURE__*/jsxs(InputGroup, {
1660
- size: size,
1661
- css: css,
1662
- disabled: disabled,
1663
- mobileOnly: mobileOnly,
1664
- desktopOnly: desktopOnly,
1665
- children: [/*#__PURE__*/jsx(InputLeftElement, {
1666
- children: /*#__PURE__*/jsx(SvgSearchOutline, {})
1667
- }), /*#__PURE__*/jsx(InputText, {
1668
- placeholder: t('placeholder', 'Cari ...'),
1669
- onChange: handleChange,
1670
- value: value,
1671
- disabled: disabled,
1672
- css: {
1673
- height: 'fit-content'
1674
- },
1675
- ...props
1676
- }), /*#__PURE__*/jsx(InputRightElement, {
1677
- children: inputValue?.length > 0 ? /*#__PURE__*/jsx(SvgCloseFilled, {
1678
- color: colors.iconSecondary
1679
- }) : /*#__PURE__*/jsx("div", {}),
1680
- onClick: handleClearButtonClick
1681
- })]
1682
- });
1683
- };
1684
- InputSearchbox.propTypes = {
1685
- placeholder: PropTypes.string,
1686
- value: PropTypes.string,
1687
- size: PropTypes.oneOf(['sm', 'lg']),
1688
- isInvalid: PropTypes.bool,
1689
- readOnly: PropTypes.bool,
1690
- disabled: PropTypes.bool,
1691
- onChange: PropTypes.func,
1692
- withDebounce: PropTypes.bool,
1693
- mobileOnly: PropTypes.bool,
1694
- desktopOnly: PropTypes.bool
1695
- };
1696
- InputSearchbox.defaultProps = {
1697
- size: 'sm'
1698
- };
1699
- InputSearchbox.displayName = 'InputSearchbox';
1700
-
1701
- /** Detect free variable `global` from Node.js. */
1702
-
1703
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
1704
-
1705
- var _freeGlobal = freeGlobal$1;
1706
-
1707
- var freeGlobal = _freeGlobal;
1708
-
1709
- /** Detect free variable `self`. */
1710
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1711
-
1712
- /** Used as a reference to the global object. */
1713
- var root$1 = freeGlobal || freeSelf || Function('return this')();
1714
-
1715
- var _root = root$1;
1716
-
1717
- var root = _root;
1718
-
1719
- /** Built-in value references. */
1720
- var Symbol$2 = root.Symbol;
1721
-
1722
- var _Symbol = Symbol$2;
1723
-
1724
- var Symbol$1 = _Symbol;
1725
-
1726
- /** Used for built-in method references. */
1727
- var objectProto$1 = Object.prototype;
1728
-
1729
- /** Used to check objects for own properties. */
1730
- var hasOwnProperty = objectProto$1.hasOwnProperty;
1731
-
1732
- /**
1733
- * Used to resolve the
1734
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1735
- * of values.
1736
- */
1737
- var nativeObjectToString$1 = objectProto$1.toString;
1738
-
1739
- /** Built-in value references. */
1740
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
1741
-
1742
- /**
1743
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1744
- *
1745
- * @private
1746
- * @param {*} value The value to query.
1747
- * @returns {string} Returns the raw `toStringTag`.
1748
- */
1749
- function getRawTag$1(value) {
1750
- var isOwn = hasOwnProperty.call(value, symToStringTag$1),
1751
- tag = value[symToStringTag$1];
1752
-
1753
- try {
1754
- value[symToStringTag$1] = undefined;
1755
- var unmasked = true;
1756
- } catch (e) {}
1757
-
1758
- var result = nativeObjectToString$1.call(value);
1759
- if (unmasked) {
1760
- if (isOwn) {
1761
- value[symToStringTag$1] = tag;
1762
- } else {
1763
- delete value[symToStringTag$1];
1764
- }
1765
- }
1766
- return result;
1767
- }
1768
-
1769
- var _getRawTag = getRawTag$1;
1770
-
1771
- /** Used for built-in method references. */
1772
-
1773
- var objectProto = Object.prototype;
1774
-
1775
- /**
1776
- * Used to resolve the
1777
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1778
- * of values.
1779
- */
1780
- var nativeObjectToString = objectProto.toString;
1781
-
1782
- /**
1783
- * Converts `value` to a string using `Object.prototype.toString`.
1784
- *
1785
- * @private
1786
- * @param {*} value The value to convert.
1787
- * @returns {string} Returns the converted string.
1788
- */
1789
- function objectToString$1(value) {
1790
- return nativeObjectToString.call(value);
1791
- }
1792
-
1793
- var _objectToString = objectToString$1;
1794
-
1795
- var Symbol = _Symbol,
1796
- getRawTag = _getRawTag,
1797
- objectToString = _objectToString;
1798
-
1799
- /** `Object#toString` result references. */
1800
- var nullTag = '[object Null]',
1801
- undefinedTag = '[object Undefined]';
1802
-
1803
- /** Built-in value references. */
1804
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1805
-
1806
- /**
1807
- * The base implementation of `getTag` without fallbacks for buggy environments.
1808
- *
1809
- * @private
1810
- * @param {*} value The value to query.
1811
- * @returns {string} Returns the `toStringTag`.
1812
- */
1813
- function baseGetTag$1(value) {
1814
- if (value == null) {
1815
- return value === undefined ? undefinedTag : nullTag;
1816
- }
1817
- return (symToStringTag && symToStringTag in Object(value))
1818
- ? getRawTag(value)
1819
- : objectToString(value);
1820
- }
1821
-
1822
- var _baseGetTag = baseGetTag$1;
1823
-
1824
- /**
1825
- * Checks if `value` is the
1826
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1827
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1828
- *
1829
- * @static
1830
- * @memberOf _
1831
- * @since 0.1.0
1832
- * @category Lang
1833
- * @param {*} value The value to check.
1834
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1835
- * @example
1836
- *
1837
- * _.isObject({});
1838
- * // => true
1839
- *
1840
- * _.isObject([1, 2, 3]);
1841
- * // => true
1842
- *
1843
- * _.isObject(_.noop);
1844
- * // => true
1845
- *
1846
- * _.isObject(null);
1847
- * // => false
1848
- */
1849
-
1850
- function isObject$1(value) {
1851
- var type = typeof value;
1852
- return value != null && (type == 'object' || type == 'function');
1853
- }
1854
-
1855
- var isObject_1 = isObject$1;
1856
-
1857
- var baseGetTag = _baseGetTag,
1858
- isObject = isObject_1;
1859
-
1860
- /** `Object#toString` result references. */
1861
- var asyncTag = '[object AsyncFunction]',
1862
- funcTag = '[object Function]',
1863
- genTag = '[object GeneratorFunction]',
1864
- proxyTag = '[object Proxy]';
1865
-
1866
- /**
1867
- * Checks if `value` is classified as a `Function` object.
1868
- *
1869
- * @static
1870
- * @memberOf _
1871
- * @since 0.1.0
1872
- * @category Lang
1873
- * @param {*} value The value to check.
1874
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1875
- * @example
1876
- *
1877
- * _.isFunction(_);
1878
- * // => true
1879
- *
1880
- * _.isFunction(/abc/);
1881
- * // => false
1882
- */
1883
- function isFunction(value) {
1884
- if (!isObject(value)) {
1885
- return false;
1886
- }
1887
- // The use of `Object#toString` avoids issues with the `typeof` operator
1888
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1889
- var tag = baseGetTag(value);
1890
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1891
- }
1892
-
1893
- var isFunction_1 = isFunction;
1894
-
1895
- var isFunction$1 = /*@__PURE__*/getDefaultExportFromCjs(isFunction_1);
1896
-
1897
- const {
1898
- zIndices: zIndices$1
1899
- } = foundations;
1900
- const PopoverContext = /*#__PURE__*/createContext();
1901
- const Popover = ({
1902
- children,
1903
- open = false,
1904
- onOpenChange,
1905
- placement,
1906
- sideOffset = 5,
1907
- hideOnScroll = false,
1908
- flip: flip$1 = true,
1909
- onClose
1910
- }) => {
1911
- const [openState, setOpenState] = useState(false);
1912
- useEffect(() => {
1913
- setOpenState(open);
1914
- }, [open]);
1915
- useEffect(() => {
1916
- if (onOpenChange) onOpenChange(openState);
1917
- }, [openState, onOpenChange]);
1918
- const floatingHook = useFloating({
1919
- open: openState,
1920
- middleware: [offset(sideOffset), shift(), flip$1 && flip()],
1921
- onOpenChange: isOpen => {
1922
- setOpenState(isOpen);
1923
- !isOpen && onClose?.();
1924
- },
1925
- placement
1926
- });
1927
- const {
1928
- getReferenceProps,
1929
- getFloatingProps
1930
- } = useInteractions([useClick(floatingHook.context, {
1931
- keyboardHandlers: false
1932
- }), useDismiss(floatingHook.context, {
1933
- ancestorScroll: hideOnScroll
1934
- })]);
1935
- const value = {
1936
- openState,
1937
- setOpenState,
1938
- floatingHook,
1939
- getReferenceProps,
1940
- getFloatingProps
1941
- };
1942
- return /*#__PURE__*/jsx(PopoverContext.Provider, {
1943
- value: value,
1944
- children: children
1945
- });
1946
- };
1947
- const PopoverTrigger = ({
1948
- children,
1949
- disabled
1950
- }) => {
1951
- const {
1952
- floatingHook: {
1953
- refs
1954
- },
1955
- getReferenceProps
1956
- } = useContext(PopoverContext);
1957
- return disabled ? children : /*#__PURE__*/cloneElement(children, getReferenceProps({
1958
- ref: refs.setReference,
1959
- ...children.props
1960
- }));
1961
- };
1962
- const PopoverContent = ({
1963
- children,
1964
- isMobile,
1965
- style,
1966
- portalled
1967
- }) => {
1968
- const {
1969
- openState,
1970
- floatingHook: {
1971
- x,
1972
- y,
1973
- strategy,
1974
- context,
1975
- refs
1976
- },
1977
- getFloatingProps
1978
- } = useContext(PopoverContext);
1979
- return openState ? /*#__PURE__*/jsx(ConditionalWrapper, {
1980
- condition: portalled,
1981
- wrapper: child => /*#__PURE__*/jsx(FloatingPortal, {
1982
- children: child
1983
- }),
1984
- children: /*#__PURE__*/jsx(FloatingFocusManager, {
1985
- context: context,
1986
- modal: false,
1987
- order: ['reference', 'content'],
1988
- returnFocus: false,
1989
- children: /*#__PURE__*/jsx("div", {
1990
- ...getFloatingProps({
1991
- ref: refs.setFloating,
1992
- style: {
1993
- position: strategy,
1994
- top: isMobile ? 0 : y ?? '',
1995
- left: isMobile ? 0 : x ?? '',
1996
- zIndex: zIndices$1.popover,
1997
- ...style
1998
- }
1999
- }),
2000
- children: children
2001
- })
2002
- })
2003
- }) : /*#__PURE__*/jsx(Fragment, {});
2004
- };
2005
- const PopoverClose = ({
2006
- children,
2007
- ...props
2008
- }) => {
2009
- const {
2010
- setOpenState
2011
- } = useContext(PopoverContext);
2012
- return /*#__PURE__*/jsx(Flex, {
2013
- ...props,
2014
- onClick: () => {
2015
- if (props.onClick) props.onClick();
2016
- setOpenState(false);
2017
- },
2018
- children: children
2019
- });
2020
- };
2021
- Popover.propTypes = {
2022
- open: PropTypes.bool,
2023
- onOpenChange: PropTypes.func,
2024
- placement: PropTypes.oneOf(['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end']),
2025
- sideOffset: PropTypes.number,
2026
- hideOnScroll: PropTypes.bool
2027
- };
2028
- Popover.displayName = 'Popover';
2029
-
2030
- function extractStringFromHTML(html = '') {
2031
- const regex = />([^<>]+)</g;
2032
- return Array.from(html.matchAll(regex), m => m[1]);
2033
- }
2034
-
2035
- const {
2036
- zIndices
2037
- } = foundations;
2038
- const SelectContainer = styled('div', {
2039
- margin: 0,
2040
- flexDirection: 'column',
2041
- display: 'block',
2042
- position: 'relative',
2043
- fontFamily: 'inherit',
2044
- fontVariantNumeric: 'tabular-nums',
2045
- fontSize: '$short-content-regular',
2046
- fontWeight: '400',
2047
- textAlign: 'left',
2048
- alignItems: 'center',
2049
- letterSpacing: '$short-content-regular',
2050
- lineHeight: '$short-content-regular',
2051
- color: '$textPrimary',
2052
- width: '100%',
2053
- variants: {
2054
- mobileOnly: {
2055
- true: {
2056
- '@lg': {
2057
- display: 'none !important'
2058
- }
2059
- }
2060
- },
2061
- desktopOnly: {
2062
- true: {
2063
- display: 'none !important',
2064
- '@lg': {
2065
- display: 'block !important'
2066
- }
2067
- }
2068
- }
2069
- }
2070
- });
2071
- const SelectBox = styled(Flex, {
2072
- margin: 0,
2073
- position: 'relative',
2074
- appearance: 'none',
2075
- background: 'none',
2076
- boxSizing: 'border-box',
2077
- border: '1px solid $bgOutline',
2078
- borderRadius: '$lg',
2079
- outline: 'none',
2080
- '&:focus-within': {
2081
- border: '1px solid $primary400'
2082
- },
2083
- '&:hover': {
2084
- border: '1px solid $primary600'
2085
- },
2086
- variants: {
2087
- size: {
2088
- sm: {
2089
- height: 32
2090
- },
2091
- lg: {
2092
- height: 40
2093
- }
2094
- },
2095
- disabled: {
2096
- true: {
2097
- backgroundColor: '$formDisable',
2098
- color: '$textDisable',
2099
- cursor: 'not-allowed',
2100
- '&:hover': {
2101
- border: '1px solid $bgOutline'
2102
- },
2103
- '&:focus-within': {
2104
- border: '1px solid $bgOutline'
2105
- }
2106
- }
2107
- },
2108
- readOnly: {
2109
- true: {
2110
- backgroundColor: '$formDisable',
2111
- color: '$textPrimary',
2112
- '&:hover': {
2113
- border: '1px solid $bgOutline'
2114
- },
2115
- '&:focus-within': {
2116
- border: '1px solid $bgOutline'
2117
- }
2118
- }
2119
- },
2120
- isInvalid: {
2121
- true: {
2122
- border: '1px solid $formError',
2123
- '&:focus-within': {
2124
- border: '1px solid $formError'
2125
- },
2126
- '&:hover': {
2127
- border: '1px solid $formError'
2128
- }
2129
- }
2130
- }
2131
- }
2132
- });
2133
- const Button = styled('button', {
2134
- display: 'flex',
2135
- width: '100%',
2136
- height: '100%',
2137
- flex: 1,
2138
- minWidth: 0,
2139
- background: 'none',
2140
- outline: 'none',
2141
- border: 'none',
2142
- cursor: 'pointer',
2143
- color: '$textContent',
2144
- alignItems: 'center',
2145
- '&:disabled': {
2146
- cursor: 'not-allowed',
2147
- color: '$textDisable'
2148
- },
2149
- variants: {
2150
- size: {
2151
- sm: {
2152
- padding: '5px 16px'
2153
- },
2154
- lg: {
2155
- padding: '11px 16px 12px'
2156
- }
2157
- },
2158
- readOnly: {
2159
- true: {
2160
- color: '$textPrimary'
2161
- }
2162
- }
2163
- }
2164
- });
2165
- const Input = styled('input', {
2166
- marginLeft: '$spacing-05',
2167
- display: 'flex',
2168
- width: '100%',
2169
- height: '100%',
2170
- background: 'none',
2171
- outline: 'none',
2172
- border: 'none',
2173
- cursor: 'text',
2174
- color: '$textPrimary',
2175
- textOverflow: 'ellipsis',
2176
- whiteSpace: 'nowrap',
2177
- overflow: 'hidden',
2178
- '&:disabled': {
2179
- cursor: 'not-allowed',
2180
- color: '$textDisable'
2181
- },
2182
- '&::placeholder': {
2183
- color: '$textDisable',
2184
- opacity: 1
2185
- },
2186
- variants: {
2187
- isReadOnly: {
2188
- true: {
2189
- color: '$textPrimary'
2190
- }
2191
- }
2192
- }
2193
- });
2194
- const IconContainer = styled('div', {
2195
- flex: ' 0 0 auto',
2196
- width: 'auto',
2197
- display: 'flex',
2198
- alignItems: 'center',
2199
- paddingRight: '$spacing-05',
2200
- cursor: 'pointer',
2201
- variants: {
2202
- disabled: {
2203
- true: {
2204
- cursor: 'not-allowed'
2205
- }
2206
- }
2207
- }
2208
- });
2209
- const OptionWrapper = styled('div', {
2210
- display: 'none',
2211
- overflow: 'auto',
2212
- fontFamily: 'inherit',
2213
- fontVariantNumeric: 'tabular-nums',
2214
- fontSize: '$short-content-regular',
2215
- fontWeight: '400',
2216
- textAlign: 'left',
2217
- zIndex: 1,
2218
- borderRadius: '$sm',
2219
- backgroundColor: '$bgWhite',
2220
- boxShadow: '0px 2px 12px #00000014',
2221
- width: '100%',
2222
- maxHeight: '300px',
2223
- position: 'absolute',
2224
- float: 'left',
2225
- top: '100%',
2226
- left: '0',
2227
- variants: {
2228
- placement: {
2229
- bottom: {
2230
- top: '100%',
2231
- left: '0',
2232
- transform: 'none'
2233
- },
2234
- top: {
2235
- top: '0',
2236
- left: '0',
2237
- transform: 'translate(0, -100%)'
2238
- }
2239
- },
2240
- withFooter: {
2241
- true: {
2242
- maxHeight: 'calc(100vh - 64px - 96px)'
2243
- }
2244
- },
2245
- isMobile: {
2246
- true: {
2247
- display: 'block',
2248
- position: 'unset',
2249
- boxShadow: 'none',
2250
- inset: 'unset',
2251
- borderRadius: 'unset',
2252
- maxHeight: 'calc(100vh - 64px - 56px)'
2253
- }
2254
- }
2255
- },
2256
- defaultVariants: {
2257
- placement: 'bottom'
2258
- }
2259
- });
2260
- const SelectOption = styled('div', {
2261
- flexDirection: 'column',
2262
- display: 'block',
2263
- borderRadius: '$lg',
2264
- padding: '12px 16px',
2265
- overflowY: 'auto',
2266
- minHeight: '40px',
2267
- height: '100%'
2268
- });
2269
- const SelectItem = styled('div', {
2270
- overflow: 'hidden',
2271
- padding: '$spacing-05 0',
2272
- backgroundColor: 'rgb(235, 245, 255)',
2273
- cursor: 'pointer',
2274
- lineHeight: '20px',
2275
- '&:not(:last-child)': {
2276
- borderBottom: '1px solid $bgBorder'
2277
- },
2278
- variants: {
2279
- hasGroup: {
2280
- true: {
2281
- paddingLeft: '$spacing-06'
2282
- }
2283
- },
2284
- isGroup: {
2285
- true: {
2286
- padding: '$spacing-03 0',
2287
- borderBottom: 'none !important'
2288
- }
2289
- }
2290
- }
2291
- });
2292
- const StyledFooter = styled('div', {
2293
- position: 'sticky',
2294
- bottom: 0,
2295
- left: 0,
2296
- right: 0,
2297
- backgroundColor: '$bgWhite',
2298
- boxShadow: '0px 4px 6px #00000014',
2299
- borderTop: '1px solid $bgBorder',
2300
- pointerEvents: 'auto'
2301
- });
2302
- const StyledDiv = styled('div', {
2303
- color: '$textDisable',
2304
- display: 'flex',
2305
- alignItems: 'center'
2306
- });
2307
- const StyledText = {
2308
- whiteSpace: 'nowrap',
2309
- overflow: 'hidden',
2310
- textOverflow: 'ellipsis'
2311
- };
2312
- const SelectInputSearch = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
2313
- var {
2314
- showLeadingIcon = false,
2315
- showClearIcon = true,
2316
- disabled,
2317
- placeholder,
2318
- readOnly,
2319
- inputProps,
2320
- handleInputValue,
2321
- noStyling,
2322
- onChange
2323
- } = _a,
2324
- props = __rest(_a, ["showLeadingIcon", "showClearIcon", "disabled", "placeholder", "readOnly", "inputProps", "handleInputValue", "noStyling", "onChange"]);
2325
- const inputRef = React.useRef(null);
2326
- return jsxs(InputGroup, {
2327
- css: !noStyling && {
2328
- height: '100%',
2329
- border: 'none',
2330
- '&:hover': {
2331
- border: 'none'
2332
- }
2333
- },
2334
- disabled: disabled,
2335
- children: [jsx(InputLeftElement, {
2336
- children: showLeadingIcon && jsx(SearchOutline, {}),
2337
- css: !showLeadingIcon ? {
2338
- width: '$spacing-05',
2339
- padding: 0
2340
- } : undefined
2341
- }), jsx(Input, Object.assign({}, inputProps, props, {
2342
- placeholder: placeholder,
2343
- readOnly: readOnly,
2344
- isReadOnly: readOnly,
2345
- ref: forwardedRef,
2346
- disabled: disabled,
2347
- css: {
2348
- marginLeft: 0,
2349
- height: 'fit-content'
2350
- }
2351
- })), showClearIcon ? jsx(InputRightElement, {
2352
- children: showClearIcon && (inputProps.value || '').length > 0 && !disabled ? jsx(CloseFilled, {}) : jsx("div", {}),
2353
- onClick: e => {
2354
- if (!disabled) {
2355
- inputProps.onChange(Object.assign(Object.assign({}, e), {
2356
- target: Object.assign(Object.assign({}, e.target), {
2357
- value: ''
2358
- })
2359
- }));
2360
- if (handleInputValue) handleInputValue('');
2361
- if (inputRef.current) inputRef.current.focus();
2362
- }
2363
- }
2364
- }) : null]
2365
- });
2366
- });
2367
- function isHTMLElement(element) {
2368
- return 'offsetTop' in element;
2369
- }
2370
- const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
2371
- var {
2372
- option,
2373
- onChange,
2374
- value,
2375
- placeholder,
2376
- searchPlaceholder,
2377
- embedSearch = false,
2378
- size = 'lg',
2379
- disabled = false,
2380
- search = false,
2381
- iconColor = 'currentColor',
2382
- hideArrowicon = false,
2383
- showLeadingIcon,
2384
- placement = 'bottom',
2385
- disabledOptions,
2386
- textSelector = 'name',
2387
- valueSelector = 'value',
2388
- readOnly = false,
2389
- isInvalid = false,
2390
- noOptionIcon = false,
2391
- fetchData,
2392
- onSearch,
2393
- isLoading = false,
2394
- showTooltip = false,
2395
- css,
2396
- renderFooter,
2397
- optionCss,
2398
- emptyDataMessage,
2399
- mobileOnly,
2400
- desktopOnly,
2401
- onStateChange,
2402
- isMobile = false,
2403
- mobileTitle,
2404
- withDebounce = true,
2405
- renderAsLabel = true
2406
- } = _a,
2407
- props = __rest(_a, ["option", "onChange", "value", "placeholder", "searchPlaceholder", "embedSearch", "size", "disabled", "search", "iconColor", "hideArrowicon", "showLeadingIcon", "placement", "disabledOptions", "textSelector", "valueSelector", "readOnly", "isInvalid", "noOptionIcon", "fetchData", "onSearch", "isLoading", "showTooltip", "css", "renderFooter", "optionCss", "emptyDataMessage", "mobileOnly", "desktopOnly", "onStateChange", "isMobile", "mobileTitle", "withDebounce", "renderAsLabel"]);
2408
- const {
2409
- t
2410
- } = useTranslation(['MajooUI/inputSelect', 'translation']);
2411
- const [options, setOptions] = useState([]);
2412
- const [item, setItem] = useState([]);
2413
- const [groupedItems, setGroupedItems] = useState([]);
2414
- const [selectedValue, setSelectedValue] = useState(value);
2415
- const [selectedIndex, setSelectedIndex] = useState(0);
2416
- const [query, setQuery] = useState();
2417
- const [openOptions, setOpenOptions] = useState(false);
2418
- const [open, setOpen] = useState(false);
2419
- const selectBoxRef = useRef(null);
2420
- const scrollerRef = useRef(null);
2421
- useEffect(() => {
2422
- var _a;
2423
- if (search && Boolean(query)) {
2424
- (_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
2425
- top: 0
2426
- });
2427
- return;
2428
- }
2429
- const scrollToSelectedElement = () => {
2430
- const element = document.querySelector(`[data-index="${selectedIndex}"]`);
2431
- const scrollContainer = scrollerRef.current;
2432
- if (element && isHTMLElement(element) && scrollContainer) {
2433
- const elementPosition = element.offsetTop - scrollContainer.offsetTop;
2434
- scrollContainer.scrollTop = elementPosition;
2435
- }
2436
- };
2437
- scrollToSelectedElement();
2438
- }, [query, search, openOptions, open, selectedIndex]);
2439
- const handleInputValue = (value, isReset = false) => {
2440
- if (onSearch && !isReset) onSearch(value);
2441
- if (fetchData) return;
2442
- if (value === '') {
2443
- return setItem(options);
2444
- } else {
2445
- setItem(options.filter(item => {
2446
- const nameIsIncluded = item.name.toLowerCase().includes(value.toLocaleLowerCase());
2447
- if (item.render && isFunction$1(item.render)) {
2448
- const extractedString = item.render() ? extractStringFromHTML(renderToString(item.render())).join(',') : '';
2449
- return nameIsIncluded || extractedString.toLowerCase().includes(value.toLocaleLowerCase());
2450
- }
2451
- return nameIsIncluded;
2452
- }));
2453
- }
2454
- };
2455
- const generateOptions = (data, valueSelector = '', textSelector = '') => {
2456
- return data.map(option => {
2457
- if (typeof option === 'object') {
2458
- const name = textSelector ? option[textSelector] : Object.values(option)[0];
2459
- const value = valueSelector ? option[valueSelector] : Object.values(option)[1];
2460
- return {
2461
- name,
2462
- value,
2463
- isDisabled: option.isDisabled === undefined && disabledOptions && disabledOptions.length > 0 ? disabledOptions.includes(value) : option.isDisabled,
2464
- render: option.render,
2465
- group: option.group
2466
- };
2467
- }
2468
- return {
2469
- name: option,
2470
- value: option,
2471
- isDisabled: disabledOptions && disabledOptions.includes(option),
2472
- render: option.render,
2473
- group: option.group
2474
- };
2475
- });
2476
- };
2477
- const debouncedSearch = React.useRef(debounce(query => __awaiter(void 0, void 0, void 0, function* () {
2478
- setQuery(query);
2479
- if (onSearch) onSearch(query);
2480
- }), 1000)).current;
2481
- useEffect(() => {
2482
- var _a;
2483
- (_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
2484
- top: 0
2485
- });
2486
- }, [query]);
2487
- useEffect(() => {
2488
- setSelectedValue(value);
2489
- }, [value]);
2490
- useEffect(() => {
2491
- if (groupedItems && value) {
2492
- const itemIndex = (groupedItems.length > 0 ? groupedItems : item !== null && item !== void 0 ? item : []).findIndex(val => String(val.value) === String(value.value));
2493
- if (itemIndex >= 0) {
2494
- setSelectedIndex(itemIndex);
2495
- }
2496
- }
2497
- }, [value, groupedItems, item]);
2498
- useEffect(() => {
2499
- const generatedOption = generateOptions(option, valueSelector, textSelector);
2500
- setItem(generatedOption);
2501
- setOptions(generatedOption);
2502
- }, [option, disabledOptions, valueSelector, textSelector]);
2503
- useEffect(() => {
2504
- return () => {
2505
- debouncedSearch.cancel();
2506
- };
2507
- }, [debouncedSearch]);
2508
- useEffect(() => {
2509
- setGroupedItems(item.sort(function (a, b) {
2510
- const nameA = (typeof a.group === 'string' ? a.group.toUpperCase() : a.group) || ''; // ignore upper and lowercase
2511
- const nameB = (typeof b.group === 'string' ? b.group.toUpperCase() : b.group) || ''; // ignore upper and lowercase
2512
- if (!a.group) return 1;
2513
- if (!b.group) return -1;
2514
- if (nameA < nameB) {
2515
- return -1;
2516
- }
2517
- if (nameA > nameB) {
2518
- return 1;
2519
- }
2520
- return 0;
2521
- }).reduce((prev, current) => {
2522
- let addedGroupItems = [];
2523
- if (prev) addedGroupItems = [...prev];
2524
- const group = current.group;
2525
- if ((!prev || !prev.find(val => val.value === `#group#${group}#`)) && group) {
2526
- addedGroupItems.push({
2527
- name: group,
2528
- value: `#group#${group}#`,
2529
- isGroup: true,
2530
- render: () => jsx(Paragraph, {
2531
- color: "primary",
2532
- paragraph: "shortContentBold",
2533
- children: group
2534
- })
2535
- });
2536
- }
2537
- addedGroupItems.push(current);
2538
- return addedGroupItems;
2539
- }, []));
2540
- }, [item]);
2541
- const stateReducer = (_, changes) => {
2542
- switch (changes.type) {
2543
- case Downshift.stateChangeTypes.blurButton:
2544
- return {
2545
- isOpen: true
2546
- };
2547
- default:
2548
- return changes;
2549
- }
2550
- };
2551
- return jsx(Downshift, Object.assign({}, props, {
2552
- onChange: onChange,
2553
- itemToString: item => item ? item.name : '',
2554
- selectedItem: selectedValue !== undefined ? selectedValue : null,
2555
- onSelect: (selectedItem, _) => setSelectedValue(selectedItem),
2556
- onStateChange: state => {
2557
- if (state && (state.type === '__autocomplete_mouseup__' || String(state.type) === '1') && 'inputValue' in state) {
2558
- handleInputValue(String(state.inputValue ? state.inputValue : '').toLowerCase());
2559
- }
2560
- if (!('isOpen' in state)) return;
2561
- if (state.isOpen && embedSearch) handleInputValue('', true);
2562
- if (!state.isOpen && fetchData && query && query.length > 0 && onSearch) {
2563
- onSearch('');
2564
- setQuery('');
2565
- }
2566
- if (onStateChange) onStateChange(state);
2567
- },
2568
- stateReducer: stateReducer,
2569
- children: ({
2570
- getRootProps,
2571
- getToggleButtonProps,
2572
- getMenuProps,
2573
- getInputProps,
2574
- getItemProps,
2575
- isOpen,
2576
- selectedItem,
2577
- highlightedIndex
2578
- }) => {
2579
- var _a, _b;
2580
- const handleDownOption = () => {
2581
- if (hideArrowicon || noOptionIcon) {
2582
- return null;
2583
- }
2584
- return jsx(IconContainer, Object.assign({}, getToggleButtonProps({
2585
- disabled: disabled || readOnly
2586
- }), {
2587
- disabled: disabled,
2588
- readOnly: readOnly,
2589
- children: jsx(CaretDownOutline, {
2590
- color: readOnly ? colors$1.gray300 : iconColor
2591
- })
2592
- }));
2593
- };
2594
- setOpen(isOpen);
2595
- return !isMobile ? jsx(Popover, {
2596
- open: openOptions,
2597
- onOpenChange: setOpenOptions,
2598
- placement: placement,
2599
- hideOnScroll: true,
2600
- children: jsxs(SelectContainer, {
2601
- css: css,
2602
- ref: selectBoxRef,
2603
- mobileOnly: mobileOnly,
2604
- desktopOnly: desktopOnly,
2605
- children: [jsx(ConditionalWrapper, {
2606
- condition: showTooltip && selectedValue,
2607
- wrapper: children => jsx(Tooltip, {
2608
- color: "dark",
2609
- label: selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.name,
2610
- children: children
2611
- }),
2612
- children: jsx(PopoverTrigger, {
2613
- children: jsxs(SelectBox, Object.assign({}, getRootProps({
2614
- refKey: 'ref'
2615
- }, {
2616
- suppressRefError: true
2617
- }), {
2618
- size: size,
2619
- disabled: disabled,
2620
- readOnly: readOnly,
2621
- isInvalid: isInvalid,
2622
- children: [search && !disabled && !readOnly ? jsx(Box, {
2623
- style: {
2624
- width: '100%',
2625
- flex: 1
2626
- },
2627
- children: jsx(SelectInputSearch, {
2628
- ref: ref,
2629
- showLeadingIcon: showLeadingIcon,
2630
- showClearIcon: hideArrowicon,
2631
- disabled: disabled,
2632
- placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('placeholder', 'Pilih Item'),
2633
- readOnly: readOnly,
2634
- handleInputValue: !fetchData ? handleInputValue : query => {
2635
- if (onSearch) onSearch(query);
2636
- setQuery(query);
2637
- },
2638
- inputProps: getInputProps({
2639
- onChange: event => {
2640
- setOpenOptions(true);
2641
- if (event.type !== 'change') return;
2642
- const query = event.target.value;
2643
- if (!fetchData) handleInputValue(query);else debouncedSearch(query);
2644
- },
2645
- disabled
2646
- }),
2647
- onClick: !isOpen ? getToggleButtonProps({
2648
- disabled: disabled || readOnly
2649
- }).onClick : undefined
2650
- })
2651
- }) : jsx(Button, Object.assign({
2652
- ref: ref
2653
- }, getToggleButtonProps({
2654
- disabled: disabled || readOnly
2655
- }), {
2656
- disabled: disabled,
2657
- size: size,
2658
- readOnly: readOnly,
2659
- type: "button",
2660
- children: selectedItem ? selectedItem.render && renderAsLabel ? selectedItem.render(selectedItem) : jsx(Text, {
2661
- color: disabled ? 'disable' : 'primary',
2662
- css: StyledText,
2663
- children: selectedItem.name
2664
- }) : jsx(Text, {
2665
- color: "disable",
2666
- css: StyledText,
2667
- children: placeholder !== null && placeholder !== void 0 ? placeholder : t('placeholder', 'Pilih Item')
2668
- })
2669
- })), handleDownOption()]
2670
- }))
2671
- })
2672
- }), jsx(Portal, {
2673
- children: jsx(PopoverContent, {
2674
- style: {
2675
- width: (_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,
2676
- zIndex: zIndices.tooltip
2677
- },
2678
- children: jsxs(Fragment, {
2679
- children: [isOpen && isLoading && jsx(Flex, {
2680
- justify: "center",
2681
- align: "center",
2682
- css: {
2683
- position: 'absolute',
2684
- inset: 0,
2685
- zIndex: '$tooltip',
2686
- top: item.length > 0 ? '0px' : placement === 'top' ? '-20px' : '20px',
2687
- // bottom: '80px',
2688
- width: '100%',
2689
- height: scrollerRef.current ? scrollerRef.current.clientHeight : '40px',
2690
- backgroundColor: '$bgWhite',
2691
- opacity: 0.8,
2692
- transform: placement === 'top' ? 'translate(0, -100%)' : 'none'
2693
- },
2694
- children: jsx(Text, {
2695
- variant: "caption",
2696
- children: "Loading...."
2697
- })
2698
- }), jsx(ConditionalWrapper, {
2699
- condition: renderFooter && typeof renderFooter === 'function',
2700
- wrapper: child => jsxs(Box, {
2701
- css: {
2702
- position: 'absolute',
2703
- float: 'left',
2704
- display: isOpen ? 'block' : 'none',
2705
- zIndex: '$popover',
2706
- width: '100%'
2707
- },
2708
- children: [child, renderFooter && typeof renderFooter === 'function' && jsx(StyledFooter, {
2709
- children: renderFooter === null || renderFooter === void 0 ? void 0 : renderFooter()
2710
- })]
2711
- }),
2712
- children: jsxs(OptionWrapper, Object.assign({}, getMenuProps({
2713
- ref: scrollerRef
2714
- }, {
2715
- suppressRefError: true
2716
- }), {
2717
- css: Object.assign({
2718
- display: isOpen ? 'block' : 'none',
2719
- zIndex: '$popover',
2720
- pointerEvents: 'auto'
2721
- }, optionCss),
2722
- withFooter: renderFooter && typeof renderFooter === 'function',
2723
- placement: placement,
2724
- children: [!search && embedSearch && isOpen && jsx(SelectContainer, {
2725
- css: {
2726
- position: 'sticky',
2727
- top: 0,
2728
- zIndex: '$sticky',
2729
- padding: '$spacing-04 $spacing-05 0',
2730
- backgroundColor: '$bgWhite'
2731
- },
2732
- children: jsx(InputSearchbox, {
2733
- size: 'sm',
2734
- onChange: handleInputValue,
2735
- placeholder: searchPlaceholder !== null && searchPlaceholder !== void 0 ? searchPlaceholder : t('searchPlaceholder', 'Cari ...'),
2736
- withDebounce: withDebounce
2737
- })
2738
- }), item.length > 0 || isLoading ? jsx(ConditionalWrapper, {
2739
- condition: !!fetchData && item.length > 0,
2740
- wrapper: children => jsx(InfiniteScroll, {
2741
- loadMore: _ => {
2742
- if (!isLoading && fetchData) fetchData({
2743
- query
2744
- });
2745
- },
2746
- hasMore: true,
2747
- threshold: 5,
2748
- useWindow: false,
2749
- children: children
2750
- }),
2751
- children: jsx(PopoverClose, {
2752
- css: {
2753
- display: 'block !important'
2754
- },
2755
- children: jsx(SelectOption, {
2756
- children: (groupedItems.length > 0 ? groupedItems : item).map((item, index) => {
2757
- var _a;
2758
- return /*#__PURE__*/createElement(SelectItem, Object.assign({}, getItemProps({
2759
- item,
2760
- disabled: item.isDisabled || item.isGroup,
2761
- onClick: () => setSelectedIndex(index)
2762
- }), {
2763
- key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
2764
- hasGroup: !!item.group,
2765
- isGroup: item.isGroup,
2766
- "data-index": index,
2767
- css: Object.assign({}, !item.isGroup ? item.isDisabled ? {
2768
- backgroundColor: 'unset',
2769
- cursor: 'not-allowed',
2770
- color: '$textDisable'
2771
- } : {
2772
- backgroundColor: highlightedIndex === index ? '$bgGray' : 'white',
2773
- fontWeight: 'normal',
2774
- color: selectedItem && selectedItem.value === item.value ? '$textBrand' : '$textPrimary'
2775
- } : {
2776
- backgroundColor: 'unset',
2777
- cursor: 'default'
2778
- })
2779
- }), item.render ? item.render(selectedItem) : item.name);
2780
- })
2781
- })
2782
- })
2783
- }) : jsx(SelectOption, {
2784
- children: jsxs(StyledDiv, {
2785
- children: [jsx("div", {
2786
- style: {
2787
- marginRight: '6px'
2788
- },
2789
- children: jsx(CircleInfoOutline, {
2790
- size: "16px",
2791
- color: colors$1.iconDisable,
2792
- style: {
2793
- verticalAlign: 'text-bottom'
2794
- }
2795
- })
2796
- }), emptyDataMessage || t('noItemPlaceholder', 'Item tidak ditemukan')]
2797
- })
2798
- })]
2799
- }))
2800
- })]
2801
- })
2802
- })
2803
- })]
2804
- })
2805
- }) : jsx(SelectContainer, {
2806
- css: css,
2807
- ref: selectBoxRef,
2808
- mobileOnly: mobileOnly,
2809
- desktopOnly: desktopOnly,
2810
- children: jsxs(ConditionalWrapper, {
2811
- condition: showTooltip && selectedValue,
2812
- wrapper: children => jsx(Tooltip, {
2813
- color: "dark",
2814
- label: selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.name,
2815
- children: children
2816
- }),
2817
- children: [jsxs(SelectBox, Object.assign({}, getRootProps({
2818
- refKey: 'ref'
2819
- }, {
2820
- suppressRefError: true
2821
- }), {
2822
- size: size,
2823
- disabled: disabled,
2824
- readOnly: readOnly,
2825
- isInvalid: isInvalid,
2826
- children: [jsx(Button, Object.assign({
2827
- ref: ref
2828
- }, getToggleButtonProps({
2829
- disabled: disabled || readOnly
2830
- }), {
2831
- disabled: disabled,
2832
- size: size,
2833
- readOnly: readOnly,
2834
- type: "button",
2835
- children: selectedItem ? selectedItem.render && renderAsLabel ? selectedItem.render(selectedItem) : jsx(Text, {
2836
- color: disabled ? 'disable' : 'primary',
2837
- css: StyledText,
2838
- children: selectedItem.name
2839
- }) : jsx(Text, {
2840
- color: "disable",
2841
- css: StyledText,
2842
- children: placeholder !== null && placeholder !== void 0 ? placeholder : t('placeholder', 'Pilih Item')
2843
- })
2844
- })), handleDownOption()]
2845
- })), jsxs(ModalDialog, {
2846
- isMobile: true,
2847
- open: isOpen,
2848
- children: [jsx(ModalDialogTitle, {
2849
- children: mobileTitle || placeholder || t('placeholder', 'Pilih Item')
2850
- }), jsx(ModalDialogContent, {
2851
- css: {
2852
- padding: 0,
2853
- maxHeight: 'unset',
2854
- position: 'relative'
2855
- },
2856
- children: jsxs(Fragment, {
2857
- children: [isOpen && isLoading && jsx(Flex, {
2858
- justify: "center",
2859
- align: "center",
2860
- css: {
2861
- position: 'absolute',
2862
- inset: 0,
2863
- zIndex: '$tooltip',
2864
- top: item.length > 0 ? '0px' : placement === 'top' ? '-20px' : '20px',
2865
- // bottom: '80px',
2866
- width: '100%',
2867
- height: scrollerRef.current ? scrollerRef.current.clientHeight : '40px',
2868
- backgroundColor: '$bgWhite',
2869
- opacity: 0.8
2870
- },
2871
- children: jsx(Text, {
2872
- variant: "caption",
2873
- children: "Loading...."
2874
- })
2875
- }), jsxs(OptionWrapper, Object.assign({}, getMenuProps({
2876
- ref: scrollerRef
2877
- }, {
2878
- suppressRefError: true
2879
- }), {
2880
- css: Object.assign({
2881
- pointerEvents: 'auto'
2882
- }, optionCss),
2883
- withFooter: renderFooter && typeof renderFooter === 'function',
2884
- isMobile: true,
2885
- children: [(search || embedSearch) && isOpen && jsx(SelectContainer, {
2886
- css: {
2887
- position: 'sticky',
2888
- top: 0,
2889
- zIndex: '$sticky',
2890
- padding: '$spacing-04 $spacing-05 0',
2891
- backgroundColor: '$bgWhite'
2892
- },
2893
- children: jsx(InputSearchbox, {
2894
- size: 'sm',
2895
- onChange: handleInputValue,
2896
- placeholder: searchPlaceholder !== null && searchPlaceholder !== void 0 ? searchPlaceholder : t('searchPlaceholder', 'Cari ...'),
2897
- withDebounce: withDebounce
2898
- })
2899
- }), item.length > 0 || isLoading ? jsx(ConditionalWrapper, {
2900
- condition: !!fetchData && item.length > 0,
2901
- wrapper: children => jsx(InfiniteScroll, {
2902
- loadMore: _ => {
2903
- if (!isLoading && fetchData) fetchData({
2904
- query
2905
- });
2906
- },
2907
- hasMore: true,
2908
- threshold: 5,
2909
- useWindow: false,
2910
- children: children
2911
- }),
2912
- children: jsx(SelectOption, {
2913
- children: (groupedItems.length > 0 ? groupedItems : item).map((item, index) => {
2914
- var _a;
2915
- return /*#__PURE__*/createElement(SelectItem, Object.assign({}, getItemProps({
2916
- item,
2917
- disabled: item.isDisabled || item.isGroup
2918
- }), {
2919
- key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
2920
- isGroup: item.isGroup,
2921
- css: Object.assign({}, !item.isGroup ? item.isDisabled ? {
2922
- backgroundColor: 'unset',
2923
- cursor: 'not-allowed',
2924
- color: '$textDisable'
2925
- } : {
2926
- backgroundColor: highlightedIndex === index ? '$bgGray' : 'white',
2927
- fontWeight: 'normal',
2928
- color: selectedItem && selectedItem.value === item.value ? '$textBrand' : '$textPrimary'
2929
- } : {
2930
- backgroundColor: 'unset',
2931
- cursor: 'default'
2932
- })
2933
- }), item.render ? item.render(selectedItem) : item.name);
2934
- })
2935
- })
2936
- }) : jsx(SelectOption, {
2937
- children: jsxs(StyledDiv, {
2938
- children: [jsx("div", {
2939
- style: {
2940
- marginRight: '6px'
2941
- },
2942
- children: jsx(CircleInfoOutline, {
2943
- size: "16px",
2944
- color: colors$1.iconDisable,
2945
- style: {
2946
- verticalAlign: 'text-bottom'
2947
- }
2948
- })
2949
- }), emptyDataMessage || t('noItemPlaceholder', 'Item tidak ditemukan')]
2950
- })
2951
- }), renderFooter && typeof renderFooter === 'function' && jsx(StyledFooter, {
2952
- children: renderFooter()
2953
- })]
2954
- }))]
2955
- })
2956
- })]
2957
- })]
2958
- })
2959
- });
2960
- }
2961
- }));
2962
- });
2963
-
2964
- const StyledSeparator = styled(SeparatorPrimitive.Root, {
2965
- backgroundColor: '$gray150',
2966
- '&[data-orientation=horizontal]': {
2967
- height: 1,
2968
- width: '100%'
2969
- },
2970
- '&[data-orientation=vertical]': {
2971
- width: 1
2972
- },
2973
- variants: {
2974
- responsive: {
2975
- true: {
2976
- display: 'none',
2977
- '@md': {
2978
- display: 'block'
2979
- }
2980
- }
2981
- },
2982
- mobileOnly: {
2983
- true: {
2984
- '@lg': {
2985
- display: 'none !important'
2986
- }
2987
- }
2988
- },
2989
- desktopOnly: {
2990
- true: {
2991
- display: 'none !important',
2992
- '@lg': {
2993
- display: 'block !important'
2994
- }
2995
- }
2996
- }
2997
- }
2998
- });
2999
- const Separator = StyledSeparator;
3000
- Separator.displayName = 'Separator';
3001
-
3002
- export { Badge as B, CheckboxGroup as C, FormLabel as F, InputText as I, OptionWrapper as O, Popover as P, StyledInput as S, Tag as T, _baseGetTag as _, Separator as a, InputSearchbox as b, InputCheckbox as c, SelectContainer as d, PopoverTrigger as e, SelectBox as f, PopoverContent as g, SelectOption as h, isArray$1 as i, SelectItem as j, InputGroup as k, InputLeftElement as l, Input as m, InputRightElement as n, InputSelect as o, Tooltip as p, PopoverClose as q, _root as r, isObject_1 as s, isFunction_1 as t, _Symbol as u, isFunction$1 as v, IconContainer as w, InputPrefix as x, InputSuffix as y };