@fpkit/acss 3.0.0 → 3.1.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.
Files changed (119) hide show
  1. package/libs/{chunk-23ANBDCR.js → chunk-4I5MF54P.js} +3 -3
  2. package/libs/chunk-4I5MF54P.js.map +1 -0
  3. package/libs/chunk-5RAWNUVD.js +8 -0
  4. package/libs/chunk-5RAWNUVD.js.map +1 -0
  5. package/libs/{chunk-D2PSO7MU.js → chunk-CWRNJA4P.js} +2 -2
  6. package/libs/{chunk-C622WBGW.cjs → chunk-DYFAUAB7.cjs} +3 -3
  7. package/libs/{chunk-MGPWZRBX.cjs → chunk-EE3ZWSBY.cjs} +3 -3
  8. package/libs/chunk-FMIM3332.js +8 -0
  9. package/libs/chunk-FMIM3332.js.map +1 -0
  10. package/libs/chunk-L6PRDL6F.cjs +31 -0
  11. package/libs/chunk-L6PRDL6F.cjs.map +1 -0
  12. package/libs/chunk-MPTMPBFT.js +9 -0
  13. package/libs/chunk-MPTMPBFT.js.map +1 -0
  14. package/libs/chunk-NWJDAHP6.cjs +17 -0
  15. package/libs/chunk-NWJDAHP6.cjs.map +1 -0
  16. package/libs/{chunk-G55UJ53G.cjs → chunk-NZVSXRTB.cjs} +3 -3
  17. package/libs/chunk-NZVSXRTB.cjs.map +1 -0
  18. package/libs/chunk-TNEJXNZA.cjs +22 -0
  19. package/libs/chunk-TNEJXNZA.cjs.map +1 -0
  20. package/libs/{chunk-QKHPHMG2.js → chunk-TPIB3RQP.js} +2 -2
  21. package/libs/components/breadcrumbs/breadcrumb.cjs +5 -5
  22. package/libs/components/breadcrumbs/breadcrumb.js +2 -2
  23. package/libs/components/dialog/dialog.cjs +4 -4
  24. package/libs/components/dialog/dialog.js +2 -2
  25. package/libs/components/flexbox/flex.css +1 -0
  26. package/libs/components/flexbox/flex.css.map +1 -0
  27. package/libs/components/flexbox/flex.min.css +3 -0
  28. package/libs/components/icons/icon.cjs +3 -3
  29. package/libs/components/icons/icon.js +1 -1
  30. package/libs/components/link/link.cjs +5 -5
  31. package/libs/components/link/link.css +1 -1
  32. package/libs/components/link/link.css.map +1 -1
  33. package/libs/components/link/link.js +1 -1
  34. package/libs/components/link/link.min.css +2 -2
  35. package/libs/components/popover/popover.cjs +4 -4
  36. package/libs/components/popover/popover.d.cts +1 -1
  37. package/libs/components/popover/popover.d.ts +1 -1
  38. package/libs/components/popover/popover.js +1 -1
  39. package/libs/components/tables/table.cjs +4 -4
  40. package/libs/components/tables/table.d.cts +1 -1
  41. package/libs/components/tables/table.d.ts +1 -1
  42. package/libs/components/tables/table.js +1 -1
  43. package/libs/hooks.cjs +3 -3
  44. package/libs/hooks.js +2 -2
  45. package/libs/icons.cjs +2 -2
  46. package/libs/icons.js +1 -1
  47. package/libs/index.cjs +43 -42
  48. package/libs/index.cjs.map +1 -1
  49. package/libs/index.css +1 -1
  50. package/libs/index.css.map +1 -1
  51. package/libs/index.d.cts +243 -52
  52. package/libs/index.d.ts +243 -52
  53. package/libs/index.js +16 -16
  54. package/libs/index.js.map +1 -1
  55. package/package.json +2 -2
  56. package/src/App.tsx +1 -3
  57. package/src/components/breadcrumbs/bc-item.tsx +0 -1
  58. package/src/components/flexbox/README.mdx +996 -0
  59. package/src/components/flexbox/STYLES.mdx +857 -0
  60. package/src/components/flexbox/flex.scss +847 -0
  61. package/src/components/flexbox/flex.stories.tsx +1934 -0
  62. package/src/components/flexbox/flex.test.tsx +689 -0
  63. package/src/components/flexbox/flex.tsx +484 -0
  64. package/src/components/flexbox/flex.types.ts +243 -0
  65. package/src/components/icons/components/arrow-right.tsx +0 -5
  66. package/src/components/kit.tsx +8 -4
  67. package/src/components/link/link.tsx +1 -1
  68. package/src/components/popover/popover.tsx +1 -1
  69. package/src/components/tables/table-elements.tsx +1 -1
  70. package/src/components/tables/table.tsx +2 -2
  71. package/src/components/text-to-speech/TextToSpeech.tsx +0 -4
  72. package/src/components/text-to-speech/useTextToSpeech.tsx +2 -6
  73. package/src/decorators/instructions.tsx +22 -18
  74. package/src/hooks/popover/popover.tsx +1 -1
  75. package/src/index.scss +1 -0
  76. package/src/index.ts +17 -0
  77. package/src/styles/flexbox/flex.css +736 -0
  78. package/src/styles/flexbox/flex.css.map +1 -0
  79. package/src/styles/index.css +735 -1
  80. package/src/styles/index.css.map +1 -1
  81. package/src/styles/link/link.css +1 -1
  82. package/src/types/component-props.ts +1 -0
  83. package/libs/chunk-23ANBDCR.js.map +0 -1
  84. package/libs/chunk-5QD3DWFI.js +0 -9
  85. package/libs/chunk-5QD3DWFI.js.map +0 -1
  86. package/libs/chunk-6WTC4JXH.cjs +0 -31
  87. package/libs/chunk-6WTC4JXH.cjs.map +0 -1
  88. package/libs/chunk-G55UJ53G.cjs.map +0 -1
  89. package/libs/chunk-KG4GHIQJ.js +0 -8
  90. package/libs/chunk-KG4GHIQJ.js.map +0 -1
  91. package/libs/chunk-US2I5GI7.cjs +0 -22
  92. package/libs/chunk-US2I5GI7.cjs.map +0 -1
  93. package/libs/chunk-Y2PFDELK.js +0 -8
  94. package/libs/chunk-Y2PFDELK.js.map +0 -1
  95. package/libs/chunk-ZOBAJTNE.cjs +0 -17
  96. package/libs/chunk-ZOBAJTNE.cjs.map +0 -1
  97. package/libs/components/alert/alert.min.min.css +0 -2
  98. package/libs/components/badge/badge.min.min.css +0 -2
  99. package/libs/components/breadcrumbs/breadcrumb.min.min.css +0 -2
  100. package/libs/components/buttons/button.min.min.css +0 -2
  101. package/libs/components/cards/card-style.min.min.css +0 -2
  102. package/libs/components/cards/card.min.min.css +0 -2
  103. package/libs/components/details/details.min.min.css +0 -2
  104. package/libs/components/dialog/dialog.min.min.css +0 -2
  105. package/libs/components/form/form.min.min.css +0 -2
  106. package/libs/components/icons/icon.min.min.css +0 -2
  107. package/libs/components/images/img.min.min.css +0 -2
  108. package/libs/components/layout/landmarks.min.min.css +0 -2
  109. package/libs/components/link/link.min.min.css +0 -2
  110. package/libs/components/list/list.min.min.css +0 -2
  111. package/libs/components/nav/nav.min.min.css +0 -2
  112. package/libs/components/progress/progress.min.min.css +0 -2
  113. package/libs/components/styles/index.min.min.css +0 -2
  114. package/libs/components/tag/tag.min.min.css +0 -2
  115. package/libs/components/text-to-speech/text-to-speech.min.min.css +0 -2
  116. /package/libs/{chunk-D2PSO7MU.js.map → chunk-CWRNJA4P.js.map} +0 -0
  117. /package/libs/{chunk-C622WBGW.cjs.map → chunk-DYFAUAB7.cjs.map} +0 -0
  118. /package/libs/{chunk-MGPWZRBX.cjs.map → chunk-EE3ZWSBY.cjs.map} +0 -0
  119. /package/libs/{chunk-QKHPHMG2.js.map → chunk-TPIB3RQP.js.map} +0 -0
@@ -0,0 +1,1934 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { within, expect } from "storybook/test";
3
+ import Flex from "./flex";
4
+ import "./flex.scss";
5
+
6
+ /**
7
+ * Flexbox Utilities and Component Story
8
+ * Comprehensive documentation of responsive flexbox utility classes and React Flex component
9
+ */
10
+ const meta: Meta<typeof Flex> = {
11
+ title: "FP.React Components/Layout/Flex",
12
+ component: Flex,
13
+ tags: ["autodocs", "beta"],
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: `
18
+ # Flex Container Component
19
+
20
+ A flexible container component for creating flexbox layouts with a declarative React API.
21
+ Supports responsive props, preset variants, and compound pattern with Flex.Item and Flex.Spacer.
22
+
23
+ ## Features
24
+
25
+ - **Compound Pattern**: Use \`Flex.Item\` and \`Flex.Spacer\` sub-components
26
+ - **Responsive Props**: Different layouts at sm/md/lg/xl breakpoints
27
+ - **Preset Variants**: Common patterns like 'center', 'between', 'stack'
28
+ - **CSS Custom Properties**: Runtime theming via styles prop
29
+ - **Polymorphic**: Render as any HTML element via 'as' prop
30
+ - **Type-Safe**: Full TypeScript support with autocomplete
31
+
32
+ ## Usage Approaches
33
+
34
+ ### 1. React Component (Recommended)
35
+ \`\`\`tsx
36
+ <Flex gap="md" justify="between" align="center">
37
+ <Flex.Item flex="1">Content 1</Flex.Item>
38
+ <Flex.Item flex="1">Content 2</Flex.Item>
39
+ </Flex>
40
+ \`\`\`
41
+
42
+ ### 2. Utility Classes (Direct HTML)
43
+ \`\`\`html
44
+ <div className="flex gap-md justify-between items-center">
45
+ <div className="flex-1">Content 1</div>
46
+ <div className="flex-1">Content 2</div>
47
+ </div>
48
+ \`\`\`
49
+
50
+ ## Breakpoints
51
+
52
+ - **sm**: 30rem (480px)
53
+ - **md**: 48rem (768px)
54
+ - **lg**: 62rem (992px)
55
+ - **xl**: 80rem (1280px)
56
+
57
+ ## CSS Custom Properties
58
+
59
+ Override default spacing:
60
+
61
+ \`\`\`css
62
+ :root {
63
+ --flex-gap-xs: 0.25rem;
64
+ --flex-gap-sm: 0.5rem;
65
+ --flex-gap-md: 0.75rem;
66
+ --flex-gap-lg: 1rem;
67
+ --flex-gap-xl: 1.5rem;
68
+ }
69
+ \`\`\`
70
+ `,
71
+ },
72
+ },
73
+ },
74
+ };
75
+
76
+ export default meta;
77
+ type Story = StoryObj<typeof Flex>;
78
+
79
+ // ============================================================================
80
+ // REACT COMPONENT STORIES
81
+ // ============================================================================
82
+
83
+ /**
84
+ * Basic Flex component usage
85
+ */
86
+ export const FlexComponent: Story = {
87
+ args: {
88
+ gap: "md",
89
+ children: (
90
+ <>
91
+ <div
92
+ style={{
93
+ padding: "1rem",
94
+ background: "#e3f2fd",
95
+ borderRadius: "0.25rem",
96
+ }}
97
+ >
98
+ Item 1
99
+ </div>
100
+ <div
101
+ style={{
102
+ padding: "1rem",
103
+ background: "#bbdefb",
104
+ borderRadius: "0.25rem",
105
+ }}
106
+ >
107
+ Item 2
108
+ </div>
109
+ <div
110
+ style={{
111
+ padding: "1rem",
112
+ background: "#90caf9",
113
+ borderRadius: "0.25rem",
114
+ }}
115
+ >
116
+ Item 3
117
+ </div>
118
+ </>
119
+ ),
120
+ },
121
+ play: async ({ canvasElement, step }) => {
122
+ const canvas = within(canvasElement);
123
+
124
+ await step("Flex container renders correctly", async () => {
125
+ const flexContainer =
126
+ canvas.getByText("Item 1").parentElement?.parentElement;
127
+ expect(flexContainer).toBeInTheDocument();
128
+ expect(flexContainer).toHaveClass("flex");
129
+ });
130
+ },
131
+ parameters: {
132
+ docs: {
133
+ description: {
134
+ story:
135
+ "Basic Flex component with gap spacing. The component automatically generates the appropriate utility classes from props.",
136
+ },
137
+ },
138
+ },
139
+ };
140
+
141
+ /**
142
+ * Flex with various layout props
143
+ */
144
+ export const FlexWithProps: Story = {
145
+ render: () => (
146
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
147
+ <div>
148
+ <h4 style={{ marginBottom: "0.5rem" }}>
149
+ Row direction with space between
150
+ </h4>
151
+ <Flex
152
+ direction="row"
153
+ justify="between"
154
+ align="center"
155
+ gap="md"
156
+ style={{
157
+ padding: "1rem",
158
+ border: "2px dashed #ccc",
159
+ borderRadius: "0.5rem",
160
+ }}
161
+ >
162
+ <div
163
+ style={{
164
+ padding: "0.75rem",
165
+ background: "#e3f2fd",
166
+ borderRadius: "0.25rem",
167
+ }}
168
+ >
169
+ Left
170
+ </div>
171
+ <div
172
+ style={{
173
+ padding: "0.75rem",
174
+ background: "#bbdefb",
175
+ borderRadius: "0.25rem",
176
+ }}
177
+ >
178
+ Center
179
+ </div>
180
+ <div
181
+ style={{
182
+ padding: "0.75rem",
183
+ background: "#90caf9",
184
+ borderRadius: "0.25rem",
185
+ }}
186
+ >
187
+ Right
188
+ </div>
189
+ </Flex>
190
+ </div>
191
+
192
+ <div>
193
+ <h4 style={{ marginBottom: "0.5rem" }}>
194
+ Column direction with center alignment
195
+ </h4>
196
+ <Flex
197
+ direction="column"
198
+ align="center"
199
+ gap="sm"
200
+ style={{
201
+ padding: "1rem",
202
+ border: "2px dashed #ccc",
203
+ borderRadius: "0.5rem",
204
+ }}
205
+ >
206
+ <div
207
+ style={{
208
+ padding: "0.75rem",
209
+ background: "#e3f2fd",
210
+ borderRadius: "0.25rem",
211
+ }}
212
+ >
213
+ Item 1
214
+ </div>
215
+ <div
216
+ style={{
217
+ padding: "0.75rem",
218
+ background: "#bbdefb",
219
+ borderRadius: "0.25rem",
220
+ }}
221
+ >
222
+ Item 2
223
+ </div>
224
+ <div
225
+ style={{
226
+ padding: "0.75rem",
227
+ background: "#90caf9",
228
+ borderRadius: "0.25rem",
229
+ }}
230
+ >
231
+ Item 3
232
+ </div>
233
+ </Flex>
234
+ </div>
235
+ </div>
236
+ ),
237
+ parameters: {
238
+ docs: {
239
+ description: {
240
+ story:
241
+ "Demonstrates different combinations of direction, justify, align, and gap props.",
242
+ },
243
+ },
244
+ },
245
+ };
246
+
247
+ /**
248
+ * Responsive Flex layout
249
+ */
250
+ export const FlexResponsive: Story = {
251
+ render: () => (
252
+ <Flex
253
+ direction="column"
254
+ gap="sm"
255
+ md={{ direction: "row", gap: "lg", justify: "between" }}
256
+ style={{
257
+ padding: "1rem",
258
+ border: "2px dashed #ccc",
259
+ borderRadius: "0.5rem",
260
+ }}
261
+ >
262
+ <Flex.Item flex="none" md={{ flex: "1" }}>
263
+ <div
264
+ style={{
265
+ padding: "1rem",
266
+ background: "#e3f2fd",
267
+ borderRadius: "0.25rem",
268
+ minHeight: "6rem",
269
+ }}
270
+ >
271
+ Column on mobile
272
+ <br />
273
+ Row on medium+
274
+ <br />
275
+ flex="1" on medium+
276
+ </div>
277
+ </Flex.Item>
278
+ <Flex.Item flex="none" md={{ flex: "1" }}>
279
+ <div
280
+ style={{
281
+ padding: "1rem",
282
+ background: "#bbdefb",
283
+ borderRadius: "0.25rem",
284
+ minHeight: "6rem",
285
+ }}
286
+ >
287
+ Responsive layout with gap changes
288
+ </div>
289
+ </Flex.Item>
290
+ <Flex.Item flex="none" md={{ flex: "1" }}>
291
+ <div
292
+ style={{
293
+ padding: "1rem",
294
+ background: "#90caf9",
295
+ borderRadius: "0.25rem",
296
+ minHeight: "6rem",
297
+ }}
298
+ >
299
+ Resize to see behavior
300
+ </div>
301
+ </Flex.Item>
302
+ </Flex>
303
+ ),
304
+ parameters: {
305
+ docs: {
306
+ description: {
307
+ story:
308
+ "Responsive layout that changes from column on mobile to row on medium+ screens, with different gap sizes at different breakpoints.",
309
+ },
310
+ },
311
+ chromatic: {
312
+ viewports: [375, 768, 1280],
313
+ },
314
+ },
315
+ };
316
+
317
+ /**
318
+ * Flex.Item sub-component
319
+ */
320
+ export const FlexWithItems: Story = {
321
+ render: () => (
322
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
323
+ <div>
324
+ <h4 style={{ marginBottom: "0.5rem" }}>Equal width items (flex="1")</h4>
325
+ <Flex
326
+ gap="md"
327
+ style={{
328
+ padding: "1rem",
329
+ border: "2px dashed #ccc",
330
+ borderRadius: "0.5rem",
331
+ }}
332
+ >
333
+ <Flex.Item flex="1">
334
+ <div
335
+ style={{
336
+ padding: "1rem",
337
+ background: "#e3f2fd",
338
+ borderRadius: "0.25rem",
339
+ }}
340
+ >
341
+ flex="1"
342
+ </div>
343
+ </Flex.Item>
344
+ <Flex.Item flex="1">
345
+ <div
346
+ style={{
347
+ padding: "1rem",
348
+ background: "#bbdefb",
349
+ borderRadius: "0.25rem",
350
+ }}
351
+ >
352
+ flex="1"
353
+ </div>
354
+ </Flex.Item>
355
+ <Flex.Item flex="1">
356
+ <div
357
+ style={{
358
+ padding: "1rem",
359
+ background: "#90caf9",
360
+ borderRadius: "0.25rem",
361
+ }}
362
+ >
363
+ flex="1"
364
+ </div>
365
+ </Flex.Item>
366
+ </Flex>
367
+ </div>
368
+
369
+ <div>
370
+ <h4 style={{ marginBottom: "0.5rem" }}>
371
+ Mixed sizing (flex="none" + flex="1")
372
+ </h4>
373
+ <Flex
374
+ gap="md"
375
+ style={{
376
+ padding: "1rem",
377
+ border: "2px dashed #ccc",
378
+ borderRadius: "0.5rem",
379
+ }}
380
+ >
381
+ <Flex.Item flex="none" styles={{ width: "8rem" }}>
382
+ <div
383
+ style={{
384
+ padding: "1rem",
385
+ background: "#e3f2fd",
386
+ borderRadius: "0.25rem",
387
+ }}
388
+ >
389
+ Fixed 8rem
390
+ </div>
391
+ </Flex.Item>
392
+ <Flex.Item flex="1">
393
+ <div
394
+ style={{
395
+ padding: "1rem",
396
+ background: "#bbdefb",
397
+ borderRadius: "0.25rem",
398
+ }}
399
+ >
400
+ Fills remaining space
401
+ </div>
402
+ </Flex.Item>
403
+ </Flex>
404
+ </div>
405
+
406
+ <div>
407
+ <h4 style={{ marginBottom: "0.5rem" }}>Custom alignment (alignSelf)</h4>
408
+ <Flex
409
+ gap="md"
410
+ style={{
411
+ padding: "1rem",
412
+ border: "2px dashed #ccc",
413
+ borderRadius: "0.5rem",
414
+ minHeight: "8rem",
415
+ }}
416
+ >
417
+ <Flex.Item alignSelf="start">
418
+ <div
419
+ style={{
420
+ padding: "0.75rem",
421
+ background: "#e3f2fd",
422
+ borderRadius: "0.25rem",
423
+ }}
424
+ >
425
+ Start
426
+ </div>
427
+ </Flex.Item>
428
+ <Flex.Item alignSelf="center">
429
+ <div
430
+ style={{
431
+ padding: "0.75rem",
432
+ background: "#bbdefb",
433
+ borderRadius: "0.25rem",
434
+ }}
435
+ >
436
+ Center
437
+ </div>
438
+ </Flex.Item>
439
+ <Flex.Item alignSelf="end">
440
+ <div
441
+ style={{
442
+ padding: "0.75rem",
443
+ background: "#90caf9",
444
+ borderRadius: "0.25rem",
445
+ }}
446
+ >
447
+ End
448
+ </div>
449
+ </Flex.Item>
450
+ </Flex>
451
+ </div>
452
+ </div>
453
+ ),
454
+ parameters: {
455
+ docs: {
456
+ description: {
457
+ story:
458
+ "Demonstrates Flex.Item sub-component with different flex sizing and alignment options.",
459
+ },
460
+ },
461
+ },
462
+ };
463
+
464
+ /**
465
+ * Flex.Spacer sub-component
466
+ */
467
+ export const FlexWithSpacer: Story = {
468
+ render: () => (
469
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
470
+ <div>
471
+ <h4 style={{ marginBottom: "0.5rem" }}>Push items to opposite edges</h4>
472
+ <Flex
473
+ gap="md"
474
+ style={{
475
+ padding: "1rem",
476
+ border: "2px dashed #ccc",
477
+ borderRadius: "0.5rem",
478
+ }}
479
+ >
480
+ <div
481
+ style={{
482
+ padding: "0.75rem",
483
+ background: "#e3f2fd",
484
+ borderRadius: "0.25rem",
485
+ }}
486
+ >
487
+ Left side
488
+ </div>
489
+ <Flex.Spacer />
490
+ <div
491
+ style={{
492
+ padding: "0.75rem",
493
+ background: "#90caf9",
494
+ borderRadius: "0.25rem",
495
+ }}
496
+ >
497
+ Right side
498
+ </div>
499
+ </Flex>
500
+ </div>
501
+
502
+ <div>
503
+ <h4 style={{ marginBottom: "0.5rem" }}>
504
+ Multiple spacers for even distribution
505
+ </h4>
506
+ <Flex
507
+ gap="md"
508
+ style={{
509
+ padding: "1rem",
510
+ border: "2px dashed #ccc",
511
+ borderRadius: "0.5rem",
512
+ }}
513
+ >
514
+ <div
515
+ style={{
516
+ padding: "0.75rem",
517
+ background: "#e3f2fd",
518
+ borderRadius: "0.25rem",
519
+ }}
520
+ >
521
+ Start
522
+ </div>
523
+ <Flex.Spacer />
524
+ <div
525
+ style={{
526
+ padding: "0.75rem",
527
+ background: "#bbdefb",
528
+ borderRadius: "0.25rem",
529
+ }}
530
+ >
531
+ Middle
532
+ </div>
533
+ <Flex.Spacer />
534
+ <div
535
+ style={{
536
+ padding: "0.75rem",
537
+ background: "#90caf9",
538
+ borderRadius: "0.25rem",
539
+ }}
540
+ >
541
+ End
542
+ </div>
543
+ </Flex>
544
+ </div>
545
+ </div>
546
+ ),
547
+ parameters: {
548
+ docs: {
549
+ description: {
550
+ story:
551
+ "Flex.Spacer creates auto-expanding space (flex: 1) to push items apart. Commonly used for navbar layouts and toolbars.",
552
+ },
553
+ },
554
+ },
555
+ };
556
+
557
+ /**
558
+ * Preset variants
559
+ */
560
+ export const FlexVariants: Story = {
561
+ render: () => (
562
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
563
+ <div>
564
+ <h4 style={{ marginBottom: "0.5rem" }}>variant="center"</h4>
565
+ <Flex
566
+ variant="center"
567
+ style={{
568
+ padding: "2rem",
569
+ border: "2px dashed #ccc",
570
+ borderRadius: "0.5rem",
571
+ minHeight: "8rem",
572
+ }}
573
+ >
574
+ <div
575
+ style={{
576
+ padding: "1rem",
577
+ background: "#e3f2fd",
578
+ borderRadius: "0.25rem",
579
+ }}
580
+ >
581
+ Centered both axes
582
+ </div>
583
+ </Flex>
584
+ </div>
585
+
586
+ <div>
587
+ <h4 style={{ marginBottom: "0.5rem" }}>variant="between"</h4>
588
+ <Flex
589
+ variant="between"
590
+ style={{
591
+ padding: "1rem",
592
+ border: "2px dashed #ccc",
593
+ borderRadius: "0.5rem",
594
+ }}
595
+ >
596
+ <div
597
+ style={{
598
+ padding: "0.75rem",
599
+ background: "#e3f2fd",
600
+ borderRadius: "0.25rem",
601
+ }}
602
+ >
603
+ Left
604
+ </div>
605
+ <div
606
+ style={{
607
+ padding: "0.75rem",
608
+ background: "#90caf9",
609
+ borderRadius: "0.25rem",
610
+ }}
611
+ >
612
+ Right
613
+ </div>
614
+ </Flex>
615
+ </div>
616
+
617
+ <div>
618
+ <h4 style={{ marginBottom: "0.5rem" }}>variant="stack"</h4>
619
+ <Flex
620
+ variant="stack"
621
+ style={{
622
+ padding: "1rem",
623
+ border: "2px dashed #ccc",
624
+ borderRadius: "0.5rem",
625
+ }}
626
+ >
627
+ <div
628
+ style={{
629
+ padding: "1rem",
630
+ background: "#e3f2fd",
631
+ borderRadius: "0.25rem",
632
+ }}
633
+ >
634
+ Stacked Item 1
635
+ </div>
636
+ <div
637
+ style={{
638
+ padding: "1rem",
639
+ background: "#bbdefb",
640
+ borderRadius: "0.25rem",
641
+ }}
642
+ >
643
+ Stacked Item 2
644
+ </div>
645
+ <div
646
+ style={{
647
+ padding: "1rem",
648
+ background: "#90caf9",
649
+ borderRadius: "0.25rem",
650
+ }}
651
+ >
652
+ Stacked Item 3
653
+ </div>
654
+ </Flex>
655
+ <p style={{ marginTop: "0.5rem", fontSize: "0.875rem", color: "#666" }}>
656
+ Stack variant uses column layout by default, becomes row on medium+
657
+ screens
658
+ </p>
659
+ </div>
660
+
661
+ <div>
662
+ <h4 style={{ marginBottom: "0.5rem" }}>variant="spread"</h4>
663
+ <Flex
664
+ variant="spread"
665
+ gap="sm"
666
+ style={{
667
+ padding: "1rem",
668
+ border: "2px dashed #ccc",
669
+ borderRadius: "0.5rem",
670
+ }}
671
+ >
672
+ <div
673
+ style={{
674
+ padding: "0.75rem",
675
+ background: "#e3f2fd",
676
+ borderRadius: "0.25rem",
677
+ }}
678
+ >
679
+ Equal
680
+ </div>
681
+ <div
682
+ style={{
683
+ padding: "0.75rem",
684
+ background: "#bbdefb",
685
+ borderRadius: "0.25rem",
686
+ }}
687
+ >
688
+ Width
689
+ </div>
690
+ <div
691
+ style={{
692
+ padding: "0.75rem",
693
+ background: "#90caf9",
694
+ borderRadius: "0.25rem",
695
+ }}
696
+ >
697
+ Items
698
+ </div>
699
+ </Flex>
700
+ </div>
701
+ </div>
702
+ ),
703
+ parameters: {
704
+ docs: {
705
+ description: {
706
+ story:
707
+ "Preset variants provide common flexbox patterns: 'center', 'between', 'around', 'stack', 'spread'.",
708
+ },
709
+ },
710
+ },
711
+ };
712
+
713
+ /**
714
+ * Nested Flex containers
715
+ */
716
+ export const NestedFlex: Story = {
717
+ render: () => (
718
+ <Flex
719
+ direction="column"
720
+ gap="md"
721
+ style={{
722
+ padding: "1rem",
723
+ border: "2px dashed #ccc",
724
+ borderRadius: "0.5rem",
725
+ }}
726
+ >
727
+ <Flex justify="between" align="center" gap="md">
728
+ <div
729
+ style={{
730
+ padding: "0.75rem",
731
+ background: "#e3f2fd",
732
+ borderRadius: "0.25rem",
733
+ }}
734
+ >
735
+ Header Left
736
+ </div>
737
+ <Flex.Spacer />
738
+ <Flex gap="sm">
739
+ <div
740
+ style={{
741
+ padding: "0.5rem",
742
+ background: "#bbdefb",
743
+ borderRadius: "0.25rem",
744
+ }}
745
+ >
746
+ Nav 1
747
+ </div>
748
+ <div
749
+ style={{
750
+ padding: "0.5rem",
751
+ background: "#bbdefb",
752
+ borderRadius: "0.25rem",
753
+ }}
754
+ >
755
+ Nav 2
756
+ </div>
757
+ <div
758
+ style={{
759
+ padding: "0.5rem",
760
+ background: "#bbdefb",
761
+ borderRadius: "0.25rem",
762
+ }}
763
+ >
764
+ Nav 3
765
+ </div>
766
+ </Flex>
767
+ </Flex>
768
+
769
+ <Flex gap="md">
770
+ <Flex.Item flex="none" styles={{ width: "12rem" }}>
771
+ <div
772
+ style={{
773
+ padding: "1rem",
774
+ background: "#f3e5f5",
775
+ borderRadius: "0.25rem",
776
+ minHeight: "12rem",
777
+ }}
778
+ >
779
+ Sidebar
780
+ </div>
781
+ </Flex.Item>
782
+ <Flex.Item flex="1">
783
+ <Flex
784
+ direction="column"
785
+ gap="md"
786
+ style={{
787
+ padding: "1rem",
788
+ background: "#f1f8e9",
789
+ borderRadius: "0.25rem",
790
+ }}
791
+ >
792
+ <div
793
+ style={{
794
+ padding: "0.75rem",
795
+ background: "#dcedc8",
796
+ borderRadius: "0.25rem",
797
+ }}
798
+ >
799
+ Main content area
800
+ </div>
801
+ <Flex gap="sm">
802
+ <Flex.Item flex="1">
803
+ <div
804
+ style={{
805
+ padding: "0.75rem",
806
+ background: "#c5e1a5",
807
+ borderRadius: "0.25rem",
808
+ }}
809
+ >
810
+ Column 1
811
+ </div>
812
+ </Flex.Item>
813
+ <Flex.Item flex="1">
814
+ <div
815
+ style={{
816
+ padding: "0.75rem",
817
+ background: "#c5e1a5",
818
+ borderRadius: "0.25rem",
819
+ }}
820
+ >
821
+ Column 2
822
+ </div>
823
+ </Flex.Item>
824
+ </Flex>
825
+ </Flex>
826
+ </Flex.Item>
827
+ </Flex>
828
+ </Flex>
829
+ ),
830
+ parameters: {
831
+ docs: {
832
+ description: {
833
+ story:
834
+ "Complex layout demonstrating nested Flex containers to create a typical application layout with header, sidebar, and main content.",
835
+ },
836
+ },
837
+ },
838
+ };
839
+
840
+ /**
841
+ * Custom styling with CSS variables
842
+ */
843
+ export const CustomStyling: Story = {
844
+ render: () => (
845
+ <Flex
846
+ gap="md"
847
+ styles={
848
+ {
849
+ "--flex-gap": "3rem",
850
+ padding: "2rem",
851
+ border: "2px solid #1976d2",
852
+ borderRadius: "0.5rem",
853
+ background: "linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%)",
854
+ } as React.CSSProperties
855
+ }
856
+ >
857
+ <div
858
+ style={{
859
+ padding: "1rem",
860
+ background: "white",
861
+ borderRadius: "0.25rem",
862
+ }}
863
+ >
864
+ Custom gap via --flex-gap
865
+ </div>
866
+ <div
867
+ style={{
868
+ padding: "1rem",
869
+ background: "white",
870
+ borderRadius: "0.25rem",
871
+ }}
872
+ >
873
+ Custom styles
874
+ </div>
875
+ <div
876
+ style={{
877
+ padding: "1rem",
878
+ background: "white",
879
+ borderRadius: "0.25rem",
880
+ }}
881
+ >
882
+ Via styles prop
883
+ </div>
884
+ </Flex>
885
+ ),
886
+ parameters: {
887
+ docs: {
888
+ description: {
889
+ story:
890
+ "Demonstrates custom styling using CSS custom properties and inline styles via the styles prop.",
891
+ },
892
+ },
893
+ },
894
+ };
895
+
896
+ /**
897
+ * Polymorphic rendering
898
+ */
899
+ export const PolymorphicFlex: Story = {
900
+ render: () => (
901
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
902
+ <div>
903
+ <h4 style={{ marginBottom: "0.5rem" }}>Render as &lt;nav&gt;</h4>
904
+ <Flex
905
+ as="nav"
906
+ role="navigation"
907
+ aria-label="Main navigation"
908
+ gap="md"
909
+ style={{
910
+ padding: "1rem",
911
+ border: "2px dashed #ccc",
912
+ borderRadius: "0.5rem",
913
+ }}
914
+ >
915
+ <a
916
+ href="#"
917
+ style={{
918
+ padding: "0.5rem",
919
+ textDecoration: "none",
920
+ color: "#1976d2",
921
+ }}
922
+ >
923
+ Home
924
+ </a>
925
+ <a
926
+ href="#"
927
+ style={{
928
+ padding: "0.5rem",
929
+ textDecoration: "none",
930
+ color: "#1976d2",
931
+ }}
932
+ >
933
+ About
934
+ </a>
935
+ <a
936
+ href="#"
937
+ style={{
938
+ padding: "0.5rem",
939
+ textDecoration: "none",
940
+ color: "#1976d2",
941
+ }}
942
+ >
943
+ Contact
944
+ </a>
945
+ </Flex>
946
+ </div>
947
+
948
+ <div>
949
+ <h4 style={{ marginBottom: "0.5rem" }}>Render as &lt;section&gt;</h4>
950
+ <Flex
951
+ as="section"
952
+ direction="column"
953
+ gap="md"
954
+ style={{
955
+ padding: "1rem",
956
+ border: "2px dashed #ccc",
957
+ borderRadius: "0.5rem",
958
+ }}
959
+ >
960
+ <h3 style={{ margin: 0 }}>Section Title</h3>
961
+ <p style={{ margin: 0 }}>Content in a semantic section element</p>
962
+ </Flex>
963
+ </div>
964
+ </div>
965
+ ),
966
+ parameters: {
967
+ docs: {
968
+ description: {
969
+ story:
970
+ "The 'as' prop allows Flex to render as any HTML element, enabling semantic markup while maintaining flexbox behavior.",
971
+ },
972
+ },
973
+ },
974
+ };
975
+
976
+ // ============================================================================
977
+ // UTILITY CLASS STORIES (Preserved for backward compatibility)
978
+ // ============================================================================
979
+
980
+ /**
981
+ * Basic flex container with default gap
982
+ */
983
+ export const BasicFlex: Story = {
984
+ render: () => (
985
+ <div
986
+ className="flex"
987
+ style={{
988
+ padding: "1rem",
989
+ border: "2px dashed #ccc",
990
+ borderRadius: "0.5rem",
991
+ }}
992
+ >
993
+ <div
994
+ style={{
995
+ padding: "1rem",
996
+ background: "#e3f2fd",
997
+ borderRadius: "0.25rem",
998
+ }}
999
+ >
1000
+ Item 1
1001
+ </div>
1002
+ <div
1003
+ style={{
1004
+ padding: "1rem",
1005
+ background: "#bbdefb",
1006
+ borderRadius: "0.25rem",
1007
+ }}
1008
+ >
1009
+ Item 2
1010
+ </div>
1011
+ <div
1012
+ style={{
1013
+ padding: "1rem",
1014
+ background: "#90caf9",
1015
+ borderRadius: "0.25rem",
1016
+ }}
1017
+ >
1018
+ Item 3
1019
+ </div>
1020
+ </div>
1021
+ ),
1022
+ parameters: {
1023
+ docs: {
1024
+ description: {
1025
+ story:
1026
+ "Basic flex container with default gap. The `.flex` class provides `display: flex` with automatic gap spacing.",
1027
+ },
1028
+ },
1029
+ },
1030
+ };
1031
+
1032
+ /**
1033
+ * Flex direction utilities
1034
+ */
1035
+ export const FlexDirection: Story = {
1036
+ render: () => (
1037
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
1038
+ <div>
1039
+ <h3 style={{ marginBottom: "0.5rem" }}>Row (default)</h3>
1040
+ <div
1041
+ className="flex flex-row gap-sm"
1042
+ style={{
1043
+ padding: "1rem",
1044
+ border: "2px dashed #ccc",
1045
+ borderRadius: "0.5rem",
1046
+ }}
1047
+ >
1048
+ <div
1049
+ style={{
1050
+ padding: "1rem",
1051
+ background: "#e3f2fd",
1052
+ borderRadius: "0.25rem",
1053
+ }}
1054
+ >
1055
+ 1
1056
+ </div>
1057
+ <div
1058
+ style={{
1059
+ padding: "1rem",
1060
+ background: "#bbdefb",
1061
+ borderRadius: "0.25rem",
1062
+ }}
1063
+ >
1064
+ 2
1065
+ </div>
1066
+ <div
1067
+ style={{
1068
+ padding: "1rem",
1069
+ background: "#90caf9",
1070
+ borderRadius: "0.25rem",
1071
+ }}
1072
+ >
1073
+ 3
1074
+ </div>
1075
+ </div>
1076
+ </div>
1077
+
1078
+ <div>
1079
+ <h3 style={{ marginBottom: "0.5rem" }}>Column</h3>
1080
+ <div
1081
+ className="flex flex-col gap-sm"
1082
+ style={{
1083
+ padding: "1rem",
1084
+ border: "2px dashed #ccc",
1085
+ borderRadius: "0.5rem",
1086
+ }}
1087
+ >
1088
+ <div
1089
+ style={{
1090
+ padding: "1rem",
1091
+ background: "#e3f2fd",
1092
+ borderRadius: "0.25rem",
1093
+ }}
1094
+ >
1095
+ 1
1096
+ </div>
1097
+ <div
1098
+ style={{
1099
+ padding: "1rem",
1100
+ background: "#bbdefb",
1101
+ borderRadius: "0.25rem",
1102
+ }}
1103
+ >
1104
+ 2
1105
+ </div>
1106
+ <div
1107
+ style={{
1108
+ padding: "1rem",
1109
+ background: "#90caf9",
1110
+ borderRadius: "0.25rem",
1111
+ }}
1112
+ >
1113
+ 3
1114
+ </div>
1115
+ </div>
1116
+ </div>
1117
+
1118
+ <div>
1119
+ <h3 style={{ marginBottom: "0.5rem" }}>Row Reverse</h3>
1120
+ <div
1121
+ className="flex flex-row-reverse gap-sm"
1122
+ style={{
1123
+ padding: "1rem",
1124
+ border: "2px dashed #ccc",
1125
+ borderRadius: "0.5rem",
1126
+ }}
1127
+ >
1128
+ <div
1129
+ style={{
1130
+ padding: "1rem",
1131
+ background: "#e3f2fd",
1132
+ borderRadius: "0.25rem",
1133
+ }}
1134
+ >
1135
+ 1
1136
+ </div>
1137
+ <div
1138
+ style={{
1139
+ padding: "1rem",
1140
+ background: "#bbdefb",
1141
+ borderRadius: "0.25rem",
1142
+ }}
1143
+ >
1144
+ 2
1145
+ </div>
1146
+ <div
1147
+ style={{
1148
+ padding: "1rem",
1149
+ background: "#90caf9",
1150
+ borderRadius: "0.25rem",
1151
+ }}
1152
+ >
1153
+ 3
1154
+ </div>
1155
+ </div>
1156
+ </div>
1157
+ </div>
1158
+ ),
1159
+ parameters: {
1160
+ docs: {
1161
+ description: {
1162
+ story:
1163
+ "Flex direction utilities: `.flex-row`, `.flex-col`, `.flex-row-reverse`, `.flex-col-reverse`",
1164
+ },
1165
+ },
1166
+ },
1167
+ };
1168
+
1169
+ /**
1170
+ * Justify content (main axis alignment)
1171
+ */
1172
+ export const JustifyContent: Story = {
1173
+ render: () => (
1174
+ <div style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
1175
+ {[
1176
+ { class: "justify-start", label: "Start" },
1177
+ { class: "justify-center", label: "Center" },
1178
+ { class: "justify-end", label: "End" },
1179
+ { class: "justify-between", label: "Space Between" },
1180
+ { class: "justify-around", label: "Space Around" },
1181
+ { class: "justify-evenly", label: "Space Evenly" },
1182
+ ].map(({ class: className, label }) => (
1183
+ <div key={className}>
1184
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1185
+ {label}
1186
+ </h4>
1187
+ <div
1188
+ className={`flex ${className}`}
1189
+ style={{
1190
+ padding: "1rem",
1191
+ border: "2px dashed #ccc",
1192
+ borderRadius: "0.5rem",
1193
+ }}
1194
+ >
1195
+ <div
1196
+ style={{
1197
+ padding: "0.75rem",
1198
+ background: "#e3f2fd",
1199
+ borderRadius: "0.25rem",
1200
+ }}
1201
+ >
1202
+ A
1203
+ </div>
1204
+ <div
1205
+ style={{
1206
+ padding: "0.75rem",
1207
+ background: "#bbdefb",
1208
+ borderRadius: "0.25rem",
1209
+ }}
1210
+ >
1211
+ B
1212
+ </div>
1213
+ <div
1214
+ style={{
1215
+ padding: "0.75rem",
1216
+ background: "#90caf9",
1217
+ borderRadius: "0.25rem",
1218
+ }}
1219
+ >
1220
+ C
1221
+ </div>
1222
+ </div>
1223
+ </div>
1224
+ ))}
1225
+ </div>
1226
+ ),
1227
+ parameters: {
1228
+ docs: {
1229
+ description: {
1230
+ story:
1231
+ "Justify content utilities control main axis alignment: `.justify-start`, `.justify-center`, `.justify-end`, `.justify-between`, `.justify-around`, `.justify-evenly`",
1232
+ },
1233
+ },
1234
+ },
1235
+ };
1236
+
1237
+ /**
1238
+ * Align items (cross axis alignment)
1239
+ */
1240
+ export const AlignItems: Story = {
1241
+ render: () => (
1242
+ <div style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
1243
+ {[
1244
+ { class: "items-start", label: "Start" },
1245
+ { class: "items-center", label: "Center" },
1246
+ { class: "items-end", label: "End" },
1247
+ { class: "items-stretch", label: "Stretch" },
1248
+ { class: "items-baseline", label: "Baseline" },
1249
+ ].map(({ class: className, label }) => (
1250
+ <div key={className}>
1251
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1252
+ {label}
1253
+ </h4>
1254
+ <div
1255
+ className={`flex ${className}`}
1256
+ style={{
1257
+ padding: "1rem",
1258
+ border: "2px dashed #ccc",
1259
+ borderRadius: "0.5rem",
1260
+ minHeight: "6rem",
1261
+ }}
1262
+ >
1263
+ <div
1264
+ style={{
1265
+ padding: "0.75rem",
1266
+ background: "#e3f2fd",
1267
+ borderRadius: "0.25rem",
1268
+ }}
1269
+ >
1270
+ Small
1271
+ </div>
1272
+ <div
1273
+ style={{
1274
+ padding: "0.75rem",
1275
+ background: "#bbdefb",
1276
+ borderRadius: "0.25rem",
1277
+ height: "4rem",
1278
+ }}
1279
+ >
1280
+ Medium
1281
+ </div>
1282
+ <div
1283
+ style={{
1284
+ padding: "0.75rem",
1285
+ background: "#90caf9",
1286
+ borderRadius: "0.25rem",
1287
+ }}
1288
+ >
1289
+ Small
1290
+ </div>
1291
+ </div>
1292
+ </div>
1293
+ ))}
1294
+ </div>
1295
+ ),
1296
+ parameters: {
1297
+ docs: {
1298
+ description: {
1299
+ story:
1300
+ "Align items utilities control cross axis alignment: `.items-start`, `.items-center`, `.items-end`, `.items-stretch`, `.items-baseline`",
1301
+ },
1302
+ },
1303
+ },
1304
+ };
1305
+
1306
+ /**
1307
+ * Gap utilities
1308
+ */
1309
+ export const GapUtilities: Story = {
1310
+ render: () => (
1311
+ <div style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
1312
+ {[
1313
+ { class: "gap-0", label: "No Gap (gap-0)" },
1314
+ { class: "gap-xs", label: "Extra Small (gap-xs)" },
1315
+ { class: "gap-sm", label: "Small (gap-sm)" },
1316
+ { class: "gap-md", label: "Medium (gap-md)" },
1317
+ { class: "gap-lg", label: "Large (gap-lg)" },
1318
+ { class: "gap-xl", label: "Extra Large (gap-xl)" },
1319
+ ].map(({ class: className, label }) => (
1320
+ <div key={className}>
1321
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1322
+ {label}
1323
+ </h4>
1324
+ <div
1325
+ className={`flex ${className}`}
1326
+ style={{
1327
+ padding: "1rem",
1328
+ border: "2px dashed #ccc",
1329
+ borderRadius: "0.5rem",
1330
+ }}
1331
+ >
1332
+ <div
1333
+ style={{
1334
+ padding: "0.75rem",
1335
+ background: "#e3f2fd",
1336
+ borderRadius: "0.25rem",
1337
+ }}
1338
+ >
1339
+ Item 1
1340
+ </div>
1341
+ <div
1342
+ style={{
1343
+ padding: "0.75rem",
1344
+ background: "#bbdefb",
1345
+ borderRadius: "0.25rem",
1346
+ }}
1347
+ >
1348
+ Item 2
1349
+ </div>
1350
+ <div
1351
+ style={{
1352
+ padding: "0.75rem",
1353
+ background: "#90caf9",
1354
+ borderRadius: "0.25rem",
1355
+ }}
1356
+ >
1357
+ Item 3
1358
+ </div>
1359
+ </div>
1360
+ </div>
1361
+ ))}
1362
+ </div>
1363
+ ),
1364
+ parameters: {
1365
+ docs: {
1366
+ description: {
1367
+ story:
1368
+ "Gap utilities use fluid spacing with `clamp()`. Available: `.gap-0`, `.gap-xs`, `.gap-sm`, `.gap-md`, `.gap-lg`, `.gap-xl`. Also supports `.row-gap-*` and `.col-gap-*` for independent control.",
1369
+ },
1370
+ },
1371
+ },
1372
+ };
1373
+
1374
+ /**
1375
+ * Flex item sizing
1376
+ */
1377
+ export const FlexSizing: Story = {
1378
+ render: () => (
1379
+ <div style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
1380
+ <div>
1381
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1382
+ flex-1 (Equal width items)
1383
+ </h4>
1384
+ <div
1385
+ className="flex gap-sm"
1386
+ style={{
1387
+ padding: "1rem",
1388
+ border: "2px dashed #ccc",
1389
+ borderRadius: "0.5rem",
1390
+ }}
1391
+ >
1392
+ <div
1393
+ className="flex-1"
1394
+ style={{
1395
+ padding: "0.75rem",
1396
+ background: "#e3f2fd",
1397
+ borderRadius: "0.25rem",
1398
+ }}
1399
+ >
1400
+ flex-1
1401
+ </div>
1402
+ <div
1403
+ className="flex-1"
1404
+ style={{
1405
+ padding: "0.75rem",
1406
+ background: "#bbdefb",
1407
+ borderRadius: "0.25rem",
1408
+ }}
1409
+ >
1410
+ flex-1
1411
+ </div>
1412
+ <div
1413
+ className="flex-1"
1414
+ style={{
1415
+ padding: "0.75rem",
1416
+ background: "#90caf9",
1417
+ borderRadius: "0.25rem",
1418
+ }}
1419
+ >
1420
+ flex-1
1421
+ </div>
1422
+ </div>
1423
+ </div>
1424
+
1425
+ <div>
1426
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1427
+ flex-auto (Content-based sizing)
1428
+ </h4>
1429
+ <div
1430
+ className="flex gap-sm"
1431
+ style={{
1432
+ padding: "1rem",
1433
+ border: "2px dashed #ccc",
1434
+ borderRadius: "0.5rem",
1435
+ }}
1436
+ >
1437
+ <div
1438
+ className="flex-auto"
1439
+ style={{
1440
+ padding: "0.75rem",
1441
+ background: "#e3f2fd",
1442
+ borderRadius: "0.25rem",
1443
+ }}
1444
+ >
1445
+ Short
1446
+ </div>
1447
+ <div
1448
+ className="flex-auto"
1449
+ style={{
1450
+ padding: "0.75rem",
1451
+ background: "#bbdefb",
1452
+ borderRadius: "0.25rem",
1453
+ }}
1454
+ >
1455
+ Medium content here
1456
+ </div>
1457
+ <div
1458
+ className="flex-auto"
1459
+ style={{
1460
+ padding: "0.75rem",
1461
+ background: "#90caf9",
1462
+ borderRadius: "0.25rem",
1463
+ }}
1464
+ >
1465
+ Longer content that takes more space
1466
+ </div>
1467
+ </div>
1468
+ </div>
1469
+
1470
+ <div>
1471
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1472
+ flex-none (Fixed width)
1473
+ </h4>
1474
+ <div
1475
+ className="flex gap-sm"
1476
+ style={{
1477
+ padding: "1rem",
1478
+ border: "2px dashed #ccc",
1479
+ borderRadius: "0.5rem",
1480
+ }}
1481
+ >
1482
+ <div
1483
+ className="flex-none"
1484
+ style={{
1485
+ padding: "0.75rem",
1486
+ background: "#e3f2fd",
1487
+ borderRadius: "0.25rem",
1488
+ width: "8rem",
1489
+ }}
1490
+ >
1491
+ Fixed 8rem
1492
+ </div>
1493
+ <div
1494
+ className="flex-1"
1495
+ style={{
1496
+ padding: "0.75rem",
1497
+ background: "#bbdefb",
1498
+ borderRadius: "0.25rem",
1499
+ }}
1500
+ >
1501
+ flex-1 fills remaining
1502
+ </div>
1503
+ </div>
1504
+ </div>
1505
+ </div>
1506
+ ),
1507
+ parameters: {
1508
+ docs: {
1509
+ description: {
1510
+ story:
1511
+ "Flex item sizing: `.flex-1` (equal distribution), `.flex-auto` (content-based), `.flex-initial` (default), `.flex-none` (no grow/shrink)",
1512
+ },
1513
+ },
1514
+ },
1515
+ };
1516
+
1517
+ /**
1518
+ * Common patterns
1519
+ */
1520
+ export const CommonPatterns: Story = {
1521
+ render: () => (
1522
+ <div style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
1523
+ <div>
1524
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1525
+ flex-center (Center both axes)
1526
+ </h4>
1527
+ <div
1528
+ className="flex-center"
1529
+ style={{
1530
+ padding: "2rem",
1531
+ border: "2px dashed #ccc",
1532
+ borderRadius: "0.5rem",
1533
+ minHeight: "8rem",
1534
+ }}
1535
+ >
1536
+ <div
1537
+ style={{
1538
+ padding: "1rem",
1539
+ background: "#e3f2fd",
1540
+ borderRadius: "0.25rem",
1541
+ }}
1542
+ >
1543
+ Centered Content
1544
+ </div>
1545
+ </div>
1546
+ </div>
1547
+
1548
+ <div>
1549
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1550
+ flex-between (Space between with center alignment)
1551
+ </h4>
1552
+ <div
1553
+ className="flex-between"
1554
+ style={{
1555
+ padding: "1rem",
1556
+ border: "2px dashed #ccc",
1557
+ borderRadius: "0.5rem",
1558
+ }}
1559
+ >
1560
+ <div
1561
+ style={{
1562
+ padding: "0.75rem",
1563
+ background: "#e3f2fd",
1564
+ borderRadius: "0.25rem",
1565
+ }}
1566
+ >
1567
+ Left
1568
+ </div>
1569
+ <div
1570
+ style={{
1571
+ padding: "0.75rem",
1572
+ background: "#90caf9",
1573
+ borderRadius: "0.25rem",
1574
+ }}
1575
+ >
1576
+ Right
1577
+ </div>
1578
+ </div>
1579
+ </div>
1580
+
1581
+ <div>
1582
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1583
+ flex-stack (Vertical stack, becomes row on md+)
1584
+ </h4>
1585
+ <div
1586
+ className="flex-stack"
1587
+ style={{
1588
+ padding: "1rem",
1589
+ border: "2px dashed #ccc",
1590
+ borderRadius: "0.5rem",
1591
+ }}
1592
+ >
1593
+ <div
1594
+ style={{
1595
+ padding: "1rem",
1596
+ background: "#e3f2fd",
1597
+ borderRadius: "0.25rem",
1598
+ }}
1599
+ >
1600
+ Item 1
1601
+ </div>
1602
+ <div
1603
+ style={{
1604
+ padding: "1rem",
1605
+ background: "#bbdefb",
1606
+ borderRadius: "0.25rem",
1607
+ }}
1608
+ >
1609
+ Item 2
1610
+ </div>
1611
+ <div
1612
+ style={{
1613
+ padding: "1rem",
1614
+ background: "#90caf9",
1615
+ borderRadius: "0.25rem",
1616
+ }}
1617
+ >
1618
+ Item 3
1619
+ </div>
1620
+ </div>
1621
+ <p style={{ marginTop: "0.5rem", fontSize: "0.875rem", color: "#666" }}>
1622
+ Resize viewport to see responsive behavior (column → row at 48rem)
1623
+ </p>
1624
+ </div>
1625
+
1626
+ <div>
1627
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1628
+ flex-spread (Equal width children)
1629
+ </h4>
1630
+ <div
1631
+ className="flex-spread gap-sm"
1632
+ style={{
1633
+ padding: "1rem",
1634
+ border: "2px dashed #ccc",
1635
+ borderRadius: "0.5rem",
1636
+ }}
1637
+ >
1638
+ <div
1639
+ style={{
1640
+ padding: "0.75rem",
1641
+ background: "#e3f2fd",
1642
+ borderRadius: "0.25rem",
1643
+ }}
1644
+ >
1645
+ A
1646
+ </div>
1647
+ <div
1648
+ style={{
1649
+ padding: "0.75rem",
1650
+ background: "#bbdefb",
1651
+ borderRadius: "0.25rem",
1652
+ }}
1653
+ >
1654
+ B
1655
+ </div>
1656
+ <div
1657
+ style={{
1658
+ padding: "0.75rem",
1659
+ background: "#90caf9",
1660
+ borderRadius: "0.25rem",
1661
+ }}
1662
+ >
1663
+ C
1664
+ </div>
1665
+ </div>
1666
+ </div>
1667
+ </div>
1668
+ ),
1669
+ parameters: {
1670
+ docs: {
1671
+ description: {
1672
+ story:
1673
+ "Common flexbox patterns: `.flex-center`, `.flex-between`, `.flex-around`, `.flex-stack`, `.flex-spread`",
1674
+ },
1675
+ },
1676
+ },
1677
+ };
1678
+
1679
+ /**
1680
+ * Responsive utilities demonstration
1681
+ */
1682
+ export const ResponsiveUtilities: Story = {
1683
+ render: () => (
1684
+ <div style={{ display: "flex", flexDirection: "column", gap: "2rem" }}>
1685
+ <div>
1686
+ <h3 style={{ marginBottom: "1rem" }}>Responsive Direction</h3>
1687
+ <p
1688
+ style={{
1689
+ marginBottom: "0.5rem",
1690
+ fontSize: "0.875rem",
1691
+ color: "#666",
1692
+ }}
1693
+ >
1694
+ Column on mobile, row on medium+ screens
1695
+ </p>
1696
+ <div
1697
+ className="flex flex-col md:flex-row gap-md"
1698
+ style={{
1699
+ padding: "1rem",
1700
+ border: "2px dashed #ccc",
1701
+ borderRadius: "0.5rem",
1702
+ }}
1703
+ >
1704
+ <div
1705
+ className="flex-1"
1706
+ style={{
1707
+ padding: "1rem",
1708
+ background: "#e3f2fd",
1709
+ borderRadius: "0.25rem",
1710
+ }}
1711
+ >
1712
+ Column 1
1713
+ </div>
1714
+ <div
1715
+ className="flex-1"
1716
+ style={{
1717
+ padding: "1rem",
1718
+ background: "#bbdefb",
1719
+ borderRadius: "0.25rem",
1720
+ }}
1721
+ >
1722
+ Column 2
1723
+ </div>
1724
+ <div
1725
+ className="flex-1"
1726
+ style={{
1727
+ padding: "1rem",
1728
+ background: "#90caf9",
1729
+ borderRadius: "0.25rem",
1730
+ }}
1731
+ >
1732
+ Column 3
1733
+ </div>
1734
+ </div>
1735
+ </div>
1736
+
1737
+ <div>
1738
+ <h3 style={{ marginBottom: "1rem" }}>Responsive Gaps</h3>
1739
+ <p
1740
+ style={{
1741
+ marginBottom: "0.5rem",
1742
+ fontSize: "0.875rem",
1743
+ color: "#666",
1744
+ }}
1745
+ >
1746
+ Small gap on mobile, large gap on medium+ screens
1747
+ </p>
1748
+ <div
1749
+ className="flex gap-sm md:gap-lg"
1750
+ style={{
1751
+ padding: "1rem",
1752
+ border: "2px dashed #ccc",
1753
+ borderRadius: "0.5rem",
1754
+ }}
1755
+ >
1756
+ <div
1757
+ style={{
1758
+ padding: "1rem",
1759
+ background: "#e3f2fd",
1760
+ borderRadius: "0.25rem",
1761
+ }}
1762
+ >
1763
+ 1
1764
+ </div>
1765
+ <div
1766
+ style={{
1767
+ padding: "1rem",
1768
+ background: "#bbdefb",
1769
+ borderRadius: "0.25rem",
1770
+ }}
1771
+ >
1772
+ 2
1773
+ </div>
1774
+ <div
1775
+ style={{
1776
+ padding: "1rem",
1777
+ background: "#90caf9",
1778
+ borderRadius: "0.25rem",
1779
+ }}
1780
+ >
1781
+ 3
1782
+ </div>
1783
+ </div>
1784
+ </div>
1785
+
1786
+ <div>
1787
+ <h3 style={{ marginBottom: "1rem" }}>Responsive Justification</h3>
1788
+ <p
1789
+ style={{
1790
+ marginBottom: "0.5rem",
1791
+ fontSize: "0.875rem",
1792
+ color: "#666",
1793
+ }}
1794
+ >
1795
+ Start alignment on mobile, space between on large+ screens
1796
+ </p>
1797
+ <div
1798
+ className="flex justify-start lg:justify-between"
1799
+ style={{
1800
+ padding: "1rem",
1801
+ border: "2px dashed #ccc",
1802
+ borderRadius: "0.5rem",
1803
+ }}
1804
+ >
1805
+ <div
1806
+ style={{
1807
+ padding: "1rem",
1808
+ background: "#e3f2fd",
1809
+ borderRadius: "0.25rem",
1810
+ }}
1811
+ >
1812
+ Left
1813
+ </div>
1814
+ <div
1815
+ style={{
1816
+ padding: "1rem",
1817
+ background: "#90caf9",
1818
+ borderRadius: "0.25rem",
1819
+ }}
1820
+ >
1821
+ Right
1822
+ </div>
1823
+ </div>
1824
+ </div>
1825
+
1826
+ <div
1827
+ style={{
1828
+ padding: "1rem",
1829
+ background: "#fff3cd",
1830
+ border: "1px solid #ffc107",
1831
+ borderRadius: "0.5rem",
1832
+ marginTop: "1rem",
1833
+ }}
1834
+ >
1835
+ <strong>💡 Tip:</strong> Resize your browser window or use
1836
+ Storybook&apos;s viewport toolbar to see responsive behavior at
1837
+ different breakpoints (sm: 480px, md: 768px, lg: 992px, xl: 1280px).
1838
+ </div>
1839
+ </div>
1840
+ ),
1841
+ parameters: {
1842
+ docs: {
1843
+ description: {
1844
+ story: `Responsive modifiers allow utilities to activate at specific breakpoints.
1845
+
1846
+ **Format:** \`{breakpoint}:{utility}\`
1847
+
1848
+ **Examples:**
1849
+ - \`sm:flex-row\` - Row direction on screens ≥ 480px
1850
+ - \`md:justify-center\` - Center justify on screens ≥ 768px
1851
+ - \`lg:gap-xl\` - Extra large gap on screens ≥ 992px
1852
+ - \`xl:items-end\` - End alignment on screens ≥ 1280px
1853
+
1854
+ All base utilities support responsive modifiers: direction, wrap, justify, align, gap, and flex sizing.`,
1855
+ },
1856
+ },
1857
+ chromatic: {
1858
+ viewports: [375, 480, 768, 992, 1280],
1859
+ },
1860
+ },
1861
+ };
1862
+
1863
+ /**
1864
+ * Wrapping behavior
1865
+ */
1866
+ export const FlexWrap: Story = {
1867
+ render: () => (
1868
+ <div style={{ display: "flex", flexDirection: "column", gap: "1.5rem" }}>
1869
+ <div>
1870
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1871
+ flex-wrap (default)
1872
+ </h4>
1873
+ <div
1874
+ className="flex flex-wrap gap-sm"
1875
+ style={{
1876
+ padding: "1rem",
1877
+ border: "2px dashed #ccc",
1878
+ borderRadius: "0.5rem",
1879
+ }}
1880
+ >
1881
+ {Array.from({ length: 12 }, (_, i) => (
1882
+ <div
1883
+ key={i}
1884
+ style={{
1885
+ padding: "0.75rem 1.5rem",
1886
+ background: "#e3f2fd",
1887
+ borderRadius: "0.25rem",
1888
+ }}
1889
+ >
1890
+ Item {i + 1}
1891
+ </div>
1892
+ ))}
1893
+ </div>
1894
+ </div>
1895
+
1896
+ <div>
1897
+ <h4 style={{ marginBottom: "0.5rem", fontSize: "0.875rem" }}>
1898
+ flex-nowrap
1899
+ </h4>
1900
+ <div
1901
+ className="flex flex-nowrap gap-sm"
1902
+ style={{
1903
+ padding: "1rem",
1904
+ border: "2px dashed #ccc",
1905
+ borderRadius: "0.5rem",
1906
+ overflowX: "auto",
1907
+ }}
1908
+ >
1909
+ {Array.from({ length: 12 }, (_, i) => (
1910
+ <div
1911
+ key={i}
1912
+ className="flex-shrink-0"
1913
+ style={{
1914
+ padding: "0.75rem 1.5rem",
1915
+ background: "#bbdefb",
1916
+ borderRadius: "0.25rem",
1917
+ }}
1918
+ >
1919
+ Item {i + 1}
1920
+ </div>
1921
+ ))}
1922
+ </div>
1923
+ </div>
1924
+ </div>
1925
+ ),
1926
+ parameters: {
1927
+ docs: {
1928
+ description: {
1929
+ story:
1930
+ "Flex wrap utilities: `.flex-wrap`, `.flex-nowrap`, `.flex-wrap-reverse`",
1931
+ },
1932
+ },
1933
+ },
1934
+ };