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