@amedia/brick-mcp 0.0.2 → 0.1.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 (48) hide show
  1. package/data/components-metadata.json +35 -29
  2. package/data/tokens-documentation.json +1 -1
  3. package/data/tokens.json +4848 -128
  4. package/dist/data/components/brick-actions.md +59 -0
  5. package/dist/data/components/brick-alt-teaser.md +264 -0
  6. package/dist/data/components/brick-avatar.md +299 -0
  7. package/dist/data/components/brick-button.md +373 -0
  8. package/dist/data/components/brick-card.md +359 -0
  9. package/dist/data/components/brick-carousel.md +355 -0
  10. package/dist/data/components/brick-classnames.md +147 -0
  11. package/dist/data/components/brick-countdown.md +180 -0
  12. package/dist/data/components/brick-dialog.md +458 -0
  13. package/dist/data/components/brick-fonts.md +389 -0
  14. package/dist/data/components/brick-helloworld.md +228 -0
  15. package/dist/data/components/brick-icon.md +274 -0
  16. package/dist/data/components/brick-icons.md +570 -0
  17. package/dist/data/components/brick-illustrations.md +604 -0
  18. package/dist/data/components/brick-image.md +361 -0
  19. package/dist/data/components/brick-input.md +557 -0
  20. package/dist/data/components/brick-mcp.json +6 -0
  21. package/dist/data/components/brick-nifs.md +164 -0
  22. package/dist/data/components/brick-pill.json +6 -0
  23. package/dist/data/components/brick-player.json +7 -0
  24. package/dist/data/components/brick-published.json +7 -0
  25. package/dist/data/components/brick-share.json +7 -0
  26. package/dist/data/components/brick-stepper.json +7 -0
  27. package/dist/data/components/brick-tab.json +7 -0
  28. package/dist/data/components/brick-tabs.json +9 -0
  29. package/dist/data/components/brick-tag.json +7 -0
  30. package/dist/data/components/brick-teaser-player.json +9 -0
  31. package/dist/data/components/brick-teaser-reels.json +9 -0
  32. package/dist/data/components/brick-teaser.json +9 -0
  33. package/dist/data/components/brick-template.json +9 -0
  34. package/dist/data/components/brick-textarea.json +7 -0
  35. package/dist/data/components/brick-themes.json +6 -0
  36. package/dist/data/components/brick-toast.json +9 -0
  37. package/dist/data/components/brick-toggle.json +7 -0
  38. package/dist/data/components/brick-tokens.json +8 -0
  39. package/dist/data/components/brick-tooltip.json +7 -0
  40. package/dist/data/components-metadata.json +234 -0
  41. package/dist/data/tokens-documentation.json +7 -0
  42. package/dist/data/tokens.json +4976 -0
  43. package/dist/http.js +314 -0
  44. package/dist/http.js.map +7 -0
  45. package/dist/index.js +26 -37
  46. package/dist/index.js.map +2 -2
  47. package/package.json +2 -2
  48. package/scripts/generate-data.js +15 -47
@@ -0,0 +1,373 @@
1
+ ---
2
+ name: brick-button
3
+ version: 9.3.1
4
+ selector: brick-button-v9
5
+ category: Forms
6
+ tags: [button, cta, action, interactive, link, form-control]
7
+ use_cases:
8
+ [
9
+ forms,
10
+ call-to-action,
11
+ navigation,
12
+ user-interaction,
13
+ authentication,
14
+ checkout,
15
+ product-listing,
16
+ modal-triggers,
17
+ ]
18
+ related: [brick-icon, brick-tokens]
19
+ ---
20
+
21
+ # Brick Button
22
+
23
+ A customizable, accessible button component that supports multiple visual variants, sizes, and can render as either a button or link element.
24
+
25
+ ## Key Capabilities
26
+
27
+ - Three visual variants: primary, secondary, and outlined
28
+ - Renders as `<button>` or `<a>` based on presence of `data-linkto` attribute
29
+ - Two size options: small and medium
30
+ - Icon support with configurable placement (left, right, top)
31
+ - Full ARIA attribute support for accessibility
32
+ - CSS custom properties for styling customization
33
+ - Analytics integration via ADP attributes
34
+ - Framework-agnostic web component with SSR support
35
+
36
+ ## Props/Attributes
37
+
38
+ | Attribute | Type | Default | Required | Description |
39
+ | ----------------------- | ---------------------------------------- | ----------- | -------- | ------------------------------------------------------------------- |
40
+ | `data-label` | string | - | yes | Button text/label |
41
+ | `data-version` | `'primary' \| 'secondary' \| 'outlined'` | `'primary'` | no | Visual style variant |
42
+ | `data-size` | `'small' \| 'medium'` | `'medium'` | no | Button size |
43
+ | `data-linkto` | string | - | no | URL to navigate to. When set, renders as `<a>` tag |
44
+ | `data-target` | string | - | no | Link target (e.g., `_blank` for new tab) |
45
+ | `data-icon-id` | string | - | no | ID of icon from brick-icon to display |
46
+ | `data-iconplacement` | `'top' \| 'right' \| 'left'` | `'left'` | no | Position of icon relative to label |
47
+ | `data-icontext` | string | - | no | Alternative text for icon |
48
+ | `data-disabled` | string | - | no | Disables the button when set to "true" |
49
+ | `data-as` | `'span' \| 'div'` | - | no | Renders as non-interactive element (for use with framework routers) |
50
+ | `data-adplabel` | string | - | no | ADP analytics click label |
51
+ | `data-adpvalue` | string | - | no | ADP analytics click value |
52
+ | `data-aria-label` | string | - | no | ARIA label for accessibility |
53
+ | `data-aria-labelledby` | string | - | no | ID of element that labels this button |
54
+ | `data-aria-describedby` | string | - | no | ID of element that describes this button |
55
+ | `data-aria-controls` | string | - | no | ID of element controlled by this button |
56
+ | `data-aria-expanded` | string | - | no | Indicates if controlled element is expanded |
57
+ | `data-aria-pressed` | string | - | no | Indicates pressed state for toggle buttons |
58
+
59
+ ## Examples
60
+
61
+ ### Basic Button
62
+
63
+ ```html
64
+ <brick-button-v9 data-label="Click me" data-version="primary">
65
+ </brick-button-v9>
66
+ ```
67
+
68
+ ### Button Variants
69
+
70
+ ```html
71
+ <!-- Primary button -->
72
+ <brick-button-v9 data-label="Primary Action" data-version="primary">
73
+ </brick-button-v9>
74
+
75
+ <!-- Secondary button -->
76
+ <brick-button-v9 data-label="Secondary Action" data-version="secondary">
77
+ </brick-button-v9>
78
+
79
+ <!-- Outlined button -->
80
+ <brick-button-v9 data-label="Outlined Action" data-version="outlined">
81
+ </brick-button-v9>
82
+ ```
83
+
84
+ ### Button as Link
85
+
86
+ ```html
87
+ <brick-button-v9
88
+ data-label="Visit Amedia"
89
+ data-version="primary"
90
+ data-linkto="https://www.amedia.no"
91
+ data-target="_blank"
92
+ >
93
+ </brick-button-v9>
94
+ ```
95
+
96
+ ### Button with Icon
97
+
98
+ ```html
99
+ <brick-button-v9
100
+ data-label="Search"
101
+ data-version="primary"
102
+ data-icon-id="search"
103
+ data-iconplacement="left"
104
+ >
105
+ </brick-button-v9>
106
+
107
+ <!-- Icon-only button -->
108
+ <brick-button-v9 data-icon-id="menu" data-aria-label="Open menu">
109
+ </brick-button-v9>
110
+ ```
111
+
112
+ ### Small Button
113
+
114
+ ```html
115
+ <brick-button-v9
116
+ data-label="Small Action"
117
+ data-version="secondary"
118
+ data-size="small"
119
+ >
120
+ </brick-button-v9>
121
+ ```
122
+
123
+ ### Disabled Button
124
+
125
+ ```html
126
+ <brick-button-v9
127
+ data-label="Disabled"
128
+ data-version="primary"
129
+ data-disabled="true"
130
+ >
131
+ </brick-button-v9>
132
+ ```
133
+
134
+ ## Framework Integration
135
+
136
+ ### Svelte
137
+
138
+ ```svelte
139
+ <script>
140
+ import '@amedia/brick-button';
141
+
142
+ function handleClick() {
143
+ console.log('Button clicked!');
144
+ }
145
+ </script>
146
+
147
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
148
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
149
+ <brick-button-v9
150
+ data-label="Click me"
151
+ data-version="primary"
152
+ onclick={handleClick}
153
+ />
154
+ ```
155
+
156
+ ### Using with Framework Routers
157
+
158
+ When using with framework routers (like svelte-routing), use `data-as` to render as a non-interactive element:
159
+
160
+ ```svelte
161
+ <script>
162
+ import { Link } from 'svelte-routing';
163
+ </script>
164
+
165
+ <Link to="/offers">
166
+ <brick-button-v9
167
+ data-label="See other subscriptions"
168
+ data-version="outlined"
169
+ data-as="span"
170
+ />
171
+ </Link>
172
+ ```
173
+
174
+ ### React/Vue
175
+
176
+ ```javascript
177
+ import '@amedia/brick-button';
178
+
179
+ // React
180
+ function MyComponent() {
181
+ return (
182
+ <brick-button-v9
183
+ data-label="Click me"
184
+ data-version="primary"
185
+ onClick={() => console.log('clicked')}
186
+ />
187
+ );
188
+ }
189
+
190
+ // Vue
191
+ <template>
192
+ <brick-button-v9
193
+ data-label="Click me"
194
+ data-version="primary"
195
+ @click="handleClick"
196
+ />
197
+ </template>
198
+ ```
199
+
200
+ ## Programmatic Usage
201
+
202
+ ```javascript
203
+ import { BrickButton } from '@amedia/brick-button';
204
+
205
+ const button = new BrickButton({
206
+ dataLabel: 'My Button',
207
+ dataVersion: 'primary',
208
+ dataSize: 'medium',
209
+ });
210
+
211
+ // Set click handler
212
+ button.onClick = (event) => {
213
+ console.log('Button clicked!', event);
214
+ };
215
+
216
+ // Add to DOM
217
+ document.body.appendChild(button);
218
+
219
+ // Programmatically focus the button
220
+ button.focus();
221
+ ```
222
+
223
+ ## Server-Side Rendering
224
+
225
+ ```javascript
226
+ import { renderBrickButton } from '@amedia/brick-button/template';
227
+
228
+ const buttonHTML = renderBrickButton({
229
+ dataLabel: 'Server Rendered',
230
+ dataVersion: 'primary',
231
+ dataLinkto: '/page',
232
+ });
233
+
234
+ // Include CSS file
235
+ // <link rel="stylesheet" href="https://assets.acdn.no/pkg/@amedia/brick-button/v9/css/styles.css">
236
+ ```
237
+
238
+ ## Accessibility
239
+
240
+ - Adheres to **WCAG 2.1 AA** guidelines
241
+ - Full ARIA attributes support for screen readers
242
+ - Keyboard navigation support (Enter/Space for buttons, Enter for links)
243
+ - Focus visible states with clear outline
244
+ - Disabled state prevents interaction and is communicated to assistive technology
245
+ - Icon-only buttons require `data-aria-label` for proper accessibility
246
+ - Proper semantic HTML (`<button>` vs `<a>`) based on behavior
247
+
248
+ ## Analytics Integration
249
+
250
+ Brick-button supports ADP (Amedia Data Platform) tracking:
251
+
252
+ ```html
253
+ <brick-button-v9
254
+ data-label="Subscribe Now"
255
+ data-version="primary"
256
+ data-adplabel="Subscribe CTA"
257
+ data-adpvalue="homepage-hero"
258
+ >
259
+ </brick-button-v9>
260
+ ```
261
+
262
+ ## Common Patterns
263
+
264
+ ### Call-to-Action Button
265
+
266
+ ```html
267
+ <brick-button-v9
268
+ data-label="Start Free Trial"
269
+ data-version="primary"
270
+ data-size="medium"
271
+ data-adplabel="CTA - Free Trial"
272
+ >
273
+ </brick-button-v9>
274
+ ```
275
+
276
+ ### Modal Trigger with ARIA
277
+
278
+ ```html
279
+ <brick-button-v9
280
+ data-label="Open Settings"
281
+ data-version="secondary"
282
+ data-aria-controls="settings-modal"
283
+ data-aria-expanded="false"
284
+ data-icon-id="settings"
285
+ >
286
+ </brick-button-v9>
287
+ ```
288
+
289
+ ### Toggle Button
290
+
291
+ ```html
292
+ <brick-button-v9
293
+ data-label="Follow"
294
+ data-version="outlined"
295
+ data-aria-pressed="false"
296
+ >
297
+ </brick-button-v9>
298
+ ```
299
+
300
+ ### Navigation with Icon
301
+
302
+ ```html
303
+ <brick-button-v9
304
+ data-label="Next"
305
+ data-version="primary"
306
+ data-linkto="/next-page"
307
+ data-icon-id="arrow-right"
308
+ data-iconplacement="right"
309
+ >
310
+ </brick-button-v9>
311
+ ```
312
+
313
+ ## Styling and CSS Properties
314
+
315
+ Customize button appearance using CSS custom properties:
316
+
317
+ ```css
318
+ brick-button-v9 {
319
+ /* Width control */
320
+ --b-button-width: 100%;
321
+
322
+ /* Height control */
323
+ --b-button-height: 3rem;
324
+
325
+ /* Border width */
326
+ --b-button-border: 2px;
327
+
328
+ /* Border radius */
329
+ --b-button-radii: 8px;
330
+
331
+ /* Content alignment */
332
+ --b-button-justify: flex-start;
333
+ }
334
+ ```
335
+
336
+ ### Color Overrides
337
+
338
+ ```css
339
+ brick-button-v9 {
340
+ /* Primary button colors */
341
+ --brick-colors-buttonPrimaryBg: var(--brick-colors-utilityWarningBg);
342
+ --brick-colors-buttonPrimaryHoverBg: var(--brick-colors-utilityWarningBg);
343
+ --brick-colors-buttonPrimaryActiveBg: var(--brick-colors-utilityWarningBg);
344
+ --brick-colors-buttonPrimaryFg: var(--brick-colors-utilityWarningFg);
345
+ }
346
+ ```
347
+
348
+ **Note:** When overriding colors, ensure your customizations adhere to WCAG 2.1 AA contrast requirements.
349
+
350
+ ## Technical Details
351
+
352
+ - **Custom Element**: `brick-button-v9`
353
+ - **Base Class**: BrickElement
354
+ - **Dependencies**:
355
+ - @amedia/brick-tokens (design tokens)
356
+ - @amedia/brick-icon (icon support)
357
+ - @amedia/brick-template (base class)
358
+ - **Renders as**: `<button>` (default) or `<a>` (when data-linkto is set) or `<span>`/`<div>` (when data-as is set)
359
+ - **SSR Compatible**: Yes, with hydration support
360
+ - **Framework**: Framework-agnostic web component
361
+
362
+ ## Important Notes
363
+
364
+ - When `data-linkto` is provided, the component renders as an `<a>` tag; otherwise, it renders as a `<button>` tag
365
+ - When `data-as` is set to `span` or `div`, renders as non-interactive element (useful for wrapping with framework router components)
366
+ - Icon-only buttons automatically get rounded background styling
367
+ - The component observes attribute changes and updates the DOM reactively for `data-label`, `data-icon-id`, `data-icontext`, `data-linkto`, and all ARIA attributes
368
+ - Do not nest interactive elements inside brick-button when using framework routers - use `data-as` instead
369
+ - Version 9.0.0 removed CommonJS support and changed `data-iconid` to `data-icon-id`
370
+
371
+ ## Version
372
+
373
+ Current version: 9.3.1