@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,39 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
4
|
+
import Box from '../../../../layout/box/Box.esm.js';
|
|
5
|
+
import Flex from '../../../../layout/flex/Flex.esm.js';
|
|
6
|
+
import { ChevronUpOutline, ChevronDownOutline } from '@majoo-ui/icons';
|
|
7
|
+
|
|
8
|
+
const OptionGroup = styled(Flex, {
|
|
9
|
+
position: 'relative'
|
|
10
|
+
});
|
|
11
|
+
const OptionItem = styled(Flex, {
|
|
12
|
+
fontWeight: 600
|
|
13
|
+
});
|
|
14
|
+
const OptionChildren = styled(Box, {});
|
|
15
|
+
const IconWrapper = styled(Box, {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
top: 10,
|
|
18
|
+
right: 0,
|
|
19
|
+
cursor: 'pointer'
|
|
20
|
+
});
|
|
21
|
+
function OptionGroupItem({
|
|
22
|
+
item,
|
|
23
|
+
children
|
|
24
|
+
}) {
|
|
25
|
+
const [isShow, setIsShow] = useState(false);
|
|
26
|
+
return jsxs(OptionGroup, {
|
|
27
|
+
direction: "column",
|
|
28
|
+
children: [jsxs(OptionItem, {
|
|
29
|
+
children: [item, jsx(IconWrapper, {
|
|
30
|
+
onClick: () => setIsShow(!isShow),
|
|
31
|
+
children: isShow ? jsx(ChevronUpOutline, {}) : jsx(ChevronDownOutline, {})
|
|
32
|
+
})]
|
|
33
|
+
}), isShow && jsx(OptionChildren, {
|
|
34
|
+
children: children
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { OptionGroupItem as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
const CheckOutline = props => /*#__PURE__*/jsxs("svg", {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
xmlSpace: "preserve",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
style: {
|
|
10
|
+
shapeRendering: 'geometricPrecision',
|
|
11
|
+
textRendering: 'geometricPrecision',
|
|
12
|
+
imageRendering: 'optimizeQuality',
|
|
13
|
+
fillRule: 'evenodd',
|
|
14
|
+
clipRule: 'evenodd'
|
|
15
|
+
},
|
|
16
|
+
viewBox: "0 0 13.06 13.06",
|
|
17
|
+
...props,
|
|
18
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
19
|
+
d: "M0 2.5A2.5 2.5 0 0 1 2.5 0h8.05a2.5 2.5 0 0 1 2.5 2.5v8.05a2.5 2.5 0 0 1-2.5 2.5H2.5c-.66 0-1.3-.26-1.77-.73S0 11.21 0 10.55V2.5z",
|
|
20
|
+
style: {
|
|
21
|
+
fill: props.color,
|
|
22
|
+
fillRule: 'nonzero'
|
|
23
|
+
}
|
|
24
|
+
}), /*#__PURE__*/jsx("path", {
|
|
25
|
+
d: "M10.12 4.53a.47.47 0 0 0 .14-.33.47.47 0 0 0-.14-.33.47.47 0 0 0-.33-.14.47.47 0 0 0-.33.14L5.13 8.2 3.6 6.66a.47.47 0 0 0-.33-.14.47.47 0 0 0-.33.14.47.47 0 0 0-.14.33c0 .12.05.24.14.33l1.87 1.87c.04.04.09.08.15.1.06.02.12.04.18.04s.12-.01.18-.04c.06-.02.11-.06.15-.1l4.66-4.66z",
|
|
26
|
+
style: {
|
|
27
|
+
fill: '#fefefe',
|
|
28
|
+
fillRule: 'nonzero'
|
|
29
|
+
}
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { CheckOutline as default };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import InputSelectCheck from '../InputSelectCheck/InputSelectCheck.esm.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const InputSelectTag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
7
|
+
return /*#__PURE__*/jsx(InputSelectCheck, {
|
|
8
|
+
ref: ref,
|
|
9
|
+
showSelectedTag: true,
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
InputSelectTag.propTypes = {
|
|
14
|
+
placeholder: PropTypes.string,
|
|
15
|
+
option: PropTypes.array.isRequired,
|
|
16
|
+
size: PropTypes.string,
|
|
17
|
+
disabled: PropTypes.bool,
|
|
18
|
+
readOnly: PropTypes.bool,
|
|
19
|
+
isInvalid: PropTypes.bool,
|
|
20
|
+
sortBy: PropTypes.string,
|
|
21
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]),
|
|
22
|
+
onChange: PropTypes.func,
|
|
23
|
+
onRemoveItem: PropTypes.func,
|
|
24
|
+
search: PropTypes.bool,
|
|
25
|
+
placement: PropTypes.oneOf(['top', 'bottom']),
|
|
26
|
+
unremovableTags: PropTypes.arrayOf(PropTypes.string),
|
|
27
|
+
disabledOptions: PropTypes.arrayOf(PropTypes.string),
|
|
28
|
+
disabledSortChecked: PropTypes.bool,
|
|
29
|
+
textEmptyItem: PropTypes.string,
|
|
30
|
+
helperText: PropTypes.string,
|
|
31
|
+
showCounter: PropTypes.bool,
|
|
32
|
+
labelCounter: PropTypes.string,
|
|
33
|
+
collapsible: PropTypes.bool,
|
|
34
|
+
toggleInput: PropTypes.bool,
|
|
35
|
+
defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]),
|
|
36
|
+
fetchData: PropTypes.func,
|
|
37
|
+
onSearch: PropTypes.func,
|
|
38
|
+
isLoading: PropTypes.bool,
|
|
39
|
+
showTagSelectAll: PropTypes.bool,
|
|
40
|
+
maxSelectedItem: PropTypes.number,
|
|
41
|
+
mobileOnly: PropTypes.bool,
|
|
42
|
+
desktopOnly: PropTypes.bool
|
|
43
|
+
};
|
|
44
|
+
InputSelectTag.defaultProps = {
|
|
45
|
+
size: 'lg',
|
|
46
|
+
disabled: false,
|
|
47
|
+
readOnly: false,
|
|
48
|
+
isInvalid: false,
|
|
49
|
+
search: true,
|
|
50
|
+
placement: 'bottom',
|
|
51
|
+
value: [],
|
|
52
|
+
disabledOptions: [],
|
|
53
|
+
disabledSortChecked: false,
|
|
54
|
+
unremovableTags: [],
|
|
55
|
+
sortBy: 'name',
|
|
56
|
+
showCounter: false,
|
|
57
|
+
collapsible: true,
|
|
58
|
+
toggleInput: true,
|
|
59
|
+
defaultValue: []
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { InputSelectTag as default };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useState } from 'react';
|
|
3
|
+
import Box from '../../../../layout/box/Box.esm.js';
|
|
4
|
+
import Flex from '../../../../layout/flex/Flex.esm.js';
|
|
5
|
+
import SignatureModal from './SignatureModal.esm.js';
|
|
6
|
+
import { styled } from '@stitches/react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import Text from '../../../text/Text.esm.js';
|
|
9
|
+
import { CloseFilled } from '@majoo-ui/icons';
|
|
10
|
+
import { foundations } from '@majoo-ui/core';
|
|
11
|
+
import { useMountedLayoutEffect } from 'react-table';
|
|
12
|
+
|
|
13
|
+
const SignatureContainer = styled(Flex, {
|
|
14
|
+
position: 'relative',
|
|
15
|
+
border: '2px dashed $gray300',
|
|
16
|
+
borderRadius: 8,
|
|
17
|
+
height: '88px',
|
|
18
|
+
width: '100%',
|
|
19
|
+
cursor: 'pointer',
|
|
20
|
+
transition: '0.2s',
|
|
21
|
+
transitionDuration: '0.5s',
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
background: '$bgGray',
|
|
25
|
+
'&:hover': {
|
|
26
|
+
border: '2px dashed $primary400',
|
|
27
|
+
background: '$bgSelectedLight'
|
|
28
|
+
},
|
|
29
|
+
variants: {
|
|
30
|
+
hasContent: {
|
|
31
|
+
true: {
|
|
32
|
+
'&:hover': {
|
|
33
|
+
background: '$bgGray'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
showError: {
|
|
38
|
+
true: {
|
|
39
|
+
border: '2px dashed $red400',
|
|
40
|
+
'&:hover': {
|
|
41
|
+
border: '2px dashed $red300',
|
|
42
|
+
background: '$bgFailed'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
disabled: {
|
|
47
|
+
true: {
|
|
48
|
+
cursor: 'not-allowed',
|
|
49
|
+
'&:hover': {
|
|
50
|
+
background: '$bgGray'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
function InputSignature({
|
|
57
|
+
title,
|
|
58
|
+
onChange,
|
|
59
|
+
defaultValue = '',
|
|
60
|
+
disabled = false,
|
|
61
|
+
css,
|
|
62
|
+
isMobile
|
|
63
|
+
}) {
|
|
64
|
+
const {
|
|
65
|
+
t
|
|
66
|
+
} = useTranslation(['MajooUI/inputSignature', 'translation']);
|
|
67
|
+
const [signatureImage, setSignatureImage] = useState(defaultValue);
|
|
68
|
+
const [open, setOpen] = useState(false);
|
|
69
|
+
const handleSave = signature => {
|
|
70
|
+
setSignatureImage(signature);
|
|
71
|
+
};
|
|
72
|
+
useMountedLayoutEffect(() => {
|
|
73
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(signatureImage);
|
|
74
|
+
}, [signatureImage]);
|
|
75
|
+
return jsxs(React__default.Fragment, {
|
|
76
|
+
children: [jsx(SignatureContainer, {
|
|
77
|
+
hasContent: !!signatureImage,
|
|
78
|
+
onClick: () => {
|
|
79
|
+
if (!disabled && !signatureImage) {
|
|
80
|
+
setOpen(true);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
disabled: disabled,
|
|
84
|
+
css: css,
|
|
85
|
+
children: signatureImage ? jsxs(React__default.Fragment, {
|
|
86
|
+
children: [!disabled ? jsx(Box, {
|
|
87
|
+
css: {
|
|
88
|
+
position: 'absolute',
|
|
89
|
+
top: '8px',
|
|
90
|
+
right: '8px'
|
|
91
|
+
},
|
|
92
|
+
onClick: e => {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
setSignatureImage('');
|
|
95
|
+
},
|
|
96
|
+
children: jsx(CloseFilled, {
|
|
97
|
+
color: foundations.colors.iconRed
|
|
98
|
+
})
|
|
99
|
+
}) : null, jsx("img", {
|
|
100
|
+
src: signatureImage,
|
|
101
|
+
alt: "signature",
|
|
102
|
+
style: {
|
|
103
|
+
height: '100%'
|
|
104
|
+
}
|
|
105
|
+
})]
|
|
106
|
+
}) : jsx(Text, {
|
|
107
|
+
variant: "label",
|
|
108
|
+
color: "disable",
|
|
109
|
+
children: t('placeholder', 'Tanda tangan di sini')
|
|
110
|
+
})
|
|
111
|
+
}), jsx(SignatureModal, {
|
|
112
|
+
t: t,
|
|
113
|
+
open: open,
|
|
114
|
+
onOpenChange: setOpen,
|
|
115
|
+
onSave: handleSave,
|
|
116
|
+
isMobile: isMobile,
|
|
117
|
+
title: title || signatureImage ? t('editTitle', 'Ubah Tanda Tangan') : t('addTitle', 'Tambah Tanda Tangan')
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { InputSignature, InputSignature as default };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import ModalDialog, { ModalDialogTitle, ModalDialogContent, ModalDialogFooter } from '../../../modalDialog/ModalDialog.esm.js';
|
|
4
|
+
import { Button } from '../../../button/Button.esm.js';
|
|
5
|
+
import { DialogClose } from '../../../dialog/Dialog.esm.js';
|
|
6
|
+
import SignaturePad from 'react-signature-pad-wrapper';
|
|
7
|
+
import { foundations } from '@majoo-ui/core';
|
|
8
|
+
|
|
9
|
+
const SignatureModal = ({
|
|
10
|
+
t,
|
|
11
|
+
open,
|
|
12
|
+
onOpenChange,
|
|
13
|
+
onSave,
|
|
14
|
+
title,
|
|
15
|
+
isMobile
|
|
16
|
+
}) => {
|
|
17
|
+
const signaturePadRef = useRef(null);
|
|
18
|
+
const handleSave = () => {
|
|
19
|
+
if (signaturePadRef.current) {
|
|
20
|
+
const signature = signaturePadRef.current.toDataURL();
|
|
21
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(signature);
|
|
22
|
+
}
|
|
23
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
24
|
+
};
|
|
25
|
+
return jsxs(ModalDialog, {
|
|
26
|
+
open: open,
|
|
27
|
+
onOpenChange: onOpenChange,
|
|
28
|
+
isMobile: isMobile,
|
|
29
|
+
children: [jsx(ModalDialogTitle, {
|
|
30
|
+
children: title
|
|
31
|
+
}), jsx(ModalDialogContent, {
|
|
32
|
+
children: jsx(SignaturePad, {
|
|
33
|
+
ref: signaturePadRef,
|
|
34
|
+
height: 256,
|
|
35
|
+
canvasProps: {
|
|
36
|
+
style: {
|
|
37
|
+
border: '2px dashed #C0C4C4',
|
|
38
|
+
borderRadius: '8px'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
options: {
|
|
42
|
+
penColor: 'black',
|
|
43
|
+
backgroundColor: foundations.colors.bgGray
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}), jsxs(ModalDialogFooter, {
|
|
47
|
+
css: {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
gap: '$compact'
|
|
50
|
+
},
|
|
51
|
+
children: [jsx(DialogClose, {
|
|
52
|
+
asChild: true,
|
|
53
|
+
children: jsx(Button, {
|
|
54
|
+
buttonType: "ghost",
|
|
55
|
+
size: "sm",
|
|
56
|
+
children: t('label.cancel', 'Batal')
|
|
57
|
+
})
|
|
58
|
+
}), jsx(Button, {
|
|
59
|
+
size: "sm",
|
|
60
|
+
onClick: handleSave,
|
|
61
|
+
children: t('label.save', 'Simpan')
|
|
62
|
+
})]
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { SignatureModal as default };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledThumb = styled(SwitchPrimitive.Thumb, {
|
|
8
|
+
display: 'block',
|
|
9
|
+
width: '16px',
|
|
10
|
+
height: '16px',
|
|
11
|
+
backgroundColor: 'white',
|
|
12
|
+
borderRadius: '$round',
|
|
13
|
+
transition: 'transform 100ms',
|
|
14
|
+
transform: 'translateX(4px)',
|
|
15
|
+
willChange: 'transform',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
'&[data-state="checked"]': {
|
|
18
|
+
transform: 'translateX(36px)'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
22
|
+
all: 'unset',
|
|
23
|
+
width: '56px',
|
|
24
|
+
height: '24px',
|
|
25
|
+
backgroundColor: '$formDefault',
|
|
26
|
+
borderRadius: '9999px',
|
|
27
|
+
position: 'relative',
|
|
28
|
+
cursor: 'pointer',
|
|
29
|
+
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
|
30
|
+
'&:focus': {
|
|
31
|
+
outline: '1.5px solid $colors$borderFocus',
|
|
32
|
+
outlineOffset: '1px'
|
|
33
|
+
},
|
|
34
|
+
'&::before': {
|
|
35
|
+
display: 'block',
|
|
36
|
+
content: 'attr(dataOffLabel)',
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
fontWeight: 600,
|
|
39
|
+
fontSize: '$label',
|
|
40
|
+
lineHeight: '$label',
|
|
41
|
+
letterSpacing: '$label',
|
|
42
|
+
color: 'white',
|
|
43
|
+
right: '$spacing-03'
|
|
44
|
+
},
|
|
45
|
+
'&[data-state="checked"]': {
|
|
46
|
+
backgroundColor: '$bgBrand',
|
|
47
|
+
'&::before': {
|
|
48
|
+
display: 'block',
|
|
49
|
+
content: 'attr(dataOnLabel)',
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
fontWeight: 600,
|
|
52
|
+
fontSize: '$label',
|
|
53
|
+
lineHeight: '$label',
|
|
54
|
+
letterSpacing: '$label',
|
|
55
|
+
color: 'white',
|
|
56
|
+
left: '$spacing-03'
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
'&:disabled': {
|
|
60
|
+
backgroundColor: '$gray200',
|
|
61
|
+
'&::before': {
|
|
62
|
+
color: '$textDisable'
|
|
63
|
+
},
|
|
64
|
+
[`& ${StyledThumb}`]: {
|
|
65
|
+
backgroundColor: '$iconDisable'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const InputSwitch = ({
|
|
70
|
+
id,
|
|
71
|
+
defaultChecked,
|
|
72
|
+
dataOnLabel,
|
|
73
|
+
dataOffLabel,
|
|
74
|
+
disabled,
|
|
75
|
+
...props
|
|
76
|
+
}) => /*#__PURE__*/jsx(StyledSwitch, {
|
|
77
|
+
defaultChecked: defaultChecked,
|
|
78
|
+
dataOnLabel: dataOnLabel,
|
|
79
|
+
dataOffLabel: dataOffLabel,
|
|
80
|
+
disabled: disabled,
|
|
81
|
+
id: id,
|
|
82
|
+
...props,
|
|
83
|
+
children: /*#__PURE__*/jsx(StyledThumb, {})
|
|
84
|
+
});
|
|
85
|
+
InputSwitch.propTypes = {
|
|
86
|
+
id: PropTypes.string,
|
|
87
|
+
disabled: PropTypes.bool,
|
|
88
|
+
dataOnLabel: PropTypes.string,
|
|
89
|
+
dataOffLabel: PropTypes.string,
|
|
90
|
+
defaultChecked: PropTypes.bool,
|
|
91
|
+
checked: PropTypes.bool,
|
|
92
|
+
onCheckedChange: PropTypes.func
|
|
93
|
+
};
|
|
94
|
+
InputSwitch.displayName = 'InputSwitch';
|
|
95
|
+
|
|
96
|
+
export { InputSwitch as default };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { styled } from '../../../../config/stitches.config.esm.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
const StyledThumb = styled(SwitchPrimitive.Thumb, {
|
|
8
|
+
display: 'block',
|
|
9
|
+
width: '16px',
|
|
10
|
+
height: '16px',
|
|
11
|
+
backgroundColor: 'white',
|
|
12
|
+
boxShadow: '0px 1px 3px grey',
|
|
13
|
+
borderRadius: '$round',
|
|
14
|
+
transition: 'transform 100ms',
|
|
15
|
+
transform: 'translateX(4px)',
|
|
16
|
+
willChange: 'transform',
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
position: 'relative',
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
'&[data-state="checked"]': {
|
|
21
|
+
transform: 'translateX(36px)'
|
|
22
|
+
},
|
|
23
|
+
'img': {
|
|
24
|
+
width: '100%',
|
|
25
|
+
height: '100%',
|
|
26
|
+
objectFit: 'contain',
|
|
27
|
+
display: 'block'
|
|
28
|
+
},
|
|
29
|
+
'.on': {
|
|
30
|
+
display: 'none'
|
|
31
|
+
},
|
|
32
|
+
'.off': {
|
|
33
|
+
display: 'block'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const StyledSwitch = styled(SwitchPrimitive.Root, {
|
|
37
|
+
all: 'unset',
|
|
38
|
+
width: '56px',
|
|
39
|
+
height: '24px',
|
|
40
|
+
backgroundColor: 'white',
|
|
41
|
+
borderRadius: '9999px',
|
|
42
|
+
border: '1px solid $gray150',
|
|
43
|
+
position: 'relative',
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
|
46
|
+
'&:focus': {
|
|
47
|
+
outline: '1.5px solid $colors$borderFocus'
|
|
48
|
+
},
|
|
49
|
+
'&::before': {
|
|
50
|
+
display: 'block',
|
|
51
|
+
content: 'attr(dataOffLabel)',
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
fontSize: '$label',
|
|
55
|
+
lineHeight: '$label',
|
|
56
|
+
letterSpacing: '$label',
|
|
57
|
+
color: '$textPrimary',
|
|
58
|
+
right: '$spacing-03'
|
|
59
|
+
},
|
|
60
|
+
'&[data-state="checked"]': {
|
|
61
|
+
'&::before': {
|
|
62
|
+
display: 'block',
|
|
63
|
+
content: 'attr(dataOnLabel)',
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
fontWeight: 600,
|
|
66
|
+
fontSize: '$label',
|
|
67
|
+
lineHeight: '$label',
|
|
68
|
+
letterSpacing: '$label',
|
|
69
|
+
color: '$textPrimary',
|
|
70
|
+
left: '$spacing-03'
|
|
71
|
+
},
|
|
72
|
+
[`& ${StyledThumb}`]: {
|
|
73
|
+
'.on': {
|
|
74
|
+
display: 'block'
|
|
75
|
+
},
|
|
76
|
+
'.off': {
|
|
77
|
+
display: 'none'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
'&:disabled': {
|
|
82
|
+
backgroundColor: '$gray200',
|
|
83
|
+
'&::before': {
|
|
84
|
+
color: '$textDisable'
|
|
85
|
+
},
|
|
86
|
+
[`& ${StyledThumb}`]: {
|
|
87
|
+
backgroundColor: '$iconDisable'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const InputSwitchWithImage = ({
|
|
92
|
+
id,
|
|
93
|
+
defaultChecked,
|
|
94
|
+
dataOnLabel,
|
|
95
|
+
dataOffLabel,
|
|
96
|
+
disabled,
|
|
97
|
+
onImage,
|
|
98
|
+
offImage,
|
|
99
|
+
thumbAltOn,
|
|
100
|
+
thumbAltOff,
|
|
101
|
+
...props
|
|
102
|
+
}) => /*#__PURE__*/jsx(StyledSwitch, {
|
|
103
|
+
defaultChecked: defaultChecked,
|
|
104
|
+
dataOnLabel: dataOnLabel,
|
|
105
|
+
dataOffLabel: dataOffLabel,
|
|
106
|
+
disabled: disabled,
|
|
107
|
+
id: id,
|
|
108
|
+
...props,
|
|
109
|
+
children: /*#__PURE__*/jsxs(StyledThumb, {
|
|
110
|
+
children: [onImage && /*#__PURE__*/jsx("img", {
|
|
111
|
+
src: onImage,
|
|
112
|
+
alt: thumbAltOn,
|
|
113
|
+
className: "on"
|
|
114
|
+
}), offImage && /*#__PURE__*/jsx("img", {
|
|
115
|
+
src: offImage,
|
|
116
|
+
alt: thumbAltOff,
|
|
117
|
+
className: "off"
|
|
118
|
+
})]
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
InputSwitchWithImage.propTypes = {
|
|
122
|
+
id: PropTypes.string,
|
|
123
|
+
disabled: PropTypes.bool,
|
|
124
|
+
dataOnLabel: PropTypes.string,
|
|
125
|
+
dataOffLabel: PropTypes.string,
|
|
126
|
+
defaultChecked: PropTypes.bool,
|
|
127
|
+
checked: PropTypes.bool,
|
|
128
|
+
onCheckedChange: PropTypes.func,
|
|
129
|
+
onImage: PropTypes.string,
|
|
130
|
+
offImage: PropTypes.string,
|
|
131
|
+
thumbAltOn: PropTypes.string,
|
|
132
|
+
thumbAltOff: PropTypes.string
|
|
133
|
+
};
|
|
134
|
+
InputSwitchWithImage.displayName = 'InputSwitchWithImage';
|
|
135
|
+
|
|
136
|
+
export { InputSwitchWithImage as default };
|