@cashub/ui-elv 1.0.2 → 1.0.4
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/datetimePicker/index.js +2 -37
- package/esm/Tab/Tab.js +21 -0
- package/esm/Tab/TabList.js +160 -0
- package/esm/Tab/TabPanel.js +42 -0
- package/esm/Tab/TabTab.js +98 -0
- package/esm/Tab/index.js +23 -0
- package/esm/Tab/subComponent/TabContext.js +3 -0
- package/esm/Tab/subComponent/TabListV2.js +18 -0
- package/esm/Tab/subComponent/TabPanelV2.js +45 -0
- package/esm/Tab/subComponent/TabTabV2.js +56 -0
- package/esm/VerticalTab/TabList.js +20 -0
- package/esm/VerticalTab/TabPanel.js +45 -0
- package/esm/VerticalTab/TabTab.js +63 -0
- package/esm/VerticalTab/VerticalTab.js +34 -0
- package/esm/VerticalTab/index.js +9 -0
- package/esm/VerticalTab/subComponent/TabContext.js +3 -0
- package/esm/alert/Alert.js +22 -0
- package/esm/alert/index.js +1 -0
- package/esm/animate/Collapse.js +65 -0
- package/esm/animate/Loader.js +51 -0
- package/esm/animate/NumberCounter.js +45 -0
- package/esm/animate/PulseRing.js +26 -0
- package/esm/animate/Spinner.js +11 -0
- package/esm/animate/index.js +5 -0
- package/esm/assets/css/autocomplete.css +16 -0
- package/esm/assets/css/font.css +4 -0
- package/esm/assets/css/global.css +2 -0
- package/esm/assets/font/helvetica/Helvetica.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
- package/esm/assets/icons/app-management.png +0 -0
- package/esm/assets/icons/burger-black.png +0 -0
- package/esm/assets/icons/burger-white.png +0 -0
- package/esm/assets/icons/burger.png +0 -0
- package/esm/assets/icons/file.svg +1 -0
- package/esm/assets/icons/map_icon1.png +0 -0
- package/esm/assets/icons/map_icon4.png +0 -0
- package/esm/assets/images/bg-aside.png +0 -0
- package/esm/assets/images/bg-chart-circle.png +0 -0
- package/esm/assets/images/bg-chart-triangle.png +0 -0
- package/esm/assets/images/cashub-logo-only.png +0 -0
- package/esm/assets/images/default-user.jpg +0 -0
- package/esm/assets/images/logo-cashub.png +0 -0
- package/esm/assets/images/map.png +0 -0
- package/esm/assets/images/qrcode.png +0 -0
- package/esm/backdrop/BaseBackdrop.js +11 -0
- package/esm/backdrop/LoadingBackdrop.js +10 -0
- package/esm/backdrop/ModalBackdrop.js +8 -0
- package/esm/backdrop/index.js +3 -0
- package/esm/badge/Badge.js +19 -0
- package/esm/badge/BadgeDot.js +11 -0
- package/esm/badge/BadgeFill.js +42 -0
- package/esm/badge/BadgeFillTriangle.js +138 -0
- package/esm/badge/BadgeWithText.js +24 -0
- package/esm/badge/index.js +5 -0
- package/esm/billing/BarChart.js +45 -0
- package/esm/billing/Grid.js +38 -0
- package/esm/billing/Header2.js +19 -0
- package/esm/billing/Header3.js +31 -0
- package/esm/billing/Paragraph.js +27 -0
- package/esm/billing/ParagraphGroup.js +16 -0
- package/esm/billing/ParagraphText.js +20 -0
- package/esm/billing/Section.js +44 -0
- package/esm/billing/SectionBody.js +11 -0
- package/esm/billing/SectionHeader.js +20 -0
- package/esm/billing/__stories__/BarChart.stories.js_bak +46 -0
- package/esm/billing/__stories__/Grid.stories.js_bak +57 -0
- package/esm/billing/__stories__/Header2.stories.js_bak +62 -0
- package/esm/billing/__stories__/Header3.stories.js_bak +69 -0
- package/esm/billing/__stories__/Paragraph.stories.js_bak +84 -0
- package/esm/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
- package/esm/billing/__stories__/ParagraphText.stories.js_bak +64 -0
- package/esm/billing/__stories__/Section.stories.js_bak +115 -0
- package/esm/billing/__stories__/SectionBody.stories.js_bak +62 -0
- package/esm/billing/__stories__/SectionHeader.stories.js-bak +68 -0
- package/esm/breadcrumb/Breadcrumb.js +71 -0
- package/esm/breadcrumb/index.js +1 -0
- package/esm/button/Button.js +145 -0
- package/esm/button/ButtonGroup.js +54 -0
- package/esm/button/IconButton.js +64 -0
- package/esm/button/ScrollToTopButton.js +47 -0
- package/esm/button/index.js +4 -0
- package/esm/callout/Callout.js +45 -0
- package/esm/callout/index.js +1 -0
- package/esm/chart/BarChart.js +147 -0
- package/esm/chart/DoughnutChart.js +110 -0
- package/esm/chart/LineChart.js +140 -0
- package/esm/chart/SingleBarChart.js +35 -0
- package/esm/chart/index.js +5 -0
- package/esm/chart/utils/centerTextPlugin.js +56 -0
- package/esm/chart/utils/customTooltip.js +84 -0
- package/esm/chart/utils/customTooltipLifecyclePlugin.js +16 -0
- package/esm/chart/utils/htmlLegendPlugin.js +83 -0
- package/esm/chart/utils/index.js +3 -0
- package/esm/chart/utils/padEmptyChartBar.js +47 -0
- package/esm/chart/utils/tooltipElement.js +17 -0
- package/esm/chart/utils/xAxisLabelTooltipPlugin.js +101 -0
- package/esm/chart/utils/yAxisTopTitlePlugin.js +43 -0
- package/esm/container/FlexContainer.js +33 -0
- package/esm/container/index.js +1 -0
- package/esm/cropper/Cropper.js +47 -0
- package/esm/cropper/CropperModalHandler.js +34 -0
- package/esm/cropper/index.js +2 -0
- package/esm/cropper/subComponent/CropImageModal.js +72 -0
- package/{datetimePicker/DatetimePicker.js → esm/datetimePicker/DatetimePickerV3.js} +63 -31
- package/esm/datetimePicker/TimeInput.js +49 -0
- package/esm/datetimePicker/TimePickerStyle.js +58 -0
- package/esm/datetimePicker/TimePickerV2.js +199 -0
- package/esm/datetimePicker/accordion/Month.js +245 -0
- package/esm/datetimePicker/accordion/Year.js +275 -0
- package/esm/datetimePicker/index.js +4 -0
- package/esm/datetimePicker/provider/constant.js +38 -0
- package/esm/datetimePicker/subComponent/DateTimePickerContext.js +3 -0
- package/esm/datetimePicker/utils/GMTDate.js +9 -0
- package/esm/datetimePicker/utils/pad.js +7 -0
- package/esm/datetimePicker/utils/toUTC0.js +7 -0
- package/esm/descriptionList/DescriptionDetail.js +21 -0
- package/esm/descriptionList/DescriptionList.js +18 -0
- package/esm/descriptionList/DescriptionTerm.js +7 -0
- package/esm/descriptionList/index.js +3 -0
- package/esm/divider/Divider.js +24 -0
- package/esm/divider/index.js +1 -0
- package/esm/dropdown/Dropdown.js +48 -0
- package/esm/dropdown/DropdownButtonOption.js +36 -0
- package/esm/dropdown/DropdownContent.js +83 -0
- package/esm/dropdown/DropdownDivOption.js +19 -0
- package/esm/dropdown/DropdownItem.js +19 -0
- package/esm/dropdown/DropdownLinkOption.js +17 -0
- package/esm/dropdown/DropdownToggle.js +31 -0
- package/esm/dropdown/index.js +11 -0
- package/esm/dropdown/subComponent/DropdownContext.js +3 -0
- package/esm/dropzone/FileDropzone.js +472 -0
- package/esm/dropzone/ImageDropzone.js +327 -0
- package/esm/dropzone/index.js +2 -0
- package/esm/dropzone/subComponent/Message.js +19 -0
- package/esm/figure/IconFigure.js +35 -0
- package/esm/figure/ImageFigure.js +31 -0
- package/esm/figure/index.js +2 -0
- package/esm/file/HiddenFileInput.js +8 -0
- package/esm/file/index.js +1 -0
- package/esm/form/Checkbox.js +157 -0
- package/esm/form/Fieldset.js +11 -0
- package/esm/form/FormItem.js +15 -0
- package/esm/form/Input.js +59 -0
- package/esm/form/Label.js +54 -0
- package/esm/form/MutedText.js +14 -0
- package/esm/form/PasswordInput.js +40 -0
- package/esm/form/RadioButton.js +94 -0
- package/esm/form/SearchSelect.js +174 -0
- package/esm/form/Searchbox.js +91 -0
- package/esm/form/Slider.js +39 -0
- package/esm/form/SwitchButton.js +97 -0
- package/esm/form/Textarea.js +34 -0
- package/esm/form/TreeView.js +66 -0
- package/esm/form/index.js +14 -0
- package/esm/grid/Column.js +39 -0
- package/esm/grid/Grid.js +28 -0
- package/esm/grid/index.js +2 -0
- package/esm/heading/Heading1.js +14 -0
- package/esm/heading/Heading2.js +21 -0
- package/esm/heading/Heading3.js +42 -0
- package/esm/heading/index.js +3 -0
- package/esm/helmet/Helmet.js +17 -0
- package/esm/helmet/index.js +3 -0
- package/esm/iconbox/ApplicationIconBox.js +74 -0
- package/esm/iconbox/IconBox.js +60 -0
- package/esm/iconbox/IconBoxV2.js +63 -0
- package/esm/iconbox/index.js +3 -0
- package/esm/iconbox/subComponent/IconBoxFigure.js +43 -0
- package/esm/iconbox/subComponent/IconBoxImage.js +35 -0
- package/esm/image/ImageFluid.js +10 -0
- package/esm/image/UploadImage.js +243 -0
- package/esm/image/index.js +2 -0
- package/esm/index.js +47 -0
- package/esm/keyframe/Pulse.js +15 -0
- package/esm/keyframe/Spin.js +7 -0
- package/esm/layout/Aside.js +39 -0
- package/esm/layout/AsideHeader.jsx +27 -0
- package/esm/layout/Backdrop.js +16 -0
- package/esm/layout/Container.js +30 -0
- package/esm/layout/Footer.js +36 -0
- package/esm/layout/Header.jsx +55 -0
- package/esm/layout/Layout.jsx +84 -0
- package/esm/layout/Logo.jsx +17 -0
- package/esm/layout/MenuIcon.jsx +27 -0
- package/esm/layout/Sidebar.jsx +271 -0
- package/esm/layout/index.js +1 -0
- package/esm/link/LinkSpan.js +62 -0
- package/esm/link/index.js +1 -0
- package/esm/map/GoogleMap.js +439 -0
- package/esm/map/GoogleReverseGeolocation.js +193 -0
- package/esm/map/LeafletMap.js +224 -0
- package/esm/map/LeafletReverseGeolocation.js +94 -0
- package/esm/map/index.js +4 -0
- package/esm/map/subComponent/BasicLeafletMap.js +27 -0
- package/esm/map/subComponent/GoogleMapContainer.js +22 -0
- package/esm/map/subComponent/GoogleMapPopup.js +103 -0
- package/esm/map/subComponent/GoogleMapWrapper.js +34 -0
- package/esm/map/subComponent/LeafletDrawControl.js +116 -0
- package/esm/map/subComponent/LeafletMapContainer.js +166 -0
- package/esm/map/subComponent/MapSearchBoxControl.js +47 -0
- package/esm/modal/StateModal.js +169 -0
- package/esm/modal/TitleModal.js +241 -0
- package/esm/modal/index.js +2 -0
- package/esm/page/Disclaimer.js +121 -0
- package/esm/page/index.js +1 -0
- package/esm/paginate/Paginate.js +129 -0
- package/esm/paginate/index.js +1 -0
- package/esm/popover/Popover.js +82 -0
- package/esm/popover/index.js +1 -0
- package/esm/qrcode/QRCode.js +51 -0
- package/esm/qrcode/QRCodeContainter.js +27 -0
- package/esm/qrcode/index.js +2 -0
- package/esm/ribbon/Ribbon.js +35 -0
- package/esm/ribbon/index.js +1 -0
- package/esm/section/Section.js +126 -0
- package/esm/section/SectionBody.js +43 -0
- package/esm/section/SectionHeader.js +61 -0
- package/esm/section/SectionToolbar.js +11 -0
- package/esm/section/SectionToolbarItem.js +10 -0
- package/esm/section/index.js +5 -0
- package/esm/select/InputSelect.js +263 -0
- package/esm/select/Select.js +811 -0
- package/esm/select/index.js +2 -0
- package/esm/select/subComponent/Checkbox.js +40 -0
- package/esm/select/subComponent/Footer.js +6 -0
- package/esm/select/subComponent/ListBox.js +23 -0
- package/esm/select/subComponent/Option.js +37 -0
- package/esm/select/subComponent/OptionGroup.js +16 -0
- package/esm/select/subComponent/Options.js +25 -0
- package/esm/select/subComponent/SearchBox.js +51 -0
- package/esm/select/subComponent/SelectedMultipleCount.js +32 -0
- package/esm/select/subComponent/SelectedMultipleTags.js +47 -0
- package/esm/select/subComponent/SelectedMultipleText.js +63 -0
- package/esm/select/subComponent/SelectedSingle.js +10 -0
- package/esm/styles/GlobalStyle.js +328 -0
- package/esm/styles/config/breakpoint.style.js +7 -0
- package/esm/styles/config/header.style.js +4 -0
- package/esm/styles/config/sidebar.style.js +11 -0
- package/esm/styles/index.js +2 -0
- package/esm/styles/mixin/backgroundColor.js +38 -0
- package/esm/styles/mixin/borderColor.js +31 -0
- package/esm/styles/mixin/color.js +31 -0
- package/esm/styles/mixin/colorOnBackground.js +31 -0
- package/esm/styles/mixin/inputPlaceholder.js +24 -0
- package/esm/styles/mixin/media.js +15 -0
- package/esm/styles/mixin/rounded.js +24 -0
- package/esm/styles/mixin/scrollbar.js +26 -0
- package/esm/styles/theme/dark.theme.js +91 -0
- package/esm/styles/theme/light.theme.js +91 -0
- package/esm/styles/theme/white.theme.js +91 -0
- package/esm/styles/themes.js +9 -0
- package/esm/table/GridTable.js +329 -0
- package/esm/table/ImageBox.js +38 -0
- package/esm/table/InfiniteGridTable.js +396 -0
- package/esm/table/PermissionTable.js +57 -0
- package/esm/table/SimpleGridTable.js +136 -0
- package/esm/table/Table.js +559 -0
- package/esm/table/__mock__/columns.js +64 -0
- package/esm/table/__mock__/data.js +530 -0
- package/esm/table/hooks/index.js +2 -0
- package/esm/table/hooks/useCalculateDataRange.js +22 -0
- package/esm/table/hooks/useGenerateSort.js +32 -0
- package/esm/table/index.js +6 -0
- package/esm/table/subComponent/BaseTableHeadCell.js +54 -0
- package/esm/table/subComponent/GridTableFooter.js +17 -0
- package/esm/table/subComponent/GridTableHeadCell.js +13 -0
- package/esm/table/subComponent/Resizer.js +70 -0
- package/esm/table/subComponent/TableFooter.js +24 -0
- package/esm/table/subComponent/TableFooterInfo.js +6 -0
- package/esm/table/subComponent/TableFooterPager.js +26 -0
- package/esm/table/subComponent/TableHeadCell.js +12 -0
- package/esm/table/subComponent/TableSort.js +31 -0
- package/esm/tagify/TagifyStyle.js +54 -0
- package/esm/tagify/Tags.js +49 -0
- package/esm/tagify/index.js +3 -0
- package/esm/tagify/templates/getCreateButtonTemplate.js +12 -0
- package/esm/text/Paragraph.js +79 -0
- package/esm/text/index.js +1 -0
- package/esm/timeline/Timeline.js +132 -0
- package/esm/timeline/index.js +1 -0
- package/esm/toast/CustomToastContainer.js +38 -0
- package/esm/toast/MessageContainer.js +44 -0
- package/esm/toast/index.js +3 -0
- package/esm/toast/show.js +29 -0
- package/esm/toast/style.css +1 -0
- package/esm/tooltip/Tooltip.js +133 -0
- package/esm/tooltip/index.js +1 -0
- package/esm/treeView/TreeViewV2.js +32 -0
- package/esm/treeView/TreeflexStyle.js +43 -0
- package/esm/treeView/index.js +2 -0
- package/esm/wizard/Wizard.js +244 -0
- package/esm/wizard/index.js +1 -0
- package/helmet/index.js +3 -7
- package/index.js +0 -12
- package/layout/Sidebar.jsx +1 -1
- package/package.json +5 -4
- package/datetimePicker/DatePicker.js +0 -363
- package/datetimePicker/DatePickerV2.js +0 -407
- package/datetimePicker/DatetimePickerV2.js +0 -395
- package/datetimePicker/TimePicker.js +0 -317
- package/datetimePicker/hooks/index.js +0 -27
- package/datetimePicker/hooks/useChangeNumber.js +0 -42
- package/datetimePicker/hooks/useDecrease.js +0 -38
- package/datetimePicker/hooks/useIncrease.js +0 -38
- package/datetimePicker/subComponent/Accordion.js +0 -373
- package/datetimePicker/subComponent/CustomTimeInput.js +0 -47
- package/jsoneditor/JsonEditor.js +0 -142
- package/jsoneditor/index.js +0 -13
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { useState, forwardRef, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { FaPen, FaTimes } from 'react-icons/fa/index.esm';
|
|
5
|
+
import { MdCrop } from 'react-icons/md/index.esm';
|
|
6
|
+
import { dataURLtoFile, getBase64DataUrlFromFile } from '@cashub/utils';
|
|
7
|
+
import { showErrorMessage } from '../toast';
|
|
8
|
+
import HiddenFileInput from '../file/HiddenFileInput';
|
|
9
|
+
import ImageFigure from '../figure/ImageFigure';
|
|
10
|
+
import ImageFluid from './ImageFluid';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const UploadImage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
13
|
+
let {
|
|
14
|
+
id,
|
|
15
|
+
src,
|
|
16
|
+
alt = 'user avatar',
|
|
17
|
+
roundedCircle = false,
|
|
18
|
+
cropperHandler,
|
|
19
|
+
onBlur,
|
|
20
|
+
onClear,
|
|
21
|
+
allowClear = false
|
|
22
|
+
} = _ref;
|
|
23
|
+
const {
|
|
24
|
+
t
|
|
25
|
+
} = useTranslation();
|
|
26
|
+
const refWrapper = useRef();
|
|
27
|
+
const [currentSrc, setCurrentSrc] = useState(src);
|
|
28
|
+
const [currentFile, setCurrentFile] = useState(null);
|
|
29
|
+
const [focusCount, setFocusCount] = useState(0);
|
|
30
|
+
const handleAvatarRemove = () => {
|
|
31
|
+
setCurrentSrc(src);
|
|
32
|
+
ref.current.value = '';
|
|
33
|
+
setCurrentFile(null);
|
|
34
|
+
};
|
|
35
|
+
const restoreFile = useCallback(() => {
|
|
36
|
+
if (!currentFile) return;
|
|
37
|
+
const dataTransfer = new DataTransfer();
|
|
38
|
+
dataTransfer.items.add(currentFile);
|
|
39
|
+
ref.current.files = dataTransfer.files;
|
|
40
|
+
}, [ref, currentFile]);
|
|
41
|
+
const handleImageFile = useCallback((file, src) => {
|
|
42
|
+
const dataTransfer = new DataTransfer();
|
|
43
|
+
const changedImageFile = dataURLtoFile(src, file.name);
|
|
44
|
+
dataTransfer.items.add(changedImageFile);
|
|
45
|
+
setCurrentSrc(src);
|
|
46
|
+
setCurrentFile(changedImageFile);
|
|
47
|
+
ref.current.files = dataTransfer.files;
|
|
48
|
+
}, [ref]);
|
|
49
|
+
const handleOnChange = files => {
|
|
50
|
+
if (files.length === 0) {
|
|
51
|
+
// close file selector or cancel upload file need to restore to last uploaded file
|
|
52
|
+
restoreFile();
|
|
53
|
+
} else {
|
|
54
|
+
const fileType = files[0].name.slice(files[0].name.lastIndexOf('.')).toLowerCase();
|
|
55
|
+
if (['.jpeg', '.bmp', '.jpg', '.png'].includes(fileType)) {
|
|
56
|
+
if (files[0].size < 2097152) {
|
|
57
|
+
const srcUrl = URL.createObjectURL(files[0]);
|
|
58
|
+
handleCrop(srcUrl, files[0]);
|
|
59
|
+
} else {
|
|
60
|
+
ref.current.value = '';
|
|
61
|
+
restoreFile();
|
|
62
|
+
showErrorMessage({
|
|
63
|
+
title: t('error:Upload'),
|
|
64
|
+
message: t('error:UploadSize', {
|
|
65
|
+
size: '2MB'
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
ref.current.value = '';
|
|
71
|
+
restoreFile();
|
|
72
|
+
showErrorMessage({
|
|
73
|
+
title: t('error:Upload'),
|
|
74
|
+
message: t('error:LogoMerchantFileType')
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const handleCrop = useCallback((src, file) => {
|
|
80
|
+
cropperHandler({
|
|
81
|
+
src,
|
|
82
|
+
file,
|
|
83
|
+
width: 160,
|
|
84
|
+
height: 160,
|
|
85
|
+
onCrop: croppedSrc => {
|
|
86
|
+
handleImageFile(file, croppedSrc);
|
|
87
|
+
},
|
|
88
|
+
onClose: () => {
|
|
89
|
+
getBase64DataUrlFromFile(file, dataUrl => {
|
|
90
|
+
handleImageFile(file, dataUrl);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}, [cropperHandler, handleImageFile]);
|
|
95
|
+
const handleFocus = event => {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
if (event.target.tagName === 'BUTTON') {
|
|
99
|
+
setFocusCount(focusCount + 1);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const handleBlur = event => {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
event.stopPropagation();
|
|
105
|
+
|
|
106
|
+
// if click figure,after click button
|
|
107
|
+
if (refWrapper.current.contains(event.relatedTarget)) return;
|
|
108
|
+
if (event.target === refWrapper.current && onBlur) {
|
|
109
|
+
onBlur();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
setCurrentSrc(src);
|
|
114
|
+
}, [src, ref]);
|
|
115
|
+
|
|
116
|
+
// if click button icon,can focus figure element
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (focusCount === 2) {
|
|
119
|
+
refWrapper.current.focus();
|
|
120
|
+
setFocusCount(0);
|
|
121
|
+
}
|
|
122
|
+
}, [ref, focusCount]);
|
|
123
|
+
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
124
|
+
ref: refWrapper,
|
|
125
|
+
roundedCircle: roundedCircle,
|
|
126
|
+
onBlur: handleBlur,
|
|
127
|
+
onFocus: handleFocus,
|
|
128
|
+
tabIndex: "0",
|
|
129
|
+
children: [currentSrc && /*#__PURE__*/_jsx(ImageFluid, {
|
|
130
|
+
crossOrigin: "anonymous",
|
|
131
|
+
src: currentSrc,
|
|
132
|
+
alt: alt,
|
|
133
|
+
rounded: true,
|
|
134
|
+
roundedCircle: roundedCircle
|
|
135
|
+
}), ref && /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
136
|
+
roundedCircle: roundedCircle,
|
|
137
|
+
children: [ref.current && ref.current.files && ref.current.files.length !== 0 && /*#__PURE__*/_jsx(CropButton, {
|
|
138
|
+
roundedCircle: roundedCircle,
|
|
139
|
+
onClick: () => {
|
|
140
|
+
handleCrop(currentSrc, ref.current.files[0]);
|
|
141
|
+
},
|
|
142
|
+
children: /*#__PURE__*/_jsx(MdCrop, {})
|
|
143
|
+
}), /*#__PURE__*/_jsx(ModifyButton, {
|
|
144
|
+
roundedCircle: roundedCircle,
|
|
145
|
+
onClick: () => {
|
|
146
|
+
ref.current.click();
|
|
147
|
+
},
|
|
148
|
+
children: /*#__PURE__*/_jsx(FaPen, {})
|
|
149
|
+
})]
|
|
150
|
+
}), /*#__PURE__*/_jsx(HiddenFileInput, {
|
|
151
|
+
ref: ref && ref,
|
|
152
|
+
id: id,
|
|
153
|
+
accept: ".jpeg, .bmp, .jpg, .png",
|
|
154
|
+
onChange: event => handleOnChange(event.target.files)
|
|
155
|
+
}), ref && ref.current && ref.current.files && ref.current.files.length !== 0 && /*#__PURE__*/_jsx(RemoveIcon, {
|
|
156
|
+
onClick: handleAvatarRemove,
|
|
157
|
+
roundedCircle: roundedCircle,
|
|
158
|
+
children: /*#__PURE__*/_jsx(FaTimes, {})
|
|
159
|
+
}), allowClear && src && ref && !ref.current?.files?.length > 0 && /*#__PURE__*/_jsx(RemoveIcon, {
|
|
160
|
+
onClick: onClear,
|
|
161
|
+
roundedCircle: roundedCircle,
|
|
162
|
+
children: /*#__PURE__*/_jsx(FaTimes, {})
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
const Wrapper = styled(ImageFigure)`
|
|
167
|
+
position: relative;
|
|
168
|
+
padding: var(--spacing-xs);
|
|
169
|
+
`;
|
|
170
|
+
const ButtonGroup = styled.div`
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: -16px;
|
|
173
|
+
right: -12px;
|
|
174
|
+
|
|
175
|
+
${_ref2 => {
|
|
176
|
+
let {
|
|
177
|
+
rounded
|
|
178
|
+
} = _ref2;
|
|
179
|
+
return rounded && `
|
|
180
|
+
top: 0;
|
|
181
|
+
right: 0;
|
|
182
|
+
`;
|
|
183
|
+
}}
|
|
184
|
+
`;
|
|
185
|
+
const ActionButton = styled.button`
|
|
186
|
+
display: inline-flex;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
align-items: center;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
width: 32px;
|
|
191
|
+
height: 32px;
|
|
192
|
+
border: none;
|
|
193
|
+
`;
|
|
194
|
+
const CropButton = styled(ActionButton)`
|
|
195
|
+
color: var(--font-on-primary);
|
|
196
|
+
background: var(--color-primary);
|
|
197
|
+
border-radius: var(--border-radius);
|
|
198
|
+
|
|
199
|
+
${_ref3 => {
|
|
200
|
+
let {
|
|
201
|
+
roundedCircle
|
|
202
|
+
} = _ref3;
|
|
203
|
+
return roundedCircle && `
|
|
204
|
+
position: relative;
|
|
205
|
+
top: -16px;
|
|
206
|
+
`;
|
|
207
|
+
}}
|
|
208
|
+
`;
|
|
209
|
+
const ModifyButton = styled(ActionButton)`
|
|
210
|
+
color: var(--font-on-primary);
|
|
211
|
+
background: var(--color-primary);
|
|
212
|
+
border-radius: var(--border-radius);
|
|
213
|
+
margin-left: var(--spacing-xs);
|
|
214
|
+
|
|
215
|
+
${_ref4 => {
|
|
216
|
+
let {
|
|
217
|
+
roundedCircle
|
|
218
|
+
} = _ref4;
|
|
219
|
+
return roundedCircle && `
|
|
220
|
+
position: relative;
|
|
221
|
+
top: 4px;
|
|
222
|
+
`;
|
|
223
|
+
}}
|
|
224
|
+
`;
|
|
225
|
+
const RemoveIcon = styled(ActionButton)`
|
|
226
|
+
position: absolute;
|
|
227
|
+
color: var(--font-on-danger);
|
|
228
|
+
background: var(--color-danger);
|
|
229
|
+
border-radius: var(--border-radius);
|
|
230
|
+
bottom: -12px;
|
|
231
|
+
right: -12px;
|
|
232
|
+
|
|
233
|
+
${_ref5 => {
|
|
234
|
+
let {
|
|
235
|
+
roundedCircle
|
|
236
|
+
} = _ref5;
|
|
237
|
+
return roundedCircle && `
|
|
238
|
+
bottom: 0;
|
|
239
|
+
right: 4px;
|
|
240
|
+
`;
|
|
241
|
+
}}
|
|
242
|
+
`;
|
|
243
|
+
export default UploadImage;
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export * from './alert';
|
|
2
|
+
export * from './animate';
|
|
3
|
+
export * from './backdrop';
|
|
4
|
+
export * from './badge';
|
|
5
|
+
export * from './breadcrumb';
|
|
6
|
+
export * from './button';
|
|
7
|
+
export * from './callout';
|
|
8
|
+
export * from './chart';
|
|
9
|
+
export * from './container';
|
|
10
|
+
export * from './cropper';
|
|
11
|
+
export * from './datetimePicker';
|
|
12
|
+
export * from './descriptionList';
|
|
13
|
+
export * from './divider';
|
|
14
|
+
export { default as Dropdown } from './dropdown';
|
|
15
|
+
export * from './dropdown';
|
|
16
|
+
export * from './dropzone';
|
|
17
|
+
export * from './figure';
|
|
18
|
+
export * from './file';
|
|
19
|
+
export * from './form';
|
|
20
|
+
export * from './grid';
|
|
21
|
+
export * from './helmet';
|
|
22
|
+
export * from './heading';
|
|
23
|
+
export * from './iconbox';
|
|
24
|
+
export * from './image';
|
|
25
|
+
export * from './layout';
|
|
26
|
+
export * from './link';
|
|
27
|
+
export * from './map';
|
|
28
|
+
export * from './modal';
|
|
29
|
+
export * from './page';
|
|
30
|
+
export * from './paginate';
|
|
31
|
+
export * from './popover';
|
|
32
|
+
export * from './qrcode';
|
|
33
|
+
export * from './ribbon';
|
|
34
|
+
export * from './section';
|
|
35
|
+
export * from './select';
|
|
36
|
+
export * from './styles';
|
|
37
|
+
export * from './table';
|
|
38
|
+
export { default as Tab } from './Tab';
|
|
39
|
+
export { TabV2 } from './Tab';
|
|
40
|
+
export * from './tagify';
|
|
41
|
+
export * from './text';
|
|
42
|
+
export * from './timeline';
|
|
43
|
+
export * from './toast';
|
|
44
|
+
export * from './tooltip';
|
|
45
|
+
export * from './treeView';
|
|
46
|
+
export { default as VerticalTab } from './VerticalTab';
|
|
47
|
+
export * from './wizard';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import headerStyle from '../styles/config/header.style';
|
|
3
|
+
import sidebarStyle from '../styles/config/sidebar.style';
|
|
4
|
+
import media from '../styles/mixin/media';
|
|
5
|
+
import bgAside from '../assets/images/bg-aside.png';
|
|
6
|
+
const Aside = styled.aside`
|
|
7
|
+
width: ${_ref => {
|
|
8
|
+
let {
|
|
9
|
+
$display
|
|
10
|
+
} = _ref;
|
|
11
|
+
return $display ? `${sidebarStyle.open.width}` : `${sidebarStyle.close.width}`;
|
|
12
|
+
}};
|
|
13
|
+
|
|
14
|
+
padding-top: var(--spacing-s);
|
|
15
|
+
height: calc(100vh - ${headerStyle.height} - var(--spacing));
|
|
16
|
+
background: url(${bgAside}), var(--color-background2);
|
|
17
|
+
background-size: 356px 436px;
|
|
18
|
+
background-repeat: no-repeat;
|
|
19
|
+
background-position: bottom;
|
|
20
|
+
border-top-right-radius: var(--border-radius);
|
|
21
|
+
position: fixed;
|
|
22
|
+
top: calc(${headerStyle.height} + var(--spacing));
|
|
23
|
+
transition: width 0.2s;
|
|
24
|
+
z-index: 60;
|
|
25
|
+
|
|
26
|
+
${media.tablet`
|
|
27
|
+
height: 100%;
|
|
28
|
+
top: 0;
|
|
29
|
+
padding-top:0;
|
|
30
|
+
border-top-right-radius:0;
|
|
31
|
+
left: 0;
|
|
32
|
+
box-shadow: var(--box-shadow);
|
|
33
|
+
|
|
34
|
+
${props => props.$display === false && css`
|
|
35
|
+
left: -${sidebarStyle.open.width};
|
|
36
|
+
`}
|
|
37
|
+
`};
|
|
38
|
+
`;
|
|
39
|
+
export default Aside;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import headerStyle from '../styles/config/header.style';
|
|
3
|
+
import media from '../styles/mixin/media';
|
|
4
|
+
import Logo from './Logo';
|
|
5
|
+
import MenuIcon from './MenuIcon';
|
|
6
|
+
|
|
7
|
+
const AsideHeader = ({ theme, logo, hasSidebar, toggleSidebar }) => {
|
|
8
|
+
return (
|
|
9
|
+
<Brand>
|
|
10
|
+
{hasSidebar && <MenuIcon theme={theme} toggleSidebar={toggleSidebar} />}
|
|
11
|
+
{logo && <Logo src={logo} />}
|
|
12
|
+
</Brand>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Brand = styled.div`
|
|
17
|
+
display: none;
|
|
18
|
+
height: ${headerStyle.height};
|
|
19
|
+
|
|
20
|
+
${media.tablet`
|
|
21
|
+
padding: 0 var(--spacing-xs);
|
|
22
|
+
align-items: center;
|
|
23
|
+
display: flex
|
|
24
|
+
`};
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export default AsideHeader;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { BaseBackdrop } from '../backdrop';
|
|
3
|
+
import media from '../styles/mixin/media';
|
|
4
|
+
const Backdrop = styled(BaseBackdrop)`
|
|
5
|
+
visibility: hidden;
|
|
6
|
+
|
|
7
|
+
${media.tablet`
|
|
8
|
+
visibility: ${_ref => {
|
|
9
|
+
let {
|
|
10
|
+
$display
|
|
11
|
+
} = _ref;
|
|
12
|
+
return $display === true ? 'visible' : 'hidden';
|
|
13
|
+
}};
|
|
14
|
+
`}
|
|
15
|
+
`;
|
|
16
|
+
export default Backdrop;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import headerStyle from '../styles/config/header.style';
|
|
3
|
+
import sidebarStyle from '../styles/config/sidebar.style';
|
|
4
|
+
import media from '../styles/mixin/media';
|
|
5
|
+
const Container = styled.div`
|
|
6
|
+
transition: 0.3s;
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding: calc(${headerStyle.height} + var(--spacing)) var(--spacing)
|
|
9
|
+
var(--spacing);
|
|
10
|
+
|
|
11
|
+
${_ref => {
|
|
12
|
+
let {
|
|
13
|
+
hasSidebar,
|
|
14
|
+
$display
|
|
15
|
+
} = _ref;
|
|
16
|
+
return hasSidebar === true && css`
|
|
17
|
+
width: calc(
|
|
18
|
+
100% -
|
|
19
|
+
${$display === true ? sidebarStyle.open.width : sidebarStyle.close.width}
|
|
20
|
+
);
|
|
21
|
+
margin-left: ${$display === true ? sidebarStyle.open.width : sidebarStyle.close.width};
|
|
22
|
+
|
|
23
|
+
${media.tablet`
|
|
24
|
+
width: 100%;
|
|
25
|
+
margin-left: 0;
|
|
26
|
+
`}
|
|
27
|
+
`;
|
|
28
|
+
}}
|
|
29
|
+
`;
|
|
30
|
+
export default Container;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import sidebarStyle from '../styles/config/sidebar.style';
|
|
3
|
+
import media from '../styles/mixin/media';
|
|
4
|
+
const Footer = styled.footer`
|
|
5
|
+
transition: 0.3s;
|
|
6
|
+
border-top: var(--border-width) solid var(--border-color);
|
|
7
|
+
color: var(--font-on-mute);
|
|
8
|
+
height: 64px;
|
|
9
|
+
line-height: 64px;
|
|
10
|
+
font-size: var(--font-body2);
|
|
11
|
+
padding: 0 var(--spacing);
|
|
12
|
+
|
|
13
|
+
${_ref => {
|
|
14
|
+
let {
|
|
15
|
+
hasSidebar
|
|
16
|
+
} = _ref;
|
|
17
|
+
return hasSidebar === true && css`
|
|
18
|
+
margin: 0 var(--spacing) 0 calc(var(--spacing) + ${sidebarStyle.close.width});
|
|
19
|
+
|
|
20
|
+
${media.tablet`
|
|
21
|
+
margin:0 ;
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
}}
|
|
25
|
+
|
|
26
|
+
${_ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
$display
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return $display && css`
|
|
31
|
+
margin: 0 var(--spacing) 0
|
|
32
|
+
calc(var(--spacing) + ${sidebarStyle.open.width});
|
|
33
|
+
`;
|
|
34
|
+
}}
|
|
35
|
+
`;
|
|
36
|
+
export default Footer;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import headerStyle from '../styles/config/header.style';
|
|
3
|
+
import media from '../styles/mixin/media';
|
|
4
|
+
import MenuIcon from './MenuIcon';
|
|
5
|
+
import Logo from './Logo';
|
|
6
|
+
|
|
7
|
+
const Header = ({ theme, logo, hasSidebar, toggleSidebar, children }) => {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<Wrapper>
|
|
11
|
+
<Brand>
|
|
12
|
+
{hasSidebar && (
|
|
13
|
+
<MenuIcon theme={theme} toggleSidebar={toggleSidebar} />
|
|
14
|
+
)}
|
|
15
|
+
{logo && <Logo src={logo} />}
|
|
16
|
+
</Brand>
|
|
17
|
+
<Topbar>{children}</Topbar>
|
|
18
|
+
</Wrapper>
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Wrapper = styled.header`
|
|
24
|
+
background: var(--color-background2);
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
align-items: center;
|
|
28
|
+
position: fixed;
|
|
29
|
+
z-index: 40;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: ${headerStyle.height};
|
|
32
|
+
padding: 0 calc(var(--spacing-s) + 0.25rem) 0 var(--spacing-s);
|
|
33
|
+
|
|
34
|
+
${media.tablet`
|
|
35
|
+
padding: 0 var(--spacing-s) 0 calc(var(--spacing-s) - 0.25rem);
|
|
36
|
+
`}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const Brand = styled.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
|
|
42
|
+
> * {
|
|
43
|
+
flex: none;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
const Topbar = styled.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
|
|
50
|
+
> *:not(:last-child) {
|
|
51
|
+
margin-right: calc(var(--spacing) - 0.5rem);
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
export default Header;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { ScrollToTopButton } from '../button';
|
|
4
|
+
import Header from './Header';
|
|
5
|
+
import Container from './Container';
|
|
6
|
+
import Footer from './Footer';
|
|
7
|
+
import Sidebar from './Sidebar';
|
|
8
|
+
import Backdrop from './Backdrop';
|
|
9
|
+
|
|
10
|
+
const Layout = ({
|
|
11
|
+
mode,
|
|
12
|
+
theme,
|
|
13
|
+
logo,
|
|
14
|
+
headerContent,
|
|
15
|
+
navContent,
|
|
16
|
+
footerContent,
|
|
17
|
+
children,
|
|
18
|
+
}) => {
|
|
19
|
+
const [display, setDisplay] = useState(!!navContent);
|
|
20
|
+
|
|
21
|
+
const toggleSidebar = () => {
|
|
22
|
+
setDisplay(!display);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// hide sidebar
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (mode === 'tablet') {
|
|
28
|
+
setDisplay(false);
|
|
29
|
+
}
|
|
30
|
+
}, [mode, setDisplay]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Wrapper>
|
|
34
|
+
<Header
|
|
35
|
+
theme={theme}
|
|
36
|
+
logo={logo}
|
|
37
|
+
hasSidebar={!!navContent}
|
|
38
|
+
toggleSidebar={toggleSidebar}
|
|
39
|
+
>
|
|
40
|
+
{headerContent}
|
|
41
|
+
</Header>
|
|
42
|
+
|
|
43
|
+
<Main>
|
|
44
|
+
<Backdrop $display={display} onClick={toggleSidebar} />
|
|
45
|
+
|
|
46
|
+
{navContent && (
|
|
47
|
+
<Sidebar
|
|
48
|
+
theme={theme}
|
|
49
|
+
logo={logo}
|
|
50
|
+
hasSidebar={!!navContent}
|
|
51
|
+
$display={display}
|
|
52
|
+
toggleSidebar={toggleSidebar}
|
|
53
|
+
>
|
|
54
|
+
{navContent}
|
|
55
|
+
</Sidebar>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
<Container hasSidebar={!!navContent} $display={display}>
|
|
59
|
+
{children}
|
|
60
|
+
</Container>
|
|
61
|
+
|
|
62
|
+
<ScrollToTopButton />
|
|
63
|
+
</Main>
|
|
64
|
+
|
|
65
|
+
<Footer hasSidebar={!!navContent} $display={display}>
|
|
66
|
+
{footerContent}
|
|
67
|
+
</Footer>
|
|
68
|
+
</Wrapper>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const Wrapper = styled.div`
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
min-height: 100vh;
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
const Main = styled.div`
|
|
79
|
+
display: flex;
|
|
80
|
+
flex: 1;
|
|
81
|
+
position: relative;
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
export default Layout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { ImageFluid } from '../image';
|
|
3
|
+
|
|
4
|
+
const Logo = ({ src }) => {
|
|
5
|
+
return (
|
|
6
|
+
<Figure>
|
|
7
|
+
<ImageFluid src={src} alt='CasHUB logo' />
|
|
8
|
+
</Figure>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Figure = styled.figure`
|
|
13
|
+
max-width: 220px;
|
|
14
|
+
height: 40px;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export default Logo;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { ImageFluid } from '../image';
|
|
3
|
+
import { IconFigure } from '../figure';
|
|
4
|
+
import { IconButton } from '../button';
|
|
5
|
+
import burgerWhite from '../assets/icons/burger-white.png';
|
|
6
|
+
import burgerBlack from '../assets/icons/burger-black.png';
|
|
7
|
+
|
|
8
|
+
const MenuIcon = ({ theme, toggleSidebar }) => {
|
|
9
|
+
return (
|
|
10
|
+
<Wrapper onClick={toggleSidebar}>
|
|
11
|
+
<IconFigure>
|
|
12
|
+
<ImageFluid
|
|
13
|
+
crossOrigin='anonymous'
|
|
14
|
+
src={theme === 'Dark' ? burgerWhite : burgerBlack}
|
|
15
|
+
alt='Sidebar toggler'
|
|
16
|
+
/>
|
|
17
|
+
</IconFigure>
|
|
18
|
+
</Wrapper>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Wrapper = styled(IconButton)`
|
|
23
|
+
margin: 0;
|
|
24
|
+
margin-right: calc(var(--spacing) - 0.5rem);
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export default MenuIcon;
|