@jenesei-software/jenesei-kit-react 1.3.23 → 1.3.24

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.
Files changed (148) hide show
  1. package/build/area-preview.cjs.js +1 -1
  2. package/build/area-preview.es.js +1 -1
  3. package/build/area-skeleton.cjs.js +1 -1
  4. package/build/area-skeleton.es.js +1 -1
  5. package/build/build-info.txt +3 -3
  6. package/build/{component-JIJwPwrc.cjs → component-7NBd7NIb.cjs} +2 -2
  7. package/build/{component-JIJwPwrc.cjs.map → component-7NBd7NIb.cjs.map} +1 -1
  8. package/build/{component-JQMDepCj.js → component-BCV2luzE.js} +2 -2
  9. package/build/{component-JQMDepCj.js.map → component-BCV2luzE.js.map} +1 -1
  10. package/build/{component-DLEbIbn9.js → component-BI5rC-2m.js} +3 -3
  11. package/build/{component-DLEbIbn9.js.map → component-BI5rC-2m.js.map} +1 -1
  12. package/build/component-BbZXNg5P.cjs +2 -0
  13. package/build/component-BbZXNg5P.cjs.map +1 -0
  14. package/build/{component-BF_RC9Ej.cjs → component-BzxsZZwo.cjs} +2 -2
  15. package/build/{component-BF_RC9Ej.cjs.map → component-BzxsZZwo.cjs.map} +1 -1
  16. package/build/{component-BnJWTOR7.js → component-C0wHqqsE.js} +4 -4
  17. package/build/{component-BnJWTOR7.js.map → component-C0wHqqsE.js.map} +1 -1
  18. package/build/{component-BXCFqCtK.cjs → component-CC8gkK9W.cjs} +2 -2
  19. package/build/{component-BXCFqCtK.cjs.map → component-CC8gkK9W.cjs.map} +1 -1
  20. package/build/{component-C7Nffvkz.js → component-CGXjLqiU.js} +2 -2
  21. package/build/{component-C7Nffvkz.js.map → component-CGXjLqiU.js.map} +1 -1
  22. package/build/{component-D4hkx75Z.js → component-CL9kCwRv.js} +2 -2
  23. package/build/{component-D4hkx75Z.js.map → component-CL9kCwRv.js.map} +1 -1
  24. package/build/{component-DHj3MVyO.js → component-CUg8vGc0.js} +6 -7
  25. package/build/component-CUg8vGc0.js.map +1 -0
  26. package/build/{component-CaJK3Oq8.js → component-ChwxoVt7.js} +2 -2
  27. package/build/{component-CaJK3Oq8.js.map → component-ChwxoVt7.js.map} +1 -1
  28. package/build/{component-C0Cy_U1j.js → component-CsuyjLrN.js} +3 -3
  29. package/build/{component-C0Cy_U1j.js.map → component-CsuyjLrN.js.map} +1 -1
  30. package/build/{component-BXhibaBj.cjs → component-DC3s_be7.cjs} +2 -2
  31. package/build/{component-BXhibaBj.cjs.map → component-DC3s_be7.cjs.map} +1 -1
  32. package/build/component-DTotEm4D.cjs +2 -0
  33. package/build/component-DTotEm4D.cjs.map +1 -0
  34. package/build/{component-CDa4aHfO.cjs → component-DXRFP4Ym.cjs} +2 -2
  35. package/build/{component-CDa4aHfO.cjs.map → component-DXRFP4Ym.cjs.map} +1 -1
  36. package/build/{component-GiB9SJbH.cjs → component-DYsviH75.cjs} +2 -2
  37. package/build/{component-GiB9SJbH.cjs.map → component-DYsviH75.cjs.map} +1 -1
  38. package/build/component-DgZATMAS.cjs +2 -0
  39. package/build/component-DgZATMAS.cjs.map +1 -0
  40. package/build/{component-ySx7l0Xg.cjs → component-Ds4G9JaH.cjs} +2 -2
  41. package/build/{component-ySx7l0Xg.cjs.map → component-Ds4G9JaH.cjs.map} +1 -1
  42. package/build/{component-31qgF6V7.js → component-DvkJKhCA.js} +13 -15
  43. package/build/component-DvkJKhCA.js.map +1 -0
  44. package/build/{component-Bv6UuRlj.cjs → component-Ei1bxdq2.cjs} +2 -2
  45. package/build/{component-Bv6UuRlj.cjs.map → component-Ei1bxdq2.cjs.map} +1 -1
  46. package/build/{component-DwFwB6Zz.js → component-P6uOD564.js} +2 -2
  47. package/build/{component-DwFwB6Zz.js.map → component-P6uOD564.js.map} +1 -1
  48. package/build/component-accordion.cjs.js +1 -1
  49. package/build/component-accordion.es.js +2 -2
  50. package/build/component-button-group.cjs.js +1 -1
  51. package/build/component-button-group.es.js +2 -2
  52. package/build/component-button.cjs.js +1 -1
  53. package/build/component-button.es.js +1 -1
  54. package/build/component-checkbox-group.cjs.js +1 -1
  55. package/build/component-checkbox-group.es.js +2 -2
  56. package/build/component-checkbox.cjs.js +1 -1
  57. package/build/component-checkbox.es.js +2 -2
  58. package/build/component-date-picker.cjs.js +1 -1
  59. package/build/component-date-picker.es.js +2 -2
  60. package/build/component-icon.cjs.js +1 -1
  61. package/build/component-icon.es.js +1 -1
  62. package/build/component-image-button.cjs.js +1 -1
  63. package/build/component-image-button.es.js +1 -1
  64. package/build/component-image-select.cjs.js +1 -1
  65. package/build/component-image-select.es.js +2 -2
  66. package/build/component-image-slider.cjs.js +1 -1
  67. package/build/component-image-slider.es.js +2 -2
  68. package/build/component-image.cjs.js +1 -1
  69. package/build/component-image.es.js +2 -2
  70. package/build/component-input-otp.cjs.js +1 -1
  71. package/build/component-input-otp.es.js +2 -2
  72. package/build/component-input.cjs.js +1 -1
  73. package/build/component-input.es.js +2 -2
  74. package/build/component-map.cjs.js +1 -1
  75. package/build/component-map.es.js +2 -2
  76. package/build/component-pagination.cjs.js +1 -1
  77. package/build/component-pagination.es.js +1 -1
  78. package/build/component-range.cjs.js +1 -1
  79. package/build/component-range.es.js +2 -2
  80. package/build/component-select.cjs.js +1 -1
  81. package/build/component-select.es.js +1 -1
  82. package/build/component-textarea.cjs.js +1 -1
  83. package/build/component-textarea.es.js +1 -1
  84. package/build/component-toggle.cjs.js +1 -1
  85. package/build/component-toggle.es.js +2 -2
  86. package/build/component-tooltip.cjs.js +1 -1
  87. package/build/component-tooltip.es.js +1 -1
  88. package/build/component-typography.cjs.js +1 -1
  89. package/build/component-typography.es.js +1 -1
  90. package/build/{component-RXfJR8yQ.js → component-zim9WtKE.js} +9 -10
  91. package/build/component-zim9WtKE.js.map +1 -0
  92. package/build/{component.components-DzoKT5j9.cjs → component.components-DUGaqWm1.cjs} +2 -2
  93. package/build/{component.components-DzoKT5j9.cjs.map → component.components-DUGaqWm1.cjs.map} +1 -1
  94. package/build/{component.components-DKDMKKNb.js → component.components-DgG3v6IP.js} +2 -2
  95. package/build/{component.components-DKDMKKNb.js.map → component.components-DgG3v6IP.js.map} +1 -1
  96. package/build/{component.constants-BMz7bhlw.js → component.constants-Bg4nPldh.js} +2 -2
  97. package/build/{component.constants-BMz7bhlw.js.map → component.constants-Bg4nPldh.js.map} +1 -1
  98. package/build/{component.constants-Bgm_xB87.js → component.constants-C_datTCs.js} +3 -3
  99. package/build/{component.constants-Bgm_xB87.js.map → component.constants-C_datTCs.js.map} +1 -1
  100. package/build/{component.constants-C0oGZ1iR.cjs → component.constants-DuIk1IUA.cjs} +2 -2
  101. package/build/{component.constants-C0oGZ1iR.cjs.map → component.constants-DuIk1IUA.cjs.map} +1 -1
  102. package/build/{component.constants-DZyqQi6L.cjs → component.constants-VFLYS55V.cjs} +2 -2
  103. package/build/{component.constants-DZyqQi6L.cjs.map → component.constants-VFLYS55V.cjs.map} +1 -1
  104. package/build/{component.types-D_tW7ArD.js → component.types-Da4YfhvS.js} +231 -274
  105. package/build/component.types-Da4YfhvS.js.map +1 -0
  106. package/build/component.types-Du4CzNpi.cjs +2 -0
  107. package/build/component.types-Du4CzNpi.cjs.map +1 -0
  108. package/build/consts.cjs.js +1 -1
  109. package/build/consts.es.js +1 -1
  110. package/build/context-app.cjs.js +1 -1
  111. package/build/context-app.es.js +2 -2
  112. package/build/context-sonner.cjs.js +1 -1
  113. package/build/context-sonner.es.js +2 -2
  114. package/build/{context.constants-wfD246Ww.cjs → context.constants-B9vCuOqK.cjs} +4 -4
  115. package/build/{context.constants-wfD246Ww.cjs.map → context.constants-B9vCuOqK.cjs.map} +1 -1
  116. package/build/{context.constants-AVloP24q.js → context.constants-rTgzRM3c.js} +12 -15
  117. package/build/{context.constants-AVloP24q.js.map → context.constants-rTgzRM3c.js.map} +1 -1
  118. package/build/{context.hooks-CXSsHfiI.cjs → context.hooks-6lCyn9Dp.cjs} +2 -2
  119. package/build/{context.hooks-CXSsHfiI.cjs.map → context.hooks-6lCyn9Dp.cjs.map} +1 -1
  120. package/build/{context.hooks-BsMIDkb3.js → context.hooks-BHFgUgBF.js} +2 -2
  121. package/build/{context.hooks-BsMIDkb3.js.map → context.hooks-BHFgUgBF.js.map} +1 -1
  122. package/build/{context.hooks-L-OO9FIg.cjs → context.hooks-C8qSZOb4.cjs} +2 -2
  123. package/build/{context.hooks-L-OO9FIg.cjs.map → context.hooks-C8qSZOb4.cjs.map} +1 -1
  124. package/build/{context.hooks-CQXyg8Md.js → context.hooks-D4-JZ2rN.js} +2 -2
  125. package/build/{context.hooks-CQXyg8Md.js.map → context.hooks-D4-JZ2rN.js.map} +1 -1
  126. package/build/index.cjs.js +1 -1
  127. package/build/index.es.js +18 -18
  128. package/build/style-error.cjs.js +1 -1
  129. package/build/style-error.es.js +1 -1
  130. package/build/style-theme.cjs.js +1 -1
  131. package/build/style-theme.es.js +1 -1
  132. package/build/{use-fcNoM5UL.cjs → use-C3yxmiPP.cjs} +2 -2
  133. package/build/{use-fcNoM5UL.cjs.map → use-C3yxmiPP.cjs.map} +1 -1
  134. package/build/{use-B4ELG6B3.js → use-DP84XchN.js} +3 -3
  135. package/build/{use-B4ELG6B3.js.map → use-DP84XchN.js.map} +1 -1
  136. package/package.json +1 -1
  137. package/build/component-1kuvOkUa.cjs +0 -2
  138. package/build/component-1kuvOkUa.cjs.map +0 -1
  139. package/build/component-31qgF6V7.js.map +0 -1
  140. package/build/component-CYmkHAmE.cjs +0 -2
  141. package/build/component-CYmkHAmE.cjs.map +0 -1
  142. package/build/component-DHj3MVyO.js.map +0 -1
  143. package/build/component-RXfJR8yQ.js.map +0 -1
  144. package/build/component-jH7YXK4X.cjs +0 -2
  145. package/build/component-jH7YXK4X.cjs.map +0 -1
  146. package/build/component.types-D_tW7ArD.js.map +0 -1
  147. package/build/component.types-ZmH2V3qe.cjs +0 -2
  148. package/build/component.types-ZmH2V3qe.cjs.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import { j as jsxRuntimeExports } from "./jsx-runtime-BrDlu8eK.js";
2
- import { bt as KEY_SIZE_DATA, bC as usePopover, D as DateWrapper, z as DateInputWrapper, aR as Typography, x as DateInput, F as DateInputButton, bD as Popover, s as DateDropdownList, B as Button, ao as SelectMonth, aq as SelectYear, t as DateDropdownDays, w as DateDropdownDayOfWeek, v as DateDropdownDay, bp as ErrorMessage } from "./context.constants-AVloP24q.js";
2
+ import { bt as KEY_SIZE_DATA, bC as usePopover, D as DateWrapper, z as DateInputWrapper, aR as Typography, x as DateInput, F as DateInputButton, bD as Popover, s as DateDropdownList, B as Button, ao as SelectMonth, aq as SelectYear, t as DateDropdownDays, w as DateDropdownDayOfWeek, v as DateDropdownDay, bp as ErrorMessage } from "./context.constants-rTgzRM3c.js";
3
3
  import "./component.styles-B0L4jbOO.js";
4
4
  import { R as Ripple } from "./component-DHM9pbab.js";
5
5
  import { b as Stack } from "./component-DEZX8aBs.js";
6
6
  import moment from "moment";
7
- import { useState, useMemo, useCallback, useRef, useEffect, Fragment } from "react";
7
+ import { useState, useRef, useEffect, useMemo, useCallback, Fragment } from "react";
8
8
  import { useTheme } from "styled-components";
9
9
  function countSevens(number) {
10
10
  const divisor = 7;
@@ -19,18 +19,22 @@ const DatePicker = (props) => {
19
19
  const [valueMoment, setValueMoment] = useState(null);
20
20
  const [dateDefaultMoment, setDateDefaultMoment] = useState(moment(props.dateDefault).utc());
21
21
  const [input, setInput] = useState({
22
- [DatePickerVariant.DD]: null,
23
- [DatePickerVariant.MM]: null,
24
- [DatePickerVariant.YYYY]: null
22
+ [DatePickerVariant.DD]: "",
23
+ [DatePickerVariant.MM]: "",
24
+ [DatePickerVariant.YYYY]: ""
25
25
  });
26
+ const refInputValue = useRef(input);
27
+ useEffect(() => {
28
+ refInputValue.current = input;
29
+ }, [input]);
26
30
  const isHasInput = useMemo(() => {
27
- return input[DatePickerVariant.DD] !== null || input[DatePickerVariant.MM] !== null || input[DatePickerVariant.YYYY] !== null;
31
+ return input[DatePickerVariant.DD] !== "" || input[DatePickerVariant.MM] !== "" || input[DatePickerVariant.YYYY] !== "";
28
32
  }, [input]);
29
33
  const onClearInput = useCallback(() => {
30
34
  setInput({
31
- [DatePickerVariant.DD]: null,
32
- [DatePickerVariant.MM]: null,
33
- [DatePickerVariant.YYYY]: null
35
+ [DatePickerVariant.DD]: "",
36
+ [DatePickerVariant.MM]: "",
37
+ [DatePickerVariant.YYYY]: ""
34
38
  });
35
39
  }, []);
36
40
  const [activeSegment, setActiveSegment] = useState(null);
@@ -59,66 +63,51 @@ const DatePicker = (props) => {
59
63
  },
60
64
  [mode]
61
65
  );
62
- const dataDate = useMemo(() => {
63
- const result = {
64
- MM: {
65
- nextSegment: getNextSegment(DatePickerVariant.MM),
66
- preSegment: getPrevSegment(DatePickerVariant.MM),
67
- onNext: () => setActiveSegment(getNextSegment(DatePickerVariant.MM)),
68
- onPrev: () => setActiveSegment(getPrevSegment(DatePickerVariant.MM)),
69
- isLast: mode[mode.length - 1] === DatePickerVariant.MM,
70
- isFirst: mode[0] === DatePickerVariant.MM,
71
- type: DatePickerVariant.MM,
72
- value: input.MM,
73
- setValue: (value) => setInput((prevValue) => ({ ...prevValue, [DatePickerVariant.MM]: value })),
74
- setActive: () => setActiveSegment(DatePickerVariant.MM),
75
- placeholder: props.locale.inputs.month
76
- },
77
- DD: {
78
- nextSegment: getNextSegment(DatePickerVariant.DD),
79
- preSegment: getPrevSegment(DatePickerVariant.DD),
80
- isLast: mode[mode.length - 1] === DatePickerVariant.DD,
81
- isFirst: mode[0] === DatePickerVariant.DD,
82
- onNext: () => setActiveSegment(getNextSegment(DatePickerVariant.DD)),
83
- onPrev: () => setActiveSegment(getPrevSegment(DatePickerVariant.DD)),
84
- type: DatePickerVariant.DD,
85
- value: input.DD,
86
- setValue: (value) => setInput((prevValue) => ({ ...prevValue, [DatePickerVariant.DD]: value })),
87
- setActive: () => setActiveSegment(DatePickerVariant.DD),
88
- placeholder: props.locale.inputs.day
89
- },
90
- YYYY: {
91
- nextSegment: getNextSegment(DatePickerVariant.YYYY),
92
- preSegment: getPrevSegment(DatePickerVariant.YYYY),
93
- isLast: mode[mode.length - 1] === DatePickerVariant.YYYY,
94
- isFirst: mode[0] === DatePickerVariant.YYYY,
95
- onNext: () => setActiveSegment(getNextSegment(DatePickerVariant.YYYY)),
96
- onPrev: () => setActiveSegment(getPrevSegment(DatePickerVariant.YYYY)),
97
- type: DatePickerVariant.YYYY,
98
- value: input.YYYY,
99
- setValue: (value) => setInput((prevValue) => ({ ...prevValue, [DatePickerVariant.YYYY]: value })),
100
- setActive: () => setActiveSegment(DatePickerVariant.YYYY),
101
- placeholder: props.locale.inputs.year
66
+ const getValidateInput = useCallback(
67
+ (input2, onSuccess, onFailure, onNan) => {
68
+ const dayStr = input2.DD;
69
+ const monthStr = input2.MM;
70
+ const yearStr = input2.YYYY;
71
+ const day = dayStr === "" ? NaN : Number(dayStr);
72
+ const month = monthStr === "" ? NaN : Number(monthStr);
73
+ const year = yearStr === "" ? NaN : Number(yearStr);
74
+ const isHasInput2 = dayStr !== "" || monthStr !== "" || yearStr !== "";
75
+ if (!Number.isNaN(day) && !Number.isNaN(month) && !Number.isNaN(year)) {
76
+ const m = moment.utc(`${day}.${month}.${year}`, "D.M.YYYY", true).startOf("day");
77
+ if (m.isValid()) {
78
+ onSuccess == null ? void 0 : onSuccess(m.valueOf());
79
+ } else {
80
+ onFailure == null ? void 0 : onFailure();
81
+ }
82
+ } else {
83
+ onNan == null ? void 0 : onNan(isHasInput2);
102
84
  }
103
- };
104
- const resultSort = mode.map((e) => {
105
- if (e === DatePickerVariant.DD) return result.DD;
106
- if (e === DatePickerVariant.MM) return result.MM;
107
- if (e === DatePickerVariant.YYYY) return result.YYYY;
108
- return null;
109
- }).filter((e) => e !== null);
85
+ },
86
+ []
87
+ );
88
+ const dataDate = useMemo(() => {
89
+ const segments = [DatePickerVariant.DD, DatePickerVariant.MM, DatePickerVariant.YYYY];
90
+ const result = Object.fromEntries(
91
+ segments.map((segment) => [
92
+ segment,
93
+ {
94
+ type: segment,
95
+ value: input[segment],
96
+ placeholder: props.locale.inputs[segment === DatePickerVariant.DD ? "day" : segment === DatePickerVariant.MM ? "month" : "year"],
97
+ isFirst: mode[0] === segment,
98
+ isLast: mode[mode.length - 1] === segment,
99
+ segmentNext: getNextSegment(segment),
100
+ segmentPrev: getPrevSegment(segment),
101
+ onNextSegment: () => setActiveSegment(getNextSegment(segment)),
102
+ onPrevSegment: () => setActiveSegment(getPrevSegment(segment)),
103
+ setValue: (value) => setInput((prev) => ({ ...prev, [segment]: value })),
104
+ setActive: () => setActiveSegment(segment)
105
+ }
106
+ ])
107
+ );
108
+ const resultSort = mode.map((segment) => result[segment]).filter(Boolean);
110
109
  return { sort: resultSort, default: result };
111
- }, [
112
- props.locale.inputs.day,
113
- props.locale.inputs.month,
114
- props.locale.inputs.year,
115
- getNextSegment,
116
- getPrevSegment,
117
- mode,
118
- input.DD,
119
- input.MM,
120
- input.YYYY
121
- ]);
110
+ }, [props, getNextSegment, getPrevSegment, mode, input]);
122
111
  const daysInWeek = useMemo(() => {
123
112
  const weekOrder = ["mo", "tu", "we", "th", "fr", "sa", "su"];
124
113
  return weekOrder.map((key, index) => {
@@ -131,61 +120,30 @@ const DatePicker = (props) => {
131
120
  }, [props.locale.weeks]);
132
121
  const daysInMonth = useMemo(() => {
133
122
  const today = moment.utc();
134
- const startOfMonth = (valueMoment ?? dateDefaultMoment).clone().startOf("month");
135
- const endOfMonth = (valueMoment ?? dateDefaultMoment).clone().endOf("month");
136
- const days = [];
123
+ const baseMoment = valueMoment ?? dateDefaultMoment;
124
+ const startOfMonth = baseMoment.clone().startOf("month");
125
+ const endOfMonth = baseMoment.clone().endOf("month");
137
126
  const dateMin = props.dateMin ? moment.utc(props.dateMin) : null;
138
127
  const dateMax = props.dateMax ? moment.utc(props.dateMax) : null;
139
- const daysToAddBefore = startOfMonth.isoWeekday() - 1;
140
- if (daysToAddBefore > 0) {
141
- for (let i = daysToAddBefore; i > 0; i--) {
142
- const day = startOfMonth.clone().subtract(i, "days");
143
- days.push({
144
- value: day.valueOf(),
145
- labelString: day.format("dd"),
146
- labelNumber: day.date(),
147
- dayOfWeek: day.isoWeekday(),
148
- isWeekend: day.isoWeekday() === 6 || day.isoWeekday() === 7,
149
- weekOfMonth: Math.ceil((days.length + 1) / 7),
150
- isToday: day.isSame(today, "day"),
151
- isCurrentMonth: false,
152
- isDisabled: day.isBefore(dateMin, "day") || day.isAfter(dateMax, "day")
153
- });
154
- }
155
- }
156
- const currentDate = startOfMonth.clone();
157
- while (currentDate <= endOfMonth) {
128
+ const firstVisibleDay = startOfMonth.clone().subtract(startOfMonth.isoWeekday() - 1, "days");
129
+ const lastVisibleDay = endOfMonth.clone().add(7 - endOfMonth.isoWeekday(), "days");
130
+ const days = [];
131
+ const currentDate = firstVisibleDay.clone();
132
+ while (currentDate <= lastVisibleDay) {
133
+ const isCurrentMonth = currentDate.isBetween(startOfMonth, endOfMonth, "day", "[]");
158
134
  days.push({
159
135
  value: currentDate.valueOf(),
160
136
  labelString: currentDate.format("dd"),
161
137
  labelNumber: currentDate.date(),
162
138
  dayOfWeek: currentDate.isoWeekday(),
163
- isWeekend: currentDate.isoWeekday() === 6 || currentDate.isoWeekday() === 7,
139
+ isWeekend: [6, 7].includes(currentDate.isoWeekday()),
164
140
  weekOfMonth: Math.ceil((days.length + 1) / 7),
165
141
  isToday: currentDate.isSame(today, "day"),
166
- isCurrentMonth: true,
167
- isDisabled: currentDate.isBefore(dateMin, "day") || currentDate.isAfter(dateMax, "day")
142
+ isCurrentMonth,
143
+ isDisabled: !!(dateMin && currentDate.isBefore(dateMin, "day") || dateMax && currentDate.isAfter(dateMax, "day"))
168
144
  });
169
145
  currentDate.add(1, "day");
170
146
  }
171
- const daysToAddAfter = 7 - endOfMonth.isoWeekday();
172
- if (daysToAddAfter > 0) {
173
- for (let i = 1; i <= daysToAddAfter; i++) {
174
- const day = endOfMonth.clone().add(i, "days").startOf("day");
175
- days.push({
176
- value: day.valueOf(),
177
- labelString: day.format("dd"),
178
- labelNumber: day.date(),
179
- dayOfWeek: day.isoWeekday(),
180
- isWeekend: day.isoWeekday() === 6 || day.isoWeekday() === 7,
181
- weekOfMonth: Math.ceil((days.length + 1) / 7),
182
- isToday: day.isSame(today, "day"),
183
- isCurrentMonth: false,
184
- isDisabled: day.isBefore(dateMin, "day") || day.isAfter(dateMax, "day")
185
- });
186
- }
187
- }
188
- days.sort((a, b) => a.value - b.value);
189
147
  return days;
190
148
  }, [valueMoment, dateDefaultMoment, props.dateMax, props.dateMin]);
191
149
  const rows = useMemo(() => countSevens(daysInMonth.length) + 1, [daysInMonth]);
@@ -239,20 +197,23 @@ const DatePicker = (props) => {
239
197
  return !!(!isInputFocused && !isHasValue && props.labelPlaceholder && !isOpen && !isHasInput && !activeSegment);
240
198
  }, [isInputFocused, isHasValue, isOpen, props.labelPlaceholder, isHasInput, activeSegment]);
241
199
  const onChangeDate = useCallback(
242
- (timestamp) => {
200
+ (timestamp, isAddLeadingZeros, isForceInput) => {
243
201
  const momentNewDate = moment(timestamp).utc();
244
- if (valueMoment == null ? void 0 : valueMoment.isSame(momentNewDate, "day")) return;
245
- setValueMoment(momentNewDate);
246
- onChange(momentNewDate.valueOf());
247
- setInput({
248
- [DatePickerVariant.DD]: momentNewDate.clone().date(),
249
- [DatePickerVariant.MM]: momentNewDate.clone().month() + 1,
250
- [DatePickerVariant.YYYY]: momentNewDate.clone().year()
251
- });
202
+ if (!(valueMoment == null ? void 0 : valueMoment.isSame(momentNewDate, "day"))) {
203
+ setValueMoment(momentNewDate);
204
+ onChange(momentNewDate.valueOf());
205
+ }
206
+ if (!(valueMoment == null ? void 0 : valueMoment.isSame(momentNewDate, "day")) || isForceInput) {
207
+ setInput({
208
+ [DatePickerVariant.DD]: isAddLeadingZeros ? momentNewDate.clone().date().toString().padStart(2, "0") : momentNewDate.clone().date().toString(),
209
+ [DatePickerVariant.MM]: isAddLeadingZeros ? (momentNewDate.clone().month() + 1).toString().padStart(2, "0") : (momentNewDate.clone().month() + 1).toString(),
210
+ [DatePickerVariant.YYYY]: momentNewDate.clone().year().toString()
211
+ });
212
+ }
252
213
  },
253
214
  [valueMoment, onChange]
254
215
  );
255
- const handleKeyDown = useCallback(
216
+ const onKeyDown = useCallback(
256
217
  (e) => {
257
218
  var _a2;
258
219
  const key = e.key;
@@ -273,7 +234,7 @@ const DatePicker = (props) => {
273
234
  if (key === "Tab") {
274
235
  if (!dataDate.default[activeSegment].isLast) {
275
236
  e.preventDefault();
276
- dataDate.default[activeSegment].onNext();
237
+ dataDate.default[activeSegment].onNextSegment();
277
238
  } else {
278
239
  (_a2 = refHiddenInput == null ? void 0 : refHiddenInput.current) == null ? void 0 : _a2.blur();
279
240
  }
@@ -284,40 +245,40 @@ const DatePicker = (props) => {
284
245
  }
285
246
  if (key === "Backspace" || key === "Delete") {
286
247
  if (activeSegment === DatePickerVariant.DD) {
287
- if (input.DD !== null) {
288
- const current = input.DD.toString();
248
+ if (input.DD !== "") {
249
+ const current = input.DD;
289
250
  if (current.length === 1) {
290
- dataDate.default[activeSegment].setValue(null);
251
+ dataDate.default[activeSegment].setValue("");
291
252
  } else {
292
253
  const newValue = current.slice(0, -1);
293
- dataDate.default[activeSegment].setValue(Number(newValue));
254
+ dataDate.default[activeSegment].setValue(newValue);
294
255
  }
295
256
  } else {
296
- dataDate.default[activeSegment].onPrev();
257
+ dataDate.default[activeSegment].onPrevSegment();
297
258
  }
298
259
  } else if (activeSegment === DatePickerVariant.MM) {
299
- if (input.MM !== null) {
300
- const current = input.MM.toString();
260
+ if (input.MM !== "") {
261
+ const current = input.MM;
301
262
  if (current.length === 1) {
302
- dataDate.default[activeSegment].setValue(null);
263
+ dataDate.default[activeSegment].setValue("");
303
264
  } else {
304
265
  const newValue = current.slice(0, -1);
305
- dataDate.default[activeSegment].setValue(Number(newValue));
266
+ dataDate.default[activeSegment].setValue(newValue);
306
267
  }
307
268
  } else {
308
- dataDate.default[activeSegment].onPrev();
269
+ dataDate.default[activeSegment].onPrevSegment();
309
270
  }
310
271
  } else if (activeSegment === DatePickerVariant.YYYY) {
311
- if (input.YYYY !== null) {
312
- const current = input.YYYY.toString();
272
+ if (input.YYYY !== "") {
273
+ const current = input.YYYY;
313
274
  if (current.length === 1) {
314
- dataDate.default[activeSegment].setValue(null);
275
+ dataDate.default[activeSegment].setValue("");
315
276
  } else {
316
277
  const newValue = current.slice(0, -1);
317
- dataDate.default[activeSegment].setValue(Number(newValue));
278
+ dataDate.default[activeSegment].setValue(newValue);
318
279
  }
319
280
  } else {
320
- dataDate.default[activeSegment].onPrev();
281
+ dataDate.default[activeSegment].onPrevSegment();
321
282
  }
322
283
  }
323
284
  e.preventDefault();
@@ -325,11 +286,11 @@ const DatePicker = (props) => {
325
286
  }
326
287
  if (key === "ArrowLeft" || key === "ArrowDown") {
327
288
  e.preventDefault();
328
- dataDate.default[activeSegment].onPrev();
289
+ dataDate.default[activeSegment].onPrevSegment();
329
290
  }
330
291
  if (key === "ArrowRight" || key === "ArrowUp") {
331
292
  e.preventDefault();
332
- dataDate.default[activeSegment].onNext();
293
+ dataDate.default[activeSegment].onNextSegment();
333
294
  }
334
295
  }
335
296
  },
@@ -337,11 +298,11 @@ const DatePicker = (props) => {
337
298
  );
338
299
  const onNextMonth = useCallback(() => {
339
300
  const newDate = (valueMoment ?? dateDefaultMoment).clone().add(1, "month");
340
- onChangeDate(newDate.valueOf());
301
+ onChangeDate(newDate.valueOf(), true);
341
302
  }, [valueMoment, onChangeDate, dateDefaultMoment]);
342
303
  const onPrevMonth = useCallback(() => {
343
304
  const newDate = (valueMoment ?? dateDefaultMoment).clone().subtract(1, "month");
344
- onChangeDate(newDate.valueOf());
305
+ onChangeDate(newDate.valueOf(), true);
345
306
  }, [valueMoment, onChangeDate, dateDefaultMoment]);
346
307
  useEffect(() => {
347
308
  setDateDefaultMoment(moment(props.dateDefault).utc());
@@ -349,50 +310,33 @@ const DatePicker = (props) => {
349
310
  useEffect(() => {
350
311
  setValueMoment(props.value || props.defaultValue ? moment(props.value ?? props.defaultValue).utc() : null);
351
312
  if (props.value) {
313
+ const m = moment(props.value).utc();
352
314
  setInput({
353
- [DatePickerVariant.DD]: moment(props.value).utc().date(),
354
- [DatePickerVariant.MM]: moment(props.value).utc().month() + 1,
355
- [DatePickerVariant.YYYY]: moment(props.value).utc().year()
315
+ [DatePickerVariant.DD]: m.date().toString().padStart(2, "0"),
316
+ [DatePickerVariant.MM]: (m.month() + 1).toString().padStart(2, "0"),
317
+ [DatePickerVariant.YYYY]: m.year().toString()
356
318
  });
357
319
  }
358
320
  }, [props.value, props.defaultValue]);
359
- const getValidateInput = useCallback(
360
- (input2, onSuccess, onFailure, onNan) => {
361
- const day = input2.DD ?? NaN;
362
- const month = input2.MM ?? NaN;
363
- const year = input2.YYYY ?? NaN;
364
- const isHasInput2 = input2[DatePickerVariant.DD] !== null || input2[DatePickerVariant.MM] !== null || input2[DatePickerVariant.YYYY] !== null;
365
- if (!Number.isNaN(day) && !Number.isNaN(month) && !Number.isNaN(year)) {
366
- const m = moment.utc(`${day}.${month}.${year}`, "D.M.YYYY", true).startOf("day");
367
- if (m.isValid()) {
368
- onSuccess == null ? void 0 : onSuccess(m.valueOf());
369
- } else {
370
- onFailure == null ? void 0 : onFailure();
371
- }
372
- } else {
373
- onNan == null ? void 0 : onNan(isHasInput2);
374
- }
375
- },
376
- []
377
- );
378
321
  useEffect(() => {
379
- getValidateInput(
380
- input,
381
- (value) => {
382
- onChangeDate(value);
383
- setIsError(false);
384
- },
385
- () => {
386
- onChange(null);
387
- setIsError(true);
388
- },
389
- (isHasInput2) => {
390
- if (!isHasInput2) {
322
+ if (!activeSegment)
323
+ getValidateInput(
324
+ input,
325
+ (value) => {
326
+ onChangeDate(value, true);
391
327
  setIsError(false);
328
+ },
329
+ () => {
330
+ onChange(null);
331
+ setIsError(true);
332
+ },
333
+ (isHasInput2) => {
334
+ if (!isHasInput2) {
335
+ setIsError(false);
336
+ }
392
337
  }
393
- }
394
- );
395
- }, [getValidateInput, onChangeDate, onChange, input]);
338
+ );
339
+ }, [getValidateInput, onChangeDate, onChange, input, activeSegment]);
396
340
  useEffect(() => {
397
341
  if (!isOpen && !isInputFocused && isHasInput && !activeSegment)
398
342
  getValidateInput(
@@ -411,6 +355,24 @@ const DatePicker = (props) => {
411
355
  }
412
356
  );
413
357
  }, [getValidateInput, onClearInput, input, isOpen, isInputFocused, onChange, isHasInput, activeSegment]);
358
+ useEffect(() => {
359
+ if (!activeSegment) return;
360
+ getValidateInput(
361
+ refInputValue.current,
362
+ (value) => {
363
+ onChangeDate(value, true, true);
364
+ setIsError(false);
365
+ },
366
+ () => {
367
+ setIsError(true);
368
+ },
369
+ (isHasInput2) => {
370
+ if (!isHasInput2) {
371
+ setIsError(false);
372
+ }
373
+ }
374
+ );
375
+ }, [onChangeDate, getValidateInput, activeSegment]);
414
376
  useEffect(() => {
415
377
  var _a2;
416
378
  if (activeSegment) {
@@ -465,21 +427,20 @@ const DatePicker = (props) => {
465
427
  position: "absolute",
466
428
  left: "-100dvw",
467
429
  top: 0,
468
- // left: 0,
469
430
  width: "100%",
470
431
  height: "100%",
471
432
  opacity: 0,
472
433
  border: "none",
473
434
  background: "transparent"
474
435
  },
475
- onKeyDown: handleKeyDown,
436
+ onKeyDown,
476
437
  onChange: (e) => {
477
438
  const value = e.target.value;
478
439
  const prevValue = refPrevValue.current;
479
440
  const newChar = value.length > prevValue.length ? value.slice(-1) : null;
480
441
  refPrevValue.current = value;
481
442
  if (newChar && /^\d$/.test(newChar)) {
482
- handleKeyDown({
443
+ onKeyDown({
483
444
  key: newChar,
484
445
  preventDefault: () => {
485
446
  },
@@ -488,7 +449,7 @@ const DatePicker = (props) => {
488
449
  });
489
450
  }
490
451
  if (value.length < prevValue.length) {
491
- handleKeyDown({
452
+ onKeyDown({
492
453
  key: "Backspace",
493
454
  preventDefault: () => {
494
455
  },
@@ -522,7 +483,7 @@ const DatePicker = (props) => {
522
483
  children: props.labelPlaceholder
523
484
  }
524
485
  ) : dataDate.sort.map((date, index) => {
525
- var _a2, _b2, _c2, _d2;
486
+ var _a2, _b2;
526
487
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Fragment, { children: [
527
488
  /* @__PURE__ */ jsxRuntimeExports.jsx(
528
489
  DateInput,
@@ -532,10 +493,9 @@ const DatePicker = (props) => {
532
493
  $genre: props.genre,
533
494
  $size: props.size,
534
495
  $font: {
496
+ ...props.font,
535
497
  size: ((_a2 = props.font) == null ? void 0 : _a2.size) ?? 16,
536
- weight: ((_b2 = props.font) == null ? void 0 : _b2.weight) ?? (props.isBold ? 500 : 400),
537
- family: ((_c2 = props.font) == null ? void 0 : _c2.family) ?? theme.font.family,
538
- height: ((_d2 = props.font) == null ? void 0 : _d2.height) ?? theme.font.lineHeight
498
+ weight: ((_b2 = props.font) == null ? void 0 : _b2.weight) ?? (props.isBold ? 500 : 400)
539
499
  },
540
500
  onClick: (e) => {
541
501
  e.preventDefault();
@@ -543,7 +503,7 @@ const DatePicker = (props) => {
543
503
  if ((props == null ? void 0 : props.isDisabled) || (props == null ? void 0 : props.isReadOnly)) return;
544
504
  date.setActive();
545
505
  },
546
- children: date.value != null ? String(date.value).padStart(date.type === DatePickerVariant.YYYY ? 1 : 2, "0") : date.placeholder || ""
506
+ children: date.value || date.placeholder || ""
547
507
  }
548
508
  ),
549
509
  index !== dataDate.sort.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { width: "4px", pointerEvents: "none", textAlign: "center" }, children: "." })
@@ -557,7 +517,9 @@ const DatePicker = (props) => {
557
517
  isWidthAsHeight: true,
558
518
  isFullSize: true,
559
519
  isRadius: true,
520
+ isWhileTapEffect: true,
560
521
  isOnlyIcon: true,
522
+ isDisabledRipple: true,
561
523
  icons: [{ name: "Calendar", type: "id" }],
562
524
  isDisabled: (props == null ? void 0 : props.isDisabled) || (props == null ? void 0 : props.isReadOnly),
563
525
  onFocus: (e) => {
@@ -608,6 +570,7 @@ const DatePicker = (props) => {
608
570
  {
609
571
  type: "button",
610
572
  isRadius: true,
573
+ isWhileTapEffect: true,
611
574
  icons: [
612
575
  {
613
576
  name: "Arrow2",
@@ -619,7 +582,9 @@ const DatePicker = (props) => {
619
582
  genre: props.genre,
620
583
  size: "small",
621
584
  onClick: () => !isBlockPrevMonth && onPrevMonth(),
622
- isHidden: isBlockPrevMonth
585
+ isDisabledRipple: true,
586
+ isHidden: isBlockPrevMonth,
587
+ isDisabled: isBlockPrevMonth
623
588
  }
624
589
  ),
625
590
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { sx: { default: { gap: "8px" } }, children: [
@@ -637,7 +602,7 @@ const DatePicker = (props) => {
637
602
  isShortLabel: true,
638
603
  refFloating: refSelectMonth,
639
604
  onChange: (timestamp) => {
640
- if (timestamp) onChangeDate(timestamp);
605
+ if (timestamp) onChangeDate(timestamp, true);
641
606
  },
642
607
  dateMin: props.dateMin,
643
608
  dateMax: props.dateMax,
@@ -652,7 +617,7 @@ const DatePicker = (props) => {
652
617
  refFloating: refSelectYear,
653
618
  value: (valueMoment ?? dateDefaultMoment).clone().startOf("year").utc().valueOf(),
654
619
  onChange: (timestamp) => {
655
- if (timestamp) onChangeDate(timestamp);
620
+ if (timestamp) onChangeDate(timestamp, true);
656
621
  },
657
622
  isOnClickOptionClose: true,
658
623
  isStayValueAfterSelect: true,
@@ -668,6 +633,7 @@ const DatePicker = (props) => {
668
633
  Button,
669
634
  {
670
635
  type: "button",
636
+ isWhileTapEffect: true,
671
637
  onClick: () => !isBlockNextMonth && onNextMonth(),
672
638
  isWidthAsHeight: true,
673
639
  isRadius: true,
@@ -680,6 +646,8 @@ const DatePicker = (props) => {
680
646
  ],
681
647
  genre: props.genre,
682
648
  size: "small",
649
+ isDisabledRipple: true,
650
+ isDisabled: isBlockNextMonth,
683
651
  isHidden: isBlockNextMonth
684
652
  }
685
653
  )
@@ -688,14 +656,14 @@ const DatePicker = (props) => {
688
656
  ),
689
657
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DateDropdownDays, { $rows: rows, children: [
690
658
  daysInWeek.map((e, index) => {
691
- var _a2, _b2;
659
+ var _a2;
692
660
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
693
661
  DateDropdownDayOfWeek,
694
662
  {
695
663
  $font: {
664
+ ...props.font,
696
665
  size: 12,
697
- weight: 700,
698
- family: ((_a2 = props.font) == null ? void 0 : _a2.family) ?? theme.font.family
666
+ weight: 700
699
667
  },
700
668
  tabIndex: -1,
701
669
  type: "button",
@@ -703,53 +671,50 @@ const DatePicker = (props) => {
703
671
  $isWeekend: false,
704
672
  $genre: props.genre,
705
673
  $size: props.size,
706
- $row: ((_b2 = daysInMonth[0]) == null ? void 0 : _b2.weekOfMonth) - 1,
674
+ $row: ((_a2 = daysInMonth[0]) == null ? void 0 : _a2.weekOfMonth) - 1,
707
675
  $column: index + 1,
708
676
  children: e.label
709
677
  },
710
678
  `${e.label}-${index}`
711
679
  );
712
680
  }),
713
- daysInMonth.map((day) => {
714
- var _a2;
715
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
716
- DateDropdownDay,
717
- {
718
- $font: {
719
- size: 12,
720
- weight: 700,
721
- family: ((_a2 = props.font) == null ? void 0 : _a2.family) ?? theme.font.family
722
- },
723
- type: "button",
724
- $isDisabled: day.isDisabled,
725
- $isDisabledOutline: day.isDisabled ?? props.isDisabledOutline,
726
- $isOutlineBoxShadow: props.isOutlineBoxShadow,
727
- $isReadOnly: props.isReadOnly,
728
- $genre: props.genre,
729
- $size: props.size,
730
- $row: (day == null ? void 0 : day.weekOfMonth) + 1,
731
- $column: day.dayOfWeek,
732
- onClick: () => {
733
- if (!day.isDisabled) {
734
- onChangeDate(day.value);
735
- if (props.isOnClickClose) {
736
- close();
737
- }
681
+ daysInMonth.map((day) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
682
+ DateDropdownDay,
683
+ {
684
+ $font: {
685
+ ...props.font,
686
+ size: 12,
687
+ weight: 700
688
+ },
689
+ type: "button",
690
+ $isDisabled: day.isDisabled,
691
+ $isDisabledOutline: day.isDisabled ?? props.isDisabledOutline,
692
+ $isOutlineBoxShadow: props.isOutlineBoxShadow,
693
+ $isReadOnly: props.isReadOnly,
694
+ $genre: props.genre,
695
+ $size: props.size,
696
+ $row: (day == null ? void 0 : day.weekOfMonth) + 1,
697
+ $column: day.dayOfWeek,
698
+ onClick: () => {
699
+ if (!day.isDisabled) {
700
+ onChangeDate(day.value, true);
701
+ if (props.isOnClickClose) {
702
+ close();
738
703
  }
739
- },
740
- tabIndex: day.isDisabled ? -1 : 0,
741
- $isToday: day.isToday,
742
- $isWeekend: day.isWeekend,
743
- $isChoice: day.value === (valueMoment == null ? void 0 : valueMoment.valueOf()),
744
- $isCurrentMonth: day.isCurrentMonth,
745
- children: [
746
- !day.isDisabled && /* @__PURE__ */ jsxRuntimeExports.jsx(Ripple, { color: theme.colors.date[props.genre].color.rest }),
747
- day.labelNumber
748
- ]
704
+ }
749
705
  },
750
- day.value
751
- );
752
- })
706
+ tabIndex: day.isDisabled ? -1 : 0,
707
+ $isToday: day.isToday,
708
+ $isWeekend: day.isWeekend,
709
+ $isChoice: day.value === (valueMoment == null ? void 0 : valueMoment.valueOf()),
710
+ $isCurrentMonth: day.isCurrentMonth,
711
+ children: [
712
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Ripple, { color: theme.colors.date[props.genre].color.rest, isDisabled: day.isDisabled }),
713
+ day.labelNumber
714
+ ]
715
+ },
716
+ day.value
717
+ ))
753
718
  ] })
754
719
  ] })
755
720
  }
@@ -773,71 +738,63 @@ const DatePicker = (props) => {
773
738
  ] });
774
739
  };
775
740
  function handleDigitKey(key, activeSegment, input, dataDate) {
776
- var _a;
777
741
  const digit = key;
778
742
  const seg = activeSegment;
779
- const current = ((_a = input[seg]) == null ? void 0 : _a.toString()) ?? "";
780
- const isZero = (s) => s === "0";
781
- const toNum = (s) => Number(s);
743
+ const current = input[seg] ?? "";
782
744
  if (seg === DatePickerVariant.DD) {
783
745
  if (current.length >= 2) {
784
- const parsed2 = toNum(digit);
785
- if (parsed2 === 0 || parsed2 > 31) return;
786
- dataDate.default[seg].setValue(parsed2);
746
+ dataDate.default[seg].setValue(digit);
787
747
  return;
788
748
  }
789
- if (current.length === 1 && isZero(current)) {
790
- const parsed2 = toNum(digit);
791
- if (parsed2 === 0 || parsed2 > 31) return;
792
- dataDate.default[seg].setValue(parsed2);
793
- dataDate.default[seg].onNext();
749
+ if (current === "") {
750
+ dataDate.default[seg].setValue(digit);
794
751
  return;
795
752
  }
796
753
  const potential = current + digit;
797
- const potentialParsed = toNum(potential);
798
- if (potentialParsed > 31) {
799
- const parsed2 = toNum(digit);
800
- if (parsed2 === 0 || parsed2 > 31) return;
801
- dataDate.default[seg].setValue(parsed2);
802
- dataDate.default[seg].onNext();
754
+ const potentialNum = Number(potential);
755
+ if (potentialNum > 31) {
756
+ dataDate.default[seg].setValue(digit);
803
757
  return;
804
758
  }
805
- const nextValue = potentialParsed === 0 ? digit : potential;
806
- const parsed = toNum(nextValue);
807
- if (parsed === 0 || parsed > 31) return;
808
- dataDate.default[seg].setValue(parsed);
809
- if (nextValue.length === 2) dataDate.default[seg].onNext();
759
+ if (potentialNum === 0) {
760
+ dataDate.default[seg].setValue(digit);
761
+ return;
762
+ }
763
+ dataDate.default[seg].setValue(potential);
764
+ dataDate.default[seg].onNextSegment();
810
765
  } else if (seg === DatePickerVariant.MM) {
811
766
  if (current.length >= 2) {
812
- const parsed2 = toNum(digit);
813
- if (parsed2 === 0 || parsed2 > 12) return;
814
- dataDate.default[seg].setValue(parsed2);
767
+ if (digit === "0") return;
768
+ dataDate.default[seg].setValue(digit);
815
769
  return;
816
770
  }
817
- if (current.length === 1 && isZero(current)) {
818
- const parsed2 = toNum(digit);
819
- if (parsed2 === 0 || parsed2 > 12) return;
820
- dataDate.default[seg].setValue(parsed2);
821
- dataDate.default[seg].onNext();
771
+ if (current === "") {
772
+ dataDate.default[seg].setValue(digit);
822
773
  return;
823
774
  }
824
775
  const potential = current + digit;
825
- const potentialParsed = toNum(potential);
826
- const nextValue = potentialParsed === 0 || potentialParsed > 12 ? digit : potential;
827
- const parsed = toNum(nextValue);
828
- if (parsed === 0 || parsed > 12) return;
829
- dataDate.default[seg].setValue(parsed);
830
- if (nextValue.length === 2 || nextValue.length === 1 && parsed > 1) {
831
- dataDate.default[seg].onNext();
776
+ const potentialNum = Number(potential);
777
+ if (potentialNum > 12) {
778
+ if (digit === "0") return;
779
+ dataDate.default[seg].setValue(digit);
780
+ return;
781
+ }
782
+ if (potentialNum === 0) {
783
+ if (digit === "0") return;
784
+ dataDate.default[seg].setValue(digit);
785
+ return;
786
+ }
787
+ dataDate.default[seg].setValue(potential);
788
+ if (potential.length === 2 || potential.length === 1 && Number(potential) > 1) {
789
+ dataDate.default[seg].onNextSegment();
832
790
  }
833
791
  } else if (seg === DatePickerVariant.YYYY) {
834
792
  if (current.length >= 4) {
835
- if (digit === "0") return;
836
- dataDate.default[seg].setValue(toNum(digit));
793
+ dataDate.default[seg].setValue(digit);
837
794
  return;
838
795
  }
839
- const nextValue = (current + digit).slice(-4);
840
- dataDate.default[seg].setValue(toNum(nextValue));
796
+ const nextValue = current + digit;
797
+ dataDate.default[seg].setValue(nextValue);
841
798
  }
842
799
  }
843
800
  var DatePickerVariant = /* @__PURE__ */ ((DatePickerVariant2) => {
@@ -850,4 +807,4 @@ export {
850
807
  DatePicker as D,
851
808
  DatePickerVariant as a
852
809
  };
853
- //# sourceMappingURL=component.types-D_tW7ArD.js.map
810
+ //# sourceMappingURL=component.types-Da4YfhvS.js.map