Skip to content

Commit 1a743db

Browse files
Merge remote-tracking branch 'origin/main' into carousel_navigate_to
2 parents 7575cec + 34219eb commit 1a743db

111 files changed

Lines changed: 1820 additions & 671 deletions

File tree

Some content is hidden

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

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ cd packages/main
3838
yarn test:cypress:single cypress/specs/Button.cy.tsx # Single test file
3939
```
4040

41+
### Documentation Website
42+
```bash
43+
cd packages/website
44+
yarn start # Starts Docusaurus on http://localhost:3000
45+
```
46+
4147
### Build & Test Flow
4248

4349
**Build steps** (always run from root folder):

docs/2-advanced/11-styles.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ ui5-card-header::part(status) {
4747

4848
<b>Note:</b> All available shadow parts are described in the API reference as part of the "Overview" section of each component.
4949

50+
## Usage of CSS Custom States
51+
52+
Components can expose custom states that reflect their internal state using the [CSS custom state pseudo-class](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:state). This allows you to apply styles based on component-specific conditions without relying on classes or attributes.
53+
54+
<b>For example:</b> You can style a component differently based on its custom state:
55+
56+
```html
57+
<ui5-toolbar-item></ui5-toolbar-item>
58+
```
59+
60+
```css
61+
ui5-toolbar-item:state(overflowed) {
62+
flex-direction: column
63+
}
64+
```
65+
66+
<b>Note:</b> All available custom states are described in the API reference as part of the "Overview" section of each component.
67+
5068
## Changing CSS Variables
5169

5270
The UI5 WebComponents leverage CSS variables, so if you inspect the elements inside the Shadow DOM, you will probably find which variable you need to change. Check the list of all [Global CSS Variables](https://github.com/SAP/theming-base-content/blob/master/content/Base/baseLib/sap_horizon/css_variables.css) that we use in the component. Altering them will change the component appearance.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"type": "module",
1212
"scripts": {
1313
"generate": "yarn workspaces foreach --all --parallel run generate",
14-
"generateAPI": "yarn workspaces foreach --all --parallel run generateAPI",
14+
"generateAPI": "yarn generateCEM && yarn mergeCEM && yarn validateCEM",
15+
"generateCEM": "yarn workspaces foreach --all --parallel run generateCEM",
16+
"mergeCEM": "yarn workspaces foreach --all --parallel run mergeCEM",
17+
"validateCEM": "yarn workspaces foreach --all --parallel run validateCEM",
1518
"generateProd": "yarn workspaces foreach --all --parallel run generateProd",
1619
"ts": "tsc -b",
1720
"bundle": "yarn workspaces foreach --all --parallel run bundle",

packages/ai/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"build": "wc-dev build",
2323
"watch": "wc-dev watch",
2424
"generate": "wc-dev generate",
25-
"generateAPI": "wc-dev generateAPI",
25+
"generateCEM": "wc-dev generateAPI.generateCEM",
26+
"mergeCEM": "wc-dev generateAPI.mergeCEM",
27+
"validateCEM": "wc-dev generateAPI.validateCEM",
2628
"bundle": "wc-dev build.bundle",
2729
"test": "yarn test:cypress",
2830
"test:cypress": "wc-dev test-cy-ci",

packages/base/cypress/specs/UI5ElementPropsAndAttrs.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe("Properties and attributes convert to each other", () => {
7878
.should("not.have.attr", "object-prop");
7979
});
8080

81-
it("Tests that array properties have no attributes", () => {
81+
it("Tests that array properties have attributes", () => {
8282
cy.mount(<Generic></Generic>);
8383

8484
cy.get("[ui5-test-generic]")
@@ -88,7 +88,7 @@ describe("Properties and attributes convert to each other", () => {
8888
.invoke("prop", "multiProp", ["a", "b"]);
8989

9090
cy.get("@testGeneric")
91-
.should("not.have.attr", "multi-prop");
91+
.should("have.attr", "multi-prop", '["a","b"]');
9292
});
9393

9494
it("Tests that noAttribute properties have no attributes", () => {

packages/base/package-scripts.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ const scripts = {
7070
"ui5": `ui5nps-script "${LIB}copy-and-watch/index.js" "dist/sap/**/*" dist/prod/sap/`,
7171
"preact": `ui5nps-script "${LIB}copy-and-watch/index.js" "dist/thirdparty/preact/**/*.js" dist/prod/thirdparty/preact/`,
7272
"assets": `ui5nps-script "${LIB}copy-and-watch/index.js" "dist/generated/assets/**/*.json" dist/prod/generated/assets/`,
73-
}
74-
},
73+
}
74+
},
7575
generateAPI: {
76-
default: "ui5nps generateAPI.generateCEM generateAPI.validateCEM",
7776
generateCEM: `ui5nps-script "${LIB}/cem/cem.js" analyze --config "${LIB}cem/custom-elements-manifest.config.mjs"`,
7877
validateCEM: `ui5nps-script "${LIB}/cem/validate.js"`,
78+
mergeCEM: `ui5nps-script "${LIB}cem/merge.mjs"`,
7979
},
8080
watch: {
8181
default: 'ui5nps-p watch.src watch.styles', // concurently

packages/base/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
"start": "wc-dev start",
4949
"build": "wc-dev build",
5050
"generate": "wc-dev generate",
51-
"generateAPI": "wc-dev generateAPI",
51+
"generateCEM": "wc-dev generateAPI.generateCEM",
52+
"mergeCEM": "wc-dev generateAPI.mergeCEM",
53+
"validateCEM": "wc-dev generateAPI.validateCEM",
5254
"generateProd": "wc-dev generateProd",
5355
"bundle": "wc-dev build.bundle",
5456
"test": "wc-dev test",

packages/base/src/UI5Element.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ const defaultConverter = {
8080
if (type === Number) {
8181
return value === null ? undefined : parseFloat(value);
8282
}
83+
84+
if (type === Object || type === Array) {
85+
try {
86+
return JSON.parse(value as string) as object | Array<unknown>;
87+
} catch {
88+
return value;
89+
}
90+
}
91+
8392
return value;
8493
},
8594
toAttribute(value: unknown, type: unknown) {
@@ -89,7 +98,7 @@ const defaultConverter = {
8998

9099
// don't set attributes for arrays and objects
91100
if (type === Object || type === Array) {
92-
return null;
101+
return JSON.stringify(value);
93102
}
94103

95104
// object, array, other

packages/base/src/UI5ElementMetadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class UI5ElementMetadata {
133133
*/
134134
hasAttribute(propName: string): boolean {
135135
const propData = this.getProperties()[propName];
136-
return propData.type !== Object && propData.type !== Array && !propData.noAttribute;
136+
return propData.type !== Object && !propData.noAttribute;
137137
}
138138

139139
/**

packages/compat/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"build": "wc-dev build",
2323
"watch": "wc-dev watch",
2424
"generate": "wc-dev generate",
25-
"generateAPI": "wc-dev generateAPI",
25+
"generateCEM": "wc-dev generateAPI.generateCEM",
26+
"mergeCEM": "wc-dev generateAPI.mergeCEM",
27+
"validateCEM": "wc-dev generateAPI.validateCEM",
2628
"bundle": "wc-dev build.bundle",
2729
"test": "yarn test:cypress",
2830
"test:cypress": "wc-dev test-cy-ci",

0 commit comments

Comments
 (0)