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.

Move remaining components from dashboard to dashboard-ui/dashboard-core (#14109)

Damian Legawieca9f69f8ab233
diff --git a/packages/dashboard-core/package.json b/packages/dashboard-core/package.json
index b2afe562bf..9a8ea7fc52 100644
--- a/packages/dashboard-core/package.json
+++ b/packages/dashboard-core/package.json
@@ -28,6 +28,7 @@
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
+ "@hookform/resolvers": "^5.2.2",
"@spree/admin-sdk": "workspace:^",
"@spree/dashboard-ui": "workspace:^",
"@tanstack/react-hotkeys": "^0.10.0",
@@ -41,8 +42,12 @@
"sonner": "^2.0.7"
},
"dependencies": {
+ "@dnd-kit/core": "^6.3.1",
+ "@dnd-kit/sortable": "^10.0.0",
+ "@dnd-kit/utilities": "^3.2.2",
"lucide-react": "^1.14.0",
- "spark-md5": "^3.0.2"
+ "spark-md5": "^3.0.2",
+ "zod": "^4.4.3"
},
"devDependencies": {
"@types/react": "^19.2.14",
diff --git a/packages/dashboard/src/components/spree/address-form-dialog.tsx b/packages/dashboard-core/src/components/address-form-dialog.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/address-form-dialog.tsx
rename to packages/dashboard-core/src/components/address-form-dialog.tsx
index 4a6d9f866d..e17756b648 100644
--- a/packages/dashboard/src/components/spree/address-form-dialog.tsx
+++ b/packages/dashboard-core/src/components/address-form-dialog.tsx
@@ -1,6 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Address } from '@spree/admin-sdk'
-import { mapSpreeErrorsToForm } from '@spree/dashboard-core'
import {
Button,
Checkbox,
@@ -21,8 +20,9 @@ import { useEffect, useRef } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { CountryCombobox } from '@/components/spree/country-combobox'
-import { StateCombobox, useCountryStates } from '@/components/spree/country-state-fields'
+import { mapSpreeErrorsToForm } from '../lib/form-errors'
+import { CountryCombobox } from './country-combobox'
+import { StateCombobox, useCountryStates } from './country-state-fields'
export interface AddressParams {
first_name: string
diff --git a/packages/dashboard/src/components/spree/app-sidebar.tsx b/packages/dashboard-core/src/components/app-sidebar.tsx
similarity index 86%
rename from packages/dashboard/src/components/spree/app-sidebar.tsx
rename to packages/dashboard-core/src/components/app-sidebar.tsx
index a69c756609..c9e433de3f 100644
--- a/packages/dashboard/src/components/spree/app-sidebar.tsx
+++ b/packages/dashboard-core/src/components/app-sidebar.tsx
@@ -1,17 +1,11 @@
-import {
- type NavEntry,
- type Permissions,
- useNavEntries,
- usePermissions,
-} from '@spree/dashboard-core'
import { Sidebar, SidebarContent, SidebarHeader } from '@spree/dashboard-ui'
import { useParams } from '@tanstack/react-router'
import { PackageIcon } from 'lucide-react'
import type { ComponentProps } from 'react'
-import { type NavItem, NavMain } from '@/components/spree/nav-main'
-import { StoreSwitcher } from '@/components/spree/store-switcher'
-
-import '@/nav/default'
+import { type NavEntry, useNavEntries } from '../lib/nav-registry'
+import { type Permissions, usePermissions } from '../providers/permission-provider'
+import { type NavItem, NavMain } from './nav-main'
+import { StoreSwitcher } from './store-switcher'
function entryToNavItem(entry: NavEntry, storeId: string): NavItem {
const pathFor = (path: string) => (path === '/' ? `/${storeId}` : `/${storeId}${path}`)
diff --git a/packages/dashboard/src/components/spree/bulk-action-bar.tsx b/packages/dashboard-core/src/components/bulk-action-bar.tsx
similarity index 99%
rename from packages/dashboard/src/components/spree/bulk-action-bar.tsx
rename to packages/dashboard-core/src/components/bulk-action-bar.tsx
index 9770479879..74581b777d 100644
--- a/packages/dashboard/src/components/spree/bulk-action-bar.tsx
+++ b/packages/dashboard-core/src/components/bulk-action-bar.tsx
@@ -1,4 +1,3 @@
-import { usePermissions } from '@spree/dashboard-core'
import { Button, useConfirm } from '@spree/dashboard-ui'
import type { QueryKey } from '@tanstack/react-query'
import { useQueryClient } from '@tanstack/react-query'
@@ -6,6 +5,7 @@ import type { ReactNode } from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
+import { usePermissions } from '../providers/permission-provider'
/**
* Context handed to a bulk action's `run` and `form` callbacks. `ids` is the
diff --git a/packages/dashboard/src/components/spree/can.tsx b/packages/dashboard-core/src/components/can.tsx
similarity index 86%
rename from packages/dashboard/src/components/spree/can.tsx
rename to packages/dashboard-core/src/components/can.tsx
index d04889aa2c..76f2b259da 100644
--- a/packages/dashboard/src/components/spree/can.tsx
+++ b/packages/dashboard-core/src/components/can.tsx
@@ -1,6 +1,6 @@
-import type { ActionName, SubjectName } from '@spree/dashboard-core'
-import { usePermissions } from '@spree/dashboard-core'
import type { ReactNode } from 'react'
+import type { ActionName, SubjectName } from '../lib/permissions'
+import { usePermissions } from '../providers/permission-provider'
interface CanProps {
/** Action name (e.g. "update", "destroy", "manage") */
diff --git a/packages/dashboard/src/components/spree/country-combobox.tsx b/packages/dashboard-core/src/components/country-combobox.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/country-combobox.tsx
rename to packages/dashboard-core/src/components/country-combobox.tsx
index de684768f5..8e557df800 100644
--- a/packages/dashboard/src/components/spree/country-combobox.tsx
+++ b/packages/dashboard-core/src/components/country-combobox.tsx
@@ -1,4 +1,3 @@
-import { useCountries, useTranslation } from '@spree/dashboard-core'
import {
Combobox,
ComboboxChip,
@@ -15,6 +14,8 @@ import {
useComboboxAnchor,
} from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useCountries } from '../hooks/use-countries'
export type CountryOption = { iso: string; iso3: string; name: string }
diff --git a/packages/dashboard/src/components/spree/country-state-fields.tsx b/packages/dashboard-core/src/components/country-state-fields.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/country-state-fields.tsx
rename to packages/dashboard-core/src/components/country-state-fields.tsx
index 34c5194b9d..acf470bbe4 100644
--- a/packages/dashboard/src/components/spree/country-state-fields.tsx
+++ b/packages/dashboard-core/src/components/country-state-fields.tsx
@@ -1,5 +1,4 @@
import type { State } from '@spree/admin-sdk'
-import { useCountries } from '@spree/dashboard-core'
import {
Combobox,
ComboboxContent,
@@ -10,6 +9,7 @@ import {
} from '@spree/dashboard-ui'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
+import { useCountries } from '../hooks/use-countries'
type StateOption = { abbr: string; name: string }
diff --git a/packages/dashboard/src/components/spree/currency-select.tsx b/packages/dashboard-core/src/components/currency-select.tsx
similarity index 97%
rename from packages/dashboard/src/components/spree/currency-select.tsx
rename to packages/dashboard-core/src/components/currency-select.tsx
index f0b0ac0e17..df0d43377b 100644
--- a/packages/dashboard/src/components/spree/currency-select.tsx
+++ b/packages/dashboard-core/src/components/currency-select.tsx
@@ -1,6 +1,7 @@
-import { useStore, useTranslation } from '@spree/dashboard-core'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useStore } from '../providers/store-provider'
interface CurrencySelectProps {
/** ID for the trigger — paired with the parent `<FieldLabel htmlFor>`. */
diff --git a/packages/dashboard/src/components/spree/export-button.tsx b/packages/dashboard-core/src/components/export-button.tsx
similarity index 96%
rename from packages/dashboard/src/components/spree/export-button.tsx
rename to packages/dashboard-core/src/components/export-button.tsx
index 0744f3d37c..01264fa470 100644
--- a/packages/dashboard/src/components/spree/export-button.tsx
+++ b/packages/dashboard-core/src/components/export-button.tsx
@@ -1,5 +1,4 @@
import type { ExportType } from '@spree/admin-sdk'
-import { filtersToRansack, useExport } from '@spree/dashboard-core'
import {
Button,
Dialog,
@@ -19,7 +18,9 @@ import {
} from '@spree/dashboard-ui'
import { DownloadIcon, FilterIcon, GlobeIcon } from 'lucide-react'
import { useState } from 'react'
-import type { ResourceActionsContext } from '@/components/spree/resource-table'
+import { useExport } from '../hooks/use-export'
+import { filtersToRansack } from '../lib/filters-to-ransack'
+import type { ResourceActionsContext } from './resource-table'
interface ExportButtonProps extends ResourceActionsContext {
/** Which dataset to export. Server validates against `Spree::Export.available_types`. */
diff --git a/packages/dashboard/src/components/spree/locale-select.tsx b/packages/dashboard-core/src/components/locale-select.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/locale-select.tsx
rename to packages/dashboard-core/src/components/locale-select.tsx
index 98c1f246b8..d61cebab7d 100644
--- a/packages/dashboard/src/components/spree/locale-select.tsx
+++ b/packages/dashboard-core/src/components/locale-select.tsx
@@ -1,4 +1,3 @@
-import { useStore, useTranslation } from '@spree/dashboard-core'
import {
Combobox,
ComboboxChip,
@@ -17,6 +16,8 @@ import {
useComboboxAnchor,
} from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useStore } from '../providers/store-provider'
interface BaseProps {
/** Locale codes to pick from. Defaults to the current store's `supported_locales`. */
diff --git a/packages/dashboard/src/components/spree/nav-main.tsx b/packages/dashboard-core/src/components/nav-main.tsx
similarity index 99%
rename from packages/dashboard/src/components/spree/nav-main.tsx
rename to packages/dashboard-core/src/components/nav-main.tsx
index 340221fb30..0d14115f22 100644
--- a/packages/dashboard/src/components/spree/nav-main.tsx
+++ b/packages/dashboard-core/src/components/nav-main.tsx
@@ -1,4 +1,3 @@
-import type { SubjectName } from '@spree/dashboard-core'
import {
DropdownMenu,
DropdownMenuContent,
@@ -16,6 +15,7 @@ import {
import { Link, useRouterState } from '@tanstack/react-router'
import type { LucideIcon } from 'lucide-react'
import { useState } from 'react'
+import type { SubjectName } from '../lib/permissions'
export type NavItem = {
title: string
diff --git a/packages/dashboard/src/components/spree/page-tabs.tsx b/packages/dashboard-core/src/components/page-tabs.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/page-tabs.tsx
rename to packages/dashboard-core/src/components/page-tabs.tsx
index 6ffd9ad9c7..071c92216d 100644
--- a/packages/dashboard/src/components/spree/page-tabs.tsx
+++ b/packages/dashboard-core/src/components/page-tabs.tsx
@@ -1,7 +1,7 @@
-import { Slot } from '@spree/dashboard-core'
import { cn } from '@spree/dashboard-ui'
import { Link, type LinkProps, useLocation, useRouter } from '@tanstack/react-router'
import type { ReactNode } from 'react'
+import { Slot } from './slot'
export interface PageTab {
/** Stable key used for React lists. */
diff --git a/packages/dashboard/src/components/spree/preferences-form.tsx b/packages/dashboard-core/src/components/preferences-form.tsx
similarity index 99%
rename from packages/dashboard/src/components/spree/preferences-form.tsx
rename to packages/dashboard-core/src/components/preferences-form.tsx
index 9af0100ae1..a65666e269 100644
--- a/packages/dashboard/src/components/spree/preferences-form.tsx
+++ b/packages/dashboard-core/src/components/preferences-form.tsx
@@ -1,5 +1,4 @@
import type { PreferenceField as PreferenceFieldDef } from '@spree/admin-sdk'
-import { useTranslation } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -12,7 +11,8 @@ import {
} from '@spree/dashboard-ui'
import { PlusIcon, TrashIcon } from 'lucide-react'
import { useId, useMemo, useState } from 'react'
-import { CurrencySelect } from '@/components/spree/currency-select'
+import { useTranslation } from 'react-i18next'
+import { CurrencySelect } from './currency-select'
/**
* Hydrates a `preferences` hash with each field's default. Used to seed
diff --git a/packages/dashboard-core/src/components/resource-combobox.tsx b/packages/dashboard-core/src/components/resource-combobox.tsx
new file mode 100644
index 0000000000..9c328e6a1d
--- /dev/null
+++ b/packages/dashboard-core/src/components/resource-combobox.tsx
@@ -0,0 +1,117 @@
+import {
+ type ComboboxOption,
+ ResourceCombobox as HeadlessResourceCombobox,
+ type ResourceComboboxProps as HeadlessResourceComboboxProps,
+} from '@spree/dashboard-ui'
+import { useQuery } from '@tanstack/react-query'
+import { useDeferredValue, useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+
+export type { ComboboxOption } from '@spree/dashboard-ui'
+
+export interface ResourceComboboxProps<T extends ComboboxOption>
+ extends Pick<
+ HeadlessResourceComboboxProps<T>,
+ | 'value'
+ | 'onChange'
+ | 'getOptionLabel'
+ | 'renderOption'
+ | 'placeholder'
+ | 'emptyText'
+ | 'disabled'
+ > {
+ /**
+ * Server-side search. Called as the user types (debounced via React's
+ * `useDeferredValue`). Receives the trimmed query string — returning
+ * `{ data: [] }` for empty queries is a fine default, as is showing
+ * "recent records".
+ */
+ search: (query: string) => Promise<{ data: T[] }>
+
+ /**
+ * Hydrate the currently-selected ID into a record so the trigger can show
+ * its label (e.g. on first render after deep-link reload). Called once
+ * per `value` change. Should return the record listed by ID.
+ */
+ hydrate: (ids: string[]) => Promise<{ data: T[] }>
+
+ /** Stable cache prefix — e.g. `'gift-card-customer-picker'`. */
+ queryKey: string
+}
+
+/**
+ * Search-driven single-select for a remote resource (customers, variants,
+ * stores, …). Wraps `@spree/dashboard-ui`'s pure `<ResourceCombobox>` with
+ * TanStack Query: `search` is called as the user types, `hydrate` resolves
+ * the currently-selected ID into a record on first render.
+ *
+ * Most callsites use this convenience wrapper. Reach for the headless version
+ * in `@spree/dashboard-ui` when the data flow doesn't match this shape
+ * (custom caching layer, local-only filtering, an externally-managed query).
+ */
+export function ResourceCombobox<T extends ComboboxOption>({
+ value,
+ onChange,
+ search,
+ hydrate,
+ queryKey,
+ getOptionLabel,
+ renderOption,
+ placeholder,
+ emptyText,
+ disabled,
+}: ResourceComboboxProps<T>) {
+ const { t } = useTranslation()
+ const placeholderLabel = placeholder ?? t('admin.common.search_placeholder')
+ const emptyLabel = emptyText ?? t('admin.common.no_results')
+
+ // Base UI's Combobox owns the input element so it can write the selected
+ // option's label into it on pick. We observe the typed query via
+ // `onInputChange` on the Root rather than controlling
+ // `<ComboboxInput value>` directly — controlling the input blocks Base UI
+ // from updating it on selection.
+ const [input, setInput] = useState('')
+ // Defer the search query so a fast typist doesn't fire one request per
+ // keystroke — React batches the search to the next idle paint.
+ const deferredInput = useDeferredValue(input)
+ const trimmedQuery = deferredInput.trim()
+
+ const { data: searchData } = useQuery({
+ queryKey: [queryKey, 'search', trimmedQuery],
+ queryFn: () => search(trimmedQuery),
+ staleTime: 30_000,
+ })
+
+ // Hydrate the currently selected ID into a record so the trigger shows
+ // its label after a deep-link reload (before the user types anything).
+ // Skipped when the search results already include the ID.
+ const searchHasValue = !!(value && searchData?.data.some((r) => r.id === value))
+ const { data: hydratedData } = useQuery({
+ queryKey: [queryKey, 'hydrate', value],
+ queryFn: () => hydrate([value as string]),
+ enabled: !!value && !searchHasValue,
+ staleTime: 60_000,
+ })
+
+ // Merge: prefer the (possibly fresher) search result if both have the ID.
+ const items = useMemo(() => {
+ const map = new Map<string, T>()
+ for (const r of hydratedData?.data ?? []) map.set(r.id, r)
+ for (const r of searchData?.data ?? []) map.set(r.id, r)
+ return Array.from(map.values())
+ }, [searchData, hydratedData])
+
+ return (
+ <HeadlessResourceCombobox
+ value={value}
+ onChange={onChange}
+ items={items}
+ onInputChange={setInput}
+ getOptionLabel={getOptionLabel}
+ renderOption={renderOption}
+ placeholder={placeholderLabel}
+ emptyText={emptyLabel}
+ disabled={disabled}
+ />
+ )
+}
diff --git a/packages/dashboard-core/src/components/resource-multi-autocomplete.tsx b/packages/dashboard-core/src/components/resource-multi-autocomplete.tsx
new file mode 100644
index 0000000000..7a53d04582
--- /dev/null
+++ b/packages/dashboard-core/src/components/resource-multi-autocomplete.tsx
@@ -0,0 +1,160 @@
+import {
+ type AutocompleteOption,
+ ResourceMultiAutocomplete as HeadlessResourceMultiAutocomplete,
+ type ResourceMultiAutocompleteProps as HeadlessResourceMultiAutocompleteProps,
+} from '@spree/dashboard-ui'
+import { useQuery } from '@tanstack/react-query'
+import { useCallback, useEffect, useMemo, useState } from 'react'
+
+export type { AutocompleteOption } from '@spree/dashboard-ui'
+
+export interface ResourceMultiAutocompleteProps<T extends AutocompleteOption>
+ extends Pick<
+ HeadlessResourceMultiAutocompleteProps<T>,
+ | 'value'
+ | 'onChange'
+ | 'onResolvedOptionsChange'
+ | 'getOptionLabel'
+ | 'placeholder'
+ | 'emptyText'
+ | 'disabled'
+ > {
+ /**
+ * Server-side search. Receives the trimmed query string. Should return
+ * `{ data: T[] }`. Called any time the user types (with debouncing
+ * provided by the caller's queryClient if needed).
+ */
+ search: (query: string) => Promise<{ data: T[] }>
+
+ /**
+ * Hydration query for the IDs in `value` that we don't yet have
+ * details for. Called once per `idsToHydrate` change. Should return
+ * the listed records, in any order — they're keyed by `id`.
+ */
+ hydrate: (ids: string[]) => Promise<{ data: T[] }>
+
+ /** Stable cache key for this picker instance — e.g. `'rule-products'`. */
+ queryKey: string
+}
+
+/**
+ * Search-driven multi-select for a remote resource. Wraps
+ * `@spree/dashboard-ui`'s headless `<ResourceMultiAutocomplete>` with
+ * TanStack Query: `search` fires as the user types; `hydrate` resolves any
+ * selected IDs not yet in the cache so chips render with labels even after
+ * a deep-link reload.
+ *
+ * Most callsites use this convenience wrapper. Reach for the headless
+ * version in `@spree/dashboard-ui` when the data flow doesn't match this
+ * shape (custom caching layer, local-only filtering, externally-managed
+ * query state).
+ */
+export function ResourceMultiAutocomplete<T extends AutocompleteOption>({
+ value,
+ onChange,
+ onResolvedOptionsChange,
+ search,
+ hydrate,
+ queryKey,
+ getOptionLabel,
+ placeholder,
+ emptyText,
+ disabled,
+}: ResourceMultiAutocompleteProps<T>) {
+ const [inputValue, setInputValue] = useState('')
+
+ // id → option cache. Survives across search queries so chips don't
+ // flicker when `value` changes. Stored as a `Map` in state so we never
+ // miss a render — TanStack Query's settle re-renders the component,
+ // which re-derives `selectedOptions`/`items` from this.
+ const [cache, setCache] = useState<Map<string, T>>(() => new Map())
+
+ const cacheItems = useCallback((items: T[]) => {
+ setCache((prev) => {
+ let next: Map<string, T> | null = null
+ for (const item of items) {
+ if (prev.get(item.id) === item) continue
+ next ??= new Map(prev)
+ next.set(item.id, item)
+ }
+ return next ?? prev
+ })
+ }, [])
+
+ // Hydrate any selected ID not yet in the cache. Recomputed when `value`
+ // or `cache` changes; the query key only contains the missing ids so
+ // re-toggling a known id doesn't refetch.
+ const idsToHydrate = useMemo(() => value.filter((id) => !cache.has(id)), [value, cache])
+
+ const { data: hydrateData } = useQuery({
+ queryKey: [queryKey, 'hydrate', idsToHydrate],
+ queryFn: () => hydrate(idsToHydrate),
+ enabled: idsToHydrate.length > 0,
+ staleTime: Number.POSITIVE_INFINITY,
+ })
+
+ const trimmedInput = inputValue.trim()
+
+ const { data: searchData, isFetching } = useQuery({
+ queryKey: [queryKey, 'search', trimmedInput],
+ queryFn: () => search(trimmedInput),
+ enabled: trimmedInput.length > 0,
+ })
+
+ // Mirror query results into the local id→option cache via an effect, not
+ // inside `queryFn`. When the picker remounts (filter panel reopens) with
+ // `staleTime: Infinity`, TanStack Query returns the cached result without
+ // re-running `queryFn`, so writes inside `queryFn` are skipped. Reading
+ // `data` here re-fires on every remount.
+ useEffect(() => {
+ if (hydrateData?.data?.length) cacheItems(hydrateData.data)
+ }, [hydrateData, cacheItems])
+
+ useEffect(() => {
+ if (searchData?.data?.length) cacheItems(searchData.data)
+ }, [searchData, cacheItems])
+
+ // Dropdown items — search results, then any selected IDs not in
+ // results so the user can deselect chips via the dropdown.
+ const items = useMemo<T[]>(() => {
+ const seen = new Set<string>()
+ const list: T[] = []
+ for (const item of searchData?.data ?? []) {
+ if (seen.has(item.id)) continue
+ seen.add(item.id)
+ list.push(item)
+ }
+ for (const id of value) {
+ if (seen.has(id)) continue
+ const cached = cache.get(id)
+ if (cached) {
+ seen.add(id)
+ list.push(cached)
+ }
+ }
+ return list
+ }, [searchData, value, cache])
+
+ // Stub-fallback so chips show their ID until hydration lands.
+ const selectedOptions = useMemo<T[]>(
+ () => value.map((id) => cache.get(id) ?? ({ id } as T)),
+ [value, cache],
+ )
+
+ return (
+ <HeadlessResourceMultiAutocomplete
+ value={value}
+ onChange={onChange}
+ onResolvedOptionsChange={onResolvedOptionsChange}
+ items={items}
+ selectedOptions={selectedOptions}
+ inputValue={inputValue}
+ onInputChange={setInputValue}
+ getOptionLabel={getOptionLabel}
+ placeholder={placeholder}
+ emptyText={emptyText}
+ isFetching={isFetching}
+ disabled={disabled}
+ />
+ )
+}
diff --git a/packages/dashboard/src/components/spree/resource-table.tsx b/packages/dashboard-core/src/components/resource-table.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/resource-table.tsx
rename to packages/dashboard-core/src/components/resource-table.tsx
index 387a9cfd61..5e02aa55d5 100644
--- a/packages/dashboard/src/components/spree/resource-table.tsx
+++ b/packages/dashboard-core/src/components/resource-table.tsx
@@ -15,16 +15,6 @@ import {
verticalListSortingStrategy,
} from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
-import {
- type ColumnDef,
- type FilterRule,
- filtersToRansack,
- getDefaultColumnKeys,
- getDisplayableColumns,
- getTable,
- type SortOption,
- useAuth,
-} from '@spree/dashboard-core'
import {
Card,
CardContent,
@@ -59,8 +49,18 @@ import {
} from 'react'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { type BulkAction, BulkActionBar } from '@/components/spree/bulk-action-bar'
-import { TableToolbar } from '@/components/spree/table-toolbar'
+import { useAuth } from '../hooks/use-auth'
+import { filtersToRansack } from '../lib/filters-to-ransack'
+import {
+ type ColumnDef,
+ type FilterRule,
+ getDefaultColumnKeys,
+ getDisplayableColumns,
+ getTable,
+ type SortOption,
+} from '../lib/table-registry'
+import { type BulkAction, BulkActionBar } from './bulk-action-bar'
+import { TableToolbar } from './table-toolbar'
// ============================================================================
// Search schema — shared by all resource table routes
diff --git a/packages/dashboard/src/components/spree/settings-sidebar.tsx b/packages/dashboard-core/src/components/settings-sidebar.tsx
similarity index 96%
rename from packages/dashboard/src/components/spree/settings-sidebar.tsx
rename to packages/dashboard-core/src/components/settings-sidebar.tsx
index 779c7e2fea..6e9bcb51f8 100644
--- a/packages/dashboard/src/components/spree/settings-sidebar.tsx
+++ b/packages/dashboard-core/src/components/settings-sidebar.tsx
@@ -1,10 +1,3 @@
-import {
- type Permissions,
- type SettingsNavEntry,
- type SettingsNavSnapshot,
- usePermissions,
- useSettingsNav,
-} from '@spree/dashboard-core'
import {
Badge,
cn,
@@ -17,9 +10,13 @@ import {
import { Link, useParams, useRouterState } from '@tanstack/react-router'
import { PackageIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { NavIcon } from '@/components/spree/nav-main'
-
-import '@/nav/settings'
+import {
+ type SettingsNavEntry,
+ type SettingsNavSnapshot,
+ useSettingsNav,
+} from '../lib/settings-nav-registry'
+import { type Permissions, usePermissions } from '../providers/permission-provider'
+import { NavIcon } from './nav-main'
/**
* Secondary settings sidebar. Always mounted as a sibling to the primary
diff --git a/packages/dashboard/src/components/spree/store-date-picker.tsx b/packages/dashboard-core/src/components/store-date-picker.tsx
similarity index 92%
rename from packages/dashboard/src/components/spree/store-date-picker.tsx
rename to packages/dashboard-core/src/components/store-date-picker.tsx
index 450e27b376..2b77e4064f 100644
--- a/packages/dashboard/src/components/spree/store-date-picker.tsx
+++ b/packages/dashboard-core/src/components/store-date-picker.tsx
@@ -1,5 +1,5 @@
-import { useStore } from '@spree/dashboard-core'
import { DatePicker, type DatePickerProps } from '@spree/dashboard-ui'
+import { useStore } from '../providers/store-provider'
/**
* Drop-in `<DatePicker>` that pulls the timezone from `<StoreProvider>` so
diff --git a/packages/dashboard/src/components/spree/store-switcher.tsx b/packages/dashboard-core/src/components/store-switcher.tsx
similarity index 97%
rename from packages/dashboard/src/components/spree/store-switcher.tsx
rename to packages/dashboard-core/src/components/store-switcher.tsx
index 2ec48a3384..16a730a63a 100644
--- a/packages/dashboard/src/components/spree/store-switcher.tsx
+++ b/packages/dashboard-core/src/components/store-switcher.tsx
@@ -1,4 +1,3 @@
-import { useStore } from '@spree/dashboard-core'
import {
Avatar,
AvatarFallback,
@@ -13,6 +12,7 @@ import {
useSidebar,
} from '@spree/dashboard-ui'
import { ChevronsUpDownIcon, ExternalLinkIcon } from 'lucide-react'
+import { useStore } from '../providers/store-provider'
export function StoreSwitcher() {
const { isMobile, state } = useSidebar()
diff --git a/packages/dashboard/src/components/spree/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
similarity index 98%
rename from packages/dashboard/src/components/spree/table-toolbar.tsx
rename to packages/dashboard-core/src/components/table-toolbar.tsx
index edd6587a97..14c4cfab3e 100644
--- a/packages/dashboard/src/components/spree/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -1,11 +1,3 @@
-import {
- type ColumnDef,
- type FilterRule,
- parseFilterIds,
- type SortOption,
- useStore,
- useTranslation,
-} from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -42,9 +34,17 @@ import {
XIcon,
} from 'lucide-react'
import { useCallback, useMemo, useRef, useState } from 'react'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { StoreDatePicker } from '@/components/spree/store-date-picker'
-import { TagCombobox } from '@/components/spree/tag-combobox'
+import { useTranslation } from 'react-i18next'
+import {
+ type ColumnDef,
+ type FilterRule,
+ parseFilterIds,
+ type SortOption,
+} from '../lib/table-registry'
+import { useStore } from '../providers/store-provider'
+import { ResourceMultiAutocomplete } from './resource-multi-autocomplete'
+import { StoreDatePicker } from './store-date-picker'
+import { TagCombobox } from './tag-combobox'
interface TableToolbarProps {
/** Displayable columns (for column selector and table headers) */
diff --git a/packages/dashboard/src/components/spree/tag-combobox.tsx b/packages/dashboard-core/src/components/tag-combobox.tsx
similarity index 95%
rename from packages/dashboard/src/components/spree/tag-combobox.tsx
rename to packages/dashboard-core/src/components/tag-combobox.tsx
index 8bb3505cbe..b4dd5fd4cb 100644
--- a/packages/dashboard/src/components/spree/tag-combobox.tsx
+++ b/packages/dashboard-core/src/components/tag-combobox.tsx
@@ -1,5 +1,3 @@
-import type { TaggableType } from '@spree/dashboard-core'
-import { adminClient, useAuth } from '@spree/dashboard-core'
import {
Combobox,
ComboboxChip,
@@ -14,6 +12,9 @@ import {
} from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
import { useMemo, useState } from 'react'
+import { adminClient } from '../client'
+import { useAuth } from '../hooks/use-auth'
+import type { TaggableType } from '../lib/table-registry'
export type { TaggableType }
diff --git a/packages/dashboard/src/components/spree/top-bar.tsx b/packages/dashboard-core/src/components/top-bar.tsx
similarity index 95%
rename from packages/dashboard/src/components/spree/top-bar.tsx
rename to packages/dashboard-core/src/components/top-bar.tsx
index 56641911da..777eb386d6 100644
--- a/packages/dashboard/src/components/spree/top-bar.tsx
+++ b/packages/dashboard-core/src/components/top-bar.tsx
@@ -1,4 +1,3 @@
-import { getInitials, useAuth, useCommandPalette, useStore } from '@spree/dashboard-core'
import {
Avatar,
AvatarFallback,
@@ -9,6 +8,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
SidebarTrigger,
+ ThemeMenuItems,
} from '@spree/dashboard-ui'
import {
BookOpenIcon,
@@ -20,7 +20,10 @@ import {
UserIcon,
} from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { ThemeMenuItems } from '@/components/spree/theme-toggle'
+import { useAuth } from '../hooks/use-auth'
+import { useCommandPalette } from '../hooks/use-command-palette'
+import { getInitials } from '../lib/formatters'
+import { useStore } from '../providers/store-provider'
const IS_MAC = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform ?? '')
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index dac28b9762..0316b8a5f7 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -14,8 +14,29 @@
// Admin SDK client (Vite-aware singleton; reads VITE_SPREE_API_URL at build)
// ---------------------------------------------------------------------------
export { adminClient } from './client'
+export * from './components/address-form-dialog'
+export * from './components/app-sidebar'
+export * from './components/bulk-action-bar'
+export * from './components/can'
+export * from './components/country-combobox'
+export * from './components/country-state-fields'
+export * from './components/currency-select'
+export * from './components/export-button'
+export * from './components/locale-select'
+export * from './components/nav-main'
export * from './components/page-header'
+export * from './components/page-tabs'
+export * from './components/preferences-form'
+export * from './components/resource-combobox'
+export * from './components/resource-multi-autocomplete'
+export * from './components/resource-table'
+export * from './components/settings-sidebar'
export * from './components/slot'
+export * from './components/store-date-picker'
+export * from './components/store-switcher'
+export * from './components/table-toolbar'
+export * from './components/tag-combobox'
+export * from './components/top-bar'
// ---------------------------------------------------------------------------
// Infra hooks
// ---------------------------------------------------------------------------
diff --git a/packages/dashboard-ui/src/index.ts b/packages/dashboard-ui/src/index.ts
index 4496b5eb96..f65bee4d64 100644
--- a/packages/dashboard-ui/src/index.ts
+++ b/packages/dashboard-ui/src/index.ts
@@ -40,7 +40,9 @@ export * from './spree/form-actions'
export * from './spree/metadata/metadata-card'
export * from './spree/relative-time'
+export * from './spree/resource-combobox'
export * from './spree/resource-layout'
+export * from './spree/resource-multi-autocomplete'
export * from './spree/resource-name-cell'
export * from './spree/route-error-boundary'
export * from './spree/row-actions'
@@ -49,6 +51,7 @@ export * from './spree/secret-input'
export * from './spree/storefront-visible-switch'
export * from './spree/tag-list'
export * from './spree/theme-provider'
+export * from './spree/theme-toggle'
// ---------------------------------------------------------------------------
// UI primitives (shadcn) — see ./ui/*
// ---------------------------------------------------------------------------
diff --git a/packages/dashboard-ui/src/spree/resource-combobox.tsx b/packages/dashboard-ui/src/spree/resource-combobox.tsx
new file mode 100644
index 0000000000..a39a0db535
--- /dev/null
+++ b/packages/dashboard-ui/src/spree/resource-combobox.tsx
@@ -0,0 +1,108 @@
+import type { ReactNode } from 'react'
+import {
+ Combobox,
+ ComboboxContent,
+ ComboboxEmpty,
+ ComboboxInput,
+ ComboboxItem,
+ ComboboxList,
+} from '../ui/combobox'
+
+/**
+ * Anything we can pick. Records must have a stable string `id` so they round-
+ * trip through the `value` prop (the form/parent state keeps the ID, not the
+ * full record).
+ */
+export type ComboboxOption = { id: string }
+
+export interface ResourceComboboxProps<T extends ComboboxOption> {
+ /** Currently selected ID. */
+ value: string | undefined | null
+ /** Fires with the picked record's ID, or `undefined` when cleared. */
+ onChange: (id: string | undefined, record: T | null) => void
+
+ /**
+ * Records available to render in the dropdown. The caller owns fetching +
+ * caching; pass whatever subset of options should currently be visible.
+ * Must include the record matching `value` so the trigger can render its
+ * label, otherwise the trigger falls back to the raw ID.
+ */
+ items: T[]
+
+ /**
+ * Called as the user types — receives the raw input string. The caller
+ * typically debounces and queries with it. The combobox does NOT manage
+ * any internal input/query state.
+ */
+ onInputChange?: (next: string) => void
+
+ /** Renders the trigger + item label. */
+ getOptionLabel: (option: T) => string
+
+ /**
+ * Optional richer item renderer for the dropdown. Falls back to
+ * `getOptionLabel` when omitted.
+ */
+ renderOption?: (option: T) => ReactNode
+
+ /** Placeholder for the search input. */
+ placeholder?: string
+ /** Empty state text shown in the dropdown when items is empty. */
+ emptyText?: string
+ disabled?: boolean
+}
+
+/**
+ * Headless search-driven single-select picker. Doesn't fetch anything itself —
+ * pass `items` plus an `onInputChange` callback and wire the data layer
+ * outside (TanStack Query, SWR, manual state, whatever).
+ *
+ * `@spree/dashboard-core` ships a convenience `<ResourceCombobox>` (same name,
+ * same props shape minus `items`/`onInputChange`, plus a `search`/`hydrate`/
+ * `queryKey` interface) that wraps this one with TanStack Query — that's what
+ * most callsites use. Reach for the pure version here when the data flow
+ * doesn't match the wrapper's shape.
+ */
+export function ResourceCombobox<T extends ComboboxOption>({
+ value,
+ onChange,
+ items,
+ onInputChange,
+ getOptionLabel,
+ renderOption,
+ placeholder,
+ emptyText,
+ disabled,
+}: ResourceComboboxProps<T>) {
+ const selected = items.find((r) => r.id === value) ?? null
+
+ return (
+ <Combobox
+ items={items}
+ value={selected}
+ onValueChange={(record: T | null) => onChange(record?.id, record)}
+ onInputValueChange={onInputChange}
+ itemToStringLabel={(record: T | null) => (record ? getOptionLabel(record) : '')}
+ itemToStringValue={(record: T | null) => record?.id ?? ''}
+ // Filtering is server-side: the caller's `onInputChange` already narrows
+ // the items list. Disable Base UI's built-in client filter so it doesn't
+ // hide rows whose label doesn't substring-match the typed query.
+ filter={null}
+ // Mirror multi-autocomplete: `disabled` on the root also disables the
+ // dropdown trigger + selection mechanics, not just the input.
+ disabled={disabled}
+ >
+ <ComboboxInput placeholder={placeholder} disabled={disabled} showClear />
+ <ComboboxContent>
+ <ComboboxEmpty>{emptyText}</ComboboxEmpty>
+ <ComboboxList>
+ {(record: T) => (
+ <ComboboxItem key={record.id} value={record}>
+ {renderOption ? renderOption(record) : getOptionLabel(record)}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )
+}
diff --git a/packages/dashboard-ui/src/spree/resource-multi-autocomplete.tsx b/packages/dashboard-ui/src/spree/resource-multi-autocomplete.tsx
new file mode 100644
index 0000000000..039f10b7bc
--- /dev/null
+++ b/packages/dashboard-ui/src/spree/resource-multi-autocomplete.tsx
@@ -0,0 +1,175 @@
+import { useCallback } from 'react'
+import {
+ Combobox,
+ ComboboxChip,
+ ComboboxChips,
+ ComboboxChipsInput,
+ ComboboxContent,
+ ComboboxEmpty,
+ ComboboxItem,
+ ComboboxList,
+ ComboboxValue,
+ useComboboxAnchor,
+} from '../ui/combobox'
+
+/**
+ * Anything we can pick. Items must have a stable string `id`. The label
+ * (and any other rendering) is up to the caller via `getOptionLabel`.
+ */
+export type AutocompleteOption = { id: string }
+
+/**
+ * Safely resolve an option's label. The caller's `getOptionLabel` typically
+ * reads hydrated fields (e.g. `c.email`), which throw or return blank when
+ * called against a stub `{ id }`. Detect that case (single own key, the `id`)
+ * and fall back to the raw id so chips for un-hydrated selections stay
+ * readable until hydration lands.
+ */
+function labelOrFallback<T extends AutocompleteOption>(
+ option: T,
+ getOptionLabel: (option: T) => string,
+): string {
+ const isStub = Object.keys(option).length === 1 && 'id' in option
+ if (isStub) return option.id
+ try {
+ return getOptionLabel(option) || option.id
+ } catch {
+ return option.id
+ }
+}
+
+export interface ResourceMultiAutocompleteProps<T extends AutocompleteOption> {
+ /** Currently selected IDs (controlled). */
+ value: string[]
+ onChange: (next: string[]) => void
+ /**
+ * Optional companion callback fired alongside `onChange` carrying the
+ * resolved option records for the selected IDs. Use this to stamp display
+ * labels on the parent state without re-fetching. IDs whose record isn't
+ * yet hydrated will be absent from this list.
+ */
+ onResolvedOptionsChange?: (options: T[]) => void
+
+ /**
+ * Records available to render in the dropdown — typically search results
+ * for the current query plus any selected records pulled from a cache.
+ * The caller owns fetching, caching, and merging.
+ */
+ items: T[]
+
+ /**
+ * Records matching `value` that we already have details for. Used to
+ * render chips with labels (and dispatch onResolvedOptionsChange with
+ * the right records). IDs missing from `selectedOptions` render as
+ * stubs (just the raw ID) until the caller hydrates them.
+ */
+ selectedOptions: T[]
+
+ /** Current text in the search input. */
+ inputValue: string
+ /** Called when the user types or selects (selection clears the input). */
+ onInputChange: (next: string) => void
+
+ /** Renders the chip and dropdown row label. */
+ getOptionLabel: (option: T) => string
+
+ /** Placeholder for the search input. */
+ placeholder?: string
+ /** Empty state text shown in the dropdown when items is empty. */
+ emptyText?: string
+ /** Override emptyText when the consumer's search is in-flight. */
+ fetchingText?: string
+ /** True while the consumer's data source is loading. */
+ isFetching?: boolean
+ /** Disable the whole picker. */
+ disabled?: boolean
+}
+
+/**
+ * Headless search-driven multi-select picker. Doesn't fetch anything — the
+ * caller passes `items` (visible options) + `selectedOptions` (records
+ * matching `value`) + `inputValue`/`onInputChange` for the typed query.
+ *
+ * `@spree/dashboard-core` ships a convenience `<ResourceMultiAutocomplete>`
+ * that wraps this with TanStack Query — that's what most callsites use.
+ * Reach for the pure version here when the data flow doesn't match the
+ * wrapper's shape.
+ */
+export function ResourceMultiAutocomplete<T extends AutocompleteOption>({
+ value,
+ onChange,
+ onResolvedOptionsChange,
+ items,
+ selectedOptions,
+ inputValue,
+ onInputChange,
+ getOptionLabel,
+ placeholder = 'Search…',
+ emptyText = 'No results',
+ fetchingText = 'Searching…',
+ isFetching,
+ disabled,
+}: ResourceMultiAutocompleteProps<T>) {
+ const anchorRef = useComboboxAnchor()
+
+ const handleChange = useCallback(
+ (next: T[]) => {
+ onChange(next.map((o) => o.id))
+ // Filter out stub `{id}` placeholders for un-hydrated IDs — callers
+ // typically stamp these on parent state and stubs would overwrite
+ // earlier real records.
+ onResolvedOptionsChange?.(next.filter((o) => Object.keys(o).length > 1))
+ onInputChange('')
+ },
+ [onChange, onResolvedOptionsChange, onInputChange],
+ )
+
+ void value // silence unused (value is consumed via selectedOptions)
+
+ return (
+ <Combobox
+ multiple
+ items={items}
+ value={selectedOptions}
+ onValueChange={handleChange as never}
+ itemToStringLabel={(o) => getOptionLabel(o as T)}
+ itemToStringValue={(o) => (o as T).id}
+ isItemEqualToValue={(a, b) => (a as T).id === (b as T).id}
+ // Filtering is server-side: the caller's data source already narrows
+ // the items list. Disable Base UI's client filter so it doesn't hide
+ // rows whose label doesn't substring-match the typed query (the typed
+ // query is often shorter than the actual label — partial email, etc.).
+ filter={null}
+ disabled={disabled}
+ >
+ <ComboboxChips ref={anchorRef}>
+ <ComboboxValue>
+ {(selected: T[]) =>
+ selected.map((opt) => (
+ // Stubs (un-hydrated IDs) come through with only `{ id }`. Fall
+ // back to the raw ID so the chip stays readable instead of going
+ // blank while hydration is in flight; `getOptionLabel` can also
+ // throw on stubs whose resolver assumes hydrated fields.
+ <ComboboxChip key={opt.id}>{labelOrFallback(opt, getOptionLabel)}</ComboboxChip>
+ ))
+ }
+ </ComboboxValue>
+ <ComboboxChipsInput
+ placeholder={placeholder}
+ value={inputValue}
+ onChange={(e) => onInputChange((e.target as HTMLInputElement).value)}
+ />
+ </ComboboxChips>
+ <ComboboxContent anchor={anchorRef}>
+ <ComboboxEmpty>{isFetching ? fetchingText : emptyText}</ComboboxEmpty>
+ <ComboboxList>
+ {(option: T) => (
+ <ComboboxItem key={option.id} value={option}>
+ {getOptionLabel(option)}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )
+}
diff --git a/packages/dashboard/src/components/spree/theme-toggle.tsx b/packages/dashboard-ui/src/spree/theme-toggle.tsx
similarity index 86%
rename from packages/dashboard/src/components/spree/theme-toggle.tsx
rename to packages/dashboard-ui/src/spree/theme-toggle.tsx
index 156fe5b284..dd9929e2af 100644
--- a/packages/dashboard/src/components/spree/theme-toggle.tsx
+++ b/packages/dashboard-ui/src/spree/theme-toggle.tsx
@@ -1,10 +1,6 @@
-import {
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- useTheme,
-} from '@spree/dashboard-ui'
import { CheckIcon, MonitorIcon, MoonIcon, SunIcon } from 'lucide-react'
+import { DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from '../ui/dropdown-menu'
+import { useTheme } from './theme-provider'
/**
* Theme picker rendered inside the user dropdown menu. Three-way (Light / Dark
diff --git a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
index ca4785e55e..5c92424d20 100644
--- a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
+++ b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
@@ -1,5 +1,5 @@
import type { PaymentMethod, PreferenceField } from '@spree/admin-sdk'
-import { Slot, useSlotEntries } from '@spree/dashboard-core'
+import { PreferencesForm, Slot, useSlotEntries } from '@spree/dashboard-core'
import {
Field,
FieldError,
@@ -17,7 +17,6 @@ import {
} from '@spree/dashboard-ui'
import { Controller, type UseFormReturn } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { PreferencesForm } from '@/components/spree/preferences-form'
import {
type PaymentMethodEditorContext,
type PaymentMethodFormMode,
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 182b51ac17..3757d096dd 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
@@ -1,6 +1,13 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { PriceList, PriceRule, ResourceTypeDefinition } from '@spree/admin-sdk'
-import { adminClient, PageHeader, useStore } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ PageHeader,
+ PreferencesForm,
+ ResourceMultiAutocomplete,
+ useStore,
+} from '@spree/dashboard-core'
import { useConfirm } from '@spree/dashboard-ui'
import { parseISO } from 'date-fns'
import { formatInTimeZone } from 'date-fns-tz'
@@ -17,15 +24,12 @@ import { useEffect, useState } from 'react'
import { Controller, type UseFormReturn, useFieldArray, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { BulkPriceEditorDialog } from '@/components/spree/bulk-price-editor/bulk-price-editor-dialog'
-import { Can } from '@/components/spree/can'
-import { PreferencesForm } from '@/components/spree/preferences-form'
import { PriceListStatusBadge } from '@/components/spree/price-list-editors/status-badge'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
// Side-effect import — registers per-rule editors (customer, customer
// group, …) into the slot registry. Must run before any RuleEditSheet
// mounts.
import '@/components/spree/price-list-editors/register'
-import { mapSpreeErrorsToForm, Slot, Subject } from '@spree/dashboard-core'
+import { mapSpreeErrorsToForm, Slot, StoreDatePicker, Subject } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -55,7 +59,6 @@ import {
ruleFormSlot,
} from '@/components/spree/price-list-editors/types'
import { EditorShell } from '@/components/spree/promotion-editors/editor-shell'
-import { StoreDatePicker } from '@/components/spree/store-date-picker'
import {
useActivatePriceList,
useDeactivatePriceList,
diff --git a/packages/dashboard/src/components/spree/price-list-editors/rule-customer-group.tsx b/packages/dashboard/src/components/spree/price-list-editors/rule-customer-group.tsx
index 0e07ac04fb..d413899eed 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/rule-customer-group.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/rule-customer-group.tsx
@@ -1,9 +1,9 @@
import type { CustomerGroup } from '@spree/admin-sdk'
+import { ResourceMultiAutocomplete } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { EditorShell } from '@/components/spree/promotion-editors/editor-shell'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { customerGroupAutocompleteProps } from '@/hooks/use-customer-groups'
import type { PriceRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/price-list-editors/rule-customer.tsx b/packages/dashboard/src/components/spree/price-list-editors/rule-customer.tsx
index 1733a78973..cc7c348046 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/rule-customer.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/rule-customer.tsx
@@ -1,9 +1,9 @@
import type { Customer } from '@spree/admin-sdk'
+import { ResourceMultiAutocomplete } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { EditorShell } from '@/components/spree/promotion-editors/editor-shell'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { customerAutocompleteProps } from '@/hooks/use-customers'
import type { PriceRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx b/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx
index 9b1b3a3975..b2257abf25 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx
@@ -1,5 +1,5 @@
import type { PromotionActionCalculator } from '@spree/admin-sdk'
-import { adminClient } from '@spree/dashboard-core'
+import { adminClient, PreferencesForm } from '@spree/dashboard-core'
import {
Field,
FieldGroup,
@@ -12,7 +12,6 @@ import {
} from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
import { useEffect, useMemo, useState } from 'react'
-import { PreferencesForm } from '@/components/spree/preferences-form'
import { EditorShell } from './editor-shell'
import type { PromotionActionEditorContext } from './types'
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 6edbd939a3..55a5c7446c 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -8,16 +8,13 @@ import type {
PromotionRuleDraft,
ResourceTypeDefinition,
} from '@spree/admin-sdk'
-import { PageHeader } from '@spree/dashboard-core'
+import { Can, PageHeader, PreferencesForm, StoreDatePicker } from '@spree/dashboard-core'
import { formatCalculatorSummary, useConfirm } from '@spree/dashboard-ui'
import { DownloadIcon, PlusIcon, SparklesIcon, TrashIcon } from 'lucide-react'
import { useEffect, useState } from 'react'
import { Controller, type UseFormReturn, useFieldArray, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { Can } from '@/components/spree/can'
-import { PreferencesForm } from '@/components/spree/preferences-form'
import { EditorShell } from '@/components/spree/promotion-editors/editor-shell'
-import { StoreDatePicker } from '@/components/spree/store-date-picker'
import '@/components/spree/promotion-editors/register'
import { mapSpreeErrorsToForm, Slot, Subject, useExport, useStore } from '@spree/dashboard-core'
import {
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx
index 9a6275302b..5fda7130df 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx
@@ -1,8 +1,7 @@
import type { Category } from '@spree/admin-sdk'
-import { adminClient, useTranslation } from '@spree/dashboard-core'
+import { adminClient, ResourceMultiAutocomplete, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { EditorShell } from './editor-shell'
import { MatchPolicyPicker } from './match-policy-picker'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
index a6b9ea3fce..ddbf523839 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
@@ -1,8 +1,7 @@
import type { Country } from '@spree/admin-sdk'
-import { useCountries, useTranslation } from '@spree/dashboard-core'
+import { CountryMultiCombobox, useCountries, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { CountryMultiCombobox } from '@/components/spree/country-combobox'
import { EditorShell } from './editor-shell'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx
index a972e23621..dd8db4bf8f 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx
@@ -1,8 +1,7 @@
import type { CustomerGroup } from '@spree/admin-sdk'
-import { useTranslation } from '@spree/dashboard-core'
+import { ResourceMultiAutocomplete, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useState } from 'react'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { customerGroupAutocompleteProps } from '@/hooks/use-customer-groups'
import { EditorShell } from './editor-shell'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx
index 87f565fba9..1aaba174a0 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx
@@ -1,8 +1,7 @@
import type { Product } from '@spree/admin-sdk'
-import { adminClient, useTranslation } from '@spree/dashboard-core'
+import { adminClient, ResourceMultiAutocomplete, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { EditorShell } from './editor-shell'
import { MatchPolicyPicker } from './match-policy-picker'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx
index 8a6b806875..352978fb13 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx
@@ -1,8 +1,7 @@
import type { Customer } from '@spree/admin-sdk'
-import { adminClient, useTranslation } from '@spree/dashboard-core'
+import { adminClient, ResourceMultiAutocomplete, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useState } from 'react'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { EditorShell } from './editor-shell'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/types.ts b/packages/dashboard/src/components/spree/promotion-editors/types.ts
index 33c626ef22..1c7e72bb88 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/types.ts
+++ b/packages/dashboard/src/components/spree/promotion-editors/types.ts
@@ -12,7 +12,7 @@ import type {
PromotionRule,
PromotionRuleDraft,
} from '@spree/admin-sdk'
-import { defaultPreferences } from '@/components/spree/preferences-form'
+import { defaultPreferences } from '@spree/dashboard-core'
/**
* Form-state row for a promotion rule. Carries everything the editor
diff --git a/packages/dashboard/src/components/spree/resource-combobox.tsx b/packages/dashboard/src/components/spree/resource-combobox.tsx
deleted file mode 100644
index bba3eb8517..0000000000
--- a/packages/dashboard/src/components/spree/resource-combobox.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-import {
- Combobox,
- ComboboxContent,
- ComboboxEmpty,
- ComboboxInput,
- ComboboxItem,
- ComboboxList,
-} from '@spree/dashboard-ui'
-import { useQuery } from '@tanstack/react-query'
-import { type ReactNode, useDeferredValue, useMemo, useState } from 'react'
-import { useTranslation } from 'react-i18next'
-
-/**
- * Anything we can pick. Records must have a stable string `id` so they round-
- * trip through the `value` prop (the form/parent state keeps the ID, not the
- * full record).
- */
-export type ComboboxOption = { id: string }
-
-export interface ResourceComboboxProps<T extends ComboboxOption> {
- /** Currently selected ID. */
- value: string | undefined | null
- /** Fires with the picked record's ID, or `undefined` when cleared. */
- onChange: (id: string | undefined, record: T | null) => void
-
- /**
- * Server-side search. Called as the user types (with React's
- * `useDeferredValue` to avoid a request per keystroke). Receives the
- * trimmed query string — returning `{ data: [] }` for empty queries is a
- * fine default, as is showing "recent records".
- */
- search: (query: string) => Promise<{ data: T[] }>
-
- /**
- * Hydrate the currently-selected ID into a record so the trigger can show
- * its label (e.g. on first render after deep-link reload). Called once
- * per `value` change. Should return the record listed by ID.
- */
- hydrate: (ids: string[]) => Promise<{ data: T[] }>
-
- /** Stable cache prefix — e.g. `'gift-card-customer-picker'`. */
- queryKey: string
-
- /** Renders the trigger + item label. */
- getOptionLabel: (option: T) => string
-
- /**
- * Optional richer item renderer for the dropdown. Falls back to
- * `getOptionLabel` when omitted. Use this to show a secondary line
- * (e.g. the customer's full name under their email).
- */
- renderOption?: (option: T) => ReactNode
-
- placeholder?: string
- emptyText?: string
- disabled?: boolean
-}
-
-/**
- * Search-driven single-select for a remote resource (customers, variants,
- * stores, …). Mirrors `<ResourceMultiAutocomplete>`'s data contract — pass
- * `search` + `hydrate` + `getOptionLabel` callbacks — but renders the
- * shadcn `<Combobox>` instead of the chips multi-picker, so the trigger
- * reads like a single-value input.
- *
- * Why this exists: hand-rolled `<Input>` + custom dropdown patterns (see
- * pre-refactor `routes/.../orders/new.tsx`) duplicate keyboard/a11y/focus
- * code per call site. Centralising on this combobox keeps every picker
- * accessible and visually consistent.
- */
-export function ResourceCombobox<T extends ComboboxOption>({
- value,
- onChange,
- search,
- hydrate,
- queryKey,
- getOptionLabel,
- renderOption,
- placeholder,
- emptyText,
- disabled,
-}: ResourceComboboxProps<T>) {
- const { t } = useTranslation()
- const placeholderLabel = placeholder ?? t('admin.common.search_placeholder')
- const emptyLabel = emptyText ?? t('admin.common.no_results')
- // Base UI's Combobox owns the input element so it can write the selected
- // option's label into it on pick. We observe the typed query via
- // `onInputValueChange` on the Root rather than controlling
- // `<ComboboxInput value>` directly — controlling the input blocks Base UI
- // from updating it on selection.
- const [input, setInput] = useState('')
- // Defer the search query so a fast typist doesn't fire one request per
- // keystroke — React batches the search to the next idle paint.
- const deferredInput = useDeferredValue(input)
- const trimmedQuery = deferredInput.trim()
-
- const { data: searchData } = useQuery({
- queryKey: [queryKey, 'search', trimmedQuery],
- queryFn: () => search(trimmedQuery),
- staleTime: 30_000,
- })
-
- // Hydrate the currently selected ID into a record so the trigger shows
- // its label after a deep-link reload (before the user types anything).
- // Skipped when the search results already include the ID.
- const searchHasValue = !!(value && searchData?.data.some((r) => r.id === value))
- const { data: hydratedData } = useQuery({
- queryKey: [queryKey, 'hydrate', value],
- queryFn: () => hydrate([value as string]),
- enabled: !!value && !searchHasValue,
- staleTime: 60_000,
- })
-
- // Merge: prefer the (possibly fresher) search result if both have the ID.
- const items = useMemo(() => {
- const map = new Map<string, T>()
- for (const r of hydratedData?.data ?? []) map.set(r.id, r)
- for (const r of searchData?.data ?? []) map.set(r.id, r)
- return Array.from(map.values())
- }, [searchData, hydratedData])
-
- const selected = useMemo<T | null>(
- () => items.find((r) => r.id === value) ?? null,
- [items, value],
- )
-
- return (
- <Combobox
- items={items}
- value={selected}
- onValueChange={(record: T | null) => onChange(record?.id, record)}
- onInputValueChange={(next: string) => setInput(next)}
- itemToStringLabel={(record: T | null) => (record ? getOptionLabel(record) : '')}
- itemToStringValue={(record: T | null) => record?.id ?? ''}
- // Filtering is server-side: `search(query)` already narrows the
- // result set. Disable Base UI's built-in client filter so it doesn't
- // hide rows whose label doesn't substring-match the typed query.
- filter={null}
- >
- <ComboboxInput placeholder={placeholderLabel} disabled={disabled} showClear />
- <ComboboxContent>
- <ComboboxEmpty>{emptyLabel}</ComboboxEmpty>
- <ComboboxList>
- {(record: T) => (
- <ComboboxItem key={record.id} value={record}>
- {renderOption ? renderOption(record) : getOptionLabel(record)}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- )
-}
diff --git a/packages/dashboard/src/components/spree/resource-multi-autocomplete.tsx b/packages/dashboard/src/components/spree/resource-multi-autocomplete.tsx
deleted file mode 100644
index 1e3a5e8ed1..0000000000
--- a/packages/dashboard/src/components/spree/resource-multi-autocomplete.tsx
+++ /dev/null
@@ -1,231 +0,0 @@
-import {
- Combobox,
- ComboboxChip,
- ComboboxChips,
- ComboboxChipsInput,
- ComboboxContent,
- ComboboxEmpty,
- ComboboxItem,
- ComboboxList,
- ComboboxValue,
- useComboboxAnchor,
-} from '@spree/dashboard-ui'
-import { useQuery } from '@tanstack/react-query'
-import { useCallback, useEffect, useMemo, useState } from 'react'
-
-/**
- * Anything we can pick. Items must have a stable string `id`. The label
- * (and any other rendering) is up to the caller via `getOptionLabel`.
- */
-export type AutocompleteOption = { id: string }
-
-export interface ResourceMultiAutocompleteProps<T extends AutocompleteOption> {
- /** Currently selected IDs (controlled). */
- value: string[]
- onChange: (next: string[]) => void
- /**
- * Optional companion callback fired alongside `onChange` carrying the
- * resolved option records (search results + cache lookups) for the
- * selected IDs. Use this to stamp display labels on the parent state
- * without re-fetching. IDs whose record isn't yet hydrated will be
- * absent from this list.
- *
- * Split from `onChange` so the picker's generic `T` can still be
- * inferred from `search`/`hydrate`/`getOptionLabel` without
- * contravariance from the callback parameter widening it.
- */
- onResolvedOptionsChange?: (options: T[]) => void
-
- /**
- * Server-side search. Receives the trimmed query string. Should return
- * `{ data: T[] }`. Called any time the user types (with debouncing
- * provided by the caller's queryClient if needed). Returning an empty
- * array on an empty query is a fine default — pass `enabled` via
- * `searchEnabled` if you want to gate it.
- */
- search: (query: string) => Promise<{ data: T[] }>
-
- /**
- * Hydration query for the IDs in `value` that we don't yet have
- * details for. Called once per `idsToHydrate` change. Should return
- * the listed records, in any order — they're keyed by `id`.
- *
- * If your endpoint can't bulk-fetch by ID, return what you can —
- * unmatched IDs render with their raw ID until the user picks them
- * from a search.
- */
- hydrate: (ids: string[]) => Promise<{ data: T[] }>
-
- /** Stable cache key for this picker instance — e.g. `'rule-products'`. */
- queryKey: string
-
- /** Renders the chip and dropdown row label. */
- getOptionLabel: (option: T) => string
-
- /** Placeholder for the search input. */
- placeholder?: string
-
- /** Empty state text shown in the dropdown when search returns nothing. */
- emptyText?: string
-
- /** Disable the whole picker. */
- disabled?: boolean
-}
-
-/**
- * Search-driven multi-select for a remote resource (products, taxons,
- * users, etc.). Mirrors the `<TagCombobox>` UX but with a server-driven
- * option list and lazy hydration of currently-selected IDs.
- *
- * Why this exists: every promotion rule that picks records (`Product`,
- * `Taxon`, `User`, `CustomerGroup`, `Country`, …) needs the same shape
- * — search + chips + hydration on first render. Centralising it here
- * keeps each rule editor down to ~30 lines of glue.
- */
-export function ResourceMultiAutocomplete<T extends AutocompleteOption>({
- value,
- onChange,
- onResolvedOptionsChange,
- search,
- hydrate,
- queryKey,
- getOptionLabel,
- placeholder = 'Search…',
- emptyText = 'No results',
- disabled,
-}: ResourceMultiAutocompleteProps<T>) {
- const anchorRef = useComboboxAnchor()
- const [inputValue, setInputValue] = useState('')
-
- // id → option cache. Survives across search queries so chips don't
- // flicker when `value` changes. Stored as a `Map` in state so we
- // never miss a render — TanStack Query's settle re-renders the
- // component, which re-derives `selectedOptions`/`items` from this.
- const [cache, setCache] = useState<Map<string, T>>(() => new Map())
-
- const cacheItems = useCallback((items: T[]) => {
- setCache((prev) => {
- let next: Map<string, T> | null = null
- for (const item of items) {
- if (prev.get(item.id) === item) continue
- next ??= new Map(prev)
- next.set(item.id, item)
- }
- return next ?? prev
- })
- }, [])
-
- // Hydrate any selected ID not yet in the cache. Recomputed when
- // `value` or `cache` changes; the query key only contains the
- // missing ids so re-toggling a known id doesn't refetch.
- const idsToHydrate = useMemo(() => value.filter((id) => !cache.has(id)), [value, cache])
-
- const { data: hydrateData } = useQuery({
- queryKey: [queryKey, 'hydrate', idsToHydrate],
- queryFn: () => hydrate(idsToHydrate),
- enabled: idsToHydrate.length > 0,
- staleTime: Number.POSITIVE_INFINITY,
- })
-
- const trimmedInput = inputValue.trim()
-
- const { data: searchData, isFetching } = useQuery({
- queryKey: [queryKey, 'search', trimmedInput],
- queryFn: () => search(trimmedInput),
- enabled: trimmedInput.length > 0,
- })
-
- // Mirror query results into the local id→option cache via an effect, not
- // inside `queryFn`. When the picker remounts (filter panel reopens) with
- // `staleTime: Infinity`, TanStack Query returns the cached result without
- // re-running `queryFn`, so writes inside `queryFn` are skipped. Reading
- // `data` here re-fires on every remount.
- useEffect(() => {
- if (hydrateData?.data?.length) cacheItems(hydrateData.data)
- }, [hydrateData, cacheItems])
-
- useEffect(() => {
- if (searchData?.data?.length) cacheItems(searchData.data)
- }, [searchData, cacheItems])
-
- // Dropdown items — search results, then any selected IDs not in
- // results so the user can deselect chips via the dropdown.
- const items = useMemo<T[]>(() => {
- const seen = new Set<string>()
- const list: T[] = []
- for (const item of searchData?.data ?? []) {
- if (seen.has(item.id)) continue
- seen.add(item.id)
- list.push(item)
- }
- for (const id of value) {
- if (seen.has(id)) continue
- const cached = cache.get(id)
- if (cached) {
- seen.add(id)
- list.push(cached)
- }
- }
- return list
- }, [searchData, value, cache])
-
- // Stub-fallback so chips show their ID until hydration lands.
- const selectedOptions = useMemo<T[]>(
- () => value.map((id) => cache.get(id) ?? ({ id } as T)),
- [value, cache],
- )
-
- const handleChange = useCallback(
- (next: T[]) => {
- onChange(next.map((o) => o.id))
- // Filter out stub `{id}` placeholders for un-hydrated IDs — callers
- // typically stamp these on parent state and stubs would overwrite
- // earlier real records.
- onResolvedOptionsChange?.(next.filter((o) => Object.keys(o).length > 1))
- setInputValue('')
- },
- [onChange, onResolvedOptionsChange],
- )
-
- return (
- <Combobox
- multiple
- items={items}
- value={selectedOptions}
- onValueChange={handleChange as never}
- itemToStringLabel={(o) => getOptionLabel(o as T)}
- itemToStringValue={(o) => (o as T).id}
- isItemEqualToValue={(a, b) => (a as T).id === (b as T).id}
- // Filtering is server-side: `search(query)` already narrows the result
- // set. Disable Base UI's client filter so it doesn't hide rows whose
- // label doesn't substring-match the typed query (the typed query is
- // often shorter than the actual label — partial email, first name
- // only, etc.).
- filter={null}
- disabled={disabled}
- >
- <ComboboxChips ref={anchorRef}>
- <ComboboxValue>
- {(selected: T[]) =>
- selected.map((opt) => <ComboboxChip key={opt.id}>{getOptionLabel(opt)}</ComboboxChip>)
- }
- </ComboboxValue>
- <ComboboxChipsInput
- placeholder={placeholder}
- value={inputValue}
- onChange={(e) => setInputValue((e.target as HTMLInputElement).value)}
- />
- </ComboboxChips>
- <ComboboxContent anchor={anchorRef}>
- <ComboboxEmpty>{isFetching ? 'Searching…' : emptyText}</ComboboxEmpty>
- <ComboboxList>
- {(option: T) => (
- <ComboboxItem key={option.id} value={option}>
- {getOptionLabel(option)}
- </ComboboxItem>
- )}
- </ComboboxList>
- </ComboboxContent>
- </Combobox>
- )
-}
diff --git a/packages/dashboard/src/main.tsx b/packages/dashboard/src/main.tsx
index b84c345c42..472bd191a6 100644
--- a/packages/dashboard/src/main.tsx
+++ b/packages/dashboard/src/main.tsx
@@ -3,10 +3,13 @@ import { QueryClientProvider } from '@tanstack/react-query'
import { RouterProvider } from '@tanstack/react-router'
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
-// Side-effect import: bootstraps i18next via dashboard-core (base namespace)
-// and merges the app's resource bundle. Must run before any component calls
-// useTranslation() — i.e. before @/router.
+// Side-effect imports: bootstrap i18next via dashboard-core (base namespace)
+// and merge the app's resource bundle; register the app's nav entries against
+// the nav-registry. Both must run before any chrome component reads from those
+// registries — i.e. before @/router. (Plugin entries follow the same pattern.)
import '@/i18n-setup'
+import '@/nav/default'
+import '@/nav/settings'
import { AuthProvider, PermissionProvider, queryClient } from '@spree/dashboard-core'
import { ThemeProvider } from '@spree/dashboard-ui'
import { router } from '@/router'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
index 09c26f7787..5ef51b2d84 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
@@ -1,11 +1,15 @@
-import { adminClient, CommandPaletteProvider, StoreProvider } from '@spree/dashboard-core'
+import {
+ AppSidebar,
+ adminClient,
+ CommandPaletteProvider,
+ SettingsSidebar,
+ StoreProvider,
+ TopBar,
+} from '@spree/dashboard-core'
import { SidebarInset, SidebarProvider } from '@spree/dashboard-ui'
import { createFileRoute, Outlet, useRouterState } from '@tanstack/react-router'
import { useEffect } from 'react'
-import { AppSidebar } from '@/components/spree/app-sidebar'
import { CommandPalette } from '@/components/spree/command-palette/command-palette'
-import { SettingsSidebar } from '@/components/spree/settings-sidebar'
-import { TopBar } from '@/components/spree/top-bar'
export const Route = createFileRoute('/_authenticated/$storeId')({
component: StoreLayout,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
index d3bac15849..3f544c153e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
@@ -1,6 +1,15 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Address, Customer, Order, StoreCredit } from '@spree/admin-sdk'
-import { mapSpreeErrorsToForm, PageHeader, useCountries, useStore } from '@spree/dashboard-core'
+import {
+ AddressFormDialog,
+ type AddressParams,
+ CurrencySelect,
+ mapSpreeErrorsToForm,
+ PageHeader,
+ TagCombobox,
+ useCountries,
+ useStore,
+} from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -58,10 +67,7 @@ import {
import { type ReactNode, useEffect, useMemo, useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { AddressFormDialog, type AddressParams } from '@/components/spree/address-form-dialog'
-import { CurrencySelect } from '@/components/spree/currency-select'
import { CustomFieldsCard } from '@/components/spree/custom-fields/custom-fields-card'
-import { TagCombobox } from '@/components/spree/tag-combobox'
import {
type StoreCreditUpdateParams,
useCreateCustomerStoreCredit,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
index 7681a8d728..d0ee482ade 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
@@ -1,6 +1,14 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { CustomerGroup, CustomerGroupCreateParams } from '@spree/admin-sdk'
-import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Button,
Field,
@@ -24,8 +32,6 @@ import { useEffect } from 'react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
useCreateCustomerGroup,
useCustomerGroup,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
index 72dfdce938..3f88f63cdb 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
@@ -1,6 +1,17 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Customer } from '@spree/admin-sdk'
-import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
+import type { BulkAction, BulkActionFormProps } from '@spree/dashboard-core'
+import {
+ adminClient,
+ ExportButton,
+ mapSpreeErrorsToForm,
+ ResourceMultiAutocomplete,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ TagCombobox,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
BulkDialog,
Button,
@@ -27,11 +38,6 @@ import { useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import type { BulkAction, BulkActionFormProps } from '@/components/spree/bulk-action-bar'
-import { ExportButton } from '@/components/spree/export-button'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
-import { TagCombobox } from '@/components/spree/tag-combobox'
import { customerGroupAutocompleteProps } from '@/hooks/use-customer-groups'
import {
useBulkAddCustomersToGroups,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
index 61eb1dcf0f..ac9f807d7b 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
@@ -1,9 +1,12 @@
import type { Order, Variant } from '@spree/admin-sdk'
import {
+ AddressFormDialog,
+ type AddressParams,
adminClient,
formatPrice,
getInitials,
PageHeader,
+ TagCombobox,
useResourceMutation,
} from '@spree/dashboard-core'
import {
@@ -77,9 +80,7 @@ import {
} from 'lucide-react'
import { type FormEvent, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { AddressFormDialog, type AddressParams } from '@/components/spree/address-form-dialog'
import { CustomFieldsCard } from '@/components/spree/custom-fields/custom-fields-card'
-import { TagCombobox } from '@/components/spree/tag-combobox'
import { orderQueryKey, useOrder, useOrderMutation } from '@/hooks/use-order'
import { spreeJsonLinkResolver } from '@/lib/json-link-resolver'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx
index 53c536a10d..3db41fbeb4 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx
@@ -1,9 +1,8 @@
-import { adminClient } from '@spree/dashboard-core'
+import { adminClient, ResourceTable, resourceSearchSchema } from '@spree/dashboard-core'
import { Button } from '@spree/dashboard-ui'
import { createFileRoute } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import '@/tables/orders'
export const Route = createFileRoute('/_authenticated/$storeId/orders/drafts')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx
index f7eadb77db..33cf55a32b 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx
@@ -1,9 +1,12 @@
-import { adminClient } from '@spree/dashboard-core'
+import {
+ adminClient,
+ ExportButton,
+ ResourceTable,
+ resourceSearchSchema,
+} from '@spree/dashboard-core'
import { Button } from '@spree/dashboard-ui'
import { createFileRoute, Link } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
-import { ExportButton } from '@/components/spree/export-button'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import '@/tables/orders'
export const Route = createFileRoute('/_authenticated/$storeId/orders/')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
index 09f04b6f1b..e5e7d9a712 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
@@ -1,6 +1,12 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Customer, Variant } from '@spree/admin-sdk'
-import { adminClient, formatPrice, mapSpreeErrorsToForm, PageHeader } from '@spree/dashboard-core'
+import {
+ adminClient,
+ formatPrice,
+ mapSpreeErrorsToForm,
+ PageHeader,
+ ResourceCombobox,
+} from '@spree/dashboard-core'
import {
Button,
Card,
@@ -22,7 +28,6 @@ import { TrashIcon } from 'lucide-react'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { ResourceCombobox } from '@/components/spree/resource-combobox'
import { customerAutocompleteProps } from '@/hooks/use-customers'
import { NEW_ORDER_DEFAULTS, type NewOrderFormValues, newOrderFormSchema } from '@/schemas/order'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
index ce3553d909..0d382a67b2 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
@@ -19,6 +19,9 @@ import {
adminClient,
mapSpreeErrorsToForm,
PageHeader,
+ ResourceMultiAutocomplete,
+ StoreDatePicker,
+ TagCombobox,
useDirectUpload,
} from '@spree/dashboard-core'
import {
@@ -57,9 +60,6 @@ import { BulkPriceEditorDialog } from '@/components/spree/bulk-price-editor/bulk
import { CustomFieldsCard } from '@/components/spree/custom-fields/custom-fields-card'
import { InventorySection } from '@/components/spree/products/inventory-section'
import { MediaEditSheet } from '@/components/spree/products/media-edit-sheet'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { StoreDatePicker } from '@/components/spree/store-date-picker'
-import { TagCombobox } from '@/components/spree/tag-combobox'
import { categoryAutocompleteProps } from '@/hooks/use-categories'
import { useDeleteProduct, useProduct, useUpdateProduct } from '@/hooks/use-product'
import {
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
index f5a2c9e3e8..3da7045eab 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
@@ -1,5 +1,15 @@
import type { Product } from '@spree/admin-sdk'
-import { adminClient, Subject, usePermissions } from '@spree/dashboard-core'
+import type { BulkAction, BulkActionFormProps } from '@spree/dashboard-core'
+import {
+ adminClient,
+ ExportButton,
+ ResourceMultiAutocomplete,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ TagCombobox,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
BulkDialog,
Button,
@@ -25,11 +35,6 @@ import {
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import type { BulkAction, BulkActionFormProps } from '@/components/spree/bulk-action-bar'
-import { ExportButton } from '@/components/spree/export-button'
-import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
-import { TagCombobox } from '@/components/spree/tag-combobox'
import { categoryAutocompleteProps } from '@/hooks/use-categories'
import { useDeleteProduct } from '@/hooks/use-product'
import {
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
index 1fb614a758..6ecfd13189 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
@@ -18,7 +18,10 @@ import { zodResolver } from '@hookform/resolvers/zod'
import type { OptionType, OptionTypeCreateParams } from '@spree/admin-sdk'
import {
adminClient,
+ Can,
mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
Subject,
useDirectUpload,
usePermissions,
@@ -74,8 +77,6 @@ import {
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
optionTypesQueryKey,
useCreateOptionType,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
index 4713b5c0e2..8b6e31f8d0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
@@ -1,12 +1,17 @@
import type { PriceList } from '@spree/admin-sdk'
-import { adminClient, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useDeletePriceList } from '@/hooks/use-price-lists'
import '@/tables/price-lists'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
index 59c2db5b68..08a47f8252 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
@@ -1,5 +1,13 @@
import type { StockTransfer, Variant } from '@spree/admin-sdk'
-import { adminClient, formatPrice, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ formatPrice,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -33,8 +41,6 @@ import { ArrowLeftRightIcon, EyeIcon, PlusIcon, TrashIcon } from 'lucide-react'
import { useMemo, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useStockLocations } from '@/hooks/use-stock-locations'
import {
useCreateStockTransfer,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
index 888ae43dbf..4e0f37dd5f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
@@ -1,6 +1,17 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Customer, GiftCard } from '@spree/admin-sdk'
-import { mapSpreeErrorsToForm, Subject, usePermissions, useStore } from '@spree/dashboard-core'
+import {
+ Can,
+ CurrencySelect,
+ mapSpreeErrorsToForm,
+ ResourceCombobox,
+ ResourceTable,
+ resourceSearchSchema,
+ StoreDatePicker,
+ Subject,
+ usePermissions,
+ useStore,
+} from '@spree/dashboard-core'
import {
Button,
Field,
@@ -24,11 +35,6 @@ import { useEffect, useRef } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { CurrencySelect } from '@/components/spree/currency-select'
-import { ResourceCombobox } from '@/components/spree/resource-combobox'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
-import { StoreDatePicker } from '@/components/spree/store-date-picker'
import { customerAutocompleteProps } from '@/hooks/use-customers'
import {
listGiftCards,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx
index f2e73aa9ca..f2a42552d6 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx
@@ -1,11 +1,16 @@
import type { Promotion } from '@spree/admin-sdk'
-import { adminClient, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useDeletePromotion } from '@/hooks/use-promotions'
import '@/tables/promotions'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
index 5f6e624de9..8e3822a502 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
@@ -2,8 +2,11 @@ import { zodResolver } from '@hookform/resolvers/zod'
import type { AllowedOrigin, AllowedOriginCreateParams } from '@spree/admin-sdk'
import {
adminClient,
+ Can,
i18n,
mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
Subject,
usePermissions,
} from '@spree/dashboard-core'
@@ -30,8 +33,6 @@ import { PlusIcon } from 'lucide-react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
useAllowedOrigin,
useCreateAllowedOrigin,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
index ce5ddf44d9..66e29567a9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
@@ -2,7 +2,10 @@ import { zodResolver } from '@hookform/resolvers/zod'
import type { CustomFieldDefinition } from '@spree/admin-sdk'
import {
adminClient,
+ Can,
mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
Subject,
useCreateCustomFieldDefinitionForSettings,
useCustomFieldDefinition,
@@ -28,9 +31,7 @@ import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
import { DefinitionFormFields } from '@/components/spree/custom-fields/definition-form'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
CUSTOM_FIELD_DEFINITION_DEFAULTS,
type CustomFieldDefinitionFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
index a839b82b6e..3bbf958789 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
@@ -2,7 +2,13 @@ import { zodResolver } from '@hookform/resolvers/zod'
import type { Market } from '@spree/admin-sdk'
import {
adminClient,
+ Can,
+ CountryMultiCombobox,
+ CurrencySelect,
+ LocaleSelect,
mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
Subject,
usePermissions,
useStore,
@@ -32,11 +38,6 @@ import { useEffect, useMemo } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { CountryMultiCombobox } from '@/components/spree/country-combobox'
-import { CurrencySelect } from '@/components/spree/currency-select'
-import { LocaleSelect } from '@/components/spree/locale-select'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
marketsQueryKey,
useCreateMarket,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
index 5bea64b26c..8720ffe6e7 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
@@ -2,7 +2,11 @@ import { zodResolver } from '@hookform/resolvers/zod'
import type { PaymentMethod, PreferenceField } from '@spree/admin-sdk'
import {
adminClient,
+ Can,
+ defaultPreferences,
mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
Subject,
usePermissions,
useStore,
@@ -26,11 +30,8 @@ import { useEffect, useMemo, useRef, useState } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
import { PaymentMethodForm } from '@/components/spree/payment-method-editors/payment-method-form'
import type { PaymentMethodFormValues } from '@/components/spree/payment-method-editors/types'
-import { defaultPreferences } from '@/components/spree/preferences-form'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
useCreatePaymentMethod,
useDeletePaymentMethod,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
index 5085fbbe1a..a1414749d5 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
@@ -5,7 +5,18 @@ import type {
StockLocationCreateParams,
StockLocationUpdateParams,
} from '@spree/admin-sdk'
-import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ CountryCombobox,
+ mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
+ StateCombobox,
+ Subject,
+ useCountryStates,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Button,
Collapsible,
@@ -39,10 +50,6 @@ import { useEffect, useMemo, useState } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { CountryCombobox } from '@/components/spree/country-combobox'
-import { StateCombobox, useCountryStates } from '@/components/spree/country-state-fields'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useStockItems, useUpdateStockItem } from '@/hooks/use-stock-items'
import {
useCreateStockLocation,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
index 31cace6e1f..b6ddc53dfe 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
@@ -1,6 +1,14 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { TaxCategory, TaxCategoryCreateParams } from '@spree/admin-sdk'
-import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ Can,
+ mapSpreeErrorsToForm,
+ ResourceTable,
+ resourceSearchSchema,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Button,
Field,
@@ -26,8 +34,6 @@ import { useEffect } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { Can } from '@/components/spree/can'
-import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
useCreateTaxCategory,
useDeleteTaxCategory,
diff --git a/packages/dashboard/src/schemas/price-list.ts b/packages/dashboard/src/schemas/price-list.ts
index 38683d1b42..9b7050abcc 100644
--- a/packages/dashboard/src/schemas/price-list.ts
+++ b/packages/dashboard/src/schemas/price-list.ts
@@ -6,10 +6,9 @@ import type {
PriceListUpdateParams,
PriceRule,
} from '@spree/admin-sdk'
-import { blankToNull } from '@spree/dashboard-core'
+import { blankToNull, defaultPreferences } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { defaultPreferences } from '@/components/spree/preferences-form'
export const MATCH_POLICIES = ['all', 'any'] as const
export type MatchPolicy = (typeof MATCH_POLICIES)[number]
diff --git a/packages/dashboard/src/tables/markets.tsx b/packages/dashboard/src/tables/markets.tsx
index 43a0c0cf63..0acd2dc87c 100644
--- a/packages/dashboard/src/tables/markets.tsx
+++ b/packages/dashboard/src/tables/markets.tsx
@@ -1,8 +1,7 @@
import type { Market } from '@spree/admin-sdk'
-import { defineTable } from '@spree/dashboard-core'
+import { defineTable, LocaleLabel } from '@spree/dashboard-core'
import { ActiveBadge, Badge, ResourceNameCell } from '@spree/dashboard-ui'
import { GlobeIcon } from 'lucide-react'
-import { LocaleLabel } from '@/components/spree/locale-select'
defineTable<Market>('markets', {
title: 'Markets',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0d198bd298..52134ca25a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -291,6 +291,18 @@ importers:
packages/dashboard-core:
dependencies:
+ '@dnd-kit/core':
+ specifier: ^6.3.1
+ '@dnd-kit/sortable':
+ specifier: ^10.0.0
+ '@dnd-kit/utilities':
+ specifier: ^3.2.2
+ version: 3.2.2([email protected])
+ '@hookform/resolvers':
+ specifier: ^5.2.2
'@spree/admin-sdk':
specifier: workspace:^
version: link:../admin-sdk
@@ -330,6 +342,9 @@ importers:
spark-md5:
specifier: ^3.0.2
version: 3.0.2
+ zod:
+ specifier: ^4.4.3
+ version: 4.4.3
devDependencies:
'@types/react':
specifier: ^19.2.14