@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.3 → 2.2.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/openbridge-webcomponents.bundle.js +52 -42
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +9 -5
- package/dist/components/alert-counter-item/alert-counter-item.css.js +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.css.js.map +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.d.ts +5 -5
- package/dist/components/alert-counter-item/alert-counter-item.d.ts.map +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.js +2 -2
- package/dist/components/alert-counter-item/alert-counter-item.js.map +1 -1
- package/dist/components/badge/badge.css.js +4 -0
- package/dist/components/badge/badge.css.js.map +1 -1
- package/dist/components/top-bar/top-bar.css.js +5 -0
- package/dist/components/top-bar/top-bar.css.js.map +1 -1
- package/dist/components/top-bar/top-bar.d.ts +5 -1
- package/dist/components/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/top-bar/top-bar.js +1 -0
- package/dist/components/top-bar/top-bar.js.map +1 -1
- package/package.json +1 -1
- package/src/components/alert-counter-item/alert-counter-item.css +1 -1
- package/src/components/alert-counter-item/alert-counter-item.spec.ts +27 -3
- package/src/components/alert-counter-item/alert-counter-item.ts +5 -5
- package/src/components/badge/badge.css +4 -0
- package/src/components/top-bar/top-bar-asset-picker.spec.ts +54 -0
- package/src/components/top-bar/top-bar.css +5 -0
- package/src/components/top-bar/top-bar.stories.ts +130 -78
- package/src/components/top-bar/top-bar.ts +6 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {describe, expect, it} from 'vitest';
|
|
2
2
|
import {render} from 'vitest-browser-lit';
|
|
3
3
|
import {html} from 'lit';
|
|
4
|
+
import '../../main.css';
|
|
4
5
|
import './alert-counter-item.js';
|
|
5
6
|
import {
|
|
6
7
|
ObcAlertCounterItem,
|
|
@@ -36,6 +37,15 @@ function lastBadge(el: ObcAlertCounterItem): ObcBadge {
|
|
|
36
37
|
return all[all.length - 1];
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
/** Top and bottom edge of each drawn badge box, in CSS px. */
|
|
41
|
+
function badgeEdges(el: ObcAlertCounterItem): [number, number][] {
|
|
42
|
+
return badges(el).map((badge) => {
|
|
43
|
+
const box = badge.shadowRoot!.querySelector('.wrapper')!;
|
|
44
|
+
const {top, bottom} = box.getBoundingClientRect();
|
|
45
|
+
return [top, bottom];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
describe('obc-alert-counter-item', () => {
|
|
40
50
|
it('renders one filled badge per positive count, most severe first', async () => {
|
|
41
51
|
const el = await setup({countCaution: 6, countAlarm: 2, countWarning: 0});
|
|
@@ -59,20 +69,34 @@ describe('obc-alert-counter-item', () => {
|
|
|
59
69
|
]);
|
|
60
70
|
});
|
|
61
71
|
|
|
62
|
-
it('adds the shelved count last, with the
|
|
72
|
+
it('adds the shelved count last, with the timer icon in both types', async () => {
|
|
63
73
|
const filled = await setup({countAlarm: 2}, {shelvedCount: 9});
|
|
64
74
|
expect([
|
|
65
75
|
lastBadge(filled).type,
|
|
66
76
|
lastBadge(filled).number,
|
|
67
77
|
lastBadge(filled).showIcon,
|
|
68
78
|
]).toEqual(['regular', 9, true]);
|
|
69
|
-
expect(lastBadge(filled).querySelector('obi-
|
|
79
|
+
expect(lastBadge(filled).querySelector('obi-timer-2')).not.toBeNull();
|
|
70
80
|
|
|
71
81
|
const level = await setup(
|
|
72
82
|
{countAlarm: 2},
|
|
73
83
|
{type: ObcAlertCounterItemType.AlertLevel, shelvedCount: 9}
|
|
74
84
|
);
|
|
75
|
-
expect(lastBadge(level).querySelector('obi-
|
|
85
|
+
expect(lastBadge(level).querySelector('obi-timer-2')).not.toBeNull();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('draws every badge box on the same top and bottom edge', async () => {
|
|
89
|
+
for (const type of Object.values(ObcAlertCounterItemType)) {
|
|
90
|
+
const el = await setup(
|
|
91
|
+
{countAlarm: 2, countWarning: 4, countCaution: 6},
|
|
92
|
+
{type, shelvedCount: 9}
|
|
93
|
+
);
|
|
94
|
+
const [first, ...rest] = badgeEdges(el);
|
|
95
|
+
|
|
96
|
+
for (const edges of rest) {
|
|
97
|
+
expect(edges, type).toEqual(first);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
76
100
|
});
|
|
77
101
|
|
|
78
102
|
it('renders nothing when nothing is counted', async () => {
|
|
@@ -6,7 +6,7 @@ import componentStyle from './alert-counter-item.css?inline';
|
|
|
6
6
|
import {customElement} from '../../decorator.js';
|
|
7
7
|
import '../badge/badge.js';
|
|
8
8
|
import {BadgeSize, BadgeType, BadgeVariant} from '../badge/badge.js';
|
|
9
|
-
import '../../icons/icon-
|
|
9
|
+
import '../../icons/icon-timer-2.js';
|
|
10
10
|
import type {AlertCounts} from '../../types.js';
|
|
11
11
|
import {alertCountsLabel, rankAlertCounts} from '../../alert-severity.js';
|
|
12
12
|
|
|
@@ -35,8 +35,8 @@ export enum ObcAlertCounterItemType {
|
|
|
35
35
|
* `alert-level` draws flat badges with the severity glyph.
|
|
36
36
|
* - **Every severity:** `counts` takes the whole `AlertType` vocabulary,
|
|
37
37
|
* including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.
|
|
38
|
-
* - **Shelved count:** `shelvedCount` adds a neutral badge with the
|
|
39
|
-
* at the end.
|
|
38
|
+
* - **Shelved count:** `shelvedCount` adds a neutral badge with the timer icon
|
|
39
|
+
* at the end, the icon the Figma counter swaps into its shelved badge.
|
|
40
40
|
* - **Accessible summary:** the row is announced as one image labelled with
|
|
41
41
|
* the counts, e.g. "2 Alarm, 4 Warning, 6 Caution".
|
|
42
42
|
*
|
|
@@ -68,7 +68,7 @@ export enum ObcAlertCounterItemType {
|
|
|
68
68
|
*
|
|
69
69
|
* @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).
|
|
70
70
|
* @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.
|
|
71
|
-
* @property shelvedCount - Number of shelved alerts, shown as a neutral badge with the
|
|
71
|
+
* @property shelvedCount - Number of shelved alerts, shown as a neutral badge with the timer icon after the severities; hidden at zero.
|
|
72
72
|
* @experimental
|
|
73
73
|
*/
|
|
74
74
|
@customElement('obc-alert-counter-item')
|
|
@@ -113,7 +113,7 @@ export class ObcAlertCounterItem extends LitElement {
|
|
|
113
113
|
showIcon
|
|
114
114
|
.number=${this.shelvedCount}
|
|
115
115
|
>
|
|
116
|
-
<obi-
|
|
116
|
+
<obi-timer-2 slot="badge-icon"></obi-timer-2>
|
|
117
117
|
</obc-badge>`
|
|
118
118
|
: nothing
|
|
119
119
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest';
|
|
2
|
+
import {render} from 'vitest-browser-lit';
|
|
3
|
+
import {html} from 'lit';
|
|
4
|
+
import '../../main.css';
|
|
5
|
+
import './top-bar.js';
|
|
6
|
+
import type {ObcTopBar} from './top-bar.js';
|
|
7
|
+
import {tabStops} from '../../internal/_test-utils.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The picker is consumer content, so the bar only has to place it: after the
|
|
11
|
+
* page name, before the command button, and not at all in settings mode.
|
|
12
|
+
*/
|
|
13
|
+
async function setup(settings = false) {
|
|
14
|
+
const screen = render(
|
|
15
|
+
html`<button id="before">before</button>
|
|
16
|
+
<obc-top-bar appTitle="App" pageName="Page" ?settings=${settings}>
|
|
17
|
+
<button slot="asset-picker" id="picker">Merd B</button>
|
|
18
|
+
<button slot="command-button" id="command">command</button>
|
|
19
|
+
</obc-top-bar>`
|
|
20
|
+
);
|
|
21
|
+
const el = screen.container.querySelector('obc-top-bar') as ObcTopBar;
|
|
22
|
+
await el.updateComplete;
|
|
23
|
+
const slot = el.shadowRoot!.querySelector<HTMLSlotElement>(
|
|
24
|
+
'slot[name="asset-picker"]'
|
|
25
|
+
);
|
|
26
|
+
return {el, slot};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('obc-top-bar asset-picker slot', () => {
|
|
30
|
+
it('sits between the page name and the command button', async () => {
|
|
31
|
+
const {slot} = await setup();
|
|
32
|
+
|
|
33
|
+
expect(slot!.assignedElements().map((e) => e.id)).toEqual(['picker']);
|
|
34
|
+
expect(slot!.previousElementSibling!.className).toBe('page-name');
|
|
35
|
+
expect((slot!.nextElementSibling as HTMLSlotElement).name).toBe(
|
|
36
|
+
'command-button'
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('is the tab stop after the menu button', async () => {
|
|
41
|
+
await setup();
|
|
42
|
+
(document.getElementById('before') as HTMLElement).focus();
|
|
43
|
+
|
|
44
|
+
const stops = await tabStops(3);
|
|
45
|
+
|
|
46
|
+
expect(stops.map((e) => e?.id)).toEqual(['', 'picker', 'command']);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('is not rendered in settings mode', async () => {
|
|
50
|
+
const {slot} = await setup(true);
|
|
51
|
+
|
|
52
|
+
expect(slot).toBeNull();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -71,11 +71,16 @@
|
|
|
71
71
|
.dimming-button,
|
|
72
72
|
.user-button,
|
|
73
73
|
.apps-button,
|
|
74
|
+
::slotted([slot="asset-picker"]),
|
|
74
75
|
::slotted([slot="command-button"]),
|
|
75
76
|
::slotted([slot="clock"]) {
|
|
76
77
|
flex-shrink: 0;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
::slotted([slot="asset-picker"]) {
|
|
81
|
+
margin: 0 var(--app-components-topbar-label-spacing); /* Figma pads the picker 8 px each side; a dropdown button brings no gutter of its own */
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
.alert-container {
|
|
80
85
|
display: flex;
|
|
81
86
|
flex: 1 1 0; /* zero basis: fills what the texts leave, holds its min-content in a squeeze */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {Meta, StoryObj} from '@storybook/web-components-vite';
|
|
2
|
+
import {useArgs} from 'storybook/preview-api';
|
|
2
3
|
import {ObcTopBar, ObcTopBarMenuButtonIcon} from './top-bar.js';
|
|
3
4
|
import './top-bar.js';
|
|
4
5
|
import '../topbar-message-item/topbar-message-item.js';
|
|
@@ -8,13 +9,18 @@ import '../../icons/icon-alarm-unacknowledged-iec.js';
|
|
|
8
9
|
import '../../icons/icon-ship.js';
|
|
9
10
|
import '../alert-icon/alert-icon.js';
|
|
10
11
|
import '../command-button/command-button.js';
|
|
11
|
-
import
|
|
12
|
+
import '../dropdown-button/dropdown-button.js';
|
|
13
|
+
import type {ObcDropdownButtonChangeEvent} from '../dropdown-button/dropdown-button.js';
|
|
14
|
+
import {html, nothing} from 'lit';
|
|
12
15
|
import {
|
|
13
16
|
ObcTopbarMessageItemSize,
|
|
14
17
|
ObcTopbarMessageItemType,
|
|
15
18
|
} from '../topbar-message-item/topbar-message-item.js';
|
|
16
19
|
import {ObcAlertButtonType} from '../alert-button/alert-button.js';
|
|
17
20
|
|
|
21
|
+
/** An entry of the story's asset list, in the shape an app would hold it. */
|
|
22
|
+
type TopBarStoryAsset = {label: string; key: string};
|
|
23
|
+
|
|
18
24
|
const meta: Meta<typeof ObcTopBar> = {
|
|
19
25
|
title: 'Application Components/Top Elements/TopBar',
|
|
20
26
|
tags: ['autodocs', '6.0'],
|
|
@@ -40,6 +46,8 @@ const meta: Meta<typeof ObcTopBar> = {
|
|
|
40
46
|
appIconBreakpointPx: 0,
|
|
41
47
|
menuButtonIcon: ObcTopBarMenuButtonIcon.Menu,
|
|
42
48
|
date: '2024-12-12T11:11:12.111Z',
|
|
49
|
+
assets: [],
|
|
50
|
+
selectedAssetKey: '',
|
|
43
51
|
},
|
|
44
52
|
argTypes: {
|
|
45
53
|
showDate: {
|
|
@@ -50,88 +58,109 @@ const meta: Meta<typeof ObcTopBar> = {
|
|
|
50
58
|
options: Object.values(ObcTopBarMenuButtonIcon),
|
|
51
59
|
},
|
|
52
60
|
},
|
|
53
|
-
render: (args) =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
@media (min-width: ${args.alertBreakpoint + 'px'}) {
|
|
61
|
+
render: (args) => {
|
|
62
|
+
// The app owns the picked asset: the story writes the pick back into its
|
|
63
|
+
// arg the way an app writes it to its state, so a re-render keeps it.
|
|
64
|
+
const [, updateArgs] = useArgs();
|
|
65
|
+
return html`
|
|
66
|
+
<style>
|
|
60
67
|
.alert-notifications {
|
|
61
|
-
display:
|
|
68
|
+
display: none;
|
|
62
69
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
?showclock=${args.showClock}
|
|
69
|
-
?widemenubutton=${args.wideMenuButton}
|
|
70
|
-
?inactive=${args.inactive}
|
|
71
|
-
?settings=${args.settings}
|
|
72
|
-
?showappicon=${args.showAppIcon}
|
|
73
|
-
?showdate=${args.showDate}
|
|
74
|
-
?showuserbutton=${args.showUserButton}
|
|
75
|
-
?userbuttondisabled=${args.userButtonDisabled}
|
|
76
|
-
?menuButtonActivated=${args.menuButtonActivated}
|
|
77
|
-
?tall=${args.tall}
|
|
78
|
-
.appButtonBreakpointPx=${args.appButtonBreakpointPx}
|
|
79
|
-
.appTitleBreakpointPx=${args.appTitleBreakpointPx}
|
|
80
|
-
.dimmingButtonBreakpointPx=${args.dimmingButtonBreakpointPx}
|
|
81
|
-
.userButtonBreakpointPx=${args.userButtonBreakpointPx}
|
|
82
|
-
.appIconBreakpointPx=${args.appIconBreakpointPx}
|
|
83
|
-
.breadcrumbItems=${args.breadcrumbItems}
|
|
84
|
-
.menuButtonIcon=${args.menuButtonIcon}
|
|
85
|
-
>
|
|
86
|
-
<obi-ship slot="app-icon"></obi-ship>
|
|
87
|
-
<obc-command-button slot="command-button"></obc-command-button>
|
|
88
|
-
<obc-topbar-message-item
|
|
89
|
-
.type=${ObcTopbarMessageItemType.WithButton}
|
|
90
|
-
.size=${
|
|
91
|
-
args.tall
|
|
92
|
-
? ObcTopbarMessageItemSize.Tall
|
|
93
|
-
: ObcTopbarMessageItemSize.Regular
|
|
70
|
+
|
|
71
|
+
@media (min-width: ${args.alertBreakpoint + 'px'}) {
|
|
72
|
+
.alert-notifications {
|
|
73
|
+
display: revert !important;
|
|
74
|
+
}
|
|
94
75
|
}
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
</style>
|
|
77
|
+
<obc-top-bar
|
|
78
|
+
?showappsbutton=${args.showAppsButton}
|
|
79
|
+
?showdimmingbutton=${args.showDimmingButton}
|
|
80
|
+
?showclock=${args.showClock}
|
|
81
|
+
?widemenubutton=${args.wideMenuButton}
|
|
82
|
+
?inactive=${args.inactive}
|
|
83
|
+
?settings=${args.settings}
|
|
84
|
+
?showappicon=${args.showAppIcon}
|
|
85
|
+
?showdate=${args.showDate}
|
|
86
|
+
?showuserbutton=${args.showUserButton}
|
|
87
|
+
?userbuttondisabled=${args.userButtonDisabled}
|
|
88
|
+
?menuButtonActivated=${args.menuButtonActivated}
|
|
89
|
+
?tall=${args.tall}
|
|
90
|
+
.appButtonBreakpointPx=${args.appButtonBreakpointPx}
|
|
91
|
+
.appTitleBreakpointPx=${args.appTitleBreakpointPx}
|
|
92
|
+
.dimmingButtonBreakpointPx=${args.dimmingButtonBreakpointPx}
|
|
93
|
+
.userButtonBreakpointPx=${args.userButtonBreakpointPx}
|
|
94
|
+
.appIconBreakpointPx=${args.appIconBreakpointPx}
|
|
95
|
+
.breadcrumbItems=${args.breadcrumbItems}
|
|
96
|
+
.menuButtonIcon=${args.menuButtonIcon}
|
|
97
97
|
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
alertType="alarm"
|
|
115
|
-
counter
|
|
116
|
-
blinking
|
|
117
|
-
showSilenceButton
|
|
118
|
-
silenceButtonDisabled
|
|
119
|
-
.type=${
|
|
120
|
-
args.inactive ? ObcAlertButtonType.Flat : ObcAlertButtonType.Normal
|
|
98
|
+
<obi-ship slot="app-icon"></obi-ship>
|
|
99
|
+
${
|
|
100
|
+
args.assets.length
|
|
101
|
+
? html`<obc-dropdown-button
|
|
102
|
+
slot="asset-picker"
|
|
103
|
+
.options=${args.assets.map(
|
|
104
|
+
({key, label}: TopBarStoryAsset) => ({
|
|
105
|
+
value: key,
|
|
106
|
+
label,
|
|
107
|
+
})
|
|
108
|
+
)}
|
|
109
|
+
.value=${args.selectedAssetKey}
|
|
110
|
+
@dropdown-change=${(event: ObcDropdownButtonChangeEvent) =>
|
|
111
|
+
updateArgs({selectedAssetKey: event.detail.value})}
|
|
112
|
+
></obc-dropdown-button>`
|
|
113
|
+
: nothing
|
|
121
114
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
115
|
+
<obc-command-button slot="command-button"></obc-command-button>
|
|
116
|
+
<obc-topbar-message-item
|
|
117
|
+
.type=${ObcTopbarMessageItemType.WithButton}
|
|
118
|
+
.size=${
|
|
119
|
+
args.tall
|
|
120
|
+
? ObcTopbarMessageItemSize.Tall
|
|
121
|
+
: ObcTopbarMessageItemSize.Regular
|
|
122
|
+
}
|
|
123
|
+
slot="alerts"
|
|
124
|
+
class="alert-notifications"
|
|
125
|
+
>
|
|
126
|
+
<obc-alert-icon
|
|
127
|
+
slot="primary-icon"
|
|
128
|
+
type="alarm"
|
|
129
|
+
active
|
|
130
|
+
></obc-alert-icon>
|
|
131
|
+
<obi-placeholder slot="secondary-icon"></obi-placeholder>
|
|
132
|
+
<div slot="title">Alert title</div>
|
|
133
|
+
<div slot="description">
|
|
134
|
+
Description here. This alert has been triggered due to a detected
|
|
135
|
+
</div>
|
|
136
|
+
<div slot="time">09:12:46</div>
|
|
137
|
+
<div slot="action-text">ACK</div>
|
|
138
|
+
</obc-topbar-message-item>
|
|
139
|
+
<obc-alert-button
|
|
140
|
+
class="alert-button ${args.inactive ? 'inactive' : ''}"
|
|
141
|
+
nAlerts="1"
|
|
142
|
+
alertType="alarm"
|
|
143
|
+
counter
|
|
144
|
+
blinking
|
|
145
|
+
showSilenceButton
|
|
146
|
+
silenceButtonDisabled
|
|
147
|
+
.type=${
|
|
148
|
+
args.inactive ? ObcAlertButtonType.Flat : ObcAlertButtonType.Normal
|
|
149
|
+
}
|
|
150
|
+
?large=${args.tall}
|
|
151
|
+
.flatMaxBreakpointPx=${args.flatMaxBreakpointPx}
|
|
152
|
+
.silenceButtonMinBreakpointPx=${args.silenceButtonMinBreakpointPx}
|
|
153
|
+
slot="alerts"
|
|
154
|
+
>
|
|
155
|
+
</obc-alert-button>
|
|
156
|
+
<obc-clock
|
|
157
|
+
slot="clock"
|
|
158
|
+
.date=${args.date}
|
|
159
|
+
.blinkOnlyBreakpointPx=${args.clockMinimizeBreakpointPx}
|
|
160
|
+
></obc-clock>
|
|
161
|
+
</obc-top-bar>
|
|
162
|
+
`;
|
|
163
|
+
},
|
|
135
164
|
} satisfies Meta<ObcTopBar>;
|
|
136
165
|
|
|
137
166
|
export default meta;
|
|
@@ -204,3 +233,26 @@ export const HomeButtonIcon: Story = {
|
|
|
204
233
|
menuButtonIcon: ObcTopBarMenuButtonIcon.Home,
|
|
205
234
|
},
|
|
206
235
|
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The `asset-picker` slot takes the control that switches the asset the page
|
|
239
|
+
* shows. An `obc-dropdown-button` fits: its label is the selected asset, a
|
|
240
|
+
* click opens the list, and its `dropdown-change` carries the key of the pick.
|
|
241
|
+
* The app owns the list and the selection: it binds them in and writes the pick
|
|
242
|
+
* back, as the story does with its args `assets` and `selectedAssetKey`.
|
|
243
|
+
*
|
|
244
|
+
* TODO(designer): Figma OpenBridge-ALPHA 703-29119 draws the picker as a plain
|
|
245
|
+
* button without a chevron; the dropdown-button rows of the same exploration
|
|
246
|
+
* (699-90973) draw one, and so does `obc-dropdown-button`.
|
|
247
|
+
*/
|
|
248
|
+
export const AssetPicker: Story = {
|
|
249
|
+
args: {
|
|
250
|
+
alertBreakpoint: 1_000_000, // the long message item would squeeze the texts out at 1280 px
|
|
251
|
+
assets: [
|
|
252
|
+
{label: 'Merd A', key: 'merd-a'},
|
|
253
|
+
{label: 'Merd B', key: 'merd-b'},
|
|
254
|
+
{label: 'Merd C', key: 'merd-c'},
|
|
255
|
+
],
|
|
256
|
+
selectedAssetKey: 'merd-b',
|
|
257
|
+
},
|
|
258
|
+
};
|
|
@@ -41,6 +41,7 @@ export enum ObcTopBarMenuButtonIcon {
|
|
|
41
41
|
* - **App Title & Page Name:** Displays the current application and page context.
|
|
42
42
|
* - **Breadcrumbs:** Optional breadcrumb navigation for hierarchical context (in settings mode).
|
|
43
43
|
* - **Command Button Slot:** Slot for inserting a primary command/action button.
|
|
44
|
+
* - **Asset Picker Slot:** Slot for a control that switches between the assets the page can show, such as an `obc-dropdown-button` whose label is the current asset.
|
|
44
45
|
* - **Alert/Notification Area:** Slot for alert indicators, notification badges, or custom alert components.
|
|
45
46
|
* - **Dimming Button:** Optional button for toggling display modes (e.g., day/night).
|
|
46
47
|
* - **User/Profile Button:** Optional user icon for profile/account actions.
|
|
@@ -64,6 +65,7 @@ export enum ObcTopBarMenuButtonIcon {
|
|
|
64
65
|
* - Use the `settings` property for configuration or setup screens to enable close/back/forward navigation and breadcrumbs.
|
|
65
66
|
* - Use the `inactive` property to visually disable the bar and its actions when the app is not interactive.
|
|
66
67
|
* - Insert custom icons or buttons using the `app-icon` and `command-button` slots.
|
|
68
|
+
* - Slot an `obc-dropdown-button` into `asset-picker` when the page shows one of several assets; the app owns the list and the selection and listens for the button's `change`.
|
|
67
69
|
* - Use the `alerts` slot to display alert indicators, notification badges, or custom alert components.
|
|
68
70
|
*
|
|
69
71
|
* **TODO(designer):** Clarify recommended combinations of visible elements for different app contexts (e.g., when to show both user and apps buttons, or best practices for alert placement).
|
|
@@ -73,7 +75,8 @@ export enum ObcTopBarMenuButtonIcon {
|
|
|
73
75
|
* | Slot Name | Renders When... | Purpose |
|
|
74
76
|
* |------------------|---------------------------------|----------------------------------------------------------------|
|
|
75
77
|
* | `app-icon` | `showAppIcon` is true | Custom icon representing the application or brand. |
|
|
76
|
-
* | `command-button` |
|
|
78
|
+
* | `command-button` | `settings` is false (if provided) | Primary command or action button for the current context. |
|
|
79
|
+
* | `asset-picker` | `settings` is false (if provided) | Control that switches the asset the page shows; its label is the current asset. |
|
|
77
80
|
* | `alerts` | Always (if provided) | Area for alert indicators, notification badges, or alert items.|
|
|
78
81
|
* | `clock` | Always (if provided) | Clock component for displaying the current time. |
|
|
79
82
|
*
|
|
@@ -159,6 +162,7 @@ export enum ObcTopBarMenuButtonIcon {
|
|
|
159
162
|
* @availableWhen breadcrumbItems settings==true
|
|
160
163
|
* @slot app-icon - Custom icon representing the application or brand (shown when `showAppIcon` is true)
|
|
161
164
|
* @slot command-button - Primary command/action button for the current context
|
|
165
|
+
* @slot asset-picker - Control that switches the asset the page shows, with the current asset as its label; an `obc-dropdown-button` fits (regular layout only, not in settings mode)
|
|
162
166
|
* @slot alerts - Area for alert indicators, notification badges, or alert items
|
|
163
167
|
* @slot clock - Clock component for displaying the current time (shown when `showClock` is true)
|
|
164
168
|
* @fires menu-button-clicked - Fired when the menu button is clicked
|
|
@@ -439,6 +443,7 @@ export class ObcTopBar extends LitElement {
|
|
|
439
443
|
}
|
|
440
444
|
leftGroup.push(html`<div class="title">${this.appTitle}</div>`);
|
|
441
445
|
leftGroup.push(html`<div class="page-name">${this.pageName}</div>`);
|
|
446
|
+
leftGroup.push(html`<slot name="asset-picker"></slot>`);
|
|
442
447
|
leftGroup.push(html`<slot name="command-button"></slot>`);
|
|
443
448
|
}
|
|
444
449
|
|