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