@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.d.cts
CHANGED
|
@@ -3074,6 +3074,15 @@ declare function TripPage({ title, tagline, destination, duration, images, video
|
|
|
3074
3074
|
interface Category2Trip extends TripCardProps {
|
|
3075
3075
|
/** Marca a trip como featured — sobe para o topo do grid principal. */
|
|
3076
3076
|
featured?: boolean;
|
|
3077
|
+
/**
|
|
3078
|
+
* Per-group filter membership — `{ groupId: [optionId, …] }`, where the ids
|
|
3079
|
+
* match the `filterGroups` option ids. A trip is kept when, for every active
|
|
3080
|
+
* filter group, its ids intersect the selected option(s). Groups that no trip
|
|
3081
|
+
* carries data for stay display-only (selecting them doesn't filter).
|
|
3082
|
+
*/
|
|
3083
|
+
filterTags?: Record<string, string[]>;
|
|
3084
|
+
/** Numeric price driving the price sort (the display string stays in `price`). */
|
|
3085
|
+
priceValue?: number;
|
|
3077
3086
|
}
|
|
3078
3087
|
interface Category2BlogPost {
|
|
3079
3088
|
title: string;
|
|
@@ -3105,8 +3114,12 @@ interface CategoryPage2Props {
|
|
|
3105
3114
|
label: string;
|
|
3106
3115
|
href?: string;
|
|
3107
3116
|
}>;
|
|
3108
|
-
/**
|
|
3109
|
-
|
|
3117
|
+
/**
|
|
3118
|
+
* Render the overlay SiteHeader inside the hero. Pass `true` for the default
|
|
3119
|
+
* header, a `SiteHeaderLink[]` for custom links, or a full
|
|
3120
|
+
* {@link TripSiteHeaderConfig} to wire languages + onLanguageChange.
|
|
3121
|
+
*/
|
|
3122
|
+
siteHeader?: boolean | SiteHeaderLink[] | TripSiteHeaderConfig;
|
|
3110
3123
|
popularTours?: Category2Trip[];
|
|
3111
3124
|
popularToursTitle?: string;
|
|
3112
3125
|
popularToursEyebrow?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3074,6 +3074,15 @@ declare function TripPage({ title, tagline, destination, duration, images, video
|
|
|
3074
3074
|
interface Category2Trip extends TripCardProps {
|
|
3075
3075
|
/** Marca a trip como featured — sobe para o topo do grid principal. */
|
|
3076
3076
|
featured?: boolean;
|
|
3077
|
+
/**
|
|
3078
|
+
* Per-group filter membership — `{ groupId: [optionId, …] }`, where the ids
|
|
3079
|
+
* match the `filterGroups` option ids. A trip is kept when, for every active
|
|
3080
|
+
* filter group, its ids intersect the selected option(s). Groups that no trip
|
|
3081
|
+
* carries data for stay display-only (selecting them doesn't filter).
|
|
3082
|
+
*/
|
|
3083
|
+
filterTags?: Record<string, string[]>;
|
|
3084
|
+
/** Numeric price driving the price sort (the display string stays in `price`). */
|
|
3085
|
+
priceValue?: number;
|
|
3077
3086
|
}
|
|
3078
3087
|
interface Category2BlogPost {
|
|
3079
3088
|
title: string;
|
|
@@ -3105,8 +3114,12 @@ interface CategoryPage2Props {
|
|
|
3105
3114
|
label: string;
|
|
3106
3115
|
href?: string;
|
|
3107
3116
|
}>;
|
|
3108
|
-
/**
|
|
3109
|
-
|
|
3117
|
+
/**
|
|
3118
|
+
* Render the overlay SiteHeader inside the hero. Pass `true` for the default
|
|
3119
|
+
* header, a `SiteHeaderLink[]` for custom links, or a full
|
|
3120
|
+
* {@link TripSiteHeaderConfig} to wire languages + onLanguageChange.
|
|
3121
|
+
*/
|
|
3122
|
+
siteHeader?: boolean | SiteHeaderLink[] | TripSiteHeaderConfig;
|
|
3110
3123
|
popularTours?: Category2Trip[];
|
|
3111
3124
|
popularToursTitle?: string;
|
|
3112
3125
|
popularToursEyebrow?: string;
|
package/dist/index.js
CHANGED
|
@@ -13757,14 +13757,56 @@ function CategoryPage2({
|
|
|
13757
13757
|
const [sort, setSort] = React29.useState(
|
|
13758
13758
|
defaultSort != null ? defaultSort : (_a = sortOptions == null ? void 0 : sortOptions[0]) == null ? void 0 : _a.id
|
|
13759
13759
|
);
|
|
13760
|
-
const sortedTrips = React29.useMemo(
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13760
|
+
const sortedTrips = React29.useMemo(() => {
|
|
13761
|
+
const active = Object.entries(filterValue).filter(
|
|
13762
|
+
([, vals]) => vals && vals.length > 0
|
|
13763
|
+
);
|
|
13764
|
+
const filtered = active.length ? trips.filter(
|
|
13765
|
+
(trip) => active.every(([groupId, selected]) => {
|
|
13766
|
+
var _a2, _b;
|
|
13767
|
+
const groupHasData = trips.some(
|
|
13768
|
+
(t) => {
|
|
13769
|
+
var _a3, _b2, _c;
|
|
13770
|
+
return ((_c = (_b2 = (_a3 = t.filterTags) == null ? void 0 : _a3[groupId]) == null ? void 0 : _b2.length) != null ? _c : 0) > 0;
|
|
13771
|
+
}
|
|
13772
|
+
);
|
|
13773
|
+
if (!groupHasData) return true;
|
|
13774
|
+
const tags = (_b = (_a2 = trip.filterTags) == null ? void 0 : _a2[groupId]) != null ? _b : [];
|
|
13775
|
+
return selected.some((id) => tags.includes(id));
|
|
13776
|
+
})
|
|
13777
|
+
) : trips;
|
|
13778
|
+
const list = [...filtered];
|
|
13779
|
+
switch (sort) {
|
|
13780
|
+
case "price-asc":
|
|
13781
|
+
list.sort((a, b) => {
|
|
13782
|
+
var _a2, _b;
|
|
13783
|
+
return ((_a2 = a.priceValue) != null ? _a2 : Infinity) - ((_b = b.priceValue) != null ? _b : Infinity);
|
|
13784
|
+
});
|
|
13785
|
+
break;
|
|
13786
|
+
case "price-desc":
|
|
13787
|
+
list.sort((a, b) => {
|
|
13788
|
+
var _a2, _b;
|
|
13789
|
+
return ((_a2 = b.priceValue) != null ? _a2 : -Infinity) - ((_b = a.priceValue) != null ? _b : -Infinity);
|
|
13790
|
+
});
|
|
13791
|
+
break;
|
|
13792
|
+
case "duration-asc":
|
|
13793
|
+
list.sort((a, b) => {
|
|
13794
|
+
var _a2, _b;
|
|
13795
|
+
return ((_a2 = a.nights) != null ? _a2 : Infinity) - ((_b = b.nights) != null ? _b : Infinity);
|
|
13796
|
+
});
|
|
13797
|
+
break;
|
|
13798
|
+
case "duration-desc":
|
|
13799
|
+
list.sort((a, b) => {
|
|
13800
|
+
var _a2, _b;
|
|
13801
|
+
return ((_a2 = b.nights) != null ? _a2 : -Infinity) - ((_b = a.nights) != null ? _b : -Infinity);
|
|
13802
|
+
});
|
|
13803
|
+
break;
|
|
13804
|
+
default:
|
|
13805
|
+
list.sort((a, b) => (b.featured ? 1 : 0) - (a.featured ? 1 : 0));
|
|
13806
|
+
break;
|
|
13807
|
+
}
|
|
13808
|
+
return list;
|
|
13809
|
+
}, [trips, filterValue, sort]);
|
|
13768
13810
|
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
|
|
13769
13811
|
/* @__PURE__ */ jsxs(
|
|
13770
13812
|
"section",
|
|
@@ -13791,10 +13833,9 @@ function CategoryPage2({
|
|
|
13791
13833
|
] }),
|
|
13792
13834
|
siteHeader && /* @__PURE__ */ jsx(
|
|
13793
13835
|
SiteHeader,
|
|
13794
|
-
{
|
|
13795
|
-
links: Array.isArray(siteHeader) ? siteHeader : void 0,
|
|
13836
|
+
__spreadProps(__spreadValues({}, Array.isArray(siteHeader) ? { links: siteHeader } : typeof siteHeader === "object" ? siteHeader : {}), {
|
|
13796
13837
|
position: "overlay"
|
|
13797
|
-
}
|
|
13838
|
+
})
|
|
13798
13839
|
),
|
|
13799
13840
|
/* @__PURE__ */ jsxs("div", { className: "relative mx-auto w-full max-w-6xl px-6 sm:px-8", children: [
|
|
13800
13841
|
breadcrumb && breadcrumb.length > 0 && /* @__PURE__ */ jsx("div", { className: "mb-3 flex items-center gap-1.5 flex-wrap", children: breadcrumb.map((crumb, i) => /* @__PURE__ */ jsxs(React29.Fragment, { children: [
|
|
@@ -13818,7 +13859,7 @@ function CategoryPage2({
|
|
|
13818
13859
|
),
|
|
13819
13860
|
/* @__PURE__ */ 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__ */ jsx("div", { className: "inline-flex gap-5 min-w-max pb-2", children: popularTours.map((trip, i) => {
|
|
13820
13861
|
var _b;
|
|
13821
|
-
const _a2 = trip, { featured: _featured, variant: _variant } = _a2, cardProps = __objRest(_a2, ["featured", "variant"]);
|
|
13862
|
+
const _a2 = trip, { featured: _featured, variant: _variant, filterTags: _filterTags, priceValue: _priceValue } = _a2, cardProps = __objRest(_a2, ["featured", "variant", "filterTags", "priceValue"]);
|
|
13822
13863
|
return /* @__PURE__ */ jsx(
|
|
13823
13864
|
TripCard,
|
|
13824
13865
|
__spreadProps(__spreadValues({}, cardProps), {
|
|
@@ -13845,9 +13886,9 @@ function CategoryPage2({
|
|
|
13845
13886
|
}
|
|
13846
13887
|
) }),
|
|
13847
13888
|
/* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground font-ui mb-5", children: [
|
|
13848
|
-
|
|
13889
|
+
sortedTrips.length,
|
|
13849
13890
|
" ",
|
|
13850
|
-
|
|
13891
|
+
sortedTrips.length === 1 ? "trip" : "trips",
|
|
13851
13892
|
" found"
|
|
13852
13893
|
] }),
|
|
13853
13894
|
(() => {
|
|
@@ -13855,7 +13896,7 @@ function CategoryPage2({
|
|
|
13855
13896
|
const hiddenCount = sortedTrips.length - visibleTrips.length;
|
|
13856
13897
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13857
13898
|
/* @__PURE__ */ 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) => {
|
|
13858
|
-
const _a2 = trip, { featured: _featured } = _a2, cardProps = __objRest(_a2, ["featured"]);
|
|
13899
|
+
const _a2 = trip, { featured: _featured, filterTags: _filterTags, priceValue: _priceValue } = _a2, cardProps = __objRest(_a2, ["featured", "filterTags", "priceValue"]);
|
|
13859
13900
|
return /* @__PURE__ */ jsx(
|
|
13860
13901
|
TripCard,
|
|
13861
13902
|
__spreadProps(__spreadValues({}, cardProps), {
|