@rhavenside/baseline 2.0.8 → 2.1.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.
- package/README.md +241 -23
- package/dist/base-line.css +2 -2
- package/dist/base-line.css.map +1 -1
- package/dist/js/collapse.js +1 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ Or via CDN:
|
|
|
31
31
|
|
|
32
32
|
## Quick Start
|
|
33
33
|
|
|
34
|
+
Base-Line automatically includes [Cadence](https://www.npmjs.com/package/@rhavenside/cadence) for motion and [Scaffold](https://www.npmjs.com/package/@rhavenside/scaffold) for layouts. No additional setup required!
|
|
35
|
+
|
|
34
36
|
### CSS Only
|
|
35
37
|
|
|
36
38
|
Include the CSS file in your HTML:
|
|
@@ -45,8 +47,8 @@ Include the CSS file in your HTML:
|
|
|
45
47
|
<title>Base-Line Example</title>
|
|
46
48
|
</head>
|
|
47
49
|
<body>
|
|
48
|
-
<div class="
|
|
49
|
-
<div class="
|
|
50
|
+
<div class="scaffold-container">
|
|
51
|
+
<div class="scaffold-stack scaffold-stack--spacing-lg">
|
|
50
52
|
<h1>Hello Base-Line</h1>
|
|
51
53
|
<p>Welcome to the Base-Line Design System</p>
|
|
52
54
|
<button class="c-button c-button--primary">Get Started</button>
|
|
@@ -56,6 +58,8 @@ Include the CSS file in your HTML:
|
|
|
56
58
|
</html>
|
|
57
59
|
```
|
|
58
60
|
|
|
61
|
+
**Note:** The example above uses Scaffold layout classes (`scaffold-container`, `scaffold-stack`) for structured layouts. All components use Cadence motion mixins automatically for smooth, consistent animations.
|
|
62
|
+
|
|
59
63
|
### With JavaScript
|
|
60
64
|
|
|
61
65
|
For interactive components (modals, dropdowns, tooltips, etc.), include the JavaScript:
|
|
@@ -125,7 +129,7 @@ All design values are defined via CSS Custom Properties:
|
|
|
125
129
|
|
|
126
130
|
- **Colors**: Surface, Text, Accent, Border, State colors
|
|
127
131
|
- **Typography**: Font families, sizes, line-height, weight
|
|
128
|
-
- **Spacing**: Consistent step scale (
|
|
132
|
+
- **Spacing**: Consistent step scale (based on Scaffold spacing: 8px/0.5rem base)
|
|
129
133
|
- **Radius**: Border-radius values
|
|
130
134
|
- **Shadow**: Shadow definitions
|
|
131
135
|
- **Z-Index**: Z-index scale
|
|
@@ -135,15 +139,114 @@ All design values are defined via CSS Custom Properties:
|
|
|
135
139
|
|
|
136
140
|
### Layer 2: Layout System
|
|
137
141
|
|
|
138
|
-
Layout classes for standard layouts without custom CSS:
|
|
142
|
+
Layout classes for standard layouts without custom CSS (powered by [Scaffold](https://www.npmjs.com/package/@rhavenside/scaffold)):
|
|
139
143
|
|
|
140
|
-
- `
|
|
141
|
-
- `
|
|
142
|
-
- `
|
|
143
|
-
- `
|
|
144
|
+
- `scaffold-container` - Container with max-width + responsive padding
|
|
145
|
+
- `scaffold-stack` - Vertical layouts with spacing options
|
|
146
|
+
- `scaffold-grid` - Flexible grid layouts (responsive columns)
|
|
147
|
+
- `scaffold-padding-*` - Padding utilities (xs, sm, md, lg, xl, xxl) with directional variants
|
|
148
|
+
- `scaffold-margin-*` - Margin utilities (xs, sm, md, lg, xl, xxl) with directional variants
|
|
144
149
|
|
|
145
150
|
**Rule:** No colors, no typography in layout classes.
|
|
146
151
|
|
|
152
|
+
**Example:**
|
|
153
|
+
```html
|
|
154
|
+
<div class="scaffold-container">
|
|
155
|
+
<div class="scaffold-stack scaffold-stack--spacing-lg">
|
|
156
|
+
<h1>Title</h1>
|
|
157
|
+
<p>Content</p>
|
|
158
|
+
</div>
|
|
159
|
+
<div class="scaffold-grid scaffold-grid--cols-3">
|
|
160
|
+
<div class="c-card">Card 1</div>
|
|
161
|
+
<div class="c-card">Card 2</div>
|
|
162
|
+
<div class="c-card">Card 3</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Motion System (Cadence)
|
|
168
|
+
|
|
169
|
+
All animations and transitions use [Cadence](https://www.npmjs.com/package/@rhavenside/cadence) for consistent motion timing:
|
|
170
|
+
|
|
171
|
+
- **motion-response()** - For direct user interactions (150ms) - Used in buttons, inputs, form controls
|
|
172
|
+
- **motion-transition()** - For state changes (300ms) - Used in modals, dropdowns, tooltips, alerts
|
|
173
|
+
- **motion-ambient()** - For continuous animations (varies) - Used in spinners, progress bars
|
|
174
|
+
- **motion-instant()** - For immediate changes (0ms) - Used for instant state updates
|
|
175
|
+
|
|
176
|
+
All components automatically use the appropriate motion intention based on their interaction pattern. This ensures consistent, accessible animations throughout your application.
|
|
177
|
+
|
|
178
|
+
## How Cadence, Scaffold, and Baseline Work Together
|
|
179
|
+
|
|
180
|
+
Base-Line is built on three complementary systems that work seamlessly together:
|
|
181
|
+
|
|
182
|
+
### Baseline - The Design System
|
|
183
|
+
|
|
184
|
+
**Baseline** provides the core design system:
|
|
185
|
+
- **Components**: Buttons, Cards, Modals, Forms, and 20+ other UI components
|
|
186
|
+
- **Design Tokens**: Colors, typography, spacing, shadows, and other design values
|
|
187
|
+
- **Utilities**: Limited utility classes for common needs
|
|
188
|
+
|
|
189
|
+
### Scaffold - The Layout System
|
|
190
|
+
|
|
191
|
+
**Scaffold** provides structured layout classes:
|
|
192
|
+
- **Container**: `scaffold-container` for max-width containers with responsive padding
|
|
193
|
+
- **Stack**: `scaffold-stack` for vertical layouts with consistent spacing
|
|
194
|
+
- **Grid**: `scaffold-grid` for flexible, responsive grid layouts
|
|
195
|
+
- **Padding**: Responsive padding utilities
|
|
196
|
+
|
|
197
|
+
Scaffold handles the **structure** of your page - where things are positioned and how they're spaced.
|
|
198
|
+
|
|
199
|
+
> **Note:** Scaffold can also be used independently. See [@rhavenside/scaffold](https://www.npmjs.com/package/@rhavenside/scaffold) for standalone usage.
|
|
200
|
+
|
|
201
|
+
### Cadence - The Motion System
|
|
202
|
+
|
|
203
|
+
**Cadence** provides consistent motion and animations:
|
|
204
|
+
- **Motion Intentions**: Different timing for different interaction types
|
|
205
|
+
- `motion-response()` - Fast feedback for direct user actions (150ms)
|
|
206
|
+
- `motion-transition()` - Smooth state changes (300ms)
|
|
207
|
+
- `motion-ambient()` - Continuous animations (varies)
|
|
208
|
+
- **Automatic Integration**: All Baseline components automatically use Cadence for animations
|
|
209
|
+
|
|
210
|
+
Cadence handles the **motion** - how things animate and transition.
|
|
211
|
+
|
|
212
|
+
> **Note:** Cadence can also be used independently. See [@rhavenside/cadence](https://www.npmjs.com/package/@rhavenside/cadence) for standalone usage.
|
|
213
|
+
|
|
214
|
+
### Working Together
|
|
215
|
+
|
|
216
|
+
Here's how they work together in practice:
|
|
217
|
+
|
|
218
|
+
```html
|
|
219
|
+
<!-- Scaffold provides the layout structure -->
|
|
220
|
+
<div class="scaffold-container">
|
|
221
|
+
<div class="scaffold-stack scaffold-stack--spacing-lg">
|
|
222
|
+
|
|
223
|
+
<!-- Baseline provides the components -->
|
|
224
|
+
<h1>Welcome</h1>
|
|
225
|
+
<button class="c-button c-button--primary">Get Started</button>
|
|
226
|
+
|
|
227
|
+
<!-- Cadence automatically animates the button on hover/click -->
|
|
228
|
+
<!-- Scaffold provides spacing between elements -->
|
|
229
|
+
<div class="scaffold-grid scaffold-grid--cols-3">
|
|
230
|
+
<div class="c-card">
|
|
231
|
+
<!-- Cadence animates card hover states -->
|
|
232
|
+
Card 1
|
|
233
|
+
</div>
|
|
234
|
+
<div class="c-card">Card 2</div>
|
|
235
|
+
<div class="c-card">Card 3</div>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**In summary:**
|
|
242
|
+
- **Scaffold** = Where things go (layout structure)
|
|
243
|
+
- **Baseline** = What things look like (components and design)
|
|
244
|
+
- **Cadence** = How things move (animations and transitions)
|
|
245
|
+
|
|
246
|
+
All three are included automatically when you install `@rhavenside/baseline` - no additional setup required!
|
|
247
|
+
|
|
248
|
+
> **Note:** This is a high-level overview. Detailed documentation for each system is available in the [full documentation](https://baseline.rhavenside.de).
|
|
249
|
+
|
|
147
250
|
### Layer 3: Components
|
|
148
251
|
|
|
149
252
|
Fully functional components with JavaScript support:
|
|
@@ -204,13 +307,14 @@ Format: `--<category>-<meaning>[-<level>]`
|
|
|
204
307
|
|
|
205
308
|
### Layout Classes
|
|
206
309
|
|
|
207
|
-
Format: `
|
|
310
|
+
Format: `scaffold-<role>` (powered by [Scaffold](https://www.npmjs.com/package/@rhavenside/scaffold))
|
|
208
311
|
|
|
209
312
|
```html
|
|
210
|
-
<div class="
|
|
211
|
-
<div class="
|
|
212
|
-
<div class="
|
|
213
|
-
<div class="
|
|
313
|
+
<div class="scaffold-container">
|
|
314
|
+
<div class="scaffold-stack scaffold-stack--spacing-lg">
|
|
315
|
+
<div class="scaffold-stack scaffold-stack--horizontal scaffold-stack--align-center">
|
|
316
|
+
<div class="scaffold-grid scaffold-grid--cols-3">
|
|
317
|
+
<div class="scaffold-padding-sm scaffold-margin-top-md">
|
|
214
318
|
```
|
|
215
319
|
|
|
216
320
|
### Components
|
|
@@ -228,7 +332,7 @@ Format: `c-<component>`
|
|
|
228
332
|
- `c-alert--danger`, `c-alert--success`
|
|
229
333
|
|
|
230
334
|
**Global States:**
|
|
231
|
-
- `is-
|
|
335
|
+
- `is-active`, `is-disabled`, `is-show` (for collapse/accordion)
|
|
232
336
|
- `is-loading`, `is-open`, `has-error`
|
|
233
337
|
|
|
234
338
|
### Utilities
|
|
@@ -400,19 +504,68 @@ const tooltip = window.BaseLine.Tooltip.getOrCreateInstance(element)
|
|
|
400
504
|
### Form
|
|
401
505
|
|
|
402
506
|
```html
|
|
403
|
-
<div class="
|
|
404
|
-
<
|
|
405
|
-
|
|
406
|
-
</
|
|
507
|
+
<div class="scaffold-container scaffold-container--narrow">
|
|
508
|
+
<div class="scaffold-stack scaffold-stack--spacing-md">
|
|
509
|
+
<div class="scaffold-stack scaffold-stack--spacing-sm">
|
|
510
|
+
<label class="c-form-label" for="email">Email</label>
|
|
511
|
+
<input type="email" class="c-form-control" id="email" placeholder="name@example.com">
|
|
512
|
+
</div>
|
|
407
513
|
|
|
408
|
-
<div class="
|
|
409
|
-
|
|
410
|
-
|
|
514
|
+
<div class="scaffold-stack scaffold-stack--spacing-sm">
|
|
515
|
+
<label class="c-form-label" for="password">Password</label>
|
|
516
|
+
<input type="password" class="c-form-control" id="password">
|
|
517
|
+
</div>
|
|
518
|
+
|
|
519
|
+
<button type="submit" class="c-button c-button--primary">Submit</button>
|
|
520
|
+
</div>
|
|
411
521
|
</div>
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**Note:** This example demonstrates Scaffold layout classes for structured form layouts. All form inputs automatically use Cadence motion-response() for smooth focus and interaction transitions.
|
|
412
525
|
|
|
413
|
-
|
|
526
|
+
### Accordion
|
|
527
|
+
|
|
528
|
+
```html
|
|
529
|
+
<div class="c-accordion" id="accordionExample">
|
|
530
|
+
<div class="c-accordion-item">
|
|
531
|
+
<h2 class="c-accordion-header">
|
|
532
|
+
<button
|
|
533
|
+
class="c-accordion-button"
|
|
534
|
+
type="button"
|
|
535
|
+
data-c-toggle="collapse"
|
|
536
|
+
data-c-target="#collapseOne"
|
|
537
|
+
data-c-parent="#accordionExample">
|
|
538
|
+
Accordion Item #1
|
|
539
|
+
</button>
|
|
540
|
+
</h2>
|
|
541
|
+
<div id="collapseOne" class="c-collapse is-show" data-c-parent="#accordionExample">
|
|
542
|
+
<div class="c-accordion-body">
|
|
543
|
+
This is the first accordion body. It is open by default (has `is-show` class).
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
</div>
|
|
547
|
+
<div class="c-accordion-item">
|
|
548
|
+
<h2 class="c-accordion-header">
|
|
549
|
+
<button
|
|
550
|
+
class="c-accordion-button c-collapsed"
|
|
551
|
+
type="button"
|
|
552
|
+
data-c-toggle="collapse"
|
|
553
|
+
data-c-target="#collapseTwo"
|
|
554
|
+
data-c-parent="#accordionExample">
|
|
555
|
+
Accordion Item #2
|
|
556
|
+
</button>
|
|
557
|
+
</h2>
|
|
558
|
+
<div id="collapseTwo" class="c-collapse" data-c-parent="#accordionExample">
|
|
559
|
+
<div class="c-accordion-body">
|
|
560
|
+
This is the second accordion body. It is closed by default (no `is-show` class, button has `c-collapsed`).
|
|
561
|
+
</div>
|
|
562
|
+
</div>
|
|
563
|
+
</div>
|
|
564
|
+
</div>
|
|
414
565
|
```
|
|
415
566
|
|
|
567
|
+
**Note:** By default, only the first accordion item should be open (with `is-show` class on the collapse element). Other items should be closed (no `is-show` class, button has `c-collapsed` class). Accordions use Cadence motion-transition() for smooth expand/collapse animations.
|
|
568
|
+
|
|
416
569
|
## Dark Mode
|
|
417
570
|
|
|
418
571
|
Dark mode is automatically activated via `prefers-color-scheme`. Additionally, the `.theme-dark` class can be set manually:
|
|
@@ -461,7 +614,72 @@ Base-Line supports all modern browsers:
|
|
|
461
614
|
|
|
462
615
|
## Dependencies
|
|
463
616
|
|
|
464
|
-
-
|
|
617
|
+
Base-Line includes the following peer dependencies that are automatically installed:
|
|
618
|
+
|
|
619
|
+
- **@rhavenside/cadence**: ^1.0.1 - Motion system for consistent animations and transitions
|
|
620
|
+
- **@rhavenside/scaffold**: ^1.1.7 - Layout system for structured page layouts
|
|
621
|
+
- **@popperjs/core**: ^2.11.8 - For positioning tooltips, popovers, and dropdowns
|
|
622
|
+
|
|
623
|
+
All dependencies are automatically installed when you install `@rhavenside/baseline`. No additional setup required!
|
|
624
|
+
|
|
625
|
+
## Version History
|
|
626
|
+
|
|
627
|
+
### Version 2.1.0 and above
|
|
628
|
+
|
|
629
|
+
**New Dependencies: Scaffold and Cadence Integration**
|
|
630
|
+
|
|
631
|
+
Version 2.1.0 introduces two new integrated systems:
|
|
632
|
+
|
|
633
|
+
**Scaffold Layout System (NEW)**
|
|
634
|
+
|
|
635
|
+
- **Scaffold is now included**: Scaffold layout classes are now part of Base-Line
|
|
636
|
+
- **Layout Classes Available**: Use `scaffold-container`, `scaffold-stack`, `scaffold-grid` for structured page layouts
|
|
637
|
+
- **Responsive by Default**: All Scaffold classes are responsive and work seamlessly with Baseline components
|
|
638
|
+
|
|
639
|
+
**Cadence Motion System Integration**
|
|
640
|
+
|
|
641
|
+
All interactive components now use the Cadence motion system for consistent, accessible animations:
|
|
642
|
+
|
|
643
|
+
- **Motion-Mixins in Components**: 10 components have been updated to use Cadence motion mixins:
|
|
644
|
+
- `motion-transition()` for state changes (Alert, Toast, Tooltip, Popover, Dropdown, Accordion, Floating Label)
|
|
645
|
+
- `motion-response()` for direct user interactions (Form Range, List Group)
|
|
646
|
+
- **Consistent Animation Timing**: All components now follow the same motion principles:
|
|
647
|
+
- 150ms for direct user interactions (`motion-response`)
|
|
648
|
+
- 300ms for state changes (`motion-transition`)
|
|
649
|
+
- **Improved Documentation**: README now includes comprehensive documentation for:
|
|
650
|
+
- Cadence motion system integration
|
|
651
|
+
- Scaffold layout system usage
|
|
652
|
+
- Dependencies and their purposes
|
|
653
|
+
|
|
654
|
+
**Benefits:**
|
|
655
|
+
- Structured layout system (Scaffold) for consistent page layouts
|
|
656
|
+
- More consistent animations across all components (Cadence)
|
|
657
|
+
- Better accessibility (respects `prefers-reduced-motion`)
|
|
658
|
+
- Easier to maintain and extend motion behavior
|
|
659
|
+
- Clear motion intentions for different interaction types
|
|
660
|
+
|
|
661
|
+
### Version 2.0.8 and below
|
|
662
|
+
|
|
663
|
+
**Before 2.1.0:**
|
|
664
|
+
|
|
665
|
+
- **No Scaffold**: Layout classes were not available - developers had to create their own layout solutions
|
|
666
|
+
- **No unified motion system**: Components used hardcoded transition values or CSS variables for animations
|
|
667
|
+
- **Manual transition timing**: Manual transition timing management required
|
|
668
|
+
- **Less consistent**: Less consistent animation behavior across components
|
|
669
|
+
|
|
670
|
+
**Migration Notes:**
|
|
671
|
+
|
|
672
|
+
If you're upgrading from 2.0.8 or earlier:
|
|
673
|
+
|
|
674
|
+
- **No breaking changes**: All existing code will continue to work without modifications
|
|
675
|
+
- **Scaffold is NEW**: Scaffold layout classes (`scaffold-container`, `scaffold-stack`, `scaffold-grid`, etc.) are now available in Base-Line 2.1.0. You can start using them for structured page layouts
|
|
676
|
+
- **Motion improvements are internal**: The Cadence motion mixins are internal improvements that make animations more consistent. Existing component behavior remains the same
|
|
677
|
+
- **New features available**: You can now take advantage of:
|
|
678
|
+
- Scaffold layout system for structured page layouts
|
|
679
|
+
- More consistent animations (automatic, no code changes needed)
|
|
680
|
+
- Better motion system documentation
|
|
681
|
+
|
|
682
|
+
If you were using custom transitions that override component defaults, you may want to review them to ensure they align with the new motion system principles (150ms for interactions, 300ms for state changes).
|
|
465
683
|
|
|
466
684
|
## License
|
|
467
685
|
|