@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.
- 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-L6PRDL6F.cjs → chunk-5CJPTDK3.cjs} +3 -3
- 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-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
- package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
- package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
- package/libs/{chunk-MPTMPBFT.js → chunk-M7JLT62Q.js} +2 -2
- 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-OU52NIKA.js +8 -0
- package/libs/chunk-OU52NIKA.js.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-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
- package/libs/{chunk-EE3ZWSBY.cjs → chunk-URBGDUFN.cjs} +6 -6
- package/libs/chunk-WWPLBWCQ.cjs +18 -0
- package/libs/chunk-WWPLBWCQ.cjs.map +1 -0
- package/libs/{chunk-TPIB3RQP.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/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.d.cts +1 -1
- package/libs/components/tables/table.d.ts +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 +64 -63
- 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 +923 -4
- package/libs/index.d.ts +923 -4
- package/libs/index.js +28 -28
- package/libs/index.js.map +1 -1
- package/package.json +2 -2
- 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/buttons/STYLES.mdx +766 -0
- package/src/components/cards/STYLES.mdx +835 -0
- package/src/components/cards/card.scss +30 -21
- package/src/components/cards/card.stories.tsx +120 -80
- package/src/components/cards/card.tsx +14 -4
- 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 +1 -1
- 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/images/STYLES.mdx +75 -0
- 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/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/tag/STYLES.mdx +105 -0
- package/src/components/text-to-speech/STYLES.mdx +80 -0
- package/src/components/ui.tsx +3 -3
- package/src/index.scss +7 -2
- package/src/index.ts +305 -12
- package/src/sass/GLOBALS-STYLES.md +631 -0
- package/src/sass/_globals.scss +45 -24
- package/src/sass/_styles.scss +2 -2
- package/src/styles/box/box.css +220 -0
- package/src/styles/box/box.css.map +1 -0
- package/src/styles/cards/card.css +23 -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 +668 -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 -14
- package/src/types/layout-primitives.ts +48 -0
- package/src/types/shared.ts +10 -26
- package/libs/chunk-ENTCUJ3A.cjs +0 -13
- package/libs/chunk-ENTCUJ3A.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-W5TKWBFC.cjs +0 -18
- package/libs/chunk-W5TKWBFC.cjs.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-L6PRDL6F.cjs.map → chunk-5CJPTDK3.cjs.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-MPTMPBFT.js.map → chunk-M7JLT62Q.js.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-EE3ZWSBY.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
- /package/libs/{chunk-TPIB3RQP.js.map → chunk-ZF6Y7W57.js.map} +0 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { within, expect } from "storybook/test";
|
|
3
|
+
|
|
4
|
+
import { Grid, GridItem } from "./grid";
|
|
5
|
+
import "./grid.scss";
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Grid> = {
|
|
8
|
+
title: "FP.React Components/Layout/Grid",
|
|
9
|
+
component: Grid,
|
|
10
|
+
tags: ["autodocs", "rc", "layout"],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `
|
|
15
|
+
# Grid - Layout Primitive
|
|
16
|
+
|
|
17
|
+
A CSS Grid-based layout primitive for responsive multi-column layouts with Grid.Item sub-component.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **CSS Grid**: True 2D layout with rows and columns
|
|
22
|
+
- **Responsive Columns**: 1-12 column layouts or auto-fit/auto-fill
|
|
23
|
+
- **Grid.Item**: Sub-component with column/row span control
|
|
24
|
+
- **Fluid Spacing**: Responsive gap using CSS clamp()
|
|
25
|
+
- **Polymorphic**: Render as any semantic HTML element
|
|
26
|
+
- **Type-Safe**: Full TypeScript support
|
|
27
|
+
|
|
28
|
+
## When to Use
|
|
29
|
+
|
|
30
|
+
- **Grid**: Multi-column card grids, dashboard layouts, responsive layouts
|
|
31
|
+
- **Stack**: Simple vertical/horizontal layouts without explicit columns
|
|
32
|
+
- **Cluster**: Inline groups that wrap (tags, buttons)
|
|
33
|
+
- **Box**: Padding/margin on containers (no layout)
|
|
34
|
+
|
|
35
|
+
[View Full Documentation →](https://github.com/anthropics/fpkit/blob/main/packages/fpkit/src/components/grid/README.mdx)
|
|
36
|
+
`,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default meta;
|
|
43
|
+
type Story = StoryObj<typeof meta>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Default 3-column grid with medium gap.
|
|
47
|
+
* Perfect for card layouts and content grids.
|
|
48
|
+
*/
|
|
49
|
+
export const Default: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
columns: 3,
|
|
52
|
+
gap: "md",
|
|
53
|
+
children: (
|
|
54
|
+
<>
|
|
55
|
+
{[...Array(6)].map((_, i) => (
|
|
56
|
+
<div
|
|
57
|
+
key={i}
|
|
58
|
+
style={{
|
|
59
|
+
padding: "1.5rem",
|
|
60
|
+
backgroundColor: "#f0f0f0",
|
|
61
|
+
borderRadius: "0.5rem",
|
|
62
|
+
textAlign: "center",
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
Card {i + 1}
|
|
66
|
+
</div>
|
|
67
|
+
))}
|
|
68
|
+
</>
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
play: async ({ canvasElement, step }) => {
|
|
72
|
+
const canvas = within(canvasElement);
|
|
73
|
+
|
|
74
|
+
await step("Grid renders correctly", async () => {
|
|
75
|
+
expect(canvas.getByText("Card 1")).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
await step("Grid has correct classes", async () => {
|
|
79
|
+
const grid = canvas.getByText("Card 1").parentElement;
|
|
80
|
+
expect(grid).toHaveClass("grid");
|
|
81
|
+
expect(grid).toHaveClass("grid-cols-3");
|
|
82
|
+
expect(grid).toHaveClass("grid-gap-md");
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 2-column layout (main content + sidebar).
|
|
89
|
+
* Using Grid.Item for column span control.
|
|
90
|
+
*/
|
|
91
|
+
export const TwoColumn: Story = {
|
|
92
|
+
render: () => (
|
|
93
|
+
<Grid columns={12} gap="lg">
|
|
94
|
+
<GridItem span={8}>
|
|
95
|
+
<div
|
|
96
|
+
style={{
|
|
97
|
+
padding: "2rem",
|
|
98
|
+
backgroundColor: "#e8f4f8",
|
|
99
|
+
borderRadius: "0.5rem",
|
|
100
|
+
minHeight: "20rem",
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<h3 style={{ margin: 0, marginBottom: "1rem" }}>Main Content</h3>
|
|
104
|
+
<p style={{ margin: 0 }}>Spans 8 of 12 columns (66%)</p>
|
|
105
|
+
</div>
|
|
106
|
+
</GridItem>
|
|
107
|
+
<GridItem span={4}>
|
|
108
|
+
<div
|
|
109
|
+
style={{
|
|
110
|
+
padding: "2rem",
|
|
111
|
+
backgroundColor: "#f0f0f0",
|
|
112
|
+
borderRadius: "0.5rem",
|
|
113
|
+
minHeight: "20rem",
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<h4 style={{ margin: 0, marginBottom: "1rem" }}>Sidebar</h4>
|
|
117
|
+
<p style={{ margin: 0 }}>Spans 4 of 12 columns (33%)</p>
|
|
118
|
+
</div>
|
|
119
|
+
</GridItem>
|
|
120
|
+
</Grid>
|
|
121
|
+
),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Auto-fit grid with minimum column width.
|
|
126
|
+
* Columns adjust automatically based on container width.
|
|
127
|
+
*/
|
|
128
|
+
export const AutoFit: Story = {
|
|
129
|
+
args: {
|
|
130
|
+
auto: "fit",
|
|
131
|
+
minColumnWidth: "15rem",
|
|
132
|
+
gap: "md",
|
|
133
|
+
children: (
|
|
134
|
+
<>
|
|
135
|
+
{[...Array(9)].map((_, i) => (
|
|
136
|
+
<div
|
|
137
|
+
key={i}
|
|
138
|
+
style={{
|
|
139
|
+
padding: "1.5rem",
|
|
140
|
+
backgroundColor: "#f0f0f0",
|
|
141
|
+
border: "2px solid #ccc",
|
|
142
|
+
borderRadius: "0.5rem",
|
|
143
|
+
textAlign: "center",
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
Item {i + 1}
|
|
147
|
+
</div>
|
|
148
|
+
))}
|
|
149
|
+
</>
|
|
150
|
+
),
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 4-column image gallery.
|
|
156
|
+
* Perfect for photo grids and media galleries.
|
|
157
|
+
*/
|
|
158
|
+
export const ImageGallery: Story = {
|
|
159
|
+
render: () => (
|
|
160
|
+
<Grid columns={4} gap="sm">
|
|
161
|
+
{[...Array(12)].map((_, i) => (
|
|
162
|
+
<div
|
|
163
|
+
key={i}
|
|
164
|
+
style={{
|
|
165
|
+
aspectRatio: "1",
|
|
166
|
+
backgroundColor: "#ddd",
|
|
167
|
+
borderRadius: "0.25rem",
|
|
168
|
+
display: "flex",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
justifyContent: "center",
|
|
171
|
+
fontSize: "2rem",
|
|
172
|
+
color: "#666",
|
|
173
|
+
}}
|
|
174
|
+
>
|
|
175
|
+
{i + 1}
|
|
176
|
+
</div>
|
|
177
|
+
))}
|
|
178
|
+
</Grid>
|
|
179
|
+
),
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Dashboard layout with mixed column spans.
|
|
184
|
+
* Demonstrates Grid.Item with various span values.
|
|
185
|
+
*/
|
|
186
|
+
export const Dashboard: Story = {
|
|
187
|
+
render: () => (
|
|
188
|
+
<Grid columns={12} gap="md">
|
|
189
|
+
<GridItem span={12}>
|
|
190
|
+
<div style={{ padding: "1rem", backgroundColor: "#0066cc", color: "white", borderRadius: "0.5rem" }}>
|
|
191
|
+
Header (Full Width)
|
|
192
|
+
</div>
|
|
193
|
+
</GridItem>
|
|
194
|
+
<GridItem span={4}>
|
|
195
|
+
<div style={{ padding: "1.5rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem", minHeight: "15rem" }}>
|
|
196
|
+
Sidebar (4 cols)
|
|
197
|
+
</div>
|
|
198
|
+
</GridItem>
|
|
199
|
+
<GridItem span={8}>
|
|
200
|
+
<div style={{ padding: "1.5rem", backgroundColor: "#e8f4f8", borderRadius: "0.5rem", minHeight: "15rem" }}>
|
|
201
|
+
Main Content (8 cols)
|
|
202
|
+
</div>
|
|
203
|
+
</GridItem>
|
|
204
|
+
<GridItem span={4}>
|
|
205
|
+
<div style={{ padding: "1rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
206
|
+
Card 1
|
|
207
|
+
</div>
|
|
208
|
+
</GridItem>
|
|
209
|
+
<GridItem span={4}>
|
|
210
|
+
<div style={{ padding: "1rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
211
|
+
Card 2
|
|
212
|
+
</div>
|
|
213
|
+
</GridItem>
|
|
214
|
+
<GridItem span={4}>
|
|
215
|
+
<div style={{ padding: "1rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
216
|
+
Card 3
|
|
217
|
+
</div>
|
|
218
|
+
</GridItem>
|
|
219
|
+
</Grid>
|
|
220
|
+
),
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Gap size variations.
|
|
225
|
+
* Demonstrates all gap scale values.
|
|
226
|
+
*/
|
|
227
|
+
export const GapSizes: Story = {
|
|
228
|
+
render: () => (
|
|
229
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
|
|
230
|
+
{["xs", "sm", "md", "lg", "xl"].map((size) => (
|
|
231
|
+
<div key={size}>
|
|
232
|
+
<h4 style={{ margin: 0, marginBottom: "0.5rem" }}>Gap {size.toUpperCase()}</h4>
|
|
233
|
+
<Grid columns={4} gap={size as SpacingScale}>
|
|
234
|
+
{[...Array(4)].map((_, i) => (
|
|
235
|
+
<div
|
|
236
|
+
key={i}
|
|
237
|
+
style={{
|
|
238
|
+
padding: "1rem",
|
|
239
|
+
backgroundColor: "#f0f0f0",
|
|
240
|
+
border: "1px solid #ccc",
|
|
241
|
+
borderRadius: "0.25rem",
|
|
242
|
+
textAlign: "center",
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
Item {i + 1}
|
|
246
|
+
</div>
|
|
247
|
+
))}
|
|
248
|
+
</Grid>
|
|
249
|
+
</div>
|
|
250
|
+
))}
|
|
251
|
+
</div>
|
|
252
|
+
),
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Asymmetric column gaps (gapX and gapY).
|
|
257
|
+
* Different horizontal and vertical spacing.
|
|
258
|
+
*/
|
|
259
|
+
export const AsymmetricGaps: Story = {
|
|
260
|
+
args: {
|
|
261
|
+
columns: 3,
|
|
262
|
+
gapX: "lg",
|
|
263
|
+
gapY: "xs",
|
|
264
|
+
children: (
|
|
265
|
+
<>
|
|
266
|
+
{[...Array(6)].map((_, i) => (
|
|
267
|
+
<div
|
|
268
|
+
key={i}
|
|
269
|
+
style={{
|
|
270
|
+
padding: "1rem",
|
|
271
|
+
backgroundColor: "#f0f0f0",
|
|
272
|
+
border: "1px solid #ccc",
|
|
273
|
+
borderRadius: "0.25rem",
|
|
274
|
+
textAlign: "center",
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
Item {i + 1}
|
|
278
|
+
</div>
|
|
279
|
+
))}
|
|
280
|
+
</>
|
|
281
|
+
),
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Row span example.
|
|
287
|
+
* Grid.Item spanning multiple rows.
|
|
288
|
+
*/
|
|
289
|
+
export const RowSpan: Story = {
|
|
290
|
+
render: () => (
|
|
291
|
+
<Grid columns={3} gap="md">
|
|
292
|
+
<GridItem rowSpan={2}>
|
|
293
|
+
<div
|
|
294
|
+
style={{
|
|
295
|
+
padding: "1.5rem",
|
|
296
|
+
backgroundColor: "#0066cc",
|
|
297
|
+
color: "white",
|
|
298
|
+
borderRadius: "0.5rem",
|
|
299
|
+
height: "100%",
|
|
300
|
+
display: "flex",
|
|
301
|
+
alignItems: "center",
|
|
302
|
+
justifyContent: "center",
|
|
303
|
+
}}
|
|
304
|
+
>
|
|
305
|
+
Tall Item (2 rows)
|
|
306
|
+
</div>
|
|
307
|
+
</GridItem>
|
|
308
|
+
<div style={{ padding: "1.5rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
309
|
+
Item 2
|
|
310
|
+
</div>
|
|
311
|
+
<div style={{ padding: "1.5rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
312
|
+
Item 3
|
|
313
|
+
</div>
|
|
314
|
+
<div style={{ padding: "1.5rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
315
|
+
Item 4
|
|
316
|
+
</div>
|
|
317
|
+
<div style={{ padding: "1.5rem", backgroundColor: "#f0f0f0", borderRadius: "0.5rem" }}>
|
|
318
|
+
Item 5
|
|
319
|
+
</div>
|
|
320
|
+
</Grid>
|
|
321
|
+
),
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Alignment options (justifyItems and alignItems).
|
|
326
|
+
* Controls how items align within their grid cells.
|
|
327
|
+
*/
|
|
328
|
+
export const Alignment: Story = {
|
|
329
|
+
render: () => (
|
|
330
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
|
|
331
|
+
<div>
|
|
332
|
+
<h4 style={{ margin: 0, marginBottom: "0.5rem" }}>Justify Items: Center</h4>
|
|
333
|
+
<Grid columns={3} gap="md" justifyItems="center">
|
|
334
|
+
{[...Array(3)].map((_, i) => (
|
|
335
|
+
<div
|
|
336
|
+
key={i}
|
|
337
|
+
style={{
|
|
338
|
+
padding: "1rem",
|
|
339
|
+
backgroundColor: "#f0f0f0",
|
|
340
|
+
border: "1px solid #ccc",
|
|
341
|
+
borderRadius: "0.25rem",
|
|
342
|
+
width: "fit-content",
|
|
343
|
+
}}
|
|
344
|
+
>
|
|
345
|
+
Centered
|
|
346
|
+
</div>
|
|
347
|
+
))}
|
|
348
|
+
</Grid>
|
|
349
|
+
</div>
|
|
350
|
+
<div>
|
|
351
|
+
<h4 style={{ margin: 0, marginBottom: "0.5rem" }}>Align Items: Center</h4>
|
|
352
|
+
<Grid columns={3} gap="md" alignItems="center" styles={{ minHeight: "10rem" }}>
|
|
353
|
+
{[...Array(3)].map((_, i) => (
|
|
354
|
+
<div
|
|
355
|
+
key={i}
|
|
356
|
+
style={{
|
|
357
|
+
padding: "1rem",
|
|
358
|
+
backgroundColor: "#f0f0f0",
|
|
359
|
+
border: "1px solid #ccc",
|
|
360
|
+
borderRadius: "0.25rem",
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
Centered
|
|
364
|
+
</div>
|
|
365
|
+
))}
|
|
366
|
+
</Grid>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
),
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Column count variations.
|
|
374
|
+
* Demonstrates different column counts from 1 to 6.
|
|
375
|
+
*/
|
|
376
|
+
export const ColumnCounts: Story = {
|
|
377
|
+
render: () => (
|
|
378
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
|
|
379
|
+
{[1, 2, 3, 4, 5, 6].map((cols) => (
|
|
380
|
+
<div key={cols}>
|
|
381
|
+
<h4 style={{ margin: 0, marginBottom: "0.5rem" }}>{cols} Column{cols > 1 ? "s" : ""}</h4>
|
|
382
|
+
<Grid columns={cols as 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12} gap="sm">
|
|
383
|
+
{[...Array(cols)].map((_, i) => (
|
|
384
|
+
<div
|
|
385
|
+
key={i}
|
|
386
|
+
style={{
|
|
387
|
+
padding: "1rem",
|
|
388
|
+
backgroundColor: "#f0f0f0",
|
|
389
|
+
border: "1px solid #ccc",
|
|
390
|
+
borderRadius: "0.25rem",
|
|
391
|
+
textAlign: "center",
|
|
392
|
+
}}
|
|
393
|
+
>
|
|
394
|
+
Col {i + 1}
|
|
395
|
+
</div>
|
|
396
|
+
))}
|
|
397
|
+
</Grid>
|
|
398
|
+
</div>
|
|
399
|
+
))}
|
|
400
|
+
</div>
|
|
401
|
+
),
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Form layout with 2 columns.
|
|
406
|
+
* Label + input pairs in a grid.
|
|
407
|
+
*/
|
|
408
|
+
export const FormLayout: Story = {
|
|
409
|
+
render: () => (
|
|
410
|
+
<Grid columns={2} gap="md" styles={{ maxWidth: "40rem" }}>
|
|
411
|
+
<label htmlFor="name" style={{ alignSelf: "center", fontWeight: "500" }}>Name</label>
|
|
412
|
+
<input
|
|
413
|
+
id="name"
|
|
414
|
+
type="text"
|
|
415
|
+
placeholder="Enter your name"
|
|
416
|
+
style={{
|
|
417
|
+
padding: "0.5rem",
|
|
418
|
+
border: "1px solid #ccc",
|
|
419
|
+
borderRadius: "0.25rem",
|
|
420
|
+
}}
|
|
421
|
+
/>
|
|
422
|
+
<label htmlFor="email" style={{ alignSelf: "center", fontWeight: "500" }}>Email</label>
|
|
423
|
+
<input
|
|
424
|
+
id="email"
|
|
425
|
+
type="email"
|
|
426
|
+
placeholder="you@example.com"
|
|
427
|
+
style={{
|
|
428
|
+
padding: "0.5rem",
|
|
429
|
+
border: "1px solid #ccc",
|
|
430
|
+
borderRadius: "0.25rem",
|
|
431
|
+
}}
|
|
432
|
+
/>
|
|
433
|
+
<label htmlFor="message" style={{ alignSelf: "start", fontWeight: "500", paddingTop: "0.5rem" }}>Message</label>
|
|
434
|
+
<textarea
|
|
435
|
+
id="message"
|
|
436
|
+
rows={4}
|
|
437
|
+
placeholder="Your message..."
|
|
438
|
+
style={{
|
|
439
|
+
padding: "0.5rem",
|
|
440
|
+
border: "1px solid #ccc",
|
|
441
|
+
borderRadius: "0.25rem",
|
|
442
|
+
fontFamily: "inherit",
|
|
443
|
+
}}
|
|
444
|
+
/>
|
|
445
|
+
<div></div>
|
|
446
|
+
<button
|
|
447
|
+
type="button"
|
|
448
|
+
style={{
|
|
449
|
+
padding: "0.75rem 1.5rem",
|
|
450
|
+
backgroundColor: "#0066cc",
|
|
451
|
+
color: "white",
|
|
452
|
+
border: "none",
|
|
453
|
+
borderRadius: "0.25rem",
|
|
454
|
+
cursor: "pointer",
|
|
455
|
+
}}
|
|
456
|
+
>
|
|
457
|
+
Submit
|
|
458
|
+
</button>
|
|
459
|
+
</Grid>
|
|
460
|
+
),
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Semantic list with ul/li.
|
|
465
|
+
* Using Grid as ul and Grid.Item as li.
|
|
466
|
+
*/
|
|
467
|
+
export const SemanticList: Story = {
|
|
468
|
+
render: () => (
|
|
469
|
+
<Grid as="ul" columns={3} gap="md" styles={{ listStyle: "none", padding: 0 }}>
|
|
470
|
+
{["Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6"].map((item) => (
|
|
471
|
+
<GridItem
|
|
472
|
+
as="li"
|
|
473
|
+
key={item}
|
|
474
|
+
styles={{
|
|
475
|
+
padding: "1.5rem",
|
|
476
|
+
backgroundColor: "#f8f9fa",
|
|
477
|
+
border: "1px solid #e0e0e0",
|
|
478
|
+
borderRadius: "0.25rem",
|
|
479
|
+
}}
|
|
480
|
+
>
|
|
481
|
+
{item}
|
|
482
|
+
</GridItem>
|
|
483
|
+
))}
|
|
484
|
+
</Grid>
|
|
485
|
+
),
|
|
486
|
+
};
|