@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
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
-
var _reactI18next = require("react-i18next");
|
|
10
|
-
var _reactOutsideClickHandler = _interopRequireDefault(require("react-outside-click-handler"));
|
|
11
|
-
var _hooks = require("@cashub/hooks");
|
|
12
|
-
var _utils = require("@cashub/utils");
|
|
13
|
-
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
14
|
-
var _Accordion = _interopRequireDefault(require("./subComponent/Accordion"));
|
|
15
|
-
var _Input = _interopRequireDefault(require("../form/Input"));
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
-
const DatePicker = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
onConfirm,
|
|
23
|
-
selected,
|
|
24
|
-
minDate,
|
|
25
|
-
maxDate,
|
|
26
|
-
fixedYear,
|
|
27
|
-
disabled
|
|
28
|
-
} = _ref;
|
|
29
|
-
const {
|
|
30
|
-
t
|
|
31
|
-
} = (0, _reactI18next.useTranslation)();
|
|
32
|
-
const [currentDisplayType, setCurrentDisplayType] = (0, _react.useState)(null);
|
|
33
|
-
const [displayPicker, setDisplayPicker] = (0, _react.useState)(false);
|
|
34
|
-
const [selectedYear, setSelectedYear] = (0, _react.useState)(selected ? new Date(selected).getFullYear() : new Date().getFullYear());
|
|
35
|
-
const [selectedMonth, setSelectedMonth] = (0, _react.useState)(selected ? new Date(selected).getMonth() : new Date().getMonth());
|
|
36
|
-
const [selectedDay, setSelectedDay] = (0, _react.useState)(selected ? new Date(selected).getDate() : new Date().getDate());
|
|
37
|
-
const [confirmYear, setConfirmYear] = (0, _react.useState)(selected ? new Date(selected).getFullYear() : '');
|
|
38
|
-
const [confirmMonth, setConfirmMonth] = (0, _react.useState)(selected ? new Date(selected).getMonth() : '');
|
|
39
|
-
const [confirmDay, setConfirmDay] = (0, _react.useState)(selected ? new Date(selected).getDate() : '');
|
|
40
|
-
const [inputValue, setInputValue] = (0, _react.useState)(selected ? selected : '');
|
|
41
|
-
const [toggleElement, setToggleElement] = (0, _react.useState)(null);
|
|
42
|
-
const [contentElement, setContentElement] = (0, _react.useState)(null);
|
|
43
|
-
const {
|
|
44
|
-
styles,
|
|
45
|
-
attributes,
|
|
46
|
-
state,
|
|
47
|
-
update
|
|
48
|
-
} = (0, _hooks.useCustomPopper)(toggleElement, contentElement, {
|
|
49
|
-
strategy: 'absolute',
|
|
50
|
-
placement: 'bottom-start'
|
|
51
|
-
});
|
|
52
|
-
const weeks = (0, _react.useMemo)(() => {
|
|
53
|
-
return ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(week => /*#__PURE__*/(0, _jsxRuntime.jsx)(Week, {
|
|
54
|
-
children: week
|
|
55
|
-
}, week));
|
|
56
|
-
}, []);
|
|
57
|
-
const handleDisplayAccordionContent = (0, _react.useCallback)(type => {
|
|
58
|
-
if (currentDisplayType === type) {
|
|
59
|
-
setCurrentDisplayType(null);
|
|
60
|
-
} else {
|
|
61
|
-
setCurrentDisplayType(type);
|
|
62
|
-
}
|
|
63
|
-
}, [currentDisplayType]);
|
|
64
|
-
const handleChangeYear = selected => {
|
|
65
|
-
if (selected === 'previous') {
|
|
66
|
-
setSelectedYear(previousParams => {
|
|
67
|
-
if (previousParams <= 1) {
|
|
68
|
-
return previousParams;
|
|
69
|
-
}
|
|
70
|
-
return previousParams - 1;
|
|
71
|
-
});
|
|
72
|
-
} else if (selected === 'next') {
|
|
73
|
-
setSelectedYear(previousParams => {
|
|
74
|
-
return previousParams + 1;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
setCurrentDisplayType(null);
|
|
78
|
-
};
|
|
79
|
-
const handleChangeMonth = selected => {
|
|
80
|
-
if (selected === 'previous') {
|
|
81
|
-
setSelectedMonth(previousParams => {
|
|
82
|
-
if (previousParams <= 0) {
|
|
83
|
-
return 11;
|
|
84
|
-
}
|
|
85
|
-
return previousParams - 1;
|
|
86
|
-
});
|
|
87
|
-
} else if (selected === 'next') {
|
|
88
|
-
setSelectedMonth(previousParams => {
|
|
89
|
-
if (previousParams >= 11) {
|
|
90
|
-
return 0;
|
|
91
|
-
}
|
|
92
|
-
return previousParams + 1;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
setCurrentDisplayType(null);
|
|
96
|
-
};
|
|
97
|
-
const handleDisabled = (0, _react.useCallback)((firstWeekOfMonth, daysOfMonthForSelectedDate, dayIndex, day) => {
|
|
98
|
-
const selectedDate = (0, _utils.formatDate)(new Date(selectedYear, firstWeekOfMonth >= dayIndex + 1 ? selectedMonth - 1 : daysOfMonthForSelectedDate + firstWeekOfMonth < dayIndex + 1 ? selectedMonth + 1 : selectedMonth, day).getTime() + 86399 * 1000);
|
|
99
|
-
if (minDate && minDate > selectedDate || maxDate && maxDate < selectedDate) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
if (fixedYear) {
|
|
103
|
-
const disabledDateInDec = selectedMonth === 11 && dayIndex >= daysOfMonthForSelectedDate + firstWeekOfMonth;
|
|
104
|
-
const disabledDateInJan = selectedMonth === 0 && dayIndex < firstWeekOfMonth;
|
|
105
|
-
return !!(disabledDateInDec || disabledDateInJan);
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}, [fixedYear, minDate, maxDate, selectedMonth, selectedYear]);
|
|
109
|
-
const handleChangeDate = (0, _react.useCallback)((daysOfMonthForSelectedDate, firstWeekOfMonth, dayIndex, day) => {
|
|
110
|
-
if (!fixedYear) {
|
|
111
|
-
setSelectedYear(() => {
|
|
112
|
-
if (selectedMonth === 0 && dayIndex < firstWeekOfMonth && selectedYear > 1) {
|
|
113
|
-
return selectedYear - 1;
|
|
114
|
-
} else if (selectedMonth === 11 && dayIndex >= daysOfMonthForSelectedDate + firstWeekOfMonth) {
|
|
115
|
-
return selectedYear + 1;
|
|
116
|
-
}
|
|
117
|
-
return selectedYear;
|
|
118
|
-
});
|
|
119
|
-
setConfirmYear(() => {
|
|
120
|
-
if (selectedMonth === 0 && dayIndex < firstWeekOfMonth && selectedYear > 1) {
|
|
121
|
-
return selectedYear - 1;
|
|
122
|
-
} else if (selectedMonth === 11 && dayIndex >= daysOfMonthForSelectedDate + firstWeekOfMonth) {
|
|
123
|
-
return selectedYear + 1;
|
|
124
|
-
}
|
|
125
|
-
return selectedYear;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
setSelectedMonth(() => {
|
|
129
|
-
if (firstWeekOfMonth > dayIndex) {
|
|
130
|
-
return selectedMonth !== 0 ? selectedMonth - 1 : 11;
|
|
131
|
-
} else if (daysOfMonthForSelectedDate + firstWeekOfMonth <= dayIndex) {
|
|
132
|
-
return selectedMonth !== 11 ? selectedMonth + 1 : 0;
|
|
133
|
-
}
|
|
134
|
-
return selectedMonth;
|
|
135
|
-
});
|
|
136
|
-
setConfirmMonth(() => {
|
|
137
|
-
if (firstWeekOfMonth > dayIndex) {
|
|
138
|
-
return selectedMonth !== 0 ? selectedMonth - 1 : 11;
|
|
139
|
-
} else if (daysOfMonthForSelectedDate + firstWeekOfMonth <= dayIndex) {
|
|
140
|
-
return selectedMonth !== 11 ? selectedMonth + 1 : 0;
|
|
141
|
-
}
|
|
142
|
-
return selectedMonth;
|
|
143
|
-
});
|
|
144
|
-
setConfirmDay(day);
|
|
145
|
-
}, [fixedYear, selectedMonth, selectedYear]);
|
|
146
|
-
const handleSelectedDay = (0, _react.useCallback)((day, daysOfMonthForSelectedDate, index, firstWeekOfMonth, lastWeekOfMonth) => {
|
|
147
|
-
if (confirmDay === day && confirmYear === selectedYear && confirmMonth === selectedMonth) {
|
|
148
|
-
if (firstWeekOfMonth === 6 && lastWeekOfMonth === 6) {
|
|
149
|
-
return true;
|
|
150
|
-
} else if (firstWeekOfMonth !== 6 && lastWeekOfMonth === 6) {
|
|
151
|
-
return index + 1 > firstWeekOfMonth;
|
|
152
|
-
}
|
|
153
|
-
return !!(index + 1 >= firstWeekOfMonth && index + 1 <= daysOfMonthForSelectedDate + firstWeekOfMonth);
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
}, [confirmYear, confirmMonth, confirmDay, selectedYear, selectedMonth]);
|
|
157
|
-
const handleDisplayDays = (0, _react.useMemo)(() => {
|
|
158
|
-
const daysOfMonthForSelectedDate = new Date(selectedYear, selectedMonth + 1, 0).getDate();
|
|
159
|
-
const daysOfPrevioueMonthForSelectedDate = new Date(selectedYear, selectedMonth + 1 - 1, 0).getDate();
|
|
160
|
-
const firstWeekOfMonth = new Date(`${selectedYear}/${selectedMonth + 1}/1`).getDay();
|
|
161
|
-
const lastWeekOfMonth = new Date(`${selectedYear}/${selectedMonth + 1}/${daysOfMonthForSelectedDate}`).getDay();
|
|
162
|
-
const days = [];
|
|
163
|
-
for (const day of [...Array(daysOfMonthForSelectedDate).keys()]) {
|
|
164
|
-
days.push(day + 1);
|
|
165
|
-
}
|
|
166
|
-
if (firstWeekOfMonth !== 0) {
|
|
167
|
-
for (let index = daysOfPrevioueMonthForSelectedDate; index > daysOfPrevioueMonthForSelectedDate - firstWeekOfMonth; index -= 1) {
|
|
168
|
-
days.unshift(index);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (lastWeekOfMonth !== 6) {
|
|
172
|
-
for (let index = 1; index <= 6 - lastWeekOfMonth; index += 1) {
|
|
173
|
-
days.push(index);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return days.map((day, index) => {
|
|
177
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Day, {
|
|
178
|
-
disabled: handleDisabled(firstWeekOfMonth, daysOfMonthForSelectedDate, index, day),
|
|
179
|
-
onClick: () => {
|
|
180
|
-
handleChangeDate(daysOfMonthForSelectedDate, firstWeekOfMonth, index, day);
|
|
181
|
-
},
|
|
182
|
-
selected: handleSelectedDay(day, daysOfMonthForSelectedDate, index, firstWeekOfMonth, lastWeekOfMonth),
|
|
183
|
-
children: day
|
|
184
|
-
}, index);
|
|
185
|
-
});
|
|
186
|
-
}, [selectedMonth, selectedYear, handleDisabled, handleChangeDate, handleSelectedDay]);
|
|
187
|
-
const handleToggle = () => {
|
|
188
|
-
setDisplayPicker(!displayPicker);
|
|
189
|
-
update();
|
|
190
|
-
};
|
|
191
|
-
const handleConfirm = () => {
|
|
192
|
-
onConfirm(inputValue);
|
|
193
|
-
setDisplayPicker(false);
|
|
194
|
-
setCurrentDisplayType(null);
|
|
195
|
-
};
|
|
196
|
-
(0, _react.useEffect)(() => {
|
|
197
|
-
if (!selected) return;
|
|
198
|
-
const date = new Date(selected);
|
|
199
|
-
setSelectedYear(date.getFullYear());
|
|
200
|
-
setSelectedMonth(date.getMonth());
|
|
201
|
-
setSelectedDay(date.getDate());
|
|
202
|
-
setConfirmYear(date.getFullYear());
|
|
203
|
-
setConfirmMonth(date.getMonth());
|
|
204
|
-
setConfirmDay(date.getDate());
|
|
205
|
-
setInputValue(selected);
|
|
206
|
-
}, [selected]);
|
|
207
|
-
(0, _react.useEffect)(() => {
|
|
208
|
-
if (!(confirmYear && confirmMonth && confirmDay)) return;
|
|
209
|
-
setInputValue((0, _utils.formatDate)(new Date(confirmYear, confirmMonth, confirmDay), 'date'));
|
|
210
|
-
}, [confirmYear, confirmMonth, confirmDay]);
|
|
211
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactOutsideClickHandler.default, {
|
|
212
|
-
onOutsideClick: handleConfirm,
|
|
213
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PickerInput, {
|
|
214
|
-
ref: setToggleElement,
|
|
215
|
-
value: inputValue,
|
|
216
|
-
onClick: handleToggle,
|
|
217
|
-
readOnly: true,
|
|
218
|
-
disabled: disabled
|
|
219
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
220
|
-
...attributes.popper,
|
|
221
|
-
style: styles.popper,
|
|
222
|
-
placement: state && state.placement,
|
|
223
|
-
ref: setContentElement,
|
|
224
|
-
displayPicker: displayPicker,
|
|
225
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Body, {
|
|
226
|
-
displayType: currentDisplayType,
|
|
227
|
-
children: [!fixedYear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Accordion.default, {
|
|
228
|
-
type: "year",
|
|
229
|
-
handleDisplayAccordionContent: () => {
|
|
230
|
-
handleDisplayAccordionContent('year');
|
|
231
|
-
},
|
|
232
|
-
handleChangeTitle: handleChangeYear,
|
|
233
|
-
setCurrentDisplayType: setCurrentDisplayType,
|
|
234
|
-
currentDisplayType: currentDisplayType,
|
|
235
|
-
selectedYear: selectedYear,
|
|
236
|
-
setSelectedYear: setSelectedYear,
|
|
237
|
-
selectedDay: selectedDay,
|
|
238
|
-
minDate: minDate,
|
|
239
|
-
maxDate: maxDate,
|
|
240
|
-
fixedYear: fixedYear
|
|
241
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Accordion.default, {
|
|
242
|
-
type: "month",
|
|
243
|
-
handleDisplayAccordionContent: () => {
|
|
244
|
-
handleDisplayAccordionContent('month');
|
|
245
|
-
},
|
|
246
|
-
handleChangeTitle: handleChangeMonth,
|
|
247
|
-
setCurrentDisplayType: setCurrentDisplayType,
|
|
248
|
-
currentDisplayType: currentDisplayType,
|
|
249
|
-
selectedMonth: selectedMonth,
|
|
250
|
-
setSelectedMonth: setSelectedMonth,
|
|
251
|
-
selectedYear: selectedYear,
|
|
252
|
-
selectedDay: selectedDay,
|
|
253
|
-
fixedYear: fixedYear,
|
|
254
|
-
minDate: minDate,
|
|
255
|
-
maxDate: maxDate
|
|
256
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateContent, {
|
|
257
|
-
children: [weeks, handleDisplayDays]
|
|
258
|
-
})]
|
|
259
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Footer, {
|
|
260
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ConfirmButton, {
|
|
261
|
-
fullWidth: true,
|
|
262
|
-
alignCenter: true,
|
|
263
|
-
onClick: handleConfirm,
|
|
264
|
-
children: t('Confirm')
|
|
265
|
-
})
|
|
266
|
-
})]
|
|
267
|
-
})]
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
const Wrapper = _styledComponents.default.div`
|
|
271
|
-
padding-bottom: var(--spacing-s);
|
|
272
|
-
background: var(--color-background1);
|
|
273
|
-
border-radius: var(--border-radius);
|
|
274
|
-
border: var(--border-width) solid var(--border-color);
|
|
275
|
-
box-shadow: var(--box-shadow);
|
|
276
|
-
overflow: hidden;
|
|
277
|
-
width: 286px;
|
|
278
|
-
z-index: 1;
|
|
279
|
-
color: var(--font-on-background);
|
|
280
|
-
|
|
281
|
-
display: ${_ref2 => {
|
|
282
|
-
let {
|
|
283
|
-
displayPicker
|
|
284
|
-
} = _ref2;
|
|
285
|
-
return displayPicker ? 'block' : 'none';
|
|
286
|
-
}};
|
|
287
|
-
`;
|
|
288
|
-
const Week = _styledComponents.default.div`
|
|
289
|
-
min-width: 36px;
|
|
290
|
-
height: 36px;
|
|
291
|
-
border-radius: var(--border-radius-s);
|
|
292
|
-
line-height: 36px;
|
|
293
|
-
text-align: center;
|
|
294
|
-
`;
|
|
295
|
-
const Day = _styledComponents.default.button`
|
|
296
|
-
min-width: 36px;
|
|
297
|
-
height: 36px;
|
|
298
|
-
border-radius: var(--border-radius-s);
|
|
299
|
-
line-height: 36px;
|
|
300
|
-
text-align: center;
|
|
301
|
-
padding: 0;
|
|
302
|
-
border: 0;
|
|
303
|
-
background: var(--color-background1);
|
|
304
|
-
color: var(--font-on-background);
|
|
305
|
-
&:hover {
|
|
306
|
-
background: var(--color-primary);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
${_ref3 => {
|
|
310
|
-
let {
|
|
311
|
-
selected
|
|
312
|
-
} = _ref3;
|
|
313
|
-
return selected && 'background: var(--color-hover);';
|
|
314
|
-
}}
|
|
315
|
-
|
|
316
|
-
${_ref4 => {
|
|
317
|
-
let {
|
|
318
|
-
disabled
|
|
319
|
-
} = _ref4;
|
|
320
|
-
return disabled && (0, _styledComponents.css)`
|
|
321
|
-
color: var(--font-on-mute);
|
|
322
|
-
background: none;
|
|
323
|
-
&:hover {
|
|
324
|
-
background: none;
|
|
325
|
-
}
|
|
326
|
-
`;
|
|
327
|
-
}}
|
|
328
|
-
`;
|
|
329
|
-
const DateContent = _styledComponents.default.div`
|
|
330
|
-
display: flex;
|
|
331
|
-
flex-wrap: wrap;
|
|
332
|
-
`;
|
|
333
|
-
const PickerInput = (0, _styledComponents.default)(_Input.default)`
|
|
334
|
-
&:disabled {
|
|
335
|
-
cursor: not-allowed;
|
|
336
|
-
opacity: 0.5;
|
|
337
|
-
}
|
|
338
|
-
`;
|
|
339
|
-
const ConfirmButton = (0, _styledComponents.default)(_Button.default)`
|
|
340
|
-
margin: 16px auto 0;
|
|
341
|
-
`;
|
|
342
|
-
const Body = _styledComponents.default.div`
|
|
343
|
-
${_ref5 => {
|
|
344
|
-
let {
|
|
345
|
-
displayType
|
|
346
|
-
} = _ref5;
|
|
347
|
-
return displayType && (0, _styledComponents.css)`
|
|
348
|
-
height: 216px;
|
|
349
|
-
`;
|
|
350
|
-
}}
|
|
351
|
-
|
|
352
|
-
overflow: hidden;
|
|
353
|
-
padding: ${_ref6 => {
|
|
354
|
-
let {
|
|
355
|
-
displayType
|
|
356
|
-
} = _ref6;
|
|
357
|
-
return displayType === 'year' ? ' 0 4px var(--spacing-s) var(--spacing-s)' : '0 var(--spacing-s) 0 var(--spacing-s)';
|
|
358
|
-
}};
|
|
359
|
-
`;
|
|
360
|
-
const Footer = _styledComponents.default.div`
|
|
361
|
-
padding: 0 var(--spacing-s);
|
|
362
|
-
`;
|
|
363
|
-
var _default = exports.default = DatePicker;
|