@onesy/ui-react 1.0.130 → 1.0.132

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 (712) hide show
  1. package/Accordion/Accordion.d.ts +2 -2
  2. package/Accordion/Accordion.js +342 -242
  3. package/Accordion/index.js +12 -7
  4. package/AdvancedTextField/AdvancedTextField.d.ts +1 -1
  5. package/AdvancedTextField/AdvancedTextField.js +165 -157
  6. package/AdvancedTextField/index.js +12 -7
  7. package/Append/Append.d.ts +3 -3
  8. package/Append/Append.js +502 -519
  9. package/Append/index.js +12 -7
  10. package/AreaChart/AreaChart.d.ts +1 -1
  11. package/AreaChart/AreaChart.js +53 -40
  12. package/AreaChart/index.js +12 -7
  13. package/AreaChartItem/AreaChartItem.d.ts +1 -1
  14. package/AreaChartItem/AreaChartItem.js +325 -237
  15. package/AreaChartItem/index.js +12 -7
  16. package/AudioPlayer/AudioPlayer.d.ts +1 -1
  17. package/AudioPlayer/AudioPlayer.js +683 -466
  18. package/AudioPlayer/index.js +12 -7
  19. package/AudioRecorder/AudioRecorder.d.ts +1 -1
  20. package/AudioRecorder/AudioRecorder.js +359 -259
  21. package/AudioRecorder/index.js +12 -7
  22. package/AutoComplete/AutoComplete.d.ts +3 -3
  23. package/AutoComplete/AutoComplete.js +693 -568
  24. package/AutoComplete/index.js +12 -7
  25. package/AutoCompleteCountry/AutoCompleteCountry.d.ts +1 -1
  26. package/AutoCompleteCountry/AutoCompleteCountry.js +99 -62
  27. package/AutoCompleteCountry/index.js +12 -7
  28. package/AutoCompleteCurrency/AutoCompleteCurrency.d.ts +1 -1
  29. package/AutoCompleteCurrency/AutoCompleteCurrency.js +73 -61
  30. package/AutoCompleteCurrency/index.js +12 -7
  31. package/Avatar/Avatar.d.ts +1 -1
  32. package/Avatar/Avatar.js +113 -86
  33. package/Avatar/index.js +12 -7
  34. package/AvatarGroup/AvatarGroup.d.ts +1 -1
  35. package/AvatarGroup/AvatarGroup.js +104 -87
  36. package/AvatarGroup/index.js +12 -7
  37. package/Backdrop/Backdrop.d.ts +1 -1
  38. package/Backdrop/Backdrop.js +160 -139
  39. package/Backdrop/index.js +12 -7
  40. package/Badge/Badge.d.ts +1 -1
  41. package/Badge/Badge.js +116 -96
  42. package/Badge/index.js +12 -7
  43. package/Banner/Banner.d.ts +1 -1
  44. package/Banner/Banner.js +126 -85
  45. package/Banner/index.js +12 -7
  46. package/BottomAppBar/BottomAppBar.d.ts +1 -1
  47. package/BottomAppBar/BottomAppBar.js +89 -60
  48. package/BottomAppBar/index.js +12 -7
  49. package/BottomSheet/BottomSheet.d.ts +1 -1
  50. package/BottomSheet/BottomSheet.js +66 -59
  51. package/BottomSheet/index.js +12 -7
  52. package/Box/Box.d.ts +1 -1
  53. package/Box/Box.js +43 -35
  54. package/Box/index.js +12 -7
  55. package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  56. package/Breadcrumbs/Breadcrumbs.js +168 -144
  57. package/Breadcrumbs/index.js +12 -7
  58. package/BubbleChart/BubbleChart.d.ts +1 -1
  59. package/BubbleChart/BubbleChart.js +261 -132
  60. package/BubbleChart/index.js +12 -7
  61. package/BubbleChartItem/BubbleChartItem.d.ts +1 -1
  62. package/BubbleChartItem/BubbleChartItem.js +228 -161
  63. package/BubbleChartItem/index.js +12 -7
  64. package/Button/Button.d.ts +1 -1
  65. package/Button/Button.js +488 -467
  66. package/Button/index.js +12 -7
  67. package/Buttons/Buttons.d.ts +1 -1
  68. package/Buttons/Buttons.js +343 -294
  69. package/Buttons/index.js +12 -7
  70. package/Calendar/Calendar.d.ts +3 -3
  71. package/Calendar/Calendar.js +715 -452
  72. package/Calendar/index.js +12 -7
  73. package/CalendarAvailability/CalendarAvailability.d.ts +2 -2
  74. package/CalendarAvailability/CalendarAvailability.js +709 -388
  75. package/CalendarAvailability/index.js +12 -7
  76. package/CalendarMenu/CalendarMenu.d.ts +1 -1
  77. package/CalendarMenu/CalendarMenu.js +430 -303
  78. package/CalendarMenu/index.js +12 -7
  79. package/CalendarMonth/CalendarMonth.d.ts +5 -5
  80. package/CalendarMonth/CalendarMonth.js +537 -498
  81. package/CalendarMonth/index.js +12 -7
  82. package/CalendarViews/CalendarViews.d.ts +2 -2
  83. package/CalendarViews/CalendarViews.js +403 -254
  84. package/CalendarViews/index.js +12 -7
  85. package/CalendarWeek/CalendarWeek.d.ts +1 -1
  86. package/CalendarWeek/CalendarWeek.js +536 -395
  87. package/CalendarWeek/index.js +12 -7
  88. package/Card/Card.d.ts +1 -1
  89. package/Card/Card.js +133 -101
  90. package/Card/index.js +12 -7
  91. package/CardButton/CardButton.d.ts +1 -1
  92. package/CardButton/CardButton.js +78 -58
  93. package/CardButton/index.js +12 -7
  94. package/CardFooter/CardFooter.d.ts +1 -1
  95. package/CardFooter/CardFooter.js +58 -39
  96. package/CardFooter/index.js +12 -7
  97. package/CardHeader/CardHeader.d.ts +1 -1
  98. package/CardHeader/CardHeader.js +61 -44
  99. package/CardHeader/index.js +12 -7
  100. package/CardImage/CardImage.d.ts +1 -1
  101. package/CardImage/CardImage.js +80 -67
  102. package/CardImage/index.js +12 -7
  103. package/CardMain/CardMain.d.ts +1 -1
  104. package/CardMain/CardMain.js +53 -39
  105. package/CardMain/index.js +12 -7
  106. package/Carousel/Carousel.d.ts +4 -4
  107. package/Carousel/Carousel.js +1025 -913
  108. package/Carousel/index.js +12 -7
  109. package/Chart/Chart.d.ts +4 -4
  110. package/Chart/Chart.js +1325 -1174
  111. package/Chart/index.js +12 -7
  112. package/Checkbox/Checkbox.d.ts +1 -1
  113. package/Checkbox/Checkbox.js +339 -325
  114. package/Checkbox/index.js +12 -7
  115. package/Chip/Chip.d.ts +1 -1
  116. package/Chip/Chip.js +131 -102
  117. package/Chip/index.js +12 -7
  118. package/Chips/Chips.d.ts +1 -1
  119. package/Chips/Chips.js +121 -94
  120. package/Chips/index.js +12 -7
  121. package/ClickListener/ClickListener.d.ts +1 -1
  122. package/ClickListener/ClickListener.js +86 -89
  123. package/ClickListener/index.js +12 -7
  124. package/Clock/Clock.d.ts +5 -5
  125. package/Clock/Clock.js +470 -417
  126. package/Clock/index.js +12 -7
  127. package/ColorTextField/ColorTextField.d.ts +1 -1
  128. package/ColorTextField/ColorTextField.js +234 -171
  129. package/ColorTextField/index.js +12 -7
  130. package/ColumnChart/ColumnChart.d.ts +1 -1
  131. package/ColumnChart/ColumnChart.js +63 -46
  132. package/ColumnChart/index.js +12 -7
  133. package/ColumnChartItem/ColumnChartItem.d.ts +1 -1
  134. package/ColumnChartItem/ColumnChartItem.js +208 -149
  135. package/ColumnChartItem/index.js +12 -7
  136. package/Confirm/Confirm.d.ts +4 -4
  137. package/Confirm/Confirm.js +184 -129
  138. package/Confirm/Context.js +9 -7
  139. package/Confirm/index.js +32 -13
  140. package/Confirm/useConfirm.js +11 -10
  141. package/Container/Container.d.ts +1 -1
  142. package/Container/Container.js +154 -133
  143. package/Container/index.js +12 -7
  144. package/CookieBanner/CookieBanner.d.ts +1 -1
  145. package/CookieBanner/CookieBanner.js +142 -76
  146. package/CookieBanner/index.js +12 -7
  147. package/Countdown/Countdown.d.ts +1 -1
  148. package/Countdown/Countdown.js +403 -255
  149. package/Countdown/index.js +12 -7
  150. package/DatePicker/DatePicker.d.ts +1 -1
  151. package/DatePicker/DatePicker.js +802 -547
  152. package/DatePicker/index.js +12 -7
  153. package/DateRangePicker/DateRangePicker.d.ts +1 -1
  154. package/DateRangePicker/DateRangePicker.js +44 -37
  155. package/DateRangePicker/index.js +12 -7
  156. package/DateTimePicker/DateTimePicker.d.ts +2 -2
  157. package/DateTimePicker/DateTimePicker.js +672 -459
  158. package/DateTimePicker/index.js +12 -7
  159. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
  160. package/DateTimeRangePicker/DateTimeRangePicker.js +44 -37
  161. package/DateTimeRangePicker/index.js +12 -7
  162. package/Divider/Divider.d.ts +1 -1
  163. package/Divider/Divider.js +198 -185
  164. package/Divider/index.js +12 -7
  165. package/DonutChart/DonutChart.d.ts +1 -1
  166. package/DonutChart/DonutChart.js +49 -42
  167. package/DonutChart/index.js +12 -7
  168. package/DragAndDropList/DragAndDropList.d.ts +1 -1
  169. package/DragAndDropList/DragAndDropList.js +160 -156
  170. package/DragAndDropList/index.js +12 -7
  171. package/Drawing/Drawing.d.ts +2 -2
  172. package/Drawing/Drawing.js +850 -523
  173. package/Drawing/index.js +12 -7
  174. package/DropZone/DropZone.d.ts +1 -1
  175. package/DropZone/DropZone.js +239 -201
  176. package/DropZone/index.js +12 -7
  177. package/Emojis/Emojis.d.ts +3 -3
  178. package/Emojis/Emojis.js +409 -317
  179. package/Emojis/emojis_list.js +7279 -9250
  180. package/Emojis/index.js +19 -9
  181. package/Expand/Expand.d.ts +1 -1
  182. package/Expand/Expand.js +201 -149
  183. package/Expand/index.js +12 -7
  184. package/Fab/Fab.d.ts +1 -1
  185. package/Fab/Fab.js +46 -26
  186. package/Fab/index.js +12 -7
  187. package/Fade/Fade.d.ts +1 -1
  188. package/Fade/Fade.js +131 -101
  189. package/Fade/index.js +12 -7
  190. package/FileChoose/FileChoose.d.ts +2 -2
  191. package/FileChoose/FileChoose.js +218 -150
  192. package/FileChoose/index.js +12 -7
  193. package/Focus/Focus.d.ts +1 -1
  194. package/Focus/Focus.js +87 -88
  195. package/Focus/index.js +12 -7
  196. package/Form/Form.d.ts +1 -1
  197. package/Form/Form.js +194 -120
  198. package/Form/index.js +12 -7
  199. package/FormRow/FormRow.d.ts +1 -1
  200. package/FormRow/FormRow.js +123 -78
  201. package/FormRow/index.js +12 -7
  202. package/Forms/Forms.d.ts +1 -1
  203. package/Forms/Forms.js +55 -41
  204. package/Forms/index.js +12 -7
  205. package/Frame/Frame.d.ts +1 -1
  206. package/Frame/Frame.js +212 -150
  207. package/Frame/index.js +12 -7
  208. package/Grid/Grid.d.ts +2 -2
  209. package/Grid/Grid.js +231 -166
  210. package/Grid/index.js +12 -7
  211. package/Grow/Grow.d.ts +1 -1
  212. package/Grow/Grow.js +137 -109
  213. package/Grow/index.js +12 -7
  214. package/HTMLCanvas/HTMLCanvas.d.ts +2 -2
  215. package/HTMLCanvas/HTMLCanvas.js +752 -542
  216. package/HTMLCanvas/index.js +23 -21
  217. package/IFrame/IFrame.d.ts +1 -1
  218. package/IFrame/IFrame.js +122 -104
  219. package/IFrame/index.js +12 -7
  220. package/Icon/Icon.d.ts +1 -1
  221. package/Icon/Icon.js +112 -95
  222. package/Icon/index.js +23 -21
  223. package/IconButton/IconButton.d.ts +1 -1
  224. package/IconButton/IconButton.js +49 -37
  225. package/IconButton/index.js +12 -7
  226. package/Image/Image.d.ts +1 -1
  227. package/Image/Image.js +285 -252
  228. package/Image/index.js +12 -7
  229. package/ImageCrop/ImageCrop.d.ts +2 -2
  230. package/ImageCrop/ImageCrop.js +1073 -1048
  231. package/ImageCrop/index.js +12 -7
  232. package/ImageEdit/ImageEdit.d.ts +2 -2
  233. package/ImageEdit/ImageEdit.js +1088 -783
  234. package/ImageEdit/index.js +12 -7
  235. package/ImageGallery/ImageGallery.d.ts +1 -1
  236. package/ImageGallery/ImageGallery.js +518 -473
  237. package/ImageGallery/index.js +12 -7
  238. package/ImageList/ImageList.d.ts +1 -1
  239. package/ImageList/ImageList.js +136 -129
  240. package/ImageList/index.js +12 -7
  241. package/ImageListItem/ImageListItem.d.ts +1 -1
  242. package/ImageListItem/ImageListItem.js +101 -87
  243. package/ImageListItem/index.js +12 -7
  244. package/ImageListItemBox/ImageListItemBox.d.ts +1 -1
  245. package/ImageListItemBox/ImageListItemBox.js +61 -50
  246. package/ImageListItemBox/index.js +12 -7
  247. package/Info/Info.d.ts +1 -1
  248. package/Info/Info.js +99 -63
  249. package/Info/index.js +12 -7
  250. package/Interaction/Interaction.d.ts +2 -2
  251. package/Interaction/Interaction.js +405 -345
  252. package/Interaction/index.js +12 -7
  253. package/Keyframes/Context.js +9 -7
  254. package/Keyframes/Keyframes.d.ts +3 -3
  255. package/Keyframes/Keyframes.js +189 -174
  256. package/Keyframes/index.js +41 -25
  257. package/Keyframes/useKeyframes.js +11 -10
  258. package/Label/Label.d.ts +1 -1
  259. package/Label/Label.js +177 -151
  260. package/Label/index.js +12 -7
  261. package/Labels/Labels.d.ts +1 -1
  262. package/Labels/Labels.js +126 -98
  263. package/Labels/index.js +12 -7
  264. package/Line/Line.d.ts +6 -6
  265. package/Line/Line.js +296 -174
  266. package/Line/index.js +12 -7
  267. package/LineChart/LineChart.d.ts +1 -1
  268. package/LineChart/LineChart.js +57 -40
  269. package/LineChart/index.js +12 -7
  270. package/LineChartItem/LineChartItem.d.ts +1 -1
  271. package/LineChartItem/LineChartItem.js +239 -177
  272. package/LineChartItem/index.js +12 -7
  273. package/LinearMeter/LinearMeter.d.ts +1 -1
  274. package/LinearMeter/LinearMeter.js +453 -377
  275. package/LinearMeter/index.js +12 -7
  276. package/LinearProgress/LinearProgress.d.ts +1 -1
  277. package/LinearProgress/LinearProgress.js +324 -255
  278. package/LinearProgress/index.js +12 -7
  279. package/Link/Link.d.ts +1 -1
  280. package/Link/Link.js +182 -127
  281. package/Link/index.js +12 -7
  282. package/Links/Links.d.ts +2 -2
  283. package/Links/Links.js +277 -156
  284. package/Links/index.js +12 -7
  285. package/List/List.d.ts +1 -1
  286. package/List/List.js +148 -113
  287. package/List/index.js +12 -7
  288. package/ListItem/ListItem.d.ts +1 -1
  289. package/ListItem/ListItem.js +388 -362
  290. package/ListItem/index.js +12 -7
  291. package/ListSubheader/ListSubheader.d.ts +1 -1
  292. package/ListSubheader/ListSubheader.js +52 -44
  293. package/ListSubheader/index.js +12 -7
  294. package/MainProgress/Context.js +9 -7
  295. package/MainProgress/MainProgress.d.ts +3 -3
  296. package/MainProgress/MainProgress.js +193 -161
  297. package/MainProgress/index.js +32 -13
  298. package/MainProgress/useMainProgress.js +11 -10
  299. package/Markdown/Markdown.d.ts +1 -1
  300. package/Markdown/Markdown.js +676 -704
  301. package/Markdown/index.js +12 -7
  302. package/Masonry/Masonry.d.ts +1 -1
  303. package/Masonry/Masonry.js +207 -181
  304. package/Masonry/index.js +12 -7
  305. package/Medias/Medias.d.ts +3 -3
  306. package/Medias/Medias.js +436 -398
  307. package/Medias/index.js +12 -7
  308. package/Menu/Menu.d.ts +1 -1
  309. package/Menu/Menu.js +278 -243
  310. package/Menu/index.js +12 -7
  311. package/MenuDesktop/MenuDesktop.d.ts +3 -3
  312. package/MenuDesktop/MenuDesktop.js +496 -419
  313. package/MenuDesktop/index.js +12 -7
  314. package/MenuItem/MenuItem.d.ts +1 -1
  315. package/MenuItem/MenuItem.js +286 -231
  316. package/MenuItem/index.js +12 -7
  317. package/Meta/Meta.d.ts +1 -1
  318. package/Meta/Meta.js +78 -54
  319. package/Meta/index.js +12 -7
  320. package/Modal/Modal.d.ts +1 -1
  321. package/Modal/Modal.js +333 -272
  322. package/Modal/index.js +12 -7
  323. package/ModalFooter/ModalFooter.d.ts +1 -1
  324. package/ModalFooter/ModalFooter.js +50 -39
  325. package/ModalFooter/index.js +12 -7
  326. package/ModalHeader/ModalHeader.d.ts +1 -1
  327. package/ModalHeader/ModalHeader.js +51 -39
  328. package/ModalHeader/index.js +12 -7
  329. package/ModalIcon/ModalIcon.d.ts +1 -1
  330. package/ModalIcon/ModalIcon.js +29 -23
  331. package/ModalIcon/index.js +12 -7
  332. package/ModalMain/ModalMain.d.ts +1 -1
  333. package/ModalMain/ModalMain.js +50 -41
  334. package/ModalMain/index.js +12 -7
  335. package/ModalText/ModalText.d.ts +1 -1
  336. package/ModalText/ModalText.js +47 -37
  337. package/ModalText/index.js +12 -7
  338. package/ModalTitle/ModalTitle.d.ts +1 -1
  339. package/ModalTitle/ModalTitle.js +47 -37
  340. package/ModalTitle/index.js +12 -7
  341. package/MoreOptions/MoreOptions.d.ts +1 -1
  342. package/MoreOptions/MoreOptions.js +72 -52
  343. package/MoreOptions/index.js +12 -7
  344. package/Move/Move.d.ts +1 -1
  345. package/Move/Move.js +166 -141
  346. package/Move/index.js +12 -7
  347. package/NavigationBar/NavigationBar.d.ts +2 -2
  348. package/NavigationBar/NavigationBar.js +133 -109
  349. package/NavigationBar/index.js +12 -7
  350. package/NavigationDrawer/NavigationDrawer.d.ts +1 -1
  351. package/NavigationDrawer/NavigationDrawer.js +241 -211
  352. package/NavigationDrawer/index.js +12 -7
  353. package/NavigationItem/NavigationItem.d.ts +2 -2
  354. package/NavigationItem/NavigationItem.js +293 -262
  355. package/NavigationItem/index.js +12 -7
  356. package/NavigationRail/NavigationRail.d.ts +1 -1
  357. package/NavigationRail/NavigationRail.js +187 -150
  358. package/NavigationRail/index.js +12 -7
  359. package/NotFound/NotFound.d.ts +1 -1
  360. package/NotFound/NotFound.js +89 -66
  361. package/NotFound/index.js +12 -7
  362. package/NumericTextField/NumericTextField.d.ts +1 -1
  363. package/NumericTextField/NumericTextField.js +217 -212
  364. package/NumericTextField/index.js +12 -7
  365. package/Page/Page.d.ts +2 -2
  366. package/Page/Page.js +131 -67
  367. package/Page/index.js +12 -7
  368. package/PageTransition/PageTransition.d.ts +1 -1
  369. package/PageTransition/PageTransition.js +112 -102
  370. package/PageTransition/index.js +12 -7
  371. package/Pagination/Pagination.d.ts +1 -1
  372. package/Pagination/Pagination.js +153 -98
  373. package/Pagination/index.js +12 -7
  374. package/PaginationItem/PaginationItem.d.ts +1 -1
  375. package/PaginationItem/PaginationItem.js +85 -65
  376. package/PaginationItem/index.js +12 -7
  377. package/Parallax/Parallax.d.ts +2 -2
  378. package/Parallax/Parallax.js +138 -145
  379. package/Parallax/index.js +12 -7
  380. package/Path/Path.d.ts +1 -1
  381. package/Path/Path.js +40 -35
  382. package/Path/index.js +12 -7
  383. package/PieChart/PieChart.d.ts +1 -1
  384. package/PieChart/PieChart.js +382 -267
  385. package/PieChart/index.js +12 -7
  386. package/Placeholder/Placeholder.d.ts +1 -1
  387. package/Placeholder/Placeholder.js +125 -117
  388. package/Placeholder/index.js +12 -7
  389. package/Portal/Portal.d.ts +1 -1
  390. package/Portal/Portal.js +37 -38
  391. package/Portal/index.js +12 -7
  392. package/Properties/Properties.d.ts +2 -2
  393. package/Properties/Properties.js +85 -64
  394. package/Properties/index.js +12 -7
  395. package/Property/Property.d.ts +1 -1
  396. package/Property/Property.js +120 -108
  397. package/Property/index.js +12 -7
  398. package/Radio/Radio.d.ts +1 -1
  399. package/Radio/Radio.js +211 -181
  400. package/Radio/index.js +12 -7
  401. package/Radios/Radios.d.ts +1 -1
  402. package/Radios/Radios.js +124 -92
  403. package/Radios/index.js +12 -7
  404. package/Rating/Rating.d.ts +1 -1
  405. package/Rating/Rating.js +353 -360
  406. package/Rating/index.js +12 -7
  407. package/Reset/Reset.d.ts +1 -1
  408. package/Reset/Reset.js +19 -24
  409. package/Reset/index.js +12 -7
  410. package/Reveal/Reveal.d.ts +1 -1
  411. package/Reveal/Reveal.js +98 -89
  412. package/Reveal/index.js +12 -7
  413. package/RichTextEditor/RichTextEditor.d.ts +1 -1
  414. package/RichTextEditor/RichTextEditor.js +1764 -972
  415. package/RichTextEditor/index.js +12 -7
  416. package/RoundMeter/RoundMeter.d.ts +1 -1
  417. package/RoundMeter/RoundMeter.js +629 -537
  418. package/RoundMeter/index.js +12 -7
  419. package/RoundProgress/RoundProgress.d.ts +1 -1
  420. package/RoundProgress/RoundProgress.js +233 -174
  421. package/RoundProgress/index.js +12 -7
  422. package/ScatterChart/ScatterChart.d.ts +1 -1
  423. package/ScatterChart/ScatterChart.js +53 -40
  424. package/ScatterChart/index.js +12 -7
  425. package/ScatterChartItem/ScatterChartItem.d.ts +1 -1
  426. package/ScatterChartItem/ScatterChartItem.js +214 -153
  427. package/ScatterChartItem/index.js +12 -7
  428. package/ScreenCapture/ScreenCapture.d.ts +2 -2
  429. package/ScreenCapture/ScreenCapture.js +427 -335
  430. package/ScreenCapture/index.js +12 -7
  431. package/Section/Section.d.ts +2 -2
  432. package/Section/Section.js +380 -319
  433. package/Section/index.js +12 -7
  434. package/SectionAction/SectionAction.d.ts +1 -1
  435. package/SectionAction/SectionAction.js +72 -61
  436. package/SectionAction/index.js +12 -7
  437. package/SectionBoxes/SectionBoxes.d.ts +2 -2
  438. package/SectionBoxes/SectionBoxes.js +240 -208
  439. package/SectionBoxes/index.js +12 -7
  440. package/SectionCards/SectionCards.d.ts +2 -2
  441. package/SectionCards/SectionCards.js +256 -217
  442. package/SectionCards/index.js +12 -7
  443. package/SectionCarousel/SectionCarousel.d.ts +2 -2
  444. package/SectionCarousel/SectionCarousel.js +284 -242
  445. package/SectionCarousel/index.js +12 -7
  446. package/SectionContact/SectionContact.d.ts +1 -1
  447. package/SectionContact/SectionContact.js +174 -116
  448. package/SectionContact/index.js +12 -7
  449. package/SectionImageGallery/SectionImageGallery.d.ts +1 -1
  450. package/SectionImageGallery/SectionImageGallery.js +64 -51
  451. package/SectionImageGallery/index.js +12 -7
  452. package/SectionLogos/SectionLogos.d.ts +1 -1
  453. package/SectionLogos/SectionLogos.js +123 -109
  454. package/SectionLogos/index.js +12 -7
  455. package/SectionMedia/SectionMedia.d.ts +1 -1
  456. package/SectionMedia/SectionMedia.js +170 -152
  457. package/SectionMedia/index.js +12 -7
  458. package/SectionReviews/SectionReviews.d.ts +2 -2
  459. package/SectionReviews/SectionReviews.js +170 -129
  460. package/SectionReviews/index.js +12 -7
  461. package/SectionTextMedia/SectionTextMedia.d.ts +1 -1
  462. package/SectionTextMedia/SectionTextMedia.js +187 -142
  463. package/SectionTextMedia/index.js +12 -7
  464. package/SectionTimeline/SectionTimeline.d.ts +2 -2
  465. package/SectionTimeline/SectionTimeline.js +126 -95
  466. package/SectionTimeline/index.js +12 -7
  467. package/SectionWatch/SectionWatch.d.ts +1 -1
  468. package/SectionWatch/SectionWatch.js +65 -53
  469. package/SectionWatch/index.js +12 -7
  470. package/Select/Select.d.ts +1 -1
  471. package/Select/Select.js +517 -406
  472. package/Select/index.js +12 -7
  473. package/Share/Share.d.ts +1 -1
  474. package/Share/Share.js +458 -319
  475. package/Share/index.js +12 -7
  476. package/Slide/Slide.d.ts +1 -1
  477. package/Slide/Slide.js +184 -140
  478. package/Slide/index.js +12 -7
  479. package/Slider/Slider.d.ts +2 -2
  480. package/Slider/Slider.js +927 -837
  481. package/Slider/index.js +12 -7
  482. package/SmartTextField/SmartTextField.d.ts +1 -1
  483. package/SmartTextField/SmartTextField.js +1406 -1014
  484. package/SmartTextField/index.js +12 -7
  485. package/Snackbar/Snackbar.d.ts +1 -1
  486. package/Snackbar/Snackbar.js +227 -185
  487. package/Snackbar/index.js +12 -7
  488. package/Snackbars/Context.d.ts +1 -1
  489. package/Snackbars/Context.js +9 -7
  490. package/Snackbars/Snackbars.d.ts +2 -2
  491. package/Snackbars/Snackbars.js +234 -210
  492. package/Snackbars/index.js +32 -13
  493. package/Snackbars/useSnackbars.js +11 -10
  494. package/Space/Space.d.ts +1 -1
  495. package/Space/Space.js +1683 -968
  496. package/Space/index.js +23 -21
  497. package/SpeechToText/SpeechToText.d.ts +1 -1
  498. package/SpeechToText/SpeechToText.js +207 -172
  499. package/SpeechToText/index.js +12 -7
  500. package/SpeedDial/SpeedDial.d.ts +1 -1
  501. package/SpeedDial/SpeedDial.js +434 -398
  502. package/SpeedDial/index.js +12 -7
  503. package/SpeedDialItem/SpeedDialItem.d.ts +1 -1
  504. package/SpeedDialItem/SpeedDialItem.js +89 -63
  505. package/SpeedDialItem/index.js +12 -7
  506. package/SpyScroll/SpyScroll.d.ts +1 -1
  507. package/SpyScroll/SpyScroll.js +154 -142
  508. package/SpyScroll/index.js +12 -7
  509. package/Step/Step.d.ts +1 -1
  510. package/Step/Step.js +181 -127
  511. package/Step/index.js +12 -7
  512. package/Stepper/Stepper.d.ts +1 -1
  513. package/Stepper/Stepper.js +159 -139
  514. package/Stepper/index.js +12 -7
  515. package/Surface/Surface.d.ts +1 -1
  516. package/Surface/Surface.js +760 -798
  517. package/Surface/index.js +12 -7
  518. package/Switch/Switch.d.ts +1 -1
  519. package/Switch/Switch.js +688 -532
  520. package/Switch/index.js +12 -7
  521. package/Tab/Tab.d.ts +1 -1
  522. package/Tab/Tab.js +185 -150
  523. package/Tab/index.js +12 -7
  524. package/Table/Table.d.ts +1 -1
  525. package/Table/Table.js +100 -77
  526. package/Table/index.js +12 -7
  527. package/TableBody/TableBody.d.ts +1 -1
  528. package/TableBody/TableBody.js +76 -63
  529. package/TableBody/index.js +12 -7
  530. package/TableCell/TableCell.d.ts +2 -2
  531. package/TableCell/TableCell.js +258 -220
  532. package/TableCell/index.js +12 -7
  533. package/TableFooter/TableFooter.d.ts +1 -1
  534. package/TableFooter/TableFooter.js +60 -48
  535. package/TableFooter/index.js +12 -7
  536. package/TableHead/TableHead.d.ts +1 -1
  537. package/TableHead/TableHead.js +139 -120
  538. package/TableHead/index.js +12 -7
  539. package/TableHeader/TableHeader.d.ts +1 -1
  540. package/TableHeader/TableHeader.js +65 -50
  541. package/TableHeader/index.js +12 -7
  542. package/TablePagination/TablePagination.d.ts +1 -1
  543. package/TablePagination/TablePagination.js +171 -98
  544. package/TablePagination/index.js +12 -7
  545. package/TableRow/TableRow.d.ts +1 -1
  546. package/TableRow/TableRow.js +77 -64
  547. package/TableRow/index.js +12 -7
  548. package/Tabs/Tabs.d.ts +1 -1
  549. package/Tabs/Tabs.js +425 -377
  550. package/Tabs/index.js +12 -7
  551. package/Text/Text.d.ts +1 -1
  552. package/Text/Text.js +131 -113
  553. package/Text/index.js +12 -7
  554. package/TextField/TextField.d.ts +1 -1
  555. package/TextField/TextField.js +940 -879
  556. package/TextField/index.js +12 -7
  557. package/TextToSpeech/TextToSpeech.d.ts +1 -1
  558. package/TextToSpeech/TextToSpeech.js +176 -153
  559. package/TextToSpeech/index.js +12 -7
  560. package/TimePicker/TimePicker.d.ts +3 -3
  561. package/TimePicker/TimePicker.js +985 -718
  562. package/TimePicker/index.js +12 -7
  563. package/TimeRangePicker/TimeRangePicker.d.ts +1 -1
  564. package/TimeRangePicker/TimeRangePicker.js +44 -37
  565. package/TimeRangePicker/index.js +12 -7
  566. package/Timeline/Timeline.d.ts +1 -1
  567. package/Timeline/Timeline.js +54 -42
  568. package/Timeline/index.js +12 -7
  569. package/TimelineItem/TimelineItem.d.ts +1 -1
  570. package/TimelineItem/TimelineItem.js +144 -147
  571. package/TimelineItem/index.js +12 -7
  572. package/Timer/Timer.d.ts +1 -1
  573. package/Timer/Timer.js +321 -204
  574. package/Timer/index.js +12 -7
  575. package/ToggleButton/ToggleButton.d.ts +1 -1
  576. package/ToggleButton/ToggleButton.js +67 -58
  577. package/ToggleButton/index.js +12 -7
  578. package/ToggleButtons/ToggleButtons.d.ts +1 -1
  579. package/ToggleButtons/ToggleButtons.js +46 -37
  580. package/ToggleButtons/index.js +12 -7
  581. package/Tooltip/Tooltip.d.ts +1 -1
  582. package/Tooltip/Tooltip.js +489 -454
  583. package/Tooltip/index.js +12 -7
  584. package/TopAppBar/TopAppBar.d.ts +1 -1
  585. package/TopAppBar/TopAppBar.js +237 -197
  586. package/TopAppBar/index.js +12 -7
  587. package/Transition/Context.js +9 -7
  588. package/Transition/Transition.d.ts +3 -3
  589. package/Transition/Transition.js +321 -339
  590. package/Transition/index.js +41 -25
  591. package/Transition/useTransition.js +11 -10
  592. package/Transitions/Transitions.d.ts +2 -2
  593. package/Transitions/Transitions.js +215 -179
  594. package/Transitions/index.js +12 -7
  595. package/Tree/Tree.d.ts +1 -1
  596. package/Tree/Tree.js +375 -312
  597. package/Tree/index.js +12 -7
  598. package/Type/Type.d.ts +1 -1
  599. package/Type/Type.js +251 -152
  600. package/Type/index.js +12 -7
  601. package/VideoPlayer/VideoPlayer.d.ts +1 -1
  602. package/VideoPlayer/VideoPlayer.js +866 -656
  603. package/VideoPlayer/index.js +12 -7
  604. package/ViewSplit/ViewSplit.d.ts +1 -1
  605. package/ViewSplit/ViewSplit.js +413 -387
  606. package/ViewSplit/index.js +12 -7
  607. package/Watch/Watch.d.ts +1 -1
  608. package/Watch/Watch.js +436 -290
  609. package/Watch/index.js +12 -7
  610. package/Weather/Weather.d.ts +4 -4
  611. package/Weather/Weather.js +294 -247
  612. package/Weather/index.js +12 -7
  613. package/Whiteboard/Whiteboard.d.ts +5 -5
  614. package/Whiteboard/Whiteboard.js +1392 -1292
  615. package/Whiteboard/index.js +12 -7
  616. package/Widgets/Context.js +9 -7
  617. package/Widgets/Widgets.d.ts +2 -2
  618. package/Widgets/Widgets.js +220 -168
  619. package/Widgets/index.js +32 -13
  620. package/Widgets/useWidgets.js +11 -10
  621. package/WindowSplit/WindowSplit.d.ts +1 -1
  622. package/WindowSplit/WindowSplit.js +381 -336
  623. package/WindowSplit/index.js +12 -7
  624. package/Zoom/Zoom.d.ts +1 -1
  625. package/Zoom/Zoom.js +126 -99
  626. package/Zoom/index.js +12 -7
  627. package/esm/Append/Append.js +6 -8
  628. package/esm/AutoComplete/AutoComplete.js +8 -20
  629. package/esm/Breadcrumbs/Breadcrumbs.js +1 -3
  630. package/esm/Buttons/Buttons.js +8 -33
  631. package/esm/Calendar/Calendar.js +74 -80
  632. package/esm/CalendarAvailability/CalendarAvailability.js +1 -2
  633. package/esm/CalendarMenu/CalendarMenu.js +2 -2
  634. package/esm/CalendarMonth/CalendarMonth.js +65 -68
  635. package/esm/CalendarWeek/CalendarWeek.js +3 -7
  636. package/esm/Carousel/Carousel.js +4 -12
  637. package/esm/Chart/Chart.js +19 -25
  638. package/esm/Clock/Clock.js +5 -8
  639. package/esm/Confirm/Confirm.js +1 -2
  640. package/esm/DatePicker/DatePicker.js +8 -13
  641. package/esm/DateTimePicker/DateTimePicker.js +6 -9
  642. package/esm/Drawing/Drawing.js +1 -6
  643. package/esm/Expand/Expand.js +1 -2
  644. package/esm/Fade/Fade.js +1 -2
  645. package/esm/Focus/Focus.js +1 -2
  646. package/esm/Grow/Grow.js +1 -2
  647. package/esm/HTMLCanvas/HTMLCanvas.js +2 -5
  648. package/esm/ImageCrop/ImageCrop.js +2 -5
  649. package/esm/ImageEdit/ImageEdit.js +5 -12
  650. package/esm/ImageGallery/ImageGallery.js +1 -2
  651. package/esm/Interaction/Interaction.js +1 -2
  652. package/esm/Keyframes/Keyframes.js +1 -2
  653. package/esm/LinearMeter/LinearMeter.js +77 -80
  654. package/esm/Markdown/Markdown.js +41 -144
  655. package/esm/MenuDesktop/MenuDesktop.js +5 -6
  656. package/esm/Rating/Rating.js +2 -4
  657. package/esm/RichTextEditor/RichTextEditor.js +36 -50
  658. package/esm/RoundMeter/RoundMeter.js +70 -73
  659. package/esm/ScreenCapture/ScreenCapture.js +2 -5
  660. package/esm/Select/Select.js +5 -9
  661. package/esm/Share/Share.js +4 -5
  662. package/esm/Slide/Slide.js +2 -4
  663. package/esm/Slider/Slider.js +3 -6
  664. package/esm/SmartTextField/SmartTextField.js +2 -4
  665. package/esm/Snackbar/Snackbar.js +1 -2
  666. package/esm/Snackbars/Snackbars.js +3 -3
  667. package/esm/Space/Space.js +3 -6
  668. package/esm/Switch/Switch.js +1 -2
  669. package/esm/Tabs/Tabs.js +1 -2
  670. package/esm/TimePicker/TimePicker.js +27 -38
  671. package/esm/Timer/Timer.js +3 -4
  672. package/esm/Tooltip/Tooltip.js +1 -2
  673. package/esm/ViewSplit/ViewSplit.js +1 -2
  674. package/esm/Watch/Watch.js +4 -5
  675. package/esm/Weather/Weather.js +14 -17
  676. package/esm/Whiteboard/Whiteboard.js +1 -4
  677. package/esm/WindowSplit/WindowSplit.js +1 -2
  678. package/esm/Zoom/Zoom.js +1 -2
  679. package/esm/index.js +1 -1
  680. package/esm/useForm/useForm.js +1 -4
  681. package/esm/useLocation/useLocation.js +1 -2
  682. package/esm/useSwipe/useSwipe.js +1 -2
  683. package/esm/utils.js +3 -11
  684. package/index.js +4052 -660
  685. package/package.json +3 -3
  686. package/types.d.ts +27 -27
  687. package/types.js +4 -1
  688. package/useForm/index.js +25 -11
  689. package/useForm/useForm.d.ts +2 -2
  690. package/useForm/useForm.js +203 -174
  691. package/useForm/validate.d.ts +12 -12
  692. package/useForm/validate.js +215 -203
  693. package/useLocation/index.js +12 -7
  694. package/useLocation/useLocation.d.ts +1 -1
  695. package/useLocation/useLocation.js +54 -49
  696. package/useMediaQuery/index.js +12 -7
  697. package/useMediaQuery/useMediaQuery.d.ts +1 -1
  698. package/useMediaQuery/useMediaQuery.js +44 -43
  699. package/useQuery/index.js +12 -7
  700. package/useQuery/useQuery.js +14 -10
  701. package/useScroll/index.js +12 -7
  702. package/useScroll/useScroll.d.ts +2 -2
  703. package/useScroll/useScroll.js +61 -56
  704. package/useSubscription/index.js +12 -7
  705. package/useSubscription/useSubscription.js +35 -35
  706. package/useSwipe/index.js +12 -7
  707. package/useSwipe/useSwipe.d.ts +2 -2
  708. package/useSwipe/useSwipe.js +157 -131
  709. package/useVisible/index.js +12 -7
  710. package/useVisible/useVisible.d.ts +2 -2
  711. package/useVisible/useVisible.js +86 -76
  712. package/utils.js +1224 -1362
package/Slider/Slider.js CHANGED
@@ -1,857 +1,947 @@
1
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
- const jsx_runtime_1 = require("react/jsx-runtime");
18
- const react_1 = __importDefault(require("react"));
19
- const utils_1 = require("@onesy/utils");
20
- const style_react_1 = require("@onesy/style-react");
21
- const IconButton_1 = __importDefault(require("../IconButton"));
22
- const Tooltip_1 = __importDefault(require("../Tooltip"));
23
- const Zoom_1 = __importDefault(require("../Zoom"));
24
- const Type_1 = __importDefault(require("../Type"));
25
- const utils_2 = require("../utils");
26
- const useStyle = (0, style_react_1.style)(theme => {
27
- const rail = {
28
- position: 'absolute',
29
- display: 'inline-flex',
30
- alignItems: 'center',
31
- justifyContent: 'center',
32
- borderRadius: 'inherit'
33
- };
34
- const horizontal = {
35
- top: '50%',
36
- transform: 'translateY(-50%)'
37
- };
38
- const vertical = {
39
- left: '50%',
40
- transform: 'translateX(-50%)'
41
- };
42
- return {
43
- root: {
44
- position: 'relative',
45
- display: 'inline-flex',
46
- borderRadius: `${theme.shape.radius.unit * 0.75}px`,
47
- cursor: 'pointer',
48
- touchAction: 'none'
49
- },
50
- root_orientation_horizontal: {
51
- width: '100vw',
52
- maxWidth: 'clamp(100px, 400px, 100%)',
53
- height: 4,
54
- margin: '16px 0 28px'
55
- },
56
- root_orientation_vertical: {
57
- height: '100vh',
58
- maxHeight: 240,
59
- width: 4,
60
- margin: '0 16px 0 28px'
61
- },
62
- rail: Object.assign({}, rail),
63
- rail_orientation_horizontal: {
64
- insetInline: '0'
65
- },
66
- rail_orientation_vertical: {
67
- insetBlock: '0'
68
- },
69
- rail_orientation_horizontal_size_small: { height: '3px' },
70
- rail_orientation_horizontal_size_regular: { height: '4px' },
71
- rail_orientation_horizontal_size_large: { height: '5px' },
72
- rail_orientation_vertical_size_small: { width: '3px' },
73
- rail_orientation_vertical_size_regular: { width: '4px' },
74
- rail_orientation_vertical_size_large: { width: '5px' },
75
- track: Object.assign({}, rail),
76
- track_orientation_horizontal: {
77
- insetInlineStart: '0'
78
- },
79
- track_orientation_vertical: {
80
- insetBlockEnd: '0'
81
- },
82
- track_orientation_horizontal_size_small: { height: '5px' },
83
- track_orientation_horizontal_size_regular: { height: '6px' },
84
- track_orientation_horizontal_size_large: { height: '7px' },
85
- track_orientation_vertical_size_small: { width: '5px' },
86
- track_orientation_vertical_size_regular: { width: '6px' },
87
- track_orientation_vertical_size_large: { width: '7px' },
88
- // Color
89
- // rail
90
- rail_color_default: { background: theme.methods.palette.color.value('default', 40, true) },
91
- rail_color_neutral: { background: theme.methods.palette.color.value('neutral', 40, true) },
92
- rail_color_primary: { background: theme.methods.palette.color.value('primary', 40, true) },
93
- rail_color_secondary: { background: theme.methods.palette.color.value('secondary', 40, true) },
94
- rail_color_tertiary: { background: theme.methods.palette.color.value('tertiary', 40, true) },
95
- rail_color_quaternary: { background: theme.methods.palette.color.value('quaternary', 40, true) },
96
- rail_color_info: { background: theme.methods.palette.color.value('info', 40, true) },
97
- rail_color_success: { background: theme.methods.palette.color.value('success', 40, true) },
98
- rail_color_warning: { background: theme.methods.palette.color.value('warning', 40, true) },
99
- rail_color_error: { background: theme.methods.palette.color.value('info', 40, true) },
100
- // track
101
- track_color_default: { background: theme.methods.palette.color.value('default', 30, true) },
102
- track_color_neutral: { background: theme.methods.palette.color.value('neutral', 30, true) },
103
- track_color_primary: { background: theme.methods.palette.color.value('primary', 30, true) },
104
- track_color_secondary: { background: theme.methods.palette.color.value('secondary', 30, true) },
105
- track_color_tertiary: { background: theme.methods.palette.color.value('tertiary', 30, true) },
106
- track_color_quaternary: { background: theme.methods.palette.color.value('quaternary', 30, true) },
107
- track_color_info: { background: theme.methods.palette.color.value('info', 30, true) },
108
- track_color_success: { background: theme.methods.palette.color.value('success', 30, true) },
109
- track_color_warning: { background: theme.methods.palette.color.value('warning', 30, true) },
110
- track_color_error: { background: theme.methods.palette.color.value('error', 30, true) },
111
- // Tonal
112
- track_tonal_color_neutral: { background: theme.methods.palette.color.value('neutral', 20, true) },
113
- track_tonal_color_primary: { background: theme.methods.palette.color.value('primary', 20, true) },
114
- track_tonal_color_secondary: { background: theme.methods.palette.color.value('secondary', 20, true) },
115
- track_tonal_color_tertiary: { background: theme.methods.palette.color.value('tertiary', 20, true) },
116
- track_tonal_color_quaternary: { background: theme.methods.palette.color.value('quaternary', 20, true) },
117
- track_tonal_color_info: { background: theme.methods.palette.color.value('info', 20, true) },
118
- track_tonal_color_success: { background: theme.methods.palette.color.value('success', 20, true) },
119
- track_tonal_color_warning: { background: theme.methods.palette.color.value('warning', 20, true) },
120
- track_tonal_color_error: { background: theme.methods.palette.color.value('info', 20, true) },
121
- // iconButton
122
- iconButton_color_default: {
123
- '&.onesy-IconButton-root': {
124
- color: theme.palette.text.default.primary
125
- }
126
- },
127
- iconButton_color_neutral: {
128
- '&.onesy-IconButton-root': {
129
- color: theme.palette.color.neutral.main
130
- }
131
- },
132
- iconButton_color_primary: {
133
- '&.onesy-IconButton-root': {
134
- color: theme.palette.color.primary.main
135
- }
136
- },
137
- iconButton_color_secondary: {
138
- '&.onesy-IconButton-root': {
139
- color: theme.palette.color.secondary.main
140
- }
141
- },
142
- iconButton_color_tertiary: {
143
- '&.onesy-IconButton-root': {
144
- color: theme.palette.color.tertiary.main
145
- }
146
- },
147
- iconButton_color_quaternary: {
148
- '&.onesy-IconButton-root': {
149
- color: theme.palette.color.quaternary.main
150
- }
151
- },
152
- iconButton_color_info: {
153
- '&.onesy-IconButton-root': {
154
- color: theme.palette.color.info.main
155
- }
156
- },
157
- iconButton_color_success: {
158
- '&.onesy-IconButton-root': {
159
- color: theme.palette.color.success.main
160
- }
161
- },
162
- iconButton_color_warning: {
163
- '&.onesy-IconButton-root': {
164
- color: theme.palette.color.warning.main
165
- }
166
- },
167
- iconButton_color_error: {
168
- '&.onesy-IconButton-root': {
169
- color: theme.palette.color.error.main
170
- }
171
- },
172
- // Tonal
173
- iconButton_tonal_color_neutral: {
174
- '&.onesy-IconButton-root': {
175
- color: theme.methods.palette.color.value('default', 70)
176
- }
177
- },
178
- iconButton_tonal_color_primary: {
179
- '&.onesy-IconButton-root': {
180
- color: theme.methods.palette.color.value('primary', 70)
181
- }
182
- },
183
- iconButton_tonal_color_secondary: {
184
- '&.onesy-IconButton-root': {
185
- color: theme.methods.palette.color.value('secondary', 70)
186
- }
187
- },
188
- iconButton_tonal_color_tertiary: {
189
- '&.onesy-IconButton-root': {
190
- color: theme.methods.palette.color.value('tertiary', 70)
191
- }
192
- },
193
- iconButton_tonal_color_quaternary: {
194
- '&.onesy-IconButton-root': {
195
- color: theme.methods.palette.color.value('quaternary', 70)
196
- }
197
- },
198
- iconButton_tonal_color_info: {
199
- '&.onesy-IconButton-root': {
200
- color: theme.methods.palette.color.value('info', 70)
201
- }
202
- },
203
- iconButton_tonal_color_success: {
204
- '&.onesy-IconButton-root': {
205
- color: theme.methods.palette.color.value('success', 70)
206
- }
207
- },
208
- iconButton_tonal_color_warning: {
209
- '&.onesy-IconButton-root': {
210
- color: theme.methods.palette.color.value('warning', 70)
211
- }
212
- },
213
- iconButton_tonal_color_error: {
214
- '&.onesy-IconButton-root': {
215
- color: theme.methods.palette.color.value('error', 70)
216
- }
217
- },
218
- square: {
219
- borderRadius: '0px'
220
- },
221
- iconButton: {
222
- position: 'absolute'
223
- },
224
- icon: {
225
- display: 'inline-flex',
226
- alignItems: 'center',
227
- justifyContent: 'center',
228
- borderRadius: `calc(${theme.shape.radius.unit / 8} * 0.5em)`,
229
- transform: 'scale(0.7)',
230
- transition: theme.methods.transitions.make('transform', { duration: 'xs' })
231
- },
232
- iconActive: {
233
- transform: 'scale(1)'
234
- },
235
- icon_size_small: {
236
- width: '16px',
237
- height: '16px',
238
- },
239
- icon_size_regular: {
240
- width: '20px',
241
- height: '20px',
242
- },
243
- icon_size_large: {
244
- width: '24px',
245
- height: '24px',
246
- },
247
- marks: Object.assign({ inset: '0' }, rail),
248
- mark: {
249
- position: 'absolute',
250
- width: '2px',
251
- height: '2px',
252
- borderRadius: theme.methods.shape.radius.value(40, 'px')
253
- },
254
- orientation_horizontal: Object.assign({}, horizontal),
255
- orientation_vertical: Object.assign({}, vertical),
256
- labels: {
257
- position: 'absolute',
258
- whiteSpace: 'nowrap',
259
- userSelect: 'none'
260
- },
261
- labels_orientation_horizontal: {
262
- width: '100%',
263
- left: '0',
264
- top: '15px'
265
- },
266
- labels_orientation_vertical: {
267
- height: '100%',
268
- top: '0',
269
- insetInlineStart: '21px'
270
- },
271
- label: {
272
- position: 'absolute',
273
- transition: theme.methods.transitions.make('color', { duration: 'xs' }),
274
- color: theme.palette.text.default.secondary
275
- },
276
- label_orientation_horizontal: {
277
- transform: 'translateX(-50%)'
278
- },
279
- label_orientation_horizontal_rtl: {
280
- transform: 'translateX(50%)'
281
- },
282
- label_orientation_vertical: {
283
- transform: 'translateY(50%)'
284
- },
285
- label_active: {
286
- color: theme.palette.text.default.primary
287
- },
288
- focus_outline: {
289
- outline: `1px solid ${theme.palette.text.default.secondary}`,
290
- outlineOffset: '8px'
291
- },
292
- readOnly: {
293
- cursor: 'default'
294
- },
295
- tooltip: {
296
- '& .onesy-Tooltip-name': {
297
- padding: '0',
298
- lineHeight: '0',
299
- minWidth: '30px',
300
- paddingTop: '100%',
301
- overflow: 'hidden',
302
- borderRadius: `${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} 0px`,
303
- transform: 'rotate(-45deg)',
304
- '& .onesy-Tooltip-name-text': {
305
- position: 'absolute',
306
- top: '50%',
307
- left: '50%',
308
- transform: 'translate(-50%, -50%) rotate(45deg)'
309
- }
310
- },
311
- '&.onesy-Tooltip-position-left': {
312
- '& .onesy-Tooltip-name': {
313
- borderRadius: `${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} 0px ${theme.methods.shape.radius.value(40, 'px')}`
314
- }
315
- },
316
- '&.onesy-Tooltip-position-right': {
317
- '& .onesy-Tooltip-name': {
318
- borderRadius: `0px ${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')}`
319
- }
320
- }
321
- },
322
- tooltip_switch_orientation_horizontal_ltr: {
323
- '& .onesy-Tooltip-name': {
324
- transform: 'rotate(135deg)',
325
- '& .onesy-Tooltip-name-text': {
326
- transform: 'translate(-50%, -50%) rotate(-135deg)'
327
- }
328
- }
329
- },
330
- tooltip_switch_orientation_horizontal_rtl: {
331
- '& .onesy-Tooltip-name': {
332
- transform: 'rotate(135deg)',
333
- '& .onesy-Tooltip-name-text': {
334
- transform: 'translate(-50%, -50%) rotate(-135deg)'
335
- }
336
- }
337
- },
338
- tooltipLabelText: {
339
- minWidth: '40px',
340
- textAlign: 'center'
341
- },
342
- disabled: {
343
- cursor: 'default',
344
- pointerEvents: 'none',
345
- opacity: theme.palette.visual_contrast.default.opacity.disabled
346
- }
347
- };
348
- }, { name: 'onesy-Slider' });
349
- const Slider = react_1.default.forwardRef((props_, ref) => {
350
- var _a;
351
- const theme = (0, style_react_1.useOnesyTheme)();
352
- const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesySlider) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
353
- const IconButton = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.IconButton) || IconButton_1.default; }, [theme]);
354
- const Tooltip = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Tooltip) || Tooltip_1.default; }, [theme]);
355
- const Zoom = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Zoom) || Zoom_1.default; }, [theme]);
356
- const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
357
- const { tonal = true, color: color_ = 'primary', size = 'regular', value: value_, valueDefault, onChange, orientation = 'horizontal', marks, precision = 0.001, min = 0, max = 100, tooltip, labels, onlyMarks, labelTooltipResolve, iconButtonPositionResolve, noTrack, noButtons, square, inverted, readOnly, disabled, icon, onMouseDown: onMouseDown_, onTouchStart: onTouchStart_, IconButtonProps, LabelProps, TooltipProps, Component = 'span', style, className, children } = props, other = __rest(props, ["tonal", "color", "size", "value", "valueDefault", "onChange", "orientation", "marks", "precision", "min", "max", "tooltip", "labels", "onlyMarks", "labelTooltipResolve", "iconButtonPositionResolve", "noTrack", "noButtons", "square", "inverted", "readOnly", "disabled", "icon", "onMouseDown", "onTouchStart", "IconButtonProps", "LabelProps", "TooltipProps", "Component", "style", "className", "children"]);
358
- const { classes } = useStyle();
359
- const [init, setInit] = react_1.default.useState(false);
360
- const [value, setValue] = react_1.default.useState(() => {
361
- const valueNew = (valueDefault !== undefined ? valueDefault : value_) || ((0, utils_1.is)('number', min) ? min : 0);
362
- return (0, utils_1.is)('array', valueNew) ? valueNew.sort((a, b) => a - b).map(item => (0, utils_1.clamp)(item, min, max)) : (0, utils_1.clamp)(valueNew, min, max);
363
- });
364
- const [mouseDown, setMouseDown] = react_1.default.useState(false);
365
- const [mouseDownButton, setMouseDownButton] = react_1.default.useState(false);
366
- const [focus, setFocus] = react_1.default.useState(false);
367
- const [focusButton, setFocusButton] = react_1.default.useState(false);
368
- const refs = {
369
- root: react_1.default.useRef(undefined),
370
- value: react_1.default.useRef(undefined),
371
- props: react_1.default.useRef(undefined),
372
- mouseDown: react_1.default.useRef(undefined),
373
- mouseDownButton: react_1.default.useRef(undefined),
374
- focusButton: react_1.default.useRef(undefined),
375
- direction: react_1.default.useRef(undefined),
376
- iconButtons: react_1.default.useRef([]),
377
- min: react_1.default.useRef(min),
378
- max: react_1.default.useRef(max)
379
- };
380
- refs.value.current = value;
381
- refs.props.current = props;
382
- refs.mouseDown.current = mouseDown;
383
- refs.mouseDownButton.current = mouseDownButton;
384
- refs.focusButton.current = focusButton;
385
- refs.direction.current = theme.direction;
386
- refs.min.current = min;
387
- refs.max.current = max;
388
- let color = color_;
389
- if (disabled)
390
- color = 'default';
391
- const valueDecimals = (String(precision).includes('e-') ? +String(precision).split('e-')[1] : (_a = String(precision).split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) || 0;
392
- const valuePrecision = (valueMouse, mouseDownButtonUpdate = false) => {
393
- let value__ = (0, utils_1.valueFromPercentageWithinRange)(valueMouse * 100, refs.min.current, refs.max.current);
394
- if (refs.direction.current === 'rtl' && orientation === 'horizontal')
395
- value__ = (refs.max.current + refs.min.current) - value__;
396
- if (value__ <= refs.min.current)
397
- return refs.min.current;
398
- if (value__ >= refs.max.current)
399
- return refs.max.current;
400
- // previous value
401
- let previous = (0, utils_1.clamp)(+(value__ - (value__ % precision)).toFixed(valueDecimals), refs.min.current, refs.max.current);
402
- if (value__ < 0)
403
- previous -= precision;
404
- if (onlyMarks && (0, utils_1.is)('array', marks)) {
405
- const previousMark = marks.map(item => item.value).sort((a, b) => b - a).find(item => item <= value__);
406
- previous = previousMark !== undefined ? previousMark : refs.min.current;
407
- }
408
- // next value
409
- let next = (0, utils_1.clamp)(+(previous + precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
410
- if (onlyMarks && (0, utils_1.is)('array', marks)) {
411
- const nextMark = marks.map(item => item.value).sort((a, b) => a - b).find(item => item >= value__);
412
- next = nextMark !== undefined ? nextMark : refs.max.current;
413
- }
414
- const valueNew = value__ < previous + ((next - previous) / 2) ? previous : next;
415
- if (mouseDownButtonUpdate && (0, utils_1.is)('array', refs.value.current)) {
416
- const items = refs.value.current.map(item => Math.abs(valueNew - item));
417
- const minItem = Math.min(...items);
418
- const index = items.findIndex(item => item === minItem);
419
- setMouseDownButton(index);
420
- refs.mouseDownButton.current = index;
421
- }
422
- return valueNew;
423
- };
424
- react_1.default.useEffect(() => {
425
- var _a;
426
- const onMouseUp = () => {
427
- if (!disabled && !readOnly) {
428
- setMouseDown(false);
429
- setMouseDownButton(false);
430
- }
431
- };
432
- const onMouseMove = (event) => {
433
- if (!refs.props.current.disabled && !refs.props.current.readOnly && refs.mouseDown.current) {
434
- let x;
435
- let y;
436
- if (event.clientX !== undefined) {
437
- x = event.clientX;
438
- y = event.clientY;
439
- }
440
- else {
441
- x = event.touches[0].clientX;
442
- y = event.touches[0].clientY;
443
- }
444
- const rect = refs.root.current.getBoundingClientRect();
445
- const { width, height } = rect;
446
- // Value to the precision point value
447
- const value__ = valuePrecision(orientation === 'horizontal' ? (x - rect.x) / width : (1 - (y - rect.y) / height));
448
- const valueNew = (0, utils_1.is)('array', refs.value.current) ? [...refs.value.current] : value__;
449
- if ((0, utils_1.is)('array', refs.value.current)) {
450
- let index = (0, utils_1.is)('number', refs.mouseDownButton.current) ? refs.mouseDownButton.current : 0;
451
- if (index > 0 && value__ < refs.value.current[index - 1]) {
452
- index -= 1;
453
- setMouseDownButton(index);
454
- }
455
- if (index < refs.value.current.length - 1 && value__ > refs.value.current[index + 1]) {
456
- index += 1;
457
- setMouseDownButton(index);
458
- }
459
- valueNew[index] = value__;
460
- }
461
- if (!(0, utils_1.equalDeep)(valueNew, refs.value.current)) {
462
- // Inner controlled value
463
- if (!props.hasOwnProperty('value'))
464
- setValue(valueNew);
465
- if ((0, utils_1.is)('function', onChange))
466
- onChange(valueNew);
467
- }
468
- }
469
- };
470
- const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
471
- rootDocument.addEventListener('mouseup', onMouseUp);
472
- rootDocument.addEventListener('mousemove', onMouseMove);
473
- rootDocument.addEventListener('touchend', onMouseUp, { passive: true });
474
- rootDocument.addEventListener('touchmove', onMouseMove, { passive: true });
475
- setInit(true);
476
- return () => {
477
- rootDocument.removeEventListener('mouseup', onMouseUp);
478
- rootDocument.removeEventListener('touchend', onMouseUp);
479
- rootDocument.removeEventListener('mousemove', onMouseMove);
480
- rootDocument.removeEventListener('touchmove', onMouseMove);
481
- };
482
- }, []);
483
- react_1.default.useEffect(() => {
484
- if (init && value_ !== value)
485
- setValue(value_);
486
- }, [value_]);
487
- const move = react_1.default.useCallback((x, y) => {
488
- if (!disabled && !readOnly) {
489
- const rect = refs.root.current.getBoundingClientRect();
490
- const { width, height } = rect;
491
- // Value to the precision point value
492
- const value__ = valuePrecision(orientation === 'horizontal' ? (x - rect.x) / width : (1 - (y - rect.y) / height), true);
493
- const valueNew = (0, utils_1.is)('array', refs.value.current) ? [...refs.value.current] : value__;
494
- if ((0, utils_1.is)('array', refs.value.current)) {
495
- let index = (0, utils_1.is)('number', refs.mouseDownButton.current) ? refs.mouseDownButton.current : 0;
496
- if (index > 0 && value__ <= refs.value.current[index - 1]) {
497
- index -= 1;
498
- setMouseDownButton(index);
499
- }
500
- if (index < refs.value.current.length - 1 && value__ >= refs.value.current[index + 1]) {
501
- index += 1;
502
- setMouseDownButton(index);
503
- }
504
- valueNew[index] = value__;
505
- }
506
- if (!(0, utils_1.equalDeep)(valueNew, refs.value.current)) {
507
- // Inner controlled value
508
- if (!props.hasOwnProperty('value'))
509
- setValue(valueNew);
510
- if ((0, utils_1.is)('function', onChange))
511
- onChange(valueNew);
512
- }
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _utils = require("@onesy/utils");
13
+ var _styleReact = require("@onesy/style-react");
14
+ var _IconButton = _interopRequireDefault(require("../IconButton"));
15
+ var _Tooltip = _interopRequireDefault(require("../Tooltip"));
16
+ var _Zoom = _interopRequireDefault(require("../Zoom"));
17
+ var _Type = _interopRequireDefault(require("../Type"));
18
+ var _utils2 = require("../utils");
19
+ const _excluded = ["tonal", "color", "size", "value", "valueDefault", "onChange", "orientation", "marks", "precision", "min", "max", "tooltip", "labels", "onlyMarks", "labelTooltipResolve", "iconButtonPositionResolve", "noTrack", "noButtons", "square", "inverted", "readOnly", "disabled", "icon", "onMouseDown", "onTouchStart", "IconButtonProps", "LabelProps", "TooltipProps", "Component", "style", "className", "children"];
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
+ const useStyle = (0, _styleReact.style)(theme => {
23
+ const rail = {
24
+ position: 'absolute',
25
+ display: 'inline-flex',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ borderRadius: 'inherit'
29
+ };
30
+ const horizontal = {
31
+ top: '50%',
32
+ transform: 'translateY(-50%)'
33
+ };
34
+ const vertical = {
35
+ left: '50%',
36
+ transform: 'translateX(-50%)'
37
+ };
38
+ return {
39
+ root: {
40
+ position: 'relative',
41
+ display: 'inline-flex',
42
+ borderRadius: `${theme.shape.radius.unit * 0.75}px`,
43
+ cursor: 'pointer',
44
+ touchAction: 'none'
45
+ },
46
+ root_orientation_horizontal: {
47
+ width: '100vw',
48
+ maxWidth: 'clamp(100px, 400px, 100%)',
49
+ height: 4,
50
+ margin: '16px 0 28px'
51
+ },
52
+ root_orientation_vertical: {
53
+ height: '100vh',
54
+ maxHeight: 240,
55
+ width: 4,
56
+ margin: '0 16px 0 28px'
57
+ },
58
+ rail: _objectSpread({}, rail),
59
+ rail_orientation_horizontal: {
60
+ insetInline: '0'
61
+ },
62
+ rail_orientation_vertical: {
63
+ insetBlock: '0'
64
+ },
65
+ rail_orientation_horizontal_size_small: {
66
+ height: '3px'
67
+ },
68
+ rail_orientation_horizontal_size_regular: {
69
+ height: '4px'
70
+ },
71
+ rail_orientation_horizontal_size_large: {
72
+ height: '5px'
73
+ },
74
+ rail_orientation_vertical_size_small: {
75
+ width: '3px'
76
+ },
77
+ rail_orientation_vertical_size_regular: {
78
+ width: '4px'
79
+ },
80
+ rail_orientation_vertical_size_large: {
81
+ width: '5px'
82
+ },
83
+ track: _objectSpread({}, rail),
84
+ track_orientation_horizontal: {
85
+ insetInlineStart: '0'
86
+ },
87
+ track_orientation_vertical: {
88
+ insetBlockEnd: '0'
89
+ },
90
+ track_orientation_horizontal_size_small: {
91
+ height: '5px'
92
+ },
93
+ track_orientation_horizontal_size_regular: {
94
+ height: '6px'
95
+ },
96
+ track_orientation_horizontal_size_large: {
97
+ height: '7px'
98
+ },
99
+ track_orientation_vertical_size_small: {
100
+ width: '5px'
101
+ },
102
+ track_orientation_vertical_size_regular: {
103
+ width: '6px'
104
+ },
105
+ track_orientation_vertical_size_large: {
106
+ width: '7px'
107
+ },
108
+ // Color
109
+ // rail
110
+ rail_color_default: {
111
+ background: theme.methods.palette.color.value('default', 40, true)
112
+ },
113
+ rail_color_neutral: {
114
+ background: theme.methods.palette.color.value('neutral', 40, true)
115
+ },
116
+ rail_color_primary: {
117
+ background: theme.methods.palette.color.value('primary', 40, true)
118
+ },
119
+ rail_color_secondary: {
120
+ background: theme.methods.palette.color.value('secondary', 40, true)
121
+ },
122
+ rail_color_tertiary: {
123
+ background: theme.methods.palette.color.value('tertiary', 40, true)
124
+ },
125
+ rail_color_quaternary: {
126
+ background: theme.methods.palette.color.value('quaternary', 40, true)
127
+ },
128
+ rail_color_info: {
129
+ background: theme.methods.palette.color.value('info', 40, true)
130
+ },
131
+ rail_color_success: {
132
+ background: theme.methods.palette.color.value('success', 40, true)
133
+ },
134
+ rail_color_warning: {
135
+ background: theme.methods.palette.color.value('warning', 40, true)
136
+ },
137
+ rail_color_error: {
138
+ background: theme.methods.palette.color.value('info', 40, true)
139
+ },
140
+ // track
141
+ track_color_default: {
142
+ background: theme.methods.palette.color.value('default', 30, true)
143
+ },
144
+ track_color_neutral: {
145
+ background: theme.methods.palette.color.value('neutral', 30, true)
146
+ },
147
+ track_color_primary: {
148
+ background: theme.methods.palette.color.value('primary', 30, true)
149
+ },
150
+ track_color_secondary: {
151
+ background: theme.methods.palette.color.value('secondary', 30, true)
152
+ },
153
+ track_color_tertiary: {
154
+ background: theme.methods.palette.color.value('tertiary', 30, true)
155
+ },
156
+ track_color_quaternary: {
157
+ background: theme.methods.palette.color.value('quaternary', 30, true)
158
+ },
159
+ track_color_info: {
160
+ background: theme.methods.palette.color.value('info', 30, true)
161
+ },
162
+ track_color_success: {
163
+ background: theme.methods.palette.color.value('success', 30, true)
164
+ },
165
+ track_color_warning: {
166
+ background: theme.methods.palette.color.value('warning', 30, true)
167
+ },
168
+ track_color_error: {
169
+ background: theme.methods.palette.color.value('error', 30, true)
170
+ },
171
+ // Tonal
172
+ track_tonal_color_neutral: {
173
+ background: theme.methods.palette.color.value('neutral', 20, true)
174
+ },
175
+ track_tonal_color_primary: {
176
+ background: theme.methods.palette.color.value('primary', 20, true)
177
+ },
178
+ track_tonal_color_secondary: {
179
+ background: theme.methods.palette.color.value('secondary', 20, true)
180
+ },
181
+ track_tonal_color_tertiary: {
182
+ background: theme.methods.palette.color.value('tertiary', 20, true)
183
+ },
184
+ track_tonal_color_quaternary: {
185
+ background: theme.methods.palette.color.value('quaternary', 20, true)
186
+ },
187
+ track_tonal_color_info: {
188
+ background: theme.methods.palette.color.value('info', 20, true)
189
+ },
190
+ track_tonal_color_success: {
191
+ background: theme.methods.palette.color.value('success', 20, true)
192
+ },
193
+ track_tonal_color_warning: {
194
+ background: theme.methods.palette.color.value('warning', 20, true)
195
+ },
196
+ track_tonal_color_error: {
197
+ background: theme.methods.palette.color.value('info', 20, true)
198
+ },
199
+ // iconButton
200
+ iconButton_color_default: {
201
+ '&.onesy-IconButton-root': {
202
+ color: theme.palette.text.default.primary
203
+ }
204
+ },
205
+ iconButton_color_neutral: {
206
+ '&.onesy-IconButton-root': {
207
+ color: theme.palette.color.neutral.main
208
+ }
209
+ },
210
+ iconButton_color_primary: {
211
+ '&.onesy-IconButton-root': {
212
+ color: theme.palette.color.primary.main
213
+ }
214
+ },
215
+ iconButton_color_secondary: {
216
+ '&.onesy-IconButton-root': {
217
+ color: theme.palette.color.secondary.main
218
+ }
219
+ },
220
+ iconButton_color_tertiary: {
221
+ '&.onesy-IconButton-root': {
222
+ color: theme.palette.color.tertiary.main
223
+ }
224
+ },
225
+ iconButton_color_quaternary: {
226
+ '&.onesy-IconButton-root': {
227
+ color: theme.palette.color.quaternary.main
228
+ }
229
+ },
230
+ iconButton_color_info: {
231
+ '&.onesy-IconButton-root': {
232
+ color: theme.palette.color.info.main
233
+ }
234
+ },
235
+ iconButton_color_success: {
236
+ '&.onesy-IconButton-root': {
237
+ color: theme.palette.color.success.main
238
+ }
239
+ },
240
+ iconButton_color_warning: {
241
+ '&.onesy-IconButton-root': {
242
+ color: theme.palette.color.warning.main
243
+ }
244
+ },
245
+ iconButton_color_error: {
246
+ '&.onesy-IconButton-root': {
247
+ color: theme.palette.color.error.main
248
+ }
249
+ },
250
+ // Tonal
251
+ iconButton_tonal_color_neutral: {
252
+ '&.onesy-IconButton-root': {
253
+ color: theme.methods.palette.color.value('default', 70)
254
+ }
255
+ },
256
+ iconButton_tonal_color_primary: {
257
+ '&.onesy-IconButton-root': {
258
+ color: theme.methods.palette.color.value('primary', 70)
259
+ }
260
+ },
261
+ iconButton_tonal_color_secondary: {
262
+ '&.onesy-IconButton-root': {
263
+ color: theme.methods.palette.color.value('secondary', 70)
264
+ }
265
+ },
266
+ iconButton_tonal_color_tertiary: {
267
+ '&.onesy-IconButton-root': {
268
+ color: theme.methods.palette.color.value('tertiary', 70)
269
+ }
270
+ },
271
+ iconButton_tonal_color_quaternary: {
272
+ '&.onesy-IconButton-root': {
273
+ color: theme.methods.palette.color.value('quaternary', 70)
274
+ }
275
+ },
276
+ iconButton_tonal_color_info: {
277
+ '&.onesy-IconButton-root': {
278
+ color: theme.methods.palette.color.value('info', 70)
279
+ }
280
+ },
281
+ iconButton_tonal_color_success: {
282
+ '&.onesy-IconButton-root': {
283
+ color: theme.methods.palette.color.value('success', 70)
284
+ }
285
+ },
286
+ iconButton_tonal_color_warning: {
287
+ '&.onesy-IconButton-root': {
288
+ color: theme.methods.palette.color.value('warning', 70)
289
+ }
290
+ },
291
+ iconButton_tonal_color_error: {
292
+ '&.onesy-IconButton-root': {
293
+ color: theme.methods.palette.color.value('error', 70)
294
+ }
295
+ },
296
+ square: {
297
+ borderRadius: '0px'
298
+ },
299
+ iconButton: {
300
+ position: 'absolute'
301
+ },
302
+ icon: {
303
+ display: 'inline-flex',
304
+ alignItems: 'center',
305
+ justifyContent: 'center',
306
+ borderRadius: `calc(${theme.shape.radius.unit / 8} * 0.5em)`,
307
+ transform: 'scale(0.7)',
308
+ transition: theme.methods.transitions.make('transform', {
309
+ duration: 'xs'
310
+ })
311
+ },
312
+ iconActive: {
313
+ transform: 'scale(1)'
314
+ },
315
+ icon_size_small: {
316
+ width: '16px',
317
+ height: '16px'
318
+ },
319
+ icon_size_regular: {
320
+ width: '20px',
321
+ height: '20px'
322
+ },
323
+ icon_size_large: {
324
+ width: '24px',
325
+ height: '24px'
326
+ },
327
+ marks: _objectSpread({
328
+ inset: '0'
329
+ }, rail),
330
+ mark: {
331
+ position: 'absolute',
332
+ width: '2px',
333
+ height: '2px',
334
+ borderRadius: theme.methods.shape.radius.value(40, 'px')
335
+ },
336
+ orientation_horizontal: _objectSpread({}, horizontal),
337
+ orientation_vertical: _objectSpread({}, vertical),
338
+ labels: {
339
+ position: 'absolute',
340
+ whiteSpace: 'nowrap',
341
+ userSelect: 'none'
342
+ },
343
+ labels_orientation_horizontal: {
344
+ width: '100%',
345
+ left: '0',
346
+ top: '15px'
347
+ },
348
+ labels_orientation_vertical: {
349
+ height: '100%',
350
+ top: '0',
351
+ insetInlineStart: '21px'
352
+ },
353
+ label: {
354
+ position: 'absolute',
355
+ transition: theme.methods.transitions.make('color', {
356
+ duration: 'xs'
357
+ }),
358
+ color: theme.palette.text.default.secondary
359
+ },
360
+ label_orientation_horizontal: {
361
+ transform: 'translateX(-50%)'
362
+ },
363
+ label_orientation_horizontal_rtl: {
364
+ transform: 'translateX(50%)'
365
+ },
366
+ label_orientation_vertical: {
367
+ transform: 'translateY(50%)'
368
+ },
369
+ label_active: {
370
+ color: theme.palette.text.default.primary
371
+ },
372
+ focus_outline: {
373
+ outline: `1px solid ${theme.palette.text.default.secondary}`,
374
+ outlineOffset: '8px'
375
+ },
376
+ readOnly: {
377
+ cursor: 'default'
378
+ },
379
+ tooltip: {
380
+ '& .onesy-Tooltip-name': {
381
+ padding: '0',
382
+ lineHeight: '0',
383
+ minWidth: '30px',
384
+ paddingTop: '100%',
385
+ overflow: 'hidden',
386
+ borderRadius: `${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} 0px`,
387
+ transform: 'rotate(-45deg)',
388
+ '& .onesy-Tooltip-name-text': {
389
+ position: 'absolute',
390
+ top: '50%',
391
+ left: '50%',
392
+ transform: 'translate(-50%, -50%) rotate(45deg)'
513
393
  }
514
- }, [disabled, readOnly, onChange, value, mouseDownButton]);
515
- const moveItem = (forward_ = true) => {
516
- const forward = (orientation === 'vertical' || (theme.direction === 'ltr' && orientation === 'horizontal')) ? forward_ : !forward_;
517
- let valueNew = (0, utils_1.is)('array', refs.value.current) ? [...refs.value.current] : refs.value.current;
518
- let index = refs.focusButton.current || 0;
519
- let value__ = (0, utils_1.is)('array', valueNew) ? valueNew[index] : valueNew;
520
- // previous value
521
- let previous = (0, utils_1.clamp)(+(value__ - precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
522
- if (onlyMarks && (0, utils_1.is)('array', marks)) {
523
- const previousMark = marks.map(item => item.value).sort((a, b) => b - a).find(item => item < value__);
524
- previous = previousMark !== undefined ? previousMark : refs.min.current;
394
+ },
395
+ '&.onesy-Tooltip-position-left': {
396
+ '& .onesy-Tooltip-name': {
397
+ borderRadius: `${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} 0px ${theme.methods.shape.radius.value(40, 'px')}`
525
398
  }
526
- // next value
527
- let next = (0, utils_1.clamp)(+(value__ + precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
528
- if (onlyMarks && (0, utils_1.is)('array', marks)) {
529
- const nextMark = marks.map(item => item.value).sort((a, b) => a - b).find(item => item > value__);
530
- next = nextMark !== undefined ? nextMark : refs.max.current;
399
+ },
400
+ '&.onesy-Tooltip-position-right': {
401
+ '& .onesy-Tooltip-name': {
402
+ borderRadius: `0px ${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')} ${theme.methods.shape.radius.value(40, 'px')}`
531
403
  }
532
- value__ = forward ? next : previous;
533
- if ((0, utils_1.is)('array', refs.value.current)) {
534
- if (index > 0 && value__ < refs.value.current[index - 1]) {
535
- index -= 1;
536
- refs.focusButton.current = index;
537
- setFocusButton(index);
538
- refs.iconButtons.current[index].focus();
539
- }
540
- if (index < refs.value.current.length - 1 && value__ > refs.value.current[index + 1]) {
541
- index += 1;
542
- refs.focusButton.current = index;
543
- setFocusButton(index);
544
- refs.iconButtons.current[index].focus();
545
- }
546
- valueNew[index] = value__;
404
+ }
405
+ },
406
+ tooltip_switch_orientation_horizontal_ltr: {
407
+ '& .onesy-Tooltip-name': {
408
+ transform: 'rotate(135deg)',
409
+ '& .onesy-Tooltip-name-text': {
410
+ transform: 'translate(-50%, -50%) rotate(-135deg)'
547
411
  }
548
- else
549
- valueNew = value__;
550
- if (!(0, utils_1.equalDeep)(valueNew, refs.value.current)) {
551
- if (!props.hasOwnProperty('value'))
552
- setValue(valueNew);
553
- if ((0, utils_1.is)('function', onChange))
554
- onChange(valueNew);
412
+ }
413
+ },
414
+ tooltip_switch_orientation_horizontal_rtl: {
415
+ '& .onesy-Tooltip-name': {
416
+ transform: 'rotate(135deg)',
417
+ '& .onesy-Tooltip-name-text': {
418
+ transform: 'translate(-50%, -50%) rotate(-135deg)'
555
419
  }
420
+ }
421
+ },
422
+ tooltipLabelText: {
423
+ minWidth: '40px',
424
+ textAlign: 'center'
425
+ },
426
+ disabled: {
427
+ cursor: 'default',
428
+ pointerEvents: 'none',
429
+ opacity: theme.palette.visual_contrast.default.opacity.disabled
430
+ }
431
+ };
432
+ }, {
433
+ name: 'onesy-Slider'
434
+ });
435
+ const Slider = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
436
+ var _String$split$;
437
+ const theme = (0, _styleReact.useOnesyTheme)();
438
+ const props = _react.default.useMemo(() => {
439
+ var _theme$ui, _theme$ui2;
440
+ return _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesySlider) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
441
+ }, [props_]);
442
+ const IconButton = _react.default.useMemo(() => {
443
+ var _theme$elements;
444
+ return (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.IconButton) || _IconButton.default;
445
+ }, [theme]);
446
+ const Tooltip = _react.default.useMemo(() => {
447
+ var _theme$elements2;
448
+ return (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Tooltip) || _Tooltip.default;
449
+ }, [theme]);
450
+ const Zoom = _react.default.useMemo(() => {
451
+ var _theme$elements3;
452
+ return (theme === null || theme === void 0 || (_theme$elements3 = theme.elements) === null || _theme$elements3 === void 0 ? void 0 : _theme$elements3.Zoom) || _Zoom.default;
453
+ }, [theme]);
454
+ const Type = _react.default.useMemo(() => {
455
+ var _theme$elements4;
456
+ return (theme === null || theme === void 0 || (_theme$elements4 = theme.elements) === null || _theme$elements4 === void 0 ? void 0 : _theme$elements4.Type) || _Type.default;
457
+ }, [theme]);
458
+ const {
459
+ tonal = true,
460
+ color: color_ = 'primary',
461
+ size = 'regular',
462
+ value: value_,
463
+ valueDefault,
464
+ onChange,
465
+ orientation = 'horizontal',
466
+ marks,
467
+ precision = 0.001,
468
+ min = 0,
469
+ max = 100,
470
+ tooltip,
471
+ labels,
472
+ onlyMarks,
473
+ labelTooltipResolve,
474
+ iconButtonPositionResolve,
475
+ noTrack,
476
+ noButtons,
477
+ square,
478
+ inverted,
479
+ readOnly,
480
+ disabled,
481
+ icon,
482
+ onMouseDown: onMouseDown_,
483
+ onTouchStart: onTouchStart_,
484
+ IconButtonProps,
485
+ LabelProps,
486
+ TooltipProps,
487
+ Component = 'span',
488
+ style,
489
+ className,
490
+ children
491
+ } = props,
492
+ other = (0, _objectWithoutProperties2.default)(props, _excluded);
493
+ const {
494
+ classes
495
+ } = useStyle();
496
+ const [init, setInit] = _react.default.useState(false);
497
+ const [value, setValue] = _react.default.useState(() => {
498
+ const valueNew = (valueDefault !== undefined ? valueDefault : value_) || ((0, _utils.is)('number', min) ? min : 0);
499
+ return (0, _utils.is)('array', valueNew) ? valueNew.sort((a, b) => a - b).map(item => (0, _utils.clamp)(item, min, max)) : (0, _utils.clamp)(valueNew, min, max);
500
+ });
501
+ const [mouseDown, setMouseDown] = _react.default.useState(false);
502
+ const [mouseDownButton, setMouseDownButton] = _react.default.useState(false);
503
+ const [focus, setFocus] = _react.default.useState(false);
504
+ const [focusButton, setFocusButton] = _react.default.useState(false);
505
+ const refs = {
506
+ root: _react.default.useRef(undefined),
507
+ value: _react.default.useRef(undefined),
508
+ props: _react.default.useRef(undefined),
509
+ mouseDown: _react.default.useRef(undefined),
510
+ mouseDownButton: _react.default.useRef(undefined),
511
+ focusButton: _react.default.useRef(undefined),
512
+ direction: _react.default.useRef(undefined),
513
+ iconButtons: _react.default.useRef([]),
514
+ min: _react.default.useRef(min),
515
+ max: _react.default.useRef(max)
516
+ };
517
+ refs.value.current = value;
518
+ refs.props.current = props;
519
+ refs.mouseDown.current = mouseDown;
520
+ refs.mouseDownButton.current = mouseDownButton;
521
+ refs.focusButton.current = focusButton;
522
+ refs.direction.current = theme.direction;
523
+ refs.min.current = min;
524
+ refs.max.current = max;
525
+ let color = color_;
526
+ if (disabled) color = 'default';
527
+ const valueDecimals = (String(precision).includes('e-') ? +String(precision).split('e-')[1] : (_String$split$ = String(precision).split('.')[1]) === null || _String$split$ === void 0 ? void 0 : _String$split$.length) || 0;
528
+ const valuePrecision = (valueMouse, mouseDownButtonUpdate = false) => {
529
+ let value__ = (0, _utils.valueFromPercentageWithinRange)(valueMouse * 100, refs.min.current, refs.max.current);
530
+ if (refs.direction.current === 'rtl' && orientation === 'horizontal') value__ = refs.max.current + refs.min.current - value__;
531
+ if (value__ <= refs.min.current) return refs.min.current;
532
+ if (value__ >= refs.max.current) return refs.max.current;
533
+
534
+ // previous value
535
+ let previous = (0, _utils.clamp)(+(value__ - value__ % precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
536
+ if (value__ < 0) previous -= precision;
537
+ if (onlyMarks && (0, _utils.is)('array', marks)) {
538
+ const previousMark = marks.map(item => item.value).sort((a, b) => b - a).find(item => item <= value__);
539
+ previous = previousMark !== undefined ? previousMark : refs.min.current;
540
+ }
541
+
542
+ // next value
543
+ let next = (0, _utils.clamp)(+(previous + precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
544
+ if (onlyMarks && (0, _utils.is)('array', marks)) {
545
+ const nextMark = marks.map(item => item.value).sort((a, b) => a - b).find(item => item >= value__);
546
+ next = nextMark !== undefined ? nextMark : refs.max.current;
547
+ }
548
+ const valueNew = value__ < previous + (next - previous) / 2 ? previous : next;
549
+ if (mouseDownButtonUpdate && (0, _utils.is)('array', refs.value.current)) {
550
+ const items = refs.value.current.map(item => Math.abs(valueNew - item));
551
+ const minItem = Math.min(...items);
552
+ const index = items.findIndex(item => item === minItem);
553
+ setMouseDownButton(index);
554
+ refs.mouseDownButton.current = index;
555
+ }
556
+ return valueNew;
557
+ };
558
+ _react.default.useEffect(() => {
559
+ var _refs$root$current;
560
+ const onMouseUp = () => {
561
+ if (!disabled && !readOnly) {
562
+ setMouseDown(false);
563
+ setMouseDownButton(false);
564
+ }
556
565
  };
557
- const onKeyDown = react_1.default.useCallback((event) => {
558
- if (!disabled && !readOnly) {
559
- if (['Enter', 'Escape', 'ArrowUp', 'ArrowRight', 'ArrowDown', 'ArrowLeft', 'Home', 'End'].includes(event.key)) {
560
- // Prevent default
561
- event.preventDefault();
562
- let valueNew = refs.value.current;
563
- switch (event.key) {
564
- case 'End':
565
- if ((0, utils_1.is)('array', refs.value.current)) {
566
- valueNew = [...refs.value.current];
567
- valueNew[0] = refs.min.current;
568
- }
569
- else
570
- valueNew = refs.min.current;
571
- if (!props.hasOwnProperty('value'))
572
- setValue(valueNew);
573
- if ((0, utils_1.is)('function', onChange))
574
- return onChange(valueNew);
575
- return;
576
- case 'Home':
577
- if ((0, utils_1.is)('array', refs.value.current)) {
578
- valueNew = [...refs.value.current];
579
- valueNew[valueNew.length - 1] = refs.max.current;
580
- }
581
- else
582
- valueNew = refs.max.current;
583
- if (!props.hasOwnProperty('value'))
584
- setValue(valueNew);
585
- if ((0, utils_1.is)('function', onChange))
586
- return onChange(valueNew);
587
- return;
588
- case 'ArrowUp':
589
- case 'ArrowRight':
590
- return moveItem();
591
- case 'ArrowDown':
592
- case 'ArrowLeft':
593
- return moveItem(false);
594
- default:
595
- break;
596
- }
597
- }
566
+ const onMouseMove = event => {
567
+ if (!refs.props.current.disabled && !refs.props.current.readOnly && refs.mouseDown.current) {
568
+ let x;
569
+ let y;
570
+ if (event.clientX !== undefined) {
571
+ x = event.clientX;
572
+ y = event.clientY;
573
+ } else {
574
+ x = event.touches[0].clientX;
575
+ y = event.touches[0].clientY;
598
576
  }
599
- }, [disabled, readOnly, value, precision, focusButton]);
600
- const onFocus = react_1.default.useCallback(() => {
601
- if (!disabled && !readOnly && !mouseDown)
602
- setFocus(true);
603
- }, [disabled, readOnly, mouseDown]);
604
- const onBlur = react_1.default.useCallback(() => {
605
- if (!disabled && !readOnly)
606
- setFocus(false);
607
- }, [disabled, readOnly]);
608
- const onFocusButton = react_1.default.useCallback((index) => {
609
- if (!disabled && !readOnly)
610
- setFocusButton(index);
611
- }, [disabled, readOnly]);
612
- const onMouseDownButton = react_1.default.useCallback((event, index) => {
613
- if (!disabled && !readOnly)
577
+ const rect = refs.root.current.getBoundingClientRect();
578
+ const {
579
+ width,
580
+ height
581
+ } = rect;
582
+
583
+ // Value to the precision point value
584
+ const value__ = valuePrecision(orientation === 'horizontal' ? (x - rect.x) / width : 1 - (y - rect.y) / height);
585
+ const valueNew = (0, _utils.is)('array', refs.value.current) ? [...refs.value.current] : value__;
586
+ if ((0, _utils.is)('array', refs.value.current)) {
587
+ let index = (0, _utils.is)('number', refs.mouseDownButton.current) ? refs.mouseDownButton.current : 0;
588
+ if (index > 0 && value__ < refs.value.current[index - 1]) {
589
+ index -= 1;
614
590
  setMouseDownButton(index);
615
- }, [disabled, readOnly]);
616
- const onMouseDown = react_1.default.useCallback((event) => {
617
- var _a, _b, _c, _d;
618
- if (!disabled && !readOnly) {
619
- setMouseDown(true);
620
- const x = event.clientX ? event.clientX : (_b = (_a = event.touches) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.clientX;
621
- const y = event.clientY ? event.clientY : (_d = (_c = event.touches) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientY;
622
- move(x, y);
591
+ }
592
+ if (index < refs.value.current.length - 1 && value__ > refs.value.current[index + 1]) {
593
+ index += 1;
594
+ setMouseDownButton(index);
595
+ }
596
+ valueNew[index] = value__;
623
597
  }
624
- if ((0, utils_1.is)('function', onMouseDown_))
625
- onMouseDown_(event);
626
- }, [disabled, readOnly, onMouseDown_]);
627
- const onTouchStart = react_1.default.useCallback((event) => {
628
- var _a, _b, _c, _d;
629
- if (!disabled && !readOnly) {
630
- setMouseDown(true);
631
- const x = event.clientX ? event.clientX : (_b = (_a = event.touches) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.clientX;
632
- const y = event.clientY ? event.clientY : (_d = (_c = event.touches) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientY;
633
- move(x, y);
598
+ if (!(0, _utils.equalDeep)(valueNew, refs.value.current)) {
599
+ // Inner controlled value
600
+ if (!props.hasOwnProperty('value')) setValue(valueNew);
601
+ if ((0, _utils.is)('function', onChange)) onChange(valueNew);
634
602
  }
635
- if ((0, utils_1.is)('function', onMouseDown_))
636
- onMouseDown_(event);
637
- }, [disabled, readOnly, onTouchStart_]);
638
- const styles = {
639
- root: {},
640
- icon: {},
641
- iconButton: {},
642
- rail: {},
643
- track: {},
644
- markRail: {},
645
- markTrack: {},
646
- label: {},
647
- };
648
- const palette = !theme.palette.color[color] && theme.methods.color(color);
649
- if (!theme.palette.color[color] && color !== 'default') {
650
- styles.markRail.background = styles.rail.background = theme.methods.palette.color.value(undefined, theme.palette.light ? 40 : 90, true, palette);
651
- styles.label.background = styles.markTrack.background = styles.icon.background = styles.track.background = styles.iconButton.color = !tonal ? palette.main : theme.methods.palette.color.value(undefined, 40, true, palette);
652
- styles.label.color = theme.methods.palette.color.text(styles.label.background, true, 'light');
653
- }
654
- styles.label.background = !tonal ? ((palette === null || palette === void 0 ? void 0 : palette[40]) || (color === 'default' ? theme.palette.text.default.primary : theme.palette.color[color].main)) : theme.methods.palette.color.value(color, 40, true, palette);
655
- styles.label.color = theme.methods.palette.color.text(styles.label.background, true, 'light');
656
- const values = ((0, utils_1.is)('array', value) ? value : [value]);
657
- const valueValue = (value__ = values[0]) => {
658
- let valueNew = value__;
659
- if (value__ === refs.min.current)
660
- valueNew = 0;
661
- else if (value__ === refs.max.current)
662
- valueNew = 100;
663
- else
664
- valueNew = (0, utils_1.percentageFromValueWithinRange)(value__, refs.min.current, refs.max.current);
665
- return (0, utils_1.clamp)(valueNew, 0, 100);
666
- };
667
- const valueMark = (value__) => {
668
- if (value__ === refs.min.current)
669
- return 0;
670
- if (value__ === refs.max.current)
671
- return `calc(100% - 2px)`;
672
- return `calc(${valueValue(value__)}% - 1px)`;
603
+ }
673
604
  };
674
- const propInset = orientation === 'horizontal' ? 'insetInlineStart' : 'insetBlockEnd';
675
- const iconButtonStyles = (value__) => {
676
- const style_ = {};
677
- if ((0, utils_1.is)('function', iconButtonPositionResolve))
678
- style_[propInset] = iconButtonPositionResolve(value__, valueValue(value__), size);
679
- else {
680
- if (size === 'small') {
681
- style_[propInset] = `calc(${valueValue(value__)}% - 15px)`;
682
- }
683
- if (size === 'regular') {
684
- style_[propInset] = `calc(${valueValue(value__)}% - 20px)`;
685
- }
686
- if (size === 'large') {
687
- style_[propInset] = `calc(${valueValue(value__)}% - 25px)`;
688
- }
689
- }
690
- return style_;
605
+ const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current = refs.root.current) === null || _refs$root$current === void 0 ? void 0 : _refs$root$current.ownerDocument) || window.document : undefined;
606
+ rootDocument.addEventListener('mouseup', onMouseUp);
607
+ rootDocument.addEventListener('mousemove', onMouseMove);
608
+ rootDocument.addEventListener('touchend', onMouseUp, {
609
+ passive: true
610
+ });
611
+ rootDocument.addEventListener('touchmove', onMouseMove, {
612
+ passive: true
613
+ });
614
+ setInit(true);
615
+ return () => {
616
+ rootDocument.removeEventListener('mouseup', onMouseUp);
617
+ rootDocument.removeEventListener('touchend', onMouseUp);
618
+ rootDocument.removeEventListener('mousemove', onMouseMove);
619
+ rootDocument.removeEventListener('touchmove', onMouseMove);
691
620
  };
692
- const propTrac = orientation === 'horizontal' ? 'width' : 'height';
693
- if (values.length === 1)
694
- styles.track[propTrac] = `${valueValue()}%`;
695
- else {
696
- const start = Math.min(...values);
697
- const end = Math.max(...values);
698
- if (orientation === 'horizontal') {
699
- styles.track.insetInlineStart = `${valueValue(start)}%`;
700
- styles.track.insetInlineEnd = `${100 - valueValue(end)}%`;
621
+ }, []);
622
+ _react.default.useEffect(() => {
623
+ if (init && value_ !== value) setValue(value_);
624
+ }, [value_]);
625
+ const move = _react.default.useCallback((x, y) => {
626
+ if (!disabled && !readOnly) {
627
+ const rect = refs.root.current.getBoundingClientRect();
628
+ const {
629
+ width,
630
+ height
631
+ } = rect;
632
+
633
+ // Value to the precision point value
634
+ const value__ = valuePrecision(orientation === 'horizontal' ? (x - rect.x) / width : 1 - (y - rect.y) / height, true);
635
+ const valueNew = (0, _utils.is)('array', refs.value.current) ? [...refs.value.current] : value__;
636
+ if ((0, _utils.is)('array', refs.value.current)) {
637
+ let index = (0, _utils.is)('number', refs.mouseDownButton.current) ? refs.mouseDownButton.current : 0;
638
+ if (index > 0 && value__ <= refs.value.current[index - 1]) {
639
+ index -= 1;
640
+ setMouseDownButton(index);
701
641
  }
702
- if (orientation === 'vertical') {
703
- styles.track.insetBlockStart = `${100 - valueValue(end)}%`;
704
- styles.track.insetBlockEnd = `${valueValue(start)}%`;
642
+ if (index < refs.value.current.length - 1 && value__ >= refs.value.current[index + 1]) {
643
+ index += 1;
644
+ setMouseDownButton(index);
705
645
  }
646
+ valueNew[index] = value__;
647
+ }
648
+ if (!(0, _utils.equalDeep)(valueNew, refs.value.current)) {
649
+ // Inner controlled value
650
+ if (!props.hasOwnProperty('value')) setValue(valueNew);
651
+ if ((0, _utils.is)('function', onChange)) onChange(valueNew);
652
+ }
653
+ }
654
+ }, [disabled, readOnly, onChange, value, mouseDownButton]);
655
+ const moveItem = (forward_ = true) => {
656
+ const forward = orientation === 'vertical' || theme.direction === 'ltr' && orientation === 'horizontal' ? forward_ : !forward_;
657
+ let valueNew = (0, _utils.is)('array', refs.value.current) ? [...refs.value.current] : refs.value.current;
658
+ let index = refs.focusButton.current || 0;
659
+ let value__ = (0, _utils.is)('array', valueNew) ? valueNew[index] : valueNew;
660
+
661
+ // previous value
662
+ let previous = (0, _utils.clamp)(+(value__ - precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
663
+ if (onlyMarks && (0, _utils.is)('array', marks)) {
664
+ const previousMark = marks.map(item => item.value).sort((a, b) => b - a).find(item => item < value__);
665
+ previous = previousMark !== undefined ? previousMark : refs.min.current;
666
+ }
667
+
668
+ // next value
669
+ let next = (0, _utils.clamp)(+(value__ + precision).toFixed(valueDecimals), refs.min.current, refs.max.current);
670
+ if (onlyMarks && (0, _utils.is)('array', marks)) {
671
+ const nextMark = marks.map(item => item.value).sort((a, b) => a - b).find(item => item > value__);
672
+ next = nextMark !== undefined ? nextMark : refs.max.current;
706
673
  }
707
- const marksValue = Math.ceil((refs.max.current - refs.min.current) / precision);
708
- let marks_ = [];
709
- if (marks) {
710
- if ((0, utils_1.is)('array', marks))
711
- marks_ = marks;
712
- else if (marksValue <= 1e3) {
713
- let markSum = refs.min.current;
714
- let index = 1;
715
- marks_.push({ value: refs.min.current, label: refs.min.current });
716
- while (markSum <= refs.max.current) {
717
- markSum = refs.min.current + (precision * index++);
718
- if (markSum < refs.max.current)
719
- marks_.push({ value: markSum, label: markSum });
720
- }
721
- marks_.push({ value: refs.max.current, label: refs.max.current });
674
+ value__ = forward ? next : previous;
675
+ if ((0, _utils.is)('array', refs.value.current)) {
676
+ if (index > 0 && value__ < refs.value.current[index - 1]) {
677
+ index -= 1;
678
+ refs.focusButton.current = index;
679
+ setFocusButton(index);
680
+ refs.iconButtons.current[index].focus();
681
+ }
682
+ if (index < refs.value.current.length - 1 && value__ > refs.value.current[index + 1]) {
683
+ index += 1;
684
+ refs.focusButton.current = index;
685
+ setFocusButton(index);
686
+ refs.iconButtons.current[index].focus();
687
+ }
688
+ valueNew[index] = value__;
689
+ } else valueNew = value__;
690
+ if (!(0, _utils.equalDeep)(valueNew, refs.value.current)) {
691
+ if (!props.hasOwnProperty('value')) setValue(valueNew);
692
+ if ((0, _utils.is)('function', onChange)) onChange(valueNew);
693
+ }
694
+ };
695
+ const onKeyDown = _react.default.useCallback(event => {
696
+ if (!disabled && !readOnly) {
697
+ if (['Enter', 'Escape', 'ArrowUp', 'ArrowRight', 'ArrowDown', 'ArrowLeft', 'Home', 'End'].includes(event.key)) {
698
+ // Prevent default
699
+ event.preventDefault();
700
+ let valueNew = refs.value.current;
701
+ switch (event.key) {
702
+ case 'End':
703
+ if ((0, _utils.is)('array', refs.value.current)) {
704
+ valueNew = [...refs.value.current];
705
+ valueNew[0] = refs.min.current;
706
+ } else valueNew = refs.min.current;
707
+ if (!props.hasOwnProperty('value')) setValue(valueNew);
708
+ if ((0, _utils.is)('function', onChange)) return onChange(valueNew);
709
+ return;
710
+ case 'Home':
711
+ if ((0, _utils.is)('array', refs.value.current)) {
712
+ valueNew = [...refs.value.current];
713
+ valueNew[valueNew.length - 1] = refs.max.current;
714
+ } else valueNew = refs.max.current;
715
+ if (!props.hasOwnProperty('value')) setValue(valueNew);
716
+ if ((0, _utils.is)('function', onChange)) return onChange(valueNew);
717
+ return;
718
+ case 'ArrowUp':
719
+ case 'ArrowRight':
720
+ return moveItem();
721
+ case 'ArrowDown':
722
+ case 'ArrowLeft':
723
+ return moveItem(false);
724
+ default:
725
+ break;
722
726
  }
727
+ }
723
728
  }
724
- const markTrack = (value__) => {
725
- if (values.length === 1)
726
- return !inverted ? value__ <= values[0] : value__ > values[0];
727
- else
728
- return !inverted ? value__ >= values[0] && value__ <= values[values.length - 1] : value__ < values[0] || value__ > values[values.length - 1];
729
- };
730
- const labelMethod = (0, utils_1.is)('function', labelTooltipResolve) ? labelTooltipResolve : (value__) => +(value__).toFixed();
731
- return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ ref: item => {
732
- if (ref) {
733
- if ((0, utils_1.is)('function', ref))
734
- ref(item);
735
- else
736
- ref.current = item;
737
- }
738
- refs.root.current = item;
739
- }, tabIndex: noButtons ? 0 : -1, onFocus: onFocus, onBlur: onBlur, onTouchStart: onTouchStart, onMouseDown: onMouseDown, onKeyDown: onKeyDown, role: 'slider', "aria-orientation": orientation, "aria-valuenow": valueValue(), "aria-valuetext": `${valueValue()}%`, "aria-valuemin": min, "aria-valuemax": max, className: (0, style_react_1.classNames)([
740
- (0, utils_2.staticClassName)('Slider', theme) && [
741
- 'onesy-Slider-root',
742
- `onesy-Slider-size-${size}`,
743
- mouseDown && `onesy-Slider-mouse-down`,
744
- focus && `onesy-Slider-focus`,
745
- readOnly && `onesy-Slider-read-only`,
746
- disabled && `onesy-Slider-disabled`
747
- ],
748
- className,
749
- classes.root,
750
- classes[`color_${color}`],
751
- tonal && classes[`tonal_color_${color}`],
752
- classes[`root_orientation_${orientation}`],
753
- noButtons && focus && classes.focus_outline,
754
- square && classes.square,
755
- readOnly && classes.readOnly,
756
- disabled && classes.disabled
757
- ]), style: Object.assign(Object.assign({}, styles.root), style) }, other, { children: [(0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
758
- (0, utils_2.staticClassName)('Slider', theme) && [
759
- 'onesy-Slider-rail'
760
- ],
761
- classes.rail,
762
- classes[`orientation_${orientation}`],
763
- classes[`rail_orientation_${orientation}`],
764
- classes[`rail_orientation_${orientation}_size_${size}`],
765
- !inverted ? [
766
- classes[`rail_color_${color}`]
767
- ] : [
768
- classes[`track_color_${color}`],
769
- tonal && classes[`track_tonal_color_${color}`]
770
- ]
771
- ]), style: styles.rail }), !noTrack && ((0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
772
- (0, utils_2.staticClassName)('Slider', theme) && [
773
- 'onesy-Slider-track'
774
- ],
775
- classes.track,
776
- classes[`orientation_${orientation}`],
777
- classes[`track_orientation_${orientation}`],
778
- classes[`track_orientation_${orientation}_size_${size}`],
779
- !inverted ? [
780
- classes[`track_color_${color}`],
781
- tonal && classes[`track_tonal_color_${color}`]
782
- ] : [
783
- classes[`rail_color_${color}`]
784
- ]
785
- ]), style: styles.track })), !!marks_.length && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
786
- (0, utils_2.staticClassName)('Slider', theme) && [
787
- 'onesy-Slider-marks'
788
- ],
789
- classes.marks,
790
- classes[`orientation_${orientation}`],
791
- classes[`track_size_${size}`]
792
- ]) }, { children: marks_.map((item, index) => ((0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
793
- (0, utils_2.staticClassName)('Slider', theme) && [
794
- 'onesy-Slider-mark'
795
- ],
796
- classes.mark,
797
- markTrack(item.value) ? classes[`rail_color_${color}`] : [
798
- classes[`track_color_${color}`],
799
- tonal && classes[`track_tonal_color_${color}`]
800
- ]
801
- ]), style: Object.assign(Object.assign({}, (markTrack(item.value) ? styles.markRail : styles.markTrack)), { [propInset]: valueMark(item.value) }) }, index))) }))), labels && !!marks_.length && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
802
- (0, utils_2.staticClassName)('Slider', theme) && [
803
- 'onesy-Slider-labels'
804
- ],
805
- classes.labels,
806
- classes[`labels_orientation_${orientation}`]
807
- ]) }, { children: marks_.map((item, index) => ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: size === 'large' ? 'b1' : size === 'regular' ? 'b2' : 'b3' }, LabelProps, { className: (0, style_react_1.classNames)([
808
- (0, utils_2.staticClassName)('Slider', theme) && [
809
- 'onesy-Slider-label'
810
- ],
811
- LabelProps === null || LabelProps === void 0 ? void 0 : LabelProps.className,
812
- classes.label,
813
- classes[`label_orientation_${orientation}`],
814
- theme.direction === 'rtl' && classes[`label_orientation_${orientation}_rtl`],
815
- item.value <= value && classes.label_active
816
- ]), style: Object.assign({ [propInset]: valueMark(item.value) }, LabelProps === null || LabelProps === void 0 ? void 0 : LabelProps.style) }, { children: item.label }), index))) }))), !noButtons && values.map((value__, index) => {
817
- var _a, _b;
818
- const classNameIcon = (0, style_react_1.classNames)([
819
- (0, utils_2.staticClassName)('Slider', theme) && [
820
- 'onesy-Slider-icon'
821
- ],
822
- classes.icon,
823
- classes[`track_color_${color}`],
824
- tonal && classes[`track_tonal_color_${color}`],
825
- classes[`icon_size_${size}`],
826
- (mouseDownButton === index) && classes.iconActive
827
- ]);
828
- return ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ className: (0, style_react_1.classNames)([
829
- classes.tooltip,
830
- classes[`tooltip_orientation_${orientation}`]
831
- ]), classNameSwitch: classes[`tooltip_switch_orientation_${orientation}_${theme.direction}`] }, ((tooltip === 'always') || (tooltip !== undefined && mouseDownButton === index) ? { open: true } : tooltip === undefined ? { open: false } : {}), { label: labelMethod(value__), position: orientation === 'horizontal' ? 'top' : theme.direction === 'ltr' ? 'left' : 'right', alignment: 'center', TransitionComponent: Zoom, transformOrigin: orientation === 'horizontal' ? 'center bottom' : 'center right', transformOriginSwitch: orientation === 'horizontal' ? 'center top' : 'center left', transformOriginRtl: orientation === 'horizontal' ? 'center bottom' : 'center left', transformOriginRtlSwitch: orientation === 'horizontal' ? 'center top' : 'center right', noMargin: true, LabelProps: {
832
- style: styles.label
833
- }, LabelTextProps: {
834
- className: classes.tooltipLabelText
835
- } }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ ref: item => refs.iconButtons.current.push(item), size: size, tonal: tonal, color: color, onBlur: onBlur, onFocus: () => {
836
- onFocus();
837
- onFocusButton(index);
838
- }, onMouseDown: (event) => onMouseDownButton(event, index), "aria-valuenow": valueValue(value__), "aria-valuetext": `${valueValue(value__)}%`, "aria-valuemin": min, "aria-valuemax": max }, IconButtonProps, { className: (0, style_react_1.classNames)([
839
- (0, utils_2.staticClassName)('Slider', theme) && [
840
- 'onesy-Slider-icon-button'
841
- ],
842
- IconButtonProps === null || IconButtonProps === void 0 ? void 0 : IconButtonProps.className,
843
- classes.iconButton,
844
- classes[`orientation_${orientation}`],
845
- !tonal && classes[`iconButton_color_${color}`],
846
- tonal && classes[`iconButton_tonal_color_${color}`],
847
- ]), style: Object.assign(Object.assign({}, iconButtonStyles(value__)), IconButtonProps === null || IconButtonProps === void 0 ? void 0 : IconButtonProps.style) }, { children: icon ? react_1.default.cloneElement(icon, {
848
- className: (0, style_react_1.classNames)([
849
- (_a = icon === null || icon === void 0 ? void 0 : icon.props) === null || _a === void 0 ? void 0 : _a.className,
850
- classNameIcon
851
- ]),
852
- style: Object.assign(Object.assign({}, styles.icon), (_b = icon === null || icon === void 0 ? void 0 : icon.props) === null || _b === void 0 ? void 0 : _b.style)
853
- }) : ((0, jsx_runtime_1.jsx)("span", { className: classNameIcon, style: styles.icon })) })) }), index));
854
- })] })));
729
+ }, [disabled, readOnly, value, precision, focusButton]);
730
+ const onFocus = _react.default.useCallback(() => {
731
+ if (!disabled && !readOnly && !mouseDown) setFocus(true);
732
+ }, [disabled, readOnly, mouseDown]);
733
+ const onBlur = _react.default.useCallback(() => {
734
+ if (!disabled && !readOnly) setFocus(false);
735
+ }, [disabled, readOnly]);
736
+ const onFocusButton = _react.default.useCallback(index => {
737
+ if (!disabled && !readOnly) setFocusButton(index);
738
+ }, [disabled, readOnly]);
739
+ const onMouseDownButton = _react.default.useCallback((event, index) => {
740
+ if (!disabled && !readOnly) setMouseDownButton(index);
741
+ }, [disabled, readOnly]);
742
+ const onMouseDown = _react.default.useCallback(event => {
743
+ if (!disabled && !readOnly) {
744
+ var _touches, _touches2;
745
+ setMouseDown(true);
746
+ const x = event.clientX ? event.clientX : (_touches = event.touches) === null || _touches === void 0 || (_touches = _touches[0]) === null || _touches === void 0 ? void 0 : _touches.clientX;
747
+ const y = event.clientY ? event.clientY : (_touches2 = event.touches) === null || _touches2 === void 0 || (_touches2 = _touches2[0]) === null || _touches2 === void 0 ? void 0 : _touches2.clientY;
748
+ move(x, y);
749
+ }
750
+ if ((0, _utils.is)('function', onMouseDown_)) onMouseDown_(event);
751
+ }, [disabled, readOnly, onMouseDown_]);
752
+ const onTouchStart = _react.default.useCallback(event => {
753
+ if (!disabled && !readOnly) {
754
+ var _touches3, _touches4;
755
+ setMouseDown(true);
756
+ const x = event.clientX ? event.clientX : (_touches3 = event.touches) === null || _touches3 === void 0 || (_touches3 = _touches3[0]) === null || _touches3 === void 0 ? void 0 : _touches3.clientX;
757
+ const y = event.clientY ? event.clientY : (_touches4 = event.touches) === null || _touches4 === void 0 || (_touches4 = _touches4[0]) === null || _touches4 === void 0 ? void 0 : _touches4.clientY;
758
+ move(x, y);
759
+ }
760
+ if ((0, _utils.is)('function', onMouseDown_)) onMouseDown_(event);
761
+ }, [disabled, readOnly, onTouchStart_]);
762
+ const styles = {
763
+ root: {},
764
+ icon: {},
765
+ iconButton: {},
766
+ rail: {},
767
+ track: {},
768
+ markRail: {},
769
+ markTrack: {},
770
+ label: {}
771
+ };
772
+ const palette = !theme.palette.color[color] && theme.methods.color(color);
773
+ if (!theme.palette.color[color] && color !== 'default') {
774
+ styles.markRail.background = styles.rail.background = theme.methods.palette.color.value(undefined, theme.palette.light ? 40 : 90, true, palette);
775
+ styles.label.background = styles.markTrack.background = styles.icon.background = styles.track.background = styles.iconButton.color = !tonal ? palette.main : theme.methods.palette.color.value(undefined, 40, true, palette);
776
+ styles.label.color = theme.methods.palette.color.text(styles.label.background, true, 'light');
777
+ }
778
+ styles.label.background = !tonal ? (palette === null || palette === void 0 ? void 0 : palette[40]) || (color === 'default' ? theme.palette.text.default.primary : theme.palette.color[color].main) : theme.methods.palette.color.value(color, 40, true, palette);
779
+ styles.label.color = theme.methods.palette.color.text(styles.label.background, true, 'light');
780
+ const values = (0, _utils.is)('array', value) ? value : [value];
781
+ const valueValue = (value__ = values[0]) => {
782
+ let valueNew = value__;
783
+ if (value__ === refs.min.current) valueNew = 0;else if (value__ === refs.max.current) valueNew = 100;else valueNew = (0, _utils.percentageFromValueWithinRange)(value__, refs.min.current, refs.max.current);
784
+ return (0, _utils.clamp)(valueNew, 0, 100);
785
+ };
786
+ const valueMark = value__ => {
787
+ if (value__ === refs.min.current) return 0;
788
+ if (value__ === refs.max.current) return `calc(100% - 2px)`;
789
+ return `calc(${valueValue(value__)}% - 1px)`;
790
+ };
791
+ const propInset = orientation === 'horizontal' ? 'insetInlineStart' : 'insetBlockEnd';
792
+ const iconButtonStyles = value__ => {
793
+ const style_ = {};
794
+ if ((0, _utils.is)('function', iconButtonPositionResolve)) style_[propInset] = iconButtonPositionResolve(value__, valueValue(value__), size);else {
795
+ if (size === 'small') {
796
+ style_[propInset] = `calc(${valueValue(value__)}% - 15px)`;
797
+ }
798
+ if (size === 'regular') {
799
+ style_[propInset] = `calc(${valueValue(value__)}% - 20px)`;
800
+ }
801
+ if (size === 'large') {
802
+ style_[propInset] = `calc(${valueValue(value__)}% - 25px)`;
803
+ }
804
+ }
805
+ return style_;
806
+ };
807
+ const propTrac = orientation === 'horizontal' ? 'width' : 'height';
808
+ if (values.length === 1) styles.track[propTrac] = `${valueValue()}%`;else {
809
+ const start = Math.min(...values);
810
+ const end = Math.max(...values);
811
+ if (orientation === 'horizontal') {
812
+ styles.track.insetInlineStart = `${valueValue(start)}%`;
813
+ styles.track.insetInlineEnd = `${100 - valueValue(end)}%`;
814
+ }
815
+ if (orientation === 'vertical') {
816
+ styles.track.insetBlockStart = `${100 - valueValue(end)}%`;
817
+ styles.track.insetBlockEnd = `${valueValue(start)}%`;
818
+ }
819
+ }
820
+ const marksValue = Math.ceil((refs.max.current - refs.min.current) / precision);
821
+ let marks_ = [];
822
+ if (marks) {
823
+ if ((0, _utils.is)('array', marks)) marks_ = marks;else if (marksValue <= 1e3) {
824
+ let markSum = refs.min.current;
825
+ let index = 1;
826
+ marks_.push({
827
+ value: refs.min.current,
828
+ label: refs.min.current
829
+ });
830
+ while (markSum <= refs.max.current) {
831
+ markSum = refs.min.current + precision * index++;
832
+ if (markSum < refs.max.current) marks_.push({
833
+ value: markSum,
834
+ label: markSum
835
+ });
836
+ }
837
+ marks_.push({
838
+ value: refs.max.current,
839
+ label: refs.max.current
840
+ });
841
+ }
842
+ }
843
+ const markTrack = value__ => {
844
+ if (values.length === 1) return !inverted ? value__ <= values[0] : value__ > values[0];else return !inverted ? value__ >= values[0] && value__ <= values[values.length - 1] : value__ < values[0] || value__ > values[values.length - 1];
845
+ };
846
+ const labelMethod = (0, _utils.is)('function', labelTooltipResolve) ? labelTooltipResolve : value__ => +value__.toFixed();
847
+ return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
848
+ ref: item => {
849
+ if (ref) {
850
+ if ((0, _utils.is)('function', ref)) ref(item);else ref.current = item;
851
+ }
852
+ refs.root.current = item;
853
+ },
854
+ tabIndex: noButtons ? 0 : -1,
855
+ onFocus: onFocus,
856
+ onBlur: onBlur,
857
+ onTouchStart: onTouchStart,
858
+ onMouseDown: onMouseDown,
859
+ onKeyDown: onKeyDown,
860
+ role: "slider",
861
+ "aria-orientation": orientation,
862
+ "aria-valuenow": valueValue(),
863
+ "aria-valuetext": `${valueValue()}%`,
864
+ "aria-valuemin": min,
865
+ "aria-valuemax": max,
866
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-root', `onesy-Slider-size-${size}`, mouseDown && `onesy-Slider-mouse-down`, focus && `onesy-Slider-focus`, readOnly && `onesy-Slider-read-only`, disabled && `onesy-Slider-disabled`], className, classes.root, classes[`color_${color}`], tonal && classes[`tonal_color_${color}`], classes[`root_orientation_${orientation}`], noButtons && focus && classes.focus_outline, square && classes.square, readOnly && classes.readOnly, disabled && classes.disabled]),
867
+ style: _objectSpread(_objectSpread({}, styles.root), style)
868
+ }, other), /*#__PURE__*/_react.default.createElement("span", {
869
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-rail'], classes.rail, classes[`orientation_${orientation}`], classes[`rail_orientation_${orientation}`], classes[`rail_orientation_${orientation}_size_${size}`], !inverted ? [classes[`rail_color_${color}`]] : [classes[`track_color_${color}`], tonal && classes[`track_tonal_color_${color}`]]]),
870
+ style: styles.rail
871
+ }), !noTrack && /*#__PURE__*/_react.default.createElement("span", {
872
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-track'], classes.track, classes[`orientation_${orientation}`], classes[`track_orientation_${orientation}`], classes[`track_orientation_${orientation}_size_${size}`], !inverted ? [classes[`track_color_${color}`], tonal && classes[`track_tonal_color_${color}`]] : [classes[`rail_color_${color}`]]]),
873
+ style: styles.track
874
+ }), !!marks_.length && /*#__PURE__*/_react.default.createElement("span", {
875
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-marks'], classes.marks, classes[`orientation_${orientation}`], classes[`track_size_${size}`]])
876
+ }, marks_.map((item, index) => /*#__PURE__*/_react.default.createElement("span", {
877
+ key: index,
878
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-mark'], classes.mark, markTrack(item.value) ? classes[`rail_color_${color}`] : [classes[`track_color_${color}`], tonal && classes[`track_tonal_color_${color}`]]]),
879
+ style: _objectSpread(_objectSpread({}, markTrack(item.value) ? styles.markRail : styles.markTrack), {}, {
880
+ [propInset]: valueMark(item.value)
881
+ })
882
+ }))), labels && !!marks_.length && /*#__PURE__*/_react.default.createElement("span", {
883
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-labels'], classes.labels, classes[`labels_orientation_${orientation}`]])
884
+ }, marks_.map((item, index) => /*#__PURE__*/_react.default.createElement(Type, (0, _extends2.default)({
885
+ key: index,
886
+ version: size === 'large' ? 'b1' : size === 'regular' ? 'b2' : 'b3'
887
+ }, LabelProps, {
888
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-label'], LabelProps === null || LabelProps === void 0 ? void 0 : LabelProps.className, classes.label, classes[`label_orientation_${orientation}`], theme.direction === 'rtl' && classes[`label_orientation_${orientation}_rtl`], item.value <= value && classes.label_active]),
889
+ style: _objectSpread({
890
+ [propInset]: valueMark(item.value)
891
+ }, LabelProps === null || LabelProps === void 0 ? void 0 : LabelProps.style)
892
+ }), item.label))), !noButtons && values.map((value__, index) => {
893
+ var _icon$props, _icon$props2;
894
+ const classNameIcon = (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-icon'], classes.icon, classes[`track_color_${color}`], tonal && classes[`track_tonal_color_${color}`], classes[`icon_size_${size}`], mouseDownButton === index && classes.iconActive]);
895
+ return /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
896
+ key: index,
897
+ className: (0, _styleReact.classNames)([classes.tooltip, classes[`tooltip_orientation_${orientation}`]]),
898
+ classNameSwitch: classes[`tooltip_switch_orientation_${orientation}_${theme.direction}`]
899
+ }, tooltip === 'always' || tooltip !== undefined && mouseDownButton === index ? {
900
+ open: true
901
+ } : tooltip === undefined ? {
902
+ open: false
903
+ } : {}, {
904
+ label: labelMethod(value__),
905
+ position: orientation === 'horizontal' ? 'top' : theme.direction === 'ltr' ? 'left' : 'right',
906
+ alignment: "center",
907
+ TransitionComponent: Zoom,
908
+ transformOrigin: orientation === 'horizontal' ? 'center bottom' : 'center right',
909
+ transformOriginSwitch: orientation === 'horizontal' ? 'center top' : 'center left',
910
+ transformOriginRtl: orientation === 'horizontal' ? 'center bottom' : 'center left',
911
+ transformOriginRtlSwitch: orientation === 'horizontal' ? 'center top' : 'center right',
912
+ noMargin: true,
913
+ LabelProps: {
914
+ style: styles.label
915
+ },
916
+ LabelTextProps: {
917
+ className: classes.tooltipLabelText
918
+ }
919
+ }, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
920
+ ref: item => refs.iconButtons.current.push(item),
921
+ size: size,
922
+ tonal: tonal,
923
+ color: color,
924
+ onBlur: onBlur,
925
+ onFocus: () => {
926
+ onFocus();
927
+ onFocusButton(index);
928
+ },
929
+ onMouseDown: event => onMouseDownButton(event, index),
930
+ "aria-valuenow": valueValue(value__),
931
+ "aria-valuetext": `${valueValue(value__)}%`,
932
+ "aria-valuemin": min,
933
+ "aria-valuemax": max
934
+ }, IconButtonProps, {
935
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Slider', theme) && ['onesy-Slider-icon-button'], IconButtonProps === null || IconButtonProps === void 0 ? void 0 : IconButtonProps.className, classes.iconButton, classes[`orientation_${orientation}`], !tonal && classes[`iconButton_color_${color}`], tonal && classes[`iconButton_tonal_color_${color}`]]),
936
+ style: _objectSpread(_objectSpread({}, iconButtonStyles(value__)), IconButtonProps === null || IconButtonProps === void 0 ? void 0 : IconButtonProps.style)
937
+ }), icon ? /*#__PURE__*/_react.default.cloneElement(icon, {
938
+ className: (0, _styleReact.classNames)([icon === null || icon === void 0 || (_icon$props = icon.props) === null || _icon$props === void 0 ? void 0 : _icon$props.className, classNameIcon]),
939
+ style: _objectSpread(_objectSpread({}, styles.icon), icon === null || icon === void 0 || (_icon$props2 = icon.props) === null || _icon$props2 === void 0 ? void 0 : _icon$props2.style)
940
+ }) : /*#__PURE__*/_react.default.createElement("span", {
941
+ className: classNameIcon,
942
+ style: styles.icon
943
+ })));
944
+ }));
855
945
  });
856
946
  Slider.displayName = 'onesy-Slider';
857
- exports.default = Slider;
947
+ var _default = exports.default = Slider;