@amedia/brick-mcp 0.0.1-LLM-DOCS → 0.0.1-NEW-PATH-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.
Files changed (65) hide show
  1. package/README.md +241 -98
  2. package/dist/data/components/brick-actions.json +6 -0
  3. package/dist/data/components/brick-alt-teaser.json +10 -0
  4. package/dist/data/components/brick-avatar.json +11 -0
  5. package/dist/data/components/brick-button.json +12 -0
  6. package/dist/data/components/brick-card.json +10 -0
  7. package/dist/data/components/brick-carousel.json +11 -0
  8. package/dist/data/components/brick-classnames.json +10 -0
  9. package/dist/data/components/brick-countdown.json +7 -0
  10. package/dist/data/components/brick-dialog.json +11 -0
  11. package/dist/data/components/brick-fonts.json +10 -0
  12. package/dist/data/components/brick-helloworld.json +7 -0
  13. package/dist/data/components/brick-icon.json +10 -0
  14. package/dist/data/components/brick-icons.json +11 -0
  15. package/dist/data/components/brick-illustrations.json +7 -0
  16. package/dist/data/components/brick-image.json +10 -0
  17. package/dist/data/components/brick-input.json +12 -0
  18. package/{data → dist/data}/components/brick-mcp.json +1 -1
  19. package/dist/data/components/brick-nifs.json +7 -0
  20. package/{data → dist/data}/components/brick-pill.json +1 -1
  21. package/{data → dist/data}/components/brick-player.json +1 -1
  22. package/dist/data/components/brick-published.json +7 -0
  23. package/{data → dist/data}/components/brick-share.json +1 -1
  24. package/{data → dist/data}/components/brick-stepper.json +1 -1
  25. package/{data → dist/data}/components/brick-tab.json +1 -1
  26. package/{data → dist/data}/components/brick-tabs.json +1 -1
  27. package/{data → dist/data}/components/brick-tag.json +1 -1
  28. package/{data → dist/data}/components/brick-teaser-player.json +1 -1
  29. package/{data → dist/data}/components/brick-teaser-reels.json +1 -1
  30. package/{data → dist/data}/components/brick-teaser.json +1 -1
  31. package/{data → dist/data}/components/brick-textarea.json +1 -1
  32. package/{data → dist/data}/components/brick-toast.json +1 -1
  33. package/{data → dist/data}/components/brick-toggle.json +1 -1
  34. package/{data → dist/data}/components/brick-tokens.json +1 -1
  35. package/{data → dist/data}/components/brick-tooltip.json +1 -1
  36. package/{data → dist/data}/components-metadata.json +29 -29
  37. package/dist/data/components.json +321 -0
  38. package/dist/http.js +311 -0
  39. package/dist/http.js.map +7 -0
  40. package/dist/index.js +52 -81
  41. package/dist/index.js.map +4 -4
  42. package/package.json +3 -6
  43. package/scripts/generate-data.js +37 -40
  44. package/data/components/brick-actions.md +0 -59
  45. package/data/components/brick-alt-teaser.md +0 -253
  46. package/data/components/brick-avatar.md +0 -265
  47. package/data/components/brick-button.md +0 -364
  48. package/data/components/brick-card.md +0 -329
  49. package/data/components/brick-carousel.md +0 -330
  50. package/data/components/brick-classnames.md +0 -150
  51. package/data/components/brick-countdown.md +0 -179
  52. package/data/components/brick-dialog.md +0 -418
  53. package/data/components/brick-fonts.md +0 -335
  54. package/data/components/brick-helloworld.md +0 -202
  55. package/data/components/brick-icon.md +0 -271
  56. package/data/components/brick-icons.md +0 -430
  57. package/data/components/brick-illustrations.md +0 -552
  58. package/data/components/brick-image.md +0 -335
  59. package/data/components/brick-input.md +0 -521
  60. package/data/components/brick-nifs.md +0 -163
  61. package/data/components/brick-published.json +0 -7
  62. package/data/tokens-documentation.json +0 -7
  63. /package/{data → dist/data}/components/brick-template.json +0 -0
  64. /package/{data → dist/data}/components/brick-themes.json +0 -0
  65. /package/{data → dist/data}/tokens.json +0 -0
@@ -1,521 +0,0 @@
1
- ---
2
- name: brick-input
3
- version: 3.0.9
4
- selector: brick-input-v3
5
- category: Forms
6
- tags: [input, form-control, text-field, validation, form-element, user-input]
7
- use_cases: [forms, authentication, search, checkout, user-registration, contact-forms, surveys, data-entry]
8
- related: [brick-tokens, brick-form]
9
- ---
10
-
11
- # Brick Input
12
-
13
- A web component that renders accessible input fields with labels, validation support, and comprehensive attribute options for all standard HTML input types.
14
-
15
- ## Key Capabilities
16
-
17
- - Supports all standard HTML input types (text, email, password, number, date, checkbox, radio, etc.)
18
- - Built-in label management with optional visual hiding (screen-reader accessible)
19
- - Pattern-based validation with error messages and aria-live announcements
20
- - Help text and optional field indicators
21
- - Automatic asterisk addition for required radio/checkbox groups
22
- - Full accessibility support with ARIA attributes
23
- - SSR compatible with hydration support
24
- - Framework-agnostic web component
25
-
26
- ## Props/Attributes
27
-
28
- | Attribute | Type | Default | Required | Description |
29
- |-----------|------|---------|----------|-------------|
30
- | `type` | `'text' \| 'email' \| 'password' \| 'number' \| 'date' \| 'checkbox' \| 'radio' \| 'tel' \| 'url' \| 'search' \| 'file' \| 'color' \| 'range' \| 'time' \| 'button' \| 'submit' \| 'reset' \| 'hidden' \| 'image'` | `'text'` | yes | Type of input field to render |
31
- | `data-label-text` | string | - | recommended | Label text for the input field |
32
- | `data-id` | string | - | no | ID for the input element |
33
- | `data-name` | string | - | no | Name attribute for form submission |
34
- | `data-value` | string | - | no | Initial value of the input |
35
- | `data-placeholder` | string | - | no | Placeholder text |
36
- | `data-required` | boolean | `false` | no | Marks the field as required |
37
- | `data-disabled` | boolean | `false` | no | Disables the input |
38
- | `data-readonly` | boolean | `false` | no | Makes the input read-only |
39
- | `data-label-hidden` | boolean | `false` | no | Visually hides label (still accessible to screen readers) |
40
- | `data-pattern` | string | - | no | Regex pattern for validation (text, password, search, tel, url, email) |
41
- | `data-errortext` | string | `'Feltet må fylles ut korrekt.'` | no | Error message shown on validation failure |
42
- | `data-helptext` | string | - | no | Helper text displayed below the input |
43
- | `data-optionaltext` | string | - | no | Text to indicate optional fields (e.g., "optional") |
44
- | `data-min` | string | - | no | Minimum value (for number, date, range) |
45
- | `data-max` | string | - | no | Maximum value (for number, date, range) |
46
- | `data-minlength` | string | - | no | Minimum character length |
47
- | `data-maxlength` | string | - | no | Maximum character length |
48
- | `data-step` | string | - | no | Step value for number/range inputs |
49
- | `data-size` | string | - | no | Size of the input field |
50
- | `data-autocomplete` | string | - | no | Autocomplete attribute value |
51
- | `data-autofocus` | boolean | `false` | no | Auto-focus the input on page load |
52
- | `data-spellcheck` | boolean | `false` | no | Enable spellcheck |
53
- | `data-checked` | boolean | `false` | no | Initial checked state (checkbox, radio) |
54
- | `data-accept` | string | - | no | Accepted file types (for file inputs) |
55
- | `data-multiple` | boolean | `false` | no | Allow multiple file selection or options |
56
- | `data-src` | string | - | no | Image source (for image type) |
57
- | `data-alt` | string | - | no | Alt text (for image type) |
58
- | `data-list` | string | - | no | ID of datalist element for autocomplete suggestions |
59
-
60
- ## Examples
61
-
62
- ### Basic Text Input
63
-
64
- ```html
65
- <brick-input-v3
66
- data-type="text"
67
- data-label-text="First Name"
68
- data-id="firstname"
69
- data-name="firstname"
70
- data-required="true">
71
- </brick-input-v3>
72
- ```
73
-
74
- ### Email Input with Validation
75
-
76
- ```html
77
- <brick-input-v3
78
- data-type="email"
79
- data-label-text="Email Address"
80
- data-id="email"
81
- data-name="email"
82
- data-required="true"
83
- data-placeholder="you@example.com"
84
- data-errortext="Please enter a valid email address"
85
- data-helptext="We'll never share your email">
86
- </brick-input-v3>
87
- ```
88
-
89
- ### Password Input
90
-
91
- ```html
92
- <brick-input-v3
93
- data-type="password"
94
- data-label-text="Password"
95
- data-id="password"
96
- data-name="password"
97
- data-required="true"
98
- data-minlength="8"
99
- data-pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$"
100
- data-errortext="Password must be at least 8 characters with letters and numbers">
101
- </brick-input-v3>
102
- ```
103
-
104
- ### Number Input with Range
105
-
106
- ```html
107
- <brick-input-v3
108
- data-type="number"
109
- data-label-text="Age"
110
- data-id="age"
111
- data-name="age"
112
- data-min="18"
113
- data-max="120"
114
- data-required="true">
115
- </brick-input-v3>
116
- ```
117
-
118
- ### Checkbox Input
119
-
120
- ```html
121
- <brick-input-v3
122
- data-type="checkbox"
123
- data-label-text="I accept the terms and conditions"
124
- data-id="terms"
125
- data-name="terms"
126
- data-value="accepted"
127
- data-required="true">
128
- </brick-input-v3>
129
- ```
130
-
131
- ### Radio Button Group
132
-
133
- ```html
134
- <!-- Radio buttons should be wrapped in a fieldset with legend -->
135
- <fieldset>
136
- <legend>Select an option</legend>
137
-
138
- <brick-input-v3
139
- data-type="radio"
140
- data-label-text="Option 1"
141
- data-id="option1"
142
- data-name="choice"
143
- data-value="1"
144
- data-required="true">
145
- </brick-input-v3>
146
-
147
- <brick-input-v3
148
- data-type="radio"
149
- data-label-text="Option 2"
150
- data-id="option2"
151
- data-name="choice"
152
- data-value="2"
153
- data-required="true">
154
- </brick-input-v3>
155
- </fieldset>
156
- ```
157
-
158
- ### Date Input
159
-
160
- ```html
161
- <brick-input-v3
162
- data-type="date"
163
- data-label-text="Date of Birth"
164
- data-id="dob"
165
- data-name="dob"
166
- data-min="1900-01-01"
167
- data-max="2025-12-31"
168
- data-required="true">
169
- </brick-input-v3>
170
- ```
171
-
172
- ### Search Input
173
-
174
- ```html
175
- <brick-input-v3
176
- data-type="search"
177
- data-label-text="Search"
178
- data-label-hidden="true"
179
- data-id="search"
180
- data-name="q"
181
- data-placeholder="Search articles...">
182
- </brick-input-v3>
183
- ```
184
-
185
- ### File Upload
186
-
187
- ```html
188
- <brick-input-v3
189
- data-type="file"
190
- data-label-text="Upload Document"
191
- data-id="document"
192
- data-name="document"
193
- data-accept=".pdf,.doc,.docx"
194
- data-multiple="true">
195
- </brick-input-v3>
196
- ```
197
-
198
- ### Input with Datalist (Autocomplete)
199
-
200
- ```html
201
- <brick-input-v3
202
- data-type="text"
203
- data-label-text="Choose a browser"
204
- data-id="browser"
205
- data-name="browser"
206
- data-list="browsers">
207
- </brick-input-v3>
208
-
209
- <datalist id="browsers">
210
- <option value="Chrome">
211
- <option value="Firefox">
212
- <option value="Safari">
213
- <option value="Edge">
214
- </datalist>
215
- ```
216
-
217
- ### Optional Field
218
-
219
- ```html
220
- <brick-input-v3
221
- data-type="text"
222
- data-label-text="Middle Name"
223
- data-id="middlename"
224
- data-name="middlename"
225
- data-optionaltext="(optional)">
226
- </brick-input-v3>
227
- ```
228
-
229
- ### Phone Number with Pattern
230
-
231
- ```html
232
- <brick-input-v3
233
- data-type="tel"
234
- data-label-text="Phone Number"
235
- data-id="phone"
236
- data-name="phone"
237
- data-pattern="[0-9]{8}"
238
- data-placeholder="12345678"
239
- data-errortext="Please enter a valid 8-digit phone number"
240
- data-required="true">
241
- </brick-input-v3>
242
- ```
243
-
244
- ## Framework Integration
245
-
246
- ### Svelte
247
-
248
- ```svelte
249
- <script>
250
- import '@amedia/brick-input';
251
-
252
- let email = '';
253
-
254
- function handleChange(event) {
255
- email = event.target.value;
256
- console.log('Email changed:', email);
257
- }
258
- </script>
259
-
260
- <brick-input-v3
261
- data-type="email"
262
- data-label-text="Email"
263
- data-id="email"
264
- data-name="email"
265
- data-required="true"
266
- onchange={handleChange}
267
- />
268
- ```
269
-
270
- ### React
271
-
272
- ```javascript
273
- import '@amedia/brick-input';
274
-
275
- function MyForm() {
276
- const handleChange = (e) => {
277
- console.log('Value:', e.target.value);
278
- };
279
-
280
- return (
281
- <brick-input-v3
282
- data-type="text"
283
- data-label-text="Username"
284
- data-id="username"
285
- data-name="username"
286
- data-required="true"
287
- onChange={handleChange}
288
- />
289
- );
290
- }
291
- ```
292
-
293
- ## Programmatic Usage
294
-
295
- ```javascript
296
- import { BrickInput } from '@amedia/brick-input';
297
-
298
- const input = new BrickInput({
299
- type: 'email',
300
- labelText: 'Email Address',
301
- id: 'email',
302
- name: 'email',
303
- required: true,
304
- placeholder: 'you@example.com'
305
- });
306
-
307
- // Set change handler
308
- input.onChange = (event) => {
309
- console.log('Value changed:', event.target.value);
310
- };
311
-
312
- // Add to DOM
313
- document.querySelector('form').appendChild(input);
314
- ```
315
-
316
- ## Server-Side Rendering
317
-
318
- ```javascript
319
- import { renderBrickInput } from '@amedia/brick-input/template';
320
-
321
- const inputHTML = renderBrickInput({
322
- type: 'text',
323
- labelText: 'First Name',
324
- id: 'firstname',
325
- name: 'firstname',
326
- required: true
327
- });
328
-
329
- // Include CSS file in your HTML
330
- // <link rel="stylesheet" href="https://assets.acdn.no/pkg/@amedia/brick-input/v3/css/styles.css">
331
- ```
332
-
333
- ## Accessibility
334
-
335
- - **WCAG 2.1 AA** compliant
336
- - Labels are always associated with inputs via `for` attribute
337
- - `data-label-hidden` provides visually hidden labels that remain accessible to screen readers
338
- - Error messages announced via `aria-live` regions
339
- - Required fields automatically get asterisks for radio/checkbox groups
340
- - Pattern validation triggers on blur with screen reader announcements
341
- - All standard ARIA attributes supported through native HTML input
342
- - Keyboard navigation fully supported
343
- - Focus states clearly visible
344
-
345
- ## Validation
346
-
347
- Validation is triggered on `blur` event for inputs with a `data-pattern` attribute:
348
-
349
- ```html
350
- <brick-input-v3
351
- data-type="text"
352
- data-label-text="Username"
353
- data-pattern="^[a-zA-Z0-9_]{3,16}$"
354
- data-errortext="Username must be 3-16 characters (letters, numbers, underscore only)">
355
- </brick-input-v3>
356
- ```
357
-
358
- **Supported types for pattern validation:**
359
- - text
360
- - password
361
- - search
362
- - tel
363
- - url
364
- - email
365
-
366
- Error messages are:
367
- - Displayed visually below the input
368
- - Announced to screen readers via aria-live="polite"
369
- - Only shown after the user has interacted with the field (on blur)
370
-
371
- ## Common Patterns
372
-
373
- ### Login Form
374
-
375
- ```html
376
- <form>
377
- <brick-input-v3
378
- data-type="email"
379
- data-label-text="Email"
380
- data-id="login-email"
381
- data-name="email"
382
- data-autocomplete="email"
383
- data-required="true">
384
- </brick-input-v3>
385
-
386
- <brick-input-v3
387
- data-type="password"
388
- data-label-text="Password"
389
- data-id="login-password"
390
- data-name="password"
391
- data-autocomplete="current-password"
392
- data-required="true">
393
- </brick-input-v3>
394
-
395
- <button type="submit">Log In</button>
396
- </form>
397
- ```
398
-
399
- ### Registration Form
400
-
401
- ```html
402
- <form>
403
- <brick-input-v3
404
- data-type="text"
405
- data-label-text="Full Name"
406
- data-id="fullname"
407
- data-name="fullname"
408
- data-autocomplete="name"
409
- data-required="true">
410
- </brick-input-v3>
411
-
412
- <brick-input-v3
413
- data-type="email"
414
- data-label-text="Email"
415
- data-id="email"
416
- data-name="email"
417
- data-autocomplete="email"
418
- data-required="true">
419
- </brick-input-v3>
420
-
421
- <brick-input-v3
422
- data-type="password"
423
- data-label-text="Password"
424
- data-id="password"
425
- data-name="password"
426
- data-autocomplete="new-password"
427
- data-minlength="8"
428
- data-required="true">
429
- </brick-input-v3>
430
-
431
- <brick-input-v3
432
- data-type="checkbox"
433
- data-label-text="I agree to the terms and conditions"
434
- data-id="terms"
435
- data-name="terms"
436
- data-required="true">
437
- </brick-input-v3>
438
-
439
- <button type="submit">Register</button>
440
- </form>
441
- ```
442
-
443
- ### Search Box
444
-
445
- ```html
446
- <form role="search">
447
- <brick-input-v3
448
- data-type="search"
449
- data-label-text="Search"
450
- data-label-hidden="true"
451
- data-id="search"
452
- data-name="q"
453
- data-placeholder="Search articles..."
454
- data-autocomplete="off">
455
- </brick-input-v3>
456
-
457
- <button type="submit">Search</button>
458
- </form>
459
- ```
460
-
461
- ### Contact Form
462
-
463
- ```html
464
- <form>
465
- <brick-input-v3
466
- data-type="text"
467
- data-label-text="Name"
468
- data-id="contact-name"
469
- data-name="name"
470
- data-required="true">
471
- </brick-input-v3>
472
-
473
- <brick-input-v3
474
- data-type="email"
475
- data-label-text="Email"
476
- data-id="contact-email"
477
- data-name="email"
478
- data-required="true">
479
- </brick-input-v3>
480
-
481
- <brick-input-v3
482
- data-type="tel"
483
- data-label-text="Phone"
484
- data-id="contact-phone"
485
- data-name="phone"
486
- data-optionaltext="(optional)">
487
- </brick-input-v3>
488
-
489
- <button type="submit">Send</button>
490
- </form>
491
- ```
492
-
493
- ## Technical Details
494
-
495
- - **Custom Element**: `brick-input-v3`
496
- - **Base Class**: BrickElement
497
- - **Dependencies**:
498
- - @amedia/brick-tokens (design tokens and utilities)
499
- - @amedia/brick-template (base class)
500
- - **Renders as**: Various `<input>` types wrapped with `<label>`
501
- - **SSR Compatible**: Yes, with hydration support
502
- - **Framework**: Framework-agnostic web component
503
-
504
- ## Important Notes
505
-
506
- - The `type` attribute is required - defaults to `'text'` if not provided
507
- - Use `data-label-text` for accessibility - it creates proper label associations
508
- - Use `data-label-hidden` to visually hide labels while keeping them accessible to screen readers
509
- - Pattern validation only works with: text, password, search, tel, url, and email types
510
- - For radio buttons and checkboxes, wrap groups in a `<fieldset>` with a `<legend>`
511
- - Required radio/checkbox groups automatically get asterisks added to their parent legend
512
- - Error messages are announced to screen readers via aria-live regions
513
- - Validation triggers on blur (when user leaves the field)
514
- - The component provides an `onChange` setter/getter for custom change handling
515
- - Checkbox and radio inputs automatically manage their `checked` attribute on change
516
- - Version 3.0.0 removed the `getCssText` export - use CSS files instead
517
- - Version 2.0.0 changed the onChange event to bubble up correctly
518
-
519
- ## Version
520
-
521
- Current version: 3.0.9
@@ -1,163 +0,0 @@
1
- ---
2
- name: brick-nifs
3
- version: 0.0.7
4
- selector: brick-nifs-v0
5
- category: Data Display
6
- tags: [sports, live-scores, websocket, real-time, nifs, football, soccer]
7
- use_cases: [sports-coverage, live-match-updates, football-scores, real-time-events]
8
- related: [brick-teaser]
9
- ---
10
-
11
- # Brick Nifs
12
-
13
- A specialized component for displaying live sports match scores and updates from the NIFS (Norwegian sports data) API via WebSocket connections.
14
-
15
- ## Key Capabilities
16
-
17
- - Real-time match score updates via WebSocket connection to NIFS API
18
- - Automatic fetching of initial match data from NIFS v2 API
19
- - Integration with brick-teaser components to display live scores as breaking news
20
- - Automatic cleanup of WebSocket connections on component removal
21
- - Support for both 45-minute (half-time) and 90-minute (full-time) scores
22
- - Event-driven architecture using custom events to update related components
23
-
24
- ## Props/Attributes
25
-
26
- | Attribute | Type | Default | Required | Description |
27
- |-----------|------|---------|----------|-------------|
28
- | `data-nifsid` | string | - | yes | The NIFS match ID to track and display live updates for |
29
-
30
- ## Examples
31
-
32
- ### Basic Live Match Score Tracking
33
-
34
- Track a single football match and display live score updates:
35
-
36
- ```html
37
- <brick-nifs-v0 data-nifsid="12345"></brick-nifs-v0>
38
- ```
39
-
40
- ### Integration with Brick Teaser
41
-
42
- Display live match scores on teaser components by matching the external ID:
43
-
44
- ```html
45
- <brick-nifs-v0 data-nifsid="12345"></brick-nifs-v0>
46
-
47
- <brick-teaser-v16
48
- data-external-id="12345"
49
- data-title="Norway vs Sweden"
50
- data-href="/sport/match/12345">
51
- </brick-teaser-v16>
52
- ```
53
-
54
- When the match score updates, the brick-nifs component will dispatch a custom event that brick-teaser components listen for, automatically displaying the score as breaking news text.
55
-
56
- ### Multiple Match Tracking
57
-
58
- Track multiple matches on the same page:
59
-
60
- ```html
61
- <brick-nifs-v0 data-nifsid="12345"></brick-nifs-v0>
62
- <brick-nifs-v0 data-nifsid="67890"></brick-nifs-v0>
63
-
64
- <brick-teaser-v16
65
- data-external-id="12345"
66
- data-title="Norway vs Sweden">
67
- </brick-teaser-v16>
68
-
69
- <brick-teaser-v16
70
- data-external-id="67890"
71
- data-title="Denmark vs Finland">
72
- </brick-teaser-v16>
73
- ```
74
-
75
- ## How It Works
76
-
77
- ### Initial Score Fetch
78
-
79
- When the component connects to the DOM, it:
80
- 1. Retrieves the `data-nifsid` attribute
81
- 2. Fetches initial match data from `https://v2api.nifs.no/matches/{matchId}/`
82
- 3. Extracts the current score (90-minute or 45-minute)
83
- 4. If a score exists (non-zero), dispatches a custom event to update related brick-teaser components
84
-
85
- ### Real-Time Updates
86
-
87
- The component establishes a WebSocket connection to `wss://websocket.nifs.no/socket.io/`:
88
- 1. Joins the match room using the NIFS match ID
89
- 2. Sends ping messages every 2.5 seconds to keep the connection alive
90
- 3. Listens for `updateMatchEvent` and `updateImportantEvents` messages
91
- 4. Parses the score data and dispatches custom events to update brick-teaser components
92
-
93
- ### Event-Driven Integration
94
-
95
- The component dispatches `brick-teaser:attribute` custom events with the following structure:
96
-
97
- ```javascript
98
- {
99
- bubbles: true,
100
- cancelable: true,
101
- composed: false,
102
- detail: {
103
- attributeName: 'data-breaking-news-text',
104
- attributeValue: '2 - 1', // Current score
105
- key: 'data-external-id',
106
- keyValue: '12345' // Match ID
107
- }
108
- }
109
- ```
110
-
111
- Any brick-teaser component with a matching `data-external-id` will receive this event and update its breaking news text with the live score.
112
-
113
- ## Programmatic Usage
114
-
115
- ```javascript
116
- import { BrickNifs } from '@amedia/brick-nifs';
117
-
118
- // The component is automatically registered as 'brick-nifs-v0'
119
- const nifsComponent = document.createElement('brick-nifs-v0');
120
- nifsComponent.dataset.nifsid = '12345';
121
- document.body.appendChild(nifsComponent);
122
- ```
123
-
124
- ## Technical Details
125
-
126
- - **Custom Element**: `brick-nifs-v0`
127
- - **Base Class**: BrickElement
128
- - **Dependencies**: [@amedia/brick-template]
129
- - **Renders as**: Custom element (no visual output, data-only component)
130
- - **WebSocket**: Persistent connection to NIFS WebSocket API
131
- - **API**: NIFS v2 REST API for initial data fetch
132
-
133
- ## Important Notes
134
-
135
- ### No Visual Output
136
-
137
- This component does not render any visible content. It acts as a data provider and event dispatcher for other components (primarily brick-teaser).
138
-
139
- ### WebSocket Connection Management
140
-
141
- - A single WebSocket connection is created per component instance
142
- - The connection sends ping messages every 2.5 seconds to stay alive
143
- - The connection is automatically cleaned up when the component is removed from the DOM via `disconnectedCallback()`
144
- - Each instance joins its specific match room on the NIFS WebSocket server
145
-
146
- ### Score Format
147
-
148
- The component prioritizes scores in this order:
149
- 1. 90-minute score (full-time)
150
- 2. 45-minute score (half-time)
151
- 3. Falls back to 0 if no score is available
152
-
153
- ### External ID Matching
154
-
155
- For the live score integration to work, brick-teaser components must have a `data-external-id` attribute that matches the `data-nifsid` of the brick-nifs component.
156
-
157
- ### Event Targeting
158
-
159
- The custom events are dispatched to ALL brick-teaser elements with a matching `data-external-id`, allowing multiple teasers on the same page to display the same live score.
160
-
161
- ## Version
162
-
163
- Current version: 0.0.7
@@ -1,7 +0,0 @@
1
- {
2
- "name": "brick-published",
3
- "version": "4.0.1",
4
- "selector": "brick-published-v4",
5
- "description": "brick-published",
6
- "mdx": "import {\n Meta,\n Canvas,\n Source,\n Controls,\n Markdown,\n} from '@storybook/addon-docs/blocks';\n\nimport * as BrickStories from './brick-published.stories';\n\nimport ReadMe from '../README.md?raw';\n\n<brick-style></brick-style>;\n\n<Meta of={BrickStories} />\n\n# brick-published\n\n## Purpose\n\nThe `brick-published` component displays publication dates in a semantic and accessible way.\n\nIt wraps a `<time>` element with proper datetime attributes to provide both human-readable and machine-readable publication timestamps. This component is commonly used in articles, blog posts, and news content to indicate when content was published or last modified.\n\n- Semantic HTML using the `<time>` element\n- Support for both publication and modification dates via `itemprop` attribute\n- Flexible date display formatting while maintaining ISO 8601 datetime attributes\n- Server-side rendering support\n- Consistent styling across different contexts\n\n<Canvas of={BrickStories.Published} sourceState=\"shown\" />\n\n## Accessibility\n\nThe `brick-published` component follows web accessibility best practices:\n\n### Semantic Structure\n\n- Uses the native `<time>` element which provides semantic meaning to assistive technologies\n- Includes proper `datetime` attribute in ISO 8601 format for machine readability\n- Uses `itemprop` attribute for structured data (schema.org microdata)\n- Follows WCAG 2.2 guidelines for meaningful content structure\n- Uses semantic markup that doesn't require additional ARIA attributes\n- Provides both human-readable display text and machine-readable datetime values\n\n### Screen Reader Support\n\n- The component structure ensures screen readers can properly announce the publication date\n- The label (e.g., \"Published:\") provides clear context before the date\n- The `datetime` attribute allows assistive technologies to interpret the exact timestamp\n\n## Usage\n\nThe `brick-published` component can be used in multiple ways depending on your rendering approach:\n\n<Source language=\"js\" code={'npm install @amedia/brick-published'} />\n\n### Server side rendering\n\nRender the markup serverside\n\n#### Import and render from '@amedia/brick-published/template'\n\n<Source\n language=\"javascript\"\n code={`import { renderBrickPublished } from '@amedia/brick-published/template';`}\n/>\n\n<Source\n language=\"javascript\"\n code={`const markup = renderPublished({\n dataDatetime: '2022-04-22T12:00:00.000+0200',\n dataLabel: 'Publisert:',\n dataDisplayDate: '22.04.23 12:01',\n dataItemprop: 'datePublished',\n })\n`}\n/>\n\n### Client side\n\n#### Import\n\n<Source\n language=\"javascript\"\n code={`\n import 'https://assets.acdn.no/pkg/@amedia/brick-published/v4/brick-published.js';\n `}\n/>\n\n#### Create the DOM element\n\nIf the markup is not rendered serverside, there are two options creating markup client side.\n\nExample: Template literals\nThe simplest way is using template literals, passing the appropriate data-attributes.\n\n<Source\n language=\"html\"\n code={`<brick-published-v4\n data-label=\"Publisert:\" data-display-date=\"22.04.23 12:01\" data-datetime=\"2022-04-22T12:00:00.000+0200\" data-itemprop=\"datePublished\"\n></brick-published-v4>`}\n/>\n\nExample: Using javascript\nCreating the element using javascript, setting dataset properties.\n\n<Source\n language=\"javascript\"\n code={`\n const el = document.createElement('brick-published-v4');\n el.setAttribute('data-label', 'Publisert:');\n el.setAttribute('data-display-date', '22.04.23 12:01');\n el.setAttribute('data-datetime', '2022-04-22T12:00:00.000+0200');\n el.setAttribute('data-itemprop', 'datePublished');\n document.body.appendChild(el);\n `}\n/>\n\n## Attributes overview for brick-published\n\nAll dataset attributes are synced to camelcased properties.\n\n<Controls />\n<Canvas />\n\n## Styling and CSS Properties\n\n🤝 brick-published is styled using CSS properties that must exist on the page.\n\nCSS Custom Properties can be used to customize the visual appearance. It is recommended to use the existing variants before resorting to custom properties.\n\nMake sure you scope the overrides.\n\n<div className=\"note\">\n <span>Note</span>\n It is your responsibilty to validate that your overrides adhere to the **WCAG\n 2.1 AA** guidelines.\n</div>\n\n<table>\n <thead>\n <tr>\n <th>Property</th>\n <th>Description</th>\n <th>Default</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\n <code>--b-published-color-fg</code>\n </td>\n <td>\n You can set the background svg of the avatar using this property.\n Example: \"--b-published-color-fg:var(--brick-colors-baseInvertedFg);\"\n </td>\n <td>\n <code>var(--brick-colors-baseFg)</code>\n </td>\n </tr>\n </tbody>\n</table>\n\n<Markdown>{ReadMe}</Markdown>\n"
7
- }