@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.
- package/charts.esm.js +3 -1453
- package/colors/Colors.esm.js +93 -0
- package/components/accordion/Accordion.esm.js +109 -0
- package/components/alertDialog/AlertDialog.esm.js +440 -0
- package/components/avatar/Avatar.esm.js +83 -0
- package/components/badge/Badge.esm.js +255 -0
- package/components/banner/Banner.esm.js +341 -0
- package/components/barChart/BarChart.esm.js +212 -0
- package/components/breadcrumb/Breadcrumb.esm.js +65 -0
- package/components/breadcrumb/index.esm.js +19 -0
- package/components/button/Button.esm.js +331 -0
- package/components/buttonGroup/ButtonGroup.esm.js +350 -0
- package/components/card/Card.esm.js +236 -0
- package/components/chart/assets/data_kosong.png.esm.js +3 -0
- package/components/chart/lineChart/LineChart.esm.js +358 -0
- package/components/chart/lineChart/components/Comparator.esm.js +82 -0
- package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
- package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
- package/components/chart/lineChart/components/ProductList.esm.js +78 -0
- package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
- package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
- package/components/chart/utils/index.esm.js +109 -0
- package/components/checkboxTable/CheckboxTable.esm.js +287 -0
- package/components/colorPicker/ColorPicker.esm.js +342 -0
- package/components/colorPicker/InputColorPicker.esm.js +120 -0
- package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
- package/components/colorPicker/components/ColorFields.esm.js +144 -0
- package/components/colorPicker/components/ColorMap.esm.js +1188 -0
- package/components/contentEditor/ContentEditor.esm.js +251 -0
- package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
- package/components/contextMenu/ContextMenu.esm.js +298 -0
- package/components/datePicker/AdvancedOption.esm.js +37 -0
- package/components/datePicker/CustomDatePicker.esm.js +121 -0
- package/components/datePicker/DatePicker.esm.js +244 -0
- package/components/datePicker/DatePickerMulti.esm.js +70 -0
- package/components/datePicker/InputDatePicker.esm.js +290 -0
- package/components/datePicker/InputDateRangePicker.esm.js +174 -0
- package/components/datePicker/components/Calendar.esm.js +654 -0
- package/components/datePicker/components/CalendarMulti.esm.js +407 -0
- package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
- package/components/datePicker/components/DateNumber.esm.js +89 -0
- package/components/datePicker/components/MobileCalendar.esm.js +522 -0
- package/components/datePicker/state/reducer.esm.js +286 -0
- package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
- package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
- package/components/devicePreview/DevicePreview.esm.js +631 -0
- package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
- package/components/dialog/Dialog.esm.js +106 -0
- package/components/drawer/Drawer.esm.js +294 -0
- package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
- package/components/editableTable/EditableMobile.esm.js +361 -0
- package/components/editableTable/EditableTable.esm.js +618 -0
- package/components/editableTable/transition.esm.js +37 -0
- package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
- package/components/form/components/FormHelper/Helper.esm.js +50 -0
- package/components/form/components/FormLabel/Label.esm.js +90 -0
- package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
- package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
- package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
- package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
- package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
- package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
- package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
- package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
- package/components/form/components/InputElement/InputElement.esm.js +35 -0
- package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
- package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
- package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
- package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
- package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
- package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
- package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
- package/components/form/components/InputRadio/context.esm.js +5 -0
- package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
- package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
- package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
- package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
- package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
- package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
- package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
- package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
- package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
- package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
- package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
- package/components/form/components/InputTags/InputTags.esm.js +268 -0
- package/components/form/components/InputText/InputText.esm.js +197 -0
- package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
- package/components/heading/Heading.esm.js +64 -0
- package/components/iconButton/IconButton.esm.js +71 -0
- package/components/image/Image.esm.js +141 -0
- package/components/link/Link.esm.js +59 -0
- package/components/loadingBar/LoadingBar.esm.js +113 -0
- package/components/mapPicker/InputMapPicker.esm.js +160 -0
- package/components/mapPicker/MapPicker.esm.js +122 -0
- package/components/mapPicker/MapPicker.styles.esm.js +70 -0
- package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
- package/components/mapPicker/components/AddressCard.esm.js +25 -0
- package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
- package/components/mapPicker/components/ChangeView.esm.js +20 -0
- package/components/mapPicker/components/InputSearch.esm.js +74 -0
- package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
- package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
- package/components/mapPicker/components/ZoomControls.esm.js +36 -0
- package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
- package/components/modalDialog/ModalDialog.esm.js +247 -0
- package/components/notificationBadge/NotificationBadge.esm.js +149 -0
- package/components/pageDialog/PageDialog.esm.js +291 -0
- package/components/pageDialog/logo.svg.esm.js +3 -0
- package/components/pagination/Pagination.esm.js +94 -0
- package/components/pagination/PaginationButton.esm.js +346 -0
- package/components/pagination/PaginationInfo.esm.js +146 -0
- package/components/paper/Paper.esm.js +76 -0
- package/components/paragraph/Paragraph.esm.js +52 -0
- package/components/pieChart/PieChart.esm.js +287 -0
- package/components/popover/Popover.esm.js +142 -0
- package/components/progress/Progress.esm.js +170 -0
- package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
- package/components/scrollSync/ScrollSync.esm.js +172 -0
- package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
- package/components/scrollSync/utils.esm.js +9 -0
- package/components/separator/Separator.esm.js +43 -0
- package/components/skeleton/Skeleton.esm.js +131 -0
- package/components/slider/Slider.esm.js +345 -0
- package/components/stepWizard/StepWizard.esm.js +451 -0
- package/components/stepWizard/index.esm.js +14 -0
- package/components/table/MobileTable.esm.js +415 -0
- package/components/table/Table.esm.js +1472 -0
- package/components/table/components/columns/DateColumn.esm.js +26 -0
- package/components/table/components/columns/DecimalColumn.esm.js +36 -0
- package/components/table/components/columns/PriceColumn.esm.js +57 -0
- package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
- package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
- package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
- package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
- package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
- package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
- package/components/table/images/img-emptydata.webp.esm.js +3 -0
- package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
- package/components/tableOfContent/TableOfContent.esm.js +267 -0
- package/components/tableOfContent/index.esm.js +18 -0
- package/components/tableOfContent/transition.esm.js +38 -0
- package/components/tabs/Tabs.esm.js +282 -0
- package/components/tag/Tag.esm.js +161 -0
- package/components/tagList/TagList.esm.js +90 -0
- package/components/tagStatus/TagStatus.esm.js +134 -0
- package/components/text/Text.esm.js +140 -0
- package/components/toast/Toast.esm.js +297 -0
- package/components/toast/ToastContainer.esm.js +73 -0
- package/components/toast/context/ToastContext.esm.js +5 -0
- package/components/toast/context/ToastProvider.esm.js +96 -0
- package/components/tooltip/Tooltip.esm.js +175 -0
- package/components/upload/Upload.esm.js +1103 -0
- package/components/upload/utils/canvasPreview.esm.js +39 -0
- package/components/upload/utils/imgPreview.esm.js +21 -0
- package/config/stitches.config.esm.js +216 -0
- package/editor.esm.js +1 -264
- package/hooks/useListOption/useListOption.esm.js +56 -0
- package/hooks/useToggle/useToggle.esm.js +8 -0
- package/index.esm.js +106 -42293
- package/layout/box/Box.esm.js +24 -0
- package/layout/flex/Flex.esm.js +135 -0
- package/layout/grid/Grid.esm.js +270 -0
- package/layout/pageContainer/PageContainer.esm.js +60 -0
- package/majoo-provider/MajooProvider.esm.js +42 -0
- package/majoo-provider/ThemeProvider.esm.js +41 -0
- package/majoo-provider/globalStyles.esm.js +242 -0
- package/majoo-provider/styles/modern-normalize.esm.js +95 -0
- package/map.esm.js +2 -734
- package/package.json +16 -5
- package/utils/calendar.esm.js +26 -0
- package/utils/element.esm.js +21 -0
- package/utils/object.esm.js +12 -0
- package/utils/request.esm.js +74 -0
- package/utils/strings.esm.js +6 -0
- package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
- package/utils/useNavigatorOnline.esm.js +19 -0
- package/utils/variant.esm.js +12 -0
- package/wrapper/ConditionalWrapper.esm.js +9 -0
- package/ModalDialog.esm.js +0 -2669
- package/Separator.esm.js +0 -3002
- package/stitches.config.esm.js +0 -2284
- 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 };
|