@sima-land/ui-nucleons 44.2.9 → 45.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) 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/{checkbox/index.js → page-scroll-lock/types.js} +0 -0
  17. package/_internal/readme.md +2 -0
  18. package/_internal/utils/dropdown.d.ts +1 -0
  19. package/_internal/utils/dropdown.js +1 -0
  20. package/alert/alert.module.scss +1 -24
  21. package/alert/index.d.ts +11 -17
  22. package/alert/index.js +33 -16
  23. package/arrow-button/arrow-button.module.scss +2 -0
  24. package/arrow-button/index.d.ts +2 -2
  25. package/autocomplete/autocomplete.d.ts +8 -0
  26. package/autocomplete/autocomplete.js +190 -0
  27. package/autocomplete/autocomplete.module.scss +2 -15
  28. package/autocomplete/index.d.ts +2 -27
  29. package/autocomplete/index.js +2 -126
  30. package/autocomplete/types.d.ts +19 -0
  31. package/autocomplete/types.js +2 -0
  32. package/autocomplete-deprecated/autocomplete.module.scss +20 -0
  33. package/autocomplete-deprecated/index.d.ts +28 -0
  34. package/autocomplete-deprecated/index.js +130 -0
  35. package/avatar/index.d.ts +2 -2
  36. package/avatar/user.d.ts +1 -1
  37. package/base-input/base-input.d.ts +11 -0
  38. package/base-input/base-input.js +96 -0
  39. package/base-input/base-input.module.scss +3 -3
  40. package/base-input/index.d.ts +2 -23
  41. package/base-input/index.js +2 -76
  42. package/base-input/types.d.ts +31 -0
  43. package/base-input/types.js +2 -0
  44. package/base-input/utils.d.ts +6 -0
  45. package/base-input/utils.js +14 -0
  46. package/base-input-deprecated/base-input.module.scss +66 -0
  47. package/base-input-deprecated/index.d.ts +24 -0
  48. package/base-input-deprecated/index.js +80 -0
  49. package/bordered-layout/index.d.ts +1 -0
  50. package/bordered-layout/index.js +1 -0
  51. package/bottom-bar/bottom-bar-util.scss +20 -0
  52. package/bottom-bar/bottom-bar.d.ts +12 -0
  53. package/bottom-bar/bottom-bar.js +47 -0
  54. package/bottom-bar/bottom-bar.module.scss +14 -0
  55. package/bottom-bar/index.d.ts +2 -21
  56. package/bottom-bar/index.js +5 -44
  57. package/bottom-bar/types.d.ts +10 -0
  58. package/bottom-bar/types.js +2 -0
  59. package/box/index.d.ts +1 -1
  60. package/breakpoints.scss +1 -1
  61. package/button/button.module.scss +70 -53
  62. package/button/index.d.ts +26 -41
  63. package/button/index.js +22 -46
  64. package/card/index.d.ts +2 -1
  65. package/card/index.js +23 -6
  66. package/card/slots.d.ts +17 -3
  67. package/card/slots.js +15 -13
  68. package/carousel/draggable.d.ts +7 -3
  69. package/carousel/draggable.js +10 -3
  70. package/carousel/helpers/draggable-event.d.ts +5 -2
  71. package/carousel/helpers/draggable-event.js +5 -0
  72. package/carousel/index.d.ts +1 -1
  73. package/carousel/index.js +24 -24
  74. package/checkbox/checkbox.module.scss +2 -0
  75. package/checkbox/index.d.ts +3 -3
  76. package/checkbox-field/index.d.ts +3 -0
  77. package/checkbox-field/index.js +3 -0
  78. package/clean-buttons/clean-buttons-util.scss +15 -0
  79. package/clean-buttons/clean-buttons.module.scss +5 -3
  80. package/clean-buttons/index.d.ts +16 -7
  81. package/clean-buttons/index.js +17 -14
  82. package/clean-buttons/types.d.ts +1 -1
  83. package/clean-buttons/utils.d.ts +5 -1
  84. package/clean-buttons/utils.js +4 -0
  85. package/{colors.d.ts → colors/index.d.ts} +1 -1
  86. package/{colors.js → colors/index.js} +0 -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 +45 -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 +31 -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 → hint-deprecated}/hint.module.scss +0 -0
  172. package/hint-deprecated/index.d.ts +11 -0
  173. package/hint-deprecated/index.js +53 -0
  174. package/hooks/breakpoint/index.d.ts +7 -4
  175. package/hooks/breakpoint/index.js +21 -13
  176. package/hooks/breakpoint/types.d.ts +3 -4
  177. package/hooks/breakpoint/utils.d.ts +2 -1
  178. package/hooks/breakpoint/utils.js +2 -1
  179. package/hooks/index.d.ts +8 -8
  180. package/hooks/index.js +27 -19
  181. package/hooks/intersection/test-utils.d.ts +1 -1
  182. package/hooks/intersection/test-utils.js +2 -1
  183. package/hooks/styles.d.ts +6 -0
  184. package/hooks/styles.js +26 -0
  185. package/info-text/index.d.ts +23 -0
  186. package/info-text/index.js +60 -0
  187. package/info-text/info-text.module.scss +28 -0
  188. package/input/index.d.ts +32 -0
  189. package/input/index.js +96 -0
  190. package/input/input.module.scss +20 -0
  191. package/input/utils.d.ts +36 -0
  192. package/input/utils.js +71 -0
  193. package/layout/index.d.ts +6 -11
  194. package/layout/index.js +6 -60
  195. package/layout/layout.d.ts +10 -0
  196. package/layout/layout.js +32 -0
  197. package/layout/layout.module.scss +33 -26
  198. package/layout/legacy.d.ts +15 -0
  199. package/layout/legacy.js +68 -0
  200. package/layout/legacy.module.scss +49 -0
  201. package/layout/types.d.ts +6 -0
  202. package/layout/types.js +2 -0
  203. package/link/index.d.ts +4 -1
  204. package/link/index.js +2 -2
  205. package/link/link.module.scss +10 -0
  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 +34 -41
  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 +3 -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/{select → select-deprecated}/select.module.scss +0 -0
  299. package/shadows.scss +18 -0
  300. package/side-page/index.d.ts +11 -26
  301. package/side-page/index.js +21 -26
  302. package/side-page/side-page.module.scss +35 -29
  303. package/side-page/slots.d.ts +12 -20
  304. package/side-page/slots.js +16 -28
  305. package/spinner/index.d.ts +18 -6
  306. package/spinner/index.js +25 -12
  307. package/spinner/spinner.module.scss +8 -0
  308. package/stepper/index.d.ts +18 -10
  309. package/stepper/index.js +17 -8
  310. package/stepper/stepper.module.scss +14 -15
  311. package/styling/fonts.d.ts +3 -3
  312. package/switcher-row/index.d.ts +42 -0
  313. package/switcher-row/index.js +59 -0
  314. package/switcher-row/switcher-row.module.scss +55 -0
  315. package/text/index.d.ts +1 -1
  316. package/text-button/index.d.ts +42 -0
  317. package/text-button/index.js +46 -0
  318. package/text-button/text-button.module.scss +99 -0
  319. package/text-field/index.d.ts +7 -6
  320. package/text-field/index.js +3 -2
  321. package/textarea/index.d.ts +21 -0
  322. package/textarea/index.js +85 -0
  323. package/textarea/textarea.module.scss +15 -0
  324. package/toggle/index.d.ts +3 -3
  325. package/toggle/toggle.module.scss +17 -8
  326. package/tooltip/index.d.ts +1 -0
  327. package/tooltip/index.js +1 -0
  328. package/top-bar/index.d.ts +3 -40
  329. package/top-bar/index.js +4 -60
  330. package/top-bar/top-bar-util.scss +29 -0
  331. package/top-bar/top-bar.d.ts +9 -0
  332. package/top-bar/top-bar.js +101 -0
  333. package/top-bar/top-bar.module.scss +129 -67
  334. package/top-bar/types.d.ts +31 -0
  335. package/top-bar/types.js +2 -0
  336. package/top-bar/utils.d.ts +14 -0
  337. package/top-bar/utils.js +56 -0
  338. package/touch-slider/index.d.ts +1 -0
  339. package/touch-slider/index.js +3 -2
  340. package/types.d.ts +18 -0
  341. package/types.js +2 -0
  342. package/unknown-content/index.d.ts +3 -3
  343. package/unknown-content/index.js +3 -3
  344. package/unknown-content/unknown-content.module.scss +16 -12
  345. package/upload-area/index.d.ts +2 -0
  346. package/upload-area/index.js +5 -0
  347. package/upload-area/types.d.ts +32 -0
  348. package/upload-area/types.js +2 -0
  349. package/upload-area/upload-area-util.scss +17 -0
  350. package/upload-area/upload-area.d.ts +8 -0
  351. package/upload-area/upload-area.js +105 -0
  352. package/upload-area/upload-area.module.scss +78 -0
  353. package/{upload → upload-area}/upload.svg +0 -0
  354. package/upload-area/utils.d.ts +17 -0
  355. package/upload-area/utils.js +48 -0
  356. package/utils.scss +74 -1
  357. package/with-hint/index.d.ts +3 -2
  358. package/with-hint/index.js +1 -0
  359. package/with-hint/positioning-hint.d.ts +1 -1
  360. package/with-hint/positioning-hint.js +2 -2
  361. package/with-tooltip/index.d.ts +2 -1
  362. package/with-tooltip/index.js +1 -0
  363. package/with-tooltip/utils.d.ts +2 -2
  364. package/_internal/body-scroll.d.ts +0 -23
  365. package/_internal/body-scroll.js +0 -41
  366. package/_internal/checkbox/index.d.ts +0 -5
  367. package/constants.d.ts +0 -6
  368. package/constants.js +0 -9
  369. package/nav-bar/index.d.ts +0 -46
  370. package/nav-bar/index.js +0 -76
  371. package/nav-bar/nav-bar.module.scss +0 -95
  372. package/upload/area.d.ts +0 -25
  373. package/upload/area.js +0 -65
  374. package/upload/area.module.scss +0 -44
  375. package/upload/utils.d.ts +0 -29
  376. package/upload/utils.js +0 -45
@@ -1,46 +0,0 @@
1
- import React from 'react';
2
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
- text?: string;
4
- icon?: React.ComponentType<React.SVGAttributes<SVGSVGElement>>;
5
- stub?: boolean;
6
- shift?: 'left' | 'right';
7
- 'data-testid'?: string;
8
- }
9
- export interface NavBarProps {
10
- /** Заголовок. */
11
- title?: string;
12
- /** Подзаголовок. */
13
- subtitle?: string;
14
- /** Класс. */
15
- className?: string;
16
- /** Нужно ли выводить полоску снизу. */
17
- bottomBordered?: boolean;
18
- /** Свойства кнопок. */
19
- buttons?: {
20
- start?: ButtonProps;
21
- startSecondary?: ButtonProps;
22
- end?: ButtonProps;
23
- endSecondary?: ButtonProps;
24
- };
25
- }
26
- /**
27
- * Высота компонента в пикселях.
28
- */
29
- export declare const NAV_BAR_HEIGHT = 56;
30
- /**
31
- * Компонент панели навигации.
32
- * @param props Свойства.
33
- * @return Элемент.
34
- */
35
- export declare const NavBar: ({ title, subtitle, className, bottomBordered, buttons: { start, startSecondary, end, endSecondary }, }: NavBarProps) => JSX.Element;
36
- /**
37
- * Компонент кнопки (с текстом или иконки).
38
- * @param props Свойства.
39
- * @param props.text Текст.
40
- * @param props.icon Функция возвращающая React-элемент svg-иконки (имеет приоритет над "text").
41
- * @param props.stub Является ли кнопка заглушкой (будет скрыта через aria, не будет содержать иконки).
42
- * @param props.shift Определяет как сместить иконку внутри кнопки.
43
- * @return Элемент.
44
- */
45
- export declare const NavButton: React.FC<ButtonProps>;
46
- export {};
package/nav-bar/index.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.NavButton = exports.NavBar = exports.NAV_BAR_HEIGHT = void 0;
18
- const react_1 = __importDefault(require("react"));
19
- const nav_bar_module_scss_1 = __importDefault(require("./nav-bar.module.scss"));
20
- const bind_1 = __importDefault(require("classnames/bind"));
21
- const fp_1 = require("lodash/fp");
22
- const borders_1 = require("../styling/borders");
23
- const colors_1 = require("../colors");
24
- const cx = bind_1.default.bind(nav_bar_module_scss_1.default);
25
- const getIcon = (0, fp_1.prop)('icon');
26
- /**
27
- * Высота компонента в пикселях.
28
- */
29
- exports.NAV_BAR_HEIGHT = 56;
30
- /**
31
- * Компонент панели навигации.
32
- * @param props Свойства.
33
- * @return Элемент.
34
- */
35
- const NavBar = ({ title, subtitle, className, bottomBordered = false, buttons: { start, startSecondary, end, endSecondary } = {}, }) => {
36
- const startButtons = [start, startSecondary];
37
- const endButtons = [end, endSecondary];
38
- const hasStartButtons = startButtons.some(Boolean);
39
- const hasEndButtons = endButtons.some(Boolean);
40
- const hasButtons = hasStartButtons || hasEndButtons;
41
- const isStartIconGroup = hasStartButtons && startButtons.every(getIcon);
42
- const isEndIconGroup = hasEndButtons && endButtons.every(getIcon);
43
- return (react_1.default.createElement("div", { className: cx('nav-bar', className, bottomBordered && borders_1.InnerBorder.bottom), style: { height: `${exports.NAV_BAR_HEIGHT}px` } },
44
- hasButtons && (react_1.default.createElement("div", { className: cx('button-groups') },
45
- hasStartButtons && (react_1.default.createElement("div", { className: cx('group') },
46
- start && react_1.default.createElement(exports.NavButton, Object.assign({ shift: isStartIconGroup ? 'right' : undefined }, start)),
47
- startSecondary && (react_1.default.createElement(exports.NavButton, Object.assign({ shift: isStartIconGroup ? 'left' : undefined }, startSecondary))))),
48
- hasEndButtons && (react_1.default.createElement("div", { className: cx('group') },
49
- endSecondary && (react_1.default.createElement(exports.NavButton, Object.assign({ stub: true, shift: isEndIconGroup ? 'right' : undefined }, endSecondary))),
50
- end && react_1.default.createElement(exports.NavButton, Object.assign({ stub: true, shift: isEndIconGroup ? 'left' : undefined }, end)))))),
51
- react_1.default.createElement("div", { className: cx('main') },
52
- Boolean(title) && react_1.default.createElement("div", { className: cx('title', 'truncate') }, title),
53
- Boolean(subtitle) && react_1.default.createElement("div", { className: cx('subtitle', 'truncate') }, subtitle)),
54
- hasButtons && (react_1.default.createElement("div", { className: cx('button-groups', 'end') },
55
- hasEndButtons && (react_1.default.createElement("div", { className: cx('group') },
56
- endSecondary && (react_1.default.createElement(exports.NavButton, Object.assign({ shift: isEndIconGroup ? 'right' : undefined }, endSecondary))),
57
- end && react_1.default.createElement(exports.NavButton, Object.assign({ shift: isEndIconGroup ? 'left' : undefined }, end)))),
58
- hasStartButtons && (react_1.default.createElement("div", { className: cx('group') },
59
- start && (react_1.default.createElement(exports.NavButton, Object.assign({ stub: true, shift: isStartIconGroup ? 'right' : undefined }, start))),
60
- startSecondary && (react_1.default.createElement(exports.NavButton, Object.assign({ stub: true, shift: isStartIconGroup ? 'left' : undefined }, startSecondary)))))))));
61
- };
62
- exports.NavBar = NavBar;
63
- /**
64
- * Компонент кнопки (с текстом или иконки).
65
- * @param props Свойства.
66
- * @param props.text Текст.
67
- * @param props.icon Функция возвращающая React-элемент svg-иконки (имеет приоритет над "text").
68
- * @param props.stub Является ли кнопка заглушкой (будет скрыта через aria, не будет содержать иконки).
69
- * @param props.shift Определяет как сместить иконку внутри кнопки.
70
- * @return Элемент.
71
- */
72
- const NavButton = (_a) => {
73
- var { text, icon: Icon, stub = false, shift, className } = _a, buttonProps = __rest(_a, ["text", "icon", "stub", "shift", "className"]);
74
- return (react_1.default.createElement("button", Object.assign({}, (!stub && buttonProps), { type: 'button', className: cx('button', Icon && 'icon', shift === 'left' && 'shift-left', shift === 'right' && 'shift-right', stub && 'stub', className), "aria-hidden": stub }), Icon && !stub ? (react_1.default.createElement(Icon, { fill: colors_1.COLORS.get('basic-gray87'), className: cx('svg'), "aria-hidden": 'true' })) : (text)));
75
- };
76
- exports.NavButton = NavButton;
@@ -1,95 +0,0 @@
1
- @use '../colors';
2
-
3
- .nav-bar {
4
- background: #fff;
5
- box-sizing: border-box;
6
- display: flex;
7
- justify-content: center;
8
- width: 100%;
9
- }
10
-
11
- .main {
12
- display: flex;
13
- flex-direction: column;
14
- flex-grow: 1;
15
- justify-content: center;
16
- overflow: hidden;
17
- text-align: center;
18
- &:first-child {
19
- padding: 0 16px;
20
- }
21
- }
22
-
23
- .title {
24
- color: colors.$basic-gray87;
25
- font-size: 16px;
26
- font-weight: 600;
27
- line-height: 24px;
28
- }
29
-
30
- .subtitle {
31
- color: colors.$basic-gray38;
32
- font-size: 12px;
33
- line-height: 16px;
34
- margin-top: -4px;
35
- }
36
-
37
- .truncate {
38
- overflow: hidden;
39
- text-overflow: ellipsis;
40
- white-space: nowrap;
41
- }
42
-
43
- .button-groups {
44
- display: flex;
45
- flex-direction: column;
46
- &.end {
47
- align-items: flex-end;
48
- text-align: right;
49
- .group {
50
- justify-content: flex-end;
51
- }
52
- }
53
- .group {
54
- display: flex;
55
- width: 100%;
56
- }
57
- }
58
-
59
- .button {
60
- background: transparent;
61
- border: 0;
62
- box-sizing: border-box;
63
- color: colors.$basic-blue;
64
- font-family: inherit;
65
- font-size: 14px;
66
- font-weight: 600;
67
- height: 56px;
68
- line-height: 20px;
69
- margin: 0;
70
- outline: 0;
71
- padding: 0 16px;
72
- text-align: inherit;
73
- width: 100%;
74
- &.icon {
75
- width: 56px;
76
- &.shift-left {
77
- padding-right: 16px;
78
- padding-left: 12px;
79
- width: 52px;
80
- }
81
- &.shift-right {
82
- padding-right: 12px;
83
- padding-left: 16px;
84
- width: 52px;
85
- }
86
- .svg {
87
- // чтобы выравнивались по центру по вертикали
88
- display: block;
89
- }
90
- }
91
- &.stub {
92
- height: 0;
93
- overflow: hidden;
94
- }
95
- }
package/upload/area.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- export interface UploadAreaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'multiple'> {
3
- /** Ограничение на количество файлов. */
4
- countLimit?: number;
5
- /** Есть ли ошибки валидации. */
6
- failed?: boolean;
7
- /** Роль файлов. */
8
- fileRole?: string;
9
- /** Форматы. */
10
- formats?: string;
11
- /** Ограничение на количество файлов. */
12
- multiple?: boolean;
13
- /** Сработает при выборе или перетаскивании файлов, получив список и событие. */
14
- onSelect?: (list: File[], e: React.DragEvent<HTMLDivElement> | React.ChangeEvent<HTMLInputElement>) => void;
15
- /** Ограничение на размер. */
16
- sizeLimit?: string;
17
- /** Идентификатор для систем автоматизированного тестирования. */
18
- 'data-testid'?: string;
19
- }
20
- /**
21
- * Компонент поля выбора файла.
22
- * @param props Свойства.
23
- * @return Элемент.
24
- */
25
- export declare const UploadArea: React.FC<UploadAreaProps>;
package/upload/area.js DELETED
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.UploadArea = void 0;
18
- const react_1 = __importDefault(require("react"));
19
- const bind_1 = __importDefault(require("classnames/bind"));
20
- const area_module_scss_1 = __importDefault(require("./area.module.scss"));
21
- const upload_svg_1 = __importDefault(require("./upload.svg"));
22
- const colors_1 = require("../colors");
23
- const link_1 = require("../link");
24
- const utils_1 = require("./utils");
25
- const lodash_1 = require("lodash");
26
- const get_declination_1 = __importDefault(require("../helpers/get-declination"));
27
- const cx = bind_1.default.bind(area_module_scss_1.default);
28
- /**
29
- * Компонент поля выбора файла.
30
- * @param props Свойства.
31
- * @return Элемент.
32
- */
33
- const UploadArea = (_a) => {
34
- var { onSelect, className, fileRole = 'файл', formats, sizeLimit = '2 Mb', multiple, countLimit = multiple ? undefined : 1, failed, 'data-testid': testId = 'upload-area' } = _a, restProps = __rest(_a, ["onSelect", "className", "fileRole", "formats", "sizeLimit", "multiple", "countLimit", "failed", 'data-testid']);
35
- const secondaryInfo = (0, lodash_1.upperFirst)([
36
- countLimit &&
37
- countLimit > 0 &&
38
- `${countLimit} ${(0, get_declination_1.default)(countLimit, ['файл', 'файла', 'файлов'])}`,
39
- formats && `формат ${formats}`,
40
- `до ${sizeLimit}`,
41
- ]
42
- .filter(Boolean)
43
- .join(', '));
44
- const prepareFiles = (0, utils_1.getFilesPreparer)({ multiple, countLimit });
45
- const { active, bind } = (0, utils_1.useDragAndDrop)({
46
- onDrop: e => onSelect === null || onSelect === void 0 ? void 0 : onSelect(prepareFiles(e.dataTransfer.files), e),
47
- });
48
- return (react_1.default.createElement("div", Object.assign({}, restProps, bind, { className: cx('root', { active }, className), "data-testid": testId }),
49
- react_1.default.createElement(upload_svg_1.default, { fill: colors_1.COLORS.get('basic-gray24') }),
50
- react_1.default.createElement("div", { className: cx('info-column') },
51
- react_1.default.createElement("div", { className: cx('info', 'primary') },
52
- "\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438",
53
- ' ',
54
- react_1.default.createElement("label", null,
55
- react_1.default.createElement("input", { type: 'file', multiple: multiple, className: cx('input'), onChange: e => {
56
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(prepareFiles(e.target.files), e);
57
- // очищаем поле чтобы можно было выбрать тот же файл повторно
58
- e.target.value = '';
59
- }, "data-testid": 'upload-area:input' }),
60
- react_1.default.createElement(link_1.Link, { pseudo: true, "data-testid": 'upload-area:anchor' },
61
- "\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 ",
62
- fileRole))),
63
- react_1.default.createElement("div", { className: cx('info', 'secondary', { failed }) }, secondaryInfo))));
64
- };
65
- exports.UploadArea = UploadArea;
@@ -1,44 +0,0 @@
1
- @use '../colors';
2
-
3
- .root {
4
- display: flex;
5
- align-items: center;
6
- border-radius: 8px;
7
- border: 1px dashed colors.$basic-gray24;
8
- height: 104px;
9
- max-width: 100%;
10
- overflow: hidden;
11
- padding: 0 40px;
12
- &.active {
13
- border: 2px solid colors.$basic-blue;
14
- padding: 0 39px;
15
- }
16
- }
17
-
18
- .input {
19
- display: none;
20
- }
21
-
22
- .info-column {
23
- margin-left: 24px;
24
- overflow: hidden;
25
- .info {
26
- white-space: nowrap;
27
- overflow: hidden;
28
- text-overflow: ellipsis;
29
- &.primary {
30
- font-size: 16px;
31
- line-height: 24px;
32
- color: colors.$basic-gray87;
33
- }
34
- &.secondary {
35
- margin-top: 4px;
36
- font-size: 14px;
37
- line-height: 20px;
38
- color: colors.$basic-gray38;
39
- &.failed {
40
- color: colors.$additional-deep-red;
41
- }
42
- }
43
- }
44
- }
package/upload/utils.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- declare type DnDProps<T> = {
3
- onDrop: React.DragEventHandler<T>;
4
- };
5
- declare type DnDResult<T> = {
6
- active: boolean;
7
- bind: {
8
- onDragEnter: React.DragEventHandler<T>;
9
- onDragOver: React.DragEventHandler<T>;
10
- onDragLeave: React.DragEventHandler<T>;
11
- onDrop: React.DragEventHandler<T>;
12
- };
13
- };
14
- /**
15
- * Хук обработки drag-n-drop событий.
16
- * @param options Опции.
17
- * @return Данные.
18
- */
19
- export declare const useDragAndDrop: <T extends HTMLElement = HTMLElement>({ onDrop, }: DnDProps<T>) => DnDResult<T>;
20
- /**
21
- * Возвращает функцию обработки FileList по заданным ограничениям.
22
- * @param props Свойства.
23
- * @return Функция.
24
- */
25
- export declare const getFilesPreparer: ({ multiple, countLimit }: {
26
- multiple?: boolean | undefined;
27
- countLimit?: number | undefined;
28
- }) => (list: File[] | FileList) => File[];
29
- export {};
package/upload/utils.js DELETED
@@ -1,45 +0,0 @@
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.getFilesPreparer = exports.useDragAndDrop = void 0;
7
- const react_1 = require("react");
8
- const with_prevent_1 = __importDefault(require("../helpers/with-prevent"));
9
- /**
10
- * Хук обработки drag-n-drop событий.
11
- * @param options Опции.
12
- * @return Данные.
13
- */
14
- const useDragAndDrop = ({ onDrop, }) => {
15
- const [active, setActive] = (0, react_1.useState)(false);
16
- return {
17
- active,
18
- bind: {
19
- onDragEnter: (0, with_prevent_1.default)(() => setActive(true)),
20
- onDragOver: (0, with_prevent_1.default)(() => setActive(true)),
21
- onDragLeave: (0, with_prevent_1.default)(e => {
22
- // игнорируем переход по дочерним элементам
23
- !e.currentTarget.contains(e.relatedTarget) && setActive(false);
24
- }),
25
- onDrop: (0, with_prevent_1.default)(e => {
26
- setActive(false);
27
- onDrop(e);
28
- }),
29
- },
30
- };
31
- };
32
- exports.useDragAndDrop = useDragAndDrop;
33
- /**
34
- * Возвращает функцию обработки FileList по заданным ограничениям.
35
- * @param props Свойства.
36
- * @return Функция.
37
- */
38
- const getFilesPreparer = ({ multiple, countLimit }) => (list) => {
39
- const files = [...list];
40
- multiple
41
- ? countLimit && Number.isFinite(countLimit) && files.splice(countLimit)
42
- : files.splice(1);
43
- return files;
44
- };
45
- exports.getFilesPreparer = getFilesPreparer;