@sb1/ffe-grid-react 13.0.8 → 13.2.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.
- package/es/GridCol.js +23 -28
- package/es/GridRow.js +9 -5
- package/es/background-colors.js +2 -1
- package/lib/GridCol.js +24 -29
- package/lib/GridRow.js +10 -8
- package/lib/background-colors.js +3 -2
- package/package.json +3 -3
- package/types/index.d.ts +4 -0
package/es/GridCol.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["background", "backgroundDark", "className", "element", "centerText", "center", "children", "sm", "md", "lg"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -19,33 +19,24 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
19
19
|
import React, { Component, createRef } from 'react';
|
|
20
20
|
import { bool, node, number, oneOf, oneOfType, shape, string } from 'prop-types';
|
|
21
21
|
import classNames from 'classnames';
|
|
22
|
-
import backgroundColors,
|
|
23
|
-
function camelCaseToDashCase(str) {
|
|
24
|
-
return str.split('').reduce(function (previous, current) {
|
|
25
|
-
return /[A-Z]/.test(current) ? "".concat(previous, "-").concat(current.toLowerCase()) : "".concat(previous).concat(current);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
var MODIFIER_LIST = ['background', 'centerText', 'center'];
|
|
22
|
+
import { backgroundColors, backgroundDarkColors, removedColors } from './background-colors';
|
|
29
23
|
var sizeClasses = function sizeClasses(size, def) {
|
|
30
|
-
var _classNames;
|
|
31
24
|
switch (_typeof(def)) {
|
|
32
25
|
case 'undefined':
|
|
33
26
|
return '';
|
|
34
27
|
case 'object':
|
|
35
|
-
return classNames((
|
|
28
|
+
return classNames(_defineProperty(_defineProperty({}, "ffe-grid__col--".concat(size, "-").concat(def.cols), def.cols || def.cols === 0), "ffe-grid__col--".concat(size, "-offset-").concat(def.offset), def.offset || def.offset === 0));
|
|
36
29
|
default:
|
|
37
30
|
return "ffe-grid__col--".concat(size, "-").concat(def);
|
|
38
31
|
}
|
|
39
32
|
};
|
|
40
|
-
var
|
|
41
|
-
return
|
|
42
|
-
return MODIFIER_LIST.indexOf(key) !== -1 && !!props[key];
|
|
43
|
-
}).map(function (key) {
|
|
44
|
-
return "ffe-grid__col--".concat(camelCaseToDashCase(key));
|
|
45
|
-
}).join(' ');
|
|
33
|
+
var centerTextClass = function centerTextClass(centerText) {
|
|
34
|
+
return centerText ? 'ffe-grid__col--center-text' : null;
|
|
46
35
|
};
|
|
47
|
-
var
|
|
48
|
-
|
|
36
|
+
var centerClass = function centerClass(center) {
|
|
37
|
+
return center ? 'ffe-grid__col--center' : null;
|
|
38
|
+
};
|
|
39
|
+
var backgroundClass = function backgroundClass(background) {
|
|
49
40
|
if (!background) {
|
|
50
41
|
return null;
|
|
51
42
|
}
|
|
@@ -54,6 +45,9 @@ var backgroundClass = function backgroundClass(_ref) {
|
|
|
54
45
|
}
|
|
55
46
|
return backgroundColors.includes(background) ? "ffe-grid__col--bg-".concat(background) : null;
|
|
56
47
|
};
|
|
48
|
+
var backgroundDarkClass = function backgroundDarkClass(backgroundDark) {
|
|
49
|
+
return backgroundDarkColors.includes(backgroundDark) ? "ffe-grid__col--bg-dark-".concat(backgroundDark) : null;
|
|
50
|
+
};
|
|
57
51
|
var GridCol = /*#__PURE__*/function (_Component) {
|
|
58
52
|
_inherits(GridCol, _Component);
|
|
59
53
|
var _super = _createSuper(GridCol);
|
|
@@ -68,19 +62,18 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
68
62
|
key: "render",
|
|
69
63
|
value: function render() {
|
|
70
64
|
var _this$props = this.props,
|
|
71
|
-
|
|
65
|
+
background = _this$props.background,
|
|
66
|
+
backgroundDark = _this$props.backgroundDark,
|
|
72
67
|
className = _this$props.className,
|
|
73
68
|
Element = _this$props.element,
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
centerText = _this$props.centerText,
|
|
70
|
+
center = _this$props.center,
|
|
71
|
+
children = _this$props.children,
|
|
76
72
|
sm = _this$props.sm,
|
|
73
|
+
md = _this$props.md,
|
|
74
|
+
lg = _this$props.lg,
|
|
77
75
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
78
|
-
|
|
79
|
-
if (MODIFIER_LIST.includes(key)) {
|
|
80
|
-
delete rest[key];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
var classes = ['ffe-grid__col', className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), modifiers(this.props), backgroundClass(this.props)].filter(function (x) {
|
|
76
|
+
var classes = ['ffe-grid__col', className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), centerTextClass(centerText), centerClass(center), backgroundClass(background), backgroundDarkClass(backgroundDark)].filter(function (x) {
|
|
84
77
|
return x;
|
|
85
78
|
}).join(' ');
|
|
86
79
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
@@ -97,7 +90,9 @@ GridCol.defaultProps = {
|
|
|
97
90
|
};
|
|
98
91
|
GridCol.propTypes = {
|
|
99
92
|
/** Supported background colors */
|
|
100
|
-
background: oneOf(
|
|
93
|
+
background: oneOf(backgroundColors),
|
|
94
|
+
/** Supported dark background colors */
|
|
95
|
+
backgroundDark: oneOf(backgroundDarkColors),
|
|
101
96
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__col classes */
|
|
102
97
|
className: string,
|
|
103
98
|
/** Specify the DOM element being used to create the GridCol */
|
package/es/GridRow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["background", "className", "children", "element", "padding", "margin"];
|
|
2
|
+
var _excluded = ["background", "backgroundDark", "className", "children", "element", "padding", "margin"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
@@ -9,9 +9,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { node, oneOf, string } from 'prop-types';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
|
-
import backgroundColors,
|
|
12
|
+
import { backgroundColors, backgroundDarkColors, removedColors } from './background-colors';
|
|
13
13
|
export default function GridRow(_ref) {
|
|
14
14
|
var background = _ref.background,
|
|
15
|
+
backgroundDark = _ref.backgroundDark,
|
|
15
16
|
className = _ref.className,
|
|
16
17
|
children = _ref.children,
|
|
17
18
|
element = _ref.element,
|
|
@@ -19,8 +20,9 @@ export default function GridRow(_ref) {
|
|
|
19
20
|
margin = _ref.margin,
|
|
20
21
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
22
|
var hasBackgroundColor = backgroundColors.includes(background);
|
|
23
|
+
var hasBackgroundDarkColor = backgroundDarkColors.includes(backgroundDark);
|
|
22
24
|
var hasRemovedColor = removedColors.includes(background);
|
|
23
|
-
var content = hasBackgroundColor ? /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
var content = hasBackgroundColor || hasBackgroundDarkColor ? /*#__PURE__*/React.createElement("div", {
|
|
24
26
|
className: "ffe-grid__row-wrapper"
|
|
25
27
|
}, children) : children;
|
|
26
28
|
if (hasRemovedColor) {
|
|
@@ -28,12 +30,14 @@ export default function GridRow(_ref) {
|
|
|
28
30
|
}
|
|
29
31
|
var Element = element || 'div';
|
|
30
32
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
31
|
-
className: classNames(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), _defineProperty({}, "ffe-grid__row--padding-".concat(padding), padding), _defineProperty({}, "ffe-grid__row--margin-".concat(margin), margin))
|
|
33
|
+
className: classNames(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), _defineProperty({}, "ffe-grid__row--bg-dark-".concat(backgroundDark), hasBackgroundDarkColor), _defineProperty({}, "ffe-grid__row--padding-".concat(padding), padding), _defineProperty({}, "ffe-grid__row--margin-".concat(margin), margin))
|
|
32
34
|
}, rest), content);
|
|
33
35
|
}
|
|
34
36
|
GridRow.propTypes = {
|
|
35
37
|
/** Supported background colors */
|
|
36
|
-
background: oneOf(
|
|
38
|
+
background: oneOf(backgroundColors),
|
|
39
|
+
/** Supported dark background colors */
|
|
40
|
+
backgroundDark: oneOf(backgroundDarkColors),
|
|
37
41
|
/** Padding in the top and bottom of the row */
|
|
38
42
|
padding: oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
39
43
|
/** Margin in the top and bottom of the row */
|
package/es/background-colors.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var backgroundColors = ['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit'];
|
|
2
|
+
export var backgroundDarkColors = ['svart', 'natt', 'koksgraa'];
|
|
2
3
|
export var removedColors = ['blue-cobalt', 'blue-royal', 'purple-magenta', 'blue-ice', 'blue-pale', 'green-mint', 'grey-cloud', 'grey-warm', 'orange-salmon', 'red', 'blue-sky', 'white'];
|
package/lib/GridCol.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _backgroundColors =
|
|
11
|
-
var _excluded = ["
|
|
10
|
+
var _backgroundColors = require("./background-colors");
|
|
11
|
+
var _excluded = ["background", "backgroundDark", "className", "element", "centerText", "center", "children", "sm", "md", "lg"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -29,39 +29,33 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
29
29
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
30
30
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
31
31
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
32
|
-
function camelCaseToDashCase(str) {
|
|
33
|
-
return str.split('').reduce(function (previous, current) {
|
|
34
|
-
return /[A-Z]/.test(current) ? "".concat(previous, "-").concat(current.toLowerCase()) : "".concat(previous).concat(current);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
var MODIFIER_LIST = ['background', 'centerText', 'center'];
|
|
38
32
|
var sizeClasses = function sizeClasses(size, def) {
|
|
39
|
-
var _classNames;
|
|
40
33
|
switch (_typeof(def)) {
|
|
41
34
|
case 'undefined':
|
|
42
35
|
return '';
|
|
43
36
|
case 'object':
|
|
44
|
-
return (0, _classnames.default)((
|
|
37
|
+
return (0, _classnames.default)(_defineProperty(_defineProperty({}, "ffe-grid__col--".concat(size, "-").concat(def.cols), def.cols || def.cols === 0), "ffe-grid__col--".concat(size, "-offset-").concat(def.offset), def.offset || def.offset === 0));
|
|
45
38
|
default:
|
|
46
39
|
return "ffe-grid__col--".concat(size, "-").concat(def);
|
|
47
40
|
}
|
|
48
41
|
};
|
|
49
|
-
var
|
|
50
|
-
return
|
|
51
|
-
return MODIFIER_LIST.indexOf(key) !== -1 && !!props[key];
|
|
52
|
-
}).map(function (key) {
|
|
53
|
-
return "ffe-grid__col--".concat(camelCaseToDashCase(key));
|
|
54
|
-
}).join(' ');
|
|
42
|
+
var centerTextClass = function centerTextClass(centerText) {
|
|
43
|
+
return centerText ? 'ffe-grid__col--center-text' : null;
|
|
55
44
|
};
|
|
56
|
-
var
|
|
57
|
-
|
|
45
|
+
var centerClass = function centerClass(center) {
|
|
46
|
+
return center ? 'ffe-grid__col--center' : null;
|
|
47
|
+
};
|
|
48
|
+
var backgroundClass = function backgroundClass(background) {
|
|
58
49
|
if (!background) {
|
|
59
50
|
return null;
|
|
60
51
|
}
|
|
61
52
|
if (_backgroundColors.removedColors.includes(background)) {
|
|
62
53
|
throw new Error("Support for the ".concat(background, " background on <GridCol> has been removed, please see the CHANGELOG"));
|
|
63
54
|
}
|
|
64
|
-
return _backgroundColors.
|
|
55
|
+
return _backgroundColors.backgroundColors.includes(background) ? "ffe-grid__col--bg-".concat(background) : null;
|
|
56
|
+
};
|
|
57
|
+
var backgroundDarkClass = function backgroundDarkClass(backgroundDark) {
|
|
58
|
+
return _backgroundColors.backgroundDarkColors.includes(backgroundDark) ? "ffe-grid__col--bg-dark-".concat(backgroundDark) : null;
|
|
65
59
|
};
|
|
66
60
|
var GridCol = exports.default = /*#__PURE__*/function (_Component) {
|
|
67
61
|
_inherits(GridCol, _Component);
|
|
@@ -77,19 +71,18 @@ var GridCol = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
77
71
|
key: "render",
|
|
78
72
|
value: function render() {
|
|
79
73
|
var _this$props = this.props,
|
|
80
|
-
|
|
74
|
+
background = _this$props.background,
|
|
75
|
+
backgroundDark = _this$props.backgroundDark,
|
|
81
76
|
className = _this$props.className,
|
|
82
77
|
Element = _this$props.element,
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
centerText = _this$props.centerText,
|
|
79
|
+
center = _this$props.center,
|
|
80
|
+
children = _this$props.children,
|
|
85
81
|
sm = _this$props.sm,
|
|
82
|
+
md = _this$props.md,
|
|
83
|
+
lg = _this$props.lg,
|
|
86
84
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
87
|
-
|
|
88
|
-
if (MODIFIER_LIST.includes(key)) {
|
|
89
|
-
delete rest[key];
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var classes = ['ffe-grid__col', className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), modifiers(this.props), backgroundClass(this.props)].filter(function (x) {
|
|
85
|
+
var classes = ['ffe-grid__col', className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), centerTextClass(centerText), centerClass(center), backgroundClass(background), backgroundDarkClass(backgroundDark)].filter(function (x) {
|
|
93
86
|
return x;
|
|
94
87
|
}).join(' ');
|
|
95
88
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
@@ -105,7 +98,9 @@ GridCol.defaultProps = {
|
|
|
105
98
|
};
|
|
106
99
|
GridCol.propTypes = {
|
|
107
100
|
/** Supported background colors */
|
|
108
|
-
background: (0, _propTypes.oneOf)(
|
|
101
|
+
background: (0, _propTypes.oneOf)(_backgroundColors.backgroundColors),
|
|
102
|
+
/** Supported dark background colors */
|
|
103
|
+
backgroundDark: (0, _propTypes.oneOf)(_backgroundColors.backgroundDarkColors),
|
|
109
104
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__col classes */
|
|
110
105
|
className: _propTypes.string,
|
|
111
106
|
/** Specify the DOM element being used to create the GridCol */
|
package/lib/GridRow.js
CHANGED
|
@@ -8,10 +8,8 @@ exports.default = GridRow;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _propTypes = require("prop-types");
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _backgroundColors =
|
|
12
|
-
var _excluded = ["background", "className", "children", "element", "padding", "margin"];
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
var _backgroundColors = require("./background-colors");
|
|
12
|
+
var _excluded = ["background", "backgroundDark", "className", "children", "element", "padding", "margin"];
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
15
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -21,15 +19,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
21
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
20
|
function GridRow(_ref) {
|
|
23
21
|
var background = _ref.background,
|
|
22
|
+
backgroundDark = _ref.backgroundDark,
|
|
24
23
|
className = _ref.className,
|
|
25
24
|
children = _ref.children,
|
|
26
25
|
element = _ref.element,
|
|
27
26
|
padding = _ref.padding,
|
|
28
27
|
margin = _ref.margin,
|
|
29
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
var hasBackgroundColor = _backgroundColors.
|
|
29
|
+
var hasBackgroundColor = _backgroundColors.backgroundColors.includes(background);
|
|
30
|
+
var hasBackgroundDarkColor = _backgroundColors.backgroundDarkColors.includes(backgroundDark);
|
|
31
31
|
var hasRemovedColor = _backgroundColors.removedColors.includes(background);
|
|
32
|
-
var content = hasBackgroundColor ? /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
var content = hasBackgroundColor || hasBackgroundDarkColor ? /*#__PURE__*/_react.default.createElement("div", {
|
|
33
33
|
className: "ffe-grid__row-wrapper"
|
|
34
34
|
}, children) : children;
|
|
35
35
|
if (hasRemovedColor) {
|
|
@@ -37,12 +37,14 @@ function GridRow(_ref) {
|
|
|
37
37
|
}
|
|
38
38
|
var Element = element || 'div';
|
|
39
39
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
40
|
-
className: (0, _classnames.default)(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), _defineProperty({}, "ffe-grid__row--padding-".concat(padding), padding), _defineProperty({}, "ffe-grid__row--margin-".concat(margin), margin))
|
|
40
|
+
className: (0, _classnames.default)(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), _defineProperty({}, "ffe-grid__row--bg-dark-".concat(backgroundDark), hasBackgroundDarkColor), _defineProperty({}, "ffe-grid__row--padding-".concat(padding), padding), _defineProperty({}, "ffe-grid__row--margin-".concat(margin), margin))
|
|
41
41
|
}, rest), content);
|
|
42
42
|
}
|
|
43
43
|
GridRow.propTypes = {
|
|
44
44
|
/** Supported background colors */
|
|
45
|
-
background: (0, _propTypes.oneOf)(
|
|
45
|
+
background: (0, _propTypes.oneOf)(_backgroundColors.backgroundColors),
|
|
46
|
+
/** Supported dark background colors */
|
|
47
|
+
backgroundDark: (0, _propTypes.oneOf)(_backgroundColors.backgroundDarkColors),
|
|
46
48
|
/** Padding in the top and bottom of the row */
|
|
47
49
|
padding: (0, _propTypes.oneOf)(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
48
50
|
/** Margin in the top and bottom of the row */
|
package/lib/background-colors.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.removedColors = exports.
|
|
7
|
-
var
|
|
6
|
+
exports.removedColors = exports.backgroundDarkColors = exports.backgroundColors = void 0;
|
|
7
|
+
var backgroundColors = exports.backgroundColors = ['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit'];
|
|
8
|
+
var backgroundDarkColors = exports.backgroundDarkColors = ['svart', 'natt', 'koksgraa'];
|
|
8
9
|
var removedColors = exports.removedColors = ['blue-cobalt', 'blue-royal', 'purple-magenta', 'blue-ice', 'blue-pale', 'green-mint', 'grey-cloud', 'grey-warm', 'orange-salmon', 'red', 'blue-sky', 'white'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-grid-react",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank1",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test:watch": "ffe-buildtool jest --watch"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@sb1/ffe-grid": "^14.0
|
|
27
|
+
"@sb1/ffe-grid": "^14.2.0",
|
|
28
28
|
"classnames": "^2.3.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "2fbed8952cbf28eb2fde5a97d00cf4e48a18f535"
|
|
42
42
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ type BackgroundColors =
|
|
|
21
21
|
| 'fjell'
|
|
22
22
|
| 'hvit';
|
|
23
23
|
|
|
24
|
+
type BackgroundDarkColors = 'svart' | 'natt' | 'koksgraa';
|
|
25
|
+
|
|
24
26
|
type Margin =
|
|
25
27
|
| '2xs'
|
|
26
28
|
| 'xs'
|
|
@@ -47,6 +49,7 @@ type Padding =
|
|
|
47
49
|
|
|
48
50
|
export interface GridRowProps extends React.ComponentProps<'div'> {
|
|
49
51
|
background?: BackgroundColors;
|
|
52
|
+
backgroundDark?: BackgroundDarkColors;
|
|
50
53
|
children: React.ReactNode;
|
|
51
54
|
className?: string;
|
|
52
55
|
element?: string;
|
|
@@ -63,6 +66,7 @@ export interface GridColSize {
|
|
|
63
66
|
|
|
64
67
|
export interface GridColProps extends React.ComponentProps<'div'> {
|
|
65
68
|
background?: BackgroundColors;
|
|
69
|
+
backgroundDark?: BackgroundDarkColors;
|
|
66
70
|
children?: React.ReactNode;
|
|
67
71
|
className?: string;
|
|
68
72
|
element?: React.ReactNode;
|