@atelic-action/ui 7.2.0 → 8.1.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/README.md +439 -132
- package/bin/atelic-check-sentry.ts +5 -0
- package/dist/gate/middleware.js +15 -1
- package/dist/monitoring/server.d.ts +72 -0
- package/dist/monitoring/server.js +201 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/marketing-config.d.ts +28 -1
- package/dist/vite/marketing-config.js +62 -0
- package/package.json +23 -11
- package/src/app/ErrorFallback.tsx +6 -2
- package/src/app/context/AppContext.tsx +10 -1
- package/src/app/index.ts +0 -1
- package/src/app/layout/AppPage.tsx +36 -7
- package/src/app/layout/DesktopRail.tsx +15 -6
- package/src/app/layout/MobileMenu.tsx +14 -5
- package/src/app/layout/MobileTabBar.tsx +3 -2
- package/src/app/layout/PageError.tsx +7 -4
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/SectionCards.tsx +7 -2
- package/src/app/layout/UserMenu.tsx +13 -7
- package/src/app/ui/alert.tsx +42 -12
- package/src/app/ui/badge.tsx +1 -1
- package/src/app/ui/button.tsx +2 -1
- package/src/app/ui/command.tsx +86 -21
- package/src/app/ui/country-dropdown.tsx +26 -47
- package/src/app/ui/form.tsx +48 -9
- package/src/app/ui/pagination.tsx +1 -1
- package/src/app/ui/progress.tsx +26 -12
- package/src/app/ui/search-input.tsx +16 -3
- package/src/app/ui/select.tsx +8 -3
- package/src/app/ui/slider.tsx +62 -15
- package/src/artifact/AppErrorBoundary.tsx +12 -7
- package/src/artifact/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +102 -17
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +361 -0
- package/src/chrome/Footer.tsx +126 -31
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +399 -0
- package/src/chrome/SiteHeader.tsx +268 -23
- package/src/chrome/SiteMenu.tsx +200 -19
- package/src/chrome/SiteShell.tsx +151 -14
- package/src/chrome/StickyCTABar.tsx +60 -2
- package/src/chrome/brandMark.ts +56 -0
- package/src/chrome/icons.ts +58 -0
- package/src/chrome/index.ts +16 -0
- package/src/chrome/navSections.ts +55 -0
- package/src/components/ColumnChart.tsx +27 -2
- package/src/components/DataTable.tsx +104 -85
- package/src/components/Disclosure.tsx +3 -1
- package/src/components/Hint.tsx +3 -24
- package/src/components/NotFound.tsx +7 -3
- package/src/components/StarRating.tsx +45 -19
- package/src/components/ThresholdScale.tsx +36 -26
- package/src/email/atoms.tsx +13 -57
- package/src/email/frame.tsx +4 -6
- package/src/email/index.ts +4 -10
- package/src/email/scoreboard.tsx +107 -186
- package/src/email/text.ts +30 -0
- package/src/email/theme.tsx +76 -9
- package/src/gate/middleware.ts +15 -1
- package/src/hooks/useDismiss.ts +39 -0
- package/src/lib/emailText.tsx +26 -0
- package/src/lib/phoneText.tsx +40 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/monitoring/ErrorCatcherScript.tsx +15 -0
- package/src/monitoring/catcher.ts +118 -0
- package/src/monitoring/index.ts +25 -0
- package/src/monitoring/sdk.ts +112 -0
- package/src/monitoring/server.ts +244 -0
- package/src/monitoring/start.ts +118 -0
- package/src/primitives/Button.tsx +5 -1
- package/src/primitives/Eyebrow.tsx +6 -2
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- package/src/routing/index.ts +1 -0
- package/src/routing/miss.ts +32 -0
- package/src/scripts/check-sentry.ts +77 -0
- package/src/sections/BlogIndex.tsx +17 -3
- package/src/sections/BlogPost.tsx +10 -1
- package/src/sections/CTASection.tsx +2 -2
- package/src/sections/CalloutPanel.tsx +34 -0
- package/src/sections/ComparisonTable.tsx +23 -2
- package/src/sections/ContactForm.tsx +61 -17
- package/src/sections/FAQBrowser.tsx +11 -2
- package/src/sections/FeatureGrid.tsx +6 -2
- package/src/sections/FullBleedVideo.tsx +167 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +70 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +80 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +18 -5
- package/src/sections/LogoMarquee.tsx +43 -11
- package/src/sections/MapEmbed.tsx +13 -9
- package/src/sections/PageHero.tsx +16 -2
- package/src/sections/ProcessSteps.tsx +27 -4
- package/src/sections/ProfileCards.tsx +12 -2
- package/src/sections/ProofStrip.tsx +44 -0
- package/src/sections/RevealSlider.tsx +28 -7
- package/src/sections/ReviewCarousel.tsx +17 -4
- package/src/sections/ReviewWall.tsx +2 -2
- package/src/sections/SplitSection.tsx +2 -1
- package/src/sections/index.ts +15 -6
- package/src/sections/siteConfig.ts +101 -8
- package/src/styles/app.css +33 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +68 -13
- package/src/styles/chrome.css +1134 -56
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +140 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +108 -39
- package/src/styles/sections.css +500 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +220 -3
- package/src/vite/index.ts +4 -0
- package/src/vite/marketing-config.ts +81 -1
- package/src/app/CardErrorBoundary.tsx +0 -39
- package/src/sections/CTABanner.tsx +0 -93
- package/src/sections/DeviceShowcase.tsx +0 -39
- package/src/sections/MediaBand.tsx +0 -20
- package/src/sections/MenuList.tsx +0 -44
- package/src/sections/PressQuotes.tsx +0 -51
- package/src/sections/SocialStrip.tsx +0 -83
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Link } from "@tanstack/react-router";
|
|
2
2
|
import { PanelRightClose, PanelRightOpen, Search, X } from "lucide-react";
|
|
3
|
-
import type
|
|
3
|
+
import { type ReactNode, useRef } from "react";
|
|
4
4
|
import { useRail } from "../context/SidebarContext";
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
6
|
import { OptionSelect } from "../ui/option-select";
|
|
@@ -150,11 +150,15 @@ export interface ToolbarFilter {
|
|
|
150
150
|
export interface ToolbarAction {
|
|
151
151
|
label?: string;
|
|
152
152
|
icon?: ReactNode;
|
|
153
|
-
/** Trailing muted timestamp (e.g. "
|
|
153
|
+
/** Trailing muted timestamp (e.g. "09:38"), part of the action's accessible name. */
|
|
154
154
|
ago?: string;
|
|
155
155
|
onClick?: () => void;
|
|
156
156
|
variant?: "ghost" | "solid";
|
|
157
157
|
disabled?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* The name for an action with no visible label (an icon alone). An action
|
|
160
|
+
* with a label is named by its words and its `ago`, so this is not needed.
|
|
161
|
+
*/
|
|
158
162
|
ariaLabel?: string;
|
|
159
163
|
/** Render the action as a router Link to this route instead of a button. */
|
|
160
164
|
to?: string;
|
|
@@ -167,7 +171,15 @@ interface AppPageToolbarProps {
|
|
|
167
171
|
search?: { value: string; onChange: (value: string) => void; placeholder?: string };
|
|
168
172
|
filters?: ToolbarFilter[];
|
|
169
173
|
actions?: ToolbarAction[];
|
|
170
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* Optional status line (a sync progress message), drawn between the
|
|
176
|
+
* search and actions row and the filters. From 1024px up the toolbar is
|
|
177
|
+
* one wrapping row, so it sits on the same line after the actions, before
|
|
178
|
+
* the filters, and wraps when the line is full; below that the toolbar
|
|
179
|
+
* stacks, so it is a line of its own under the search and the actions
|
|
180
|
+
* (which may have wrapped under the search) and above the filters.
|
|
181
|
+
* A plain block, never a live region, so a ticking line is not announced.
|
|
182
|
+
*/
|
|
171
183
|
notice?: ReactNode;
|
|
172
184
|
}
|
|
173
185
|
|
|
@@ -182,6 +194,7 @@ export function AppPageToolbar({
|
|
|
182
194
|
actions = [],
|
|
183
195
|
notice,
|
|
184
196
|
}: AppPageToolbarProps) {
|
|
197
|
+
const searchRef = useRef<HTMLInputElement>(null);
|
|
185
198
|
return (
|
|
186
199
|
<div className="ap-tools">
|
|
187
200
|
<div className="ap-toolrow">
|
|
@@ -189,6 +202,7 @@ export function AppPageToolbar({
|
|
|
189
202
|
<label className="ap-search">
|
|
190
203
|
<Search size={17} aria-hidden="true" />
|
|
191
204
|
<input
|
|
205
|
+
ref={searchRef}
|
|
192
206
|
type="search"
|
|
193
207
|
value={search.value}
|
|
194
208
|
onChange={(event) => search.onChange(event.target.value)}
|
|
@@ -199,10 +213,14 @@ export function AppPageToolbar({
|
|
|
199
213
|
<button
|
|
200
214
|
type="button"
|
|
201
215
|
className="ap-search-clear"
|
|
202
|
-
onClick={() =>
|
|
216
|
+
onClick={() => {
|
|
217
|
+
search.onChange("");
|
|
218
|
+
// The button leaves with the value, so focus goes back to the box.
|
|
219
|
+
searchRef.current?.focus();
|
|
220
|
+
}}
|
|
203
221
|
aria-label="Clear search"
|
|
204
222
|
>
|
|
205
|
-
<X size={15} />
|
|
223
|
+
<X size={15} aria-hidden="true" />
|
|
206
224
|
</button>
|
|
207
225
|
)}
|
|
208
226
|
</label>
|
|
@@ -220,10 +238,15 @@ export function AppPageToolbar({
|
|
|
220
238
|
to={action.to}
|
|
221
239
|
disabled={action.disabled}
|
|
222
240
|
className={className}
|
|
223
|
-
aria-label={
|
|
241
|
+
aria-label={
|
|
242
|
+
action.ariaLabel
|
|
243
|
+
? [action.ariaLabel, action.ago].filter(Boolean).join(" ")
|
|
244
|
+
: undefined
|
|
245
|
+
}
|
|
224
246
|
>
|
|
225
247
|
{action.icon}
|
|
226
248
|
{action.label}
|
|
249
|
+
{action.ago && <span className="ago">{action.ago}</span>}
|
|
227
250
|
</Link>
|
|
228
251
|
);
|
|
229
252
|
}
|
|
@@ -234,7 +257,13 @@ export function AppPageToolbar({
|
|
|
234
257
|
className={className}
|
|
235
258
|
onClick={action.onClick}
|
|
236
259
|
disabled={action.disabled}
|
|
237
|
-
aria-label
|
|
260
|
+
// The visible words name the action; an aria-label is
|
|
261
|
+
// for an icon only action, and keeps the visible time.
|
|
262
|
+
aria-label={
|
|
263
|
+
action.ariaLabel
|
|
264
|
+
? [action.ariaLabel, action.ago].filter(Boolean).join(" ")
|
|
265
|
+
: undefined
|
|
266
|
+
}
|
|
238
267
|
>
|
|
239
268
|
{action.icon}
|
|
240
269
|
{action.label}
|
|
@@ -35,8 +35,15 @@ function RailLink({
|
|
|
35
35
|
active && "bg-primary/10 text-primary font-medium",
|
|
36
36
|
);
|
|
37
37
|
const link = (
|
|
38
|
-
<Link
|
|
39
|
-
|
|
38
|
+
<Link
|
|
39
|
+
to={item.href}
|
|
40
|
+
className={className}
|
|
41
|
+
aria-current={active ? "page" : undefined}
|
|
42
|
+
// Collapsed, the label leaves the link and the tooltip only
|
|
43
|
+
// describes it, so the link carries the label as its name.
|
|
44
|
+
aria-label={collapsed ? item.label : undefined}
|
|
45
|
+
>
|
|
46
|
+
<Icon className="h-5 w-5 flex-shrink-0" aria-hidden="true" />
|
|
40
47
|
{!collapsed && <span>{item.label}</span>}
|
|
41
48
|
</Link>
|
|
42
49
|
);
|
|
@@ -124,19 +131,21 @@ export function DesktopRail({ pathname, collapsed, onToggle, user, onLogout }: D
|
|
|
124
131
|
<nav className="flex-1 space-y-1 px-4 py-6" aria-label="Primary navigation">
|
|
125
132
|
{navItems
|
|
126
133
|
.filter((item) => !item.mobileOnly)
|
|
127
|
-
.map((item) => {
|
|
134
|
+
.map((item, at) => {
|
|
128
135
|
const active = isActiveSection(pathname, item);
|
|
129
136
|
const showChildren = active && !collapsed && item.children?.length;
|
|
130
137
|
return (
|
|
131
|
-
|
|
138
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two entries may share a link, so the place keeps the key unique; the nav never reorders
|
|
139
|
+
<div key={at}>
|
|
132
140
|
<RailLink item={item} active={active} collapsed={collapsed} />
|
|
133
141
|
{showChildren ? (
|
|
134
142
|
<ul className="mt-1 space-y-0.5 pb-1" aria-label={`${item.label} pages`}>
|
|
135
|
-
{item.children?.map((child) => {
|
|
143
|
+
{item.children?.map((child, childAt) => {
|
|
136
144
|
const childActive = isActivePath(pathname, child.href);
|
|
137
145
|
const ChildIcon = child.icon;
|
|
138
146
|
return (
|
|
139
|
-
|
|
147
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two entries may share a link, so the place keeps the key unique; the nav never reorders
|
|
148
|
+
<li key={childAt}>
|
|
140
149
|
<Link
|
|
141
150
|
to={child.href}
|
|
142
151
|
className={cn(
|
|
@@ -72,14 +72,15 @@ export function MobileMenu({ pathname, user, onLogout }: MobileMenuProps) {
|
|
|
72
72
|
|
|
73
73
|
<nav className="flex-1 overflow-y-auto px-2 py-3" aria-label="Menu">
|
|
74
74
|
<ul className="space-y-0.5">
|
|
75
|
-
{navItems.map((item) => {
|
|
75
|
+
{navItems.map((item, at) => {
|
|
76
76
|
const Icon = item.icon;
|
|
77
77
|
const active = isActiveSection(pathname, item);
|
|
78
78
|
// A section with sub pages lights its row only on its own landing
|
|
79
79
|
// page; deeper in, the sub page row carries the highlight.
|
|
80
80
|
const exact = pathname === item.href;
|
|
81
81
|
return (
|
|
82
|
-
|
|
82
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two entries may share a link, so the place keeps the key unique; the nav never reorders
|
|
83
|
+
<li key={at}>
|
|
83
84
|
<Link
|
|
84
85
|
onClick={() => setOpen(false)}
|
|
85
86
|
to={item.href}
|
|
@@ -98,11 +99,12 @@ export function MobileMenu({ pathname, user, onLogout }: MobileMenuProps) {
|
|
|
98
99
|
</Link>
|
|
99
100
|
{item.children ? (
|
|
100
101
|
<ul className="mb-1 mt-0.5 space-y-0.5" aria-label={`${item.label} pages`}>
|
|
101
|
-
{item.children.map((child) => {
|
|
102
|
+
{item.children.map((child, childAt) => {
|
|
102
103
|
const ChildIcon = child.icon;
|
|
103
104
|
const childActive = isActivePath(pathname, child.href);
|
|
104
105
|
return (
|
|
105
|
-
|
|
106
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two entries may share a link, so the place keeps the key unique; the nav never reorders
|
|
107
|
+
<li key={childAt}>
|
|
106
108
|
<Link
|
|
107
109
|
onClick={() => setOpen(false)}
|
|
108
110
|
to={child.href}
|
|
@@ -145,7 +147,14 @@ export function MobileMenu({ pathname, user, onLogout }: MobileMenuProps) {
|
|
|
145
147
|
<span className="text-xs text-muted-foreground">Profile</span>
|
|
146
148
|
</span>
|
|
147
149
|
</Link>
|
|
148
|
-
<button
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
onClick={onLogout}
|
|
153
|
+
className={cn(
|
|
154
|
+
ROW,
|
|
155
|
+
"w-full text-destructive-ink active:text-destructive-hover dark:active:text-destructive-ink",
|
|
156
|
+
)}
|
|
157
|
+
>
|
|
149
158
|
<LogOut className="h-5 w-5 flex-shrink-0" />
|
|
150
159
|
<span>Log out</span>
|
|
151
160
|
</button>
|
|
@@ -18,12 +18,13 @@ export function MobileTabBar({ pathname }: { pathname: string }) {
|
|
|
18
18
|
<div className="flex h-16 items-center justify-around">
|
|
19
19
|
{navItems
|
|
20
20
|
.filter((item) => !item.desktopOnly)
|
|
21
|
-
.map((item) => {
|
|
21
|
+
.map((item, at) => {
|
|
22
22
|
const Icon = item.icon;
|
|
23
23
|
const active = isActiveSection(pathname, item);
|
|
24
24
|
return (
|
|
25
25
|
<Link
|
|
26
|
-
key
|
|
26
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two entries may share a link, so the place keeps the key unique; the nav never reorders
|
|
27
|
+
key={at}
|
|
27
28
|
to={item.href}
|
|
28
29
|
className={cn(
|
|
29
30
|
"flex h-full flex-1 flex-col items-center justify-center py-2 transition-colors duration-150 active:bg-accent",
|
|
@@ -13,15 +13,18 @@ interface PageErrorProps {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Standardized error state for pages.
|
|
16
|
-
* Provides consistent error display across the application.
|
|
16
|
+
* Provides consistent error display across the application. It is an alert,
|
|
17
|
+
* so a screen reader announces it once as it appears: the reader who started
|
|
18
|
+
* the load hears that it failed. Render it only when the error happens, not
|
|
19
|
+
* ahead of time with its words swapped in.
|
|
17
20
|
*/
|
|
18
21
|
export function PageError({ message, title = "Error", className }: PageErrorProps) {
|
|
19
22
|
return (
|
|
20
|
-
<Card className={cn("border-destructive/50", className)}>
|
|
23
|
+
<Card role="alert" className={cn("border-destructive/50", className)}>
|
|
21
24
|
<CardContent className="flex items-center gap-3 py-6">
|
|
22
|
-
<AlertCircle className="h-5 w-5 flex-shrink-0 text-destructive" />
|
|
25
|
+
<AlertCircle className="h-5 w-5 flex-shrink-0 text-destructive-ink" aria-hidden="true" />
|
|
23
26
|
<div>
|
|
24
|
-
<p className="font-medium text-destructive">{title}</p>
|
|
27
|
+
<p className="font-medium text-destructive-ink">{title}</p>
|
|
25
28
|
<p className="text-sm text-muted-foreground">{message}</p>
|
|
26
29
|
</div>
|
|
27
30
|
</CardContent>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { cn } from "../lib/utils";
|
|
2
1
|
import { Card, CardContent, CardHeader } from "../ui/card";
|
|
3
2
|
|
|
4
3
|
interface PageSkeletonProps {
|
|
@@ -12,11 +11,15 @@ interface PageSkeletonProps {
|
|
|
12
11
|
cardLayout?: "single" | "two-column" | "grid";
|
|
13
12
|
/** Additional className */
|
|
14
13
|
className?: string;
|
|
14
|
+
/** The words a screen reader hears while the page loads, visually hidden. Defaults to "Loading". */
|
|
15
|
+
label?: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Standardized loading skeleton for pages.
|
|
19
|
-
* Provides consistent loading states across the application.
|
|
20
|
+
* Provides consistent loading states across the application. The blocks are
|
|
21
|
+
* hidden from a screen reader, which hears the busy region's `label` instead,
|
|
22
|
+
* and the pulse stops for a reader who asks for reduced motion.
|
|
20
23
|
*/
|
|
21
24
|
export function PageSkeleton({
|
|
22
25
|
showHeader = true,
|
|
@@ -24,6 +27,7 @@ export function PageSkeleton({
|
|
|
24
27
|
cardCount = 3,
|
|
25
28
|
cardLayout = "single",
|
|
26
29
|
className,
|
|
30
|
+
label = "Loading",
|
|
27
31
|
}: PageSkeletonProps) {
|
|
28
32
|
const gridClasses = {
|
|
29
33
|
single: "space-y-6",
|
|
@@ -32,33 +36,36 @@ export function PageSkeleton({
|
|
|
32
36
|
};
|
|
33
37
|
|
|
34
38
|
return (
|
|
35
|
-
<div
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<div className="
|
|
39
|
+
<div aria-busy="true" className={className}>
|
|
40
|
+
<span className="sr-only">{label}</span>
|
|
41
|
+
<div aria-hidden="true" className="animate-pulse motion-reduce:animate-none">
|
|
42
|
+
{showHeader && (
|
|
43
|
+
<div className="mb-6 sm:mb-8">
|
|
44
|
+
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
|
45
|
+
<div className="space-y-2">
|
|
46
|
+
<div className="h-8 w-48 rounded bg-muted sm:h-9" />
|
|
47
|
+
<div className="h-4 w-64 rounded bg-muted sm:h-5" />
|
|
48
|
+
</div>
|
|
49
|
+
{showHeaderAction && <div className="h-10 w-32 rounded bg-muted" />}
|
|
42
50
|
</div>
|
|
43
|
-
{showHeaderAction && <div className="h-10 w-32 rounded bg-muted" />}
|
|
44
51
|
</div>
|
|
45
|
-
|
|
46
|
-
)}
|
|
52
|
+
)}
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
<div className={gridClasses[cardLayout]}>
|
|
55
|
+
{Array.from({ length: cardCount }).map((_, i) => (
|
|
56
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Static skeleton items never reorder
|
|
57
|
+
<Card key={i}>
|
|
58
|
+
<CardHeader>
|
|
59
|
+
<div className="h-6 w-2/3 rounded bg-muted" />
|
|
60
|
+
<div className="h-4 w-1/2 rounded bg-muted" />
|
|
61
|
+
</CardHeader>
|
|
62
|
+
<CardContent className="space-y-3">
|
|
63
|
+
<div className="h-4 w-full rounded bg-muted" />
|
|
64
|
+
<div className="h-4 w-3/4 rounded bg-muted" />
|
|
65
|
+
</CardContent>
|
|
66
|
+
</Card>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
62
69
|
</div>
|
|
63
70
|
</div>
|
|
64
71
|
);
|
|
@@ -14,10 +14,15 @@ export function SectionCards({ section }: { section: string }) {
|
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<nav className="ap-sections" aria-label={`${item.label} pages`}>
|
|
17
|
-
{item.children.map((child) => {
|
|
17
|
+
{item.children.map((child, at) => {
|
|
18
18
|
const Icon = child.icon;
|
|
19
19
|
return (
|
|
20
|
-
<Link
|
|
20
|
+
<Link
|
|
21
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two entries may share a link, so the place keeps the key unique; the nav never reorders
|
|
22
|
+
key={at}
|
|
23
|
+
to={child.href}
|
|
24
|
+
className="ap-section-card"
|
|
25
|
+
>
|
|
21
26
|
<span className="ic">
|
|
22
27
|
<Icon size={20} />
|
|
23
28
|
</span>
|
|
@@ -34,10 +34,16 @@ export function UserMenu({ user, onLogout, collapsed = false }: UserMenuProps) {
|
|
|
34
34
|
const name = displayName(user);
|
|
35
35
|
const initials = avatarInitials(name);
|
|
36
36
|
|
|
37
|
+
// The trigger is named by what it shows, never a fixed "User menu" that
|
|
38
|
+
// replaces it: the user's name expanded, the initials and the name
|
|
39
|
+
// (visually hidden) collapsed, so a voice user can say what they see.
|
|
40
|
+
// The picture is decorative either way, since the name is in the text.
|
|
37
41
|
const avatar = (
|
|
38
42
|
<Avatar className="h-9 w-9 border border-border/40 flex-shrink-0">
|
|
39
|
-
<AvatarImage src={user?.avatar ?? undefined} alt=
|
|
40
|
-
<AvatarFallback className="text-sm"
|
|
43
|
+
<AvatarImage src={user?.avatar ?? undefined} alt="" />
|
|
44
|
+
<AvatarFallback className="text-sm" aria-hidden={collapsed ? undefined : true}>
|
|
45
|
+
{initials}
|
|
46
|
+
</AvatarFallback>
|
|
41
47
|
</Avatar>
|
|
42
48
|
);
|
|
43
49
|
|
|
@@ -46,25 +52,25 @@ export function UserMenu({ user, onLogout, collapsed = false }: UserMenuProps) {
|
|
|
46
52
|
variant="ghost"
|
|
47
53
|
size="sm"
|
|
48
54
|
className="w-full p-2 hover:bg-accent"
|
|
49
|
-
aria-label="User menu"
|
|
50
55
|
aria-expanded={open}
|
|
51
|
-
aria-haspopup="
|
|
56
|
+
aria-haspopup="menu"
|
|
52
57
|
>
|
|
53
58
|
{avatar}
|
|
59
|
+
<span className="sr-only">{name}</span>
|
|
54
60
|
</Button>
|
|
55
61
|
) : (
|
|
56
62
|
<Button
|
|
57
63
|
variant="ghost"
|
|
58
64
|
className="w-full justify-between px-3 py-2.5 h-auto hover:bg-accent overflow-hidden"
|
|
59
|
-
aria-label="User menu"
|
|
60
65
|
aria-expanded={open}
|
|
61
|
-
aria-haspopup="
|
|
66
|
+
aria-haspopup="menu"
|
|
62
67
|
>
|
|
63
68
|
<div className="flex items-center space-x-3 min-w-0">
|
|
64
69
|
{avatar}
|
|
65
70
|
<span className="text-sm font-medium truncate">{name}</span>
|
|
66
71
|
</div>
|
|
67
72
|
<ChevronDown
|
|
73
|
+
aria-hidden="true"
|
|
68
74
|
className={cn("h-4 w-4 text-muted-foreground transition-transform", open && "rotate-180")}
|
|
69
75
|
/>
|
|
70
76
|
</Button>
|
|
@@ -94,7 +100,7 @@ export function UserMenu({ user, onLogout, collapsed = false }: UserMenuProps) {
|
|
|
94
100
|
</Link>
|
|
95
101
|
</DropdownMenuItem>
|
|
96
102
|
<DropdownMenuSeparator />
|
|
97
|
-
<DropdownMenuItem onClick={onLogout} className="cursor-pointer text-destructive">
|
|
103
|
+
<DropdownMenuItem onClick={onLogout} className="cursor-pointer text-destructive-ink">
|
|
98
104
|
<LogOut className="mr-2 h-4 w-4" />
|
|
99
105
|
<span>Log out</span>
|
|
100
106
|
</DropdownMenuItem>
|
package/src/app/ui/alert.tsx
CHANGED
|
@@ -10,7 +10,7 @@ const alertVariants = cva(
|
|
|
10
10
|
variant: {
|
|
11
11
|
default: "bg-background text-foreground",
|
|
12
12
|
destructive:
|
|
13
|
-
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
13
|
+
"border-destructive/50 text-destructive-ink dark:border-destructive [&>svg]:text-destructive-ink",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
defaultVariants: {
|
|
@@ -19,23 +19,53 @@ const alertVariants = cva(
|
|
|
19
19
|
},
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
HTMLDivElement
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
export interface AlertProps
|
|
23
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
24
|
+
VariantProps<typeof alertVariants> {
|
|
25
|
+
/**
|
|
26
|
+
* Announce the alert as it appears: "assertive" is `role="alert"`, which
|
|
27
|
+
* interrupts, and "polite" is `role="status"`, which waits its turn. Unset,
|
|
28
|
+
* the alert is a plain block read in its place, right for a notice that is
|
|
29
|
+
* on the page as it loads. A `role` passed directly still wins.
|
|
30
|
+
*/
|
|
31
|
+
announce?: "assertive" | "polite";
|
|
32
|
+
}
|
|
29
33
|
|
|
30
|
-
const
|
|
31
|
-
({ className, ...props }, ref) => (
|
|
32
|
-
<
|
|
34
|
+
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
|
|
35
|
+
({ className, variant, announce, ...props }, ref) => (
|
|
36
|
+
<div
|
|
33
37
|
ref={ref}
|
|
34
|
-
|
|
38
|
+
role={announce === "assertive" ? "alert" : announce === "polite" ? "status" : undefined}
|
|
39
|
+
className={cn(alertVariants({ variant }), className)}
|
|
35
40
|
{...props}
|
|
36
41
|
/>
|
|
37
42
|
),
|
|
38
43
|
);
|
|
44
|
+
Alert.displayName = "Alert";
|
|
45
|
+
|
|
46
|
+
type AlertTitleLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
47
|
+
|
|
48
|
+
export interface AlertTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
49
|
+
/**
|
|
50
|
+
* Make the title a heading at this level, for an alert that opens a part
|
|
51
|
+
* of the page. Unset, it is a paragraph styled as a title, since an alert
|
|
52
|
+
* rarely starts a section and a fixed level skips levels on most pages.
|
|
53
|
+
*/
|
|
54
|
+
level?: AlertTitleLevel;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const AlertTitle = React.forwardRef<HTMLHeadingElement, AlertTitleProps>(
|
|
58
|
+
({ className, level, ...props }, ref) => {
|
|
59
|
+
const Tag = (level ? `h${level}` : "p") as "h2" | "p";
|
|
60
|
+
return (
|
|
61
|
+
<Tag
|
|
62
|
+
ref={ref}
|
|
63
|
+
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
);
|
|
39
69
|
AlertTitle.displayName = "AlertTitle";
|
|
40
70
|
|
|
41
71
|
const AlertDescription = React.forwardRef<
|
package/src/app/ui/badge.tsx
CHANGED
|
@@ -12,7 +12,7 @@ const badgeVariants = cva(
|
|
|
12
12
|
secondary:
|
|
13
13
|
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
14
14
|
destructive:
|
|
15
|
-
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive
|
|
15
|
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive-hover",
|
|
16
16
|
outline: "text-foreground",
|
|
17
17
|
},
|
|
18
18
|
},
|
package/src/app/ui/button.tsx
CHANGED
|
@@ -10,7 +10,8 @@ const buttonVariants = cva(
|
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
12
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
-
destructive:
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive-hover active:bg-destructive-hover",
|
|
14
15
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
15
16
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
16
17
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
package/src/app/ui/command.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DialogProps } from "@radix-ui/react-dialog";
|
|
2
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
2
|
+
import { Command as CommandPrimitive, useCommandState } from "cmdk";
|
|
3
3
|
import { Search } from "lucide-react";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
|
-
import { Dialog, DialogContent } from "./dialog";
|
|
6
|
+
import { Dialog, DialogContent, DialogTitle } from "./dialog";
|
|
7
7
|
|
|
8
8
|
const Command = React.forwardRef<
|
|
9
9
|
React.ElementRef<typeof CommandPrimitive>,
|
|
@@ -20,10 +20,46 @@ const Command = React.forwardRef<
|
|
|
20
20
|
));
|
|
21
21
|
Command.displayName = CommandPrimitive.displayName;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export interface CommandDialogProps extends DialogProps {
|
|
24
|
+
/** The dialog's name, which a screen reader announces as it opens. Defaults to "Commands". */
|
|
25
|
+
title?: string;
|
|
26
|
+
/** Show the title above the search. Hidden by default, still read. */
|
|
27
|
+
showTitle?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The command palette in a dialog. It is opened by state (a shortcut, a
|
|
32
|
+
* button's handler) rather than a trigger of its own, so it remembers what
|
|
33
|
+
* had focus as it opens and hands focus back there as it closes, which
|
|
34
|
+
* Radix does only for a `DialogTrigger`.
|
|
35
|
+
*/
|
|
36
|
+
const CommandDialog = ({
|
|
37
|
+
children,
|
|
38
|
+
title = "Commands",
|
|
39
|
+
showTitle = false,
|
|
40
|
+
...props
|
|
41
|
+
}: CommandDialogProps) => {
|
|
42
|
+
const returnTo = React.useRef<HTMLElement | null>(null);
|
|
24
43
|
return (
|
|
25
44
|
<Dialog {...props}>
|
|
26
|
-
<DialogContent
|
|
45
|
+
<DialogContent
|
|
46
|
+
aria-describedby={undefined}
|
|
47
|
+
className="overflow-hidden p-0 shadow-lg"
|
|
48
|
+
onOpenAutoFocus={() => {
|
|
49
|
+
const active = document.activeElement;
|
|
50
|
+
returnTo.current =
|
|
51
|
+
active instanceof HTMLElement && active !== document.body ? active : null;
|
|
52
|
+
}}
|
|
53
|
+
onCloseAutoFocus={(event) => {
|
|
54
|
+
const target = returnTo.current;
|
|
55
|
+
returnTo.current = null;
|
|
56
|
+
if (target?.isConnected) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
target.focus();
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<DialogTitle className={showTitle ? "px-4 pt-4 text-base" : "sr-only"}>{title}</DialogTitle>
|
|
27
63
|
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
28
64
|
{children}
|
|
29
65
|
</Command>
|
|
@@ -64,14 +100,32 @@ const CommandList = React.forwardRef<
|
|
|
64
100
|
|
|
65
101
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
66
102
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The line shown when nothing matches. It sits inside the list, which is a
|
|
105
|
+
* listbox and may hold only options, so it is drawn as one disabled option
|
|
106
|
+
* rather than cmdk's presentational block: a reader hears "No results" as the
|
|
107
|
+
* list's one entry instead of an empty list.
|
|
108
|
+
*/
|
|
109
|
+
const CommandEmpty = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
110
|
+
({ className, ...props }, ref) => {
|
|
111
|
+
const empty = useCommandState((state) => state.filtered.count === 0);
|
|
112
|
+
if (!empty) return null;
|
|
113
|
+
return (
|
|
114
|
+
// biome-ignore lint/a11y/useFocusableInteractive: the list moves its highlight by aria-activedescendant, and this option is disabled
|
|
115
|
+
<div
|
|
116
|
+
ref={ref}
|
|
117
|
+
cmdk-empty=""
|
|
118
|
+
role="option"
|
|
119
|
+
aria-disabled="true"
|
|
120
|
+
aria-selected="false"
|
|
121
|
+
className={cn("py-6 text-center text-sm", className)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
);
|
|
73
127
|
|
|
74
|
-
CommandEmpty.displayName =
|
|
128
|
+
CommandEmpty.displayName = "CommandEmpty";
|
|
75
129
|
|
|
76
130
|
const CommandGroup = React.forwardRef<
|
|
77
131
|
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
@@ -89,17 +143,28 @@ const CommandGroup = React.forwardRef<
|
|
|
89
143
|
|
|
90
144
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
91
145
|
|
|
146
|
+
/**
|
|
147
|
+
* A rule between groups, hidden while a search is typed (as cmdk's own is)
|
|
148
|
+
* unless `alwaysRender`. It is drawn with no role, since the list it sits in
|
|
149
|
+
* is a listbox and may hold only options and groups; a rule is decoration.
|
|
150
|
+
*/
|
|
92
151
|
const CommandSeparator = React.forwardRef<
|
|
93
|
-
|
|
94
|
-
React.
|
|
95
|
-
>(({ className, ...props }, ref) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
152
|
+
HTMLDivElement,
|
|
153
|
+
React.HTMLAttributes<HTMLDivElement> & { alwaysRender?: boolean }
|
|
154
|
+
>(({ className, alwaysRender = false, ...props }, ref) => {
|
|
155
|
+
const idle = useCommandState((state) => !state.search);
|
|
156
|
+
if (!alwaysRender && !idle) return null;
|
|
157
|
+
return (
|
|
158
|
+
<div
|
|
159
|
+
ref={ref}
|
|
160
|
+
cmdk-separator=""
|
|
161
|
+
role="none"
|
|
162
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
CommandSeparator.displayName = "CommandSeparator";
|
|
103
168
|
|
|
104
169
|
const CommandItem = React.forwardRef<
|
|
105
170
|
React.ElementRef<typeof CommandPrimitive.Item>,
|