@fpkit/acss 0.6.2 → 1.0.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/README.md +32 -0
- package/docs/README.md +325 -0
- package/docs/guides/accessibility.md +764 -0
- package/docs/guides/architecture.md +705 -0
- package/docs/guides/composition.md +688 -0
- package/docs/guides/css-variables.md +522 -0
- package/docs/guides/storybook.md +828 -0
- package/docs/guides/testing.md +817 -0
- package/docs/testing/focus-indicator-testing.md +437 -0
- package/libs/components/alert/alert.css +1 -1
- package/libs/components/alert/alert.css.map +1 -1
- package/libs/components/alert/alert.min.css +2 -2
- package/libs/components/badge/badge.css +1 -1
- package/libs/components/badge/badge.css.map +1 -1
- package/libs/components/badge/badge.min.css +2 -2
- package/libs/components/breadcrumbs/breadcrumb.css +1 -1
- package/libs/components/breadcrumbs/breadcrumb.css.map +1 -1
- package/libs/components/breadcrumbs/breadcrumb.min.css +2 -2
- package/libs/components/buttons/button.css +1 -1
- package/libs/components/buttons/button.css.map +1 -1
- package/libs/components/buttons/button.min.css +2 -2
- package/libs/components/cards/card.css +1 -1
- package/libs/components/cards/card.css.map +1 -1
- package/libs/components/cards/card.min.css +2 -2
- package/libs/components/details/details.css +1 -1
- package/libs/components/details/details.css.map +1 -1
- package/libs/components/details/details.min.css +2 -2
- package/libs/components/dialog/dialog.css +1 -1
- package/libs/components/dialog/dialog.css.map +1 -1
- package/libs/components/dialog/dialog.min.css +2 -2
- package/libs/components/form/form.css +1 -1
- package/libs/components/form/form.css.map +1 -1
- package/libs/components/form/form.min.css +2 -2
- package/libs/components/images/img.css +1 -1
- package/libs/components/images/img.css.map +1 -1
- package/libs/components/images/img.min.css +2 -2
- package/libs/components/layout/landmarks.css +1 -1
- package/libs/components/layout/landmarks.css.map +1 -1
- package/libs/components/layout/landmarks.min.css +2 -2
- package/libs/components/link/link.css +1 -1
- package/libs/components/link/link.css.map +1 -1
- package/libs/components/link/link.min.css +2 -2
- package/libs/components/list/list.css +1 -1
- package/libs/components/list/list.min.css +1 -1
- package/libs/components/nav/nav.css +1 -1
- package/libs/components/nav/nav.css.map +1 -1
- package/libs/components/nav/nav.min.css +2 -2
- package/libs/components/progress/progress.css +1 -1
- package/libs/components/progress/progress.css.map +1 -1
- package/libs/components/progress/progress.min.css +2 -2
- package/libs/components/tag/tag.css +1 -1
- package/libs/components/tag/tag.css.map +1 -1
- package/libs/components/tag/tag.min.css +2 -2
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/package.json +4 -3
- package/src/components/README.mdx +1 -1
- package/src/components/alert/alert.scss +4 -4
- package/src/components/alert/alert.scss.backup +184 -0
- package/src/components/alert/alert.stories.tsx +53 -2
- package/src/components/badge/badge.scss +2 -2
- package/src/components/badge/badge.scss.backup +39 -0
- package/src/components/badge/badge.stories.tsx +40 -0
- package/src/components/breadcrumbs/breadcrumb.scss +5 -5
- package/src/components/breadcrumbs/breadcrumb.scss.backup +35 -0
- package/src/components/breadcrumbs/breadcrumb.stories.tsx +17 -1
- package/src/components/buttons/button.scss +32 -27
- package/src/components/buttons/button.scss.backup +145 -0
- package/src/components/buttons/button.stories.tsx +196 -7
- package/src/components/cards/card.scss +39 -5
- package/src/components/cards/card.scss.backup +67 -0
- package/src/components/cards/card.stories.tsx +184 -1
- package/src/components/details/details.scss +14 -14
- package/src/components/details/details.scss.backup +126 -0
- package/src/components/details/details.stories.tsx +41 -1
- package/src/components/dialog/dialog.scss +3 -3
- package/src/components/dialog/dialog.scss.backup +126 -0
- package/src/components/form/form.scss +25 -9
- package/src/components/form/form.scss.backup +87 -0
- package/src/components/form/form.stories.tsx +272 -1
- package/src/components/form/input.stories.tsx +159 -1
- package/src/components/form/select.stories.tsx +1 -1
- package/src/components/heading/README.mdx +292 -0
- package/src/components/icons/icon.stories.tsx +1 -1
- package/src/components/images/figure.stories.tsx +41 -1
- package/src/components/images/img.scss +8 -8
- package/src/components/images/img.scss.backup +59 -0
- package/src/components/layout/_header.scss +14 -14
- package/src/components/layout/_header.scss.backup +72 -0
- package/src/components/layout/landmarks.scss +7 -7
- package/src/components/layout/landmarks.scss.backup +51 -0
- package/src/components/layout/landmarks.stories.tsx +42 -0
- package/src/components/link/link.scss +5 -5
- package/src/components/link/link.scss.backup +145 -0
- package/src/components/link/link.stories.tsx +38 -2
- package/src/components/list/list.scss +1 -1
- package/src/components/nav/nav.scss +17 -17
- package/src/components/nav/nav.scss.backup +123 -0
- package/src/components/nav/nav.stories.tsx +36 -2
- package/src/components/progress/progress.scss +7 -7
- package/src/components/progress/progress.scss.backup +70 -0
- package/src/components/tag/tag.scss +10 -10
- package/src/components/tag/tag.scss.backup +130 -0
- package/src/components/tag/tag.stories.tsx +23 -2
- package/src/components/ui.stories.tsx +53 -19
- package/src/docs/accessibility.mdx +484 -0
- package/src/docs/composition.mdx +549 -0
- package/src/docs/css-variables.mdx +380 -0
- package/src/docs/fpkit-developer.mdx +545 -0
- package/src/introduction.mdx +356 -0
- package/src/styles/alert/alert.css +4 -4
- package/src/styles/badge/badge.css +2 -2
- package/src/styles/breadcrumbs/breadcrumb.css +5 -5
- package/src/styles/buttons/button.css +30 -27
- package/src/styles/buttons/button.css.map +1 -1
- package/src/styles/cards/card.css +35 -5
- package/src/styles/cards/card.css.map +1 -1
- package/src/styles/details/details.css +14 -14
- package/src/styles/dialog/dialog.css +3 -3
- package/src/styles/form/form.css +20 -10
- package/src/styles/form/form.css.map +1 -1
- package/src/styles/images/img.css +8 -8
- package/src/styles/index.css +179 -134
- package/src/styles/index.css.map +1 -1
- package/src/styles/layout/landmarks.css +21 -21
- package/src/styles/link/link.css +5 -5
- package/src/styles/list/list.css +1 -1
- package/src/styles/nav/nav.css +17 -17
- package/src/styles/progress/progress.css +6 -6
- package/src/styles/tag/tag.css +4 -4
- package/src/styles/utilities/_disabled.scss +5 -4
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { Meta } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta title="FP.REACT Components/Heading (Deprecated)/Readme" />
|
|
4
|
+
|
|
5
|
+
# Heading (Deprecated)
|
|
6
|
+
|
|
7
|
+
> ⚠️ **DEPRECATED**: This component is deprecated and will be removed in **v3.0.0**. Please use the [`Title`](?path=/docs/fp-react-components-title--docs) component instead.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Deprecation Notice
|
|
12
|
+
|
|
13
|
+
<div style={{ padding: '1.5rem', background: '#fef3c7', border: '2px solid #f59e0b', borderRadius: '0.5rem', marginBottom: '2rem' }}>
|
|
14
|
+
<strong style={{ color: '#92400e', fontSize: '1.125rem' }}>⚠️ This component is deprecated</strong>
|
|
15
|
+
<p style={{ marginTop: '0.5rem', color: '#78350f' }}>
|
|
16
|
+
The <code>Heading</code> component has been replaced by the new <code>Title</code> component
|
|
17
|
+
which offers improved API design, better accessibility features, and enhanced performance.
|
|
18
|
+
</p>
|
|
19
|
+
<p style={{ marginTop: '0.5rem', color: '#78350f' }}>
|
|
20
|
+
<strong>Removal Timeline:</strong> This component will be removed in v3.0.0 (TBD)
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Migration
|
|
27
|
+
|
|
28
|
+
### Before (Deprecated)
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Heading } from '@fpkit/acss';
|
|
32
|
+
|
|
33
|
+
<Heading type="h2">Section Title</Heading>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### After (Recommended)
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Title } from '@fpkit/acss';
|
|
40
|
+
|
|
41
|
+
<Title level="h2">Section Title</Title>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Why We Deprecated Heading
|
|
47
|
+
|
|
48
|
+
The new `Title` component provides several advantages over the deprecated `Heading` component:
|
|
49
|
+
|
|
50
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem', margin: '1.5rem 0' }}>
|
|
51
|
+
<div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
|
|
52
|
+
<strong>✅ Better API</strong>
|
|
53
|
+
<p style={{ fontSize: '0.875rem', color: '#666' }}>The <code>level</code> prop is more semantic and descriptive than <code>type</code></p>
|
|
54
|
+
</div>
|
|
55
|
+
<div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
|
|
56
|
+
<strong>✅ Improved Accessibility</strong>
|
|
57
|
+
<p style={{ fontSize: '0.875rem', color: '#666' }}>Enhanced WCAG 2.1 AA compliance with better screen reader support</p>
|
|
58
|
+
</div>
|
|
59
|
+
<div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
|
|
60
|
+
<strong>✅ Better Documentation</strong>
|
|
61
|
+
<p style={{ fontSize: '0.875rem', color: '#666' }}>Comprehensive JSDoc comments for improved TypeScript IntelliSense</p>
|
|
62
|
+
</div>
|
|
63
|
+
<div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
|
|
64
|
+
<strong>✅ Performance</strong>
|
|
65
|
+
<p style={{ fontSize: '0.875rem', color: '#666' }}>React.memo optimization prevents unnecessary re-renders</p>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Migration Guide
|
|
72
|
+
|
|
73
|
+
### Step-by-Step Migration
|
|
74
|
+
|
|
75
|
+
#### 1. Update Imports
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
// Before
|
|
79
|
+
import { Heading } from '@fpkit/acss';
|
|
80
|
+
|
|
81
|
+
// After
|
|
82
|
+
import { Title } from '@fpkit/acss';
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### 2. Rename the Component
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
// Before
|
|
89
|
+
<Heading type="h2">Section Title</Heading>
|
|
90
|
+
|
|
91
|
+
// After
|
|
92
|
+
<Title level="h2">Section Title</Title>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### 3. Update the Prop Name
|
|
96
|
+
|
|
97
|
+
The only prop that changed is `type` → `level`:
|
|
98
|
+
|
|
99
|
+
| Old Prop | New Prop | Description |
|
|
100
|
+
|----------|----------|-------------|
|
|
101
|
+
| `type` | `level` | The semantic heading level (h1-h6) |
|
|
102
|
+
|
|
103
|
+
#### 4. Review Default Behavior
|
|
104
|
+
|
|
105
|
+
**IMPORTANT:** The default heading level changed:
|
|
106
|
+
|
|
107
|
+
- **Heading (old)**: Default is `h3`
|
|
108
|
+
- **Title (new)**: Default is `h2`
|
|
109
|
+
|
|
110
|
+
If you relied on the default, you may need to explicitly specify `h3`:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
// Before (implicitly h3)
|
|
114
|
+
<Heading>Default Heading</Heading>
|
|
115
|
+
|
|
116
|
+
// After (explicitly h3 to maintain behavior)
|
|
117
|
+
<Title level="h3">Default Heading</Title>
|
|
118
|
+
|
|
119
|
+
// Or use the new default (h2)
|
|
120
|
+
<Title>Default Title</Title>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## All Heading Levels
|
|
126
|
+
|
|
127
|
+
The `Heading` component supports all six semantic heading levels, just like `Title`:
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
// h1 - Page title (use once per page)
|
|
131
|
+
<Heading type="h1">Main Page Title</Heading>
|
|
132
|
+
|
|
133
|
+
// h2 - Major sections
|
|
134
|
+
<Heading type="h2">Section Heading</Heading>
|
|
135
|
+
|
|
136
|
+
// h3 - Subsections (default)
|
|
137
|
+
<Heading type="h3">Subsection Heading</Heading>
|
|
138
|
+
|
|
139
|
+
// h4-h6 - Deeper nesting
|
|
140
|
+
<Heading type="h4">Level Four Heading</Heading>
|
|
141
|
+
<Heading type="h5">Level Five Heading</Heading>
|
|
142
|
+
<Heading type="h6">Level Six Heading</Heading>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Migrate to:**
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
// h1 - Page title (use once per page)
|
|
149
|
+
<Title level="h1">Main Page Title</Title>
|
|
150
|
+
|
|
151
|
+
// h2 - Major sections (now default)
|
|
152
|
+
<Title level="h2">Section Heading</Title>
|
|
153
|
+
|
|
154
|
+
// h3 - Subsections
|
|
155
|
+
<Title level="h3">Subsection Heading</Title>
|
|
156
|
+
|
|
157
|
+
// h4-h6 - Deeper nesting
|
|
158
|
+
<Title level="h4">Level Four Heading</Title>
|
|
159
|
+
<Title level="h5">Level Five Heading</Title>
|
|
160
|
+
<Title level="h6">Level Six Heading</Title>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Props
|
|
166
|
+
|
|
167
|
+
> **Note**: These props still work but are deprecated. Refer to the [Title component documentation](?path=/docs/fp-react-components-title--docs) for the current API.
|
|
168
|
+
|
|
169
|
+
| Prop | Type | Default | Description |
|
|
170
|
+
|------|------|---------|-------------|
|
|
171
|
+
| `type` | `"h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6"` | `"h3"` | **Deprecated.** Use `level` on Title component instead |
|
|
172
|
+
| `children` | `React.ReactNode` | *required* | The content to display in the heading |
|
|
173
|
+
| `ui` | `string` | - | Data attribute for fpkit styling hooks |
|
|
174
|
+
| `className` | `string` | - | CSS class names to apply |
|
|
175
|
+
| `ref` | `React.Ref<HTMLHeadingElement>` | - | Forwarded ref to the heading element |
|
|
176
|
+
|
|
177
|
+
All other standard HTML heading attributes and ARIA properties are also supported.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Current Behavior
|
|
182
|
+
|
|
183
|
+
The `Heading` component still works for backwards compatibility but:
|
|
184
|
+
|
|
185
|
+
### Development Warnings
|
|
186
|
+
|
|
187
|
+
In development mode, the component logs deprecation warnings to the console:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
[@fpkit/acss] Heading component is deprecated and will be removed in v3.0.0.
|
|
191
|
+
Please use the Title component instead.
|
|
192
|
+
Migration: <Heading type="h2"> → <Title level="h2">
|
|
193
|
+
See documentation: https://fpkit.dev/components/title
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Production Behavior
|
|
197
|
+
|
|
198
|
+
- No console warnings in production builds
|
|
199
|
+
- Full backwards compatibility maintained
|
|
200
|
+
- All props forwarded correctly to Title component
|
|
201
|
+
- Performance identical to direct Title usage
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## TypeScript Support
|
|
206
|
+
|
|
207
|
+
The component maintains full TypeScript support:
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { Heading, type TitleProps } from '@fpkit/acss';
|
|
211
|
+
|
|
212
|
+
// Old API (still typed correctly)
|
|
213
|
+
<Heading type="h2">Typed Heading</Heading>
|
|
214
|
+
|
|
215
|
+
// Type-safe with all Title props
|
|
216
|
+
const props: TitleProps = {
|
|
217
|
+
type: 'h3',
|
|
218
|
+
children: 'Section Title',
|
|
219
|
+
className: 'custom-class'
|
|
220
|
+
};
|
|
221
|
+
<Heading {...props} />
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
However, TypeScript will show deprecation warnings in your IDE for better migration visibility.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Migration Checklist
|
|
229
|
+
|
|
230
|
+
Use this checklist to ensure a smooth migration:
|
|
231
|
+
|
|
232
|
+
- [ ] Find all `<Heading>` imports in your codebase
|
|
233
|
+
- [ ] Replace `import { Heading }` with `import { Title }`
|
|
234
|
+
- [ ] Replace all `<Heading>` tags with `<Title>`
|
|
235
|
+
- [ ] Replace all `type` props with `level`
|
|
236
|
+
- [ ] Review uses without explicit `type` prop (default changed from `h3` → `h2`)
|
|
237
|
+
- [ ] Test all migrated components
|
|
238
|
+
- [ ] Remove any `Heading` imports
|
|
239
|
+
- [ ] Search for any remaining references to `Heading` component
|
|
240
|
+
|
|
241
|
+
### Find and Replace Tips
|
|
242
|
+
|
|
243
|
+
**VS Code / IDE Search:**
|
|
244
|
+
|
|
245
|
+
```regex
|
|
246
|
+
# Find
|
|
247
|
+
<Heading\s+type="(h[1-6])"
|
|
248
|
+
|
|
249
|
+
# Replace with
|
|
250
|
+
<Title level="$1"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Command Line (ripgrep):**
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Find all Heading usage
|
|
257
|
+
rg "Heading" --type tsx --type ts
|
|
258
|
+
|
|
259
|
+
# Find Heading imports
|
|
260
|
+
rg "import.*Heading.*from.*@fpkit/acss"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Related Components
|
|
266
|
+
|
|
267
|
+
- **[Title](?path=/docs/fp-react-components-title--docs)** - The recommended replacement component
|
|
268
|
+
- **Text** - For body text and paragraphs
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Support & Resources
|
|
273
|
+
|
|
274
|
+
- **Title Component Docs**: [View documentation](?path=/docs/fp-react-components-title--docs)
|
|
275
|
+
- **GitHub**: [fpkit/acss](https://github.com/fpkit/acss)
|
|
276
|
+
- **Migration Help**: Open an issue if you need assistance migrating
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
<div style={{ padding: '1.5rem', background: '#f0f9ff', border: '1px solid #0ea5e9', borderRadius: '0.5rem', marginTop: '2rem' }}>
|
|
281
|
+
<strong>💡 Migration Tip:</strong> The Title component maintains the same functionality
|
|
282
|
+
while providing better DX and accessibility. The migration is straightforward and can be done incrementally.
|
|
283
|
+
Start by migrating new code, then gradually update existing components.
|
|
284
|
+
</div>
|
|
285
|
+
|
|
286
|
+
<div style={{ padding: '1.5rem', background: '#fef3c7', border: '2px solid #f59e0b', borderRadius: '0.5rem', marginTop: '1rem' }}>
|
|
287
|
+
<strong style={{ color: '#92400e' }}>⚠️ Removal Timeline</strong>
|
|
288
|
+
<p style={{ marginTop: '0.5rem', color: '#78350f', marginBottom: 0 }}>
|
|
289
|
+
Plan to complete your migration before upgrading to v3.0.0.
|
|
290
|
+
This component will be completely removed in that release.
|
|
291
|
+
</p>
|
|
292
|
+
</div>
|
|
@@ -11,7 +11,47 @@ const meta: Meta<typeof Figure> = {
|
|
|
11
11
|
actions: { argTypesRegex: "^on.*" },
|
|
12
12
|
docs: {
|
|
13
13
|
description: {
|
|
14
|
-
component:
|
|
14
|
+
component: `A semantic figure component for displaying images with captions, using CSS custom properties for flexible styling.
|
|
15
|
+
|
|
16
|
+
## CSS Variables
|
|
17
|
+
|
|
18
|
+
Customize the Figure and Image appearance using CSS custom properties:
|
|
19
|
+
|
|
20
|
+
### Image Variables (img[alt])
|
|
21
|
+
- \`--img-max-width\`: Maximum width (default: \`100%\`)
|
|
22
|
+
- \`--img-height\`: Height value (default: \`auto\`)
|
|
23
|
+
- \`--img-display\`: Display type (default: \`inline-block\`)
|
|
24
|
+
- \`--img-object-fit\`: Object fit mode (default: \`cover\`)
|
|
25
|
+
- \`--img-object-position\`: Object position (default: \`center\`)
|
|
26
|
+
- \`--img-aspect-ratio\`: Aspect ratio (default: \`auto 2/3\`)
|
|
27
|
+
|
|
28
|
+
### Figure Variables (figure:has(img[alt]))
|
|
29
|
+
- \`--fig-display\`: Display type (default: \`flex\`)
|
|
30
|
+
- \`--fig-padding\`: Figure padding (default: \`0.5rem\`)
|
|
31
|
+
- \`--fig-bg\`: Background color (default: \`rgba(245, 245, 245, 0.683)\`)
|
|
32
|
+
- \`--fig-width\`: Max width constraint (default: \`fit-content\`)
|
|
33
|
+
- \`--fig-bottom\`: Figcaption bottom offset (default: \`var(--fig-padding)\`)
|
|
34
|
+
- \`--fig-left\`: Figcaption left offset (default: \`var(--fig-padding)\`)
|
|
35
|
+
- \`--fig-right\`: Figcaption right offset (default: \`var(--fig-padding)\`)
|
|
36
|
+
|
|
37
|
+
### Figcaption Variables
|
|
38
|
+
- \`--caption-padding\`: Caption padding (default: \`var(--spc-3)\`)
|
|
39
|
+
|
|
40
|
+
**Example:**
|
|
41
|
+
\`\`\`css
|
|
42
|
+
figure:has(img[alt]) {
|
|
43
|
+
--fig-padding: 1rem;
|
|
44
|
+
--fig-bg: #f5f5f5;
|
|
45
|
+
--fig-width: 40rem;
|
|
46
|
+
--caption-padding: 1.5rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
img[alt] {
|
|
50
|
+
--img-max-width: 100%;
|
|
51
|
+
--img-object-fit: contain;
|
|
52
|
+
--img-aspect-ratio: 16/9;
|
|
53
|
+
}
|
|
54
|
+
\`\`\``,
|
|
15
55
|
},
|
|
16
56
|
},
|
|
17
57
|
},
|
|
@@ -39,20 +39,20 @@ img[alt] {
|
|
|
39
39
|
figure {
|
|
40
40
|
&:has(img[alt]) {
|
|
41
41
|
--fig-display: flex;
|
|
42
|
-
--fig-
|
|
42
|
+
--fig-padding: 0.5rem;
|
|
43
43
|
--fig-bg: rgba(245, 245, 245, 0.683);
|
|
44
|
-
--fig-
|
|
44
|
+
--fig-width: fit-content;
|
|
45
45
|
display: var(--fig-display);
|
|
46
46
|
position: relative;
|
|
47
|
-
padding: var(--fig-
|
|
47
|
+
padding: var(--fig-padding);
|
|
48
48
|
background-color: var(--fig-bg);
|
|
49
|
-
max-width: var(--fig-
|
|
49
|
+
max-width: var(--fig-width);
|
|
50
50
|
> figcaption {
|
|
51
51
|
position: absolute;
|
|
52
|
-
bottom: var(--fig-bottom, var(--fig-
|
|
53
|
-
left: var(--fig-left, var(--fig-
|
|
54
|
-
right: var(--fig-right, var(--fig-
|
|
55
|
-
padding: var(--caption-
|
|
52
|
+
bottom: var(--fig-bottom, var(--fig-padding));
|
|
53
|
+
left: var(--fig-left, var(--fig-padding));
|
|
54
|
+
right: var(--fig-right, var(--fig-padding));
|
|
55
|
+
padding: var(--caption-padding, var(--spc-3));
|
|
56
56
|
background-color: var(--fig-bg);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image component styles
|
|
3
|
+
*
|
|
4
|
+
* Applies to all images with alt attribute (both decorative alt="" and semantic).
|
|
5
|
+
* Uses CSS custom properties for flexible theming and responsive behavior.
|
|
6
|
+
*/
|
|
7
|
+
img[alt] {
|
|
8
|
+
/* CSS Custom Properties - Override these for customization */
|
|
9
|
+
--img-max-width: 100%;
|
|
10
|
+
--img-height: auto;
|
|
11
|
+
--img-object-fit: cover;
|
|
12
|
+
--img-object-position: center;
|
|
13
|
+
--img-aspect-ratio: auto 2/3;
|
|
14
|
+
--img-display: inline-block;
|
|
15
|
+
|
|
16
|
+
/* Layout - Responsive by default */
|
|
17
|
+
max-width: var(--img-max-width);
|
|
18
|
+
max-inline-size: var(--img-max-width); /* Logical property for i18n */
|
|
19
|
+
block-size: var(--img-height);
|
|
20
|
+
display: var(--img-display);
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
|
|
23
|
+
/* Object fitting for responsive images */
|
|
24
|
+
object-fit: var(--img-object-fit);
|
|
25
|
+
object-position: var(--img-object-position);
|
|
26
|
+
aspect-ratio: var(--img-aspect-ratio);
|
|
27
|
+
|
|
28
|
+
/* Accessibility - Italic font for broken image alt text */
|
|
29
|
+
font-style: italic;
|
|
30
|
+
|
|
31
|
+
/* Background for loading state */
|
|
32
|
+
background-size: cover;
|
|
33
|
+
background-repeat: no-repeat;
|
|
34
|
+
|
|
35
|
+
/* Shape margin for text wrapping */
|
|
36
|
+
shape-margin: var(--spc-3);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
figure {
|
|
40
|
+
&:has(img[alt]) {
|
|
41
|
+
--fig-display: flex;
|
|
42
|
+
--fig-p: 0.5rem;
|
|
43
|
+
--fig-bg: rgba(245, 245, 245, 0.683);
|
|
44
|
+
--fig-w: fit-content;
|
|
45
|
+
display: var(--fig-display);
|
|
46
|
+
position: relative;
|
|
47
|
+
padding: var(--fig-p);
|
|
48
|
+
background-color: var(--fig-bg);
|
|
49
|
+
max-width: var(--fig-w);
|
|
50
|
+
> figcaption {
|
|
51
|
+
position: absolute;
|
|
52
|
+
bottom: var(--fig-bottom, var(--fig-p));
|
|
53
|
+
left: var(--fig-left, var(--fig-p));
|
|
54
|
+
right: var(--fig-right, var(--fig-p));
|
|
55
|
+
padding: var(--caption-p, var(--spc-3));
|
|
56
|
+
background-color: var(--fig-bg);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -9,24 +9,24 @@ header,
|
|
|
9
9
|
--overlay-display: grid;
|
|
10
10
|
// Overlay padding
|
|
11
11
|
--overlay-padding: 2rem;
|
|
12
|
-
--overlay-
|
|
13
|
-
--overlay-
|
|
14
|
-
--overlay-max-
|
|
12
|
+
--overlay-width: 100%;
|
|
13
|
+
--overlay-height: 40vh;
|
|
14
|
+
--overlay-max-height: 500px;
|
|
15
15
|
--overlay-color: currentColor;
|
|
16
|
-
--overlay-content-
|
|
16
|
+
--overlay-content-width: 80%;
|
|
17
17
|
--overlay-gap: 2rem;
|
|
18
18
|
--overlay-bg: whitesmoke;
|
|
19
|
-
--overlay-
|
|
20
|
-
--overlay-
|
|
21
|
-
--overlay-
|
|
22
|
-
--overlay-
|
|
19
|
+
--overlay-padding-inline: auto;
|
|
20
|
+
--overlay-padding-block: auto;
|
|
21
|
+
--overlay-margin-inline: auto;
|
|
22
|
+
--overlay-margin-block: auto;
|
|
23
23
|
|
|
24
24
|
grid-template-areas: 'overlay';
|
|
25
25
|
display: var(--overlay-display);
|
|
26
26
|
place-items: var(--overlay-placement);
|
|
27
27
|
align-items: var(--overlay-placement);
|
|
28
|
-
min-height: var(--overlay-
|
|
29
|
-
width: var(--overlay-
|
|
28
|
+
min-height: var(--overlay-height);
|
|
29
|
+
width: var(--overlay-width);
|
|
30
30
|
color: var(--overlay-color);
|
|
31
31
|
background-color: var(--overlay-bg);
|
|
32
32
|
min-width: 20rem;
|
|
@@ -34,16 +34,16 @@ header,
|
|
|
34
34
|
grid-area: overlay;
|
|
35
35
|
}
|
|
36
36
|
> img {
|
|
37
|
-
width: var(--overlay-
|
|
37
|
+
width: var(--overlay-width);
|
|
38
38
|
// height: auto;
|
|
39
39
|
background-size: contain;
|
|
40
40
|
}
|
|
41
41
|
> div,
|
|
42
42
|
> section {
|
|
43
43
|
--overlay-display: flex;
|
|
44
|
-
max-width: var(--overlay-content-
|
|
44
|
+
max-width: var(--overlay-content-width);
|
|
45
45
|
padding-inline: var(--spc-4);
|
|
46
|
-
margin-inline: var(--overlay-
|
|
46
|
+
margin-inline: var(--overlay-margin-inline);
|
|
47
47
|
gap: var(--overlay-gap);
|
|
48
48
|
text-align: center;
|
|
49
49
|
p {
|
|
@@ -54,7 +54,7 @@ header,
|
|
|
54
54
|
}
|
|
55
55
|
> h1,
|
|
56
56
|
> h2 {
|
|
57
|
-
line-height: var(--header-
|
|
57
|
+
line-height: var(--header-line-height, 1.1);
|
|
58
58
|
font-weight: 500;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
header,
|
|
2
|
+
[data-hero],
|
|
3
|
+
[data-grid~='overlay'] {
|
|
4
|
+
// Name of the grid area
|
|
5
|
+
--overlay-grid-area: overlay;
|
|
6
|
+
// Placement of items in grid area
|
|
7
|
+
--overlay-placement: center;
|
|
8
|
+
// Controls display of grid
|
|
9
|
+
--overlay-display: grid;
|
|
10
|
+
// Overlay padding
|
|
11
|
+
--overlay-padding: 2rem;
|
|
12
|
+
--overlay-w: 100%;
|
|
13
|
+
--overlay-h: 40vh;
|
|
14
|
+
--overlay-max-h: 500px;
|
|
15
|
+
--overlay-color: currentColor;
|
|
16
|
+
--overlay-content-w: 80%;
|
|
17
|
+
--overlay-gap: 2rem;
|
|
18
|
+
--overlay-bg: whitesmoke;
|
|
19
|
+
--overlay-px: auto;
|
|
20
|
+
--overlay-py: auto;
|
|
21
|
+
--overlay-mx: auto;
|
|
22
|
+
--overlay-my: auto;
|
|
23
|
+
|
|
24
|
+
grid-template-areas: 'overlay';
|
|
25
|
+
display: var(--overlay-display);
|
|
26
|
+
place-items: var(--overlay-placement);
|
|
27
|
+
align-items: var(--overlay-placement);
|
|
28
|
+
min-height: var(--overlay-h);
|
|
29
|
+
width: var(--overlay-w);
|
|
30
|
+
color: var(--overlay-color);
|
|
31
|
+
background-color: var(--overlay-bg);
|
|
32
|
+
min-width: 20rem;
|
|
33
|
+
> * {
|
|
34
|
+
grid-area: overlay;
|
|
35
|
+
}
|
|
36
|
+
> img {
|
|
37
|
+
width: var(--overlay-w);
|
|
38
|
+
// height: auto;
|
|
39
|
+
background-size: contain;
|
|
40
|
+
}
|
|
41
|
+
> div,
|
|
42
|
+
> section {
|
|
43
|
+
--overlay-display: flex;
|
|
44
|
+
max-width: var(--overlay-content-w);
|
|
45
|
+
padding-inline: var(--spc-4);
|
|
46
|
+
margin-inline: var(--overlay-mx);
|
|
47
|
+
gap: var(--overlay-gap);
|
|
48
|
+
text-align: center;
|
|
49
|
+
p {
|
|
50
|
+
width: auto;
|
|
51
|
+
max-width: 60ch;
|
|
52
|
+
font-size: var(--fs-8);
|
|
53
|
+
line-height: 1.4;
|
|
54
|
+
}
|
|
55
|
+
> h1,
|
|
56
|
+
> h2 {
|
|
57
|
+
line-height: var(--header-lh, 1.1);
|
|
58
|
+
font-weight: 500;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
> h1 {
|
|
62
|
+
font-size: var(--fs-12);
|
|
63
|
+
}
|
|
64
|
+
> h2 {
|
|
65
|
+
font-size: var(--fs-11);
|
|
66
|
+
}
|
|
67
|
+
> h3 {
|
|
68
|
+
font-size: var(--fs-10);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
main,
|
|
5
5
|
footer {
|
|
6
|
-
--content-
|
|
7
|
-
--content-
|
|
8
|
-
--content-
|
|
6
|
+
--content-width: min(100%, 1480px);
|
|
7
|
+
--content-margin-inline: auto;
|
|
8
|
+
--content-padding-inline: 1rem;
|
|
9
9
|
--content-gap: 2rem;
|
|
10
10
|
padding-block: var(--overlay-padding);
|
|
11
11
|
> section {
|
|
12
|
-
width: var(--content-
|
|
13
|
-
margin-inline: var(--content-
|
|
12
|
+
width: var(--content-width);
|
|
13
|
+
margin-inline: var(--content-margin-inline);
|
|
14
14
|
padding-inline: var(--spc-6);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,8 +20,8 @@ main {
|
|
|
20
20
|
font-size: var(--fs-3);
|
|
21
21
|
> section[aria-label],
|
|
22
22
|
> section {
|
|
23
|
-
width: var(--content-
|
|
24
|
-
margin-inline: var(--content-
|
|
23
|
+
width: var(--content-width);
|
|
24
|
+
margin-inline: var(--content-margin-inline);
|
|
25
25
|
&:has(> article, > aside) {
|
|
26
26
|
display: flex;
|
|
27
27
|
flex-wrap: wrap;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@use './header';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
main,
|
|
5
|
+
footer {
|
|
6
|
+
--content-w: min(100%, 1480px);
|
|
7
|
+
--content-mx: auto;
|
|
8
|
+
--content-px: 1rem;
|
|
9
|
+
--content-gap: 2rem;
|
|
10
|
+
padding-block: var(--overlay-padding);
|
|
11
|
+
> section {
|
|
12
|
+
width: var(--content-w);
|
|
13
|
+
margin-inline: var(--content-mx);
|
|
14
|
+
padding-inline: var(--spc-6);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
main {
|
|
19
|
+
flex: 1;
|
|
20
|
+
font-size: var(--fs-3);
|
|
21
|
+
> section[aria-label],
|
|
22
|
+
> section {
|
|
23
|
+
width: var(--content-w);
|
|
24
|
+
margin-inline: var(--content-mx);
|
|
25
|
+
&:has(> article, > aside) {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
flex: 1;
|
|
29
|
+
gap: var(--content-gap);
|
|
30
|
+
> article {
|
|
31
|
+
flex-basis: 0;
|
|
32
|
+
flex-grow: 999;
|
|
33
|
+
min-inline-size: 50%;
|
|
34
|
+
}
|
|
35
|
+
> aside {
|
|
36
|
+
flex-basis: 20rem;
|
|
37
|
+
flex-grow: 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
footer {
|
|
44
|
+
> div {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
min-height: 5rem;
|
|
49
|
+
text-align: center;
|
|
50
|
+
}
|
|
51
|
+
}
|