@jenesei-software/jenesei-kit-react 1.2.3 → 1.2.5

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