@sledge-app/react-instant-search 2.0.53 → 2.0.55

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.
@@ -859,6 +859,7 @@ const Slider = (props) => {
859
859
  minMaxClassName = "",
860
860
  minMaxTextClassName = ""
861
861
  } = props;
862
+ const { isJsVersion, locale } = React__default.useContext(SledgeContext) || {};
862
863
  const [inputRangeMin, setInputRangeMin] = React__default.useState(inputRangeFormatter(value == null ? void 0 : value[0]));
863
864
  const [inputRangeMax, setInputRangeMax] = React__default.useState(inputRangeFormatter((value == null ? void 0 : value[1]) || (value == null ? void 0 : value[0])));
864
865
  const delayInputRangeRef = React__default.useRef(null);
@@ -869,8 +870,9 @@ const Slider = (props) => {
869
870
  const isTypeIncludeSlider = (_b = String(type)) == null ? void 0 : _b.includes("slider");
870
871
  const isTypeIncludeInputRange = (_c = String(type)) == null ? void 0 : _c.includes("input_range");
871
872
  const handleChangeInputRange = ({ event, type: type2 }) => {
872
- var _a2;
873
+ var _a2, _b2;
873
874
  let valueInput = (_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.value;
875
+ valueInput = (_b2 = valueInput == null ? void 0 : valueInput.replaceAll) == null ? void 0 : _b2.call(valueInput, ",", ".");
874
876
  if (!Number(valueInput) && Number(valueInput) !== 0)
875
877
  return;
876
878
  let valueCommit = type2 === "min" ? [valueInput || 0, (value == null ? void 0 : value[1]) || (value == null ? void 0 : value[0])] : [value == null ? void 0 : value[0], valueInput || 0];
@@ -909,6 +911,22 @@ const Slider = (props) => {
909
911
  }
910
912
  }, 500);
911
913
  };
914
+ const decimalFormatter = (value2) => {
915
+ var _a2, _b2, _c2;
916
+ const selectedLocale = isJsVersion ? selectedLocaleJs() : locale;
917
+ if (value2 && selectedLocale) {
918
+ try {
919
+ const formatted = new Intl.NumberFormat(selectedLocale).format(value2);
920
+ const nonDigits = (_a2 = formatted == null ? void 0 : formatted.replace) == null ? void 0 : _a2.call(formatted, /\d/g, "");
921
+ const decimalSeparator = (_b2 = nonDigits == null ? void 0 : nonDigits.slice) == null ? void 0 : _b2.call(nonDigits, -1);
922
+ if (decimalSeparator === ",")
923
+ return (_c2 = value2 == null ? void 0 : value2.replaceAll) == null ? void 0 : _c2.call(value2, ".", ",");
924
+ } catch (error) {
925
+ return value2;
926
+ }
927
+ }
928
+ return value2;
929
+ };
912
930
  useEffectOnChange(() => {
913
931
  if (isTypeIncludeInputRange && !(valueFilterSliderChange == null ? void 0 : valueFilterSliderChange.length)) {
914
932
  setInputRangeMin(inputRangeFormatter(value == null ? void 0 : value[0]));
@@ -926,7 +944,7 @@ const Slider = (props) => {
926
944
  className: "sledge__slider-input-range-minmax",
927
945
  type: "text",
928
946
  onChange: (event) => handleChangeInputRange({ event, type: "min" }),
929
- value: inputRangeMin,
947
+ value: decimalFormatter(inputRangeMin),
930
948
  style: labelStyle
931
949
  }
932
950
  ),
@@ -937,7 +955,7 @@ const Slider = (props) => {
937
955
  className: "sledge__slider-input-range-minmax",
938
956
  type: "text",
939
957
  onChange: (event) => handleChangeInputRange({ event, type: "max" }),
940
- value: inputRangeMax,
958
+ value: decimalFormatter(inputRangeMax),
941
959
  style: labelStyle
942
960
  }
943
961
  )
@@ -10154,7 +10172,8 @@ const ResultProduct = React__default.memo((props) => {
10154
10172
  filter: language_filter,
10155
10173
  clear_filter: language_clear_filter,
10156
10174
  pagination_info: language_pagination_info,
10157
- total_result_text: language_total_result_text
10175
+ total_result_text: language_total_result_text,
10176
+ product: language_product
10158
10177
  } = languageSettings || {};
10159
10178
  const { separator: hierarchical_separator, hiddens: hierarchical_hiddens } = hierarchicalProductTypeSettings || {};
10160
10179
  const {
@@ -10183,8 +10202,9 @@ const ResultProduct = React__default.memo((props) => {
10183
10202
  let isSummaryTextFromLanguage = language_total_result_text && getSummaryText;
10184
10203
  if (isSummaryTextFromLanguage) {
10185
10204
  getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_RESULT, totalResult);
10205
+ const languageProduct = language_product || "Products";
10186
10206
  if (layoutType === "product-filter")
10187
- getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.COLLECTION_NAME, collectionName || "Products");
10207
+ getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.COLLECTION_NAME, collectionName || languageProduct);
10188
10208
  }
10189
10209
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isSummaryTextFromLanguage ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-data-summary-text", dangerouslySetInnerHTML: { __html: getSummaryText } }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-data-summary-text", children: defaultSummaryText }) });
10190
10210
  };