Skip to content

Commit 84a3f90

Browse files
feat(Framework): update to ui5-webcomponents-rc.6 (#392)
For Features, please look at the [UI5 Web Components Changelog](https://github.com/SAP/ui5-webcomponents/blob/master/CHANGELOG.md#100-rc6-2020-03-27). BREAKING CHANGE: Replace Avatar Component with `Avatar` UI5 Web Component BREAKING CHANGE: Replace Carousel Component with `Carousel` UI5 Web Component BREAKING CHANGE: Replace SegmentedButton Component with `SegmentedButton` UI5 Web Component BREAKING CHANGE: Deleted SegmentedButtonItem, replaced by ToggleButton BREAKING CHANGE: Remove MessageToast Component, replaced by `Toast` UI5 Web Component BREAKING CHANGE: **ThemeProvider**: Remove prop `withToastContainer` BREAKING CHANGE: **AvatarSize**: Remove value `Custom` BREAKING CHANGE: **ButtonDesign**: Rename`Accept` to `Positive` BREAKING CHANGE: **ButtonDesign**: Rename`Reject` to `Negative` BREAKING CHANGE: **InputType**: Rename `Url` to `URL` BREAKING CHANGE: **CarouselArrowsPlacement**: Rename `PageIndicator` to `Navigation` BREAKING CHANGE:**BusyIndicator** : change default size of busy dots to `Medium` BREAKING CHANGE:**Icon** : `src` property is removed in favor of `name` BREAKING CHANGE:**MessageStrip** : replace icon property with icon slot to allow setting arbitrary content by the user BREAKING CHANGE:**MultiComboBox** : Does not longer accept `StandardListItem` as child, use `MultiComboBoxItem` instead BREAKING CHANGE:**ShellBar** : profile property is removed in favour of profile slot BREAKING CHANGE:**TabContainer** : `onItemSelect` event is renamed to `onTabSelect` and the item event parameter is renamed to tab. BREAKING CHANGE:**Card** : the property `subtitle` has been renamed to `subheading` BREAKING CHANGE:**TextArea** : the property `maxLength` has been renamed to `maxlength` BREAKING CHANGE:**ThemeProvider** : new prop `theme` is required for correct theming in addition to importing `import '@ui5/webcomponents-react/lib/ThemingSupport'` BREAKING CHANGE: configuring of compact size is removed, use the `ui5-content-density-compact` CSS class to apply compact size. Closes #349
1 parent e0ea6d6 commit 84a3f90

File tree

300 files changed

+4581
-6934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+4581
-6934
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
camelcase: [
6969
'error',
7070
{
71-
allow: ['sap_fiori_3', 'sap_fiori_3_dark']
71+
allow: ['sap_fiori_3', 'sap_fiori_3_dark', 'sap_belize', 'sap_belize_hcb', 'sap_belize_hcw']
7272
}
7373
],
7474
'comma-dangle': 'error',

.storybook/manager.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,11 @@ addons.setConfig({
3232
* sidebar tree animations
3333
* @type {Boolean}
3434
*/
35-
sidebarAnimations: true
35+
sidebarAnimations: true,
36+
37+
/**
38+
* enable/disable shortcuts
39+
* @type {Boolean}
40+
*/
41+
enableShortcuts: false
3642
});

.storybook/preview.js

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { makeDecorator } from '@storybook/addons';
33
import { addDecorator, addParameters } from '@storybook/react';
44
import { setTheme } from '@ui5/webcomponents-base/dist/config/Theme';
55
import '@ui5/webcomponents-base/dist/features/browsersupport/IE11';
6-
import '@ui5/webcomponents-fiori/dist/json-imports/Themes';
6+
import '@ui5/webcomponents-fiori/dist/generated/json-imports/Themes';
77
import '@ui5/webcomponents-react-base/polyfill/IE11';
88
import { ContentDensity } from '@ui5/webcomponents-react/lib/ContentDensity';
99
import { ThemeProvider } from '@ui5/webcomponents-react/lib/ThemeProvider';
1010
import { Themes } from '@ui5/webcomponents-react/lib/Themes';
11-
import '@ui5/webcomponents/dist/json-imports/i18n';
12-
import '@ui5/webcomponents/dist/json-imports/Themes';
11+
import '@ui5/webcomponents-react/lib/ThemingSupport';
12+
import '@ui5/webcomponents-theme-base/dist/Assets';
13+
import '@ui5/webcomponents/dist/features/InputElementsFormSupport';
14+
import '@ui5/webcomponents/dist/generated/json-imports/i18n';
15+
import '@ui5/webcomponents/dist/generated/json-imports/Themes';
1316
import '@webcomponents/webcomponentsjs/webcomponents-bundle';
14-
import { window } from 'global';
15-
import 'highlight.js/styles/solarized-dark.css';
16-
import qs from 'qs';
1717
import React, { useEffect } from 'react';
1818
import 'react-app-polyfill/ie11';
1919

@@ -30,14 +30,14 @@ addParameters({
3030

3131
addDecorator(withKnobs);
3232

33-
const ThemeContainer = ({ theme, contentDensity, children, setQueryParam, direction }) => {
33+
const ThemeContainer = ({ theme, contentDensity, children, direction }) => {
3434
useEffect(() => {
3535
if (contentDensity === ContentDensity.Compact) {
3636
document.body.classList.add('ui5-content-density-compact');
3737
} else {
3838
document.body.classList.remove('ui5-content-density-compact');
3939
}
40-
}, [contentDensity, setQueryParam]);
40+
}, [contentDensity]);
4141

4242
useEffect(() => {
4343
document.querySelector('html').setAttribute('dir', direction.toLowerCase());
@@ -47,53 +47,23 @@ const ThemeContainer = ({ theme, contentDensity, children, setQueryParam, direct
4747
setTheme(theme);
4848
}, [theme]);
4949

50-
return children;
50+
return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
5151
};
5252

5353
const withQuery = makeDecorator({
54-
name: 'withQuery',
55-
parameterName: 'query',
54+
name: 'themr',
55+
parameterName: 'themr',
5656
wrapper: (getStory, context) => {
57-
function setQueryParam(queryObj) {
58-
const iframe = window.parent.document.getElementById('storybook-preview-iframe');
59-
const [base, search] = iframe.src.split('?');
60-
const currentQuery = qs.parse(search, { ignoreQueryPrefix: true });
61-
iframe.src = `${base}?${qs.stringify({ ...currentQuery, ...queryObj })}`;
62-
}
63-
64-
let contentDensity;
65-
try {
66-
const iframe = window.parent.document.getElementById('storybook-preview-iframe');
67-
const currentQuery = qs.parse(iframe.src.split('?')[1]);
68-
contentDensity =
69-
currentQuery['sap-ui-compactSize'] && currentQuery['sap-ui-compactSize'] !== 'false'
70-
? ContentDensity.Compact
71-
: ContentDensity.Cozy;
72-
} catch (e) {
73-
contentDensity = ContentDensity.Compact;
74-
}
75-
7657
return (
7758
<ThemeContainer
78-
theme={select('Theme', [Themes.sap_fiori_3, Themes.sap_fiori_3_dark], Themes.sap_fiori_3)}
79-
contentDensity={select('ContentDensity', ContentDensity, contentDensity)}
59+
theme={select('Theme', Themes, Themes.sap_fiori_3)}
60+
contentDensity={select('ContentDensity', ContentDensity, ContentDensity.Cozy)}
8061
direction={select('Text Direction', ['LTR', 'RTL'], 'LTR')}
81-
setQueryParam={setQueryParam}
8262
>
8363
{getStory(context)}
8464
</ThemeContainer>
8565
);
8666
}
8767
});
8868

89-
const themr = makeDecorator({
90-
name: 'themr',
91-
parameterName: 'themr',
92-
skipIfNoParametersOrOptions: false,
93-
wrapper: (getStory, context) => {
94-
return <ThemeProvider withToastContainer>{getStory(context)}</ThemeProvider>;
95-
}
96-
});
97-
9869
addDecorator(withQuery);
99-
addDecorator(themr);

config/jestsetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Adapter from 'enzyme-adapter-react-16';
55
import { createSerializer } from 'enzyme-to-json';
66
import ResizeObserver from 'resize-observer-polyfill';
77
import 'intersection-observer';
8-
import '@ui5/webcomponents/dist/json-imports/i18n';
8+
import '@ui5/webcomponents/dist/generated/json-imports/i18n';
99

1010
process.env.NODE_ENV = 'test';
1111
process.env.BABEL_ENV = 'test';

docs/welcome/Welcome.stories.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,27 @@ Then, you can use the Button in your app:
5959

6060
You could import all components also from `@ui5/webcomponents-react` directly, but this will have a negative impact on your bundle size.
6161

62+
### Theming
63+
64+
UI5 Web Components and UI5 Web Components for React are both coming with the `sap_fiori_3` a.k.a. `Quartz` Theme built in.
65+
In case you want to change your applications' theme, you have to import a couple of modules:
66+
```js
67+
import { setTheme } from '@ui5/webcomponents-base/dist/config/Theme';
68+
import '@ui5/webcomponents-theme-base/dist/Assets';
69+
import '@ui5/webcomponents/dist/generated/json-imports/Themes';
70+
import '@ui5/webcomponents-fiori/dist/generated/json-imports/Themes'; // only if you are using the ShellBar or the Product Switch
71+
import '@ui5/webcomponents-react/lib/ThemingSupport';
72+
```
73+
74+
In addition to call `setTheme` with a string parameter of the new theme, you must pass the new `theme` as a prop into the `ThemeProvider` component.
75+
Passing the prop is a temporary solution until the UI5 Web Components are providing [all Theming Parameters](https://github.com/SAP/ui5-webcomponents/issues/1396).<br />
76+
Available Themes:
77+
- `sap_fiori_3` (default)
78+
- `sap_fiori_dark`
79+
- `sap_belize`
80+
- `sap_belize_hcb`
81+
- `sap_belize_hcw`
82+
6283
### Configure Compact/Cozy setting
6384
UI5 Web Components supports ```Compact``` and ```Cozy``` mode. It is set to ```Cozy``` by default. To enable ```Compact``` globally, provide the option ```compactSize: true``` in the configuration ```script``` tag:
6485

package.json

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
"@babel/core": "^7.8.7",
3131
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.0",
3232
"@babel/plugin-proposal-optional-chaining": "^7.8.0",
33+
"@rollup/plugin-json": "^4.0.2",
34+
"@rollup/plugin-node-resolve": "^7.1.1",
35+
"@rollup/plugin-replace": "^2.3.1",
3336
"@storybook/storybook-deployer": "^2.8.1",
3437
"@types/enzyme": "^3.10.5",
3538
"@types/jest": "^25.1.2",
@@ -54,13 +57,8 @@
5457
"eslint": "^6.8.0",
5558
"eslint-plugin-prefer-arrow": "^1.1.7",
5659
"eslint-plugin-react": "^7.18.3",
57-
"esm": "^3.2.22",
58-
"extract-comments": "^1.1.0",
59-
"file-loader": "^5.0.2",
60-
"file-url": "^3.0.0",
6160
"filesize": "^6.0.1",
6261
"glob": "^7.1.6",
63-
"global": "^4.4.0",
6462
"google-closure-compiler": "^20200204.0.0",
6563
"gzip-size": "^5.1.0",
6664
"husky": "^4.2.1",
@@ -77,30 +75,20 @@
7775
"ncp": "^2.0.0",
7876
"npm-run-all": "^4.1.5",
7977
"prettier": "^1.19.1",
80-
"puppeteer": "^2.1.1",
81-
"qs": "^6.9.1",
8278
"react": "^16.8.6",
8379
"react-app-polyfill": "^1.0.6",
8480
"react-dom": "^16.8.6",
8581
"rimraf": "^3.0.1",
86-
"rollup": "^1.31.0",
82+
"rollup": "^2.3.1",
8783
"rollup-plugin-babel": "^4.3.2",
88-
"rollup-plugin-commonjs": "^10.1.0",
89-
"rollup-plugin-node-resolve": "^5.2.0",
90-
"rollup-plugin-postcss": "^2.0.6",
9184
"rollup-plugin-prettier": "^0.6.0",
92-
"rollup-plugin-replace": "^2.2.0",
93-
"rollup-plugin-strip-banner": "^1.0.0",
85+
"rollup-plugin-strip-banner": "^2.0.0",
9486
"shelljs": "^0.8.3",
9587
"sinon": "^8.1.1",
9688
"targz": "^1.0.1",
9789
"tmp": "^0.1.0",
98-
"ts-node": "8.6.2",
9990
"tslint": "^6.0.0",
100-
"typescript": "^3.8.3",
101-
"util": "^0.12.0",
102-
"webpack": "^4.42.0",
103-
"webpack-cli": "^3.3.11"
91+
"typescript": "^3.8.3"
10492
},
10593
"resolutions": {
10694
"@types/react": "16.9.2"

packages/base/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
"resize-observer-polyfill": "^1.5.1",
3434
"smoothscroll-polyfill": "^0.4.4"
3535
},
36+
"devDependencies": {
37+
"@sap-theming/theming-base-content": "11.1.18"
38+
},
3639
"peerDependencies": {
3740
"react": "^16.8.0",
3841
"react-jss": "^10.0.4"

packages/base/scripts/cssVariables/parse.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const { writeFileSync } = require('fs');
2-
const { root } = require('./themeDesignerVariables');
2+
const { root } = require('@sap-theming/theming-base-content/content/Base/baseLib/sap_fiori_3/variables.json');
33
const PATHS = require('../../../../config/paths');
44
const path = require('path');
5+
const prettier = require('prettier');
6+
const prettierConfig = require('../../../../prettier.config');
57

68
const variables = Object.keys(root);
79

@@ -21,4 +23,7 @@ for (const variable of variables) {
2123
}
2224
fileContent += '}\n';
2325

24-
writeFileSync(path.join(PATHS.packages, 'base', 'src', 'styling', 'ThemingParameters.ts'), fileContent);
26+
writeFileSync(
27+
path.join(PATHS.packages, 'base', 'src', 'styling', 'ThemingParameters.ts'),
28+
prettier.format(fileContent, prettierConfig)
29+
);

0 commit comments

Comments
 (0)