@fpkit/acss 3.1.0 → 3.2.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/libs/{chunk-2NRIP6RB.cjs → chunk-2C3YLBWP.cjs} +3 -3
- package/libs/{chunk-NWJDAHP6.cjs → chunk-2GJHKWEK.cjs} +3 -3
- package/libs/{chunk-FVROL3V5.js → chunk-2JCDEC32.js} +3 -3
- package/libs/{chunk-IRLFZ3OL.js → chunk-3XJC4XUG.js} +2 -2
- package/libs/{chunk-23ANBDCR.js → chunk-4I5MF54P.js} +3 -3
- package/libs/chunk-4I5MF54P.js.map +1 -0
- package/libs/chunk-5CJPTDK3.cjs +31 -0
- package/libs/chunk-5CJPTDK3.cjs.map +1 -0
- package/libs/{chunk-E4OSROCA.cjs → chunk-5QSNJQVH.cjs} +3 -3
- package/libs/{chunk-O3JIHC5M.cjs → chunk-6BUJZ4DJ.cjs} +3 -3
- package/libs/{chunk-WXBFBWYF.cjs → chunk-AFINOD2L.cjs} +3 -3
- package/libs/{chunk-HRRHPLER.js → chunk-AWZLSWDO.js} +2 -2
- package/libs/chunk-DDSXKOUB.js +7 -0
- package/libs/chunk-DDSXKOUB.js.map +1 -0
- package/libs/{chunk-CWRNJA4P.js → chunk-DIJBIOFE.js} +3 -3
- package/libs/chunk-EJ6KYBFE.cjs +13 -0
- package/libs/chunk-EJ6KYBFE.cjs.map +1 -0
- package/libs/{chunk-GUJSMQ3V.cjs → chunk-EKJYOCLY.cjs} +3 -3
- package/libs/{chunk-X5RKCLDC.cjs → chunk-F64GE6RG.cjs} +4 -4
- package/libs/chunk-FMIM3332.js +8 -0
- package/libs/chunk-FMIM3332.js.map +1 -0
- package/libs/{chunk-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
- package/libs/chunk-IWP4VJEP.cjs +18 -0
- package/libs/chunk-IWP4VJEP.cjs.map +1 -0
- package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
- package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
- package/libs/chunk-M7JLT62Q.js +9 -0
- package/libs/chunk-M7JLT62Q.js.map +1 -0
- package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
- package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
- package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
- package/libs/{chunk-G55UJ53G.cjs → chunk-NZVSXRTB.cjs} +3 -3
- package/libs/chunk-NZVSXRTB.cjs.map +1 -0
- package/libs/{chunk-43TK2ICH.js → chunk-PMWL5XZ4.js} +3 -3
- package/libs/{chunk-KVKQLRJG.js → chunk-TF3GQKOY.js} +2 -2
- package/libs/chunk-TNEJXNZA.cjs +22 -0
- package/libs/chunk-TNEJXNZA.cjs.map +1 -0
- package/libs/{chunk-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
- package/libs/chunk-UGMP72J2.js +8 -0
- package/libs/chunk-UGMP72J2.js.map +1 -0
- package/libs/{chunk-MGPWZRBX.cjs → chunk-URBGDUFN.cjs} +6 -6
- package/libs/{chunk-QKHPHMG2.js → chunk-ZF6Y7W57.js} +5 -5
- package/libs/component-props-50e69975.d.ts +66 -0
- package/libs/components/box/box.css +1 -0
- package/libs/components/box/box.css.map +1 -0
- package/libs/components/box/box.min.css +3 -0
- package/libs/components/breadcrumbs/breadcrumb.cjs +6 -6
- package/libs/components/breadcrumbs/breadcrumb.js +3 -3
- package/libs/components/button.cjs +4 -4
- package/libs/components/button.d.cts +10 -3
- package/libs/components/button.d.ts +10 -3
- package/libs/components/button.js +2 -2
- package/libs/components/card.cjs +7 -7
- package/libs/components/card.d.cts +13 -85
- package/libs/components/card.d.ts +13 -85
- package/libs/components/card.js +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/cluster/cluster.css +1 -0
- package/libs/components/cluster/cluster.css.map +1 -0
- package/libs/components/cluster/cluster.min.css +3 -0
- package/libs/components/dialog/dialog.cjs +7 -7
- package/libs/components/dialog/dialog.js +5 -5
- package/libs/components/form/fields.cjs +4 -4
- package/libs/components/form/fields.js +2 -2
- package/libs/components/form/textarea.cjs +4 -4
- package/libs/components/form/textarea.js +2 -2
- package/libs/components/grid/grid.css +1 -0
- package/libs/components/grid/grid.css.map +1 -0
- package/libs/components/grid/grid.min.css +3 -0
- package/libs/components/heading/heading.cjs +3 -3
- package/libs/components/heading/heading.js +2 -2
- package/libs/components/icons/icon.cjs +4 -4
- package/libs/components/icons/icon.d.cts +2 -2
- package/libs/components/icons/icon.d.ts +2 -2
- package/libs/components/icons/icon.js +2 -2
- package/libs/components/link/link.cjs +6 -6
- package/libs/components/link/link.js +2 -2
- package/libs/components/list/list.cjs +5 -5
- package/libs/components/list/list.js +2 -2
- package/libs/components/modal.cjs +4 -4
- package/libs/components/modal.d.cts +1 -1
- package/libs/components/modal.d.ts +1 -1
- package/libs/components/modal.js +3 -3
- package/libs/components/nav/nav.cjs +7 -7
- package/libs/components/nav/nav.js +3 -3
- package/libs/components/popover/popover.cjs +4 -4
- package/libs/components/popover/popover.d.cts +1 -1
- package/libs/components/popover/popover.d.ts +1 -1
- package/libs/components/popover/popover.js +1 -1
- package/libs/components/stack/stack.css +1 -0
- package/libs/components/stack/stack.css.map +1 -0
- package/libs/components/stack/stack.min.css +3 -0
- package/libs/components/tables/table.cjs +4 -4
- package/libs/components/tables/table.d.cts +2 -2
- package/libs/components/tables/table.d.ts +2 -2
- package/libs/components/tables/table.js +1 -1
- package/libs/components/text/text.cjs +5 -5
- package/libs/components/text/text.js +2 -2
- package/libs/hooks.cjs +4 -4
- package/libs/hooks.js +3 -3
- package/libs/{icons-287fce3a.d.ts → icons-df8e744f.d.ts} +1 -1
- package/libs/icons.cjs +3 -3
- package/libs/icons.d.cts +2 -2
- package/libs/icons.d.ts +2 -2
- package/libs/icons.js +2 -2
- package/libs/index.cjs +74 -73
- package/libs/index.cjs.map +1 -1
- package/libs/index.css +1 -1
- package/libs/index.css.map +1 -1
- package/libs/index.d.cts +925 -6
- package/libs/index.d.ts +925 -6
- package/libs/index.js +30 -30
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/App.tsx +1 -3
- package/src/components/alert/STYLES.mdx +790 -0
- package/src/components/badge/STYLES.mdx +610 -0
- package/src/components/box/README.mdx +401 -0
- package/src/components/box/STYLES.mdx +360 -0
- package/src/components/box/box.scss +245 -0
- package/src/components/box/box.stories.tsx +395 -0
- package/src/components/box/box.test.tsx +425 -0
- package/src/components/box/box.tsx +170 -0
- package/src/components/box/box.types.ts +166 -0
- package/src/components/breadcrumbs/STYLES.mdx +99 -0
- package/src/components/breadcrumbs/bc-item.tsx +0 -1
- package/src/components/buttons/STYLES.mdx +766 -0
- package/src/components/cards/STYLES.mdx +835 -0
- package/src/components/cards/card.scss +29 -21
- package/src/components/cards/card.tsx +13 -3
- package/src/components/cards/card.types.ts +13 -0
- package/src/components/cluster/README.mdx +595 -0
- package/src/components/cluster/STYLES.mdx +626 -0
- package/src/components/cluster/cluster.scss +86 -0
- package/src/components/cluster/cluster.stories.tsx +385 -0
- package/src/components/cluster/cluster.test.tsx +655 -0
- package/src/components/cluster/cluster.tsx +94 -0
- package/src/components/cluster/cluster.types.ts +75 -0
- package/src/components/details/STYLES.mdx +445 -0
- package/src/components/dialog/STYLES.mdx +888 -0
- package/src/components/flexbox/STYLES.mdx +857 -0
- package/src/components/flexbox/flex.stories.tsx +842 -141
- package/src/components/flexbox/flex.types.ts +25 -6
- package/src/components/form/STYLES.mdx +821 -0
- package/src/components/grid/README.mdx +709 -0
- package/src/components/grid/STYLES.mdx +785 -0
- package/src/components/grid/grid.scss +287 -0
- package/src/components/grid/grid.stories.tsx +486 -0
- package/src/components/grid/grid.test.tsx +981 -0
- package/src/components/grid/grid.tsx +222 -0
- package/src/components/grid/grid.types.ts +344 -0
- package/src/components/icons/STYLES.mdx +56 -0
- package/src/components/icons/components/arrow-right.tsx +0 -5
- package/src/components/images/STYLES.mdx +75 -0
- package/src/components/kit.tsx +8 -4
- package/src/components/layout/STYLES.mdx +556 -0
- package/src/components/link/STYLES.mdx +75 -0
- package/src/components/list/STYLES.mdx +631 -0
- package/src/components/nav/STYLES.mdx +460 -0
- package/src/components/popover/popover.tsx +1 -1
- package/src/components/progress/STYLES.mdx +64 -0
- package/src/components/stack/README.mdx +400 -0
- package/src/components/stack/STYLES.mdx +414 -0
- package/src/components/stack/stack.scss +109 -0
- package/src/components/stack/stack.stories.tsx +559 -0
- package/src/components/stack/stack.test.tsx +426 -0
- package/src/components/stack/stack.tsx +141 -0
- package/src/components/stack/stack.types.ts +133 -0
- package/src/components/tables/table-elements.tsx +1 -1
- package/src/components/tables/table.tsx +2 -2
- package/src/components/tag/STYLES.mdx +105 -0
- package/src/components/text-to-speech/STYLES.mdx +80 -0
- package/src/components/text-to-speech/TextToSpeech.tsx +0 -4
- package/src/components/text-to-speech/useTextToSpeech.tsx +2 -6
- package/src/components/ui.tsx +3 -3
- package/src/decorators/instructions.tsx +22 -18
- package/src/hooks/popover/popover.tsx +1 -1
- package/src/index.scss +5 -1
- package/src/index.ts +305 -12
- package/src/sass/GLOBALS-STYLES.md +631 -0
- package/src/sass/_globals.scss +45 -24
- package/src/styles/box/box.css +220 -0
- package/src/styles/box/box.css.map +1 -0
- package/src/styles/cards/card.css +22 -17
- package/src/styles/cards/card.css.map +1 -1
- package/src/styles/cluster/cluster.css +71 -0
- package/src/styles/cluster/cluster.css.map +1 -0
- package/src/styles/grid/grid.css +238 -0
- package/src/styles/grid/grid.css.map +1 -0
- package/src/styles/index.css +667 -49
- package/src/styles/index.css.map +1 -1
- package/src/styles/stack/stack.css +86 -0
- package/src/styles/stack/stack.css.map +1 -0
- package/src/types/component-props.ts +42 -13
- package/src/types/layout-primitives.ts +48 -0
- package/src/types/shared.ts +10 -26
- package/libs/chunk-23ANBDCR.js.map +0 -1
- package/libs/chunk-5QD3DWFI.js +0 -9
- package/libs/chunk-5QD3DWFI.js.map +0 -1
- package/libs/chunk-6WTC4JXH.cjs +0 -31
- package/libs/chunk-6WTC4JXH.cjs.map +0 -1
- package/libs/chunk-ENTCUJ3A.cjs +0 -13
- package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
- package/libs/chunk-G55UJ53G.cjs.map +0 -1
- package/libs/chunk-HHLNOC5T.js +0 -7
- package/libs/chunk-HHLNOC5T.js.map +0 -1
- package/libs/chunk-KK47SYZI.js +0 -8
- package/libs/chunk-KK47SYZI.js.map +0 -1
- package/libs/chunk-US2I5GI7.cjs +0 -22
- package/libs/chunk-US2I5GI7.cjs.map +0 -1
- package/libs/chunk-W5TKWBFC.cjs +0 -18
- package/libs/chunk-W5TKWBFC.cjs.map +0 -1
- package/libs/chunk-Y2PFDELK.js +0 -8
- package/libs/chunk-Y2PFDELK.js.map +0 -1
- package/libs/component-props-67d978a2.d.ts +0 -38
- /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
- /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
- /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
- /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
- /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
- /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
- /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
- /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
- /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
- /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
- /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
- /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
- /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
- /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
- /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
- /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
- /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
- /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
- /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
- /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
- /package/libs/{chunk-MGPWZRBX.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
- /package/libs/{chunk-QKHPHMG2.js.map → chunk-ZF6Y7W57.js.map} +0 -0
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as GridStories from './grid.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={GridStories} title="Styles/Grid" />
|
|
5
|
+
|
|
6
|
+
# Grid Component Styles
|
|
7
|
+
|
|
8
|
+
Complete CSS reference for the Grid layout primitive and Grid.Item sub-component.
|
|
9
|
+
|
|
10
|
+
## CSS Architecture
|
|
11
|
+
|
|
12
|
+
The Grid component uses a **utility-class system** with CSS custom properties for theming. All spacing values use the unified spacing scale with fluid `clamp()` for responsive design. Grid provides true CSS Grid layouts with explicit column control (1-12) and auto-fit/auto-fill behavior.
|
|
13
|
+
|
|
14
|
+
**Key Characteristics:**
|
|
15
|
+
- **Zero Runtime:** All styling via CSS classes (no JavaScript)
|
|
16
|
+
- **CSS Grid:** Native CSS Grid for 2D layouts
|
|
17
|
+
- **12-Column System:** Explicit column layouts from 1-12
|
|
18
|
+
- **Fluid Spacing:** CSS clamp() for responsive gaps
|
|
19
|
+
- **Rem Units:** All measurements in rem (1rem = 16px base)
|
|
20
|
+
|
|
21
|
+
## Base Styles
|
|
22
|
+
|
|
23
|
+
### `.grid`
|
|
24
|
+
|
|
25
|
+
Base CSS Grid container.
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
.grid {
|
|
29
|
+
display: grid;
|
|
30
|
+
gap: var(--spacing-md); /* Default: clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem) */
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Default Behavior:**
|
|
35
|
+
- Displays items in a grid layout
|
|
36
|
+
- Default gap: `--spacing-md` (12-18px responsive)
|
|
37
|
+
- No explicit columns by default (auto-flows)
|
|
38
|
+
|
|
39
|
+
## Column Layout (Explicit Columns)
|
|
40
|
+
|
|
41
|
+
Utility classes for explicit column counts from 1-12.
|
|
42
|
+
|
|
43
|
+
### `.grid-cols-1` to `.grid-cols-12`
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
.grid-cols-1 {
|
|
47
|
+
grid-template-columns: repeat(1, 1fr);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.grid-cols-2 {
|
|
51
|
+
grid-template-columns: repeat(2, 1fr);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.grid-cols-3 {
|
|
55
|
+
grid-template-columns: repeat(3, 1fr);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ... up to .grid-cols-12 */
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Usage:** `<Grid columns={3}>`
|
|
62
|
+
**Value:** `repeat(N, 1fr)` where N = 1-12
|
|
63
|
+
**Use Cases:**
|
|
64
|
+
- `cols-1`: Full-width single column
|
|
65
|
+
- `cols-2`: Two equal columns (50/50)
|
|
66
|
+
- `cols-3`: Three equal columns (33.33% each)
|
|
67
|
+
- `cols-4`: Four equal columns (25% each)
|
|
68
|
+
- `cols-12`: 12-column system for flexible layouts
|
|
69
|
+
|
|
70
|
+
## Auto Layout (Auto-Fit / Auto-Fill)
|
|
71
|
+
|
|
72
|
+
Classes for responsive grids without media queries.
|
|
73
|
+
|
|
74
|
+
### `.grid-auto-fit`
|
|
75
|
+
|
|
76
|
+
Auto-fit layout. Columns expand to fill available space.
|
|
77
|
+
|
|
78
|
+
```css
|
|
79
|
+
.grid-auto-fit {
|
|
80
|
+
/* Inline style applies: grid-template-columns: repeat(auto-fit, minmax(Xrem, 1fr)); */
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Usage:** `<Grid auto="fit" minColumnWidth="15rem">`
|
|
85
|
+
**Inline Style:** `grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr))`
|
|
86
|
+
**Behavior:** Columns expand to fill space, fewer columns on narrow viewports
|
|
87
|
+
|
|
88
|
+
### `.grid-auto-fill`
|
|
89
|
+
|
|
90
|
+
Auto-fill layout. Creates as many columns as fit, even if empty.
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
.grid-auto-fill {
|
|
94
|
+
/* Inline style applies: grid-template-columns: repeat(auto-fill, minmax(Xrem, 1fr)); */
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Usage:** `<Grid auto="fill" minColumnWidth="20rem">`
|
|
99
|
+
**Inline Style:** `grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr))`
|
|
100
|
+
**Behavior:** Creates empty columns if space available
|
|
101
|
+
|
|
102
|
+
## Gap Utilities
|
|
103
|
+
|
|
104
|
+
Control spacing between all grid items (rows and columns).
|
|
105
|
+
|
|
106
|
+
### `.grid-gap-0` to `.grid-gap-xl`
|
|
107
|
+
|
|
108
|
+
```css
|
|
109
|
+
.grid-gap-0 {
|
|
110
|
+
gap: 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.grid-gap-xs {
|
|
114
|
+
gap: var(--spacing-xs);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.grid-gap-sm {
|
|
118
|
+
gap: var(--spacing-sm);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.grid-gap-md {
|
|
122
|
+
gap: var(--spacing-md);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.grid-gap-lg {
|
|
126
|
+
gap: var(--spacing-lg);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.grid-gap-xl {
|
|
130
|
+
gap: var(--spacing-xl);
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Usage:** `<Grid columns={3} gap="md">`
|
|
135
|
+
**Values:**
|
|
136
|
+
- `gap-0`: No gap (0)
|
|
137
|
+
- `gap-xs`: Extra small (clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem)) - 4-8px
|
|
138
|
+
- `gap-sm`: Small (clamp(0.5rem, 0.45rem + 0.35vw, 0.75rem)) - 8-12px
|
|
139
|
+
- `gap-md`: Medium (clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem)) - 12-18px
|
|
140
|
+
- `gap-lg`: Large (clamp(1rem, 0.85rem + 0.6vw, 1.5rem)) - 16-24px
|
|
141
|
+
- `gap-xl`: Extra large (clamp(1.5rem, 1.25rem + 0.75vw, 2rem)) - 24-32px
|
|
142
|
+
|
|
143
|
+
## Gap X (Column Gap)
|
|
144
|
+
|
|
145
|
+
Control horizontal spacing between columns.
|
|
146
|
+
|
|
147
|
+
### `.grid-gap-x-0` to `.grid-gap-x-xl`
|
|
148
|
+
|
|
149
|
+
```css
|
|
150
|
+
.grid-gap-x-0 {
|
|
151
|
+
column-gap: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.grid-gap-x-xs {
|
|
155
|
+
column-gap: var(--spacing-xs);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.grid-gap-x-sm {
|
|
159
|
+
column-gap: var(--spacing-sm);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* ... */
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Usage:** `<Grid columns={3} gapX="lg">`
|
|
166
|
+
**Overrides:** Takes precedence over `gap` for horizontal spacing
|
|
167
|
+
|
|
168
|
+
## Gap Y (Row Gap)
|
|
169
|
+
|
|
170
|
+
Control vertical spacing between rows.
|
|
171
|
+
|
|
172
|
+
### `.grid-gap-y-0` to `.grid-gap-y-xl`
|
|
173
|
+
|
|
174
|
+
```css
|
|
175
|
+
.grid-gap-y-0 {
|
|
176
|
+
row-gap: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.grid-gap-y-xs {
|
|
180
|
+
row-gap: var(--spacing-xs);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.grid-gap-y-sm {
|
|
184
|
+
row-gap: var(--spacing-sm);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* ... */
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Usage:** `<Grid columns={3} gapY="sm">`
|
|
191
|
+
**Overrides:** Takes precedence over `gap` for vertical spacing
|
|
192
|
+
|
|
193
|
+
**Asymmetric Gaps Example:**
|
|
194
|
+
```tsx
|
|
195
|
+
<Grid columns={3} gapX="xl" gapY="xs">
|
|
196
|
+
{/* Wide columns, tight rows */}
|
|
197
|
+
</Grid>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Justify Items (Horizontal Alignment)
|
|
201
|
+
|
|
202
|
+
Control horizontal alignment of items within their grid cells.
|
|
203
|
+
|
|
204
|
+
### `.grid-justify-items-start`
|
|
205
|
+
|
|
206
|
+
Align items to the start (left in LTR).
|
|
207
|
+
|
|
208
|
+
```css
|
|
209
|
+
.grid-justify-items-start {
|
|
210
|
+
justify-items: start;
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Usage:** `<Grid columns={3} justifyItems="start">`
|
|
215
|
+
**Behavior:** Items aligned to left edge of cells
|
|
216
|
+
|
|
217
|
+
### `.grid-justify-items-center`
|
|
218
|
+
|
|
219
|
+
Center items horizontally within cells.
|
|
220
|
+
|
|
221
|
+
```css
|
|
222
|
+
.grid-justify-items-center {
|
|
223
|
+
justify-items: center;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Usage:** `<Grid columns={3} justifyItems="center">`
|
|
228
|
+
**Behavior:** Items centered horizontally
|
|
229
|
+
|
|
230
|
+
### `.grid-justify-items-end`
|
|
231
|
+
|
|
232
|
+
Align items to the end (right in LTR).
|
|
233
|
+
|
|
234
|
+
```css
|
|
235
|
+
.grid-justify-items-end {
|
|
236
|
+
justify-items: end;
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Usage:** `<Grid columns={3} justifyItems="end">`
|
|
241
|
+
**Behavior:** Items aligned to right edge of cells
|
|
242
|
+
|
|
243
|
+
### `.grid-justify-items-stretch`
|
|
244
|
+
|
|
245
|
+
Stretch items to fill cell width.
|
|
246
|
+
|
|
247
|
+
```css
|
|
248
|
+
.grid-justify-items-stretch {
|
|
249
|
+
justify-items: stretch;
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Usage:** `<Grid columns={3} justifyItems="stretch">`
|
|
254
|
+
**Behavior:** Items expand to fill cell width (default)
|
|
255
|
+
|
|
256
|
+
## Align Items (Vertical Alignment)
|
|
257
|
+
|
|
258
|
+
Control vertical alignment of items within their grid cells.
|
|
259
|
+
|
|
260
|
+
### `.grid-align-items-start`
|
|
261
|
+
|
|
262
|
+
Align items to the top of cells.
|
|
263
|
+
|
|
264
|
+
```css
|
|
265
|
+
.grid-align-items-start {
|
|
266
|
+
align-items: start;
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Usage:** `<Grid columns={3} alignItems="start">`
|
|
271
|
+
**Behavior:** Items aligned to top edge of cells
|
|
272
|
+
|
|
273
|
+
### `.grid-align-items-center`
|
|
274
|
+
|
|
275
|
+
Center items vertically within cells.
|
|
276
|
+
|
|
277
|
+
```css
|
|
278
|
+
.grid-align-items-center {
|
|
279
|
+
align-items: center;
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Usage:** `<Grid columns={3} alignItems="center">`
|
|
284
|
+
**Behavior:** Items centered vertically
|
|
285
|
+
|
|
286
|
+
### `.grid-align-items-end`
|
|
287
|
+
|
|
288
|
+
Align items to the bottom of cells.
|
|
289
|
+
|
|
290
|
+
```css
|
|
291
|
+
.grid-align-items-end {
|
|
292
|
+
align-items: end;
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Usage:** `<Grid columns={3} alignItems="end">`
|
|
297
|
+
**Behavior:** Items aligned to bottom edge of cells
|
|
298
|
+
|
|
299
|
+
### `.grid-align-items-stretch`
|
|
300
|
+
|
|
301
|
+
Stretch items to fill cell height.
|
|
302
|
+
|
|
303
|
+
```css
|
|
304
|
+
.grid-align-items-stretch {
|
|
305
|
+
align-items: stretch;
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Usage:** `<Grid columns={3} alignItems="stretch">`
|
|
310
|
+
**Behavior:** Items expand to fill cell height (default)
|
|
311
|
+
|
|
312
|
+
## Grid.Item - Column Span
|
|
313
|
+
|
|
314
|
+
Control how many columns a grid item spans.
|
|
315
|
+
|
|
316
|
+
### `.grid-col-span-1` to `.grid-col-span-12`
|
|
317
|
+
|
|
318
|
+
```css
|
|
319
|
+
.grid-col-span-1 {
|
|
320
|
+
grid-column: span 1;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.grid-col-span-2 {
|
|
324
|
+
grid-column: span 2;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.grid-col-span-3 {
|
|
328
|
+
grid-column: span 3;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* ... up to .grid-col-span-12 */
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Usage:** `<Grid.Item span={8}>Main content</Grid.Item>`
|
|
335
|
+
**Values:** span 1-12 columns
|
|
336
|
+
**Use Cases:**
|
|
337
|
+
- `span-1`: Single column width (default)
|
|
338
|
+
- `span-2`: Two columns wide
|
|
339
|
+
- `span-4`: Four columns wide (33.33% in 12-col grid)
|
|
340
|
+
- `span-6`: Six columns wide (50% in 12-col grid)
|
|
341
|
+
- `span-8`: Eight columns wide (66.67% in 12-col grid)
|
|
342
|
+
- `span-12`: Full width (100%)
|
|
343
|
+
|
|
344
|
+
**Example (8/4 Split):**
|
|
345
|
+
```tsx
|
|
346
|
+
<Grid columns={12} gap="lg">
|
|
347
|
+
<Grid.Item span={8}>Main (66.67%)</Grid.Item>
|
|
348
|
+
<Grid.Item span={4}>Sidebar (33.33%)</Grid.Item>
|
|
349
|
+
</Grid>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Grid.Item - Row Span
|
|
353
|
+
|
|
354
|
+
Control how many rows a grid item spans.
|
|
355
|
+
|
|
356
|
+
### `.grid-row-span-1` to `.grid-row-span-6`
|
|
357
|
+
|
|
358
|
+
```css
|
|
359
|
+
.grid-row-span-1 {
|
|
360
|
+
grid-row: span 1;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.grid-row-span-2 {
|
|
364
|
+
grid-row: span 2;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.grid-row-span-3 {
|
|
368
|
+
grid-row: span 3;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/* ... up to .grid-row-span-6 */
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Usage:** `<Grid.Item rowSpan={2}>Tall item</Grid.Item>`
|
|
375
|
+
**Values:** span 1-6 rows
|
|
376
|
+
**Behavior:** Item spans multiple rows vertically
|
|
377
|
+
|
|
378
|
+
**Example:**
|
|
379
|
+
```tsx
|
|
380
|
+
<Grid columns={3} gap="md">
|
|
381
|
+
<Grid.Item rowSpan={2}>Tall sidebar</Grid.Item>
|
|
382
|
+
<div>Item 2</div>
|
|
383
|
+
<div>Item 3</div>
|
|
384
|
+
<div>Item 4</div>
|
|
385
|
+
<div>Item 5</div>
|
|
386
|
+
</Grid>
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## CSS Custom Properties
|
|
390
|
+
|
|
391
|
+
### Global Spacing Scale
|
|
392
|
+
|
|
393
|
+
Defined in `_globals.scss`:
|
|
394
|
+
|
|
395
|
+
```scss
|
|
396
|
+
:root {
|
|
397
|
+
--spacing-0: 0;
|
|
398
|
+
--spacing-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem); /* 4-8px */
|
|
399
|
+
--spacing-sm: clamp(0.5rem, 0.45rem + 0.35vw, 0.75rem); /* 8-12px */
|
|
400
|
+
--spacing-md: clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem); /* 12-18px */
|
|
401
|
+
--spacing-lg: clamp(1rem, 0.85rem + 0.6vw, 1.5rem); /* 16-24px */
|
|
402
|
+
--spacing-xl: clamp(1.5rem, 1.25rem + 0.75vw, 2rem); /* 24-32px */
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Theming
|
|
407
|
+
|
|
408
|
+
Override spacing scale globally or per component:
|
|
409
|
+
|
|
410
|
+
**Global:**
|
|
411
|
+
```css
|
|
412
|
+
:root {
|
|
413
|
+
/* Custom larger gaps */
|
|
414
|
+
--spacing-md: 1.5rem;
|
|
415
|
+
--spacing-lg: 2.5rem;
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Per Component:**
|
|
420
|
+
```tsx
|
|
421
|
+
<Grid
|
|
422
|
+
columns={3}
|
|
423
|
+
gap="md"
|
|
424
|
+
styles={{
|
|
425
|
+
'--spacing-md': '2rem',
|
|
426
|
+
} as React.CSSProperties}
|
|
427
|
+
>
|
|
428
|
+
<div>Item</div>
|
|
429
|
+
</Grid>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Responsive Behavior
|
|
433
|
+
|
|
434
|
+
### Fluid Gaps
|
|
435
|
+
|
|
436
|
+
Gap values automatically adjust based on viewport width using CSS clamp():
|
|
437
|
+
|
|
438
|
+
```
|
|
439
|
+
Viewport Width → Gap Size
|
|
440
|
+
320px (mobile) → Minimum (e.g., 0.75rem for md)
|
|
441
|
+
~800px (tablet) → Middle value (interpolated)
|
|
442
|
+
1280px+ (desktop) → Maximum (e.g., 1.125rem for md)
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**No media queries needed!** Spacing scales smoothly.
|
|
446
|
+
|
|
447
|
+
### Auto-Fit Example
|
|
448
|
+
|
|
449
|
+
```tsx
|
|
450
|
+
<Grid auto="fit" minColumnWidth="15rem" gap="md">
|
|
451
|
+
<div>Card 1</div>
|
|
452
|
+
<div>Card 2</div>
|
|
453
|
+
<div>Card 3</div>
|
|
454
|
+
</Grid>
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
**Behavior:**
|
|
458
|
+
- Viewport 320px: 1 column (cards 15rem+ wide)
|
|
459
|
+
- Viewport 640px: 2 columns (2 × 15rem = 30rem fits)
|
|
460
|
+
- Viewport 960px: 3 columns (3 × 15rem = 45rem fits)
|
|
461
|
+
- Automatically adjusts without media queries!
|
|
462
|
+
|
|
463
|
+
### Media Query Integration
|
|
464
|
+
|
|
465
|
+
Combine with media queries for custom responsive behavior:
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
<Grid columns={4} gap="md" className="responsive-grid">
|
|
469
|
+
{items.map(item => <Card key={item.id}>{item}</Card>)}
|
|
470
|
+
</Grid>
|
|
471
|
+
|
|
472
|
+
<style>
|
|
473
|
+
@media (max-width: 768px) {
|
|
474
|
+
.responsive-grid {
|
|
475
|
+
grid-template-columns: repeat(2, 1fr);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
@media (max-width: 480px) {
|
|
480
|
+
.responsive-grid {
|
|
481
|
+
grid-template-columns: 1fr;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
</style>
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
## Class Generation
|
|
488
|
+
|
|
489
|
+
The Grid and Grid.Item components generate classes based on props:
|
|
490
|
+
|
|
491
|
+
### Grid Example
|
|
492
|
+
|
|
493
|
+
```tsx
|
|
494
|
+
<Grid columns={3} gap="md" justifyItems="center" alignItems="center">
|
|
495
|
+
Content
|
|
496
|
+
</Grid>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
**Generated classes:**
|
|
500
|
+
```html
|
|
501
|
+
<div class="grid grid-cols-3 grid-gap-md grid-justify-items-center grid-align-items-center">
|
|
502
|
+
Content
|
|
503
|
+
</div>
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Grid.Item Example
|
|
507
|
+
|
|
508
|
+
```tsx
|
|
509
|
+
<Grid.Item span={8} rowSpan={2}>
|
|
510
|
+
Content
|
|
511
|
+
</Grid.Item>
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Generated classes:**
|
|
515
|
+
```html
|
|
516
|
+
<div class="grid-col-span-8 grid-row-span-2">
|
|
517
|
+
Content
|
|
518
|
+
</div>
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## Combining with Custom Styles
|
|
522
|
+
|
|
523
|
+
### Custom Classes
|
|
524
|
+
|
|
525
|
+
```tsx
|
|
526
|
+
<Grid className="custom-grid" columns={3} gap="md">
|
|
527
|
+
<div>Item</div>
|
|
528
|
+
</Grid>
|
|
529
|
+
|
|
530
|
+
<style>
|
|
531
|
+
.custom-grid {
|
|
532
|
+
max-width: 75rem; /* 1200px */
|
|
533
|
+
margin-inline: auto;
|
|
534
|
+
padding: 2rem;
|
|
535
|
+
}
|
|
536
|
+
</style>
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Inline Styles
|
|
540
|
+
|
|
541
|
+
```tsx
|
|
542
|
+
<Grid
|
|
543
|
+
columns={3}
|
|
544
|
+
gap="md"
|
|
545
|
+
styles={{
|
|
546
|
+
maxWidth: '1200px',
|
|
547
|
+
marginInline: 'auto',
|
|
548
|
+
}}
|
|
549
|
+
>
|
|
550
|
+
<div>Item</div>
|
|
551
|
+
</Grid>
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Custom Column Widths
|
|
555
|
+
|
|
556
|
+
```tsx
|
|
557
|
+
<Grid
|
|
558
|
+
styles={{
|
|
559
|
+
gridTemplateColumns: '200px 1fr 200px',
|
|
560
|
+
}}
|
|
561
|
+
gap="md"
|
|
562
|
+
>
|
|
563
|
+
<div>Fixed 200px</div>
|
|
564
|
+
<div>Flexible</div>
|
|
565
|
+
<div>Fixed 200px</div>
|
|
566
|
+
</Grid>
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## SCSS Source
|
|
570
|
+
|
|
571
|
+
**File:** `src/components/grid/grid.scss`
|
|
572
|
+
|
|
573
|
+
```scss
|
|
574
|
+
/**
|
|
575
|
+
* Grid Component Styles
|
|
576
|
+
*
|
|
577
|
+
* Utility classes for the Grid layout primitive and Grid.Item sub-component.
|
|
578
|
+
* Provides CSS Grid-based layouts with responsive columns, gap spacing, and alignment.
|
|
579
|
+
* All spacing values use the unified spacing scale from globals.
|
|
580
|
+
* All units are in rem (1rem = 16px base).
|
|
581
|
+
*/
|
|
582
|
+
|
|
583
|
+
// Base Grid
|
|
584
|
+
.grid {
|
|
585
|
+
display: grid;
|
|
586
|
+
gap: var(--spacing-md);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Column Layout (1-12)
|
|
590
|
+
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
|
|
591
|
+
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
|
|
592
|
+
// ... up to 12
|
|
593
|
+
|
|
594
|
+
// Auto Layout
|
|
595
|
+
.grid-auto-fit { /* Inline style */ }
|
|
596
|
+
.grid-auto-fill { /* Inline style */ }
|
|
597
|
+
|
|
598
|
+
// Gap Utilities
|
|
599
|
+
.grid-gap-0 { gap: 0; }
|
|
600
|
+
.grid-gap-xs { gap: var(--spacing-xs); }
|
|
601
|
+
// ... all scales
|
|
602
|
+
|
|
603
|
+
// Gap X/Y
|
|
604
|
+
.grid-gap-x-md { column-gap: var(--spacing-md); }
|
|
605
|
+
.grid-gap-y-lg { row-gap: var(--spacing-lg); }
|
|
606
|
+
|
|
607
|
+
// Justify/Align Items
|
|
608
|
+
.grid-justify-items-center { justify-items: center; }
|
|
609
|
+
.grid-align-items-center { align-items: center; }
|
|
610
|
+
|
|
611
|
+
// Grid.Item Column Span (1-12)
|
|
612
|
+
.grid-col-span-1 { grid-column: span 1; }
|
|
613
|
+
.grid-col-span-2 { grid-column: span 2; }
|
|
614
|
+
// ... up to 12
|
|
615
|
+
|
|
616
|
+
// Grid.Item Row Span (1-6)
|
|
617
|
+
.grid-row-span-1 { grid-row: span 1; }
|
|
618
|
+
.grid-row-span-2 { grid-row: span 2; }
|
|
619
|
+
// ... up to 6
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
## Compiled CSS Output
|
|
623
|
+
|
|
624
|
+
**Location:** `libs/components/grid/grid.css`
|
|
625
|
+
|
|
626
|
+
**Minified Size:** ~1.2 KB (gzipped: ~600 bytes)
|
|
627
|
+
|
|
628
|
+
## Performance
|
|
629
|
+
|
|
630
|
+
### Bundle Size
|
|
631
|
+
- **SCSS Source:** 4.2 KB
|
|
632
|
+
- **Compiled CSS:** 1.2 KB
|
|
633
|
+
- **Gzipped:** 0.6 KB
|
|
634
|
+
|
|
635
|
+
### Runtime Performance
|
|
636
|
+
- **Zero JavaScript:** All layout via CSS
|
|
637
|
+
- **No Re-renders:** Static utility classes
|
|
638
|
+
- **GPU Accelerated:** CSS Grid handled by browser compositor
|
|
639
|
+
|
|
640
|
+
### Loading Strategy
|
|
641
|
+
- **Critical CSS:** Include `.grid` base class and common column counts
|
|
642
|
+
- **Lazy Load:** Load all utility classes on demand
|
|
643
|
+
|
|
644
|
+
## Browser Support
|
|
645
|
+
|
|
646
|
+
| Feature | Chrome | Firefox | Safari | Edge |
|
|
647
|
+
|---------|--------|---------|--------|------|
|
|
648
|
+
| CSS Grid | ✅ 57+ | ✅ 52+ | ✅ 10.1+ | ✅ 16+ |
|
|
649
|
+
| grid-template-columns | ✅ 57+ | ✅ 52+ | ✅ 10.1+ | ✅ 16+ |
|
|
650
|
+
| gap (grid) | ✅ 66+ | ✅ 61+ | ✅ 12+ | ✅ 16+ |
|
|
651
|
+
| CSS clamp() | ✅ 79+ | ✅ 75+ | ✅ 13.1+ | ✅ 79+ |
|
|
652
|
+
| auto-fit/auto-fill | ✅ 57+ | ✅ 52+ | ✅ 10.1+ | ✅ 16+ |
|
|
653
|
+
|
|
654
|
+
**Fallback:** For older browsers without CSS Grid, content stacks vertically.
|
|
655
|
+
|
|
656
|
+
## Accessibility
|
|
657
|
+
|
|
658
|
+
### Semantic HTML
|
|
659
|
+
|
|
660
|
+
Use appropriate elements via the `as` prop:
|
|
661
|
+
|
|
662
|
+
```tsx
|
|
663
|
+
<Grid as="section"> {/* <section> for content sections */}
|
|
664
|
+
<Grid as="ul"> {/* <ul> for lists */}
|
|
665
|
+
<Grid as="article"> {/* <article> for independent content */}
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Focus Order
|
|
669
|
+
|
|
670
|
+
CSS Grid maintains DOM order for keyboard navigation:
|
|
671
|
+
|
|
672
|
+
```tsx
|
|
673
|
+
<Grid columns={3} gap="md">
|
|
674
|
+
<button>First</button> {/* Tab order: 1 */}
|
|
675
|
+
<button>Second</button> {/* Tab order: 2 */}
|
|
676
|
+
<button>Third</button> {/* Tab order: 3 */}
|
|
677
|
+
</Grid>
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
Even with grid-column spans, focus order follows DOM structure.
|
|
681
|
+
|
|
682
|
+
### Screen Readers
|
|
683
|
+
|
|
684
|
+
Provide ARIA labels for non-semantic containers:
|
|
685
|
+
|
|
686
|
+
```tsx
|
|
687
|
+
<Grid columns={3} aria-label="Product catalog">
|
|
688
|
+
{products.map(product => (
|
|
689
|
+
<article key={product.id}>...</article>
|
|
690
|
+
))}
|
|
691
|
+
</Grid>
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
## Migration from Legacy Styles
|
|
695
|
+
|
|
696
|
+
### From Float Layouts
|
|
697
|
+
|
|
698
|
+
**Before:**
|
|
699
|
+
```css
|
|
700
|
+
.grid {
|
|
701
|
+
overflow: auto; /* Clearfix */
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.grid > * {
|
|
705
|
+
float: left;
|
|
706
|
+
width: 33.333%;
|
|
707
|
+
padding: 1rem;
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
**After:**
|
|
712
|
+
```tsx
|
|
713
|
+
<Grid columns={3} gap="md">
|
|
714
|
+
<div>Item</div>
|
|
715
|
+
</Grid>
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### From Flexbox Grids
|
|
719
|
+
|
|
720
|
+
**Before:**
|
|
721
|
+
```css
|
|
722
|
+
.grid {
|
|
723
|
+
display: flex;
|
|
724
|
+
flex-wrap: wrap;
|
|
725
|
+
gap: 1rem;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
.grid > * {
|
|
729
|
+
flex: 0 0 calc(33.333% - 1rem);
|
|
730
|
+
}
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
**After:**
|
|
734
|
+
```tsx
|
|
735
|
+
<Grid columns={3} gap="md">
|
|
736
|
+
<div>Item</div>
|
|
737
|
+
</Grid>
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### From Table Layouts
|
|
741
|
+
|
|
742
|
+
**Before:**
|
|
743
|
+
```html
|
|
744
|
+
<table>
|
|
745
|
+
<tr>
|
|
746
|
+
<td>Cell 1</td>
|
|
747
|
+
<td>Cell 2</td>
|
|
748
|
+
</tr>
|
|
749
|
+
</table>
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
**After:**
|
|
753
|
+
```tsx
|
|
754
|
+
<Grid columns={2} gap="md">
|
|
755
|
+
<div>Cell 1</div>
|
|
756
|
+
<div>Cell 2</div>
|
|
757
|
+
</Grid>
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
## Related Documentation
|
|
761
|
+
|
|
762
|
+
- **README.mdx** - Component usage and patterns
|
|
763
|
+
- **grid.stories.tsx** - Interactive examples
|
|
764
|
+
- **grid.test.tsx** - Unit tests and behavior
|
|
765
|
+
- **_globals.scss** - Global spacing scale definitions
|
|
766
|
+
|
|
767
|
+
## Version History
|
|
768
|
+
|
|
769
|
+
- **v0.5.11** - Initial release of Grid component
|
|
770
|
+
- 12-column system
|
|
771
|
+
- Auto-fit/auto-fill support
|
|
772
|
+
- Grid.Item sub-component
|
|
773
|
+
- Unified spacing scale
|
|
774
|
+
- Comprehensive tests and documentation
|
|
775
|
+
|
|
776
|
+
## Resources
|
|
777
|
+
|
|
778
|
+
- **CSS Grid Guide:** [MDN CSS Grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout)
|
|
779
|
+
- **CSS clamp():** [MDN clamp()](https://developer.mozilla.org/en-US/docs/Web/CSS/clamp)
|
|
780
|
+
- **Auto-Fit vs Auto-Fill:** [CSS-Tricks Guide](https://css-tricks.com/auto-sizing-columns-css-grid-auto-fill-vs-auto-fit/)
|
|
781
|
+
- **Spacing Scale:** See `_globals.scss` for complete scale
|
|
782
|
+
|
|
783
|
+
## License
|
|
784
|
+
|
|
785
|
+
MIT
|