@pushwoosh/kit-helpers 4.6.4 → 4.8.0

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.
Files changed (3) hide show
  1. package/grid.d.ts +40 -18
  2. package/grid.js +22 -1
  3. package/package.json +1 -1
package/grid.d.ts CHANGED
@@ -1,50 +1,67 @@
1
- export declare const toCssValue: (value: number | string) => string;
1
+ type StrNum = string | number;
2
+ export declare const toCssValue: (value: StrNum) => string;
2
3
  export declare const GridContainer: import("styled-components").StyledComponent<"div", any, {
3
4
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
4
5
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
5
- $gap?: string | number | undefined;
6
+ $bgColor?: string | undefined;
7
+ $border?: string | undefined;
8
+ $borderRadius?: StrNum | undefined;
9
+ $boxShadow?: string | undefined;
10
+ $gap?: StrNum | undefined;
6
11
  $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
7
12
  $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
8
13
  $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
9
- $margin?: string | number | undefined;
10
- $padding?: string | number | undefined;
14
+ $margin?: StrNum | undefined;
15
+ $padding?: StrNum | undefined;
11
16
  $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
12
17
  }, never>;
13
18
  export declare const Columns: import("styled-components").StyledComponent<"div", any, {
14
19
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
15
20
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
16
- $gap?: string | number | undefined;
21
+ $bgColor?: string | undefined;
22
+ $border?: string | undefined;
23
+ $borderRadius?: StrNum | undefined;
24
+ $boxShadow?: string | undefined;
25
+ $gap?: StrNum | undefined;
17
26
  $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
18
27
  $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
19
28
  $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
20
- $margin?: string | number | undefined;
21
- $padding?: string | number | undefined;
29
+ $margin?: StrNum | undefined;
30
+ $padding?: StrNum | undefined;
22
31
  $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
23
32
  } & {
24
- $sizes: number | string;
33
+ $sizes: StrNum;
25
34
  }, never>;
26
35
  export declare const Rows: import("styled-components").StyledComponent<"div", any, {
27
36
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
28
37
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
29
- $gap?: string | number | undefined;
38
+ $bgColor?: string | undefined;
39
+ $border?: string | undefined;
40
+ $borderRadius?: StrNum | undefined;
41
+ $boxShadow?: string | undefined;
42
+ $gap?: StrNum | undefined;
30
43
  $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
31
44
  $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
32
45
  $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
33
- $margin?: string | number | undefined;
34
- $padding?: string | number | undefined;
46
+ $margin?: StrNum | undefined;
47
+ $padding?: StrNum | undefined;
35
48
  $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
36
49
  } & {
37
- $sizes: number | string;
50
+ $sizes: StrNum;
38
51
  }, never>;
39
52
  export declare const Horizontal: import("styled-components").StyledComponent<"div", any, {
40
53
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
41
54
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
42
- $gap?: string | number | undefined;
55
+ $bgColor?: string | undefined;
56
+ $border?: string | undefined;
57
+ $borderRadius?: StrNum | undefined;
58
+ $boxShadow?: string | undefined;
59
+ $gap?: StrNum | undefined;
43
60
  $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
44
61
  $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
45
62
  $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
46
- $margin?: string | number | undefined;
47
- $padding?: string | number | undefined;
63
+ $margin?: StrNum | undefined;
64
+ $padding?: StrNum | undefined;
48
65
  $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
49
66
  } & {
50
67
  $gridAutoFlow: string;
@@ -52,13 +69,18 @@ export declare const Horizontal: import("styled-components").StyledComponent<"di
52
69
  export declare const Vertical: import("styled-components").StyledComponent<"div", any, {
53
70
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
54
71
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
55
- $gap?: string | number | undefined;
72
+ $bgColor?: string | undefined;
73
+ $border?: string | undefined;
74
+ $borderRadius?: StrNum | undefined;
75
+ $boxShadow?: string | undefined;
76
+ $gap?: StrNum | undefined;
56
77
  $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
57
78
  $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
58
79
  $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
59
- $margin?: string | number | undefined;
60
- $padding?: string | number | undefined;
80
+ $margin?: StrNum | undefined;
81
+ $padding?: StrNum | undefined;
61
82
  $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
62
83
  } & {
63
84
  $gridAutoFlow: string;
64
85
  }, "$gridAutoFlow">;
86
+ export {};
package/grid.js CHANGED
@@ -8,10 +8,31 @@ const createCssDeclaration = (property, value, valueConvert) => {
8
8
  }
9
9
  return undefined;
10
10
  };
11
+ function createCssBoxDeclaration(property, value, valueConvert) {
12
+ if (typeof value === 'object') {
13
+ const declarations = [];
14
+ const {
15
+ horizontal,
16
+ vertical,
17
+ ...rest
18
+ } = value;
19
+ if (horizontal) {
20
+ declarations.push(createCssDeclaration(`${property}-left`, horizontal, valueConvert), createCssDeclaration(`${property}-right`, horizontal, valueConvert));
21
+ }
22
+ if (vertical) {
23
+ declarations.push(createCssDeclaration(`${property}-top`, vertical, valueConvert), createCssDeclaration(`${property}-bottom`, vertical, valueConvert));
24
+ }
25
+ Object.entries(rest).forEach(([key, keyValue]) => {
26
+ declarations.push(createCssDeclaration(`${property}-${key}`, keyValue, valueConvert));
27
+ });
28
+ return declarations.join('');
29
+ }
30
+ return createCssDeclaration(property, value, valueConvert);
31
+ }
11
32
  export const GridContainer = styled.div.withConfig({
12
33
  displayName: "GridContainer",
13
34
  componentId: "sc-1mpmh7u-0"
14
- })(["display:grid;", " ", " ", " ", " ", " ", " ", " ", " ", ""], props => createCssDeclaration('align-content', props.$alignContent), props => createCssDeclaration('align-items', props.$alignItems), props => createCssDeclaration('gap', props.$gap, toCssValue), props => createCssDeclaration('grid-auto-flow', props.$gridAutoFlow), props => createCssDeclaration('justify-content', props.$justifyContent), props => createCssDeclaration('justify-items', props.$justifyItems), props => createCssDeclaration('margin', props.$margin, toCssValue), props => createCssDeclaration('padding', props.$padding, toCssValue), props => createCssDeclaration('place-items', props.$placeItems));
35
+ })(["display:grid;", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ""], props => createCssDeclaration('align-content', props.$alignContent), props => createCssDeclaration('align-items', props.$alignItems), props => createCssDeclaration('background-color', props.$bgColor), props => createCssBoxDeclaration('border', props.$border), props => createCssDeclaration('border-radius', props.$borderRadius, toCssValue), props => createCssDeclaration('box-shadow', props.$boxShadow), props => createCssDeclaration('gap', props.$gap, toCssValue), props => createCssDeclaration('grid-auto-flow', props.$gridAutoFlow), props => createCssDeclaration('justify-content', props.$justifyContent), props => createCssDeclaration('justify-items', props.$justifyItems), props => createCssBoxDeclaration('margin', props.$margin, toCssValue), props => createCssBoxDeclaration('padding', props.$padding, toCssValue), props => createCssDeclaration('place-items', props.$placeItems));
15
36
  export const Columns = styled(GridContainer).withConfig({
16
37
  displayName: "Columns",
17
38
  componentId: "sc-1mpmh7u-1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-helpers",
3
- "version": "4.6.4",
3
+ "version": "4.8.0",
4
4
  "description": "React component for build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",