@widergy/energy-ui 2.12.2 → 2.12.3

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 (279) 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 +4 -2
  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 +32 -32
  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 +159 -250
  11. package/dist/components/UTAttachment/layout.js +26 -27
  12. package/dist/components/UTAttachment/theme.js +4 -2
  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 +54 -94
  18. package/dist/components/UTAutocomplete/theme.js +6 -4
  19. package/dist/components/UTAvatar/constants.js +2 -3
  20. package/dist/components/UTAvatar/index.js +18 -17
  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 +75 -93
  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 +30 -37
  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 +152 -166
  48. package/dist/components/UTBarChart/theme.js +4 -2
  49. package/dist/components/UTBarChart/types.js +10 -19
  50. package/dist/components/UTBarChart/utils.js +107 -111
  51. package/dist/components/UTBreadcrumbs/constants.js +23 -31
  52. package/dist/components/UTBreadcrumbs/index.js +76 -101
  53. package/dist/components/UTBreadcrumbs/theme.js +4 -2
  54. package/dist/components/UTButton/constants.js +11 -17
  55. package/dist/components/UTButton/index.js +28 -31
  56. package/dist/components/UTButton/theme.js +23 -23
  57. package/dist/components/UTCBUInput/index.js +36 -40
  58. package/dist/components/UTCBUInput/theme.js +4 -2
  59. package/dist/components/UTCaptcha/index.js +19 -45
  60. package/dist/components/UTCard/components/UTCardFooter/index.js +15 -16
  61. package/dist/components/UTCard/index.js +85 -120
  62. package/dist/components/UTCard/theme.js +11 -12
  63. package/dist/components/UTCard/types.js +2 -3
  64. package/dist/components/UTCarousel/components/Button/index.js +13 -13
  65. package/dist/components/UTCarousel/components/Legend/index.js +13 -15
  66. package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
  67. package/dist/components/UTCarousel/components/Slider/constants.js +5 -10
  68. package/dist/components/UTCarousel/components/Slider/index.js +204 -273
  69. package/dist/components/UTCarousel/components/Slider/layout.js +67 -94
  70. package/dist/components/UTCarousel/index.js +14 -15
  71. package/dist/components/UTCarousel/theme.js +4 -2
  72. package/dist/components/UTCheckList/constants.js +1 -2
  73. package/dist/components/UTCheckList/index.js +72 -93
  74. package/dist/components/UTCheckList/theme.js +31 -31
  75. package/dist/components/UTCheckbox/constants.js +3 -6
  76. package/dist/components/UTCheckbox/index.js +32 -44
  77. package/dist/components/UTCheckbox/theme.js +35 -35
  78. package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
  79. package/dist/components/UTConsumptionBar/constants.js +3 -6
  80. package/dist/components/UTConsumptionBar/index.js +53 -80
  81. package/dist/components/UTCuit/index.js +109 -133
  82. package/dist/components/UTCuit/theme.js +51 -53
  83. package/dist/components/UTDatePicker/components/Day/constants.js +1 -2
  84. package/dist/components/UTDatePicker/components/Day/index.js +12 -12
  85. package/dist/components/UTDatePicker/constants.js +20 -31
  86. package/dist/components/UTDatePicker/index.js +60 -102
  87. package/dist/components/UTDatePicker/theme.js +5 -3
  88. package/dist/components/UTDatePicker/types.js +2 -3
  89. package/dist/components/UTDatePicker/utils.js +2 -6
  90. package/dist/components/UTDialog/constants.js +2 -4
  91. package/dist/components/UTDialog/index.js +38 -37
  92. package/dist/components/UTDialog/theme.js +4 -2
  93. package/dist/components/UTDialog/types.js +2 -3
  94. package/dist/components/UTDotMenu/index.js +39 -61
  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 +4 -2
  98. package/dist/components/UTEmojiPicker/utils.js +21 -51
  99. package/dist/components/UTExternalLink/constants.js +3 -5
  100. package/dist/components/UTExternalLink/index.js +18 -15
  101. package/dist/components/UTExternalLink/theme.js +8 -6
  102. package/dist/components/UTFileInput/constants.js +2 -4
  103. package/dist/components/UTFileInput/index.js +7 -31
  104. package/dist/components/UTFileInput/layout.js +68 -97
  105. package/dist/components/UTIconButton/index.js +49 -72
  106. package/dist/components/UTIconButton/theme.js +4 -2
  107. package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +53 -58
  108. package/dist/components/UTImageRadio/constants.js +3 -6
  109. package/dist/components/UTImageRadio/index.js +39 -47
  110. package/dist/components/UTImageRadio/theme.js +11 -12
  111. package/dist/components/UTImageRadio/types.js +2 -3
  112. package/dist/components/UTImageRadio/utils.js +2 -6
  113. package/dist/components/UTLabel/constants.js +14 -20
  114. package/dist/components/UTLabel/index.js +18 -20
  115. package/dist/components/UTLabel/theme.js +15 -15
  116. package/dist/components/UTList/index.js +15 -18
  117. package/dist/components/UTLoading/index.js +15 -15
  118. package/dist/components/UTMap/components/GoogleMaps/constants.js +8 -11
  119. package/dist/components/UTMap/components/GoogleMaps/index.js +63 -91
  120. package/dist/components/UTMap/components/GoogleMaps/styles.js +2 -3
  121. package/dist/components/UTMap/constants.js +6 -12
  122. package/dist/components/UTMap/index.js +163 -198
  123. package/dist/components/UTMap/types.js +4 -6
  124. package/dist/components/UTMap/utils.js +29 -46
  125. package/dist/components/UTMap/withGoogleMapScript.js +18 -22
  126. package/dist/components/UTMenu/index.js +52 -69
  127. package/dist/components/UTMenu/theme.js +5 -3
  128. package/dist/components/UTMenu/utils.js +5 -11
  129. package/dist/components/UTModal/constants.js +9 -13
  130. package/dist/components/UTModal/index.js +26 -30
  131. package/dist/components/UTModal/theme.js +4 -2
  132. package/dist/components/UTPagination/components/PageSizeSelector/index.js +11 -10
  133. package/dist/components/UTPagination/components/PageSizeSelector/utils.js +7 -13
  134. package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
  135. package/dist/components/UTPagination/components/Pagination/index.js +28 -39
  136. package/dist/components/UTPagination/components/Pagination/utils.js +8 -14
  137. package/dist/components/UTPagination/constants.js +3 -6
  138. package/dist/components/UTPagination/index.js +16 -17
  139. package/dist/components/UTPagination/theme.js +4 -2
  140. package/dist/components/UTPanel/index.js +38 -44
  141. package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +13 -10
  142. package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +22 -19
  143. package/dist/components/UTPasswordField/components/PasswordValidations/index.js +63 -50
  144. package/dist/components/UTPasswordField/components/PasswordWarning/index.js +25 -26
  145. package/dist/components/UTPasswordField/index.js +26 -23
  146. package/dist/components/UTPasswordField/theme.js +4 -2
  147. package/dist/components/UTPhoneInput/constants.js +3 -6
  148. package/dist/components/UTPhoneInput/index.js +180 -205
  149. package/dist/components/UTPhoneInput/theme.js +77 -77
  150. package/dist/components/UTPieChart/components/ArrowLabel/constants.js +4 -8
  151. package/dist/components/UTPieChart/components/ArrowLabel/index.js +24 -23
  152. package/dist/components/UTPieChart/components/Legend/contants.js +3 -6
  153. package/dist/components/UTPieChart/components/Legend/index.js +27 -24
  154. package/dist/components/UTPieChart/constants.js +13 -26
  155. package/dist/components/UTPieChart/hooks/use-animated-value/index.js +15 -33
  156. package/dist/components/UTPieChart/index.js +73 -76
  157. package/dist/components/UTPieChart/theme.js +4 -2
  158. package/dist/components/UTPieChart/utils.js +4 -2
  159. package/dist/components/UTProgressBar/constants.js +2 -4
  160. package/dist/components/UTProgressBar/index.js +15 -17
  161. package/dist/components/UTProgressBar/theme.js +4 -2
  162. package/dist/components/UTProgressBar/types.js +2 -3
  163. package/dist/components/UTRadioGroup/index.js +56 -83
  164. package/dist/components/UTRadioGroup/theme.js +52 -52
  165. package/dist/components/UTRating/components/Circle/index.js +41 -56
  166. package/dist/components/UTRating/components/Faces/constants.js +2 -4
  167. package/dist/components/UTRating/components/Faces/index.js +34 -36
  168. package/dist/components/UTRating/components/Star/index.js +36 -40
  169. package/dist/components/UTRating/constants.js +4 -8
  170. package/dist/components/UTRating/index.js +31 -46
  171. package/dist/components/UTRating/theme.js +4 -2
  172. package/dist/components/UTRipple/Ripple.js +22 -39
  173. package/dist/components/UTRipple/index.js +18 -37
  174. package/dist/components/UTSelect/components/Option/index.js +13 -13
  175. package/dist/components/UTSelect/constants.js +4 -8
  176. package/dist/components/UTSelect/index.js +63 -85
  177. package/dist/components/UTSelect/stylesJS.js +2 -3
  178. package/dist/components/UTSelect/theme.js +6 -4
  179. package/dist/components/UTSelect/utils.js +3 -13
  180. package/dist/components/UTSidebar/components/ListOption/index.js +34 -49
  181. package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
  182. package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
  183. package/dist/components/UTSidebar/components/Option/constants.js +2 -3
  184. package/dist/components/UTSidebar/components/Option/index.js +28 -32
  185. package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
  186. package/dist/components/UTSidebar/index.js +42 -53
  187. package/dist/components/UTSidebar/theme.js +4 -2
  188. package/dist/components/UTSidebar/types.js +5 -10
  189. package/dist/components/UTSkeleton/index.js +10 -36
  190. package/dist/components/UTStatus/constants.js +5 -9
  191. package/dist/components/UTStatus/index.js +16 -15
  192. package/dist/components/UTStatus/theme.js +66 -49
  193. package/dist/components/UTSwitch/constants.js +3 -6
  194. package/dist/components/UTSwitch/index.js +42 -57
  195. package/dist/components/UTSwitch/theme.js +4 -2
  196. package/dist/components/UTTable/components/ActionIcons/constants.js +1 -2
  197. package/dist/components/UTTable/components/ActionIcons/index.js +47 -85
  198. package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +10 -12
  199. package/dist/components/UTTable/components/Cell/index.js +18 -23
  200. package/dist/components/UTTable/components/HeaderCell/constants.js +2 -3
  201. package/dist/components/UTTable/components/HeaderCell/index.js +23 -30
  202. package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
  203. package/dist/components/UTTable/components/PrimaryAction/index.js +12 -11
  204. package/dist/components/UTTable/components/ResponsiveCell/index.js +19 -20
  205. package/dist/components/UTTable/components/Status/index.js +18 -19
  206. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +10 -9
  207. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +7 -13
  208. package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
  209. package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +21 -32
  210. package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +8 -14
  211. package/dist/components/UTTable/components/TableFooter/constants.js +1 -2
  212. package/dist/components/UTTable/components/TableFooter/index.js +15 -15
  213. package/dist/components/UTTable/components/TableHeader/index.js +11 -11
  214. package/dist/components/UTTable/components/TableRow/constants.js +3 -6
  215. package/dist/components/UTTable/components/TableRow/index.js +82 -95
  216. package/dist/components/UTTable/components/TableRow/styles.module.scss +8 -1
  217. package/dist/components/UTTable/components/TableRow/utils.js +15 -0
  218. package/dist/components/UTTable/constants.js +26 -43
  219. package/dist/components/UTTable/hook.js +11 -26
  220. package/dist/components/UTTable/index.js +129 -220
  221. package/dist/components/UTTable/theme.js +17 -17
  222. package/dist/components/UTTable/types.js +4 -8
  223. package/dist/components/UTTable/utils.js +70 -74
  224. package/dist/components/UTTabs/components/TooltipTab/index.js +20 -30
  225. package/dist/components/UTTabs/constants.js +4 -8
  226. package/dist/components/UTTabs/index.js +57 -86
  227. package/dist/components/UTTabs/theme.js +4 -2
  228. package/dist/components/UTTabs/utils.js +1 -1
  229. package/dist/components/UTTextArea/constants.js +3 -6
  230. package/dist/components/UTTextArea/index.js +23 -23
  231. package/dist/components/UTTextArea/theme.js +4 -2
  232. package/dist/components/UTTextInput/constants.js +2 -3
  233. package/dist/components/UTTextInput/index.js +137 -165
  234. package/dist/components/UTTextInput/theme.js +6 -4
  235. package/dist/components/UTThirdPartyCookieChecker/index.js +17 -21
  236. package/dist/components/UTToggle/components/ToggleOption/index.js +16 -17
  237. package/dist/components/UTToggle/index.js +25 -26
  238. package/dist/components/UTToggle/theme.js +4 -2
  239. package/dist/components/UTTooltip/index.js +23 -30
  240. package/dist/components/UTTooltip/theme.js +4 -2
  241. package/dist/components/UTTopbar/components/Notifications/index.js +11 -14
  242. package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
  243. package/dist/components/UTTopbar/index.js +28 -31
  244. package/dist/components/UTTopbar/theme.js +4 -2
  245. package/dist/components/UTTopbar/types.js +5 -9
  246. package/dist/components/UTTouchableWithoutFeedback/index.js +14 -27
  247. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +2 -4
  248. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +34 -31
  249. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
  250. package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +6 -12
  251. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +8 -18
  252. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +23 -47
  253. package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +31 -34
  254. package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +81 -93
  255. package/dist/components/UTVirtualizedList/constants.js +4 -8
  256. package/dist/components/UTVirtualizedList/index.js +26 -38
  257. package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +17 -21
  258. package/dist/components/UTWorkflowContainer/constants.js +3 -6
  259. package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
  260. package/dist/components/UTWorkflowContainer/index.js +32 -51
  261. package/dist/components/UTWorkflowContainer/theme.js +60 -53
  262. package/dist/components/UTWorkflowContainer/types.js +2 -3
  263. package/dist/components/WithLoading/index.js +10 -15
  264. package/dist/components/WithTheme/index.js +10 -17
  265. package/dist/components/WithTheme/layout.js +22 -28
  266. package/dist/components/WithTouch/index.js +12 -19
  267. package/dist/constants/UTTable.js +2 -3
  268. package/dist/index.js +58 -58
  269. package/dist/theme.js +6 -5
  270. package/dist/types/commonTypes.js +3 -5
  271. package/dist/types/consumptionTypes.js +3 -5
  272. package/dist/types/formTypes.js +4 -7
  273. package/dist/types/tableTypes.js +2 -3
  274. package/dist/utils/classesUtils.js +5 -13
  275. package/dist/utils/componentUtils.js +10 -13
  276. package/dist/utils/helperFunctions.js +4 -4
  277. package/dist/utils/shadowUtils.js +13 -11
  278. package/dist/utils/useScreenSize.js +2 -3
  279. 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
  });
@@ -8,11 +7,6 @@ exports.validateProps = exports.retrieveStyle = exports.getLabelTheme = exports.
8
7
  var _react = _interopRequireDefault(require("react"));
9
8
  var _constants = require("./constants");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- 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; }
12
- 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; }
13
- 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; }
14
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
- 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); }
16
10
  var ErrorIcon = function ErrorIcon(props) {
17
11
  return /*#__PURE__*/_react.default.createElement("svg", props, /*#__PURE__*/_react.default.createElement("path", {
18
12
  fillRule: "evenodd",
@@ -88,47 +82,62 @@ WarningIcon.defaultProps = {
88
82
  fill: "none",
89
83
  xmlns: "http://www.w3.org/2000/svg"
90
84
  };
91
- var getBackgroundColor = function getBackgroundColor(_ref) {
92
- var theme = _ref.theme,
93
- type = _ref.type,
94
- variant = _ref.variant;
85
+ const getBackgroundColor = _ref => {
86
+ let {
87
+ theme,
88
+ type,
89
+ variant
90
+ } = _ref;
95
91
  return variant !== _constants.VARIANTS.unassigned ? theme.Palette[variant][type === _constants.TYPES.negative ? '04' : '01'] : type === _constants.TYPES.negative ? theme.Palette.gray['04'] : theme.Palette.light['04'];
96
92
  };
97
- var getIconFill = function getIconFill(_ref2) {
98
- var _TYPES$default$TYPES$;
99
- var theme = _ref2.theme,
100
- type = _ref2.type,
101
- variant = _ref2.variant;
102
- return (_TYPES$default$TYPES$ = {}, _defineProperty(_TYPES$default$TYPES$, _constants.TYPES.default, theme.Palette.dark['05']), _defineProperty(_TYPES$default$TYPES$, _constants.TYPES.light, theme.Palette[variant !== _constants.VARIANTS.unassigned ? variant : 'gray']['05']), _defineProperty(_TYPES$default$TYPES$, _constants.TYPES.negative, theme.Palette.light['01']), _TYPES$default$TYPES$)[type];
103
- };
104
- var defaultIconMapper = function defaultIconMapper(variant) {
105
- var _VARIANTS$error$VARIA;
106
- return (_VARIANTS$error$VARIA = {}, _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.error, ErrorIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.information, InfoIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.success, SuccessIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.unassigned, UnassignedIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.warning, WarningIcon), _VARIANTS$error$VARIA)[variant];
107
- };
93
+ const getIconFill = _ref2 => {
94
+ let {
95
+ theme,
96
+ type,
97
+ variant
98
+ } = _ref2;
99
+ return {
100
+ [_constants.TYPES.default]: theme.Palette.dark['05'],
101
+ [_constants.TYPES.light]: theme.Palette[variant !== _constants.VARIANTS.unassigned ? variant : 'gray']['05'],
102
+ [_constants.TYPES.negative]: theme.Palette.light['01']
103
+ }[type];
104
+ };
105
+ const defaultIconMapper = variant => ({
106
+ [_constants.VARIANTS.error]: ErrorIcon,
107
+ [_constants.VARIANTS.information]: InfoIcon,
108
+ [_constants.VARIANTS.success]: SuccessIcon,
109
+ [_constants.VARIANTS.unassigned]: UnassignedIcon,
110
+ [_constants.VARIANTS.warning]: WarningIcon
111
+ })[variant];
108
112
  exports.defaultIconMapper = defaultIconMapper;
109
- var validateProps = function validateProps(_ref3) {
110
- var type = _ref3.type,
111
- variant = _ref3.variant;
113
+ const validateProps = _ref3 => {
114
+ let {
115
+ type,
116
+ variant
117
+ } = _ref3;
112
118
  return {
113
119
  type: _constants.TYPES[type] || _constants.TYPES[_constants.DEFAULT_PROPS.type],
114
120
  variant: _constants.VARIANTS[variant] || _constants.VARIANTS[_constants.DEFAULT_PROPS.variant]
115
121
  };
116
122
  };
117
123
  exports.validateProps = validateProps;
118
- var retrieveStyle = function retrieveStyle(_ref4) {
119
- var theme = _ref4.theme,
120
- type = _ref4.type,
121
- uppercase = _ref4.uppercase,
122
- variant = _ref4.variant;
124
+ const retrieveStyle = _ref4 => {
125
+ let {
126
+ theme,
127
+ type,
128
+ uppercase,
129
+ variant
130
+ } = _ref4;
123
131
  return {
124
132
  root: {
125
133
  alignItems: 'center',
126
- backgroundColor: getBackgroundColor(_objectSpread({
127
- theme: theme
128
- }, validateProps({
129
- type: type,
130
- variant: variant
131
- }))),
134
+ backgroundColor: getBackgroundColor({
135
+ theme,
136
+ ...validateProps({
137
+ type,
138
+ variant
139
+ })
140
+ }),
132
141
  borderRadius: '4px',
133
142
  display: 'flex',
134
143
  gridGap: '8px',
@@ -139,29 +148,37 @@ var retrieveStyle = function retrieveStyle(_ref4) {
139
148
  display: 'none'
140
149
  }
141
150
  },
142
- label: _objectSpread({}, uppercase ? {
143
- textTransform: 'uppercase'
144
- } : {}),
151
+ label: {
152
+ ...(uppercase ? {
153
+ textTransform: 'uppercase'
154
+ } : {})
155
+ },
145
156
  icon: {
146
157
  flexShrink: '0',
147
158
  height: '20px',
148
159
  width: '20px',
149
160
  '& path': {
150
- fill: getIconFill(_objectSpread({
151
- theme: theme
152
- }, validateProps({
153
- type: type,
154
- variant: variant
155
- })))
161
+ fill: getIconFill({
162
+ theme,
163
+ ...validateProps({
164
+ type,
165
+ variant
166
+ })
167
+ })
156
168
  }
157
169
  }
158
170
  };
159
171
  };
160
172
  exports.retrieveStyle = retrieveStyle;
161
- var getLabelTheme = function getLabelTheme(_ref5) {
162
- var _TYPES$default$TYPES$2;
163
- var type = _ref5.type,
164
- variant = _ref5.variant;
165
- return (_TYPES$default$TYPES$2 = {}, _defineProperty(_TYPES$default$TYPES$2, _constants.TYPES.default, 'dark'), _defineProperty(_TYPES$default$TYPES$2, _constants.TYPES.light, variant !== _constants.VARIANTS.unassigned ? variant : 'gray'), _defineProperty(_TYPES$default$TYPES$2, _constants.TYPES.negative, 'light'), _TYPES$default$TYPES$2)[type];
173
+ const getLabelTheme = _ref5 => {
174
+ let {
175
+ type,
176
+ variant
177
+ } = _ref5;
178
+ return {
179
+ [_constants.TYPES.default]: 'dark',
180
+ [_constants.TYPES.light]: variant !== _constants.VARIANTS.unassigned ? variant : 'gray',
181
+ [_constants.TYPES.negative]: 'light'
182
+ }[type];
166
183
  };
167
184
  exports.getLabelTheme = getLabelTheme;
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TRUE = exports.STATES = exports.DEFAULT_SWITCH_ID = void 0;
7
- var STATES = {
7
+ const STATES = exports.STATES = {
8
8
  ON: 'SI',
9
9
  OFF: 'NO'
10
10
  };
11
- exports.STATES = STATES;
12
- var DEFAULT_SWITCH_ID = 'switch';
13
- exports.DEFAULT_SWITCH_ID = DEFAULT_SWITCH_ID;
14
- var TRUE = 'true';
15
- exports.TRUE = TRUE;
11
+ const DEFAULT_SWITCH_ID = exports.DEFAULT_SWITCH_ID = 'switch';
12
+ const TRUE = exports.TRUE = 'true';
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -16,62 +15,49 @@ var _WithTheme = _interopRequireDefault(require("../WithTheme"));
16
15
  var _theme = require("./theme");
17
16
  var _constants = require("./constants.js");
18
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
- 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); }
20
- 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; }
21
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
22
- 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."); }
23
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
24
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
25
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
26
- 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."); }
27
- 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); }
28
- 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; }
29
- 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; } }
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
- var UTSwitch = function UTSwitch(_ref) {
32
- var _ref$classes = _ref.classes,
33
- themeClasses = _ref$classes === void 0 ? {} : _ref$classes,
34
- classNames = _ref.classNames,
35
- disabled = _ref.disabled,
36
- _ref$field = _ref.field,
37
- field = _ref$field === void 0 ? {} : _ref$field,
38
- _ref$input = _ref.input,
39
- input = _ref$input === void 0 ? {} : _ref$input,
40
- _ref$meta = _ref.meta,
41
- meta = _ref$meta === void 0 ? {} : _ref$meta,
42
- showErrors = _ref.showErrors;
43
- var value = input.value,
44
- onChange_ = input.onChange;
45
- var key = field.key,
46
- fieldOptions = field.field_options,
47
- _field$configuration = field.configuration,
48
- configuration = _field$configuration === void 0 ? {} : _field$configuration;
49
- var textOff_ = configuration.textOff,
50
- textOn_ = configuration.textOn,
51
- _configuration$inside = configuration.insideText,
52
- insideText = _configuration$inside === void 0 ? true : _configuration$inside,
53
- withText = configuration.withText;
54
- var switchId = key || _constants.DEFAULT_SWITCH_ID;
55
- var classes = (0, _react.useMemo)(function () {
56
- return (0, _classesUtils.mergeClasses)(themeClasses, classNames);
57
- }, [classNames]);
58
- var useFieldOptions = fieldOptions && !(0, _array.isEmpty)(fieldOptions);
59
- var _ref2 = useFieldOptions ? _toConsumableArray(fieldOptions).sort(function (_, _ref4) {
60
- var optionValue = _ref4.value,
61
- name = _ref4.name;
62
- return [optionValue, name === _constants.TRUE].includes(value) ? 1 : -1;
63
- }) : [],
64
- _ref3 = _slicedToArray(_ref2, 2),
65
- currentOption = _ref3[0],
66
- switchedOption = _ref3[1];
67
- var onChange = useFieldOptions ? function () {
68
- return onChange_(switchedOption.value);
69
- } : onChange_;
70
- (0, _react.useEffect)(function () {
18
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
+ const UTSwitch = _ref => {
21
+ let {
22
+ classes: themeClasses = {},
23
+ classNames,
24
+ disabled,
25
+ field = {},
26
+ input = {},
27
+ meta = {},
28
+ showErrors
29
+ } = _ref;
30
+ const {
31
+ value,
32
+ onChange: onChange_
33
+ } = input;
34
+ const {
35
+ key,
36
+ field_options: fieldOptions,
37
+ configuration = {}
38
+ } = field;
39
+ const {
40
+ textOff: textOff_,
41
+ textOn: textOn_,
42
+ insideText = true,
43
+ withText
44
+ } = configuration;
45
+ const switchId = key || _constants.DEFAULT_SWITCH_ID;
46
+ const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(themeClasses, classNames), [classNames]);
47
+ const useFieldOptions = fieldOptions && !(0, _array.isEmpty)(fieldOptions);
48
+ const [currentOption, switchedOption] = useFieldOptions ? [...fieldOptions].sort((_, _ref2) => {
49
+ let {
50
+ value: optionValue,
51
+ name
52
+ } = _ref2;
53
+ return [optionValue, name === _constants.TRUE].includes(value) ? 1 : -1;
54
+ }) : [];
55
+ const onChange = useFieldOptions ? () => onChange_(switchedOption.value) : onChange_;
56
+ (0, _react.useEffect)(() => {
71
57
  if (useFieldOptions && value === false) onChange_(currentOption.value);
72
58
  }, [value]);
73
- var textOn = textOn_ || _constants.STATES.ON;
74
- var textOff = textOff_ || _constants.STATES.OFF;
59
+ const textOn = textOn_ || _constants.STATES.ON;
60
+ const textOff = textOff_ || _constants.STATES.OFF;
75
61
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
76
62
  className: classes.outerContainer
77
63
  }, withText && !insideText && textOff, /*#__PURE__*/_react.default.createElement("label", {
@@ -113,5 +99,4 @@ UTSwitch.propTypes = {
113
99
  meta: _formTypes.metaPropTypes,
114
100
  showErrors: _propTypes.bool
115
101
  };
116
- var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTSwitch);
117
- exports.default = _default;
102
+ var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTSwitch);
@@ -7,8 +7,10 @@ exports.retrieveStyle = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
8
  var _colorsModule = _interopRequireDefault(require("../../scss/variables/colors.module.scss"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- var retrieveStyle = function retrieveStyle(_ref) {
11
- var theme = _ref.theme;
10
+ const retrieveStyle = _ref => {
11
+ let {
12
+ theme
13
+ } = _ref;
12
14
  return {
13
15
  outerContainer: {
14
16
  alignItems: (0, _seamlessImmutable.getIn)(theme, ['UTSwitch', 'outerContainer', 'alignItems'], 'center'),
@@ -4,5 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEAULT_LOADING_SIZE = void 0;
7
- var DEAULT_LOADING_SIZE = 24;
8
- exports.DEAULT_LOADING_SIZE = DEAULT_LOADING_SIZE;
7
+ const DEAULT_LOADING_SIZE = exports.DEAULT_LOADING_SIZE = 24;
@@ -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
  });
@@ -15,91 +14,57 @@ var _types = require("../../types");
15
14
  var _constants = require("./constants");
16
15
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
17
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
- 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); }
19
- 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; }
20
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _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; }
22
- 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; }
23
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
- 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); }
25
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
26
- 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."); }
27
- 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); }
28
- 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; }
29
- 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; } }
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
- var ActionIcons = function ActionIcons(_ref) {
32
- var classes = _ref.classes,
33
- column = _ref.column,
34
- rowData = _ref.rowData;
35
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.actions.map(function (_ref2) {
36
- var key = _ref2.key,
37
- Icon = _ref2.Icon,
38
- tooltip = _ref2.tooltip,
39
- disabledTooltip = _ref2.disabledTooltip,
40
- onClick = _ref2.onClick,
41
- buttonClassName = _ref2.buttonClassName,
42
- iconClassName = _ref2.iconClassName,
43
- disabledIconClassName = _ref2.disabledIconClassName,
44
- loadingClassName = _ref2.loadingClassName,
45
- _ref2$loadingSize = _ref2.loadingSize,
46
- loadingSize = _ref2$loadingSize === void 0 ? _constants.DEAULT_LOADING_SIZE : _ref2$loadingSize,
47
- _ref2$isVisible = _ref2.isVisible,
48
- isVisible = _ref2$isVisible === void 0 ? function () {
49
- return true;
50
- } : _ref2$isVisible,
51
- _ref2$tooltipProps = _ref2.tooltipProps,
52
- tooltipProps = _ref2$tooltipProps === void 0 ? {} : _ref2$tooltipProps,
53
- _ref2$isDisabled = _ref2.isDisabled,
54
- isDisabled = _ref2$isDisabled === void 0 ? function () {
55
- return false;
56
- } : _ref2$isDisabled,
57
- _ref2$isLoading = _ref2.isLoading,
58
- isLoading = _ref2$isLoading === void 0 ? function () {
59
- return false;
60
- } : _ref2$isLoading,
61
- _ref2$menuItems = _ref2.menuItems,
62
- menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
63
- withMenuDivider = _ref2.withMenuDivider;
64
- var _useState = (0, _react.useState)(),
65
- _useState2 = _slicedToArray(_useState, 2),
66
- menuAnchor = _useState2[0],
67
- setMenuAnchor = _useState2[1];
68
- var _useState3 = (0, _react.useState)(),
69
- _useState4 = _slicedToArray(_useState3, 2),
70
- menuRowContextData = _useState4[0],
71
- setMenuRowConextData = _useState4[1];
72
- var openMenu = function openMenu(event) {
73
- return setMenuAnchor(event.currentTarget);
74
- };
75
- var closeMenu = function closeMenu() {
76
- return setMenuAnchor();
77
- };
78
- var handleActionClick = function handleActionClick(event, eventRowData) {
17
+ 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); }
18
+ 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; }
19
+ const ActionIcons = _ref => {
20
+ let {
21
+ classes,
22
+ column,
23
+ rowData
24
+ } = _ref;
25
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.actions.map(_ref2 => {
26
+ let {
27
+ key,
28
+ Icon,
29
+ tooltip,
30
+ disabledTooltip,
31
+ onClick,
32
+ buttonClassName,
33
+ iconClassName,
34
+ disabledIconClassName,
35
+ loadingClassName,
36
+ loadingSize = _constants.DEAULT_LOADING_SIZE,
37
+ isVisible = () => true,
38
+ tooltipProps = {},
39
+ isDisabled = () => false,
40
+ isLoading = () => false,
41
+ menuItems = [],
42
+ withMenuDivider
43
+ } = _ref2;
44
+ const [menuAnchor, setMenuAnchor] = (0, _react.useState)();
45
+ const [menuRowContextData, setMenuRowConextData] = (0, _react.useState)();
46
+ const openMenu = event => setMenuAnchor(event.currentTarget);
47
+ const closeMenu = () => setMenuAnchor();
48
+ const handleActionClick = (event, eventRowData) => {
79
49
  if ((0, _array.isEmpty)(menuItems)) onClick(eventRowData);else {
80
- setMenuRowConextData(_objectSpread(_objectSpread({}, eventRowData), {}, {
50
+ setMenuRowConextData({
51
+ ...eventRowData,
81
52
  clickCallback: closeMenu
82
- }));
53
+ });
83
54
  openMenu(event);
84
55
  }
85
56
  };
86
- var visibleMenuItems = menuItems.filter(function (menuItem) {
87
- return !menuItem.isVisible || menuItem.isVisible(rowData);
88
- }).map(function (menuItem) {
89
- return _objectSpread(_objectSpread({}, menuItem), {}, {
90
- disabled: menuItem.isDisabled && menuItem.isDisabled(rowData)
91
- });
92
- });
93
- var getDisabledTooltip = function getDisabledTooltip() {
94
- return typeof disabledTooltip === 'function' ? disabledTooltip(rowData) : disabledTooltip;
57
+ const visibleMenuItems = menuItems.filter(menuItem => !menuItem.isVisible || menuItem.isVisible(rowData)).map(menuItem => ({
58
+ ...menuItem,
59
+ disabled: menuItem.isDisabled && menuItem.isDisabled(rowData)
60
+ }));
61
+ const getDisabledTooltip = () => typeof disabledTooltip === 'function' ? disabledTooltip(rowData) : disabledTooltip;
62
+ const tooltipContent = isDisabled(rowData) && disabledTooltip ? getDisabledTooltip() : tooltip;
63
+ const tippyProps = {
64
+ appendTo: () => document.body,
65
+ interactive: false,
66
+ ...tooltipProps
95
67
  };
96
- var tooltipContent = isDisabled(rowData) && disabledTooltip ? getDisabledTooltip() : tooltip;
97
- var tippyProps = _objectSpread({
98
- appendTo: function appendTo() {
99
- return document.body;
100
- },
101
- interactive: false
102
- }, tooltipProps);
103
68
  return isVisible(rowData) && /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
104
69
  key: key,
105
70
  content: tooltipContent,
@@ -107,9 +72,7 @@ var ActionIcons = function ActionIcons(_ref) {
107
72
  tippyProps: tippyProps
108
73
  }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("div", {
109
74
  className: "".concat(_stylesModule.default.iconButton, " ").concat(classes.actionIconButton, " \n ").concat((isDisabled(rowData) || isLoading(rowData)) && _stylesModule.default.disabled, " ").concat(buttonClassName),
110
- onClick: function onClick(event) {
111
- return handleActionClick(event, rowData);
112
- },
75
+ onClick: event => handleActionClick(event, rowData),
113
76
  role: "button"
114
77
  }, isLoading(rowData) ? /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
115
78
  className: "".concat(classes.actionLoading, " ").concat(loadingClassName),
@@ -132,5 +95,4 @@ ActionIcons.propTypes = {
132
95
  column: _types.columnType,
133
96
  rowData: _propTypes.object
134
97
  };
135
- var _default = /*#__PURE__*/(0, _react.memo)(ActionIcons);
136
- exports.default = _default;
98
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(ActionIcons);
@@ -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
  });
@@ -11,19 +10,19 @@ var _object = require("@widergy/web-utils/lib/object");
11
10
  var _UTButton = _interopRequireDefault(require("../../../../../UTButton"));
12
11
  var _types = require("../../../../types");
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- 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); }
15
- 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; }
16
- var ActionButton = function ActionButton(_ref) {
13
+ 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); }
14
+ 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; }
15
+ const ActionButton = _ref => {
17
16
  var _column$actions;
18
- var column = _ref.column,
19
- rowData = _ref.rowData;
20
- var actionConfig = (_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions[0];
17
+ let {
18
+ column,
19
+ rowData
20
+ } = _ref;
21
+ const actionConfig = (_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions[0];
21
22
  return !(0, _object.objectIsEmpty)(actionConfig) && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
22
23
  classNames: actionConfig.buttonClassNames,
23
24
  key: actionConfig.key,
24
- onClick: function onClick() {
25
- return actionConfig.onClick(rowData);
26
- },
25
+ onClick: () => actionConfig.onClick(rowData),
27
26
  variant: "text"
28
27
  }, actionConfig.text);
29
28
  };
@@ -31,5 +30,4 @@ ActionButton.propTypes = {
31
30
  column: _types.columnType,
32
31
  rowData: _propTypes.object
33
32
  };
34
- var _default = /*#__PURE__*/(0, _react.memo)(ActionButton);
35
- exports.default = _default;
33
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(ActionButton);
@@ -13,29 +13,25 @@ var _Status = _interopRequireDefault(require("../Status"));
13
13
  var _ActionButton = _interopRequireDefault(require("./components/ActionButton"));
14
14
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
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 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; }
20
- 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; }
21
- 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; }
22
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
- 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); }
24
- var Cell = function Cell(_ref) {
25
- var _ref$align = _ref.align,
26
- align = _ref$align === void 0 ? _constants.COLUMN_POSITION.LEFT : _ref$align,
27
- classes = _ref.classes,
28
- column = _ref.column,
29
- columnSizes = _ref.columnSizes,
30
- defaultNullValue = _ref.defaultNullValue,
31
- rowData = _ref.rowData,
32
- style = _ref.style;
33
- var cellAlignStyles = [_constants.CELL_TYPES.ACTION_ICONS, _constants.CELL_TYPES.ACTION_BUTTON].includes(column.type) ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
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; }
18
+ const Cell = _ref => {
19
+ let {
20
+ align = _constants.COLUMN_POSITION.LEFT,
21
+ classes,
22
+ column,
23
+ columnSizes,
24
+ defaultNullValue,
25
+ rowData,
26
+ style
27
+ } = _ref;
28
+ const cellAlignStyles = [_constants.CELL_TYPES.ACTION_ICONS, _constants.CELL_TYPES.ACTION_BUTTON].includes(column.type) ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
34
29
  return /*#__PURE__*/_react.default.createElement("div", {
35
30
  className: " ".concat(_stylesModule.default.rowElement, " ").concat(cellAlignStyles, " ").concat(classes.rowCell),
36
- style: _objectSpread({
37
- width: columnSizes[column.key]
38
- }, style)
31
+ style: {
32
+ width: columnSizes[column.key],
33
+ ...style
34
+ }
39
35
  }, column.cellRenderer ? column.cellRenderer(rowData[column.key], rowData) : column.type === _constants.CELL_TYPES.ACTION_BUTTON ? /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
40
36
  column: column,
41
37
  rowData: rowData
@@ -59,5 +55,4 @@ Cell.propTypes = {
59
55
  rowData: _propTypes.object,
60
56
  style: _propTypes.object
61
57
  };
62
- var _default = /*#__PURE__*/(0, _react.memo)(Cell);
63
- exports.default = _default;
58
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(Cell);
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ORDER_DIRECTION = void 0;
7
- var ORDER_DIRECTION = {
7
+ const ORDER_DIRECTION = exports.ORDER_DIRECTION = {
8
8
  ASC: 'asc',
9
9
  DESC: 'desc'
10
- };
11
- exports.ORDER_DIRECTION = ORDER_DIRECTION;
10
+ };