@atelic-action/ui 7.2.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.
- package/README.md +312 -126
- package/package.json +14 -10
- 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 +9 -2
- package/src/app/layout/MobileMenu.tsx +5 -1
- package/src/app/layout/PageError.tsx +6 -3
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/UserMenu.tsx +12 -6
- package/src/app/ui/alert.tsx +41 -11
- 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 +46 -7
- 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/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +71 -16
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +329 -0
- package/src/chrome/Footer.tsx +32 -9
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +388 -0
- package/src/chrome/SiteHeader.tsx +235 -18
- package/src/chrome/SiteMenu.tsx +197 -19
- package/src/chrome/SiteShell.tsx +130 -13
- package/src/chrome/StickyCTABar.tsx +56 -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 +4 -1
- 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/hooks/useDismiss.ts +39 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/primitives/Button.tsx +2 -0
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- 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 +158 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +63 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +64 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +17 -4
- 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 +66 -3
- package/src/styles/app.css +24 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +42 -13
- package/src/styles/chrome.css +935 -47
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +137 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +97 -35
- package/src/styles/sections.css +477 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +212 -2
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Shared UI for the Atelic templates: site chrome, base styles, the component library, the access gate, and the app shell they install",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -95,10 +95,11 @@
|
|
|
95
95
|
"prepack": "bun run build",
|
|
96
96
|
"lint": "biome check .",
|
|
97
97
|
"lint:fix": "biome check . --write",
|
|
98
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.server.json && tsc --noEmit -p
|
|
99
|
-
"test:run": "vitest run",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
98
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.server.json && tsc --noEmit -p stories",
|
|
99
|
+
"test:run": "vitest run --project=unit",
|
|
100
|
+
"test:stories": "vitest run --project=storybook",
|
|
101
|
+
"storybook": "storybook dev --port 6006",
|
|
102
|
+
"storybook:build": "storybook build --output-dir storybook-static"
|
|
102
103
|
},
|
|
103
104
|
"dependencies": {
|
|
104
105
|
"@radix-ui/react-tabs": "^1.2.1",
|
|
@@ -130,7 +131,6 @@
|
|
|
130
131
|
"country-data-list": "^1.6.0",
|
|
131
132
|
"lucide-react": "^1.23.0",
|
|
132
133
|
"react": "^19.0.0",
|
|
133
|
-
"react-circle-flags": "^0.0.25",
|
|
134
134
|
"react-dom": "^19.0.0",
|
|
135
135
|
"react-hook-form": "^7.71.1",
|
|
136
136
|
"sonner": "^2.0.7",
|
|
@@ -210,9 +210,6 @@
|
|
|
210
210
|
"country-data-list": {
|
|
211
211
|
"optional": true
|
|
212
212
|
},
|
|
213
|
-
"react-circle-flags": {
|
|
214
|
-
"optional": true
|
|
215
|
-
},
|
|
216
213
|
"react-hook-form": {
|
|
217
214
|
"optional": true
|
|
218
215
|
},
|
|
@@ -252,6 +249,10 @@
|
|
|
252
249
|
"@radix-ui/react-slot": "^1.2.4",
|
|
253
250
|
"@radix-ui/react-switch": "^1.2.6",
|
|
254
251
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
252
|
+
"@storybook/addon-a11y": "^10.6.8",
|
|
253
|
+
"@storybook/addon-docs": "^10.6.8",
|
|
254
|
+
"@storybook/addon-vitest": "^10.6.8",
|
|
255
|
+
"@storybook/react-vite": "^10.6.8",
|
|
255
256
|
"@tailwindcss/vite": "^4.1.17",
|
|
256
257
|
"@tanstack/react-query": "^5.59.0",
|
|
257
258
|
"@tanstack/react-router": "^1.81.4",
|
|
@@ -264,17 +265,20 @@
|
|
|
264
265
|
"@types/react": "^19.0.0",
|
|
265
266
|
"@types/react-dom": "^19.0.0",
|
|
266
267
|
"@vitejs/plugin-react": "^6.1.1",
|
|
268
|
+
"@vitest/browser": "^4.1.11",
|
|
269
|
+
"@vitest/browser-playwright": "^4.1.11",
|
|
267
270
|
"class-variance-authority": "^0.7.0",
|
|
268
271
|
"clsx": "^2.1.1",
|
|
269
272
|
"cmdk": "^1.1.1",
|
|
270
273
|
"country-data-list": "^1.6.0",
|
|
271
274
|
"jsdom": "^25.0.1",
|
|
272
275
|
"lucide-react": "^1.23.0",
|
|
276
|
+
"playwright": "^1.65.1",
|
|
273
277
|
"react": "^19.0.0",
|
|
274
|
-
"react-circle-flags": "^0.0.25",
|
|
275
278
|
"react-dom": "^19.0.0",
|
|
276
279
|
"react-hook-form": "^7.71.1",
|
|
277
280
|
"sonner": "^2.0.7",
|
|
281
|
+
"storybook": "^10.6.8",
|
|
278
282
|
"tailwind-merge": "^3.0.0",
|
|
279
283
|
"tailwindcss": "^4.1.17",
|
|
280
284
|
"tailwindcss-animate": "^1.0.7",
|
|
@@ -20,13 +20,17 @@ export function ErrorFallback({ error, resetError, showDetails = false }: ErrorF
|
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<div className="flex min-h-screen items-center justify-center bg-background p-4">
|
|
23
|
-
<div className="max-w-md text-center">
|
|
23
|
+
<div className="w-full min-w-0 max-w-md text-center">
|
|
24
24
|
<h1 className="text-2xl font-semibold text-foreground">Something went wrong</h1>
|
|
25
25
|
<p className="mt-2 text-sm text-muted-foreground">
|
|
26
26
|
An unexpected error occurred. Please try again.
|
|
27
27
|
</p>
|
|
28
28
|
{showDetails && (
|
|
29
|
-
<pre
|
|
29
|
+
<pre
|
|
30
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: a box that scrolls takes focus, so a keyboard can scroll it
|
|
31
|
+
tabIndex={0}
|
|
32
|
+
className="mt-4 max-h-40 overflow-auto rounded bg-muted p-3 text-left text-xs text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
33
|
+
>
|
|
30
34
|
{errorMessage}
|
|
31
35
|
</pre>
|
|
32
36
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, type ReactNode, useContext, useMemo, useRef } from "react";
|
|
2
|
-
import { type AppConfig, getAppConfig } from "../config";
|
|
2
|
+
import { type AppConfig, getAppConfig, peekAppConfig } from "../config";
|
|
3
3
|
import { configureApp } from "../configure";
|
|
4
4
|
import type { NavItem } from "../layout/nav";
|
|
5
5
|
|
|
@@ -42,6 +42,15 @@ export function useAppConfig(): AppConfig {
|
|
|
42
42
|
return useContext(AppContext)?.config ?? getAppConfig();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The app's config when there is one, or null: for a kit component that also
|
|
47
|
+
* renders outside the shell (a story, a page with no provider), which falls
|
|
48
|
+
* back to its own default rather than throwing.
|
|
49
|
+
*/
|
|
50
|
+
export function useOptionalAppConfig(): AppConfig | null {
|
|
51
|
+
return useContext(AppContext)?.config ?? peekAppConfig();
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
/** The app's nav items. Throws outside an `AppProvider` or `AppConfigProvider`. */
|
|
46
55
|
export function useNav(): NavItem[] {
|
|
47
56
|
const context = useContext(AppContext);
|
package/src/app/index.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
// The provider, the config, and the frame
|
|
9
9
|
export { AppProvider, type AppProviderProps } from "./AppProvider";
|
|
10
10
|
export { AuthGuard } from "./AuthGuard";
|
|
11
|
-
export { CardErrorBoundary } from "./CardErrorBoundary";
|
|
12
11
|
export { type AppConfig, getAppConfig } from "./config";
|
|
13
12
|
export { configureApp } from "./configure";
|
|
14
13
|
export {
|
|
@@ -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
|
);
|
|
@@ -145,7 +145,11 @@ export function MobileMenu({ pathname, user, onLogout }: MobileMenuProps) {
|
|
|
145
145
|
<span className="text-xs text-muted-foreground">Profile</span>
|
|
146
146
|
</span>
|
|
147
147
|
</Link>
|
|
148
|
-
<button
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
onClick={onLogout}
|
|
151
|
+
className={cn(ROW, "w-full text-destructive active:text-destructive-hover")}
|
|
152
|
+
>
|
|
149
153
|
<LogOut className="h-5 w-5 flex-shrink-0" />
|
|
150
154
|
<span>Log out</span>
|
|
151
155
|
</button>
|
|
@@ -13,13 +13,16 @@ 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" aria-hidden="true" />
|
|
23
26
|
<div>
|
|
24
27
|
<p className="font-medium text-destructive">{title}</p>
|
|
25
28
|
<p className="text-sm text-muted-foreground">{message}</p>
|
|
@@ -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
|
);
|
|
@@ -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>
|
package/src/app/ui/alert.tsx
CHANGED
|
@@ -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>,
|