@scania/tegel-lite 0.0.2 → 0.0.3-rules-beta.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.
@@ -0,0 +1,474 @@
1
+ ---
2
+ description: Display components including cards, tables, modals, messages, and steppers
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Display Components
7
+
8
+ ## Card
9
+
10
+ **Classes**: `tl-card`
11
+ **Variants**: `tl-card--primary`, `tl-card--secondary`, `tl-card--clickable`, `tl-card--stretch`, `tl-card--expandable`
12
+
13
+ ```html
14
+ <!-- Basic card -->
15
+ <div class="tl-card">
16
+ <div class="tl-card__header">
17
+ <div class="tl-card__headings">
18
+ <span class="tl-card__title">Card Title</span>
19
+ <span class="tl-card__subtitle">Subtitle</span>
20
+ </div>
21
+ </div>
22
+ <div class="tl-card__body">
23
+ <div class="tl-card__content">
24
+ <p>Card content goes here.</p>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <!-- Card with image -->
30
+ <div class="tl-card">
31
+ <img class="tl-card__image" src="image.jpg" alt="Description" />
32
+ <div class="tl-card__header tl-card__header--below">
33
+ <div class="tl-card__headings">
34
+ <span class="tl-card__title">Featured Card</span>
35
+ </div>
36
+ </div>
37
+ <div class="tl-card__body">
38
+ <div class="tl-card__content">
39
+ <p>Content below the image.</p>
40
+ </div>
41
+ </div>
42
+ <div class="tl-card__bottom-row">
43
+ <div class="tl-card__actions">
44
+ <button class="tl-button tl-button--primary tl-button--sm">Action</button>
45
+ </div>
46
+ </div>
47
+ </div>
48
+
49
+ <!-- Clickable card -->
50
+ <button class="tl-card tl-card--clickable">
51
+ <div class="tl-card__header">
52
+ <div class="tl-card__headings">
53
+ <span class="tl-card__title">Clickable</span>
54
+ </div>
55
+ </div>
56
+ <div class="tl-card__body">
57
+ <div class="tl-card__content">Click anywhere</div>
58
+ </div>
59
+ </button>
60
+
61
+ <!-- Card with thumbnail -->
62
+ <div class="tl-card">
63
+ <div class="tl-card__header">
64
+ <img class="tl-card__thumbnail" src="avatar.jpg" alt="User" />
65
+ <div class="tl-card__headings">
66
+ <span class="tl-card__title">User Name</span>
67
+ <span class="tl-card__subtitle">Role</span>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Accordion
76
+
77
+ **Classes**: `tl-accordion`
78
+ **Variants**: `tl-accordion--primary`, `tl-accordion--secondary`, `tl-accordion--hide-last-border`
79
+
80
+ ```html
81
+ <div class="tl-accordion">
82
+ <!-- Expanded item -->
83
+ <div class="tl-accordion__item tl-accordion__item--expanded">
84
+ <button class="tl-accordion__header-icon-end" aria-expanded="true">
85
+ <span class="tl-accordion__title">Section 1</span>
86
+ </button>
87
+ <div class="tl-accordion__panel">
88
+ <p>Content of section 1.</p>
89
+ </div>
90
+ </div>
91
+
92
+ <!-- Collapsed item -->
93
+ <div class="tl-accordion__item">
94
+ <button class="tl-accordion__header-icon-end" aria-expanded="false">
95
+ <span class="tl-accordion__title">Section 2</span>
96
+ </button>
97
+ <div class="tl-accordion__panel">
98
+ <p>Content of section 2.</p>
99
+ </div>
100
+ </div>
101
+
102
+ <!-- Disabled item -->
103
+ <div class="tl-accordion__item tl-accordion__item--disabled">
104
+ <button
105
+ class="tl-accordion__header-icon-end"
106
+ aria-expanded="false"
107
+ disabled
108
+ >
109
+ <span class="tl-accordion__title">Disabled</span>
110
+ </button>
111
+ <div class="tl-accordion__panel">
112
+ <p>Cannot expand.</p>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ ```
117
+
118
+ **Icon position**: Use `tl-accordion__header-icon-start` for chevron on left, `tl-accordion__header-icon-end` for right.
119
+
120
+ ---
121
+
122
+ ## Badge
123
+
124
+ **Classes**: `tl-badge`
125
+ **Sizes**: `tl-badge--sm` (8×8px dot), `tl-badge--lg` (20×20px), `tl-badge--pill` (auto-width)
126
+
127
+ **IMPORTANT**: The badge component does NOT have built-in status variants (success, warning, danger). It only provides neutral notification badges.
128
+
129
+ ```html
130
+ <!-- Notification badges (default usage) -->
131
+ <span class="tl-badge tl-badge--sm"></span>
132
+ <span class="tl-badge tl-badge--lg"><span class="tl-badge__text">5</span></span>
133
+ <span class="tl-badge tl-badge--pill"
134
+ ><span class="tl-badge__text">New</span></span
135
+ >
136
+ ```
137
+
138
+ ### Status Badges (Custom Component)
139
+
140
+ **NEVER use inline styles on badges.** For status indicators (success, warning, danger), create a custom component with proper CSS classes:
141
+
142
+ ```css
143
+ /* Add to your custom stylesheet */
144
+ .status-badge {
145
+ display: inline-block;
146
+ padding: var(--dimension-space-tiny) var(--dimension-space-small);
147
+ border-radius: var(--dimension-radius-rounded);
148
+ font-size: 12px;
149
+ font-weight: var(--scania-font-weight-bold);
150
+ text-align: center;
151
+ }
152
+
153
+ .status-badge--success {
154
+ background-color: var(--color-system-success-discrete);
155
+ color: var(--color-system-success-default);
156
+ }
157
+
158
+ .status-badge--warning {
159
+ background-color: var(--color-system-warning-discrete);
160
+ color: var(--color-system-warning-default);
161
+ }
162
+
163
+ .status-badge--danger {
164
+ background-color: var(--color-system-danger-discrete);
165
+ color: var(--color-system-danger-default);
166
+ }
167
+
168
+ .status-badge--info {
169
+ background-color: var(--color-system-info-discrete);
170
+ color: var(--color-system-info-default);
171
+ }
172
+ ```
173
+
174
+ ```html
175
+ <!-- CUSTOM: Status badges using Tegel tokens -->
176
+ <span class="status-badge status-badge--success">Active</span>
177
+ <span class="status-badge status-badge--warning">Pending</span>
178
+ <span class="status-badge status-badge--danger">Error</span>
179
+ <span class="status-badge status-badge--info">Info</span>
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Banner
185
+
186
+ **Classes**: `tl-banner`
187
+ **Variants**: `tl-banner--error`, `tl-banner--information`
188
+
189
+ ```html
190
+ <!-- Default banner -->
191
+ <div class="tl-banner" role="alert">
192
+ <span class="tl-banner__icon">
193
+ <span class="tl-icon tl-icon--info"></span>
194
+ </span>
195
+ <div class="tl-banner__content">
196
+ <div class="tl-banner__text">
197
+ <h6 class="tl-banner__header">Notice</h6>
198
+ <p class="tl-banner__subheader">System maintenance scheduled.</p>
199
+ </div>
200
+ <div class="tl-banner__actions">
201
+ <a href="#" class="tl-link tl-link--underline">Learn more</a>
202
+ </div>
203
+ </div>
204
+ <button class="tl-banner__close" aria-label="Close">
205
+ <span class="tl-icon tl-icon--cross"></span>
206
+ </button>
207
+ </div>
208
+
209
+ <!-- Error banner -->
210
+ <div class="tl-banner tl-banner--error" role="alert">
211
+ <span class="tl-banner__icon">
212
+ <span class="tl-icon tl-icon--error"></span>
213
+ </span>
214
+ <div class="tl-banner__content">
215
+ <div class="tl-banner__text">
216
+ <h6 class="tl-banner__header">Error</h6>
217
+ <p class="tl-banner__subheader">Something went wrong.</p>
218
+ </div>
219
+ </div>
220
+ </div>
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Message
226
+
227
+ **Classes**: `tl-message`
228
+ **Variants**: `tl-message--information`, `tl-message--success`, `tl-message--warning`, `tl-message--error`, `tl-message--minimal`
229
+ **Mode**: `tl-message--primary`, `tl-message--secondary`, `tl-message--no-icon`
230
+
231
+ ```html
232
+ <!-- Information message -->
233
+ <div class="tl-message tl-message--information">
234
+ <div class="tl-message__wrapper">
235
+ <div class="tl-message__content">
236
+ <p class="tl-message__header">Information</p>
237
+ <p class="tl-message__extended-message">Here is some helpful context.</p>
238
+ </div>
239
+ </div>
240
+ </div>
241
+
242
+ <!-- Error message -->
243
+ <div class="tl-message tl-message--error">
244
+ <div class="tl-message__wrapper">
245
+ <div class="tl-message__content">
246
+ <p class="tl-message__header">Error occurred</p>
247
+ <p class="tl-message__extended-message">Please try again later.</p>
248
+ </div>
249
+ </div>
250
+ </div>
251
+
252
+ <!-- Minimal (inline) error message -->
253
+ <div class="tl-message tl-message--error tl-message--minimal">
254
+ <div class="tl-message__wrapper">
255
+ <div class="tl-message__content">
256
+ <p class="tl-message__header">Invalid input</p>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Toast
265
+
266
+ **Classes**: `tl-toast`
267
+ **Variants**: `tl-toast--information`, `tl-toast--success`, `tl-toast--error`, `tl-toast--warning`
268
+
269
+ ```html
270
+ <div class="tl-toast tl-toast--success" role="alert">
271
+ <span class="tl-toast__icon">
272
+ <span class="tl-icon tl-icon--tick"></span>
273
+ </span>
274
+ <div class="tl-toast__content">
275
+ <div class="tl-toast__text">
276
+ <h6 class="tl-toast__header">Success</h6>
277
+ <p class="tl-toast__subheader">Item was saved.</p>
278
+ </div>
279
+ </div>
280
+ <button class="tl-toast__close" aria-label="Dismiss">
281
+ <span class="tl-icon tl-icon--cross"></span>
282
+ </button>
283
+ </div>
284
+ ```
285
+
286
+ Width is fixed at `348px`. Position with CSS `position: fixed`.
287
+
288
+ ---
289
+
290
+ ## Modal / Dialog
291
+
292
+ **Classes**: `tl-modal`
293
+ **Sizes**: `tl-modal--xs`, `tl-modal--sm`, `tl-modal--md`, `tl-modal--lg`
294
+ **Modifiers**: `tl-modal--visible` (shows modal), `tl-modal--sticky` (sticky header/actions)
295
+
296
+ ```html
297
+ <!-- Overlay (backdrop) -->
298
+ <div class="tl-modal__overlay tl-modal--visible"></div>
299
+
300
+ <!-- Modal -->
301
+ <div
302
+ class="tl-modal tl-modal--sm tl-modal--visible tl-modal--sticky"
303
+ role="dialog"
304
+ aria-modal="true"
305
+ aria-labelledby="modal-title"
306
+ >
307
+ <div class="tl-modal__header">
308
+ <h5 class="tl-modal__title" id="modal-title">Confirm Action</h5>
309
+ <button class="tl-modal__close" aria-label="Close">
310
+ <span class="tl-icon tl-icon--cross"></span>
311
+ </button>
312
+ </div>
313
+ <div class="tl-modal__body">
314
+ <p>Are you sure you want to proceed?</p>
315
+ </div>
316
+ <div class="tl-modal__actions">
317
+ <button class="tl-button tl-button--secondary tl-button--md">Cancel</button>
318
+ <button class="tl-button tl-button--primary tl-button--md">Confirm</button>
319
+ </div>
320
+ </div>
321
+ ```
322
+
323
+ **Responsive widths** for `tl-modal--sm`:
324
+
325
+ - Mobile (320px): 100%
326
+ - Tablet (672px): 62.5%
327
+ - Desktop (1056px): 43.75%
328
+ - Wide (1312px): 37.5%
329
+ - Ultra-wide (1584px): 37.5%
330
+
331
+ ---
332
+
333
+ ## Table
334
+
335
+ **Classes**: `tl-table`
336
+ **Variants**: `tl-table--primary`, `tl-table--secondary`, `tl-table--responsive`, `tl-table--compact`
337
+ **Modifiers**: `tl-table--zebra-rows-odd`, `tl-table--zebra-rows-even`, `tl-table--vertical-dividers`, `tl-table--horizontal-scroll`, `tl-table--clickable`
338
+
339
+ ```html
340
+ <table class="tl-table tl-table--responsive">
341
+ <!-- Optional toolbar -->
342
+ <caption class="tl-table__toolbar">
343
+ <div class="tl-table__upper-bar">
344
+ <div class="tl-table__actionbar-left">
345
+ <span class="tl-table__title">Users</span>
346
+ </div>
347
+ </div>
348
+ </caption>
349
+
350
+ <thead class="tl-table__header">
351
+ <tr class="tl-table__row">
352
+ <th class="tl-table__header-cell">Name</th>
353
+ <th class="tl-table__header-cell">Email</th>
354
+ <th class="tl-table__header-cell">Role</th>
355
+ </tr>
356
+ </thead>
357
+
358
+ <tbody class="tl-table__body">
359
+ <tr class="tl-table__row">
360
+ <td class="tl-table__body-cell">John Doe</td>
361
+ <td class="tl-table__body-cell">john@example.com</td>
362
+ <td class="tl-table__body-cell">Admin</td>
363
+ </tr>
364
+ <tr class="tl-table__row">
365
+ <td class="tl-table__body-cell">Jane Smith</td>
366
+ <td class="tl-table__body-cell">jane@example.com</td>
367
+ <td class="tl-table__body-cell">User</td>
368
+ </tr>
369
+ </tbody>
370
+ </table>
371
+ ```
372
+
373
+ ### Sortable Headers
374
+
375
+ ```html
376
+ <th class="tl-table__header-cell tl-table__header-cell--sortable">
377
+ <button class="tl-table__header-button">
378
+ <span class="tl-table__header-button-text">Name</span>
379
+ <span class="tl-table__header-button-icon tl-icon tl-icon--sorting"></span>
380
+ </button>
381
+ </th>
382
+ ```
383
+
384
+ ---
385
+
386
+ ## Block (Content Section)
387
+
388
+ **Classes**: `tl-block`
389
+ **Variants**: `tl-block--primary`, `tl-block--secondary`
390
+
391
+ ```html
392
+ <div class="tl-block tl-block--primary">
393
+ <h2>Section Title</h2>
394
+ <p>Body text in a block.</p>
395
+ <div class="tl-block">
396
+ <h3>Nested Block</h3>
397
+ <p>Nested content with alternating background.</p>
398
+ </div>
399
+ </div>
400
+ ```
401
+
402
+ Blocks alternate background colors automatically when nested.
403
+
404
+ ---
405
+
406
+ ## Stepper
407
+
408
+ **Classes**: `tl-stepper`
409
+ **Sizes**: `tl-stepper--lg`, `tl-stepper--sm`
410
+ **Direction**: `tl-stepper--horizontal`, `tl-stepper--vertical`
411
+ **Label**: `tl-stepper--label-below`, `tl-stepper--label-aside`, `tl-stepper--hide-labels`
412
+
413
+ ```html
414
+ <div class="tl-stepper tl-stepper--horizontal tl-stepper--lg">
415
+ <ol class="tl-stepper__list">
416
+ <li class="tl-stepper__step tl-stepper__step--success">
417
+ <span class="tl-stepper__node"></span>
418
+ <span class="tl-stepper__label">Step 1</span>
419
+ </li>
420
+ <li class="tl-stepper__step tl-stepper__step--current">
421
+ <span class="tl-stepper__node">2</span>
422
+ <span class="tl-stepper__label">Step 2</span>
423
+ </li>
424
+ <li class="tl-stepper__step tl-stepper__step--upcoming">
425
+ <span class="tl-stepper__node">3</span>
426
+ <span class="tl-stepper__label">Step 3</span>
427
+ </li>
428
+ </ol>
429
+ </div>
430
+ ```
431
+
432
+ Step states: `tl-stepper__step--success`, `tl-stepper__step--error`, `tl-stepper__step--current`, `tl-stepper__step--upcoming`
433
+
434
+ ---
435
+
436
+ ## Spinner / Loader
437
+
438
+ **Classes**: `tl-spinner`
439
+ **Sizes**: `tl-spinner--xs` (16px), `tl-spinner--sm` (24px), `tl-spinner--md` (52px), `tl-spinner--lg` (84px)
440
+ **Color**: `tl-spinner--default`, `tl-spinner--inverted`
441
+
442
+ ```html
443
+ <svg
444
+ class="tl-spinner tl-spinner--md tl-spinner--default"
445
+ aria-label="Loading"
446
+ role="img"
447
+ >
448
+ <circle class="tl-spinner__circle"></circle>
449
+ </svg>
450
+ ```
451
+
452
+ ---
453
+
454
+ ## Popover Canvas
455
+
456
+ **Classes**: `tl-popover-canvas`
457
+ **Modifiers**: `tl-popover-canvas--visible`, `tl-popover-canvas--animation-fade`, `tl-popover-canvas--primary`, `tl-popover-canvas--secondary`
458
+
459
+ ```html
460
+ <div
461
+ class="tl-popover-canvas tl-popover-canvas--visible tl-popover-canvas--animation-fade"
462
+ >
463
+ <div class="tl-popover-canvas__content">
464
+ <h5 class="tl-popover-canvas__header">Popover Title</h5>
465
+ <p>Content here.</p>
466
+ <div class="tl-popover-canvas__actions">
467
+ <button class="tl-button tl-button--ghost tl-button--sm">Cancel</button>
468
+ <button class="tl-button tl-button--primary tl-button--sm">
469
+ Confirm
470
+ </button>
471
+ </div>
472
+ </div>
473
+ </div>
474
+ ```