@descope/web-components-ui 1.0.162 → 1.0.164

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
@@ -919,7 +919,7 @@ const proxyInputMixin = (superclass) =>
919
919
  }
920
920
 
921
921
  get inputElement() {
922
- if (this.#inputElement) return this.#inputElement
922
+ if (this.#inputElement) return this.#inputElement;
923
923
 
924
924
  this.warnIfInputElementIsMissing();
925
925
 
@@ -956,7 +956,7 @@ const proxyInputMixin = (superclass) =>
956
956
  // on some cases the base element is not ready so the inputElement is empty
957
957
  // we are deferring this section to make sure the base element is ready
958
958
  setTimeout(() => {
959
- this.inputElement.addEventListener('input', (e) => {
959
+ this.inputElement?.addEventListener('input', (e) => {
960
960
  if (!this.inputElement.checkValidity()) {
961
961
  this.inputElement.setCustomValidity('');
962
962
  // after updating the input validity we want to trigger set validity on the wrapping element
@@ -1000,7 +1000,6 @@ const proxyInputMixin = (superclass) =>
1000
1000
  forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1001
1001
  });
1002
1002
  }
1003
-
1004
1003
  };
1005
1004
 
1006
1005
  const composedProxyInputMixin = compose(
@@ -2234,13 +2233,13 @@ const selectors = {
2234
2233
  text: { selector: () => TextClass.componentName },
2235
2234
  };
2236
2235
 
2237
- const { anchor, text: text$2, host: host$7, wrapper } = selectors;
2236
+ const { anchor, text: text$2, host: host$7, wrapper: wrapper$1 } = selectors;
2238
2237
 
2239
2238
  const LinkClass = compose(
2240
2239
  createStyleMixin({
2241
2240
  mappings: {
2242
2241
  hostWidth: { ...host$7, property: 'width' },
2243
- textAlign: wrapper,
2242
+ textAlign: wrapper$1,
2244
2243
  textColor: [
2245
2244
  { ...anchor, property: 'color' },
2246
2245
  { ...text$2, property: TextClass.cssVarList.textColor },
@@ -2538,7 +2537,14 @@ class PasscodeInternal extends BaseInputClass$3 {
2538
2537
  input.onkeydown = ({ key }) => {
2539
2538
  // when user deletes a digit, we want to focus the previous digit
2540
2539
  if (key === 'Backspace') {
2541
- input.setSelectionRange(1, 1);
2540
+ // if value is empty then the input element does not fire `input` event
2541
+ // if this is the case, we focus the element here.
2542
+ // otherwise, the focusElement occurs as part of the `input` event listener
2543
+ if (!input.value) {
2544
+ setTimeout(() => focusElement(this.getPrevInput(input)), 0);
2545
+ } else {
2546
+ input.setSelectionRange(1, 1);
2547
+ }
2542
2548
  } else if (key.length === 1) {
2543
2549
  // we want only characters and not command keys
2544
2550
  input.value = ''; // we are clearing the previous value so we can override it with the new value
@@ -5413,13 +5419,15 @@ const observedAttributes = [
5413
5419
  'description',
5414
5420
  'button-label',
5415
5421
  'accept',
5422
+ 'readonly',
5416
5423
  'button-mode',
5417
5424
  'button-variant',
5418
5425
  'required',
5419
5426
  'size',
5427
+ 'icon',
5420
5428
  ];
5421
5429
 
5422
- const BaseInputClass = createBaseInputClass({ componentName: componentName$1, baseSelector: ':host > div.wrapper' });
5430
+ const BaseInputClass = createBaseInputClass({ componentName: componentName$1, baseSelector: ':host > div' });
5423
5431
 
5424
5432
  class RawUploadFile extends BaseInputClass {
5425
5433
  static get observedAttributes() {
@@ -5431,12 +5439,16 @@ class RawUploadFile extends BaseInputClass {
5431
5439
 
5432
5440
  this.attachShadow({ mode: 'open' }).innerHTML = `
5433
5441
  <style>
5434
- .wrapper {
5442
+ :host {
5443
+ display: flex;
5444
+ }
5445
+ :host > div {
5435
5446
  display: flex;
5436
5447
  align-items: center;
5437
5448
  justify-content: center;
5438
5449
  text-align: center;
5439
5450
  flex-direction: column;
5451
+ width: 100%;
5440
5452
  }
5441
5453
  .button-wrapper {
5442
5454
  position: relative;
@@ -5449,11 +5461,10 @@ class RawUploadFile extends BaseInputClass {
5449
5461
  opacity: 0;
5450
5462
  }
5451
5463
  </style>
5452
- <div class="wrapper">
5464
+ <div>
5453
5465
  <div class="icon"></div>
5454
5466
  <div class="title">
5455
5467
  <span class="title-text"></span>
5456
- <span class="required-indicator"></span>
5457
5468
  </div>
5458
5469
  <div class="description"></div>
5459
5470
  <div class="button-wrapper">
@@ -5515,6 +5526,10 @@ class RawUploadFile extends BaseInputClass {
5515
5526
  this.updateButtonSize(newValue);
5516
5527
  } else if (attrName === 'accept') {
5517
5528
  this.updateInputAccept(newValue);
5529
+ } else if (attrName === 'readonly') {
5530
+ this.updateReadOnly(newValue);
5531
+ } else if (attrName === 'icon') {
5532
+ this.updateIcon(newValue);
5518
5533
  }
5519
5534
  }
5520
5535
  }
@@ -5535,6 +5550,10 @@ class RawUploadFile extends BaseInputClass {
5535
5550
  return this.shadowRoot.querySelector('.description');
5536
5551
  }
5537
5552
 
5553
+ get icon() {
5554
+ return this.shadowRoot.querySelector('.icon');
5555
+ }
5556
+
5538
5557
  updateTitle(val) {
5539
5558
  this.title.innerHTML = val;
5540
5559
  }
@@ -5562,10 +5581,23 @@ class RawUploadFile extends BaseInputClass {
5562
5581
  updateInputAccept(val) {
5563
5582
  this.input.setAttribute('accept', val);
5564
5583
  }
5584
+
5585
+ updateReadOnly(val) {
5586
+ if (val === 'true') {
5587
+ this.input.setAttribute('disabled', 'true');
5588
+ } else {
5589
+ this.input.removeAttribute('disabled');
5590
+ }
5591
+ }
5592
+
5593
+ updateIcon(val) {
5594
+ this.icon.style.content = `url(${val})`;
5595
+ }
5565
5596
  }
5566
5597
 
5567
- const { host, icon, title, description, requiredIndicator } = {
5568
- host: { selector: () => '.wrapper' },
5598
+ const { host, wrapper, icon, title, description, requiredIndicator } = {
5599
+ host: { selector: () => ':host' },
5600
+ wrapper: { selector: () => ':host > div' },
5569
5601
  icon: { selector: () => '.icon' },
5570
5602
  title: { selector: () => '.title' },
5571
5603
  description: { selector: () => '.description' },
@@ -5578,15 +5610,15 @@ const UploadFileClass = compose(
5578
5610
  mappings: {
5579
5611
  fontSize: {},
5580
5612
  fontFamily: {},
5581
- hostWidth: { ...host, property: 'width' },
5613
+ borderColor: {},
5614
+ borderWidth: {},
5615
+ borderStyle: {},
5616
+ borderRadius: {},
5582
5617
  hostHeight: { ...host, property: 'height' },
5583
- hostPadding: { ...host, property: 'padding' },
5584
- gap: { ...host },
5585
- lineHeight: { ...host, property: 'line-height' },
5586
- borderColor: { ...host, property: 'border-color' },
5587
- borderWidth: { ...host, property: 'border-width' },
5588
- borderStyle: { ...host, property: 'border-style' },
5589
- borderRadius: { ...host, property: 'border-radius' },
5618
+ hostWidth: { ...host, property: 'width' },
5619
+ hostPadding: { property: 'padding' },
5620
+ gap: { ...wrapper },
5621
+ lineHeight: { ...wrapper, property: 'line-height' },
5590
5622
  titleFontSize: { ...title, property: 'font-size' },
5591
5623
  titleFontWeight: { ...title, property: 'font-weight' },
5592
5624
  descriptionFontSize: { ...description, property: 'font-size' },
@@ -5594,7 +5626,6 @@ const UploadFileClass = compose(
5594
5626
  { ...title, property: 'color' },
5595
5627
  { ...description, property: 'color' },
5596
5628
  ],
5597
- icon: { ...icon, property: 'content' },
5598
5629
  iconSize: { ...icon, property: 'width' },
5599
5630
  requiredIndicator: { ...requiredIndicator, property: 'content' },
5600
5631
  },
@@ -6958,10 +6989,8 @@ const vars$1 = UploadFileClass.cssVarList;
6958
6989
 
6959
6990
  const uploadFile = {
6960
6991
  [vars$1.labelTextColor]: refs.labelTextColor,
6961
- [vars$1.requiredIndicator]: refs.requiredIndicator,
6962
6992
  [vars$1.fontFamily]: refs.fontFamily,
6963
6993
 
6964
- [vars$1.icon]: 'url(https://imgs.descope.com/components/upload-file-outlined.svg)',
6965
6994
  [vars$1.iconSize]: '2em',
6966
6995
 
6967
6996
  [vars$1.hostPadding]: '0.75em',
@@ -6976,6 +7005,10 @@ const uploadFile = {
6976
7005
  [vars$1.borderRadius]: refs.borderRadius,
6977
7006
  [vars$1.borderStyle]: 'dashed',
6978
7007
 
7008
+ _required: {
7009
+ [vars$1.requiredIndicator]: refs.requiredIndicator,
7010
+ },
7011
+
6979
7012
  size: {
6980
7013
  xs: {
6981
7014
  [vars$1.hostHeight]: '196px',
@@ -7006,6 +7039,10 @@ const uploadFile = {
7006
7039
  [vars$1.lineHeight]: '1.75em',
7007
7040
  },
7008
7041
  },
7042
+
7043
+ _fullWidth: {
7044
+ [vars$1.hostWidth]: refs.width,
7045
+ },
7009
7046
  };
7010
7047
 
7011
7048
  var uploadFile$1 = /*#__PURE__*/Object.freeze({