@planetaexo/design-system 0.18.0 → 0.20.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 CHANGED
@@ -1282,7 +1282,11 @@ function Alert({ variant = "info", children, className }) {
1282
1282
  }
1283
1283
  );
1284
1284
  }
1285
- function AdventureCard({ adventure, labels }) {
1285
+ function AdventureCard({
1286
+ adventure,
1287
+ labels,
1288
+ interactionsDisabled
1289
+ }) {
1286
1290
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1287
1291
  const isControlled = (_b = (_a = adventure.optionals) == null ? void 0 : _a.some((o) => o.onCheckedChange !== void 0)) != null ? _b : false;
1288
1292
  const [checkedInternal, setCheckedInternal] = React23__namespace.useState(
@@ -1351,15 +1355,19 @@ function AdventureCard({ adventure, labels }) {
1351
1355
  const currentQty = (_c2 = opt.quantity) != null ? _c2 : minQty;
1352
1356
  const canDec = currentQty > minQty;
1353
1357
  const canInc = currentQty < maxQty;
1354
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1.5", children: [
1355
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
1358
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-wrap items-center gap-x-3 gap-y-1.5", interactionsDisabled && "opacity-60"), children: [
1359
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: cn("flex items-center gap-3 group", interactionsDisabled ? "cursor-not-allowed" : "cursor-pointer"), children: [
1356
1360
  /* @__PURE__ */ jsxRuntime.jsx(
1357
1361
  "input",
1358
1362
  {
1359
1363
  type: "checkbox",
1360
1364
  checked,
1361
1365
  onChange: () => toggleOptional(opt),
1362
- className: "h-4 w-4 shrink-0 rounded border-border accent-primary cursor-pointer"
1366
+ disabled: interactionsDisabled,
1367
+ className: cn(
1368
+ "h-4 w-4 shrink-0 rounded border-border accent-primary",
1369
+ interactionsDisabled ? "cursor-not-allowed" : "cursor-pointer"
1370
+ )
1363
1371
  }
1364
1372
  ),
1365
1373
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-sans text-foreground/80 group-hover:text-foreground transition-colors leading-snug", children: [
@@ -1379,14 +1387,14 @@ function AdventureCard({ adventure, labels }) {
1379
1387
  type: "button",
1380
1388
  onClick: () => {
1381
1389
  var _a3;
1382
- return canDec && ((_a3 = opt.onQuantityChange) == null ? void 0 : _a3.call(opt, opt.id, currentQty - 1));
1390
+ return !interactionsDisabled && canDec && ((_a3 = opt.onQuantityChange) == null ? void 0 : _a3.call(opt, opt.id, currentQty - 1));
1383
1391
  },
1384
- disabled: !canDec,
1392
+ disabled: interactionsDisabled || !canDec,
1385
1393
  "aria-label": (_d2 = opt.decreaseQuantityLabel) != null ? _d2 : "Decrease quantity",
1386
1394
  className: cn(
1387
1395
  "h-7 w-7 rounded border border-border flex items-center justify-center text-sm font-semibold",
1388
1396
  "transition-colors",
1389
- canDec ? "hover:bg-muted cursor-pointer text-foreground" : "opacity-40 cursor-not-allowed text-muted-foreground"
1397
+ interactionsDisabled ? "opacity-40 cursor-not-allowed text-muted-foreground" : canDec ? "hover:bg-muted cursor-pointer text-foreground" : "opacity-40 cursor-not-allowed text-muted-foreground"
1390
1398
  ),
1391
1399
  children: "\u2212"
1392
1400
  }
@@ -1398,14 +1406,14 @@ function AdventureCard({ adventure, labels }) {
1398
1406
  type: "button",
1399
1407
  onClick: () => {
1400
1408
  var _a3;
1401
- return canInc && ((_a3 = opt.onQuantityChange) == null ? void 0 : _a3.call(opt, opt.id, currentQty + 1));
1409
+ return !interactionsDisabled && canInc && ((_a3 = opt.onQuantityChange) == null ? void 0 : _a3.call(opt, opt.id, currentQty + 1));
1402
1410
  },
1403
- disabled: !canInc,
1411
+ disabled: interactionsDisabled || !canInc,
1404
1412
  "aria-label": (_e2 = opt.increaseQuantityLabel) != null ? _e2 : "Increase quantity",
1405
1413
  className: cn(
1406
1414
  "h-7 w-7 rounded border border-border flex items-center justify-center text-sm font-semibold",
1407
1415
  "transition-colors",
1408
- canInc ? "hover:bg-muted cursor-pointer text-foreground" : "opacity-40 cursor-not-allowed text-muted-foreground"
1416
+ interactionsDisabled ? "opacity-40 cursor-not-allowed text-muted-foreground" : canInc ? "hover:bg-muted cursor-pointer text-foreground" : "opacity-40 cursor-not-allowed text-muted-foreground"
1409
1417
  ),
1410
1418
  children: "+"
1411
1419
  }
@@ -1476,11 +1484,12 @@ function OfferSidebar({
1476
1484
  onBook,
1477
1485
  bookLabel,
1478
1486
  bookDisabled,
1479
- labels
1487
+ labels,
1488
+ bookHref
1480
1489
  }) {
1481
1490
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1482
1491
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
1483
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden lg:flex rounded-2xl border border-border bg-card p-5 flex-col gap-4", children: [
1492
+ !bookHref && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "hidden lg:flex rounded-2xl border border-border bg-card p-5 flex-col gap-4", children: [
1484
1493
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1485
1494
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-widest text-muted-foreground font-heading mb-1", children: (_a = labels == null ? void 0 : labels.bookingTotal) != null ? _a : "Booking Total" }),
1486
1495
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-black text-primary font-heading leading-none", children: total })
@@ -1930,19 +1939,37 @@ function BookingConfirmedCard({
1930
1939
  email,
1931
1940
  message,
1932
1941
  onBack,
1933
- backLabel = "Back to offer"
1942
+ backLabel = "Back to offer",
1943
+ bookingNumber,
1944
+ bookingNumberLabel = "Your booking number is:",
1945
+ viewBookingHref,
1946
+ viewBookingLabel = "VIEW BOOKING"
1934
1947
  }) {
1948
+ const hasBookingNumber = bookingNumber !== void 0 && bookingNumber !== null && bookingNumber !== "";
1935
1949
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl border border-border bg-card p-8 flex flex-col items-center gap-6 text-center", children: [
1936
1950
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-20 w-20 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2Icon, { className: "w-10 h-10 text-primary" }) }),
1937
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1951
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
1938
1952
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-2xl font-black text-foreground font-heading", children: title }),
1939
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-sm text-muted-foreground font-sans max-w-sm mx-auto leading-relaxed", children: message != null ? message : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1953
+ hasBookingNumber && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-foreground font-sans", children: [
1954
+ bookingNumberLabel,
1955
+ " ",
1956
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold text-foreground font-heading", children: bookingNumber })
1957
+ ] }),
1958
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground font-sans max-w-sm mx-auto leading-relaxed", children: message != null ? message : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1940
1959
  "A confirmation email has been sent to",
1941
1960
  " ",
1942
1961
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground", children: email || "your email" }),
1943
1962
  ". Our team will be in touch shortly."
1944
1963
  ] }) })
1945
1964
  ] }),
1965
+ viewBookingHref && /* @__PURE__ */ jsxRuntime.jsx(
1966
+ "a",
1967
+ {
1968
+ href: viewBookingHref,
1969
+ className: "rounded-full bg-primary px-6 py-3 text-sm font-bold tracking-wide uppercase text-primary-foreground font-heading transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1970
+ children: viewBookingLabel
1971
+ }
1972
+ ),
1946
1973
  onBack && /* @__PURE__ */ jsxRuntime.jsx(
1947
1974
  "button",
1948
1975
  {
@@ -2224,11 +2251,13 @@ function Offer({
2224
2251
  summaryDiscountLine,
2225
2252
  continueDisabled,
2226
2253
  labels,
2254
+ confirmedState,
2255
+ interactionsDisabled,
2227
2256
  className
2228
2257
  }) {
2229
- var _a, _b;
2258
+ var _a, _b, _c;
2230
2259
  const [showBooking, setShowBooking] = React23__namespace.useState(false);
2231
- const isShowingCheckout = !!checkoutSlot || showBooking;
2260
+ const isShowingCheckout = !confirmedState && (!!checkoutSlot || showBooking);
2232
2261
  const handleBook = () => {
2233
2262
  if (!checkoutSlot && !externalBookingFlow) setShowBooking(true);
2234
2263
  onContinue == null ? void 0 : onContinue();
@@ -2238,13 +2267,27 @@ function Offer({
2238
2267
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-black text-foreground font-heading leading-tight", children: title }),
2239
2268
  subtitle && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground font-sans space-y-1 leading-relaxed", children: subtitle }),
2240
2269
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-6 lg:gap-8 items-start", children: [
2241
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
2270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-6", children: confirmedState ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2271
+ /* @__PURE__ */ jsxRuntime.jsx(
2272
+ BookingConfirmedCard,
2273
+ {
2274
+ title: (_a = confirmedState.title) != null ? _a : labels == null ? void 0 : labels.bookingConfirmed,
2275
+ email: confirmedState.email,
2276
+ message: confirmedState.message,
2277
+ bookingNumber: confirmedState.bookingNumber,
2278
+ bookingNumberLabel: confirmedState.bookingNumberLabel,
2279
+ viewBookingHref: confirmedState.viewBookingHref,
2280
+ viewBookingLabel: confirmedState.viewBookingLabel
2281
+ }
2282
+ ),
2283
+ confirmedState.belowSlot
2284
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2242
2285
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-col gap-5", children: [
2243
2286
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2244
2287
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapIcon, { className: "w-5 h-5 text-primary shrink-0" }),
2245
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-bold text-foreground font-heading text-base", children: (_a = labels == null ? void 0 : labels.includedAdventures) != null ? _a : "Included Adventures" })
2288
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-bold text-foreground font-heading text-base", children: (_b = labels == null ? void 0 : labels.includedAdventures) != null ? _b : "Included Adventures" })
2246
2289
  ] }),
2247
- adventures.map((adventure) => /* @__PURE__ */ jsxRuntime.jsx(AdventureCard, { adventure, labels }, adventure.id))
2290
+ adventures.map((adventure) => /* @__PURE__ */ jsxRuntime.jsx(AdventureCard, { adventure, labels, interactionsDisabled }, adventure.id))
2248
2291
  ] }),
2249
2292
  !isShowingCheckout && /* @__PURE__ */ jsxRuntime.jsx(
2250
2293
  OfferSummarySection,
@@ -2271,7 +2314,7 @@ function Offer({
2271
2314
  labels
2272
2315
  }
2273
2316
  ))
2274
- ] }),
2317
+ ] }) }),
2275
2318
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:sticky lg:top-8", children: /* @__PURE__ */ jsxRuntime.jsx(
2276
2319
  OfferSidebar,
2277
2320
  {
@@ -2280,13 +2323,14 @@ function Offer({
2280
2323
  onBook: handleBook,
2281
2324
  bookLabel: continueLabel,
2282
2325
  bookDisabled: continueDisabled,
2283
- labels
2326
+ labels,
2327
+ bookHref: confirmedState == null ? void 0 : confirmedState.viewBookingHref
2284
2328
  }
2285
2329
  ) })
2286
2330
  ] }),
2287
- !isShowingCheckout && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed bottom-0 inset-x-0 z-40 border-t border-border bg-background/95 backdrop-blur-sm px-4 py-3 lg:hidden", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 max-w-5xl mx-auto", children: [
2331
+ !isShowingCheckout && !confirmedState && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed bottom-0 inset-x-0 z-40 border-t border-border bg-background/95 backdrop-blur-sm px-4 py-3 lg:hidden", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 max-w-5xl mx-auto", children: [
2288
2332
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
2289
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] uppercase tracking-widest text-muted-foreground font-heading", children: (_b = labels == null ? void 0 : labels.total) != null ? _b : "Total" }),
2333
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] uppercase tracking-widest text-muted-foreground font-heading", children: (_c = labels == null ? void 0 : labels.total) != null ? _c : "Total" }),
2290
2334
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xl font-black text-primary font-heading leading-tight", children: total })
2291
2335
  ] }),
2292
2336
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2294,10 +2338,12 @@ function Offer({
2294
2338
  {
2295
2339
  type: "button",
2296
2340
  onClick: handleBook,
2341
+ disabled: continueDisabled,
2297
2342
  className: cn(
2298
2343
  "rounded-full bg-primary px-6 py-3 text-sm font-bold tracking-wide uppercase",
2299
2344
  "text-primary-foreground font-heading transition-colors hover:bg-primary/90",
2300
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
2345
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2346
+ continueDisabled && "opacity-50 pointer-events-none"
2301
2347
  ),
2302
2348
  children: continueLabel
2303
2349
  }