@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.94 → 2.0.0-next.96

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 (115) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +15137 -14794
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +110 -70
  4. package/dist/alert-severity.d.ts +1 -1
  5. package/dist/alert-severity.d.ts.map +1 -1
  6. package/dist/alert-severity.js +4 -1
  7. package/dist/alert-severity.js.map +1 -1
  8. package/dist/building-blocks/chart-line/chart-line-base.d.ts +95 -33
  9. package/dist/building-blocks/chart-line/chart-line-base.d.ts.map +1 -1
  10. package/dist/building-blocks/chart-line/chart-line-base.js +88 -23
  11. package/dist/building-blocks/chart-line/chart-line-base.js.map +1 -1
  12. package/dist/charthelpers/index.d.ts +1 -0
  13. package/dist/charthelpers/index.d.ts.map +1 -1
  14. package/dist/charthelpers/index.js +4 -0
  15. package/dist/charthelpers/index.js.map +1 -1
  16. package/dist/charthelpers/x-value.d.ts +72 -0
  17. package/dist/charthelpers/x-value.d.ts.map +1 -0
  18. package/dist/charthelpers/x-value.js +60 -0
  19. package/dist/charthelpers/x-value.js.map +1 -0
  20. package/dist/components/alert-button/alert-button.js +1 -1
  21. package/dist/components/alert-button/alert-button.js.map +1 -1
  22. package/dist/components/alert-icon/alert-icon.d.ts +30 -7
  23. package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
  24. package/dist/components/alert-icon/alert-icon.js +234 -67
  25. package/dist/components/alert-icon/alert-icon.js.map +1 -1
  26. package/dist/components/alert-icon/icons/icon-critical-acknowledged.d.ts +2 -0
  27. package/dist/components/alert-icon/icons/icon-critical-acknowledged.d.ts.map +1 -0
  28. package/dist/components/alert-icon/icons/icon-critical-acknowledged.js +17 -0
  29. package/dist/components/alert-icon/icons/icon-critical-acknowledged.js.map +1 -0
  30. package/dist/components/alert-icon/icons/icon-critical-rectified.d.ts +3 -0
  31. package/dist/components/alert-icon/icons/icon-critical-rectified.d.ts.map +1 -0
  32. package/dist/components/alert-icon/icons/icon-critical-rectified.js +28 -0
  33. package/dist/components/alert-icon/icons/icon-critical-rectified.js.map +1 -0
  34. package/dist/components/alert-icon/icons/icon-critical-silenced.d.ts +3 -0
  35. package/dist/components/alert-icon/icons/icon-critical-silenced.d.ts.map +1 -0
  36. package/dist/components/alert-icon/icons/{icon-warning-silenced.js → icon-critical-silenced.js} +26 -13
  37. package/dist/components/alert-icon/icons/icon-critical-silenced.js.map +1 -0
  38. package/dist/components/alert-icon/icons/icon-critical-unacknowledged.d.ts +3 -0
  39. package/dist/components/alert-icon/icons/icon-critical-unacknowledged.d.ts.map +1 -0
  40. package/dist/components/alert-icon/icons/icon-critical-unacknowledged.js +28 -0
  41. package/dist/components/alert-icon/icons/icon-critical-unacknowledged.js.map +1 -0
  42. package/dist/components/alert-icon/icons/icon-low-acknowledged.d.ts +2 -0
  43. package/dist/components/alert-icon/icons/icon-low-acknowledged.d.ts.map +1 -0
  44. package/dist/components/alert-icon/icons/icon-low-acknowledged.js +11 -0
  45. package/dist/components/alert-icon/icons/icon-low-acknowledged.js.map +1 -0
  46. package/dist/components/alert-icon/icons/icon-low-rectified.d.ts +3 -0
  47. package/dist/components/alert-icon/icons/icon-low-rectified.d.ts.map +1 -0
  48. package/dist/components/alert-icon/icons/icon-low-rectified.js +16 -0
  49. package/dist/components/alert-icon/icons/icon-low-rectified.js.map +1 -0
  50. package/dist/components/alert-icon/icons/icon-low-silenced.d.ts +3 -0
  51. package/dist/components/alert-icon/icons/icon-low-silenced.d.ts.map +1 -0
  52. package/dist/components/alert-icon/icons/icon-low-silenced.js +18 -0
  53. package/dist/components/alert-icon/icons/icon-low-silenced.js.map +1 -0
  54. package/dist/components/alert-icon/icons/icon-low-unacknowledged.d.ts +3 -0
  55. package/dist/components/alert-icon/icons/icon-low-unacknowledged.d.ts.map +1 -0
  56. package/dist/components/alert-icon/icons/icon-low-unacknowledged.js +16 -0
  57. package/dist/components/alert-icon/icons/icon-low-unacknowledged.js.map +1 -0
  58. package/dist/navigation-instruments/gauge-trend/gauge-trend.d.ts +16 -1
  59. package/dist/navigation-instruments/gauge-trend/gauge-trend.d.ts.map +1 -1
  60. package/dist/navigation-instruments/gauge-trend/gauge-trend.js +12 -0
  61. package/dist/navigation-instruments/gauge-trend/gauge-trend.js.map +1 -1
  62. package/dist/pages/alert-detail-page/alert-detail-page.d.ts.map +1 -1
  63. package/dist/pages/alert-detail-page/alert-detail-page.js +1 -2
  64. package/dist/pages/alert-detail-page/alert-detail-page.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/alert-severity.ts +8 -1
  67. package/src/bars-graphs/area-graph/area-graph.stories.ts +83 -1
  68. package/src/bars-graphs/line-graph/line-graph.stories.ts +148 -1
  69. package/src/building-blocks/chart-line/chart-line-base.stories.ts +1 -1
  70. package/src/building-blocks/chart-line/chart-line-base.ts +198 -70
  71. package/src/charthelpers/index.ts +1 -0
  72. package/src/charthelpers/x-value.spec.ts +102 -0
  73. package/src/charthelpers/x-value.ts +134 -0
  74. package/src/components/alert-button/alert-button.ts +1 -1
  75. package/src/components/alert-icon/alert-icon.stories.ts +69 -11
  76. package/src/components/alert-icon/alert-icon.ts +214 -64
  77. package/src/components/alert-icon/icons/icon-critical-acknowledged.ts +14 -0
  78. package/src/components/alert-icon/icons/icon-critical-rectified.ts +25 -0
  79. package/src/components/alert-icon/icons/{icon-warning-silenced.ts → icon-critical-silenced.ts} +23 -10
  80. package/src/components/alert-icon/icons/icon-critical-unacknowledged.ts +25 -0
  81. package/src/components/alert-icon/icons/icon-low-acknowledged.ts +8 -0
  82. package/src/components/alert-icon/icons/icon-low-rectified.ts +13 -0
  83. package/src/components/alert-icon/icons/icon-low-silenced.ts +15 -0
  84. package/src/components/alert-icon/icons/icon-low-unacknowledged.ts +13 -0
  85. package/src/navigation-instruments/gauge-trend/gauge-trend.stories.ts +42 -0
  86. package/src/navigation-instruments/gauge-trend/gauge-trend.ts +38 -1
  87. package/src/pages/alert-detail-page/alert-detail-page.ts +0 -2
  88. package/dist/components/alert-icon/icons/icon-alarm-rectified.d.ts +0 -3
  89. package/dist/components/alert-icon/icons/icon-alarm-rectified.d.ts.map +0 -1
  90. package/dist/components/alert-icon/icons/icon-alarm-rectified.js +0 -15
  91. package/dist/components/alert-icon/icons/icon-alarm-rectified.js.map +0 -1
  92. package/dist/components/alert-icon/icons/icon-alarm-silenced.d.ts +0 -3
  93. package/dist/components/alert-icon/icons/icon-alarm-silenced.d.ts.map +0 -1
  94. package/dist/components/alert-icon/icons/icon-alarm-silenced.js +0 -17
  95. package/dist/components/alert-icon/icons/icon-alarm-silenced.js.map +0 -1
  96. package/dist/components/alert-icon/icons/icon-alarm-unack.d.ts +0 -3
  97. package/dist/components/alert-icon/icons/icon-alarm-unack.d.ts.map +0 -1
  98. package/dist/components/alert-icon/icons/icon-alarm-unack.js +0 -15
  99. package/dist/components/alert-icon/icons/icon-alarm-unack.js.map +0 -1
  100. package/dist/components/alert-icon/icons/icon-warning-rectified.d.ts +0 -3
  101. package/dist/components/alert-icon/icons/icon-warning-rectified.d.ts.map +0 -1
  102. package/dist/components/alert-icon/icons/icon-warning-rectified.js +0 -15
  103. package/dist/components/alert-icon/icons/icon-warning-rectified.js.map +0 -1
  104. package/dist/components/alert-icon/icons/icon-warning-silenced.d.ts +0 -3
  105. package/dist/components/alert-icon/icons/icon-warning-silenced.d.ts.map +0 -1
  106. package/dist/components/alert-icon/icons/icon-warning-silenced.js.map +0 -1
  107. package/dist/components/alert-icon/icons/icon-warning-unack.d.ts +0 -3
  108. package/dist/components/alert-icon/icons/icon-warning-unack.d.ts.map +0 -1
  109. package/dist/components/alert-icon/icons/icon-warning-unack.js +0 -15
  110. package/dist/components/alert-icon/icons/icon-warning-unack.js.map +0 -1
  111. package/src/components/alert-icon/icons/icon-alarm-rectified.ts +0 -12
  112. package/src/components/alert-icon/icons/icon-alarm-silenced.ts +0 -14
  113. package/src/components/alert-icon/icons/icon-alarm-unack.ts +0 -12
  114. package/src/components/alert-icon/icons/icon-warning-rectified.ts +0 -12
  115. package/src/components/alert-icon/icons/icon-warning-unack.ts +0 -12
@@ -0,0 +1,134 @@
1
+ /**
2
+ * X-value normalization and formatting for line/area charts.
3
+ *
4
+ * Charts accept x-values as epoch milliseconds, ISO-8601 strings, `Date`
5
+ * instances, or Temporal objects (`Instant`, `ZonedDateTime`,
6
+ * `PlainDateTime`, `PlainDate`). All are normalized to a single number
7
+ * (epoch milliseconds in `'time'` mode, the plain value in `'number'` mode)
8
+ * so the Chart.js linear scale positions points proportionally.
9
+ *
10
+ * Temporal support is structural (duck-typed): there is no dependency on the
11
+ * Temporal API or a polyfill, and cross-realm/polyfilled objects work.
12
+ * Plain* types (which carry no time zone) are interpreted in the system
13
+ * time zone.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * normalizeXValue('2026-07-06T10:00:00Z', XValueMode.time); // epoch ms
18
+ * normalizeXValue(new Date(0), XValueMode.time); // 0
19
+ * normalizeXValue({epochMilliseconds: 42}, XValueMode.time); // 42 (Temporal)
20
+ * normalizeXValue('2.5', XValueMode.number); // 2.5
21
+ *
22
+ * formatXValue(ms, XValueMode.time, referenceMs); // '5min' (relative)
23
+ * formatXValue(ms, XValueMode.time); // locale date string
24
+ * formatXValue(2.5, XValueMode.number); // '2.5'
25
+ * ```
26
+ */
27
+
28
+ type TemporalEpochLike = {
29
+ epochMilliseconds: number;
30
+ };
31
+
32
+ type TemporalPlainLike = {
33
+ year: number;
34
+ month: number;
35
+ day: number;
36
+ hour?: number;
37
+ minute?: number;
38
+ second?: number;
39
+ millisecond?: number;
40
+ };
41
+
42
+ /** Structural type covering the supported Temporal object shapes. */
43
+ export type TemporalLike = TemporalEpochLike | TemporalPlainLike;
44
+
45
+ /** Every value accepted as a chart x-coordinate. */
46
+ export type ChartXValue = number | string | Date | TemporalLike;
47
+
48
+ /** X-axis interpretation used for normalization and formatting. */
49
+ export enum XValueMode {
50
+ time = 'time',
51
+ number = 'number',
52
+ }
53
+
54
+ function isTemporalEpochLike(v: object): v is TemporalEpochLike {
55
+ return typeof (v as TemporalEpochLike).epochMilliseconds === 'number';
56
+ }
57
+
58
+ function isTemporalPlainLike(v: object): v is TemporalPlainLike {
59
+ const t = v as TemporalPlainLike;
60
+ return (
61
+ typeof t.year === 'number' &&
62
+ typeof t.month === 'number' &&
63
+ typeof t.day === 'number'
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Normalize an x-value to a finite number, or NaN when unusable.
69
+ *
70
+ * Rules, in order:
71
+ * 1. `number` → as-is (epoch ms in time mode, plain value in number mode)
72
+ * 2. `Date` → `getTime()`
73
+ * 3. `{epochMilliseconds}` (Temporal Instant / ZonedDateTime) → epoch ms
74
+ * 4. `{year, month, day, …}` (Temporal PlainDateTime / PlainDate) →
75
+ * epoch ms in the system time zone
76
+ * 5. `string` → time mode: `Date.parse()` first, `Number()` fallback;
77
+ * number mode: `Number()` only
78
+ */
79
+ export function normalizeXValue(v: ChartXValue, mode: XValueMode): number {
80
+ if (typeof v === 'number') {
81
+ return Number.isFinite(v) ? v : NaN;
82
+ }
83
+ if (v instanceof Date) {
84
+ return v.getTime();
85
+ }
86
+ if (typeof v === 'object' && v !== null) {
87
+ if (isTemporalEpochLike(v)) return v.epochMilliseconds;
88
+ if (isTemporalPlainLike(v)) {
89
+ return new Date(
90
+ v.year,
91
+ v.month - 1,
92
+ v.day,
93
+ v.hour ?? 0,
94
+ v.minute ?? 0,
95
+ v.second ?? 0,
96
+ v.millisecond ?? 0
97
+ ).getTime();
98
+ }
99
+ return NaN;
100
+ }
101
+ if (typeof v === 'string') {
102
+ if (v.trim() === '') return NaN;
103
+ if (mode === XValueMode.time) {
104
+ const parsed = Date.parse(v);
105
+ if (Number.isFinite(parsed)) return parsed;
106
+ }
107
+ const numeric = Number(v);
108
+ return Number.isFinite(numeric) ? numeric : NaN;
109
+ }
110
+ return NaN;
111
+ }
112
+
113
+ /**
114
+ * Format a normalized x-value for axis tick labels and tooltips.
115
+ *
116
+ * Mirrors the historical chart-line tick formatting exactly: with a finite
117
+ * `relativeToMs` (time mode) renders `<n>min` relative to it; without one
118
+ * renders `toLocaleDateString()`. Number mode renders the plain value.
119
+ * Callers express the `TimeDisplay` choice by passing or omitting
120
+ * `relativeToMs`.
121
+ */
122
+ export function formatXValue(
123
+ value: number,
124
+ mode: XValueMode,
125
+ relativeToMs?: number
126
+ ): string {
127
+ if (!Number.isFinite(value)) return '';
128
+ if (mode === XValueMode.number) return String(value);
129
+ if (relativeToMs !== undefined && Number.isFinite(relativeToMs)) {
130
+ const minutes = Math.round((value - relativeToMs) / 60000);
131
+ return `${minutes}min`;
132
+ }
133
+ return new Date(value).toLocaleDateString();
134
+ }
@@ -288,7 +288,7 @@ export class ObcAlertButton extends LitElement {
288
288
  this.blinking &&
289
289
  hasAlerts &&
290
290
  this.alertType !== undefined &&
291
- supportsBlinking(this.alertType);
291
+ supportsBlinking(this.alertType, false);
292
292
  return html`
293
293
  <div
294
294
  class=${classMap({
@@ -31,7 +31,6 @@ const meta: Meta<typeof ObcAlertIcon> = {
31
31
  .type=${args.type}
32
32
  .acknowledged=${args.acknowledged}
33
33
  .active=${args.active}
34
- .outline=${args.outline}
35
34
  ></obc-alert-icon>
36
35
  </div>`,
37
36
  } satisfies Meta<ObcAlertIcon>;
@@ -89,21 +88,11 @@ export const Caution: Story = {
89
88
  },
90
89
  };
91
90
 
92
- export const AlarmOutline: Story = {
93
- args: {
94
- type: AlertType.Alarm,
95
- acknowledged: false,
96
- active: true,
97
- outline: true,
98
- },
99
- };
100
-
101
91
  export const LevelCritical: Story = {
102
92
  args: {
103
93
  type: AlertType.LevelCritical,
104
94
  acknowledged: false,
105
95
  active: true,
106
- outline: true,
107
96
  },
108
97
  };
109
98
 
@@ -138,3 +127,72 @@ export const LevelDiagnostic: Story = {
138
127
  active: true,
139
128
  },
140
129
  };
130
+
131
+ export const AlarmRectifiedNoAck: Story = {
132
+ args: {
133
+ type: AlertType.Alarm,
134
+ acknowledged: false,
135
+ active: false,
136
+ },
137
+ };
138
+
139
+ export const ApiMatrix: Story = {
140
+ render: (args) =>
141
+ html` <div
142
+ style="display:grid;grid-template-columns: auto repeat(8,32px);gap:16px"
143
+ >
144
+ <div></div>
145
+ ${Object.values(AlertType).map(
146
+ (type) =>
147
+ html`<div
148
+ style="display:flex;flex-direction:column;align-items:center"
149
+ >
150
+ ${type}
151
+ </div>`
152
+ )}
153
+ ${renderRow('Active', {
154
+ acknowledged: false,
155
+ active: true,
156
+ silenced: false,
157
+ })}
158
+ ${renderRow('Acknowledged', {
159
+ acknowledged: true,
160
+ active: true,
161
+ silenced: false,
162
+ })}
163
+ ${renderRow('Silenced', {
164
+ acknowledged: false,
165
+ active: true,
166
+ silenced: true,
167
+ })}
168
+ ${renderRow('Rectified', {
169
+ acknowledged: true,
170
+ active: false,
171
+ silenced: false,
172
+ })}
173
+ ${renderRow('Rectified unacknowledged', {
174
+ acknowledged: false,
175
+ active: false,
176
+ silenced: false,
177
+ })}
178
+ </div>`,
179
+ };
180
+
181
+ function renderRow(
182
+ label: string,
183
+ options: {acknowledged: boolean; active: boolean; silenced: boolean}
184
+ ) {
185
+ return html`
186
+ <div style="display:flex;flex-direction:column;align-items:center">${label}</div>
187
+ ${Object.values(AlertType).map(
188
+ (type) => html`
189
+ <obc-alert-icon
190
+ .type=${type}
191
+ .acknowledged=${options.acknowledged}
192
+ .active=${options.active}
193
+ .silenced=${options.silenced}
194
+ ></obc-alert-icon>
195
+ `
196
+ )}
197
+ </div>`;
198
+ }
@@ -1,21 +1,10 @@
1
1
  import {LitElement, html, css, TemplateResult, nothing} from 'lit';
2
2
  import {property} from 'lit/decorators.js';
3
3
  import {classMap} from 'lit/directives/class-map.js';
4
- import {alarmRectifiedA} from './icons/icon-alarm-rectified.js';
5
- import {warningRectifiedA} from './icons/icon-warning-rectified.js';
6
- import {alarmSilencedA, alarmSilencedB} from './icons/icon-alarm-silenced.js';
7
- import {
8
- warningSilencedA,
9
- warningSilencedB,
10
- } from './icons/icon-warning-silenced.js';
11
- import {alarmUnackA, alarmUnackB} from './icons/icon-alarm-unack.js';
12
- import {warningUnackA, warningUnackB} from './icons/icon-warning-unack.js';
13
4
  import '../../icons/icon-caution-color-iec.js';
14
5
  import {customElement} from '../../decorator.js';
15
6
  import {AlertType} from '../../types.js';
16
7
  import {
17
- getAlertBadgeComponent,
18
- AlertBadgeComponent,
19
8
  getAlertBlinkMode,
20
9
  getBamAlertTypeForBlinking,
21
10
  supportsBlinking,
@@ -23,9 +12,51 @@ import {
23
12
  import '../../icons/icon-alarm-badge-outline.js';
24
13
  import '../../icons/icon-warning-badge-outline.js';
25
14
  import '../../icons/icon-caution-badge-outline.js';
15
+ import '../../icons/icon-alarm-acknowledged-iec.js';
16
+ import '../../icons/icon-warning-acknowledged-iec.js';
17
+ import '../../icons/icon-alarm-rectified-iec.js';
18
+ import '../../icons/icon-warning-rectified-iec.js';
19
+ import '../../icons/icon-alarm-rectified-outlined.js';
20
+ import '../../icons/icon-warning-rectified-outlined.js';
21
+ import '../../icons/icon-alarm-silenced-iec.js';
22
+ import '../../icons/icon-alarm-silenced-outlined.js';
23
+ import '../../icons/icon-warning-silenced-iec.js';
24
+ import '../../icons/icon-warning-silenced-outlined.js';
25
+ import '../../icons/icon-alarm-unacknowledged-iec.js';
26
+ import '../../icons/icon-alarm-acknowledged-outlined.js';
27
+ import '../../icons/icon-warning-unacknowledged-iec.js';
28
+ import '../../icons/icon-warning-unacknowledged-outlined.js';
29
+
26
30
  import '../alert-frame/critical-badge.js';
27
31
  import '../alert-frame/diagnostic-badge.js';
28
32
  import {criticalA, criticalB} from './icons/icon-critical.js';
33
+ import {
34
+ criticalUnacknowledgedA,
35
+ criticalUnacknowledgedB,
36
+ } from './icons/icon-critical-unacknowledged.js';
37
+ import {
38
+ criticalSilencedA,
39
+ criticalSilencedB,
40
+ } from './icons/icon-critical-silenced.js';
41
+ import {
42
+ criticalRectifiedA,
43
+ criticalRectifiedB,
44
+ } from './icons/icon-critical-rectified.js';
45
+ import {criticalAcknowledged} from './icons/icon-critical-acknowledged.js';
46
+ import {
47
+ lowUnacknowledgedA,
48
+ lowUnacknowledgedB,
49
+ } from './icons/icon-low-unacknowledged.js';
50
+ import {lowSilencedA, lowSilencedB} from './icons/icon-low-silenced.js';
51
+ import {lowRectifiedA, lowRectifiedB} from './icons/icon-low-rectified.js';
52
+ import {lowAcknowledged} from './icons/icon-low-acknowledged.js';
53
+
54
+ enum AlertIconState {
55
+ Silenced = 'silenced',
56
+ Unacknowledged = 'unacknowledged',
57
+ Acknowledged = 'acknowledged',
58
+ Rectified = 'rectified',
59
+ }
29
60
 
30
61
  enum AlertIconName {
31
62
  AlarmSilenced = 'alarm-silenced',
@@ -35,37 +66,85 @@ enum AlertIconName {
35
66
  WarningRectified = 'warning-rectified',
36
67
  WarningSilenced = 'warning-silenced',
37
68
  Critical = 'critical',
69
+ CriticalUnack = 'critical-unack',
70
+ CriticalSilenced = 'critical-silenced',
71
+ CriticalRectified = 'critical-rectified',
72
+ LowUnack = 'low-unack',
73
+ LowSilenced = 'low-silenced',
74
+ LowRectified = 'low-rectified',
38
75
  }
39
76
 
40
77
  const mapping = {
41
78
  [AlertIconName.AlarmSilenced]: {
42
- a: alarmSilencedA,
43
- b: alarmSilencedB,
79
+ a: html`<obi-alarm-silenced-iec usecsscolor></obi-alarm-silenced-iec>`,
80
+ b: html`<obi-alarm-silenced-outlined
81
+ usecsscolor
82
+ ></obi-alarm-silenced-outlined>`,
44
83
  },
45
84
  [AlertIconName.AlarmUnack]: {
46
- a: alarmUnackA,
47
- b: alarmUnackB,
85
+ a: html`<obi-alarm-unacknowledged-iec
86
+ usecsscolor
87
+ ></obi-alarm-unacknowledged-iec>`,
88
+ b: html`<obi-alarm-acknowledged-outlined
89
+ usecsscolor
90
+ ></obi-alarm-acknowledged-outlined>`,
48
91
  },
49
92
  [AlertIconName.AlarmRectified]: {
50
- a: alarmRectifiedA,
51
- b: alarmRectifiedA,
93
+ a: html`<obi-alarm-rectified-iec usecsscolor></obi-alarm-rectified-iec>`,
94
+ b: html`<obi-alarm-rectified-outlined
95
+ usecsscolor
96
+ ></obi-alarm-rectified-outlined>`,
52
97
  },
53
98
  [AlertIconName.WarningUnack]: {
54
- a: warningUnackA,
55
- b: warningUnackB,
99
+ a: html`<obi-warning-unacknowledged-iec
100
+ usecsscolor
101
+ ></obi-warning-unacknowledged-iec>`,
102
+ b: html`<obi-warning-unacknowledged-outlined
103
+ usecsscolor
104
+ ></obi-warning-unacknowledged-outlined>`,
56
105
  },
57
106
  [AlertIconName.WarningRectified]: {
58
- a: warningRectifiedA,
59
- b: warningRectifiedA,
107
+ a: html`<obi-warning-rectified-iec
108
+ usecsscolor
109
+ ></obi-warning-rectified-iec>`,
110
+ b: html`<obi-warning-rectified-outlined
111
+ usecsscolor
112
+ ></obi-warning-rectified-outlined>`,
60
113
  },
61
114
  [AlertIconName.WarningSilenced]: {
62
- a: warningSilencedA,
63
- b: warningSilencedB,
115
+ a: html`<obi-warning-silenced-iec usecsscolor></obi-warning-silenced-iec>`,
116
+ b: html`<obi-warning-silenced-outlined
117
+ usecsscolor
118
+ ></obi-warning-silenced-outlined>`,
64
119
  },
65
120
  [AlertIconName.Critical]: {
66
121
  a: criticalA,
67
122
  b: criticalB,
68
123
  },
124
+ [AlertIconName.CriticalUnack]: {
125
+ a: criticalUnacknowledgedA,
126
+ b: criticalUnacknowledgedB,
127
+ },
128
+ [AlertIconName.CriticalSilenced]: {
129
+ a: criticalSilencedA,
130
+ b: criticalSilencedB,
131
+ },
132
+ [AlertIconName.CriticalRectified]: {
133
+ a: criticalRectifiedA,
134
+ b: criticalRectifiedB,
135
+ },
136
+ [AlertIconName.LowUnack]: {
137
+ a: lowUnacknowledgedA,
138
+ b: lowUnacknowledgedB,
139
+ },
140
+ [AlertIconName.LowSilenced]: {
141
+ a: lowSilencedA,
142
+ b: lowSilencedB,
143
+ },
144
+ [AlertIconName.LowRectified]: {
145
+ a: lowRectifiedA,
146
+ b: lowRectifiedB,
147
+ },
69
148
  };
70
149
  /**
71
150
  * `obc-alert-icon` – Animated alert icon for signaling alarm and warning states.
@@ -103,27 +182,76 @@ const mapping = {
103
182
  */
104
183
  @customElement('obc-alert-icon')
105
184
  export class ObcAlertIcon extends LitElement {
106
- @property({type: String}) type!: AlertType;
107
- /** @availableWhen outline==false && type in [Alarm, Warning, LevelHigh, LevelMedium] */
108
- @property({type: Boolean}) acknowledged!: boolean;
109
- /** @availableWhen outline==false && type in [Alarm, Warning, LevelHigh, LevelMedium] */
110
- @property({type: Boolean}) active!: boolean;
111
- @property({type: Boolean}) outline!: boolean;
185
+ @property({type: String}) alertType: AlertType = AlertType.Alarm;
186
+ /* @deprecated use `alertType` instead */
187
+ @property({type: String}) type?: AlertType;
188
+ /**
189
+ * @availableWhen type in [Alarm, Warning, LevelHigh, LevelMedium, LevelLow]
190
+ */
191
+ @property({type: Boolean}) acknowledged?: boolean;
192
+ /**
193
+ * @availableWhen type in [Alarm, Warning, LevelHigh, LevelMedium, LevelLow]
194
+ */
195
+ @property({type: Boolean}) active?: boolean;
196
+ @property({type: Boolean}) silenced?: boolean;
197
+
198
+ private get _effectiveType(): AlertType {
199
+ if (this.type) {
200
+ return this.type;
201
+ }
202
+ return this.alertType;
203
+ }
112
204
 
113
205
  private get bamType(): AlertType {
114
- return getBamAlertTypeForBlinking(this.type);
206
+ return getBamAlertTypeForBlinking(this._effectiveType);
207
+ }
208
+
209
+ private get _effectiveState(): AlertIconState {
210
+ if (this.active === false) {
211
+ return AlertIconState.Rectified;
212
+ } else if (this.acknowledged) {
213
+ return AlertIconState.Acknowledged;
214
+ } else if (this.silenced) {
215
+ return AlertIconState.Silenced;
216
+ } else if (this.active === true) {
217
+ return AlertIconState.Unacknowledged;
218
+ }
219
+ return AlertIconState.Unacknowledged;
115
220
  }
116
221
 
117
222
  get icon() {
118
- if (this.type === AlertType.LevelCritical) {
119
- return mapping[AlertIconName.Critical];
223
+ if (this._effectiveType === AlertType.LevelCritical) {
224
+ switch (this._effectiveState) {
225
+ case AlertIconState.Rectified:
226
+ return mapping[AlertIconName.CriticalRectified];
227
+ case AlertIconState.Silenced:
228
+ return mapping[AlertIconName.CriticalSilenced];
229
+ case AlertIconState.Unacknowledged:
230
+ return mapping[AlertIconName.CriticalUnack];
231
+ default:
232
+ return mapping[AlertIconName.Critical];
233
+ }
234
+ } else if (this._effectiveType === AlertType.LevelLow) {
235
+ switch (this._effectiveState) {
236
+ case AlertIconState.Rectified:
237
+ return mapping[AlertIconName.LowRectified];
238
+ case AlertIconState.Silenced:
239
+ return mapping[AlertIconName.LowSilenced];
240
+ case AlertIconState.Unacknowledged:
241
+ return mapping[AlertIconName.LowUnack];
242
+ default:
243
+ return mapping[AlertIconName.LowUnack];
244
+ }
120
245
  } else if (this.bamType === AlertType.Alarm) {
121
- if (this.active === false) {
122
- return mapping[AlertIconName.AlarmRectified];
123
- } else if (this.acknowledged) {
124
- return mapping[AlertIconName.AlarmSilenced];
125
- } else {
126
- return mapping[AlertIconName.AlarmUnack];
246
+ switch (this._effectiveState) {
247
+ case AlertIconState.Rectified:
248
+ return mapping[AlertIconName.AlarmRectified];
249
+ case AlertIconState.Silenced:
250
+ return mapping[AlertIconName.AlarmSilenced];
251
+ case AlertIconState.Unacknowledged:
252
+ return mapping[AlertIconName.AlarmUnack];
253
+ default:
254
+ return null;
127
255
  }
128
256
  } else if (this.bamType === AlertType.Warning) {
129
257
  if (this.active === false) {
@@ -138,48 +266,68 @@ export class ObcAlertIcon extends LitElement {
138
266
  return null;
139
267
  }
140
268
 
141
- private renderOutlineIcon(): TemplateResult {
142
- switch (getAlertBadgeComponent(this.type)) {
143
- case AlertBadgeComponent.Critical:
144
- return html`<obi-critical-badge></obi-critical-badge>`;
145
- case AlertBadgeComponent.Warning:
146
- return html`<obi-warning-badge-outline></obi-warning-badge-outline>`;
147
- case AlertBadgeComponent.Caution:
148
- return html`<obi-caution-badge-outline></obi-caution-badge-outline>`;
149
- case AlertBadgeComponent.Diagnostic:
150
- return html`<obi-diagnostic-badge
151
- style="color: var(--alert-diagnostic-color);"
152
- ></obi-diagnostic-badge>`;
153
- default:
154
- return html`<obi-alarm-badge-outline></obi-alarm-badge-outline>`;
155
- }
156
- }
157
-
158
269
  private renderStaticIcon(): TemplateResult | typeof nothing {
159
- if (this.type === AlertType.Caution || this.type === AlertType.LevelLow) {
270
+ // Caution and diagnostic always show a fixed symbol, regardless of state.
271
+ if (this._effectiveType === AlertType.Caution) {
160
272
  return html`<obi-caution-color-iec usecsscolor></obi-caution-color-iec>`;
161
273
  }
162
- if (this.type === AlertType.LevelDiagnostic) {
274
+ if (this._effectiveType === AlertType.LevelDiagnostic) {
163
275
  return html`<obi-diagnostic-badge
164
276
  style="color: var(--alert-diagnostic-color);"
165
277
  ></obi-diagnostic-badge>`;
166
278
  }
279
+ if (this._effectiveState === AlertIconState.Acknowledged) {
280
+ if (this._effectiveType === AlertType.LevelCritical) {
281
+ return html`${criticalAcknowledged}`;
282
+ }
283
+ if (this._effectiveType === AlertType.LevelLow) {
284
+ return html`${lowAcknowledged}`;
285
+ }
286
+ switch (this.bamType) {
287
+ case AlertType.Alarm:
288
+ return html`<obi-alarm-acknowledged-iec
289
+ usecsscolor
290
+ ></obi-alarm-acknowledged-iec>`;
291
+ case AlertType.Warning:
292
+ return html`<obi-warning-acknowledged-iec
293
+ usecsscolor
294
+ ></obi-warning-acknowledged-iec>`;
295
+ default:
296
+ return nothing;
297
+ }
298
+ } else if (this._effectiveState === AlertIconState.Rectified) {
299
+ if (this._effectiveType === AlertType.LevelCritical) {
300
+ return html`${criticalRectifiedB}`;
301
+ }
302
+ if (this._effectiveType === AlertType.LevelLow) {
303
+ return html`${lowRectifiedB}`;
304
+ }
305
+ switch (this.bamType) {
306
+ case AlertType.Alarm:
307
+ return html`<obi-alarm-rectified-outlined
308
+ usecsscolor
309
+ ></obi-alarm-rectified-outlined>`;
310
+ case AlertType.Warning:
311
+ return html`<obi-warning-rectified-outlined
312
+ usecsscolor
313
+ ></obi-warning-rectified-outlined>`;
314
+ default:
315
+ return nothing;
316
+ }
317
+ }
167
318
  return nothing;
168
319
  }
169
320
 
170
321
  override render() {
171
- if (!this.type) {
322
+ if (!this._effectiveType) {
172
323
  return html`<div>No alarm</div>`;
173
324
  }
174
- if (this.outline) {
175
- return html`<div class="wrapper">${this.renderOutlineIcon()}</div>`;
176
- }
177
- if (supportsBlinking(this.type) && !(this.type === AlertType.LevelLow)) {
325
+ if (supportsBlinking(this._effectiveType, this.acknowledged ?? false)) {
178
326
  const icons = this.icon;
179
327
  if (!icons) {
180
328
  throw new Error('No icon found');
181
329
  }
182
- const blinkMode = getAlertBlinkMode(this.type);
330
+ const blinkMode = getAlertBlinkMode(this._effectiveType);
183
331
  return html`
184
332
  <div
185
333
  class=${classMap({
@@ -211,7 +359,9 @@ export class ObcAlertIcon extends LitElement {
211
359
  left: 0;
212
360
  }
213
361
 
214
- svg {
362
+ svg,
363
+ .a,
364
+ .b {
215
365
  height: 100%;
216
366
  width: 100%;
217
367
  position: absolute;
@@ -0,0 +1,14 @@
1
+ import {svg} from 'lit';
2
+
3
+ export const criticalAcknowledged = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
4
+ <path d="M 22,12
5
+ L 17,20.66
6
+ L 7,20.66
7
+ L 2,12
8
+ L 7,3.34
9
+ L 17,3.34
10
+ Z"
11
+ fill="var(--alert-critical-color)" stroke="var(--alert-critical-outline-color)" />
12
+ <path d="M13 13V7H11V13H13Z" fill="var(--on-critical-active-color)"/>
13
+ <path d="M13 17V15H11V17H13Z" fill="var(--on-critical-active-color)"/>
14
+ </svg>`;
@@ -0,0 +1,25 @@
1
+ import {svg} from 'lit';
2
+
3
+ export const criticalRectifiedA = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
4
+ <path d="M 22,12
5
+ L 17,20.66
6
+ L 7,20.66
7
+ L 2,12
8
+ L 7,3.34
9
+ L 17,3.34
10
+ Z"
11
+ fill="var(--alert-critical-color)" stroke="var(--alert-critical-outline-color)" />
12
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M18.2071 9.20706L10.5 16.9142L5.79291 12.2071L7.20712 10.7928L10.5 14.0857L16.7929 7.79285L18.2071 9.20706Z" fill="var(--on-critical-active-color)"/>
13
+ </svg>`;
14
+
15
+ export const criticalRectifiedB = svg`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
16
+ <path d="M 22,12
17
+ L 17,20.66
18
+ L 7,20.66
19
+ L 2,12
20
+ L 7,3.34
21
+ L 17,3.34
22
+ Z"
23
+ fill="none" stroke="var(--element-active-color)" />
24
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M18.2071 9.20706L10.5 16.9142L5.79291 12.2071L7.20712 10.7928L10.5 14.0857L16.7929 7.79285L18.2071 9.20706Z" fill="var(--element-active-color)"/>
25
+ </svg>`;