@geowiki/design-system 0.16.0-dev.1 → 0.16.0-dev.2

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 (2) hide show
  1. package/README.md +254 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # @geowiki/design-system
2
+
3
+ The foundational UI component library for the GeoWiki platform. This package provides accessible, themeable components built on [Radix UI](https://www.radix-ui.com/) primitives, a comprehensive icon set, design tokens, and shared utilities — all styled with [Tailwind CSS](https://tailwindcss.com/).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @geowiki/design-system
9
+ ```
10
+
11
+ **Peer dependencies:** `react >= 18.2.0` and `react-dom >= 18.2.0`
12
+
13
+ ## Setup
14
+
15
+ ### 1. Import styles
16
+
17
+ Import the package stylesheet in your application entry point:
18
+
19
+ ```tsx
20
+ import "@geowiki/design-system/styles.css";
21
+ ```
22
+
23
+ ### 2. Extend Tailwind config
24
+
25
+ To use the design system's Tailwind theme (colors, typography, animations) in your own components:
26
+
27
+ ```js
28
+ // tailwind.config.js
29
+ const designSystemConfig = require("@geowiki/design-system/tailwind-config");
30
+
31
+ /** @type {import('tailwindcss').Config} */
32
+ module.exports = {
33
+ presets: [designSystemConfig],
34
+ content: [
35
+ "./src/**/*.{js,ts,jsx,tsx}",
36
+ // Include design-system components in Tailwind's content scan
37
+ "./node_modules/@geowiki/design-system/dist/**/*.{js,mjs}",
38
+ ],
39
+ };
40
+ ```
41
+
42
+ ### 3. Import components
43
+
44
+ ```tsx
45
+ import { Button, Dialog, DialogContent, DialogTrigger, cn } from "@geowiki/design-system";
46
+ ```
47
+
48
+ ## Package Exports
49
+
50
+ | Export Path | Description |
51
+ | ---------------------------------- | ------------------------------------------ |
52
+ | `@geowiki/design-system` | All components, icons, hooks, and utilities |
53
+ | `@geowiki/design-system/styles.css` | Compiled CSS (Tailwind + design tokens) |
54
+ | `@geowiki/design-system/tailwind-config` | Tailwind configuration preset |
55
+
56
+ ## Component Catalog
57
+
58
+ ### UI Primitives
59
+
60
+ 41 accessible, unstyled-by-default components built on Radix UI, styled with Tailwind and `class-variance-authority`:
61
+
62
+ | Component | Component | Component | Component |
63
+ | --------- | --------- | --------- | --------- |
64
+ | Accordion | Alert | AlertDialog | AspectRatio |
65
+ | Avatar | Badge | Button | Calendar |
66
+ | Card | Checkbox | Collapsible | Command |
67
+ | ContextMenu | Dialog | DropdownMenu | Form |
68
+ | HoverCard | Input | Label | Menubar |
69
+ | NavigationMenu | Popover | Progress | RadioGroup |
70
+ | ScrollArea | Select | Separator | Sheet |
71
+ | Skeleton | Slider | Switch | Table |
72
+ | Tabs | Tag | TagList | Textarea |
73
+ | Toast | Toaster | Toggle | Tooltip |
74
+ | useToast | | | |
75
+
76
+ ### Icons
77
+
78
+ 28 custom SVG icon components for application UI:
79
+
80
+ `AccountIcon` `AtomIcon` `BookTextIcon` `CalendarIcon` `CameraIcon` `ChartLineDotsIcon` `ChatsIcons` `ClipboardIcon` `CpuIcon` `DesktopCodeIcon` `FarmerClustersIcon` `GridDividersIcon` `HardDriveIcon` `HeadphonesIcon` `ImageIcon` `LayerGroupIcon` `LegendIcon` `MapLayersIcon` `MicroscopeIcon` `MinusIcon` `PlusIcon` `ResourcesIcon` `SettingsIcon` `StopWatchCheckIcon` `UserGroupIcon` `VideoPlayIcon` `XIcon`
81
+
82
+ A polymorphic `Icon` component is also available for dynamic icon rendering.
83
+
84
+ ### Map Icons
85
+
86
+ 11 specialized icons for GIS and map visualization:
87
+
88
+ `Download` `FarmerClusterPin` `Hexagon` `IconPaths` `Legend` `LocationIcon` `MapIcon` `Microscope` `ObservationPin` `Overlay` `UsersGroup`
89
+
90
+ ### Design Elements
91
+
92
+ 22 higher-level, application-specific components:
93
+
94
+ `AboutInfoItem` `Breadcrumb` `DesignButton` `Carousel` `DesignCheckbox` `Cookies` `Country` `Infobox` `DesignInput` `KeyInfoItem` `LastUpdatedTag` `NoResults` `DesignRadioGroup` `DesignSelect` `SimpleTag` `DesignSwitch` `DesignTag` `TagsGroup` `TestWeight` `ThreeColumn` `Typography` `VersionDisplay`
95
+
96
+ ### Elements
97
+
98
+ 15 utility and presentation components:
99
+
100
+ `ElementButton` `ButtonLink` `Error` `FeatureDisabled` `IframeViewer` `Loader` `LocalLoader` `MediaEmbedItem` `PermissionDisabled` `ShowLargeText` `ShowShortText` `SizedImage` `UnderConstruction` `DisplayItem`
101
+
102
+ ### Shared Components
103
+
104
+ Reusable composite components and hooks:
105
+
106
+ | Component | Description |
107
+ | --------- | ----------- |
108
+ | `CustomTable` | Data table built on `@tanstack/react-table` |
109
+ | `FullPageLoader` | Full-screen loading overlay |
110
+ | `CustomImage` | Enhanced image component |
111
+ | `Loader` | Inline loading spinner |
112
+ | `Pagination` | Page navigation controls |
113
+ | `Search` | Search input with debounce |
114
+ | `ThemeSwitcher` | Light/dark theme toggle |
115
+ | `useDebounce` | Debounce hook for values |
116
+
117
+ ### Buttons & Inputs
118
+
119
+ | Component | Description |
120
+ | --------- | ----------- |
121
+ | `DeleteButton` | Destructive action button |
122
+ | `PrimaryButton` | Primary CTA button |
123
+ | `OldCustomInput` | Legacy styled input |
124
+ | `MultiSelect` | Multi-value select (react-select) |
125
+ | `TextArea` | Styled textarea |
126
+
127
+ ### Other
128
+
129
+ | Component | Description |
130
+ | --------- | ----------- |
131
+ | `UmamiAnalytics` | Umami analytics script injection |
132
+ | `HeroImage` | Hero section image component |
133
+ | `Horizontal` | Horizontal panel layout |
134
+
135
+ ## Utilities
136
+
137
+ | Export | Description |
138
+ | ------ | ----------- |
139
+ | `cn(...inputs)` | Merges class names using `clsx` + `tailwind-merge`. Use this instead of raw string concatenation to avoid Tailwind class conflicts. |
140
+ | `getPages(totalItems, pageSize)` | Calculates pagination metadata (total pages, offsets). |
141
+
142
+ ## Models
143
+
144
+ | Export | Description |
145
+ | ------ | ----------- |
146
+ | `LinkButtonItem` | TypeScript interface for link button configuration objects. |
147
+
148
+ ## Design Tokens
149
+
150
+ The package ships a comprehensive set of CSS custom properties defined in `src/styles/tokens.css`. These tokens drive the Tailwind theme and can be overridden for theming.
151
+
152
+ ### Color System
153
+
154
+ - **Primary scale:** `--primary-50` through `--primary-950` (11 steps)
155
+ - **Semantic colors:** `--background`, `--foreground`, `--card`, `--popover`, `--muted`, `--secondary`, `--accent`, `--destructive`, `--border`, `--input`, `--ring`
156
+ - **Tag palette:** 11 named tag colors — blue, dark-blue, light-green, dark-green, orange, light-purple, purple, dark-purple, pink, turquoise, yellow
157
+ - **Legacy colors:** `--primary-black`, `--primary-green`, `--primary-white`, `--system-error`
158
+
159
+ ### Typography
160
+
161
+ Fonts: **Montserrat** (primary), **Open Sans**, **Hanken Grotesk**
162
+
163
+ | Scale | Sizes |
164
+ | ----- | ----- |
165
+ | Headings | `h1`–`h9` (with accent/italic variants for `h1`, `h2`) |
166
+ | Body | `body-12`, `body-14`, `body-15`, `body-16`, `body-18`, `body-20` (with medium/semibold/bold variants) |
167
+ | Landing | `landing-title` (80px, with accent italic variant) |
168
+ | Caption | `caption` (16px, tracked) |
169
+
170
+ ## Architecture
171
+
172
+ ```
173
+ @geowiki/design-system
174
+ ├── src/
175
+ │ ├── components/
176
+ │ │ ├── ui/ # Radix UI primitives (41)
177
+ │ │ ├── Icons/ # Custom SVG icons (28)
178
+ │ │ │ └── MapIcons/ # GIS-specific icons (11)
179
+ │ │ ├── DesignElements/ # Application components (22)
180
+ │ │ ├── Elements/ # Utility components (15)
181
+ │ │ ├── Shared/ # Composite components (8) + hooks
182
+ │ │ ├── Button/ # Specialized buttons (2)
183
+ │ │ ├── Input/ # Input variants (3)
184
+ │ │ ├── Analytics/ # Analytics integration
185
+ │ │ ├── Hero/ # Hero section
186
+ │ │ └── Panel/ # Panel layouts
187
+ │ ├── lib/
188
+ │ │ ├── utils.ts # cn(), getPages()
189
+ │ │ ├── models/ # TypeScript interfaces
190
+ │ │ └── styles/
191
+ │ │ └── tokens.css # CSS custom properties
192
+ │ └── index.tsx # Barrel export
193
+ ├── tailwind.config.js # Tailwind theme (importable as preset)
194
+ ├── styles.css # Entry point for CSS build
195
+ └── tsup.config.ts # Build configuration
196
+ ```
197
+
198
+ ### How it fits in the monorepo
199
+
200
+ ```
201
+ geowiki app → @geowiki/ui → @geowiki/design-system
202
+ (business UI) (primitives & tokens)
203
+ ```
204
+
205
+ `@geowiki/design-system` contains only standalone, dependency-free UI components. It has no knowledge of APIs, state management, or application logic. The `@geowiki/ui` package imports from design-system and adds business-specific behavior (API integration, store bindings, etc.).
206
+
207
+ ## Development
208
+
209
+ ### Scripts
210
+
211
+ ```bash
212
+ pnpm build # Build with tsup + Tailwind CSS
213
+ pnpm lint # ESLint
214
+ pnpm type-check # TypeScript validation
215
+ pnpm clean # Remove dist, node_modules, .turbo
216
+ ```
217
+
218
+ ### Build output
219
+
220
+ The build produces three artifacts in `dist/`:
221
+
222
+ | File | Format | Description |
223
+ | ---- | ------ | ----------- |
224
+ | `index.js` | CommonJS | Node.js / bundler import |
225
+ | `index.mjs` | ESM | Modern bundler import |
226
+ | `index.d.ts` | TypeScript | Type declarations |
227
+ | `styles.css` | CSS | Minified Tailwind + tokens |
228
+
229
+ ### Adding a new component
230
+
231
+ 1. Create the component in the appropriate `src/components/` subdirectory.
232
+ 2. Export it from `src/index.tsx`.
233
+ 3. If the component uses new design tokens, add the CSS custom properties to `src/styles/tokens.css` and map them in `tailwind.config.js`.
234
+ 4. Run `pnpm build` to verify the build succeeds.
235
+
236
+ ## Tech Stack
237
+
238
+ | Concern | Library |
239
+ | ------- | ------- |
240
+ | Component primitives | [Radix UI](https://www.radix-ui.com/) |
241
+ | Styling | [Tailwind CSS 3.3](https://tailwindcss.com/) |
242
+ | Variant API | [class-variance-authority](https://cva.style/) |
243
+ | Class merging | [clsx](https://github.com/lukeed/clsx) + [tailwind-merge](https://github.com/dcastil/tailwind-merge) |
244
+ | Icons | Custom SVG + [Lucide React](https://lucide.dev/) + [Heroicons](https://heroicons.com/) |
245
+ | Data tables | [@tanstack/react-table](https://tanstack.com/table) |
246
+ | Multi-select | [react-select](https://react-select.com/) |
247
+ | Calendar | [react-day-picker](https://react-day-picker.js.org/) |
248
+ | Carousel | [Embla Carousel](https://www.embla-carousel.com/) |
249
+ | Command palette | [cmdk](https://cmdk.paco.me/) |
250
+ | Build tool | [tsup](https://tsup.egoist.dev/) |
251
+
252
+ ## License
253
+
254
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geowiki/design-system",
3
- "version": "0.16.0-dev.1",
3
+ "version": "0.16.0-dev.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [