@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/Chart/Chart.js CHANGED
@@ -1,1191 +1,1342 @@
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]];
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 _Surface = _interopRequireDefault(require("../Surface"));
15
+ var _Line = _interopRequireDefault(require("../Line"));
16
+ var _Type = _interopRequireDefault(require("../Type"));
17
+ var _Path = _interopRequireDefault(require("../Path"));
18
+ var _Append = _interopRequireDefault(require("../Append"));
19
+ var _Grow = _interopRequireDefault(require("../Grow"));
20
+ var _useMediaQuery = _interopRequireDefault(require("../useMediaQuery"));
21
+ var _utils2 = require("../utils");
22
+ const _excluded = ["tonal", "color", "title", "subtitle", "values", "pre", "elements", "names", "nameX", "nameY", "tooltip", "tooltipIndividually", "tooltipCloseOnMouseLeave", "elementTooltip", "guidelines", "guidelinesAppend", "guidelinesDisplayInactive", "additionalLines", "legend", "legendManageVisibility", "legendPosition", "animate", "animateTimeout", "labels", "labelsX", "labelsY", "labelDecimalPlaces", "labelsAutoNumber", "labelsYAutoNumber", "labelsXAutoNumber", "marks", "marksX", "marksY", "marksAutoNumber", "marksYAutoNumber", "marksXAutoNumber", "grid", "gridX", "gridY", "gridAutoNumber", "gridYAutoNumber", "gridXAutoNumber", "points", "pointsVisibility", "borders", "borderStart", "borderLeft", "borderEnd", "borderRight", "borderTop", "borderBottom", "minX", "maxX", "minY", "maxY", "minMaxPadding", "minPadding", "maxPadding", "minPaddingX", "minPaddingY", "maxPaddingX", "maxPaddingY", "noMain", "tooltipRender", "tooltipGroupRender", "labelRender", "labelResolve", "onUpdateRects", "Component", "SvgProps", "TypeProps", "TitleProps", "SubtitleProps", "PointsProps", "PointProps", "HeaderProps", "AppendProps", "AdditionalLineProps", "AdditionalLinesProps", "LegendProps", "LegendItemProps", "GuidelineProps", "WrapperProps", "className", "children"],
23
+ _excluded2 = ["item", "className"];
24
+ 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; }
25
+ 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; }
26
+ const useStyle = (0, _styleReact.style)(theme => ({
27
+ root: {
28
+ width: '100%',
29
+ '&.onesy-Surface-root': {
30
+ background: 'transparent'
31
+ }
32
+ },
33
+ additionalLines: {
34
+ pointerEvents: 'none'
35
+ },
36
+ append_wrapper: {
37
+ userSelect: 'none',
38
+ pointerEvents: 'none',
39
+ zIndex: theme.z_index.tooltip
40
+ },
41
+ wrapper: {
42
+ position: 'relative',
43
+ height: '400px',
44
+ width: '100%',
45
+ maxWidth: '1000px'
46
+ },
47
+ wrapper_label_x: {
48
+ margin: '0 0 30px 0'
49
+ },
50
+ wrapper_label_y: {
51
+ margin: '0 0 0 40px'
52
+ },
53
+ wrapper_labels: {
54
+ margin: '0 0 30px 40px'
55
+ },
56
+ wrapper_name_x: {
57
+ margin: '0 0 60px 0'
58
+ },
59
+ wrapper_name_y: {
60
+ margin: '0 0 0 70px'
61
+ },
62
+ wrapper_names: {
63
+ margin: '0 0 60px 70px'
64
+ },
65
+ legend_offset_labels_y: {
66
+ paddingLeft: theme.methods.space.value(5, 'px')
67
+ },
68
+ legend_offset_names_y: {
69
+ paddingLeft: theme.methods.space.value(9, 'px')
70
+ },
71
+ svg: {
72
+ position: 'relative',
73
+ touchAction: 'none',
74
+ userSelect: 'none',
75
+ '& path, & circle, & rect, & g': {
76
+ transition: theme.methods.transitions.make('opacity', {
77
+ duration: 'xs'
78
+ })
79
+ }
80
+ },
81
+ header: {
82
+ width: '100%',
83
+ marginBottom: '24px'
84
+ },
85
+ subtitle: {
86
+ opacity: '0.74'
87
+ },
88
+ append: {
89
+ padding: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2.5, 'px')}`,
90
+ borderRadius: theme.methods.shape.radius.value(1.5, 'px')
91
+ },
92
+ name: {
93
+ position: 'absolute',
94
+ userSelect: 'none'
95
+ },
96
+ name_x: {
97
+ bottom: '-61px',
98
+ left: '50%',
99
+ transform: 'translateX(-50%)'
100
+ },
101
+ name_y: {
102
+ left: '-87px',
103
+ top: '50%',
104
+ transform: 'translateY(-50%) rotate(-90deg)'
105
+ },
106
+ labels: {
107
+ position: 'absolute',
108
+ userSelect: 'none'
109
+ },
110
+ labels_x: {
111
+ top: 'calc(100% + 12px)',
112
+ left: '0',
113
+ width: '100%'
114
+ },
115
+ labels_y: {
116
+ top: '0',
117
+ right: 'calc(100% + 12px)',
118
+ height: '100%'
119
+ },
120
+ label: {
121
+ position: 'absolute',
122
+ whiteSpace: 'nowrap'
123
+ },
124
+ label_x: {
125
+ transform: 'translateX(-50%)',
126
+ top: '0'
127
+ },
128
+ label_y: {
129
+ transform: 'translateY(50%)',
130
+ right: '0'
131
+ },
132
+ marks: {
133
+ position: 'absolute'
134
+ },
135
+ marks_x: {
136
+ top: 'calc(100% + 0px)',
137
+ left: '0',
138
+ width: '100%'
139
+ },
140
+ marks_y: {
141
+ top: '0',
142
+ right: 'calc(100% + 0px)',
143
+ height: '100%'
144
+ },
145
+ mark: {
146
+ position: 'absolute'
147
+ },
148
+ mark_x: {
149
+ width: '1px',
150
+ height: '7px',
151
+ top: '0',
152
+ background: 'currentColor'
153
+ },
154
+ mark_y: {
155
+ width: '7px',
156
+ height: '1px',
157
+ right: '0',
158
+ background: 'currentColor'
159
+ },
160
+ grids: {
161
+ position: 'absolute',
162
+ width: '100%',
163
+ height: '100%'
164
+ },
165
+ grids_x: {
166
+ top: '0',
167
+ left: '0'
168
+ },
169
+ grids_y: {
170
+ top: '0',
171
+ left: '0'
172
+ },
173
+ grid: {
174
+ position: 'absolute',
175
+ width: '100%',
176
+ height: '100%',
177
+ opacity: theme.palette.light ? '0.07' : '0.14'
178
+ },
179
+ grid_x: {
180
+ width: '1px',
181
+ background: 'currentColor'
182
+ },
183
+ grid_y: {
184
+ height: '1px',
185
+ background: 'currentColor'
186
+ },
187
+ border: {
188
+ position: 'absolute',
189
+ background: 'currentColor'
190
+ },
191
+ borderX: {
192
+ height: '1px',
193
+ width: 'calc(100% + 1px)',
194
+ left: '0'
195
+ },
196
+ borderTop: {
197
+ top: '0'
198
+ },
199
+ borderBottom: {
200
+ bottom: '0'
201
+ },
202
+ borderY: {
203
+ width: '1px',
204
+ height: 'calc(100% + 1px)',
205
+ top: '-1px'
206
+ },
207
+ borderStart: {
208
+ insetInlineStart: '0'
209
+ },
210
+ borderLeft: {
211
+ left: '0'
212
+ },
213
+ borderEnd: {
214
+ insetInlineEnd: '0'
215
+ },
216
+ borderRight: {
217
+ right: '0'
218
+ },
219
+ point_visibility_hover: {
220
+ opacity: '0',
221
+ transition: theme.methods.transitions.make('opacity', {
222
+ duration: 'xxs'
223
+ }),
224
+ '&:hover': {
225
+ opacity: '1'
226
+ }
227
+ },
228
+ point_visibility_visible: {
229
+ opacity: '1'
230
+ },
231
+ point_active: {
232
+ opacity: '1'
233
+ },
234
+ point_visibility_hidden: {
235
+ opacity: '0',
236
+ pointerEvents: 'none'
237
+ },
238
+ // Legend
239
+ legend: {},
240
+ legend_position_top: {
241
+ marginBottom: '16px'
242
+ },
243
+ legend_position_bottom: {
244
+ marginTop: '16px'
245
+ },
246
+ legend_item: {
247
+ userSelect: 'none'
248
+ },
249
+ legend_item_manage_visibility: {
250
+ cursor: 'pointer',
251
+ transition: theme.methods.transitions.make('opacity', {
252
+ duration: 'xs'
253
+ })
254
+ },
255
+ legend_item_hidden: {
256
+ opacity: '0.4'
257
+ },
258
+ legend_icon: {
259
+ width: '10px',
260
+ height: '10px',
261
+ borderRadius: theme.methods.shape.radius.value(40, 'px'),
262
+ boxSizing: 'border-box'
263
+ },
264
+ append_icon: {
265
+ width: '8px',
266
+ height: '8px',
267
+ borderRadius: theme.methods.shape.radius.value(40, 'px'),
268
+ boxSizing: 'border-box'
269
+ },
270
+ // Guideline
271
+ guidelines: {
272
+ stroke: 'currentColor',
273
+ strokeDasharray: '4',
274
+ opacity: '0.44',
275
+ pointerEvents: 'none'
276
+ }
277
+ }), {
278
+ name: 'onesy-Chart'
279
+ });
280
+ const Chart = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
281
+ var _append$values, _append$values2, _append$values3, _append$values4;
282
+ const theme = (0, _styleReact.useOnesyTheme)();
283
+ const l = theme.l;
284
+ const props = _react.default.useMemo(() => {
285
+ var _theme$ui, _theme$ui2;
286
+ 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.onesyChart) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
287
+ }, [props_]);
288
+ const Line = _react.default.useMemo(() => {
289
+ var _theme$elements;
290
+ return (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
291
+ }, [theme]);
292
+ const Surface = _react.default.useMemo(() => {
293
+ var _theme$elements2;
294
+ return (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Surface) || _Surface.default;
295
+ }, [theme]);
296
+ const Type = _react.default.useMemo(() => {
297
+ var _theme$elements3;
298
+ return (theme === null || theme === void 0 || (_theme$elements3 = theme.elements) === null || _theme$elements3 === void 0 ? void 0 : _theme$elements3.Type) || _Type.default;
299
+ }, [theme]);
300
+ const Path = _react.default.useMemo(() => {
301
+ var _theme$elements4;
302
+ return (theme === null || theme === void 0 || (_theme$elements4 = theme.elements) === null || _theme$elements4 === void 0 ? void 0 : _theme$elements4.Path) || _Path.default;
303
+ }, [theme]);
304
+ const Append = _react.default.useMemo(() => {
305
+ var _theme$elements5;
306
+ return (theme === null || theme === void 0 || (_theme$elements5 = theme.elements) === null || _theme$elements5 === void 0 ? void 0 : _theme$elements5.Append) || _Append.default;
307
+ }, [theme]);
308
+ const Grow = _react.default.useMemo(() => {
309
+ var _theme$elements6;
310
+ return (theme === null || theme === void 0 || (_theme$elements6 = theme.elements) === null || _theme$elements6 === void 0 ? void 0 : _theme$elements6.Grow) || _Grow.default;
311
+ }, [theme]);
312
+ const {
313
+ tonal = true,
314
+ color = 'primary',
315
+ title,
316
+ subtitle,
317
+ // Values
318
+ values,
319
+ // Pre
320
+ pre,
321
+ // Elements
322
+ elements,
323
+ // Names
324
+ names,
325
+ nameX: nameX_,
326
+ nameY: nameY_,
327
+ // Tooltip
328
+ tooltip: tooltip_,
329
+ tooltipIndividually: tooltipIndividually_,
330
+ tooltipCloseOnMouseLeave: tooltipCloseOnMouseLeave_,
331
+ elementTooltip: elementTooltip_,
332
+ // Guideline
333
+ guidelines: guidelines_,
334
+ guidelinesAppend: guidelinesAppend_,
335
+ guidelinesDisplayInactive: guidelinesDisplayInactive_,
336
+ // Additional lines
337
+ additionalLines: additionalLines__,
338
+ // Legend
339
+ legend: legend___,
340
+ legendManageVisibility = true,
341
+ legendPosition = 'bottom',
342
+ // Animation
343
+ animate: animate_,
344
+ animateTimeout: animateTimeout_,
345
+ // Labels
346
+ labels: labels___,
347
+ labelsX: labelsX_,
348
+ labelsY: labelsY_,
349
+ labelDecimalPlaces: labelDecimalPlaces_,
350
+ labelsAutoNumber: labelsAutoNumber_,
351
+ labelsYAutoNumber: labelsYAutoNumber_,
352
+ labelsXAutoNumber: labelsXAutoNumber_,
353
+ // Marks
354
+ marks: marks___,
355
+ marksX: marksX_,
356
+ marksY: marksY_,
357
+ marksAutoNumber: marksAutoNumber_,
358
+ marksYAutoNumber: marksYAutoNumber_,
359
+ marksXAutoNumber: marksXAutoNumber_,
360
+ // Grid
361
+ grid: grid___,
362
+ gridX: gridX_,
363
+ gridY: gridY_,
364
+ gridAutoNumber: gridAutoNumber_,
365
+ gridYAutoNumber: gridYAutoNumber_,
366
+ gridXAutoNumber: gridXAutoNumber_,
367
+ // Points
368
+ points: points___,
369
+ pointsVisibility: pointsVisibility_,
370
+ // Borders
371
+ borders: borders_ = true,
372
+ borderStart: borderStart_ = false,
373
+ borderLeft: borderLeft_ = true,
374
+ borderEnd: borderEnd_ = false,
375
+ borderRight: borderRight_ = false,
376
+ borderTop: borderTop_ = false,
377
+ borderBottom: borderBottom_ = true,
378
+ // Min, max
379
+ minX: minX_,
380
+ maxX: maxX_,
381
+ minY: minY_,
382
+ maxY: maxY_,
383
+ minMaxPadding: minMaxPadding__,
384
+ minPadding: minPadding__,
385
+ maxPadding: maxPadding__,
386
+ minPaddingX: minPaddingX__,
387
+ minPaddingY: minPaddingY__,
388
+ maxPaddingX: maxPaddingX__,
389
+ maxPaddingY: maxPaddingY__,
390
+ noMain,
391
+ tooltipRender,
392
+ tooltipGroupRender,
393
+ labelRender,
394
+ labelResolve,
395
+ onUpdateRects,
396
+ Component = 'div',
397
+ SvgProps,
398
+ TypeProps,
399
+ TitleProps,
400
+ SubtitleProps,
401
+ PointsProps,
402
+ PointProps,
403
+ HeaderProps,
404
+ AppendProps,
405
+ AdditionalLineProps,
406
+ AdditionalLinesProps,
407
+ LegendProps,
408
+ LegendItemProps,
409
+ GuidelineProps,
410
+ WrapperProps,
411
+ className,
412
+ children
413
+ } = props,
414
+ other = (0, _objectWithoutProperties2.default)(props, _excluded);
415
+ const {
416
+ classes
417
+ } = useStyle();
418
+ const refs = {
419
+ root: _react.default.useRef(undefined),
420
+ wrapper: _react.default.useRef(undefined),
421
+ svg: _react.default.useRef(undefined),
422
+ defs: _react.default.useRef(undefined),
423
+ minMax: _react.default.useRef(undefined),
424
+ rects: _react.default.useRef(undefined),
425
+ guidelines: _react.default.useRef(undefined),
426
+ guidelinesIn: _react.default.useRef(undefined),
427
+ guidelinesPosition: _react.default.useRef(undefined),
428
+ guidelinesAppend: _react.default.useRef(undefined),
429
+ hover: _react.default.useRef(undefined),
430
+ allValues: _react.default.useRef([]),
431
+ values: _react.default.useRef([]),
432
+ visible: _react.default.useRef([]),
433
+ appendStyle: _react.default.useRef({}),
434
+ theme: _react.default.useRef([])
435
+ };
436
+ const keys = _react.default.useMemo(() => {
437
+ const result = [];
438
+ const items = [nameX_, nameY_, tooltip_, tooltipIndividually_, tooltipCloseOnMouseLeave_, elementTooltip_, guidelines_, guidelinesAppend_, guidelinesDisplayInactive_, animate_, animateTimeout_, legend___, labels___, labelsX_, labelsY_, labelDecimalPlaces_, labelsAutoNumber_, labelsYAutoNumber_, labelsXAutoNumber_, marks___, marksX_, marksY_, marksAutoNumber_, marksYAutoNumber_, marksXAutoNumber_, grid___, gridX_, gridY_, gridAutoNumber_, gridYAutoNumber_, gridXAutoNumber_, points___, pointsVisibility_];
439
+ items.forEach(item => {
440
+ if ((0, _utils.is)('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key => result.push(key));
441
+ });
442
+ return (0, _utils.unique)(result);
443
+ }, [nameX_, nameY_, tooltip_, tooltipIndividually_, tooltipCloseOnMouseLeave_, elementTooltip_, guidelines_, guidelinesAppend_, guidelinesDisplayInactive_, animate_, animateTimeout_, legend___, labels___, labelsX_, labelsY_, labelDecimalPlaces_, labelsAutoNumber_, labelsYAutoNumber_, labelsXAutoNumber_, marks___, marksX_, marksY_, marksAutoNumber_, marksYAutoNumber_, marksXAutoNumber_, grid___, gridX_, gridY_, gridAutoNumber_, gridYAutoNumber_, gridXAutoNumber_, points___, pointsVisibility_, borders_, borderStart_, borderLeft_, borderEnd_, borderRight_, borderTop_, borderBottom_, minX_, maxX_, minY_, maxY_, minMaxPadding__, minPadding__, maxPadding__, minPaddingX__, minPaddingY__, maxPaddingX__, maxPaddingY__]);
444
+ const breakpoints = {};
445
+ keys.forEach(key => {
446
+ breakpoints[key] = (0, _useMediaQuery.default)(theme.breakpoints.media[key], {
447
+ element: refs.root.current
448
+ });
449
+ });
450
+ const nameX = (0, _utils2.valueBreakpoints)(nameX_, undefined, breakpoints, theme);
451
+ const nameY = (0, _utils2.valueBreakpoints)(nameY_, undefined, breakpoints, theme);
452
+ const tooltip = (0, _utils2.valueBreakpoints)(tooltip_, true, breakpoints, theme);
453
+ const tooltipIndividually = (0, _utils2.valueBreakpoints)(tooltipIndividually_, true, breakpoints, theme);
454
+ const tooltipCloseOnMouseLeave = (0, _utils2.valueBreakpoints)(tooltipCloseOnMouseLeave_, true, breakpoints, theme);
455
+ const elementTooltip = (0, _utils2.valueBreakpoints)(elementTooltip_, undefined, breakpoints, theme);
456
+ const guidelines = (0, _utils2.valueBreakpoints)(guidelines_, undefined, breakpoints, theme);
457
+ const guidelinesAppend = (0, _utils2.valueBreakpoints)(guidelinesAppend_, true, breakpoints, theme);
458
+ const guidelinesDisplayInactive = (0, _utils2.valueBreakpoints)(guidelinesDisplayInactive_, false, breakpoints, theme);
459
+ const animate = (0, _utils2.valueBreakpoints)(animate_, true, breakpoints, theme);
460
+ const animateTimeout = (0, _utils2.valueBreakpoints)(animateTimeout_, 140, breakpoints, theme);
461
+ const legend__ = (0, _utils2.valueBreakpoints)(legend___, 'auto', breakpoints, theme);
462
+ const labels__ = (0, _utils2.valueBreakpoints)(labels___, 'auto', breakpoints, theme);
463
+ const labelsX = (0, _utils2.valueBreakpoints)(labelsX_, true, breakpoints, theme);
464
+ const labelsY = (0, _utils2.valueBreakpoints)(labelsY_, true, breakpoints, theme);
465
+ const labelDecimalPlaces = (0, _utils2.valueBreakpoints)(labelDecimalPlaces_, 0, breakpoints, theme);
466
+ const labelsAutoNumber = (0, _utils2.valueBreakpoints)(labelsAutoNumber_, 10, breakpoints, theme);
467
+ const labelsYAutoNumber = (0, _utils2.valueBreakpoints)(labelsYAutoNumber_, undefined, breakpoints, theme);
468
+ const labelsXAutoNumber = (0, _utils2.valueBreakpoints)(labelsXAutoNumber_, undefined, breakpoints, theme);
469
+ const marks__ = (0, _utils2.valueBreakpoints)(marks___, 'auto', breakpoints, theme);
470
+ const marksX = (0, _utils2.valueBreakpoints)(marksX_, true, breakpoints, theme);
471
+ const marksY = (0, _utils2.valueBreakpoints)(marksY_, true, breakpoints, theme);
472
+ const marksAutoNumber = (0, _utils2.valueBreakpoints)(marksAutoNumber_, 10, breakpoints, theme);
473
+ const marksYAutoNumber = (0, _utils2.valueBreakpoints)(marksYAutoNumber_, undefined, breakpoints, theme);
474
+ const marksXAutoNumber = (0, _utils2.valueBreakpoints)(marksXAutoNumber_, undefined, breakpoints, theme);
475
+ const grid__ = (0, _utils2.valueBreakpoints)(grid___, undefined, breakpoints, theme);
476
+ const gridX = (0, _utils2.valueBreakpoints)(gridX_, true, breakpoints, theme);
477
+ const gridY = (0, _utils2.valueBreakpoints)(gridY_, true, breakpoints, theme);
478
+ const gridAutoNumber = (0, _utils2.valueBreakpoints)(gridAutoNumber_, 10, breakpoints, theme);
479
+ const gridYAutoNumber = (0, _utils2.valueBreakpoints)(gridYAutoNumber_, undefined, breakpoints, theme);
480
+ const gridXAutoNumber = (0, _utils2.valueBreakpoints)(gridXAutoNumber_, undefined, breakpoints, theme);
481
+ const points__ = (0, _utils2.valueBreakpoints)(points___, true, breakpoints, theme);
482
+ const pointsVisibility = (0, _utils2.valueBreakpoints)(pointsVisibility_, 'hover', breakpoints, theme);
483
+ const borders = (0, _utils2.valueBreakpoints)(borders_, true, breakpoints, theme);
484
+ const borderStart = (0, _utils2.valueBreakpoints)(borderStart_, false, breakpoints, theme);
485
+ const borderLeft = (0, _utils2.valueBreakpoints)(borderLeft_, true, breakpoints, theme);
486
+ const borderEnd = (0, _utils2.valueBreakpoints)(borderEnd_, false, breakpoints, theme);
487
+ const borderRight = (0, _utils2.valueBreakpoints)(borderRight_, false, breakpoints, theme);
488
+ const borderTop = (0, _utils2.valueBreakpoints)(borderTop_, false, breakpoints, theme);
489
+ const borderBottom = (0, _utils2.valueBreakpoints)(borderBottom_, true, breakpoints, theme);
490
+ const minX = (0, _utils2.valueBreakpoints)(minX_, undefined, breakpoints, theme);
491
+ const maxX = (0, _utils2.valueBreakpoints)(maxX_, undefined, breakpoints, theme);
492
+ const minY = (0, _utils2.valueBreakpoints)(minY_, undefined, breakpoints, theme);
493
+ const maxY = (0, _utils2.valueBreakpoints)(maxY_, undefined, breakpoints, theme);
494
+ const minMaxPadding = (0, _utils2.valueBreakpoints)(minMaxPadding__, undefined, breakpoints, theme);
495
+ const minPadding = (0, _utils2.valueBreakpoints)(minPadding__, undefined, breakpoints, theme);
496
+ const maxPadding = (0, _utils2.valueBreakpoints)(maxPadding__, undefined, breakpoints, theme);
497
+ const minPaddingX = (0, _utils2.valueBreakpoints)(minPaddingX__, undefined, breakpoints, theme);
498
+ const minPaddingY = (0, _utils2.valueBreakpoints)(minPaddingY__, undefined, breakpoints, theme);
499
+ const maxPaddingX = (0, _utils2.valueBreakpoints)(maxPaddingX__, undefined, breakpoints, theme);
500
+ const maxPaddingY = (0, _utils2.valueBreakpoints)(maxPaddingY__, undefined, breakpoints, theme);
501
+ const [rects, setRects] = _react.default.useState();
502
+ const [points, setPoints] = _react.default.useState();
503
+ const [labels, setLabels] = _react.default.useState();
504
+ const [marks, setMarks] = _react.default.useState();
505
+ const [grid, setGrid] = _react.default.useState();
506
+ const [additionalLines, setAdditionalLines] = _react.default.useState();
507
+ const [legend, setLegend] = _react.default.useState([]);
508
+ const [defs, setDefs] = _react.default.useState([]);
509
+ const [append, setAppend] = _react.default.useState();
510
+ const [visible, setVisible] = _react.default.useState({});
511
+ const [guidelinesIn, setGuidelineIn] = _react.default.useState(false);
512
+ const [guidelinesPosition, setGuidelinePosition] = _react.default.useState({});
513
+ const [hover, setHover] = _react.default.useState(false);
514
+ refs.rects.current = rects;
515
+ refs.guidelines.current = guidelines;
516
+ refs.guidelinesIn.current = guidelinesIn;
517
+ refs.guidelinesPosition.current = guidelinesPosition;
518
+ refs.guidelinesAppend.current = guidelinesAppend;
519
+ refs.hover.current = hover;
520
+ refs.values.current = values;
521
+ refs.visible.current = visible;
522
+ refs.theme.current = theme;
523
+ const minMax = _react.default.useMemo(() => {
524
+ const values_ = {
525
+ min: {
526
+ x: minX || Number.MAX_SAFE_INTEGER,
527
+ y: minY || Number.MAX_SAFE_INTEGER
528
+ },
529
+ max: {
530
+ x: maxX || Number.MIN_SAFE_INTEGER,
531
+ y: maxY || Number.MIN_SAFE_INTEGER
532
+ }
533
+ };
534
+ if (!noMain) {
535
+ const allItems = values.flatMap(item => (0, _utils.is)('array', item.values[0]) ? item.values : [item.values]);
536
+ if ((0, _utils.is)('array', values)) {
537
+ allItems.forEach(item => {
538
+ const [x, y] = item;
539
+ if (minX === undefined) values_.min.x = Math.min(values_.min.x, x);
540
+ if (maxX === undefined) values_.max.x = Math.max(values_.max.x, x);
541
+ if (minY === undefined) values_.min.y = Math.min(values_.min.y, y);
542
+ if (maxY === undefined) values_.max.y = Math.max(values_.max.y, y);
543
+ });
544
+ }
545
+ const minPaddingY_ = minPaddingY !== undefined ? minPaddingY : minPadding !== undefined ? minPadding : minMaxPadding;
546
+ const maxPaddingY_ = maxPaddingY !== undefined ? maxPaddingY : maxPadding !== undefined ? maxPadding : minMaxPadding;
547
+ const minPaddingX_ = minPaddingX !== undefined ? minPaddingX : minPadding !== undefined ? minPadding : minMaxPadding;
548
+ const maxPaddingX_ = maxPaddingX !== undefined ? maxPaddingX : maxPadding !== undefined ? maxPadding : minMaxPadding;
549
+ const totals = {
550
+ x: values_.max.x - values_.min.x,
551
+ y: values_.max.y - values_.min.y
552
+ };
553
+ if (minPaddingY_ !== undefined) values_.min.y -= totals.y * minPaddingY_;
554
+ if (maxPaddingY_ !== undefined) values_.max.y += totals.y * maxPaddingY_;
555
+ if (minPaddingX_ !== undefined) values_.min.x -= totals.x * minPaddingX_;
556
+ if (maxPaddingX_ !== undefined) values_.max.x += totals.x * maxPaddingX_;
557
+ }
558
+ return values_;
559
+ }, [values, minX, maxX, minY, maxY, minMaxPadding, minPadding, maxPadding, minPaddingX, minPaddingY, maxPaddingX, maxPaddingY, noMain]);
560
+ refs.minMax.current = minMax;
561
+ const onWrapperMouseEnter = _react.default.useCallback(() => {
562
+ if (!refs.guidelinesIn.current) setGuidelineIn(true);
563
+ setHover(true);
564
+ }, []);
565
+ const onWrapperMouseLeave = _react.default.useCallback(() => {
566
+ setHover(false);
567
+ setTimeout(() => {
568
+ if (tooltipCloseOnMouseLeave) setAppend(values_ => _objectSpread(_objectSpread({}, values_), {}, {
569
+ open: false
570
+ }));
571
+ if (!guidelinesDisplayInactive) setGuidelineIn(false);
572
+ setGuidelinePosition({});
573
+ });
574
+ }, [tooltipCloseOnMouseLeave, guidelinesDisplayInactive]);
575
+ const makeGroupTooltip = (x_, y_) => {
576
+ const items = refs.allValues.current.filter(item => item.normalized[0] === x_);
577
+ const itemsY = (0, _utils.copy)(items).sort((a, b) => a.normalized[1] - b.normalized[1]);
578
+ const x = x_;
579
+ const y = itemsY[0].normalized[1];
580
+ const groups = {};
581
+ items.forEach(item => {
582
+ var _item$item;
583
+ const color_ = ((_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.color) || 'primary';
584
+ if (!groups[color_]) groups[color_] = [];
585
+ groups[color_].push(item);
586
+ });
587
+
588
+ // Group sorted by y largest, to smallest
589
+ Object.keys(groups).forEach(group => groups[group].sort((a, b) => {
590
+ var _a$normalized, _b$normalized;
591
+ return ((_a$normalized = a.normalized) === null || _a$normalized === void 0 ? void 0 : _a$normalized[1]) - ((_b$normalized = b.normalized) === null || _b$normalized === void 0 ? void 0 : _b$normalized[1]);
592
+ }));
593
+
594
+ // Groups sorted by y largest, to smallest
595
+ const groupsSorted = Object.keys(groups).sort((a, b) => {
596
+ var _groups$a$, _groups$b$;
597
+ return ((_groups$a$ = groups[a][0]) === null || _groups$a$ === void 0 || (_groups$a$ = _groups$a$.normalized) === null || _groups$a$ === void 0 ? void 0 : _groups$a$[1]) - ((_groups$b$ = groups[b][0]) === null || _groups$b$ === void 0 || (_groups$b$ = _groups$b$.normalized) === null || _groups$b$ === void 0 ? void 0 : _groups$b$[1]);
598
+ });
599
+ const element = (0, _utils.is)('function', tooltipGroupRender) ? tooltipGroupRender(groups, groupsSorted) : /*#__PURE__*/_react.default.createElement(Line, {
600
+ tonal: tonal,
601
+ color: color,
602
+ elevation: 1,
603
+ gap: 0.25,
604
+ direction: "column",
605
+ Component: Surface,
606
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-append'], classes.append])
607
+ }, /*#__PURE__*/_react.default.createElement(Line, {
608
+ gap: 1,
609
+ direction: "column",
610
+ style: {
611
+ width: '100%'
612
+ }
613
+ }, /*#__PURE__*/_react.default.createElement(Line, {
614
+ gap: 1,
615
+ direction: "row",
616
+ align: "center"
617
+ }, /*#__PURE__*/_react.default.createElement(Type, {
618
+ version: "b3",
619
+ style: {
620
+ fontWeight: 600
621
+ }
622
+ }, (names === null || names === void 0 ? void 0 : names.y) || 'y'), /*#__PURE__*/_react.default.createElement(Type, {
623
+ version: "b3",
624
+ style: {
625
+ fontWeight: 600
626
+ }
627
+ }, (names === null || names === void 0 ? void 0 : names.x) || 'x')), /*#__PURE__*/_react.default.createElement(Line, {
628
+ gap: 1,
629
+ direction: "column"
630
+ }, groupsSorted.map((group, index) => {
631
+ var _groups$group$;
632
+ return /*#__PURE__*/_react.default.createElement(Line, {
633
+ key: index,
634
+ gap: 1,
635
+ direction: "column",
636
+ style: {
637
+ width: '100%'
10
638
  }
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 Surface_1 = __importDefault(require("../Surface"));
22
- const Line_1 = __importDefault(require("../Line"));
23
- const Type_1 = __importDefault(require("../Type"));
24
- const Path_1 = __importDefault(require("../Path"));
25
- const Append_1 = __importDefault(require("../Append"));
26
- const Grow_1 = __importDefault(require("../Grow"));
27
- const useMediaQuery_1 = __importDefault(require("../useMediaQuery"));
28
- const utils_2 = require("../utils");
29
- const useStyle = (0, style_react_1.style)(theme => ({
30
- root: {
31
- width: '100%',
32
- '&.onesy-Surface-root': {
33
- background: 'transparent'
639
+ }, /*#__PURE__*/_react.default.createElement("span", {
640
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-append-icon'], classes.append_icon]),
641
+ style: {
642
+ background: !refs.theme.current.palette.color[group] ? group : refs.theme.current.palette.color[group][((_groups$group$ = groups[group][0]) === null || _groups$group$ === void 0 || (_groups$group$ = _groups$group$.item) === null || _groups$group$ === void 0 ? void 0 : _groups$group$.tone) || 'main']
34
643
  }
35
- },
36
- additionalLines: {
37
- pointerEvents: 'none'
38
- },
39
- append_wrapper: {
40
- userSelect: 'none',
41
- pointerEvents: 'none',
42
- zIndex: theme.z_index.tooltip
43
- },
44
- wrapper: {
45
- position: 'relative',
46
- height: '400px',
47
- width: '100%',
48
- maxWidth: '1000px'
49
- },
50
- wrapper_label_x: {
51
- margin: '0 0 30px 0'
52
- },
53
- wrapper_label_y: {
54
- margin: '0 0 0 40px'
55
- },
56
- wrapper_labels: {
57
- margin: '0 0 30px 40px'
58
- },
59
- wrapper_name_x: {
60
- margin: '0 0 60px 0'
61
- },
62
- wrapper_name_y: {
63
- margin: '0 0 0 70px'
64
- },
65
- wrapper_names: {
66
- margin: '0 0 60px 70px'
67
- },
68
- legend_offset_labels_y: {
69
- paddingLeft: theme.methods.space.value(5, 'px')
70
- },
71
- legend_offset_names_y: {
72
- paddingLeft: theme.methods.space.value(9, 'px')
73
- },
74
- svg: {
75
- position: 'relative',
76
- touchAction: 'none',
77
- userSelect: 'none',
78
- '& path, & circle, & rect, & g': {
79
- transition: theme.methods.transitions.make('opacity', { duration: 'xs' })
80
- }
81
- },
82
- header: {
83
- width: '100%',
84
- marginBottom: '24px'
85
- },
86
- subtitle: {
87
- opacity: '0.74'
88
- },
89
- append: {
90
- padding: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2.5, 'px')}`,
91
- borderRadius: theme.methods.shape.radius.value(1.5, 'px')
92
- },
93
- name: {
94
- position: 'absolute',
95
- userSelect: 'none'
96
- },
97
- name_x: {
98
- bottom: '-61px',
99
- left: '50%',
100
- transform: 'translateX(-50%)'
101
- },
102
- name_y: {
103
- left: '-87px',
104
- top: '50%',
105
- transform: 'translateY(-50%) rotate(-90deg)'
106
- },
107
- labels: {
108
- position: 'absolute',
109
- userSelect: 'none'
110
- },
111
- labels_x: {
112
- top: 'calc(100% + 12px)',
113
- left: '0',
114
- width: '100%'
115
- },
116
- labels_y: {
117
- top: '0',
118
- right: 'calc(100% + 12px)',
119
- height: '100%'
120
- },
121
- label: {
122
- position: 'absolute',
123
- whiteSpace: 'nowrap'
124
- },
125
- label_x: {
126
- transform: 'translateX(-50%)',
127
- top: '0'
128
- },
129
- label_y: {
130
- transform: 'translateY(50%)',
131
- right: '0'
132
- },
133
- marks: {
134
- position: 'absolute'
135
- },
136
- marks_x: {
137
- top: 'calc(100% + 0px)',
138
- left: '0',
139
- width: '100%'
140
- },
141
- marks_y: {
142
- top: '0',
143
- right: 'calc(100% + 0px)',
144
- height: '100%'
145
- },
146
- mark: {
147
- position: 'absolute'
148
- },
149
- mark_x: {
150
- width: '1px',
151
- height: '7px',
152
- top: '0',
153
- background: 'currentColor'
154
- },
155
- mark_y: {
156
- width: '7px',
157
- height: '1px',
158
- right: '0',
159
- background: 'currentColor'
160
- },
161
- grids: {
162
- position: 'absolute',
163
- width: '100%',
164
- height: '100%'
165
- },
166
- grids_x: {
167
- top: '0',
168
- left: '0'
169
- },
170
- grids_y: {
171
- top: '0',
172
- left: '0'
173
- },
174
- grid: {
175
- position: 'absolute',
176
- width: '100%',
177
- height: '100%',
178
- opacity: theme.palette.light ? '0.07' : '0.14'
179
- },
180
- grid_x: {
181
- width: '1px',
182
- background: 'currentColor'
183
- },
184
- grid_y: {
185
- height: '1px',
186
- background: 'currentColor'
187
- },
188
- border: {
189
- position: 'absolute',
190
- background: 'currentColor'
191
- },
192
- borderX: {
193
- height: '1px',
194
- width: 'calc(100% + 1px)',
195
- left: '0'
196
- },
197
- borderTop: {
198
- top: '0'
199
- },
200
- borderBottom: {
201
- bottom: '0'
202
- },
203
- borderY: {
204
- width: '1px',
205
- height: 'calc(100% + 1px)',
206
- top: '-1px'
207
- },
208
- borderStart: {
209
- insetInlineStart: '0'
210
- },
211
- borderLeft: {
212
- left: '0'
213
- },
214
- borderEnd: {
215
- insetInlineEnd: '0'
216
- },
217
- borderRight: {
218
- right: '0'
219
- },
220
- point_visibility_hover: {
221
- opacity: '0',
222
- transition: theme.methods.transitions.make('opacity', { duration: 'xxs' }),
223
- '&:hover': {
224
- opacity: '1'
644
+ }), /*#__PURE__*/_react.default.createElement(Line, {
645
+ gap: 0,
646
+ direction: "column",
647
+ style: {
648
+ width: '100%'
225
649
  }
226
- },
227
- point_visibility_visible: {
228
- opacity: '1'
229
- },
230
- point_active: {
231
- opacity: '1'
232
- },
233
- point_visibility_hidden: {
234
- opacity: '0',
235
- pointerEvents: 'none'
236
- },
237
- // Legend
238
- legend: {},
239
- legend_position_top: {
240
- marginBottom: '16px'
241
- },
242
- legend_position_bottom: {
243
- marginTop: '16px'
244
- },
245
- legend_item: {
246
- userSelect: 'none'
247
- },
248
- legend_item_manage_visibility: {
249
- cursor: 'pointer',
250
- transition: theme.methods.transitions.make('opacity', { duration: 'xs' })
251
- },
252
- legend_item_hidden: {
253
- opacity: '0.4'
254
- },
255
- legend_icon: {
256
- width: '10px',
257
- height: '10px',
258
- borderRadius: theme.methods.shape.radius.value(40, 'px'),
259
- boxSizing: 'border-box'
260
- },
261
- append_icon: {
262
- width: '8px',
263
- height: '8px',
264
- borderRadius: theme.methods.shape.radius.value(40, 'px'),
265
- boxSizing: 'border-box'
266
- },
267
- // Guideline
268
- guidelines: {
269
- stroke: 'currentColor',
270
- strokeDasharray: '4',
271
- opacity: '0.44',
272
- pointerEvents: 'none'
273
- }
274
- }), { name: 'onesy-Chart' });
275
- const Chart = react_1.default.forwardRef((props_, ref) => {
276
- var _a, _b, _c, _d;
277
- const theme = (0, style_react_1.useOnesyTheme)();
278
- const l = theme.l;
279
- 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.onesyChart) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
280
- const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
281
- const Surface = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Surface) || Surface_1.default; }, [theme]);
282
- 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]);
283
- const Path = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Path) || Path_1.default; }, [theme]);
284
- const Append = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Append) || Append_1.default; }, [theme]);
285
- const Grow = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Grow) || Grow_1.default; }, [theme]);
286
- const { tonal = true, color = 'primary', title, subtitle,
287
- // Values
288
- values,
289
- // Pre
290
- pre,
291
- // Elements
292
- elements,
293
- // Names
294
- names, nameX: nameX_, nameY: nameY_,
295
- // Tooltip
296
- tooltip: tooltip_, tooltipIndividually: tooltipIndividually_, tooltipCloseOnMouseLeave: tooltipCloseOnMouseLeave_, elementTooltip: elementTooltip_,
297
- // Guideline
298
- guidelines: guidelines_, guidelinesAppend: guidelinesAppend_, guidelinesDisplayInactive: guidelinesDisplayInactive_,
299
- // Additional lines
300
- additionalLines: additionalLines__,
301
- // Legend
302
- legend: legend___, legendManageVisibility = true, legendPosition = 'bottom',
303
- // Animation
304
- animate: animate_, animateTimeout: animateTimeout_,
305
- // Labels
306
- labels: labels___, labelsX: labelsX_, labelsY: labelsY_, labelDecimalPlaces: labelDecimalPlaces_, labelsAutoNumber: labelsAutoNumber_, labelsYAutoNumber: labelsYAutoNumber_, labelsXAutoNumber: labelsXAutoNumber_,
307
- // Marks
308
- marks: marks___, marksX: marksX_, marksY: marksY_, marksAutoNumber: marksAutoNumber_, marksYAutoNumber: marksYAutoNumber_, marksXAutoNumber: marksXAutoNumber_,
309
- // Grid
310
- grid: grid___, gridX: gridX_, gridY: gridY_, gridAutoNumber: gridAutoNumber_, gridYAutoNumber: gridYAutoNumber_, gridXAutoNumber: gridXAutoNumber_,
311
- // Points
312
- points: points___, pointsVisibility: pointsVisibility_,
313
- // Borders
314
- borders: borders_ = true, borderStart: borderStart_ = false, borderLeft: borderLeft_ = true, borderEnd: borderEnd_ = false, borderRight: borderRight_ = false, borderTop: borderTop_ = false, borderBottom: borderBottom_ = true,
315
- // Min, max
316
- minX: minX_, maxX: maxX_, minY: minY_, maxY: maxY_, minMaxPadding: minMaxPadding__, minPadding: minPadding__, maxPadding: maxPadding__, minPaddingX: minPaddingX__, minPaddingY: minPaddingY__, maxPaddingX: maxPaddingX__, maxPaddingY: maxPaddingY__, noMain, tooltipRender, tooltipGroupRender, labelRender, labelResolve, onUpdateRects, Component = 'div', SvgProps, TypeProps, TitleProps, SubtitleProps, PointsProps, PointProps, HeaderProps, AppendProps, AdditionalLineProps, AdditionalLinesProps, LegendProps, LegendItemProps, GuidelineProps, WrapperProps, className, children } = props, other = __rest(props, ["tonal", "color", "title", "subtitle", "values", "pre", "elements", "names", "nameX", "nameY", "tooltip", "tooltipIndividually", "tooltipCloseOnMouseLeave", "elementTooltip", "guidelines", "guidelinesAppend", "guidelinesDisplayInactive", "additionalLines", "legend", "legendManageVisibility", "legendPosition", "animate", "animateTimeout", "labels", "labelsX", "labelsY", "labelDecimalPlaces", "labelsAutoNumber", "labelsYAutoNumber", "labelsXAutoNumber", "marks", "marksX", "marksY", "marksAutoNumber", "marksYAutoNumber", "marksXAutoNumber", "grid", "gridX", "gridY", "gridAutoNumber", "gridYAutoNumber", "gridXAutoNumber", "points", "pointsVisibility", "borders", "borderStart", "borderLeft", "borderEnd", "borderRight", "borderTop", "borderBottom", "minX", "maxX", "minY", "maxY", "minMaxPadding", "minPadding", "maxPadding", "minPaddingX", "minPaddingY", "maxPaddingX", "maxPaddingY", "noMain", "tooltipRender", "tooltipGroupRender", "labelRender", "labelResolve", "onUpdateRects", "Component", "SvgProps", "TypeProps", "TitleProps", "SubtitleProps", "PointsProps", "PointProps", "HeaderProps", "AppendProps", "AdditionalLineProps", "AdditionalLinesProps", "LegendProps", "LegendItemProps", "GuidelineProps", "WrapperProps", "className", "children"]);
317
- const { classes } = useStyle();
318
- const refs = {
319
- root: react_1.default.useRef(undefined),
320
- wrapper: react_1.default.useRef(undefined),
321
- svg: react_1.default.useRef(undefined),
322
- defs: react_1.default.useRef(undefined),
323
- minMax: react_1.default.useRef(undefined),
324
- rects: react_1.default.useRef(undefined),
325
- guidelines: react_1.default.useRef(undefined),
326
- guidelinesIn: react_1.default.useRef(undefined),
327
- guidelinesPosition: react_1.default.useRef(undefined),
328
- guidelinesAppend: react_1.default.useRef(undefined),
329
- hover: react_1.default.useRef(undefined),
330
- allValues: react_1.default.useRef([]),
331
- values: react_1.default.useRef([]),
332
- visible: react_1.default.useRef([]),
333
- appendStyle: react_1.default.useRef({}),
334
- theme: react_1.default.useRef([])
650
+ }, groups[group].map((item, index_) => {
651
+ var _item$values, _item$values2, _item$values3, _item$values4;
652
+ return /*#__PURE__*/_react.default.createElement(Line, {
653
+ key: index_,
654
+ gap: 1,
655
+ direction: "row",
656
+ style: {
657
+ width: '100%'
658
+ }
659
+ }, /*#__PURE__*/_react.default.createElement(Type, {
660
+ version: "b3"
661
+ }, (0, _utils.is)('function', labelResolve) ? labelResolve(item === null || item === void 0 || (_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values[1], 'y', item, 'group') : item === null || item === void 0 || (_item$values2 = item.values) === null || _item$values2 === void 0 ? void 0 : _item$values2[1]), /*#__PURE__*/_react.default.createElement(Type, {
662
+ version: "b3"
663
+ }, (0, _utils.is)('function', labelResolve) ? labelResolve(item === null || item === void 0 || (_item$values3 = item.values) === null || _item$values3 === void 0 ? void 0 : _item$values3[0], 'x', item, 'group') : item === null || item === void 0 || (_item$values4 = item.values) === null || _item$values4 === void 0 ? void 0 : _item$values4[0]));
664
+ })));
665
+ }))));
666
+ const rectSvg = refs.svg.current.getBoundingClientRect();
667
+ const width = 8;
668
+ const height = 8;
669
+ const rect_ = {
670
+ x: x + rectSvg.x - width,
671
+ y: y + rectSvg.y - width,
672
+ width,
673
+ height
335
674
  };
336
- const keys = react_1.default.useMemo(() => {
337
- const result = [];
338
- const items = [nameX_, nameY_, tooltip_, tooltipIndividually_, tooltipCloseOnMouseLeave_, elementTooltip_, guidelines_, guidelinesAppend_, guidelinesDisplayInactive_, animate_, animateTimeout_, legend___, labels___, labelsX_, labelsY_, labelDecimalPlaces_, labelsAutoNumber_, labelsYAutoNumber_, labelsXAutoNumber_, marks___, marksX_, marksY_, marksAutoNumber_, marksYAutoNumber_, marksXAutoNumber_, grid___, gridX_, gridY_, gridAutoNumber_, gridYAutoNumber_, gridXAutoNumber_, points___, pointsVisibility_,];
339
- items.forEach(item => {
340
- if ((0, utils_1.is)('object', item))
341
- Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key => result.push(key));
342
- });
343
- return (0, utils_1.unique)(result);
344
- }, [nameX_, nameY_, tooltip_, tooltipIndividually_, tooltipCloseOnMouseLeave_, elementTooltip_, guidelines_, guidelinesAppend_, guidelinesDisplayInactive_, animate_, animateTimeout_, legend___, labels___, labelsX_, labelsY_, labelDecimalPlaces_, labelsAutoNumber_, labelsYAutoNumber_, labelsXAutoNumber_, marks___, marksX_, marksY_, marksAutoNumber_, marksYAutoNumber_, marksXAutoNumber_, grid___, gridX_, gridY_, gridAutoNumber_, gridYAutoNumber_, gridXAutoNumber_, points___, pointsVisibility_, borders_, borderStart_, borderLeft_, borderEnd_, borderRight_, borderTop_, borderBottom_, minX_, maxX_, minY_, maxY_, minMaxPadding__, minPadding__, maxPadding__, minPaddingX__, minPaddingY__, maxPaddingX__, maxPaddingY__]);
345
- const breakpoints = {};
346
- keys.forEach(key => {
347
- breakpoints[key] = (0, useMediaQuery_1.default)(theme.breakpoints.media[key], { element: refs.root.current });
675
+ rect_.top = rect_.y;
676
+ rect_.bottom = rect_.y + height;
677
+ rect_.left = rect_.x;
678
+ rect_.right = rect_.x + width;
679
+ setAppend({
680
+ open: true,
681
+ element,
682
+ rect: rect_
348
683
  });
349
- const nameX = (0, utils_2.valueBreakpoints)(nameX_, undefined, breakpoints, theme);
350
- const nameY = (0, utils_2.valueBreakpoints)(nameY_, undefined, breakpoints, theme);
351
- const tooltip = (0, utils_2.valueBreakpoints)(tooltip_, true, breakpoints, theme);
352
- const tooltipIndividually = (0, utils_2.valueBreakpoints)(tooltipIndividually_, true, breakpoints, theme);
353
- const tooltipCloseOnMouseLeave = (0, utils_2.valueBreakpoints)(tooltipCloseOnMouseLeave_, true, breakpoints, theme);
354
- const elementTooltip = (0, utils_2.valueBreakpoints)(elementTooltip_, undefined, breakpoints, theme);
355
- const guidelines = (0, utils_2.valueBreakpoints)(guidelines_, undefined, breakpoints, theme);
356
- const guidelinesAppend = (0, utils_2.valueBreakpoints)(guidelinesAppend_, true, breakpoints, theme);
357
- const guidelinesDisplayInactive = (0, utils_2.valueBreakpoints)(guidelinesDisplayInactive_, false, breakpoints, theme);
358
- const animate = (0, utils_2.valueBreakpoints)(animate_, true, breakpoints, theme);
359
- const animateTimeout = (0, utils_2.valueBreakpoints)(animateTimeout_, 140, breakpoints, theme);
360
- const legend__ = (0, utils_2.valueBreakpoints)(legend___, 'auto', breakpoints, theme);
361
- const labels__ = (0, utils_2.valueBreakpoints)(labels___, 'auto', breakpoints, theme);
362
- const labelsX = (0, utils_2.valueBreakpoints)(labelsX_, true, breakpoints, theme);
363
- const labelsY = (0, utils_2.valueBreakpoints)(labelsY_, true, breakpoints, theme);
364
- const labelDecimalPlaces = (0, utils_2.valueBreakpoints)(labelDecimalPlaces_, 0, breakpoints, theme);
365
- const labelsAutoNumber = (0, utils_2.valueBreakpoints)(labelsAutoNumber_, 10, breakpoints, theme);
366
- const labelsYAutoNumber = (0, utils_2.valueBreakpoints)(labelsYAutoNumber_, undefined, breakpoints, theme);
367
- const labelsXAutoNumber = (0, utils_2.valueBreakpoints)(labelsXAutoNumber_, undefined, breakpoints, theme);
368
- const marks__ = (0, utils_2.valueBreakpoints)(marks___, 'auto', breakpoints, theme);
369
- const marksX = (0, utils_2.valueBreakpoints)(marksX_, true, breakpoints, theme);
370
- const marksY = (0, utils_2.valueBreakpoints)(marksY_, true, breakpoints, theme);
371
- const marksAutoNumber = (0, utils_2.valueBreakpoints)(marksAutoNumber_, 10, breakpoints, theme);
372
- const marksYAutoNumber = (0, utils_2.valueBreakpoints)(marksYAutoNumber_, undefined, breakpoints, theme);
373
- const marksXAutoNumber = (0, utils_2.valueBreakpoints)(marksXAutoNumber_, undefined, breakpoints, theme);
374
- const grid__ = (0, utils_2.valueBreakpoints)(grid___, undefined, breakpoints, theme);
375
- const gridX = (0, utils_2.valueBreakpoints)(gridX_, true, breakpoints, theme);
376
- const gridY = (0, utils_2.valueBreakpoints)(gridY_, true, breakpoints, theme);
377
- const gridAutoNumber = (0, utils_2.valueBreakpoints)(gridAutoNumber_, 10, breakpoints, theme);
378
- const gridYAutoNumber = (0, utils_2.valueBreakpoints)(gridYAutoNumber_, undefined, breakpoints, theme);
379
- const gridXAutoNumber = (0, utils_2.valueBreakpoints)(gridXAutoNumber_, undefined, breakpoints, theme);
380
- const points__ = (0, utils_2.valueBreakpoints)(points___, true, breakpoints, theme);
381
- const pointsVisibility = (0, utils_2.valueBreakpoints)(pointsVisibility_, 'hover', breakpoints, theme);
382
- const borders = (0, utils_2.valueBreakpoints)(borders_, true, breakpoints, theme);
383
- const borderStart = (0, utils_2.valueBreakpoints)(borderStart_, false, breakpoints, theme);
384
- const borderLeft = (0, utils_2.valueBreakpoints)(borderLeft_, true, breakpoints, theme);
385
- const borderEnd = (0, utils_2.valueBreakpoints)(borderEnd_, false, breakpoints, theme);
386
- const borderRight = (0, utils_2.valueBreakpoints)(borderRight_, false, breakpoints, theme);
387
- const borderTop = (0, utils_2.valueBreakpoints)(borderTop_, false, breakpoints, theme);
388
- const borderBottom = (0, utils_2.valueBreakpoints)(borderBottom_, true, breakpoints, theme);
389
- const minX = (0, utils_2.valueBreakpoints)(minX_, undefined, breakpoints, theme);
390
- const maxX = (0, utils_2.valueBreakpoints)(maxX_, undefined, breakpoints, theme);
391
- const minY = (0, utils_2.valueBreakpoints)(minY_, undefined, breakpoints, theme);
392
- const maxY = (0, utils_2.valueBreakpoints)(maxY_, undefined, breakpoints, theme);
393
- const minMaxPadding = (0, utils_2.valueBreakpoints)(minMaxPadding__, undefined, breakpoints, theme);
394
- const minPadding = (0, utils_2.valueBreakpoints)(minPadding__, undefined, breakpoints, theme);
395
- const maxPadding = (0, utils_2.valueBreakpoints)(maxPadding__, undefined, breakpoints, theme);
396
- const minPaddingX = (0, utils_2.valueBreakpoints)(minPaddingX__, undefined, breakpoints, theme);
397
- const minPaddingY = (0, utils_2.valueBreakpoints)(minPaddingY__, undefined, breakpoints, theme);
398
- const maxPaddingX = (0, utils_2.valueBreakpoints)(maxPaddingX__, undefined, breakpoints, theme);
399
- const maxPaddingY = (0, utils_2.valueBreakpoints)(maxPaddingY__, undefined, breakpoints, theme);
400
- const [rects, setRects] = react_1.default.useState();
401
- const [points, setPoints] = react_1.default.useState();
402
- const [labels, setLabels] = react_1.default.useState();
403
- const [marks, setMarks] = react_1.default.useState();
404
- const [grid, setGrid] = react_1.default.useState();
405
- const [additionalLines, setAdditionalLines] = react_1.default.useState();
406
- const [legend, setLegend] = react_1.default.useState([]);
407
- const [defs, setDefs] = react_1.default.useState([]);
408
- const [append, setAppend] = react_1.default.useState();
409
- const [visible, setVisible] = react_1.default.useState({});
410
- const [guidelinesIn, setGuidelineIn] = react_1.default.useState(false);
411
- const [guidelinesPosition, setGuidelinePosition] = react_1.default.useState({});
412
- const [hover, setHover] = react_1.default.useState(false);
413
- refs.rects.current = rects;
414
- refs.guidelines.current = guidelines;
415
- refs.guidelinesIn.current = guidelinesIn;
416
- refs.guidelinesPosition.current = guidelinesPosition;
417
- refs.guidelinesAppend.current = guidelinesAppend;
418
- refs.hover.current = hover;
419
- refs.values.current = values;
420
- refs.visible.current = visible;
421
- refs.theme.current = theme;
422
- const minMax = react_1.default.useMemo(() => {
423
- const values_ = {
424
- min: {
425
- x: minX || Number.MAX_SAFE_INTEGER,
426
- y: minY || Number.MAX_SAFE_INTEGER
427
- },
428
- max: {
429
- x: maxX || Number.MIN_SAFE_INTEGER,
430
- y: maxY || Number.MIN_SAFE_INTEGER
431
- }
432
- };
433
- if (!noMain) {
434
- const allItems = values.flatMap(item => (0, utils_1.is)('array', item.values[0]) ? item.values : [item.values]);
435
- if ((0, utils_1.is)('array', values)) {
436
- allItems.forEach((item) => {
437
- const [x, y] = item;
438
- if (minX === undefined)
439
- values_.min.x = Math.min(values_.min.x, x);
440
- if (maxX === undefined)
441
- values_.max.x = Math.max(values_.max.x, x);
442
- if (minY === undefined)
443
- values_.min.y = Math.min(values_.min.y, y);
444
- if (maxY === undefined)
445
- values_.max.y = Math.max(values_.max.y, y);
446
- });
447
- }
448
- const minPaddingY_ = minPaddingY !== undefined ? minPaddingY : minPadding !== undefined ? minPadding : minMaxPadding;
449
- const maxPaddingY_ = maxPaddingY !== undefined ? maxPaddingY : maxPadding !== undefined ? maxPadding : minMaxPadding;
450
- const minPaddingX_ = minPaddingX !== undefined ? minPaddingX : minPadding !== undefined ? minPadding : minMaxPadding;
451
- const maxPaddingX_ = maxPaddingX !== undefined ? maxPaddingX : maxPadding !== undefined ? maxPadding : minMaxPadding;
452
- const totals = {
453
- x: values_.max.x - values_.min.x,
454
- y: values_.max.y - values_.min.y
455
- };
456
- if (minPaddingY_ !== undefined)
457
- values_.min.y -= totals.y * minPaddingY_;
458
- if (maxPaddingY_ !== undefined)
459
- values_.max.y += totals.y * maxPaddingY_;
460
- if (minPaddingX_ !== undefined)
461
- values_.min.x -= totals.x * minPaddingX_;
462
- if (maxPaddingX_ !== undefined)
463
- values_.max.x += totals.x * maxPaddingX_;
684
+ };
685
+ _react.default.useEffect(() => {
686
+ var _refs$root$current;
687
+ const onMove = (x_, y_) => {
688
+ // Only horizontal move at the moment
689
+ // ie. vertical guidelines
690
+ const rectWrapper = refs.rects.current.wrapper;
691
+ const rectSvg = refs.svg.current.getBoundingClientRect();
692
+ let x = (0, _utils.clamp)(x_ - (rectSvg === null || rectSvg === void 0 ? void 0 : rectSvg.x), 0, rectWrapper === null || rectWrapper === void 0 ? void 0 : rectWrapper.width);
693
+ const y = (0, _utils.clamp)(y_ - (rectSvg === null || rectSvg === void 0 ? void 0 : rectSvg.y), 0, rectWrapper === null || rectWrapper === void 0 ? void 0 : rectWrapper.height);
694
+ if (refs.guidelinesAppend.current && ['both', 'vertical'].includes(refs.guidelines.current)) {
695
+ const allValues = refs.allValues.current;
696
+ let index;
697
+ let previous;
698
+ let item;
699
+ for (let i = 0; i < allValues.length; i++) {
700
+ var _previous, _item;
701
+ previous = allValues[i - 1];
702
+ item = allValues[i];
703
+ if (((_previous = previous) === null || _previous === void 0 || (_previous = _previous.normalized) === null || _previous === void 0 ? void 0 : _previous[0]) <= x && x <= ((_item = item) === null || _item === void 0 || (_item = _item.normalized) === null || _item === void 0 ? void 0 : _item[0])) {
704
+ index = i;
705
+ break;
706
+ }
464
707
  }
465
- return values_;
466
- }, [values, minX, maxX, minY, maxY, minMaxPadding, minPadding, maxPadding, minPaddingX, minPaddingY, maxPaddingX, maxPaddingY, noMain]);
467
- refs.minMax.current = minMax;
468
- const onWrapperMouseEnter = react_1.default.useCallback(() => {
469
- if (!refs.guidelinesIn.current)
470
- setGuidelineIn(true);
471
- setHover(true);
472
- }, []);
473
- const onWrapperMouseLeave = react_1.default.useCallback(() => {
474
- setHover(false);
475
- setTimeout(() => {
476
- if (tooltipCloseOnMouseLeave)
477
- setAppend(values_ => (Object.assign(Object.assign({}, values_), { open: false })));
478
- if (!guidelinesDisplayInactive)
479
- setGuidelineIn(false);
480
- setGuidelinePosition({});
481
- });
482
- }, [tooltipCloseOnMouseLeave, guidelinesDisplayInactive]);
483
- const makeGroupTooltip = (x_, y_) => {
484
- const items = refs.allValues.current.filter(item => item.normalized[0] === x_);
485
- const itemsY = (0, utils_1.copy)(items).sort((a, b) => a.normalized[1] - b.normalized[1]);
486
- const x = x_;
487
- const y = itemsY[0].normalized[1];
488
- const groups = {};
489
- items.forEach(item => {
490
- var _a;
491
- const color_ = ((_a = item.item) === null || _a === void 0 ? void 0 : _a.color) || 'primary';
492
- if (!groups[color_])
493
- groups[color_] = [];
494
- groups[color_].push(item);
495
- });
496
- // Group sorted by y largest, to smallest
497
- Object.keys(groups).forEach(group => groups[group].sort((a, b) => { var _a, _b; return ((_a = a.normalized) === null || _a === void 0 ? void 0 : _a[1]) - ((_b = b.normalized) === null || _b === void 0 ? void 0 : _b[1]); }));
498
- // Groups sorted by y largest, to smallest
499
- const groupsSorted = Object.keys(groups).sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = groups[a][0]) === null || _a === void 0 ? void 0 : _a.normalized) === null || _b === void 0 ? void 0 : _b[1]) - ((_d = (_c = groups[b][0]) === null || _c === void 0 ? void 0 : _c.normalized) === null || _d === void 0 ? void 0 : _d[1]); });
500
- const element = (0, utils_1.is)('function', tooltipGroupRender) ? tooltipGroupRender(groups, groupsSorted) : ((0, jsx_runtime_1.jsx)(Line, Object.assign({ tonal: tonal, color: color, elevation: 1, gap: 0.25, direction: 'column', Component: Surface, className: (0, style_react_1.classNames)([
501
- (0, utils_2.staticClassName)('Chart', theme) && [
502
- 'onesy-Chart-append'
503
- ],
504
- classes.append
505
- ]) }, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'column', style: {
506
- width: '100%'
507
- } }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
508
- fontWeight: 600
509
- } }, { children: (names === null || names === void 0 ? void 0 : names.y) || 'y' })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
510
- fontWeight: 600
511
- } }, { children: (names === null || names === void 0 ? void 0 : names.x) || 'x' }))] })), (0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 1, direction: 'column' }, { children: groupsSorted.map((group, index) => {
512
- var _a, _b;
513
- return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'column', style: {
514
- width: '100%'
515
- } }, { children: [(0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
516
- (0, utils_2.staticClassName)('Chart', theme) && [
517
- 'onesy-Chart-append-icon'
518
- ],
519
- classes.append_icon
520
- ]), style: {
521
- background: !refs.theme.current.palette.color[group] ? group : refs.theme.current.palette.color[group][((_b = (_a = groups[group][0]) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.tone) || 'main']
522
- } }), (0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'column', style: {
523
- width: '100%'
524
- } }, { children: groups[group].map((item, index_) => {
525
- var _a, _b, _c, _d;
526
- return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', style: {
527
- width: '100%'
528
- } }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: (0, utils_1.is)('function', labelResolve) ? labelResolve((_a = item === null || item === void 0 ? void 0 : item.values) === null || _a === void 0 ? void 0 : _a[1], 'y', item, 'group') : (_b = item === null || item === void 0 ? void 0 : item.values) === null || _b === void 0 ? void 0 : _b[1] })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: (0, utils_1.is)('function', labelResolve) ? labelResolve((_c = item === null || item === void 0 ? void 0 : item.values) === null || _c === void 0 ? void 0 : _c[0], 'x', item, 'group') : (_d = item === null || item === void 0 ? void 0 : item.values) === null || _d === void 0 ? void 0 : _d[0] }))] }), index_));
529
- }) }))] }), index));
530
- }) }))] })) })));
708
+ if (index === undefined) {
709
+ var _allValues$;
710
+ index = x <= ((_allValues$ = allValues[0]) === null || _allValues$ === void 0 || (_allValues$ = _allValues$.normalized) === null || _allValues$ === void 0 ? void 0 : _allValues$[0]) ? 0 : allValues.length - 1;
711
+ previous = allValues[index - 1];
712
+ item = allValues[index];
713
+ }
714
+ if (previous || item) {
715
+ var _item$normalized, _previous$normalized;
716
+ if (!previous) x = (_item$normalized = item.normalized) === null || _item$normalized === void 0 ? void 0 : _item$normalized[0];else if (!item) x = (_previous$normalized = previous.normalized) === null || _previous$normalized === void 0 ? void 0 : _previous$normalized[0];else {
717
+ const len = item.normalized[0] - previous.normalized[0];
718
+ const part = len / 2;
719
+ x = x < previous.normalized[0] + part ? previous.normalized[0] : item.normalized[0];
720
+ }
721
+ }
722
+ makeGroupTooltip(x, y);
723
+ }
724
+ setGuidelinePosition(value_ => _objectSpread(_objectSpread({}, value_), {}, {
725
+ x,
726
+ y
727
+ }));
728
+ };
729
+ const onMouseMove = event => {
730
+ if (refs.hover.current) {
731
+ const x = event.clientX;
732
+ const y = event.clientY;
733
+ onMove(x, y);
734
+ }
735
+ };
736
+ const onTouchMove = event => {
737
+ if (refs.hover.current) {
738
+ const x = event.touches[0].clientX;
739
+ const y = event.touches[0].clientY;
740
+ onMove(x, y);
741
+ }
742
+ };
743
+ const method = () => {
744
+ if (refs.wrapper.current) {
745
+ const rectWrapper = refs.wrapper.current.getBoundingClientRect();
531
746
  const rectSvg = refs.svg.current.getBoundingClientRect();
532
- const width = 8;
533
- const height = 8;
534
- const rect_ = {
535
- x: (x + rectSvg.x) - width,
536
- y: (y + rectSvg.y) - width,
537
- width,
538
- height
747
+ const rects_ = {
748
+ wrapper: rectWrapper,
749
+ svg: rectSvg
539
750
  };
540
- rect_.top = rect_.y;
541
- rect_.bottom = rect_.y + height;
542
- rect_.left = rect_.x;
543
- rect_.right = rect_.x + width;
544
- setAppend({
545
- open: true,
546
- element,
547
- rect: rect_
548
- });
751
+ setRects(rects_);
752
+ if ((0, _utils.is)('function', onUpdateRects)) onUpdateRects(rects_);
753
+ }
549
754
  };
550
- react_1.default.useEffect(() => {
551
- var _a;
552
- const onMove = (x_, y_) => {
553
- var _a, _b, _c, _d, _e, _f;
554
- // Only horizontal move at the moment
555
- // ie. vertical guidelines
556
- const rectWrapper = refs.rects.current.wrapper;
557
- const rectSvg = refs.svg.current.getBoundingClientRect();
558
- let x = (0, utils_1.clamp)(x_ - (rectSvg === null || rectSvg === void 0 ? void 0 : rectSvg.x), 0, rectWrapper === null || rectWrapper === void 0 ? void 0 : rectWrapper.width);
559
- const y = (0, utils_1.clamp)(y_ - (rectSvg === null || rectSvg === void 0 ? void 0 : rectSvg.y), 0, rectWrapper === null || rectWrapper === void 0 ? void 0 : rectWrapper.height);
560
- if (refs.guidelinesAppend.current && ['both', 'vertical'].includes(refs.guidelines.current)) {
561
- const allValues = refs.allValues.current;
562
- let index;
563
- let previous;
564
- let item;
565
- for (let i = 0; i < allValues.length; i++) {
566
- previous = allValues[i - 1];
567
- item = allValues[i];
568
- if (((_a = previous === null || previous === void 0 ? void 0 : previous.normalized) === null || _a === void 0 ? void 0 : _a[0]) <= x && x <= ((_b = item === null || item === void 0 ? void 0 : item.normalized) === null || _b === void 0 ? void 0 : _b[0])) {
569
- index = i;
570
- break;
571
- }
572
- }
573
- if (index === undefined) {
574
- index = x <= ((_d = (_c = allValues[0]) === null || _c === void 0 ? void 0 : _c.normalized) === null || _d === void 0 ? void 0 : _d[0]) ? 0 : allValues.length - 1;
575
- previous = allValues[index - 1];
576
- item = allValues[index];
577
- }
578
- if (previous || item) {
579
- if (!previous)
580
- x = (_e = item.normalized) === null || _e === void 0 ? void 0 : _e[0];
581
- else if (!item)
582
- x = (_f = previous.normalized) === null || _f === void 0 ? void 0 : _f[0];
583
- else {
584
- const len = item.normalized[0] - previous.normalized[0];
585
- const part = len / 2;
586
- x = x < (previous.normalized[0] + part) ? previous.normalized[0] : item.normalized[0];
587
- }
588
- }
589
- makeGroupTooltip(x, y);
590
- }
591
- setGuidelinePosition(value_ => (Object.assign(Object.assign({}, value_), { x,
592
- y })));
593
- };
594
- const onMouseMove = (event) => {
595
- if (refs.hover.current) {
596
- const x = event.clientX;
597
- const y = event.clientY;
598
- onMove(x, y);
599
- }
600
- };
601
- const onTouchMove = (event) => {
602
- if (refs.hover.current) {
603
- const x = event.touches[0].clientX;
604
- const y = event.touches[0].clientY;
605
- onMove(x, y);
606
- }
607
- };
608
- const method = () => {
609
- if (refs.wrapper.current) {
610
- const rectWrapper = refs.wrapper.current.getBoundingClientRect();
611
- const rectSvg = refs.svg.current.getBoundingClientRect();
612
- const rects_ = {
613
- wrapper: rectWrapper,
614
- svg: rectSvg
615
- };
616
- setRects(rects_);
617
- if ((0, utils_1.is)('function', onUpdateRects))
618
- onUpdateRects(rects_);
619
- }
620
- };
621
- method();
622
- const observer = new ResizeObserver(method);
623
- observer.observe(refs.root.current);
624
- const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
625
- rootDocument.addEventListener('mousemove', onMouseMove);
626
- rootDocument.addEventListener('touchmove', onTouchMove);
627
- rootDocument.addEventListener('touchend', onWrapperMouseLeave);
628
- return () => {
629
- observer.disconnect();
630
- rootDocument.removeEventListener('mousemove', onMouseMove);
631
- rootDocument.removeEventListener('touchmove', onTouchMove);
632
- rootDocument.removeEventListener('touchend', onWrapperMouseLeave);
633
- };
634
- }, []);
635
- react_1.default.useEffect(() => {
636
- make();
637
- }, [values, labels__, marks__, grid__, additionalLines__, legend__, visible, (guidelinesAppend && guidelinesPosition), rects, theme]);
638
- const onPointMouseEnter = react_1.default.useCallback((values_) => {
639
- if (tooltipIndividually) {
640
- setAppend(Object.assign(Object.assign({}, ((0, utils_1.is)('function', tooltipRender) ? tooltipRender(values_) : values_)), { rect: values_.rect, open: true }));
641
- }
642
- }, [tooltipRender, tooltipIndividually]);
643
- const onPointMouseLeave = react_1.default.useCallback(() => {
644
- setAppend(append_ => (Object.assign(Object.assign({}, append_), { open: false })));
645
- }, []);
646
- const onLegendClick = (value) => {
647
- if (value !== undefined && legendManageVisibility) {
648
- setVisible((visible_) => (Object.assign(Object.assign({}, visible_), { [value]: ![undefined, true].includes(visible_[value]) })));
649
- }
755
+ method();
756
+ const observer = new ResizeObserver(method);
757
+ observer.observe(refs.root.current);
758
+ 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;
759
+ rootDocument.addEventListener('mousemove', onMouseMove);
760
+ rootDocument.addEventListener('touchmove', onTouchMove);
761
+ rootDocument.addEventListener('touchend', onWrapperMouseLeave);
762
+ return () => {
763
+ observer.disconnect();
764
+ rootDocument.removeEventListener('mousemove', onMouseMove);
765
+ rootDocument.removeEventListener('touchmove', onTouchMove);
766
+ rootDocument.removeEventListener('touchend', onWrapperMouseLeave);
650
767
  };
651
- const LegendItem = react_1.default.useCallback((props__) => {
652
- const { item = {}, className: className_ } = props__, other_ = __rest(props__, ["item", "className"]);
653
- const { color: color_, tone = 'main', name = 'No name' } = item;
654
- return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, LegendItemProps, { className: (0, style_react_1.classNames)([
655
- (0, utils_2.staticClassName)('Chart', theme) && [
656
- 'onesy-Chart-legend-item'
657
- ],
658
- className_,
659
- LegendItemProps === null || LegendItemProps === void 0 ? void 0 : LegendItemProps.className,
660
- classes.legend_item
661
- ]) }, other_, { children: [(0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
662
- (0, utils_2.staticClassName)('Chart', theme) && [
663
- 'onesy-Chart-legend-icon'
664
- ],
665
- classes.legend_icon
666
- ]), style: {
667
- color: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone],
668
- background: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone]
669
- } }), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2' }, { children: name }))] })));
670
- }, [theme]);
671
- const make = (valueNew = refs.values.current) => {
672
- // Make values into x, y, coordinates
673
- // normalized in rect width, height values
674
- // invert y so 0, 0 is at bottom left
675
- if (refs.rects.current && valueNew && !noMain) {
676
- const { width, height } = refs.rects.current.wrapper;
677
- // Labels
678
- const labels_ = {
679
- x: (0, utils_1.is)('array', labels__ === null || labels__ === void 0 ? void 0 : labels__.x) ? labels__.x : (0, utils_2.minMaxBetweenNumbers)(labelsXAutoNumber !== undefined ? labelsXAutoNumber : labelsAutoNumber !== undefined ? labelsAutoNumber : 10, refs.minMax.current.min.x, refs.minMax.current.max.x).map(item => ({
680
- value: item,
681
- label: (0, utils_1.castParam)((item).toFixed(labelDecimalPlaces || 0))
682
- })),
683
- y: (0, utils_1.is)('array', labels__ === null || labels__ === void 0 ? void 0 : labels__.y) ? labels__.y : (0, utils_2.minMaxBetweenNumbers)(labelsYAutoNumber !== undefined ? labelsYAutoNumber : labelsAutoNumber !== undefined ? labelsAutoNumber : 10, refs.minMax.current.min.y, refs.minMax.current.max.y).map(item => ({
684
- value: item,
685
- label: (0, utils_1.castParam)((item).toFixed(labelDecimalPlaces || 0))
686
- }))
687
- };
688
- labels_.x = labels_.x.map(item => (Object.assign(Object.assign({}, item), { percentage: (0, utils_1.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.x, refs.minMax.current.max.x) })));
689
- labels_.y = labels_.y.map(item => (Object.assign(Object.assign({}, item), { percentage: (0, utils_1.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.y, refs.minMax.current.max.y) })));
690
- // Marks
691
- const marks_ = {
692
- x: (0, utils_1.is)('array', marks__ === null || marks__ === void 0 ? void 0 : marks__.x) ? marks__.x : (0, utils_2.minMaxBetweenNumbers)(marksXAutoNumber !== undefined ? marksXAutoNumber : marksAutoNumber !== undefined ? marksAutoNumber : 10, refs.minMax.current.min.x, refs.minMax.current.max.x).map(item => ({
693
- value: item
694
- })),
695
- y: (0, utils_1.is)('array', marks__ === null || marks__ === void 0 ? void 0 : marks__.y) ? marks__.y : (0, utils_2.minMaxBetweenNumbers)(marksYAutoNumber !== undefined ? marksYAutoNumber : marksAutoNumber !== undefined ? marksAutoNumber : 10, refs.minMax.current.min.y, refs.minMax.current.max.y).map(item => ({
696
- value: item
697
- }))
698
- };
699
- marks_.x = marks_.x.map(item => (Object.assign(Object.assign({}, item), { percentage: (0, utils_1.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.x, refs.minMax.current.max.x) })));
700
- marks_.y = marks_.y.map(item => (Object.assign(Object.assign({}, item), { percentage: (0, utils_1.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.y, refs.minMax.current.max.y) })));
701
- // Grid
702
- const grid_ = {
703
- x: (0, utils_1.is)('array', grid__ === null || grid__ === void 0 ? void 0 : grid__.x) ? grid__.x : (0, utils_2.minMaxBetweenNumbers)(gridXAutoNumber !== undefined ? gridXAutoNumber : gridAutoNumber !== undefined ? gridAutoNumber : 10, refs.minMax.current.min.x, refs.minMax.current.max.x).map(item => ({
704
- value: item
705
- })),
706
- y: (0, utils_1.is)('array', grid__ === null || grid__ === void 0 ? void 0 : grid__.y) ? grid__.y : (0, utils_2.minMaxBetweenNumbers)(gridYAutoNumber !== undefined ? gridYAutoNumber : gridAutoNumber !== undefined ? gridAutoNumber : 10, refs.minMax.current.min.y, refs.minMax.current.max.y).map(item => ({
707
- value: item
708
- }))
709
- };
710
- grid_.x = grid_.x.map(item => (Object.assign(Object.assign({}, item), { percentage: (0, utils_1.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.x, refs.minMax.current.max.x) })));
711
- grid_.y = grid_.y.map(item => (Object.assign(Object.assign({}, item), { percentage: (0, utils_1.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.y, refs.minMax.current.max.y) })));
712
- refs.allValues.current = [];
713
- // Points
714
- const points_ = (0, utils_1.copy)(valueNew).flatMap(item => {
715
- var _a;
716
- const { color: color_, tone = 'main', name } = item;
717
- const itemValues = ([x, y, ...args]) => {
718
- const values__ = {
719
- x: (0, utils_1.percentageFromValueWithinRange)(x, refs.minMax.current.min.x, refs.minMax.current.max.x),
720
- y: (0, utils_1.percentageFromValueWithinRange)(y, refs.minMax.current.min.y, refs.minMax.current.max.y)
721
- };
722
- values__.x = (0, utils_1.valueFromPercentageWithinRange)(values__.x, 0, width);
723
- values__.y = (0, utils_1.valueFromPercentageWithinRange)(values__.y, 0, height);
724
- if (refs.visible.current[name] !== false) {
725
- refs.allValues.current.push({
726
- item,
727
- values: [x, y, ...args],
728
- normalized: [values__.x, height - values__.y].map(item_ => Math.abs(item_))
729
- });
730
- }
731
- return {
732
- values: [x, y, ...args],
733
- normalized: [values__.x, height - values__.y].map(item_ => Math.abs(item_))
734
- };
735
- };
736
- const itemArrayNested = (0, utils_1.is)('array', (_a = item.values) === null || _a === void 0 ? void 0 : _a[0]);
737
- const values_ = itemArrayNested ? (0, utils_1.copy)(item.values)
738
- // Sort for x from smallest to largest
739
- .sort((a, b) => a[0] - b[0])
740
- .map(itemValues) : [itemValues(item.values)];
741
- return values_.map((item_, index) => ((0, jsx_runtime_1.jsx)(Path, Object.assign({ Component: 'circle', r: 4, cx: item_.normalized[0], cy: item_.normalized[1], fill: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone], stroke: 'none' }, (!elementTooltip ? {
742
- onMouseEnter: event => {
743
- const rect_ = event.target.getBoundingClientRect();
744
- onPointMouseEnter({
745
- values: item_.values,
746
- rect: rect_
747
- });
748
- },
749
- onMouseLeave: onPointMouseLeave
750
- } : undefined), PointProps, { className: (0, style_react_1.classNames)([
751
- (0, utils_2.staticClassName)('Chart', theme) && [
752
- 'onesy-Chart-point'
753
- ],
754
- PointProps === null || PointProps === void 0 ? void 0 : PointProps.className,
755
- classes.point,
756
- classes[`point_visibility_${pointsVisibility}`],
757
- (refs.guidelinesAppend.current && refs.guidelinesPosition.current.x === item_.normalized[0]) && classes.point_active
758
- ]), style: Object.assign(Object.assign({}, (refs.visible.current[name] === false ? {
759
- opacity: 0,
760
- pointerEvents: 'none'
761
- } : undefined)), PointProps === null || PointProps === void 0 ? void 0 : PointProps.style) }), index)));
768
+ }, []);
769
+ _react.default.useEffect(() => {
770
+ make();
771
+ }, [values, labels__, marks__, grid__, additionalLines__, legend__, visible, guidelinesAppend && guidelinesPosition, rects, theme]);
772
+ const onPointMouseEnter = _react.default.useCallback(values_ => {
773
+ if (tooltipIndividually) {
774
+ setAppend(_objectSpread(_objectSpread({}, (0, _utils.is)('function', tooltipRender) ? tooltipRender(values_) : values_), {}, {
775
+ rect: values_.rect,
776
+ open: true
777
+ }));
778
+ }
779
+ }, [tooltipRender, tooltipIndividually]);
780
+ const onPointMouseLeave = _react.default.useCallback(() => {
781
+ setAppend(append_ => _objectSpread(_objectSpread({}, append_), {}, {
782
+ open: false
783
+ }));
784
+ }, []);
785
+ const onLegendClick = value => {
786
+ if (value !== undefined && legendManageVisibility) {
787
+ setVisible(visible_ => _objectSpread(_objectSpread({}, visible_), {}, {
788
+ [value]: ![undefined, true].includes(visible_[value])
789
+ }));
790
+ }
791
+ };
792
+ const LegendItem = _react.default.useCallback(props__ => {
793
+ const {
794
+ item = {},
795
+ className: className_
796
+ } = props__,
797
+ other_ = (0, _objectWithoutProperties2.default)(props__, _excluded2);
798
+ const {
799
+ color: color_,
800
+ tone = 'main',
801
+ name = 'No name'
802
+ } = item;
803
+ return /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
804
+ gap: 1,
805
+ direction: "row",
806
+ align: "center"
807
+ }, LegendItemProps, {
808
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-legend-item'], className_, LegendItemProps === null || LegendItemProps === void 0 ? void 0 : LegendItemProps.className, classes.legend_item])
809
+ }, other_), /*#__PURE__*/_react.default.createElement("span", {
810
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-legend-icon'], classes.legend_icon]),
811
+ style: {
812
+ color: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone],
813
+ background: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone]
814
+ }
815
+ }), /*#__PURE__*/_react.default.createElement(Type, {
816
+ version: "b2"
817
+ }, name));
818
+ }, [theme]);
819
+ const make = (valueNew = refs.values.current) => {
820
+ // Make values into x, y, coordinates
821
+ // normalized in rect width, height values
822
+
823
+ // invert y so 0, 0 is at bottom left
824
+ if (refs.rects.current && valueNew && !noMain) {
825
+ const {
826
+ width,
827
+ height
828
+ } = refs.rects.current.wrapper;
829
+
830
+ // Labels
831
+ const labels_ = {
832
+ x: (0, _utils.is)('array', labels__ === null || labels__ === void 0 ? void 0 : labels__.x) ? labels__.x : (0, _utils2.minMaxBetweenNumbers)(labelsXAutoNumber !== undefined ? labelsXAutoNumber : labelsAutoNumber !== undefined ? labelsAutoNumber : 10, refs.minMax.current.min.x, refs.minMax.current.max.x).map(item => ({
833
+ value: item,
834
+ label: (0, _utils.castParam)(item.toFixed(labelDecimalPlaces || 0))
835
+ })),
836
+ y: (0, _utils.is)('array', labels__ === null || labels__ === void 0 ? void 0 : labels__.y) ? labels__.y : (0, _utils2.minMaxBetweenNumbers)(labelsYAutoNumber !== undefined ? labelsYAutoNumber : labelsAutoNumber !== undefined ? labelsAutoNumber : 10, refs.minMax.current.min.y, refs.minMax.current.max.y).map(item => ({
837
+ value: item,
838
+ label: (0, _utils.castParam)(item.toFixed(labelDecimalPlaces || 0))
839
+ }))
840
+ };
841
+ labels_.x = labels_.x.map(item => _objectSpread(_objectSpread({}, item), {}, {
842
+ percentage: (0, _utils.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.x, refs.minMax.current.max.x)
843
+ }));
844
+ labels_.y = labels_.y.map(item => _objectSpread(_objectSpread({}, item), {}, {
845
+ percentage: (0, _utils.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.y, refs.minMax.current.max.y)
846
+ }));
847
+
848
+ // Marks
849
+ const marks_ = {
850
+ x: (0, _utils.is)('array', marks__ === null || marks__ === void 0 ? void 0 : marks__.x) ? marks__.x : (0, _utils2.minMaxBetweenNumbers)(marksXAutoNumber !== undefined ? marksXAutoNumber : marksAutoNumber !== undefined ? marksAutoNumber : 10, refs.minMax.current.min.x, refs.minMax.current.max.x).map(item => ({
851
+ value: item
852
+ })),
853
+ y: (0, _utils.is)('array', marks__ === null || marks__ === void 0 ? void 0 : marks__.y) ? marks__.y : (0, _utils2.minMaxBetweenNumbers)(marksYAutoNumber !== undefined ? marksYAutoNumber : marksAutoNumber !== undefined ? marksAutoNumber : 10, refs.minMax.current.min.y, refs.minMax.current.max.y).map(item => ({
854
+ value: item
855
+ }))
856
+ };
857
+ marks_.x = marks_.x.map(item => _objectSpread(_objectSpread({}, item), {}, {
858
+ percentage: (0, _utils.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.x, refs.minMax.current.max.x)
859
+ }));
860
+ marks_.y = marks_.y.map(item => _objectSpread(_objectSpread({}, item), {}, {
861
+ percentage: (0, _utils.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.y, refs.minMax.current.max.y)
862
+ }));
863
+
864
+ // Grid
865
+ const grid_ = {
866
+ x: (0, _utils.is)('array', grid__ === null || grid__ === void 0 ? void 0 : grid__.x) ? grid__.x : (0, _utils2.minMaxBetweenNumbers)(gridXAutoNumber !== undefined ? gridXAutoNumber : gridAutoNumber !== undefined ? gridAutoNumber : 10, refs.minMax.current.min.x, refs.minMax.current.max.x).map(item => ({
867
+ value: item
868
+ })),
869
+ y: (0, _utils.is)('array', grid__ === null || grid__ === void 0 ? void 0 : grid__.y) ? grid__.y : (0, _utils2.minMaxBetweenNumbers)(gridYAutoNumber !== undefined ? gridYAutoNumber : gridAutoNumber !== undefined ? gridAutoNumber : 10, refs.minMax.current.min.y, refs.minMax.current.max.y).map(item => ({
870
+ value: item
871
+ }))
872
+ };
873
+ grid_.x = grid_.x.map(item => _objectSpread(_objectSpread({}, item), {}, {
874
+ percentage: (0, _utils.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.x, refs.minMax.current.max.x)
875
+ }));
876
+ grid_.y = grid_.y.map(item => _objectSpread(_objectSpread({}, item), {}, {
877
+ percentage: (0, _utils.percentageFromValueWithinRange)(item.value, refs.minMax.current.min.y, refs.minMax.current.max.y)
878
+ }));
879
+ refs.allValues.current = [];
880
+
881
+ // Points
882
+ const points_ = (0, _utils.copy)(valueNew).flatMap(item => {
883
+ var _item$values5;
884
+ const {
885
+ color: color_,
886
+ tone = 'main',
887
+ name
888
+ } = item;
889
+ const itemValues = ([x, y, ...args]) => {
890
+ const values__ = {
891
+ x: (0, _utils.percentageFromValueWithinRange)(x, refs.minMax.current.min.x, refs.minMax.current.max.x),
892
+ y: (0, _utils.percentageFromValueWithinRange)(y, refs.minMax.current.min.y, refs.minMax.current.max.y)
893
+ };
894
+ values__.x = (0, _utils.valueFromPercentageWithinRange)(values__.x, 0, width);
895
+ values__.y = (0, _utils.valueFromPercentageWithinRange)(values__.y, 0, height);
896
+ if (refs.visible.current[name] !== false) {
897
+ refs.allValues.current.push({
898
+ item,
899
+ values: [x, y, ...args],
900
+ normalized: [values__.x, height - values__.y].map(item_ => Math.abs(item_))
762
901
  });
763
- refs.allValues.current.sort((a, b) => (a === null || a === void 0 ? void 0 : a.normalized[0]) - (b === null || b === void 0 ? void 0 : b.normalized[0]));
764
- // Guidelines
765
- const additionalLines_ = additionalLines__ && additionalLines__.map((item, index) => {
766
- const { color: color_, tone = 'main', style } = item;
767
- const values_ = {
768
- x1: (0, utils_1.percentageFromValueWithinRange)(item.x1, refs.minMax.current.min.x, refs.minMax.current.max.x),
769
- y1: (0, utils_1.percentageFromValueWithinRange)(item.y1, refs.minMax.current.min.y, refs.minMax.current.max.y),
770
- x2: (0, utils_1.percentageFromValueWithinRange)(item.x2, refs.minMax.current.min.x, refs.minMax.current.max.x),
771
- y2: (0, utils_1.percentageFromValueWithinRange)(item.y2, refs.minMax.current.min.y, refs.minMax.current.max.y),
772
- };
773
- values_.x1 = (0, utils_1.valueFromPercentageWithinRange)(values_.x1, 0, width);
774
- values_.y1 = (0, utils_1.valueFromPercentageWithinRange)(values_.y1, 0, height);
775
- values_.x2 = (0, utils_1.valueFromPercentageWithinRange)(values_.x2, 0, width);
776
- values_.y2 = (0, utils_1.valueFromPercentageWithinRange)(values_.y2, 0, height);
777
- return ((0, jsx_runtime_1.jsx)(Path, Object.assign({ d: `M ${values_.x1} ${height - values_.y1} L ${values_.x2} ${height - values_.y2}`, fill: 'none', stroke: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone] }, AdditionalLineProps, { className: (0, style_react_1.classNames)([
778
- (0, utils_2.staticClassName)('Chart', theme) && [
779
- 'onesy-Chart-additional-lines'
780
- ],
781
- AdditionalLineProps === null || AdditionalLineProps === void 0 ? void 0 : AdditionalLineProps.className,
782
- classes.additionalLines
783
- ]), style: Object.assign(Object.assign({}, style), AdditionalLineProps === null || AdditionalLineProps === void 0 ? void 0 : AdditionalLineProps.style) }), index));
902
+ }
903
+ return {
904
+ values: [x, y, ...args],
905
+ normalized: [values__.x, height - values__.y].map(item_ => Math.abs(item_))
906
+ };
907
+ };
908
+ const itemArrayNested = (0, _utils.is)('array', (_item$values5 = item.values) === null || _item$values5 === void 0 ? void 0 : _item$values5[0]);
909
+ const values_ = itemArrayNested ? (0, _utils.copy)(item.values)
910
+ // Sort for x from smallest to largest
911
+ .sort((a, b) => a[0] - b[0]).map(itemValues) : [itemValues(item.values)];
912
+ return values_.map((item_, index) => /*#__PURE__*/_react.default.createElement(Path, (0, _extends2.default)({
913
+ key: index,
914
+ Component: "circle",
915
+ r: 4,
916
+ cx: item_.normalized[0],
917
+ cy: item_.normalized[1],
918
+ fill: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone],
919
+ stroke: "none"
920
+ }, !elementTooltip ? {
921
+ onMouseEnter: event => {
922
+ const rect_ = event.target.getBoundingClientRect();
923
+ onPointMouseEnter({
924
+ values: item_.values,
925
+ rect: rect_
784
926
  });
785
- // Labels
786
- setLabels(labels_);
787
- // Marks
788
- setMarks(marks_);
789
- // Grid
790
- setGrid(grid_);
791
- // Guidelines
792
- setAdditionalLines(additionalLines_);
793
- // Update children value
794
- setPoints(points_);
927
+ },
928
+ onMouseLeave: onPointMouseLeave
929
+ } : undefined, PointProps, {
930
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-point'], PointProps === null || PointProps === void 0 ? void 0 : PointProps.className, classes.point, classes[`point_visibility_${pointsVisibility}`], refs.guidelinesAppend.current && refs.guidelinesPosition.current.x === item_.normalized[0] && classes.point_active]),
931
+ style: _objectSpread(_objectSpread({}, refs.visible.current[name] === false ? {
932
+ opacity: 0,
933
+ pointerEvents: 'none'
934
+ } : undefined), PointProps === null || PointProps === void 0 ? void 0 : PointProps.style)
935
+ })));
936
+ });
937
+ refs.allValues.current.sort((a, b) => (a === null || a === void 0 ? void 0 : a.normalized[0]) - (b === null || b === void 0 ? void 0 : b.normalized[0]));
938
+
939
+ // Guidelines
940
+ const additionalLines_ = additionalLines__ && additionalLines__.map((item, index) => {
941
+ const {
942
+ color: color_,
943
+ tone = 'main',
944
+ style
945
+ } = item;
946
+ const values_ = {
947
+ x1: (0, _utils.percentageFromValueWithinRange)(item.x1, refs.minMax.current.min.x, refs.minMax.current.max.x),
948
+ y1: (0, _utils.percentageFromValueWithinRange)(item.y1, refs.minMax.current.min.y, refs.minMax.current.max.y),
949
+ x2: (0, _utils.percentageFromValueWithinRange)(item.x2, refs.minMax.current.min.x, refs.minMax.current.max.x),
950
+ y2: (0, _utils.percentageFromValueWithinRange)(item.y2, refs.minMax.current.min.y, refs.minMax.current.max.y)
951
+ };
952
+ values_.x1 = (0, _utils.valueFromPercentageWithinRange)(values_.x1, 0, width);
953
+ values_.y1 = (0, _utils.valueFromPercentageWithinRange)(values_.y1, 0, height);
954
+ values_.x2 = (0, _utils.valueFromPercentageWithinRange)(values_.x2, 0, width);
955
+ values_.y2 = (0, _utils.valueFromPercentageWithinRange)(values_.y2, 0, height);
956
+ return /*#__PURE__*/_react.default.createElement(Path, (0, _extends2.default)({
957
+ key: index,
958
+ d: `M ${values_.x1} ${height - values_.y1} L ${values_.x2} ${height - values_.y2}`,
959
+ fill: "none",
960
+ stroke: !theme.palette.color[color_] ? color_ : theme.palette.color[color_][tone]
961
+ }, AdditionalLineProps, {
962
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-additional-lines'], AdditionalLineProps === null || AdditionalLineProps === void 0 ? void 0 : AdditionalLineProps.className, classes.additionalLines]),
963
+ style: _objectSpread(_objectSpread({}, style), AdditionalLineProps === null || AdditionalLineProps === void 0 ? void 0 : AdditionalLineProps.style)
964
+ }));
965
+ });
966
+
967
+ // Labels
968
+ setLabels(labels_);
969
+
970
+ // Marks
971
+ setMarks(marks_);
972
+
973
+ // Grid
974
+ setGrid(grid_);
975
+
976
+ // Guidelines
977
+ setAdditionalLines(additionalLines_);
978
+
979
+ // Update children value
980
+ setPoints(points_);
981
+ }
982
+
983
+ // Legend
984
+ const legend_ = legend__ !== 'auto' ? legend__ : [];
985
+ if (legend__ === 'auto') {
986
+ const map = {};
987
+ values.forEach(item => {
988
+ const name = (item === null || item === void 0 ? void 0 : item.name) || '';
989
+ if (!map[name]) {
990
+ legend_.push({
991
+ item,
992
+ element: /*#__PURE__*/_react.default.createElement(LegendItem, {
993
+ item: item
994
+ })
995
+ });
996
+ map[name] = true;
795
997
  }
796
- // Legend
797
- const legend_ = legend__ !== 'auto' ? legend__ : [];
798
- if (legend__ === 'auto') {
799
- const map = {};
800
- values.forEach((item) => {
801
- const name = (item === null || item === void 0 ? void 0 : item.name) || '';
802
- if (!map[name]) {
803
- legend_.push({
804
- item,
805
- element: ((0, jsx_runtime_1.jsx)(LegendItem, { item: item }))
806
- });
807
- map[name] = true;
808
- }
809
- });
998
+ });
999
+ }
1000
+
1001
+ // Legend
1002
+ if ((0, _utils.is)('array', legend_)) setLegend(legend_);
1003
+ };
1004
+ return /*#__PURE__*/_react.default.createElement(Surface, (0, _extends2.default)({
1005
+ ref: item => {
1006
+ if (ref) {
1007
+ if ((0, _utils.is)('function', ref)) ref(item);else ref.current = item;
1008
+ }
1009
+ refs.root.current = item;
1010
+ },
1011
+ tonal: tonal,
1012
+ color: color,
1013
+ gap: 0,
1014
+ direction: "column",
1015
+ align: "center",
1016
+ Component: Line,
1017
+ AdditionalProps: {
1018
+ Component
1019
+ },
1020
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-root'], className, classes.root])
1021
+ }, other), (title || subtitle) && /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
1022
+ gap: 0.5,
1023
+ align: "center",
1024
+ justify: "center"
1025
+ }, HeaderProps, {
1026
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-header'], HeaderProps === null || HeaderProps === void 0 ? void 0 : HeaderProps.className, classes.header, (labels === null || labels === void 0 ? void 0 : labels.y) && labelsY && classes.legend_offset_labels_y, (names === null || names === void 0 ? void 0 : names.y) && nameY && classes.legend_offset_names_y])
1027
+ }), (0, _utils.is)('simple', title) ? /*#__PURE__*/_react.default.createElement(Type, (0, _extends2.default)({
1028
+ version: "t2"
1029
+ }, TypeProps, TitleProps, {
1030
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-title'], TypeProps === null || TypeProps === void 0 ? void 0 : TypeProps.className, TitleProps === null || TitleProps === void 0 ? void 0 : TitleProps.className, classes.title])
1031
+ }), title) : title, (0, _utils.is)('simple', subtitle) ? /*#__PURE__*/_react.default.createElement(Type, (0, _extends2.default)({
1032
+ version: "b3"
1033
+ }, TypeProps, SubtitleProps, {
1034
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-title'], TypeProps === null || TypeProps === void 0 ? void 0 : TypeProps.className, SubtitleProps === null || SubtitleProps === void 0 ? void 0 : SubtitleProps.className, classes.subtitle])
1035
+ }), subtitle) : subtitle), legend__ && legendPosition === 'top' && legend && /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
1036
+ gap: 2,
1037
+ direction: "row",
1038
+ align: "center",
1039
+ justify: "center",
1040
+ wrap: "wrap"
1041
+ }, LegendProps, {
1042
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-legend', `onesy-Chart-legend-position-${legendPosition}`], LegendProps === null || LegendProps === void 0 ? void 0 : LegendProps.className, classes.legend, classes[`legend_position_${legendPosition}`], (labels === null || labels === void 0 ? void 0 : labels.y) && labelsY && classes.legend_offset_labels_y, (names === null || names === void 0 ? void 0 : names.y) && nameY && classes.legend_offset_names_y])
1043
+ }), legend.map(({
1044
+ item,
1045
+ element
1046
+ }) => {
1047
+ var _element$props;
1048
+ return /*#__PURE__*/_react.default.cloneElement(element, {
1049
+ onClick: () => onLegendClick(item.name),
1050
+ className: (0, _styleReact.classNames)([element === null || element === void 0 || (_element$props = element.props) === null || _element$props === void 0 ? void 0 : _element$props.className, legendManageVisibility && classes.legend_item_manage_visibility, refs.visible.current[item.name] === false && classes.legend_item_hidden])
1051
+ });
1052
+ })), /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
1053
+ ref: refs.wrapper
1054
+ }, WrapperProps, {
1055
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-wrapper'], WrapperProps === null || WrapperProps === void 0 ? void 0 : WrapperProps.className, classes.wrapper, (labels === null || labels === void 0 ? void 0 : labels.x) && (labels === null || labels === void 0 ? void 0 : labels.y) && labelsX && labelsY && classes.wrapper_labels, !(labels !== null && labels !== void 0 && labels.x && labels !== null && labels !== void 0 && labels.y && labelsX && labelsY) && (labels === null || labels === void 0 ? void 0 : labels.x) && labelsX && classes.wrapper_label_x, !(labels !== null && labels !== void 0 && labels.x && labels !== null && labels !== void 0 && labels.y && labelsX && labelsY) && (labels === null || labels === void 0 ? void 0 : labels.y) && labelsY && classes.wrapper_label_y, (names === null || names === void 0 ? void 0 : names.x) && (names === null || names === void 0 ? void 0 : names.y) && nameX && nameY && classes.wrapper_names, !(names !== null && names !== void 0 && names.x && names !== null && names !== void 0 && names.y && nameX && nameY) && (names === null || names === void 0 ? void 0 : names.x) && nameX && classes.wrapper_name_x, !(names !== null && names !== void 0 && names.x && names !== null && names !== void 0 && names.y && nameX && nameY) && (names === null || names === void 0 ? void 0 : names.y) && nameY && classes.wrapper_name_y])
1056
+ }), /*#__PURE__*/_react.default.createElement(Surface, {
1057
+ tonal: tonal,
1058
+ color: color
1059
+ }, ({
1060
+ color: color_,
1061
+ backgroundColor,
1062
+ palette
1063
+ }) => {
1064
+ var _rects$wrapper, _rects$wrapper2, _rects$wrapper3, _rects$wrapper4;
1065
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !!grid__ && gridX && (grid === null || grid === void 0 ? void 0 : grid.x) && /*#__PURE__*/_react.default.createElement(Line, {
1066
+ gap: 0,
1067
+ direction: "row",
1068
+ align: "flex-start",
1069
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-grids', 'onesy-Chart-grids-x'], classes.grids, classes.grids_x])
1070
+ }, grid.x.map((item, index) => /*#__PURE__*/_react.default.createElement("div", {
1071
+ key: index,
1072
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-grid', 'onesy-Chart-grid-x'], classes.grid, classes.grid_x]),
1073
+ style: {
1074
+ left: `${item.percentage}%`
1075
+ }
1076
+ }))), !!grid__ && gridY && (grid === null || grid === void 0 ? void 0 : grid.y) && /*#__PURE__*/_react.default.createElement(Line, {
1077
+ gap: 0,
1078
+ direction: "column",
1079
+ align: "flex-end",
1080
+ justify: "center",
1081
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-grids', 'onesy-Chart-grids-y'], classes.grids, classes.grids_y])
1082
+ }, grid.y.map((item, index) => /*#__PURE__*/_react.default.createElement("div", {
1083
+ key: index,
1084
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-grid', 'onesy-Chart-grid-y'], classes.grid, classes.grid_y]),
1085
+ style: {
1086
+ bottom: `${item.percentage}%`
1087
+ }
1088
+ }))), /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({
1089
+ ref: refs.svg,
1090
+ xmlns: "http://www.w3.org/2000/svg",
1091
+ viewBox: `0 0 ${(rects === null || rects === void 0 || (_rects$wrapper = rects.wrapper) === null || _rects$wrapper === void 0 ? void 0 : _rects$wrapper.width) || 0} ${(rects === null || rects === void 0 || (_rects$wrapper2 = rects.wrapper) === null || _rects$wrapper2 === void 0 ? void 0 : _rects$wrapper2.height) || 0}`
1092
+ }, guidelines ? {
1093
+ onMouseEnter: onWrapperMouseEnter,
1094
+ onTouchStart: onWrapperMouseEnter,
1095
+ onMouseLeave: onWrapperMouseLeave
1096
+ } : undefined, SvgProps, {
1097
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-svg'], SvgProps === null || SvgProps === void 0 ? void 0 : SvgProps.className, classes.svg])
1098
+ }), /*#__PURE__*/_react.default.createElement("defs", {
1099
+ ref: refs.defs
1100
+ }, defs && defs.map((item, index) => (/*#__PURE__*/_react.default.cloneElement(item, {
1101
+ key: index
1102
+ })))), pre, elements && elements.map(({
1103
+ item,
1104
+ element
1105
+ }, index) => {
1106
+ var _props;
1107
+ const isVisible = visible[item === null || item === void 0 ? void 0 : item.name] === undefined || !!visible[item === null || item === void 0 ? void 0 : item.name];
1108
+ return /*#__PURE__*/_react.default.cloneElement(element, _objectSpread(_objectSpread({
1109
+ key: index
1110
+ }, elementTooltip ? {
1111
+ onMouseEnter: event => {
1112
+ const rect_ = event.target.getBoundingClientRect();
1113
+ onPointMouseEnter(_objectSpread(_objectSpread({}, item), {}, {
1114
+ rect: rect_
1115
+ }));
1116
+ },
1117
+ onMouseLeave: onPointMouseLeave
1118
+ } : undefined), {}, {
1119
+ style: _objectSpread(_objectSpread({}, element === null || element === void 0 || (_props = element.props) === null || _props === void 0 ? void 0 : _props.style), !isVisible ? {
1120
+ opacity: '0',
1121
+ pointerEvents: 'none'
1122
+ } : undefined)
1123
+ }));
1124
+ }), children && _react.default.Children.toArray(children).map((element, index) => {
1125
+ var _element$props2, _element$props3, _props2;
1126
+ const isVisible = visible[(_element$props2 = element.props) === null || _element$props2 === void 0 ? void 0 : _element$props2.name] === undefined || !!visible[(_element$props3 = element.props) === null || _element$props3 === void 0 ? void 0 : _element$props3.name];
1127
+ return /*#__PURE__*/_react.default.cloneElement(element, _objectSpread(_objectSpread({
1128
+ key: index,
1129
+ refs: {
1130
+ wrapper: refs.wrapper.current,
1131
+ defs: refs.defs.current
1132
+ },
1133
+ rects,
1134
+ animate: element.props.animate !== undefined ? element.props.animate : animate,
1135
+ animateTimeout: element.props.animateTimeout !== undefined ? element.props.animateTimeout : animateTimeout,
1136
+ updateDefs: setDefs,
1137
+ updateLegend: setLegend
1138
+ }, elementTooltip ? {
1139
+ onMouseEnter: event => {
1140
+ const rect_ = event.target.getBoundingClientRect();
1141
+ onPointMouseEnter(_objectSpread(_objectSpread({}, element.props), {}, {
1142
+ rect: rect_
1143
+ }));
1144
+ },
1145
+ onMouseLeave: onPointMouseLeave
1146
+ } : undefined), {}, {
1147
+ minMax: element.props.minMax !== undefined ? element.props.minMax : minMax,
1148
+ minX: element.props.minX !== undefined ? element.props.minX : minX,
1149
+ maxX: element.props.maxX !== undefined ? element.props.maxX : maxX,
1150
+ minY: element.props.minY !== undefined ? element.props.minY : minY,
1151
+ maxY: element.props.maxY !== undefined ? element.props.maxY : maxY,
1152
+ minMaxPadding: element.props.minMaxPadding !== undefined ? element.props.minMaxPadding : minMaxPadding,
1153
+ minPadding: element.props.minPadding !== undefined ? element.props.minPadding : minPadding,
1154
+ maxPadding: element.props.maxPadding !== undefined ? element.props.maxPadding : maxPadding,
1155
+ minPaddingX: element.props.minPaddingX !== undefined ? element.props.minPaddingX : minPaddingX,
1156
+ minPaddingY: element.props.minPaddingY !== undefined ? element.props.minPaddingY : minPaddingY,
1157
+ maxPaddingX: element.props.maxPaddingX !== undefined ? element.props.maxPaddingX : maxPaddingX,
1158
+ maxPaddingY: element.props.maxPaddingY !== undefined ? element.props.maxPaddingY : maxPaddingY,
1159
+ style: _objectSpread(_objectSpread({}, element === null || element === void 0 || (_props2 = element.props) === null || _props2 === void 0 ? void 0 : _props2.style), !isVisible ? {
1160
+ opacity: '0',
1161
+ pointerEvents: 'none'
1162
+ } : undefined)
1163
+ }));
1164
+ }), additionalLines && /*#__PURE__*/_react.default.createElement("g", (0, _extends2.default)({}, AdditionalLinesProps, {
1165
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-additional-lines'], AdditionalLinesProps === null || AdditionalLinesProps === void 0 ? void 0 : AdditionalLinesProps.className, classes.additionalLines])
1166
+ }), additionalLines), guidelines && guidelinesIn && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ['both', 'vertical'].includes(guidelines) && /*#__PURE__*/_react.default.createElement("path", (0, _extends2.default)({
1167
+ d: `M ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.x) || 0} 0 ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.x) || 0} ${(rects === null || rects === void 0 || (_rects$wrapper3 = rects.wrapper) === null || _rects$wrapper3 === void 0 ? void 0 : _rects$wrapper3.height) || 0}`
1168
+ }, GuidelineProps, {
1169
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-guidelines', 'onesy-Chart-guidelines-vertical'], GuidelineProps === null || GuidelineProps === void 0 ? void 0 : GuidelineProps.className, classes.guidelines, classes.guidelines_vertical])
1170
+ })), ['both', 'horizontal'].includes(guidelines) && /*#__PURE__*/_react.default.createElement("path", (0, _extends2.default)({
1171
+ d: `M 0 ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.y) || 0} ${(rects === null || rects === void 0 || (_rects$wrapper4 = rects.wrapper) === null || _rects$wrapper4 === void 0 ? void 0 : _rects$wrapper4.width) || 0} ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.y) || 0}`
1172
+ }, GuidelineProps, {
1173
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-guidelines', 'onesy-Chart-guidelines-horizontal'], GuidelineProps === null || GuidelineProps === void 0 ? void 0 : GuidelineProps.className, classes.guidelines, classes.guidelines_horizontal])
1174
+ }))), points__ && points && /*#__PURE__*/_react.default.createElement("g", (0, _extends2.default)({}, PointsProps, {
1175
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-points'], PointsProps === null || PointsProps === void 0 ? void 0 : PointsProps.className, classes.points])
1176
+ }), points.map((item, index) => (/*#__PURE__*/_react.default.cloneElement(item, {
1177
+ key: index
1178
+ }))))), borders && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, borderTop && /*#__PURE__*/_react.default.createElement("div", {
1179
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-border', 'onesy-Chart-border-x', 'onesy-Chart-border-top'], classes.border, classes.borderX, classes.borderTop])
1180
+ }), borderBottom && /*#__PURE__*/_react.default.createElement("div", {
1181
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-border', 'onesy-Chart-border-x', 'onesy-Chart-border-bottom'], classes.border, classes.borderX, classes.borderBottom])
1182
+ }), borderStart && /*#__PURE__*/_react.default.createElement("div", {
1183
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-border', 'onesy-Chart-border-y', 'onesy-Chart-border-start'], classes.border, classes.borderY, classes.boderStart])
1184
+ }), borderLeft && /*#__PURE__*/_react.default.createElement("div", {
1185
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-border', 'onesy-Chart-border-y', 'onesy-Chart-border-left'], classes.border, classes.borderY, classes.borderLeft])
1186
+ }), borderEnd && /*#__PURE__*/_react.default.createElement("div", {
1187
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-border', 'onesy-Chart-border-y', 'onesy-Chart-border-end'], classes.border, classes.borderY, classes.borderEnd])
1188
+ }), borderRight && /*#__PURE__*/_react.default.createElement("div", {
1189
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-border', 'onesy-Chart-border-y', 'onesy-Chart-border-right'], classes.border, classes.borderY, classes.borderRight])
1190
+ })), !!labels__ && labelsX && (labels === null || labels === void 0 ? void 0 : labels.x) && /*#__PURE__*/_react.default.createElement(Line, {
1191
+ gap: 0,
1192
+ direction: "row",
1193
+ align: "flex-start",
1194
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-labels', 'onesy-Chart-labels-x'], classes.labels, classes.labels_x])
1195
+ }, labels.x.map((item, index) => {
1196
+ const itemProps = {
1197
+ key: index,
1198
+ version: 'b3',
1199
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-label', 'onesy-Chart-label-x'], classes.label, classes.label_x]),
1200
+ style: {
1201
+ left: `${item.percentage}%`
810
1202
  }
811
- // Legend
812
- if ((0, utils_1.is)('array', legend_))
813
- setLegend(legend_);
814
- };
815
- return ((0, jsx_runtime_1.jsxs)(Surface, Object.assign({ ref: item => {
816
- if (ref) {
817
- if ((0, utils_1.is)('function', ref))
818
- ref(item);
819
- else
820
- ref.current = item;
821
- }
822
- refs.root.current = item;
823
- }, tonal: tonal, color: color, gap: 0, direction: 'column', align: 'center', Component: Line, AdditionalProps: {
824
- Component
825
- }, className: (0, style_react_1.classNames)([
826
- (0, utils_2.staticClassName)('Chart', theme) && [
827
- 'onesy-Chart-root'
828
- ],
829
- className,
830
- classes.root
831
- ]) }, other, { children: [(title || subtitle) && ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, align: 'center', justify: 'center' }, HeaderProps, { className: (0, style_react_1.classNames)([
832
- (0, utils_2.staticClassName)('Chart', theme) && [
833
- 'onesy-Chart-header'
834
- ],
835
- HeaderProps === null || HeaderProps === void 0 ? void 0 : HeaderProps.className,
836
- classes.header,
837
- ((labels === null || labels === void 0 ? void 0 : labels.y) && labelsY) && classes.legend_offset_labels_y,
838
- ((names === null || names === void 0 ? void 0 : names.y) && nameY) && classes.legend_offset_names_y
839
- ]) }, { children: [(0, utils_1.is)('simple', title) ? ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 't2' }, TypeProps, TitleProps, { className: (0, style_react_1.classNames)([
840
- (0, utils_2.staticClassName)('Chart', theme) && [
841
- 'onesy-Chart-title'
842
- ],
843
- TypeProps === null || TypeProps === void 0 ? void 0 : TypeProps.className,
844
- TitleProps === null || TitleProps === void 0 ? void 0 : TitleProps.className,
845
- classes.title
846
- ]) }, { children: title }))) : title, (0, utils_1.is)('simple', subtitle) ? ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, TypeProps, SubtitleProps, { className: (0, style_react_1.classNames)([
847
- (0, utils_2.staticClassName)('Chart', theme) && [
848
- 'onesy-Chart-title'
849
- ],
850
- TypeProps === null || TypeProps === void 0 ? void 0 : TypeProps.className,
851
- SubtitleProps === null || SubtitleProps === void 0 ? void 0 : SubtitleProps.className,
852
- classes.subtitle
853
- ]) }, { children: subtitle }))) : subtitle] }))), (legend__ && legendPosition === 'top' && legend) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 2, direction: 'row', align: 'center', justify: 'center', wrap: 'wrap' }, LegendProps, { className: (0, style_react_1.classNames)([
854
- (0, utils_2.staticClassName)('Chart', theme) && [
855
- 'onesy-Chart-legend',
856
- `onesy-Chart-legend-position-${legendPosition}`
857
- ],
858
- LegendProps === null || LegendProps === void 0 ? void 0 : LegendProps.className,
859
- classes.legend,
860
- classes[`legend_position_${legendPosition}`],
861
- ((labels === null || labels === void 0 ? void 0 : labels.y) && labelsY) && classes.legend_offset_labels_y,
862
- ((names === null || names === void 0 ? void 0 : names.y) && nameY) && classes.legend_offset_names_y
863
- ]) }, { children: legend.map(({ item, element }) => {
864
- var _a;
865
- return (react_1.default.cloneElement(element, {
866
- onClick: () => onLegendClick(item.name),
867
- className: (0, style_react_1.classNames)([
868
- (_a = element === null || element === void 0 ? void 0 : element.props) === null || _a === void 0 ? void 0 : _a.className,
869
- legendManageVisibility && classes.legend_item_manage_visibility,
870
- refs.visible.current[item.name] === false && classes.legend_item_hidden
871
- ])
872
- }));
873
- }) }))), (0, jsx_runtime_1.jsx)(Line, Object.assign({ ref: refs.wrapper }, WrapperProps, { className: (0, style_react_1.classNames)([
874
- (0, utils_2.staticClassName)('Chart', theme) && [
875
- 'onesy-Chart-wrapper'
876
- ],
877
- WrapperProps === null || WrapperProps === void 0 ? void 0 : WrapperProps.className,
878
- classes.wrapper,
879
- ((labels === null || labels === void 0 ? void 0 : labels.x) && (labels === null || labels === void 0 ? void 0 : labels.y) && labelsX && labelsY) && classes.wrapper_labels,
880
- (!((labels === null || labels === void 0 ? void 0 : labels.x) && (labels === null || labels === void 0 ? void 0 : labels.y) && labelsX && labelsY) && (labels === null || labels === void 0 ? void 0 : labels.x) && labelsX) && classes.wrapper_label_x,
881
- (!((labels === null || labels === void 0 ? void 0 : labels.x) && (labels === null || labels === void 0 ? void 0 : labels.y) && labelsX && labelsY) && (labels === null || labels === void 0 ? void 0 : labels.y) && labelsY) && classes.wrapper_label_y,
882
- ((names === null || names === void 0 ? void 0 : names.x) && (names === null || names === void 0 ? void 0 : names.y) && nameX && nameY) && classes.wrapper_names,
883
- (!((names === null || names === void 0 ? void 0 : names.x) && (names === null || names === void 0 ? void 0 : names.y) && nameX && nameY) && (names === null || names === void 0 ? void 0 : names.x) && nameX) && classes.wrapper_name_x,
884
- (!((names === null || names === void 0 ? void 0 : names.x) && (names === null || names === void 0 ? void 0 : names.y) && nameX && nameY) && (names === null || names === void 0 ? void 0 : names.y) && nameY) && classes.wrapper_name_y
885
- ]) }, { children: (0, jsx_runtime_1.jsx)(Surface, Object.assign({ tonal: tonal, color: color }, { children: ({ color: color_, backgroundColor, palette }) => {
886
- var _a, _b, _c, _d;
887
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!grid__ && gridX && (grid === null || grid === void 0 ? void 0 : grid.x) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'row', align: 'flex-start', className: (0, style_react_1.classNames)([
888
- (0, utils_2.staticClassName)('Chart', theme) && [
889
- 'onesy-Chart-grids',
890
- 'onesy-Chart-grids-x'
891
- ],
892
- classes.grids,
893
- classes.grids_x
894
- ]) }, { children: grid.x.map((item, index) => ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
895
- (0, utils_2.staticClassName)('Chart', theme) && [
896
- 'onesy-Chart-grid',
897
- 'onesy-Chart-grid-x'
898
- ],
899
- classes.grid,
900
- classes.grid_x
901
- ]), style: {
902
- left: `${item.percentage}%`
903
- } }, index))) }))), !!grid__ && gridY && (grid === null || grid === void 0 ? void 0 : grid.y) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'column', align: 'flex-end', justify: 'center', className: (0, style_react_1.classNames)([
904
- (0, utils_2.staticClassName)('Chart', theme) && [
905
- 'onesy-Chart-grids',
906
- 'onesy-Chart-grids-y'
907
- ],
908
- classes.grids,
909
- classes.grids_y
910
- ]) }, { children: grid.y.map((item, index) => ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
911
- (0, utils_2.staticClassName)('Chart', theme) && [
912
- 'onesy-Chart-grid',
913
- 'onesy-Chart-grid-y'
914
- ],
915
- classes.grid,
916
- classes.grid_y
917
- ]), style: {
918
- bottom: `${item.percentage}%`
919
- } }, index))) }))), (0, jsx_runtime_1.jsxs)("svg", Object.assign({ ref: refs.svg, xmlns: 'http://www.w3.org/2000/svg', viewBox: `0 0 ${((_a = rects === null || rects === void 0 ? void 0 : rects.wrapper) === null || _a === void 0 ? void 0 : _a.width) || 0} ${((_b = rects === null || rects === void 0 ? void 0 : rects.wrapper) === null || _b === void 0 ? void 0 : _b.height) || 0}` }, (guidelines ? {
920
- onMouseEnter: onWrapperMouseEnter,
921
- onTouchStart: onWrapperMouseEnter,
922
- onMouseLeave: onWrapperMouseLeave
923
- } : undefined), SvgProps, { className: (0, style_react_1.classNames)([
924
- (0, utils_2.staticClassName)('Chart', theme) && [
925
- 'onesy-Chart-svg'
926
- ],
927
- SvgProps === null || SvgProps === void 0 ? void 0 : SvgProps.className,
928
- classes.svg
929
- ]) }, { children: [(0, jsx_runtime_1.jsx)("defs", Object.assign({ ref: refs.defs }, { children: defs && defs.map((item, index) => (react_1.default.cloneElement(item, {
930
- key: index
931
- }))) })), pre, elements && elements.map(({ item, element }, index) => {
932
- var _a;
933
- const isVisible = (visible[item === null || item === void 0 ? void 0 : item.name] === undefined || !!visible[item === null || item === void 0 ? void 0 : item.name]);
934
- return (react_1.default.cloneElement(element, Object.assign(Object.assign({ key: index }, (elementTooltip ? {
935
- onMouseEnter: event => {
936
- const rect_ = event.target.getBoundingClientRect();
937
- onPointMouseEnter(Object.assign(Object.assign({}, item), { rect: rect_ }));
938
- },
939
- onMouseLeave: onPointMouseLeave
940
- } : undefined)), { style: Object.assign(Object.assign({}, (_a = element === null || element === void 0 ? void 0 : element.props) === null || _a === void 0 ? void 0 : _a.style), (!isVisible ? {
941
- opacity: '0',
942
- pointerEvents: 'none'
943
- } : undefined)) })));
944
- }), children && react_1.default.Children.toArray(children).map((element, index) => {
945
- var _a, _b, _c;
946
- const isVisible = (visible[(_a = element.props) === null || _a === void 0 ? void 0 : _a.name] === undefined || !!visible[(_b = element.props) === null || _b === void 0 ? void 0 : _b.name]);
947
- return (react_1.default.cloneElement(element, Object.assign(Object.assign({ key: index, refs: {
948
- wrapper: refs.wrapper.current,
949
- defs: refs.defs.current
950
- }, rects, animate: element.props.animate !== undefined ? element.props.animate : animate, animateTimeout: element.props.animateTimeout !== undefined ? element.props.animateTimeout : animateTimeout, updateDefs: setDefs, updateLegend: setLegend }, (elementTooltip ? {
951
- onMouseEnter: event => {
952
- const rect_ = event.target.getBoundingClientRect();
953
- onPointMouseEnter(Object.assign(Object.assign({}, element.props), { rect: rect_ }));
954
- },
955
- onMouseLeave: onPointMouseLeave
956
- } : undefined)), { minMax: element.props.minMax !== undefined ? element.props.minMax : minMax, minX: element.props.minX !== undefined ? element.props.minX : minX, maxX: element.props.maxX !== undefined ? element.props.maxX : maxX, minY: element.props.minY !== undefined ? element.props.minY : minY, maxY: element.props.maxY !== undefined ? element.props.maxY : maxY, minMaxPadding: element.props.minMaxPadding !== undefined ? element.props.minMaxPadding : minMaxPadding, minPadding: element.props.minPadding !== undefined ? element.props.minPadding : minPadding, maxPadding: element.props.maxPadding !== undefined ? element.props.maxPadding : maxPadding, minPaddingX: element.props.minPaddingX !== undefined ? element.props.minPaddingX : minPaddingX, minPaddingY: element.props.minPaddingY !== undefined ? element.props.minPaddingY : minPaddingY, maxPaddingX: element.props.maxPaddingX !== undefined ? element.props.maxPaddingX : maxPaddingX, maxPaddingY: element.props.maxPaddingY !== undefined ? element.props.maxPaddingY : maxPaddingY, style: Object.assign(Object.assign({}, (_c = element === null || element === void 0 ? void 0 : element.props) === null || _c === void 0 ? void 0 : _c.style), (!isVisible ? {
957
- opacity: '0',
958
- pointerEvents: 'none'
959
- } : undefined)) })));
960
- }), additionalLines && ((0, jsx_runtime_1.jsx)("g", Object.assign({}, AdditionalLinesProps, { className: (0, style_react_1.classNames)([
961
- (0, utils_2.staticClassName)('Chart', theme) && [
962
- 'onesy-Chart-additional-lines'
963
- ],
964
- AdditionalLinesProps === null || AdditionalLinesProps === void 0 ? void 0 : AdditionalLinesProps.className,
965
- classes.additionalLines
966
- ]) }, { children: additionalLines }))), guidelines && guidelinesIn && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [['both', 'vertical'].includes(guidelines) && ((0, jsx_runtime_1.jsx)("path", Object.assign({ d: `M ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.x) || 0} 0 ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.x) || 0} ${((_c = rects === null || rects === void 0 ? void 0 : rects.wrapper) === null || _c === void 0 ? void 0 : _c.height) || 0}` }, GuidelineProps, { className: (0, style_react_1.classNames)([
967
- (0, utils_2.staticClassName)('Chart', theme) && [
968
- 'onesy-Chart-guidelines',
969
- 'onesy-Chart-guidelines-vertical'
970
- ],
971
- GuidelineProps === null || GuidelineProps === void 0 ? void 0 : GuidelineProps.className,
972
- classes.guidelines,
973
- classes.guidelines_vertical
974
- ]) }))), ['both', 'horizontal'].includes(guidelines) && ((0, jsx_runtime_1.jsx)("path", Object.assign({ d: `M 0 ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.y) || 0} ${((_d = rects === null || rects === void 0 ? void 0 : rects.wrapper) === null || _d === void 0 ? void 0 : _d.width) || 0} ${(guidelinesPosition === null || guidelinesPosition === void 0 ? void 0 : guidelinesPosition.y) || 0}` }, GuidelineProps, { className: (0, style_react_1.classNames)([
975
- (0, utils_2.staticClassName)('Chart', theme) && [
976
- 'onesy-Chart-guidelines',
977
- 'onesy-Chart-guidelines-horizontal'
978
- ],
979
- GuidelineProps === null || GuidelineProps === void 0 ? void 0 : GuidelineProps.className,
980
- classes.guidelines,
981
- classes.guidelines_horizontal
982
- ]) })))] }), points__ && points && ((0, jsx_runtime_1.jsx)("g", Object.assign({}, PointsProps, { className: (0, style_react_1.classNames)([
983
- (0, utils_2.staticClassName)('Chart', theme) && [
984
- 'onesy-Chart-points'
985
- ],
986
- PointsProps === null || PointsProps === void 0 ? void 0 : PointsProps.className,
987
- classes.points
988
- ]) }, { children: points.map((item, index) => (react_1.default.cloneElement(item, {
989
- key: index
990
- }))) })))] })), borders && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [borderTop && ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
991
- (0, utils_2.staticClassName)('Chart', theme) && [
992
- 'onesy-Chart-border',
993
- 'onesy-Chart-border-x',
994
- 'onesy-Chart-border-top'
995
- ],
996
- classes.border,
997
- classes.borderX,
998
- classes.borderTop
999
- ]) })), borderBottom && ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
1000
- (0, utils_2.staticClassName)('Chart', theme) && [
1001
- 'onesy-Chart-border',
1002
- 'onesy-Chart-border-x',
1003
- 'onesy-Chart-border-bottom'
1004
- ],
1005
- classes.border,
1006
- classes.borderX,
1007
- classes.borderBottom
1008
- ]) })), borderStart && ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
1009
- (0, utils_2.staticClassName)('Chart', theme) && [
1010
- 'onesy-Chart-border',
1011
- 'onesy-Chart-border-y',
1012
- 'onesy-Chart-border-start'
1013
- ],
1014
- classes.border,
1015
- classes.borderY,
1016
- classes.boderStart
1017
- ]) })), borderLeft && ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
1018
- (0, utils_2.staticClassName)('Chart', theme) && [
1019
- 'onesy-Chart-border',
1020
- 'onesy-Chart-border-y',
1021
- 'onesy-Chart-border-left'
1022
- ],
1023
- classes.border,
1024
- classes.borderY,
1025
- classes.borderLeft
1026
- ]) })), borderEnd && ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
1027
- (0, utils_2.staticClassName)('Chart', theme) && [
1028
- 'onesy-Chart-border',
1029
- 'onesy-Chart-border-y',
1030
- 'onesy-Chart-border-end'
1031
- ],
1032
- classes.border,
1033
- classes.borderY,
1034
- classes.borderEnd
1035
- ]) })), borderRight && ((0, jsx_runtime_1.jsx)("div", { className: (0, style_react_1.classNames)([
1036
- (0, utils_2.staticClassName)('Chart', theme) && [
1037
- 'onesy-Chart-border',
1038
- 'onesy-Chart-border-y',
1039
- 'onesy-Chart-border-right'
1040
- ],
1041
- classes.border,
1042
- classes.borderY,
1043
- classes.borderRight
1044
- ]) }))] }), !!labels__ && labelsX && (labels === null || labels === void 0 ? void 0 : labels.x) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'row', align: 'flex-start', className: (0, style_react_1.classNames)([
1045
- (0, utils_2.staticClassName)('Chart', theme) && [
1046
- 'onesy-Chart-labels',
1047
- 'onesy-Chart-labels-x'
1048
- ],
1049
- classes.labels,
1050
- classes.labels_x
1051
- ]) }, { children: labels.x.map((item, index) => {
1052
- const itemProps = {
1053
- key: index,
1054
- version: 'b3',
1055
- className: (0, style_react_1.classNames)([
1056
- (0, utils_2.staticClassName)('Chart', theme) && [
1057
- 'onesy-Chart-label',
1058
- 'onesy-Chart-label-x'
1059
- ],
1060
- classes.label,
1061
- classes.label_x
1062
- ]),
1063
- style: {
1064
- left: `${item.percentage}%`
1065
- }
1066
- };
1067
- return ((0, utils_1.is)('function', labelRender) ?
1068
- labelRender(Object.assign(Object.assign({}, item), { axis: 'x', props: itemProps })) :
1069
- (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', className: (0, style_react_1.classNames)([
1070
- (0, utils_2.staticClassName)('Chart', theme) && [
1071
- 'onesy-Chart-label',
1072
- 'onesy-Chart-label-x'
1073
- ],
1074
- classes.label,
1075
- classes.label_x
1076
- ]), style: {
1077
- left: `${item.percentage}%`
1078
- } }, { children: (0, utils_1.is)('function', labelResolve) ? labelResolve(item.label, 'x', item) : item.label }), index));
1079
- }) }))), !!labels__ && labelsY && (labels === null || labels === void 0 ? void 0 : labels.y) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'column', align: 'flex-end', justify: 'center', className: (0, style_react_1.classNames)([
1080
- (0, utils_2.staticClassName)('Chart', theme) && [
1081
- 'onesy-Chart-labels',
1082
- 'onesy-Chart-labels-y'
1083
- ],
1084
- classes.labels,
1085
- classes.labels_y
1086
- ]) }, { children: labels.y.map((item, index) => ((0, utils_1.is)('function', labelRender) ?
1087
- labelRender(Object.assign(Object.assign({}, item), { axis: 'y' })) :
1088
- (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', className: (0, style_react_1.classNames)([
1089
- (0, utils_2.staticClassName)('Chart', theme) && [
1090
- 'onesy-Chart-label',
1091
- 'onesy-Chart-label-y'
1092
- ],
1093
- classes.label,
1094
- classes.label_y
1095
- ]), style: {
1096
- bottom: `${item.percentage}%`
1097
- } }, { children: (0, utils_1.is)('function', labelResolve) ? labelResolve(item.label, 'y', item) : item.label }), index))) }))), !!marks__ && marksX && (marks === null || marks === void 0 ? void 0 : marks.x) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'row', align: 'flex-start', className: (0, style_react_1.classNames)([
1098
- (0, utils_2.staticClassName)('Chart', theme) && [
1099
- 'onesy-Chart-marks',
1100
- 'onesy-Chart-marks-x'
1101
- ],
1102
- classes.marks,
1103
- classes.marks_x
1104
- ]) }, { children: marks.x.map((item, index) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
1105
- (0, utils_2.staticClassName)('Chart', theme) && [
1106
- 'onesy-Chart-mark',
1107
- 'onesy-Chart-mark-x'
1108
- ],
1109
- classes.mark,
1110
- classes.mark_x
1111
- ]), style: {
1112
- left: `${item.percentage}%`
1113
- } }, { children: item.mark }), index))) }))), !!marks__ && marksY && (marks === null || marks === void 0 ? void 0 : marks.y) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0, direction: 'column', align: 'flex-end', justify: 'center', className: (0, style_react_1.classNames)([
1114
- (0, utils_2.staticClassName)('Chart', theme) && [
1115
- 'onesy-Chart-marks',
1116
- 'onesy-Chart-marks-y'
1117
- ],
1118
- classes.marks,
1119
- classes.marks_y
1120
- ]) }, { children: marks.y.map((item, index) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
1121
- (0, utils_2.staticClassName)('Chart', theme) && [
1122
- 'onesy-Chart-mark',
1123
- 'onesy-Chart-mark-y'
1124
- ],
1125
- classes.mark,
1126
- classes.mark_y
1127
- ]), style: {
1128
- bottom: `${item.percentage}%`
1129
- } }, { children: item.mark }), index))) }))), (names === null || names === void 0 ? void 0 : names.x) && nameX && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2', className: (0, style_react_1.classNames)([
1130
- (0, utils_2.staticClassName)('Chart', theme) && [
1131
- 'onesy-Chart-name',
1132
- 'onesy-Chart-name-x'
1133
- ],
1134
- classes.name,
1135
- classes.name_x
1136
- ]) }, { children: names.x }))), (names === null || names === void 0 ? void 0 : names.y) && nameY && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b2', className: (0, style_react_1.classNames)([
1137
- (0, utils_2.staticClassName)('Chart', theme) && [
1138
- 'onesy-Chart-name',
1139
- 'onesy-Chart-name-y'
1140
- ],
1141
- classes.name,
1142
- classes.name_y
1143
- ]) }, { children: names.y })))] }));
1144
- } })) })), (legend__ && legendPosition === 'bottom' && legend) && ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 2, direction: 'row', align: 'center', justify: 'center', wrap: 'wrap' }, LegendProps, { className: (0, style_react_1.classNames)([
1145
- (0, utils_2.staticClassName)('Chart', theme) && [
1146
- 'onesy-Chart-legend',
1147
- `onesy-Chart-legend-position-${legendPosition}`
1148
- ],
1149
- LegendProps === null || LegendProps === void 0 ? void 0 : LegendProps.className,
1150
- classes.legend,
1151
- classes[`legend_position_${legendPosition}`],
1152
- ((labels === null || labels === void 0 ? void 0 : labels.y) && labelsY) && classes.legend_offset_labels_y,
1153
- ((names === null || names === void 0 ? void 0 : names.y) && nameY) && classes.legend_offset_names_y
1154
- ]) }, { children: legend.map(({ item, element }) => {
1155
- var _a;
1156
- return (react_1.default.cloneElement(element, {
1157
- onClick: () => onLegendClick(item.name),
1158
- className: (0, style_react_1.classNames)([
1159
- (_a = element === null || element === void 0 ? void 0 : element.props) === null || _a === void 0 ? void 0 : _a.className,
1160
- legendManageVisibility && classes.legend_item_manage_visibility,
1161
- refs.visible.current[item.name] === false && classes.legend_item_hidden
1162
- ])
1163
- }));
1164
- }) }))), tooltip && ((0, jsx_runtime_1.jsx)(Append, Object.assign({ open: true, offset: [16, 16], padding: [14, 14], element: ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, style_react_1.classNames)([
1165
- (0, utils_2.staticClassName)('Chart', theme) && [
1166
- 'onesy-Chart-append-wrapper'
1167
- ],
1168
- classes.append_wrapper
1169
- ]), style: Object.assign({}, refs.appendStyle.current) }, { children: (0, jsx_runtime_1.jsx)(Grow, Object.assign({ in: append === null || append === void 0 ? void 0 : append.open, onAdded: () => {
1170
- refs.appendStyle.current = {
1171
- transition: theme.methods.transitions.make('transform', { duration: 150 })
1172
- };
1173
- }, onEnter: () => {
1174
- refs.appendStyle.current = {
1175
- transition: theme.methods.transitions.make('transform', { duration: 150 })
1176
- };
1177
- }, onExited: () => {
1178
- refs.appendStyle.current = {};
1179
- }, add: true }, { children: (append === null || append === void 0 ? void 0 : append.element) || ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ tonal: tonal, color: color, elevation: 1, gap: 0.4, direction: 'column', Component: Surface, className: (0, style_react_1.classNames)([
1180
- (0, utils_2.staticClassName)('Chart', theme) && [
1181
- 'onesy-Chart-append'
1182
- ],
1183
- classes.append
1184
- ]) }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
1185
- fontWeight: 600
1186
- } }, { children: (names === null || names === void 0 ? void 0 : names.y) || 'y' })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: (0, utils_1.is)('function', labelResolve) ? labelResolve((_a = append === null || append === void 0 ? void 0 : append.values) === null || _a === void 0 ? void 0 : _a[1], 'y', append, 'individual') : (_b = append === null || append === void 0 ? void 0 : append.values) === null || _b === void 0 ? void 0 : _b[1] }))] })), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 1, direction: 'row', align: 'center' }, { children: [(0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3', style: {
1187
- fontWeight: 600
1188
- } }, { children: (names === null || names === void 0 ? void 0 : names.x) || 'x' })), (0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, { children: (0, utils_1.is)('function', labelResolve) ? labelResolve((_c = append === null || append === void 0 ? void 0 : append.values) === null || _c === void 0 ? void 0 : _c[0], 'x', append, 'individual') : (_d = append === null || append === void 0 ? void 0 : append.values) === null || _d === void 0 ? void 0 : _d[0] }))] }))] }))) })) }))), anchor: append === null || append === void 0 ? void 0 : append.rect, portal: true, alignment: 'center', position: 'top' }, AppendProps)))] })));
1203
+ };
1204
+ return (0, _utils.is)('function', labelRender) ? labelRender(_objectSpread(_objectSpread({}, item), {}, {
1205
+ axis: 'x',
1206
+ props: itemProps
1207
+ })) : /*#__PURE__*/_react.default.createElement(Type, {
1208
+ key: index,
1209
+ version: "b3",
1210
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-label', 'onesy-Chart-label-x'], classes.label, classes.label_x]),
1211
+ style: {
1212
+ left: `${item.percentage}%`
1213
+ }
1214
+ }, (0, _utils.is)('function', labelResolve) ? labelResolve(item.label, 'x', item) : item.label);
1215
+ })), !!labels__ && labelsY && (labels === null || labels === void 0 ? void 0 : labels.y) && /*#__PURE__*/_react.default.createElement(Line, {
1216
+ gap: 0,
1217
+ direction: "column",
1218
+ align: "flex-end",
1219
+ justify: "center",
1220
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-labels', 'onesy-Chart-labels-y'], classes.labels, classes.labels_y])
1221
+ }, labels.y.map((item, index) => (0, _utils.is)('function', labelRender) ? labelRender(_objectSpread(_objectSpread({}, item), {}, {
1222
+ axis: 'y'
1223
+ })) : /*#__PURE__*/_react.default.createElement(Type, {
1224
+ key: index,
1225
+ version: "b3",
1226
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-label', 'onesy-Chart-label-y'], classes.label, classes.label_y]),
1227
+ style: {
1228
+ bottom: `${item.percentage}%`
1229
+ }
1230
+ }, (0, _utils.is)('function', labelResolve) ? labelResolve(item.label, 'y', item) : item.label))), !!marks__ && marksX && (marks === null || marks === void 0 ? void 0 : marks.x) && /*#__PURE__*/_react.default.createElement(Line, {
1231
+ gap: 0,
1232
+ direction: "row",
1233
+ align: "flex-start",
1234
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-marks', 'onesy-Chart-marks-x'], classes.marks, classes.marks_x])
1235
+ }, marks.x.map((item, index) => /*#__PURE__*/_react.default.createElement("span", {
1236
+ key: index,
1237
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-mark', 'onesy-Chart-mark-x'], classes.mark, classes.mark_x]),
1238
+ style: {
1239
+ left: `${item.percentage}%`
1240
+ }
1241
+ }, item.mark))), !!marks__ && marksY && (marks === null || marks === void 0 ? void 0 : marks.y) && /*#__PURE__*/_react.default.createElement(Line, {
1242
+ gap: 0,
1243
+ direction: "column",
1244
+ align: "flex-end",
1245
+ justify: "center",
1246
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-marks', 'onesy-Chart-marks-y'], classes.marks, classes.marks_y])
1247
+ }, marks.y.map((item, index) => /*#__PURE__*/_react.default.createElement("span", {
1248
+ key: index,
1249
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-mark', 'onesy-Chart-mark-y'], classes.mark, classes.mark_y]),
1250
+ style: {
1251
+ bottom: `${item.percentage}%`
1252
+ }
1253
+ }, item.mark))), (names === null || names === void 0 ? void 0 : names.x) && nameX && /*#__PURE__*/_react.default.createElement(Type, {
1254
+ version: "b2",
1255
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-name', 'onesy-Chart-name-x'], classes.name, classes.name_x])
1256
+ }, names.x), (names === null || names === void 0 ? void 0 : names.y) && nameY && /*#__PURE__*/_react.default.createElement(Type, {
1257
+ version: "b2",
1258
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-name', 'onesy-Chart-name-y'], classes.name, classes.name_y])
1259
+ }, names.y));
1260
+ })), legend__ && legendPosition === 'bottom' && legend && /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
1261
+ gap: 2,
1262
+ direction: "row",
1263
+ align: "center",
1264
+ justify: "center",
1265
+ wrap: "wrap"
1266
+ }, LegendProps, {
1267
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-legend', `onesy-Chart-legend-position-${legendPosition}`], LegendProps === null || LegendProps === void 0 ? void 0 : LegendProps.className, classes.legend, classes[`legend_position_${legendPosition}`], (labels === null || labels === void 0 ? void 0 : labels.y) && labelsY && classes.legend_offset_labels_y, (names === null || names === void 0 ? void 0 : names.y) && nameY && classes.legend_offset_names_y])
1268
+ }), legend.map(({
1269
+ item,
1270
+ element
1271
+ }) => {
1272
+ var _element$props4;
1273
+ return /*#__PURE__*/_react.default.cloneElement(element, {
1274
+ onClick: () => onLegendClick(item.name),
1275
+ className: (0, _styleReact.classNames)([element === null || element === void 0 || (_element$props4 = element.props) === null || _element$props4 === void 0 ? void 0 : _element$props4.className, legendManageVisibility && classes.legend_item_manage_visibility, refs.visible.current[item.name] === false && classes.legend_item_hidden])
1276
+ });
1277
+ })), tooltip && /*#__PURE__*/_react.default.createElement(Append, (0, _extends2.default)({
1278
+ open: true,
1279
+ offset: [16, 16],
1280
+ padding: [14, 14],
1281
+ element: /*#__PURE__*/_react.default.createElement("div", {
1282
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-append-wrapper'], classes.append_wrapper]),
1283
+ style: _objectSpread({}, refs.appendStyle.current)
1284
+ }, /*#__PURE__*/_react.default.createElement(Grow, {
1285
+ in: append === null || append === void 0 ? void 0 : append.open,
1286
+ onAdded: () => {
1287
+ refs.appendStyle.current = {
1288
+ transition: theme.methods.transitions.make('transform', {
1289
+ duration: 150
1290
+ })
1291
+ };
1292
+ },
1293
+ onEnter: () => {
1294
+ refs.appendStyle.current = {
1295
+ transition: theme.methods.transitions.make('transform', {
1296
+ duration: 150
1297
+ })
1298
+ };
1299
+ },
1300
+ onExited: () => {
1301
+ refs.appendStyle.current = {};
1302
+ },
1303
+ add: true
1304
+ }, (append === null || append === void 0 ? void 0 : append.element) || /*#__PURE__*/_react.default.createElement(Line, {
1305
+ tonal: tonal,
1306
+ color: color,
1307
+ elevation: 1,
1308
+ gap: 0.4,
1309
+ direction: "column",
1310
+ Component: Surface,
1311
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Chart', theme) && ['onesy-Chart-append'], classes.append])
1312
+ }, /*#__PURE__*/_react.default.createElement(Line, {
1313
+ gap: 1,
1314
+ direction: "row",
1315
+ align: "center"
1316
+ }, /*#__PURE__*/_react.default.createElement(Type, {
1317
+ version: "b3",
1318
+ style: {
1319
+ fontWeight: 600
1320
+ }
1321
+ }, (names === null || names === void 0 ? void 0 : names.y) || 'y'), /*#__PURE__*/_react.default.createElement(Type, {
1322
+ version: "b3"
1323
+ }, (0, _utils.is)('function', labelResolve) ? labelResolve(append === null || append === void 0 || (_append$values = append.values) === null || _append$values === void 0 ? void 0 : _append$values[1], 'y', append, 'individual') : append === null || append === void 0 || (_append$values2 = append.values) === null || _append$values2 === void 0 ? void 0 : _append$values2[1])), /*#__PURE__*/_react.default.createElement(Line, {
1324
+ gap: 1,
1325
+ direction: "row",
1326
+ align: "center"
1327
+ }, /*#__PURE__*/_react.default.createElement(Type, {
1328
+ version: "b3",
1329
+ style: {
1330
+ fontWeight: 600
1331
+ }
1332
+ }, (names === null || names === void 0 ? void 0 : names.x) || 'x'), /*#__PURE__*/_react.default.createElement(Type, {
1333
+ version: "b3"
1334
+ }, (0, _utils.is)('function', labelResolve) ? labelResolve(append === null || append === void 0 || (_append$values3 = append.values) === null || _append$values3 === void 0 ? void 0 : _append$values3[0], 'x', append, 'individual') : append === null || append === void 0 || (_append$values4 = append.values) === null || _append$values4 === void 0 ? void 0 : _append$values4[0]))))),
1335
+ anchor: append === null || append === void 0 ? void 0 : append.rect,
1336
+ portal: true,
1337
+ alignment: "center",
1338
+ position: "top"
1339
+ }, AppendProps)));
1189
1340
  });
1190
1341
  Chart.displayName = 'onesy-Chart';
1191
- exports.default = Chart;
1342
+ var _default = exports.default = Chart;