@descope/web-components-ui 1.0.241 → 1.0.243

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.
package/dist/index.esm.js CHANGED
@@ -2556,7 +2556,7 @@ const getSanitizedCharacters = (str) => {
2556
2556
 
2557
2557
  const componentName$q = getComponentName('passcode-internal');
2558
2558
 
2559
- const observedAttributes$5 = ['digits'];
2559
+ const observedAttributes$5 = ['digits', 'loading'];
2560
2560
 
2561
2561
  const forwardAttributes = ['disabled', 'bordered', 'size', 'invalid', 'readonly'];
2562
2562
 
@@ -2572,21 +2572,34 @@ class PasscodeInternal extends BaseInputClass$4 {
2572
2572
 
2573
2573
  this.innerHTML = `
2574
2574
  <div class="wrapper"></div>
2575
+ <div class="loader-container">
2576
+ <descope-loader-radial size="xs" mode="primary"></descope-loader-radial>
2577
+ </div>
2575
2578
  <style>
2576
2579
  .wrapper {
2577
2580
  display: flex;
2578
2581
  width: 100%;
2579
2582
  justify-content: space-between;
2580
2583
  direction: ltr;
2584
+ position: relative;
2581
2585
  }
2582
2586
 
2583
2587
  descope-text-field {
2584
2588
  direction: ltr;
2585
2589
  }
2590
+
2591
+ .loader-container {
2592
+ display: none;
2593
+ position: absolute;
2594
+ top: 50%;
2595
+ left: 50%;
2596
+ transform: translate(-50%, -50%);
2597
+ }
2586
2598
  </style>
2587
2599
  `;
2588
2600
 
2589
- this.wrapperEle = this.querySelector('div');
2601
+ this.wrapperEle = this.querySelector('.wrapper');
2602
+ this.loaderContainer = this.querySelector('.loader-container');
2590
2603
  }
2591
2604
 
2592
2605
  renderInputs() {
@@ -2608,6 +2621,14 @@ class PasscodeInternal extends BaseInputClass$4 {
2608
2621
  this.initInputs();
2609
2622
  }
2610
2623
 
2624
+ handleLoadingState(isLoading) {
2625
+ if (isLoading) {
2626
+ this.setAttribute('inert', 'true');
2627
+ } else {
2628
+ this.removeAttribute('inert');
2629
+ }
2630
+ }
2631
+
2611
2632
  get digits() {
2612
2633
  return Number.parseInt(this.getAttribute('digits'), 10) || 6;
2613
2634
  }
@@ -2753,6 +2774,9 @@ class PasscodeInternal extends BaseInputClass$4 {
2753
2774
  if (attrName === 'digits') {
2754
2775
  this.renderInputs();
2755
2776
  }
2777
+ if (attrName === 'loading') {
2778
+ this.handleLoadingState(newValue === 'true');
2779
+ }
2756
2780
  }
2757
2781
  }
2758
2782
  }
@@ -2847,7 +2871,7 @@ const customMixin$5 = (superclass) =>
2847
2871
 
2848
2872
  this.inputElement = this.shadowRoot.querySelector(componentName$q);
2849
2873
 
2850
- forwardAttrs(this, this.inputElement, { includeAttrs: ['digits', 'size'] });
2874
+ forwardAttrs(this, this.inputElement, { includeAttrs: ['digits', 'size', 'loading'] });
2851
2875
  }
2852
2876
 
2853
2877
  attributeChangedCallback(attrName, oldValue, newValue) {
@@ -2878,6 +2902,7 @@ const {
2878
2902
  };
2879
2903
 
2880
2904
  const textVars$2 = TextFieldClass.cssVarList;
2905
+ const loaderVars = LoaderRadialClass.cssVarList;
2881
2906
 
2882
2907
  const PasscodeClass = compose(
2883
2908
  createStyleMixin({
@@ -2908,6 +2933,8 @@ const PasscodeClass = compose(
2908
2933
  digitOutlineWidth: { ...digitField, property: textVars$2.inputOutlineWidth },
2909
2934
 
2910
2935
  focusedDigitFieldOutlineColor: { ...focusedDigitField, property: textVars$2.inputOutlineColor },
2936
+ overlayOpacity: { ...internalWrapper$1, property: 'opacity' },
2937
+ spinnerSize: { selector: LoaderRadialClass.componentName, property: loaderVars.spinnerSize },
2911
2938
  },
2912
2939
  }),
2913
2940
  draggableMixin,
@@ -2932,6 +2959,10 @@ const PasscodeClass = compose(
2932
2959
  background-color: transparent;
2933
2960
  }
2934
2961
 
2962
+ :host([loading="true"]) descope-passcode-internal .loader-container {
2963
+ display: block;
2964
+ }
2965
+
2935
2966
  descope-passcode-internal {
2936
2967
  -webkit-mask-image: none;
2937
2968
  padding: 0;
@@ -7653,6 +7684,8 @@ const [theme$1, refs, vars$u] = createHelperVars(
7653
7684
 
7654
7685
  direction: globalRefs$h.direction,
7655
7686
 
7687
+ overlayOpacity: '0.3',
7688
+
7656
7689
  size: {
7657
7690
  xs: { fontSize: '12px', chipFontSize: '10px' },
7658
7691
  sm: { fontSize: '14px', chipFontSize: '12px' },
@@ -8322,9 +8355,20 @@ const passcode = {
8322
8355
  [vars$g.focusedDigitFieldOutlineColor]: refs.outlineColor,
8323
8356
  [vars$g.digitSize]: refs.inputHeight,
8324
8357
 
8358
+ size: {
8359
+ xs: { [vars$g.spinnerSize]: '15px' },
8360
+ sm: { [vars$g.spinnerSize]: '20px' },
8361
+ md: { [vars$g.spinnerSize]: '20px' },
8362
+ lg: { [vars$g.spinnerSize]: '20px' },
8363
+ },
8364
+
8325
8365
  _hideCursor: {
8326
8366
  [vars$g.digitCaretTextColor]: 'transparent',
8327
8367
  },
8368
+
8369
+ _loading: {
8370
+ [vars$g.overlayOpacity]: refs.overlayOpacity,
8371
+ },
8328
8372
  };
8329
8373
 
8330
8374
  var passcode$1 = /*#__PURE__*/Object.freeze({