@oicl/openbridge-webcomponents 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.
Files changed (61) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +4717 -4485
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +510 -60
  4. package/dist/alert-severity.d.ts +19 -1
  5. package/dist/alert-severity.d.ts.map +1 -1
  6. package/dist/alert-severity.js +48 -2
  7. package/dist/alert-severity.js.map +1 -1
  8. package/dist/components/alert-button/alert-button.css.js +7 -1513
  9. package/dist/components/alert-button/alert-button.css.js.map +1 -1
  10. package/dist/components/alert-button/alert-button.d.ts +50 -86
  11. package/dist/components/alert-button/alert-button.d.ts.map +1 -1
  12. package/dist/components/alert-button/alert-button.js +40 -107
  13. package/dist/components/alert-button/alert-button.js.map +1 -1
  14. package/dist/components/alert-button-item/alert-button-item.css.js +1570 -0
  15. package/dist/components/alert-button-item/alert-button-item.css.js.map +1 -0
  16. package/dist/components/alert-button-item/alert-button-item.d.ts +162 -0
  17. package/dist/components/alert-button-item/alert-button-item.d.ts.map +1 -0
  18. package/dist/components/alert-button-item/alert-button-item.js +210 -0
  19. package/dist/components/alert-button-item/alert-button-item.js.map +1 -0
  20. package/dist/components/alert-counter-item/alert-counter-item.css.js +25 -0
  21. package/dist/components/alert-counter-item/alert-counter-item.css.js.map +1 -0
  22. package/dist/components/alert-counter-item/alert-counter-item.d.ts +77 -0
  23. package/dist/components/alert-counter-item/alert-counter-item.d.ts.map +1 -0
  24. package/dist/components/alert-counter-item/alert-counter-item.js +87 -0
  25. package/dist/components/alert-counter-item/alert-counter-item.js.map +1 -0
  26. package/dist/components/alert-frame/alert-frame.css.js +23 -27
  27. package/dist/components/alert-frame/alert-frame.css.js.map +1 -1
  28. package/dist/components/alert-frame/alert-frame.d.ts +7 -6
  29. package/dist/components/alert-frame/alert-frame.d.ts.map +1 -1
  30. package/dist/components/alert-frame/alert-frame.js +6 -9
  31. package/dist/components/alert-frame/alert-frame.js.map +1 -1
  32. package/dist/components/tree-navigation-item/tree-navigation-item.d.ts +7 -34
  33. package/dist/components/tree-navigation-item/tree-navigation-item.d.ts.map +1 -1
  34. package/dist/components/tree-navigation-item/tree-navigation-item.js +3 -32
  35. package/dist/components/tree-navigation-item/tree-navigation-item.js.map +1 -1
  36. package/dist/generated/locales/es-419.d.ts +11 -3
  37. package/dist/generated/locales/es-419.d.ts.map +1 -1
  38. package/dist/generated/locales/es-419.js +11 -3
  39. package/dist/generated/locales/es-419.js.map +1 -1
  40. package/dist/generated/locales/fi-FI.d.ts +8 -0
  41. package/dist/generated/locales/fi-FI.d.ts.map +1 -1
  42. package/dist/generated/locales/fi-FI.js +8 -0
  43. package/dist/generated/locales/fi-FI.js.map +1 -1
  44. package/dist/navigation-instruments/readout/readout.css.js +4 -29
  45. package/dist/navigation-instruments/readout/readout.css.js.map +1 -1
  46. package/dist/navigation-instruments/readout/readout.d.ts.map +1 -1
  47. package/dist/navigation-instruments/readout/readout.js +1 -9
  48. package/dist/navigation-instruments/readout/readout.js.map +1 -1
  49. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +5 -34
  50. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
  51. package/dist/navigation-instruments/readout-list-item/readout-list-item.d.ts.map +1 -1
  52. package/dist/navigation-instruments/readout-list-item/readout-list-item.js +1 -9
  53. package/dist/navigation-instruments/readout-list-item/readout-list-item.js.map +1 -1
  54. package/dist/palettes/blinking.d.ts +6 -2
  55. package/dist/palettes/blinking.d.ts.map +1 -1
  56. package/dist/palettes/blinking.js +6 -2
  57. package/dist/palettes/blinking.js.map +1 -1
  58. package/dist/types.d.ts +15 -0
  59. package/dist/types.d.ts.map +1 -1
  60. package/dist/types.js.map +1 -1
  61. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-button-item.css.js","sources":[],"sourcesContent":[],"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,162 @@
1
+ import { LitElement } from 'lit';
2
+ import { AlertType, FlashingSpeed, AlertCounts, ResolvedFlashingSpeed } from '../../types.js';
3
+ import { FlashingController } from '../../palettes/flashing-controller.js';
4
+ import '../../icons/icon-alerts.js';
5
+ import '../../icons/icon-alerts-active.js';
6
+ import '../../icons/icon-alerts-alarm-twotone.js';
7
+ import '../../icons/icon-alerts-warning-twotone.js';
8
+ import '../../icons/icon-alerts-caution-twotone.js';
9
+ import '../../manual-icon/icon-alerts-critical-twotone.js';
10
+ import '../../manual-icon/icon-alerts-diagnostic-twotone.js';
11
+ import '../alert-counter-item/alert-counter-item.js';
12
+ /**
13
+ * `ObcAlertButtonType` – Enum for alert button visual and behavioral variants.
14
+ *
15
+ * - `flat`: Minimal, icon-only button for compact spaces.
16
+ * - `normal`: Standard button with icon and optional counter.
17
+ * - `enhanced`: Emphasized button with additional styling for high-priority alerts.
18
+ */
19
+ export declare enum ObcAlertButtonType {
20
+ Flat = "flat",
21
+ Normal = "normal",
22
+ Enhanced = "enhanced"
23
+ }
24
+ /**
25
+ * `<obc-alert-button-item>` – The bell button that shows the alert state and count.
26
+ *
27
+ * Shows the alert status as a bell in the style of the given alert type, with
28
+ * an optional counter, or as a global counter: one badge per severity, then
29
+ * the bell and the total. `obc-alert-button` renders the item next to its
30
+ * silence button; use the item on its own where no silence button is needed.
31
+ *
32
+ * ---
33
+ *
34
+ * ### Features
35
+ * - **Variants (`type`):** `flat` (icon only), `normal` (bordered, icon and
36
+ * counter) and `enhanced` (filled in the severity colour).
37
+ * - **Alert types:** `alarm`, `warning`, `caution` and the `level-*` family;
38
+ * `nAlerts` of 0 shows the idle bell.
39
+ * - **Counter:** `counter` shows `nAlerts` next to the bell, except in `flat`.
40
+ * - **Global counter:** `globalCounter` shows the per-severity `counts` as
41
+ * badges, then the bell and `nAlerts`, always in the normal style.
42
+ * - **Flashing:** `blinking` flashes the bell at the tempo `flashingSpeed`
43
+ * resolves (#1224).
44
+ * - **Fill height:** `fillHeight` stretches the visible button to the host
45
+ * height, as the tall `obc-alert-button` does.
46
+ *
47
+ * ---
48
+ *
49
+ * ### Usage Guidelines
50
+ * - Keep `nAlerts` and `counts` consistent; the item shows both as given.
51
+ * - The generated label reads e.g. "Alerts, 12, 2 Alarm, 4 Warning,
52
+ * 6 Caution"; an `aria-label` on the host replaces it.
53
+ * - A native button, so Enter and Space activate it (APG button pattern).
54
+ * - A parent that joins another button to the item's end sets the
55
+ * `data-group-item-not-last` attribute on the host.
56
+ * - **TODO(designer):** the Figma file draws the flat item's hover, active and
57
+ * focused variants at 20 % opacity; the item uses the standard flat states.
58
+ * - **TODO(designer):** the Figma file defines no flashing for the global
59
+ * counter, so it never flashes.
60
+ *
61
+ * ---
62
+ *
63
+ * ### Example
64
+ *
65
+ * ```html
66
+ * <obc-alert-button-item alertType="alarm" nAlerts="3" counter blinking></obc-alert-button-item>
67
+ * <obc-alert-button-item
68
+ * globalCounter
69
+ * nAlerts="12"
70
+ * .counts=${{countAlarm: 2, countWarning: 4, countCaution: 6}}
71
+ * ></obc-alert-button-item>
72
+ * ```
73
+ *
74
+ * @property type - Visual variant: `flat` (icon only), `normal` (default, bordered with the counter) or `enhanced` (filled in the severity colour).
75
+ * @availableWhen type globalCounter==false
76
+ * @property alertType - Alert type that selects the icon and colours: `alarm`, `warning`, `caution` or a `level-*` severity.
77
+ * @availableWhen alertType globalCounter==false
78
+ * @property nAlerts - Number of active alerts; 0 shows the idle bell and hides the counter.
79
+ * @property counter - Shows `nAlerts` next to the bell (not in `flat`).
80
+ * @availableWhen counter globalCounter==false
81
+ * @property globalCounter - Shows the per-severity counts, the bell and the total instead of a single alert status.
82
+ * @property counts - Alert count per severity for the global counter badges.
83
+ * @availableWhen counts globalCounter==true
84
+ * @property shelvedCount - Number of shelved alerts, shown after the global counter badges.
85
+ * @availableWhen shelvedCount globalCounter==true
86
+ * @property blinking - Flashes the bell while there are active alerts of a flashing alert type.
87
+ * @availableWhen blinking globalCounter==false
88
+ * @property flashingSpeed - Flash tempo while `blinking` is on: `default` resolves from `alertType`, `fast`, `slow`, `very-slow` force a tempo, `fixed` never flashes.
89
+ * @availableWhen flashingSpeed blinking==true
90
+ * @property fillHeight - Stretches the visible button to the host height instead of the 32 px visual target.
91
+ * @property ariaLabel - Accessible name forwarded to the inner `<button>`, mapped to the `aria-label` attribute; replaces the generated label. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.
92
+ * @fires click - Fired when the button is clicked.
93
+ * @experimental
94
+ */
95
+ export declare class ObcAlertButtonItem extends LitElement {
96
+ /**
97
+ * Visual variant: `flat` (icon only), `normal` (default, bordered with the counter) or `enhanced` (filled in the severity colour).
98
+ *
99
+ * Available when `globalCounter==false`.
100
+ */
101
+ type: ObcAlertButtonType;
102
+ /**
103
+ * Alert type that selects the icon and colours: `alarm`, `warning`, `caution` or a `level-*` severity.
104
+ *
105
+ * Available when `globalCounter==false`.
106
+ */
107
+ alertType?: AlertType;
108
+ /** Number of active alerts; 0 shows the idle bell and hides the counter. */
109
+ nAlerts: number;
110
+ /**
111
+ * Shows `nAlerts` next to the bell (not in `flat`).
112
+ *
113
+ * Available when `globalCounter==false`.
114
+ */
115
+ counter: boolean;
116
+ /** Shows the per-severity counts, the bell and the total instead of a single alert status. */
117
+ globalCounter: boolean;
118
+ /**
119
+ * Alert count per severity for the global counter badges.
120
+ *
121
+ * Available when `globalCounter==true`.
122
+ */
123
+ counts: AlertCounts;
124
+ /**
125
+ * Number of shelved alerts, shown after the global counter badges.
126
+ *
127
+ * Available when `globalCounter==true`.
128
+ */
129
+ shelvedCount: number;
130
+ /**
131
+ * Flashes the bell while there are active alerts of a flashing alert type.
132
+ *
133
+ * Available when `globalCounter==false`.
134
+ */
135
+ blinking: boolean;
136
+ /**
137
+ * Flash tempo while `blinking` is on: `default` resolves from `alertType`, `fast`, `slow`, `very-slow` force a tempo, `fixed` never flashes.
138
+ *
139
+ * Available when `blinking==true`.
140
+ */
141
+ flashingSpeed: FlashingSpeed;
142
+ /** Stretches the visible button to the host height instead of the 32 px visual target. */
143
+ fillHeight: boolean;
144
+ /** Accessible name forwarded to the inner `<button>`, mapped to the `aria-label` attribute; replaces the generated label. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary. */
145
+ ariaLabel: string | null;
146
+ protected readonly flashing: FlashingController;
147
+ get resolvedFlashingSpeed(): ResolvedFlashingSpeed;
148
+ private get accessibleName();
149
+ private renderTwotoneIcon;
150
+ /** The blink layer shows the opposite of the steady layer in each flash. */
151
+ private renderIcon;
152
+ private renderCount;
153
+ private renderCounts;
154
+ render(): import('lit-html').TemplateResult<1>;
155
+ static styles: import('lit').CSSResult;
156
+ }
157
+ declare global {
158
+ interface HTMLElementTagNameMap {
159
+ 'obc-alert-button-item': ObcAlertButtonItem;
160
+ }
161
+ }
162
+ //# sourceMappingURL=alert-button-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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,YAAY;IAWX,MAAM;IAyCf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,kBAAkB,CAAC;KAC7C;CACF"}
@@ -0,0 +1,210 @@
1
+ import { unsafeCSS, LitElement, html, nothing } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+ import { localized, msg } from "@lit/localize";
5
+ import componentStyle from "./alert-button-item.css.js";
6
+ import { customElement } from "../../decorator.js";
7
+ import "../../icons/icon-alerts.js";
8
+ import "../../icons/icon-alerts-active.js";
9
+ import "../../icons/icon-alerts-alarm-twotone.js";
10
+ import "../../icons/icon-alerts-warning-twotone.js";
11
+ import "../../icons/icon-alerts-caution-twotone.js";
12
+ import "../../manual-icon/icon-alerts-critical-twotone.js";
13
+ import "../../manual-icon/icon-alerts-diagnostic-twotone.js";
14
+ import { ObcAlertCounterItemType } from "../alert-counter-item/alert-counter-item.js";
15
+ import { FlashingSpeed } from "../../types.js";
16
+ import { resolveFlashingSpeed, AlertFlashPhase, alertCountsLabel, alertTypeLabel, getAlertTwotoneComponent, AlertTwotoneComponent, rankAlertCounts } from "../../alert-severity.js";
17
+ import { FlashingController } from "../../palettes/flashing-controller.js";
18
+ var __defProp = Object.defineProperty;
19
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
20
+ var __decorateClass = (decorators, target, key, kind) => {
21
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
22
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
23
+ if (decorator = decorators[i])
24
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
25
+ if (kind && result) __defProp(target, key, result);
26
+ return result;
27
+ };
28
+ var ObcAlertButtonType = /* @__PURE__ */ ((ObcAlertButtonType2) => {
29
+ ObcAlertButtonType2["Flat"] = "flat";
30
+ ObcAlertButtonType2["Normal"] = "normal";
31
+ ObcAlertButtonType2["Enhanced"] = "enhanced";
32
+ return ObcAlertButtonType2;
33
+ })(ObcAlertButtonType || {});
34
+ let ObcAlertButtonItem = class extends LitElement {
35
+ constructor() {
36
+ super(...arguments);
37
+ this.type = "normal";
38
+ this.nAlerts = 0;
39
+ this.counter = false;
40
+ this.globalCounter = false;
41
+ this.counts = {};
42
+ this.shelvedCount = 0;
43
+ this.blinking = false;
44
+ this.flashingSpeed = FlashingSpeed.Default;
45
+ this.fillHeight = false;
46
+ this.ariaLabel = null;
47
+ this.flashing = new FlashingController(
48
+ this,
49
+ () => this.resolvedFlashingSpeed
50
+ );
51
+ }
52
+ get resolvedFlashingSpeed() {
53
+ if (this.globalCounter || !this.blinking || this.nAlerts <= 0 || this.alertType === void 0) {
54
+ return FlashingSpeed.Fixed;
55
+ }
56
+ return resolveFlashingSpeed(
57
+ this.flashingSpeed,
58
+ this.alertType,
59
+ AlertFlashPhase.Active
60
+ );
61
+ }
62
+ get accessibleName() {
63
+ if (this.ariaLabel) {
64
+ return this.ariaLabel;
65
+ }
66
+ const parts = [msg("Alerts")];
67
+ if (this.nAlerts > 0) {
68
+ parts.push(String(this.nAlerts));
69
+ }
70
+ if (this.globalCounter) {
71
+ const breakdown = alertCountsLabel(this.counts, this.shelvedCount);
72
+ if (breakdown) {
73
+ parts.push(breakdown);
74
+ }
75
+ } else if (this.nAlerts > 0 && this.alertType) {
76
+ parts.push(alertTypeLabel(this.alertType));
77
+ }
78
+ return parts.join(", ");
79
+ }
80
+ renderTwotoneIcon() {
81
+ const twotone = this.alertType ? getAlertTwotoneComponent(this.alertType) : AlertTwotoneComponent.Caution;
82
+ switch (twotone) {
83
+ case AlertTwotoneComponent.Critical:
84
+ return html`<obi-alerts-critical-twotone
85
+ useCssColor
86
+ class="icon"
87
+ ></obi-alerts-critical-twotone>`;
88
+ case AlertTwotoneComponent.Diagnostic:
89
+ return html`<obi-alerts-diagnostic-twotone
90
+ useCssColor
91
+ class="icon"
92
+ ></obi-alerts-diagnostic-twotone>`;
93
+ case AlertTwotoneComponent.Warning:
94
+ return html`<obi-alerts-warning-twotone
95
+ useCssColor
96
+ class="icon"
97
+ ></obi-alerts-warning-twotone>`;
98
+ case AlertTwotoneComponent.Caution:
99
+ return html`<obi-alerts-caution-twotone
100
+ useCssColor
101
+ class="icon"
102
+ ></obi-alerts-caution-twotone>`;
103
+ default:
104
+ return html`<obi-alerts-alarm-twotone
105
+ useCssColor
106
+ class="icon"
107
+ ></obi-alerts-alarm-twotone>`;
108
+ }
109
+ }
110
+ /** The blink layer shows the opposite of the steady layer in each flash. */
111
+ renderIcon(styleType, blinkLayer) {
112
+ if (this.nAlerts === 0) {
113
+ return html`<obi-alerts class="icon"></obi-alerts>`;
114
+ }
115
+ const enhanced = styleType === "enhanced";
116
+ if (blinkLayer) {
117
+ return enhanced ? this.renderTwotoneIcon() : html`<obi-alerts class="icon"></obi-alerts>`;
118
+ }
119
+ return enhanced || this.globalCounter ? html`<obi-alerts-active class="icon"></obi-alerts-active>` : this.renderTwotoneIcon();
120
+ }
121
+ renderCount() {
122
+ return html`<span class="count">${this.nAlerts}</span>`;
123
+ }
124
+ renderCounts() {
125
+ if (rankAlertCounts(this.counts).length === 0 && this.shelvedCount <= 0) {
126
+ return nothing;
127
+ }
128
+ return html`<obc-alert-counter-item
129
+ .type=${ObcAlertCounterItemType.Badges}
130
+ .counts=${this.counts}
131
+ .shelvedCount=${this.shelvedCount}
132
+ ></obc-alert-counter-item>`;
133
+ }
134
+ render() {
135
+ const styleType = this.globalCounter ? "normal" : this.type;
136
+ const showCount = this.nAlerts > 0 && (this.globalCounter || this.counter && styleType !== "flat");
137
+ const tempo = this.resolvedFlashingSpeed;
138
+ return html`
139
+ <button
140
+ class=${classMap({
141
+ "alert-button": true,
142
+ [`type-${styleType}`]: true,
143
+ [`alert-type-${this.alertType ?? "none"}`]: true,
144
+ counter: showCount && !this.globalCounter,
145
+ "global-counter": this.globalCounter,
146
+ "fill-height": this.fillHeight,
147
+ [`flash-${tempo}`]: true
148
+ })}
149
+ aria-label=${this.accessibleName}
150
+ >
151
+ ${tempo === FlashingSpeed.Fixed ? nothing : html`<div class="blink" aria-hidden="true">
152
+ <div class="content">
153
+ ${this.renderIcon(styleType, true)}
154
+ ${showCount ? this.renderCount() : nothing}
155
+ </div>
156
+ </div>`}
157
+ <div class="visible-wrapper">
158
+ ${this.globalCounter ? this.renderCounts() : nothing}
159
+ <div class="content">
160
+ ${this.renderIcon(styleType, false)}
161
+ ${showCount ? this.renderCount() : nothing}
162
+ </div>
163
+ </div>
164
+ </button>
165
+ `;
166
+ }
167
+ };
168
+ ObcAlertButtonItem.styles = unsafeCSS(componentStyle);
169
+ __decorateClass([
170
+ property({ type: String })
171
+ ], ObcAlertButtonItem.prototype, "type", 2);
172
+ __decorateClass([
173
+ property({ type: String })
174
+ ], ObcAlertButtonItem.prototype, "alertType", 2);
175
+ __decorateClass([
176
+ property({ type: Number })
177
+ ], ObcAlertButtonItem.prototype, "nAlerts", 2);
178
+ __decorateClass([
179
+ property({ type: Boolean })
180
+ ], ObcAlertButtonItem.prototype, "counter", 2);
181
+ __decorateClass([
182
+ property({ type: Boolean })
183
+ ], ObcAlertButtonItem.prototype, "globalCounter", 2);
184
+ __decorateClass([
185
+ property({ type: Object, attribute: false })
186
+ ], ObcAlertButtonItem.prototype, "counts", 2);
187
+ __decorateClass([
188
+ property({ type: Number })
189
+ ], ObcAlertButtonItem.prototype, "shelvedCount", 2);
190
+ __decorateClass([
191
+ property({ type: Boolean })
192
+ ], ObcAlertButtonItem.prototype, "blinking", 2);
193
+ __decorateClass([
194
+ property({ type: String })
195
+ ], ObcAlertButtonItem.prototype, "flashingSpeed", 2);
196
+ __decorateClass([
197
+ property({ type: Boolean })
198
+ ], ObcAlertButtonItem.prototype, "fillHeight", 2);
199
+ __decorateClass([
200
+ property({ type: String, attribute: "aria-label" })
201
+ ], ObcAlertButtonItem.prototype, "ariaLabel", 2);
202
+ ObcAlertButtonItem = __decorateClass([
203
+ customElement("obc-alert-button-item"),
204
+ localized()
205
+ ], ObcAlertButtonItem);
206
+ export {
207
+ ObcAlertButtonItem,
208
+ ObcAlertButtonType
209
+ };
210
+ //# sourceMappingURL=alert-button-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-button-item.js","sources":["../../../src/components/alert-button-item/alert-button-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {localized, msg} from '@lit/localize';\nimport componentStyle from './alert-button-item.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../../icons/icon-alerts.js';\nimport '../../icons/icon-alerts-active.js';\nimport '../../icons/icon-alerts-alarm-twotone.js';\nimport '../../icons/icon-alerts-warning-twotone.js';\nimport '../../icons/icon-alerts-caution-twotone.js';\nimport '../../manual-icon/icon-alerts-critical-twotone.js';\nimport '../../manual-icon/icon-alerts-diagnostic-twotone.js';\nimport '../alert-counter-item/alert-counter-item.js';\nimport {ObcAlertCounterItemType} from '../alert-counter-item/alert-counter-item.js';\nimport {\n AlertType,\n FlashingSpeed,\n type AlertCounts,\n type ResolvedFlashingSpeed,\n} from '../../types.js';\nimport {\n AlertFlashPhase,\n AlertTwotoneComponent,\n alertCountsLabel,\n alertTypeLabel,\n getAlertTwotoneComponent,\n rankAlertCounts,\n resolveFlashingSpeed,\n} from '../../alert-severity.js';\nimport {FlashingController} from '../../palettes/flashing-controller.js';\n\n/**\n * `ObcAlertButtonType` – Enum for alert button visual and behavioral variants.\n *\n * - `flat`: Minimal, icon-only button for compact spaces.\n * - `normal`: Standard button with icon and optional counter.\n * - `enhanced`: Emphasized button with additional styling for high-priority alerts.\n */\nexport enum ObcAlertButtonType {\n Flat = 'flat',\n Normal = 'normal',\n Enhanced = 'enhanced',\n}\n\n/**\n * `<obc-alert-button-item>` – The bell button that shows the alert state and count.\n *\n * Shows the alert status as a bell in the style of the given alert type, with\n * an optional counter, or as a global counter: one badge per severity, then\n * the bell and the total. `obc-alert-button` renders the item next to its\n * silence button; use the item on its own where no silence button is needed.\n *\n * ---\n *\n * ### Features\n * - **Variants (`type`):** `flat` (icon only), `normal` (bordered, icon and\n * counter) and `enhanced` (filled in the severity colour).\n * - **Alert types:** `alarm`, `warning`, `caution` and the `level-*` family;\n * `nAlerts` of 0 shows the idle bell.\n * - **Counter:** `counter` shows `nAlerts` next to the bell, except in `flat`.\n * - **Global counter:** `globalCounter` shows the per-severity `counts` as\n * badges, then the bell and `nAlerts`, always in the normal style.\n * - **Flashing:** `blinking` flashes the bell at the tempo `flashingSpeed`\n * resolves (#1224).\n * - **Fill height:** `fillHeight` stretches the visible button to the host\n * height, as the tall `obc-alert-button` does.\n *\n * ---\n *\n * ### Usage Guidelines\n * - Keep `nAlerts` and `counts` consistent; the item shows both as given.\n * - The generated label reads e.g. \"Alerts, 12, 2 Alarm, 4 Warning,\n * 6 Caution\"; an `aria-label` on the host replaces it.\n * - A native button, so Enter and Space activate it (APG button pattern).\n * - A parent that joins another button to the item's end sets the\n * `data-group-item-not-last` attribute on the host.\n * - **TODO(designer):** the Figma file draws the flat item's hover, active and\n * focused variants at 20 % opacity; the item uses the standard flat states.\n * - **TODO(designer):** the Figma file defines no flashing for the global\n * counter, so it never flashes.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-alert-button-item alertType=\"alarm\" nAlerts=\"3\" counter blinking></obc-alert-button-item>\n * <obc-alert-button-item\n * globalCounter\n * nAlerts=\"12\"\n * .counts=${{countAlarm: 2, countWarning: 4, countCaution: 6}}\n * ></obc-alert-button-item>\n * ```\n *\n * @property type - Visual variant: `flat` (icon only), `normal` (default, bordered with the counter) or `enhanced` (filled in the severity colour).\n * @availableWhen type globalCounter==false\n * @property alertType - Alert type that selects the icon and colours: `alarm`, `warning`, `caution` or a `level-*` severity.\n * @availableWhen alertType globalCounter==false\n * @property nAlerts - Number of active alerts; 0 shows the idle bell and hides the counter.\n * @property counter - Shows `nAlerts` next to the bell (not in `flat`).\n * @availableWhen counter globalCounter==false\n * @property globalCounter - Shows the per-severity counts, the bell and the total instead of a single alert status.\n * @property counts - Alert count per severity for the global counter badges.\n * @availableWhen counts globalCounter==true\n * @property shelvedCount - Number of shelved alerts, shown after the global counter badges.\n * @availableWhen shelvedCount globalCounter==true\n * @property blinking - Flashes the bell while there are active alerts of a flashing alert type.\n * @availableWhen blinking globalCounter==false\n * @property flashingSpeed - Flash tempo while `blinking` is on: `default` resolves from `alertType`, `fast`, `slow`, `very-slow` force a tempo, `fixed` never flashes.\n * @availableWhen flashingSpeed blinking==true\n * @property fillHeight - Stretches the visible button to the host height instead of the 32 px visual target.\n * @property ariaLabel - Accessible name forwarded to the inner `<button>`, mapped to the `aria-label` attribute; replaces the generated label. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.\n * @fires click - Fired when the button is clicked.\n * @experimental\n */\n@customElement('obc-alert-button-item')\n@localized()\nexport class ObcAlertButtonItem extends LitElement {\n @property({type: String}) type: ObcAlertButtonType =\n ObcAlertButtonType.Normal;\n @property({type: String}) alertType?: AlertType;\n @property({type: Number}) nAlerts = 0;\n @property({type: Boolean}) counter = false;\n @property({type: Boolean}) globalCounter = false;\n @property({type: Object, attribute: false}) counts: AlertCounts = {};\n @property({type: Number}) shelvedCount = 0;\n @property({type: Boolean}) blinking = false;\n @property({type: String}) flashingSpeed: FlashingSpeed =\n FlashingSpeed.Default;\n @property({type: Boolean}) fillHeight = false;\n\n // Reactive so a consumer changing the name re-renders the shadow button.\n @property({type: String, attribute: 'aria-label'})\n override ariaLabel: string | null = null;\n\n protected readonly flashing = new FlashingController(\n this,\n () => this.resolvedFlashingSpeed\n );\n\n get resolvedFlashingSpeed(): ResolvedFlashingSpeed {\n if (\n this.globalCounter ||\n !this.blinking ||\n this.nAlerts <= 0 ||\n this.alertType === undefined\n ) {\n return FlashingSpeed.Fixed;\n }\n return resolveFlashingSpeed(\n this.flashingSpeed,\n this.alertType,\n AlertFlashPhase.Active\n );\n }\n\n private get accessibleName(): string {\n if (this.ariaLabel) {\n return this.ariaLabel;\n }\n const parts = [msg('Alerts')];\n if (this.nAlerts > 0) {\n parts.push(String(this.nAlerts));\n }\n if (this.globalCounter) {\n const breakdown = alertCountsLabel(this.counts, this.shelvedCount);\n if (breakdown) {\n parts.push(breakdown);\n }\n } else if (this.nAlerts > 0 && this.alertType) {\n parts.push(alertTypeLabel(this.alertType));\n }\n return parts.join(', ');\n }\n\n private renderTwotoneIcon() {\n const twotone = this.alertType\n ? getAlertTwotoneComponent(this.alertType)\n : AlertTwotoneComponent.Caution;\n switch (twotone) {\n case AlertTwotoneComponent.Critical:\n return html`<obi-alerts-critical-twotone\n useCssColor\n class=\"icon\"\n ></obi-alerts-critical-twotone>`;\n case AlertTwotoneComponent.Diagnostic:\n return html`<obi-alerts-diagnostic-twotone\n useCssColor\n class=\"icon\"\n ></obi-alerts-diagnostic-twotone>`;\n case AlertTwotoneComponent.Warning:\n return html`<obi-alerts-warning-twotone\n useCssColor\n class=\"icon\"\n ></obi-alerts-warning-twotone>`;\n case AlertTwotoneComponent.Caution:\n return html`<obi-alerts-caution-twotone\n useCssColor\n class=\"icon\"\n ></obi-alerts-caution-twotone>`;\n default:\n return html`<obi-alerts-alarm-twotone\n useCssColor\n class=\"icon\"\n ></obi-alerts-alarm-twotone>`;\n }\n }\n\n /** The blink layer shows the opposite of the steady layer in each flash. */\n private renderIcon(styleType: ObcAlertButtonType, blinkLayer: boolean) {\n if (this.nAlerts === 0) {\n return html`<obi-alerts class=\"icon\"></obi-alerts>`;\n }\n const enhanced = styleType === ObcAlertButtonType.Enhanced;\n if (blinkLayer) {\n return enhanced\n ? this.renderTwotoneIcon()\n : html`<obi-alerts class=\"icon\"></obi-alerts>`;\n }\n return enhanced || this.globalCounter\n ? html`<obi-alerts-active class=\"icon\"></obi-alerts-active>`\n : this.renderTwotoneIcon();\n }\n\n private renderCount() {\n return html`<span class=\"count\">${this.nAlerts}</span>`;\n }\n\n private renderCounts() {\n if (rankAlertCounts(this.counts).length === 0 && this.shelvedCount <= 0) {\n return nothing;\n }\n return html`<obc-alert-counter-item\n .type=${ObcAlertCounterItemType.Badges}\n .counts=${this.counts}\n .shelvedCount=${this.shelvedCount}\n ></obc-alert-counter-item>`;\n }\n\n override render() {\n const styleType = this.globalCounter\n ? ObcAlertButtonType.Normal\n : this.type;\n const showCount =\n this.nAlerts > 0 &&\n (this.globalCounter ||\n (this.counter && styleType !== ObcAlertButtonType.Flat));\n const tempo = this.resolvedFlashingSpeed;\n return html`\n <button\n class=${classMap({\n 'alert-button': true,\n [`type-${styleType}`]: true,\n [`alert-type-${this.alertType ?? 'none'}`]: true,\n counter: showCount && !this.globalCounter,\n 'global-counter': this.globalCounter,\n 'fill-height': this.fillHeight,\n [`flash-${tempo}`]: true,\n })}\n aria-label=${this.accessibleName}\n >\n ${tempo === FlashingSpeed.Fixed\n ? nothing\n : html`<div class=\"blink\" aria-hidden=\"true\">\n <div class=\"content\">\n ${this.renderIcon(styleType, true)}\n ${showCount ? this.renderCount() : nothing}\n </div>\n </div>`}\n <div class=\"visible-wrapper\">\n ${this.globalCounter ? this.renderCounts() : nothing}\n <div class=\"content\">\n ${this.renderIcon(styleType, false)}\n ${showCount ? this.renderCount() : nothing}\n </div>\n </div>\n </button>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-button-item': ObcAlertButtonItem;\n }\n}\n"],"names":["ObcAlertButtonType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCO,IAAK,uCAAAA,wBAAL;AACLA,sBAAA,MAAA,IAAO;AACPA,sBAAA,QAAA,IAAS;AACTA,sBAAA,UAAA,IAAW;AAHD,SAAAA;AAAA,GAAA,sBAAA,CAAA,CAAA;AA+EL,IAAM,qBAAN,cAAiC,WAAW;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,OACxB;AAEwB,SAAA,UAAU;AACT,SAAA,UA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C,MAAM,QAAQ,WAAW,cAAa;AAAA,GAftC,mBAgBF,WAAA,aAAA,CAAA;AAhBE,qBAAN,gBAAA;AAAA,EAFN,cAAc,uBAAuB;AAAA,EACrC,UAAA;AAAU,GACE,kBAAA;"}
@@ -0,0 +1,25 @@
1
+ import { css } from "lit";
2
+ const componentStyle = css`* {
3
+ -webkit-tap-highlight-color: transparent;
4
+ }
5
+
6
+ :host {
7
+ display: inline-block;
8
+ }
9
+
10
+ .row {
11
+ display: flex;
12
+ align-items: center;
13
+ gap: var(--app-components-alert-counter-item-badge-spacing);
14
+ }
15
+
16
+ obi-alerts-shelf {
17
+ display: block; /* fills the badge icon box that sizes the badge-icon slot */
18
+ width: 100%;
19
+ height: 100%;
20
+ }
21
+ `;
22
+ export {
23
+ componentStyle as default
24
+ };
25
+ //# sourceMappingURL=alert-counter-item.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-counter-item.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,77 @@
1
+ import { LitElement, nothing } from 'lit';
2
+ import { AlertCounts } from '../../types.js';
3
+ import '../badge/badge.js';
4
+ import '../../icons/icon-alerts-shelf.js';
5
+ /**
6
+ * `ObcAlertCounterItemType` – How each count is drawn (Figma `Type`).
7
+ *
8
+ * - `badges`: filled badges in the severity colour (Figma Badges counter).
9
+ * - `alert-level`: flat badges with the severity glyph (Figma Alert level counter).
10
+ */
11
+ export declare enum ObcAlertCounterItemType {
12
+ Badges = "badges",
13
+ AlertLevel = "alert-level"
14
+ }
15
+ /**
16
+ * `<obc-alert-counter-item>` – A row of alert counts, one badge per severity.
17
+ *
18
+ * Renders a large `obc-badge` for every severity with a count above zero, most
19
+ * severe first, followed by an optional shelved count. Nothing renders when
20
+ * nothing is counted.
21
+ *
22
+ * ---
23
+ *
24
+ * ### Features
25
+ * - **Two types:** `badges` draws filled badges in the severity colour;
26
+ * `alert-level` draws flat badges with the severity glyph.
27
+ * - **Every severity:** `counts` takes the whole `AlertType` vocabulary,
28
+ * including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.
29
+ * - **Shelved count:** `shelvedCount` adds a neutral badge at the end, with
30
+ * the shelf icon in `alert-level`.
31
+ * - **Accessible summary:** the row is announced as one image labelled with
32
+ * the counts, e.g. "2 Alarm, 4 Warning, 6 Caution".
33
+ *
34
+ * ---
35
+ *
36
+ * ### Usage Guidelines
37
+ * - Show how many alerts are outstanding per severity in a compact space;
38
+ * `obc-alert-button-item` nests the counter for its global counter.
39
+ * - Pass the counts as one object: `.counts=${{countAlarm: 2, countWarning: 4}}`.
40
+ * - The counter is display-only: it renders no button and fires no events.
41
+ * - For a framed per-subsystem summary with a label, see
42
+ * `obc-alert-subsystem-counter`.
43
+ * - **TODO(designer):** the Figma component also has an Unacked counter type;
44
+ * how its icons map to counts is not defined yet.
45
+ *
46
+ * ---
47
+ *
48
+ * ### Example
49
+ *
50
+ * ```html
51
+ * <obc-alert-counter-item
52
+ * .counts=${{countAlarm: 2, countWarning: 4, countCaution: 6}}
53
+ * shelvedCount="9"
54
+ * ></obc-alert-counter-item>
55
+ * ```
56
+ *
57
+ * @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).
58
+ * @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.
59
+ * @property shelvedCount - Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero.
60
+ * @experimental
61
+ */
62
+ export declare class ObcAlertCounterItem extends LitElement {
63
+ /** How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph). */
64
+ type: ObcAlertCounterItemType;
65
+ /** Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown. */
66
+ counts: AlertCounts;
67
+ /** Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero. */
68
+ shelvedCount: number;
69
+ render(): import('lit-html').TemplateResult<1> | typeof nothing;
70
+ static styles: import('lit').CSSResult;
71
+ }
72
+ declare global {
73
+ interface HTMLElementTagNameMap {
74
+ 'obc-alert-counter-item': ObcAlertCounterItem;
75
+ }
76
+ }
77
+ //# sourceMappingURL=alert-counter-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-counter-item.d.ts","sourceRoot":"","sources":["../../../src/components/alert-counter-item/alert-counter-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAQ,OAAO,EAAY,MAAM,KAAK,CAAC;AAMzD,OAAO,mBAAmB,CAAC;AAE3B,OAAO,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAGhD;;;;;GAKG;AACH,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,UAAU,gBAAgB;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAEa,mBAAoB,SAAQ,UAAU;IACvB,IAAI,EAAE,uBAAuB,CACtB;IACW,MAAM,EAAE,WAAW,CAAM;IAC3C,YAAY,SAAK;IAElC,MAAM;IA0Cf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,mBAAmB,CAAC;KAC/C;CACF"}
@@ -0,0 +1,87 @@
1
+ import { unsafeCSS, LitElement, nothing, html } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { repeat } from "lit/directives/repeat.js";
4
+ import { localized } from "@lit/localize";
5
+ import componentStyle from "./alert-counter-item.css.js";
6
+ import { customElement } from "../../decorator.js";
7
+ import { BadgeVariant, BadgeSize, BadgeType } from "../badge/badge.js";
8
+ import "../../icons/icon-alerts-shelf.js";
9
+ import { rankAlertCounts, alertCountsLabel } from "../../alert-severity.js";
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __decorateClass = (decorators, target, key, kind) => {
13
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
+ if (decorator = decorators[i])
16
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
+ if (kind && result) __defProp(target, key, result);
18
+ return result;
19
+ };
20
+ var ObcAlertCounterItemType = /* @__PURE__ */ ((ObcAlertCounterItemType2) => {
21
+ ObcAlertCounterItemType2["Badges"] = "badges";
22
+ ObcAlertCounterItemType2["AlertLevel"] = "alert-level";
23
+ return ObcAlertCounterItemType2;
24
+ })(ObcAlertCounterItemType || {});
25
+ let ObcAlertCounterItem = class extends LitElement {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.type = "badges";
29
+ this.counts = {};
30
+ this.shelvedCount = 0;
31
+ }
32
+ render() {
33
+ const ranked = rankAlertCounts(this.counts);
34
+ if (ranked.length === 0 && this.shelvedCount <= 0) {
35
+ return nothing;
36
+ }
37
+ const alertLevel = this.type === "alert-level";
38
+ const variant = alertLevel ? BadgeVariant.flat : BadgeVariant.default;
39
+ return html`
40
+ <div
41
+ class="row"
42
+ role="img"
43
+ aria-label=${alertCountsLabel(this.counts, this.shelvedCount)}
44
+ >
45
+ ${repeat(
46
+ ranked,
47
+ (entry) => entry.type,
48
+ (entry) => html`<obc-badge
49
+ size=${BadgeSize.large}
50
+ type=${entry.type}
51
+ .variant=${variant}
52
+ .showIcon=${alertLevel}
53
+ .number=${entry.count}
54
+ ></obc-badge>`
55
+ )}
56
+ ${this.shelvedCount > 0 ? html`<obc-badge
57
+ size=${BadgeSize.large}
58
+ type=${BadgeType.regular}
59
+ .variant=${variant}
60
+ .showIcon=${alertLevel}
61
+ .number=${this.shelvedCount}
62
+ >
63
+ ${alertLevel ? html`<obi-alerts-shelf slot="badge-icon"></obi-alerts-shelf>` : nothing}
64
+ </obc-badge>` : nothing}
65
+ </div>
66
+ `;
67
+ }
68
+ };
69
+ ObcAlertCounterItem.styles = unsafeCSS(componentStyle);
70
+ __decorateClass([
71
+ property({ type: String })
72
+ ], ObcAlertCounterItem.prototype, "type", 2);
73
+ __decorateClass([
74
+ property({ type: Object, attribute: false })
75
+ ], ObcAlertCounterItem.prototype, "counts", 2);
76
+ __decorateClass([
77
+ property({ type: Number })
78
+ ], ObcAlertCounterItem.prototype, "shelvedCount", 2);
79
+ ObcAlertCounterItem = __decorateClass([
80
+ customElement("obc-alert-counter-item"),
81
+ localized()
82
+ ], ObcAlertCounterItem);
83
+ export {
84
+ ObcAlertCounterItem,
85
+ ObcAlertCounterItemType
86
+ };
87
+ //# sourceMappingURL=alert-counter-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-counter-item.js","sources":["../../../src/components/alert-counter-item/alert-counter-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {repeat} from 'lit/directives/repeat.js';\nimport {localized} from '@lit/localize';\nimport componentStyle from './alert-counter-item.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../badge/badge.js';\nimport {BadgeSize, BadgeType, BadgeVariant} from '../badge/badge.js';\nimport '../../icons/icon-alerts-shelf.js';\nimport type {AlertCounts} from '../../types.js';\nimport {alertCountsLabel, rankAlertCounts} from '../../alert-severity.js';\n\n/**\n * `ObcAlertCounterItemType` – How each count is drawn (Figma `Type`).\n *\n * - `badges`: filled badges in the severity colour (Figma Badges counter).\n * - `alert-level`: flat badges with the severity glyph (Figma Alert level counter).\n */\nexport enum ObcAlertCounterItemType {\n Badges = 'badges',\n AlertLevel = 'alert-level',\n}\n\n/**\n * `<obc-alert-counter-item>` – A row of alert counts, one badge per severity.\n *\n * Renders a large `obc-badge` for every severity with a count above zero, most\n * severe first, followed by an optional shelved count. Nothing renders when\n * nothing is counted.\n *\n * ---\n *\n * ### Features\n * - **Two types:** `badges` draws filled badges in the severity colour;\n * `alert-level` draws flat badges with the severity glyph.\n * - **Every severity:** `counts` takes the whole `AlertType` vocabulary,\n * including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.\n * - **Shelved count:** `shelvedCount` adds a neutral badge at the end, with\n * the shelf icon in `alert-level`.\n * - **Accessible summary:** the row is announced as one image labelled with\n * the counts, e.g. \"2 Alarm, 4 Warning, 6 Caution\".\n *\n * ---\n *\n * ### Usage Guidelines\n * - Show how many alerts are outstanding per severity in a compact space;\n * `obc-alert-button-item` nests the counter for its global counter.\n * - Pass the counts as one object: `.counts=${{countAlarm: 2, countWarning: 4}}`.\n * - The counter is display-only: it renders no button and fires no events.\n * - For a framed per-subsystem summary with a label, see\n * `obc-alert-subsystem-counter`.\n * - **TODO(designer):** the Figma component also has an Unacked counter type;\n * how its icons map to counts is not defined yet.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-alert-counter-item\n * .counts=${{countAlarm: 2, countWarning: 4, countCaution: 6}}\n * shelvedCount=\"9\"\n * ></obc-alert-counter-item>\n * ```\n *\n * @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).\n * @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.\n * @property shelvedCount - Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero.\n * @experimental\n */\n@customElement('obc-alert-counter-item')\n@localized()\nexport class ObcAlertCounterItem extends LitElement {\n @property({type: String}) type: ObcAlertCounterItemType =\n ObcAlertCounterItemType.Badges;\n @property({type: Object, attribute: false}) counts: AlertCounts = {};\n @property({type: Number}) shelvedCount = 0;\n\n override render() {\n const ranked = rankAlertCounts(this.counts);\n if (ranked.length === 0 && this.shelvedCount <= 0) {\n return nothing;\n }\n const alertLevel = this.type === ObcAlertCounterItemType.AlertLevel;\n const variant = alertLevel ? BadgeVariant.flat : BadgeVariant.default;\n return html`\n <div\n class=\"row\"\n role=\"img\"\n aria-label=${alertCountsLabel(this.counts, this.shelvedCount)}\n >\n ${repeat(\n ranked,\n (entry) => entry.type,\n (entry) =>\n html`<obc-badge\n size=${BadgeSize.large}\n type=${entry.type}\n .variant=${variant}\n .showIcon=${alertLevel}\n .number=${entry.count}\n ></obc-badge>`\n )}\n ${this.shelvedCount > 0\n ? html`<obc-badge\n size=${BadgeSize.large}\n type=${BadgeType.regular}\n .variant=${variant}\n .showIcon=${alertLevel}\n .number=${this.shelvedCount}\n >\n ${alertLevel\n ? html`<obi-alerts-shelf slot=\"badge-icon\"></obi-alerts-shelf>`\n : nothing}\n </obc-badge>`\n : nothing}\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-counter-item': ObcAlertCounterItem;\n }\n}\n"],"names":["ObcAlertCounterItemType"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,IAAK,4CAAAA,6BAAL;AACLA,2BAAA,QAAA,IAAS;AACTA,2BAAA,YAAA,IAAa;AAFH,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAsDL,IAAM,sBAAN,cAAkC,WAAW;AAAA,EAA7C,cAAA;AAAA,UAAA,GAAA,SAAA;AACqB,SAAA,OACxB;AAC0C,SAAA,SAAsB,CAAA;AACxC,SAAA,eAAe;AAAA,EAAA;AAAA,EAEhC,SAAS;AAChB,UAAM,SAAS,gBAAgB,KAAK,MAAM;AAC1C,QAAI,OAAO,WAAW,KAAK,KAAK,gBAAgB,GAAG;AACjD,aAAO;AAAA,IACT;AACA,UAAM,aAAa,KAAK,SAAS;AACjC,UAAM,UAAU,aAAa,aAAa,OAAO,aAAa;AAC9D,WAAO;AAAA;AAAA;AAAA;AAAA,qBAIU,iBAAiB,KAAK,QAAQ,KAAK,YAAY,CAAC;AAAA;AAAA,UAE3D;AAAA,MACA;AAAA,MACA,CAAC,UAAU,MAAM;AAAA,MACjB,CAAC,UACC;AAAA,qBACS,UAAU,KAAK;AAAA,qBACf,MAAM,IAAI;AAAA,yBACN,OAAO;AAAA,0BACN,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