@oicl/openbridge-webcomponents 0.0.15-dev-20250205200936 → 0.0.15-dev-20250206192612

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 (83) hide show
  1. package/__snapshots__/alert-icon--primary.png +0 -0
  2. package/__snapshots__/application-alert-button--alarm-3-digits-standalone.png +0 -0
  3. package/__snapshots__/application-alert-button--alarm-3-digits.png +0 -0
  4. package/__snapshots__/application-alert-button--alarm-standalone.png +0 -0
  5. package/__snapshots__/application-alert-button--alarm.png +0 -0
  6. package/__snapshots__/application-alert-button--caution.png +0 -0
  7. package/__snapshots__/application-alert-button--command.png +0 -0
  8. package/__snapshots__/application-alert-button--flat.png +0 -0
  9. package/__snapshots__/application-alert-button--notification.png +0 -0
  10. package/__snapshots__/application-alert-button--regular-idle.png +0 -0
  11. package/__snapshots__/application-alert-button--regular-standalone-no-counter.png +0 -0
  12. package/__snapshots__/application-alert-button--regular-standalone.png +0 -0
  13. package/__snapshots__/application-alert-button--regular.png +0 -0
  14. package/__snapshots__/application-alert-button--running.png +0 -0
  15. package/__snapshots__/application-alert-button--standalone-idle-flat.png +0 -0
  16. package/__snapshots__/application-alert-button--standalone-idle.png +0 -0
  17. package/__snapshots__/application-alert-button--standalone.png +0 -0
  18. package/__snapshots__/application-alert-button--warning.png +0 -0
  19. package/__snapshots__/application-alert-topbar-element--caution.png +0 -0
  20. package/__snapshots__/application-alert-topbar-element--full.png +0 -0
  21. package/__snapshots__/application-alert-topbar-element--minimized.png +0 -0
  22. package/__snapshots__/application-alert-topbar-element--muted.png +0 -0
  23. package/__snapshots__/application-alert-topbar-element--no-ack.png +0 -0
  24. package/__snapshots__/application-alert-topbar-element--no-alerts.png +0 -0
  25. package/__snapshots__/application-notification-message--large-single-message.png +0 -0
  26. package/__snapshots__/application-notification-message--large.png +0 -0
  27. package/__snapshots__/application-notification-message--primary.png +0 -0
  28. package/__snapshots__/application-topbar--inactive.png +0 -0
  29. package/__snapshots__/application-topbar--regular.png +0 -0
  30. package/__snapshots__/application-topbar--reponsive.png +0 -0
  31. package/__snapshots__/application-topbar--settings.png +0 -0
  32. package/__snapshots__/application-topbar--small.png +0 -0
  33. package/__snapshots__/application-topbar--wide-rail-regular.png +0 -0
  34. package/custom-elements.json +41 -98
  35. package/dist/components/alert-button/alert-button.css.js +278 -249
  36. package/dist/components/alert-button/alert-button.css.js.map +1 -1
  37. package/dist/components/alert-button/alert-button.d.ts +7 -5
  38. package/dist/components/alert-button/alert-button.d.ts.map +1 -1
  39. package/dist/components/alert-button/alert-button.js +79 -22
  40. package/dist/components/alert-button/alert-button.js.map +1 -1
  41. package/dist/components/alert-icon/alert-icon.d.ts +0 -2
  42. package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
  43. package/dist/components/alert-icon/alert-icon.js +23 -15
  44. package/dist/components/alert-icon/alert-icon.js.map +1 -1
  45. package/dist/components/alert-icon/icons/icon-14-alarm-silenced-a.js +5 -5
  46. package/dist/components/alert-icon/icons/icon-14-alarm-silenced-a.js.map +1 -1
  47. package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.d.ts.map +1 -1
  48. package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.js +10 -12
  49. package/dist/components/alert-icon/icons/icon-14-alarm-silenced-b.js.map +1 -1
  50. package/dist/components/alert-icon/icons/icon-14-alarm-unack-a.js +4 -4
  51. package/dist/components/alert-icon/icons/icon-14-alarm-unack-a.js.map +1 -1
  52. package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.d.ts.map +1 -1
  53. package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.js +9 -11
  54. package/dist/components/alert-icon/icons/icon-14-alarm-unack-b.js.map +1 -1
  55. package/dist/components/alert-icon/icons/icon-14-warning-unack-a.js +4 -4
  56. package/dist/components/alert-icon/icons/icon-14-warning-unack-a.js.map +1 -1
  57. package/dist/components/alert-icon/icons/icon-14-warning-unack-b.js +3 -3
  58. package/dist/components/alert-icon/icons/icon-14-warning-unack-b.js.map +1 -1
  59. package/dist/components/alert-topbar-element/alert-topbar-element.d.ts +0 -2
  60. package/dist/components/alert-topbar-element/alert-topbar-element.d.ts.map +1 -1
  61. package/dist/components/alert-topbar-element/alert-topbar-element.js +3 -13
  62. package/dist/components/alert-topbar-element/alert-topbar-element.js.map +1 -1
  63. package/dist/types.d.ts +1 -4
  64. package/dist/types.d.ts.map +1 -1
  65. package/dist/types.js +0 -3
  66. package/dist/types.js.map +1 -1
  67. package/package.json +2 -2
  68. package/src/components/alert-button/alert-button.css +118 -98
  69. package/src/components/alert-button/alert-button.stories.ts +42 -19
  70. package/src/components/alert-button/alert-button.ts +89 -27
  71. package/src/components/alert-icon/alert-icon.stories.ts +1 -8
  72. package/src/components/alert-icon/alert-icon.ts +23 -13
  73. package/src/components/alert-icon/icons/icon-14-alarm-silenced-a.ts +5 -5
  74. package/src/components/alert-icon/icons/icon-14-alarm-silenced-b.ts +10 -12
  75. package/src/components/alert-icon/icons/icon-14-alarm-unack-a.ts +4 -4
  76. package/src/components/alert-icon/icons/icon-14-alarm-unack-b.ts +9 -11
  77. package/src/components/alert-icon/icons/icon-14-warning-unack-a.ts +4 -4
  78. package/src/components/alert-icon/icons/icon-14-warning-unack-b.ts +3 -3
  79. package/src/components/alert-topbar-element/alert-topbar-element.stories.ts +6 -8
  80. package/src/components/alert-topbar-element/alert-topbar-element.ts +3 -7
  81. package/src/components/top-bar/top-bar.stories.ts +4 -2
  82. package/src/palettes/variables.css +61 -0
  83. package/src/types.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"icon-14-warning-unack-b.js","sources":["../../../../src/components/alert-icon/icons/icon-14-warning-unack-b.ts"],"sourcesContent":["import {svg} from 'lit';\nexport const svg14WarningUnackB = svg`<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10.5\" style=\"stroke: var(--element-neutral-color)\" />\n<path d=\"M8.50855 13.8814L11.6442 17.0171V6.9829L8.50855 10.1186H6V13.8814H8.50855Z\" style=\"fill: var(--element-neutral-color)\" />\n<path d=\"M14.4664 12C14.4664 10.89 13.8267 9.93672 12.8985 9.47263V14.5211C13.8267 14.0633 14.4664 13.11 14.4664 12Z\" style=\"fill: var(--element-neutral-color)\" />\n<path d=\"M12.8985 7.7919C14.7109 8.33124 16.0342 10.012 16.0342 12C16.0342 13.988 14.7109 15.6688 12.8985 16.2081V17.5C15.4133 16.9293 17.2885 14.6842 17.2885 12C17.2885 9.31585 15.4133 7.0707 12.8985 6.5V7.7919Z\" style=\"fill: var(--element-neutral-color)\" />\n</svg>\n`;\n"],"names":[],"mappings":";AACO,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"icon-14-warning-unack-b.js","sources":["../../../../src/components/alert-icon/icons/icon-14-warning-unack-b.ts"],"sourcesContent":["import {svg} from 'lit';\nexport const svg14WarningUnackB = svg`<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10.5\" style=\"stroke: var(--element-neutral-color)\" />\n<path d=\"M8.5 14H6.5C6.22386 14 6 13.7761 6 13.5V10.5C6 10.2239 6.22386 10 6.5 10H8.5L12 6.5V10.379V17.5L8.5 14Z\" style=\"fill: var(--element-neutral-color)\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M14.7678 13.7678C14.4186 14.117 13.9767 14.3522 13.5 14.4495V9.55053C13.9767 9.64784 14.4186 9.88307 14.7678 10.2323C15.2366 10.7011 15.5 11.337 15.5 12C15.5 12.6631 15.2366 13.299 14.7678 13.7678Z\" style=\"fill: var(--element-neutral-color)\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M13.5 6.59167V7.86933C14.2529 8.05163 14.9484 8.43799 15.5052 8.99482C16.3022 9.79185 16.75 10.8729 16.75 12C16.75 13.1272 16.3022 14.2082 15.5052 15.0052C14.9484 15.5621 14.2529 15.9484 13.5 16.1307V17.4084C14.5869 17.2074 15.5965 16.6817 16.3891 15.8891C17.4205 14.8577 18 13.4587 18 12C18 10.5413 17.4205 9.14239 16.3891 8.11094C15.5965 7.31836 14.5869 6.79266 13.5 6.59167Z\" style=\"fill: var(--element-neutral-color)\"/>\n</svg>\n`;\n"],"names":[],"mappings":";AACO,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -29,8 +29,6 @@ import '../../icons/icon-sound-muted-fill';
29
29
  export declare class ObcAlertTopbarElement extends LitElement {
30
30
  nAlerts: number;
31
31
  alertType: AlertType;
32
- blinkAlarmValue: boolean;
33
- blinkWarningValue: boolean;
34
32
  showAck: boolean;
35
33
  alertMuted: boolean;
36
34
  minimized: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"alert-topbar-element.d.ts","sourceRoot":"","sources":["../../../src/components/alert-topbar-element/alert-topbar-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAGhD,OAAO,8BAA8B,CAAC;AACtC,OAAO,4CAA4C,CAAC;AACpD,OAAO,8CAA8C,CAAC;AAEtD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAKtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAEa,qBAAsB,SAAQ,UAAU;IACzB,OAAO,SAAK;IACZ,SAAS,EAAE,SAAS,CAAkB;IACrC,eAAe,UAAS;IACxB,iBAAiB,UAAS;IAC1B,OAAO,UAAS;IAChB,UAAU,UAAS;IACnB,SAAS,UAAS;IACnB,QAAQ,SAAO;IAEhC,MAAM;IAsEf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,qBAAqB,CAAC;KAClD;CACF"}
1
+ {"version":3,"file":"alert-topbar-element.d.ts","sourceRoot":"","sources":["../../../src/components/alert-topbar-element/alert-topbar-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAkB,MAAM,KAAK,CAAC;AAGhD,OAAO,8BAA8B,CAAC;AACtC,OAAO,4CAA4C,CAAC;AACpD,OAAO,8CAA8C,CAAC;AAEtD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAKtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAEa,qBAAsB,SAAQ,UAAU;IACzB,OAAO,SAAK;IACZ,SAAS,EAAE,SAAS,CAAmB;IACtC,OAAO,UAAS;IAChB,UAAU,UAAS;IACnB,SAAS,UAAS;IACnB,QAAQ,SAAO;IAEhC,MAAM;IAoEf,OAAgB,MAAM,0BAA2B;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,qBAAqB,CAAC;KAClD;CACF"}
@@ -22,9 +22,7 @@ let ObcAlertTopbarElement = class extends LitElement {
22
22
  constructor() {
23
23
  super(...arguments);
24
24
  this.nAlerts = 0;
25
- this.alertType = AlertType.None;
26
- this.blinkAlarmValue = false;
27
- this.blinkWarningValue = false;
25
+ this.alertType = AlertType.Alarm;
28
26
  this.showAck = false;
29
27
  this.alertMuted = false;
30
28
  this.minimized = false;
@@ -32,7 +30,7 @@ let ObcAlertTopbarElement = class extends LitElement {
32
30
  }
33
31
  render() {
34
32
  const empty = this.nAlerts === 0;
35
- const disabledMute = this.alertMuted || empty || this.alertType === AlertType.None || this.alertType === AlertType.Running || this.alertType === AlertType.Caution;
33
+ const disabledMute = this.alertMuted || empty || this.nAlerts === 0 || this.alertType === AlertType.Running || this.alertType === AlertType.Caution;
36
34
  let firstPart;
37
35
  if (this.minimized) {
38
36
  firstPart = html`<obc-notification-button
@@ -84,9 +82,7 @@ let ObcAlertTopbarElement = class extends LitElement {
84
82
  <obc-alert-button
85
83
  .alertType=${this.alertType}
86
84
  .nAlerts=${this.nAlerts}
87
- .counter=${!empty}
88
- .blinkAlarmValue=${this.blinkAlarmValue}
89
- .blinkWarningValue=${this.blinkWarningValue}
85
+ counter
90
86
  @click=${() => this.dispatchEvent(new CustomEvent("alertclick"))}
91
87
  ></obc-alert-button>
92
88
  </div>
@@ -100,12 +96,6 @@ __decorateClass([
100
96
  __decorateClass([
101
97
  property({ type: String })
102
98
  ], ObcAlertTopbarElement.prototype, "alertType", 2);
103
- __decorateClass([
104
- property({ type: Boolean })
105
- ], ObcAlertTopbarElement.prototype, "blinkAlarmValue", 2);
106
- __decorateClass([
107
- property({ type: Boolean })
108
- ], ObcAlertTopbarElement.prototype, "blinkWarningValue", 2);
109
99
  __decorateClass([
110
100
  property({ type: Boolean })
111
101
  ], ObcAlertTopbarElement.prototype, "showAck", 2);
@@ -1 +1 @@
1
- {"version":3,"file":"alert-topbar-element.js","sources":["../../../src/components/alert-topbar-element/alert-topbar-element.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport compentStyle from './alert-topbar-element.css?inline';\nimport '../alert-button/alert-button';\nimport '../notification-button/notification-button';\nimport '../notification-message/notification-message';\n\nimport '../../icons/icon-sound-muted-fill';\nimport {AlertType} from '../../types';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {localized, msg} from '@lit/localize';\n\n/**\n * Element that displays the alert in topbar\n * Use the element in the alerts slot in topbar\n *\n * @prop {number} nAlerts - Number of alerts.\n * @prop {AlertType} alertType - Type of alert.\n * @prop {boolean} blinkAlarmValue - This value should alternate between true and false to make the icon blink.\n * It should be synchronized with the blinkValue of other alarms.\n * @prop {boolean} blinkWarningValue - This value should alternate between true and false to make the icon blink.\n * @prop {boolean} showAck - If the ack button should be shown.\n * @prop {boolean} alertMuted - If the alert is muted.\n * @prop {boolean} minimized - If the alert is minimized.\n * @prop {number} maxWidth - The maximum width of the alert.\n *\n * @fires muteclick - Fired when the mute button is clicked\n * @fires ackclick - Fired when the ack button is clicked\n * @fires alertclick - Fired when the alert button is clicked\n * @fires messageclick - Fired when the message is clicked\n *\n * @slot - The message to display in the alert element of type `obc-notification-message-item`\n * @slot empty - The message to display when there are no alerts\n */\n@localized()\n@customElement('obc-alert-topbar-element')\nexport class ObcAlertTopbarElement extends LitElement {\n @property({type: Number}) nAlerts = 0;\n @property({type: String}) alertType: AlertType = AlertType.None;\n @property({type: Boolean}) blinkAlarmValue = false;\n @property({type: Boolean}) blinkWarningValue = false;\n @property({type: Boolean}) showAck = false;\n @property({type: Boolean}) alertMuted = false;\n @property({type: Boolean}) minimized = false;\n @property({type: Number}) maxWidth = 480;\n\n override render() {\n const empty = this.nAlerts === 0;\n const disabledMute =\n this.alertMuted ||\n empty ||\n this.alertType === AlertType.None ||\n this.alertType === AlertType.Running ||\n this.alertType === AlertType.Caution;\n let firstPart;\n if (this.minimized) {\n firstPart = html`<obc-notification-button\n icon\n openright\n cornerleft\n @click=${() => this.dispatchEvent(new CustomEvent('muteclick'))}\n >\n <obi-sound-muted-fill></obi-sound-muted-fill>\n </obc-notification-button>`;\n } else {\n firstPart = html`<obc-notification-message\n class=\"notification-message\"\n .empty=${empty}\n @click=${() => this.dispatchEvent(new CustomEvent('messageclick'))}\n >\n <slot></slot>\n <div slot=\"empty\">${msg('No active alerts')}</div>\n </obc-notification-message>\n ${this.showAck\n ? html`<obc-notification-button\n openright\n @click=${() => this.dispatchEvent(new CustomEvent('ackclick'))}\n >ACK</obc-notification-button\n >`\n : html``}\n <obc-notification-button\n icon\n openright\n .indent=${empty}\n .disabled=${disabledMute}\n @click=${() => this.dispatchEvent(new CustomEvent('muteclick'))}\n >\n <obi-sound-muted-fill></obi-sound-muted-fill>\n </obc-notification-button>`;\n }\n return html`\n <style>\n :host {\n max-width: ${this.maxWidth}px;\n }\n </style>\n <div\n class=${classMap({\n wrapper: true,\n minimized: this.minimized,\n })}\n style=${`max-width: ${this.maxWidth - 8}px;`}\n >\n ${firstPart}\n <obc-alert-button\n .alertType=${this.alertType}\n .nAlerts=${this.nAlerts}\n .counter=${!empty}\n .blinkAlarmValue=${this.blinkAlarmValue}\n .blinkWarningValue=${this.blinkWarningValue}\n @click=${() => this.dispatchEvent(new CustomEvent('alertclick'))}\n ></obc-alert-button>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ob-alert-topbar-element': ObcAlertTopbarElement;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCa,IAAA,wBAAN,cAAoC,WAAW;AAAA,EAA/C,cAAA;AAAA,UAAA,GAAA,SAAA;AAC+B,SAAA,UAAA;AACV,SAAA,YAAuB,UAAU;AACd,SAAA,kBAAA;AACE,SAAA,oBAAA;AACV,SAAA,UAAA;AACG,SAAA,aAAA;AACD,SAAA,YAAA;AACF,SAAA,WAAA;AAAA,EAAA;AAAA,EAE5B,SAAS;AACV,UAAA,QAAQ,KAAK,YAAY;AAC/B,UAAM,eACJ,KAAK,cACL,SACA,KAAK,cAAc,UAAU,QAC7B,KAAK,cAAc,UAAU,WAC7B,KAAK,cAAc,UAAU;AAC3B,QAAA;AACJ,QAAI,KAAK,WAAW;AACN,kBAAA;AAAA;AAAA;AAAA;AAAA,iBAID,MAAM,KAAK,cAAc,IAAI,YAAY,WAAW,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,IAAA,OAI5D;AACO,kBAAA;AAAA;AAAA,mBAEC,KAAK;AAAA,mBACL,MAAM,KAAK,cAAc,IAAI,YAAY,cAAc,CAAC,CAAC;AAAA;AAAA;AAAA,8BAG9C,IAAI,kBAAkB,CAAC;AAAA;AAAA,UAE3C,KAAK,UACH;AAAA;AAAA,uBAEW,MAAM,KAAK,cAAc,IAAI,YAAY,UAAU,CAAC,CAAC;AAAA;AAAA,iBAGhE,MAAM;AAAA;AAAA;AAAA;AAAA,oBAIE,KAAK;AAAA,sBACH,YAAY;AAAA,mBACf,MAAM,KAAK,cAAc,IAAI,YAAY,WAAW,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,IAAA;AAK9D,WAAA;AAAA;AAAA;AAAA,uBAGY,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA,gBAIpB,SAAS;AAAA,MACf,SAAS;AAAA,MACT,WAAW,KAAK;AAAA,IAAA,CACjB,CAAC;AAAA,gBACM,cAAc,KAAK,WAAW,CAAC,KAAK;AAAA;AAAA,UAE1C,SAAS;AAAA;AAAA,uBAEI,KAAK,SAAS;AAAA,qBAChB,KAAK,OAAO;AAAA,qBACZ,CAAC,KAAK;AAAA,6BACE,KAAK,eAAe;AAAA,+BAClB,KAAK,iBAAiB;AAAA,mBAClC,MAAM,KAAK,cAAc,IAAI,YAAY,YAAY,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,EAAA;AAO1E;AAjFa,sBAgFK,SAAS,UAAU,YAAY;AA/ErB,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAO,CAAA;AAAA,GADb,sBACe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAO,CAAA;AAAA,GAFb,sBAEe,WAAA,aAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GAHd,sBAGgB,WAAA,mBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GAJd,sBAIgB,WAAA,qBAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GALd,sBAKgB,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GANd,sBAMgB,WAAA,cAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GAPd,sBAOgB,WAAA,aAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAO,CAAA;AAAA,GARb,sBAQe,WAAA,YAAA,CAAA;AARf,wBAAN,gBAAA;AAAA,EAFN,UAAU;AAAA,EACV,cAAc,0BAA0B;AAAA,GAC5B,qBAAA;"}
1
+ {"version":3,"file":"alert-topbar-element.js","sources":["../../../src/components/alert-topbar-element/alert-topbar-element.ts"],"sourcesContent":["import {LitElement, html, unsafeCSS} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport compentStyle from './alert-topbar-element.css?inline';\nimport '../alert-button/alert-button';\nimport '../notification-button/notification-button';\nimport '../notification-message/notification-message';\n\nimport '../../icons/icon-sound-muted-fill';\nimport {AlertType} from '../../types';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {localized, msg} from '@lit/localize';\n\n/**\n * Element that displays the alert in topbar\n * Use the element in the alerts slot in topbar\n *\n * @prop {number} nAlerts - Number of alerts.\n * @prop {AlertType} alertType - Type of alert.\n * @prop {boolean} blinkAlarmValue - This value should alternate between true and false to make the icon blink.\n * It should be synchronized with the blinkValue of other alarms.\n * @prop {boolean} blinkWarningValue - This value should alternate between true and false to make the icon blink.\n * @prop {boolean} showAck - If the ack button should be shown.\n * @prop {boolean} alertMuted - If the alert is muted.\n * @prop {boolean} minimized - If the alert is minimized.\n * @prop {number} maxWidth - The maximum width of the alert.\n *\n * @fires muteclick - Fired when the mute button is clicked\n * @fires ackclick - Fired when the ack button is clicked\n * @fires alertclick - Fired when the alert button is clicked\n * @fires messageclick - Fired when the message is clicked\n *\n * @slot - The message to display in the alert element of type `obc-notification-message-item`\n * @slot empty - The message to display when there are no alerts\n */\n@localized()\n@customElement('obc-alert-topbar-element')\nexport class ObcAlertTopbarElement extends LitElement {\n @property({type: Number}) nAlerts = 0;\n @property({type: String}) alertType: AlertType = AlertType.Alarm;\n @property({type: Boolean}) showAck = false;\n @property({type: Boolean}) alertMuted = false;\n @property({type: Boolean}) minimized = false;\n @property({type: Number}) maxWidth = 480;\n\n override render() {\n const empty = this.nAlerts === 0;\n const disabledMute =\n this.alertMuted ||\n empty ||\n this.nAlerts === 0 ||\n this.alertType === AlertType.Running ||\n this.alertType === AlertType.Caution;\n let firstPart;\n if (this.minimized) {\n firstPart = html`<obc-notification-button\n icon\n openright\n cornerleft\n @click=${() => this.dispatchEvent(new CustomEvent('muteclick'))}\n >\n <obi-sound-muted-fill></obi-sound-muted-fill>\n </obc-notification-button>`;\n } else {\n firstPart = html`<obc-notification-message\n class=\"notification-message\"\n .empty=${empty}\n @click=${() => this.dispatchEvent(new CustomEvent('messageclick'))}\n >\n <slot></slot>\n <div slot=\"empty\">${msg('No active alerts')}</div>\n </obc-notification-message>\n ${this.showAck\n ? html`<obc-notification-button\n openright\n @click=${() => this.dispatchEvent(new CustomEvent('ackclick'))}\n >ACK</obc-notification-button\n >`\n : html``}\n <obc-notification-button\n icon\n openright\n .indent=${empty}\n .disabled=${disabledMute}\n @click=${() => this.dispatchEvent(new CustomEvent('muteclick'))}\n >\n <obi-sound-muted-fill></obi-sound-muted-fill>\n </obc-notification-button>`;\n }\n return html`\n <style>\n :host {\n max-width: ${this.maxWidth}px;\n }\n </style>\n <div\n class=${classMap({\n wrapper: true,\n minimized: this.minimized,\n })}\n style=${`max-width: ${this.maxWidth - 8}px;`}\n >\n ${firstPart}\n <obc-alert-button\n .alertType=${this.alertType}\n .nAlerts=${this.nAlerts}\n counter\n @click=${() => this.dispatchEvent(new CustomEvent('alertclick'))}\n ></obc-alert-button>\n </div>\n `;\n }\n\n static override styles = unsafeCSS(compentStyle);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ob-alert-topbar-element': ObcAlertTopbarElement;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCa,IAAA,wBAAN,cAAoC,WAAW;AAAA,EAA/C,cAAA;AAAA,UAAA,GAAA,SAAA;AAC+B,SAAA,UAAA;AACV,SAAA,YAAuB,UAAU;AACtB,SAAA,UAAA;AACG,SAAA,aAAA;AACD,SAAA,YAAA;AACF,SAAA,WAAA;AAAA,EAAA;AAAA,EAE5B,SAAS;AACV,UAAA,QAAQ,KAAK,YAAY;AAC/B,UAAM,eACJ,KAAK,cACL,SACA,KAAK,YAAY,KACjB,KAAK,cAAc,UAAU,WAC7B,KAAK,cAAc,UAAU;AAC3B,QAAA;AACJ,QAAI,KAAK,WAAW;AACN,kBAAA;AAAA;AAAA;AAAA;AAAA,iBAID,MAAM,KAAK,cAAc,IAAI,YAAY,WAAW,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,IAAA,OAI5D;AACO,kBAAA;AAAA;AAAA,mBAEC,KAAK;AAAA,mBACL,MAAM,KAAK,cAAc,IAAI,YAAY,cAAc,CAAC,CAAC;AAAA;AAAA;AAAA,8BAG9C,IAAI,kBAAkB,CAAC;AAAA;AAAA,UAE3C,KAAK,UACH;AAAA;AAAA,uBAEW,MAAM,KAAK,cAAc,IAAI,YAAY,UAAU,CAAC,CAAC;AAAA;AAAA,iBAGhE,MAAM;AAAA;AAAA;AAAA;AAAA,oBAIE,KAAK;AAAA,sBACH,YAAY;AAAA,mBACf,MAAM,KAAK,cAAc,IAAI,YAAY,WAAW,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,IAAA;AAK9D,WAAA;AAAA;AAAA;AAAA,uBAGY,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA,gBAIpB,SAAS;AAAA,MACf,SAAS;AAAA,MACT,WAAW,KAAK;AAAA,IAAA,CACjB,CAAC;AAAA,gBACM,cAAc,KAAK,WAAW,CAAC,KAAK;AAAA;AAAA,UAE1C,SAAS;AAAA;AAAA,uBAEI,KAAK,SAAS;AAAA,qBAChB,KAAK,OAAO;AAAA;AAAA,mBAEd,MAAM,KAAK,cAAc,IAAI,YAAY,YAAY,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,EAAA;AAO1E;AA7Ea,sBA4EK,SAAS,UAAU,YAAY;AA3ErB,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAO,CAAA;AAAA,GADb,sBACe,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAO,CAAA;AAAA,GAFb,sBAEe,WAAA,aAAA,CAAA;AACC,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GAHd,sBAGgB,WAAA,WAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GAJd,sBAIgB,WAAA,cAAA,CAAA;AACA,gBAAA;AAAA,EAA1B,SAAS,EAAC,MAAM,QAAQ,CAAA;AAAA,GALd,sBAKgB,WAAA,aAAA,CAAA;AACD,gBAAA;AAAA,EAAzB,SAAS,EAAC,MAAM,OAAO,CAAA;AAAA,GANb,sBAMe,WAAA,YAAA,CAAA;AANf,wBAAN,gBAAA;AAAA,EAFN,UAAU;AAAA,EACV,cAAc,0BAA0B;AAAA,GAC5B,qBAAA;"}
package/dist/types.d.ts CHANGED
@@ -3,10 +3,7 @@ export declare enum AlertType {
3
3
  Warning = "warning",
4
4
  Caution = "caution",
5
5
  Running = "running",
6
- Command = "command",
7
- Notification = "notification",
8
- None = "none",
9
- Flat = "flat"
6
+ Notification = "notification"
10
7
  }
11
8
  export declare enum Direction {
12
9
  Up = "up",
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,oBAAY,SAAS;IACnB,EAAE,OAAO;IACT,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B;AAED,oBAAY,SAAS;IACnB,EAAE,OAAO;IACT,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
package/dist/types.js CHANGED
@@ -3,10 +3,7 @@ var AlertType = /* @__PURE__ */ ((AlertType2) => {
3
3
  AlertType2["Warning"] = "warning";
4
4
  AlertType2["Caution"] = "caution";
5
5
  AlertType2["Running"] = "running";
6
- AlertType2["Command"] = "command";
7
6
  AlertType2["Notification"] = "notification";
8
- AlertType2["None"] = "none";
9
- AlertType2["Flat"] = "flat";
10
7
  return AlertType2;
11
8
  })(AlertType || {});
12
9
  var Direction = /* @__PURE__ */ ((Direction2) => {
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["export enum AlertType {\n Alarm = 'alarm',\n Warning = 'warning',\n Caution = 'caution',\n Running = 'running',\n Command = 'command',\n Notification = 'notification',\n None = 'none',\n Flat = 'flat',\n}\n\nexport enum Direction {\n Up = 'up',\n Down = 'down',\n Left = 'left',\n Right = 'right',\n}\n"],"names":["AlertType","Direction"],"mappings":"AAAY,IAAA,8BAAAA,eAAL;AACLA,aAAA,OAAQ,IAAA;AACRA,aAAA,SAAU,IAAA;AACVA,aAAA,SAAU,IAAA;AACVA,aAAA,SAAU,IAAA;AACVA,aAAA,SAAU,IAAA;AACVA,aAAA,cAAe,IAAA;AACfA,aAAA,MAAO,IAAA;AACPA,aAAA,MAAO,IAAA;AARGA,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAWA,IAAA,8BAAAC,eAAL;AACLA,aAAA,IAAK,IAAA;AACLA,aAAA,MAAO,IAAA;AACPA,aAAA,MAAO,IAAA;AACPA,aAAA,OAAQ,IAAA;AAJEA,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["export enum AlertType {\n Alarm = 'alarm',\n Warning = 'warning',\n Caution = 'caution',\n Running = 'running',\n Notification = 'notification',\n}\n\nexport enum Direction {\n Up = 'up',\n Down = 'down',\n Left = 'left',\n Right = 'right',\n}\n"],"names":["AlertType","Direction"],"mappings":"AAAY,IAAA,8BAAAA,eAAL;AACLA,aAAA,OAAQ,IAAA;AACRA,aAAA,SAAU,IAAA;AACVA,aAAA,SAAU,IAAA;AACVA,aAAA,SAAU,IAAA;AACVA,aAAA,cAAe,IAAA;AALLA,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAQA,IAAA,8BAAAC,eAAL;AACLA,aAAA,IAAK,IAAA;AACLA,aAAA,MAAO,IAAA;AACPA,aAAA,MAAO,IAAA;AACPA,aAAA,OAAQ,IAAA;AAJEA,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents",
3
- "version": "0.0.15-dev-20250205200936",
3
+ "version": "0.0.15-dev-20250206192612",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -74,7 +74,7 @@
74
74
  "postcss": "^8.4.49",
75
75
  "postcss-mixins": "^11.0.3",
76
76
  "postcss-nesting": "^13.0.1",
77
- "prettier": "^3.3.3",
77
+ "prettier": "^3.4.2",
78
78
  "release-it": "^17.1.1",
79
79
  "rollup-plugin-postcss-lit": "^2.1.0",
80
80
  "storybook": "^8.4.7",
@@ -1,134 +1,154 @@
1
1
  * {
2
- box-sizing: border-box;
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ button {
6
+ position: relative;
7
+ padding: 0;
8
+ appearance: none;
9
+ border: none;
10
+ background-color: transparent;
11
+ }
12
+
13
+ .wrapper.overlay {
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ right: 0;
18
+ bottom: 0;
3
19
  }
4
20
 
5
21
  .wrapper {
6
- box-sizing: border-box;
7
- padding: 0;
8
- padding-right: 8px;
9
- background: transparent;
10
- height: 48px;
11
- width: 56px;
12
- appearance: none;
13
- border: none;
22
+ box-sizing: border-box;
23
+ background: transparent;
24
+ min-width: var(--global-size-spacing-touch-target-min);
25
+ min-height: var(--global-size-spacing-touch-target-min);
26
+ padding: 0 var(--app-components-alert-button-margin-horizontal);
27
+ appearance: none;
28
+ border: none;
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+
33
+ @mixin font-button;
34
+
35
+ &.standalone {
36
+ padding-right: 0;
37
+ }
38
+
39
+ &:not(.standalone) {
40
+ padding-left: 0;
41
+ }
42
+
43
+ & .icon {
44
+ width: var(--app-components-alert-button-icon-size);
45
+ height: var(--app-components-alert-button-icon-size);
46
+ }
47
+
48
+ & .visible-wrapper {
49
+ border-radius: var(--ui-components-button-border-radius-top-left)
50
+ var(--ui-components-button-border-radius-top-right)
51
+ var(--ui-components-button-border-radius-bottom-right)
52
+ var(--ui-components-button-border-radius-bottom-left);
14
53
  display: flex;
15
54
  align-items: center;
16
55
  justify-content: center;
56
+ width: var(--app-components-alert-button-alert-button-width);
57
+ height: var(--app-components-alert-button-visual-target-size);
58
+ gap: var(--app-components-alert-button-counter-spacing);
59
+ }
17
60
 
18
- @mixin font-button;
19
-
20
- &.standalone {
21
- width: 48px;
22
- padding-right: 0;
23
- }
24
-
25
- &.counter {
26
- width: 64px;
27
-
28
- &.standalone {
29
- width: 72px;
30
- padding-left: 8px;
31
- padding-right: 8px;
32
- }
33
- }
61
+ &:not(.counter),
62
+ &.type-flat {
63
+ padding: 0;
34
64
 
35
- & .icon {
36
- height: 24px;
37
- width: 24px;
65
+ & .visible-wrapper {
66
+ width: var(--ui-components-icon-button-visual-target-size);
38
67
  }
68
+ }
39
69
 
70
+ &:not(.standalone) {
40
71
  & .visible-wrapper {
41
- border-radius: 6px;
42
- display: flex;
43
- align-items: center;
44
- justify-content: center;
45
- height: 32px;
46
- width: 100%;
47
- gap: 4px;
72
+ border-bottom-left-radius: 0;
73
+ border-top-left-radius: 0;
48
74
  }
75
+ }
49
76
 
50
- &.standalone:not(.counter) .visible-wrapper {
51
- width: 32px;
52
- }
77
+ &.type-alarm {
78
+ @mixin style style=alarm visibleWrapperClass=.visible-wrapper;
79
+ color: var(--on-alarm-active-color);
53
80
 
54
- &:not(.standalone) {
55
- & .visible-wrapper {
56
- border-radius: 0 6px 6px 0;
57
- }
81
+ &.on {
82
+ opacity: var(--alarm-blink-on);
58
83
  }
84
+ }
59
85
 
60
- &.type-alarm {
61
- @mixin style style=alarm visibleWrapperClass=.visible-wrapper;
62
- color: var(--on-alarm-active-color);
63
- }
86
+ &.type-alarm-off {
87
+ opacity: var(--alarm-blink-off);
88
+ }
64
89
 
65
- &.type-warning {
66
- @mixin style style=warning visibleWrapperClass=.visible-wrapper;
90
+ &.type-warning {
91
+ @mixin style style=warning visibleWrapperClass=.visible-wrapper;
67
92
 
68
- & .visible-wrapper {
69
- color: var(--on-warning-active-color, #FFF);
93
+ & .visible-wrapper {
94
+ color: var(--on-warning-active-color, #fff);
70
95
 
71
- & .badge {
72
- color: var(--on-warning-active-color, #FFF);
73
- }
74
- }
96
+ & .badge {
97
+ color: var(--on-warning-active-color, #fff);
98
+ }
75
99
  }
76
100
 
77
- &.type-caution {
78
- @mixin style style=caution visibleWrapperClass=.visible-wrapper;
79
-
80
- & .visible-wrapper {
81
- color: var(--on-caution-active-color, #FFF);
82
-
83
- & .badge {
84
- color: var(--on-caution-active-color, #FFF);
85
- }
86
- }
101
+ &.on {
102
+ opacity: var(--warning-blink-on);
87
103
  }
104
+ }
88
105
 
89
- &.type-running {
90
- @mixin style style=normal visibleWrapperClass=.visible-wrapper;
91
-
92
- & .icon {
93
- color: var(--alert-running-color);
94
- }
95
- }
106
+ &.type-warning-off {
107
+ opacity: var(--warning-blink-off);
108
+ }
96
109
 
97
- &.type-command {
98
- @mixin style style=notification visibleWrapperClass=.visible-wrapper;
110
+ &.type-caution {
111
+ @mixin style style=caution visibleWrapperClass=.visible-wrapper;
99
112
 
100
- & .visible-wrapper {
101
- color: var(--on-running-active-color, #FFF);
113
+ & .visible-wrapper {
114
+ color: var(--on-caution-active-color, #fff);
102
115
 
103
- & .badge {
104
- color: var(--on-running-active-color, #FFF);
105
- }
106
- }
116
+ & .badge {
117
+ color: var(--on-caution-active-color, #fff);
118
+ }
107
119
  }
120
+ }
108
121
 
109
- &.type-notification {
110
- @mixin style style=normal visibleWrapperClass=.visible-wrapper;
122
+ &.type-running {
123
+ @mixin style style=running visibleWrapperClass=.visible-wrapper;
124
+ color: var(--on-running-active-color);
125
+ }
111
126
 
112
- & .icon {
113
- color: var(--instrument-enhanced-secondary-color);
114
- }
115
- }
127
+ &.type-notification {
128
+ @mixin style style=notification visibleWrapperClass=.visible-wrapper;
129
+ color: var(--on-notification-active-color);
130
+ }
131
+
132
+ &.type-advice {
133
+ @mixin style style=advice visibleWrapperClass=.visible-wrapper;
134
+ color: var(--on-advice-active-color);
135
+ }
116
136
 
117
- &.type-none {
118
- @mixin style style=normal visibleWrapperClass=.visible-wrapper;
119
- color: var(--on-normal-active-color);
137
+ &.type-none {
138
+ @mixin style style=normal visibleWrapperClass=.visible-wrapper;
139
+ color: var(--on-normal-active-color);
120
140
 
121
- & .icon {
122
- color: var(--on-normal-neutral-color);
123
- }
141
+ & .icon {
142
+ color: var(--on-normal-neutral-color);
124
143
  }
144
+ }
125
145
 
126
- &.type-flat {
127
- @mixin style style=flat visibleWrapperClass=.visible-wrapper;
128
- color: var(--on-flat-active-color);
146
+ &.type-flat {
147
+ @mixin style style=flat visibleWrapperClass=.visible-wrapper;
148
+ color: var(--on-flat-active-color);
129
149
 
130
- & .icon {
131
- color: var(--on-flat-neutral-color);
132
- }
150
+ & .icon {
151
+ color: var(--on-flat-neutral-color);
133
152
  }
134
- }
153
+ }
154
+ }
@@ -11,8 +11,6 @@ const meta: Meta<typeof ObcAlertButton> = {
11
11
  nAlerts: 2,
12
12
  counter: true,
13
13
  standalone: false,
14
- blinkAlarmValue: true,
15
- blinkWarningValue: true,
16
14
  },
17
15
  argTypes: {
18
16
  nAlerts: {
@@ -40,6 +38,28 @@ export const Alarm: Story = {
40
38
  },
41
39
  };
42
40
 
41
+ export const AlarmStandalone: Story = {
42
+ args: {
43
+ alertType: AlertType.Alarm,
44
+ standalone: true,
45
+ },
46
+ };
47
+
48
+ export const Alarm3digits: Story = {
49
+ args: {
50
+ alertType: AlertType.Alarm,
51
+ nAlerts: 100,
52
+ },
53
+ };
54
+
55
+ export const Alarm3digitsStandalone: Story = {
56
+ args: {
57
+ alertType: AlertType.Alarm,
58
+ nAlerts: 100,
59
+ standalone: true,
60
+ },
61
+ };
62
+
43
63
  export const Warning: Story = {
44
64
  args: {
45
65
  alertType: AlertType.Warning,
@@ -58,9 +78,11 @@ export const Running: Story = {
58
78
  },
59
79
  };
60
80
 
61
- export const Command: Story = {
81
+ export const RegularIdle: Story = {
62
82
  args: {
63
- alertType: AlertType.Command,
83
+ alertType: AlertType.Alarm,
84
+ nAlerts: 0,
85
+ standalone: false,
64
86
  },
65
87
  };
66
88
 
@@ -70,36 +92,37 @@ export const Notification: Story = {
70
92
  },
71
93
  };
72
94
 
73
- export const Regular: Story = {
74
- args: {
75
- alertType: AlertType.None,
76
- },
77
- };
78
-
79
- export const Flat: Story = {
95
+ export const Standalone: Story = {
80
96
  args: {
81
- alertType: AlertType.Flat,
97
+ alertType: AlertType.Alarm,
98
+ nAlerts: 2,
99
+ counter: true,
100
+ standalone: true,
82
101
  },
83
102
  };
84
103
 
85
- export const RegularNoCounter: Story = {
104
+ export const StandaloneIdle: Story = {
86
105
  args: {
87
- alertType: AlertType.None,
88
- counter: false,
106
+ alertType: AlertType.Alarm,
107
+ nAlerts: 0,
108
+ standalone: true,
109
+ flatWhenIdle: false,
89
110
  },
90
111
  };
91
112
 
92
- export const RegularStandalone: Story = {
113
+ export const StandaloneIdleFlat: Story = {
93
114
  args: {
94
- alertType: AlertType.None,
95
- counter: true,
115
+ alertType: AlertType.Alarm,
116
+ nAlerts: 0,
96
117
  standalone: true,
118
+ flatWhenIdle: true,
97
119
  },
98
120
  };
99
121
 
100
122
  export const RegularStandaloneNoCounter: Story = {
101
123
  args: {
102
- alertType: AlertType.None,
124
+ alertType: AlertType.Alarm,
125
+ nAlerts: 1,
103
126
  counter: false,
104
127
  standalone: true,
105
128
  },
@@ -1,7 +1,12 @@
1
1
  import {LitElement, html, unsafeCSS} from 'lit';
2
2
  import {customElement, property} from 'lit/decorators.js';
3
3
  import compentStyle from './alert-button.css?inline';
4
+ import '../../icons/icon-alerts';
4
5
  import '../../icons/icon-alerts-active';
6
+ import '../../icons/icon-notification';
7
+ import '../../icons/icon-notification-filled';
8
+ import '../../icons/icon-notification-advice';
9
+ import '../../icons/icon-notification-advice-active';
5
10
  import {AlertType} from '../../types';
6
11
  import {classMap} from 'lit/directives/class-map.js';
7
12
 
@@ -12,46 +17,103 @@ import {classMap} from 'lit/directives/class-map.js';
12
17
  * @prop {AlertType} alertType - Type of alert.
13
18
  * @prop {boolean} standalone - If the button is standalone and not used together with an notification-message.
14
19
  * @prop {boolean} counter - If the button should display a counter.
15
- * @prop {boolean} blinkAlarmValue - This value should alternate between true and false to make the icon blink.
16
- * It should be synchronized with the blinkValue of other alarms.
17
- * @prop {boolean} blinkWarningValue - This value should alternate between true and false to make the icon blink.
18
20
  *
19
21
  * @fires click - Fires when the button is clicked.
20
22
  */
21
23
  @customElement('obc-alert-button')
22
24
  export class ObcAlertButton extends LitElement {
23
25
  @property({type: Number}) nAlerts = 0;
24
- @property({type: String}) alertType = AlertType.None;
26
+ @property({type: String}) alertType = AlertType.Alarm;
27
+ @property({type: Boolean}) flatWhenIdle = false;
25
28
  @property({type: Boolean}) standalone = false;
26
29
  @property({type: Boolean}) counter = false;
27
- @property({type: Boolean}) blinkAlarmValue = false;
28
- @property({type: Boolean}) blinkWarningValue = false;
30
+
31
+ private alertIcon() {
32
+ const isIdle = this.nAlerts === 0;
33
+ switch (this.alertType) {
34
+ /*
35
+ case AlertType.Advice:
36
+ if (isIdle) {
37
+ return html`<obi-notification-advice
38
+ class="icon"
39
+ ></obi-notification-advice>`;
40
+ } else {
41
+ return html`<obi-notification-advice-active
42
+ class="icon"
43
+ ></obi-notification-advice-active>`;
44
+ }
45
+ */
46
+ case AlertType.Notification:
47
+ if (isIdle) {
48
+ return html`<obi-notification class="icon"></obi-notification>`;
49
+ } else {
50
+ return html`<obi-notification-filled
51
+ class="icon"
52
+ ></obi-notification-filled>`;
53
+ }
54
+ default:
55
+ if (isIdle) {
56
+ return html`<obi-alerts class="icon"></obi-alerts>`;
57
+ } else {
58
+ return html`<obi-alerts-active class="icon"></obi-alerts-active>`;
59
+ }
60
+ }
61
+ }
29
62
 
30
63
  override render() {
31
- let alertType = this.alertType;
32
- if (this.alertType === AlertType.Alarm && !this.blinkAlarmValue) {
33
- alertType = AlertType.None;
34
- } else if (
35
- this.alertType === AlertType.Warning &&
36
- !this.blinkWarningValue
37
- ) {
38
- alertType = AlertType.None;
64
+ const isAlarm = this.alertType === AlertType.Alarm;
65
+ const isWarning = this.alertType === AlertType.Warning;
66
+ const hasAlerts = this.nAlerts > 0;
67
+ const isAlarmOrWarning = (isAlarm || isWarning) && hasAlerts;
68
+
69
+ let activeAlertType: string = this.alertType;
70
+ if (!hasAlerts) {
71
+ if (this.flatWhenIdle) {
72
+ activeAlertType = 'flat';
73
+ } else {
74
+ activeAlertType = 'none';
75
+ }
39
76
  }
40
77
  return html`
41
- <button
42
- class=${classMap({
43
- wrapper: true,
44
- [`type-${alertType}`]: true,
45
- counter: this.counter,
46
- standalone: this.standalone,
47
- })}
48
- >
49
- <div class="visible-wrapper">
50
- <obi-alerts-active class="icon"></obi-alerts-active>
51
- ${this.counter
52
- ? html`<div class="badge">${this.nAlerts}</div>`
53
- : null}
78
+ <button>
79
+ <div
80
+ class=${classMap({
81
+ wrapper: true,
82
+ [`type-${activeAlertType}`]: true,
83
+ counter: this.counter,
84
+ standalone: this.standalone,
85
+ on: true,
86
+ })}
87
+ >
88
+ <div class="visible-wrapper">
89
+ ${this.alertIcon()}
90
+ ${this.counter && hasAlerts
91
+ ? html`<div class="badge">${this.nAlerts}</div>`
92
+ : null}
93
+ </div>
54
94
  </div>
95
+
96
+ ${isAlarmOrWarning
97
+ ? html`<div
98
+ class=${classMap({
99
+ wrapper: true,
100
+ 'type-none': true,
101
+ counter: this.counter,
102
+ standalone: this.standalone,
103
+ [`type-${this.alertType}-off`]: true,
104
+ overlay: true,
105
+ })}
106
+ >
107
+ <div class="visible-wrapper">
108
+ ${this.nAlerts > 0
109
+ ? html`<obi-alerts-active class="icon"></obi-alerts-active>`
110
+ : html`<obi-alerts class="icon"></obi-alerts>`}
111
+ ${this.counter
112
+ ? html`<div class="badge">${this.nAlerts}</div>`
113
+ : null}
114
+ </div>
115
+ </div>`
116
+ : null}
55
117
  </button>
56
118
  `;
57
119
  }