@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
@@ -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
  });
@@ -9,19 +8,19 @@ var _react = _interopRequireWildcard(require("react"));
9
8
  var _propTypes = require("prop-types");
10
9
  var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../../../UTTouchableWithoutFeedback"));
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
- var LegendContainer = function LegendContainer(_ref) {
15
- var index = _ref.index,
16
- currentSlide = _ref.currentSlide,
17
- onClick = _ref.onClick,
18
- LegendCustom = _ref.LegendCustom,
19
- classes = _ref.classes,
20
- keyName = _ref.keyName;
21
- var handleOnClick = function handleOnClick() {
22
- return onClick(index + 1);
23
- };
24
- var isActive = currentSlide === index;
11
+ 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); }
12
+ 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; }
13
+ const LegendContainer = _ref => {
14
+ let {
15
+ index,
16
+ currentSlide,
17
+ onClick,
18
+ LegendCustom,
19
+ classes,
20
+ keyName
21
+ } = _ref;
22
+ const handleOnClick = () => onClick(index + 1);
23
+ const isActive = currentSlide === index;
25
24
  return LegendCustom ? /*#__PURE__*/_react.default.createElement(LegendCustom, {
26
25
  onClick: handleOnClick
27
26
  }) : /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
@@ -40,5 +39,4 @@ LegendContainer.propTypes = {
40
39
  keyName: _propTypes.string,
41
40
  classes: (0, _propTypes.objectOf)(_propTypes.string)
42
41
  };
43
- var _default = /*#__PURE__*/(0, _react.memo)(LegendContainer);
44
- exports.default = _default;
42
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(LegendContainer);
@@ -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
  });
@@ -10,19 +9,21 @@ var _propTypes = require("prop-types");
10
9
  var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../../../../../UTTouchableWithoutFeedback"));
11
10
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
12
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- 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); }
14
- 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; }
15
- var Slide = function Slide(_ref) {
16
- var keyName = _ref.keyName,
17
- imgSrc = _ref.imgSrc,
18
- position = _ref.position,
19
- widthContainer = _ref.widthContainer,
20
- currentSlide = _ref.currentSlide,
21
- border = _ref.border,
22
- shouldAnimate = _ref.shouldAnimate,
23
- animationTime = _ref.animationTime,
24
- onClick = _ref.onClick;
25
- var slide = currentSlide === position ? border / 2 : currentSlide === position - 1 ? -border / 4 : currentSlide === position + 1 && border + border / 4;
12
+ 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); }
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
+ const Slide = _ref => {
15
+ let {
16
+ keyName,
17
+ imgSrc,
18
+ position,
19
+ widthContainer,
20
+ currentSlide,
21
+ border,
22
+ shouldAnimate,
23
+ animationTime,
24
+ onClick
25
+ } = _ref;
26
+ const slide = currentSlide === position ? border / 2 : currentSlide === position - 1 ? -border / 4 : currentSlide === position + 1 && border + border / 4;
26
27
  return /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
27
28
  keyName: keyName,
28
29
  className: "".concat(_stylesModule.default.imageContainer),
@@ -52,5 +53,4 @@ Slide.propTypes = {
52
53
  onClick: _propTypes.func,
53
54
  keyName: _propTypes.string
54
55
  };
55
- var _default = /*#__PURE__*/(0, _react.memo)(Slide);
56
- exports.default = _default;
56
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(Slide);
@@ -4,13 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SLOW_ANIMATION = exports.OUTSIDE = exports.MIN_TIME_MOVE = exports.INSIDE = exports.FAST_ANIMATION = void 0;
7
- var FAST_ANIMATION = 35;
8
- exports.FAST_ANIMATION = FAST_ANIMATION;
9
- var SLOW_ANIMATION = 400;
10
- exports.SLOW_ANIMATION = SLOW_ANIMATION;
11
- var MIN_TIME_MOVE = 150;
12
- exports.MIN_TIME_MOVE = MIN_TIME_MOVE;
13
- var OUTSIDE = 'outside';
14
- exports.OUTSIDE = OUTSIDE;
15
- var INSIDE = 'inside';
16
- exports.INSIDE = INSIDE;
7
+ const FAST_ANIMATION = exports.FAST_ANIMATION = 35;
8
+ const SLOW_ANIMATION = exports.SLOW_ANIMATION = 400;
9
+ const MIN_TIME_MOVE = exports.MIN_TIME_MOVE = 150;
10
+ const OUTSIDE = exports.OUTSIDE = 'outside';
11
+ const INSIDE = exports.INSIDE = 'inside';
@@ -13,36 +13,15 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
13
13
  var _layout = _interopRequireDefault(require("./layout"));
14
14
  var _constants = require("./constants");
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- 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); }
17
- 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; }
18
- 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); }
19
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
20
- 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."); }
21
- 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); }
22
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24
- 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; }
25
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
27
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
28
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
32
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
+ 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); }
17
+ 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; }
35
18
  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; }
36
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
37
- 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); }
38
- var SliderContainer = /*#__PURE__*/function (_PureComponent) {
39
- _inherits(SliderContainer, _PureComponent);
40
- var _super = _createSuper(SliderContainer);
41
- function SliderContainer(props) {
42
- var _this;
43
- _classCallCheck(this, SliderContainer);
44
- _this = _super.call(this, props);
45
- _defineProperty(_assertThisInitialized(_this), "state", {
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
+ 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); }
21
+ class SliderContainer extends _react.PureComponent {
22
+ constructor(props) {
23
+ super(props);
24
+ _defineProperty(this, "state", {
46
25
  index: 1,
47
26
  slideArray: [],
48
27
  shouldAnimate: true,
@@ -51,268 +30,219 @@ var SliderContainer = /*#__PURE__*/function (_PureComponent) {
51
30
  finishPosition: 0,
52
31
  timeAnimation: _constants.FAST_ANIMATION
53
32
  });
54
- _defineProperty(_assertThisInitialized(_this), "handleMouseDown", (0, _helperFunctions.throttle)(function (event) {
55
- _this.containerRef.current.addEventListener('mousemove', _this.handleMouseMove);
56
- window.addEventListener('mouseup', _this.handleEventUp);
57
- return _this.setState({
33
+ _defineProperty(this, "handleMouseDown", (0, _helperFunctions.throttle)(event => {
34
+ this.containerRef.current.addEventListener('mousemove', this.handleMouseMove);
35
+ window.addEventListener('mouseup', this.handleEventUp);
36
+ return this.setState({
58
37
  initialPosition: event.clientX,
59
38
  shouldAnimate: false,
60
39
  timeMove: new Date().getTime()
61
40
  });
62
- }, _this.state.timeAnimation));
63
- _defineProperty(_assertThisInitialized(_this), "handleTouchDown", (0, _helperFunctions.throttle)(function (event) {
64
- _this.containerRef.current.addEventListener('touchmove', _this.handleTouchMove);
65
- window.addEventListener('touchend', _this.handleEventUp);
66
- return _this.setState({
41
+ }, this.state.timeAnimation));
42
+ _defineProperty(this, "handleTouchDown", (0, _helperFunctions.throttle)(event => {
43
+ this.containerRef.current.addEventListener('touchmove', this.handleTouchMove);
44
+ window.addEventListener('touchend', this.handleEventUp);
45
+ return this.setState({
67
46
  initialPosition: event.changedTouches[event.changedTouches.length - 1].clientX,
68
47
  shouldAnimate: false,
69
48
  timeMove: new Date().getTime()
70
49
  });
71
- }, _this.state.timeAnimation));
72
- _defineProperty(_assertThisInitialized(_this), "updateImgArray", function () {
73
- var arr = [_this.props.slides[_this.props.slides.length - 1]].concat(_toConsumableArray(_this.props.slides), [_this.props.slides[0]]);
74
- _this.setState({
50
+ }, this.state.timeAnimation));
51
+ _defineProperty(this, "updateImgArray", () => {
52
+ const arr = [this.props.slides[this.props.slides.length - 1], ...this.props.slides, this.props.slides[0]];
53
+ this.setState({
75
54
  slideArray: arr
76
55
  });
77
56
  });
78
- _defineProperty(_assertThisInitialized(_this), "updateContainerWidth", function () {
79
- return _this.setState({
80
- containerWidth: _this.containerRef.current && _this.containerRef.current.clientWidth
81
- });
82
- });
83
- _defineProperty(_assertThisInitialized(_this), "handleNextSlide", function () {
84
- if (_this.imagesLength === _this.state.index) {
85
- _this.setState(function (prevState) {
86
- return {
87
- index: prevState.index + 1,
88
- shouldAnimate: true,
89
- timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
90
- disable: true
91
- };
92
- }, function () {
93
- return setTimeout(function () {
94
- return _this.setState(function (prevState) {
95
- return {
96
- index: 1,
97
- shouldAnimate: false,
98
- timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
99
- disable: false
100
- };
101
- });
102
- }, _this.state.timeAnimation);
103
- });
104
- } else _this.setState(function (prevState) {
105
- return {
57
+ _defineProperty(this, "updateContainerWidth", () => this.setState({
58
+ containerWidth: this.containerRef.current && this.containerRef.current.clientWidth
59
+ }));
60
+ _defineProperty(this, "handleNextSlide", () => {
61
+ if (this.imagesLength === this.state.index) {
62
+ this.setState(prevState => ({
106
63
  index: prevState.index + 1,
107
64
  shouldAnimate: true,
108
65
  timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
109
66
  disable: true
110
- };
111
- }, function () {
112
- return setTimeout(function () {
113
- return _this.setState({
114
- disable: false
115
- });
116
- }, _this.state.timeAnimation);
117
- });
67
+ }), () => setTimeout(() => this.setState(prevState => ({
68
+ index: 1,
69
+ shouldAnimate: false,
70
+ timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
71
+ disable: false
72
+ })), this.state.timeAnimation));
73
+ } else this.setState(prevState => ({
74
+ index: prevState.index + 1,
75
+ shouldAnimate: true,
76
+ timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
77
+ disable: true
78
+ }), () => setTimeout(() => this.setState({
79
+ disable: false
80
+ }), this.state.timeAnimation));
118
81
  });
119
- _defineProperty(_assertThisInitialized(_this), "handlePrevSlide", function () {
120
- if (_this.state.index === 1) {
121
- _this.setState(function (prevState) {
122
- return {
123
- index: 0,
124
- shouldAnimate: true,
125
- timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
126
- disable: true
127
- };
128
- }, function () {
129
- return setTimeout(function () {
130
- return _this.setState(function (prevState) {
131
- return {
132
- index: prevState.slideArray.length - 2,
133
- shouldAnimate: false,
134
- timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
135
- disable: false
136
- };
137
- });
138
- }, _this.state.timeAnimation);
139
- });
140
- } else _this.setState(function (prevState) {
141
- return {
142
- index: prevState.index - 1,
82
+ _defineProperty(this, "handlePrevSlide", () => {
83
+ if (this.state.index === 1) {
84
+ this.setState(prevState => ({
85
+ index: 0,
143
86
  shouldAnimate: true,
144
87
  timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
145
88
  disable: true
146
- };
147
- }, function () {
148
- return setTimeout(function () {
149
- return _this.setState({
150
- disable: false
151
- });
152
- }, _this.state.timeAnimation);
153
- });
154
- });
155
- _defineProperty(_assertThisInitialized(_this), "handleMouseMove", function (event) {
156
- return _this.setState(function (prevState) {
157
- return {
158
- finishPosition: prevState.initialPosition - event.clientX
159
- };
160
- });
161
- });
162
- _defineProperty(_assertThisInitialized(_this), "handleTouchMove", function (event) {
163
- return _this.setState(function (prevState) {
164
- return {
165
- finishPosition: prevState.initialPosition - event.changedTouches[event.changedTouches.length - 1].clientX
166
- };
167
- });
89
+ }), () => setTimeout(() => this.setState(prevState => ({
90
+ index: prevState.slideArray.length - 2,
91
+ shouldAnimate: false,
92
+ timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
93
+ disable: false
94
+ })), this.state.timeAnimation));
95
+ } else this.setState(prevState => ({
96
+ index: prevState.index - 1,
97
+ shouldAnimate: true,
98
+ timeAnimation: prevState.finishPosition === 0 ? _constants.SLOW_ANIMATION : prevState.timeAnimation,
99
+ disable: true
100
+ }), () => setTimeout(() => this.setState({
101
+ disable: false
102
+ }), this.state.timeAnimation));
168
103
  });
169
- _defineProperty(_assertThisInitialized(_this), "handleEventUp", function () {
170
- _this.containerRef.current.removeEventListener('mousemove', _this.handleMouseMove);
171
- _this.containerRef.current.removeEventListener('touchmove', _this.handleTouchMove);
172
- var containerWidth = _this.state.containerWidth;
173
- var time = new Date().getTime();
174
- var transitionTime = time - _this.state.timeMove;
175
- var fastAnimationRight = _this.state.finishPosition > 60;
176
- var fastAnimationLeft = _this.state.finishPosition < -60;
177
- var fastAnimation = transitionTime > 0 && transitionTime < _constants.MIN_TIME_MOVE && (fastAnimationRight || fastAnimationLeft);
104
+ _defineProperty(this, "handleMouseMove", event => this.setState(prevState => ({
105
+ finishPosition: prevState.initialPosition - event.clientX
106
+ })));
107
+ _defineProperty(this, "handleTouchMove", event => this.setState(prevState => ({
108
+ finishPosition: prevState.initialPosition - event.changedTouches[event.changedTouches.length - 1].clientX
109
+ })));
110
+ _defineProperty(this, "handleEventUp", () => {
111
+ this.containerRef.current.removeEventListener('mousemove', this.handleMouseMove);
112
+ this.containerRef.current.removeEventListener('touchmove', this.handleTouchMove);
113
+ const {
114
+ containerWidth
115
+ } = this.state;
116
+ const time = new Date().getTime();
117
+ const transitionTime = time - this.state.timeMove;
118
+ const fastAnimationRight = this.state.finishPosition > 60;
119
+ const fastAnimationLeft = this.state.finishPosition < -60;
120
+ const fastAnimation = transitionTime > 0 && transitionTime < _constants.MIN_TIME_MOVE && (fastAnimationRight || fastAnimationLeft);
178
121
  if (fastAnimation) {
179
- _this.setState({
122
+ this.setState({
180
123
  timeAnimation: _constants.FAST_ANIMATION
181
124
  });
182
125
  if (fastAnimationLeft) {
183
- _this.handlePrevSlide();
184
- } else if (fastAnimationRight) _this.handleNextSlide();
126
+ this.handlePrevSlide();
127
+ } else if (fastAnimationRight) this.handleNextSlide();
185
128
  }
186
- if (transitionTime !== 0 && -containerWidth / 3 >= _this.state.finishPosition && !fastAnimation) {
187
- _this.setState({
129
+ if (transitionTime !== 0 && -containerWidth / 3 >= this.state.finishPosition && !fastAnimation) {
130
+ this.setState({
188
131
  timeAnimation: _constants.SLOW_ANIMATION
189
132
  });
190
- _this.handlePrevSlide();
191
- } else if (transitionTime !== 0 && containerWidth / 3 <= _this.state.finishPosition && !fastAnimation) {
192
- _this.setState({
133
+ this.handlePrevSlide();
134
+ } else if (transitionTime !== 0 && containerWidth / 3 <= this.state.finishPosition && !fastAnimation) {
135
+ this.setState({
193
136
  timeAnimation: _constants.SLOW_ANIMATION
194
137
  });
195
- _this.handleNextSlide();
138
+ this.handleNextSlide();
196
139
  }
197
- return _this.setState({
140
+ return this.setState({
198
141
  initialPosition: 0,
199
142
  finishPosition: 0,
200
143
  shouldAnimate: true
201
144
  });
202
145
  });
203
- _defineProperty(_assertThisInitialized(_this), "handleLegend", function (item) {
204
- _this.setState({
146
+ _defineProperty(this, "handleLegend", item => {
147
+ this.setState({
205
148
  timeAnimation: 400,
206
149
  index: item
207
150
  });
208
151
  });
209
- _this.containerRef = /*#__PURE__*/_react.default.createRef();
210
- _this.imagesLength = props.slides.length;
211
- return _this;
152
+ this.containerRef = /*#__PURE__*/_react.default.createRef();
153
+ this.imagesLength = props.slides.length;
212
154
  }
213
- _createClass(SliderContainer, [{
214
- key: "componentDidMount",
215
- value: function componentDidMount() {
216
- var _this2 = this;
217
- var arr = [this.props.slides[this.props.slides.length - 1]].concat(_toConsumableArray(this.props.slides), [this.props.slides[0]]);
218
- this.setState({
219
- slideArray: arr
220
- });
221
- this.containerRef.current.addEventListener('touchstart', this.handleTouchDown);
222
- this.containerRef.current.addEventListener('mousedown', this.handleMouseDown);
223
- this.updateContainerWidth();
224
- window.addEventListener('resize', this.updateContainerWidth);
225
- if (this.props.autoPlay) setInterval(function () {
226
- return _this2.handleNextSlide();
227
- }, this.props.autoPlayDelay);
228
- }
229
- }, {
230
- key: "componentDidUpdate",
231
- value: function componentDidUpdate(prevProps) {
232
- if (this.props.slides !== prevProps.slides) {
233
- this.updateImgArray();
234
- }
235
- }
236
- }, {
237
- key: "render",
238
- value: function render() {
239
- var _this3 = this;
240
- var _this$state = this.state,
241
- shouldAnimate = _this$state.shouldAnimate,
242
- slideArray = _this$state.slideArray,
243
- index = _this$state.index,
244
- timeAnimation = _this$state.timeAnimation,
245
- containerWidth = _this$state.containerWidth;
246
- var _this$props = this.props,
247
- withBorder = _this$props.withBorder,
248
- arrow = _this$props.arrow,
249
- legend = _this$props.legend,
250
- classes = _this$props.classes,
251
- slides = _this$props.slides,
252
- height = _this$props.height,
253
- activeEvents = _this$props.activeEvents,
254
- className = _this$props.className;
255
- var baseSlidePosition = (index - 1) * -containerWidth;
256
- var transitionSlide = !this.props.enableMove ? baseSlidePosition - this.state.finishPosition : baseSlidePosition;
257
- return /*#__PURE__*/_react.default.createElement("div", {
258
- className: "".concat(_stylesModule.default.generalContainer, " ").concat(className),
259
- style: {
260
- pointerEvents: "".concat(this.state.disable || !activeEvents ? 'none' : 'all'),
261
- height: height
262
- },
263
- draggable: "false"
264
- }, arrow && arrow.position === _constants.OUTSIDE && /*#__PURE__*/_react.default.createElement("div", {
265
- className: _stylesModule.default.arrowContainer
266
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
267
- ArrowCustom: arrow.arrowCustomLeft,
268
- callback: arrow.callbackLeft,
269
- onPress: this.handlePrevSlide,
270
- classes: classes,
271
- left: true
272
- })), /*#__PURE__*/_react.default.createElement("div", {
273
- ref: this.containerRef,
274
- className: _stylesModule.default.sliderContainer,
275
- draggable: "false"
276
- }, /*#__PURE__*/_react.default.createElement(_layout.default, {
277
- transitionSlide: transitionSlide,
278
- containerWidth: containerWidth,
279
- slideArray: slideArray,
280
- shouldAnimate: shouldAnimate,
281
- slides: slides,
282
- withBorder: withBorder,
283
- index: index,
284
- handleLegend: this.handleLegend,
285
- handlePrevSlide: this.handlePrevSlide,
286
- handleNextSlide: this.handleNextSlide,
287
- timeAnimation: timeAnimation,
288
- arrow: arrow,
289
- legend: legend,
290
- classes: classes
291
- })), legend && legend.position === _constants.OUTSIDE && /*#__PURE__*/_react.default.createElement("div", {
292
- className: _stylesModule.default.legendContainerOut
293
- }, /*#__PURE__*/_react.default.createElement("div", {
294
- className: _stylesModule.default.legend
295
- }, slides.map(function (_, item) {
296
- return /*#__PURE__*/_react.default.createElement(_Legend.default, {
297
- LegendCustom: legend.legendCustom,
298
- index: item,
299
- currentSlide: index === slideArray.length - 1 ? 0 : index === 0 ? 1 : index - 1,
300
- onClick: _this3.handleLegend,
301
- classes: classes,
302
- keyName: "legend-key-".concat(item)
303
- });
304
- }))), arrow && arrow.position === _constants.OUTSIDE && /*#__PURE__*/_react.default.createElement("div", {
305
- className: _stylesModule.default.arrowContainer
306
- }, /*#__PURE__*/_react.default.createElement(_Button.default, {
307
- ArrowCustom: arrow.arrowCustomRight,
308
- callback: arrow.callbackRight,
309
- onPress: this.handleNextSlide,
310
- classes: classes
311
- })));
155
+ componentDidMount() {
156
+ const arr = [this.props.slides[this.props.slides.length - 1], ...this.props.slides, this.props.slides[0]];
157
+ this.setState({
158
+ slideArray: arr
159
+ });
160
+ this.containerRef.current.addEventListener('touchstart', this.handleTouchDown);
161
+ this.containerRef.current.addEventListener('mousedown', this.handleMouseDown);
162
+ this.updateContainerWidth();
163
+ window.addEventListener('resize', this.updateContainerWidth);
164
+ if (this.props.autoPlay) setInterval(() => this.handleNextSlide(), this.props.autoPlayDelay);
165
+ }
166
+ componentDidUpdate(prevProps) {
167
+ if (this.props.slides !== prevProps.slides) {
168
+ this.updateImgArray();
312
169
  }
313
- }]);
314
- return SliderContainer;
315
- }(_react.PureComponent);
170
+ }
171
+ render() {
172
+ const {
173
+ shouldAnimate,
174
+ slideArray,
175
+ index,
176
+ timeAnimation,
177
+ containerWidth
178
+ } = this.state;
179
+ const {
180
+ withBorder,
181
+ arrow,
182
+ legend,
183
+ classes,
184
+ slides,
185
+ height,
186
+ activeEvents,
187
+ className
188
+ } = this.props;
189
+ const baseSlidePosition = (index - 1) * -containerWidth;
190
+ const transitionSlide = !this.props.enableMove ? baseSlidePosition - this.state.finishPosition : baseSlidePosition;
191
+ return /*#__PURE__*/_react.default.createElement("div", {
192
+ className: "".concat(_stylesModule.default.generalContainer, " ").concat(className),
193
+ style: {
194
+ pointerEvents: "".concat(this.state.disable || !activeEvents ? 'none' : 'all'),
195
+ height
196
+ },
197
+ draggable: "false"
198
+ }, arrow && arrow.position === _constants.OUTSIDE && /*#__PURE__*/_react.default.createElement("div", {
199
+ className: _stylesModule.default.arrowContainer
200
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
201
+ ArrowCustom: arrow.arrowCustomLeft,
202
+ callback: arrow.callbackLeft,
203
+ onPress: this.handlePrevSlide,
204
+ classes: classes,
205
+ left: true
206
+ })), /*#__PURE__*/_react.default.createElement("div", {
207
+ ref: this.containerRef,
208
+ className: _stylesModule.default.sliderContainer,
209
+ draggable: "false"
210
+ }, /*#__PURE__*/_react.default.createElement(_layout.default, {
211
+ transitionSlide: transitionSlide,
212
+ containerWidth: containerWidth,
213
+ slideArray: slideArray,
214
+ shouldAnimate: shouldAnimate,
215
+ slides: slides,
216
+ withBorder: withBorder,
217
+ index: index,
218
+ handleLegend: this.handleLegend,
219
+ handlePrevSlide: this.handlePrevSlide,
220
+ handleNextSlide: this.handleNextSlide,
221
+ timeAnimation: timeAnimation,
222
+ arrow: arrow,
223
+ legend: legend,
224
+ classes: classes
225
+ })), legend && legend.position === _constants.OUTSIDE && /*#__PURE__*/_react.default.createElement("div", {
226
+ className: _stylesModule.default.legendContainerOut
227
+ }, /*#__PURE__*/_react.default.createElement("div", {
228
+ className: _stylesModule.default.legend
229
+ }, slides.map((_, item) => /*#__PURE__*/_react.default.createElement(_Legend.default, {
230
+ LegendCustom: legend.legendCustom,
231
+ index: item,
232
+ currentSlide: index === slideArray.length - 1 ? 0 : index === 0 ? 1 : index - 1,
233
+ onClick: this.handleLegend,
234
+ classes: classes,
235
+ keyName: "legend-key-".concat(item)
236
+ })))), arrow && arrow.position === _constants.OUTSIDE && /*#__PURE__*/_react.default.createElement("div", {
237
+ className: _stylesModule.default.arrowContainer
238
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
239
+ ArrowCustom: arrow.arrowCustomRight,
240
+ callback: arrow.callbackRight,
241
+ onPress: this.handleNextSlide,
242
+ classes: classes
243
+ })));
244
+ }
245
+ }
316
246
  SliderContainer.propTypes = {
317
247
  slides: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
318
248
  imgSrc: _propTypes.string
@@ -337,5 +267,4 @@ SliderContainer.propTypes = {
337
267
  className: _propTypes.string,
338
268
  classes: (0, _propTypes.objectOf)(_propTypes.string)
339
269
  };
340
- var _default = SliderContainer;
341
- exports.default = _default;
270
+ var _default = exports.default = SliderContainer;