Skip to content

Commit 799e0dc

Browse files
authored
fix(cli): improve description for events & outline experimental components (#6625)
1 parent 36aa447 commit 799e0dc

File tree

95 files changed

+823
-24
lines changed

Some content is hidden

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

95 files changed

+823
-24
lines changed

.storybook/components/DocsHeader.module.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,17 @@
3535
.infoTable td[data-import-cell='true'] {
3636
padding-inline-end: 2.5rem;
3737
}
38+
39+
.titleRow {
40+
padding-block-end: 0.5rem;
41+
}
42+
43+
.titleRow :global(.sbdocs-title) {
44+
margin-bottom: 0;
45+
}
46+
47+
.experimentalLabel {
48+
font-size: var(--sapObjectHeader_Title_SnappedFontSize);
49+
margin-inline-start: 0.25rem;
50+
align-self: flex-end;
51+
}

.storybook/components/DocsHeader.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface InfoTableProps {
4949
subComponents?: string[];
5050
mergeSubComponents?: boolean;
5151
isChart?: boolean;
52+
experimental?: boolean;
5253
}
5354

5455
export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTableProps) => {
@@ -128,11 +129,12 @@ export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTabl
128129
);
129130
};
130131

131-
export const DocsHeader = ({ since, subComponents, mergeSubComponents, isChart }: InfoTableProps) => {
132+
export const DocsHeader = ({ since, subComponents, mergeSubComponents, isChart, experimental }: InfoTableProps) => {
132133
return (
133134
<ThemeProvider>
134-
<FlexBox alignItems={FlexBoxAlignItems.Center}>
135+
<FlexBox alignItems={FlexBoxAlignItems.Center} className={classes.titleRow}>
135136
<Title />
137+
{experimental && <Label className={classes.experimentalLabel}>experimental</Label>}
136138
<span style={{ flexGrow: 1 }} />
137139
<Links />
138140
</FlexBox>

.storybook/manager-head.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
input:not(:checked) ~ span:first-of-type {
5151
background-color: transparent !important;
5252
}
53+
54+
/*experimental components */
55+
#data-display-table::after,
56+
#inputs-tokenizer::after,
57+
#layouts-floorplans-form::after,
58+
#charts-timelinechart::after {
59+
content: '(experimental)';
60+
overflow: hidden;
61+
}
5362
</style>
5463

5564
<script data-ui5-config type="application/json">

.storybook/preview-head.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@
8383
position: static;
8484
}
8585

86+
/* table in props description (table in ArgsTable) */
87+
.docblock-argstable-body table {
88+
max-width: 10rem;
89+
table-layout: fixed;
90+
border-collapse: collapse;
91+
border-spacing: 1px;
92+
text-align: center;
93+
}
94+
.docblock-argstable-body table th {
95+
background-color: #eceff1;
96+
color: #2e3438 !important;
97+
border: 1px solid #dededf !important;
98+
padding: 0px !important;
99+
padding-block: 0.125rem !important;
100+
}
101+
.docblock-argstable-body table td {
102+
border: 1px solid #dededf !important;
103+
padding: 0px !important;
104+
padding-block: 0.125rem !important;
105+
}
106+
86107
/* TODO remove this workaround as soon as https://github.com/storybookjs/storybook/issues/20497 is fixed */
87108
.docs-story > div > div[scale] {
88109
min-height: 20px;

packages/charts/src/components/TimelineChart/TimeLineChart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TimelineChartAnnotation } from './TimelineChartAnnotation';
66

77
<Meta of={ComponentStories} />
88

9-
<DocsHeader isChart since="1.10.0" />
9+
<DocsHeader isChart since="1.10.0" experimental />
1010

1111
<Canvas of={ComponentStories.Default} />
1212

packages/charts/src/components/TimelineChart/TimeLineChart.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TimelineChart } from './TimelineChart.js';
66
import { TimelineChartAnnotation } from './TimelineChartAnnotation.js';
77

88
const meta = {
9-
title: 'TimelineChart (experimental)',
9+
title: 'TimelineChart',
1010
component: TimelineChart,
1111
argTypes: {
1212
dataset: {

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class ComponentRenderer extends AbstractRenderer {
1414
private note: string = '';
1515
private isAbstract: boolean = false;
1616
private since: string | undefined;
17+
private isExperimental: boolean | string | undefined = false;
1718

1819
setAttributes(attrs: CEM.ClassField[]) {
1920
this.attributes.push(...attrs);
@@ -50,6 +51,11 @@ export class ComponentRenderer extends AbstractRenderer {
5051
return this;
5152
}
5253

54+
setIsExperimental(value?: boolean | string) {
55+
this.isExperimental = value;
56+
return this;
57+
}
58+
5359
prepare(context: WebComponentWrapper) {
5460
context.exportSet.add(context.componentName);
5561
}
@@ -64,10 +70,13 @@ export class ComponentRenderer extends AbstractRenderer {
6470
comment += ` *\n`;
6571
comment += ` * @since [${this.since}](https://github.com/SAP/ui5-webcomponents/releases/tag/v${this.since}) of __${context.packageName}__.\n`;
6672
}
67-
6873
if (this.isAbstract) {
6974
comment += ' * @abstract\n';
7075
}
76+
if (this.isExperimental) {
77+
comment += ` * @experimental${typeof this.isExperimental === 'string' ? ` ${this.isExperimental}` : ''}\n`;
78+
}
79+
7180
comment += '*/';
7281

7382
const component = dedent`

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ export class PropTypesRenderer extends AbstractRenderer {
114114
descriptionParts.push(` * @deprecated`);
115115
}
116116
}
117+
if (
118+
Object.prototype.hasOwnProperty.call(event, '_ui5Bubbles') ||
119+
Object.prototype.hasOwnProperty.call(event, '_ui5Cancelable')
120+
) {
121+
descriptionParts.push(` *`);
122+
descriptionParts.push(`* | cancelable | bubbles |`);
123+
descriptionParts.push(`* | :--------: | :-----: |`);
124+
descriptionParts.push(`* | ${event._ui5Cancelable ? '✅' : '❌'}|${event._ui5Bubbles ? '✅' : '❌'}|`);
125+
}
117126

118127
const domRef = `${context.componentName}DomRef`;
119128
let eventType = '(event: unknown) => void;';

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default async function createWrappers(packageName: string, outDir: string
6666
.setNote(options.additionalComponentNote ?? '')
6767
.setIsAbstract(declaration._ui5abstract ?? false)
6868
.setSince(declaration._ui5since)
69+
.setIsExperimental(declaration._ui5experimental)
6970
);
7071
wrapper.addRenderer(new ExportsRenderer());
7172

packages/compat/src/components/Table/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,30 @@ interface TablePropTypes
175175
* **Note:** The event will be fired if `growing` is set to `Button` or `Scroll`.
176176
*
177177
* **Note:** Available since [v2.0.0](https://github.com/SAP/ui5-webcomponents/releases/tag/v2.0.0) of **@ui5/webcomponents-compat**.
178+
*
179+
* | cancelable | bubbles |
180+
* | :--------: | :-----: |
181+
* | ❌|✅|
178182
*/
179183
onLoadMore?: (event: Ui5CustomEvent<TableDomRef>) => void;
180184

181185
/**
182186
* Fired when `TableColumn` is shown as a pop-in instead of hiding it.
183187
*
184188
* **Note:** Available since [v2.0.0](https://github.com/SAP/ui5-webcomponents/releases/tag/v2.0.0) of **@ui5/webcomponents-compat**.
189+
*
190+
* | cancelable | bubbles |
191+
* | :--------: | :-----: |
192+
* | ❌|✅|
185193
*/
186194
onPopinChange?: (event: Ui5CustomEvent<TableDomRef, TablePopinChangeEventDetail>) => void;
187195

188196
/**
189197
* Fired when a row in `Active` mode is clicked or `Enter` key is pressed.
198+
*
199+
* | cancelable | bubbles |
200+
* | :--------: | :-----: |
201+
* | ❌|✅|
190202
*/
191203
onRowClick?: (event: Ui5CustomEvent<TableDomRef, TableRowClickEventDetail>) => void;
192204

@@ -195,6 +207,10 @@ interface TablePropTypes
195207
* in `SingleSelect` and `MultiSelect` modes.
196208
*
197209
* **Note:** Available since [v2.0.0](https://github.com/SAP/ui5-webcomponents/releases/tag/v2.0.0) of **@ui5/webcomponents-compat**.
210+
*
211+
* | cancelable | bubbles |
212+
* | :--------: | :-----: |
213+
* | ❌|✅|
198214
*/
199215
onSelectionChange?: (event: Ui5CustomEvent<TableDomRef, TableSelectionChangeEventDetail>) => void;
200216
}

0 commit comments

Comments
 (0)