@planetaexo/design-system 0.5.2 → 0.5.4

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.d.cts CHANGED
@@ -626,8 +626,26 @@ interface RegistrationSuccessCardProps {
626
626
  formatAnswer?: (field: RegistrationField, value: RegistrationFieldValue) => string;
627
627
  className?: string;
628
628
  actions?: React.ReactNode;
629
+ /** Logo URL displayed above the title. Pass `null` to hide the logo. */
630
+ logo?: string | null;
631
+ logoAlt?: string;
632
+ /** Terms section rendered at the bottom of the card. */
633
+ terms?: {
634
+ markdown: string;
635
+ accepted: boolean;
636
+ } | null;
637
+ adventure?: RegistrationAdventure | null;
638
+ booking?: RegistrationBooking | null;
639
+ traveller?: RegistrationTraveller | null;
640
+ tripInfoLabels?: {
641
+ sectionTitle?: string;
642
+ adventureLabel?: string;
643
+ bookingLabel?: string;
644
+ partnerLabel?: string;
645
+ travellerLabel?: string;
646
+ };
629
647
  }
630
- declare function RegistrationSuccessCard({ title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
648
+ declare function RegistrationSuccessCard({ title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, logo, logoAlt, terms, adventure, booking, traveller, tripInfoLabels, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
631
649
 
632
650
  interface FloatingInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
633
651
  label: string;
package/dist/index.d.ts CHANGED
@@ -626,8 +626,26 @@ interface RegistrationSuccessCardProps {
626
626
  formatAnswer?: (field: RegistrationField, value: RegistrationFieldValue) => string;
627
627
  className?: string;
628
628
  actions?: React.ReactNode;
629
+ /** Logo URL displayed above the title. Pass `null` to hide the logo. */
630
+ logo?: string | null;
631
+ logoAlt?: string;
632
+ /** Terms section rendered at the bottom of the card. */
633
+ terms?: {
634
+ markdown: string;
635
+ accepted: boolean;
636
+ } | null;
637
+ adventure?: RegistrationAdventure | null;
638
+ booking?: RegistrationBooking | null;
639
+ traveller?: RegistrationTraveller | null;
640
+ tripInfoLabels?: {
641
+ sectionTitle?: string;
642
+ adventureLabel?: string;
643
+ bookingLabel?: string;
644
+ partnerLabel?: string;
645
+ travellerLabel?: string;
646
+ };
629
647
  }
630
- declare function RegistrationSuccessCard({ title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
648
+ declare function RegistrationSuccessCard({ title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, logo, logoAlt, terms, adventure, booking, traveller, tripInfoLabels, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
631
649
 
632
650
  interface FloatingInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
633
651
  label: string;
package/dist/index.js CHANGED
@@ -5075,26 +5075,84 @@ function RegistrationSuccessCard({
5075
5075
  dateFormatter = isoOrDateToString,
5076
5076
  formatAnswer,
5077
5077
  className,
5078
- actions
5078
+ actions,
5079
+ logo,
5080
+ logoAlt = "PlanetaEXO",
5081
+ terms,
5082
+ adventure,
5083
+ booking,
5084
+ traveller,
5085
+ tripInfoLabels
5079
5086
  }) {
5087
+ var _a, _b, _c, _d, _e;
5080
5088
  const sorted = [...fields].sort((a, b) => {
5081
- var _a, _b;
5082
- return ((_a = a.order) != null ? _a : 0) - ((_b = b.order) != null ? _b : 0);
5089
+ var _a2, _b2;
5090
+ return ((_a2 = a.order) != null ? _a2 : 0) - ((_b2 = b.order) != null ? _b2 : 0);
5083
5091
  }).filter((f) => Object.prototype.hasOwnProperty.call(answers, f.id));
5092
+ const hasTripInfo = !!(adventure || booking || traveller);
5093
+ const dateRange = adventure ? formatDateRange(adventure, dateFormatter) : null;
5094
+ const TL = {
5095
+ sectionTitle: (_a = tripInfoLabels == null ? void 0 : tripInfoLabels.sectionTitle) != null ? _a : "Trip info",
5096
+ adventureLabel: (_b = tripInfoLabels == null ? void 0 : tripInfoLabels.adventureLabel) != null ? _b : "Adventure",
5097
+ bookingLabel: (_c = tripInfoLabels == null ? void 0 : tripInfoLabels.bookingLabel) != null ? _c : "Booking",
5098
+ partnerLabel: (_d = tripInfoLabels == null ? void 0 : tripInfoLabels.partnerLabel) != null ? _d : "Partner",
5099
+ travellerLabel: (_e = tripInfoLabels == null ? void 0 : tripInfoLabels.travellerLabel) != null ? _e : "Traveller"
5100
+ };
5084
5101
  return /* @__PURE__ */ jsxs("div", { className: cn("rounded-xl border border-border bg-card p-6 sm:p-8 flex flex-col gap-10", className), children: [
5085
5102
  actions && /* @__PURE__ */ jsx("div", { className: "flex gap-3 justify-end", children: actions }),
5086
5103
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
5087
- /* @__PURE__ */ jsx("div", { className: "inline-flex h-14 w-14 items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsx(CircleCheckIcon, { size: 28 }) }),
5104
+ logo !== null && /* eslint-disable-next-line @next/next/no-img-element */
5105
+ /* @__PURE__ */ jsx(
5106
+ "img",
5107
+ {
5108
+ src: logo != null ? logo : "/logo-planetaexo.png",
5109
+ alt: logoAlt,
5110
+ className: "h-10 w-auto object-contain"
5111
+ }
5112
+ ),
5113
+ logo === void 0 && /* @__PURE__ */ jsx("div", { className: "inline-flex h-14 w-14 items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsx(CircleCheckIcon, { size: 28 }) }),
5088
5114
  /* @__PURE__ */ jsx("h2", { className: "text-2xl font-black uppercase tracking-wide text-foreground font-heading leading-tight", children: title }),
5089
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-ui", children: message })
5115
+ message && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-ui", children: message })
5090
5116
  ] }),
5117
+ hasTripInfo && /* @__PURE__ */ jsx(FormSection2, { title: TL.sectionTitle, children: /* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-y-3 text-sm font-ui", children: [
5118
+ adventure && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5119
+ /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.adventureLabel }),
5120
+ /* @__PURE__ */ jsx("dd", { className: "text-foreground font-medium text-right min-w-0 break-words", children: adventure.name })
5121
+ ] }),
5122
+ dateRange && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5123
+ /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: (adventure == null ? void 0 : adventure.startDate) && (adventure == null ? void 0 : adventure.endDate) ? "Dates" : "Date" }),
5124
+ /* @__PURE__ */ jsx("dd", { className: "text-foreground text-right min-w-0", children: dateRange })
5125
+ ] }),
5126
+ (adventure == null ? void 0 : adventure.partnerName) && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5127
+ /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.partnerLabel }),
5128
+ /* @__PURE__ */ jsx("dd", { className: "text-foreground text-right min-w-0", children: adventure.partnerName })
5129
+ ] }),
5130
+ booking && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5131
+ /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.bookingLabel }),
5132
+ /* @__PURE__ */ jsx("dd", { className: "text-foreground font-mono tabular-nums text-right min-w-0", children: booking.id })
5133
+ ] }),
5134
+ traveller && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5135
+ /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.travellerLabel }),
5136
+ /* @__PURE__ */ jsx("dd", { className: "text-foreground font-medium text-right min-w-0 break-words", children: traveller.fullName })
5137
+ ] })
5138
+ ] }) }),
5091
5139
  sorted.length > 0 && /* @__PURE__ */ jsx(FormSection2, { title: answersTitle, children: /* @__PURE__ */ jsx("dl", { className: "flex flex-col gap-y-3 text-sm font-ui", children: sorted.map((f) => /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5092
5140
  /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: f.label }),
5093
5141
  /* @__PURE__ */ jsx("dd", { className: "text-foreground text-right min-w-0 break-words", children: (formatAnswer != null ? formatAnswer : ((field, v) => defaultFormatAnswer(field, v, dateFormatter)))(
5094
5142
  f,
5095
5143
  answers[f.id]
5096
5144
  ) })
5097
- ] }, f.id)) }) })
5145
+ ] }, f.id)) }) }),
5146
+ terms && /* @__PURE__ */ jsxs(FormSection2, { title: "Terms & Conditions", children: [
5147
+ /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-muted/30 p-4 max-h-48 overflow-y-auto", children: /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap text-sm leading-relaxed text-foreground font-ui", children: terms.markdown }) }),
5148
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-ui", children: [
5149
+ /* @__PURE__ */ jsx("div", { className: cn(
5150
+ "inline-flex h-5 w-5 items-center justify-center rounded-full text-white text-xs",
5151
+ terms.accepted ? "bg-primary" : "bg-destructive"
5152
+ ), children: terms.accepted ? "\u2713" : "\u2717" }),
5153
+ /* @__PURE__ */ jsx("span", { className: terms.accepted ? "text-primary font-medium" : "text-destructive font-medium", children: terms.accepted ? "Accepted" : "Not accepted" })
5154
+ ] })
5155
+ ] })
5098
5156
  ] });
5099
5157
  }
5100
5158
  var OTPCodeInput = ({