@amedia/brick-mcp 0.1.2 → 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.
- package/README.md +50 -1
- package/data/components/brick-mcp.md +259 -0
- package/data/components/brick-pill.md +362 -0
- package/data/components/brick-player.md +331 -0
- package/data/components/brick-published.md +219 -0
- package/data/components/brick-share.md +335 -0
- package/data/components/brick-stepper.md +319 -0
- package/data/components/brick-tab.md +241 -0
- package/data/components/brick-tabs.md +420 -0
- package/data/components/brick-tag.md +335 -0
- package/data/components/brick-teaser-player.md +248 -0
- package/data/components/brick-teaser-reels.md +190 -0
- package/data/components/brick-teaser.md +262 -0
- package/data/components/brick-template.md +226 -0
- package/data/components/brick-textarea.md +191 -0
- package/data/components/brick-themes.md +104 -0
- package/data/components/brick-toast.md +271 -0
- package/data/components/brick-toggle.md +268 -0
- package/data/components/brick-tokens.md +287 -0
- package/data/components/brick-tooltip.md +249 -0
- package/data/components-metadata.json +35 -35
- package/dist/data/components/brick-mcp.md +259 -0
- package/dist/data/components/brick-pill.md +362 -0
- package/dist/data/components/brick-player.md +331 -0
- package/dist/data/components/brick-published.md +219 -0
- package/dist/data/components/brick-share.md +335 -0
- package/dist/data/components/brick-stepper.md +319 -0
- package/dist/data/components/brick-tab.md +241 -0
- package/dist/data/components/brick-tabs.md +420 -0
- package/dist/data/components/brick-tag.md +335 -0
- package/dist/data/components/brick-teaser-player.md +248 -0
- package/dist/data/components/brick-teaser-reels.md +190 -0
- package/dist/data/components/brick-teaser.md +262 -0
- package/dist/data/components/brick-template.md +226 -0
- package/dist/data/components/brick-textarea.md +191 -0
- package/dist/data/components/brick-themes.md +104 -0
- package/dist/data/components/brick-toast.md +271 -0
- package/dist/data/components/brick-toggle.md +268 -0
- package/dist/data/components/brick-tokens.md +287 -0
- package/dist/data/components/brick-tooltip.md +249 -0
- package/dist/data/components-metadata.json +35 -35
- package/package.json +37 -37
- package/data/components/brick-mcp.json +0 -6
- package/data/components/brick-pill.json +0 -6
- package/data/components/brick-player.json +0 -7
- package/data/components/brick-published.json +0 -7
- package/data/components/brick-share.json +0 -7
- package/data/components/brick-stepper.json +0 -7
- package/data/components/brick-tab.json +0 -7
- package/data/components/brick-tabs.json +0 -9
- package/data/components/brick-tag.json +0 -7
- package/data/components/brick-teaser-player.json +0 -9
- package/data/components/brick-teaser-reels.json +0 -9
- package/data/components/brick-teaser.json +0 -9
- package/data/components/brick-template.json +0 -9
- package/data/components/brick-textarea.json +0 -7
- package/data/components/brick-themes.json +0 -6
- package/data/components/brick-toast.json +0 -9
- package/data/components/brick-toggle.json +0 -7
- package/data/components/brick-tokens.json +0 -8
- package/data/components/brick-tooltip.json +0 -7
- package/dist/data/components/brick-mcp.json +0 -6
- package/dist/data/components/brick-pill.json +0 -6
- package/dist/data/components/brick-player.json +0 -7
- package/dist/data/components/brick-published.json +0 -7
- package/dist/data/components/brick-share.json +0 -7
- package/dist/data/components/brick-stepper.json +0 -7
- package/dist/data/components/brick-tab.json +0 -7
- package/dist/data/components/brick-tabs.json +0 -9
- package/dist/data/components/brick-tag.json +0 -7
- package/dist/data/components/brick-teaser-player.json +0 -9
- package/dist/data/components/brick-teaser-reels.json +0 -9
- package/dist/data/components/brick-teaser.json +0 -9
- package/dist/data/components/brick-template.json +0 -9
- package/dist/data/components/brick-textarea.json +0 -7
- package/dist/data/components/brick-themes.json +0 -6
- package/dist/data/components/brick-toast.json +0 -9
- package/dist/data/components/brick-toggle.json +0 -7
- package/dist/data/components/brick-tokens.json +0 -8
- package/dist/data/components/brick-tooltip.json +0 -7
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-share
|
|
3
|
+
version: 0.3.12
|
|
4
|
+
selector: brick-share
|
|
5
|
+
category: Navigation
|
|
6
|
+
tags: [share, social, web-share-api, clipboard, copy, gift, toast, url]
|
|
7
|
+
use_cases: [article-sharing, social-sharing, url-copying, gift-articles, content-distribution]
|
|
8
|
+
related: [brick-button, brick-toast, brick-tokens]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Share
|
|
12
|
+
|
|
13
|
+
A versatile sharing component that supports native Web Share API, clipboard copying, and custom share functionality with toast feedback for success and error states.
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Three sharing modes: share, copy, and gift
|
|
18
|
+
- Native Web Share API support with automatic fallback to clipboard
|
|
19
|
+
- Integration with Pushapp for app-specific sharing
|
|
20
|
+
- Automatic toast notifications for success and error states
|
|
21
|
+
- Customizable labels and aria-labels for accessibility
|
|
22
|
+
- Icon-only or label-only display modes
|
|
23
|
+
- Automatic URL detection (uses current page URL if not specified)
|
|
24
|
+
- Server-side rendering support
|
|
25
|
+
|
|
26
|
+
## Props/Attributes
|
|
27
|
+
|
|
28
|
+
| Attribute | Type | Default | Required | Description |
|
|
29
|
+
| -------------------- | ----------------------------- | ---------------- | -------- | ------------------------------------------------------------------ |
|
|
30
|
+
| `data-version` | `"share" \| "copy" \| "gift"` | `"share"` | no | Sharing mode and visual style |
|
|
31
|
+
| `data-url` | string | Current page URL | no | URL to share or copy |
|
|
32
|
+
| `data-title` | string | - | no | Title for native share dialog |
|
|
33
|
+
| `data-text` | string | - | no | Additional text for native share dialog |
|
|
34
|
+
| `data-share-label` | string | - | no | Custom button label text |
|
|
35
|
+
| `data-aria-label` | string | - | no | ARIA label for accessibility |
|
|
36
|
+
| `data-copy-success` | string | Default message | no | Custom success toast message when URL is copied |
|
|
37
|
+
| `data-copy-error` | string | Default message | no | Custom error toast message when copying fails |
|
|
38
|
+
| `data-copy-status` | `"success" \| "error"` | - | no | Manually trigger toast display (for testing/demo) |
|
|
39
|
+
| `data-label` | string | - | no | Set to "false" to hide label (icon-only mode) |
|
|
40
|
+
| `data-icon` | string | - | no | Set to "false" to hide icon (label-only mode) |
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Basic Share Button
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<brick-share
|
|
48
|
+
data-version="share"
|
|
49
|
+
>
|
|
50
|
+
</brick-share>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Share Specific URL
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<brick-share
|
|
57
|
+
data-version="share"
|
|
58
|
+
data-url="https://amedia.no"
|
|
59
|
+
data-title="Lenke til Amedia.no"
|
|
60
|
+
data-text="Jeg vil gjerne dele denne med deg"
|
|
61
|
+
>
|
|
62
|
+
</brick-share>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Copy to Clipboard
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<brick-share
|
|
69
|
+
data-version="copy"
|
|
70
|
+
data-url="https://amedia.no"
|
|
71
|
+
data-copy-success="Kopiert lenken!"
|
|
72
|
+
data-copy-error="Det oppstod en feil"
|
|
73
|
+
>
|
|
74
|
+
</brick-share>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Gift Article
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<brick-share
|
|
81
|
+
data-version="gift"
|
|
82
|
+
data-share-label="Gi bort"
|
|
83
|
+
data-aria-label="Kopierer lenke for å gi bort artikkelen til en annen leser gratis"
|
|
84
|
+
data-copy-success="Kopiert lenken!"
|
|
85
|
+
data-copy-error="Det oppstod en feil"
|
|
86
|
+
>
|
|
87
|
+
</brick-share>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Custom Label
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<brick-share
|
|
94
|
+
data-url="https://amedia.no"
|
|
95
|
+
data-share-label="Del artikkelen"
|
|
96
|
+
>
|
|
97
|
+
</brick-share>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Icon Only
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<brick-share
|
|
104
|
+
data-url="https://amedia.no"
|
|
105
|
+
data-title="Lenke til Amedia.no"
|
|
106
|
+
data-version="share"
|
|
107
|
+
data-label="false"
|
|
108
|
+
>
|
|
109
|
+
</brick-share>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Label Only (No Icon)
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<brick-share
|
|
116
|
+
data-share-label="Del"
|
|
117
|
+
data-icon="false"
|
|
118
|
+
>
|
|
119
|
+
</brick-share>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Framework Integration
|
|
123
|
+
|
|
124
|
+
### JavaScript
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
// Get share button element
|
|
128
|
+
const shareButton = document.querySelector('brick-share');
|
|
129
|
+
|
|
130
|
+
// Programmatically set URL
|
|
131
|
+
shareButton.dataUrl = 'https://example.com';
|
|
132
|
+
shareButton.dataTitle = 'Check this out!';
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Listen for Share Events
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
const shareButton = document.querySelector('brick-share');
|
|
139
|
+
|
|
140
|
+
shareButton.addEventListener('click', (event) => {
|
|
141
|
+
console.log('Share button clicked');
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Server-Side Rendering
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
import { renderBrickShare } from '@amedia/brick-share/template';
|
|
149
|
+
|
|
150
|
+
const html = renderBrickShare({
|
|
151
|
+
dataVersion: 'share',
|
|
152
|
+
dataUrl: 'https://amedia.no',
|
|
153
|
+
dataShareLabel: 'Del artikkelen',
|
|
154
|
+
dataCopySuccess: 'Kopiert!',
|
|
155
|
+
dataCopyError: 'Kunne ikke kopiere',
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Sharing Behavior
|
|
160
|
+
|
|
161
|
+
### Web Share API (Native)
|
|
162
|
+
|
|
163
|
+
When available (mobile devices and modern browsers), the component uses the native Web Share API:
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
navigator.share({
|
|
167
|
+
url: 'https://example.com',
|
|
168
|
+
title: 'Article title',
|
|
169
|
+
text: 'Additional text',
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Clipboard Fallback
|
|
174
|
+
|
|
175
|
+
If Web Share API is not available, the component falls back to copying the URL to clipboard and shows a toast notification.
|
|
176
|
+
|
|
177
|
+
### Pushapp Integration
|
|
178
|
+
|
|
179
|
+
The component automatically detects and uses Pushapp share functionality when available:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
window.pushapp.share({
|
|
183
|
+
url: 'https://example.com',
|
|
184
|
+
title: 'Article title',
|
|
185
|
+
text: 'Additional text',
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Toast Notifications
|
|
190
|
+
|
|
191
|
+
The component integrates with `brick-toast` to display feedback:
|
|
192
|
+
|
|
193
|
+
- **Success**: Shows when URL is successfully copied to clipboard
|
|
194
|
+
- **Error**: Shows when copying fails
|
|
195
|
+
|
|
196
|
+
```html
|
|
197
|
+
<!-- Success toast appears automatically -->
|
|
198
|
+
<brick-share
|
|
199
|
+
data-version="copy"
|
|
200
|
+
data-copy-success="Lenken er kopiert!"
|
|
201
|
+
>
|
|
202
|
+
</brick-share>
|
|
203
|
+
|
|
204
|
+
<!-- Error toast appears on failure -->
|
|
205
|
+
<brick-share
|
|
206
|
+
data-version="copy"
|
|
207
|
+
data-copy-error="Kunne ikke kopiere lenken"
|
|
208
|
+
>
|
|
209
|
+
</brick-share>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Accessibility
|
|
213
|
+
|
|
214
|
+
- Full keyboard navigation support
|
|
215
|
+
- Customizable ARIA labels via `data-aria-label`
|
|
216
|
+
- Focus visible states
|
|
217
|
+
- Screen reader friendly button labels
|
|
218
|
+
- Semantic button element for proper interaction
|
|
219
|
+
|
|
220
|
+
## Common Patterns
|
|
221
|
+
|
|
222
|
+
### Article Share Section
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<div class="article-share">
|
|
226
|
+
<brick-share
|
|
227
|
+
data-version="share"
|
|
228
|
+
data-share-label="Del artikkelen"
|
|
229
|
+
data-copy-success="Lenken er kopiert!"
|
|
230
|
+
>
|
|
231
|
+
</brick-share>
|
|
232
|
+
</div>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Multiple Share Options
|
|
236
|
+
|
|
237
|
+
```html
|
|
238
|
+
<div class="share-options">
|
|
239
|
+
<brick-share
|
|
240
|
+
data-version="share"
|
|
241
|
+
data-share-label="Del"
|
|
242
|
+
>
|
|
243
|
+
</brick-share>
|
|
244
|
+
|
|
245
|
+
<brick-share
|
|
246
|
+
data-version="copy"
|
|
247
|
+
data-share-label="Kopier lenke"
|
|
248
|
+
data-copy-success="Kopiert!"
|
|
249
|
+
>
|
|
250
|
+
</brick-share>
|
|
251
|
+
|
|
252
|
+
<brick-share
|
|
253
|
+
data-version="gift"
|
|
254
|
+
data-share-label="Gi bort"
|
|
255
|
+
data-copy-success="Lenken er kopiert!"
|
|
256
|
+
>
|
|
257
|
+
</brick-share>
|
|
258
|
+
</div>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Compact Share Bar
|
|
262
|
+
|
|
263
|
+
```html
|
|
264
|
+
<div class="compact-share">
|
|
265
|
+
<!-- Icon-only buttons -->
|
|
266
|
+
<brick-share
|
|
267
|
+
data-version="share"
|
|
268
|
+
data-label="false"
|
|
269
|
+
data-aria-label="Del artikkelen"
|
|
270
|
+
>
|
|
271
|
+
</brick-share>
|
|
272
|
+
|
|
273
|
+
<brick-share
|
|
274
|
+
data-version="copy"
|
|
275
|
+
data-label="false"
|
|
276
|
+
data-aria-label="Kopier lenke"
|
|
277
|
+
data-copy-success="Kopiert!"
|
|
278
|
+
>
|
|
279
|
+
</brick-share>
|
|
280
|
+
</div>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Version Variants
|
|
284
|
+
|
|
285
|
+
### Share Version
|
|
286
|
+
|
|
287
|
+
Default sharing mode with share icon. Uses Web Share API when available.
|
|
288
|
+
|
|
289
|
+
```html
|
|
290
|
+
<brick-share data-version="share"></brick-share>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Copy Version
|
|
294
|
+
|
|
295
|
+
Displays copy icon and always copies to clipboard (does not invoke Web Share API).
|
|
296
|
+
|
|
297
|
+
```html
|
|
298
|
+
<brick-share data-version="copy"></brick-share>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Gift Version
|
|
302
|
+
|
|
303
|
+
Special variant for gifting articles, typically with custom messaging.
|
|
304
|
+
|
|
305
|
+
```html
|
|
306
|
+
<brick-share data-version="gift" data-share-label="Gi bort"></brick-share>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Technical Details
|
|
310
|
+
|
|
311
|
+
- **Custom Element**: `brick-share`
|
|
312
|
+
- **Base Class**: BrickElement
|
|
313
|
+
- **Dependencies**:
|
|
314
|
+
- @amedia/brick-button (button component)
|
|
315
|
+
- @amedia/brick-toast (toast notifications)
|
|
316
|
+
- @amedia/brick-template (base class)
|
|
317
|
+
- @amedia/brick-tokens (design tokens)
|
|
318
|
+
- **Renders as**: Button element using brick-button
|
|
319
|
+
- **SSR Compatible**: Yes, with template function
|
|
320
|
+
- **Browser APIs**: Web Share API, Clipboard API
|
|
321
|
+
|
|
322
|
+
## Important Notes
|
|
323
|
+
|
|
324
|
+
- If `data-url` is not provided, the component uses `window.location.href` (current page URL)
|
|
325
|
+
- The Web Share API is only available in secure contexts (HTTPS)
|
|
326
|
+
- Clipboard API requires user interaction (button click) to work
|
|
327
|
+
- Toast notifications require `brick-toast` to be available on the page
|
|
328
|
+
- Set `data-label="false"` for icon-only mode (accessibility requires `data-aria-label`)
|
|
329
|
+
- Set `data-icon="false"` for label-only mode
|
|
330
|
+
- The component automatically detects and prioritizes: Web Share API → Pushapp → Clipboard
|
|
331
|
+
- `data-copy-status` is primarily for testing/demo purposes to manually trigger toasts
|
|
332
|
+
|
|
333
|
+
## Version
|
|
334
|
+
|
|
335
|
+
Current version: 0.3.12
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-stepper
|
|
3
|
+
version: 1.0.18
|
|
4
|
+
selector: brick-stepper-v1
|
|
5
|
+
category: Navigation
|
|
6
|
+
tags: [stepper, progress, steps, wizard, multi-step, process, indicator, accessibility]
|
|
7
|
+
use_cases: [checkout-flow, multi-step-forms, onboarding, wizard, progress-tracking, registration]
|
|
8
|
+
related: [brick-icon, brick-tokens]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Brick Stepper
|
|
12
|
+
|
|
13
|
+
A progress indicator component that displays the current step in a multi-step process with optional labels, icons, and visual feedback for completed and upcoming steps.
|
|
14
|
+
|
|
15
|
+
## Key Capabilities
|
|
16
|
+
|
|
17
|
+
- Displays numbered steps with current step indicator
|
|
18
|
+
- Supports ascending (left-to-right) and descending (right-to-left) order
|
|
19
|
+
- Optional labels for each step (e.g., "Step 1", "Step 2")
|
|
20
|
+
- Visual distinction between completed, current, and upcoming steps
|
|
21
|
+
- Optional checkmark icons for completed steps
|
|
22
|
+
- Optional lock icons for incomplete steps
|
|
23
|
+
- Fully accessible with ARIA labels and semantic HTML
|
|
24
|
+
- Server-side rendering support
|
|
25
|
+
|
|
26
|
+
## Props/Attributes
|
|
27
|
+
|
|
28
|
+
| Attribute | Type | Default | Required | Description |
|
|
29
|
+
| ------------------------- | ----------------- | --------------------- | -------- | ------------------------------------------------------------------ |
|
|
30
|
+
| `data-steps` | string (number) | - | yes | Total number of steps to render |
|
|
31
|
+
| `data-steps-current` | string (number) | - | no* | Current step number (sets aria-current attribute) |
|
|
32
|
+
| `data-steps-completed` | string (number) | - | no* | Number of completed steps (alternative to data-steps-current) |
|
|
33
|
+
| `data-steps-order` | `"asc" \| "desc"` | `"asc"` | no | Step order: "asc" (1→n) or "desc" (n→1) |
|
|
34
|
+
| `data-steps-aria-label` | string | `"Fremdriftsindikator"` | no | ARIA label for the stepper list |
|
|
35
|
+
| `data-steps-label` | string | - | no | Label prefix for each step (e.g., "Steg" → "Steg 1", "Steg 2") |
|
|
36
|
+
| `data-steps-icon-check` | string | - | no | Set to "true" to show checkmark icon on completed steps |
|
|
37
|
+
| `data-steps-icon-lock` | string | - | no | Set to "true" to show lock icon on incomplete steps |
|
|
38
|
+
|
|
39
|
+
*Either `data-steps-current` or `data-steps-completed` must be provided.
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Basic Stepper
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<brick-stepper-v1
|
|
47
|
+
data-steps="7"
|
|
48
|
+
data-steps-current="4"
|
|
49
|
+
>
|
|
50
|
+
</brick-stepper-v1>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Stepper with Labels
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<brick-stepper-v1
|
|
57
|
+
data-steps="5"
|
|
58
|
+
data-steps-current="2"
|
|
59
|
+
data-steps-label="Steg"
|
|
60
|
+
>
|
|
61
|
+
</brick-stepper-v1>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Reversed Order (Right-to-Left)
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<brick-stepper-v1
|
|
68
|
+
data-steps="7"
|
|
69
|
+
data-steps-current="4"
|
|
70
|
+
data-steps-order="desc"
|
|
71
|
+
>
|
|
72
|
+
</brick-stepper-v1>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### With Icons
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<brick-stepper-v1
|
|
79
|
+
data-steps="5"
|
|
80
|
+
data-steps-current="3"
|
|
81
|
+
data-steps-label="Steg"
|
|
82
|
+
data-steps-icon-check="true"
|
|
83
|
+
data-steps-icon-lock="true"
|
|
84
|
+
>
|
|
85
|
+
</brick-stepper-v1>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Using Completed Instead of Current
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<brick-stepper-v1
|
|
92
|
+
data-steps="5"
|
|
93
|
+
data-steps-completed="2"
|
|
94
|
+
data-steps-label="Steg"
|
|
95
|
+
>
|
|
96
|
+
</brick-stepper-v1>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Custom ARIA Label
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<brick-stepper-v1
|
|
103
|
+
data-steps="4"
|
|
104
|
+
data-steps-current="2"
|
|
105
|
+
data-steps-aria-label="Checkout process"
|
|
106
|
+
>
|
|
107
|
+
</brick-stepper-v1>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Checkout Flow Example
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<brick-stepper-v1
|
|
114
|
+
data-steps="4"
|
|
115
|
+
data-steps-current="2"
|
|
116
|
+
data-steps-label="Step"
|
|
117
|
+
data-steps-icon-check="true"
|
|
118
|
+
data-steps-icon-lock="true"
|
|
119
|
+
data-steps-aria-label="Checkout progress"
|
|
120
|
+
>
|
|
121
|
+
</brick-stepper-v1>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Programmatic Usage
|
|
125
|
+
|
|
126
|
+
### Update Current Step
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
const stepper = document.querySelector('brick-stepper-v1');
|
|
130
|
+
|
|
131
|
+
// Move to next step
|
|
132
|
+
stepper.dataStepsCurrent = '3';
|
|
133
|
+
|
|
134
|
+
// Enable icons
|
|
135
|
+
stepper.dataStepsIconCheck = 'true';
|
|
136
|
+
stepper.dataStepsIconLock = 'true';
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Server-Side Rendering
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
import { renderBrickStepper } from '@amedia/brick-stepper/template';
|
|
143
|
+
|
|
144
|
+
const html = renderBrickStepper({
|
|
145
|
+
dataSteps: '5',
|
|
146
|
+
dataStepsCurrent: '2',
|
|
147
|
+
dataStepsLabel: 'Steg',
|
|
148
|
+
dataStepsIconCheck: 'true',
|
|
149
|
+
dataStepsAriaLabel: 'Registration progress',
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Visual States
|
|
154
|
+
|
|
155
|
+
### Step States
|
|
156
|
+
|
|
157
|
+
The component provides visual distinction for three step states:
|
|
158
|
+
|
|
159
|
+
1. **Completed steps**: Steps before the current step (or within completed count)
|
|
160
|
+
- Styled with completed visual state
|
|
161
|
+
- Optional checkmark icon
|
|
162
|
+
|
|
163
|
+
2. **Current step**: The active step in the process
|
|
164
|
+
- Receives `aria-current="step"` attribute
|
|
165
|
+
- Visual emphasis styling
|
|
166
|
+
|
|
167
|
+
3. **Upcoming steps**: Steps after the current step
|
|
168
|
+
- Default styling
|
|
169
|
+
- Optional lock icon
|
|
170
|
+
|
|
171
|
+
### Step Order
|
|
172
|
+
|
|
173
|
+
- **Ascending (`data-steps-order="asc"`)**: Steps numbered 1 → n (left to right)
|
|
174
|
+
- **Descending (`data-steps-order="desc"`)**: Steps numbered n → 1 (right to left, reversed)
|
|
175
|
+
|
|
176
|
+
## Accessibility
|
|
177
|
+
|
|
178
|
+
- Uses semantic `<ol>` (ordered list) element
|
|
179
|
+
- Current step marked with `aria-current="step"`
|
|
180
|
+
- Customizable `aria-label` for the list container
|
|
181
|
+
- Proper list item semantics for screen readers
|
|
182
|
+
- Visual and non-visual indication of progress
|
|
183
|
+
- Keyboard navigation support through standard list semantics
|
|
184
|
+
|
|
185
|
+
## Common Patterns
|
|
186
|
+
|
|
187
|
+
### Multi-Step Form
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<form>
|
|
191
|
+
<brick-stepper-v1
|
|
192
|
+
data-steps="3"
|
|
193
|
+
data-steps-current="1"
|
|
194
|
+
data-steps-label="Step"
|
|
195
|
+
data-steps-aria-label="Registration form progress"
|
|
196
|
+
>
|
|
197
|
+
</brick-stepper-v1>
|
|
198
|
+
|
|
199
|
+
<!-- Form content here -->
|
|
200
|
+
</form>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Checkout Process
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<brick-stepper-v1
|
|
207
|
+
data-steps="4"
|
|
208
|
+
data-steps-current="2"
|
|
209
|
+
data-steps-label="Step"
|
|
210
|
+
data-steps-icon-check="true"
|
|
211
|
+
data-steps-icon-lock="true"
|
|
212
|
+
data-steps-aria-label="Checkout process"
|
|
213
|
+
>
|
|
214
|
+
</brick-stepper-v1>
|
|
215
|
+
|
|
216
|
+
<!-- Steps: Cart → Shipping → Payment → Confirmation -->
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Onboarding Wizard
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<brick-stepper-v1
|
|
223
|
+
data-steps="5"
|
|
224
|
+
data-steps-current="3"
|
|
225
|
+
data-steps-label="Steg"
|
|
226
|
+
data-steps-icon-check="true"
|
|
227
|
+
data-steps-aria-label="Onboarding wizard"
|
|
228
|
+
>
|
|
229
|
+
</brick-stepper-v1>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Reverse Flow (Countdown)
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<brick-stepper-v1
|
|
236
|
+
data-steps="7"
|
|
237
|
+
data-steps-current="5"
|
|
238
|
+
data-steps-order="desc"
|
|
239
|
+
data-steps-label="Dag"
|
|
240
|
+
data-steps-aria-label="Days remaining"
|
|
241
|
+
>
|
|
242
|
+
</brick-stepper-v1>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Framework Integration
|
|
246
|
+
|
|
247
|
+
### Svelte
|
|
248
|
+
|
|
249
|
+
```svelte
|
|
250
|
+
<script>
|
|
251
|
+
let currentStep = 1;
|
|
252
|
+
|
|
253
|
+
function nextStep() {
|
|
254
|
+
currentStep++;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function prevStep() {
|
|
258
|
+
currentStep--;
|
|
259
|
+
}
|
|
260
|
+
</script>
|
|
261
|
+
|
|
262
|
+
<brick-stepper-v1
|
|
263
|
+
data-steps="5"
|
|
264
|
+
data-steps-current={currentStep.toString()}
|
|
265
|
+
data-steps-label="Step"
|
|
266
|
+
/>
|
|
267
|
+
|
|
268
|
+
<button on:click={prevStep}>Previous</button>
|
|
269
|
+
<button on:click={nextStep}>Next</button>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### React
|
|
273
|
+
|
|
274
|
+
```jsx
|
|
275
|
+
import { useState } from 'react';
|
|
276
|
+
|
|
277
|
+
function CheckoutFlow() {
|
|
278
|
+
const [currentStep, setCurrentStep] = useState(1);
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<>
|
|
282
|
+
<brick-stepper-v1
|
|
283
|
+
data-steps="4"
|
|
284
|
+
data-steps-current={currentStep.toString()}
|
|
285
|
+
data-steps-label="Step"
|
|
286
|
+
data-steps-icon-check="true"
|
|
287
|
+
/>
|
|
288
|
+
|
|
289
|
+
<button onClick={() => setCurrentStep(currentStep - 1)}>Back</button>
|
|
290
|
+
<button onClick={() => setCurrentStep(currentStep + 1)}>Next</button>
|
|
291
|
+
</>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Technical Details
|
|
297
|
+
|
|
298
|
+
- **Custom Element**: `brick-stepper-v1`
|
|
299
|
+
- **Base Class**: BrickElement
|
|
300
|
+
- **Dependencies**:
|
|
301
|
+
- @amedia/brick-icon (for check and lock icons)
|
|
302
|
+
- @amedia/brick-template (base class)
|
|
303
|
+
- @amedia/brick-tokens (design tokens)
|
|
304
|
+
- **Renders as**: `<ol>` (ordered list) with `<li>` items
|
|
305
|
+
- **SSR Compatible**: Yes, with template function
|
|
306
|
+
|
|
307
|
+
## Important Notes
|
|
308
|
+
|
|
309
|
+
- Either `data-steps-current` or `data-steps-completed` must be provided
|
|
310
|
+
- Step numbers are 1-indexed (first step is "1", not "0")
|
|
311
|
+
- When `data-steps-order="desc"`, steps are visually reversed but still numbered correctly
|
|
312
|
+
- Icons require `data-steps-icon-check` or `data-steps-icon-lock` to be set to "true" (string)
|
|
313
|
+
- The component is purely presentational - it does not handle step navigation logic
|
|
314
|
+
- Labels are automatically numbered: if `data-steps-label="Steg"`, steps show as "Steg 1", "Steg 2", etc.
|
|
315
|
+
- The default ARIA label is in Norwegian: "Fremdriftsindikator" - customize for other languages
|
|
316
|
+
|
|
317
|
+
## Version
|
|
318
|
+
|
|
319
|
+
Current version: 1.0.18
|