@synerise/ds-grid 1.1.15 → 1.1.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.
- package/CHANGELOG.md +8 -0
- package/dist/Grid.const.js +6 -2
- package/dist/Grid.context.d.ts +1 -1
- package/dist/Grid.context.js +6 -3
- package/dist/Grid.d.ts +3 -3
- package/dist/Grid.js +16 -22
- package/dist/Grid.styles.d.ts +2 -2
- package/dist/Grid.styles.js +9 -17
- package/dist/Grid.types.d.ts +1 -1
- package/dist/Grid.types.js +1 -1
- package/dist/GridItem/GridItem.d.ts +2 -2
- package/dist/GridItem/GridItem.js +30 -37
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +9 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.17](https://github.com/Synerise/synerise-design/compare/@synerise/ds-grid@1.1.16...@synerise/ds-grid@1.1.17) (2026-04-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-grid
|
|
9
|
+
|
|
10
|
+
## [1.1.16](https://github.com/Synerise/synerise-design/compare/@synerise/ds-grid@1.1.15...@synerise/ds-grid@1.1.16) (2026-03-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-grid
|
|
13
|
+
|
|
6
14
|
## [1.1.15](https://github.com/Synerise/synerise-design/compare/@synerise/ds-grid@1.1.14...@synerise/ds-grid@1.1.15) (2026-03-20)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-grid
|
package/dist/Grid.const.js
CHANGED
package/dist/Grid.context.d.ts
CHANGED
package/dist/Grid.context.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { createContext } from
|
|
2
|
-
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const GridContext = createContext({
|
|
3
3
|
dimensions: {
|
|
4
4
|
width: window.innerWidth,
|
|
5
5
|
height: window.innerHeight
|
|
6
6
|
}
|
|
7
|
-
});
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
GridContext
|
|
10
|
+
};
|
package/dist/Grid.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GridProps } from './Grid.types';
|
|
3
3
|
declare const Grid: {
|
|
4
4
|
({ children, gutter, style }: GridProps): React.JSX.Element;
|
|
5
|
-
Item: ({ children, contentWrapper, ...props }: import(
|
|
5
|
+
Item: ({ children, contentWrapper, ...props }: import('./Grid.types').GridItemProps) => React.JSX.Element;
|
|
6
6
|
};
|
|
7
7
|
export default Grid;
|
package/dist/Grid.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useBreakpoint } from
|
|
3
|
-
import {
|
|
4
|
-
import { GridContext } from
|
|
5
|
-
import
|
|
6
|
-
import Item from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /*#__PURE__*/React.createElement(S.GridContainer, {
|
|
15
|
-
style: style,
|
|
16
|
-
className: "ds-grid",
|
|
17
|
-
columns: ((_breakpointData$break = breakpointData.breakpoint) == null ? void 0 : _breakpointData$break.columns) || DEFAULT_COLUMNS_NUMBER,
|
|
18
|
-
gutter: gutter
|
|
19
|
-
}, /*#__PURE__*/React.createElement(GridContext.Provider, {
|
|
20
|
-
value: breakpointData
|
|
21
|
-
}, children));
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useBreakpoint } from "@synerise/ds-utils";
|
|
3
|
+
import { DEFAULT_GUTTER, DEFAULT_COLUMNS_NUMBER } from "./Grid.const.js";
|
|
4
|
+
import { GridContext } from "./Grid.context.js";
|
|
5
|
+
import { GridContainer } from "./Grid.styles.js";
|
|
6
|
+
import Item from "./GridItem/GridItem.js";
|
|
7
|
+
const Grid = ({
|
|
8
|
+
children,
|
|
9
|
+
gutter = DEFAULT_GUTTER,
|
|
10
|
+
style
|
|
11
|
+
}) => {
|
|
12
|
+
const breakpointData = useBreakpoint();
|
|
13
|
+
return /* @__PURE__ */ jsx(GridContainer, { style, className: "ds-grid", columns: breakpointData.breakpoint?.columns || DEFAULT_COLUMNS_NUMBER, gutter, children: /* @__PURE__ */ jsx(GridContext.Provider, { value: breakpointData, children }) });
|
|
22
14
|
};
|
|
23
15
|
Grid.Item = Item;
|
|
24
|
-
export
|
|
16
|
+
export {
|
|
17
|
+
Grid as default
|
|
18
|
+
};
|
package/dist/Grid.styles.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const GridContainer: import(
|
|
1
|
+
export declare const GridContainer: import('styled-components').StyledComponent<"div", any, {
|
|
2
2
|
columns: number;
|
|
3
3
|
gutter: number;
|
|
4
4
|
}, never>;
|
|
5
|
-
export declare const GridItem: import(
|
|
5
|
+
export declare const GridItem: import('styled-components').StyledComponent<"div", any, {
|
|
6
6
|
columns?: number;
|
|
7
7
|
contentWrapper: boolean;
|
|
8
8
|
maxColumns: number;
|
package/dist/Grid.styles.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import styled, { css } from
|
|
2
|
-
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const GridContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
3
3
|
displayName: "Gridstyles__GridContainer",
|
|
4
4
|
componentId: "sc-5newme-0"
|
|
5
|
-
})(["width:100%;display:grid;grid-template-columns:repeat(", ",1fr);grid-row-gap:", ";grid-column-gap:", ";"],
|
|
6
|
-
|
|
7
|
-
}, function (props) {
|
|
8
|
-
return props.gutter + "px";
|
|
9
|
-
}, function (props) {
|
|
10
|
-
return props.gutter + "px";
|
|
11
|
-
});
|
|
12
|
-
export var GridItem = styled.div.withConfig({
|
|
5
|
+
})(["width:100%;display:grid;grid-template-columns:repeat(", ",1fr);grid-row-gap:", ";grid-column-gap:", ";"], (props) => props.columns, (props) => `${props.gutter}px`, (props) => `${props.gutter}px`);
|
|
6
|
+
const GridItem = /* @__PURE__ */ styled.div.withConfig({
|
|
13
7
|
displayName: "Gridstyles__GridItem",
|
|
14
8
|
componentId: "sc-5newme-1"
|
|
15
|
-
})(["grid-column:span ", ";display:", ";", ""],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
return props.contentWrapper && Boolean(props.maxColumns) && Boolean(props.columns) && css(["grid-column-start:", ";grid-column-end:", ";display:flex;flex-direction:column;align-items:flex-start;justify-content:stretch;& > *{width:100%;margin-bottom:24px;}"], props.maxColumns && props.columns ? (props.maxColumns - props.columns) / 2 + 1 : 'span', props.maxColumns && props.columns ? (props.maxColumns - props.columns) / 2 + 1 + props.columns : 1);
|
|
21
|
-
});
|
|
9
|
+
})(["grid-column:span ", ";display:", ";", ""], (props) => props.columns || 1, (props) => props.columns === 0 ? "none" : "inherit", (props) => props.contentWrapper && Boolean(props.maxColumns) && Boolean(props.columns) && css(["grid-column-start:", ";grid-column-end:", ";display:flex;flex-direction:column;align-items:flex-start;justify-content:stretch;& > *{width:100%;margin-bottom:24px;}"], props.maxColumns && props.columns ? (props.maxColumns - props.columns) / 2 + 1 : "span", props.maxColumns && props.columns ? (props.maxColumns - props.columns) / 2 + 1 + props.columns : 1));
|
|
10
|
+
export {
|
|
11
|
+
GridContainer,
|
|
12
|
+
GridItem
|
|
13
|
+
};
|
package/dist/Grid.types.d.ts
CHANGED
package/dist/Grid.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GridItemProps } from '../Grid.types';
|
|
3
3
|
declare const Item: ({ children, contentWrapper, ...props }: GridItemProps) => React.JSX.Element;
|
|
4
4
|
export default Item;
|
|
@@ -1,52 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return BREAKPOINTS.filter(function (breakpoint) {
|
|
16
|
-
return props[breakpoint] !== undefined;
|
|
17
|
-
}).map(function (breakpoint) {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useMemo } from "react";
|
|
3
|
+
import { DEFAULT_COLUMNS_NUMBER } from "../Grid.const.js";
|
|
4
|
+
import { GridContext } from "../Grid.context.js";
|
|
5
|
+
import { GridItem } from "../Grid.styles.js";
|
|
6
|
+
const BREAKPOINTS = ["xxl", "xl", "lg", "md", "sm", "xs"];
|
|
7
|
+
const Item = ({
|
|
8
|
+
children,
|
|
9
|
+
contentWrapper,
|
|
10
|
+
...props
|
|
11
|
+
}) => {
|
|
12
|
+
const breakpointData = useContext(GridContext);
|
|
13
|
+
const definedBreakpoints = useMemo(() => {
|
|
14
|
+
return BREAKPOINTS.filter((breakpoint) => props[breakpoint] !== void 0).map((breakpoint) => {
|
|
18
15
|
return {
|
|
19
16
|
name: breakpoint,
|
|
20
17
|
index: BREAKPOINTS.indexOf(breakpoint)
|
|
21
18
|
};
|
|
22
19
|
});
|
|
23
20
|
}, [props]);
|
|
24
|
-
|
|
21
|
+
const breakpointColumns = useMemo(() => {
|
|
25
22
|
if (breakpointData.breakpoint) {
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const {
|
|
24
|
+
name
|
|
25
|
+
} = breakpointData.breakpoint;
|
|
26
|
+
if (props[name] !== void 0) {
|
|
28
27
|
return props[name];
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
return nextAvailableBreakpoint ? props[nextAvailableBreakpoint.name] : undefined;
|
|
29
|
+
const indexOfCurrentBreakpoint = BREAKPOINTS.indexOf(name);
|
|
30
|
+
const nextAvailableBreakpoint = definedBreakpoints.find((breakpoint) => breakpoint.index >= indexOfCurrentBreakpoint);
|
|
31
|
+
return nextAvailableBreakpoint ? props[nextAvailableBreakpoint.name] : void 0;
|
|
35
32
|
}
|
|
36
|
-
return
|
|
33
|
+
return void 0;
|
|
37
34
|
}, [breakpointData.breakpoint, definedBreakpoints, props]);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (breakpointColumns !== undefined) {
|
|
35
|
+
const getColumns = useMemo(() => {
|
|
36
|
+
if (breakpointColumns !== void 0) {
|
|
41
37
|
return breakpointColumns;
|
|
42
38
|
}
|
|
43
|
-
return
|
|
39
|
+
return breakpointData.breakpoint?.columns || DEFAULT_COLUMNS_NUMBER;
|
|
44
40
|
}, [breakpointColumns, breakpointData]);
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
contentWrapper: Boolean(contentWrapper)
|
|
50
|
-
}, children);
|
|
41
|
+
return /* @__PURE__ */ jsx(GridItem, { className: "ds-grid-item", columns: getColumns, maxColumns: breakpointData?.breakpoint?.columns || getColumns, contentWrapper: Boolean(contentWrapper), children });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
Item as default
|
|
51
45
|
};
|
|
52
|
-
export default Item;
|
package/dist/index.js
CHANGED
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-grid",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"description": "Grid UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,15 +16,12 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
20
|
-
"build:
|
|
21
|
-
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "pnpm run build:js -- --watch",
|
|
23
|
-
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
19
|
+
"build": "vite build",
|
|
20
|
+
"build:watch": "vite build --watch",
|
|
24
21
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
22
|
"prepublish": "pnpm run build",
|
|
26
|
-
"test": "
|
|
27
|
-
"test:watch": "
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
28
25
|
"types": "tsc --noEmit",
|
|
29
26
|
"check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
|
|
30
27
|
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
@@ -35,12 +32,13 @@
|
|
|
35
32
|
],
|
|
36
33
|
"types": "dist/index.d.ts",
|
|
37
34
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-utils": "^1.
|
|
35
|
+
"@synerise/ds-utils": "^1.8.0"
|
|
39
36
|
},
|
|
40
37
|
"peerDependencies": {
|
|
41
38
|
"@synerise/ds-core": "*",
|
|
42
39
|
"react": ">=16.9.0 <= 18.3.1",
|
|
43
|
-
"styled-components": "^5.3.3"
|
|
40
|
+
"styled-components": "^5.3.3",
|
|
41
|
+
"vitest": "4"
|
|
44
42
|
},
|
|
45
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ce3c6d75efe8573a2b274853636f959b75a6cd32"
|
|
46
44
|
}
|