@fpkit/acss 3.1.0 → 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 (239) 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-23ANBDCR.js → chunk-4I5MF54P.js} +3 -3
  6. package/libs/chunk-4I5MF54P.js.map +1 -0
  7. package/libs/chunk-5CJPTDK3.cjs +31 -0
  8. package/libs/chunk-5CJPTDK3.cjs.map +1 -0
  9. package/libs/{chunk-E4OSROCA.cjs → chunk-5QSNJQVH.cjs} +3 -3
  10. package/libs/{chunk-O3JIHC5M.cjs → chunk-6BUJZ4DJ.cjs} +3 -3
  11. package/libs/{chunk-WXBFBWYF.cjs → chunk-AFINOD2L.cjs} +3 -3
  12. package/libs/{chunk-HRRHPLER.js → chunk-AWZLSWDO.js} +2 -2
  13. package/libs/chunk-DDSXKOUB.js +7 -0
  14. package/libs/chunk-DDSXKOUB.js.map +1 -0
  15. package/libs/{chunk-CWRNJA4P.js → chunk-DIJBIOFE.js} +3 -3
  16. package/libs/chunk-EJ6KYBFE.cjs +13 -0
  17. package/libs/chunk-EJ6KYBFE.cjs.map +1 -0
  18. package/libs/{chunk-GUJSMQ3V.cjs → chunk-EKJYOCLY.cjs} +3 -3
  19. package/libs/{chunk-X5RKCLDC.cjs → chunk-F64GE6RG.cjs} +4 -4
  20. package/libs/chunk-FMIM3332.js +8 -0
  21. package/libs/chunk-FMIM3332.js.map +1 -0
  22. package/libs/{chunk-5RAWNUVD.js → chunk-IBUTNPTQ.js} +2 -2
  23. package/libs/chunk-IWP4VJEP.cjs +18 -0
  24. package/libs/chunk-IWP4VJEP.cjs.map +1 -0
  25. package/libs/{chunk-ZFJ4U45S.js → chunk-KDMX3FAW.js} +2 -2
  26. package/libs/{chunk-DYFAUAB7.cjs → chunk-LXODKKA3.cjs} +4 -4
  27. package/libs/chunk-M7JLT62Q.js +9 -0
  28. package/libs/chunk-M7JLT62Q.js.map +1 -0
  29. package/libs/{chunk-IQ76HGVP.js → chunk-MBWI67UT.js} +2 -2
  30. package/libs/{chunk-O5XAJ7BY.cjs → chunk-NCGVF2QS.cjs} +4 -4
  31. package/libs/{chunk-W2UIN7EV.cjs → chunk-NPWHQVYB.cjs} +3 -3
  32. package/libs/{chunk-G55UJ53G.cjs → chunk-NZVSXRTB.cjs} +3 -3
  33. package/libs/chunk-NZVSXRTB.cjs.map +1 -0
  34. package/libs/{chunk-43TK2ICH.js → chunk-PMWL5XZ4.js} +3 -3
  35. package/libs/{chunk-KVKQLRJG.js → chunk-TF3GQKOY.js} +2 -2
  36. package/libs/chunk-TNEJXNZA.cjs +22 -0
  37. package/libs/chunk-TNEJXNZA.cjs.map +1 -0
  38. package/libs/{chunk-IEB64SWY.js → chunk-U5VA34SU.js} +2 -2
  39. package/libs/chunk-UGMP72J2.js +8 -0
  40. package/libs/chunk-UGMP72J2.js.map +1 -0
  41. package/libs/{chunk-MGPWZRBX.cjs → chunk-URBGDUFN.cjs} +6 -6
  42. package/libs/{chunk-QKHPHMG2.js → chunk-ZF6Y7W57.js} +5 -5
  43. package/libs/component-props-50e69975.d.ts +66 -0
  44. package/libs/components/box/box.css +1 -0
  45. package/libs/components/box/box.css.map +1 -0
  46. package/libs/components/box/box.min.css +3 -0
  47. package/libs/components/breadcrumbs/breadcrumb.cjs +6 -6
  48. package/libs/components/breadcrumbs/breadcrumb.js +3 -3
  49. package/libs/components/button.cjs +4 -4
  50. package/libs/components/button.d.cts +10 -3
  51. package/libs/components/button.d.ts +10 -3
  52. package/libs/components/button.js +2 -2
  53. package/libs/components/card.cjs +7 -7
  54. package/libs/components/card.d.cts +13 -85
  55. package/libs/components/card.d.ts +13 -85
  56. package/libs/components/card.js +2 -2
  57. package/libs/components/cards/card.css +1 -1
  58. package/libs/components/cards/card.css.map +1 -1
  59. package/libs/components/cards/card.min.css +2 -2
  60. package/libs/components/cluster/cluster.css +1 -0
  61. package/libs/components/cluster/cluster.css.map +1 -0
  62. package/libs/components/cluster/cluster.min.css +3 -0
  63. package/libs/components/dialog/dialog.cjs +7 -7
  64. package/libs/components/dialog/dialog.js +5 -5
  65. package/libs/components/form/fields.cjs +4 -4
  66. package/libs/components/form/fields.js +2 -2
  67. package/libs/components/form/textarea.cjs +4 -4
  68. package/libs/components/form/textarea.js +2 -2
  69. package/libs/components/grid/grid.css +1 -0
  70. package/libs/components/grid/grid.css.map +1 -0
  71. package/libs/components/grid/grid.min.css +3 -0
  72. package/libs/components/heading/heading.cjs +3 -3
  73. package/libs/components/heading/heading.js +2 -2
  74. package/libs/components/icons/icon.cjs +4 -4
  75. package/libs/components/icons/icon.d.cts +2 -2
  76. package/libs/components/icons/icon.d.ts +2 -2
  77. package/libs/components/icons/icon.js +2 -2
  78. package/libs/components/link/link.cjs +6 -6
  79. package/libs/components/link/link.js +2 -2
  80. package/libs/components/list/list.cjs +5 -5
  81. package/libs/components/list/list.js +2 -2
  82. package/libs/components/modal.cjs +4 -4
  83. package/libs/components/modal.d.cts +1 -1
  84. package/libs/components/modal.d.ts +1 -1
  85. package/libs/components/modal.js +3 -3
  86. package/libs/components/nav/nav.cjs +7 -7
  87. package/libs/components/nav/nav.js +3 -3
  88. package/libs/components/popover/popover.cjs +4 -4
  89. package/libs/components/popover/popover.d.cts +1 -1
  90. package/libs/components/popover/popover.d.ts +1 -1
  91. package/libs/components/popover/popover.js +1 -1
  92. package/libs/components/stack/stack.css +1 -0
  93. package/libs/components/stack/stack.css.map +1 -0
  94. package/libs/components/stack/stack.min.css +3 -0
  95. package/libs/components/tables/table.cjs +4 -4
  96. package/libs/components/tables/table.d.cts +2 -2
  97. package/libs/components/tables/table.d.ts +2 -2
  98. package/libs/components/tables/table.js +1 -1
  99. package/libs/components/text/text.cjs +5 -5
  100. package/libs/components/text/text.js +2 -2
  101. package/libs/hooks.cjs +4 -4
  102. package/libs/hooks.js +3 -3
  103. package/libs/{icons-287fce3a.d.ts → icons-df8e744f.d.ts} +1 -1
  104. package/libs/icons.cjs +3 -3
  105. package/libs/icons.d.cts +2 -2
  106. package/libs/icons.d.ts +2 -2
  107. package/libs/icons.js +2 -2
  108. package/libs/index.cjs +74 -73
  109. package/libs/index.cjs.map +1 -1
  110. package/libs/index.css +1 -1
  111. package/libs/index.css.map +1 -1
  112. package/libs/index.d.cts +925 -6
  113. package/libs/index.d.ts +925 -6
  114. package/libs/index.js +30 -30
  115. package/libs/index.js.map +1 -1
  116. package/package.json +2 -2
  117. package/src/App.tsx +1 -3
  118. package/src/components/alert/STYLES.mdx +790 -0
  119. package/src/components/badge/STYLES.mdx +610 -0
  120. package/src/components/box/README.mdx +401 -0
  121. package/src/components/box/STYLES.mdx +360 -0
  122. package/src/components/box/box.scss +245 -0
  123. package/src/components/box/box.stories.tsx +395 -0
  124. package/src/components/box/box.test.tsx +425 -0
  125. package/src/components/box/box.tsx +170 -0
  126. package/src/components/box/box.types.ts +166 -0
  127. package/src/components/breadcrumbs/STYLES.mdx +99 -0
  128. package/src/components/breadcrumbs/bc-item.tsx +0 -1
  129. package/src/components/buttons/STYLES.mdx +766 -0
  130. package/src/components/cards/STYLES.mdx +835 -0
  131. package/src/components/cards/card.scss +29 -21
  132. package/src/components/cards/card.tsx +13 -3
  133. package/src/components/cards/card.types.ts +13 -0
  134. package/src/components/cluster/README.mdx +595 -0
  135. package/src/components/cluster/STYLES.mdx +626 -0
  136. package/src/components/cluster/cluster.scss +86 -0
  137. package/src/components/cluster/cluster.stories.tsx +385 -0
  138. package/src/components/cluster/cluster.test.tsx +655 -0
  139. package/src/components/cluster/cluster.tsx +94 -0
  140. package/src/components/cluster/cluster.types.ts +75 -0
  141. package/src/components/details/STYLES.mdx +445 -0
  142. package/src/components/dialog/STYLES.mdx +888 -0
  143. package/src/components/flexbox/STYLES.mdx +857 -0
  144. package/src/components/flexbox/flex.stories.tsx +842 -141
  145. package/src/components/flexbox/flex.types.ts +25 -6
  146. package/src/components/form/STYLES.mdx +821 -0
  147. package/src/components/grid/README.mdx +709 -0
  148. package/src/components/grid/STYLES.mdx +785 -0
  149. package/src/components/grid/grid.scss +287 -0
  150. package/src/components/grid/grid.stories.tsx +486 -0
  151. package/src/components/grid/grid.test.tsx +981 -0
  152. package/src/components/grid/grid.tsx +222 -0
  153. package/src/components/grid/grid.types.ts +344 -0
  154. package/src/components/icons/STYLES.mdx +56 -0
  155. package/src/components/icons/components/arrow-right.tsx +0 -5
  156. package/src/components/images/STYLES.mdx +75 -0
  157. package/src/components/kit.tsx +8 -4
  158. package/src/components/layout/STYLES.mdx +556 -0
  159. package/src/components/link/STYLES.mdx +75 -0
  160. package/src/components/list/STYLES.mdx +631 -0
  161. package/src/components/nav/STYLES.mdx +460 -0
  162. package/src/components/popover/popover.tsx +1 -1
  163. package/src/components/progress/STYLES.mdx +64 -0
  164. package/src/components/stack/README.mdx +400 -0
  165. package/src/components/stack/STYLES.mdx +414 -0
  166. package/src/components/stack/stack.scss +109 -0
  167. package/src/components/stack/stack.stories.tsx +559 -0
  168. package/src/components/stack/stack.test.tsx +426 -0
  169. package/src/components/stack/stack.tsx +141 -0
  170. package/src/components/stack/stack.types.ts +133 -0
  171. package/src/components/tables/table-elements.tsx +1 -1
  172. package/src/components/tables/table.tsx +2 -2
  173. package/src/components/tag/STYLES.mdx +105 -0
  174. package/src/components/text-to-speech/STYLES.mdx +80 -0
  175. package/src/components/text-to-speech/TextToSpeech.tsx +0 -4
  176. package/src/components/text-to-speech/useTextToSpeech.tsx +2 -6
  177. package/src/components/ui.tsx +3 -3
  178. package/src/decorators/instructions.tsx +22 -18
  179. package/src/hooks/popover/popover.tsx +1 -1
  180. package/src/index.scss +5 -1
  181. package/src/index.ts +305 -12
  182. package/src/sass/GLOBALS-STYLES.md +631 -0
  183. package/src/sass/_globals.scss +45 -24
  184. package/src/styles/box/box.css +220 -0
  185. package/src/styles/box/box.css.map +1 -0
  186. package/src/styles/cards/card.css +22 -17
  187. package/src/styles/cards/card.css.map +1 -1
  188. package/src/styles/cluster/cluster.css +71 -0
  189. package/src/styles/cluster/cluster.css.map +1 -0
  190. package/src/styles/grid/grid.css +238 -0
  191. package/src/styles/grid/grid.css.map +1 -0
  192. package/src/styles/index.css +667 -49
  193. package/src/styles/index.css.map +1 -1
  194. package/src/styles/stack/stack.css +86 -0
  195. package/src/styles/stack/stack.css.map +1 -0
  196. package/src/types/component-props.ts +42 -13
  197. package/src/types/layout-primitives.ts +48 -0
  198. package/src/types/shared.ts +10 -26
  199. package/libs/chunk-23ANBDCR.js.map +0 -1
  200. package/libs/chunk-5QD3DWFI.js +0 -9
  201. package/libs/chunk-5QD3DWFI.js.map +0 -1
  202. package/libs/chunk-6WTC4JXH.cjs +0 -31
  203. package/libs/chunk-6WTC4JXH.cjs.map +0 -1
  204. package/libs/chunk-ENTCUJ3A.cjs +0 -13
  205. package/libs/chunk-ENTCUJ3A.cjs.map +0 -1
  206. package/libs/chunk-G55UJ53G.cjs.map +0 -1
  207. package/libs/chunk-HHLNOC5T.js +0 -7
  208. package/libs/chunk-HHLNOC5T.js.map +0 -1
  209. package/libs/chunk-KK47SYZI.js +0 -8
  210. package/libs/chunk-KK47SYZI.js.map +0 -1
  211. package/libs/chunk-US2I5GI7.cjs +0 -22
  212. package/libs/chunk-US2I5GI7.cjs.map +0 -1
  213. package/libs/chunk-W5TKWBFC.cjs +0 -18
  214. package/libs/chunk-W5TKWBFC.cjs.map +0 -1
  215. package/libs/chunk-Y2PFDELK.js +0 -8
  216. package/libs/chunk-Y2PFDELK.js.map +0 -1
  217. package/libs/component-props-67d978a2.d.ts +0 -38
  218. /package/libs/{chunk-2NRIP6RB.cjs.map → chunk-2C3YLBWP.cjs.map} +0 -0
  219. /package/libs/{chunk-NWJDAHP6.cjs.map → chunk-2GJHKWEK.cjs.map} +0 -0
  220. /package/libs/{chunk-FVROL3V5.js.map → chunk-2JCDEC32.js.map} +0 -0
  221. /package/libs/{chunk-IRLFZ3OL.js.map → chunk-3XJC4XUG.js.map} +0 -0
  222. /package/libs/{chunk-E4OSROCA.cjs.map → chunk-5QSNJQVH.cjs.map} +0 -0
  223. /package/libs/{chunk-O3JIHC5M.cjs.map → chunk-6BUJZ4DJ.cjs.map} +0 -0
  224. /package/libs/{chunk-WXBFBWYF.cjs.map → chunk-AFINOD2L.cjs.map} +0 -0
  225. /package/libs/{chunk-HRRHPLER.js.map → chunk-AWZLSWDO.js.map} +0 -0
  226. /package/libs/{chunk-CWRNJA4P.js.map → chunk-DIJBIOFE.js.map} +0 -0
  227. /package/libs/{chunk-GUJSMQ3V.cjs.map → chunk-EKJYOCLY.cjs.map} +0 -0
  228. /package/libs/{chunk-X5RKCLDC.cjs.map → chunk-F64GE6RG.cjs.map} +0 -0
  229. /package/libs/{chunk-5RAWNUVD.js.map → chunk-IBUTNPTQ.js.map} +0 -0
  230. /package/libs/{chunk-ZFJ4U45S.js.map → chunk-KDMX3FAW.js.map} +0 -0
  231. /package/libs/{chunk-DYFAUAB7.cjs.map → chunk-LXODKKA3.cjs.map} +0 -0
  232. /package/libs/{chunk-IQ76HGVP.js.map → chunk-MBWI67UT.js.map} +0 -0
  233. /package/libs/{chunk-O5XAJ7BY.cjs.map → chunk-NCGVF2QS.cjs.map} +0 -0
  234. /package/libs/{chunk-W2UIN7EV.cjs.map → chunk-NPWHQVYB.cjs.map} +0 -0
  235. /package/libs/{chunk-43TK2ICH.js.map → chunk-PMWL5XZ4.js.map} +0 -0
  236. /package/libs/{chunk-KVKQLRJG.js.map → chunk-TF3GQKOY.js.map} +0 -0
  237. /package/libs/{chunk-IEB64SWY.js.map → chunk-U5VA34SU.js.map} +0 -0
  238. /package/libs/{chunk-MGPWZRBX.cjs.map → chunk-URBGDUFN.cjs.map} +0 -0
  239. /package/libs/{chunk-QKHPHMG2.js.map → chunk-ZF6Y7W57.js.map} +0 -0
@@ -0,0 +1,395 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
+
4
+ import { Box } from "./box";
5
+ import "./box.scss";
6
+
7
+ const meta: Meta<typeof Box> = {
8
+ title: "FP.React Components/Layout/Box",
9
+ component: Box,
10
+ tags: ["autodocs", "rc", "layout"],
11
+ parameters: {
12
+ docs: {
13
+ description: {
14
+ component: `
15
+ # Box - Layout Primitive
16
+
17
+ A fundamental container primitive for spacing and sizing control. Provides comprehensive control over padding, margin, width, and border radius using a unified spacing scale.
18
+
19
+ ## Features
20
+
21
+ - **Unified Spacing Scale**: Fluid responsive spacing using CSS clamp()
22
+ - **Logical Properties**: padding-inline/padding-block for i18n support
23
+ - **Polymorphic**: Render as any semantic HTML element
24
+ - **CSS Custom Properties**: Runtime theming
25
+ - **Type-Safe**: Full TypeScript support
26
+ - **Zero Runtime**: Utility classes compiled at build time
27
+
28
+ [View Full Documentation →](https://github.com/anthropics/fpkit/blob/main/packages/fpkit/src/components/box/README.mdx)
29
+ `,
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ export default meta;
36
+ type Story = StoryObj<typeof meta>;
37
+
38
+ /**
39
+ * Default Box component with medium padding.
40
+ * Demonstrates basic usage as a container with padding.
41
+ */
42
+ export const Default: Story = {
43
+ args: {
44
+ padding: "md",
45
+ children: "Default Box with medium padding",
46
+ },
47
+ play: async ({ canvasElement, step }) => {
48
+ const canvas = within(canvasElement);
49
+
50
+ await step("Box renders correctly", async () => {
51
+ const box = canvas.getByText("Default Box with medium padding");
52
+ expect(box).toBeInTheDocument();
53
+ expect(box).toHaveClass("box-padding-md");
54
+ });
55
+ },
56
+ };
57
+
58
+ /**
59
+ * Box with different padding sizes.
60
+ * Demonstrates the unified spacing scale from xs to xl.
61
+ */
62
+ export const PaddingSizes: Story = {
63
+ render: () => (
64
+ <div style={{ display: "flex", flexDirection: "column", gap: "1rem" }}>
65
+ <Box padding="xs" styles={{ backgroundColor: "#f0f0f0" }}>
66
+ Padding XS (4-8px)
67
+ </Box>
68
+ <Box padding="sm" styles={{ backgroundColor: "#f0f0f0" }}>
69
+ Padding SM (8-12px)
70
+ </Box>
71
+ <Box padding="md" styles={{ backgroundColor: "#f0f0f0" }}>
72
+ Padding MD (12-18px)
73
+ </Box>
74
+ <Box padding="lg" styles={{ backgroundColor: "#f0f0f0" }}>
75
+ Padding LG (16-24px)
76
+ </Box>
77
+ <Box padding="xl" styles={{ backgroundColor: "#f0f0f0" }}>
78
+ Padding XL (24-32px)
79
+ </Box>
80
+ </div>
81
+ ),
82
+ };
83
+
84
+ /**
85
+ * Box with asymmetric padding using logical properties.
86
+ * Demonstrates paddingInline and paddingBlock for different horizontal/vertical padding.
87
+ */
88
+ export const AsymmetricPadding: Story = {
89
+ args: {
90
+ paddingInline: "xl",
91
+ paddingBlock: "sm",
92
+ styles: { backgroundColor: "#e8f4f8", border: "2px dashed #0066cc" },
93
+ children: "Wide horizontal padding, narrow vertical padding",
94
+ },
95
+ };
96
+
97
+ /**
98
+ * Box with margin spacing.
99
+ * Demonstrates margin control with the spacing scale.
100
+ */
101
+ export const WithMargin: Story = {
102
+ render: () => (
103
+ <div style={{ border: "2px solid #ccc", padding: "1rem" }}>
104
+ <Box
105
+ margin="lg"
106
+ padding="md"
107
+ styles={{ backgroundColor: "#f0f0f0" }}
108
+ >
109
+ Box with large margin on all sides
110
+ </Box>
111
+ </div>
112
+ ),
113
+ };
114
+
115
+ /**
116
+ * Box with different width options.
117
+ * Demonstrates width control: auto, full, fit, and max.
118
+ */
119
+ export const WidthVariants: Story = {
120
+ render: () => (
121
+ <div style={{ display: "flex", flexDirection: "column", gap: "1rem" }}>
122
+ <Box width="auto" padding="md" styles={{ backgroundColor: "#f0f0f0" }}>
123
+ Width: auto (default, natural width)
124
+ </Box>
125
+ <Box width="full" padding="md" styles={{ backgroundColor: "#e8f4f8" }}>
126
+ Width: full (100% width)
127
+ </Box>
128
+ <Box width="fit" padding="md" styles={{ backgroundColor: "#fff3cd" }}>
129
+ Width: fit (fits content)
130
+ </Box>
131
+ <Box width="max" padding="md" styles={{ backgroundColor: "#f8d7da" }}>
132
+ Width: max (max-content)
133
+ </Box>
134
+ </div>
135
+ ),
136
+ };
137
+
138
+ /**
139
+ * Box with maximum width constraints.
140
+ * Useful for readable text widths and centered containers.
141
+ */
142
+ export const MaxWidthVariants: Story = {
143
+ render: () => (
144
+ <div style={{ display: "flex", flexDirection: "column", gap: "1rem" }}>
145
+ <Box
146
+ maxWidth="xs"
147
+ padding="md"
148
+ styles={{ backgroundColor: "#f0f0f0", marginInline: "auto" }}
149
+ >
150
+ Max Width XS (480px) - Great for mobile layouts
151
+ </Box>
152
+ <Box
153
+ maxWidth="sm"
154
+ padding="md"
155
+ styles={{ backgroundColor: "#e8f4f8", marginInline: "auto" }}
156
+ >
157
+ Max Width SM (640px) - Good for narrow content
158
+ </Box>
159
+ <Box
160
+ maxWidth="md"
161
+ padding="md"
162
+ styles={{ backgroundColor: "#fff3cd", marginInline: "auto" }}
163
+ >
164
+ Max Width MD (768px) - Tablet-friendly width
165
+ </Box>
166
+ <Box
167
+ maxWidth="container"
168
+ padding="md"
169
+ styles={{ backgroundColor: "#d4edda", marginInline: "auto" }}
170
+ >
171
+ Max Width Container (1200px) - Standard page container
172
+ </Box>
173
+ </div>
174
+ ),
175
+ };
176
+
177
+ /**
178
+ * Centered container pattern.
179
+ * Common pattern for page layouts with max-width and auto margins.
180
+ */
181
+ export const CenteredContainer: Story = {
182
+ args: {
183
+ padding: "lg",
184
+ maxWidth: "container",
185
+ styles: { marginInline: "auto", backgroundColor: "#f8f9fa" },
186
+ children: (
187
+ <>
188
+ <h2 style={{ marginTop: 0 }}>Centered Container</h2>
189
+ <p>
190
+ This is a common pattern for page layouts. The container has a max
191
+ width of 1200px and is centered using marginInline: auto.
192
+ </p>
193
+ </>
194
+ ),
195
+ },
196
+ };
197
+
198
+ /**
199
+ * Box with border radius options.
200
+ * Demonstrates rounded corners from subtle to fully rounded.
201
+ */
202
+ export const BorderRadiusVariants: Story = {
203
+ render: () => (
204
+ <div style={{ display: "flex", flexDirection: "column", gap: "1rem" }}>
205
+ <Box
206
+ radius="xs"
207
+ padding="md"
208
+ styles={{ backgroundColor: "#f0f0f0", border: "1px solid #ccc" }}
209
+ >
210
+ Radius XS (2px) - Subtle rounding
211
+ </Box>
212
+ <Box
213
+ radius="sm"
214
+ padding="md"
215
+ styles={{ backgroundColor: "#e8f4f8", border: "1px solid #0066cc" }}
216
+ >
217
+ Radius SM (4px) - Small rounding
218
+ </Box>
219
+ <Box
220
+ radius="md"
221
+ padding="md"
222
+ styles={{ backgroundColor: "#fff3cd", border: "1px solid #856404" }}
223
+ >
224
+ Radius MD (6px) - Medium rounding
225
+ </Box>
226
+ <Box
227
+ radius="lg"
228
+ padding="md"
229
+ styles={{ backgroundColor: "#d4edda", border: "1px solid #155724" }}
230
+ >
231
+ Radius LG (8px) - Large rounding
232
+ </Box>
233
+ <Box
234
+ radius="xl"
235
+ padding="md"
236
+ styles={{ backgroundColor: "#f8d7da", border: "1px solid #721c24" }}
237
+ >
238
+ Radius XL (12px) - Extra large rounding
239
+ </Box>
240
+ <Box
241
+ radius="full"
242
+ padding="md"
243
+ width="fit"
244
+ styles={{ backgroundColor: "#d1ecf1", border: "1px solid #0c5460" }}
245
+ >
246
+ Radius Full (9999px) - Fully rounded pill
247
+ </Box>
248
+ </div>
249
+ ),
250
+ };
251
+
252
+ /**
253
+ * Card-like Box component.
254
+ * Demonstrates creating a card with padding, radius, and shadow.
255
+ */
256
+ export const CardLike: Story = {
257
+ args: {
258
+ padding: "lg",
259
+ radius: "md",
260
+ as: "article",
261
+ styles: {
262
+ backgroundColor: "#fff",
263
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
264
+ border: "1px solid #e0e0e0",
265
+ },
266
+ children: (
267
+ <>
268
+ <h3 style={{ marginTop: 0 }}>Card Title</h3>
269
+ <p>
270
+ This Box is styled to look like a card with padding, border radius,
271
+ and a subtle shadow. It uses semantic HTML (article) for better
272
+ accessibility.
273
+ </p>
274
+ <button type="button" style={{ marginTop: "0.5rem" }}>
275
+ Action
276
+ </button>
277
+ </>
278
+ ),
279
+ },
280
+ };
281
+
282
+ /**
283
+ * Semantic HTML variations.
284
+ * Demonstrates polymorphic rendering with different HTML elements.
285
+ */
286
+ export const SemanticVariants: Story = {
287
+ render: () => (
288
+ <div style={{ display: "flex", flexDirection: "column", gap: "1rem" }}>
289
+ <Box as="div" padding="md" styles={{ backgroundColor: "#f0f0f0" }}>
290
+ <code>&lt;div&gt;</code> - Generic container (default)
291
+ </Box>
292
+ <Box as="section" padding="md" styles={{ backgroundColor: "#e8f4f8" }}>
293
+ <code>&lt;section&gt;</code> - Thematic grouping
294
+ </Box>
295
+ <Box as="article" padding="md" styles={{ backgroundColor: "#fff3cd" }}>
296
+ <code>&lt;article&gt;</code> - Self-contained content
297
+ </Box>
298
+ <Box as="aside" padding="md" styles={{ backgroundColor: "#d4edda" }}>
299
+ <code>&lt;aside&gt;</code> - Tangentially related content
300
+ </Box>
301
+ <Box as="main" padding="md" styles={{ backgroundColor: "#f8d7da" }}>
302
+ <code>&lt;main&gt;</code> - Primary page content
303
+ </Box>
304
+ <Box as="header" padding="md" styles={{ backgroundColor: "#d1ecf1" }}>
305
+ <code>&lt;header&gt;</code> - Page/section header
306
+ </Box>
307
+ <Box as="footer" padding="md" styles={{ backgroundColor: "#e2e3e5" }}>
308
+ <code>&lt;footer&gt;</code> - Page/section footer
309
+ </Box>
310
+ </div>
311
+ ),
312
+ };
313
+
314
+ /**
315
+ * Composition example.
316
+ * Demonstrates nesting Box components for complex layouts.
317
+ */
318
+ export const Composition: Story = {
319
+ render: () => (
320
+ <Box padding="lg" styles={{ backgroundColor: "#f8f9fa" }}>
321
+ <h2 style={{ marginTop: 0 }}>Outer Container</h2>
322
+ <Box
323
+ padding="md"
324
+ margin="md"
325
+ radius="md"
326
+ styles={{ backgroundColor: "#fff", boxShadow: "0 1px 3px rgba(0,0,0,0.1)" }}
327
+ >
328
+ <h3 style={{ marginTop: 0 }}>Nested Box 1</h3>
329
+ <p>Boxes can be nested to create complex layouts.</p>
330
+ </Box>
331
+ <Box
332
+ padding="md"
333
+ margin="md"
334
+ radius="md"
335
+ styles={{ backgroundColor: "#fff", boxShadow: "0 1px 3px rgba(0,0,0,0.1)" }}
336
+ >
337
+ <h3 style={{ marginTop: 0 }}>Nested Box 2</h3>
338
+ <p>Each Box is independent with its own spacing and styling.</p>
339
+ </Box>
340
+ </Box>
341
+ ),
342
+ };
343
+
344
+ /**
345
+ * CSS Custom Property Override.
346
+ * Demonstrates theming by overriding CSS custom properties.
347
+ */
348
+ export const CustomProperties: Story = {
349
+ args: {
350
+ padding: "lg",
351
+ radius: "md",
352
+ styles: {
353
+ // Override spacing and radius via CSS variables
354
+ "--spacing-lg": "2rem",
355
+ "--box-radius-md": "1rem",
356
+ backgroundColor: "#e8f4f8",
357
+ border: "2px solid #0066cc",
358
+ } as React.CSSProperties,
359
+ children: (
360
+ <>
361
+ <h3 style={{ marginTop: 0 }}>Custom CSS Properties</h3>
362
+ <p>
363
+ This Box overrides --spacing-lg and --box-radius-md to demonstrate
364
+ theming via CSS custom properties.
365
+ </p>
366
+ </>
367
+ ),
368
+ },
369
+ };
370
+
371
+ /**
372
+ * Responsive full-width section.
373
+ * Common pattern for full-width hero or section layouts.
374
+ */
375
+ export const FullWidthSection: Story = {
376
+ args: {
377
+ as: "section",
378
+ width: "full",
379
+ paddingBlock: "xl",
380
+ paddingInline: "lg",
381
+ styles: {
382
+ backgroundColor: "#0066cc",
383
+ color: "#fff",
384
+ },
385
+ children: (
386
+ <>
387
+ <h2 style={{ marginTop: 0, color: "#fff" }}>Full-Width Hero Section</h2>
388
+ <p style={{ maxWidth: "60ch" }}>
389
+ This pattern is common for hero sections or full-width content areas.
390
+ Uses paddingBlock and paddingInline for responsive spacing.
391
+ </p>
392
+ </>
393
+ ),
394
+ },
395
+ };