@bearmenu/ui 0.8.8 → 0.8.10

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 (206) hide show
  1. package/dist/chunk-24RFI4RQ.js +167 -0
  2. package/dist/chunk-2XCZJWTV.js +121 -0
  3. package/dist/chunk-5RWTOT5Y.js +72 -0
  4. package/dist/chunk-62ES6N32.js +27 -0
  5. package/dist/chunk-AKQ57NXY.js +58 -0
  6. package/dist/chunk-CLLY6XB3.js +41 -0
  7. package/dist/chunk-DTXNDLSE.js +125 -0
  8. package/dist/chunk-F6FMZJDG.js +113 -0
  9. package/dist/{chunk-2WDJR6K7.js → chunk-G7IFL4Z4.js} +4 -1
  10. package/dist/chunk-MZL7CGCL.js +109 -0
  11. package/dist/chunk-Q6QH52LJ.js +38 -0
  12. package/dist/chunk-SY6RV476.js +48 -0
  13. package/dist/chunk-TH6W2PWG.js +213 -0
  14. package/dist/chunk-UDN7UHJW.js +60 -0
  15. package/dist/{chunk-TT3WFS6S.js → chunk-YOKHBAIH.js} +11 -11
  16. package/dist/components/alert.d.ts +2 -2
  17. package/dist/components/badge.d.ts +1 -1
  18. package/dist/components/concept-compare-rail.d.ts +50 -0
  19. package/dist/components/concept-compare-rail.js +5 -0
  20. package/dist/components/concept-compare.d.ts +110 -0
  21. package/dist/components/concept-compare.js +238 -0
  22. package/dist/components/concept-convergence.d.ts +41 -0
  23. package/dist/components/concept-convergence.js +53 -0
  24. package/dist/components/convergence.d.ts +25 -0
  25. package/dist/components/convergence.js +4 -0
  26. package/dist/components/date-input.d.ts +1 -1
  27. package/dist/components/event-card.js +1 -1
  28. package/dist/components/event-compact-row.d.ts +1 -1
  29. package/dist/components/event-compact-row.js +1 -1
  30. package/dist/components/event-detail-panel.d.ts +171 -25
  31. package/dist/components/event-detail-panel.js +472 -175
  32. package/dist/components/event-index-row.js +1 -1
  33. package/dist/components/event-list-row-wide.js +2 -2
  34. package/dist/components/event-list-row.js +2 -2
  35. package/dist/components/explainer-steps.d.ts +34 -0
  36. package/dist/components/explainer-steps.js +36 -0
  37. package/dist/components/glass-ground.d.ts +66 -0
  38. package/dist/components/glass-ground.js +3 -0
  39. package/dist/components/hub-surface.d.ts +27 -0
  40. package/dist/components/hub-surface.js +30 -0
  41. package/dist/components/hue-chip.d.ts +70 -0
  42. package/dist/components/hue-chip.js +3 -0
  43. package/dist/components/kitchen-dossier.d.ts +88 -0
  44. package/dist/components/kitchen-dossier.js +187 -0
  45. package/dist/components/menu-dead-end.d.ts +56 -0
  46. package/dist/components/menu-dead-end.js +49 -0
  47. package/dist/components/menu-family-block.d.ts +99 -0
  48. package/dist/components/menu-family-block.js +155 -0
  49. package/dist/components/menu-family-card.d.ts +65 -0
  50. package/dist/components/menu-family-card.js +79 -0
  51. package/dist/components/menu-field.d.ts +57 -0
  52. package/dist/components/menu-field.js +93 -0
  53. package/dist/components/menu-filter-chips.d.ts +86 -0
  54. package/dist/components/menu-filter-chips.js +122 -0
  55. package/dist/components/menu-group-rows.d.ts +53 -0
  56. package/dist/components/menu-group-rows.js +67 -0
  57. package/dist/components/menu-hub-hero.d.ts +65 -0
  58. package/dist/components/menu-hub-hero.js +103 -0
  59. package/dist/components/menu-index-header.d.ts +37 -0
  60. package/dist/components/menu-index-header.js +68 -0
  61. package/dist/components/menu-index-list.d.ts +48 -0
  62. package/dist/components/menu-index-list.js +96 -0
  63. package/dist/components/menu-intent-hero.d.ts +69 -0
  64. package/dist/components/menu-intent-hero.js +87 -0
  65. package/dist/components/menu-intent-tiles.d.ts +31 -0
  66. package/dist/components/menu-intent-tiles.js +50 -0
  67. package/dist/components/menu-item.d.ts +127 -0
  68. package/dist/components/menu-item.js +5 -0
  69. package/dist/components/menu-kitchen-list.d.ts +82 -0
  70. package/dist/components/menu-kitchen-list.js +5 -0
  71. package/dist/components/menu-mocks.d.ts +90 -0
  72. package/dist/components/menu-mocks.js +504 -0
  73. package/dist/components/menu-types.d.ts +421 -0
  74. package/dist/components/menu-types.js +1 -0
  75. package/dist/components/motion-icon-controls.js +2 -2
  76. package/dist/components/motion-icon-set.js +21 -9
  77. package/dist/components/motion-icon.d.ts +22 -1
  78. package/dist/components/motion-icon.js +1 -1
  79. package/dist/components/open-now-list.d.ts +40 -0
  80. package/dist/components/open-now-list.js +69 -0
  81. package/dist/components/photo-ground.d.ts +64 -0
  82. package/dist/components/photo-ground.js +3 -0
  83. package/dist/components/place-about-tab.js +2 -2
  84. package/dist/components/place-details-mobile.js +2 -2
  85. package/dist/components/place-types.d.ts +112 -1
  86. package/dist/components/qa-block.d.ts +36 -0
  87. package/dist/components/qa-block.js +24 -0
  88. package/dist/components/scroll-fade.js +3 -121
  89. package/dist/components/signature-chip.d.ts +37 -0
  90. package/dist/components/signature-chip.js +4 -0
  91. package/dist/components/snap-rail.d.ts +48 -5
  92. package/dist/components/snap-rail.js +3 -51
  93. package/dist/components/stat-banner.d.ts +47 -0
  94. package/dist/components/stat-banner.js +61 -0
  95. package/dist/components/story.d.ts +34 -0
  96. package/dist/components/story.js +3 -0
  97. package/dist/components/tag.d.ts +2 -2
  98. package/dist/components/text.d.ts +1 -1
  99. package/dist/components/top-comparison.d.ts +28 -0
  100. package/dist/components/top-comparison.js +76 -0
  101. package/dist/components/top-cross-link.d.ts +34 -0
  102. package/dist/components/top-cross-link.js +101 -0
  103. package/dist/components/top-ranking-entry.d.ts +53 -0
  104. package/dist/components/top-ranking-entry.js +217 -0
  105. package/dist/components/top-ranking-hero.d.ts +61 -0
  106. package/dist/components/top-ranking-hero.js +99 -0
  107. package/dist/components/top-ranking-legend.d.ts +69 -0
  108. package/dist/components/top-ranking-legend.js +124 -0
  109. package/dist/components/top-types.d.ts +109 -0
  110. package/dist/components/top-types.js +1 -0
  111. package/dist/components/venue-grade-dimensions.d.ts +38 -0
  112. package/dist/components/venue-grade-dimensions.js +3 -0
  113. package/dist/components/venue-quotes.d.ts +32 -0
  114. package/dist/components/venue-quotes.js +3 -0
  115. package/dist/components/venue-wall.d.ts +41 -0
  116. package/dist/components/venue-wall.js +118 -0
  117. package/dist/components/weekday-theme-banner.d.ts +70 -0
  118. package/dist/components/weekday-theme-banner.js +127 -0
  119. package/dist/components/weekend-panel.js +2 -2
  120. package/package.json +1 -1
  121. package/src/components/colour-dictionary.stories.tsx +227 -0
  122. package/src/components/concept-compare-rail.tsx +131 -0
  123. package/src/components/concept-compare.stories.tsx +172 -0
  124. package/src/components/concept-compare.tsx +443 -0
  125. package/src/components/concept-convergence.stories.tsx +53 -0
  126. package/src/components/concept-convergence.tsx +90 -0
  127. package/src/components/convergence.stories.tsx +54 -0
  128. package/src/components/convergence.tsx +177 -0
  129. package/src/components/event-compact-row.tsx +1 -1
  130. package/src/components/event-detail-panel.stories.tsx +205 -97
  131. package/src/components/event-detail-panel.test.tsx +181 -0
  132. package/src/components/event-detail-panel.tsx +703 -185
  133. package/src/components/explainer-steps.stories.tsx +46 -0
  134. package/src/components/explainer-steps.tsx +74 -0
  135. package/src/components/glass-ground.tsx +129 -0
  136. package/src/components/hub-surface.stories.tsx +68 -0
  137. package/src/components/hub-surface.tsx +50 -0
  138. package/src/components/hue-chip.stories.tsx +76 -0
  139. package/src/components/hue-chip.test.tsx +62 -0
  140. package/src/components/hue-chip.tsx +99 -0
  141. package/src/components/kitchen-dossier.stories.tsx +108 -0
  142. package/src/components/kitchen-dossier.tsx +322 -0
  143. package/src/components/menu-dead-end.stories.tsx +67 -0
  144. package/src/components/menu-dead-end.tsx +127 -0
  145. package/src/components/menu-family-block.stories.tsx +91 -0
  146. package/src/components/menu-family-block.tsx +314 -0
  147. package/src/components/menu-family-card.stories.tsx +120 -0
  148. package/src/components/menu-family-card.tsx +191 -0
  149. package/src/components/menu-field.stories.tsx +74 -0
  150. package/src/components/menu-field.tsx +199 -0
  151. package/src/components/menu-filter-chips.stories.tsx +107 -0
  152. package/src/components/menu-filter-chips.tsx +238 -0
  153. package/src/components/menu-group-rows.stories.tsx +54 -0
  154. package/src/components/menu-group-rows.tsx +133 -0
  155. package/src/components/menu-hub-hero.stories.tsx +92 -0
  156. package/src/components/menu-hub-hero.tsx +187 -0
  157. package/src/components/menu-index-header.stories.tsx +72 -0
  158. package/src/components/menu-index-header.tsx +125 -0
  159. package/src/components/menu-index-list.stories.tsx +50 -0
  160. package/src/components/menu-index-list.tsx +149 -0
  161. package/src/components/menu-intent-hero.stories.tsx +67 -0
  162. package/src/components/menu-intent-hero.tsx +189 -0
  163. package/src/components/menu-intent-tiles.stories.tsx +54 -0
  164. package/src/components/menu-intent-tiles.tsx +76 -0
  165. package/src/components/menu-item.tsx +416 -0
  166. package/src/components/menu-kitchen-list.stories.tsx +67 -0
  167. package/src/components/menu-kitchen-list.test.tsx +78 -0
  168. package/src/components/menu-kitchen-list.tsx +284 -0
  169. package/src/components/menu-mocks.ts +592 -0
  170. package/src/components/menu-types.ts +442 -0
  171. package/src/components/motion-icon-controls.tsx +11 -11
  172. package/src/components/motion-icon-set.tsx +36 -8
  173. package/src/components/motion-icon.test.tsx +23 -1
  174. package/src/components/motion-icon.tsx +20 -0
  175. package/src/components/open-now-list.stories.tsx +76 -0
  176. package/src/components/open-now-list.tsx +127 -0
  177. package/src/components/photo-ground.tsx +147 -0
  178. package/src/components/place-types.ts +112 -0
  179. package/src/components/qa-block.stories.tsx +43 -0
  180. package/src/components/qa-block.tsx +60 -0
  181. package/src/components/signature-chip.tsx +77 -0
  182. package/src/components/snap-rail.tsx +133 -9
  183. package/src/components/stat-banner.stories.tsx +100 -0
  184. package/src/components/stat-banner.tsx +117 -0
  185. package/src/components/story.tsx +225 -0
  186. package/src/components/top-comparison.stories.tsx +78 -0
  187. package/src/components/top-comparison.tsx +151 -0
  188. package/src/components/top-cross-link.stories.tsx +84 -0
  189. package/src/components/top-cross-link.tsx +171 -0
  190. package/src/components/top-ranking-entry.stories.tsx +171 -0
  191. package/src/components/top-ranking-entry.test.tsx +105 -0
  192. package/src/components/top-ranking-entry.tsx +425 -0
  193. package/src/components/top-ranking-hero.stories.tsx +76 -0
  194. package/src/components/top-ranking-hero.tsx +218 -0
  195. package/src/components/top-ranking-legend.stories.tsx +78 -0
  196. package/src/components/top-ranking-legend.tsx +239 -0
  197. package/src/components/top-types.ts +110 -0
  198. package/src/components/venue-grade-dimensions.stories.tsx +83 -0
  199. package/src/components/venue-grade-dimensions.tsx +91 -0
  200. package/src/components/venue-quotes.stories.tsx +59 -0
  201. package/src/components/venue-quotes.tsx +64 -0
  202. package/src/components/venue-wall.stories.tsx +78 -0
  203. package/src/components/venue-wall.tsx +185 -0
  204. package/src/components/weekday-theme-banner.stories.tsx +113 -0
  205. package/src/components/weekday-theme-banner.tsx +231 -0
  206. package/dist/{chunk-XWMRABZW.js → chunk-HSIYYA2E.js} +1 -1
@@ -0,0 +1,238 @@
1
+ import { X } from "lucide-react";
2
+ import { cn } from "../lib/utils";
3
+ import { ScrollFade } from "./scroll-fade";
4
+ import { Skeleton } from "./skeleton";
5
+ import type { MenuFilterChip } from "./menu-types";
6
+
7
+ /**
8
+ * MenuFilterChips — the intent page's filter row.
9
+ *
10
+ * ## One unit, one list that moves
11
+ *
12
+ * Every chip counts KITCHENS, whatever facet is behind it. A dietary chip reads
13
+ * "has a vegetarian dish" and counts venues; a dish-group chip reads "has a
14
+ * pizza" and counts venues. The earlier version mixed venue counts and dish
15
+ * counts in one row and became unreadable — you could not tell what a number
16
+ * was counting without reading the label that produced it. The unit is stated
17
+ * once, at the head of the row (`unitLabel`, e.g. "KITCHENS · 247"), and never
18
+ * again.
19
+ *
20
+ * ## A zero-count chip is dimmed, not disabled
21
+ *
22
+ * `empty` chips stay tappable. Pressing one swaps it in and drops whichever
23
+ * active filter conflicts with it, and the caller says which in a line beneath.
24
+ * Disabling it would refuse the reader the thing they asked for and give no
25
+ * reason; this way the row answers the question by being pressed. Facets the
26
+ * API says are unavailable for this intent are not passed in at all — not
27
+ * drawn, rather than drawn dead.
28
+ *
29
+ * ## The row scrolls; the escape hatch does not
30
+ *
31
+ * One line in every state. Chips scroll horizontally under a `<ScrollFade>`,
32
+ * and "More filters" is pinned opposite the unit label rather than wrapping,
33
+ * so the way out of a full row is always in the same place.
34
+ *
35
+ * Interactive: the consumer marks its own module `"use client"`.
36
+ */
37
+
38
+ export type MenuFilterChipsProps = {
39
+ chips: MenuFilterChip[];
40
+ onToggle: (key: string) => void;
41
+ /** The unit and the current total, composed by the caller, e.g. "KITCHENS · 247". */
42
+ unitLabel?: string;
43
+ /** Opens the full filter sheet. Omit for a row where every facet is a chip. */
44
+ onMore?: () => void;
45
+ moreLabel?: string;
46
+ /**
47
+ * A glyph for the phone's icon-only "more filters" button.
48
+ *
49
+ * The label is the widest fixed element in the row — "More filters" is ~80px
50
+ * of a 358px viewport, and it is the one thing that never scrolls, so it eats
51
+ * the chips' runway on every phone. Given an icon, the button collapses to a
52
+ * square below `lg` and keeps `moreLabel` as its accessible name.
53
+ *
54
+ * A node rather than a name because the app owns its iconography, and this
55
+ * one is animated on press — the DS neither knows the glyph nor drives it.
56
+ */
57
+ moreIcon?: React.ReactNode;
58
+ /** Press handler for the icon button, e.g. to replay the glyph's animation. */
59
+ onMorePointerDown?: () => void;
60
+ /** Locale-aware integer formatter for the counts. Defaults to `String`. */
61
+ formatCount?: (value: number) => string;
62
+ /** Accessible name for the row. */
63
+ ariaLabel?: string;
64
+ className?: string;
65
+ };
66
+
67
+ export function MenuFilterChips({
68
+ chips,
69
+ onToggle,
70
+ unitLabel,
71
+ onMore,
72
+ moreLabel,
73
+ moreIcon,
74
+ onMorePointerDown,
75
+ formatCount = String,
76
+ ariaLabel,
77
+ className,
78
+ }: MenuFilterChipsProps) {
79
+ return (
80
+ <div className={cn("relative flex items-center gap-2", className)}>
81
+ {/* Desktop only. It states a unit and a total that the section heading
82
+ directly below already gives in full ("The kitchens Cluj-Napoca rates
83
+ for Italian · 247"), and on a phone it is a fixed 110px bitten out of
84
+ the one row that needs every pixel to scroll. */}
85
+ {unitLabel && (
86
+ <span className="hidden shrink-0 pr-0.5 text-[11px] font-extrabold uppercase tracking-[0.1em] text-muted-foreground lg:inline">
87
+ {unitLabel}
88
+ </span>
89
+ )}
90
+
91
+ <ScrollFade
92
+ orientation="horizontal"
93
+ size="sm"
94
+ className="min-w-0 flex-1"
95
+ scrollClassName="scrollbar-hide"
96
+ >
97
+ <div className="flex items-center gap-2" role="group" aria-label={ariaLabel}>
98
+ {chips.map((chip) => (
99
+ <Chip
100
+ key={chip.key}
101
+ chip={chip}
102
+ onToggle={() => onToggle(chip.key)}
103
+ formatCount={formatCount}
104
+ />
105
+ ))}
106
+ </div>
107
+ </ScrollFade>
108
+
109
+ {onMore && (
110
+ <>
111
+ {/* One control, two shapes. On a phone it is a 40px square carrying
112
+ the caller's glyph, with `moreLabel` as its accessible name; from
113
+ `lg` it is the text link it has always been. Two elements rather
114
+ than one so neither has to carry the other's padding, and both
115
+ stay `shrink-0` against the scrolling chips. */}
116
+ {moreIcon && (
117
+ <button
118
+ type="button"
119
+ onClick={onMore}
120
+ onPointerDown={onMorePointerDown}
121
+ aria-label={moreLabel}
122
+ aria-haspopup="dialog"
123
+ className="inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-border text-accent transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none lg:hidden"
124
+ >
125
+ {moreIcon}
126
+ </button>
127
+ )}
128
+ <button
129
+ type="button"
130
+ onClick={onMore}
131
+ className={cn(
132
+ "shrink-0 rounded-md pl-2 text-[12.5px] font-bold text-accent transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
133
+ moreIcon && "hidden lg:inline"
134
+ )}
135
+ >
136
+ {moreLabel}
137
+ </button>
138
+ </>
139
+ )}
140
+ </div>
141
+ );
142
+ }
143
+
144
+ function Chip({
145
+ chip,
146
+ onToggle,
147
+ formatCount,
148
+ }: {
149
+ chip: MenuFilterChip;
150
+ onToggle: () => void;
151
+ formatCount: (value: number) => string;
152
+ }) {
153
+ return (
154
+ <button
155
+ type="button"
156
+ onClick={onToggle}
157
+ aria-pressed={chip.active}
158
+ className={cn(
159
+ "inline-flex h-9 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-4 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
160
+ chip.active
161
+ ? "border-accent font-semibold text-accent shadow-[0_1px_2px_oklch(0.51_0.095_45_/_0.08)]"
162
+ : "border-border bg-card text-foreground hover:border-accent/40",
163
+ // Dimmed, never disabled — pressing it is how the reader finds out
164
+ // which active filter is in the way.
165
+ chip.empty && "opacity-45"
166
+ )}
167
+ >
168
+ {chip.icon}
169
+ {chip.label}
170
+ {chip.count !== undefined && (
171
+ <span className={cn("tabular-nums", chip.active ? "text-accent" : "text-muted-foreground")}>
172
+ {formatCount(chip.count)}
173
+ </span>
174
+ )}
175
+ {chip.active && <X className="h-3 w-3 shrink-0" aria-hidden />}
176
+ </button>
177
+ );
178
+ }
179
+
180
+ /**
181
+ * MenuFilterSummary — what the active filters did, and the way out.
182
+ *
183
+ * Sits under the row whenever anything is on. The sentence is composed by the
184
+ * caller because it is a real sentence in two languages ("Three filters · 34 of
185
+ * 247 kitchens are mid-range, have a vegetarian Italian dish, and are open
186
+ * now") and assembling it from fragments here would produce translated
187
+ * word-salad in one of them.
188
+ */
189
+ export type MenuFilterSummaryProps = {
190
+ /** The composed sentence. */
191
+ summary: React.ReactNode;
192
+ clearLabel: string;
193
+ onClear: () => void;
194
+ className?: string;
195
+ };
196
+
197
+ export function MenuFilterSummary({
198
+ summary,
199
+ clearLabel,
200
+ onClear,
201
+ className,
202
+ }: MenuFilterSummaryProps) {
203
+ return (
204
+ <div className={cn("flex flex-wrap items-center gap-2.5 pt-3.5", className)}>
205
+ <span className="text-[13px] text-muted-foreground [&_b]:font-bold [&_b]:text-foreground">
206
+ {summary}
207
+ </span>
208
+ <button
209
+ type="button"
210
+ onClick={onClear}
211
+ className="ml-auto shrink-0 rounded-md text-[12.5px] font-bold text-accent transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none"
212
+ >
213
+ {clearLabel}
214
+ </button>
215
+ </div>
216
+ );
217
+ }
218
+
219
+ // ─── Skeleton ───────────────────────────────────────────────────────────────
220
+
221
+ /**
222
+ * One line, as the row itself renders — never a wrapped block.
223
+ *
224
+ * The widths vary deliberately: six identical pills read as a progress bar, and
225
+ * the real row is a set of labels of different lengths.
226
+ */
227
+ const CHIP_WIDTHS = [128, 104, 96, 148, 112, 88];
228
+
229
+ export function MenuFilterChipsSkeleton({ className }: { className?: string }) {
230
+ return (
231
+ <div className={cn("flex items-center gap-2 overflow-hidden", className)} aria-hidden>
232
+ <Skeleton className="h-3 w-[92px] shrink-0" />
233
+ {CHIP_WIDTHS.map((width, index) => (
234
+ <Skeleton key={index} className="h-9 shrink-0 rounded-full" style={{ width }} />
235
+ ))}
236
+ </div>
237
+ );
238
+ }
@@ -0,0 +1,54 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { MenuGroupRows } from "./menu-group-rows";
3
+ import { mockGradients } from "./menu-mocks";
4
+
5
+ const meta: Meta<typeof MenuGroupRows> = {
6
+ title: "Menu/MenuGroupRows",
7
+ component: MenuGroupRows,
8
+ tags: ["autodocs"],
9
+ decorators: [
10
+ (Story) => (
11
+ <div className="w-[380px] bg-background p-4">
12
+ <Story />
13
+ </div>
14
+ ),
15
+ ],
16
+ parameters: {
17
+ docs: {
18
+ description: {
19
+ component:
20
+ "What an intent consists of — the `dish_groups` facet on a cuisine page, digest tags and graded strengths on a going-out page. One component for both, because both are the same object: a facet value, its venue count and a range. The counts are VENUES: no endpoint counts dishes per cuisine, so *120* is a hundred and twenty kitchens that make a pizza, and the `meta` line is composed by the caller so it can say which.",
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof MenuGroupRows>;
28
+
29
+ export const Cuisine: Story = {
30
+ args: {
31
+ rows: [
32
+ { slug: "pizza", name: "Pizza", meta: "120 kitchens", rangeLabel: "30—68", href: "#", gradient: mockGradients.pasta },
33
+ { slug: "pasta", name: "Pasta", meta: "96 kitchens", rangeLabel: "38—84", href: "#", gradient: mockGradients.pasta },
34
+ { slug: "salad", name: "Salad", meta: "88 kitchens", rangeLabel: "22—56", href: "#", gradient: mockGradients.greens },
35
+ { slug: "beef", name: "Beef", meta: "77 kitchens", rangeLabel: "34—72", href: "#", gradient: mockGradients.meat },
36
+ ],
37
+ },
38
+ };
39
+
40
+ /** The going-out side: tags and strengths, and no price range behind them. */
41
+ export const GoingOut: Story = {
42
+ args: {
43
+ rows: [
44
+ { slug: "cocktails", name: "Cocktails", meta: "63 places", href: "#", gradient: mockGradients.cocktail },
45
+ { slug: "late_night", name: "Open late", meta: "59 places", href: "#", gradient: mockGradients.meat },
46
+ { slug: "drinks_quality", name: "Strong on drinks", meta: "131 places", href: "#", gradient: mockGradients.sweet },
47
+ ],
48
+ },
49
+ };
50
+
51
+ /** No gradient and no range — the row still reads. */
52
+ export const Bare: Story = {
53
+ args: { rows: [{ slug: "soup", name: "Soup", meta: "169 kitchens" }] },
54
+ };
@@ -0,0 +1,133 @@
1
+ import { ChevronRight } from "lucide-react";
2
+ import { cn } from "../lib/utils";
3
+ import { Skeleton } from "./skeleton";
4
+ import type { MenuLinkComponent, MenuLinkProps } from "./menu-types";
5
+
6
+ /**
7
+ * MenuGroupRows — what an intent consists of.
8
+ *
9
+ * On a cuisine page this is the `dish_groups` facet narrowed by the cuisine
10
+ * ("Pizza · 120 kitchens · 30–68"); on a going-out page it is the digest tags
11
+ * and graded strengths ("Cocktails · 63 places"). One component for both,
12
+ * because both are the same object: a facet value, its venue count, and a range.
13
+ *
14
+ * ## The counts are VENUES, and the label has to say so
15
+ *
16
+ * There is no endpoint that counts dishes per cuisine — `/dishes` accepts
17
+ * `cuisine_slugs` and ignores it — so "120" here is a hundred and twenty
18
+ * kitchens that make a pizza, not a hundred and twenty pizzas. The `meta` line
19
+ * is composed by the caller precisely so that it can say which, in a language
20
+ * where the two words differ.
21
+ *
22
+ * ## Not `<ConceptCard>`
23
+ *
24
+ * That one is a cover-led card for a thing with a date and a venue. This is a
25
+ * row in a sidebar: a hue bar, a name, a count and a range. Giving it a cover
26
+ * would mean finding a photograph of "pasta", which is the kind of picture that
27
+ * makes a page look generated.
28
+ */
29
+
30
+ /** @deprecated Alias of `MenuLinkProps`; kept for symmetry with the other menu surfaces. */
31
+ export type MenuGroupRowsLinkProps = MenuLinkProps;
32
+
33
+ function DefaultLink({ href, ...props }: MenuGroupRowsLinkProps) {
34
+ return <a href={href} {...props} />;
35
+ }
36
+
37
+ export type MenuGroupRow = {
38
+ slug: string;
39
+ name: string;
40
+ /** Venue count line, e.g. "120 kitchens". Pluralised by the caller. */
41
+ meta: string;
42
+ /** Price range, already formatted, e.g. "30—68". Omitted where none is known. */
43
+ rangeLabel?: string;
44
+ href?: string;
45
+ /** Finished CSS gradient for the bar. A missing one falls back to the border colour. */
46
+ gradient?: string;
47
+ };
48
+
49
+ export type MenuGroupRowsProps = {
50
+ rows: MenuGroupRow[];
51
+ linkComponent?: MenuLinkComponent;
52
+ className?: string;
53
+ };
54
+
55
+ export function MenuGroupRows({
56
+ rows,
57
+ linkComponent: LinkComponent = DefaultLink,
58
+ className,
59
+ }: MenuGroupRowsProps) {
60
+ return (
61
+ <ul className={cn("flex flex-col", className)}>
62
+ {rows.map((row) => {
63
+ const body = (
64
+ <>
65
+ <span
66
+ aria-hidden
67
+ className={cn(
68
+ "h-[34px] w-2 shrink-0 rounded-full",
69
+ !row.gradient && "bg-border"
70
+ )}
71
+ style={row.gradient ? { backgroundImage: row.gradient } : undefined}
72
+ />
73
+ <span className="min-w-0 flex-1">
74
+ <span className="block truncate text-sm font-bold">{row.name}</span>
75
+ <span className="mt-px block truncate text-[11.5px] text-muted-foreground">
76
+ {row.meta}
77
+ </span>
78
+ </span>
79
+ {row.rangeLabel && (
80
+ <span className="shrink-0 font-mono text-xs tabular-nums text-muted-foreground">
81
+ {row.rangeLabel}
82
+ </span>
83
+ )}
84
+ <ChevronRight className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
85
+ </>
86
+ );
87
+
88
+ return (
89
+ <li key={row.slug} className="border-t border-border first:border-t-0">
90
+ {row.href ? (
91
+ <LinkComponent
92
+ href={row.href}
93
+ className="flex items-center gap-3 py-3 transition-colors hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring motion-reduce:transition-none"
94
+ >
95
+ {body}
96
+ </LinkComponent>
97
+ ) : (
98
+ <span className="flex items-center gap-3 py-3">{body}</span>
99
+ )}
100
+ </li>
101
+ );
102
+ })}
103
+ </ul>
104
+ );
105
+ }
106
+
107
+ // ─── Skeleton ───────────────────────────────────────────────────────────────
108
+
109
+ export function MenuGroupRowsSkeleton({
110
+ rows = 5,
111
+ className,
112
+ }: {
113
+ rows?: number;
114
+ className?: string;
115
+ }) {
116
+ return (
117
+ <div className={cn("flex flex-col", className)} aria-hidden>
118
+ {Array.from({ length: rows }, (_, index) => (
119
+ <div
120
+ key={index}
121
+ className="flex items-center gap-3 border-t border-border py-3 first:border-t-0"
122
+ >
123
+ <Skeleton className="h-[34px] w-2 rounded-full" />
124
+ <div className="flex min-w-0 flex-1 flex-col gap-1.5">
125
+ <Skeleton className="h-3.5 w-[50%]" />
126
+ <Skeleton className="h-3 w-[35%]" />
127
+ </div>
128
+ <Skeleton className="h-3 w-[52px]" />
129
+ </div>
130
+ ))}
131
+ </div>
132
+ );
133
+ }
@@ -0,0 +1,92 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { ArrowLeftRight, UtensilsCrossed } from "lucide-react";
3
+ import { Button } from "./button";
4
+ import { MenuHubHero } from "./menu-hub-hero";
5
+
6
+ const meta: Meta<typeof MenuHubHero> = {
7
+ title: "Menu/MenuHubHero",
8
+ component: MenuHubHero,
9
+ tags: ["autodocs"],
10
+ decorators: [
11
+ (Story) => (
12
+ <div className="w-[1100px] bg-background p-4">
13
+ <Story />
14
+ </div>
15
+ ),
16
+ ],
17
+ parameters: {
18
+ docs: {
19
+ description: {
20
+ component:
21
+ "The claim that opens a menu hub, proven by live figures. A statement rather than a count, with the catalogue's real numbers under it and one proof line demonstrating what a catalogue can say that a single menu cannot. The ground is a texture rather than a photograph because item photography is generated and one venue's photo behind a claim about every venue argues the wrong thing — callers with a real licensed venue image can pass `backgroundUrl`.",
22
+ },
23
+ },
24
+ },
25
+ };
26
+
27
+ export default meta;
28
+ type Story = StoryObj<typeof MenuHubHero>;
29
+
30
+ export const Default: Story = {
31
+ args: {
32
+ kicker: "397 MENUS IN CLUJ-NAPOCA, READ IN FULL",
33
+ kickerIcon: <UtensilsCrossed className="h-3 w-3" />,
34
+ headline: "Nobody should have to walk in blind.",
35
+ body: "We read every menu in the city — what each kitchen serves, what it costs, how big the portion is, and which plates the reviews keep naming. Decide before you sit down.",
36
+ figures: [
37
+ { value: "19,062", label: "dishes" },
38
+ { value: "26,078", label: "drinks" },
39
+ { value: "397", label: "menus read" },
40
+ { value: "38", label: "cuisines" },
41
+ ],
42
+ proof: (
43
+ <span>
44
+ A margherita: <b className="font-mono font-medium">87 kitchens make one, 10 to 120 lei</b>
45
+ </span>
46
+ ),
47
+ proofIcon: <ArrowLeftRight className="h-3.5 w-3.5" />,
48
+ action: (
49
+ <Button size="sm" variant="secondary">
50
+ See the spread
51
+ </Button>
52
+ ),
53
+ },
54
+ };
55
+
56
+ /** The drinks tab: same component, different view model and copy. */
57
+ export const DrinksTab: Story = {
58
+ args: {
59
+ kicker: "397 MENUS IN CLUJ-NAPOCA, READ IN FULL",
60
+ kickerIcon: <UtensilsCrossed className="h-3 w-3" />,
61
+ headline: "The same negroni, across seventy-four bars.",
62
+ body: "Twenty-six thousand drinks, matched into concepts so the price comparison is real.",
63
+ figures: [
64
+ { value: "26,078", label: "drinks" },
65
+ { value: "397", label: "menus read" },
66
+ { value: "74", label: "bars pour a negroni" },
67
+ ],
68
+ },
69
+ };
70
+
71
+ /** No figures, no proof — the hero degrades to a claim and nothing else. */
72
+ export const ClaimOnly: Story = {
73
+ args: { headline: "Nobody should have to walk in blind." },
74
+ };
75
+
76
+ export const Mobile: Story = {
77
+ args: {
78
+ kicker: "397 MENUS READ IN FULL",
79
+ headline: "Nobody should have to walk in blind.",
80
+ figures: [
81
+ { value: "19,062", label: "dishes" },
82
+ { value: "397", label: "menus read" },
83
+ ],
84
+ },
85
+ decorators: [
86
+ (Story) => (
87
+ <div className="w-[390px] bg-background p-3">
88
+ <Story />
89
+ </div>
90
+ ),
91
+ ],
92
+ };