@fpkit/acss 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) 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-IWP4VJEP.cjs +18 -0
  19. package/libs/chunk-IWP4VJEP.cjs.map +1 -0
  20. package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
  21. package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
  22. package/libs/{chunk-MPTMPBFT.js → chunk-M7JLT62Q.js} +2 -2
  23. package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
  24. package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
  25. package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
  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-UGMP72J2.js +8 -0
  30. package/libs/chunk-UGMP72J2.js.map +1 -0
  31. package/libs/{chunk-EE3ZWSBY.cjs → chunk-URBGDUFN.cjs} +6 -6
  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 +29 -21
  114. package/src/components/cards/card.tsx +13 -3
  115. package/src/components/cards/card.types.ts +13 -0
  116. package/src/components/cluster/README.mdx +595 -0
  117. package/src/components/cluster/STYLES.mdx +626 -0
  118. package/src/components/cluster/cluster.scss +86 -0
  119. package/src/components/cluster/cluster.stories.tsx +385 -0
  120. package/src/components/cluster/cluster.test.tsx +655 -0
  121. package/src/components/cluster/cluster.tsx +94 -0
  122. package/src/components/cluster/cluster.types.ts +75 -0
  123. package/src/components/details/STYLES.mdx +445 -0
  124. package/src/components/dialog/STYLES.mdx +888 -0
  125. package/src/components/flexbox/STYLES.mdx +1 -1
  126. package/src/components/form/STYLES.mdx +821 -0
  127. package/src/components/grid/README.mdx +709 -0
  128. package/src/components/grid/STYLES.mdx +785 -0
  129. package/src/components/grid/grid.scss +287 -0
  130. package/src/components/grid/grid.stories.tsx +486 -0
  131. package/src/components/grid/grid.test.tsx +981 -0
  132. package/src/components/grid/grid.tsx +222 -0
  133. package/src/components/grid/grid.types.ts +344 -0
  134. package/src/components/icons/STYLES.mdx +56 -0
  135. package/src/components/images/STYLES.mdx +75 -0
  136. package/src/components/layout/STYLES.mdx +556 -0
  137. package/src/components/link/STYLES.mdx +75 -0
  138. package/src/components/list/STYLES.mdx +631 -0
  139. package/src/components/nav/STYLES.mdx +460 -0
  140. package/src/components/progress/STYLES.mdx +64 -0
  141. package/src/components/stack/README.mdx +400 -0
  142. package/src/components/stack/STYLES.mdx +414 -0
  143. package/src/components/stack/stack.scss +109 -0
  144. package/src/components/stack/stack.stories.tsx +559 -0
  145. package/src/components/stack/stack.test.tsx +426 -0
  146. package/src/components/stack/stack.tsx +141 -0
  147. package/src/components/stack/stack.types.ts +133 -0
  148. package/src/components/tag/STYLES.mdx +105 -0
  149. package/src/components/text-to-speech/STYLES.mdx +80 -0
  150. package/src/components/ui.tsx +3 -3
  151. package/src/index.scss +5 -1
  152. package/src/index.ts +305 -12
  153. package/src/sass/GLOBALS-STYLES.md +631 -0
  154. package/src/sass/_globals.scss +45 -24
  155. package/src/styles/box/box.css +220 -0
  156. package/src/styles/box/box.css.map +1 -0
  157. package/src/styles/cards/card.css +22 -17
  158. package/src/styles/cards/card.css.map +1 -1
  159. package/src/styles/cluster/cluster.css +71 -0
  160. package/src/styles/cluster/cluster.css.map +1 -0
  161. package/src/styles/grid/grid.css +238 -0
  162. package/src/styles/grid/grid.css.map +1 -0
  163. package/src/styles/index.css +667 -49
  164. package/src/styles/index.css.map +1 -1
  165. package/src/styles/stack/stack.css +86 -0
  166. package/src/styles/stack/stack.css.map +1 -0
  167. package/src/types/component-props.ts +42 -14
  168. package/src/types/layout-primitives.ts +48 -0
  169. package/src/types/shared.ts +10 -26
  170. package/libs/chunk-ENTCUJ3A.cjs +0 -13
  171. package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
  172. package/libs/chunk-HHLNOC5T.js +0 -7
  173. package/libs/chunk-HHLNOC5T.js.map +0 -1
  174. package/libs/chunk-KK47SYZI.js +0 -8
  175. package/libs/chunk-KK47SYZI.js.map +0 -1
  176. package/libs/chunk-W5TKWBFC.cjs +0 -18
  177. package/libs/chunk-W5TKWBFC.cjs.map +0 -1
  178. package/libs/component-props-67d978a2.d.ts +0 -38
  179. /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
  180. /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
  181. /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
  182. /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
  183. /package/libs/{chunk-L6PRDL6F.cjs.map → chunk-5CJPTDK3.cjs.map} +0 -0
  184. /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
  185. /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
  186. /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
  187. /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
  188. /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
  189. /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
  190. /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
  191. /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
  192. /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
  193. /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
  194. /package/libs/{chunk-MPTMPBFT.js.map → chunk-M7JLT62Q.js.map} +0 -0
  195. /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
  196. /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
  197. /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
  198. /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
  199. /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
  200. /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
  201. /package/libs/{chunk-EE3ZWSBY.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
  202. /package/libs/{chunk-TPIB3RQP.js.map → chunk-ZF6Y7W57.js.map} +0 -0
@@ -0,0 +1,360 @@
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
+ import * as BoxStories from './box.stories';
3
+
4
+ <Meta of={BoxStories} title="Styles/Box" />
5
+
6
+ # Box Component - CSS Custom Properties
7
+
8
+ Complete reference for CSS custom properties used by the Box component.
9
+
10
+ ## Overview
11
+
12
+ The Box component uses CSS custom properties (CSS variables) for all spacing, sizing, and appearance values. This enables:
13
+
14
+ - **Runtime Theming**: Change values without recompiling
15
+ - **Cascading Overrides**: Override at any level in the DOM tree
16
+ - **Responsive Design**: Fluid values using `clamp()` adapt to viewport
17
+ - **Consistency**: Unified spacing scale across all layout primitives
18
+
19
+ ## Spacing Scale Variables
20
+
21
+ The unified spacing scale is shared across Box, Stack, Cluster, and Grid components. All values use `clamp()` for fluid, responsive scaling without media queries.
22
+
23
+ ### Spacing Scale
24
+
25
+ | Variable | Value | Responsive Range | Use Case |
26
+ |----------|-------|------------------|----------|
27
+ | `--spacing-0` | `0` | - | No spacing |
28
+ | `--spacing-xs` | `clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem)` | 4-8px | Tight spacing (badges, inline elements) |
29
+ | `--spacing-sm` | `clamp(0.5rem, 0.45rem + 0.35vw, 0.75rem)` | 8-12px | Small spacing (list items, compact layouts) |
30
+ | `--spacing-md` | `clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem)` | 12-18px | Medium spacing (default padding/margin) |
31
+ | `--spacing-lg` | `clamp(1rem, 0.85rem + 0.6vw, 1.5rem)` | 16-24px | Large spacing (section padding) |
32
+ | `--spacing-xl` | `clamp(1.5rem, 1.25rem + 0.75vw, 2rem)` | 24-32px | Extra large spacing (page sections, heroes) |
33
+
34
+ ### How clamp() Works
35
+
36
+ ```css
37
+ clamp(MIN, PREFERRED, MAX)
38
+ ```
39
+
40
+ - **MIN**: Minimum value at smallest viewport (320px)
41
+ - **PREFERRED**: Formula that scales with viewport width
42
+ - **MAX**: Maximum value at largest viewport
43
+
44
+ Example: `--spacing-md: clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem)`
45
+ - At 320px viewport: 0.75rem (12px)
46
+ - At 768px viewport: ~0.93rem (15px)
47
+ - At 1920px+ viewport: 1.125rem (18px)
48
+
49
+ ## Max Width Variables
50
+
51
+ Maximum width constraints for readable content and responsive containers.
52
+
53
+ | Variable | Value (rem) | Value (px) | Use Case |
54
+ |----------|-------------|------------|----------|
55
+ | `--box-max-width-xs` | `30rem` | 480px | Mobile-first, narrow content |
56
+ | `--box-max-width-sm` | `40rem` | 640px | Small devices, form containers |
57
+ | `--box-max-width-md` | `48rem` | 768px | Tablets, readable text width |
58
+ | `--box-max-width-lg` | `64rem` | 1024px | Desktop layouts, dashboards |
59
+ | `--box-max-width-xl` | `80rem` | 1280px | Wide layouts, data tables |
60
+ | `--box-max-width-container` | `75rem` | 1200px | Standard page container width |
61
+
62
+ ### Responsive Breakpoint Reference
63
+
64
+ For context, these max-widths correspond to common breakpoints:
65
+
66
+ - **xs (480px)**: Mobile landscape
67
+ - **sm (640px)**: Large mobile/small tablet
68
+ - **md (768px)**: Tablet portrait
69
+ - **lg (1024px)**: Tablet landscape/small desktop
70
+ - **xl (1280px)**: Desktop
71
+ - **container (1200px)**: Standard content width
72
+
73
+ ## Border Radius Variables
74
+
75
+ Border radius values for rounded corners.
76
+
77
+ | Variable | Value (rem) | Value (px) | Use Case |
78
+ |----------|-------------|------------|----------|
79
+ | `--box-radius-xs` | `0.125rem` | 2px | Subtle rounding (inputs, badges) |
80
+ | `--box-radius-sm` | `0.25rem` | 4px | Small rounding (buttons, chips) |
81
+ | `--box-radius-md` | `0.375rem` | 6px | Medium rounding (cards, modals) |
82
+ | `--box-radius-lg` | `0.5rem` | 8px | Large rounding (panels, containers) |
83
+ | `--box-radius-xl` | `0.75rem` | 12px | Extra large rounding (hero sections) |
84
+ | `--box-radius-full` | `9999px` | ~infinite | Fully rounded (pills, circles) |
85
+
86
+ ## Customization Examples
87
+
88
+ ### Global Theme Override
89
+
90
+ Override variables globally in your root stylesheet:
91
+
92
+ ```css
93
+ :root {
94
+ /* Increase spacing scale */
95
+ --spacing-md: 1rem;
96
+ --spacing-lg: 1.5rem;
97
+ --spacing-xl: 2.5rem;
98
+
99
+ /* Adjust max widths */
100
+ --box-max-width-container: 80rem; /* 1280px */
101
+
102
+ /* More rounded corners */
103
+ --box-radius-md: 0.5rem;
104
+ --box-radius-lg: 1rem;
105
+ }
106
+ ```
107
+
108
+ ### Component-Level Override
109
+
110
+ Override variables on specific components:
111
+
112
+ ```tsx
113
+ <Box
114
+ padding="lg"
115
+ radius="md"
116
+ styles={{
117
+ '--spacing-lg': '2rem',
118
+ '--box-radius-md': '1rem',
119
+ backgroundColor: '#f8f9fa'
120
+ } as React.CSSProperties}
121
+ >
122
+ <p>This Box has custom spacing and radius values.</p>
123
+ </Box>
124
+ ```
125
+
126
+ ### Context-Based Theming
127
+
128
+ Create theme contexts with different variable values:
129
+
130
+ ```css
131
+ /* Light theme */
132
+ .theme-light {
133
+ --spacing-md: 1rem;
134
+ --box-radius-md: 0.375rem;
135
+ }
136
+
137
+ /* Dark theme */
138
+ .theme-dark {
139
+ --spacing-md: 1.25rem;
140
+ --box-radius-md: 0.5rem;
141
+ }
142
+
143
+ /* Compact theme */
144
+ .theme-compact {
145
+ --spacing-xs: 0.125rem;
146
+ --spacing-sm: 0.25rem;
147
+ --spacing-md: 0.5rem;
148
+ --spacing-lg: 0.75rem;
149
+ --spacing-xl: 1rem;
150
+ }
151
+ ```
152
+
153
+ ```tsx
154
+ <div className="theme-compact">
155
+ <Box padding="lg">
156
+ {/* Uses compact spacing values */}
157
+ <p>Compact theme with tighter spacing</p>
158
+ </Box>
159
+ </div>
160
+ ```
161
+
162
+ ### Responsive Custom Values
163
+
164
+ Combine CSS variables with media queries for advanced responsive design:
165
+
166
+ ```css
167
+ @media (min-width: 48rem) { /* 768px */
168
+ :root {
169
+ --spacing-lg: 2rem;
170
+ --box-max-width-container: 80rem;
171
+ }
172
+ }
173
+
174
+ @media (min-width: 80rem) { /* 1280px */
175
+ :root {
176
+ --spacing-xl: 3rem;
177
+ }
178
+ }
179
+ ```
180
+
181
+ ## Generated Utility Classes
182
+
183
+ Box generates utility classes from props. These classes use the CSS variables above.
184
+
185
+ ### Padding Classes
186
+
187
+ ```css
188
+ .box-padding-0 { padding: 0; }
189
+ .box-padding-xs { padding: var(--spacing-xs); }
190
+ .box-padding-sm { padding: var(--spacing-sm); }
191
+ .box-padding-md { padding: var(--spacing-md); }
192
+ .box-padding-lg { padding: var(--spacing-lg); }
193
+ .box-padding-xl { padding: var(--spacing-xl); }
194
+ ```
195
+
196
+ ### Padding Inline Classes (Logical Properties)
197
+
198
+ ```css
199
+ .box-padding-inline-xs { padding-inline: var(--spacing-xs); }
200
+ .box-padding-inline-sm { padding-inline: var(--spacing-sm); }
201
+ .box-padding-inline-md { padding-inline: var(--spacing-md); }
202
+ .box-padding-inline-lg { padding-inline: var(--spacing-lg); }
203
+ .box-padding-inline-xl { padding-inline: var(--spacing-xl); }
204
+ ```
205
+
206
+ ### Padding Block Classes (Logical Properties)
207
+
208
+ ```css
209
+ .box-padding-block-xs { padding-block: var(--spacing-xs); }
210
+ .box-padding-block-sm { padding-block: var(--spacing-sm); }
211
+ .box-padding-block-md { padding-block: var(--spacing-md); }
212
+ .box-padding-block-lg { padding-block: var(--spacing-lg); }
213
+ .box-padding-block-xl { padding-block: var(--spacing-xl); }
214
+ ```
215
+
216
+ ### Margin Classes
217
+
218
+ Similar pattern as padding:
219
+
220
+ ```css
221
+ .box-margin-0 { margin: 0; }
222
+ .box-margin-xs { margin: var(--spacing-xs); }
223
+ /* ... etc */
224
+ ```
225
+
226
+ ### Width Classes
227
+
228
+ ```css
229
+ .box-width-auto { width: auto; }
230
+ .box-width-full { width: 100%; }
231
+ .box-width-fit { width: fit-content; }
232
+ .box-width-max { width: max-content; }
233
+ ```
234
+
235
+ ### Max-Width Classes
236
+
237
+ ```css
238
+ .box-max-width-xs { max-width: var(--box-max-width-xs); }
239
+ .box-max-width-sm { max-width: var(--box-max-width-sm); }
240
+ .box-max-width-md { max-width: var(--box-max-width-md); }
241
+ .box-max-width-lg { max-width: var(--box-max-width-lg); }
242
+ .box-max-width-xl { max-width: var(--box-max-width-xl); }
243
+ .box-max-width-container { max-width: var(--box-max-width-container); }
244
+ ```
245
+
246
+ ### Border Radius Classes
247
+
248
+ ```css
249
+ .box-radius-0 { border-radius: 0; }
250
+ .box-radius-xs { border-radius: var(--box-radius-xs); }
251
+ .box-radius-sm { border-radius: var(--box-radius-sm); }
252
+ .box-radius-md { border-radius: var(--box-radius-md); }
253
+ .box-radius-lg { border-radius: var(--box-radius-lg); }
254
+ .box-radius-xl { border-radius: var(--box-radius-xl); }
255
+ .box-radius-full { border-radius: var(--box-radius-full); }
256
+ ```
257
+
258
+ ## Advanced Customization
259
+
260
+ ### Create Custom Spacing Tokens
261
+
262
+ Extend the spacing scale with custom values:
263
+
264
+ ```css
265
+ :root {
266
+ /* Add custom spacing values */
267
+ --spacing-xxs: 0.125rem; /* 2px */
268
+ --spacing-xxl: 3rem; /* 48px */
269
+ --spacing-jumbo: 5rem; /* 80px */
270
+ }
271
+ ```
272
+
273
+ ### Animation with CSS Variables
274
+
275
+ Animate spacing changes smoothly:
276
+
277
+ ```css
278
+ .box-animated {
279
+ transition: padding 0.3s ease;
280
+ }
281
+
282
+ .box-animated:hover {
283
+ --spacing-md: 1.5rem;
284
+ }
285
+ ```
286
+
287
+ ```tsx
288
+ <Box
289
+ padding="md"
290
+ className="box-animated"
291
+ styles={{ backgroundColor: '#f0f0f0' }}
292
+ >
293
+ Hover to see padding transition
294
+ </Box>
295
+ ```
296
+
297
+ ### Dark Mode Integration
298
+
299
+ Adjust spacing and radii for dark mode:
300
+
301
+ ```css
302
+ @media (prefers-color-scheme: dark) {
303
+ :root {
304
+ /* Slightly larger spacing for better readability in dark mode */
305
+ --spacing-md: 1rem;
306
+ --spacing-lg: 1.75rem;
307
+
308
+ /* More rounded corners for softer appearance */
309
+ --box-radius-md: 0.5rem;
310
+ --box-radius-lg: 0.75rem;
311
+ }
312
+ }
313
+ ```
314
+
315
+ ## Browser Compatibility
316
+
317
+ ### CSS Custom Properties
318
+ - **Supported**: All modern browsers (Chrome 49+, Firefox 31+, Safari 9.1+, Edge 15+)
319
+ - **Fallback**: For legacy browsers, consider PostCSS custom properties plugin
320
+
321
+ ### CSS Logical Properties
322
+ - **Supported**: Chrome 69+, Firefox 41+, Safari 12.1+, Edge 79+
323
+ - **Fallback**: Use directional properties (padding-left/right) for older browsers
324
+
325
+ ### CSS clamp()
326
+ - **Supported**: Chrome 79+, Firefox 75+, Safari 13.1+, Edge 79+
327
+ - **Fallback**: Use media queries with fixed rem values for older browsers
328
+
329
+ ## Performance Considerations
330
+
331
+ ### CSS Variable Performance
332
+ - **Inheritance**: CSS variables inherit through the DOM tree (O(1) lookup)
333
+ - **Repainting**: Changing CSS variables triggers repaint, not reflow (faster)
334
+ - **Memory**: Negligible memory overhead compared to inline styles
335
+
336
+ ### Build-Time Optimization
337
+ - Unused utility classes can be tree-shaken in production builds
338
+ - Consider PurgeCSS or similar tools to remove unused classes
339
+ - CSS variables defined but unused have minimal impact
340
+
341
+ ## Debugging CSS Variables
342
+
343
+ Use browser DevTools to inspect CSS variable values:
344
+
345
+ ```javascript
346
+ // Get computed value of a CSS variable
347
+ const box = document.querySelector('.box-padding-md');
348
+ const paddingValue = getComputedStyle(box).getPropertyValue('--spacing-md');
349
+ console.log(paddingValue); // e.g., "clamp(0.75rem, 0.65rem + 0.45vw, 1.125rem)"
350
+
351
+ // Set CSS variable programmatically
352
+ box.style.setProperty('--spacing-md', '2rem');
353
+ ```
354
+
355
+ ## Related Documentation
356
+
357
+ - [Box Component README](./README.mdx)
358
+ - [CSS Custom Properties (MDN)](https://developer.mozilla.org/en-US/docs/Web/CSS/--*)
359
+ - [CSS Logical Properties (MDN)](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
360
+ - [CSS clamp() (MDN)](https://developer.mozilla.org/en-US/docs/Web/CSS/clamp)
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Box Component Styles
3
+ *
4
+ * Utility classes for the Box layout primitive.
5
+ * All spacing values use the unified spacing scale from globals.
6
+ * All units are in rem (1rem = 16px base).
7
+ */
8
+
9
+ // ============================================================================
10
+ // Padding Utilities
11
+ // ============================================================================
12
+
13
+ // Padding on all sides
14
+ .box-padding-0 {
15
+ padding: 0;
16
+ }
17
+
18
+ .box-padding-xs {
19
+ padding: var(--spacing-xs);
20
+ }
21
+
22
+ .box-padding-sm {
23
+ padding: var(--spacing-sm);
24
+ }
25
+
26
+ .box-padding-md {
27
+ padding: var(--spacing-md);
28
+ }
29
+
30
+ .box-padding-lg {
31
+ padding: var(--spacing-lg);
32
+ }
33
+
34
+ .box-padding-xl {
35
+ padding: var(--spacing-xl);
36
+ }
37
+
38
+ // Padding inline (logical properties - left/right in LTR)
39
+ .box-padding-inline-0 {
40
+ padding-inline: 0;
41
+ }
42
+
43
+ .box-padding-inline-xs {
44
+ padding-inline: var(--spacing-xs);
45
+ }
46
+
47
+ .box-padding-inline-sm {
48
+ padding-inline: var(--spacing-sm);
49
+ }
50
+
51
+ .box-padding-inline-md {
52
+ padding-inline: var(--spacing-md);
53
+ }
54
+
55
+ .box-padding-inline-lg {
56
+ padding-inline: var(--spacing-lg);
57
+ }
58
+
59
+ .box-padding-inline-xl {
60
+ padding-inline: var(--spacing-xl);
61
+ }
62
+
63
+ // Padding block (logical properties - top/bottom)
64
+ .box-padding-block-0 {
65
+ padding-block: 0;
66
+ }
67
+
68
+ .box-padding-block-xs {
69
+ padding-block: var(--spacing-xs);
70
+ }
71
+
72
+ .box-padding-block-sm {
73
+ padding-block: var(--spacing-sm);
74
+ }
75
+
76
+ .box-padding-block-md {
77
+ padding-block: var(--spacing-md);
78
+ }
79
+
80
+ .box-padding-block-lg {
81
+ padding-block: var(--spacing-lg);
82
+ }
83
+
84
+ .box-padding-block-xl {
85
+ padding-block: var(--spacing-xl);
86
+ }
87
+
88
+ // ============================================================================
89
+ // Margin Utilities
90
+ // ============================================================================
91
+
92
+ // Margin on all sides
93
+ .box-margin-0 {
94
+ margin: 0;
95
+ }
96
+
97
+ .box-margin-xs {
98
+ margin: var(--spacing-xs);
99
+ }
100
+
101
+ .box-margin-sm {
102
+ margin: var(--spacing-sm);
103
+ }
104
+
105
+ .box-margin-md {
106
+ margin: var(--spacing-md);
107
+ }
108
+
109
+ .box-margin-lg {
110
+ margin: var(--spacing-lg);
111
+ }
112
+
113
+ .box-margin-xl {
114
+ margin: var(--spacing-xl);
115
+ }
116
+
117
+ // Margin inline (logical properties - left/right in LTR)
118
+ .box-margin-inline-0 {
119
+ margin-inline: 0;
120
+ }
121
+
122
+ .box-margin-inline-xs {
123
+ margin-inline: var(--spacing-xs);
124
+ }
125
+
126
+ .box-margin-inline-sm {
127
+ margin-inline: var(--spacing-sm);
128
+ }
129
+
130
+ .box-margin-inline-md {
131
+ margin-inline: var(--spacing-md);
132
+ }
133
+
134
+ .box-margin-inline-lg {
135
+ margin-inline: var(--spacing-lg);
136
+ }
137
+
138
+ .box-margin-inline-xl {
139
+ margin-inline: var(--spacing-xl);
140
+ }
141
+
142
+ // Margin block (logical properties - top/bottom)
143
+ .box-margin-block-0 {
144
+ margin-block: 0;
145
+ }
146
+
147
+ .box-margin-block-xs {
148
+ margin-block: var(--spacing-xs);
149
+ }
150
+
151
+ .box-margin-block-sm {
152
+ margin-block: var(--spacing-sm);
153
+ }
154
+
155
+ .box-margin-block-md {
156
+ margin-block: var(--spacing-md);
157
+ }
158
+
159
+ .box-margin-block-lg {
160
+ margin-block: var(--spacing-lg);
161
+ }
162
+
163
+ .box-margin-block-xl {
164
+ margin-block: var(--spacing-xl);
165
+ }
166
+
167
+ // ============================================================================
168
+ // Width Utilities
169
+ // ============================================================================
170
+
171
+ .box-width-auto {
172
+ width: auto;
173
+ }
174
+
175
+ .box-width-full {
176
+ width: 100%;
177
+ }
178
+
179
+ .box-width-fit {
180
+ width: fit-content;
181
+ }
182
+
183
+ .box-width-max {
184
+ width: max-content;
185
+ }
186
+
187
+ // ============================================================================
188
+ // Max-Width Utilities
189
+ // ============================================================================
190
+
191
+ .box-max-width-xs {
192
+ max-width: var(--box-max-width-xs);
193
+ }
194
+
195
+ .box-max-width-sm {
196
+ max-width: var(--box-max-width-sm);
197
+ }
198
+
199
+ .box-max-width-md {
200
+ max-width: var(--box-max-width-md);
201
+ }
202
+
203
+ .box-max-width-lg {
204
+ max-width: var(--box-max-width-lg);
205
+ }
206
+
207
+ .box-max-width-xl {
208
+ max-width: var(--box-max-width-xl);
209
+ }
210
+
211
+ .box-max-width-container {
212
+ max-width: var(--box-max-width-container);
213
+ }
214
+
215
+ // ============================================================================
216
+ // Border Radius Utilities
217
+ // ============================================================================
218
+
219
+ .box-radius-0 {
220
+ border-radius: 0;
221
+ }
222
+
223
+ .box-radius-xs {
224
+ border-radius: var(--box-radius-xs);
225
+ }
226
+
227
+ .box-radius-sm {
228
+ border-radius: var(--box-radius-sm);
229
+ }
230
+
231
+ .box-radius-md {
232
+ border-radius: var(--box-radius-md);
233
+ }
234
+
235
+ .box-radius-lg {
236
+ border-radius: var(--box-radius-lg);
237
+ }
238
+
239
+ .box-radius-xl {
240
+ border-radius: var(--box-radius-xl);
241
+ }
242
+
243
+ .box-radius-full {
244
+ border-radius: var(--box-radius-full);
245
+ }