@synerise/ds-grid 1.1.4 → 1.1.6

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/README.md CHANGED
@@ -6,6 +6,7 @@ title: Grid
6
6
  Grid UI Component
7
7
 
8
8
  ## Installation
9
+
9
10
  ```
10
11
  npm i @synerise/ds-grid
11
12
  or
@@ -13,9 +14,10 @@ yarn add @synerise/ds-grid
13
14
  ```
14
15
 
15
16
  ## Usage
17
+
16
18
  ```
17
19
  import Grid from '@synerise/ds-grid'
18
-
20
+
19
21
  <Grid>
20
22
  <Grid.Item xxl={12} xl={8} lg={6} md={4} sm={4} xs={3}>
21
23
  <Card>...</Card>
@@ -39,15 +41,13 @@ import Grid from '@synerise/ds-grid'
39
41
  ### Grid
40
42
 
41
43
  | Property | Description | Type | Default |
42
- | -------- | ----------- | ---- | ------- |
44
+ | -------- | -------------------------- | ------ | ------- |
43
45
  | gutter | Spacing between grids (px) | number | 24 |
44
46
 
45
-
46
-
47
47
  ### Grid.Item
48
48
 
49
49
  | Property | Description | Type | Default |
50
- | -------- | ----------- | ---- | ------- |
50
+ | -------------- | ----------------------------------------------------------------------------------------- | ------- | ------- |
51
51
  | xxl | `screen > 1600`, number of cells to occupy, 0 corresponds to display: none, max value: 24 | number | - |
52
52
  | xl | `screen > 1280`, number of cells to occupy, 0 corresponds to display: none, max value: 16 | number | - |
53
53
  | lg | `screen > 960`, number of cells to occupy, 0 corresponds to display: none, max value: 12 | number | - |
@@ -55,5 +55,3 @@ import Grid from '@synerise/ds-grid'
55
55
  | sm | `screen > 320`, number of cells to occupy, 0 corresponds to display: none, max value: 8 | number | - |
56
56
  | xs | `screen <= 320`, number of cells to occupy, 0 corresponds to display: none, max value: 3 | number | - |
57
57
  | contentWrapper | Group content with max size (defined in col size props) and center them horizontally | boolean | - |
58
-
59
-
package/dist/Grid.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GridProps } from './Grid.types';
2
+ import { type GridProps } from './Grid.types';
3
3
  export declare const GridContext: React.Context<{
4
4
  dimensions: {
5
5
  width: number;
@@ -3,7 +3,7 @@ export declare const GridContainer: import("styled-components").StyledComponent<
3
3
  gutter: number;
4
4
  }, never>;
5
5
  export declare const GridItem: import("styled-components").StyledComponent<"div", any, {
6
- columns?: number | undefined;
6
+ columns?: number;
7
7
  contentWrapper: boolean;
8
8
  maxColumns: number;
9
9
  }, never>;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
2
  export type GridProps = {
3
3
  gutter?: number;
4
4
  style?: CSSProperties;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { GridItemProps } from '../Grid.types';
2
+ import { type GridItemProps } from '../Grid.types';
3
3
  declare const Item: ({ children, contentWrapper, ...props }: GridItemProps) => React.JSX.Element;
4
4
  export default Item;
@@ -1,16 +1,16 @@
1
1
  var _excluded = ["children", "contentWrapper"];
2
2
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
3
- import React from 'react';
4
- import * as S from '../Grid.styles';
3
+ import React, { useContext, useMemo } from 'react';
5
4
  import { DEFAULT_COLUMNS_NUMBER, GridContext } from '../Grid';
5
+ import * as S from '../Grid.styles';
6
6
  var BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
7
7
  var Item = function Item(_ref) {
8
8
  var _breakpointData$break2;
9
9
  var children = _ref.children,
10
10
  contentWrapper = _ref.contentWrapper,
11
11
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
12
- var breakpointData = React.useContext(GridContext);
13
- var definedBreakpoints = React.useMemo(function () {
12
+ var breakpointData = useContext(GridContext);
13
+ var definedBreakpoints = useMemo(function () {
14
14
  return BREAKPOINTS.filter(function (breakpoint) {
15
15
  return props[breakpoint] !== undefined;
16
16
  }).map(function (breakpoint) {
@@ -20,10 +20,12 @@ var Item = function Item(_ref) {
20
20
  };
21
21
  });
22
22
  }, [props]);
23
- var breakpointColumns = React.useMemo(function () {
23
+ var breakpointColumns = useMemo(function () {
24
24
  if (breakpointData.breakpoint) {
25
25
  var name = breakpointData.breakpoint.name;
26
- if (props[name] !== undefined) return props[name];
26
+ if (props[name] !== undefined) {
27
+ return props[name];
28
+ }
27
29
  var indexOfCurrentBreakpoint = BREAKPOINTS.indexOf(name);
28
30
  var nextAvailableBreakpoint = definedBreakpoints.find(function (breakpoint) {
29
31
  return breakpoint.index >= indexOfCurrentBreakpoint;
@@ -32,9 +34,11 @@ var Item = function Item(_ref) {
32
34
  }
33
35
  return undefined;
34
36
  }, [breakpointData.breakpoint, definedBreakpoints, props]);
35
- var getColumns = React.useMemo(function () {
37
+ var getColumns = useMemo(function () {
36
38
  var _breakpointData$break;
37
- if (breakpointColumns !== undefined) return breakpointColumns;
39
+ if (breakpointColumns !== undefined) {
40
+ return breakpointColumns;
41
+ }
38
42
  return ((_breakpointData$break = breakpointData.breakpoint) == null ? void 0 : _breakpointData$break.columns) || DEFAULT_COLUMNS_NUMBER;
39
43
  }, [breakpointColumns, breakpointData]);
40
44
  return /*#__PURE__*/React.createElement(S.GridItem, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-grid",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Grid UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,12 +34,12 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-utils": "^1.3.0"
37
+ "@synerise/ds-utils": "^1.4.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@synerise/ds-core": "*",
41
41
  "react": ">=16.9.0 <= 18.3.1",
42
42
  "styled-components": "^5.3.3"
43
43
  },
44
- "gitHead": "f2713cd35cfe22f63a159f05144585834897a132"
44
+ "gitHead": "b35b1875727156fe9f5b3bad55aed5ca447c8c8d"
45
45
  }