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