@widergy/energy-ui 3.161.0 → 3.162.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.
@@ -1,7 +1,151 @@
1
1
  .bannerContainer {
2
- align-items: center;
3
- display: flex;
4
- flex-direction: row;
5
- grid-gap: 16px;
6
- padding: 16px;
2
+ align-items: flex-start;
3
+ border-radius: var(--UT-banner-radius, 8px);
4
+ display: flex;
5
+ flex-direction: row;
6
+ }
7
+
8
+ .contentContainer {
9
+ display: flex;
10
+ flex: 1;
11
+ }
12
+
13
+ .contentHorizontal {
14
+ align-items: flex-start;
15
+ flex-direction: row;
16
+ }
17
+
18
+ .contentVertical {
19
+ flex-direction: column;
20
+ }
21
+
22
+ .iconTextContainer {
23
+ display: flex;
24
+ grid-gap: var(--UT-banner-icon-gap, 12px);
25
+ }
26
+
27
+ .iconHorizontal {
28
+ align-items: flex-start;
29
+ flex-direction: row;
30
+ }
31
+
32
+ .iconVertical {
33
+ flex-direction: column;
34
+ }
35
+
36
+ .iconFlex {
37
+ flex: 1;
38
+ }
39
+
40
+ .textContainer {
41
+ display: flex;
42
+ flex-direction: column;
43
+ grid-gap: var(--UT-banner-text-gap, 8px);
44
+ }
45
+
46
+ .textFlex {
47
+ flex: 1;
48
+ }
49
+
50
+ .buttonsContainer {
51
+ display: flex;
52
+ flex-direction: row;
53
+ flex-wrap: wrap;
54
+ grid-gap: var(--UT-banner-buttons-gap, 8px);
55
+ }
56
+
57
+ .buttonsVertical {
58
+ align-self: flex-start;
59
+ }
60
+
61
+ .gapSmall {
62
+ grid-gap: var(--UT-banner-gap-sm, 8px);
63
+ }
64
+
65
+ .gapMedium {
66
+ grid-gap: var(--UT-banner-gap-md, 16px);
67
+ }
68
+
69
+ .gapLarge {
70
+ grid-gap: var(--UT-banner-gap-lg, 24px);
71
+ }
72
+
73
+ .paddingSmall {
74
+ padding: var(--UT-banner-padding-y-sm, 8px) var(--UT-banner-padding-x-sm, 12px);
75
+ }
76
+
77
+ .paddingMedium {
78
+ padding: var(--UT-banner-padding-md, 16px);
79
+ }
80
+
81
+ .paddingLarge {
82
+ padding: var(--UT-banner-padding-lg, 24px);
83
+ }
84
+
85
+ .errorLight {
86
+ background-color: var(--actionError01);
87
+ }
88
+
89
+ .errorDark {
90
+ background-color: var(--actionError04);
91
+ }
92
+
93
+ .grayLight {
94
+ background-color: var(--light02);
95
+ }
96
+
97
+ .grayDark {
98
+ background-color: var(--gray05);
99
+ }
100
+
101
+ .informationLight {
102
+ background-color: var(--semanticInformation01);
103
+ }
104
+
105
+ .informationDark {
106
+ background-color: var(--semanticInformation04);
107
+ }
108
+
109
+ .negativeLight {
110
+ background-color: var(--actionNegative02);
111
+ }
112
+
113
+ .negativeDark {
114
+ background-color: var(--actionNegative04);
115
+ }
116
+
117
+ .primaryLight {
118
+ background-color: var(--actionAccent01);
119
+ }
120
+
121
+ .primaryDark {
122
+ background-color: var(--actionAccent04);
123
+ }
124
+
125
+ .successLight {
126
+ background-color: var(--semanticSuccess01);
127
+ }
128
+
129
+ .successDark {
130
+ background-color: var(--semanticSuccess04);
131
+ }
132
+
133
+ .warningLight {
134
+ background-color: var(--semanticWarning01);
135
+ }
136
+
137
+ .warningDark {
138
+ background-color: var(--semanticWarning04);
139
+ }
140
+
141
+ .whiteLight {
142
+ background-color: var(--light01);
143
+ }
144
+
145
+ .whiteDark {
146
+ background-color: var(--dark04);
147
+ }
148
+
149
+ .uppercase {
150
+ text-transform: uppercase;
7
151
  }
@@ -0,0 +1,14 @@
1
+ import { bool, func, node, oneOfType, shape, string } from 'prop-types';
2
+ export const buttonType = shape({
3
+ colorTheme: string,
4
+ dataTestId: string,
5
+ disabled: bool,
6
+ Icon: oneOfType([string, func]),
7
+ iconPlacement: string,
8
+ loading: bool,
9
+ onClick: func,
10
+ size: string,
11
+ title: node,
12
+ type: string,
13
+ variant: string
14
+ });
@@ -0,0 +1,137 @@
1
+ import { COLOR_THEMES, SIZES, VARIANTS } from './constants';
2
+
3
+ /**
4
+ * Returns the default UTIcon colorTheme and shade for the banner icon based on the
5
+ * banner's colorTheme and variant. Matches the mobile implementation.
6
+ * @param {string} colorTheme - Banner color theme.
7
+ * @param {string} variant - Banner variant ('light' | 'dark').
8
+ * @returns {{ colorTheme: string, shade: string }}
9
+ */
10
+ export const getDefaultIconTheme = (colorTheme, variant) => {
11
+ var _COLOR_THEMES$ERROR$C;
12
+ if (variant === VARIANTS.DARK) {
13
+ return colorTheme === COLOR_THEMES.NEGATIVE ? {
14
+ colorTheme: 'dark',
15
+ shade: '05'
16
+ } : {
17
+ colorTheme: 'light',
18
+ shade: '01'
19
+ };
20
+ }
21
+ return (_COLOR_THEMES$ERROR$C = {
22
+ [COLOR_THEMES.ERROR]: {
23
+ colorTheme: 'error',
24
+ shade: '04'
25
+ },
26
+ [COLOR_THEMES.GRAY]: {
27
+ colorTheme: 'accent',
28
+ shade: '04'
29
+ },
30
+ [COLOR_THEMES.INFORMATION]: {
31
+ colorTheme: 'information',
32
+ shade: '04'
33
+ },
34
+ [COLOR_THEMES.NEGATIVE]: {
35
+ colorTheme: 'light',
36
+ shade: '01'
37
+ },
38
+ [COLOR_THEMES.PRIMARY]: {
39
+ colorTheme: 'accent',
40
+ shade: '04'
41
+ },
42
+ [COLOR_THEMES.SUCCESS]: {
43
+ colorTheme: 'success',
44
+ shade: '04'
45
+ },
46
+ [COLOR_THEMES.WARNING]: {
47
+ colorTheme: 'warning',
48
+ shade: '04'
49
+ },
50
+ [COLOR_THEMES.WHITE]: {
51
+ colorTheme: 'accent',
52
+ shade: '04'
53
+ }
54
+ }[colorTheme]) !== null && _COLOR_THEMES$ERROR$C !== void 0 ? _COLOR_THEMES$ERROR$C : {
55
+ colorTheme: 'accent',
56
+ shade: '04'
57
+ };
58
+ };
59
+
60
+ /**
61
+ * Returns the default icon size in pixels based on the banner size.
62
+ * @param {string} size - One of SIZES values.
63
+ * @returns {number}
64
+ */
65
+ export const getDefaultIconSize = size => size === SIZES.LARGE ? 24 : 20;
66
+
67
+ /**
68
+ * Returns the default colorTheme for buttons and the close button based on the
69
+ * banner variant. Dark variant uses 'negative'; light variant uses standard colors.
70
+ * @param {string} variant - Banner variant ('light' | 'dark').
71
+ * @returns {{ button: string, onClose: string, secondaryButton: string }}
72
+ */
73
+ export const getDefaultButtonColorTheme = variant => {
74
+ const isDark = variant === VARIANTS.DARK;
75
+ return {
76
+ button: isDark ? 'negative' : 'secondary',
77
+ onClose: isDark ? 'negative' : 'gray',
78
+ secondaryButton: isDark ? 'negative' : 'secondary'
79
+ };
80
+ };
81
+
82
+ /**
83
+ * Returns the UTLabel variant and weight for the main text (children) based on
84
+ * the banner size.
85
+ * @param {string} size - One of SIZES values.
86
+ * @returns {{ variant: string, weight: string }}
87
+ */
88
+ export const getLabelStyles = size => {
89
+ var _SIZES$LARGE$SIZES$ME;
90
+ return (_SIZES$LARGE$SIZES$ME = {
91
+ [SIZES.LARGE]: {
92
+ titleVariant: 'title3',
93
+ descriptionVariant: 'body'
94
+ },
95
+ [SIZES.MEDIUM]: {
96
+ titleVariant: 'subtitle1',
97
+ descriptionVariant: 'small'
98
+ },
99
+ [SIZES.SMALL]: {
100
+ titleVariant: 'small',
101
+ descriptionVariant: 'small'
102
+ }
103
+ }[size]) !== null && _SIZES$LARGE$SIZES$ME !== void 0 ? _SIZES$LARGE$SIZES$ME : {
104
+ titleVariant: 'small',
105
+ descriptionVariant: 'small'
106
+ };
107
+ };
108
+
109
+ /**
110
+ * Returns the UTLabel colorTheme for the banner's main text content based on the
111
+ * banner's colorTheme and variant. Negative+light and any dark variant use light
112
+ * (white) text; all other combinations use dark text.
113
+ * @param {string} colorTheme - Banner color theme.
114
+ * @param {string} variant - Banner variant ('light' | 'dark').
115
+ * @returns {string} UTLabel colorTheme value.
116
+ */
117
+ export const getLabelColorTheme = (colorTheme, variant) => {
118
+ if (colorTheme === COLOR_THEMES.NEGATIVE) {
119
+ return variant === VARIANTS.LIGHT ? 'light' : 'dark';
120
+ }
121
+ return variant === VARIANTS.LIGHT ? 'dark' : 'light';
122
+ };
123
+
124
+ /**
125
+ * Returns the UTLabel colorTheme for the banner's secondary text content based on the
126
+ * banner's colorTheme and variant. Negative+light and any dark variant use light
127
+ * (white) text; all other combinations use gray text.
128
+ * @param {string} colorTheme - Banner color theme.
129
+ * @param {string} variant - Banner variant ('light' | 'gray').
130
+ * @returns {string} UTLabel colorTheme value.
131
+ */
132
+ export const getSecondaryLabelColorTheme = (colorTheme, variant) => {
133
+ if (colorTheme === COLOR_THEMES.NEGATIVE) {
134
+ return variant === VARIANTS.LIGHT ? 'light' : 'gray';
135
+ }
136
+ return variant === VARIANTS.LIGHT ? 'gray' : 'light';
137
+ };
@@ -1,4 +1,4 @@
1
- import React, { Fragment, useEffect, useMemo, useRef, useState } from 'react';
1
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import * as d3 from 'd3';
3
3
  import { array, object, objectOf, string } from 'prop-types';
4
4
  import { mergeMultipleClassNames } from '../../utils/classesUtils';
@@ -168,7 +168,7 @@ const UTGraph = _ref => {
168
168
  crossAxisLeft,
169
169
  crossAxisRight
170
170
  } = _ref2;
171
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Bars, {
171
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Bars, {
172
172
  crossAxisLeft: crossAxisLeft,
173
173
  crossAxisRight: crossAxisRight,
174
174
  dataset: dataset,
@@ -146,8 +146,9 @@ const UTHeader = _ref => {
146
146
  height: BANNER_ICON_SIZE,
147
147
  width: BANNER_ICON_SIZE
148
148
  },
149
- Icon: banner.Icon
150
- }, banner.text)));
149
+ Icon: banner.Icon,
150
+ title: banner.text
151
+ })));
151
152
  };
152
153
  UTHeader.propTypes = {
153
154
  actions: arrayOf(object),
@@ -47,6 +47,7 @@ export const ID_CONSTANTS = {
47
47
  PINNED: 'pinned',
48
48
  POPPER: 'popper',
49
49
  SEARCH_BUTTON: 'searchButton',
50
+ SECONDARY_ACTION: 'secondaryAction',
50
51
  SEARCH_BUTTON_TOOLTIP: 'searchButtonTooltip',
51
52
  SEARCH_FIELD: 'searchField',
52
53
  SELECTION_COMPONENT: 'selectionComponent',
@@ -54,6 +55,7 @@ export const ID_CONSTANTS = {
54
55
  SIDEBAR_BUTTON: 'sidebarButton',
55
56
  STATUS_MESSAGE: 'statusMessage',
56
57
  TABLE: 'table',
58
+ TERTIARY_ACTION: 'tertiaryAction',
57
59
  TABLE_ROW: 'tableRow',
58
60
  TITLE: 'title',
59
61
  USER_FILTER: 'userFilter',
package/dist/esm/index.js CHANGED
@@ -9,6 +9,7 @@ import AttachmentContainer from './deprecated/UTAttachment';
9
9
  import UTAutocomplete from './deprecated/UTAutocomplete';
10
10
  import UTAvatar from './components/UTAvatar';
11
11
  import UTBadge from './components/UTBadge';
12
+ import UTBanner from './components/UTBanner';
12
13
  import UTBarChart from './deprecated/UTBarChart';
13
14
  import UTBreadcrumbs from './components/UTBreadcrumbs';
14
15
  import UTButton from './components/UTButton';
@@ -106,4 +107,4 @@ export { UTList };
106
107
  export { UTPieChart };
107
108
  /** @deprecated */
108
109
  export { UTToggle };
109
- export { AlertHandler, componentUtils, ThemeProvider as EnergyThemeProvider, keyboardUtils, stylesDeduplicationUtils, useCSSVariables, UTCalendar, UTActionCard, UTAlert, UTAttachmentList, UTAvatar, UTBadge, UTBreadcrumbs, UTButton, UTButtonGroup, UTCaptcha, UTCarousel, UTCBUInput, UTCheckbox, UTCheckList, UTChip, UTConsumptionBar, UTCreditCard, UTCuit, UTDataCategory, UTDataElement, UTDatePicker, UTDocumentWizard, UTDotMenu, UTEmojiPicker, UTExternalLink, UTFileInputContainer as UTFileInput, UTShortcutPanel, UTGoogleAutocomplete, UTGraph, UTIcon, UTImageRadio, UTKpi, UTLabel, UTLoading, UTMap, UTMenu, UTModal, UTOnboarding, UTPagination, UTPanel, UTPasswordField, UTPhoneInput, UTPopper, UTPopUp, UTProductItem, UTProgressBar, UTRadioGroup, UTRatingContainer as UTRating, UTSearchField, UTSelect, UTSelectableCard, UTSidebar, UTSignature, Skeleton as UTSkeleton, UTStatus, UTStatusMessage, UTSwitch, UTTable, UTTabs, UTTextArea, UTTextInput, UTThirdPartyCookieChecker, UTTooltip, UTTopbar, UTTouchableWithoutFeedback, UTTracker, UTValidation, UTVirtualizedList, UTVirtualKeyboard, UTWorkflowContainer, UTWrapperObservation, WithLoading, WithTouch, useScrollBasedMenu };
110
+ export { AlertHandler, componentUtils, ThemeProvider as EnergyThemeProvider, keyboardUtils, stylesDeduplicationUtils, useCSSVariables, UTCalendar, UTActionCard, UTAlert, UTAttachmentList, UTAvatar, UTBadge, UTBanner, UTBreadcrumbs, UTButton, UTButtonGroup, UTCaptcha, UTCarousel, UTCBUInput, UTCheckbox, UTCheckList, UTChip, UTConsumptionBar, UTCreditCard, UTCuit, UTDataCategory, UTDataElement, UTDatePicker, UTDocumentWizard, UTDotMenu, UTEmojiPicker, UTExternalLink, UTFileInputContainer as UTFileInput, UTShortcutPanel, UTGoogleAutocomplete, UTGraph, UTIcon, UTImageRadio, UTKpi, UTLabel, UTLoading, UTMap, UTMenu, UTModal, UTOnboarding, UTPagination, UTPanel, UTPasswordField, UTPhoneInput, UTPopper, UTPopUp, UTProductItem, UTProgressBar, UTRadioGroup, UTRatingContainer as UTRating, UTSearchField, UTSelect, UTSelectableCard, UTSidebar, UTSignature, Skeleton as UTSkeleton, UTStatus, UTStatusMessage, UTSwitch, UTTable, UTTabs, UTTextArea, UTTextInput, UTThirdPartyCookieChecker, UTTooltip, UTTopbar, UTTouchableWithoutFeedback, UTTracker, UTValidation, UTVirtualizedList, UTVirtualKeyboard, UTWorkflowContainer, UTWrapperObservation, WithLoading, WithTouch, useScrollBasedMenu };
@@ -163,6 +163,19 @@ export const baseTokens = {
163
163
  'radius-xl': 'radius-500'
164
164
  },
165
165
  component: {
166
+ 'UT-banner-buttons-gap': 'gap-sm',
167
+ 'UT-banner-gap-lg': 'gap-xl',
168
+ 'UT-banner-gap-md': 'gap-lg',
169
+ 'UT-banner-gap-sm': 'gap-sm',
170
+ 'UT-banner-icon-gap': 'gap-md',
171
+ 'UT-banner-icon-size-lg': 'size-icon-md',
172
+ 'UT-banner-icon-size-sm': 'size-icon-xs',
173
+ 'UT-banner-padding-lg': 'padding-lg',
174
+ 'UT-banner-padding-md': 'padding-md',
175
+ 'UT-banner-padding-x-sm': 'padding-sm',
176
+ 'UT-banner-padding-y-sm': 'padding-xs',
177
+ 'UT-banner-radius': 'radius-md',
178
+ 'UT-banner-text-gap': 'gap-sm',
166
179
  'UT-button-height-sm': 'size-control-sm',
167
180
  'UT-button-height-md': 'size-control-md',
168
181
  'UT-button-height-lg': 'size-control-lg',
package/dist/index.js CHANGED
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "UTBadge", {
57
57
  return _UTBadge.default;
58
58
  }
59
59
  });
60
+ Object.defineProperty(exports, "UTBanner", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _UTBanner.default;
64
+ }
65
+ });
60
66
  Object.defineProperty(exports, "UTBarChart", {
61
67
  enumerable: true,
62
68
  get: function () {
@@ -548,6 +554,7 @@ var _UTAttachment = _interopRequireDefault(require("./deprecated/UTAttachment"))
548
554
  var _UTAutocomplete = _interopRequireDefault(require("./deprecated/UTAutocomplete"));
549
555
  var _UTAvatar = _interopRequireDefault(require("./components/UTAvatar"));
550
556
  var _UTBadge = _interopRequireDefault(require("./components/UTBadge"));
557
+ var _UTBanner = _interopRequireDefault(require("./components/UTBanner"));
551
558
  var _UTBarChart = _interopRequireDefault(require("./deprecated/UTBarChart"));
552
559
  var _UTBreadcrumbs = _interopRequireDefault(require("./components/UTBreadcrumbs"));
553
560
  var _UTButton = _interopRequireDefault(require("./components/UTButton"));
@@ -169,6 +169,19 @@ const baseTokens = exports.baseTokens = {
169
169
  'radius-xl': 'radius-500'
170
170
  },
171
171
  component: {
172
+ 'UT-banner-buttons-gap': 'gap-sm',
173
+ 'UT-banner-gap-lg': 'gap-xl',
174
+ 'UT-banner-gap-md': 'gap-lg',
175
+ 'UT-banner-gap-sm': 'gap-sm',
176
+ 'UT-banner-icon-gap': 'gap-md',
177
+ 'UT-banner-icon-size-lg': 'size-icon-md',
178
+ 'UT-banner-icon-size-sm': 'size-icon-xs',
179
+ 'UT-banner-padding-lg': 'padding-lg',
180
+ 'UT-banner-padding-md': 'padding-md',
181
+ 'UT-banner-padding-x-sm': 'padding-sm',
182
+ 'UT-banner-padding-y-sm': 'padding-xs',
183
+ 'UT-banner-radius': 'radius-md',
184
+ 'UT-banner-text-gap': 'gap-sm',
172
185
  'UT-button-height-sm': 'size-control-sm',
173
186
  'UT-button-height-md': 'size-control-md',
174
187
  'UT-button-height-lg': 'size-control-lg',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.161.0",
3
+ "version": "3.162.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.retrieveStyle = void 0;
7
- const retrieveStyle = _ref => {
8
- var _theme$Palette;
9
- let {
10
- theme
11
- } = _ref;
12
- return {
13
- infoContainer: {
14
- backgroundColor: (_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.light['03']
15
- }
16
- };
17
- };
18
- exports.retrieveStyle = retrieveStyle;
@@ -1,11 +0,0 @@
1
- export const retrieveStyle = _ref => {
2
- var _theme$Palette;
3
- let {
4
- theme
5
- } = _ref;
6
- return {
7
- infoContainer: {
8
- backgroundColor: (_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.light['03']
9
- }
10
- };
11
- };