@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.4 → 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 +6 -0
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +6 -2
- 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/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,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
|
|