@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.1 → 2.2.0-next.3

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 (36) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +42 -16
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +88 -13
  4. package/dist/components/alert-button/alert-button.d.ts +7 -2
  5. package/dist/components/alert-button/alert-button.d.ts.map +1 -1
  6. package/dist/components/alert-button/alert-button.js +5 -1
  7. package/dist/components/alert-button/alert-button.js.map +1 -1
  8. package/dist/components/alert-button-item/alert-button-item.d.ts +7 -1
  9. package/dist/components/alert-button-item/alert-button-item.d.ts.map +1 -1
  10. package/dist/components/alert-button-item/alert-button-item.js +3 -1
  11. package/dist/components/alert-button-item/alert-button-item.js.map +1 -1
  12. package/dist/components/alert-counter-item/alert-counter-item.d.ts +7 -4
  13. package/dist/components/alert-counter-item/alert-counter-item.d.ts.map +1 -1
  14. package/dist/components/alert-counter-item/alert-counter-item.js +2 -4
  15. package/dist/components/alert-counter-item/alert-counter-item.js.map +1 -1
  16. package/dist/components/badge/badge.css.js +7 -0
  17. package/dist/components/badge/badge.css.js.map +1 -1
  18. package/dist/components/top-bar/top-bar.css.js +2 -2
  19. package/dist/components/top-bar/top-bar.css.js.map +1 -1
  20. package/dist/components/top-bar/top-bar.d.ts +23 -8
  21. package/dist/components/top-bar/top-bar.d.ts.map +1 -1
  22. package/dist/components/top-bar/top-bar.js +25 -9
  23. package/dist/components/top-bar/top-bar.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/components/alert-button/alert-button.spec.ts +12 -6
  26. package/src/components/alert-button/alert-button.stories.ts +32 -1
  27. package/src/components/alert-button/alert-button.ts +8 -2
  28. package/src/components/alert-button-item/alert-button-item.spec.ts +30 -1
  29. package/src/components/alert-button-item/alert-button-item.stories.ts +28 -0
  30. package/src/components/alert-button-item/alert-button-item.ts +7 -2
  31. package/src/components/alert-counter-item/alert-counter-item.spec.ts +7 -5
  32. package/src/components/alert-counter-item/alert-counter-item.ts +8 -11
  33. package/src/components/badge/badge.css +6 -0
  34. package/src/components/top-bar/top-bar-more-button.spec.ts +60 -0
  35. package/src/components/top-bar/top-bar.css +2 -2
  36. package/src/components/top-bar/top-bar.ts +47 -14
@@ -2,7 +2,11 @@ import {describe, expect, it} from 'vitest';
2
2
  import {render} from 'vitest-browser-lit';
3
3
  import {html, type TemplateResult} from 'lit';
4
4
  import './alert-button.js';
5
- import {ObcAlertButton, ObcAlertButtonType} from './alert-button.js';
5
+ import {
6
+ ObcAlertButton,
7
+ ObcAlertButtonType,
8
+ ObcAlertCounterItemType,
9
+ } from './alert-button.js';
6
10
  import type {ObcAlertButtonItem} from '../alert-button-item/alert-button-item.js';
7
11
  import {AlertType, FlashingSpeed} from '../../types.js';
8
12
 
@@ -64,16 +68,18 @@ describe('obc-alert-button', () => {
64
68
  const {el, item} = await setup(
65
69
  html`<obc-alert-button
66
70
  globalCounter
71
+ .globalCounterType=${ObcAlertCounterItemType.AlertLevel}
67
72
  .nAlerts=${26}
68
73
  .counts=${counts}
69
74
  .shelvedCount=${9}
70
75
  ></obc-alert-button>`
71
76
  );
72
- expect([item.globalCounter, item.counts, item.shelvedCount]).toEqual([
73
- true,
74
- counts,
75
- 9,
76
- ]);
77
+ expect([
78
+ item.globalCounter,
79
+ item.globalCounterType,
80
+ item.counts,
81
+ item.shelvedCount,
82
+ ]).toEqual([true, ObcAlertCounterItemType.AlertLevel, counts, 9]);
77
83
 
78
84
  el.flatMaxBreakpointPx = window.innerWidth + 1;
79
85
  await el.updateComplete;
@@ -1,5 +1,9 @@
1
1
  import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
- import {ObcAlertButton, ObcAlertButtonType} from './alert-button.js';
2
+ import {
3
+ ObcAlertButton,
4
+ ObcAlertButtonType,
5
+ ObcAlertCounterItemType,
6
+ } from './alert-button.js';
3
7
  import {AlertType, FlashingSpeed} from '../../types.js';
4
8
  import './alert-button.js';
5
9
  import {widthDecorator} from '../../storybook-util.js';
@@ -10,6 +14,7 @@ const meta: Meta<typeof ObcAlertButton> = {
10
14
  component: 'obc-alert-button',
11
15
  args: {
12
16
  counter: true,
17
+ globalCounter: false, // the gate arg, so the global counter controls follow it
13
18
  width: 72,
14
19
  },
15
20
  argTypes: {
@@ -31,6 +36,10 @@ const meta: Meta<typeof ObcAlertButton> = {
31
36
  options: Object.values(FlashingSpeed),
32
37
  control: {type: 'select'},
33
38
  },
39
+ globalCounterType: {
40
+ options: Object.values(ObcAlertCounterItemType),
41
+ control: {type: 'inline-radio'},
42
+ },
34
43
  counts: {control: {type: 'object'}},
35
44
  shelvedCount: {control: {type: 'number', min: 0}},
36
45
  width: {control: {type: 'range', min: 64, max: 1028, step: 1}},
@@ -278,3 +287,25 @@ export const GlobalCounterShelvedSilence: Story = {
278
287
  width: 244,
279
288
  },
280
289
  };
290
+
291
+ export const GlobalCounterAlertLevel: Story = {
292
+ args: {
293
+ globalCounter: true,
294
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
295
+ nAlerts: 26,
296
+ counts: GLOBAL_COUNTS,
297
+ width: 232,
298
+ },
299
+ };
300
+
301
+ export const GlobalCounterAlertLevelShelvedSilence: Story = {
302
+ args: {
303
+ globalCounter: true,
304
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
305
+ nAlerts: 26,
306
+ counts: GLOBAL_COUNTS,
307
+ shelvedCount: 9,
308
+ showSilenceButton: true,
309
+ width: 336,
310
+ },
311
+ };
@@ -9,10 +9,11 @@ import '../../icons/icon-notification-advice-active.js';
9
9
  import '../../icons/icon-silence-iec.js';
10
10
  import '../alert-button-item/alert-button-item.js';
11
11
  import {ObcAlertButtonType} from '../alert-button-item/alert-button-item.js';
12
+ import {ObcAlertCounterItemType} from '../alert-counter-item/alert-counter-item.js';
12
13
  import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
13
14
  import {customElement} from '../../decorator.js';
14
15
 
15
- export {ObcAlertButtonType};
16
+ export {ObcAlertButtonType, ObcAlertCounterItemType};
16
17
 
17
18
  /**
18
19
  * `<obc-alert-button>` – A compact, icon-based button for displaying alert or notification status and count.
@@ -29,7 +30,7 @@ export {ObcAlertButtonType};
29
30
  * - **Enhanced:** Visually prominent button for high-priority alerts, with accent styling.
30
31
  * - **Alert Types:** Supports `alarm`, `warning`, `caution`, or no alert (idle). Icon and color adapt to the alert type.
31
32
  * - **Alert Counter:** Optional badge displays the number of active alerts (except in flat mode).
32
- * - **Global Counter:** `globalCounter` shows the per-severity `counts` and an optional `shelvedCount` before the bell and the total, as `obc-alert-button-item` draws them.
33
+ * - **Global Counter:** `globalCounter` shows the per-severity `counts` and an optional `shelvedCount` before the bell and the total, as `obc-alert-button-item` draws them; `globalCounterType` picks filled badges or the severity shapes.
33
34
  * - **Silence Button:** Optional secondary button to mute or silence alerts, shown when enabled and at sufficient width.
34
35
  * - **Blinking Animation:** Can animate (blink) to draw attention to active alerts (except for caution type).
35
36
  * - **Responsive Layout:** Automatically switches to flat mode below a configurable width, and hides the silence button below another configurable width.
@@ -87,6 +88,8 @@ export {ObcAlertButtonType};
87
88
  * @availableWhen silenceButtonDisabled showSilenceButton==true
88
89
  * @property counter - Shows the alert counter when there are active alerts and the button is not flat.
89
90
  * @property globalCounter - Shows the per-severity counts and the shelved count before the bell and the total (the item's global counter); a flat button shows the plain bell.
91
+ * @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).
92
+ * @availableWhen globalCounterType globalCounter==true
90
93
  * @property counts - Alert count per severity for the global counter badges (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts).
91
94
  * @availableWhen counts globalCounter==true
92
95
  * @property shelvedCount - Number of shelved alerts, shown after the global counter badges; hidden at zero.
@@ -113,6 +116,8 @@ export class ObcAlertButton extends LitElement {
113
116
  @property({type: Boolean}) silenceButtonDisabled = false;
114
117
  @property({type: Boolean}) counter = false;
115
118
  @property({type: Boolean}) globalCounter = false;
119
+ @property({type: String}) globalCounterType: ObcAlertCounterItemType =
120
+ ObcAlertCounterItemType.Badges;
116
121
  @property({type: Object, attribute: false}) counts: AlertCounts = {};
117
122
  @property({type: Number}) shelvedCount = 0;
118
123
  @property({type: Boolean}) blinking = false;
@@ -173,6 +178,7 @@ export class ObcAlertButton extends LitElement {
173
178
  .globalCounter=${
174
179
  this.globalCounter && this.activeType !== ObcAlertButtonType.Flat
175
180
  }
181
+ .globalCounterType=${this.globalCounterType}
176
182
  .counts=${this.counts}
177
183
  .shelvedCount=${this.shelvedCount}
178
184
  .blinking=${this.blinking}
@@ -4,7 +4,10 @@ import {userEvent} from '@vitest/browser/context';
4
4
  import {html} from 'lit';
5
5
  import './alert-button-item.js';
6
6
  import {ObcAlertButtonItem, ObcAlertButtonType} from './alert-button-item.js';
7
- import type {ObcAlertCounterItem} from '../alert-counter-item/alert-counter-item.js';
7
+ import {
8
+ ObcAlertCounterItemType,
9
+ type ObcAlertCounterItem,
10
+ } from '../alert-counter-item/alert-counter-item.js';
8
11
  import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
9
12
 
10
13
  type ItemProps = Partial<
@@ -15,6 +18,7 @@ type ItemProps = Partial<
15
18
  | 'nAlerts'
16
19
  | 'counter'
17
20
  | 'globalCounter'
21
+ | 'globalCounterType'
18
22
  | 'counts'
19
23
  | 'shelvedCount'
20
24
  | 'blinking'
@@ -45,6 +49,10 @@ async function setup(props: ItemProps = {}) {
45
49
  const el = screen.container.querySelector(
46
50
  'obc-alert-button-item'
47
51
  ) as ObcAlertButtonItem;
52
+ // Set only when given, so the default case exercises the element's own default.
53
+ if (props.globalCounterType !== undefined) {
54
+ el.globalCounterType = props.globalCounterType;
55
+ }
48
56
  await el.updateComplete;
49
57
  return el;
50
58
  }
@@ -173,6 +181,27 @@ describe('obc-alert-button-item global counter', () => {
173
181
  ).toBe('12');
174
182
  });
175
183
 
184
+ it('passes the counter type on, badges by default', async () => {
185
+ const counterType = async (props: ItemProps) =>
186
+ (
187
+ (
188
+ await setup({globalCounter: true, nAlerts: 12, ...props})
189
+ ).shadowRoot!.querySelector(
190
+ 'obc-alert-counter-item'
191
+ ) as ObcAlertCounterItem
192
+ ).type;
193
+
194
+ expect(await counterType({counts: SEVERITY_COUNTS})).toBe(
195
+ ObcAlertCounterItemType.Badges
196
+ );
197
+ expect(
198
+ await counterType({
199
+ counts: SEVERITY_COUNTS,
200
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
201
+ })
202
+ ).toBe(ObcAlertCounterItemType.AlertLevel);
203
+ });
204
+
176
205
  it('uses the normal style whatever the type', async () => {
177
206
  const el = await setup({
178
207
  globalCounter: true,
@@ -2,6 +2,7 @@ import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
2
  import {html} from 'lit';
3
3
  import {ObcAlertButtonItem, ObcAlertButtonType} from './alert-button-item.js';
4
4
  import './alert-button-item.js';
5
+ import {ObcAlertCounterItemType} from '../alert-counter-item/alert-counter-item.js';
5
6
  import {AlertType, FlashingSpeed, type AlertCounts} from '../../types.js';
6
7
 
7
8
  type ItemArgs = Pick<
@@ -11,6 +12,7 @@ type ItemArgs = Pick<
11
12
  | 'nAlerts'
12
13
  | 'counter'
13
14
  | 'globalCounter'
15
+ | 'globalCounterType'
14
16
  | 'counts'
15
17
  | 'shelvedCount'
16
18
  | 'blinking'
@@ -33,6 +35,9 @@ const renderItem = (args: Partial<ItemArgs>) =>
33
35
  .nAlerts=${args.nAlerts ?? 0}
34
36
  .counter=${args.counter ?? false}
35
37
  .globalCounter=${args.globalCounter ?? false}
38
+ .globalCounterType=${
39
+ args.globalCounterType ?? ObcAlertCounterItemType.Badges
40
+ }
36
41
  .counts=${args.counts ?? {}}
37
42
  .shelvedCount=${args.shelvedCount ?? 0}
38
43
  .blinking=${args.blinking ?? false}
@@ -59,6 +64,10 @@ const meta: Meta<ItemArgs> = {
59
64
  },
60
65
  alertType: {control: {type: 'select'}, options: Object.values(AlertType)},
61
66
  nAlerts: {control: {type: 'number', min: 0}},
67
+ globalCounterType: {
68
+ control: {type: 'inline-radio'},
69
+ options: Object.values(ObcAlertCounterItemType),
70
+ },
62
71
  counts: {control: {type: 'object'}},
63
72
  shelvedCount: {control: {type: 'number', min: 0}},
64
73
  flashingSpeed: {
@@ -151,6 +160,25 @@ export const GlobalCounterWithShelved: Story = {
151
160
  },
152
161
  };
153
162
 
163
+ export const GlobalCounterAlertLevel: Story = {
164
+ args: {
165
+ globalCounter: true,
166
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
167
+ nAlerts: 12,
168
+ counts: SEVERITY_COUNTS,
169
+ },
170
+ };
171
+
172
+ export const GlobalCounterAlertLevelWithShelved: Story = {
173
+ args: {
174
+ globalCounter: true,
175
+ globalCounterType: ObcAlertCounterItemType.AlertLevel,
176
+ nAlerts: 12,
177
+ counts: SEVERITY_COUNTS,
178
+ shelvedCount: 9,
179
+ },
180
+ };
181
+
154
182
  export const GlobalCounterLevelSeverities: Story = {
155
183
  args: {
156
184
  globalCounter: true,
@@ -60,7 +60,8 @@ export enum ObcAlertButtonType {
60
60
  * `nAlerts` of 0 shows the idle bell.
61
61
  * - **Counter:** `counter` shows `nAlerts` next to the bell, except in `flat`.
62
62
  * - **Global counter:** `globalCounter` shows the per-severity `counts` as
63
- * badges, then the bell and `nAlerts`, always in the normal style.
63
+ * badges, then the bell and `nAlerts`, always in the normal style;
64
+ * `globalCounterType` picks filled badges or the severity shapes.
64
65
  * - **Flashing:** `blinking` flashes the bell at the tempo `flashingSpeed`
65
66
  * resolves (#1224).
66
67
  * - **Fill height:** `fillHeight` stretches the visible button to the host
@@ -104,6 +105,8 @@ export enum ObcAlertButtonType {
104
105
  * @property counter - Shows `nAlerts` next to the bell (not in `flat`).
105
106
  * @availableWhen counter globalCounter==false
106
107
  * @property globalCounter - Shows the per-severity counts, the bell and the total instead of a single alert status.
108
+ * @property globalCounterType - How the global counter draws each count: `badges` (filled severity badges, default) or `alert-level` (the severity shape beside the count).
109
+ * @availableWhen globalCounterType globalCounter==true
107
110
  * @property counts - Alert count per severity for the global counter badges.
108
111
  * @availableWhen counts globalCounter==true
109
112
  * @property shelvedCount - Number of shelved alerts, shown after the global counter badges.
@@ -126,6 +129,8 @@ export class ObcAlertButtonItem extends LitElement {
126
129
  @property({type: Number}) nAlerts = 0;
127
130
  @property({type: Boolean}) counter = false;
128
131
  @property({type: Boolean}) globalCounter = false;
132
+ @property({type: String}) globalCounterType: ObcAlertCounterItemType =
133
+ ObcAlertCounterItemType.Badges;
129
134
  @property({type: Object, attribute: false}) counts: AlertCounts = {};
130
135
  @property({type: Number}) shelvedCount = 0;
131
136
  @property({type: Boolean}) blinking = false;
@@ -235,7 +240,7 @@ export class ObcAlertButtonItem extends LitElement {
235
240
  return nothing;
236
241
  }
237
242
  return html`<obc-alert-counter-item
238
- .type=${ObcAlertCounterItemType.Badges}
243
+ .type=${this.globalCounterType}
239
244
  .counts=${this.counts}
240
245
  .shelvedCount=${this.shelvedCount}
241
246
  ></obc-alert-counter-item>`;
@@ -59,12 +59,14 @@ describe('obc-alert-counter-item', () => {
59
59
  ]);
60
60
  });
61
61
 
62
- it('adds the shelved count last', async () => {
62
+ it('adds the shelved count last, with the shelf icon in both types', async () => {
63
63
  const filled = await setup({countAlarm: 2}, {shelvedCount: 9});
64
- expect([lastBadge(filled).type, lastBadge(filled).number]).toEqual([
65
- 'regular',
66
- 9,
67
- ]);
64
+ expect([
65
+ lastBadge(filled).type,
66
+ lastBadge(filled).number,
67
+ lastBadge(filled).showIcon,
68
+ ]).toEqual(['regular', 9, true]);
69
+ expect(lastBadge(filled).querySelector('obi-alerts-shelf')).not.toBeNull();
68
70
 
69
71
  const level = await setup(
70
72
  {countAlarm: 2},
@@ -35,8 +35,8 @@ export enum ObcAlertCounterItemType {
35
35
  * `alert-level` draws flat badges with the severity glyph.
36
36
  * - **Every severity:** `counts` takes the whole `AlertType` vocabulary,
37
37
  * including the `level-*` family, ordered by `ALERT_SEVERITY_PRIORITY`.
38
- * - **Shelved count:** `shelvedCount` adds a neutral badge at the end, with
39
- * the shelf icon in `alert-level`.
38
+ * - **Shelved count:** `shelvedCount` adds a neutral badge with the shelf icon
39
+ * at the end.
40
40
  * - **Accessible summary:** the row is announced as one image labelled with
41
41
  * the counts, e.g. "2 Alarm, 4 Warning, 6 Caution".
42
42
  *
@@ -51,6 +51,9 @@ export enum ObcAlertCounterItemType {
51
51
  * `obc-alert-subsystem-counter`.
52
52
  * - **TODO(designer):** the Figma component also has an Unacked counter type;
53
53
  * how its icons map to counts is not defined yet.
54
+ * - **TODO(designer):** the Figma component draws alarm, warning and caution;
55
+ * critical and diagnostic use the `level-critical` and `level-diagnostic`
56
+ * badges of `obc-badge` (#1389).
54
57
  *
55
58
  * ---
56
59
  *
@@ -65,7 +68,7 @@ export enum ObcAlertCounterItemType {
65
68
  *
66
69
  * @property type - How each count is drawn: `badges` (filled severity badges, default) or `alert-level` (flat badges with the severity glyph).
67
70
  * @property counts - Alert count per severity (`countAlarm`, `countWarning`, `countCaution` and the `level-*` counts); counts of zero or less are not shown.
68
- * @property shelvedCount - Number of shelved alerts, shown as a neutral badge after the severities; hidden at zero.
71
+ * @property shelvedCount - Number of shelved alerts, shown as a neutral badge with the shelf icon after the severities; hidden at zero.
69
72
  * @experimental
70
73
  */
71
74
  @customElement('obc-alert-counter-item')
@@ -107,16 +110,10 @@ export class ObcAlertCounterItem extends LitElement {
107
110
  size=${BadgeSize.large}
108
111
  type=${BadgeType.regular}
109
112
  .variant=${variant}
110
- .showIcon=${alertLevel}
113
+ showIcon
111
114
  .number=${this.shelvedCount}
112
115
  >
113
- ${
114
- alertLevel
115
- ? html`<obi-alerts-shelf
116
- slot="badge-icon"
117
- ></obi-alerts-shelf>`
118
- : nothing
119
- }
116
+ <obi-alerts-shelf slot="badge-icon"></obi-alerts-shelf>
120
117
  </obc-badge>`
121
118
  : nothing
122
119
  }
@@ -161,6 +161,12 @@
161
161
  min-height: var(--ui-components-badge-icon-size);
162
162
  }
163
163
 
164
+ /* Figma binds the flat large icon frame to the badge height, not icon-size-large */
165
+ &.size-large .icon {
166
+ width: var(--ui-components-badge-min-size-large);
167
+ height: var(--ui-components-badge-min-size-large);
168
+ }
169
+
164
170
  .icon.type-alarm {
165
171
  color: unset;
166
172
  border-color: var(--alert-alarm-outline-color);
@@ -0,0 +1,60 @@
1
+ import {afterEach, describe, expect, it} from 'vitest';
2
+ import './top-bar.js';
3
+ import type {ObcTopBar} from './top-bar.js';
4
+
5
+ const cleanup: Array<() => void> = [];
6
+ afterEach(() => {
7
+ while (cleanup.length) cleanup.pop()!();
8
+ });
9
+
10
+ async function mount(init: (bar: ObcTopBar) => void = () => {}) {
11
+ const bar = document.createElement('obc-top-bar') as ObcTopBar;
12
+ init(bar);
13
+ document.body.append(bar);
14
+ cleanup.push(() => bar.remove());
15
+ await bar.updateComplete;
16
+ const button = bar.shadowRoot!.querySelector<HTMLElement>('.more-button')!;
17
+ return {bar, button};
18
+ }
19
+
20
+ describe('obc-top-bar more button', () => {
21
+ it('fires more-button-clicked and the deprecated left-more-button-clicked', async () => {
22
+ const {bar, button} = await mount();
23
+ const events: string[] = [];
24
+ bar.addEventListener('more-button-clicked', () =>
25
+ events.push('more-button-clicked')
26
+ );
27
+ bar.addEventListener('left-more-button-clicked', () =>
28
+ events.push('left-more-button-clicked')
29
+ );
30
+ button.click();
31
+ expect(events).toEqual(['more-button-clicked', 'left-more-button-clicked']);
32
+ });
33
+
34
+ it('exposes both the more-button and the deprecated left-more-button part', async () => {
35
+ const {button} = await mount();
36
+ expect(button.part.contains('more-button')).toBe(true);
37
+ expect(button.part.contains('left-more-button')).toBe(true);
38
+ });
39
+
40
+ it('moreButtonActivated activates the button', async () => {
41
+ const {bar, button} = await mount((bar) => {
42
+ bar.moreButtonActivated = true;
43
+ });
44
+ expect(button.hasAttribute('activated')).toBe(true);
45
+ bar.moreButtonActivated = false;
46
+ await bar.updateComplete;
47
+ expect(button.hasAttribute('activated')).toBe(false);
48
+ });
49
+
50
+ it('the deprecated leftMoreButtonActivated still activates the button', async () => {
51
+ const {bar, button} = await mount((bar) => {
52
+ bar.setAttribute('leftMoreButtonActivated', '');
53
+ });
54
+ expect(bar.moreButtonActivated).toBe(true);
55
+ expect(button.hasAttribute('activated')).toBe(true);
56
+ bar.leftMoreButtonActivated = false;
57
+ await bar.updateComplete;
58
+ expect(button.hasAttribute('activated')).toBe(false);
59
+ });
60
+ });
@@ -67,7 +67,7 @@
67
67
  /* Controls never shrink: a squeeze reaches the texts, then overflows the end */
68
68
  .menu-button,
69
69
  .app-icon,
70
- .left-more-button,
70
+ .more-button,
71
71
  .dimming-button,
72
72
  .user-button,
73
73
  .apps-button,
@@ -109,7 +109,7 @@
109
109
  @mixin font-body-active;
110
110
  }
111
111
 
112
- .left-more-button {
112
+ .more-button {
113
113
  display: none;
114
114
  }
115
115
 
@@ -1,4 +1,4 @@
1
- import {LitElement, html, unsafeCSS} from 'lit';
1
+ import {LitElement, PropertyValues, html, unsafeCSS} from 'lit';
2
2
  import {property} from 'lit/decorators.js';
3
3
  import {classMap} from 'lit/directives/class-map.js';
4
4
  import {msg} from '@lit/localize';
@@ -81,7 +81,8 @@ export enum ObcTopBarMenuButtonIcon {
81
81
  * - `menu-button-clicked` – Fired when the menu button is clicked.
82
82
  * - `dimming-button-clicked` – Fired when the dimming (day/night) button is clicked.
83
83
  * - `apps-button-clicked` – Fired when the apps button is clicked.
84
- * - `left-more-button-clicked` – Fired when the left more button is clicked.
84
+ * - `more-button-clicked` – Fired when the more button is clicked.
85
+ * - `left-more-button-clicked` – Deprecated alias of `more-button-clicked`, fired with it; removed in 4.0.0.
85
86
  * - `user-button-clicked` – Fired when the user/profile button is clicked.
86
87
  * - `close` – Fired in settings mode when the close button is clicked.
87
88
  * - `back` – Fired in settings mode when the back button is clicked.
@@ -132,8 +133,8 @@ export enum ObcTopBarMenuButtonIcon {
132
133
  * @availableWhen dimmingButtonActivated showDimmingButton==true && inactive==false
133
134
  * @property appsButtonActivated - Highlights the apps button as active.
134
135
  * @availableWhen appsButtonActivated showAppsButton==true && inactive==false
135
- * @property leftMoreButtonActivated - Highlights the left more button as active.
136
- * @availableWhen leftMoreButtonActivated inactive==false
136
+ * @property moreButtonActivated - Highlights the more button as active.
137
+ * @availableWhen moreButtonActivated inactive==false
137
138
  * @property userButtonActivated - Highlights the user/profile button as active.
138
139
  * @availableWhen userButtonActivated showUserButton==true && inactive==false
139
140
  * @property userButtonDisabled - Disables the user/profile button.
@@ -163,13 +164,16 @@ export enum ObcTopBarMenuButtonIcon {
163
164
  * @fires menu-button-clicked - Fired when the menu button is clicked
164
165
  * @fires dimming-button-clicked - Fired when the dimming (day/night) button is clicked
165
166
  * @fires apps-button-clicked - Fired when the apps button is clicked
166
- * @fires left-more-button-clicked - Fired when the left more button is clicked
167
+ * @fires more-button-clicked - Fired when the more button is clicked
168
+ * @fires left-more-button-clicked - Deprecated: listen to `more-button-clicked` instead. Fired together with it; removed in 4.0.0.
167
169
  * @fires user-button-clicked - Fired when the user/profile button is clicked
168
170
  * @fires close - Fired in settings mode when the close button is clicked
169
171
  * @fires back - Fired in settings mode when the back button is clicked
170
172
  * @fires emergency-brightness-start - Fired when the menu button is held for 500ms. This should increase the brightness of the screen slowly. Used when the screen is too dark.
171
173
  * @fires emergency-brightness-stop - Fired when the menu button is released.
172
174
  * @fires {BreadcrumbClickEvent} breadcrumb-click - Fired when a breadcrumb item is clicked.
175
+ * @csspart more-button - The more button shown below the breakpoints.
176
+ * @csspart left-more-button - Deprecated alias of the `more-button` part; removed in 4.0.0.
173
177
  * @stable
174
178
  */
175
179
  @customElement('obc-top-bar')
@@ -190,7 +194,13 @@ export class ObcTopBar extends LitElement {
190
194
  appsButtonActivated = false;
191
195
 
192
196
  @property({type: Boolean})
193
- leftMoreButtonActivated = false;
197
+ moreButtonActivated = false;
198
+
199
+ /**
200
+ * @deprecated Use `moreButtonActivated`. Removed in 4.0.0.
201
+ */
202
+ @property({type: Boolean})
203
+ leftMoreButtonActivated?: boolean;
194
204
 
195
205
  @property({type: Boolean})
196
206
  userButtonActivated = false;
@@ -253,9 +263,30 @@ export class ObcTopBar extends LitElement {
253
263
  this.dispatchEvent(new CustomEvent('apps-button-clicked'));
254
264
  }
255
265
 
256
- private leftMoreButtonClicked() {
266
+ /**
267
+ * Copies the deprecated `leftMoreButtonActivated` into
268
+ * `moreButtonActivated`. A plain field rather than a getter/setter alias:
269
+ * the Vue wrapper writes every prop back on its second render, and a getter
270
+ * would then write `false` over the new property.
271
+ */
272
+ override willUpdate(changed: PropertyValues<this>): void {
273
+ super.willUpdate(changed);
274
+ if (
275
+ changed.has('leftMoreButtonActivated') &&
276
+ this.leftMoreButtonActivated !== undefined
277
+ ) {
278
+ this.moreButtonActivated = this.leftMoreButtonActivated;
279
+ }
280
+ }
281
+
282
+ private moreButtonClicked() {
283
+ /**
284
+ * Fired when the more button is clicked.
285
+ * @event more-button-clicked
286
+ */
287
+ this.dispatchEvent(new CustomEvent('more-button-clicked'));
257
288
  /**
258
- * Fired when the left more button is clicked.
289
+ * Deprecated alias of `more-button-clicked`; removed in 4.0.0.
259
290
  * @event left-more-button-clicked
260
291
  */
261
292
  this.dispatchEvent(new CustomEvent('left-more-button-clicked'));
@@ -413,13 +444,15 @@ export class ObcTopBar extends LitElement {
413
444
 
414
445
  const breakpointMoreButton = Math.max(
415
446
  this.appButtonBreakpointPx,
416
- this.dimmingButtonBreakpointPx
447
+ this.dimmingButtonBreakpointPx,
448
+ this.userButtonBreakpointPx,
449
+ this.appIconBreakpointPx
417
450
  );
418
451
 
419
452
  return html`
420
453
  <style>
421
454
  @media (max-width: ${breakpointMoreButton}px) {
422
- .left-more-button {
455
+ .more-button {
423
456
  display: revert !important;
424
457
  }
425
458
 
@@ -519,12 +552,12 @@ export class ObcTopBar extends LitElement {
519
552
  ${
520
553
  !this.inactive
521
554
  ? html`<obc-icon-button
522
- class="left-more-button"
523
- part="left-more-button"
555
+ class="more-button"
556
+ part="more-button left-more-button"
524
557
  variant="flat"
525
558
  aria-label=${msg('More')}
526
- @click=${this.leftMoreButtonClicked}
527
- ?activated=${this.leftMoreButtonActivated}
559
+ @click=${this.moreButtonClicked}
560
+ ?activated=${this.moreButtonActivated}
528
561
  >
529
562
  <obi-more-vertical-google></obi-more-vertical-google>
530
563
  </obc-icon-button>`