@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
@@ -0,0 +1,281 @@
1
+ import React__default, { useCallback } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
4
+ import { styled, keyframes } from '../../config/stitches.config.esm.js';
5
+ import { Button } from '../button/Button.esm.js';
6
+ import { useThemeProvider } from '@majoo-ui/helpers';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ const Context = /*#__PURE__*/React__default.createContext();
10
+ const slideUpAndFade = keyframes({
11
+ '0%': {
12
+ opacity: 0,
13
+ transform: 'translateY(2px)'
14
+ },
15
+ '100%': {
16
+ opacity: 1,
17
+ transform: 'translateY(0)'
18
+ }
19
+ });
20
+ const slideRightAndFade = keyframes({
21
+ '0%': {
22
+ opacity: 0,
23
+ transform: 'translateX(-2px)'
24
+ },
25
+ '100%': {
26
+ opacity: 1,
27
+ transform: 'translateX(0)'
28
+ }
29
+ });
30
+ const slideDownAndFade = keyframes({
31
+ '0%': {
32
+ opacity: 0,
33
+ transform: 'translateY(-2px)'
34
+ },
35
+ '100%': {
36
+ opacity: 1,
37
+ transform: 'translateY(0)'
38
+ }
39
+ });
40
+ const slideLeftAndFade = keyframes({
41
+ '0%': {
42
+ opacity: 0,
43
+ transform: 'translateX(2px)'
44
+ },
45
+ '100%': {
46
+ opacity: 1,
47
+ transform: 'translateX(0)'
48
+ }
49
+ });
50
+ const StyledContent = styled(DropdownMenuPrimitive.Content, {
51
+ width: 143,
52
+ maxWidth: 243,
53
+ backgroundColor: '$bgWhite',
54
+ borderRadius: 4,
55
+ padding: 8,
56
+ zIndex: '$sticky',
57
+ boxShadow: '0px 10px 38px -10px rgba(22, 23, 24, 0.35), 0px 10px 20px -15px rgba(22, 23, 24, 0.2)',
58
+ '@media (prefers-reduced-motion: no-preference)': {
59
+ animationDuration: '400ms',
60
+ animationTimingFunction: 'cubic-bezier(0.16, 1, 0.3, 1)',
61
+ animationFillMode: 'forwards',
62
+ willChange: 'transform, opacity',
63
+ '&[data-state="open"]': {
64
+ '&[data-side="top"]': {
65
+ animationName: slideDownAndFade
66
+ },
67
+ '&[data-side="right"]': {
68
+ animationName: slideLeftAndFade
69
+ },
70
+ '&[data-side="bottom"]': {
71
+ animationName: slideUpAndFade
72
+ },
73
+ '&[data-side="left"]': {
74
+ animationName: slideRightAndFade
75
+ }
76
+ }
77
+ }
78
+ });
79
+ const itemStyles = {
80
+ all: 'unset',
81
+ fontSize: 13,
82
+ lineHeight: 1,
83
+ borderRadius: 3,
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ height: 'calc(36px - 8px)',
87
+ padding: '8px 0',
88
+ position: 'relative',
89
+ userSelect: 'none',
90
+ '&[data-disabled]': {
91
+ color: '$gray400',
92
+ pointerEvents: 'none'
93
+ },
94
+ '&:hover': {
95
+ cursor: 'pointer'
96
+ },
97
+ '&:active': {
98
+ backgroundColor: '$gray150'
99
+ },
100
+ '&:focus': {
101
+ backgroundColor: '$gray100'
102
+ }
103
+ };
104
+ const StyledItem = styled(DropdownMenuPrimitive.Item, {
105
+ ...itemStyles
106
+ });
107
+ StyledItem.propTypes = {
108
+ asChild: PropTypes.bool,
109
+ disabled: PropTypes.bool,
110
+ onSelect: PropTypes.func
111
+ };
112
+ const StyledCheckboxItem = styled(DropdownMenuPrimitive.CheckboxItem, {
113
+ ...itemStyles
114
+ });
115
+ const StyledRadioItem = styled(DropdownMenuPrimitive.RadioItem, {
116
+ ...itemStyles
117
+ });
118
+ const StyledLabel = styled(DropdownMenuPrimitive.Label, {
119
+ padding: '8px 0',
120
+ fontSize: 12,
121
+ lineHeight: '25px',
122
+ color: '$gray700'
123
+ });
124
+ const StyledSeparator = styled(DropdownMenuPrimitive.Separator, {
125
+ height: 1,
126
+ backgroundColor: '$gray150',
127
+ margin: 5
128
+ });
129
+ const StyledItemIndicator = styled(DropdownMenuPrimitive.ItemIndicator, {
130
+ position: 'absolute',
131
+ left: 0,
132
+ width: 25,
133
+ display: 'inline-flex',
134
+ alignItems: 'center',
135
+ justifyContent: 'center'
136
+ });
137
+ const StyledArrow = styled(DropdownMenuPrimitive.Arrow, {
138
+ fill: 'white'
139
+ });
140
+ const DropdownMenuContext = ({
141
+ side,
142
+ align,
143
+ children,
144
+ ...props
145
+ }) => {
146
+ return /*#__PURE__*/jsx(DropdownMenuPrimitive.Root, {
147
+ ...props,
148
+ children: /*#__PURE__*/jsx(Context.Provider, {
149
+ value: {
150
+ side,
151
+ align
152
+ },
153
+ children: children
154
+ })
155
+ });
156
+ };
157
+ DropdownMenuContext.propTypes = {
158
+ side: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
159
+ align: PropTypes.oneOf(['start', 'center', 'end'])
160
+ };
161
+ const DropdownMenuContentContext = ({
162
+ theme,
163
+ ...props
164
+ }) => {
165
+ const {
166
+ side,
167
+ align
168
+ } = React__default.useContext(Context);
169
+ const themeProvider = useThemeProvider(theme);
170
+ const ref = useCallback(node => {
171
+ const appElement = document.getElementById('app');
172
+ if (appElement) {
173
+ if (node !== null) {
174
+ appElement.classList.add('noscroll');
175
+ } else {
176
+ appElement.classList.remove('noscroll');
177
+ }
178
+ }
179
+ }, []);
180
+ return /*#__PURE__*/jsx(StyledContent, {
181
+ className: `dropdown-content ${themeProvider?.theme || ''}`,
182
+ side: side,
183
+ align: align,
184
+ ref: ref,
185
+ ...props,
186
+ children: props.children
187
+ });
188
+ };
189
+ DropdownMenuContentContext.propTypes = {
190
+ sideOffset: PropTypes.number,
191
+ alignOffset: PropTypes.number,
192
+ asChild: PropTypes.bool
193
+ };
194
+ const DropdownTrigger = /*#__PURE__*/React__default.forwardRef(({
195
+ children,
196
+ ...props
197
+ }, ref) => {
198
+ const {
199
+ asChild,
200
+ ...rest
201
+ } = props;
202
+ return /*#__PURE__*/jsx(DropdownMenuPrimitive.Trigger, {
203
+ ...rest,
204
+ asChild: asChild,
205
+ ref: ref,
206
+ children: children && /*#__PURE__*/React__default.cloneElement(children, {
207
+ ...rest
208
+ })
209
+ });
210
+ });
211
+ DropdownTrigger.propTypes = {
212
+ asChild: PropTypes.bool
213
+ };
214
+ const RightSlot = styled('div', {
215
+ marginLeft: 'auto',
216
+ ':focus > &': {
217
+ color: 'white'
218
+ },
219
+ '[data-disabled] &': {
220
+ color: '$gray400'
221
+ }
222
+ });
223
+ const StyledDropdown = styled(Button, {
224
+ padding: '6px 12px',
225
+ '&:disabled': {
226
+ '& + div': {
227
+ display: 'none !important'
228
+ }
229
+ }
230
+ });
231
+ const ButtonDropdown = /*#__PURE__*/React__default.forwardRef((props, ref) => {
232
+ const {
233
+ ...rest
234
+ } = props;
235
+ return /*#__PURE__*/jsx(StyledDropdown, {
236
+ ref: ref,
237
+ css: rest.css,
238
+ ...rest,
239
+ children: rest.children
240
+ });
241
+ });
242
+ ButtonDropdown.propTypes = {
243
+ children: PropTypes.node.isRequired,
244
+ css: PropTypes.object,
245
+ rightIcon: PropTypes.node
246
+ };
247
+ ButtonDropdown.defaultProps = {
248
+ css: {},
249
+ rightIcon: undefined
250
+ };
251
+ ButtonDropdown.displayName = 'ButtonDropdown';
252
+ RightSlot.displayName = 'RightSlot';
253
+
254
+ // Exports
255
+ const DropdownMenu = DropdownMenuContext;
256
+ const DropdownMenuTrigger = DropdownTrigger;
257
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
258
+ const DropdownMenuContent = DropdownMenuContentContext;
259
+ const DropdownMenuItem = StyledItem;
260
+ const DropdownMenuCheckboxItem = StyledCheckboxItem;
261
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
262
+ const DropdownMenuRadioItem = StyledRadioItem;
263
+ const DropdownMenuItemIndicator = StyledItemIndicator;
264
+ // export const DropdownMenuTriggerItem = StyledTriggerItem;
265
+ const DropdownMenuLabel = StyledLabel;
266
+ const DropdownMenuSeparator = StyledSeparator;
267
+ const DropdownMenuArrow = StyledArrow;
268
+ DropdownMenu.displayName = 'DropdownMenu';
269
+ DropdownMenuTrigger.displayName = 'DropdownMenuTrigger';
270
+ DropdownMenuContent.displayName = 'DropdownMenuContent';
271
+ DropdownMenuItem.displayName = 'DropdownMenuItem';
272
+ DropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';
273
+ DropdownMenuRadioGroup.displayName = 'DropdownMenuRadioGroup';
274
+ DropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';
275
+ DropdownMenuItemIndicator.displayName = 'DropdownMenuItemIndicator';
276
+ // DropdownMenuTriggerItem.displayName = 'DropdownMenuTriggerItem';
277
+ DropdownMenuLabel.displayName = 'DropdownMenuLabel';
278
+ DropdownMenuSeparator.displayName = 'DropdownMenuSeparator';
279
+ DropdownMenuArrow.displayName = 'DropdownMenuArrow';
280
+
281
+ export { ButtonDropdown, DropdownMenu, DropdownMenuArrow, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, RightSlot, StyledDropdown };
@@ -0,0 +1,361 @@
1
+ import 'core-js/modules/es.array.includes.js';
2
+ import 'core-js/modules/es.iterator.constructor.js';
3
+ import 'core-js/modules/es.iterator.filter.js';
4
+ import 'core-js/modules/es.iterator.map.js';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import React__default, { useEffect, createElement } from 'react';
7
+ import { ChevronUpOutline, ChevronDownOutline } from '@majoo-ui/icons';
8
+ import { styled } from '../../config/stitches.config.esm.js';
9
+ import Heading from '../heading/Heading.esm.js';
10
+ import Box from '../../layout/box/Box.esm.js';
11
+ import Flex from '../../layout/flex/Flex.esm.js';
12
+ import { Grid, GridItem } from '../../layout/grid/Grid.esm.js';
13
+ import Collapalse from './transition.esm.js';
14
+ import { TableHeaderCellContainer, TableHeadCellContent } from '../table/Table.esm.js';
15
+ import { useTranslation } from 'react-i18next';
16
+
17
+ const TableContainer = styled('div', {
18
+ display: 'block',
19
+ flexDirection: 'column',
20
+ maxWidth: '100%',
21
+ position: 'relative',
22
+ height: '100%'
23
+ });
24
+ const TableContent = styled('table', {
25
+ width: '100%',
26
+ borderSpacing: 0,
27
+ borderCollapse: 'collapse'
28
+ });
29
+ const TableHead = styled('thead', {
30
+ position: 'sticky',
31
+ top: 0,
32
+ backgroundColor: '$gray50',
33
+ boxShadow: '0 4px 4px rgba(0, 0, 0, 0.025)',
34
+ zIndex: 10
35
+ });
36
+ const TableHeadRow = styled('tr', {
37
+ borderBottom: '1pt solid $bgBorder'
38
+ });
39
+ const TableHeadCell = styled('th', {
40
+ height: '41px',
41
+ fontSize: '$header-table',
42
+ fontWeight: 600,
43
+ color: '$textSecondary',
44
+ textAlign: 'left',
45
+ paddingLeft: 8
46
+ });
47
+ const TableBody = styled('tbody', {});
48
+ const TableRow = styled('tr', {
49
+ '&:hover': {
50
+ backgroundColor: '$bgGray'
51
+ }
52
+ });
53
+ const TableRowCollapse = styled('tr', {
54
+ borderBottom: '1pt solid $bgBorder',
55
+ '&:hover': {
56
+ backgroundColor: '$bgGray'
57
+ }
58
+ });
59
+ const TableCell = styled('td', {
60
+ fontSize: '$short-content-regular',
61
+ lineHeight: '$short-content-regular',
62
+ letterSpacing: '$short-content-regular',
63
+ fontWeight: 400,
64
+ color: '$textPrimary',
65
+ position: 'relative',
66
+ paddingLeft: 8,
67
+ '&:last-child': {
68
+ paddingRight: 8
69
+ }
70
+ });
71
+ const TableFoot = styled('tfoot', {
72
+ position: 'sticky',
73
+ bottom: 0,
74
+ backgroundColor: '$bgWhite'
75
+ });
76
+ const TableFootRow = styled('tr');
77
+ const TableFootCell = styled('td', {});
78
+ const TableCellCollapse = styled('td', {
79
+ fontSize: '$short-content-regular',
80
+ lineHeight: '$short-content-regular',
81
+ letterSpacing: '$short-content-regular',
82
+ fontWeight: 400,
83
+ color: '$textPrimary',
84
+ position: 'relative',
85
+ '&:not(:last-child)': {
86
+ paddingRight: 16
87
+ }
88
+ });
89
+ const Required = styled('span', {
90
+ marginLeft: 4,
91
+ color: '$textRed !important'
92
+ });
93
+ function EditableTableMobile(props) {
94
+ var _a, _b;
95
+ const {
96
+ rowVirtualizer,
97
+ tableContainerRef,
98
+ instance,
99
+ showCheckbox,
100
+ customRows,
101
+ onExpand,
102
+ hiddenColumns,
103
+ customEmptyDataProps,
104
+ virtualized
105
+ } = props;
106
+ const {
107
+ getTableProps,
108
+ getTableBodyProps,
109
+ headerGroups,
110
+ rows,
111
+ prepareRow,
112
+ state,
113
+ toggleAllRowsExpanded,
114
+ setHiddenColumns
115
+ } = instance;
116
+ const {
117
+ t
118
+ } = useTranslation('MajooUI/table');
119
+ useEffect(() => {
120
+ if (hiddenColumns === null || hiddenColumns === void 0 ? void 0 : hiddenColumns.length) {
121
+ setHiddenColumns(hiddenColumns);
122
+ }
123
+ }, [hiddenColumns, setHiddenColumns]);
124
+ const getCustomRows = (row, renderRow) => {
125
+ var _a, _b;
126
+ let customStyle = {};
127
+ let CustomRow;
128
+ let showInMobile = false;
129
+ if (customRows && customRows(row).length) {
130
+ for (let i = 0; i < customRows(row).length; i++) {
131
+ if ((_a = customRows(row)[i]) === null || _a === void 0 ? void 0 : _a.showInMobile) {
132
+ showInMobile = true;
133
+ }
134
+ if (customRows(row)[i].predicate) {
135
+ customStyle = (_b = customRows(row)[i]) === null || _b === void 0 ? void 0 : _b.css;
136
+ CustomRow = () => {
137
+ var _a;
138
+ return (_a = customRows(row)[i]) === null || _a === void 0 ? void 0 : _a.Row(row.values, renderRow);
139
+ };
140
+ }
141
+ }
142
+ }
143
+ return {
144
+ CustomRow,
145
+ customStyle,
146
+ showInMobile
147
+ };
148
+ };
149
+ const renderTableRow = (row, customStyle) => {
150
+ var _a;
151
+ return jsxs(Fragment, {
152
+ children: [jsx(TableRow, Object.assign({
153
+ css: customStyle
154
+ }, row.getRowProps(), {
155
+ children: row.cells.map((cell, index) => {
156
+ var _a, _b;
157
+ const isMobileHeader = (_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.isMobileHeader;
158
+ const isSelector = ((_b = cell === null || cell === void 0 ? void 0 : cell.column) === null || _b === void 0 ? void 0 : _b.id) === 'selection';
159
+ return (isMobileHeader || isSelector) && (/*#__PURE__*/createElement(TableCell, Object.assign({}, cell.getCellProps({
160
+ style: {
161
+ minWidth: cell.column.minWidth,
162
+ width: isSelector ? 10 : cell.column.width,
163
+ maxWidth: isSelector ? 10 : cell.column.maxWidth
164
+ }
165
+ }), {
166
+ key: `cell-body-${index}`
167
+ }), jsxs(Flex, {
168
+ align: "center",
169
+ justify: "between",
170
+ css: {
171
+ cursor: 'pointer',
172
+ minHeight: 40
173
+ },
174
+ children: [jsx(Box, {
175
+ children: cell.render('Cell')
176
+ }), !isSelector && jsx(Flex, {
177
+ justify: "center",
178
+ align: "center",
179
+ onClick: () => {
180
+ var _a;
181
+ if (!((_a = Object.keys(state.expanded)) === null || _a === void 0 ? void 0 : _a.includes(row.id))) {
182
+ toggleAllRowsExpanded(false);
183
+ }
184
+ row.toggleRowExpanded(!row.isExpanded);
185
+ onExpand === null || onExpand === void 0 ? void 0 : onExpand(!row.isExpanded);
186
+ },
187
+ children: row.isExpanded ? jsx(ChevronUpOutline, {}) : jsx(ChevronDownOutline, {})
188
+ })]
189
+ })));
190
+ })
191
+ })), jsxs(TableRowCollapse, {
192
+ css: {
193
+ backgroundColor: '$gray50'
194
+ },
195
+ children: [showCheckbox && jsx(TableCell, {}), jsx(TableCellCollapse, {
196
+ children: jsx(Collapalse, {
197
+ isOpen: row.isExpanded,
198
+ children: jsx(Flex, {
199
+ direction: "column",
200
+ css: {
201
+ borderTop: '1pt solid $bgBorder'
202
+ },
203
+ children: row.cells.filter(cell => {
204
+ var _a, _b, _c, _d;
205
+ return typeof ((_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.hidden) === 'boolean' ? !((_b = cell === null || cell === void 0 ? void 0 : cell.column) === null || _b === void 0 ? void 0 : _b.hidden) : !((_d = (_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.hidden) === null || _d === void 0 ? void 0 : _d.call(_c, cell));
206
+ }).map((cell, index) => {
207
+ var _a, _b, _c, _d;
208
+ const headerRender = (_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.Header;
209
+ const isMobileHeader = (_b = cell === null || cell === void 0 ? void 0 : cell.column) === null || _b === void 0 ? void 0 : _b.isMobileHeader;
210
+ const isSelector = ((_c = cell === null || cell === void 0 ? void 0 : cell.column) === null || _c === void 0 ? void 0 : _c.id) === 'selection';
211
+ return !isMobileHeader && !isSelector && jsx(Flex, {
212
+ direction: "column",
213
+ justify: "center",
214
+ css: {
215
+ borderBottom: '1pt solid $bgBorder',
216
+ padding: '10px 12px',
217
+ minHeight: 52
218
+ },
219
+ children: jsxs(Grid, {
220
+ columns: 6,
221
+ flow: "row",
222
+ css: {
223
+ gridRowGap: '$spacing-04',
224
+ gridColumnGap: '$spacing-04',
225
+ alignItems: 'center'
226
+ },
227
+ children: [jsx(GridItem, {
228
+ colSpan: 3,
229
+ children: jsx(Heading, {
230
+ heading: "headerTable",
231
+ color: "secondary",
232
+ children: typeof headerRender === 'string' ? jsxs(Fragment, {
233
+ children: [headerRender === null || headerRender === void 0 ? void 0 : headerRender.toUpperCase(), ((_d = cell === null || cell === void 0 ? void 0 : cell.column) === null || _d === void 0 ? void 0 : _d.isRequired) ? jsx(Required, {
234
+ children: "*"
235
+ }) : '']
236
+ }) : headerRender
237
+ })
238
+ }), jsx(GridItem, {
239
+ colSpan: 3,
240
+ children: jsx(Flex, {
241
+ justify: "end",
242
+ children: cell.render('Cell')
243
+ })
244
+ })]
245
+ })
246
+ }, `cell-collapse-${index}`);
247
+ })
248
+ })
249
+ })
250
+ })]
251
+ }, 'row-collapse-' + ((_a = row.getRowProps()) === null || _a === void 0 ? void 0 : _a.key))]
252
+ });
253
+ };
254
+ const {
255
+ virtualItems: virtualRows,
256
+ totalSize
257
+ } = rowVirtualizer;
258
+ const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _a === void 0 ? void 0 : _a.start) || 0 : 0;
259
+ const paddingBottom = virtualRows.length > 0 ? totalSize - (((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0) : 0;
260
+ const tableRowData = virtualized ? virtualRows : rows;
261
+ return jsx(TableContainer, {
262
+ ref: tableContainerRef,
263
+ css: props === null || props === void 0 ? void 0 : props.css,
264
+ children: jsxs(TableContent, Object.assign({}, getTableProps(), {
265
+ children: [jsx(TableHead, {
266
+ children: headerGroups.map((headerGroup, index) => {
267
+ const visibleHeaders = headerGroup.headers.filter(column => {
268
+ var _a;
269
+ return typeof (column === null || column === void 0 ? void 0 : column.hidden) === 'boolean' ? !(column === null || column === void 0 ? void 0 : column.hidden) : !((_a = column === null || column === void 0 ? void 0 : column.hidden) === null || _a === void 0 ? void 0 : _a.call(column, column));
270
+ });
271
+ return /*#__PURE__*/createElement(TableHeadRow, Object.assign({}, headerGroup.getHeaderGroupProps(), {
272
+ key: `head-row-${index}`
273
+ }), visibleHeaders.map((column, index) => {
274
+ const isMobileHeader = column === null || column === void 0 ? void 0 : column.isMobileHeader;
275
+ const isSelector = (column === null || column === void 0 ? void 0 : column.id) === 'selection';
276
+ const headerRender = column.render('Header');
277
+ return (isMobileHeader || isSelector) && (/*#__PURE__*/createElement(TableHeadCell, Object.assign({}, column.getHeaderProps(props => [props, column.sortable ? column.getSortByToggleProps({
278
+ title: t('sortColumnTitle', 'Urutkan') || 'Urutkan'
279
+ }) : {
280
+ onClick: column.onToggle
281
+ }, {
282
+ style: {
283
+ minWidth: column.minWidth,
284
+ width: isSelector ? 10 : column.width,
285
+ maxWidth: isSelector ? 10 : column.maxWidth
286
+ }
287
+ }]), {
288
+ key: `head-cell-${index}`
289
+ }), typeof headerRender === 'string' ? jsx(TableHeaderCellContainer, {
290
+ isMobile: true,
291
+ isSortedDesc: column.isSortedDesc,
292
+ unsortable: !column.sortable,
293
+ isToggleable: !!column.onToggle,
294
+ isToggled: column.isToggled,
295
+ css: {
296
+ padding: 0
297
+ },
298
+ children: jsxs(TableHeadCellContent, {
299
+ heading: "headerTable",
300
+ children: [headerRender.toUpperCase(), (column === null || column === void 0 ? void 0 : column.isRequired) ? jsx(Required, {
301
+ children: "*"
302
+ }) : '']
303
+ })
304
+ }) : jsxs(Fragment, {
305
+ children: [headerRender, (column === null || column === void 0 ? void 0 : column.isRequired) ? jsx(Required, {
306
+ children: "*"
307
+ }) : '']
308
+ })));
309
+ }));
310
+ })
311
+ }), jsxs(TableBody, Object.assign({}, getTableBodyProps(), {
312
+ children: [virtualized && paddingTop > 0 && jsx("tr", {
313
+ children: jsx("td", {
314
+ style: {
315
+ height: `${paddingTop}px`
316
+ }
317
+ })
318
+ }), tableRowData === null || tableRowData === void 0 ? void 0 : tableRowData.map((dataRow, index) => {
319
+ const row = virtualized ? rows === null || rows === void 0 ? void 0 : rows[dataRow === null || dataRow === void 0 ? void 0 : dataRow.index] : dataRow;
320
+ prepareRow(row);
321
+ const {
322
+ customStyle
323
+ } = getCustomRows(row);
324
+ const {
325
+ CustomRow,
326
+ showInMobile
327
+ } = getCustomRows(row, () => renderTableRow(row, customStyle));
328
+ return jsx(React__default.Fragment, {
329
+ children: CustomRow && showInMobile ? jsx(CustomRow, {
330
+ style: customStyle
331
+ }) : renderTableRow(row, customStyle)
332
+ }, index);
333
+ }), virtualized && paddingBottom > 0 && jsx("tr", {
334
+ children: jsx("td", {
335
+ style: {
336
+ height: `${paddingBottom}px`
337
+ }
338
+ })
339
+ })]
340
+ })), rows.length < 1 && jsx(TableFoot, {
341
+ children: jsx(TableFootRow, {
342
+ children: jsx(TableFootCell, {
343
+ colSpan: "100%",
344
+ children: jsxs(Flex, {
345
+ align: "center",
346
+ justify: "center",
347
+ direction: "column",
348
+ gap: 3,
349
+ css: {
350
+ margin: '56px auto 100px'
351
+ },
352
+ children: [customEmptyDataProps.doodleImage, customEmptyDataProps.title, customEmptyDataProps.description]
353
+ })
354
+ })
355
+ })
356
+ })]
357
+ }))
358
+ });
359
+ }
360
+
361
+ export { EditableTableMobile as default };