@descope/web-components-ui 3.27.4 → 3.27.5

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 (37) hide show
  1. package/dist/cjs/index.cjs.js +81 -9
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +81 -9
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/9439.js +1 -1
  6. package/dist/umd/9439.js.map +1 -1
  7. package/dist/umd/DescopeDev.js +1 -1
  8. package/dist/umd/DescopeDev.js.map +1 -1
  9. package/dist/umd/descope-collapsible-container.js +1 -1
  10. package/dist/umd/descope-collapsible-container.js.map +1 -1
  11. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  12. package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
  13. package/dist/umd/descope-new-password-index-js.js +1 -1
  14. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  15. package/dist/umd/descope-passcode-index-js.js +1 -1
  16. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  17. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  18. package/dist/umd/descope-security-questions-setup-index-js.js.map +1 -1
  19. package/dist/umd/descope-security-questions-verify-index-js.js +1 -1
  20. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  21. package/dist/umd/descope-text-field.js +1 -1
  22. package/dist/umd/descope-text-field.js.map +1 -1
  23. package/dist/umd/index.js +1 -1
  24. package/dist/umd/index.js.map +1 -1
  25. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  26. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  27. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  28. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  29. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  30. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js.map +1 -1
  31. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  32. package/dist/umd/phone-fields-descope-phone-field-index-js.js.map +1 -1
  33. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +1 -1
  34. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
  35. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  36. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
  37. package/package.json +46 -46
package/dist/index.esm.js CHANGED
@@ -8059,6 +8059,7 @@ const customMixin$h = (superclass) =>
8059
8059
  renderCopyToClipboard(shouldRender) {
8060
8060
  if (!shouldRender) {
8061
8061
  this.icon?.remove();
8062
+ this.copyLiveRegion?.remove();
8062
8063
  return;
8063
8064
  }
8064
8065
 
@@ -8074,20 +8075,53 @@ const customMixin$h = (superclass) =>
8074
8075
  style: 'cursor: initial',
8075
8076
  };
8076
8077
 
8078
+ const setIconState = (config) => {
8079
+ Object.assign(this.icon, config);
8080
+ this.icon.setAttribute('aria-label', config.title);
8081
+ };
8082
+
8077
8083
  this.icon = Object.assign(document.createElement('vaadin-icon'), {
8078
8084
  slot: 'suffix',
8079
- ...iconInitConfig,
8085
+ tabIndex: 0,
8080
8086
  });
8087
+ this.icon.setAttribute('role', 'button');
8088
+ setIconState(iconInitConfig);
8089
+
8090
+ // visually hidden live region, so screen readers announce the copy
8091
+ this.copyLiveRegion = document.createElement('span');
8092
+ this.copyLiveRegion.setAttribute('aria-live', 'polite');
8093
+ this.copyLiveRegion.style.cssText =
8094
+ 'position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;';
8081
8095
 
8082
8096
  this.baseElement.appendChild(this.icon);
8083
- this.icon.addEventListener('click', () => {
8084
- navigator.clipboard.writeText(this.value);
8085
- Object.assign(this.icon, iconCopiedConfig);
8097
+ this.shadowRoot.appendChild(this.copyLiveRegion);
8086
8098
 
8087
- // we want the icon to go back to the initial state after 5 seconds
8088
- setTimeout(() => {
8089
- Object.assign(this.icon, iconInitConfig);
8090
- }, 5000);
8099
+ let resetTimer;
8100
+ const copy = async () => {
8101
+ try {
8102
+ await navigator.clipboard.writeText(this.value);
8103
+ } catch {
8104
+ return;
8105
+ }
8106
+ setIconState(iconCopiedConfig);
8107
+ this.copyLiveRegion.textContent = 'Copied';
8108
+
8109
+ // we want the icon to go back to the initial state after 3 seconds
8110
+ // a repeated copy restarts the countdown
8111
+ clearTimeout(resetTimer);
8112
+ resetTimer = setTimeout(() => {
8113
+ setIconState(iconInitConfig);
8114
+ this.copyLiveRegion.textContent = '';
8115
+ }, 3000);
8116
+ };
8117
+
8118
+ this.icon.addEventListener('click', copy);
8119
+ this.icon.addEventListener('keydown', (e) => {
8120
+ if (e.key !== 'Enter' && e.key !== ' ') return;
8121
+ e.preventDefault();
8122
+ // the SDK submits the flow on any Enter that reaches the flow root
8123
+ e.stopPropagation();
8124
+ copy();
8091
8125
  });
8092
8126
  }
8093
8127
 
@@ -25221,7 +25255,7 @@ class RawCollapsibleContainer extends createBaseClass$1({
25221
25255
  baseSelector: 'slot',
25222
25256
  }) {
25223
25257
  static get observedAttributes() {
25224
- return ['collapsed', 'collapsible', 'text'];
25258
+ return ['collapsed', 'collapsible', 'text', 'aria-label'];
25225
25259
  }
25226
25260
 
25227
25261
  constructor() {
@@ -25332,7 +25366,31 @@ class RawCollapsibleContainer extends createBaseClass$1({
25332
25366
  this.setAttribute('collapsed', this.isCollapsed ? 'false' : 'true');
25333
25367
  }
25334
25368
 
25369
+ // header acts as a disclosure button only when the container is collapsible
25370
+ updateHeaderA11y() {
25371
+ if (!this.isCollapsible) {
25372
+ ['role', 'tabindex', 'aria-expanded', 'aria-label'].forEach((attr) =>
25373
+ this.header.removeAttribute(attr),
25374
+ );
25375
+ return;
25376
+ }
25377
+ this.header.setAttribute('role', 'button');
25378
+ this.header.setAttribute('tabindex', '0');
25379
+ this.header.setAttribute('aria-expanded', String(!this.isCollapsed));
25380
+ // without header text the button has no name, so fall back to a label
25381
+ if (this.getAttribute('text')) {
25382
+ this.header.removeAttribute('aria-label');
25383
+ } else {
25384
+ this.header.setAttribute(
25385
+ 'aria-label',
25386
+ this.getAttribute('aria-label') || 'Toggle section',
25387
+ );
25388
+ }
25389
+ }
25390
+
25335
25391
  collapse(animated = false) {
25392
+ // keep collapsed content out of the tab order and the a11y tree
25393
+ this.content.inert = true;
25336
25394
  const final = () => {
25337
25395
  this.content.style.maxHeight = '0px';
25338
25396
  };
@@ -25344,6 +25402,7 @@ class RawCollapsibleContainer extends createBaseClass$1({
25344
25402
  }
25345
25403
 
25346
25404
  expand(animated = false) {
25405
+ this.content.inert = false;
25347
25406
  const final = () => {
25348
25407
  this.content.style.maxHeight = '';
25349
25408
  };
@@ -25366,6 +25425,13 @@ class RawCollapsibleContainer extends createBaseClass$1({
25366
25425
  if (!this.isCollapsible) return;
25367
25426
  this.toggle();
25368
25427
  });
25428
+ this.header.addEventListener('keydown', (e) => {
25429
+ if (!this.isCollapsible || (e.key !== 'Enter' && e.key !== ' ')) return;
25430
+ e.preventDefault();
25431
+ // the SDK submits the flow on any Enter that reaches the flow root
25432
+ e.stopPropagation();
25433
+ this.toggle();
25434
+ });
25369
25435
  forwardAttrs$1(this, this.textComponent, {
25370
25436
  includeAttrs: ['text-align', 'text-variant', 'text-mode'],
25371
25437
  mapAttrs: { 'text-mode': 'mode', 'text-variant': 'variant' },
@@ -25380,8 +25446,14 @@ class RawCollapsibleContainer extends createBaseClass$1({
25380
25446
  attributeChangedCallback(name, oldValue, newValue) {
25381
25447
  if (name === 'text') {
25382
25448
  this.updateHeaderText();
25449
+ this.updateHeaderA11y();
25450
+ return;
25451
+ }
25452
+ if (name === 'aria-label') {
25453
+ this.updateHeaderA11y();
25383
25454
  return;
25384
25455
  }
25456
+ this.updateHeaderA11y();
25385
25457
  const collapsed = this.isCollapsed && this.isCollapsible;
25386
25458
  if (collapsed) {
25387
25459
  this.collapse(this.#isComponentMounted);