@widergy/energy-ui 3.123.1 → 3.125.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/UTActionCard/components/Header/index.js +1 -1
  3. package/dist/components/UTCalendar/components/Day/index.js +37 -0
  4. package/dist/components/UTCalendar/components/Day/styles.module.scss +36 -0
  5. package/dist/components/UTCalendar/components/TimeInput/index.js +39 -0
  6. package/dist/components/UTCalendar/components/TimeInput/styles.module.scss +12 -0
  7. package/dist/components/UTCalendar/constants.js +15 -0
  8. package/dist/components/UTCalendar/index.js +119 -0
  9. package/dist/components/UTCalendar/styles.module.scss +122 -0
  10. package/dist/components/UTLabel/README.md +7 -2
  11. package/dist/components/UTLabel/UTLabel.stories.js +13 -0
  12. package/dist/components/UTLabel/components/Markdown/components/BlockQuote/index.js +48 -0
  13. package/dist/components/UTLabel/components/Markdown/components/BlockQuote/styles.module.scss +16 -0
  14. package/dist/components/UTLabel/components/Markdown/components/Citation/index.js +28 -0
  15. package/dist/components/UTLabel/components/Markdown/components/CitationGroup/index.js +25 -0
  16. package/dist/components/UTLabel/components/Markdown/components/CitationGroup/styles.module.scss +22 -0
  17. package/dist/components/UTLabel/components/Markdown/components/Links/constants.js +8 -0
  18. package/dist/components/UTLabel/components/Markdown/components/Links/index.js +46 -0
  19. package/dist/components/UTLabel/components/Markdown/components/Links/styles.module.scss +3 -0
  20. package/dist/components/UTLabel/components/Markdown/components/ListItem/index.js +53 -0
  21. package/dist/components/UTLabel/components/Markdown/components/ListItem/styles.module.scss +22 -0
  22. package/dist/components/UTLabel/components/Markdown/components/Section/index.js +59 -0
  23. package/dist/components/UTLabel/components/Markdown/components/Section/styles.module.scss +13 -0
  24. package/dist/components/UTLabel/components/Markdown/components/WithCustomHandler/index.js +25 -0
  25. package/dist/components/UTLabel/components/Markdown/constants.js +66 -0
  26. package/dist/components/UTLabel/components/Markdown/customPlugins/remarkCitations.js +189 -0
  27. package/dist/components/UTLabel/components/Markdown/customPlugins/remarkDeflist.js +94 -0
  28. package/dist/components/UTLabel/components/Markdown/index.js +41 -0
  29. package/dist/components/UTLabel/components/Markdown/utils.js +39 -0
  30. package/dist/components/UTLabel/constants.js +3 -17
  31. package/dist/components/UTLabel/index.js +10 -15
  32. package/dist/components/UTLabel/theme.js +153 -3
  33. package/dist/components/UTRadioGroup/versions/V1/components/Radio/theme.js +1 -5
  34. package/dist/index.js +7 -0
  35. package/package.json +6 -2
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WEIGHTS = exports.VARIANTS_SIZES = exports.VARIANTS_LINE_HEIGHT = exports.VARIANTS = exports.MARKDOWN_RENDERERS = exports.DEFAULT_PROPS = void 0;
7
- var _react = _interopRequireDefault(require("react"));
6
+ exports.WEIGHTS = exports.VARIANTS_SIZES = exports.VARIANTS_LINE_HEIGHT = exports.VARIANTS = exports.DEFAULT_PROPS = void 0;
8
7
  var _Palette = require("../../constants/Palette");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
8
  const VARIANTS = exports.VARIANTS = {
11
9
  title1: 'h1',
12
10
  title2: 'h2',
@@ -54,23 +52,11 @@ const WEIGHTS = exports.WEIGHTS = {
54
52
  extrabold: 800,
55
53
  black: 900
56
54
  };
57
- const MARKDOWN_RENDERERS = exports.MARKDOWN_RENDERERS = {
58
- a: _ref => {
59
- let {
60
- href,
61
- children
62
- } = _ref;
63
- return /*#__PURE__*/_react.default.createElement("a", {
64
- href: href,
65
- rel: "noopener noreferrer",
66
- target: "_blank"
67
- }, children);
68
- }
69
- };
70
55
  const DEFAULT_PROPS = exports.DEFAULT_PROPS = {
71
56
  colorTheme: _Palette.COLOR_THEMES.dark,
72
57
  field: {},
73
- markdownRenderers: MARKDOWN_RENDERERS,
58
+ markdownExtended: false,
59
+ markdownRenderers: {},
74
60
  variant: 'body',
75
61
  weight: 'regular',
76
62
  withMarkdown: false
@@ -6,20 +6,16 @@ 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 _reactMarkdown = _interopRequireDefault(require("react-markdown"));
10
- var _remarkBreaks = _interopRequireDefault(require("remark-breaks"));
11
- var _rehypeRaw = _interopRequireDefault(require("rehype-raw"));
12
9
  var _classesUtils = require("../../utils/classesUtils");
13
10
  var _componentUtils = require("../../utils/componentUtils");
14
11
  var _UTSkeleton = _interopRequireDefault(require("../UTSkeleton"));
15
12
  var _WithTheme = _interopRequireDefault(require("../WithTheme"));
13
+ var _Markdown = _interopRequireDefault(require("./components/Markdown"));
16
14
  var _constants = require("./constants");
17
15
  var _theme = require("./theme");
18
16
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
21
- /* eslint-disable react/no-children-prop */
22
-
23
19
  const UTLabel = _ref => {
24
20
  let {
25
21
  align,
@@ -27,6 +23,7 @@ const UTLabel = _ref => {
27
23
  className,
28
24
  classes: theme,
29
25
  dataTestId,
26
+ markdownExtended,
30
27
  markdownRenderers,
31
28
  title,
32
29
  variant,
@@ -37,19 +34,16 @@ const UTLabel = _ref => {
37
34
  const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(theme, {
38
35
  className
39
36
  }), [theme, className]);
37
+ const componentClassname = "".concat(classes.root, " ").concat(withMarkdown ? classes.markdown : '', " ").concat(_stylesModule.default["".concat(align, "Alignment")] || '', " ").concat(classes.className);
40
38
  return /*#__PURE__*/_react.default.createElement(_UTSkeleton.default, null, /*#__PURE__*/_react.default.createElement(Component, {
41
- className: "".concat(classes.root, " ").concat(_stylesModule.default["".concat(align, "Alignment")] || '', " ").concat(classes.className).trim(),
39
+ className: componentClassname.trim(),
42
40
  "data-testid": dataTestId,
43
41
  title: title
44
- }, withMarkdown && /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
45
- children: children,
46
- components: markdownRenderers,
47
- disallowedElements: ['p', 'blockquote'],
48
- rehypePlugins: [_rehypeRaw.default],
49
- remarkPlugins: [_remarkBreaks.default],
50
- skipHtml: false,
51
- unwrapDisallowed: true
52
- }) || children));
42
+ }, withMarkdown && /*#__PURE__*/_react.default.createElement(_Markdown.default, {
43
+ classes: classes,
44
+ markdownExtended: markdownExtended,
45
+ markdownRenderers: markdownRenderers
46
+ }, children) || children));
53
47
  };
54
48
  UTLabel.defaultProps = _constants.DEFAULT_PROPS;
55
49
  UTLabel.propTypes = {
@@ -57,6 +51,7 @@ UTLabel.propTypes = {
57
51
  classes: (0, _propTypes.objectOf)(_propTypes.string),
58
52
  className: _propTypes.string,
59
53
  dataTestId: _propTypes.string,
54
+ markdownExtended: _propTypes.bool,
60
55
  markdownRenderers: (0, _propTypes.objectOf)(_propTypes.func),
61
56
  title: _propTypes.string,
62
57
  variant: _propTypes.string,
@@ -19,7 +19,7 @@ const variantsColorTheme = (colorTheme, shade, theme) => {
19
19
  const linkColor = (theme, colorTheme) => {
20
20
  var _theme$Palette;
21
21
  const actionPaletteColors = ((_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.actions) || theme.Palette;
22
- const color = colorTheme === _Palette.COLOR_THEMES.light ? actionPaletteColors.negative[_Palette.COLOR_SHADES.shade05] : colorTheme === _Palette.COLOR_THEMES.error ? actionPaletteColors.error[_Palette.COLOR_SHADES.shade05] : actionPaletteColors.neutral[_Palette.COLOR_SHADES.shade05];
22
+ const color = colorTheme === _Palette.COLOR_THEMES.light ? actionPaletteColors[_Palette.COLOR_THEMES.negative][_Palette.COLOR_SHADES.shade05] : colorTheme === _Palette.COLOR_THEMES.error ? actionPaletteColors[_Palette.COLOR_THEMES.error][_Palette.COLOR_SHADES.shade05] : actionPaletteColors[_Palette.COLOR_THEMES.accent][_Palette.COLOR_SHADES.shade05];
23
23
  return color;
24
24
  };
25
25
  const getFontStyles = _ref => {
@@ -51,6 +51,8 @@ const retrieveStyle = _ref2 => {
51
51
  weight,
52
52
  variantsSizes
53
53
  } = _ref2;
54
+ const darkTextColor = colorTheme === _Palette.COLOR_THEMES.light ? theme.Palette[_Palette.COLOR_THEMES.light][_Palette.COLOR_SHADES.shade01] : theme.Palette[_Palette.COLOR_THEMES.dark][_Palette.COLOR_SHADES.shade05];
55
+ const grayTextColor = colorTheme === _Palette.COLOR_THEMES.light ? theme.Palette[_Palette.COLOR_THEMES.light][_Palette.COLOR_SHADES.shade01] : theme.Palette[_Palette.COLOR_THEMES.gray][_Palette.COLOR_SHADES.shade04];
54
56
  return {
55
57
  root: {
56
58
  color: variantsColorTheme((_field$configuration$ = field === null || field === void 0 || (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.colorTheme) !== null && _field$configuration$ !== void 0 ? _field$configuration$ : colorTheme, (_field$configuration$2 = field === null || field === void 0 || (_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.shade) !== null && _field$configuration$2 !== void 0 ? _field$configuration$2 : shade, theme),
@@ -60,10 +62,158 @@ const retrieveStyle = _ref2 => {
60
62
  weight: (_field$configuration$4 = field === null || field === void 0 || (_field$configuration4 = field.configuration) === null || _field$configuration4 === void 0 ? void 0 : _field$configuration4.weight) !== null && _field$configuration$4 !== void 0 ? _field$configuration$4 : weight,
61
63
  variantsSizes
62
64
  }),
63
- margin: 0,
64
- '& > a': {
65
+ margin: 0
66
+ },
67
+ markdown: {
68
+ '& a': {
65
69
  color: linkColor(theme, colorTheme)
70
+ },
71
+ '& h1, & h2, & h3, & h4, & h5, & h6': {
72
+ color: darkTextColor,
73
+ fontWeight: _constants.WEIGHTS.medium,
74
+ lineHeight: 1,
75
+ margin: '0 0 8px 0'
76
+ },
77
+ '& h1': {
78
+ fontSize: '1.875em'
79
+ },
80
+ '& h2': {
81
+ fontSize: '1.5em'
82
+ },
83
+ '& h3': {
84
+ fontSize: '1.375em'
85
+ },
86
+ '& h4': {
87
+ fontSize: '1.125em'
88
+ },
89
+ '& h5': {
90
+ fontSize: '1em',
91
+ margin: '0 0 12px 0'
92
+ },
93
+ '& h6': {
94
+ color: grayTextColor,
95
+ fontSize: '1em',
96
+ margin: '0 0 12px 0'
97
+ },
98
+ '& table': {
99
+ border: "1px solid ".concat(theme.Palette[_Palette.COLOR_THEMES.light][_Palette.COLOR_SHADES.shade04]),
100
+ borderCollapse: 'collapse',
101
+ margin: '0 0 24px 0',
102
+ width: '100%'
103
+ },
104
+ '& th, & td': {
105
+ border: "1px solid ".concat(theme.Palette[_Palette.COLOR_THEMES.light][_Palette.COLOR_SHADES.shade04]),
106
+ padding: '8px 12px',
107
+ textAlign: 'left'
108
+ },
109
+ '& th': {
110
+ backgroundColor: (theme.Palette.actions || theme.Palette)[_Palette.COLOR_THEMES.negative][_Palette.COLOR_SHADES.shade01],
111
+ color: grayTextColor,
112
+ fontWeight: _constants.WEIGHTS.medium
113
+ },
114
+ '& p': {
115
+ margin: '0 0 12px 0'
116
+ },
117
+ '& ol': {
118
+ paddingLeft: 24,
119
+ textAlign: 'start'
120
+ },
121
+ '& ul, & ol': {
122
+ margin: '0 0 24px 0'
123
+ },
124
+ '& ul:not(.contains-task-list)': {
125
+ paddingLeft: 24,
126
+ textAlign: 'start'
127
+ },
128
+ '& pre': {
129
+ backgroundColor: theme.Palette[_Palette.COLOR_THEMES.light][_Palette.COLOR_SHADES.shade03],
130
+ borderRadius: 8,
131
+ fontSize: '0.875em',
132
+ lineHeight: '1.25em',
133
+ margin: '0 0 24px 0',
134
+ padding: '12px 16px',
135
+ whiteSpace: 'pre-wrap'
136
+ },
137
+ '& dl': {
138
+ margin: '0 0 24px 0'
139
+ },
140
+ '& dd': {
141
+ fontSize: 'inherit',
142
+ margin: 0
143
+ },
144
+ '& dt': {
145
+ color: grayTextColor,
146
+ fontSize: _constants.VARIANTS_SIZES.small,
147
+ fontWeight: _constants.WEIGHTS.semibold
148
+ },
149
+ '& dl + dl': {
150
+ marginTop: -12
151
+ },
152
+ '& dt + dt, & dt + dd, & dd + dd': {
153
+ marginTop: 12
154
+ },
155
+ '& hr': {
156
+ borderColor: theme.Palette[_Palette.COLOR_THEMES.gray][_Palette.COLOR_SHADES.shade01],
157
+ borderTop: 0,
158
+ margin: '8px 0 24px'
159
+ },
160
+ '& li + li': {
161
+ marginTop: 12
162
+ },
163
+ '& li > ul': {
164
+ marginTop: 8
165
+ },
166
+ '& li::marker': {
167
+ color: theme.Palette[_Palette.COLOR_THEMES.gray][_Palette.COLOR_SHADES.shade01]
168
+ },
169
+ '& li > ul > li + li': {
170
+ marginTop: 8
171
+ },
172
+ '& li p': {
173
+ margin: 0
174
+ },
175
+ '& sup': {
176
+ fontSize: 'inherit'
177
+ },
178
+ '& sup > a': {
179
+ fontSize: '0.75em'
180
+ },
181
+ '& img, & video, & audio': {
182
+ borderRadius: 8,
183
+ margin: '0 0 24px 0'
184
+ },
185
+ '& .contains-task-list': {
186
+ display: 'flex',
187
+ flexDirection: 'column',
188
+ gridGap: '12px',
189
+ margin: '0 0 24px 0',
190
+ paddingLeft: 0,
191
+ '& li': {
192
+ margin: 0
193
+ }
194
+ },
195
+ '& :last-child': {
196
+ marginBottom: '0'
66
197
  }
198
+ },
199
+ blockquote: {
200
+ color: grayTextColor,
201
+ '&::before': {
202
+ background: theme.Palette[_Palette.COLOR_THEMES.gray][_Palette.COLOR_SHADES.shade01]
203
+ }
204
+ },
205
+ citationGroup: {
206
+ '&::-webkit-scrollbar-thumb': {
207
+ backgroundColor: theme.Palette[_Palette.COLOR_THEMES.gray][_Palette.COLOR_SHADES.shade04]
208
+ }
209
+ },
210
+ customFootnotes: {
211
+ '& span': {
212
+ color: grayTextColor
213
+ }
214
+ },
215
+ taskItemIconUnchecked: {
216
+ borderColor: theme.Palette[_Palette.COLOR_THEMES.gray][_Palette.COLOR_SHADES.shade01]
67
217
  }
68
218
  };
69
219
  };
@@ -109,11 +109,7 @@ const retrieveStyle = _ref => {
109
109
  [_constants.SPACING.SMALL]: '8px',
110
110
  [_constants.SPACING.MEDIUM]: '16px'
111
111
  }[spacing],
112
- minHeight: {
113
- [_constants2.RADIO_VARIANTS.CARD]: '48px',
114
- [_constants2.RADIO_VARIANTS.BUTTON]: '24px',
115
- [_constants2.RADIO_VARIANTS.DEFAULT]: '24px'
116
- }[variant],
112
+ minHeight: '24px',
117
113
  overflow: 'hidden',
118
114
  padding: '12px 16px',
119
115
  ...(disabled ? disabledTheme : selected ? selectedTheme : baseTheme)
package/dist/index.js CHANGED
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "UTCBUInput", {
87
87
  return _UTCBUInput.default;
88
88
  }
89
89
  });
90
+ Object.defineProperty(exports, "UTCalendar", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _UTCalendar.default;
94
+ }
95
+ });
90
96
  Object.defineProperty(exports, "UTCaptcha", {
91
97
  enumerable: true,
92
98
  get: function () {
@@ -598,4 +604,5 @@ var _WithLoading = _interopRequireDefault(require("./components/WithLoading"));
598
604
  var _WithTouch = _interopRequireDefault(require("./components/WithTouch"));
599
605
  var _stylesDeduplicationUtils = _interopRequireDefault(require("./utils/stylesDeduplicationUtils"));
600
606
  var _useScrollBasedMenu = _interopRequireDefault(require("./utils/hooks/use-scroll-based-menu"));
607
+ var _UTCalendar = _interopRequireDefault(require("./components/UTCalendar"));
601
608
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.123.1",
3
+ "version": "3.125.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/eslint-parser": "^7.23.10",
34
+ "@date-io/date-fns": "^1.3.11",
34
35
  "@date-io/dayjs": "1.x",
35
36
  "@material-ui/core": "^4.4.0",
36
37
  "@material-ui/icons": "^3.0.1",
@@ -46,6 +47,7 @@
46
47
  "babel-plugin-inline-react-svg": "^2.0.2",
47
48
  "babel-plugin-named-asset-import": "^0.3.2",
48
49
  "d3": "^7.0.1",
50
+ "date-fns": "2.30.0",
49
51
  "dayjs": "^1.10.7",
50
52
  "downloadjs": "^1.4.7",
51
53
  "emojilib": "^3.0.10",
@@ -67,9 +69,11 @@
67
69
  "react-window": "^1.8.5",
68
70
  "rehype-raw": "^6.1.0",
69
71
  "remark-breaks": "^3.0.2",
72
+ "remark-gfm": "^3.0.1",
70
73
  "sass-loader": "^10.0.5",
71
74
  "sass": "^1.80.4",
72
- "seamless-immutable": "^7.1.4"
75
+ "seamless-immutable": "^7.1.4",
76
+ "unist-util-visit": "^4.0.0"
73
77
  },
74
78
  "devDependencies": {
75
79
  "@babel/cli": "^7.2.3",