@sb1/ffe-grid-react 11.1.8 → 12.0.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/Grid.js +9 -18
- package/es/GridCol.js +3 -38
- package/es/GridRow.js +13 -27
- package/es/index.js +0 -1
- package/lib/Grid.js +8 -17
- package/lib/GridCol.js +3 -38
- package/lib/GridRow.js +12 -27
- package/lib/index.js +0 -8
- package/package.json +2 -2
- package/types/index.d.ts +29 -22
- package/es/InlineGrid.js +0 -33
- package/lib/InlineGrid.js +0 -46
package/es/Grid.js
CHANGED
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "
|
|
1
|
+
var _excluded = ["children", "className", "gap", "element"];
|
|
2
2
|
|
|
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
|
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
5
7
|
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; }
|
|
6
8
|
|
|
7
9
|
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; }
|
|
8
10
|
|
|
9
11
|
import React from 'react';
|
|
10
12
|
import classNames from 'classnames';
|
|
11
|
-
import {
|
|
13
|
+
import { node, string, oneOf } from 'prop-types';
|
|
12
14
|
export default function Grid(_ref) {
|
|
13
15
|
var children = _ref.children,
|
|
14
16
|
className = _ref.className,
|
|
15
|
-
|
|
17
|
+
gap = _ref.gap,
|
|
16
18
|
element = _ref.element,
|
|
17
|
-
topPadding = _ref.topPadding,
|
|
18
19
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
20
|
|
|
20
21
|
var Element = element || 'div';
|
|
21
22
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
22
|
-
className: classNames(className, 'ffe-grid', {
|
|
23
|
-
'ffe-grid--condensed': condensed
|
|
24
|
-
}, {
|
|
25
|
-
'ffe-grid--no-top-padding': !topPadding
|
|
26
|
-
})
|
|
23
|
+
className: classNames(className, 'ffe-grid', _defineProperty({}, "ffe-grid--gap-".concat(gap), gap))
|
|
27
24
|
}, rest), children);
|
|
28
25
|
}
|
|
29
|
-
Grid.defaultProps = {
|
|
30
|
-
topPadding: true
|
|
31
|
-
};
|
|
32
26
|
Grid.propTypes = {
|
|
33
27
|
/** Any children of a Grid must be a GridRow */
|
|
34
28
|
children: node,
|
|
@@ -36,12 +30,9 @@ Grid.propTypes = {
|
|
|
36
30
|
/** Any extra classes are attached to the root node, in addition to ffe-grid classes */
|
|
37
31
|
className: string,
|
|
38
32
|
|
|
39
|
-
/**
|
|
40
|
-
|
|
33
|
+
/** Specify the internal gutter of the grid */
|
|
34
|
+
gap: oneOf(['none', '2xs', 'xs', 'sm', 'md', 'lg']),
|
|
41
35
|
|
|
42
36
|
/** Specify the DOM element being used to create the Grid */
|
|
43
|
-
element: string
|
|
44
|
-
|
|
45
|
-
/** Add top padding */
|
|
46
|
-
topPadding: bool
|
|
37
|
+
element: string
|
|
47
38
|
};
|
package/es/GridCol.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["children", "className", "element", "lg", "md", "sm"];
|
|
2
2
|
|
|
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
|
|
|
@@ -41,7 +41,7 @@ function camelCaseToDashCase(str) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
var MODIFIER_LIST = ['
|
|
44
|
+
var MODIFIER_LIST = ['background', 'centerText'];
|
|
45
45
|
|
|
46
46
|
var sizeClasses = function sizeClasses(size, def) {
|
|
47
47
|
var _classNames;
|
|
@@ -99,7 +99,6 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
key: "render",
|
|
100
100
|
value: function render() {
|
|
101
101
|
var _this$props = this.props,
|
|
102
|
-
bottomPadding = _this$props.bottomPadding,
|
|
103
102
|
children = _this$props.children,
|
|
104
103
|
className = _this$props.className,
|
|
105
104
|
Element = _this$props.element,
|
|
@@ -113,7 +112,7 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
113
112
|
delete rest[key];
|
|
114
113
|
}
|
|
115
114
|
});
|
|
116
|
-
var classes = [className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), modifiers(this.props), backgroundClass(this.props)
|
|
115
|
+
var classes = [className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), modifiers(this.props), backgroundClass(this.props)].filter(function (x) {
|
|
117
116
|
return x;
|
|
118
117
|
}).join(' ');
|
|
119
118
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
@@ -128,7 +127,6 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
128
127
|
|
|
129
128
|
export { GridCol as default };
|
|
130
129
|
GridCol.defaultProps = {
|
|
131
|
-
bottomPadding: true,
|
|
132
130
|
element: 'div'
|
|
133
131
|
};
|
|
134
132
|
GridCol.propTypes = {
|
|
@@ -141,45 +139,12 @@ GridCol.propTypes = {
|
|
|
141
139
|
/** Specify the DOM element being used to create the GridCol */
|
|
142
140
|
element: node,
|
|
143
141
|
|
|
144
|
-
/** Distribute remaining space around the content elements */
|
|
145
|
-
around: bool,
|
|
146
|
-
|
|
147
|
-
/** Distribute remaining space between the content elements */
|
|
148
|
-
between: bool,
|
|
149
|
-
|
|
150
|
-
/** Place content elements at the bottom of the column */
|
|
151
|
-
bottom: bool,
|
|
152
|
-
|
|
153
|
-
/** Center content horizontally */
|
|
154
|
-
center: bool,
|
|
155
|
-
|
|
156
142
|
/** Center text content horizontally */
|
|
157
143
|
centerText: bool,
|
|
158
144
|
|
|
159
145
|
/** The content of the column */
|
|
160
146
|
children: node,
|
|
161
147
|
|
|
162
|
-
/** Place content elements to the right of the column */
|
|
163
|
-
end: bool,
|
|
164
|
-
|
|
165
|
-
/** Layout column content horizontally and flip flex direction */
|
|
166
|
-
horizontal: bool,
|
|
167
|
-
|
|
168
|
-
/** Center content vertically */
|
|
169
|
-
middle: bool,
|
|
170
|
-
|
|
171
|
-
/** Add bottom padding */
|
|
172
|
-
bottomPadding: bool,
|
|
173
|
-
|
|
174
|
-
/** Reverse layout direction */
|
|
175
|
-
reverse: bool,
|
|
176
|
-
|
|
177
|
-
/** Place content elements to the left of the column */
|
|
178
|
-
start: bool,
|
|
179
|
-
|
|
180
|
-
/** Place content elements at the top of the column */
|
|
181
|
-
top: bool,
|
|
182
|
-
|
|
183
148
|
/** Size modifiers for small screen sizes */
|
|
184
149
|
sm: oneOfType([
|
|
185
150
|
/** Number of columns, 0-12 */
|
package/es/GridRow.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["background", "className", "children", "element", "
|
|
1
|
+
var _excluded = ["background", "className", "children", "element", "padding", "margin"];
|
|
2
2
|
|
|
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
|
|
|
@@ -9,7 +9,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
9
9
|
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; }
|
|
10
10
|
|
|
11
11
|
import React from 'react';
|
|
12
|
-
import {
|
|
12
|
+
import { node, oneOf, string } from 'prop-types';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import backgroundColors, { removedColors } from './background-colors';
|
|
15
15
|
export default function GridRow(_ref) {
|
|
@@ -17,40 +17,32 @@ export default function GridRow(_ref) {
|
|
|
17
17
|
className = _ref.className,
|
|
18
18
|
children = _ref.children,
|
|
19
19
|
element = _ref.element,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
padding = _ref.padding,
|
|
21
|
+
margin = _ref.margin,
|
|
22
22
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
23
|
|
|
24
|
-
var content = children;
|
|
25
24
|
var hasBackgroundColor = backgroundColors.includes(background);
|
|
26
25
|
var hasRemovedColor = removedColors.includes(background);
|
|
27
26
|
|
|
28
|
-
if (hasBackgroundColor) {
|
|
29
|
-
content = /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className: "ffe-grid__row-wrapper"
|
|
31
|
-
}, children);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
if (hasRemovedColor) {
|
|
35
28
|
throw new Error("Support for the ".concat(background, " background on <GridRow> has been removed, please see the CHANGELOG"));
|
|
36
29
|
}
|
|
37
30
|
|
|
38
31
|
var Element = element || 'div';
|
|
39
32
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
40
|
-
className: classNames(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), {
|
|
41
|
-
|
|
42
|
-
}, {
|
|
43
|
-
'ffe-grid__row--top-padding': topPadding
|
|
44
|
-
})
|
|
45
|
-
}, rest), content);
|
|
33
|
+
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))
|
|
34
|
+
}, rest), children);
|
|
46
35
|
}
|
|
47
|
-
GridRow.defaultProps = {
|
|
48
|
-
topPadding: false
|
|
49
|
-
};
|
|
50
36
|
GridRow.propTypes = {
|
|
51
37
|
/** Supported background colors */
|
|
52
38
|
background: oneOf(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
|
|
53
39
|
|
|
40
|
+
/** Padding in the top and bottom of the row */
|
|
41
|
+
padding: oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
42
|
+
|
|
43
|
+
/** Margin in the top and bottom of the row */
|
|
44
|
+
margin: oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
45
|
+
|
|
54
46
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__row classes */
|
|
55
47
|
className: string,
|
|
56
48
|
|
|
@@ -58,11 +50,5 @@ GridRow.propTypes = {
|
|
|
58
50
|
children: node,
|
|
59
51
|
|
|
60
52
|
/** Specify the DOM element being used to create the GridRow */
|
|
61
|
-
element: string
|
|
62
|
-
|
|
63
|
-
/** If true, columns are reversed */
|
|
64
|
-
reverse: bool,
|
|
65
|
-
|
|
66
|
-
/** If true, row receives top padding. Useful for when you have background colored rows */
|
|
67
|
-
topPadding: bool
|
|
53
|
+
element: string
|
|
68
54
|
};
|
package/es/index.js
CHANGED
package/lib/Grid.js
CHANGED
|
@@ -11,12 +11,14 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = require("prop-types");
|
|
13
13
|
|
|
14
|
-
var _excluded = ["children", "className", "
|
|
14
|
+
var _excluded = ["children", "className", "gap", "element"];
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
18
|
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); }
|
|
19
19
|
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
|
|
20
22
|
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; }
|
|
21
23
|
|
|
22
24
|
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; }
|
|
@@ -24,24 +26,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
24
26
|
function Grid(_ref) {
|
|
25
27
|
var children = _ref.children,
|
|
26
28
|
className = _ref.className,
|
|
27
|
-
|
|
29
|
+
gap = _ref.gap,
|
|
28
30
|
element = _ref.element,
|
|
29
|
-
topPadding = _ref.topPadding,
|
|
30
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
32
|
|
|
32
33
|
var Element = element || 'div';
|
|
33
34
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
34
|
-
className: (0, _classnames.default)(className, 'ffe-grid', {
|
|
35
|
-
'ffe-grid--condensed': condensed
|
|
36
|
-
}, {
|
|
37
|
-
'ffe-grid--no-top-padding': !topPadding
|
|
38
|
-
})
|
|
35
|
+
className: (0, _classnames.default)(className, 'ffe-grid', _defineProperty({}, "ffe-grid--gap-".concat(gap), gap))
|
|
39
36
|
}, rest), children);
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
Grid.defaultProps = {
|
|
43
|
-
topPadding: true
|
|
44
|
-
};
|
|
45
39
|
Grid.propTypes = {
|
|
46
40
|
/** Any children of a Grid must be a GridRow */
|
|
47
41
|
children: _propTypes.node,
|
|
@@ -49,12 +43,9 @@ Grid.propTypes = {
|
|
|
49
43
|
/** Any extra classes are attached to the root node, in addition to ffe-grid classes */
|
|
50
44
|
className: _propTypes.string,
|
|
51
45
|
|
|
52
|
-
/**
|
|
53
|
-
|
|
46
|
+
/** Specify the internal gutter of the grid */
|
|
47
|
+
gap: (0, _propTypes.oneOf)(['none', '2xs', 'xs', 'sm', 'md', 'lg']),
|
|
54
48
|
|
|
55
49
|
/** Specify the DOM element being used to create the Grid */
|
|
56
|
-
element: _propTypes.string
|
|
57
|
-
|
|
58
|
-
/** Add top padding */
|
|
59
|
-
topPadding: _propTypes.bool
|
|
50
|
+
element: _propTypes.string
|
|
60
51
|
};
|
package/lib/GridCol.js
CHANGED
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _backgroundColors = _interopRequireWildcard(require("./background-colors"));
|
|
15
15
|
|
|
16
|
-
var _excluded = ["
|
|
16
|
+
var _excluded = ["children", "className", "element", "lg", "md", "sm"];
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
@@ -57,7 +57,7 @@ function camelCaseToDashCase(str) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
var MODIFIER_LIST = ['
|
|
60
|
+
var MODIFIER_LIST = ['background', 'centerText'];
|
|
61
61
|
|
|
62
62
|
var sizeClasses = function sizeClasses(size, def) {
|
|
63
63
|
var _classNames;
|
|
@@ -115,7 +115,6 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
115
115
|
key: "render",
|
|
116
116
|
value: function render() {
|
|
117
117
|
var _this$props = this.props,
|
|
118
|
-
bottomPadding = _this$props.bottomPadding,
|
|
119
118
|
children = _this$props.children,
|
|
120
119
|
className = _this$props.className,
|
|
121
120
|
Element = _this$props.element,
|
|
@@ -129,7 +128,7 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
129
128
|
delete rest[key];
|
|
130
129
|
}
|
|
131
130
|
});
|
|
132
|
-
var classes = [className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), modifiers(this.props), backgroundClass(this.props)
|
|
131
|
+
var classes = [className, sizeClasses('lg', lg), sizeClasses('md', md), sizeClasses('sm', !sm && !lg && !md ? 12 : sm), modifiers(this.props), backgroundClass(this.props)].filter(function (x) {
|
|
133
132
|
return x;
|
|
134
133
|
}).join(' ');
|
|
135
134
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
@@ -144,7 +143,6 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
144
143
|
|
|
145
144
|
exports.default = GridCol;
|
|
146
145
|
GridCol.defaultProps = {
|
|
147
|
-
bottomPadding: true,
|
|
148
146
|
element: 'div'
|
|
149
147
|
};
|
|
150
148
|
GridCol.propTypes = {
|
|
@@ -157,45 +155,12 @@ GridCol.propTypes = {
|
|
|
157
155
|
/** Specify the DOM element being used to create the GridCol */
|
|
158
156
|
element: _propTypes.node,
|
|
159
157
|
|
|
160
|
-
/** Distribute remaining space around the content elements */
|
|
161
|
-
around: _propTypes.bool,
|
|
162
|
-
|
|
163
|
-
/** Distribute remaining space between the content elements */
|
|
164
|
-
between: _propTypes.bool,
|
|
165
|
-
|
|
166
|
-
/** Place content elements at the bottom of the column */
|
|
167
|
-
bottom: _propTypes.bool,
|
|
168
|
-
|
|
169
|
-
/** Center content horizontally */
|
|
170
|
-
center: _propTypes.bool,
|
|
171
|
-
|
|
172
158
|
/** Center text content horizontally */
|
|
173
159
|
centerText: _propTypes.bool,
|
|
174
160
|
|
|
175
161
|
/** The content of the column */
|
|
176
162
|
children: _propTypes.node,
|
|
177
163
|
|
|
178
|
-
/** Place content elements to the right of the column */
|
|
179
|
-
end: _propTypes.bool,
|
|
180
|
-
|
|
181
|
-
/** Layout column content horizontally and flip flex direction */
|
|
182
|
-
horizontal: _propTypes.bool,
|
|
183
|
-
|
|
184
|
-
/** Center content vertically */
|
|
185
|
-
middle: _propTypes.bool,
|
|
186
|
-
|
|
187
|
-
/** Add bottom padding */
|
|
188
|
-
bottomPadding: _propTypes.bool,
|
|
189
|
-
|
|
190
|
-
/** Reverse layout direction */
|
|
191
|
-
reverse: _propTypes.bool,
|
|
192
|
-
|
|
193
|
-
/** Place content elements to the left of the column */
|
|
194
|
-
start: _propTypes.bool,
|
|
195
|
-
|
|
196
|
-
/** Place content elements at the top of the column */
|
|
197
|
-
top: _propTypes.bool,
|
|
198
|
-
|
|
199
164
|
/** Size modifiers for small screen sizes */
|
|
200
165
|
sm: (0, _propTypes.oneOfType)([
|
|
201
166
|
/** Number of columns, 0-12 */
|
package/lib/GridRow.js
CHANGED
|
@@ -15,7 +15,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
15
15
|
|
|
16
16
|
var _backgroundColors = _interopRequireWildcard(require("./background-colors"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["background", "className", "children", "element", "
|
|
18
|
+
var _excluded = ["background", "className", "children", "element", "padding", "margin"];
|
|
19
19
|
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
21
|
|
|
@@ -36,43 +36,34 @@ function GridRow(_ref) {
|
|
|
36
36
|
className = _ref.className,
|
|
37
37
|
children = _ref.children,
|
|
38
38
|
element = _ref.element,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
padding = _ref.padding,
|
|
40
|
+
margin = _ref.margin,
|
|
41
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
42
|
|
|
43
|
-
var content = children;
|
|
44
|
-
|
|
45
43
|
var hasBackgroundColor = _backgroundColors.default.includes(background);
|
|
46
44
|
|
|
47
45
|
var hasRemovedColor = _backgroundColors.removedColors.includes(background);
|
|
48
46
|
|
|
49
|
-
if (hasBackgroundColor) {
|
|
50
|
-
content = /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
-
className: "ffe-grid__row-wrapper"
|
|
52
|
-
}, children);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
47
|
if (hasRemovedColor) {
|
|
56
48
|
throw new Error("Support for the ".concat(background, " background on <GridRow> has been removed, please see the CHANGELOG"));
|
|
57
49
|
}
|
|
58
50
|
|
|
59
51
|
var Element = element || 'div';
|
|
60
52
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
61
|
-
className: (0, _classnames.default)(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), {
|
|
62
|
-
|
|
63
|
-
}, {
|
|
64
|
-
'ffe-grid__row--top-padding': topPadding
|
|
65
|
-
})
|
|
66
|
-
}, rest), content);
|
|
53
|
+
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))
|
|
54
|
+
}, rest), children);
|
|
67
55
|
}
|
|
68
56
|
|
|
69
|
-
GridRow.defaultProps = {
|
|
70
|
-
topPadding: false
|
|
71
|
-
};
|
|
72
57
|
GridRow.propTypes = {
|
|
73
58
|
/** Supported background colors */
|
|
74
59
|
background: (0, _propTypes.oneOf)(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
|
|
75
60
|
|
|
61
|
+
/** Padding in the top and bottom of the row */
|
|
62
|
+
padding: (0, _propTypes.oneOf)(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
63
|
+
|
|
64
|
+
/** Margin in the top and bottom of the row */
|
|
65
|
+
margin: (0, _propTypes.oneOf)(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
66
|
+
|
|
76
67
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__row classes */
|
|
77
68
|
className: _propTypes.string,
|
|
78
69
|
|
|
@@ -80,11 +71,5 @@ GridRow.propTypes = {
|
|
|
80
71
|
children: _propTypes.node,
|
|
81
72
|
|
|
82
73
|
/** Specify the DOM element being used to create the GridRow */
|
|
83
|
-
element: _propTypes.string
|
|
84
|
-
|
|
85
|
-
/** If true, columns are reversed */
|
|
86
|
-
reverse: _propTypes.bool,
|
|
87
|
-
|
|
88
|
-
/** If true, row receives top padding. Useful for when you have background colored rows */
|
|
89
|
-
topPadding: _propTypes.bool
|
|
74
|
+
element: _propTypes.string
|
|
90
75
|
};
|
package/lib/index.js
CHANGED
|
@@ -21,17 +21,9 @@ Object.defineProperty(exports, "GridRow", {
|
|
|
21
21
|
return _GridRow.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "InlineGrid", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _InlineGrid.default;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
24
|
|
|
31
25
|
var _Grid = _interopRequireDefault(require("./Grid"));
|
|
32
26
|
|
|
33
|
-
var _InlineGrid = _interopRequireDefault(require("./InlineGrid"));
|
|
34
|
-
|
|
35
27
|
var _GridRow = _interopRequireDefault(require("./GridRow"));
|
|
36
28
|
|
|
37
29
|
var _GridCol = _interopRequireDefault(require("./GridCol"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-grid-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank1",
|
|
6
6
|
"files": [
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "4e1226ba50e091c930cd6aa4bdc72b2f4c0f524f"
|
|
42
42
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
className?: string;
|
|
6
|
-
condensed?: boolean;
|
|
7
|
-
element?: string;
|
|
8
|
-
topPadding?: boolean;
|
|
9
|
-
}
|
|
3
|
+
type Gap = 'none' | '2xs' | 'xs' | 'md' | 'lg';
|
|
10
4
|
|
|
11
|
-
export interface
|
|
5
|
+
export interface GridProps extends React.HTMLAttributes<HTMLElement> {
|
|
12
6
|
children: React.ReactNode;
|
|
13
7
|
className?: string;
|
|
14
8
|
element?: string;
|
|
9
|
+
gap?: Gap;
|
|
15
10
|
}
|
|
16
11
|
|
|
17
12
|
type BackgroundColors =
|
|
@@ -26,13 +21,37 @@ type BackgroundColors =
|
|
|
26
21
|
| 'fjell'
|
|
27
22
|
| 'hvit';
|
|
28
23
|
|
|
24
|
+
type Margin =
|
|
25
|
+
| '2xs'
|
|
26
|
+
| 'xs'
|
|
27
|
+
| 'sm'
|
|
28
|
+
| 'md'
|
|
29
|
+
| 'lg'
|
|
30
|
+
| 'xl'
|
|
31
|
+
| '2xl'
|
|
32
|
+
| '3xl'
|
|
33
|
+
| '4xl'
|
|
34
|
+
| '5xl';
|
|
35
|
+
|
|
36
|
+
type Padding =
|
|
37
|
+
| '2xs'
|
|
38
|
+
| 'xs'
|
|
39
|
+
| 'sm'
|
|
40
|
+
| 'md'
|
|
41
|
+
| 'lg'
|
|
42
|
+
| 'xl'
|
|
43
|
+
| '2xl'
|
|
44
|
+
| '3xl'
|
|
45
|
+
| '4xl'
|
|
46
|
+
| '5xl';
|
|
47
|
+
|
|
29
48
|
export interface GridRowProps extends React.HTMLAttributes<HTMLElement> {
|
|
30
49
|
background?: BackgroundColors;
|
|
31
50
|
children: React.ReactNode;
|
|
32
51
|
className?: string;
|
|
33
52
|
element?: string;
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
padding?: Padding;
|
|
54
|
+
margin?: Margin;
|
|
36
55
|
}
|
|
37
56
|
|
|
38
57
|
type ColumnsRange = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
@@ -47,24 +66,12 @@ export interface GridColProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
47
66
|
children?: React.ReactNode;
|
|
48
67
|
className?: string;
|
|
49
68
|
element?: React.ReactNode;
|
|
50
|
-
around?: boolean;
|
|
51
|
-
between?: boolean;
|
|
52
|
-
bottom?: boolean;
|
|
53
|
-
center?: boolean;
|
|
54
69
|
centerText?: boolean;
|
|
55
|
-
end?: boolean;
|
|
56
|
-
horizontal?: boolean;
|
|
57
|
-
middle?: boolean;
|
|
58
|
-
bottomPadding?: boolean;
|
|
59
|
-
reverse?: boolean;
|
|
60
|
-
start?: boolean;
|
|
61
|
-
top?: boolean;
|
|
62
70
|
sm?: ColumnsRange | string | GridColSize;
|
|
63
71
|
md?: ColumnsRange | string | GridColSize;
|
|
64
72
|
lg?: ColumnsRange | string | GridColSize;
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
declare class Grid extends React.Component<GridProps, any> {}
|
|
68
|
-
declare class InlineGrid extends React.Component<InlineGridProps, any> {}
|
|
69
76
|
declare class GridRow extends React.Component<GridRowProps, any> {}
|
|
70
77
|
declare class GridCol extends React.Component<GridColProps, any> {}
|
package/es/InlineGrid.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var _excluded = ["className", "element"];
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import classNames from 'classnames';
|
|
11
|
-
import { node, string } from 'prop-types';
|
|
12
|
-
export default function InlineGrid(_ref) {
|
|
13
|
-
var className = _ref.className,
|
|
14
|
-
Element = _ref.element,
|
|
15
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
|
|
17
|
-
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
18
|
-
className: classNames(className, 'ffe-grid', 'ffe-grid--inline')
|
|
19
|
-
}, rest));
|
|
20
|
-
}
|
|
21
|
-
InlineGrid.propTypes = {
|
|
22
|
-
/** Any children of a InlineGrid must be a GridRow */
|
|
23
|
-
children: node,
|
|
24
|
-
|
|
25
|
-
/** Any extra classes are attached to the root node, in addition to ffe-grid classes */
|
|
26
|
-
className: string,
|
|
27
|
-
|
|
28
|
-
/** Specify the DOM element being used to create the Grid */
|
|
29
|
-
element: string
|
|
30
|
-
};
|
|
31
|
-
InlineGrid.defaultProps = {
|
|
32
|
-
element: 'div'
|
|
33
|
-
};
|
package/lib/InlineGrid.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = InlineGrid;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = require("prop-types");
|
|
13
|
-
|
|
14
|
-
var _excluded = ["className", "element"];
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
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); }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function InlineGrid(_ref) {
|
|
25
|
-
var className = _ref.className,
|
|
26
|
-
Element = _ref.element,
|
|
27
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
30
|
-
className: (0, _classnames.default)(className, 'ffe-grid', 'ffe-grid--inline')
|
|
31
|
-
}, rest));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
InlineGrid.propTypes = {
|
|
35
|
-
/** Any children of a InlineGrid must be a GridRow */
|
|
36
|
-
children: _propTypes.node,
|
|
37
|
-
|
|
38
|
-
/** Any extra classes are attached to the root node, in addition to ffe-grid classes */
|
|
39
|
-
className: _propTypes.string,
|
|
40
|
-
|
|
41
|
-
/** Specify the DOM element being used to create the Grid */
|
|
42
|
-
element: _propTypes.string
|
|
43
|
-
};
|
|
44
|
-
InlineGrid.defaultProps = {
|
|
45
|
-
element: 'div'
|
|
46
|
-
};
|