@oicl/openbridge-webcomponents 2.2.0-next.5 → 2.2.0-next.6

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 (50) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +542 -6
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +854 -197
  4. package/dist/components/alert-button-item/alert-button-item.css.js +65 -1
  5. package/dist/components/alert-button-item/alert-button-item.css.js.map +1 -1
  6. package/dist/components/alert-button-item/alert-button-item.d.ts +14 -1
  7. package/dist/components/alert-button-item/alert-button-item.d.ts.map +1 -1
  8. package/dist/components/alert-button-item/alert-button-item.js +19 -2
  9. package/dist/components/alert-button-item/alert-button-item.js.map +1 -1
  10. package/dist/components/alert-subsystem-button/alert-subsystem-button.css.js +120 -0
  11. package/dist/components/alert-subsystem-button/alert-subsystem-button.css.js.map +1 -0
  12. package/dist/components/alert-subsystem-button/alert-subsystem-button.d.ts +105 -0
  13. package/dist/components/alert-subsystem-button/alert-subsystem-button.d.ts.map +1 -0
  14. package/dist/components/alert-subsystem-button/alert-subsystem-button.js +107 -0
  15. package/dist/components/alert-subsystem-button/alert-subsystem-button.js.map +1 -0
  16. package/dist/components/alert-subsystem-counter/alert-subsystem-counter.css.js +4 -0
  17. package/dist/components/alert-subsystem-counter/alert-subsystem-counter.css.js.map +1 -1
  18. package/dist/components/alert-subsystem-counter/alert-subsystem-counter.d.ts +3 -1
  19. package/dist/components/alert-subsystem-counter/alert-subsystem-counter.d.ts.map +1 -1
  20. package/dist/components/alert-subsystem-counter/alert-subsystem-counter.js +7 -1
  21. package/dist/components/alert-subsystem-counter/alert-subsystem-counter.js.map +1 -1
  22. package/dist/components/diagnostic-button/diagnostic-button.css.js +18 -0
  23. package/dist/components/diagnostic-button/diagnostic-button.css.js.map +1 -0
  24. package/dist/components/diagnostic-button/diagnostic-button.d.ts +71 -0
  25. package/dist/components/diagnostic-button/diagnostic-button.d.ts.map +1 -0
  26. package/dist/components/diagnostic-button/diagnostic-button.js +52 -0
  27. package/dist/components/diagnostic-button/diagnostic-button.js.map +1 -0
  28. package/dist/components/diagnostic-menu/diagnostic-menu.css.js +109 -0
  29. package/dist/components/diagnostic-menu/diagnostic-menu.css.js.map +1 -0
  30. package/dist/components/diagnostic-menu/diagnostic-menu.d.ts +111 -0
  31. package/dist/components/diagnostic-menu/diagnostic-menu.d.ts.map +1 -0
  32. package/dist/components/diagnostic-menu/diagnostic-menu.js +90 -0
  33. package/dist/components/diagnostic-menu/diagnostic-menu.js.map +1 -0
  34. package/dist/components/icon-button/icon-button.js +2 -2
  35. package/dist/components/icon-button/icon-button.js.map +1 -1
  36. package/dist/components/top-bar/top-bar.css.js +1 -0
  37. package/dist/components/top-bar/top-bar.css.js.map +1 -1
  38. package/dist/components/top-bar/top-bar.d.ts +4 -0
  39. package/dist/components/top-bar/top-bar.d.ts.map +1 -1
  40. package/dist/components/top-bar/top-bar.js +1 -0
  41. package/dist/components/top-bar/top-bar.js.map +1 -1
  42. package/dist/generated/locales/es-419.d.ts +6 -0
  43. package/dist/generated/locales/es-419.d.ts.map +1 -1
  44. package/dist/generated/locales/es-419.js +6 -0
  45. package/dist/generated/locales/es-419.js.map +1 -1
  46. package/dist/generated/locales/fi-FI.d.ts +6 -0
  47. package/dist/generated/locales/fi-FI.d.ts.map +1 -1
  48. package/dist/generated/locales/fi-FI.js +6 -0
  49. package/dist/generated/locales/fi-FI.js.map +1 -1
  50. package/package.json +1 -1
@@ -30,7 +30,8 @@ var alert_button_item_default = css`* {
30
30
  height: 100%;
31
31
  }
32
32
 
33
- .icon {
33
+ .icon,
34
+ ::slotted([slot="icon"]) {
34
35
  display: block;
35
36
  width: var(--app-components-alert-button-item-icon-size);
36
37
  height: var(--app-components-alert-button-item-icon-size);
@@ -1505,6 +1506,69 @@ var alert_button_item_default = css`* {
1505
1506
  color: var(--on-notification-active-color);
1506
1507
  }
1507
1508
 
1509
+ /* After the type rules, which it ties on specificity. Not named .activated:
1510
+ the mixin's own activated state would match twice, and the selected style
1511
+ has no tokens for it. */
1512
+ .alert-button.selected {
1513
+ cursor: pointer;
1514
+ }
1515
+ .alert-button.selected:focus {
1516
+ outline: none;
1517
+ }
1518
+ .alert-button.selected .visible-wrapper {
1519
+ border-color: var(--selected-enabled-border-color);
1520
+ background-color: var(--selected-enabled-background-color);
1521
+ border-width: 1px;
1522
+ border-style: solid;
1523
+ cursor: pointer;
1524
+ --base-border-color: var(--selected-enabled-border-color);
1525
+ --base-background-color: var(--selected-enabled-background-color);
1526
+ }
1527
+ .alert-button.selected.activated .visible-wrapper {
1528
+ border-color: var(--selected-activated-border-color);
1529
+ background-color: var(--selected-activated-background-color);
1530
+ --base-border-color: var(--selected-activated-border-color);
1531
+ --base-background-color: var(--selected-activated-background-color);
1532
+ }
1533
+ @media (hover:hover) {
1534
+ .alert-button.selected:hover .visible-wrapper {
1535
+ border-color: color-mix(in srgb, var(--selected-hover-border-color) calc(var(--obc-can-hover) * 100%), var(--base-border-color));
1536
+ background-color: color-mix(in srgb, var(--selected-hover-background-color) calc(var(--obc-can-hover) * 100%), var(--base-background-color));
1537
+ }
1538
+ }
1539
+ .alert-button.selected:active .visible-wrapper {
1540
+ border-color: var(--selected-pressed-border-color);
1541
+ background-color: var(--selected-pressed-background-color);
1542
+ }
1543
+ .alert-button.selected:focus-visible .visible-wrapper {
1544
+ outline-color: var(--border-focus-color);
1545
+ outline-width: var(--global-size-spacing-border-weight-focusframe);
1546
+ outline-style: solid;
1547
+ border-color: var(--container-global-color);
1548
+ z-index: 1;
1549
+ }
1550
+ .alert-button.selected:disabled .visible-wrapper {
1551
+ border-color: var(--selected-disabled-border-color);
1552
+ background-color: var(--selected-disabled-background-color);
1553
+ cursor: not-allowed;
1554
+ color: var(--on-selected-disabled-color) !important;
1555
+ }
1556
+ .alert-button.selected.disabled .visible-wrapper {
1557
+ border-color: var(--selected-disabled-border-color);
1558
+ background-color: var(--selected-disabled-background-color);
1559
+ cursor: not-allowed;
1560
+ color: var(--on-selected-disabled-color) !important;
1561
+ }
1562
+ .alert-button.selected:disabled {
1563
+ cursor: not-allowed;
1564
+ }
1565
+ .alert-button.selected.disabled {
1566
+ cursor: not-allowed;
1567
+ }
1568
+ .alert-button.selected .visible-wrapper {
1569
+ color: var(--on-selected-active-color);
1570
+ }
1571
+
1508
1572
  .flash-fast .visible-wrapper {
1509
1573
  opacity: var(--flash-fast-on);
1510
1574
  }
@@ -1 +1 @@
1
- {"version":3,"file":"alert-button-item.css.js","names":[],"sources":["../../../src/components/alert-button-item/alert-button-item.css?inline"],"sourcesContent":["* {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-flex;\n}\n\n.alert-button {\n appearance: none;\n background: none;\n border: none;\n padding: 0;\n position: relative; /* containing block of the .blink layer */\n display: flex;\n flex-grow: 1; /* fills the width a parent gives the host */\n align-items: center;\n justify-content: center;\n min-width: var(--app-components-alert-button-item-min-width);\n height: var(--app-components-alert-button-item-touch-target-size);\n\n &.fill-height {\n height: 100%;\n }\n}\n\n.icon {\n display: block;\n width: var(--app-components-alert-button-item-icon-size);\n height: var(--app-components-alert-button-item-icon-size);\n}\n\n.visible-wrapper,\n.blink {\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--app-components-alert-button-item-visual-target-size);\n min-width: var(--ui-components-icon-button-visual-target-size);\n border-radius: var(--ui-components-button-border-radius-top-left)\n var(--ui-components-button-border-radius-top-right)\n var(--ui-components-button-border-radius-bottom-right)\n var(--ui-components-button-border-radius-bottom-left);\n color: var(--on-normal-neutral-color);\n @mixin font-button;\n\n .fill-height & {\n height: 100%;\n }\n\n /* a parent joins another button to this end */\n :host([data-group-item-not-last]) & {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n\n.blink {\n position: absolute;\n inset: 0;\n margin: auto; /* centres the fixed-height layer in the touch target */\n}\n\n.content {\n display: flex;\n align-items: center;\n gap: var(--app-components-alert-button-item-counter-spacing);\n}\n\n.counter .content {\n /* the Figma stroke is drawn inside the frame, over this padding */\n padding: 0 calc(var(--ui-components-button-padding-horizontal) - 1px);\n}\n\n.count {\n padding-right: var(--app-components-alert-button-item-padding-counter-right);\n}\n\n.global-counter {\n & .visible-wrapper {\n /* the Figma stroke is drawn inside the frame, over this padding */\n padding: 0\n calc(var(--app-components-alert-button-item-padding-horizontal) - 1px);\n }\n\n & .content {\n padding: 0 var(--ui-components-button-padding-horizontal);\n }\n}\n\n.type-flat {\n @mixin style style=flat visibleWrapperClass=.visible-wrapper;\n @mixin style style=flat visibleWrapperClass=.blink;\n\n & .visible-wrapper {\n color: var(--on-flat-neutral-color);\n }\n\n & .blink {\n width: min-content;\n }\n}\n\n.type-normal .visible-wrapper,\n.type-enhanced .visible-wrapper {\n width: 100%;\n}\n\n.type-normal {\n @mixin style style=normal visibleWrapperClass=.visible-wrapper;\n @mixin style style=normal visibleWrapperClass=.blink;\n}\n\n.type-enhanced.alert-type-alarm {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=alarm visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-alarm-active-color);\n }\n}\n\n.type-enhanced.alert-type-warning {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=warning visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-warning-active-color);\n }\n}\n\n.type-enhanced.alert-type-caution {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=caution visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-caution-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-critical {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=critical visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-critical-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-high {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=alarm visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-alarm-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-medium {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=warning visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-warning-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-low {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=caution visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-caution-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-diagnostic {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=notification visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-notification-active-color);\n }\n}\n\n.flash-fast {\n & .visible-wrapper {\n opacity: var(--flash-fast-on);\n }\n\n & .blink {\n opacity: var(--flash-fast-off);\n }\n}\n\n.flash-slow {\n & .visible-wrapper {\n opacity: var(--flash-slow-on);\n }\n\n & .blink {\n opacity: var(--flash-slow-off);\n }\n}\n\n.flash-very-slow {\n & .visible-wrapper {\n opacity: var(--flash-very-slow-on);\n }\n\n & .blink {\n opacity: var(--flash-very-slow-off);\n }\n}\n\n.alert-type-alarm {\n --icon-fill: var(--alarm-enabled-background-color);\n --icon-stroke: var(--alarm-pressed-border-color);\n}\n\n.alert-type-warning {\n --icon-fill: var(--warning-enabled-background-color);\n --icon-stroke: var(--warning-pressed-border-color);\n}\n\n.alert-type-caution,\n.alert-type-level-low {\n --icon-fill: var(--caution-enabled-background-color);\n --icon-stroke: var(--caution-pressed-border-color);\n}\n\n.alert-type-level-critical {\n --icon-fill: var(--alert-critical-color);\n --icon-stroke: var(--alert-critical-outline-color);\n}\n\n.alert-type-level-high {\n --icon-fill: var(--alarm-enabled-background-color);\n --icon-stroke: var(--alarm-pressed-border-color);\n}\n\n.alert-type-level-medium {\n --icon-fill: var(--warning-enabled-background-color);\n --icon-stroke: var(--warning-pressed-border-color);\n}\n\n.alert-type-level-diagnostic {\n --icon-fill: var(--alert-diagnostic-color);\n --icon-stroke: var(--alert-diagnostic-outline-color);\n}\n\n/* The name lives on the button; a change of counts is announced from here. */\n.announcement {\n @mixin visually-hidden;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"alert-button-item.css.js","names":[],"sources":["../../../src/components/alert-button-item/alert-button-item.css?inline"],"sourcesContent":["* {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-flex;\n}\n\n.alert-button {\n appearance: none;\n background: none;\n border: none;\n padding: 0;\n position: relative; /* containing block of the .blink layer */\n display: flex;\n flex-grow: 1; /* fills the width a parent gives the host */\n align-items: center;\n justify-content: center;\n min-width: var(--app-components-alert-button-item-min-width);\n height: var(--app-components-alert-button-item-touch-target-size);\n\n &.fill-height {\n height: 100%;\n }\n}\n\n.icon,\n::slotted([slot=\"icon\"]) {\n display: block;\n width: var(--app-components-alert-button-item-icon-size);\n height: var(--app-components-alert-button-item-icon-size);\n}\n\n.visible-wrapper,\n.blink {\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--app-components-alert-button-item-visual-target-size);\n min-width: var(--ui-components-icon-button-visual-target-size);\n border-radius: var(--ui-components-button-border-radius-top-left)\n var(--ui-components-button-border-radius-top-right)\n var(--ui-components-button-border-radius-bottom-right)\n var(--ui-components-button-border-radius-bottom-left);\n color: var(--on-normal-neutral-color);\n @mixin font-button;\n\n .fill-height & {\n height: 100%;\n }\n\n /* a parent joins another button to this end */\n :host([data-group-item-not-last]) & {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n\n.blink {\n position: absolute;\n inset: 0;\n margin: auto; /* centres the fixed-height layer in the touch target */\n}\n\n.content {\n display: flex;\n align-items: center;\n gap: var(--app-components-alert-button-item-counter-spacing);\n}\n\n.counter .content {\n /* the Figma stroke is drawn inside the frame, over this padding */\n padding: 0 calc(var(--ui-components-button-padding-horizontal) - 1px);\n}\n\n.count {\n padding-right: var(--app-components-alert-button-item-padding-counter-right);\n}\n\n.global-counter {\n & .visible-wrapper {\n /* the Figma stroke is drawn inside the frame, over this padding */\n padding: 0\n calc(var(--app-components-alert-button-item-padding-horizontal) - 1px);\n }\n\n & .content {\n padding: 0 var(--ui-components-button-padding-horizontal);\n }\n}\n\n.type-flat {\n @mixin style style=flat visibleWrapperClass=.visible-wrapper;\n @mixin style style=flat visibleWrapperClass=.blink;\n\n & .visible-wrapper {\n color: var(--on-flat-neutral-color);\n }\n\n & .blink {\n width: min-content;\n }\n}\n\n.type-normal .visible-wrapper,\n.type-enhanced .visible-wrapper {\n width: 100%;\n}\n\n.type-normal {\n @mixin style style=normal visibleWrapperClass=.visible-wrapper;\n @mixin style style=normal visibleWrapperClass=.blink;\n}\n\n.type-enhanced.alert-type-alarm {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=alarm visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-alarm-active-color);\n }\n}\n\n.type-enhanced.alert-type-warning {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=warning visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-warning-active-color);\n }\n}\n\n.type-enhanced.alert-type-caution {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=caution visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-caution-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-critical {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=critical visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-critical-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-high {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=alarm visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-alarm-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-medium {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=warning visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-warning-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-low {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=caution visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-caution-active-color);\n }\n}\n\n.type-enhanced.alert-type-level-diagnostic {\n @mixin style style=normal visibleWrapperClass=.blink;\n @mixin style style=notification visibleWrapperClass=.visible-wrapper;\n & .visible-wrapper {\n color: var(--on-notification-active-color);\n }\n}\n\n/* After the type rules, which it ties on specificity. Not named .activated:\n the mixin's own activated state would match twice, and the selected style\n has no tokens for it. */\n.alert-button.selected {\n @mixin style style=selected visibleWrapperClass=.visible-wrapper;\n\n & .visible-wrapper {\n color: var(--on-selected-active-color);\n }\n}\n\n.flash-fast {\n & .visible-wrapper {\n opacity: var(--flash-fast-on);\n }\n\n & .blink {\n opacity: var(--flash-fast-off);\n }\n}\n\n.flash-slow {\n & .visible-wrapper {\n opacity: var(--flash-slow-on);\n }\n\n & .blink {\n opacity: var(--flash-slow-off);\n }\n}\n\n.flash-very-slow {\n & .visible-wrapper {\n opacity: var(--flash-very-slow-on);\n }\n\n & .blink {\n opacity: var(--flash-very-slow-off);\n }\n}\n\n.alert-type-alarm {\n --icon-fill: var(--alarm-enabled-background-color);\n --icon-stroke: var(--alarm-pressed-border-color);\n}\n\n.alert-type-warning {\n --icon-fill: var(--warning-enabled-background-color);\n --icon-stroke: var(--warning-pressed-border-color);\n}\n\n.alert-type-caution,\n.alert-type-level-low {\n --icon-fill: var(--caution-enabled-background-color);\n --icon-stroke: var(--caution-pressed-border-color);\n}\n\n.alert-type-level-critical {\n --icon-fill: var(--alert-critical-color);\n --icon-stroke: var(--alert-critical-outline-color);\n}\n\n.alert-type-level-high {\n --icon-fill: var(--alarm-enabled-background-color);\n --icon-stroke: var(--alarm-pressed-border-color);\n}\n\n.alert-type-level-medium {\n --icon-fill: var(--warning-enabled-background-color);\n --icon-stroke: var(--warning-pressed-border-color);\n}\n\n.alert-type-level-diagnostic {\n --icon-fill: var(--alert-diagnostic-color);\n --icon-stroke: var(--alert-diagnostic-outline-color);\n}\n\n/* The name lives on the button; a change of counts is announced from here. */\n.announcement {\n @mixin visually-hidden;\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit';
1
+ import { LitElement, PropertyValues } from 'lit';
2
2
  import { ObcAlertCounterItemType } from '../alert-counter-item/alert-counter-item.js';
3
3
  import { AlertType, FlashingSpeed, AlertCounts, ResolvedFlashingSpeed } from '../../types.js';
4
4
  import { FlashingController } from '../../palettes/flashing-controller.js';
@@ -45,6 +45,10 @@ export declare enum ObcAlertButtonType {
45
45
  * resolves (#1224).
46
46
  * - **Fill height:** `fillHeight` stretches the visible button to the host
47
47
  * height, as the tall `obc-alert-button` does.
48
+ * - **Icon slot:** the `icon` slot replaces the bell with any icon; the item
49
+ * then never flashes.
50
+ * - **Activated:** `activated` draws the selected style, for a button whose
51
+ * panel is showing.
48
52
  *
49
53
  * ---
50
54
  *
@@ -95,7 +99,10 @@ export declare enum ObcAlertButtonType {
95
99
  * @property flashingSpeed - Flash tempo while `blinking` is on: `default` resolves from `alertType`, `fast`, `slow`, `very-slow` force a tempo, `fixed` never flashes.
96
100
  * @availableWhen flashingSpeed blinking==true
97
101
  * @property fillHeight - Stretches the visible button to the host height instead of the 32 px visual target.
102
+ * @property activated - Draws the button in the selected style, for a button whose panel is showing.
98
103
  * @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.
104
+ * @property ariaExpanded - Whether the panel the button opens is showing, forwarded to the inner `<button>` as `aria-expanded`; mapped to the `aria-expanded` attribute. Set it with `activated` from the flag that drives the panel; left unset, the button announces no panel.
105
+ * @slot icon - Replaces the bell. The flash cross-fades two bells, so a slotted icon never flashes and `blinking` has no effect while the slot is filled.
99
106
  * @fires click - Fired when the button is clicked.
100
107
  * @experimental
101
108
  */
@@ -154,8 +161,14 @@ export declare class ObcAlertButtonItem extends LitElement {
154
161
  flashingSpeed: FlashingSpeed;
155
162
  /** Stretches the visible button to the host height instead of the 32 px visual target. */
156
163
  fillHeight: boolean;
164
+ /** Draws the button in the selected style, for a button whose panel is showing. */
165
+ activated: boolean;
157
166
  /** 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. */
158
167
  ariaLabel: string | null;
168
+ /** Whether the panel the button opens is showing, forwarded to the inner `<button>` as `aria-expanded`; mapped to the `aria-expanded` attribute. Set it with `activated` from the flag that drives the panel; left unset, the button announces no panel. */
169
+ ariaExpanded: string | null;
170
+ private hasSlottedIcon;
171
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
159
172
  protected readonly flashing: FlashingController;
160
173
  get resolvedFlashingSpeed(): ResolvedFlashingSpeed;
161
174
  private get accessibleName();
@@ -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;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"}
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,EAAE,cAAc,EAA2B,MAAM,KAAK,CAAC;AAOzE,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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16
16
  import { LitElement, html, nothing, unsafeCSS } from "lit";
17
17
  import { property } from "lit/decorators.js";
18
18
  import { classMap } from "lit/directives/class-map.js";
19
+ import { ifDefined } from "lit/directives/if-defined.js";
19
20
  //#region src/components/alert-button-item/alert-button-item.ts
20
21
  /**
21
22
  * `ObcAlertButtonType` – Enum for alert button visual and behavioral variants.
@@ -43,11 +44,18 @@ var ObcAlertButtonItem = class ObcAlertButtonItem extends LitElement {
43
44
  this.blinking = false;
44
45
  this.flashingSpeed = FlashingSpeed.Default;
45
46
  this.fillHeight = false;
47
+ this.activated = false;
46
48
  this.ariaLabel = null;
49
+ this.ariaExpanded = null;
50
+ this.hasSlottedIcon = false;
47
51
  this.flashing = new FlashingController(this, () => this.resolvedFlashingSpeed);
48
52
  }
53
+ willUpdate(changedProperties) {
54
+ super.willUpdate(changedProperties);
55
+ this.hasSlottedIcon = this.querySelector(":scope > [slot=\"icon\"]") !== null;
56
+ }
49
57
  get resolvedFlashingSpeed() {
50
- if (this.globalCounter || !this.blinking || this.nAlerts <= 0 || this.alertType === void 0) return FlashingSpeed.Fixed;
58
+ if (this.globalCounter || this.hasSlottedIcon || !this.blinking || this.nAlerts <= 0 || this.alertType === void 0) return FlashingSpeed.Fixed;
51
59
  return resolveFlashingSpeed(this.flashingSpeed, this.alertType, AlertFlashPhase.Active);
52
60
  }
53
61
  get accessibleName() {
@@ -115,9 +123,11 @@ var ObcAlertButtonItem = class ObcAlertButtonItem extends LitElement {
115
123
  counter: showCount && !this.globalCounter,
116
124
  "global-counter": this.globalCounter,
117
125
  "fill-height": this.fillHeight,
126
+ selected: this.activated,
118
127
  [`flash-${tempo}`]: true
119
128
  })}
120
129
  aria-label=${this.accessibleName}
130
+ aria-expanded=${ifDefined(this.ariaExpanded === "true" || this.ariaExpanded === "false" ? this.ariaExpanded : void 0)}
121
131
  >
122
132
  ${tempo === FlashingSpeed.Fixed ? nothing : html`<div class="blink" aria-hidden="true">
123
133
  <div class="content">
@@ -128,7 +138,9 @@ var ObcAlertButtonItem = class ObcAlertButtonItem extends LitElement {
128
138
  <div class="visible-wrapper">
129
139
  ${this.globalCounter ? this.renderCounts() : nothing}
130
140
  <div class="content">
131
- ${this.renderIcon(styleType, false)}
141
+ <slot name="icon" @slotchange=${() => this.requestUpdate()}
142
+ >${this.renderIcon(styleType, false)}</slot
143
+ >
132
144
  ${showCount ? this.renderCount() : nothing}
133
145
  </div>
134
146
  </div>
@@ -156,10 +168,15 @@ __decorate([property({ type: Number })], ObcAlertButtonItem.prototype, "shelvedC
156
168
  __decorate([property({ type: Boolean })], ObcAlertButtonItem.prototype, "blinking", void 0);
157
169
  __decorate([property({ type: String })], ObcAlertButtonItem.prototype, "flashingSpeed", void 0);
158
170
  __decorate([property({ type: Boolean })], ObcAlertButtonItem.prototype, "fillHeight", void 0);
171
+ __decorate([property({ type: Boolean })], ObcAlertButtonItem.prototype, "activated", void 0);
159
172
  __decorate([property({
160
173
  type: String,
161
174
  attribute: "aria-label"
162
175
  })], ObcAlertButtonItem.prototype, "ariaLabel", void 0);
176
+ __decorate([property({
177
+ type: String,
178
+ attribute: "aria-expanded"
179
+ })], ObcAlertButtonItem.prototype, "ariaExpanded", void 0);
163
180
  ObcAlertButtonItem = __decorate([customElement("obc-alert-button-item"), localized()], ObcAlertButtonItem);
164
181
  //#endregion
165
182
  export { ObcAlertButtonItem, ObcAlertButtonType };
@@ -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 * `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,KAAA,oBAAA,wBAAwB;EACwC,KAAA,SAAA,CAAC;EAC1B,KAAA,eAAA;EACH,KAAA,WAAA;EAEpC,KAAA,gBAAA,cAAc;EACwB,KAAA,aAAA;EAIJ,KAAA,YAAA;EAEN,KAAA,WAAA,IAAI,mBAChC,YACM,KAAK,qBACb;;CAEA,IAAI,wBAA+C;EACjD,IACE,KAAK,iBACL,CAAC,KAAK,YACN,KAAK,WAAW,KAChB,KAA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AAA,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"}
1
+ {"version":3,"file":"alert-button-item.js","names":[],"sources":["../../../src/components/alert-button-item/alert-button-item.ts"],"sourcesContent":["import {LitElement, PropertyValues, html, nothing, unsafeCSS} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.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 * - **Icon slot:** the `icon` slot replaces the bell with any icon; the item\n * then never flashes.\n * - **Activated:** `activated` draws the selected style, for a button whose\n * panel is showing.\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 activated - Draws the button in the selected style, for a button whose panel is showing.\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 * @property ariaExpanded - Whether the panel the button opens is showing, forwarded to the inner `<button>` as `aria-expanded`; mapped to the `aria-expanded` attribute. Set it with `activated` from the flag that drives the panel; left unset, the button announces no panel.\n * @slot icon - Replaces the bell. The flash cross-fades two bells, so a slotted icon never flashes and `blinking` has no effect while the slot is filled.\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 @property({type: Boolean}) activated = 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 @property({type: String, attribute: 'aria-expanded'})\n override ariaExpanded: string | null = null;\n\n private hasSlottedIcon = false;\n\n protected override willUpdate(changedProperties: PropertyValues<this>) {\n super.willUpdate(changedProperties);\n // Read before the first paint, so the flash is never installed for an\n // icon that replaces the bell; the slot's change event re-runs it.\n this.hasSlottedIcon = this.querySelector(':scope > [slot=\"icon\"]') !== null;\n }\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.hasSlottedIcon ||\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 selected: this.activated,\n [`flash-${tempo}`]: true,\n })}\n aria-label=${this.accessibleName}\n aria-expanded=${ifDefined(\n this.ariaExpanded === 'true' || this.ariaExpanded === 'false'\n ? this.ariaExpanded\n : undefined\n )}\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 <slot name=\"icon\" @slotchange=${() => this.requestUpdate()}\n >${this.renderIcon(styleType, false)}</slot\n >\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 {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,WAAA,iBAAA,KAAA,CAAA;AAEvB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,cAAA,KAAA,CAAA;AACxB,WAAA,CAAA,SAAS,EAAC,MAAM,QAAO,CAAC,CAAA,GAAA,mBAAA,WAAA,aAAA,KAAA,CAAA;AAGxB,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAY,CAAC,CAAA,GAAA,mBAAA,WAAA,aAAA,KAAA,CAAA;AAGhD,WAAA,CAAA,SAAS;CAAC,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAA,mBAAA,WAAA,gBAAA,KAAA,CAAA;AAvBrD,qBAAA,WAAA,CAAA,cAAc,uBAAuB,GACrC,UAAU,CAAA,GAAA,kBAAA"}
@@ -0,0 +1,120 @@
1
+ import { css } from "lit";
2
+ //#region src/components/alert-subsystem-button/alert-subsystem-button.css?inline
3
+ var alert_subsystem_button_default = css`* {
4
+ -webkit-tap-highlight-color: transparent;
5
+ }
6
+
7
+ * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ :host {
12
+ display: inline-flex;
13
+ }
14
+
15
+ .wrapper {
16
+ display: flex;
17
+ align-items: stretch;
18
+ }
19
+
20
+ .counter-button {
21
+ appearance: none;
22
+ background: none;
23
+ border: none;
24
+ padding: 0;
25
+ display: flex;
26
+ align-items: center;
27
+ height: var(--ui-components-button-touch-target-size);
28
+ color: var(--on-normal-neutral-color);
29
+ }
30
+
31
+ .counter-button {
32
+ cursor: pointer;
33
+ }
34
+
35
+ .counter-button:focus {
36
+ outline: none;
37
+ }
38
+
39
+ .counter-button .visible-wrapper {
40
+ border-color: var(--normal-enabled-border-color);
41
+ background-color: var(--normal-enabled-background-color);
42
+ border-width: 1px;
43
+ border-style: solid;
44
+ cursor: pointer;
45
+ --base-border-color: var(--normal-enabled-border-color);
46
+ --base-background-color: var(--normal-enabled-background-color);
47
+ }
48
+
49
+ .counter-button.activated .visible-wrapper {
50
+ border-color: var(--normal-activated-border-color);
51
+ background-color: var(--normal-activated-background-color);
52
+ --base-border-color: var(--normal-activated-border-color);
53
+ --base-background-color: var(--normal-activated-background-color);
54
+ }
55
+
56
+ @media (hover:hover) {
57
+
58
+ .counter-button:hover .visible-wrapper {
59
+ border-color: color-mix(in srgb, var(--normal-hover-border-color) calc(var(--obc-can-hover) * 100%), var(--base-border-color));
60
+ background-color: color-mix(in srgb, var(--normal-hover-background-color) calc(var(--obc-can-hover) * 100%), var(--base-background-color));
61
+ }
62
+ }
63
+
64
+ .counter-button:active .visible-wrapper {
65
+ border-color: var(--normal-pressed-border-color);
66
+ background-color: var(--normal-pressed-background-color);
67
+ }
68
+
69
+ .counter-button:focus-visible .visible-wrapper {
70
+ outline-color: var(--border-focus-color);
71
+ outline-width: var(--global-size-spacing-border-weight-focusframe);
72
+ outline-style: solid;
73
+ border-color: var(--container-global-color);
74
+ z-index: 1;
75
+ }
76
+
77
+ .counter-button:disabled .visible-wrapper {
78
+ border-color: var(--normal-disabled-border-color);
79
+ background-color: var(--normal-disabled-background-color);
80
+ cursor: not-allowed;
81
+ color: var(--on-normal-disabled-color) !important;
82
+ }
83
+
84
+ .counter-button.disabled .visible-wrapper {
85
+ border-color: var(--normal-disabled-border-color);
86
+ background-color: var(--normal-disabled-background-color);
87
+ cursor: not-allowed;
88
+ color: var(--on-normal-disabled-color) !important;
89
+ }
90
+
91
+ .counter-button:disabled {
92
+ cursor: not-allowed;
93
+ }
94
+
95
+ .counter-button.disabled {
96
+ cursor: not-allowed;
97
+ }
98
+
99
+ /* Scoped like the mixin's rules, which it has to outrank for the border */
100
+ .counter-button .visible-wrapper {
101
+ display: flex;
102
+ align-items: center;
103
+ height: var(--ui-components-icon-button-visual-target-size);
104
+ padding: 0 8px; /* the design's counter frame inset */
105
+ border-radius: var(--ui-components-button-border-radius-top-left) 0 0
106
+ var(--ui-components-button-border-radius-bottom-left);
107
+ border-right: none; /* the list half's left border is the shared edge */
108
+ }
109
+
110
+ .counter::part(frame) {
111
+ background: none;
112
+ border: none;
113
+ border-radius: 0;
114
+ padding: 0; /* the counter's own frame gives way to the button's */
115
+ }
116
+ `;
117
+ //#endregion
118
+ export { alert_subsystem_button_default as default };
119
+
120
+ //# sourceMappingURL=alert-subsystem-button.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-subsystem-button.css.js","names":[],"sources":["../../../src/components/alert-subsystem-button/alert-subsystem-button.css?inline"],"sourcesContent":["* {\n box-sizing: border-box;\n}\n\n:host {\n display: inline-flex;\n}\n\n.wrapper {\n display: flex;\n align-items: stretch;\n}\n\n.counter-button {\n appearance: none;\n background: none;\n border: none;\n padding: 0;\n display: flex;\n align-items: center;\n height: var(--ui-components-button-touch-target-size);\n color: var(--on-normal-neutral-color);\n @mixin style style=normal visibleWrapperClass=.visible-wrapper;\n}\n\n/* Scoped like the mixin's rules, which it has to outrank for the border */\n.counter-button .visible-wrapper {\n display: flex;\n align-items: center;\n height: var(--ui-components-icon-button-visual-target-size);\n padding: 0 8px; /* the design's counter frame inset */\n border-radius: var(--ui-components-button-border-radius-top-left) 0 0\n var(--ui-components-button-border-radius-bottom-left);\n border-right: none; /* the list half's left border is the shared edge */\n}\n\n.counter::part(frame) {\n background: none;\n border: none;\n border-radius: 0;\n padding: 0; /* the counter's own frame gives way to the button's */\n}\n"],"mappings":""}
@@ -0,0 +1,105 @@
1
+ import { LitElement } from 'lit';
2
+ import { AlertCounts } from '../../types.js';
3
+ import '../alert-subsystem-counter/alert-subsystem-counter.js';
4
+ import '../alert-counter-item/alert-counter-item.js';
5
+ import '../icon-button/icon-button.js';
6
+ import '../../icons/icon-alert-list.js';
7
+ /**
8
+ * `<obc-alert-subsystem-button>` – A subsystem's alert counts as a split
9
+ * control: the counts open the alert menu, the list icon goes to the alert
10
+ * list page.
11
+ *
12
+ * The left half is `obc-alert-subsystem-counter` with the per-severity
13
+ * `counts` drawn by `obc-alert-counter-item`, inside a button of the normal
14
+ * style; the right half is an icon button with the alert list icon. The two
15
+ * share one edge, as the halves of `obc-split-button` do.
16
+ *
17
+ * ---
18
+ *
19
+ * ### Features
20
+ * - **Counts:** `counts` per severity, drawn as badges; `hasAlert` off, or
21
+ * on with nothing counted, shows `emptyText` instead.
22
+ * - **Label and icon:** `label` and the `icon` slot, as on the counter.
23
+ * - **Two halves:** `counter-click` from the counts, `alert-list-click` from
24
+ * the list icon; `counterDisabled` and `listDisabled` disable one half,
25
+ * `disabled` both.
26
+ * - **List icon:** the `list-icon` slot, the alert list icon when empty.
27
+ *
28
+ * ---
29
+ *
30
+ * ### Usage Guidelines
31
+ * - Show `obc-alert-menu` on `counter-click` and navigate on
32
+ * `alert-list-click`; the button reports the clicks and nothing more.
33
+ * - Two native buttons, each a tab stop, activated by Enter and Space
34
+ * ([APG button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/)).
35
+ * Left out: nothing.
36
+ * - **TODO(designer):** the design draws an empty placeholder badge for each
37
+ * zero count; no counter in the library does, so only non-zero counts are
38
+ * drawn (#1396).
39
+ * - **TODO(designer):** a disabled counter half dims its frame, while the
40
+ * severity badges keep their colour and the label its active colour; the
41
+ * design has no disabled variant.
42
+ *
43
+ * ---
44
+ *
45
+ * ### Example
46
+ *
47
+ * ```html
48
+ * <obc-alert-subsystem-button label="HVAC" hasAlert .counts=${{countCaution: 2}}>
49
+ * <obi-placeholder slot="icon"></obi-placeholder>
50
+ * </obc-alert-subsystem-button>
51
+ * ```
52
+ *
53
+ * @property counts - Alert count per severity, drawn as badges in the counter half.
54
+ * @availableWhen counts hasAlert==true
55
+ * @property hasAlert - Whether the subsystem has active alerts: `true` draws the badges, `false` the `emptyText`; `true` with nothing counted shows the `emptyText` as well.
56
+ * @property label - The subsystem label, before the badges.
57
+ * @property emptyText - Text shown instead of the badges when `hasAlert` is `false` or nothing is counted.
58
+ * @property disabled - Disables both halves.
59
+ * @property counterDisabled - Disables the counter half alone.
60
+ * @property listDisabled - Disables the list half alone.
61
+ * @property listButtonLabel - Accessible name of the list half; "Alert list" when left empty.
62
+ * @property ariaLabel - Accessible name of the counter half, mapped to the `aria-label` attribute; replaces the generated "HVAC, 2 Caution", or "Alerts" when the half has neither a label nor text. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary.
63
+ * @slot icon - Leading icon of the counter half.
64
+ * @slot list-icon - Icon of the list half; the alert list icon when empty.
65
+ * @fires {CustomEvent<void>} counter-click - Fired when the counter half is clicked.
66
+ * @fires {CustomEvent<void>} alert-list-click - Fired when the list half is clicked.
67
+ * @experimental
68
+ */
69
+ export declare class ObcAlertSubsystemButton extends LitElement {
70
+ /**
71
+ * Alert count per severity, drawn as badges in the counter half.
72
+ *
73
+ * Available when `hasAlert==true`.
74
+ */
75
+ counts: AlertCounts;
76
+ /** Whether the subsystem has active alerts: `true` draws the badges, `false` the `emptyText`; `true` with nothing counted shows the `emptyText` as well. */
77
+ hasAlert: boolean;
78
+ /** The subsystem label, before the badges. */
79
+ label: string;
80
+ /** Text shown instead of the badges when `hasAlert` is `false` or nothing is counted. */
81
+ emptyText: string;
82
+ /** Disables both halves. */
83
+ disabled: boolean;
84
+ /** Disables the counter half alone. */
85
+ counterDisabled: boolean;
86
+ /** Disables the list half alone. */
87
+ listDisabled: boolean;
88
+ /** Accessible name of the list half; "Alert list" when left empty. */
89
+ listButtonLabel: string;
90
+ /** Accessible name of the counter half, mapped to the `aria-label` attribute; replaces the generated "HVAC, 2 Caution", or "Alerts" when the half has neither a label nor text. `aria-labelledby` is not supported: ID references cannot cross the shadow boundary. */
91
+ ariaLabel: string | null;
92
+ /** The flag the counter gets: `hasAlert` with nothing to draw reads as none. */
93
+ private get showsCounts();
94
+ private get counterName();
95
+ private handleCounterClick;
96
+ private handleListClick;
97
+ render(): import('lit-html').TemplateResult<1>;
98
+ static styles: import('lit').CSSResult;
99
+ }
100
+ declare global {
101
+ interface HTMLElementTagNameMap {
102
+ 'obc-alert-subsystem-button': ObcAlertSubsystemButton;
103
+ }
104
+ }
105
+ //# sourceMappingURL=alert-subsystem-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-subsystem-button.d.ts","sourceRoot":"","sources":["../../../src/components/alert-subsystem-button/alert-subsystem-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAKhD,OAAO,uDAAuD,CAAC;AAC/D,OAAO,6CAA6C,CAAC;AACrD,OAAO,+BAA+B,CAAC;AACvC,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAEa,uBAAwB,SAAQ,UAAU;IACT,MAAM,EAAE,WAAW,CAAM;IAC1C,QAAQ,UAAS;IAClB,KAAK,SAAM;IACX,SAAS,SAAe;IACvB,QAAQ,UAAS;IACjB,eAAe,UAAS;IACxB,YAAY,UAAS;IACtB,eAAe,SAAM;IAItC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEzC,gFAAgF;IAChF,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,WAAW,GAWtB;IAED,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,eAAe,CAGrB;IAEO,MAAM;IA0Cf,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,4BAA4B,EAAE,uBAAuB,CAAC;KACvD;CACF"}