@planetaexo/design-system 0.9.0 → 0.9.2

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
@@ -288,6 +288,9 @@ interface BookingAdventure {
288
288
  addTravellerLabel?: string;
289
289
  /** Texto curto exibido em mobile (sm:hidden). Default: "Add". */
290
290
  addTravellerShortLabel?: string;
291
+ /** Tooltip exibido quando chips de "Add to this adventure" estão desabilitados por capacidade.
292
+ * Default: "Adventure full". */
293
+ atCapacityLabel?: string;
291
294
  }
292
295
  interface BookingContact {
293
296
  name: string;
@@ -341,6 +344,9 @@ interface BookingDetailsProps {
341
344
  onAddTraveller?: (adventureId: string) => void;
342
345
  /** Quando fornecida, desassocia o viajante da aventura sem deletá-lo da reserva. */
343
346
  onUnassignFromAdventure?: (adventureId: string, travellerId: string) => void;
347
+ /** Quando fornecida, o consumer assume clipboard + feedback visual (ex.: toast). Fallback:
348
+ * `navigator.clipboard.writeText` sem feedback. */
349
+ onCopyFormLink?: (url: string) => void;
344
350
  /** Submit do modal de ADD interno. Usado quando `onAddTraveller` NÃO é passado. */
345
351
  onSubmitAddTraveller?: (adventureId: string, data: TravellerFormData) => Promise<void> | void;
346
352
  /** Submit do modal de EDIT interno. Usado quando `onEditTraveller` NÃO é passado. */
@@ -369,7 +375,7 @@ interface BookingDetailsProps {
369
375
  signOutLabel?: string;
370
376
  className?: string;
371
377
  }
372
- declare function BookingDetails({ bookingId, status, createdAt, contact, agentName, agentContactUrl, agentNameFallback, agentLabel, agentContactLabel, cannotRemoveLastTravellerLabel, adventures, summaryLineItems, subtotal, total, depositInfo, onAddContactAsTraveller, onEditTraveller, onRemoveTraveller, onAddSuggestedTraveller, onAddTraveller, onUnassignFromAdventure, onSubmitAddTraveller, onSubmitEditTraveller, onConfirmRemoveTraveller, travellerFormConfig, addTravellerSaving, editTravellerSaving, removeTravellerSaving, travellerFormError, onPayBalance, onCancelRequest, logoSrc, logoAlt, onSignOut, signOutLabel, className, }: BookingDetailsProps): react_jsx_runtime.JSX.Element;
378
+ declare function BookingDetails({ bookingId, status, createdAt, contact, agentName, agentContactUrl, agentNameFallback, agentLabel, agentContactLabel, cannotRemoveLastTravellerLabel, adventures, summaryLineItems, subtotal, total, depositInfo, onAddContactAsTraveller, onEditTraveller, onRemoveTraveller, onAddSuggestedTraveller, onAddTraveller, onUnassignFromAdventure, onCopyFormLink, onSubmitAddTraveller, onSubmitEditTraveller, onConfirmRemoveTraveller, travellerFormConfig, addTravellerSaving, editTravellerSaving, removeTravellerSaving, travellerFormError, onPayBalance, onCancelRequest, logoSrc, logoAlt, onSignOut, signOutLabel, className, }: BookingDetailsProps): react_jsx_runtime.JSX.Element;
373
379
 
374
380
  interface BookingConfirmationLabels {
375
381
  ctaButton?: string;
@@ -721,11 +727,16 @@ interface RegistrationFormProps {
721
727
  declare const TERMS_ACCEPT_KEY = "__registrationTermsAccepted";
722
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;
723
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";
724
735
  title?: string;
725
736
  message?: string;
726
737
  answersTitle?: string;
727
- fields: RegistrationField[];
728
- answers: RegistrationFormValues;
738
+ fields?: RegistrationField[];
739
+ answers?: RegistrationFormValues;
729
740
  dateFormatter?: (date: Date | string | undefined) => string;
730
741
  formatAnswer?: (field: RegistrationField, value: RegistrationFieldValue) => string;
731
742
  className?: string;
@@ -749,7 +760,7 @@ interface RegistrationSuccessCardProps {
749
760
  travellerLabel?: string;
750
761
  };
751
762
  }
752
- 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;
763
+ declare function RegistrationSuccessCard({ variant, title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, logo, logoAlt, terms, adventure, booking, traveller, tripInfoLabels, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
753
764
 
754
765
  interface FloatingInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
755
766
  label: string;
package/dist/index.d.ts CHANGED
@@ -288,6 +288,9 @@ interface BookingAdventure {
288
288
  addTravellerLabel?: string;
289
289
  /** Texto curto exibido em mobile (sm:hidden). Default: "Add". */
290
290
  addTravellerShortLabel?: string;
291
+ /** Tooltip exibido quando chips de "Add to this adventure" estão desabilitados por capacidade.
292
+ * Default: "Adventure full". */
293
+ atCapacityLabel?: string;
291
294
  }
292
295
  interface BookingContact {
293
296
  name: string;
@@ -341,6 +344,9 @@ interface BookingDetailsProps {
341
344
  onAddTraveller?: (adventureId: string) => void;
342
345
  /** Quando fornecida, desassocia o viajante da aventura sem deletá-lo da reserva. */
343
346
  onUnassignFromAdventure?: (adventureId: string, travellerId: string) => void;
347
+ /** Quando fornecida, o consumer assume clipboard + feedback visual (ex.: toast). Fallback:
348
+ * `navigator.clipboard.writeText` sem feedback. */
349
+ onCopyFormLink?: (url: string) => void;
344
350
  /** Submit do modal de ADD interno. Usado quando `onAddTraveller` NÃO é passado. */
345
351
  onSubmitAddTraveller?: (adventureId: string, data: TravellerFormData) => Promise<void> | void;
346
352
  /** Submit do modal de EDIT interno. Usado quando `onEditTraveller` NÃO é passado. */
@@ -369,7 +375,7 @@ interface BookingDetailsProps {
369
375
  signOutLabel?: string;
370
376
  className?: string;
371
377
  }
372
- declare function BookingDetails({ bookingId, status, createdAt, contact, agentName, agentContactUrl, agentNameFallback, agentLabel, agentContactLabel, cannotRemoveLastTravellerLabel, adventures, summaryLineItems, subtotal, total, depositInfo, onAddContactAsTraveller, onEditTraveller, onRemoveTraveller, onAddSuggestedTraveller, onAddTraveller, onUnassignFromAdventure, onSubmitAddTraveller, onSubmitEditTraveller, onConfirmRemoveTraveller, travellerFormConfig, addTravellerSaving, editTravellerSaving, removeTravellerSaving, travellerFormError, onPayBalance, onCancelRequest, logoSrc, logoAlt, onSignOut, signOutLabel, className, }: BookingDetailsProps): react_jsx_runtime.JSX.Element;
378
+ declare function BookingDetails({ bookingId, status, createdAt, contact, agentName, agentContactUrl, agentNameFallback, agentLabel, agentContactLabel, cannotRemoveLastTravellerLabel, adventures, summaryLineItems, subtotal, total, depositInfo, onAddContactAsTraveller, onEditTraveller, onRemoveTraveller, onAddSuggestedTraveller, onAddTraveller, onUnassignFromAdventure, onCopyFormLink, onSubmitAddTraveller, onSubmitEditTraveller, onConfirmRemoveTraveller, travellerFormConfig, addTravellerSaving, editTravellerSaving, removeTravellerSaving, travellerFormError, onPayBalance, onCancelRequest, logoSrc, logoAlt, onSignOut, signOutLabel, className, }: BookingDetailsProps): react_jsx_runtime.JSX.Element;
373
379
 
374
380
  interface BookingConfirmationLabels {
375
381
  ctaButton?: string;
@@ -721,11 +727,16 @@ interface RegistrationFormProps {
721
727
  declare const TERMS_ACCEPT_KEY = "__registrationTermsAccepted";
722
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;
723
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";
724
735
  title?: string;
725
736
  message?: string;
726
737
  answersTitle?: string;
727
- fields: RegistrationField[];
728
- answers: RegistrationFormValues;
738
+ fields?: RegistrationField[];
739
+ answers?: RegistrationFormValues;
729
740
  dateFormatter?: (date: Date | string | undefined) => string;
730
741
  formatAnswer?: (field: RegistrationField, value: RegistrationFieldValue) => string;
731
742
  className?: string;
@@ -749,7 +760,7 @@ interface RegistrationSuccessCardProps {
749
760
  travellerLabel?: string;
750
761
  };
751
762
  }
752
- 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;
763
+ declare function RegistrationSuccessCard({ variant, title, message, answersTitle, fields, answers, dateFormatter, formatAnswer, className, actions, logo, logoAlt, terms, adventure, booking, traveller, tripInfoLabels, }: RegistrationSuccessCardProps): react_jsx_runtime.JSX.Element;
753
764
 
754
765
  interface FloatingInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
755
766
  label: string;
package/dist/index.js CHANGED
@@ -2255,6 +2255,7 @@ function AdventureSection({
2255
2255
  onAddSuggestedTraveller,
2256
2256
  onAddTraveller,
2257
2257
  onUnassignFromAdventure,
2258
+ onCopyFormLink,
2258
2259
  hasSubmitAddTraveller,
2259
2260
  hasSubmitEditTraveller,
2260
2261
  hasConfirmRemoveTraveller,
@@ -2266,7 +2267,11 @@ function AdventureSection({
2266
2267
  var _a, _b, _c, _d, _e, _f, _g;
2267
2268
  const [detailsOpen, setDetailsOpen] = React22.useState(false);
2268
2269
  const handleCopyUrl = (url) => {
2269
- navigator.clipboard.writeText(url);
2270
+ if (onCopyFormLink) {
2271
+ onCopyFormLink(url);
2272
+ } else {
2273
+ void navigator.clipboard.writeText(url);
2274
+ }
2270
2275
  };
2271
2276
  const people = adventure.slots;
2272
2277
  [
@@ -2569,24 +2574,38 @@ function AdventureSection({
2569
2574
  t.id
2570
2575
  );
2571
2576
  }) }),
2572
- adventure.suggestedTravellers && adventure.suggestedTravellers.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 pt-2", children: [
2573
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground font-ui", children: "Add to this adventure" }),
2574
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: adventure.suggestedTravellers.map((st) => /* @__PURE__ */ jsxs(
2575
- "button",
2576
- {
2577
- type: "button",
2578
- onClick: () => onAddSuggestedTraveller == null ? void 0 : onAddSuggestedTraveller(adventure.id, st.id),
2579
- className: "flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-ui text-foreground hover:border-primary hover:text-primary hover:bg-primary/5 transition-colors",
2580
- children: [
2581
- /* @__PURE__ */ jsx(PlusIcon, { className: "w-3 h-3" }),
2582
- st.firstName,
2583
- " ",
2584
- st.lastName
2585
- ]
2586
- },
2587
- st.id
2588
- )) })
2589
- ] }),
2577
+ adventure.suggestedTravellers && adventure.suggestedTravellers.length > 0 && (() => {
2578
+ var _a2;
2579
+ const atCapacity = totalSlots > 0 && adventure.travellers.length >= totalSlots;
2580
+ const atCapacityTooltip = atCapacity ? (_a2 = adventure.atCapacityLabel) != null ? _a2 : "Adventure full" : void 0;
2581
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 pt-2", children: [
2582
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground font-ui", children: "Add to this adventure" }),
2583
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: adventure.suggestedTravellers.map((st) => /* @__PURE__ */ jsxs(
2584
+ "button",
2585
+ {
2586
+ type: "button",
2587
+ onClick: () => {
2588
+ if (atCapacity) return;
2589
+ onAddSuggestedTraveller == null ? void 0 : onAddSuggestedTraveller(adventure.id, st.id);
2590
+ },
2591
+ disabled: atCapacity,
2592
+ title: atCapacityTooltip,
2593
+ "aria-disabled": atCapacity,
2594
+ className: cn(
2595
+ "flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-ui text-foreground hover:border-primary hover:text-primary hover:bg-primary/5 transition-colors",
2596
+ "disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none disabled:hover:border-border disabled:hover:text-foreground disabled:hover:bg-transparent"
2597
+ ),
2598
+ children: [
2599
+ /* @__PURE__ */ jsx(PlusIcon, { className: "w-3 h-3" }),
2600
+ st.firstName,
2601
+ " ",
2602
+ st.lastName
2603
+ ]
2604
+ },
2605
+ st.id
2606
+ )) })
2607
+ ] });
2608
+ })(),
2590
2609
  adventure.travellers.length > 0 && totalSlots > 0 && (() => {
2591
2610
  const completed = adventure.travellers.filter((t) => t.status === "completed").length;
2592
2611
  const percent = Math.round(completed / totalSlots * 100);
@@ -3041,6 +3060,7 @@ function BookingDetails({
3041
3060
  onAddSuggestedTraveller,
3042
3061
  onAddTraveller,
3043
3062
  onUnassignFromAdventure,
3063
+ onCopyFormLink,
3044
3064
  onSubmitAddTraveller,
3045
3065
  onSubmitEditTraveller,
3046
3066
  onConfirmRemoveTraveller,
@@ -3253,6 +3273,7 @@ function BookingDetails({
3253
3273
  onAddSuggestedTraveller,
3254
3274
  onAddTraveller,
3255
3275
  onUnassignFromAdventure,
3276
+ onCopyFormLink,
3256
3277
  hasSubmitAddTraveller,
3257
3278
  hasSubmitEditTraveller,
3258
3279
  hasConfirmRemoveTraveller,
@@ -5517,11 +5538,12 @@ function isoOrDateToString(v) {
5517
5538
  return d.toISOString().slice(0, 10);
5518
5539
  }
5519
5540
  function RegistrationSuccessCard({
5541
+ variant = "full",
5520
5542
  title = "Thanks \u2014 your answers have been received.",
5521
5543
  message = "We'll get in touch if anything else is needed.",
5522
5544
  answersTitle = "Your submitted answers",
5523
- fields,
5524
- answers,
5545
+ fields = [],
5546
+ answers = {},
5525
5547
  dateFormatter = isoOrDateToString,
5526
5548
  formatAnswer,
5527
5549
  className,
@@ -5535,11 +5557,12 @@ function RegistrationSuccessCard({
5535
5557
  tripInfoLabels
5536
5558
  }) {
5537
5559
  var _a, _b, _c, _d, _e;
5538
- const sorted = [...fields].sort((a, b) => {
5560
+ const isMinimal = variant === "minimal";
5561
+ const sorted = isMinimal ? [] : [...fields].sort((a, b) => {
5539
5562
  var _a2, _b2;
5540
5563
  return ((_a2 = a.order) != null ? _a2 : 0) - ((_b2 = b.order) != null ? _b2 : 0);
5541
5564
  }).filter((f) => Object.prototype.hasOwnProperty.call(answers, f.id));
5542
- const hasTripInfo = !!(adventure || booking || traveller);
5565
+ const hasTripInfo = !isMinimal && !!(adventure || booking || traveller);
5543
5566
  const dateRange = adventure ? formatDateRange(adventure, dateFormatter) : null;
5544
5567
  const TL = {
5545
5568
  sectionTitle: (_a = tripInfoLabels == null ? void 0 : tripInfoLabels.sectionTitle) != null ? _a : "Trip info",
@@ -5593,7 +5616,7 @@ function RegistrationSuccessCard({
5593
5616
  answers[f.id]
5594
5617
  ) })
5595
5618
  ] }, f.id)) }) }),
5596
- terms && /* @__PURE__ */ jsx(FormSection2, { title: "Terms & Conditions", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-ui", children: [
5619
+ !isMinimal && terms && /* @__PURE__ */ jsx(FormSection2, { title: "Terms & Conditions", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-ui", children: [
5597
5620
  /* @__PURE__ */ jsx("div", { className: cn(
5598
5621
  "inline-flex h-5 w-5 items-center justify-center rounded-full text-white text-xs font-bold",
5599
5622
  terms.accepted ? "bg-primary" : "bg-destructive"