@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.
- package/data/components-metadata.json +35 -29
- package/data/tokens-documentation.json +1 -1
- package/data/tokens.json +4848 -128
- package/dist/data/components/brick-actions.md +59 -0
- package/dist/data/components/brick-alt-teaser.md +264 -0
- package/dist/data/components/brick-avatar.md +299 -0
- package/dist/data/components/brick-button.md +373 -0
- package/dist/data/components/brick-card.md +359 -0
- package/dist/data/components/brick-carousel.md +355 -0
- package/dist/data/components/brick-classnames.md +147 -0
- package/dist/data/components/brick-countdown.md +180 -0
- package/dist/data/components/brick-dialog.md +458 -0
- package/dist/data/components/brick-fonts.md +389 -0
- package/dist/data/components/brick-helloworld.md +228 -0
- package/dist/data/components/brick-icon.md +274 -0
- package/dist/data/components/brick-icons.md +570 -0
- package/dist/data/components/brick-illustrations.md +604 -0
- package/dist/data/components/brick-image.md +361 -0
- package/dist/data/components/brick-input.md +557 -0
- package/dist/data/components/brick-mcp.json +6 -0
- package/dist/data/components/brick-nifs.md +164 -0
- package/dist/data/components/brick-pill.json +6 -0
- package/dist/data/components/brick-player.json +7 -0
- package/dist/data/components/brick-published.json +7 -0
- package/dist/data/components/brick-share.json +7 -0
- package/dist/data/components/brick-stepper.json +7 -0
- package/dist/data/components/brick-tab.json +7 -0
- package/dist/data/components/brick-tabs.json +9 -0
- package/dist/data/components/brick-tag.json +7 -0
- package/dist/data/components/brick-teaser-player.json +9 -0
- package/dist/data/components/brick-teaser-reels.json +9 -0
- package/dist/data/components/brick-teaser.json +9 -0
- package/dist/data/components/brick-template.json +9 -0
- package/dist/data/components/brick-textarea.json +7 -0
- package/dist/data/components/brick-themes.json +6 -0
- package/dist/data/components/brick-toast.json +9 -0
- package/dist/data/components/brick-toggle.json +7 -0
- package/dist/data/components/brick-tokens.json +8 -0
- package/dist/data/components/brick-tooltip.json +7 -0
- package/dist/data/components-metadata.json +234 -0
- package/dist/data/tokens-documentation.json +7 -0
- package/dist/data/tokens.json +4976 -0
- package/dist/http.js +314 -0
- package/dist/http.js.map +7 -0
- package/dist/index.js +26 -37
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
- package/scripts/generate-data.js +15 -47
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brick-icon
|
|
3
|
+
version: 2.3.1
|
|
4
|
+
selector: brick-icon-v2
|
|
5
|
+
category: Media
|
|
6
|
+
tags: [icon, svg, graphics, accessibility, sprite, visual]
|
|
7
|
+
use_cases:
|
|
8
|
+
[
|
|
9
|
+
all-ui,
|
|
10
|
+
navigation,
|
|
11
|
+
buttons,
|
|
12
|
+
visual-indicators,
|
|
13
|
+
status-display,
|
|
14
|
+
content-decoration,
|
|
15
|
+
]
|
|
16
|
+
related: [brick-button, brick-pill, brick-avatar]
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Brick Icon
|
|
20
|
+
|
|
21
|
+
A lightweight Web Component for rendering SVG icons from an embedded SVG sprite with built-in accessibility features.
|
|
22
|
+
|
|
23
|
+
## Key Capabilities
|
|
24
|
+
|
|
25
|
+
- Renders icons from an inline SVG sprite using icon IDs
|
|
26
|
+
- Automatic accessibility handling with configurable screen reader text
|
|
27
|
+
- Dynamic icon switching via attribute changes
|
|
28
|
+
- Size control through data attributes or CSS variables
|
|
29
|
+
- Color customization via CSS custom properties
|
|
30
|
+
- Special animation support for breaking news icon
|
|
31
|
+
- Framework-agnostic Web Component
|
|
32
|
+
|
|
33
|
+
## Props/Attributes
|
|
34
|
+
|
|
35
|
+
| Attribute | Type | Default | Required | Description |
|
|
36
|
+
| ---------------- | ----------------------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `data-icon-id` | string | - | yes | The ID of the SVG symbol inside the embedded SVG sprite |
|
|
38
|
+
| `data-icon-text` | string | - | no | Screen reader announcement text. When provided, icon gets `role="graphics-symbol"` and a `<title>` tag. When omitted, icon is hidden from screen readers with `aria-hidden="true"` |
|
|
39
|
+
| `data-icon-size` | 'small' \| 'medium' \| string | 'medium' | no | Predefined size for the icon container. 'small' or 'medium' values use token-based sizing |
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Basic Icon (Decorative)
|
|
44
|
+
|
|
45
|
+
Icon without screen reader text, suitable for decorative purposes or when paired with visible text:
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<brick-icon-v2 data-icon-id="chevron-right"></brick-icon-v2>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Accessible Icon
|
|
52
|
+
|
|
53
|
+
Icon with screen reader text for meaningful standalone icons:
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<brick-icon-v2 data-icon-id="play" data-icon-text="Play video"> </brick-icon-v2>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Sized Icon
|
|
60
|
+
|
|
61
|
+
Icon with predefined size:
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<brick-icon-v2
|
|
65
|
+
data-icon-id="search"
|
|
66
|
+
data-icon-text="Search"
|
|
67
|
+
data-icon-size="small"
|
|
68
|
+
>
|
|
69
|
+
</brick-icon-v2>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Icon in Button Context
|
|
73
|
+
|
|
74
|
+
Decorative icon alongside text (hidden from screen readers):
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<button>
|
|
78
|
+
<brick-icon-v2 data-icon-id="play"></brick-icon-v2>
|
|
79
|
+
Play
|
|
80
|
+
</button>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Breaking News Icon
|
|
84
|
+
|
|
85
|
+
Special icon with pulse animation:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<brick-icon-v2 data-icon-id="pill-breaking" data-icon-text="Breaking news">
|
|
89
|
+
</brick-icon-v2>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Programmatic Usage
|
|
93
|
+
|
|
94
|
+
### Client-Side Rendering
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
import '@amedia/brick-icon';
|
|
98
|
+
|
|
99
|
+
// The custom element defines itself automatically
|
|
100
|
+
const icon = document.createElement('brick-icon-v2');
|
|
101
|
+
icon.setAttribute('data-icon-id', 'chevron-right');
|
|
102
|
+
icon.setAttribute('data-icon-text', 'Navigate right');
|
|
103
|
+
document.body.appendChild(icon);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Server-Side Rendering
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
import { renderBrickIcon } from '@amedia/brick-icon/template';
|
|
110
|
+
|
|
111
|
+
const html = renderBrickIcon({
|
|
112
|
+
dataIconId: 'play',
|
|
113
|
+
dataIconText: 'Play video',
|
|
114
|
+
dataIconSize: 'medium',
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Dynamic Icon Changes
|
|
119
|
+
|
|
120
|
+
Icons can be updated dynamically via attribute changes:
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
const icon = document.querySelector('brick-icon-v2');
|
|
124
|
+
|
|
125
|
+
// Update icon ID
|
|
126
|
+
icon.setAttribute('data-icon-id', 'chevron-up');
|
|
127
|
+
|
|
128
|
+
// Update screen reader text
|
|
129
|
+
icon.setAttribute('data-icon-text', 'Collapse section');
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Prerequisites
|
|
133
|
+
|
|
134
|
+
### SVG Sprite Requirement
|
|
135
|
+
|
|
136
|
+
brick-icon requires an SVG sprite to be embedded in the HTML page. The sprite must contain `<symbol>` elements with IDs matching the `data-icon-id` values.
|
|
137
|
+
|
|
138
|
+
```html
|
|
139
|
+
<svg style="display: none;">
|
|
140
|
+
<symbol id="play" viewBox="0 0 24 24">
|
|
141
|
+
<path d="..." />
|
|
142
|
+
</symbol>
|
|
143
|
+
<symbol id="chevron-right" viewBox="0 0 24 24">
|
|
144
|
+
<path d="..." />
|
|
145
|
+
</symbol>
|
|
146
|
+
</svg>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Check out `@amedia/brick-icons` package which provides theme-specific SVG sprites maintained in Figma.
|
|
150
|
+
|
|
151
|
+
### Why Inline SVG Sprite
|
|
152
|
+
|
|
153
|
+
- Eliminates additional network requests
|
|
154
|
+
- Simpler implementation without asynchronous loading
|
|
155
|
+
- Icons available immediately when HTML is parsed
|
|
156
|
+
- Better perceived performance
|
|
157
|
+
- Optimal for small to medium icon sets
|
|
158
|
+
|
|
159
|
+
## Accessibility
|
|
160
|
+
|
|
161
|
+
### Automatic ARIA Handling
|
|
162
|
+
|
|
163
|
+
- **With `data-icon-text`**: Icon receives `role="graphics-symbol"` and a `<title>` element with the provided text, making it accessible to screen readers
|
|
164
|
+
- **Without `data-icon-text`**: Icon receives `aria-hidden="true"`, hiding it from screen readers (appropriate for decorative icons)
|
|
165
|
+
|
|
166
|
+
### VoiceOver Compatibility
|
|
167
|
+
|
|
168
|
+
Icons include `aria-labelledby` attributes for proper announcement in Safari with VoiceOver.
|
|
169
|
+
|
|
170
|
+
### Best Practices
|
|
171
|
+
|
|
172
|
+
- Omit `data-icon-text` for decorative icons or when adjacent text provides context
|
|
173
|
+
- Always provide `data-icon-text` for standalone interactive icons
|
|
174
|
+
- Ensure color contrast meets WCAG 2.1 AA requirements when customizing colors
|
|
175
|
+
|
|
176
|
+
## Styling
|
|
177
|
+
|
|
178
|
+
### CSS Custom Properties
|
|
179
|
+
|
|
180
|
+
| Property | Description | Default |
|
|
181
|
+
| ------------------------------------ | ----------------------------------------- | ------------------------------------------ |
|
|
182
|
+
| `--b-icon-color` | Icon fill color | `currentColor` |
|
|
183
|
+
| `--b-icon-size` | Container size (height) | `var(--brick-sizes-iconM)` (24px) |
|
|
184
|
+
| `--b-icon-svg-width` | SVG element width | `var(--brick-sizes-iconM)` (24px) |
|
|
185
|
+
| `--b-icon-svg-height` | SVG element height | `var(--brick-sizes-iconM)` (24px) |
|
|
186
|
+
| `--b-icon-color-breaking-pulseStart` | Breaking icon pulse animation start color | `var(--brick-colors-pillNonePulseStartBg)` |
|
|
187
|
+
| `--b-icon-color-breaking-pulseEnd` | Breaking icon pulse animation end color | `var(--brick-colors-pillNonePulseEndBg)` |
|
|
188
|
+
|
|
189
|
+
### Custom Sizing Example
|
|
190
|
+
|
|
191
|
+
```css
|
|
192
|
+
brick-icon-v2[data-icon-id='custom-large'] {
|
|
193
|
+
--b-icon-svg-width: 48px;
|
|
194
|
+
--b-icon-svg-height: 48px;
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Color Customization
|
|
199
|
+
|
|
200
|
+
```css
|
|
201
|
+
brick-icon-v2 {
|
|
202
|
+
--b-icon-color: #007bff;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Common Patterns
|
|
207
|
+
|
|
208
|
+
### Icon with Adjacent Text
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<a href="/search">
|
|
212
|
+
<brick-icon-v2 data-icon-id="search"></brick-icon-v2>
|
|
213
|
+
Search
|
|
214
|
+
</a>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Icon-Only Button
|
|
218
|
+
|
|
219
|
+
```html
|
|
220
|
+
<button aria-label="Close dialog">
|
|
221
|
+
<brick-icon-v2 data-icon-id="close" data-icon-text="Close"> </brick-icon-v2>
|
|
222
|
+
</button>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Responsive Icon Sizing
|
|
226
|
+
|
|
227
|
+
```css
|
|
228
|
+
brick-icon-v2 {
|
|
229
|
+
--b-icon-size: 16px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@media (min-width: 768px) {
|
|
233
|
+
brick-icon-v2 {
|
|
234
|
+
--b-icon-size: 24px;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Technical Details
|
|
240
|
+
|
|
241
|
+
- **Custom Element**: `brick-icon-v2`
|
|
242
|
+
- **Base Class**: BrickElement
|
|
243
|
+
- **Dependencies**: @amedia/brick-tokens, @amedia/brick-template
|
|
244
|
+
- **Renders as**: `<brick-icon-v2>` container with internal `<svg>` element
|
|
245
|
+
- **Observed Attributes**: `data-icon-id`, `data-icon-text`
|
|
246
|
+
- **Mirrored Props**: `data-icon-id`, `data-icon-text`, `data-icon-size`
|
|
247
|
+
|
|
248
|
+
## Important Notes
|
|
249
|
+
|
|
250
|
+
### Version 2 Breaking Changes
|
|
251
|
+
|
|
252
|
+
Version 2.0.0 introduced breaking changes:
|
|
253
|
+
|
|
254
|
+
- New tag name: `brick-icon-v2` (previously `brick-icon`)
|
|
255
|
+
- Requires embedded SVG sprite in HTML (no external sprite loading)
|
|
256
|
+
- Removed `theme` property (no longer needed)
|
|
257
|
+
- Removed CommonJS build
|
|
258
|
+
|
|
259
|
+
### Size Control
|
|
260
|
+
|
|
261
|
+
The `data-icon-size` attribute sets predefined sizes:
|
|
262
|
+
|
|
263
|
+
- `small`: Uses `--brick-sizes-iconS` token (typically 16px)
|
|
264
|
+
- `medium`: Uses `--brick-sizes-iconM` token (typically 24px)
|
|
265
|
+
|
|
266
|
+
For custom sizes, use CSS custom properties instead.
|
|
267
|
+
|
|
268
|
+
### Breaking News Animation
|
|
269
|
+
|
|
270
|
+
The icon with `data-icon-id="pill-breaking"` includes a special pulsing animation controlled by the `--b-icon-color-breaking-pulseStart` and `--b-icon-color-breaking-pulseEnd` CSS variables.
|
|
271
|
+
|
|
272
|
+
## Version
|
|
273
|
+
|
|
274
|
+
Current version: 2.3.1
|