spoko-design-system 1.19.0 → 1.20.0
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/.claude/settings.json +48 -48
- package/.github/dependabot.yml +11 -11
- package/.github/todo.yml +3 -3
- package/.github/workflows/claude.yml +37 -37
- package/.github/workflows/code-quality.yml +72 -72
- package/.github/workflows/deploy.yml +43 -43
- package/.husky/README.md +41 -41
- package/.husky/commit-msg +1 -1
- package/.husky/pre-commit +40 -40
- package/.prettierignore +14 -14
- package/.prettierrc +30 -30
- package/.stackblitzrc +5 -5
- package/.vscode/extensions.json +4 -4
- package/.vscode/launch.json +11 -11
- package/.vscode/settings.json +21 -21
- package/CHANGELOG.md +462 -456
- package/CLAUDE.md +268 -268
- package/LICENSE +21 -21
- package/README.md +303 -132
- package/TOOLTIPS.md +236 -236
- package/astro.config.mjs +84 -84
- package/commitlint.config.js +3 -3
- package/dev-dist/sw.js +91 -91
- package/dev-dist/workbox-c676b6d3.js +3391 -3391
- package/eslint.config.js +70 -70
- package/icon.config.ts +348 -348
- package/index.ts +78 -78
- package/package.json +160 -160
- package/public/arrow-bottom.svg +7 -7
- package/public/fonts/lg.svg +53 -53
- package/public/fonts/vwhead-bold-demo.html +549 -549
- package/public/fonts/vwhead-regular-demo.html +549 -549
- package/public/fonts/vwtext-bold-demo.html +549 -549
- package/public/fonts/vwtext-regular-demo.html +549 -549
- package/public/github.svg +3 -3
- package/public/grid_dot.svg +4 -4
- package/public/linkedin.svg +44 -44
- package/public/make-scrollable-code-focusable.js +3 -3
- package/public/pagefind.yml +3 -3
- package/public/polo.blue.svg +29 -29
- package/public/spoko.space.svg +71 -71
- package/public/twitter.svg +46 -46
- package/renovate.json +6 -6
- package/sandbox.config.json +11 -11
- package/sonar-project.properties +26 -26
- package/src/components/Category/CategoryDetails.astro +46 -18
- package/src/pages/components/badges.mdx +57 -57
- package/src/pages/components/breadcrumbs.mdx +139 -139
- package/src/pages/components/buttons.mdx +359 -359
- package/src/pages/components/card.mdx +294 -294
- package/src/pages/components/carousel.mdx +62 -62
- package/src/pages/components/copyright.mdx +42 -42
- package/src/pages/components/details-list.mdx +207 -207
- package/src/pages/components/features-list.mdx +37 -37
- package/src/pages/components/flags.mdx +49 -49
- package/src/pages/components/fuck-russia.mdx +39 -39
- package/src/pages/components/hand-drive.mdx +78 -78
- package/src/pages/components/headline.mdx +337 -337
- package/src/pages/components/image.mdx +513 -513
- package/src/pages/components/input.mdx +367 -367
- package/src/pages/components/jumbotron.mdx +530 -530
- package/src/pages/components/modal.mdx +212 -212
- package/src/pages/components/post-header.mdx +64 -64
- package/src/pages/components/pr-code.mdx +213 -213
- package/src/pages/components/product-engine.mdx +418 -418
- package/src/pages/components/product-number.mdx +58 -58
- package/src/pages/components/product-tile.mdx +51 -51
- package/src/pages/components/quote.mdx +33 -33
- package/src/pages/components/slimbanner.mdx +260 -260
- package/src/pages/components/table.mdx +108 -108
- package/src/pages/core/colors.mdx +21 -21
- package/src/pages/core/grid.mdx +193 -193
- package/src/pages/core/introduction.mdx +77 -77
- package/src/pages/core/tooltips.mdx +491 -491
- package/src/pages/patterns/introduction.mdx +60 -60
- package/src/styles/_variables.scss +70 -70
- package/tailwind.config.cjs +8 -8
- package/tsconfig.json +28 -28
- package/uno-config/index.ts +269 -269
- package/uno-config/theme/breakpoints.ts +9 -9
- package/uno-config/theme/colors.ts +65 -65
- package/uno-config/theme/dimensions.ts +17 -17
- package/uno-config/theme/effects.ts +14 -14
- package/uno-config/theme/grid.ts +10 -10
- package/uno-config/theme/index.ts +26 -26
- package/uno-config/theme/shortcuts/buttons.ts +53 -53
- package/uno-config/theme/shortcuts/components.ts +124 -124
- package/uno-config/theme/shortcuts/index.ts +20 -20
- package/uno-config/theme/shortcuts/jumbotron.ts +71 -71
- package/uno-config/theme/shortcuts/layout.ts +75 -75
- package/uno-config/theme/typography.ts +29 -29
- package/uno.config.ts +2 -2
|
@@ -1,212 +1,212 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Modal"
|
|
3
|
-
layout: "../../layouts/MainLayout.astro"
|
|
4
|
-
---
|
|
5
|
-
import Modal from '../../components/Modal.astro'
|
|
6
|
-
import Button from '../../components/Button.vue'
|
|
7
|
-
import { Icon } from 'astro-icon/components';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Modal
|
|
11
|
-
|
|
12
|
-
Native modal window based on `<dialog>` tag with `::backdrop` CSS pseudo-element. Features built-in X close button, action buttons, and flexible configuration.
|
|
13
|
-
|
|
14
|
-
**Documentation:**
|
|
15
|
-
- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
|
|
16
|
-
- https://developer.mozilla.org/en-US/docs/Web/CSS/::backdrop
|
|
17
|
-
|
|
18
|
-
## Basic Modal with Title and X Button
|
|
19
|
-
|
|
20
|
-
<div class="component-preview">
|
|
21
|
-
<Modal id="dialog1" open="Open modal" title="Modal Title">
|
|
22
|
-
<p>This modal has a title and built-in X close button in the top-right corner.</p>
|
|
23
|
-
<p>You can also close by clicking the backdrop or pressing Escape.</p>
|
|
24
|
-
</Modal>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
```astro
|
|
28
|
-
<Modal id="dialog1" open="Open modal" title="Modal Title">
|
|
29
|
-
<p>This modal has a title and built-in X close button in the top-right corner.</p>
|
|
30
|
-
<p>You can also close by clicking the backdrop or pressing Escape.</p>
|
|
31
|
-
</Modal>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Modal with Action Buttons
|
|
35
|
-
|
|
36
|
-
<div class="component-preview">
|
|
37
|
-
<Modal
|
|
38
|
-
id="dialog2"
|
|
39
|
-
open="Delete Item"
|
|
40
|
-
title="Confirm Delete"
|
|
41
|
-
showActions
|
|
42
|
-
cancelText="Cancel"
|
|
43
|
-
confirmText="Delete"
|
|
44
|
-
>
|
|
45
|
-
<p>Are you sure you want to delete this item? This action cannot be undone.</p>
|
|
46
|
-
</Modal>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
```astro
|
|
50
|
-
<Modal
|
|
51
|
-
id="dialog2"
|
|
52
|
-
open="Delete Item"
|
|
53
|
-
title="Confirm Delete"
|
|
54
|
-
showActions
|
|
55
|
-
cancelText="Cancel"
|
|
56
|
-
confirmText="Delete"
|
|
57
|
-
>
|
|
58
|
-
<p>Are you sure you want to delete this item? This action cannot be undone.</p>
|
|
59
|
-
</Modal>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Modal with Custom Actions
|
|
63
|
-
|
|
64
|
-
<div class="component-preview">
|
|
65
|
-
<Modal
|
|
66
|
-
id="dialog3"
|
|
67
|
-
open="Save Changes"
|
|
68
|
-
title="Save Document"
|
|
69
|
-
showActions
|
|
70
|
-
>
|
|
71
|
-
<p>Would you like to save your changes before closing?</p>
|
|
72
|
-
|
|
73
|
-
<div slot="actions" class="flex gap-3 justify-end">
|
|
74
|
-
<form method="dialog" class="contents">
|
|
75
|
-
<Button>Don't Save</Button>
|
|
76
|
-
</form>
|
|
77
|
-
<form method="dialog" class="contents">
|
|
78
|
-
<Button primary>Save</Button>
|
|
79
|
-
</form>
|
|
80
|
-
</div>
|
|
81
|
-
</Modal>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
```astro
|
|
85
|
-
<Modal
|
|
86
|
-
id="dialog3"
|
|
87
|
-
open="Save Changes"
|
|
88
|
-
title="Save Document"
|
|
89
|
-
showActions
|
|
90
|
-
>
|
|
91
|
-
<p>Would you like to save your changes before closing?</p>
|
|
92
|
-
|
|
93
|
-
<div slot="actions" class="flex gap-3 justify-end">
|
|
94
|
-
<form method="dialog" class="contents">
|
|
95
|
-
<Button>Don't Save</Button>
|
|
96
|
-
</form>
|
|
97
|
-
<form method="dialog" class="contents">
|
|
98
|
-
<Button primary>Save</Button>
|
|
99
|
-
</form>
|
|
100
|
-
</div>
|
|
101
|
-
</Modal>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Modal with Custom Width
|
|
105
|
-
|
|
106
|
-
<div class="component-preview">
|
|
107
|
-
<Modal
|
|
108
|
-
id="dialog4"
|
|
109
|
-
open="Wide Modal"
|
|
110
|
-
title="Large Content"
|
|
111
|
-
maxWidth="900px"
|
|
112
|
-
>
|
|
113
|
-
<p>This modal is wider than the default. Useful for forms or detailed content.</p>
|
|
114
|
-
<div class="grid grid-cols-2 gap-4 mt-4">
|
|
115
|
-
<div class="p-4 bg-gray-100 rounded">Column 1</div>
|
|
116
|
-
<div class="p-4 bg-gray-100 rounded">Column 2</div>
|
|
117
|
-
</div>
|
|
118
|
-
</Modal>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
```astro
|
|
122
|
-
<Modal
|
|
123
|
-
id="dialog4"
|
|
124
|
-
open="Wide Modal"
|
|
125
|
-
title="Large Content"
|
|
126
|
-
maxWidth="900px"
|
|
127
|
-
>
|
|
128
|
-
<p>This modal is wider than the default. Useful for forms or detailed content.</p>
|
|
129
|
-
</Modal>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Modal without X Button (Legacy Style)
|
|
133
|
-
|
|
134
|
-
<div class="component-preview">
|
|
135
|
-
<Modal id="dialog5" open="Open modal" title="Custom Close" showXButton={false}>
|
|
136
|
-
<p>This modal doesn't have the X button.</p>
|
|
137
|
-
<p>You need to provide your own close button.</p>
|
|
138
|
-
<Button primary slot="close" class="mt-4">Close Modal</Button>
|
|
139
|
-
</Modal>
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
```astro
|
|
143
|
-
<Modal id="dialog5" open="Open modal" title="Custom Close" showXButton={false}>
|
|
144
|
-
<p>This modal doesn't have the X button.</p>
|
|
145
|
-
<Button primary slot="close" class="mt-4">Close Modal</Button>
|
|
146
|
-
</Modal>
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Modal with Custom Close Button (Icon)
|
|
150
|
-
|
|
151
|
-
<div class="component-preview">
|
|
152
|
-
<Modal id="dialog6" open="Open modal" title="Icon Close" showXButton={false}>
|
|
153
|
-
<p>Some extra content you would like here</p>
|
|
154
|
-
<Button primary slot="close" class="mt-4"><Icon name="octicon:x-24" /></Button>
|
|
155
|
-
</Modal>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
```astro
|
|
159
|
-
<Modal id="dialog6" open="Open modal" title="Icon Close" showXButton={false}>
|
|
160
|
-
<p>Some extra content you would like here</p>
|
|
161
|
-
<Button primary slot="close" class="mt-4"><Icon name="octicon:x-24" /></Button>
|
|
162
|
-
</Modal>
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Handling Confirm Events
|
|
166
|
-
|
|
167
|
-
You can listen for the `confirm` event when using action buttons:
|
|
168
|
-
|
|
169
|
-
```javascript
|
|
170
|
-
document.getElementById('dialog2').addEventListener('confirm', (e) => {
|
|
171
|
-
console.log('Confirmed!', e.detail);
|
|
172
|
-
// Perform your action here
|
|
173
|
-
document.getElementById('dialog2').close();
|
|
174
|
-
});
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Props
|
|
178
|
-
|
|
179
|
-
| Prop | Type | Default | Description |
|
|
180
|
-
|------|------|---------|-------------|
|
|
181
|
-
| `id` | string | required | Unique identifier for the modal |
|
|
182
|
-
| `open` | string | `'Open modal'` | Text for the trigger button |
|
|
183
|
-
| `title` | string | `undefined` | Modal title (shown in header) |
|
|
184
|
-
| `maxWidth` | string | `'600px'` | Maximum width of the modal |
|
|
185
|
-
| `showXButton` | boolean | `true` | Show X close button in top-right |
|
|
186
|
-
| `showTrigger` | boolean | `true` | Show the trigger button |
|
|
187
|
-
| `showActions` | boolean | `false` | Show action buttons footer |
|
|
188
|
-
| `cancelText` | string | `'Cancel'` | Text for cancel button |
|
|
189
|
-
| `confirmText` | string | `'Confirm'` | Text for confirm button |
|
|
190
|
-
| `confirmPrimary` | boolean | `true` | Make confirm button primary style |
|
|
191
|
-
|
|
192
|
-
## Slots
|
|
193
|
-
|
|
194
|
-
| Slot | Description |
|
|
195
|
-
|------|-------------|
|
|
196
|
-
| `default` | Main modal content (alias for `main` slot) |
|
|
197
|
-
| `main` | Main modal content |
|
|
198
|
-
| `header` | Custom header content (replaces title) |
|
|
199
|
-
| `actions` | Custom action buttons (when `showActions` is true) |
|
|
200
|
-
| `close` | Custom close button (when `showActions` is false) |
|
|
201
|
-
|
|
202
|
-
## Features
|
|
203
|
-
|
|
204
|
-
- ✅ Built-in X close button in top-right corner
|
|
205
|
-
- ✅ Click backdrop to close
|
|
206
|
-
- ✅ Press Escape to close
|
|
207
|
-
- ✅ Built-in action buttons (Cancel/Confirm)
|
|
208
|
-
- ✅ Customizable width
|
|
209
|
-
- ✅ TypeScript support
|
|
210
|
-
- ✅ Fully accessible with ARIA labels
|
|
211
|
-
|
|
212
|
-
|
|
1
|
+
---
|
|
2
|
+
title: "Modal"
|
|
3
|
+
layout: "../../layouts/MainLayout.astro"
|
|
4
|
+
---
|
|
5
|
+
import Modal from '../../components/Modal.astro'
|
|
6
|
+
import Button from '../../components/Button.vue'
|
|
7
|
+
import { Icon } from 'astro-icon/components';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Modal
|
|
11
|
+
|
|
12
|
+
Native modal window based on `<dialog>` tag with `::backdrop` CSS pseudo-element. Features built-in X close button, action buttons, and flexible configuration.
|
|
13
|
+
|
|
14
|
+
**Documentation:**
|
|
15
|
+
- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
|
|
16
|
+
- https://developer.mozilla.org/en-US/docs/Web/CSS/::backdrop
|
|
17
|
+
|
|
18
|
+
## Basic Modal with Title and X Button
|
|
19
|
+
|
|
20
|
+
<div class="component-preview">
|
|
21
|
+
<Modal id="dialog1" open="Open modal" title="Modal Title">
|
|
22
|
+
<p>This modal has a title and built-in X close button in the top-right corner.</p>
|
|
23
|
+
<p>You can also close by clicking the backdrop or pressing Escape.</p>
|
|
24
|
+
</Modal>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
```astro
|
|
28
|
+
<Modal id="dialog1" open="Open modal" title="Modal Title">
|
|
29
|
+
<p>This modal has a title and built-in X close button in the top-right corner.</p>
|
|
30
|
+
<p>You can also close by clicking the backdrop or pressing Escape.</p>
|
|
31
|
+
</Modal>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Modal with Action Buttons
|
|
35
|
+
|
|
36
|
+
<div class="component-preview">
|
|
37
|
+
<Modal
|
|
38
|
+
id="dialog2"
|
|
39
|
+
open="Delete Item"
|
|
40
|
+
title="Confirm Delete"
|
|
41
|
+
showActions
|
|
42
|
+
cancelText="Cancel"
|
|
43
|
+
confirmText="Delete"
|
|
44
|
+
>
|
|
45
|
+
<p>Are you sure you want to delete this item? This action cannot be undone.</p>
|
|
46
|
+
</Modal>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
```astro
|
|
50
|
+
<Modal
|
|
51
|
+
id="dialog2"
|
|
52
|
+
open="Delete Item"
|
|
53
|
+
title="Confirm Delete"
|
|
54
|
+
showActions
|
|
55
|
+
cancelText="Cancel"
|
|
56
|
+
confirmText="Delete"
|
|
57
|
+
>
|
|
58
|
+
<p>Are you sure you want to delete this item? This action cannot be undone.</p>
|
|
59
|
+
</Modal>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Modal with Custom Actions
|
|
63
|
+
|
|
64
|
+
<div class="component-preview">
|
|
65
|
+
<Modal
|
|
66
|
+
id="dialog3"
|
|
67
|
+
open="Save Changes"
|
|
68
|
+
title="Save Document"
|
|
69
|
+
showActions
|
|
70
|
+
>
|
|
71
|
+
<p>Would you like to save your changes before closing?</p>
|
|
72
|
+
|
|
73
|
+
<div slot="actions" class="flex gap-3 justify-end">
|
|
74
|
+
<form method="dialog" class="contents">
|
|
75
|
+
<Button>Don't Save</Button>
|
|
76
|
+
</form>
|
|
77
|
+
<form method="dialog" class="contents">
|
|
78
|
+
<Button primary>Save</Button>
|
|
79
|
+
</form>
|
|
80
|
+
</div>
|
|
81
|
+
</Modal>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
```astro
|
|
85
|
+
<Modal
|
|
86
|
+
id="dialog3"
|
|
87
|
+
open="Save Changes"
|
|
88
|
+
title="Save Document"
|
|
89
|
+
showActions
|
|
90
|
+
>
|
|
91
|
+
<p>Would you like to save your changes before closing?</p>
|
|
92
|
+
|
|
93
|
+
<div slot="actions" class="flex gap-3 justify-end">
|
|
94
|
+
<form method="dialog" class="contents">
|
|
95
|
+
<Button>Don't Save</Button>
|
|
96
|
+
</form>
|
|
97
|
+
<form method="dialog" class="contents">
|
|
98
|
+
<Button primary>Save</Button>
|
|
99
|
+
</form>
|
|
100
|
+
</div>
|
|
101
|
+
</Modal>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Modal with Custom Width
|
|
105
|
+
|
|
106
|
+
<div class="component-preview">
|
|
107
|
+
<Modal
|
|
108
|
+
id="dialog4"
|
|
109
|
+
open="Wide Modal"
|
|
110
|
+
title="Large Content"
|
|
111
|
+
maxWidth="900px"
|
|
112
|
+
>
|
|
113
|
+
<p>This modal is wider than the default. Useful for forms or detailed content.</p>
|
|
114
|
+
<div class="grid grid-cols-2 gap-4 mt-4">
|
|
115
|
+
<div class="p-4 bg-gray-100 rounded">Column 1</div>
|
|
116
|
+
<div class="p-4 bg-gray-100 rounded">Column 2</div>
|
|
117
|
+
</div>
|
|
118
|
+
</Modal>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
```astro
|
|
122
|
+
<Modal
|
|
123
|
+
id="dialog4"
|
|
124
|
+
open="Wide Modal"
|
|
125
|
+
title="Large Content"
|
|
126
|
+
maxWidth="900px"
|
|
127
|
+
>
|
|
128
|
+
<p>This modal is wider than the default. Useful for forms or detailed content.</p>
|
|
129
|
+
</Modal>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Modal without X Button (Legacy Style)
|
|
133
|
+
|
|
134
|
+
<div class="component-preview">
|
|
135
|
+
<Modal id="dialog5" open="Open modal" title="Custom Close" showXButton={false}>
|
|
136
|
+
<p>This modal doesn't have the X button.</p>
|
|
137
|
+
<p>You need to provide your own close button.</p>
|
|
138
|
+
<Button primary slot="close" class="mt-4">Close Modal</Button>
|
|
139
|
+
</Modal>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
```astro
|
|
143
|
+
<Modal id="dialog5" open="Open modal" title="Custom Close" showXButton={false}>
|
|
144
|
+
<p>This modal doesn't have the X button.</p>
|
|
145
|
+
<Button primary slot="close" class="mt-4">Close Modal</Button>
|
|
146
|
+
</Modal>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Modal with Custom Close Button (Icon)
|
|
150
|
+
|
|
151
|
+
<div class="component-preview">
|
|
152
|
+
<Modal id="dialog6" open="Open modal" title="Icon Close" showXButton={false}>
|
|
153
|
+
<p>Some extra content you would like here</p>
|
|
154
|
+
<Button primary slot="close" class="mt-4"><Icon name="octicon:x-24" /></Button>
|
|
155
|
+
</Modal>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
```astro
|
|
159
|
+
<Modal id="dialog6" open="Open modal" title="Icon Close" showXButton={false}>
|
|
160
|
+
<p>Some extra content you would like here</p>
|
|
161
|
+
<Button primary slot="close" class="mt-4"><Icon name="octicon:x-24" /></Button>
|
|
162
|
+
</Modal>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Handling Confirm Events
|
|
166
|
+
|
|
167
|
+
You can listen for the `confirm` event when using action buttons:
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
document.getElementById('dialog2').addEventListener('confirm', (e) => {
|
|
171
|
+
console.log('Confirmed!', e.detail);
|
|
172
|
+
// Perform your action here
|
|
173
|
+
document.getElementById('dialog2').close();
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Props
|
|
178
|
+
|
|
179
|
+
| Prop | Type | Default | Description |
|
|
180
|
+
|------|------|---------|-------------|
|
|
181
|
+
| `id` | string | required | Unique identifier for the modal |
|
|
182
|
+
| `open` | string | `'Open modal'` | Text for the trigger button |
|
|
183
|
+
| `title` | string | `undefined` | Modal title (shown in header) |
|
|
184
|
+
| `maxWidth` | string | `'600px'` | Maximum width of the modal |
|
|
185
|
+
| `showXButton` | boolean | `true` | Show X close button in top-right |
|
|
186
|
+
| `showTrigger` | boolean | `true` | Show the trigger button |
|
|
187
|
+
| `showActions` | boolean | `false` | Show action buttons footer |
|
|
188
|
+
| `cancelText` | string | `'Cancel'` | Text for cancel button |
|
|
189
|
+
| `confirmText` | string | `'Confirm'` | Text for confirm button |
|
|
190
|
+
| `confirmPrimary` | boolean | `true` | Make confirm button primary style |
|
|
191
|
+
|
|
192
|
+
## Slots
|
|
193
|
+
|
|
194
|
+
| Slot | Description |
|
|
195
|
+
|------|-------------|
|
|
196
|
+
| `default` | Main modal content (alias for `main` slot) |
|
|
197
|
+
| `main` | Main modal content |
|
|
198
|
+
| `header` | Custom header content (replaces title) |
|
|
199
|
+
| `actions` | Custom action buttons (when `showActions` is true) |
|
|
200
|
+
| `close` | Custom close button (when `showActions` is false) |
|
|
201
|
+
|
|
202
|
+
## Features
|
|
203
|
+
|
|
204
|
+
- ✅ Built-in X close button in top-right corner
|
|
205
|
+
- ✅ Click backdrop to close
|
|
206
|
+
- ✅ Press Escape to close
|
|
207
|
+
- ✅ Built-in action buttons (Cancel/Confirm)
|
|
208
|
+
- ✅ Customizable width
|
|
209
|
+
- ✅ TypeScript support
|
|
210
|
+
- ✅ Fully accessible with ARIA labels
|
|
211
|
+
|
|
212
|
+
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "PostHeader"
|
|
3
|
-
layout: "../../layouts/MainLayout.astro"
|
|
4
|
-
---
|
|
5
|
-
import PostHeader from '../../components/PostHeader.astro'
|
|
6
|
-
export const author = { firstName: 'Szymon', name: 'CNK' }
|
|
7
|
-
export const categories = [{"name":"Tools & garage accessories","uri":"#"}, {"name":"Lorem Ipsum","uri":"#"}]
|
|
8
|
-
export const date = "2023-07-13T01:35:03"
|
|
9
|
-
|
|
10
|
-
# PostHeader
|
|
11
|
-
|
|
12
|
-
WordPress PostHeader - post top component for WordPress Single Post template data like categories etc. comes from WP Rest API.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## PostHeader with some content for WordPress single page template
|
|
16
|
-
|
|
17
|
-
<div class="component-preview">
|
|
18
|
-
<div class="relative w-full">
|
|
19
|
-
<PostHeader
|
|
20
|
-
author={author}
|
|
21
|
-
lang="en"
|
|
22
|
-
categories={categories}
|
|
23
|
-
title="Lorem Ipsum"
|
|
24
|
-
date={date}
|
|
25
|
-
image="https://img.freepik.com/free-photo/morskie-oko-tatry_1204-510.jpg?w=1380&t=st=1706297574~exp=1706298174~hmac=5c93e7317e7dbe602d5dcd708c5b9708ffabcb5e8ab2b7f2790941975dfcefe4"
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
<div class="relative">
|
|
32
|
-
<PostHeader
|
|
33
|
-
author={ { firstName: 'Szymon', name: 'CNK' } }
|
|
34
|
-
lang="en"
|
|
35
|
-
categories={ [{"name":"Tools & garage accessories","uri":"/category/garage/tools-garage-accessories/"}, , {"name":"Lorem Ipsum","uri":"#"}] }
|
|
36
|
-
title="Lorem Ipsum"
|
|
37
|
-
date="2023-07-13T01:35:03"
|
|
38
|
-
image="https://img.freepik.com/free-photo/morskie-oko-tatry_1204-510.jpg?w=1380&t=st=1706297574~exp=1706298174~hmac=5c93e7317e7dbe602d5dcd708c5b9708ffabcb5e8ab2b7f2790941975dfcefe4"
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## PostHeader - only title
|
|
45
|
-
|
|
46
|
-
<div class="component-preview">
|
|
47
|
-
<div class="relative w-full">
|
|
48
|
-
<PostHeader
|
|
49
|
-
title="Lorem Ipsum"
|
|
50
|
-
lang="en"
|
|
51
|
-
image="https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg?w=1380&t=st=1706297408~exp=1706298008~hmac=34fe549db6a665d24269d38a8ecdd7eb3f82cfea6346c8a4039ee3c03b62aad8"
|
|
52
|
-
/>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
<div class="relative">
|
|
58
|
-
<PostHeader
|
|
59
|
-
title="Lorem Ipsum"
|
|
60
|
-
lang="en"
|
|
61
|
-
image="https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg?w=1380&t=st=1706297408~exp=1706298008~hmac=34fe549db6a665d24269d38a8ecdd7eb3f82cfea6346c8a4039ee3c03b62aad8"
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
```
|
|
1
|
+
---
|
|
2
|
+
title: "PostHeader"
|
|
3
|
+
layout: "../../layouts/MainLayout.astro"
|
|
4
|
+
---
|
|
5
|
+
import PostHeader from '../../components/PostHeader.astro'
|
|
6
|
+
export const author = { firstName: 'Szymon', name: 'CNK' }
|
|
7
|
+
export const categories = [{"name":"Tools & garage accessories","uri":"#"}, {"name":"Lorem Ipsum","uri":"#"}]
|
|
8
|
+
export const date = "2023-07-13T01:35:03"
|
|
9
|
+
|
|
10
|
+
# PostHeader
|
|
11
|
+
|
|
12
|
+
WordPress PostHeader - post top component for WordPress Single Post template data like categories etc. comes from WP Rest API.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## PostHeader with some content for WordPress single page template
|
|
16
|
+
|
|
17
|
+
<div class="component-preview">
|
|
18
|
+
<div class="relative w-full">
|
|
19
|
+
<PostHeader
|
|
20
|
+
author={author}
|
|
21
|
+
lang="en"
|
|
22
|
+
categories={categories}
|
|
23
|
+
title="Lorem Ipsum"
|
|
24
|
+
date={date}
|
|
25
|
+
image="https://img.freepik.com/free-photo/morskie-oko-tatry_1204-510.jpg?w=1380&t=st=1706297574~exp=1706298174~hmac=5c93e7317e7dbe602d5dcd708c5b9708ffabcb5e8ab2b7f2790941975dfcefe4"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
<div class="relative">
|
|
32
|
+
<PostHeader
|
|
33
|
+
author={ { firstName: 'Szymon', name: 'CNK' } }
|
|
34
|
+
lang="en"
|
|
35
|
+
categories={ [{"name":"Tools & garage accessories","uri":"/category/garage/tools-garage-accessories/"}, , {"name":"Lorem Ipsum","uri":"#"}] }
|
|
36
|
+
title="Lorem Ipsum"
|
|
37
|
+
date="2023-07-13T01:35:03"
|
|
38
|
+
image="https://img.freepik.com/free-photo/morskie-oko-tatry_1204-510.jpg?w=1380&t=st=1706297574~exp=1706298174~hmac=5c93e7317e7dbe602d5dcd708c5b9708ffabcb5e8ab2b7f2790941975dfcefe4"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## PostHeader - only title
|
|
45
|
+
|
|
46
|
+
<div class="component-preview">
|
|
47
|
+
<div class="relative w-full">
|
|
48
|
+
<PostHeader
|
|
49
|
+
title="Lorem Ipsum"
|
|
50
|
+
lang="en"
|
|
51
|
+
image="https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg?w=1380&t=st=1706297408~exp=1706298008~hmac=34fe549db6a665d24269d38a8ecdd7eb3f82cfea6346c8a4039ee3c03b62aad8"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
<div class="relative">
|
|
58
|
+
<PostHeader
|
|
59
|
+
title="Lorem Ipsum"
|
|
60
|
+
lang="en"
|
|
61
|
+
image="https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg?w=1380&t=st=1706297408~exp=1706298008~hmac=34fe549db6a665d24269d38a8ecdd7eb3f82cfea6346c8a4039ee3c03b62aad8"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
```
|