@spree/dashboard-ui 1.0.0-beta.1 → 1.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spree/dashboard-ui",
3
3
  "license": "MIT",
4
- "version": "1.0.0-beta.1",
4
+ "version": "1.0.0-beta.3",
5
5
  "description": "Spree Dashboard design system — shadcn primitives, headless composed components, and design tokens. Source-only package; consumers compile via their own Vite/Tailwind setup. Developer Preview.",
6
6
  "author": "Vendo Connect Inc.",
7
7
  "homepage": "https://spreecommerce.org",
@@ -67,7 +67,6 @@
67
67
  "date-fns-tz": "^3.2.0",
68
68
  "flag-icons": "^7.5.0",
69
69
  "lucide-react": "^1.14.0",
70
- "maplibre-gl": "6.4.1",
71
70
  "react-colorful": "^5.7.0",
72
71
  "react-day-picker": "^9.14.0",
73
72
  "recharts": "^3.8.1",
@@ -76,7 +75,6 @@
76
75
  "tw-animate-css": "^1.4.0"
77
76
  },
78
77
  "devDependencies": {
79
- "@types/geojson": "^7946.0.16",
80
78
  "@types/react": "^19.2.14",
81
79
  "@types/react-dom": "^19.2.3",
82
80
  "tailwindcss": "^4.2.4",
package/src/index.ts CHANGED
@@ -31,7 +31,6 @@ export { requiredMessage } from './lib/validation-messages'
31
31
  // ---------------------------------------------------------------------------
32
32
  export * from './spree/address-block'
33
33
  export * from './spree/address-book-row'
34
- export * from './spree/address-map'
35
34
  export * from './spree/back-button'
36
35
  export * from './spree/bulk-dialog'
37
36
  export * from './spree/bulk-price-table'
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react'
1
2
  import { Thumbnail } from '../ui/thumbnail'
2
3
  import { PackageIcon } from './icons'
3
4
 
@@ -5,6 +6,9 @@ import { PackageIcon } from './icons'
5
6
  * One row of a fulfillment's item list, already joined to its line item by
6
7
  * the caller. The image and the price are optional: a surface that does not
7
8
  * expose them renders the name and the count alone.
9
+ *
10
+ * `priceSource` is a node because saying where a price came from means
11
+ * linking to it, and routing belongs to the app.
8
12
  */
9
13
  export type FulfillmentItemRowData = {
10
14
  key: string
@@ -12,6 +16,7 @@ export type FulfillmentItemRowData = {
12
16
  optionsText?: string | null
13
17
  thumbnailUrl?: string | null
14
18
  displayPrice?: string | null
19
+ priceSource?: ReactNode
15
20
  quantity: number
16
21
  }
17
22
 
@@ -35,14 +40,15 @@ function ItemRow({ row }: { row: FulfillmentItemRowData }) {
35
40
  )}
36
41
  </div>
37
42
 
38
- <div className="shrink-0 whitespace-nowrap text-right text-muted-foreground text-sm">
43
+ <div className="min-w-0 shrink text-right text-muted-foreground text-sm">
39
44
  {row.displayPrice ? (
40
- <span>
45
+ <span className="whitespace-nowrap">
41
46
  {row.displayPrice} × {row.quantity}
42
47
  </span>
43
48
  ) : (
44
- <span>× {row.quantity}</span>
49
+ <span className="whitespace-nowrap">× {row.quantity}</span>
45
50
  )}
51
+ {row.priceSource && <div className="truncate text-xs">{row.priceSource}</div>}
46
52
  </div>
47
53
  </div>
48
54
  )
@@ -1,62 +0,0 @@
1
- import { lazy, Suspense } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
-
4
- /**
5
- * Structural shape `<AddressMap>` needs. Declared here rather than imported
6
- * so the design system stays decoupled from any SDK's `Address` type — the
7
- * same reason `<AddressBlock>` carries its own.
8
- */
9
- export interface AddressMapValue {
10
- latitude?: number | null
11
- longitude?: number | null
12
- }
13
-
14
- // MapLibre and its styles are a few megabytes for a map that appears on one
15
- // card of a page, so it is loaded on demand and every other screen is spared.
16
- const LazyMap = lazy(async () => ({ default: (await import('../ui/map')).Map }))
17
- const LazyMapControls = lazy(async () => ({ default: (await import('../ui/map')).MapControls }))
18
- const LazyMapMarker = lazy(async () => ({ default: (await import('../ui/map')).MapMarker }))
19
- const LazyMarkerContent = lazy(async () => ({ default: (await import('../ui/map')).MarkerContent }))
20
- const LazyMarkerTooltip = lazy(async () => ({ default: (await import('../ui/map')).MarkerTooltip }))
21
-
22
- /**
23
- * Where an address actually is, beside the lines that describe it — a returns
24
- * address is what shoppers are told to post to, so it is worth seeing on a map
25
- * rather than trusting as typed.
26
- *
27
- * Coordinates are geocoded in the background after an address is saved, so a
28
- * freshly entered one has none yet; the map is simply absent until then rather
29
- * than showing the middle of the ocean.
30
- */
31
- export function AddressMap({
32
- address,
33
- label,
34
- className,
35
- }: {
36
- address: AddressMapValue
37
- /** Names whose address the pin marks — a seller, a customer, a branch. */
38
- label?: string
39
- className?: string
40
- }) {
41
- const { t } = useTranslation()
42
- const { latitude, longitude } = address
43
-
44
- if (latitude == null || longitude == null) {
45
- return <p className="text-muted-foreground text-xs">{t('admin.address.not_located_yet')}</p>
46
- }
47
-
48
- return (
49
- <div className={className ?? 'h-40 overflow-hidden rounded-md border'}>
50
- <Suspense fallback={<div className="size-full animate-pulse bg-muted" />}>
51
- <LazyMap center={[longitude, latitude]} zoom={13}>
52
- <LazyMapControls />
53
- <LazyMapMarker longitude={longitude} latitude={latitude}>
54
- {/* The default pin; the tooltip names whose address it is. */}
55
- <LazyMarkerContent />
56
- {label && <LazyMarkerTooltip>{label}</LazyMarkerTooltip>}
57
- </LazyMapMarker>
58
- </LazyMap>
59
- </Suspense>
60
- </div>
61
- )
62
- }