@fpkit/acss 3.6.0 → 3.7.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.
Files changed (49) hide show
  1. package/libs/{chunk-URBGDUFN.cjs → chunk-75YQDONV.cjs} +3 -3
  2. package/libs/chunk-AOFQDQVS.cjs +17 -0
  3. package/libs/chunk-AOFQDQVS.cjs.map +1 -0
  4. package/libs/{chunk-ZF6Y7W57.js → chunk-G3TFKMWB.js} +2 -2
  5. package/libs/chunk-Q7OAQLUT.js +10 -0
  6. package/libs/chunk-Q7OAQLUT.js.map +1 -0
  7. package/libs/components/dialog/dialog.cjs +4 -4
  8. package/libs/components/dialog/dialog.js +2 -2
  9. package/libs/components/heading/heading.cjs +2 -2
  10. package/libs/components/heading/heading.d.cts +1 -1
  11. package/libs/components/heading/heading.d.ts +1 -1
  12. package/libs/components/heading/heading.js +1 -1
  13. package/libs/components/title/title.css +1 -0
  14. package/libs/components/title/title.css.map +1 -0
  15. package/libs/components/title/title.min.css +3 -0
  16. package/libs/{heading-7446cb46.d.ts → heading-81eef89a.d.ts} +42 -0
  17. package/libs/index.cjs +5 -5
  18. package/libs/index.css +1 -1
  19. package/libs/index.css.map +1 -1
  20. package/libs/index.d.cts +1 -1
  21. package/libs/index.d.ts +1 -1
  22. package/libs/index.js +2 -2
  23. package/package.json +2 -2
  24. package/src/components/box/box.stories.tsx +1 -1
  25. package/src/components/cluster/cluster.stories.tsx +1 -1
  26. package/src/components/col/README.mdx +233 -9
  27. package/src/components/col/STYLES.mdx +1380 -0
  28. package/src/components/col/col.stories.tsx +1 -1
  29. package/src/components/grid/grid.stories.tsx +130 -35
  30. package/src/components/row/row.stories.tsx +1 -1
  31. package/src/components/stack/stack.stories.tsx +219 -60
  32. package/src/components/title/README.mdx +87 -1
  33. package/src/components/title/STYLES.mdx +501 -0
  34. package/src/components/title/title.scss +51 -0
  35. package/src/components/title/title.stories.tsx +158 -0
  36. package/src/components/title/title.test.tsx +113 -0
  37. package/src/components/title/title.tsx +53 -1
  38. package/src/index.scss +1 -0
  39. package/src/sass/columns.stories.tsx +434 -10
  40. package/src/styles/index.css +74 -0
  41. package/src/styles/index.css.map +1 -1
  42. package/src/styles/title/title.css +75 -0
  43. package/src/styles/title/title.css.map +1 -0
  44. package/libs/chunk-2C3YLBWP.cjs +0 -17
  45. package/libs/chunk-2C3YLBWP.cjs.map +0 -1
  46. package/libs/chunk-KDMX3FAW.js +0 -10
  47. package/libs/chunk-KDMX3FAW.js.map +0 -1
  48. /package/libs/{chunk-URBGDUFN.cjs.map → chunk-75YQDONV.cjs.map} +0 -0
  49. /package/libs/{chunk-ZF6Y7W57.js.map → chunk-G3TFKMWB.js.map} +0 -0
@@ -0,0 +1,501 @@
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
+ import * as TitleStories from './title.stories';
3
+
4
+ <Meta of={TitleStories} title="FP.REACT Components/Title/Styles" />
5
+
6
+ # Title Component Styles
7
+
8
+ Comprehensive CSS custom properties documentation for the Title component.
9
+
10
+ ---
11
+
12
+ ## Overview
13
+
14
+ The Title component uses **CSS custom properties (CSS variables)** for flexible, reactive styling. This approach allows you to:
15
+
16
+ - Override styles without modifying the component source
17
+ - Create theme variations using CSS
18
+ - Maintain consistent sizing with rem units
19
+ - Ensure WCAG AA contrast compliance with predefined color variants
20
+
21
+ ---
22
+
23
+ ## CSS Custom Properties
24
+
25
+ ### Base Properties
26
+
27
+ These properties control the fundamental styling of all Title components:
28
+
29
+ ```css
30
+ [data-title] {
31
+ --title-fs: inherit; /* Font size */
32
+ --title-fw: 600; /* Font weight */
33
+ --title-lh: 1.2; /* Line height */
34
+ --title-margin-block-end: 0.5em; /* Bottom margin */
35
+ --title-color: inherit; /* Text color */
36
+ }
37
+ ```
38
+
39
+ | Property | Default | Description |
40
+ |----------|---------|-------------|
41
+ | `--title-fs` | `inherit` | Font size (overridden by size variants) |
42
+ | `--title-fw` | `600` | Font weight (semi-bold) |
43
+ | `--title-lh` | `1.2` | Line height for optimal readability |
44
+ | `--title-margin-block-end` | `0.5em` | Bottom margin using logical properties |
45
+ | `--title-color` | `inherit` | Text color (overridden by color variants) |
46
+
47
+ ---
48
+
49
+ ## Size Tokens
50
+
51
+ The Title component provides six size variants using predefined tokens:
52
+
53
+ ```css
54
+ :root {
55
+ --title-size-xs: 0.75rem; /* 12px */
56
+ --title-size-sm: 0.875rem; /* 14px */
57
+ --title-size-md: 1rem; /* 16px */
58
+ --title-size-lg: 1.5rem; /* 24px */
59
+ --title-size-xl: 2rem; /* 32px */
60
+ --title-size-2xl: 2.5rem; /* 40px */
61
+ }
62
+ ```
63
+
64
+ ### Size Variant Usage
65
+
66
+ Size variants are applied via the `data-title` attribute:
67
+
68
+ ```tsx
69
+ <Title size="xs">Extra Small (12px)</Title>
70
+ <Title size="sm">Small (14px)</Title>
71
+ <Title size="md">Medium (16px)</Title>
72
+ <Title size="lg">Large (24px)</Title>
73
+ <Title size="xl">Extra Large (32px)</Title>
74
+ <Title size="2xl">2X Large (40px)</Title>
75
+ ```
76
+
77
+ **CSS Implementation:**
78
+
79
+ ```css
80
+ [data-title~="xs"] { --title-fs: var(--title-size-xs); }
81
+ [data-title~="sm"] { --title-fs: var(--title-size-sm); }
82
+ [data-title~="md"] { --title-fs: var(--title-size-md); }
83
+ [data-title~="lg"] { --title-fs: var(--title-size-lg); }
84
+ [data-title~="xl"] { --title-fs: var(--title-size-xl); }
85
+ [data-title~="2xl"] { --title-fs: var(--title-size-2xl); }
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Color Variants
91
+
92
+ All color variants meet **WCAG 2.1 Level AA contrast requirements** (4.5:1 minimum on white background).
93
+
94
+ ```css
95
+ [data-title~="primary"] { --title-color: #1e3a8a; } /* 8.59:1 */
96
+ [data-title~="secondary"] { --title-color: #4b5563; } /* 7.56:1 */
97
+ [data-title~="accent"] { --title-color: #7c3aed; } /* 4.62:1 */
98
+ [data-title~="muted"] { --title-color: #6b7280; } /* 5.49:1 */
99
+ [data-title~="inherit"] { --title-color: inherit; }
100
+ ```
101
+
102
+ ### Color Variant Details
103
+
104
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '1rem', margin: '1.5rem 0' }}>
105
+ <div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
106
+ <div style={{ fontSize: '1.25rem', fontWeight: 600, color: '#1e3a8a', marginBottom: '0.5rem' }}>Primary</div>
107
+ <code style={{ fontSize: '0.75rem', display: 'block', marginBottom: '0.25rem' }}>#1e3a8a</code>
108
+ <div style={{ fontSize: '0.875rem', color: '#666' }}>Contrast: 8.59:1</div>
109
+ </div>
110
+ <div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
111
+ <div style={{ fontSize: '1.25rem', fontWeight: 600, color: '#4b5563', marginBottom: '0.5rem' }}>Secondary</div>
112
+ <code style={{ fontSize: '0.75rem', display: 'block', marginBottom: '0.25rem' }}>#4b5563</code>
113
+ <div style={{ fontSize: '0.875rem', color: '#666' }}>Contrast: 7.56:1</div>
114
+ </div>
115
+ <div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
116
+ <div style={{ fontSize: '1.25rem', fontWeight: 600, color: '#7c3aed', marginBottom: '0.5rem' }}>Accent</div>
117
+ <code style={{ fontSize: '0.75rem', display: 'block', marginBottom: '0.25rem' }}>#7c3aed</code>
118
+ <div style={{ fontSize: '0.875rem', color: '#666' }}>Contrast: 4.62:1</div>
119
+ </div>
120
+ <div style={{ padding: '1rem', border: '1px solid #e0e0e0', borderRadius: '0.5rem' }}>
121
+ <div style={{ fontSize: '1.25rem', fontWeight: 600, color: '#6b7280', marginBottom: '0.5rem' }}>Muted</div>
122
+ <code style={{ fontSize: '0.75rem', display: 'block', marginBottom: '0.25rem' }}>#6b7280</code>
123
+ <div style={{ fontSize: '0.875rem', color: '#666' }}>Contrast: 5.49:1</div>
124
+ </div>
125
+ </div>
126
+
127
+ ---
128
+
129
+ ## Focus Indicator
130
+
131
+ The Title component includes a focus indicator for keyboard navigation:
132
+
133
+ ```css
134
+ [data-title]:focus-visible {
135
+ outline: 2px solid currentColor;
136
+ outline-offset: 2px;
137
+ }
138
+ ```
139
+
140
+ This ensures that when a Title element receives keyboard focus (e.g., when using `tabIndex={-1}` for programmatic focus), a visible outline appears.
141
+
142
+ ---
143
+
144
+ ## Customization
145
+
146
+ ### Method 1: Override via Inline Styles
147
+
148
+ Override CSS custom properties using the `styles` prop:
149
+
150
+ ```tsx
151
+ <Title
152
+ level="h2"
153
+ size="lg"
154
+ styles={{
155
+ '--title-fs': '3rem',
156
+ '--title-color': '#10b981',
157
+ '--title-fw': '700',
158
+ }}
159
+ >
160
+ Custom Overridden Title
161
+ </Title>
162
+ ```
163
+
164
+ **Result:**
165
+ - Font size: 3rem (48px) - overrides the `lg` size
166
+ - Color: #10b981 (emerald green)
167
+ - Font weight: 700 (bold)
168
+
169
+ ### Method 2: Global CSS Override
170
+
171
+ Create global styles to customize all Title components:
172
+
173
+ ```css
174
+ /* Override all titles */
175
+ [data-title] {
176
+ --title-fw: 700;
177
+ --title-lh: 1.4;
178
+ --title-margin-block-end: 1rem;
179
+ }
180
+
181
+ /* Override specific size */
182
+ [data-title~="xl"] {
183
+ --title-fs: 2.5rem; /* Increase xl from 2rem to 2.5rem */
184
+ }
185
+
186
+ /* Override specific color */
187
+ [data-title~="primary"] {
188
+ --title-color: #0066cc; /* Custom brand blue */
189
+ }
190
+ ```
191
+
192
+ ### Method 3: Scoped CSS Override
193
+
194
+ Override Title properties within a specific container:
195
+
196
+ ```css
197
+ /* Only affect titles inside .dark-theme */
198
+ .dark-theme [data-title] {
199
+ --title-color: #f0f0f0;
200
+ }
201
+
202
+ .dark-theme [data-title~="primary"] {
203
+ --title-color: #60a5fa; /* Lighter blue for dark backgrounds */
204
+ }
205
+
206
+ /* Only affect titles inside .card */
207
+ .card [data-title] {
208
+ --title-margin-block-end: 0.25rem;
209
+ --title-fw: 700;
210
+ }
211
+ ```
212
+
213
+ ### Method 4: Creating Custom Variants
214
+
215
+ Extend the component with custom data attributes:
216
+
217
+ ```tsx
218
+ <Title
219
+ level="h2"
220
+ data-variant="hero"
221
+ className="custom-title"
222
+ >
223
+ Hero Title
224
+ </Title>
225
+ ```
226
+
227
+ **Custom CSS:**
228
+
229
+ ```css
230
+ [data-variant="hero"] {
231
+ --title-fs: 4rem;
232
+ --title-fw: 800;
233
+ --title-color: linear-gradient(to right, #0066cc, #7c3aed);
234
+ background: var(--title-color);
235
+ -webkit-background-clip: text;
236
+ -webkit-text-fill-color: transparent;
237
+ background-clip: text;
238
+ }
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Theming
244
+
245
+ ### Example: Dark Theme
246
+
247
+ Create a dark theme by overriding color variants:
248
+
249
+ ```css
250
+ [data-theme="dark"] {
251
+ /* Override base title color */
252
+ [data-title] {
253
+ --title-color: #f9fafb;
254
+ }
255
+
256
+ /* Override color variants for dark backgrounds */
257
+ [data-title~="primary"] {
258
+ --title-color: #60a5fa; /* Light blue */
259
+ }
260
+
261
+ [data-title~="secondary"] {
262
+ --title-color: #9ca3af; /* Light gray */
263
+ }
264
+
265
+ [data-title~="accent"] {
266
+ --title-color: #a78bfa; /* Light purple */
267
+ }
268
+
269
+ [data-title~="muted"] {
270
+ --title-color: #6b7280; /* Medium gray */
271
+ }
272
+ }
273
+ ```
274
+
275
+ **Usage:**
276
+
277
+ ```tsx
278
+ <div data-theme="dark">
279
+ <Title level="h1" size="2xl" color="primary">
280
+ Dark Theme Title
281
+ </Title>
282
+ </div>
283
+ ```
284
+
285
+ ### Example: Brand Theme
286
+
287
+ Create a custom brand theme with your company colors:
288
+
289
+ ```css
290
+ :root {
291
+ /* Brand color tokens */
292
+ --brand-primary: #ff6b35;
293
+ --brand-secondary: #004e89;
294
+ --brand-accent: #f7b801;
295
+ }
296
+
297
+ /* Apply brand colors to title variants */
298
+ [data-title~="primary"] {
299
+ --title-color: var(--brand-primary);
300
+ }
301
+
302
+ [data-title~="secondary"] {
303
+ --title-color: var(--brand-secondary);
304
+ }
305
+
306
+ [data-title~="accent"] {
307
+ --title-color: var(--brand-accent);
308
+ }
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Responsive Typography
314
+
315
+ Use CSS media queries to create responsive sizing:
316
+
317
+ ```css
318
+ /* Mobile: smaller sizes */
319
+ @media (max-width: 768px) {
320
+ :root {
321
+ --title-size-2xl: 2rem; /* 32px instead of 40px */
322
+ --title-size-xl: 1.75rem; /* 28px instead of 32px */
323
+ --title-size-lg: 1.25rem; /* 20px instead of 24px */
324
+ }
325
+ }
326
+
327
+ /* Desktop: larger sizes */
328
+ @media (min-width: 1280px) {
329
+ :root {
330
+ --title-size-2xl: 3rem; /* 48px instead of 40px */
331
+ --title-size-xl: 2.5rem; /* 40px instead of 32px */
332
+ }
333
+ }
334
+ ```
335
+
336
+ ---
337
+
338
+ ## Best Practices
339
+
340
+ ### ✅ DO: Use rem Units
341
+
342
+ All size values use rem units for accessibility and scalability:
343
+
344
+ ```css
345
+ /* ✅ GOOD */
346
+ --title-fs: 1.5rem;
347
+
348
+ /* ❌ BAD */
349
+ --title-fs: 24px;
350
+ ```
351
+
352
+ **Why?** Users can adjust their browser's base font size, and rem values scale accordingly.
353
+
354
+ ### ✅ DO: Maintain Contrast Ratios
355
+
356
+ When creating custom colors, ensure WCAG AA compliance (4.5:1 minimum):
357
+
358
+ ```css
359
+ /* ✅ GOOD: High contrast */
360
+ --title-color: #1e3a8a; /* 8.59:1 on white */
361
+
362
+ /* ❌ BAD: Low contrast */
363
+ --title-color: #cbd5e1; /* Only 2.1:1 on white - fails WCAG AA */
364
+ ```
365
+
366
+ **Tools:**
367
+ - [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
368
+ - [Accessible Colors](https://accessible-colors.com/)
369
+
370
+ ### ✅ DO: Use Logical Properties
371
+
372
+ Prefer logical properties for better internationalization:
373
+
374
+ ```css
375
+ /* ✅ GOOD: Works with RTL languages */
376
+ --title-margin-block-end: 0.5em;
377
+
378
+ /* ❌ BAD: Fixed to LTR layout */
379
+ --title-margin-bottom: 0.5em;
380
+ ```
381
+
382
+ ### ✅ DO: Test Across Viewports
383
+
384
+ Test custom sizing across different screen sizes:
385
+
386
+ ```tsx
387
+ {/* Desktop */}
388
+ <Title size="2xl" color="primary">Hero Title</Title>
389
+
390
+ {/* Mobile */}
391
+ <Title size="xl" color="primary">Hero Title</Title>
392
+ ```
393
+
394
+ ---
395
+
396
+ ## CSS Architecture
397
+
398
+ The Title component follows fpkit's CSS architecture:
399
+
400
+ 1. **Global tokens** (`:root`) - Reusable size values
401
+ 2. **Component properties** (`[data-title]`) - Base styling
402
+ 3. **Variant selectors** (`[data-title~="..."]`) - Size and color variants
403
+ 4. **State selectors** (`:focus-visible`) - Interactive states
404
+
405
+ **File Location:**
406
+ ```
407
+ packages/fpkit/src/components/title/title.scss
408
+ ```
409
+
410
+ **Compiled Output:**
411
+ ```
412
+ packages/fpkit/libs/components/title/title.css
413
+ packages/fpkit/libs/index.css (included in main bundle)
414
+ ```
415
+
416
+ ---
417
+
418
+ ## Import Styles
419
+
420
+ ### Option 1: Import Main Bundle
421
+
422
+ ```tsx
423
+ import '@fpkit/acss/styles';
424
+ ```
425
+
426
+ This imports all fpkit styles including Title.
427
+
428
+ ### Option 2: Import Component Styles Only
429
+
430
+ ```tsx
431
+ import '@fpkit/acss/css/title/title.css';
432
+ ```
433
+
434
+ This imports only the Title component styles.
435
+
436
+ ### Option 3: Import SCSS Source
437
+
438
+ ```scss
439
+ @use '@fpkit/acss/scss/components/title/title.scss';
440
+ ```
441
+
442
+ Import the SCSS source for customization before compilation.
443
+
444
+ ---
445
+
446
+ ## Related Documentation
447
+
448
+ - **[Title Component Readme](?path=/docs/fp-react-components-title-readme--docs)** - Component usage and API
449
+ - **[CSS Variable Reference Guide](/docs/css-variables.md)** - fpkit CSS variable naming standards
450
+ - **[WCAG 2.1 Color Contrast](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html)** - Understanding contrast requirements
451
+
452
+ ---
453
+
454
+ ## Quick Reference
455
+
456
+ ### All CSS Custom Properties
457
+
458
+ ```css
459
+ /* Size tokens */
460
+ --title-size-xs: 0.75rem;
461
+ --title-size-sm: 0.875rem;
462
+ --title-size-md: 1rem;
463
+ --title-size-lg: 1.5rem;
464
+ --title-size-xl: 2rem;
465
+ --title-size-2xl: 2.5rem;
466
+
467
+ /* Base properties */
468
+ --title-fs: inherit;
469
+ --title-fw: 600;
470
+ --title-lh: 1.2;
471
+ --title-margin-block-end: 0.5em;
472
+ --title-color: inherit;
473
+ ```
474
+
475
+ ### All Data Attributes
476
+
477
+ ```html
478
+ <!-- Size variants -->
479
+ <Title size="xs">...</Title>
480
+ <Title size="sm">...</Title>
481
+ <Title size="md">...</Title>
482
+ <Title size="lg">...</Title>
483
+ <Title size="xl">...</Title>
484
+ <Title size="2xl">...</Title>
485
+
486
+ <!-- Color variants -->
487
+ <Title color="primary">...</Title>
488
+ <Title color="secondary">...</Title>
489
+ <Title color="accent">...</Title>
490
+ <Title color="muted">...</Title>
491
+ <Title color="inherit">...</Title>
492
+
493
+ <!-- Combined -->
494
+ <Title size="xl" color="primary">...</Title>
495
+ ```
496
+
497
+ ---
498
+
499
+ <div style={{ padding: '1rem', background: '#f0f9ff', border: '1px solid #0ea5e9', borderRadius: '0.5rem', marginTop: '2rem' }}>
500
+ <strong>💡 Pro Tip:</strong> Use browser DevTools to inspect the computed CSS custom properties in real-time. Right-click a Title element, select "Inspect", and view the "Computed" tab to see all active CSS variables.
501
+ </div>
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Title Component Styles
3
+ * Size and color variants using CSS custom properties
4
+ */
5
+
6
+ :root {
7
+ /* Size tokens (rem only) */
8
+ --title-size-xs: 0.75rem; /* 12px */
9
+ --title-size-sm: 0.875rem; /* 14px */
10
+ --title-size-md: 1rem; /* 16px */
11
+ --title-size-lg: 1.5rem; /* 24px */
12
+ --title-size-xl: 2rem; /* 32px */
13
+ --title-size-2xl: 2.5rem; /* 40px */
14
+ }
15
+
16
+ [data-title] {
17
+ /* Base properties */
18
+ --title-fs: inherit;
19
+ --title-fw: 600;
20
+ --title-lh: 1.2;
21
+ --title-margin-block-end: 0.5em;
22
+ --title-color: inherit;
23
+
24
+ /* Apply properties */
25
+ font-size: var(--title-fs);
26
+ font-weight: var(--title-fw);
27
+ line-height: var(--title-lh);
28
+ margin-block-end: var(--title-margin-block-end);
29
+ color: var(--title-color);
30
+
31
+ /* Size variants */
32
+ &[data-title~="xs"] { --title-fs: var(--title-size-xs); }
33
+ &[data-title~="sm"] { --title-fs: var(--title-size-sm); }
34
+ &[data-title~="md"] { --title-fs: var(--title-size-md); }
35
+ &[data-title~="lg"] { --title-fs: var(--title-size-lg); }
36
+ &[data-title~="xl"] { --title-fs: var(--title-size-xl); }
37
+ &[data-title~="2xl"] { --title-fs: var(--title-size-2xl); }
38
+
39
+ /* Color variants - WCAG AA compliant (4.5:1 minimum) */
40
+ &[data-title~="primary"] { --title-color: #1e3a8a; } /* 8.59:1 */
41
+ &[data-title~="secondary"] { --title-color: #4b5563; } /* 7.56:1 */
42
+ &[data-title~="accent"] { --title-color: #7c3aed; } /* 4.62:1 */
43
+ &[data-title~="muted"] { --title-color: #6b7280; } /* 5.49:1 */
44
+ &[data-title~="inherit"] { --title-color: inherit; }
45
+ }
46
+
47
+ /* Focus indicator */
48
+ [data-title]:focus-visible {
49
+ outline: 2px solid currentColor;
50
+ outline-offset: 2px;
51
+ }