@planetaexo/design-system 0.54.1 → 0.55.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.
- package/dist/index.cjs +56 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +56 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13778,14 +13778,56 @@ function CategoryPage2({
|
|
|
13778
13778
|
const [sort, setSort] = React29__namespace.useState(
|
|
13779
13779
|
defaultSort != null ? defaultSort : (_a = sortOptions == null ? void 0 : sortOptions[0]) == null ? void 0 : _a.id
|
|
13780
13780
|
);
|
|
13781
|
-
const sortedTrips = React29__namespace.useMemo(
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13781
|
+
const sortedTrips = React29__namespace.useMemo(() => {
|
|
13782
|
+
const active = Object.entries(filterValue).filter(
|
|
13783
|
+
([, vals]) => vals && vals.length > 0
|
|
13784
|
+
);
|
|
13785
|
+
const filtered = active.length ? trips.filter(
|
|
13786
|
+
(trip) => active.every(([groupId, selected]) => {
|
|
13787
|
+
var _a2, _b;
|
|
13788
|
+
const groupHasData = trips.some(
|
|
13789
|
+
(t) => {
|
|
13790
|
+
var _a3, _b2, _c;
|
|
13791
|
+
return ((_c = (_b2 = (_a3 = t.filterTags) == null ? void 0 : _a3[groupId]) == null ? void 0 : _b2.length) != null ? _c : 0) > 0;
|
|
13792
|
+
}
|
|
13793
|
+
);
|
|
13794
|
+
if (!groupHasData) return true;
|
|
13795
|
+
const tags = (_b = (_a2 = trip.filterTags) == null ? void 0 : _a2[groupId]) != null ? _b : [];
|
|
13796
|
+
return selected.some((id) => tags.includes(id));
|
|
13797
|
+
})
|
|
13798
|
+
) : trips;
|
|
13799
|
+
const list = [...filtered];
|
|
13800
|
+
switch (sort) {
|
|
13801
|
+
case "price-asc":
|
|
13802
|
+
list.sort((a, b) => {
|
|
13803
|
+
var _a2, _b;
|
|
13804
|
+
return ((_a2 = a.priceValue) != null ? _a2 : Infinity) - ((_b = b.priceValue) != null ? _b : Infinity);
|
|
13805
|
+
});
|
|
13806
|
+
break;
|
|
13807
|
+
case "price-desc":
|
|
13808
|
+
list.sort((a, b) => {
|
|
13809
|
+
var _a2, _b;
|
|
13810
|
+
return ((_a2 = b.priceValue) != null ? _a2 : -Infinity) - ((_b = a.priceValue) != null ? _b : -Infinity);
|
|
13811
|
+
});
|
|
13812
|
+
break;
|
|
13813
|
+
case "duration-asc":
|
|
13814
|
+
list.sort((a, b) => {
|
|
13815
|
+
var _a2, _b;
|
|
13816
|
+
return ((_a2 = a.nights) != null ? _a2 : Infinity) - ((_b = b.nights) != null ? _b : Infinity);
|
|
13817
|
+
});
|
|
13818
|
+
break;
|
|
13819
|
+
case "duration-desc":
|
|
13820
|
+
list.sort((a, b) => {
|
|
13821
|
+
var _a2, _b;
|
|
13822
|
+
return ((_a2 = b.nights) != null ? _a2 : -Infinity) - ((_b = a.nights) != null ? _b : -Infinity);
|
|
13823
|
+
});
|
|
13824
|
+
break;
|
|
13825
|
+
default:
|
|
13826
|
+
list.sort((a, b) => (b.featured ? 1 : 0) - (a.featured ? 1 : 0));
|
|
13827
|
+
break;
|
|
13828
|
+
}
|
|
13829
|
+
return list;
|
|
13830
|
+
}, [trips, filterValue, sort]);
|
|
13789
13831
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("w-full", className), children: [
|
|
13790
13832
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13791
13833
|
"section",
|
|
@@ -13812,10 +13854,9 @@ function CategoryPage2({
|
|
|
13812
13854
|
] }),
|
|
13813
13855
|
siteHeader && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13814
13856
|
SiteHeader,
|
|
13815
|
-
{
|
|
13816
|
-
links: Array.isArray(siteHeader) ? siteHeader : void 0,
|
|
13857
|
+
__spreadProps(__spreadValues({}, Array.isArray(siteHeader) ? { links: siteHeader } : typeof siteHeader === "object" ? siteHeader : {}), {
|
|
13817
13858
|
position: "overlay"
|
|
13818
|
-
}
|
|
13859
|
+
})
|
|
13819
13860
|
),
|
|
13820
13861
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mx-auto w-full max-w-6xl px-6 sm:px-8", children: [
|
|
13821
13862
|
breadcrumb && breadcrumb.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-3 flex items-center gap-1.5 flex-wrap", children: breadcrumb.map((crumb, i) => /* @__PURE__ */ jsxRuntime.jsxs(React29__namespace.Fragment, { children: [
|
|
@@ -13839,7 +13880,7 @@ function CategoryPage2({
|
|
|
13839
13880
|
),
|
|
13840
13881
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "-mx-6 sm:-mx-8 px-6 sm:px-8 overflow-x-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex gap-5 min-w-max pb-2", children: popularTours.map((trip, i) => {
|
|
13841
13882
|
var _b;
|
|
13842
|
-
const _a2 = trip, { featured: _featured, variant: _variant } = _a2, cardProps = __objRest(_a2, ["featured", "variant"]);
|
|
13883
|
+
const _a2 = trip, { featured: _featured, variant: _variant, filterTags: _filterTags, priceValue: _priceValue } = _a2, cardProps = __objRest(_a2, ["featured", "variant", "filterTags", "priceValue"]);
|
|
13843
13884
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13844
13885
|
TripCard,
|
|
13845
13886
|
__spreadProps(__spreadValues({}, cardProps), {
|
|
@@ -13866,9 +13907,9 @@ function CategoryPage2({
|
|
|
13866
13907
|
}
|
|
13867
13908
|
) }),
|
|
13868
13909
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground font-ui mb-5", children: [
|
|
13869
|
-
|
|
13910
|
+
sortedTrips.length,
|
|
13870
13911
|
" ",
|
|
13871
|
-
|
|
13912
|
+
sortedTrips.length === 1 ? "trip" : "trips",
|
|
13872
13913
|
" found"
|
|
13873
13914
|
] }),
|
|
13874
13915
|
(() => {
|
|
@@ -13876,7 +13917,7 @@ function CategoryPage2({
|
|
|
13876
13917
|
const hiddenCount = sortedTrips.length - visibleTrips.length;
|
|
13877
13918
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13878
13919
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-8 lg:gap-x-[35px] lg:gap-y-[38px]", children: visibleTrips.map((trip, i) => {
|
|
13879
|
-
const _a2 = trip, { featured: _featured } = _a2, cardProps = __objRest(_a2, ["featured"]);
|
|
13920
|
+
const _a2 = trip, { featured: _featured, filterTags: _filterTags, priceValue: _priceValue } = _a2, cardProps = __objRest(_a2, ["featured", "filterTags", "priceValue"]);
|
|
13880
13921
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13881
13922
|
TripCard,
|
|
13882
13923
|
__spreadProps(__spreadValues({}, cardProps), {
|