@descope/web-components-ui 1.0.413 → 1.0.414

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 (106) hide show
  1. package/dist/cjs/index.cjs.js +11 -507
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/umd/{1497.js → 1053.js} +19 -19
  5. package/dist/umd/{1497.js.LICENSE.txt → 1053.js.LICENSE.txt} +0 -6
  6. package/dist/umd/{4671.js → 1414.js} +122 -10
  7. package/dist/umd/{4671.js.LICENSE.txt → 1414.js.LICENSE.txt} +0 -6
  8. package/dist/umd/1437.js +6 -6
  9. package/dist/umd/2566.js +2 -0
  10. package/dist/umd/{952.js.LICENSE.txt → 2566.js.LICENSE.txt} +6 -0
  11. package/dist/umd/2755.js +1 -0
  12. package/dist/umd/286.js +2 -2
  13. package/dist/umd/2919.js +832 -0
  14. package/dist/umd/{8910.js.LICENSE.txt → 2919.js.LICENSE.txt} +0 -6
  15. package/dist/umd/3222.js +282 -0
  16. package/dist/umd/351.js +7 -7
  17. package/dist/umd/3607.js +1 -1
  18. package/dist/umd/3607.js.LICENSE.txt +0 -6
  19. package/dist/umd/3711.js +123 -0
  20. package/dist/umd/4480.js +1 -1
  21. package/dist/umd/4834.js +4 -4
  22. package/dist/umd/{8799.js → 5026.js} +117 -5
  23. package/dist/umd/{8799.js.LICENSE.txt → 5026.js.LICENSE.txt} +0 -6
  24. package/dist/umd/5086.js +2 -2
  25. package/dist/umd/5273.js +4 -4
  26. package/dist/umd/5412.js +2 -2
  27. package/dist/umd/5443.js +116 -4
  28. package/dist/umd/6418.js +2 -0
  29. package/dist/umd/6474.js +6 -6
  30. package/dist/umd/{6206.js → 6637.js} +9 -9
  31. package/dist/umd/{6206.js.LICENSE.txt → 6637.js.LICENSE.txt} +6 -0
  32. package/dist/umd/6726.js +148 -0
  33. package/dist/umd/{8114.js → 7212.js} +16 -16
  34. package/dist/umd/{1012.js.LICENSE.txt → 7212.js.LICENSE.txt} +0 -6
  35. package/dist/umd/{1180.js → 7407.js} +117 -5
  36. package/dist/umd/{9547.js.LICENSE.txt → 7407.js.LICENSE.txt} +0 -6
  37. package/dist/umd/{7200.js → 7607.js} +16 -16
  38. package/dist/umd/{8114.js.LICENSE.txt → 7607.js.LICENSE.txt} +0 -6
  39. package/dist/umd/7824.js +116 -4
  40. package/dist/umd/{9547.js → 8162.js} +3 -3
  41. package/dist/umd/{1180.js.LICENSE.txt → 8162.js.LICENSE.txt} +0 -6
  42. package/dist/umd/8164.js +319 -0
  43. package/dist/umd/{1221.js → 8980.js} +5 -5
  44. package/dist/umd/{1221.js.LICENSE.txt → 8980.js.LICENSE.txt} +0 -6
  45. package/dist/umd/9167.js +452 -0
  46. package/dist/umd/9632.js +275 -0
  47. package/dist/umd/9632.js.LICENSE.txt +23 -0
  48. package/dist/umd/9895.js +17 -0
  49. package/dist/umd/DescopeDev.js +1 -1674
  50. package/dist/umd/DescopeDev.js.LICENSE.txt +0 -92
  51. package/dist/umd/descope-apps-list-index-js.js +1 -1
  52. package/dist/umd/descope-avatar-index-js.js +1 -1
  53. package/dist/umd/descope-button-index-js.js +116 -4
  54. package/dist/umd/descope-combo-box-index-js.js +14 -14
  55. package/dist/umd/descope-date-field-index-js.js +1 -1
  56. package/dist/umd/descope-email-field-index-js.js +4 -4
  57. package/dist/umd/descope-grid-descope-grid-custom-column-index-js.js +4 -4
  58. package/dist/umd/descope-grid-descope-grid-custom-column-index-js.js.LICENSE.txt +6 -0
  59. package/dist/umd/descope-grid-descope-grid-item-details-column-index-js.js +4 -19
  60. package/dist/umd/descope-grid-descope-grid-item-details-column-index-js.js.LICENSE.txt +0 -18
  61. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js +1 -1
  62. package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js.LICENSE.txt +6 -0
  63. package/dist/umd/descope-grid-descope-grid-text-column-index-js.js +2 -2
  64. package/dist/umd/descope-grid-descope-grid-text-column-index-js.js.LICENSE.txt +6 -0
  65. package/dist/umd/descope-grid-index-js.js +1 -1
  66. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  67. package/dist/umd/descope-new-password-index-js.js +1 -2
  68. package/dist/umd/descope-passcode-index-js.js +1 -1
  69. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  70. package/dist/umd/descope-security-questions-verify-index-js.js +2 -2
  71. package/dist/umd/descope-security-questions-verify-index-js.js.LICENSE.txt +0 -6
  72. package/dist/umd/descope-text-field-index-js.js +2 -2
  73. package/dist/umd/descope-text-field-index-js.js.LICENSE.txt +0 -6
  74. package/dist/umd/descope-user-attribute-index-js.js +1 -1
  75. package/dist/umd/descope-user-auth-method-index-js.js +1 -1
  76. package/dist/umd/index.js +1 -1
  77. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  78. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  79. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  80. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  81. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
  82. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.LICENSE.txt +0 -6
  83. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +15 -15
  84. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.LICENSE.txt +0 -6
  85. package/package.json +1 -1
  86. package/src/components/descope-hybrid-field/HybridFieldClass.js +2 -2
  87. package/dist/umd/1012.js +0 -148
  88. package/dist/umd/2520.js +0 -1
  89. package/dist/umd/2584.js +0 -123
  90. package/dist/umd/4771.js +0 -129
  91. package/dist/umd/481.js +0 -2
  92. package/dist/umd/5021.js +0 -170
  93. package/dist/umd/7871.js +0 -452
  94. package/dist/umd/8082.js +0 -319
  95. package/dist/umd/8677.js +0 -275
  96. package/dist/umd/8677.js.LICENSE.txt +0 -29
  97. package/dist/umd/8910.js +0 -832
  98. package/dist/umd/952.js +0 -2
  99. package/dist/umd/descope-new-password-index-js.js.LICENSE.txt +0 -5
  100. /package/dist/umd/{4771.js.LICENSE.txt → 3222.js.LICENSE.txt} +0 -0
  101. /package/dist/umd/{2584.js.LICENSE.txt → 3711.js.LICENSE.txt} +0 -0
  102. /package/dist/umd/{481.js.LICENSE.txt → 6418.js.LICENSE.txt} +0 -0
  103. /package/dist/umd/{7200.js.LICENSE.txt → 6726.js.LICENSE.txt} +0 -0
  104. /package/dist/umd/{8082.js.LICENSE.txt → 8164.js.LICENSE.txt} +0 -0
  105. /package/dist/umd/{7871.js.LICENSE.txt → 9167.js.LICENSE.txt} +0 -0
  106. /package/dist/umd/{5021.js.LICENSE.txt → 9895.js.LICENSE.txt} +0 -0
@@ -5,12 +5,8 @@ var Color = require('color');
5
5
  var DOMPurify = require('dompurify');
6
6
  var MarkdownIt = require('markdown-it');
7
7
  require('lodash.debounce');
8
- var min = require('libphonenumber-js/min');
8
+ require('libphonenumber-js/min');
9
9
  var hljs = require('highlight.js');
10
- require('@vaadin/combo-box');
11
- require('@vaadin/text-field');
12
- require('@vaadin/icons');
13
- require('@vaadin/icon');
14
10
 
15
11
  const DESCOPE_PREFIX = 'descope';
16
12
  const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
@@ -2035,7 +2031,7 @@ const createProxy = ({
2035
2031
 
2036
2032
  })();
2037
2033
 
2038
- const observedAttributes$5 = ['required', 'pattern'];
2034
+ const observedAttributes$4 = ['required', 'pattern'];
2039
2035
 
2040
2036
  const errorAttributes = {
2041
2037
  valueMissing: 'data-errormessage-value-missing',
@@ -2054,7 +2050,7 @@ const inputValidationMixin = (superclass) =>
2054
2050
  #validationTarget = validationTargetSymbol;
2055
2051
 
2056
2052
  static get observedAttributes() {
2057
- return [...(superclass.observedAttributes || []), ...observedAttributes$5];
2053
+ return [...(superclass.observedAttributes || []), ...observedAttributes$4];
2058
2054
  }
2059
2055
 
2060
2056
  static get formAssociated() {
@@ -2226,7 +2222,7 @@ const inputValidationMixin = (superclass) =>
2226
2222
  attributeChangedCallback(attrName, oldValue, newValue) {
2227
2223
  super.attributeChangedCallback?.(attrName, oldValue, newValue);
2228
2224
 
2229
- if (observedAttributes$5.includes(attrName)) {
2225
+ if (observedAttributes$4.includes(attrName)) {
2230
2226
  this.#setValidity();
2231
2227
  }
2232
2228
  }
@@ -6203,12 +6199,12 @@ const LoaderRadialClass = compose(
6203
6199
 
6204
6200
  const componentName$H = getComponentName('passcode');
6205
6201
 
6206
- const observedAttributes$4 = ['digits'];
6202
+ const observedAttributes$3 = ['digits'];
6207
6203
 
6208
6204
  const customMixin$9 = (superclass) =>
6209
6205
  class PasscodeMixinClass extends superclass {
6210
6206
  static get observedAttributes() {
6211
- return observedAttributes$4.concat(superclass.observedAttributes || []);
6207
+ return observedAttributes$3.concat(superclass.observedAttributes || []);
6212
6208
  }
6213
6209
 
6214
6210
  get digits() {
@@ -7218,14 +7214,14 @@ var comboBox$1 = /*#__PURE__*/Object.freeze({
7218
7214
  vars: vars$y
7219
7215
  });
7220
7216
 
7221
- const observedAttributes$3 = ['src', 'alt'];
7217
+ const observedAttributes$2 = ['src', 'alt'];
7222
7218
 
7223
7219
  const componentName$E = getComponentName('image');
7224
7220
 
7225
7221
  const BaseClass$2 = createBaseClass({ componentName: componentName$E, baseSelector: ':host > img' });
7226
7222
  class RawImage extends BaseClass$2 {
7227
7223
  static get observedAttributes() {
7228
- return observedAttributes$3.concat(BaseClass$2.observedAttributes || []);
7224
+ return observedAttributes$2.concat(BaseClass$2.observedAttributes || []);
7229
7225
  }
7230
7226
 
7231
7227
  constructor() {
@@ -7248,7 +7244,7 @@ class RawImage extends BaseClass$2 {
7248
7244
  connectedCallback() {
7249
7245
  super.connectedCallback?.();
7250
7246
 
7251
- forwardAttrs(this, this.baseElement, { includeAttrs: observedAttributes$3 });
7247
+ forwardAttrs(this, this.baseElement, { includeAttrs: observedAttributes$2 });
7252
7248
  }
7253
7249
  }
7254
7250
 
@@ -8488,322 +8484,9 @@ var CountryCodes = [
8488
8484
  ].sort((a, b) => (a.name < b.name ? -1 : 1)),
8489
8485
  ];
8490
8486
 
8491
- // We use JSDelivr (proxy by static.descope.com) in order to fetch the images as image file from this library (svg-country-flags)
8492
- // This reduces our bundle size, and we use it as a static remote resource.
8493
- const getCountryFlag = (code) =>
8494
- `https://static.descope.com/npm/svg-country-flags@1.2.10/svg/${code.toLowerCase()}.svg`;
8495
-
8496
- const comboBoxItem = ({ code, dialCode, name: country }) => `
8497
- <div
8498
- style="display:flex; flex-direction: column;"
8499
- data-id="${dialCode}"
8500
- data-name="${code} ${dialCode} ${country}"
8501
- data-country-code="${code}"
8502
- >
8503
- <div>
8504
- <span>
8505
- <img src="${getCountryFlag(code)}" width="20"/>
8506
- </span>
8507
- <span>${country}</span>
8508
- </div>
8509
- <div>
8510
- <span>${code}</span>
8511
- <span>${dialCode}</span>
8512
- </div>
8513
- </div>
8514
- `;
8515
-
8516
- const parsePhoneNumber = (val) => {
8517
- const value = val || '';
8518
- let countryCode = '';
8519
- let phoneNumber = '';
8520
-
8521
- // Attempt to parse the value using libphonenumber-js
8522
- const parsed = min.parsePhoneNumberFromString(value);
8523
-
8524
- if (parsed) {
8525
- if (parsed.countryCallingCode) {
8526
- countryCode = `+${parsed.countryCallingCode}`;
8527
- }
8528
-
8529
- if (parsed.nationalNumber) {
8530
- phoneNumber = parsed.nationalNumber;
8531
- }
8532
- } else {
8533
- // Fallback: assume a dash separates country code and phone number
8534
- const [country, phone] = value.split('-');
8535
- countryCode = country || '';
8536
- phoneNumber = phone || '';
8537
- }
8538
-
8539
- return [countryCode, phoneNumber];
8540
- };
8541
-
8542
8487
  const componentName$D = getComponentName('phone-field-internal');
8543
8488
 
8544
- const commonAttrs = ['disabled', 'size', 'bordered', 'readonly', 'allow-alphanumeric-input'];
8545
- const countryAttrs = ['country-input-placeholder', 'default-code', 'restrict-countries'];
8546
- const phoneAttrs = ['phone-input-placeholder', 'maxlength', 'autocomplete', 'name'];
8547
- const labelTypeAttrs = ['label-type', 'country-input-label', 'label'];
8548
- const mapAttrs$1 = {
8549
- 'country-input-label': 'label',
8550
- 'country-input-placeholder': 'placeholder',
8551
- 'phone-input-placeholder': 'placeholder',
8552
- };
8553
-
8554
- const inputRelatedAttrs = [].concat(commonAttrs, countryAttrs, phoneAttrs, labelTypeAttrs);
8555
-
8556
- const BaseInputClass$4 = createBaseInputClass({ componentName: componentName$D, baseSelector: 'div' });
8557
-
8558
- let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$4 {
8559
- static get observedAttributes() {
8560
- return [].concat(BaseInputClass$4.observedAttributes || [], inputRelatedAttrs);
8561
- }
8562
-
8563
- constructor() {
8564
- super();
8565
-
8566
- this.innerHTML = `
8567
- <div class="wrapper">
8568
- <descope-combo-box
8569
- item-label-path="data-name"
8570
- item-value-path="data-id"
8571
- >
8572
- ${CountryCodes.map((item) => comboBoxItem(item)).join('')}
8573
- </descope-combo-box>
8574
- <div class="separator"></div>
8575
- <descope-text-field type="tel"></descope-text-field>
8576
- </div>
8577
- `;
8578
-
8579
- this.countryCodeInput = this.querySelector('descope-combo-box');
8580
- this.phoneNumberInput = this.querySelector('descope-text-field');
8581
- this.inputs = [this.countryCodeInput, this.phoneNumberInput];
8582
-
8583
- forwardAttrs(this, this.countryCodeInput, { includeAttrs: ['label-type'] });
8584
- forwardAttrs(this, this.phoneNumberInput, { includeAttrs: ['label-type', 'required'] });
8585
-
8586
- // override combo box setter to display dialCode value in input
8587
- this.countryCodeInput.customValueTransformFn = (val) => {
8588
- const [, dialCode] = val?.split?.(' ') || [];
8589
- return dialCode;
8590
- };
8591
- }
8592
-
8593
- get countryCodeInputData() {
8594
- return this.countryCodeInput.items;
8595
- }
8596
-
8597
- get allowAlphanumericInput() {
8598
- return this.getAttribute('allow-alphanumeric-input') === 'true';
8599
- }
8600
-
8601
- get value() {
8602
- if (!this.phoneNumberValue) {
8603
- return '';
8604
- }
8605
- return `${this.countryCodeInput.value}-${this.phoneNumberInput.value}`;
8606
- }
8607
-
8608
- set value(val) {
8609
- const [countryCode, phoneNumber] = parsePhoneNumber(val);
8610
-
8611
- this.#setCountryCode(countryCode);
8612
- this.#setPhoneNumber(phoneNumber);
8613
- }
8614
-
8615
- setSelectionRange(...args) {
8616
- this.phoneNumberInput.setSelectionRange(...args);
8617
- }
8618
-
8619
- get selectionStart() {
8620
- return this.phoneNumberInput.selectionStart;
8621
- }
8622
-
8623
- #setCountryCode(val) {
8624
- if (val) {
8625
- const countryCodeItem = this.getCountryByDialCode(val);
8626
- if (countryCodeItem) {
8627
- this.countryCodeInput.selectedItem = countryCodeItem;
8628
- }
8629
- } else {
8630
- this.countryCodeInput.selectedItem = undefined;
8631
- }
8632
- }
8633
-
8634
- #setPhoneNumber(val) {
8635
- if (this.phoneNumberInput.value === val) {
8636
- return;
8637
- }
8638
-
8639
- this.phoneNumberInput.value = val;
8640
- }
8641
-
8642
- get phoneNumberValue() {
8643
- return this.phoneNumberInput.value;
8644
- }
8645
-
8646
- get countryCodeValue() {
8647
- return this.countryCodeInput.shadowRoot.querySelector('input').value;
8648
- }
8649
-
8650
- get phoneNumberInputEle() {
8651
- return this.phoneNumberInput.shadowRoot.querySelector('input');
8652
- }
8653
-
8654
- get minLength() {
8655
- return parseInt(this.getAttribute('minlength'), 10) || 0;
8656
- }
8657
-
8658
- getValidity() {
8659
- const hasCode = this.countryCodeInput.value;
8660
- const hasPhone = this.phoneNumberInput.value;
8661
- const emptyValue = !hasCode || !hasPhone;
8662
- const hasMinPhoneLength =
8663
- this.phoneNumberInput.value?.length && this.phoneNumberInput.value.length < this.minLength;
8664
-
8665
- if (this.isRequired && emptyValue) {
8666
- return { valueMissing: true };
8667
- }
8668
- if (hasMinPhoneLength) {
8669
- return { tooShort: true };
8670
- }
8671
- if (hasPhone && !hasCode) {
8672
- return { valueMissing: true };
8673
- }
8674
- return {};
8675
- }
8676
-
8677
- init() {
8678
- this.addEventListener('focus', (e) => {
8679
- // we want to ignore focus events we are dispatching
8680
- if (e.isTrusted) this.inputs[1].focus();
8681
- });
8682
-
8683
- super.init?.();
8684
- this.initInputs();
8685
- }
8686
-
8687
- getRestrictedCountries() {
8688
- const attr = this.getAttribute('restrict-countries');
8689
- return attr ? attr.split(',') : [];
8690
- }
8691
-
8692
- getCountryByDialCode(countryDialCode) {
8693
- return this.countryCodeInput.items?.find((c) => c.getAttribute('data-id') === countryDialCode);
8694
- }
8695
-
8696
- getCountryByCodeId(countryCode) {
8697
- return this.countryCodeInput.items?.find(
8698
- (c) => c.getAttribute('data-country-code') === countryCode
8699
- );
8700
- }
8701
-
8702
- updateCountryCodeItems(restrictCountries) {
8703
- const items = restrictCountries.length
8704
- ? CountryCodes.filter((c) => restrictCountries.includes(c.code))
8705
- : CountryCodes;
8706
- this.querySelector('descope-combo-box').innerHTML = items
8707
- .map((item) => comboBoxItem(item))
8708
- .join('');
8709
- }
8710
-
8711
- handleDefaultCountryCode(countryCode) {
8712
- if (!this.countryCodeInput.value) {
8713
- const countryCodeItem = this.getCountryByCodeId(countryCode);
8714
- // When replacing the input component (inserting internal component into text-field) -
8715
- // Vaadin resets the input's value. We use setTimeout in order to make sure this happens
8716
- // after the reset.
8717
- if (countryCodeItem) {
8718
- setTimeout(() => {
8719
- this.countryCodeInput.selectedItem = countryCodeItem;
8720
- });
8721
- }
8722
- }
8723
- }
8724
-
8725
- initInputs() {
8726
- // Sanitize phone input value to filter everything but digits
8727
- this.phoneNumberInput.addEventListener('input', (e) => {
8728
- if (!this.allowAlphanumericInput) {
8729
- const telDigitsRegExp = /^\d$/;
8730
- const sanitizedInput = e.target.value
8731
- .split('')
8732
- .filter((char) => telDigitsRegExp.test(char))
8733
- .join('');
8734
- e.target.value = sanitizedInput;
8735
- }
8736
- });
8737
-
8738
- this.handleFocusEventsDispatching(this.inputs);
8739
- this.handleInputEventDispatching();
8740
- }
8741
-
8742
- handleLabelTypeAttrs(attrName, newValue) {
8743
- // set or remove label attributes from inner text/combo components on `label-type` change
8744
- const attr = mapAttrs$1[attrName] || attrName;
8745
-
8746
- if (attrName === 'label-type') {
8747
- this.onLabelTypeChange(newValue);
8748
- }
8749
- // on inner components label attr change - set label attributes for text/combo components
8750
- // only if label-type is `floating`
8751
- else if (this.getAttribute('label-type') === 'floating') {
8752
- if (attrName === 'country-input-label') {
8753
- this.countryCodeInput.setAttribute(attr, newValue);
8754
- } else if (attrName === 'label') {
8755
- this.phoneNumberInput.setAttribute(attr, newValue);
8756
- }
8757
- }
8758
- }
8759
-
8760
- onLabelTypeChange(newValue) {
8761
- if (newValue === 'floating') {
8762
- // on change to `floating` label - set inner components `label` and `placeholder`
8763
- this.countryCodeInput.setAttribute('label', this.getAttribute('country-input-label') || '');
8764
- this.countryCodeInput.setAttribute(
8765
- 'placeholder',
8766
- this.getAttribute('country-input-placeholder') || ''
8767
- );
8768
- this.phoneNumberInput.setAttribute('label', this.getAttribute('label') || '');
8769
- this.phoneNumberInput.setAttribute(
8770
- 'placeholder',
8771
- this.getAttribute('phone-input-placeholder') || ''
8772
- );
8773
- } else {
8774
- // for other cases - reset inner components label-type and labels
8775
- this.inputs.forEach((input) => input.removeAttribute('label'));
8776
- }
8777
- }
8778
-
8779
- attributeChangedCallback(attrName, oldValue, newValue) {
8780
- super.attributeChangedCallback(attrName, oldValue, newValue);
8781
-
8782
- if (oldValue !== newValue) {
8783
- if (attrName === 'default-code' && newValue) {
8784
- this.handleDefaultCountryCode(newValue);
8785
- } else if (inputRelatedAttrs.includes(attrName)) {
8786
- const attr = mapAttrs$1[attrName] || attrName;
8787
-
8788
- if (commonAttrs.includes(attrName)) {
8789
- this.inputs.forEach((input) => input.setAttribute(attr, newValue));
8790
- } else if (countryAttrs.includes(attrName)) {
8791
- this.countryCodeInput.setAttribute(attr, newValue);
8792
- } else if (phoneAttrs.includes(attrName)) {
8793
- this.phoneNumberInput.setAttribute(attr, newValue);
8794
- }
8795
- }
8796
-
8797
- if (labelTypeAttrs.includes(attrName)) {
8798
- this.handleLabelTypeAttrs(attrName, newValue);
8799
- }
8800
-
8801
- if (attrName === 'restrict-countries') {
8802
- this.updateCountryCodeItems(this.getRestrictedCountries());
8803
- }
8804
- }
8805
- }
8806
- };
8489
+ createBaseInputClass({ componentName: componentName$D, baseSelector: 'div' });
8807
8490
 
8808
8491
  const textVars$2 = TextFieldClass.cssVarList;
8809
8492
  const comboVars = ComboBoxClass.cssVarList;
@@ -9147,176 +8830,9 @@ var phoneField$1 = /*#__PURE__*/Object.freeze({
9147
8830
  vars: vars$w
9148
8831
  });
9149
8832
 
9150
- const getCountryByCodeId = (countryCode) => {
9151
- return CountryCodes.find((c) => c.code === countryCode)?.dialCode;
9152
- };
9153
-
9154
8833
  const componentName$B = getComponentName('phone-field-internal-input-box');
9155
8834
 
9156
- const observedAttributes$2 = [
9157
- 'disabled',
9158
- 'size',
9159
- 'bordered',
9160
- 'invalid',
9161
- 'readonly',
9162
- 'phone-input-placeholder',
9163
- 'name',
9164
- 'autocomplete',
9165
- 'label-type',
9166
- 'allow-alphanumeric-input',
9167
- ];
9168
- const mapAttrs = {
9169
- 'phone-input-placeholder': 'placeholder',
9170
- };
9171
-
9172
- const BaseInputClass$3 = createBaseInputClass({ componentName: componentName$B, baseSelector: 'div' });
9173
-
9174
- class PhoneFieldInternal extends BaseInputClass$3 {
9175
- static get observedAttributes() {
9176
- return [].concat(BaseInputClass$3.observedAttributes || [], observedAttributes$2);
9177
- }
9178
-
9179
- constructor() {
9180
- super();
9181
-
9182
- this.innerHTML = `
9183
- <div>
9184
- <descope-text-field tabindex="1"></descope-text-field>
9185
- </div>
9186
- `;
9187
-
9188
- this.phoneNumberInput = this.querySelector('descope-text-field');
9189
- }
9190
-
9191
- get defaultCountryCode() {
9192
- return getCountryByCodeId(this.getAttribute('default-code'));
9193
- }
9194
-
9195
- get hasDefaultCode() {
9196
- return !!this.getAttribute('default-code');
9197
- }
9198
-
9199
- get allowAlphanumericInput() {
9200
- return this.getAttribute('allow-alphanumeric-input') === 'true';
9201
- }
9202
-
9203
- get value() {
9204
- if (!this.phoneNumberValue) {
9205
- return '';
9206
- }
9207
-
9208
- if (this.hasDefaultCode) {
9209
- // we want to transform phone numbers to a valid {dialCode}-{phoneNumber} format
9210
- // e.g.:
9211
- // +972-12345 => +972-12345
9212
- // 972-12345 => +972-12345
9213
- // 12345 => +972-12345
9214
- //
9215
- // we also want to handle any extra dash if added in the start of the phone number
9216
- // e.g.:
9217
- // +972--12345 => +972-12345
9218
- const pattern = new RegExp(`\\+?${parseInt(this.defaultCountryCode, 10)}--?`);
9219
- return `${this.defaultCountryCode}-${this.phoneNumberInput.value.replace(pattern, '')}`;
9220
- }
9221
-
9222
- return this.phoneNumberInput.value;
9223
- }
9224
-
9225
- set value(val) {
9226
- this.phoneNumberInput.value = val;
9227
- }
9228
-
9229
- get phoneNumberValue() {
9230
- return this.phoneNumberInput.value;
9231
- }
9232
-
9233
- get phoneNumberInputEle() {
9234
- return this.phoneNumberInput.shadowRoot.querySelector('input');
9235
- }
9236
-
9237
- get minLength() {
9238
- return parseInt(this.getAttribute('minlength'), 10) || 0;
9239
- }
9240
-
9241
- get maxLength() {
9242
- return parseInt(this.getAttribute('maxlength'), 10) || 50;
9243
- }
9244
-
9245
- getValidity() {
9246
- const validPhonePattern = /^\+?\d{1,4}-?(?:\d-?){1,15}$/;
9247
- const stripValue = this.value.replace(/\D/g, '');
9248
-
9249
- if (this.isRequired && !this.value) {
9250
- return { valueMissing: true };
9251
- }
9252
-
9253
- if (stripValue.length < this.minLength) {
9254
- return { tooShort: true };
9255
- }
9256
-
9257
- if (stripValue.length > this.maxLength) {
9258
- return { tooLong: true };
9259
- }
9260
-
9261
- if (!validPhonePattern.test(this.value)) {
9262
- return { patternMismatch: true };
9263
- }
9264
-
9265
- return {};
9266
- }
9267
-
9268
- init() {
9269
- this.addEventListener('focus', (e) => {
9270
- // we want to ignore focus events we are dispatching
9271
- if (e.isTrusted) this.phoneNumberInput.focus();
9272
- });
9273
-
9274
- super.init?.();
9275
- this.initInputs();
9276
- }
9277
-
9278
- getCountryByDialCode(countryDialCode) {
9279
- return this.countryCodeInput.items?.find(
9280
- (c) => c.getAttribute('data-country-code') === countryDialCode
9281
- );
9282
- }
9283
-
9284
- initInputs() {
9285
- // Sanitize phone input value to filter everything but digits
9286
- this.phoneNumberInput.addEventListener('input', (e) => {
9287
- if (e.target.value.length === 1 && e.target.value === '-') {
9288
- e.target.value = '';
9289
- }
9290
-
9291
- e.target.value = e.target.value
9292
- .replace(/(?!^)\+/g, '')
9293
- .replace('--', '-')
9294
- .replace('+-', '+');
9295
-
9296
- let sanitizedInput = e.target.value;
9297
- if (!this.allowAlphanumericInput) {
9298
- const telDigitsRegExp = /^[+\d-]+$/;
9299
- sanitizedInput = e.target.value
9300
- .split('')
9301
- .filter((char) => telDigitsRegExp.test(char))
9302
- .join('');
9303
- }
9304
-
9305
- e.target.value = sanitizedInput;
9306
- });
9307
-
9308
- this.handleFocusEventsDispatching([this.phoneNumberInput]);
9309
- }
9310
-
9311
- attributeChangedCallback(attrName, oldValue, newValue) {
9312
- super.attributeChangedCallback(attrName, oldValue, newValue);
9313
-
9314
- if (oldValue !== newValue && observedAttributes$2.includes(attrName)) {
9315
- const attr = mapAttrs[attrName] || attrName;
9316
- this.phoneNumberInput.setAttribute(attr, newValue);
9317
- }
9318
- }
9319
- }
8835
+ createBaseInputClass({ componentName: componentName$B, baseSelector: 'div' });
9320
8836
 
9321
8837
  const textVars$1 = TextFieldClass.cssVarList;
9322
8838
 
@@ -17643,18 +17159,6 @@ const isNumericValue = (val) => NUMERIC_RE.test(val.replaceAll('+', '').replaceA
17643
17159
 
17644
17160
  const sanitizeCountryCodePrefix = (val) => val.replace(/\+\d+-/, '');
17645
17161
 
17646
- customElements.define(componentName$F, ComboBoxClass);
17647
-
17648
- customElements.define(componentName$_, TextFieldClass);
17649
-
17650
- customElements.define(componentName$D, PhoneFieldInternal$1);
17651
-
17652
- customElements.define(componentName$C, PhoneFieldClass);
17653
-
17654
- customElements.define(componentName$B, PhoneFieldInternal);
17655
-
17656
- customElements.define(componentName$A, PhoneFieldInputBoxClass);
17657
-
17658
17162
  const componentName$2 = getComponentName('hybrid-field');
17659
17163
 
17660
17164
  const attrs = {