@sima-land/ui-nucleons 44.2.10 → 45.0.0-alpha.1

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 (378) hide show
  1. package/_internal/custom-scrollbar/index.d.ts +13 -7
  2. package/_internal/custom-scrollbar/index.js +29 -15
  3. package/_internal/dropdown-loading/index.d.ts +3 -3
  4. package/_internal/dropdown-loading/index.js +4 -2
  5. package/_internal/page-scroll-lock/adapters/body-scroll-lock.d.ts +39 -0
  6. package/_internal/page-scroll-lock/adapters/body-scroll-lock.js +62 -0
  7. package/_internal/page-scroll-lock/adapters/ui-nucleons.d.ts +25 -0
  8. package/_internal/page-scroll-lock/adapters/ui-nucleons.js +103 -0
  9. package/_internal/page-scroll-lock/context.d.ts +13 -0
  10. package/_internal/page-scroll-lock/context.js +54 -0
  11. package/_internal/page-scroll-lock/hook.d.ts +12 -0
  12. package/_internal/page-scroll-lock/hook.js +26 -0
  13. package/_internal/page-scroll-lock/index.d.ts +4 -0
  14. package/_internal/page-scroll-lock/index.js +9 -0
  15. package/_internal/page-scroll-lock/types.d.ts +22 -0
  16. package/_internal/readme.md +2 -0
  17. package/_internal/utils/dropdown.d.ts +1 -0
  18. package/_internal/utils/dropdown.js +1 -0
  19. package/alert/alert.module.scss +1 -24
  20. package/alert/index.d.ts +11 -17
  21. package/alert/index.js +33 -16
  22. package/arrow-button/arrow-button.module.scss +2 -0
  23. package/arrow-button/index.d.ts +2 -2
  24. package/autocomplete/autocomplete.d.ts +8 -0
  25. package/autocomplete/autocomplete.js +190 -0
  26. package/autocomplete/autocomplete.module.scss +2 -15
  27. package/autocomplete/index.d.ts +2 -27
  28. package/autocomplete/index.js +2 -126
  29. package/autocomplete/types.d.ts +19 -0
  30. package/autocomplete/types.js +2 -0
  31. package/autocomplete-deprecated/autocomplete.module.scss +20 -0
  32. package/autocomplete-deprecated/index.d.ts +28 -0
  33. package/autocomplete-deprecated/index.js +130 -0
  34. package/avatar/index.d.ts +2 -2
  35. package/avatar/user.d.ts +1 -1
  36. package/base-input/base-input.d.ts +11 -0
  37. package/base-input/base-input.js +96 -0
  38. package/base-input/base-input.module.scss +3 -3
  39. package/base-input/index.d.ts +2 -23
  40. package/base-input/index.js +2 -76
  41. package/base-input/types.d.ts +31 -0
  42. package/base-input/types.js +2 -0
  43. package/base-input/utils.d.ts +6 -0
  44. package/base-input/utils.js +14 -0
  45. package/base-input-deprecated/base-input.module.scss +66 -0
  46. package/base-input-deprecated/index.d.ts +24 -0
  47. package/base-input-deprecated/index.js +80 -0
  48. package/bordered-layout/index.d.ts +1 -0
  49. package/bordered-layout/index.js +1 -0
  50. package/bottom-bar/bottom-bar-util.scss +20 -0
  51. package/bottom-bar/bottom-bar.d.ts +12 -0
  52. package/bottom-bar/bottom-bar.js +47 -0
  53. package/bottom-bar/bottom-bar.module.scss +14 -0
  54. package/bottom-bar/index.d.ts +2 -21
  55. package/bottom-bar/index.js +5 -44
  56. package/bottom-bar/types.d.ts +10 -0
  57. package/bottom-bar/types.js +2 -0
  58. package/box/index.d.ts +1 -1
  59. package/breakpoints.scss +34 -3
  60. package/button/button.module.scss +70 -53
  61. package/button/index.d.ts +26 -41
  62. package/button/index.js +22 -46
  63. package/card/index.d.ts +2 -1
  64. package/card/index.js +23 -6
  65. package/card/slots.d.ts +17 -3
  66. package/card/slots.js +15 -13
  67. package/carousel/draggable.d.ts +7 -3
  68. package/carousel/draggable.js +10 -3
  69. package/carousel/helpers/draggable-event.d.ts +5 -2
  70. package/carousel/helpers/draggable-event.js +5 -0
  71. package/carousel/index.d.ts +1 -1
  72. package/carousel/index.js +24 -24
  73. package/checkbox/checkbox.module.scss +1 -0
  74. package/checkbox/index.d.ts +3 -3
  75. package/checkbox-field/index.d.ts +3 -0
  76. package/checkbox-field/index.js +3 -0
  77. package/clean-buttons/clean-buttons-util.scss +15 -0
  78. package/clean-buttons/clean-buttons.module.scss +5 -3
  79. package/clean-buttons/index.d.ts +16 -7
  80. package/clean-buttons/index.js +17 -14
  81. package/clean-buttons/types.d.ts +1 -1
  82. package/clean-buttons/utils.d.ts +5 -1
  83. package/clean-buttons/utils.js +4 -0
  84. package/{colors.d.ts → colors/index.d.ts} +2 -2
  85. package/{colors.js → colors/index.js} +2 -1
  86. package/colors.scss +2 -0
  87. package/dot-nav/index.d.ts +1 -1
  88. package/dropdown/index.d.ts +1 -0
  89. package/dropdown/utils.d.ts +19 -0
  90. package/dropdown/utils.js +47 -0
  91. package/dropdown-item/dropdown-item.module.scss +80 -15
  92. package/dropdown-item/index.d.ts +20 -9
  93. package/dropdown-item/index.js +12 -9
  94. package/dropdown-item/types.d.ts +3 -0
  95. package/dropdown-item/types.js +2 -0
  96. package/dropdown-item/utils.d.ts +45 -0
  97. package/dropdown-item/utils.js +89 -0
  98. package/expandable/utils.js +3 -3
  99. package/field-block/field-block.module.scss +155 -0
  100. package/field-block/index.d.ts +63 -0
  101. package/field-block/index.js +43 -0
  102. package/field-grid/index.d.ts +5 -4
  103. package/field-grid/index.js +1 -0
  104. package/helpers/bounds-of.d.ts +5 -1
  105. package/helpers/bounds-of.js +5 -0
  106. package/helpers/center-of.d.ts +4 -1
  107. package/helpers/center-of.js +8 -1
  108. package/helpers/create-container.d.ts +5 -2
  109. package/helpers/create-container.js +7 -2
  110. package/helpers/define-slots.d.ts +3 -3
  111. package/helpers/define-slots.js +5 -3
  112. package/helpers/events.d.ts +16 -8
  113. package/helpers/events.js +41 -15
  114. package/helpers/find-child-element.d.ts +12 -9
  115. package/helpers/find-child-element.js +9 -5
  116. package/helpers/find-offset-parent.d.ts +1 -2
  117. package/helpers/find-offset-parent.js +2 -2
  118. package/helpers/find-sibling-index.d.ts +11 -8
  119. package/helpers/find-sibling-index.js +8 -3
  120. package/helpers/fit-element-height.d.ts +5 -5
  121. package/helpers/fit-element-height.js +9 -7
  122. package/helpers/format-date.d.ts +11 -11
  123. package/helpers/format-date.js +15 -13
  124. package/helpers/format-number.d.ts +1 -1
  125. package/helpers/format-number.js +2 -2
  126. package/helpers/get-date-interval-data.d.ts +4 -1
  127. package/helpers/get-date-interval-data.js +7 -2
  128. package/helpers/get-declination.d.ts +5 -1
  129. package/helpers/get-declination.js +5 -0
  130. package/helpers/get-fraction-depth.d.ts +1 -1
  131. package/helpers/get-fraction-depth.js +2 -2
  132. package/helpers/get-no-index.d.ts +2 -2
  133. package/helpers/get-no-index.js +4 -3
  134. package/helpers/get-relative-pos.d.ts +4 -1
  135. package/helpers/get-relative-pos.js +7 -2
  136. package/helpers/get-scroll-parent.d.ts +1 -2
  137. package/helpers/get-scroll-parent.js +5 -5
  138. package/helpers/is-browser.d.ts +4 -1
  139. package/helpers/is-browser.js +8 -1
  140. package/helpers/is-fully-scrolled.d.ts +3 -3
  141. package/helpers/is-fully-scrolled.js +2 -2
  142. package/helpers/is-touch-device.d.ts +1 -1
  143. package/helpers/is-touch-device.js +4 -5
  144. package/helpers/layer.d.ts +1 -1
  145. package/helpers/layer.js +2 -2
  146. package/helpers/max-index-of.d.ts +4 -1
  147. package/helpers/max-index-of.js +7 -2
  148. package/helpers/media-query-list.d.ts +1 -1
  149. package/helpers/media-query-list.js +2 -2
  150. package/helpers/on.d.ts +4 -1
  151. package/helpers/on.js +7 -2
  152. package/helpers/point.d.ts +4 -1
  153. package/helpers/point.js +8 -1
  154. package/helpers/rename.d.ts +3 -1
  155. package/helpers/rename.js +1 -0
  156. package/helpers/scroll-to-child.d.ts +1 -1
  157. package/helpers/scroll-to-child.js +3 -2
  158. package/helpers/styles.d.ts +8 -2
  159. package/helpers/styles.js +18 -4
  160. package/helpers/with-prevent.d.ts +9 -6
  161. package/helpers/with-prevent.js +16 -9
  162. package/hint/hint-view.d.ts +26 -0
  163. package/hint/hint-view.js +43 -0
  164. package/hint/hint-view.module.scss +32 -0
  165. package/hint/hint.d.ts +14 -0
  166. package/hint/hint.js +41 -0
  167. package/hint/index.d.ts +5 -8
  168. package/hint/index.js +13 -48
  169. package/hint/utils.d.ts +61 -0
  170. package/hint/utils.js +161 -0
  171. package/hint-deprecated/index.d.ts +11 -0
  172. package/hint-deprecated/index.js +53 -0
  173. package/hooks/breakpoint/index.d.ts +7 -4
  174. package/hooks/breakpoint/index.js +21 -13
  175. package/hooks/breakpoint/types.d.ts +3 -4
  176. package/hooks/breakpoint/utils.d.ts +2 -1
  177. package/hooks/breakpoint/utils.js +2 -1
  178. package/hooks/index.d.ts +8 -8
  179. package/hooks/index.js +27 -19
  180. package/hooks/intersection/test-utils.d.ts +1 -1
  181. package/hooks/intersection/test-utils.js +2 -1
  182. package/hooks/styles.d.ts +6 -0
  183. package/hooks/styles.js +26 -0
  184. package/info-text/index.d.ts +23 -0
  185. package/info-text/index.js +60 -0
  186. package/info-text/info-text.module.scss +28 -0
  187. package/input/index.d.ts +32 -0
  188. package/input/index.js +96 -0
  189. package/input/input.module.scss +20 -0
  190. package/input/utils.d.ts +36 -0
  191. package/input/utils.js +71 -0
  192. package/layout/index.d.ts +6 -11
  193. package/layout/index.js +6 -60
  194. package/layout/layout.d.ts +10 -0
  195. package/layout/layout.js +32 -0
  196. package/layout/layout.module.scss +33 -26
  197. package/layout/legacy.d.ts +15 -0
  198. package/layout/legacy.js +68 -0
  199. package/layout/legacy.module.scss +49 -0
  200. package/layout/types.d.ts +6 -0
  201. package/layout/types.js +2 -0
  202. package/link/index.d.ts +4 -1
  203. package/link/index.js +2 -2
  204. package/link/link-util.scss +37 -0
  205. package/link/link.module.scss +19 -12
  206. package/loading-overlay/index.d.ts +1 -0
  207. package/loading-overlay/index.js +1 -0
  208. package/masked-field/index.d.ts +1 -0
  209. package/masked-field/index.js +1 -0
  210. package/masked-input/hook.d.ts +8 -0
  211. package/masked-input/hook.js +72 -0
  212. package/masked-input/index.d.ts +5 -0
  213. package/masked-input/index.js +7 -0
  214. package/masked-input/masked-input.d.ts +8 -0
  215. package/masked-input/masked-input.js +73 -0
  216. package/masked-input/types.d.ts +51 -0
  217. package/masked-input/types.js +2 -0
  218. package/masked-input/utils.d.ts +15 -0
  219. package/masked-input/utils.js +49 -0
  220. package/modal/index.d.ts +10 -12
  221. package/modal/index.js +27 -64
  222. package/modal/modal.module.scss +98 -55
  223. package/modal/slots.d.ts +13 -10
  224. package/modal/slots.js +30 -28
  225. package/modal/utils.d.ts +8 -10
  226. package/modal/utils.js +2 -26
  227. package/modal-overlay/index.d.ts +13 -0
  228. package/modal-overlay/index.js +60 -0
  229. package/modal-overlay/modal-overlay-util.scss +1 -0
  230. package/modal-overlay/modal-overlay.module.scss +14 -0
  231. package/modal-overlay/utils.d.ts +14 -0
  232. package/modal-overlay/utils.js +32 -0
  233. package/package.json +49 -41
  234. package/pagination/utils.d.ts +2 -2
  235. package/panel/index.d.ts +27 -13
  236. package/panel/index.js +43 -9
  237. package/panel/panel.module.scss +49 -8
  238. package/phone-input/index.d.ts +4 -28
  239. package/phone-input/index.js +2 -121
  240. package/phone-input/phone-input.d.ts +8 -0
  241. package/phone-input/phone-input.js +133 -0
  242. package/phone-input/phone-input.module.scss +8 -32
  243. package/phone-input/presets.d.ts +21 -22
  244. package/phone-input/presets.js +1 -2
  245. package/phone-input/types.d.ts +6 -0
  246. package/phone-input/types.js +2 -0
  247. package/phone-input/utils.d.ts +30 -1
  248. package/phone-input/utils.js +52 -3
  249. package/phone-input-deprecated/index.d.ts +29 -0
  250. package/phone-input-deprecated/index.js +124 -0
  251. package/phone-input-deprecated/phone-input.module.scss +41 -0
  252. package/plate/index.d.ts +3 -3
  253. package/plate/index.js +2 -2
  254. package/plate/plate.module.scss +3 -0
  255. package/popup/index.d.ts +5 -0
  256. package/popup/index.js +12 -0
  257. package/popup/popup-view.d.ts +14 -0
  258. package/popup/popup-view.js +35 -0
  259. package/popup/popup-view.module.scss +40 -0
  260. package/popup/popup.d.ts +17 -0
  261. package/popup/popup.js +73 -0
  262. package/popup/utils.d.ts +38 -0
  263. package/popup/utils.js +83 -0
  264. package/price/index.d.ts +1 -1
  265. package/price/index.js +3 -3
  266. package/price/utils.d.ts +5 -5
  267. package/price/utils.js +33 -23
  268. package/radio-button/index.d.ts +10 -0
  269. package/radio-button/index.js +33 -0
  270. package/radio-button/radio-button.module.scss +46 -0
  271. package/rating/index.d.ts +2 -1
  272. package/rating/types.d.ts +1 -1
  273. package/readme.md +56 -65
  274. package/screen/index.d.ts +4 -2
  275. package/screen/index.js +34 -3
  276. package/screen/screen.module.scss +0 -2
  277. package/screen/slots.d.ts +2 -8
  278. package/screen/slots.js +8 -9
  279. package/screen/utils.d.ts +2 -1
  280. package/select/index.d.ts +2 -33
  281. package/select/index.js +3 -109
  282. package/select/parts/block.d.ts +8 -0
  283. package/select/parts/block.js +70 -0
  284. package/select/parts/block.module.scss +7 -0
  285. package/select/parts/button.d.ts +8 -0
  286. package/select/parts/button.js +69 -0
  287. package/select/parts/menu.d.ts +8 -0
  288. package/select/parts/menu.js +105 -0
  289. package/select/parts/menu.module.scss +4 -0
  290. package/select/select.d.ts +14 -0
  291. package/select/select.js +145 -0
  292. package/select/types.d.ts +55 -0
  293. package/select/types.js +2 -0
  294. package/select/utils.d.ts +3 -0
  295. package/select/utils.js +13 -0
  296. package/select-deprecated/index.d.ts +34 -0
  297. package/select-deprecated/index.js +112 -0
  298. package/shadows.scss +18 -0
  299. package/side-page/index.d.ts +11 -26
  300. package/side-page/index.js +21 -26
  301. package/side-page/side-page.module.scss +35 -29
  302. package/side-page/slots.d.ts +12 -20
  303. package/side-page/slots.js +16 -28
  304. package/spinner/index.d.ts +18 -6
  305. package/spinner/index.js +25 -12
  306. package/spinner/spinner.module.scss +8 -0
  307. package/stepper/index.d.ts +18 -10
  308. package/stepper/index.js +17 -8
  309. package/stepper/stepper.module.scss +14 -15
  310. package/styling/fonts.d.ts +3 -3
  311. package/switcher-row/index.d.ts +42 -0
  312. package/switcher-row/index.js +59 -0
  313. package/switcher-row/switcher-row.module.scss +59 -0
  314. package/text/index.d.ts +1 -1
  315. package/text-button/index.d.ts +42 -0
  316. package/text-button/index.js +46 -0
  317. package/text-button/text-button.module.scss +96 -0
  318. package/text-field/index.d.ts +7 -6
  319. package/text-field/index.js +3 -2
  320. package/textarea/index.d.ts +21 -0
  321. package/textarea/index.js +85 -0
  322. package/textarea/textarea.module.scss +15 -0
  323. package/toggle/index.d.ts +3 -3
  324. package/toggle/toggle.module.scss +17 -8
  325. package/tooltip/index.d.ts +1 -0
  326. package/tooltip/index.js +1 -0
  327. package/top-bar/index.d.ts +3 -40
  328. package/top-bar/index.js +4 -60
  329. package/top-bar/top-bar-util.scss +29 -0
  330. package/top-bar/top-bar.d.ts +9 -0
  331. package/top-bar/top-bar.js +101 -0
  332. package/top-bar/top-bar.module.scss +129 -67
  333. package/top-bar/types.d.ts +31 -0
  334. package/top-bar/types.js +2 -0
  335. package/top-bar/utils.d.ts +14 -0
  336. package/top-bar/utils.js +56 -0
  337. package/touch-slider/index.d.ts +1 -0
  338. package/touch-slider/index.js +3 -2
  339. package/types.d.ts +18 -0
  340. package/types.js +2 -0
  341. package/unknown-content/index.d.ts +3 -3
  342. package/unknown-content/index.js +3 -3
  343. package/unknown-content/unknown-content.module.scss +16 -12
  344. package/upload-area/index.d.ts +2 -0
  345. package/upload-area/index.js +5 -0
  346. package/upload-area/types.d.ts +32 -0
  347. package/upload-area/types.js +2 -0
  348. package/upload-area/upload-area-util.scss +17 -0
  349. package/upload-area/upload-area.d.ts +8 -0
  350. package/upload-area/upload-area.js +105 -0
  351. package/upload-area/upload-area.module.scss +78 -0
  352. package/upload-area/utils.d.ts +17 -0
  353. package/upload-area/utils.js +48 -0
  354. package/utils.scss +74 -1
  355. package/with-hint/index.d.ts +3 -2
  356. package/with-hint/index.js +1 -0
  357. package/with-hint/positioning-hint.d.ts +1 -1
  358. package/with-hint/positioning-hint.js +2 -2
  359. package/with-tooltip/index.d.ts +2 -1
  360. package/with-tooltip/index.js +1 -0
  361. package/with-tooltip/utils.d.ts +2 -2
  362. package/_internal/body-scroll.d.ts +0 -23
  363. package/_internal/body-scroll.js +0 -41
  364. package/_internal/checkbox/index.d.ts +0 -5
  365. package/constants.d.ts +0 -6
  366. package/constants.js +0 -9
  367. package/nav-bar/index.d.ts +0 -46
  368. package/nav-bar/index.js +0 -76
  369. package/nav-bar/nav-bar.module.scss +0 -95
  370. package/upload/area.d.ts +0 -25
  371. package/upload/area.js +0 -65
  372. package/upload/area.module.scss +0 -44
  373. package/upload/utils.d.ts +0 -29
  374. package/upload/utils.js +0 -45
  375. /package/_internal/{checkbox/index.js → page-scroll-lock/types.js} +0 -0
  376. /package/{hint → hint-deprecated}/hint.module.scss +0 -0
  377. /package/{select → select-deprecated}/select.module.scss +0 -0
  378. /package/{upload → upload-area}/upload.svg +0 -0
@@ -0,0 +1,63 @@
1
+ import { ReactNode, HTMLAttributes, LabelHTMLAttributes, Ref, CSSProperties } from 'react';
2
+ export type FieldBlockSize = 's' | 'm' | 'l';
3
+ type NoChildren<T extends {
4
+ children?: any;
5
+ }> = Omit<T, 'children'>;
6
+ export interface FieldBlockStyle extends CSSProperties {
7
+ '--field-width'?: string;
8
+ '--field-main-text-color'?: string;
9
+ }
10
+ type WithStyle<T extends {
11
+ style?: CSSProperties;
12
+ }> = Omit<T, 'style'> & {
13
+ style?: FieldBlockStyle;
14
+ };
15
+ export interface FieldBlockProps {
16
+ /** Отключенное состояние. */
17
+ disabled?: boolean;
18
+ /** Состояние с ошибкой. */
19
+ failed?: boolean;
20
+ /** Состояние фокуса. */
21
+ focused?: boolean;
22
+ /** Подпись под полем. */
23
+ caption?: string;
24
+ /** Ярлык в поле. */
25
+ label?: string;
26
+ /** Выводить ярлык вместо placeholder или введенного значения. */
27
+ labelAsPlaceholder?: boolean;
28
+ /** Опции элемента ярлыка. */
29
+ labelProps?: NoChildren<LabelHTMLAttributes<HTMLLabelElement>>;
30
+ /** Размер. */
31
+ size?: FieldBlockSize;
32
+ /** Фиксировать высоту. */
33
+ fixedHeight?: boolean;
34
+ /** Опции корневого элемента. */
35
+ rootProps?: NoChildren<WithStyle<HTMLAttributes<HTMLDivElement>>>;
36
+ /** Ref корневого элемента. */
37
+ rootRef?: Ref<HTMLDivElement>;
38
+ /** Опции элемента блока поля. */
39
+ blockProps?: NoChildren<WithStyle<HTMLAttributes<HTMLDivElement>>>;
40
+ /** Ref элемента блока поля. */
41
+ blockRef?: Ref<HTMLDivElement>;
42
+ /** Украшение перед основным содержимым. */
43
+ adornmentStart?: ReactNode;
44
+ /** Украшение после основного содержимого. */
45
+ adornmentEnd?: ReactNode;
46
+ /** Основное содержимое. */
47
+ main?: ReactNode;
48
+ /** Опции основного содержимого. */
49
+ mainProps?: NoChildren<WithStyle<HTMLAttributes<HTMLDivElement>>>;
50
+ /** Идентификатор для систем автоматизированного тестирования. */
51
+ 'data-testid'?: string;
52
+ }
53
+ export declare const FIELD_BLOCK_HEIGHT: Record<FieldBlockSize, number>;
54
+ export declare const FIELD_BLOCK_DEFAULTS: {
55
+ readonly size: "l";
56
+ };
57
+ /**
58
+ * Блок поля по дизайн-гайдам.
59
+ * @param props Свойства.
60
+ * @return Элемент.
61
+ */
62
+ export declare function FieldBlock({ size, main, mainProps, disabled, failed, focused, label, labelProps, labelAsPlaceholder, fixedHeight, caption, rootRef, rootProps, blockRef, blockProps, adornmentStart, adornmentEnd, 'data-testid': testId, }: FieldBlockProps): JSX.Element;
63
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FieldBlock = exports.FIELD_BLOCK_DEFAULTS = exports.FIELD_BLOCK_HEIGHT = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const bind_1 = __importDefault(require("classnames/bind"));
9
+ const field_block_module_scss_1 = __importDefault(require("./field-block.module.scss"));
10
+ const cx = bind_1.default.bind(field_block_module_scss_1.default);
11
+ exports.FIELD_BLOCK_HEIGHT = {
12
+ s: 32,
13
+ m: 40,
14
+ l: 56,
15
+ };
16
+ exports.FIELD_BLOCK_DEFAULTS = {
17
+ size: 'l',
18
+ };
19
+ /**
20
+ * Блок поля по дизайн-гайдам.
21
+ * @param props Свойства.
22
+ * @return Элемент.
23
+ */
24
+ function FieldBlock({ size = exports.FIELD_BLOCK_DEFAULTS.size, main, mainProps, disabled, failed, focused, label, labelProps, labelAsPlaceholder, fixedHeight = true, caption, rootRef, rootProps, blockRef, blockProps, adornmentStart, adornmentEnd, 'data-testid': testId = 'field-block', }) {
25
+ const needLabel = Boolean(label) && (size === 'l' || labelAsPlaceholder);
26
+ const rootClassName = cx('root', `size-${size}`, {
27
+ disabled,
28
+ focused,
29
+ failed,
30
+ 'label-as-placeholder': needLabel && labelAsPlaceholder,
31
+ 'no-label': !needLabel,
32
+ }, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className);
33
+ const blockClassName = cx('block', fixedHeight && 'fixed-height', blockProps === null || blockProps === void 0 ? void 0 : blockProps.className);
34
+ return (react_1.default.createElement("div", Object.assign({}, rootProps, { ref: rootRef, className: rootClassName, "data-testid": testId }),
35
+ react_1.default.createElement("div", Object.assign({}, blockProps, { ref: blockRef, className: blockClassName, "data-testid": 'field-block:block' }),
36
+ adornmentStart && (react_1.default.createElement("div", { className: cx('col', 'adornment-col', 'start'), "data-testid": 'field-block:adornment-start' }, adornmentStart)),
37
+ react_1.default.createElement("div", { className: cx('col', 'main-col') },
38
+ needLabel && (react_1.default.createElement("label", Object.assign({}, labelProps, { className: cx('label', labelProps === null || labelProps === void 0 ? void 0 : labelProps.className), "data-testid": 'field-block:label' }), label)),
39
+ react_1.default.createElement("div", Object.assign({}, mainProps, { className: cx('main', mainProps === null || mainProps === void 0 ? void 0 : mainProps.className), "data-testid": 'field-block:main' }), main)),
40
+ adornmentEnd && (react_1.default.createElement("div", { className: cx('col', 'adornment-col', 'end'), "data-testid": 'field-block:adornment-end' }, adornmentEnd))),
41
+ caption && (react_1.default.createElement("div", { className: cx('caption'), "data-testid": 'field-block:caption' }, caption))));
42
+ }
43
+ exports.FieldBlock = FieldBlock;
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
2
  import { TextFieldProps } from '../text-field';
3
- declare type ItOrArray<T> = T[] | T;
4
- declare type CellSize = 'full' | 'half' | 'third';
3
+ type ItOrArray<T> = T[] | T;
4
+ type CellSize = 'full' | 'half' | 'third';
5
5
  interface CommonCellProps {
6
6
  size?: CellSize;
7
7
  rounds?: TextFieldProps['rounds'];
8
8
  }
9
- declare type OnlyOneRequired<T, K extends keyof T = keyof T> = {
9
+ type OnlyOneRequired<T, K extends keyof T = keyof T> = {
10
10
  [key in K]?: Required<Pick<T, key>> & Partial<Record<Exclude<K, key>, undefined>>;
11
11
  }[K];
12
- export declare type CellProps = CommonCellProps & OnlyOneRequired<{
12
+ export type CellProps = CommonCellProps & OnlyOneRequired<{
13
13
  field: React.ReactElement<Pick<TextFieldProps, 'rounds' | 'caption' | 'classes' | 'className'>>;
14
14
  renderField: (props: Pick<TextFieldProps, 'rounds' | 'caption'>) => React.ReactNode;
15
15
  }>;
@@ -30,6 +30,7 @@ export interface FieldGridComponent extends React.FC<FieldGridProps> {
30
30
  }
31
31
  /**
32
32
  * Компонент сетки полей.
33
+ * @deprecated В макетах больше не используются "склеивания" полей.
33
34
  * @param props Свойства.
34
35
  * @param props.children Содержимое, дочерними элементами могут быть только FieldGrid.Row.
35
36
  * @param props.rootProps Свойства корневого элемента.
@@ -42,6 +42,7 @@ const TypeCheck = {
42
42
  };
43
43
  /**
44
44
  * Компонент сетки полей.
45
+ * @deprecated В макетах больше не используются "склеивания" полей.
45
46
  * @param props Свойства.
46
47
  * @param props.children Содержимое, дочерними элементами могут быть только FieldGrid.Row.
47
48
  * @param props.rootProps Свойства корневого элемента.
@@ -3,4 +3,8 @@
3
3
  * @param element Элемент.
4
4
  * @return Ограничивающий прямоугольник.
5
5
  */
6
- export default function boundsOf<T>(element: T): T extends Element ? DOMRect : null;
6
+ export declare function boundsOf<T>(element: T): T extends Element ? DOMRect : null;
7
+ /**
8
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
9
+ */
10
+ export default boundsOf;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.boundsOf = void 0;
3
4
  /**
4
5
  * Возвращает ограничивающий прямоугольник элемента.
5
6
  * @param element Элемент.
@@ -8,4 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
9
  function boundsOf(element) {
9
10
  return (element instanceof Element ? element.getBoundingClientRect() : null);
10
11
  }
12
+ exports.boundsOf = boundsOf;
13
+ /**
14
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
15
+ */
11
16
  exports.default = boundsOf;
@@ -3,5 +3,8 @@
3
3
  * @param rect Прямоугольник.
4
4
  * @return Центр.
5
5
  */
6
- declare const centerOf: (rect: DOMRect) => import("./point").IPoint;
6
+ export declare function centerOf(rect: DOMRect): import("./point").IPoint;
7
+ /**
8
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
9
+ */
7
10
  export default centerOf;
@@ -3,11 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.centerOf = void 0;
6
7
  const point_1 = __importDefault(require("./point"));
7
8
  /**
8
9
  * Возвращает координаты центра прямоугольника.
9
10
  * @param rect Прямоугольник.
10
11
  * @return Центр.
11
12
  */
12
- const centerOf = (rect) => (0, point_1.default)((rect.right + rect.left) / 2, (rect.bottom + rect.top) / 2);
13
+ function centerOf(rect) {
14
+ return (0, point_1.default)((rect.right + rect.left) / 2, (rect.bottom + rect.top) / 2);
15
+ }
16
+ exports.centerOf = centerOf;
17
+ /**
18
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
19
+ */
13
20
  exports.default = centerOf;
@@ -3,11 +3,14 @@ export interface Container<T> {
3
3
  set: (v: T) => void;
4
4
  setObserver: (fn: Observer<T> | null) => void;
5
5
  }
6
- declare type Observer<T> = (prev: T | undefined, next: T | undefined) => void;
6
+ type Observer<T> = (prev: T | undefined, next: T | undefined) => void;
7
7
  /**
8
8
  * Фабрика контейнеров для произвольных значений.
9
9
  * @param initialValue Начальное значение в контейнере.
10
10
  * @return Контейнер.
11
11
  */
12
- declare const createContainer: <T = any>(initialValue?: T | undefined) => Container<T>;
12
+ export declare function createContainer<T = any>(initialValue?: T): Container<T>;
13
+ /**
14
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
15
+ */
13
16
  export default createContainer;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createContainer = void 0;
3
4
  /**
4
5
  * Фабрика контейнеров для произвольных значений.
5
6
  * @param initialValue Начальное значение в контейнере.
6
7
  * @return Контейнер.
7
8
  */
8
- const createContainer = (initialValue) => {
9
+ function createContainer(initialValue) {
9
10
  let value = initialValue;
10
11
  let observe;
11
12
  /**
@@ -30,5 +31,9 @@ const createContainer = (initialValue) => {
30
31
  observe = newObserve;
31
32
  };
32
33
  return { get, set, setObserver };
33
- };
34
+ }
35
+ exports.createContainer = createContainer;
36
+ /**
37
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
38
+ */
34
39
  exports.default = createContainer;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- export declare type SlotsDict = Record<string, React.ElementType>;
3
- export declare type Slots<M extends SlotsDict> = {
2
+ export type SlotsDict = Record<string, React.ElementType>;
3
+ export type Slots<M extends SlotsDict> = {
4
4
  [key in keyof M]: React.ReactElement<React.ComponentProps<M[key]>, M[key]> | undefined;
5
5
  };
6
6
  /**
@@ -9,4 +9,4 @@ export declare type Slots<M extends SlotsDict> = {
9
9
  * @param dict Словарь типов элементов.
10
10
  * @return Дочерние элементы разбитые по слотам.
11
11
  */
12
- export declare const defineSlots: <T extends SlotsDict>(children: React.ReactNode, dict: T) => Slots<T>;
12
+ export declare function defineSlots<T extends SlotsDict>(children: React.ReactNode, dict: T): Slots<T>;
@@ -8,14 +8,16 @@ const react_1 = require("react");
8
8
  * @param type Тип.
9
9
  * @return Результат.
10
10
  */
11
- const isComponentOfType = (value, type) => value.type === type;
11
+ function isComponentOfType(value, type) {
12
+ return value.type === type;
13
+ }
12
14
  /**
13
15
  * Распределяет дочерние элементы по слотам.
14
16
  * @param children Дочерние элементы.
15
17
  * @param dict Словарь типов элементов.
16
18
  * @return Дочерние элементы разбитые по слотам.
17
19
  */
18
- const defineSlots = (children, dict) => {
20
+ function defineSlots(children, dict) {
19
21
  const allKeys = Object.keys(dict);
20
22
  const slots = react_1.Children.toArray(children).reduce((result, item) => {
21
23
  if ((0, react_1.isValidElement)(item)) {
@@ -29,5 +31,5 @@ const defineSlots = (children, dict) => {
29
31
  return result;
30
32
  }, {});
31
33
  return slots;
32
- };
34
+ }
33
35
  exports.defineSlots = defineSlots;
@@ -1,20 +1,28 @@
1
1
  import React from 'react';
2
- export declare type EventWithPosition<T extends HTMLElement = HTMLElement> = MouseEvent | TouchEvent | React.MouseEvent<T> | React.TouchEvent<T>;
2
+ export type EventWithPosition<T extends HTMLElement = HTMLElement> = MouseEvent | TouchEvent | React.MouseEvent<T> | React.TouchEvent<T>;
3
3
  /**
4
4
  * Проверяет, является ли событие событием нажатия основной кнопки мыши.
5
- * @param e Событие.
5
+ * @param event Событие.
6
6
  * @return Является ли.
7
7
  */
8
- export declare const isMainMouseButton: (e: any) => boolean;
8
+ export declare function isMainMouseButton(event: any): boolean;
9
9
  /**
10
10
  * Проверяет, является ли переданное событие touch-событием.
11
- * @param e Событие.
12
- * @return Является ли.
11
+ * @param event Событие.
12
+ * @return Является ли переданное событие touch-событием.
13
13
  */
14
- export declare const isTouchEvent: (e: any) => e is TouchEvent | React.TouchEvent<Element>;
14
+ export declare function isTouchEvent(event: any): event is TouchEvent | React.TouchEvent;
15
15
  /**
16
16
  * Берет данные позиции из события.
17
- * @param e Touch- или Mouse-событие.
17
+ * @param event Touch- или Mouse-событие.
18
18
  * @return Данные позиции.
19
19
  */
20
- export declare const getEventClientPos: <T extends HTMLElement = HTMLElement>(e: EventWithPosition<T>) => import("./point").IPoint;
20
+ export declare function getEventClientPos<T extends HTMLElement = HTMLElement>(event: EventWithPosition<T>): import("./point").IPoint;
21
+ /**
22
+ * Вызывает событие input на элементе input/textarea/select.
23
+ * Полезен когда необходимо сообщить React'у что был произведен ввод значения пользователем.
24
+ * За основу взята реализация отсюда: https://stackoverflow.com/a/47409362/13166471.
25
+ * @param element Элемент.
26
+ * @param value Значение.
27
+ */
28
+ export declare function triggerInput(element: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement, value: string): void;
package/helpers/events.js CHANGED
@@ -1,31 +1,57 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getEventClientPos = exports.isTouchEvent = exports.isMainMouseButton = void 0;
7
- const point_1 = __importDefault(require("./point"));
3
+ exports.triggerInput = exports.getEventClientPos = exports.isTouchEvent = exports.isMainMouseButton = void 0;
4
+ const point_1 = require("./point");
8
5
  /**
9
6
  * Проверяет, является ли событие событием нажатия основной кнопки мыши.
10
- * @param e Событие.
7
+ * @param event Событие.
11
8
  * @return Является ли.
12
9
  */
13
- const isMainMouseButton = (e) => (e === null || e === void 0 ? void 0 : e.button) === 0;
10
+ function isMainMouseButton(event) {
11
+ return (event === null || event === void 0 ? void 0 : event.button) === 0;
12
+ }
14
13
  exports.isMainMouseButton = isMainMouseButton;
15
14
  /**
16
15
  * Проверяет, является ли переданное событие touch-событием.
17
- * @param e Событие.
18
- * @return Является ли.
16
+ * @param event Событие.
17
+ * @return Является ли переданное событие touch-событием.
19
18
  */
20
- const isTouchEvent = (e) => Boolean(e === null || e === void 0 ? void 0 : e.touches);
19
+ function isTouchEvent(event) {
20
+ return Boolean(event === null || event === void 0 ? void 0 : event.touches);
21
+ }
21
22
  exports.isTouchEvent = isTouchEvent;
22
23
  /**
23
24
  * Берет данные позиции из события.
24
- * @param e Touch- или Mouse-событие.
25
+ * @param event Touch- или Mouse-событие.
25
26
  * @return Данные позиции.
26
27
  */
27
- const getEventClientPos = (e) => {
28
- const source = (0, exports.isTouchEvent)(e) ? e.touches[0] : e;
29
- return (0, point_1.default)(source === null || source === void 0 ? void 0 : source.clientX, source === null || source === void 0 ? void 0 : source.clientY);
30
- };
28
+ function getEventClientPos(event) {
29
+ const source = isTouchEvent(event) ? event.touches[0] : event;
30
+ return (0, point_1.Point)(source === null || source === void 0 ? void 0 : source.clientX, source === null || source === void 0 ? void 0 : source.clientY);
31
+ }
31
32
  exports.getEventClientPos = getEventClientPos;
33
+ /**
34
+ * Вызывает событие input на элементе input/textarea/select.
35
+ * Полезен когда необходимо сообщить React'у что был произведен ввод значения пользователем.
36
+ * За основу взята реализация отсюда: https://stackoverflow.com/a/47409362/13166471.
37
+ * @param element Элемент.
38
+ * @param value Значение.
39
+ */
40
+ function triggerInput(element, value) {
41
+ var _a;
42
+ const constructors = [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement];
43
+ let constructor = null;
44
+ for (const item of constructors) {
45
+ if (element instanceof item) {
46
+ constructor = item;
47
+ }
48
+ }
49
+ if (constructor) {
50
+ const setValue = (_a = Object.getOwnPropertyDescriptor(constructor.prototype, 'value')) === null || _a === void 0 ? void 0 : _a.set;
51
+ if (setValue) {
52
+ setValue.call(element, value);
53
+ element.dispatchEvent(new Event('input', { bubbles: true }));
54
+ }
55
+ }
56
+ }
57
+ exports.triggerInput = triggerInput;
@@ -7,14 +7,17 @@
7
7
  * @param props.defaultResult Результат в случае если ни один элемент не прошел проверку.
8
8
  * @param props.isSuitable Должна определить удовлетворяет ли элемент условию.
9
9
  * @param props.needBreakLoop Должна определить нужно ли останавливать цикл.
10
- * @return Родственный элемент.
10
+ * @return Индекс дочернего элемента.
11
11
  */
12
- declare const findChildElement: ({ target, startIndex, increment, defaultResult, isSuitable, needBreakLoop, }: {
12
+ export declare function findChildIndex({ target, startIndex, increment, defaultResult, isSuitable, needBreakLoop, }: {
13
13
  target?: HTMLElement | null | undefined;
14
- startIndex?: number | undefined;
15
- increment?: number | undefined;
16
- defaultResult?: number | undefined;
17
- isSuitable?: ((el: Element) => boolean) | undefined;
18
- needBreakLoop?: ((passed: boolean) => boolean) | undefined;
19
- }) => number;
20
- export default findChildElement;
14
+ startIndex?: number;
15
+ increment?: number;
16
+ defaultResult?: number;
17
+ isSuitable?: (el: Element) => boolean;
18
+ needBreakLoop?: (passed: boolean) => boolean;
19
+ }): number;
20
+ /**
21
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
22
+ */
23
+ export default findChildIndex;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const lodash_1 = require("lodash");
3
+ exports.findChildIndex = void 0;
4
4
  /**
5
5
  * Выполняет цикл для поиска родственного элемента по заданным условиям.
6
6
  * @param props Свойства.
@@ -10,9 +10,9 @@ const lodash_1 = require("lodash");
10
10
  * @param props.defaultResult Результат в случае если ни один элемент не прошел проверку.
11
11
  * @param props.isSuitable Должна определить удовлетворяет ли элемент условию.
12
12
  * @param props.needBreakLoop Должна определить нужно ли останавливать цикл.
13
- * @return Родственный элемент.
13
+ * @return Индекс дочернего элемента.
14
14
  */
15
- const findChildElement = ({ target, startIndex = 0, increment = 1, defaultResult = -1, isSuitable, needBreakLoop = lodash_1.identity, }) => {
15
+ function findChildIndex({ target, startIndex = 0, increment = 1, defaultResult = -1, isSuitable, needBreakLoop = a => a, }) {
16
16
  let result = defaultResult;
17
17
  if (target && target.children && isSuitable !== undefined) {
18
18
  const { children } = target;
@@ -28,5 +28,9 @@ const findChildElement = ({ target, startIndex = 0, increment = 1, defaultResult
28
28
  }
29
29
  }
30
30
  return result;
31
- };
32
- exports.default = findChildElement;
31
+ }
32
+ exports.findChildIndex = findChildIndex;
33
+ /**
34
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
35
+ */
36
+ exports.default = findChildIndex;
@@ -3,5 +3,4 @@
3
3
  * @param element Элемент.
4
4
  * @return Правильный offsetParent.
5
5
  */
6
- declare const findOffsetParent: (element: HTMLElement) => Element | null;
7
- export { findOffsetParent };
6
+ export declare function findOffsetParent(element: HTMLElement): Element | null;
@@ -6,7 +6,7 @@ exports.findOffsetParent = void 0;
6
6
  * @param element Элемент.
7
7
  * @return Правильный offsetParent.
8
8
  */
9
- const findOffsetParent = (element) => {
9
+ function findOffsetParent(element) {
10
10
  let parent = element.offsetParent || document.body;
11
11
  if (getComputedStyle(parent).position === 'static') {
12
12
  parent =
@@ -15,5 +15,5 @@ const findOffsetParent = (element) => {
15
15
  : document.documentElement;
16
16
  }
17
17
  return parent;
18
- };
18
+ }
19
19
  exports.findOffsetParent = findOffsetParent;
@@ -4,17 +4,20 @@
4
4
  * @param props.target Элемент для которого нужно найти родственный элемент.
5
5
  * @param [props.startIndex=0] Индекс элемента с которого нужно начать поиск.
6
6
  * @param [props.increment=1] Значение инкремента.
7
- * @param [props.defaultResult=-1] Резуьтат в случае если ни один элемент не прошел проверку.
7
+ * @param [props.defaultResult=-1] Результат в случае если ни один элемент не прошел проверку.
8
8
  * @param [props.isSuitable] Должна определить удовлетворяет ли элемент условию.
9
9
  * @param [props.needBreakLoop] Должна определить нужно ли останавливать цикл.
10
10
  * @return Родственный элемент.
11
11
  */
12
- declare const findSiblingIndex: ({ target, startIndex, increment, defaultResult, isSuitable, needBreakLoop, }: {
12
+ export declare function findSiblingIndex({ target, startIndex, increment, defaultResult, isSuitable, needBreakLoop, }: {
13
13
  target: HTMLElement;
14
- startIndex?: number | undefined;
15
- increment?: number | undefined;
16
- defaultResult?: number | undefined;
17
- isSuitable?: ((el: Element) => boolean) | undefined;
18
- needBreakLoop?: ((passed: boolean) => boolean) | undefined;
19
- }) => number;
14
+ startIndex?: number;
15
+ increment?: number;
16
+ defaultResult?: number;
17
+ isSuitable?: (el: Element) => boolean;
18
+ needBreakLoop?: (passed: boolean) => boolean;
19
+ }): number;
20
+ /**
21
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
22
+ */
20
23
  export default findSiblingIndex;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSiblingIndex = void 0;
3
4
  const lodash_1 = require("lodash");
4
5
  /**
5
6
  * Выполняет цикл для поиска родственного элемента по заданным условиям.
@@ -7,12 +8,12 @@ const lodash_1 = require("lodash");
7
8
  * @param props.target Элемент для которого нужно найти родственный элемент.
8
9
  * @param [props.startIndex=0] Индекс элемента с которого нужно начать поиск.
9
10
  * @param [props.increment=1] Значение инкремента.
10
- * @param [props.defaultResult=-1] Резуьтат в случае если ни один элемент не прошел проверку.
11
+ * @param [props.defaultResult=-1] Результат в случае если ни один элемент не прошел проверку.
11
12
  * @param [props.isSuitable] Должна определить удовлетворяет ли элемент условию.
12
13
  * @param [props.needBreakLoop] Должна определить нужно ли останавливать цикл.
13
14
  * @return Родственный элемент.
14
15
  */
15
- const findSiblingIndex = ({ target, startIndex = 0, increment = 1, defaultResult = -1, isSuitable, needBreakLoop = lodash_1.identity, }) => {
16
+ function findSiblingIndex({ target, startIndex = 0, increment = 1, defaultResult = -1, isSuitable, needBreakLoop = lodash_1.identity, }) {
16
17
  let result = defaultResult;
17
18
  if (target && target.parentElement && (0, lodash_1.isFunction)(isSuitable)) {
18
19
  const { children } = target.parentElement;
@@ -28,5 +29,9 @@ const findSiblingIndex = ({ target, startIndex = 0, increment = 1, defaultResult
28
29
  }
29
30
  }
30
31
  return result;
31
- };
32
+ }
33
+ exports.findSiblingIndex = findSiblingIndex;
34
+ /**
35
+ * @deprecated Следует использовать именованный экспорт. Экспорт по умолчанию будет удалён в будущем.
36
+ */
32
37
  exports.default = findSiblingIndex;
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Перехватив событие, подгонит высоту поля под содержимое.
3
- * @param event Событие.
4
- * @param event.target Поле.
2
+ * Подгонит высоту поля под содержимое.
3
+ * @param eventLike Событие.
4
+ * @param eventLike.target Поле.
5
5
  */
6
- export declare const fitElementHeight: ({ target }: {
6
+ export declare function fitElementHeight({ target }: {
7
7
  target: HTMLElement;
8
- }) => void;
8
+ }): void;
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fitElementHeight = void 0;
4
4
  /**
5
- * Перехватив событие, подгонит высоту поля под содержимое.
6
- * @param event Событие.
7
- * @param event.target Поле.
5
+ * Подгонит высоту поля под содержимое.
6
+ * @param eventLike Событие.
7
+ * @param eventLike.target Поле.
8
8
  */
9
- const fitElementHeight = ({ target }) => {
9
+ function fitElementHeight({ target }) {
10
10
  target.style.height = 'auto';
11
- // актуальные значения после установки "auto" (в начало функции не переносить)
11
+ // ВАЖНО (1): актуальные значения берем ПОСЛЕ установки "auto" (в начало функции не переносить)
12
+ // ВАЖНО (2): дважды обращаемся к scrollHeight из-за бага в Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1799404
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
14
  const { scrollHeight, offsetHeight, clientHeight } = target;
13
- target.style.height = `${scrollHeight + offsetHeight - clientHeight}px`;
14
- };
15
+ target.style.height = `${target.scrollHeight + offsetHeight - clientHeight}px`;
16
+ }
15
17
  exports.fitElementHeight = fitElementHeight;
@@ -6,11 +6,11 @@
6
6
  * @param options.invalidPlaceholder Вернется в случае невалидности даты.
7
7
  * @return Функция для форматирования даты.
8
8
  */
9
- export declare const createDateFormatter: ({ formatFrom, formatTo, invalidPlaceholder, }?: {
10
- formatFrom?: string | string[] | undefined;
11
- formatTo?: string | ((d: Date) => string) | undefined;
9
+ export declare function createDateFormatter({ formatFrom, formatTo, invalidPlaceholder, }?: {
10
+ formatFrom?: string | string[];
11
+ formatTo?: string | ((d: Date) => string);
12
12
  invalidPlaceholder?: any;
13
- }) => (dateString: string) => any;
13
+ }): (dateString: string) => any;
14
14
  /**
15
15
  * Работает аналогично "date-fns/parse", но позволяет передать множество форматов в виде массива.
16
16
  * @param dateString Строка с датой.
@@ -19,11 +19,11 @@ export declare const createDateFormatter: ({ formatFrom, formatTo, invalidPlaceh
19
19
  * @param options Опции "date-fns/parse".
20
20
  * @return Дата.
21
21
  */
22
- export declare const parseMultiple: (dateString: string, formatString: string | string[], referenceDate: Date, options?: {
23
- locale?: Locale | undefined;
24
- weekStartsOn?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | undefined;
25
- firstWeekContainsDate?: 2 | 1 | 3 | 4 | 5 | 6 | 7 | undefined;
26
- useAdditionalWeekYearTokens?: boolean | undefined;
27
- useAdditionalDayOfYearTokens?: boolean | undefined;
28
- } | undefined) => Date;
22
+ export declare function parseMultiple(dateString: string, formatString: string | string[], referenceDate: Date, options?: {
23
+ locale?: Locale;
24
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
25
+ firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
26
+ useAdditionalWeekYearTokens?: boolean;
27
+ useAdditionalDayOfYearTokens?: boolean;
28
+ }): Date;
29
29
  export declare const formatDate: (dateString: string) => any;