@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.148 → 2.0.0-next.149
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 +119 -42
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +154 -19
- package/dist/components/icon-button/icon-button.d.ts +3 -0
- package/dist/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/icon-button.js +6 -0
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/dist/components/top-bar/top-bar.d.ts.map +1 -1
- package/dist/components/top-bar/top-bar.js +8 -0
- package/dist/components/top-bar/top-bar.js.map +1 -1
- package/dist/generated/locales/es-419.d.ts +11 -1
- package/dist/generated/locales/es-419.d.ts.map +1 -1
- package/dist/generated/locales/es-419.js +11 -1
- package/dist/generated/locales/es-419.js.map +1 -1
- package/dist/generated/locales/fi-FI.d.ts +11 -1
- package/dist/generated/locales/fi-FI.d.ts.map +1 -1
- package/dist/generated/locales/fi-FI.js +11 -1
- package/dist/generated/locales/fi-FI.js.map +1 -1
- package/dist/integration-systems/integration-bar/integration-bar.d.ts +8 -8
- package/dist/integration-systems/integration-bar/integration-bar.d.ts.map +1 -1
- package/dist/integration-systems/integration-bar/integration-bar.js +13 -1
- package/dist/integration-systems/integration-bar/integration-bar.js.map +1 -1
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.d.ts +72 -7
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.d.ts.map +1 -1
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.js +99 -41
- package/dist/integration-systems/integration-bar-dropdown/integration-bar-dropdown.js.map +1 -1
- package/package.json +1 -1
- package/src/components/icon-button/icon-button.spec.ts +52 -0
- package/src/components/icon-button/icon-button.ts +7 -0
- package/src/components/top-bar/top-bar.ts +10 -0
- package/src/generated/locales/es-419.ts +11 -1
- package/src/generated/locales/fi-FI.ts +11 -1
- package/src/integration-systems/integration-bar/integration-bar.ts +21 -9
- package/src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.stories.ts +70 -3
- package/src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.ts +138 -52
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import '../integration-tabs/integration-tabs.js';
|
|
3
3
|
import '../../components/clock/clock.js';
|
|
4
4
|
import '../../components/icon-button/icon-button.js';
|
|
@@ -7,13 +7,42 @@ import '../../icons/icon-user.js';
|
|
|
7
7
|
import '../../icons/icon-configure.js';
|
|
8
8
|
import '../../icons/icon-notification.js';
|
|
9
9
|
import '../../icons/icon-home.js';
|
|
10
|
+
import '../../icons/icon-screen-desk.js';
|
|
11
|
+
import '../../icons/icon-alerts.js';
|
|
12
|
+
import '../../icons/icon-link.js';
|
|
10
13
|
/**
|
|
14
|
+
* `<obc-integration-bar-dropdown>` – A compact top-level integration header with a dropdown selector, status fields and system action buttons.
|
|
11
15
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
16
|
+
* @property showHomeButton - Home button at the left end of the bar.
|
|
17
|
+
* @property homeButtonActivated - Pressed styling for the home button.
|
|
18
|
+
* @availableWhen homeButtonActivated showHomeButton==true
|
|
19
|
+
* @property showLinkButton - Link button, between home and the selector.
|
|
20
|
+
* @property linkButtonActivated - Pressed styling for the link button.
|
|
21
|
+
* @availableWhen linkButtonActivated showLinkButton==true
|
|
22
|
+
* @property showClock - Renders the `clock` slot at the right end.
|
|
23
|
+
* @property showAlertButton - Alert button, first in the right-hand group.
|
|
24
|
+
* @property alertButtonActivated - Pressed styling for the alert button.
|
|
25
|
+
* @availableWhen alertButtonActivated showAlertButton==true
|
|
26
|
+
* @property showNotificationButton - Notification button, after the alert button.
|
|
27
|
+
* @property notificationButtonActivated - Pressed styling; the count badge only appears in this state.
|
|
28
|
+
* @availableWhen notificationButtonActivated showNotificationButton==true
|
|
29
|
+
* @property notificationCount - Number drawn in the count badge.
|
|
30
|
+
* @availableWhen notificationCount showNotificationButton==true && showNotificationCount==true && notificationButtonActivated==true
|
|
31
|
+
* @property showNotificationCount - Draws the count badge on the notification button.
|
|
32
|
+
* @availableWhen showNotificationCount showNotificationButton==true && notificationButtonActivated==true
|
|
33
|
+
* @property showScreenButton - Screen button, after the notification button.
|
|
34
|
+
* @property screenButtonActivated - Pressed styling for the screen button.
|
|
35
|
+
* @availableWhen screenButtonActivated showScreenButton==true
|
|
36
|
+
* @property showUserButton - User button, last before the clock.
|
|
37
|
+
* @property userButtonActivated - Pressed styling for the user button.
|
|
38
|
+
* @availableWhen userButtonActivated showUserButton==true
|
|
39
|
+
* @property showDimmingButton - Dimming button, between system and user.
|
|
40
|
+
* @property dimmingButtonActivated - Pressed styling for the dimming button.
|
|
41
|
+
* @availableWhen dimmingButtonActivated showDimmingButton==true
|
|
42
|
+
* @property showSystemButton - System button, after the screen button.
|
|
43
|
+
* @property systemButtonActivated - Pressed styling for the system button.
|
|
44
|
+
* @availableWhen systemButtonActivated showSystemButton==true
|
|
45
|
+
* @property nStatusFields - How many `status-icon-N`/`status-label-N` slot pairs are rendered.
|
|
17
46
|
*
|
|
18
47
|
* @slot vessel-selector - Vessel selector content
|
|
19
48
|
* @slot status-label-1 - Label for the first status field
|
|
@@ -23,25 +52,61 @@ import '../../icons/icon-home.js';
|
|
|
23
52
|
* @slot status-label-3 - Label for the third status field
|
|
24
53
|
* @slot status-icon-3 - Icon for the third status field
|
|
25
54
|
* @slot clock - Custom clock content, rendered when `showClock` is true
|
|
55
|
+
*
|
|
56
|
+
* @fires {CustomEvent} home-button-clicked - Fired when the home button is clicked
|
|
57
|
+
* @fires {CustomEvent} link-button-clicked - Fired when the link button is clicked
|
|
58
|
+
* @fires {CustomEvent} alert-button-clicked - Fired when the alert button is clicked
|
|
59
|
+
* @fires {CustomEvent} dimming-button-clicked - Fired when the dimming button is clicked
|
|
60
|
+
* @fires {CustomEvent} notification-button-clicked - Fired when the notification button is clicked
|
|
61
|
+
* @fires {CustomEvent} screen-button-clicked - Fired when the screen button is clicked
|
|
62
|
+
* @fires {CustomEvent} user-button-clicked - Fired when the user button is clicked
|
|
63
|
+
* @fires {CustomEvent} system-button-clicked - Fired when the system button is clicked
|
|
26
64
|
* @experimental
|
|
27
65
|
*/
|
|
28
66
|
export declare class ObcIntegrationBarDropdown extends LitElement {
|
|
67
|
+
/** Home button at the left end of the bar. */
|
|
29
68
|
showHomeButton: boolean;
|
|
69
|
+
/** Pressed styling for the home button. */
|
|
30
70
|
homeButtonActivated: boolean;
|
|
71
|
+
/** Link button, between home and the selector. */
|
|
72
|
+
showLinkButton: boolean;
|
|
73
|
+
/** Pressed styling for the link button. */
|
|
74
|
+
linkButtonActivated: boolean;
|
|
75
|
+
/** Renders the `clock` slot at the right end. */
|
|
31
76
|
showClock: boolean;
|
|
77
|
+
/** Alert button, first in the right-hand group. */
|
|
78
|
+
showAlertButton: boolean;
|
|
79
|
+
/** Pressed styling for the alert button. */
|
|
80
|
+
alertButtonActivated: boolean;
|
|
81
|
+
/** Notification button, after the alert button. */
|
|
32
82
|
showNotificationButton: boolean;
|
|
83
|
+
/** Pressed styling; the count badge only appears in this state. */
|
|
33
84
|
notificationButtonActivated: boolean;
|
|
85
|
+
/** Number drawn in the count badge. */
|
|
34
86
|
notificationCount: number;
|
|
87
|
+
/** Draws the count badge on the notification button. */
|
|
35
88
|
showNotificationCount: boolean;
|
|
89
|
+
/** Screen button, after the notification button. */
|
|
90
|
+
showScreenButton: boolean;
|
|
91
|
+
/** Pressed styling for the screen button. */
|
|
92
|
+
screenButtonActivated: boolean;
|
|
93
|
+
/** User button, last before the clock. */
|
|
36
94
|
showUserButton: boolean;
|
|
95
|
+
/** Pressed styling for the user button. */
|
|
37
96
|
userButtonActivated: boolean;
|
|
97
|
+
/** Dimming button, between system and user. */
|
|
38
98
|
showDimmingButton: boolean;
|
|
99
|
+
/** Pressed styling for the dimming button. */
|
|
39
100
|
dimmingButtonActivated: boolean;
|
|
101
|
+
/** System button, after the screen button. */
|
|
40
102
|
showSystemButton: boolean;
|
|
103
|
+
/** Pressed styling for the system button. */
|
|
41
104
|
systemButtonActivated: boolean;
|
|
105
|
+
/** How many `status-icon-N`/`status-label-N` slot pairs are rendered. */
|
|
42
106
|
nStatusFields: number;
|
|
43
107
|
private renderStatusFields;
|
|
44
|
-
|
|
108
|
+
private renderIconButton;
|
|
109
|
+
render(): TemplateResult<1>;
|
|
45
110
|
static styles: import('lit').CSSResult;
|
|
46
111
|
}
|
|
47
112
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-bar-dropdown.d.ts","sourceRoot":"","sources":["../../../src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"integration-bar-dropdown.d.ts","sourceRoot":"","sources":["../../../src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA4B,KAAK,cAAc,EAAC,MAAM,KAAK,CAAC;AAG9E,OAAO,yCAAyC,CAAC;AACjD,OAAO,iCAAiC,CAAC;AACzC,OAAO,6CAA6C,CAAC;AACrD,OAAO,2CAA2C,CAAC;AACnD,OAAO,0BAA0B,CAAC;AAClC,OAAO,+BAA+B,CAAC;AACvC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,qBACa,yBAA0B,SAAQ,UAAU;IAC5B,cAAc,UAAS;IACvB,mBAAmB,UAAS;IAC5B,cAAc,UAAS;IACvB,mBAAmB,UAAS;IAC5B,SAAS,UAAS;IAClB,eAAe,UAAS;IACxB,oBAAoB,UAAS;IAC7B,sBAAsB,UAAS;IAC/B,2BAA2B,UAAS;IACrC,iBAAiB,SAAK;IACrB,qBAAqB,UAAS;IAC9B,gBAAgB,UAAS;IACzB,qBAAqB,UAAS;IAC9B,cAAc,UAAS;IACvB,mBAAmB,UAAS;IAC5B,iBAAiB,UAAS;IAC1B,sBAAsB,UAAS;IAC/B,gBAAgB,UAAS;IACzB,qBAAqB,UAAS;IAC/B,aAAa,SAAK;IAE5C,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,gBAAgB;IAmBf,MAAM;IA+Ff,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,8BAA8B,EAAE,yBAAyB,CAAC;KAC3D;CACF"}
|
|
@@ -9,8 +9,12 @@ import "../../icons/icon-user.js";
|
|
|
9
9
|
import "../../icons/icon-configure.js";
|
|
10
10
|
import "../../icons/icon-notification.js";
|
|
11
11
|
import "../../icons/icon-home.js";
|
|
12
|
+
import "../../icons/icon-screen-desk.js";
|
|
13
|
+
import "../../icons/icon-alerts.js";
|
|
14
|
+
import "../../icons/icon-link.js";
|
|
12
15
|
import { NotificationButtonStyle } from "../../components/notification-button/notification-button.js";
|
|
13
16
|
import { property } from "lit/decorators.js";
|
|
17
|
+
import { msg } from "@lit/localize";
|
|
14
18
|
var __defProp = Object.defineProperty;
|
|
15
19
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
20
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -26,11 +30,17 @@ let ObcIntegrationBarDropdown = class extends LitElement {
|
|
|
26
30
|
super(...arguments);
|
|
27
31
|
this.showHomeButton = false;
|
|
28
32
|
this.homeButtonActivated = false;
|
|
33
|
+
this.showLinkButton = false;
|
|
34
|
+
this.linkButtonActivated = false;
|
|
29
35
|
this.showClock = false;
|
|
36
|
+
this.showAlertButton = false;
|
|
37
|
+
this.alertButtonActivated = false;
|
|
30
38
|
this.showNotificationButton = false;
|
|
31
39
|
this.notificationButtonActivated = false;
|
|
32
40
|
this.notificationCount = 0;
|
|
33
41
|
this.showNotificationCount = false;
|
|
42
|
+
this.showScreenButton = false;
|
|
43
|
+
this.screenButtonActivated = false;
|
|
34
44
|
this.showUserButton = false;
|
|
35
45
|
this.userButtonActivated = false;
|
|
36
46
|
this.showDimmingButton = false;
|
|
@@ -57,60 +67,90 @@ let ObcIntegrationBarDropdown = class extends LitElement {
|
|
|
57
67
|
}
|
|
58
68
|
return html`<div class="status">${result}</div>`;
|
|
59
69
|
}
|
|
70
|
+
// The event name stays a literal at each call site so `cem analyze` can read it.
|
|
71
|
+
renderIconButton(name, activated, label, icon, onClick) {
|
|
72
|
+
return html`<obc-icon-button
|
|
73
|
+
class="${name}-button"
|
|
74
|
+
part="${name}-button"
|
|
75
|
+
variant="integration"
|
|
76
|
+
aria-label=${label}
|
|
77
|
+
@click=${onClick}
|
|
78
|
+
?activated=${activated}
|
|
79
|
+
>
|
|
80
|
+
${icon}
|
|
81
|
+
</obc-icon-button>`;
|
|
82
|
+
}
|
|
60
83
|
render() {
|
|
61
84
|
return html`
|
|
62
85
|
<div class="wrapper">
|
|
63
86
|
<div class="left-side">
|
|
64
|
-
${this.showHomeButton ?
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
${this.showHomeButton ? this.renderIconButton(
|
|
88
|
+
"home",
|
|
89
|
+
this.homeButtonActivated,
|
|
90
|
+
msg("Home"),
|
|
91
|
+
html`<obi-home></obi-home>`,
|
|
92
|
+
() => this.dispatchEvent(new CustomEvent("home-button-clicked"))
|
|
93
|
+
) : nothing}
|
|
94
|
+
${this.showLinkButton ? this.renderIconButton(
|
|
95
|
+
"link",
|
|
96
|
+
this.linkButtonActivated,
|
|
97
|
+
msg("Link"),
|
|
98
|
+
html`<obi-link></obi-link>`,
|
|
99
|
+
() => this.dispatchEvent(new CustomEvent("link-button-clicked"))
|
|
100
|
+
) : nothing}
|
|
73
101
|
<slot name="vessel-selector"></slot>
|
|
74
102
|
${this.renderStatusFields()}
|
|
75
103
|
</div>
|
|
76
104
|
<div class="right-side">
|
|
77
|
-
${this.
|
|
105
|
+
${this.showAlertButton ? this.renderIconButton(
|
|
106
|
+
"alert",
|
|
107
|
+
this.alertButtonActivated,
|
|
108
|
+
msg("Alerts"),
|
|
109
|
+
html`<obi-alerts></obi-alerts>`,
|
|
110
|
+
() => this.dispatchEvent(new CustomEvent("alert-button-clicked"))
|
|
111
|
+
) : nothing}
|
|
112
|
+
${this.showNotificationButton ? (
|
|
113
|
+
// TODO(designer): keep the Enhanced badge button here, or match the
|
|
114
|
+
// sibling bar's plain notification icon button? (#624)
|
|
115
|
+
html`<obc-notification-button
|
|
78
116
|
@click=${() => this.dispatchEvent(
|
|
79
|
-
|
|
80
|
-
|
|
117
|
+
new CustomEvent("notification-button-clicked")
|
|
118
|
+
)}
|
|
81
119
|
.buttonStyle=${NotificationButtonStyle.Enhanced}
|
|
82
120
|
.showCount=${this.showNotificationCount}
|
|
83
121
|
.count=${this.notificationCount}
|
|
84
122
|
?isActive=${this.notificationButtonActivated}
|
|
85
|
-
></obc-notification-button>`
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
></obc-notification-button>`
|
|
124
|
+
) : nothing}
|
|
125
|
+
${this.showScreenButton ? this.renderIconButton(
|
|
126
|
+
"screen",
|
|
127
|
+
this.screenButtonActivated,
|
|
128
|
+
msg("Screen"),
|
|
129
|
+
html`<obi-screen-desk></obi-screen-desk>`,
|
|
130
|
+
() => this.dispatchEvent(new CustomEvent("screen-button-clicked"))
|
|
131
|
+
) : nothing}
|
|
132
|
+
${this.showSystemButton ? this.renderIconButton(
|
|
133
|
+
"system",
|
|
134
|
+
this.systemButtonActivated,
|
|
135
|
+
msg("System"),
|
|
136
|
+
html`<obi-configure></obi-configure>`,
|
|
137
|
+
() => this.dispatchEvent(new CustomEvent("system-button-clicked"))
|
|
138
|
+
) : nothing}
|
|
139
|
+
${this.showDimmingButton ? this.renderIconButton(
|
|
140
|
+
"dimming",
|
|
141
|
+
this.dimmingButtonActivated,
|
|
142
|
+
msg("Dimming"),
|
|
143
|
+
html`<obi-palette-day-night-iec></obi-palette-day-night-iec>`,
|
|
144
|
+
() => this.dispatchEvent(new CustomEvent("dimming-button-clicked"))
|
|
145
|
+
) : nothing}
|
|
146
|
+
${this.showUserButton ? this.renderIconButton(
|
|
147
|
+
"user",
|
|
148
|
+
this.userButtonActivated,
|
|
149
|
+
msg("User"),
|
|
150
|
+
html`<obi-user></obi-user>`,
|
|
151
|
+
() => this.dispatchEvent(new CustomEvent("user-button-clicked"))
|
|
152
|
+
) : nothing}
|
|
153
|
+
${this.showClock ? html`<slot name="clock"></slot>` : nothing}
|
|
114
154
|
</div>
|
|
115
155
|
</div>
|
|
116
156
|
`;
|
|
@@ -123,9 +163,21 @@ __decorateClass([
|
|
|
123
163
|
__decorateClass([
|
|
124
164
|
property({ type: Boolean })
|
|
125
165
|
], ObcIntegrationBarDropdown.prototype, "homeButtonActivated", 2);
|
|
166
|
+
__decorateClass([
|
|
167
|
+
property({ type: Boolean })
|
|
168
|
+
], ObcIntegrationBarDropdown.prototype, "showLinkButton", 2);
|
|
169
|
+
__decorateClass([
|
|
170
|
+
property({ type: Boolean })
|
|
171
|
+
], ObcIntegrationBarDropdown.prototype, "linkButtonActivated", 2);
|
|
126
172
|
__decorateClass([
|
|
127
173
|
property({ type: Boolean })
|
|
128
174
|
], ObcIntegrationBarDropdown.prototype, "showClock", 2);
|
|
175
|
+
__decorateClass([
|
|
176
|
+
property({ type: Boolean })
|
|
177
|
+
], ObcIntegrationBarDropdown.prototype, "showAlertButton", 2);
|
|
178
|
+
__decorateClass([
|
|
179
|
+
property({ type: Boolean })
|
|
180
|
+
], ObcIntegrationBarDropdown.prototype, "alertButtonActivated", 2);
|
|
129
181
|
__decorateClass([
|
|
130
182
|
property({ type: Boolean })
|
|
131
183
|
], ObcIntegrationBarDropdown.prototype, "showNotificationButton", 2);
|
|
@@ -138,6 +190,12 @@ __decorateClass([
|
|
|
138
190
|
__decorateClass([
|
|
139
191
|
property({ type: Boolean })
|
|
140
192
|
], ObcIntegrationBarDropdown.prototype, "showNotificationCount", 2);
|
|
193
|
+
__decorateClass([
|
|
194
|
+
property({ type: Boolean })
|
|
195
|
+
], ObcIntegrationBarDropdown.prototype, "showScreenButton", 2);
|
|
196
|
+
__decorateClass([
|
|
197
|
+
property({ type: Boolean })
|
|
198
|
+
], ObcIntegrationBarDropdown.prototype, "screenButtonActivated", 2);
|
|
141
199
|
__decorateClass([
|
|
142
200
|
property({ type: Boolean })
|
|
143
201
|
], ObcIntegrationBarDropdown.prototype, "showUserButton", 2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-bar-dropdown.js","sources":["../../../src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport compentStyle from './integration-bar-dropdown.css?inline';\nimport '../integration-tabs/integration-tabs.js';\nimport '../../components/clock/clock.js';\nimport '../../components/icon-button/icon-button.js';\nimport '../../icons/icon-palette-day-night-iec.js';\nimport '../../icons/icon-user.js';\nimport '../../icons/icon-configure.js';\nimport '../../icons/icon-notification.js';\nimport '../../icons/icon-home.js';\nimport {NotificationButtonStyle} from '../../components/notification-button/notification-button.js';\nimport {property} from 'lit/decorators.js';\n\n/**\n *\n * @fires home-button-clicked - Fired when the home button is clicked\n * @fires dimming-button-clicked - Fired when the dimming button is clicked\n * @fires notification-button-clicked - Fired when the notification button is clicked\n * @fires user-button-clicked - Fired when the user button is clicked\n * @fires system-button-clicked - Fired when the system button is clicked\n *\n * @slot vessel-selector - Vessel selector content\n * @slot status-label-1 - Label for the first status field\n * @slot status-icon-1 - Icon for the first status field\n * @slot status-label-2 - Label for the second status field\n * @slot status-icon-2 - Icon for the second status field\n * @slot status-label-3 - Label for the third status field\n * @slot status-icon-3 - Icon for the third status field\n * @slot clock - Custom clock content, rendered when `showClock` is true\n * @experimental\n */\n@customElement('obc-integration-bar-dropdown')\nexport class ObcIntegrationBarDropdown extends LitElement {\n @property({type: Boolean}) showHomeButton = false;\n @property({type: Boolean}) homeButtonActivated = false;\n @property({type: Boolean}) showClock = false;\n @property({type: Boolean}) showNotificationButton = false;\n @property({type: Boolean}) notificationButtonActivated = false;\n @property({type: Number}) notificationCount = 0;\n @property({type: Boolean}) showNotificationCount = false;\n @property({type: Boolean}) showUserButton = false;\n @property({type: Boolean}) userButtonActivated = false;\n @property({type: Boolean}) showDimmingButton = false;\n @property({type: Boolean}) dimmingButtonActivated = false;\n @property({type: Boolean}) showSystemButton = false;\n @property({type: Boolean}) systemButtonActivated = false;\n @property({type: Number}) nStatusFields = 0;\n\n private renderStatusFields() {\n if (this.nStatusFields <= 0) {\n return nothing;\n }\n const result = [];\n for (let i = 0; i < this.nStatusFields; i++) {\n if (i > 0) {\n result.push(html`<div class=\"divider\"></div>`);\n }\n result.push(html`\n <div class=\"status-item\">\n <slot class=\"status-icon\" name=\"status-icon-${i + 1}\"></slot>\n <slot class=\"status-label\" name=\"status-label-${i + 1}\"></slot>\n </div>\n `);\n }\n return html`<div class=\"status\">${result}</div>`;\n }\n\n override render() {\n return html`\n <div class=\"wrapper\">\n <div class=\"left-side\">\n ${this.showHomeButton\n ? html`<obc-icon-button\n class=\"home-button\"\n part=\"home-button\"\n variant=\"integration\"\n @click=${() =>\n this.dispatchEvent(new CustomEvent('home-button-clicked'))}\n ?activated=${this.homeButtonActivated}\n >\n <obi-home></obi-home>\n </obc-icon-button>`\n : null}\n <slot name=\"vessel-selector\"></slot>\n ${this.renderStatusFields()}\n </div>\n <div class=\"right-side\">\n ${this.showNotificationButton\n ? html`<obc-notification-button\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('notification-button-clicked')\n )}\n .buttonStyle=${NotificationButtonStyle.Enhanced}\n .showCount=${this.showNotificationCount}\n .count=${this.notificationCount}\n ?isActive=${this.notificationButtonActivated}\n ></obc-notification-button>`\n : nothing}\n ${this.showSystemButton\n ? html`<obc-icon-button\n class=\"system-button\"\n part=\"system-button\"\n variant=\"integration\"\n @click=${() =>\n this.dispatchEvent(new CustomEvent('system-button-clicked'))}\n ?activated=${this.systemButtonActivated}\n >\n <obi-configure></obi-configure>\n </obc-icon-button>`\n : null}\n ${this.showDimmingButton\n ? html`<obc-icon-button\n class=\"dimming-button\"\n part=\"dimming-button\"\n variant=\"integration\"\n @click=${() =>\n this.dispatchEvent(new CustomEvent('dimming-button-clicked'))}\n ?activated=${this.dimmingButtonActivated}\n >\n <obi-palette-day-night-iec></obi-palette-day-night-iec>\n </obc-icon-button>`\n : null}\n ${this.showUserButton\n ? html`<obc-icon-button\n class=\"user-button\"\n part=\"user-button\"\n variant=\"integration\"\n @click=${() =>\n this.dispatchEvent(new CustomEvent('user-button-clicked'))}\n ?activated=${this.userButtonActivated}\n >\n <obi-user></obi-user>\n </obc-icon-button>`\n : null}\n ${this.showClock ? html`<slot name=\"clock\"></slot>` : null}\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-integration-bar-dropdown': ObcIntegrationBarDropdown;\n }\n}\n"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AM,QAAA,CAAQ;AAAA,GAPd,0BAOgB,WAAA,yBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GARd,0BAQgB,WAAA,kBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GATd,0BASgB,WAAA,uBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAVd,0BAUgB,WAAA,qBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAXd,0BAWgB,WAAA,0BAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAZd,0BAYgB,WAAA,oBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAbd,0BAagB,WAAA,yBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GAdb,0BAce,WAAA,iBAAA,CAAA;AAdf,4BAAN,gBAAA;AAAA,EADN,cAAc,8BAA8B;AAAA,GAChC,yBAAA;"}
|
|
1
|
+
{"version":3,"file":"integration-bar-dropdown.js","sources":["../../../src/integration-systems/integration-bar-dropdown/integration-bar-dropdown.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS, type TemplateResult} from 'lit';\nimport {customElement} from '../../decorator.js';\nimport compentStyle from './integration-bar-dropdown.css?inline';\nimport '../integration-tabs/integration-tabs.js';\nimport '../../components/clock/clock.js';\nimport '../../components/icon-button/icon-button.js';\nimport '../../icons/icon-palette-day-night-iec.js';\nimport '../../icons/icon-user.js';\nimport '../../icons/icon-configure.js';\nimport '../../icons/icon-notification.js';\nimport '../../icons/icon-home.js';\nimport '../../icons/icon-screen-desk.js';\nimport '../../icons/icon-alerts.js';\nimport '../../icons/icon-link.js';\nimport {NotificationButtonStyle} from '../../components/notification-button/notification-button.js';\nimport {property} from 'lit/decorators.js';\nimport {msg} from '@lit/localize';\n\n/**\n * `<obc-integration-bar-dropdown>` – A compact top-level integration header with a dropdown selector, status fields and system action buttons.\n *\n * @property showHomeButton - Home button at the left end of the bar.\n * @property homeButtonActivated - Pressed styling for the home button.\n * @availableWhen homeButtonActivated showHomeButton==true\n * @property showLinkButton - Link button, between home and the selector.\n * @property linkButtonActivated - Pressed styling for the link button.\n * @availableWhen linkButtonActivated showLinkButton==true\n * @property showClock - Renders the `clock` slot at the right end.\n * @property showAlertButton - Alert button, first in the right-hand group.\n * @property alertButtonActivated - Pressed styling for the alert button.\n * @availableWhen alertButtonActivated showAlertButton==true\n * @property showNotificationButton - Notification button, after the alert button.\n * @property notificationButtonActivated - Pressed styling; the count badge only appears in this state.\n * @availableWhen notificationButtonActivated showNotificationButton==true\n * @property notificationCount - Number drawn in the count badge.\n * @availableWhen notificationCount showNotificationButton==true && showNotificationCount==true && notificationButtonActivated==true\n * @property showNotificationCount - Draws the count badge on the notification button.\n * @availableWhen showNotificationCount showNotificationButton==true && notificationButtonActivated==true\n * @property showScreenButton - Screen button, after the notification button.\n * @property screenButtonActivated - Pressed styling for the screen button.\n * @availableWhen screenButtonActivated showScreenButton==true\n * @property showUserButton - User button, last before the clock.\n * @property userButtonActivated - Pressed styling for the user button.\n * @availableWhen userButtonActivated showUserButton==true\n * @property showDimmingButton - Dimming button, between system and user.\n * @property dimmingButtonActivated - Pressed styling for the dimming button.\n * @availableWhen dimmingButtonActivated showDimmingButton==true\n * @property showSystemButton - System button, after the screen button.\n * @property systemButtonActivated - Pressed styling for the system button.\n * @availableWhen systemButtonActivated showSystemButton==true\n * @property nStatusFields - How many `status-icon-N`/`status-label-N` slot pairs are rendered.\n *\n * @slot vessel-selector - Vessel selector content\n * @slot status-label-1 - Label for the first status field\n * @slot status-icon-1 - Icon for the first status field\n * @slot status-label-2 - Label for the second status field\n * @slot status-icon-2 - Icon for the second status field\n * @slot status-label-3 - Label for the third status field\n * @slot status-icon-3 - Icon for the third status field\n * @slot clock - Custom clock content, rendered when `showClock` is true\n *\n * @fires {CustomEvent} home-button-clicked - Fired when the home button is clicked\n * @fires {CustomEvent} link-button-clicked - Fired when the link button is clicked\n * @fires {CustomEvent} alert-button-clicked - Fired when the alert button is clicked\n * @fires {CustomEvent} dimming-button-clicked - Fired when the dimming button is clicked\n * @fires {CustomEvent} notification-button-clicked - Fired when the notification button is clicked\n * @fires {CustomEvent} screen-button-clicked - Fired when the screen button is clicked\n * @fires {CustomEvent} user-button-clicked - Fired when the user button is clicked\n * @fires {CustomEvent} system-button-clicked - Fired when the system button is clicked\n * @experimental\n */\n@customElement('obc-integration-bar-dropdown')\nexport class ObcIntegrationBarDropdown extends LitElement {\n @property({type: Boolean}) showHomeButton = false;\n @property({type: Boolean}) homeButtonActivated = false;\n @property({type: Boolean}) showLinkButton = false;\n @property({type: Boolean}) linkButtonActivated = false;\n @property({type: Boolean}) showClock = false;\n @property({type: Boolean}) showAlertButton = false;\n @property({type: Boolean}) alertButtonActivated = false;\n @property({type: Boolean}) showNotificationButton = false;\n @property({type: Boolean}) notificationButtonActivated = false;\n @property({type: Number}) notificationCount = 0;\n @property({type: Boolean}) showNotificationCount = false;\n @property({type: Boolean}) showScreenButton = false;\n @property({type: Boolean}) screenButtonActivated = false;\n @property({type: Boolean}) showUserButton = false;\n @property({type: Boolean}) userButtonActivated = false;\n @property({type: Boolean}) showDimmingButton = false;\n @property({type: Boolean}) dimmingButtonActivated = false;\n @property({type: Boolean}) showSystemButton = false;\n @property({type: Boolean}) systemButtonActivated = false;\n @property({type: Number}) nStatusFields = 0;\n\n private renderStatusFields() {\n if (this.nStatusFields <= 0) {\n return nothing;\n }\n const result = [];\n for (let i = 0; i < this.nStatusFields; i++) {\n if (i > 0) {\n result.push(html`<div class=\"divider\"></div>`);\n }\n result.push(html`\n <div class=\"status-item\">\n <slot class=\"status-icon\" name=\"status-icon-${i + 1}\"></slot>\n <slot class=\"status-label\" name=\"status-label-${i + 1}\"></slot>\n </div>\n `);\n }\n return html`<div class=\"status\">${result}</div>`;\n }\n\n // The event name stays a literal at each call site so `cem analyze` can read it.\n private renderIconButton(\n name: string,\n activated: boolean,\n label: string,\n icon: TemplateResult,\n onClick: () => void\n ) {\n return html`<obc-icon-button\n class=\"${name}-button\"\n part=\"${name}-button\"\n variant=\"integration\"\n aria-label=${label}\n @click=${onClick}\n ?activated=${activated}\n >\n ${icon}\n </obc-icon-button>`;\n }\n\n override render() {\n return html`\n <div class=\"wrapper\">\n <div class=\"left-side\">\n ${this.showHomeButton\n ? this.renderIconButton(\n 'home',\n this.homeButtonActivated,\n msg('Home'),\n html`<obi-home></obi-home>`,\n () => this.dispatchEvent(new CustomEvent('home-button-clicked'))\n )\n : nothing}\n ${this.showLinkButton\n ? this.renderIconButton(\n 'link',\n this.linkButtonActivated,\n msg('Link'),\n html`<obi-link></obi-link>`,\n () => this.dispatchEvent(new CustomEvent('link-button-clicked'))\n )\n : nothing}\n <slot name=\"vessel-selector\"></slot>\n ${this.renderStatusFields()}\n </div>\n <div class=\"right-side\">\n ${this.showAlertButton\n ? this.renderIconButton(\n 'alert',\n this.alertButtonActivated,\n msg('Alerts'),\n html`<obi-alerts></obi-alerts>`,\n () =>\n this.dispatchEvent(new CustomEvent('alert-button-clicked'))\n )\n : nothing}\n ${this.showNotificationButton\n ? // TODO(designer): keep the Enhanced badge button here, or match the\n // sibling bar's plain notification icon button? (#624)\n html`<obc-notification-button\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('notification-button-clicked')\n )}\n .buttonStyle=${NotificationButtonStyle.Enhanced}\n .showCount=${this.showNotificationCount}\n .count=${this.notificationCount}\n ?isActive=${this.notificationButtonActivated}\n ></obc-notification-button>`\n : nothing}\n ${this.showScreenButton\n ? this.renderIconButton(\n 'screen',\n this.screenButtonActivated,\n msg('Screen'),\n html`<obi-screen-desk></obi-screen-desk>`,\n () =>\n this.dispatchEvent(new CustomEvent('screen-button-clicked'))\n )\n : nothing}\n ${this.showSystemButton\n ? this.renderIconButton(\n 'system',\n this.systemButtonActivated,\n msg('System'),\n html`<obi-configure></obi-configure>`,\n () =>\n this.dispatchEvent(new CustomEvent('system-button-clicked'))\n )\n : nothing}\n ${this.showDimmingButton\n ? this.renderIconButton(\n 'dimming',\n this.dimmingButtonActivated,\n msg('Dimming'),\n html`<obi-palette-day-night-iec></obi-palette-day-night-iec>`,\n () =>\n this.dispatchEvent(new CustomEvent('dimming-button-clicked'))\n )\n : nothing}\n ${this.showUserButton\n ? this.renderIconButton(\n 'user',\n this.userButtonActivated,\n msg('User'),\n html`<obi-user></obi-user>`,\n () => this.dispatchEvent(new CustomEvent('user-button-clicked'))\n )\n : nothing}\n ${this.showClock ? html`<slot name=\"clock\"></slot>` : nothing}\n </div>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-integration-bar-dropdown': ObcIntegrationBarDropdown;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEO,IAAM,4BAAN,cAAwC,WAAW;AAAA,EAAnD,cAAA;AAAA,UAAA,GAAA,SAAA;AACsB,SAAA,iBAAiB;AACjB,SAAA,sBAAsB;AACtB,SAAA,iBAAiB;AACjB,SAAA,sBAAsB;AACtB,SAAA,YAAY;AACZ,SAAA,kBAAkB;AAClB,SAAA,uBAAuB;AACvB,SAAA,yBAAyB;AACzB,SAAA,8BAA8B;AAC/B,SAAA,oBAAoB;AACnB,SAAA,wBAAwB;AACxB,SAAA,mBAAmB;AACnB,SAAA,wBAAwB;AACxB,SAAA,iBAAiB;AACjB,SAAA,sBAAsB;AACtB,SAAA,oBAAoB;AACpB,SAAA,yBAAyB;AACzB,SAAA,mBAAmB;AACnB,SAAA,wBAAwB;AACzB,SAAA,gBAAgB;AAAA,EAAA;AAAA,EAElC,qBAAqB;AAC3B,QAAI,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ACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAjBd,0BAiBgB,WAAA,0BAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAlBd,0BAkBgB,WAAA,oBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAA,CAAQ;AAAA,GAnBd,0BAmBgB,WAAA,yBAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAA,CAAO;AAAA,GApBb,0BAoBe,WAAA,iBAAA,CAAA;AApBf,4BAAN,gBAAA;AAAA,EADN,cAAc,8BAA8B;AAAA,GAChC,yBAAA;"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest';
|
|
2
|
+
import './icon-button.js';
|
|
3
|
+
import {ObcIconButton} from './icon-button.js';
|
|
4
|
+
import {render} from 'vitest-browser-lit';
|
|
5
|
+
import {html} from 'lit';
|
|
6
|
+
|
|
7
|
+
describe('obc-icon-button accessible name', () => {
|
|
8
|
+
async function setup(template: ReturnType<typeof html>) {
|
|
9
|
+
const screen = render(template);
|
|
10
|
+
const el = screen.baseElement.querySelector(
|
|
11
|
+
'obc-icon-button'
|
|
12
|
+
) as ObcIconButton;
|
|
13
|
+
await el.updateComplete;
|
|
14
|
+
return el;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function shadowButton(el: ObcIconButton) {
|
|
18
|
+
return el.shadowRoot!.querySelector('button')!;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
it('forwards the host aria-label to the shadow button', async () => {
|
|
22
|
+
const el = await setup(
|
|
23
|
+
html`<obc-icon-button aria-label="Play"></obc-icon-button>`
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
expect(shadowButton(el).getAttribute('aria-label')).toBe('Play');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('follows later changes to the host aria-label', async () => {
|
|
30
|
+
const el = await setup(
|
|
31
|
+
html`<obc-icon-button aria-label="Play"></obc-icon-button>`
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
el.setAttribute('aria-label', 'Pause');
|
|
35
|
+
await el.updateComplete;
|
|
36
|
+
|
|
37
|
+
expect(shadowButton(el).getAttribute('aria-label')).toBe('Pause');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('does not forward aria-labelledby, which cannot resolve across the shadow boundary', async () => {
|
|
41
|
+
const el = await setup(
|
|
42
|
+
html`<obc-icon-button
|
|
43
|
+
aria-label="Play"
|
|
44
|
+
aria-labelledby="external-label"
|
|
45
|
+
></obc-icon-button>`
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const button = shadowButton(el);
|
|
49
|
+
expect(button.hasAttribute('aria-labelledby')).toBe(false);
|
|
50
|
+
expect(button.getAttribute('aria-label')).toBe('Play');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -2,6 +2,7 @@ import {LitElement, html, nothing, unsafeCSS} from 'lit';
|
|
|
2
2
|
import {property} from 'lit/decorators.js';
|
|
3
3
|
import iconStyle from './icon-button.css?inline';
|
|
4
4
|
import {classMap} from 'lit/directives/class-map.js';
|
|
5
|
+
import {ifDefined} from 'lit/directives/if-defined.js';
|
|
5
6
|
import {customElement} from '../../decorator.js';
|
|
6
7
|
import {degToRad} from '../../svghelpers/math.js';
|
|
7
8
|
|
|
@@ -96,6 +97,7 @@ export enum IconButtonVariant {
|
|
|
96
97
|
* If undefined, no progress indicator is shown.
|
|
97
98
|
* @property hasLabel - If true, displays a label below the icon using the `label` slot.
|
|
98
99
|
* @property showDivider - If false, and cornerLeft or cornerRight is true, the divider is not shown.
|
|
100
|
+
* @property ariaLabel - Accessible name forwarded to the inner `<button>`, mapped to the `aria-label` attribute. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.
|
|
99
101
|
* @slot - Icon slot (default): Place an icon such as <obi-search> here.
|
|
100
102
|
* @slot label - Optional label shown below the icon when `hasLabel` is true.
|
|
101
103
|
* @fires click - Fired when the button is clicked (if not disabled).
|
|
@@ -130,6 +132,10 @@ export class ObcIconButton extends LitElement {
|
|
|
130
132
|
|
|
131
133
|
@property({type: Boolean, attribute: false}) showDivider = true;
|
|
132
134
|
|
|
135
|
+
// Reactive so a consumer swapping the name (Play → Pause) re-renders the shadow button.
|
|
136
|
+
@property({type: String, attribute: 'aria-label'})
|
|
137
|
+
override ariaLabel: string | null = null;
|
|
138
|
+
|
|
133
139
|
get progressSpinner() {
|
|
134
140
|
if (this.progress === undefined) {
|
|
135
141
|
return nothing;
|
|
@@ -200,6 +206,7 @@ export class ObcIconButton extends LitElement {
|
|
|
200
206
|
'hide-divider': !this.showDivider,
|
|
201
207
|
})}
|
|
202
208
|
?disabled=${this.disabled}
|
|
209
|
+
aria-label=${ifDefined(this.ariaLabel ?? undefined)}
|
|
203
210
|
part="wrapper"
|
|
204
211
|
>
|
|
205
212
|
${this.progress !== undefined ? this.progressSpinner : nothing}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {LitElement, html, unsafeCSS} from 'lit';
|
|
2
2
|
import {property} from 'lit/decorators.js';
|
|
3
3
|
import {classMap} from 'lit/directives/class-map.js';
|
|
4
|
+
import {msg} from '@lit/localize';
|
|
4
5
|
import compentStyle from './top-bar.css?inline';
|
|
5
6
|
import '../icon-button/icon-button.js';
|
|
6
7
|
import '../clock/clock.js';
|
|
@@ -429,6 +430,7 @@ export class ObcTopBar extends LitElement {
|
|
|
429
430
|
html`<div class="menu-button">
|
|
430
431
|
<obc-icon-button
|
|
431
432
|
variant="flat"
|
|
433
|
+
aria-label=${msg('Close')}
|
|
432
434
|
@pointerdown=${() => this.leftButtonDown(new CustomEvent('close'))}
|
|
433
435
|
@pointerup=${() => this.leftButtonUp()}
|
|
434
436
|
@pointerleave=${() => this.leftButtonLeave()}
|
|
@@ -440,6 +442,7 @@ export class ObcTopBar extends LitElement {
|
|
|
440
442
|
leftGroup.push(
|
|
441
443
|
html`<obc-icon-button
|
|
442
444
|
variant="flat"
|
|
445
|
+
aria-label=${msg('Back')}
|
|
443
446
|
@click=${() => this.dispatchEvent(new CustomEvent('back'))}
|
|
444
447
|
>
|
|
445
448
|
<obi-arrow-left-google></obi-arrow-left-google>
|
|
@@ -463,6 +466,9 @@ export class ObcTopBar extends LitElement {
|
|
|
463
466
|
html`<div class="menu-button ${this.wideMenuButton ? 'wide' : null}">
|
|
464
467
|
<obc-icon-button
|
|
465
468
|
variant="flat"
|
|
469
|
+
aria-label=${this.menuButtonIcon === ObcTopBarMenuButtonIcon.Menu
|
|
470
|
+
? msg('Menu')
|
|
471
|
+
: msg('Home')}
|
|
466
472
|
@pointerdown=${() =>
|
|
467
473
|
this.leftButtonDown(new CustomEvent('menu-button-clicked'))}
|
|
468
474
|
@pointerup=${() => this.leftButtonUp()}
|
|
@@ -553,6 +559,7 @@ export class ObcTopBar extends LitElement {
|
|
|
553
559
|
class="dimming-button"
|
|
554
560
|
part="dimming-button"
|
|
555
561
|
variant="flat"
|
|
562
|
+
aria-label=${msg('Dimming')}
|
|
556
563
|
@click=${this.dimmingButtonClicked}
|
|
557
564
|
?activated=${this.dimmingButtonActivated}
|
|
558
565
|
>
|
|
@@ -564,6 +571,7 @@ export class ObcTopBar extends LitElement {
|
|
|
564
571
|
class="user-button"
|
|
565
572
|
variant="flat"
|
|
566
573
|
part="user-button"
|
|
574
|
+
aria-label=${msg('User')}
|
|
567
575
|
@click=${this.userButtonClicked}
|
|
568
576
|
?activated=${this.userButtonActivated}
|
|
569
577
|
?disabled=${this.userButtonDisabled}
|
|
@@ -576,6 +584,7 @@ export class ObcTopBar extends LitElement {
|
|
|
576
584
|
class="apps-button"
|
|
577
585
|
variant="flat"
|
|
578
586
|
part="apps-button"
|
|
587
|
+
aria-label=${msg('Apps')}
|
|
579
588
|
@click=${this.appsButtonClicked}
|
|
580
589
|
?activated=${this.appsButtonActivated}
|
|
581
590
|
>
|
|
@@ -588,6 +597,7 @@ export class ObcTopBar extends LitElement {
|
|
|
588
597
|
class="left-more-button"
|
|
589
598
|
part="left-more-button"
|
|
590
599
|
variant="flat"
|
|
600
|
+
aria-label=${msg('More')}
|
|
591
601
|
@click=${this.leftMoreButtonClicked}
|
|
592
602
|
?activated=${this.leftMoreButtonActivated}
|
|
593
603
|
>
|
|
@@ -54,6 +54,14 @@
|
|
|
54
54
|
'sdb1595f5c742dfbb': `Input`,
|
|
55
55
|
's37cbecaec58e2192': `Mode`,
|
|
56
56
|
's065289e6cba017c6': `Transcribe`,
|
|
57
|
+
's5e8250fb85d64c23': `Close`,
|
|
58
|
+
'sc16e00a7a8b2fde2': `Back`,
|
|
59
|
+
's6d8c02aee480af7a': `Menu`,
|
|
60
|
+
's6abb1cd87fe0114e': `Home`,
|
|
61
|
+
's18c92783d4042bbc': `Dimming`,
|
|
62
|
+
'sa48f81f001b893d2': `User`,
|
|
63
|
+
'sf7eeef8b4d6e602d': `Apps`,
|
|
64
|
+
's37a9e8aec5713460': `More`,
|
|
57
65
|
's76b886a513fca0d8': `Username is required`,
|
|
58
66
|
'seb1d48da15e775c9': `Password is required`,
|
|
59
67
|
's5e27738a2e8eb763': `Sign in`,
|
|
@@ -61,8 +69,10 @@
|
|
|
61
69
|
'sf6e1665c7022a1f8': `Password`,
|
|
62
70
|
's981f6febad4df84a': `Recently signed in`,
|
|
63
71
|
'sbce70cbdb856635e': `Recent`,
|
|
64
|
-
'sa48f81f001b893d2': `User`,
|
|
65
72
|
's7cfe12cd14df9950': `Sign out`,
|
|
73
|
+
's5be3c6d61cd9182f': `Notifications`,
|
|
74
|
+
's744d993d03f29851': `Screen`,
|
|
75
|
+
'sa81e2cdaf6921adc': `System`,
|
|
66
76
|
's3374200692e9843d': `No alerts`,
|
|
67
77
|
's6686fcc6d2c8f0bd': `Note`,
|
|
68
78
|
'sfbc33dd48f23752c': `Tag ID`,
|
|
@@ -64,6 +64,14 @@
|
|
|
64
64
|
'sdb1595f5c742dfbb': `Input`,
|
|
65
65
|
's37cbecaec58e2192': `Mode`,
|
|
66
66
|
's065289e6cba017c6': `Transcribe`,
|
|
67
|
+
's5e8250fb85d64c23': `Close`,
|
|
68
|
+
'sc16e00a7a8b2fde2': `Back`,
|
|
69
|
+
's6d8c02aee480af7a': `Menu`,
|
|
70
|
+
's6abb1cd87fe0114e': `Home`,
|
|
71
|
+
's18c92783d4042bbc': `Dimming`,
|
|
72
|
+
'sa48f81f001b893d2': `User`,
|
|
73
|
+
'sf7eeef8b4d6e602d': `Apps`,
|
|
74
|
+
's37a9e8aec5713460': `More`,
|
|
67
75
|
's76b886a513fca0d8': `Username is required`,
|
|
68
76
|
'seb1d48da15e775c9': `Password is required`,
|
|
69
77
|
's5e27738a2e8eb763': `Sign in`,
|
|
@@ -71,8 +79,10 @@
|
|
|
71
79
|
'sf6e1665c7022a1f8': `Password`,
|
|
72
80
|
's981f6febad4df84a': `Recently signed in`,
|
|
73
81
|
'sbce70cbdb856635e': `Recent`,
|
|
74
|
-
'sa48f81f001b893d2': `User`,
|
|
75
82
|
's7cfe12cd14df9950': `Sign out`,
|
|
83
|
+
's5be3c6d61cd9182f': `Notifications`,
|
|
84
|
+
's744d993d03f29851': `Screen`,
|
|
85
|
+
'sa81e2cdaf6921adc': `System`,
|
|
76
86
|
's3374200692e9843d': `No alerts`,
|
|
77
87
|
};
|
|
78
88
|
|