baseline-ds 0.1.4

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 (36) hide show
  1. package/README.md +330 -0
  2. package/dist/index.css +1970 -0
  3. package/dist/index.css.map +1 -0
  4. package/dist/index.d.mts +743 -0
  5. package/dist/index.d.ts +743 -0
  6. package/dist/index.js +3843 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/index.mjs +3756 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/tokens/baseline/css/variables.css +278 -0
  11. package/dist/tokens/baseline/js/tokens.js +223 -0
  12. package/dist/tokens/baseline/json/tokens.json +305 -0
  13. package/dist/tokens/baseline/scss/_variables.scss +222 -0
  14. package/dist/tokens/baseline-pro/css/variables.css +278 -0
  15. package/dist/tokens/baseline-pro/js/tokens.js +223 -0
  16. package/dist/tokens/baseline-pro/json/tokens.json +305 -0
  17. package/dist/tokens/baseline-pro/scss/_variables.scss +222 -0
  18. package/dist/tokens/offset/css/variables.css +278 -0
  19. package/dist/tokens/offset/js/tokens.js +223 -0
  20. package/dist/tokens/offset/json/tokens.json +305 -0
  21. package/dist/tokens/offset/scss/_variables.scss +222 -0
  22. package/dist/tokens/primitives/css/variables.css +183 -0
  23. package/dist/tokens/primitives/js/tokens.js +181 -0
  24. package/dist/tokens/primitives/json/tokens.json +229 -0
  25. package/dist/tokens/primitives/scss/_variables.scss +180 -0
  26. package/dist/tokens/semantic/css/variables.css +48 -0
  27. package/dist/tokens/semantic/js/tokens.js +265 -0
  28. package/dist/tokens/semantic/json/tokens.json +395 -0
  29. package/dist/tokens/semantic/scss/_variables.scss +264 -0
  30. package/package.json +84 -0
  31. package/src/fonts.css +17 -0
  32. package/tokens/token_0001PrimitiveBrand_Baseline.json +204 -0
  33. package/tokens/token_0001PrimitiveBrand_BaselinePro.json +204 -0
  34. package/tokens/token_0001PrimitiveBrand_Offset.json +204 -0
  35. package/tokens/token_0100SemanticCore_Mode1.json +218 -0
  36. package/tokens/token__0000PrimitiveCore_Mode1.json +760 -0
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # Baseline Design System
2
+
3
+ A comprehensive design system with tokens, components, icons, and Storybook documentation.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Design Tokens** - Multi-brand token system with primitives, brand overrides, and semantic tokens
8
+ - 🧩 **React Components** - Reusable, accessible components built with TypeScript
9
+ - 🎯 **Icon System** - 50+ SVG icons as React components
10
+ - 🎭 **Multi-Brand Support** - Switch between Baseline, Baseline Pro, and Offset themes
11
+ - 📚 **Storybook Documentation** - Interactive component documentation and examples
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @baseline/design-system
17
+ ```
18
+
19
+ ## Design Tokens
20
+
21
+ The design system uses a cascading token architecture:
22
+
23
+ 1. **Primitive Core** (`0000PrimitiveCore_Mode1.json`) - Base values (colors, spacing, typography)
24
+ 2. **Brand Overrides** (`0001PrimitiveBrand_*.json`) - Brand-specific customizations
25
+ 3. **Semantic Layer** (`0100SemanticCore_Mode1.json`) - Contextual tokens that reference primitives and brands
26
+
27
+ ### Using Tokens
28
+
29
+ #### CSS Variables
30
+
31
+ ```css
32
+ /* Import primitives, brand, and semantic tokens */
33
+ @import '@baseline/design-system/tokens/css';
34
+
35
+ /* Use in your CSS */
36
+ .button {
37
+ background-color: var(--brand-color-brand-100);
38
+ padding: var(--spacing-scale-050) var(--spacing-scale-070);
39
+ border-radius: var(--brand-sizing-radius-small);
40
+ font-family: var(--brand-typography-font-family-body);
41
+ font-size: var(--brand-sizing-typography-font-size-paragraph-medium);
42
+ }
43
+ ```
44
+
45
+ #### JavaScript/TypeScript
46
+
47
+ ```typescript
48
+ import tokens from '@baseline/design-system/tokens/json';
49
+
50
+ const primaryColor = tokens.color.brand[100];
51
+ const spacing = tokens.spacing.scale[50];
52
+ ```
53
+
54
+ #### SCSS
55
+
56
+ ```scss
57
+ @import '@baseline/design-system/tokens/scss';
58
+
59
+ .button {
60
+ background-color: $brand-color-brand-100;
61
+ padding: $spacing-scale-050 $spacing-scale-070;
62
+ }
63
+ ```
64
+
65
+ ### Available Token Formats
66
+
67
+ - `@baseline/design-system/tokens/css` - CSS variables
68
+ - `@baseline/design-system/tokens/scss` - SCSS variables
69
+ - `@baseline/design-system/tokens/js` - JavaScript/ES modules
70
+ - `@baseline/design-system/tokens/json` - JSON format
71
+
72
+ ### Brand-Specific Tokens
73
+
74
+ You can also import brand-specific token files:
75
+
76
+ - `@baseline/design-system/tokens/css/baseline`
77
+ - `@baseline/design-system/tokens/css/baseline-pro`
78
+ - `@baseline/design-system/tokens/css/offset`
79
+
80
+ ## Components
81
+
82
+ ### Button
83
+
84
+ A flexible button component with multiple variants, states, and shapes.
85
+
86
+ ```typescript
87
+ import { Button } from '@baseline/design-system';
88
+
89
+ // Basic usage
90
+ <Button label="Click me" />
91
+
92
+ // With icon
93
+ <Button
94
+ label="Download"
95
+ leadingIcon
96
+ icon={<IconDownload size={12} />}
97
+ />
98
+
99
+ // Different variants
100
+ <Button
101
+ label="Button"
102
+ hierarchy="Primary"
103
+ shape="Pill"
104
+ state="Default"
105
+ />
106
+ ```
107
+
108
+ #### Button Props
109
+
110
+ | Prop | Type | Default | Description |
111
+ |------|------|---------|-------------|
112
+ | `label` | `string` | `"Button"` | Button text |
113
+ | `leadingIcon` | `boolean` | `false` | Show icon before text |
114
+ | `icon` | `React.ReactNode` | `null` | Custom icon component |
115
+ | `chevron` | `boolean` | `false` | Show chevron on the right |
116
+ | `shape` | `'Rectangle' \| 'Pill' \| 'Circle'` | `'Rectangle'` | Button shape |
117
+ | `state` | `'Default' \| 'Hover' \| 'Active' \| 'Focus' \| 'Disabled'` | `'Default'` | Button state |
118
+ | `hierarchy` | `'Primary' \| 'Secondary' \| 'Tertiary'` | `'Primary'` | Button importance |
119
+ | `disabled` | `boolean` | `false` | Disable the button |
120
+ | `onClick` | `() => void` | - | Click handler |
121
+ | `className` | `string` | `''` | Additional CSS classes |
122
+
123
+ ## Icons
124
+
125
+ The design system includes 50+ icons as React components. All icons are tree-shakeable and customizable.
126
+
127
+ ### Available Icons
128
+
129
+ - `IconArrowRight`, `IconArrowLeft`
130
+ - `IconChevronDown`, `IconChevronUp`, `IconChevronLeft`, `IconChevronRight`
131
+ - `IconSettings`, `IconDownload`, `IconPlus`, `IconMinus`
132
+ - `IconAlert`, `IconError`, `IconWarning`, `IconSuccess`
133
+ - `IconChat`, `IconCamera`, `IconVideo`, `IconMicrophone`
134
+ - And 40+ more...
135
+
136
+ ### Using Icons
137
+
138
+ ```typescript
139
+ import { IconArrowRight, IconDownload, IconSettings } from '@baseline/design-system';
140
+
141
+ // Basic usage
142
+ <IconArrowRight size={24} />
143
+
144
+ // Custom size and color
145
+ <IconSettings
146
+ size={16}
147
+ color="var(--brand-color-brand-100)"
148
+ />
149
+
150
+ // With accessibility
151
+ <IconDownload
152
+ size={20}
153
+ aria-label="Download file"
154
+ />
155
+
156
+ // In a Button
157
+ <Button
158
+ label="Download"
159
+ leadingIcon
160
+ icon={<IconDownload size={12} />}
161
+ />
162
+ ```
163
+
164
+ ### Icon Props
165
+
166
+ All icons accept the same props:
167
+
168
+ | Prop | Type | Default | Description |
169
+ |------|------|---------|-------------|
170
+ | `size` | `number \| string` | `24` | Icon size (width and height) |
171
+ | `color` | `string` | `'currentColor'` | Icon color (inherits text color by default) |
172
+ | `className` | `string` | - | Additional CSS classes |
173
+ | `aria-label` | `string` | - | Accessibility label |
174
+ | `aria-hidden` | `boolean` | - | Hide from screen readers (auto-set if no aria-label) |
175
+
176
+ Icons use `currentColor` by default, so they automatically inherit the text color from their parent element, making them theme-aware.
177
+
178
+ ### Generating Icons
179
+
180
+ Icons are generated from SVG files in `src/assets/icons`. To regenerate icons after adding new SVGs:
181
+
182
+ ```bash
183
+ npm run generate-icons
184
+ ```
185
+
186
+ ## Brand Themes
187
+
188
+ The design system supports three brand themes:
189
+
190
+ - **Baseline** (default)
191
+ - **Baseline Pro**
192
+ - **Offset**
193
+
194
+ ### Switching Themes in Storybook
195
+
196
+ Use the "Brand Theme" dropdown in the Storybook toolbar to switch between themes. All components and tokens will update automatically.
197
+
198
+ ### Using Themes in Your Application
199
+
200
+ ```css
201
+ /* Import the brand-specific CSS */
202
+ @import '@baseline/design-system/tokens/css/baseline';
203
+ /* or */
204
+ @import '@baseline/design-system/tokens/css/baseline-pro';
205
+ /* or */
206
+ @import '@baseline/design-system/tokens/css/offset';
207
+ ```
208
+
209
+ ## Development
210
+
211
+ ### Prerequisites
212
+
213
+ - Node.js 18+
214
+ - npm or yarn
215
+
216
+ ### Setup
217
+
218
+ ```bash
219
+ # Install dependencies
220
+ npm install
221
+
222
+ # Build tokens
223
+ npm run build:tokens
224
+
225
+ # Start Storybook
226
+ npm run storybook
227
+ ```
228
+
229
+ ### Available Scripts
230
+
231
+ | Script | Description |
232
+ |--------|-------------|
233
+ | `npm run build` | Build tokens and components |
234
+ | `npm run build:tokens` | Build all token files for all brands |
235
+ | `npm run build:components` | Build React components |
236
+ | `npm run generate-icons` | Generate icon components from SVG files |
237
+ | `npm run storybook` | Start Storybook development server |
238
+ | `npm run build-storybook` | Build static Storybook site |
239
+ | `npm run fetch-tokens` | Fetch latest tokens from Zeroheight API |
240
+
241
+ ### Project Structure
242
+
243
+ ```
244
+ baseline-design-system/
245
+ ├── src/
246
+ │ ├── assets/
247
+ │ │ └── icons/ # SVG icon files
248
+ │ ├── components/ # React components
249
+ │ ├── icons/ # Generated icon components
250
+ │ └── tokens/ # Token exports
251
+ ├── tokens/ # Source token files (from Zeroheight)
252
+ ├── dist/ # Built output
253
+ ├── scripts/ # Build and utility scripts
254
+ └── .storybook/ # Storybook configuration
255
+ ```
256
+
257
+ ### Token Architecture
258
+
259
+ Tokens follow a cascading structure:
260
+
261
+ 1. **Primitives** (`0000PrimitiveCore_Mode1.json`)
262
+ - Base color palettes (azure, blue, brick, emerald, etc.)
263
+ - Base spacing and sizing scales
264
+ - Base typography values
265
+
266
+ 2. **Brand Overrides** (`0001PrimitiveBrand_*.json`)
267
+ - Brand-specific color mappings
268
+ - Brand-specific sizing overrides
269
+ - References primitive tokens where values match
270
+
271
+ 3. **Semantic Layer** (`0100SemanticCore_Mode1.json`)
272
+ - Contextual tokens (e.g., `color.typography.primary.default`)
273
+ - References both primitives and brand tokens
274
+ - Provides meaning-based naming
275
+
276
+ ### Token Transformations
277
+
278
+ The build process applies several transformations:
279
+
280
+ - **Sizing**: Pixels → rems (base 16px, 3 decimal places)
281
+ - **Typography**: Points → rems (base 12pt, 3 decimal places)
282
+ - **Line Height**: Raw value → unitless (divided by 100)
283
+ - **Font Families**: Adds `sans-serif` fallback
284
+ - **Font Weight**: Used as-is (no transformation)
285
+
286
+ ## Building for Production
287
+
288
+ ```bash
289
+ # Build everything
290
+ npm run build
291
+
292
+ # The dist/ folder will contain:
293
+ # - Built components (CJS and ESM)
294
+ # - TypeScript declarations
295
+ # - Token files (CSS, SCSS, JS, JSON)
296
+ ```
297
+
298
+ ## Publishing
299
+
300
+ The package is configured for private npm publishing. See [PRIVATE_NPM_SETUP.md](./PRIVATE_NPM_SETUP.md) for detailed instructions on:
301
+
302
+ - Setting up private npm registry (GitHub Packages, private registry, etc.)
303
+ - Publishing the package
304
+ - Configuring consuming repositories
305
+ - CI/CD setup
306
+ - Authentication and troubleshooting
307
+
308
+ ### Quick Start
309
+
310
+ 1. Configure your registry in `.npmrc`
311
+ 2. Build: `npm run build`
312
+ 3. Update version: `npm version patch|minor|major`
313
+ 4. Publish: `npm publish`
314
+
315
+ ## License
316
+
317
+ MIT
318
+
319
+ ## Contributing
320
+
321
+ This design system is synced with Zeroheight. Token files are automatically updated via GitHub integration.
322
+
323
+ To add new components or icons:
324
+
325
+ 1. Add component files to `src/components/`
326
+ 2. Add SVG icons to `src/assets/icons/`
327
+ 3. Run `npm run generate-icons` to regenerate icon components
328
+ 4. Update exports in `src/index.ts`
329
+ 5. Add Storybook stories in `.storybook/`
330
+