@atelic-action/ui 7.1.0 → 8.0.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.
Files changed (105) hide show
  1. package/README.md +313 -127
  2. package/package.json +14 -10
  3. package/src/app/ErrorFallback.tsx +6 -2
  4. package/src/app/context/AppContext.tsx +10 -1
  5. package/src/app/index.ts +0 -1
  6. package/src/app/layout/AppPage.tsx +36 -7
  7. package/src/app/layout/DesktopRail.tsx +9 -2
  8. package/src/app/layout/MobileMenu.tsx +5 -1
  9. package/src/app/layout/PageError.tsx +6 -3
  10. package/src/app/layout/PageSkeleton.tsx +33 -26
  11. package/src/app/layout/UserMenu.tsx +12 -6
  12. package/src/app/ui/alert.tsx +41 -11
  13. package/src/app/ui/badge.tsx +1 -1
  14. package/src/app/ui/button.tsx +2 -1
  15. package/src/app/ui/command.tsx +86 -21
  16. package/src/app/ui/country-dropdown.tsx +26 -47
  17. package/src/app/ui/form.tsx +46 -7
  18. package/src/app/ui/pagination.tsx +1 -1
  19. package/src/app/ui/progress.tsx +26 -12
  20. package/src/app/ui/search-input.tsx +16 -3
  21. package/src/app/ui/select.tsx +8 -3
  22. package/src/app/ui/slider.tsx +62 -15
  23. package/src/artifact/ArtifactShell.tsx +8 -3
  24. package/src/artifact/ErrorFallback.tsx +8 -1
  25. package/src/artifact/artifactConfig.ts +1 -1
  26. package/src/chrome/BrandLockup.tsx +71 -16
  27. package/src/chrome/ClosingBar.tsx +8 -5
  28. package/src/chrome/ContactDock.tsx +329 -0
  29. package/src/chrome/Footer.tsx +32 -9
  30. package/src/chrome/NavBadge.tsx +8 -0
  31. package/src/chrome/NavMegaPanel.tsx +388 -0
  32. package/src/chrome/SiteHeader.tsx +235 -18
  33. package/src/chrome/SiteMenu.tsx +197 -19
  34. package/src/chrome/SiteShell.tsx +130 -13
  35. package/src/chrome/StickyCTABar.tsx +56 -2
  36. package/src/chrome/brandMark.ts +56 -0
  37. package/src/chrome/icons.ts +58 -0
  38. package/src/chrome/index.ts +16 -0
  39. package/src/chrome/navSections.ts +55 -0
  40. package/src/components/ColumnChart.tsx +27 -2
  41. package/src/components/DataTable.tsx +104 -85
  42. package/src/components/Disclosure.tsx +3 -1
  43. package/src/components/Hint.tsx +3 -24
  44. package/src/components/NotFound.tsx +4 -1
  45. package/src/components/StarRating.tsx +45 -19
  46. package/src/components/ThresholdScale.tsx +36 -26
  47. package/src/email/atoms.tsx +13 -57
  48. package/src/email/frame.tsx +4 -6
  49. package/src/email/index.ts +4 -10
  50. package/src/email/scoreboard.tsx +107 -186
  51. package/src/email/text.ts +30 -0
  52. package/src/email/theme.tsx +76 -9
  53. package/src/hooks/useDismiss.ts +39 -0
  54. package/src/lib/useScrollsSideways.ts +26 -0
  55. package/src/primitives/Button.tsx +2 -0
  56. package/src/primitives/ProseBlocks.tsx +6 -1
  57. package/src/primitives/SectionHeading.tsx +3 -1
  58. package/src/primitives/StarRow.tsx +23 -8
  59. package/src/sections/BlogIndex.tsx +17 -3
  60. package/src/sections/BlogPost.tsx +10 -1
  61. package/src/sections/CTASection.tsx +2 -2
  62. package/src/sections/CalloutPanel.tsx +34 -0
  63. package/src/sections/ComparisonTable.tsx +23 -2
  64. package/src/sections/ContactForm.tsx +61 -17
  65. package/src/sections/FAQBrowser.tsx +11 -2
  66. package/src/sections/FeatureGrid.tsx +6 -2
  67. package/src/sections/FullBleedVideo.tsx +158 -0
  68. package/src/sections/Gallery.tsx +6 -4
  69. package/src/sections/Hero.tsx +63 -39
  70. package/src/sections/JumpRail.tsx +7 -0
  71. package/src/sections/LegalPage.tsx +10 -2
  72. package/src/sections/LinkColumns.tsx +64 -0
  73. package/src/sections/LocationSection.tsx +28 -5
  74. package/src/sections/Locations.tsx +17 -4
  75. package/src/sections/LogoMarquee.tsx +43 -11
  76. package/src/sections/MapEmbed.tsx +13 -9
  77. package/src/sections/PageHero.tsx +16 -2
  78. package/src/sections/ProcessSteps.tsx +27 -4
  79. package/src/sections/ProfileCards.tsx +12 -2
  80. package/src/sections/ProofStrip.tsx +44 -0
  81. package/src/sections/RevealSlider.tsx +28 -7
  82. package/src/sections/ReviewCarousel.tsx +17 -4
  83. package/src/sections/ReviewWall.tsx +2 -2
  84. package/src/sections/SplitSection.tsx +2 -1
  85. package/src/sections/index.ts +15 -6
  86. package/src/sections/siteConfig.ts +66 -3
  87. package/src/styles/app.css +24 -2
  88. package/src/styles/artifact.css +20 -8
  89. package/src/styles/base.css +42 -13
  90. package/src/styles/chrome.css +938 -48
  91. package/src/styles/components.css +104 -65
  92. package/src/styles/defaults.css +137 -0
  93. package/src/styles/gate.css +21 -10
  94. package/src/styles/primitives.css +97 -35
  95. package/src/styles/sections.css +477 -437
  96. package/src/styles/star-rating.css +1 -4
  97. package/src/tokens/palettes.ts +24 -4
  98. package/src/types.ts +212 -2
  99. package/src/app/CardErrorBoundary.tsx +0 -39
  100. package/src/sections/CTABanner.tsx +0 -93
  101. package/src/sections/DeviceShowcase.tsx +0 -39
  102. package/src/sections/MediaBand.tsx +0 -20
  103. package/src/sections/MenuList.tsx +0 -44
  104. package/src/sections/PressQuotes.tsx +0 -51
  105. package/src/sections/SocialStrip.tsx +0 -83
@@ -0,0 +1,388 @@
1
+ import { ChevronRight } from "lucide-react";
2
+ import { newTabProps } from "../lib/newTabProps";
3
+ import { Button } from "../primitives/Button";
4
+ import { TickList } from "../primitives/TickList";
5
+ import type {
6
+ NavCardsSection,
7
+ NavGroupChildLink,
8
+ NavGroupColumn,
9
+ NavIconRowsSection,
10
+ NavLink,
11
+ NavPanelSection,
12
+ NavPictureSection,
13
+ } from "../types";
14
+ import { navIcons } from "./icons";
15
+ import { NavBadge } from "./NavBadge";
16
+ import { isLinkColumn, panelSections } from "./navSections";
17
+
18
+ export interface NavMegaPanelProps {
19
+ id: string;
20
+ /** The group whose sections and feature card the panel holds. */
21
+ group: NavLink;
22
+ open: boolean;
23
+ currentPath?: string;
24
+ /** Called when a link in the panel is followed, so the header can close it. */
25
+ onNavigate?: () => void;
26
+ }
27
+
28
+ /**
29
+ * The key a section is listed under: its place and its kind. Two sections
30
+ * may share a heading or an href, so the place keeps every key unique.
31
+ */
32
+ function sectionKey(section: NavPanelSection, index: number): string {
33
+ return `${index} ${isLinkColumn(section) ? "links" : section.kind}`;
34
+ }
35
+
36
+ function Badge({ text }: { text?: string }) {
37
+ return <NavBadge text={text} className="nav-mega-badge" />;
38
+ }
39
+
40
+ /**
41
+ * Says whether a link is the panel's current item, as its `aria-current`,
42
+ * by the link's place in the panel (`linkKey`).
43
+ */
44
+ type Current = (key: string) => "page" | undefined;
45
+
46
+ /** A link's place in the panel: which section, and where inside it. */
47
+ function linkKey(section: number, ...place: (number | string)[]): string {
48
+ return [section, ...place].join(" ");
49
+ }
50
+
51
+ /**
52
+ * The place of the panel's one current item: the first link, in reading
53
+ * order, to the page being read. A panel may link one page several times
54
+ * (the group's own page as its "all" link and a column's head, a child
55
+ * sharing its parent's href), and a reader is told the page is here once.
56
+ * Worked out from the props alone, in the order the links render, so any
57
+ * render (StrictMode's second, a child's on its own) marks the same link.
58
+ */
59
+ function currentKey(
60
+ group: NavLink,
61
+ sections: NavPanelSection[],
62
+ currentPath?: string,
63
+ ): string | undefined {
64
+ if (currentPath === undefined) return undefined;
65
+ if (group.allLabel && group.href === currentPath) return "all";
66
+ for (const [index, section] of sections.entries()) {
67
+ if (isLinkColumn(section)) {
68
+ if (section.href === currentPath) return linkKey(index, "head");
69
+ for (const [at, link] of section.links.entries()) {
70
+ if (link.href === currentPath) return linkKey(index, at);
71
+ for (const [child, sub] of (link.children ?? []).entries()) {
72
+ if (sub.href === currentPath) return linkKey(index, at, child);
73
+ }
74
+ }
75
+ } else if (section.kind === "picture") {
76
+ if (section.href === currentPath) return linkKey(index, "picture");
77
+ } else if (section.kind === "rows") {
78
+ for (const [at, row] of section.rows.entries()) {
79
+ if (row.href === currentPath) return linkKey(index, "row", at);
80
+ }
81
+ } else if (section.kind === "cards") {
82
+ for (const [at, card] of section.cards.entries()) {
83
+ if (card.href === currentPath) return linkKey(index, "card", at);
84
+ }
85
+ }
86
+ }
87
+ return undefined;
88
+ }
89
+
90
+ interface SectionProps {
91
+ /** The section's place in the panel, which its links' keys begin with. */
92
+ index: number;
93
+ current: Current;
94
+ onNavigate?: () => void;
95
+ }
96
+
97
+ function LinkColumn({
98
+ column,
99
+ index,
100
+ current,
101
+ onNavigate,
102
+ }: { column: NavGroupColumn } & SectionProps) {
103
+ // A child may share its parent's href, and two links may share one, so
104
+ // every key carries its place.
105
+ const child = (parent: number) => (link: NavGroupChildLink, at: number) => (
106
+ <li key={`${at} ${link.href}`}>
107
+ <a
108
+ className="nav-mega-sub"
109
+ href={link.href}
110
+ onClick={onNavigate}
111
+ aria-current={current(linkKey(index, parent, at))}
112
+ {...newTabProps(link.href, link.external)}
113
+ >
114
+ {link.label}
115
+ <Badge text={link.badge} />
116
+ </a>
117
+ </li>
118
+ );
119
+ return (
120
+ <div className="nav-mega-sec is-links">
121
+ {column.href ? (
122
+ <a
123
+ className="nav-mega-head"
124
+ href={column.href}
125
+ onClick={onNavigate}
126
+ aria-current={current(linkKey(index, "head"))}
127
+ >
128
+ {column.heading}
129
+ </a>
130
+ ) : (
131
+ <p className="nav-mega-head">{column.heading}</p>
132
+ )}
133
+ <ul>
134
+ {column.links.map((link, at) => (
135
+ // biome-ignore lint/suspicious/noArrayIndexKey: two links may share an href, so the place keeps the key unique; a panel's links never reorder
136
+ <li key={`${at} ${link.href}`}>
137
+ <a
138
+ className="nav-mega-link"
139
+ href={link.href}
140
+ onClick={onNavigate}
141
+ aria-current={current(linkKey(index, at))}
142
+ {...newTabProps(link.href, link.external)}
143
+ >
144
+ <span className="nav-mega-label">
145
+ {link.label}
146
+ <Badge text={link.badge} />
147
+ </span>
148
+ {link.description && <span className="nav-mega-desc">{link.description}</span>}
149
+ </a>
150
+ {link.children && link.children.length > 0 && (
151
+ <ul className="nav-mega-children">{link.children.map(child(at))}</ul>
152
+ )}
153
+ </li>
154
+ ))}
155
+ </ul>
156
+ </div>
157
+ );
158
+ }
159
+
160
+ function PictureSection({
161
+ section,
162
+ index,
163
+ current,
164
+ onNavigate,
165
+ }: { section: NavPictureSection } & SectionProps) {
166
+ return (
167
+ <a
168
+ className="nav-mega-sec is-picture"
169
+ href={section.href}
170
+ onClick={onNavigate}
171
+ aria-current={current(linkKey(index, "picture"))}
172
+ {...newTabProps(section.href, section.external)}
173
+ >
174
+ <img
175
+ className="nav-mega-picture"
176
+ src={section.image.src}
177
+ alt={section.image.alt ?? ""}
178
+ loading="lazy"
179
+ decoding="async"
180
+ />
181
+ <span className="nav-mega-caption">{section.caption}</span>
182
+ </a>
183
+ );
184
+ }
185
+
186
+ function RowsSection({
187
+ section,
188
+ index,
189
+ current,
190
+ onNavigate,
191
+ }: { section: NavIconRowsSection } & SectionProps) {
192
+ return (
193
+ <div className="nav-mega-sec is-rows">
194
+ {section.heading && <p className="nav-mega-head">{section.heading}</p>}
195
+ <ul className="nav-mega-rows">
196
+ {section.rows.map((row, at) => {
197
+ const Icon = navIcons[row.icon];
198
+ return (
199
+ // biome-ignore lint/suspicious/noArrayIndexKey: two links may share an href, so the place keeps the key unique; a panel's links never reorder
200
+ <li key={`${at} ${row.href}`}>
201
+ <a
202
+ className={["nav-mega-row", row.highlight && "is-highlight"]
203
+ .filter(Boolean)
204
+ .join(" ")}
205
+ href={row.href}
206
+ onClick={onNavigate}
207
+ aria-current={current(linkKey(index, "row", at))}
208
+ {...newTabProps(row.href, row.external)}
209
+ >
210
+ <span className="nav-mega-row-icon">
211
+ <Icon size={21} strokeWidth={1.75} aria-hidden="true" />
212
+ </span>
213
+ <span className="nav-mega-row-text">
214
+ <span className="nav-mega-row-label">{row.label}</span>
215
+ {row.description && <span className="nav-mega-row-desc">{row.description}</span>}
216
+ </span>
217
+ <ChevronRight className="nav-mega-row-go" size={16} aria-hidden="true" />
218
+ </a>
219
+ </li>
220
+ );
221
+ })}
222
+ </ul>
223
+ </div>
224
+ );
225
+ }
226
+
227
+ function CardsSection({
228
+ section,
229
+ index,
230
+ current,
231
+ onNavigate,
232
+ }: { section: NavCardsSection } & SectionProps) {
233
+ return (
234
+ <div className="nav-mega-sec is-cards">
235
+ {section.heading && <p className="nav-mega-head">{section.heading}</p>}
236
+ <ul className="nav-mega-cards">
237
+ {section.cards.map((card, at) => (
238
+ // biome-ignore lint/suspicious/noArrayIndexKey: two links may share an href, so the place keeps the key unique; a panel's links never reorder
239
+ <li key={`${at} ${card.href}`}>
240
+ <a
241
+ className="nav-mega-card-link"
242
+ href={card.href}
243
+ onClick={onNavigate}
244
+ aria-current={current(linkKey(index, "card", at))}
245
+ {...newTabProps(card.href, card.external)}
246
+ >
247
+ {card.image ? (
248
+ <img
249
+ className="nav-mega-thumb"
250
+ src={card.image.src}
251
+ alt={card.image.alt ?? ""}
252
+ loading="lazy"
253
+ decoding="async"
254
+ />
255
+ ) : (
256
+ <span className="nav-mega-thumb" aria-hidden="true" />
257
+ )}
258
+ <span className="nav-mega-card-text">
259
+ {card.kicker && <span className="nav-mega-kicker">{card.kicker}</span>}
260
+ <span className="nav-mega-card-title">{card.title}</span>
261
+ {card.meta && <span className="nav-mega-meta">{card.meta}</span>}
262
+ </span>
263
+ </a>
264
+ </li>
265
+ ))}
266
+ </ul>
267
+ </div>
268
+ );
269
+ }
270
+
271
+ /**
272
+ * The desktop panel a nav group opens: one card under the bar, as wide as
273
+ * the page's wrap, holding the group's sections left to right (link columns,
274
+ * a picture, icon rows, small cards) and, when the group has one, the
275
+ * feature card at the right. It renders whether open or not, `inert` while
276
+ * closed, so the links ship in the static HTML and leave the tab order until
277
+ * it opens. The header owns the open state; this draws it.
278
+ */
279
+ export function NavMegaPanel({ id, group, open, currentPath, onNavigate }: NavMegaPanelProps) {
280
+ const { feature, allLabel, href } = group;
281
+ // A section of a kind this version does not know is left out, never drawn as another kind.
282
+ const columns = panelSections(group);
283
+ const claim = currentKey(group, columns, currentPath);
284
+ const current: Current = (key) => (key === claim ? "page" : undefined);
285
+ return (
286
+ <div
287
+ id={id}
288
+ className={["nav-mega", open && "is-open"].filter(Boolean).join(" ")}
289
+ inert={!open}
290
+ >
291
+ <div className="nav-mega-card">
292
+ <div className="nav-mega-body">
293
+ {allLabel && (
294
+ <a
295
+ className="nav-mega-all"
296
+ href={href}
297
+ onClick={onNavigate}
298
+ aria-current={current("all")}
299
+ >
300
+ {allLabel}
301
+ </a>
302
+ )}
303
+ <div className="nav-mega-sections">
304
+ {columns.map((section, index) => {
305
+ const key = sectionKey(section, index);
306
+ if (isLinkColumn(section)) {
307
+ return (
308
+ <LinkColumn
309
+ key={key}
310
+ index={index}
311
+ column={section}
312
+ current={current}
313
+ onNavigate={onNavigate}
314
+ />
315
+ );
316
+ }
317
+ if (section.kind === "picture") {
318
+ return (
319
+ <PictureSection
320
+ key={key}
321
+ index={index}
322
+ section={section}
323
+ current={current}
324
+ onNavigate={onNavigate}
325
+ />
326
+ );
327
+ }
328
+ if (section.kind === "rows") {
329
+ return (
330
+ <RowsSection
331
+ key={key}
332
+ index={index}
333
+ section={section}
334
+ current={current}
335
+ onNavigate={onNavigate}
336
+ />
337
+ );
338
+ }
339
+ if (section.kind === "cards") {
340
+ return (
341
+ <CardsSection
342
+ key={key}
343
+ index={index}
344
+ section={section}
345
+ current={current}
346
+ onNavigate={onNavigate}
347
+ />
348
+ );
349
+ }
350
+ return null;
351
+ })}
352
+ </div>
353
+ </div>
354
+ {feature && (
355
+ // The card is the primary field, so its button turns light (.on-primary).
356
+ <div className="nav-feature on-primary">
357
+ {feature.image && (
358
+ <img
359
+ className="nav-feature-img"
360
+ src={feature.image.src}
361
+ alt={feature.image.alt}
362
+ loading="lazy"
363
+ decoding="async"
364
+ />
365
+ )}
366
+ <div className="nav-feature-body">
367
+ {feature.eyebrow && <p className="nav-feature-eyebrow">{feature.eyebrow}</p>}
368
+ <p className="nav-feature-title">{feature.title}</p>
369
+ {feature.text && <p className="nav-feature-text">{feature.text}</p>}
370
+ {feature.points && feature.points.length > 0 && (
371
+ <TickList className="nav-feature-points" items={feature.points} />
372
+ )}
373
+ <Button
374
+ className="nav-feature-cta"
375
+ href={feature.cta.href}
376
+ newTab={feature.cta.external}
377
+ onClick={onNavigate}
378
+ arrow
379
+ >
380
+ {feature.cta.label}
381
+ </Button>
382
+ </div>
383
+ </div>
384
+ )}
385
+ </div>
386
+ </div>
387
+ );
388
+ }