@aurora-ds/components 0.17.16 → 0.17.17

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.
@@ -3,10 +3,10 @@ import { CSSProperties, ReactNode } from 'react';
3
3
  export type GridProps = {
4
4
  /** Grid children elements */
5
5
  children: ReactNode;
6
- /** Number of columns (number or CSS grid-template-columns value). Acts as max columns when minChildWidth is set. */
7
- columns?: number | string;
8
- /** Number of rows (number or CSS grid-template-rows value). */
9
- rows?: number | string;
6
+ /** Number of columns. Acts as max columns when minChildWidth is set for responsive behavior. */
7
+ columns?: number;
8
+ /** Number of rows. */
9
+ rows?: number;
10
10
  /** Gap between columns (theme spacing key) */
11
11
  columnGap?: keyof Theme['spacing'];
12
12
  /** Gap between rows (theme spacing key) */
@@ -41,8 +41,8 @@ export type GridProps = {
41
41
  tabIndex?: number;
42
42
  };
43
43
  export type GridStyleParams = {
44
- columns?: number | string;
45
- rows?: number | string;
44
+ columns?: number;
45
+ rows?: number;
46
46
  columnGap?: keyof Theme['spacing'];
47
47
  rowGap?: keyof Theme['spacing'];
48
48
  width?: CSSProperties['width'];
package/dist/cjs/index.js CHANGED
@@ -1893,8 +1893,8 @@ 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 (items stretch)
1897
- * - If both are defined: creates responsive columns with a maximum limit (items don't stretch beyond column width)
1896
+ * - If only minChildWidth is defined: creates responsive auto-fill columns
1897
+ * - If both are defined: creates responsive columns with a maximum limit (columns acts as max)
1898
1898
  *
1899
1899
  * Key difference between auto-fill and auto-fit:
1900
1900
  * - auto-fill: keeps empty column tracks, items don't stretch to fill container
@@ -1902,12 +1902,11 @@ Card.displayName = 'Card';
1902
1902
  */
1903
1903
  const getGridTemplateColumns = (columns, minChildWidth, columnGap) => {
1904
1904
  const minWidthValue = typeof minChildWidth === 'number' ? `${minChildWidth}px` : minChildWidth;
1905
- if (minChildWidth && typeof columns === 'number') {
1905
+ if (minChildWidth && columns) {
1906
1906
  // Responsive grid with max columns limit
1907
1907
  // Uses auto-fill to preserve empty column tracks (items don't stretch beyond their column)
1908
1908
  // The min value ensures items are at least minChildWidth
1909
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
1910
  const gapValue = columnGap || '0px';
1912
1911
  const minColumnWidth = `calc((100% - (${columns} - 1) * ${gapValue}) / ${columns})`;
1913
1912
  return `repeat(auto-fill, minmax(max(${minWidthValue}, ${minColumnWidth}), 1fr))`;
@@ -1916,20 +1915,20 @@ const getGridTemplateColumns = (columns, minChildWidth, columnGap) => {
1916
1915
  // Responsive grid without column limit - items will fill available space
1917
1916
  return `repeat(auto-fill, minmax(${minWidthValue}, 1fr))`;
1918
1917
  }
1919
- if (typeof columns === 'number') {
1918
+ if (columns) {
1920
1919
  // Fixed number of columns - each column takes equal space
1921
1920
  return `repeat(${columns}, 1fr)`;
1922
1921
  }
1923
- return columns;
1922
+ return undefined;
1924
1923
  };
1925
1924
  /**
1926
1925
  * Generates the grid-template-rows value based on rows prop
1927
1926
  */
1928
1927
  const getGridTemplateRows = (rows) => {
1929
- if (typeof rows === 'number') {
1930
- return `repeat(${rows}, 1fr)`;
1928
+ if (rows) {
1929
+ return `repeat(${rows}, auto)`;
1931
1930
  }
1932
- return rows;
1931
+ return undefined;
1933
1932
  };
1934
1933
  /**
1935
1934
  * Grid styles using createStyles from @aurora-ds/theme
@@ -1967,7 +1966,7 @@ const GRID_STYLES = theme.createStyles((theme) => ({
1967
1966
  * - Use `minChildWidth` for responsive auto-fill grids
1968
1967
  * - Combine `columns` + `minChildWidth` for responsive grid with max columns limit
1969
1968
  */
1970
- const Grid = ({ children, columns = 1, rows, columnGap = 'md', rowGap = 'md', width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, minChildWidth, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
1969
+ const Grid = ({ children, columns = 3, rows, columnGap = 'md', rowGap = 'md', width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, minChildWidth, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
1971
1970
  return (jsxRuntime.jsx("div", { className: GRID_STYLES.root({
1972
1971
  columns,
1973
1972
  rows,