@roadtrip/components 3.33.1 → 3.33.3

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.
@@ -129,7 +129,7 @@ const Col = class {
129
129
  };
130
130
  Col.style = RoadColStyle0;
131
131
 
132
- const counterCss = ".sc-road-counter-h{position:relative;z-index:0;display:block}road-input.sc-road-counter{--input-text-align:center;--border-radius:0;--margin-bottom:0}road-button.sc-road-counter{width:3rem;font-size:var(--road-font-size-24);line-height:1.4;background:var(--road-surface);border:1px solid var(--road-button-tertiary-outline)}road-button.sc-road-counter:hover,road-button.sc-road-counter:focus{background:var(--road-button-tertiary-variant)}road-button.sc-road-counter road-icon.sc-road-counter{display:flex;fill:var(--road-primary)}.disabled.sc-road-counter{margin-right:-1px;margin-left:-1px;pointer-events:none;cursor:not-allowed;background:var(--road-surface-disabled);border:1px solid var(--road-on-surface-disabled);opacity:inherit}.disabled.sc-road-counter:focus{background:var(--road-disabled)}.disabled.sc-road-counter road-icon.sc-road-counter{fill:var(--road-grey-50)}road-button.btn-md.sc-road-counter{width:2.5rem}road-button.btn-sm.sc-road-counter{width:2rem}.counter-md.sc-road-counter{height:2.5rem}.counter-sm.sc-road-counter{height:2rem}.counter-md.sc-road-counter road-input.sc-road-counter{--height:2.5rem}.counter-md.sc-road-counter road-button.sc-road-counter{min-width:2.5rem}.counter-sm.sc-road-counter road-input.sc-road-counter{--height:2rem}.counter-sm.sc-road-counter road-button.sc-road-counter{min-width:2rem}";
132
+ const counterCss = ".sc-road-counter-h{position:relative;z-index:0;display:block}road-input.sc-road-counter{--input-text-align:center;--border-radius:0;--margin-bottom:0}road-button.sc-road-counter{position:relative;width:3rem;font-size:var(--road-font-size-24);line-height:1.4;background:var(--road-surface);border:1px solid var(--road-button-tertiary-outline)}road-button.sc-road-counter:hover,road-button.sc-road-counter:focus{background:var(--road-button-tertiary-variant)}road-button.sc-road-counter road-icon.sc-road-counter{display:flex;fill:var(--road-primary)}.disabled.sc-road-counter{margin-right:-1px;margin-left:-1px;pointer-events:none;cursor:not-allowed;background:var(--road-surface-disabled);border:1px solid var(--road-on-surface-disabled);opacity:inherit}.disabled.sc-road-counter:focus{background:var(--road-disabled)}.disabled.sc-road-counter road-icon.sc-road-counter{fill:var(--road-grey-50)}road-button.btn-md.sc-road-counter{width:2.5rem}road-button.btn-sm.sc-road-counter{width:2rem}.counter-md.sc-road-counter{height:2.5rem}.counter-sm.sc-road-counter{height:2rem}.counter-md.sc-road-counter road-input.sc-road-counter{--height:2.5rem}.counter-md.sc-road-counter road-button.sc-road-counter{min-width:2.5rem}.counter-sm.sc-road-counter road-input.sc-road-counter{--height:2rem}.counter-sm.sc-road-counter road-button.sc-road-counter{min-width:2rem}";
133
133
  const RoadCounterStyle0 = counterCss;
134
134
 
135
135
  const Counter = class {
@@ -17893,48 +17893,57 @@ const Input = class {
17893
17893
  if (this.type === 'number' && this.blockdecimal) {
17894
17894
  newValue = newValue.replace(/[.,]/g, ''); // Supprime les décimales si `blockdecimal` est activé
17895
17895
  }
17896
- // Convertir en nombre et ajuster selon min/max
17897
- let numericValue = parseFloat(newValue);
17898
- const minValue = this.min !== undefined ? parseFloat(this.min) : undefined;
17899
- const maxValue = this.max !== undefined ? parseFloat(this.max) : undefined;
17900
- if (!isNaN(numericValue)) {
17901
- if (minValue !== undefined && numericValue < minValue) {
17902
- numericValue = minValue;
17903
- }
17904
- if (maxValue !== undefined && numericValue > maxValue) {
17905
- numericValue = maxValue;
17896
+ if (this.type === 'number') {
17897
+ // Convertir en nombre et ajuster selon min/max
17898
+ let numericValue = parseFloat(newValue);
17899
+ const minValue = this.min !== undefined ? parseFloat(this.min) : undefined;
17900
+ const maxValue = this.max !== undefined ? parseFloat(this.max) : undefined;
17901
+ if (!isNaN(numericValue)) {
17902
+ if (minValue !== undefined && numericValue < minValue) {
17903
+ numericValue = minValue;
17904
+ }
17905
+ if (maxValue !== undefined && numericValue > maxValue) {
17906
+ numericValue = maxValue;
17907
+ }
17908
+ newValue = numericValue.toString();
17909
+ input.value = newValue; // Force l'affichage de la valeur max
17910
+ ev.preventDefault(); // Empêche la saisie supplémentaire
17906
17911
  }
17907
- newValue = numericValue.toString();
17912
+ this.value = newValue;
17908
17913
  }
17909
- if (this.type === 'number') {
17914
+ // Vérification si la valeur a réellement changé avant de la mettre à jour
17915
+ if (this.value !== newValue) {
17910
17916
  this.value = newValue;
17911
- input.value = newValue; // Mise à jour immédiate du champ
17917
+ this.roadInput.emit(ev);
17912
17918
  }
17913
- this.roadInput.emit(ev);
17914
- this.roadChange.emit({ value: newValue });
17915
17919
  // Appeler enforceMinMaxValue à chaque modification de la valeur
17916
17920
  this.enforceMinMaxValue();
17917
17921
  };
17918
17922
  this.onBlur = () => {
17919
17923
  let value = this.getValue();
17920
- const minValue = this.min !== undefined ? parseFloat(this.min) : undefined;
17921
- const maxValue = this.max !== undefined ? parseFloat(this.max) : undefined;
17922
- let numericValue = parseFloat(value);
17923
- if (!isNaN(numericValue)) {
17924
- if (minValue !== undefined && numericValue < minValue) {
17925
- numericValue = minValue;
17926
- }
17927
- if (maxValue !== undefined && numericValue > maxValue) {
17928
- numericValue = maxValue;
17929
- }
17930
- value = numericValue.toString();
17931
- }
17932
17924
  if (this.type === 'number') {
17925
+ const minValue = this.min !== undefined ? parseFloat(this.min) : undefined;
17926
+ const maxValue = this.max !== undefined ? parseFloat(this.max) : undefined;
17927
+ let numericValue = parseFloat(value);
17928
+ if (!isNaN(numericValue)) {
17929
+ if (minValue !== undefined && numericValue < minValue) {
17930
+ numericValue = minValue;
17931
+ }
17932
+ if (maxValue !== undefined && numericValue > maxValue) {
17933
+ numericValue = maxValue;
17934
+ }
17935
+ value = numericValue.toString();
17936
+ }
17933
17937
  this.value = value;
17934
17938
  const input = document.getElementById(this.inputId);
17935
17939
  input.value = value;
17936
17940
  }
17937
- this.roadBlur.emit(value);
17941
+ // Vérification si la valeur a changé avant mise à jour
17942
+ if (this.value !== value) {
17943
+ this.value = value;
17944
+ this.roadBlur.emit(value);
17945
+ this.roadChange.emit({ value });
17946
+ }
17938
17947
  // Appeler enforceMinMaxValue lors de la perte de focus
17939
17948
  this.enforceMinMaxValue();
17940
17949
  };
@@ -17962,10 +17971,10 @@ const Input = class {
17962
17971
  /**
17963
17972
  * Update the native input element when the value changes
17964
17973
  */
17965
- valueChanged() {
17966
- this.debouncedRoadChange(this.value);
17967
- // Appeler enforceMinMaxValue après chaque changement de valeur
17968
- this.enforceMinMaxValue();
17974
+ valueChanged(newValue, oldValue) {
17975
+ if (newValue !== oldValue) {
17976
+ this.debouncedRoadChange(newValue);
17977
+ }
17969
17978
  }
17970
17979
  async enforceMinMaxValue() {
17971
17980
  let value = this.getValue();
@@ -17981,12 +17990,9 @@ const Input = class {
17981
17990
  }
17982
17991
  value = numericValue.toString();
17983
17992
  }
17984
- if (this.type === 'number') {
17985
- this.value = value;
17986
- const input = document.getElementById(this.inputId);
17987
- input.value = value;
17993
+ if (this.type === 'number' && this.value !== value) {
17994
+ this.value = value; // Déclenche @Watch('value')
17988
17995
  }
17989
- this.roadChange.emit({ value });
17990
17996
  }
17991
17997
  getValue() {
17992
17998
  return typeof this.value === 'number'
@@ -18002,7 +18008,7 @@ const Input = class {
18002
18008
  const hasValueClass = this.value !== '' && this.value !== null ? 'has-value' : '';
18003
18009
  const lessLabelClass = this.label !== '' ? '' : 'less-label';
18004
18010
  const isInvalidClass = this.error !== undefined && this.error !== '' ? 'is-invalid' : '';
18005
- return (index.h(index.Host, { key: 'b7ef84554172ef97f03f4dc705900d07a2aa1a38', "aria-disabled": this.disabled ? 'true' : null, class: this.sizes && `input-${this.sizes}`, value: value, blockdecimal: this.blockdecimal }, index.h("input", { key: '8eeb48bdc7f566e5d05653b62e84fd8a65c5f186', class: `form-control ${hasValueClass} ${isInvalidClass} ${lessLabelClass}`, id: this.inputId, "aria-disabled": this.disabled ? 'true' : null, "aria-labelledby": labelId, disabled: this.disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, enterKeyHint: this.enterkeyhint, autoFocus: this.autofocus, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.type === 'number' ? (event) => this.handleKeyDown(event) : undefined, "data-cy": 'road-input' }), index.h("label", { key: '4aefd838da02cab58f221b5b3997425b08a5d8d4', class: "form-label", id: labelId, htmlFor: this.inputId }, this.label), this.error && this.error !== '' && index.h("p", { key: '4240bb64b880cc9d5a197bde53d751e111585c1e', class: "invalid-feedback" }, index.h("road-icon", { key: '018901170aa61e758327643920e4e061df3b8610', slot: "start", name: "alert-error-solid", "aria-hidden": "true", size: "sm" }), this.error), this.helper && this.helper !== '' && index.h("p", { key: '84c82786154595624d477db40b79bee27eff1d03', class: "helper" }, this.helper), this.type && this.type == 'password' && index.h("slot", { key: '3d55459ebb09892c6b830b726292ae2db4cbb5be', name: "checklistPassword" })));
18011
+ return (index.h(index.Host, { key: 'e8296b902967681ad3483560e720236c98dc4f9f', "aria-disabled": this.disabled ? 'true' : null, class: this.sizes && `input-${this.sizes}`, value: value, blockdecimal: this.blockdecimal }, index.h("input", { key: '8ad175738f8fca4ca345aff156e3124db00afbdf', class: `form-control ${hasValueClass} ${isInvalidClass} ${lessLabelClass}`, id: this.inputId, "aria-disabled": this.disabled ? 'true' : null, "aria-labelledby": labelId, disabled: this.disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, enterKeyHint: this.enterkeyhint, autoFocus: this.autofocus, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.type === 'number' ? (event) => this.handleKeyDown(event) : undefined, "data-cy": 'road-input' }), index.h("label", { key: 'f9e63512f533d2cf89a8bbfd6fffd8824a721211', class: "form-label", id: labelId, htmlFor: this.inputId }, this.label), this.error && this.error !== '' && index.h("p", { key: 'ec34468bc61c42943ee5b275081e02be859e45e2', class: "invalid-feedback" }, index.h("road-icon", { key: '83204d0fecc77eb3d8e8bc9697cd9bfc7ddb3be5', slot: "start", name: "alert-error-solid", "aria-hidden": "true", size: "sm" }), this.error), this.helper && this.helper !== '' && index.h("p", { key: 'b639735e1508e1aac0ba5800edf9649fb1847155', class: "helper" }, this.helper), this.type && this.type == 'password' && index.h("slot", { key: 'c33c73bc53ae22f3b3bd97021a5c4f320cff89f9', name: "checklistPassword" })));
18006
18012
  }
18007
18013
  static get watchers() { return {
18008
18014
  "debounce": ["debounceChanged"],