@descope/web-components-ui 1.0.324 → 1.0.326

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -1496,6 +1496,7 @@ const ButtonClass = compose(
1496
1496
  borderWidth: {},
1497
1497
 
1498
1498
  verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],
1499
+ horizontalPadding: [{ property: 'padding-right' }, { property: 'padding-left' }],
1499
1500
 
1500
1501
  labelTextColor: { property: 'color' },
1501
1502
  iconColor: {
@@ -5834,10 +5835,10 @@ const comboBoxItem = ({ code, dialCode, name: country }) => `
5834
5835
 
5835
5836
  const componentName$y = getComponentName('phone-field-internal');
5836
5837
 
5837
- const commonAttrs$1 = ['disabled', 'size', 'bordered', 'invalid', 'readonly', 'label-type'];
5838
+ const commonAttrs$1 = ['disabled', 'size', 'bordered', 'invalid', 'readonly'];
5838
5839
  const countryAttrs = ['country-input-placeholder', 'default-code', 'restrict-countries'];
5839
5840
  const phoneAttrs = ['phone-input-placeholder', 'maxlength', 'autocomplete', 'name'];
5840
- const labelTypeAttrs = ['country-input-label', 'phone-input-label'];
5841
+ const labelTypeAttrs = ['label-type', 'country-input-label', 'phone-input-label'];
5841
5842
  const mapAttrs$1 = {
5842
5843
  'country-input-label': 'label',
5843
5844
  'phone-input-label': 'label',
@@ -6001,6 +6002,43 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$6 {
6001
6002
  this.handleInputEventDispatching();
6002
6003
  }
6003
6004
 
6005
+ handleLabelTypeAttrs(attrName, newValue) {
6006
+ // set or remove label attributes from inner text/combo components on `label-type` change
6007
+ const attr = mapAttrs$1[attrName] || attrName;
6008
+
6009
+ if (attrName === 'label-type') {
6010
+ this.onLabelTypeChange(newValue);
6011
+ }
6012
+ // on inner components label attr change - set label attributes for text/combo components
6013
+ // only if label-type is `floating`
6014
+ else if (this.getAttribute('label-type') === 'floating') {
6015
+ if (attrName === 'country-input-label') {
6016
+ this.countryCodeInput.setAttribute(attr, newValue);
6017
+ } else if (attrName === 'phone-input-label') {
6018
+ this.phoneNumberInput.setAttribute(attr, newValue);
6019
+ }
6020
+ }
6021
+ }
6022
+
6023
+ onLabelTypeChange(newValue) {
6024
+ if (newValue === 'floating') {
6025
+ // on change to `floating` label - set inner components `label` and `placeholder`
6026
+ this.countryCodeInput.setAttribute('label', this.getAttribute('country-input-label') || '');
6027
+ this.countryCodeInput.setAttribute(
6028
+ 'placeholder',
6029
+ this.getAttribute('country-input-placeholder') || ''
6030
+ );
6031
+ this.phoneNumberInput.setAttribute('label', this.getAttribute('phone-input-label') || '');
6032
+ this.phoneNumberInput.setAttribute(
6033
+ 'placeholder',
6034
+ this.getAttribute('phone-input-placeholder') || ''
6035
+ );
6036
+ } else {
6037
+ // for other cases - reset inner components label-type and labels
6038
+ this.inputs.forEach((input) => input.removeAttribute('label'));
6039
+ }
6040
+ }
6041
+
6004
6042
  attributeChangedCallback(attrName, oldValue, newValue) {
6005
6043
  super.attributeChangedCallback(attrName, oldValue, newValue);
6006
6044
 
@@ -6016,15 +6054,13 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$6 {
6016
6054
  this.countryCodeInput.setAttribute(attr, newValue);
6017
6055
  } else if (phoneAttrs.includes(attrName)) {
6018
6056
  this.phoneNumberInput.setAttribute(attr, newValue);
6019
- } else if (labelTypeAttrs.includes(attrName)) {
6020
- if (attrName === 'country-input-label') {
6021
- this.countryCodeInput.setAttribute(attr, newValue);
6022
- }
6023
- if (attrName === 'phone-input-label') {
6024
- this.phoneNumberInput.setAttribute(attr, newValue);
6025
- }
6026
6057
  }
6027
6058
  }
6059
+
6060
+ if (labelTypeAttrs.includes(attrName)) {
6061
+ this.handleLabelTypeAttrs(attrName, newValue);
6062
+ }
6063
+
6028
6064
  if (attrName === 'restrict-countries') {
6029
6065
  this.updateCountryCodeItems(this.getRestrictedCountries());
6030
6066
  }
@@ -6077,6 +6113,7 @@ const customMixin$6 = (superclass) =>
6077
6113
  'country-input-label',
6078
6114
  'phone-input-label',
6079
6115
  'readonly',
6116
+ 'label-type',
6080
6117
  ],
6081
6118
  });
6082
6119
  }
@@ -12087,6 +12124,7 @@ const button = {
12087
12124
  },
12088
12125
 
12089
12126
  [compVars$5.verticalPadding]: '1em',
12127
+ [compVars$5.horizontalPadding]: '0.875em',
12090
12128
 
12091
12129
  [compVars$5.outlineWidth]: globals.border.sm,
12092
12130
  [compVars$5.outlineOffset]: '0px', // keep `px` unit for external calc