@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.139 → 2.0.0-next.140

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.
@@ -72,6 +72,8 @@ export type ObcUserMenuSignedInAction = {
72
72
  * - `size` (`ObcUserMenuSize`): Controls the overall size. Defaults to `regular`.
73
73
  * - `hasRecentlySignedIn` (`boolean`): Toggles the recent users section.
74
74
  * Defaults to `false`.
75
+ * - `showUsername` (`boolean`): Toggles the username field. Defaults to `true`.
76
+ * - `showPassword` (`boolean`): Toggles the password field. Defaults to `true`.
75
77
  * - `username` (`string`): Current username value for sign-in layouts.
76
78
  * - `password` (`string`): Current password value for sign-in layouts.
77
79
  * - `usernameError` (`string`): Error message for the username field.
@@ -111,9 +113,9 @@ export type ObcUserMenuSignedInAction = {
111
113
  * @property hasRecentlySignedIn - Toggles the "Recently signed in" section visibility.
112
114
  * @availableWhen hasRecentlySignedIn type in [signIn, userSignIn]
113
115
  * @property username - Current username value for sign-in layouts.
114
- * @availableWhen username type==signIn
116
+ * @availableWhen username showUsername==true && type==signIn
115
117
  * @property password - Current password value for sign-in layouts.
116
- * @availableWhen password type in [signIn, userSignIn]
118
+ * @availableWhen password showPassword==true && type in [signIn, userSignIn]
117
119
  * @property usernameError - Error message for the username field.
118
120
  * @availableWhen usernameError type==signIn
119
121
  * @property passwordError - Error message for the password field.
@@ -125,10 +127,14 @@ export type ObcUserMenuSignedInAction = {
125
127
  * @property recentUsers - Recent users for the "Recently signed in" section.
126
128
  * @property signedInActions - Actions shown in the signed-in navigation list.
127
129
  * @availableWhen signedInActions type==signedIn
130
+ * @property showUsername - Controls the visibility of the username field.
131
+ * @availableWhen showUsername type==signIn
132
+ * @property showPassword - Controls the visibility of the password field.
133
+ * @availableWhen showPassword type in [signIn, userSignIn]
128
134
  * @property primaryActionId - Id of the action promoted to a button in the small signed-in layout.
129
135
  * @availableWhen primaryActionId type==signedIn && size==small
130
136
  * @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).
131
- * @fires {CustomEvent<{username: string, password: string}>} sign-in-click - Fired when a sign-in button is clicked.
137
+ * @fires {CustomEvent<{username?: string, password?: string}>} sign-in-click - Fired when a sign-in button is clicked.
132
138
  * @fires {CustomEvent<void>} sign-out-click - Fired when the sign-out button is clicked.
133
139
  * @fires {CustomEvent<{id: string, label: string}>} signed-in-action-click - Fired when a signed-in action is clicked.
134
140
  * @fires {CustomEvent<{initials: string, label: string}>} recent-user-click - Fired when a recent user button is clicked.
@@ -144,8 +150,14 @@ export class ObcUserMenu extends LitElement {
144
150
  @property({type: Boolean})
145
151
  hasRecentlySignedIn = false;
146
152
 
153
+ @property({type: Boolean, attribute: false})
154
+ showUsername = true;
155
+
147
156
  @property({type: String}) username = '';
148
157
 
158
+ @property({type: Boolean, attribute: false})
159
+ showPassword = true;
160
+
149
161
  @property({type: String}) password = '';
150
162
 
151
163
  @property({type: String}) usernameError = '';
@@ -305,14 +317,16 @@ export class ObcUserMenu extends LitElement {
305
317
 
306
318
  private validateSignIn() {
307
319
  let valid = true;
308
- const needsUsername = this.type === ObcUserMenuType.signIn;
320
+ const needsUsername =
321
+ this.type === ObcUserMenuType.signIn && this.showUsername;
322
+ const needsPassword = this.showPassword;
309
323
 
310
324
  if (needsUsername && !this.username) {
311
325
  this.usernameError = msg('Username is required');
312
326
  valid = false;
313
327
  }
314
328
 
315
- if (!this.password) {
329
+ if (needsPassword && !this.password) {
316
330
  this.passwordError = msg('Password is required');
317
331
  valid = false;
318
332
  }
@@ -326,7 +340,10 @@ export class ObcUserMenu extends LitElement {
326
340
  }
327
341
  this.dispatchEvent(
328
342
  new CustomEvent('sign-in-click', {
329
- detail: {username: this.username, password: this.password},
343
+ detail: {
344
+ username: this.showUsername ? this.username : undefined,
345
+ password: this.showPassword ? this.password : undefined,
346
+ },
330
347
  })
331
348
  );
332
349
  }
@@ -340,21 +357,30 @@ export class ObcUserMenu extends LitElement {
340
357
  <div class="title-container">
341
358
  <h3 class="title">${msg('Sign in')}</h3>
342
359
  </div>
343
- <div class="login-container">
344
- ${this.renderTextInput(
345
- msg('Username'),
346
- HTMLInputTypeAttribute.Text,
347
- this.username,
348
- this.handleUsernameInput.bind(this),
349
- this.usernameError
350
- )}
351
- ${this.renderTextInput(
352
- msg('Password'),
353
- HTMLInputTypeAttribute.Password,
354
- this.password,
355
- this.handlePasswordInput.bind(this),
356
- this.passwordError
357
- )}
360
+ <div
361
+ class=${classMap({
362
+ 'login-container': true,
363
+ 'signin-only': !this.showRecentUsers,
364
+ })}
365
+ >
366
+ ${this.showUsername
367
+ ? this.renderTextInput(
368
+ msg('Username'),
369
+ HTMLInputTypeAttribute.Text,
370
+ this.username,
371
+ this.handleUsernameInput.bind(this),
372
+ this.usernameError
373
+ )
374
+ : nothing}
375
+ ${this.showPassword
376
+ ? this.renderTextInput(
377
+ msg('Password'),
378
+ HTMLInputTypeAttribute.Password,
379
+ this.password,
380
+ this.handlePasswordInput.bind(this),
381
+ this.passwordError
382
+ )
383
+ : nothing}
358
384
  <obc-button
359
385
  variant=${ButtonVariant.raised}
360
386
  fullWidth
@@ -383,21 +409,30 @@ export class ObcUserMenu extends LitElement {
383
409
  <div class="title-container">
384
410
  <h3 class="title">${msg('Sign in')}</h3>
385
411
  </div>
386
- <div class="login-container">
387
- ${this.renderTextInput(
388
- msg('Username'),
389
- HTMLInputTypeAttribute.Text,
390
- this.username,
391
- this.handleUsernameInput.bind(this),
392
- this.usernameError
393
- )}
394
- ${this.renderTextInput(
395
- msg('Password'),
396
- HTMLInputTypeAttribute.Password,
397
- this.password,
398
- this.handlePasswordInput.bind(this),
399
- this.passwordError
400
- )}
412
+ <div
413
+ class=${classMap({
414
+ 'login-container': true,
415
+ 'signin-only': !this.showRecentUsers,
416
+ })}
417
+ >
418
+ ${this.showUsername
419
+ ? this.renderTextInput(
420
+ msg('Username'),
421
+ HTMLInputTypeAttribute.Text,
422
+ this.username,
423
+ this.handleUsernameInput.bind(this),
424
+ this.usernameError
425
+ )
426
+ : nothing}
427
+ ${this.showPassword
428
+ ? this.renderTextInput(
429
+ msg('Password'),
430
+ HTMLInputTypeAttribute.Password,
431
+ this.password,
432
+ this.handlePasswordInput.bind(this),
433
+ this.passwordError
434
+ )
435
+ : nothing}
401
436
  <obc-button
402
437
  variant=${ButtonVariant.raised}
403
438
  fullWidth
@@ -427,18 +462,25 @@ export class ObcUserMenu extends LitElement {
427
462
  <div class="title-container">
428
463
  <h3 class="title">${msg('Sign in')}</h3>
429
464
  </div>
430
- <div class="login-container">
465
+ <div
466
+ class=${classMap({
467
+ 'login-container': true,
468
+ 'signin-only': !this.showRecentUsers,
469
+ })}
470
+ >
431
471
  <div class="user-primary">
432
472
  ${this.renderUserProfile('vertical', 'large')}
433
473
  </div>
434
474
  <div class="fields">
435
- ${this.renderTextInput(
436
- msg('Password'),
437
- HTMLInputTypeAttribute.Password,
438
- this.password,
439
- this.handlePasswordInput.bind(this),
440
- this.passwordError
441
- )}
475
+ ${this.showPassword
476
+ ? this.renderTextInput(
477
+ msg('Password'),
478
+ HTMLInputTypeAttribute.Password,
479
+ this.password,
480
+ this.handlePasswordInput.bind(this),
481
+ this.passwordError
482
+ )
483
+ : nothing}
442
484
  <obc-button
443
485
  variant=${ButtonVariant.raised}
444
486
  fullWidth
@@ -471,14 +513,21 @@ export class ObcUserMenu extends LitElement {
471
513
  <div class="user-container">
472
514
  ${this.renderUserProfile('horizontal', 'regular')}
473
515
  </div>
474
- <div class="login-container">
475
- ${this.renderTextInput(
476
- msg('Password'),
477
- HTMLInputTypeAttribute.Password,
478
- this.password,
479
- this.handlePasswordInput.bind(this),
480
- this.passwordError
481
- )}
516
+ <div
517
+ class=${classMap({
518
+ 'login-container': true,
519
+ 'signin-only': !this.showRecentUsers,
520
+ })}
521
+ >
522
+ ${this.showPassword
523
+ ? this.renderTextInput(
524
+ msg('Password'),
525
+ HTMLInputTypeAttribute.Password,
526
+ this.password,
527
+ this.handlePasswordInput.bind(this),
528
+ this.passwordError
529
+ )
530
+ : nothing}
482
531
  <obc-button
483
532
  variant=${ButtonVariant.raised}
484
533
  fullWidth