Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Dashboard design tokens improvements (#14605)

Damian Legawiec8f876d9fe683
diff --git a/packages/dashboard-core/src/components/app-sidebar.tsx b/packages/dashboard-core/src/components/app-sidebar.tsx
index 3733158b21..64c7dc9312 100644
--- a/packages/dashboard-core/src/components/app-sidebar.tsx
+++ b/packages/dashboard-core/src/components/app-sidebar.tsx
@@ -1,4 +1,12 @@
-import { Sidebar, SidebarContent, SidebarHeader } from '@spree/dashboard-ui'
+import {
+ Sidebar,
+ SidebarContent,
+ SidebarGroup,
+ SidebarHeader,
+ SidebarMenu,
+ SidebarMenuItem,
+ Skeleton,
+} from '@spree/dashboard-ui'
import { PackageIcon } from '@spree/dashboard-ui/icons'
import { useParams } from '@tanstack/react-router'
import type { ComponentProps, ReactNode } from 'react'
@@ -54,9 +62,14 @@ function filterByPermissions(items: NavItem[], permissions: Permissions): NavIte
* than re-deriving the prefixing and permission filtering, which is what a
* second sidebar would otherwise copy.
*/
-export function useNavItems(tenantId: string): { navItems: NavItem[]; bottomItems: NavItem[] } {
+export function useNavItems(tenantId: string): {
+ navItems: NavItem[]
+ bottomItems: NavItem[]
+ /** True while permissions are still loading, so the nav is not yet knowable. */
+ isLoading: boolean
+} {
const { t } = useTranslation()
- const { permissions } = usePermissions()
+ const { permissions, isLoading } = usePermissions()
const store = useOptionalStore()?.store ?? null
const { user } = useAuth()
const { main, bottom } = useNavEntries()
@@ -73,7 +86,7 @@ export function useNavItems(tenantId: string): { navItems: NavItem[]; bottomItem
permissions,
)
- return { navItems, bottomItems }
+ return { navItems, bottomItems, isLoading }
}
/**
@@ -101,14 +114,49 @@ export function AppSidebar({
}) {
const { i18n } = useTranslation()
const { storeId } = useParams({ strict: false }) as { storeId?: string }
- const { navItems, bottomItems } = useNavItems(tenantId ?? storeId ?? 'default')
+ const { navItems, bottomItems, isLoading } = useNavItems(tenantId ?? storeId ?? 'default')
return (
<Sidebar collapsible="icon" side={primarySidebarSide(i18n.language)} {...props}>
<SidebarHeader>{header ?? <StoreSwitcher />}</SidebarHeader>
<SidebarContent>
- <NavMain items={navItems} bottomItems={bottomItems} />
+ {/* Permissions decide which links exist, and until they arrive every
+ `can()` answers false — so the real nav is not "empty", it is not
+ yet known. Rendering the filtered list during that window shows a
+ near-empty rail that then pops to a full one; skeleton rows keep the
+ shell's shape steady and say the difference honestly.
+
+ Keyed on `isLoading` alone, not on an empty list: entries without a
+ `subject` (Home, Getting Started) skip the permission filter, so the
+ list is never actually empty and a length check would never fire. */}
+ {isLoading ? <NavSkeleton /> : <NavMain items={navItems} bottomItems={bottomItems} />}
</SidebarContent>
</Sidebar>
)
}
+
+/**
+ * Placeholder rows for the primary nav while permissions load.
+ *
+ * The count is deliberate rather than arbitrary: it approximates a typical
+ * operator's nav so the rail does not visibly resize when the real list
+ * replaces it. Marked `aria-hidden` — a screen reader gains nothing from
+ * placeholder rows, and the shell announces the page itself.
+ */
+function NavSkeleton() {
+ return (
+ <SidebarGroup aria-hidden>
+ <SidebarMenu>
+ {Array.from({ length: 8 }, (_, i) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: fixed-length placeholder list
+ <SidebarMenuItem key={i}>
+ <div className="flex h-8 items-center gap-2 px-2">
+ <Skeleton className="size-4 shrink-0 rounded" />
+ <Skeleton className="h-3 w-24 group-data-[collapsible=icon]:hidden" />
+ </div>
+ </SidebarMenuItem>
+ ))}
+ </SidebarMenu>
+ </SidebarGroup>
+ )
+}
diff --git a/packages/dashboard-core/src/components/page-header.tsx b/packages/dashboard-core/src/components/page-header.tsx
index 7b21fb5566..8d31b096d8 100644
--- a/packages/dashboard-core/src/components/page-header.tsx
+++ b/packages/dashboard-core/src/components/page-header.tsx
@@ -171,7 +171,10 @@ export function PageHeader({
// so it yields space to the actions instead of pushing them onto a
// second row — a page with only a Save button was spending two rows
// of a short viewport on chrome.
- 'sticky top-header-height z-20 -mx-4 -mt-4 flex flex-row items-start gap-2 bg-background/90 backdrop-blur supports-[backdrop-filter]:bg-background/75 px-4 pt-4 pb-3 sm:gap-3 lg:-mx-6 lg:-mt-6 lg:px-6 lg:pt-6',
+ // Opaque for the same reason as the top bar: this band pins over the
+ // page's own scrolling content, so a translucent fill lets that content
+ // ghost through it.
+ 'sticky top-header-height z-20 -mx-4 -mt-4 flex flex-row items-start gap-2 bg-background px-4 pt-4 pb-3 sm:gap-3 lg:-mx-6 lg:-mt-6 lg:px-6 lg:pt-6',
// `translate` is listed explicitly: Tailwind v4 compiles
// `-translate-y-*` to the standalone `translate` property, so a
// `transform`-only transition never animates it and the header would
diff --git a/packages/dashboard-core/src/components/resource-table.tsx b/packages/dashboard-core/src/components/resource-table.tsx
index 91d055506b..45d433e07a 100644
--- a/packages/dashboard-core/src/components/resource-table.tsx
+++ b/packages/dashboard-core/src/components/resource-table.tsx
@@ -64,6 +64,7 @@ import {
getTable,
type SortOption,
} from '../lib/table-registry'
+import { useStickyHeader } from '../providers/sticky-header-provider'
import { useTenantId } from '../providers/tenant-provider'
import { type BulkAction, BulkActionBar } from './bulk-action-bar'
import { TableToolbar } from './table-toolbar'
@@ -145,6 +146,15 @@ interface ResourceTableProps<T> {
searchParams: ResourceSearch
/** Title displayed in the toolbar header. Overrides the table definition's title. */
title?: string
+ /**
+ * Heading level for the title.
+ *
+ * Resolved automatically: `h1` when the table is the page (the admin's list
+ * routes render nothing else), `h2` when a `PageHeader` is mounted and has
+ * already claimed the `h1` — which is how the seller panel's list pages are
+ * built. Set it explicitly only to override that.
+ */
+ titleAs?: 'h1' | 'h2' | 'h3'
/** One line under the title. Overrides the table definition's description. */
description?: string
/** Docs for the feature, linked after the description. Overrides the table definition's. */
@@ -209,6 +219,7 @@ export function ResourceTable<T extends Record<string, any>>({
queryFn,
searchParams,
title,
+ titleAs,
description,
docsPath,
defaultParams,
@@ -295,6 +306,9 @@ export function ResourceTable<T extends Record<string, any>>({
const sortString = dir === 'desc' ? `-${sort}` : sort
const tenantId = useTenantId()
+ // A `PageHeader` on the same page already renders the `h1`, so the table's
+ // title becomes an `h2` rather than a second one.
+ const { hasPageHeader } = useStickyHeader()
// Auto-inject the tenant id so every list query — and the matching mutation
// invalidation — is tenant-scoped without each page re-implementing it.
// Goes through +withStoreScope+ so the slot ordering matches +useResourceKey+
@@ -503,6 +517,7 @@ export function ResourceTable<T extends Record<string, any>>({
onFiltersChange={handleFiltersChange}
allColumns={allColumns}
title={title ?? table.title}
+ titleAs={titleAs ?? (hasPageHeader ? 'h2' : 'h1')}
description={description ?? table.description}
docsPath={docsPath ?? table.docsPath}
actions={resolvedActions}
@@ -519,7 +534,7 @@ export function ResourceTable<T extends Record<string, any>>({
items={rows.map((r) => (r as any).id)}
strategy={verticalListSortingStrategy}
>
- <Table stickyHeader roundedBottom>
+ <Table stickyHeader>
<TableHeader>
<TableHeaderRow>
<TableHead className="w-8" />
@@ -639,7 +654,7 @@ export function ResourceTable<T extends Record<string, any>>({
</section>,
document.body,
)}
- <Table stickyHeader roundedBottom>
+ <Table stickyHeader>
<TableHeader>
{/* Column headers stay mounted with rows selected, and the bulk
bar is laid over them. Swapping them for one `colSpan` cell
diff --git a/packages/dashboard-core/src/components/route-announcer.tsx b/packages/dashboard-core/src/components/route-announcer.tsx
new file mode 100644
index 0000000000..ff312fd40f
--- /dev/null
+++ b/packages/dashboard-core/src/components/route-announcer.tsx
@@ -0,0 +1,64 @@
+import { useEffect, useRef, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+
+/**
+ * Keeps the document title in step with the page, and announces navigation.
+ *
+ * A single-page app changes neither by itself. Two things follow: every browser
+ * tab, history entry and bookmark reads "Spree Admin" regardless of where the
+ * merchant is, and a screen reader says nothing at all when a link swaps the
+ * whole page — the reader announces a title change on a document load, and the
+ * SPA never performs one.
+ *
+ * The title is read from the page's own `<h1>` rather than declared per route:
+ * there are forty-odd routes and plugins add more, so anything that has to be
+ * restated in each one is a list that drifts. The `h1` is already the page's
+ * name, already translated, and already carries the record's own name on a
+ * detail page ("R1001" rather than a generic "Order").
+ *
+ * A `MutationObserver` is what makes this reliable. The heading is not in the
+ * DOM on the first frame after a navigation — the route's data is still
+ * loading and the pending component is showing — so reading once on a path
+ * change finds either nothing or the previous page's heading.
+ */
+export function RouteAnnouncer({ suffix }: { suffix?: string }) {
+ const { t } = useTranslation()
+ const [announcement, setAnnouncement] = useState('')
+ // The title as last applied, so an unchanged heading doesn't re-announce on
+ // every unrelated DOM mutation.
+ const lastTitle = useRef<string | null>(null)
+ const appName = suffix ?? t('admin.app_name', 'Spree Admin')
+
+ useEffect(() => {
+ const sync = () => {
+ const heading = document.querySelector('h1')
+ const pageTitle = heading?.textContent?.trim()
+ if (!pageTitle) return
+
+ const next = `${pageTitle} · ${appName}`
+ if (next === lastTitle.current) return
+
+ // The first heading of the session is the page the user just opened
+ // directly; the document title announces that on load, so repeating it
+ // here would be the same page said twice. Only a *change* of page is
+ // news, which is the case a single-page app otherwise says nothing about.
+ const isFirstResolve = lastTitle.current === null
+ lastTitle.current = next
+ document.title = next
+ // The heading text alone, not the full title: the app name is repeated
+ // on every page and adds nothing when spoken aloud.
+ if (!isFirstResolve) setAnnouncement(pageTitle)
+ }
+
+ sync()
+ const observer = new MutationObserver(sync)
+ observer.observe(document.body, { subtree: true, childList: true, characterData: true })
+ return () => observer.disconnect()
+ }, [appName])
+
+ return (
+ <div aria-live="polite" aria-atomic="true" className="sr-only">
+ {announcement}
+ </div>
+ )
+}
diff --git a/packages/dashboard-core/src/components/section-heading.tsx b/packages/dashboard-core/src/components/section-heading.tsx
index 29806c6f37..fca0f191de 100644
--- a/packages/dashboard-core/src/components/section-heading.tsx
+++ b/packages/dashboard-core/src/components/section-heading.tsx
@@ -17,18 +17,38 @@ export function SectionHeading({
description,
docsPath,
className,
+ as,
}: {
title: React.ReactNode
description?: React.ReactNode
/** Relative to the user guide, or a full URL for a plugin's own docs. */
docsPath?: string
className?: string
+ /**
+ * Heading element to render the title as. Defaults to a plain `div`, which
+ * is right for a card sitting inside a page that already has its own
+ * heading. Pass `h1` when this heading *is* the page's title — a list page
+ * built from `ResourceTable` has no other one, so without it the page
+ * carries no heading at all and screen-reader users lose both the document
+ * outline and heading navigation.
+ */
+ as?: 'h1' | 'h2' | 'h3'
}) {
const { t } = useTranslation()
return (
<div className={cn('flex min-w-0 flex-col gap-1', className)}>
- <CardTitle className="min-w-0 truncate text-lg">{title}</CardTitle>
+ {/* A heading renders the same styles CardTitle carries, so a page title
+ and a card title are visually identical — only the element differs.
+ CardTitle is a plain div and cannot forward an element type, so the
+ heading is written out rather than routed through it. */}
+ {as ? (
+ <Heading level={as} className="min-w-0 truncate text-lg">
+ {title}
+ </Heading>
+ ) : (
+ <CardTitle className="min-w-0 truncate text-lg">{title}</CardTitle>
+ )}
{description && (
<p className="text-muted-foreground text-sm">
{description}
@@ -51,3 +71,32 @@ export function SectionHeading({
</div>
)
}
+
+/**
+ * The title element for a `SectionHeading` that carries a heading level.
+ *
+ * Repeats CardTitle's own classes rather than importing them: the base
+ * stylesheet sizes bare `h1`–`h6` for prose (h1 is `text-4xl`), and a heading
+ * dropped into a card toolbar has to opt out of that or it renders at twice
+ * the intended size. Stating the classes here also keeps the two branches of
+ * `SectionHeading` visually identical by construction.
+ */
+function Heading({
+ level,
+ className,
+ children,
+}: {
+ level: 'h1' | 'h2' | 'h3'
+ className?: string
+ children: React.ReactNode
+}) {
+ const Tag = level
+ return (
+ <Tag
+ data-slot="card-title"
+ className={cn('flex items-center gap-2 font-medium text-base', className)}
+ >
+ {children}
+ </Tag>
+ )
+}
diff --git a/packages/dashboard-core/src/components/skip-link.tsx b/packages/dashboard-core/src/components/skip-link.tsx
new file mode 100644
index 0000000000..c4c08fe51d
--- /dev/null
+++ b/packages/dashboard-core/src/components/skip-link.tsx
@@ -0,0 +1,36 @@
+import { useTranslation } from 'react-i18next'
+
+/**
+ * "Skip to content", the first thing in the tab order.
+ *
+ * The sidebar carries thirty-odd links, and they precede the page on every
+ * route. Without this a keyboard user tabs through all of them again after
+ * each navigation before reaching what they came for.
+ *
+ * Visible only while focused: it is a keyboard affordance, and a pointer user
+ * has no use for it. It stays in the DOM and in the tab order at all times
+ * though — `display: none` or `hidden` would take it out of both, which is the
+ * usual way this control ends up doing nothing.
+ */
+export function SkipLink({ targetId = 'main-content' }: { targetId?: string }) {
+ const { t } = useTranslation()
+
+ return (
+ <a
+ href={`#${targetId}`}
+ className={[
+ // Off-screen until focused, rather than hidden: reachable by Tab,
+ // invisible to everyone else.
+ 'sr-only',
+ 'focus-visible:not-sr-only focus-visible:fixed focus-visible:top-3 focus-visible:left-3',
+ 'focus-visible:z-50 focus-visible:rounded-lg focus-visible:bg-card',
+ 'focus-visible:px-4 focus-visible:py-2 focus-visible:text-sm focus-visible:font-medium',
+ 'focus-visible:text-foreground focus-visible:shadow-md',
+ 'focus-visible:border focus-visible:border-border-control',
+ 'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50',
+ ].join(' ')}
+ >
+ {t('admin.common.skip_to_content')}
+ </a>
+ )
+}
diff --git a/packages/dashboard-core/src/components/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
index 2750b6f2e4..27f771ac5a 100644
--- a/packages/dashboard-core/src/components/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -73,6 +73,12 @@ interface TableToolbarProps {
allColumns?: ColumnDef[]
/** Title displayed in the toolbar header */
title?: string
+ /**
+ * Heading level for the title. Defaults to `h1` because a list page is this
+ * table and nothing else. Pass a lower level when the table is a panel
+ * inside a page that already owns the `h1`.
+ */
+ titleAs?: 'h1' | 'h2' | 'h3'
/** One line under the title saying what the list is for. */
description?: string
/** Documentation for the feature, linked at the end of the description. */
@@ -181,6 +187,7 @@ export function TableToolbar({
onFiltersChange,
allColumns,
title,
+ titleAs = 'h1',
description,
docsPath,
actions,
@@ -267,7 +274,20 @@ export function TableToolbar({
)}
>
{(title || description) && (
- <SectionHeading title={title} description={description} docsPath={docsPath} />
+ // `h1`: a list page is a `ResourceTable` and nothing else, so this
+ // title is the page's only heading. Rendered as a div it left those
+ // pages with no heading at all — no document outline, and nothing
+ // for the heading-navigation a screen reader user relies on.
+ <SectionHeading
+ // Only a real title becomes a heading. `title` and `description`
+ // are independent, and a description-only caller would otherwise
+ // emit an empty `<h1>` — which a screen reader still lists in
+ // heading navigation, as a blank entry.
+ as={title ? titleAs : undefined}
+ title={title}
+ description={description}
+ docsPath={docsPath}
+ />
)}
<div className="ml-auto flex shrink-0 items-center gap-2">{actions}</div>
</div>
diff --git a/packages/dashboard-core/src/components/top-bar.tsx b/packages/dashboard-core/src/components/top-bar.tsx
index 20a3529bc6..0201c0cbd4 100644
--- a/packages/dashboard-core/src/components/top-bar.tsx
+++ b/packages/dashboard-core/src/components/top-bar.tsx
@@ -79,7 +79,15 @@ export function TopBar({
return (
<header
className={cn(
- 'sticky top-0 z-40 flex h-header-height shrink-0 items-center gap-3 bg-background/90 px-4 border-b border-sidebar-border backdrop-blur supports-[backdrop-filter]:bg-background/75',
+ // Opaque, not frosted. A translucent bar works over a page background,
+ // but this one sits above a scrolling table: at 75% every row that
+ // passes under it shows through, and the blur smears the thumbnail and
+ // title rather than hiding them — which reads as a rendering fault, not
+ // as material. Measured, dark row text stays legible through the bar
+ // until about 98% opacity, by which point there is no translucency left
+ // to see. So the effect cannot survive this surface, and the bar takes
+ // the page colour outright.
+ 'sticky top-0 z-40 flex h-header-height shrink-0 items-center gap-3 bg-background px-4 border-b border-sidebar-border',
'transition-transform duration-200 ease-out motion-reduce:transition-none',
hidden && '-translate-y-full',
)}
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index dbe74a0236..f9eb8b6248 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -39,8 +39,10 @@ export * from './components/resource-combobox'
export * from './components/resource-multi-autocomplete'
export * from './components/resource-picker-sheet'
export * from './components/resource-table'
+export * from './components/route-announcer'
export * from './components/section-heading'
export * from './components/settings-sidebar'
+export * from './components/skip-link'
export * from './components/slot'
export * from './components/store-date-picker'
export * from './components/store-switcher'
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index 08e8b8944b..9385f6f792 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -1,5 +1,6 @@
{
"admin": {
+ "app_name": "Spree Admin",
"a11y": {
"breadcrumb": "مسار التنقل",
"breadcrumb_more": "المزيد",
@@ -156,6 +157,7 @@
"empty_value": "—",
"inactive": "غير نشط",
"learn_more": "اعرف المزيد",
+ "skip_to_content": "تخطي إلى المحتوى",
"loading": "جارٍ التحميل…",
"next": "التالي",
"no": "لا",
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index 0800342367..ca9a9895e9 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -1,5 +1,6 @@
{
"admin": {
+ "app_name": "Spree Admin",
"a11y": {
"breadcrumb": "Breadcrumb",
"breadcrumb_more": "Mehr",
@@ -156,6 +157,7 @@
"empty_value": "—",
"inactive": "Inaktiv",
"learn_more": "Mehr erfahren",
+ "skip_to_content": "Zum Inhalt springen",
"loading": "Wird geladen…",
"next": "Weiter",
"no": "Nein",
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index f3ddeb1857..4824a4f4b4 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -1,5 +1,6 @@
{
"admin": {
+ "app_name": "Spree Admin",
"a11y": {
"breadcrumb": "Breadcrumb",
"breadcrumb_more": "More",
@@ -156,6 +157,7 @@
"empty_value": "—",
"inactive": "Inactive",
"learn_more": "Learn more",
+ "skip_to_content": "Skip to content",
"loading": "Loading…",
"next": "Next",
"no": "No",
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index 25fc9fb9a8..d260626f44 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -1,5 +1,6 @@
{
"admin": {
+ "app_name": "Spree Admin",
"a11y": {
"breadcrumb": "Fil d'Ariane",
"breadcrumb_more": "Plus",
@@ -156,6 +157,7 @@
"empty_value": "—",
"inactive": "Inactif",
"learn_more": "En savoir plus",
+ "skip_to_content": "Aller au contenu",
"loading": "Chargement…",
"next": "Suivant",
"no": "Non",
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index 98f93655c8..f05e723333 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -1,5 +1,6 @@
{
"admin": {
+ "app_name": "Spree Admin",
"a11y": {
"breadcrumb": "Ścieżka nawigacji",
"breadcrumb_more": "Więcej",
@@ -156,6 +157,7 @@
"empty_value": "—",
"inactive": "Nieaktywny",
"learn_more": "Dowiedz się więcej",
+ "skip_to_content": "Przejdź do treści",
"loading": "Ładowanie…",
"next": "Następna",
"no": "Nie",
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index 050ca9d07e..314cd47e41 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -1,5 +1,6 @@
{
"admin": {
+ "app_name": "Spree Admin",
"a11y": {
"breadcrumb": "面包屑导航",
"breadcrumb_more": "更多",
@@ -156,6 +157,7 @@
"empty_value": "—",
"inactive": "停用",
"learn_more": "了解更多",
+ "skip_to_content": "跳到主要内容",
"loading": "加载中…",
"next": "下一页",
"no": "否",
diff --git a/packages/dashboard-core/src/products/product-form-cards.tsx b/packages/dashboard-core/src/products/product-form-cards.tsx
index 0fe8b16466..6a63ffdaec 100644
--- a/packages/dashboard-core/src/products/product-form-cards.tsx
+++ b/packages/dashboard-core/src/products/product-form-cards.tsx
@@ -219,11 +219,14 @@ export function PricesCard({
</Select>
)}
</CardHeader>
- <CardContent>
+ {/* `p-0` like every other card holding a table: the grid draws its own
+ cell borders to the card's edges, and padding here insets it into a
+ floating block with a gutter on all four sides. */}
+ <CardContent className="p-0">
{currencyResolved ? (
<ProductBulkPriceEditor form={form} currency={currency} productName={productName} />
) : (
- <div className="h-24 w-full animate-pulse rounded-md bg-muted" />
+ <div className="m-3 h-24 animate-pulse rounded-md bg-muted" />
)}
</CardContent>
</Card>
@@ -768,7 +771,7 @@ export function InventoryCard({
<CardHeader>
<CardTitle>{t('admin.pages.products.section_inventory')}</CardTitle>
</CardHeader>
- <CardContent>
+ <CardContent className="p-0">
<InventorySection form={form} stockLocationHref={stockLocationHref} />
</CardContent>
</Card>
diff --git a/packages/dashboard-core/src/products/variants-options-builder.tsx b/packages/dashboard-core/src/products/variants-options-builder.tsx
index 7fc1d4aa32..88965ebd58 100644
--- a/packages/dashboard-core/src/products/variants-options-builder.tsx
+++ b/packages/dashboard-core/src/products/variants-options-builder.tsx
@@ -384,7 +384,7 @@ function OptionPicker({ optionType, initialValues, onSave, onCancel }: OptionPic
className={`inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors ${
isPicked
? 'border-primary bg-primary text-primary-foreground'
- : 'border-border bg-background hover:bg-muted'
+ : 'border-border bg-background hover:bg-accent'
}`}
>
{isPicked && <CheckIcon className="size-3" />}
@@ -396,7 +396,7 @@ function OptionPicker({ optionType, initialValues, onSave, onCancel }: OptionPic
<button
type="button"
onClick={() => setCreatingValue(true)}
- className="inline-flex items-center gap-1.5 rounded-full border border-dashed border-border bg-background px-3 py-1 text-xs hover:bg-muted"
+ className="inline-flex items-center gap-1.5 rounded-full border border-dashed border-border bg-background px-3 py-1 text-xs hover:bg-accent"
>
<PlusIcon className="size-3" />
{t('admin.products.variants.create_value')}
diff --git a/packages/dashboard-core/src/providers/auth-provider.tsx b/packages/dashboard-core/src/providers/auth-provider.tsx
index 2ce569e922..24abc03c19 100644
--- a/packages/dashboard-core/src/providers/auth-provider.tsx
+++ b/packages/dashboard-core/src/providers/auth-provider.tsx
@@ -8,6 +8,7 @@ import type {
import { createContext, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'
import { getApiClient, type PanelSession } from '../api-client'
import { ADMIN_LOCALE_STORAGE_KEY, switchLocale } from '../lib/i18n'
+import { queryClient } from '../lib/query-client'
interface AuthContextValue {
user: AdminUser | null
@@ -114,6 +115,13 @@ export function AuthProvider({ children }: { children: ReactNode }) {
// principal's first requests (permissions, the index redirect) and 403
// them against a tenant they may hold no role on.
client.clearTenant?.()
+ // Everything fetched as the previous principal, permissions included. The
+ // permission query stops running once `isAuthenticated` goes false, but its
+ // cached rules survive — so the next admin to sign in on this browser would
+ // render the last one's navigation and action buttons until the refetch
+ // landed. Server-side authorization is unaffected either way; this is about
+ // not showing one principal what another may do.
+ queryClient.clear()
setToken(null)
setUser(null)
clearRefreshTimer()
diff --git a/packages/dashboard-core/src/providers/permission-provider.tsx b/packages/dashboard-core/src/providers/permission-provider.tsx
index d5f67957af..f3e3d40882 100644
--- a/packages/dashboard-core/src/providers/permission-provider.tsx
+++ b/packages/dashboard-core/src/providers/permission-provider.tsx
@@ -1,17 +1,11 @@
import type { PermissionRule } from '@spree/admin-sdk'
-import {
- createContext,
- type ReactNode,
- useCallback,
- useContext,
- useEffect,
- useMemo,
- useRef,
- useState,
-} from 'react'
+import { useQuery, useQueryClient } from '@tanstack/react-query'
+import { createContext, type ReactNode, useCallback, useContext, useMemo } from 'react'
import { getApiClient } from '../api-client'
import { useAuth } from '../hooks/use-auth'
import type { ActionName, SubjectName } from '../lib/permissions'
+import { useResourceKey } from '../lib/query-keys'
+import { useTenantId } from './tenant-provider'
/**
* Matcher that mirrors CanCanCan semantics:
@@ -82,6 +76,17 @@ export function buildPermissions(rules: PermissionRule[]): Permissions {
}
}
+/**
+ * Query resource name for the permission fetch. Exported so anything else
+ * reading the same `/me` response can share this cache entry rather than
+ * issuing a second identical request.
+ */
+export const PERMISSIONS_RESOURCE = 'permissions'
+
+/** Stable identities, so `data ?? []` doesn't produce a new array each render. */
+const EMPTY_RULES: PermissionRule[] = []
+const EMPTY_KEYS: string[] = []
+
/** Empty permissions that deny everything — used before rules are loaded. */
const EMPTY_PERMISSIONS: Permissions = {
can: () => false,
@@ -91,42 +96,33 @@ const EMPTY_PERMISSIONS: Permissions = {
export function PermissionProvider({ children }: { children: ReactNode }) {
const { isAuthenticated } = useAuth()
- const [rules, setRules] = useState<PermissionRule[]>([])
- const [permissionKeys, setPermissionKeys] = useState<string[]>([])
- const [isLoading, setIsLoading] = useState(false)
- // Guards against out-of-order `/me` responses: a rapid store switch (or a
- // logout) bumps the generation, and any response from a superseded request
- // is dropped instead of overwriting the current store's permissions.
- const requestGeneration = useRef(0)
+ const queryClient = useQueryClient()
+ // Store-scoped by construction: `useResourceKey` folds the tenant id in, so
+ // switching store changes the key and TanStack refetches on its own — no
+ // manual reload, and no chance of one store's rules being shown for another.
+ const queryKey = useResourceKey(PERMISSIONS_RESOURCE)
- const refresh = useCallback(async () => {
- const generation = ++requestGeneration.current
- setIsLoading(true)
- try {
- const res = await getApiClient().fetchPermissions()
- if (generation !== requestGeneration.current) return
- setRules(res.rules)
- setPermissionKeys(res.keys)
- } catch {
- if (generation !== requestGeneration.current) return
- setRules([])
- setPermissionKeys([])
- } finally {
- if (generation === requestGeneration.current) setIsLoading(false)
- }
- }, [])
-
- useEffect(() => {
- if (!isAuthenticated) {
- requestGeneration.current += 1
- setRules([])
- setPermissionKeys([])
- setIsLoading(false)
- return
- }
+ const query = useQuery({
+ queryKey,
+ queryFn: () => getApiClient().fetchPermissions(),
+ enabled: isAuthenticated,
+ // Permissions change when an admin's role does, which is rare and happens
+ // elsewhere. Refetching them on every window focus costs a request on the
+ // shell's critical path and almost never returns anything new.
+ staleTime: 5 * 60 * 1000,
+ })
- void refresh()
- }, [isAuthenticated, refresh])
+ const rules = query.data?.rules ?? EMPTY_RULES
+ const permissionKeys = query.data?.keys ?? EMPTY_KEYS
+
+ // `useResourceKey` returns a fresh array each render, so depending on it
+ // directly would give `refresh` a new identity every render — and a consumer
+ // holding it in an effect's dependencies would then re-run that effect
+ // forever. Depend on the tenant id (a string) and rebuild the key inside.
+ const tenantId = useTenantId()
+ const refresh = useCallback(async () => {
+ await queryClient.invalidateQueries({ queryKey: [PERMISSIONS_RESOURCE, tenantId] })
+ }, [queryClient, tenantId])
const permissions = useMemo(
() => (rules.length > 0 ? buildPermissions(rules) : EMPTY_PERMISSIONS),
@@ -134,7 +130,22 @@ export function PermissionProvider({ children }: { children: ReactNode }) {
)
return (
- <PermissionContext.Provider value={{ permissions, rules, permissionKeys, isLoading, refresh }}>
+ <PermissionContext.Provider
+ value={{
+ permissions,
+ rules,
+ permissionKeys,
+ // The first load only, which is what the nav's skeleton is for. Not
+ // `isFetching` alone: that is also true while a stale query refetches
+ // in the background, so an already-rendered nav would drop back to
+ // placeholders on every refresh — the flicker the skeleton exists to
+ // remove. Not `isPending` alone either: it stays true for a disabled
+ // query, leaving the sign-in screen loading forever. Both together
+ // mean "signed in, nothing cached yet, a request in flight".
+ isLoading: isAuthenticated && query.isPending && query.isFetching,
+ refresh,
+ }}
+ >
{children}
</PermissionContext.Provider>
)
diff --git a/packages/dashboard-ui/src/spree/bulk-price-table.tsx b/packages/dashboard-ui/src/spree/bulk-price-table.tsx
index 5150186e6b..34d145becc 100644
--- a/packages/dashboard-ui/src/spree/bulk-price-table.tsx
+++ b/packages/dashboard-ui/src/spree/bulk-price-table.tsx
@@ -302,12 +302,15 @@ export function BulkPriceTable({
const hasSearch = !!search && search.length > 0
return (
+ // Padding lives on the toolbar and the pager, not on this wrapper: the
+ // grid between them should run to the container's edges, the way a
+ // table in a card does.
<div className="flex h-full flex-col gap-3">
{showToolbar && (
// Always-mounted toolbar. Conditionally rendering the search input
// would unmount it whenever a deferred query refetches into the
// loading state, blurring the field mid-keystroke.
- <div className="flex shrink-0 items-center justify-between gap-3">
+ <div className="flex shrink-0 items-center justify-between gap-3 px-3">
{labels.countSummary !== undefined && (
<p className="text-xs text-muted-foreground">{labels.countSummary}</p>
)}
@@ -323,7 +326,10 @@ export function BulkPriceTable({
</div>
)}
- <div className="min-h-0 flex-1 overflow-auto">
+ {/* No `overflow-auto` here: the grid inside owns its own scroller
+ (it needs one for the sticky header), and a second one around it
+ nests two scrollbars over the same content. */}
+ <div className="min-h-0 flex-1">
{isLoading ? (
<p className="text-sm text-muted-foreground">{labels.loading}</p>
) : isEmpty ? (
@@ -348,7 +354,7 @@ export function BulkPriceTable({
</div>
{showPagination && (
- <div className="flex shrink-0 items-center justify-between gap-2 text-xs text-muted-foreground">
+ <div className="flex shrink-0 items-center justify-between gap-2 px-3 pb-3 text-xs text-muted-foreground">
<span>
{labels.pageOf.replace('{page}', String(page)).replace('{total}', String(totalPages))}
</span>
diff --git a/packages/dashboard-ui/src/spree/bulk-variants-table.tsx b/packages/dashboard-ui/src/spree/bulk-variants-table.tsx
index bf3120bae4..d97ec48556 100644
--- a/packages/dashboard-ui/src/spree/bulk-variants-table.tsx
+++ b/packages/dashboard-ui/src/spree/bulk-variants-table.tsx
@@ -427,6 +427,8 @@ export function BulkVariantsTable({
getRowId={(row) => row.id}
className={minWidth}
aria-label={labels.gridAriaLabel}
+ // Sets a min-width well past any viewport, so it has to scroll itself.
+ scrollable
/>
)
}
diff --git a/packages/dashboard-ui/src/spree/data-grid/data-grid.tsx b/packages/dashboard-ui/src/spree/data-grid/data-grid.tsx
index 5c86c592af..8eba3f609a 100644
--- a/packages/dashboard-ui/src/spree/data-grid/data-grid.tsx
+++ b/packages/dashboard-ui/src/spree/data-grid/data-grid.tsx
@@ -26,6 +26,17 @@ interface DataGridProps<T> {
className?: string
/** Optional caption-row aria-label etc. */
'aria-label'?: string
+ /**
+ * Whether the grid scrolls inside its own box.
+ *
+ * `true` for a grid too wide or tall for where it sits — the bulk variant
+ * editor in its dialog, which has columns well past any viewport. `false`
+ * when the container already handles it, or when the grid is sized to fit:
+ * the fill handle straddles the selection's bottom-right corner and hangs a
+ * few pixels past the table, which a scroll container counts as content, so
+ * selecting an edge cell raises scrollbars on a grid that fits.
+ */
+ scrollable?: boolean
}
export function DataGrid<T>({
@@ -35,6 +46,7 @@ export function DataGrid<T>({
renderSectionHeader,
className,
'aria-label': ariaLabel,
+ scrollable = false,
}: DataGridProps<T>) {
const table = useReactTable<T>({
data: rows,
@@ -49,6 +61,7 @@ export function DataGrid<T>({
renderSectionHeader={renderSectionHeader}
className={className}
ariaLabel={ariaLabel}
+ scrollable={scrollable}
/>
)
}
@@ -58,11 +71,13 @@ function DataGridShell<T>({
renderSectionHeader,
className,
ariaLabel,
+ scrollable,
}: {
table: Table<T>
renderSectionHeader?: RenderSectionHeader<T>
className?: string
ariaLabel?: string
+ scrollable?: boolean
}) {
const gridRef = useRef<HTMLTableElement | null>(null)
const cellsRef = useRef<Map<CellKey, CellRegistration>>(new Map())
@@ -191,8 +206,17 @@ function DataGridShell<T>({
leaves `position: sticky` with nothing to stick within. Bounding it
to the caller's height gives the header a viewport again, and a
caller that imposes no height (a grid that scrolls with the page)
- still resolves to no constraint. */}
- <div className="relative max-h-full overflow-auto">
+ still resolves to no constraint.
+
+ All of it is behind `scrollable`, because a scroll container is not
+ free: `position: absolute` takes the fill handle out of layout flow
+ but NOT out of a scroller's scrollable overflow, and the handle
+ straddles the selection's bottom-right corner. On a cell at the
+ grid's edge it therefore hangs a few pixels past the table and the
+ container grows to contain it — so selecting an edge cell raised
+ scrollbars on a grid that fits its card. A grid that does not need
+ to scroll should not be a scroll container. */}
+ <div className={cn('relative', scrollable && 'themed-scrollbar max-h-full overflow-auto')}>
<table
ref={gridRef}
// Focusable so the grid itself can hold the keyboard when a cell's
@@ -203,6 +227,17 @@ function DataGridShell<T>({
tabIndex={-1}
className={cn(
'w-full border-collapse text-sm outline-none [&_td]:border [&_th]:border [&_td]:border-border [&_th]:border-border',
+ // Internal rules only. `border` on every cell also draws the grid's
+ // outer edge — `border-collapse` merges neighbours, so the outermost
+ // cells' outer sides become the table's own frame, doubling the
+ // card's border a pixel away from it. These grids are always inside
+ // a container that draws that edge already.
+ '[&_tr>*:first-child]:border-l-0 [&_tr>*:last-child]:border-r-0 [&_thead_tr:first-child>*]:border-t-0 [&_tbody_tr:last-child>*]:border-b-0',
+ // The header draws its bottom rule as an inset shadow (see the
+ // `<th>` below). Both the header's own bottom border and the
+ // first body row's top border would stack beside that shadow, so
+ // the one rule between the header and the body is the shadow.
+ '[&_thead_th]:border-b-0 [&_tbody_tr:first-child>*]:border-t-0',
className,
)}
aria-label={ariaLabel}
@@ -238,11 +273,28 @@ function DataGridShell<T>({
setEditing(null)
}}
>
- <thead className="sticky top-0 z-10 bg-muted/60 text-xs text-muted-foreground">
+ {/* The fill is on the cells, not the row: under `border-collapse` a
+ background on `<thead>` or `<tr>` paints unreliably, and it has to
+ be opaque — this row pins over the grid's own scrolling content,
+ so a translucent one (it was `bg-muted/60`) lets the rows behind
+ it read straight through the column labels. */}
+ <thead className="sticky top-0 z-10 text-xs text-muted-foreground">
{table.getHeaderGroups().map((group) => (
<tr key={group.id}>
{group.headers.map((header) => (
- <th key={header.id} className="h-8 px-3 text-left font-medium">
+ <th
+ key={header.id}
+ // The bottom rule is an inset shadow, not the cell's own
+ // border: under `border-collapse` the collapsed borders
+ // belong to the table, so they scroll away with it and a
+ // pinned header ends up with rows sliding flush against its
+ // labels. A shadow belongs to the cell and pins with it.
+ //
+ // The table-level classes zero this cell's own top and
+ // bottom borders: a border sits outside the padding box and
+ // the shadow inside, so leaving both draws two rules at rest.
+ className="h-8 bg-muted px-3 text-left font-medium shadow-[inset_0_-1px_0_0_var(--border)]"
+ >
{header.isPlaceholder
? null
: flexRender(header.column.columnDef.header, header.getContext())}
diff --git a/packages/dashboard-ui/src/styles.css b/packages/dashboard-ui/src/styles.css
index aa02a7da58..5342c2374d 100644
--- a/packages/dashboard-ui/src/styles.css
+++ b/packages/dashboard-ui/src/styles.css
@@ -96,6 +96,48 @@
values such as the sticky table header's inset shadow, where `/50` has no
effect. */
--border-subtle: color-mix(in srgb, var(--border-base) 50%, transparent);
+ /* Controls carry two different problems, so they take two different tokens.
+ WCAG 1.4.11 asks 3:1 only of what is needed to *identify* a control — so
+ what matters is whether the border is the only thing doing that job.
+
+ --border-control: for a control with nothing else to identify it. A
+ checkbox and a radio are a transparent 16px box; erase the outline and
+ there is nothing on the page. 3.25:1 on the white card, 3.11:1 on the page
+ ground — the lightest step that clears the minimum on both.
+
+ --border-field: for a text field, select or combobox. These sit on a card
+ of the same colour, so the border is what draws them — but a form of ten
+ fields outlined at the control value reads as a wall of boxes. This lands
+ between the two: firmer than the old rule, quiet enough to disappear into
+ a dense form.
+
+ A tinted fill was tried here and reverted. Disabled fields are `--muted`,
+ so any resting tint either collides with that meaning or (as happened)
+ lands darker than it and inverts the signal outright. On this palette the
+ enabled state has to stay on the card colour. */
+ --border-control: oklch(0.65 0.006 56);
+ --border-field: oklch(0.86 0.004 56);
+ /* A card that *holds* other records — an order's fulfillments, its returns,
+ its claims — rather than holding content directly.
+
+ It takes the page's own colour, so the card contributes a border and a
+ title strip and nothing else: the white records inside are the only thing
+ with a surface, and they carry all the weight. Points at --background
+ rather than repeating its value, so the two cannot drift apart.
+
+ Giving the container a fill of its own was tried and reads worse — it
+ tints a large area to say something the border already says, and the
+ records lose contrast against it. Sitting at the page colour is safe
+ because the card still draws its 1px border at 1.21:1; the fill was never
+ carrying that boundary.
+
+ Records inside stay on `--card`, so what a merchant reads is the raised,
+ white thing. Pushing them into a grey well instead reads as content that
+ has been demoted, which is backwards — the fulfillment is the point of
+ the card, not its chrome. */
+ --card-container: var(--background);
+ /* Light mode's raised record is simply the card surface. */
+ --nested-raised: oklch(1 0 0);
--input: color-mix(in srgb, var(--border-base) 80%, transparent);
--ring: var(--brand-blue);
--chart-1: oklch(0.7663 0.1067 254.4);
@@ -185,6 +227,17 @@
--border-base: oklch(1 0 0 / 12%);
--border: color-mix(in srgb, var(--border-base) 80%, transparent);
--border-subtle: color-mix(in srgb, var(--border-base) 50%, transparent);
+ /* Light mode darkens the control edge away from the card; dark mode lightens
+ it. Not the light value inverted — measured on this theme's own surfaces:
+ 3.22:1 on the card, 3.34:1 on the page ground. */
+ --border-control: oklch(0.52 0.006 56);
+ --border-field: oklch(0.32 0.004 56);
+ /* Same arrangement as light — container at the page colour, records raised
+ above it. 1.118:1 between them here. Records take `--nested-raised` rather
+ than `--card`: the card token is a step above the page, which is where the
+ container would sit if it had a fill of its own. */
+ --card-container: var(--background);
+ --nested-raised: oklch(0.235 0 0);
--input: color-mix(in srgb, var(--border-base) 80%, transparent);
--ring: oklch(0.552 0.016 285); /* same blue ring as light, for focus parity */
--link: oklch(0.7 0.16 258);
@@ -302,6 +355,10 @@
--color-input: var(--input);
--color-border: var(--border);
--color-border-subtle: var(--border-subtle);
+ --color-border-control: var(--border-control);
+ --color-border-field: var(--border-field);
+ --color-card-container: var(--card-container);
+ --color-nested-raised: var(--nested-raised);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-accent-foreground: var(--accent-foreground);
@@ -541,6 +598,24 @@
min-height: 2.75rem !important;
}
+ /* The rules above size what is *inside* an open menu; these size the
+ * control that opens it. A row's "⋮" is 24px, the sidebar toggle 28px and
+ * a table's sort/columns buttons 34px — each clears the 24px web minimum
+ * but sits well under what a finger wants, and the row action is both the
+ * smallest and the most repeated target on a list.
+ *
+ * Restricted to `button` because these slots wrap arbitrary children:
+ * `tooltip-trigger` in particular renders whatever it is given, including
+ * plain text, which must not be inflated to 44px. Width as well as height,
+ * since these are square icon buttons rather than full-width rows. */
+ button[data-slot='dropdown-menu-trigger'],
+ button[data-slot='sidebar-trigger'],
+ button[data-slot='popover-trigger'],
+ button[data-slot='tooltip-trigger'] {
+ min-height: 2.75rem !important;
+ min-width: 2.75rem !important;
+ }
+
/* The controls inside the filter panel's value step — the operator select,
its input and the buttons under them. They are sized for a pointer
(`size="sm"`, roughly 30px), which is below the touch minimum on the one
diff --git a/packages/dashboard-ui/src/ui/attachment.tsx b/packages/dashboard-ui/src/ui/attachment.tsx
index 6653888935..16ffeb8752 100644
--- a/packages/dashboard-ui/src/ui/attachment.tsx
+++ b/packages/dashboard-ui/src/ui/attachment.tsx
@@ -12,7 +12,7 @@ import { Button } from './button'
// `cn-*` preset classes flattened into plain utilities (this package predates
// the shadcn CSS layer).
const attachmentVariants = cva(
- 'group/attachment relative flex max-w-full min-w-0 shrink-0 flex-wrap rounded-lg border bg-card text-card-foreground transition-colors has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed',
+ 'group/attachment relative flex max-w-full min-w-0 shrink-0 flex-wrap rounded-lg border bg-card text-card-foreground transition-colors has-[>a,>button]:hover:bg-accent/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed',
{
variants: {
size: {
diff --git a/packages/dashboard-ui/src/ui/badge.tsx b/packages/dashboard-ui/src/ui/badge.tsx
index aaca60354d..91a0fdc674 100644
--- a/packages/dashboard-ui/src/ui/badge.tsx
+++ b/packages/dashboard-ui/src/ui/badge.tsx
@@ -30,9 +30,9 @@ const badgeVariants = cva(
info: 'border-info-border bg-info-bg text-info [a]:hover:bg-info-border',
warning: 'border-warning-border bg-warning-bg text-warning [a]:hover:bg-warning-border',
outline:
- 'border-border bg-card/50 text-foreground/75 [a]:hover:bg-muted [a]:hover:text-muted-foreground',
+ 'border-border bg-card/50 text-foreground/75 [a]:hover:bg-accent [a]:hover:text-muted-foreground',
ghost:
- 'border-transparent hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',
+ 'border-transparent hover:bg-accent hover:text-muted-foreground dark:hover:bg-accent/50',
link: 'border-transparent text-primary underline-offset-4 hover:underline',
},
},
diff --git a/packages/dashboard-ui/src/ui/button.tsx b/packages/dashboard-ui/src/ui/button.tsx
index 9a677c790a..1c4636f100 100644
--- a/packages/dashboard-ui/src/ui/button.tsx
+++ b/packages/dashboard-ui/src/ui/button.tsx
@@ -10,9 +10,9 @@ const buttonVariants = cva(
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/85',
outline:
- 'border-border bg-muted text-foreground hover:bg-accent hover:text-foreground aria-expanded:bg-accent',
+ 'border-border bg-card shadow-xs text-foreground hover:bg-accent hover:text-foreground aria-expanded:bg-accent',
ghost: 'hover:bg-accent hover:text-accent-foreground aria-expanded:bg-accent',
- destructive: 'text-destructive bg-muted border-border shadow-xs hover:bg-destructive/10',
+ destructive: 'text-destructive bg-card border-border shadow-xs hover:bg-destructive/10',
// Ghost's chrome (none until hover) with destructive's colour. The
// inline remove buttons that sit inside a row or field want no box of
// their own, but still need the red tint on hover rather than ghost's
diff --git a/packages/dashboard-ui/src/ui/card.tsx b/packages/dashboard-ui/src/ui/card.tsx
index 73cd2da7d5..14314fd6fa 100644
--- a/packages/dashboard-ui/src/ui/card.tsx
+++ b/packages/dashboard-ui/src/ui/card.tsx
@@ -9,11 +9,22 @@ function Card({
}: React.ComponentProps<'div'> & {
/**
* `nested` is one resource listed inside a card — a fulfillment on an order,
- * a return, a rule. It sits on the muted surface so it reads as a thing
+ * a return, a rule. It sits on a recessed surface so it reads as a thing
* *within* the card rather than another card beside it, and carries its own
* horizontal padding so its sections divide edge to edge.
+ *
+ * The box is load-bearing once there is more than one of them: a fulfillment
+ * already divides its own rows, so grouping by rules alone would draw the
+ * boundary between two fulfillments as the same line at the same inset as
+ * the boundary between two items — and the panel's own actions would have no
+ * visible owner.
+ *
+ * `container` is the card those nested records sit in. Pair the two: the
+ * container recedes, the records stay raised. A `default` card wrapping
+ * `nested` ones puts the content in a well and the frame in front of it,
+ * which reads as the content being demoted.
*/
- variant?: 'default' | 'nested'
+ variant?: 'default' | 'nested' | 'container'
}) {
return (
<div
@@ -26,9 +37,11 @@ function Card({
// rather than `hidden` so `overflow-y` stays `visible` and sticky
// descendants keep resolving against the page.
'group/card flex flex-col min-w-0 overflow-x-clip break-words text-card-foreground shadow-xs',
- variant === 'nested'
- ? 'rounded-lg border border-border-subtle bg-muted px-3'
- : 'rounded-xl border border-border bg-card',
+ variant === 'nested' && 'rounded-lg border border-border-subtle bg-nested-raised px-3',
+ // Holds nested records rather than content, so it recedes and lets
+ // them be the raised, readable thing.
+ variant === 'container' && 'rounded-xl border border-border bg-card-container',
+ variant === 'default' && 'rounded-xl border border-border bg-card',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/checkbox.tsx b/packages/dashboard-ui/src/ui/checkbox.tsx
index 83ec6e6f06..89b5e824b7 100644
--- a/packages/dashboard-ui/src/ui/checkbox.tsx
+++ b/packages/dashboard-ui/src/ui/checkbox.tsx
@@ -25,7 +25,15 @@ function Checkbox({
disabled={disabled}
name={name}
className={cn(
- 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-[4px] border border-border align-[-3px] outline-none transition-shadow',
+ 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-[4px] border border-border-control align-[-3px] outline-none transition-shadow',
+ // The 16px box is the right *visual* size in a dense table, but on its
+ // own it is a 16px target — under the 24px WCAG 2.2 asks for, on the
+ // control every bulk action starts from. A pseudo-element extends the
+ // pressable area to 34px without taking layout space, so column widths
+ // and row height are unchanged. `z-1` keeps it above the row-click
+ // bridge, which would otherwise swallow presses in the padded margin
+ // and navigate instead of selecting.
+ "before:absolute before:inset-[-9px] before:z-1 before:content-['']",
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
'disabled:cursor-not-allowed disabled:opacity-50',
'aria-invalid:border-destructive aria-invalid:ring-destructive/20',
diff --git a/packages/dashboard-ui/src/ui/combobox.tsx b/packages/dashboard-ui/src/ui/combobox.tsx
index dce33bb0cc..69efd8249a 100644
--- a/packages/dashboard-ui/src/ui/combobox.tsx
+++ b/packages/dashboard-ui/src/ui/combobox.tsx
@@ -48,7 +48,7 @@ function ComboboxButtonTrigger({ className, children, ...props }: ComboboxPrimit
<ComboboxPrimitive.Trigger
data-slot="combobox-button-trigger"
className={cn(
- "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border-field bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
@@ -286,7 +286,7 @@ function ComboboxChips({
// resize lets the positioner follow the anchor smoothly; making it
// instant jumps the open popup out from under the pointer, so the next
// option click lands on nothing.
- 'flex flex-wrap items-center gap-1.5 rounded-lg border border-border bg-card text-foreground px-2.5 py-1.5 text-base transition-all duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-aria-invalid:border-destructive has-data-[slot=combobox-chip]:p-1.5',
+ 'flex flex-wrap items-center gap-1.5 rounded-lg border border-border-field bg-card text-foreground px-2.5 py-1.5 text-base transition-all duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-aria-invalid:border-destructive has-data-[slot=combobox-chip]:p-1.5',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/command.tsx b/packages/dashboard-ui/src/ui/command.tsx
index f259b4c764..1ff9f9a00d 100644
--- a/packages/dashboard-ui/src/ui/command.tsx
+++ b/packages/dashboard-ui/src/ui/command.tsx
@@ -179,7 +179,7 @@ function CommandItem({
<CommandPrimitive.Item
data-slot="command-item"
className={cn(
- "group/command-item relative flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-selected:*:[svg]:text-foreground",
+ "group/command-item relative flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent data-selected:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-selected:*:[svg]:text-foreground",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/data-table.tsx b/packages/dashboard-ui/src/ui/data-table.tsx
index 8241ecd212..efb611d96d 100644
--- a/packages/dashboard-ui/src/ui/data-table.tsx
+++ b/packages/dashboard-ui/src/ui/data-table.tsx
@@ -19,10 +19,18 @@ interface TableProps extends React.ComponentProps<'table'> {
*/
stickyHeader?: boolean
/**
- * Rounds the last row's outer corners. Opt-in, because it only reads
- * correctly when the table is the last thing inside a rounded container —
- * anything below it (a pagination footer, a card action row) leaves the
- * curve floating mid-surface.
+ * Rounds the last row's outer corners.
+ *
+ * Left unset this resolves itself: the corners round only when the table's
+ * wrapper is the last element in its container, which is exactly when the
+ * row's edge is the card's edge. Pass `false` to suppress it, or `true` to
+ * force it where the container's own markup hides that (a table wrapped in
+ * an extra element that is not itself last).
+ *
+ * The rule matters in both directions, and callers had it wrong both ways: a
+ * table with a pagination footer under it drew a curve floating mid-surface,
+ * and one that ended the card left a square hover overflowing the card's
+ * own radius.
*/
roundedBottom?: boolean
}
@@ -48,13 +56,7 @@ interface TableProps extends React.ComponentProps<'table'> {
* rounding), and a scroll listener mirrors the body's `scrollLeft` onto the
* pinned table so the header tracks horizontal scrolling.
*/
-function Table({
- className,
- children,
- stickyHeader = false,
- roundedBottom = false,
- ...props
-}: TableProps) {
+function Table({ className, children, stickyHeader = false, roundedBottom, ...props }: TableProps) {
const scrollRef = useRef<HTMLDivElement | null>(null)
const bodyTableRef = useRef<HTMLTableElement | null>(null)
const pinnedTableRef = useRef<HTMLTableElement | null>(null)
@@ -64,9 +66,27 @@ function Table({
// `td:only-child` covers the empty and skeleton rows, whose single spanning
// cell is both first and last child — matching on those alone rounds one
// corner and leaves the other square against the card's curve.
- const roundedClasses = roundedBottom
- ? '[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl [&_tbody_tr:last-child_td:last-child]:rounded-br-xl [&_tbody_tr:last-child_td:only-child]:rounded-b-xl'
- : undefined
+ //
+ // `in-[&:last-child]` gates the whole set on the table's wrapper being the
+ // last element in its container: with a pagination footer under it the
+ // wrapper is not last, so the corners stay square on their own. Explicitly
+ // passing the prop opts out of that test in either direction.
+ // Both variants are written out in full rather than composed at runtime:
+ // Tailwind scans this file as text, so a class it never sees spelled out is
+ // a class it never generates.
+ const alwaysRounded =
+ '[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl [&_tbody_tr:last-child_td:last-child]:rounded-br-xl [&_tbody_tr:last-child_td:only-child]:rounded-b-xl'
+ // Applied to the outermost wrapper, not the table: `in-[:last-child]` is
+ // satisfied by *any* last-child ancestor, and the sticky variant nests two
+ // more divs that are both last inside it. Gating on the wrapper the
+ // pagination is actually a sibling of is the only test that means "nothing
+ // follows this table".
+ const roundedWhenLast =
+ 'last:[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl last:[&_tbody_tr:last-child_td:last-child]:rounded-br-xl last:[&_tbody_tr:last-child_td:only-child]:rounded-b-xl'
+ // `true`/`false` decide on the table itself; unset defers to the wrapper's
+ // own position among its siblings.
+ const tableRoundedClasses = roundedBottom === true ? alwaysRounded : undefined
+ const wrapperRoundedClasses = roundedBottom === undefined ? roundedWhenLast : undefined
const kids = Children.toArray(children)
const headerElement = kids.find(
@@ -119,9 +139,14 @@ function Table({
// visible`, so sticky resolves against the page instead. Narrow viewports
// keep `auto`, where scrolling a wide table sideways matters more than a
// sticky header.
- <div className="@container/table-scroll overflow-x-auto md:overflow-x-clip">
+ <div
+ className={cn(
+ '@container/table-scroll overflow-x-auto md:overflow-x-clip',
+ wrapperRoundedClasses,
+ )}
+ >
<table
- className={cn('w-full align-top text-foreground', roundedClasses, className)}
+ className={cn('w-full align-top text-foreground', tableRoundedClasses, className)}
{...props}
>
{children}
@@ -132,10 +157,14 @@ function Table({
// `w-max` + `min-w-full`: size to the content, but never narrower than the
// card, so a table with few columns still fills the width.
- const tableClasses = cn('w-max min-w-full align-top text-foreground', roundedClasses, className)
+ const tableClasses = cn(
+ 'w-max min-w-full align-top text-foreground',
+ tableRoundedClasses,
+ className,
+ )
return (
- <div className="relative min-w-0">
+ <div className={cn('relative min-w-0', wrapperRoundedClasses)}>
{/* Zero-height sticky wrapper: the pinned header overlays the sizer row
below instead of occupying its own band. The inner div clips the
horizontal overhang the translateX mirror produces. */}
@@ -216,7 +245,7 @@ function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
return (
- <tr className={cn('group/row hover:bg-accent/25 last:*:border-b-0', className)} {...props} />
+ <tr className={cn('group/row hover:bg-accent/70 last:*:border-b-0', className)} {...props} />
)
}
diff --git a/packages/dashboard-ui/src/ui/input-group.tsx b/packages/dashboard-ui/src/ui/input-group.tsx
index 5b26cc99aa..0a0c12c53a 100644
--- a/packages/dashboard-ui/src/ui/input-group.tsx
+++ b/packages/dashboard-ui/src/ui/input-group.tsx
@@ -11,7 +11,7 @@ function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="input-group"
role="group"
className={cn(
- 'group/input-group relative flex w-full min-w-0 items-center rounded-lg border border-border bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:shadow-none has-disabled:bg-muted has-disabled:opacity-50 has-disabled:shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-blue-500 has-[[data-slot=input-group-control]:focus-visible]:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-[[data-slot][aria-invalid=true]]:border-destructive has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
+ 'group/input-group relative flex w-full min-w-0 items-center rounded-lg border border-border-field bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:shadow-none has-disabled:bg-muted has-disabled:cursor-not-allowed has-disabled:text-muted-foreground has-disabled:shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-blue-500 has-[[data-slot=input-group-control]:focus-visible]:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-[[data-slot][aria-invalid=true]]:border-destructive has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/input.tsx b/packages/dashboard-ui/src/ui/input.tsx
index 6c06aab656..fbb75361f4 100644
--- a/packages/dashboard-ui/src/ui/input.tsx
+++ b/packages/dashboard-ui/src/ui/input.tsx
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
type={type}
data-slot="input"
className={cn(
- 'block w-full min-w-0 min-h-8 rounded-lg border border-border bg-card py-1.5 px-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
+ 'block w-full min-w-0 min-h-8 rounded-lg border border-border-field bg-card py-1.5 px-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/map.tsx b/packages/dashboard-ui/src/ui/map.tsx
index ee4a256191..0783c95916 100644
--- a/packages/dashboard-ui/src/ui/map.tsx
+++ b/packages/dashboard-ui/src/ui/map.tsx
@@ -591,7 +591,7 @@ function PopupCloseButton({ onClick }: { onClick: () => void }) {
type="button"
onClick={onClick}
aria-label="Close popup"
- className="focus-visible:ring-ring hover:bg-muted text-foreground absolute top-1 right-1 z-10 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset"
+ className="focus-visible:ring-ring hover:bg-accent text-foreground absolute top-1 right-1 z-10 inline-flex size-5 cursor-pointer items-center justify-center rounded-sm transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset"
>
<X className="size-3.5" />
</button>
diff --git a/packages/dashboard-ui/src/ui/radio-group.tsx b/packages/dashboard-ui/src/ui/radio-group.tsx
index dea67e5616..ce200c9d0f 100644
--- a/packages/dashboard-ui/src/ui/radio-group.tsx
+++ b/packages/dashboard-ui/src/ui/radio-group.tsx
@@ -18,7 +18,7 @@ function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof Rad
<RadioPrimitive.Root
data-slot="radio-group-item"
className={cn(
- 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-full border border-input align-[-3px] shadow-xs outline-none transition-shadow',
+ 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-full border border-border-control align-[-3px] shadow-xs outline-none transition-shadow',
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
'disabled:cursor-not-allowed disabled:opacity-50',
'aria-invalid:border-destructive aria-invalid:ring-destructive/20',
diff --git a/packages/dashboard-ui/src/ui/rich-text-editor.tsx b/packages/dashboard-ui/src/ui/rich-text-editor.tsx
index 50b6d81937..e8554ae5eb 100644
--- a/packages/dashboard-ui/src/ui/rich-text-editor.tsx
+++ b/packages/dashboard-ui/src/ui/rich-text-editor.tsx
@@ -177,7 +177,7 @@ export function RichTextEditor({
ref={wrapperRef}
data-slot="rich-text-editor"
className={cn(
- 'rounded-lg border border-border bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]',
+ 'rounded-lg border border-border-field bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]',
disabled && 'pointer-events-none bg-muted border-border',
className,
)}
diff --git a/packages/dashboard-ui/src/ui/select.tsx b/packages/dashboard-ui/src/ui/select.tsx
index 81b02f0e72..d89339ec0c 100644
--- a/packages/dashboard-ui/src/ui/select.tsx
+++ b/packages/dashboard-ui/src/ui/select.tsx
@@ -59,7 +59,7 @@ function SelectTrigger({
// doesn't collapse to chevron-height when the SelectValue render-prop
// returns an empty string (e.g., when value is unset and the
// placeholder isn't surfaced through the render-prop).
- "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive data-[placeholder]:text-muted-foreground data-[size=sm]:py-1 data-[size=sm]:px-2 data-[size=sm]:text-sm data-[size=sm]:min-h-[1.9375rem] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border-field bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive data-[placeholder]:text-muted-foreground data-[size=sm]:py-1 data-[size=sm]:px-2 data-[size=sm]:text-sm data-[size=sm]:min-h-[1.9375rem] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/sidebar.tsx b/packages/dashboard-ui/src/ui/sidebar.tsx
index 939104b467..1dc38e742c 100644
--- a/packages/dashboard-ui/src/ui/sidebar.tsx
+++ b/packages/dashboard-ui/src/ui/sidebar.tsx
@@ -337,9 +337,17 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
)
}
-function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
+function SidebarInset({ className, id = 'main-content', ...props }: React.ComponentProps<'main'>) {
return (
<main
+ // The skip link's target. Defaulted here rather than set by each host so
+ // the link cannot point at nothing.
+ id={id}
+ // `-1`: a container is not normally focusable, but the skip link has to
+ // be able to move focus here — without it the browser scrolls to the
+ // anchor and leaves focus behind in the nav, so the next Tab continues
+ // through the sidebar the user just asked to skip.
+ tabIndex={-1}
data-slot="sidebar-inset"
className={cn(
// `min-w-0`: `w-full` sets the flex basis to the wrapper's full width,
diff --git a/packages/dashboard-ui/src/ui/textarea.tsx b/packages/dashboard-ui/src/ui/textarea.tsx
index 85357b4669..7dfc907e82 100644
--- a/packages/dashboard-ui/src/ui/textarea.tsx
+++ b/packages/dashboard-ui/src/ui/textarea.tsx
@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
<textarea
data-slot="textarea"
className={cn(
- 'flex field-sizing-content min-h-16 w-full rounded-lg border border-border bg-card px-2.5 py-1.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive',
+ 'flex field-sizing-content min-h-16 w-full rounded-lg border border-border-field bg-card px-2.5 py-1.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive',
className,
)}
{...props}
diff --git a/packages/dashboard/e2e/auth.spec.ts b/packages/dashboard/e2e/auth.spec.ts
index db4747ffa1..73e022d2b9 100644
--- a/packages/dashboard/e2e/auth.spec.ts
+++ b/packages/dashboard/e2e/auth.spec.ts
@@ -34,7 +34,9 @@ test.describe('admin authentication', () => {
await page.getByRole('link', { name: /forgot password/i }).click()
await expect(page).toHaveURL(/\/forgot-password/)
- await expect(page.getByText('Reset your password', { exact: true })).toBeVisible()
+ // The heading specifically: the route announcer's live region briefly holds
+ // the same text, so a bare text match resolves to two elements.
+ await expect(page.getByRole('heading', { name: 'Reset your password' })).toBeVisible()
})
test('confirms the reset request without revealing whether the email exists', async ({
diff --git a/packages/dashboard/e2e/seller-catalog.spec.ts b/packages/dashboard/e2e/seller-catalog.spec.ts
index 170d00a243..0c2908dde7 100644
--- a/packages/dashboard/e2e/seller-catalog.spec.ts
+++ b/packages/dashboard/e2e/seller-catalog.spec.ts
@@ -62,11 +62,15 @@ test.describe('seller catalog and orders', () => {
try {
// Products: the list is reachable from the nav and starts empty.
+ //
+ // `level: 1` because a seller list page carries two headings by design —
+ // the page's own title and the table's caption below it. The assertion
+ // here is about landing on the page, which is the `h1`.
await sellerPage
.getByRole('link', { name: /products/i })
.first()
.click()
- await expect(sellerPage.getByRole('heading', { name: /products/i })).toBeVisible({
+ await expect(sellerPage.getByRole('heading', { name: /products/i, level: 1 })).toBeVisible({
timeout: 20_000,
})
@@ -100,7 +104,7 @@ test.describe('seller catalog and orders', () => {
.getByRole('link', { name: /orders/i })
.first()
.click()
- await expect(sellerPage.getByRole('heading', { name: /orders/i })).toBeVisible({
+ await expect(sellerPage.getByRole('heading', { name: /orders/i, level: 1 })).toBeVisible({
timeout: 20_000,
})
// The empty state itself, not merely the absence of an error: a blank
diff --git a/packages/dashboard/src/components/spree/api-keys/api-key-table.tsx b/packages/dashboard/src/components/spree/api-keys/api-key-table.tsx
index d197bec3cb..c51b199c61 100644
--- a/packages/dashboard/src/components/spree/api-keys/api-key-table.tsx
+++ b/packages/dashboard/src/components/spree/api-keys/api-key-table.tsx
@@ -130,7 +130,7 @@ function ApiKeyTableFrame({
</EmptyHeader>
</Empty>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.fields.name.label')}</TableHead>
diff --git a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
index e972b6288a..0510516aba 100644
--- a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
+++ b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
@@ -209,7 +209,10 @@ export function BulkPriceEditorDialog({
</Button>
</div>
</DialogHeader>
- <DialogBody className="flex min-h-0 flex-1 flex-col p-3">
+ {/* `p-0`: the editor pads its own toolbar and pager, so the grid
+ between them reaches the dialog's edges instead of floating
+ inside a gutter. */}
+ <DialogBody className="flex min-h-0 flex-1 flex-col p-0">
<BulkPriceEditor
priceListId={priceList.id}
currency={currency}
diff --git a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
index cd3e881cb3..747bee80a9 100644
--- a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
+++ b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
@@ -86,11 +86,64 @@ function CommandPaletteContent({ setOpen }: { setOpen: (open: boolean) => void }
const q = input.trim().toLowerCase()
const matches = (label: string) => !q || label.toLowerCase().includes(q)
- const gotoItems = gotoCommands.filter((c) =>
- matches(t('admin.components.command_palette.goto_label', { label: c.label })),
- )
+
+ // Rank a label against the query: whole word beats prefix beats anywhere.
+ // Without this a plain `includes` treats every hit as equal, so typing "ord"
+ // ordered two *C-ord-less* vacuums above "Orders" — the destination the
+ // query most obviously names. Ordering is stable within a tier, so the
+ // registry's own sequence still decides ties.
+ const matchRank = (label: string) => {
+ const value = label.toLowerCase()
+ if (value === q) return 0
+ if (value.startsWith(q)) return 1
+ if (new RegExp(`\\b${q.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`).test(value)) return 2
+ return 3
+ }
+
+ const gotoLabel = (command: (typeof gotoCommands)[number]) =>
+ t('admin.components.command_palette.goto_label', { label: command.label })
+
+ // Filter on the full "Go to Orders" string so typing the verb still finds
+ // things, but *rank* on the destination name alone — the wrapper begins with
+ // "Go to" in English and something different in every other locale, so
+ // ranking the decorated label would score every entry identically.
+ const gotoItems = gotoCommands
+ .filter((c) => matches(gotoLabel(c)) || matches(c.label))
+ .map((command, index) => ({ command, index }))
+ .sort((a, b) => {
+ const byRank = matchRank(a.command.label) - matchRank(b.command.label)
+ return byRank !== 0 ? byRank : a.index - b.index
+ })
+ .map(({ command }) => command)
+
+ // When the query names a destination outright ("orders", "products"), that
+ // page is what was asked for — so the nav group leads instead of sitting
+ // under every record whose text happens to contain the word. Anything less
+ // exact keeps the standard order, where records come first.
+ const gotoLeads = q.length > 0 && gotoItems.some((c) => matchRank(c.label) === 0)
const showLogout = matches(t('admin.auth.logout'))
+ // Rendered in one of two slots depending on `gotoLeads`, so it is built once
+ // here rather than duplicated in both branches of the list below.
+ const gotoGroup =
+ gotoItems.length > 0 ? (
+ <CommandGroup heading={t('admin.components.command_palette.goto')}>
+ {gotoItems.map(({ key, label, icon: Icon, url }) => (
+ <CommandItem
+ key={key}
+ value={`goto-${key}`}
+ onSelect={() => {
+ close()
+ navigate({ to: url })
+ }}
+ >
+ <Icon />
+ {label}
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ ) : null
+
return (
<Dialog
open
@@ -164,6 +217,9 @@ function CommandPaletteContent({ setOpen }: { setOpen: (open: boolean) => void }
<CommandSeparator />
)}
+ {gotoLeads && gotoGroup}
+ {gotoLeads && gotoItems.length > 0 && hasResults && <CommandSeparator />}
+
{groups.map((group) => (
<ResourceGroup
key={group.entry.key}
@@ -176,26 +232,12 @@ function CommandPaletteContent({ setOpen }: { setOpen: (open: boolean) => void }
/>
))}
- {hasResults && (gotoItems.length > 0 || showLogout) && <CommandSeparator />}
-
- {gotoItems.length > 0 && (
- <CommandGroup heading={t('admin.components.command_palette.goto')}>
- {gotoItems.map(({ key, label, icon: Icon, url }) => (
- <CommandItem
- key={key}
- value={`goto-${key}`}
- onSelect={() => {
- close()
- navigate({ to: url })
- }}
- >
- <Icon />
- {label}
- </CommandItem>
- ))}
- </CommandGroup>
+ {!gotoLeads && hasResults && (gotoItems.length > 0 || showLogout) && (
+ <CommandSeparator />
)}
+ {!gotoLeads && gotoGroup}
+
{gotoItems.length > 0 && showLogout && <CommandSeparator />}
{showLogout && (
diff --git a/packages/dashboard/src/components/spree/customers/customer-orders-card.tsx b/packages/dashboard/src/components/spree/customers/customer-orders-card.tsx
index b9c248205c..657313a319 100644
--- a/packages/dashboard/src/components/spree/customers/customer-orders-card.tsx
+++ b/packages/dashboard/src/components/spree/customers/customer-orders-card.tsx
@@ -72,7 +72,7 @@ export function CustomerOrdersCard({
</CardContent>
) : (
<CardContent className="p-0">
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.customers.detail.orders_table.order')}</TableHead>
diff --git a/packages/dashboard/src/components/spree/customers/customer-store-credits-card.tsx b/packages/dashboard/src/components/spree/customers/customer-store-credits-card.tsx
index e0a57afa4f..74d424a454 100644
--- a/packages/dashboard/src/components/spree/customers/customer-store-credits-card.tsx
+++ b/packages/dashboard/src/components/spree/customers/customer-store-credits-card.tsx
@@ -93,7 +93,7 @@ export function CustomerStoreCreditsCard({ customer }: { customer: Customer }) {
</CardContent>
) : (
<CardContent className="p-0">
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.fields.amount.label')}</TableHead>
diff --git a/packages/dashboard/src/components/spree/order-post-sale-cards.tsx b/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
index c403e53cd2..69f640d367 100644
--- a/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
+++ b/packages/dashboard/src/components/spree/order-post-sale-cards.tsx
@@ -62,7 +62,7 @@ export function OrderExchangesCard({ order }: { order: Order }) {
return (
<>
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<RepeatIcon className="size-4" />
@@ -214,7 +214,7 @@ export function OrderClaimsCard({ order }: { order: Order }) {
return (
<>
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<ShieldAlertIcon className="size-4" />
diff --git a/packages/dashboard/src/components/spree/order-returns-card.tsx b/packages/dashboard/src/components/spree/order-returns-card.tsx
index e14642e4c6..3a83f519ab 100644
--- a/packages/dashboard/src/components/spree/order-returns-card.tsx
+++ b/packages/dashboard/src/components/spree/order-returns-card.tsx
@@ -74,7 +74,7 @@ export function OrderReturnsCard({ order }: { order: Order }) {
return (
<>
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<RotateCcwIcon className="size-4" />
diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
index 2acb4c849b..540ecd16ee 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
@@ -795,7 +795,7 @@ export function FulfillmentsCard({ order }: { order: Order }) {
return (
<>
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<TruckIcon className="size-4" />
diff --git a/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx b/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx
index c7cb0c5c7a..1183064611 100644
--- a/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx
+++ b/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx
@@ -88,7 +88,7 @@ export function AddLineItemDialog({
setSelectedVariant(v)
setSearch('')
}}
- className="flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted transition-colors border-b last:border-0"
+ className="flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-accent transition-colors border-b last:border-0"
>
<div className="min-w-0 flex-1">
<div className="font-medium truncate">{v.product_name ?? v.sku}</div>
diff --git a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
index 2e2cc1e7ea..1bedd63982 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
@@ -715,7 +715,7 @@ function RuleRow({
}
return (
- <div className="flex w-full items-stretch rounded-md border bg-card hover:bg-muted/50">
+ <div className="flex w-full items-stretch rounded-md border bg-card hover:bg-accent/50">
<button
type="button"
onClick={onEdit}
@@ -890,7 +890,7 @@ function RulePickerSheet({
key={tt.type}
type="button"
onClick={() => onPicked(tt)}
- className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-muted/50"
+ className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-accent/50"
>
<span className="text-sm font-medium">
{typeLabel('price_rule', tt.type, tt.label)}
diff --git a/packages/dashboard/src/components/spree/products/publishing-card.tsx b/packages/dashboard/src/components/spree/products/publishing-card.tsx
index 56ffdb5f37..1c6d5ac4c7 100644
--- a/packages/dashboard/src/components/spree/products/publishing-card.tsx
+++ b/packages/dashboard/src/components/spree/products/publishing-card.tsx
@@ -235,7 +235,7 @@ function PublicationRow({
<button
type="button"
onClick={onEdit}
- className="group flex w-full items-start justify-between gap-3 rounded-md px-2 py-2 text-left hover:bg-muted/40"
+ className="group flex w-full items-start justify-between gap-3 rounded-md px-2 py-2 text-left hover:bg-accent cursor-pointer"
>
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
<div className="flex items-center gap-2">
@@ -377,7 +377,7 @@ function ManageChannelsSheet({
key={channel.id}
type="button"
onClick={() => toggle(channel, !checked)}
- className="flex w-full cursor-pointer items-center gap-3 rounded-md border border-border bg-background px-3 py-2 text-left hover:bg-muted/40"
+ className="flex w-full cursor-pointer items-center gap-3 rounded-md border border-border bg-background px-3 py-2 text-left hover:bg-accent"
>
<Checkbox checked={checked} tabIndex={-1} />
<span className="flex-1 text-sm">
diff --git a/packages/dashboard/src/components/spree/promotion-editors/action-create-line-items.tsx b/packages/dashboard/src/components/spree/promotion-editors/action-create-line-items.tsx
index a89d2e75f9..1211681542 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/action-create-line-items.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/action-create-line-items.tsx
@@ -127,7 +127,7 @@ export function CreateLineItemsActionEditor({
</p>
) : (
<div className="overflow-x-auto">
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.orders.new.items_table.variant')}</TableHead>
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index 5bc8836a8e..52d180f99e 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -802,7 +802,7 @@ function RuleRow({
// valid sibling. The "edit" area is its own <button> spanning the
// label/summary slot; trash is the second column.
return (
- <div className="flex w-full items-stretch rounded-md border bg-card hover:bg-muted/50">
+ <div className="flex w-full items-stretch rounded-md border bg-card hover:bg-accent/50">
<button
type="button"
onClick={onEdit}
@@ -983,7 +983,7 @@ function RulePickerSheet({
key={tt.type}
type="button"
onClick={() => onPicked(tt)}
- className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-muted/50"
+ className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-accent/50"
>
<span className="text-sm font-medium">
{typeLabel('promotion_rule', tt.type, tt.label)}
@@ -1202,7 +1202,7 @@ function ActionRow({
}
return (
- <div className="flex w-full items-stretch rounded-md border bg-card hover:bg-muted/50">
+ <div className="flex w-full items-stretch rounded-md border bg-card hover:bg-accent/50">
<button
type="button"
onClick={onEdit}
@@ -1275,7 +1275,7 @@ function ActionPickerSheet({
key={type.type}
type="button"
onClick={() => onPicked(type)}
- className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-muted/50"
+ className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-accent/50"
>
<span className="text-sm font-medium">
{typeLabel('promotion_action', type.type, type.label)}
diff --git a/packages/dashboard/src/create-router.ts b/packages/dashboard/src/create-router.ts
index f48f935e89..450f699a33 100644
--- a/packages/dashboard/src/create-router.ts
+++ b/packages/dashboard/src/create-router.ts
@@ -1,9 +1,11 @@
+import { ErrorState } from '@spree/dashboard-ui'
import {
type AnyRoute,
createRouter,
type RouterConstructorOptions,
type RouterHistory,
} from '@tanstack/react-router'
+import { createElement } from 'react'
import { RoutePending } from './components/spree/route-pending'
/**
@@ -55,6 +57,14 @@ export function createDashboardRouter<TRouteTree extends AnyRoute>(
// Every route inherits this while its chunk or loader resolves. Without it
// TanStack renders a bare "Loading…" string on an otherwise blank page.
defaultPendingComponent: RoutePending,
+ // Without this a thrown render or loader error takes the whole admin down
+ // to a white screen. TanStack hands the component `{ error, reset }`, so
+ // the merchant gets the message and a retry rather than a dead tab.
+ // `createElement` rather than JSX so this stays a `.ts` module: renaming
+ // it to `.tsx` changes the specifier every importer resolves, which a
+ // running dev server caches and then fails to find.
+ defaultErrorComponent: ({ error, reset }) =>
+ createElement(ErrorState, { error, onRetry: reset }),
// Long enough that a fast navigation never flashes a skeleton, short enough
// that a slow one doesn't look frozen.
defaultPendingMs: 300,
diff --git a/packages/dashboard/src/routes/__root.tsx b/packages/dashboard/src/routes/__root.tsx
index aefb54511a..480ac66b18 100644
--- a/packages/dashboard/src/routes/__root.tsx
+++ b/packages/dashboard/src/routes/__root.tsx
@@ -1,3 +1,4 @@
+import { RouteAnnouncer } from '@spree/dashboard-core'
import { Toaster } from '@spree/dashboard-ui'
import { createRootRoute, Outlet } from '@tanstack/react-router'
@@ -9,6 +10,9 @@ function RootLayout() {
return (
<>
<Outlet />
+ {/* Mounted above every route, signed in or not, so the tab title and the
+ navigation announcement follow the page wherever it goes. */}
+ <RouteAnnouncer />
<Toaster />
</>
)
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
index 5ae183c883..2d2803d217 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
@@ -5,15 +5,15 @@ import {
MobileBreadcrumbBar,
SettingsNavSheet,
SettingsSidebar,
+ SkipLink,
StickyHeaderProvider,
StoreProvider,
TopBar,
useAutoCollapseSidebar,
- usePermissions,
} from '@spree/dashboard-core'
import { SidebarInset, SidebarProvider } from '@spree/dashboard-ui'
import { createFileRoute, Outlet, useRouterState } from '@tanstack/react-router'
-import { useEffect, useRef, useState } from 'react'
+import { useState } from 'react'
import { CommandPalette } from '../../components/spree/command-palette/command-palette'
import { ProfileDialog } from '../../components/spree/profile-dialog'
import { getAvailableUiLocales } from '../../i18n-setup'
@@ -36,21 +36,10 @@ function StoreLayout() {
const { storeId } = Route.useParams()
const pathname = useRouterState({ select: (s) => s.location.pathname })
const inSettings = pathname.startsWith(`/${storeId}/settings`)
- const { refresh: refreshPermissions } = usePermissions()
- const isFirstStore = useRef(true)
-
- // Permissions are store-scoped (roles are held per store). The provider
- // already loaded them for the initial store on login; reload only when the
- // admin switches to a different store — `storeId` is in the deps for
- // exactly that re-run, even though the body doesn't read it.
- // biome-ignore lint/correctness/useExhaustiveDependencies: storeId drives the store-switch re-run
- useEffect(() => {
- if (isFirstStore.current) {
- isFirstStore.current = false
- return
- }
- void refreshPermissions()
- }, [storeId, refreshPermissions])
+ // Permissions are store-scoped (roles are held per store), and the provider
+ // now keys its query by the active store — so switching store refetches them
+ // on its own. The manual reload this used to run here is not just redundant
+ // but harmful: it re-ran whenever its callback changed identity.
return (
<StoreProvider storeId={storeId}>
@@ -83,6 +72,9 @@ function StoreShell({ inSettings }: { inSettings: boolean }) {
return (
<>
+ {/* First in the tab order by construction — it has to precede the
+ sidebar's thirty-odd links to be able to skip them. */}
+ <SkipLink />
<AppSidebar />
{/* `flex-row` so the secondary sidebar can sit flush against the
primary and span full height. The TopBar moves into the content
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
index 07df55991c..3c48a08a3f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
@@ -100,7 +100,7 @@ function AnalyticsChart({ data }: { data: DashboardAnalytics }) {
key={metric}
type="button"
onClick={() => setActiveMetric(metric)}
- className="relative flex min-w-0 flex-1 flex-col justify-center gap-1 border-l px-3 py-3 text-left transition-colors first:border-l-0 hover:bg-muted/40 sm:px-6 sm:py-4"
+ className="relative flex min-w-0 flex-1 flex-col justify-center gap-1 border-l px-3 py-3 text-left transition-colors first:border-l-0 hover:bg-accent/40 sm:px-6 sm:py-4"
>
<span className="truncate text-xs text-muted-foreground">
{t(`admin.pages.home.metrics.${metric}`)}
@@ -170,7 +170,7 @@ function TopProducts({ products }: { products: DashboardAnalytics['top_products'
<CardDescription>{t('admin.pages.home.top_products_description')}</CardDescription>
</CardHeader>
<CardContent className="p-0">
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.pages.home.columns.product')}</TableHead>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
index ef25326baf..21017dd49f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
@@ -299,7 +299,7 @@ function NewOrderPage() {
{items.length > 0 && (
<div className="mt-4 overflow-x-auto">
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.orders.new.items_table.variant')}</TableHead>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
index 29e33c5138..415a1e7595 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
@@ -586,7 +586,7 @@ function OptionValuesFieldArray({
image_cleared: false,
})
}
- className="flex w-full items-center justify-center gap-2 px-3 py-3 text-sm font-medium text-foreground transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ className="flex w-full items-center justify-center gap-2 px-3 py-3 text-sm font-medium text-foreground transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
>
<PlusIcon className="size-4" />
{t('admin.pages.products.options.add_value')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/reasons.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/reasons.tsx
index 8e46d4e057..77a6debd20 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/reasons.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/reasons.tsx
@@ -171,7 +171,7 @@ function ReasonSection({
</EmptyHeader>
</Empty>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.fields.name.label')}</TableHead>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx
index 2eb18f9ddb..abd5175841 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx
@@ -99,7 +99,7 @@ function RolesSettingsPage() {
</EmptyHeader>
</Empty>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.pages.roles.table.role')}</TableHead>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
index e12aea187d..cdf5b7cf6c 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
@@ -147,7 +147,7 @@ function StaffCard({ staff, loading }: { staff: AdminUser[]; loading: boolean })
</EmptyHeader>
</Empty>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.pages.staff.table.member')}</TableHead>
@@ -274,7 +274,7 @@ function PendingInvitationsCard({
<Skeleton className="h-10 w-full" />
</div>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('admin.fields.email.label')}</TableHead>
diff --git a/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx b/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx
index fba1633475..3a8c6a99bf 100644
--- a/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx
+++ b/packages/seller-dashboard/src/components/orders/fulfillments-card.tsx
@@ -53,7 +53,7 @@ export function FulfillmentsCard({ order }: { order: Order }) {
const fulfillments = order.fulfillments ?? []
return (
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<TruckIcon className="size-4" />
diff --git a/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx b/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx
index 9ab1f5dd9a..589f3db4ea 100644
--- a/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx
+++ b/packages/seller-dashboard/src/components/orders/post-sale-cards.tsx
@@ -66,7 +66,7 @@ export function ExchangesCard({ order }: { order: Order }) {
}
return (
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<ArrowLeftRightIcon className="size-4" />
@@ -186,7 +186,7 @@ export function ClaimsCard({ order }: { order: Order }) {
}
return (
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<ShieldAlertIcon className="size-4" />
diff --git a/packages/seller-dashboard/src/components/orders/returns-card.tsx b/packages/seller-dashboard/src/components/orders/returns-card.tsx
index 3639bf4d00..ec7ab18554 100644
--- a/packages/seller-dashboard/src/components/orders/returns-card.tsx
+++ b/packages/seller-dashboard/src/components/orders/returns-card.tsx
@@ -62,7 +62,7 @@ export function ReturnsCard({ order }: { order: Order }) {
}
return (
- <Card>
+ <Card variant="container">
<CardHeader>
<CardTitle>
<RotateCcwIcon className="size-4" />
diff --git a/packages/seller-dashboard/src/pages/onboarding.tsx b/packages/seller-dashboard/src/pages/onboarding.tsx
index ce3f2a7b71..0048c53f62 100644
--- a/packages/seller-dashboard/src/pages/onboarding.tsx
+++ b/packages/seller-dashboard/src/pages/onboarding.tsx
@@ -152,7 +152,7 @@ function RequirementCard({
<button
type="button"
onClick={() => setOpen((previous) => !previous)}
- className="flex w-full cursor-pointer items-center gap-3 p-4 text-left hover:bg-muted/50"
+ className="flex w-full cursor-pointer items-center gap-3 p-4 text-left hover:bg-accent/50"
>
<StatusIcon status={requirement.status} />
<div className="flex min-w-0 flex-col">
diff --git a/packages/seller-dashboard/src/pages/team.tsx b/packages/seller-dashboard/src/pages/team.tsx
index 7e5808d1a2..441c9fd1ef 100644
--- a/packages/seller-dashboard/src/pages/team.tsx
+++ b/packages/seller-dashboard/src/pages/team.tsx
@@ -149,7 +149,7 @@ function MembersCard({ members, loading }: { members: TeamMember[]; loading: boo
</EmptyHeader>
</Empty>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('team.table.member')}</TableHead>
@@ -257,7 +257,7 @@ function PendingInvitationsCard({
<Skeleton className="h-10 w-full" />
</div>
) : (
- <Table roundedBottom>
+ <Table>
<TableHeader>
<TableRow>
<TableHead>{t('team.table.email')}</TableHead>