@descope/web-components-ui 3.27.4 → 3.27.6

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 (47) hide show
  1. package/dist/cjs/index.cjs.js +94 -10
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +95 -11
  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/9582.js +1 -1
  8. package/dist/umd/9582.js.map +1 -1
  9. package/dist/umd/DescopeDev.js +1 -1
  10. package/dist/umd/DescopeDev.js.map +1 -1
  11. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
  12. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js.map +1 -1
  13. package/dist/umd/descope-alert-index-js.js +1 -1
  14. package/dist/umd/descope-alert-index-js.js.map +1 -1
  15. package/dist/umd/descope-collapsible-container.js +1 -1
  16. package/dist/umd/descope-collapsible-container.js.map +1 -1
  17. package/dist/umd/descope-enriched-text.js +1 -1
  18. package/dist/umd/descope-enriched-text.js.map +1 -1
  19. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  20. package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
  21. package/dist/umd/descope-new-password-index-js.js +1 -1
  22. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  23. package/dist/umd/descope-passcode-index-js.js +1 -1
  24. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  25. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  26. package/dist/umd/descope-security-questions-setup-index-js.js.map +1 -1
  27. package/dist/umd/descope-security-questions-verify-index-js.js +1 -1
  28. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  29. package/dist/umd/descope-text-field.js +1 -1
  30. package/dist/umd/descope-text-field.js.map +1 -1
  31. package/dist/umd/descope-tooltip.js +1 -1
  32. package/dist/umd/descope-tooltip.js.map +1 -1
  33. package/dist/umd/index.js +1 -1
  34. package/dist/umd/index.js.map +1 -1
  35. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  36. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  37. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  38. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  39. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  40. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js.map +1 -1
  41. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  42. package/dist/umd/phone-fields-descope-phone-field-index-js.js.map +1 -1
  43. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +1 -1
  44. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
  45. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  46. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
  47. package/package.json +46 -46
package/dist/index.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import MarkdownIt from 'markdown-it';
2
+ import DOMPurify from 'dompurify';
2
3
  import debounce$1 from 'lodash.debounce';
3
4
  import merge from 'lodash.merge';
4
5
  import Color from 'color';
@@ -6,7 +7,6 @@ import 'element-internals-polyfill';
6
7
  import '@vaadin/checkbox';
7
8
  import '@vaadin/text-field';
8
9
  import '@vaadin/combo-box';
9
- import DOMPurify from 'dompurify';
10
10
  import '@vaadin/button';
11
11
  import '@vaadin/popover/src/vaadin-popover';
12
12
  import '@vaadin/icons';
@@ -2574,6 +2574,16 @@ const decodeHTML = (html) => {
2574
2574
 
2575
2575
  const componentName$1B = getComponentName$1('enriched-text');
2576
2576
 
2577
+ const sanitizeConfig = {
2578
+ ADD_ATTR: ['target'],
2579
+ // Same scheme rule as markdown-it's link check, so custom-scheme links
2580
+ // (myapp://, slack://) keep working; DOMPurify's default list strips them.
2581
+ // `i` because markdown-it lowercases the URL before testing and DOMPurify does not.
2582
+ ALLOWED_URI_REGEXP:
2583
+ /^(?!(?:vbscript|javascript|file|data):)|^data:image\/(?:gif|png|jpeg|webp);/i,
2584
+ FORBID_TAGS: ['form', 'input', 'button', 'textarea', 'select', 'style'],
2585
+ };
2586
+
2577
2587
  class EnrichedText extends createBaseClass$1({
2578
2588
  componentName: componentName$1B,
2579
2589
  baseSelector: ':host > div',
@@ -2769,8 +2779,10 @@ class EnrichedText extends createBaseClass$1({
2769
2779
  console.warn('Not parsing invalid markdown token');
2770
2780
  }
2771
2781
 
2782
+ html = DOMPurify.sanitize(html, sanitizeConfig);
2783
+
2772
2784
  this.contentNode.innerHTML = html;
2773
- this.contentNode.firstChild?.setAttribute('part', 'content');
2785
+ this.contentNode.firstElementChild?.setAttribute('part', 'content');
2774
2786
  }
2775
2787
 
2776
2788
  onReadOnlyChange(isReadOnly) {
@@ -8059,6 +8071,7 @@ const customMixin$h = (superclass) =>
8059
8071
  renderCopyToClipboard(shouldRender) {
8060
8072
  if (!shouldRender) {
8061
8073
  this.icon?.remove();
8074
+ this.copyLiveRegion?.remove();
8062
8075
  return;
8063
8076
  }
8064
8077
 
@@ -8074,20 +8087,53 @@ const customMixin$h = (superclass) =>
8074
8087
  style: 'cursor: initial',
8075
8088
  };
8076
8089
 
8090
+ const setIconState = (config) => {
8091
+ Object.assign(this.icon, config);
8092
+ this.icon.setAttribute('aria-label', config.title);
8093
+ };
8094
+
8077
8095
  this.icon = Object.assign(document.createElement('vaadin-icon'), {
8078
8096
  slot: 'suffix',
8079
- ...iconInitConfig,
8097
+ tabIndex: 0,
8080
8098
  });
8099
+ this.icon.setAttribute('role', 'button');
8100
+ setIconState(iconInitConfig);
8101
+
8102
+ // visually hidden live region, so screen readers announce the copy
8103
+ this.copyLiveRegion = document.createElement('span');
8104
+ this.copyLiveRegion.setAttribute('aria-live', 'polite');
8105
+ this.copyLiveRegion.style.cssText =
8106
+ 'position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;';
8081
8107
 
8082
8108
  this.baseElement.appendChild(this.icon);
8083
- this.icon.addEventListener('click', () => {
8084
- navigator.clipboard.writeText(this.value);
8085
- Object.assign(this.icon, iconCopiedConfig);
8109
+ this.shadowRoot.appendChild(this.copyLiveRegion);
8086
8110
 
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);
8111
+ let resetTimer;
8112
+ const copy = async () => {
8113
+ try {
8114
+ await navigator.clipboard.writeText(this.value);
8115
+ } catch {
8116
+ return;
8117
+ }
8118
+ setIconState(iconCopiedConfig);
8119
+ this.copyLiveRegion.textContent = 'Copied';
8120
+
8121
+ // we want the icon to go back to the initial state after 3 seconds
8122
+ // a repeated copy restarts the countdown
8123
+ clearTimeout(resetTimer);
8124
+ resetTimer = setTimeout(() => {
8125
+ setIconState(iconInitConfig);
8126
+ this.copyLiveRegion.textContent = '';
8127
+ }, 3000);
8128
+ };
8129
+
8130
+ this.icon.addEventListener('click', copy);
8131
+ this.icon.addEventListener('keydown', (e) => {
8132
+ if (e.key !== 'Enter' && e.key !== ' ') return;
8133
+ e.preventDefault();
8134
+ // the SDK submits the flow on any Enter that reaches the flow root
8135
+ e.stopPropagation();
8136
+ copy();
8091
8137
  });
8092
8138
  }
8093
8139
 
@@ -25221,7 +25267,7 @@ class RawCollapsibleContainer extends createBaseClass$1({
25221
25267
  baseSelector: 'slot',
25222
25268
  }) {
25223
25269
  static get observedAttributes() {
25224
- return ['collapsed', 'collapsible', 'text'];
25270
+ return ['collapsed', 'collapsible', 'text', 'aria-label'];
25225
25271
  }
25226
25272
 
25227
25273
  constructor() {
@@ -25332,7 +25378,31 @@ class RawCollapsibleContainer extends createBaseClass$1({
25332
25378
  this.setAttribute('collapsed', this.isCollapsed ? 'false' : 'true');
25333
25379
  }
25334
25380
 
25381
+ // header acts as a disclosure button only when the container is collapsible
25382
+ updateHeaderA11y() {
25383
+ if (!this.isCollapsible) {
25384
+ ['role', 'tabindex', 'aria-expanded', 'aria-label'].forEach((attr) =>
25385
+ this.header.removeAttribute(attr),
25386
+ );
25387
+ return;
25388
+ }
25389
+ this.header.setAttribute('role', 'button');
25390
+ this.header.setAttribute('tabindex', '0');
25391
+ this.header.setAttribute('aria-expanded', String(!this.isCollapsed));
25392
+ // without header text the button has no name, so fall back to a label
25393
+ if (this.getAttribute('text')) {
25394
+ this.header.removeAttribute('aria-label');
25395
+ } else {
25396
+ this.header.setAttribute(
25397
+ 'aria-label',
25398
+ this.getAttribute('aria-label') || 'Toggle section',
25399
+ );
25400
+ }
25401
+ }
25402
+
25335
25403
  collapse(animated = false) {
25404
+ // keep collapsed content out of the tab order and the a11y tree
25405
+ this.content.inert = true;
25336
25406
  const final = () => {
25337
25407
  this.content.style.maxHeight = '0px';
25338
25408
  };
@@ -25344,6 +25414,7 @@ class RawCollapsibleContainer extends createBaseClass$1({
25344
25414
  }
25345
25415
 
25346
25416
  expand(animated = false) {
25417
+ this.content.inert = false;
25347
25418
  const final = () => {
25348
25419
  this.content.style.maxHeight = '';
25349
25420
  };
@@ -25366,6 +25437,13 @@ class RawCollapsibleContainer extends createBaseClass$1({
25366
25437
  if (!this.isCollapsible) return;
25367
25438
  this.toggle();
25368
25439
  });
25440
+ this.header.addEventListener('keydown', (e) => {
25441
+ if (!this.isCollapsible || (e.key !== 'Enter' && e.key !== ' ')) return;
25442
+ e.preventDefault();
25443
+ // the SDK submits the flow on any Enter that reaches the flow root
25444
+ e.stopPropagation();
25445
+ this.toggle();
25446
+ });
25369
25447
  forwardAttrs$1(this, this.textComponent, {
25370
25448
  includeAttrs: ['text-align', 'text-variant', 'text-mode'],
25371
25449
  mapAttrs: { 'text-mode': 'mode', 'text-variant': 'variant' },
@@ -25380,8 +25458,14 @@ class RawCollapsibleContainer extends createBaseClass$1({
25380
25458
  attributeChangedCallback(name, oldValue, newValue) {
25381
25459
  if (name === 'text') {
25382
25460
  this.updateHeaderText();
25461
+ this.updateHeaderA11y();
25462
+ return;
25463
+ }
25464
+ if (name === 'aria-label') {
25465
+ this.updateHeaderA11y();
25383
25466
  return;
25384
25467
  }
25468
+ this.updateHeaderA11y();
25385
25469
  const collapsed = this.isCollapsed && this.isCollapsible;
25386
25470
  if (collapsed) {
25387
25471
  this.collapse(this.#isComponentMounted);