@itcase/ui 1.2.29 → 1.2.30

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.
@@ -4,6 +4,7 @@ var tslib_es6 = require('../../tslib.es6-CCZ3TN_7.js');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var clsx = require('clsx');
7
+ var locale = require('date-fns/locale');
7
8
  var DatePicker = require('react-datepicker');
8
9
  var index = require('../appearance/DatePicker.js');
9
10
  var useDeviceTargetClass = require('../hooks/useDeviceTargetClass.js');
@@ -36,1049 +37,6 @@ require('../appearance/Input.js');
36
37
  require('../appearance/Label.js');
37
38
  require('../appearance/Text.js');
38
39
 
39
- function buildFormatLongFn(args) {
40
- return (options = {}) => {
41
- // TODO: Remove String()
42
- const width = options.width ? String(options.width) : args.defaultWidth;
43
- const format = args.formats[width] || args.formats[args.defaultWidth];
44
- return format;
45
- };
46
- }
47
-
48
- /* eslint-disable no-unused-vars */
49
-
50
- /**
51
- * The localize function argument callback which allows to convert raw value to
52
- * the actual type.
53
- *
54
- * @param value - The value to convert
55
- *
56
- * @returns The converted value
57
- */
58
-
59
- /**
60
- * The map of localized values for each width.
61
- */
62
-
63
- /**
64
- * The index type of the locale unit value. It types conversion of units of
65
- * values that don't start at 0 (i.e. quarters).
66
- */
67
-
68
- /**
69
- * Converts the unit value to the tuple of values.
70
- */
71
-
72
- /**
73
- * The tuple of localized era values. The first element represents BC,
74
- * the second element represents AD.
75
- */
76
-
77
- /**
78
- * The tuple of localized quarter values. The first element represents Q1.
79
- */
80
-
81
- /**
82
- * The tuple of localized day values. The first element represents Sunday.
83
- */
84
-
85
- /**
86
- * The tuple of localized month values. The first element represents January.
87
- */
88
-
89
- function buildLocalizeFn(args) {
90
- return (value, options) => {
91
- const context = options?.context ? String(options.context) : "standalone";
92
-
93
- let valuesArray;
94
- if (context === "formatting" && args.formattingValues) {
95
- const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
96
- const width = options?.width ? String(options.width) : defaultWidth;
97
-
98
- valuesArray =
99
- args.formattingValues[width] || args.formattingValues[defaultWidth];
100
- } else {
101
- const defaultWidth = args.defaultWidth;
102
- const width = options?.width ? String(options.width) : args.defaultWidth;
103
-
104
- valuesArray = args.values[width] || args.values[defaultWidth];
105
- }
106
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
107
-
108
- // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
109
- return valuesArray[index];
110
- };
111
- }
112
-
113
- function buildMatchFn(args) {
114
- return (string, options = {}) => {
115
- const width = options.width;
116
-
117
- const matchPattern =
118
- (width && args.matchPatterns[width]) ||
119
- args.matchPatterns[args.defaultMatchWidth];
120
- const matchResult = string.match(matchPattern);
121
-
122
- if (!matchResult) {
123
- return null;
124
- }
125
- const matchedString = matchResult[0];
126
-
127
- const parsePatterns =
128
- (width && args.parsePatterns[width]) ||
129
- args.parsePatterns[args.defaultParseWidth];
130
-
131
- const key = Array.isArray(parsePatterns)
132
- ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
133
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
134
- findKey(parsePatterns, (pattern) => pattern.test(matchedString));
135
-
136
- let value;
137
-
138
- value = args.valueCallback ? args.valueCallback(key) : key;
139
- value = options.valueCallback
140
- ? // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
141
- options.valueCallback(value)
142
- : value;
143
-
144
- const rest = string.slice(matchedString.length);
145
-
146
- return { value, rest };
147
- };
148
- }
149
-
150
- function findKey(object, predicate) {
151
- for (const key in object) {
152
- if (
153
- Object.prototype.hasOwnProperty.call(object, key) &&
154
- predicate(object[key])
155
- ) {
156
- return key;
157
- }
158
- }
159
- return undefined;
160
- }
161
-
162
- function findIndex(array, predicate) {
163
- for (let key = 0; key < array.length; key++) {
164
- if (predicate(array[key])) {
165
- return key;
166
- }
167
- }
168
- return undefined;
169
- }
170
-
171
- function buildMatchPatternFn(args) {
172
- return (string, options = {}) => {
173
- const matchResult = string.match(args.matchPattern);
174
- if (!matchResult) return null;
175
- const matchedString = matchResult[0];
176
-
177
- const parseResult = string.match(args.parsePattern);
178
- if (!parseResult) return null;
179
- let value = args.valueCallback
180
- ? args.valueCallback(parseResult[0])
181
- : parseResult[0];
182
-
183
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
184
- value = options.valueCallback ? options.valueCallback(value) : value;
185
-
186
- const rest = string.slice(matchedString.length);
187
-
188
- return { value, rest };
189
- };
190
- }
191
-
192
- /**
193
- * @name toDate
194
- * @category Common Helpers
195
- * @summary Convert the given argument to an instance of Date.
196
- *
197
- * @description
198
- * Convert the given argument to an instance of Date.
199
- *
200
- * If the argument is an instance of Date, the function returns its clone.
201
- *
202
- * If the argument is a number, it is treated as a timestamp.
203
- *
204
- * If the argument is none of the above, the function returns Invalid Date.
205
- *
206
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
207
- *
208
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
209
- *
210
- * @param argument - The value to convert
211
- *
212
- * @returns The parsed date in the local time zone
213
- *
214
- * @example
215
- * // Clone the date:
216
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
217
- * //=> Tue Feb 11 2014 11:30:30
218
- *
219
- * @example
220
- * // Convert the timestamp to date:
221
- * const result = toDate(1392098430000)
222
- * //=> Tue Feb 11 2014 11:30:30
223
- */
224
- function toDate(argument) {
225
- const argStr = Object.prototype.toString.call(argument);
226
-
227
- // Clone the date
228
- if (
229
- argument instanceof Date ||
230
- (typeof argument === "object" && argStr === "[object Date]")
231
- ) {
232
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
233
- return new argument.constructor(+argument);
234
- } else if (
235
- typeof argument === "number" ||
236
- argStr === "[object Number]" ||
237
- typeof argument === "string" ||
238
- argStr === "[object String]"
239
- ) {
240
- // TODO: Can we get rid of as?
241
- return new Date(argument);
242
- } else {
243
- // TODO: Can we get rid of as?
244
- return new Date(NaN);
245
- }
246
- }
247
-
248
- let defaultOptions = {};
249
-
250
- function getDefaultOptions() {
251
- return defaultOptions;
252
- }
253
-
254
- /**
255
- * The {@link startOfWeek} function options.
256
- */
257
-
258
- /**
259
- * @name startOfWeek
260
- * @category Week Helpers
261
- * @summary Return the start of a week for the given date.
262
- *
263
- * @description
264
- * Return the start of a week for the given date.
265
- * The result will be in the local timezone.
266
- *
267
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
268
- *
269
- * @param date - The original date
270
- * @param options - An object with options
271
- *
272
- * @returns The start of a week
273
- *
274
- * @example
275
- * // The start of a week for 2 September 2014 11:55:00:
276
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
277
- * //=> Sun Aug 31 2014 00:00:00
278
- *
279
- * @example
280
- * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
281
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
282
- * //=> Mon Sep 01 2014 00:00:00
283
- */
284
- function startOfWeek(date, options) {
285
- const defaultOptions = getDefaultOptions();
286
- const weekStartsOn =
287
- options?.weekStartsOn ??
288
- options?.locale?.options?.weekStartsOn ??
289
- defaultOptions.weekStartsOn ??
290
- defaultOptions.locale?.options?.weekStartsOn ??
291
- 0;
292
-
293
- const _date = toDate(date);
294
- const day = _date.getDay();
295
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
296
-
297
- _date.setDate(_date.getDate() - diff);
298
- _date.setHours(0, 0, 0, 0);
299
- return _date;
300
- }
301
-
302
- /**
303
- * The {@link isSameWeek} function options.
304
- */
305
-
306
- /**
307
- * @name isSameWeek
308
- * @category Week Helpers
309
- * @summary Are the given dates in the same week (and month and year)?
310
- *
311
- * @description
312
- * Are the given dates in the same week (and month and year)?
313
- *
314
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
315
- *
316
- * @param dateLeft - The first date to check
317
- * @param dateRight - The second date to check
318
- * @param options - An object with options
319
- *
320
- * @returns The dates are in the same week (and month and year)
321
- *
322
- * @example
323
- * // Are 31 August 2014 and 4 September 2014 in the same week?
324
- * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))
325
- * //=> true
326
- *
327
- * @example
328
- * // If week starts with Monday,
329
- * // are 31 August 2014 and 4 September 2014 in the same week?
330
- * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {
331
- * weekStartsOn: 1
332
- * })
333
- * //=> false
334
- *
335
- * @example
336
- * // Are 1 January 2014 and 1 January 2015 in the same week?
337
- * const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1))
338
- * //=> false
339
- */
340
- function isSameWeek(dateLeft, dateRight, options) {
341
- const dateLeftStartOfWeek = startOfWeek(dateLeft, options);
342
- const dateRightStartOfWeek = startOfWeek(dateRight, options);
343
-
344
- return +dateLeftStartOfWeek === +dateRightStartOfWeek;
345
- }
346
-
347
- function declension(scheme, count) {
348
- // scheme for count=1 exists
349
- if (scheme.one !== undefined && count === 1) {
350
- return scheme.one;
351
- }
352
-
353
- const rem10 = count % 10;
354
- const rem100 = count % 100;
355
-
356
- // 1, 21, 31, ...
357
- if (rem10 === 1 && rem100 !== 11) {
358
- return scheme.singularNominative.replace("{{count}}", String(count));
359
-
360
- // 2, 3, 4, 22, 23, 24, 32 ...
361
- } else if (rem10 >= 2 && rem10 <= 4 && (rem100 < 10 || rem100 > 20)) {
362
- return scheme.singularGenitive.replace("{{count}}", String(count));
363
-
364
- // 5, 6, 7, 8, 9, 10, 11, ...
365
- } else {
366
- return scheme.pluralGenitive.replace("{{count}}", String(count));
367
- }
368
- }
369
-
370
- function buildLocalizeTokenFn(scheme) {
371
- return (count, options) => {
372
- if (options?.addSuffix) {
373
- if (options.comparison && options.comparison > 0) {
374
- if (scheme.future) {
375
- return declension(scheme.future, count);
376
- } else {
377
- return "через " + declension(scheme.regular, count);
378
- }
379
- } else {
380
- if (scheme.past) {
381
- return declension(scheme.past, count);
382
- } else {
383
- return declension(scheme.regular, count) + " назад";
384
- }
385
- }
386
- } else {
387
- return declension(scheme.regular, count);
388
- }
389
- };
390
- }
391
-
392
- const formatDistanceLocale = {
393
- lessThanXSeconds: buildLocalizeTokenFn({
394
- regular: {
395
- one: "меньше секунды",
396
- singularNominative: "меньше {{count}} секунды",
397
- singularGenitive: "меньше {{count}} секунд",
398
- pluralGenitive: "меньше {{count}} секунд",
399
- },
400
- future: {
401
- one: "меньше, чем через секунду",
402
- singularNominative: "меньше, чем через {{count}} секунду",
403
- singularGenitive: "меньше, чем через {{count}} секунды",
404
- pluralGenitive: "меньше, чем через {{count}} секунд",
405
- },
406
- }),
407
-
408
- xSeconds: buildLocalizeTokenFn({
409
- regular: {
410
- singularNominative: "{{count}} секунда",
411
- singularGenitive: "{{count}} секунды",
412
- pluralGenitive: "{{count}} секунд",
413
- },
414
- past: {
415
- singularNominative: "{{count}} секунду назад",
416
- singularGenitive: "{{count}} секунды назад",
417
- pluralGenitive: "{{count}} секунд назад",
418
- },
419
- future: {
420
- singularNominative: "через {{count}} секунду",
421
- singularGenitive: "через {{count}} секунды",
422
- pluralGenitive: "через {{count}} секунд",
423
- },
424
- }),
425
-
426
- halfAMinute: (_count, options) => {
427
- if (options?.addSuffix) {
428
- if (options.comparison && options.comparison > 0) {
429
- return "через полминуты";
430
- } else {
431
- return "полминуты назад";
432
- }
433
- }
434
-
435
- return "полминуты";
436
- },
437
-
438
- lessThanXMinutes: buildLocalizeTokenFn({
439
- regular: {
440
- one: "меньше минуты",
441
- singularNominative: "меньше {{count}} минуты",
442
- singularGenitive: "меньше {{count}} минут",
443
- pluralGenitive: "меньше {{count}} минут",
444
- },
445
- future: {
446
- one: "меньше, чем через минуту",
447
- singularNominative: "меньше, чем через {{count}} минуту",
448
- singularGenitive: "меньше, чем через {{count}} минуты",
449
- pluralGenitive: "меньше, чем через {{count}} минут",
450
- },
451
- }),
452
-
453
- xMinutes: buildLocalizeTokenFn({
454
- regular: {
455
- singularNominative: "{{count}} минута",
456
- singularGenitive: "{{count}} минуты",
457
- pluralGenitive: "{{count}} минут",
458
- },
459
- past: {
460
- singularNominative: "{{count}} минуту назад",
461
- singularGenitive: "{{count}} минуты назад",
462
- pluralGenitive: "{{count}} минут назад",
463
- },
464
- future: {
465
- singularNominative: "через {{count}} минуту",
466
- singularGenitive: "через {{count}} минуты",
467
- pluralGenitive: "через {{count}} минут",
468
- },
469
- }),
470
-
471
- aboutXHours: buildLocalizeTokenFn({
472
- regular: {
473
- singularNominative: "около {{count}} часа",
474
- singularGenitive: "около {{count}} часов",
475
- pluralGenitive: "около {{count}} часов",
476
- },
477
- future: {
478
- singularNominative: "приблизительно через {{count}} час",
479
- singularGenitive: "приблизительно через {{count}} часа",
480
- pluralGenitive: "приблизительно через {{count}} часов",
481
- },
482
- }),
483
-
484
- xHours: buildLocalizeTokenFn({
485
- regular: {
486
- singularNominative: "{{count}} час",
487
- singularGenitive: "{{count}} часа",
488
- pluralGenitive: "{{count}} часов",
489
- },
490
- }),
491
-
492
- xDays: buildLocalizeTokenFn({
493
- regular: {
494
- singularNominative: "{{count}} день",
495
- singularGenitive: "{{count}} дня",
496
- pluralGenitive: "{{count}} дней",
497
- },
498
- }),
499
-
500
- aboutXWeeks: buildLocalizeTokenFn({
501
- regular: {
502
- singularNominative: "около {{count}} недели",
503
- singularGenitive: "около {{count}} недель",
504
- pluralGenitive: "около {{count}} недель",
505
- },
506
- future: {
507
- singularNominative: "приблизительно через {{count}} неделю",
508
- singularGenitive: "приблизительно через {{count}} недели",
509
- pluralGenitive: "приблизительно через {{count}} недель",
510
- },
511
- }),
512
-
513
- xWeeks: buildLocalizeTokenFn({
514
- regular: {
515
- singularNominative: "{{count}} неделя",
516
- singularGenitive: "{{count}} недели",
517
- pluralGenitive: "{{count}} недель",
518
- },
519
- }),
520
-
521
- aboutXMonths: buildLocalizeTokenFn({
522
- regular: {
523
- singularNominative: "около {{count}} месяца",
524
- singularGenitive: "около {{count}} месяцев",
525
- pluralGenitive: "около {{count}} месяцев",
526
- },
527
- future: {
528
- singularNominative: "приблизительно через {{count}} месяц",
529
- singularGenitive: "приблизительно через {{count}} месяца",
530
- pluralGenitive: "приблизительно через {{count}} месяцев",
531
- },
532
- }),
533
-
534
- xMonths: buildLocalizeTokenFn({
535
- regular: {
536
- singularNominative: "{{count}} месяц",
537
- singularGenitive: "{{count}} месяца",
538
- pluralGenitive: "{{count}} месяцев",
539
- },
540
- }),
541
-
542
- aboutXYears: buildLocalizeTokenFn({
543
- regular: {
544
- singularNominative: "около {{count}} года",
545
- singularGenitive: "около {{count}} лет",
546
- pluralGenitive: "около {{count}} лет",
547
- },
548
- future: {
549
- singularNominative: "приблизительно через {{count}} год",
550
- singularGenitive: "приблизительно через {{count}} года",
551
- pluralGenitive: "приблизительно через {{count}} лет",
552
- },
553
- }),
554
-
555
- xYears: buildLocalizeTokenFn({
556
- regular: {
557
- singularNominative: "{{count}} год",
558
- singularGenitive: "{{count}} года",
559
- pluralGenitive: "{{count}} лет",
560
- },
561
- }),
562
-
563
- overXYears: buildLocalizeTokenFn({
564
- regular: {
565
- singularNominative: "больше {{count}} года",
566
- singularGenitive: "больше {{count}} лет",
567
- pluralGenitive: "больше {{count}} лет",
568
- },
569
- future: {
570
- singularNominative: "больше, чем через {{count}} год",
571
- singularGenitive: "больше, чем через {{count}} года",
572
- pluralGenitive: "больше, чем через {{count}} лет",
573
- },
574
- }),
575
-
576
- almostXYears: buildLocalizeTokenFn({
577
- regular: {
578
- singularNominative: "почти {{count}} год",
579
- singularGenitive: "почти {{count}} года",
580
- pluralGenitive: "почти {{count}} лет",
581
- },
582
- future: {
583
- singularNominative: "почти через {{count}} год",
584
- singularGenitive: "почти через {{count}} года",
585
- pluralGenitive: "почти через {{count}} лет",
586
- },
587
- }),
588
- };
589
-
590
- const formatDistance = (token, count, options) => {
591
- return formatDistanceLocale[token](count, options);
592
- };
593
-
594
- const dateFormats = {
595
- full: "EEEE, d MMMM y 'г.'",
596
- long: "d MMMM y 'г.'",
597
- medium: "d MMM y 'г.'",
598
- short: "dd.MM.y",
599
- };
600
-
601
- const timeFormats = {
602
- full: "H:mm:ss zzzz",
603
- long: "H:mm:ss z",
604
- medium: "H:mm:ss",
605
- short: "H:mm",
606
- };
607
-
608
- const dateTimeFormats = {
609
- any: "{{date}}, {{time}}",
610
- };
611
-
612
- const formatLong = {
613
- date: buildFormatLongFn({
614
- formats: dateFormats,
615
- defaultWidth: "full",
616
- }),
617
-
618
- time: buildFormatLongFn({
619
- formats: timeFormats,
620
- defaultWidth: "full",
621
- }),
622
-
623
- dateTime: buildFormatLongFn({
624
- formats: dateTimeFormats,
625
- defaultWidth: "any",
626
- }),
627
- };
628
-
629
- const accusativeWeekdays = [
630
- "воскресенье",
631
- "понедельник",
632
- "вторник",
633
- "среду",
634
- "четверг",
635
- "пятницу",
636
- "субботу",
637
- ];
638
-
639
- function lastWeek(day) {
640
- const weekday = accusativeWeekdays[day];
641
-
642
- switch (day) {
643
- case 0:
644
- return "'в прошлое " + weekday + " в' p";
645
- case 1:
646
- case 2:
647
- case 4:
648
- return "'в прошлый " + weekday + " в' p";
649
- case 3:
650
- case 5:
651
- case 6:
652
- return "'в прошлую " + weekday + " в' p";
653
- }
654
- }
655
-
656
- function thisWeek(day) {
657
- const weekday = accusativeWeekdays[day];
658
-
659
- if (day === 2 /* Tue */) {
660
- return "'во " + weekday + " в' p";
661
- } else {
662
- return "'в " + weekday + " в' p";
663
- }
664
- }
665
-
666
- function nextWeek(day) {
667
- const weekday = accusativeWeekdays[day];
668
-
669
- switch (day) {
670
- case 0:
671
- return "'в следующее " + weekday + " в' p";
672
- case 1:
673
- case 2:
674
- case 4:
675
- return "'в следующий " + weekday + " в' p";
676
- case 3:
677
- case 5:
678
- case 6:
679
- return "'в следующую " + weekday + " в' p";
680
- }
681
- }
682
-
683
- const formatRelativeLocale = {
684
- lastWeek: (date, baseDate, options) => {
685
- const day = date.getDay();
686
- if (isSameWeek(date, baseDate, options)) {
687
- return thisWeek(day);
688
- } else {
689
- return lastWeek(day);
690
- }
691
- },
692
- yesterday: "'вчера в' p",
693
- today: "'сегодня в' p",
694
- tomorrow: "'завтра в' p",
695
- nextWeek: (date, baseDate, options) => {
696
- const day = date.getDay();
697
- if (isSameWeek(date, baseDate, options)) {
698
- return thisWeek(day);
699
- } else {
700
- return nextWeek(day);
701
- }
702
- },
703
- other: "P",
704
- };
705
-
706
- const formatRelative = (token, date, baseDate, options) => {
707
- const format = formatRelativeLocale[token];
708
-
709
- if (typeof format === "function") {
710
- return format(date, baseDate, options);
711
- }
712
-
713
- return format;
714
- };
715
-
716
- const eraValues = {
717
- narrow: ["до н.э.", "н.э."],
718
- abbreviated: ["до н. э.", "н. э."],
719
- wide: ["до нашей эры", "нашей эры"],
720
- };
721
-
722
- const quarterValues = {
723
- narrow: ["1", "2", "3", "4"],
724
- abbreviated: ["1-й кв.", "2-й кв.", "3-й кв.", "4-й кв."],
725
- wide: ["1-й квартал", "2-й квартал", "3-й квартал", "4-й квартал"],
726
- };
727
-
728
- const monthValues = {
729
- narrow: ["Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"],
730
- abbreviated: [
731
- "янв.",
732
- "фев.",
733
- "март",
734
- "апр.",
735
- "май",
736
- "июнь",
737
- "июль",
738
- "авг.",
739
- "сент.",
740
- "окт.",
741
- "нояб.",
742
- "дек.",
743
- ],
744
-
745
- wide: [
746
- "январь",
747
- "февраль",
748
- "март",
749
- "апрель",
750
- "май",
751
- "июнь",
752
- "июль",
753
- "август",
754
- "сентябрь",
755
- "октябрь",
756
- "ноябрь",
757
- "декабрь",
758
- ],
759
- };
760
-
761
- const formattingMonthValues = {
762
- narrow: ["Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"],
763
- abbreviated: [
764
- "янв.",
765
- "фев.",
766
- "мар.",
767
- "апр.",
768
- "мая",
769
- "июн.",
770
- "июл.",
771
- "авг.",
772
- "сент.",
773
- "окт.",
774
- "нояб.",
775
- "дек.",
776
- ],
777
-
778
- wide: [
779
- "января",
780
- "февраля",
781
- "марта",
782
- "апреля",
783
- "мая",
784
- "июня",
785
- "июля",
786
- "августа",
787
- "сентября",
788
- "октября",
789
- "ноября",
790
- "декабря",
791
- ],
792
- };
793
-
794
- const dayValues = {
795
- narrow: ["В", "П", "В", "С", "Ч", "П", "С"],
796
- short: ["вс", "пн", "вт", "ср", "чт", "пт", "сб"],
797
- abbreviated: ["вск", "пнд", "втр", "срд", "чтв", "птн", "суб"],
798
- wide: [
799
- "воскресенье",
800
- "понедельник",
801
- "вторник",
802
- "среда",
803
- "четверг",
804
- "пятница",
805
- "суббота",
806
- ],
807
- };
808
-
809
- const dayPeriodValues = {
810
- narrow: {
811
- am: "ДП",
812
- pm: "ПП",
813
- midnight: "полн.",
814
- noon: "полд.",
815
- morning: "утро",
816
- afternoon: "день",
817
- evening: "веч.",
818
- night: "ночь",
819
- },
820
- abbreviated: {
821
- am: "ДП",
822
- pm: "ПП",
823
- midnight: "полн.",
824
- noon: "полд.",
825
- morning: "утро",
826
- afternoon: "день",
827
- evening: "веч.",
828
- night: "ночь",
829
- },
830
- wide: {
831
- am: "ДП",
832
- pm: "ПП",
833
- midnight: "полночь",
834
- noon: "полдень",
835
- morning: "утро",
836
- afternoon: "день",
837
- evening: "вечер",
838
- night: "ночь",
839
- },
840
- };
841
-
842
- const formattingDayPeriodValues = {
843
- narrow: {
844
- am: "ДП",
845
- pm: "ПП",
846
- midnight: "полн.",
847
- noon: "полд.",
848
- morning: "утра",
849
- afternoon: "дня",
850
- evening: "веч.",
851
- night: "ночи",
852
- },
853
- abbreviated: {
854
- am: "ДП",
855
- pm: "ПП",
856
- midnight: "полн.",
857
- noon: "полд.",
858
- morning: "утра",
859
- afternoon: "дня",
860
- evening: "веч.",
861
- night: "ночи",
862
- },
863
- wide: {
864
- am: "ДП",
865
- pm: "ПП",
866
- midnight: "полночь",
867
- noon: "полдень",
868
- morning: "утра",
869
- afternoon: "дня",
870
- evening: "вечера",
871
- night: "ночи",
872
- },
873
- };
874
-
875
- const ordinalNumber = (dirtyNumber, options) => {
876
- const number = Number(dirtyNumber);
877
- const unit = options?.unit;
878
-
879
- let suffix;
880
- if (unit === "date") {
881
- suffix = "-е";
882
- } else if (unit === "week" || unit === "minute" || unit === "second") {
883
- suffix = "-я";
884
- } else {
885
- suffix = "-й";
886
- }
887
-
888
- return number + suffix;
889
- };
890
-
891
- const localize = {
892
- ordinalNumber,
893
-
894
- era: buildLocalizeFn({
895
- values: eraValues,
896
- defaultWidth: "wide",
897
- }),
898
-
899
- quarter: buildLocalizeFn({
900
- values: quarterValues,
901
- defaultWidth: "wide",
902
- argumentCallback: (quarter) => quarter - 1,
903
- }),
904
-
905
- month: buildLocalizeFn({
906
- values: monthValues,
907
- defaultWidth: "wide",
908
- formattingValues: formattingMonthValues,
909
- defaultFormattingWidth: "wide",
910
- }),
911
-
912
- day: buildLocalizeFn({
913
- values: dayValues,
914
- defaultWidth: "wide",
915
- }),
916
-
917
- dayPeriod: buildLocalizeFn({
918
- values: dayPeriodValues,
919
- defaultWidth: "any",
920
- formattingValues: formattingDayPeriodValues,
921
- defaultFormattingWidth: "wide",
922
- }),
923
- };
924
-
925
- const matchOrdinalNumberPattern = /^(\d+)(-?(е|я|й|ое|ье|ая|ья|ый|ой|ий|ый))?/i;
926
- const parseOrdinalNumberPattern = /\d+/i;
927
-
928
- const matchEraPatterns = {
929
- narrow: /^((до )?н\.?\s?э\.?)/i,
930
- abbreviated: /^((до )?н\.?\s?э\.?)/i,
931
- wide: /^(до нашей эры|нашей эры|наша эра)/i,
932
- };
933
- const parseEraPatterns = {
934
- any: [/^д/i, /^н/i],
935
- };
936
-
937
- const matchQuarterPatterns = {
938
- narrow: /^[1234]/i,
939
- abbreviated: /^[1234](-?[ыои]?й?)? кв.?/i,
940
- wide: /^[1234](-?[ыои]?й?)? квартал/i,
941
- };
942
-
943
- const parseQuarterPatterns = {
944
- any: [/1/i, /2/i, /3/i, /4/i],
945
- };
946
-
947
- const matchMonthPatterns = {
948
- narrow: /^[яфмаисонд]/i,
949
- abbreviated:
950
- /^(янв|фев|март?|апр|ма[йя]|июн[ья]?|июл[ья]?|авг|сент?|окт|нояб?|дек)\.?/i,
951
- wide: /^(январ[ья]|феврал[ья]|марта?|апрел[ья]|ма[йя]|июн[ья]|июл[ья]|августа?|сентябр[ья]|октябр[ья]|октябр[ья]|ноябр[ья]|декабр[ья])/i,
952
- };
953
-
954
- const parseMonthPatterns = {
955
- narrow: [
956
- /^я/i,
957
- /^ф/i,
958
- /^м/i,
959
- /^а/i,
960
- /^м/i,
961
- /^и/i,
962
- /^и/i,
963
- /^а/i,
964
- /^с/i,
965
- /^о/i,
966
- /^н/i,
967
- /^я/i,
968
- ],
969
-
970
- any: [
971
- /^я/i,
972
- /^ф/i,
973
- /^мар/i,
974
- /^ап/i,
975
- /^ма[йя]/i,
976
- /^июн/i,
977
- /^июл/i,
978
- /^ав/i,
979
- /^с/i,
980
- /^о/i,
981
- /^н/i,
982
- /^д/i,
983
- ],
984
- };
985
-
986
- const matchDayPatterns = {
987
- narrow: /^[впсч]/i,
988
- short: /^(вс|во|пн|по|вт|ср|чт|че|пт|пя|сб|су)\.?/i,
989
- abbreviated: /^(вск|вос|пнд|пон|втр|вто|срд|сре|чтв|чет|птн|пят|суб).?/i,
990
- wide: /^(воскресень[ея]|понедельника?|вторника?|сред[аы]|четверга?|пятниц[аы]|суббот[аы])/i,
991
- };
992
-
993
- const parseDayPatterns = {
994
- narrow: [/^в/i, /^п/i, /^в/i, /^с/i, /^ч/i, /^п/i, /^с/i],
995
- any: [/^в[ос]/i, /^п[он]/i, /^в/i, /^ср/i, /^ч/i, /^п[ят]/i, /^с[уб]/i],
996
- };
997
-
998
- const matchDayPeriodPatterns = {
999
- narrow: /^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,
1000
- abbreviated: /^([дп]п|полн\.?|полд\.?|утр[оа]|день|дня|веч\.?|ноч[ьи])/i,
1001
- wide: /^([дп]п|полночь|полдень|утр[оа]|день|дня|вечера?|ноч[ьи])/i,
1002
- };
1003
-
1004
- const parseDayPeriodPatterns = {
1005
- any: {
1006
- am: /^дп/i,
1007
- pm: /^пп/i,
1008
- midnight: /^полн/i,
1009
- noon: /^полд/i,
1010
- morning: /^у/i,
1011
- afternoon: /^д[ен]/i,
1012
- evening: /^в/i,
1013
- night: /^н/i,
1014
- },
1015
- };
1016
-
1017
- const match = {
1018
- ordinalNumber: buildMatchPatternFn({
1019
- matchPattern: matchOrdinalNumberPattern,
1020
- parsePattern: parseOrdinalNumberPattern,
1021
- valueCallback: (value) => parseInt(value, 10),
1022
- }),
1023
-
1024
- era: buildMatchFn({
1025
- matchPatterns: matchEraPatterns,
1026
- defaultMatchWidth: "wide",
1027
- parsePatterns: parseEraPatterns,
1028
- defaultParseWidth: "any",
1029
- }),
1030
-
1031
- quarter: buildMatchFn({
1032
- matchPatterns: matchQuarterPatterns,
1033
- defaultMatchWidth: "wide",
1034
- parsePatterns: parseQuarterPatterns,
1035
- defaultParseWidth: "any",
1036
- valueCallback: (index) => index + 1,
1037
- }),
1038
-
1039
- month: buildMatchFn({
1040
- matchPatterns: matchMonthPatterns,
1041
- defaultMatchWidth: "wide",
1042
- parsePatterns: parseMonthPatterns,
1043
- defaultParseWidth: "any",
1044
- }),
1045
-
1046
- day: buildMatchFn({
1047
- matchPatterns: matchDayPatterns,
1048
- defaultMatchWidth: "wide",
1049
- parsePatterns: parseDayPatterns,
1050
- defaultParseWidth: "any",
1051
- }),
1052
-
1053
- dayPeriod: buildMatchFn({
1054
- matchPatterns: matchDayPeriodPatterns,
1055
- defaultMatchWidth: "wide",
1056
- parsePatterns: parseDayPeriodPatterns,
1057
- defaultParseWidth: "any",
1058
- }),
1059
- };
1060
-
1061
- /**
1062
- * @category Locales
1063
- * @summary Russian locale.
1064
- * @language Russian
1065
- * @iso-639-2 rus
1066
- * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
1067
- * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
1068
- */
1069
- const ru = {
1070
- code: "ru",
1071
- formatDistance: formatDistance,
1072
- formatLong: formatLong,
1073
- formatRelative: formatRelative,
1074
- localize: localize,
1075
- match: match,
1076
- options: {
1077
- weekStartsOn: 1 /* Monday */,
1078
- firstWeekContainsDate: 1,
1079
- },
1080
- };
1081
-
1082
40
  var datePickerConfig = {
1083
41
  appearance: index.datePickerAppearance,
1084
42
  setAppearance: function (newComponent) {
@@ -1160,7 +118,7 @@ function DatePickerInput(props) {
1160
118
  var datePickerStyles = useStyles.useStyles(props).styles;
1161
119
  return (jsxRuntime.jsx("div", { className: clsx(className, 'datepicker', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.monthsShown) && 'datepicker_type_multiple-months', (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.customTimeInput) && 'datepicker_type_button', widthClass ||
1162
120
  ((appearanceConfig === null || appearanceConfig === void 0 ? void 0 : appearanceConfig.datePicker.width) &&
1163
- ((_a = "datepicker_width_".concat(appearanceConfig.datePicker.width)) === null || _a === void 0 ? void 0 : _a.replace(/([A-Z])/g, '-$1').toLowerCase()))), style: datePickerStyles, children: jsxRuntime.jsx(DatePicker, tslib_es6.__assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsxRuntime.jsx(DatePickerCustomInput, { datePickerAppearance: appearance, labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
121
+ ((_a = "datepicker_width_".concat(appearanceConfig.datePicker.width)) === null || _a === void 0 ? void 0 : _a.replace(/([A-Z])/g, '-$1').toLowerCase()))), style: datePickerStyles, children: jsxRuntime.jsx(DatePicker, tslib_es6.__assign({ ref: datepickerRef, endDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? endDate : undefined, locale: locale.ru, minDate: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.disablePastDays) ? new Date() : undefined, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, customInput: jsxRuntime.jsx(DatePickerCustomInput, { datePickerAppearance: appearance, labelTextSize: labelTextSize, clearIcon: clearIcon, clearIconFill: clearIconFill, clearIconFillHover: clearIconFillHover, clearIconFillSize: clearIconFillSize, clearIconItemFill: clearIconItemFill, clearIconItemFillHover: clearIconItemFillHover, clearIconShape: clearIconShape, clearIconSize: clearIconSize, clearIconSrc: clearIconSrc, clearLabel: clearLabel, clearLabelTextColor: clearLabelTextColor, clearLabelTextColorHover: clearLabelTextColorHover, clearLabelTextSize: clearLabelTextSize, datepickerRef: datepickerRef, inputIcon: datePickerProps.inputIcon, inputIconFill: datePickerProps.inputIconFill, inputIconFillHover: datePickerProps.inputIconFillHover, inputIconFillSize: datePickerProps.inputIconFillSize, inputIconItemFill: datePickerProps.inputIconItemFill, inputIconShape: datePickerProps.inputIconShape, inputIconSize: datePickerProps.inputIconSize, inputIconSrc: datePickerProps.inputIconSrc, inputProps: inputProps, isClearable: datePickerProps.isClearable }), popperClassName: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.popper) && "react-datepicker-popper-".concat(datePickerProps.popper), onChange: (datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.selectsRange) ? handleChange : onChange }, datePickerProps, {
1164
122
  // Important for use custom clear button
1165
123
  isClearable: false })) }));
1166
124
  }