Skip to content

Commit a879f43

Browse files
committed
feat(side-panel): extract status actions into new component
The main motivation is to allow access to the native elements. In some applications a status action triggers a menu or overlay. This is currently built by those apps using a DOM query. With this change, they can just use the overlay directive. In addition, we can deprecate the `StatusItem` interface, which depends on the already deprecated `MenuItem`. The usage is quite simple: ```html <si-side-panel-content> <si-side-panel-actions> <button type="button" si-side-panel-action icon="element-alarm-background-filled" iconColor="status-danger" overlayIcon="element-alarm-tick" overlayIconColor="text-body" (click)="action()" > Action </button> </si-side-panel-actions> </si-side-panel-content> ```
1 parent b23de18 commit a879f43

File tree

27 files changed

+833
-45
lines changed

27 files changed

+833
-45
lines changed

api-goldens/element-ng/side-panel/index.api.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ export interface SidePanelNavigateRouterLink {
5151
// @public
5252
export type SidePanelSize = 'regular' | 'wide' | 'extended';
5353

54+
// @public
55+
export class SiSidePanelActionComponent {
56+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
57+
readonly icon: _angular_core.InputSignal<string>;
58+
readonly iconColor: _angular_core.InputSignal<string | undefined>;
59+
readonly stackedIcon: _angular_core.InputSignal<string | undefined>;
60+
readonly stackedIconColor: _angular_core.InputSignal<string | undefined>;
61+
}
62+
63+
// @public
64+
export class SiSidePanelActionsComponent {
65+
}
66+
5467
// @public (undocumented)
5568
export class SiSidePanelComponent implements OnInit, OnDestroy, OnChanges {
5669
constructor();
@@ -85,6 +98,7 @@ export class SiSidePanelContentComponent implements OnInit {
8598
readonly searchPlaceholder: _angular_core.InputSignal<TranslatableString>;
8699
readonly secondaryActions: _angular_core.InputSignal<(MenuItem | MenuItem_2)[]>;
87100
readonly showMobileDrawerBadge: _angular_core.InputSignalWithTransform<boolean, unknown>;
101+
// @deprecated
88102
readonly statusActions: _angular_core.InputSignal<StatusItem[]>;
89103
toggleFullscreen(): void;
90104
readonly toggleItemLabel: _angular_core.InputSignal<TranslatableString>;
@@ -113,7 +127,7 @@ export class SiSidePanelService {
113127
toggleFullscreen(): void;
114128
}
115129

116-
// @public
130+
// @public @deprecated
117131
export interface StatusItem extends MenuItem {
118132
// (undocumented)
119133
overlayIcon?: string;

playwright/e2e/element-examples/si-side-panel.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ test.describe('si-side-panel', () => {
88
const example = 'si-side-panel/si-side-panel';
99
const exampleCollapsible = 'si-side-panel/si-side-panel-collapsible';
1010

11+
const exampleCollapsibleLegacyStatusActions =
12+
'si-side-panel/si-side-panel-collapsible-legacy-status-actions';
13+
1114
test(`${example} - modes and backdrop`, async ({ page, si }) => {
1215
await si.visitExample(example);
1316

@@ -63,6 +66,18 @@ test.describe('si-side-panel', () => {
6366
await si.runVisualAndA11yTests('open');
6467
});
6568

69+
test(exampleCollapsibleLegacyStatusActions, async ({ page, si }) => {
70+
await si.visitExample(exampleCollapsibleLegacyStatusActions);
71+
72+
await page.locator('.btn').getByText('close').click();
73+
await expect(page.locator('si-side-panel.rpanel-collapsed')).toBeVisible();
74+
await si.runVisualAndA11yTests('legacy-closed');
75+
76+
await page.locator('.btn').getByText('Toggle side panel').click();
77+
await expect(page.locator('si-side-panel:not(.rpanel-collapsed)')).toBeVisible();
78+
await si.runVisualAndA11yTests('legacy-open');
79+
});
80+
6681
test(`${example} - fullscreen button visibility`, async ({ page, si }) => {
6782
await page.setViewportSize({ width: 500, height: 800 });
6883
await si.visitExample(example);
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

playwright/snapshots/si-side-panel.spec.ts-snapshots/si-side-panel--si-side-panel-collapsible--closed.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
- button "Toggle"
2-
- link "Out of Service":
3-
- /url: ""
4-
- link "Event source active, ack":
5-
- /url: ""
2+
- button "Out of Service"
3+
- button "Event source active, ack"
64
- button "Properties"
75
- button "Documents"
86
- button "Graphics"
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

playwright/snapshots/si-side-panel.spec.ts-snapshots/si-side-panel--si-side-panel-collapsible--open.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
- menuitem "Toggle"
66
- button "Enter fullscreen"
77
- button "Toggle"
8-
- link "Out of Service":
9-
- /url: ""
10-
- link "Event source active, ack":
11-
- /url: ""
8+
- button "Out of Service"
9+
- button "Event source active, ack"
1210
- textbox "Search..."
1311
- button "Properties 5" [expanded]
1412
- region "Properties 5": And here we have some content
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)