@fpkit/acss 3.1.1 → 3.2.1

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 (204) hide show
  1. package/libs/{chunk-2NRIP6RB.cjs → chunk-2C3YLBWP.cjs} +3 -3
  2. package/libs/{chunk-NWJDAHP6.cjs → chunk-2GJHKWEK.cjs} +3 -3
  3. package/libs/{chunk-FVROL3V5.js → chunk-2JCDEC32.js} +3 -3
  4. package/libs/{chunk-IRLFZ3OL.js → chunk-3XJC4XUG.js} +2 -2
  5. package/libs/{chunk-L6PRDL6F.cjs → chunk-5CJPTDK3.cjs} +3 -3
  6. package/libs/{chunk-E4OSROCA.cjs → chunk-5QSNJQVH.cjs} +3 -3
  7. package/libs/{chunk-O3JIHC5M.cjs → chunk-6BUJZ4DJ.cjs} +3 -3
  8. package/libs/{chunk-WXBFBWYF.cjs → chunk-AFINOD2L.cjs} +3 -3
  9. package/libs/{chunk-HRRHPLER.js → chunk-AWZLSWDO.js} +2 -2
  10. package/libs/chunk-DDSXKOUB.js +7 -0
  11. package/libs/chunk-DDSXKOUB.js.map +1 -0
  12. package/libs/{chunk-CWRNJA4P.js → chunk-DIJBIOFE.js} +3 -3
  13. package/libs/chunk-EJ6KYBFE.cjs +13 -0
  14. package/libs/chunk-EJ6KYBFE.cjs.map +1 -0
  15. package/libs/{chunk-GUJSMQ3V.cjs → chunk-EKJYOCLY.cjs} +3 -3
  16. package/libs/{chunk-X5RKCLDC.cjs → chunk-F64GE6RG.cjs} +4 -4
  17. package/libs/{chunk-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
  18. package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
  19. package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
  20. package/libs/{chunk-MPTMPBFT.js → chunk-M7JLT62Q.js} +2 -2
  21. package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
  22. package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
  23. package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
  24. package/libs/chunk-OU52NIKA.js +8 -0
  25. package/libs/chunk-OU52NIKA.js.map +1 -0
  26. package/libs/{chunk-43TK2ICH.js → chunk-PMWL5XZ4.js} +3 -3
  27. package/libs/{chunk-KVKQLRJG.js → chunk-TF3GQKOY.js} +2 -2
  28. package/libs/{chunk-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
  29. package/libs/{chunk-EE3ZWSBY.cjs → chunk-URBGDUFN.cjs} +6 -6
  30. package/libs/chunk-WWPLBWCQ.cjs +18 -0
  31. package/libs/chunk-WWPLBWCQ.cjs.map +1 -0
  32. package/libs/{chunk-TPIB3RQP.js → chunk-ZF6Y7W57.js} +5 -5
  33. package/libs/component-props-50e69975.d.ts +66 -0
  34. package/libs/components/box/box.css +1 -0
  35. package/libs/components/box/box.css.map +1 -0
  36. package/libs/components/box/box.min.css +3 -0
  37. package/libs/components/breadcrumbs/breadcrumb.cjs +6 -6
  38. package/libs/components/breadcrumbs/breadcrumb.js +3 -3
  39. package/libs/components/button.cjs +4 -4
  40. package/libs/components/button.d.cts +10 -3
  41. package/libs/components/button.d.ts +10 -3
  42. package/libs/components/button.js +2 -2
  43. package/libs/components/card.cjs +7 -7
  44. package/libs/components/card.d.cts +13 -85
  45. package/libs/components/card.d.ts +13 -85
  46. package/libs/components/card.js +2 -2
  47. package/libs/components/cards/card.css +1 -1
  48. package/libs/components/cards/card.css.map +1 -1
  49. package/libs/components/cards/card.min.css +2 -2
  50. package/libs/components/cluster/cluster.css +1 -0
  51. package/libs/components/cluster/cluster.css.map +1 -0
  52. package/libs/components/cluster/cluster.min.css +3 -0
  53. package/libs/components/dialog/dialog.cjs +7 -7
  54. package/libs/components/dialog/dialog.js +5 -5
  55. package/libs/components/form/fields.cjs +4 -4
  56. package/libs/components/form/fields.js +2 -2
  57. package/libs/components/form/textarea.cjs +4 -4
  58. package/libs/components/form/textarea.js +2 -2
  59. package/libs/components/grid/grid.css +1 -0
  60. package/libs/components/grid/grid.css.map +1 -0
  61. package/libs/components/grid/grid.min.css +3 -0
  62. package/libs/components/heading/heading.cjs +3 -3
  63. package/libs/components/heading/heading.js +2 -2
  64. package/libs/components/icons/icon.cjs +4 -4
  65. package/libs/components/icons/icon.d.cts +2 -2
  66. package/libs/components/icons/icon.d.ts +2 -2
  67. package/libs/components/icons/icon.js +2 -2
  68. package/libs/components/link/link.cjs +6 -6
  69. package/libs/components/link/link.js +2 -2
  70. package/libs/components/list/list.cjs +5 -5
  71. package/libs/components/list/list.js +2 -2
  72. package/libs/components/modal.cjs +4 -4
  73. package/libs/components/modal.d.cts +1 -1
  74. package/libs/components/modal.d.ts +1 -1
  75. package/libs/components/modal.js +3 -3
  76. package/libs/components/nav/nav.cjs +7 -7
  77. package/libs/components/nav/nav.js +3 -3
  78. package/libs/components/stack/stack.css +1 -0
  79. package/libs/components/stack/stack.css.map +1 -0
  80. package/libs/components/stack/stack.min.css +3 -0
  81. package/libs/components/tables/table.d.cts +1 -1
  82. package/libs/components/tables/table.d.ts +1 -1
  83. package/libs/components/text/text.cjs +5 -5
  84. package/libs/components/text/text.js +2 -2
  85. package/libs/hooks.cjs +4 -4
  86. package/libs/hooks.js +3 -3
  87. package/libs/{icons-287fce3a.d.ts → icons-df8e744f.d.ts} +1 -1
  88. package/libs/icons.cjs +3 -3
  89. package/libs/icons.d.cts +2 -2
  90. package/libs/icons.d.ts +2 -2
  91. package/libs/icons.js +2 -2
  92. package/libs/index.cjs +64 -63
  93. package/libs/index.cjs.map +1 -1
  94. package/libs/index.css +1 -1
  95. package/libs/index.css.map +1 -1
  96. package/libs/index.d.cts +923 -4
  97. package/libs/index.d.ts +923 -4
  98. package/libs/index.js +28 -28
  99. package/libs/index.js.map +1 -1
  100. package/package.json +2 -2
  101. package/src/components/alert/STYLES.mdx +790 -0
  102. package/src/components/badge/STYLES.mdx +610 -0
  103. package/src/components/box/README.mdx +401 -0
  104. package/src/components/box/STYLES.mdx +360 -0
  105. package/src/components/box/box.scss +245 -0
  106. package/src/components/box/box.stories.tsx +395 -0
  107. package/src/components/box/box.test.tsx +425 -0
  108. package/src/components/box/box.tsx +170 -0
  109. package/src/components/box/box.types.ts +166 -0
  110. package/src/components/breadcrumbs/STYLES.mdx +99 -0
  111. package/src/components/buttons/STYLES.mdx +766 -0
  112. package/src/components/cards/STYLES.mdx +835 -0
  113. package/src/components/cards/card.scss +30 -21
  114. package/src/components/cards/card.stories.tsx +120 -80
  115. package/src/components/cards/card.tsx +14 -4
  116. package/src/components/cards/card.types.ts +13 -0
  117. package/src/components/cluster/README.mdx +595 -0
  118. package/src/components/cluster/STYLES.mdx +626 -0
  119. package/src/components/cluster/cluster.scss +86 -0
  120. package/src/components/cluster/cluster.stories.tsx +385 -0
  121. package/src/components/cluster/cluster.test.tsx +655 -0
  122. package/src/components/cluster/cluster.tsx +94 -0
  123. package/src/components/cluster/cluster.types.ts +75 -0
  124. package/src/components/details/STYLES.mdx +445 -0
  125. package/src/components/dialog/STYLES.mdx +888 -0
  126. package/src/components/flexbox/STYLES.mdx +1 -1
  127. package/src/components/form/STYLES.mdx +821 -0
  128. package/src/components/grid/README.mdx +709 -0
  129. package/src/components/grid/STYLES.mdx +785 -0
  130. package/src/components/grid/grid.scss +287 -0
  131. package/src/components/grid/grid.stories.tsx +486 -0
  132. package/src/components/grid/grid.test.tsx +981 -0
  133. package/src/components/grid/grid.tsx +222 -0
  134. package/src/components/grid/grid.types.ts +344 -0
  135. package/src/components/icons/STYLES.mdx +56 -0
  136. package/src/components/images/STYLES.mdx +75 -0
  137. package/src/components/layout/STYLES.mdx +556 -0
  138. package/src/components/link/STYLES.mdx +75 -0
  139. package/src/components/list/STYLES.mdx +631 -0
  140. package/src/components/nav/STYLES.mdx +460 -0
  141. package/src/components/progress/STYLES.mdx +64 -0
  142. package/src/components/stack/README.mdx +400 -0
  143. package/src/components/stack/STYLES.mdx +414 -0
  144. package/src/components/stack/stack.scss +109 -0
  145. package/src/components/stack/stack.stories.tsx +559 -0
  146. package/src/components/stack/stack.test.tsx +426 -0
  147. package/src/components/stack/stack.tsx +141 -0
  148. package/src/components/stack/stack.types.ts +133 -0
  149. package/src/components/tag/STYLES.mdx +105 -0
  150. package/src/components/text-to-speech/STYLES.mdx +80 -0
  151. package/src/components/ui.tsx +3 -3
  152. package/src/index.scss +7 -2
  153. package/src/index.ts +305 -12
  154. package/src/sass/GLOBALS-STYLES.md +631 -0
  155. package/src/sass/_globals.scss +45 -24
  156. package/src/sass/_styles.scss +2 -2
  157. package/src/styles/box/box.css +220 -0
  158. package/src/styles/box/box.css.map +1 -0
  159. package/src/styles/cards/card.css +23 -17
  160. package/src/styles/cards/card.css.map +1 -1
  161. package/src/styles/cluster/cluster.css +71 -0
  162. package/src/styles/cluster/cluster.css.map +1 -0
  163. package/src/styles/grid/grid.css +238 -0
  164. package/src/styles/grid/grid.css.map +1 -0
  165. package/src/styles/index.css +668 -49
  166. package/src/styles/index.css.map +1 -1
  167. package/src/styles/stack/stack.css +86 -0
  168. package/src/styles/stack/stack.css.map +1 -0
  169. package/src/types/component-props.ts +42 -14
  170. package/src/types/layout-primitives.ts +48 -0
  171. package/src/types/shared.ts +10 -26
  172. package/libs/chunk-ENTCUJ3A.cjs +0 -13
  173. package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
  174. package/libs/chunk-HHLNOC5T.js +0 -7
  175. package/libs/chunk-HHLNOC5T.js.map +0 -1
  176. package/libs/chunk-KK47SYZI.js +0 -8
  177. package/libs/chunk-KK47SYZI.js.map +0 -1
  178. package/libs/chunk-W5TKWBFC.cjs +0 -18
  179. package/libs/chunk-W5TKWBFC.cjs.map +0 -1
  180. package/libs/component-props-67d978a2.d.ts +0 -38
  181. /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
  182. /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
  183. /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
  184. /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
  185. /package/libs/{chunk-L6PRDL6F.cjs.map → chunk-5CJPTDK3.cjs.map} +0 -0
  186. /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
  187. /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
  188. /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
  189. /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
  190. /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
  191. /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
  192. /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
  193. /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
  194. /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
  195. /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
  196. /package/libs/{chunk-MPTMPBFT.js.map → chunk-M7JLT62Q.js.map} +0 -0
  197. /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
  198. /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
  199. /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
  200. /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
  201. /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
  202. /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
  203. /package/libs/{chunk-EE3ZWSBY.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
  204. /package/libs/{chunk-TPIB3RQP.js.map → chunk-ZF6Y7W57.js.map} +0 -0
@@ -0,0 +1,709 @@
1
+ import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
2
+ import * as GridStories from './grid.stories';
3
+
4
+ <Meta of={GridStories} />
5
+
6
+ # Grid
7
+
8
+ A CSS Grid-based layout primitive for responsive multi-column layouts with Grid.Item sub-component.
9
+
10
+ ## Overview
11
+
12
+ Grid provides a powerful, declarative API for creating CSS Grid layouts with explicit column control (1-12 columns), auto-fit/auto-fill responsive behavior, gap spacing, and alignment options. The Grid.Item sub-component enables flexible column and row spanning for complex layouts.
13
+
14
+ **Key Characteristics:**
15
+ - **CSS Grid**: True 2D layout with rows and columns
16
+ - **12-Column System**: Explicit column layouts from 1-12 columns
17
+ - **Auto-Fit/Auto-Fill**: Responsive grids without media queries
18
+ - **Grid.Item**: Sub-component with column/row span control
19
+ - **Fluid Spacing**: Gap spacing using CSS custom properties with clamp()
20
+ - **Zero Runtime**: All styling via utility classes (no JavaScript)
21
+
22
+ ## When to Use
23
+
24
+ ### ✅ Use Grid for:
25
+ - **Card Grids**: Multi-column layouts for cards, products, posts
26
+ - **Dashboard Layouts**: Complex layouts with varying column spans
27
+ - **Responsive Layouts**: Main content + sidebar with explicit column control
28
+ - **Image Galleries**: Photo grids with consistent aspect ratios
29
+ - **Form Layouts**: Label + input pairs in 2-column layouts
30
+
31
+ ### ❌ Don't Use Grid for:
32
+ - **Simple Vertical Layouts**: Use `Stack` for simple vertical stacking
33
+ - **Inline Groups that Wrap**: Use `Cluster` for tags, badges, buttons
34
+ - **Single Row Layouts**: Use `Stack direction="horizontal"` or `Cluster`
35
+ - **Containers with Padding Only**: Use `Box` for padding/margin control
36
+
37
+ ## Usage
38
+
39
+ ### Basic 3-Column Grid
40
+
41
+ ```tsx
42
+ import { Grid } from '@fpkit/acss';
43
+
44
+ <Grid columns={3} gap="md">
45
+ <div>Card 1</div>
46
+ <div>Card 2</div>
47
+ <div>Card 3</div>
48
+ <div>Card 4</div>
49
+ <div>Card 5</div>
50
+ <div>Card 6</div>
51
+ </Grid>
52
+ ```
53
+
54
+ ### Auto-Fit Responsive Grid
55
+
56
+ ```tsx
57
+ <Grid auto="fit" minColumnWidth="15rem" gap="lg">
58
+ <div>Card 1</div>
59
+ <div>Card 2</div>
60
+ <div>Card 3</div>
61
+ </Grid>
62
+ ```
63
+
64
+ ### Two-Column Layout (Main + Sidebar)
65
+
66
+ ```tsx
67
+ <Grid columns={12} gap="lg">
68
+ <Grid.Item span={8}>
69
+ <article>Main content (8/12 columns)</article>
70
+ </Grid.Item>
71
+ <Grid.Item span={4}>
72
+ <aside>Sidebar (4/12 columns)</aside>
73
+ </Grid.Item>
74
+ </Grid>
75
+ ```
76
+
77
+ ### Dashboard with Mixed Spans
78
+
79
+ ```tsx
80
+ <Grid columns={12} gap="md">
81
+ <Grid.Item span={12}>Header (full width)</Grid.Item>
82
+ <Grid.Item span={4}>Sidebar</Grid.Item>
83
+ <Grid.Item span={8}>Main content</Grid.Item>
84
+ <Grid.Item span={4}>Card 1</Grid.Item>
85
+ <Grid.Item span={4}>Card 2</Grid.Item>
86
+ <Grid.Item span={4}>Card 3</Grid.Item>
87
+ </Grid>
88
+ ```
89
+
90
+ ### Image Gallery
91
+
92
+ ```tsx
93
+ <Grid columns={4} gap="sm">
94
+ {images.map((img) => (
95
+ <img key={img.id} src={img.url} alt={img.alt} />
96
+ ))}
97
+ </Grid>
98
+ ```
99
+
100
+ ## Props
101
+
102
+ ### Grid Component
103
+
104
+ #### `columns`
105
+ **Type:** `GridColumns` (`1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12`)
106
+ **Default:** `undefined`
107
+
108
+ Number of columns in the grid. Creates an explicit column layout with equal-width columns. Mutually exclusive with `auto` prop.
109
+
110
+ **Usage:**
111
+
112
+ ```tsx
113
+ <Grid columns={3}>3 equal columns</Grid>
114
+ <Grid columns={12}>12-column system</Grid>
115
+ ```
116
+
117
+ #### `auto`
118
+ **Type:** `"fit" | "fill"`
119
+ **Default:** `undefined`
120
+
121
+ Auto-fit or auto-fill behavior for responsive grids. Requires `minColumnWidth` to be set.
122
+
123
+ - `fit`: Columns expand to fill available space
124
+ - `fill`: Creates as many columns as fit, even if empty
125
+
126
+ **Usage:**
127
+
128
+ ```tsx
129
+ <Grid auto="fit" minColumnWidth="15rem" gap="md">
130
+ Responsive grid without media queries
131
+ </Grid>
132
+ ```
133
+
134
+ #### `minColumnWidth`
135
+ **Type:** `string` (rem units)
136
+ **Default:** `undefined`
137
+
138
+ Minimum column width for auto-fit/auto-fill grids. Must be specified in rem units (e.g., "15rem", "20rem"). Used with `auto` prop.
139
+
140
+ **Usage:**
141
+
142
+ ```tsx
143
+ <Grid auto="fit" minColumnWidth="15rem">
144
+ Columns minimum 15rem wide
145
+ </Grid>
146
+ ```
147
+
148
+ #### `gap`
149
+ **Type:** `SpacingScale` (`"0" | "xs" | "sm" | "md" | "lg" | "xl"`)
150
+ **Default:** `undefined` (uses default `.grid` gap)
151
+
152
+ Gap spacing between all grid items (both rows and columns). Uses the unified spacing scale.
153
+
154
+ **CSS Variable Mapping:**
155
+ - `0` → `--spacing-0` (0)
156
+ - `xs` → `--spacing-xs` (clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem))
157
+ - `sm` → `--spacing-sm` (clamp(0.5rem, 0.45rem + 0.35vw, 0.75rem))
158
+ - `md` → `--spacing-md` (clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem))
159
+ - `lg` → `--spacing-lg` (clamp(1rem, 0.85rem + 0.6vw, 1.5rem))
160
+ - `xl` → `--spacing-xl` (clamp(1.5rem, 1.25rem + 0.75vw, 2rem))
161
+
162
+ **Usage:**
163
+
164
+ ```tsx
165
+ <Grid columns={3} gap="md">Medium gap (12-18px)</Grid>
166
+ <Grid columns={4} gap="lg">Large gap (16-24px)</Grid>
167
+ ```
168
+
169
+ #### `gapX`
170
+ **Type:** `SpacingScale` (`"0" | "xs" | "sm" | "md" | "lg" | "xl"`)
171
+ **Default:** `undefined`
172
+
173
+ Horizontal gap spacing (column gap). Overrides `gap` for horizontal spacing only. Uses the unified spacing scale.
174
+
175
+ **Usage:**
176
+
177
+ ```tsx
178
+ <Grid columns={3} gapX="lg" gapY="sm">
179
+ Wide columns, tight rows
180
+ </Grid>
181
+ ```
182
+
183
+ #### `gapY`
184
+ **Type:** `SpacingScale` (`"0" | "xs" | "sm" | "md" | "lg" | "xl"`)
185
+ **Default:** `undefined`
186
+
187
+ Vertical gap spacing (row gap). Overrides `gap` for vertical spacing only. Uses the unified spacing scale.
188
+
189
+ **Usage:**
190
+
191
+ ```tsx
192
+ <Grid columns={3} gapX="sm" gapY="xl">
193
+ Tight columns, tall rows
194
+ </Grid>
195
+ ```
196
+
197
+ #### `justifyItems`
198
+ **Type:** `"start" | "center" | "end" | "stretch"`
199
+ **Default:** `undefined` (defaults to `stretch`)
200
+
201
+ Horizontal alignment of grid items within their grid cells (justify-items).
202
+
203
+ **Usage:**
204
+
205
+ ```tsx
206
+ <Grid columns={3} justifyItems="center">
207
+ Items centered horizontally in cells
208
+ </Grid>
209
+ ```
210
+
211
+ #### `alignItems`
212
+ **Type:** `"start" | "center" | "end" | "stretch"`
213
+ **Default:** `undefined` (defaults to `stretch`)
214
+
215
+ Vertical alignment of grid items within their grid cells (align-items).
216
+
217
+ **Usage:**
218
+
219
+ ```tsx
220
+ <Grid columns={3} alignItems="center">
221
+ Items centered vertically in cells
222
+ </Grid>
223
+ ```
224
+
225
+ #### `as`
226
+ **Type:** `GridElement` (`"div" | "section" | "article" | "ul" | "ol"`)
227
+ **Default:** `"div"`
228
+
229
+ Polymorphic prop to render the Grid as any semantic HTML element.
230
+
231
+ **Usage:**
232
+
233
+ ```tsx
234
+ <Grid as="section" columns={3}>Semantic section</Grid>
235
+ <Grid as="ul" columns={2}>Unordered list grid</Grid>
236
+ ```
237
+
238
+ #### `className` / `classes`
239
+ **Type:** `string`
240
+ **Default:** `undefined`
241
+
242
+ Additional CSS classes to merge with utility classes.
243
+
244
+ **Usage:**
245
+
246
+ ```tsx
247
+ <Grid className="custom-grid" columns={3}>Content</Grid>
248
+ ```
249
+
250
+ #### `styles` / `style`
251
+ **Type:** `React.CSSProperties`
252
+ **Default:** `undefined`
253
+
254
+ Inline styles for custom styling or CSS custom property overrides.
255
+
256
+ **Usage:**
257
+
258
+ ```tsx
259
+ <Grid styles={{ maxWidth: '1200px' }} columns={3}>
260
+ Content
261
+ </Grid>
262
+ ```
263
+
264
+ ### Grid.Item Component
265
+
266
+ #### `span`
267
+ **Type:** `GridColumns` (`1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12`)
268
+ **Default:** `1`
269
+
270
+ Number of columns this item should span. Determines the width of the grid item relative to the parent grid's columns.
271
+
272
+ **Usage:**
273
+
274
+ ```tsx
275
+ <Grid columns={12}>
276
+ <Grid.Item span={8}>Main content (8/12)</Grid.Item>
277
+ <Grid.Item span={4}>Sidebar (4/12)</Grid.Item>
278
+ </Grid>
279
+ ```
280
+
281
+ #### `rowSpan`
282
+ **Type:** `number`
283
+ **Default:** `undefined`
284
+
285
+ Number of rows this item should span.
286
+
287
+ **Usage:**
288
+
289
+ ```tsx
290
+ <Grid columns={3}>
291
+ <Grid.Item rowSpan={2}>Tall item (2 rows)</Grid.Item>
292
+ <div>Normal item</div>
293
+ <div>Normal item</div>
294
+ </Grid>
295
+ ```
296
+
297
+ #### `as`
298
+ **Type:** `GridItemElement` (`"div" | "section" | "article" | "li"`)
299
+ **Default:** `"div"`
300
+
301
+ Polymorphic prop to render the Grid.Item as any semantic HTML element.
302
+
303
+ **Usage:**
304
+
305
+ ```tsx
306
+ <Grid as="ul" columns={3}>
307
+ <Grid.Item as="li">List item 1</Grid.Item>
308
+ <Grid.Item as="li">List item 2</Grid.Item>
309
+ </Grid>
310
+ ```
311
+
312
+ ## CSS Classes
313
+
314
+ Grid and Grid.Item generate utility classes based on props:
315
+
316
+ ### Grid Classes
317
+
318
+ **Base:**
319
+ - `.grid` - Base CSS Grid container
320
+
321
+ **Columns:**
322
+ - `.grid-cols-1` to `.grid-cols-12` - Explicit column counts
323
+
324
+ **Auto:**
325
+ - `.grid-auto-fit` - Auto-fit layout (inline style applies grid-template-columns)
326
+ - `.grid-auto-fill` - Auto-fill layout (inline style applies grid-template-columns)
327
+
328
+ **Gap:**
329
+ - `.grid-gap-0` to `.grid-gap-xl` - Overall gap
330
+ - `.grid-gap-x-{scale}` - Column gap
331
+ - `.grid-gap-y-{scale}` - Row gap
332
+
333
+ **Alignment:**
334
+ - `.grid-justify-items-{start|center|end|stretch}` - Horizontal alignment
335
+ - `.grid-align-items-{start|center|end|stretch}` - Vertical alignment
336
+
337
+ ### Grid.Item Classes
338
+
339
+ **Column Span:**
340
+ - `.grid-col-span-1` to `.grid-col-span-12` - Column spanning
341
+
342
+ **Row Span:**
343
+ - `.grid-row-span-1` to `.grid-row-span-6` - Row spanning
344
+
345
+ ## Composition Patterns
346
+
347
+ ### Nested Layout Primitives
348
+
349
+ Combine Grid with other layout primitives:
350
+
351
+ ```tsx
352
+ <Grid columns={3} gap="lg">
353
+ <Box padding="md" radius="md">
354
+ <Stack gap="sm">
355
+ <Title level={3}>Card Title</Title>
356
+ <Text>Card content</Text>
357
+ </Stack>
358
+ </Box>
359
+ </Grid>
360
+ ```
361
+
362
+ ### Responsive Dashboard
363
+
364
+ ```tsx
365
+ <Grid columns={12} gap="md">
366
+ <Grid.Item span={12}>
367
+ <Header />
368
+ </Grid.Item>
369
+
370
+ <Grid.Item span={3}>
371
+ <Sidebar />
372
+ </Grid.Item>
373
+
374
+ <Grid.Item span={9}>
375
+ <Stack gap="lg">
376
+ <Section1 />
377
+ <Section2 />
378
+ </Stack>
379
+ </Grid.Item>
380
+
381
+ <Grid.Item span={12}>
382
+ <Footer />
383
+ </Grid.Item>
384
+ </Grid>
385
+ ```
386
+
387
+ ### Auto-Fit Card Grid
388
+
389
+ ```tsx
390
+ <Grid auto="fit" minColumnWidth="15rem" gap="md">
391
+ {products.map(product => (
392
+ <Card key={product.id}>
393
+ <CardTitle>{product.name}</CardTitle>
394
+ <CardContent>{product.description}</CardContent>
395
+ </Card>
396
+ ))}
397
+ </Grid>
398
+ ```
399
+
400
+ ## Accessibility
401
+
402
+ ### Semantic Elements
403
+
404
+ Use appropriate semantic elements via the `as` prop:
405
+
406
+ ```tsx
407
+ {/* Grid of articles */}
408
+ <Grid as="section" columns={3} aria-label="Featured posts">
409
+ <Grid.Item as="article">
410
+ <h2>Post Title</h2>
411
+ <p>Content</p>
412
+ </Grid.Item>
413
+ </Grid>
414
+
415
+ {/* List grid */}
416
+ <Grid as="ul" columns={4} styles={{ listStyle: 'none' }}>
417
+ <Grid.Item as="li">Item 1</Grid.Item>
418
+ </Grid>
419
+ ```
420
+
421
+ ### ARIA Labels
422
+
423
+ Provide descriptive labels for screen readers:
424
+
425
+ ```tsx
426
+ <Grid columns={3} aria-label="Product catalog">
427
+ {products.map(product => (
428
+ <article key={product.id} aria-labelledby={`product-${product.id}`}>
429
+ <h3 id={`product-${product.id}`}>{product.name}</h3>
430
+ </article>
431
+ ))}
432
+ </Grid>
433
+ ```
434
+
435
+ ### Keyboard Navigation
436
+
437
+ Ensure focusable items within grid cells are keyboard accessible:
438
+
439
+ ```tsx
440
+ <Grid columns={3} gap="md">
441
+ {items.map(item => (
442
+ <button key={item.id} onClick={handleClick}>
443
+ {item.name}
444
+ </button>
445
+ ))}
446
+ </Grid>
447
+ ```
448
+
449
+ ## Comparison with Other Primitives
450
+
451
+ ### Grid vs Cluster
452
+
453
+ | Feature | Grid | Cluster |
454
+ |---------|------|---------|
455
+ | **Layout** | CSS Grid (2D) | Flexbox with wrapping (1D) |
456
+ | **Columns** | Explicit (1-12) or auto-fit | No explicit columns |
457
+ | **Use Case** | Multi-column layouts | Inline groups (tags, buttons) |
458
+ | **Wrapping** | Grid-based | Flex-wrap: wrap |
459
+
460
+ **When to use Grid:**
461
+ - Need explicit column control
462
+ - Multi-row layouts with alignment
463
+ - Equal-width columns
464
+
465
+ **When to use Cluster:**
466
+ - Inline content that wraps naturally
467
+ - Tags, badges, button groups
468
+ - Variable-width items
469
+
470
+ ### Grid vs Stack
471
+
472
+ | Feature | Grid | Stack |
473
+ |---------|------|-------|
474
+ | **Layout** | CSS Grid (2D) | Flexbox (1D) |
475
+ | **Direction** | Both (rows + columns) | Vertical or horizontal |
476
+ | **Use Case** | Multi-column layouts | Linear stacking |
477
+
478
+ **When to use Grid:**
479
+ - Multi-column card grids
480
+ - Dashboard layouts
481
+ - Responsive layouts with column control
482
+
483
+ **When to use Stack:**
484
+ - Simple vertical stacking
485
+ - Horizontal button groups (no wrapping)
486
+ - Form fields in sequence
487
+
488
+ ### Grid vs Flex
489
+
490
+ | Feature | Grid | Flex |
491
+ |---------|------|------|
492
+ | **Layout System** | CSS Grid | Flexbox |
493
+ | **Columns** | Explicit or auto-fit | No explicit columns |
494
+ | **Use Case** | Multi-column grids | Advanced flex layouts |
495
+
496
+ **When to use Grid:**
497
+ - Explicit column layouts
498
+ - Card grids, galleries
499
+ - Dashboard layouts
500
+
501
+ **When to use Flex:**
502
+ - Need all flexbox properties
503
+ - Complex flex alignment
504
+ - Space distribution with flex-grow/shrink
505
+
506
+ ## Design Patterns
507
+
508
+ ### Product Grid
509
+
510
+ ```tsx
511
+ <Grid columns={4} gap="md">
512
+ {products.map(product => (
513
+ <Card key={product.id}>
514
+ <img src={product.image} alt={product.name} />
515
+ <CardTitle>{product.name}</CardTitle>
516
+ <Text>${product.price}</Text>
517
+ <Button>Add to Cart</Button>
518
+ </Card>
519
+ ))}
520
+ </Grid>
521
+ ```
522
+
523
+ ### Blog Layout
524
+
525
+ ```tsx
526
+ <Grid columns={12} gap="lg">
527
+ <Grid.Item span={8}>
528
+ <Stack gap="xl">
529
+ {posts.map(post => (
530
+ <article key={post.id}>
531
+ <Title level={2}>{post.title}</Title>
532
+ <Text>{post.excerpt}</Text>
533
+ </article>
534
+ ))}
535
+ </Stack>
536
+ </Grid.Item>
537
+
538
+ <Grid.Item span={4}>
539
+ <aside>
540
+ <Title level={3}>Recent Posts</Title>
541
+ <List>...</List>
542
+ </aside>
543
+ </Grid.Item>
544
+ </Grid>
545
+ ```
546
+
547
+ ### Form Layout
548
+
549
+ ```tsx
550
+ <Grid columns={2} gap="md" styles={{ maxWidth: '40rem' }}>
551
+ <label htmlFor="name">Name</label>
552
+ <Input id="name" />
553
+
554
+ <label htmlFor="email">Email</label>
555
+ <Input id="email" type="email" />
556
+
557
+ <label htmlFor="message">Message</label>
558
+ <Textarea id="message" rows={4} />
559
+
560
+ <div></div>
561
+ <Button>Submit</Button>
562
+ </Grid>
563
+ ```
564
+
565
+ ### Image Gallery
566
+
567
+ ```tsx
568
+ <Grid columns={3} gap="xs">
569
+ {images.map(img => (
570
+ <div key={img.id} style={{ aspectRatio: '1' }}>
571
+ <img
572
+ src={img.url}
573
+ alt={img.alt}
574
+ style={{ width: '100%', height: '100%', objectFit: 'cover' }}
575
+ />
576
+ </div>
577
+ ))}
578
+ </Grid>
579
+ ```
580
+
581
+ ### Dashboard Layout
582
+
583
+ ```tsx
584
+ <Grid columns={12} gap="md">
585
+ <Grid.Item span={12}>
586
+ <Header>Dashboard</Header>
587
+ </Grid.Item>
588
+
589
+ <Grid.Item span={3}>
590
+ <nav>
591
+ <List>Menu items</List>
592
+ </nav>
593
+ </Grid.Item>
594
+
595
+ <Grid.Item span={9}>
596
+ <Grid columns={3} gap="md">
597
+ <Card>Stat 1</Card>
598
+ <Card>Stat 2</Card>
599
+ <Card>Stat 3</Card>
600
+ </Grid>
601
+ </Grid.Item>
602
+ </Grid>
603
+ ```
604
+
605
+ ## Customization
606
+
607
+ ### CSS Custom Properties
608
+
609
+ Override spacing via CSS custom properties:
610
+
611
+ ```tsx
612
+ <Grid
613
+ columns={3}
614
+ gap="md"
615
+ styles={{
616
+ '--spacing-md': '2rem', // Override default medium gap
617
+ } as React.CSSProperties}
618
+ >
619
+ <div>Item 1</div>
620
+ </Grid>
621
+ ```
622
+
623
+ ### Custom Column Widths
624
+
625
+ Use inline styles for custom grid-template-columns:
626
+
627
+ ```tsx
628
+ <Grid
629
+ styles={{
630
+ gridTemplateColumns: '200px 1fr 200px',
631
+ }}
632
+ gap="md"
633
+ >
634
+ <div>Fixed 200px</div>
635
+ <div>Flexible</div>
636
+ <div>Fixed 200px</div>
637
+ </Grid>
638
+ ```
639
+
640
+ ### Responsive Behavior
641
+
642
+ Combine with media queries or container queries:
643
+
644
+ ```tsx
645
+ <Grid
646
+ columns={4}
647
+ gap="md"
648
+ className="responsive-grid"
649
+ >
650
+ {items.map(item => <Card key={item.id}>{item.name}</Card>)}
651
+ </Grid>
652
+
653
+ <style>
654
+ .responsive-grid {
655
+ grid-template-columns: repeat(4, 1fr);
656
+ }
657
+
658
+ @media (max-width: 768px) {
659
+ .responsive-grid {
660
+ grid-template-columns: repeat(2, 1fr);
661
+ }
662
+ }
663
+
664
+ @media (max-width: 480px) {
665
+ .responsive-grid {
666
+ grid-template-columns: 1fr;
667
+ }
668
+ }
669
+ </style>
670
+ ```
671
+
672
+ ## Performance
673
+
674
+ - **Zero Runtime:** All layout via CSS classes (no JavaScript calculations)
675
+ - **Fluid Spacing:** CSS clamp() for responsive gaps without media queries
676
+ - **Minimal Footprint:** ~1KB gzipped for all utility classes
677
+ - **No Re-renders:** Static utility classes don't cause re-renders
678
+
679
+ ## Browser Support
680
+
681
+ - **CSS Grid:** Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+
682
+ - **CSS clamp():** Chrome 79+, Firefox 75+, Safari 13.1+
683
+ - **Gap Property:** Chrome 66+, Firefox 61+, Safari 12+
684
+
685
+ ## Related Components
686
+
687
+ - **Stack:** Vertical/horizontal flexbox layouts without explicit columns
688
+ - **Cluster:** Wrapping flex for inline groups (tags, buttons)
689
+ - **Box:** Container with padding/margin/sizing control
690
+ - **Flex:** Advanced flexbox layouts with all flex properties
691
+
692
+ ## Examples
693
+
694
+ <Canvas of={GridStories.Default} />
695
+ <Canvas of={GridStories.TwoColumn} />
696
+ <Canvas of={GridStories.AutoFit} />
697
+ <Canvas of={GridStories.Dashboard} />
698
+
699
+ ## API Reference
700
+
701
+ See the [STYLES.mdx](./STYLES.mdx) documentation for complete CSS custom properties reference.
702
+
703
+ ## Version
704
+
705
+ Available since `@fpkit/acss` v0.5.11
706
+
707
+ ## License
708
+
709
+ MIT