@cashub/ui-elv 1.0.2 → 1.0.3
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 +2 -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/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,199 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import OutsideClickHandler from 'react-outside-click-handler';
|
|
4
|
+
import { useCustomPopper } from '@cashub/hooks';
|
|
5
|
+
import { generateRange } from '@cashub/utils';
|
|
6
|
+
import pad from './utils/pad';
|
|
7
|
+
import { Input } from '../form';
|
|
8
|
+
import scrollbar from '../styles/mixin/scrollbar';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
+
const LENGTH = 2;
|
|
11
|
+
const PAD_STRING = '0';
|
|
12
|
+
const HOUR_OPTIONS = generateRange(0, 23).map(value => {
|
|
13
|
+
return pad(value, LENGTH, PAD_STRING);
|
|
14
|
+
});
|
|
15
|
+
const MINUTE_SECOND_OPTIONS = generateRange(0, 59).map(value => {
|
|
16
|
+
return pad(value, LENGTH, PAD_STRING);
|
|
17
|
+
});
|
|
18
|
+
const EMPTY_TIME = {
|
|
19
|
+
hour: '',
|
|
20
|
+
minute: '',
|
|
21
|
+
second: ''
|
|
22
|
+
};
|
|
23
|
+
const getTimeFromSelected = (selected, allowEmpty) => {
|
|
24
|
+
let time = new Date(Date.parse(selected));
|
|
25
|
+
if (isNaN(time)) {
|
|
26
|
+
if (allowEmpty) {
|
|
27
|
+
return EMPTY_TIME;
|
|
28
|
+
}
|
|
29
|
+
time = new Date();
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
hour: pad(time.getHours(), LENGTH, PAD_STRING),
|
|
33
|
+
minute: pad(time.getMinutes(), LENGTH, PAD_STRING),
|
|
34
|
+
second: pad(time.getSeconds(), LENGTH, PAD_STRING)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const TimePickerV2 = _ref => {
|
|
38
|
+
let {
|
|
39
|
+
selected,
|
|
40
|
+
onSelect,
|
|
41
|
+
allowEmpty = false
|
|
42
|
+
} = _ref;
|
|
43
|
+
const [display, setDisplay] = useState(false);
|
|
44
|
+
const [targetElement, setTargetElement] = useState(null);
|
|
45
|
+
const [popperElement, setPopperElement] = useState(null);
|
|
46
|
+
const [time, setTime] = useState(() => {
|
|
47
|
+
return getTimeFromSelected(selected, allowEmpty);
|
|
48
|
+
});
|
|
49
|
+
const {
|
|
50
|
+
styles,
|
|
51
|
+
attributes,
|
|
52
|
+
state,
|
|
53
|
+
update
|
|
54
|
+
} = useCustomPopper(targetElement, popperElement, {
|
|
55
|
+
placement: 'bottom-start'
|
|
56
|
+
});
|
|
57
|
+
const handleToggle = () => {
|
|
58
|
+
setDisplay(!display);
|
|
59
|
+
update();
|
|
60
|
+
};
|
|
61
|
+
const handleChange = (type, value) => {
|
|
62
|
+
const next = {
|
|
63
|
+
...time,
|
|
64
|
+
[type]: value
|
|
65
|
+
};
|
|
66
|
+
setTime(next);
|
|
67
|
+
if (typeof onSelect === 'function' && next.hour && next.minute && next.second) {
|
|
68
|
+
onSelect(`${next.hour}:${next.minute}:${next.second}`);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// sync time picker state when selected value changes
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
setTime(getTimeFromSelected(selected, allowEmpty));
|
|
75
|
+
}, [allowEmpty, selected]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (display) {
|
|
78
|
+
const {
|
|
79
|
+
childNodes
|
|
80
|
+
} = popperElement;
|
|
81
|
+
childNodes.forEach(panel => {
|
|
82
|
+
const selectedItem = panel.querySelector('[aria-selected="true"]');
|
|
83
|
+
if (panel.scrollHeight > panel.clientHeight) {
|
|
84
|
+
panel.scrollTop = selectedItem ? selectedItem.offsetTop : 0;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, [display, popperElement]);
|
|
89
|
+
return /*#__PURE__*/_jsx(OutsideClickHandler, {
|
|
90
|
+
onOutsideClick: () => {
|
|
91
|
+
setDisplay(false);
|
|
92
|
+
},
|
|
93
|
+
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
94
|
+
children: [/*#__PURE__*/_jsx(Input, {
|
|
95
|
+
ref: setTargetElement,
|
|
96
|
+
type: "text",
|
|
97
|
+
readOnly: true,
|
|
98
|
+
onClick: handleToggle,
|
|
99
|
+
value: time.hour && time.minute && time.second ? `${time.hour}:${time.minute}:${time.second}` : ''
|
|
100
|
+
}), /*#__PURE__*/_jsxs(Panel, {
|
|
101
|
+
ref: setPopperElement,
|
|
102
|
+
$display: display,
|
|
103
|
+
style: styles.popper,
|
|
104
|
+
...attributes.popper,
|
|
105
|
+
placement: state && state.placement,
|
|
106
|
+
children: [/*#__PURE__*/_jsx(Picker, {
|
|
107
|
+
children: HOUR_OPTIONS.map(option => {
|
|
108
|
+
return /*#__PURE__*/_jsx(Option, {
|
|
109
|
+
role: "option",
|
|
110
|
+
onClick: () => {
|
|
111
|
+
handleChange('hour', option);
|
|
112
|
+
},
|
|
113
|
+
selected: option === time.hour,
|
|
114
|
+
"aria-selected": option === time.hour,
|
|
115
|
+
children: option
|
|
116
|
+
}, option);
|
|
117
|
+
})
|
|
118
|
+
}), /*#__PURE__*/_jsx(Picker, {
|
|
119
|
+
children: MINUTE_SECOND_OPTIONS.map(option => {
|
|
120
|
+
return /*#__PURE__*/_jsx(Option, {
|
|
121
|
+
role: "option",
|
|
122
|
+
onClick: () => {
|
|
123
|
+
handleChange('minute', option);
|
|
124
|
+
},
|
|
125
|
+
selected: option === time.minute,
|
|
126
|
+
"aria-selected": option === time.minute,
|
|
127
|
+
children: option
|
|
128
|
+
}, option);
|
|
129
|
+
})
|
|
130
|
+
}), /*#__PURE__*/_jsx(Picker, {
|
|
131
|
+
children: MINUTE_SECOND_OPTIONS.map(option => {
|
|
132
|
+
return /*#__PURE__*/_jsx(Option, {
|
|
133
|
+
role: "option",
|
|
134
|
+
onClick: () => {
|
|
135
|
+
handleChange('second', option);
|
|
136
|
+
},
|
|
137
|
+
selected: option === time.second,
|
|
138
|
+
"aria-selected": option === time.second,
|
|
139
|
+
children: option
|
|
140
|
+
}, option);
|
|
141
|
+
})
|
|
142
|
+
})]
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const Panel = styled.div`
|
|
148
|
+
display: flex;
|
|
149
|
+
visibility: ${_ref2 => {
|
|
150
|
+
let {
|
|
151
|
+
$display
|
|
152
|
+
} = _ref2;
|
|
153
|
+
return $display ? 'visible' : 'hidden';
|
|
154
|
+
}};
|
|
155
|
+
width: 100%;
|
|
156
|
+
max-width: 360px;
|
|
157
|
+
background: var(--color-background1);
|
|
158
|
+
color: var(--font-on-background);
|
|
159
|
+
border: var(--border-width) solid var(--border-color);
|
|
160
|
+
border-radius: var(--border-radius);
|
|
161
|
+
box-shadow: var(--box-shadow);
|
|
162
|
+
z-index: 85;
|
|
163
|
+
`;
|
|
164
|
+
const Picker = styled.ul`
|
|
165
|
+
flex: 1;
|
|
166
|
+
text-align: center;
|
|
167
|
+
max-height: 144px;
|
|
168
|
+
overflow-y: auto;
|
|
169
|
+
|
|
170
|
+
${scrollbar}
|
|
171
|
+
|
|
172
|
+
&:first-child {
|
|
173
|
+
border-top-left-radius: var(--border-radius);
|
|
174
|
+
border-bottom-left-radius: var(--border-radius);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:not(:last-child) {
|
|
178
|
+
border-right: var(--border-width) solid var(--border-color);
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
const Option = styled.li`
|
|
182
|
+
padding: var(--spacing-xs) 0;
|
|
183
|
+
background: var(--color-background1);
|
|
184
|
+
transition: background 0.3s;
|
|
185
|
+
|
|
186
|
+
&:hover {
|
|
187
|
+
background: var(--color-hover);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
${_ref3 => {
|
|
191
|
+
let {
|
|
192
|
+
selected
|
|
193
|
+
} = _ref3;
|
|
194
|
+
return selected && css`
|
|
195
|
+
background: var(--color-hover);
|
|
196
|
+
`;
|
|
197
|
+
}}
|
|
198
|
+
`;
|
|
199
|
+
export default TimePickerV2;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { useCallback, useContext, useMemo } from 'react';
|
|
2
|
+
import { IoMdArrowDropup } from 'react-icons/io/index.esm';
|
|
3
|
+
import { MdArrowBackIosNew, MdArrowForwardIos } from 'react-icons/md/index.esm';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { datetimeTFormat } from '@cashub/utils';
|
|
6
|
+
import DateTimePicker from '../subComponent/DateTimePickerContext';
|
|
7
|
+
import { MONTH } from '../provider/constant';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
const Month = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
expand,
|
|
12
|
+
handleDisplayAccordionContent
|
|
13
|
+
} = _ref;
|
|
14
|
+
const {
|
|
15
|
+
selectedDate,
|
|
16
|
+
setSelectedDate,
|
|
17
|
+
minDate,
|
|
18
|
+
maxDate,
|
|
19
|
+
fixedYear,
|
|
20
|
+
setAccordionCurrentDisplayType
|
|
21
|
+
} = useContext(DateTimePicker);
|
|
22
|
+
const handleChangeMonth = useCallback(month => {
|
|
23
|
+
// switch to the first day of the target month
|
|
24
|
+
const date = new Date(selectedDate);
|
|
25
|
+
date.setDate(1);
|
|
26
|
+
date.setMonth(month);
|
|
27
|
+
setSelectedDate(datetimeTFormat(date));
|
|
28
|
+
setAccordionCurrentDisplayType(null);
|
|
29
|
+
}, [setAccordionCurrentDisplayType, setSelectedDate, selectedDate]);
|
|
30
|
+
const changeToPreviousMonth = () => {
|
|
31
|
+
const date = new Date(selectedDate);
|
|
32
|
+
handleChangeMonth(date.getMonth() <= 0 ? 11 : date.getMonth() - 1);
|
|
33
|
+
};
|
|
34
|
+
const changeToNextMonth = () => {
|
|
35
|
+
const date = new Date(selectedDate);
|
|
36
|
+
handleChangeMonth(date.getMonth() >= 11 ? 0 : date.getMonth() + 1);
|
|
37
|
+
};
|
|
38
|
+
const handleMonthItemDisable = useCallback(month => {
|
|
39
|
+
let minDayDate;
|
|
40
|
+
let maxDayDate;
|
|
41
|
+
if (minDate) {
|
|
42
|
+
minDayDate = new Date(datetimeTFormat(minDate));
|
|
43
|
+
minDayDate.setMonth(month);
|
|
44
|
+
minDayDate.setFullYear(new Date(selectedDate).getFullYear());
|
|
45
|
+
}
|
|
46
|
+
if (maxDate) {
|
|
47
|
+
maxDayDate = maxDate && new Date(datetimeTFormat(maxDate));
|
|
48
|
+
maxDayDate.setFullYear(new Date(selectedDate).getFullYear());
|
|
49
|
+
maxDayDate.setMonth(month);
|
|
50
|
+
}
|
|
51
|
+
if (minDate !== undefined && maxDate !== undefined) {
|
|
52
|
+
return !(new Date(datetimeTFormat(minDate)) <= minDayDate && maxDayDate <= new Date(datetimeTFormat(maxDate)));
|
|
53
|
+
} else if (minDate) {
|
|
54
|
+
return !(datetimeTFormat(minDate) <= datetimeTFormat(minDayDate));
|
|
55
|
+
} else if (maxDate) {
|
|
56
|
+
return !(datetimeTFormat(maxDayDate) <= datetimeTFormat(maxDate));
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}, [maxDate, minDate, selectedDate]);
|
|
60
|
+
const handleDisableArrow = useCallback(arrowType => {
|
|
61
|
+
const date = new Date(selectedDate);
|
|
62
|
+
const selectedMonth = date.getMonth();
|
|
63
|
+
date.setDate(1);
|
|
64
|
+
if (arrowType === 'previous') {
|
|
65
|
+
date.setMonth(selectedMonth - 1 < 0 ? 11 : selectedMonth - 1);
|
|
66
|
+
} else {
|
|
67
|
+
date.setMonth(selectedMonth + 1 > 11 ? 0 : selectedMonth + 1);
|
|
68
|
+
}
|
|
69
|
+
if (fixedYear && !minDate && !maxDate || !minDate && !maxDate) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const minDate1st = minDate && new Date(datetimeTFormat(minDate));
|
|
73
|
+
const maxDate1st = maxDate && new Date(datetimeTFormat(maxDate));
|
|
74
|
+
if (minDate && !maxDate) {
|
|
75
|
+
minDate1st.setDate(1);
|
|
76
|
+
minDate1st.setHours(0, 0, 0, 0);
|
|
77
|
+
return !(minDate1st <= date);
|
|
78
|
+
} else if (maxDate && !minDate) {
|
|
79
|
+
maxDate1st.setDate(1);
|
|
80
|
+
maxDate1st.setHours(23, 59, 59, 0);
|
|
81
|
+
return !(maxDate1st >= date);
|
|
82
|
+
} else if (minDate && maxDate) {
|
|
83
|
+
minDate1st.setDate(1);
|
|
84
|
+
minDate1st.setHours(0, 0, 0, 0);
|
|
85
|
+
maxDate1st.setDate(1);
|
|
86
|
+
maxDate1st.setHours(23, 59, 59, 0);
|
|
87
|
+
return !(minDate1st <= date && maxDate1st >= date);
|
|
88
|
+
}
|
|
89
|
+
}, [fixedYear, maxDate, minDate, selectedDate]);
|
|
90
|
+
const monthContent = useMemo(() => {
|
|
91
|
+
const selectedMonth = new Date(selectedDate).getMonth();
|
|
92
|
+
return MONTH.map((month, index) => /*#__PURE__*/_jsx(Item, {
|
|
93
|
+
selected: selectedMonth === index,
|
|
94
|
+
onClick: () => {
|
|
95
|
+
handleChangeMonth(index);
|
|
96
|
+
},
|
|
97
|
+
disabled: handleMonthItemDisable(index),
|
|
98
|
+
children: month.text
|
|
99
|
+
}, month.number));
|
|
100
|
+
}, [selectedDate, handleChangeMonth, handleMonthItemDisable]);
|
|
101
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
102
|
+
children: [/*#__PURE__*/_jsxs(Header, {
|
|
103
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
104
|
+
onClick: changeToPreviousMonth,
|
|
105
|
+
disabled: handleDisableArrow('previous'),
|
|
106
|
+
children: /*#__PURE__*/_jsx(MdArrowBackIosNew, {})
|
|
107
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
108
|
+
children: MONTH[new Date(selectedDate).getMonth()].text
|
|
109
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
110
|
+
onClick: changeToNextMonth,
|
|
111
|
+
disabled: handleDisableArrow('next'),
|
|
112
|
+
children: /*#__PURE__*/_jsx(MdArrowForwardIos, {})
|
|
113
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
114
|
+
$rotate: expand,
|
|
115
|
+
right: true,
|
|
116
|
+
onClick: handleDisplayAccordionContent,
|
|
117
|
+
children: /*#__PURE__*/_jsx(IoMdArrowDropup, {})
|
|
118
|
+
})]
|
|
119
|
+
}), /*#__PURE__*/_jsx(Body, {
|
|
120
|
+
expand: expand,
|
|
121
|
+
fixedYear: fixedYear,
|
|
122
|
+
children: monthContent
|
|
123
|
+
})]
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const Header = styled.div`
|
|
127
|
+
display: flex;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
align-content: center;
|
|
130
|
+
position: relative;
|
|
131
|
+
|
|
132
|
+
> div {
|
|
133
|
+
width: 72px;
|
|
134
|
+
line-height: 36px;
|
|
135
|
+
text-align: center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&::before {
|
|
139
|
+
content: '';
|
|
140
|
+
border-bottom: var(--border-width) solid var(--border-color);
|
|
141
|
+
position: absolute;
|
|
142
|
+
width: 300px;
|
|
143
|
+
bottom: 0;
|
|
144
|
+
z-index: 1;
|
|
145
|
+
right: -16px;
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
const IconButton = styled.button`
|
|
149
|
+
width: 36px;
|
|
150
|
+
height: 36px;
|
|
151
|
+
background: var(--color-background1);
|
|
152
|
+
border: none;
|
|
153
|
+
color: var(--font-on-background);
|
|
154
|
+
padding: 0;
|
|
155
|
+
transition: 0.3s;
|
|
156
|
+
|
|
157
|
+
&:hover {
|
|
158
|
+
color: var(--color-primary);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
${_ref2 => {
|
|
162
|
+
let {
|
|
163
|
+
disabled
|
|
164
|
+
} = _ref2;
|
|
165
|
+
return disabled && css`
|
|
166
|
+
opacity: 0.5;
|
|
167
|
+
|
|
168
|
+
&:hover {
|
|
169
|
+
color: var(--font-on-background);
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
}}
|
|
173
|
+
|
|
174
|
+
${_ref3 => {
|
|
175
|
+
let {
|
|
176
|
+
right,
|
|
177
|
+
$rotate
|
|
178
|
+
} = _ref3;
|
|
179
|
+
return right && `
|
|
180
|
+
position: absolute;
|
|
181
|
+
right: 0;
|
|
182
|
+
${$rotate && css`
|
|
183
|
+
transform: rotate(180deg);
|
|
184
|
+
`}
|
|
185
|
+
`;
|
|
186
|
+
}}
|
|
187
|
+
`;
|
|
188
|
+
const Body = styled.div`
|
|
189
|
+
flex-wrap: wrap;
|
|
190
|
+
height: 0;
|
|
191
|
+
width: 100%;
|
|
192
|
+
display: ${_ref4 => {
|
|
193
|
+
let {
|
|
194
|
+
expand
|
|
195
|
+
} = _ref4;
|
|
196
|
+
return expand ? 'flex' : 'none';
|
|
197
|
+
}};
|
|
198
|
+
|
|
199
|
+
${_ref5 => {
|
|
200
|
+
let {
|
|
201
|
+
fixedYear
|
|
202
|
+
} = _ref5;
|
|
203
|
+
return css`
|
|
204
|
+
min-height: ${fixedYear ? '192' : '144'}px;
|
|
205
|
+
`;
|
|
206
|
+
}}
|
|
207
|
+
transition: .3s;
|
|
208
|
+
|
|
209
|
+
transition: 0.3s;
|
|
210
|
+
`;
|
|
211
|
+
const Item = styled.button`
|
|
212
|
+
width: calc(100% / 3);
|
|
213
|
+
height: 36px;
|
|
214
|
+
line-height: 36px;
|
|
215
|
+
text-align: center;
|
|
216
|
+
border-radius: var(--border-radius-s);
|
|
217
|
+
padding: 0;
|
|
218
|
+
border: none;
|
|
219
|
+
color: var(--font-on-background);
|
|
220
|
+
background: var(--color-background1);
|
|
221
|
+
|
|
222
|
+
&:hover {
|
|
223
|
+
${_ref6 => {
|
|
224
|
+
let {
|
|
225
|
+
disabled
|
|
226
|
+
} = _ref6;
|
|
227
|
+
return !disabled && 'background: var(--color-primary)';
|
|
228
|
+
}}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
${_ref7 => {
|
|
232
|
+
let {
|
|
233
|
+
disabled
|
|
234
|
+
} = _ref7;
|
|
235
|
+
return disabled && 'color: var(--font-on-mute)';
|
|
236
|
+
}}
|
|
237
|
+
|
|
238
|
+
${_ref8 => {
|
|
239
|
+
let {
|
|
240
|
+
selected
|
|
241
|
+
} = _ref8;
|
|
242
|
+
return selected && 'background: var(--color-hover)';
|
|
243
|
+
}}
|
|
244
|
+
`;
|
|
245
|
+
export default Month;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { IoMdArrowDropup } from 'react-icons/io/index.esm';
|
|
3
|
+
import { MdArrowBackIosNew, MdArrowForwardIos } from 'react-icons/md/index.esm';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { generateRange, datetimeTFormat } from '@cashub/utils';
|
|
6
|
+
import DateTimePicker from '../subComponent/DateTimePickerContext';
|
|
7
|
+
import scrollbar from '../../styles/mixin/scrollbar';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
+
const Year = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
expand,
|
|
12
|
+
handleDisplayAccordionContent
|
|
13
|
+
} = _ref;
|
|
14
|
+
const {
|
|
15
|
+
fixedYear,
|
|
16
|
+
minDate,
|
|
17
|
+
maxDate,
|
|
18
|
+
selectedDate,
|
|
19
|
+
setSelectedDate,
|
|
20
|
+
setAccordionCurrentDisplayType
|
|
21
|
+
} = useContext(DateTimePicker);
|
|
22
|
+
const bodyRef = useRef(null);
|
|
23
|
+
const selectedYearRef = useRef(null);
|
|
24
|
+
const [yearArr, setYearArr] = useState([]);
|
|
25
|
+
const minYear = minDate ? new Date(datetimeTFormat(minDate)).getFullYear() : 1;
|
|
26
|
+
const maxYear = maxDate ? new Date(datetimeTFormat(maxDate)).getFullYear() : null;
|
|
27
|
+
const handleChangeYear = useCallback(year => {
|
|
28
|
+
const date = new Date(selectedDate);
|
|
29
|
+
date.setFullYear(year);
|
|
30
|
+
setSelectedDate(datetimeTFormat(date));
|
|
31
|
+
setAccordionCurrentDisplayType(null);
|
|
32
|
+
}, [selectedDate, setAccordionCurrentDisplayType, setSelectedDate]);
|
|
33
|
+
const changeToPreviousYear = useCallback(() => {
|
|
34
|
+
const date = new Date(selectedDate);
|
|
35
|
+
if (date.getFullYear() > 1) {
|
|
36
|
+
handleChangeYear(date.getFullYear() - 1);
|
|
37
|
+
}
|
|
38
|
+
}, [selectedDate, handleChangeYear]);
|
|
39
|
+
const changeToNextYear = useCallback(() => {
|
|
40
|
+
const date = new Date(selectedDate);
|
|
41
|
+
handleChangeYear(date.getFullYear() + 1);
|
|
42
|
+
}, [selectedDate, handleChangeYear]);
|
|
43
|
+
const handleYearItemDisable = useCallback(year => {
|
|
44
|
+
if (minDate !== undefined && maxDate !== undefined) {
|
|
45
|
+
return !(minYear <= year && year <= maxYear);
|
|
46
|
+
}
|
|
47
|
+
if (minDate) {
|
|
48
|
+
return minYear > year;
|
|
49
|
+
} else if (maxDate) {
|
|
50
|
+
return maxYear < year;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}, [minYear, maxYear, maxDate, minDate]);
|
|
54
|
+
const handleDisableArrow = useCallback(arrowType => {
|
|
55
|
+
const data = new Date(selectedDate);
|
|
56
|
+
if (arrowType === 'previous') {
|
|
57
|
+
return minYear > data.getFullYear() - 1;
|
|
58
|
+
} else if (arrowType === 'next') {
|
|
59
|
+
if (maxYear) {
|
|
60
|
+
return maxYear < data.getFullYear() + 1;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}, [selectedDate, minYear, maxYear]);
|
|
65
|
+
const yearContent = useMemo(() => {
|
|
66
|
+
const data = new Date(selectedDate);
|
|
67
|
+
return yearArr.map((year, index) => /*#__PURE__*/_jsx(Item, {
|
|
68
|
+
ref: data.getFullYear() === year ? selectedYearRef : null,
|
|
69
|
+
selected: data.getFullYear() === year,
|
|
70
|
+
onClick: () => {
|
|
71
|
+
handleChangeYear(year);
|
|
72
|
+
},
|
|
73
|
+
disabled: handleYearItemDisable(year),
|
|
74
|
+
children: year
|
|
75
|
+
}, index));
|
|
76
|
+
}, [selectedDate, yearArr, handleChangeYear, handleYearItemDisable]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const data = new Date(selectedDate);
|
|
79
|
+
if (!fixedYear) {
|
|
80
|
+
const start = data.getFullYear() - 16 > 0 ? data.getFullYear() - 16 : 1;
|
|
81
|
+
const end = data.getFullYear() + 16;
|
|
82
|
+
const yearRange = generateRange(start, end);
|
|
83
|
+
setYearArr(yearRange);
|
|
84
|
+
}
|
|
85
|
+
}, [fixedYear, selectedDate]);
|
|
86
|
+
const scroll = useCallback(() => {
|
|
87
|
+
if (bodyRef?.current && selectedYearRef?.current) {
|
|
88
|
+
const body = bodyRef.current;
|
|
89
|
+
if (body.scrollTop + body.clientHeight >= body.scrollHeight - 90) {
|
|
90
|
+
body.removeEventListener('scroll', scroll);
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
setYearArr(previousParams => {
|
|
93
|
+
body.addEventListener('scroll', scroll);
|
|
94
|
+
const addYearRange = generateRange(previousParams[previousParams.length - 1] + 1, previousParams[previousParams.length - 1] + 15);
|
|
95
|
+
return [...previousParams, ...addYearRange];
|
|
96
|
+
});
|
|
97
|
+
}, 400);
|
|
98
|
+
} else if (body.scrollTop < 50) {
|
|
99
|
+
body.removeEventListener('scroll', scroll);
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
setYearArr(previousParams => {
|
|
102
|
+
body.addEventListener('scroll', scroll);
|
|
103
|
+
if (previousParams[0] - 15 <= 0) {
|
|
104
|
+
const addYearRange = generateRange(previousParams[0] - (previousParams[0] - 1), previousParams[0] - 1);
|
|
105
|
+
return [...addYearRange, ...previousParams];
|
|
106
|
+
}
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
body.scrollTo({
|
|
109
|
+
top: body.scrollTop + 96
|
|
110
|
+
});
|
|
111
|
+
}, 400);
|
|
112
|
+
const addYearRange = generateRange(previousParams[0] - 15, previousParams[0] - 1);
|
|
113
|
+
return [...addYearRange, ...previousParams];
|
|
114
|
+
});
|
|
115
|
+
}, 400);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, []);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
bodyRef.current.addEventListener('scroll', scroll);
|
|
121
|
+
}, [scroll]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (expand && bodyRef?.current && selectedYearRef?.current) {
|
|
124
|
+
bodyRef.current.scrollTo({
|
|
125
|
+
top: selectedYearRef.current.offsetTop - bodyRef.current.offsetTop
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}, [expand]);
|
|
129
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
130
|
+
children: [/*#__PURE__*/_jsxs(Header, {
|
|
131
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
132
|
+
onClick: changeToPreviousYear,
|
|
133
|
+
disabled: handleDisableArrow('previous'),
|
|
134
|
+
children: /*#__PURE__*/_jsx(MdArrowBackIosNew, {})
|
|
135
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
136
|
+
children: new Date(selectedDate).getFullYear()
|
|
137
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
138
|
+
onClick: changeToNextYear,
|
|
139
|
+
disabled: handleDisableArrow('next'),
|
|
140
|
+
children: /*#__PURE__*/_jsx(MdArrowForwardIos, {})
|
|
141
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
142
|
+
$rotate: expand,
|
|
143
|
+
right: true,
|
|
144
|
+
onClick: handleDisplayAccordionContent,
|
|
145
|
+
children: /*#__PURE__*/_jsx(IoMdArrowDropup, {})
|
|
146
|
+
})]
|
|
147
|
+
}), /*#__PURE__*/_jsx(Body, {
|
|
148
|
+
expand: expand,
|
|
149
|
+
fixedYear: fixedYear,
|
|
150
|
+
ref: bodyRef,
|
|
151
|
+
children: yearContent
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
const Header = styled.div`
|
|
156
|
+
display: flex;
|
|
157
|
+
justify-content: center;
|
|
158
|
+
align-content: center;
|
|
159
|
+
position: relative;
|
|
160
|
+
|
|
161
|
+
> div {
|
|
162
|
+
width: 72px;
|
|
163
|
+
line-height: 36px;
|
|
164
|
+
text-align: center;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&::before {
|
|
168
|
+
content: '';
|
|
169
|
+
border-bottom: var(--border-width) solid var(--border-color);
|
|
170
|
+
position: absolute;
|
|
171
|
+
width: 300px;
|
|
172
|
+
bottom: 0;
|
|
173
|
+
z-index: 1;
|
|
174
|
+
right: -16px;
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
const IconButton = styled.button`
|
|
178
|
+
width: 36px;
|
|
179
|
+
height: 36px;
|
|
180
|
+
background: var(--color-background1);
|
|
181
|
+
border: none;
|
|
182
|
+
color: var(--font-on-background);
|
|
183
|
+
padding: 0;
|
|
184
|
+
transition: 0.3s;
|
|
185
|
+
|
|
186
|
+
&:hover {
|
|
187
|
+
color: var(--color-primary);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
${_ref2 => {
|
|
191
|
+
let {
|
|
192
|
+
disabled
|
|
193
|
+
} = _ref2;
|
|
194
|
+
return disabled && css`
|
|
195
|
+
opacity: 0.5;
|
|
196
|
+
|
|
197
|
+
&:hover {
|
|
198
|
+
color: var(--font-on-background);
|
|
199
|
+
}
|
|
200
|
+
`;
|
|
201
|
+
}}
|
|
202
|
+
|
|
203
|
+
${_ref3 => {
|
|
204
|
+
let {
|
|
205
|
+
right,
|
|
206
|
+
$rotate
|
|
207
|
+
} = _ref3;
|
|
208
|
+
return right && `
|
|
209
|
+
position: absolute;
|
|
210
|
+
right: 0;
|
|
211
|
+
${$rotate && css`
|
|
212
|
+
transform: rotate(180deg);
|
|
213
|
+
`}
|
|
214
|
+
`;
|
|
215
|
+
}}
|
|
216
|
+
`;
|
|
217
|
+
const Body = styled.div`
|
|
218
|
+
flex-wrap: wrap;
|
|
219
|
+
height: 0;
|
|
220
|
+
width: 100%;
|
|
221
|
+
display: ${_ref4 => {
|
|
222
|
+
let {
|
|
223
|
+
expand
|
|
224
|
+
} = _ref4;
|
|
225
|
+
return expand ? 'flex' : 'none';
|
|
226
|
+
}};
|
|
227
|
+
transition: 0.3s;
|
|
228
|
+
overflow-y: scroll;
|
|
229
|
+
gap: 12px 0;
|
|
230
|
+
${scrollbar}
|
|
231
|
+
|
|
232
|
+
${_ref5 => {
|
|
233
|
+
let {
|
|
234
|
+
fixedYear
|
|
235
|
+
} = _ref5;
|
|
236
|
+
return css`
|
|
237
|
+
height: ${fixedYear ? '144' : '192'}px};
|
|
238
|
+
`;
|
|
239
|
+
}}
|
|
240
|
+
`;
|
|
241
|
+
const Item = styled.button`
|
|
242
|
+
width: calc(100% / 3);
|
|
243
|
+
height: 36px;
|
|
244
|
+
line-height: 36px;
|
|
245
|
+
text-align: center;
|
|
246
|
+
border-radius: var(--border-radius-s);
|
|
247
|
+
padding: 0;
|
|
248
|
+
border: none;
|
|
249
|
+
color: var(--font-on-background);
|
|
250
|
+
background: var(--color-background1);
|
|
251
|
+
|
|
252
|
+
&:hover {
|
|
253
|
+
${_ref6 => {
|
|
254
|
+
let {
|
|
255
|
+
disabled
|
|
256
|
+
} = _ref6;
|
|
257
|
+
return !disabled && 'background: var(--color-primary);';
|
|
258
|
+
}}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
${_ref7 => {
|
|
262
|
+
let {
|
|
263
|
+
disabled
|
|
264
|
+
} = _ref7;
|
|
265
|
+
return disabled && 'color: var(--font-on-mute)';
|
|
266
|
+
}}
|
|
267
|
+
|
|
268
|
+
${_ref8 => {
|
|
269
|
+
let {
|
|
270
|
+
selected
|
|
271
|
+
} = _ref8;
|
|
272
|
+
return selected && 'background: var(--color-hover)';
|
|
273
|
+
}}
|
|
274
|
+
`;
|
|
275
|
+
export default Year;
|