@roadtrip/components 3.11.2 → 3.12.0

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 (85) hide show
  1. package/dist/cjs/index-12592729.js +4 -4
  2. package/dist/cjs/index-fb57f684.js.map +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/road-phone-number-input.cjs.entry.js +114 -155
  5. package/dist/cjs/road-phone-number-input.cjs.entry.js.map +1 -1
  6. package/dist/cjs/road-progress-indicator-horizontal.cjs.entry.js +3 -2
  7. package/dist/cjs/road-progress-indicator-horizontal.cjs.entry.js.map +1 -1
  8. package/dist/cjs/road-rating.cjs.entry.js +5 -2
  9. package/dist/cjs/road-rating.cjs.entry.js.map +1 -1
  10. package/dist/cjs/road-select.cjs.entry.js +17 -0
  11. package/dist/cjs/road-select.cjs.entry.js.map +1 -1
  12. package/dist/cjs/roadtrip.cjs.js +1 -1
  13. package/dist/collection/components/global-navigation/global-navigation.stories.js +2 -1
  14. package/dist/collection/components/icon/svg/location-pin-outline-color.svg +1 -1
  15. package/dist/collection/components/icon/svg/social-whatsapp-badge.svg +1 -1
  16. package/dist/collection/components/icon/svg/social-whatsapp-color.svg +1 -1
  17. package/dist/collection/components/icon/svg/social-whatsapp-solid.svg +1 -1
  18. package/dist/collection/components/phone-number-input/interfaces/country.interface.js +2 -0
  19. package/dist/collection/components/phone-number-input/interfaces/country.interface.js.map +1 -0
  20. package/dist/collection/components/phone-number-input/interfaces/index.js +3 -0
  21. package/dist/collection/components/phone-number-input/interfaces/index.js.map +1 -0
  22. package/dist/collection/components/phone-number-input/interfaces/phone.interface.js +2 -0
  23. package/dist/collection/components/phone-number-input/interfaces/phone.interface.js.map +1 -0
  24. package/dist/collection/components/phone-number-input/phone-number-input.css +200 -1
  25. package/dist/collection/components/phone-number-input/phone-number-input.js +171 -229
  26. package/dist/collection/components/phone-number-input/phone-number-input.js.map +1 -1
  27. package/dist/collection/components/phone-number-input/phone-number-input.stories.js +30 -28
  28. package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.js +21 -2
  29. package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.js.map +1 -1
  30. package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.stories.js +12 -5
  31. package/dist/collection/components/rating/rating.css +4 -0
  32. package/dist/collection/components/rating/rating.js +40 -1
  33. package/dist/collection/components/rating/rating.js.map +1 -1
  34. package/dist/collection/components/rating/rating.stories.js +17 -0
  35. package/dist/collection/components/select/select.js +18 -1
  36. package/dist/collection/components/select/select.js.map +1 -1
  37. package/dist/collection/components/select/select.stories.js +2 -2
  38. package/dist/esm/index-52302079.js +4 -4
  39. package/dist/esm/index-891decf5.js.map +1 -1
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/road-phone-number-input.entry.js +114 -155
  42. package/dist/esm/road-phone-number-input.entry.js.map +1 -1
  43. package/dist/esm/road-progress-indicator-horizontal.entry.js +3 -2
  44. package/dist/esm/road-progress-indicator-horizontal.entry.js.map +1 -1
  45. package/dist/esm/road-rating.entry.js +5 -2
  46. package/dist/esm/road-rating.entry.js.map +1 -1
  47. package/dist/esm/road-select.entry.js +17 -0
  48. package/dist/esm/road-select.entry.js.map +1 -1
  49. package/dist/esm/roadtrip.js +1 -1
  50. package/dist/html.html-data.json +28 -12
  51. package/dist/icons/icons.svg +1 -1
  52. package/dist/icons/index.js +4 -4
  53. package/dist/roadtrip/{p-4f5e8cc2.entry.js → p-254ba3c4.entry.js} +2 -2
  54. package/dist/roadtrip/p-254ba3c4.entry.js.map +1 -0
  55. package/dist/roadtrip/p-73fe2357.js.map +1 -1
  56. package/dist/roadtrip/{p-995e1e53.entry.js → p-9173eb4b.entry.js} +2 -2
  57. package/dist/roadtrip/p-9173eb4b.entry.js.map +1 -0
  58. package/dist/roadtrip/{p-a2a9a650.entry.js → p-be8aee32.entry.js} +2 -2
  59. package/dist/roadtrip/p-be8aee32.entry.js.map +1 -0
  60. package/dist/roadtrip/p-cbc00bfb.entry.js +2 -0
  61. package/dist/roadtrip/p-cbc00bfb.entry.js.map +1 -0
  62. package/dist/roadtrip/roadtrip.css +1 -1
  63. package/dist/roadtrip/roadtrip.esm.js +1 -1
  64. package/dist/roadtrip/roadtrip.esm.js.map +1 -1
  65. package/dist/roadtrip/svg/location-pin-outline-color.svg +1 -1
  66. package/dist/roadtrip/svg/social-whatsapp-badge.svg +1 -1
  67. package/dist/roadtrip/svg/social-whatsapp-color.svg +1 -1
  68. package/dist/roadtrip/svg/social-whatsapp-solid.svg +1 -1
  69. package/dist/types/components/phone-number-input/interfaces/country.interface.d.ts +13 -0
  70. package/dist/types/components/phone-number-input/interfaces/index.d.ts +2 -0
  71. package/dist/types/components/phone-number-input/interfaces/phone.interface.d.ts +11 -0
  72. package/dist/types/components/phone-number-input/phone-number-input.d.ts +41 -75
  73. package/dist/types/components/progress-indicator-horizontal/progress-indicator-horizontal.d.ts +4 -0
  74. package/dist/types/components/rating/rating.d.ts +8 -0
  75. package/dist/types/components/select/select.d.ts +2 -0
  76. package/dist/types/components.d.ts +75 -44
  77. package/hydrate/index.js +155 -170
  78. package/icons/icons.svg +1 -1
  79. package/icons/index.js +4 -4
  80. package/package.json +2 -2
  81. package/dist/roadtrip/p-39d1c90a.entry.js +0 -2
  82. package/dist/roadtrip/p-39d1c90a.entry.js.map +0 -1
  83. package/dist/roadtrip/p-4f5e8cc2.entry.js.map +0 -1
  84. package/dist/roadtrip/p-995e1e53.entry.js.map +0 -1
  85. package/dist/roadtrip/p-a2a9a650.entry.js.map +0 -1
package/hydrate/index.js CHANGED
@@ -15399,7 +15399,7 @@ class Range {
15399
15399
  }
15400
15400
  let rangeIds = 0;
15401
15401
 
15402
- const ratingCss = "/*!@:host*/.sc-road-rating-h{display:flex;align-items:center}/*!@.rating-stars*/.rating-stars.sc-road-rating{display:inline-flex;flex-shrink:0}/*!@.rating-star*/.rating-star.sc-road-rating{color:var(--road-surface-disabled)}/*!@.rating-stars.rating-stars--small .icon-sm*/.rating-stars.rating-stars--small.sc-road-rating .icon-sm.sc-road-rating{width:1rem;height:1rem}/*!@.rating-number*/.rating-number.sc-road-rating{margin-left:0.5rem;font-size:var(--road-link-medium);color:var(--road-on-surface);text-decoration:underline}/*!@.rating-number.rating-number--small*/.rating-number.rating-number--small.sc-road-rating{font-size:var(--road-link-small)}";
15402
+ const ratingCss = "/*!@:host*/.sc-road-rating-h{display:flex;align-items:center}/*!@.rating-stars*/.rating-stars.sc-road-rating{display:inline-flex;flex-shrink:0}/*!@.rating-star*/.rating-star.sc-road-rating{color:var(--road-surface-disabled)}/*!@.rating-stars.rating-stars--small .icon-sm*/.rating-stars.rating-stars--small.sc-road-rating .icon-sm.sc-road-rating{width:1rem;height:1rem}/*!@.rating-number*/.rating-number.sc-road-rating{margin-left:0.5rem;font-size:var(--road-link-medium);color:var(--road-on-surface);text-decoration:underline}/*!@.rating-number.rating-number--small*/.rating-number.rating-number--small.sc-road-rating{font-size:var(--road-link-small)}/*!@.rating-number.readonly*/.rating-number.readonly.sc-road-rating{text-decoration:none}";
15403
15403
 
15404
15404
  class Rating {
15405
15405
  constructor(hostRef) {
@@ -15407,15 +15407,18 @@ class Rating {
15407
15407
  this.size = 'medium';
15408
15408
  this.rate = 0;
15409
15409
  this.showreviews = true;
15410
+ this.readonly = false;
15410
15411
  this.reviews = 0;
15411
15412
  this.reviewsText = 'reviews';
15413
+ this.url = '#';
15412
15414
  }
15413
15415
  render() {
15414
15416
  const rate = Math.floor(this.rate);
15415
15417
  const rateDecimale = this.rate - Math.floor(this.rate) > 0 ? 1 : 0;
15416
15418
  const sizeRatingStarsClass = this.size !== undefined ? `rating-stars rating-stars--${this.size}` : 'rating-stars';
15417
15419
  const sizeRatingNumberClass = this.size !== undefined ? `rating-number rating-number--${this.size}` : 'rating-number';
15418
- return (hAsync(Host, null, hAsync("div", { class: `${sizeRatingStarsClass}` }, [...Array(rate)].map(() => hAsync("road-icon", { icon: star, size: "sm", color: "warning" })), [...Array(rateDecimale)].map(() => hAsync("road-icon", { icon: starHalfColor, size: "sm", class: "rating-star" })), [...Array(5 - rate - rateDecimale)].map(() => hAsync("road-icon", { icon: star, size: "sm", class: "rating-star" }))), this.showreviews && hAsync("a", { class: `${sizeRatingNumberClass}`, href: "#" }, "(", this.reviews, this.reviewsText && ` ${this.reviewsText}`, ")")));
15420
+ const readOnly = this.readonly == true ? `readonly` : '';
15421
+ return (hAsync(Host, null, hAsync("div", { class: `${sizeRatingStarsClass}` }, [...Array(rate)].map(() => hAsync("road-icon", { icon: star, size: "sm", color: "warning" })), [...Array(rateDecimale)].map(() => hAsync("road-icon", { icon: starHalfColor, size: "sm", class: "rating-star" })), [...Array(5 - rate - rateDecimale)].map(() => hAsync("road-icon", { icon: star, size: "sm", class: "rating-star" }))), this.readonly == false && this.showreviews && hAsync("a", { class: `${sizeRatingNumberClass}`, href: this.url }, "(", this.reviews, this.reviewsText && ` ${this.reviewsText}`, ")"), this.readonly == true && this.showreviews && hAsync("road-label", { class: `${sizeRatingNumberClass} ${readOnly}` }, "(", this.reviews, this.reviewsText && ` ${this.reviewsText}`, ")")));
15419
15422
  }
15420
15423
  static get style() { return ratingCss; }
15421
15424
  static get cmpMeta() { return {
@@ -15425,8 +15428,10 @@ class Rating {
15425
15428
  "size": [513],
15426
15429
  "rate": [2],
15427
15430
  "showreviews": [4],
15431
+ "readonly": [4],
15428
15432
  "reviews": [2],
15429
- "reviewsText": [1, "reviews-text"]
15433
+ "reviewsText": [1, "reviews-text"],
15434
+ "url": [1]
15430
15435
  },
15431
15436
  "$listeners$": undefined,
15432
15437
  "$lazyBundleId$": "-",
@@ -15460,7 +15465,7 @@ class RoadAreaCode {
15460
15465
  this.roadfocus.emit();
15461
15466
  this.roadFocus.emit();
15462
15467
  };
15463
- this.selectId = `road-select-${selectIds$1++}`;
15468
+ this.selectId = `road-select-${selectIds$2++}`;
15464
15469
  this.selectedValue = '';
15465
15470
  this.options = [];
15466
15471
  this.autofocus = false;
@@ -15528,7 +15533,7 @@ class RoadAreaCode {
15528
15533
  "$attrsToReflect$": []
15529
15534
  }; }
15530
15535
  }
15531
- let selectIds$1 = 0;
15536
+ let selectIds$2 = 0;
15532
15537
 
15533
15538
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
15534
15539
 
@@ -16738,174 +16743,143 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.inputDigitHelper_=function(a){var
16738
16743
  });
16739
16744
  });
16740
16745
 
16741
- const phoneNumberInputCss = ".sc-road-phone-number-input-h #phone-number.sc-road-phone-number-input .invalid-feedback.sc-road-input.sc-road-phone-number-input{margin-left:-4.5rem}.is-invalid.sc-road-phone-number-input .form-control.sc-road-input.sc-road-phone-number-input{border-color:var(--road-danger-outline)}";
16746
+ const phoneNumberInputCss = ".sc-road-phone-number-input-h #phone-number.sc-road-phone-number-input .invalid-feedback.sc-road-input.sc-road-phone-number-input{margin-left:-4.5rem}.is-invalid.sc-road-phone-number-input .form-control.sc-road-input.sc-road-phone-number-input{border-color:var(--road-danger-outline)}.road-phone-input-select.sc-road-phone-number-input{position:relative;display:block;margin-bottom:1rem;font-family:var(--road-font, sans-serif);color:var(--road-on-surface);background-color:var(--road-surface);border:1px solid var(--road-input-outline);border-radius:0.25rem;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:5rem;height:3.5rem}.sc-road-phone-number-input-h .is-error.sc-road-phone-number-input{border-color:var(--road-danger-outline)}.form-select-area.sc-road-phone-number-input{box-sizing:border-box;display:block;width:100%;height:3rem;padding:0.75rem 3rem 0 1rem;margin:0;font-size:var(--road-body-medium);line-height:1.5;color:var(--road-on-surface);background:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0icmdiYSgyMywgMzAsIDUyLCAwLjcyKSI+PHBhdGggZD0iTTIzIDI2bDkgMTIgOS0xMnoiLz48L3N2Zz4=\") no-repeat right 1rem center/1.5rem 2rem;position:absolute;top:0;left:0;height:100%;width:100%;z-index:1;border:0;opacity:0;cursor:pointer}.form-select-area.sc-road-phone-number-input:-moz-focusring{color:transparent;text-shadow:0 0 0 #000000}.form-select-area.sc-road-phone-number-input::-ms-expand{display:none}.form-select-area.sc-road-phone-number-input::placeholder{color:var(--road-on-surface-extra-weak)}@media (hover: hover){.form-select-area.sc-road-phone-number-input:not(:disabled):hover{border-color:var(--road-input-outline-variant)}}.form-select-area.sc-road-phone-number-input:focus~.form-select-area-label.sc-road-phone-number-input,.form-select-area[required].sc-road-phone-number-input:valid~.form-select-area-label.sc-road-phone-number-input,.form-select-area.has-value.sc-road-phone-number-input~.form-select-area-label.sc-road-phone-number-input{transform:scale(0.625) translateY(-0.625rem)}.form-select-area.sc-road-phone-number-input:not(:disabled):focus{border-color:var(--road-input-outline-variant);outline:0}.form-select-area.sc-road-phone-number-input:disabled,.form-select-area[readonly].sc-road-phone-number-input{color:var(--road-on-surface-disabled);cursor:not-allowed;background-color:var(--road-surface-disabled);opacity:1}.form-select-area-label.sc-road-phone-number-input{position:absolute;top:0.9rem;left:1rem;display:block;font-size:var(--road-font-size-18);line-height:1.5;color:var(--road-on-surface-extra-weak);pointer-events:none;transition:transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;transform-origin:0 0}.form-select-area.sc-road-phone-number-input:required~.form-select-area-label.sc-road-phone-number-input::after{color:var(--road-on-danger-surface);content:\" *\"}.form-select-area-value.sc-road-phone-number-input{position:absolute;top:1.4rem;left:1rem;display:block;font-size:var(--road-label-medium);line-height:1.5;color:var(--road-on-surface);pointer-events:none;transition:transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;transform-origin:0 0}.select-xl.sc-road-phone-number-input-h .form-select-area.sc-road-phone-number-input{height:3.5rem;padding:0.75rem 0 0 1rem}.select-xl.sc-road-phone-number-input-h .form-select-area-label.sc-road-phone-number-input{top:1rem}.select-xl.sc-road-phone-number-input-h .form-select-area.sc-road-phone-number-input:focus~.form-select-area-label.sc-road-phone-number-input,.select-xl.sc-road-phone-number-input-h .form-select-area[required].sc-road-phone-number-input:valid~.form-select-area-label.sc-road-phone-number-input,.select-xl.sc-road-phone-number-input-h .form-select-area.has-value.sc-road-phone-number-input~.form-select-area-label.sc-road-phone-number-input,.select-xl.sc-road-phone-number-input-h .form-select-area[type=\"date\"].sc-road-phone-number-input~.form-select-area-label.sc-road-phone-number-input,.select-xl.sc-road-phone-number-input-h .form-select-area[type=\"time\"].sc-road-phone-number-input~.form-select-area-label.sc-road-phone-number-input{transform:scale(0.75) translateY(-0.625rem)}.select-xl.sc-road-phone-number-input-h .form-select-area.sc-road-phone-number-input:placeholder-shown~.form-select-area-label.sc-road-phone-number-input{transform:scale(0.75) translateY(-0.625rem)}.invalid-feedback.sc-road-phone-number-input{display:none;width:100%;margin-top:0.5rem;font-size:var(--road-body-small);color:var(--road-on-danger-surface)}.form-select-area.is-invalid.sc-road-phone-number-input,.was-validated.sc-road-phone-number-input .form-select-area.sc-road-phone-number-input:invalid{border-color:var(--road-on-danger-surface)}.form-select-area.is-invalid.sc-road-phone-number-input~.invalid-feedback.sc-road-phone-number-input,.was-validated.sc-road-phone-number-input .form-select-area.sc-road-phone-number-input:invalid~.invalid-feedback.sc-road-phone-number-input{display:block}.form-select-area.sc-road-phone-number-input option.sc-road-phone-number-input:checked::after{position:absolute;top:0;left:0;content:attr(data-content)}.form-select-area.sc-road-phone-number-input::after{position:absolute;top:0;left:0;content:var(--selected-content, '')}";
16742
16747
 
16748
+ let selectIds$1 = 0;
16743
16749
  class RoadPhoneNumberInput {
16744
16750
  constructor(hostRef) {
16745
16751
  registerInstance(this, hostRef);
16746
16752
  this.roadPhoneNumberInput = createEvent(this, "roadPhoneNumberInput", 7);
16747
- this.roadselected = createEvent(this, "roadselected", 7);
16748
- this.roadSelected = createEvent(this, "roadSelected", 7);
16753
+ this.disabled = false;
16749
16754
  this.countryData = [];
16750
16755
  this.language = 'fr';
16751
- this.areaLabel = 'Country';
16752
- this.areaValue = '';
16753
- this.inputLabel = 'Number';
16754
- this.inputValue = '';
16755
- this.numberType = undefined;
16756
+ this.codeLabel = '';
16757
+ this.phoneLabel = '';
16758
+ this.phoneValue = undefined;
16759
+ this.countryCode = undefined;
16760
+ this.errorMessage = '';
16756
16761
  this.required = false;
16757
- this.selectedCountry = '';
16762
+ this.selectedCountry = this.countryData[0].countryCode;
16763
+ this.selectedCountryCode = this.countryData[0].phoneCode;
16758
16764
  this.phoneNumber = '';
16759
- this.inputError = '';
16760
16765
  this.countryOptions = [];
16766
+ this.returnObject = {
16767
+ isError: false,
16768
+ phone: this.resetPhoneUtilData(),
16769
+ };
16761
16770
  }
16762
- languageChanged() {
16763
- this.updateCountryOptions();
16764
- }
16765
- updateCountryOptions() {
16766
- const validLanguage = this.language && this.countryData[0].translations[this.language] ? this.language : 'fr';
16767
- this.countryOptions = this.countryData.map(country => {
16768
- return {
16769
- value: country.phoneCode,
16770
- label: `${country.translations[validLanguage]} (+${country.phoneCode})`,
16771
- selected: country.countryCode === this.selectedCountry, // Ici, nous marquons l'option par défaut comme sélectionnée
16772
- };
16773
- });
16771
+ updateMessagePosition() {
16772
+ this.placeErrorMessage();
16774
16773
  }
16774
+ // On component load
16775
16775
  componentWillLoad() {
16776
- if (this.numberType && this.numberType !== 'FIXED_LINE' && this.numberType !== 'MOBILE') {
16777
- this.numberType = '';
16778
- }
16779
- if (this.areaValue) {
16780
- this.selectedCountry = this.getPhoneCountryCode(this.areaValue);
16776
+ var _a;
16777
+ this.placeErrorMessage();
16778
+ let fromSelect = false;
16779
+ if (this.phoneValue) {
16780
+ this.phoneNumber = this.phoneValue;
16781
16781
  }
16782
- else {
16783
- if (this.countryData && this.countryData.length > 0) {
16784
- this.selectedCountry = this.countryData[0].countryCode;
16785
- }
16786
- }
16787
- if (this.inputValue) {
16788
- // this.phoneNumber = this.inputValue;
16789
- // function recupererCaracteres(s: string ) {
16790
- // if (s.substring(0, 2) === "00") {
16791
- // return s.substring(2, 4);
16792
- // } else {
16793
- // return null;
16794
- // }
16795
- // }
16796
- // const chaine = this.inputValue;
16797
- // const resultat = recupererCaracteres(chaine);
16798
- // this.areaValue = resultat as string;
16799
- // this.selectedCountry = this.getPhoneCountryCode(this.areaValue);
16800
- this.handleInput({
16801
- detail: {
16802
- value: this.inputValue,
16803
- },
16804
- });
16782
+ if (this.countryCode) {
16783
+ this.selectedCountry = this.countryCode;
16784
+ this.updateSelectedCountryCode((_a = this.getPhoneCodeFromCountryCode(this.countryCode)) !== null && _a !== void 0 ? _a : '');
16785
+ fromSelect = true;
16805
16786
  }
16806
16787
  this.updateCountryOptions();
16788
+ this.createAndDispatchPhoneData(fromSelect);
16807
16789
  }
16808
- getPhoneCountryCode(phoneCode) {
16809
- var _a, _b;
16810
- return (_b = (_a = this.countryData.find((country) => country.phoneCode === phoneCode)) === null || _a === void 0 ? void 0 : _a.countryCode) !== null && _b !== void 0 ? _b : '';
16790
+ // On user input
16791
+ handleInput(event) {
16792
+ this.phoneNumber = event.detail.value;
16793
+ this.createAndDispatchPhoneData();
16811
16794
  }
16795
+ // On user select
16812
16796
  handleSelect(event) {
16813
- const receivedPhoneCode = event.detail.value.replace('+', '');
16814
- const phoneCountryCode = this.getPhoneCountryCode(receivedPhoneCode);
16815
- this.selectedCountry = phoneCountryCode;
16816
- this.createReturnObject();
16817
- }
16818
- createReturnObject() {
16819
- var _a, _b, _c, _d;
16820
- const returnObject = {
16821
- isError: true,
16822
- phone: {
16823
- phoneNumberType: 'UNKNOWN',
16824
- countryCode: this.selectedCountry,
16825
- nationalNumber: this.phoneNumber,
16826
- phoneCode: (_b = (_a = this.countryData.find((country) => country.countryCode === this.selectedCountry)) === null || _a === void 0 ? void 0 : _a.phoneCode) !== null && _b !== void 0 ? _b : '',
16827
- internationalNumber: this.phoneNumber,
16828
- },
16829
- };
16830
- // create instance
16797
+ const select = event.target;
16798
+ if (select) {
16799
+ this.updateSelectedCountry(select.value);
16800
+ this.updateSelectedCountryCode(this.getPhoneCodeFromCountryCode(this.selectedCountry));
16801
+ }
16802
+ this.createAndDispatchPhoneData(true);
16803
+ this.updateCountryOptions();
16804
+ }
16805
+ createAndDispatchPhoneData(fromSelect) {
16806
+ // Init phone util
16831
16807
  const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance();
16832
16808
  const PNF = libphonenumber.PhoneNumberFormat;
16833
- // Parse and verify the phone number
16809
+ // Reset the return object data
16810
+ this.returnObject.phone = this.resetPhoneUtilData();
16811
+ const tmpCountry = this.selectedCountry.length ? this.selectedCountry : this.countryData[0].countryCode;
16834
16812
  try {
16835
- const parsedPhoneNumber = phoneUtil.parse(this.phoneNumber, this.selectedCountry);
16836
- const phoneCode = parsedPhoneNumber.getCountryCode();
16837
- // get the phone's country code and updates the areaValue
16813
+ const parsedPhoneNumber = phoneUtil.parse(this.phoneNumber, tmpCountry);
16814
+ this.returnObject.isError = !phoneUtil.isValidNumber(parsedPhoneNumber) && !this.isEmptyPhoneNumber();
16815
+ this.returnObject.phone.nationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.NATIONAL);
16816
+ this.returnObject.phone.internationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.INTERNATIONAL);
16817
+ // Set the country code values depending on the event origin
16838
16818
  if (phoneUtil.getRegionCodeForNumber(parsedPhoneNumber)) {
16839
- this.selectedCountry = phoneUtil.getRegionCodeForNumber(parsedPhoneNumber);
16840
- const computedPhoneCode = (_d = (_c = this.countryData.find(country => country.countryCode == this.selectedCountry)) === null || _c === void 0 ? void 0 : _c.phoneCode) !== null && _d !== void 0 ? _d : '';
16841
- this.areaValue = computedPhoneCode;
16842
- }
16843
- const errorTranslation = {
16844
- fixed: {
16845
- fr: 'N° de fixe attendu',
16846
- en: 'Expected landline number',
16847
- es: 'Número de teléfono fijo esperado',
16848
- pt: 'Número de telefone fixo esperado',
16849
- nl: 'Verwacht vast nummer',
16850
- de: 'Erwartete Festnetznummer',
16851
- it: 'Numero di rete fissa previsto',
16852
- },
16853
- mobile: {
16854
- fr: 'N° de mobile attendu',
16855
- en: 'Expected mobile number',
16856
- es: 'Número de móvil esperado',
16857
- pt: 'Número de celular esperado',
16858
- nl: 'Verwacht mobiel nummer',
16859
- de: 'Erwartete Handynummer',
16860
- it: 'Numero di cellulare previsto',
16861
- },
16862
- default: {
16863
- fr: 'Numéro de téléphone non valide',
16864
- en: 'Invalid phone number',
16865
- es: 'Numero de telefono invalido',
16866
- pt: 'Número de telefone inválido',
16867
- nl: 'Ongeldig telefoonnummer',
16868
- de: 'Ungültige Telefonnummer',
16869
- it: 'Numero di telefono invalido',
16870
- },
16871
- };
16872
- if (parsedPhoneNumber && phoneUtil.isValidNumber(parsedPhoneNumber)) {
16873
- this.setAndPlaceErrorMessage('');
16874
- const phoneType = Object.entries(libphonenumber.PhoneNumberType).find(entry => entry[1] === phoneUtil.getNumberType(parsedPhoneNumber));
16875
- returnObject.isError = false;
16876
- returnObject.phone = {
16877
- phoneNumberType: phoneType[0],
16878
- countryCode: phoneUtil.getRegionCodeForNumber(parsedPhoneNumber),
16879
- phoneCode,
16880
- nationalNumber: phoneUtil.format(parsedPhoneNumber, PNF.NATIONAL),
16881
- internationalNumber: phoneUtil.format(parsedPhoneNumber, PNF.E164),
16882
- };
16883
- if (phoneType[0] !== this.numberType) {
16884
- switch (this.numberType) {
16885
- case 'FIXED_LINE':
16886
- this.setAndPlaceErrorMessage(errorTranslation.fixed[this.language]);
16887
- break;
16888
- case 'MOBILE':
16889
- this.setAndPlaceErrorMessage(errorTranslation.mobile[this.language]);
16890
- break;
16891
- default:
16892
- this.setAndPlaceErrorMessage('');
16893
- }
16819
+ if (fromSelect) {
16820
+ this.returnObject.isError = !(phoneUtil.isValidNumber(parsedPhoneNumber) &&
16821
+ phoneUtil.isValidNumberForRegion(parsedPhoneNumber, this.selectedCountry) &&
16822
+ !this.isEmptyPhoneNumber());
16894
16823
  }
16824
+ else {
16825
+ this.updateSelectedCountryCode(parsedPhoneNumber.getCountryCode().toString());
16826
+ this.updateSelectedCountry(phoneUtil.getRegionCodeForNumber(parsedPhoneNumber));
16827
+ this.returnObject.phone.countryCode = this.selectedCountry;
16828
+ this.returnObject.phone.code = this.selectedCountryCode;
16829
+ }
16830
+ this.updateCountryOptions();
16895
16831
  }
16896
- else {
16897
- this.setAndPlaceErrorMessage(errorTranslation.default[this.language]);
16898
- }
16832
+ const phoneType = Object.entries(libphonenumber.PhoneNumberType).find(entry => entry[1] === phoneUtil.getNumberType(parsedPhoneNumber));
16833
+ this.returnObject.phone.numberType = phoneType[0];
16899
16834
  }
16900
- catch (_e) { }
16835
+ catch (_a) { }
16901
16836
  finally {
16902
- this.roadPhoneNumberInput.emit(returnObject);
16903
- // console.log(returnObject.phone.phoneCode);
16904
- // returnObject.phone.phoneCode = '';
16837
+ this.roadPhoneNumberInput.emit(this.returnObject);
16905
16838
  }
16906
16839
  }
16907
- setAndPlaceErrorMessage(message) {
16908
- this.inputError = message;
16840
+ // utils
16841
+ updateSelectedCountryCode(countryCode) {
16842
+ this.selectedCountryCode = countryCode;
16843
+ }
16844
+ updateSelectedCountry(value) {
16845
+ this.selectedCountry = value;
16846
+ }
16847
+ resetPhoneUtilData() {
16848
+ return {
16849
+ numberType: 'UNKNOWN',
16850
+ countryCode: this.selectedCountry,
16851
+ code: this.selectedCountryCode,
16852
+ nationalNumber: this.phoneNumber,
16853
+ internationalNumber: this.phoneNumber,
16854
+ };
16855
+ }
16856
+ isEmptyPhoneNumber() {
16857
+ return !this.phoneNumber.length;
16858
+ }
16859
+ getPhoneCodeFromCountryCode(countryCode) {
16860
+ var _a;
16861
+ return (_a = this.countryData.find(country => country.countryCode === countryCode)) === null || _a === void 0 ? void 0 : _a.phoneCode;
16862
+ }
16863
+ updateCountryOptions() {
16864
+ const validLanguage = this.countryData[0].translations[this.language] ? this.language : 'fr';
16865
+ this.countryOptions = [
16866
+ ...this.countryData
16867
+ .sort((a, b) => a.translations[validLanguage].localeCompare(b.translations[validLanguage]))
16868
+ .map(country => ({
16869
+ value: country.countryCode,
16870
+ label: `${country.translations[validLanguage]} (+${country.phoneCode})`,
16871
+ selected: country.countryCode === this.selectedCountry,
16872
+ disabled: false,
16873
+ })),
16874
+ {
16875
+ value: '',
16876
+ label: '--',
16877
+ selected: this.countryData.every((country) => country.countryCode !== this.selectedCountry),
16878
+ disabled: true,
16879
+ },
16880
+ ];
16881
+ }
16882
+ placeErrorMessage() {
16909
16883
  this.waitForElementToExist('.invalid-feedback').then((messError) => {
16910
16884
  messError.style.display = "block";
16911
16885
  messError.style.marginTop = "-0.5rem";
@@ -16930,45 +16904,37 @@ class RoadPhoneNumberInput {
16930
16904
  });
16931
16905
  });
16932
16906
  }
16933
- handleInput(event) {
16934
- this.updateCountryOptions();
16935
- this.phoneNumber = event.detail.value;
16936
- this.createReturnObject();
16937
- }
16938
- extractCallingCode(countryString) {
16939
- const regex = /\(([^)]+)\)/;
16940
- const found = countryString.match(regex);
16941
- return found ? found[1] : '';
16942
- }
16943
- selectCountry(event) {
16944
- const countryString = event.detail.value; // Get the value from the custom event
16945
- this.selectedCountry = this.extractCallingCode(countryString);
16946
- this.el.querySelector('.form-select-area-value').innerHTML = countryString;
16947
- }
16948
16907
  render() {
16949
- return (hAsync(Host, { numberType: this.numberType }, hAsync("road-input-group", null, hAsync("road-area-code", { slot: "prepend", class: `form-select has-value`, label: this.areaLabel, value: this.areaValue, sizes: "xl", options: this.countryOptions, onRoadchange: (event) => this.handleSelect(event) }), hAsync("road-input", { id: "phone-number", sizes: "xl", label: this.inputLabel, value: this.inputValue, onRoadChange: (event) => this.handleInput(event), required: this.required, error: this.inputError }))));
16908
+ const selectId = `road-select-${selectIds$1++}`;
16909
+ const labelId = selectId + '-label';
16910
+ const valueId = selectId + '-value';
16911
+ const isInvalidClass = this.errorMessage.length ? 'is-invalid' : '';
16912
+ const isErrorClass = this.errorMessage.length ? 'is-error' : '';
16913
+ return (hAsync(Host, null, hAsync("road-input-group", null, hAsync("div", { class: `road-phone-input-select ${isErrorClass}`, slot: "prepend" }, hAsync("select", { id: 'phone-number-input', class: `form-select-area has-value ${isInvalidClass}`, "aria-disabled": this.disabled ? 'true' : null, disabled: this.disabled, onChange: (event) => this.handleSelect(event) }, this.countryOptions && this.countryOptions.map(option => (hAsync("option", { value: option.value, disabled: option.disabled, selected: option.selected }, option.label)))), hAsync("label", { class: "form-select-area-label", id: labelId, htmlFor: selectId }, this.codeLabel), hAsync("label", { class: "form-select-area-value", id: valueId, htmlFor: selectId }, "+", this.selectedCountryCode)), hAsync("road-input", { id: "phone-number", sizes: "xl", label: this.phoneLabel, value: this.phoneValue, onRoadChange: (event) => this.handleInput(event), required: this.required, error: this.errorMessage }))));
16950
16914
  }
16951
16915
  get el() { return getElement(this); }
16952
16916
  static get watchers() { return {
16953
- "language": ["languageChanged"]
16917
+ "errorMessage": ["updateMessagePosition"]
16954
16918
  }; }
16955
16919
  static get style() { return phoneNumberInputCss; }
16956
16920
  static get cmpMeta() { return {
16957
16921
  "$flags$": 2,
16958
16922
  "$tagName$": "road-phone-number-input",
16959
16923
  "$members$": {
16924
+ "disabled": [4],
16960
16925
  "countryData": [16],
16961
16926
  "language": [1],
16962
- "areaLabel": [1, "area-label"],
16963
- "areaValue": [1025, "area-value"],
16964
- "inputLabel": [1, "input-label"],
16965
- "inputValue": [1, "input-value"],
16966
- "numberType": [1, "number-type"],
16927
+ "codeLabel": [1, "code-label"],
16928
+ "phoneLabel": [1, "phone-label"],
16929
+ "phoneValue": [1, "phone-value"],
16930
+ "countryCode": [1, "country-code"],
16931
+ "errorMessage": [1, "error-message"],
16967
16932
  "required": [4],
16968
16933
  "selectedCountry": [32],
16934
+ "selectedCountryCode": [32],
16969
16935
  "phoneNumber": [32],
16970
- "inputError": [32],
16971
- "countryOptions": [32]
16936
+ "countryOptions": [32],
16937
+ "returnObject": [32]
16972
16938
  },
16973
16939
  "$listeners$": undefined,
16974
16940
  "$lazyBundleId$": "-",
@@ -17088,6 +17054,7 @@ class Select {
17088
17054
  const select = ev.target;
17089
17055
  if (select) {
17090
17056
  this.value = select.value || '';
17057
+ this.value = this.addSelected();
17091
17058
  }
17092
17059
  };
17093
17060
  this.onBlur = () => {
@@ -17117,6 +17084,22 @@ class Select {
17117
17084
  this.roadChange.emit({
17118
17085
  value: this.value,
17119
17086
  });
17087
+ this.value = this.addSelected();
17088
+ }
17089
+ componentWillLoad() {
17090
+ this.value = this.addSelected();
17091
+ }
17092
+ addSelected() {
17093
+ var _a, _b;
17094
+ const selectedOption = this.options.find(option => option.value === this.value);
17095
+ const selectedOption2 = this.options.find(option => option.selected);
17096
+ if (selectedOption) {
17097
+ selectedOption.selected = true;
17098
+ }
17099
+ if (selectedOption2) {
17100
+ selectedOption2.selected = false;
17101
+ }
17102
+ return (_b = (_a = this.options.find(option => option.value === this.value)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
17120
17103
  }
17121
17104
  render() {
17122
17105
  const labelId = this.selectId + '-label';
@@ -19076,6 +19059,7 @@ class Stepper {
19076
19059
  constructor(hostRef) {
19077
19060
  registerInstance(this, hostRef);
19078
19061
  this.color = 'default';
19062
+ this.numberStep = 3;
19079
19063
  this.stateFirstStep = undefined;
19080
19064
  this.stateSecondStep = undefined;
19081
19065
  this.stateThirdStep = undefined;
@@ -19087,11 +19071,11 @@ class Stepper {
19087
19071
  const colorClass = this.color !== undefined ? `progress-indicator-horizontal progress-indicator-horizontal-${this.color}` : 'progress-indicator-horizontal';
19088
19072
  const stateClass = this.stateFirstStep !== undefined ? `progress-indicator-horizontal-item ${this.stateFirstStep}` : 'progress-indicator-horizontal-item';
19089
19073
  const stateSecondStepClass = this.stateSecondStep !== undefined ? `progress-indicator-horizontal-item ${this.stateSecondStep}` : 'progress-indicator-horizontal-item';
19090
- const stateThirdStepClass = this.stateSecondStep !== undefined ? `progress-indicator-horizontal-item ${this.stateThirdStep}` : 'progress-indicator-horizontal-item';
19074
+ const stateThirdStepClass = this.stateThirdStep !== undefined ? `progress-indicator-horizontal-item ${this.stateThirdStep}` : 'progress-indicator-horizontal-item';
19091
19075
  const urlStep1 = this.urlStep1 !== undefined ? `${this.urlStep1}` : '#';
19092
19076
  const urlStep2 = this.urlStep2 !== undefined ? `${this.urlStep2}` : '#';
19093
19077
  const urlStep3 = this.urlStep3 !== undefined ? `${this.urlStep3}` : '#';
19094
- return (hAsync(Host, null, hAsync("nav", null, hAsync("ul", { class: `${colorClass}` }, hAsync("li", { class: `${stateClass}` }, hAsync("a", { class: "progress-indicator-horizontal-link", href: `${urlStep1}` }, hAsync("span", { class: "progress-indicator-horizontal-icon" }, hAsync("slot", { name: "progress-indicator-horizontal-icon" })), hAsync("span", { class: "progress-indicator-horizontal-title" }, hAsync("slot", { name: "progress-indicator-horizontal-title" })))), hAsync("li", { class: `${stateSecondStepClass}` }, hAsync("a", { class: "progress-indicator-horizontal-link", href: `${urlStep2}` }, hAsync("span", { class: "progress-indicator-horizontal-icon" }, hAsync("slot", { name: "progress-indicator-horizontal-icon2" })), hAsync("span", { class: "progress-indicator-horizontal-title" }, hAsync("slot", { name: "progress-indicator-horizontal-title2" })))), hAsync("li", { class: `${stateThirdStepClass}` }, hAsync("a", { class: "progress-indicator-horizontal-link", href: `${urlStep3}` }, hAsync("span", { class: "progress-indicator-horizontal-icon" }, hAsync("slot", { name: "progress-indicator-horizontal-icon3" })), hAsync("span", { class: "progress-indicator-horizontal-title" }, hAsync("slot", { name: "progress-indicator-horizontal-title3" }))))))));
19078
+ return (hAsync(Host, null, hAsync("nav", null, hAsync("ul", { class: `${colorClass}` }, hAsync("li", { class: `${stateClass}` }, hAsync("a", { class: "progress-indicator-horizontal-link", href: `${urlStep1}` }, hAsync("span", { class: "progress-indicator-horizontal-icon" }, hAsync("slot", { name: "progress-indicator-horizontal-icon" })), hAsync("span", { class: "progress-indicator-horizontal-title" }, hAsync("slot", { name: "progress-indicator-horizontal-title" })))), hAsync("li", { class: `${stateSecondStepClass}` }, hAsync("a", { class: "progress-indicator-horizontal-link", href: `${urlStep2}` }, hAsync("span", { class: "progress-indicator-horizontal-icon" }, hAsync("slot", { name: "progress-indicator-horizontal-icon2" })), hAsync("span", { class: "progress-indicator-horizontal-title" }, hAsync("slot", { name: "progress-indicator-horizontal-title2" })))), this.numberStep == 3 && hAsync("li", { class: `${stateThirdStepClass}` }, hAsync("a", { class: "progress-indicator-horizontal-link", href: `${urlStep3}` }, hAsync("span", { class: "progress-indicator-horizontal-icon" }, hAsync("slot", { name: "progress-indicator-horizontal-icon3" })), hAsync("span", { class: "progress-indicator-horizontal-title" }, hAsync("slot", { name: "progress-indicator-horizontal-title3" }))))))));
19095
19079
  }
19096
19080
  static get style() { return progressIndicatorHorizontalCss; }
19097
19081
  static get cmpMeta() { return {
@@ -19099,6 +19083,7 @@ class Stepper {
19099
19083
  "$tagName$": "road-progress-indicator-horizontal",
19100
19084
  "$members$": {
19101
19085
  "color": [513],
19086
+ "numberStep": [2, "number-step"],
19102
19087
  "stateFirstStep": [1, "state-first-step"],
19103
19088
  "stateSecondStep": [1, "state-second-step"],
19104
19089
  "stateThirdStep": [1, "state-third-step"],