@bearmenu/ui 0.8.23 → 0.8.25

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.
Files changed (83) hide show
  1. package/dist/{chunk-5LTILG3L.js → chunk-5HHRVJOT.js} +14 -1
  2. package/dist/{chunk-SDWN6L4O.js → chunk-AHHDC7ML.js} +1 -1
  3. package/dist/{chunk-5XREWOBB.js → chunk-IEIJP73R.js} +14 -1
  4. package/dist/{chunk-BKKQ7GCZ.js → chunk-QG6I2ILT.js} +1 -1
  5. package/dist/{chunk-TIQNM4XD.js → chunk-VEGFQSZA.js} +17 -1
  6. package/dist/components/alert-dialog.js +1 -1
  7. package/dist/components/alert.d.ts +2 -2
  8. package/dist/components/badge.d.ts +1 -1
  9. package/dist/components/badge.js +1 -1
  10. package/dist/components/booking-row.d.ts +60 -0
  11. package/dist/components/booking-row.js +103 -0
  12. package/dist/components/booking-summary-card.d.ts +38 -0
  13. package/dist/components/booking-summary-card.js +67 -0
  14. package/dist/components/button.d.ts +2 -2
  15. package/dist/components/button.js +1 -1
  16. package/dist/components/calendar.d.ts +17 -3
  17. package/dist/components/calendar.js +100 -12
  18. package/dist/components/carousel.js +1 -1
  19. package/dist/components/coach-marks.js +1 -1
  20. package/dist/components/combobox.js +1 -1
  21. package/dist/components/command.d.ts +7 -7
  22. package/dist/components/concept-convergence.js +2 -2
  23. package/dist/components/empty-state.js +1 -1
  24. package/dist/components/event-card.js +1 -1
  25. package/dist/components/event-compact-row.js +1 -1
  26. package/dist/components/event-detail-panel.js +1 -1
  27. package/dist/components/event-list-row-wide.js +2 -2
  28. package/dist/components/event-list-row.js +1 -1
  29. package/dist/components/filter-category-row.js +1 -1
  30. package/dist/components/hold-countdown.d.ts +43 -0
  31. package/dist/components/hold-countdown.js +90 -0
  32. package/dist/components/kitchen-dossier.js +1 -1
  33. package/dist/components/link-button.js +1 -1
  34. package/dist/components/menu-family-block.js +1 -1
  35. package/dist/components/menu-index-list.js +1 -1
  36. package/dist/components/menu-item.js +3 -3
  37. package/dist/components/motion-icon-set.d.ts +2 -1
  38. package/dist/components/motion-icon-set.js +27 -1
  39. package/dist/components/multi-select-combobox.js +2 -2
  40. package/dist/components/pagination.js +1 -1
  41. package/dist/components/party-counter.d.ts +36 -0
  42. package/dist/components/party-counter.js +61 -0
  43. package/dist/components/place-card.js +2 -2
  44. package/dist/components/place-details-mobile.js +1 -1
  45. package/dist/components/searchable-select.js +1 -1
  46. package/dist/components/signature-chip.js +2 -2
  47. package/dist/components/sliding-panels.js +1 -1
  48. package/dist/components/spinner.d.ts +2 -2
  49. package/dist/components/tag.d.ts +2 -2
  50. package/dist/components/text.d.ts +3 -3
  51. package/dist/components/time-slot.d.ts +73 -0
  52. package/dist/components/time-slot.js +106 -0
  53. package/dist/components/toggle-group.js +15 -2
  54. package/dist/components/toggle.d.ts +1 -1
  55. package/dist/components/toggle.js +1 -1
  56. package/dist/components/top-ranking-entry.js +3 -3
  57. package/dist/components/weekday-chip.d.ts +33 -0
  58. package/dist/components/weekday-chip.js +48 -0
  59. package/package.json +1 -1
  60. package/src/components/badge.stories.tsx +17 -0
  61. package/src/components/badge.tsx +15 -0
  62. package/src/components/booking-primitives.test.tsx +180 -0
  63. package/src/components/booking-row.stories.tsx +66 -0
  64. package/src/components/booking-row.tsx +168 -0
  65. package/src/components/booking-summary-card.stories.tsx +41 -0
  66. package/src/components/booking-summary-card.tsx +109 -0
  67. package/src/components/button.stories.tsx +23 -0
  68. package/src/components/button.tsx +13 -0
  69. package/src/components/calendar.stories.tsx +27 -0
  70. package/src/components/calendar.tsx +110 -3
  71. package/src/components/hold-countdown.stories.tsx +68 -0
  72. package/src/components/hold-countdown.tsx +140 -0
  73. package/src/components/motion-icon-set.stories.tsx +2 -0
  74. package/src/components/motion-icon-set.tsx +42 -0
  75. package/src/components/party-counter.stories.tsx +57 -0
  76. package/src/components/party-counter.tsx +93 -0
  77. package/src/components/time-slot.stories.tsx +85 -0
  78. package/src/components/time-slot.tsx +186 -0
  79. package/src/components/toggle-group.stories.tsx +27 -0
  80. package/src/components/toggle-group.tsx +14 -1
  81. package/src/components/toggle.tsx +16 -0
  82. package/src/components/weekday-chip.stories.tsx +54 -0
  83. package/src/components/weekday-chip.tsx +75 -0
@@ -0,0 +1,168 @@
1
+ import * as React from "react";
2
+ import { ChevronRight } from "lucide-react";
3
+ import { cn } from "../lib/utils";
4
+ import { Badge } from "./badge";
5
+
6
+ /**
7
+ * BookingRow and BookingRowList — the guest's bookings in "My bookings".
8
+ *
9
+ * Measured from the booking design (`.bkrow`, and the desktop list):
10
+ *
11
+ * Mobile (below `md`): rows 14px tall-padded, 12px gap, divided by a
12
+ * `line-soft` hairline. A 50px thumb with an 11px radius. Line one: the venue
13
+ * at 14px bold, the code chip pushed right. Line two: the venue type at 11.5px
14
+ * muted. Line three, 7px gaps: when at 12.5px medium, the party at 12px muted,
15
+ * then the status pill.
16
+ *
17
+ * Desktop (`md` and up): one card (14px radius, no inset), rows 14px × 18px
18
+ * with 14px gaps, divided by the same hairline. A 46px thumb, then the venue
19
+ * (bold) with its type inline and muted over "when · party" in the secondary
20
+ * ink, then the status pill, the code chip and a muted chevron. The row that
21
+ * is next up gets a 5% accent wash.
22
+ *
23
+ * The whole row is one link. Strings arrive formatted and localised; the thumb
24
+ * arrives rendered, so the app picks its own image component.
25
+ */
26
+
27
+ export type BookingRowStatus = "confirmed" | "pending";
28
+
29
+ export type BookingRowLinkProps = {
30
+ href: string;
31
+ className?: string;
32
+ children: React.ReactNode;
33
+ };
34
+
35
+ function DefaultLink({ href, ...props }: BookingRowLinkProps) {
36
+ return <a href={href} {...props} />;
37
+ }
38
+
39
+ export type BookingRowProps = {
40
+ venueName: string;
41
+ /** "Bistro", "Cocktail bar" */
42
+ venueType?: string;
43
+ /** "Fri 14 Aug · 19:30" */
44
+ when: string;
45
+ /** "2 people" */
46
+ party: string;
47
+ status: BookingRowStatus;
48
+ /** "Confirmed", "Pending" — already localised. */
49
+ statusLabel: string;
50
+ code: string;
51
+ href: string;
52
+ /** The venue photo, rendered by the app; a quiet placeholder when absent. */
53
+ thumbnail?: React.ReactNode;
54
+ /** The next booking up — tinted on desktop. */
55
+ highlighted?: boolean;
56
+ linkComponent?: React.ComponentType<BookingRowLinkProps>;
57
+ className?: string;
58
+ };
59
+
60
+ function Thumb({ children, className }: { children?: React.ReactNode; className?: string }) {
61
+ return (
62
+ <span
63
+ aria-hidden
64
+ className={cn(
65
+ // Dark: `surface-2` sits a notch from the card and vanishes; the
66
+ // accent-tinted step reads as a photo slot.
67
+ "block shrink-0 overflow-hidden rounded-[11px] bg-surface-2 dark:bg-accent-subtle [&_img]:size-full [&_img]:object-cover",
68
+ className
69
+ )}
70
+ >
71
+ {children}
72
+ </span>
73
+ );
74
+ }
75
+
76
+ export function BookingRow({
77
+ venueName,
78
+ venueType,
79
+ when,
80
+ party,
81
+ status,
82
+ statusLabel,
83
+ code,
84
+ href,
85
+ thumbnail,
86
+ highlighted,
87
+ linkComponent: LinkComponent = DefaultLink,
88
+ className,
89
+ }: BookingRowProps) {
90
+ const statusPill = (
91
+ <Badge as="span" variant={status}>
92
+ {statusLabel}
93
+ </Badge>
94
+ );
95
+ const codeChip = (
96
+ <Badge as="span" variant="code">
97
+ {code}
98
+ </Badge>
99
+ );
100
+
101
+ return (
102
+ <LinkComponent
103
+ href={href}
104
+ className={cn(
105
+ "flex gap-3 py-3.5 leading-[1.2] text-foreground",
106
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
107
+ "md:items-center md:gap-3.5 md:px-[18px] md:hover:bg-accent/[0.03]",
108
+ highlighted && "md:bg-accent/5 md:hover:bg-accent/5",
109
+ className
110
+ )}
111
+ >
112
+ <Thumb className="size-[50px] md:size-[46px]">{thumbnail}</Thumb>
113
+
114
+ {/* Mobile: three stacked lines. */}
115
+ <div className="min-w-0 flex-1 md:hidden">
116
+ <div className="flex items-center justify-between gap-2">
117
+ <b className="truncate text-sm font-bold">{venueName}</b>
118
+ {codeChip}
119
+ </div>
120
+ {venueType && <div className="text-[11.5px] text-muted-foreground">{venueType}</div>}
121
+ <div className="mt-2 flex flex-wrap items-center gap-[7px]">
122
+ <span className="text-[12.5px] font-medium">{when}</span>
123
+ <span className="text-xs text-muted-foreground">{party}</span>
124
+ {statusPill}
125
+ </div>
126
+ </div>
127
+
128
+ {/* Desktop: one line. */}
129
+ <div className="hidden min-w-0 flex-1 md:block">
130
+ <div className="truncate">
131
+ <b className="text-sm font-bold">{venueName}</b>
132
+ {venueType && <span className="ml-1.5 text-xs text-muted-foreground">{venueType}</span>}
133
+ </div>
134
+ <div className="mt-0.5 truncate text-[12.5px] text-ink-secondary">
135
+ {when} · {party}
136
+ </div>
137
+ </div>
138
+ <span className="hidden md:contents">
139
+ {statusPill}
140
+ {codeChip}
141
+ <ChevronRight aria-hidden className="size-[15px] shrink-0 text-muted-foreground" />
142
+ </span>
143
+ </LinkComponent>
144
+ );
145
+ }
146
+
147
+ export type BookingRowListProps = {
148
+ children: React.ReactNode;
149
+ /** "Upcoming bookings" — names the list for assistive tech. */
150
+ "aria-label"?: string;
151
+ className?: string;
152
+ };
153
+
154
+ /** The list around the rows: hairlines between them on mobile, one card on desktop. */
155
+ export function BookingRowList({ children, "aria-label": ariaLabel, className }: BookingRowListProps) {
156
+ return (
157
+ <ul
158
+ aria-label={ariaLabel}
159
+ className={cn(
160
+ "divide-y divide-line-soft",
161
+ "md:overflow-hidden md:rounded-[14px] md:border md:border-border md:bg-card",
162
+ className
163
+ )}
164
+ >
165
+ {React.Children.map(children, (child) => (child ? <li>{child}</li> : null))}
166
+ </ul>
167
+ );
168
+ }
@@ -0,0 +1,41 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { BookingSummaryCard } from "./booking-summary-card";
3
+
4
+ const meta: Meta<typeof BookingSummaryCard> = {
5
+ title: "Booking/BookingSummaryCard",
6
+ component: BookingSummaryCard,
7
+ tags: ["autodocs"],
8
+ args: {
9
+ venueName: "Sălcii Bistro",
10
+ date: "Fri 14 August",
11
+ timeAndParty: "19:30 · 2 people",
12
+ seating: "Terrace (requested)",
13
+ address: "Strada Iuliu Maniu 12",
14
+ code: "BM-8421",
15
+ labels: { code: "Booking code" },
16
+ },
17
+ decorators: [
18
+ (Story) => (
19
+ <div className="w-[343px]">
20
+ <Story />
21
+ </div>
22
+ ),
23
+ ],
24
+ parameters: {
25
+ docs: {
26
+ description: {
27
+ component:
28
+ "The booking at a glance on the confirmation screen: venue, when, party, seating asked for, address, and the code to give at the door.",
29
+ },
30
+ },
31
+ },
32
+ };
33
+
34
+ export default meta;
35
+ type Story = StoryObj<typeof BookingSummaryCard>;
36
+
37
+ /** B3. */
38
+ export const Confirmed: Story = {};
39
+
40
+ /** No seating preference: the row is left out, not shown empty. */
41
+ export const NoPreference: Story = { args: { seating: undefined } };
@@ -0,0 +1,109 @@
1
+ import * as React from "react";
2
+ import { CalendarDays, Clock, MapPin } from "lucide-react";
3
+ import { cn } from "../lib/utils";
4
+
5
+ /**
6
+ * BookingSummaryCard — the booking at a glance on the confirmation screen
7
+ * ("Your table is booked"): the venue, then when, how many, where you asked
8
+ * to sit and the address, then the booking code.
9
+ *
10
+ * Measured from the booking design (`.cardx` + `.rowi`): a card with a 1px
11
+ * hairline, 14px radius, 15px inset and a 1px/3px shadow. The venue at 16px
12
+ * bold. Rows 11px below it, 7px apart: a 14px icon (1.8 stroke, muted) in a
13
+ * 16px column, 10px gap, text at 13px in the secondary ink. Then a
14
+ * `line-soft` divider 13px below with 13px above the code row: "BOOKING CODE"
15
+ * at 10.5px uppercase, muted, and the code in mono at 15px bold, pushed right.
16
+ *
17
+ * Every string arrives formatted and localised; the card only lays them out.
18
+ */
19
+
20
+ export type BookingSummaryCardLabels = {
21
+ /** "Booking code" */
22
+ code: string;
23
+ };
24
+
25
+ export type BookingSummaryCardProps = {
26
+ venueName: string;
27
+ /** "Fri 14 August" */
28
+ date: string;
29
+ /** "19:30 · 2 people" */
30
+ timeAndParty: string;
31
+ /** "Terrace (requested)" — omitted when there is no preference. */
32
+ seating?: string;
33
+ /** "Strada Iuliu Maniu 12" */
34
+ address?: string;
35
+ /** "BM-8421" */
36
+ code: string;
37
+ labels: BookingSummaryCardLabels;
38
+ className?: string;
39
+ };
40
+
41
+ function Row({ icon, children }: { icon: React.ReactNode; children: React.ReactNode }) {
42
+ return (
43
+ <div className="flex items-center gap-2.5 text-[13px] leading-4 text-ink-secondary [&+&]:mt-[7px]">
44
+ <span className="flex w-4 shrink-0 justify-center text-muted-foreground" aria-hidden>
45
+ {icon}
46
+ </span>
47
+ <span>{children}</span>
48
+ </div>
49
+ );
50
+ }
51
+
52
+ const ICON = "size-3.5 [stroke-width:1.8]";
53
+
54
+ /**
55
+ * The design's seating glyph, a low bench-sofa. Not in lucide (Armchair and
56
+ * Sofa both read as a different object), so drawn from the design's own paths.
57
+ */
58
+ function SeatIcon({ className }: { className?: string }) {
59
+ return (
60
+ <svg
61
+ viewBox="0 0 24 24"
62
+ fill="none"
63
+ stroke="currentColor"
64
+ strokeLinecap="round"
65
+ strokeLinejoin="round"
66
+ className={className}
67
+ aria-hidden
68
+ >
69
+ <path d="M5 11V7a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4" />
70
+ <path d="M5 11a2 2 0 0 0 0 4h14a2 2 0 0 0 0-4" />
71
+ <path d="M6 15v3M18 15v3M7 15h10" />
72
+ </svg>
73
+ );
74
+ }
75
+
76
+ export function BookingSummaryCard({
77
+ venueName,
78
+ date,
79
+ timeAndParty,
80
+ seating,
81
+ address,
82
+ code,
83
+ labels,
84
+ className,
85
+ }: BookingSummaryCardProps) {
86
+ return (
87
+ <div
88
+ data-slot="booking-summary-card"
89
+ className={cn(
90
+ "rounded-[14px] border border-border bg-card p-[15px] leading-[1.2] shadow-[0_1px_3px_oklch(0.5_0_0/0.1)]",
91
+ className
92
+ )}
93
+ >
94
+ <b className="text-base leading-5 font-bold text-foreground">{venueName}</b>
95
+ <div className="mt-[11px]">
96
+ <Row icon={<CalendarDays className={ICON} />}>{date}</Row>
97
+ <Row icon={<Clock className={ICON} />}>{timeAndParty}</Row>
98
+ {seating && <Row icon={<SeatIcon className={ICON} />}>{seating}</Row>}
99
+ {address && <Row icon={<MapPin className={ICON} />}>{address}</Row>}
100
+ </div>
101
+ <div className="mt-[13px] flex items-center justify-between border-t border-line-soft pt-[13px]">
102
+ <span className="text-[10.5px] tracking-[0.05em] text-muted-foreground uppercase">
103
+ {labels.code}
104
+ </span>
105
+ <b className="font-mono text-[15px] font-bold tabular-nums text-foreground">{code}</b>
106
+ </div>
107
+ </div>
108
+ );
109
+ }
@@ -127,6 +127,29 @@ export const AllVariants: Story = {
127
127
  ),
128
128
  };
129
129
 
130
+ /**
131
+ * The committing action of the booking flow, on the brand gradient. `cta` in
132
+ * the footers ("Continue · 19:30", "Confirm booking"), `cta-sm` inline
133
+ * ("Confirm the table" beside the hold countdown). Beside it, the quiet
134
+ * `outline` for Back / Cancel.
135
+ */
136
+ export const Cta: Story = {
137
+ render: () => (
138
+ <div className="flex flex-wrap items-center gap-3">
139
+ <Button variant="outline">Back</Button>
140
+ <Button variant="cta" size="cta">
141
+ Continue · 19:30
142
+ </Button>
143
+ <Button variant="cta" size="cta-sm">
144
+ Confirm the table
145
+ </Button>
146
+ <Button variant="cta" size="cta" disabled>
147
+ Continue
148
+ </Button>
149
+ </div>
150
+ ),
151
+ };
152
+
130
153
  export const AllSizes: Story = {
131
154
  render: () => (
132
155
  <div className="flex items-center gap-4">
@@ -62,6 +62,15 @@ const buttonVariants = cva(
62
62
  /** An ON state that is not the primary — a toggled mode, a guide running. */
63
63
  warning:
64
64
  "bg-warning text-warning-foreground shadow-sm hover:bg-warning/90 hover:shadow",
65
+ /**
66
+ * The committing action of a flow: "Continue · 19:30", "Confirm
67
+ * booking", "Reserve", "See booking". The booking design draws every
68
+ * one of them on `--gradient-primary` with white type, in both themes —
69
+ * the gradient is warm in dark too, so the ink never inverts.
70
+ * `bg-[image:…]`, not `bg-[…]`: the token is a gradient, and only
71
+ * `background-image` accepts it. Pair with `size="cta"` / `"cta-sm"`.
72
+ */
73
+ cta: "bg-[image:var(--gradient-primary)] text-white hover:brightness-[0.94] active:brightness-90",
65
74
  },
66
75
  size: {
67
76
  xs: "h-8 rounded-lg px-3 text-xs [&_svg]:size-3.5",
@@ -70,6 +79,10 @@ const buttonVariants = cva(
70
79
  lg: "h-12 rounded-2xl px-8",
71
80
  /** The `ink` action's shape. Owns the radius so no variant fights it. */
72
81
  pill: "h-11 rounded-full px-5 text-[13.5px] font-bold",
82
+ /** The booking design's action: 46px, 12px radius, 15px semibold. */
83
+ cta: "h-[46px] rounded-xl px-5 text-[15px] font-semibold",
84
+ /** Its compact form, in dense footers and inline rows: 38px, 10px radius. */
85
+ "cta-sm": "h-[38px] rounded-[10px] px-4 text-[13.5px] font-semibold",
73
86
  icon: "h-11 w-11 rounded-full",
74
87
  "icon-xs": "h-8 w-8 rounded-full [&_svg]:size-3.5",
75
88
  "icon-sm": "h-9 w-9 rounded-full",
@@ -45,3 +45,30 @@ function CalendarRangeDemo() {
45
45
  export const Range: Story = {
46
46
  render: () => <CalendarRangeDemo />,
47
47
  };
48
+
49
+ /**
50
+ * The booking flow's month grid (B1 desktop): 32px round cells in mono,
51
+ * the chosen day on the brand gradient, past days faded, a closed day struck
52
+ * through. Frozen on August 2026 so it matches the design frame.
53
+ */
54
+ function BookingCalendarDemo() {
55
+ const [date, setDate] = useState<Date | undefined>(new Date(2026, 7, 14));
56
+ return (
57
+ <div className="w-[270px]">
58
+ <Calendar
59
+ appearance="booking"
60
+ mode="single"
61
+ weekStartsOn={1}
62
+ defaultMonth={new Date(2026, 7, 1)}
63
+ selected={date}
64
+ onSelect={setDate}
65
+ disabled={[{ before: new Date(2026, 7, 6) }, new Date(2026, 7, 25)]}
66
+ modifiers={{ closed: [new Date(2026, 7, 25)] }}
67
+ />
68
+ </div>
69
+ );
70
+ }
71
+
72
+ export const Booking: Story = {
73
+ render: () => <BookingCalendarDemo />,
74
+ };
@@ -7,23 +7,93 @@ import { DayPicker, getDefaultClassNames, type DayButton } from "react-day-picke
7
7
  import { cn } from "../lib/utils";
8
8
  import { Button, buttonVariants } from "./button";
9
9
 
10
+ /**
11
+ * `appearance="booking"` is the month grid of the booking flow's "When are you
12
+ * coming?" (desktop), measured from its design (`.cal`): seven equal columns
13
+ * 3px apart; single-letter weekdays at 9.5px bold, muted; days as 32px round
14
+ * cells in mono 12.5px medium, secondary ink; the chosen day filled with
15
+ * `--gradient-primary`, white and bold; past days at 30%; a day the venue is
16
+ * closed struck through in a lighter ink. No outside days. Mark closed days
17
+ * with `modifiers={{ closed: … }}` — the appearance styles the `closed`
18
+ * modifier; `disabled` covers past days and the booking window.
19
+ */
20
+ type CalendarAppearance = "default" | "booking";
21
+
22
+ const BOOKING_CLASSNAMES = {
23
+ root: "w-full",
24
+ months: "relative flex flex-col",
25
+ month: "flex w-full flex-col",
26
+ // The caption row is 15px with 7px under it; the chevrons sit in that row.
27
+ nav: "absolute inset-x-0 top-0 flex h-[15px] w-full items-center justify-between",
28
+ button_previous:
29
+ "grid size-6 -m-[4.5px] cursor-pointer place-items-center rounded-full text-muted-foreground hover:bg-surface-2 hover:text-foreground aria-disabled:pointer-events-none aria-disabled:opacity-30 [&_svg]:size-3.5",
30
+ button_next:
31
+ "grid size-6 -m-[4.5px] cursor-pointer place-items-center rounded-full text-muted-foreground hover:bg-surface-2 hover:text-foreground aria-disabled:pointer-events-none aria-disabled:opacity-30 [&_svg]:size-3.5",
32
+ month_caption: "mb-[7px] flex h-[15px] w-full items-center justify-center",
33
+ caption_label: "text-[12.5px] leading-[15px] font-bold text-foreground select-none",
34
+ month_grid: "w-full border-collapse",
35
+ weekdays: "grid grid-cols-7 gap-[3px]",
36
+ weekday: "pb-[3px] text-center text-[9.5px] font-bold text-muted-foreground select-none",
37
+ week: "mt-[3px] grid grid-cols-7 gap-[3px]",
38
+ day: "p-0 text-center select-none",
39
+ today: "",
40
+ outside: "invisible",
41
+ disabled: "",
42
+ hidden: "invisible",
43
+ } as const;
44
+
10
45
  function Calendar({
11
46
  className,
12
47
  classNames,
13
- showOutsideDays = true,
48
+ showOutsideDays,
14
49
  captionLayout = "label",
15
50
  buttonVariant = "ghost",
51
+ appearance = "default",
16
52
  formatters,
17
53
  components,
54
+ modifiersClassNames,
18
55
  ...props
19
56
  }: React.ComponentProps<typeof DayPicker> & {
20
57
  buttonVariant?: React.ComponentProps<typeof Button>["variant"];
58
+ appearance?: CalendarAppearance;
21
59
  }) {
22
60
  const defaultClassNames = getDefaultClassNames();
23
61
 
62
+ if (appearance === "booking") {
63
+ return (
64
+ <DayPicker
65
+ showOutsideDays={showOutsideDays ?? false}
66
+ className={cn("group/calendar w-full", className)}
67
+ captionLayout="label"
68
+ formatters={{
69
+ formatWeekdayName: (date) =>
70
+ date.toLocaleString("default", { weekday: "narrow" }),
71
+ ...formatters,
72
+ }}
73
+ classNames={{ ...BOOKING_CLASSNAMES, ...classNames }}
74
+ modifiersClassNames={{ closed: "is-closed", ...modifiersClassNames }}
75
+ components={{
76
+ Root: ({ className, rootRef, ...rootProps }) => (
77
+ <div data-slot="calendar" data-appearance="booking" ref={rootRef} className={cn(className)} {...rootProps} />
78
+ ),
79
+ Chevron: ({ className, orientation, ...chevronProps }) =>
80
+ orientation === "left" ? (
81
+ <ChevronLeftIcon className={cn("size-4", className)} {...chevronProps} />
82
+ ) : (
83
+ <ChevronRightIcon className={cn("size-4", className)} {...chevronProps} />
84
+ ),
85
+ DayButton: BookingDayButton,
86
+ ...components,
87
+ }}
88
+ {...props}
89
+ />
90
+ );
91
+ }
92
+
24
93
  return (
25
94
  <DayPicker
26
- showOutsideDays={showOutsideDays}
95
+ showOutsideDays={showOutsideDays ?? true}
96
+ modifiersClassNames={modifiersClassNames}
27
97
  className={cn(
28
98
  "group/calendar bg-background p-3 [--cell-size:--spacing(9)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
29
99
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
@@ -177,4 +247,41 @@ function CalendarDayButton({
177
247
  );
178
248
  }
179
249
 
180
- export { Calendar, CalendarDayButton };
250
+ /** The booking appearance's day: a 32px round cell, see `BOOKING_CLASSNAMES`. */
251
+ function BookingDayButton({
252
+ className,
253
+ day,
254
+ modifiers,
255
+ ...props
256
+ }: React.ComponentProps<typeof DayButton>) {
257
+ const ref = React.useRef<HTMLButtonElement>(null);
258
+ React.useEffect(() => {
259
+ if (modifiers.focused) ref.current?.focus();
260
+ }, [modifiers.focused]);
261
+
262
+ const closed = Boolean(modifiers.closed);
263
+
264
+ return (
265
+ <button
266
+ ref={ref}
267
+ type="button"
268
+ data-day={day.date.toLocaleDateString()}
269
+ data-selected={modifiers.selected || undefined}
270
+ data-closed={closed || undefined}
271
+ className={cn(
272
+ "grid h-8 w-full cursor-pointer place-items-center rounded-full font-mono text-[12.5px] leading-none font-medium text-ink-secondary tabular-nums",
273
+ "transition-colors duration-150 hover:bg-surface-2 motion-reduce:transition-none",
274
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
275
+ modifiers.selected &&
276
+ "bg-[image:var(--gradient-primary)] font-bold text-white hover:bg-transparent hover:brightness-[0.94]",
277
+ modifiers.disabled && !closed && "cursor-not-allowed opacity-30 hover:bg-transparent",
278
+ // A closed day is also disabled; it reads as closed, not as past.
279
+ closed && "cursor-not-allowed text-[oklch(0.7_0_0)] line-through hover:bg-transparent dark:text-ink-tertiary",
280
+ className
281
+ )}
282
+ {...props}
283
+ />
284
+ );
285
+ }
286
+
287
+ export { Calendar, CalendarDayButton, BookingDayButton };
@@ -0,0 +1,68 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Button } from "./button";
3
+ import { HoldCountdown, type HoldCountdownLabels } from "./hold-countdown";
4
+
5
+ // A fixed clock so the story always reads 09:41 on first paint.
6
+ const NOW = Date.UTC(2026, 7, 14, 16, 0, 0);
7
+ const expiresAt = NOW + (9 * 60 + 41) * 1000;
8
+
9
+ const stackedLabels: HoldCountdownLabels = {
10
+ held: "Held for you",
11
+ explanation: "then it goes to the next person",
12
+ remaining: (m, s) => `${m} minutes ${s} seconds left`,
13
+ };
14
+
15
+ const inlineLabels: HoldCountdownLabels = {
16
+ ...stackedLabels,
17
+ explanation: "After the countdown the table goes to the next person on the list.",
18
+ };
19
+
20
+ const meta: Meta<typeof HoldCountdown> = {
21
+ title: "Booking/HoldCountdown",
22
+ component: HoldCountdown,
23
+ tags: ["autodocs"],
24
+ args: { expiresAt, now: () => NOW },
25
+ parameters: {
26
+ docs: {
27
+ description: {
28
+ component:
29
+ "How long a table offered from the waitlist stays held (\"A table opened up\"). Stacked on mobile; inline with its action on desktop. Ticks once a second and calls onExpire once, at zero.",
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ export default meta;
36
+ type Story = StoryObj<typeof HoldCountdown>;
37
+
38
+ /** B5a mobile. */
39
+ export const Stacked: Story = {
40
+ args: { labels: stackedLabels, layout: "stacked" },
41
+ decorators: [
42
+ (Story) => (
43
+ <div className="w-[343px]">
44
+ <Story />
45
+ </div>
46
+ ),
47
+ ],
48
+ };
49
+
50
+ /** B5a desktop. */
51
+ export const Inline: Story = {
52
+ args: {
53
+ labels: inlineLabels,
54
+ layout: "inline",
55
+ action: (
56
+ <Button variant="cta" size="cta-sm">
57
+ Confirm the table
58
+ </Button>
59
+ ),
60
+ },
61
+ decorators: [
62
+ (Story) => (
63
+ <div className="w-[520px]">
64
+ <Story />
65
+ </div>
66
+ ),
67
+ ],
68
+ };