@widergy/energy-ui 3.18.7 → 3.19.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/UTButtonGroup/README.md +10 -0
- package/dist/components/UTButtonGroup/constants.js +16 -0
- package/dist/components/UTButtonGroup/index.js +53 -0
- package/dist/components/UTButtonGroup/styles.module.scss +36 -0
- package/dist/components/UTButtonGroup/theme.js +20 -0
- package/dist/components/UTIcon/index.js +3 -2
- package/dist/components/UTIcon/styles.module.scss +3 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.19.0](https://github.com/widergy/energy-ui/compare/v3.18.8...v3.19.0) (2024-09-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* ut button group ([#488](https://github.com/widergy/energy-ui/issues/488)) ([ee41125](https://github.com/widergy/energy-ui/commit/ee41125452e6abc9ec5197221b842ae654552ac7))
|
|
7
|
+
|
|
8
|
+
## [3.18.8](https://github.com/widergy/energy-ui/compare/v3.18.7...v3.18.8) (2024-09-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* icon shrinking ([#489](https://github.com/widergy/energy-ui/issues/489)) ([4a929a0](https://github.com/widergy/energy-ui/commit/4a929a01d463ca9c31a40f7394692b1975041aad))
|
|
14
|
+
|
|
1
15
|
## [3.18.7](https://github.com/widergy/energy-ui/compare/v3.18.6...v3.18.7) (2024-09-16)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# UTButton
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Name | Type | Default | Description |
|
|
6
|
+
| ---------- | :-------------- | --------- | -------------------------------------------------------------------------------------- |
|
|
7
|
+
| actions | array | | Array of actions to render. Each action must include:`Icon`, `id` and `onClick` props. |
|
|
8
|
+
| colorTheme | string | 'primary' | The color theme to use. One of:`primary`, `secondary`, `negative`. |
|
|
9
|
+
| shape | string | 'square' | Type of the button. One of:`square`, `circle`. |
|
|
10
|
+
| selected | string / number | | Id of the active button. |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SQUARE_TYPE = exports.DEFAULT_TYPE = exports.DEFAULT_COLOR_THEME = exports.CIRCLE_TYPE = exports.BACKGROUND_COLOR_MAPPER = void 0;
|
|
7
|
+
const BACKGROUND_COLOR_MAPPER = theme => ({
|
|
8
|
+
primary: theme.lightBackground,
|
|
9
|
+
negative: theme.negativeBackground,
|
|
10
|
+
neutral: theme.lightBackground
|
|
11
|
+
});
|
|
12
|
+
exports.BACKGROUND_COLOR_MAPPER = BACKGROUND_COLOR_MAPPER;
|
|
13
|
+
const CIRCLE_TYPE = exports.CIRCLE_TYPE = 'circle';
|
|
14
|
+
const SQUARE_TYPE = exports.SQUARE_TYPE = 'square';
|
|
15
|
+
const DEFAULT_TYPE = exports.DEFAULT_TYPE = SQUARE_TYPE;
|
|
16
|
+
const DEFAULT_COLOR_THEME = exports.DEFAULT_COLOR_THEME = 'primary';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../UTButton"));
|
|
10
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
11
|
+
var _theme = require("./theme");
|
|
12
|
+
var _constants = require("./constants");
|
|
13
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
const UTButtonGroup = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
actions,
|
|
18
|
+
classes: theme,
|
|
19
|
+
colorTheme = _constants.DEFAULT_COLOR_THEME,
|
|
20
|
+
selected,
|
|
21
|
+
shape: type = _constants.DEFAULT_TYPE
|
|
22
|
+
} = _ref;
|
|
23
|
+
const backgroundColor = (0, _constants.BACKGROUND_COLOR_MAPPER)(theme)[colorTheme] || (0, _constants.BACKGROUND_COLOR_MAPPER)(theme).primary;
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
className: `${_stylesModule.default[`${type}Container`]} ${backgroundColor}`
|
|
26
|
+
}, actions.map(_ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
Icon,
|
|
29
|
+
id,
|
|
30
|
+
onClick
|
|
31
|
+
} = _ref2;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
33
|
+
colorTheme: colorTheme,
|
|
34
|
+
Icon: Icon,
|
|
35
|
+
key: id,
|
|
36
|
+
onClick: onClick,
|
|
37
|
+
size: "large",
|
|
38
|
+
variant: selected === id ? 'filled' : 'text'
|
|
39
|
+
});
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
UTButtonGroup.propTypes = {
|
|
43
|
+
actions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
44
|
+
Icon: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.element]),
|
|
45
|
+
id: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
46
|
+
onClick: _propTypes.func
|
|
47
|
+
})).isRequired,
|
|
48
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
49
|
+
colorTheme: _propTypes.string,
|
|
50
|
+
selected: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]).isRequired,
|
|
51
|
+
shape: _propTypes.string
|
|
52
|
+
};
|
|
53
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTButtonGroup);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
$default-border-radius: 8px;
|
|
2
|
+
$square-border-radius: calc(#{$default-border-radius} - 1px);
|
|
3
|
+
$rounded-border-radius: 100px;
|
|
4
|
+
|
|
5
|
+
%container {
|
|
6
|
+
display: flex;
|
|
7
|
+
width: fit-content;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.squareContainer {
|
|
11
|
+
@extend %container;
|
|
12
|
+
border-radius: $default-border-radius;
|
|
13
|
+
|
|
14
|
+
& > button {
|
|
15
|
+
border-radius: 0 !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
& > button:first-child {
|
|
19
|
+
border-bottom-left-radius: $square-border-radius !important;
|
|
20
|
+
border-top-left-radius: $square-border-radius !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
& > button:last-child {
|
|
24
|
+
border-bottom-right-radius: $square-border-radius !important;
|
|
25
|
+
border-top-right-radius: $square-border-radius !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.circleContainer {
|
|
30
|
+
@extend %container;
|
|
31
|
+
border-radius: $rounded-border-radius;
|
|
32
|
+
|
|
33
|
+
& > button {
|
|
34
|
+
border-radius: $rounded-border-radius !important;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
lightBackground: {
|
|
13
|
+
backgroundColor: theme.Palette.light['03']
|
|
14
|
+
},
|
|
15
|
+
negativeBackground: {
|
|
16
|
+
backgroundColor: theme.Palette.actions?.negative['02'] || theme.Palette.negative['02']
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.retrieveStyle = retrieveStyle;
|
|
@@ -8,8 +8,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var TablerIcons = _interopRequireWildcard(require("@tabler/icons-react"));
|
|
10
10
|
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
11
|
-
var _theme = require("./theme");
|
|
12
11
|
var _constants = require("./constants");
|
|
12
|
+
var _theme = require("./theme");
|
|
13
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
15
|
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; }
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -39,7 +40,7 @@ const UTIcon = _ref => {
|
|
|
39
40
|
const IconComponent = _constants.ENERGY_ICONS[name] || TablerIcons[name];
|
|
40
41
|
if (!IconComponent) return null;
|
|
41
42
|
return /*#__PURE__*/_react.default.createElement(IconComponent, _extends({
|
|
42
|
-
className: className
|
|
43
|
+
className: `${className} ${_stylesModule.default.icon}`
|
|
43
44
|
}, iconProps));
|
|
44
45
|
};
|
|
45
46
|
UTIcon.propTypes = {
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "UTButton", {
|
|
|
69
69
|
return _UTButton.default;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "UTButtonGroup", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _UTButtonGroup.default;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "UTCBUInput", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function () {
|
|
@@ -411,6 +417,7 @@ var _UTBadge = _interopRequireDefault(require("./components/UTBadge"));
|
|
|
411
417
|
var _UTBarChart = _interopRequireDefault(require("./components/UTBarChart"));
|
|
412
418
|
var _UTBreadcrumbs = _interopRequireDefault(require("./components/UTBreadcrumbs"));
|
|
413
419
|
var _UTButton = _interopRequireDefault(require("./components/UTButton"));
|
|
420
|
+
var _UTButtonGroup = _interopRequireDefault(require("./components/UTButtonGroup"));
|
|
414
421
|
var _UTCaptcha = _interopRequireDefault(require("./components/UTCaptcha"));
|
|
415
422
|
var _UTCard = _interopRequireDefault(require("./components/UTCard"));
|
|
416
423
|
var _UTCarousel = _interopRequireDefault(require("./components/UTCarousel"));
|