Skip to content

Commit eac2942

Browse files
committed
add supported node note
1 parent e718844 commit eac2942

File tree

115 files changed

+470
-36
lines changed

Some content is hidden

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

115 files changed

+470
-36
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ cypress/downloads
3131
.nx
3232

3333
debug-storybook.log
34+
35+
.vscode

packages/cli/src/scripts/create-wrappers/PropTypesRenderer.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ export class PropTypesRenderer extends AbstractRenderer {
8181
}
8282
}
8383

84+
const slotType = slot._ui5type;
85+
if (slotType) {
86+
let slotElementType: string = 'unknown';
87+
const slotReferences = slot._ui5type?.references;
88+
if (slotReferences?.length) {
89+
const types = new Set<string>([]);
90+
slotReferences.forEach((slotRef) => {
91+
types.add(slotRef.name);
92+
});
93+
slotElementType = [...types].join(', ');
94+
} else if (slotType.text) {
95+
slotElementType = slotType.text.match(/^Array<([^>]+)>$/)?.[1] ?? slotType.text;
96+
}
97+
descriptionParts.push(` *`);
98+
descriptionParts.push(` * __Supported Node Type/s:__ \`${slotElementType}\``);
99+
}
100+
84101
return `/**\n${descriptionParts.join('\n')}\n */\n${snakeCaseToCamelCase(slot.name)}?: ${
85102
isDefaultSlot ? 'ReactNode | ReactNode[]' : 'UI5WCSlotsNode'
86103
}`;

packages/main/src/webComponents/Avatar/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ interface AvatarPropTypes
131131
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
132132
*
133133
* **Note:** Available since [v1.7.0](https://github.com/UI5/webcomponents/releases/tag/v1.7.0) of **@ui5/webcomponents**.
134+
*
135+
* __Supported Node Type/s:__ `HTMLElement`
134136
*/
135137
badge?: UI5WCSlotsNode;
136138

@@ -141,6 +143,8 @@ interface AvatarPropTypes
141143
* `ui5-avatar:not(:defined) {`<br/>
142144
* &nbsp;&nbsp;&nbsp;&nbsp;`visibility: hidden;`<br/>
143145
* `}`
146+
*
147+
* __Supported Node Type/s:__ `HTMLElement`
144148
*/
145149
children?: ReactNode | ReactNode[];
146150
/**

packages/main/src/webComponents/AvatarGroup/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ interface AvatarGroupPropTypes
7272
*
7373
* Moreover, if you use avatars with "Square" shape, there will be visual inconsistency
7474
* as the built-in overflow action has "Circle" shape.
75+
*
76+
* __Supported Node Type/s:__ `IAvatarGroupItem`
7577
*/
7678
children?: ReactNode | ReactNode[];
7779

@@ -87,6 +89,8 @@ interface AvatarGroupPropTypes
8789
*
8890
* __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component.
8991
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
92+
*
93+
* __Supported Node Type/s:__ `IButton`
9094
*/
9195
overflowButton?: UI5WCSlotsNode;
9296
/**

packages/main/src/webComponents/Bar/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ interface BarPropTypes
3636
Omit<CommonProps, keyof BarAttributes | 'children' | 'endContent' | 'startContent'> {
3737
/**
3838
* Defines the content in the middle of the bar.
39+
*
40+
* __Supported Node Type/s:__ `HTMLElement`
3941
*/
4042
children?: ReactNode | ReactNode[];
4143

@@ -47,6 +49,8 @@ interface BarPropTypes
4749
*
4850
* __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component.
4951
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
52+
*
53+
* __Supported Node Type/s:__ `HTMLElement`
5054
*/
5155
endContent?: UI5WCSlotsNode;
5256

@@ -58,6 +62,8 @@ interface BarPropTypes
5862
*
5963
* __Note:__ When passing a custom React component to this prop, you have to make sure your component reads the `slot` prop and appends it to the most outer element of your component.
6064
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
65+
*
66+
* __Supported Node Type/s:__ `HTMLElement`
6167
*/
6268
startContent?: UI5WCSlotsNode;
6369
}

packages/main/src/webComponents/BarcodeScannerDialog/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ interface BarcodeScannerDialogPropTypes
4343
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
4444
*
4545
* **Note:** Available since [v2.4.0](https://github.com/UI5/webcomponents/releases/tag/v2.4.0) of **@ui5/webcomponents-fiori**.
46+
*
47+
* __Supported Node Type/s:__ `HTMLElement`
4648
*/
4749
footer?: UI5WCSlotsNode;
4850

@@ -59,6 +61,8 @@ interface BarcodeScannerDialogPropTypes
5961
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
6062
*
6163
* **Note:** Available since [v2.4.0](https://github.com/UI5/webcomponents/releases/tag/v2.4.0) of **@ui5/webcomponents-fiori**.
64+
*
65+
* __Supported Node Type/s:__ `HTMLElement`
6266
*/
6367
header?: UI5WCSlotsNode;
6468
/**

packages/main/src/webComponents/Breadcrumbs/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ interface BreadcrumbsPropTypes
3535
* Defines the component items.
3636
*
3737
* **Note:** Use the `BreadcrumbsItem` component to define the desired items.
38+
*
39+
* __Supported Node Type/s:__ `BreadcrumbsItem`
3840
*/
3941
children?: ReactNode | ReactNode[];
4042
/**

packages/main/src/webComponents/BreadcrumbsItem/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ interface BreadcrumbsItemPropTypes
4646
* Defines the text of the component.
4747
*
4848
* **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
49+
*
50+
* __Supported Node Type/s:__ `Node`
4951
*/
5052
children?: ReactNode | ReactNode[];
5153
}

packages/main/src/webComponents/BusyIndicator/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ interface BusyIndicatorPropTypes
4646
Omit<CommonProps, keyof BusyIndicatorAttributes | 'children'> {
4747
/**
4848
* Determines the content over which the component will appear.
49+
*
50+
* __Supported Node Type/s:__ `Node`
4951
*/
5052
children?: ReactNode | ReactNode[];
5153
}

packages/main/src/webComponents/Button/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ interface ButtonPropTypes
162162
* Learn more about it [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/knowledge-base-handling-slots--docs).
163163
*
164164
* **Note:** Available since [v2.7.0](https://github.com/UI5/webcomponents/releases/tag/v2.7.0) of **@ui5/webcomponents**.
165+
*
166+
* __Supported Node Type/s:__ `ButtonBadge`
165167
*/
166168
badge?: UI5WCSlotsNode;
167169

168170
/**
169171
* Defines the text of the component.
170172
*
171173
* **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
174+
*
175+
* __Supported Node Type/s:__ `Node`
172176
*/
173177
children?: ReactNode | ReactNode[];
174178
/**

0 commit comments

Comments
 (0)