@consta/uikit 3.12.1 → 3.13.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 (373) hide show
  1. package/Attach/package.json +1 -1
  2. package/Attachment/package.json +1 -1
  3. package/Avatar/package.json +1 -1
  4. package/Badge/package.json +1 -1
  5. package/BasicSelectDeprecated/package.json +1 -1
  6. package/Breadcrumbs/package.json +1 -1
  7. package/BreadcrumbsCanary/es.js +1 -0
  8. package/BreadcrumbsCanary/index.d.ts +1 -0
  9. package/BreadcrumbsCanary/index.js +4 -0
  10. package/BreadcrumbsCanary/package.json +9 -0
  11. package/Button/package.json +1 -1
  12. package/CHANGELOG.md +56 -48
  13. package/Calendar/package.json +1 -1
  14. package/Card/package.json +1 -1
  15. package/Checkbox/package.json +1 -1
  16. package/CheckboxGroup/package.json +1 -1
  17. package/ChoiceGroup/package.json +1 -1
  18. package/Collapse/package.json +1 -1
  19. package/CollapseGroup/package.json +1 -1
  20. package/Combobox/package.json +1 -1
  21. package/ComboboxDeprecated/package.json +1 -1
  22. package/ContextMenu/package.json +1 -1
  23. package/DatePickerCanary/package.json +1 -1
  24. package/DateTimeCanary/package.json +1 -1
  25. package/DragNDropField/package.json +1 -1
  26. package/EventInterceptor/package.json +1 -1
  27. package/FieldCaption/package.json +1 -1
  28. package/FieldLabel/package.json +1 -1
  29. package/File/package.json +1 -1
  30. package/FileField/package.json +1 -1
  31. package/FileIcon/package.json +1 -1
  32. package/FileIconAvi/package.json +1 -1
  33. package/FileIconBmp/package.json +1 -1
  34. package/FileIconCsv/package.json +1 -1
  35. package/FileIconDoc/package.json +1 -1
  36. package/FileIconExe/package.json +1 -1
  37. package/FileIconGif/package.json +1 -1
  38. package/FileIconJpg/package.json +1 -1
  39. package/FileIconJson/package.json +1 -1
  40. package/FileIconLoading/package.json +1 -1
  41. package/FileIconMov/package.json +1 -1
  42. package/FileIconMp3/package.json +1 -1
  43. package/FileIconMp4/package.json +1 -1
  44. package/FileIconPdf/package.json +1 -1
  45. package/FileIconPng/package.json +1 -1
  46. package/FileIconPtt/package.json +1 -1
  47. package/FileIconRar/package.json +1 -1
  48. package/FileIconRtf/package.json +1 -1
  49. package/FileIconTiff/package.json +1 -1
  50. package/FileIconTxt/package.json +1 -1
  51. package/FileIconUndefined/package.json +1 -1
  52. package/FileIconWav/package.json +1 -1
  53. package/FileIconXls/package.json +1 -1
  54. package/FileIconZip/package.json +1 -1
  55. package/Grid/package.json +1 -1
  56. package/Header/package.json +1 -1
  57. package/Icon/package.json +1 -1
  58. package/IconAdd/package.json +1 -1
  59. package/IconAddToComparison/package.json +1 -1
  60. package/IconAlert/package.json +1 -1
  61. package/IconAlignBlocksLeft/package.json +1 -1
  62. package/IconAlignBlocksRight/package.json +1 -1
  63. package/IconAlignCenter/package.json +1 -1
  64. package/IconAlignJustify/package.json +1 -1
  65. package/IconAlignLeft/package.json +1 -1
  66. package/IconAlignRight/package.json +1 -1
  67. package/IconAllDone/package.json +1 -1
  68. package/IconArrowDown/package.json +1 -1
  69. package/IconArrowLeft/package.json +1 -1
  70. package/IconArrowRight/package.json +1 -1
  71. package/IconArrowUp/package.json +1 -1
  72. package/IconArtBrush/package.json +1 -1
  73. package/IconAttach/package.json +1 -1
  74. package/IconBackward/package.json +1 -1
  75. package/IconBag/package.json +1 -1
  76. package/IconBarrier/package.json +1 -1
  77. package/IconBento/package.json +1 -1
  78. package/IconBold/package.json +1 -1
  79. package/IconBook/package.json +1 -1
  80. package/IconBookmarkFilled/package.json +1 -1
  81. package/IconBookmarkStroked/package.json +1 -1
  82. package/IconCalculator/package.json +1 -1
  83. package/IconCalendar/package.json +1 -1
  84. package/IconCamera/package.json +1 -1
  85. package/IconCancel/package.json +1 -1
  86. package/IconCards/package.json +1 -1
  87. package/IconChat/package.json +1 -1
  88. package/IconCheck/package.json +1 -1
  89. package/IconClose/package.json +1 -1
  90. package/IconCollapse/package.json +1 -1
  91. package/IconColorFill/package.json +1 -1
  92. package/IconColorText/package.json +1 -1
  93. package/IconColumns/package.json +1 -1
  94. package/IconComment/package.json +1 -1
  95. package/IconConnection/package.json +1 -1
  96. package/IconCopy/package.json +1 -1
  97. package/IconCrown/package.json +1 -1
  98. package/IconCursorMouse/package.json +1 -1
  99. package/IconDataNull/package.json +1 -1
  100. package/IconDiamond/package.json +1 -1
  101. package/IconDinosaur/package.json +1 -1
  102. package/IconDisconnection/package.json +1 -1
  103. package/IconDocAdd/package.json +1 -1
  104. package/IconDocBlank/package.json +1 -1
  105. package/IconDocDelete/package.json +1 -1
  106. package/IconDocExport/package.json +1 -1
  107. package/IconDocFilled/package.json +1 -1
  108. package/IconDown/package.json +1 -1
  109. package/IconDownload/package.json +1 -1
  110. package/IconDrag/package.json +1 -1
  111. package/IconDraggable/package.json +1 -1
  112. package/IconDrillingRig/package.json +1 -1
  113. package/IconDrop/package.json +1 -1
  114. package/IconEdit/package.json +1 -1
  115. package/IconExit/package.json +1 -1
  116. package/IconExpand/package.json +1 -1
  117. package/IconEye/package.json +1 -1
  118. package/IconEyeClose/package.json +1 -1
  119. package/IconFavorite/package.json +1 -1
  120. package/IconFilter/package.json +1 -1
  121. package/IconFitToDefault/package.json +1 -1
  122. package/IconFlagFilled/package.json +1 -1
  123. package/IconFlagStroked/package.json +1 -1
  124. package/IconFolders/package.json +1 -1
  125. package/IconForward/package.json +1 -1
  126. package/IconFunnel/package.json +1 -1
  127. package/IconGas/package.json +1 -1
  128. package/IconGeo/package.json +1 -1
  129. package/IconGrouping/package.json +1 -1
  130. package/IconHamburger/package.json +1 -1
  131. package/IconHand/package.json +1 -1
  132. package/IconHealth/package.json +1 -1
  133. package/IconInComparison/package.json +1 -1
  134. package/IconInfo/package.json +1 -1
  135. package/IconIntroduction/package.json +1 -1
  136. package/IconIpad/package.json +1 -1
  137. package/IconItalic/package.json +1 -1
  138. package/IconKebab/package.json +1 -1
  139. package/IconLaptop/package.json +1 -1
  140. package/IconLayers/package.json +1 -1
  141. package/IconLeaf/package.json +1 -1
  142. package/IconLightningBolt/package.json +1 -1
  143. package/IconLineAndBarChart/package.json +1 -1
  144. package/IconLink/package.json +1 -1
  145. package/IconList/package.json +1 -1
  146. package/IconListNumbered/package.json +1 -1
  147. package/IconLock/package.json +1 -1
  148. package/IconLogicalElement/package.json +1 -1
  149. package/IconMBU/package.json +1 -1
  150. package/IconMGRP/package.json +1 -1
  151. package/IconMLSP/package.json +1 -1
  152. package/IconMMP/package.json +1 -1
  153. package/IconMail/package.json +1 -1
  154. package/IconMap/package.json +1 -1
  155. package/IconMaxHeight/package.json +1 -1
  156. package/IconMaxWidth/package.json +1 -1
  157. package/IconMeatball/package.json +1 -1
  158. package/IconMic/package.json +1 -1
  159. package/IconMolecules/package.json +1 -1
  160. package/IconMoon/package.json +1 -1
  161. package/IconNodeEnd/package.json +1 -1
  162. package/IconNodeStart/package.json +1 -1
  163. package/IconNodeStep/package.json +1 -1
  164. package/IconNodes/package.json +1 -1
  165. package/IconOpenInNew/package.json +1 -1
  166. package/IconPanelBottom/package.json +1 -1
  167. package/IconPanelLeft/package.json +1 -1
  168. package/IconPanelRight/package.json +1 -1
  169. package/IconPanelTop/package.json +1 -1
  170. package/IconPaste/package.json +1 -1
  171. package/IconPause/package.json +1 -1
  172. package/IconPhone/package.json +1 -1
  173. package/IconPhoto/package.json +1 -1
  174. package/IconPlay/package.json +1 -1
  175. package/IconPressure/package.json +1 -1
  176. package/IconProcessing/package.json +1 -1
  177. package/IconQuestion/package.json +1 -1
  178. package/IconQuote/package.json +1 -1
  179. package/IconRUO/package.json +1 -1
  180. package/IconRUS/package.json +1 -1
  181. package/IconRecord/package.json +1 -1
  182. package/IconRemove/package.json +1 -1
  183. package/IconRemoveFromComparison/package.json +1 -1
  184. package/IconReply/package.json +1 -1
  185. package/IconResize/package.json +1 -1
  186. package/IconRestart/package.json +1 -1
  187. package/IconRevert/package.json +1 -1
  188. package/IconRing/package.json +1 -1
  189. package/IconRouble/package.json +1 -1
  190. package/IconRuler/package.json +1 -1
  191. package/IconScreen/package.json +1 -1
  192. package/IconSearch/package.json +1 -1
  193. package/IconSelect/package.json +1 -1
  194. package/IconSelectOpen/package.json +1 -1
  195. package/IconSettings/package.json +1 -1
  196. package/IconShape/package.json +1 -1
  197. package/IconShuffle/package.json +1 -1
  198. package/IconSmile/package.json +1 -1
  199. package/IconSortDown/package.json +1 -1
  200. package/IconSortDownCenter/package.json +1 -1
  201. package/IconSortUp/package.json +1 -1
  202. package/IconSortUpCenter/package.json +1 -1
  203. package/IconStop/package.json +1 -1
  204. package/IconStorage/package.json +1 -1
  205. package/IconStrikethrough/package.json +1 -1
  206. package/IconSun/package.json +1 -1
  207. package/IconTable/package.json +1 -1
  208. package/IconTarget/package.json +1 -1
  209. package/IconTeam/package.json +1 -1
  210. package/IconTest/package.json +1 -1
  211. package/IconThumbUp/package.json +1 -1
  212. package/IconTie/package.json +1 -1
  213. package/IconTop/package.json +1 -1
  214. package/IconTrash/package.json +1 -1
  215. package/IconType/package.json +1 -1
  216. package/IconUnderline/package.json +1 -1
  217. package/IconUnlock/package.json +1 -1
  218. package/IconUnsort/package.json +1 -1
  219. package/IconUnsortCenter/package.json +1 -1
  220. package/IconUpload/package.json +1 -1
  221. package/IconUser/package.json +1 -1
  222. package/IconVZD/package.json +1 -1
  223. package/IconVideo/package.json +1 -1
  224. package/IconWarning/package.json +1 -1
  225. package/IconWatch/package.json +1 -1
  226. package/IconWideScreen/package.json +1 -1
  227. package/IconWorld/package.json +1 -1
  228. package/Informer/package.json +1 -1
  229. package/LayoutCanary/package.json +1 -1
  230. package/Loader/package.json +1 -1
  231. package/MixCard/package.json +1 -1
  232. package/MixFocus/package.json +1 -1
  233. package/MixSpace/package.json +1 -1
  234. package/MixVisuallyHidden/package.json +1 -1
  235. package/Modal/package.json +1 -1
  236. package/MultiComboboxDeprecated/package.json +1 -1
  237. package/Pagination/package.json +1 -1
  238. package/Popover/package.json +1 -1
  239. package/PortalWithTheme/package.json +1 -1
  240. package/ProgressSpin/package.json +1 -1
  241. package/ProgressStepBarCanary/package.json +1 -1
  242. package/Radio/package.json +1 -1
  243. package/RadioGroup/package.json +1 -1
  244. package/Responses/package.json +1 -1
  245. package/Responses403/package.json +1 -1
  246. package/Responses404/package.json +1 -1
  247. package/Responses500/package.json +1 -1
  248. package/Responses503/package.json +1 -1
  249. package/ResponsesConnectionError/package.json +1 -1
  250. package/ResponsesDeleted/package.json +1 -1
  251. package/ResponsesEmptyBox/package.json +1 -1
  252. package/ResponsesEmptyPockets/package.json +1 -1
  253. package/ResponsesImage/package.json +1 -1
  254. package/ResponsesImage403/package.json +1 -1
  255. package/ResponsesImage404/package.json +1 -1
  256. package/ResponsesImage500/package.json +1 -1
  257. package/ResponsesImage503/package.json +1 -1
  258. package/ResponsesImageConnectionError/package.json +1 -1
  259. package/ResponsesImageDeleted/package.json +1 -1
  260. package/ResponsesImageEmptyBox/package.json +1 -1
  261. package/ResponsesImageEmptyPockets/package.json +1 -1
  262. package/ResponsesImageNothingFound/package.json +1 -1
  263. package/ResponsesImageSuccess/package.json +1 -1
  264. package/ResponsesNothingFound/package.json +1 -1
  265. package/ResponsesSuccess/package.json +1 -1
  266. package/Select/package.json +1 -1
  267. package/Sidebar/package.json +1 -1
  268. package/Skeleton/package.json +1 -1
  269. package/SliderCanary/package.json +1 -1
  270. package/SnackBar/package.json +1 -1
  271. package/Steps/package.json +1 -1
  272. package/Switch/package.json +1 -1
  273. package/SwitchGroup/package.json +1 -1
  274. package/Table/package.json +1 -1
  275. package/Tabs/package.json +1 -1
  276. package/Tag/package.json +1 -1
  277. package/TagBase/package.json +1 -1
  278. package/Text/package.json +1 -1
  279. package/TextField/package.json +1 -1
  280. package/Theme/package.json +1 -1
  281. package/ThemeToggler/package.json +1 -1
  282. package/Timer/package.json +1 -1
  283. package/Tooltip/package.json +1 -1
  284. package/User/package.json +1 -1
  285. package/UserSelect/package.json +1 -1
  286. package/UserSelectDeprecated/package.json +1 -1
  287. package/__internal__/cjs-src/components/BreadcrumbsCanary/Breadcrumbs.css +75 -0
  288. package/__internal__/cjs-src/components/BreadcrumbsCanary/BreadcrumbsCanary.d.ts +5 -0
  289. package/__internal__/cjs-src/components/BreadcrumbsCanary/BreadcrumbsCanary.js +57 -0
  290. package/__internal__/cjs-src/components/BreadcrumbsCanary/helpers.d.ts +16 -0
  291. package/__internal__/cjs-src/components/BreadcrumbsCanary/helpers.js +21 -0
  292. package/__internal__/cjs-src/components/BreadcrumbsCanary/types.d.ts +36 -0
  293. package/__internal__/cjs-src/components/BreadcrumbsCanary/types.js +5 -0
  294. package/__internal__/cjs-src/components/Checkbox/Checkbox.css +74 -80
  295. package/__internal__/cjs-src/components/DatePickerCanary/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js +1 -1
  296. package/__internal__/cjs-src/components/DatePickerCanary/helpers.d.ts +9 -0
  297. package/__internal__/cjs-src/components/EventInterceptor/eventInterceptorMap.d.ts +1 -0
  298. package/__internal__/cjs-src/components/EventInterceptor/propsHandlers/useTextFieldEventsHandler.d.ts +1 -0
  299. package/__internal__/cjs-src/components/ProgressStepBarCanary/ProgressStepBarCanary.js +2 -1
  300. package/__internal__/cjs-src/components/ProgressStepBarCanary/ProgressStepBarItem/ProgressStepBarItem.js +4 -4
  301. package/__internal__/cjs-src/components/SliderCanary/Slider.css +4 -0
  302. package/__internal__/cjs-src/components/SliderCanary/SliderCanary.js +9 -11
  303. package/__internal__/cjs-src/components/SliderCanary/SliderPoint/SliderPoint.css +1 -0
  304. package/__internal__/cjs-src/components/SliderCanary/SliderPoint/SliderPoint.js +3 -5
  305. package/__internal__/cjs-src/components/SliderCanary/helper.d.ts +4 -2
  306. package/__internal__/cjs-src/components/SliderCanary/useSlider/helper.d.ts +4 -4
  307. package/__internal__/cjs-src/components/SliderCanary/useSlider/helper.js +8 -7
  308. package/__internal__/cjs-src/components/SliderCanary/useSlider/useSlider.js +53 -66
  309. package/__internal__/cjs-src/components/SliderCanary/useSliderStationing.js +10 -13
  310. package/__internal__/cjs-src/components/SnackBar/Item/SnackBar-Item.d.ts +4 -1
  311. package/__internal__/cjs-src/components/SnackBar/Item/SnackBar-Item.js +9 -8
  312. package/__internal__/cjs-src/components/SnackBar/SnackBar.js +11 -4
  313. package/__internal__/cjs-src/components/TextField/TextField.js +2 -2
  314. package/__internal__/cjs-src/components/TextField/helpers.d.ts +1 -0
  315. package/__internal__/cjs-src/components/Theme/_size/Theme_size_gpnDefault.css +1 -1
  316. package/__internal__/cjs-src/mixs/MixCard/MixCard.css +0 -98
  317. package/__internal__/cjs-src/mixs/MixCard/MixCard.d.ts +1 -1
  318. package/__internal__/cjs-src/mixs/MixCard/MixCard.js +10 -1
  319. package/__internal__/src/components/BreadcrumbsCanary/Breadcrumbs.css +75 -0
  320. package/__internal__/src/components/BreadcrumbsCanary/BreadcrumbsCanary.d.ts +5 -0
  321. package/__internal__/src/components/BreadcrumbsCanary/BreadcrumbsCanary.js +54 -0
  322. package/__internal__/src/components/BreadcrumbsCanary/helpers.d.ts +16 -0
  323. package/__internal__/src/components/BreadcrumbsCanary/helpers.js +16 -0
  324. package/__internal__/src/components/BreadcrumbsCanary/types.d.ts +36 -0
  325. package/__internal__/src/components/BreadcrumbsCanary/types.js +2 -0
  326. package/__internal__/src/components/Checkbox/Checkbox.css +74 -80
  327. package/__internal__/src/components/DatePickerCanary/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js +1 -1
  328. package/__internal__/src/components/DatePickerCanary/helpers.d.ts +9 -0
  329. package/__internal__/src/components/EventInterceptor/eventInterceptorMap.d.ts +1 -0
  330. package/__internal__/src/components/EventInterceptor/propsHandlers/useTextFieldEventsHandler.d.ts +1 -0
  331. package/__internal__/src/components/ProgressStepBarCanary/ProgressStepBarCanary.js +2 -1
  332. package/__internal__/src/components/ProgressStepBarCanary/ProgressStepBarItem/ProgressStepBarItem.js +4 -4
  333. package/__internal__/src/components/SliderCanary/Slider.css +4 -0
  334. package/__internal__/src/components/SliderCanary/SliderCanary.js +5 -7
  335. package/__internal__/src/components/SliderCanary/SliderPoint/SliderPoint.css +1 -0
  336. package/__internal__/src/components/SliderCanary/SliderPoint/SliderPoint.js +3 -5
  337. package/__internal__/src/components/SliderCanary/helper.d.ts +4 -2
  338. package/__internal__/src/components/SliderCanary/useSlider/helper.d.ts +4 -4
  339. package/__internal__/src/components/SliderCanary/useSlider/helper.js +8 -7
  340. package/__internal__/src/components/SliderCanary/useSlider/useSlider.js +53 -66
  341. package/__internal__/src/components/SliderCanary/useSliderStationing.js +11 -14
  342. package/__internal__/src/components/SnackBar/Item/SnackBar-Item.d.ts +4 -1
  343. package/__internal__/src/components/SnackBar/Item/SnackBar-Item.js +9 -8
  344. package/__internal__/src/components/SnackBar/SnackBar.js +11 -4
  345. package/__internal__/src/components/TextField/TextField.js +2 -2
  346. package/__internal__/src/components/TextField/helpers.d.ts +1 -0
  347. package/__internal__/src/components/Theme/_size/Theme_size_gpnDefault.css +1 -1
  348. package/__internal__/src/mixs/MixCard/MixCard.css +0 -98
  349. package/__internal__/src/mixs/MixCard/MixCard.d.ts +1 -1
  350. package/__internal__/src/mixs/MixCard/MixCard.js +10 -1
  351. package/createIcon/package.json +1 -1
  352. package/createResponsesImage/package.json +1 -1
  353. package/package.json +2 -1
  354. package/useBreakpoints/package.json +1 -1
  355. package/useChoiceGroup/package.json +1 -1
  356. package/useChoiceGroupIndexed/package.json +1 -1
  357. package/useClickOutside/package.json +1 -1
  358. package/useComponentSize/package.json +1 -1
  359. package/useDebounce/package.json +1 -1
  360. package/useFlag/package.json +1 -1
  361. package/useForkRef/package.json +1 -1
  362. package/useGlobalKeys/package.json +1 -1
  363. package/useKeys/package.json +1 -1
  364. package/useMutableRef/package.json +1 -1
  365. package/useOverflow/package.json +1 -1
  366. package/usePrevious/package.json +1 -1
  367. package/useResizeObserved/package.json +1 -1
  368. package/useScrollElements/package.json +1 -1
  369. package/useScrollPosition/package.json +1 -1
  370. package/useSelect/package.json +1 -1
  371. package/useThemeVars/package.json +1 -1
  372. package/useTimer/package.json +1 -1
  373. package/withTooltip/package.json +1 -1
@@ -68,7 +68,8 @@ function ProgressStepBarRender(props, ref) {
68
68
  position: getItemPosition(index, steps.length),
69
69
  pointRef: stepsRef[index],
70
70
  direction: direction,
71
- onClick: onClick || onItemClickHandler
71
+ onClick: onClick || onItemClickHandler,
72
+ key: cnProgressStepBar({ index: index })
72
73
  };
73
74
  };
74
75
  var isOverflow = useOverflow({ currentRef: listRef });
@@ -26,11 +26,11 @@ var renderPointContent = function (point, size, progress) {
26
26
  return React.createElement(ProgressSpin, { size: size });
27
27
  if (!point)
28
28
  return null;
29
- if (typeof point === 'function') {
30
- var Icon = point;
31
- return React.createElement(Icon, { size: "xs" });
29
+ if (typeof point === 'number') {
30
+ return (React.createElement(Text, { className: cnProgressStepBarItem('PointText'), size: size === 's' ? '2xs' : 'xs', weight: "bold" }, point));
32
31
  }
33
- return (React.createElement(Text, { className: cnProgressStepBarItem('PointText'), size: size === 's' ? '2xs' : 'xs', weight: "bold" }, point));
32
+ var Icon = point;
33
+ return React.createElement(Icon, { size: "xs" });
34
34
  };
35
35
  export var ProgressStepBarItem = React.forwardRef(function (props, ref) {
36
36
  var content = props.content, tooltipContent = props.tooltipContent, label = props.label, point = props.point, status = props.status, progress = props.progress, direction = props.direction, size = props.size, pointRef = props.pointRef, onClick = props.onClick, _a = props.position, position = _a === void 0 ? propPositionDefault : _a, otherProps = __rest(props, ["content", "tooltipContent", "label", "point", "status", "progress", "direction", "size", "pointRef", "onClick", "position"]);
@@ -61,6 +61,10 @@
61
61
  align-items: center;
62
62
  width: 100%;
63
63
  height: var(--space-m);
64
+ -webkit-user-select: none;
65
+ -moz-user-select: none;
66
+ -ms-user-select: none;
67
+ user-select: none;
64
68
  }
65
69
 
66
70
  .Slider-Side_position_left {
@@ -9,9 +9,8 @@ import { FieldLabel } from '../FieldLabel/FieldLabel';
9
9
  import { SliderInput } from './SliderInput/SliderInput';
10
10
  import { SliderLine } from './SliderLine/SliderLine';
11
11
  import { SliderPoint } from './SliderPoint/SliderPoint';
12
- import { getActiveValue } from './useSlider/helper';
13
12
  import { useSlider } from './useSlider/useSlider';
14
- import { defaultPropSize, defaultTooltipFormatter, isNotRangeParams, isRangeParams, } from './helper';
13
+ import { defaultPropSize, defaultTooltipFormatter, isNotRangeParams, } from './helper';
15
14
  import { useSliderStationing } from './useSliderStationing';
16
15
  var cnSlider = cn('Slider');
17
16
  var sizeMap = {
@@ -40,8 +39,8 @@ function SliderRender(props, ref) {
40
39
  onAfterChange: onAfterChange,
41
40
  sliderRef: sliderRef,
42
41
  buttonRefs: [leftButtonRef, rightButtonRef]
43
- }), onKeyPress = _l.onKeyPress, onFocus = _l.onFocus, dragPoint = _l.dragPoint, popoverPosition = _l.popoverPosition, activeButton = _l.activeButton, currentValue = _l.currentValue;
44
- var _m = useSliderStationing(currentValue, min, max, view, range, step, [leftButtonRef, rightButtonRef], sliderRef), lineSizes = _m.lineSizes, buttonPositions = _m.buttonPositions;
42
+ }), onKeyPress = _l.onKeyPress, onFocus = _l.onFocus, handlePress = _l.handlePress, popoverPosition = _l.popoverPosition, activeButton = _l.activeButton, currentValue = _l.currentValue;
43
+ var _m = useSliderStationing(currentValue.length === 1 ? currentValue[0] : currentValue, min, max, view, range, step, [leftButtonRef, rightButtonRef], sliderRef), lineSizes = _m.lineSizes, buttonPositions = _m.buttonPositions;
45
44
  var changeHovered = function (status) {
46
45
  if (status)
47
46
  on();
@@ -56,9 +55,8 @@ function SliderRender(props, ref) {
56
55
  IconLeft && (React.createElement("div", { className: cnSlider('Side', { position: 'left' }) },
57
56
  React.createElement(IconLeft, { size: iconSize, view: "secondary" }))),
58
57
  React.createElement("div", { className: cnSlider('Control'), ref: sliderRef },
59
- React.createElement(SliderLine, { hovered: isHovered, onHover: changeHovered, lines: lineSizes, disabled: disabled, view: view }),
60
- React.createElement(SliderPoint, { hovered: isHovered, buttonRef: leftButtonRef, popoverPosition: popoverPosition[0], onKeyPress: onKeyPress, onFocus: onFocus, disabled: disabled, onMouseDown: dragPoint, position: buttonPositions[0], focused: activeButton === 'left', buttonLabel: "left", withTooltip: withTooltip, onHover: changeHovered, value: tooltipFormatter(getActiveValue(currentValue, 'left')) }),
61
- isRangeParams(props) && (React.createElement(SliderPoint, { hovered: isHovered, buttonRef: rightButtonRef, onFocus: onFocus, popoverPosition: popoverPosition[1], onKeyPress: onKeyPress, disabled: disabled, onMouseDown: dragPoint, focused: activeButton === 'right', withTooltip: withTooltip, position: buttonPositions[1], buttonLabel: "right", onHover: changeHovered, value: tooltipFormatter(getActiveValue(currentValue, 'right')) }))),
58
+ React.createElement(SliderLine, { hovered: isHovered || typeof activeButton === 'number', onHover: changeHovered, lines: lineSizes, disabled: disabled, view: view }),
59
+ currentValue.map(function (val, index) { return (React.createElement(SliderPoint, { hovered: isHovered || typeof activeButton === 'number', buttonRef: leftButtonRef, popoverPosition: popoverPosition[index], onKeyPress: onKeyPress, onFocus: onFocus, handlePress: handlePress, disabled: disabled, position: buttonPositions[index], focused: activeButton === index, buttonLabel: index, withTooltip: withTooltip, onHover: changeHovered, tooltipFormatter: tooltipFormatter, value: val, role: "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": val })); })),
62
60
  IconRight && (React.createElement("div", { className: cnSlider('Side', { position: 'right' }) },
63
61
  React.createElement(IconRight, { size: iconSize, view: "secondary" })))),
64
62
  caption && (React.createElement(FieldCaption, { className: cnSlider('Caption'), status: status }, caption))));
@@ -14,6 +14,7 @@
14
14
  align-items: center;
15
15
  width: var(--space-m);
16
16
  height: var(--space-m);
17
+ padding: 0;
17
18
  background-color: var(--color-bg-default);
18
19
  border: var(--space-3xs) solid var(--color-control-bg-primary);
19
20
  border-radius: calc(var(--space-m) * 0.5);
@@ -20,7 +20,7 @@ var getTooltipPosition = function (popoverPosition, buttonRef) {
20
20
  };
21
21
  export var SliderPoint = function (props) {
22
22
  var _a;
23
- var hovered = props.hovered, onHover = props.onHover, value = props.value, position = props.position, disabled = props.disabled, withTooltip = props.withTooltip, focused = props.focused, popoverPosition = props.popoverPosition, buttonRef = props.buttonRef, onKeyPress = props.onKeyPress, buttonLabel = props.buttonLabel, onFocus = props.onFocus, otherProps = __rest(props, ["hovered", "onHover", "value", "position", "disabled", "withTooltip", "focused", "popoverPosition", "buttonRef", "onKeyPress", "buttonLabel", "onFocus"]);
23
+ var hovered = props.hovered, onHover = props.onHover, value = props.value, position = props.position, disabled = props.disabled, withTooltip = props.withTooltip, focused = props.focused, popoverPosition = props.popoverPosition, buttonRef = props.buttonRef, handlePress = props.handlePress, onKeyPress = props.onKeyPress, tooltipFormatter = props.tooltipFormatter, buttonLabel = props.buttonLabel, onFocus = props.onFocus, otherProps = __rest(props, ["hovered", "onHover", "value", "position", "disabled", "withTooltip", "focused", "popoverPosition", "buttonRef", "handlePress", "onKeyPress", "tooltipFormatter", "buttonLabel", "onFocus"]);
24
24
  var _b = __read(useFlag(false), 2), tooltipVisible = _b[0], _c = _b[1], on = _c.on, off = _c.off;
25
25
  var theme = useTheme().theme;
26
26
  var tooltipTheme = __assign(__assign({}, theme), { color: {
@@ -56,11 +56,9 @@ export var SliderPoint = function (props) {
56
56
  };
57
57
  var pointRef = useRef(null);
58
58
  return (React.createElement(React.Fragment, null,
59
- React.createElement("button", __assign({ type: "button", "aria-label": buttonLabel + "-button", className: cnSliderPoint({ hovered: hovered, disabled: disabled }, [!disabled ? cnMixFocus() : '']), onMouseOver: function () { return handleMouseAction(true); }, onMouseOut: function () { return handleMouseAction(false); }, onKeyDown: function (e) { return onKeyPress === null || onKeyPress === void 0 ? void 0 : onKeyPress(e, buttonLabel); }, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus,
60
- // onMouseUp={handleBlur}
61
- ref: useForkRef([buttonRef, pointRef]), tabIndex: 0, style: (_a = {},
59
+ React.createElement("button", __assign({ type: "button", "aria-label": buttonLabel + "-button", className: cnSliderPoint({ hovered: hovered, disabled: disabled }, [!disabled ? cnMixFocus() : '']), onMouseOver: function () { return handleMouseAction(true); }, onMouseOut: function () { return handleMouseAction(false); }, onMouseDown: function () { return handlePress === null || handlePress === void 0 ? void 0 : handlePress(buttonLabel); }, onTouchStart: function () { return handlePress === null || handlePress === void 0 ? void 0 : handlePress(buttonLabel); }, onKeyDown: function (e) { return onKeyPress === null || onKeyPress === void 0 ? void 0 : onKeyPress(e, buttonLabel); }, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus, ref: useForkRef([buttonRef, pointRef]), tabIndex: 0, style: (_a = {},
62
60
  _a['--slider-button-left'] = position + "%",
63
61
  _a) }, otherProps)),
64
62
  tooltipVisible && withTooltip && popoverPosition && (React.createElement(ThemeContext.Provider, { value: { theme: tooltipTheme, themeClassNames: tooltipThemeClassNames } },
65
- React.createElement(Tooltip, { position: getTooltipPosition(popoverPosition, buttonRef || pointRef), className: cnSliderPoint('Tooltip'), direction: "downCenter", possibleDirections: ['downCenter', 'leftDown', 'rightDown'] }, value)))));
63
+ React.createElement(Tooltip, { position: getTooltipPosition(popoverPosition, buttonRef || pointRef), className: cnSliderPoint('Tooltip'), direction: "downCenter", possibleDirections: ['downCenter', 'leftDown', 'rightDown'] }, tooltipFormatter ? tooltipFormatter(value) : value)))));
66
64
  };
@@ -48,16 +48,18 @@ export declare type SliderLineProps = {
48
48
  onHover?: (hovered: boolean) => void;
49
49
  };
50
50
  export declare type SliderPointProps = PropsWithHTMLAttributes<{
51
- value?: number | string;
51
+ value?: number;
52
52
  disabled?: boolean;
53
53
  focused?: boolean;
54
54
  hovered?: boolean;
55
55
  withTooltip?: boolean;
56
+ handlePress?: (typeButton: ActiveButton) => void;
56
57
  buttonLabel?: ActiveButton;
57
58
  buttonRef?: React.RefObject<HTMLButtonElement>;
58
59
  popoverPosition?: TrackPosition;
60
+ tooltipFormatter?: PropToolipFormatter;
59
61
  onFocus?: (e: React.FocusEvent<HTMLButtonElement> | React.MouseEvent, button: ActiveButton) => void;
60
- onKeyPress?: (e: React.KeyboardEvent, typeButton: ActiveButton) => void;
62
+ onKeyPress?: (e: React.KeyboardEvent, typeButton?: ActiveButton) => void;
61
63
  onHover?: (hovered: boolean) => void;
62
64
  position: number;
63
65
  }, HTMLButtonElement>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PropOnChange, SliderValue, TrackPosition } from '../helper';
3
- export declare type ActiveButton = 'left' | 'right' | null | undefined;
3
+ export declare type ActiveButton = 0 | 1 | null | undefined;
4
4
  export declare type Stationing = {
5
5
  x: number;
6
6
  y: number;
@@ -22,14 +22,14 @@ export declare type UseSliderProps<RANGE extends boolean = false> = {
22
22
  export declare type UseSliderValues = {
23
23
  onKeyPress: (e: React.KeyboardEvent, typeButton: ActiveButton) => void;
24
24
  onFocus: (e: React.FocusEvent<HTMLButtonElement> | React.MouseEvent, button: ActiveButton) => void;
25
+ handlePress: (typeButton: ActiveButton) => void;
25
26
  activeButton: ActiveButton;
26
- dragPoint: () => void;
27
- currentValue: number | [number, number];
27
+ currentValue: [number] | [number, number];
28
28
  popoverPosition: TrackPosition[];
29
29
  };
30
30
  export declare const isRangeParams: (params: UseSliderProps<boolean>) => params is UseSliderProps<true>;
31
31
  export declare const isNotRangeParams: (params: UseSliderProps<boolean>) => params is UseSliderProps<false>;
32
- export declare const trackPosition: (event: Event | React.TouchEvent | React.MouseEvent) => TrackPosition;
32
+ export declare const trackPosition: (event: TouchEvent | MouseEvent) => TrackPosition;
33
33
  export declare const getActiveValue: (value: number | [number, number], active: ActiveButton) => number;
34
34
  export declare const detectActiveButton: (posittion: TrackPosition, buttons: React.RefObject<HTMLButtonElement>[]) => ActiveButton;
35
35
  export declare const getValidValue: (value: number, min: number, max: number, step?: number | number[] | undefined) => number;
@@ -13,11 +13,14 @@ export var trackPosition = function (event) {
13
13
  y: event.clientY
14
14
  };
15
15
  }
16
- return null;
16
+ return {
17
+ x: event.changedTouches[0].clientX,
18
+ y: event.changedTouches[0].clientY
19
+ };
17
20
  };
18
21
  export var getActiveValue = function (value, active) {
19
22
  if (Array.isArray(value)) {
20
- return active === 'left' ? value[0] : value[1];
23
+ return value[typeof active === 'number' ? active : 0];
21
24
  }
22
25
  return value;
23
26
  };
@@ -31,7 +34,7 @@ export var detectActiveButton = function (position, buttons) {
31
34
  x + width >= position.x &&
32
35
  y <= position.y &&
33
36
  y + height >= position.y) {
34
- activeButton = index === 0 ? 'left' : 'right';
37
+ activeButton = index;
35
38
  button.focus();
36
39
  }
37
40
  }
@@ -101,7 +104,7 @@ export var getNewValue = function (changedValue, currentValue, step, min, max, a
101
104
  var minRangeValue = min;
102
105
  if (Array.isArray(currentValue)) {
103
106
  var _a = __read(currentValue, 2), left = _a[0], right = _a[1];
104
- if (activeButton === 'right') {
107
+ if (activeButton === 1) {
105
108
  minRangeValue = left;
106
109
  }
107
110
  else {
@@ -110,9 +113,7 @@ export var getNewValue = function (changedValue, currentValue, step, min, max, a
110
113
  }
111
114
  var analyzedValue = getValidValue(analyzeDivisionValue(changedValue, step, min, max), minRangeValue, maxRangeValue, step);
112
115
  if (Array.isArray(currentValue)) {
113
- return activeButton === 'right'
114
- ? [currentValue[0], analyzedValue]
115
- : [analyzedValue, currentValue[1]];
116
+ return activeButton === 1 ? [currentValue[0], analyzedValue] : [analyzedValue, currentValue[1]];
116
117
  }
117
118
  return analyzedValue;
118
119
  };
@@ -1,7 +1,7 @@
1
1
  import { __read, __spread } from "tslib";
2
2
  import { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { useComponentSize } from '../../../hooks/useComponentSize/useComponentSize';
4
- import { useFlag } from '../../../hooks/useFlag/useFlag';
4
+ import { useMutableRef } from '../../../hooks/useMutableRef/useMutableRef';
5
5
  import { getActiveValue, getNewValue, getValidValue, getValueByPosition, isNotRangeParams, isRangeParams, trackPosition, } from './helper';
6
6
  export function useSlider(props) {
7
7
  var disabled = props.disabled, range = props.range, value = props.value, min = props.min, max = props.max, _a = props.step, step = _a === void 0 ? 1 : _a, onChange = props.onChange, onAfterChange = props.onAfterChange, sliderRef = props.sliderRef, buttonRefs = props.buttonRefs;
@@ -10,51 +10,34 @@ export function useSlider(props) {
10
10
  var _b = __read(useState(value), 2), currentValue = _b[0], setCurrentValue = _b[1];
11
11
  var _c = __read(useState(null), 2), leftPopover = _c[0], setLeftPopover = _c[1];
12
12
  var _d = __read(useState(null), 2), rightPopover = _d[0], setRightPopover = _d[1];
13
- var _e = __read(useFlag(false), 2), draggable = _e[0], _f = _e[1], on = _f.on, off = _f.off;
14
13
  var activeButton = useRef(null);
15
14
  var sizeSlider = useComponentSize(sliderRef);
16
- var addListeners = function () {
17
- document.addEventListener('mouseup', handleTouchEnd);
18
- document.addEventListener('touchend', handleTouchEnd);
19
- document.addEventListener('mousemove', handleTouchMove);
20
- document.addEventListener('touchmove', handleTouchMove);
21
- };
22
- var removeListeners = function () {
23
- document.removeEventListener('mouseup', handleTouchEnd);
24
- document.removeEventListener('touchend', handleTouchEnd);
25
- document.removeEventListener('mousemove', handleTouchMove);
26
- document.removeEventListener('touchmove', handleTouchMove);
27
- };
15
+ var lastValue = useMutableRef(currentValue);
28
16
  useEffect(function () {
29
- addListeners();
30
- return function () {
31
- removeListeners();
32
- };
33
- }, [
34
- activeButton.current,
35
- step,
36
- currentValue,
37
- value,
38
- min,
39
- max,
40
- sliderRef.current,
41
- buttonRefs,
42
- disabled,
43
- draggable,
44
- ]);
17
+ if (disabled) {
18
+ controlListeners('remove');
19
+ }
20
+ }, [disabled]);
21
+ var controlListeners = function (type) {
22
+ var method = type === 'add' ? 'addEventListener' : 'removeEventListener';
23
+ document[method]('mouseup', handleRelease);
24
+ document[method]('touchend', handleRelease);
25
+ document[method]('mousemove', handleTouchMove);
26
+ document[method]('touchmove', handleTouchMove);
27
+ };
45
28
  useEffect(function () {
46
29
  if (Array.isArray(currentValue)) {
47
- setTooltipPosition(currentValue[0], 'left');
48
- setTooltipPosition(currentValue[1], 'right');
30
+ setTooltipPosition(currentValue[0], 0);
31
+ setTooltipPosition(currentValue[1], 1);
49
32
  }
50
33
  else {
51
- setTooltipPosition(currentValue, 'left');
34
+ setTooltipPosition(currentValue, 0);
52
35
  }
53
36
  }, [currentValue]);
54
37
  useEffect(function () {
55
38
  if (JSON.stringify(value) !== JSON.stringify(currentValue)) {
56
39
  setCurrentValue(value);
57
- setTooltipPosition(getActiveValue(value, activeButton.current), 'left');
40
+ setTooltipPosition(getActiveValue(value, activeButton.current), 0);
58
41
  activeButton.current = null;
59
42
  }
60
43
  }, [value]);
@@ -62,10 +45,10 @@ export function useSlider(props) {
62
45
  onChange === null || onChange === void 0 ? void 0 : onChange({
63
46
  value: Array.isArray(currentValue)
64
47
  ? [
65
- getNewValue(currentValue[0], currentValue[0], step, min, max, 'left'),
66
- getNewValue(currentValue[1], currentValue[1], step, min, max, 'right'),
48
+ getNewValue(currentValue[0], currentValue[0], step, min, max, 0),
49
+ getNewValue(currentValue[1], currentValue[1], step, min, max, 1),
67
50
  ]
68
- : getNewValue(currentValue, currentValue, step, min, max, 'left')
51
+ : getNewValue(currentValue, currentValue, step, min, max, 0)
69
52
  });
70
53
  }, [step]);
71
54
  useEffect(function () {
@@ -89,7 +72,7 @@ export function useSlider(props) {
89
72
  }
90
73
  }, []);
91
74
  var onKeyPress = useCallback(function (event, typeButton) {
92
- if (!disabled && typeof typeButton === 'string' && typeof currentValue !== 'undefined') {
75
+ if (!disabled && typeof typeButton === 'number' && typeof currentValue !== 'undefined') {
93
76
  var stepIncrement_1 = !Array.isArray(step) ? step || 1 : 1;
94
77
  var validKeyCode = false;
95
78
  var changedValue_1 = getActiveValue(currentValue, typeButton);
@@ -118,7 +101,7 @@ export function useSlider(props) {
118
101
  stepsArr_1 = __spread(stepsArr_1, [maxValue]);
119
102
  }
120
103
  stepsArr_1.forEach(function (stepPoint, index) {
121
- if (typeof typeButton === 'string' && changedValue_1 === stepPoint) {
104
+ if (typeof typeButton === 'number' && changedValue_1 === stepPoint) {
122
105
  if (stepIncrement_1 >= 0) {
123
106
  if (index === 0) {
124
107
  stepIncrement_1 = stepsArr_1[1] - minValue;
@@ -152,14 +135,14 @@ export function useSlider(props) {
152
135
  }
153
136
  }, [currentValue, step, min, max]);
154
137
  var setTooltipPosition = function (value, position) {
155
- if (sliderRef.current && position) {
156
- var button = buttonRefs[position === 'left' ? 0 : 1].current || sliderRef.current;
138
+ if (sliderRef.current && typeof position === 'number') {
139
+ var button = buttonRefs[position].current || sliderRef.current;
157
140
  var _a = sliderRef.current.getBoundingClientRect(), x = _a.x, width = _a.width;
158
141
  var newPosition = {
159
142
  y: button.offsetTop + button.offsetHeight + 50,
160
143
  x: x + Math.abs((value - minValue) / (maxValue - minValue)) * width
161
144
  };
162
- if (position === 'left') {
145
+ if (position === 0) {
163
146
  setLeftPopover(newPosition);
164
147
  }
165
148
  else {
@@ -169,7 +152,7 @@ export function useSlider(props) {
169
152
  };
170
153
  var changePosition = function (event) {
171
154
  var nativeEvent = event;
172
- if (typeof activeButton.current !== 'string') {
155
+ if (typeof activeButton.current !== 'number') {
173
156
  return value;
174
157
  }
175
158
  var position = trackPosition(nativeEvent);
@@ -179,49 +162,53 @@ export function useSlider(props) {
179
162
  var onFocus = function (e, button) {
180
163
  activeButton.current = button;
181
164
  };
182
- var handleTouchMove = function (event) {
183
- if (typeof activeButton.current === 'string' && draggable) {
165
+ var handleTouchMove = function (event, typeButton) {
166
+ var button = typeButton || activeButton.current;
167
+ if (typeof button === 'number') {
184
168
  var position = changePosition(event);
185
- var oldValue = getActiveValue(currentValue, activeButton.current);
186
- var newValue = getActiveValue(position, activeButton.current);
169
+ var oldValue = getActiveValue(currentValue, button);
170
+ var newValue = getActiveValue(position, button);
187
171
  if (oldValue !== newValue) {
188
172
  setCurrentValue(position);
189
173
  onAfterChange === null || onAfterChange === void 0 ? void 0 : onAfterChange({ e: event, value: position });
190
174
  }
191
175
  }
192
176
  };
193
- var handleTouchEnd = function (event) {
194
- var position = changePosition(event);
195
- if (typeof position !== 'undefined') {
196
- setCurrentValue(position);
197
- onChange === null || onChange === void 0 ? void 0 : onChange({ e: event, value: position });
198
- }
199
- off();
200
- if (JSON.stringify(position) !== JSON.stringify(currentValue)) {
201
- buttonRefs.forEach(function (button) {
202
- var _a;
203
- (_a = button.current) === null || _a === void 0 ? void 0 : _a.blur();
204
- });
205
- activeButton.current = null;
206
- }
207
- };
208
177
  useEffect(function () {
209
178
  if (isRangeParams(props)) {
210
179
  props.value.forEach(function (val, index) {
211
- setTooltipPosition(getActiveValue(val, activeButton.current), index === 0 ? 'left' : 'right');
180
+ setTooltipPosition(getActiveValue(val, activeButton.current), index === 0 ? 0 : 1);
212
181
  });
213
182
  }
214
183
  if (isNotRangeParams(props)) {
215
- setTooltipPosition(getActiveValue(value, activeButton.current), 'left');
184
+ setTooltipPosition(getActiveValue(value, activeButton.current), 0);
216
185
  }
217
186
  activeButton.current = null;
218
187
  }, [sizeSlider, typeof value]);
188
+ var handleRelease = useCallback(function (e) {
189
+ var _a, _b;
190
+ controlListeners('remove');
191
+ if (isRangeParams(props) && Array.isArray(lastValue.current)) {
192
+ var copyValues = __spread(lastValue.current).sort(function (a, b) { return Number(a) - Number(b); });
193
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, { e: e, value: copyValues });
194
+ }
195
+ if (isNotRangeParams(props) && typeof lastValue.current === 'number') {
196
+ (_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, { e: e, value: lastValue.current });
197
+ }
198
+ activeButton.current = null;
199
+ }, [lastValue, value, onChange, handleTouchMove]);
200
+ var handlePress = useCallback(function (typeButton) {
201
+ if (!disabled) {
202
+ activeButton.current = typeButton;
203
+ controlListeners('add');
204
+ }
205
+ }, [currentValue, value, onChange, handleTouchMove, disabled]);
219
206
  return {
220
207
  onKeyPress: onKeyPress,
221
208
  onFocus: onFocus,
222
- dragPoint: on,
209
+ handlePress: handlePress,
223
210
  activeButton: activeButton.current,
224
211
  popoverPosition: [leftPopover, rightPopover],
225
- currentValue: currentValue
212
+ currentValue: Array.isArray(currentValue) ? currentValue : [currentValue]
226
213
  };
227
214
  }
@@ -1,4 +1,4 @@
1
- import { __read } from "tslib";
1
+ import { __read, __spread } from "tslib";
2
2
  import { useCallback, useEffect, useState } from 'react';
3
3
  export var getSteps = function (step, min, max) {
4
4
  var stepsArray = [];
@@ -48,18 +48,15 @@ export var useSliderStationing = function (value, min, max, view, range, step, b
48
48
  });
49
49
  }
50
50
  else if (Array.isArray(value) && value) {
51
- sizesArray.push({
52
- width: ((value[0] - min) / absoluteSize) * 100,
53
- active: false
54
- });
55
- sizesArray.push({
56
- width: ((value[1] - value[0]) / absoluteSize) * 100,
57
- active: true
58
- });
59
- sizesArray.push({
60
- width: ((max - value[1]) / absoluteSize) * 100,
61
- active: false
62
- });
51
+ var endPointArray = __spread(value);
52
+ endPointArray.unshift(min);
53
+ endPointArray.push(max);
54
+ for (var i = 0; i < endPointArray.length - 1; i++) {
55
+ sizesArray.push({
56
+ width: ((endPointArray[i + 1] - endPointArray[i]) / absoluteSize) * 100,
57
+ active: endPointArray[i] !== min && endPointArray[i + 1] !== max
58
+ });
59
+ }
63
60
  }
64
61
  else {
65
62
  sizesArray.push({
@@ -74,7 +71,7 @@ export var useSliderStationing = function (value, min, max, view, range, step, b
74
71
  width: (Math.abs(stepSize.max - stepSize.min) * 100) / absoluteSize,
75
72
  active: (typeof value === 'number' || Array.isArray(value)) &&
76
73
  (range && Array.isArray(value)
77
- ? stepSize.max > value[0] && stepSize.min < value[1]
74
+ ? stepSize.max > value[0] && stepSize.min < value[value.length - 1]
78
75
  : stepSize.max <= value)
79
76
  });
80
77
  });
@@ -1,8 +1,11 @@
1
1
  import '../../Theme/_color/Theme_color_gpnDark.css';
2
2
  import './SnackBar-Item.css';
3
3
  import React from 'react';
4
+ import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
4
5
  import { Item } from '../SnackBar';
5
6
  export declare type SnackBarItemProps = {
6
7
  item: Item;
7
8
  };
8
- export declare const SnackBarItem: React.FC<SnackBarItemProps>;
9
+ declare type SnackBarItemComponent = (props: PropsWithHTMLAttributesAndRef<SnackBarItemProps, HTMLDivElement>) => React.ReactElement | null;
10
+ export declare const SnackBarItem: SnackBarItemComponent;
11
+ export {};
@@ -2,6 +2,7 @@ import { __read } from "tslib";
2
2
  import '../../Theme/_color/Theme_color_gpnDark.css';
3
3
  import './SnackBar-Item.css';
4
4
  import React, { useEffect, useState } from 'react';
5
+ import { useFlag } from '../../../hooks/useFlag/useFlag';
5
6
  import { IconClose } from '../../../icons/IconClose/IconClose';
6
7
  import { isNumber, isString } from '../../../utils/type-guards';
7
8
  import { Button } from '../../Button/Button';
@@ -20,17 +21,17 @@ var getAutoCloseTime = function (autoClose) {
20
21
  }
21
22
  return false;
22
23
  };
23
- export var SnackBarItem = function (props) {
24
+ export var SnackBarItem = React.forwardRef(function (props, ref) {
24
25
  var item = props.item;
25
26
  var onClose = item.onClose, autoClose = item.autoClose, showProgress = item.showProgress, Icon = item.icon, message = item.message, actions = item.actions, _a = item.status, status = _a === void 0 ? snackBarItemStatusDefault : _a, onAutoCloseProp = item.onAutoClose;
26
27
  var _b = __read(useState(null), 2), timerFunctions = _b[0], setTimerFunctions = _b[1];
27
- var _c = __read(useState(false), 2), hover = _c[0], setHover = _c[1];
28
- var _d = __read(useState(false), 2), timeIsOver = _d[0], setTimeIsOver = _d[1];
28
+ var _c = __read(useFlag(false), 2), hover = _c[0], _d = _c[1], onHover = _d.on, offHover = _d.off;
29
+ var _e = __read(useFlag(false), 2), timeIsOver = _e[0], onTimeIsOver = _e[1].on;
29
30
  var handleMountTimer = function (timerFunctions) {
30
31
  return setTimerFunctions(timerFunctions);
31
32
  };
32
- var handleMouseEnter = function () { return setHover(true); };
33
- var handleMouseLeave = function () { return setHover(false); };
33
+ var handleMouseEnter = function () { return onHover(); };
34
+ var handleMouseLeave = function () { return offHover(); };
34
35
  var autoCloseTime = getAutoCloseTime(autoClose);
35
36
  var hideAutoCloseTimer = showProgress === undefined || !(isNumber(autoCloseTime) && autoCloseTime > 0);
36
37
  var onAutoClose = function (item) {
@@ -52,15 +53,15 @@ export var SnackBarItem = function (props) {
52
53
  }
53
54
  }, [hover, timeIsOver, timerFunctions]);
54
55
  var handleTimeIsOver = function () {
55
- setTimeIsOver(true);
56
+ onTimeIsOver();
56
57
  onAutoClose(item);
57
58
  };
58
59
  var handleClose = onClose ? function () { return onClose(item); } : undefined;
59
- return (React.createElement("div", { className: cnSnackBarItem({ status: status }, [cnTheme({ color: 'gpnDark' })]), onMouseEnter: autoCloseTime ? handleMouseEnter : undefined, onMouseLeave: autoCloseTime ? handleMouseLeave : undefined },
60
+ return (React.createElement("div", { ref: ref, className: cnSnackBarItem({ status: status }, [cnTheme({ color: 'gpnDark' })]), onMouseEnter: autoCloseTime ? handleMouseEnter : undefined, onMouseLeave: autoCloseTime ? handleMouseLeave : undefined },
60
61
  autoCloseTime && (React.createElement(SnackBarTimer, { onMount: handleMountTimer, onTimeIsOver: handleTimeIsOver, startTime: autoCloseTime, hidden: hideAutoCloseTimer })),
61
62
  hideAutoCloseTimer && Icon && React.createElement(Icon, { className: cnSnackBar('Icon'), size: "m" }),
62
63
  React.createElement("div", { className: cnSnackBar('Content') },
63
64
  isString(message) || isNumber(message) ? (React.createElement(Text, { className: cnSnackBar('Message'), lineHeight: "s" }, message)) : (React.createElement(React.Fragment, null, message)),
64
65
  actions && React.createElement(SnackBarActionButton, { actions: actions })),
65
66
  onClose && (React.createElement(Button, { className: cnSnackBar('CloseButton'), view: "clear", iconLeft: IconClose, form: "round", size: "xs", onClick: handleClose }))));
66
- };
67
+ });
@@ -1,6 +1,6 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import './SnackBar.css';
3
- import React from 'react';
3
+ import React, { createRef, useMemo } from 'react';
4
4
  import { CSSTransition, TransitionGroup } from 'react-transition-group';
5
5
  import { cn } from '../../utils/bem';
6
6
  import { cnForCssTransition } from '../../utils/cnForCssTransition';
@@ -14,8 +14,15 @@ export var cnSnackBarItem = cn(COMPONENT_NAME, 'Item');
14
14
  var cssTransitionClassNames = cnForCssTransition(cnSnackBarItem);
15
15
  export var SnackBar = function (props) {
16
16
  var _a = usePropsHandler(COMPONENT_NAME, props), items = _a.items, className = _a.className, otherProps = __rest(_a, ["items", "className"]);
17
- return (React.createElement(TransitionGroup, __assign({}, otherProps, { className: cnSnackBar(null, [className]), appear: true, enter: true, exit: true }), items.map(function (item) {
18
- return (React.createElement(CSSTransition, { classNames: cssTransitionClassNames, key: item.key, timeout: 200 },
19
- React.createElement(SnackBarItem, { item: item })));
17
+ var refs = useMemo(function () {
18
+ var refArray = [];
19
+ for (var i = 0; i < items.length; i++) {
20
+ refArray[i] = createRef();
21
+ }
22
+ return refArray;
23
+ }, [items]);
24
+ return (React.createElement(TransitionGroup, __assign({}, otherProps, { className: cnSnackBar(null, [className]), appear: true, enter: true, exit: true }), items.map(function (item, index) {
25
+ return (React.createElement(CSSTransition, { nodeRef: refs[index], classNames: cssTransitionClassNames, key: item.key, timeout: 200 },
26
+ React.createElement(SnackBarItem, { item: item, ref: refs[index] })));
20
27
  })));
21
28
  };
@@ -17,7 +17,7 @@ export var cnTextField = cn(COMPONENT_NAME);
17
17
  export function TextFieldRender(props, ref) {
18
18
  var textFieldRef = React.useRef(null);
19
19
  var inputRef = React.useRef(null);
20
- var _a = usePropsHandler(COMPONENT_NAME, props, textFieldRef), className = _a.className, _b = _a.type, type = _b === void 0 ? 'text' : _b, value = _a.value, onChange = _a.onChange, id = _a.id, name = _a.name, rows = _a.rows, cols = _a.cols, minRows = _a.minRows, maxRows = _a.maxRows, inputRefProp = _a.inputRef, maxLength = _a.maxLength, disabled = _a.disabled, _c = _a.size, size = _c === void 0 ? textFieldPropSizeDefault : _c, _d = _a.view, view = _d === void 0 ? textFieldPropViewDefault : _d, _e = _a.form, form = _e === void 0 ? textFieldPropFormDefault : _e, state = _a.state, status = _a.status, _f = _a.width, width = _f === void 0 ? textFieldPropWidthDefault : _f, onBlur = _a.onBlur, onFocus = _a.onFocus, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, placeholder = _a.placeholder, leftSide = _a.leftSide, rightSide = _a.rightSide, autoComplete = _a.autoComplete, withClearButton = _a.withClearButton, max = _a.max, min = _a.min, readOnly = _a.readOnly, required = _a.required, _h = _a.step, step = _h === void 0 ? 1 : _h, tabIndex = _a.tabIndex, ariaLabel = _a.ariaLabel, label = _a.label, _j = _a.labelPosition, labelPosition = _j === void 0 ? 'top' : _j, caption = _a.caption, iconSizeProp = _a.iconSize, focused = _a.focused, onClick = _a.onClick, otherProps = __rest(_a, ["className", "type", "value", "onChange", "id", "name", "rows", "cols", "minRows", "maxRows", "inputRef", "maxLength", "disabled", "size", "view", "form", "state", "status", "width", "onBlur", "onFocus", "autoFocus", "placeholder", "leftSide", "rightSide", "autoComplete", "withClearButton", "max", "min", "readOnly", "required", "step", "tabIndex", "ariaLabel", "label", "labelPosition", "caption", "iconSize", "focused", "onClick"]);
20
+ var _a = usePropsHandler(COMPONENT_NAME, props, textFieldRef), className = _a.className, _b = _a.type, type = _b === void 0 ? 'text' : _b, value = _a.value, onChange = _a.onChange, id = _a.id, name = _a.name, rows = _a.rows, cols = _a.cols, minRows = _a.minRows, maxRows = _a.maxRows, inputRefProp = _a.inputRef, maxLength = _a.maxLength, disabled = _a.disabled, _c = _a.size, size = _c === void 0 ? textFieldPropSizeDefault : _c, _d = _a.view, view = _d === void 0 ? textFieldPropViewDefault : _d, _e = _a.form, form = _e === void 0 ? textFieldPropFormDefault : _e, state = _a.state, status = _a.status, _f = _a.width, width = _f === void 0 ? textFieldPropWidthDefault : _f, onBlur = _a.onBlur, onFocus = _a.onFocus, _g = _a.autoFocus, autoFocus = _g === void 0 ? false : _g, placeholder = _a.placeholder, leftSide = _a.leftSide, rightSide = _a.rightSide, autoComplete = _a.autoComplete, withClearButton = _a.withClearButton, max = _a.max, min = _a.min, readOnly = _a.readOnly, required = _a.required, _h = _a.step, step = _h === void 0 ? 1 : _h, tabIndex = _a.tabIndex, ariaLabel = _a.ariaLabel, label = _a.label, inputContainerRef = _a.inputContainerRef, _j = _a.labelPosition, labelPosition = _j === void 0 ? 'top' : _j, caption = _a.caption, iconSizeProp = _a.iconSize, focused = _a.focused, onClick = _a.onClick, otherProps = __rest(_a, ["className", "type", "value", "onChange", "id", "name", "rows", "cols", "minRows", "maxRows", "inputRef", "maxLength", "disabled", "size", "view", "form", "state", "status", "width", "onBlur", "onFocus", "autoFocus", "placeholder", "leftSide", "rightSide", "autoComplete", "withClearButton", "max", "min", "readOnly", "required", "step", "tabIndex", "ariaLabel", "label", "inputContainerRef", "labelPosition", "caption", "iconSize", "focused", "onClick"]);
21
21
  var _k = __read(useState(autoFocus), 2), focus = _k[0], setFocus = _k[1];
22
22
  var textarea = type === 'textarea';
23
23
  var LeftIcon = leftSide;
@@ -113,7 +113,7 @@ export function TextFieldRender(props, ref) {
113
113
  return (React.createElement("div", __assign({ className: cnTextField({ labelPosition: labelPosition, size: size, view: view, width: width }, [className]), ref: useForkRef([ref, textFieldRef]) }, rootProps, otherProps),
114
114
  label && (React.createElement(FieldLabel, { required: required, className: cnTextField('Label', { labelPosition: labelPosition }), size: size }, label)),
115
115
  React.createElement("div", { className: cnTextField('Body') },
116
- React.createElement("div", { className: cnTextField('InputContainer', {
116
+ React.createElement("div", { ref: inputContainerRef, className: cnTextField('InputContainer', {
117
117
  view: view,
118
118
  form: form,
119
119
  status: status || state,
@@ -74,6 +74,7 @@ export declare type TextFieldProps<TYPE extends string> = PropsWithHTMLAttribute
74
74
  required?: boolean;
75
75
  step?: number | string;
76
76
  tabIndex?: number;
77
+ inputContainerRef?: React.Ref<HTMLDivElement>;
77
78
  inputRef?: React.Ref<HTMLTextAreaElement | HTMLInputElement>;
78
79
  ariaLabel?: string;
79
80
  iconSize?: IconPropSize;
@@ -13,7 +13,7 @@
13
13
  --size-text-6xl: 96px;
14
14
 
15
15
  /* Межстрочный интервал */
16
- --line-height-text-2xs: 1em;
16
+ --line-height-text-2xs: 1.1em;
17
17
  --line-height-text-xs: 1.2em;
18
18
  --line-height-text-s: 1.4em;
19
19
  --line-height-text-m: 1.5em;