@aurora-ds/components 0.17.10 → 0.17.11
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 -1
- package/dist/cjs/components/layout/grid/Grid.props.d.ts +1 -4
- package/dist/cjs/index.js +13 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/layout/grid/Grid.d.ts +1 -1
- package/dist/esm/components/layout/grid/Grid.props.d.ts +1 -4
- package/dist/esm/index.js +13 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { GridProps } from '@components/layout/grid/Grid.props.ts';
|
|
|
8
8
|
* **Usage:**
|
|
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
|
+
* - Children with min-width will cause the grid to overflow if space is insufficient
|
|
12
12
|
*/
|
|
13
13
|
declare const Grid: FC<GridProps>;
|
|
14
14
|
export default Grid;
|
|
@@ -3,7 +3,7 @@ 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).
|
|
6
|
+
/** Number of columns (number or CSS grid-template-columns value). */
|
|
7
7
|
columns?: number | string;
|
|
8
8
|
/** Number of rows (number or CSS grid-template-rows value). */
|
|
9
9
|
rows?: number | string;
|
|
@@ -29,8 +29,6 @@ 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 */
|
|
33
|
-
minChildWidth?: CSSProperties['width'];
|
|
34
32
|
/** Accessibility label for screen readers */
|
|
35
33
|
ariaLabel?: string;
|
|
36
34
|
/** ID of element that labels this grid */
|
|
@@ -56,5 +54,4 @@ export type GridStyleParams = {
|
|
|
56
54
|
alignContent?: CSSProperties['alignContent'];
|
|
57
55
|
justifyContent?: CSSProperties['justifyContent'];
|
|
58
56
|
padding?: keyof Theme['spacing'];
|
|
59
|
-
minChildWidth?: CSSProperties['width'];
|
|
60
57
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1891,24 +1891,17 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
|
|
|
1891
1891
|
Card.displayName = 'Card';
|
|
1892
1892
|
|
|
1893
1893
|
/**
|
|
1894
|
-
* Generates the grid-template-columns value based on columns
|
|
1895
|
-
* - If
|
|
1896
|
-
* - If
|
|
1897
|
-
*
|
|
1894
|
+
* Generates the grid-template-columns value based on columns prop
|
|
1895
|
+
* - If columns is a number: creates that exact number of columns with equal width
|
|
1896
|
+
* - If columns is a string: uses it directly as grid-template-columns value
|
|
1897
|
+
*
|
|
1898
|
+
* Children with min-width will cause overflow rather than wrapping.
|
|
1899
|
+
* For responsive behavior, the parent container should handle breakpoints
|
|
1900
|
+
* or use CSS container queries.
|
|
1898
1901
|
*/
|
|
1899
|
-
const getGridTemplateColumns = (columns
|
|
1900
|
-
const minWidthValue = typeof minChildWidth === 'number' ? `${minChildWidth}px` : minChildWidth;
|
|
1901
|
-
if (minChildWidth && typeof columns === 'number') {
|
|
1902
|
-
// 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))`;
|
|
1905
|
-
}
|
|
1906
|
-
if (minChildWidth) {
|
|
1907
|
-
// Responsive grid without column limit
|
|
1908
|
-
return `repeat(auto-fill, minmax(${minWidthValue}, 1fr))`;
|
|
1909
|
-
}
|
|
1902
|
+
const getGridTemplateColumns = (columns) => {
|
|
1910
1903
|
if (typeof columns === 'number') {
|
|
1911
|
-
// Fixed columns
|
|
1904
|
+
// Fixed number of columns - each column takes equal space
|
|
1912
1905
|
return `repeat(${columns}, 1fr)`;
|
|
1913
1906
|
}
|
|
1914
1907
|
return columns;
|
|
@@ -1926,12 +1919,11 @@ const getGridTemplateRows = (rows) => {
|
|
|
1926
1919
|
* Grid styles using createStyles from @aurora-ds/theme
|
|
1927
1920
|
*/
|
|
1928
1921
|
const GRID_STYLES = theme.createStyles((theme) => ({
|
|
1929
|
-
root: ({ columns, rows, gap, columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding,
|
|
1922
|
+
root: ({ columns, rows, gap, columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, }) => {
|
|
1930
1923
|
const gapValue = gap ? theme.spacing[gap] : undefined;
|
|
1931
|
-
const columnGapValue = columnGap ? theme.spacing[columnGap] : gapValue;
|
|
1932
1924
|
return {
|
|
1933
1925
|
display: 'grid',
|
|
1934
|
-
gridTemplateColumns: getGridTemplateColumns(columns
|
|
1926
|
+
gridTemplateColumns: getGridTemplateColumns(columns),
|
|
1935
1927
|
gridTemplateRows: getGridTemplateRows(rows),
|
|
1936
1928
|
gap: gapValue,
|
|
1937
1929
|
columnGap: columnGap ? theme.spacing[columnGap] : undefined,
|
|
@@ -1944,8 +1936,6 @@ const GRID_STYLES = theme.createStyles((theme) => ({
|
|
|
1944
1936
|
alignContent,
|
|
1945
1937
|
justifyContent,
|
|
1946
1938
|
padding: padding ? theme.spacing[padding] : undefined,
|
|
1947
|
-
// CSS variable for gap calculation in grid-template-columns
|
|
1948
|
-
'--grid-gap': columnGapValue || gapValue || '0px',
|
|
1949
1939
|
};
|
|
1950
1940
|
},
|
|
1951
1941
|
}));
|
|
@@ -1958,9 +1948,9 @@ const GRID_STYLES = theme.createStyles((theme) => ({
|
|
|
1958
1948
|
* **Usage:**
|
|
1959
1949
|
* - Use `columns` to define the number of columns or a custom grid-template-columns value
|
|
1960
1950
|
* - Use `rows` to define the number of rows or a custom grid-template-rows value
|
|
1961
|
-
* -
|
|
1951
|
+
* - Children with min-width will cause the grid to overflow if space is insufficient
|
|
1962
1952
|
*/
|
|
1963
|
-
const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding,
|
|
1953
|
+
const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
1964
1954
|
return (jsxRuntime.jsx("div", { className: GRID_STYLES.root({
|
|
1965
1955
|
columns,
|
|
1966
1956
|
rows,
|
|
@@ -1975,7 +1965,6 @@ const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, widt
|
|
|
1975
1965
|
alignContent,
|
|
1976
1966
|
justifyContent,
|
|
1977
1967
|
padding,
|
|
1978
|
-
minChildWidth,
|
|
1979
1968
|
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
1980
1969
|
};
|
|
1981
1970
|
Grid.displayName = 'Grid';
|