@widergy/energy-ui 1.136.0 → 1.136.2

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 (256) hide show
  1. package/dist/components/EnergyThemeProvider/index.js +13 -36
  2. package/dist/components/Loading/constants.js +1 -2
  3. package/dist/components/Loading/index.js +13 -12
  4. package/dist/components/Loading/theme.js +9 -11
  5. package/dist/components/UTAlert/AlertHandler.js +75 -101
  6. package/dist/components/UTAlert/index.js +65 -87
  7. package/dist/components/UTAlert/theme.js +29 -31
  8. package/dist/components/UTAttachment/components/Preview/index.js +8 -9
  9. package/dist/components/UTAttachment/constants.js +7 -13
  10. package/dist/components/UTAttachment/index.js +153 -232
  11. package/dist/components/UTAttachment/layout.js +25 -26
  12. package/dist/components/UTAttachment/theme.js +12 -14
  13. package/dist/components/UTAttachment/utils.js +34 -117
  14. package/dist/components/UTAutocomplete/components/ListBox/index.js +13 -21
  15. package/dist/components/UTAutocomplete/components/ListBox/utils.js +9 -11
  16. package/dist/components/UTAutocomplete/constants.js +12 -23
  17. package/dist/components/UTAutocomplete/index.js +45 -66
  18. package/dist/components/UTAutocomplete/theme.js +3 -3
  19. package/dist/components/UTAvatar/constants.js +2 -3
  20. package/dist/components/UTAvatar/index.js +15 -12
  21. package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +22 -22
  22. package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +1 -1
  23. package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +21 -22
  24. package/dist/components/UTBarChart/components/Bars/constants.js +3 -6
  25. package/dist/components/UTBarChart/components/Bars/index.js +70 -80
  26. package/dist/components/UTBarChart/components/Legend/constants.js +12 -18
  27. package/dist/components/UTBarChart/components/Legend/index.js +73 -91
  28. package/dist/components/UTBarChart/components/Legend/utils.js +1 -5
  29. package/dist/components/UTBarChart/components/Levels/index.js +16 -14
  30. package/dist/components/UTBarChart/components/Levels/utils.js +25 -27
  31. package/dist/components/UTBarChart/components/LinearPlot/constants.js +3 -5
  32. package/dist/components/UTBarChart/components/LinearPlot/index.js +25 -20
  33. package/dist/components/UTBarChart/components/LinearPlot/utils.js +37 -39
  34. package/dist/components/UTBarChart/components/Pagination/constants.js +1 -2
  35. package/dist/components/UTBarChart/components/Pagination/index.js +20 -24
  36. package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +21 -32
  37. package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +2 -4
  38. package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +20 -19
  39. package/dist/components/UTBarChart/components/XAxis/constants.js +1 -2
  40. package/dist/components/UTBarChart/components/XAxis/index.js +54 -65
  41. package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +12 -11
  42. package/dist/components/UTBarChart/components/YAxis/constants.js +1 -2
  43. package/dist/components/UTBarChart/components/YAxis/index.js +24 -31
  44. package/dist/components/UTBarChart/components/YAxis/utils.js +4 -6
  45. package/dist/components/UTBarChart/constants.js +4 -8
  46. package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +23 -40
  47. package/dist/components/UTBarChart/index.js +148 -162
  48. package/dist/components/UTBarChart/theme.js +102 -104
  49. package/dist/components/UTBarChart/types.js +9 -17
  50. package/dist/components/UTBarChart/utils.js +107 -111
  51. package/dist/components/UTBreadcrumbs/constants.js +3 -6
  52. package/dist/components/UTBreadcrumbs/index.js +79 -106
  53. package/dist/components/UTBreadcrumbs/theme.js +21 -23
  54. package/dist/components/UTButton/index.js +48 -71
  55. package/dist/components/UTButton/theme.js +172 -174
  56. package/dist/components/UTCBUInput/index.js +36 -40
  57. package/dist/components/UTCBUInput/theme.js +5 -7
  58. package/dist/components/UTCaptcha/index.js +19 -45
  59. package/dist/components/UTCard/components/UTCardFooter/index.js +16 -17
  60. package/dist/components/UTCard/index.js +87 -122
  61. package/dist/components/UTCard/theme.js +8 -11
  62. package/dist/components/UTCard/types.js +2 -3
  63. package/dist/components/UTCarousel/components/Button/index.js +13 -13
  64. package/dist/components/UTCarousel/components/Legend/index.js +14 -16
  65. package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
  66. package/dist/components/UTCarousel/components/Slider/constants.js +5 -10
  67. package/dist/components/UTCarousel/components/Slider/index.js +181 -252
  68. package/dist/components/UTCarousel/components/Slider/layout.js +66 -93
  69. package/dist/components/UTCarousel/index.js +14 -15
  70. package/dist/components/UTCarousel/theme.js +35 -37
  71. package/dist/components/UTCheckList/constants.js +1 -2
  72. package/dist/components/UTCheckList/index.js +72 -91
  73. package/dist/components/UTCheckList/theme.js +66 -70
  74. package/dist/components/UTCheckbox/constants.js +3 -6
  75. package/dist/components/UTCheckbox/index.js +31 -42
  76. package/dist/components/UTCheckbox/theme.js +49 -53
  77. package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
  78. package/dist/components/UTConsumptionBar/constants.js +3 -6
  79. package/dist/components/UTConsumptionBar/index.js +49 -74
  80. package/dist/components/UTCuit/index.js +109 -133
  81. package/dist/components/UTCuit/theme.js +47 -49
  82. package/dist/components/UTDatePicker/components/Day/constants.js +1 -2
  83. package/dist/components/UTDatePicker/components/Day/index.js +12 -12
  84. package/dist/components/UTDatePicker/constants.js +20 -31
  85. package/dist/components/UTDatePicker/index.js +59 -101
  86. package/dist/components/UTDatePicker/theme.js +173 -177
  87. package/dist/components/UTDatePicker/types.js +2 -3
  88. package/dist/components/UTDatePicker/utils.js +2 -6
  89. package/dist/components/UTDialog/components/ActionButton/index.js +10 -9
  90. package/dist/components/UTDialog/constants.js +2 -4
  91. package/dist/components/UTDialog/index.js +39 -38
  92. package/dist/components/UTDialog/theme.js +93 -95
  93. package/dist/components/UTDialog/types.js +2 -3
  94. package/dist/components/UTDotMenu/index.js +33 -57
  95. package/dist/components/UTEmojiPicker/constants.js +6 -11
  96. package/dist/components/UTEmojiPicker/index.js +45 -65
  97. package/dist/components/UTEmojiPicker/theme.js +1 -1
  98. package/dist/components/UTEmojiPicker/utils.js +21 -51
  99. package/dist/components/UTExternalLink/index.js +17 -14
  100. package/dist/components/UTFileInput/constants.js +2 -4
  101. package/dist/components/UTFileInput/index.js +7 -31
  102. package/dist/components/UTFileInput/layout.js +67 -96
  103. package/dist/components/UTIconButton/index.js +49 -72
  104. package/dist/components/UTIconButton/theme.js +53 -55
  105. package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +53 -58
  106. package/dist/components/UTImageRadio/constants.js +3 -6
  107. package/dist/components/UTImageRadio/index.js +39 -47
  108. package/dist/components/UTImageRadio/theme.js +8 -11
  109. package/dist/components/UTImageRadio/types.js +2 -3
  110. package/dist/components/UTImageRadio/utils.js +2 -6
  111. package/dist/components/UTLabel/index.js +69 -90
  112. package/dist/components/UTLabel/theme.js +84 -86
  113. package/dist/components/UTList/index.js +15 -18
  114. package/dist/components/UTLoading/index.js +15 -15
  115. package/dist/components/UTMap/components/GoogleMaps/constants.js +8 -11
  116. package/dist/components/UTMap/components/GoogleMaps/index.js +63 -91
  117. package/dist/components/UTMap/components/GoogleMaps/styles.js +2 -3
  118. package/dist/components/UTMap/constants.js +6 -12
  119. package/dist/components/UTMap/index.js +163 -198
  120. package/dist/components/UTMap/types.js +4 -6
  121. package/dist/components/UTMap/utils.js +29 -46
  122. package/dist/components/UTMap/withGoogleMapScript.js +12 -17
  123. package/dist/components/UTMenu/index.js +52 -69
  124. package/dist/components/UTMenu/theme.js +2 -2
  125. package/dist/components/UTMenu/utils.js +5 -11
  126. package/dist/components/UTPagination/theme.js +4 -2
  127. package/dist/components/UTPanel/index.js +38 -44
  128. package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +14 -11
  129. package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +24 -21
  130. package/dist/components/UTPasswordField/components/PasswordValidations/index.js +63 -50
  131. package/dist/components/UTPasswordField/components/PasswordWarning/index.js +26 -27
  132. package/dist/components/UTPasswordField/index.js +26 -23
  133. package/dist/components/UTPasswordField/theme.js +37 -39
  134. package/dist/components/UTPhoneInput/constants.js +3 -6
  135. package/dist/components/UTPhoneInput/index.js +180 -205
  136. package/dist/components/UTPhoneInput/theme.js +109 -113
  137. package/dist/components/UTPieChart/components/ArrowLabel/constants.js +4 -8
  138. package/dist/components/UTPieChart/components/ArrowLabel/index.js +24 -23
  139. package/dist/components/UTPieChart/components/Legend/contants.js +3 -6
  140. package/dist/components/UTPieChart/components/Legend/index.js +27 -24
  141. package/dist/components/UTPieChart/constants.js +13 -26
  142. package/dist/components/UTPieChart/hooks/use-animated-value/index.js +15 -33
  143. package/dist/components/UTPieChart/index.js +73 -76
  144. package/dist/components/UTPieChart/theme.js +23 -25
  145. package/dist/components/UTPieChart/utils.js +4 -2
  146. package/dist/components/UTProgressBar/constants.js +2 -4
  147. package/dist/components/UTProgressBar/index.js +12 -11
  148. package/dist/components/UTProgressBar/theme.js +25 -27
  149. package/dist/components/UTProgressBar/types.js +2 -3
  150. package/dist/components/UTRadioGroup/index.js +45 -71
  151. package/dist/components/UTRadioGroup/theme.js +82 -86
  152. package/dist/components/UTRating/components/Circle/index.js +41 -56
  153. package/dist/components/UTRating/components/Faces/constants.js +2 -4
  154. package/dist/components/UTRating/components/Faces/index.js +34 -36
  155. package/dist/components/UTRating/components/Star/index.js +36 -40
  156. package/dist/components/UTRating/constants.js +4 -8
  157. package/dist/components/UTRating/index.js +31 -46
  158. package/dist/components/UTRating/theme.js +77 -79
  159. package/dist/components/UTRipple/Ripple.js +22 -39
  160. package/dist/components/UTRipple/index.js +18 -37
  161. package/dist/components/UTSelect/components/Option/index.js +13 -13
  162. package/dist/components/UTSelect/constants.js +4 -8
  163. package/dist/components/UTSelect/index.js +61 -81
  164. package/dist/components/UTSelect/stylesJS.js +2 -3
  165. package/dist/components/UTSelect/theme.js +43 -45
  166. package/dist/components/UTSelect/utils.js +3 -13
  167. package/dist/components/UTSidebar/components/ListOption/index.js +32 -47
  168. package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
  169. package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
  170. package/dist/components/UTSidebar/components/Option/constants.js +2 -3
  171. package/dist/components/UTSidebar/components/Option/index.js +28 -32
  172. package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
  173. package/dist/components/UTSidebar/index.js +42 -53
  174. package/dist/components/UTSidebar/theme.js +1 -1
  175. package/dist/components/UTSidebar/types.js +5 -10
  176. package/dist/components/UTSkeleton/index.js +10 -36
  177. package/dist/components/UTSwitch/constants.js +3 -6
  178. package/dist/components/UTSwitch/index.js +42 -57
  179. package/dist/components/UTSwitch/theme.js +115 -117
  180. package/dist/components/UTTable/components/ActionIcons/constants.js +1 -2
  181. package/dist/components/UTTable/components/ActionIcons/index.js +44 -81
  182. package/dist/components/UTTable/components/Cell/index.js +18 -23
  183. package/dist/components/UTTable/components/HeaderCell/constants.js +2 -3
  184. package/dist/components/UTTable/components/HeaderCell/index.js +23 -30
  185. package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
  186. package/dist/components/UTTable/components/PrimaryAction/index.js +12 -11
  187. package/dist/components/UTTable/components/ResponsiveCell/index.js +19 -20
  188. package/dist/components/UTTable/components/Status/index.js +18 -19
  189. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +10 -9
  190. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +7 -13
  191. package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
  192. package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +21 -32
  193. package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +8 -14
  194. package/dist/components/UTTable/components/TableFooter/constants.js +1 -2
  195. package/dist/components/UTTable/components/TableFooter/index.js +15 -15
  196. package/dist/components/UTTable/components/TableHeader/index.js +11 -11
  197. package/dist/components/UTTable/components/TableRow/constants.js +3 -6
  198. package/dist/components/UTTable/components/TableRow/index.js +79 -94
  199. package/dist/components/UTTable/constants.js +26 -43
  200. package/dist/components/UTTable/hook.js +11 -26
  201. package/dist/components/UTTable/index.js +125 -213
  202. package/dist/components/UTTable/theme.js +13 -16
  203. package/dist/components/UTTable/types.js +4 -8
  204. package/dist/components/UTTable/utils.js +70 -74
  205. package/dist/components/UTTabs/components/TooltipTab/index.js +20 -30
  206. package/dist/components/UTTabs/constants.js +4 -8
  207. package/dist/components/UTTabs/index.js +55 -84
  208. package/dist/components/UTTabs/theme.js +112 -114
  209. package/dist/components/UTTabs/utils.js +1 -1
  210. package/dist/components/UTTextArea/constants.js +4 -6
  211. package/dist/components/UTTextArea/index.js +40 -24
  212. package/dist/components/UTTextArea/styles.module.scss +20 -1
  213. package/dist/components/UTTextArea/theme.js +1 -1
  214. package/dist/components/UTTextInput/constants.js +2 -3
  215. package/dist/components/UTTextInput/index.js +116 -146
  216. package/dist/components/UTTextInput/theme.js +28 -30
  217. package/dist/components/UTThirdPartyCookieChecker/index.js +17 -21
  218. package/dist/components/UTToggle/components/ToggleOption/index.js +16 -17
  219. package/dist/components/UTToggle/index.js +25 -26
  220. package/dist/components/UTToggle/theme.js +47 -49
  221. package/dist/components/UTTooltip/index.js +23 -30
  222. package/dist/components/UTTooltip/theme.js +1 -1
  223. package/dist/components/UTTopbar/theme.js +4 -2
  224. package/dist/components/UTTouchableWithoutFeedback/index.js +14 -27
  225. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +2 -4
  226. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +34 -31
  227. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
  228. package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +6 -12
  229. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +8 -18
  230. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +23 -47
  231. package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +31 -34
  232. package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +81 -93
  233. package/dist/components/UTVirtualizedList/constants.js +4 -8
  234. package/dist/components/UTVirtualizedList/index.js +26 -38
  235. package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +11 -11
  236. package/dist/components/UTWorkflowContainer/constants.js +5 -9
  237. package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
  238. package/dist/components/UTWorkflowContainer/index.js +31 -50
  239. package/dist/components/UTWorkflowContainer/theme.js +70 -64
  240. package/dist/components/UTWorkflowContainer/types.js +2 -3
  241. package/dist/components/WithLoading/index.js +10 -15
  242. package/dist/components/WithTheme/index.js +10 -17
  243. package/dist/components/WithTheme/layout.js +18 -41
  244. package/dist/components/WithTouch/index.js +12 -19
  245. package/dist/index.js +54 -54
  246. package/dist/scss/variables/colors.module.scss +1 -0
  247. package/dist/theme.js +5 -3
  248. package/dist/types/commonTypes.js +3 -5
  249. package/dist/types/consumptionTypes.js +3 -5
  250. package/dist/types/formTypes.js +4 -7
  251. package/dist/types/tableTypes.js +2 -3
  252. package/dist/utils/classesUtils.js +4 -10
  253. package/dist/utils/componentUtils.js +10 -13
  254. package/dist/utils/helperFunctions.js +4 -4
  255. package/dist/utils/useScreenSize.js +2 -3
  256. package/package.json +1 -1
@@ -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.barType = exports.barDataType = void 0;
7
7
  var _propTypes = require("prop-types");
8
- var 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,14 +21,11 @@ var barType = (0, _propTypes.shape)({
21
21
  value: _propTypes.number
22
22
  }))
23
23
  });
24
- exports.barType = barType;
25
- var barDataType = (0, _propTypes.arrayOf)((0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(barType), barType]));
26
- exports.barDataType = barDataType;
27
- var 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)({
28
26
  type: _propTypes.string
29
27
  });
30
- exports.linearMarkersType = linearMarkersType;
31
- var linearType = (0, _propTypes.shape)({
28
+ const linearType = exports.linearType = (0, _propTypes.shape)({
32
29
  color: _propTypes.string,
33
30
  data: (0, _propTypes.arrayOf)({
34
31
  xCoodrinate: _propTypes.number,
@@ -37,16 +34,13 @@ var linearType = (0, _propTypes.shape)({
37
34
  marker: linearMarkersType,
38
35
  type: _propTypes.string
39
36
  });
40
- exports.linearType = linearType;
41
- var linearDataType = (0, _propTypes.arrayOf)(linearType);
42
- exports.linearDataType = linearDataType;
43
- var 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)({
44
39
  value: _propTypes.number,
45
40
  color: _propTypes.string,
46
41
  id: _propTypes.string
47
42
  }));
48
- exports.levelsType = levelsType;
49
- var referencesType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
43
+ const referencesType = exports.referencesType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
50
44
  check: _propTypes.func,
51
45
  className: _propTypes.string,
52
46
  CustomIcon: _propTypes.elementType,
@@ -54,11 +48,9 @@ var referencesType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
54
48
  label: _propTypes.string,
55
49
  orderFunction: _propTypes.func
56
50
  }));
57
- exports.referencesType = referencesType;
58
- var xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
51
+ const xAxisDefinitionType = exports.xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
59
52
  labelBackgroundPadding: _propTypes.number,
60
53
  mainLabel: _propTypes.string,
61
54
  secondaryLabel: _propTypes.string,
62
55
  selectedLabelBackground: _propTypes.string
63
- }));
64
- exports.xAxisDefinitionType = xAxisDefinitionType;
56
+ }));
@@ -7,81 +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(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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 = 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
17
  exports.getPages = getPages;
28
- var getFormattedData = function getFormattedData() {
29
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
30
- var pagination = arguments.length > 1 ? arguments[1] : undefined;
31
- var index = arguments.length > 2 ? arguments[2] : undefined;
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;
32
22
  return data.slice(index * pagination, (index + 1) * pagination);
33
23
  };
34
24
  exports.getFormattedData = getFormattedData;
35
- var getFormattedLinearData = function getFormattedLinearData() {
36
- var linearData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
37
- var currentPage = arguments.length > 1 ? arguments[1] : undefined;
38
- var pagination = arguments.length > 2 ? arguments[2] : undefined;
39
- return linearData.filter(function (_ref) {
40
- var xCoordinate = _ref.xCoordinate;
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;
41
33
  return Math.floor(xCoordinate / pagination) === currentPage;
42
- }).map(function (item, i) {
43
- return _objectSpread(_objectSpread({}, item), {}, {
44
- xCoordinate: i
45
- });
46
- });
34
+ }).map((item, i) => ({
35
+ ...item,
36
+ xCoordinate: i
37
+ }));
47
38
  };
48
39
  exports.getFormattedLinearData = getFormattedLinearData;
49
- var getMaxValue = function getMaxValue(dataSet) {
50
- return dataSet && !(0, _array.isEmpty)(dataSet) && (d3.max(dataSet, function (_ref2) {
51
- var value = _ref2.value;
52
- return value;
53
- }) || 0);
54
- };
40
+ const getMaxValue = dataSet => dataSet && !(0, _array.isEmpty)(dataSet) && (d3.max(dataSet, _ref2 => {
41
+ let {
42
+ value
43
+ } = _ref2;
44
+ return value;
45
+ }) || 0);
55
46
  exports.getMaxValue = getMaxValue;
56
- var getMinValue = function getMinValue(dataSet) {
57
- return dataSet && !(0, _array.isEmpty)(dataSet) && d3.min(dataSet, function (_ref3) {
58
- var value = _ref3.value;
59
- return value;
60
- }) || 0;
61
- };
47
+ const getMinValue = dataSet => dataSet && !(0, _array.isEmpty)(dataSet) && d3.min(dataSet, _ref3 => {
48
+ let {
49
+ value
50
+ } = _ref3;
51
+ return value;
52
+ }) || 0;
62
53
  exports.getMinValue = getMinValue;
63
- var maxValueOrDefault = function maxValueOrDefault(value) {
64
- return value === 0 ? _constants.DEFAULT_MAX_VALUE : value;
65
- };
66
- var getMaxValues = function getMaxValues(flatBarData, flatLinearData, levels) {
67
- return {
68
- maxLinearValue: maxValueOrDefault(getMaxValue(flatLinearData)),
69
- maxBarValue: maxValueOrDefault(Math.max(getMaxValue(flatBarData), getMaxValue(levels)))
70
- };
71
- };
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
+ });
72
59
  exports.getMaxValues = getMaxValues;
73
- var calculateTotalWidth = function calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) {
74
- var minimumNeededWidth = dataLength * groups * (minBarWidth + 2 * padding) + marginLeft + marginRight;
60
+ const calculateTotalWidth = (minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) => {
61
+ const minimumNeededWidth = dataLength * groups * (minBarWidth + 2 * padding) + marginLeft + marginRight;
75
62
  return Math.max(containerWidth, minimumNeededWidth);
76
63
  };
77
- var getGraphAttributes = function getGraphAttributes(containerWidth, containerHeight, marginLeft, marginRight, marginBottom, minBarWidth, dataLength, padding, groups, spacingOptions) {
78
- var totalWidth = minBarWidth ? calculateTotalWidth(minBarWidth, dataLength, padding, containerWidth, marginLeft, marginRight, groups) : containerWidth;
79
- var _spacingOptions$axisP = spacingOptions.axisPadding,
80
- axisPadding = _spacingOptions$axisP === void 0 ? _constants.DEFAULT_AXIS_PADDING : _spacingOptions$axisP,
81
- _spacingOptions$scrol = spacingOptions.scrollPadding,
82
- scrollPadding = _spacingOptions$scrol === void 0 ? _constants.DEFAULT_SCROLL_PADDING : _spacingOptions$scrol,
83
- _spacingOptions$margi = spacingOptions.marginTop,
84
- 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;
85
71
  return {
86
72
  TOTAL_WIDTH: totalWidth,
87
73
  TOTAL_HEIGHT: containerHeight,
@@ -92,77 +78,87 @@ var getGraphAttributes = function getGraphAttributes(containerWidth, containerHe
92
78
  };
93
79
  };
94
80
  exports.getGraphAttributes = getGraphAttributes;
95
- var flattenBarData = function flattenBarData(data) {
81
+ const flattenBarData = data => {
96
82
  var _data$0$;
97
- return data && Array.isArray((_data$0$ = data[0][0]) === null || _data$0$ === void 0 ? void 0 : _data$0$.values) ? data.flat().map(function (_ref4) {
98
- 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;
99
87
  return values;
100
88
  }).flat() : data.flat();
101
89
  };
102
- var flattenAndReduceBarData = function flattenAndReduceBarData(data) {
90
+ const flattenAndReduceBarData = data => {
103
91
  var _data$0$2;
104
- 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) {
105
- 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;
106
96
  return {
107
- value: values.reduce(function (acc, _ref6) {
108
- var value = _ref6.value;
97
+ value: values.reduce((acc, _ref6) => {
98
+ let {
99
+ value
100
+ } = _ref6;
109
101
  return acc + value;
110
102
  }, 0)
111
103
  };
112
104
  }) : data.flat());
113
105
  };
114
106
  exports.flattenAndReduceBarData = flattenAndReduceBarData;
115
- var flattenLinearData = function flattenLinearData(linearData) {
116
- return linearData === null || linearData === void 0 ? void 0 : linearData.map(function (_ref7) {
117
- var data = _ref7.data;
118
- return data;
119
- }).flat();
120
- };
121
- var flattenData = function flattenData(barData, linearData) {
122
- return {
123
- flatBarData: flattenBarData(barData),
124
- flatLinearData: flattenLinearData(linearData)
125
- };
126
- };
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
+ });
127
117
  exports.flattenData = flattenData;
128
- var getFormattedDecorators = function getFormattedDecorators(xAxis) {
129
- var decorators = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
130
- var currentPage = arguments.length > 2 ? arguments[2] : undefined;
131
- var pagination = arguments.length > 3 ? arguments[3] : undefined;
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;
132
122
  if (pagination) {
133
- var rangeStart = currentPage * pagination;
134
- var rangeEnd = (currentPage + 1) * pagination;
135
- var validDecorators = pagination ? decorators.filter(function (_ref8) {
136
- 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;
137
129
  return rangeStart <= x && rangeEnd > x;
138
130
  }) : decorators;
139
- return validDecorators.map(function (_ref9) {
140
- var x = _ref9.x,
141
- config = _objectWithoutProperties(_ref9, _excluded);
142
- return _objectSpread({
131
+ return validDecorators.map(_ref9 => {
132
+ let {
133
+ x,
134
+ ...config
135
+ } = _ref9;
136
+ return {
143
137
  x: pagination ? xAxis(x - currentPage * pagination) : xAxis(x),
144
- id: x
145
- }, config);
138
+ id: x,
139
+ ...config
140
+ };
146
141
  });
147
142
  }
148
- return decorators.map(function (_ref10) {
149
- var x = _ref10.x,
150
- config = _objectWithoutProperties(_ref10, _excluded2);
151
- return _objectSpread({
152
- x: xAxis(x)
153
- }, config);
154
- });
155
- };
156
- exports.getFormattedDecorators = getFormattedDecorators;
157
- var getGrid = function getGrid(ticks, maxValue) {
158
- return new Array(ticks).fill(0).map(function (_, index) {
143
+ return decorators.map(_ref10 => {
144
+ let {
145
+ x,
146
+ ...config
147
+ } = _ref10;
159
148
  return {
160
- value: maxValue - index * maxValue / (ticks - 1),
161
- type: 'grid'
149
+ x: xAxis(x),
150
+ ...config
162
151
  };
163
- }).filter(function (_ref11) {
164
- var value = _ref11.value;
165
- return !!value;
166
152
  });
167
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
+ });
168
164
  exports.getGrid = getGrid;
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_SEPARATOR = exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = exports.DEFAULT_ELIPSIS = void 0;
7
- var DEFAULT_SEPARATOR = '/';
8
- exports.DEFAULT_SEPARATOR = DEFAULT_SEPARATOR;
9
- var DEFAULT_ELIPSIS = '...';
10
- exports.DEFAULT_ELIPSIS = DEFAULT_ELIPSIS;
11
- var DEFAULT_ELIPSIS_WIDTH_ESTIMATE = 100;
12
- exports.DEFAULT_ELIPSIS_WIDTH_ESTIMATE = DEFAULT_ELIPSIS_WIDTH_ESTIMATE;
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;
@@ -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
  });
@@ -17,114 +16,87 @@ var _constants = require("./constants");
17
16
  var _theme = require("./theme");
18
17
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+ 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); }
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; }
22
21
  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); }
23
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
24
- 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."); }
25
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
26
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
28
- 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."); }
29
- 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); }
30
- 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; }
31
- 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; } }
32
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
- var UTBreadcrumbs = function UTBreadcrumbs(_ref) {
34
- var breadcrumbs = _ref.breadcrumbs,
35
- themeClasses = _ref.classes,
36
- classNames = _ref.classNames,
37
- _ref$disableMenu = _ref.disableMenu,
38
- disableMenu = _ref$disableMenu === void 0 ? false : _ref$disableMenu,
39
- _ref$elipsis = _ref.elipsis,
40
- elipsis = _ref$elipsis === void 0 ? _constants.DEFAULT_ELIPSIS : _ref$elipsis,
41
- _ref$elipsisWidthEsti = _ref.elipsisWidthEstimate,
42
- elipsisWidthEstimate = _ref$elipsisWidthEsti === void 0 ? _constants.DEFAULT_ELIPSIS_WIDTH_ESTIMATE : _ref$elipsisWidthEsti,
43
- _ref$menuProps = _ref.menuProps,
44
- menuProps = _ref$menuProps === void 0 ? {} : _ref$menuProps,
45
- onRedirect = _ref.onRedirect,
46
- onSetAction = _ref.onSetAction,
47
- _ref$separator = _ref.separator,
48
- separator = _ref$separator === void 0 ? _constants.DEFAULT_SEPARATOR : _ref$separator;
49
- var dispatch = (0, _reactRedux.useDispatch)();
50
- var classes = (0, _react.useMemo)(function () {
51
- return (0, _classesUtils.mergeClasses)(themeClasses, classNames);
52
- }, [classNames]);
53
- var containerRef = (0, _react.useRef)();
54
- var _useState = (0, _react.useState)(breadcrumbs),
55
- _useState2 = _slicedToArray(_useState, 2),
56
- content = _useState2[0],
57
- setContent = _useState2[1];
58
- var _useState3 = (0, _react.useState)({
59
- anchor: null,
60
- items: []
61
- }),
62
- _useState4 = _slicedToArray(_useState3, 2),
63
- menu = _useState4[0],
64
- setMenu = _useState4[1];
65
- var getSectionsTotalWidth = function getSectionsTotalWidth(ref) {
66
- return _toConsumableArray(ref.current.children).reduce(function (total, currentChildren) {
67
- return total + currentChildren.offsetWidth;
68
- }, 0);
69
- };
70
- var getItemsBeforeCollapse = function getItemsBeforeCollapse(ref) {
71
- var sections = _toConsumableArray(ref.current.children);
72
- var containerWidth = ref.current.offsetWidth;
73
- var itemsBeforeCollapse = 1;
74
- var accumulatedWidth = 0;
75
- var firstItemWidth = sections[0].offsetWidth;
76
- var lastItemWidth = sections[sections.length - 2].offsetWidth;
77
- var availableWidth = containerWidth - firstItemWidth - lastItemWidth - elipsisWidthEstimate;
78
- sections.slice(1).forEach(function (section) {
22
+ const UTBreadcrumbs = _ref => {
23
+ let {
24
+ breadcrumbs,
25
+ classes: themeClasses,
26
+ classNames,
27
+ disableMenu = false,
28
+ elipsis = _constants.DEFAULT_ELIPSIS,
29
+ elipsisWidthEstimate = _constants.DEFAULT_ELIPSIS_WIDTH_ESTIMATE,
30
+ menuProps = {},
31
+ onRedirect,
32
+ onSetAction,
33
+ separator = _constants.DEFAULT_SEPARATOR
34
+ } = _ref;
35
+ const dispatch = (0, _reactRedux.useDispatch)();
36
+ const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(themeClasses, classNames), [classNames]);
37
+ const containerRef = (0, _react.useRef)();
38
+ const [content, setContent] = (0, _react.useState)(breadcrumbs);
39
+ const [menu, setMenu] = (0, _react.useState)({
40
+ anchor: null,
41
+ items: []
42
+ });
43
+ const getSectionsTotalWidth = ref => [...ref.current.children].reduce((total, currentChildren) => total + currentChildren.offsetWidth, 0);
44
+ const getItemsBeforeCollapse = ref => {
45
+ const sections = [...ref.current.children];
46
+ const {
47
+ offsetWidth: containerWidth
48
+ } = ref.current;
49
+ let itemsBeforeCollapse = 1;
50
+ let accumulatedWidth = 0;
51
+ const firstItemWidth = sections[0].offsetWidth;
52
+ const lastItemWidth = sections[sections.length - 2].offsetWidth;
53
+ const availableWidth = containerWidth - firstItemWidth - lastItemWidth - elipsisWidthEstimate;
54
+ sections.slice(1).forEach(section => {
79
55
  accumulatedWidth += section.offsetWidth;
80
56
  if (accumulatedWidth <= availableWidth) itemsBeforeCollapse += 1;
81
57
  });
82
58
  return itemsBeforeCollapse;
83
59
  };
84
- var truncate = function truncate() {
60
+ const truncate = () => {
85
61
  if (!containerRef.current) return;
86
- var containerWidth = containerRef.current.offsetWidth;
87
- var childrenTotalWidth = getSectionsTotalWidth(containerRef);
62
+ const {
63
+ offsetWidth: containerWidth
64
+ } = containerRef.current;
65
+ const childrenTotalWidth = getSectionsTotalWidth(containerRef);
88
66
  if (childrenTotalWidth > containerWidth) {
89
- setContent(function (prevContent) {
90
- var isCollapsed = prevContent.some(function (_ref2) {
91
- var label = _ref2.label;
67
+ setContent(prevContent => {
68
+ const isCollapsed = prevContent.some(_ref2 => {
69
+ let {
70
+ label
71
+ } = _ref2;
92
72
  return label === elipsis;
93
73
  });
94
74
  if (isCollapsed) return prevContent;
95
75
  if (prevContent.length <= 2) return prevContent;
96
- var itemsBeforeCollapse = getItemsBeforeCollapse(containerRef);
97
- return [].concat(_toConsumableArray(prevContent.slice(0, itemsBeforeCollapse)), [{
76
+ const itemsBeforeCollapse = getItemsBeforeCollapse(containerRef);
77
+ return [...prevContent.slice(0, itemsBeforeCollapse), {
98
78
  label: elipsis,
99
79
  menuItems: prevContent.slice(itemsBeforeCollapse, prevContent.length - 1)
100
- }, prevContent[prevContent.length - 1]]);
80
+ }, prevContent[prevContent.length - 1]];
101
81
  });
102
82
  }
103
83
  };
104
- (0, _react.useEffect)(function () {
84
+ (0, _react.useEffect)(() => {
105
85
  setContent(breadcrumbs);
106
86
  }, [breadcrumbs]);
107
- (0, _react.useEffect)(function () {
108
- if (containerRef.current) window.requestAnimationFrame(function () {
109
- return truncate();
110
- });
87
+ (0, _react.useEffect)(() => {
88
+ if (containerRef.current) window.requestAnimationFrame(() => truncate());
111
89
  }, [content]);
112
- (0, _react.useEffect)(function () {
90
+ (0, _react.useEffect)(() => {
113
91
  window.addEventListener('resize', truncate);
114
- return function () {
115
- return window.removeEventListener('resize', truncate);
116
- };
92
+ return () => window.removeEventListener('resize', truncate);
117
93
  }, []);
118
- var handleCloseMenu = function handleCloseMenu() {
119
- return setMenu({
120
- anchor: null,
121
- items: []
122
- });
123
- };
124
- var handleClickOptions = function handleClickOptions(options, route, id) {
125
- var indexOfCurrentBreadcrumb = breadcrumbs.findIndex(function (breadcrumb) {
126
- return breadcrumb.id === id;
127
- });
94
+ const handleCloseMenu = () => setMenu({
95
+ anchor: null,
96
+ items: []
97
+ });
98
+ const handleClickOptions = (options, route, id) => {
99
+ const indexOfCurrentBreadcrumb = breadcrumbs.findIndex(breadcrumb => breadcrumb.id === id);
128
100
  if (indexOfCurrentBreadcrumb !== breadcrumbs.length - 1) {
129
101
  if (options.setAction) {
130
102
  onSetAction(options.setAction, options.params);
@@ -138,26 +110,28 @@ var UTBreadcrumbs = function UTBreadcrumbs(_ref) {
138
110
  return /*#__PURE__*/_react.default.createElement("div", {
139
111
  className: _stylesModule.default.breadcrumbs,
140
112
  ref: containerRef
141
- }, content.map(function (_ref3, index) {
142
- var route = _ref3.route,
143
- label = _ref3.label,
144
- menuItems = _ref3.menuItems,
145
- itemClassName = _ref3.itemClassName,
146
- _ref3$options = _ref3.options,
147
- options = _ref3$options === void 0 ? {} : _ref3$options,
148
- _ref3$id = _ref3.id,
149
- id = _ref3$id === void 0 ? Math.random() : _ref3$id;
150
- var handleClick = function handleClick(event) {
113
+ }, content.map((_ref3, index) => {
114
+ let {
115
+ route,
116
+ label,
117
+ menuItems,
118
+ itemClassName,
119
+ options = {},
120
+ id = Math.random()
121
+ } = _ref3;
122
+ const handleClick = event => {
151
123
  if (menuItems) setMenu({
152
124
  anchor: event.currentTarget,
153
- items: _toConsumableArray(menuItems).map(function (_ref4) {
154
- var menuItemLabel = _ref4.label,
155
- menuItemRoute = _ref4.route,
156
- menuItemOptions = _ref4.options,
157
- menuItemId = _ref4.id;
125
+ items: [...menuItems].map(_ref4 => {
126
+ let {
127
+ label: menuItemLabel,
128
+ route: menuItemRoute,
129
+ options: menuItemOptions,
130
+ id: menuItemId
131
+ } = _ref4;
158
132
  return {
159
133
  label: menuItemLabel,
160
- onClick: function onClick() {
134
+ onClick: () => {
161
135
  setContent(breadcrumbs);
162
136
  handleCloseMenu();
163
137
  handleClickOptions(menuItemOptions, menuItemRoute, menuItemId);
@@ -166,7 +140,7 @@ var UTBreadcrumbs = function UTBreadcrumbs(_ref) {
166
140
  })
167
141
  });else handleClickOptions(options, route, id);
168
142
  };
169
- var isLast = index === content.length - 1;
143
+ const isLast = index === content.length - 1;
170
144
  return /*#__PURE__*/_react.default.createElement("div", {
171
145
  className: _stylesModule.default.section,
172
146
  key: "".concat(route, "-").concat(label)
@@ -198,5 +172,4 @@ UTBreadcrumbs.propTypes = {
198
172
  menuProps: _propTypes.object,
199
173
  separator: _propTypes.string
200
174
  };
201
- var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBreadcrumbs);
202
- exports.default = _default;
175
+ var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBreadcrumbs);