@sledge-app/react-instant-search 1.0.17 → 1.0.19
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.
- package/dist/components/SearchWidget/SearchWidget.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +72 -47
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports, $ as $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, a as $cb5cc270b50c6fcd$export$41fb9f06171c75f4, b as $cb5cc270b50c6fcd$export$602eac185826482c, c as $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, d as $cb5cc270b50c6fcd$export$f39c2d165cd861fe, e as $cb5cc270b50c6fcd$export$21b07c8f274aebd5, f as $67824d98245208a0$export$be92b6f5f03c0fe9, g as $67824d98245208a0$export$adb584737d712b70, h as $e698a72e93240346$export$be92b6f5f03c0fe9, i as $e698a72e93240346$export$adb584737d712b70, k as $faa2e61a3361514f$export$be92b6f5f03c0fe9, l as $faa2e61a3361514f$export$13921ac0cc260818, m as $faa2e61a3361514f$export$9a58ef0d7ad3278c, n as $faa2e61a3361514f$export$6521433ed15a34db, o as $f99a8c78507165f7$export$be92b6f5f03c0fe9, p as $f99a8c78507165f7$export$6d08773d2e66f8f2, q as $f99a8c78507165f7$export$adb584737d712b70, r as $cc7e05a45900e73f$export$6d08773d2e66f8f2, s as $cc7e05a45900e73f$export$d6e5bf9c43ea9319, t as $cc7e05a45900e73f$export$c3468e2714d175fa, u as $cc7e05a45900e73f$export$be92b6f5f03c0fe9, v as $cc7e05a45900e73f$export$41fb9f06171c75f4, w as $cc7e05a45900e73f$export$4c8d1a57a761ef94, x as $cc7e05a45900e73f$export$f04a61298a47a40f, y as $cc7e05a45900e73f$export$602eac185826482c, z as $cc7e05a45900e73f$export$7c6e2c02157bb7d2, A as $cc7e05a45900e73f$export$2f60d3ec9ad468f2, B as $cc7e05a45900e73f$export$d5c6c08dc2d3ca7, C as $cc7e05a45900e73f$export$bf1aedc3039c8d63, D as motion, E as client, F as $a093c7e1ec25a057$export$2881499e37b75b9a, G as $a093c7e1ec25a057$export$be92b6f5f03c0fe9, H as $a093c7e1ec25a057$export$41fb9f06171c75f4, I as $a093c7e1ec25a057$export$602eac185826482c, J as $a093c7e1ec25a057$export$7c6e2c02157bb7d2, K as $a093c7e1ec25a057$export$21b07c8f274aebd5, L as $57acba87d6e25586$export$be92b6f5f03c0fe9, M as $57acba87d6e25586$export$d5c6c08dc2d3ca7, N as $57acba87d6e25586$export$9a4e88b92edfce6b, O as $57acba87d6e25586$export$6521433ed15a34db, P as MasonryResponsive, Q as Masonry, R as $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, S as $5d3850c4d0b4e6c7$export$602eac185826482c, T as $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, U as $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 } from "./vendor-efe38901.js";
|
|
2
|
-
import React__default
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import { SledgeContext } from "@sledge-app/core";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
const ProductFilterWidget = (props) => {
|
|
@@ -1835,52 +1835,74 @@ const Rating = (props) => {
|
|
|
1835
1835
|
setIsFirstLoading(true);
|
|
1836
1836
|
handleProductRatingInfo(valueRenderProductReviewRating, true);
|
|
1837
1837
|
}, [productId, valueRenderProductReviewRating]);
|
|
1838
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__rating", onClick: handleOnClick, "data-rating-size": size, children: isFirstLoading && withSkeletonLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "230px", height: "28px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1838
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__rating", onClick: handleOnClick, "data-rating-size": size, children: isFirstLoading && withSkeletonLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "230px", height: "28px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isLoading && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
1839
|
+
[1, 2, 3, 4, 5].map((item, index) => {
|
|
1840
|
+
let ratingValue = Math.floor(parseFloat(averageReview));
|
|
1841
|
+
let getCommaValue = String(averageReview).includes(",") ? String(averageReview).split(",") : [];
|
|
1842
|
+
let getCommaValueDot = String(averageReview).includes(".") ? String(averageReview).split(".") : [];
|
|
1843
|
+
let isHaveCommaValue = getCommaValue.length || getCommaValueDot.length;
|
|
1844
|
+
let commaValue = isHaveCommaValue ? getCommaValue[1] || getCommaValueDot[1] : 0;
|
|
1845
|
+
let fillOther = "fill-0";
|
|
1846
|
+
if (item > ratingValue && ratingValue + 1 === item) {
|
|
1847
|
+
fillOther = `fill-${commaValue}`;
|
|
1848
|
+
}
|
|
1849
|
+
fillOther = item <= ratingValue ? "full" : fillOther;
|
|
1850
|
+
let offset;
|
|
1851
|
+
if (fillOther === "fill-0") {
|
|
1852
|
+
offset = "0%";
|
|
1853
|
+
}
|
|
1854
|
+
if (fillOther === "fill-1") {
|
|
1855
|
+
offset = "25%";
|
|
1856
|
+
}
|
|
1857
|
+
if (fillOther === "fill-2") {
|
|
1858
|
+
offset = "35%";
|
|
1859
|
+
}
|
|
1860
|
+
if (fillOther === "fill-3") {
|
|
1861
|
+
offset = "40%";
|
|
1862
|
+
}
|
|
1863
|
+
if (fillOther === "fill-4") {
|
|
1864
|
+
offset = "45%";
|
|
1865
|
+
}
|
|
1866
|
+
if (fillOther === "fill-5") {
|
|
1867
|
+
offset = "50%";
|
|
1868
|
+
}
|
|
1869
|
+
if (fillOther === "fill-6") {
|
|
1870
|
+
offset = "60%";
|
|
1871
|
+
}
|
|
1872
|
+
if (fillOther === "fill-7") {
|
|
1873
|
+
offset = "70%";
|
|
1874
|
+
}
|
|
1875
|
+
if (fillOther === "fill-8") {
|
|
1876
|
+
offset = "80%";
|
|
1877
|
+
}
|
|
1878
|
+
if (fillOther === "fill-9") {
|
|
1879
|
+
offset = "90%";
|
|
1880
|
+
}
|
|
1881
|
+
if (fillOther === "full") {
|
|
1882
|
+
offset = "100%";
|
|
1883
|
+
}
|
|
1884
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", ...sizing, viewBox: "0 0 32 32", children: [
|
|
1885
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: `rating-gradient-${fillOther}-${index}-${productId}`, children: [
|
|
1886
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fill_color }),
|
|
1887
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: "transparent" })
|
|
1888
|
+
] }) }),
|
|
1889
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1890
|
+
"path",
|
|
1891
|
+
{
|
|
1892
|
+
fill: `url(#rating-gradient-${fillOther}-${index}-${productId})`,
|
|
1893
|
+
d: "M9.18817 19.8162L9.25542 19.4179L8.94431 19.1604L3.14591 14.3604L3.14598 14.3603L3.13673 14.3529C2.5294 13.8672 2.784 12.8955 3.54372 12.7636L11.7291 12.3989L12.1807 12.3788L12.3481 11.959L15.8472 3.18648C15.977 2.94796 16.2257 2.79961 16.4979 2.79961C16.769 2.79961 17.0185 2.94848 17.1489 3.18698L20.6478 11.959L20.8152 12.3788L21.2668 12.3989L29.4522 12.7636C30.2119 12.8955 30.4665 13.8672 29.8592 14.3529L29.8591 14.3528L29.85 14.3604L24.0516 19.1604L23.7405 19.4179L23.8077 19.8162L25.3884 29.1774C25.4834 29.8833 24.7613 30.4104 24.1224 30.1159L16.8734 25.5088L16.498 25.2702L16.1226 25.5088L8.87373 30.1141C8.23317 30.409 7.51248 29.8817 7.60746 29.1758L9.18817 19.8162Z",
|
|
1894
|
+
stroke: outline_color,
|
|
1895
|
+
strokeWidth: "1.4"
|
|
1896
|
+
}
|
|
1897
|
+
)
|
|
1898
|
+
] });
|
|
1899
|
+
}),
|
|
1900
|
+
withTotal ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-product-review__rating-summary-total", children: [
|
|
1901
|
+
"(",
|
|
1902
|
+
totalReview,
|
|
1903
|
+
")"
|
|
1904
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})
|
|
1905
|
+
] }) }) });
|
|
1884
1906
|
};
|
|
1885
1907
|
const getSizing = (size) => {
|
|
1886
1908
|
if (size === "xs") {
|
|
@@ -4970,6 +4992,9 @@ const SearchWidget = (props) => {
|
|
|
4970
4992
|
return () => clearTimeout(delayDebounceFn);
|
|
4971
4993
|
}
|
|
4972
4994
|
}, [keyword]);
|
|
4995
|
+
React__default.useEffect(() => {
|
|
4996
|
+
showSearchResult ? document.body.classList.add("sledge__open-element-inset") : document.body.classList.remove("sledge__open-element-inset");
|
|
4997
|
+
}, [showSearchResult]);
|
|
4973
4998
|
const wrapperStyle = {
|
|
4974
4999
|
maxWidth: width
|
|
4975
5000
|
};
|