Skip to content

feat: update @ui5/webcomponents to 1.17.0 #5022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8c7513d
update wc versions
Lukas742 Aug 29, 2023
f875f8f
run script
Lukas742 Aug 29, 2023
0c85226
temp fixes
Lukas742 Aug 29, 2023
ecdd4c2
wrapper script V2 toolbar
Lukas742 Aug 29, 2023
7eb2d42
delete wc toolbar
Lukas742 Aug 29, 2023
9746f0d
add toolbar v2, cleanup, imports, types
Lukas742 Aug 29, 2023
cf056b9
Update index.ts
Lukas742 Aug 29, 2023
9f8be94
Update ToolbarV2.mdx
Lukas742 Aug 29, 2023
227ede8
Toolbar basic demo
Lukas742 Aug 29, 2023
df527e0
script: make name replace more generic
Lukas742 Aug 29, 2023
6dcdc30
don't apply inherited properties
Lukas742 Aug 30, 2023
8828b98
remove inherited slot
Lukas742 Aug 30, 2023
b20867c
Delete SelectMenuOptionDomRef.json
Lukas742 Aug 30, 2023
ee96dc4
convert version info to wcr version
Lukas742 Aug 30, 2023
9db401f
add Error for incompatible versions
Lukas742 Aug 30, 2023
2dae914
apply updated versions
Lukas742 Aug 30, 2023
bf9eea0
update `menu` prop, add `menu` DomRef` property
Lukas742 Aug 30, 2023
86f94c3
update to latest snapshot
Lukas742 Aug 30, 2023
64c623c
run script
Lukas742 Aug 30, 2023
264f840
Select basic story
Lukas742 Aug 30, 2023
38ef959
Toolbar: basi story
Lukas742 Aug 30, 2023
c93df0c
add `SelectMenu` example
Lukas742 Aug 30, 2023
5cd8b19
Toolbar: add deprecation annotation
Lukas742 Aug 30, 2023
11bce1a
Update Toolbar.mdx
Lukas742 Aug 30, 2023
04445cb
Update ToolbarV2.mdx
Lukas742 Aug 30, 2023
bfb1374
ui5wc toolbar link
Lukas742 Aug 30, 2023
41d5e0d
Menu: add submenu story
Lukas742 Aug 31, 2023
3115dcd
chore: update internal ui5wc CSS variables
Lukas742 Aug 31, 2023
a81b549
Merge branch 'main' into feat/wc-1.17.0
Lukas742 Sep 1, 2023
3e82d9e
update to latest snapshot
Lukas742 Sep 1, 2023
a8f3a17
run script (comments)
Lukas742 Sep 1, 2023
2880ec4
run script (update components)
Lukas742 Sep 1, 2023
0d7518a
Update index.tsx
Lukas742 Sep 1, 2023
754d3eb
Merge branch 'main' into feat/wc-1.17.0
Lukas742 Sep 1, 2023
1e10ea6
update prettier & eslint
Lukas742 Sep 1, 2023
94626bf
toolbar components: ui5wc link
Lukas742 Sep 1, 2023
0d30e25
update to 1.17.0
Lukas742 Sep 1, 2023
dffc179
remove ToolbarItem
Lukas742 Sep 1, 2023
e206f33
remove `ToolbarItemOverflowBehavior` cleanup `ToolbarItem` imports
Lukas742 Sep 1, 2023
d85ece2
ShellBarItem: imports
Lukas742 Sep 1, 2023
79a7633
Update AnalyticalCardHeader.jss.ts
Lukas742 Sep 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .storybook/components/Footer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
align-items: center;
background-color: var(--sapPageFooter_Background);
border-top: 0.0625rem solid var(--sapPageFooter_BorderColor);
height: var(--_ui5_bar_base_height);
overflow: hidden;
}

Expand Down
3 changes: 1 addition & 2 deletions docs/knowledge-base/CustomComponentsSlots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ Now the `BarComponent` would compile to this:

<BarComponent />

<div style={{ height: 'var(--_ui5_bar_base_height)' }} />
<Footer style={{ position: 'fixed', bottom: 0, zIndex: 2, maxHeight: 'var(--_ui5_bar_base_height)' }} />
<Footer style={{ position: 'fixed', bottom: 0, zIndex: 2 }} />
3 changes: 1 addition & 2 deletions docs/knowledge-base/Portals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,4 @@ Then, set the `portalContainer` to the respective element.
/>
```

<div style={{ height: 'var(--_ui5_bar_base_height)' }} />
<Footer style={{ position: 'fixed', bottom: 0, zIndex: 2, maxHeight: 'var(--_ui5_bar_base_height)' }} />
<Footer style={{ position: 'fixed', bottom: 0, zIndex: 2 }} />
3 changes: 1 addition & 2 deletions docs/knowledge-base/TestingWithJest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,4 @@ jest.mock('react', () => {

Now you should be able to run your test by using `npm run test` or `yarn test`.

<div style={{ height: 'var(--_ui5_bar_base_height)' }} />
<Footer style={{ position: 'fixed', bottom: 0, zIndex: 2, maxHeight: 'var(--_ui5_bar_base_height)' }} />
<Footer style={{ position: 'fixed', bottom: 0, zIndex: 2 }} />
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test": "yarn test:prepare && yarn test:cypress",
"clean": "tsc --build --clean && rimraf temp .out && lerna run clean",
"clean:remove-modules": "yarn clean && rimraf node_modules",
"prettier:all": "prettier --write --config ./prettier.config.cjs \"packages/**/*.{js,jsx,ts,tsx,mdx,json}\"",
"prettier:all": "prettier --write --config ./prettier.config.cjs \"packages/**/*.{js,jsx,ts,tsx,mdx,json,md}\"",
"lint": "eslint packages --ext .ts,.tsx",
"lerna:version-dryrun": "lerna version --conventional-graduate --no-git-tag-version --no-push",
"create-webcomponents-wrapper": "node --experimental-json-modules ./packages/main/scripts/create-web-components-wrapper.mjs && node --experimental-json-modules ./scripts/generate-theming-parameters.js",
Expand All @@ -37,9 +37,9 @@
"@storybook/react": "7.3.2",
"@storybook/react-vite": "7.3.2",
"@storybook/theming": "7.3.2",
"@ui5/webcomponents": "1.16.0",
"@ui5/webcomponents-fiori": "1.16.0",
"@ui5/webcomponents-icons": "1.16.0",
"@ui5/webcomponents": "1.17.0",
"@ui5/webcomponents-fiori": "1.17.0",
"@ui5/webcomponents-icons": "1.17.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"remark-gfm": "^3.0.1",
Expand All @@ -59,7 +59,7 @@
"@types/react-dom": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@ui5/webcomponents-tools": "1.16.0",
"@ui5/webcomponents-tools": "1.17.0",
"@vitejs/plugin-react": "^4.0.0",
"chromatic": "^6.5.3",
"cssnano": "^6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"peerDependencies": {
"@types/react": "*",
"@ui5/webcomponents-base": "~1.16.0",
"@ui5/webcomponents-base": "~1.17.0",
"react": "^16.14.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
Expand Down
4 changes: 2 additions & 2 deletions packages/charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"recharts": "2.8.0"
},
"peerDependencies": {
"@ui5/webcomponents-react": "~1.18.0",
"@ui5/webcomponents-react-base": "~1.18.0",
"@ui5/webcomponents-react": "~1.19.0",
"@ui5/webcomponents-react-base": "~1.19.0",
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
"react-jss": "^10.10.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/cra-template-seed/template.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"package": {
"dependencies": {
"@ui5/webcomponents": "~1.16.0",
"@ui5/webcomponents-fiori": "~1.16.0",
"@ui5/webcomponents-icons": "~1.16.0",
"@ui5/webcomponents": "~1.17.0",
"@ui5/webcomponents-fiori": "~1.17.0",
"@ui5/webcomponents-icons": "~1.17.0",
"@ui5/webcomponents-react": "latest",
"axios": "^0.27.2",
"formik": "^2.2.9",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { getScopedVarName } from '@ui5/webcomponents-base/dist/CustomElementsScope.js';
import { Avatar, AvatarShape, ShellBar } from '@ui5/webcomponents-react';
import React, { useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';

import { Avatar, AvatarShape, ShellBar } from '@ui5/webcomponents-react';
import '@ui5/webcomponents-icons/dist/customer.js';
import { ROUTES } from '../../routes/Routes';
import LanguageSwitch from '../LanguageSwitch/LanguageSwitch';
import PopoverListItems from '../Popover/List/PopoverListItems';
import ThemeSwitch from '../ThemeSwitch/ThemeSwitch';
import LanguageSwitch from '../LanguageSwitch/LanguageSwitch';
import { ROUTES } from '../../routes/Routes';

const style = {
shell: {
Expand All @@ -16,7 +16,7 @@ const style = {
zIndex: 100
},
emptySpace: {
paddingTop: 'var(--_ui5_shellbar_root_height)'
paddingTop: getScopedVarName('--_ui5_shellbar_root_height')
}
};

Expand Down
6 changes: 3 additions & 3 deletions packages/cra-template/template.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"package": {
"dependencies": {
"@ui5/webcomponents": "~1.16.0",
"@ui5/webcomponents-fiori": "~1.16.0",
"@ui5/webcomponents-icons": "~1.16.0",
"@ui5/webcomponents": "~1.17.0",
"@ui5/webcomponents-fiori": "~1.17.0",
"@ui5/webcomponents-icons": "~1.17.0",
"@ui5/webcomponents-react": "latest",
"web-vitals": "^2.1.0"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"@ui5/webcomponents": "~1.16.0",
"@ui5/webcomponents-base": "~1.16.0",
"@ui5/webcomponents-fiori": "~1.16.0",
"@ui5/webcomponents-icons": "~1.16.0",
"@ui5/webcomponents": "~1.17.0",
"@ui5/webcomponents-base": "~1.17.0",
"@ui5/webcomponents-fiori": "~1.17.0",
"@ui5/webcomponents-icons": "~1.17.0",
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0"
},
Expand Down
81 changes: 63 additions & 18 deletions packages/main/scripts/create-web-components-wrapper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import {
getDomRefMethods,
getDomRefObjects
} from '../../../scripts/web-component-wrappers/utils.js';
import versionInfo from '../../../scripts/web-component-wrappers/version-info.json' assert { type: 'json' };
import publicVersionInfo from '../../../scripts/web-component-wrappers/version-info.json' assert { type: 'json' };
import internalVersionInfo from '../../../scripts/web-component-wrappers/version-info-internal.json' assert { type: 'json' };
import { setTimeout } from 'node:timers/promises';

const versionInfo = { ...publicVersionInfo, ...internalVersionInfo };

// To only create a single component, replace "false" with the component (module) name
// or execute the following command: "yarn create-webcomponents-wrapper [name]"
Expand Down Expand Up @@ -61,8 +65,24 @@ const INPUT_COMPONENTS = new Set([
const componentsFromFioriPackage = new Set(fioriWebComponentsSpec.symbols.map((componentSpec) => componentSpec.module));

const interfaces = new Set();

// currently only applied to main wc package
const MODULE_NAME_REPLACEMENT = {
Toolbar: 'ToolbarV2',
ToolbarSeparator: 'ToolbarSeparatorV2',
ToolbarSpacer: 'ToolbarSpacerV2'
};
const allWebComponents = [
...mainWebComponentsSpec.symbols.filter((spec) => !spec.module.startsWith('types/')),
...mainWebComponentsSpec.symbols
.filter((spec) => !spec.module.startsWith('types/'))
.map((item) => {
if (MODULE_NAME_REPLACEMENT[item.module]) {
item.name = item.name.replace(item.module, MODULE_NAME_REPLACEMENT[item.module]);
item.basename = MODULE_NAME_REPLACEMENT[item.module];
item.module = MODULE_NAME_REPLACEMENT[item.module];
}
return item;
}),
...fioriWebComponentsSpec.symbols.filter((spec) => !spec.module.startsWith('types/'))
].filter((item) => {
if (item.kind === 'interface') {
Expand Down Expand Up @@ -199,7 +219,7 @@ const createWebComponentWrapper = async (
const domRef = Utils.createDomRef(componentSpec, importStatements);
const importSpecifier = `@ui5/webcomponents${
componentsFromFioriPackage.has(componentSpec.module) ? '-fiori' : ''
}/dist/${componentSpec.module}.js`;
}/dist/${componentSpec.resource}`;

const imports = [`import '${importSpecifier}';`, ...new Set(importStatements)];

Expand All @@ -221,10 +241,10 @@ const createWebComponentWrapper = async (
eventProps,
defaultProps,
domRef,
baseComponentName:
typeof COMPONENTS_WITHOUT_DEMOS[componentSpec.module] === 'string'
? COMPONENTS_WITHOUT_DEMOS[componentSpec.module]
: componentSpec.module
baseComponentName: (typeof COMPONENTS_WITHOUT_DEMOS[componentSpec.module] === 'string'
? COMPONENTS_WITHOUT_DEMOS[componentSpec.module]
: componentSpec.module
).replace('V2', '')
});
};

Expand Down Expand Up @@ -344,11 +364,22 @@ allWebComponents
const slotsAndEvents = [];
const importStatements = [];
const defaultProps = [];
if (componentSpec.properties) {
componentSpec.properties = componentSpec.properties.filter((item) => {
return !item.description.includes('is inherited and not supported');
});
}
if (componentSpec.slots) {
componentSpec.slots = componentSpec.slots.filter((item) => {
return !item.description.includes('is inherited and not supported');
});
}
const allComponentProperties = (componentSpec.properties || [])
.filter(
(prop) =>
.filter((prop) => {
return (
prop.visibility === 'public' && prop.readonly !== 'true' && prop.static !== true && prop.type !== 'object'
)
);
})
.map((property) => {
const tsType = Utils.getTypeDefinitionForProperty(property);
if (tsType.importStatement) {
Expand Down Expand Up @@ -476,6 +507,7 @@ allWebComponents
!EXCLUDE_LIST.includes(componentSpec.module)
) {
const regularPropsToOmit = new Set(['boolean', 'Boolean', 'object', 'Object']);

const webComponentWrapper = await createWebComponentWrapper(
componentSpec,
mainDescription,
Expand All @@ -498,24 +530,34 @@ allWebComponents

// create test
if (!existsSync(path.join(webComponentFolderPath, `${componentSpec.module}.cy.tsx`))) {
const webComponentTest = renderTest({ name: componentSpec.module, tagname: componentSpec.tagname });
const webComponentTest = await renderTest({ name: componentSpec.module, tagname: componentSpec.tagname });
writeFileSync(path.join(webComponentFolderPath, `${componentSpec.module}.cy.tsx`), webComponentTest);
}

// create demo
const componentWithoutDemo = COMPONENTS_WITHOUT_DEMOS[componentSpec.module];
// create subcomponent description
if (typeof componentWithoutDemo === 'string') {
const since = componentSpec.since ? `<b>Since:</b> ${versionInfo[componentSpec.since]}<br/>` : '';
let since = '';
if (componentSpec.since) {
if (!versionInfo[componentSpec.since]) {
throw new Error(
`${componentSpec.module}: Ui5Wc version is not compatible with version-info.json! Please add it to version-info-internal.json`
);
}
since = `**Since:** ${versionInfo[componentSpec.since]}\n`;
}
const abstractDescription = componentSpec.abstract
? `<b>Abstract UI5 Web Component</b> - Find out more about abstract components <a href="https://sap.github.io/ui5-webcomponents-react/?path=/docs/knowledge-base-faq--docs#what-are-abstract-ui5-web-components" target="_blank">here</a>.<br/><br/>`
: '</br>';
mainDescription = `${since}${abstractDescription}${mainDescription}`;
const subComponentDescription = `${await formatDemoDescription(
mainDescription,
: '';
mainDescription = `${abstractDescription}${mainDescription}`;
const subComponentDescription = `${since}${
!abstractDescription && since ? '\n' : ''
}${await formatDemoDescription(mainDescription, componentSpec, false)}\n${await formatDemoDescription(
description,
componentSpec,
false
)}\n${await formatDemoDescription(description, componentSpec, false)}`;
)}`;
writeFileSync(
path.join(webComponentFolderPath, `${componentSpec.module}Description.md`),
subComponentDescription
Expand Down Expand Up @@ -584,4 +626,7 @@ writeFileSync(
.join('\n')
);

spawnSync('prettier', [WEB_COMPONENTS_ROOT_DIR, '--write'], { stdio: [0, 1, 2] });
console.log('~~~~~', 'TIMEOUT', '~~~~~');
await setTimeout(2000);

spawnSync('yarn', ['prettier:all'], { stdio: [0, 1, 2], cwd: PATHS.root });
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { spacing, ThemingParameters } from '@ui5/webcomponents-react-base';
import { cssVarVersionInfoPrefix } from '../../internal/utils.js';

const _cardHeaderFocusOffset = `var(${cssVarVersionInfoPrefix}card_header_focus_offset)`;
const _cardHeaderFocusBorder = `var(${cssVarVersionInfoPrefix}card_header_focus_border)`;
const _cardHeaderFocusRadius = `var(${cssVarVersionInfoPrefix}card_header_focus_radius)`;
const _cardHeaderFocusBottomRadius = `var(${cssVarVersionInfoPrefix}card_header_focus_bottom_radius)`;

const styles = {
helpText: {
Expand All @@ -15,16 +21,16 @@ const styles = {
outline: 'none',
content: '""',
position: 'absolute',
border: 'var(--_ui5_card_header_focus_border)',
border: _cardHeaderFocusBorder,
pointerEvents: 'none',
top: 'var(--_ui5_card_header_focus_offset)',
left: 'var(--_ui5_card_header_focus_offset)',
right: 'var(--_ui5_card_header_focus_offset)',
bottom: 'var(--_ui5_card_header_focus_offset)',
borderTopLeftRadius: 'var(--_ui5_card_header_focus_radius)',
borderTopRightRadius: 'var(--_ui5_card_header_focus_radius)',
borderBottomLeftRadius: 'var(--_ui5_card_header_focus_bottom_radius)',
borderBottomRightRadius: 'var(--_ui5_card_header_focus_bottom_radius)'
top: _cardHeaderFocusOffset,
left: _cardHeaderFocusOffset,
right: _cardHeaderFocusOffset,
bottom: _cardHeaderFocusOffset,
borderTopLeftRadius: _cardHeaderFocusRadius,
borderTopRightRadius: _cardHeaderFocusRadius,
borderBottomLeftRadius: _cardHeaderFocusBottomRadius,
borderBottomRightRadius: _cardHeaderFocusBottomRadius
},
'&:focus-visible': {
outline: 'none'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ const styles = {
padding: 0
}
},
filterListItem: {
height: 'var(--_ui5_list_item_base_height)'
},
filter: {
height: 'var(--_ui5_list_item_base_height)'
},
filterIcon: {
paddingInlineEnd: '0.5rem',
minWidth: '1rem',
Expand Down Expand Up @@ -231,12 +225,8 @@ export const ColumnHeaderModal = (props: ColumnHeaderModalProperties) => {
)}
{showFilter && (
//todo maybe need to enhance Input selection after ui5-webcomponents issue has been fixed (undefined is displayed as val)
<CustomListItem
type={ListItemType.Inactive}
className={classes.filterListItem}
onKeyDown={handleCustomLiKeyDown}
>
<FlexBox alignItems={FlexBoxAlignItems.Center} className={classes.filter}>
<CustomListItem type={ListItemType.Inactive} onKeyDown={handleCustomLiKeyDown}>
<FlexBox alignItems={FlexBoxAlignItems.Center}>
<Icon name={iconFilter} className={classes.filterIcon} aria-hidden />
<Filter column={column} popoverRef={ref} />
</FlexBox>
Expand Down
16 changes: 10 additions & 6 deletions packages/main/src/components/DynamicPageAnchorBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ import type { CSSProperties } from 'react';
import { createUseStyles } from 'react-jss';
import { COLLAPSE_HEADER, EXPAND_HEADER, PIN_HEADER, UNPIN_HEADER } from '../../i18n/i18n-defaults.js';
import type { CommonProps } from '../../interfaces/index.js';
import { cssVarVersionInfoPrefix } from '../../internal/utils.js';
import { Button, ToggleButton } from '../../webComponents/index.js';

const _buttonBaseMinWidth = `${cssVarVersionInfoPrefix}button_base_min_width`;
const _buttonBaseHeight = `${cssVarVersionInfoPrefix}button_base_height`;

const anchorButtonVariables = {
[_buttonBaseMinWidth]: '1.5rem',
[_buttonBaseHeight]: '1.5rem'
} as CSSProperties;

const anchorBarStyles = {
container: {
position: 'absolute',
Expand All @@ -33,7 +42,7 @@ const anchorBarStyles = {
}
},
anchorBarActionButton: {
'--_ui5wcr_anchor-btn-center': `calc((var(--_ui5_button_base_min_width) - var(--sapButton_BorderWidth)) / 2)`,
'--_ui5wcr_anchor-btn-center': `calc((var(${_buttonBaseMinWidth}) - ${ThemingParameters.sapButton_BorderWidth}) / 2)`,
position: 'absolute',
insetBlockStart: `calc(-1 * var(--_ui5wcr_anchor-btn-center))`,
insetInlineStart: 'calc(50% - var(--_ui5wcr_anchor-btn-center))',
Expand Down Expand Up @@ -100,11 +109,6 @@ interface DynamicPageAnchorBarPropTypes extends CommonProps {
onPinnedStateChange?: (pinned: boolean) => void;
}

const anchorButtonVariables = {
'--_ui5_button_base_min_width': '1.5rem',
'--_ui5_button_base_height': '1.5rem'
} as CSSProperties;

/**
* The dynamic page anchor bar contains the expand/collapse (expands or collapses the header content)
* and pin button (pins the content header).
Expand Down
Loading