@rhavenside/baseline 2.0.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 (80) hide show
  1. package/README.md +472 -0
  2. package/dist/base-line.css +5 -0
  3. package/dist/base-line.css.map +1 -0
  4. package/dist/fonts/GoogleSansCode-Bold.ttf +0 -0
  5. package/dist/fonts/GoogleSansCode-BoldItalic.ttf +0 -0
  6. package/dist/fonts/GoogleSansCode-ExtraBold.ttf +0 -0
  7. package/dist/fonts/GoogleSansCode-ExtraBoldItalic.ttf +0 -0
  8. package/dist/fonts/GoogleSansCode-Italic-VariableFont_wght.ttf +0 -0
  9. package/dist/fonts/GoogleSansCode-Italic.ttf +0 -0
  10. package/dist/fonts/GoogleSansCode-Light.ttf +0 -0
  11. package/dist/fonts/GoogleSansCode-LightItalic.ttf +0 -0
  12. package/dist/fonts/GoogleSansCode-Medium.ttf +0 -0
  13. package/dist/fonts/GoogleSansCode-MediumItalic.ttf +0 -0
  14. package/dist/fonts/GoogleSansCode-Regular.ttf +0 -0
  15. package/dist/fonts/GoogleSansCode-SemiBold.ttf +0 -0
  16. package/dist/fonts/GoogleSansCode-SemiBoldItalic.ttf +0 -0
  17. package/dist/fonts/GoogleSansCode-VariableFont_wght.ttf +0 -0
  18. package/dist/fonts/RobotoCondensed-Black.ttf +0 -0
  19. package/dist/fonts/RobotoCondensed-BlackItalic.ttf +0 -0
  20. package/dist/fonts/RobotoCondensed-Bold.ttf +0 -0
  21. package/dist/fonts/RobotoCondensed-BoldItalic.ttf +0 -0
  22. package/dist/fonts/RobotoCondensed-ExtraBold.ttf +0 -0
  23. package/dist/fonts/RobotoCondensed-ExtraBoldItalic.ttf +0 -0
  24. package/dist/fonts/RobotoCondensed-ExtraLight.ttf +0 -0
  25. package/dist/fonts/RobotoCondensed-ExtraLightItalic.ttf +0 -0
  26. package/dist/fonts/RobotoCondensed-Italic-VariableFont_wght.ttf +0 -0
  27. package/dist/fonts/RobotoCondensed-Italic.ttf +0 -0
  28. package/dist/fonts/RobotoCondensed-Light.ttf +0 -0
  29. package/dist/fonts/RobotoCondensed-LightItalic.ttf +0 -0
  30. package/dist/fonts/RobotoCondensed-Medium.ttf +0 -0
  31. package/dist/fonts/RobotoCondensed-MediumItalic.ttf +0 -0
  32. package/dist/fonts/RobotoCondensed-Regular.ttf +0 -0
  33. package/dist/fonts/RobotoCondensed-SemiBold.ttf +0 -0
  34. package/dist/fonts/RobotoCondensed-SemiBoldItalic.ttf +0 -0
  35. package/dist/fonts/RobotoCondensed-Thin.ttf +0 -0
  36. package/dist/fonts/RobotoCondensed-ThinItalic.ttf +0 -0
  37. package/dist/fonts/RobotoCondensed-VariableFont_wght.ttf +0 -0
  38. package/dist/fonts/ZalandoSansExpanded-Black.ttf +0 -0
  39. package/dist/fonts/ZalandoSansExpanded-BlackItalic.ttf +0 -0
  40. package/dist/fonts/ZalandoSansExpanded-Bold.ttf +0 -0
  41. package/dist/fonts/ZalandoSansExpanded-BoldItalic.ttf +0 -0
  42. package/dist/fonts/ZalandoSansExpanded-ExtraBold.ttf +0 -0
  43. package/dist/fonts/ZalandoSansExpanded-ExtraBoldItalic.ttf +0 -0
  44. package/dist/fonts/ZalandoSansExpanded-ExtraLight.ttf +0 -0
  45. package/dist/fonts/ZalandoSansExpanded-ExtraLightItalic.ttf +0 -0
  46. package/dist/fonts/ZalandoSansExpanded-Italic-VariableFont_wght.ttf +0 -0
  47. package/dist/fonts/ZalandoSansExpanded-Italic.ttf +0 -0
  48. package/dist/fonts/ZalandoSansExpanded-Light.ttf +0 -0
  49. package/dist/fonts/ZalandoSansExpanded-LightItalic.ttf +0 -0
  50. package/dist/fonts/ZalandoSansExpanded-Medium.ttf +0 -0
  51. package/dist/fonts/ZalandoSansExpanded-MediumItalic.ttf +0 -0
  52. package/dist/fonts/ZalandoSansExpanded-Regular.ttf +0 -0
  53. package/dist/fonts/ZalandoSansExpanded-SemiBold.ttf +0 -0
  54. package/dist/fonts/ZalandoSansExpanded-SemiBoldItalic.ttf +0 -0
  55. package/dist/fonts/ZalandoSansExpanded-VariableFont_wght.ttf +0 -0
  56. package/dist/fonts/baseline-icons.woff +0 -0
  57. package/dist/fonts/baseline-icons.woff2 +0 -0
  58. package/dist/js/accordion.js +103 -0
  59. package/dist/js/alert.js +91 -0
  60. package/dist/js/base.js +146 -0
  61. package/dist/js/button.js +80 -0
  62. package/dist/js/carousel.js +427 -0
  63. package/dist/js/collapse.js +233 -0
  64. package/dist/js/color-modes.js +70 -0
  65. package/dist/js/component.js +114 -0
  66. package/dist/js/dropdown.js +348 -0
  67. package/dist/js/index.js +108 -0
  68. package/dist/js/modal.js +440 -0
  69. package/dist/js/offcanvas.js +356 -0
  70. package/dist/js/popover.js +241 -0
  71. package/dist/js/swipe.js +143 -0
  72. package/dist/js/tab.js +285 -0
  73. package/dist/js/toast.js +228 -0
  74. package/dist/js/tooltip.js +716 -0
  75. package/dist/js/util/backdrop.js +133 -0
  76. package/dist/js/util/component-functions.js +111 -0
  77. package/dist/js/util/focustrap.js +101 -0
  78. package/dist/js/util/scrollbar.js +111 -0
  79. package/dist/js/util.js +564 -0
  80. package/package.json +47 -0
package/README.md ADDED
@@ -0,0 +1,472 @@
1
+ # Base-Line Design System
2
+
3
+ A strict, layer-based design system with semantic tokens. Built on Bootstrap 5.3 architecture with a custom naming convention and token-based theming system.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@rhavenside/baseline.svg)](https://www.npmjs.com/package/@rhavenside/baseline)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Installation
9
+
10
+ Install Base-Line via npm:
11
+
12
+ ```bash
13
+ npm install @rhavenside/baseline
14
+ ```
15
+
16
+ Or via CDN:
17
+
18
+ ```html
19
+ <link rel="stylesheet" href="https://unpkg.com/@rhavenside/baseline/dist/base-line.css">
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ### CSS Only
25
+
26
+ Include the CSS file in your HTML:
27
+
28
+ ```html
29
+ <!DOCTYPE html>
30
+ <html lang="en">
31
+ <head>
32
+ <meta charset="UTF-8">
33
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
34
+ <link rel="stylesheet" href="node_modules/@rhavenside/baseline/dist/base-line.css">
35
+ <title>Base-Line Example</title>
36
+ </head>
37
+ <body>
38
+ <div class="l-container">
39
+ <div class="l-stack l-stack--lg">
40
+ <h1>Hello Base-Line</h1>
41
+ <p>Welcome to the Base-Line Design System</p>
42
+ <button class="c-button c-button--primary">Get Started</button>
43
+ </div>
44
+ </div>
45
+ </body>
46
+ </html>
47
+ ```
48
+
49
+ ### With JavaScript
50
+
51
+ For interactive components (modals, dropdowns, tooltips, etc.), include the JavaScript:
52
+
53
+ ```html
54
+ <script type="module">
55
+ import '@rhavenside/baseline/js'
56
+ </script>
57
+ ```
58
+
59
+ Or using CommonJS:
60
+
61
+ ```javascript
62
+ require('@rhavenside/baseline/js')
63
+ ```
64
+
65
+ ### In Your Build System
66
+
67
+ #### Webpack / Vite / Rollup
68
+
69
+ ```javascript
70
+ // Import CSS
71
+ import '@rhavenside/baseline/css'
72
+
73
+ // Import JavaScript
74
+ import { Modal, Dropdown, Tooltip } from '@rhavenside/baseline/js'
75
+ ```
76
+
77
+ #### Sass/SCSS
78
+
79
+ ```scss
80
+ // Import the full system
81
+ @import '~@rhavenside/baseline/dist/base-line.css';
82
+
83
+ // Or import SCSS source (if available)
84
+ @import '~@rhavenside/baseline/src/base.scss';
85
+ ```
86
+
87
+ ## Package Contents
88
+
89
+ After installation, the package includes:
90
+
91
+ ```
92
+ node_modules/@rhavenside/baseline/
93
+ ├── dist/
94
+ │ ├── base-line.css # Compiled CSS (compressed)
95
+ │ ├── base-line.css.map # Source map
96
+ │ ├── js/
97
+ │ │ ├── index.js # Main JavaScript entry point
98
+ │ │ ├── alert.js
99
+ │ │ ├── button.js
100
+ │ │ ├── modal.js
101
+ │ │ └── ... # All component files
102
+ │ └── fonts/
103
+ │ ├── baseline-icons.woff
104
+ │ ├── baseline-icons.woff2
105
+ │ └── *.ttf # Custom fonts
106
+ ```
107
+
108
+ ## Architecture
109
+
110
+ The system is divided into 4 clear layers:
111
+
112
+ ### Layer 1: Design Tokens (Foundation)
113
+
114
+ All design values are defined via CSS Custom Properties:
115
+
116
+ - **Colors**: Surface, Text, Accent, Border, State colors
117
+ - **Typography**: Font families, sizes, line-height, weight
118
+ - **Spacing**: Consistent step scale (4px base)
119
+ - **Radius**: Border-radius values
120
+ - **Shadow**: Shadow definitions
121
+ - **Z-Index**: Z-index scale
122
+ - **Motion**: Duration + easing functions
123
+
124
+ **Rule:** No value without token. Exception: `0` and `auto`.
125
+
126
+ ### Layer 2: Layout System
127
+
128
+ Layout classes for standard layouts without custom CSS:
129
+
130
+ - `l-container` - Container with max-width + responsive padding
131
+ - `l-stack` - Vertical layouts
132
+ - `l-cluster` - Horizontal groups
133
+ - `l-grid` - Flexible grid layouts (auto-fit / auto-fill)
134
+
135
+ **Rule:** No colors, no typography in layout classes.
136
+
137
+ ### Layer 3: Components
138
+
139
+ Fully functional components with JavaScript support:
140
+
141
+ - **Buttons**: Primary, Secondary, Outline, Link variants
142
+ - **Forms**: Input, Select, Textarea, Checkbox, Radio, Switch, Range
143
+ - **Cards**: Standard, Elevated, Bordered variants
144
+ - **Modals**: Dialogs with backdrop and animations
145
+ - **Dropdowns**: Menus with positioning
146
+ - **Tooltips & Popovers**: Contextual information
147
+ - **Alerts**: Dismissible notifications
148
+ - **Badges**: Status indicators and shields
149
+ - **Tables**: Responsive tables with variants
150
+ - **Navigation**: Navbar, Nav, Tabs
151
+ - **Accordion**: Collapsible content sections
152
+ - **Carousel**: Image/content sliders
153
+ - **Pagination**: Page navigation
154
+ - **Progress**: Progress bars
155
+ - **Spinners**: Loading indicators
156
+ - **Toasts**: Toast notifications
157
+ - **Offcanvas**: Slide-out panels
158
+ - **Breadcrumbs**: Navigation breadcrumbs
159
+ - **List Groups**: Structured lists
160
+ - **Input Groups**: Combined form inputs
161
+
162
+ **Rule:** Components are state-driven and use tokens exclusively.
163
+
164
+ ### Layer 4: Utilities
165
+
166
+ Intentionally limited utilities:
167
+
168
+ - Visibility (`u-hidden`, `u-visually-hidden`)
169
+ - Text alignment (`u-text-center`, `u-text-start`, etc.)
170
+ - Font size (`u-fs-1` to `u-fs-6`)
171
+ - Font weight (`u-fw-normal`, `u-fw-bold`, etc.)
172
+ - Overflow (`u-overflow-hidden`, etc.)
173
+ - Alignment (`u-flex`, `u-justify-between`, etc.)
174
+ - Spacing (`u-m-*`, `u-p-*`, `u-gap-*`)
175
+
176
+ **Forbidden:** Padding utilities for design, color utilities, shadow utilities.
177
+
178
+ ## Naming Convention
179
+
180
+ ### Tokens
181
+
182
+ Format: `--<category>-<meaning>[-<level>]`
183
+
184
+ ```css
185
+ --color-surface
186
+ --color-surface-muted
187
+ --color-accent
188
+ --space-1 to --space-n
189
+ --radius-sm, --radius-md
190
+ --shadow-1, --shadow-2
191
+ --duration-fast, --duration-normal
192
+ --ease-standard, --ease-emphasized
193
+ ```
194
+
195
+ ### Layout Classes
196
+
197
+ Format: `l-<role>`
198
+
199
+ ```html
200
+ <div class="l-container">
201
+ <div class="l-stack l-stack--lg">
202
+ <div class="l-cluster l-cluster--center">
203
+ <div class="l-grid l-grid--auto-fit">
204
+ ```
205
+
206
+ ### Components
207
+
208
+ Format: `c-<component>`
209
+
210
+ ```html
211
+ <button class="c-button c-button--primary">Button</button>
212
+ <input class="c-input" type="text">
213
+ <div class="c-card">
214
+ ```
215
+
216
+ **Variants:**
217
+ - `c-button--primary`, `c-button--secondary`
218
+ - `c-alert--danger`, `c-alert--success`
219
+
220
+ **Global States:**
221
+ - `is-hovered`, `is-active`, `is-disabled`
222
+ - `is-loading`, `is-open`, `has-error`
223
+
224
+ ### Utilities
225
+
226
+ Format: `u-<function>`
227
+
228
+ ```html
229
+ <div class="u-hidden">
230
+ <div class="u-text-center">
231
+ <div class="u-flex u-justify-between">
232
+ ```
233
+
234
+ ## JavaScript API
235
+
236
+ ### Data API (Automatic Initialization)
237
+
238
+ Components can be initialized automatically via data attributes:
239
+
240
+ ```html
241
+ <!-- Modal -->
242
+ <button
243
+ type="button"
244
+ class="c-button"
245
+ data-c-toggle="modal"
246
+ data-c-target="#myModal">
247
+ Open Modal
248
+ </button>
249
+
250
+ <!-- Tooltip -->
251
+ <button
252
+ type="button"
253
+ class="c-button"
254
+ data-c-toggle="tooltip"
255
+ data-c-placement="top"
256
+ title="Tooltip text">
257
+ Hover me
258
+ </button>
259
+
260
+ <!-- Popover -->
261
+ <button
262
+ type="button"
263
+ class="c-button"
264
+ data-c-toggle="popover"
265
+ data-c-title="Popover title"
266
+ data-c-content="Popover content">
267
+ Click me
268
+ </button>
269
+ ```
270
+
271
+ ### Programmatic API
272
+
273
+ Import and use components programmatically:
274
+
275
+ ```javascript
276
+ import { Modal, Dropdown, Tooltip } from '@rhavenside/baseline/js'
277
+
278
+ // Create a modal instance
279
+ const modalElement = document.querySelector('#myModal')
280
+ const modal = Modal.getOrCreateInstance(modalElement, {
281
+ backdrop: true,
282
+ keyboard: true
283
+ })
284
+
285
+ // Show the modal
286
+ modal.show()
287
+
288
+ // Create a tooltip
289
+ const tooltipElement = document.querySelector('[data-c-toggle="tooltip"]')
290
+ const tooltip = Tooltip.getOrCreateInstance(tooltipElement, {
291
+ title: 'Custom tooltip text',
292
+ placement: 'top'
293
+ })
294
+
295
+ // Show the tooltip
296
+ tooltip.show()
297
+ ```
298
+
299
+ ### Global Access
300
+
301
+ When loaded via script tag, components are available globally:
302
+
303
+ ```javascript
304
+ // Access via window.BaseLine
305
+ const modal = window.BaseLine.Modal.getOrCreateInstance(element)
306
+ const tooltip = window.BaseLine.Tooltip.getOrCreateInstance(element)
307
+ ```
308
+
309
+ ## Available Components
310
+
311
+ | Component | CSS Class | JavaScript | Description |
312
+ |-----------|-----------|------------|-------------|
313
+ | Alert | `.c-alert` | `Alert` | Contextual feedback messages |
314
+ | Badge | `.c-badge` | - | Status indicators |
315
+ | Breadcrumb | `.c-breadcrumb` | - | Navigation breadcrumbs |
316
+ | Button | `.c-button` | `Button` | Interactive buttons |
317
+ | Card | `.c-card` | - | Content containers |
318
+ | Carousel | `.c-carousel` | `Carousel` | Image/content sliders |
319
+ | Dropdown | `.c-dropdown` | `Dropdown` | Dropdown menus |
320
+ | Modal | `.c-modal` | `Modal` | Modal dialogs |
321
+ | Nav | `.c-nav` | `Tab` | Navigation and tabs |
322
+ | Navbar | `.c-navbar` | - | Navigation bars |
323
+ | Offcanvas | `.c-offcanvas` | `Offcanvas` | Slide-out panels |
324
+ | Pagination | `.c-pagination` | - | Page navigation |
325
+ | Popover | `.c-popover` | `Popover` | Popovers |
326
+ | Progress | `.c-progress` | - | Progress bars |
327
+ | Spinner | `.c-spinner` | - | Loading spinners |
328
+ | Toast | `.c-toast` | `Toast` | Toast notifications |
329
+ | Tooltip | `.c-tooltip` | `Tooltip` | Tooltips |
330
+ | Accordion | `.c-accordion` | `Accordion` | Collapsible sections |
331
+ | Forms | `.c-input`, `.c-form-control` | - | Form inputs |
332
+ | Table | `.c-table` | - | Data tables |
333
+ | List Group | `.c-list-group` | - | Structured lists |
334
+
335
+ ## Examples
336
+
337
+ ### Button
338
+
339
+ ```html
340
+ <button class="c-button c-button--primary">Primary</button>
341
+ <button class="c-button c-button--secondary">Secondary</button>
342
+ <button class="c-button c-button--outline-primary">Outline</button>
343
+ ```
344
+
345
+ ### Card
346
+
347
+ ```html
348
+ <div class="c-card">
349
+ <div class="c-card__header">
350
+ <h5 class="c-card__title">Card Title</h5>
351
+ </div>
352
+ <div class="c-card__body">
353
+ <p>Card content goes here.</p>
354
+ </div>
355
+ </div>
356
+ ```
357
+
358
+ ### Modal
359
+
360
+ ```html
361
+ <!-- Trigger Button -->
362
+ <button
363
+ type="button"
364
+ class="c-button c-button--primary"
365
+ data-c-toggle="modal"
366
+ data-c-target="#exampleModal">
367
+ Launch Modal
368
+ </button>
369
+
370
+ <!-- Modal -->
371
+ <div class="c-modal c-fade" id="exampleModal" tabindex="-1">
372
+ <div class="c-modal-dialog">
373
+ <div class="c-modal-content">
374
+ <div class="c-modal-header">
375
+ <h5 class="c-modal-title">Modal Title</h5>
376
+ <button type="button" class="c-close" data-c-dismiss="modal"></button>
377
+ </div>
378
+ <div class="c-modal-body">
379
+ <p>Modal body text goes here.</p>
380
+ </div>
381
+ <div class="c-modal-footer">
382
+ <button type="button" class="c-button c-button--secondary" data-c-dismiss="modal">Close</button>
383
+ <button type="button" class="c-button c-button--primary">Save changes</button>
384
+ </div>
385
+ </div>
386
+ </div>
387
+ </div>
388
+ ```
389
+
390
+ ### Form
391
+
392
+ ```html
393
+ <div class="l-stack l-stack--sm">
394
+ <label class="c-form-label" for="email">Email</label>
395
+ <input type="email" class="c-form-control" id="email" placeholder="name@example.com">
396
+ </div>
397
+
398
+ <div class="l-stack l-stack--sm">
399
+ <label class="c-form-label" for="password">Password</label>
400
+ <input type="password" class="c-form-control" id="password">
401
+ </div>
402
+
403
+ <button type="submit" class="c-button c-button--primary">Submit</button>
404
+ ```
405
+
406
+ ## Dark Mode
407
+
408
+ Dark mode is automatically activated via `prefers-color-scheme`. Additionally, the `.theme-dark` class can be set manually:
409
+
410
+ ```html
411
+ <html class="theme-dark">
412
+ ```
413
+
414
+ Or via data attribute:
415
+
416
+ ```html
417
+ <html data-bs-theme="dark">
418
+ ```
419
+
420
+ ## Theming
421
+
422
+ The system can be extended project-specifically without changing the core:
423
+
424
+ ```css
425
+ :root {
426
+ --color-accent: #0066cc;
427
+ --color-primary: #0066cc;
428
+ --space-4: 1.5rem;
429
+ --radius-md: 0.5rem;
430
+ }
431
+
432
+ .theme-dark,
433
+ [data-bs-theme="dark"] {
434
+ --color-surface: #1a1a1a;
435
+ --color-text: #ffffff;
436
+ }
437
+ ```
438
+
439
+ ## Responsive Font Sizing (RFS)
440
+
441
+ Base-Line includes [RFS (Responsive Font Size)](https://github.com/twbs/rfs) for automatic responsive font sizing. All font sizes, paddings, and margins above 1.25rem automatically scale down on smaller screens.
442
+
443
+ ## Browser Support
444
+
445
+ Base-Line supports all modern browsers:
446
+
447
+ - Chrome (latest)
448
+ - Firefox (latest)
449
+ - Safari (latest)
450
+ - Edge (latest)
451
+
452
+ ## Dependencies
453
+
454
+ - **@popperjs/core**: ^2.11.8 (for positioning tooltips, popovers, dropdowns)
455
+
456
+ ## License
457
+
458
+ MIT License - see [LICENSE](LICENSE) file for details.
459
+
460
+ ## Links
461
+
462
+ - [Documentation](https://github.com/rhavenside/base-line)
463
+ - [Issues](https://github.com/rhavenside/base-line/issues)
464
+ - [npm Package](https://www.npmjs.com/package/@rhavenside/baseline)
465
+
466
+ ## Contributing
467
+
468
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the strict contribution rules.
469
+
470
+ ---
471
+
472
+ Built with ❤️ using Bootstrap 5.3 architecture and RFS for responsive typography.