@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.15 → 2.2.0-next.16

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 (29) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +147 -44
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +39 -1
  4. package/dist/automation/automation-badge/automation-badge.css_inline.js +6 -0
  5. package/dist/automation/automation-badge/automation-badge.d.ts +61 -1
  6. package/dist/automation/automation-badge/automation-badge.d.ts.map +1 -1
  7. package/dist/automation/automation-badge/automation-badge.js +83 -1
  8. package/dist/automation/automation-badge/automation-badge.js.map +1 -1
  9. package/dist/automation/automation-button/abstract-automation-button.d.ts +5 -2
  10. package/dist/automation/automation-button/abstract-automation-button.d.ts.map +1 -1
  11. package/dist/automation/automation-button/abstract-automation-button.js +6 -0
  12. package/dist/automation/automation-button/abstract-automation-button.js.map +1 -1
  13. package/dist/automation/automation-tank/automation-tank.d.ts.map +1 -1
  14. package/dist/automation/automation-tank/automation-tank.js +7 -2
  15. package/dist/automation/automation-tank/automation-tank.js.map +1 -1
  16. package/dist/automation/specialty-tank/abstract-specialty-tank.d.ts.map +1 -1
  17. package/dist/automation/specialty-tank/abstract-specialty-tank.js +7 -2
  18. package/dist/automation/specialty-tank/abstract-specialty-tank.js.map +1 -1
  19. package/package.json +3 -2
  20. package/script/check-typography-ramp.ts +144 -0
  21. package/script/typography/ramp.ts +237 -0
  22. package/script/typography-ramp.test.ts +267 -0
  23. package/src/automation/analog-valve/analog-valve.stories.ts +8 -0
  24. package/src/automation/automation-badge/automation-badge.css +6 -0
  25. package/src/automation/automation-badge/automation-badge.stories.ts +47 -3
  26. package/src/automation/automation-badge/automation-badge.ts +124 -1
  27. package/src/automation/automation-button/abstract-automation-button.ts +13 -0
  28. package/src/automation/automation-tank/automation-tank.ts +11 -6
  29. package/src/automation/specialty-tank/abstract-specialty-tank.ts +11 -6
@@ -47,9 +47,35 @@ export const AllVariants: Story = {
47
47
  <div
48
48
  style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;"
49
49
  >
50
- ${Object.values(ObcAutomationBadgeType).map((type) =>
51
- Object.values(ObcAutomationBadgeMode).map(
52
- (mode) => html`
50
+ ${Object.values(ObcAutomationBadgeType)
51
+ .filter((type) => !type.startsWith('letter-'))
52
+ .map((type) =>
53
+ Object.values(ObcAutomationBadgeMode).map(
54
+ (mode) => html`
55
+ <obc-automation-badge
56
+ .mode=${mode}
57
+ .type=${type}
58
+ ></obc-automation-badge>
59
+ `
60
+ )
61
+ )}
62
+ </div>
63
+ `;
64
+ },
65
+ };
66
+
67
+ export const Letters: Story = {
68
+ render() {
69
+ const letters = Object.values(ObcAutomationBadgeType).filter((type) =>
70
+ type.startsWith('letter-')
71
+ );
72
+ return html`
73
+ <div
74
+ style="display: grid; grid-template-columns: repeat(${letters.length}, auto); gap: 10px; justify-content: start;"
75
+ >
76
+ ${Object.values(ObcAutomationBadgeMode).map((mode) =>
77
+ letters.map(
78
+ (type) => html`
53
79
  <obc-automation-badge
54
80
  .mode=${mode}
55
81
  .type=${type}
@@ -98,6 +124,24 @@ export const InterlockInhibit: Story = {
98
124
  },
99
125
  };
100
126
 
127
+ export const AlertShelved: Story = {
128
+ args: {
129
+ type: ObcAutomationBadgeType.AlertShelved,
130
+ },
131
+ };
132
+
133
+ export const Simulation: Story = {
134
+ args: {
135
+ type: ObcAutomationBadgeType.Simulation,
136
+ },
137
+ };
138
+
139
+ export const Letter: Story = {
140
+ args: {
141
+ type: ObcAutomationBadgeType.LetterS,
142
+ },
143
+ };
144
+
101
145
  export const SlottedIcon: Story = {
102
146
  render(args) {
103
147
  return html`<obc-automation-badge .mode=${args.mode}>
@@ -4,6 +4,7 @@ import compentStyle from './automation-badge.css?inline';
4
4
  import {classMap} from 'lit/directives/class-map.js';
5
5
  import {customElement} from '../../decorator.js';
6
6
  import '../../icons/icon-alert-off-filled.js';
7
+ import '../../icons/icon-alerts-shelf.js';
7
8
  import '../../icons/icon-auto.js';
8
9
  import '../../icons/icon-manual.js';
9
10
  import '../../icons/icon-manual-only.js';
@@ -29,6 +30,8 @@ export enum ObcAutomationBadgeType {
29
30
  Interlock = 'interlock',
30
31
  InterlockInhibit = 'interlock-inhibit',
31
32
  AlertSilenced = 'alert-silenced',
33
+ AlertShelved = 'alert-shelved',
34
+ Simulation = 'simulation',
32
35
  Caution = 'caution',
33
36
  Warning = 'warning',
34
37
  Alarm = 'alarm',
@@ -37,6 +40,32 @@ export enum ObcAutomationBadgeType {
37
40
  LevelMedium = 'level-medium',
38
41
  LevelLow = 'level-low',
39
42
  LevelDiagnostic = 'level-diagnostic',
43
+ LetterA = 'letter-a',
44
+ LetterB = 'letter-b',
45
+ LetterC = 'letter-c',
46
+ LetterD = 'letter-d',
47
+ LetterE = 'letter-e',
48
+ LetterF = 'letter-f',
49
+ LetterG = 'letter-g',
50
+ LetterH = 'letter-h',
51
+ LetterI = 'letter-i',
52
+ LetterJ = 'letter-j',
53
+ LetterK = 'letter-k',
54
+ LetterL = 'letter-l',
55
+ LetterM = 'letter-m',
56
+ LetterN = 'letter-n',
57
+ LetterO = 'letter-o',
58
+ LetterP = 'letter-p',
59
+ LetterQ = 'letter-q',
60
+ LetterR = 'letter-r',
61
+ LetterS = 'letter-s',
62
+ LetterT = 'letter-t',
63
+ LetterU = 'letter-u',
64
+ LetterV = 'letter-v',
65
+ LetterW = 'letter-w',
66
+ LetterX = 'letter-x',
67
+ LetterY = 'letter-y',
68
+ LetterZ = 'letter-z',
40
69
  }
41
70
 
42
71
  const ALERT_BADGE_TYPES: ObcAutomationBadgeType[] = [
@@ -51,6 +80,47 @@ const ALERT_BADGE_TYPES: ObcAutomationBadgeType[] = [
51
80
  ];
52
81
 
53
82
  /**
83
+ * Letter badge geometry in the 16-unit badge box.
84
+ *
85
+ * The design outlines a 15.33 px capital on a 13.33 baseline, so the glyph
86
+ * fills the box the way the icon badges do (Figma 1188:55068).
87
+ */
88
+ const LETTER_FONT_SIZE = 15.33;
89
+ const LETTER_BASELINE = 13.33;
90
+
91
+ /** The capital a `letter-<x>` type draws, `undefined` for every other type. */
92
+ function badgeLetter(
93
+ type: ObcAutomationBadgeType | undefined
94
+ ): string | undefined {
95
+ return type?.match(/^letter-([a-z])$/)?.[1].toUpperCase();
96
+ }
97
+
98
+ /**
99
+ * Automation badge: one state glyph in the corner of a device button, tank
100
+ * or tile.
101
+ *
102
+ * ## Features
103
+ *
104
+ * - `type` picks the glyph: control mode (`auto`, `manual`, `manual-only`,
105
+ * `local`, `local-only`), `command-locked`, `interlock`,
106
+ * `interlock-inhibit`, `simulation`, `alert-silenced`, `alert-shelved`,
107
+ * the alert categories (`caution`, `warning`, `alarm`), the alert levels
108
+ * (`level-critical` to `level-diagnostic`) and one capital letter
109
+ * (`letter-a` to `letter-z`).
110
+ * - `mode` picks the surface: `flat` draws the glyph with a silhouette
111
+ * outline straight on the device, `regular` and `enhanced` put it on a
112
+ * bordered or raised chip. Alert categories and levels carry their own
113
+ * colour and render flat whatever the mode.
114
+ * - Without a built-in type the slots take a custom glyph.
115
+ *
116
+ * ## Usage
117
+ *
118
+ * Device buttons and tanks place it through `badgeControl`, `badgeAlert`,
119
+ * `badgeInterlock` and `badgeCommandLocked`; use the element directly for a
120
+ * badge outside those four corners.
121
+ *
122
+ * @property mode - Surface of the badge: `flat`, `regular` or `enhanced`.
123
+ * @property type - Built-in glyph to draw; unset renders the slots.
54
124
  * @slot icon-silhouette - Custom silhouette/outline icon, rendered behind the default slot content when no built-in badge type matches.
55
125
  * @slot - Default slot for custom badge content, rendered when no built-in badge type matches.
56
126
  * @stable
@@ -138,9 +208,53 @@ export class ObcAutomationBadge extends LitElement {
138
208
  </svg>`;
139
209
  }
140
210
 
211
+ /** The cube of the simulated badge, as the design draws it (Figma 1188:54997). */
212
+ private renderSimulationIcon(className: string) {
213
+ return html`<svg
214
+ class=${className}
215
+ viewBox="0 0 16 16"
216
+ fill="currentColor"
217
+ xmlns="http://www.w3.org/2000/svg"
218
+ >
219
+ <path
220
+ d="M7.33333 14.4833V8.38333L2 5.3V10.65C2 10.8944 2.05833 11.1167 2.175 11.3167C2.29167 11.5167 2.45555 11.6778 2.66667 11.8L7.33333 14.4833ZM8.66667 14.4833L13.3333 11.8C13.5444 11.6778 13.7083 11.5167 13.825 11.3167C13.9417 11.1167 14 10.8944 14 10.65V5.3L8.66667 8.38333V14.4833Z"
221
+ />
222
+ <path
223
+ d="M13.2833 4.16667L8.66667 1.51667C8.45556 1.39444 8.23333 1.33333 8 1.33333C7.76667 1.33333 7.54444 1.39444 7.33333 1.51667L2.7 4.18333L8 7.23333L13.2833 4.16667Z"
224
+ />
225
+ </svg>`;
226
+ }
227
+
228
+ /** A letter badge: one capital of the body font, hidden from assistive technology because the badge draws it twice. */
229
+ private renderLetterIcon(letter: string, className: string) {
230
+ return html`<svg
231
+ class=${className}
232
+ viewBox="0 0 16 16"
233
+ fill="currentColor"
234
+ aria-hidden="true"
235
+ xmlns="http://www.w3.org/2000/svg"
236
+ >
237
+ <text
238
+ class="letter"
239
+ x="8"
240
+ y=${LETTER_BASELINE}
241
+ font-size=${LETTER_FONT_SIZE}
242
+ text-anchor="middle"
243
+ >
244
+ ${letter}
245
+ </text>
246
+ </svg>`;
247
+ }
248
+
141
249
  // TODO(designer): rename the 'siluette' typo to 'silhouette', in Figma too
142
250
  private getIcon() {
143
- if (this.type === ObcAutomationBadgeType.Auto) {
251
+ const letter = badgeLetter(this.type);
252
+ if (letter) {
253
+ return html`${this.renderLetterIcon(
254
+ letter,
255
+ 'icon siluette'
256
+ )}${this.renderLetterIcon(letter, 'icon')}`;
257
+ } else if (this.type === ObcAutomationBadgeType.Auto) {
144
258
  return html`<obi-auto class="icon siluette"></obi-auto
145
259
  ><obi-auto class="icon"></obi-auto>`;
146
260
  } else if (this.type === ObcAutomationBadgeType.Manual) {
@@ -171,6 +285,15 @@ export class ObcAutomationBadge extends LitElement {
171
285
  class="icon siluette"
172
286
  ></obi-alert-off-filled
173
287
  ><obi-alert-off-filled class="icon"></obi-alert-off-filled>`;
288
+ } else if (this.type === ObcAutomationBadgeType.AlertShelved) {
289
+ // TODO(designer): the sketch draws shelved as a diamond with a plus and
290
+ // the alert counter uses a timer; this badge keeps alerts-shelf (#1424)
291
+ return html`<obi-alerts-shelf class="icon siluette"></obi-alerts-shelf
292
+ ><obi-alerts-shelf class="icon"></obi-alerts-shelf>`;
293
+ } else if (this.type === ObcAutomationBadgeType.Simulation) {
294
+ return html`${this.renderSimulationIcon(
295
+ 'icon siluette'
296
+ )}${this.renderSimulationIcon('icon')}`;
174
297
  } else if (this.type === ObcAutomationBadgeType.LevelCritical) {
175
298
  return this.renderLevelCriticalIcon(
176
299
  this.effectiveMode === ObcAutomationBadgeMode.Flat
@@ -40,6 +40,7 @@ import {CircularProgressMode} from '../../building-blocks/circular-progress/circ
40
40
  export enum AutomationButtonBadgeAlert {
41
41
  None = 'none',
42
42
  Silence = 'silence',
43
+ Shelved = 'shelved',
43
44
  Caution = 'caution',
44
45
  Warning = 'warning',
45
46
  Alarm = 'alarm',
@@ -54,6 +55,7 @@ export enum AutomationButtonBadgeInterlock {
54
55
  None = 'none',
55
56
  Interlock = 'interlock',
56
57
  InterlockInhibit = 'interlock-inhibit',
58
+ Simulation = 'simulation',
57
59
  }
58
60
 
59
61
  export enum AutomationButtonBadgeControl {
@@ -68,6 +70,7 @@ export enum AutomationButtonBadgeControl {
68
70
  export enum AutomationButtonBadgeCommandLocked {
69
71
  None = 'none',
70
72
  CommandLocked = 'command-locked',
73
+ Simulation = 'simulation',
71
74
  }
72
75
 
73
76
  /**
@@ -270,6 +273,8 @@ export class ObcAbstractAutomationButton extends LitElement {
270
273
  private getBadgeAlertType(): ObcAutomationBadgeType | null {
271
274
  if (this.badgeAlert === AutomationButtonBadgeAlert.Silence) {
272
275
  return ObcAutomationBadgeType.AlertSilenced;
276
+ } else if (this.badgeAlert === AutomationButtonBadgeAlert.Shelved) {
277
+ return ObcAutomationBadgeType.AlertShelved;
273
278
  } else if (this.badgeAlert === AutomationButtonBadgeAlert.Caution) {
274
279
  return ObcAutomationBadgeType.Caution;
275
280
  } else if (this.badgeAlert === AutomationButtonBadgeAlert.Warning) {
@@ -312,6 +317,10 @@ export class ObcAbstractAutomationButton extends LitElement {
312
317
  this.badgeInterlock === AutomationButtonBadgeInterlock.InterlockInhibit
313
318
  ) {
314
319
  return ObcAutomationBadgeType.InterlockInhibit;
320
+ } else if (
321
+ this.badgeInterlock === AutomationButtonBadgeInterlock.Simulation
322
+ ) {
323
+ return ObcAutomationBadgeType.Simulation;
315
324
  }
316
325
  return null;
317
326
  }
@@ -322,6 +331,10 @@ export class ObcAbstractAutomationButton extends LitElement {
322
331
  AutomationButtonBadgeCommandLocked.CommandLocked
323
332
  ) {
324
333
  return ObcAutomationBadgeType.CommandLocked;
334
+ } else if (
335
+ this.badgeCommandLocked === AutomationButtonBadgeCommandLocked.Simulation
336
+ ) {
337
+ return ObcAutomationBadgeType.Simulation;
325
338
  }
326
339
  return null;
327
340
  }
@@ -274,6 +274,8 @@ export class ObcAutomationTank extends AdviceMixin(SetpointMixin(LitElement)) {
274
274
  switch (this.badgeAlert) {
275
275
  case AutomationButtonBadgeAlert.Silence:
276
276
  return ObcAutomationBadgeType.AlertSilenced;
277
+ case AutomationButtonBadgeAlert.Shelved:
278
+ return ObcAutomationBadgeType.AlertShelved;
277
279
  case AutomationButtonBadgeAlert.Caution:
278
280
  return ObcAutomationBadgeType.Caution;
279
281
  case AutomationButtonBadgeAlert.Warning:
@@ -318,19 +320,22 @@ export class ObcAutomationTank extends AdviceMixin(SetpointMixin(LitElement)) {
318
320
  return ObcAutomationBadgeType.Interlock;
319
321
  case AutomationButtonBadgeInterlock.InterlockInhibit:
320
322
  return ObcAutomationBadgeType.InterlockInhibit;
323
+ case AutomationButtonBadgeInterlock.Simulation:
324
+ return ObcAutomationBadgeType.Simulation;
321
325
  default:
322
326
  return null;
323
327
  }
324
328
  }
325
329
 
326
330
  private _badgeCommandLockedType(): ObcAutomationBadgeType | null {
327
- if (
328
- this.badgeCommandLocked ===
329
- AutomationButtonBadgeCommandLocked.CommandLocked
330
- ) {
331
- return ObcAutomationBadgeType.CommandLocked;
331
+ switch (this.badgeCommandLocked) {
332
+ case AutomationButtonBadgeCommandLocked.CommandLocked:
333
+ return ObcAutomationBadgeType.CommandLocked;
334
+ case AutomationButtonBadgeCommandLocked.Simulation:
335
+ return ObcAutomationBadgeType.Simulation;
336
+ default:
337
+ return null;
332
338
  }
333
- return null;
334
339
  }
335
340
 
336
341
  private get _usesGaugeTrend(): boolean {
@@ -177,6 +177,8 @@ export class ObcAbstractSpecialtyTank extends LitElement {
177
177
  switch (this.badgeAlert) {
178
178
  case AutomationButtonBadgeAlert.Silence:
179
179
  return ObcAutomationBadgeType.AlertSilenced;
180
+ case AutomationButtonBadgeAlert.Shelved:
181
+ return ObcAutomationBadgeType.AlertShelved;
180
182
  case AutomationButtonBadgeAlert.Caution:
181
183
  return ObcAutomationBadgeType.Caution;
182
184
  case AutomationButtonBadgeAlert.Warning:
@@ -204,19 +206,22 @@ export class ObcAbstractSpecialtyTank extends LitElement {
204
206
  return ObcAutomationBadgeType.Interlock;
205
207
  case AutomationButtonBadgeInterlock.InterlockInhibit:
206
208
  return ObcAutomationBadgeType.InterlockInhibit;
209
+ case AutomationButtonBadgeInterlock.Simulation:
210
+ return ObcAutomationBadgeType.Simulation;
207
211
  default:
208
212
  return null;
209
213
  }
210
214
  }
211
215
 
212
216
  private _badgeCommandLockedType(): ObcAutomationBadgeType | null {
213
- if (
214
- this.badgeCommandLocked ===
215
- AutomationButtonBadgeCommandLocked.CommandLocked
216
- ) {
217
- return ObcAutomationBadgeType.CommandLocked;
217
+ switch (this.badgeCommandLocked) {
218
+ case AutomationButtonBadgeCommandLocked.CommandLocked:
219
+ return ObcAutomationBadgeType.CommandLocked;
220
+ case AutomationButtonBadgeCommandLocked.Simulation:
221
+ return ObcAutomationBadgeType.Simulation;
222
+ default:
223
+ return null;
218
224
  }
219
- return null;
220
225
  }
221
226
 
222
227
  private _slotHasContent(e: Event): boolean {