@widergy/energy-ui 1.128.2 → 1.130.1
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.
- package/CHANGELOG.md +21 -0
- package/dist/components/UTAvatar/constants.js +83 -0
- package/dist/components/UTAvatar/index.js +50 -0
- package/dist/components/UTCard/index.js +35 -27
- package/dist/components/UTCarousel/components/Slider/index.js +15 -0
- package/dist/index.js +16 -0
- package/dist/utils/componentUtils.js +26 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [1.130.1](https://github.com/widergy/energy-ui/compare/v1.130.0...v1.130.1) (2022-08-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* banners filter ([#306](https://github.com/widergy/energy-ui/issues/306)) ([d2fc3bb](https://github.com/widergy/energy-ui/commit/d2fc3bb020cb60f2c5a932916b8ccf2f1dd93941))
|
|
7
|
+
|
|
8
|
+
# [1.130.0](https://github.com/widergy/energy-ui/compare/v1.129.0...v1.130.0) (2022-08-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* migrated UTAvatar to library ([#302](https://github.com/widergy/energy-ui/issues/302)) ([1070f65](https://github.com/widergy/energy-ui/commit/1070f65417f76a992be82042c5f34b8e84817489))
|
|
14
|
+
|
|
15
|
+
# [1.129.0](https://github.com/widergy/energy-ui/compare/v1.128.2...v1.129.0) (2022-08-22)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* added expand text to utcard ([#305](https://github.com/widergy/energy-ui/issues/305)) ([b559030](https://github.com/widergy/energy-ui/commit/b5590305db4a309a56d6a7546854ebf2c6749bf6))
|
|
21
|
+
|
|
1
22
|
## [1.128.2](https://github.com/widergy/energy-ui/compare/v1.128.1...v1.128.2) (2022-08-17)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultPalette = void 0;
|
|
7
|
+
var defaultPalette = [{
|
|
8
|
+
backgroundColor: 'rgb(0, 0, 180)',
|
|
9
|
+
color: '#FFF'
|
|
10
|
+
}, {
|
|
11
|
+
backgroundColor: 'rgb(175, 13, 102)',
|
|
12
|
+
color: '#FFF'
|
|
13
|
+
}, {
|
|
14
|
+
backgroundColor: 'rgb(146,248,70)',
|
|
15
|
+
color: '#000'
|
|
16
|
+
}, {
|
|
17
|
+
backgroundColor: 'rgb(255, 200, 47)',
|
|
18
|
+
color: '#000'
|
|
19
|
+
}, {
|
|
20
|
+
backgroundColor: 'rgb(255,118,0)',
|
|
21
|
+
color: '#000'
|
|
22
|
+
}, {
|
|
23
|
+
backgroundColor: 'rgb(0, 0, 180)',
|
|
24
|
+
color: '#000'
|
|
25
|
+
}, {
|
|
26
|
+
backgroundColor: 'rgb(235,235,222)',
|
|
27
|
+
color: '#000'
|
|
28
|
+
}, {
|
|
29
|
+
backgroundColor: 'rgb(100,100,100)',
|
|
30
|
+
color: '#FFF'
|
|
31
|
+
}, {
|
|
32
|
+
backgroundColor: 'rgb(255,255,0)',
|
|
33
|
+
color: '#000'
|
|
34
|
+
}, {
|
|
35
|
+
backgroundColor: 'rgb(55,19,112)',
|
|
36
|
+
color: '#FFF'
|
|
37
|
+
}, {
|
|
38
|
+
backgroundColor: 'rgb(255,255,150)',
|
|
39
|
+
color: '#000'
|
|
40
|
+
}, {
|
|
41
|
+
backgroundColor: 'rgb(202,62,94)',
|
|
42
|
+
color: '#FFF'
|
|
43
|
+
}, {
|
|
44
|
+
backgroundColor: 'rgb(205,145,63)',
|
|
45
|
+
color: '#000'
|
|
46
|
+
}, {
|
|
47
|
+
backgroundColor: 'rgb(12,75,100)',
|
|
48
|
+
color: '#FFF'
|
|
49
|
+
}, {
|
|
50
|
+
backgroundColor: 'rgb(175,155,50)',
|
|
51
|
+
color: '#000'
|
|
52
|
+
}, {
|
|
53
|
+
backgroundColor: '#000',
|
|
54
|
+
color: '#FFF'
|
|
55
|
+
}, {
|
|
56
|
+
backgroundColor: 'rgb(37,70,25)',
|
|
57
|
+
color: '#FFF'
|
|
58
|
+
}, {
|
|
59
|
+
backgroundColor: 'rgb(121,33,135)',
|
|
60
|
+
color: '#FFF'
|
|
61
|
+
}, {
|
|
62
|
+
backgroundColor: 'rgb(83,140,208)',
|
|
63
|
+
color: '#FFF'
|
|
64
|
+
}, {
|
|
65
|
+
backgroundColor: 'rgb(0,154,37)',
|
|
66
|
+
color: '#000'
|
|
67
|
+
}, {
|
|
68
|
+
backgroundColor: 'rgb(178,220,205)',
|
|
69
|
+
color: '#000'
|
|
70
|
+
}, {
|
|
71
|
+
backgroundColor: 'rgb(255,152,213)',
|
|
72
|
+
color: '#000'
|
|
73
|
+
}, {
|
|
74
|
+
backgroundColor: 'rgb(0,0,74)',
|
|
75
|
+
color: '#FFF'
|
|
76
|
+
}, {
|
|
77
|
+
backgroundColor: 'rgb(175,200,74)',
|
|
78
|
+
color: '#000'
|
|
79
|
+
}, {
|
|
80
|
+
backgroundColor: 'rgb(63,25,12)',
|
|
81
|
+
color: '#FF'
|
|
82
|
+
}];
|
|
83
|
+
exports.defaultPalette = defaultPalette;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("prop-types");
|
|
13
|
+
|
|
14
|
+
var _energyUi = require("@widergy/energy-ui");
|
|
15
|
+
|
|
16
|
+
var _componentUtils = _interopRequireDefault(require("../../utils/componentUtils"));
|
|
17
|
+
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
var UTAvatar = function UTAvatar(_ref) {
|
|
23
|
+
var className = _ref.className,
|
|
24
|
+
manualColors = _ref.manualColors,
|
|
25
|
+
palette = _ref.palette,
|
|
26
|
+
userName = _ref.userName;
|
|
27
|
+
var getFirstLetter = _componentUtils.default.getFirstLetter,
|
|
28
|
+
getAvatarColors = _componentUtils.default.getAvatarColors;
|
|
29
|
+
var firstNameLetter = getFirstLetter(userName);
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_Avatar.default, {
|
|
31
|
+
className: className,
|
|
32
|
+
style: manualColors ? {} : getAvatarColors(userName, palette || _constants.defaultPalette)
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_energyUi.UTLabel, {
|
|
34
|
+
bold: true,
|
|
35
|
+
xxxlarge: true,
|
|
36
|
+
style: manualColors ? {} : getAvatarColors(userName, palette || _constants.defaultPalette)
|
|
37
|
+
}, firstNameLetter));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
UTAvatar.propTypes = {
|
|
41
|
+
className: _propTypes.string,
|
|
42
|
+
manualColors: _propTypes.bool,
|
|
43
|
+
palette: (0, _propTypes.shape)({
|
|
44
|
+
color: _propTypes.string,
|
|
45
|
+
backgroundColor: _propTypes.string
|
|
46
|
+
}),
|
|
47
|
+
userName: _propTypes.string
|
|
48
|
+
};
|
|
49
|
+
var _default = UTAvatar;
|
|
50
|
+
exports.default = _default;
|
|
@@ -21,6 +21,8 @@ var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../UTTouchable
|
|
|
21
21
|
|
|
22
22
|
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
23
23
|
|
|
24
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
25
|
+
|
|
24
26
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
25
27
|
|
|
26
28
|
var _UTCardFooter = _interopRequireDefault(require("./components/UTCardFooter"));
|
|
@@ -126,25 +128,27 @@ var UTCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
126
128
|
var _this2 = this;
|
|
127
129
|
|
|
128
130
|
var _this$props = this.props,
|
|
129
|
-
|
|
130
|
-
footer = _this$props.footer,
|
|
131
|
+
button = _this$props.button,
|
|
131
132
|
children = _this$props.children,
|
|
132
|
-
horizontal = _this$props.horizontal,
|
|
133
|
-
className = _this$props.className,
|
|
134
|
-
isCollapsible = _this$props.isCollapsible,
|
|
135
|
-
style = _this$props.style,
|
|
136
133
|
classes = _this$props.classes,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
button = _this$props.button,
|
|
134
|
+
className = _this$props.className,
|
|
135
|
+
CustomFooter = _this$props.CustomFooter,
|
|
140
136
|
expandableContentClassName = _this$props.expandableContentClassName,
|
|
141
|
-
expandableIconClassName = _this$props.expandableIconClassName,
|
|
142
137
|
expandableIconButtonClassName = _this$props.expandableIconButtonClassName,
|
|
138
|
+
expandableIconClassName = _this$props.expandableIconClassName,
|
|
143
139
|
ExpandedIcon = _this$props.ExpandedIcon,
|
|
144
|
-
|
|
140
|
+
expandText = _this$props.expandText,
|
|
141
|
+
expandTextClassName = _this$props.expandTextClassName,
|
|
142
|
+
flat = _this$props.flat,
|
|
143
|
+
footer = _this$props.footer,
|
|
145
144
|
footerClassName = _this$props.footerClassName,
|
|
145
|
+
header = _this$props.header,
|
|
146
146
|
headerClassName = _this$props.headerClassName,
|
|
147
|
-
|
|
147
|
+
horizontal = _this$props.horizontal,
|
|
148
|
+
isCollapsible = _this$props.isCollapsible,
|
|
149
|
+
isOpen = _this$props.isOpen,
|
|
150
|
+
NonExpandedIcon = _this$props.NonExpandedIcon,
|
|
151
|
+
style = _this$props.style;
|
|
148
152
|
var _this$state = this.state,
|
|
149
153
|
expandIsSelected = _this$state.expandIsSelected,
|
|
150
154
|
childrenHeight = _this$state.childrenHeight;
|
|
@@ -173,7 +177,9 @@ var UTCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
173
177
|
}, header), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
174
178
|
onClick: this.handleOnPress,
|
|
175
179
|
className: expandableIconButtonClassName
|
|
176
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
180
|
+
}, expandText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
181
|
+
className: expandTextClassName
|
|
182
|
+
}, expandText, " "), /*#__PURE__*/_react.default.createElement(ExpandIcon, {
|
|
177
183
|
className: expandableIconClassName
|
|
178
184
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
179
185
|
ref: function ref(_ref) {
|
|
@@ -193,25 +199,27 @@ var UTCard = /*#__PURE__*/function (_PureComponent) {
|
|
|
193
199
|
}(_react.PureComponent);
|
|
194
200
|
|
|
195
201
|
UTCard.propTypes = {
|
|
196
|
-
header: _types.cardActionsTypes.header,
|
|
197
|
-
footer: _types.cardActionsTypes.footer,
|
|
198
|
-
horizontal: _propTypes.bool,
|
|
199
|
-
className: _propTypes.string,
|
|
200
|
-
isCollapsible: _propTypes.bool,
|
|
201
|
-
onClick: _propTypes.func,
|
|
202
|
-
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
203
|
-
isOpen: _propTypes.bool,
|
|
204
|
-
style: _propTypes.object,
|
|
205
|
-
flat: _propTypes.bool,
|
|
206
202
|
button: _propTypes.element,
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
204
|
+
className: _propTypes.string,
|
|
205
|
+
CustomFooter: (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.func]),
|
|
209
206
|
expandableContentClassName: _propTypes.string,
|
|
210
|
-
expandableIconClassName: _propTypes.string,
|
|
211
207
|
expandableIconButtonClassName: _propTypes.string,
|
|
208
|
+
expandableIconClassName: _propTypes.string,
|
|
209
|
+
ExpandedIcon: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.element]),
|
|
210
|
+
expandText: _propTypes.string,
|
|
211
|
+
expandTextClassName: _propTypes.string,
|
|
212
|
+
flat: _propTypes.bool,
|
|
213
|
+
footer: _types.cardActionsTypes.footer,
|
|
212
214
|
footerClassName: _propTypes.string,
|
|
215
|
+
header: _types.cardActionsTypes.header,
|
|
213
216
|
headerClassName: _propTypes.string,
|
|
214
|
-
|
|
217
|
+
horizontal: _propTypes.bool,
|
|
218
|
+
isCollapsible: _propTypes.bool,
|
|
219
|
+
isOpen: _propTypes.bool,
|
|
220
|
+
NonExpandedIcon: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.element]),
|
|
221
|
+
onClick: _propTypes.func,
|
|
222
|
+
style: _propTypes.object
|
|
215
223
|
};
|
|
216
224
|
UTCard.defaultProps = {
|
|
217
225
|
isOpen: null,
|
|
@@ -107,6 +107,14 @@ var SliderContainer = /*#__PURE__*/function (_PureComponent) {
|
|
|
107
107
|
});
|
|
108
108
|
}, _this.state.timeAnimation));
|
|
109
109
|
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "updateImgArray", function () {
|
|
111
|
+
var arr = [_this.props.slides[_this.props.slides.length - 1]].concat(_toConsumableArray(_this.props.slides), [_this.props.slides[0]]);
|
|
112
|
+
|
|
113
|
+
_this.setState({
|
|
114
|
+
slideArray: arr
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
110
118
|
_defineProperty(_assertThisInitialized(_this), "updateContainerWidth", function () {
|
|
111
119
|
return _this.setState({
|
|
112
120
|
containerWidth: _this.containerRef.current && _this.containerRef.current.clientWidth
|
|
@@ -275,6 +283,13 @@ var SliderContainer = /*#__PURE__*/function (_PureComponent) {
|
|
|
275
283
|
return _this2.handleNextSlide();
|
|
276
284
|
}, this.props.autoPlayDelay);
|
|
277
285
|
}
|
|
286
|
+
}, {
|
|
287
|
+
key: "componentDidUpdate",
|
|
288
|
+
value: function componentDidUpdate(prevProps) {
|
|
289
|
+
if (this.props.slides !== prevProps.slides) {
|
|
290
|
+
this.updateImgArray();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
278
293
|
}, {
|
|
279
294
|
key: "render",
|
|
280
295
|
value: function render() {
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "UTAutocomplete", {
|
|
|
33
33
|
return _UTAutocomplete.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "UTAvatar", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _UTAvatar.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "UTBarChart", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function get() {
|
|
@@ -303,9 +309,17 @@ Object.defineProperty(exports, "WithTouch", {
|
|
|
303
309
|
return _WithTouch.default;
|
|
304
310
|
}
|
|
305
311
|
});
|
|
312
|
+
Object.defineProperty(exports, "componentUtils", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
get: function get() {
|
|
315
|
+
return _componentUtils.default;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
306
318
|
|
|
307
319
|
var _UTAlert = _interopRequireDefault(require("./components/UTAlert"));
|
|
308
320
|
|
|
321
|
+
var _UTAvatar = _interopRequireDefault(require("./components/UTAvatar"));
|
|
322
|
+
|
|
309
323
|
var _AlertHandler = _interopRequireDefault(require("./components/UTAlert/AlertHandler"));
|
|
310
324
|
|
|
311
325
|
var _UTAutocomplete = _interopRequireDefault(require("./components/UTAutocomplete"));
|
|
@@ -404,4 +418,6 @@ var _UTEmojiPicker = _interopRequireDefault(require("./components/UTEmojiPicker"
|
|
|
404
418
|
|
|
405
419
|
var _UTBreadcrumbs = _interopRequireDefault(require("./components/UTBreadcrumbs"));
|
|
406
420
|
|
|
421
|
+
var _componentUtils = _interopRequireDefault(require("./utils/componentUtils"));
|
|
422
|
+
|
|
407
423
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var A_CHAR_CODE = 65;
|
|
8
|
+
var Z_CHAR_CODE = 90;
|
|
9
|
+
|
|
10
|
+
var getFirstLetter = function getFirstLetter(userName) {
|
|
11
|
+
return (userName === null || userName === void 0 ? void 0 : userName.trim().slice(0, 1).toUpperCase()) || 'A';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var getAvatarColors = function getAvatarColors(userName, colors) {
|
|
15
|
+
var hashIndex = (userName === null || userName === void 0 ? void 0 : userName.split('').reduce(function (acum, _letter, index) {
|
|
16
|
+
var letterCode = userName.toUpperCase().charCodeAt(index);
|
|
17
|
+
return letterCode >= A_CHAR_CODE && letterCode <= Z_CHAR_CODE ? acum + letterCode - A_CHAR_CODE + 1 : acum;
|
|
18
|
+
}, 0)) || 0;
|
|
19
|
+
return colors[hashIndex % colors.length];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var _default = {
|
|
23
|
+
getFirstLetter: getFirstLetter,
|
|
24
|
+
getAvatarColors: getAvatarColors
|
|
25
|
+
};
|
|
26
|
+
exports.default = _default;
|