@gradeui/ui 0.8.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/components/ui/accordion.md +30 -0
  2. package/components/ui/ai-chat.md +35 -0
  3. package/components/ui/alert.md +21 -0
  4. package/components/ui/app-shell.md +61 -0
  5. package/components/ui/avatar.md +18 -0
  6. package/components/ui/badge.md +18 -0
  7. package/components/ui/breadcrumb.md +54 -0
  8. package/components/ui/button.md +31 -0
  9. package/components/ui/calendar.md +39 -0
  10. package/components/ui/card.md +25 -0
  11. package/components/ui/chart.md +48 -0
  12. package/components/ui/checkbox.md +19 -0
  13. package/components/ui/collapsible.md +28 -0
  14. package/components/ui/command.md +38 -0
  15. package/components/ui/date-picker.md +52 -0
  16. package/components/ui/dialog.md +29 -0
  17. package/components/ui/dropdown-menu.md +39 -0
  18. package/components/ui/flex.md +41 -0
  19. package/components/ui/grid.md +44 -0
  20. package/components/ui/hover-card.md +35 -0
  21. package/components/ui/input.md +17 -0
  22. package/components/ui/label.md +14 -0
  23. package/components/ui/map.md +80 -0
  24. package/components/ui/media-surface.md +18 -0
  25. package/components/ui/popover.md +36 -0
  26. package/components/ui/progress.md +14 -0
  27. package/components/ui/radio-group.md +37 -0
  28. package/components/ui/resizable.md +30 -0
  29. package/components/ui/rive-player.md +38 -0
  30. package/components/ui/row.md +32 -0
  31. package/components/ui/scroll-area.md +27 -0
  32. package/components/ui/select.md +24 -0
  33. package/components/ui/separator.md +16 -0
  34. package/components/ui/shader-preset-picker.md +26 -0
  35. package/components/ui/shader-preset-preview.md +24 -0
  36. package/components/ui/sheet.md +46 -0
  37. package/components/ui/side-menu.md +40 -0
  38. package/components/ui/simple-tabs.md +27 -0
  39. package/components/ui/skeleton.md +17 -0
  40. package/components/ui/slider.md +48 -0
  41. package/components/ui/stack.md +32 -0
  42. package/components/ui/switch.md +20 -0
  43. package/components/ui/table.md +27 -0
  44. package/components/ui/tabs.md +39 -0
  45. package/components/ui/textarea.md +14 -0
  46. package/components/ui/three-scene.md +226 -0
  47. package/components/ui/toast.md +38 -0
  48. package/components/ui/toggle-group.md +36 -0
  49. package/components/ui/toggle.md +36 -0
  50. package/components/ui/tooltip.md +28 -0
  51. package/components/ui/video-player.md +27 -0
  52. package/dist/index.d.mts +252 -90
  53. package/dist/index.d.ts +252 -90
  54. package/dist/index.js +240 -240
  55. package/dist/index.js.map +1 -1
  56. package/dist/index.mjs +240 -240
  57. package/dist/index.mjs.map +1 -1
  58. package/dist/map/google.d.mts +6 -0
  59. package/dist/map/google.d.ts +6 -0
  60. package/dist/map/google.js +2 -0
  61. package/dist/map/google.js.map +1 -0
  62. package/dist/map/google.mjs +2 -0
  63. package/dist/map/google.mjs.map +1 -0
  64. package/dist/map/mapbox.d.mts +6 -0
  65. package/dist/map/mapbox.d.ts +6 -0
  66. package/dist/map/mapbox.js +3 -0
  67. package/dist/map/mapbox.js.map +1 -0
  68. package/dist/map/mapbox.mjs +3 -0
  69. package/dist/map/mapbox.mjs.map +1 -0
  70. package/dist/map/maplibre.d.mts +6 -0
  71. package/dist/map/maplibre.d.ts +6 -0
  72. package/dist/map/maplibre.js +3 -0
  73. package/dist/map/maplibre.js.map +1 -0
  74. package/dist/map/maplibre.mjs +3 -0
  75. package/dist/map/maplibre.mjs.map +1 -0
  76. package/dist/styles.css +1 -1
  77. package/dist/types-BxywIwvG.d.mts +160 -0
  78. package/dist/types-BxywIwvG.d.ts +160 -0
  79. package/package.json +42 -5
@@ -0,0 +1,160 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Coordinate tuple — `[lng, lat]`. Always tuples in the public API; each
5
+ * adapter normalizes internally to whatever shape its provider expects
6
+ * (Google takes `{ lat, lng }` objects, Mapbox/MapLibre take tuples).
7
+ */
8
+ type Coords = [lng: number, lat: number];
9
+ type MapAppearance = "light" | "dark" | "satellite" | "auto";
10
+ type MapErrorCode = "sdk-missing" | "api-key-missing" | "provider-init-failed" | "style-load-failed" | "tile-load-failed";
11
+ type MapError = {
12
+ code: MapErrorCode;
13
+ message: string;
14
+ cause?: unknown;
15
+ };
16
+ /**
17
+ * Imperative handle exposed via `ref` and `onLoad`. Use for fly-to
18
+ * animations, fit-bounds, and the `.instance` escape hatch when you
19
+ * need the provider-native map object.
20
+ */
21
+ type MapHandle = {
22
+ /** Pan + zoom to a marker by id, or directly to coords. */
23
+ flyTo: (idOrCoords: string | Coords, opts?: {
24
+ zoom?: number;
25
+ durationMs?: number;
26
+ }) => void;
27
+ panTo: (coords: Coords, opts?: {
28
+ durationMs?: number;
29
+ }) => void;
30
+ fitBounds: (coords: Coords[], opts?: {
31
+ paddingPx?: number;
32
+ durationMs?: number;
33
+ }) => void;
34
+ getCenter: () => Coords;
35
+ getZoom: () => number;
36
+ getBounds: () => [Coords, Coords];
37
+ /**
38
+ * Provider-native instance. Cast to `mapboxgl.Map`, `maplibregl.Map`,
39
+ * or `google.maps.Map` to reach features the wrapper doesn't expose
40
+ * (3D extrusions, custom layers, drawing tools, heatmaps).
41
+ * Touching this makes your code provider-specific.
42
+ */
43
+ readonly instance: unknown;
44
+ };
45
+ type MapBaseProps = {
46
+ center: Coords;
47
+ zoom: number;
48
+ /** [southwest, northeast] — takes precedence over center/zoom when set. */
49
+ bounds?: [Coords, Coords];
50
+ /** Default `"auto"` (follows GradeThemeProvider mode). */
51
+ appearance?: MapAppearance;
52
+ /** Default `true`. `false` disables pan/zoom/rotate (static display). */
53
+ interactive?: boolean;
54
+ /** Controlled hovered marker id — pairs with `onHoveredIdChange` for list↔map sync. */
55
+ hoveredId?: string | null;
56
+ onHoveredIdChange?: (id: string | null) => void;
57
+ onLoad?: (handle: MapHandle) => void;
58
+ onError?: (error: MapError) => void;
59
+ className?: string;
60
+ style?: React.CSSProperties;
61
+ children?: React.ReactNode;
62
+ };
63
+ /**
64
+ * Discriminated union — TS enforces the right config fields per provider.
65
+ *
66
+ * @example
67
+ * // Zero-config public demo (MapLibre + MapTiler demo key):
68
+ * <Map center={[-122.42, 37.78]} zoom={12} />
69
+ *
70
+ * // Mapbox:
71
+ * <Map provider="mapbox" accessToken={env.MAPBOX_TOKEN} center={...} zoom={...} />
72
+ *
73
+ * // Google:
74
+ * <Map provider="google" apiKey={env.GOOGLE_MAPS_KEY} center={...} zoom={...} />
75
+ */
76
+ type MapProps = MapBaseProps & ({
77
+ provider?: "maplibre";
78
+ /** Override the default MapTiler style URL entirely. */
79
+ styleUrl?: string;
80
+ /** Your MapTiler key. Omit to use the Grade demo key (referrer-locked to gradeui.com). */
81
+ tilerKey?: string;
82
+ } | {
83
+ provider: "mapbox";
84
+ accessToken: string;
85
+ /** Override the appearance-derived Mapbox style URL. */
86
+ styleUrl?: string;
87
+ } | {
88
+ provider: "google";
89
+ apiKey: string;
90
+ /** Optional Google Cloud Map ID for cloud-based styling. */
91
+ mapId?: string;
92
+ });
93
+ type MapMarkerProps = {
94
+ /** Required — used by `flyTo(id)` and `hoveredId` matching. */
95
+ id: string;
96
+ at: Coords;
97
+ /** Default `"bottom"` — pin tip at the coord. */
98
+ anchor?: "center" | "bottom";
99
+ className?: string;
100
+ children?: React.ReactNode;
101
+ onClick?: (e: {
102
+ id: string;
103
+ coords: Coords;
104
+ native: MouseEvent;
105
+ }) => void;
106
+ };
107
+ type AdapterCallbacks = {
108
+ onLoad: () => void;
109
+ onError: (error: MapError) => void;
110
+ onMarkerHover: (id: string | null) => void;
111
+ onMarkerClick: (id: string, coords: Coords, native: MouseEvent) => void;
112
+ };
113
+ type AdapterOpts = {
114
+ center: Coords;
115
+ zoom: number;
116
+ bounds?: [Coords, Coords];
117
+ appearance: "light" | "dark" | "satellite";
118
+ interactive: boolean;
119
+ styleUrl?: string;
120
+ tilerKey?: string;
121
+ accessToken?: string;
122
+ apiKey?: string;
123
+ mapId?: string;
124
+ };
125
+ type MarkerHandle = {
126
+ /** DOM element the adapter created for this marker. `<MapMarker>` portals its children into here. */
127
+ element: HTMLElement;
128
+ /** Last-known coords, used by `flyTo(id)`. Updated via `setPosition`. */
129
+ coords: Coords;
130
+ setHovered: (hovered: boolean) => void;
131
+ setPosition: (coords: Coords) => void;
132
+ remove: () => void;
133
+ };
134
+ type AdapterInstance = {
135
+ setCenter: (coords: Coords) => void;
136
+ setZoom: (zoom: number) => void;
137
+ setBounds: (sw: Coords, ne: Coords) => void;
138
+ setAppearance: (appearance: "light" | "dark" | "satellite") => void;
139
+ setInteractive: (enabled: boolean) => void;
140
+ flyTo: (coords: Coords, opts?: {
141
+ zoom?: number;
142
+ durationMs?: number;
143
+ }) => void;
144
+ panTo: (coords: Coords, opts?: {
145
+ durationMs?: number;
146
+ }) => void;
147
+ fitBounds: (coords: Coords[], opts?: {
148
+ paddingPx?: number;
149
+ durationMs?: number;
150
+ }) => void;
151
+ getCenter: () => Coords;
152
+ getZoom: () => number;
153
+ getBounds: () => [Coords, Coords];
154
+ addMarker: (id: string, coords: Coords, anchor: "center" | "bottom") => MarkerHandle;
155
+ destroy: () => void;
156
+ instance: unknown;
157
+ };
158
+ type AdapterFactory = (container: HTMLElement, opts: AdapterOpts, callbacks: AdapterCallbacks) => Promise<AdapterInstance>;
159
+
160
+ export type { AdapterFactory as A, Coords as C, MapProps as M, MapHandle as a, MapMarkerProps as b, MapAppearance as c, MapError as d, MapErrorCode as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradeui/ui",
3
- "version": "0.8.2",
3
+ "version": "0.10.0",
4
4
  "description": "Grade Design System — React components, theme engine, and design tokens",
5
5
  "license": "MIT",
6
6
  "author": "Grade",
@@ -62,17 +62,47 @@
62
62
  "types": "./dist/tailwind-preset.d.ts",
63
63
  "import": "./dist/tailwind-preset.mjs",
64
64
  "require": "./dist/tailwind-preset.js"
65
+ },
66
+ "./map/maplibre": {
67
+ "types": "./dist/map/maplibre.d.ts",
68
+ "import": "./dist/map/maplibre.mjs",
69
+ "require": "./dist/map/maplibre.js"
70
+ },
71
+ "./map/mapbox": {
72
+ "types": "./dist/map/mapbox.d.ts",
73
+ "import": "./dist/map/mapbox.mjs",
74
+ "require": "./dist/map/mapbox.js"
75
+ },
76
+ "./map/google": {
77
+ "types": "./dist/map/google.d.ts",
78
+ "import": "./dist/map/google.mjs",
79
+ "require": "./dist/map/google.js"
65
80
  }
66
81
  },
67
82
  "files": [
68
- "dist"
83
+ "dist",
84
+ "components/ui/*.md"
69
85
  ],
70
86
  "sideEffects": [
71
87
  "**/*.css"
72
88
  ],
73
89
  "peerDependencies": {
74
90
  "react": "^18.0.0 || ^19.0.0",
75
- "react-dom": "^18.0.0 || ^19.0.0"
91
+ "react-dom": "^18.0.0 || ^19.0.0",
92
+ "maplibre-gl": "^4.0.0 || ^5.0.0",
93
+ "mapbox-gl": "^3.0.0",
94
+ "@googlemaps/js-api-loader": "^1.16.0"
95
+ },
96
+ "peerDependenciesMeta": {
97
+ "maplibre-gl": {
98
+ "optional": true
99
+ },
100
+ "mapbox-gl": {
101
+ "optional": true
102
+ },
103
+ "@googlemaps/js-api-loader": {
104
+ "optional": true
105
+ }
76
106
  },
77
107
  "dependencies": {
78
108
  "@radix-ui/react-accordion": "^1.2.12",
@@ -107,6 +137,7 @@
107
137
  "postprocessing": "^6.36.5",
108
138
  "react-day-picker": "^9.13.0",
109
139
  "react-markdown": "^10.1.0",
140
+ "react-resizable-panels": "^2.1.7",
110
141
  "recharts": "^2.15.4",
111
142
  "remark-gfm": "^4.0.1",
112
143
  "sonner": "^2.0.7",
@@ -117,11 +148,15 @@
117
148
  "@rive-app/react-canvas": "^4.21.4"
118
149
  },
119
150
  "devDependencies": {
151
+ "@googlemaps/js-api-loader": "^1.16.0",
152
+ "@types/google.maps": "^3.55.0",
120
153
  "@types/node": "^20",
121
154
  "@types/react": "^19",
122
155
  "@types/react-dom": "^19",
123
156
  "@types/three": "^0.170.0",
124
157
  "autoprefixer": "^10.4.23",
158
+ "maplibre-gl": "^4.7.0",
159
+ "mapbox-gl": "^3.8.0",
125
160
  "postcss": "^8",
126
161
  "tailwindcss": "^3.4.1",
127
162
  "tailwindcss-animate": "^1.0.7",
@@ -129,9 +164,11 @@
129
164
  "typescript": "^5.6.3"
130
165
  },
131
166
  "scripts": {
132
- "build": "tsup && npm run build:css",
167
+ "build": "npm run clean && tsup && npm run build:css",
133
168
  "build:css": "tailwindcss -i ./styles/globals.css -o ./dist/styles.css --minify",
134
- "dev": "tsup --watch",
169
+ "build:css:watch": "tailwindcss -i ./styles/globals.css -o ./dist/styles.css --watch",
170
+ "dev": "npm run build:css && tsup --watch",
171
+ "dev:full": "npm run build:css && (tsup --watch & npm run build:css:watch)",
135
172
  "lint": "echo \"(no lint configured for @gradeui/ui yet)\"",
136
173
  "clean": "rm -rf dist"
137
174
  }