@sb1/ffe-grid-react 15.1.0 → 16.0.1
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/es/GridCol.js +4 -8
- package/es/GridRow.js +5 -8
- package/lib/GridCol.js +4 -8
- package/lib/GridRow.js +5 -8
- package/package.json +4 -4
- package/types/GridCol.d.ts +9 -5
- package/types/GridRow.d.ts +9 -5
- package/types/types.d.ts +1 -2
package/es/GridCol.js
CHANGED
|
@@ -41,14 +41,11 @@ var centerTextClass = function (centerText) {
|
|
|
41
41
|
var centerClass = function (center) {
|
|
42
42
|
return center ? 'ffe-grid__col--center' : null;
|
|
43
43
|
};
|
|
44
|
-
var backgroundClass = function (
|
|
45
|
-
return
|
|
46
|
-
};
|
|
47
|
-
var backgroundDarkClass = function (backgroundDark) {
|
|
48
|
-
return backgroundDark ? "ffe-grid__col--bg-dark-".concat(backgroundDark) : null;
|
|
44
|
+
var backgroundClass = function (bgColor) {
|
|
45
|
+
return bgColor ? "ffe-grid__col--bg-".concat(bgColor) : null;
|
|
49
46
|
};
|
|
50
47
|
export var GridCol = function (_a) {
|
|
51
|
-
var
|
|
48
|
+
var bgColor = _a.bgColor, className = _a.className, _b = _a.as, Comp = _b === void 0 ? 'div' : _b, centerText = _a.centerText, center = _a.center, children = _a.children, sm = _a.sm, md = _a.md, lg = _a.lg, rest = __rest(_a, ["bgColor", "className", "as", "centerText", "center", "children", "sm", "md", "lg"]);
|
|
52
49
|
return (React.createElement(Comp, __assign({ className: [
|
|
53
50
|
'ffe-grid__col',
|
|
54
51
|
className,
|
|
@@ -57,8 +54,7 @@ export var GridCol = function (_a) {
|
|
|
57
54
|
sizeClasses('sm', !sm && !lg && !md ? 12 : sm),
|
|
58
55
|
centerTextClass(centerText),
|
|
59
56
|
centerClass(center),
|
|
60
|
-
backgroundClass(
|
|
61
|
-
backgroundDarkClass(backgroundDark),
|
|
57
|
+
backgroundClass(bgColor),
|
|
62
58
|
]
|
|
63
59
|
.filter(function (x) { return x; })
|
|
64
60
|
.join(' ') }, rest), children));
|
package/es/GridRow.js
CHANGED
|
@@ -36,12 +36,9 @@ var sizeClasses = function (size, def) {
|
|
|
36
36
|
_a));
|
|
37
37
|
};
|
|
38
38
|
export var GridRow = function (_a) {
|
|
39
|
-
var _b, _c, _d
|
|
40
|
-
var
|
|
41
|
-
var hasBackgroundColor = !!
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
return (React.createElement(Comp, __assign({ className: classNames(className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', sm), 'ffe-grid__row', (_b = {}, _b["ffe-grid__row--bg-".concat(background)] = hasBackgroundColor, _b), (_c = {},
|
|
45
|
-
_c["ffe-grid__row--bg-dark-".concat(backgroundDark)] = hasBackgroundDarkColor,
|
|
46
|
-
_c), (_d = {}, _d["ffe-grid__row--padding-".concat(padding)] = padding, _d), (_e = {}, _e["ffe-grid__row--margin-".concat(margin)] = margin, _e)) }, rest), content));
|
|
39
|
+
var _b, _c, _d;
|
|
40
|
+
var bgColor = _a.bgColor, className = _a.className, children = _a.children, _e = _a.as, Comp = _e === void 0 ? 'div' : _e, sm = _a.sm, md = _a.md, lg = _a.lg, padding = _a.padding, margin = _a.margin, rest = __rest(_a, ["bgColor", "className", "children", "as", "sm", "md", "lg", "padding", "margin"]);
|
|
41
|
+
var hasBackgroundColor = !!bgColor;
|
|
42
|
+
var content = hasBackgroundColor ? (React.createElement("div", { className: "ffe-grid__row-wrapper" }, children)) : (children);
|
|
43
|
+
return (React.createElement(Comp, __assign({ className: classNames(className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', sm), 'ffe-grid__row', (_b = {}, _b["ffe-grid__row--bg-".concat(bgColor)] = hasBackgroundColor, _b), (_c = {}, _c["ffe-grid__row--padding-".concat(padding)] = padding, _c), (_d = {}, _d["ffe-grid__row--margin-".concat(margin)] = margin, _d)) }, rest), content));
|
|
47
44
|
};
|
package/lib/GridCol.js
CHANGED
|
@@ -47,14 +47,11 @@ var centerTextClass = function (centerText) {
|
|
|
47
47
|
var centerClass = function (center) {
|
|
48
48
|
return center ? 'ffe-grid__col--center' : null;
|
|
49
49
|
};
|
|
50
|
-
var backgroundClass = function (
|
|
51
|
-
return
|
|
52
|
-
};
|
|
53
|
-
var backgroundDarkClass = function (backgroundDark) {
|
|
54
|
-
return backgroundDark ? "ffe-grid__col--bg-dark-".concat(backgroundDark) : null;
|
|
50
|
+
var backgroundClass = function (bgColor) {
|
|
51
|
+
return bgColor ? "ffe-grid__col--bg-".concat(bgColor) : null;
|
|
55
52
|
};
|
|
56
53
|
var GridCol = function (_a) {
|
|
57
|
-
var
|
|
54
|
+
var bgColor = _a.bgColor, className = _a.className, _b = _a.as, Comp = _b === void 0 ? 'div' : _b, centerText = _a.centerText, center = _a.center, children = _a.children, sm = _a.sm, md = _a.md, lg = _a.lg, rest = __rest(_a, ["bgColor", "className", "as", "centerText", "center", "children", "sm", "md", "lg"]);
|
|
58
55
|
return (react_1.default.createElement(Comp, __assign({ className: [
|
|
59
56
|
'ffe-grid__col',
|
|
60
57
|
className,
|
|
@@ -63,8 +60,7 @@ var GridCol = function (_a) {
|
|
|
63
60
|
sizeClasses('sm', !sm && !lg && !md ? 12 : sm),
|
|
64
61
|
centerTextClass(centerText),
|
|
65
62
|
centerClass(center),
|
|
66
|
-
backgroundClass(
|
|
67
|
-
backgroundDarkClass(backgroundDark),
|
|
63
|
+
backgroundClass(bgColor),
|
|
68
64
|
]
|
|
69
65
|
.filter(function (x) { return x; })
|
|
70
66
|
.join(' ') }, rest), children));
|
package/lib/GridRow.js
CHANGED
|
@@ -42,13 +42,10 @@ var sizeClasses = function (size, def) {
|
|
|
42
42
|
_a));
|
|
43
43
|
};
|
|
44
44
|
var GridRow = function (_a) {
|
|
45
|
-
var _b, _c, _d
|
|
46
|
-
var
|
|
47
|
-
var hasBackgroundColor = !!
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
return (react_1.default.createElement(Comp, __assign({ className: (0, classnames_1.default)(className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', sm), 'ffe-grid__row', (_b = {}, _b["ffe-grid__row--bg-".concat(background)] = hasBackgroundColor, _b), (_c = {},
|
|
51
|
-
_c["ffe-grid__row--bg-dark-".concat(backgroundDark)] = hasBackgroundDarkColor,
|
|
52
|
-
_c), (_d = {}, _d["ffe-grid__row--padding-".concat(padding)] = padding, _d), (_e = {}, _e["ffe-grid__row--margin-".concat(margin)] = margin, _e)) }, rest), content));
|
|
45
|
+
var _b, _c, _d;
|
|
46
|
+
var bgColor = _a.bgColor, className = _a.className, children = _a.children, _e = _a.as, Comp = _e === void 0 ? 'div' : _e, sm = _a.sm, md = _a.md, lg = _a.lg, padding = _a.padding, margin = _a.margin, rest = __rest(_a, ["bgColor", "className", "children", "as", "sm", "md", "lg", "padding", "margin"]);
|
|
47
|
+
var hasBackgroundColor = !!bgColor;
|
|
48
|
+
var content = hasBackgroundColor ? (react_1.default.createElement("div", { className: "ffe-grid__row-wrapper" }, children)) : (children);
|
|
49
|
+
return (react_1.default.createElement(Comp, __assign({ className: (0, classnames_1.default)(className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', sm), 'ffe-grid__row', (_b = {}, _b["ffe-grid__row--bg-".concat(bgColor)] = hasBackgroundColor, _b), (_c = {}, _c["ffe-grid__row--padding-".concat(padding)] = padding, _c), (_d = {}, _d["ffe-grid__row--margin-".concat(margin)] = margin, _d)) }, rest), content));
|
|
53
50
|
};
|
|
54
51
|
exports.GridRow = GridRow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-grid-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank1",
|
|
6
6
|
"files": [
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"test:watch": "ffe-buildtool jest --watch"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sb1/ffe-grid": "^
|
|
28
|
+
"@sb1/ffe-grid": "^16.0.1",
|
|
29
29
|
"classnames": "^2.3.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@sb1/ffe-buildtool": "^0.
|
|
32
|
+
"@sb1/ffe-buildtool": "^0.10.0",
|
|
33
33
|
"react": "^18.2.0",
|
|
34
34
|
"react-dom": "^18.2.0"
|
|
35
35
|
},
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "abedc811686859a152f05182aeece4ac8667949a"
|
|
43
43
|
}
|
package/types/GridCol.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React, { ElementType } from 'react';
|
|
2
|
-
import { BackgroundColor,
|
|
2
|
+
import { BackgroundColor, ComponentWithoutRefAsPropParams, SizeModifier } from './types';
|
|
3
3
|
export type GridColProps<As extends ElementType = any> = ComponentWithoutRefAsPropParams<As> & {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Supported background colors
|
|
6
|
+
*
|
|
7
|
+
* Property has new values that work with dark and accent mode as part of the Semantic Color update
|
|
8
|
+
* Possible values: `primary` `secondary` `tertiary`
|
|
9
|
+
* [Read more in the upgrade guide](https://sparebank1.github.io/designsystem/?path=/docs/introduksjon-changelog--docs#2025---februar---semantiske-farger)
|
|
10
|
+
*/
|
|
11
|
+
bgColor?: BackgroundColor;
|
|
8
12
|
/** Center text content horizontally */
|
|
9
13
|
centerText?: boolean;
|
|
10
14
|
/** Center content vertically */
|
package/types/GridRow.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ElementType } from 'react';
|
|
2
|
-
import { ComponentWithoutRefAsPropParams, BackgroundColor,
|
|
2
|
+
import { ComponentWithoutRefAsPropParams, BackgroundColor, Margin, Padding } from './types';
|
|
3
3
|
interface GridRowSize {
|
|
4
4
|
margin?: Margin;
|
|
5
5
|
padding?: Padding;
|
|
@@ -10,10 +10,14 @@ export type GridRowProps<As extends ElementType = any> = ComponentWithoutRefAsPr
|
|
|
10
10
|
padding?: Padding;
|
|
11
11
|
/** Margin in the top and bottom of the row */
|
|
12
12
|
margin?: Margin;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Supported background colors
|
|
15
|
+
*
|
|
16
|
+
* Property has new values that work with dark and accent mode as part of the Semantic Color update
|
|
17
|
+
* Possible values: `primary` `secondary` `tertiary`
|
|
18
|
+
* [Read more in the upgrade guide](https://sparebank1.github.io/designsystem/?path=/docs/introduksjon-changelog--docs#2025---februar---semantiske-farger)
|
|
19
|
+
*/
|
|
20
|
+
bgColor?: BackgroundColor;
|
|
17
21
|
/** Size modifiers for small screen sizes */
|
|
18
22
|
sm?: SizeModifier;
|
|
19
23
|
/** Size modifiers for medium screen sizes */
|
package/types/types.d.ts
CHANGED
|
@@ -7,8 +7,7 @@ export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
|
7
7
|
export type Margin = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
|
|
8
8
|
export type Padding = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl';
|
|
9
9
|
export type Gap = 'none' | '2xs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
10
|
-
export type BackgroundColor = '
|
|
11
|
-
export type BackgroundColorDark = 'svart' | 'natt' | 'koksgraa';
|
|
10
|
+
export type BackgroundColor = 'primary' | 'secondary' | 'tertiary';
|
|
12
11
|
type ColumnsRange = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
|
|
13
12
|
interface GridColSize {
|
|
14
13
|
cols: ColumnsRange;
|