@aurora-ds/components 0.17.9 → 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 +2 -5
- package/dist/cjs/index.js +15 -14
- 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 +2 -5
- package/dist/esm/index.js +15 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +3 -5
- 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,9 +3,9 @@ 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
|
-
/** Number of rows (number or CSS grid-template-rows value) */
|
|
8
|
+
/** Number of rows (number or CSS grid-template-rows value). */
|
|
9
9
|
rows?: number | string;
|
|
10
10
|
/** Gap between items (theme spacing key) */
|
|
11
11
|
gap?: keyof Theme['spacing'];
|
|
@@ -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,13 +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
|
|
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.
|
|
1895
1901
|
*/
|
|
1896
|
-
const getGridTemplateColumns = (columns
|
|
1897
|
-
if (minChildWidth) {
|
|
1898
|
-
return `repeat(auto-fill, minmax(${typeof minChildWidth === 'number' ? `${minChildWidth}px` : minChildWidth}, 1fr))`;
|
|
1899
|
-
}
|
|
1902
|
+
const getGridTemplateColumns = (columns) => {
|
|
1900
1903
|
if (typeof columns === 'number') {
|
|
1904
|
+
// Fixed number of columns - each column takes equal space
|
|
1901
1905
|
return `repeat(${columns}, 1fr)`;
|
|
1902
1906
|
}
|
|
1903
1907
|
return columns;
|
|
@@ -1915,20 +1919,18 @@ const getGridTemplateRows = (rows) => {
|
|
|
1915
1919
|
* Grid styles using createStyles from @aurora-ds/theme
|
|
1916
1920
|
*/
|
|
1917
1921
|
const GRID_STYLES = theme.createStyles((theme) => ({
|
|
1918
|
-
root: ({ columns, rows, gap, columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding,
|
|
1919
|
-
const gapValue = gap ?
|
|
1920
|
-
const maxWidth = typeof columns === 'number' && typeof minChildWidth === 'number' ? `${columns * minChildWidth + (columns - 1) * gapValue}px` : undefined;
|
|
1922
|
+
root: ({ columns, rows, gap, columnGap, rowGap, width, height, minHeight, alignItems, justifyItems, alignContent, justifyContent, padding, }) => {
|
|
1923
|
+
const gapValue = gap ? theme.spacing[gap] : undefined;
|
|
1921
1924
|
return {
|
|
1922
1925
|
display: 'grid',
|
|
1923
|
-
gridTemplateColumns: getGridTemplateColumns(columns
|
|
1926
|
+
gridTemplateColumns: getGridTemplateColumns(columns),
|
|
1924
1927
|
gridTemplateRows: getGridTemplateRows(rows),
|
|
1925
|
-
gap:
|
|
1928
|
+
gap: gapValue,
|
|
1926
1929
|
columnGap: columnGap ? theme.spacing[columnGap] : undefined,
|
|
1927
1930
|
rowGap: rowGap ? theme.spacing[rowGap] : undefined,
|
|
1928
1931
|
width,
|
|
1929
1932
|
height,
|
|
1930
1933
|
minHeight,
|
|
1931
|
-
maxWidth,
|
|
1932
1934
|
alignItems,
|
|
1933
1935
|
justifyItems,
|
|
1934
1936
|
alignContent,
|
|
@@ -1946,9 +1948,9 @@ const GRID_STYLES = theme.createStyles((theme) => ({
|
|
|
1946
1948
|
* **Usage:**
|
|
1947
1949
|
* - Use `columns` to define the number of columns or a custom grid-template-columns value
|
|
1948
1950
|
* - Use `rows` to define the number of rows or a custom grid-template-rows value
|
|
1949
|
-
* -
|
|
1951
|
+
* - Children with min-width will cause the grid to overflow if space is insufficient
|
|
1950
1952
|
*/
|
|
1951
|
-
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, }) => {
|
|
1952
1954
|
return (jsxRuntime.jsx("div", { className: GRID_STYLES.root({
|
|
1953
1955
|
columns,
|
|
1954
1956
|
rows,
|
|
@@ -1963,7 +1965,6 @@ const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, widt
|
|
|
1963
1965
|
alignContent,
|
|
1964
1966
|
justifyContent,
|
|
1965
1967
|
padding,
|
|
1966
|
-
minChildWidth,
|
|
1967
1968
|
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
1968
1969
|
};
|
|
1969
1970
|
Grid.displayName = 'Grid';
|