@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,418 +0,0 @@
1
- ---
2
- name: brick-dialog
3
- version: 2.0.13
4
- selector: brick-dialog-v2
5
- category: Feedback
6
- tags: [dialog, modal, overlay, popup, user-interaction, focus-management, accessibility]
7
- use_cases: [confirmation-dialogs, alert-messages, forms, subscription-offers, user-prompts, information-display, video-players, content-overlays]
8
- related: [brick-button]
9
- ---
10
-
11
- # Brick Dialog
12
-
13
- A Web Component for displaying dialog and modal windows that overlay page content and require user interaction.
14
-
15
- ## Key Capabilities
16
-
17
- - **Dual modes**: Supports both non-modal dialogs and modal windows with different interaction patterns
18
- - **Position control**: Configure dialog position (top, center, bottom) for non-modal dialogs
19
- - **Template-based content**: Use HTML template tags to define header and content areas
20
- - **Full accessibility**: Built-in ARIA support, focus management, and keyboard navigation
21
- - **Focus trapping**: Automatic focus trapping for modal dialogs to ensure accessibility
22
- - **Automatic styling**: Includes close buttons and responsive layout out of the box
23
-
24
- ## Props/Attributes
25
-
26
- | Attribute | Type | Default | Required | Description |
27
- |-----------|------|---------|----------|-------------|
28
- | `data-type` | `"dialog" \| "modal"` | `"dialog"` | no | The type of dialog to render. Use "dialog" for non-blocking overlays, "modal" for blocking interactions |
29
- | `data-position` | `"top" \| "center" \| "bottom"` | `"center"` | no | Position of the dialog in the viewport. Only applicable when `data-type="dialog"` |
30
- | `data-id` | string | - | no | Custom ID for the internal dialog element |
31
-
32
- ## Examples
33
-
34
- ### Basic Dialog
35
-
36
- A non-modal dialog allows users to interact with both the dialog and the underlying page content.
37
-
38
- ```html
39
- <brick-dialog-v2 data-type="dialog" data-position="center">
40
- <template data-name="header">
41
- <h2>Dialog Title</h2>
42
- </template>
43
- <template data-name="content">
44
- <p>This is a non-modal dialog. You can interact with the page behind it.</p>
45
- </template>
46
- </brick-dialog-v2>
47
-
48
- <script>
49
- const dialog = document.querySelector('brick-dialog-v2');
50
- document.querySelector('.open-btn').addEventListener('click', () => {
51
- dialog.openDialog();
52
- });
53
- </script>
54
- ```
55
-
56
- ### Modal Dialog
57
-
58
- A modal dialog blocks interaction with the underlying page until dismissed.
59
-
60
- ```html
61
- <brick-dialog-v2 data-type="modal">
62
- <template data-name="header">
63
- <h2>Confirm Action</h2>
64
- </template>
65
- <template data-name="content">
66
- <p>Are you sure you want to proceed?</p>
67
- <brick-button-v9 data-label="Confirm" data-version="primary"></brick-button-v9>
68
- <brick-button-v9 data-label="Cancel" data-version="secondary"></brick-button-v9>
69
- </template>
70
- </brick-dialog-v2>
71
- ```
72
-
73
- ### Dialog with Custom ID
74
-
75
- Provide a unique ID for the dialog element for better integration and tracking.
76
-
77
- ```html
78
- <brick-dialog-v2 data-id="subscription-dialog" data-type="modal">
79
- <template data-name="header">
80
- <h2>Subscribe Today</h2>
81
- </template>
82
- <template data-name="content">
83
- <p>Get access to premium content for just 1 kr!</p>
84
- <brick-button-v9
85
- data-label="Subscribe Now"
86
- data-version="primary"
87
- style="--brick-colors-buttonPrimaryBg:var(--brick-colors-buttonSignalBg);">
88
- </brick-button-v9>
89
- </template>
90
- </brick-dialog-v2>
91
- ```
92
-
93
- ### Dialog Positioned at Top
94
-
95
- Position a non-modal dialog at the top of the viewport.
96
-
97
- ```html
98
- <brick-dialog-v2 data-type="dialog" data-position="top">
99
- <template data-name="header">
100
- <h2>Notification</h2>
101
- </template>
102
- <template data-name="content">
103
- <p>New updates are available.</p>
104
- </template>
105
- </brick-dialog-v2>
106
- ```
107
-
108
- ### Dialog with Rich Content
109
-
110
- Include complex content like forms, buttons, and links inside the dialog.
111
-
112
- ```html
113
- <brick-dialog-v2 data-type="modal">
114
- <template data-name="header">
115
- <h2>Special Offer</h2>
116
- </template>
117
- <template data-name="content">
118
- <p>Subscribe for 1 kr today!</p>
119
- <brick-button-v9
120
- onclick="alert('Button clicked!')"
121
- data-label="Subscribe"
122
- data-version="primary"
123
- data-size="small">
124
- </brick-button-v9>
125
- <brick-button-v9
126
- onclick="alert('Learn more')"
127
- data-label="Learn More"
128
- data-version="secondary"
129
- data-size="small">
130
- </brick-button-v9>
131
- <p>Read more about <a href="#">what you get access to here.</a></p>
132
- </template>
133
- </brick-dialog-v2>
134
- ```
135
-
136
- ## Framework Integration
137
-
138
- ### Svelte
139
-
140
- Svelte 5 has a known issue where the first `<template>` tag may be stripped during compilation. Use a dummy template as a workaround.
141
-
142
- ```svelte
143
- <script>
144
- let dialogRef;
145
-
146
- function openDialog() {
147
- dialogRef.openDialog();
148
- }
149
- </script>
150
-
151
- <brick-dialog-v2 bind:this={dialogRef} data-type="modal">
152
- <!-- Workaround for Svelte 5 template stripping -->
153
- <template data-name="template-for-svelte-compile-will-be-stripped"></template>
154
-
155
- <template data-name="header">
156
- <h2>Dialog Title</h2>
157
- </template>
158
-
159
- <template data-name="content">
160
- <p>Dialog content goes here.</p>
161
- </template>
162
- </brick-dialog-v2>
163
-
164
- <button on:click={openDialog}>Open Dialog</button>
165
- ```
166
-
167
- ### Svelte with Custom Styles
168
-
169
- You can include scoped styles within the template tags.
170
-
171
- ```svelte
172
- <script>
173
- let dialogRef;
174
-
175
- function openDialog() {
176
- dialogRef.openDialog();
177
- }
178
- </script>
179
-
180
- <brick-dialog-v2 bind:this={dialogRef}>
181
- <template data-name="header">
182
- <style>
183
- .custom-title {
184
- color: red;
185
- }
186
- </style>
187
- <h2><div class="custom-title">Dialog Title</div></h2>
188
- </template>
189
-
190
- <template data-name="content">
191
- <p>Dialog content goes here.</p>
192
- </template>
193
- </brick-dialog-v2>
194
-
195
- <button on:click={openDialog}>Open Dialog</button>
196
- ```
197
-
198
- ## Programmatic Usage
199
-
200
- ```javascript
201
- import '@amedia/brick-dialog';
202
-
203
- // Create dialog element
204
- const dialog = document.createElement('brick-dialog-v2');
205
- dialog.dataset.type = 'modal';
206
- dialog.dataset.id = `dialog-${Math.random().toString(36).substring(2)}`;
207
-
208
- // Add content via templates
209
- dialog.innerHTML = `
210
- <template data-name="header">
211
- <h2>My Dialog</h2>
212
- </template>
213
- <template data-name="content">
214
- <p>Dialog content here</p>
215
- </template>
216
- `;
217
-
218
- // Append to DOM
219
- document.body.appendChild(dialog);
220
-
221
- // Open the dialog
222
- dialog.openDialog();
223
-
224
- // Close the dialog
225
- dialog.close();
226
- ```
227
-
228
- ### Using Methods
229
-
230
- ```javascript
231
- const dialog = document.querySelector('brick-dialog-v2');
232
-
233
- // Open dialog (automatically calls show() or showModal() based on data-type)
234
- dialog.openDialog();
235
-
236
- // Alternative: use native dialog methods
237
- dialog.show(); // For non-modal dialogs
238
- dialog.showModal(); // For modal dialogs
239
-
240
- // Close dialog
241
- dialog.close();
242
- ```
243
-
244
- ## Accessibility
245
-
246
- The brick-dialog component is built with comprehensive accessibility features:
247
-
248
- ### ARIA Support
249
- - Uses `role="dialog"` to inform assistive technologies
250
- - Adds `aria-modal="true"` for modal dialogs to indicate content underneath is inert
251
- - Automatically sets `aria-labelledby` if a heading with an ID is present in the header
252
- - Falls back to `aria-label="Dialog"` if no heading is found
253
-
254
- ### Focus Management
255
- - Saves the previously focused element before opening
256
- - Automatically moves focus to the dialog when opened
257
- - Restores focus to the original element when closed
258
- - Maintains logical focus order for keyboard users
259
-
260
- ### Keyboard Interactions
261
- - **Escape key**: Closes non-modal dialogs
262
- - **Tab key**: For modal dialogs, focus is trapped within the dialog
263
- - Tab cycles forward through focusable elements
264
- - Shift+Tab cycles backward
265
- - Focus loops from last to first element and vice versa
266
-
267
- ### Background Interaction Prevention
268
- - Modal dialogs add `aria-hidden="true"` to the `<body>` element
269
- - Disables scrolling on the body when modal is open
270
- - Ensures users cannot accidentally interact with background content
271
-
272
- ### Close Buttons
273
- - Accessible close button in the header
274
- - Additional close button in the footer for modal dialogs
275
- - Both buttons use the accessible `brick-button-v9` component
276
-
277
- ## CSS Customization
278
-
279
- The dialog supports CSS custom properties for styling customization. Scope your overrides appropriately.
280
-
281
- | Property | Description | Default |
282
- |----------|-------------|---------|
283
- | `--b-dialog-max-inline-size` | Controls the maximum width of the dialog | `80vw` |
284
-
285
- ### Example
286
-
287
- ```html
288
- <style>
289
- brick-dialog-v2 {
290
- --b-dialog-max-inline-size: 600px;
291
- }
292
-
293
- brick-dialog-v2 header {
294
- border-bottom: 1px solid grey;
295
- padding-bottom: var(--brick-space-x1);
296
- }
297
-
298
- brick-dialog-v2 p {
299
- font-family: var(--brick-fonts-baseBodyM);
300
- }
301
- </style>
302
- ```
303
-
304
- ## Template Tags
305
-
306
- Content is added to the dialog using HTML `<template>` tags with `data-name` attributes.
307
-
308
- | data-name | Description |
309
- |-----------|-------------|
310
- | `header` | Content for the dialog header (appears before the close button) |
311
- | `content` | Main content area of the dialog |
312
-
313
- ## Common Patterns
314
-
315
- ### Subscription Offer Modal
316
-
317
- Display a subscription offer that requires user attention.
318
-
319
- ```html
320
- <brick-dialog-v2 data-type="modal" data-id="subscription-modal">
321
- <template data-name="header">
322
- <h2>Special Offer</h2>
323
- </template>
324
- <template data-name="content">
325
- <p>Subscribe for only 1 kr today!</p>
326
- <brick-button-v9
327
- data-label="Subscribe Now"
328
- data-version="primary"
329
- style="--brick-colors-buttonPrimaryBg:var(--brick-colors-buttonSignalBg);">
330
- </brick-button-v9>
331
- <p>Learn more about <a href="/subscription">all the benefits here</a>.</p>
332
- </template>
333
- </brick-dialog-v2>
334
- ```
335
-
336
- ### Confirmation Dialog
337
-
338
- Use a modal for critical actions requiring confirmation.
339
-
340
- ```html
341
- <brick-dialog-v2 data-type="modal">
342
- <template data-name="header">
343
- <h2>Delete Confirmation</h2>
344
- </template>
345
- <template data-name="content">
346
- <p>Are you sure you want to delete this item? This action cannot be undone.</p>
347
- <brick-button-v9
348
- class="confirm-delete"
349
- data-label="Delete"
350
- data-version="primary"
351
- data-size="small">
352
- </brick-button-v9>
353
- <brick-button-v9
354
- class="cancel"
355
- data-label="Cancel"
356
- data-version="secondary"
357
- data-size="small">
358
- </brick-button-v9>
359
- </template>
360
- </brick-dialog-v2>
361
- ```
362
-
363
- ### Non-Modal Information Dialog
364
-
365
- Use a non-modal dialog for supplementary information.
366
-
367
- ```html
368
- <brick-dialog-v2 data-type="dialog" data-position="bottom">
369
- <template data-name="header">
370
- <h2>Tip</h2>
371
- </template>
372
- <template data-name="content">
373
- <p>You can use keyboard shortcuts to navigate faster!</p>
374
- </template>
375
- </brick-dialog-v2>
376
- ```
377
-
378
- ## Technical Details
379
-
380
- - **Custom Element**: `brick-dialog-v2`
381
- - **Base Class**: BrickElement
382
- - **Dependencies**: @amedia/brick-template, @amedia/brick-tokens, @amedia/brick-button
383
- - **Renders as**: `<dialog>` element with wrapper divs and header/footer structure
384
-
385
- ## Important Notes
386
-
387
- ### Dialog vs Modal Choice
388
-
389
- **Use a dialog when:**
390
- - Information or interaction is supplementary and non-critical
391
- - Users might need to interact with both the dialog and main content
392
- - Minimizing workflow disruption is important
393
-
394
- **Use a modal when:**
395
- - Immediate user action is required before proceeding
396
- - User focus must be solely on the modal content
397
- - Preventing interaction with main content is necessary to avoid errors
398
-
399
- ### Unique IDs
400
-
401
- Always provide a unique ID for the dialog when possible:
402
-
403
- ```javascript
404
- const dialogId = `dialog-${Math.random().toString(36).substring(2)}`;
405
- // Or use a UUID library for more robustness
406
- ```
407
-
408
- ### Server-Side Rendering
409
-
410
- The current version (2.0.13) does not support server-side rendering. Future versions may add this capability if needed.
411
-
412
- ### Template Tag Attributes
413
-
414
- Use `data-name` (not `name`) for template tag identification. This was changed in version 1.0.0.
415
-
416
- ## Version
417
-
418
- Current version: 2.0.13