@fpkit/acss 3.3.0 → 3.4.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 (51) hide show
  1. package/libs/components/alert/alert.min.min.css +2 -0
  2. package/libs/components/badge/badge.min.min.css +2 -0
  3. package/libs/components/box/box.min.min.css +2 -0
  4. package/libs/components/breadcrumbs/breadcrumb.min.min.css +2 -0
  5. package/libs/components/buttons/button.min.min.css +2 -0
  6. package/libs/components/cards/card-style.min.min.css +2 -0
  7. package/libs/components/cards/card.min.min.css +2 -0
  8. package/libs/components/cluster/cluster.min.min.css +2 -0
  9. package/libs/components/details/details.min.min.css +2 -0
  10. package/libs/components/dialog/dialog.min.min.css +2 -0
  11. package/libs/components/flexbox/flex.min.min.css +2 -0
  12. package/libs/components/form/form.min.min.css +2 -0
  13. package/libs/components/grid/grid.min.min.css +2 -0
  14. package/libs/components/icons/icon.min.min.css +2 -0
  15. package/libs/components/images/img.min.min.css +2 -0
  16. package/libs/components/layout/landmarks.min.min.css +2 -0
  17. package/libs/components/link/link.min.min.css +2 -0
  18. package/libs/components/list/list.min.min.css +2 -0
  19. package/libs/components/nav/nav.min.min.css +2 -0
  20. package/libs/components/progress/progress.min.min.css +2 -0
  21. package/libs/components/stack/stack.min.min.css +2 -0
  22. package/libs/components/styles/index.min.min.css +2 -0
  23. package/libs/components/tag/tag.min.min.css +2 -0
  24. package/libs/components/text-to-speech/text-to-speech.min.min.css +2 -0
  25. package/libs/index.cjs +22 -20
  26. package/libs/index.cjs.map +1 -1
  27. package/libs/index.css +1 -1
  28. package/libs/index.css.map +1 -1
  29. package/libs/index.d.cts +275 -1
  30. package/libs/index.d.ts +275 -1
  31. package/libs/index.js +9 -9
  32. package/libs/index.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/components/col/README.mdx +532 -0
  35. package/src/components/col/col.stories.tsx +424 -0
  36. package/src/components/col/col.test.tsx +321 -0
  37. package/src/components/col/col.tsx +105 -0
  38. package/src/components/col/col.types.ts +76 -0
  39. package/src/components/row/README.mdx +324 -0
  40. package/src/components/row/row.stories.tsx +595 -0
  41. package/src/components/row/row.test.tsx +358 -0
  42. package/src/components/row/row.tsx +121 -0
  43. package/src/components/row/row.types.ts +93 -0
  44. package/src/index.scss +1 -0
  45. package/src/index.ts +2 -0
  46. package/src/sass/README.mdx +597 -0
  47. package/src/sass/_columns.scss +198 -0
  48. package/src/sass/columns.stories.tsx +456 -0
  49. package/src/styles/index.css +340 -0
  50. package/src/styles/index.css.map +1 -1
  51. package/src/types/layout-primitives.ts +61 -0
@@ -0,0 +1,597 @@
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
+
3
+ <Meta title="FP.React Components/Utilities/Columns/Documentation" />
4
+
5
+ # 12-Column Utility System
6
+
7
+ A Bootstrap/Foundation-compatible 12-column utility class system for creating
8
+ flexible, responsive layouts using Flexbox.
9
+
10
+ ## Overview
11
+
12
+ The column utility system provides `.col-1` through `.col-12` classes that work
13
+ with Flexbox containers, using percentage-based widths that automatically switch
14
+ to 100% width on mobile screens.
15
+
16
+ ### Key Features
17
+
18
+ - ✅ **12-column grid system** - `.col-1` (8.333%) through `.col-12` (100%)
19
+ - ✅ **Mobile-first responsive** - 100% width on mobile (< 768px), percentage
20
+ widths on desktop
21
+ - ✅ **Flexbox-only** - Works with Flex component or `.col-row` utility (NOT
22
+ with Grid component)
23
+ - ✅ **CSS custom properties** - Customizable breakpoints and column widths
24
+ - ✅ **Optional utilities** - Offsets, auto-width, and visual ordering
25
+ - ✅ **Accessibility-friendly** - Uses logical properties for RTL support
26
+
27
+ ## Quick Start
28
+
29
+ ### Option 1: Using `.col-row` Utility (Recommended for Simple Layouts)
30
+
31
+ ```jsx
32
+ <div className="col-row">
33
+ <div className="col-6">Left Half</div>
34
+ <div className="col-6">Right Half</div>
35
+ </div>
36
+ ```
37
+
38
+ ### Option 2: Using Flex Component (Recommended for Complex Layouts)
39
+
40
+ ```jsx
41
+ import { Flex } from "@fpkit/acss";
42
+
43
+ <Flex wrap="wrap" gap="md">
44
+ <div className="col-6">Left Half</div>
45
+ <div className="col-6">Right Half</div>
46
+ </Flex>;
47
+ ```
48
+
49
+ ### Option 3: Custom Flex Container
50
+
51
+ ```jsx
52
+ <div style={{ display: "flex", flexWrap: "wrap", gap: "1rem" }}>
53
+ <div className="col-6">Left Half</div>
54
+ <div className="col-6">Right Half</div>
55
+ </div>
56
+ ```
57
+
58
+ ## Column Classes Reference
59
+
60
+ | Class | Width (Desktop) | Width (Mobile) | Use Case |
61
+ | --------- | --------------- | -------------- | ------------------------------------- |
62
+ | `.col-1` | 8.333% | 100% | Narrow sidebar, icons |
63
+ | `.col-2` | 16.667% | 100% | Small widgets |
64
+ | `.col-3` | 25% | 100% | Quarter width, 4-column layouts |
65
+ | `.col-4` | 33.333% | 100% | Third width, 3-column layouts |
66
+ | `.col-5` | 41.667% | 100% | Asymmetric layouts |
67
+ | `.col-6` | 50% | 100% | Half width, 2-column layouts |
68
+ | `.col-7` | 58.333% | 100% | Asymmetric layouts |
69
+ | `.col-8` | 66.667% | 100% | Two-thirds width, main content |
70
+ | `.col-9` | 75% | 100% | Three-quarters width, primary content |
71
+ | `.col-10` | 83.333% | 100% | Wide content area |
72
+ | `.col-11` | 91.667% | 100% | Almost full width |
73
+ | `.col-12` | 100% | 100% | Full width |
74
+
75
+ ## Common Layout Patterns
76
+
77
+ ### Two-Column Layout (50/50)
78
+
79
+ ```jsx
80
+ <div className="col-row">
81
+ <div className="col-6">Left Column</div>
82
+ <div className="col-6">Right Column</div>
83
+ </div>
84
+ ```
85
+
86
+ ### Three-Column Layout (Equal Widths)
87
+
88
+ ```jsx
89
+ <div className="col-row">
90
+ <div className="col-4">Column 1</div>
91
+ <div className="col-4">Column 2</div>
92
+ <div className="col-4">Column 3</div>
93
+ </div>
94
+ ```
95
+
96
+ ### Four-Column Layout (Equal Widths)
97
+
98
+ ```jsx
99
+ <div className="col-row">
100
+ <div className="col-3">Column 1</div>
101
+ <div className="col-3">Column 2</div>
102
+ <div className="col-3">Column 3</div>
103
+ <div className="col-3">Column 4</div>
104
+ </div>
105
+ ```
106
+
107
+ ### Sidebar Layout (Narrow + Wide)
108
+
109
+ ```jsx
110
+ <div className="col-row">
111
+ <div className="col-3">Sidebar</div>
112
+ <div className="col-9">Main Content</div>
113
+ </div>
114
+ ```
115
+
116
+ ### Dashboard Layout (Asymmetric)
117
+
118
+ ```jsx
119
+ <div className="col-row">
120
+ <div className="col-8">Primary Content</div>
121
+ <div className="col-4">Secondary Content</div>
122
+ </div>
123
+ ```
124
+
125
+ ### Mixed Widths with Auto-Wrapping
126
+
127
+ ```jsx
128
+ <div className="col-row">
129
+ <div className="col-8">Wide Section</div>
130
+ <div className="col-4">Narrow Section</div>
131
+ <div className="col-6">Half Width</div>
132
+ <div className="col-6">Half Width</div>
133
+ <div className="col-12">Full Width Footer</div>
134
+ </div>
135
+ ```
136
+
137
+ ## Optional Utilities
138
+
139
+ ### Column Offsets
140
+
141
+ Push columns to the right using margin-inline-start:
142
+
143
+ ```jsx
144
+ {
145
+ /* Center a 6-column element */
146
+ }
147
+ <div className="col-row">
148
+ <div className="col-6 col-offset-3">Centered Content</div>
149
+ </div>;
150
+
151
+ {
152
+ /* Create asymmetric spacing */
153
+ }
154
+ <div className="col-row">
155
+ <div className="col-4 col-offset-2">Offset Left by 2 columns</div>
156
+ <div className="col-4 col-offset-1">Offset Left by 1 column</div>
157
+ </div>;
158
+ ```
159
+
160
+ **Available offset classes:** `.col-offset-0` through `.col-offset-11`
161
+
162
+ ### Auto-Width Columns
163
+
164
+ Columns that size based on content:
165
+
166
+ ```jsx
167
+ <div className="col-row">
168
+ <div className="col-auto">Auto-sized Button</div>
169
+ <div className="col-6">Fixed Half-Width</div>
170
+ <div className="col-auto">Auto-sized Label</div>
171
+ </div>
172
+ ```
173
+
174
+ ### Column Ordering
175
+
176
+ Visually reorder columns without changing HTML structure:
177
+
178
+ ```jsx
179
+ <div className="col-row">
180
+ <div className="col-4 col-order-2">Appears Second</div>
181
+ <div className="col-4 col-order-first">Appears First</div>
182
+ <div className="col-4 col-order-last">Appears Last</div>
183
+ </div>
184
+ ```
185
+
186
+ **Available order classes:**
187
+
188
+ - `.col-order-first` (order: -1)
189
+ - `.col-order-last` (order: 13)
190
+ - `.col-order-0` through `.col-order-12`
191
+
192
+ ## Container Patterns
193
+
194
+ ### `.col-row` Utility
195
+
196
+ The `.col-row` utility provides a convenient Bootstrap-like container:
197
+
198
+ ```jsx
199
+ <div className="col-row">
200
+ <div className="col-6">Column</div>
201
+ </div>
202
+ ```
203
+
204
+ **Properties:**
205
+
206
+ - `display: flex`
207
+ - `flex-wrap: wrap`
208
+ - `gap: var(--spacing-md)` (default gap, customizable)
209
+
210
+ **Benefits:**
211
+
212
+ - ✅ Familiar to Bootstrap/Foundation users
213
+ - ✅ Single class creates proper flex container
214
+ - ✅ Works with existing gap utilities
215
+ - ✅ No React required (pure CSS)
216
+
217
+ **Customizing gap:**
218
+
219
+ ```jsx
220
+ {
221
+ /* Override gap with inline style */
222
+ }
223
+ <div className="col-row" style={{ gap: "2rem" }}>
224
+ <div className="col-4">Column</div>
225
+ </div>;
226
+
227
+ {
228
+ /* Or use gap utility classes (if available) */
229
+ }
230
+ <div className="col-row gap-lg">
231
+ <div className="col-4">Column</div>
232
+ </div>;
233
+ ```
234
+
235
+ ### When to Use Each Container
236
+
237
+ | Container | Best For | Pros | Cons |
238
+ | --------------- | ----------------------------------- | ------------------------------------ | --------------------------------- |
239
+ | `.col-row` | Simple HTML layouts, Bootstrap-like | Familiar, concise, default gap | Less flexible than Flex component |
240
+ | `<Flex>` | React apps, complex layouts | Responsive props, alignment controls | Requires React, more verbose |
241
+ | Inline styles | One-off layouts, prototyping | Full control | Not reusable |
242
+ | Utility classes | Custom containers | Flexible, reusable | Requires utility class system |
243
+
244
+ ## Spacing and Gutters
245
+
246
+ **Unlike Bootstrap**, these column utilities do NOT have built-in gutters.
247
+ Instead, use the `gap` property on the container:
248
+
249
+ ```jsx
250
+ {
251
+ /* ✅ CORRECT: Use gap on container */
252
+ }
253
+ <div className="col-row">
254
+ <div className="col-6">Proper spacing via gap</div>
255
+ <div className="col-6">Proper spacing via gap</div>
256
+ </div>;
257
+
258
+ {
259
+ /* ❌ WRONG: Don't add padding to columns */
260
+ }
261
+ <div className="col-row">
262
+ <div className="col-6" style={{ padding: "0.5rem" }}>
263
+ Breaks the 12-column math!
264
+ </div>
265
+ </div>;
266
+ ```
267
+
268
+ **Available gap values** (when using fpkit gap utilities):
269
+
270
+ - `gap-0` - No gap
271
+ - `gap-xs` - Extra small (0.25-0.5rem)
272
+ - `gap-sm` - Small (0.5-0.75rem)
273
+ - `gap-md` - Medium (0.75-1.125rem) ← Recommended default
274
+ - `gap-lg` - Large (1-1.5rem)
275
+ - `gap-xl` - Extra large (1.5-2rem)
276
+
277
+ ## Responsive Behavior
278
+
279
+ Columns automatically adapt to screen size using a mobile-first approach:
280
+
281
+ ### Mobile (< 768px / 48rem)
282
+
283
+ - All columns are **100% width**
284
+ - Columns stack vertically
285
+ - Perfect for small screens
286
+
287
+ ### Desktop (≥ 768px / 48rem)
288
+
289
+ - Columns use **percentage widths**
290
+ - Columns display side-by-side
291
+ - Creates multi-column layouts
292
+
293
+ **Example:**
294
+
295
+ ```jsx
296
+ <div className="col-row">
297
+ <div className="col-4">Card 1</div>
298
+ <div className="col-4">Card 2</div>
299
+ <div className="col-4">Card 3</div>
300
+ </div>
301
+ ```
302
+
303
+ **On mobile:** Cards stack (100% width each) **On desktop:** Cards display
304
+ side-by-side (33.33% width each)
305
+
306
+ ## Important Considerations
307
+
308
+ ### ⚠️ Requires Flex Container
309
+
310
+ Column utilities **require a flex container** to work correctly:
311
+
312
+ ```jsx
313
+ {
314
+ /* ❌ WRONG: No flex container */
315
+ }
316
+ <div>
317
+ <div className="col-6">Won't work</div>
318
+ </div>;
319
+
320
+ {
321
+ /* ✅ CORRECT: Proper flex container */
322
+ }
323
+ <div className="col-row">
324
+ <div className="col-6">Works correctly</div>
325
+ </div>;
326
+ ```
327
+
328
+ **Container must have:**
329
+
330
+ - `display: flex`
331
+ - `flex-wrap: wrap` (to allow wrapping)
332
+ - Optional: `gap` property for spacing
333
+
334
+ ### ⚠️ NOT Compatible with Grid Component
335
+
336
+ Column utilities are designed for **Flexbox only**. The existing Grid component
337
+ uses CSS Grid with different classes:
338
+
339
+ ```jsx
340
+ {
341
+ /* ❌ WRONG: Grid uses CSS Grid, not Flexbox */
342
+ }
343
+ <div className="grid gap-md">
344
+ <div className="col-4">Won't work as expected</div>
345
+ </div>;
346
+
347
+ {
348
+ /* ✅ CORRECT: Use Grid's built-in column spanning */
349
+ }
350
+ <div className="grid grid-cols-12 gap-md">
351
+ <div className="grid-col-span-4">Sidebar</div>
352
+ <div className="grid-col-span-8">Main Content</div>
353
+ </div>;
354
+ ```
355
+
356
+ **Two DIFFERENT systems:**
357
+
358
+ | System | Display Mode | Classes | Use Case |
359
+ | ----------------------------- | ------------ | ---------------------------------- | --------------------------------- |
360
+ | **Column Utilities** (NEW) | Flexbox | `.col-1` to `.col-12` | Bootstrap-style percentage widths |
361
+ | **Grid Component** (Existing) | CSS Grid | `.grid-cols-*`, `.grid-col-span-*` | Multi-dimensional grid layouts |
362
+
363
+ ## Customization
364
+
365
+ ### CSS Custom Properties
366
+
367
+ All column widths and the breakpoint are defined as CSS custom properties and
368
+ can be customized:
369
+
370
+ ```css
371
+ :root {
372
+ /* Breakpoint for responsive behavior */
373
+ --col-breakpoint: 48rem; /* 768px */
374
+
375
+ /* Column width percentages */
376
+ --col-1: 8.333333%;
377
+ --col-2: 16.666667%;
378
+ --col-3: 25%;
379
+ /* ... and so on */
380
+ }
381
+ ```
382
+
383
+ **Example: Change breakpoint to 64rem (1024px):**
384
+
385
+ ```css
386
+ :root {
387
+ --col-breakpoint: 64rem;
388
+ }
389
+ ```
390
+
391
+ **Example: Override column widths:**
392
+
393
+ ```css
394
+ :root {
395
+ --col-6: 48%; /* Instead of 50% */
396
+ }
397
+ ```
398
+
399
+ ## Migration from Bootstrap/Foundation
400
+
401
+ ### Bootstrap Row/Col Pattern
402
+
403
+ **Bootstrap:**
404
+
405
+ ```html
406
+ <div class="row">
407
+ <div class="col-6">Column</div>
408
+ <div class="col-6">Column</div>
409
+ </div>
410
+ ```
411
+
412
+ **fpkit (Option 1 - Bootstrap-like):**
413
+
414
+ ```jsx
415
+ <div className="col-row">
416
+ <div className="col-6">Column</div>
417
+ <div className="col-6">Column</div>
418
+ </div>
419
+ ```
420
+
421
+ **fpkit (Option 2 - React component):**
422
+
423
+ ```jsx
424
+ <Flex wrap="wrap" gap="md">
425
+ <div className="col-6">Column</div>
426
+ <div className="col-6">Column</div>
427
+ </Flex>
428
+ ```
429
+
430
+ ### Foundation Grid Pattern
431
+
432
+ **Foundation:**
433
+
434
+ ```html
435
+ <div class="grid-x grid-padding-x">
436
+ <div class="cell medium-6">Column</div>
437
+ <div class="cell medium-6">Column</div>
438
+ </div>
439
+ ```
440
+
441
+ **fpkit:**
442
+
443
+ ```jsx
444
+ <div className="col-row">
445
+ <div className="col-6">Column</div>
446
+ <div className="col-6">Column</div>
447
+ </div>
448
+ ```
449
+
450
+ ### Key Differences
451
+
452
+ - Use `.col-row` (closest to Bootstrap's `.row`) OR `<Flex>` component
453
+ - `.col-row` uses `gap` instead of negative margins + padding
454
+ - Same class names (`.col-1` through `.col-12`)
455
+ - Same percentage calculations
456
+ - Only one breakpoint (48rem) - no sm/md/lg/xl variants yet
457
+
458
+ ## Troubleshooting
459
+
460
+ ### Columns Not Wrapping to New Rows
461
+
462
+ **Problem:** All columns stay on one row and shrink
463
+
464
+ **Solution:** Add `flex-wrap: wrap` to the container
465
+
466
+ ```jsx
467
+ {
468
+ /* ❌ WRONG */
469
+ }
470
+ <Flex>
471
+ <div className="col-6">...</div>
472
+ <div className="col-6">...</div>
473
+ <div className="col-6">...</div> {/* Doesn't wrap! */}
474
+ </Flex>;
475
+
476
+ {
477
+ /* ✅ CORRECT */
478
+ }
479
+ <Flex wrap="wrap">
480
+ <div className="col-6">...</div>
481
+ <div className="col-6">...</div>
482
+ <div className="col-6">...</div> {/* Wraps to new row */}
483
+ </Flex>;
484
+ ```
485
+
486
+ ### Content Overflowing from Columns
487
+
488
+ **Problem:** Long text or images overflow the column width
489
+
490
+ **Solution:** The `min-width: 0` in the utility prevents this, but verify
491
+ container has `flex-wrap: wrap`
492
+
493
+ ### Columns Not Sized Correctly on Mobile
494
+
495
+ **Problem:** Columns show percentage widths on mobile screens
496
+
497
+ **Solution:** Check browser width is actually < 768px (48rem). Use browser
498
+ DevTools responsive mode to verify.
499
+
500
+ ### Can't Use with Grid Component
501
+
502
+ **Problem:** `.col-6` doesn't work inside `<Grid>` component
503
+
504
+ **Solution:** Use `.grid-col-span-6` instead. Column utilities only work with
505
+ Flexbox, not CSS Grid.
506
+
507
+ ## Browser Support
508
+
509
+ - ✅ All modern browsers (Chrome, Firefox, Safari, Edge)
510
+ - ✅ Flexbox required (supported since IE11)
511
+ - ✅ CSS custom properties (not supported in IE11, but degrades gracefully)
512
+ - ✅ Modern media query syntax `@media (width >= 48rem)`
513
+
514
+ ## Performance
515
+
516
+ ### Bundle Size
517
+
518
+ - **Total CSS:** ~4KB (uncompressed)
519
+ - **After minification:** ~2KB
520
+ - **Impact:** < 2% of typical component library bundle
521
+
522
+ ### Optimization Tips
523
+
524
+ 1. **Remove unused features** - If you don't need offsets/ordering, remove those
525
+ sections from `_columns.scss`
526
+ 2. **Use gap utilities** - Instead of custom padding on every column
527
+ 3. **Leverage CSS custom properties** - One-time definition, reused across all
528
+ columns
529
+
530
+ ## Examples in the Wild
531
+
532
+ ### Card Grid
533
+
534
+ ```jsx
535
+ <div className="col-row">
536
+ {products.map((product) => (
537
+ <div key={product.id} className="col-3">
538
+ <Card>
539
+ <CardTitle>{product.name}</CardTitle>
540
+ <CardContent>{product.description}</CardContent>
541
+ </Card>
542
+ </div>
543
+ ))}
544
+ </div>
545
+ ```
546
+
547
+ ### Dashboard Layout
548
+
549
+ ```jsx
550
+ <div className="col-row">
551
+ <div className="col-3">
552
+ <Sidebar />
553
+ </div>
554
+ <div className="col-6">
555
+ <MainContent />
556
+ </div>
557
+ <div className="col-3">
558
+ <SecondaryContent />
559
+ </div>
560
+ </div>
561
+ ```
562
+
563
+ ### Form Layout
564
+
565
+ ```jsx
566
+ <div className="col-row">
567
+ <div className="col-6">
568
+ <Field label="First Name">
569
+ <FieldInput />
570
+ </Field>
571
+ </div>
572
+ <div className="col-6">
573
+ <Field label="Last Name">
574
+ <FieldInput />
575
+ </Field>
576
+ </div>
577
+ <div className="col-12">
578
+ <Field label="Email">
579
+ <FieldInput type="email" />
580
+ </Field>
581
+ </div>
582
+ </div>
583
+ ```
584
+
585
+ ## Related Components
586
+
587
+ - **Flex Component** - For complex flexbox layouts with responsive props
588
+ - **Grid Component** - For CSS Grid-based layouts (NOT compatible with `.col-*`
589
+ classes)
590
+ - **Stack Component** - For vertical stacking with consistent spacing
591
+ - **Cluster Component** - For wrapping groups of items
592
+
593
+ ## Resources
594
+
595
+ - [Flexbox MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout)
596
+ - [CSS Custom Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*)
597
+ - [Logical Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)