@jenesei-software/jenesei-kit-react 1.2.3 → 1.2.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/build/{area-C2sWYH-e.js → area-BC64nSGj.js} +2 -2
- package/build/{area-C2sWYH-e.js.map → area-BC64nSGj.js.map} +1 -1
- package/build/{area-CD10k19W.cjs → area-C6QOr2Kd.cjs} +7 -7
- package/build/{area-CD10k19W.cjs.map → area-C6QOr2Kd.cjs.map} +1 -1
- package/build/area-scroll.cjs.js +1 -1
- package/build/area-scroll.es.js +1 -1
- package/build/build-info.txt +3 -3
- package/build/{component-CbPhVNw5.js → component-BJ4BlUBV.js} +2 -2
- package/build/{component-CbPhVNw5.js.map → component-BJ4BlUBV.js.map} +1 -1
- package/build/{component-BnYw0FvH.cjs → component-BfsH0boq.cjs} +2 -2
- package/build/{component-BnYw0FvH.cjs.map → component-BfsH0boq.cjs.map} +1 -1
- package/build/{component-9m1Ib3fS.js → component-BtA2Qlbp.js} +2 -2
- package/build/{component-9m1Ib3fS.js.map → component-BtA2Qlbp.js.map} +1 -1
- package/build/{component-C8QrHu0C.js → component-CTz8wF0z.js} +3 -3
- package/build/{component-C8QrHu0C.js.map → component-CTz8wF0z.js.map} +1 -1
- package/build/{component-FwG2ieR3.cjs → component-CV14RCdO.cjs} +2 -2
- package/build/{component-FwG2ieR3.cjs.map → component-CV14RCdO.cjs.map} +1 -1
- package/build/{component-C0atFCun.cjs → component-DBxYbAnr.cjs} +2 -2
- package/build/{component-C0atFCun.cjs.map → component-DBxYbAnr.cjs.map} +1 -1
- package/build/{component-DURhph1i.js → component-DTH1-Npa.js} +3 -3
- package/build/{component-DURhph1i.js.map → component-DTH1-Npa.js.map} +1 -1
- package/build/{component-X4e7zEKk.cjs → component-Dw21Chky.cjs} +2 -2
- package/build/{component-X4e7zEKk.cjs.map → component-Dw21Chky.cjs.map} +1 -1
- package/build/{component-Bovatz78.cjs → component-ODhIlUPq.cjs} +2 -2
- package/build/{component-Bovatz78.cjs.map → component-ODhIlUPq.cjs.map} +1 -1
- package/build/component-button-group.cjs.js +1 -1
- package/build/component-button-group.es.js +1 -1
- package/build/component-button.cjs.js +1 -1
- package/build/component-button.es.js +1 -1
- package/build/component-checkbox-group.cjs.js +1 -1
- package/build/component-checkbox-group.es.js +1 -1
- package/build/component-checkbox.cjs.js +1 -1
- package/build/component-checkbox.es.js +1 -1
- package/build/component-date-picker.cjs.js +1 -1
- package/build/component-date-picker.d.ts +74 -65
- package/build/component-date-picker.es.js +9 -10
- package/build/component-image-button.cjs.js +1 -1
- package/build/component-image-button.es.js +1 -1
- package/build/component-image-select.cjs.js +1 -1
- package/build/component-image-select.es.js +1 -1
- package/build/component-image-slider.cjs.js +1 -1
- package/build/component-image-slider.es.js +1 -1
- package/build/component-input-otp.cjs.js +1 -1
- package/build/component-input-otp.es.js +1 -1
- package/build/component-input.cjs.js +1 -1
- package/build/component-input.d.ts +3 -3
- package/build/component-input.es.js +3 -3
- package/build/component-map.cjs.js +1 -1
- package/build/component-map.es.js +1 -1
- package/build/component-pagination.cjs.js +1 -1
- package/build/component-pagination.es.js +1 -1
- package/build/component-range.cjs.js +1 -1
- package/build/component-range.es.js +1 -1
- package/build/component-select.cjs.js +1 -1
- package/build/component-select.d.ts +6 -6
- package/build/component-select.es.js +1 -1
- package/build/component-textarea.cjs.js +1 -1
- package/build/component-textarea.es.js +1 -1
- package/build/component-toggle.cjs.js +1 -1
- package/build/component-toggle.es.js +1 -1
- package/build/component-tooltip.cjs.js +1 -1
- package/build/component-tooltip.d.ts +1 -0
- package/build/component-tooltip.es.js +1 -1
- package/build/component-typography.cjs.js +1 -1
- package/build/component-typography.d.ts +1 -0
- package/build/component-typography.es.js +1 -1
- package/build/{component--cOriuv7.js → component-zhkRBgS8.js} +45 -3
- package/build/{component--cOriuv7.js.map → component-zhkRBgS8.js.map} +1 -1
- package/build/{component.components-1kRDD3KO.cjs → component.components-9ON8OLUd.cjs} +2 -2
- package/build/{component.components-1kRDD3KO.cjs.map → component.components-9ON8OLUd.cjs.map} +1 -1
- package/build/{component.components-CQ3LLnFl.js → component.components-CnwUBa8n.js} +2 -2
- package/build/{component.components-CQ3LLnFl.js.map → component.components-CnwUBa8n.js.map} +1 -1
- package/build/{component.constants-B1rq1PLe.js → component.constants-Ck-Y1EPF.js} +2 -2
- package/build/{component.constants-B1rq1PLe.js.map → component.constants-Ck-Y1EPF.js.map} +1 -1
- package/build/{component.constants-BLHg7rcI.cjs → component.constants-DD964QJh.cjs} +2 -2
- package/build/{component.constants-BLHg7rcI.cjs.map → component.constants-DD964QJh.cjs.map} +1 -1
- package/build/{component.constants-Gz2mf7IF.cjs → component.constants-DGS-J9Sc.cjs} +2 -2
- package/build/{component.constants-Gz2mf7IF.cjs.map → component.constants-DGS-J9Sc.cjs.map} +1 -1
- package/build/{component.constants-B95xyW0s.js → component.constants-c0DK2OSH.js} +3 -3
- package/build/{component.constants-B95xyW0s.js.map → component.constants-c0DK2OSH.js.map} +1 -1
- package/build/{component.styles-q4ne6jV1.cjs → component.styles-B4reSccT.cjs} +2 -2
- package/build/{component.styles-q4ne6jV1.cjs.map → component.styles-B4reSccT.cjs.map} +1 -1
- package/build/{component.styles-BrGPrrEb.cjs → component.styles-BScmaCvt.cjs} +2 -2
- package/build/{component.styles-BrGPrrEb.cjs.map → component.styles-BScmaCvt.cjs.map} +1 -1
- package/build/{component.styles-Dm_Ov4nM.cjs → component.styles-C5GdZJou.cjs} +24 -24
- package/build/{component.styles-Dm_Ov4nM.cjs.map → component.styles-C5GdZJou.cjs.map} +1 -1
- package/build/{component.styles-BzNkEurr.js → component.styles-CFrk_dpy.js} +5 -5
- package/build/{component.styles-BzNkEurr.js.map → component.styles-CFrk_dpy.js.map} +1 -1
- package/build/{component.styles-CvJK1eif.cjs → component.styles-CGyQHdKu.cjs} +8 -13
- package/build/component.styles-CGyQHdKu.cjs.map +1 -0
- package/build/{component.styles-DqNAGfc9.cjs → component.styles-CzsKP7v-.cjs} +2 -2
- package/build/{component.styles-DqNAGfc9.cjs.map → component.styles-CzsKP7v-.cjs.map} +1 -1
- package/build/{component.styles-vcNQJK0U.cjs → component.styles-D8ZAo-kS.cjs} +2 -2
- package/build/{component.styles-vcNQJK0U.cjs.map → component.styles-D8ZAo-kS.cjs.map} +1 -1
- package/build/{component.styles-DjLSmx3e.cjs → component.styles-DLbbGi9i.cjs} +2 -2
- package/build/{component.styles-DjLSmx3e.cjs.map → component.styles-DLbbGi9i.cjs.map} +1 -1
- package/build/{component.styles-DKG-fvog.js → component.styles-DS53SD15.js} +4 -4
- package/build/{component.styles-DKG-fvog.js.map → component.styles-DS53SD15.js.map} +1 -1
- package/build/{component.styles-DMBvhmz6.js → component.styles-DjJOwUeA.js} +3 -3
- package/build/{component.styles-DMBvhmz6.js.map → component.styles-DjJOwUeA.js.map} +1 -1
- package/build/{component.styles-DqTkSP8L.js → component.styles-DsnwGPvj.js} +16 -21
- package/build/component.styles-DsnwGPvj.js.map +1 -0
- package/build/{component.styles-DhI3n-dL.js → component.styles-DxQx6LQO.js} +3 -3
- package/build/{component.styles-DhI3n-dL.js.map → component.styles-DxQx6LQO.js.map} +1 -1
- package/build/{component.styles-CccZrbSA.js → component.styles-N7ZFXn4z.js} +2 -2
- package/build/{component.styles-CccZrbSA.js.map → component.styles-N7ZFXn4z.js.map} +1 -1
- package/build/{component.styles-DuIrUV9k.js → component.styles-UIEZecbT.js} +2 -2
- package/build/{component.styles-DuIrUV9k.js.map → component.styles-UIEZecbT.js.map} +1 -1
- package/build/{component.styles-CRWn1pVi.js → component.styles-WqYNZfbs.js} +3 -3
- package/build/{component.styles-CRWn1pVi.js.map → component.styles-WqYNZfbs.js.map} +1 -1
- package/build/{component.styles-Dt_CUijB.js → component.styles-hc14mwUo.js} +6 -7
- package/build/{component.styles-Dt_CUijB.js.map → component.styles-hc14mwUo.js.map} +1 -1
- package/build/{component.styles-DwdN7mQq.cjs → component.styles-qRQ8i8W6.cjs} +2 -2
- package/build/{component.styles-DwdN7mQq.cjs.map → component.styles-qRQ8i8W6.cjs.map} +1 -1
- package/build/{component.styles-Bz2vyHqK.cjs → component.styles-sTbPcfTb.cjs} +2 -2
- package/build/{component.styles-Bz2vyHqK.cjs.map → component.styles-sTbPcfTb.cjs.map} +1 -1
- package/build/component.types-A04vFOxU.cjs +164 -0
- package/build/component.types-A04vFOxU.cjs.map +1 -0
- package/build/component.types-CqvwcIsz.js +843 -0
- package/build/component.types-CqvwcIsz.js.map +1 -0
- package/build/context-sonner.cjs.js +1 -1
- package/build/context-sonner.es.js +1 -1
- package/build/{context.constants-BAz35AJw.js → context.constants-B9I-yc9Q.js} +3 -3
- package/build/{context.constants-BAz35AJw.js.map → context.constants-B9I-yc9Q.js.map} +1 -1
- package/build/{context.constants-fwK8ogSf.cjs → context.constants-DkMk-pc7.cjs} +2 -2
- package/build/{context.constants-fwK8ogSf.cjs.map → context.constants-DkMk-pc7.cjs.map} +1 -1
- package/build/index.cjs.js +1 -1
- package/build/index.d.ts +83 -61
- package/build/index.es.js +34 -35
- package/build/{style-DjCgiI7l.js → style-Dca2udON.js} +2 -2
- package/build/{style-DjCgiI7l.js.map → style-Dca2udON.js.map} +1 -1
- package/build/{style-eIuUYu9x.cjs → style-DmwoOdFB.cjs} +2 -2
- package/build/{style-eIuUYu9x.cjs.map → style-DmwoOdFB.cjs.map} +1 -1
- package/build/style-error.cjs.js +1 -1
- package/build/style-error.es.js +1 -1
- package/build/{use-BnaBipTR.cjs → use-Deto6eH3.cjs} +2 -2
- package/build/{use-BnaBipTR.cjs.map → use-Deto6eH3.cjs.map} +1 -1
- package/build/{use-B6rT81uF.js → use-JiiFbVer.js} +3 -3
- package/build/{use-B6rT81uF.js.map → use-JiiFbVer.js.map} +1 -1
- package/package.json +1 -1
- package/build/component.styles-CvJK1eif.cjs.map +0 -1
- package/build/component.styles-DCDOKa6e.js +0 -793
- package/build/component.styles-DCDOKa6e.js.map +0 -1
- package/build/component.styles-DTC9tjQX.cjs +0 -165
- package/build/component.styles-DTC9tjQX.cjs.map +0 -1
- package/build/component.styles-DqTkSP8L.js.map +0 -1
|
@@ -0,0 +1,843 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "./jsx-runtime-BrDlu8eK.js";
|
|
2
|
+
import { c as Button } from "./component-BJ4BlUBV.js";
|
|
3
|
+
import "./component.styles-B0L4jbOO.js";
|
|
4
|
+
import { R as Ripple } from "./component-vpCWcIhC.js";
|
|
5
|
+
import { c as SelectMonth, e as SelectYear } from "./component.styles-DsnwGPvj.js";
|
|
6
|
+
import { b as Stack } from "./component-jPZYT5iL.js";
|
|
7
|
+
import { b as ErrorMessage, a as addError } from "./style-Dca2udON.js";
|
|
8
|
+
import { K as KEY_SIZE_DATA } from "./theme.global-B46v_8eu.js";
|
|
9
|
+
import moment from "moment";
|
|
10
|
+
import { useState, useMemo, useCallback, useRef, useEffect, Fragment } from "react";
|
|
11
|
+
import styled, { useTheme, css } from "styled-components";
|
|
12
|
+
import { u as usePopover, j as Typography, P as Popover, g as getFontSizeStyles } from "./component-zhkRBgS8.js";
|
|
13
|
+
import { d as addInputIsInputEffect } from "./component.styles-hc14mwUo.js";
|
|
14
|
+
import { j as addNiceNumber, a as addRemoveScrollbar, b as addTransition, f as addOutline, i as addRemoveOutline } from "./style-Bvt_Melk.js";
|
|
15
|
+
import { a as addSX } from "./style-plT9Ah7t.js";
|
|
16
|
+
import { motion } from "framer-motion";
|
|
17
|
+
function countSevens(number) {
|
|
18
|
+
const divisor = 7;
|
|
19
|
+
const count = Math.floor(number / divisor);
|
|
20
|
+
const remainder = number % divisor;
|
|
21
|
+
return remainder > 0 ? count + 1 : count;
|
|
22
|
+
}
|
|
23
|
+
const DatePicker = (props) => {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
const { onChange } = props;
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
const [valueMoment, setValueMoment] = useState(null);
|
|
28
|
+
const [dateDefaultMoment, setDateDefaultMoment] = useState(moment(props.dateDefault).utc());
|
|
29
|
+
const [input, setInput] = useState({
|
|
30
|
+
[DatePickerVariant.DD]: null,
|
|
31
|
+
[DatePickerVariant.MM]: null,
|
|
32
|
+
[DatePickerVariant.YYYY]: null
|
|
33
|
+
});
|
|
34
|
+
const [activeSegment, setActiveSegment] = useState(null);
|
|
35
|
+
const [isError, setIsError] = useState(false);
|
|
36
|
+
const mode = useMemo(() => {
|
|
37
|
+
if (!props.mode || props.mode.length === 0) {
|
|
38
|
+
return [DatePickerVariant.DD, DatePickerVariant.MM, DatePickerVariant.YYYY];
|
|
39
|
+
}
|
|
40
|
+
const hasDuplicates = new Set(props.mode).size !== props.mode.length;
|
|
41
|
+
if (hasDuplicates) {
|
|
42
|
+
return [DatePickerVariant.DD, DatePickerVariant.MM, DatePickerVariant.YYYY];
|
|
43
|
+
}
|
|
44
|
+
return props.mode;
|
|
45
|
+
}, [props.mode]);
|
|
46
|
+
const getNextSegment = useCallback(
|
|
47
|
+
(currentSegment) => {
|
|
48
|
+
const currentIndex = mode.indexOf(currentSegment);
|
|
49
|
+
return currentIndex < mode.length - 1 ? mode[currentIndex + 1] : mode[0];
|
|
50
|
+
},
|
|
51
|
+
[mode]
|
|
52
|
+
);
|
|
53
|
+
const getPrevSegment = useCallback(
|
|
54
|
+
(currentSegment) => {
|
|
55
|
+
const currentIndex = mode.indexOf(currentSegment);
|
|
56
|
+
return currentIndex > 0 ? mode[currentIndex - 1] : mode[mode.length - 1];
|
|
57
|
+
},
|
|
58
|
+
[mode]
|
|
59
|
+
);
|
|
60
|
+
const dataDate = useMemo(() => {
|
|
61
|
+
const result = {
|
|
62
|
+
MM: {
|
|
63
|
+
nextSegment: getNextSegment(DatePickerVariant.MM),
|
|
64
|
+
preSegment: getPrevSegment(DatePickerVariant.MM),
|
|
65
|
+
onNext: () => setActiveSegment(getNextSegment(DatePickerVariant.MM)),
|
|
66
|
+
onPrev: () => setActiveSegment(getPrevSegment(DatePickerVariant.MM)),
|
|
67
|
+
isLast: mode[mode.length - 1] === DatePickerVariant.MM,
|
|
68
|
+
type: DatePickerVariant.MM,
|
|
69
|
+
value: input.MM,
|
|
70
|
+
setValue: (value) => setInput((prevValue) => ({ ...prevValue, [DatePickerVariant.MM]: value })),
|
|
71
|
+
setActive: () => setActiveSegment(DatePickerVariant.MM),
|
|
72
|
+
placeholder: props.locale.inputs.month
|
|
73
|
+
},
|
|
74
|
+
DD: {
|
|
75
|
+
nextSegment: getNextSegment(DatePickerVariant.DD),
|
|
76
|
+
preSegment: getPrevSegment(DatePickerVariant.DD),
|
|
77
|
+
isLast: mode[mode.length - 1] === DatePickerVariant.DD,
|
|
78
|
+
onNext: () => setActiveSegment(getNextSegment(DatePickerVariant.DD)),
|
|
79
|
+
onPrev: () => setActiveSegment(getPrevSegment(DatePickerVariant.DD)),
|
|
80
|
+
type: DatePickerVariant.DD,
|
|
81
|
+
value: input.DD,
|
|
82
|
+
setValue: (value) => setInput((prevValue) => ({ ...prevValue, [DatePickerVariant.DD]: value })),
|
|
83
|
+
setActive: () => setActiveSegment(DatePickerVariant.DD),
|
|
84
|
+
placeholder: props.locale.inputs.day
|
|
85
|
+
},
|
|
86
|
+
YYYY: {
|
|
87
|
+
nextSegment: getNextSegment(DatePickerVariant.YYYY),
|
|
88
|
+
preSegment: getPrevSegment(DatePickerVariant.YYYY),
|
|
89
|
+
isLast: mode[mode.length - 1] === DatePickerVariant.YYYY,
|
|
90
|
+
onNext: () => setActiveSegment(getNextSegment(DatePickerVariant.YYYY)),
|
|
91
|
+
onPrev: () => setActiveSegment(getPrevSegment(DatePickerVariant.YYYY)),
|
|
92
|
+
type: DatePickerVariant.YYYY,
|
|
93
|
+
value: input.YYYY,
|
|
94
|
+
setValue: (value) => setInput((prevValue) => ({ ...prevValue, [DatePickerVariant.YYYY]: value })),
|
|
95
|
+
setActive: () => setActiveSegment(DatePickerVariant.YYYY),
|
|
96
|
+
placeholder: props.locale.inputs.year
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const resultSort = mode.map((e) => {
|
|
100
|
+
if (e === DatePickerVariant.DD) return result.DD;
|
|
101
|
+
if (e === DatePickerVariant.MM) return result.MM;
|
|
102
|
+
if (e === DatePickerVariant.YYYY) return result.YYYY;
|
|
103
|
+
return null;
|
|
104
|
+
}).filter((e) => e !== null);
|
|
105
|
+
return { sort: resultSort, default: result };
|
|
106
|
+
}, [
|
|
107
|
+
props.locale.inputs.day,
|
|
108
|
+
props.locale.inputs.month,
|
|
109
|
+
props.locale.inputs.year,
|
|
110
|
+
getNextSegment,
|
|
111
|
+
getPrevSegment,
|
|
112
|
+
mode,
|
|
113
|
+
input.DD,
|
|
114
|
+
input.MM,
|
|
115
|
+
input.YYYY
|
|
116
|
+
]);
|
|
117
|
+
const daysInWeek = useMemo(() => {
|
|
118
|
+
const weekOrder = ["mo", "tu", "we", "th", "fr", "sa", "su"];
|
|
119
|
+
return weekOrder.map((key, index) => {
|
|
120
|
+
const found = props.locale.weeks.find((w) => w.value === key);
|
|
121
|
+
return {
|
|
122
|
+
index,
|
|
123
|
+
label: (found == null ? void 0 : found.localeShort) ?? key.toUpperCase()
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}, [props.locale.weeks]);
|
|
127
|
+
const daysInMonth = useMemo(() => {
|
|
128
|
+
const today = moment.utc();
|
|
129
|
+
const startOfMonth = (valueMoment ?? dateDefaultMoment).clone().startOf("month");
|
|
130
|
+
const endOfMonth = (valueMoment ?? dateDefaultMoment).clone().endOf("month");
|
|
131
|
+
const days = [];
|
|
132
|
+
const dateMin = props.dateMin ? moment.utc(props.dateMin) : null;
|
|
133
|
+
const dateMax = props.dateMax ? moment.utc(props.dateMax) : null;
|
|
134
|
+
const daysToAddBefore = startOfMonth.isoWeekday() - 1;
|
|
135
|
+
if (daysToAddBefore > 0) {
|
|
136
|
+
for (let i = daysToAddBefore; i > 0; i--) {
|
|
137
|
+
const day = startOfMonth.clone().subtract(i, "days");
|
|
138
|
+
days.push({
|
|
139
|
+
value: day.valueOf(),
|
|
140
|
+
labelString: day.format("dd"),
|
|
141
|
+
labelNumber: day.date(),
|
|
142
|
+
dayOfWeek: day.isoWeekday(),
|
|
143
|
+
isWeekend: day.isoWeekday() === 6 || day.isoWeekday() === 7,
|
|
144
|
+
weekOfMonth: Math.ceil((days.length + 1) / 7),
|
|
145
|
+
isToday: day.isSame(today, "day"),
|
|
146
|
+
isCurrentMonth: false,
|
|
147
|
+
isDisabled: day.isBefore(dateMin, "day") || day.isAfter(dateMax, "day")
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const currentDate = startOfMonth.clone();
|
|
152
|
+
while (currentDate <= endOfMonth) {
|
|
153
|
+
days.push({
|
|
154
|
+
value: currentDate.valueOf(),
|
|
155
|
+
labelString: currentDate.format("dd"),
|
|
156
|
+
labelNumber: currentDate.date(),
|
|
157
|
+
dayOfWeek: currentDate.isoWeekday(),
|
|
158
|
+
isWeekend: currentDate.isoWeekday() === 6 || currentDate.isoWeekday() === 7,
|
|
159
|
+
weekOfMonth: Math.ceil((days.length + 1) / 7),
|
|
160
|
+
isToday: currentDate.isSame(today, "day"),
|
|
161
|
+
isCurrentMonth: true,
|
|
162
|
+
isDisabled: currentDate.isBefore(dateMin, "day") || currentDate.isAfter(dateMax, "day")
|
|
163
|
+
});
|
|
164
|
+
currentDate.add(1, "day");
|
|
165
|
+
}
|
|
166
|
+
const daysToAddAfter = 7 - endOfMonth.isoWeekday();
|
|
167
|
+
if (daysToAddAfter > 0) {
|
|
168
|
+
for (let i = 1; i <= daysToAddAfter; i++) {
|
|
169
|
+
const day = endOfMonth.clone().add(i, "days").startOf("day");
|
|
170
|
+
days.push({
|
|
171
|
+
value: day.valueOf(),
|
|
172
|
+
labelString: day.format("dd"),
|
|
173
|
+
labelNumber: day.date(),
|
|
174
|
+
dayOfWeek: day.isoWeekday(),
|
|
175
|
+
isWeekend: day.isoWeekday() === 6 || day.isoWeekday() === 7,
|
|
176
|
+
weekOfMonth: Math.ceil((days.length + 1) / 7),
|
|
177
|
+
isToday: day.isSame(today, "day"),
|
|
178
|
+
isCurrentMonth: false,
|
|
179
|
+
isDisabled: day.isBefore(dateMin, "day") || day.isAfter(dateMax, "day")
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
days.sort((a, b) => a.value - b.value);
|
|
184
|
+
return days;
|
|
185
|
+
}, [valueMoment, dateDefaultMoment, props.dateMax, props.dateMin]);
|
|
186
|
+
const rows = useMemo(() => countSevens(daysInMonth.length) + 1, [daysInMonth]);
|
|
187
|
+
const height = useMemo(
|
|
188
|
+
() => 40 + rows * 28 + (rows - 1) * 6 + KEY_SIZE_DATA[props.size].padding * 2,
|
|
189
|
+
[props.size, rows]
|
|
190
|
+
);
|
|
191
|
+
const sizeRadius = useMemo(() => KEY_SIZE_DATA[props.size].radius, [props.size]);
|
|
192
|
+
const isHasValue = useMemo(() => {
|
|
193
|
+
return valueMoment !== null;
|
|
194
|
+
}, [valueMoment]);
|
|
195
|
+
const isBlockNextMonth = useMemo(() => {
|
|
196
|
+
const nextMonth = (valueMoment ?? dateDefaultMoment).clone().add(1, "month").startOf("month");
|
|
197
|
+
const isBeforeEndDate = props.dateMax ? nextMonth.isAfter(moment.utc(props.dateMax), "month") : false;
|
|
198
|
+
return isBeforeEndDate;
|
|
199
|
+
}, [valueMoment, props.dateMax, dateDefaultMoment]);
|
|
200
|
+
const isBlockPrevMonth = useMemo(() => {
|
|
201
|
+
const prevMonth = (valueMoment ?? dateDefaultMoment).clone().subtract(1, "month").startOf("month");
|
|
202
|
+
const isAfterStartDate = props.dateMin ? prevMonth.isBefore(moment.utc(props.dateMin), "month") : false;
|
|
203
|
+
return isAfterStartDate;
|
|
204
|
+
}, [valueMoment, props.dateMin, dateDefaultMoment]);
|
|
205
|
+
const refSelectMonth = useRef(null);
|
|
206
|
+
const refSelectYear = useRef(null);
|
|
207
|
+
const sizePadding = useMemo(() => KEY_SIZE_DATA[props.size].padding, [props.size]);
|
|
208
|
+
const { isOpen, close, refReference, refFloating, floatingStyles, open } = usePopover({
|
|
209
|
+
placement: "bottom-start",
|
|
210
|
+
offset: sizePadding,
|
|
211
|
+
mode: "independence",
|
|
212
|
+
isClickOutside: true,
|
|
213
|
+
refsExcludeClickOutside: [refSelectMonth, refSelectYear],
|
|
214
|
+
isDisabled: props == null ? void 0 : props.isDisabled,
|
|
215
|
+
onFocus() {
|
|
216
|
+
var _a2;
|
|
217
|
+
(_a2 = props.onFocus) == null ? void 0 : _a2.call(props);
|
|
218
|
+
},
|
|
219
|
+
onBlur() {
|
|
220
|
+
var _a2;
|
|
221
|
+
(_a2 = props.onBlur) == null ? void 0 : _a2.call(props);
|
|
222
|
+
},
|
|
223
|
+
onBlurReference() {
|
|
224
|
+
setActiveSegment(null);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
const onChangeDate = useCallback(
|
|
228
|
+
(timestamp) => {
|
|
229
|
+
const momentNewDate = moment(timestamp).utc();
|
|
230
|
+
if (valueMoment == null ? void 0 : valueMoment.isSame(momentNewDate, "day")) return;
|
|
231
|
+
setValueMoment(momentNewDate);
|
|
232
|
+
setInput({
|
|
233
|
+
[DatePickerVariant.DD]: momentNewDate.clone().date(),
|
|
234
|
+
[DatePickerVariant.MM]: momentNewDate.clone().month() + 1,
|
|
235
|
+
[DatePickerVariant.YYYY]: momentNewDate.clone().year()
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
[valueMoment]
|
|
239
|
+
);
|
|
240
|
+
const handleKeyDown = useCallback(
|
|
241
|
+
(e) => {
|
|
242
|
+
const key = e.key;
|
|
243
|
+
const allowedKeys = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Backspace", "Delete", "Tab"];
|
|
244
|
+
const isDigit = /^\d$/.test(key);
|
|
245
|
+
const isAllowed = isDigit || allowedKeys.includes(key) || e.ctrlKey || e.metaKey;
|
|
246
|
+
if (!isAllowed) {
|
|
247
|
+
e.preventDefault();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (activeSegment && dataDate.default[activeSegment]) {
|
|
251
|
+
if (isDigit) {
|
|
252
|
+
const digit = key;
|
|
253
|
+
if (activeSegment === DatePickerVariant.DD) {
|
|
254
|
+
const current = input.DD !== null ? input.DD.toString() : "";
|
|
255
|
+
let nextValue;
|
|
256
|
+
if (current.length >= 2) {
|
|
257
|
+
nextValue = digit;
|
|
258
|
+
} else {
|
|
259
|
+
nextValue = current + digit;
|
|
260
|
+
}
|
|
261
|
+
const parsed = Number(nextValue);
|
|
262
|
+
if (parsed > 31 || parsed === 0) return;
|
|
263
|
+
dataDate.default[activeSegment].setValue(parsed);
|
|
264
|
+
if (nextValue.length === 2) {
|
|
265
|
+
dataDate.default[activeSegment].onNext();
|
|
266
|
+
}
|
|
267
|
+
} else if (activeSegment === DatePickerVariant.MM) {
|
|
268
|
+
const currentMonthStr = input.MM !== null ? input.MM.toString() : "";
|
|
269
|
+
let nextValue;
|
|
270
|
+
if (currentMonthStr.length >= 2) {
|
|
271
|
+
nextValue = digit;
|
|
272
|
+
} else {
|
|
273
|
+
const potential = currentMonthStr + digit;
|
|
274
|
+
const potentialParsed = Number(potential);
|
|
275
|
+
if (potentialParsed > 12) {
|
|
276
|
+
nextValue = digit;
|
|
277
|
+
} else {
|
|
278
|
+
nextValue = potential;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const parsed = Number(nextValue);
|
|
282
|
+
if (parsed > 12 || parsed === 0) return;
|
|
283
|
+
dataDate.default[activeSegment].setValue(parsed);
|
|
284
|
+
if (nextValue.length === 2 || nextValue.length === 1 && parsed > 1) {
|
|
285
|
+
dataDate.default[activeSegment].onNext();
|
|
286
|
+
}
|
|
287
|
+
} else if (activeSegment === DatePickerVariant.YYYY) {
|
|
288
|
+
const current = input.YYYY !== null ? input.YYYY.toString() : "";
|
|
289
|
+
let nextValue;
|
|
290
|
+
if (current.length >= 4) {
|
|
291
|
+
if (digit === "0") return;
|
|
292
|
+
nextValue = digit;
|
|
293
|
+
} else {
|
|
294
|
+
nextValue = current + digit;
|
|
295
|
+
}
|
|
296
|
+
const parsed = Number(nextValue);
|
|
297
|
+
dataDate.default[activeSegment].setValue(parsed);
|
|
298
|
+
}
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
e.stopPropagation();
|
|
301
|
+
}
|
|
302
|
+
if (key === "Tab") {
|
|
303
|
+
if (!dataDate.default[activeSegment].isLast) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
dataDate.default[activeSegment].onNext();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (key === "Backspace" || key === "Delete") {
|
|
309
|
+
if (activeSegment === DatePickerVariant.DD) {
|
|
310
|
+
if (input.DD !== null) {
|
|
311
|
+
const current = input.DD.toString();
|
|
312
|
+
if (current.length === 1) {
|
|
313
|
+
dataDate.default[activeSegment].setValue(null);
|
|
314
|
+
} else {
|
|
315
|
+
const newValue = current.slice(0, -1);
|
|
316
|
+
dataDate.default[activeSegment].setValue(Number(newValue));
|
|
317
|
+
}
|
|
318
|
+
} else {
|
|
319
|
+
dataDate.default[activeSegment].onPrev();
|
|
320
|
+
}
|
|
321
|
+
} else if (activeSegment === DatePickerVariant.MM) {
|
|
322
|
+
if (input.MM !== null) {
|
|
323
|
+
const current = input.MM.toString();
|
|
324
|
+
if (current.length === 1) {
|
|
325
|
+
dataDate.default[activeSegment].setValue(null);
|
|
326
|
+
} else {
|
|
327
|
+
const newValue = current.slice(0, -1);
|
|
328
|
+
dataDate.default[activeSegment].setValue(Number(newValue));
|
|
329
|
+
}
|
|
330
|
+
} else {
|
|
331
|
+
dataDate.default[activeSegment].onPrev();
|
|
332
|
+
}
|
|
333
|
+
} else if (activeSegment === DatePickerVariant.YYYY) {
|
|
334
|
+
if (input.YYYY !== null) {
|
|
335
|
+
const current = input.YYYY.toString();
|
|
336
|
+
if (current.length === 1) {
|
|
337
|
+
dataDate.default[activeSegment].setValue(null);
|
|
338
|
+
} else {
|
|
339
|
+
const newValue = current.slice(0, -1);
|
|
340
|
+
dataDate.default[activeSegment].setValue(Number(newValue));
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
dataDate.default[activeSegment].onPrev();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
e.stopPropagation();
|
|
348
|
+
}
|
|
349
|
+
if (key === "ArrowLeft" || key === "ArrowDown") {
|
|
350
|
+
e.preventDefault();
|
|
351
|
+
dataDate.default[activeSegment].onPrev();
|
|
352
|
+
}
|
|
353
|
+
if (key === "ArrowRight" || key === "ArrowUp") {
|
|
354
|
+
e.preventDefault();
|
|
355
|
+
dataDate.default[activeSegment].onNext();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
[activeSegment, input.DD, input.MM, input.YYYY, dataDate.default]
|
|
360
|
+
);
|
|
361
|
+
const onNextMonth = useCallback(() => {
|
|
362
|
+
const newDate = (valueMoment ?? dateDefaultMoment).clone().add(1, "month");
|
|
363
|
+
onChangeDate(newDate.valueOf());
|
|
364
|
+
}, [valueMoment, onChangeDate, dateDefaultMoment]);
|
|
365
|
+
const onPrevMonth = useCallback(() => {
|
|
366
|
+
const newDate = (valueMoment ?? dateDefaultMoment).clone().subtract(1, "month");
|
|
367
|
+
onChangeDate(newDate.valueOf());
|
|
368
|
+
}, [valueMoment, onChangeDate, dateDefaultMoment]);
|
|
369
|
+
useEffect(() => {
|
|
370
|
+
setDateDefaultMoment(moment(props.dateDefault).utc());
|
|
371
|
+
}, [props.dateDefault]);
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
if (isOpen) {
|
|
374
|
+
setActiveSegment(DatePickerVariant.DD);
|
|
375
|
+
} else {
|
|
376
|
+
setActiveSegment(null);
|
|
377
|
+
}
|
|
378
|
+
}, [isOpen]);
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
onChange(valueMoment ? valueMoment.valueOf() : null);
|
|
381
|
+
}, [valueMoment, onChange]);
|
|
382
|
+
useEffect(() => {
|
|
383
|
+
setValueMoment(moment(props.value ?? props.defaultValue).utc());
|
|
384
|
+
}, [props.value, props.defaultValue]);
|
|
385
|
+
useEffect(() => {
|
|
386
|
+
if (input.DD !== null && input.MM !== null && input.YYYY !== null) {
|
|
387
|
+
const day = input.DD ?? NaN;
|
|
388
|
+
const month = input.MM ?? NaN;
|
|
389
|
+
const year = input.YYYY ?? NaN;
|
|
390
|
+
if (!Number.isNaN(day) && !Number.isNaN(month) && !Number.isNaN(year)) {
|
|
391
|
+
const m = moment.utc(`${day}.${month}.${year}`, "D.M.YYYY", true).startOf("day");
|
|
392
|
+
if (m.isValid()) {
|
|
393
|
+
onChangeDate(m.valueOf());
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}, [input.DD, input.MM, input.YYYY, onChangeDate]);
|
|
398
|
+
useEffect(() => {
|
|
399
|
+
if (input.DD !== null && input.MM !== null && input.YYYY !== null) {
|
|
400
|
+
const day = input.DD ?? NaN;
|
|
401
|
+
const month = input.MM ?? NaN;
|
|
402
|
+
const year = input.YYYY ?? NaN;
|
|
403
|
+
if (!Number.isNaN(day) && !Number.isNaN(month) && !Number.isNaN(year)) {
|
|
404
|
+
const m = moment.utc(`${day}.${month}.${year}`, "D.M.YYYY", true).startOf("day");
|
|
405
|
+
if (m.isValid()) {
|
|
406
|
+
setIsError(false);
|
|
407
|
+
} else {
|
|
408
|
+
setIsError(true);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}, [input.DD, input.MM, input.YYYY]);
|
|
413
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
414
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
415
|
+
DateWrapper,
|
|
416
|
+
{
|
|
417
|
+
$size: props.size,
|
|
418
|
+
$genre: props.genre,
|
|
419
|
+
$sx: props.sx,
|
|
420
|
+
$isDisabled: props == null ? void 0 : props.isDisabled,
|
|
421
|
+
$isMinWidth: props == null ? void 0 : props.isMinWidth,
|
|
422
|
+
$radius: sizeRadius,
|
|
423
|
+
$parentListHeight: height,
|
|
424
|
+
tabIndex: -1,
|
|
425
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
426
|
+
DateInputWrapper,
|
|
427
|
+
{
|
|
428
|
+
ref: refReference,
|
|
429
|
+
tabIndex: 0,
|
|
430
|
+
$genre: props.genre,
|
|
431
|
+
$size: props.size,
|
|
432
|
+
$error: isError ? {
|
|
433
|
+
isError: true,
|
|
434
|
+
size: (_a = props == null ? void 0 : props.error) == null ? void 0 : _a.size,
|
|
435
|
+
...props.notValidDate
|
|
436
|
+
} : props.error,
|
|
437
|
+
$isOpen: isOpen,
|
|
438
|
+
onClick: () => {
|
|
439
|
+
open();
|
|
440
|
+
},
|
|
441
|
+
onKeyDown: handleKeyDown,
|
|
442
|
+
onFocus: () => {
|
|
443
|
+
open();
|
|
444
|
+
},
|
|
445
|
+
children: !isHasValue && props.labelPlaceholder && !isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
446
|
+
Typography,
|
|
447
|
+
{
|
|
448
|
+
sx: { default: { size: 16, line: 1, isNoUserSelect: true } },
|
|
449
|
+
sxStandard: (theme2) => ({
|
|
450
|
+
default: {
|
|
451
|
+
color: theme2.colors.input[props.genre].color.placeholder
|
|
452
|
+
}
|
|
453
|
+
}),
|
|
454
|
+
children: props.labelPlaceholder
|
|
455
|
+
}
|
|
456
|
+
) : dataDate.sort.map((date, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
|
|
457
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
458
|
+
DateInput,
|
|
459
|
+
{
|
|
460
|
+
$isHaveValue: !!date.value,
|
|
461
|
+
$isActive: activeSegment === date.type,
|
|
462
|
+
$genre: props.genre,
|
|
463
|
+
$size: props.size,
|
|
464
|
+
onClick: () => date.setActive(),
|
|
465
|
+
children: date.value != null ? String(date.value).padStart(date.type === DatePickerVariant.YYYY ? 1 : 2, "0") : date.placeholder || ""
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
index !== dataDate.sort.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { width: "4px", pointerEvents: "none", textAlign: "center" }, children: "." })
|
|
469
|
+
] }, date.type))
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
),
|
|
474
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
475
|
+
Popover,
|
|
476
|
+
{
|
|
477
|
+
sx: (theme2) => ({
|
|
478
|
+
default: {
|
|
479
|
+
background: theme2.colors.input[props.genre].background.rest,
|
|
480
|
+
border: `solid 1px ${theme2.colors.input[props.genre].border.rest}`
|
|
481
|
+
}
|
|
482
|
+
}),
|
|
483
|
+
size: props.size,
|
|
484
|
+
genre: props.genre,
|
|
485
|
+
isOpen,
|
|
486
|
+
isShowAlwaysOutline: true,
|
|
487
|
+
floatingStyles,
|
|
488
|
+
ref: refFloating,
|
|
489
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DateDropdownList, { $isInputEffect: props.isInputEffect, $genre: props.genre, $size: props.size, children: [
|
|
490
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
491
|
+
Stack,
|
|
492
|
+
{
|
|
493
|
+
sx: {
|
|
494
|
+
default: {
|
|
495
|
+
justifyContent: "space-between",
|
|
496
|
+
alignItems: "center"
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
children: [
|
|
500
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
501
|
+
Button,
|
|
502
|
+
{
|
|
503
|
+
type: "button",
|
|
504
|
+
isRadius: true,
|
|
505
|
+
icons: [
|
|
506
|
+
{
|
|
507
|
+
name: "Arrow2",
|
|
508
|
+
type: "id",
|
|
509
|
+
turn: 90
|
|
510
|
+
}
|
|
511
|
+
],
|
|
512
|
+
isWidthAsHeight: true,
|
|
513
|
+
genre: props.genre,
|
|
514
|
+
size: "small",
|
|
515
|
+
onClick: () => !isBlockPrevMonth && onPrevMonth(),
|
|
516
|
+
isHidden: isBlockPrevMonth
|
|
517
|
+
}
|
|
518
|
+
),
|
|
519
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { sx: { default: { gap: "8px" } }, children: [
|
|
520
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
521
|
+
SelectMonth,
|
|
522
|
+
{
|
|
523
|
+
monthsLocale: props.locale.months,
|
|
524
|
+
genre: props.genre,
|
|
525
|
+
size: "small",
|
|
526
|
+
value: (valueMoment ?? dateDefaultMoment).clone().startOf("month").utc().valueOf(),
|
|
527
|
+
isOnClickOptionClose: true,
|
|
528
|
+
isStayValueAfterSelect: true,
|
|
529
|
+
isOnlyColorInSelectListOption: true,
|
|
530
|
+
isCenter: true,
|
|
531
|
+
isShortLabel: true,
|
|
532
|
+
refFloating: refSelectMonth,
|
|
533
|
+
onChange: (timestamp) => {
|
|
534
|
+
if (timestamp) onChangeDate(timestamp);
|
|
535
|
+
},
|
|
536
|
+
dateMin: props.dateMin,
|
|
537
|
+
dateMax: props.dateMax,
|
|
538
|
+
sx: { default: { width: "60px" } }
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
542
|
+
SelectYear,
|
|
543
|
+
{
|
|
544
|
+
genre: props.genre,
|
|
545
|
+
size: "small",
|
|
546
|
+
refFloating: refSelectYear,
|
|
547
|
+
value: (valueMoment ?? dateDefaultMoment).clone().startOf("year").utc().valueOf(),
|
|
548
|
+
onChange: (timestamp) => {
|
|
549
|
+
if (timestamp) onChangeDate(timestamp);
|
|
550
|
+
},
|
|
551
|
+
isOnClickOptionClose: true,
|
|
552
|
+
isStayValueAfterSelect: true,
|
|
553
|
+
isOnlyColorInSelectListOption: true,
|
|
554
|
+
isCenter: true,
|
|
555
|
+
dateMin: props.dateMin,
|
|
556
|
+
dateMax: props.dateMax,
|
|
557
|
+
sx: { default: { width: "60px" } }
|
|
558
|
+
}
|
|
559
|
+
)
|
|
560
|
+
] }),
|
|
561
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
562
|
+
Button,
|
|
563
|
+
{
|
|
564
|
+
type: "button",
|
|
565
|
+
onClick: () => !isBlockNextMonth && onNextMonth(),
|
|
566
|
+
isWidthAsHeight: true,
|
|
567
|
+
isRadius: true,
|
|
568
|
+
icons: [
|
|
569
|
+
{
|
|
570
|
+
name: "Arrow2",
|
|
571
|
+
type: "id",
|
|
572
|
+
turn: -90
|
|
573
|
+
}
|
|
574
|
+
],
|
|
575
|
+
genre: props.genre,
|
|
576
|
+
size: "small",
|
|
577
|
+
isHidden: isBlockNextMonth
|
|
578
|
+
}
|
|
579
|
+
)
|
|
580
|
+
]
|
|
581
|
+
}
|
|
582
|
+
),
|
|
583
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DateDropdownDays, { $rows: rows, children: [
|
|
584
|
+
daysInWeek.map((e, index) => {
|
|
585
|
+
var _a2;
|
|
586
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
587
|
+
DateDropdownDayOfWeek,
|
|
588
|
+
{
|
|
589
|
+
tabIndex: -1,
|
|
590
|
+
type: "button",
|
|
591
|
+
$isToday: false,
|
|
592
|
+
$isWeekend: false,
|
|
593
|
+
$genre: props.genre,
|
|
594
|
+
$size: props.size,
|
|
595
|
+
$row: ((_a2 = daysInMonth[0]) == null ? void 0 : _a2.weekOfMonth) - 1,
|
|
596
|
+
$column: index + 1,
|
|
597
|
+
children: e.label
|
|
598
|
+
},
|
|
599
|
+
`${e.label}-${index}`
|
|
600
|
+
);
|
|
601
|
+
}),
|
|
602
|
+
daysInMonth.map((day) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
603
|
+
DateDropdownDay,
|
|
604
|
+
{
|
|
605
|
+
type: "button",
|
|
606
|
+
$isDisabled: day.isDisabled,
|
|
607
|
+
$genre: props.genre,
|
|
608
|
+
$size: props.size,
|
|
609
|
+
$row: (day == null ? void 0 : day.weekOfMonth) + 1,
|
|
610
|
+
$column: day.dayOfWeek,
|
|
611
|
+
onClick: () => {
|
|
612
|
+
if (!day.isDisabled) {
|
|
613
|
+
onChangeDate(day.value);
|
|
614
|
+
if (props.isOnClickClose) {
|
|
615
|
+
close();
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
tabIndex: day.isDisabled ? -1 : 0,
|
|
620
|
+
$isToday: day.isToday,
|
|
621
|
+
$isWeekend: day.isWeekend,
|
|
622
|
+
$isChoice: day.value === (valueMoment == null ? void 0 : valueMoment.valueOf()),
|
|
623
|
+
$isCurrentMonth: day.isCurrentMonth,
|
|
624
|
+
children: [
|
|
625
|
+
!day.isDisabled && /* @__PURE__ */ jsxRuntimeExports.jsx(Ripple, { color: theme.colors.date[props.genre].color.rest }),
|
|
626
|
+
day.labelNumber
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
day.value
|
|
630
|
+
))
|
|
631
|
+
] })
|
|
632
|
+
] })
|
|
633
|
+
}
|
|
634
|
+
),
|
|
635
|
+
isError || (props == null ? void 0 : props.error) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
636
|
+
ErrorMessage,
|
|
637
|
+
{
|
|
638
|
+
...isError ? {
|
|
639
|
+
isError: true,
|
|
640
|
+
size: (_b = props == null ? void 0 : props.error) == null ? void 0 : _b.size,
|
|
641
|
+
...props.notValidDate
|
|
642
|
+
} : props.error,
|
|
643
|
+
size: ((_c = props == null ? void 0 : props.error) == null ? void 0 : _c.size) ?? props.size
|
|
644
|
+
}
|
|
645
|
+
) : null
|
|
646
|
+
] });
|
|
647
|
+
};
|
|
648
|
+
const DateWrapper = styled.div`
|
|
649
|
+
width: 100%;
|
|
650
|
+
position: relative;
|
|
651
|
+
height: fit-content;
|
|
652
|
+
${(props) => props.$isMinWidth && css`
|
|
653
|
+
width: min-content;
|
|
654
|
+
`}
|
|
655
|
+
${addSX};
|
|
656
|
+
${addNiceNumber};
|
|
657
|
+
`;
|
|
658
|
+
const DateDropdownListParent = styled(motion.div)`
|
|
659
|
+
${addRemoveScrollbar};
|
|
660
|
+
`;
|
|
661
|
+
const DateDropdownList = styled.div`
|
|
662
|
+
position: relative;
|
|
663
|
+
display: flex;
|
|
664
|
+
flex-direction: column;
|
|
665
|
+
width: 100%;
|
|
666
|
+
padding-top: 6px;
|
|
667
|
+
transform: translateZ(0);
|
|
668
|
+
justify-content: flex-start;
|
|
669
|
+
gap: 10px;
|
|
670
|
+
${addInputIsInputEffect};
|
|
671
|
+
`;
|
|
672
|
+
const DateDropdownDays = styled.div`
|
|
673
|
+
display: grid;
|
|
674
|
+
column-gap: normal;
|
|
675
|
+
row-gap: normal;
|
|
676
|
+
gap: 6px;
|
|
677
|
+
grid-template-columns: repeat(7, 28px);
|
|
678
|
+
grid-template-rows: repeat(${(props) => props.$rows}, 28px);
|
|
679
|
+
justify-content: space-between;
|
|
680
|
+
`;
|
|
681
|
+
const addDateDropdownDaySize = css`
|
|
682
|
+
${(props) => props.$size && css`
|
|
683
|
+
border-radius: ${KEY_SIZE_DATA[props.$size].radius}px;
|
|
684
|
+
${(params) => getFontSizeStyles(12, 700, params.theme.font.family)};
|
|
685
|
+
`};
|
|
686
|
+
position: relative;
|
|
687
|
+
overflow: hidden;
|
|
688
|
+
isolation: isolate;
|
|
689
|
+
user-select: none;
|
|
690
|
+
background: ${(props) => props.theme.colors.date[props.$genre].background.rest};
|
|
691
|
+
border-color: ${(props) => props.theme.colors.date[props.$genre].border.rest};
|
|
692
|
+
color: ${(props) => props.theme.colors.date[props.$genre].color.rest};
|
|
693
|
+
border: 1px solid transparent;
|
|
694
|
+
grid-row: ${(props) => props.$row};
|
|
695
|
+
grid-column: ${(props) => props.$column};
|
|
696
|
+
display: flex;
|
|
697
|
+
align-items: center;
|
|
698
|
+
justify-content: center;
|
|
699
|
+
width: 100%;
|
|
700
|
+
height: 100%;
|
|
701
|
+
cursor: pointer;
|
|
702
|
+
&:hover {
|
|
703
|
+
${(props) => !props.$isDisabled && css`
|
|
704
|
+
background: ${props.theme.colors.date[props.$genre].background.hover};
|
|
705
|
+
border-color: ${props.theme.colors.date[props.$genre].border.hover};
|
|
706
|
+
color: ${props.theme.colors.date[props.$genre].color.hover};
|
|
707
|
+
`}
|
|
708
|
+
}
|
|
709
|
+
${addTransition};
|
|
710
|
+
|
|
711
|
+
${(props) => props.$isWeekend && css`
|
|
712
|
+
background: ${props.theme.colors.date[props.$genre].background.weekend};
|
|
713
|
+
border-color: ${props.theme.colors.date[props.$genre].border.weekend};
|
|
714
|
+
color: ${props.theme.colors.date[props.$genre].color.weekend};
|
|
715
|
+
`}
|
|
716
|
+
${(props) => props.$isToday && css`
|
|
717
|
+
background: ${props.theme.colors.date[props.$genre].background.today};
|
|
718
|
+
border-color: ${props.theme.colors.date[props.$genre].border.today};
|
|
719
|
+
color: ${props.theme.colors.date[props.$genre].color.today};
|
|
720
|
+
`}
|
|
721
|
+
${(props) => props.$isChoice && css`
|
|
722
|
+
background: ${props.theme.colors.date[props.$genre].background.choice};
|
|
723
|
+
border-color: ${props.theme.colors.date[props.$genre].border.choice};
|
|
724
|
+
color: ${props.theme.colors.date[props.$genre].color.choice};
|
|
725
|
+
`}
|
|
726
|
+
${(props) => props.$isDisabled && css`
|
|
727
|
+
background: ${props.theme.colors.date[props.$genre].background.weekend};
|
|
728
|
+
border-color: ${props.theme.colors.date[props.$genre].border.weekend};
|
|
729
|
+
color: ${props.theme.colors.date[props.$genre].color.weekend};
|
|
730
|
+
opacity: 0.5;
|
|
731
|
+
`}
|
|
732
|
+
${(props) => !props.$isCurrentMonth && css`
|
|
733
|
+
opacity: 0.5;
|
|
734
|
+
`}
|
|
735
|
+
${(params) => getFontSizeStyles(12, 700, params.theme.font.family)};
|
|
736
|
+
|
|
737
|
+
${addOutline};
|
|
738
|
+
`;
|
|
739
|
+
const DateDropdownDay = styled.button`
|
|
740
|
+
${addDateDropdownDaySize}
|
|
741
|
+
`;
|
|
742
|
+
const DateDropdownDayOfWeek = styled.button`
|
|
743
|
+
${addDateDropdownDaySize}
|
|
744
|
+
opacity: 1;
|
|
745
|
+
background-color: transparent;
|
|
746
|
+
`;
|
|
747
|
+
const addDateInputGenre = css`
|
|
748
|
+
background-color: ${(props) => props.$isActive ? props.theme.palette.black10 : "transparent"};
|
|
749
|
+
|
|
750
|
+
${(props) => getFontSizeStyles(16, props.$isBold ? 500 : 400, props.theme.font.family, props.theme.font.lineHeight)};
|
|
751
|
+
${(props) => props.$isHaveValue ? css`
|
|
752
|
+
color: ${props.theme.colors.input[props.$genre].color.rest};
|
|
753
|
+
&:focus-visible {
|
|
754
|
+
color: ${props.theme.colors.input[props.$genre].color.rest};
|
|
755
|
+
}
|
|
756
|
+
` : css`
|
|
757
|
+
color: ${props.theme.colors.input[props.$genre].color.placeholder};
|
|
758
|
+
`};
|
|
759
|
+
`;
|
|
760
|
+
const addDateInputSize = css`
|
|
761
|
+
border-radius: 4px;
|
|
762
|
+
padding: 2px;
|
|
763
|
+
min-width: 10px;
|
|
764
|
+
`;
|
|
765
|
+
const DateInput = styled.div`
|
|
766
|
+
text-align: center;
|
|
767
|
+
resize: none;
|
|
768
|
+
overflow: hidden;
|
|
769
|
+
border: 0px solid;
|
|
770
|
+
background: transparent;
|
|
771
|
+
margin: 0px !important;
|
|
772
|
+
white-space: nowrap;
|
|
773
|
+
${addDateInputSize};
|
|
774
|
+
${addDateInputGenre};
|
|
775
|
+
${addRemoveOutline};
|
|
776
|
+
`;
|
|
777
|
+
const addDateInputWrapperGenre = css`
|
|
778
|
+
${(props) => css`
|
|
779
|
+
background: ${props.theme.colors.input[props.$genre].background.rest};
|
|
780
|
+
border-color: ${props.theme.colors.input[props.$genre].border.rest};
|
|
781
|
+
color: ${props.theme.colors.input[props.$genre].color.rest};
|
|
782
|
+
outline: 2px solid transparent;
|
|
783
|
+
outline-offset: 1px;
|
|
784
|
+
&:hover {
|
|
785
|
+
background: ${props.theme.colors.input[props.$genre].background.hover};
|
|
786
|
+
border-color: ${props.theme.colors.input[props.$genre].border.hover};
|
|
787
|
+
color: ${props.theme.colors.input[props.$genre].color.hover};
|
|
788
|
+
}
|
|
789
|
+
${props.$isOpen && css`
|
|
790
|
+
background: ${props.theme.colors.input[props.$genre].background.rest};
|
|
791
|
+
border-color: ${props.theme.colors.input[props.$genre].border.rest};
|
|
792
|
+
color: ${props.theme.colors.input[props.$genre].color.rest};
|
|
793
|
+
outline: 2px solid ${(props2) => props2.theme.states.focus};
|
|
794
|
+
`}
|
|
795
|
+
`};
|
|
796
|
+
`;
|
|
797
|
+
const addDateInputWrapperSize = css`
|
|
798
|
+
${(props) => css`
|
|
799
|
+
padding: 0px ${KEY_SIZE_DATA[props.$size].padding}px;
|
|
800
|
+
height: ${KEY_SIZE_DATA[props.$size].height}px;
|
|
801
|
+
min-height: ${KEY_SIZE_DATA[props.$size].height}px;
|
|
802
|
+
max-height: ${KEY_SIZE_DATA[props.$size].height}px;
|
|
803
|
+
border-radius: ${KEY_SIZE_DATA[props.$size].radius}px;
|
|
804
|
+
`}
|
|
805
|
+
`;
|
|
806
|
+
const DateInputWrapper = styled.div`
|
|
807
|
+
resize: none;
|
|
808
|
+
overflow: hidden;
|
|
809
|
+
width: 100%;
|
|
810
|
+
border: 1px solid transparent;
|
|
811
|
+
|
|
812
|
+
white-space: nowrap;
|
|
813
|
+
|
|
814
|
+
display: flex;
|
|
815
|
+
align-items: center;
|
|
816
|
+
gap: 0px;
|
|
817
|
+
|
|
818
|
+
${addDateInputWrapperSize};
|
|
819
|
+
${addDateInputWrapperGenre};
|
|
820
|
+
${addTransition};
|
|
821
|
+
${addError};
|
|
822
|
+
`;
|
|
823
|
+
var DatePickerVariant = /* @__PURE__ */ ((DatePickerVariant2) => {
|
|
824
|
+
DatePickerVariant2["DD"] = "DD";
|
|
825
|
+
DatePickerVariant2["MM"] = "MM";
|
|
826
|
+
DatePickerVariant2["YYYY"] = "YYYY";
|
|
827
|
+
return DatePickerVariant2;
|
|
828
|
+
})(DatePickerVariant || {});
|
|
829
|
+
export {
|
|
830
|
+
DatePicker as D,
|
|
831
|
+
DateWrapper as a,
|
|
832
|
+
DateDropdownListParent as b,
|
|
833
|
+
DateDropdownList as c,
|
|
834
|
+
DateDropdownDays as d,
|
|
835
|
+
addDateDropdownDaySize as e,
|
|
836
|
+
DateDropdownDay as f,
|
|
837
|
+
DateDropdownDayOfWeek as g,
|
|
838
|
+
DateInput as h,
|
|
839
|
+
addDateInputWrapperSize as i,
|
|
840
|
+
DateInputWrapper as j,
|
|
841
|
+
DatePickerVariant as k
|
|
842
|
+
};
|
|
843
|
+
//# sourceMappingURL=component.types-CqvwcIsz.js.map
|