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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/charts.esm.js +3 -1453
  2. package/colors/Colors.esm.js +93 -0
  3. package/components/accordion/Accordion.esm.js +109 -0
  4. package/components/alertDialog/AlertDialog.esm.js +440 -0
  5. package/components/avatar/Avatar.esm.js +83 -0
  6. package/components/badge/Badge.esm.js +255 -0
  7. package/components/banner/Banner.esm.js +341 -0
  8. package/components/barChart/BarChart.esm.js +212 -0
  9. package/components/breadcrumb/Breadcrumb.esm.js +65 -0
  10. package/components/breadcrumb/index.esm.js +19 -0
  11. package/components/button/Button.esm.js +331 -0
  12. package/components/buttonGroup/ButtonGroup.esm.js +350 -0
  13. package/components/card/Card.esm.js +236 -0
  14. package/components/chart/assets/data_kosong.png.esm.js +3 -0
  15. package/components/chart/lineChart/LineChart.esm.js +358 -0
  16. package/components/chart/lineChart/components/Comparator.esm.js +82 -0
  17. package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
  18. package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
  19. package/components/chart/lineChart/components/ProductList.esm.js +78 -0
  20. package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
  21. package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
  22. package/components/chart/utils/index.esm.js +109 -0
  23. package/components/checkboxTable/CheckboxTable.esm.js +287 -0
  24. package/components/colorPicker/ColorPicker.esm.js +342 -0
  25. package/components/colorPicker/InputColorPicker.esm.js +120 -0
  26. package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
  27. package/components/colorPicker/components/ColorFields.esm.js +144 -0
  28. package/components/colorPicker/components/ColorMap.esm.js +1188 -0
  29. package/components/contentEditor/ContentEditor.esm.js +251 -0
  30. package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
  31. package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
  32. package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
  33. package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
  34. package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
  35. package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
  36. package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
  37. package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
  38. package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
  39. package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
  40. package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
  41. package/components/contextMenu/ContextMenu.esm.js +298 -0
  42. package/components/datePicker/AdvancedOption.esm.js +37 -0
  43. package/components/datePicker/CustomDatePicker.esm.js +121 -0
  44. package/components/datePicker/DatePicker.esm.js +244 -0
  45. package/components/datePicker/DatePickerMulti.esm.js +70 -0
  46. package/components/datePicker/InputDatePicker.esm.js +290 -0
  47. package/components/datePicker/InputDateRangePicker.esm.js +174 -0
  48. package/components/datePicker/components/Calendar.esm.js +654 -0
  49. package/components/datePicker/components/CalendarMulti.esm.js +407 -0
  50. package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
  51. package/components/datePicker/components/DateNumber.esm.js +89 -0
  52. package/components/datePicker/components/MobileCalendar.esm.js +522 -0
  53. package/components/datePicker/state/reducer.esm.js +286 -0
  54. package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
  55. package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
  56. package/components/devicePreview/DevicePreview.esm.js +631 -0
  57. package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
  58. package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
  59. package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
  60. package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
  61. package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
  62. package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
  63. package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
  64. package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
  65. package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
  66. package/components/dialog/Dialog.esm.js +106 -0
  67. package/components/drawer/Drawer.esm.js +294 -0
  68. package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
  69. package/components/editableTable/EditableMobile.esm.js +361 -0
  70. package/components/editableTable/EditableTable.esm.js +618 -0
  71. package/components/editableTable/transition.esm.js +37 -0
  72. package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
  73. package/components/form/components/FormHelper/Helper.esm.js +50 -0
  74. package/components/form/components/FormLabel/Label.esm.js +90 -0
  75. package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
  76. package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
  77. package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
  78. package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
  79. package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
  80. package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
  81. package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
  82. package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
  83. package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
  84. package/components/form/components/InputElement/InputElement.esm.js +35 -0
  85. package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
  86. package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
  87. package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
  88. package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
  89. package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
  90. package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
  91. package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
  92. package/components/form/components/InputRadio/context.esm.js +5 -0
  93. package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
  94. package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
  95. package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
  96. package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
  97. package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
  98. package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
  99. package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
  100. package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
  101. package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
  102. package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
  103. package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
  104. package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
  105. package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
  106. package/components/form/components/InputTags/InputTags.esm.js +268 -0
  107. package/components/form/components/InputText/InputText.esm.js +197 -0
  108. package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
  109. package/components/heading/Heading.esm.js +64 -0
  110. package/components/iconButton/IconButton.esm.js +71 -0
  111. package/components/image/Image.esm.js +141 -0
  112. package/components/link/Link.esm.js +59 -0
  113. package/components/loadingBar/LoadingBar.esm.js +113 -0
  114. package/components/mapPicker/InputMapPicker.esm.js +160 -0
  115. package/components/mapPicker/MapPicker.esm.js +122 -0
  116. package/components/mapPicker/MapPicker.styles.esm.js +70 -0
  117. package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
  118. package/components/mapPicker/components/AddressCard.esm.js +25 -0
  119. package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
  120. package/components/mapPicker/components/ChangeView.esm.js +20 -0
  121. package/components/mapPicker/components/InputSearch.esm.js +74 -0
  122. package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
  123. package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
  124. package/components/mapPicker/components/ZoomControls.esm.js +36 -0
  125. package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
  126. package/components/modalDialog/ModalDialog.esm.js +247 -0
  127. package/components/notificationBadge/NotificationBadge.esm.js +149 -0
  128. package/components/pageDialog/PageDialog.esm.js +291 -0
  129. package/components/pageDialog/logo.svg.esm.js +3 -0
  130. package/components/pagination/Pagination.esm.js +94 -0
  131. package/components/pagination/PaginationButton.esm.js +346 -0
  132. package/components/pagination/PaginationInfo.esm.js +146 -0
  133. package/components/paper/Paper.esm.js +76 -0
  134. package/components/paragraph/Paragraph.esm.js +52 -0
  135. package/components/pieChart/PieChart.esm.js +287 -0
  136. package/components/popover/Popover.esm.js +142 -0
  137. package/components/progress/Progress.esm.js +170 -0
  138. package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
  139. package/components/scrollSync/ScrollSync.esm.js +172 -0
  140. package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
  141. package/components/scrollSync/utils.esm.js +9 -0
  142. package/components/separator/Separator.esm.js +43 -0
  143. package/components/skeleton/Skeleton.esm.js +131 -0
  144. package/components/slider/Slider.esm.js +345 -0
  145. package/components/stepWizard/StepWizard.esm.js +451 -0
  146. package/components/stepWizard/index.esm.js +14 -0
  147. package/components/table/MobileTable.esm.js +415 -0
  148. package/components/table/Table.esm.js +1472 -0
  149. package/components/table/components/columns/DateColumn.esm.js +26 -0
  150. package/components/table/components/columns/DecimalColumn.esm.js +36 -0
  151. package/components/table/components/columns/PriceColumn.esm.js +57 -0
  152. package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
  153. package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
  154. package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
  155. package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
  156. package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
  157. package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
  158. package/components/table/images/img-emptydata.webp.esm.js +3 -0
  159. package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
  160. package/components/tableOfContent/TableOfContent.esm.js +267 -0
  161. package/components/tableOfContent/index.esm.js +18 -0
  162. package/components/tableOfContent/transition.esm.js +38 -0
  163. package/components/tabs/Tabs.esm.js +282 -0
  164. package/components/tag/Tag.esm.js +161 -0
  165. package/components/tagList/TagList.esm.js +90 -0
  166. package/components/tagStatus/TagStatus.esm.js +134 -0
  167. package/components/text/Text.esm.js +140 -0
  168. package/components/toast/Toast.esm.js +297 -0
  169. package/components/toast/ToastContainer.esm.js +73 -0
  170. package/components/toast/context/ToastContext.esm.js +5 -0
  171. package/components/toast/context/ToastProvider.esm.js +96 -0
  172. package/components/tooltip/Tooltip.esm.js +175 -0
  173. package/components/upload/Upload.esm.js +1103 -0
  174. package/components/upload/utils/canvasPreview.esm.js +39 -0
  175. package/components/upload/utils/imgPreview.esm.js +21 -0
  176. package/config/stitches.config.esm.js +216 -0
  177. package/editor.esm.js +1 -264
  178. package/hooks/useListOption/useListOption.esm.js +56 -0
  179. package/hooks/useToggle/useToggle.esm.js +8 -0
  180. package/index.esm.js +106 -42293
  181. package/layout/box/Box.esm.js +24 -0
  182. package/layout/flex/Flex.esm.js +135 -0
  183. package/layout/grid/Grid.esm.js +270 -0
  184. package/layout/pageContainer/PageContainer.esm.js +60 -0
  185. package/majoo-provider/MajooProvider.esm.js +42 -0
  186. package/majoo-provider/ThemeProvider.esm.js +41 -0
  187. package/majoo-provider/globalStyles.esm.js +242 -0
  188. package/majoo-provider/styles/modern-normalize.esm.js +95 -0
  189. package/map.esm.js +2 -734
  190. package/package.json +8 -4
  191. package/utils/calendar.esm.js +26 -0
  192. package/utils/element.esm.js +21 -0
  193. package/utils/object.esm.js +12 -0
  194. package/utils/request.esm.js +74 -0
  195. package/utils/strings.esm.js +6 -0
  196. package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
  197. package/utils/useNavigatorOnline.esm.js +19 -0
  198. package/utils/variant.esm.js +12 -0
  199. package/wrapper/ConditionalWrapper.esm.js +9 -0
  200. package/ModalDialog.esm.js +0 -2669
  201. package/Separator.esm.js +0 -3002
  202. package/stitches.config.esm.js +0 -2284
  203. package/{index.esm.css → charts.esm.css} +4 -4
@@ -0,0 +1,287 @@
1
+ import 'core-js/modules/es.iterator.constructor.js';
2
+ import 'core-js/modules/es.iterator.map.js';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { cloneElement } from 'react';
5
+ import { styled, colors } from '../../config/stitches.config.esm.js';
6
+ import Box from '../../layout/box/Box.esm.js';
7
+ import Flex from '../../layout/flex/Flex.esm.js';
8
+ import useMediaQuery from '../../utils/useMediaQuery.esm.js';
9
+
10
+ const Container = styled(Flex, {
11
+ gap: '$spacing-05'
12
+ });
13
+ const Status = styled('div', {
14
+ width: 16,
15
+ height: 16,
16
+ background: '$bgWhite',
17
+ borderWidth: 4,
18
+ borderStyle: 'solid',
19
+ borderColor: '$primary500',
20
+ borderRadius: 50,
21
+ boxSizing: 'border-box',
22
+ position: 'relative',
23
+ variants: {
24
+ state: {
25
+ active: {
26
+ borderColor: '$primary500'
27
+ },
28
+ inActive: {
29
+ borderColor: '$gray150'
30
+ },
31
+ error: {
32
+ borderColor: '$red400'
33
+ }
34
+ },
35
+ completed: {
36
+ true: {
37
+ backgroundColor: '$primary500'
38
+ }
39
+ },
40
+ withIcon: {
41
+ true: {
42
+ display: 'flex',
43
+ justifyContent: 'center',
44
+ alignItems: 'center',
45
+ width: 40,
46
+ height: 40,
47
+ borderWidth: 2
48
+ }
49
+ }
50
+ }
51
+ });
52
+ const Title = styled('p', {
53
+ fontStyle: 'normal',
54
+ fontSize: 14,
55
+ color: '$textPrimary',
56
+ margin: 0,
57
+ zIndex: 10,
58
+ variants: {
59
+ state: {
60
+ active: {
61
+ fontWeight: 600
62
+ },
63
+ inActive: {
64
+ fontWeight: 400
65
+ },
66
+ error: {
67
+ fontWeight: 400
68
+ }
69
+ }
70
+ }
71
+ });
72
+ const Line = styled('span', {
73
+ width: '100%',
74
+ height: 2,
75
+ backgroundColor: '$primary500',
76
+ variants: {
77
+ state: {
78
+ active: {
79
+ backgroundColor: '$primary500'
80
+ },
81
+ inActive: {
82
+ backgroundColor: '$gray150'
83
+ },
84
+ error: {
85
+ backgroundColor: '$red400'
86
+ }
87
+ },
88
+ withIcon: {
89
+ true: {
90
+ width: 'calc(100% - 40px)'
91
+ }
92
+ }
93
+ }
94
+ });
95
+ const SvgCheckFilled = () => jsx("svg", {
96
+ width: "24",
97
+ height: "24",
98
+ viewBox: "0 0 24 24",
99
+ fill: "none",
100
+ xmlns: "http://www.w3.org/2000/svg",
101
+ children: jsx("path", {
102
+ d: "M5 11.5L10 16.5L19 7.5",
103
+ stroke: "white",
104
+ strokeWidth: "2",
105
+ strokeLinecap: "round",
106
+ strokeLinejoin: "round"
107
+ })
108
+ });
109
+ function ProgressIndicator(props) {
110
+ var _a;
111
+ const {
112
+ progressList,
113
+ progress,
114
+ progressError,
115
+ direction = 'horizontal',
116
+ width,
117
+ gap = 80
118
+ } = props;
119
+ const isMobile = useMediaQuery('(max-width: 767px)');
120
+ const isIcon = Boolean((_a = progressList === null || progressList === void 0 ? void 0 : progressList[0]) === null || _a === void 0 ? void 0 : _a.icon);
121
+ function getState(itemProgress) {
122
+ if (itemProgress === progressError) {
123
+ return 'error';
124
+ } else {
125
+ if (itemProgress <= progress) {
126
+ return 'active';
127
+ } else {
128
+ return 'inActive';
129
+ }
130
+ }
131
+ }
132
+ function renderIcon(item) {
133
+ const isCompleted = (item === null || item === void 0 ? void 0 : item.progress) < progress && (item === null || item === void 0 ? void 0 : item.progress) !== progressError;
134
+ const state = getState(item === null || item === void 0 ? void 0 : item.progress);
135
+ const getColor = state => {
136
+ switch (state) {
137
+ case 'error':
138
+ return colors.red400;
139
+ case 'active':
140
+ return colors.primary500;
141
+ default:
142
+ return colors.gray150;
143
+ }
144
+ };
145
+ const iconProps = {
146
+ size: 24,
147
+ color: getColor(state)
148
+ };
149
+ return isCompleted ? jsx(SvgCheckFilled, {}) : /*#__PURE__*/cloneElement(item === null || item === void 0 ? void 0 : item.icon, iconProps);
150
+ }
151
+ function renderHorizontalIndicator() {
152
+ return jsx(Container, {
153
+ direction: "column",
154
+ children: jsx(Flex, {
155
+ css: {
156
+ margin: '0px 8px',
157
+ '@md': {
158
+ margin: '0px 4px'
159
+ },
160
+ '& > div:not(:first-child):not(:last-child)': {
161
+ '.title-progress': {
162
+ display: 'flex',
163
+ justifyContent: 'center'
164
+ }
165
+ },
166
+ '& > div:first-child': {
167
+ '.title-progress': {
168
+ display: 'flex',
169
+ justifyContent: 'start',
170
+ left: '-10%',
171
+ right: `-${isIcon ? 500 : 3000}%`
172
+ }
173
+ },
174
+ '& > div:last-child': {
175
+ '.title-progress': {
176
+ display: 'flex',
177
+ justifyContent: 'end',
178
+ right: '-10%',
179
+ left: `-${isIcon ? 500 : 3000}%`
180
+ }
181
+ }
182
+ },
183
+ justify: "between",
184
+ children: progressList === null || progressList === void 0 ? void 0 : progressList.map((item, index) => {
185
+ var _a;
186
+ const isCompleted = (item === null || item === void 0 ? void 0 : item.progress) < progress && (item === null || item === void 0 ? void 0 : item.progress) !== progressError;
187
+ return jsxs(Flex, {
188
+ align: "center",
189
+ css: {
190
+ flex: (progressList === null || progressList === void 0 ? void 0 : progressList.length) !== index + 1 ? 1 : 0,
191
+ paddingTop: 45
192
+ },
193
+ children: [jsxs(Status, {
194
+ state: getState(item === null || item === void 0 ? void 0 : item.progress),
195
+ withIcon: isIcon,
196
+ completed: isCompleted,
197
+ children: [isIcon && renderIcon(item), jsx(Box, {
198
+ className: "title-progress",
199
+ css: {
200
+ position: 'absolute',
201
+ top: -45,
202
+ left: `-${isIcon ? 250 : 2000}%`,
203
+ right: `-${isIcon ? 250 : 2000}%`
204
+ },
205
+ children: jsx(Title, {
206
+ css: {
207
+ opacity: isMobile && (item === null || item === void 0 ? void 0 : item.progress) !== progress ? 0 : 1
208
+ },
209
+ state: getState(item === null || item === void 0 ? void 0 : item.progress),
210
+ children: typeof (item === null || item === void 0 ? void 0 : item.title) === 'function' ? (_a = item === null || item === void 0 ? void 0 : item.title) === null || _a === void 0 ? void 0 : _a.call(item) : item === null || item === void 0 ? void 0 : item.title
211
+ }, index)
212
+ })]
213
+ }), jsx(Line, {
214
+ state: getState((item === null || item === void 0 ? void 0 : item.progress) + 1),
215
+ withIcon: isIcon,
216
+ css: {
217
+ display: (progressList === null || progressList === void 0 ? void 0 : progressList.length) === index + 1 ? 'none' : 'unset'
218
+ }
219
+ })]
220
+ }, index);
221
+ })
222
+ })
223
+ });
224
+ }
225
+ function renderVerticalIndicator() {
226
+ return jsx(Container, {
227
+ direction: "column",
228
+ children: jsx(Flex, {
229
+ align: "start",
230
+ direction: "column",
231
+ css: {
232
+ margin: '$spacing-01'
233
+ },
234
+ justify: "between",
235
+ children: progressList === null || progressList === void 0 ? void 0 : progressList.map((item, index) => {
236
+ var _a;
237
+ const isCompleted = (item === null || item === void 0 ? void 0 : item.progress) < progress && (item === null || item === void 0 ? void 0 : item.progress) !== progressError;
238
+ return jsxs(Flex, {
239
+ direction: "column",
240
+ align: "center",
241
+ css: {
242
+ flex: (progressList === null || progressList === void 0 ? void 0 : progressList.length) !== index + 1 ? 1 : 0
243
+ },
244
+ children: [jsxs(Status, {
245
+ css: {
246
+ borderWidth: 1,
247
+ height: 8,
248
+ width: 8
249
+ },
250
+ state: getState(item === null || item === void 0 ? void 0 : item.progress),
251
+ withIcon: isIcon,
252
+ completed: isCompleted,
253
+ children: [isIcon && renderIcon(item), jsx(Box, {
254
+ className: "title-progress",
255
+ css: {
256
+ position: 'absolute',
257
+ top: isIcon ? 10 : -5,
258
+ left: isIcon ? 40 : 20,
259
+ right: width ? `-${width}px` : -300
260
+ },
261
+ children: item.render ? jsx(Fragment, {
262
+ children: typeof (item === null || item === void 0 ? void 0 : item.render) === 'function' ? item === null || item === void 0 ? void 0 : item.render() : item === null || item === void 0 ? void 0 : item.render
263
+ }) : jsx(Title, {
264
+ css: {
265
+ opacity: isMobile && (item === null || item === void 0 ? void 0 : item.progress) !== progress ? 0 : 1
266
+ },
267
+ state: getState((item === null || item === void 0 ? void 0 : item.progress) + 1),
268
+ children: typeof (item === null || item === void 0 ? void 0 : item.title) === 'function' ? (_a = item === null || item === void 0 ? void 0 : item.title) === null || _a === void 0 ? void 0 : _a.call(item) : item === null || item === void 0 ? void 0 : item.title
269
+ }, index)
270
+ })]
271
+ }), jsx(Line, {
272
+ state: getState(item === null || item === void 0 ? void 0 : item.progress),
273
+ withIcon: isIcon,
274
+ css: {
275
+ width: 2,
276
+ height: gap
277
+ }
278
+ })]
279
+ }, index + 'vertical');
280
+ })
281
+ })
282
+ });
283
+ }
284
+ return direction === 'horizontal' ? renderHorizontalIndicator() : renderVerticalIndicator();
285
+ }
286
+
287
+ export { ProgressIndicator as default };
@@ -0,0 +1,172 @@
1
+ import 'core-js/modules/es.array.push.js';
2
+ import 'core-js/modules/es.iterator.constructor.js';
3
+ import 'core-js/modules/es.iterator.find.js';
4
+ import 'core-js/modules/es.iterator.for-each.js';
5
+ import { jsx } from 'react/jsx-runtime';
6
+ import React__default, { useRef } from 'react';
7
+
8
+ /**
9
+ * ScrollingSyncerContext is the context to be handling scrolled nodes
10
+ */
11
+ const ScrollingSyncerContext = /*#__PURE__*/React__default.createContext({
12
+ registerNode: (_node, _group) => {},
13
+ unregisterNode: (_node, _group) => {},
14
+ onScroll: (_e, _groups) => {}
15
+ });
16
+ /**
17
+ * ScrollSync component is a context based component,
18
+ * that wrappes children to be .Provided with context utils and eventsHandlers
19
+ * @param props ScrollSyncProps
20
+ */
21
+ const ScrollSync = props => {
22
+ /**
23
+ * a map of group: and it's nodes
24
+ * {
25
+ * groupA: [node1, node2, node3],
26
+ * groupB: [node4, node5],
27
+ * groupC: [node1, node4],
28
+ * }
29
+ */
30
+ const nodesRef = useRef({});
31
+ const elements = nodesRef.current;
32
+ /**
33
+ * A simple trick to avoid calling `requestAnimationFrame` before the frame is painted, to enhance performance!
34
+ */
35
+ const shouldPaintFrameRef = useRef(true);
36
+ let shouldPaintFrame = shouldPaintFrameRef.current;
37
+ /**
38
+ * return boolean if the group exists
39
+ * @param group to be found
40
+ */
41
+ const findGroup = group => {
42
+ return !!elements[group];
43
+ };
44
+ /**
45
+ * returns found node or undefined
46
+ * @param node to be found
47
+ * @param group to be searched in
48
+ */
49
+ const doesNodeExists = (node, group) => {
50
+ const groupExists = findGroup(group);
51
+ if (!groupExists) return false;
52
+ const foundNode = elements[group].find(element => element.node === node);
53
+ if (!foundNode) return false;
54
+ return !!foundNode;
55
+ };
56
+ /**
57
+ * this function will delightly register your node (that uses ScrollSyncNode)
58
+ * to be scroll-synced with it's cool other registerd nodes
59
+ *
60
+ * @param node to be registred
61
+ * @param groups to wich groups the node should be registered
62
+ */
63
+ const registerNode = (element, groups) => {
64
+ groups.forEach(group => {
65
+ const groupExists = findGroup(group);
66
+ if (!groupExists) {
67
+ elements[group] = [];
68
+ }
69
+ elements[group].push(Object.assign({}, element));
70
+ });
71
+ };
72
+ /**
73
+ * this function will delightly UNregister your node (that uses ScrollSyncNode)
74
+ * to stop it's scroll-sync with other cool registerd nodes
75
+ *
76
+ * used now when unmounting nodes
77
+ *
78
+ * @param element to be registred
79
+ * @param groups to wich groups the node should be registered
80
+ */
81
+ const unregisterNode = (element, groups) => {
82
+ groups.forEach(group => {
83
+ const doesNodeExist = doesNodeExists(element.node, group);
84
+ if (doesNodeExist) {
85
+ elements[group].splice(elements[group].findIndex(e => element.node === e.node), 1);
86
+ }
87
+ });
88
+ };
89
+ /**
90
+ * calculate scrolling percentage of the scrolledNode to be synced with other nodes
91
+ * @param scrolledNode !!
92
+ * @param node other node to be scroll-synced
93
+ */
94
+ const syncScrollPosition = (scrolledNode, node, config) => {
95
+ if (!scrolledNode || !node) return;
96
+ const {
97
+ scrollTop,
98
+ scrollHeight,
99
+ offsetHeight,
100
+ scrollLeft,
101
+ scrollWidth,
102
+ offsetLeft,
103
+ offsetWidth
104
+ } = scrolledNode;
105
+ if (!props.proportional) {
106
+ if (config !== 'vertical-only') {
107
+ node.scrollLeft = scrollLeft;
108
+ }
109
+ if (config !== 'horizontal-only') {
110
+ node.scrollTop = scrollTop;
111
+ }
112
+ return;
113
+ }
114
+ //calculate percentage of scrolling of the scrolledNode
115
+ const percentagePerHeight = scrollTop / (scrollHeight - offsetHeight);
116
+ //calculate percentage of scrolling of the scrolledNode
117
+ const percentagePerWidth = scrollLeft / (scrollWidth - offsetWidth);
118
+ //Apply calculated scrolling
119
+ if (config !== 'vertical-only') {
120
+ node.scrollLeft = Math.round(percentagePerWidth * (node.scrollWidth - node.offsetWidth));
121
+ }
122
+ if (config !== 'horizontal-only') {
123
+ node.scrollTop = Math.round(percentagePerHeight * (node.scrollHeight - node.offsetHeight));
124
+ }
125
+ };
126
+ /**
127
+ * We sync all other nodes in the registered groups
128
+ * @param scrolledNode !!
129
+ * @param groups groups to be scroll-synced
130
+ */
131
+ const syncScrollPositions = (scrolledNode, groups) => {
132
+ groups.forEach(group => {
133
+ elements[group].forEach(element => {
134
+ /* For all nodes other than the currently scrolled one */
135
+ if (scrolledNode !== element.node) {
136
+ syncScrollPosition(scrolledNode, element.node, element.scroll);
137
+ }
138
+ });
139
+ });
140
+ };
141
+ /**
142
+ * check if previous frame was painted and we should paint next
143
+ * if we should, then we call `requestAnimationFrame` again
144
+ * and then clear the shouldPaintFrame flag till next animation frame
145
+ *
146
+ * @param node node to be scrolled
147
+ * @param groups groups to be scroll-synced
148
+ */
149
+ const handleNodeScroll = (node, groups) => {
150
+ if (shouldPaintFrame) {
151
+ window.requestAnimationFrame(() => {
152
+ syncScrollPositions(node, groups);
153
+ shouldPaintFrame = true;
154
+ });
155
+ shouldPaintFrame = false;
156
+ }
157
+ };
158
+ return jsx(ScrollingSyncerContext.Provider, {
159
+ value: {
160
+ registerNode,
161
+ unregisterNode,
162
+ onScroll: (e, groups) => !props.disabled && handleNodeScroll(e.currentTarget, groups)
163
+ },
164
+ children: React__default.Children.only(props.children)
165
+ });
166
+ };
167
+ ScrollSync.defaultProps = {
168
+ disabled: false,
169
+ proportional: true
170
+ };
171
+
172
+ export { ScrollSync, ScrollingSyncerContext, ScrollSync as default };
@@ -0,0 +1,87 @@
1
+ import React__default, { forwardRef, useContext, useRef, useEffect } from 'react';
2
+ import { ScrollingSyncerContext } from './ScrollSync.esm.js';
3
+ import { toArray, getMovingAxis } from './utils.esm.js';
4
+
5
+ const ScrollSyncNode = /*#__PURE__*/forwardRef((props, forwardedRef) => {
6
+ const {
7
+ children,
8
+ group = 'default',
9
+ scroll = 'all',
10
+ selfLockAxis = null,
11
+ onScroll: onNodeScroll = () => undefined
12
+ } = props;
13
+ const {
14
+ registerNode,
15
+ unregisterNode,
16
+ onScroll
17
+ } = useContext(ScrollingSyncerContext);
18
+ const childRef = children.ref;
19
+ const hasDoubleRef = childRef != null && forwardedRef != null;
20
+ if (hasDoubleRef) {
21
+ console.warn('scroll-sync-react:\nWARNING: ref used on both ScrollSyncNode and its direct child.\nUsing the ref from the ScrollSyncNode component.');
22
+ }
23
+ const innerRef = useRef(null);
24
+ const ref = childRef && !forwardedRef ? childRef : innerRef;
25
+ useEffect(() => {
26
+ if (typeof forwardedRef === 'function') {
27
+ forwardedRef(ref.current);
28
+ }
29
+ }, []);
30
+ const applySelfLockAxis = event => {
31
+ const movingAxis = getMovingAxis(event);
32
+ if (selfLockAxis === 'X' && movingAxis === 'X') {
33
+ event.preventDefault();
34
+ } else if (selfLockAxis === 'Y' && movingAxis === 'Y') {
35
+ event.preventDefault();
36
+ } else if (selfLockAxis === 'XY' && (movingAxis === 'XY' || movingAxis === 'X' || movingAxis === 'Y')) {
37
+ event.preventDefault();
38
+ }
39
+ };
40
+ useEffect(() => {
41
+ var _a;
42
+ const syncableElement = {
43
+ node: ref.current,
44
+ scroll
45
+ };
46
+ if (syncableElement) registerNode(syncableElement, toArray(group));
47
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.addEventListener('wheel', applySelfLockAxis, {
48
+ passive: false
49
+ });
50
+ return () => {
51
+ var _a;
52
+ unregisterNode(syncableElement, toArray(group));
53
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', applySelfLockAxis);
54
+ };
55
+ }, []);
56
+ useEffect(() => {
57
+ const syncableElement = {
58
+ node: ref.current,
59
+ scroll
60
+ };
61
+ unregisterNode(syncableElement, toArray(group));
62
+ registerNode(syncableElement, toArray(group));
63
+ return () => unregisterNode(syncableElement, toArray(group));
64
+ }, [scroll, group]);
65
+ return /*#__PURE__*/React__default.cloneElement(children, {
66
+ ref,
67
+ onScroll: e => {
68
+ if (typeof children.props.onScroll === 'function') {
69
+ children.props.onScroll(e);
70
+ }
71
+ e.persist();
72
+ onScroll(e, toArray(group));
73
+ onNodeScroll(e);
74
+ },
75
+ onWheel: e => {
76
+ if (typeof children.props.onWheel === 'function') {
77
+ children.props.onWheel(e);
78
+ }
79
+ e.persist();
80
+ onScroll(e, toArray(group));
81
+ onNodeScroll(e);
82
+ }
83
+ });
84
+ });
85
+ ScrollSyncNode.displayName = 'ScrollSyncNode';
86
+
87
+ export { ScrollSyncNode, ScrollSyncNode as default };
@@ -0,0 +1,9 @@
1
+ const toArray = groups => [].concat(groups);
2
+ const getMovingAxis = e => {
3
+ if (e.deltaX > 0 || e.deltaX < 0) return "X";
4
+ if (e.deltaY > 0 || e.deltaY < 0) return "Y";
5
+ if ((e.deltaY > 0 || e.deltaY < 0) && (e.deltaX > 0 || e.deltaX < 0)) return "XY";
6
+ return null;
7
+ };
8
+
9
+ export { getMovingAxis, toArray };
@@ -0,0 +1,43 @@
1
+ import 'react';
2
+ import { styled } from '../../config/stitches.config.esm.js';
3
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
4
+
5
+ const StyledSeparator = styled(SeparatorPrimitive.Root, {
6
+ backgroundColor: '$gray150',
7
+ '&[data-orientation=horizontal]': {
8
+ height: 1,
9
+ width: '100%'
10
+ },
11
+ '&[data-orientation=vertical]': {
12
+ width: 1
13
+ },
14
+ variants: {
15
+ responsive: {
16
+ true: {
17
+ display: 'none',
18
+ '@md': {
19
+ display: 'block'
20
+ }
21
+ }
22
+ },
23
+ mobileOnly: {
24
+ true: {
25
+ '@lg': {
26
+ display: 'none !important'
27
+ }
28
+ }
29
+ },
30
+ desktopOnly: {
31
+ true: {
32
+ display: 'none !important',
33
+ '@lg': {
34
+ display: 'block !important'
35
+ }
36
+ }
37
+ }
38
+ }
39
+ });
40
+ const Separator = StyledSeparator;
41
+ Separator.displayName = 'Separator';
42
+
43
+ export { Separator, Separator as default };