@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.
Files changed (30) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +60 -46
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +39 -7
  4. package/dist/components/alert-button/alert-button.d.ts +7 -2
  5. package/dist/components/alert-button/alert-button.d.ts.map +1 -1
  6. package/dist/components/alert-button/alert-button.js +5 -1
  7. package/dist/components/alert-button/alert-button.js.map +1 -1
  8. package/dist/components/alert-button-item/alert-button-item.d.ts +7 -1
  9. package/dist/components/alert-button-item/alert-button-item.d.ts.map +1 -1
  10. package/dist/components/alert-button-item/alert-button-item.js +3 -1
  11. package/dist/components/alert-button-item/alert-button-item.js.map +1 -1
  12. package/dist/components/alert-counter-item/alert-counter-item.css.js +1 -1
  13. package/dist/components/alert-counter-item/alert-counter-item.css.js.map +1 -1
  14. package/dist/components/alert-counter-item/alert-counter-item.d.ts +8 -5
  15. package/dist/components/alert-counter-item/alert-counter-item.d.ts.map +1 -1
  16. package/dist/components/alert-counter-item/alert-counter-item.js +3 -5
  17. package/dist/components/alert-counter-item/alert-counter-item.js.map +1 -1
  18. package/dist/components/badge/badge.css.js +11 -0
  19. package/dist/components/badge/badge.css.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/components/alert-button/alert-button.spec.ts +12 -6
  22. package/src/components/alert-button/alert-button.stories.ts +32 -1
  23. package/src/components/alert-button/alert-button.ts +8 -2
  24. package/src/components/alert-button-item/alert-button-item.spec.ts +30 -1
  25. package/src/components/alert-button-item/alert-button-item.stories.ts +28 -0
  26. package/src/components/alert-button-item/alert-button-item.ts +7 -2
  27. package/src/components/alert-counter-item/alert-counter-item.css +1 -1
  28. package/src/components/alert-counter-item/alert-counter-item.spec.ts +32 -6
  29. package/src/components/alert-counter-item/alert-counter-item.ts +9 -12
  30. package/src/components/badge/badge.css +10 -0
@@ -1 +1 @@
1
- {"version":3,"file":"alert-counter-item.js","names":[],"sources":["../../../src/components/alert-counter-item/alert-counter-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {repeat} from 'lit/directives/repeat.js';\nimport {localized} from '@lit/localize';\nimport componentStyle from './alert-counter-item.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../badge/badge.js';\nimport {BadgeSize, BadgeType, BadgeVariant} from '../badge/badge.js';\nimport '../../icons/icon-alerts-shelf.js';\nimport type {AlertCounts} from '../../types.js';\nimport {alertCountsLabel, rankAlertCounts} from '../../alert-severity.js';\n\n/**\n * `ObcAlertCounterItemType` – How each count is drawn (Figma `Type`).\n *\n * - `badges`: filled badges in the severity colour (Figma Badges counter).\n * - `alert-level`: flat badges with the severity glyph (Figma Alert level counter).\n */\nexport enum ObcAlertCounterItemType {\n Badges = 'badges',\n AlertLevel = 'alert-level',\n}\n\n/**\n * `<obc-alert-counter-item>` – A row of alert counts, one badge per severity.\n *\n * Renders a large `obc-badge` for every severity with a count above zero, most\n * severe first, followed by an optional shelved count. Nothing renders when\n * nothing is counted.\n *\n * ---\n *\n * ### Features\n * - **Two types:** `badges` draws filled badges in the severity colour;\n * `alert-level` draws flat badges with the severity glyph.\n * - **Every severity:** `counts` takes the whole `AlertType` vocabulary,\n * including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.\n * - **Shelved count:** `shelvedCount` adds a neutral badge at the end, with\n * the shelf icon in `alert-level`.\n * - **Accessible summary:** the row is announced as one image labelled with\n * the counts, e.g. \"2 Alarm, 4 Warning, 6 Caution\".\n *\n * ---\n *\n * ### Usage Guidelines\n * - Show how many alerts are outstanding per severity in a compact space;\n * `obc-alert-button-item` nests the counter for its global counter.\n * - Pass the counts as one object: `.counts=${{countAlarm: 2, countWarning: 4}}`.\n * - The counter is display-only: it renders no button and fires no events.\n * - For a framed per-subsystem summary with a label, see\n * `obc-alert-subsystem-counter`.\n * - **TODO(designer):** the Figma component also has an Unacked counter type;\n * how its icons map to counts is not defined yet.\n *\n * ---\n *\n * ### Example\n *\n * ```html\n * <obc-alert-counter-item\n * .counts=${{countAlarm: 2, countWarning: 4, countCaution: 6}}\n * shelvedCount=\"9\"\n * ></obc-alert-counter-item>\n * ```\n *\n * @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).\n * @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.\n * @property shelvedCount - Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero.\n * @experimental\n */\n@customElement('obc-alert-counter-item')\n@localized()\nexport class ObcAlertCounterItem extends LitElement {\n @property({type: String}) type: ObcAlertCounterItemType =\n ObcAlertCounterItemType.Badges;\n @property({type: Object, attribute: false}) counts: AlertCounts = {};\n @property({type: Number}) shelvedCount = 0;\n\n override render() {\n const ranked = rankAlertCounts(this.counts);\n if (ranked.length === 0 && this.shelvedCount <= 0) {\n return nothing;\n }\n const alertLevel = this.type === ObcAlertCounterItemType.AlertLevel;\n const variant = alertLevel ? BadgeVariant.flat : BadgeVariant.default;\n return html`\n <div\n class=\"row\"\n role=\"img\"\n aria-label=${alertCountsLabel(this.counts, this.shelvedCount)}\n >\n ${repeat(\n ranked,\n (entry) => entry.type,\n (entry) =>\n html`<obc-badge\n size=${BadgeSize.large}\n type=${entry.type}\n .variant=${variant}\n .showIcon=${alertLevel}\n .number=${entry.count}\n ></obc-badge>`\n )}\n ${\n this.shelvedCount > 0\n ? html`<obc-badge\n size=${BadgeSize.large}\n type=${BadgeType.regular}\n .variant=${variant}\n .showIcon=${alertLevel}\n .number=${this.shelvedCount}\n >\n ${\n alertLevel\n ? html`<obi-alerts-shelf\n slot=\"badge-icon\"\n ></obi-alerts-shelf>`\n : nothing\n }\n </obc-badge>`\n : nothing\n }\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-counter-item': ObcAlertCounterItem;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAY,0BAAL,yBAAA,yBAAA;CACL,wBAAA,YAAA;CACA,wBAAA,gBAAA;;AACF,EAAA,CAAA,CAAA;AAmDO,IAAM,sBAAN,MAAM,4BAA4B,WAAW;;;;EAGgB,KAAA,SAAA,CAAC;EAC1B,KAAA,eAAA;;CAEzC,SAAkB;EAChB,MAAM,SAAS,gBAAgB,KAAK,MAAM;EAC1C,IAAI,OAAO,WAAW,KAAK,KAAK,gBAAgB,GAC9C,OAAO;EAET,MAAM,aAAa,KAAK,SAAA;EACxB,MAAM,UAAU,aAAa,aAAa,OAAO,aAAa;EAC9D,OAAO,IAAI;;;;qBAIM,iBAAiB,KAAK,QAAQ,KAAK,YAAY,EAAE;;UAE5D,OACA,SACC,UAAU,MAAM,OAChB,UACC,IAAI;qBACK,UAAU,MAAM;qBAChB,MAAM,KAAK;yBACP,QAAQ;0BACP,WAAW;wBACb,MAAM,MAAM;0BAE5B,EAAE;UAEA,KAAK,eAAe,IAChB,IAAI;uBACK,UAAU,MAAM;uBAChB,UAAU,QAAQ;2BACd,QAAQ;4BACP,WAAW;0BACb,KAAK,aAAa;;kBAG1B,aACI,IAAI;;8CAGJ,QACL;8BAEH,QACL;;;CAGP;;EAEyB,KAAA,SAAA,UAAU,0BAAc;;AACnD;AAtDG,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,oBAAA,WAAA,QAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,oBAAA,WAAA,UAAA,KAAA,CAAA;AACzC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,oBAAA,WAAA,gBAAA,KAAA,CAAA;AANzB,sBAAA,WAAA,CAAA,cAAc,wBAAwB,GACtC,UAAU,CAAA,GAAA,mBAAA"}
1
+ {"version":3,"file":"alert-counter-item.js","names":[],"sources":["../../../src/components/alert-counter-item/alert-counter-item.ts"],"sourcesContent":["import {LitElement, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {repeat} from 'lit/directives/repeat.js';\nimport {localized} from '@lit/localize';\nimport componentStyle from './alert-counter-item.css?inline';\nimport {customElement} from '../../decorator.js';\nimport '../badge/badge.js';\nimport {BadgeSize, BadgeType, BadgeVariant} from '../badge/badge.js';\nimport '../../icons/icon-timer-2.js';\nimport type {AlertCounts} from '../../types.js';\nimport {alertCountsLabel, rankAlertCounts} from '../../alert-severity.js';\n\n/**\n * `ObcAlertCounterItemType` – How each count is drawn (Figma `Type`).\n *\n * - `badges`: filled badges in the severity colour (Figma Badges counter).\n * - `alert-level`: flat badges with the severity glyph (Figma Alert level counter).\n */\nexport enum ObcAlertCounterItemType {\n Badges = 'badges',\n AlertLevel = 'alert-level',\n}\n\n/**\n * `<obc-alert-counter-item>` – A row of alert counts, one badge per severity.\n *\n * Renders a large `obc-badge` for every severity with a count above zero, most\n * severe first, followed by an optional shelved count. Nothing renders when\n * nothing is counted.\n *\n * ---\n *\n * ### Features\n * - **Two types:** `badges` draws filled badges in the severity colour;\n * `alert-level` draws flat badges with the severity glyph.\n * - **Every severity:** `counts` takes the whole `AlertType` vocabulary,\n * including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.\n * - **Shelved count:** `shelvedCount` adds a neutral badge 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 * ```\n *\n * @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).\n * @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.\n * @property shelvedCount - Number of shelved alerts, shown as a neutral badge with the timer icon after the severities; hidden at zero.\n * @experimental\n */\n@customElement('obc-alert-counter-item')\n@localized()\nexport class ObcAlertCounterItem extends LitElement {\n @property({type: String}) type: ObcAlertCounterItemType =\n ObcAlertCounterItemType.Badges;\n @property({type: Object, attribute: false}) counts: AlertCounts = {};\n @property({type: Number}) shelvedCount = 0;\n\n override render() {\n const ranked = rankAlertCounts(this.counts);\n if (ranked.length === 0 && this.shelvedCount <= 0) {\n return nothing;\n }\n const alertLevel = this.type === ObcAlertCounterItemType.AlertLevel;\n const variant = alertLevel ? BadgeVariant.flat : BadgeVariant.default;\n return html`\n <div\n class=\"row\"\n role=\"img\"\n aria-label=${alertCountsLabel(this.counts, this.shelvedCount)}\n >\n ${repeat(\n ranked,\n (entry) => entry.type,\n (entry) =>\n html`<obc-badge\n size=${BadgeSize.large}\n type=${entry.type}\n .variant=${variant}\n .showIcon=${alertLevel}\n .number=${entry.count}\n ></obc-badge>`\n )}\n ${\n this.shelvedCount > 0\n ? html`<obc-badge\n size=${BadgeSize.large}\n type=${BadgeType.regular}\n .variant=${variant}\n showIcon\n .number=${this.shelvedCount}\n >\n <obi-timer-2 slot=\"badge-icon\"></obi-timer-2>\n </obc-badge>`\n : nothing\n }\n </div>\n `;\n }\n\n static override styles = unsafeCSS(componentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'obc-alert-counter-item': ObcAlertCounterItem;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAY,0BAAL,yBAAA,yBAAA;CACL,wBAAA,YAAA;CACA,wBAAA,gBAAA;;AACF,EAAA,CAAA,CAAA;AAsDO,IAAM,sBAAN,MAAM,4BAA4B,WAAW;;;;EAGgB,KAAA,SAAA,CAAC;EAC1B,KAAA,eAAA;;CAEzC,SAAkB;EAChB,MAAM,SAAS,gBAAgB,KAAK,MAAM;EAC1C,IAAI,OAAO,WAAW,KAAK,KAAK,gBAAgB,GAC9C,OAAO;EAET,MAAM,aAAa,KAAK,SAAA;EACxB,MAAM,UAAU,aAAa,aAAa,OAAO,aAAa;EAC9D,OAAO,IAAI;;;;qBAIM,iBAAiB,KAAK,QAAQ,KAAK,YAAY,EAAE;;UAE5D,OACA,SACC,UAAU,MAAM,OAChB,UACC,IAAI;qBACK,UAAU,MAAM;qBAChB,MAAM,KAAK;yBACP,QAAQ;0BACP,WAAW;wBACb,MAAM,MAAM;0BAE5B,EAAE;UAEA,KAAK,eAAe,IAChB,IAAI;uBACK,UAAU,MAAM;uBAChB,UAAU,QAAQ;2BACd,QAAQ;;0BAET,KAAK,aAAa;;;8BAI9B,QACL;;;CAGP;;EAEyB,KAAA,SAAA,UAAU,0BAAc;;AACnD;AAhDG,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,oBAAA,WAAA,QAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAK,CAAC,CAAA,GAAA,oBAAA,WAAA,UAAA,KAAA,CAAA;AACzC,WAAA,CAAA,SAAS,EAAC,MAAM,OAAM,CAAC,CAAA,GAAA,oBAAA,WAAA,gBAAA,KAAA,CAAA;AANzB,sBAAA,WAAA,CAAA,cAAc,wBAAwB,GACtC,UAAU,CAAA,GAAA,mBAAA"}
@@ -4,6 +4,10 @@ var badge_default = css`* {
4
4
  -webkit-tap-highlight-color: transparent;
5
5
  }
6
6
 
7
+ :host {
8
+ line-height: 0; /* in a flex row, the host's text line adds the font's descent under an icon-first badge */
9
+ }
10
+
7
11
  .wrapper {
8
12
  user-select: none;
9
13
  display: flex;
@@ -182,6 +186,13 @@ var badge_default = css`* {
182
186
  min-height: var(--ui-components-badge-icon-size);
183
187
  }
184
188
 
189
+ /* Figma binds the flat large icon frame to the badge height, not icon-size-large */
190
+
191
+ .wrapper.variant-flat.size-large .icon {
192
+ width: var(--ui-components-badge-min-size-large);
193
+ height: var(--ui-components-badge-min-size-large);
194
+ }
195
+
185
196
  .wrapper.variant-flat .icon.type-alarm {
186
197
  color: unset;
187
198
  border-color: var(--alert-alarm-outline-color);
@@ -1 +1 @@
1
- {"version":3,"file":"badge.css.js","names":[],"sources":["../../../src/components/badge/badge.css?inline"],"sourcesContent":[".wrapper {\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border-style: solid;\n border-radius: var(--ui-components-badge-border-radius);\n padding: calc(var(--ui-components-badge-padding) - 1px);\n border: 1px solid var(--alert-alarm-outline-color);\n background: var(--alert-alarm-color);\n width: fit-content;\n height: 16px;\n box-sizing: border-box;\n\n .badge-icon {\n width: 100%;\n height: 100%;\n }\n\n .icon {\n width: var(--ui-components-badge-icon-size);\n height: var(--ui-components-badge-icon-size);\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n }\n\n & .number {\n @mixin font-label-active;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 0 var(--ui-components-badge-label-spacing) 1px\n var(--ui-components-badge-label-spacing);\n height: var(--ui-components-badge-icon-size);\n min-width: var(--ui-components-badge-icon-size);\n }\n\n &.size-large {\n display: inline-flex;\n width: fit-content;\n height: 24px;\n min-width: var(--ui-components-badge-min-size-large);\n min-height: var(--ui-components-badge-min-size-large);\n\n padding: calc(var(--ui-components-badge-padding) - 1px);\n justify-content: center;\n align-items: center;\n background: var(--alert-alarm-color);\n\n & .number {\n padding-bottom: 0;\n }\n\n & .number-text {\n @mixin font-body-active;\n }\n\n & .icon {\n width: var(--ui-components-badge-icon-size-large);\n height: var(--ui-components-badge-icon-size-large);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n &.type-empty {\n min-width: 38px;\n height: 24px;\n }\n }\n\n &.type-regular {\n color: var(--on-normal-neutral-color);\n background-color: var(--normal-enabled-background-color);\n border-color: var(--normal-enabled-border-color);\n }\n\n &.type-alarm {\n background-color: var(--alert-alarm-color);\n border-color: var(--alert-alarm-outline-color);\n color: var(--on-alarm-color);\n }\n\n &.type-warning {\n background-color: var(--alert-warning-color);\n border-color: var(--alert-warning-outline-color);\n color: var(--on-warning-color);\n }\n\n &.type-caution,\n &.type-level-low {\n background-color: var(--alert-caution-color);\n border-color: var(--alert-caution-outline-color);\n color: var(--on-caution-color);\n }\n\n &.type-level-critical {\n background-color: var(--critical-enabled-background-color);\n border-color: var(--critical-enabled-border-color);\n color: var(--on-critical-color);\n }\n\n &.type-level-high {\n background-color: var(--alert-alarm-color);\n border-color: var(--alert-alarm-outline-color);\n color: var(--on-alarm-color);\n }\n\n &.type-level-medium {\n background-color: var(--alert-warning-color);\n border-color: var(--alert-warning-outline-color);\n color: var(--on-warning-color);\n }\n\n &.type-level-diagnostic {\n background-color: var(--notification-enabled-background-color);\n border-color: var(--notification-enabled-border-color);\n color: var(--on-notification-active-color);\n }\n\n &.type-running {\n background-color: var(--alert-running-color);\n border-color: var(--alert-running-color);\n color: var(--on-running-color);\n }\n\n &.type-notification {\n background-color: var(--instrument-enhanced-primary-color);\n border-color: var(--instrument-enhanced-primary-color);\n color: var(--on-selected-active-color);\n }\n\n &.type-enhance {\n background-color: var(--instrument-enhanced-secondary-color);\n border-color: var(--instrument-enhanced-secondary-color);\n color: var(--on-selected-active-color);\n }\n\n &.type-empty {\n background-color: var(--flat-enabled-background-color);\n border-color: var(--normal-enabled-border-color);\n min-width: 28px;\n }\n\n &.type-automation {\n background-color: var(--container-background-color);\n border-color: var(--container-background-color);\n color: var(--on-flat-neutral-color);\n }\n\n &.variant-flat {\n background-color: var(--flat-enabled-background-color);\n border-color: var(--flat-enabled-background-color);\n\n .icon {\n min-width: var(--ui-components-badge-icon-size);\n min-height: var(--ui-components-badge-icon-size);\n }\n\n .icon.type-alarm {\n color: unset;\n border-color: var(--alert-alarm-outline-color);\n background: none;\n }\n\n .icon.type-warning {\n color: unset;\n border-color: var(--alert-warning-outline-color);\n background: none;\n }\n .icon.type-caution,\n .icon.type-level-low {\n color: unset;\n border-color: var(--alert-caution-outline-color);\n background: none;\n }\n\n .icon.type-level-critical {\n color: unset;\n border-color: var(--critical-enabled-border-color);\n background: none;\n }\n\n .icon.type-level-high {\n color: unset;\n border-color: var(--alert-alarm-outline-color);\n background: none;\n }\n\n .icon.type-level-medium {\n color: unset;\n border-color: var(--alert-warning-outline-color);\n background: none;\n }\n\n .icon.type-level-diagnostic {\n color: unset;\n border-color: var(--notification-enabled-border-color);\n background: none;\n }\n\n .icon.type-regular {\n color: unset;\n border-color: var(--normal-enabled-border-color);\n background: none;\n }\n\n .icon.type-notification {\n color: var(--instrument-enhanced-primary-color);\n border-color: var(\n --instrument-enhanced-primary-outline-color,\n transparent\n );\n background: none;\n }\n\n .icon.type-enhance {\n color: var(--instrument-enhanced-secondary-color);\n background: none;\n }\n\n .icon.type-regular {\n color: var(--on-normal-neutral-color);\n }\n\n .number {\n color: var(--element-active-color);\n }\n\n .icon.type-automation {\n color: unset;\n background: none;\n }\n\n & .icon.type-outline {\n width: var(--ui-components-badge-icon-size-flat);\n height: var(--ui-components-badge-icon-size-flat);\n }\n\n .icon.type-outline + .number {\n color: var(--on-normal-neutral-color);\n }\n }\n}\n\n.icon.type-alarm path {\n stroke: var(--alert-alarm-outline-color);\n}\n.icon.type-warning circle {\n stroke: var(--alert-warning-outline-color);\n}\n.icon.type-caution path {\n stroke: var(--alert-caution-outline-color);\n}\n.icon.type-running path {\n stroke: none;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"badge.css.js","names":[],"sources":["../../../src/components/badge/badge.css?inline"],"sourcesContent":[":host {\n line-height: 0; /* in a flex row, the host's text line adds the font's descent under an icon-first badge */\n}\n\n.wrapper {\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n border-style: solid;\n border-radius: var(--ui-components-badge-border-radius);\n padding: calc(var(--ui-components-badge-padding) - 1px);\n border: 1px solid var(--alert-alarm-outline-color);\n background: var(--alert-alarm-color);\n width: fit-content;\n height: 16px;\n box-sizing: border-box;\n\n .badge-icon {\n width: 100%;\n height: 100%;\n }\n\n .icon {\n width: var(--ui-components-badge-icon-size);\n height: var(--ui-components-badge-icon-size);\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n }\n\n & .number {\n @mixin font-label-active;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 0 var(--ui-components-badge-label-spacing) 1px\n var(--ui-components-badge-label-spacing);\n height: var(--ui-components-badge-icon-size);\n min-width: var(--ui-components-badge-icon-size);\n }\n\n &.size-large {\n display: inline-flex;\n width: fit-content;\n height: 24px;\n min-width: var(--ui-components-badge-min-size-large);\n min-height: var(--ui-components-badge-min-size-large);\n\n padding: calc(var(--ui-components-badge-padding) - 1px);\n justify-content: center;\n align-items: center;\n background: var(--alert-alarm-color);\n\n & .number {\n padding-bottom: 0;\n }\n\n & .number-text {\n @mixin font-body-active;\n }\n\n & .icon {\n width: var(--ui-components-badge-icon-size-large);\n height: var(--ui-components-badge-icon-size-large);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n &.type-empty {\n min-width: 38px;\n height: 24px;\n }\n }\n\n &.type-regular {\n color: var(--on-normal-neutral-color);\n background-color: var(--normal-enabled-background-color);\n border-color: var(--normal-enabled-border-color);\n }\n\n &.type-alarm {\n background-color: var(--alert-alarm-color);\n border-color: var(--alert-alarm-outline-color);\n color: var(--on-alarm-color);\n }\n\n &.type-warning {\n background-color: var(--alert-warning-color);\n border-color: var(--alert-warning-outline-color);\n color: var(--on-warning-color);\n }\n\n &.type-caution,\n &.type-level-low {\n background-color: var(--alert-caution-color);\n border-color: var(--alert-caution-outline-color);\n color: var(--on-caution-color);\n }\n\n &.type-level-critical {\n background-color: var(--critical-enabled-background-color);\n border-color: var(--critical-enabled-border-color);\n color: var(--on-critical-color);\n }\n\n &.type-level-high {\n background-color: var(--alert-alarm-color);\n border-color: var(--alert-alarm-outline-color);\n color: var(--on-alarm-color);\n }\n\n &.type-level-medium {\n background-color: var(--alert-warning-color);\n border-color: var(--alert-warning-outline-color);\n color: var(--on-warning-color);\n }\n\n &.type-level-diagnostic {\n background-color: var(--notification-enabled-background-color);\n border-color: var(--notification-enabled-border-color);\n color: var(--on-notification-active-color);\n }\n\n &.type-running {\n background-color: var(--alert-running-color);\n border-color: var(--alert-running-color);\n color: var(--on-running-color);\n }\n\n &.type-notification {\n background-color: var(--instrument-enhanced-primary-color);\n border-color: var(--instrument-enhanced-primary-color);\n color: var(--on-selected-active-color);\n }\n\n &.type-enhance {\n background-color: var(--instrument-enhanced-secondary-color);\n border-color: var(--instrument-enhanced-secondary-color);\n color: var(--on-selected-active-color);\n }\n\n &.type-empty {\n background-color: var(--flat-enabled-background-color);\n border-color: var(--normal-enabled-border-color);\n min-width: 28px;\n }\n\n &.type-automation {\n background-color: var(--container-background-color);\n border-color: var(--container-background-color);\n color: var(--on-flat-neutral-color);\n }\n\n &.variant-flat {\n background-color: var(--flat-enabled-background-color);\n border-color: var(--flat-enabled-background-color);\n\n .icon {\n min-width: var(--ui-components-badge-icon-size);\n min-height: var(--ui-components-badge-icon-size);\n }\n\n /* Figma binds the flat large icon frame to the badge height, not icon-size-large */\n &.size-large .icon {\n width: var(--ui-components-badge-min-size-large);\n height: var(--ui-components-badge-min-size-large);\n }\n\n .icon.type-alarm {\n color: unset;\n border-color: var(--alert-alarm-outline-color);\n background: none;\n }\n\n .icon.type-warning {\n color: unset;\n border-color: var(--alert-warning-outline-color);\n background: none;\n }\n .icon.type-caution,\n .icon.type-level-low {\n color: unset;\n border-color: var(--alert-caution-outline-color);\n background: none;\n }\n\n .icon.type-level-critical {\n color: unset;\n border-color: var(--critical-enabled-border-color);\n background: none;\n }\n\n .icon.type-level-high {\n color: unset;\n border-color: var(--alert-alarm-outline-color);\n background: none;\n }\n\n .icon.type-level-medium {\n color: unset;\n border-color: var(--alert-warning-outline-color);\n background: none;\n }\n\n .icon.type-level-diagnostic {\n color: unset;\n border-color: var(--notification-enabled-border-color);\n background: none;\n }\n\n .icon.type-regular {\n color: unset;\n border-color: var(--normal-enabled-border-color);\n background: none;\n }\n\n .icon.type-notification {\n color: var(--instrument-enhanced-primary-color);\n border-color: var(\n --instrument-enhanced-primary-outline-color,\n transparent\n );\n background: none;\n }\n\n .icon.type-enhance {\n color: var(--instrument-enhanced-secondary-color);\n background: none;\n }\n\n .icon.type-regular {\n color: var(--on-normal-neutral-color);\n }\n\n .number {\n color: var(--element-active-color);\n }\n\n .icon.type-automation {\n color: unset;\n background: none;\n }\n\n & .icon.type-outline {\n width: var(--ui-components-badge-icon-size-flat);\n height: var(--ui-components-badge-icon-size-flat);\n }\n\n .icon.type-outline + .number {\n color: var(--on-normal-neutral-color);\n }\n }\n}\n\n.icon.type-alarm path {\n stroke: var(--alert-alarm-outline-color);\n}\n.icon.type-warning circle {\n stroke: var(--alert-warning-outline-color);\n}\n.icon.type-caution path {\n stroke: var(--alert-caution-outline-color);\n}\n.icon.type-running path {\n stroke: none;\n}\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.2.0-next.2",
3
+ "version": "2.2.0-next.4",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,7 +2,11 @@ import {describe, expect, it} from 'vitest';
2
2
  import {render} from 'vitest-browser-lit';
3
3
  import {html, type TemplateResult} from 'lit';
4
4
  import './alert-button.js';
5
- import {ObcAlertButton, ObcAlertButtonType} from './alert-button.js';
5
+ import {
6
+ ObcAlertButton,
7
+ ObcAlertButtonType,
8
+ ObcAlertCounterItemType,
9
+ } from './alert-button.js';
6
10
  import type {ObcAlertButtonItem} from '../alert-button-item/alert-button-item.js';
7
11
  import {AlertType, FlashingSpeed} from '../../types.js';
8
12
 
@@ -64,16 +68,18 @@ describe('obc-alert-button', () => {
64
68
  const {el, item} = await setup(
65
69
  html`<obc-alert-button
66
70
  globalCounter
71
+ .globalCounterType=${ObcAlertCounterItemType.AlertLevel}
67
72
  .nAlerts=${26}
68
73
  .counts=${counts}
69
74
  .shelvedCount=${9}
70
75
  ></obc-alert-button>`
71
76
  );
72
- expect([item.globalCounter, item.counts, item.shelvedCount]).toEqual([
73
- true,
74
- counts,
75
- 9,
76
- ]);
77
+ expect([
78
+ item.globalCounter,
79
+ item.globalCounterType,
80
+ item.counts,
81
+ item.shelvedCount,
82
+ ]).toEqual([true, ObcAlertCounterItemType.AlertLevel, counts, 9]);
77
83
 
78
84
  el.flatMaxBreakpointPx = window.innerWidth + 1;
79
85
  await el.updateComplete;
@@ -1,5 +1,9 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
- import {ObcAlertButton, ObcAlertButtonType} from './alert-button.js';
2
+ import {
3
+ ObcAlertButton,
4
+ ObcAlertButtonType,
5
+ ObcAlertCounterItemType,
6
+ } from './alert-button.js';
3
7
  import {AlertType, FlashingSpeed} from '../../types.js';
4
8
  import './alert-button.js';
5
9
  import {widthDecorator} from '../../storybook-util.js';
@@ -10,6 +14,7 @@ const meta: Meta<typeof ObcAlertButton> = {
10
14
  component: 'obc-alert-button',
11
15
  args: {
12
16
  counter: true,
17
+ globalCounter: false, // the gate arg, so the global counter controls follow it
13
18
  width: 72,
14
19
  },
15
20
  argTypes: {
@@ -31,6 +36,10 @@ const meta: Meta<typeof ObcAlertButton> = {
31
36
  options: Object.values(FlashingSpeed),
32
37
  control: {type: 'select'},
33
38
  },
39
+ globalCounterType: {
40
+ options: Object.values(ObcAlertCounterItemType),
41
+ control: {type: 'inline-radio'},
42
+ },
34
43
  counts: {control: {type: 'object'}},
35
44
  shelvedCount: {control: {type: 'number', min: 0}},
36
45
  width: {control: {type: 'range', min: 64, max: 1028, step: 1}},
@@ -278,3 +287,25 @@ export const GlobalCounterShelvedSilence: Story = {
278
287
  width: 244,
279
288
  },
280
289
  };
290
+
291
+ export const GlobalCounterAlertLevel: Story = {
292
+ args: {
293
+ globalCounter: true,
294
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
295
+ nAlerts: 26,
296
+ counts: GLOBAL_COUNTS,
297
+ width: 232,
298
+ },
299
+ };
300
+
301
+ export const GlobalCounterAlertLevelShelvedSilence: Story = {
302
+ args: {
303
+ globalCounter: true,
304
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
305
+ nAlerts: 26,
306
+ counts: GLOBAL_COUNTS,
307
+ shelvedCount: 9,
308
+ showSilenceButton: true,
309
+ width: 336,
310
+ },
311
+ };
@@ -9,10 +9,11 @@ import '../../icons/icon-notification-advice-active.js';
9
9
  import '../../icons/icon-silence-iec.js';
10
10
  import '../alert-button-item/alert-button-item.js';
11
11
  import {ObcAlertButtonType} from '../alert-button-item/alert-button-item.js';
12
+ import {ObcAlertCounterItemType} from '../alert-counter-item/alert-counter-item.js';
12
13
  import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
13
14
  import {customElement} from '../../decorator.js';
14
15
 
15
- export {ObcAlertButtonType};
16
+ export {ObcAlertButtonType, ObcAlertCounterItemType};
16
17
 
17
18
  /**
18
19
  * `<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.
@@ -29,7 +30,7 @@ export {ObcAlertButtonType};
29
30
  * - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.
30
31
  * - **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.
31
32
  * - **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).
32
- * - **Global Counter:** `globalCounter` shows the per-severity `counts` and an optional `shelvedCount` before the bell and the total, as `obc-alert-button-item` draws them.
33
+ * - **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.
33
34
  * - **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.
34
35
  * - **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).
35
36
  * - **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.
@@ -87,6 +88,8 @@ export {ObcAlertButtonType};
87
88
  * @availableWhen silenceButtonDisabled showSilenceButton==true
88
89
  * @property counter - Shows the alert counter when there are active alerts and the button is not flat.
89
90
  * @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.
91
+ * @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).
92
+ * @availableWhen globalCounterType globalCounter==true
90
93
  * @property counts - Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts).
91
94
  * @availableWhen counts globalCounter==true
92
95
  * @property shelvedCount - Number of shelved alerts, shown after the global counter badges; hidden at zero.
@@ -113,6 +116,8 @@ export class ObcAlertButton extends LitElement {
113
116
  @property({type: Boolean}) silenceButtonDisabled = false;
114
117
  @property({type: Boolean}) counter = false;
115
118
  @property({type: Boolean}) globalCounter = false;
119
+ @property({type: String}) globalCounterType: ObcAlertCounterItemType =
120
+ ObcAlertCounterItemType.Badges;
116
121
  @property({type: Object, attribute: false}) counts: AlertCounts = {};
117
122
  @property({type: Number}) shelvedCount = 0;
118
123
  @property({type: Boolean}) blinking = false;
@@ -173,6 +178,7 @@ export class ObcAlertButton extends LitElement {
173
178
  .globalCounter=${
174
179
  this.globalCounter && this.activeType !== ObcAlertButtonType.Flat
175
180
  }
181
+ .globalCounterType=${this.globalCounterType}
176
182
  .counts=${this.counts}
177
183
  .shelvedCount=${this.shelvedCount}
178
184
  .blinking=${this.blinking}
@@ -4,7 +4,10 @@ import {userEvent} from '@vitest/browser/context';
4
4
  import {html} from 'lit';
5
5
  import './alert-button-item.js';
6
6
  import {ObcAlertButtonItem, ObcAlertButtonType} from './alert-button-item.js';
7
- import type {ObcAlertCounterItem} from '../alert-counter-item/alert-counter-item.js';
7
+ import {
8
+ ObcAlertCounterItemType,
9
+ type ObcAlertCounterItem,
10
+ } from '../alert-counter-item/alert-counter-item.js';
8
11
  import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
9
12
 
10
13
  type ItemProps = Partial<
@@ -15,6 +18,7 @@ type ItemProps = Partial<
15
18
  | 'nAlerts'
16
19
  | 'counter'
17
20
  | 'globalCounter'
21
+ | 'globalCounterType'
18
22
  | 'counts'
19
23
  | 'shelvedCount'
20
24
  | 'blinking'
@@ -45,6 +49,10 @@ async function setup(props: ItemProps = {}) {
45
49
  const el = screen.container.querySelector(
46
50
  'obc-alert-button-item'
47
51
  ) as ObcAlertButtonItem;
52
+ // Set only when given, so the default case exercises the element's own default.
53
+ if (props.globalCounterType !== undefined) {
54
+ el.globalCounterType = props.globalCounterType;
55
+ }
48
56
  await el.updateComplete;
49
57
  return el;
50
58
  }
@@ -173,6 +181,27 @@ describe('obc-alert-button-item global counter', () => {
173
181
  ).toBe('12');
174
182
  });
175
183
 
184
+ it('passes the counter type on, badges by default', async () => {
185
+ const counterType = async (props: ItemProps) =>
186
+ (
187
+ (
188
+ await setup({globalCounter: true, nAlerts: 12, ...props})
189
+ ).shadowRoot!.querySelector(
190
+ 'obc-alert-counter-item'
191
+ ) as ObcAlertCounterItem
192
+ ).type;
193
+
194
+ expect(await counterType({counts: SEVERITY_COUNTS})).toBe(
195
+ ObcAlertCounterItemType.Badges
196
+ );
197
+ expect(
198
+ await counterType({
199
+ counts: SEVERITY_COUNTS,
200
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
201
+ })
202
+ ).toBe(ObcAlertCounterItemType.AlertLevel);
203
+ });
204
+
176
205
  it('uses the normal style whatever the type', async () => {
177
206
  const el = await setup({
178
207
  globalCounter: true,
@@ -2,6 +2,7 @@ import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
2
  import {html} from 'lit';
3
3
  import {ObcAlertButtonItem, ObcAlertButtonType} from './alert-button-item.js';
4
4
  import './alert-button-item.js';
5
+ import {ObcAlertCounterItemType} from '../alert-counter-item/alert-counter-item.js';
5
6
  import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
6
7
 
7
8
  type ItemArgs = Pick<
@@ -11,6 +12,7 @@ type ItemArgs = Pick<
11
12
  | 'nAlerts'
12
13
  | 'counter'
13
14
  | 'globalCounter'
15
+ | 'globalCounterType'
14
16
  | 'counts'
15
17
  | 'shelvedCount'
16
18
  | 'blinking'
@@ -33,6 +35,9 @@ const renderItem = (args: Partial<ItemArgs>) =>
33
35
  .nAlerts=${args.nAlerts ?? 0}
34
36
  .counter=${args.counter ?? false}
35
37
  .globalCounter=${args.globalCounter ?? false}
38
+ .globalCounterType=${
39
+ args.globalCounterType ?? ObcAlertCounterItemType.Badges
40
+ }
36
41
  .counts=${args.counts ?? {}}
37
42
  .shelvedCount=${args.shelvedCount ?? 0}
38
43
  .blinking=${args.blinking ?? false}
@@ -59,6 +64,10 @@ const meta: Meta<ItemArgs> = {
59
64
  },
60
65
  alertType: {control: {type: 'select'}, options: Object.values(AlertType)},
61
66
  nAlerts: {control: {type: 'number', min: 0}},
67
+ globalCounterType: {
68
+ control: {type: 'inline-radio'},
69
+ options: Object.values(ObcAlertCounterItemType),
70
+ },
62
71
  counts: {control: {type: 'object'}},
63
72
  shelvedCount: {control: {type: 'number', min: 0}},
64
73
  flashingSpeed: {
@@ -151,6 +160,25 @@ export const GlobalCounterWithShelved: Story = {
151
160
  },
152
161
  };
153
162
 
163
+ export const GlobalCounterAlertLevel: Story = {
164
+ args: {
165
+ globalCounter: true,
166
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
167
+ nAlerts: 12,
168
+ counts: SEVERITY_COUNTS,
169
+ },
170
+ };
171
+
172
+ export const GlobalCounterAlertLevelWithShelved: Story = {
173
+ args: {
174
+ globalCounter: true,
175
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
176
+ nAlerts: 12,
177
+ counts: SEVERITY_COUNTS,
178
+ shelvedCount: 9,
179
+ },
180
+ };
181
+
154
182
  export const GlobalCounterLevelSeverities: Story = {
155
183
  args: {
156
184
  globalCounter: true,
@@ -60,7 +60,8 @@ export enum ObcAlertButtonType {
60
60
  * `nAlerts` of 0 shows the idle bell.
61
61
  * - **Counter:** `counter` shows `nAlerts` next to the bell, except in `flat`.
62
62
  * - **Global counter:** `globalCounter` shows the per-severity `counts` as
63
- * badges, then the bell and `nAlerts`, always in the normal style.
63
+ * badges, then the bell and `nAlerts`, always in the normal style;
64
+ * `globalCounterType` picks filled badges or the severity shapes.
64
65
  * - **Flashing:** `blinking` flashes the bell at the tempo `flashingSpeed`
65
66
  * resolves (#1224).
66
67
  * - **Fill height:** `fillHeight` stretches the visible button to the host
@@ -104,6 +105,8 @@ export enum ObcAlertButtonType {
104
105
  * @property counter - Shows `nAlerts` next to the bell (not in `flat`).
105
106
  * @availableWhen counter globalCounter==false
106
107
  * @property globalCounter - Shows the per-severity counts, the bell and the total instead of a single alert status.
108
+ * @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).
109
+ * @availableWhen globalCounterType globalCounter==true
107
110
  * @property counts - Alert count per severity for the global counter badges.
108
111
  * @availableWhen counts globalCounter==true
109
112
  * @property shelvedCount - Number of shelved alerts, shown after the global counter badges.
@@ -126,6 +129,8 @@ export class ObcAlertButtonItem extends LitElement {
126
129
  @property({type: Number}) nAlerts = 0;
127
130
  @property({type: Boolean}) counter = false;
128
131
  @property({type: Boolean}) globalCounter = false;
132
+ @property({type: String}) globalCounterType: ObcAlertCounterItemType =
133
+ ObcAlertCounterItemType.Badges;
129
134
  @property({type: Object, attribute: false}) counts: AlertCounts = {};
130
135
  @property({type: Number}) shelvedCount = 0;
131
136
  @property({type: Boolean}) blinking = false;
@@ -235,7 +240,7 @@ export class ObcAlertButtonItem extends LitElement {
235
240
  return nothing;
236
241
  }
237
242
  return html`<obc-alert-counter-item
238
- .type=${ObcAlertCounterItemType.Badges}
243
+ .type=${this.globalCounterType}
239
244
  .counts=${this.counts}
240
245
  .shelvedCount=${this.shelvedCount}
241
246
  ></obc-alert-counter-item>`;
@@ -8,7 +8,7 @@
8
8
  gap: var(--app-components-alert-counter-item-badge-spacing);
9
9
  }
10
10
 
11
- obi-alerts-shelf {
11
+ obi-timer-2 {
12
12
  display: block; /* fills the badge icon box that sizes the badge-icon slot */
13
13
  width: 100%;
14
14
  height: 100%;
@@ -1,6 +1,7 @@
1
1
  import {describe, expect, it} from 'vitest';
2
2
  import {render} from 'vitest-browser-lit';
3
3
  import {html} from 'lit';
4
+ import '../../main.css';
4
5
  import './alert-counter-item.js';
5
6
  import {
6
7
  ObcAlertCounterItem,
@@ -36,6 +37,15 @@ function lastBadge(el: ObcAlertCounterItem): ObcBadge {
36
37
  return all[all.length - 1];
37
38
  }
38
39
 
40
+ /** Top and bottom edge of each drawn badge box, in CSS px. */
41
+ function badgeEdges(el: ObcAlertCounterItem): [number, number][] {
42
+ return badges(el).map((badge) => {
43
+ const box = badge.shadowRoot!.querySelector('.wrapper')!;
44
+ const {top, bottom} = box.getBoundingClientRect();
45
+ return [top, bottom];
46
+ });
47
+ }
48
+
39
49
  describe('obc-alert-counter-item', () => {
40
50
  it('renders one filled badge per positive count, most severe first', async () => {
41
51
  const el = await setup({countCaution: 6, countAlarm: 2, countWarning: 0});
@@ -59,18 +69,34 @@ describe('obc-alert-counter-item', () => {
59
69
  ]);
60
70
  });
61
71
 
62
- it('adds the shelved count last', async () => {
72
+ it('adds the shelved count last, with the timer icon in both types', async () => {
63
73
  const filled = await setup({countAlarm: 2}, {shelvedCount: 9});
64
- expect([lastBadge(filled).type, lastBadge(filled).number]).toEqual([
65
- 'regular',
66
- 9,
67
- ]);
74
+ expect([
75
+ lastBadge(filled).type,
76
+ lastBadge(filled).number,
77
+ lastBadge(filled).showIcon,
78
+ ]).toEqual(['regular', 9, true]);
79
+ expect(lastBadge(filled).querySelector('obi-timer-2')).not.toBeNull();
68
80
 
69
81
  const level = await setup(
70
82
  {countAlarm: 2},
71
83
  {type: ObcAlertCounterItemType.AlertLevel, shelvedCount: 9}
72
84
  );
73
- expect(lastBadge(level).querySelector('obi-alerts-shelf')).not.toBeNull();
85
+ expect(lastBadge(level).querySelector('obi-timer-2')).not.toBeNull();
86
+ });
87
+
88
+ it('draws every badge box on the same top and bottom edge', async () => {
89
+ for (const type of Object.values(ObcAlertCounterItemType)) {
90
+ const el = await setup(
91
+ {countAlarm: 2, countWarning: 4, countCaution: 6},
92
+ {type, shelvedCount: 9}
93
+ );
94
+ const [first, ...rest] = badgeEdges(el);
95
+
96
+ for (const edges of rest) {
97
+ expect(edges, type).toEqual(first);
98
+ }
99
+ }
74
100
  });
75
101
 
76
102
  it('renders nothing when nothing is counted', async () => {
@@ -6,7 +6,7 @@ import componentStyle from './alert-counter-item.css?inline';
6
6
  import {customElement} from '../../decorator.js';
7
7
  import '../badge/badge.js';
8
8
  import {BadgeSize, BadgeType, BadgeVariant} from '../badge/badge.js';
9
- import '../../icons/icon-alerts-shelf.js';
9
+ import '../../icons/icon-timer-2.js';
10
10
  import type {AlertCounts} from '../../types.js';
11
11
  import {alertCountsLabel, rankAlertCounts} from '../../alert-severity.js';
12
12
 
@@ -35,8 +35,8 @@ export enum ObcAlertCounterItemType {
35
35
  * `alert-level` draws flat badges with the severity glyph.
36
36
  * - **Every severity:** `counts` takes the whole `AlertType` vocabulary,
37
37
  * including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.
38
- * - **Shelved count:** `shelvedCount` adds a neutral badge at the end, with
39
- * the shelf icon in `alert-level`.
38
+ * - **Shelved count:** `shelvedCount` adds a neutral badge with the timer icon
39
+ * at the end, the icon the Figma counter swaps into its shelved badge.
40
40
  * - **Accessible summary:** the row is announced as one image labelled with
41
41
  * the counts, e.g. "2 Alarm, 4 Warning, 6 Caution".
42
42
  *
@@ -51,6 +51,9 @@ export enum ObcAlertCounterItemType {
51
51
  * `obc-alert-subsystem-counter`.
52
52
  * - **TODO(designer):** the Figma component also has an Unacked counter type;
53
53
  * how its icons map to counts is not defined yet.
54
+ * - **TODO(designer):** the Figma component draws alarm, warning and caution;
55
+ * critical and diagnostic use the `level-critical` and `level-diagnostic`
56
+ * badges of `obc-badge` (#1389).
54
57
  *
55
58
  * ---
56
59
  *
@@ -65,7 +68,7 @@ export enum ObcAlertCounterItemType {
65
68
  *
66
69
  * @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).
67
70
  * @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.
68
- * @property shelvedCount - Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero.
71
+ * @property shelvedCount - Number of shelved alerts, shown as a neutral badge with the timer icon after the severities; hidden at zero.
69
72
  * @experimental
70
73
  */
71
74
  @customElement('obc-alert-counter-item')
@@ -107,16 +110,10 @@ export class ObcAlertCounterItem extends LitElement {
107
110
  size=${BadgeSize.large}
108
111
  type=${BadgeType.regular}
109
112
  .variant=${variant}
110
- .showIcon=${alertLevel}
113
+ showIcon
111
114
  .number=${this.shelvedCount}
112
115
  >
113
- ${
114
- alertLevel
115
- ? html`<obi-alerts-shelf
116
- slot="badge-icon"
117
- ></obi-alerts-shelf>`
118
- : nothing
119
- }
116
+ <obi-timer-2 slot="badge-icon"></obi-timer-2>
120
117
  </obc-badge>`
121
118
  : nothing
122
119
  }
@@ -1,3 +1,7 @@
1
+ :host {
2
+ line-height: 0; /* in a flex row, the host's text line adds the font's descent under an icon-first badge */
3
+ }
4
+
1
5
  .wrapper {
2
6
  user-select: none;
3
7
  display: flex;
@@ -161,6 +165,12 @@
161
165
  min-height: var(--ui-components-badge-icon-size);
162
166
  }
163
167
 
168
+ /* Figma binds the flat large icon frame to the badge height, not icon-size-large */
169
+ &.size-large .icon {
170
+ width: var(--ui-components-badge-min-size-large);
171
+ height: var(--ui-components-badge-min-size-large);
172
+ }
173
+
164
174
  .icon.type-alarm {
165
175
  color: unset;
166
176
  border-color: var(--alert-alarm-outline-color);