@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.2 → 2.2.0-next.4
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 +60 -46
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +39 -7
- package/dist/components/alert-button/alert-button.d.ts +7 -2
- package/dist/components/alert-button/alert-button.d.ts.map +1 -1
- package/dist/components/alert-button/alert-button.js +5 -1
- package/dist/components/alert-button/alert-button.js.map +1 -1
- package/dist/components/alert-button-item/alert-button-item.d.ts +7 -1
- package/dist/components/alert-button-item/alert-button-item.d.ts.map +1 -1
- package/dist/components/alert-button-item/alert-button-item.js +3 -1
- package/dist/components/alert-button-item/alert-button-item.js.map +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.css.js +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.css.js.map +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.d.ts +8 -5
- package/dist/components/alert-counter-item/alert-counter-item.d.ts.map +1 -1
- package/dist/components/alert-counter-item/alert-counter-item.js +3 -5
- package/dist/components/alert-counter-item/alert-counter-item.js.map +1 -1
- package/dist/components/badge/badge.css.js +11 -0
- package/dist/components/badge/badge.css.js.map +1 -1
- package/package.json +1 -1
- package/src/components/alert-button/alert-button.spec.ts +12 -6
- package/src/components/alert-button/alert-button.stories.ts +32 -1
- package/src/components/alert-button/alert-button.ts +8 -2
- package/src/components/alert-button-item/alert-button-item.spec.ts +30 -1
- package/src/components/alert-button-item/alert-button-item.stories.ts +28 -0
- package/src/components/alert-button-item/alert-button-item.ts +7 -2
- package/src/components/alert-counter-item/alert-counter-item.css +1 -1
- package/src/components/alert-counter-item/alert-counter-item.spec.ts +32 -6
- package/src/components/alert-counter-item/alert-counter-item.ts +9 -12
- package/src/components/badge/badge.css +10 -0
package/custom-elements.json
CHANGED
|
@@ -3790,7 +3790,7 @@
|
|
|
3790
3790
|
{
|
|
3791
3791
|
"kind": "variable",
|
|
3792
3792
|
"name": "ObcAlertButtonItem",
|
|
3793
|
-
"default": "class ObcAlertButtonItem extends LitElement { constructor(..._args) { super(..._args); this.type = \"normal\"; this.nAlerts = 0; this.counter = false; this.globalCounter = false; this.counts = {}; this.shelvedCount = 0; this.blinking = false; this.flashingSpeed = FlashingSpeed.Default; this.fillHeight = false; this.ariaLabel = null; this.flashing = new FlashingController(this, () => this.resolvedFlashingSpeed); } get resolvedFlashingSpeed() { if (this.globalCounter || !this.blinking || this.nAlerts <= 0 || this.alertType === void 0) return FlashingSpeed.Fixed; return resolveFlashingSpeed(this.flashingSpeed, this.alertType, AlertFlashPhase.Active); } get accessibleName() { if (this.ariaLabel) return this.ariaLabel; const parts = [msg(\"Alerts\")]; if (this.nAlerts > 0) parts.push(String(this.nAlerts)); if (this.globalCounter) { const breakdown = alertCountsLabel(this.counts, this.shelvedCount); if (breakdown) parts.push(breakdown); } else if (this.nAlerts > 0 && this.alertType) parts.push(alertTypeLabel(this.alertType)); return parts.join(\", \"); } renderTwotoneIcon() { switch (this.alertType ? getAlertTwotoneComponent(this.alertType) : AlertTwotoneComponent.Caution) { case AlertTwotoneComponent.Critical: return html`<obi-alerts-critical-twotone useCssColor class=\"icon\" ></obi-alerts-critical-twotone>`; case AlertTwotoneComponent.Diagnostic: return html`<obi-alerts-diagnostic-twotone useCssColor class=\"icon\" ></obi-alerts-diagnostic-twotone>`; case AlertTwotoneComponent.Warning: return html`<obi-alerts-warning-twotone useCssColor class=\"icon\" ></obi-alerts-warning-twotone>`; case AlertTwotoneComponent.Caution: return html`<obi-alerts-caution-twotone useCssColor class=\"icon\" ></obi-alerts-caution-twotone>`; default: return html`<obi-alerts-alarm-twotone useCssColor class=\"icon\" ></obi-alerts-alarm-twotone>`; } } /** The blink layer shows the opposite of the steady layer in each flash. */ renderIcon(styleType, blinkLayer) { if (this.nAlerts === 0) return html`<obi-alerts class=\"icon\"></obi-alerts>`; const enhanced = styleType === \"enhanced\"; if (blinkLayer) return enhanced ? this.renderTwotoneIcon() : html`<obi-alerts class=\"icon\"></obi-alerts>`; return enhanced || this.globalCounter ? html`<obi-alerts-active class=\"icon\"></obi-alerts-active>` : this.renderTwotoneIcon(); } renderCount() { return html`<span class=\"count\">${this.nAlerts}</span>`; } renderCounts() { if (rankAlertCounts(this.counts).length === 0 && this.shelvedCount <= 0) return nothing; return html`<obc-alert-counter-item .type=${
|
|
3793
|
+
"default": "class ObcAlertButtonItem extends LitElement { constructor(..._args) { super(..._args); this.type = \"normal\"; this.nAlerts = 0; this.counter = false; this.globalCounter = false; this.globalCounterType = ObcAlertCounterItemType.Badges; this.counts = {}; this.shelvedCount = 0; this.blinking = false; this.flashingSpeed = FlashingSpeed.Default; this.fillHeight = false; this.ariaLabel = null; this.flashing = new FlashingController(this, () => this.resolvedFlashingSpeed); } get resolvedFlashingSpeed() { if (this.globalCounter || !this.blinking || this.nAlerts <= 0 || this.alertType === void 0) return FlashingSpeed.Fixed; return resolveFlashingSpeed(this.flashingSpeed, this.alertType, AlertFlashPhase.Active); } get accessibleName() { if (this.ariaLabel) return this.ariaLabel; const parts = [msg(\"Alerts\")]; if (this.nAlerts > 0) parts.push(String(this.nAlerts)); if (this.globalCounter) { const breakdown = alertCountsLabel(this.counts, this.shelvedCount); if (breakdown) parts.push(breakdown); } else if (this.nAlerts > 0 && this.alertType) parts.push(alertTypeLabel(this.alertType)); return parts.join(\", \"); } renderTwotoneIcon() { switch (this.alertType ? getAlertTwotoneComponent(this.alertType) : AlertTwotoneComponent.Caution) { case AlertTwotoneComponent.Critical: return html`<obi-alerts-critical-twotone useCssColor class=\"icon\" ></obi-alerts-critical-twotone>`; case AlertTwotoneComponent.Diagnostic: return html`<obi-alerts-diagnostic-twotone useCssColor class=\"icon\" ></obi-alerts-diagnostic-twotone>`; case AlertTwotoneComponent.Warning: return html`<obi-alerts-warning-twotone useCssColor class=\"icon\" ></obi-alerts-warning-twotone>`; case AlertTwotoneComponent.Caution: return html`<obi-alerts-caution-twotone useCssColor class=\"icon\" ></obi-alerts-caution-twotone>`; default: return html`<obi-alerts-alarm-twotone useCssColor class=\"icon\" ></obi-alerts-alarm-twotone>`; } } /** The blink layer shows the opposite of the steady layer in each flash. */ renderIcon(styleType, blinkLayer) { if (this.nAlerts === 0) return html`<obi-alerts class=\"icon\"></obi-alerts>`; const enhanced = styleType === \"enhanced\"; if (blinkLayer) return enhanced ? this.renderTwotoneIcon() : html`<obi-alerts class=\"icon\"></obi-alerts>`; return enhanced || this.globalCounter ? html`<obi-alerts-active class=\"icon\"></obi-alerts-active>` : this.renderTwotoneIcon(); } renderCount() { return html`<span class=\"count\">${this.nAlerts}</span>`; } renderCounts() { if (rankAlertCounts(this.counts).length === 0 && this.shelvedCount <= 0) return nothing; return html`<obc-alert-counter-item .type=${this.globalCounterType} .counts=${this.counts} .shelvedCount=${this.shelvedCount} ></obc-alert-counter-item>`; } render() { const styleType = this.globalCounter ? \"normal\" : this.type; const showCount = this.nAlerts > 0 && (this.globalCounter || this.counter && styleType !== \"flat\"); const tempo = this.resolvedFlashingSpeed; return html` <button class=${classMap({ \"alert-button\": true, [`type-${styleType}`]: true, [`alert-type-${this.alertType ?? \"none\"}`]: true, counter: showCount && !this.globalCounter, \"global-counter\": this.globalCounter, \"fill-height\": this.fillHeight, [`flash-${tempo}`]: true })} aria-label=${this.accessibleName} > ${tempo === FlashingSpeed.Fixed ? nothing : html`<div class=\"blink\" aria-hidden=\"true\"> <div class=\"content\"> ${this.renderIcon(styleType, true)} ${showCount ? this.renderCount() : nothing} </div> </div>`} <div class=\"visible-wrapper\"> ${this.globalCounter ? this.renderCounts() : nothing} <div class=\"content\"> ${this.renderIcon(styleType, false)} ${showCount ? this.renderCount() : nothing} </div> </div> </button> <span class=\"announcement\" aria-live=\"polite\" aria-atomic=\"true\" >${this.accessibleName}</span > `; } static { this.styles = unsafeCSS(alert_button_item_default); } }"
|
|
3794
3794
|
}
|
|
3795
3795
|
],
|
|
3796
3796
|
"exports": [
|
|
@@ -3819,7 +3819,7 @@
|
|
|
3819
3819
|
{
|
|
3820
3820
|
"kind": "variable",
|
|
3821
3821
|
"name": "ObcAlertButton",
|
|
3822
|
-
"default": "class ObcAlertButton extends LitElement { constructor(..._args) { super(..._args); this.nAlerts = 0; this.type = ObcAlertButtonType.Normal; this.large = false; this.showSilenceButton = false; this.silenceButtonDisabled = false; this.counter = false; this.globalCounter = false; this.counts = {}; this.shelvedCount = 0; this.blinking = false; this.flashingSpeed = FlashingSpeed.Default; this.flatMaxBreakpointPx = 0; this.silenceButtonMinBreakpointPx = 0; this.width = window.innerWidth; this.resizeListener = () => { this.width = window.innerWidth; }; } connectedCallback() { super.connectedCallback(); window.addEventListener(\"resize\", this.resizeListener); } disconnectedCallback() { window.removeEventListener(\"resize\", this.resizeListener); super.disconnectedCallback(); } get activeType() { if (this.type === ObcAlertButtonType.Flat) return ObcAlertButtonType.Flat; if (this.width < this.flatMaxBreakpointPx) return ObcAlertButtonType.Flat; return this.type; } get showSilenceButtonDynamic() { return this.showSilenceButton && this.width >= this.silenceButtonMinBreakpointPx && this.activeType !== ObcAlertButtonType.Flat; } render() { const showSilence = this.showSilenceButtonDynamic; return html` <div class=${classMap({ wrapper: true, [`type-${this.activeType}`]: true, large: this.large })} > <obc-alert-button-item .type=${this.activeType} .alertType=${this.alertType} .nAlerts=${this.nAlerts} .counter=${this.counter} .globalCounter=${this.globalCounter && this.activeType !== ObcAlertButtonType.Flat} .counts=${this.counts} .shelvedCount=${this.shelvedCount} .blinking=${this.blinking} .flashingSpeed=${this.flashingSpeed} .fillHeight=${this.large} ?data-group-item-not-last=${showSilence} @click=${() => this.dispatchEvent(new CustomEvent(\"click-alert\"))} ></obc-alert-button-item> ${showSilence ? html` <button class=\"silence-button\" aria-label=${msg(\"Silence\")} @click=${() => this.dispatchEvent(new CustomEvent(\"click-silence\"))} ?disabled=${this.silenceButtonDisabled} > <div class=\"visible-wrapper\"> <obi-silence-iec class=\"icon\"></obi-silence-iec> </div> </button> ` : nothing} </div> `; } static { this.styles = unsafeCSS(alert_button_default); } }"
|
|
3822
|
+
"default": "class ObcAlertButton extends LitElement { constructor(..._args) { super(..._args); this.nAlerts = 0; this.type = ObcAlertButtonType.Normal; this.large = false; this.showSilenceButton = false; this.silenceButtonDisabled = false; this.counter = false; this.globalCounter = false; this.globalCounterType = ObcAlertCounterItemType.Badges; this.counts = {}; this.shelvedCount = 0; this.blinking = false; this.flashingSpeed = FlashingSpeed.Default; this.flatMaxBreakpointPx = 0; this.silenceButtonMinBreakpointPx = 0; this.width = window.innerWidth; this.resizeListener = () => { this.width = window.innerWidth; }; } connectedCallback() { super.connectedCallback(); window.addEventListener(\"resize\", this.resizeListener); } disconnectedCallback() { window.removeEventListener(\"resize\", this.resizeListener); super.disconnectedCallback(); } get activeType() { if (this.type === ObcAlertButtonType.Flat) return ObcAlertButtonType.Flat; if (this.width < this.flatMaxBreakpointPx) return ObcAlertButtonType.Flat; return this.type; } get showSilenceButtonDynamic() { return this.showSilenceButton && this.width >= this.silenceButtonMinBreakpointPx && this.activeType !== ObcAlertButtonType.Flat; } render() { const showSilence = this.showSilenceButtonDynamic; return html` <div class=${classMap({ wrapper: true, [`type-${this.activeType}`]: true, large: this.large })} > <obc-alert-button-item .type=${this.activeType} .alertType=${this.alertType} .nAlerts=${this.nAlerts} .counter=${this.counter} .globalCounter=${this.globalCounter && this.activeType !== ObcAlertButtonType.Flat} .globalCounterType=${this.globalCounterType} .counts=${this.counts} .shelvedCount=${this.shelvedCount} .blinking=${this.blinking} .flashingSpeed=${this.flashingSpeed} .fillHeight=${this.large} ?data-group-item-not-last=${showSilence} @click=${() => this.dispatchEvent(new CustomEvent(\"click-alert\"))} ></obc-alert-button-item> ${showSilence ? html` <button class=\"silence-button\" aria-label=${msg(\"Silence\")} @click=${() => this.dispatchEvent(new CustomEvent(\"click-silence\"))} ?disabled=${this.silenceButtonDisabled} > <div class=\"visible-wrapper\"> <obi-silence-iec class=\"icon\"></obi-silence-iec> </div> </button> ` : nothing} </div> `; } static { this.styles = unsafeCSS(alert_button_default); } }"
|
|
3823
3823
|
}
|
|
3824
3824
|
],
|
|
3825
3825
|
"exports": [
|
|
@@ -3838,6 +3838,14 @@
|
|
|
3838
3838
|
"name": "ObcAlertButtonType",
|
|
3839
3839
|
"module": "dist/components/alert-button/alert-button.js"
|
|
3840
3840
|
}
|
|
3841
|
+
},
|
|
3842
|
+
{
|
|
3843
|
+
"kind": "js",
|
|
3844
|
+
"name": "ObcAlertCounterItemType",
|
|
3845
|
+
"declaration": {
|
|
3846
|
+
"name": "ObcAlertCounterItemType",
|
|
3847
|
+
"module": "dist/components/alert-button/alert-button.js"
|
|
3848
|
+
}
|
|
3841
3849
|
}
|
|
3842
3850
|
]
|
|
3843
3851
|
},
|
|
@@ -3853,7 +3861,7 @@
|
|
|
3853
3861
|
{
|
|
3854
3862
|
"kind": "variable",
|
|
3855
3863
|
"name": "ObcAlertCounterItem",
|
|
3856
|
-
"default": "class ObcAlertCounterItem extends LitElement { constructor(..._args) { super(..._args); this.type = \"badges\"; this.counts = {}; this.shelvedCount = 0; } render() { const ranked = rankAlertCounts(this.counts); if (ranked.length === 0 && this.shelvedCount <= 0) return nothing; const alertLevel = this.type === \"alert-level\"; const variant = alertLevel ? BadgeVariant.flat : BadgeVariant.default; return html` <div class=\"row\" role=\"img\" aria-label=${alertCountsLabel(this.counts, this.shelvedCount)} > ${repeat(ranked, (entry) => entry.type, (entry) => html`<obc-badge size=${BadgeSize.large} type=${entry.type} .variant=${variant} .showIcon=${alertLevel} .number=${entry.count} ></obc-badge>`)} ${this.shelvedCount > 0 ? html`<obc-badge size=${BadgeSize.large} type=${BadgeType.regular} .variant=${variant}
|
|
3864
|
+
"default": "class ObcAlertCounterItem extends LitElement { constructor(..._args) { super(..._args); this.type = \"badges\"; this.counts = {}; this.shelvedCount = 0; } render() { const ranked = rankAlertCounts(this.counts); if (ranked.length === 0 && this.shelvedCount <= 0) return nothing; const alertLevel = this.type === \"alert-level\"; const variant = alertLevel ? BadgeVariant.flat : BadgeVariant.default; return html` <div class=\"row\" role=\"img\" aria-label=${alertCountsLabel(this.counts, this.shelvedCount)} > ${repeat(ranked, (entry) => entry.type, (entry) => html`<obc-badge size=${BadgeSize.large} type=${entry.type} .variant=${variant} .showIcon=${alertLevel} .number=${entry.count} ></obc-badge>`)} ${this.shelvedCount > 0 ? html`<obc-badge size=${BadgeSize.large} type=${BadgeType.regular} .variant=${variant} showIcon .number=${this.shelvedCount} > <obi-timer-2 slot=\"badge-icon\"></obi-timer-2> </obc-badge>` : nothing} </div> `; } static { this.styles = unsafeCSS(alert_counter_item_default); } }"
|
|
3857
3865
|
}
|
|
3858
3866
|
],
|
|
3859
3867
|
"exports": [
|
|
@@ -51676,7 +51684,7 @@
|
|
|
51676
51684
|
"declarations": [
|
|
51677
51685
|
{
|
|
51678
51686
|
"kind": "class",
|
|
51679
|
-
"description": "`<obc-alert-button-item>` – The bell button that shows the alert state and count.\n\nShows the alert status as a bell in the style of the given alert type, with\nan optional counter, or as a global counter: one badge per severity, then\nthe bell and the total. `obc-alert-button` renders the item next to its\nsilence 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. A visually hidden\n polite live region repeats that name, so a change of counts is announced\n without the button holding focus; the name attribute alone would change\n silently.\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```",
|
|
51687
|
+
"description": "`<obc-alert-button-item>` – The bell button that shows the alert state and count.\n\nShows the alert status as a bell in the style of the given alert type, with\nan optional counter, or as a global counter: one badge per severity, then\nthe bell and the total. `obc-alert-button` renders the item next to its\nsilence 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 `globalCounterType` picks filled badges or the severity shapes.\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. A visually hidden\n polite live region repeats that name, so a change of counts is announced\n without the button holding focus; the name attribute alone would change\n silently.\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```",
|
|
51680
51688
|
"name": "ObcAlertButtonItem",
|
|
51681
51689
|
"members": [
|
|
51682
51690
|
{
|
|
@@ -51722,6 +51730,14 @@
|
|
|
51722
51730
|
"default": "false",
|
|
51723
51731
|
"description": "Shows the per-severity counts, the bell and the total instead of a single alert status."
|
|
51724
51732
|
},
|
|
51733
|
+
{
|
|
51734
|
+
"kind": "field",
|
|
51735
|
+
"name": "globalCounterType",
|
|
51736
|
+
"type": {
|
|
51737
|
+
"text": "ObcAlertCounterItemType"
|
|
51738
|
+
},
|
|
51739
|
+
"description": "How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count)."
|
|
51740
|
+
},
|
|
51725
51741
|
{
|
|
51726
51742
|
"kind": "field",
|
|
51727
51743
|
"name": "counts",
|
|
@@ -51874,7 +51890,7 @@
|
|
|
51874
51890
|
"declarations": [
|
|
51875
51891
|
{
|
|
51876
51892
|
"kind": "class",
|
|
51877
|
-
"description": "`<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.\n\nThis 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.\n\nAppears 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.\n\n## Features\n\n- **Variants:**\n - **Flat:** Minimal, icon-only button for space-constrained layouts.\n - **Normal:** Standard button with icon and optional alert counter.\n - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.\n- **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.\n- **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).\n- **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.\n- **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.\n- **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).\n- **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.\n- **Large Size Option:** Increases button height and padding for touch-friendly or prominent use.\n\n## Usage Guidelines\n\nUse `<obc-alert-button>` to provide a persistent, easily accessible indicator of alert or notification status. Ideal for toolbars, headers, or notification panels where users need to be aware of active alerts and may need to silence them quickly.\n\n- Use the counter to show the number of active alerts when relevant.\n- Use the silence button to provide a quick mute action, but only when space allows.\n- Choose the variant (`flat`, `normal`, `enhanced`) based on available space and the importance of the alert.\n- The blinking feature should be reserved for urgent or high-priority alerts to avoid unnecessary distraction.\n\n**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.\n\n**TODO(designer):** The Figma Alert button has no flat Global counter, so below `flatMaxBreakpointPx` the button shows the flat bell without the counts.\n\n## Events\n\n- `click-alert` – Fired when the main alert button is clicked.\n- `click-silence` – Fired when the silence button is clicked.\n\n## Best Practices & Constraints\n\n- Only show the counter when there are active alerts and the button is not in flat mode.\n- The silence button is only visible if enabled, the width is above the minimum breakpoint, and the button is not flat.\n- Blinking should be used sparingly to avoid overwhelming the user.\n- Use the large variant for touch interfaces or when the button needs to stand out.\n\n## Example\n\n```html\n<obc-alert-button\n nAlerts=\"3\"\n alertType=\"alarm\"\n type=\"enhanced\"\n counter\n showSilenceButton\n blinking\n large\n flatMaxBreakpointPx=\"600\"\n silenceButtonMinBreakpointPx=\"600\"\n></obc-alert-button>\n```\n\nIn 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.",
|
|
51893
|
+
"description": "`<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.\n\nThis 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.\n\nAppears 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.\n\n## Features\n\n- **Variants:**\n - **Flat:** Minimal, icon-only button for space-constrained layouts.\n - **Normal:** Standard button with icon and optional alert counter.\n - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.\n- **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.\n- **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).\n- **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; `globalCounterType` picks filled badges or the severity shapes.\n- **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.\n- **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).\n- **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.\n- **Large Size Option:** Increases button height and padding for touch-friendly or prominent use.\n\n## Usage Guidelines\n\nUse `<obc-alert-button>` to provide a persistent, easily accessible indicator of alert or notification status. Ideal for toolbars, headers, or notification panels where users need to be aware of active alerts and may need to silence them quickly.\n\n- Use the counter to show the number of active alerts when relevant.\n- Use the silence button to provide a quick mute action, but only when space allows.\n- Choose the variant (`flat`, `normal`, `enhanced`) based on available space and the importance of the alert.\n- The blinking feature should be reserved for urgent or high-priority alerts to avoid unnecessary distraction.\n\n**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.\n\n**TODO(designer):** The Figma Alert button has no flat Global counter, so below `flatMaxBreakpointPx` the button shows the flat bell without the counts.\n\n## Events\n\n- `click-alert` – Fired when the main alert button is clicked.\n- `click-silence` – Fired when the silence button is clicked.\n\n## Best Practices & Constraints\n\n- Only show the counter when there are active alerts and the button is not in flat mode.\n- The silence button is only visible if enabled, the width is above the minimum breakpoint, and the button is not flat.\n- Blinking should be used sparingly to avoid overwhelming the user.\n- Use the large variant for touch interfaces or when the button needs to stand out.\n\n## Example\n\n```html\n<obc-alert-button\n nAlerts=\"3\"\n alertType=\"alarm\"\n type=\"enhanced\"\n counter\n showSilenceButton\n blinking\n large\n flatMaxBreakpointPx=\"600\"\n silenceButtonMinBreakpointPx=\"600\"\n></obc-alert-button>\n```\n\nIn 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.",
|
|
51878
51894
|
"name": "ObcAlertButton",
|
|
51879
51895
|
"members": [
|
|
51880
51896
|
{
|
|
@@ -51944,6 +51960,14 @@
|
|
|
51944
51960
|
"default": "false",
|
|
51945
51961
|
"description": "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."
|
|
51946
51962
|
},
|
|
51963
|
+
{
|
|
51964
|
+
"kind": "field",
|
|
51965
|
+
"name": "globalCounterType",
|
|
51966
|
+
"type": {
|
|
51967
|
+
"text": "ObcAlertCounterItemType"
|
|
51968
|
+
},
|
|
51969
|
+
"description": "How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count)."
|
|
51970
|
+
},
|
|
51947
51971
|
{
|
|
51948
51972
|
"kind": "field",
|
|
51949
51973
|
"name": "counts",
|
|
@@ -52067,6 +52091,14 @@
|
|
|
52067
52091
|
"module": "src/components/alert-button/alert-button.ts"
|
|
52068
52092
|
}
|
|
52069
52093
|
},
|
|
52094
|
+
{
|
|
52095
|
+
"kind": "js",
|
|
52096
|
+
"name": "ObcAlertCounterItemType",
|
|
52097
|
+
"declaration": {
|
|
52098
|
+
"name": "ObcAlertCounterItemType",
|
|
52099
|
+
"module": "src/components/alert-button/alert-button.ts"
|
|
52100
|
+
}
|
|
52101
|
+
},
|
|
52070
52102
|
{
|
|
52071
52103
|
"kind": "js",
|
|
52072
52104
|
"name": "ObcAlertButton",
|
|
@@ -52083,7 +52115,7 @@
|
|
|
52083
52115
|
"declarations": [
|
|
52084
52116
|
{
|
|
52085
52117
|
"kind": "class",
|
|
52086
|
-
"description": "`<obc-alert-counter-item>` – A row of alert counts, one badge per severity.\n\nRenders a large `obc-badge` for every severity with a count above zero, most\nsevere first, followed by an optional shelved count. Nothing renders when\nnothing 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
|
|
52118
|
+
"description": "`<obc-alert-counter-item>` – A row of alert counts, one badge per severity.\n\nRenders a large `obc-badge` for every severity with a count above zero, most\nsevere first, followed by an optional shelved count. Nothing renders when\nnothing 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 with the timer icon\n at the end, the icon the Figma counter swaps into its shelved badge.\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- **TODO(designer):** the Figma component draws alarm, warning and caution;\n critical and diagnostic use the `level-critical` and `level-diagnostic`\n badges of `obc-badge` (#1389).\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```",
|
|
52087
52119
|
"name": "ObcAlertCounterItem",
|
|
52088
52120
|
"members": [
|
|
52089
52121
|
{
|
|
@@ -52110,7 +52142,7 @@
|
|
|
52110
52142
|
"text": "number"
|
|
52111
52143
|
},
|
|
52112
52144
|
"default": "0",
|
|
52113
|
-
"description": "Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero."
|
|
52145
|
+
"description": "Number of shelved alerts, shown as a neutral badge with the timer icon after the severities; hidden at zero."
|
|
52114
52146
|
},
|
|
52115
52147
|
{
|
|
52116
52148
|
"kind": "method",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import { ObcAlertButtonType } from '../alert-button-item/alert-button-item.js';
|
|
3
|
+
import { ObcAlertCounterItemType } from '../alert-counter-item/alert-counter-item.js';
|
|
3
4
|
import { AlertType, FlashingSpeed, AlertCounts } from '../../types.js';
|
|
4
5
|
import '../../icons/icon-notification.js';
|
|
5
6
|
import '../../icons/icon-notification-advice.js';
|
|
6
7
|
import '../../icons/icon-notification-advice-active.js';
|
|
7
8
|
import '../../icons/icon-silence-iec.js';
|
|
8
9
|
import '../alert-button-item/alert-button-item.js';
|
|
9
|
-
export { ObcAlertButtonType };
|
|
10
|
+
export { ObcAlertButtonType, ObcAlertCounterItemType };
|
|
10
11
|
/**
|
|
11
12
|
* `<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.
|
|
12
13
|
*
|
|
@@ -22,7 +23,7 @@ export { ObcAlertButtonType };
|
|
|
22
23
|
* - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.
|
|
23
24
|
* - **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.
|
|
24
25
|
* - **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).
|
|
25
|
-
* - **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.
|
|
26
|
+
* - **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; `globalCounterType` picks filled badges or the severity shapes.
|
|
26
27
|
* - **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.
|
|
27
28
|
* - **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).
|
|
28
29
|
* - **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.
|
|
@@ -80,6 +81,8 @@ export { ObcAlertButtonType };
|
|
|
80
81
|
* @availableWhen silenceButtonDisabled showSilenceButton==true
|
|
81
82
|
* @property counter - Shows the alert counter when there are active alerts and the button is not flat.
|
|
82
83
|
* @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.
|
|
84
|
+
* @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).
|
|
85
|
+
* @availableWhen globalCounterType globalCounter==true
|
|
83
86
|
* @property counts - Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts).
|
|
84
87
|
* @availableWhen counts globalCounter==true
|
|
85
88
|
* @property shelvedCount - Number of shelved alerts, shown after the global counter badges; hidden at zero.
|
|
@@ -112,6 +115,8 @@ export declare class ObcAlertButton extends LitElement {
|
|
|
112
115
|
counter: boolean;
|
|
113
116
|
/** 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. */
|
|
114
117
|
globalCounter: boolean;
|
|
118
|
+
/** How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count). */
|
|
119
|
+
globalCounterType: ObcAlertCounterItemType;
|
|
115
120
|
/** Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts). */
|
|
116
121
|
counts: AlertCounts;
|
|
117
122
|
/** Number of shelved alerts, shown after the global counter badges; hidden at zero. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-button.d.ts","sourceRoot":"","sources":["../../../src/components/alert-button/alert-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAKzD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,yCAAyC,CAAC;AACjD,OAAO,gDAAgD,CAAC;AACxD,OAAO,iCAAiC,CAAC;AACzC,OAAO,2CAA2C,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EAAC,kBAAkB,EAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"alert-button.d.ts","sourceRoot":"","sources":["../../../src/components/alert-button/alert-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAKzD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,yCAAyC,CAAC;AACjD,OAAO,gDAAgD,CAAC;AACxD,OAAO,iCAAiC,CAAC;AACzC,OAAO,2CAA2C,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAC,uBAAuB,EAAC,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,KAAK,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EAAC,kBAAkB,EAAE,uBAAuB,EAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,qBAEa,cAAe,SAAQ,UAAU;IAClB,OAAO,SAAK;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,qBAA6B;IAChC,KAAK,UAAS;IACd,iBAAiB,UAAS;IAC1B,qBAAqB,UAAS;IAC9B,OAAO,UAAS;IAChB,aAAa,UAAS;IACvB,iBAAiB,EAAE,uBAAuB,CACnC;IACW,MAAM,EAAE,WAAW,CAAM;IAC3C,YAAY,SAAK;IAChB,QAAQ,UAAS;IAClB,aAAa,EAAE,aAAa,CAC9B;IACE,mBAAmB,SAAK;IACxB,4BAA4B,SAAK;IAElD,OAAO,CAAC,KAAK,CAAqB;IAE3C,OAAO,CAAC,cAAc,CAEpB;IAEO,iBAAiB;IAKjB,oBAAoB;IAK7B,OAAO,KAAK,UAAU,GAQrB;IAED,OAAO,KAAK,wBAAwB,GAMnC;IAEQ,MAAM;IAgDf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF"}
|
|
@@ -6,6 +6,7 @@ import "../../icons/icon-notification-advice.js";
|
|
|
6
6
|
import "../../icons/icon-notification.js";
|
|
7
7
|
import "../../icons/icon-silence-iec.js";
|
|
8
8
|
import alert_button_default from "./alert-button.css.js";
|
|
9
|
+
import { ObcAlertCounterItemType } from "../alert-counter-item/alert-counter-item.js";
|
|
9
10
|
import { ObcAlertButtonType } from "../alert-button-item/alert-button-item.js";
|
|
10
11
|
import { localized, msg } from "@lit/localize";
|
|
11
12
|
import { LitElement, html, nothing, unsafeCSS } from "lit";
|
|
@@ -22,6 +23,7 @@ var ObcAlertButton = class ObcAlertButton extends LitElement {
|
|
|
22
23
|
this.silenceButtonDisabled = false;
|
|
23
24
|
this.counter = false;
|
|
24
25
|
this.globalCounter = false;
|
|
26
|
+
this.globalCounterType = ObcAlertCounterItemType.Badges;
|
|
25
27
|
this.counts = {};
|
|
26
28
|
this.shelvedCount = 0;
|
|
27
29
|
this.blinking = false;
|
|
@@ -65,6 +67,7 @@ var ObcAlertButton = class ObcAlertButton extends LitElement {
|
|
|
65
67
|
.nAlerts=${this.nAlerts}
|
|
66
68
|
.counter=${this.counter}
|
|
67
69
|
.globalCounter=${this.globalCounter && this.activeType !== ObcAlertButtonType.Flat}
|
|
70
|
+
.globalCounterType=${this.globalCounterType}
|
|
68
71
|
.counts=${this.counts}
|
|
69
72
|
.shelvedCount=${this.shelvedCount}
|
|
70
73
|
.blinking=${this.blinking}
|
|
@@ -100,6 +103,7 @@ __decorate([property({ type: Boolean })], ObcAlertButton.prototype, "showSilence
|
|
|
100
103
|
__decorate([property({ type: Boolean })], ObcAlertButton.prototype, "silenceButtonDisabled", void 0);
|
|
101
104
|
__decorate([property({ type: Boolean })], ObcAlertButton.prototype, "counter", void 0);
|
|
102
105
|
__decorate([property({ type: Boolean })], ObcAlertButton.prototype, "globalCounter", void 0);
|
|
106
|
+
__decorate([property({ type: String })], ObcAlertButton.prototype, "globalCounterType", void 0);
|
|
103
107
|
__decorate([property({
|
|
104
108
|
type: Object,
|
|
105
109
|
attribute: false
|
|
@@ -112,6 +116,6 @@ __decorate([property({ type: Number })], ObcAlertButton.prototype, "silenceButto
|
|
|
112
116
|
__decorate([state()], ObcAlertButton.prototype, "width", void 0);
|
|
113
117
|
ObcAlertButton = __decorate([customElement("obc-alert-button"), localized()], ObcAlertButton);
|
|
114
118
|
//#endregion
|
|
115
|
-
export { ObcAlertButton, ObcAlertButtonType };
|
|
119
|
+
export { ObcAlertButton, ObcAlertButtonType, ObcAlertCounterItemType };
|
|
116
120
|
|
|
117
121
|
//# sourceMappingURL=alert-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-button.js","names":[],"sources":["../../../src/components/alert-button/alert-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {localized, msg} from '@lit/localize';\nimport compentStyle from './alert-button.css?inline';\nimport '../../icons/icon-notification.js';\nimport '../../icons/icon-notification-advice.js';\nimport '../../icons/icon-notification-advice-active.js';\nimport '../../icons/icon-silence-iec.js';\nimport '../alert-button-item/alert-button-item.js';\nimport {ObcAlertButtonType} from '../alert-button-item/alert-button-item.js';\nimport {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';\nimport {customElement} from '../../decorator.js';\n\nexport {ObcAlertButtonType};\n\n/**\n * `<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.\n *\n * 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.\n *\n * 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.\n *\n * ## Features\n *\n * - **Variants:**\n * - **Flat:** Minimal, icon-only button for space-constrained layouts.\n * - **Normal:** Standard button with icon and optional alert counter.\n * - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.\n * - **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.\n * - **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).\n * - **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.\n * - **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.\n * - **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).\n * - **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.\n * - **Large Size Option:** Increases button height and padding for touch-friendly or prominent use.\n *\n * ## Usage Guidelines\n *\n * Use `<obc-alert-button>` to provide a persistent, easily accessible indicator of alert or notification status. Ideal for toolbars, headers, or notification panels where users need to be aware of active alerts and may need to silence them quickly.\n *\n * - Use the counter to show the number of active alerts when relevant.\n * - Use the silence button to provide a quick mute action, but only when space allows.\n * - Choose the variant (`flat`, `normal`, `enhanced`) based on available space and the importance of the alert.\n * - The blinking feature should be reserved for urgent or high-priority alerts to avoid unnecessary distraction.\n *\n * **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.\n *\n * **TODO(designer):** The Figma Alert button has no flat Global counter, so below `flatMaxBreakpointPx` the button shows the flat bell without the counts.\n *\n * ## Events\n *\n * - `click-alert` – Fired when the main alert button is clicked.\n * - `click-silence` – Fired when the silence button is clicked.\n *\n * ## Best Practices & Constraints\n *\n * - Only show the counter when there are active alerts and the button is not in flat mode.\n * - The silence button is only visible if enabled, the width is above the minimum breakpoint, and the button is not flat.\n * - Blinking should be used sparingly to avoid overwhelming the user.\n * - Use the large variant for touch interfaces or when the button needs to stand out.\n *\n * ## Example\n *\n * ```html\n * <obc-alert-button\n * nAlerts=\"3\"\n * alertType=\"alarm\"\n * type=\"enhanced\"\n * counter\n * showSilenceButton\n * blinking\n * large\n * flatMaxBreakpointPx=\"600\"\n * silenceButtonMinBreakpointPx=\"600\"\n * ></obc-alert-button>\n * ```\n *\n * 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.\n *\n * @property nAlerts - Number of active alerts shown in the counter; 0 shows the idle state.\n * @property alertType - Alert type that selects the icon and colours: `alarm`, `warning`, `caution`, a `level-*` severity, or unset for the idle state.\n * @property type - Visual variant: `flat` (icon only), `normal` (default, icon and optional counter) or `enhanced` (emphasized for high-priority alerts).\n * @property large - Increases the button height and padding for touch-friendly or prominent use.\n * @property showSilenceButton - Shows the silence button when the width is at least `silenceButtonMinBreakpointPx` and the button is not flat.\n * @property silenceButtonDisabled - Disables the silence button when true.\n * @availableWhen silenceButtonDisabled showSilenceButton==true\n * @property counter - Shows the alert counter when there are active alerts and the button is not flat.\n * @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.\n * @property counts - Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts).\n * @availableWhen counts globalCounter==true\n * @property shelvedCount - Number of shelved alerts, shown after the global counter badges; hidden at zero.\n * @availableWhen shelvedCount globalCounter==true\n * @property blinking - Flashes the bell for active alerts of a flashing alert type (never for caution).\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 flatMaxBreakpointPx - Window width in px below which a `normal` or `enhanced` button switches to flat mode.\n * @availableWhen flatMaxBreakpointPx type!=flat\n * @property silenceButtonMinBreakpointPx - Minimum window width in px for showing the silence button.\n * @availableWhen silenceButtonMinBreakpointPx showSilenceButton==true\n * @fires {CustomEvent<void>} click-alert - Fired when the main alert button is clicked.\n * @fires {CustomEvent<void>} click-silence - Fired when the silence button is clicked.\n * @stable\n */\n@customElement('obc-alert-button')\n@localized()\nexport class ObcAlertButton extends LitElement {\n @property({type: Number}) nAlerts = 0;\n @property({type: String}) alertType?: AlertType;\n @property({type: String}) type = ObcAlertButtonType.Normal;\n @property({type: Boolean}) large = false;\n @property({type: Boolean}) showSilenceButton = false;\n @property({type: Boolean}) silenceButtonDisabled = false;\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: Number}) flatMaxBreakpointPx = 0;\n @property({type: Number}) silenceButtonMinBreakpointPx = 0;\n\n @state() private width = window.innerWidth;\n\n private resizeListener = () => {\n this.width = window.innerWidth;\n };\n\n override connectedCallback() {\n super.connectedCallback();\n window.addEventListener('resize', this.resizeListener);\n }\n\n override disconnectedCallback() {\n window.removeEventListener('resize', this.resizeListener);\n super.disconnectedCallback();\n }\n\n private get activeType(): ObcAlertButtonType {\n if (this.type === ObcAlertButtonType.Flat) {\n return ObcAlertButtonType.Flat;\n }\n if (this.width < this.flatMaxBreakpointPx) {\n return ObcAlertButtonType.Flat;\n }\n return this.type;\n }\n\n private get showSilenceButtonDynamic(): boolean {\n return (\n this.showSilenceButton &&\n this.width >= this.silenceButtonMinBreakpointPx &&\n this.activeType !== ObcAlertButtonType.Flat\n );\n }\n\n override render() {\n const showSilence = this.showSilenceButtonDynamic;\n return html`\n <div\n class=${classMap({\n wrapper: true,\n [`type-${this.activeType}`]: true,\n large: this.large,\n })}\n >\n <obc-alert-button-item\n .type=${this.activeType}\n .alertType=${this.alertType}\n .nAlerts=${this.nAlerts}\n .counter=${this.counter}\n .globalCounter=${\n this.globalCounter && this.activeType !== ObcAlertButtonType.Flat\n }\n .counts=${this.counts}\n .shelvedCount=${this.shelvedCount}\n .blinking=${this.blinking}\n .flashingSpeed=${this.flashingSpeed}\n .fillHeight=${this.large}\n ?data-group-item-not-last=${showSilence}\n @click=${() => this.dispatchEvent(new CustomEvent('click-alert'))}\n ></obc-alert-button-item>\n ${\n showSilence\n ? html`\n <button\n class=\"silence-button\"\n aria-label=${msg('Silence')}\n @click=${() =>\n this.dispatchEvent(new CustomEvent('click-silence'))}\n ?disabled=${this.silenceButtonDisabled}\n >\n <div class=\"visible-wrapper\">\n <obi-silence-iec class=\"icon\"></obi-silence-iec>\n </div>\n </button>\n `\n : nothing\n }\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-button': ObcAlertButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA0GO,IAAM,iBAAN,MAAM,uBAAuB,WAAW;;;EACT,KAAA,UAAA;EAEH,KAAA,OAAA,mBAAmB;EACjB,KAAA,QAAA;EACY,KAAA,oBAAA;EACI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,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,gCAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,MAAM,CAAA,GAAA,eAAA,WAAA,SAAA,KAAA,CAAA;AAnBR,iBAAA,WAAA,CAAA,cAAc,kBAAkB,GAChC,UAAU,CAAA,GAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"alert-button.js","names":[],"sources":["../../../src/components/alert-button/alert-button.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {localized, msg} from '@lit/localize';\nimport compentStyle from './alert-button.css?inline';\nimport '../../icons/icon-notification.js';\nimport '../../icons/icon-notification-advice.js';\nimport '../../icons/icon-notification-advice-active.js';\nimport '../../icons/icon-silence-iec.js';\nimport '../alert-button-item/alert-button-item.js';\nimport {ObcAlertButtonType} from '../alert-button-item/alert-button-item.js';\nimport {ObcAlertCounterItemType} from '../alert-counter-item/alert-counter-item.js';\nimport {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';\nimport {customElement} from '../../decorator.js';\n\nexport {ObcAlertButtonType, ObcAlertCounterItemType};\n\n/**\n * `<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.\n *\n * 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.\n *\n * 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.\n *\n * ## Features\n *\n * - **Variants:**\n * - **Flat:** Minimal, icon-only button for space-constrained layouts.\n * - **Normal:** Standard button with icon and optional alert counter.\n * - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.\n * - **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.\n * - **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).\n * - **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; `globalCounterType` picks filled badges or the severity shapes.\n * - **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.\n * - **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).\n * - **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.\n * - **Large Size Option:** Increases button height and padding for touch-friendly or prominent use.\n *\n * ## Usage Guidelines\n *\n * Use `<obc-alert-button>` to provide a persistent, easily accessible indicator of alert or notification status. Ideal for toolbars, headers, or notification panels where users need to be aware of active alerts and may need to silence them quickly.\n *\n * - Use the counter to show the number of active alerts when relevant.\n * - Use the silence button to provide a quick mute action, but only when space allows.\n * - Choose the variant (`flat`, `normal`, `enhanced`) based on available space and the importance of the alert.\n * - The blinking feature should be reserved for urgent or high-priority alerts to avoid unnecessary distraction.\n *\n * **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.\n *\n * **TODO(designer):** The Figma Alert button has no flat Global counter, so below `flatMaxBreakpointPx` the button shows the flat bell without the counts.\n *\n * ## Events\n *\n * - `click-alert` – Fired when the main alert button is clicked.\n * - `click-silence` – Fired when the silence button is clicked.\n *\n * ## Best Practices & Constraints\n *\n * - Only show the counter when there are active alerts and the button is not in flat mode.\n * - The silence button is only visible if enabled, the width is above the minimum breakpoint, and the button is not flat.\n * - Blinking should be used sparingly to avoid overwhelming the user.\n * - Use the large variant for touch interfaces or when the button needs to stand out.\n *\n * ## Example\n *\n * ```html\n * <obc-alert-button\n * nAlerts=\"3\"\n * alertType=\"alarm\"\n * type=\"enhanced\"\n * counter\n * showSilenceButton\n * blinking\n * large\n * flatMaxBreakpointPx=\"600\"\n * silenceButtonMinBreakpointPx=\"600\"\n * ></obc-alert-button>\n * ```\n *\n * 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.\n *\n * @property nAlerts - Number of active alerts shown in the counter; 0 shows the idle state.\n * @property alertType - Alert type that selects the icon and colours: `alarm`, `warning`, `caution`, a `level-*` severity, or unset for the idle state.\n * @property type - Visual variant: `flat` (icon only), `normal` (default, icon and optional counter) or `enhanced` (emphasized for high-priority alerts).\n * @property large - Increases the button height and padding for touch-friendly or prominent use.\n * @property showSilenceButton - Shows the silence button when the width is at least `silenceButtonMinBreakpointPx` and the button is not flat.\n * @property silenceButtonDisabled - Disables the silence button when true.\n * @availableWhen silenceButtonDisabled showSilenceButton==true\n * @property counter - Shows the alert counter when there are active alerts and the button is not flat.\n * @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.\n * @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).\n * @availableWhen globalCounterType globalCounter==true\n * @property counts - Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts).\n * @availableWhen counts globalCounter==true\n * @property shelvedCount - Number of shelved alerts, shown after the global counter badges; hidden at zero.\n * @availableWhen shelvedCount globalCounter==true\n * @property blinking - Flashes the bell for active alerts of a flashing alert type (never for caution).\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 flatMaxBreakpointPx - Window width in px below which a `normal` or `enhanced` button switches to flat mode.\n * @availableWhen flatMaxBreakpointPx type!=flat\n * @property silenceButtonMinBreakpointPx - Minimum window width in px for showing the silence button.\n * @availableWhen silenceButtonMinBreakpointPx showSilenceButton==true\n * @fires {CustomEvent<void>} click-alert - Fired when the main alert button is clicked.\n * @fires {CustomEvent<void>} click-silence - Fired when the silence button is clicked.\n * @stable\n */\n@customElement('obc-alert-button')\n@localized()\nexport class ObcAlertButton extends LitElement {\n @property({type: Number}) nAlerts = 0;\n @property({type: String}) alertType?: AlertType;\n @property({type: String}) type = ObcAlertButtonType.Normal;\n @property({type: Boolean}) large = false;\n @property({type: Boolean}) showSilenceButton = false;\n @property({type: Boolean}) silenceButtonDisabled = false;\n @property({type: Boolean}) counter = false;\n @property({type: Boolean}) globalCounter = false;\n @property({type: String}) globalCounterType: ObcAlertCounterItemType =\n ObcAlertCounterItemType.Badges;\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: Number}) flatMaxBreakpointPx = 0;\n @property({type: Number}) silenceButtonMinBreakpointPx = 0;\n\n @state() private width = window.innerWidth;\n\n private resizeListener = () => {\n this.width = window.innerWidth;\n };\n\n override connectedCallback() {\n super.connectedCallback();\n window.addEventListener('resize', this.resizeListener);\n }\n\n override disconnectedCallback() {\n window.removeEventListener('resize', this.resizeListener);\n super.disconnectedCallback();\n }\n\n private get activeType(): ObcAlertButtonType {\n if (this.type === ObcAlertButtonType.Flat) {\n return ObcAlertButtonType.Flat;\n }\n if (this.width < this.flatMaxBreakpointPx) {\n return ObcAlertButtonType.Flat;\n }\n return this.type;\n }\n\n private get showSilenceButtonDynamic(): boolean {\n return (\n this.showSilenceButton &&\n this.width >= this.silenceButtonMinBreakpointPx &&\n this.activeType !== ObcAlertButtonType.Flat\n );\n }\n\n override render() {\n const showSilence = this.showSilenceButtonDynamic;\n return html`\n <div\n class=${classMap({\n wrapper: true,\n [`type-${this.activeType}`]: true,\n large: this.large,\n })}\n >\n <obc-alert-button-item\n .type=${this.activeType}\n .alertType=${this.alertType}\n .nAlerts=${this.nAlerts}\n .counter=${this.counter}\n .globalCounter=${\n this.globalCounter && this.activeType !== ObcAlertButtonType.Flat\n }\n .globalCounterType=${this.globalCounterType}\n .counts=${this.counts}\n .shelvedCount=${this.shelvedCount}\n .blinking=${this.blinking}\n .flashingSpeed=${this.flashingSpeed}\n .fillHeight=${this.large}\n ?data-group-item-not-last=${showSilence}\n @click=${() => this.dispatchEvent(new CustomEvent('click-alert'))}\n ></obc-alert-button-item>\n ${\n showSilence\n ? html`\n <button\n class=\"silence-button\"\n aria-label=${msg('Silence')}\n @click=${() =>\n this.dispatchEvent(new CustomEvent('click-silence'))}\n ?disabled=${this.silenceButtonDisabled}\n >\n <div class=\"visible-wrapper\">\n <obi-silence-iec class=\"icon\"></obi-silence-iec>\n </div>\n </button>\n `\n : nothing\n }\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-button': ObcAlertButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6GO,IAAM,iBAAN,MAAM,uBAAuB,WAAW;;;EACT,KAAA,UAAA;EAEH,KAAA,OAAA,mBAAmB;EACjB,KAAA,QAAA;EACY,KAAA,oBAAA;EACI,KAAA,wBAAA;EACd,KAAA,UAAA;EACM,KAAA,gBAAA;EAEzC,KAAA,oBAAA,wBAAwB;EACwC,KAAA,SAAA,CAAC;EAC1B,KAAA,eAAA;EACH,KAAA,WAAA;EAEpC,KAAA,gBAAA,cAAc;EACgC,KAAA,sBAAA;EACS,KAAA,+BAAA;EAEhC,KAAA,QAAA,OAAO;EAED,KAAA,uBAAA;GAC7B,KAAK,QAAQ,OAAO;EACtB;;CAEA,oBAA6B;EAC3B,MAAM,kBAAkB;EACxB,OAAO,iBAAiB,UAAU,KAAK,cAAc;CACvD;CAEA,uBAAgC;EAC9B,OAAO,oBAAoB,UAAU,KAAK,cAAc;EACxD,MAAM,qBAAqB;CAC7B;CAEA,IAAY,aAAiC;EAC3C,IAAI,KAAK,SAAS,mBAAmB,MACnC,OAAO,mBAAmB;EAE5B,IAAI,KAAK,QAAQ,KAAK,qBACpB,OAAO,mBAAmB;EAE5B,OAAO,KAAK;CACd;CAEA,IAAY,2BAAoC;EAC9C,OACE,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,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,WAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,iBAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,qBAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,eAAA,WAAA,UAAA,KAAA,CAAA;AACzC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,gBAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,eAAA,WAAA,YAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,iBAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,uBAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,eAAA,WAAA,gCAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,MAAM,CAAA,GAAA,eAAA,WAAA,SAAA,KAAA,CAAA;AArBR,iBAAA,WAAA,CAAA,cAAc,kBAAkB,GAChC,UAAU,CAAA,GAAA,cAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import { ObcAlertCounterItemType } from '../alert-counter-item/alert-counter-item.js';
|
|
2
3
|
import { AlertType, FlashingSpeed, AlertCounts, ResolvedFlashingSpeed } from '../../types.js';
|
|
3
4
|
import { FlashingController } from '../../palettes/flashing-controller.js';
|
|
4
5
|
import '../../icons/icon-alerts.js';
|
|
@@ -38,7 +39,8 @@ export declare enum ObcAlertButtonType {
|
|
|
38
39
|
* `nAlerts` of 0 shows the idle bell.
|
|
39
40
|
* - **Counter:** `counter` shows `nAlerts` next to the bell, except in `flat`.
|
|
40
41
|
* - **Global counter:** `globalCounter` shows the per-severity `counts` as
|
|
41
|
-
* badges, then the bell and `nAlerts`, always in the normal style
|
|
42
|
+
* badges, then the bell and `nAlerts`, always in the normal style;
|
|
43
|
+
* `globalCounterType` picks filled badges or the severity shapes.
|
|
42
44
|
* - **Flashing:** `blinking` flashes the bell at the tempo `flashingSpeed`
|
|
43
45
|
* resolves (#1224).
|
|
44
46
|
* - **Fill height:** `fillHeight` stretches the visible button to the host
|
|
@@ -82,6 +84,8 @@ export declare enum ObcAlertButtonType {
|
|
|
82
84
|
* @property counter - Shows `nAlerts` next to the bell (not in `flat`).
|
|
83
85
|
* @availableWhen counter globalCounter==false
|
|
84
86
|
* @property globalCounter - Shows the per-severity counts, the bell and the total instead of a single alert status.
|
|
87
|
+
* @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).
|
|
88
|
+
* @availableWhen globalCounterType globalCounter==true
|
|
85
89
|
* @property counts - Alert count per severity for the global counter badges.
|
|
86
90
|
* @availableWhen counts globalCounter==true
|
|
87
91
|
* @property shelvedCount - Number of shelved alerts, shown after the global counter badges.
|
|
@@ -106,6 +110,8 @@ export declare class ObcAlertButtonItem extends LitElement {
|
|
|
106
110
|
counter: boolean;
|
|
107
111
|
/** Shows the per-severity counts, the bell and the total instead of a single alert status. */
|
|
108
112
|
globalCounter: boolean;
|
|
113
|
+
/** How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count). */
|
|
114
|
+
globalCounterType: ObcAlertCounterItemType;
|
|
109
115
|
/** Alert count per severity for the global counter badges. */
|
|
110
116
|
counts: AlertCounts;
|
|
111
117
|
/** Number of shelved alerts, shown after the global counter badges. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-button-item.d.ts","sourceRoot":"","sources":["../../../src/components/alert-button-item/alert-button-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAMzD,OAAO,4BAA4B,CAAC;AACpC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,0CAA0C,CAAC;AAClD,OAAO,4CAA4C,CAAC;AACpD,OAAO,4CAA4C,CAAC;AACpD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,qDAAqD,CAAC;AAC7D,OAAO,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"alert-button-item.d.ts","sourceRoot":"","sources":["../../../src/components/alert-button-item/alert-button-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,KAAK,CAAC;AAMzD,OAAO,4BAA4B,CAAC;AACpC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,0CAA0C,CAAC;AAClD,OAAO,4CAA4C,CAAC;AACpD,OAAO,4CAA4C,CAAC;AACpD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,qDAAqD,CAAC;AAC7D,OAAO,6CAA6C,CAAC;AACrD,OAAO,EAAC,uBAAuB,EAAC,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACL,SAAS,EACT,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AAUxB,OAAO,EAAC,kBAAkB,EAAC,MAAM,uCAAuC,CAAC;AAEzE;;;;;;GAMG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,qBAEa,kBAAmB,SAAQ,UAAU;IACtB,IAAI,EAAE,kBAAkB,CACtB;IACF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,SAAK;IACX,OAAO,UAAS;IAChB,aAAa,UAAS;IACvB,iBAAiB,EAAE,uBAAuB,CACnC;IACW,MAAM,EAAE,WAAW,CAAM;IAC3C,YAAY,SAAK;IAChB,QAAQ,UAAS;IAClB,aAAa,EAAE,aAAa,CAC9B;IACG,UAAU,UAAS;IAIrC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEzC,SAAS,CAAC,QAAQ,CAAC,QAAQ,qBAGzB;IAEF,IAAI,qBAAqB,IAAI,qBAAqB,CAcjD;IAED,OAAO,KAAK,cAAc,GAiBzB;IAED,OAAO,CAAC,iBAAiB;IAiCzB,4EAA4E;IAC5E,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IAWX,MAAM;IA8Cf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,kBAAkB,CAAC;KAC7C;CACF"}
|
|
@@ -37,6 +37,7 @@ var ObcAlertButtonItem = class ObcAlertButtonItem extends LitElement {
|
|
|
37
37
|
this.nAlerts = 0;
|
|
38
38
|
this.counter = false;
|
|
39
39
|
this.globalCounter = false;
|
|
40
|
+
this.globalCounterType = ObcAlertCounterItemType.Badges;
|
|
40
41
|
this.counts = {};
|
|
41
42
|
this.shelvedCount = 0;
|
|
42
43
|
this.blinking = false;
|
|
@@ -96,7 +97,7 @@ var ObcAlertButtonItem = class ObcAlertButtonItem extends LitElement {
|
|
|
96
97
|
renderCounts() {
|
|
97
98
|
if (rankAlertCounts(this.counts).length === 0 && this.shelvedCount <= 0) return nothing;
|
|
98
99
|
return html`<obc-alert-counter-item
|
|
99
|
-
.type=${
|
|
100
|
+
.type=${this.globalCounterType}
|
|
100
101
|
.counts=${this.counts}
|
|
101
102
|
.shelvedCount=${this.shelvedCount}
|
|
102
103
|
></obc-alert-counter-item>`;
|
|
@@ -146,6 +147,7 @@ __decorate([property({ type: String })], ObcAlertButtonItem.prototype, "alertTyp
|
|
|
146
147
|
__decorate([property({ type: Number })], ObcAlertButtonItem.prototype, "nAlerts", void 0);
|
|
147
148
|
__decorate([property({ type: Boolean })], ObcAlertButtonItem.prototype, "counter", void 0);
|
|
148
149
|
__decorate([property({ type: Boolean })], ObcAlertButtonItem.prototype, "globalCounter", void 0);
|
|
150
|
+
__decorate([property({ type: String })], ObcAlertButtonItem.prototype, "globalCounterType", void 0);
|
|
149
151
|
__decorate([property({
|
|
150
152
|
type: Object,
|
|
151
153
|
attribute: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-button-item.js","names":[],"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. A visually hidden\n * polite live region repeats that name, so a change of counts is announced\n * without the button holding focus; the name attribute alone would change\n * silently.\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 ${\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 }\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 <span class=\"announcement\" aria-live=\"polite\" aria-atomic=\"true\"\n >${this.accessibleName}</span\n >\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HT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AU,yBAAc;;AACnD;AAxKG,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,QAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,aAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,WAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,WAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,iBAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,mBAAA,WAAA,UAAA,KAAA,CAAA;AACzC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,gBAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,YAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,iBAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,cAAA,KAAA,CAAA;AAGxB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAA,mBAAA,WAAA,aAAA,KAAA,CAAA;AAjBlD,qBAAA,WAAA,CAAA,cAAc,uBAAuB,GACrC,UAAU,CAAA,GAAA,kBAAA"}
|
|
1
|
+
{"version":3,"file":"alert-button-item.js","names":[],"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 * `globalCounterType` picks filled badges or the severity shapes.\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. A visually hidden\n * polite live region repeats that name, so a change of counts is announced\n * without the button holding focus; the name attribute alone would change\n * silently.\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 globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).\n * @availableWhen globalCounterType globalCounter==true\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: String}) globalCounterType: ObcAlertCounterItemType =\n ObcAlertCounterItemType.Badges;\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=${this.globalCounterType}\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 ${\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 }\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 <span class=\"announcement\" aria-live=\"polite\" aria-atomic=\"true\"\n >${this.accessibleName}</span\n >\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,UAAA;CACA,mBAAA,YAAA;CACA,mBAAA,cAAA;;AACF,EAAA,CAAA,CAAA;AAiFO,IAAM,qBAAN,MAAM,2BAA2B,WAAW;;;;EAIb,KAAA,UAAA;EACC,KAAA,UAAA;EACM,KAAA,gBAAA;EAEzC,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AAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,WAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,iBAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,qBAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,mBAAA,WAAA,UAAA,KAAA,CAAA;AACzC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,gBAAA,KAAA,CAAA;AACvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,YAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,mBAAA,WAAA,iBAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,cAAA,KAAA,CAAA;AAGxB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAA,mBAAA,WAAA,aAAA,KAAA,CAAA;AAnBlD,qBAAA,WAAA,CAAA,cAAc,uBAAuB,GACrC,UAAU,CAAA,GAAA,kBAAA"}
|
|
@@ -14,7 +14,7 @@ var alert_counter_item_default = css`* {
|
|
|
14
14
|
gap: var(--app-components-alert-counter-item-badge-spacing);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
obi-
|
|
17
|
+
obi-timer-2 {
|
|
18
18
|
display: block; /* fills the badge icon box that sizes the badge-icon slot */
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-counter-item.css.js","names":[],"sources":["../../../src/components/alert-counter-item/alert-counter-item.css?inline"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.row {\n display: flex;\n align-items: center;\n gap: var(--app-components-alert-counter-item-badge-spacing);\n}\n\nobi-
|
|
1
|
+
{"version":3,"file":"alert-counter-item.css.js","names":[],"sources":["../../../src/components/alert-counter-item/alert-counter-item.css?inline"],"sourcesContent":[":host {\n display: inline-block;\n}\n\n.row {\n display: flex;\n align-items: center;\n gap: var(--app-components-alert-counter-item-badge-spacing);\n}\n\nobi-timer-2 {\n display: block; /* fills the badge icon box that sizes the badge-icon slot */\n width: 100%;\n height: 100%;\n}\n"],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, nothing } from 'lit';
|
|
2
2
|
import { AlertCounts } from '../../types.js';
|
|
3
3
|
import '../badge/badge.js';
|
|
4
|
-
import '../../icons/icon-
|
|
4
|
+
import '../../icons/icon-timer-2.js';
|
|
5
5
|
/**
|
|
6
6
|
* `ObcAlertCounterItemType` – How each count is drawn (Figma `Type`).
|
|
7
7
|
*
|
|
@@ -26,8 +26,8 @@ export declare enum ObcAlertCounterItemType {
|
|
|
26
26
|
* `alert-level` draws flat badges with the severity glyph.
|
|
27
27
|
* - **Every severity:** `counts` takes the whole `AlertType` vocabulary,
|
|
28
28
|
* including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.
|
|
29
|
-
* - **Shelved count:** `shelvedCount` adds a neutral badge
|
|
30
|
-
* the
|
|
29
|
+
* - **Shelved count:** `shelvedCount` adds a neutral badge with the timer icon
|
|
30
|
+
* at the end, the icon the Figma counter swaps into its shelved badge.
|
|
31
31
|
* - **Accessible summary:** the row is announced as one image labelled with
|
|
32
32
|
* the counts, e.g. "2 Alarm, 4 Warning, 6 Caution".
|
|
33
33
|
*
|
|
@@ -42,6 +42,9 @@ export declare enum ObcAlertCounterItemType {
|
|
|
42
42
|
* `obc-alert-subsystem-counter`.
|
|
43
43
|
* - **TODO(designer):** the Figma component also has an Unacked counter type;
|
|
44
44
|
* how its icons map to counts is not defined yet.
|
|
45
|
+
* - **TODO(designer):** the Figma component draws alarm, warning and caution;
|
|
46
|
+
* critical and diagnostic use the `level-critical` and `level-diagnostic`
|
|
47
|
+
* badges of `obc-badge` (#1389).
|
|
45
48
|
*
|
|
46
49
|
* ---
|
|
47
50
|
*
|
|
@@ -56,7 +59,7 @@ export declare enum ObcAlertCounterItemType {
|
|
|
56
59
|
*
|
|
57
60
|
* @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).
|
|
58
61
|
* @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.
|
|
62
|
+
* @property shelvedCount - Number of shelved alerts, shown as a neutral badge with the timer icon after the severities; hidden at zero.
|
|
60
63
|
* @experimental
|
|
61
64
|
*/
|
|
62
65
|
export declare class ObcAlertCounterItem extends LitElement {
|
|
@@ -64,7 +67,7 @@ export declare class ObcAlertCounterItem extends LitElement {
|
|
|
64
67
|
type: ObcAlertCounterItemType;
|
|
65
68
|
/** Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown. */
|
|
66
69
|
counts: AlertCounts;
|
|
67
|
-
/** Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero. */
|
|
70
|
+
/** Number of shelved alerts, shown as a neutral badge with the timer icon after the severities; hidden at zero. */
|
|
68
71
|
shelvedCount: number;
|
|
69
72
|
render(): import('lit-html').TemplateResult<1> | typeof nothing;
|
|
70
73
|
static styles: import('lit').CSSResult;
|
|
@@ -1 +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,
|
|
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,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAGhD;;;;;GAKG;AACH,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,UAAU,gBAAgB;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { alertCountsLabel, rankAlertCounts } from "../../alert-severity.js";
|
|
2
2
|
import { customElement } from "../../decorator.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
|
|
4
|
-
import "../../icons/icon-
|
|
4
|
+
import "../../icons/icon-timer-2.js";
|
|
5
5
|
import { BadgeSize, BadgeType, BadgeVariant } from "../badge/badge.js";
|
|
6
6
|
import alert_counter_item_default from "./alert-counter-item.css.js";
|
|
7
7
|
import { localized } from "@lit/localize";
|
|
@@ -49,12 +49,10 @@ var ObcAlertCounterItem = class ObcAlertCounterItem extends LitElement {
|
|
|
49
49
|
size=${BadgeSize.large}
|
|
50
50
|
type=${BadgeType.regular}
|
|
51
51
|
.variant=${variant}
|
|
52
|
-
|
|
52
|
+
showIcon
|
|
53
53
|
.number=${this.shelvedCount}
|
|
54
54
|
>
|
|
55
|
-
|
|
56
|
-
slot="badge-icon"
|
|
57
|
-
></obi-alerts-shelf>` : nothing}
|
|
55
|
+
<obi-timer-2 slot="badge-icon"></obi-timer-2>
|
|
58
56
|
</obc-badge>` : nothing}
|
|
59
57
|
</div>
|
|
60
58
|
`;
|