@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,414 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as StackStories from './stack.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={StackStories} title="Styles/Stack" />
|
|
5
|
+
|
|
6
|
+
# Stack Component - CSS Custom Properties
|
|
7
|
+
|
|
8
|
+
Complete reference for CSS custom properties and utility classes used by the Stack component.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Stack uses CSS custom properties from the unified spacing scale for gap values, plus utility classes for flexbox layout control. All spacing values use `clamp()` for fluid responsive scaling.
|
|
13
|
+
|
|
14
|
+
## Spacing Scale Variables
|
|
15
|
+
|
|
16
|
+
Stack shares the unified spacing scale with Box, Cluster, and Grid components.
|
|
17
|
+
|
|
18
|
+
| Variable | Value | Responsive Range | Use Case |
|
|
19
|
+
|----------|-------|------------------|----------|
|
|
20
|
+
| `--spacing-0` | `0` | - | No gap |
|
|
21
|
+
| `--spacing-xs` | `clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem)` | 4-8px | Tight spacing (compact lists) |
|
|
22
|
+
| `--spacing-sm` | `clamp(0.5rem, 0.45rem + 0.35vw, 0.75rem)` | 8-12px | Small spacing (button groups) |
|
|
23
|
+
| `--spacing-md` | `clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem)` | 12-18px | Medium spacing (content sections) |
|
|
24
|
+
| `--spacing-lg` | `clamp(1rem, 0.85rem + 0.6vw, 1.5rem)` | 16-24px | Large spacing (major sections) |
|
|
25
|
+
| `--spacing-xl` | `clamp(1.5rem, 1.25rem + 0.75vw, 2rem)` | 24-32px | Extra large spacing (page sections) |
|
|
26
|
+
|
|
27
|
+
## Generated Utility Classes
|
|
28
|
+
|
|
29
|
+
Stack generates utility classes from props for zero-runtime performance.
|
|
30
|
+
|
|
31
|
+
### Base Stack Class
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
.stack {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column; /* Default vertical */
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Direction Classes
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
.stack-vertical {
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.stack-horizontal {
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Usage:**
|
|
53
|
+
```tsx
|
|
54
|
+
<Stack direction="horizontal" gap="sm">
|
|
55
|
+
<Button>Cancel</Button>
|
|
56
|
+
<Button>Submit</Button>
|
|
57
|
+
</Stack>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Gap Classes
|
|
61
|
+
|
|
62
|
+
```css
|
|
63
|
+
.stack-gap-0 { gap: 0; }
|
|
64
|
+
.stack-gap-xs { gap: var(--spacing-xs); }
|
|
65
|
+
.stack-gap-sm { gap: var(--spacing-sm); }
|
|
66
|
+
.stack-gap-md { gap: var(--spacing-md); }
|
|
67
|
+
.stack-gap-lg { gap: var(--spacing-lg); }
|
|
68
|
+
.stack-gap-xl { gap: var(--spacing-xl); }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Usage:**
|
|
72
|
+
```tsx
|
|
73
|
+
<Stack gap="lg">
|
|
74
|
+
<Section />
|
|
75
|
+
<Section />
|
|
76
|
+
</Stack>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Align Classes (Cross-Axis)
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
.stack-align-start { align-items: flex-start; }
|
|
83
|
+
.stack-align-center { align-items: center; }
|
|
84
|
+
.stack-align-end { align-items: flex-end; }
|
|
85
|
+
.stack-align-stretch { align-items: stretch; }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Usage:**
|
|
89
|
+
```tsx
|
|
90
|
+
<Stack direction="horizontal" align="center" gap="sm">
|
|
91
|
+
<Icon />
|
|
92
|
+
<span>Centered with icon</span>
|
|
93
|
+
</Stack>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Justify Classes (Main-Axis)
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
.stack-justify-start { justify-content: flex-start; }
|
|
100
|
+
.stack-justify-center { justify-content: center; }
|
|
101
|
+
.stack-justify-end { justify-content: flex-end; }
|
|
102
|
+
.stack-justify-between { justify-content: space-between; }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Usage:**
|
|
106
|
+
```tsx
|
|
107
|
+
<Stack justify="between" style={{ minHeight: '100vh' }}>
|
|
108
|
+
<Header />
|
|
109
|
+
<Main />
|
|
110
|
+
<Footer />
|
|
111
|
+
</Stack>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Wrap Classes
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
.stack-wrap { flex-wrap: wrap; }
|
|
118
|
+
.stack-nowrap { flex-wrap: nowrap; }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Usage:**
|
|
122
|
+
```tsx
|
|
123
|
+
<Stack direction="horizontal" wrap="wrap" gap="md">
|
|
124
|
+
{items.map(item => <Card key={item.id} />)}
|
|
125
|
+
</Stack>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Customization Examples
|
|
129
|
+
|
|
130
|
+
### Global Theme Override
|
|
131
|
+
|
|
132
|
+
Override spacing scale globally:
|
|
133
|
+
|
|
134
|
+
```css
|
|
135
|
+
:root {
|
|
136
|
+
/* Tighter spacing */
|
|
137
|
+
--spacing-xs: 0.125rem;
|
|
138
|
+
--spacing-sm: 0.25rem;
|
|
139
|
+
--spacing-md: 0.5rem;
|
|
140
|
+
--spacing-lg: 0.75rem;
|
|
141
|
+
--spacing-xl: 1rem;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Component-Level Override
|
|
146
|
+
|
|
147
|
+
Override spacing on specific Stack:
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<Stack
|
|
151
|
+
gap="lg"
|
|
152
|
+
styles={{
|
|
153
|
+
'--spacing-lg': '3rem' // Custom large gap
|
|
154
|
+
} as React.CSSProperties}
|
|
155
|
+
>
|
|
156
|
+
<Section />
|
|
157
|
+
<Section />
|
|
158
|
+
</Stack>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Context-Based Theming
|
|
162
|
+
|
|
163
|
+
Create theme contexts:
|
|
164
|
+
|
|
165
|
+
```css
|
|
166
|
+
/* Compact theme */
|
|
167
|
+
.theme-compact {
|
|
168
|
+
--spacing-xs: 0.125rem;
|
|
169
|
+
--spacing-sm: 0.25rem;
|
|
170
|
+
--spacing-md: 0.5rem;
|
|
171
|
+
--spacing-lg: 0.75rem;
|
|
172
|
+
--spacing-xl: 1rem;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* Spacious theme */
|
|
176
|
+
.theme-spacious {
|
|
177
|
+
--spacing-xs: 0.5rem;
|
|
178
|
+
--spacing-sm: 0.75rem;
|
|
179
|
+
--spacing-md: 1.25rem;
|
|
180
|
+
--spacing-lg: 2rem;
|
|
181
|
+
--spacing-xl: 3rem;
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
<div className="theme-compact">
|
|
187
|
+
<Stack gap="lg">
|
|
188
|
+
{/* Uses compact spacing values */}
|
|
189
|
+
</Stack>
|
|
190
|
+
</div>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Responsive Custom Values
|
|
194
|
+
|
|
195
|
+
Combine with media queries:
|
|
196
|
+
|
|
197
|
+
```css
|
|
198
|
+
@media (min-width: 48rem) { /* 768px */
|
|
199
|
+
:root {
|
|
200
|
+
--spacing-lg: 2rem;
|
|
201
|
+
--spacing-xl: 3rem;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@media (min-width: 80rem) { /* 1280px */
|
|
206
|
+
:root {
|
|
207
|
+
--spacing-xl: 4rem;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Advanced Customization
|
|
213
|
+
|
|
214
|
+
### Custom Gap Values
|
|
215
|
+
|
|
216
|
+
Add custom spacing tokens:
|
|
217
|
+
|
|
218
|
+
```css
|
|
219
|
+
:root {
|
|
220
|
+
--spacing-xxs: 0.125rem; /* 2px */
|
|
221
|
+
--spacing-xxl: 3rem; /* 48px */
|
|
222
|
+
--spacing-jumbo: 5rem; /* 80px */
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Then override Stack classes:
|
|
227
|
+
|
|
228
|
+
```css
|
|
229
|
+
.stack-gap-custom {
|
|
230
|
+
gap: var(--spacing-jumbo);
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Animated Transitions
|
|
235
|
+
|
|
236
|
+
Animate gap changes:
|
|
237
|
+
|
|
238
|
+
```css
|
|
239
|
+
.stack-animated {
|
|
240
|
+
transition: gap 0.3s ease;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.stack-animated:hover {
|
|
244
|
+
--spacing-md: 1.5rem;
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
```tsx
|
|
249
|
+
<Stack gap="md" className="stack-animated">
|
|
250
|
+
<Item />
|
|
251
|
+
<Item />
|
|
252
|
+
</Stack>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Dark Mode Adjustments
|
|
256
|
+
|
|
257
|
+
Adjust spacing for dark mode:
|
|
258
|
+
|
|
259
|
+
```css
|
|
260
|
+
@media (prefers-color-scheme: dark) {
|
|
261
|
+
:root {
|
|
262
|
+
/* Slightly larger gaps for better readability */
|
|
263
|
+
--spacing-md: 1rem;
|
|
264
|
+
--spacing-lg: 1.75rem;
|
|
265
|
+
--spacing-xl: 2.5rem;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Class Combination Examples
|
|
271
|
+
|
|
272
|
+
Stack applies multiple utility classes based on props:
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
// Generates: .stack .stack-horizontal .stack-gap-lg .stack-align-center .stack-justify-between
|
|
276
|
+
<Stack
|
|
277
|
+
direction="horizontal"
|
|
278
|
+
gap="lg"
|
|
279
|
+
align="center"
|
|
280
|
+
justify="between"
|
|
281
|
+
>
|
|
282
|
+
Content
|
|
283
|
+
</Stack>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
// Generates: .stack .stack-vertical .stack-gap-md .stack-wrap
|
|
288
|
+
<Stack
|
|
289
|
+
direction="vertical"
|
|
290
|
+
gap="md"
|
|
291
|
+
wrap="wrap"
|
|
292
|
+
>
|
|
293
|
+
Content
|
|
294
|
+
</Stack>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Performance Considerations
|
|
298
|
+
|
|
299
|
+
### CSS Variable Performance
|
|
300
|
+
- Variables inherit through DOM tree (O(1) lookup)
|
|
301
|
+
- Changing variables triggers repaint, not reflow (faster)
|
|
302
|
+
- Minimal memory overhead vs inline styles
|
|
303
|
+
|
|
304
|
+
### Utility Class Benefits
|
|
305
|
+
- Zero runtime JavaScript
|
|
306
|
+
- Classes generated at build time
|
|
307
|
+
- Browser can optimize class-based styles
|
|
308
|
+
- Tree-shakeable in production builds
|
|
309
|
+
|
|
310
|
+
## Browser Compatibility
|
|
311
|
+
|
|
312
|
+
### CSS Flexbox
|
|
313
|
+
- **Supported**: All modern browsers (IE 11+ with prefixes)
|
|
314
|
+
- **Fallback**: Not needed for modern browsers
|
|
315
|
+
|
|
316
|
+
### CSS Custom Properties
|
|
317
|
+
- **Supported**: Chrome 49+, Firefox 31+, Safari 9.1+, Edge 15+
|
|
318
|
+
- **Fallback**: Use PostCSS custom properties plugin
|
|
319
|
+
|
|
320
|
+
### CSS Gap Property
|
|
321
|
+
- **Supported**: Chrome 84+, Firefox 63+, Safari 14.1+, Edge 84+
|
|
322
|
+
- **Fallback**: For older browsers, use margin on children (less ideal)
|
|
323
|
+
|
|
324
|
+
### CSS clamp()
|
|
325
|
+
- **Supported**: Chrome 79+, Firefox 75+, Safari 13.1+, Edge 79+
|
|
326
|
+
- **Fallback**: Use media queries with fixed rem values
|
|
327
|
+
|
|
328
|
+
## Debugging CSS Variables
|
|
329
|
+
|
|
330
|
+
Inspect values in browser DevTools:
|
|
331
|
+
|
|
332
|
+
```javascript
|
|
333
|
+
// Get computed gap value
|
|
334
|
+
const stack = document.querySelector('.stack-gap-md');
|
|
335
|
+
const gapValue = getComputedStyle(stack).getPropertyValue('--spacing-md');
|
|
336
|
+
console.log(gapValue); // "clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem)"
|
|
337
|
+
|
|
338
|
+
// Override programmatically
|
|
339
|
+
stack.style.setProperty('--spacing-md', '2rem');
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Common Patterns
|
|
343
|
+
|
|
344
|
+
### Card Grid with Responsive Gap
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
<Stack gap="lg" styles={{
|
|
348
|
+
'--spacing-lg': 'clamp(1rem, 2vw, 2rem)'
|
|
349
|
+
} as React.CSSProperties}>
|
|
350
|
+
<Card />
|
|
351
|
+
<Card />
|
|
352
|
+
</Stack>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Nested Stacks with Different Gaps
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
<Stack gap="xl">
|
|
359
|
+
<Stack gap="sm">
|
|
360
|
+
<h3>Tight spacing group</h3>
|
|
361
|
+
<p>Item 1</p>
|
|
362
|
+
<p>Item 2</p>
|
|
363
|
+
</Stack>
|
|
364
|
+
<Stack gap="sm">
|
|
365
|
+
<h3>Another tight group</h3>
|
|
366
|
+
<p>Item 1</p>
|
|
367
|
+
<p>Item 2</p>
|
|
368
|
+
</Stack>
|
|
369
|
+
</Stack>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Responsive Direction
|
|
373
|
+
|
|
374
|
+
Use inline styles for responsive direction:
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
<Stack
|
|
378
|
+
direction="vertical"
|
|
379
|
+
gap="md"
|
|
380
|
+
styles={{
|
|
381
|
+
'@media (min-width: 768px)': {
|
|
382
|
+
flexDirection: 'row'
|
|
383
|
+
}
|
|
384
|
+
}}
|
|
385
|
+
>
|
|
386
|
+
<Item />
|
|
387
|
+
<Item />
|
|
388
|
+
</Stack>
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Or use CSS:
|
|
392
|
+
|
|
393
|
+
```css
|
|
394
|
+
@media (min-width: 48rem) {
|
|
395
|
+
.stack-responsive {
|
|
396
|
+
flex-direction: row;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
<Stack className="stack-responsive" gap="md">
|
|
403
|
+
<Item />
|
|
404
|
+
<Item />
|
|
405
|
+
</Stack>
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## Related Documentation
|
|
409
|
+
|
|
410
|
+
- [Stack Component README](./README.mdx)
|
|
411
|
+
- [Box Component STYLES](../box/STYLES.mdx)
|
|
412
|
+
- [CSS Flexbox (MDN)](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout)
|
|
413
|
+
- [CSS Custom Properties (MDN)](https://developer.mozilla.org/en-US/docs/Web/CSS/--*)
|
|
414
|
+
- [CSS Gap Property (MDN)](https://developer.mozilla.org/en-US/docs/Web/CSS/gap)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack Component Styles
|
|
3
|
+
*
|
|
4
|
+
* Utility classes for the Stack layout primitive.
|
|
5
|
+
* Provides flexbox-based vertical/horizontal layouts with gap spacing.
|
|
6
|
+
* All spacing values use the unified spacing scale from globals.
|
|
7
|
+
* All units are in rem (1rem = 16px base).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Base Stack
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
.stack {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column; // Default to vertical
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Direction Utilities
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
.stack-vertical {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.stack-horizontal {
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// Gap Utilities
|
|
33
|
+
// ============================================================================
|
|
34
|
+
|
|
35
|
+
.stack-gap-0 {
|
|
36
|
+
gap: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.stack-gap-xs {
|
|
40
|
+
gap: var(--spacing-xs);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.stack-gap-sm {
|
|
44
|
+
gap: var(--spacing-sm);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.stack-gap-md {
|
|
48
|
+
gap: var(--spacing-md);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.stack-gap-lg {
|
|
52
|
+
gap: var(--spacing-lg);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.stack-gap-xl {
|
|
56
|
+
gap: var(--spacing-xl);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// Align Utilities (Cross-Axis)
|
|
61
|
+
// ============================================================================
|
|
62
|
+
|
|
63
|
+
.stack-align-start {
|
|
64
|
+
align-items: flex-start;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.stack-align-center {
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.stack-align-end {
|
|
72
|
+
align-items: flex-end;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.stack-align-stretch {
|
|
76
|
+
align-items: stretch;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// Justify Utilities (Main-Axis)
|
|
81
|
+
// ============================================================================
|
|
82
|
+
|
|
83
|
+
.stack-justify-start {
|
|
84
|
+
justify-content: flex-start;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.stack-justify-center {
|
|
88
|
+
justify-content: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.stack-justify-end {
|
|
92
|
+
justify-content: flex-end;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.stack-justify-between {
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ============================================================================
|
|
100
|
+
// Wrap Utilities
|
|
101
|
+
// ============================================================================
|
|
102
|
+
|
|
103
|
+
.stack-wrap {
|
|
104
|
+
flex-wrap: wrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.stack-nowrap {
|
|
108
|
+
flex-wrap: nowrap;
|
|
109
|
+
}
|