@widergy/energy-ui 1.134.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/Loading/index.js +1 -2
  3. package/dist/components/Loading/styles.module.scss +1 -1
  4. package/dist/components/Loading/theme.js +2 -1
  5. package/dist/components/UTAlert/theme.js +3 -2
  6. package/dist/components/UTAttachment/layout.js +9 -7
  7. package/dist/components/UTAttachment/styles.module.scss +0 -1
  8. package/dist/components/UTAttachment/theme.js +2 -1
  9. package/dist/components/UTAutocomplete/theme.js +8 -6
  10. package/dist/components/UTAvatar/index.js +21 -8
  11. package/dist/components/UTBarChart/components/Legend/index.js +24 -20
  12. package/dist/components/UTBarChart/components/Pagination/index.js +26 -20
  13. package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +1 -1
  14. package/dist/components/UTBarChart/components/YAxis/index.js +1 -1
  15. package/dist/components/UTBarChart/index.js +7 -4
  16. package/dist/components/UTBarChart/theme.js +10 -7
  17. package/dist/components/UTBarChart/types.js +2 -2
  18. package/dist/components/UTBreadcrumbs/index.js +14 -8
  19. package/dist/components/UTBreadcrumbs/styles.module.scss +0 -6
  20. package/dist/components/UTBreadcrumbs/theme.js +2 -13
  21. package/dist/components/UTButton/README.md +35 -0
  22. package/dist/components/UTButton/constants.js +42 -0
  23. package/dist/components/UTButton/index.js +63 -83
  24. package/dist/components/UTButton/styles.module.scss +36 -0
  25. package/dist/components/UTButton/theme.js +143 -158
  26. package/dist/components/UTCBUInput/theme.js +2 -1
  27. package/dist/components/UTCard/components/UTCardFooter/index.js +5 -6
  28. package/dist/components/UTCard/index.js +23 -29
  29. package/dist/components/UTCard/theme.js +2 -1
  30. package/dist/components/UTCarousel/components/Button/index.js +1 -1
  31. package/dist/components/UTCarousel/components/Legend/index.js +1 -4
  32. package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +2 -5
  33. package/dist/components/UTCarousel/components/Slider/index.js +45 -18
  34. package/dist/components/UTCarousel/components/Slider/layout.js +13 -12
  35. package/dist/components/UTCarousel/theme.js +2 -1
  36. package/dist/components/UTCheckList/index.js +11 -9
  37. package/dist/components/UTCheckList/theme.js +8 -3
  38. package/dist/components/UTCheckbox/index.js +34 -28
  39. package/dist/components/UTCheckbox/theme.js +11 -3
  40. package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +7 -8
  41. package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/styles.module.scss +1 -2
  42. package/dist/components/UTConsumptionBar/index.js +22 -13
  43. package/dist/components/UTConsumptionBar/styles.module.scss +0 -14
  44. package/dist/components/UTCuit/index.js +2 -2
  45. package/dist/components/UTCuit/theme.js +1 -1
  46. package/dist/components/UTDatePicker/index.js +29 -27
  47. package/dist/components/UTDatePicker/theme.js +22 -7
  48. package/dist/components/UTDialog/index.js +19 -23
  49. package/dist/components/UTDialog/theme.js +8 -23
  50. package/dist/components/UTDialog/types.js +5 -6
  51. package/dist/components/UTDotMenu/index.js +16 -8
  52. package/dist/components/UTEmojiPicker/theme.js +2 -1
  53. package/dist/components/UTFileInput/layout.js +5 -4
  54. package/dist/components/UTFileInput/styles.module.scss +0 -1
  55. package/dist/components/UTIconButton/theme.js +2 -1
  56. package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +2 -2
  57. package/dist/components/UTImageRadio/index.js +2 -1
  58. package/dist/components/UTImageRadio/theme.js +15 -12
  59. package/dist/components/UTLabel/README.md +169 -0
  60. package/dist/components/UTLabel/constants.js +91 -0
  61. package/dist/components/UTLabel/index.js +41 -104
  62. package/dist/components/UTLabel/theme.js +29 -84
  63. package/dist/components/UTMap/index.js +7 -7
  64. package/dist/components/UTMap/styles.module.scss +0 -5
  65. package/dist/components/UTMenu/theme.js +3 -2
  66. package/dist/components/UTPanel/index.js +11 -10
  67. package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +4 -3
  68. package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/styles.module.scss +2 -2
  69. package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +16 -16
  70. package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/styles.module.scss +2 -2
  71. package/dist/components/UTPasswordField/components/PasswordValidations/index.js +11 -9
  72. package/dist/components/UTPasswordField/components/PasswordWarning/index.js +3 -3
  73. package/dist/components/UTPasswordField/components/PasswordWarning/styles.module.scss +1 -1
  74. package/dist/components/UTPasswordField/theme.js +13 -27
  75. package/dist/components/UTPhoneInput/index.js +4 -4
  76. package/dist/components/UTPhoneInput/theme.js +3 -6
  77. package/dist/components/UTPieChart/theme.js +2 -1
  78. package/dist/components/UTProgressBar/index.js +27 -20
  79. package/dist/components/UTProgressBar/theme.js +14 -13
  80. package/dist/components/UTRadioGroup/index.js +35 -22
  81. package/dist/components/UTRadioGroup/theme.js +10 -6
  82. package/dist/components/UTRating/components/Star/index.js +2 -1
  83. package/dist/components/UTRating/index.js +3 -1
  84. package/dist/components/UTRating/theme.js +3 -2
  85. package/dist/components/UTSelect/index.js +13 -3
  86. package/dist/components/UTSelect/styles.module.scss +5 -0
  87. package/dist/components/UTSelect/theme.js +7 -2
  88. package/dist/components/UTSidebar/theme.js +6 -5
  89. package/dist/components/UTSkeleton/index.js +3 -2
  90. package/dist/components/UTSwitch/index.js +2 -1
  91. package/dist/components/UTSwitch/theme.js +2 -1
  92. package/dist/components/UTTable/components/TableHeader/index.js +11 -7
  93. package/dist/components/UTTable/theme.js +31 -29
  94. package/dist/components/UTTabs/index.js +25 -20
  95. package/dist/components/UTTabs/theme.js +2 -1
  96. package/dist/components/UTTextArea/index.js +2 -1
  97. package/dist/components/UTTextArea/theme.js +2 -1
  98. package/dist/components/UTTextInput/index.js +16 -8
  99. package/dist/components/UTTextInput/styles.module.scss +3 -2
  100. package/dist/components/UTTextInput/theme.js +3 -2
  101. package/dist/components/UTToggle/components/ToggleOption/index.js +1 -0
  102. package/dist/components/UTToggle/theme.js +2 -1
  103. package/dist/components/UTTooltip/index.js +6 -4
  104. package/dist/components/UTTooltip/styles.module.scss +4 -2
  105. package/dist/components/UTTooltip/theme.js +2 -1
  106. package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +12 -4
  107. package/dist/components/UTWorkflowContainer/index.js +19 -15
  108. package/dist/components/UTWorkflowContainer/styles.module.scss +0 -34
  109. package/dist/components/UTWorkflowContainer/theme.js +12 -58
  110. package/dist/components/UTWorkflowContainer/types.js +1 -1
  111. package/dist/components/WithTheme/layout.js +46 -42
  112. package/dist/scss/variables/_colors.scss +8 -0
  113. package/dist/theme.js +4 -1
  114. package/dist/types/formTypes.js +3 -3
  115. package/dist/utils/classesUtils.js +7 -3
  116. package/dist/utils/shadowUtils.js +40 -0
  117. package/package.json +5 -3
  118. package/dist/components/UTDialog/components/ActionButton/index.js +0 -35
  119. package/dist/components/UTLabel/styles.module.scss +0 -3
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.retrieveStyle = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
8
  var _colors = _interopRequireDefault(require("../../scss/variables/_colors.scss"));
9
+ var _classesUtils = require("../../utils/classesUtils");
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
12
  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; }
12
13
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
14
  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); }
14
- var retrieveStyle = function retrieveStyle(theme) {
15
- var _container, _subtitle;
15
+ var retrieveStyle = function retrieveStyle(_ref) {
16
+ var _container, _theme$UTWorkflowCont, _theme$UTWorkflowCont2, _theme$UTWorkflowCont3, _theme$UTWorkflowCont4, _theme$UTWorkflowCont5, _theme$UTWorkflowCont6, _theme$UTWorkflowCont7, _theme$UTWorkflowCont8, _theme$UTWorkflowCont9, _theme$UTWorkflowCont10, _theme$UTWorkflowCont11, _theme$UTWorkflowCont12, _subtitle, _theme$UTWorkflowCont13, _theme$UTWorkflowCont14, _theme$UTWorkflowCont15;
17
+ var theme = _ref.theme;
16
18
  var mobile = (0, _seamlessImmutable.getIn)(theme, ['Media', 'mobile']);
17
19
  var tabletMobile = (0, _seamlessImmutable.getIn)(theme, ['Media', 'tabletMobile']);
18
20
  var desktop = (0, _seamlessImmutable.getIn)(theme, ['Media', 'desktop']);
@@ -71,68 +73,21 @@ var retrieveStyle = function retrieveStyle(theme) {
71
73
  maxWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'titles', 'tabletMobile', 'maxWidth'])
72
74
  }),
73
75
  backButton: _defineProperty({
74
- border: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'border']),
75
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'borderRadius'], 4),
76
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'color']),
77
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'backgroundColor']),
78
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'fontSize']),
79
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'fontWeight']),
80
- height: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'height']),
81
- left: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'left']),
82
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'padding']),
83
- '&:hover': {
84
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButtonHover', 'color']),
85
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButtonHover', 'backgroundColor'])
86
- },
87
- minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'minWidth']),
88
- boxShadow: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'boxShadow'])
76
+ minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'minWidth'])
89
77
  }, tabletMobile, {
90
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', "tabletMobile", 'borderRadius']),
91
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', "tabletMobile", 'padding']),
92
- minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', "tabletMobile", 'minWidth'], '1px !important')
78
+ minWidth: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont === void 0 ? void 0 : (_theme$UTWorkflowCont2 = _theme$UTWorkflowCont.backButton) === null || _theme$UTWorkflowCont2 === void 0 ? void 0 : (_theme$UTWorkflowCont3 = _theme$UTWorkflowCont2.tabletMobile) === null || _theme$UTWorkflowCont3 === void 0 ? void 0 : _theme$UTWorkflowCont3.minWidth) || '1px')
93
79
  }),
94
- buttonIcon: {
95
- height: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'buttonIcon', 'height']),
96
- width: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'buttonIcon', 'width']),
97
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'buttonIcon', 'color'])
98
- },
99
- backButtonDisabled: {
100
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButtonDisabled', 'backgroundColor']),
101
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButtonDisabled', 'color']),
102
- border: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButtonDisabled', 'border'])
103
- },
104
- nextButtonDisabled: {
105
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButtonDisabled', 'backgroundColor']),
106
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButtonDisabled', 'color']),
107
- border: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButtonDisabled', 'border'])
108
- },
109
80
  nextButton: _defineProperty({
110
- border: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'border']),
111
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'borderRadius'], 4),
112
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'color']),
113
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'backgroundColor']),
114
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'fontSize']),
115
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'fontWeight']),
116
- height: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'height']),
117
- right: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'left']),
118
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'padding']),
119
- '&:hover': {
120
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButtonHover', 'color']),
121
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButtonHover', 'backgroundColor'])
122
- },
123
- minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'minWidth']),
124
- boxShadow: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', 'boxShadow'])
81
+ minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'backButton', 'minWidth'])
125
82
  }, tabletMobile, {
126
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', "tabletMobile", 'borderRadius']),
127
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', "tabletMobile", 'padding']),
128
- minWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'nextButton', "tabletMobile", 'minWidth'], '1px !important')
83
+ minWidth: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont4 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont4 === void 0 ? void 0 : (_theme$UTWorkflowCont5 = _theme$UTWorkflowCont4.nextButton) === null || _theme$UTWorkflowCont5 === void 0 ? void 0 : (_theme$UTWorkflowCont6 = _theme$UTWorkflowCont5.tabletMobile) === null || _theme$UTWorkflowCont6 === void 0 ? void 0 : _theme$UTWorkflowCont6.minWidth) || '1px')
129
84
  }),
130
85
  title: _defineProperty({
131
86
  color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'color']),
132
87
  fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'fontSize']),
133
88
  fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'fontWeight']),
134
- margin: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'margin'], '0 0 2px 0'),
135
- marginBottom: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'marginBottom']),
89
+ margin: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont7 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont7 === void 0 ? void 0 : (_theme$UTWorkflowCont8 = _theme$UTWorkflowCont7.title) === null || _theme$UTWorkflowCont8 === void 0 ? void 0 : _theme$UTWorkflowCont8.margin) || '0 0 2px 0'),
90
+ marginBottom: (0, _classesUtils.withImportant)(theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont9 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont9 === void 0 ? void 0 : (_theme$UTWorkflowCont10 = _theme$UTWorkflowCont9.title) === null || _theme$UTWorkflowCont10 === void 0 ? void 0 : _theme$UTWorkflowCont10.marginBottom),
136
91
  textAlign: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'textAlign'])
137
92
  }, tabletMobile, {
138
93
  marginTop: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'tabletMobile', 'marginTop']),
@@ -149,8 +104,7 @@ var retrieveStyle = function retrieveStyle(theme) {
149
104
  color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'color']),
150
105
  fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'fontSize']),
151
106
  fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'fontWeight']),
152
- margin: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'margin'], '0 0 2px 0'),
153
- marginBottom: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'marginBottom']),
107
+ margin: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont11 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont11 === void 0 ? void 0 : (_theme$UTWorkflowCont12 = _theme$UTWorkflowCont11.subtitle) === null || _theme$UTWorkflowCont12 === void 0 ? void 0 : _theme$UTWorkflowCont12.margin) || '0 0 10px 0'),
154
108
  textAlign: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'textAlign'])
155
109
  }, _defineProperty(_subtitle, tabletMobile, {
156
110
  fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'tabletMobile', 'fontSize'])
@@ -174,7 +128,7 @@ var retrieveStyle = function retrieveStyle(theme) {
174
128
  justifyContent: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'bottomActions', 'container', 'justifyContent']),
175
129
  margin: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'bottomActions', 'container', 'padding'], '0'),
176
130
  minHeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'bottomActions', 'container', 'minHeight'], '90px'),
177
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'bottomActions', 'container', 'padding'], '0 !important')
131
+ padding: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont13 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont13 === void 0 ? void 0 : (_theme$UTWorkflowCont14 = _theme$UTWorkflowCont13.bottomActions) === null || _theme$UTWorkflowCont14 === void 0 ? void 0 : (_theme$UTWorkflowCont15 = _theme$UTWorkflowCont14.container) === null || _theme$UTWorkflowCont15 === void 0 ? void 0 : _theme$UTWorkflowCont15.padding) || 0)
178
132
  }
179
133
  };
180
134
  };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.buttonTypes = void 0;
7
7
  var _propTypes = require("prop-types");
8
8
  var buttonTypes = (0, _propTypes.oneOfType)([_propTypes.element, (0, _propTypes.shape)({
9
- onPress: _propTypes.func,
9
+ onClick: _propTypes.func,
10
10
  disabled: _propTypes.bool,
11
11
  label: _propTypes.string,
12
12
  buttonProps: _propTypes.object,
@@ -5,57 +5,61 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
9
9
  var _propTypes = require("prop-types");
10
- var _reactJss = _interopRequireDefault(require("react-jss"));
10
+ var _jss = _interopRequireDefault(require("jss"));
11
+ var _jssPresetDefault = _interopRequireDefault(require("jss-preset-default"));
12
+ var _objectHash = _interopRequireDefault(require("object-hash"));
11
13
  var _styles = require("@material-ui/core/styles");
14
+ var _theme = require("../../theme");
15
+ var _excluded = ["Component", "muiTheme", "retrieveMuiTheme", "retrieveStyle", "theme"];
12
16
  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
17
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
- 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); } }
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
+ 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; }
19
21
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
22
  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
- 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); }
22
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
- 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); }; }
24
- 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); }
25
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
- 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; } }
27
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
- var ThemedComponent = /*#__PURE__*/function (_PureComponent) {
29
- _inherits(ThemedComponent, _PureComponent);
30
- var _super = _createSuper(ThemedComponent);
31
- function ThemedComponent(props) {
32
- var _this;
33
- _classCallCheck(this, ThemedComponent);
34
- _this = _super.call(this, props);
35
- _this.muiTheme = _this.props.retrieveMuiTheme && _this.props.retrieveMuiTheme(_this.props.theme, _this.props.muiTheme);
36
- _this.StyledComponent = _this.props.retrieveStyle ? (0, _reactJss.default)(_this.props.retrieveStyle(_this.props.theme))(_this.props.Component) : _this.props.Component;
37
- return _this;
38
- }
39
- _createClass(ThemedComponent, [{
40
- key: "render",
41
- value: function render() {
42
- return this.muiTheme ? /*#__PURE__*/_react.default.createElement(_styles.MuiThemeProvider, {
43
- theme: this.muiTheme
44
- }, /*#__PURE__*/_react.default.createElement(this.StyledComponent, _extends({
45
- base: true
46
- }, this.props))) : /*#__PURE__*/_react.default.createElement(this.StyledComponent, _extends({
47
- base: true
48
- }, this.props));
49
- }
50
- }]);
51
- return ThemedComponent;
52
- }(_react.PureComponent);
23
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
24
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
+ _jss.default.setup((0, _jssPresetDefault.default)());
26
+ _jss.default.options.insertionPoint = document.getElementById('energyui-insertion-point');
27
+ var conditionalCreateSheet = function conditionalCreateSheet(retrieveStyle, theme) {
28
+ var styles = retrieveStyle(theme);
29
+ var stylesKey = (0, _objectHash.default)(styles);
30
+ var sheet = _theme.manager.get(stylesKey);
31
+ if (sheet) return sheet.classes;
32
+ sheet = _jss.default.createStyleSheet(styles);
33
+ _theme.manager.add(stylesKey, sheet);
34
+ var _sheet$attach = sheet.attach(),
35
+ classes = _sheet$attach.classes;
36
+ return classes;
37
+ };
38
+ var ThemedComponent = function ThemedComponent(_ref) {
39
+ var Component = _ref.Component,
40
+ muiTheme = _ref.muiTheme,
41
+ retrieveMuiTheme = _ref.retrieveMuiTheme,
42
+ retrieveStyle = _ref.retrieveStyle,
43
+ theme = _ref.theme,
44
+ props = _objectWithoutProperties(_ref, _excluded);
45
+ var classes = conditionalCreateSheet(retrieveStyle, _objectSpread({
46
+ theme: theme
47
+ }, props));
48
+ var muiThemeUpdated = retrieveMuiTheme && retrieveMuiTheme(theme, muiTheme);
49
+ return muiThemeUpdated ? /*#__PURE__*/_react.default.createElement(_styles.MuiThemeProvider, {
50
+ theme: muiThemeUpdated
51
+ }, /*#__PURE__*/_react.default.createElement(Component, _extends({
52
+ classes: classes
53
+ }, props))) : /*#__PURE__*/_react.default.createElement(Component, _extends({
54
+ classes: classes
55
+ }, props));
56
+ };
53
57
  ThemedComponent.propTypes = {
54
58
  Component: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.func]),
55
- retrieveStyle: _propTypes.func,
59
+ muiTheme: _propTypes.object,
56
60
  retrieveMuiTheme: _propTypes.func,
57
- theme: _propTypes.object,
58
- muiTheme: _propTypes.object
61
+ retrieveStyle: _propTypes.func,
62
+ theme: _propTypes.object
59
63
  };
60
64
  var _default = ThemedComponent;
61
65
  exports.default = _default;
@@ -37,6 +37,10 @@ $switch-hover: rgba(1, 1, 1, 0.07);
37
37
  $switch-active: rgba(1, 1, 1, 0.17);
38
38
  $switch-gray: #CCC;
39
39
  $switch-gray-hover: rgba(180, 180, 180, 1);
40
+ $button-primary: #2B70FB;
41
+ $button-secondary: #1A58D5;
42
+ $button-tertiary: #E9F0FD;
43
+ $button-shadow: #C9DBFE;
40
44
  $image-radio-background: #E5E5E5;
41
45
  $image-radio-background-hover: darken(#E5E5E5, 10%);
42
46
  $green: #02E700;
@@ -85,6 +89,10 @@ $card-background: #FAFAFA;
85
89
  switchActive: $switch-active;
86
90
  switchGray: $switch-gray;
87
91
  switchGrayHover: $switch-gray-hover;
92
+ buttonPrimary: $button-primary;
93
+ buttonSecodary: $button-secondary;
94
+ buttonTertiary: $button-tertiary;
95
+ buttonShadow: $button-shadow;
88
96
  imageRadioBackground: $image-radio-background;
89
97
  imageRadioBackgroundHover: $image-radio-background-hover;
90
98
  ratingStarSelected: $rating-star-selected;
package/dist/theme.js CHANGED
@@ -3,10 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.EnergyThemeProvider = exports.EnergyThemeConsumer = void 0;
6
+ exports.manager = exports.EnergyThemeProvider = exports.EnergyThemeConsumer = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _jss = require("jss");
8
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
10
  var ThemeContext = /*#__PURE__*/_react.default.createContext({});
11
+ var manager = new _jss.SheetsManager();
12
+ exports.manager = manager;
10
13
  var EnergyThemeProvider = ThemeContext.Provider,
11
14
  EnergyThemeConsumer = ThemeContext.Consumer;
12
15
  exports.EnergyThemeConsumer = EnergyThemeConsumer;
@@ -44,7 +44,7 @@ var fieldType = (0, _propTypes.shape)({
44
44
  required_message: _propTypes.string,
45
45
  key: _propTypes.string,
46
46
  field_options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
47
- name: _propTypes.string.isRequired,
47
+ name: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.node]),
48
48
  id: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number]).isRequired,
49
49
  key: _propTypes.string,
50
50
  value: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number])
@@ -57,10 +57,10 @@ var fieldType = (0, _propTypes.shape)({
57
57
  normalize: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.arrayOf)(_propTypes.func)]),
58
58
  form_id: _propTypes.number,
59
59
  child_keys: _propTypes.string,
60
- visibility_parent_field_key_id: _propTypes.string,
60
+ visibility_parent_field_key_id: _propTypes.number,
61
61
  visibility_parent_field_option_value_id: (0, _propTypes.oneOfType)([_propTypes.number, (0, _propTypes.arrayOf)(_propTypes.number)]),
62
62
  visibility_parent_field_option_values: _propTypes.array,
63
- visibility_toggleable_field_id: _propTypes.string,
63
+ visibility_toggleable_field_id: _propTypes.number,
64
64
  visibility_toggleable_field_value: _propTypes.string,
65
65
  read_only: _propTypes.bool,
66
66
  default_value: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.bool, _propTypes.number]),
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.mergeClasses = void 0;
6
+ exports.withImportant = exports.mergeClasses = void 0;
7
7
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
8
  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."); }
9
9
  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); }
@@ -15,8 +15,12 @@ var mergeClasses = function mergeClasses(themeClasses, classNames) {
15
15
  var classes = {};
16
16
  var allClassNames = [].concat(_toConsumableArray(Object.keys(classNames)), _toConsumableArray(Object.keys(themeClasses)));
17
17
  allClassNames.forEach(function (name) {
18
- classes[name] = "".concat(themeClasses[name], " ").concat(classNames[name]);
18
+ classes[name] = "".concat(themeClasses[name] || '', " ").concat(classNames[name] || '').trim();
19
19
  });
20
20
  return classes;
21
21
  };
22
- exports.mergeClasses = mergeClasses;
22
+ exports.mergeClasses = mergeClasses;
23
+ var withImportant = function withImportant(style) {
24
+ return style && "".concat(style, " !important");
25
+ };
26
+ exports.withImportant = withImportant;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getShadow = void 0;
7
+ var defaultOrientation = 'bottom';
8
+ var defaultLevel = 1;
9
+ var levels = {
10
+ 1: 6,
11
+ 2: 12,
12
+ 3: 24
13
+ };
14
+ var orientations = {
15
+ bottom: {
16
+ 1: 3,
17
+ 2: 6,
18
+ 3: 24
19
+ },
20
+ center: {
21
+ 1: 0,
22
+ 2: 0,
23
+ 3: 0
24
+ },
25
+ top: {
26
+ 1: -3,
27
+ 2: -6,
28
+ 3: -24
29
+ }
30
+ };
31
+ var getShadow = function getShadow(_ref) {
32
+ var color = _ref.color,
33
+ level = _ref.level,
34
+ orientation = _ref.orientation;
35
+ var shadowLevel = levels[level] || levels[defaultLevel];
36
+ var shadowOrientation = orientations[orientation] || orientations[defaultOrientation];
37
+ var shadowOrientationLevel = shadowOrientation[level] || shadowOrientation[defaultLevel];
38
+ return "0 ".concat(shadowOrientationLevel, "px ").concat(shadowLevel, "px 0 ").concat(color, "1a");
39
+ };
40
+ exports.getShadow = getShadow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "1.134.2",
3
+ "version": "2.0.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",
@@ -40,14 +40,16 @@
40
40
  "emojilib": "3.0.5",
41
41
  "node-sass": "^4.9.0",
42
42
  "numeral": "^2.0.6",
43
+ "object-hash": "^3.0.0",
43
44
  "react-google-maps": ">=9.2.2",
44
45
  "react-google-recaptcha": "^1.0.1",
45
46
  "react-jss": "^8.6.1",
46
- "react-markdown": "^5.0.1",
47
+ "react-markdown": "^7.1.0",
47
48
  "react-perfect-scrollbar": "^1.5.3",
48
49
  "react-transition-group": "^4.2.2",
49
50
  "react-window": "^1.8.5",
50
- "remark-breaks": "^2.0.1",
51
+ "rehype-raw": "^6.1.0",
52
+ "remark-breaks": "^3.0.2",
51
53
  "sass-loader": "^7.0.3",
52
54
  "seamless-immutable": "^7.1.4"
53
55
  },
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _propTypes = require("prop-types");
9
- var _UTButton = _interopRequireDefault(require("../../../UTButton"));
10
- var _types = require("../../types");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
- var ActionButton = function ActionButton(_ref) {
14
- var button = _ref.button,
15
- className = _ref.className,
16
- defaultText = _ref.defaultText,
17
- ButtonComponent = _ref.ButtonComponent;
18
- var Component = ButtonComponent || _UTButton.default;
19
- return /*#__PURE__*/_react.default.isValidElement(button) ? /*#__PURE__*/_react.default.cloneElement(button, {
20
- className: className
21
- }) : /*#__PURE__*/_react.default.createElement(Component, _extends({
22
- loading: button.loading,
23
- onPress: button.onPress,
24
- disabled: button.disabled,
25
- className: "".concat(className, " ").concat(button.className)
26
- }, button.config), button.text || defaultText);
27
- };
28
- ActionButton.propTypes = {
29
- button: _types.dialogButtonPropTypes,
30
- className: _propTypes.string,
31
- defaultText: _propTypes.string,
32
- ButtonComponent: (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.elementType, _propTypes.node, _propTypes.func])
33
- };
34
- var _default = ActionButton;
35
- exports.default = _default;
@@ -1,3 +0,0 @@
1
- .link {
2
- color: inherit;
3
- }