@descope/web-components-ui 1.0.162 → 1.0.164

Sign up to get free protection for your applications and to get access to all the features.
@@ -1241,7 +1241,7 @@ const proxyInputMixin = (superclass) =>
1241
1241
  }
1242
1242
 
1243
1243
  get inputElement() {
1244
- if (this.#inputElement) return this.#inputElement
1244
+ if (this.#inputElement) return this.#inputElement;
1245
1245
 
1246
1246
  this.warnIfInputElementIsMissing();
1247
1247
 
@@ -1278,7 +1278,7 @@ const proxyInputMixin = (superclass) =>
1278
1278
  // on some cases the base element is not ready so the inputElement is empty
1279
1279
  // we are deferring this section to make sure the base element is ready
1280
1280
  setTimeout(() => {
1281
- this.inputElement.addEventListener('input', (e) => {
1281
+ this.inputElement?.addEventListener('input', (e) => {
1282
1282
  if (!this.inputElement.checkValidity()) {
1283
1283
  this.inputElement.setCustomValidity('');
1284
1284
  // after updating the input validity we want to trigger set validity on the wrapping element
@@ -1322,7 +1322,6 @@ const proxyInputMixin = (superclass) =>
1322
1322
  forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
1323
1323
  });
1324
1324
  }
1325
-
1326
1325
  };
1327
1326
 
1328
1327
  const composedProxyInputMixin = compose(
@@ -3353,13 +3352,13 @@ const selectors$1 = {
3353
3352
  text: { selector: () => TextClass.componentName },
3354
3353
  };
3355
3354
 
3356
- const { anchor, text: text$1, host: host$7, wrapper } = selectors$1;
3355
+ const { anchor, text: text$1, host: host$7, wrapper: wrapper$1 } = selectors$1;
3357
3356
 
3358
3357
  const LinkClass = compose(
3359
3358
  createStyleMixin({
3360
3359
  mappings: {
3361
3360
  hostWidth: { ...host$7, property: 'width' },
3362
- textAlign: wrapper,
3361
+ textAlign: wrapper$1,
3363
3362
  textColor: [
3364
3363
  { ...anchor, property: 'color' },
3365
3364
  { ...text$1, property: TextClass.cssVarList.textColor },
@@ -5899,13 +5898,15 @@ const observedAttributes$1 = [
5899
5898
  'description',
5900
5899
  'button-label',
5901
5900
  'accept',
5901
+ 'readonly',
5902
5902
  'button-mode',
5903
5903
  'button-variant',
5904
5904
  'required',
5905
5905
  'size',
5906
+ 'icon',
5906
5907
  ];
5907
5908
 
5908
- const BaseInputClass = createBaseInputClass({ componentName: componentName$1, baseSelector: ':host > div.wrapper' });
5909
+ const BaseInputClass = createBaseInputClass({ componentName: componentName$1, baseSelector: ':host > div' });
5909
5910
 
5910
5911
  class RawUploadFile extends BaseInputClass {
5911
5912
  static get observedAttributes() {
@@ -5917,12 +5918,16 @@ class RawUploadFile extends BaseInputClass {
5917
5918
 
5918
5919
  this.attachShadow({ mode: 'open' }).innerHTML = `
5919
5920
  <style>
5920
- .wrapper {
5921
+ :host {
5922
+ display: flex;
5923
+ }
5924
+ :host > div {
5921
5925
  display: flex;
5922
5926
  align-items: center;
5923
5927
  justify-content: center;
5924
5928
  text-align: center;
5925
5929
  flex-direction: column;
5930
+ width: 100%;
5926
5931
  }
5927
5932
  .button-wrapper {
5928
5933
  position: relative;
@@ -5935,11 +5940,10 @@ class RawUploadFile extends BaseInputClass {
5935
5940
  opacity: 0;
5936
5941
  }
5937
5942
  </style>
5938
- <div class="wrapper">
5943
+ <div>
5939
5944
  <div class="icon"></div>
5940
5945
  <div class="title">
5941
5946
  <span class="title-text"></span>
5942
- <span class="required-indicator"></span>
5943
5947
  </div>
5944
5948
  <div class="description"></div>
5945
5949
  <div class="button-wrapper">
@@ -6001,6 +6005,10 @@ class RawUploadFile extends BaseInputClass {
6001
6005
  this.updateButtonSize(newValue);
6002
6006
  } else if (attrName === 'accept') {
6003
6007
  this.updateInputAccept(newValue);
6008
+ } else if (attrName === 'readonly') {
6009
+ this.updateReadOnly(newValue);
6010
+ } else if (attrName === 'icon') {
6011
+ this.updateIcon(newValue);
6004
6012
  }
6005
6013
  }
6006
6014
  }
@@ -6021,6 +6029,10 @@ class RawUploadFile extends BaseInputClass {
6021
6029
  return this.shadowRoot.querySelector('.description');
6022
6030
  }
6023
6031
 
6032
+ get icon() {
6033
+ return this.shadowRoot.querySelector('.icon');
6034
+ }
6035
+
6024
6036
  updateTitle(val) {
6025
6037
  this.title.innerHTML = val;
6026
6038
  }
@@ -6048,10 +6060,23 @@ class RawUploadFile extends BaseInputClass {
6048
6060
  updateInputAccept(val) {
6049
6061
  this.input.setAttribute('accept', val);
6050
6062
  }
6063
+
6064
+ updateReadOnly(val) {
6065
+ if (val === 'true') {
6066
+ this.input.setAttribute('disabled', 'true');
6067
+ } else {
6068
+ this.input.removeAttribute('disabled');
6069
+ }
6070
+ }
6071
+
6072
+ updateIcon(val) {
6073
+ this.icon.style.content = `url(${val})`;
6074
+ }
6051
6075
  }
6052
6076
 
6053
- const { host, icon, title, description, requiredIndicator } = {
6054
- host: { selector: () => '.wrapper' },
6077
+ const { host, wrapper, icon, title, description, requiredIndicator } = {
6078
+ host: { selector: () => ':host' },
6079
+ wrapper: { selector: () => ':host > div' },
6055
6080
  icon: { selector: () => '.icon' },
6056
6081
  title: { selector: () => '.title' },
6057
6082
  description: { selector: () => '.description' },
@@ -6064,15 +6089,15 @@ const UploadFileClass = compose(
6064
6089
  mappings: {
6065
6090
  fontSize: {},
6066
6091
  fontFamily: {},
6067
- hostWidth: { ...host, property: 'width' },
6092
+ borderColor: {},
6093
+ borderWidth: {},
6094
+ borderStyle: {},
6095
+ borderRadius: {},
6068
6096
  hostHeight: { ...host, property: 'height' },
6069
- hostPadding: { ...host, property: 'padding' },
6070
- gap: { ...host },
6071
- lineHeight: { ...host, property: 'line-height' },
6072
- borderColor: { ...host, property: 'border-color' },
6073
- borderWidth: { ...host, property: 'border-width' },
6074
- borderStyle: { ...host, property: 'border-style' },
6075
- borderRadius: { ...host, property: 'border-radius' },
6097
+ hostWidth: { ...host, property: 'width' },
6098
+ hostPadding: { property: 'padding' },
6099
+ gap: { ...wrapper },
6100
+ lineHeight: { ...wrapper, property: 'line-height' },
6076
6101
  titleFontSize: { ...title, property: 'font-size' },
6077
6102
  titleFontWeight: { ...title, property: 'font-weight' },
6078
6103
  descriptionFontSize: { ...description, property: 'font-size' },
@@ -6080,7 +6105,6 @@ const UploadFileClass = compose(
6080
6105
  { ...title, property: 'color' },
6081
6106
  { ...description, property: 'color' },
6082
6107
  ],
6083
- icon: { ...icon, property: 'content' },
6084
6108
  iconSize: { ...icon, property: 'width' },
6085
6109
  requiredIndicator: { ...requiredIndicator, property: 'content' },
6086
6110
  },
@@ -6093,10 +6117,8 @@ const vars$1 = UploadFileClass.cssVarList;
6093
6117
 
6094
6118
  const uploadFile = {
6095
6119
  [vars$1.labelTextColor]: refs.labelTextColor,
6096
- [vars$1.requiredIndicator]: refs.requiredIndicator,
6097
6120
  [vars$1.fontFamily]: refs.fontFamily,
6098
6121
 
6099
- [vars$1.icon]: 'url(https://imgs.descope.com/components/upload-file-outlined.svg)',
6100
6122
  [vars$1.iconSize]: '2em',
6101
6123
 
6102
6124
  [vars$1.hostPadding]: '0.75em',
@@ -6111,6 +6133,10 @@ const uploadFile = {
6111
6133
  [vars$1.borderRadius]: refs.borderRadius,
6112
6134
  [vars$1.borderStyle]: 'dashed',
6113
6135
 
6136
+ _required: {
6137
+ [vars$1.requiredIndicator]: refs.requiredIndicator,
6138
+ },
6139
+
6114
6140
  size: {
6115
6141
  xs: {
6116
6142
  [vars$1.hostHeight]: '196px',
@@ -6141,6 +6167,10 @@ const uploadFile = {
6141
6167
  [vars$1.lineHeight]: '1.75em',
6142
6168
  },
6143
6169
  },
6170
+
6171
+ _fullWidth: {
6172
+ [vars$1.hostWidth]: refs.width,
6173
+ },
6144
6174
  };
6145
6175
 
6146
6176
  var uploadFile$1 = /*#__PURE__*/Object.freeze({