@aurora-ds/components 0.17.10 → 0.17.12

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.
@@ -9,6 +9,7 @@ import { GridProps } from '@components/layout/grid/Grid.props.ts';
9
9
  * - Use `columns` to define the number of columns or a custom grid-template-columns value
10
10
  * - Use `rows` to define the number of rows or a custom grid-template-rows value
11
11
  * - Use `minChildWidth` for responsive auto-fill grids
12
+ * - Combine `columns` + `minChildWidth` for responsive grid with max columns limit
12
13
  */
13
14
  declare const Grid: FC<GridProps>;
14
15
  export default Grid;
@@ -29,7 +29,7 @@ export type GridProps = {
29
29
  justifyContent?: CSSProperties['justifyContent'];
30
30
  /** Padding inside the grid */
31
31
  padding?: keyof Theme['spacing'];
32
- /** Minimum width for auto-fill/auto-fit columns */
32
+ /** Minimum width for each grid child. Enables responsive auto-fill behavior. */
33
33
  minChildWidth?: CSSProperties['width'];
34
34
  /** Accessibility label for screen readers */
35
35
  ariaLabel?: string;
package/dist/cjs/index.js CHANGED
@@ -1893,22 +1893,30 @@ Card.displayName = 'Card';
1893
1893
  /**
1894
1894
  * Generates the grid-template-columns value based on columns and minChildWidth props
1895
1895
  * - If only columns is defined: creates a fixed number of columns
1896
- * - If only minChildWidth is defined: creates responsive auto-fill columns
1897
- * - If both are defined: creates responsive columns with a maximum limit
1896
+ * - If only minChildWidth is defined: creates responsive auto-fill columns (items stretch)
1897
+ * - If both are defined: creates responsive columns with a maximum limit (items don't stretch beyond column width)
1898
+ *
1899
+ * Key difference between auto-fill and auto-fit:
1900
+ * - auto-fill: keeps empty column tracks, items don't stretch to fill container
1901
+ * - auto-fit: collapses empty tracks, items stretch to fill available space
1898
1902
  */
1899
1903
  const getGridTemplateColumns = (columns, minChildWidth) => {
1900
1904
  const minWidthValue = typeof minChildWidth === 'number' ? `${minChildWidth}px` : minChildWidth;
1901
1905
  if (minChildWidth && typeof columns === 'number') {
1902
1906
  // Responsive grid with max columns limit
1903
- // Uses auto-fit with max() to ensure we don't exceed the column limit
1904
- return `repeat(auto-fit, minmax(max(${minWidthValue}, calc((100% - ${(columns - 1)} * var(--grid-gap, 0px)) / ${columns})), 1fr))`;
1907
+ // Uses auto-fill to preserve empty column tracks (items don't stretch beyond their column)
1908
+ // The min value ensures items are at least minChildWidth
1909
+ // The max value is 1fr to distribute space evenly within the max columns constraint
1910
+ // The calc ensures we never exceed the specified number of columns
1911
+ const minColumnWidth = `calc((100% - ${columns - 1} * var(--grid-gap, 0px)) / ${columns})`;
1912
+ return `repeat(auto-fill, minmax(max(${minWidthValue}, ${minColumnWidth}), 1fr))`;
1905
1913
  }
1906
1914
  if (minChildWidth) {
1907
- // Responsive grid without column limit
1915
+ // Responsive grid without column limit - items will fill available space
1908
1916
  return `repeat(auto-fill, minmax(${minWidthValue}, 1fr))`;
1909
1917
  }
1910
1918
  if (typeof columns === 'number') {
1911
- // Fixed columns
1919
+ // Fixed number of columns - each column takes equal space
1912
1920
  return `repeat(${columns}, 1fr)`;
1913
1921
  }
1914
1922
  return columns;
@@ -1944,7 +1952,6 @@ const GRID_STYLES = theme.createStyles((theme) => ({
1944
1952
  alignContent,
1945
1953
  justifyContent,
1946
1954
  padding: padding ? theme.spacing[padding] : undefined,
1947
- // CSS variable for gap calculation in grid-template-columns
1948
1955
  '--grid-gap': columnGapValue || gapValue || '0px',
1949
1956
  };
1950
1957
  },
@@ -1959,6 +1966,7 @@ const GRID_STYLES = theme.createStyles((theme) => ({
1959
1966
  * - Use `columns` to define the number of columns or a custom grid-template-columns value
1960
1967
  * - Use `rows` to define the number of rows or a custom grid-template-rows value
1961
1968
  * - Use `minChildWidth` for responsive auto-fill grids
1969
+ * - Combine `columns` + `minChildWidth` for responsive grid with max columns limit
1962
1970
  */
1963
1971
  const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, minChildWidth, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
1964
1972
  return (jsxRuntime.jsx("div", { className: GRID_STYLES.root({