@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.153 → 2.0.0-next.155

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 (46) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +438 -238
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +295 -37
  4. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js +3 -7
  5. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js.map +1 -1
  6. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts +133 -13
  7. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts.map +1 -1
  8. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js +330 -233
  9. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js.map +1 -1
  10. package/dist/components/table/table.d.ts.map +1 -1
  11. package/dist/components/table/table.js +10 -2
  12. package/dist/components/table/table.js.map +1 -1
  13. package/dist/components/user-button/user-button.css.js +68 -1
  14. package/dist/components/user-button/user-button.css.js.map +1 -1
  15. package/dist/components/user-button/user-button.d.ts +8 -1
  16. package/dist/components/user-button/user-button.d.ts.map +1 -1
  17. package/dist/components/user-button/user-button.js +12 -3
  18. package/dist/components/user-button/user-button.js.map +1 -1
  19. package/dist/components/user-menu/user-menu.css.js +15 -0
  20. package/dist/components/user-menu/user-menu.css.js.map +1 -1
  21. package/dist/components/user-menu/user-menu.d.ts +22 -2
  22. package/dist/components/user-menu/user-menu.d.ts.map +1 -1
  23. package/dist/components/user-menu/user-menu.js +34 -2
  24. package/dist/components/user-menu/user-menu.js.map +1 -1
  25. package/dist/generated/locales/es-419.d.ts +1 -0
  26. package/dist/generated/locales/es-419.d.ts.map +1 -1
  27. package/dist/generated/locales/es-419.js +1 -0
  28. package/dist/generated/locales/es-419.js.map +1 -1
  29. package/dist/generated/locales/fi-FI.d.ts +1 -0
  30. package/dist/generated/locales/fi-FI.d.ts.map +1 -1
  31. package/dist/generated/locales/fi-FI.js +1 -0
  32. package/dist/generated/locales/fi-FI.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/components/alert-list-details-experimental/alert-list-details-experimental.css +3 -7
  35. package/src/components/alert-list-details-experimental/alert-list-details-experimental.spec.ts +188 -0
  36. package/src/components/alert-list-details-experimental/alert-list-details-experimental.stories.ts +142 -33
  37. package/src/components/alert-list-details-experimental/alert-list-details-experimental.ts +490 -252
  38. package/src/components/table/table.ts +15 -2
  39. package/src/components/user-button/user-button.css +27 -1
  40. package/src/components/user-button/user-button.stories.ts +29 -0
  41. package/src/components/user-button/user-button.ts +22 -3
  42. package/src/components/user-menu/user-menu.css +8 -0
  43. package/src/components/user-menu/user-menu.stories.ts +53 -0
  44. package/src/components/user-menu/user-menu.ts +55 -4
  45. package/src/generated/locales/es-419.ts +1 -0
  46. package/src/generated/locales/fi-FI.ts +1 -0
@@ -197,6 +197,9 @@ export type ObcTableExpandToggleEvent = CustomEvent<{
197
197
  expanded: boolean;
198
198
  }>;
199
199
 
200
+ const INTERACTIVE_SELECTOR =
201
+ 'button, a[href], input, select, textarea, [role="button"], [role="link"], [role="checkbox"]';
202
+
200
203
  function cssPart(value: ObcTableCellData, subpart: string): string | undefined {
201
204
  if (value.cssPart) {
202
205
  return `${value.cssPart} ${subpart}`;
@@ -397,7 +400,16 @@ export class ObcTable extends LitElement {
397
400
  }
398
401
  }
399
402
 
400
- private _handleRowClick(row: ObcTableRow) {
403
+ private _handleRowClick(event: MouseEvent, row: ObcTableRow) {
404
+ const rowElement = event.currentTarget;
405
+ for (const node of event.composedPath()) {
406
+ if (node === rowElement) break;
407
+ // Stopping propagation in the cell instead would break listeners
408
+ // delegated to the document, such as Svelte's.
409
+ if (node instanceof Element && node.matches(INTERACTIVE_SELECTOR)) {
410
+ return;
411
+ }
412
+ }
401
413
  this.dispatchEvent(
402
414
  new CustomEvent('row-click', {detail: {row}}) as ObcTableRowClickEvent
403
415
  );
@@ -883,7 +895,8 @@ export class ObcTable extends LitElement {
883
895
  'selected-with-next': isRowSelected && hasSelectedNextRow,
884
896
  striped: isStriped,
885
897
  })}
886
- @click=${() => this._handleRowClick(row)}
898
+ @click=${(event: MouseEvent) =>
899
+ this._handleRowClick(event, row)}
887
900
  @keydown=${this._handleRowKeyDown}
888
901
  data-row-id=${row.id}
889
902
  style="grid-row: ${rowIndex + 1}"
@@ -37,10 +37,26 @@
37
37
  @mixin font-subtitle;
38
38
  }
39
39
 
40
+ .user-label {
41
+ @mixin font-body;
42
+ }
43
+
44
+ .user-sublabel {
45
+ @mixin font-body;
46
+ }
47
+
48
+ &.has-sublabel .user-label {
49
+ @mixin font-body-active;
50
+ }
51
+
40
52
  &.style-selected .user-initials {
41
53
  @mixin font-title;
42
54
  }
43
55
 
56
+ &.style-selected .user-label {
57
+ @mixin font-body-active;
58
+ }
59
+
44
60
  &.state-static {
45
61
  width: var(--ui-components-user-button-visual-size-enhanced);
46
62
  height: var(--ui-components-user-button-visual-size-enhanced);
@@ -55,7 +71,17 @@
55
71
  color: var(--element-active-color);
56
72
  }
57
73
 
58
- &:disabled .user-label {
74
+ .user-sublabel {
75
+ @mixin font-label;
76
+ color: var(--element-active-color);
77
+ }
78
+
79
+ &.has-sublabel .user-label {
80
+ @mixin font-label-active;
81
+ }
82
+
83
+ &:disabled .user-label,
84
+ &:disabled .user-sublabel {
59
85
  color: var(--element-disabled-color);
60
86
  }
61
87
 
@@ -175,3 +175,32 @@ export const TooManyInitials: Story = {
175
175
  styleType: StyleType.flat,
176
176
  },
177
177
  };
178
+
179
+ export const WithSublabel: Story = {
180
+ args: {
181
+ variant: Variant.initials,
182
+ styleType: StyleType.normal,
183
+ label: 'Anna',
184
+ sublabel: 'Captain',
185
+ },
186
+ };
187
+
188
+ export const LargeWithSublabel: Story = {
189
+ args: {
190
+ variant: Variant.initials,
191
+ styleType: StyleType.normal,
192
+ size: Size.large,
193
+ label: 'Anna',
194
+ sublabel: 'Captain',
195
+ },
196
+ };
197
+
198
+ export const StaticWithSublabel: Story = {
199
+ args: {
200
+ variant: Variant.initials,
201
+ styleType: StyleType.normal,
202
+ static: true,
203
+ label: 'Anna',
204
+ sublabel: 'Captain',
205
+ },
206
+ };
@@ -50,6 +50,8 @@ export enum Variant {
50
50
  * - Provide a custom icon via the `icon` slot when using the `icon` variant.
51
51
  * - **Label Support:**
52
52
  * - Optional `label` property displays text next to the button (not shown in static mode).
53
+ * - Optional `sublabel` adds a second, lighter line under the label, for a
54
+ * secondary detail such as the user's role.
53
55
  *
54
56
  * ## Usage Guidelines
55
57
  * Use `obc-user-button` to represent a user in navigation bars, toolbars, or menus where a compact, recognizable user indicator is needed. Ideal for profile menus, account switching, or user-related quick actions.
@@ -71,7 +73,8 @@ export enum Variant {
71
73
  * - Initials longer than two characters are truncated and a warning is logged.
72
74
  * - If `initials` is empty or invalid, the button falls back to the user icon.
73
75
  * - The `label` is only visible when the button is interactive (not static).
74
- * - For accessibility, the button uses `aria-label` based on initials or a default.
76
+ * - For accessibility, the button is named after its visible text `label` and
77
+ * `sublabel` — falling back to the initials when it shows no text.
75
78
  * - Only use the `static` property for non-interactive contexts; otherwise, the button is clickable.
76
79
  *
77
80
  * ## Example:
@@ -88,6 +91,8 @@ export enum Variant {
88
91
  * @availableWhen disabled static==false
89
92
  * @property label - Optional label text to display next to the button (not shown in static mode).
90
93
  * @availableWhen label static==false
94
+ * @property sublabel - Optional second line under the label, for a secondary detail such as a role (not shown in static mode).
95
+ * @availableWhen sublabel static==false
91
96
  * @slot icon - Custom icon for the user button (used only in `icon` variant; defaults to <obi-user> if not provided)
92
97
  * @stable
93
98
  */
@@ -122,6 +127,8 @@ export class ObcUserButton extends LitElement {
122
127
 
123
128
  @property({type: String}) label?: string;
124
129
 
130
+ @property({type: String}) sublabel?: string;
131
+
125
132
  private get formattedInitials() {
126
133
  if (!this.initials) return '';
127
134
 
@@ -157,21 +164,33 @@ export class ObcUserButton extends LitElement {
157
164
  'mode-initials': !this.shouldShowIcon,
158
165
  'state-static': this.static,
159
166
  [`size-${this.size}`]: true,
167
+ 'has-sublabel': Boolean(this.sublabel) && !this.static,
160
168
  };
161
169
 
162
170
  // Use button element when clickable, div when static
163
171
  const tag = this.static ? literal`div` : literal`button`;
164
172
 
173
+ const visibleText = [this.label, this.sublabel].filter(Boolean).join(', ');
174
+ const accessibleName =
175
+ (!this.static && visibleText) || this.initials || 'User button';
176
+
165
177
  const label =
166
178
  this.label && !this.static
167
179
  ? html`<span class="user-label" part="label">${this.label}</span>`
168
180
  : nothing;
169
181
 
182
+ const sublabel =
183
+ this.sublabel && !this.static
184
+ ? html`<span class="user-sublabel" part="sublabel">
185
+ ${this.sublabel}
186
+ </span>`
187
+ : nothing;
188
+
170
189
  return html`
171
190
  <${tag}
172
191
  class=${classMap(wrapperClasses)}
173
192
  ?disabled=${this.disabled}
174
- aria-label=${this.initials || 'User button'}
193
+ aria-label=${accessibleName}
175
194
  >
176
195
  <div class="content-container" part="content-container">
177
196
  <div class="user-button-circle">
@@ -192,7 +211,7 @@ export class ObcUserButton extends LitElement {
192
211
  `
193
212
  }
194
213
  </div>
195
- ${label}
214
+ ${label} ${sublabel}
196
215
  </div>
197
216
  </${tag}>
198
217
  `;
@@ -142,6 +142,14 @@
142
142
  @mixin font-overline;
143
143
  color: var(--element-neutral-color);
144
144
  }
145
+
146
+ obc-user-button:not(.has-role)::part(label) {
147
+ font-weight: var(--font-weight-regular);
148
+ }
149
+
150
+ obc-user-button::part(sublabel) {
151
+ @mixin font-body;
152
+ }
145
153
  }
146
154
 
147
155
  .user-primary {
@@ -16,6 +16,7 @@ const meta: Meta<ObcUserMenu> = {
16
16
  'sign-out-click',
17
17
  'signed-in-action-click',
18
18
  'recent-user-click',
19
+ 'use-another-account-click',
19
20
  ],
20
21
  },
21
22
  },
@@ -50,6 +51,8 @@ const meta: Meta<ObcUserMenu> = {
50
51
  passwordError: '',
51
52
  userInitials: 'AB',
52
53
  userLabel: 'Username',
54
+ userRole: '',
55
+ showUseAnotherAccount: true,
53
56
  recentUsers: [
54
57
  {initials: 'AB', label: 'Username'},
55
58
  {initials: 'CD', label: 'Username'},
@@ -77,6 +80,8 @@ const meta: Meta<ObcUserMenu> = {
77
80
  passwordError=${args.passwordError}
78
81
  .userInitials=${args.userInitials}
79
82
  .userLabel=${args.userLabel}
83
+ .userRole=${args.userRole}
84
+ .showUseAnotherAccount=${args.showUseAnotherAccount}
80
85
  .recentUsers=${args.recentUsers}
81
86
  .signedInActions=${args.signedInActions}
82
87
  .primaryActionId=${args.primaryActionId}
@@ -185,6 +190,54 @@ export const SignedInWithoutActions: Story = {
185
190
  },
186
191
  };
187
192
 
193
+ export const UserSignInWithRoles: Story = {
194
+ args: {
195
+ type: ObcUserMenuType.userSignIn,
196
+ size: ObcUserMenuSize.regular,
197
+ hasRecentlySignedIn: true,
198
+ userRole: 'Role',
199
+ recentUsers: [
200
+ {initials: 'AB', label: 'Username', role: 'Role'},
201
+ {initials: 'CD', label: 'Username', role: 'Role'},
202
+ {initials: 'EF', label: 'Username', role: 'Role'},
203
+ ],
204
+ },
205
+ };
206
+
207
+ export const SignedInWithRole: Story = {
208
+ args: {
209
+ type: ObcUserMenuType.signedIn,
210
+ size: ObcUserMenuSize.regular,
211
+ userRole: 'Role',
212
+ },
213
+ };
214
+
215
+ export const UserSignInWithoutUseAnotherAccount: Story = {
216
+ args: {
217
+ type: ObcUserMenuType.userSignIn,
218
+ size: ObcUserMenuSize.regular,
219
+ showUseAnotherAccount: false,
220
+ },
221
+ };
222
+
223
+ export const UserSignInSmallWithoutUseAnotherAccount: Story = {
224
+ args: {
225
+ type: ObcUserMenuType.userSignIn,
226
+ size: ObcUserMenuSize.small,
227
+ showUseAnotherAccount: false,
228
+ },
229
+ };
230
+
231
+ export const UserSignInSmallIgnoresRole: Story = {
232
+ args: {
233
+ type: ObcUserMenuType.userSignIn,
234
+ size: ObcUserMenuSize.small,
235
+ hasRecentlySignedIn: true,
236
+ userRole: 'Role',
237
+ recentUsers: [{initials: 'AB', label: 'Username', role: 'Role'}],
238
+ },
239
+ };
240
+
188
241
  export const SignInWithoutRecentUsers: Story = {
189
242
  args: {
190
243
  type: ObcUserMenuType.signIn,
@@ -39,8 +39,11 @@ export enum ObcUserMenuSize {
39
39
  export type ObcUserMenuUser = {
40
40
  initials: string;
41
41
  label: string;
42
+ role?: string;
42
43
  };
43
44
 
45
+ export type ObcUserMenuRecentUserClickEvent = CustomEvent<ObcUserMenuUser>;
46
+
44
47
  export type ObcUserMenuSignedInAction = {
45
48
  id: string;
46
49
  label: string;
@@ -80,8 +83,13 @@ export type ObcUserMenuSignedInAction = {
80
83
  * - `passwordError` (`string`): Error message for the password field.
81
84
  * - `userInitials` (`string`): Initials for the primary user profile.
82
85
  * - `userLabel` (`string`): Label for the primary user profile.
86
+ * - `userRole` (`string`): Role shown under the primary user's label. Omit it
87
+ * to show no role; only the regular size draws one.
83
88
  * - `recentUsers` (`ObcUserMenuUser[]`): List of recent users shown in the
84
- * "Recently signed in" section. Empty renders no section.
89
+ * "Recently signed in" section. Empty renders no section. Each user may
90
+ * carry its own `role`.
91
+ * - `showUseAnotherAccount` (`boolean`): Toggles the "Use another account"
92
+ * button in the `user-sign-in` layouts, both sizes. Defaults to `true`.
85
93
  * - `signedInActions` (`ObcUserMenuSignedInAction[]`): Actions shown in the
86
94
  * signed-in navigation list. Empty renders no actions.
87
95
  * - `primaryActionId` (`string`): Id of the action promoted to a button in the
@@ -90,6 +98,9 @@ export type ObcUserMenuSignedInAction = {
90
98
  * ### Events
91
99
  * - `sign-in-click` – Fired when a sign-in button is clicked.
92
100
  * - `sign-out-click` – Fired when the sign-out button is clicked.
101
+ * - `use-another-account-click` – Fired when the "Use another account" button
102
+ * is clicked. The menu does not change its own type; set it to `sign-in` in
103
+ * the handler to show the full form.
93
104
  * - `signed-in-action-click` – Fired when a signed-in action is clicked.
94
105
  * - `recent-user-click` – Fired when a recent user button is clicked.
95
106
  *
@@ -124,6 +135,8 @@ export type ObcUserMenuSignedInAction = {
124
135
  * @availableWhen userInitials type!=signIn
125
136
  * @property userLabel - Label for the primary user profile.
126
137
  * @availableWhen userLabel type!=signIn
138
+ * @property userRole - Role shown under the primary user's label; omit it to show no role.
139
+ * @availableWhen userRole type!=signIn && size==regular
127
140
  * @property recentUsers - Recent users for the "Recently signed in" section.
128
141
  * @property signedInActions - Actions shown in the signed-in navigation list.
129
142
  * @availableWhen signedInActions type==signedIn
@@ -133,11 +146,14 @@ export type ObcUserMenuSignedInAction = {
133
146
  * @availableWhen showPassword type in [signIn, userSignIn]
134
147
  * @property primaryActionId - Id of the action promoted to a button in the small signed-in layout.
135
148
  * @availableWhen primaryActionId type==signedIn && size==small
149
+ * @property showUseAnotherAccount - Controls the visibility of the "Use another account" button.
150
+ * @availableWhen showUseAnotherAccount type==userSignIn
136
151
  * @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).
137
152
  * @fires {CustomEvent<{username?: string, password?: string}>} sign-in-click - Fired when a sign-in button is clicked.
138
153
  * @fires {CustomEvent<void>} sign-out-click - Fired when the sign-out button is clicked.
154
+ * @fires {CustomEvent<void>} use-another-account-click - Fired when the "Use another account" button is clicked.
139
155
  * @fires {CustomEvent<{id: string, label: string}>} signed-in-action-click - Fired when a signed-in action is clicked.
140
- * @fires {CustomEvent<{initials: string, label: string}>} recent-user-click - Fired when a recent user button is clicked.
156
+ * @fires {ObcUserMenuRecentUserClickEvent} recent-user-click - Fired when a recent user button is clicked, carrying that user's entry.
141
157
  * @stable
142
158
  */
143
159
  @customElement('obc-user-menu')
@@ -168,6 +184,8 @@ export class ObcUserMenu extends LitElement {
168
184
 
169
185
  @property({type: String}) userLabel?: string;
170
186
 
187
+ @property({type: String}) userRole?: string;
188
+
171
189
  @property({type: Array, attribute: false})
172
190
  recentUsers: ObcUserMenuUser[] = [];
173
191
 
@@ -176,6 +194,9 @@ export class ObcUserMenu extends LitElement {
176
194
 
177
195
  @property({type: String}) primaryActionId?: string;
178
196
 
197
+ @property({type: Boolean, attribute: false})
198
+ showUseAnotherAccount = true;
199
+
179
200
  private get showRecentUsers() {
180
201
  return this.hasRecentlySignedIn && this.recentUsers.length > 0;
181
202
  }
@@ -223,6 +244,7 @@ export class ObcUserMenu extends LitElement {
223
244
  .size=${size}
224
245
  .initials=${user.initials}
225
246
  .label=${user.label}
247
+ .sublabel=${isLarge ? user.role : undefined}
226
248
  @click=${() => this.handleRecentUserClick(user)}
227
249
  ></obc-user-button>
228
250
  `
@@ -239,6 +261,7 @@ export class ObcUserMenu extends LitElement {
239
261
  return nothing;
240
262
  }
241
263
  const userButtonSize = size === 'large' ? Size.large : Size.regular;
264
+ const role = size === 'large' ? this.userRole : undefined;
242
265
  return html`
243
266
  <div
244
267
  class=${classMap({
@@ -250,12 +273,14 @@ export class ObcUserMenu extends LitElement {
250
273
  class=${classMap({
251
274
  'user-avatar': true,
252
275
  [`size-${size}`]: true,
276
+ 'has-role': Boolean(role),
253
277
  })}
254
278
  .variant=${Variant.initials}
255
279
  .styleType=${StyleType.normal}
256
280
  .size=${userButtonSize}
257
281
  .initials=${this.userInitials ?? ''}
258
282
  .label=${this.userLabel ?? ''}
283
+ .sublabel=${role}
259
284
  ></obc-user-button>
260
285
  </div>
261
286
  `;
@@ -293,8 +318,8 @@ export class ObcUserMenu extends LitElement {
293
318
 
294
319
  private handleRecentUserClick(user: ObcUserMenuUser) {
295
320
  this.dispatchEvent(
296
- new CustomEvent('recent-user-click', {
297
- detail: {initials: user.initials, label: user.label},
321
+ new CustomEvent<ObcUserMenuUser>('recent-user-click', {
322
+ detail: {...user},
298
323
  })
299
324
  );
300
325
  }
@@ -352,6 +377,10 @@ export class ObcUserMenu extends LitElement {
352
377
  this.dispatchEvent(new CustomEvent('sign-out-click'));
353
378
  }
354
379
 
380
+ private handleUseAnotherAccountClick() {
381
+ this.dispatchEvent(new CustomEvent('use-another-account-click'));
382
+ }
383
+
355
384
  private renderSignIn() {
356
385
  return html`
357
386
  <div class="title-container">
@@ -488,6 +517,17 @@ export class ObcUserMenu extends LitElement {
488
517
  >
489
518
  ${msg('Sign in')}
490
519
  </obc-button>
520
+ ${this.showUseAnotherAccount
521
+ ? html`
522
+ <obc-button
523
+ variant=${ButtonVariant.normal}
524
+ fullWidth
525
+ @click=${this.handleUseAnotherAccountClick}
526
+ >
527
+ ${msg('Use another account')}
528
+ </obc-button>
529
+ `
530
+ : nothing}
491
531
  </div>
492
532
  </div>
493
533
  ${this.showRecentUsers
@@ -535,6 +575,17 @@ export class ObcUserMenu extends LitElement {
535
575
  >
536
576
  ${msg('Sign in')}
537
577
  </obc-button>
578
+ ${this.showUseAnotherAccount
579
+ ? html`
580
+ <obc-button
581
+ variant=${ButtonVariant.normal}
582
+ fullWidth
583
+ @click=${this.handleUseAnotherAccountClick}
584
+ >
585
+ ${msg('Use another account')}
586
+ </obc-button>
587
+ `
588
+ : nothing}
538
589
  </div>
539
590
  ${this.showRecentUsers
540
591
  ? html`
@@ -77,6 +77,7 @@
77
77
  'sf6e1665c7022a1f8': `Password`,
78
78
  's981f6febad4df84a': `Recently signed in`,
79
79
  'sbce70cbdb856635e': `Recent`,
80
+ 's8506875a9d95f22c': `Use another account`,
80
81
  's7cfe12cd14df9950': `Sign out`,
81
82
  's5be3c6d61cd9182f': `Notifications`,
82
83
  's744d993d03f29851': `Screen`,
@@ -87,6 +87,7 @@
87
87
  'sf6e1665c7022a1f8': `Password`,
88
88
  's981f6febad4df84a': `Recently signed in`,
89
89
  'sbce70cbdb856635e': `Recent`,
90
+ 's8506875a9d95f22c': `Use another account`,
90
91
  's7cfe12cd14df9950': `Sign out`,
91
92
  's5be3c6d61cd9182f': `Notifications`,
92
93
  's744d993d03f29851': `Screen`,