@fpkit/acss 3.4.0 → 3.6.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 (44) hide show
  1. package/libs/index.cjs +5 -5
  2. package/libs/index.cjs.map +1 -1
  3. package/libs/index.css +1 -1
  4. package/libs/index.css.map +1 -1
  5. package/libs/index.d.cts +64 -13
  6. package/libs/index.d.ts +64 -13
  7. package/libs/index.js +4 -4
  8. package/libs/index.js.map +1 -1
  9. package/package.json +2 -2
  10. package/src/components/col/README.mdx +138 -9
  11. package/src/components/col/col.stories.tsx +1711 -2
  12. package/src/components/col/col.test.tsx +45 -0
  13. package/src/components/col/col.tsx +3 -1
  14. package/src/components/col/col.types.ts +18 -4
  15. package/src/components/row/row.tsx +9 -0
  16. package/src/components/row/row.types.ts +24 -7
  17. package/src/sass/_columns.scss +396 -81
  18. package/src/styles/index.css +515 -7
  19. package/src/styles/index.css.map +1 -1
  20. package/src/types/layout-primitives.ts +22 -2
  21. package/libs/components/alert/alert.min.min.css +0 -2
  22. package/libs/components/badge/badge.min.min.css +0 -2
  23. package/libs/components/box/box.min.min.css +0 -2
  24. package/libs/components/breadcrumbs/breadcrumb.min.min.css +0 -2
  25. package/libs/components/buttons/button.min.min.css +0 -2
  26. package/libs/components/cards/card-style.min.min.css +0 -2
  27. package/libs/components/cards/card.min.min.css +0 -2
  28. package/libs/components/cluster/cluster.min.min.css +0 -2
  29. package/libs/components/details/details.min.min.css +0 -2
  30. package/libs/components/dialog/dialog.min.min.css +0 -2
  31. package/libs/components/flexbox/flex.min.min.css +0 -2
  32. package/libs/components/form/form.min.min.css +0 -2
  33. package/libs/components/grid/grid.min.min.css +0 -2
  34. package/libs/components/icons/icon.min.min.css +0 -2
  35. package/libs/components/images/img.min.min.css +0 -2
  36. package/libs/components/layout/landmarks.min.min.css +0 -2
  37. package/libs/components/link/link.min.min.css +0 -2
  38. package/libs/components/list/list.min.min.css +0 -2
  39. package/libs/components/nav/nav.min.min.css +0 -2
  40. package/libs/components/progress/progress.min.min.css +0 -2
  41. package/libs/components/stack/stack.min.min.css +0 -2
  42. package/libs/components/styles/index.min.min.css +0 -2
  43. package/libs/components/tag/tag.min.min.css +0 -2
  44. package/libs/components/text-to-speech/text-to-speech.min.min.css +0 -2
@@ -111,6 +111,51 @@ describe("Col Component", () => {
111
111
  });
112
112
  });
113
113
 
114
+ describe("Flex Column", () => {
115
+ it("applies col-flex utility class when span is 'flex'", () => {
116
+ const { container } = render(<Col span="flex">Content</Col>);
117
+ const col = container.firstChild as HTMLElement;
118
+ expect(col).toHaveClass("col-flex");
119
+ });
120
+
121
+ it("does not apply numeric col class when span is 'flex'", () => {
122
+ const { container } = render(<Col span="flex">Content</Col>);
123
+ const col = container.firstChild as HTMLElement;
124
+ expect(col.className).not.toMatch(/col-\d+/);
125
+ });
126
+
127
+ it("auto overrides flex when both provided", () => {
128
+ const { container } = render(<Col auto span="flex">Content</Col>);
129
+ const col = container.firstChild as HTMLElement;
130
+ expect(col).toHaveClass("col-auto");
131
+ expect(col).not.toHaveClass("col-flex");
132
+ });
133
+
134
+ it("flex column works with offset", () => {
135
+ const { container } = render(<Col span="flex" offset={2}>Content</Col>);
136
+ const col = container.firstChild as HTMLElement;
137
+ expect(col).toHaveClass("col-flex");
138
+ expect(col).toHaveClass("col-offset-2");
139
+ });
140
+
141
+ it("flex column works with order", () => {
142
+ const { container } = render(<Col span="flex" order="first">Content</Col>);
143
+ const col = container.firstChild as HTMLElement;
144
+ expect(col).toHaveClass("col-flex");
145
+ expect(col).toHaveClass("col-order-first");
146
+ });
147
+
148
+ it("flex column works with combined props", () => {
149
+ const { container } = render(
150
+ <Col span="flex" offset={1} order={2}>Content</Col>
151
+ );
152
+ const col = container.firstChild as HTMLElement;
153
+ expect(col).toHaveClass("col-flex");
154
+ expect(col).toHaveClass("col-offset-1");
155
+ expect(col).toHaveClass("col-order-2");
156
+ });
157
+ });
158
+
114
159
  describe("Offset Utilities", () => {
115
160
  it("applies col-offset-0 utility class", () => {
116
161
  const { container } = render(<Col offset={0}>Content</Col>);
@@ -70,9 +70,11 @@ export const Col = React.forwardRef<HTMLElement, ColProps>(
70
70
  // Build utility classes array - NO base class
71
71
  const utilityClasses: string[] = [];
72
72
 
73
- // Auto takes precedence over span
73
+ // Auto takes precedence over span (including "flex")
74
74
  if (auto) {
75
75
  utilityClasses.push("col-auto");
76
+ } else if (span === "flex") {
77
+ utilityClasses.push("col-flex");
76
78
  } else if (span) {
77
79
  utilityClasses.push(`col-${span}`);
78
80
  }
@@ -27,10 +27,22 @@ export interface ColProps
27
27
  extends Partial<ComponentProps>,
28
28
  Omit<React.HTMLAttributes<HTMLElement>, "className"> {
29
29
  /**
30
- * Column span (1-12)
31
- * Maps to .col-{span} utility class
32
- * Ignored if auto is true
30
+ * Column span (1-12 or "flex")
31
+ *
32
+ * - Numeric values (1-12): Maps to .col-{span} utility class (fixed width)
33
+ * - "flex": Maps to .col-flex utility class (grows to fill space)
34
+ *
35
+ * Ignored if auto is true (auto takes precedence)
36
+ *
33
37
  * @default undefined
38
+ *
39
+ * @example
40
+ * // Fixed width column
41
+ * <Col span={6}>50% width on desktop</Col>
42
+ *
43
+ * @example
44
+ * // Flex column fills remaining space
45
+ * <Col span="flex">Grows to fill available space</Col>
34
46
  */
35
47
  span?: ColumnSpan;
36
48
 
@@ -53,8 +65,10 @@ export interface ColProps
53
65
  /**
54
66
  * Auto-width column
55
67
  * When true, uses .col-auto (content-based width)
56
- * Takes precedence over span prop
68
+ * Takes precedence over span prop (including "flex")
57
69
  * @default false
70
+ *
71
+ * @see span - For flex-grow behavior, use span="flex" instead of auto
58
72
  */
59
73
  auto?: boolean;
60
74
 
@@ -75,6 +75,15 @@ export const Row = React.forwardRef<HTMLElement, RowProps>(
75
75
  },
76
76
  ref
77
77
  ) => {
78
+ // Deprecation warning in development
79
+ if (process.env.NODE_ENV === "development" && alwaysProportional) {
80
+ // eslint-disable-next-line no-console
81
+ console.warn(
82
+ "[fpkit] Row: alwaysProportional is deprecated and will be removed in v5.0.0. " +
83
+ 'Use responsive column utilities instead: className="col-sm-6 col-md-4"'
84
+ );
85
+ }
86
+
78
87
  // Build utility classes array - ALWAYS include base class
79
88
  const utilityClasses: string[] = ["col-row"];
80
89
 
@@ -56,22 +56,39 @@ export interface RowProps
56
56
  wrap?: FlexWrap;
57
57
 
58
58
  /**
59
- * When true, columns maintain their proportional layout on tablets and larger
60
- * instead of stacking to 100% width on all mobile devices (< 768px).
59
+ * @deprecated This prop will be removed in v5.0.0
61
60
  *
62
- * Wrapping behavior with this prop:
63
- * - Mobile phones (< 480px): Columns still stack at 100% width
64
- * - Tablets & larger (≥ 480px): Columns maintain proportional layout
61
+ * Use responsive column utility classes instead for better control across breakpoints.
65
62
  *
66
- * Use this when you want columns to stay side-by-side on tablets and desktops
67
- * but still provide mobile-friendly stacking on phones.
63
+ * Migration path:
64
+ * - Before: `<Row alwaysProportional><Col span={6}>Column</Col></Row>`
65
+ * - After: `<Row><div className="col-sm-6">Column</div></Row>`
66
+ *
67
+ * Responsive utilities provide more flexibility:
68
+ * - Mobile phones (< 480px): `.col-12` (stack full width)
69
+ * - Tablets (≥ 480px): `.col-sm-6` (half width)
70
+ * - Desktops (≥ 1024px): `.col-lg-4` (third width)
68
71
  *
69
72
  * @default false
70
73
  * @example
74
+ * // Deprecated approach
71
75
  * <Row alwaysProportional>
72
76
  * <Col span={6}>Column 1</Col>
73
77
  * <Col span={6}>Column 2</Col>
74
78
  * </Row>
79
+ *
80
+ * @example
81
+ * // Recommended approach with responsive utilities
82
+ * <Row>
83
+ * <div className="col-12 col-sm-6 col-lg-4">Column 1</div>
84
+ * <div className="col-12 col-sm-6 col-lg-4">Column 2</div>
85
+ * </Row>
86
+ *
87
+ * @example
88
+ * // Mix with Col component if needed
89
+ * <Row>
90
+ * <Col span={12} className="col-sm-6 col-lg-4">Column</Col>
91
+ * </Row>
75
92
  */
76
93
  alwaysProportional?: boolean;
77
94