@aurora-ds/components 0.17.14 → 0.17.16
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.props.d.ts +0 -3
- package/dist/cjs/index.js +12 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/layout/grid/Grid.props.d.ts +0 -3
- package/dist/esm/index.js +12 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/package.json +1 -1
|
@@ -7,8 +7,6 @@ export type GridProps = {
|
|
|
7
7
|
columns?: number | string;
|
|
8
8
|
/** Number of rows (number or CSS grid-template-rows value). */
|
|
9
9
|
rows?: number | string;
|
|
10
|
-
/** Gap between items (theme spacing key) */
|
|
11
|
-
gap?: keyof Theme['spacing'];
|
|
12
10
|
/** Gap between columns (theme spacing key) */
|
|
13
11
|
columnGap?: keyof Theme['spacing'];
|
|
14
12
|
/** Gap between rows (theme spacing key) */
|
|
@@ -45,7 +43,6 @@ export type GridProps = {
|
|
|
45
43
|
export type GridStyleParams = {
|
|
46
44
|
columns?: number | string;
|
|
47
45
|
rows?: number | string;
|
|
48
|
-
gap?: keyof Theme['spacing'];
|
|
49
46
|
columnGap?: keyof Theme['spacing'];
|
|
50
47
|
rowGap?: keyof Theme['spacing'];
|
|
51
48
|
width?: CSSProperties['width'];
|
package/dist/cjs/index.js
CHANGED
|
@@ -1900,7 +1900,7 @@ Card.displayName = 'Card';
|
|
|
1900
1900
|
* - auto-fill: keeps empty column tracks, items don't stretch to fill container
|
|
1901
1901
|
* - auto-fit: collapses empty tracks, items stretch to fill available space
|
|
1902
1902
|
*/
|
|
1903
|
-
const getGridTemplateColumns = (columns, minChildWidth) => {
|
|
1903
|
+
const getGridTemplateColumns = (columns, minChildWidth, columnGap) => {
|
|
1904
1904
|
const minWidthValue = typeof minChildWidth === 'number' ? `${minChildWidth}px` : minChildWidth;
|
|
1905
1905
|
if (minChildWidth && typeof columns === 'number') {
|
|
1906
1906
|
// Responsive grid with max columns limit
|
|
@@ -1908,7 +1908,8 @@ const getGridTemplateColumns = (columns, minChildWidth) => {
|
|
|
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
1910
|
// The calc ensures we never exceed the specified number of columns
|
|
1911
|
-
const
|
|
1911
|
+
const gapValue = columnGap || '0px';
|
|
1912
|
+
const minColumnWidth = `calc((100% - (${columns} - 1) * ${gapValue}) / ${columns})`;
|
|
1912
1913
|
return `repeat(auto-fill, minmax(max(${minWidthValue}, ${minColumnWidth}), 1fr))`;
|
|
1913
1914
|
}
|
|
1914
1915
|
if (minChildWidth) {
|
|
@@ -1934,16 +1935,15 @@ const getGridTemplateRows = (rows) => {
|
|
|
1934
1935
|
* Grid styles using createStyles from @aurora-ds/theme
|
|
1935
1936
|
*/
|
|
1936
1937
|
const GRID_STYLES = theme.createStyles((theme) => ({
|
|
1937
|
-
root: ({ columns, rows,
|
|
1938
|
-
const
|
|
1939
|
-
const
|
|
1938
|
+
root: ({ columns, rows, columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, minChildWidth, }) => {
|
|
1939
|
+
const columnGapValue = columnGap ? theme.spacing[columnGap] : undefined;
|
|
1940
|
+
const rowGapValue = rowGap ? theme.spacing[rowGap] : undefined;
|
|
1940
1941
|
return {
|
|
1941
1942
|
display: 'grid',
|
|
1942
|
-
gridTemplateColumns: getGridTemplateColumns(columns, minChildWidth),
|
|
1943
|
+
gridTemplateColumns: getGridTemplateColumns(columns, minChildWidth, columnGapValue),
|
|
1943
1944
|
gridTemplateRows: getGridTemplateRows(rows),
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
rowGap: rowGap ? theme.spacing[rowGap] : undefined,
|
|
1945
|
+
columnGap: columnGapValue,
|
|
1946
|
+
rowGap: rowGapValue,
|
|
1947
1947
|
width,
|
|
1948
1948
|
height,
|
|
1949
1949
|
minHeight,
|
|
@@ -1951,8 +1951,7 @@ const GRID_STYLES = theme.createStyles((theme) => ({
|
|
|
1951
1951
|
justifyItems,
|
|
1952
1952
|
alignContent,
|
|
1953
1953
|
justifyContent,
|
|
1954
|
-
padding: padding ? theme.spacing[padding] : undefined
|
|
1955
|
-
'--grid-gap': columnGapValue || gapValue || '0px',
|
|
1954
|
+
padding: padding ? theme.spacing[padding] : undefined
|
|
1956
1955
|
};
|
|
1957
1956
|
},
|
|
1958
1957
|
}));
|
|
@@ -1968,11 +1967,10 @@ const GRID_STYLES = theme.createStyles((theme) => ({
|
|
|
1968
1967
|
* - Use `minChildWidth` for responsive auto-fill grids
|
|
1969
1968
|
* - Combine `columns` + `minChildWidth` for responsive grid with max columns limit
|
|
1970
1969
|
*/
|
|
1971
|
-
const Grid = ({ children, columns = 1, rows,
|
|
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, }) => {
|
|
1972
1971
|
return (jsxRuntime.jsx("div", { className: GRID_STYLES.root({
|
|
1973
1972
|
columns,
|
|
1974
1973
|
rows,
|
|
1975
|
-
gap,
|
|
1976
1974
|
columnGap,
|
|
1977
1975
|
rowGap,
|
|
1978
1976
|
width,
|
|
@@ -2485,7 +2483,7 @@ const TAB_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
|
2485
2483
|
display: 'flex',
|
|
2486
2484
|
alignItems: 'center',
|
|
2487
2485
|
justifyContent: 'center',
|
|
2488
|
-
gap: theme.spacing.
|
|
2486
|
+
gap: theme.spacing.sm,
|
|
2489
2487
|
backgroundColor: isActive ? theme.colors.background : 'transparent',
|
|
2490
2488
|
color: isActive ? theme.colors.text : theme.colors.textSecondary,
|
|
2491
2489
|
boxShadow: isActive ? theme.shadows.sm : undefined,
|