@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
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.VARIANTS = exports.SIZES = exports.ICON_PLACEMENTS = exports.DEFAULT_PROPS = exports.COLORS_MAPPER = void 0;
7
+ var VARIANTS = {
8
+ filled: 'contained',
9
+ outlined: 'outlined',
10
+ semitransparent: 'contained',
11
+ text: 'text',
12
+ shadow: 'text'
13
+ };
14
+ exports.VARIANTS = VARIANTS;
15
+ var SIZES = {
16
+ small: 'small',
17
+ medium: 'medium',
18
+ large: 'large'
19
+ };
20
+ exports.SIZES = SIZES;
21
+ var ICON_PLACEMENTS = {
22
+ left: 'left',
23
+ right: 'right'
24
+ };
25
+ exports.ICON_PLACEMENTS = ICON_PLACEMENTS;
26
+ var DEFAULT_PROPS = {
27
+ colorTheme: 'secondary',
28
+ disabled: false,
29
+ hideTextOnResponsive: false,
30
+ iconPlacement: ICON_PLACEMENTS.left,
31
+ loading: false,
32
+ size: SIZES.medium,
33
+ variant: 'filled'
34
+ };
35
+ exports.DEFAULT_PROPS = DEFAULT_PROPS;
36
+ var COLORS_MAPPER = {
37
+ primary: 'accent',
38
+ secondary: 'neutral',
39
+ error: 'error',
40
+ negative: 'negative'
41
+ };
42
+ exports.COLORS_MAPPER = COLORS_MAPPER;
@@ -6,100 +6,80 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _propTypes = require("prop-types");
10
9
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
11
10
  var _CircularProgress = _interopRequireDefault(require("@material-ui/core/CircularProgress"));
11
+ var _propTypes = require("prop-types");
12
12
  var _WithTheme = _interopRequireDefault(require("../WithTheme"));
13
+ var _classesUtils = require("../../utils/classesUtils");
14
+ var _constants = require("./constants");
13
15
  var _theme = require("./theme");
16
+ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
17
+ var _excluded = ["childrenContainer", "circularProgress", "icon", "leftIcon", "rightIcon"];
14
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
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); }
16
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; }
17
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
- 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); } }
19
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
22
- 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); }
23
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
24
- 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); }; }
25
- 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); }
26
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27
- 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; } }
28
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
- var UTButton = /*#__PURE__*/function (_PureComponent) {
30
- _inherits(UTButton, _PureComponent);
31
- var _super = _createSuper(UTButton);
32
- function UTButton() {
33
- _classCallCheck(this, UTButton);
34
- return _super.apply(this, arguments);
35
- }
36
- _createClass(UTButton, [{
37
- key: "render",
38
- value: function render() {
39
- var _this$props = this.props,
40
- text = _this$props.text,
41
- fab = _this$props.fab,
42
- outlined = _this$props.outlined,
43
- extendedFab = _this$props.extendedFab,
44
- type = _this$props.type,
45
- onPress = _this$props.onPress,
46
- disabled = _this$props.disabled,
47
- loading = _this$props.loading,
48
- small = _this$props.small,
49
- large = _this$props.large,
50
- lowercase = _this$props.lowercase,
51
- uppercase = _this$props.uppercase,
52
- classes = _this$props.classes,
53
- className = _this$props.className,
54
- children = _this$props.children,
55
- autoFocus = _this$props.autoFocus,
56
- style = _this$props.style,
57
- secondary = _this$props.secondary,
58
- alternative = _this$props.alternative,
59
- gray = _this$props.gray;
60
- var size = small ? 'small' : large ? 'large' : 'medium';
61
- return /*#__PURE__*/_react.default.createElement(_Button.default, {
62
- type: type,
63
- size: size,
64
- autoFocus: autoFocus,
65
- style: style,
66
- variant: text ? 'text' : fab ? 'fab' : extendedFab ? 'extendedFab' : outlined ? 'outlined' : 'contained',
67
- disabled: disabled || loading,
68
- onClick: onPress,
69
- classes: {
70
- root: "".concat(small ? classes.small : large && classes.large, " ").concat(uppercase ? classes.uppercase : lowercase && classes.lowercase, " ").concat(className),
71
- label: classes.labelFullWidth,
72
- contained: "".concat(classes.base, " ").concat(secondary && classes.secondary, " ").concat(alternative && classes.alternative, " ").concat(gray && classes.gray),
73
- text: "".concat(classes.baseText, " ").concat(secondary && classes.secondaryText, " ").concat(alternative && classes.alternativeText, " ").concat(gray && classes.grayText),
74
- outlined: "".concat(classes.baseOutlined, " ").concat(secondary && classes.secondaryOutlined, " ").concat(alternative && classes.alternativeOutlined, " ").concat(gray && classes.grayOutlined)
75
- }
76
- }, children, loading && /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
77
- size: 24,
78
- className: classes["loading".concat(outlined ? 'Outlined' : text ? 'Text' : '')]
79
- }));
80
- }
81
- }]);
82
- return UTButton;
83
- }(_react.PureComponent);
21
+ 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; }
22
+ 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; }
23
+ var UTButton = function UTButton(_ref) {
24
+ var children = _ref.children,
25
+ theme = _ref.classes,
26
+ classNames = _ref.classNames,
27
+ disabled = _ref.disabled,
28
+ hideTextOnResponsive = _ref.hideTextOnResponsive,
29
+ Icon = _ref.Icon,
30
+ iconPlacement = _ref.iconPlacement,
31
+ loading = _ref.loading,
32
+ onClick = _ref.onClick,
33
+ size = _ref.size,
34
+ style = _ref.style,
35
+ type = _ref.type,
36
+ variant = _ref.variant;
37
+ var classes = (0, _react.useMemo)(function () {
38
+ return (0, _classesUtils.mergeClasses)(theme, classNames);
39
+ });
40
+ var childrenContainer = classes.childrenContainer,
41
+ circularProgress = classes.circularProgress,
42
+ icon = classes.icon,
43
+ leftIcon = classes.leftIcon,
44
+ rightIcon = classes.rightIcon,
45
+ materialButtonClasses = _objectWithoutProperties(classes, _excluded);
46
+ var RenderedChildren = /*#__PURE__*/_react.default.createElement("div", {
47
+ className: "\n ".concat(childrenContainer, "\n ").concat(_stylesModule.default.childrenContainer, "\n ").concat(hideTextOnResponsive && _stylesModule.default.hideTextOnResponsive, "\n ").concat(!children && _stylesModule.default.withoutText, "\n ")
48
+ }, iconPlacement === _constants.ICON_PLACEMENTS.left && Icon && /*#__PURE__*/_react.default.createElement(Icon, {
49
+ className: "".concat(icon, " ").concat(leftIcon, " ").concat(_stylesModule.default.icon)
50
+ }), children && /*#__PURE__*/_react.default.createElement("div", {
51
+ className: "".concat(_stylesModule.default.text, " ").concat(classes.text)
52
+ }, children), iconPlacement !== _constants.ICON_PLACEMENTS.left && Icon && /*#__PURE__*/_react.default.createElement(Icon, {
53
+ className: "".concat(icon, " ").concat(rightIcon, " ").concat(_stylesModule.default.icon)
54
+ }));
55
+ return /*#__PURE__*/_react.default.createElement(_Button.default, {
56
+ disabled: disabled || loading,
57
+ classes: materialButtonClasses,
58
+ onClick: onClick,
59
+ size: size,
60
+ variant: _constants.VARIANTS[variant],
61
+ type: type,
62
+ style: style
63
+ }, RenderedChildren, loading && /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
64
+ size: 24,
65
+ className: "".concat(_stylesModule.default.loading, " ").concat(circularProgress)
66
+ }));
67
+ };
68
+ UTButton.defaultProps = _constants.DEFAULT_PROPS;
84
69
  UTButton.propTypes = {
85
- text: _propTypes.bool,
86
- small: _propTypes.bool,
87
- large: _propTypes.bool,
88
- outlined: _propTypes.bool,
89
- secondary: _propTypes.bool,
90
- alternative: _propTypes.bool,
91
- gray: _propTypes.bool,
92
- fab: _propTypes.bool,
93
- extendedFab: _propTypes.bool,
70
+ classes: (0, _propTypes.objectOf)(_propTypes.string),
71
+ classNames: (0, _propTypes.objectOf)(_propTypes.string),
94
72
  disabled: _propTypes.bool,
73
+ hideTextOnResponsive: _propTypes.bool,
74
+ Icon: _propTypes.elementType,
75
+ iconPlacement: _propTypes.string,
95
76
  loading: _propTypes.bool,
96
- uppercase: _propTypes.bool,
97
- lowercase: _propTypes.bool,
98
- autoFocus: _propTypes.bool,
77
+ onClick: _propTypes.func,
78
+ size: _propTypes.string,
79
+ // TODO: this "style" prop is for compatibility with the -base project only. Delete it when no longer needed
80
+ style: _propTypes.object,
99
81
  type: _propTypes.string,
100
- onPress: _propTypes.func,
101
- classes: (0, _propTypes.objectOf)(_propTypes.string),
102
- className: _propTypes.string
82
+ variant: _propTypes.string
103
83
  };
104
84
  var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTButton);
105
85
  exports.default = _default;
@@ -0,0 +1,36 @@
1
+ @import '../../scss/variables/mediaQueries';
2
+
3
+ .hideTextOnResponsive {
4
+ @media #{$mobile} {
5
+ .text {
6
+ display: none;
7
+ }
8
+
9
+ .icon {
10
+ margin: 0 -4px;
11
+ }
12
+ }
13
+ }
14
+
15
+ .icon {
16
+ flex-shrink: 0;
17
+ font-size: 24px;
18
+ height: 24px;
19
+ width: 24px;
20
+ }
21
+
22
+ .withoutText {
23
+ .icon {
24
+ margin: 0 -4px;
25
+ }
26
+ }
27
+
28
+ .childrenContainer {
29
+ align-items: center;
30
+ display: flex;
31
+ justify-content: flex-start;
32
+ }
33
+
34
+ .loading {
35
+ position: absolute;
36
+ }
@@ -3,185 +3,170 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.retrieveStyle = void 0;
7
- var _seamlessImmutable = require("seamless-immutable");
8
- var _colors = _interopRequireDefault(require("../../scss/variables/_colors.scss"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- var retrieveStyle = function retrieveStyle(theme) {
11
- return {
12
- base: {
13
- textTransform: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'textTransform'], 'none'),
14
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'backgroundColor']),
15
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'borderRadius']),
16
- boxShadow: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'boxShadow']),
17
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'color']),
18
- fontFamily: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'fontFamily']),
19
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'fontSize'], (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'medium'])),
20
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'fontWeight']),
21
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'padding']),
6
+ exports.variantsColorTheme = exports.retrieveStyle = void 0;
7
+ var _classesUtils = require("../../utils/classesUtils");
8
+ var _shadowUtils = require("../../utils/shadowUtils");
9
+ var _constants = require("./constants");
10
+ 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
+ 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; }
12
+ 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; }
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
+ var variantsColorTheme = function variantsColorTheme(theme, colorTheme, variant) {
17
+ var actionColorName = _constants.COLORS_MAPPER[colorTheme] || _constants.COLORS_MAPPER[_constants.DEFAULT_PROPS.colorTheme];
18
+ var actionTheme = theme.Palette.actions[actionColorName];
19
+ var negativeTheme = theme.Palette.actions[_constants.COLORS_MAPPER.negative];
20
+ var neutralTheme = theme.Palette.actions[_constants.COLORS_MAPPER.secondary];
21
+ var definition = {
22
+ filled: {
23
+ backgroundColor: actionTheme['04'],
24
+ border: '1px solid transparent',
25
+ color: colorTheme === _constants.COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05'],
26
+ fill: colorTheme === _constants.COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05'],
22
27
  '&:hover': {
23
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'hover', 'backgroundColor']),
24
- boxShadow: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'base', 'hover', 'boxShadow'])
28
+ backgroundColor: actionTheme['03'],
29
+ boxShadow: (0, _shadowUtils.getShadow)({
30
+ color: actionTheme['04'],
31
+ level: 2
32
+ })
25
33
  },
26
- '&:disabled': {
27
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabled', 'backgroundColor']),
28
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabled', 'color']),
29
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabled', 'padding'])
30
- }
31
- },
32
- baseText: {
33
- textTransform: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'textTransform'], 'none'),
34
- backgroundColor: _colors.default.transparent,
35
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'borderRadius']),
36
- boxShadow: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'boxShadow']),
37
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'color']),
38
- fontFamily: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'fontFamily']),
39
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'fontSize'], (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'medium'])),
40
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'fontWeight']),
41
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'padding']),
42
- '&:hover': {
43
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'hover', 'backgroundColor']),
44
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseText', 'hover', 'color'])
34
+ '&:active': {
35
+ backgroundColor: actionTheme['05'],
36
+ boxShadow: (0, _shadowUtils.getShadow)({
37
+ color: actionTheme['04'],
38
+ level: 2
39
+ })
45
40
  },
46
- '&:disabled': {
47
- backgroundColor: _colors.default.transparent,
48
- borderColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledText', 'borderColor']),
49
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledText', 'color']),
50
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledText', 'padding'])
41
+ disabled: {
42
+ color: (0, _classesUtils.withImportant)(colorTheme === _constants.COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05']),
43
+ backgroundColor: (0, _classesUtils.withImportant)(actionTheme['04']),
44
+ opacity: (0, _classesUtils.withImportant)(0.5)
51
45
  }
52
46
  },
53
- baseOutlined: {
54
- textTransform: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'textTransform'], 'none'),
55
- backgroundColor: _colors.default.transparent,
56
- border: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'border']),
57
- borderColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'borderColor']),
58
- borderRadius: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'borderRadius']),
59
- boxShadow: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'boxShadow']),
60
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'color']),
61
- fontFamily: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'fontFamily']),
62
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'fontSize'], (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'medium'])),
63
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'fontWeight']),
64
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'padding']),
65
- '&:hover': {
66
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'hover', 'backgroundColor']),
67
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'baseOutlined', 'hover', 'color'])
68
- },
69
- '&:disabled': {
70
- backgroundColor: _colors.default.transparent,
71
- border: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledOutlined', 'border']),
72
- borderColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledOutlined', 'borderColor']),
73
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledOutlined', 'color']),
74
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'disabledOutlined', 'padding'])
75
- }
76
- },
77
- secondary: {
78
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondary', 'backgroundColor']),
79
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondary', 'color']),
80
- '&:hover': {
81
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondary', 'hover', 'backgroundColor'])
82
- },
83
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondary', 'padding'])
84
- },
85
- secondaryText: {
86
- backgroundColor: _colors.default.transparent,
87
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryText', 'color']),
47
+ semitransparent: {
48
+ backgroundColor: actionTheme['01'],
49
+ border: '1px solid transparent',
50
+ color: actionTheme['05'],
51
+ fill: actionTheme['05'],
88
52
  '&:hover': {
89
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryText', 'hover', 'backgroundColor'])
53
+ backgroundColor: actionTheme['02']
90
54
  },
91
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryText', 'padding'])
92
- },
93
- secondaryOutlined: {
94
- backgroundColor: _colors.default.transparent,
95
- border: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryOutlined', 'border']),
96
- borderColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryOutlined', 'borderColor']),
97
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryOutlined', 'color']),
98
- '&:hover': {
99
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryOutlined', 'hover', 'backgroundColor'])
55
+ '&:active': {
56
+ backgroundColor: actionTheme['03']
100
57
  },
101
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'secondaryOutlined', 'padding'])
58
+ disabled: {
59
+ color: (0, _classesUtils.withImportant)(actionTheme['05']),
60
+ opacity: (0, _classesUtils.withImportant)(0.5)
61
+ }
102
62
  },
103
- alternative: {
104
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternative', 'backgroundColor']),
105
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternative', 'color']),
63
+ outlined: {
64
+ border: "1px solid ".concat(actionTheme['05']),
65
+ color: actionTheme['05'],
66
+ fill: actionTheme['05'],
106
67
  '&:hover': {
107
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternative', 'hover', 'backgroundColor'])
68
+ backgroundColor: actionTheme['01']
108
69
  },
109
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternative', 'padding'])
110
- },
111
- alternativeText: {
112
- backgroundColor: _colors.default.transparent,
113
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeText', 'color']),
114
- '&:hover': {
115
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeText', 'hover', 'backgroundColor'])
70
+ '&:active': {
71
+ backgroundColor: actionTheme['02']
116
72
  },
117
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeText', 'padding'])
73
+ disabled: {
74
+ border: (0, _classesUtils.withImportant)("1px solid ".concat(actionTheme['05'])),
75
+ color: (0, _classesUtils.withImportant)(actionTheme['05']),
76
+ opacity: (0, _classesUtils.withImportant)(0.5)
77
+ }
118
78
  },
119
- alternativeOutlined: {
120
- backgroundColor: _colors.default.transparent,
121
- border: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeOutlined', 'border']),
122
- borderColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeOutlined', 'borderColor']),
123
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeOutlined', 'color']),
79
+ text: {
80
+ border: '1px solid transparent',
81
+ color: actionTheme['05'],
82
+ fill: actionTheme['05'],
124
83
  '&:hover': {
125
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeOutlined', 'hover', 'backgroundColor'])
84
+ backgroundColor: actionTheme['01']
126
85
  },
127
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'alternativeOutlined', 'padding'])
128
- },
129
- gray: {
130
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'gray', 'backgroundColor']),
131
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'gray', 'color']),
132
- '&:hover': {
133
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'gray', 'hover', 'backgroundColor'])
86
+ '&:active': {
87
+ backgroundColor: actionTheme['02']
134
88
  },
135
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'gray', 'padding'])
89
+ disabled: {
90
+ color: (0, _classesUtils.withImportant)(actionTheme['05']),
91
+ opacity: (0, _classesUtils.withImportant)(0.5)
92
+ }
136
93
  },
137
- grayText: {
138
- backgroundColor: _colors.default.transparent,
139
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayText', 'color']),
94
+ shadow: {
95
+ backgroundColor: colorTheme === _constants.COLORS_MAPPER.negative ? neutralTheme['05'] : negativeTheme['05'],
96
+ boxShadow: (0, _shadowUtils.getShadow)({
97
+ color: actionTheme['04'],
98
+ level: 1
99
+ }),
100
+ border: '1px solid transparent',
101
+ color: actionTheme['05'],
102
+ fill: actionTheme['05'],
140
103
  '&:hover': {
141
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayText', 'hover', 'backgroundColor'])
104
+ backgroundColor: actionTheme['01'],
105
+ boxShadow: (0, _shadowUtils.getShadow)({
106
+ color: actionTheme['04'],
107
+ level: 2
108
+ })
142
109
  },
143
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayText', 'padding'])
144
- },
145
- grayOutlined: {
146
- backgroundColor: _colors.default.transparent,
147
- border: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayOutlined', 'border']),
148
- borderColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayOutlined', 'borderColor']),
149
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayOutlined', 'color']),
150
- '&:hover': {
151
- backgroundColor: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayOutlined', 'hover', 'backgroundColor'])
110
+ '&:active': {
111
+ backgroundColor: actionTheme['02'],
112
+ boxShadow: (0, _shadowUtils.getShadow)({
113
+ color: actionTheme['04'],
114
+ level: 2
115
+ })
152
116
  },
153
- padding: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'grayOutlined', 'padding'])
154
- },
155
- small: {
156
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'small'])
157
- },
158
- large: {
159
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'large'])
160
- },
161
- lowercase: {
162
- textTransform: 'lowercase'
163
- },
164
- uppercase: {
165
- textTransform: 'uppercase'
166
- },
167
- labelFullWidth: {
168
- width: '100%'
169
- },
170
- loading: {
171
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'loading', 'color']),
172
- position: 'absolute',
173
- left: 'calc(50% - 12px)'
174
- },
175
- loadingText: {
176
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'loadingText', 'color'], (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'loading', 'color'])),
177
- position: 'absolute',
178
- left: 'calc(50% - 12px)'
179
- },
180
- loadingOutlined: {
181
- color: (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'loadingOutlined', 'color'], (0, _seamlessImmutable.getIn)(theme, ['UTButton', 'loading', 'color'])),
182
- position: 'absolute',
183
- left: 'calc(50% - 12px)'
117
+ disabled: {
118
+ color: (0, _classesUtils.withImportant)(actionTheme['05']),
119
+ opacity: (0, _classesUtils.withImportant)(0.5)
120
+ }
184
121
  }
185
122
  };
123
+ return definition[variant] || definition[_constants.DEFAULT_PROPS.variant];
124
+ };
125
+ exports.variantsColorTheme = variantsColorTheme;
126
+ var baseButtonTheme = function baseButtonTheme(theme) {
127
+ var _theme$UTButton, _theme$UTButton$circu;
128
+ return {
129
+ root: {
130
+ borderRadius: 4,
131
+ boxShadow: (0, _classesUtils.withImportant)('none'),
132
+ fontSize: '1rem',
133
+ fontWeight: '500',
134
+ lineHeight: '1.375rem',
135
+ minWidth: 'auto',
136
+ padding: '8px 12px',
137
+ textTransform: 'none',
138
+ transition: 'background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms'
139
+ },
140
+ sizeLarge: {
141
+ fontSize: '1rem',
142
+ fontWeight: '500',
143
+ padding: '12px 16px'
144
+ },
145
+ sizeSmall: {
146
+ fontSize: '1rem',
147
+ fontWeight: '500',
148
+ padding: '4px 8px'
149
+ },
150
+ leftIcon: {
151
+ marginRight: '8px'
152
+ },
153
+ rightIcon: {
154
+ marginLeft: '8px'
155
+ },
156
+ circularProgress: {
157
+ color: ((_theme$UTButton = theme.UTButton) === null || _theme$UTButton === void 0 ? void 0 : (_theme$UTButton$circu = _theme$UTButton.circularProgress) === null || _theme$UTButton$circu === void 0 ? void 0 : _theme$UTButton$circu.color) || '484848'
158
+ }
159
+ };
160
+ };
161
+ var retrieveStyle = function retrieveStyle(_ref) {
162
+ var colorTheme = _ref.colorTheme,
163
+ variant = _ref.variant,
164
+ theme = _ref.theme;
165
+ var baseTheme = baseButtonTheme(theme);
166
+ var variantTheme = variantsColorTheme(theme, colorTheme, variant);
167
+ return _objectSpread(_objectSpread({}, baseTheme), {}, {
168
+ disabled: variantTheme.disabled,
169
+ root: _objectSpread(_objectSpread({}, baseTheme.root), variantTheme)
170
+ });
186
171
  };
187
172
  exports.retrieveStyle = retrieveStyle;
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.retrieveStyle = void 0;
7
7
  var _seamlessImmutable = require("seamless-immutable");
8
- var retrieveStyle = function retrieveStyle(theme) {
8
+ var retrieveStyle = function retrieveStyle(_ref) {
9
+ var theme = _ref.theme;
9
10
  return {
10
11
  helper: {
11
12
  color: (0, _seamlessImmutable.getIn)(theme, ['UTCBUInput', 'helper', 'color'])
@@ -21,12 +21,11 @@ var UTCardFooter = function UTCardFooter(_ref) {
21
21
  }, footer.map(function (button) {
22
22
  return /*#__PURE__*/_react.default.createElement(Button, _extends({
23
23
  key: button.name,
24
- className: "".concat(_stylesModule.default.button, " ").concat(button.className)
25
- }, button), button.disabled ? button.DisabledIcon && /*#__PURE__*/_react.default.createElement(button.DisabledIcon, {
26
- className: button.iconClassName
27
- }) : button.Icon && /*#__PURE__*/_react.default.createElement(button.Icon, {
28
- className: button.iconClassName
29
- }), button.name);
24
+ classNames: {
25
+ root: "".concat(_stylesModule.default.button, " ").concat(button.className),
26
+ icon: button.iconClassName
27
+ }
28
+ }, button), button.name);
30
29
  }));
31
30
  };
32
31
  UTCardFooter.propTypes = {