Skip to content

Commit d3daed6

Browse files
committed
Revert "Merge branch 'master' into chore/update-storybook"
This reverts commit 1b801f9, reversing changes made to 1106f34.
1 parent 1b801f9 commit d3daed6

Some content is hidden

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

44 files changed

+667
-2854
lines changed

.storybook/main.js

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
const { highlightLog } = require('../scripts/utils');
21
const path = require('path');
32
const PATHS = require('../config/paths');
4-
const dedent = require('dedent');
53
require('dotenv').config({
64
path: path.join(PATHS.root, '.env')
75
});
@@ -15,7 +13,12 @@ const DEPENDENCY_REGEX = BUILD_FOR_IE11
1513

1614
module.exports = {
1715
stories: ['../docs/**/*.stories.mdx', '../packages/**/*.stories.mdx', '../packages/**/*.stories.[tj]sx'],
18-
addons: ['@storybook/addon-knobs', '@storybook/addon-docs', '@storybook/addon-actions'],
16+
addons: [
17+
'@storybook/addon-toolbars',
18+
'@storybook/addon-docs',
19+
'@storybook/addon-controls',
20+
'@storybook/addon-actions'
21+
],
1922
webpack: async (config, { configType }) => {
2023
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
2124
// You can change the configuration based on that.
@@ -27,35 +30,6 @@ module.exports = {
2730
type: 'javascript/auto'
2831
});
2932

30-
const tsLoader = {
31-
test: /\.tsx?$/,
32-
include: PATHS.packages,
33-
use: [
34-
{
35-
loader: require.resolve('babel-loader'),
36-
options: {
37-
envName: 'esm',
38-
configFile: path.resolve(PATHS.root, 'babel.config.js')
39-
}
40-
}
41-
]
42-
};
43-
44-
if (IS_RELEASE_BUILD) {
45-
highlightLog('Warning: Prop Types Table Generation is active');
46-
tsLoader.use.push(require.resolve('react-docgen-typescript-loader'));
47-
} else {
48-
highlightLog('Info: Prop Types Table Generation is disabled');
49-
console.log(dedent`
50-
The Prop Table Generation is very expensive during build-time and therefore disabled by default.
51-
If you need Prop-Tables, you can activate it by adding a '.env' file to the root of the project with the following content:
52-
53-
UI5_WEBCOMPONENTS_FOR_REACT_RELEASE_BUILD=true\n\n
54-
`);
55-
}
56-
57-
config.module.rules.push(tsLoader);
58-
5933
if ((IS_RELEASE_BUILD && configType === 'PRODUCTION') || BUILD_FOR_IE11) {
6034
config.module.rules.push({
6135
test: /\.(js|mjs)$/,
@@ -102,8 +76,6 @@ module.exports = {
10276
}
10377
});
10478
}
105-
106-
config.resolve.extensions.push('.ts', '.tsx');
10779
config.resolve.alias = {
10880
...config.resolve.alias,
10981
'@shared': path.join(PATHS.root, 'shared'),

.storybook/preview.js

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { select, withKnobs } from '@storybook/addon-knobs';
21
import { makeDecorator } from '@storybook/addons';
32
import { addDecorator, addParameters } from '@storybook/react';
43
import { setTheme } from '@ui5/webcomponents-base/dist/config/Theme';
@@ -23,11 +22,11 @@ addParameters({
2322
: a[1].id.localeCompare(b[1].id, undefined, { numeric: true, caseFirst: 'upper' });
2423
},
2524
showRoots: true
26-
}
25+
},
26+
passArgsFirst: true,
27+
actions: { argTypesRegex: '^on.*' }
2728
});
2829

29-
addDecorator(withKnobs);
30-
3130
const ThemeContainer = ({ theme, contentDensity, children, direction }) => {
3231
useEffect(() => {
3332
if (contentDensity === ContentDensity.Compact) {
@@ -37,9 +36,9 @@ const ThemeContainer = ({ theme, contentDensity, children, direction }) => {
3736
}
3837
}, [contentDensity]);
3938

40-
// useEffect(() => {
41-
// document.querySelector('html').setAttribute('dir', direction.toLowerCase());
42-
// }, [direction]);
39+
useEffect(() => {
40+
document.querySelector('html').setAttribute('dir', direction);
41+
}, [direction]);
4342

4443
useEffect(() => {
4544
setTheme(theme);
@@ -54,9 +53,9 @@ const withQuery = makeDecorator({
5453
wrapper: (getStory, context) => {
5554
return (
5655
<ThemeContainer
57-
theme={select('Theme', Themes, Themes.sap_fiori_3)}
58-
contentDensity={select('ContentDensity', ContentDensity, ContentDensity.Cozy)}
59-
direction={select('Text Direction', ['LTR', 'RTL'], 'LTR')}
56+
theme={context.globalArgs.theme || Themes.sap_fiori_3}
57+
contentDensity={context.globalArgs.contentDensity}
58+
direction={context.globalArgs.direction}
6059
>
6160
{getStory(context)}
6261
</ThemeContainer>
@@ -65,3 +64,74 @@ const withQuery = makeDecorator({
6564
});
6665

6766
addDecorator(withQuery);
67+
68+
export const globalArgTypes = {
69+
theme: {
70+
name: 'Theme',
71+
description: 'Fiori Theme',
72+
defaultValue: Themes.sap_fiori_3,
73+
toolbar: {
74+
icon: 'paintbrush',
75+
items: [
76+
{
77+
value: Themes.sap_fiori_3,
78+
title: Themes.sap_fiori_3
79+
},
80+
{
81+
value: Themes.sap_fiori_3_dark,
82+
title: Themes.sap_fiori_3_dark
83+
},
84+
{
85+
value: Themes.sap_belize,
86+
title: Themes.sap_belize
87+
},
88+
{
89+
value: Themes.sap_belize_hcb,
90+
title: Themes.sap_belize_hcb
91+
},
92+
{
93+
value: Themes.sap_belize_hcw,
94+
title: Themes.sap_belize_hcw
95+
}
96+
]
97+
}
98+
},
99+
contentDensity: {
100+
name: 'Content Density',
101+
description: 'Content Density',
102+
defaultValue: ContentDensity.Cozy,
103+
toolbar: {
104+
icon: 'component',
105+
items: [
106+
{
107+
value: ContentDensity.Cozy,
108+
title: ContentDensity.Cozy
109+
},
110+
{
111+
value: ContentDensity.Compact,
112+
title: ContentDensity.Compact
113+
}
114+
]
115+
}
116+
},
117+
direction: {
118+
name: 'Direction',
119+
description: 'Text Direction',
120+
defaultValue: 'ltr',
121+
toolbar: {
122+
icon: 'transfer',
123+
items: [
124+
{
125+
value: 'ltr',
126+
title: 'LTR',
127+
icon: 'arrowrightalt'
128+
},
129+
{
130+
value: 'rtl',
131+
title: 'RTL',
132+
icon: 'arrowleftalt'
133+
}
134+
]
135+
}
136+
}
137+
};

CHANGELOG.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,6 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6-
# [0.10.0-rc.1](https://github.com/SAP/ui5-webcomponents-react/compare/v0.10.0-rc.0...v0.10.0-rc.1) (2020-05-25)
7-
8-
9-
### Bug Fixes
10-
11-
* **AnalyticalTable:** remove padding and scrollbar from select-all header cell ([#536](https://github.com/SAP/ui5-webcomponents-react/issues/536)) ([97158a3](https://github.com/SAP/ui5-webcomponents-react/commit/97158a39663cf40c424829a86962df7070a0dacb)), closes [#532](https://github.com/SAP/ui5-webcomponents-react/issues/532)
12-
* **DurationPicker:** use correct value for defaultProp maxValue ([#529](https://github.com/SAP/ui5-webcomponents-react/issues/529)) ([888d069](https://github.com/SAP/ui5-webcomponents-react/commit/888d069a86784c4833f9257abc67e569be3dd231))
13-
14-
15-
### Features
16-
17-
* **StyleClassHelper:** add putIfPresent method ([#539](https://github.com/SAP/ui5-webcomponents-react/issues/539)) ([0ae0785](https://github.com/SAP/ui5-webcomponents-react/commit/0ae078554dd0e7e6a1424de6755ec02fa15bb12e))
18-
19-
20-
21-
22-
236
# [0.10.0-rc.0](https://github.com/SAP/ui5-webcomponents-react/compare/v0.9.5...v0.10.0-rc.0) (2020-05-19)
247

258

config/jestsetup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { createSerializer } from 'enzyme-to-json';
66
import ResizeObserver from 'resize-observer-polyfill';
77
import 'intersection-observer';
88
import '@ui5/webcomponents/dist/generated/json-imports/i18n';
9-
import 'whatwg-fetch';
109

1110
// React 16 Enzyme adapter
1211
Enzyme.configure({ adapter: new Adapter() });

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.10.0-rc.1",
5+
"version": "0.10.0-rc.0",
66
"npmClient": "yarn",
77
"useWorkspaces": true,
88
"command": {

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@
101101
"targz": "^1.0.1",
102102
"tmp": "^0.1.0",
103103
"tslint": "^6.1.2",
104-
"typescript": "^3.8.3",
105-
"whatwg-fetch": "^3.0.0"
104+
"typescript": "^3.8.3"
106105
},
107106
"resolutions": {
108107
"@types/react": "16.9.34",

packages/base/CHANGELOG.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6-
# [0.10.0-rc.1](https://github.com/SAP/ui5-webcomponents-react/compare/v0.10.0-rc.0...v0.10.0-rc.1) (2020-05-25)
7-
8-
9-
### Features
10-
11-
* **StyleClassHelper:** add putIfPresent method ([#539](https://github.com/SAP/ui5-webcomponents-react/issues/539)) ([0ae0785](https://github.com/SAP/ui5-webcomponents-react/commit/0ae078554dd0e7e6a1424de6755ec02fa15bb12e))
12-
13-
14-
15-
16-
176
# [0.10.0-rc.0](https://github.com/SAP/ui5-webcomponents-react/compare/v0.9.5...v0.10.0-rc.0) (2020-05-19)
187

198

packages/base/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ui5/webcomponents-react-base",
3-
"version": "0.10.0-rc.1",
3+
"version": "0.10.0-rc.0",
44
"description": "Base for ui5-webcomponents-react",
55
"main": "index.cjs.js",
66
"module": "index.esm.js",
Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,20 @@
11
import { fetchI18nBundle, getI18nBundle } from '@ui5/webcomponents-base/dist/i18nBundle';
22
import { useEffect, useState } from 'react';
33

4-
type TextWithDefault = { key: string; defaultText: string };
5-
type TextWithPlaceholders = [TextWithDefault, ...string[]];
6-
74
interface I18nBundle {
8-
getText: (textObj: TextWithDefault, ...args: any) => string;
5+
getText: (textObj: { key: string; defaultText: string }, ...args: any) => string;
96
}
107

11-
const resolveTranslations = (bundle, texts) => {
12-
return texts.map((text) => {
13-
if (Array.isArray(text)) {
14-
const [key, ...replacements] = text;
15-
return bundle.getText(key, replacements);
16-
}
17-
return bundle.getText(text);
18-
});
19-
};
20-
21-
export const useI18nText = (bundleName: string, ...texts: (TextWithDefault | TextWithPlaceholders)[]): string[] => {
22-
const i18nBundle: I18nBundle = getI18nBundle(bundleName);
23-
const [translations, setTranslations] = useState(resolveTranslations(i18nBundle, texts));
8+
export const useI18nBundle = (bundleName): I18nBundle => {
9+
const [bundle, setBundle] = useState(getI18nBundle(bundleName));
2410

2511
useEffect(() => {
2612
const fetchAndLoadBundle = async () => {
2713
await fetchI18nBundle(bundleName);
28-
setTranslations((prev) => {
29-
const next = resolveTranslations(i18nBundle, texts);
30-
if (prev.length === next.length && prev.every((translation, index) => next[index] === translation)) {
31-
return prev;
32-
}
33-
return next;
34-
});
14+
setBundle(getI18nBundle(bundleName));
3515
};
3616
fetchAndLoadBundle();
37-
}, [fetchI18nBundle, bundleName, texts]);
17+
}, []);
3818

39-
return translations;
19+
return bundle;
4020
};

packages/base/src/lib/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useConsolidatedRef } from '../hooks/useConsolidatedRef';
2-
import { useI18nText } from '../hooks/useI18nBundle';
2+
import { useI18nBundle } from '../hooks/useI18nBundle';
33
import { usePassThroughHtmlProps } from '../hooks/usePassThroughHtmlProps';
44
import { useViewportRange } from '../hooks/useViewportRange';
55

6-
export { useConsolidatedRef, usePassThroughHtmlProps, useViewportRange, useI18nText };
6+
export { useConsolidatedRef, usePassThroughHtmlProps, useViewportRange, useI18nBundle };

packages/base/src/styling/CssSizeVariables.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export enum CssSizeVariablesNames {
1414
sapWcrAnalyticalTableTreePaddingLevel1 = 'sapWcrAnalyticalTableTreePaddingLevel1',
1515
sapWcrAnalyticalTableTreePaddingLevel2 = 'sapWcrAnalyticalTableTreePaddingLevel2',
1616
sapWcrAnalyticalTableTreePaddingLevel3 = 'sapWcrAnalyticalTableTreePaddingLevel3',
17-
sapWcrCheckBoxWidthHeight = 'sapWcrCheckBoxWidthHeight',
1817
sapWcrAnalyticalTableSelectionColumnWidth = 'sapWcrAnalyticalTableSelectionColumnWidth'
1918
}
2019

@@ -43,7 +42,6 @@ export const cssVariablesStyles = `
4342
--${CssSizeVariablesNames.sapWcrAnalyticalTableTreePaddingLevel1}:1.5rem;
4443
--${CssSizeVariablesNames.sapWcrAnalyticalTableTreePaddingLevel2}:2.25rem;
4544
--${CssSizeVariablesNames.sapWcrAnalyticalTableTreePaddingLevel3}:2.75rem;
46-
--${CssSizeVariablesNames.sapWcrCheckBoxWidthHeight}:2.75rem;
4745
--${CssSizeVariablesNames.sapWcrAnalyticalTableSelectionColumnWidth}:55px;
4846
4947
}
@@ -65,7 +63,6 @@ export const cssVariablesStyles = `
6563
--${CssSizeVariablesNames.sapWcrAnalyticalTableTreePaddingLevel1}:1rem;
6664
--${CssSizeVariablesNames.sapWcrAnalyticalTableTreePaddingLevel2}:1.5rem;
6765
--${CssSizeVariablesNames.sapWcrAnalyticalTableTreePaddingLevel3}:2rem;
68-
--${CssSizeVariablesNames.sapWcrCheckBoxWidthHeight}:2rem;
6966
--${CssSizeVariablesNames.sapWcrAnalyticalTableSelectionColumnWidth}:40px;
7067
}
7168
`;

packages/base/src/styling/StyleClassHelper.test.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)