@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,141 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import Flex from '../../layout/flex/Flex.esm.js';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
const ContainerFallback = styled(Flex, {
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
border: '2px dashed #C0C4C4',
|
|
11
|
+
borderRadius: 8,
|
|
12
|
+
backgroundColor: '$gray50',
|
|
13
|
+
height: 120,
|
|
14
|
+
width: 188,
|
|
15
|
+
variants: {
|
|
16
|
+
rounded: {
|
|
17
|
+
true: {
|
|
18
|
+
borderRadius: '100%'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const TextFallback = styled('p', {
|
|
24
|
+
fontSize: 12,
|
|
25
|
+
fontWeight: 400,
|
|
26
|
+
fontStyle: 'normal',
|
|
27
|
+
textAlign: 'center',
|
|
28
|
+
color: '$textDisable'
|
|
29
|
+
});
|
|
30
|
+
const StyledImage = styled('img', {
|
|
31
|
+
display: 'inline-block',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
variants: {
|
|
35
|
+
rounded: {
|
|
36
|
+
true: {
|
|
37
|
+
borderRadius: '100%'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
function Image({
|
|
43
|
+
className,
|
|
44
|
+
src,
|
|
45
|
+
alt,
|
|
46
|
+
width,
|
|
47
|
+
height,
|
|
48
|
+
objectFit,
|
|
49
|
+
fallback,
|
|
50
|
+
fallbackTitle,
|
|
51
|
+
css,
|
|
52
|
+
cssFallback,
|
|
53
|
+
rounded,
|
|
54
|
+
...props
|
|
55
|
+
}) {
|
|
56
|
+
const {
|
|
57
|
+
t
|
|
58
|
+
} = useTranslation('translation');
|
|
59
|
+
if (src || fallback) {
|
|
60
|
+
return /*#__PURE__*/jsx(StyledImage, {
|
|
61
|
+
className: className,
|
|
62
|
+
src: src,
|
|
63
|
+
alt: alt,
|
|
64
|
+
width: width,
|
|
65
|
+
height: height,
|
|
66
|
+
srcSet: fallback,
|
|
67
|
+
rounded: rounded,
|
|
68
|
+
css: {
|
|
69
|
+
objectFit: objectFit,
|
|
70
|
+
...css
|
|
71
|
+
},
|
|
72
|
+
...props
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
return /*#__PURE__*/jsx(ContainerFallback, {
|
|
76
|
+
rounded: rounded,
|
|
77
|
+
align: "center",
|
|
78
|
+
justify: "center",
|
|
79
|
+
css: {
|
|
80
|
+
width,
|
|
81
|
+
height,
|
|
82
|
+
...cssFallback
|
|
83
|
+
},
|
|
84
|
+
children: /*#__PURE__*/jsx(TextFallback, {
|
|
85
|
+
children: fallbackTitle === 'Tidak ada foto' ? t('fallbackTitle', fallbackTitle) : fallbackTitle
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
Image.propTypes = {
|
|
91
|
+
/**
|
|
92
|
+
Additional className for img element.
|
|
93
|
+
*/
|
|
94
|
+
className: PropTypes.string,
|
|
95
|
+
/**
|
|
96
|
+
Which is used to specify the source of an image.
|
|
97
|
+
*/
|
|
98
|
+
src: PropTypes.string,
|
|
99
|
+
/**
|
|
100
|
+
The written copy that appears in place of an image on a webpage if the image fails to load on a user's screen.
|
|
101
|
+
*/
|
|
102
|
+
alt: PropTypes.string,
|
|
103
|
+
/**
|
|
104
|
+
Additional css for img element.
|
|
105
|
+
*/
|
|
106
|
+
css: PropTypes.object,
|
|
107
|
+
/**
|
|
108
|
+
Additional css for default fallback element.
|
|
109
|
+
*/
|
|
110
|
+
cssFallback: PropTypes.object,
|
|
111
|
+
/**
|
|
112
|
+
Custom width of img element.
|
|
113
|
+
*/
|
|
114
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
115
|
+
/**
|
|
116
|
+
Custom height of img element.
|
|
117
|
+
*/
|
|
118
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
119
|
+
/**
|
|
120
|
+
Set image to circle.
|
|
121
|
+
*/
|
|
122
|
+
rounded: PropTypes.bool,
|
|
123
|
+
/**
|
|
124
|
+
Used to specify how an <img> should be resized to fit its container.
|
|
125
|
+
*/
|
|
126
|
+
objectFit: PropTypes.string,
|
|
127
|
+
/**
|
|
128
|
+
Custom fallback if image url doesn't exist.
|
|
129
|
+
*/
|
|
130
|
+
fallback: PropTypes.string,
|
|
131
|
+
/**
|
|
132
|
+
Custom fallback title for default fallback.
|
|
133
|
+
*/
|
|
134
|
+
fallbackTitle: PropTypes.string
|
|
135
|
+
};
|
|
136
|
+
Image.defaultProps = {
|
|
137
|
+
rounded: false,
|
|
138
|
+
fallbackTitle: 'Tidak ada foto'
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export { Image, Image as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
5
|
+
|
|
6
|
+
const StyledLink = styled('a', {
|
|
7
|
+
fontSize: '$short-content-regular',
|
|
8
|
+
textDecoration: 'underline',
|
|
9
|
+
variants: {
|
|
10
|
+
/**
|
|
11
|
+
* Specify the link color
|
|
12
|
+
*/
|
|
13
|
+
color: {
|
|
14
|
+
success: {
|
|
15
|
+
color: '$textBrand'
|
|
16
|
+
},
|
|
17
|
+
info: {
|
|
18
|
+
color: '$hlNews'
|
|
19
|
+
},
|
|
20
|
+
warning: {
|
|
21
|
+
color: '$hlProcess'
|
|
22
|
+
},
|
|
23
|
+
failed: {
|
|
24
|
+
color: '$textRed'
|
|
25
|
+
},
|
|
26
|
+
pending: {
|
|
27
|
+
color: '$hlPending'
|
|
28
|
+
},
|
|
29
|
+
primary: {
|
|
30
|
+
color: '$textPrimary'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
color: 'success'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const Link = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
|
|
39
|
+
var {
|
|
40
|
+
children = 'Learn more',
|
|
41
|
+
color = 'success',
|
|
42
|
+
isExternal = false,
|
|
43
|
+
href = '#',
|
|
44
|
+
target,
|
|
45
|
+
rel
|
|
46
|
+
} = _a,
|
|
47
|
+
props = __rest(_a, ["children", "color", "isExternal", "href", "target", "rel"]);
|
|
48
|
+
return jsx(StyledLink, Object.assign({
|
|
49
|
+
target: isExternal ? '_blank' : target,
|
|
50
|
+
rel: isExternal ? 'noopener noreferrer' : rel,
|
|
51
|
+
href: href,
|
|
52
|
+
color: color,
|
|
53
|
+
ref: forwardedRef
|
|
54
|
+
}, props, {
|
|
55
|
+
children: children
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export { Link };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { styled } from '@stitches/react';
|
|
4
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
5
|
+
|
|
6
|
+
const Container = styled('div', {});
|
|
7
|
+
const ProgressText = styled('p', {
|
|
8
|
+
fontStyle: 'normal',
|
|
9
|
+
fontWeight: 400,
|
|
10
|
+
fontSize: 14,
|
|
11
|
+
color: '$textSecondary',
|
|
12
|
+
marginTop: 8,
|
|
13
|
+
textAlign: 'center'
|
|
14
|
+
});
|
|
15
|
+
const StyledProgress = styled(ProgressPrimitive.Root, {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
overflow: 'hidden',
|
|
18
|
+
background: '$gray150',
|
|
19
|
+
borderRadius: '99999px',
|
|
20
|
+
width: '100%',
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
sm: {
|
|
24
|
+
height: 4
|
|
25
|
+
},
|
|
26
|
+
md: {
|
|
27
|
+
height: 8
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const StyledIndicator = styled(ProgressPrimitive.Indicator, {
|
|
33
|
+
background: 'linear-gradient(90deg, rgba(1,174,136,1) 35%, rgba(4,201,158,1) 100%)',
|
|
34
|
+
width: '100%',
|
|
35
|
+
height: '100%',
|
|
36
|
+
transition: 'transform 660ms cubic-bezier(0.65, 0, 0.35, 1)'
|
|
37
|
+
});
|
|
38
|
+
const Progress = StyledProgress;
|
|
39
|
+
const ProgressIndicator = StyledIndicator;
|
|
40
|
+
function PrimitiveLoadingBar({
|
|
41
|
+
progress,
|
|
42
|
+
description,
|
|
43
|
+
showProgressOnly,
|
|
44
|
+
css,
|
|
45
|
+
visibility,
|
|
46
|
+
colors,
|
|
47
|
+
size
|
|
48
|
+
}) {
|
|
49
|
+
return visibility && jsxs(Container, {
|
|
50
|
+
css: css,
|
|
51
|
+
children: [jsx(Progress, {
|
|
52
|
+
value: 66,
|
|
53
|
+
size: size,
|
|
54
|
+
children: jsx(ProgressIndicator, {
|
|
55
|
+
style: {
|
|
56
|
+
transform: `translateX(-${100 - progress}%)`
|
|
57
|
+
},
|
|
58
|
+
css: {
|
|
59
|
+
background: (colors === null || colors === void 0 ? void 0 : colors.length) > 1 ? `linear-gradient(90deg, ${colors === null || colors === void 0 ? void 0 : colors[0]} 35%, ${colors === null || colors === void 0 ? void 0 : colors[1]} 100%)` : colors === null || colors === void 0 ? void 0 : colors[0]
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}), !showProgressOnly && jsx(ProgressText, {
|
|
63
|
+
children: `${description} ${progress}%`
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
let interval;
|
|
68
|
+
function LoadingBar(props) {
|
|
69
|
+
const {
|
|
70
|
+
show,
|
|
71
|
+
onCompleted,
|
|
72
|
+
interval: intervalTime
|
|
73
|
+
} = props;
|
|
74
|
+
const [progress, setProgress] = useState(0);
|
|
75
|
+
const [visibility, setVisibility] = useState(false);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (show) {
|
|
78
|
+
setVisibility(true);
|
|
79
|
+
interval = setInterval(() => {
|
|
80
|
+
setProgress(prev => prev < 100 && prev + 1);
|
|
81
|
+
}, intervalTime);
|
|
82
|
+
} else {
|
|
83
|
+
setProgress(100);
|
|
84
|
+
clearInterval(interval);
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
setVisibility(false);
|
|
87
|
+
setProgress(0);
|
|
88
|
+
}, 1000);
|
|
89
|
+
}
|
|
90
|
+
return () => setProgress(0);
|
|
91
|
+
}, [show, intervalTime]);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (progress === 100) {
|
|
94
|
+
clearInterval(interval);
|
|
95
|
+
onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted();
|
|
96
|
+
}
|
|
97
|
+
}, [progress, onCompleted]);
|
|
98
|
+
return typeof (props === null || props === void 0 ? void 0 : props.progress) === 'number' ? jsx(PrimitiveLoadingBar, Object.assign({}, props, {
|
|
99
|
+
visibility: true
|
|
100
|
+
})) : jsx(PrimitiveLoadingBar, Object.assign({}, props, {
|
|
101
|
+
visibility: visibility,
|
|
102
|
+
progress: progress
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
LoadingBar.defaultProps = {
|
|
106
|
+
showProgressOnly: false,
|
|
107
|
+
show: false,
|
|
108
|
+
interval: 100,
|
|
109
|
+
description: 'Loading...',
|
|
110
|
+
size: 'md'
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export { LoadingBar as default };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useState, useRef, useCallback, useEffect } from 'react';
|
|
4
|
+
import MapPicker from './MapPicker.esm.js';
|
|
5
|
+
import { Button } from '../button/Button.esm.js';
|
|
6
|
+
import { Image } from '../image/Image.esm.js';
|
|
7
|
+
import ModalDialog, { ModalDialogTrigger, ModalDialogTitle, ModalDialogContent } from '../modalDialog/ModalDialog.esm.js';
|
|
8
|
+
import Paragraph from '../paragraph/Paragraph.esm.js';
|
|
9
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
10
|
+
import Box from '../../layout/box/Box.esm.js';
|
|
11
|
+
import Flex from '../../layout/flex/Flex.esm.js';
|
|
12
|
+
import useMediaQuery from '../../utils/useMediaQuery.esm.js';
|
|
13
|
+
import img from './assets/images/Mapsicle.png.esm.js';
|
|
14
|
+
|
|
15
|
+
const ContainerInput = styled('div', {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
height: 64,
|
|
18
|
+
width: '100%',
|
|
19
|
+
borderRadius: 8
|
|
20
|
+
});
|
|
21
|
+
function InputMapPicker(props) {
|
|
22
|
+
var _a;
|
|
23
|
+
const {
|
|
24
|
+
css,
|
|
25
|
+
modalTitle,
|
|
26
|
+
buttonLabel,
|
|
27
|
+
placeholder,
|
|
28
|
+
radius,
|
|
29
|
+
value,
|
|
30
|
+
showSelectButton,
|
|
31
|
+
readOnly,
|
|
32
|
+
onChange,
|
|
33
|
+
customInputValue,
|
|
34
|
+
header,
|
|
35
|
+
marker
|
|
36
|
+
} = props;
|
|
37
|
+
const modalTrigger = React__default.useRef(null);
|
|
38
|
+
const [inputValue, setInputValue] = useState(placeholder);
|
|
39
|
+
const initialInputValue = useRef(null);
|
|
40
|
+
const handleSearchLatLng = useCallback(latLng => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
try {
|
|
42
|
+
const res = yield fetch(`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${Number(latLng.lat)}&lon=${Number(latLng.lng)}&accept-language=id`);
|
|
43
|
+
const location = yield res.json();
|
|
44
|
+
initialInputValue.current = location.display_name;
|
|
45
|
+
setInputValue(location.display_name);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw new Error('Failed to search address');
|
|
48
|
+
}
|
|
49
|
+
}), []);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (value && value.lat && value.lng) {
|
|
52
|
+
handleSearchLatLng(value);
|
|
53
|
+
}
|
|
54
|
+
}, [value, handleSearchLatLng]);
|
|
55
|
+
function handleClick() {
|
|
56
|
+
var _a;
|
|
57
|
+
(_a = modalTrigger === null || modalTrigger === void 0 ? void 0 : modalTrigger.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
58
|
+
}
|
|
59
|
+
function handleChange(mapObject, isConfirmed) {
|
|
60
|
+
if (isConfirmed) {
|
|
61
|
+
handleClick();
|
|
62
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(mapObject);
|
|
63
|
+
} else {
|
|
64
|
+
setInputValue(mapObject.formatted_address);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const isDesktop = useMediaQuery('(min-width: 767px)');
|
|
68
|
+
return jsxs(React__default.Fragment, {
|
|
69
|
+
children: [jsxs(Flex, {
|
|
70
|
+
direction: "column",
|
|
71
|
+
gap: 3,
|
|
72
|
+
align: "start",
|
|
73
|
+
children: [jsxs(ContainerInput, {
|
|
74
|
+
css: css,
|
|
75
|
+
children: [jsx(Image, {
|
|
76
|
+
css: {
|
|
77
|
+
borderRadius: 8,
|
|
78
|
+
height: 64
|
|
79
|
+
},
|
|
80
|
+
src: img,
|
|
81
|
+
alt: "map-picker",
|
|
82
|
+
width: "100%"
|
|
83
|
+
}), jsx(Box, {
|
|
84
|
+
css: {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
top: 0,
|
|
87
|
+
right: 0,
|
|
88
|
+
bottom: 0,
|
|
89
|
+
left: 0,
|
|
90
|
+
backgroundColor: 'rgba(39, 42, 42, 0.6)',
|
|
91
|
+
borderRadius: 8
|
|
92
|
+
},
|
|
93
|
+
children: jsxs(Flex, {
|
|
94
|
+
align: "center",
|
|
95
|
+
justify: "between",
|
|
96
|
+
gap: 6,
|
|
97
|
+
css: {
|
|
98
|
+
height: '100%',
|
|
99
|
+
padding: 16
|
|
100
|
+
},
|
|
101
|
+
children: [jsx(Paragraph, {
|
|
102
|
+
css: {
|
|
103
|
+
color: '$textWhite',
|
|
104
|
+
fontWeight: 600,
|
|
105
|
+
flex: 1
|
|
106
|
+
},
|
|
107
|
+
isTruncated: true,
|
|
108
|
+
children: (_a = customInputValue !== null && customInputValue !== void 0 ? customInputValue : inputValue) !== null && _a !== void 0 ? _a : 'Tandai lokasi dalam peta'
|
|
109
|
+
}), isDesktop ? jsx(Button, {
|
|
110
|
+
type: "button",
|
|
111
|
+
size: "sm",
|
|
112
|
+
buttonType: "secondary",
|
|
113
|
+
onClick: handleClick,
|
|
114
|
+
children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : 'Ubah Lokasi'
|
|
115
|
+
}) : null]
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
}), !isDesktop ? jsx(Button, {
|
|
119
|
+
type: "button",
|
|
120
|
+
size: "md",
|
|
121
|
+
buttonType: "secondary",
|
|
122
|
+
onClick: handleClick,
|
|
123
|
+
children: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : 'Ubah Lokasi'
|
|
124
|
+
}) : null]
|
|
125
|
+
}), jsxs(ModalDialog, {
|
|
126
|
+
width: isDesktop ? 565 : '100%',
|
|
127
|
+
layer: "$modal",
|
|
128
|
+
onPointerDownOutside: e => e.preventDefault(),
|
|
129
|
+
onCloseClick: () => {
|
|
130
|
+
var _a;
|
|
131
|
+
return setInputValue((_a = initialInputValue.current) !== null && _a !== void 0 ? _a : placeholder);
|
|
132
|
+
},
|
|
133
|
+
children: [jsx(ModalDialogTrigger, {
|
|
134
|
+
asChild: true,
|
|
135
|
+
children: jsx("div", {
|
|
136
|
+
ref: modalTrigger
|
|
137
|
+
})
|
|
138
|
+
}), jsx(ModalDialogTitle, {
|
|
139
|
+
children: modalTitle !== null && modalTitle !== void 0 ? modalTitle : 'Tambah Lokasi di Map'
|
|
140
|
+
}), jsx(ModalDialogContent, {
|
|
141
|
+
css: {
|
|
142
|
+
overflowY: 'auto',
|
|
143
|
+
overflowX: 'hidden',
|
|
144
|
+
position: 'relative'
|
|
145
|
+
},
|
|
146
|
+
children: jsx(MapPicker, {
|
|
147
|
+
value: value,
|
|
148
|
+
onChange: handleChange,
|
|
149
|
+
radius: radius,
|
|
150
|
+
showSelectButton: showSelectButton,
|
|
151
|
+
readOnly: readOnly,
|
|
152
|
+
header: header,
|
|
153
|
+
marker: marker
|
|
154
|
+
})
|
|
155
|
+
})]
|
|
156
|
+
})]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export { InputMapPicker as default };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { MapContainer, Circle, TileLayer } from '@monsonjeremy/react-leaflet';
|
|
5
|
+
import { useState, useEffect } from 'react';
|
|
6
|
+
import useMediaQuery from '../../utils/useMediaQuery.esm.js';
|
|
7
|
+
import 'leaflet/dist/leaflet.css';
|
|
8
|
+
import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css';
|
|
9
|
+
import 'leaflet-defaulticon-compatibility';
|
|
10
|
+
import { colors } from '../../config/stitches.config.esm.js';
|
|
11
|
+
import { Container, MapWrapper, mapContainerStyle } from './MapPicker.styles.esm.js';
|
|
12
|
+
import { useMapSearch } from './hooks/useMapSearch.esm.js';
|
|
13
|
+
import { InputSearch } from './components/InputSearch.esm.js';
|
|
14
|
+
import { ButtonSelect } from './components/ButtonSelect.esm.js';
|
|
15
|
+
import { MarkerIcon } from './components/MarkerIcon.esm.js';
|
|
16
|
+
import { ZoomControls } from './components/ZoomControls.esm.js';
|
|
17
|
+
import { AddressCard } from './components/AddressCard.esm.js';
|
|
18
|
+
import { ChangeView } from './components/ChangeView.esm.js';
|
|
19
|
+
|
|
20
|
+
function MapPicker(props) {
|
|
21
|
+
const {
|
|
22
|
+
css,
|
|
23
|
+
radius,
|
|
24
|
+
value,
|
|
25
|
+
showSelectButton,
|
|
26
|
+
readOnly,
|
|
27
|
+
onChange,
|
|
28
|
+
selectLocationText,
|
|
29
|
+
searchPlaceholder,
|
|
30
|
+
header,
|
|
31
|
+
marker
|
|
32
|
+
} = props;
|
|
33
|
+
const [zoom, setZoom] = useState(16);
|
|
34
|
+
const isDesktop = useMediaQuery('(min-width: 767px)');
|
|
35
|
+
const {
|
|
36
|
+
center,
|
|
37
|
+
setCenter,
|
|
38
|
+
places,
|
|
39
|
+
searchQuery,
|
|
40
|
+
searchResult,
|
|
41
|
+
handleSearchChange,
|
|
42
|
+
handleSearchSelect,
|
|
43
|
+
handleSearchLatLng
|
|
44
|
+
} = useMapSearch({
|
|
45
|
+
initialCenter: value && (value === null || value === void 0 ? void 0 : value.lat) && (value === null || value === void 0 ? void 0 : value.lng) && value || {
|
|
46
|
+
lat: -6.175392,
|
|
47
|
+
lng: 106.827153
|
|
48
|
+
},
|
|
49
|
+
showSelectButton,
|
|
50
|
+
onChange
|
|
51
|
+
});
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (value && (value === null || value === void 0 ? void 0 : value.lat) && (value === null || value === void 0 ? void 0 : value.lng)) {
|
|
54
|
+
setCenter(value);
|
|
55
|
+
handleSearchLatLng(value);
|
|
56
|
+
}
|
|
57
|
+
}, [value, setCenter]);
|
|
58
|
+
function handleMarkerClick() {
|
|
59
|
+
if (places.length > 0) {
|
|
60
|
+
const mapObject = {
|
|
61
|
+
place_id: places[0].place_id,
|
|
62
|
+
lat: places[0].lat,
|
|
63
|
+
lng: places[0].lon,
|
|
64
|
+
formatted_address: places[0].display_name,
|
|
65
|
+
address_components: places[0].address
|
|
66
|
+
};
|
|
67
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(Object.assign({}, mapObject), true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return jsxs(Container, {
|
|
71
|
+
direction: "column",
|
|
72
|
+
css: css,
|
|
73
|
+
children: [header, jsx(MapWrapper, {
|
|
74
|
+
children: jsxs(MapContainer, {
|
|
75
|
+
center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng],
|
|
76
|
+
zoom: zoom,
|
|
77
|
+
zoomControl: false,
|
|
78
|
+
dragging: !readOnly,
|
|
79
|
+
style: isDesktop ? mapContainerStyle.desktop : mapContainerStyle.mobile,
|
|
80
|
+
children: [radius && jsx(Circle, {
|
|
81
|
+
center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng],
|
|
82
|
+
radius: radius,
|
|
83
|
+
pathOptions: {
|
|
84
|
+
color: colors.bgBrand,
|
|
85
|
+
fillColor: colors.bgBrand
|
|
86
|
+
}
|
|
87
|
+
}), jsx(TileLayer, {
|
|
88
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
89
|
+
}), showSelectButton && jsx(ButtonSelect, {
|
|
90
|
+
onClick: handleMarkerClick,
|
|
91
|
+
label: selectLocationText
|
|
92
|
+
}), jsx(MarkerIcon, {
|
|
93
|
+
marker: marker
|
|
94
|
+
}), jsx(ChangeView, {
|
|
95
|
+
center: [center === null || center === void 0 ? void 0 : center.lat, center === null || center === void 0 ? void 0 : center.lng],
|
|
96
|
+
readOnly: readOnly,
|
|
97
|
+
onDragEnd: handleSearchLatLng
|
|
98
|
+
}), !readOnly && jsx(InputSearch, {
|
|
99
|
+
list: searchResult,
|
|
100
|
+
value: searchQuery,
|
|
101
|
+
placeholder: searchPlaceholder || 'Cari ...',
|
|
102
|
+
onChange: handleSearchChange,
|
|
103
|
+
onSelect: handleSearchSelect
|
|
104
|
+
}), jsx(ZoomControls, {
|
|
105
|
+
onZoomIn: () => setZoom(current => current + 1),
|
|
106
|
+
onZoomOut: () => setZoom(current => current - 1)
|
|
107
|
+
})]
|
|
108
|
+
}, zoom)
|
|
109
|
+
}), places === null || places === void 0 ? void 0 : places.map(place => jsx(AddressCard, {
|
|
110
|
+
place: place
|
|
111
|
+
}, place.place_id))]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
MapPicker.defaultProps = {
|
|
115
|
+
value: {
|
|
116
|
+
lat: -6.175392,
|
|
117
|
+
lng: 106.827153
|
|
118
|
+
},
|
|
119
|
+
showSelectButton: true
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { MapPicker as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
2
|
+
import Flex from '../../layout/flex/Flex.esm.js';
|
|
3
|
+
|
|
4
|
+
//@ts-nocheck
|
|
5
|
+
const Container = styled(Flex, {
|
|
6
|
+
gap: '$spacing-05',
|
|
7
|
+
'@md': {
|
|
8
|
+
width: 517
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const AddressCardWrapper = styled(Flex, {
|
|
12
|
+
border: '1px solid $gray150',
|
|
13
|
+
borderRadius: 8,
|
|
14
|
+
gap: '$spacing-04',
|
|
15
|
+
padding: '$spacing-05'
|
|
16
|
+
});
|
|
17
|
+
const Address = styled('p', {
|
|
18
|
+
fontSize: 14,
|
|
19
|
+
fontWeight: 400,
|
|
20
|
+
color: '$textPrimary',
|
|
21
|
+
margin: 0
|
|
22
|
+
});
|
|
23
|
+
const SearchInput = styled('input', {
|
|
24
|
+
boxSizing: `border-box`,
|
|
25
|
+
border: `1px solid transparent`,
|
|
26
|
+
width: 204,
|
|
27
|
+
height: 32,
|
|
28
|
+
paddingLeft: 36,
|
|
29
|
+
paddingRight: 10,
|
|
30
|
+
borderRadius: 6,
|
|
31
|
+
boxShadow: `0 2px 6px rgba(0, 0, 0, 0.3)`,
|
|
32
|
+
fontSize: 14,
|
|
33
|
+
outline: `none`,
|
|
34
|
+
textOverflow: `ellipses`
|
|
35
|
+
});
|
|
36
|
+
const ZoomControlButton = styled(Flex, {
|
|
37
|
+
height: 44,
|
|
38
|
+
width: 44,
|
|
39
|
+
padding: 12,
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
border: '1px solid $btnPrimary',
|
|
43
|
+
borderRadius: 6,
|
|
44
|
+
backgroundColor: '$bgWhite',
|
|
45
|
+
cursor: 'pointer',
|
|
46
|
+
zIndex: 1800
|
|
47
|
+
});
|
|
48
|
+
const MapWrapper = styled('div', {
|
|
49
|
+
position: 'relative',
|
|
50
|
+
width: '100% !important',
|
|
51
|
+
height: '441px !important',
|
|
52
|
+
overflow: 'hidden',
|
|
53
|
+
'@md': {
|
|
54
|
+
width: '517px !important'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const mapContainerStyle = {
|
|
58
|
+
mobile: {
|
|
59
|
+
position: 'relative',
|
|
60
|
+
width: '100%',
|
|
61
|
+
height: '441px'
|
|
62
|
+
},
|
|
63
|
+
desktop: {
|
|
64
|
+
position: 'relative',
|
|
65
|
+
width: '517px',
|
|
66
|
+
height: '441px'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { Address, AddressCardWrapper, Container, MapWrapper, SearchInput, ZoomControlButton, mapContainerStyle };
|