Skip to content

Commit 4b4815b

Browse files
authored
refactor: harmonize prop/enum names (#6040)
BREAKING CHANGE: __ActionSheet:__ `a11yConfig` has been renamed to `accessibilityAttributes`. BREAKING CHANGE: __AnalyticalTable:__ The properties and values for the `AnalyticalTableSelectionMode` enum has been changed. `SingleSelect` is now `Single` and `MultiSelect` is now `Multiple`. BREAKING CHANGE: __AnalyticalTable:__ `a11yConfig` has been renamed to `accessibilityAttributes`. BREAKING CHANGE: __ObjectPage:__ `a11yConfig` has been renamed to `accessibilityAttributes`. BREAKING CHANGE: __ObjectStatus:__ `active` has been renamed to `interactive`.
1 parent 7e19fbb commit 4b4815b

26 files changed

+133
-110
lines changed

docs/MigrationGuide.mdx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ Please use the following components instead:
405405

406406
**Renamed Props:**
407407

408-
- `a11yConfig.dynamicPageAnchorBar` has been renamed to `a11yConfig.objectPageAnchorBar`
408+
- `a11yConfig` has been renamed to `accessibilityAttributes`
409+
- `a11yConfig.dynamicPageAnchorBar` has been renamed to `accessibilityAttributes.objectPageAnchorBar`
409410

410411
Also, the namings of internal `data-component-name` attributes have been adjusted accordingly. E.g. `data-component-name="DynamicPageTitleSubHeader"` has been renamed to `data-component-name="ObjectPageTitleSubHeader"`
411412

@@ -443,16 +444,15 @@ function MyComponent() {
443444
### ActionSheet
444445

445446
The prop `portalContainer` has been removed as it is no longer needed due to the [popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) which is now used in the UI5 Web Components.
446-
For a better aligned API, the `showCancelButton` prop has been replaced wih the `hideCancelButton` prop and the logic has been inverted.
447-
You only need to apply changes to your code if `showCancelButton` has been set to `false`.
447+
For a better aligned API, the `showCancelButton` prop has been replaced wih the `hideCancelButton` prop and the logic has been inverted. Also, the `a11yConfig` prop has been renamed to `accessibilityAttributes`.
448448

449449
```tsx
450450
// v1
451451
import { ActionSheet, Button } from '@ui5/webcomponents-react';
452452

453453
function MyComponent() {
454454
return (
455-
<ActionSheet showCancelButton={false}>
455+
<ActionSheet showCancelButton={false} a11yConfig={{ actionSheetMobileContent: { role: 'menu' } }}>
456456
<Button>Action 1</Button>
457457
</ActionSheet>
458458
);
@@ -463,7 +463,7 @@ import { ActionSheet, Button } from '@ui5/webcomponents-react';
463463

464464
function MyComponent() {
465465
return (
466-
<ActionSheet hideCancelButton>
466+
<ActionSheet hideCancelButton accessibilityAttributes={{ actionSheetMobileContent: { role: 'menu' } }}>
467467
<Button>Action 1</Button>
468468
</ActionSheet>
469469
);
@@ -483,13 +483,19 @@ function MyComponent() {
483483

484484
**Renamed Enums:**
485485

486-
Only the names of the following enums have changed, so it's sufficient to replace them with the new name.
486+
Names of the following enums have changed:
487487

488488
- `TableScaleWidthMode` is now `AnalyticalTableScaleWidthMode`
489489
- `TableSelectionBehavior` is now `AnalyticalTableSelectionBehavior`
490490
- `TableSelectionMode` is now `AnalyticalTableSelectionMode`
491491
- `TableVisibleRowCountMode` is now `AnalyticalTableVisibleRowCountMode`
492492

493+
**Changed Enums:**
494+
495+
- The properties and values for the `AnalyticalTableSelectionMode` enum has been changed.
496+
- `SingleSelect` is now `Single`
497+
- `MultiSelect` is now `Multiple`.
498+
493499
**[Column Properties](https://sap.github.io/ui5-webcomponents-react/?path=/docs/data-display-analyticaltable--docs#column-properties) Changes**
494500

495501
- `canReorder` has been removed, please use `disableDragAndDrop` instead.
@@ -505,6 +511,7 @@ const columns = [{ ...otherProperties, canReorder: false }];
505511
scaleWidthMode={TableScaleWidthMode.Grow}
506512
selectionBehavior={TableSelectionBehavior.Row}
507513
selectionMode={TableSelectionMode.MultiSelect}
514+
// selectionMode={TableSelectionMode.SingleSelect}
508515
visibleRowCountMode={TableVisibleRowCountMode.Interactive}
509516
/>;
510517

@@ -517,7 +524,8 @@ const columns = [{ ...otherProps, disableDragAndDrop: true }];
517524
subComponentsBehavior={AnalyticalTableSubComponentsBehavior.Visible}
518525
scaleWidthMode={AnalyticalTableScaleWidthMode.Grow}
519526
selectionBehavior={AnalyticalTableSelectionBehavior.Row}
520-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
527+
selectionMode={AnalyticalTableSelectionMode.Multiple}
528+
// selectionMode={AnalyticalTableSelectionMode.Single}
521529
visibleRowCountMode={AnalyticalTableVisibleRowCountMode.Interactive}
522530
/>;
523531
```
@@ -610,9 +618,13 @@ The prop `titleText` is now required and the default value `true` has been remov
610618

611619
The prop `titleText` is now required.
612620

621+
### ObjectStatus
622+
623+
For better alignment with the UI5 Web Components the `active` prop has been renamed to `interactive`.
624+
613625
## Enum Changes
614626

615-
For a better alignment with the UI5 Web Components, the following enums have been renamed:
627+
For better alignment with the UI5 Web Components, the following enums have been renamed:
616628

617629
- `MessageBoxActions` has been renamed to `MessageBoxAction`
618630
- `MessageBoxTypes` has been renamed to `MessageBoxType`

packages/cli/src/scripts/codemod/transforms/v2/codemodConfig.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
},
1010
"ActionSheet": {
1111
"changedProps": {
12+
"a11yConfig": "accessibilityAttributes",
1213
"onAfterClose": "onClose",
1314
"onAfterOpen": "onOpen",
1415
"placementType": "placement",
1516
"showCancelButton": "hideCancelButton"
1617
},
1718
"removedProps": ["portalContainer"]
1819
},
19-
"AnalyticalTable": {},
20+
"AnalyticalTable": {
21+
"renamedEnums": {
22+
"selectionMode": "AnalyticalTableSelectionMode"
23+
}
24+
},
2025
"Avatar": {},
2126
"Badge": {
2227
"newComponent": "Tag"
@@ -286,7 +291,15 @@
286291
},
287292
"removedProps": ["selected"]
288293
},
294+
"ObjectPage": {
295+
"changedProps": {
296+
"a11yConfig": "accessibilityAttributes"
297+
}
298+
},
289299
"ObjectStatus": {
300+
"changedProps": {
301+
"active": "interactive"
302+
},
290303
"renamedEnums": {
291304
"state": "ValueState"
292305
}
@@ -618,6 +631,10 @@
618631
"Themes": "Theme"
619632
},
620633
"enumProperties": {
634+
"AnalyticalTableSelectionMode": {
635+
"SingleSelect": "Single",
636+
"MultiSelect": "Multiple"
637+
},
621638
"BusyIndicatorSize": {
622639
"Small": "S",
623640
"Medium": "M",

packages/main/src/components/ActionSheet/ActionSheet.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const meta = {
2424
header: {
2525
control: { disable: true }
2626
},
27-
a11yConfig: { table: { category: 'A11y props' } }
27+
accessibilityAttributes: { table: { category: 'Accessibility props' } }
2828
},
2929
args: {
3030
horizontalAlign: PopoverHorizontalAlign.Center,

packages/main/src/components/ActionSheet/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export interface ActionSheetPropTypes extends Omit<ResponsivePopoverPropTypes, '
4444
*/
4545
hideCancelButton?: boolean;
4646
/**
47-
* Defines internally used a11y properties.
47+
* Defines internally used accessibility properties/attributes.
4848
*/
49-
a11yConfig?: {
49+
accessibilityAttributes?: {
5050
actionSheetMobileContent?: {
5151
role?: string;
5252
};
@@ -116,7 +116,8 @@ function ActionSheetButton(props: ActionSheetButtonPropTypes) {
116116
*
117117
*/
118118
const ActionSheet = forwardRef<ResponsivePopoverDomRef, ActionSheetPropTypes>((props, ref) => {
119-
const { a11yConfig, children, className, header, headerText, hideCancelButton, onOpen, open, ...rest } = props;
119+
const { accessibilityAttributes, children, className, header, headerText, hideCancelButton, onOpen, open, ...rest } =
120+
props;
120121

121122
useStylesheet(styleData, ActionSheet.displayName);
122123

@@ -229,7 +230,7 @@ const ActionSheet = forwardRef<ResponsivePopoverDomRef, ActionSheetPropTypes>((p
229230
<div
230231
className={isPhone() ? classNames.contentMobile : undefined}
231232
data-component-name="ActionSheetMobileContent"
232-
role={a11yConfig?.actionSheetMobileContent?.role ?? 'application'}
233+
role={accessibilityAttributes?.actionSheetMobileContent?.role ?? 'application'}
233234
onKeyDown={handleKeyDown}
234235
ref={actionBtnsRef}
235236
>

packages/main/src/components/AnalyticalTable/AnalyticalTable.cy.tsx

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ describe('AnalyticalTable', () => {
484484
}}
485485
data={dataTree}
486486
globalFilterValue={filter}
487-
selectionMode="MultiSelect"
487+
selectionMode="Multiple"
488488
/>
489489
<div data-testid="payloadHelper">
490490
{JSON.stringify(relevantPayload?.selectedFlatRows?.filter(Boolean).length)}
@@ -587,7 +587,7 @@ describe('AnalyticalTable', () => {
587587
setAllRowsSelected(e.detail.allRowsSelected);
588588
onRowSelect(e);
589589
}}
590-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
590+
selectionMode={AnalyticalTableSelectionMode.Multiple}
591591
selectedRowIds={selectedRowIds}
592592
/>
593593
<p>
@@ -790,7 +790,7 @@ describe('AnalyticalTable', () => {
790790
onRowSelect(e);
791791
}}
792792
data={groupableData}
793-
selectionMode="MultiSelect"
793+
selectionMode="Multiple"
794794
/>
795795
<div data-testid="selectedFlatRowsLength">
796796
{JSON.stringify(relevantPayload?.selectedFlatRows?.filter(Boolean).length)}
@@ -833,7 +833,7 @@ describe('AnalyticalTable', () => {
833833
return (
834834
<>
835835
<AnalyticalTable
836-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
836+
selectionMode={AnalyticalTableSelectionMode.Multiple}
837837
data={dataTree}
838838
columns={columns}
839839
isTreeTable
@@ -947,7 +947,7 @@ describe('AnalyticalTable', () => {
947947
const indeterminateChange = cy.spy().as('onIndeterminateChangeSpy');
948948
cy.mount(
949949
<AnalyticalTable
950-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
950+
selectionMode={AnalyticalTableSelectionMode.Multiple}
951951
data={dataTree}
952952
columns={columns}
953953
isTreeTable
@@ -1086,7 +1086,7 @@ describe('AnalyticalTable', () => {
10861086
[
10871087
{ props: {}, bothWidth: 952, onlyNameWidth: 1904, onlyAgeWidth: 1904 },
10881088
{
1089-
props: { selectionMode: AnalyticalTableSelectionMode.MultiSelect },
1089+
props: { selectionMode: AnalyticalTableSelectionMode.Multiple },
10901090
bothWidth: 930,
10911091
onlyNameWidth: 1860,
10921092
onlyAgeWidth: 1860
@@ -1107,7 +1107,7 @@ describe('AnalyticalTable', () => {
11071107
props: {
11081108
withNavigationHighlight: true,
11091109
withRowHighlight: true,
1110-
selectionMode: AnalyticalTableSelectionMode.SingleSelect
1110+
selectionMode: AnalyticalTableSelectionMode.Single
11111111
},
11121112
bothWidth: 924,
11131113
onlyNameWidth: 1848,
@@ -1397,9 +1397,7 @@ describe('AnalyticalTable', () => {
13971397
accessor: 'friend.name'
13981398
}
13991399
];
1400-
cy.mount(
1401-
<AnalyticalTable selectionMode="SingleSelect" data={data.slice(0, 2)} columns={columns} onRowSelect={select} />
1402-
);
1400+
cy.mount(<AnalyticalTable selectionMode="Single" data={data.slice(0, 2)} columns={columns} onRowSelect={select} />);
14031401
cy.findAllByText('Custom Cell Button')
14041402
.should('have.length', 2)
14051403
.each(($cellBtn) => {
@@ -1429,7 +1427,7 @@ describe('AnalyticalTable', () => {
14291427
}
14301428
];
14311429
cy.mount(
1432-
<AnalyticalTable selectionMode="SingleSelect" data={data.slice(0, 2)} columns={columns2} onRowSelect={select} />
1430+
<AnalyticalTable selectionMode="Single" data={data.slice(0, 2)} columns={columns2} onRowSelect={select} />
14331431
);
14341432
cy.findAllByText('Custom Cell Button')
14351433
.should('have.length', 2)
@@ -1536,7 +1534,7 @@ describe('AnalyticalTable', () => {
15361534
<AnalyticalTable
15371535
data={data}
15381536
columns={columns}
1539-
selectionMode={AnalyticalTableSelectionMode.SingleSelect}
1537+
selectionMode={AnalyticalTableSelectionMode.Single}
15401538
selectionBehavior={AnalyticalTableSelectionBehavior.RowOnly}
15411539
/>
15421540
);
@@ -1545,7 +1543,7 @@ describe('AnalyticalTable', () => {
15451543
<AnalyticalTable
15461544
data={data}
15471545
columns={columns}
1548-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
1546+
selectionMode={AnalyticalTableSelectionMode.Multiple}
15491547
selectionBehavior={AnalyticalTableSelectionBehavior.RowOnly}
15501548
/>
15511549
);
@@ -1572,7 +1570,7 @@ describe('AnalyticalTable', () => {
15721570
data={data}
15731571
columns={columns}
15741572
withNavigationHighlight
1575-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
1573+
selectionMode={AnalyticalTableSelectionMode.Multiple}
15761574
markNavigatedRow={markNavigatedRow}
15771575
onRowSelect={onRowSelect}
15781576
/>
@@ -1595,7 +1593,7 @@ describe('AnalyticalTable', () => {
15951593
const selectedRowColor = cssVarToRgb(ThemingParameters.sapList_SelectionBackgroundColor);
15961594
cy.mount(
15971595
<AnalyticalTable
1598-
selectionMode={AnalyticalTableSelectionMode.SingleSelect}
1596+
selectionMode={AnalyticalTableSelectionMode.Single}
15991597
data={data}
16001598
columns={columns}
16011599
reactTableOptions={{
@@ -1620,7 +1618,7 @@ describe('AnalyticalTable', () => {
16201618
data={data}
16211619
columns={columns}
16221620
selectionBehavior={AnalyticalTableSelectionBehavior.Row}
1623-
selectionMode={AnalyticalTableSelectionMode.SingleSelect}
1621+
selectionMode={AnalyticalTableSelectionMode.Single}
16241622
onRowClick={rowClick}
16251623
onRowSelect={rowSelect}
16261624
/>
@@ -1648,7 +1646,7 @@ describe('AnalyticalTable', () => {
16481646
data={data}
16491647
columns={columns}
16501648
selectionBehavior={AnalyticalTableSelectionBehavior.Row}
1651-
selectionMode={AnalyticalTableSelectionMode.SingleSelect}
1649+
selectionMode={AnalyticalTableSelectionMode.Single}
16521650
onRowClick={rowSelectWithoutSelCell}
16531651
onRowSelect={rowSelect}
16541652
/>
@@ -2005,7 +2003,7 @@ describe('AnalyticalTable', () => {
20052003
columns={columns}
20062004
onRowSelect={onRowSelect}
20072005
onRowClick={onRowClick}
2008-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2006+
selectionMode={AnalyticalTableSelectionMode.Multiple}
20092007
tableHooks={[useRowDisableSelection('disableSelection')]}
20102008
minRows={1}
20112009
/>
@@ -2041,7 +2039,7 @@ describe('AnalyticalTable', () => {
20412039
it('plugin hook: useManualRowSelect', () => {
20422040
cy.mount(
20432041
<AnalyticalTable
2044-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2042+
selectionMode={AnalyticalTableSelectionMode.Multiple}
20452043
data={manualSelectData}
20462044
columns={columns}
20472045
tableHooks={[useManualRowSelect('isSelected')]}
@@ -2059,7 +2057,7 @@ describe('AnalyticalTable', () => {
20592057
const [, ...updatedManualSelectData] = manualSelectData;
20602058
cy.mount(
20612059
<AnalyticalTable
2062-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2060+
selectionMode={AnalyticalTableSelectionMode.Multiple}
20632061
data={[
20642062
{
20652063
name: 'Selected',
@@ -2096,7 +2094,7 @@ describe('AnalyticalTable', () => {
20962094
Show Selected
20972095
</Button>
20982096
<AnalyticalTable
2099-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2097+
selectionMode={AnalyticalTableSelectionMode.Multiple}
21002098
data={data}
21012099
columns={columns}
21022100
tableInstance={instance}
@@ -2388,7 +2386,7 @@ describe('AnalyticalTable', () => {
23882386
<AnalyticalTable
23892387
columns={columns}
23902388
data={data}
2391-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2389+
selectionMode={AnalyticalTableSelectionMode.Multiple}
23922390
onRowSelect={handleSelect}
23932391
/>
23942392
<span data-testid="payload">{stringifiedPl}</span>
@@ -2825,7 +2823,7 @@ describe('AnalyticalTable', () => {
28252823
<AnalyticalTable
28262824
data={generateMoreData(50)}
28272825
columns={columns}
2828-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2826+
selectionMode={AnalyticalTableSelectionMode.Multiple}
28292827
/>
28302828
);
28312829

@@ -2838,7 +2836,7 @@ describe('AnalyticalTable', () => {
28382836
<AnalyticalTable
28392837
data={generateMoreData(50)}
28402838
columns={columns}
2841-
selectionMode={AnalyticalTableSelectionMode.MultiSelect}
2839+
selectionMode={AnalyticalTableSelectionMode.Multiple}
28422840
withRowHighlight
28432841
/>
28442842
);

packages/main/src/components/AnalyticalTable/AnalyticalTable.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ import * as ComponentStories from './AnalyticalTable.stories';
137137
selectedRowIds={{
138138
3: true
139139
}}
140-
selectionMode="SingleSelect"
140+
selectionMode="Single"
141141
withRowHighlight
142142
/>
143143
```

0 commit comments

Comments
 (0)