@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.132 → 2.0.0-next.134

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 (31) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +59 -49
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +11 -22
  4. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.css.js +8 -1
  5. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.css.js.map +1 -1
  6. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.d.ts +6 -0
  7. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.d.ts.map +1 -1
  8. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.js +13 -2
  9. package/dist/components/automation-button-readout-stack/automation-button-readout-stack.js.map +1 -1
  10. package/dist/components/user-menu/user-menu.d.ts +11 -6
  11. package/dist/components/user-menu/user-menu.d.ts.map +1 -1
  12. package/dist/components/user-menu/user-menu.js +38 -46
  13. package/dist/components/user-menu/user-menu.js.map +1 -1
  14. package/dist/generated/locales/es-419.d.ts +1 -5
  15. package/dist/generated/locales/es-419.d.ts.map +1 -1
  16. package/dist/generated/locales/es-419.js +1 -5
  17. package/dist/generated/locales/es-419.js.map +1 -1
  18. package/dist/generated/locales/fi-FI.d.ts +1 -5
  19. package/dist/generated/locales/fi-FI.d.ts.map +1 -1
  20. package/dist/generated/locales/fi-FI.js +1 -5
  21. package/dist/generated/locales/fi-FI.js.map +1 -1
  22. package/package.json +1 -1
  23. package/script/agent-docs/frontmatter.ts +1 -1
  24. package/script/generate-bundle-entry.ts +9 -4
  25. package/script/sync-agent-docs.test.ts +9 -0
  26. package/src/components/automation-button-readout-stack/automation-button-readout-stack.css +9 -1
  27. package/src/components/automation-button-readout-stack/automation-button-readout-stack.ts +15 -2
  28. package/src/components/user-menu/user-menu.stories.ts +23 -0
  29. package/src/components/user-menu/user-menu.ts +49 -62
  30. package/src/generated/locales/es-419.ts +1 -5
  31. package/src/generated/locales/fi-FI.ts +1 -5
@@ -56,7 +56,7 @@ export type ObcUserMenuSignedInAction = {
56
56
  * - **Multiple States:** Supports sign-in, user sign-in, loading, and signed-in layouts.
57
57
  * - **Size Options:** Regular and small sizes for compact layouts.
58
58
  * - **Recent Users:** Optional "Recently signed in" section for quick access.
59
- * - **Navigation Actions:** Signed-in state includes navigation items and actions.
59
+ * - **Navigation Actions:** Signed-in state lists the actions it is given.
60
60
  *
61
61
  * ### Variants
62
62
  * - `type`: `sign-in`, `user-sign-in`, `loading-sign-in`, `signed-in`
@@ -71,7 +71,7 @@ export type ObcUserMenuSignedInAction = {
71
71
  * - `type` (`ObcUserMenuType`): Controls the layout state. Defaults to `sign-in`.
72
72
  * - `size` (`ObcUserMenuSize`): Controls the overall size. Defaults to `regular`.
73
73
  * - `hasRecentlySignedIn` (`boolean`): Toggles the recent users section.
74
- * Defaults to `true`.
74
+ * Defaults to `false`.
75
75
  * - `username` (`string`): Current username value for sign-in layouts.
76
76
  * - `password` (`string`): Current password value for sign-in layouts.
77
77
  * - `usernameError` (`string`): Error message for the username field.
@@ -79,9 +79,11 @@ export type ObcUserMenuSignedInAction = {
79
79
  * - `userInitials` (`string`): Initials for the primary user profile.
80
80
  * - `userLabel` (`string`): Label for the primary user profile.
81
81
  * - `recentUsers` (`ObcUserMenuUser[]`): List of recent users shown in the
82
- * "Recently signed in" section.
82
+ * "Recently signed in" section. Empty renders no section.
83
83
  * - `signedInActions` (`ObcUserMenuSignedInAction[]`): Actions shown in the
84
- * signed-in navigation list.
84
+ * signed-in navigation list. Empty renders no actions.
85
+ * - `primaryActionId` (`string`): Id of the action promoted to a button in the
86
+ * small signed-in layout.
85
87
  *
86
88
  * ### Events
87
89
  * - `sign-in-click` – Fired when a sign-in button is clicked.
@@ -123,6 +125,8 @@ export type ObcUserMenuSignedInAction = {
123
125
  * @property recentUsers - Recent users for the "Recently signed in" section.
124
126
  * @property signedInActions - Actions shown in the signed-in navigation list.
125
127
  * @availableWhen signedInActions type==signedIn
128
+ * @property primaryActionId - Id of the action promoted to a button in the small signed-in layout.
129
+ * @availableWhen primaryActionId type==signedIn && size==small
126
130
  * @slot signed-in-action-icon-<id> - Optional icon for a signed-in action, one per action; `<id>` is the normalized action id (shown in the `signed-in` type).
127
131
  * @fires {CustomEvent<{username: string, password: string}>} sign-in-click - Fired when a sign-in button is clicked.
128
132
  * @fires {CustomEvent<void>} sign-out-click - Fired when the sign-out button is clicked.
@@ -158,22 +162,10 @@ export class ObcUserMenu extends LitElement {
158
162
  @property({type: Array, attribute: false})
159
163
  signedInActions: ObcUserMenuSignedInAction[] = [];
160
164
 
161
- private get defaultSignedInActions() {
162
- return [
163
- {id: 'calendar', label: msg('Calendar')},
164
- {id: 'log', label: msg('Log')},
165
- {id: 'preferences', label: msg('Preferences')},
166
- {id: 'user-account', label: msg('User account')},
167
- ];
168
- }
165
+ @property({type: String}) primaryActionId?: string;
169
166
 
170
- private get defaultRecentUsers() {
171
- const label = msg('Username');
172
- return [
173
- {initials: 'AB', label},
174
- {initials: 'CD', label},
175
- {initials: 'EF', label},
176
- ];
167
+ private get showRecentUsers() {
168
+ return this.hasRecentlySignedIn && this.recentUsers.length > 0;
177
169
  }
178
170
 
179
171
  private renderTextInput(
@@ -202,9 +194,7 @@ export class ObcUserMenu extends LitElement {
202
194
 
203
195
  private renderUserButtons(count: number, isLarge: boolean) {
204
196
  const size = isLarge ? Size.large : Size.regular;
205
- const users = (
206
- this.recentUsers.length ? this.recentUsers : this.defaultRecentUsers
207
- ).slice(0, count);
197
+ const users = this.recentUsers.slice(0, count);
208
198
  return html`
209
199
  <div
210
200
  class=${classMap({
@@ -231,15 +221,12 @@ export class ObcUserMenu extends LitElement {
231
221
 
232
222
  private renderUserProfile(
233
223
  layout: 'vertical' | 'horizontal',
234
- size: 'large' | 'regular',
235
- initials?: string,
236
- label?: string
224
+ size: 'large' | 'regular'
237
225
  ) {
226
+ if (!this.userInitials && !this.userLabel) {
227
+ return nothing;
228
+ }
238
229
  const userButtonSize = size === 'large' ? Size.large : Size.regular;
239
- const fallbackUser = this.recentUsers[0] ?? this.defaultRecentUsers[0];
240
- const resolvedInitials =
241
- initials ?? this.userInitials ?? fallbackUser.initials;
242
- const resolvedLabel = label ?? this.userLabel ?? fallbackUser.label;
243
230
  return html`
244
231
  <div
245
232
  class=${classMap({
@@ -255,8 +242,8 @@ export class ObcUserMenu extends LitElement {
255
242
  .variant=${Variant.initials}
256
243
  .styleType=${StyleType.normal}
257
244
  .size=${userButtonSize}
258
- .initials=${resolvedInitials}
259
- .label=${resolvedLabel}
245
+ .initials=${this.userInitials ?? ''}
246
+ .label=${this.userLabel ?? ''}
260
247
  ></obc-user-button>
261
248
  </div>
262
249
  `;
@@ -376,7 +363,7 @@ export class ObcUserMenu extends LitElement {
376
363
  ${msg('Sign in')}
377
364
  </obc-button>
378
365
  </div>
379
- ${this.hasRecentlySignedIn
366
+ ${this.showRecentUsers
380
367
  ? html`
381
368
  <div class="recent-container">
382
369
  <div class="title-container">
@@ -419,9 +406,9 @@ export class ObcUserMenu extends LitElement {
419
406
  ${msg('Sign in')}
420
407
  </obc-button>
421
408
  </div>
422
- <div class="divider" aria-hidden="true"></div>
423
- ${this.hasRecentlySignedIn
409
+ ${this.showRecentUsers
424
410
  ? html`
411
+ <div class="divider" aria-hidden="true"></div>
425
412
  <div class="recent-container recent">
426
413
  <div class="title-container">
427
414
  <div class="subtitle">${msg('Recent')}</div>
@@ -461,7 +448,7 @@ export class ObcUserMenu extends LitElement {
461
448
  </obc-button>
462
449
  </div>
463
450
  </div>
464
- ${this.hasRecentlySignedIn
451
+ ${this.showRecentUsers
465
452
  ? html`
466
453
  <div class="recent-container">
467
454
  <div class="title-container">
@@ -500,9 +487,9 @@ export class ObcUserMenu extends LitElement {
500
487
  ${msg('Sign in')}
501
488
  </obc-button>
502
489
  </div>
503
- <div class="divider" aria-hidden="true"></div>
504
- ${this.hasRecentlySignedIn
490
+ ${this.showRecentUsers
505
491
  ? html`
492
+ <div class="divider" aria-hidden="true"></div>
506
493
  <div class="recent-container recent">
507
494
  <div class="title-container">
508
495
  <div class="subtitle">${msg('Recent')}</div>
@@ -551,9 +538,6 @@ export class ObcUserMenu extends LitElement {
551
538
  }
552
539
 
553
540
  private renderSignedIn() {
554
- const actions = this.signedInActions.length
555
- ? this.signedInActions
556
- : this.defaultSignedInActions;
557
541
  return html`
558
542
  <div class="title-container">
559
543
  <h3 class="title">${msg('User')}</h3>
@@ -562,24 +546,28 @@ export class ObcUserMenu extends LitElement {
562
546
  ${this.renderUserProfile('vertical', 'large')}
563
547
  </div>
564
548
  <div class="divider" aria-hidden="true"></div>
565
- <div class="nav-container">
566
- ${actions.map((action) => {
567
- const normalizedId = this.normalizeActionId(action.id);
568
- return html`
569
- <obc-navigation-item
570
- .label=${action.label}
571
- hasIcon
572
- @click=${() => this.handleSignedInActionClick(action)}
573
- >
574
- <span slot="icon">
575
- <slot name="signed-in-action-icon-${normalizedId}">
576
- ${this.getSignedInActionIcon(normalizedId)}
577
- </slot>
578
- </span>
579
- </obc-navigation-item>
580
- `;
581
- })}
582
- </div>
549
+ ${this.signedInActions.length
550
+ ? html`
551
+ <div class="nav-container">
552
+ ${this.signedInActions.map((action) => {
553
+ const normalizedId = this.normalizeActionId(action.id);
554
+ return html`
555
+ <obc-navigation-item
556
+ .label=${action.label}
557
+ hasIcon
558
+ @click=${() => this.handleSignedInActionClick(action)}
559
+ >
560
+ <span slot="icon">
561
+ <slot name="signed-in-action-icon-${normalizedId}">
562
+ ${this.getSignedInActionIcon(normalizedId)}
563
+ </slot>
564
+ </span>
565
+ </obc-navigation-item>
566
+ `;
567
+ })}
568
+ </div>
569
+ `
570
+ : nothing}
583
571
  <div class="button-container">
584
572
  <obc-button
585
573
  variant=${ButtonVariant.normal}
@@ -593,10 +581,9 @@ export class ObcUserMenu extends LitElement {
593
581
  }
594
582
 
595
583
  private renderSignedInSmall() {
596
- const actions = this.signedInActions.length
597
- ? this.signedInActions
598
- : this.defaultSignedInActions;
599
- const primaryAction = actions[2];
584
+ const primaryAction = this.signedInActions.find(
585
+ (action) => action.id === this.primaryActionId
586
+ );
600
587
  return html`
601
588
  <div class="title-container">
602
589
  <h3 class="title">${msg('User')}</h3>
@@ -54,14 +54,10 @@
54
54
  'sdb1595f5c742dfbb': `Input`,
55
55
  's37cbecaec58e2192': `Mode`,
56
56
  's065289e6cba017c6': `Transcribe`,
57
- 'sbb980b38227e171f': `Calendar`,
58
- 's24f39319b8853791': `Log`,
59
- 's2b5047d39b9baf3d': `Preferences`,
60
- 'se62c3ba656215129': `User account`,
61
- 's03f42eea72154959': `Username`,
62
57
  's76b886a513fca0d8': `Username is required`,
63
58
  'seb1d48da15e775c9': `Password is required`,
64
59
  's5e27738a2e8eb763': `Sign in`,
60
+ 's03f42eea72154959': `Username`,
65
61
  'sf6e1665c7022a1f8': `Password`,
66
62
  's981f6febad4df84a': `Recently signed in`,
67
63
  'sbce70cbdb856635e': `Recent`,
@@ -64,14 +64,10 @@
64
64
  'sdb1595f5c742dfbb': `Input`,
65
65
  's37cbecaec58e2192': `Mode`,
66
66
  's065289e6cba017c6': `Transcribe`,
67
- 'sbb980b38227e171f': `Calendar`,
68
- 's24f39319b8853791': `Log`,
69
- 's2b5047d39b9baf3d': `Preferences`,
70
- 'se62c3ba656215129': `User account`,
71
- 's03f42eea72154959': `Username`,
72
67
  's76b886a513fca0d8': `Username is required`,
73
68
  'seb1d48da15e775c9': `Password is required`,
74
69
  's5e27738a2e8eb763': `Sign in`,
70
+ 's03f42eea72154959': `Username`,
75
71
  'sf6e1665c7022a1f8': `Password`,
76
72
  's981f6febad4df84a': `Recently signed in`,
77
73
  'sbce70cbdb856635e': `Recent`,