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