@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.152 → 2.0.0-next.153
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/.storybook/vitest.setup.ts +1 -1
- package/bundle/openbridge-webcomponents.bundle.js +4717 -4485
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +374 -52
- package/dist/alert-severity.d.ts +19 -1
- package/dist/alert-severity.d.ts.map +1 -1
- package/dist/alert-severity.js +48 -2
- package/dist/alert-severity.js.map +1 -1
- package/dist/components/alert-button/alert-button.css.js +7 -1513
- package/dist/components/alert-button/alert-button.css.js.map +1 -1
- package/dist/components/alert-button/alert-button.d.ts +40 -96
- package/dist/components/alert-button/alert-button.d.ts.map +1 -1
- package/dist/components/alert-button/alert-button.js +40 -107
- package/dist/components/alert-button/alert-button.js.map +1 -1
- package/dist/components/alert-button-item/alert-button-item.css.js +1570 -0
- package/dist/components/alert-button-item/alert-button-item.css.js.map +1 -0
- package/dist/components/alert-button-item/alert-button-item.d.ts +134 -0
- package/dist/components/alert-button-item/alert-button-item.d.ts.map +1 -0
- package/dist/components/alert-button-item/alert-button-item.js +210 -0
- package/dist/components/alert-button-item/alert-button-item.js.map +1 -0
- package/dist/components/alert-counter-item/alert-counter-item.css.js +25 -0
- package/dist/components/alert-counter-item/alert-counter-item.css.js.map +1 -0
- package/dist/components/alert-counter-item/alert-counter-item.d.ts +77 -0
- package/dist/components/alert-counter-item/alert-counter-item.d.ts.map +1 -0
- package/dist/components/alert-counter-item/alert-counter-item.js +87 -0
- package/dist/components/alert-counter-item/alert-counter-item.js.map +1 -0
- package/dist/components/alert-frame/alert-frame.css.js +23 -27
- package/dist/components/alert-frame/alert-frame.css.js.map +1 -1
- package/dist/components/alert-frame/alert-frame.d.ts +7 -6
- package/dist/components/alert-frame/alert-frame.d.ts.map +1 -1
- package/dist/components/alert-frame/alert-frame.js +6 -9
- package/dist/components/alert-frame/alert-frame.js.map +1 -1
- package/dist/components/tree-navigation-item/tree-navigation-item.d.ts +7 -34
- package/dist/components/tree-navigation-item/tree-navigation-item.d.ts.map +1 -1
- package/dist/components/tree-navigation-item/tree-navigation-item.js +3 -32
- package/dist/components/tree-navigation-item/tree-navigation-item.js.map +1 -1
- package/dist/generated/locales/es-419.d.ts +11 -3
- package/dist/generated/locales/es-419.d.ts.map +1 -1
- package/dist/generated/locales/es-419.js +11 -3
- package/dist/generated/locales/es-419.js.map +1 -1
- package/dist/generated/locales/fi-FI.d.ts +8 -0
- package/dist/generated/locales/fi-FI.d.ts.map +1 -1
- package/dist/generated/locales/fi-FI.js +8 -0
- package/dist/generated/locales/fi-FI.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.css.js +4 -29
- package/dist/navigation-instruments/readout/readout.css.js.map +1 -1
- package/dist/navigation-instruments/readout/readout.d.ts.map +1 -1
- package/dist/navigation-instruments/readout/readout.js +1 -9
- package/dist/navigation-instruments/readout/readout.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +5 -34
- package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js +1 -9
- package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
- package/dist/palettes/blinking.d.ts +6 -2
- package/dist/palettes/blinking.d.ts.map +1 -1
- package/dist/palettes/blinking.js +6 -2
- package/dist/palettes/blinking.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/alert-severity.spec.ts +81 -2
- package/src/alert-severity.ts +74 -0
- package/src/components/alert-button/alert-button.css +7 -196
- package/src/components/alert-button/alert-button.spec.ts +119 -68
- package/src/components/alert-button/alert-button.stories.ts +24 -0
- package/src/components/alert-button/alert-button.ts +49 -211
- package/src/components/alert-button-item/alert-button-item.css +242 -0
- package/src/components/alert-button-item/alert-button-item.spec.ts +299 -0
- package/src/components/alert-button-item/alert-button-item.stories.ts +178 -0
- package/src/components/alert-button-item/alert-button-item.ts +289 -0
- package/src/components/alert-counter-item/alert-counter-item.css +15 -0
- package/src/components/alert-counter-item/alert-counter-item.spec.ts +91 -0
- package/src/components/alert-counter-item/alert-counter-item.stories.ts +66 -0
- package/src/components/alert-counter-item/alert-counter-item.ts +128 -0
- package/src/components/alert-frame/alert-frame.css +23 -27
- package/src/components/alert-frame/alert-frame.spec.ts +19 -1
- package/src/components/alert-frame/alert-frame.stories.ts +47 -0
- package/src/components/alert-frame/alert-frame.ts +16 -17
- package/src/components/tree-navigation-item/tree-navigation-item.ts +10 -60
- package/src/generated/locales/es-419.ts +11 -3
- package/src/generated/locales/fi-FI.ts +8 -0
- package/src/navigation-instruments/readout/readout.css +4 -29
- package/src/navigation-instruments/readout/readout.ts +1 -9
- package/src/navigation-instruments/readout-list-item/readout-list-item.css +5 -33
- package/src/navigation-instruments/readout-list-item/readout-list-item.ts +1 -9
- package/src/palettes/blinking.spec.ts +38 -23
- package/src/palettes/blinking.ts +12 -4
- package/src/types.ts +16 -0
|
@@ -1,51 +1,25 @@
|
|
|
1
1
|
import {LitElement, html, nothing, unsafeCSS} from 'lit';
|
|
2
2
|
import {property, state} from 'lit/decorators.js';
|
|
3
|
+
import {classMap} from 'lit/directives/class-map.js';
|
|
4
|
+
import {localized, msg} from '@lit/localize';
|
|
3
5
|
import compentStyle from './alert-button.css?inline';
|
|
4
|
-
import '../../icons/icon-alerts.js';
|
|
5
|
-
import '../../icons/icon-alerts-active.js';
|
|
6
6
|
import '../../icons/icon-notification.js';
|
|
7
7
|
import '../../icons/icon-notification-advice.js';
|
|
8
8
|
import '../../icons/icon-notification-advice-active.js';
|
|
9
9
|
import '../../icons/icon-silence-iec.js';
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import '../../
|
|
13
|
-
import '../../manual-icon/icon-alerts-critical-twotone.js';
|
|
14
|
-
import '../../manual-icon/icon-alerts-diagnostic-twotone.js';
|
|
15
|
-
import {
|
|
16
|
-
AlertType,
|
|
17
|
-
FlashingSpeed,
|
|
18
|
-
type ResolvedFlashingSpeed,
|
|
19
|
-
} from '../../types.js';
|
|
20
|
-
import {
|
|
21
|
-
AlertFlashPhase,
|
|
22
|
-
getAlertTwotoneComponent,
|
|
23
|
-
AlertTwotoneComponent,
|
|
24
|
-
resolveFlashingSpeed,
|
|
25
|
-
} from '../../alert-severity.js';
|
|
26
|
-
import {classMap} from 'lit/directives/class-map.js';
|
|
10
|
+
import '../alert-button-item/alert-button-item.js';
|
|
11
|
+
import {ObcAlertButtonType} from '../alert-button-item/alert-button-item.js';
|
|
12
|
+
import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
|
|
27
13
|
import {customElement} from '../../decorator.js';
|
|
28
|
-
import {FlashingController} from '../../palettes/flashing-controller.js';
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
* `ObcAlertButtonType` – Enum for alert button visual and behavioral variants.
|
|
32
|
-
*
|
|
33
|
-
* - `flat`: Minimal, icon-only button for compact spaces.
|
|
34
|
-
* - `normal`: Standard button with icon and optional counter.
|
|
35
|
-
* - `enhanced`: Emphasized button with additional styling for high-priority alerts.
|
|
36
|
-
*/
|
|
37
|
-
export enum ObcAlertButtonType {
|
|
38
|
-
Flat = 'flat',
|
|
39
|
-
Normal = 'normal',
|
|
40
|
-
Enhanced = 'enhanced',
|
|
41
|
-
}
|
|
15
|
+
export {ObcAlertButtonType};
|
|
42
16
|
|
|
43
17
|
/**
|
|
44
18
|
* `<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.
|
|
45
19
|
*
|
|
46
20
|
* This component provides a visual indicator for active alerts or notifications, supporting different alert types (such as alarm, warning, or caution) and an optional counter badge. It can also include a secondary "silence" action button for muting alerts, adapting its layout responsively for different screen widths.
|
|
47
21
|
*
|
|
48
|
-
* Appears in toolbars or notification areas to give users a quick overview of alert status and provide direct access to alert-related actions.
|
|
22
|
+
* Appears in toolbars or notification areas to give users a quick overview of alert status and provide direct access to alert-related actions. The bell itself is an `obc-alert-button-item`; use the item directly where no silence button or breakpoints are needed, or for its global counter.
|
|
49
23
|
*
|
|
50
24
|
* ## Features
|
|
51
25
|
*
|
|
@@ -55,6 +29,7 @@ export enum ObcAlertButtonType {
|
|
|
55
29
|
* - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.
|
|
56
30
|
* - **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.
|
|
57
31
|
* - **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).
|
|
32
|
+
* - **Global Counter:** `globalCounter` shows the per-severity `counts` and an optional `shelvedCount` before the bell and the total, as `obc-alert-button-item` draws them.
|
|
58
33
|
* - **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.
|
|
59
34
|
* - **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).
|
|
60
35
|
* - **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.
|
|
@@ -71,19 +46,7 @@ export enum ObcAlertButtonType {
|
|
|
71
46
|
*
|
|
72
47
|
* **TODO(designer):** Confirm if there are recommended default behaviors for auto-blinking, and if there are any design constraints for when to use each variant.
|
|
73
48
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* - `nAlerts` (number): Number of active alerts to display in the counter badge.
|
|
77
|
-
* - `alertType` (`AlertType`): Type of alert (`alarm`, `warning`, `caution`, or undefined for idle).
|
|
78
|
-
* - `type` (`ObcAlertButtonType`): Visual variant of the button (`flat`, `normal`, `enhanced`). Default is `normal`.
|
|
79
|
-
* - `counter` (boolean): Whether to show the alert counter badge (not available in flat mode).
|
|
80
|
-
* - `showSilenceButton` (boolean): Whether to display the silence button (hidden in flat mode or below min breakpoint).
|
|
81
|
-
* - `silenceButtonDisabled` (boolean): Disables the silence button when true.
|
|
82
|
-
* - `flatMaxBreakpointPx` (number): Maximum width (in px) for normal/enhanced mode; below this, switches to flat mode.
|
|
83
|
-
* - `silenceButtonMinBreakpointPx` (number): Minimum width (in px) to show the silence button; below this, it is hidden.
|
|
84
|
-
* - `blinking` (boolean): Enables blinking animation for active alerts (not for caution type).
|
|
85
|
-
* - `flashingSpeed`: tempo of the blink (`default` follows the alert type: critical/alarm/high fast, warning/medium slow, low very slow; `fixed` never flashes).
|
|
86
|
-
* - `large` (boolean): Increases button size for prominent or touch-friendly use.
|
|
49
|
+
* **TODO(designer):** The Figma Alert button has no flat Global counter, so below `flatMaxBreakpointPx` the button shows the flat bell without the counts.
|
|
87
50
|
*
|
|
88
51
|
* ## Events
|
|
89
52
|
*
|
|
@@ -115,107 +78,47 @@ export enum ObcAlertButtonType {
|
|
|
115
78
|
*
|
|
116
79
|
* In this example, the button shows an alarm icon, a counter badge with "3", is styled as enhanced, blinks to indicate urgency, and includes a silence button if the width allows.
|
|
117
80
|
*
|
|
118
|
-
* @property
|
|
119
|
-
*
|
|
81
|
+
* @property nAlerts - Number of active alerts shown in the counter; 0 shows the idle state.
|
|
82
|
+
* @property alertType - Alert type that selects the icon and colours: `alarm`, `warning`, `caution`, a `level-*` severity, or unset for the idle state.
|
|
83
|
+
* @property type - Visual variant: `flat` (icon only), `normal` (default, icon and optional counter) or `enhanced` (emphasized for high-priority alerts).
|
|
84
|
+
* @property large - Increases the button height and padding for touch-friendly or prominent use.
|
|
85
|
+
* @property showSilenceButton - Shows the silence button when the width is at least `silenceButtonMinBreakpointPx` and the button is not flat.
|
|
120
86
|
* @property silenceButtonDisabled - Disables the silence button when true.
|
|
121
87
|
* @availableWhen silenceButtonDisabled showSilenceButton==true
|
|
122
|
-
* @
|
|
88
|
+
* @property counter - Shows the alert counter when there are active alerts and the button is not flat.
|
|
89
|
+
* @property globalCounter - Shows the per-severity counts and the shelved count before the bell and the total (the item's global counter); a flat button shows the plain bell.
|
|
90
|
+
* @property counts - Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts).
|
|
91
|
+
* @availableWhen counts globalCounter==true
|
|
92
|
+
* @property shelvedCount - Number of shelved alerts, shown after the global counter badges; hidden at zero.
|
|
93
|
+
* @availableWhen shelvedCount globalCounter==true
|
|
94
|
+
* @property blinking - Flashes the bell for active alerts of a flashing alert type (never for caution).
|
|
95
|
+
* @property flashingSpeed - Flash tempo while `blinking` is on: `default` resolves from `alertType`, `fast`, `slow`, `very-slow` force a tempo, `fixed` never flashes.
|
|
96
|
+
* @availableWhen flashingSpeed blinking==true
|
|
97
|
+
* @property flatMaxBreakpointPx - Window width in px below which a `normal` or `enhanced` button switches to flat mode.
|
|
98
|
+
* @availableWhen flatMaxBreakpointPx type!=flat
|
|
99
|
+
* @property silenceButtonMinBreakpointPx - Minimum window width in px for showing the silence button.
|
|
100
|
+
* @availableWhen silenceButtonMinBreakpointPx showSilenceButton==true
|
|
123
101
|
* @fires {CustomEvent<void>} click-alert - Fired when the main alert button is clicked.
|
|
124
102
|
* @fires {CustomEvent<void>} click-silence - Fired when the silence button is clicked.
|
|
125
103
|
* @stable
|
|
126
104
|
*/
|
|
127
105
|
@customElement('obc-alert-button')
|
|
106
|
+
@localized()
|
|
128
107
|
export class ObcAlertButton extends LitElement {
|
|
129
|
-
/**
|
|
130
|
-
* Number of active alerts to display in the counter badge.
|
|
131
|
-
*
|
|
132
|
-
* If set to 0, the button appears in the idle state.
|
|
133
|
-
*/
|
|
134
108
|
@property({type: Number}) nAlerts = 0;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Type of alert to display.
|
|
138
|
-
*
|
|
139
|
-
* Determines the icon and color scheme. Can be `alarm`, `warning`, `caution`, or undefined for idle state.
|
|
140
|
-
*/
|
|
141
109
|
@property({type: String}) alertType?: AlertType;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Visual variant of the button.
|
|
145
|
-
*
|
|
146
|
-
* - `flat`: Minimal, icon-only button for compact layouts.
|
|
147
|
-
* - `normal`: Standard button with icon and optional counter (default).
|
|
148
|
-
* - `enhanced`: Emphasized button for high-priority alerts.
|
|
149
|
-
*/
|
|
150
110
|
@property({type: String}) type = ObcAlertButtonType.Normal;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Increases button size for touch-friendly or prominent use.
|
|
154
|
-
*
|
|
155
|
-
* Adds extra height and padding.
|
|
156
|
-
*/
|
|
157
111
|
@property({type: Boolean}) large = false;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Whether to display the silence button.
|
|
161
|
-
*
|
|
162
|
-
* The silence button is only shown if this is true, the width is above `silenceButtonMinBreakpointPx`, and the button is not in flat mode.
|
|
163
|
-
*/
|
|
164
112
|
@property({type: Boolean}) showSilenceButton = false;
|
|
165
|
-
|
|
166
113
|
@property({type: Boolean}) silenceButtonDisabled = false;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Whether to show the alert counter badge.
|
|
170
|
-
*
|
|
171
|
-
* Only shown when there are active alerts and the button is not in flat mode.
|
|
172
|
-
*/
|
|
173
114
|
@property({type: Boolean}) counter = false;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
*
|
|
178
|
-
* Blinking is only shown for alarm and warning types, not for caution.
|
|
179
|
-
*/
|
|
115
|
+
@property({type: Boolean}) globalCounter = false;
|
|
116
|
+
@property({type: Object, attribute: false}) counts: AlertCounts = {};
|
|
117
|
+
@property({type: Number}) shelvedCount = 0;
|
|
180
118
|
@property({type: Boolean}) blinking = false;
|
|
181
|
-
|
|
182
119
|
@property({type: String}) flashingSpeed: FlashingSpeed =
|
|
183
120
|
FlashingSpeed.Default;
|
|
184
|
-
|
|
185
|
-
protected readonly flashing = new FlashingController(
|
|
186
|
-
this,
|
|
187
|
-
() => this.resolvedFlashingSpeed
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
get resolvedFlashingSpeed(): ResolvedFlashingSpeed {
|
|
191
|
-
if (!this.blinking || this.nAlerts <= 0 || this.alertType === undefined) {
|
|
192
|
-
return FlashingSpeed.Fixed;
|
|
193
|
-
}
|
|
194
|
-
return resolveFlashingSpeed(
|
|
195
|
-
this.flashingSpeed,
|
|
196
|
-
this.alertType,
|
|
197
|
-
AlertFlashPhase.Active
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Maximum width (in px) for normal/enhanced mode.
|
|
203
|
-
*
|
|
204
|
-
* If the available width is less than this value, the button switches to flat mode.
|
|
205
|
-
* Only applies when `type` is set to `normal` or `enhanced`.
|
|
206
|
-
*
|
|
207
|
-
* @availableWhen type!=flat
|
|
208
|
-
*/
|
|
209
121
|
@property({type: Number}) flatMaxBreakpointPx = 0;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Minimum width (in px) to show the silence button.
|
|
213
|
-
*
|
|
214
|
-
* If the available width is less than this value, the silence button is hidden.
|
|
215
|
-
* Only applies when `showSilenceButton` is true.
|
|
216
|
-
*
|
|
217
|
-
* @availableWhen showSilenceButton==true
|
|
218
|
-
*/
|
|
219
122
|
@property({type: Number}) silenceButtonMinBreakpointPx = 0;
|
|
220
123
|
|
|
221
124
|
@state() private width = window.innerWidth;
|
|
@@ -234,59 +137,6 @@ export class ObcAlertButton extends LitElement {
|
|
|
234
137
|
super.disconnectedCallback();
|
|
235
138
|
}
|
|
236
139
|
|
|
237
|
-
private renderAlertTwotoneIcon() {
|
|
238
|
-
const twotone = this.alertType
|
|
239
|
-
? getAlertTwotoneComponent(this.alertType)
|
|
240
|
-
: AlertTwotoneComponent.Caution;
|
|
241
|
-
switch (twotone) {
|
|
242
|
-
case AlertTwotoneComponent.Critical:
|
|
243
|
-
return html`<obi-alerts-critical-twotone
|
|
244
|
-
useCssColor
|
|
245
|
-
class="icon"
|
|
246
|
-
></obi-alerts-critical-twotone>`;
|
|
247
|
-
case AlertTwotoneComponent.Diagnostic:
|
|
248
|
-
return html`<obi-alerts-diagnostic-twotone
|
|
249
|
-
useCssColor
|
|
250
|
-
class="icon"
|
|
251
|
-
></obi-alerts-diagnostic-twotone>`;
|
|
252
|
-
case AlertTwotoneComponent.Warning:
|
|
253
|
-
return html`<obi-alerts-warning-twotone
|
|
254
|
-
useCssColor
|
|
255
|
-
class="icon"
|
|
256
|
-
></obi-alerts-warning-twotone>`;
|
|
257
|
-
case AlertTwotoneComponent.Caution:
|
|
258
|
-
return html`<obi-alerts-caution-twotone
|
|
259
|
-
useCssColor
|
|
260
|
-
class="icon"
|
|
261
|
-
></obi-alerts-caution-twotone>`;
|
|
262
|
-
default:
|
|
263
|
-
return html`<obi-alerts-alarm-twotone
|
|
264
|
-
useCssColor
|
|
265
|
-
class="icon"
|
|
266
|
-
></obi-alerts-alarm-twotone>`;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
private alertIcon() {
|
|
271
|
-
const isIdle = this.nAlerts === 0;
|
|
272
|
-
if (isIdle) {
|
|
273
|
-
return html`<obi-alerts class="icon"></obi-alerts>`;
|
|
274
|
-
}
|
|
275
|
-
if (this.type === ObcAlertButtonType.Enhanced) {
|
|
276
|
-
return html`<obi-alerts-active class="icon"></obi-alerts-active>`;
|
|
277
|
-
}
|
|
278
|
-
return this.renderAlertTwotoneIcon();
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
private alertIconNegative() {
|
|
282
|
-
const useIdle =
|
|
283
|
-
this.nAlerts === 0 || this.type !== ObcAlertButtonType.Enhanced;
|
|
284
|
-
if (useIdle) {
|
|
285
|
-
return html`<obi-alerts class="icon"></obi-alerts>`;
|
|
286
|
-
}
|
|
287
|
-
return this.renderAlertTwotoneIcon();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
140
|
private get activeType(): ObcAlertButtonType {
|
|
291
141
|
if (this.type === ObcAlertButtonType.Flat) {
|
|
292
142
|
return ObcAlertButtonType.Flat;
|
|
@@ -306,47 +156,35 @@ export class ObcAlertButton extends LitElement {
|
|
|
306
156
|
}
|
|
307
157
|
|
|
308
158
|
override render() {
|
|
309
|
-
const
|
|
310
|
-
const showCounter =
|
|
311
|
-
this.counter && hasAlerts && this.activeType !== ObcAlertButtonType.Flat;
|
|
312
|
-
const tempo = this.resolvedFlashingSpeed;
|
|
313
|
-
const showBlinking = tempo !== FlashingSpeed.Fixed;
|
|
159
|
+
const showSilence = this.showSilenceButtonDynamic;
|
|
314
160
|
return html`
|
|
315
161
|
<div
|
|
316
162
|
class=${classMap({
|
|
317
163
|
wrapper: true,
|
|
318
|
-
[`alert-type-${this.alertType ?? 'none'}`]: true,
|
|
319
|
-
counter: showCounter,
|
|
320
|
-
'has-silence': this.showSilenceButtonDynamic,
|
|
321
164
|
[`type-${this.activeType}`]: true,
|
|
322
|
-
[`flash-${tempo}`]: true,
|
|
323
165
|
large: this.large,
|
|
324
166
|
})}
|
|
325
167
|
>
|
|
326
|
-
<button
|
|
327
|
-
|
|
168
|
+
<obc-alert-button-item
|
|
169
|
+
.type=${this.activeType}
|
|
170
|
+
.alertType=${this.alertType}
|
|
171
|
+
.nAlerts=${this.nAlerts}
|
|
172
|
+
.counter=${this.counter}
|
|
173
|
+
.globalCounter=${this.globalCounter &&
|
|
174
|
+
this.activeType !== ObcAlertButtonType.Flat}
|
|
175
|
+
.counts=${this.counts}
|
|
176
|
+
.shelvedCount=${this.shelvedCount}
|
|
177
|
+
.blinking=${this.blinking}
|
|
178
|
+
.flashingSpeed=${this.flashingSpeed}
|
|
179
|
+
.fillHeight=${this.large}
|
|
180
|
+
?data-group-item-not-last=${showSilence}
|
|
328
181
|
@click=${() => this.dispatchEvent(new CustomEvent('click-alert'))}
|
|
329
|
-
>
|
|
330
|
-
|
|
331
|
-
? html` <div class="blink">
|
|
332
|
-
${this.alertIconNegative()}
|
|
333
|
-
${showCounter
|
|
334
|
-
? html`<div class="badge">${this.nAlerts}</div>`
|
|
335
|
-
: null}
|
|
336
|
-
</div>`
|
|
337
|
-
: nothing}
|
|
338
|
-
<div class="visible-wrapper">
|
|
339
|
-
${this.alertIcon()}
|
|
340
|
-
${showCounter
|
|
341
|
-
? html`<div class="badge">${this.nAlerts}</div>`
|
|
342
|
-
: nothing}
|
|
343
|
-
</div>
|
|
344
|
-
</button>
|
|
345
|
-
|
|
346
|
-
${this.showSilenceButtonDynamic
|
|
182
|
+
></obc-alert-button-item>
|
|
183
|
+
${showSilence
|
|
347
184
|
? html`
|
|
348
185
|
<button
|
|
349
186
|
class="silence-button"
|
|
187
|
+
aria-label=${msg('Silence')}
|
|
350
188
|
@click=${() =>
|
|
351
189
|
this.dispatchEvent(new CustomEvent('click-silence'))}
|
|
352
190
|
?disabled=${this.silenceButtonDisabled}
|
|
@@ -356,7 +194,7 @@ export class ObcAlertButton extends LitElement {
|
|
|
356
194
|
</div>
|
|
357
195
|
</button>
|
|
358
196
|
`
|
|
359
|
-
:
|
|
197
|
+
: nothing}
|
|
360
198
|
</div>
|
|
361
199
|
`;
|
|
362
200
|
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.alert-button {
|
|
10
|
+
appearance: none;
|
|
11
|
+
background: none;
|
|
12
|
+
border: none;
|
|
13
|
+
padding: 0;
|
|
14
|
+
position: relative; /* containing block of the .blink layer */
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-grow: 1; /* fills the width a parent gives the host */
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
min-width: var(--app-components-alert-button-item-min-width);
|
|
20
|
+
height: var(--app-components-alert-button-item-touch-target-size);
|
|
21
|
+
|
|
22
|
+
&.fill-height {
|
|
23
|
+
height: 100%;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.icon {
|
|
28
|
+
display: block;
|
|
29
|
+
width: var(--app-components-alert-button-item-icon-size);
|
|
30
|
+
height: var(--app-components-alert-button-item-icon-size);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.visible-wrapper,
|
|
34
|
+
.blink {
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
height: var(--app-components-alert-button-item-visual-target-size);
|
|
39
|
+
min-width: var(--ui-components-icon-button-visual-target-size);
|
|
40
|
+
border-radius: var(--ui-components-button-border-radius-top-left)
|
|
41
|
+
var(--ui-components-button-border-radius-top-right)
|
|
42
|
+
var(--ui-components-button-border-radius-bottom-right)
|
|
43
|
+
var(--ui-components-button-border-radius-bottom-left);
|
|
44
|
+
color: var(--on-normal-neutral-color);
|
|
45
|
+
@mixin font-button;
|
|
46
|
+
|
|
47
|
+
.fill-height & {
|
|
48
|
+
height: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* a parent joins another button to this end */
|
|
52
|
+
:host([data-group-item-not-last]) & {
|
|
53
|
+
border-top-right-radius: 0;
|
|
54
|
+
border-bottom-right-radius: 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.blink {
|
|
59
|
+
position: absolute;
|
|
60
|
+
inset: 0;
|
|
61
|
+
margin: auto; /* centres the fixed-height layer in the touch target */
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.content {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: var(--app-components-alert-button-item-counter-spacing);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.counter .content {
|
|
71
|
+
/* the Figma stroke is drawn inside the frame, over this padding */
|
|
72
|
+
padding: 0 calc(var(--ui-components-button-padding-horizontal) - 1px);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.count {
|
|
76
|
+
padding-right: var(--app-components-alert-button-item-padding-counter-right);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.global-counter {
|
|
80
|
+
& .visible-wrapper {
|
|
81
|
+
/* the Figma stroke is drawn inside the frame, over this padding */
|
|
82
|
+
padding: 0
|
|
83
|
+
calc(var(--app-components-alert-button-item-padding-horizontal) - 1px);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
& .content {
|
|
87
|
+
padding: 0 var(--ui-components-button-padding-horizontal);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.type-flat {
|
|
92
|
+
@mixin style style=flat visibleWrapperClass=.visible-wrapper;
|
|
93
|
+
@mixin style style=flat visibleWrapperClass=.blink;
|
|
94
|
+
|
|
95
|
+
& .visible-wrapper {
|
|
96
|
+
color: var(--on-flat-neutral-color);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
& .blink {
|
|
100
|
+
width: min-content;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.type-normal .visible-wrapper,
|
|
105
|
+
.type-enhanced .visible-wrapper {
|
|
106
|
+
width: 100%;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.type-normal {
|
|
110
|
+
@mixin style style=normal visibleWrapperClass=.visible-wrapper;
|
|
111
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.type-enhanced.alert-type-alarm {
|
|
115
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
116
|
+
@mixin style style=alarm visibleWrapperClass=.visible-wrapper;
|
|
117
|
+
& .visible-wrapper {
|
|
118
|
+
color: var(--on-alarm-active-color);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.type-enhanced.alert-type-warning {
|
|
123
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
124
|
+
@mixin style style=warning visibleWrapperClass=.visible-wrapper;
|
|
125
|
+
& .visible-wrapper {
|
|
126
|
+
color: var(--on-warning-active-color);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.type-enhanced.alert-type-caution {
|
|
131
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
132
|
+
@mixin style style=caution visibleWrapperClass=.visible-wrapper;
|
|
133
|
+
& .visible-wrapper {
|
|
134
|
+
color: var(--on-caution-active-color);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.type-enhanced.alert-type-level-critical {
|
|
139
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
140
|
+
@mixin style style=critical visibleWrapperClass=.visible-wrapper;
|
|
141
|
+
& .visible-wrapper {
|
|
142
|
+
color: var(--on-critical-active-color);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.type-enhanced.alert-type-level-high {
|
|
147
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
148
|
+
@mixin style style=alarm visibleWrapperClass=.visible-wrapper;
|
|
149
|
+
& .visible-wrapper {
|
|
150
|
+
color: var(--on-alarm-active-color);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.type-enhanced.alert-type-level-medium {
|
|
155
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
156
|
+
@mixin style style=warning visibleWrapperClass=.visible-wrapper;
|
|
157
|
+
& .visible-wrapper {
|
|
158
|
+
color: var(--on-warning-active-color);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.type-enhanced.alert-type-level-low {
|
|
163
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
164
|
+
@mixin style style=caution visibleWrapperClass=.visible-wrapper;
|
|
165
|
+
& .visible-wrapper {
|
|
166
|
+
color: var(--on-caution-active-color);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.type-enhanced.alert-type-level-diagnostic {
|
|
171
|
+
@mixin style style=normal visibleWrapperClass=.blink;
|
|
172
|
+
@mixin style style=notification visibleWrapperClass=.visible-wrapper;
|
|
173
|
+
& .visible-wrapper {
|
|
174
|
+
color: var(--on-notification-active-color);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.flash-fast {
|
|
179
|
+
& .visible-wrapper {
|
|
180
|
+
opacity: var(--flash-fast-on);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
& .blink {
|
|
184
|
+
opacity: var(--flash-fast-off);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.flash-slow {
|
|
189
|
+
& .visible-wrapper {
|
|
190
|
+
opacity: var(--flash-slow-on);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
& .blink {
|
|
194
|
+
opacity: var(--flash-slow-off);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.flash-very-slow {
|
|
199
|
+
& .visible-wrapper {
|
|
200
|
+
opacity: var(--flash-very-slow-on);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
& .blink {
|
|
204
|
+
opacity: var(--flash-very-slow-off);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.alert-type-alarm {
|
|
209
|
+
--icon-fill: var(--alarm-enabled-background-color);
|
|
210
|
+
--icon-stroke: var(--alarm-pressed-border-color);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.alert-type-warning {
|
|
214
|
+
--icon-fill: var(--warning-enabled-background-color);
|
|
215
|
+
--icon-stroke: var(--warning-pressed-border-color);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.alert-type-caution,
|
|
219
|
+
.alert-type-level-low {
|
|
220
|
+
--icon-fill: var(--caution-enabled-background-color);
|
|
221
|
+
--icon-stroke: var(--caution-pressed-border-color);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.alert-type-level-critical {
|
|
225
|
+
--icon-fill: var(--alert-critical-color);
|
|
226
|
+
--icon-stroke: var(--alert-critical-outline-color);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.alert-type-level-high {
|
|
230
|
+
--icon-fill: var(--alarm-enabled-background-color);
|
|
231
|
+
--icon-stroke: var(--alarm-pressed-border-color);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.alert-type-level-medium {
|
|
235
|
+
--icon-fill: var(--warning-enabled-background-color);
|
|
236
|
+
--icon-stroke: var(--warning-pressed-border-color);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.alert-type-level-diagnostic {
|
|
240
|
+
--icon-fill: var(--alert-diagnostic-color);
|
|
241
|
+
--icon-stroke: var(--alert-diagnostic-outline-color);
|
|
242
|
+
}
|