@widergy/energy-ui 3.38.0 → 3.39.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.
- package/CHANGELOG.md +14 -0
- package/dist/components/Loading/index.js +10 -10
- package/dist/components/UTRating/index.js +14 -93
- package/dist/components/UTRating/{components → versions/V0/components}/Circle/index.js +1 -1
- package/dist/components/UTRating/{components → versions/V0/components}/Circle/styles.module.scss +4 -4
- package/dist/components/UTRating/{components → versions/V0/components}/Faces/index.js +2 -2
- package/dist/components/UTRating/{components → versions/V0/components}/Faces/styles.module.scss +5 -5
- package/dist/components/UTRating/{components → versions/V0/components}/Star/index.js +1 -1
- package/dist/components/UTRating/{components → versions/V0/components}/Star/styles.module.scss +3 -3
- package/dist/components/UTRating/versions/V0/index.js +105 -0
- package/dist/components/UTRating/{styles.module.scss → versions/V0/styles.module.scss} +1 -1
- package/dist/components/UTRating/{theme.js → versions/V0/theme.js} +1 -1
- package/dist/components/UTRating/versions/V1/README.md +44 -0
- package/dist/components/UTRating/versions/V1/components/Option/index.js +53 -0
- package/dist/components/UTRating/versions/V1/components/Option/styles.module.scss +10 -0
- package/dist/components/UTRating/versions/V1/components/Option/theme.js +17 -0
- package/dist/components/UTRating/versions/V1/components/Option/utils.js +21 -0
- package/dist/components/UTRating/versions/V1/constants.js +11 -0
- package/dist/components/UTRating/versions/V1/index.js +96 -0
- package/dist/components/UTRating/versions/V1/styles.module.scss +24 -0
- package/dist/components/UTStatusMessage/README.md +46 -0
- package/dist/components/UTStatusMessage/constants.js +36 -0
- package/dist/components/UTStatusMessage/index.js +105 -0
- package/dist/components/UTStatusMessage/styles.module.scss +37 -0
- package/dist/components/UTStatusMessage/theme.js +74 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-confuzed-selected.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-confuzed.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-empty-selected.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-empty.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-happy-selected.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-happy.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-sad-selected.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-sad.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-smile-selected.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-smile.svg +0 -0
- /package/dist/components/UTRating/{components → versions/V0/components}/Faces/constants.js +0 -0
- /package/dist/components/UTRating/{constants.js → versions/V0/constants.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.39.0](https://github.com/widergy/energy-ui/compare/v3.38.1...v3.39.0) (2024-11-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [EVE-4330] UTStatusMessage ([#523](https://github.com/widergy/energy-ui/issues/523)) ([cdd5fd6](https://github.com/widergy/energy-ui/commit/cdd5fd61889a07ad30861607023f6a590bec6590))
|
|
7
|
+
|
|
8
|
+
## [3.38.1](https://github.com/widergy/energy-ui/compare/v3.38.0...v3.38.1) (2024-11-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [EVE-4327] UTRating v1 ([#522](https://github.com/widergy/energy-ui/issues/522)) ([0fce183](https://github.com/widergy/energy-ui/commit/0fce1839be7c7b18901f73214526ec96052df302))
|
|
14
|
+
|
|
1
15
|
# [3.38.0](https://github.com/widergy/energy-ui/compare/v3.37.2...v3.38.0) (2024-11-04)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -16,13 +16,13 @@ var _constants = require("./constants");
|
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
const Loading = _ref => {
|
|
18
18
|
let {
|
|
19
|
-
|
|
19
|
+
classes,
|
|
20
20
|
className,
|
|
21
|
-
thickness,
|
|
22
21
|
size,
|
|
23
|
-
|
|
22
|
+
text = _constants.DEFAULT_LOADING_TEXT,
|
|
23
|
+
textClassName,
|
|
24
24
|
theme,
|
|
25
|
-
|
|
25
|
+
thickness
|
|
26
26
|
} = _ref;
|
|
27
27
|
const defaultSize = (0, _seamlessImmutable.getIn)(theme, ['Loading', 'base', 'size'], 85);
|
|
28
28
|
const defaultThickness = (0, _seamlessImmutable.getIn)(theme, ['Loading', 'base', 'thickness'], 1.5);
|
|
@@ -34,15 +34,15 @@ const Loading = _ref => {
|
|
|
34
34
|
thickness: thickness || defaultThickness
|
|
35
35
|
}), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
36
36
|
className: "".concat(_stylesModule.default.text, " ").concat(classes.text, " ").concat(textClassName)
|
|
37
|
-
}, text
|
|
37
|
+
}, text));
|
|
38
38
|
};
|
|
39
39
|
Loading.propTypes = {
|
|
40
|
-
text: _propTypes.string,
|
|
41
|
-
size: _propTypes.number,
|
|
42
|
-
thickness: _propTypes.number,
|
|
43
40
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
44
|
-
theme: _propTypes.object,
|
|
45
41
|
className: _propTypes.string,
|
|
46
|
-
|
|
42
|
+
size: _propTypes.number,
|
|
43
|
+
text: _propTypes.string,
|
|
44
|
+
textClassName: _propTypes.string,
|
|
45
|
+
theme: _propTypes.object,
|
|
46
|
+
thickness: _propTypes.number
|
|
47
47
|
};
|
|
48
48
|
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(Loading);
|
|
@@ -4,102 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var _formTypes = require("../../types/formTypes");
|
|
12
|
-
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
13
|
-
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
14
|
-
var _classesUtils = require("../../utils/classesUtils");
|
|
15
|
-
var _theme = require("./theme");
|
|
16
|
-
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
-
var _Circle = _interopRequireDefault(require("./components/Circle"));
|
|
18
|
-
var _Faces = _interopRequireDefault(require("./components/Faces"));
|
|
19
|
-
var _Star = _interopRequireDefault(require("./components/Star"));
|
|
20
|
-
var _constants = require("./constants");
|
|
9
|
+
var _V = _interopRequireDefault(require("./versions/V0"));
|
|
10
|
+
var _V2 = _interopRequireDefault(require("./versions/V1"));
|
|
21
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
25
|
-
const UTRatingContainer = _ref => {
|
|
12
|
+
const UTRating = _ref => {
|
|
26
13
|
let {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
field = {},
|
|
30
|
-
onChange,
|
|
31
|
-
options,
|
|
32
|
-
titleProps,
|
|
33
|
-
withUpperTitle
|
|
14
|
+
version = 'V0',
|
|
15
|
+
...props
|
|
34
16
|
} = _ref;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ignore_title: ignoreTitle,
|
|
41
|
-
variant,
|
|
42
|
-
star_color: starColor,
|
|
43
|
-
text_variant: textVariant
|
|
44
|
-
} = field.configuration || {};
|
|
45
|
-
const shouldShowUpperTitle = ignoreTitle && withUpperTitle;
|
|
46
|
-
const handleClick = (order, value) => {
|
|
47
|
-
setSelectedOptions((0, _array.autocompleteWithNumbers)(1, order));
|
|
48
|
-
if ((0, _array.isEmpty)(selectedOptions)) setTemporalSelected((0, _array.autocompleteWithNumbers)(1, order));
|
|
49
|
-
onChange(value.toString());
|
|
50
|
-
};
|
|
51
|
-
const handleHover = value => {
|
|
52
|
-
setHoveredOptions((0, _array.autocompleteWithNumbers)(1, value));
|
|
53
|
-
setSelectedOptions([]);
|
|
54
|
-
};
|
|
55
|
-
const handleMouseLeave = () => {
|
|
56
|
-
setHoveredOptions([]);
|
|
57
|
-
setSelectedOptions(temporalSelected);
|
|
58
|
-
};
|
|
59
|
-
const handleMapOptions = option => {
|
|
60
|
-
const defaultProps = {
|
|
61
|
-
onClick: handleClick,
|
|
62
|
-
value: option.value,
|
|
63
|
-
order: option.order,
|
|
64
|
-
isFirst: options[0].order === option.order,
|
|
65
|
-
isLast: options[options.length - 1].order === option.order,
|
|
66
|
-
textVariant,
|
|
67
|
-
name: option.name,
|
|
68
|
-
classes,
|
|
69
|
-
color: starColor || _colorsModule.default.ratingStarSelected
|
|
70
|
-
};
|
|
71
|
-
return variant === _constants.RATING_VARIANTS.CIRCULAR ? /*#__PURE__*/_react.default.createElement(_Circle.default, _extends({
|
|
72
|
-
key: option.value,
|
|
73
|
-
selected: selectedOptions[selectedOptions.length - 1] === option.order
|
|
74
|
-
}, defaultProps)) : variant === _constants.RATING_VARIANTS.FACES ? /*#__PURE__*/_react.default.createElement(_Faces.default, _extends({
|
|
75
|
-
key: option.value,
|
|
76
|
-
selected: selectedOptions[selectedOptions.length - 1] === option.order
|
|
77
|
-
}, defaultProps)) : /*#__PURE__*/_react.default.createElement(_Star.default, _extends({
|
|
78
|
-
key: option.value,
|
|
79
|
-
hovered: hoveredOptions.includes(option.order),
|
|
80
|
-
selected: selectedOptions.includes(option.order),
|
|
81
|
-
onMouseLeave: handleMouseLeave,
|
|
82
|
-
onHover: handleHover
|
|
83
|
-
}, defaultProps));
|
|
84
|
-
};
|
|
85
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
86
|
-
className: "".concat(classes.title)
|
|
87
|
-
}, titleProps, {
|
|
88
|
-
withMarkdown: true
|
|
89
|
-
}), field.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
-
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
91
|
-
}, options.map(handleMapOptions)));
|
|
17
|
+
const Component = {
|
|
18
|
+
V0: _V.default,
|
|
19
|
+
V1: _V2.default
|
|
20
|
+
}[version];
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(Component, props);
|
|
92
22
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
96
|
-
field: _formTypes.fieldType,
|
|
97
|
-
onChange: _propTypes.func,
|
|
98
|
-
options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
99
|
-
order: _propTypes.number,
|
|
100
|
-
value: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
|
|
101
|
-
})),
|
|
102
|
-
titleProps: _propTypes.object,
|
|
103
|
-
withUpperTitle: _propTypes.bool
|
|
23
|
+
UTRating.propTypes = {
|
|
24
|
+
version: _propTypes.string
|
|
104
25
|
};
|
|
105
|
-
var _default = exports.default =
|
|
26
|
+
var _default = exports.default = UTRating;
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));
|
|
9
9
|
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
10
10
|
var _propTypes = require("prop-types");
|
|
11
|
-
var _UTLabel = _interopRequireDefault(require("
|
|
11
|
+
var _UTLabel = _interopRequireDefault(require("../../../../../UTLabel"));
|
|
12
12
|
var _constants = require("../../constants");
|
|
13
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/dist/components/UTRating/{components → versions/V0/components}/Circle/styles.module.scss
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@use '
|
|
2
|
-
@use '
|
|
3
|
-
@use '
|
|
4
|
-
@use '
|
|
1
|
+
@use '../../../../../../scss/variables/colors.module.scss' as *;
|
|
2
|
+
@use '../../../../../../scss/variables/fontSizes.module.scss' as *;
|
|
3
|
+
@use '../../../../../../scss/variables/sizes.module.scss' as *;
|
|
4
|
+
@use '../../../../../../scss/variables/mediaQueries.module.scss' as *;
|
|
5
5
|
|
|
6
6
|
.icon {
|
|
7
7
|
height: $rating-circle-icon-size;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
|
-
var _UTButton = _interopRequireDefault(require("
|
|
10
|
-
var _UTLabel = _interopRequireDefault(require("
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../../../../../UTButton"));
|
|
10
|
+
var _UTLabel = _interopRequireDefault(require("../../../../../UTLabel"));
|
|
11
11
|
var _constants = require("../../constants");
|
|
12
12
|
var _constants2 = require("./constants");
|
|
13
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
package/dist/components/UTRating/{components → versions/V0/components}/Faces/styles.module.scss
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@use '
|
|
2
|
-
@use '
|
|
3
|
-
@use '
|
|
1
|
+
@use '../../../../../../scss/variables/colors.module.scss' as *;
|
|
2
|
+
@use '../../../../../../scss/variables/sizes.module.scss' as *;
|
|
3
|
+
@use '../../../../../../scss/variables/mediaQueries.module.scss' as *;
|
|
4
4
|
|
|
5
5
|
.container {
|
|
6
6
|
align-items: center;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
.first {
|
|
13
13
|
flex-direction: row-reverse;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/* @media #{$mobile} {
|
|
16
16
|
position: relative;
|
|
17
17
|
|
|
18
18
|
.text {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
top: 40px;
|
|
22
22
|
white-space: nowrap;
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
} */
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.last {
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _StarRate = _interopRequireDefault(require("@material-ui/icons/StarRate"));
|
|
10
10
|
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
11
|
-
var _UTLabel = _interopRequireDefault(require("
|
|
11
|
+
var _UTLabel = _interopRequireDefault(require("../../../../../UTLabel"));
|
|
12
12
|
var _constants = require("../../constants");
|
|
13
13
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/dist/components/UTRating/{components → versions/V0/components}/Star/styles.module.scss
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@use '
|
|
2
|
-
@use '
|
|
3
|
-
@use '
|
|
1
|
+
@use '../../../../../../scss/variables/colors.module.scss' as *;
|
|
2
|
+
@use '../../../../../../scss/variables/fontSizes.module.scss' as *;
|
|
3
|
+
@use '../../../../../../scss/variables/mediaQueries.module.scss' as *;
|
|
4
4
|
|
|
5
5
|
.container {
|
|
6
6
|
align-items: center;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _array = require("@widergy/web-utils/lib/array");
|
|
10
|
+
var _colorsModule = _interopRequireDefault(require("../../../../scss/variables/colors.module.scss"));
|
|
11
|
+
var _formTypes = require("../../../../types/formTypes");
|
|
12
|
+
var _WithTheme = _interopRequireDefault(require("../../../WithTheme"));
|
|
13
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
14
|
+
var _classesUtils = require("../../../../utils/classesUtils");
|
|
15
|
+
var _theme = require("./theme");
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
var _Circle = _interopRequireDefault(require("./components/Circle"));
|
|
18
|
+
var _Faces = _interopRequireDefault(require("./components/Faces"));
|
|
19
|
+
var _Star = _interopRequireDefault(require("./components/Star"));
|
|
20
|
+
var _constants = require("./constants");
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
25
|
+
const UTRatingContainer = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
classes: theme,
|
|
28
|
+
classNames,
|
|
29
|
+
field = {},
|
|
30
|
+
onChange,
|
|
31
|
+
options,
|
|
32
|
+
titleProps,
|
|
33
|
+
withUpperTitle
|
|
34
|
+
} = _ref;
|
|
35
|
+
const [selectedOptions, setSelectedOptions] = (0, _react.useState)([]);
|
|
36
|
+
const [hoveredOptions, setHoveredOptions] = (0, _react.useState)([]);
|
|
37
|
+
const [temporalSelected, setTemporalSelected] = (0, _react.useState)([]);
|
|
38
|
+
const classes = (0, _classesUtils.mergeClasses)(theme, classNames);
|
|
39
|
+
const {
|
|
40
|
+
ignore_title: ignoreTitle,
|
|
41
|
+
variant,
|
|
42
|
+
star_color: starColor,
|
|
43
|
+
text_variant: textVariant
|
|
44
|
+
} = field.configuration || {};
|
|
45
|
+
const shouldShowUpperTitle = ignoreTitle && withUpperTitle;
|
|
46
|
+
const handleClick = (order, value) => {
|
|
47
|
+
setSelectedOptions((0, _array.autocompleteWithNumbers)(1, order));
|
|
48
|
+
if ((0, _array.isEmpty)(selectedOptions)) setTemporalSelected((0, _array.autocompleteWithNumbers)(1, order));
|
|
49
|
+
onChange(value.toString());
|
|
50
|
+
};
|
|
51
|
+
const handleHover = value => {
|
|
52
|
+
setHoveredOptions((0, _array.autocompleteWithNumbers)(1, value));
|
|
53
|
+
setSelectedOptions([]);
|
|
54
|
+
};
|
|
55
|
+
const handleMouseLeave = () => {
|
|
56
|
+
setHoveredOptions([]);
|
|
57
|
+
setSelectedOptions(temporalSelected);
|
|
58
|
+
};
|
|
59
|
+
const handleMapOptions = option => {
|
|
60
|
+
const defaultProps = {
|
|
61
|
+
onClick: handleClick,
|
|
62
|
+
value: option.value,
|
|
63
|
+
order: option.order,
|
|
64
|
+
isFirst: options[0].order === option.order,
|
|
65
|
+
isLast: options[options.length - 1].order === option.order,
|
|
66
|
+
textVariant,
|
|
67
|
+
name: option.name,
|
|
68
|
+
classes,
|
|
69
|
+
color: starColor || _colorsModule.default.ratingStarSelected
|
|
70
|
+
};
|
|
71
|
+
return variant === _constants.RATING_VARIANTS.CIRCULAR ? /*#__PURE__*/_react.default.createElement(_Circle.default, _extends({
|
|
72
|
+
key: option.value,
|
|
73
|
+
selected: selectedOptions[selectedOptions.length - 1] === option.order
|
|
74
|
+
}, defaultProps)) : variant === _constants.RATING_VARIANTS.FACES ? /*#__PURE__*/_react.default.createElement(_Faces.default, _extends({
|
|
75
|
+
key: option.value,
|
|
76
|
+
selected: selectedOptions[selectedOptions.length - 1] === option.order
|
|
77
|
+
}, defaultProps)) : /*#__PURE__*/_react.default.createElement(_Star.default, _extends({
|
|
78
|
+
key: option.value,
|
|
79
|
+
hovered: hoveredOptions.includes(option.order),
|
|
80
|
+
selected: selectedOptions.includes(option.order),
|
|
81
|
+
onMouseLeave: handleMouseLeave,
|
|
82
|
+
onHover: handleHover
|
|
83
|
+
}, defaultProps));
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
86
|
+
className: "".concat(classes.title)
|
|
87
|
+
}, titleProps, {
|
|
88
|
+
withMarkdown: true
|
|
89
|
+
}), field.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
91
|
+
}, options.map(handleMapOptions)));
|
|
92
|
+
};
|
|
93
|
+
UTRatingContainer.propTypes = {
|
|
94
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
95
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
96
|
+
field: _formTypes.fieldType,
|
|
97
|
+
onChange: _propTypes.func,
|
|
98
|
+
options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
99
|
+
order: _propTypes.number,
|
|
100
|
+
value: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
|
|
101
|
+
})),
|
|
102
|
+
titleProps: _propTypes.object,
|
|
103
|
+
withUpperTitle: _propTypes.bool
|
|
104
|
+
};
|
|
105
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTRatingContainer);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.retrieveStyle = void 0;
|
|
7
7
|
var _seamlessImmutable = require("seamless-immutable");
|
|
8
|
-
var _colorsModule = _interopRequireDefault(require("
|
|
8
|
+
var _colorsModule = _interopRequireDefault(require("../../../../scss/variables/colors.module.scss"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const retrieveStyle = _ref => {
|
|
11
11
|
let {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# UTRating
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
`UTRating` is a configurable rating input component that enables users to easily provide feedback through visual indicators.
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| ------------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| classNames | object | | Custom CSS class names for styling the component. |
|
|
12
|
+
| dataTestId | string | | Unique identifier for testing purposes. |
|
|
13
|
+
| disabled | bool | false | Indicates whether the input is disabled and cannot be interacted with. |
|
|
14
|
+
| error | string | | Error message to display when validation fails or an issue occurs. |
|
|
15
|
+
| helpTextEnd | string | | Additional help text displayed at the end of the input for user guidance. |
|
|
16
|
+
| helpTextStart | string | | Additional help text displayed at the beginning of the input for user guidance. |
|
|
17
|
+
| onChange | func | | Callback function invoked when the input value changes. |
|
|
18
|
+
| options | array | | Array of options available for selection. |
|
|
19
|
+
| required | bool | false | Indicates whether the input is mandatory for form submission. |
|
|
20
|
+
| title | string | | Title for the input, providing context to the user. |
|
|
21
|
+
| validations | array | | Array of validation rules to be applied to the input value. |
|
|
22
|
+
| value | string | | The current value of the input. |
|
|
23
|
+
| variant | string | `star` | Defines the visual style component. |
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### options
|
|
27
|
+
|
|
28
|
+
`options` is an array of objects with a `value` and a `name` key. The values should be in the range of 0-10, except for the `faces` variant. In desktop view, all options are displayed in one row; in responsive view, they are broken into 2 rows if there are more than 5 options.
|
|
29
|
+
|
|
30
|
+
### variant
|
|
31
|
+
|
|
32
|
+
The value of `variant` must be one of the following:
|
|
33
|
+
|
|
34
|
+
- `faces`: the options are represented as face icons. Option values should exclusively be between 1 and 5, values outside this range are not supported.
|
|
35
|
+
- `star`: the options are represented as star icons.
|
|
36
|
+
- `text`: the options are represented as the option's `text`.
|
|
37
|
+
|
|
38
|
+
### Structure of Validations
|
|
39
|
+
|
|
40
|
+
For detailed information about the structure of validations, please refer to the UTValidation component documentation.
|
|
41
|
+
|
|
42
|
+
### Handling Errors
|
|
43
|
+
|
|
44
|
+
Errors can be displayed below the text input using either the `error` prop or the `validations` prop.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _propTypes = require("prop-types");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _constants = require("../../constants");
|
|
10
|
+
var _UTButton = _interopRequireDefault(require("../../../../../UTButton"));
|
|
11
|
+
var _WithTheme = _interopRequireDefault(require("../../../../../WithTheme"));
|
|
12
|
+
var _utils = require("./utils");
|
|
13
|
+
var _theme = require("./theme");
|
|
14
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const Option = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
classes,
|
|
19
|
+
disabled,
|
|
20
|
+
error,
|
|
21
|
+
isSelected,
|
|
22
|
+
name,
|
|
23
|
+
onChange,
|
|
24
|
+
value,
|
|
25
|
+
variant,
|
|
26
|
+
wrapperStyle
|
|
27
|
+
} = _ref;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
+
style: wrapperStyle
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
31
|
+
classNames: {
|
|
32
|
+
root: "".concat(_stylesModule.default.option, " ").concat(error ? classes.error : ''),
|
|
33
|
+
text: _stylesModule.default.text
|
|
34
|
+
},
|
|
35
|
+
colorTheme: isSelected ? 'primary' : 'secondary',
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
Icon: (0, _utils.getIcon)(variant, value, isSelected),
|
|
38
|
+
onClick: () => onChange(value),
|
|
39
|
+
variant: (0, _utils.getVariant)(variant, isSelected)
|
|
40
|
+
}, _constants.RATING_VARIANTS.TEXT === variant ? name : null));
|
|
41
|
+
};
|
|
42
|
+
Option.propTypes = {
|
|
43
|
+
classes: _propTypes.object,
|
|
44
|
+
disabled: _propTypes.bool,
|
|
45
|
+
error: _propTypes.string,
|
|
46
|
+
isSelected: _propTypes.bool,
|
|
47
|
+
name: _propTypes.string,
|
|
48
|
+
onChange: _propTypes.func,
|
|
49
|
+
value: _propTypes.string,
|
|
50
|
+
variant: _propTypes.string,
|
|
51
|
+
wrapperStyle: _propTypes.object
|
|
52
|
+
};
|
|
53
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(Option);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveStyle = void 0;
|
|
7
|
+
const retrieveStyle = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
theme
|
|
10
|
+
} = _ref;
|
|
11
|
+
return {
|
|
12
|
+
error: {
|
|
13
|
+
borderColor: "".concat(theme.Palette.error['05'], " !important")
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
exports.retrieveStyle = retrieveStyle;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getVariant = exports.getIcon = void 0;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
const getIcon = (variant, value, isSelected) => ({
|
|
9
|
+
[_constants.RATING_VARIANTS.TEXT]: null,
|
|
10
|
+
[_constants.RATING_VARIANTS.FACES]: {
|
|
11
|
+
1: 'IconMoodSad',
|
|
12
|
+
2: 'IconMoodConfuzed',
|
|
13
|
+
3: 'IconMoodEmpty',
|
|
14
|
+
4: 'IconMoodSmile',
|
|
15
|
+
5: 'IconMoodHappy'
|
|
16
|
+
}[value],
|
|
17
|
+
[_constants.RATING_VARIANTS.STAR]: isSelected ? 'IconStarFilled' : 'IconStar'
|
|
18
|
+
})[variant];
|
|
19
|
+
exports.getIcon = getIcon;
|
|
20
|
+
const getVariant = (variant, isSelected) => !isSelected || variant === _constants.RATING_VARIANTS.STAR ? 'shadow' : 'outlined';
|
|
21
|
+
exports.getVariant = getVariant;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
10
|
+
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
11
|
+
var _utils = require("../../../UTValidation/utils");
|
|
12
|
+
var _UTValidation = _interopRequireDefault(require("../../../UTValidation"));
|
|
13
|
+
var _useScreenSize = require("../../../../utils/useScreenSize");
|
|
14
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
|
+
var _Option = _interopRequireDefault(require("./components/Option"));
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
21
|
+
const UTRating = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
classNames = {},
|
|
24
|
+
dataTestId,
|
|
25
|
+
disabled,
|
|
26
|
+
error,
|
|
27
|
+
helpTextEnd,
|
|
28
|
+
helpTextStart,
|
|
29
|
+
onChange,
|
|
30
|
+
options = [],
|
|
31
|
+
required,
|
|
32
|
+
title,
|
|
33
|
+
validations,
|
|
34
|
+
value,
|
|
35
|
+
variant = _constants.RATING_VARIANTS.STAR
|
|
36
|
+
} = _ref;
|
|
37
|
+
const {
|
|
38
|
+
isMobileOrTablet
|
|
39
|
+
} = (0, _useScreenSize.useScreenSize)();
|
|
40
|
+
const validationData = (0, _react.useMemo)(() => validations || error && (0, _utils.formatErrorToValidation)(error), [error, validations]);
|
|
41
|
+
const valueIndex = options.map(_ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
value: optionValue
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return optionValue;
|
|
46
|
+
}).indexOf(value);
|
|
47
|
+
const isSelected = index => valueIndex !== -1 && variant === _constants.RATING_VARIANTS.STAR ? index <= valueIndex : index === valueIndex;
|
|
48
|
+
const wrapperStyle = {
|
|
49
|
+
boxSizing: 'border-box',
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flex: isMobileOrTablet && options.length > 5 ? "0 0 calc(".concat(100 / Math.ceil(options.length / 2), "% - 4px)") : '1 '
|
|
52
|
+
};
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classNames.container),
|
|
55
|
+
"data-testid": dataTestId
|
|
56
|
+
}, title && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
57
|
+
colorTheme: "dark",
|
|
58
|
+
required: required
|
|
59
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
+
className: "".concat(_stylesModule.default.optionsContainer, " ").concat(classNames.optionsContainer, " ").concat(isMobileOrTablet ? _stylesModule.default.responsive : '')
|
|
61
|
+
}, options.map((option, index) => /*#__PURE__*/_react.default.createElement(_Option.default, _extends({}, option, {
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
error: error,
|
|
64
|
+
isSelected: isSelected(index),
|
|
65
|
+
key: option.value,
|
|
66
|
+
onChange: onChange,
|
|
67
|
+
variant: variant,
|
|
68
|
+
wrapperStyle: wrapperStyle
|
|
69
|
+
})))), helpTextStart && /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
+
className: "".concat(_stylesModule.default.helpTextContainer, " ").concat(classNames.helpTextContainer)
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
72
|
+
colorTheme: "gray",
|
|
73
|
+
variant: "small"
|
|
74
|
+
}, helpTextStart), helpTextEnd && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
75
|
+
colorTheme: "gray",
|
|
76
|
+
variant: "small"
|
|
77
|
+
}, helpTextEnd)), validationData && /*#__PURE__*/_react.default.createElement(_UTValidation.default, {
|
|
78
|
+
validationData: validationData
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
UTRating.propTypes = {
|
|
82
|
+
classNames: _propTypes.object,
|
|
83
|
+
dataTestId: _propTypes.string,
|
|
84
|
+
disabled: _propTypes.bool,
|
|
85
|
+
error: _propTypes.string,
|
|
86
|
+
helpTextEnd: _propTypes.string,
|
|
87
|
+
helpTextStart: _propTypes.string,
|
|
88
|
+
onChange: _propTypes.func,
|
|
89
|
+
options: _propTypes.array,
|
|
90
|
+
required: _propTypes.bool,
|
|
91
|
+
title: _propTypes.string,
|
|
92
|
+
validations: _propTypes.array,
|
|
93
|
+
value: _propTypes.string,
|
|
94
|
+
variant: _propTypes.string
|
|
95
|
+
};
|
|
96
|
+
var _default = exports.default = UTRating;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
grid-gap: 8px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.optionsContainer {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
grid-gap: 4px;
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.helpTextContainer {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.responsive {
|
|
22
|
+
flex-wrap: wrap;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# UTStatusMessage
|
|
2
|
+
|
|
3
|
+
The purpose of this component, as its name indicates, is to communicate a message about the status of the view or component in which it is contextually situated.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Name | Type | Default | Description |
|
|
8
|
+
| --------------------- | --------- | ------- | -------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| children | element | | The content to be rendered inside the component. |
|
|
10
|
+
| classes | object | | Custom CSS classes for styling the component. |
|
|
11
|
+
| colorTheme | string | default | Defines the color theme for the component. |
|
|
12
|
+
| description | string | | Description text providing additional context or information. |
|
|
13
|
+
| descriptionProps | object | | Props to be applied to the description UTLabel. |
|
|
14
|
+
| helpText | string | | Help text displayed to guide the user. |
|
|
15
|
+
| helpTextProps | object | | Props to be applied to the help text UTLabel. |
|
|
16
|
+
| icon | string | | Icon to be displayed in the header. |
|
|
17
|
+
| iconProps | object | | Props to be applied to the UTIcon |
|
|
18
|
+
| image | string | | URL of an image to be displayed in the header, replacing the icon. |
|
|
19
|
+
| loading | bool | false | Indicates whether the component is in a loading state. Replaces the header. |
|
|
20
|
+
| primaryAction | func | | Callback function for the primary action. |
|
|
21
|
+
| primaryActionProps | object | | Props to be applied to the primary action UTButton. |
|
|
22
|
+
| primaryActionText | string | | Text for the primary action UTButton. |
|
|
23
|
+
| secondaryAction | func | | Callback function for the secondary action. |
|
|
24
|
+
| secondaryActionProps | object | | Props to be applied to the secondary action UTButton. |
|
|
25
|
+
| secondaryActionText | string | | Text for the secondary action UTButton. |
|
|
26
|
+
| showHeader | bool | true | Indicates whether to display the header section of the component. |
|
|
27
|
+
| title | string | | Title for the component, providing context to the user. |
|
|
28
|
+
| titleProps | object | | Props to be applied to the title UTLabel. |
|
|
29
|
+
|
|
30
|
+
### colorTheme
|
|
31
|
+
|
|
32
|
+
The value of `colorTheme` must be one of the following:
|
|
33
|
+
|
|
34
|
+
- `accent`
|
|
35
|
+
- `default`
|
|
36
|
+
- `error`
|
|
37
|
+
- `gradient`
|
|
38
|
+
- `gray`
|
|
39
|
+
- `identity1`
|
|
40
|
+
- `identity2`
|
|
41
|
+
- `identity3`
|
|
42
|
+
- `identity4`
|
|
43
|
+
- `info`
|
|
44
|
+
- `negative`
|
|
45
|
+
- `success`
|
|
46
|
+
- `warning`
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ICON_COLOR_THEMES = exports.COLOR_THEMES = void 0;
|
|
7
|
+
const COLOR_THEMES = exports.COLOR_THEMES = {
|
|
8
|
+
ACCENT: 'accent',
|
|
9
|
+
DEFAULT: 'default',
|
|
10
|
+
ERROR: 'error',
|
|
11
|
+
GRADIENT: 'gradient',
|
|
12
|
+
GRAY: 'gray',
|
|
13
|
+
IDENTITY_1: 'identity1',
|
|
14
|
+
IDENTITY_2: 'identity2',
|
|
15
|
+
IDENTITY_3: 'identity3',
|
|
16
|
+
IDENTITY_4: 'identity4',
|
|
17
|
+
INFO: 'info',
|
|
18
|
+
NEGATIVE: 'negative',
|
|
19
|
+
SUCCESS: 'success',
|
|
20
|
+
WARNING: 'warning'
|
|
21
|
+
};
|
|
22
|
+
const ICON_COLOR_THEMES = exports.ICON_COLOR_THEMES = {
|
|
23
|
+
[COLOR_THEMES.ACCENT]: 'accent',
|
|
24
|
+
[COLOR_THEMES.DEFAULT]: 'dark',
|
|
25
|
+
[COLOR_THEMES.ERROR]: 'error',
|
|
26
|
+
[COLOR_THEMES.GRADIENT]: 'light',
|
|
27
|
+
[COLOR_THEMES.GRAY]: 'gray',
|
|
28
|
+
[COLOR_THEMES.IDENTITY_1]: 'light',
|
|
29
|
+
[COLOR_THEMES.IDENTITY_2]: 'light',
|
|
30
|
+
[COLOR_THEMES.IDENTITY_3]: 'light',
|
|
31
|
+
[COLOR_THEMES.IDENTITY_4]: 'light',
|
|
32
|
+
[COLOR_THEMES.INFO]: 'information',
|
|
33
|
+
[COLOR_THEMES.NEGATIVE]: 'dark',
|
|
34
|
+
[COLOR_THEMES.SUCCESS]: 'success',
|
|
35
|
+
[COLOR_THEMES.WARNING]: 'warning'
|
|
36
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _propTypes = require("prop-types");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../UTButton"));
|
|
10
|
+
var _UTIcon = _interopRequireDefault(require("../UTIcon"));
|
|
11
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
12
|
+
var _UTLoading = _interopRequireDefault(require("../UTLoading"));
|
|
13
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
14
|
+
var _constants = require("./constants");
|
|
15
|
+
var _theme = require("./theme");
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
|
+
const UTStatusMessage = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
classes,
|
|
23
|
+
colorTheme = _constants.COLOR_THEMES.DEFAULT,
|
|
24
|
+
description,
|
|
25
|
+
descriptionProps,
|
|
26
|
+
helpText,
|
|
27
|
+
helpTextProps,
|
|
28
|
+
icon = 'IconInfoCircle',
|
|
29
|
+
iconProps = {},
|
|
30
|
+
image,
|
|
31
|
+
loading,
|
|
32
|
+
primaryAction,
|
|
33
|
+
primaryActionProps,
|
|
34
|
+
primaryActionText,
|
|
35
|
+
secondaryAction,
|
|
36
|
+
secondaryActionProps,
|
|
37
|
+
secondaryActionText,
|
|
38
|
+
showHeader = true,
|
|
39
|
+
title,
|
|
40
|
+
titleProps
|
|
41
|
+
} = _ref;
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
|
|
44
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_UTLoading.default, {
|
|
45
|
+
loading: true,
|
|
46
|
+
text: null
|
|
47
|
+
}) : showHeader ? /*#__PURE__*/_react.default.createElement("div", {
|
|
48
|
+
className: classes.banner
|
|
49
|
+
}, image ? /*#__PURE__*/_react.default.createElement("img", {
|
|
50
|
+
src: image,
|
|
51
|
+
className: "".concat(_stylesModule.default.image, " ").concat(classes.image),
|
|
52
|
+
alt: ""
|
|
53
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
className: classes.iconContainer
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
56
|
+
name: icon,
|
|
57
|
+
colorTheme: _constants.ICON_COLOR_THEMES[colorTheme]
|
|
58
|
+
}, iconProps)))) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
className: "".concat(_stylesModule.default.content, " ").concat(classes.content)
|
|
60
|
+
}, (title || description || helpText) && /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
+
className: _stylesModule.default.section
|
|
62
|
+
}, title && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
63
|
+
className: _stylesModule.default.label,
|
|
64
|
+
variant: "title3",
|
|
65
|
+
weight: "medium"
|
|
66
|
+
}, titleProps), title), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
67
|
+
className: _stylesModule.default.label,
|
|
68
|
+
colorTheme: "gray",
|
|
69
|
+
variant: "body"
|
|
70
|
+
}, descriptionProps), description), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
71
|
+
className: _stylesModule.default.label,
|
|
72
|
+
colorTheme: "gray",
|
|
73
|
+
variant: "small"
|
|
74
|
+
}, helpTextProps), helpText)), children, (primaryAction || secondaryAction) && /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: _stylesModule.default.section
|
|
76
|
+
}, primaryAction && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
77
|
+
onClick: primaryAction
|
|
78
|
+
}, primaryActionProps), primaryActionText), secondaryAction && /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
79
|
+
onClick: secondaryAction,
|
|
80
|
+
variant: "text"
|
|
81
|
+
}, secondaryActionProps), secondaryActionText))));
|
|
82
|
+
};
|
|
83
|
+
UTStatusMessage.propTypes = {
|
|
84
|
+
children: _propTypes.element,
|
|
85
|
+
classes: _propTypes.object,
|
|
86
|
+
colorTheme: _propTypes.string,
|
|
87
|
+
description: _propTypes.string,
|
|
88
|
+
descriptionProps: _propTypes.object,
|
|
89
|
+
helpText: _propTypes.string,
|
|
90
|
+
helpTextProps: _propTypes.object,
|
|
91
|
+
icon: _propTypes.string,
|
|
92
|
+
iconProps: _propTypes.object,
|
|
93
|
+
image: _propTypes.string,
|
|
94
|
+
loading: _propTypes.bool,
|
|
95
|
+
primaryAction: _propTypes.func,
|
|
96
|
+
primaryActionProps: _propTypes.object,
|
|
97
|
+
primaryActionText: _propTypes.string,
|
|
98
|
+
secondaryAction: _propTypes.func,
|
|
99
|
+
secondaryActionProps: _propTypes.object,
|
|
100
|
+
secondaryActionText: _propTypes.string,
|
|
101
|
+
showHeader: _propTypes.bool,
|
|
102
|
+
title: _propTypes.string,
|
|
103
|
+
titleProps: _propTypes.object
|
|
104
|
+
};
|
|
105
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTStatusMessage);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
align-items: center;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
flex-grow: 1;
|
|
6
|
+
grid-gap: 24px;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.content {
|
|
12
|
+
align-items: center;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
grid-gap: 24px;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
max-width: 500px;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.section {
|
|
23
|
+
align-items: center;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
grid-gap: 8px;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.label {
|
|
31
|
+
text-align: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.image {
|
|
35
|
+
height: 200px;
|
|
36
|
+
width: 200px;
|
|
37
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveStyle = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
const getIconBackgroundColor = (colorTheme, theme) => {
|
|
9
|
+
var _theme$Palette, _theme$Palette2, _theme$Palette3, _theme$Palette4, _theme$Palette5, _theme$Palette6, _theme$Palette7, _theme$Palette8, _theme$Palette9, _theme$Palette10, _theme$Palette11, _theme$Palette12;
|
|
10
|
+
return {
|
|
11
|
+
[_constants.COLOR_THEMES.ACCENT]: (_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.accent['01'],
|
|
12
|
+
[_constants.COLOR_THEMES.DEFAULT]: (_theme$Palette2 = theme.Palette) === null || _theme$Palette2 === void 0 ? void 0 : _theme$Palette2.light['03'],
|
|
13
|
+
[_constants.COLOR_THEMES.ERROR]: (_theme$Palette3 = theme.Palette) === null || _theme$Palette3 === void 0 ? void 0 : _theme$Palette3.error['01'],
|
|
14
|
+
[_constants.COLOR_THEMES.GRADIENT]: 'light',
|
|
15
|
+
[_constants.COLOR_THEMES.GRAY]: (_theme$Palette4 = theme.Palette) === null || _theme$Palette4 === void 0 ? void 0 : _theme$Palette4.light['03'],
|
|
16
|
+
[_constants.COLOR_THEMES.IDENTITY_1]: (_theme$Palette5 = theme.Palette) === null || _theme$Palette5 === void 0 || (_theme$Palette5 = _theme$Palette5.identitySolid) === null || _theme$Palette5 === void 0 ? void 0 : _theme$Palette5['01'],
|
|
17
|
+
[_constants.COLOR_THEMES.IDENTITY_2]: (_theme$Palette6 = theme.Palette) === null || _theme$Palette6 === void 0 || (_theme$Palette6 = _theme$Palette6.identitySolid) === null || _theme$Palette6 === void 0 ? void 0 : _theme$Palette6['02'],
|
|
18
|
+
[_constants.COLOR_THEMES.IDENTITY_3]: (_theme$Palette7 = theme.Palette) === null || _theme$Palette7 === void 0 || (_theme$Palette7 = _theme$Palette7.identitySolid) === null || _theme$Palette7 === void 0 ? void 0 : _theme$Palette7['03'],
|
|
19
|
+
[_constants.COLOR_THEMES.IDENTITY_4]: (_theme$Palette8 = theme.Palette) === null || _theme$Palette8 === void 0 || (_theme$Palette8 = _theme$Palette8.identitySolid) === null || _theme$Palette8 === void 0 ? void 0 : _theme$Palette8['04'],
|
|
20
|
+
[_constants.COLOR_THEMES.INFO]: (_theme$Palette9 = theme.Palette) === null || _theme$Palette9 === void 0 ? void 0 : _theme$Palette9.information['01'],
|
|
21
|
+
[_constants.COLOR_THEMES.NEGATIVE]: (_theme$Palette10 = theme.Palette) === null || _theme$Palette10 === void 0 ? void 0 : _theme$Palette10.light['01'],
|
|
22
|
+
[_constants.COLOR_THEMES.SUCCESS]: (_theme$Palette11 = theme.Palette) === null || _theme$Palette11 === void 0 ? void 0 : _theme$Palette11.success['01'],
|
|
23
|
+
[_constants.COLOR_THEMES.WARNING]: (_theme$Palette12 = theme.Palette) === null || _theme$Palette12 === void 0 ? void 0 : _theme$Palette12.warning['01']
|
|
24
|
+
}[colorTheme];
|
|
25
|
+
};
|
|
26
|
+
const getBannerBackgroundColor = (colorTheme, theme) => {
|
|
27
|
+
var _theme$Palette13, _theme$Palette14, _theme$Palette15, _theme$Palette16, _theme$Palette17, _theme$Palette18, _theme$Palette19, _theme$Palette20, _theme$Palette21, _theme$Palette22, _theme$Palette23, _theme$Palette24;
|
|
28
|
+
return {
|
|
29
|
+
[_constants.COLOR_THEMES.ACCENT]: (_theme$Palette13 = theme.Palette) === null || _theme$Palette13 === void 0 ? void 0 : _theme$Palette13.accent['03'],
|
|
30
|
+
[_constants.COLOR_THEMES.DEFAULT]: (_theme$Palette14 = theme.Palette) === null || _theme$Palette14 === void 0 ? void 0 : _theme$Palette14.gray['05'],
|
|
31
|
+
[_constants.COLOR_THEMES.ERROR]: (_theme$Palette15 = theme.Palette) === null || _theme$Palette15 === void 0 ? void 0 : _theme$Palette15.error['03'],
|
|
32
|
+
[_constants.COLOR_THEMES.GRADIENT]: null,
|
|
33
|
+
[_constants.COLOR_THEMES.GRAY]: (_theme$Palette16 = theme.Palette) === null || _theme$Palette16 === void 0 ? void 0 : _theme$Palette16.gray['03'],
|
|
34
|
+
[_constants.COLOR_THEMES.IDENTITY_1]: (_theme$Palette17 = theme.Palette) === null || _theme$Palette17 === void 0 || (_theme$Palette17 = _theme$Palette17.identitySolid) === null || _theme$Palette17 === void 0 ? void 0 : _theme$Palette17['01'],
|
|
35
|
+
[_constants.COLOR_THEMES.IDENTITY_2]: (_theme$Palette18 = theme.Palette) === null || _theme$Palette18 === void 0 || (_theme$Palette18 = _theme$Palette18.identitySolid) === null || _theme$Palette18 === void 0 ? void 0 : _theme$Palette18['02'],
|
|
36
|
+
[_constants.COLOR_THEMES.IDENTITY_3]: (_theme$Palette19 = theme.Palette) === null || _theme$Palette19 === void 0 || (_theme$Palette19 = _theme$Palette19.identitySolid) === null || _theme$Palette19 === void 0 ? void 0 : _theme$Palette19['03'],
|
|
37
|
+
[_constants.COLOR_THEMES.IDENTITY_4]: (_theme$Palette20 = theme.Palette) === null || _theme$Palette20 === void 0 || (_theme$Palette20 = _theme$Palette20.identitySolid) === null || _theme$Palette20 === void 0 ? void 0 : _theme$Palette20['04'],
|
|
38
|
+
[_constants.COLOR_THEMES.INFO]: (_theme$Palette21 = theme.Palette) === null || _theme$Palette21 === void 0 ? void 0 : _theme$Palette21.information['03'],
|
|
39
|
+
[_constants.COLOR_THEMES.NEGATIVE]: (_theme$Palette22 = theme.Palette) === null || _theme$Palette22 === void 0 ? void 0 : _theme$Palette22.light['01'],
|
|
40
|
+
[_constants.COLOR_THEMES.SUCCESS]: (_theme$Palette23 = theme.Palette) === null || _theme$Palette23 === void 0 ? void 0 : _theme$Palette23.success['03'],
|
|
41
|
+
[_constants.COLOR_THEMES.WARNING]: (_theme$Palette24 = theme.Palette) === null || _theme$Palette24 === void 0 ? void 0 : _theme$Palette24.warning['03']
|
|
42
|
+
}[colorTheme];
|
|
43
|
+
};
|
|
44
|
+
const retrieveStyle = _ref => {
|
|
45
|
+
var _theme$Palette25, _theme$Palette26;
|
|
46
|
+
let {
|
|
47
|
+
showBanner = true,
|
|
48
|
+
theme,
|
|
49
|
+
colorTheme = _constants.COLOR_THEMES.DEFAULT
|
|
50
|
+
} = _ref;
|
|
51
|
+
const gradient = "linear-gradient(45deg, ".concat((_theme$Palette25 = theme.Palette) === null || _theme$Palette25 === void 0 || (_theme$Palette25 = _theme$Palette25.identityGradient) === null || _theme$Palette25 === void 0 ? void 0 : _theme$Palette25['01'], " 0%, ").concat((_theme$Palette26 = theme.Palette) === null || _theme$Palette26 === void 0 || (_theme$Palette26 = _theme$Palette26.identityGradient) === null || _theme$Palette26 === void 0 ? void 0 : _theme$Palette26['02'], " 100%);");
|
|
52
|
+
return {
|
|
53
|
+
iconContainer: {
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
background: colorTheme === _constants.COLOR_THEMES.GRADIENT && !showBanner ? gradient : '',
|
|
56
|
+
backgroundColor: getIconBackgroundColor(colorTheme, theme),
|
|
57
|
+
borderRadius: 100,
|
|
58
|
+
display: 'flex',
|
|
59
|
+
height: 56,
|
|
60
|
+
justifyContent: 'center',
|
|
61
|
+
width: 56
|
|
62
|
+
},
|
|
63
|
+
banner: {
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
background: colorTheme === _constants.COLOR_THEMES.GRADIENT && showBanner ? gradient : '',
|
|
66
|
+
backgroundColor: showBanner ? getBannerBackgroundColor(colorTheme, theme) : 'transparent',
|
|
67
|
+
display: 'flex',
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
padding: '12px 0',
|
|
70
|
+
width: '100%'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.retrieveStyle = retrieveStyle;
|
package/dist/index.js
CHANGED
|
@@ -321,6 +321,12 @@ Object.defineProperty(exports, "UTStatus", {
|
|
|
321
321
|
return _UTStatus.default;
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
+
Object.defineProperty(exports, "UTStatusMessage", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () {
|
|
327
|
+
return _UTStatusMessage.default;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
324
330
|
Object.defineProperty(exports, "UTSwitch", {
|
|
325
331
|
enumerable: true,
|
|
326
332
|
get: function () {
|
|
@@ -477,6 +483,7 @@ var _UTSelectableCard = _interopRequireDefault(require("./components/UTSelectabl
|
|
|
477
483
|
var _UTSidebar = _interopRequireDefault(require("./components/UTSidebar"));
|
|
478
484
|
var _UTSkeleton = _interopRequireDefault(require("./components/UTSkeleton"));
|
|
479
485
|
var _UTStatus = _interopRequireDefault(require("./components/UTStatus"));
|
|
486
|
+
var _UTStatusMessage = _interopRequireDefault(require("./components/UTStatusMessage"));
|
|
480
487
|
var _UTSwitch = _interopRequireDefault(require("./components/UTSwitch"));
|
|
481
488
|
var _UTTable = _interopRequireDefault(require("./components/UTTable"));
|
|
482
489
|
var _UTTabs = _interopRequireDefault(require("./components/UTTabs"));
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-empty.svg
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-happy.svg
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-sad.svg
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/components/UTRating/{components → versions/V0/components}/Faces/assets/mood-smile.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|