@planetaexo/design-system 0.9.1 → 0.9.3

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
@@ -727,11 +727,16 @@ interface RegistrationFormProps {
727
727
  declare const TERMS_ACCEPT_KEY = "__registrationTermsAccepted";
728
728
  declare function RegistrationForm({ logo, logoAlt, heroImage, heroImageAlt, title, subtitle, adventure, booking, traveller, fields, values, defaultValues, onChange, onSubmit, onValidate, externalErrors, terms, includeTerms, loading, error, defaultPhoneCountry, dateFormatter, labels, className, readOnly, }: RegistrationFormProps): react_jsx_runtime.JSX.Element;
729
729
  interface RegistrationSuccessCardProps {
730
+ /**
731
+ * `"full"` (default): renders trip info, submitted answers and terms sections.
732
+ * `"minimal"`: renders only logo/icon, title, message and the `actions` slot.
733
+ */
734
+ variant?: "full" | "minimal";
730
735
  title?: string;
731
736
  message?: string;
732
737
  answersTitle?: string;
733
- fields: RegistrationField[];
734
- answers: RegistrationFormValues;
738
+ fields?: RegistrationField[];
739
+ answers?: RegistrationFormValues;
735
740
  dateFormatter?: (date: Date | string | undefined) => string;
736
741
  formatAnswer?: (field: RegistrationField, value: RegistrationFieldValue) => string;
737
742
  className?: string;
@@ -744,6 +749,19 @@ interface RegistrationSuccessCardProps {
744
749
  markdown: string;
745
750
  accepted: boolean;
746
751
  } | null;
752
+ /**
753
+ * Layout of the "Terms & Conditions" section.
754
+ * - `"summary"` (default): shows only the accepted/not-accepted indicator.
755
+ * - `"full"`: shows the indicator **and** the full `terms.markdown` content
756
+ * (plain text, preserving line breaks). Used by the PDF export.
757
+ */
758
+ termsLayout?: "summary" | "full";
759
+ /** i18n-friendly labels for the Terms section. Defaults to English. */
760
+ termsLabels?: {
761
+ title?: string;
762
+ accepted?: string;
763
+ notAccepted?: string;
764
+ };
747
765
  adventure?: RegistrationAdventure | null;
748
766
  booking?: RegistrationBooking | null;
749
767
  traveller?: RegistrationTraveller | null;
@@ -755,7 +773,7 @@ interface RegistrationSuccessCardProps {
755
773
  travellerLabel?: string;
756
774
  };
757
775
  }
758
- 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;
776
+ declare function RegistrationSuccessCard({ variant, title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, logo, logoAlt, terms, termsLayout, termsLabels, adventure, booking, traveller, tripInfoLabels, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
759
777
 
760
778
  interface FloatingInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
761
779
  label: string;
package/dist/index.d.ts CHANGED
@@ -727,11 +727,16 @@ interface RegistrationFormProps {
727
727
  declare const TERMS_ACCEPT_KEY = "__registrationTermsAccepted";
728
728
  declare function RegistrationForm({ logo, logoAlt, heroImage, heroImageAlt, title, subtitle, adventure, booking, traveller, fields, values, defaultValues, onChange, onSubmit, onValidate, externalErrors, terms, includeTerms, loading, error, defaultPhoneCountry, dateFormatter, labels, className, readOnly, }: RegistrationFormProps): react_jsx_runtime.JSX.Element;
729
729
  interface RegistrationSuccessCardProps {
730
+ /**
731
+ * `"full"` (default): renders trip info, submitted answers and terms sections.
732
+ * `"minimal"`: renders only logo/icon, title, message and the `actions` slot.
733
+ */
734
+ variant?: "full" | "minimal";
730
735
  title?: string;
731
736
  message?: string;
732
737
  answersTitle?: string;
733
- fields: RegistrationField[];
734
- answers: RegistrationFormValues;
738
+ fields?: RegistrationField[];
739
+ answers?: RegistrationFormValues;
735
740
  dateFormatter?: (date: Date | string | undefined) => string;
736
741
  formatAnswer?: (field: RegistrationField, value: RegistrationFieldValue) => string;
737
742
  className?: string;
@@ -744,6 +749,19 @@ interface RegistrationSuccessCardProps {
744
749
  markdown: string;
745
750
  accepted: boolean;
746
751
  } | null;
752
+ /**
753
+ * Layout of the "Terms & Conditions" section.
754
+ * - `"summary"` (default): shows only the accepted/not-accepted indicator.
755
+ * - `"full"`: shows the indicator **and** the full `terms.markdown` content
756
+ * (plain text, preserving line breaks). Used by the PDF export.
757
+ */
758
+ termsLayout?: "summary" | "full";
759
+ /** i18n-friendly labels for the Terms section. Defaults to English. */
760
+ termsLabels?: {
761
+ title?: string;
762
+ accepted?: string;
763
+ notAccepted?: string;
764
+ };
747
765
  adventure?: RegistrationAdventure | null;
748
766
  booking?: RegistrationBooking | null;
749
767
  traveller?: RegistrationTraveller | null;
@@ -755,7 +773,7 @@ interface RegistrationSuccessCardProps {
755
773
  travellerLabel?: string;
756
774
  };
757
775
  }
758
- 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;
776
+ declare function RegistrationSuccessCard({ variant, title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, logo, logoAlt, terms, termsLayout, termsLabels, adventure, booking, traveller, tripInfoLabels, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
759
777
 
760
778
  interface FloatingInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
761
779
  label: string;
package/dist/index.js CHANGED
@@ -5538,11 +5538,12 @@ function isoOrDateToString(v) {
5538
5538
  return d.toISOString().slice(0, 10);
5539
5539
  }
5540
5540
  function RegistrationSuccessCard({
5541
+ variant = "full",
5541
5542
  title = "Thanks \u2014 your answers have been received.",
5542
5543
  message = "We'll get in touch if anything else is needed.",
5543
5544
  answersTitle = "Your submitted answers",
5544
- fields,
5545
- answers,
5545
+ fields = [],
5546
+ answers = {},
5546
5547
  dateFormatter = isoOrDateToString,
5547
5548
  formatAnswer,
5548
5549
  className,
@@ -5550,17 +5551,20 @@ function RegistrationSuccessCard({
5550
5551
  logo,
5551
5552
  logoAlt = "PlanetaEXO",
5552
5553
  terms,
5554
+ termsLayout = "summary",
5555
+ termsLabels,
5553
5556
  adventure,
5554
5557
  booking,
5555
5558
  traveller,
5556
5559
  tripInfoLabels
5557
5560
  }) {
5558
- var _a, _b, _c, _d, _e;
5559
- const sorted = [...fields].sort((a, b) => {
5561
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5562
+ const isMinimal = variant === "minimal";
5563
+ const sorted = isMinimal ? [] : [...fields].sort((a, b) => {
5560
5564
  var _a2, _b2;
5561
5565
  return ((_a2 = a.order) != null ? _a2 : 0) - ((_b2 = b.order) != null ? _b2 : 0);
5562
5566
  }).filter((f) => Object.prototype.hasOwnProperty.call(answers, f.id));
5563
- const hasTripInfo = !!(adventure || booking || traveller);
5567
+ const hasTripInfo = !isMinimal && !!(adventure || booking || traveller);
5564
5568
  const dateRange = adventure ? formatDateRange(adventure, dateFormatter) : null;
5565
5569
  const TL = {
5566
5570
  sectionTitle: (_a = tripInfoLabels == null ? void 0 : tripInfoLabels.sectionTitle) != null ? _a : "Trip info",
@@ -5586,40 +5590,43 @@ function RegistrationSuccessCard({
5586
5590
  message && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground font-ui", children: message })
5587
5591
  ] }),
5588
5592
  hasTripInfo && /* @__PURE__ */ jsx(FormSection2, { title: TL.sectionTitle, children: /* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-y-3 text-sm font-ui", children: [
5589
- adventure && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5590
- /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.adventureLabel }),
5591
- /* @__PURE__ */ jsx("dd", { className: "text-foreground font-medium text-right min-w-0 break-words", children: adventure.name })
5593
+ adventure && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-x-4", children: [
5594
+ /* @__PURE__ */ jsx("dt", { className: "w-1/2 text-muted-foreground break-words", children: TL.adventureLabel }),
5595
+ /* @__PURE__ */ jsx("dd", { className: "w-1/2 text-foreground font-medium text-right min-w-0 break-words", children: adventure.name })
5592
5596
  ] }),
5593
- dateRange && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5594
- /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: (adventure == null ? void 0 : adventure.startDate) && (adventure == null ? void 0 : adventure.endDate) ? "Dates" : "Date" }),
5595
- /* @__PURE__ */ jsx("dd", { className: "text-foreground text-right min-w-0", children: dateRange })
5597
+ dateRange && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-x-4", children: [
5598
+ /* @__PURE__ */ jsx("dt", { className: "w-1/2 text-muted-foreground break-words", children: (adventure == null ? void 0 : adventure.startDate) && (adventure == null ? void 0 : adventure.endDate) ? "Dates" : "Date" }),
5599
+ /* @__PURE__ */ jsx("dd", { className: "w-1/2 text-foreground text-right min-w-0 break-words", children: dateRange })
5596
5600
  ] }),
5597
- (adventure == null ? void 0 : adventure.partnerName) && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5598
- /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.partnerLabel }),
5599
- /* @__PURE__ */ jsx("dd", { className: "text-foreground text-right min-w-0", children: adventure.partnerName })
5601
+ (adventure == null ? void 0 : adventure.partnerName) && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-x-4", children: [
5602
+ /* @__PURE__ */ jsx("dt", { className: "w-1/2 text-muted-foreground break-words", children: TL.partnerLabel }),
5603
+ /* @__PURE__ */ jsx("dd", { className: "w-1/2 text-foreground text-right min-w-0 break-words", children: adventure.partnerName })
5600
5604
  ] }),
5601
- booking && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5602
- /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.bookingLabel }),
5603
- /* @__PURE__ */ jsx("dd", { className: "text-foreground font-mono tabular-nums text-right min-w-0", children: booking.id })
5605
+ booking && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-x-4", children: [
5606
+ /* @__PURE__ */ jsx("dt", { className: "w-1/2 text-muted-foreground break-words", children: TL.bookingLabel }),
5607
+ /* @__PURE__ */ jsx("dd", { className: "w-1/2 text-foreground font-mono tabular-nums text-right min-w-0 break-words", children: booking.id })
5604
5608
  ] }),
5605
- traveller && /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
5606
- /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: TL.travellerLabel }),
5607
- /* @__PURE__ */ jsx("dd", { className: "text-foreground font-medium text-right min-w-0 break-words", children: traveller.fullName })
5609
+ traveller && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-x-4", children: [
5610
+ /* @__PURE__ */ jsx("dt", { className: "w-1/2 text-muted-foreground break-words", children: TL.travellerLabel }),
5611
+ /* @__PURE__ */ jsx("dd", { className: "w-1/2 text-foreground font-medium text-right min-w-0 break-words", children: traveller.fullName })
5608
5612
  ] })
5609
5613
  ] }) }),
5610
- 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: [
5611
- /* @__PURE__ */ jsx("dt", { className: "text-muted-foreground", children: f.label }),
5612
- /* @__PURE__ */ jsx("dd", { className: "text-foreground text-right min-w-0 break-words", children: (formatAnswer != null ? formatAnswer : ((field, v) => defaultFormatAnswer(field, v, dateFormatter)))(
5614
+ 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 gap-x-4", children: [
5615
+ /* @__PURE__ */ jsx("dt", { className: "w-1/2 text-muted-foreground break-words", children: f.label }),
5616
+ /* @__PURE__ */ jsx("dd", { className: "w-1/2 text-foreground text-right min-w-0 break-words", children: (formatAnswer != null ? formatAnswer : ((field, v) => defaultFormatAnswer(field, v, dateFormatter)))(
5613
5617
  f,
5614
5618
  answers[f.id]
5615
5619
  ) })
5616
5620
  ] }, f.id)) }) }),
5617
- terms && /* @__PURE__ */ jsx(FormSection2, { title: "Terms & Conditions", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-ui", children: [
5618
- /* @__PURE__ */ jsx("div", { className: cn(
5619
- "inline-flex h-5 w-5 items-center justify-center rounded-full text-white text-xs font-bold",
5620
- terms.accepted ? "bg-primary" : "bg-destructive"
5621
- ), children: terms.accepted ? "\u2713" : "\u2717" }),
5622
- /* @__PURE__ */ jsx("span", { className: terms.accepted ? "text-primary font-medium" : "text-destructive font-medium", children: terms.accepted ? "Accepted" : "Not accepted" })
5621
+ !isMinimal && terms && /* @__PURE__ */ jsx(FormSection2, { title: (_f = termsLabels == null ? void 0 : termsLabels.title) != null ? _f : "Terms & Conditions", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 text-sm font-ui", children: [
5622
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
5623
+ /* @__PURE__ */ jsx("div", { className: cn(
5624
+ "inline-flex h-5 w-5 items-center justify-center rounded-full text-white text-xs font-bold",
5625
+ terms.accepted ? "bg-primary" : "bg-destructive"
5626
+ ), children: terms.accepted ? "\u2713" : "\u2717" }),
5627
+ /* @__PURE__ */ jsx("span", { className: terms.accepted ? "text-primary font-medium" : "text-destructive font-medium", children: terms.accepted ? (_g = termsLabels == null ? void 0 : termsLabels.accepted) != null ? _g : "Accepted" : (_h = termsLabels == null ? void 0 : termsLabels.notAccepted) != null ? _h : "Not accepted" })
5628
+ ] }),
5629
+ termsLayout === "full" && terms.markdown.trim().length > 0 && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground font-ui", children: terms.markdown }) })
5623
5630
  ] }) })
5624
5631
  ] });
5625
5632
  }