@j3m-quantum/ui 1.7.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/dist/index.cjs +1597 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +503 -1
- package/dist/index.d.ts +503 -1
- package/dist/index.js +1576 -183
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +2 -0
- package/package.json +15 -2
package/README.md
CHANGED
|
@@ -8,6 +8,13 @@ J3M Quantum UI - A React component library with J3M design tokens.
|
|
|
8
8
|
- **Tailwind CSS v4** (required - not compatible with v3)
|
|
9
9
|
- **tw-animate-css** >= 1.0.0
|
|
10
10
|
|
|
11
|
+
### Optional Peer Dependencies
|
|
12
|
+
|
|
13
|
+
| Package | Version | Required For |
|
|
14
|
+
|---------|---------|--------------|
|
|
15
|
+
| `leaflet` | ^1.9.4 | Map components |
|
|
16
|
+
| `react-leaflet` | ^5.0.0 | Map components |
|
|
17
|
+
|
|
11
18
|
## Features
|
|
12
19
|
|
|
13
20
|
- **J3M Design Tokens** - Orange primary, neutral grays, pill-shaped buttons
|
|
@@ -272,6 +279,9 @@ Dialog, Drawer, Sheet, Popover, HoverCard
|
|
|
272
279
|
### Layout
|
|
273
280
|
ScrollArea, Collapsible, Resizable, Sidebar, SidebarProvider, SidebarInset, Section
|
|
274
281
|
|
|
282
|
+
### Map
|
|
283
|
+
Map, MapTileLayer, MapMarker, MapPopup, MapTooltip, MapZoomControl
|
|
284
|
+
|
|
275
285
|
### Utilities
|
|
276
286
|
ThemeSwitch, ToolbarCanvas, PlayerCanvas
|
|
277
287
|
|
|
@@ -381,6 +391,96 @@ const navItems: NavItem[] = [
|
|
|
381
391
|
<NavMain items={navItems} />
|
|
382
392
|
```
|
|
383
393
|
|
|
394
|
+
## Map Components
|
|
395
|
+
|
|
396
|
+
Leaflet-based map components for displaying interactive maps. **Requires optional peer dependencies.**
|
|
397
|
+
|
|
398
|
+
### Installation
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
npm install leaflet react-leaflet
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Setup
|
|
405
|
+
|
|
406
|
+
Import Leaflet CSS in your app's entry CSS file:
|
|
407
|
+
|
|
408
|
+
```css
|
|
409
|
+
/* src/index.css */
|
|
410
|
+
@import "tailwindcss";
|
|
411
|
+
@import "tw-animate-css";
|
|
412
|
+
@import "@j3m-quantum/ui/styles";
|
|
413
|
+
@import "leaflet/dist/leaflet.css";
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Basic Usage
|
|
417
|
+
|
|
418
|
+
```tsx
|
|
419
|
+
import { Map, MapTileLayer, MapMarker, MapPopup } from '@j3m-quantum/ui'
|
|
420
|
+
|
|
421
|
+
function MyMap() {
|
|
422
|
+
return (
|
|
423
|
+
<Map center={[57.7089, 11.9746]} zoom={12} className="h-[400px]">
|
|
424
|
+
<MapTileLayer />
|
|
425
|
+
<MapMarker position={[57.7089, 11.9746]}>
|
|
426
|
+
<MapPopup>Hello from Gothenburg!</MapPopup>
|
|
427
|
+
</MapMarker>
|
|
428
|
+
</Map>
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Tile Layer Variants
|
|
434
|
+
|
|
435
|
+
```tsx
|
|
436
|
+
// Default (OpenStreetMap)
|
|
437
|
+
<MapTileLayer variant="default" />
|
|
438
|
+
|
|
439
|
+
// Dark mode tiles
|
|
440
|
+
<MapTileLayer variant="dark" />
|
|
441
|
+
|
|
442
|
+
// Satellite imagery
|
|
443
|
+
<MapTileLayer variant="satellite" />
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Map Components Reference
|
|
447
|
+
|
|
448
|
+
| Component | Description |
|
|
449
|
+
|-----------|-------------|
|
|
450
|
+
| `Map` | Main map container. Requires explicit height via `className` or `style`. |
|
|
451
|
+
| `MapTileLayer` | Tile layer for map background. Supports `default`, `dark`, `satellite` variants. |
|
|
452
|
+
| `MapMarker` | Marker at a specific position. Can contain Popup and Tooltip children. |
|
|
453
|
+
| `MapPopup` | Popup that appears when a marker is clicked. |
|
|
454
|
+
| `MapTooltip` | Tooltip that appears on marker hover. |
|
|
455
|
+
| `MapZoomControl` | Custom zoom control positioning (MapContainer has built-in controls). |
|
|
456
|
+
|
|
457
|
+
### Fixing Marker Icons
|
|
458
|
+
|
|
459
|
+
Bundlers may break Leaflet's default marker icon paths. Fix by configuring icons in your app:
|
|
460
|
+
|
|
461
|
+
```tsx
|
|
462
|
+
import L from "leaflet"
|
|
463
|
+
|
|
464
|
+
delete (L.Icon.Default.prototype as any)._getIconUrl
|
|
465
|
+
L.Icon.Default.mergeOptions({
|
|
466
|
+
iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
|
|
467
|
+
iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
|
|
468
|
+
shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",
|
|
469
|
+
})
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### React StrictMode
|
|
473
|
+
|
|
474
|
+
When using React StrictMode, use unique keys on Map components to prevent "already initialized" errors:
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
const [mapKey] = useState(() => `map-${Date.now()}`)
|
|
478
|
+
|
|
479
|
+
<Map key={mapKey} center={[57.7089, 11.9746]} zoom={12}>
|
|
480
|
+
...
|
|
481
|
+
</Map>
|
|
482
|
+
```
|
|
483
|
+
|
|
384
484
|
## Customization
|
|
385
485
|
|
|
386
486
|
Override CSS variables after the import:
|