@widergy/energy-ui 2.10.1 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/dist/components/EnergyThemeProvider/index.js +12 -34
  2. package/dist/components/Loading/constants.js +1 -1
  3. package/dist/components/Loading/index.js +12 -10
  4. package/dist/components/Loading/theme.js +6 -3
  5. package/dist/components/UTAlert/AlertHandler.js +74 -99
  6. package/dist/components/UTAlert/index.js +64 -85
  7. package/dist/components/UTAlert/theme.js +34 -32
  8. package/dist/components/UTAttachment/components/Preview/index.js +7 -7
  9. package/dist/components/UTAttachment/constants.js +6 -6
  10. package/dist/components/UTAttachment/index.js +158 -248
  11. package/dist/components/UTAttachment/layout.js +25 -25
  12. package/dist/components/UTAttachment/theme.js +6 -3
  13. package/dist/components/UTAttachment/utils.js +44 -117
  14. package/dist/components/UTAutocomplete/components/ListBox/index.js +12 -19
  15. package/dist/components/UTAutocomplete/components/ListBox/utils.js +11 -12
  16. package/dist/components/UTAutocomplete/constants.js +11 -11
  17. package/dist/components/UTAutocomplete/index.js +53 -92
  18. package/dist/components/UTAutocomplete/theme.js +9 -5
  19. package/dist/components/UTAvatar/constants.js +1 -1
  20. package/dist/components/UTAvatar/index.js +17 -15
  21. package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +21 -20
  22. package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +2 -1
  23. package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +20 -20
  24. package/dist/components/UTBarChart/components/Bars/constants.js +3 -3
  25. package/dist/components/UTBarChart/components/Bars/index.js +69 -78
  26. package/dist/components/UTBarChart/components/Legend/constants.js +14 -17
  27. package/dist/components/UTBarChart/components/Legend/index.js +74 -91
  28. package/dist/components/UTBarChart/components/Legend/utils.js +2 -5
  29. package/dist/components/UTBarChart/components/Levels/index.js +15 -12
  30. package/dist/components/UTBarChart/components/Levels/utils.js +26 -27
  31. package/dist/components/UTBarChart/components/LinearPlot/constants.js +2 -2
  32. package/dist/components/UTBarChart/components/LinearPlot/index.js +24 -18
  33. package/dist/components/UTBarChart/components/LinearPlot/utils.js +39 -39
  34. package/dist/components/UTBarChart/components/Pagination/constants.js +1 -1
  35. package/dist/components/UTBarChart/components/Pagination/index.js +19 -22
  36. package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +20 -30
  37. package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +2 -2
  38. package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +19 -17
  39. package/dist/components/UTBarChart/components/XAxis/constants.js +1 -1
  40. package/dist/components/UTBarChart/components/XAxis/index.js +53 -63
  41. package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +11 -9
  42. package/dist/components/UTBarChart/components/YAxis/constants.js +1 -1
  43. package/dist/components/UTBarChart/components/YAxis/index.js +29 -35
  44. package/dist/components/UTBarChart/components/YAxis/utils.js +6 -6
  45. package/dist/components/UTBarChart/constants.js +4 -4
  46. package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +22 -38
  47. package/dist/components/UTBarChart/index.js +151 -164
  48. package/dist/components/UTBarChart/theme.js +6 -3
  49. package/dist/components/UTBarChart/types.js +9 -9
  50. package/dist/components/UTBarChart/utils.js +118 -111
  51. package/dist/components/UTBreadcrumbs/constants.js +22 -24
  52. package/dist/components/UTBreadcrumbs/index.js +75 -99
  53. package/dist/components/UTBreadcrumbs/theme.js +6 -3
  54. package/dist/components/UTButton/constants.js +11 -11
  55. package/dist/components/UTButton/index.js +27 -29
  56. package/dist/components/UTButton/theme.js +26 -24
  57. package/dist/components/UTCBUInput/index.js +35 -38
  58. package/dist/components/UTCBUInput/theme.js +6 -3
  59. package/dist/components/UTCaptcha/index.js +18 -43
  60. package/dist/components/UTCard/components/UTCardFooter/index.js +14 -14
  61. package/dist/components/UTCard/index.js +84 -118
  62. package/dist/components/UTCard/theme.js +13 -13
  63. package/dist/components/UTCard/types.js +1 -1
  64. package/dist/components/UTCarousel/components/Button/index.js +12 -11
  65. package/dist/components/UTCarousel/components/Legend/index.js +12 -13
  66. package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +15 -14
  67. package/dist/components/UTCarousel/components/Slider/constants.js +5 -5
  68. package/dist/components/UTCarousel/components/Slider/index.js +203 -271
  69. package/dist/components/UTCarousel/components/Slider/layout.js +66 -92
  70. package/dist/components/UTCarousel/index.js +13 -13
  71. package/dist/components/UTCarousel/theme.js +6 -3
  72. package/dist/components/UTCheckList/constants.js +1 -1
  73. package/dist/components/UTCheckList/index.js +71 -91
  74. package/dist/components/UTCheckList/theme.js +34 -32
  75. package/dist/components/UTCheckbox/constants.js +2 -4
  76. package/dist/components/UTCheckbox/index.js +31 -42
  77. package/dist/components/UTCheckbox/theme.js +37 -35
  78. package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +8 -7
  79. package/dist/components/UTConsumptionBar/constants.js +3 -3
  80. package/dist/components/UTConsumptionBar/index.js +52 -78
  81. package/dist/components/UTCuit/index.js +108 -131
  82. package/dist/components/UTCuit/theme.js +52 -53
  83. package/dist/components/UTDatePicker/components/Day/constants.js +1 -1
  84. package/dist/components/UTDatePicker/components/Day/index.js +11 -10
  85. package/dist/components/UTDatePicker/constants.js +21 -22
  86. package/dist/components/UTDatePicker/index.js +59 -100
  87. package/dist/components/UTDatePicker/theme.js +8 -4
  88. package/dist/components/UTDatePicker/types.js +1 -1
  89. package/dist/components/UTDatePicker/utils.js +4 -6
  90. package/dist/components/UTDialog/constants.js +2 -2
  91. package/dist/components/UTDialog/index.js +37 -35
  92. package/dist/components/UTDialog/theme.js +6 -3
  93. package/dist/components/UTDialog/types.js +1 -1
  94. package/dist/components/UTDotMenu/index.js +38 -59
  95. package/dist/components/UTEmojiPicker/constants.js +5 -5
  96. package/dist/components/UTEmojiPicker/index.js +44 -63
  97. package/dist/components/UTEmojiPicker/theme.js +6 -3
  98. package/dist/components/UTEmojiPicker/utils.js +24 -52
  99. package/dist/components/UTExternalLink/constants.js +2 -2
  100. package/dist/components/UTExternalLink/index.js +17 -13
  101. package/dist/components/UTExternalLink/theme.js +11 -7
  102. package/dist/components/UTFileInput/constants.js +2 -2
  103. package/dist/components/UTFileInput/index.js +6 -29
  104. package/dist/components/UTFileInput/layout.js +67 -95
  105. package/dist/components/UTIconButton/index.js +48 -70
  106. package/dist/components/UTIconButton/theme.js +6 -3
  107. package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +52 -56
  108. package/dist/components/UTImageRadio/constants.js +3 -3
  109. package/dist/components/UTImageRadio/index.js +38 -45
  110. package/dist/components/UTImageRadio/theme.js +13 -13
  111. package/dist/components/UTImageRadio/types.js +1 -1
  112. package/dist/components/UTImageRadio/utils.js +4 -6
  113. package/dist/components/UTLabel/constants.js +13 -11
  114. package/dist/components/UTLabel/index.js +17 -18
  115. package/dist/components/UTLabel/theme.js +19 -16
  116. package/dist/components/UTList/index.js +14 -16
  117. package/dist/components/UTLoading/index.js +14 -13
  118. package/dist/components/UTMap/components/GoogleMaps/constants.js +9 -10
  119. package/dist/components/UTMap/components/GoogleMaps/index.js +62 -89
  120. package/dist/components/UTMap/constants.js +6 -6
  121. package/dist/components/UTMap/index.js +162 -196
  122. package/dist/components/UTMap/types.js +4 -3
  123. package/dist/components/UTMap/utils.js +35 -46
  124. package/dist/components/UTMap/withGoogleMapScript.js +18 -14
  125. package/dist/components/UTMenu/index.js +51 -67
  126. package/dist/components/UTMenu/theme.js +8 -4
  127. package/dist/components/UTMenu/utils.js +10 -12
  128. package/dist/components/UTModal/constants.js +9 -9
  129. package/dist/components/UTModal/index.js +25 -28
  130. package/dist/components/UTModal/theme.js +6 -3
  131. package/dist/components/UTPagination/components/PageSizeSelector/index.js +10 -8
  132. package/dist/components/UTPagination/components/PageSizeSelector/utils.js +9 -14
  133. package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +11 -10
  134. package/dist/components/UTPagination/components/Pagination/index.js +27 -37
  135. package/dist/components/UTPagination/components/Pagination/utils.js +10 -15
  136. package/dist/components/UTPagination/constants.js +3 -3
  137. package/dist/components/UTPagination/index.js +15 -15
  138. package/dist/components/UTPagination/theme.js +6 -3
  139. package/dist/components/UTPanel/index.js +37 -42
  140. package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +12 -8
  141. package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +21 -17
  142. package/dist/components/UTPasswordField/components/PasswordValidations/index.js +62 -48
  143. package/dist/components/UTPasswordField/components/PasswordWarning/index.js +24 -24
  144. package/dist/components/UTPasswordField/index.js +25 -21
  145. package/dist/components/UTPasswordField/theme.js +6 -3
  146. package/dist/components/UTPhoneInput/constants.js +3 -3
  147. package/dist/components/UTPhoneInput/index.js +179 -203
  148. package/dist/components/UTPhoneInput/theme.js +79 -77
  149. package/dist/components/UTPieChart/components/ArrowLabel/constants.js +4 -4
  150. package/dist/components/UTPieChart/components/ArrowLabel/index.js +23 -21
  151. package/dist/components/UTPieChart/components/Legend/contants.js +3 -3
  152. package/dist/components/UTPieChart/components/Legend/index.js +26 -22
  153. package/dist/components/UTPieChart/constants.js +13 -13
  154. package/dist/components/UTPieChart/hooks/use-animated-value/index.js +14 -31
  155. package/dist/components/UTPieChart/index.js +72 -74
  156. package/dist/components/UTPieChart/theme.js +6 -3
  157. package/dist/components/UTPieChart/utils.js +6 -3
  158. package/dist/components/UTProgressBar/constants.js +2 -2
  159. package/dist/components/UTProgressBar/index.js +14 -15
  160. package/dist/components/UTProgressBar/theme.js +6 -3
  161. package/dist/components/UTProgressBar/types.js +1 -1
  162. package/dist/components/UTRadioGroup/index.js +55 -81
  163. package/dist/components/UTRadioGroup/theme.js +54 -52
  164. package/dist/components/UTRating/components/Circle/index.js +40 -54
  165. package/dist/components/UTRating/components/Faces/assets/mood-confuzed.svg +3 -0
  166. package/dist/components/UTRating/components/Faces/assets/mood-empty.svg +3 -0
  167. package/dist/components/UTRating/components/Faces/assets/mood-happy.svg +3 -0
  168. package/dist/components/UTRating/components/Faces/assets/mood-sad.svg +3 -0
  169. package/dist/components/UTRating/components/Faces/assets/mood-smile.svg +3 -0
  170. package/dist/components/UTRating/components/Faces/constants.js +85 -0
  171. package/dist/components/UTRating/components/Faces/index.js +76 -0
  172. package/dist/components/UTRating/components/Faces/styles.module.scss +78 -0
  173. package/dist/components/UTRating/components/Star/index.js +35 -38
  174. package/dist/components/UTRating/constants.js +5 -4
  175. package/dist/components/UTRating/index.js +35 -46
  176. package/dist/components/UTRating/styles.module.scss +1 -0
  177. package/dist/components/UTRating/theme.js +52 -3
  178. package/dist/components/UTRipple/Ripple.js +21 -37
  179. package/dist/components/UTRipple/index.js +17 -35
  180. package/dist/components/UTSelect/components/Option/index.js +12 -11
  181. package/dist/components/UTSelect/constants.js +4 -4
  182. package/dist/components/UTSelect/index.js +62 -83
  183. package/dist/components/UTSelect/theme.js +9 -5
  184. package/dist/components/UTSelect/utils.js +5 -14
  185. package/dist/components/UTSidebar/components/ListOption/index.js +33 -47
  186. package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +7 -6
  187. package/dist/components/UTSidebar/components/LogosContainer/index.js +13 -12
  188. package/dist/components/UTSidebar/components/Option/constants.js +1 -1
  189. package/dist/components/UTSidebar/components/Option/index.js +27 -30
  190. package/dist/components/UTSidebar/components/Toggler/index.js +10 -9
  191. package/dist/components/UTSidebar/index.js +41 -51
  192. package/dist/components/UTSidebar/theme.js +6 -3
  193. package/dist/components/UTSidebar/types.js +5 -5
  194. package/dist/components/UTSkeleton/index.js +9 -34
  195. package/dist/components/UTStatus/constants.js +4 -4
  196. package/dist/components/UTStatus/index.js +15 -13
  197. package/dist/components/UTStatus/theme.js +70 -49
  198. package/dist/components/UTSwitch/constants.js +3 -3
  199. package/dist/components/UTSwitch/index.js +41 -55
  200. package/dist/components/UTSwitch/theme.js +6 -3
  201. package/dist/components/UTTable/components/ActionIcons/constants.js +1 -1
  202. package/dist/components/UTTable/components/ActionIcons/index.js +46 -83
  203. package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +9 -10
  204. package/dist/components/UTTable/components/Cell/index.js +17 -21
  205. package/dist/components/UTTable/components/HeaderCell/constants.js +1 -1
  206. package/dist/components/UTTable/components/HeaderCell/index.js +22 -28
  207. package/dist/components/UTTable/components/HeaderCell/utils.js +5 -4
  208. package/dist/components/UTTable/components/PrimaryAction/index.js +11 -9
  209. package/dist/components/UTTable/components/ResponsiveCell/index.js +18 -18
  210. package/dist/components/UTTable/components/Status/index.js +17 -17
  211. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +9 -7
  212. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +9 -14
  213. package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +11 -10
  214. package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +20 -30
  215. package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +10 -15
  216. package/dist/components/UTTable/components/TableFooter/constants.js +1 -1
  217. package/dist/components/UTTable/components/TableFooter/index.js +14 -13
  218. package/dist/components/UTTable/components/TableHeader/index.js +10 -9
  219. package/dist/components/UTTable/components/TableRow/constants.js +2 -4
  220. package/dist/components/UTTable/components/TableRow/index.js +78 -92
  221. package/dist/components/UTTable/constants.js +26 -24
  222. package/dist/components/UTTable/hook.js +13 -27
  223. package/dist/components/UTTable/index.js +125 -213
  224. package/dist/components/UTTable/theme.js +19 -18
  225. package/dist/components/UTTable/types.js +4 -4
  226. package/dist/components/UTTable/utils.js +80 -75
  227. package/dist/components/UTTabs/components/TooltipTab/index.js +19 -28
  228. package/dist/components/UTTabs/constants.js +4 -4
  229. package/dist/components/UTTabs/index.js +56 -84
  230. package/dist/components/UTTabs/theme.js +6 -3
  231. package/dist/components/UTTabs/utils.js +3 -2
  232. package/dist/components/UTTextArea/constants.js +2 -4
  233. package/dist/components/UTTextArea/index.js +22 -21
  234. package/dist/components/UTTextArea/theme.js +6 -3
  235. package/dist/components/UTTextInput/constants.js +1 -1
  236. package/dist/components/UTTextInput/index.js +136 -163
  237. package/dist/components/UTTextInput/theme.js +9 -5
  238. package/dist/components/UTThirdPartyCookieChecker/index.js +16 -19
  239. package/dist/components/UTToggle/components/ToggleOption/index.js +15 -15
  240. package/dist/components/UTToggle/index.js +24 -24
  241. package/dist/components/UTToggle/theme.js +6 -3
  242. package/dist/components/UTTooltip/index.js +22 -28
  243. package/dist/components/UTTooltip/theme.js +6 -3
  244. package/dist/components/UTTopbar/components/Notifications/index.js +10 -12
  245. package/dist/components/UTTopbar/components/UserMenu/index.js +14 -13
  246. package/dist/components/UTTopbar/index.js +27 -29
  247. package/dist/components/UTTopbar/theme.js +6 -3
  248. package/dist/components/UTTopbar/types.js +4 -4
  249. package/dist/components/UTTouchableWithoutFeedback/index.js +13 -25
  250. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +2 -2
  251. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +33 -29
  252. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +6 -5
  253. package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +6 -6
  254. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +7 -16
  255. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +22 -45
  256. package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +30 -32
  257. package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +89 -94
  258. package/dist/components/UTVirtualizedList/constants.js +4 -4
  259. package/dist/components/UTVirtualizedList/index.js +25 -36
  260. package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +14 -17
  261. package/dist/components/UTWorkflowContainer/constants.js +3 -3
  262. package/dist/components/UTWorkflowContainer/hooks/use-previous.js +5 -4
  263. package/dist/components/UTWorkflowContainer/index.js +31 -49
  264. package/dist/components/UTWorkflowContainer/theme.js +62 -54
  265. package/dist/components/UTWorkflowContainer/types.js +1 -1
  266. package/dist/components/WithLoading/index.js +9 -13
  267. package/dist/components/WithTheme/index.js +9 -15
  268. package/dist/components/WithTheme/layout.js +21 -26
  269. package/dist/components/WithTouch/index.js +11 -17
  270. package/dist/constants/UTTable.js +1 -1
  271. package/dist/index.js +58 -58
  272. package/dist/theme.js +8 -4
  273. package/dist/types/commonTypes.js +2 -2
  274. package/dist/types/consumptionTypes.js +2 -2
  275. package/dist/types/formTypes.js +3 -3
  276. package/dist/types/tableTypes.js +1 -1
  277. package/dist/utils/classesUtils.js +7 -13
  278. package/dist/utils/componentUtils.js +8 -10
  279. package/dist/utils/helperFunctions.js +6 -5
  280. package/dist/utils/shadowUtils.js +15 -12
  281. package/dist/utils/useScreenSize.js +1 -1
  282. package/package.json +2 -2
  283. package/CHANGELOG.md +0 -2234
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.xAxisDefinitionType = exports.referencesType = exports.linearType = exports.linearMarkersType = exports.linearDataType = exports.levelsType = exports.buttonPropsTypes = exports.barType = exports.barDataType = void 0;
7
7
  var _propTypes = require("prop-types");
8
- var barType = exports.barType = (0, _propTypes.shape)({
8
+ const barType = exports.barType = (0, _propTypes.shape)({
9
9
  clickable: _propTypes.bool,
10
10
  color: _propTypes.string,
11
11
  highlightColor: _propTypes.string,
@@ -21,11 +21,11 @@ var barType = exports.barType = (0, _propTypes.shape)({
21
21
  value: _propTypes.number
22
22
  }))
23
23
  });
24
- var barDataType = exports.barDataType = (0, _propTypes.arrayOf)((0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(barType), barType]));
25
- var linearMarkersType = exports.linearMarkersType = (0, _propTypes.shape)({
24
+ const barDataType = exports.barDataType = (0, _propTypes.arrayOf)((0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(barType), barType]));
25
+ const linearMarkersType = exports.linearMarkersType = (0, _propTypes.shape)({
26
26
  type: _propTypes.string
27
27
  });
28
- var linearType = exports.linearType = (0, _propTypes.shape)({
28
+ const linearType = exports.linearType = (0, _propTypes.shape)({
29
29
  color: _propTypes.string,
30
30
  data: (0, _propTypes.arrayOf)({
31
31
  xCoodrinate: _propTypes.number,
@@ -34,13 +34,13 @@ var linearType = exports.linearType = (0, _propTypes.shape)({
34
34
  marker: linearMarkersType,
35
35
  type: _propTypes.string
36
36
  });
37
- var linearDataType = exports.linearDataType = (0, _propTypes.arrayOf)(linearType);
38
- var levelsType = exports.levelsType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
37
+ const linearDataType = exports.linearDataType = (0, _propTypes.arrayOf)(linearType);
38
+ const levelsType = exports.levelsType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
39
39
  value: _propTypes.number,
40
40
  color: _propTypes.string,
41
41
  id: _propTypes.string
42
42
  }));
43
- var referencesType = exports.referencesType = (0, _propTypes.shape)({
43
+ const referencesType = exports.referencesType = (0, _propTypes.shape)({
44
44
  check: _propTypes.func,
45
45
  className: _propTypes.string,
46
46
  CustomIcon: _propTypes.elementType,
@@ -48,13 +48,13 @@ var referencesType = exports.referencesType = (0, _propTypes.shape)({
48
48
  label: _propTypes.string,
49
49
  orderFunction: _propTypes.func
50
50
  });
51
- var xAxisDefinitionType = exports.xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
51
+ const xAxisDefinitionType = exports.xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
52
52
  labelBackgroundPadding: _propTypes.number,
53
53
  mainLabel: _propTypes.string,
54
54
  secondaryLabel: _propTypes.string,
55
55
  selectedLabelBackground: _propTypes.string
56
56
  }));
57
- var buttonPropsTypes = exports.buttonPropsTypes = (0, _propTypes.shape)({
57
+ const buttonPropsTypes = exports.buttonPropsTypes = (0, _propTypes.shape)({
58
58
  colorTheme: _propTypes.string,
59
59
  iconPlacement: _propTypes.string,
60
60
  size: _propTypes.string,
@@ -7,75 +7,67 @@ exports.getPages = exports.getMinValue = exports.getMaxValues = exports.getMaxVa
7
7
  var _array = require("@widergy/web-utils/lib/array");
8
8
  var d3 = _interopRequireWildcard(require("d3"));
9
9
  var _constants = require("./constants");
10
- var _excluded = ["x"],
11
- _excluded2 = ["x"];
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
- 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; }
18
- 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) { _defineProperty(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; }
19
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
22
- var getPages = exports.getPages = function getPages() {
23
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
24
- var pagination = arguments.length > 1 ? arguments[1] : undefined;
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ const getPages = function () {
13
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
14
+ let pagination = arguments.length > 1 ? arguments[1] : undefined;
25
15
  return Math.ceil(data.length / pagination);
26
16
  };
27
- var getFormattedData = exports.getFormattedData = function getFormattedData() {
28
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
29
- var pagination = arguments.length > 1 ? arguments[1] : undefined;
30
- var index = arguments.length > 2 ? arguments[2] : undefined;
17
+ exports.getPages = getPages;
18
+ const getFormattedData = function () {
19
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
20
+ let pagination = arguments.length > 1 ? arguments[1] : undefined;
21
+ let index = arguments.length > 2 ? arguments[2] : undefined;
31
22
  return data.slice(index * pagination, (index + 1) * pagination);
32
23
  };
33
- var getFormattedLinearData = exports.getFormattedLinearData = function getFormattedLinearData() {
34
- var linearData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
35
- var currentPage = arguments.length > 1 ? arguments[1] : undefined;
36
- var pagination = arguments.length > 2 ? arguments[2] : undefined;
37
- return linearData.filter(function (_ref) {
38
- var xCoordinate = _ref.xCoordinate;
24
+ exports.getFormattedData = getFormattedData;
25
+ const getFormattedLinearData = function () {
26
+ let linearData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
27
+ let currentPage = arguments.length > 1 ? arguments[1] : undefined;
28
+ let pagination = arguments.length > 2 ? arguments[2] : undefined;
29
+ return linearData.filter(_ref => {
30
+ let {
31
+ xCoordinate
32
+ } = _ref;
39
33
  return Math.floor(xCoordinate / pagination) === currentPage;
40
- }).map(function (item, i) {
41
- return _objectSpread(_objectSpread({}, item), {}, {
42
- xCoordinate: i
43
- });
44
- });
45
- };
46
- var getMaxValue = exports.getMaxValue = function getMaxValue(dataSet) {
47
- return dataSet && !(0, _array.isEmpty)(dataSet) && (d3.max(dataSet, function (_ref2) {
48
- var value = _ref2.value;
49
- return value;
50
- }) || 0);
51
- };
52
- var getMinValue = exports.getMinValue = function getMinValue(dataSet) {
53
- return dataSet && !(0, _array.isEmpty)(dataSet) && d3.min(dataSet, function (_ref3) {
54
- var value = _ref3.value;
55
- return value;
56
- }) || 0;
57
- };
58
- var maxValueOrDefault = function maxValueOrDefault(value) {
59
- return value === 0 ? _constants.DEFAULT_MAX_VALUE : value;
34
+ }).map((item, i) => ({
35
+ ...item,
36
+ xCoordinate: i
37
+ }));
60
38
  };
61
- var getMaxValues = exports.getMaxValues = function getMaxValues(flatBarData, flatLinearData, levels) {
62
- return {
63
- maxLinearValue: maxValueOrDefault(getMaxValue(flatLinearData)),
64
- maxBarValue: maxValueOrDefault(Math.max(getMaxValue(flatBarData), getMaxValue(levels)))
65
- };
66
- };
67
- var calculateTotalWidth = function calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) {
68
- var minimumNeededWidth = dataLength * groups * (minBarWidth + 2 * padding) + marginLeft + marginRight;
39
+ exports.getFormattedLinearData = getFormattedLinearData;
40
+ const getMaxValue = dataSet => dataSet && !(0, _array.isEmpty)(dataSet) && (d3.max(dataSet, _ref2 => {
41
+ let {
42
+ value
43
+ } = _ref2;
44
+ return value;
45
+ }) || 0);
46
+ exports.getMaxValue = getMaxValue;
47
+ const getMinValue = dataSet => dataSet && !(0, _array.isEmpty)(dataSet) && d3.min(dataSet, _ref3 => {
48
+ let {
49
+ value
50
+ } = _ref3;
51
+ return value;
52
+ }) || 0;
53
+ exports.getMinValue = getMinValue;
54
+ const maxValueOrDefault = value => value === 0 ? _constants.DEFAULT_MAX_VALUE : value;
55
+ const getMaxValues = (flatBarData, flatLinearData, levels) => ({
56
+ maxLinearValue: maxValueOrDefault(getMaxValue(flatLinearData)),
57
+ maxBarValue: maxValueOrDefault(Math.max(getMaxValue(flatBarData), getMaxValue(levels)))
58
+ });
59
+ exports.getMaxValues = getMaxValues;
60
+ const calculateTotalWidth = (minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) => {
61
+ const minimumNeededWidth = dataLength * groups * (minBarWidth + 2 * padding) + marginLeft + marginRight;
69
62
  return Math.max(containerWidth, minimumNeededWidth);
70
63
  };
71
- var getGraphAttributes = exports.getGraphAttributes = function getGraphAttributes(containerWidth, containerHeight, marginLeft, marginRight, marginBottom, minBarWidth, dataLength, padding, groups, spacingOptions) {
72
- var totalWidth = minBarWidth ? calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) : containerWidth;
73
- var _spacingOptions$axisP = spacingOptions.axisPadding,
74
- axisPadding = _spacingOptions$axisP === void 0 ? _constants.DEFAULT_AXIS_PADDING : _spacingOptions$axisP,
75
- _spacingOptions$scrol = spacingOptions.scrollPadding,
76
- scrollPadding = _spacingOptions$scrol === void 0 ? _constants.DEFAULT_SCROLL_PADDING : _spacingOptions$scrol,
77
- _spacingOptions$margi = spacingOptions.marginTop,
78
- marginTop = _spacingOptions$margi === void 0 ? _constants.DEFAULT_MARGIN_TOP : _spacingOptions$margi;
64
+ const getGraphAttributes = (containerWidth, containerHeight, marginLeft, marginRight, marginBottom, minBarWidth, dataLength, padding, groups, spacingOptions) => {
65
+ const totalWidth = minBarWidth ? calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) : containerWidth;
66
+ const {
67
+ axisPadding = _constants.DEFAULT_AXIS_PADDING,
68
+ scrollPadding = _constants.DEFAULT_SCROLL_PADDING,
69
+ marginTop = _constants.DEFAULT_MARGIN_TOP
70
+ } = spacingOptions;
79
71
  return {
80
72
  TOTAL_WIDTH: totalWidth,
81
73
  TOTAL_HEIGHT: containerHeight,
@@ -85,73 +77,88 @@ var getGraphAttributes = exports.getGraphAttributes = function getGraphAttribute
85
77
  GRAPH_Y_END: marginTop + 4 * axisPadding
86
78
  };
87
79
  };
88
- var flattenBarData = function flattenBarData(data) {
80
+ exports.getGraphAttributes = getGraphAttributes;
81
+ const flattenBarData = data => {
89
82
  var _data$0$;
90
- return data && Array.isArray((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.values) ? data.flat().map(function (_ref4) {
91
- var values = _ref4.values;
83
+ return data && Array.isArray((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.values) ? data.flat().map(_ref4 => {
84
+ let {
85
+ values
86
+ } = _ref4;
92
87
  return values;
93
88
  }).flat() : data.flat();
94
89
  };
95
- var flattenAndReduceBarData = exports.flattenAndReduceBarData = function flattenAndReduceBarData(data) {
90
+ const flattenAndReduceBarData = data => {
96
91
  var _data$0$2;
97
- return data && (Array.isArray((_data$0$2 = data[0][0]) === null || _data$0$2 === void 0 ? void 0 : _data$0$2.values) ? data.flat().map(function (_ref5) {
98
- var values = _ref5.values;
92
+ return data && (Array.isArray((_data$0$2 = data[0][0]) === null || _data$0$2 === void 0 ? void 0 : _data$0$2.values) ? data.flat().map(_ref5 => {
93
+ let {
94
+ values
95
+ } = _ref5;
99
96
  return {
100
- value: values.reduce(function (acc, _ref6) {
101
- var value = _ref6.value;
97
+ value: values.reduce((acc, _ref6) => {
98
+ let {
99
+ value
100
+ } = _ref6;
102
101
  return acc + value;
103
102
  }, 0)
104
103
  };
105
104
  }) : data.flat());
106
105
  };
107
- var flattenLinearData = function flattenLinearData(linearData) {
108
- return linearData === null || linearData === void 0 ? void 0 : linearData.map(function (_ref7) {
109
- var data = _ref7.data;
110
- return data;
111
- }).flat();
112
- };
113
- var flattenData = exports.flattenData = function flattenData(barData, linearData) {
114
- return {
115
- flatBarData: flattenBarData(barData),
116
- flatLinearData: flattenLinearData(linearData)
117
- };
118
- };
119
- var getFormattedDecorators = exports.getFormattedDecorators = function getFormattedDecorators(xAxis) {
120
- var decorators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
121
- var currentPage = arguments.length > 2 ? arguments[2] : undefined;
122
- var pagination = arguments.length > 3 ? arguments[3] : undefined;
106
+ exports.flattenAndReduceBarData = flattenAndReduceBarData;
107
+ const flattenLinearData = linearData => linearData === null || linearData === void 0 ? void 0 : linearData.map(_ref7 => {
108
+ let {
109
+ data
110
+ } = _ref7;
111
+ return data;
112
+ }).flat();
113
+ const flattenData = (barData, linearData) => ({
114
+ flatBarData: flattenBarData(barData),
115
+ flatLinearData: flattenLinearData(linearData)
116
+ });
117
+ exports.flattenData = flattenData;
118
+ const getFormattedDecorators = function (xAxis) {
119
+ let decorators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
120
+ let currentPage = arguments.length > 2 ? arguments[2] : undefined;
121
+ let pagination = arguments.length > 3 ? arguments[3] : undefined;
123
122
  if (pagination) {
124
- var rangeStart = currentPage * pagination;
125
- var rangeEnd = (currentPage + 1) * pagination;
126
- var validDecorators = pagination ? decorators.filter(function (_ref8) {
127
- var x = _ref8.x;
123
+ const rangeStart = currentPage * pagination;
124
+ const rangeEnd = (currentPage + 1) * pagination;
125
+ const validDecorators = pagination ? decorators.filter(_ref8 => {
126
+ let {
127
+ x
128
+ } = _ref8;
128
129
  return rangeStart <= x && rangeEnd > x;
129
130
  }) : decorators;
130
- return validDecorators.map(function (_ref9) {
131
- var x = _ref9.x,
132
- config = _objectWithoutProperties(_ref9, _excluded);
133
- return _objectSpread({
131
+ return validDecorators.map(_ref9 => {
132
+ let {
133
+ x,
134
+ ...config
135
+ } = _ref9;
136
+ return {
134
137
  x: pagination ? xAxis(x - currentPage * pagination) : xAxis(x),
135
- id: x
136
- }, config);
138
+ id: x,
139
+ ...config
140
+ };
137
141
  });
138
142
  }
139
- return decorators.map(function (_ref10) {
140
- var x = _ref10.x,
141
- config = _objectWithoutProperties(_ref10, _excluded2);
142
- return _objectSpread({
143
- x: xAxis(x)
144
- }, config);
145
- });
146
- };
147
- var getGrid = exports.getGrid = function getGrid(ticks, maxValue) {
148
- return new Array(ticks).fill(0).map(function (_, index) {
143
+ return decorators.map(_ref10 => {
144
+ let {
145
+ x,
146
+ ...config
147
+ } = _ref10;
149
148
  return {
150
- value: maxValue - index * maxValue / (ticks - 1),
151
- type: 'grid'
149
+ x: xAxis(x),
150
+ ...config
152
151
  };
153
- }).filter(function (_ref11) {
154
- var value = _ref11.value;
155
- return !!value;
156
152
  });
157
- };
153
+ };
154
+ exports.getFormattedDecorators = getFormattedDecorators;
155
+ const getGrid = (ticks, maxValue) => new Array(ticks).fill(0).map((_, index) => ({
156
+ value: maxValue - index * maxValue / (ticks - 1),
157
+ type: 'grid'
158
+ })).filter(_ref11 => {
159
+ let {
160
+ value
161
+ } = _ref11;
162
+ return !!value;
163
+ });
164
+ exports.getGrid = getGrid;
@@ -4,37 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_SEPARATOR = exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = exports.DEFAULT_ELIPSIS = exports.COMPONENTS_THEME_PROPS = exports.COLOR_THEMES_MAPPER = exports.COLOR_THEMES = void 0;
7
- var _COMPONENTS_THEME_PRO;
8
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
- var DEFAULT_SEPARATOR = exports.DEFAULT_SEPARATOR = '/';
13
- var DEFAULT_ELIPSIS = exports.DEFAULT_ELIPSIS = '...';
14
- var DEFAULT_ELIPSIS_WIDTH_ESTIMATE = exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = 100;
15
- var COLOR_THEMES = exports.COLOR_THEMES = {
7
+ const DEFAULT_SEPARATOR = exports.DEFAULT_SEPARATOR = '/';
8
+ const DEFAULT_ELIPSIS = exports.DEFAULT_ELIPSIS = '...';
9
+ const DEFAULT_ELIPSIS_WIDTH_ESTIMATE = exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = 100;
10
+ const COLOR_THEMES = exports.COLOR_THEMES = {
16
11
  DARK: 'dark',
17
12
  LIGHT: 'light'
18
13
  };
19
- var COMPONENTS_THEME_PROPS = exports.COMPONENTS_THEME_PROPS = (_COMPONENTS_THEME_PRO = {}, _defineProperty(_COMPONENTS_THEME_PRO, COLOR_THEMES.DARK, {
20
- button: {
21
- colorTheme: 'secondary'
14
+ const COMPONENTS_THEME_PROPS = exports.COMPONENTS_THEME_PROPS = {
15
+ [COLOR_THEMES.DARK]: {
16
+ button: {
17
+ colorTheme: 'secondary'
18
+ },
19
+ label: {
20
+ colorTheme: 'gray'
21
+ }
22
22
  },
23
- label: {
24
- colorTheme: 'gray'
23
+ [COLOR_THEMES.LIGHT]: {
24
+ button: {
25
+ colorTheme: 'negative'
26
+ },
27
+ label: {
28
+ colorTheme: 'negative',
29
+ shade: '03'
30
+ }
25
31
  }
26
- }), _defineProperty(_COMPONENTS_THEME_PRO, COLOR_THEMES.LIGHT, {
27
- button: {
28
- colorTheme: 'negative'
29
- },
30
- label: {
31
- colorTheme: 'negative',
32
- shade: '03'
33
- }
34
- }), _COMPONENTS_THEME_PRO);
32
+ };
35
33
 
36
34
  // temporary mapper for compatibility with 'buttonColorTheme' attribute in office-web-edenor
37
- var COLOR_THEMES_MAPPER = exports.COLOR_THEMES_MAPPER = {
35
+ const COLOR_THEMES_MAPPER = exports.COLOR_THEMES_MAPPER = {
38
36
  negative: COLOR_THEMES.LIGHT,
39
37
  primary: COLOR_THEMES.DARK,
40
38
  secondary: COLOR_THEMES.DARK
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -16,130 +15,107 @@ var _constants = require("./constants");
16
15
  var _theme = require("./theme");
17
16
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
18
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
20
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
23
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
25
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
26
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
28
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
30
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
31
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
32
- var UTBreadcrumbs = function UTBreadcrumbs(_ref) {
33
- var breadcrumbs = _ref.breadcrumbs,
34
- themeClasses = _ref.classes,
35
- classNames = _ref.classNames,
36
- _ref$colorTheme = _ref.colorTheme,
37
- colorTheme = _ref$colorTheme === void 0 ? _constants.COLOR_THEMES.DARK : _ref$colorTheme,
38
- _ref$disableMenu = _ref.disableMenu,
39
- disableMenu = _ref$disableMenu === void 0 ? false : _ref$disableMenu,
40
- _ref$elipsis = _ref.elipsis,
41
- elipsis = _ref$elipsis === void 0 ? _constants.DEFAULT_ELIPSIS : _ref$elipsis,
42
- _ref$elipsisWidthEsti = _ref.elipsisWidthEstimate,
43
- elipsisWidthEstimate = _ref$elipsisWidthEsti === void 0 ? _constants.DEFAULT_ELIPSIS_WIDTH_ESTIMATE : _ref$elipsisWidthEsti,
44
- _ref$firstItemOverflo = _ref.firstItemOverflow,
45
- firstItemOverflow = _ref$firstItemOverflo === void 0 ? false : _ref$firstItemOverflo,
46
- _ref$menuProps = _ref.menuProps,
47
- menuProps = _ref$menuProps === void 0 ? {} : _ref$menuProps,
48
- onRedirect = _ref.onRedirect,
49
- _ref$separator = _ref.separator,
50
- separator = _ref$separator === void 0 ? _constants.DEFAULT_SEPARATOR : _ref$separator;
51
- var classes = (0, _react.useMemo)(function () {
52
- return (0, _classesUtils.mergeClasses)(themeClasses, classNames);
53
- }, [classNames]);
54
- var containerRef = (0, _react.useRef)();
55
- var _useState = (0, _react.useState)(breadcrumbs),
56
- _useState2 = _slicedToArray(_useState, 2),
57
- content = _useState2[0],
58
- setContent = _useState2[1];
59
- var _useState3 = (0, _react.useState)({
60
- anchor: null,
61
- items: []
62
- }),
63
- _useState4 = _slicedToArray(_useState3, 2),
64
- menu = _useState4[0],
65
- setMenu = _useState4[1];
66
- var getSectionsTotalWidth = function getSectionsTotalWidth(ref) {
67
- return _toConsumableArray(ref.current.children).reduce(function (total, currentChildren) {
68
- return total + currentChildren.offsetWidth;
69
- }, 0);
70
- };
71
- var getItemsBeforeCollapse = function getItemsBeforeCollapse(ref) {
72
- var sections = _toConsumableArray(ref.current.children);
73
- var containerWidth = ref.current.offsetWidth;
74
- var itemsBeforeCollapse = 1;
75
- var accumulatedWidth = 0;
76
- var firstItemWidth = sections[0].offsetWidth;
77
- var lastItemWidth = sections[sections.length - 2].offsetWidth;
78
- var availableWidth = containerWidth - firstItemWidth - lastItemWidth - elipsisWidthEstimate;
79
- sections.slice(1).forEach(function (section) {
21
+ const UTBreadcrumbs = _ref => {
22
+ let {
23
+ breadcrumbs,
24
+ classes: themeClasses,
25
+ classNames,
26
+ colorTheme = _constants.COLOR_THEMES.DARK,
27
+ disableMenu = false,
28
+ elipsis = _constants.DEFAULT_ELIPSIS,
29
+ elipsisWidthEstimate = _constants.DEFAULT_ELIPSIS_WIDTH_ESTIMATE,
30
+ firstItemOverflow = false,
31
+ menuProps = {},
32
+ onRedirect,
33
+ separator = _constants.DEFAULT_SEPARATOR
34
+ } = _ref;
35
+ const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(themeClasses, classNames), [classNames]);
36
+ const containerRef = (0, _react.useRef)();
37
+ const [content, setContent] = (0, _react.useState)(breadcrumbs);
38
+ const [menu, setMenu] = (0, _react.useState)({
39
+ anchor: null,
40
+ items: []
41
+ });
42
+ const getSectionsTotalWidth = ref => [...ref.current.children].reduce((total, currentChildren) => total + currentChildren.offsetWidth, 0);
43
+ const getItemsBeforeCollapse = ref => {
44
+ const sections = [...ref.current.children];
45
+ const {
46
+ offsetWidth: containerWidth
47
+ } = ref.current;
48
+ let itemsBeforeCollapse = 1;
49
+ let accumulatedWidth = 0;
50
+ const firstItemWidth = sections[0].offsetWidth;
51
+ const lastItemWidth = sections[sections.length - 2].offsetWidth;
52
+ const availableWidth = containerWidth - firstItemWidth - lastItemWidth - elipsisWidthEstimate;
53
+ sections.slice(1).forEach(section => {
80
54
  accumulatedWidth += section.offsetWidth;
81
55
  if (accumulatedWidth <= availableWidth) itemsBeforeCollapse += 1;
82
56
  });
83
57
  return itemsBeforeCollapse;
84
58
  };
85
- var truncate = function truncate() {
59
+ const truncate = () => {
86
60
  if (!containerRef.current) return;
87
- var containerWidth = containerRef.current.offsetWidth;
88
- var childrenTotalWidth = getSectionsTotalWidth(containerRef);
61
+ const {
62
+ offsetWidth: containerWidth
63
+ } = containerRef.current;
64
+ const childrenTotalWidth = getSectionsTotalWidth(containerRef);
89
65
  if (childrenTotalWidth > containerWidth) {
90
- setContent(function (prevContent) {
91
- var isCollapsed = prevContent.some(function (_ref2) {
92
- var label = _ref2.label;
66
+ setContent(prevContent => {
67
+ const isCollapsed = prevContent.some(_ref2 => {
68
+ let {
69
+ label
70
+ } = _ref2;
93
71
  return label === elipsis;
94
72
  });
95
73
  if (isCollapsed) return prevContent;
96
74
  if (prevContent.length <= 2) return prevContent;
97
- var itemsBeforeCollapse = getItemsBeforeCollapse(containerRef);
98
- return [].concat(_toConsumableArray(prevContent.slice(0, itemsBeforeCollapse)), [{
75
+ const itemsBeforeCollapse = getItemsBeforeCollapse(containerRef);
76
+ return [...prevContent.slice(0, itemsBeforeCollapse), {
99
77
  label: elipsis,
100
78
  menuItems: prevContent.slice(itemsBeforeCollapse, prevContent.length - 1)
101
- }, prevContent[prevContent.length - 1]]);
79
+ }, prevContent[prevContent.length - 1]];
102
80
  });
103
81
  }
104
82
  };
105
- (0, _react.useEffect)(function () {
83
+ (0, _react.useEffect)(() => {
106
84
  setContent(breadcrumbs);
107
85
  }, [breadcrumbs]);
108
- (0, _react.useEffect)(function () {
109
- if (containerRef.current) window.requestAnimationFrame(function () {
110
- return truncate();
111
- });
86
+ (0, _react.useEffect)(() => {
87
+ if (containerRef.current) window.requestAnimationFrame(() => truncate());
112
88
  }, [content]);
113
- (0, _react.useEffect)(function () {
89
+ (0, _react.useEffect)(() => {
114
90
  window.addEventListener('resize', truncate);
115
- return function () {
116
- return window.removeEventListener('resize', truncate);
117
- };
91
+ return () => window.removeEventListener('resize', truncate);
118
92
  }, []);
119
- var handleCloseMenu = function handleCloseMenu() {
120
- return setMenu({
121
- anchor: null,
122
- items: []
123
- });
124
- };
93
+ const handleCloseMenu = () => setMenu({
94
+ anchor: null,
95
+ items: []
96
+ });
125
97
  return /*#__PURE__*/_react.default.createElement("div", {
126
98
  className: _stylesModule.default.breadcrumbs,
127
99
  ref: containerRef
128
- }, content.map(function (_ref3, index) {
129
- var buttonColorTheme = _ref3.buttonColorTheme,
130
- itemClassName = _ref3.itemClassName,
131
- label = _ref3.label,
132
- menuItems = _ref3.menuItems,
133
- route = _ref3.route;
134
- var handleClick = function handleClick(event) {
100
+ }, content.map((_ref3, index) => {
101
+ let {
102
+ buttonColorTheme,
103
+ itemClassName,
104
+ label,
105
+ menuItems,
106
+ route
107
+ } = _ref3;
108
+ const handleClick = event => {
135
109
  if (menuItems) setMenu({
136
110
  anchor: event.currentTarget,
137
- items: _toConsumableArray(menuItems).map(function (_ref4) {
138
- var menuItemLabel = _ref4.label,
139
- menuItemRoute = _ref4.route;
111
+ items: [...menuItems].map(_ref4 => {
112
+ let {
113
+ label: menuItemLabel,
114
+ route: menuItemRoute
115
+ } = _ref4;
140
116
  return {
141
117
  label: menuItemLabel,
142
- onClick: function onClick() {
118
+ onClick: () => {
143
119
  setContent(breadcrumbs);
144
120
  handleCloseMenu();
145
121
  onRedirect(menuItemRoute);
@@ -148,9 +124,9 @@ var UTBreadcrumbs = function UTBreadcrumbs(_ref) {
148
124
  })
149
125
  });else onRedirect(route);
150
126
  };
151
- var isLast = index === content.length - 1;
152
- var overflowControl = index === 0 && firstItemOverflow;
153
- var colorThemesDefinition = buttonColorTheme ? _constants.COMPONENTS_THEME_PROPS[_constants.COLOR_THEMES_MAPPER[buttonColorTheme]] : _constants.COMPONENTS_THEME_PROPS[colorTheme];
127
+ const isLast = index === content.length - 1;
128
+ const overflowControl = index === 0 && firstItemOverflow;
129
+ const colorThemesDefinition = buttonColorTheme ? _constants.COMPONENTS_THEME_PROPS[_constants.COLOR_THEMES_MAPPER[buttonColorTheme]] : _constants.COMPONENTS_THEME_PROPS[colorTheme];
154
130
  return /*#__PURE__*/_react.default.createElement("div", {
155
131
  className: "".concat(_stylesModule.default.section, " ").concat(overflowControl && _stylesModule.default.firstItem),
156
132
  key: "".concat(route, "-").concat(label)
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.retrieveStyle = void 0;
7
7
  var _classesUtils = require("../../utils/classesUtils");
8
- var retrieveStyle = exports.retrieveStyle = function retrieveStyle(_ref) {
8
+ const retrieveStyle = _ref => {
9
9
  var _theme$UTBreadcrumbs;
10
- var theme = _ref.theme;
10
+ let {
11
+ theme
12
+ } = _ref;
11
13
  return {
12
14
  separator: {
13
15
  margin: (0, _classesUtils.withImportant)((theme === null || theme === void 0 || (_theme$UTBreadcrumbs = theme.UTBreadcrumbs) === null || _theme$UTBreadcrumbs === void 0 || (_theme$UTBreadcrumbs = _theme$UTBreadcrumbs.separator) === null || _theme$UTBreadcrumbs === void 0 ? void 0 : _theme$UTBreadcrumbs.margin) || '0 12px')
14
16
  }
15
17
  };
16
- };
18
+ };
19
+ exports.retrieveStyle = retrieveStyle;