@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.cjs CHANGED
@@ -2276,6 +2276,7 @@ function AdventureSection({
2276
2276
  onAddSuggestedTraveller,
2277
2277
  onAddTraveller,
2278
2278
  onUnassignFromAdventure,
2279
+ onCopyFormLink,
2279
2280
  hasSubmitAddTraveller,
2280
2281
  hasSubmitEditTraveller,
2281
2282
  hasConfirmRemoveTraveller,
@@ -2287,7 +2288,11 @@ function AdventureSection({
2287
2288
  var _a, _b, _c, _d, _e, _f, _g;
2288
2289
  const [detailsOpen, setDetailsOpen] = React22__namespace.useState(false);
2289
2290
  const handleCopyUrl = (url) => {
2290
- navigator.clipboard.writeText(url);
2291
+ if (onCopyFormLink) {
2292
+ onCopyFormLink(url);
2293
+ } else {
2294
+ void navigator.clipboard.writeText(url);
2295
+ }
2291
2296
  };
2292
2297
  const people = adventure.slots;
2293
2298
  [
@@ -2590,24 +2595,38 @@ function AdventureSection({
2590
2595
  t.id
2591
2596
  );
2592
2597
  }) }),
2593
- adventure.suggestedTravellers && adventure.suggestedTravellers.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 pt-2", children: [
2594
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground font-ui", children: "Add to this adventure" }),
2595
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: adventure.suggestedTravellers.map((st) => /* @__PURE__ */ jsxRuntime.jsxs(
2596
- "button",
2597
- {
2598
- type: "button",
2599
- onClick: () => onAddSuggestedTraveller == null ? void 0 : onAddSuggestedTraveller(adventure.id, st.id),
2600
- 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",
2601
- children: [
2602
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "w-3 h-3" }),
2603
- st.firstName,
2604
- " ",
2605
- st.lastName
2606
- ]
2607
- },
2608
- st.id
2609
- )) })
2610
- ] }),
2598
+ adventure.suggestedTravellers && adventure.suggestedTravellers.length > 0 && (() => {
2599
+ var _a2;
2600
+ const atCapacity = totalSlots > 0 && adventure.travellers.length >= totalSlots;
2601
+ const atCapacityTooltip = atCapacity ? (_a2 = adventure.atCapacityLabel) != null ? _a2 : "Adventure full" : void 0;
2602
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 pt-2", children: [
2603
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground font-ui", children: "Add to this adventure" }),
2604
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: adventure.suggestedTravellers.map((st) => /* @__PURE__ */ jsxRuntime.jsxs(
2605
+ "button",
2606
+ {
2607
+ type: "button",
2608
+ onClick: () => {
2609
+ if (atCapacity) return;
2610
+ onAddSuggestedTraveller == null ? void 0 : onAddSuggestedTraveller(adventure.id, st.id);
2611
+ },
2612
+ disabled: atCapacity,
2613
+ title: atCapacityTooltip,
2614
+ "aria-disabled": atCapacity,
2615
+ className: cn(
2616
+ "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",
2617
+ "disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none disabled:hover:border-border disabled:hover:text-foreground disabled:hover:bg-transparent"
2618
+ ),
2619
+ children: [
2620
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlusIcon, { className: "w-3 h-3" }),
2621
+ st.firstName,
2622
+ " ",
2623
+ st.lastName
2624
+ ]
2625
+ },
2626
+ st.id
2627
+ )) })
2628
+ ] });
2629
+ })(),
2611
2630
  adventure.travellers.length > 0 && totalSlots > 0 && (() => {
2612
2631
  const completed = adventure.travellers.filter((t) => t.status === "completed").length;
2613
2632
  const percent = Math.round(completed / totalSlots * 100);
@@ -3062,6 +3081,7 @@ function BookingDetails({
3062
3081
  onAddSuggestedTraveller,
3063
3082
  onAddTraveller,
3064
3083
  onUnassignFromAdventure,
3084
+ onCopyFormLink,
3065
3085
  onSubmitAddTraveller,
3066
3086
  onSubmitEditTraveller,
3067
3087
  onConfirmRemoveTraveller,
@@ -3274,6 +3294,7 @@ function BookingDetails({
3274
3294
  onAddSuggestedTraveller,
3275
3295
  onAddTraveller,
3276
3296
  onUnassignFromAdventure,
3297
+ onCopyFormLink,
3277
3298
  hasSubmitAddTraveller,
3278
3299
  hasSubmitEditTraveller,
3279
3300
  hasConfirmRemoveTraveller,
@@ -5538,11 +5559,12 @@ function isoOrDateToString(v) {
5538
5559
  return d.toISOString().slice(0, 10);
5539
5560
  }
5540
5561
  function RegistrationSuccessCard({
5562
+ variant = "full",
5541
5563
  title = "Thanks \u2014 your answers have been received.",
5542
5564
  message = "We'll get in touch if anything else is needed.",
5543
5565
  answersTitle = "Your submitted answers",
5544
- fields,
5545
- answers,
5566
+ fields = [],
5567
+ answers = {},
5546
5568
  dateFormatter = isoOrDateToString,
5547
5569
  formatAnswer,
5548
5570
  className,
@@ -5556,11 +5578,12 @@ function RegistrationSuccessCard({
5556
5578
  tripInfoLabels
5557
5579
  }) {
5558
5580
  var _a, _b, _c, _d, _e;
5559
- const sorted = [...fields].sort((a, b) => {
5581
+ const isMinimal = variant === "minimal";
5582
+ const sorted = isMinimal ? [] : [...fields].sort((a, b) => {
5560
5583
  var _a2, _b2;
5561
5584
  return ((_a2 = a.order) != null ? _a2 : 0) - ((_b2 = b.order) != null ? _b2 : 0);
5562
5585
  }).filter((f) => Object.prototype.hasOwnProperty.call(answers, f.id));
5563
- const hasTripInfo = !!(adventure || booking || traveller);
5586
+ const hasTripInfo = !isMinimal && !!(adventure || booking || traveller);
5564
5587
  const dateRange = adventure ? formatDateRange(adventure, dateFormatter) : null;
5565
5588
  const TL = {
5566
5589
  sectionTitle: (_a = tripInfoLabels == null ? void 0 : tripInfoLabels.sectionTitle) != null ? _a : "Trip info",
@@ -5614,7 +5637,7 @@ function RegistrationSuccessCard({
5614
5637
  answers[f.id]
5615
5638
  ) })
5616
5639
  ] }, f.id)) }) }),
5617
- terms && /* @__PURE__ */ jsxRuntime.jsx(FormSection2, { title: "Terms & Conditions", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm font-ui", children: [
5640
+ !isMinimal && terms && /* @__PURE__ */ jsxRuntime.jsx(FormSection2, { title: "Terms & Conditions", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm font-ui", children: [
5618
5641
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
5619
5642
  "inline-flex h-5 w-5 items-center justify-center rounded-full text-white text-xs font-bold",
5620
5643
  terms.accepted ? "bg-primary" : "bg-destructive"