@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,329 +0,0 @@
1
- ---
2
- name: brick-card
3
- version: 7.3.8
4
- selector: brick-card-v7
5
- category: Layout
6
- tags: [card, container, content-grouping, layout, flexible-container, image-text, article]
7
- use_cases: [content-cards, article-teasers, product-listings, call-to-action, promotional-banners, feature-highlights, subscription-prompts, tips-boxes, step-by-step-guides]
8
- related: [brick-button, brick-image, brick-stepper]
9
- ---
10
-
11
- # Brick Card
12
-
13
- A flexible container component for grouping related content with support for images, text, buttons, and optional stepper functionality.
14
-
15
- ## Key Capabilities
16
-
17
- - Highly flexible layout with horizontal and vertical orientations (including reverse directions)
18
- - Supports multiple visual themes (light, dark, alt, sport, highlight, custom)
19
- - Integrates brick-image and brick-button components seamlessly
20
- - Optional dense/compact layout modes for space efficiency
21
- - Primary and secondary button support with icons and ADP analytics tracking
22
- - Semantic HTML with configurable container tags (article or div)
23
- - Built-in support for brick-stepper to show progress
24
- - Meta itemprops for structured data and analytics
25
-
26
- ## Props/Attributes
27
-
28
- | Attribute | Type | Default | Required | Description |
29
- |-----------|------|---------|----------|-------------|
30
- | `data-skin` | `'none' \| 'black' \| 'custom-one' \| 'custom-two' \| 'sport' \| 'highlight' \| 'alt' \| 'dark' \| 'light'` | `'light'` | No | Visual theme/background color of the card |
31
- | `data-as` | `'article' \| 'div'` | `'article'` | No | HTML tag to use for card container |
32
- | `data-title-text` | `string` | - | No | Main heading text |
33
- | `data-title-as` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6'` | `'h2'` | No | HTML heading level for title |
34
- | `data-text` | `string` | - | No | Body text content |
35
- | `data-primary-link-to` | `string` | - | No | URL for primary button |
36
- | `data-primary-button-text` | `string` | - | No | Text for primary button |
37
- | `data-primary-button-icon` | `string` | - | No | Icon name for primary button |
38
- | `data-primary-button-adp-label` | `string` | - | No | ADP tracking label for primary button clicks |
39
- | `data-primary-button-adp-value` | `string` | - | No | ADP tracking value for primary button clicks |
40
- | `data-secondary-link-to` | `string` | - | No | URL for secondary button |
41
- | `data-secondary-button-text` | `string` | - | No | Text for secondary button |
42
- | `data-secondary-button-icon` | `string` | - | No | Icon name for secondary button |
43
- | `data-secondary-button-adp-label` | `string` | - | No | ADP tracking label for secondary button clicks |
44
- | `data-secondary-button-adp-value` | `string` | - | No | ADP tracking value for secondary button clicks |
45
- | `data-button-size` | `'small' \| 'medium'` | `'medium'` | No | Size of buttons |
46
- | `data-image-src` | `string` | - | No | Image source URL (use properly sized/encoded Reflex URLs) |
47
- | `data-image-alt-text` | `string` | - | No | Alt text for image (required if image-src is provided) |
48
- | `data-image-size` | `'small' \| 'medium' \| 'large'` | `'medium'` | No | Size of the image within the card |
49
- | `data-layout` | `'default' \| 'compact'` | `'default'` | No | Layout density (compact has tighter spacing and smaller fonts) |
50
- | `data-layout-direction` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | `'row'` | No | Direction of content flow |
51
- | `data-dense` | `boolean` | `false` | No | Enable dense spacing mode |
52
- | `data-meta-itemprops` | `string` | - | No | Meta element attributes as comma-separated key:value pairs (e.g., "adpType:teaser,contentModel:paywall") |
53
- | `data-steps` | `string` | - | No | Number of steps for brick-stepper |
54
- | `data-steps-current` | `string` | - | No | Current step for brick-stepper |
55
- | `data-steps-completed` | `string` | - | No | Number of completed steps for brick-stepper |
56
- | `data-steps-order` | `'asc' \| 'desc'` | `'asc'` | No | Order direction for steps |
57
- | `data-steps-aria-label` | `string` | - | No | Aria label for stepper |
58
- | `data-steps-label` | `string` | - | No | Label text for steps |
59
- | `data-steps-icon-check` | `string` | - | No | Show check icon for completed steps |
60
- | `data-steps-icon-lock` | `string` | - | No | Show lock icon for locked steps |
61
-
62
- ## Examples
63
-
64
- ### Basic Card with Image and Title
65
-
66
- A simple horizontal card with an image and title.
67
-
68
- ```html
69
- <brick-card-v7
70
- data-image-src="https://g.acdn.no/api/reflex/v1/image/resize/680/https%3A%2F%2Fg.acdn.no%2Fobscura%2FAPI%2Fdynamic%2Fr1%2Fece5%2Ftr_2000_2000_s_f%2F0000%2Favio%2F2023%2F5%2F16%2F8%2F%252BHandwerk%252BBotaniske%252B-4151.jpg%3Fchk%3DDDB861"
71
- data-image-alt-text="A happy waitress holding a breakfast tray"
72
- data-title-text="Oppgrader og få frukost på din bursdag!"
73
- data-skin="light"
74
- data-image-size="large">
75
- </brick-card-v7>
76
- ```
77
-
78
- ### Complete Card with All Features
79
-
80
- Full-featured card with image, title, text, and two buttons.
81
-
82
- ```html
83
- <brick-card-v7
84
- data-image-src="https://g.acdn.no/api/reflex/v1/image/resize/680/https%3A%2F%2Fg.acdn.no%2Fobscura%2FAPI%2Fdynamic%2Fr1%2Fece5%2Ftr_2000_2000_s_f%2F0000%2Favio%2F2023%2F5%2F16%2F8%2F%252BHandwerk%252BBotaniske%252B-4151.jpg%3Fchk%3DDDB861"
85
- data-image-alt-text="A happy waitress holding a breakfast tray"
86
- data-image-size="large"
87
- data-title-text="Oppgrader og få frukost på din bursdag!"
88
- data-text="Å spise frokost på kafé er en bra start på dagen enten du er en morgenfugl eller liker å sove lenge. Med +Alt får du alltid frukost på din bursdag!"
89
- data-skin="light"
90
- data-as="article"
91
- data-primary-link-to="https://www.ao.no/stor-guide-lyst-pa-frokost-pa-kaf-her-er-13-steder-med-god-stemning/f/5-128-522696"
92
- data-primary-button-text="Oppgrader til +Alt"
93
- data-primary-button-icon="plusall"
94
- data-button-size="small"
95
- data-secondary-link-to="https://nn.wikipedia.org/wiki/Frukost"
96
- data-secondary-button-text="Les mer om frukost">
97
- </brick-card-v7>
98
- ```
99
-
100
- ### Vertical Layout Card
101
-
102
- Card with vertical content stacking (column layout).
103
-
104
- ```html
105
- <brick-card-v7
106
- data-layout-direction="column"
107
- data-image-src="https://g.acdn.no/api/reflex/v1/image/resize/680/https%3A%2F%2Fg.acdn.no%2Fobscura%2FAPI%2Fdynamic%2Fr1%2Fece5%2Ftr_2000_2000_s_f%2F0000%2Favio%2F2023%2F5%2F16%2F8%2F%252BHandwerk%252BBotaniske%252B-4151.jpg%3Fchk%3DDDB861"
108
- data-image-alt-text="A happy waitress holding a breakfast tray"
109
- data-title-text="Vertical Card Example"
110
- data-text="Content flows vertically in this layout."
111
- data-skin="dark"
112
- data-primary-link-to="/example"
113
- data-primary-button-text="Learn More">
114
- </brick-card-v7>
115
- ```
116
-
117
- ### Dense/Compact Card Without Image
118
-
119
- Minimal card for call-to-action boxes without images.
120
-
121
- ```html
122
- <brick-card-v7
123
- data-text="Vet du noe mer om denne saken?"
124
- data-primary-link-to="/vis/info/tips-oss"
125
- data-primary-button-text="Tips oss"
126
- data-button-size="medium"
127
- data-layout-direction="row"
128
- data-dense="true"
129
- data-skin="alt">
130
- </brick-card-v7>
131
- ```
132
-
133
- ### Card with Stepper
134
-
135
- Card displaying progress through steps (e.g., for courses or multi-step processes).
136
-
137
- ```html
138
- <brick-card-v7
139
- data-layout-direction="column"
140
- data-title-text="Complete Your Profile"
141
- data-text="Follow these steps to complete your setup"
142
- data-skin="light"
143
- data-steps="7"
144
- data-steps-current="3"
145
- data-steps-label="Dag"
146
- data-steps-order="desc"
147
- data-steps-icon-check="true"
148
- data-steps-icon-lock="true"
149
- data-primary-link-to="/continue"
150
- data-primary-button-text="Continue">
151
- </brick-card-v7>
152
- ```
153
-
154
- ## Programmatic Usage
155
-
156
- ### Client-Side Rendering
157
-
158
- ```javascript
159
- import '@amedia/brick-card';
160
-
161
- const card = document.createElement('brick-card-v7');
162
- card.dataset.titleText = 'My Card Title';
163
- card.dataset.text = 'Card description text';
164
- card.dataset.imageSrc = 'https://example.com/image.jpg';
165
- card.dataset.imageAltText = 'Image description';
166
- card.dataset.primaryLinkTo = '/learn-more';
167
- card.dataset.primaryButtonText = 'Learn More';
168
- card.dataset.skin = 'light';
169
-
170
- document.body.appendChild(card);
171
- ```
172
-
173
- ### Server-Side Rendering
174
-
175
- ```javascript
176
- import { renderBrickCard } from '@amedia/brick-card/template';
177
-
178
- const cardMarkup = renderBrickCard({
179
- dataTitleText: 'Server-Rendered Card',
180
- dataText: 'This card is rendered on the server',
181
- dataImageSrc: 'https://example.com/image.jpg',
182
- dataImageAltText: 'Image description',
183
- dataPrimaryLinkTo: '/action',
184
- dataPrimaryButtonText: 'Take Action',
185
- dataSkin: 'dark'
186
- });
187
-
188
- // cardMarkup is a string of HTML ready to be sent to the client
189
- ```
190
-
191
- ## Accessibility
192
-
193
- - Semantic HTML: Use `data-as="article"` for self-contained content
194
- - Proper heading hierarchy: Configure `data-title-as` to match document structure
195
- - Image alt text: Always provide `data-image-alt-text` when using images
196
- - Keyboard navigation: All buttons are fully keyboard accessible
197
- - Screen reader support: Stepper component includes `data-steps-aria-label`
198
- - WCAG 2.1 AA compliant color contrast across all skin variants
199
-
200
- ## Analytics Integration
201
-
202
- Brick-card supports ADP (Amedia Data Platform) analytics tracking for button clicks:
203
-
204
- ```html
205
- <brick-card-v7
206
- data-primary-button-text="Subscribe"
207
- data-primary-link-to="/subscribe"
208
- data-primary-button-adp-label="upgrade"
209
- data-primary-button-adp-value="subscription-tier-premium"
210
- data-secondary-button-text="Learn More"
211
- data-secondary-link-to="/info"
212
- data-secondary-button-adp-label="read-more"
213
- data-secondary-button-adp-value="subscription-info">
214
- </brick-card-v7>
215
- ```
216
-
217
- **Important:** ADP logging requires wrapping the card with proper `itemscope` attributes. The card itself only renders the button labels; you must provide the ADP scope wrapper.
218
-
219
- ## Common Patterns
220
-
221
- ### Subscription/Upgrade Prompt
222
-
223
- For conversion-focused cards encouraging upgrades or subscriptions.
224
-
225
- ```html
226
- <brick-card-v7
227
- data-title-text="Upgrade to Premium"
228
- data-text="Get unlimited access to all articles and exclusive content"
229
- data-skin="highlight"
230
- data-layout-direction="column"
231
- data-primary-button-text="Upgrade Now"
232
- data-primary-link-to="/subscribe"
233
- data-primary-button-icon="plusall"
234
- data-button-size="medium">
235
- </brick-card-v7>
236
- ```
237
-
238
- ### Article Teaser
239
-
240
- For displaying article previews in lists or grids.
241
-
242
- ```html
243
- <brick-card-v7
244
- data-as="article"
245
- data-image-src="https://example.com/article-image.jpg"
246
- data-image-alt-text="Article preview image"
247
- data-image-size="large"
248
- data-title-text="Breaking News: Local Event Draws Crowds"
249
- data-title-as="h3"
250
- data-text="Thousands gathered downtown for the annual festival..."
251
- data-skin="light"
252
- data-primary-link-to="/article/12345"
253
- data-primary-button-text="Read More"
254
- data-meta-itemprops="adpType:teaser,contentModel:free">
255
- </brick-card-v7>
256
- ```
257
-
258
- ### Tips/Help Box
259
-
260
- For contextual help or user engagement prompts.
261
-
262
- ```html
263
- <brick-card-v7
264
- data-text="Vet du noe mer om denne saken?"
265
- data-skin="alt"
266
- data-dense="true"
267
- data-primary-link-to="/tips"
268
- data-primary-button-text="Tips oss"
269
- data-primary-button-adp-label="user-tips">
270
- </brick-card-v7>
271
- ```
272
-
273
- ## Technical Details
274
-
275
- - **Custom Element**: `brick-card-v7`
276
- - **Base Class**: BrickElement (from @amedia/brick-template)
277
- - **Dependencies**:
278
- - @amedia/brick-template
279
- - @amedia/brick-button
280
- - @amedia/brick-image
281
- - @amedia/brick-stepper
282
- - @amedia/brick-tokens
283
- - **Renders as**: Configurable (`article` or `div`)
284
- - **Browser Support**: Modern browsers (ES2020+)
285
- - **Build Target**: ESM and CommonJS modules available
286
-
287
- ## Important Notes
288
-
289
- ### Image URLs
290
-
291
- Since brick-card v7.0.0 (brick-image v4), image URLs must be properly sized and encoded. Use Amedia's Reflex API:
292
-
293
- ```
294
- https://g.acdn.no/api/reflex/v1/image/resize/680/[ENCODED_URL]
295
- ```
296
-
297
- The size is not automatically applied; you must provide the correct size in the URL.
298
-
299
- ### Breaking Changes from v6
300
-
301
- - `dataLinkTo` → `dataPrimaryLinkTo`
302
- - `dataButtonText` → `dataPrimaryButtonText`
303
-
304
- ### Layout Flexibility
305
-
306
- The card does not require an image. You can create text-only cards by omitting `data-image-src`. Similarly, buttons are optional - omit button properties to create cards without actions.
307
-
308
- ### Theme Inheritance
309
-
310
- Brick-card inherits theme context from parent elements. The `data-skin` attribute controls the card's background color within the inherited theme.
311
-
312
- ### Meta Itemprops Format
313
-
314
- The `data-meta-itemprops` attribute accepts a comma-separated string of key:value pairs:
315
-
316
- ```html
317
- data-meta-itemprops="adpType:teaser,contentModel:paywall,category:news"
318
- ```
319
-
320
- This generates:
321
- ```html
322
- <meta itemprop="adpType" content="teaser">
323
- <meta itemprop="contentModel" content="paywall">
324
- <meta itemprop="category" content="news">
325
- ```
326
-
327
- ## Version
328
-
329
- Current version: 7.3.8
@@ -1,330 +0,0 @@
1
- ---
2
- name: brick-carousel
3
- version: 2.0.10
4
- selector: brick-carousel-v2
5
- category: Layout
6
- tags: [carousel, slider, content-slider, gallery, navigation, scroll, responsive, accessible]
7
- use_cases: [content-carousels, image-galleries, article-sliders, video-carousels, product-listings, teaser-collections, media-galleries, responsive-layouts]
8
- related: [brick-teaser, brick-image, brick-player]
9
- ---
10
-
11
- # Brick Carousel
12
-
13
- A simple, accessible carousel component for displaying any type of content in a horizontal scrolling layout with navigation controls.
14
-
15
- ## Key Capabilities
16
-
17
- - Fully accessible with semantic markup, keyboard navigation, and ARIA support
18
- - Supports three layout types: carousel (default), gallery (full-width single items), and compact (dense layout)
19
- - Responsive design that adapts to container width (1-3 items visible depending on space)
20
- - Client-side and server-side rendering support
21
- - Drag-to-scroll functionality on desktop
22
- - Automatic mutation detection for dynamically added content
23
- - Template tag support for custom elements to prevent early initialization
24
- - Customizable navigation button visibility
25
-
26
- ## Props/Attributes
27
-
28
- | Attribute | Type | Default | Required | Description |
29
- |-----------|------|---------|----------|-------------|
30
- | `data-version` | `"carousel" \| "gallery" \| "compact"` | `"carousel"` | No | Layout type. "carousel" shows 1-3 items, "gallery" shows 1 full-width item, "compact" provides a denser layout |
31
- | `data-min-slides-to-show` | `string` (number) | `"1"` | No | Minimum number of slides to show. When set to "2" and only 2 children exist, shows both in a fraction grid without scrolling |
32
- | `data-hide-btn-start-end` | `boolean` | `false` | No | Hides navigation buttons when at start/end of carousel. Not recommended for content wrapped in links to avoid misclicks |
33
- | `dataItems` | `string[]` | - | No (Yes for SSR) | Array of HTML content strings for server-side rendering. Each item is automatically wrapped with proper `<li>` markup |
34
-
35
- ## Examples
36
-
37
- ### Basic Carousel (Client-side)
38
-
39
- ```html
40
- <script type="module" src="https://assets.acdn.no/pkg/@amedia/brick-carousel/2.0.10/brick-carousel.js"></script>
41
-
42
- <brick-carousel-v2>
43
- <article>Article 1 content</article>
44
- <article>Article 2 content</article>
45
- <article>Article 3 content</article>
46
- <article>Article 4 content</article>
47
- <article>Article 5 content</article>
48
- </brick-carousel-v2>
49
- ```
50
-
51
- ### Gallery Mode
52
-
53
- Shows one full-width item at a time, ideal for image galleries.
54
-
55
- ```html
56
- <brick-carousel-v2 data-version="gallery">
57
- <brick-image-v9 src="https://example.com/image1.jpg" alt="Image 1"></brick-image-v9>
58
- <brick-image-v9 src="https://example.com/image2.jpg" alt="Image 2"></brick-image-v9>
59
- <brick-image-v9 src="https://example.com/image3.jpg" alt="Image 3"></brick-image-v9>
60
- </brick-carousel-v2>
61
- ```
62
-
63
- ### Compact Layout
64
-
65
- Provides a denser layout with adjusted grid column widths.
66
-
67
- ```html
68
- <brick-carousel-v2 data-version="compact">
69
- <brick-teaser-v13 title="Compact teaser 1"></brick-teaser-v13>
70
- <brick-teaser-v13 title="Compact teaser 2"></brick-teaser-v13>
71
- <brick-teaser-v13 title="Compact teaser 3"></brick-teaser-v13>
72
- <brick-teaser-v13 title="Compact teaser 4"></brick-teaser-v13>
73
- </brick-carousel-v2>
74
- ```
75
-
76
- ### Minimum Slides to Show
77
-
78
- Forces minimum 2 slides visible even on smaller screens. When exactly 2 children exist, displays both without navigation.
79
-
80
- ```html
81
- <brick-carousel-v2 data-min-slides-to-show="2">
82
- <article>Article 1</article>
83
- <article>Article 2</article>
84
- </brick-carousel-v2>
85
- ```
86
-
87
- ### Using Template Tags for Custom Elements
88
-
89
- Wrap content in `<template>` tags to prevent custom elements (like brick-player) from initializing too early. The template content is added to the DOM after being placed in the carousel.
90
-
91
- ```html
92
- <brick-carousel-v2>
93
- <template>
94
- <brick-player
95
- mediaid="abc123"
96
- playerid="xyz789"
97
- aspectratio="16:9"
98
- title="Video title">
99
- </brick-player>
100
- </template>
101
- <template>
102
- <brick-player
103
- mediaid="def456"
104
- playerid="xyz789"
105
- aspectratio="16:9"
106
- title="Another video">
107
- </brick-player>
108
- </template>
109
- </brick-carousel-v2>
110
- ```
111
-
112
- ## Server-Side Rendering
113
-
114
- ### Basic SSR Example
115
-
116
- ```typescript
117
- import { renderBrickCarousel } from '@amedia/brick-carousel/template';
118
-
119
- const carouselHTML = renderBrickCarousel({
120
- dataItems: [
121
- '<article>Article 1</article>',
122
- '<article>Article 2</article>',
123
- '<article>Article 3</article>',
124
- '<article>Article 4</article>'
125
- ],
126
- dataVersion: 'carousel',
127
- dataMinSlidesToShow: '2'
128
- });
129
- ```
130
-
131
- ### SSR Gallery Example
132
-
133
- ```typescript
134
- import { renderBrickCarousel } from '@amedia/brick-carousel/template';
135
-
136
- const galleryHTML = renderBrickCarousel({
137
- dataItems: [
138
- '<brick-image-v9 src="image1.jpg" alt="Image 1"></brick-image-v9>',
139
- '<brick-image-v9 src="image2.jpg" alt="Image 2"></brick-image-v9>',
140
- '<brick-image-v9 src="image3.jpg" alt="Image 3"></brick-image-v9>'
141
- ],
142
- dataVersion: 'gallery'
143
- });
144
- ```
145
-
146
- ### SSR with Hide Buttons
147
-
148
- ```typescript
149
- import { renderBrickCarousel } from '@amedia/brick-carousel/template';
150
-
151
- const carouselHTML = renderBrickCarousel({
152
- dataItems: [
153
- '<div class="content">Slide 1</div>',
154
- '<div class="content">Slide 2</div>',
155
- '<div class="content">Slide 3</div>'
156
- ],
157
- dataHideBtnStartEnd: true
158
- });
159
- ```
160
-
161
- ## Programmatic Usage
162
-
163
- ```javascript
164
- import { BrickCarousel } from '@amedia/brick-carousel';
165
-
166
- const carousel = new BrickCarousel({
167
- dataVersion: 'carousel',
168
- dataMinSlidesToShow: '2',
169
- dataHideBtnStartEnd: false
170
- });
171
-
172
- // Append to DOM
173
- document.querySelector('#container').appendChild(carousel);
174
-
175
- // Add items dynamically
176
- const article = document.createElement('article');
177
- article.textContent = 'Dynamic content';
178
- carousel.appendChild(article);
179
- ```
180
-
181
- ## Accessibility
182
-
183
- ### Built-in Accessibility Features
184
-
185
- - **Semantic HTML**: Uses `<section>`, `<ul>`, and `<li>` elements with proper ARIA roles
186
- - **Screen Reader Support**:
187
- - `aria-describedby` connects carousel to descriptive text
188
- - Each slide announces "Article X of Y" (or "Image X of Y" for gallery mode)
189
- - Skip link allows users to bypass carousel content
190
- - **Keyboard Navigation**:
191
- - `Arrow Left/Right`: Navigate between slides
192
- - `Tab`: Navigate through focusable elements within slides
193
- - `Escape`: Skip to content after carousel
194
- - **Navigation Buttons**: Properly labeled with `aria-label` and disabled states
195
- - **Reduced Motion**: Respects `prefers-reduced-motion` user preference
196
- - **Focus Management**: Automatically manages focus when navigating to start/end
197
-
198
- ### WCAG 2.1 AA Compliance
199
-
200
- Component is tested for accessibility and meets WCAG 2.1 AA standards with automated axe tests via Playwright.
201
-
202
- ## Responsive Behavior
203
-
204
- The carousel automatically adjusts the number of visible slides based on container width:
205
-
206
- - **< 460px**: Shows 1 slide
207
- - **460px - 768px**: Shows 2 slides
208
- - **> 768px**: Shows 3 slides (or fewer if `data-slides` is less than 3)
209
- - **Gallery mode**: Always shows 1 full-width slide
210
- - **When `data-min-slides-to-show="2"`**: Forces minimum 2 slides visible
211
-
212
- ## Styling and CSS Properties
213
-
214
- ### Custom CSS Properties
215
-
216
- | Property | Description | Default |
217
- |----------|-------------|---------|
218
- | `--b-carousel-btn-min` | Minimum width and height for navigation buttons | `2rem` |
219
- | `--b-carousel-btn-max` | Maximum width and height for navigation buttons | `3.125rem` |
220
- | `--b-carousel-btns-display` | Display state of navigation buttons (set programmatically) | `block` or `none` |
221
-
222
- ### Example: Customizing Button Size
223
-
224
- ```css
225
- brick-carousel-v2 {
226
- --b-carousel-btn-min: 2.5rem;
227
- --b-carousel-btn-max: 4rem;
228
- }
229
- ```
230
-
231
- ## Common Patterns
232
-
233
- ### Article Carousel with Teasers
234
-
235
- ```html
236
- <brick-carousel-v2 data-min-slides-to-show="2">
237
- <brick-teaser-v13
238
- title="Breaking news story"
239
- type="story"
240
- vignette="News">
241
- </brick-teaser-v13>
242
- <brick-teaser-v13
243
- title="Opinion piece"
244
- type="opinion"
245
- vignette="Opinion">
246
- </brick-teaser-v13>
247
- <brick-teaser-v13
248
- title="Photo gallery"
249
- type="gallery"
250
- vignette="Photos">
251
- </brick-teaser-v13>
252
- </brick-carousel-v2>
253
- ```
254
-
255
- ### Video Carousel
256
-
257
- ```html
258
- <brick-carousel-v2>
259
- <template>
260
- <brick-player
261
- mediaid="video1"
262
- playerid="player123"
263
- aspectratio="16:9"
264
- title="Video 1">
265
- </brick-player>
266
- </template>
267
- <template>
268
- <brick-player
269
- mediaid="video2"
270
- playerid="player123"
271
- aspectratio="16:9"
272
- title="Video 2">
273
- </brick-player>
274
- </template>
275
- </brick-carousel-v2>
276
- ```
277
-
278
- ### Image Gallery with Hidden End Buttons
279
-
280
- ```html
281
- <brick-carousel-v2
282
- data-version="gallery"
283
- data-hide-btn-start-end="true">
284
- <brick-image-v9 src="image1.jpg" alt="Gallery image 1"></brick-image-v9>
285
- <brick-image-v9 src="image2.jpg" alt="Gallery image 2"></brick-image-v9>
286
- <brick-image-v9 src="image3.jpg" alt="Gallery image 3"></brick-image-v9>
287
- </brick-carousel-v2>
288
- ```
289
-
290
- ## Technical Details
291
-
292
- - **Custom Element**: `brick-carousel-v2`
293
- - **Base Class**: BrickElement
294
- - **Dependencies**: @amedia/brick-template (1.3.1), @amedia/brick-tokens (5.19.6)
295
- - **Renders as**: `<section>` containing navigation and content
296
- - **Browser Support**: Modern browsers with custom element support
297
- - **Mutation Observer**: Automatically detects and handles dynamically added children
298
- - **Scroll Behavior**: Uses CSS scroll-snap for smooth scrolling
299
- - **Drag Support**: Click-and-drag navigation on desktop (disabled on touch devices)
300
-
301
- ## Important Notes
302
-
303
- ### CSS Subgrid Issue
304
-
305
- There is a known issue with using CSS subgrid in carousel content. The `overflow: hidden` rule on `li.content-wrapper` can interfere with subgrid behavior. If you need to use subgrid, you must override the overflow rule in your own CSS and handle any overflow issues yourself.
306
-
307
- ```css
308
- brick-carousel-v2 [data-content-wrapper] {
309
- overflow: visible; /* Override for subgrid support */
310
- }
311
- ```
312
-
313
- ### Template Tag Usage (Client-side only)
314
-
315
- When using custom elements like `brick-player`, wrap them in `<template>` tags to prevent early initialization. The content must be a template string, not created with `createElement`, to avoid premature custom element initialization.
316
-
317
- ### SSR vs Client-side Differences
318
-
319
- - **Client-side**: Direct children are automatically wrapped in `<li>` elements
320
- - **Server-side**: Use `dataItems` array with HTML strings that are wrapped by the template function
321
- - **Server-side parameters**: All parameters are strings (e.g., `dataMinSlidesToShow: '2'`)
322
- - **Validation**: Server-side function includes built-in validation with helpful error messages
323
-
324
- ### Hide Buttons Caution
325
-
326
- The `data-hide-btn-start-end` attribute should generally not be used when carousel content is wrapped in links (like teasers), as disappearing buttons can cause users to accidentally click the underlying link.
327
-
328
- ## Version
329
-
330
- Current version: 2.0.10