@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,324 @@
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
+ import * as RowStories from "./row.stories";
3
+
4
+ <Meta of={RowStories} />
5
+
6
+ # Row
7
+
8
+ A flex container component for building responsive 12-column layouts with
9
+ customizable spacing, alignment, and wrapping behavior.
10
+
11
+ ## Overview
12
+
13
+ Row provides a type-safe React wrapper around the `.col-row` utility class,
14
+ serving as the container element for column-based layouts. It always includes
15
+ the base `.col-row` class and adds variant utilities based on props.
16
+
17
+ ## Key Features
18
+
19
+ - **Flex Container**: Uses `display: flex` with `flex-wrap: wrap` by default
20
+ - **Customizable Gap**: Control spacing between columns with the `gap` prop
21
+ - **Alignment Control**: Horizontal (`justify`) and vertical (`align`) alignment
22
+ options
23
+ - **Polymorphic**: Render as any semantic HTML element via the `as` prop
24
+ - **Type-Safe**: Full TypeScript support with literal types for all props
25
+ - **Mobile-First**: Columns automatically stack on mobile (`<768px`) and flow
26
+ horizontally on desktop
27
+
28
+ ## When to Use
29
+
30
+ Use Row when you need:
31
+
32
+ - Multi-column layouts (2-column, 3-column, etc.)
33
+ - Responsive grid systems that adapt to viewport size
34
+ - Card grids with consistent spacing
35
+ - Dashboard layouts with multiple content areas
36
+ - Form layouts with side-by-side fields
37
+
38
+ ## Props
39
+
40
+ ### gap
41
+
42
+ Controls spacing between columns. Maps to CSS custom property `--spacing-*`.
43
+
44
+ - **Type**: `"0" | "xs" | "sm" | "md" | "lg" | "xl"`
45
+ - **Default**: `undefined` (uses `.col-row` default gap)
46
+ - **CSS Class**: `.col-row-gap-{size}`
47
+
48
+ ### justify
49
+
50
+ Horizontal alignment of columns (maps to `justify-content`).
51
+
52
+ - **Type**: `"start" | "center" | "end" | "between" | "around" | "evenly"`
53
+ - **Default**: `undefined` (flex-start)
54
+ - **CSS Class**: `.col-row-justify-{value}`
55
+
56
+ ### align
57
+
58
+ Vertical alignment of columns (maps to `align-items`).
59
+
60
+ - **Type**: `"start" | "center" | "end" | "baseline" | "stretch"`
61
+ - **Default**: `undefined` (stretch)
62
+ - **CSS Class**: `.col-row-align-{value}`
63
+
64
+ ### wrap
65
+
66
+ Flex wrap behavior.
67
+
68
+ - **Type**: `"wrap" | "nowrap" | "wrap-reverse"`
69
+ - **Default**: `"wrap"`
70
+ - **CSS Class**: `.col-row-{value}` (only added if not "wrap")
71
+
72
+ ### as
73
+
74
+ Element type to render. Supports semantic HTML elements.
75
+
76
+ - **Type**: `"div" | "section" | "article" | "ul" | "ol" | "nav"`
77
+ - **Default**: `"div"`
78
+
79
+ ### className
80
+
81
+ Additional CSS classes to merge with utility classes.
82
+
83
+ - **Type**: `string`
84
+ - **Default**: `undefined`
85
+
86
+ ## Basic Usage
87
+
88
+ ```jsx
89
+ import { Row, Col } from "@fpkit/acss";
90
+
91
+ function MyLayout() {
92
+ return (
93
+ <Row>
94
+ <Col span={6}>Left column (50%)</Col>
95
+ <Col span={6}>Right column (50%)</Col>
96
+ </Row>
97
+ );
98
+ }
99
+ ```
100
+
101
+ ## Examples
102
+
103
+ ### Two-Column Layout
104
+
105
+ ```jsx
106
+ <Row gap="md">
107
+ <Col span={6}>
108
+ <h3>Column 1</h3>
109
+ <p>Content for the first column</p>
110
+ </Col>
111
+ <Col span={6}>
112
+ <h3>Column 2</h3>
113
+ <p>Content for the second column</p>
114
+ </Col>
115
+ </Row>
116
+ ```
117
+
118
+ ### Centered Content
119
+
120
+ ```jsx
121
+ <Row justify="center" align="center" gap="lg">
122
+ <Col span={4}>Centered column 1</Col>
123
+ <Col span={4}>Centered column 2</Col>
124
+ <Col span={4}>Centered column 3</Col>
125
+ </Row>
126
+ ```
127
+
128
+ ### Responsive Grid
129
+
130
+ ```jsx
131
+ <Row gap="md">
132
+ <Col span={12} className="col-md-4">
133
+ 100% mobile, 33% desktop
134
+ </Col>
135
+ <Col span={12} className="col-md-4">
136
+ 100% mobile, 33% desktop
137
+ </Col>
138
+ <Col span={12} className="col-md-4">
139
+ 100% mobile, 33% desktop
140
+ </Col>
141
+ </Row>
142
+ ```
143
+
144
+ ### Semantic HTML List
145
+
146
+ ```jsx
147
+ <Row as="ul" gap="sm">
148
+ <Col as="li" span={4}>
149
+ Item 1
150
+ </Col>
151
+ <Col as="li" span={4}>
152
+ Item 2
153
+ </Col>
154
+ <Col as="li" span={4}>
155
+ Item 3
156
+ </Col>
157
+ </Row>
158
+ ```
159
+
160
+ ## Accessibility
161
+
162
+ ### Semantic HTML
163
+
164
+ Use the `as` prop to render Row with appropriate semantic elements:
165
+
166
+ - `<nav>` for navigation layouts
167
+ - `<section>` or `<article>` for content sections
168
+ - `<ul>` or `<ol>` for lists of items
169
+
170
+ ```jsx
171
+ <Row as="nav" aria-label="Main navigation">
172
+ <Col span={12}>...</Col>
173
+ </Row>
174
+ ```
175
+
176
+ ### Landmark Regions
177
+
178
+ When using Row for page layout, ensure proper landmark structure:
179
+
180
+ ```jsx
181
+ <Row as="section" aria-labelledby="features-heading">
182
+ <Col span={12}>
183
+ <h2 id="features-heading">Features</h2>
184
+ </Col>
185
+ <Col span={4}>Feature 1</Col>
186
+ <Col span={4}>Feature 2</Col>
187
+ <Col span={4}>Feature 3</Col>
188
+ </Row>
189
+ ```
190
+
191
+ ### Focus Order
192
+
193
+ Row maintains natural DOM order for keyboard navigation. Visual reordering (via
194
+ Col's `order` prop) does not affect focus order, ensuring keyboard users
195
+ navigate in a logical sequence.
196
+
197
+ ## Responsive Behavior
198
+
199
+ Row uses a **mobile-first** approach where columns stack vertically on small
200
+ screens and flow horizontally on larger screens:
201
+
202
+ - **Mobile** (`<768px`): Columns are 100% width and stack vertically
203
+ - **Desktop** (`≥768px`): Columns use their specified span values and flow
204
+ horizontally
205
+
206
+ Control responsive behavior using responsive utility classes on Col:
207
+
208
+ ```jsx
209
+ <Row>
210
+ <Col span={12} className="col-md-6 col-lg-4">
211
+ {/* 100% mobile, 50% tablet, 33% desktop */}
212
+ </Col>
213
+ </Row>
214
+ ```
215
+
216
+ ## Advanced Patterns
217
+
218
+ ### Complex Layouts
219
+
220
+ Combine multiple Row props for sophisticated layouts:
221
+
222
+ ```jsx
223
+ <Row gap="xl" justify="between" align="stretch">
224
+ <Col span={3}>Sidebar</Col>
225
+ <Col span={6}>Main content</Col>
226
+ <Col span={3}>Aside</Col>
227
+ </Row>
228
+ ```
229
+
230
+ ### Nested Rows
231
+
232
+ Rows can be nested for complex grid structures:
233
+
234
+ ```jsx
235
+ <Row gap="lg">
236
+ <Col span={12}>
237
+ <h2>Section Title</h2>
238
+ </Col>
239
+ <Col span={6}>
240
+ <Row gap="sm">
241
+ <Col span={6}>Nested 1</Col>
242
+ <Col span={6}>Nested 2</Col>
243
+ </Row>
244
+ </Col>
245
+ <Col span={6}>Content</Col>
246
+ </Row>
247
+ ```
248
+
249
+ ### Dashboard Layout
250
+
251
+ ```jsx
252
+ <Row gap="md" align="stretch">
253
+ <Col span={12} className="col-lg-8">
254
+ <Card>Main chart</Card>
255
+ </Col>
256
+ <Col span={12} className="col-lg-4">
257
+ <Card>Side panel</Card>
258
+ </Col>
259
+ <Col span={6} className="col-lg-3">
260
+ <Card>Metric 1</Card>
261
+ </Col>
262
+ <Col span={6} className="col-lg-3">
263
+ <Card>Metric 2</Card>
264
+ </Col>
265
+ <Col span={6} className="col-lg-3">
266
+ <Card>Metric 3</Card>
267
+ </Col>
268
+ <Col span={6} className="col-lg-3">
269
+ <Card>Metric 4</Card>
270
+ </Col>
271
+ </Row>
272
+ ```
273
+
274
+ ## Related Components
275
+
276
+ - **Col** - Column component used within Row for responsive layouts
277
+ - **Grid** - Alternative grid system using CSS Grid
278
+ - **Flex** - Low-level flexbox utility component
279
+
280
+ ## Best Practices
281
+
282
+ 1. **Always use Row with Col**: Row is designed to contain Col components
283
+ 2. **Choose semantic elements**: Use `as` prop for appropriate HTML elements
284
+ 3. **Mobile-first responsive**: Design for mobile first, enhance for desktop
285
+ 4. **Consistent gap sizes**: Use design system spacing scale (xs, sm, md, lg,
286
+ xl)
287
+ 5. **Accessibility**: Ensure proper heading hierarchy and landmark structure
288
+
289
+ ## Technical Notes
290
+
291
+ ### CSS Classes
292
+
293
+ Row always renders with the `.col-row` base class and conditionally adds variant
294
+ utilities:
295
+
296
+ - Base: `.col-row`
297
+ - Gap: `.col-row-gap-{size}`
298
+ - Justify: `.col-row-justify-{value}`
299
+ - Align: `.col-row-align-{value}`
300
+ - Wrap: `.col-row-{wrap-value}` (only if not default "wrap")
301
+
302
+ ### CSS Custom Properties
303
+
304
+ The `.col-row` class uses CSS custom properties for customization:
305
+
306
+ ```css
307
+ .col-row {
308
+ --col-row-gap: var(--spacing-md, 1rem);
309
+ }
310
+ ```
311
+
312
+ Override via inline styles:
313
+
314
+ ```jsx
315
+ <Row style={{ "--col-row-gap": "2rem" }}>
316
+ <Col span={6}>Column 1</Col>
317
+ <Col span={6}>Column 2</Col>
318
+ </Row>
319
+ ```
320
+
321
+ ### Performance
322
+
323
+ Row is a lightweight wrapper with minimal overhead. All layout logic is handled
324
+ via CSS utility classes, resulting in optimal runtime performance.