@alfalab/core-components-calendar-range 9.0.14 → 9.1.0

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 (68) hide show
  1. package/Component.d.ts +4 -0
  2. package/Component.js.map +1 -1
  3. package/components/divider/index.css +8 -8
  4. package/components/divider/index.module.css.js +1 -1
  5. package/components/divider/index.module.css.js.map +1 -1
  6. package/cssm/Component.d.ts +4 -0
  7. package/cssm/Component.js.map +1 -1
  8. package/cssm/components/divider/index.module.css +1 -1
  9. package/cssm/hooks.d.ts +31 -0
  10. package/cssm/hooks.js +84 -0
  11. package/cssm/hooks.js.map +1 -1
  12. package/cssm/views/index.module.css +12 -0
  13. package/cssm/views/static.d.ts +13 -2
  14. package/cssm/views/static.js +93 -50
  15. package/cssm/views/static.js.map +1 -1
  16. package/esm/Component.d.ts +4 -0
  17. package/esm/Component.js.map +1 -1
  18. package/esm/components/divider/index.css +8 -8
  19. package/esm/components/divider/index.module.css.js +1 -1
  20. package/esm/components/divider/index.module.css.js.map +1 -1
  21. package/esm/hooks.d.ts +31 -0
  22. package/esm/hooks.js +84 -2
  23. package/esm/hooks.js.map +1 -1
  24. package/esm/views/index.css +19 -7
  25. package/esm/views/index.module.css.js +1 -1
  26. package/esm/views/index.module.css.js.map +1 -1
  27. package/esm/views/static.d.ts +13 -2
  28. package/esm/views/static.js +93 -50
  29. package/esm/views/static.js.map +1 -1
  30. package/hooks.d.ts +31 -0
  31. package/hooks.js +84 -0
  32. package/hooks.js.map +1 -1
  33. package/modern/Component.d.ts +4 -0
  34. package/modern/Component.js.map +1 -1
  35. package/modern/components/divider/index.css +8 -8
  36. package/modern/components/divider/index.module.css.js +1 -1
  37. package/modern/components/divider/index.module.css.js.map +1 -1
  38. package/modern/hooks.d.ts +31 -0
  39. package/modern/hooks.js +79 -2
  40. package/modern/hooks.js.map +1 -1
  41. package/modern/views/index.css +19 -7
  42. package/modern/views/index.module.css.js +1 -1
  43. package/modern/views/index.module.css.js.map +1 -1
  44. package/modern/views/static.d.ts +13 -2
  45. package/modern/views/static.js +88 -45
  46. package/modern/views/static.js.map +1 -1
  47. package/moderncssm/Component.d.ts +4 -0
  48. package/moderncssm/Component.js.map +1 -1
  49. package/moderncssm/components/divider/index.module.css +1 -1
  50. package/moderncssm/hooks.d.ts +31 -0
  51. package/moderncssm/hooks.js +79 -2
  52. package/moderncssm/hooks.js.map +1 -1
  53. package/moderncssm/views/index.module.css +13 -0
  54. package/moderncssm/views/static.d.ts +13 -2
  55. package/moderncssm/views/static.js +88 -45
  56. package/moderncssm/views/static.js.map +1 -1
  57. package/package.json +2 -1
  58. package/src/Component.tsx +5 -0
  59. package/src/components/divider/index.module.css +1 -1
  60. package/src/hooks.ts +150 -1
  61. package/src/views/index.module.css +11 -0
  62. package/src/views/static.tsx +188 -92
  63. package/views/index.css +19 -7
  64. package/views/index.module.css.js +1 -1
  65. package/views/index.module.css.js.map +1 -1
  66. package/views/static.d.ts +13 -2
  67. package/views/static.js +90 -47
  68. package/views/static.js.map +1 -1
@@ -1,35 +1,51 @@
1
1
  /* eslint-disable complexity */
2
- import React, { type FC, type MouseEvent, useCallback, useEffect, useState } from 'react';
2
+ import React, { type FC, type MouseEvent, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import cn from 'classnames';
4
4
  import { addMonths, endOfMonth, isSameMonth, max, startOfMonth, subMonths } from 'date-fns';
5
5
 
6
6
  import { CalendarDesktop } from '@alfalab/core-components-calendar/desktop';
7
7
  import { usePeriodWithReset } from '@alfalab/core-components-calendar/shared';
8
+ import { type CalendarInputProps } from '@alfalab/core-components-calendar-input';
8
9
  import {
9
10
  formatDate,
10
11
  isValidInputValue,
11
12
  parseDateString,
12
13
  } from '@alfalab/core-components-calendar-input/shared';
13
- import {
14
- DateInput,
15
- type DateInputProps,
16
- isCompleteDateInput,
17
- } from '@alfalab/core-components-date-input';
14
+ import { isCompleteDateInput } from '@alfalab/core-components-date-input';
18
15
  import { getDataTestId } from '@alfalab/core-components-shared';
16
+ import {
17
+ UniversalDateInput,
18
+ type UniversalDateInputProps,
19
+ } from '@alfalab/core-components-universal-date-input';
19
20
 
20
21
  import { type CalendarRangeProps } from '../Component';
21
22
  import { Divider } from '../components/divider';
22
- import { useSelectionProps, useStaticViewMonthes } from '../hooks';
23
+ import { useSelectionProps, useStaticRangeAutoSwap, useStaticViewMonthes } from '../hooks';
23
24
  import { isDayButton } from '../utils';
24
25
 
25
26
  import styles from './index.module.css';
26
27
 
27
- export type CalendarRangeStaticProps = Omit<CalendarRangeProps, 'calendarPosition'> & {
28
+ type DateInputProps = Omit<CalendarInputProps, 'onCalendarOpen' | 'onCalendarClose' | 'onChange'>;
29
+
30
+ interface CalendarRangeStaticProps
31
+ extends Omit<CalendarRangeProps, 'calendarPosition' | 'inputFromProps' | 'inputToProps'> {
28
32
  /**
29
33
  * Отображать начальный месяц слева или справа (влияет только на начальный рендер)
30
34
  */
31
35
  defaultMonthPosition?: 'left' | 'right';
32
- };
36
+
37
+ /**
38
+ * Пропсы для инпута начальной даты диапазона
39
+ */
40
+ inputFromProps?: DateInputProps;
41
+
42
+ /**
43
+ * Пропсы для инпута конечной даты диапазона
44
+ */
45
+ inputToProps?: DateInputProps;
46
+ }
47
+
48
+ type CorrectionToggleRef = { handleCorrection: () => void };
33
49
 
34
50
  export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
35
51
  className,
@@ -42,7 +58,6 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
42
58
  onDateFromChange = () => null,
43
59
  onDateToChange = () => null,
44
60
  onChange = () => null,
45
- onError,
46
61
  inputFromProps = {},
47
62
  inputToProps = {},
48
63
  offDays,
@@ -50,10 +65,33 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
50
65
  returnInvalidDates = false,
51
66
  dataTestId,
52
67
  calendarContainerClassName,
68
+ autoSwap = false,
69
+ onError,
53
70
  }) => {
54
71
  const [inputFromValue, setInputFromValue] = useState<string>(valueFrom);
55
72
  const [inputToValue, setInputToValue] = useState<string>(valueTo);
56
73
 
74
+ const [inputFromError, setInputFromError] = useState(false);
75
+ const [inputToError, setInputToError] = useState(false);
76
+
77
+ const toggleCorrectionFromRef = useRef<CorrectionToggleRef>(null);
78
+ const toggleCorrectionToRef = useRef<CorrectionToggleRef>(null);
79
+
80
+ const inputToRef = useRef<HTMLInputElement>(null);
81
+ const inputFromRef = useRef<HTMLInputElement>(null);
82
+
83
+ const { swapDates, isInternalUpdate } = useStaticRangeAutoSwap({
84
+ autoSwap,
85
+ setInputFromValue,
86
+ setInputToValue,
87
+ toggleCorrectionFromRef,
88
+ toggleCorrectionToRef,
89
+ inputFromRef,
90
+ inputToRef,
91
+ });
92
+
93
+ const [rangeValidationError, setRangeValidationError] = useState(false);
94
+
57
95
  let dateFrom = isValidInputValue(inputFromValue, minDate, maxDate, offDays)
58
96
  ? parseDateString(inputFromValue).getTime()
59
97
  : null;
@@ -66,11 +104,6 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
66
104
  dateFrom = null;
67
105
  }
68
106
 
69
- const bothInvalid =
70
- isCompleteDateInput(inputFromValue) &&
71
- isCompleteDateInput(inputToValue) &&
72
- parseDateString(inputFromValue).getTime() > parseDateString(inputToValue).getTime();
73
-
74
107
  const [highlightedDate, setHighlightedDate] = useState<number | undefined>(undefined);
75
108
 
76
109
  const period = usePeriodWithReset({
@@ -78,26 +111,6 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
78
111
  initialSelectedTo: dateTo ? parseDateString(inputToValue).getTime() : undefined,
79
112
  });
80
113
 
81
- const validateInputFromValue = useCallback(
82
- (value: string) => isValidInputValue(value, minDate, dateFrom || maxDate, offDays),
83
- [dateFrom, maxDate, minDate, offDays],
84
- );
85
-
86
- const validateInputToValue = useCallback(
87
- (value: string) => isValidInputValue(value, dateFrom || minDate, maxDate, offDays),
88
-
89
- [dateFrom, minDate, maxDate, offDays],
90
- );
91
-
92
- const [inputFromInvalid, setInputFromInvalid] = useState<boolean>(
93
- isCompleteDateInput(inputFromValue) && dateFrom === null,
94
- );
95
-
96
- const [inputToInvalid, setInputToInvalid] = useState<boolean>(
97
- isCompleteDateInput(inputToValue) && dateTo === null,
98
- );
99
-
100
- const hasValidateError = bothInvalid || inputFromInvalid || inputToInvalid;
101
114
  const {
102
115
  calendarProps: calendarFromProps,
103
116
  onInputChange: onInputChangeFrom,
@@ -118,22 +131,48 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
118
131
  },
119
132
  );
120
133
 
121
- const handleValidInputFrom = useCallback(() => {
122
- setInputFromInvalid(inputFromValue !== '' && !validateInputFromValue(inputFromValue));
123
- }, [inputFromValue, validateInputFromValue]);
134
+ const handleInputFromChange: Required<UniversalDateInputProps>['onInputChange'] = (
135
+ event,
136
+ payload,
137
+ ) => {
138
+ const newValue = payload.value;
139
+
140
+ setInputFromValue(newValue);
124
141
 
125
- const handleValidInputTo = useCallback(() => {
126
- setInputToInvalid(inputToValue !== '' && !validateInputToValue(inputToValue));
127
- }, [inputToValue, validateInputToValue]);
142
+ if (isValidInputValue(newValue, minDate, maxDate, offDays)) {
143
+ swapDates(newValue, inputFromValue, inputToValue);
144
+ }
128
145
 
129
- const handleInputFromChange: Required<DateInputProps>['onChange'] = (event, payload) => {
130
- setInputFromValue(payload.value);
131
- onInputChangeFrom?.(event, payload);
146
+ const payloadWithDate = { date: parseDateString(payload.value), value: payload.value };
147
+
148
+ if (onInputChangeFrom) {
149
+ onInputChangeFrom(
150
+ event === null ? ({} as React.ChangeEvent<HTMLInputElement>) : event,
151
+ payloadWithDate,
152
+ );
153
+ }
132
154
  };
133
155
 
134
- const handleInputToChange: Required<DateInputProps>['onChange'] = (event, payload) => {
135
- setInputToValue(payload.value);
136
- onInputChangeTo?.(event, payload);
156
+ const handleInputToChange: Required<UniversalDateInputProps>['onInputChange'] = (
157
+ event,
158
+ payload,
159
+ ) => {
160
+ const newValue = payload.value;
161
+
162
+ setInputToValue(newValue);
163
+
164
+ if (isValidInputValue(newValue, minDate, maxDate, offDays)) {
165
+ swapDates(newValue, inputFromValue, inputToValue);
166
+ }
167
+
168
+ const payloadWithDate = { date: parseDateString(payload.value), value: payload.value };
169
+
170
+ if (onInputChangeTo) {
171
+ onInputChangeTo(
172
+ event === null ? ({} as React.ChangeEvent<HTMLInputElement>) : event,
173
+ payloadWithDate,
174
+ );
175
+ }
137
176
  };
138
177
 
139
178
  const handleMouseOver = useCallback((event: MouseEvent<HTMLDivElement>) => {
@@ -180,22 +219,24 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
180
219
  }, [valueTo]);
181
220
 
182
221
  useEffect(() => {
183
- if (!inputFromValue || isCompleteDateInput(inputFromValue)) {
184
- handleValidInputFrom();
185
- }
186
-
187
222
  period.setStart(dateFrom || undefined);
188
223
  if (dateTo) {
189
224
  period.setEnd(dateTo);
190
225
  }
191
226
 
227
+ if (isInternalUpdate.current) {
228
+ isInternalUpdate.current = false;
229
+
230
+ return;
231
+ }
232
+
192
233
  if (inputFromValue !== valueFrom) {
193
- onDateFromChange({
234
+ onDateFromChange?.({
194
235
  value: inputFromValue,
195
236
  date: dateFrom,
196
237
  });
197
238
 
198
- onChange({
239
+ onChange?.({
199
240
  valueFrom: inputFromValue,
200
241
  valueTo: inputToValue,
201
242
  dateFrom,
@@ -206,15 +247,17 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
206
247
  }, [inputFromValue]);
207
248
 
208
249
  useEffect(() => {
209
- if (!inputToValue || isCompleteDateInput(inputToValue)) {
210
- handleValidInputTo();
211
- }
212
-
213
250
  period.setEnd(dateTo || undefined);
214
251
  if (dateFrom) {
215
252
  period.setStart(dateFrom);
216
253
  }
217
254
 
255
+ if (isInternalUpdate.current) {
256
+ isInternalUpdate.current = false;
257
+
258
+ return;
259
+ }
260
+
218
261
  if (inputToValue !== valueTo) {
219
262
  // eslint-disable-next-line no-nested-ternary
220
263
  const inputDateTo = returnInvalidDates
@@ -223,12 +266,12 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
223
266
  : null
224
267
  : dateTo;
225
268
 
226
- onDateToChange({
269
+ onDateToChange?.({
227
270
  value: inputToValue,
228
271
  date: inputDateTo,
229
272
  });
230
273
 
231
- onChange({
274
+ onChange?.({
232
275
  valueFrom: inputFromValue,
233
276
  valueTo: inputToValue,
234
277
  dateFrom,
@@ -238,12 +281,53 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
238
281
  // eslint-disable-next-line react-hooks/exhaustive-deps
239
282
  }, [inputToValue]);
240
283
 
284
+ useEffect(() => {
285
+ const isInputFromValueComplete = isCompleteDateInput(inputFromValue);
286
+ const isInputToValueComplete = isCompleteDateInput(inputToValue);
287
+
288
+ let individualInputFromError = false;
289
+ let individualInputToError = false;
290
+
291
+ if (isInputFromValueComplete) {
292
+ individualInputFromError = !isValidInputValue(
293
+ inputFromValue,
294
+ minDate,
295
+ maxDate,
296
+ offDays,
297
+ );
298
+ }
299
+
300
+ if (isInputToValueComplete) {
301
+ individualInputToError = !isValidInputValue(inputToValue, minDate, maxDate, offDays);
302
+ }
303
+
304
+ let isRangeError = false;
305
+
306
+ const isValidInputFromValueStandalone =
307
+ isInputFromValueComplete && individualInputFromError === false;
308
+ const isValidInputToValueStandalone =
309
+ isInputToValueComplete && individualInputToError === false;
310
+
311
+ if (isValidInputFromValueStandalone && isValidInputToValueStandalone) {
312
+ const parsedDateFrom = parseDateString(inputFromValue).getTime();
313
+ const parsedDateTo = parseDateString(inputToValue).getTime();
314
+
315
+ if (parsedDateFrom > parsedDateTo) {
316
+ isRangeError = true;
317
+ }
318
+ }
319
+
320
+ setInputFromError(individualInputFromError || isRangeError);
321
+ setInputToError(individualInputToError || isRangeError);
322
+
323
+ setRangeValidationError(isRangeError);
324
+ }, [inputFromValue, inputToValue, minDate, maxDate, offDays]);
325
+
241
326
  useEffect(() => {
242
327
  if (onError) {
243
- onError(hasValidateError);
328
+ onError(rangeValidationError);
244
329
  }
245
- // eslint-disable-next-line react-hooks/exhaustive-deps
246
- }, [hasValidateError]);
330
+ }, [onError, rangeValidationError]);
247
331
 
248
332
  const rangeProps = useSelectionProps(period.selectedFrom, period.selectedTo, highlightedDate);
249
333
 
@@ -260,22 +344,54 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
260
344
  onMouseOver={handleMouseOver}
261
345
  data-test-id={dataTestId}
262
346
  >
263
- <div>
264
- <DateInput
347
+ <div className={cn(styles.inputsContainer)}>
348
+ <UniversalDateInput
265
349
  {...dateInputFromProps}
266
- mobileMode={
267
- dateInputFromProps.mobileMode === 'popover'
268
- ? 'input'
269
- : dateInputFromProps.mobileMode
270
- }
350
+ Calendar={undefined}
351
+ view='date'
352
+ picker={false}
271
353
  value={inputFromValue}
272
- onChange={handleInputFromChange}
354
+ onInputChange={handleInputFromChange}
273
355
  onClear={handleClearFrom}
274
- onBlur={handleValidInputFrom}
275
- error={bothInvalid || inputFromInvalid || dateInputFromProps.error}
356
+ correctionRef={toggleCorrectionFromRef}
357
+ error={inputFromError ? 'Укажите корректную дату' : dateInputFromProps.error}
276
358
  clear={true}
277
359
  block={true}
360
+ minDate={minDate}
361
+ autoCorrection={false}
362
+ maxDate={
363
+ minMaxInSameMonth
364
+ ? maxDate
365
+ : maxDate && max([maxDate, endOfMonth(subMonths(maxDate, 1))]).getTime()
366
+ }
367
+ ref={inputFromRef}
278
368
  />
369
+
370
+ <Divider inputFromProps={inputFromProps} inputToProps={inputToProps} />
371
+
372
+ <UniversalDateInput
373
+ {...dateInputToProps}
374
+ Calendar={undefined}
375
+ view='date'
376
+ picker={false}
377
+ value={inputToValue}
378
+ onInputChange={handleInputToChange}
379
+ onClear={handleClearTo}
380
+ error={inputToError ? 'Укажите корректную дату' : dateInputToProps.error}
381
+ correctionRef={toggleCorrectionToRef}
382
+ clear={true}
383
+ block={true}
384
+ autoCorrection={false}
385
+ minDate={
386
+ minMaxInSameMonth
387
+ ? minDate
388
+ : minDate && startOfMonth(addMonths(minDate, 1)).getTime()
389
+ }
390
+ maxDate={maxDate}
391
+ ref={inputToRef}
392
+ />
393
+ </div>
394
+ <div className={cn(styles.calendarContainers)}>
279
395
  <div
280
396
  className={cn(styles.calendarContainer, calendarContainerClassName)}
281
397
  data-test-id={getDataTestId(dataTestId, 'container-from')}
@@ -299,26 +415,6 @@ export const CalendarRangeStatic: FC<CalendarRangeStaticProps> = ({
299
415
  {...rangeProps}
300
416
  />
301
417
  </div>
302
- </div>
303
-
304
- <Divider inputFromProps={inputFromProps} inputToProps={inputToProps} />
305
-
306
- <div>
307
- <DateInput
308
- {...dateInputToProps}
309
- mobileMode={
310
- dateInputToProps.mobileMode === 'popover'
311
- ? 'input'
312
- : dateInputToProps.mobileMode
313
- }
314
- value={inputToValue}
315
- onChange={handleInputToChange}
316
- onClear={handleClearTo}
317
- onBlur={handleValidInputTo}
318
- error={bothInvalid || inputToInvalid || dateInputToProps.error}
319
- clear={true}
320
- block={true}
321
- />
322
418
  <div data-test-id={getDataTestId(dataTestId, 'container-to')}>
323
419
  <CalendarToComponent
324
420
  {...calendarToProps}
package/views/index.css CHANGED
@@ -1,32 +1,44 @@
1
1
  :root {
2
2
  --gap-s: 12px;
3
3
  --gap-m: 16px;
4
+ --gap-2xl: 32px;
4
5
  --gap-0: 0px;
5
6
  --gap-12: var(--gap-s);
6
7
  --gap-16: var(--gap-m);
8
+ --gap-32: var(--gap-2xl);
7
9
  }
8
10
  :root {
9
11
  --calendar-inner-width: 280px;
10
12
  }
11
- .calendar-range__component_cda4k {
13
+ .calendar-range__component_q8vzh {
12
14
  display: flex;
13
15
  }
14
- .calendar-range__component_cda4k button[aria-selected='true'] {
16
+ .calendar-range__component_q8vzh button[aria-selected='true'] {
15
17
  cursor: pointer;
16
18
  }
17
- .calendar-range__component_cda4k *[class*='errorIcon_'] {
19
+ .calendar-range__component_q8vzh *[class*='errorIcon_'] {
18
20
  display: none;
19
21
  }
20
- .calendar-range__component_cda4k *[class*='calendarIcon_'] {
22
+ .calendar-range__component_q8vzh *[class*='calendarIcon_'] {
21
23
  margin-right: var(--gap-0);
22
24
  }
23
- .calendar-range__static_cda4k .calendar-range__calendar_cda4k {
25
+ .calendar-range__static_q8vzh {
26
+ flex-direction: column;
27
+ }
28
+ .calendar-range__static_q8vzh .calendar-range__calendar_q8vzh {
24
29
  width: var(--calendar-inner-width);
25
30
  }
26
- .calendar-range__static_cda4k .calendar-range__calendar_cda4k > div:first-child {
31
+ .calendar-range__static_q8vzh .calendar-range__calendar_q8vzh > div:first-child {
27
32
  padding: var(--gap-16) var(--gap-0) var(--gap-12);
28
33
  }
29
- .calendar-range__calendarContainer_cda4k {
34
+ .calendar-range__inputsContainer_q8vzh {
35
+ display: flex;
36
+ }
37
+ .calendar-range__calendarContainers_q8vzh {
38
+ display: flex;
39
+ gap: var(--gap-32);
40
+ }
41
+ .calendar-range__calendarContainer_q8vzh {
30
42
  width: var(--calendar-inner-width);
31
43
  display: flex;
32
44
  justify-content: center;
@@ -2,7 +2,7 @@
2
2
 
3
3
  require('./index.css');
4
4
 
5
- var styles = {"component":"calendar-range__component_cda4k","static":"calendar-range__static_cda4k","calendar":"calendar-range__calendar_cda4k","calendarContainer":"calendar-range__calendarContainer_cda4k"};
5
+ var styles = {"component":"calendar-range__component_q8vzh","static":"calendar-range__static_q8vzh","calendar":"calendar-range__calendar_q8vzh","inputsContainer":"calendar-range__inputsContainer_q8vzh","calendarContainers":"calendar-range__calendarContainers_q8vzh","calendarContainer":"calendar-range__calendarContainer_q8vzh"};
6
6
 
7
7
  module.exports = styles;
8
8
  //# sourceMappingURL=index.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.module.css.js","sources":["../src/views/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../../calendar/src/vars.css';\n\n.component {\n display: flex;\n\n & button[aria-selected='true'] {\n cursor: pointer;\n }\n\n & *[class*='errorIcon_'] {\n display: none;\n }\n\n & *[class*='calendarIcon_'] {\n margin-right: var(--gap-0);\n }\n}\n\n.static {\n & .calendar {\n width: var(--calendar-inner-width);\n\n & > div:first-child {\n padding: var(--gap-16) var(--gap-0) var(--gap-12);\n }\n }\n}\n\n.calendarContainer {\n width: var(--calendar-inner-width);\n display: flex;\n justify-content: center;\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,iCAAiC,CAAC,QAAQ,CAAC,8BAA8B,CAAC,UAAU,CAAC,gCAAgC,CAAC,mBAAmB,CAAC,yCAAyC,CAAC;;;;"}
1
+ {"version":3,"file":"index.module.css.js","sources":["../src/views/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../../calendar/src/vars.css';\n\n.component {\n display: flex;\n\n & button[aria-selected='true'] {\n cursor: pointer;\n }\n\n & *[class*='errorIcon_'] {\n display: none;\n }\n\n & *[class*='calendarIcon_'] {\n margin-right: var(--gap-0);\n }\n}\n\n.static {\n flex-direction: column;\n\n & .calendar {\n width: var(--calendar-inner-width);\n\n & > div:first-child {\n padding: var(--gap-16) var(--gap-0) var(--gap-12);\n }\n }\n}\n\n.inputsContainer {\n display: flex;\n}\n\n.calendarContainers {\n display: flex;\n gap: var(--gap-32);\n}\n\n.calendarContainer {\n width: var(--calendar-inner-width);\n display: flex;\n justify-content: center;\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,iCAAiC,CAAC,QAAQ,CAAC,8BAA8B,CAAC,UAAU,CAAC,gCAAgC,CAAC,iBAAiB,CAAC,uCAAuC,CAAC,oBAAoB,CAAC,0CAA0C,CAAC,mBAAmB,CAAC,yCAAyC,CAAC;;;;"}
package/views/static.d.ts CHANGED
@@ -1,9 +1,20 @@
1
1
  import { type FC } from 'react';
2
+ import { type CalendarInputProps } from '@alfalab/core-components-calendar-input';
2
3
  import { type CalendarRangeProps } from '../Component';
3
- export type CalendarRangeStaticProps = Omit<CalendarRangeProps, 'calendarPosition'> & {
4
+ type DateInputProps = Omit<CalendarInputProps, 'onCalendarOpen' | 'onCalendarClose' | 'onChange'>;
5
+ interface CalendarRangeStaticProps extends Omit<CalendarRangeProps, 'calendarPosition' | 'inputFromProps' | 'inputToProps'> {
4
6
  /**
5
7
  * Отображать начальный месяц слева или справа (влияет только на начальный рендер)
6
8
  */
7
9
  defaultMonthPosition?: 'left' | 'right';
8
- };
10
+ /**
11
+ * Пропсы для инпута начальной даты диапазона
12
+ */
13
+ inputFromProps?: DateInputProps;
14
+ /**
15
+ * Пропсы для инпута конечной даты диапазона
16
+ */
17
+ inputToProps?: DateInputProps;
18
+ }
9
19
  export declare const CalendarRangeStatic: FC<CalendarRangeStaticProps>;
20
+ export {};