@sb1/ffe-grid-react 12.0.0 → 12.0.2
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 +4 -13
- package/es/GridCol.js +17 -67
- package/es/GridRow.js +10 -20
- package/es/show-grid.js +0 -5
- package/lib/Grid.js +4 -19
- package/lib/GridCol.js +17 -74
- package/lib/GridRow.js +10 -31
- package/lib/index.js +0 -4
- package/lib/show-grid.js +0 -10
- package/package.json +40 -40
- package/types/index.d.ts +1 -0
package/es/Grid.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
var _excluded = ["children", "className", "gap", "element"];
|
|
2
|
-
|
|
3
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); }
|
|
4
|
-
|
|
5
3
|
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
|
-
|
|
7
4
|
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; }
|
|
8
|
-
|
|
9
5
|
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
|
-
|
|
11
6
|
import React from 'react';
|
|
12
7
|
import classNames from 'classnames';
|
|
13
8
|
import { node, string, oneOf } from 'prop-types';
|
|
14
9
|
export default function Grid(_ref) {
|
|
15
10
|
var children = _ref.children,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
className = _ref.className,
|
|
12
|
+
gap = _ref.gap,
|
|
13
|
+
element = _ref.element,
|
|
14
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
15
|
var Element = element || 'div';
|
|
22
16
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
23
17
|
className: classNames(className, 'ffe-grid', _defineProperty({}, "ffe-grid--gap-".concat(gap), gap))
|
|
@@ -26,13 +20,10 @@ export default function Grid(_ref) {
|
|
|
26
20
|
Grid.propTypes = {
|
|
27
21
|
/** Any children of a Grid must be a GridRow */
|
|
28
22
|
children: node,
|
|
29
|
-
|
|
30
23
|
/** Any extra classes are attached to the root node, in addition to ffe-grid classes */
|
|
31
24
|
className: string,
|
|
32
|
-
|
|
33
25
|
/** Specify the internal gutter of the grid */
|
|
34
26
|
gap: oneOf(['none', '2xs', 'xs', 'sm', 'md', 'lg']),
|
|
35
|
-
|
|
36
27
|
/** Specify the DOM element being used to create the Grid */
|
|
37
28
|
element: string
|
|
38
29
|
};
|
package/es/GridCol.js
CHANGED
|
@@ -1,63 +1,40 @@
|
|
|
1
1
|
var _excluded = ["children", "className", "element", "lg", "md", "sm"];
|
|
2
|
-
|
|
3
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); }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
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; }
|
|
8
|
-
|
|
9
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
-
|
|
11
6
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
12
|
-
|
|
13
7
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
-
|
|
15
8
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
-
|
|
17
9
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
|
-
|
|
19
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
20
|
-
|
|
21
11
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
22
|
-
|
|
23
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
-
|
|
25
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
|
-
|
|
27
14
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
28
|
-
|
|
29
15
|
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; }
|
|
30
|
-
|
|
31
16
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
32
|
-
|
|
33
17
|
import React, { Component, createRef } from 'react';
|
|
34
18
|
import { bool, node, number, oneOf, oneOfType, shape, string } from 'prop-types';
|
|
35
19
|
import classNames from 'classnames';
|
|
36
20
|
import backgroundColors, { removedColors } from './background-colors';
|
|
37
|
-
|
|
38
21
|
function camelCaseToDashCase(str) {
|
|
39
22
|
return str.split('').reduce(function (previous, current) {
|
|
40
23
|
return /[A-Z]/.test(current) ? "".concat(previous, "-").concat(current.toLowerCase()) : "".concat(previous).concat(current);
|
|
41
24
|
});
|
|
42
25
|
}
|
|
43
|
-
|
|
44
|
-
var MODIFIER_LIST = ['background', 'centerText'];
|
|
45
|
-
|
|
26
|
+
var MODIFIER_LIST = ['background', 'centerText', 'center'];
|
|
46
27
|
var sizeClasses = function sizeClasses(size, def) {
|
|
47
28
|
var _classNames;
|
|
48
|
-
|
|
49
29
|
switch (_typeof(def)) {
|
|
50
30
|
case 'undefined':
|
|
51
31
|
return '';
|
|
52
|
-
|
|
53
32
|
case 'object':
|
|
54
33
|
return classNames((_classNames = {}, _defineProperty(_classNames, "ffe-grid__col--".concat(size, "-").concat(def.cols), def.cols || def.cols === 0), _defineProperty(_classNames, "ffe-grid__col--".concat(size, "-offset-").concat(def.offset), def.offset || def.offset === 0), _classNames));
|
|
55
|
-
|
|
56
34
|
default:
|
|
57
35
|
return "ffe-grid__col--".concat(size, "-").concat(def);
|
|
58
36
|
}
|
|
59
37
|
};
|
|
60
|
-
|
|
61
38
|
var modifiers = function modifiers(props) {
|
|
62
39
|
return Object.keys(props).filter(function (key) {
|
|
63
40
|
return MODIFIER_LIST.indexOf(key) !== -1 && !!props[key];
|
|
@@ -65,54 +42,43 @@ var modifiers = function modifiers(props) {
|
|
|
65
42
|
return "ffe-grid__col--".concat(camelCaseToDashCase(key));
|
|
66
43
|
}).join(' ');
|
|
67
44
|
};
|
|
68
|
-
|
|
69
45
|
var backgroundClass = function backgroundClass(_ref) {
|
|
70
46
|
var background = _ref.background;
|
|
71
|
-
|
|
72
47
|
if (!background) {
|
|
73
48
|
return null;
|
|
74
49
|
}
|
|
75
|
-
|
|
76
50
|
if (removedColors.includes(background)) {
|
|
77
51
|
throw new Error("Support for the ".concat(background, " background on <GridCol> has been removed, please see the CHANGELOG"));
|
|
78
52
|
}
|
|
79
|
-
|
|
80
53
|
return backgroundColors.includes(background) ? "ffe-grid__col--bg-".concat(background) : null;
|
|
81
54
|
};
|
|
82
|
-
|
|
83
55
|
var GridCol = /*#__PURE__*/function (_Component) {
|
|
84
56
|
_inherits(GridCol, _Component);
|
|
85
|
-
|
|
86
57
|
var _super = _createSuper(GridCol);
|
|
87
|
-
|
|
88
58
|
function GridCol() {
|
|
89
59
|
var _this;
|
|
90
|
-
|
|
91
60
|
_classCallCheck(this, GridCol);
|
|
92
|
-
|
|
93
61
|
_this = _super.call(this);
|
|
94
62
|
_this.ref = /*#__PURE__*/createRef();
|
|
95
63
|
return _this;
|
|
96
64
|
}
|
|
97
|
-
|
|
98
65
|
_createClass(GridCol, [{
|
|
99
66
|
key: "render",
|
|
100
67
|
value: function render() {
|
|
101
68
|
var _this$props = this.props,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
69
|
+
children = _this$props.children,
|
|
70
|
+
className = _this$props.className,
|
|
71
|
+
Element = _this$props.element,
|
|
72
|
+
lg = _this$props.lg,
|
|
73
|
+
md = _this$props.md,
|
|
74
|
+
sm = _this$props.sm,
|
|
75
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
110
76
|
Object.keys(rest).forEach(function (key) {
|
|
111
77
|
if (MODIFIER_LIST.includes(key)) {
|
|
112
78
|
delete rest[key];
|
|
113
79
|
}
|
|
114
80
|
});
|
|
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) {
|
|
81
|
+
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) {
|
|
116
82
|
return x;
|
|
117
83
|
}).join(' ');
|
|
118
84
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
@@ -121,10 +87,8 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
121
87
|
}, rest), children);
|
|
122
88
|
}
|
|
123
89
|
}]);
|
|
124
|
-
|
|
125
90
|
return GridCol;
|
|
126
91
|
}(Component);
|
|
127
|
-
|
|
128
92
|
export { GridCol as default };
|
|
129
93
|
GridCol.defaultProps = {
|
|
130
94
|
element: 'div'
|
|
@@ -132,54 +96,40 @@ GridCol.defaultProps = {
|
|
|
132
96
|
GridCol.propTypes = {
|
|
133
97
|
/** Supported background colors */
|
|
134
98
|
background: oneOf(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
|
|
135
|
-
|
|
136
99
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__col classes */
|
|
137
100
|
className: string,
|
|
138
|
-
|
|
139
101
|
/** Specify the DOM element being used to create the GridCol */
|
|
140
102
|
element: node,
|
|
141
|
-
|
|
142
103
|
/** Center text content horizontally */
|
|
143
104
|
centerText: bool,
|
|
144
|
-
|
|
105
|
+
/** Center content vertically */
|
|
106
|
+
center: bool,
|
|
145
107
|
/** The content of the column */
|
|
146
108
|
children: node,
|
|
147
|
-
|
|
148
109
|
/** Size modifiers for small screen sizes */
|
|
149
|
-
sm: oneOfType([
|
|
150
|
-
/** Number of columns, 0-12 */
|
|
151
|
-
number,
|
|
152
|
-
/** Number of columns, 0-12 */
|
|
110
|
+
sm: oneOfType([/** Number of columns, 0-12 */
|
|
111
|
+
number, /** Number of columns, 0-12 */
|
|
153
112
|
string, shape({
|
|
154
113
|
/** Number of columns, 0-12 */
|
|
155
114
|
cols: oneOfType([number, string]),
|
|
156
|
-
|
|
157
115
|
/** Number of colums offset, 0-12 */
|
|
158
116
|
offset: oneOfType([number, string])
|
|
159
117
|
})]),
|
|
160
|
-
|
|
161
118
|
/** Size modifiers for medium screen sizes */
|
|
162
|
-
md: oneOfType([
|
|
163
|
-
/** Number of columns, 0-12 */
|
|
164
|
-
number,
|
|
165
|
-
/** Number of columns, 0-12 */
|
|
119
|
+
md: oneOfType([/** Number of columns, 0-12 */
|
|
120
|
+
number, /** Number of columns, 0-12 */
|
|
166
121
|
string, shape({
|
|
167
122
|
/** Number of columns, 0-12 */
|
|
168
123
|
cols: oneOfType([number, string]),
|
|
169
|
-
|
|
170
124
|
/** Number of colums offset, 0-12 */
|
|
171
125
|
offset: oneOfType([number, string])
|
|
172
126
|
})]),
|
|
173
|
-
|
|
174
127
|
/** Size modifiers for large screen sizes */
|
|
175
|
-
lg: oneOfType([
|
|
176
|
-
/** Number of columns, 0-12 */
|
|
177
|
-
number,
|
|
178
|
-
/** Number of columns, 0-12 */
|
|
128
|
+
lg: oneOfType([/** Number of columns, 0-12 */
|
|
129
|
+
number, /** Number of columns, 0-12 */
|
|
179
130
|
string, shape({
|
|
180
131
|
/** Number of columns, 0-12 */
|
|
181
132
|
cols: oneOfType([number, string]),
|
|
182
|
-
|
|
183
133
|
/** Number of colums offset, 0-12 */
|
|
184
134
|
offset: oneOfType([number, string])
|
|
185
135
|
})])
|
package/es/GridRow.js
CHANGED
|
@@ -1,54 +1,44 @@
|
|
|
1
1
|
var _excluded = ["background", "className", "children", "element", "padding", "margin"];
|
|
2
|
-
|
|
3
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); }
|
|
4
|
-
|
|
5
3
|
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
|
-
|
|
7
4
|
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; }
|
|
8
|
-
|
|
9
5
|
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
|
-
|
|
11
6
|
import React from 'react';
|
|
12
7
|
import { node, oneOf, string } from 'prop-types';
|
|
13
8
|
import classNames from 'classnames';
|
|
14
9
|
import backgroundColors, { removedColors } from './background-colors';
|
|
15
10
|
export default function GridRow(_ref) {
|
|
16
11
|
var background = _ref.background,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
element = _ref.element,
|
|
15
|
+
padding = _ref.padding,
|
|
16
|
+
margin = _ref.margin,
|
|
17
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
18
|
var hasBackgroundColor = backgroundColors.includes(background);
|
|
25
19
|
var hasRemovedColor = removedColors.includes(background);
|
|
26
|
-
|
|
20
|
+
var content = hasBackgroundColor ? /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "ffe-grid__row-wrapper"
|
|
22
|
+
}, children) : children;
|
|
27
23
|
if (hasRemovedColor) {
|
|
28
24
|
throw new Error("Support for the ".concat(background, " background on <GridRow> has been removed, please see the CHANGELOG"));
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
var Element = element || 'div';
|
|
32
27
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
33
28
|
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),
|
|
29
|
+
}, rest), content);
|
|
35
30
|
}
|
|
36
31
|
GridRow.propTypes = {
|
|
37
32
|
/** Supported background colors */
|
|
38
33
|
background: oneOf(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
|
|
39
|
-
|
|
40
34
|
/** Padding in the top and bottom of the row */
|
|
41
35
|
padding: oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
42
|
-
|
|
43
36
|
/** Margin in the top and bottom of the row */
|
|
44
37
|
margin: oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
45
|
-
|
|
46
38
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__row classes */
|
|
47
39
|
className: string,
|
|
48
|
-
|
|
49
40
|
/** All children of a `<GridRow />` must be `<GridCol />`. */
|
|
50
41
|
children: node,
|
|
51
|
-
|
|
52
42
|
/** Specify the DOM element being used to create the GridRow */
|
|
53
43
|
element: string
|
|
54
44
|
};
|
package/es/show-grid.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Grid, GridRow, GridCol } from '@sb1/ffe-grid-react';
|
|
3
3
|
import { render } from 'react-dom';
|
|
4
|
-
|
|
5
4
|
var createGridContainer = function createGridContainer() {
|
|
6
5
|
var css = "\n .ffe-grid-react-debug__grid-content {\n background: #e1e1e1;\n height: 100vh;\n opacity: 0.6;\n width: 100%;\n }\n\n .ffe-grid-react-debug__grid-container {\n height: 100%;\n pointer-events: none;\n position: fixed;\n top: 0;\n z-index: 9999;\n width: 100%;\n }\n ";
|
|
7
6
|
var style = document.createElement('style');
|
|
@@ -15,16 +14,13 @@ var createGridContainer = function createGridContainer() {
|
|
|
15
14
|
document.body.appendChild(div);
|
|
16
15
|
return div;
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
var showGrid = function showGrid() {
|
|
20
18
|
var div = document.getElementById('gridView');
|
|
21
|
-
|
|
22
19
|
if (div) {
|
|
23
20
|
var styleDiv = document.getElementById('gridViewStyle');
|
|
24
21
|
styleDiv.parentNode.removeChild(styleDiv);
|
|
25
22
|
return div.parentNode.removeChild(div);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
var grid = /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridRow, null, new Array(12).fill(null).map(function (_, index) {
|
|
29
25
|
return /*#__PURE__*/React.createElement(GridCol, {
|
|
30
26
|
lg: 1,
|
|
@@ -37,5 +33,4 @@ var showGrid = function showGrid() {
|
|
|
37
33
|
})));
|
|
38
34
|
render(grid, createGridContainer());
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
export default showGrid;
|
package/lib/Grid.js
CHANGED
|
@@ -4,48 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Grid;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = require("prop-types");
|
|
13
|
-
|
|
14
10
|
var _excluded = ["children", "className", "gap", "element"];
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
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
13
|
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
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
function Grid(_ref) {
|
|
27
17
|
var children = _ref.children,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
className = _ref.className,
|
|
19
|
+
gap = _ref.gap,
|
|
20
|
+
element = _ref.element,
|
|
21
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
22
|
var Element = element || 'div';
|
|
34
23
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
35
24
|
className: (0, _classnames.default)(className, 'ffe-grid', _defineProperty({}, "ffe-grid--gap-".concat(gap), gap))
|
|
36
25
|
}, rest), children);
|
|
37
26
|
}
|
|
38
|
-
|
|
39
27
|
Grid.propTypes = {
|
|
40
28
|
/** Any children of a Grid must be a GridRow */
|
|
41
29
|
children: _propTypes.node,
|
|
42
|
-
|
|
43
30
|
/** Any extra classes are attached to the root node, in addition to ffe-grid classes */
|
|
44
31
|
className: _propTypes.string,
|
|
45
|
-
|
|
46
32
|
/** Specify the internal gutter of the grid */
|
|
47
33
|
gap: (0, _propTypes.oneOf)(['none', '2xs', 'xs', 'sm', 'md', 'lg']),
|
|
48
|
-
|
|
49
34
|
/** Specify the DOM element being used to create the Grid */
|
|
50
35
|
element: _propTypes.string
|
|
51
36
|
};
|
package/lib/GridCol.js
CHANGED
|
@@ -4,76 +4,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _backgroundColors = _interopRequireWildcard(require("./background-colors"));
|
|
15
|
-
|
|
16
11
|
var _excluded = ["children", "className", "element", "lg", "md", "sm"];
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
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
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
15
|
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); }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
-
|
|
32
19
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
33
|
-
|
|
34
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
-
|
|
36
21
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
|
-
|
|
38
22
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
-
|
|
40
23
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
41
|
-
|
|
42
24
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
|
-
|
|
44
25
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
|
-
|
|
46
26
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
-
|
|
48
27
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
-
|
|
50
28
|
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; }
|
|
51
|
-
|
|
52
29
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
53
|
-
|
|
54
30
|
function camelCaseToDashCase(str) {
|
|
55
31
|
return str.split('').reduce(function (previous, current) {
|
|
56
32
|
return /[A-Z]/.test(current) ? "".concat(previous, "-").concat(current.toLowerCase()) : "".concat(previous).concat(current);
|
|
57
33
|
});
|
|
58
34
|
}
|
|
59
|
-
|
|
60
|
-
var MODIFIER_LIST = ['background', 'centerText'];
|
|
61
|
-
|
|
35
|
+
var MODIFIER_LIST = ['background', 'centerText', 'center'];
|
|
62
36
|
var sizeClasses = function sizeClasses(size, def) {
|
|
63
37
|
var _classNames;
|
|
64
|
-
|
|
65
38
|
switch (_typeof(def)) {
|
|
66
39
|
case 'undefined':
|
|
67
40
|
return '';
|
|
68
|
-
|
|
69
41
|
case 'object':
|
|
70
42
|
return (0, _classnames.default)((_classNames = {}, _defineProperty(_classNames, "ffe-grid__col--".concat(size, "-").concat(def.cols), def.cols || def.cols === 0), _defineProperty(_classNames, "ffe-grid__col--".concat(size, "-offset-").concat(def.offset), def.offset || def.offset === 0), _classNames));
|
|
71
|
-
|
|
72
43
|
default:
|
|
73
44
|
return "ffe-grid__col--".concat(size, "-").concat(def);
|
|
74
45
|
}
|
|
75
46
|
};
|
|
76
|
-
|
|
77
47
|
var modifiers = function modifiers(props) {
|
|
78
48
|
return Object.keys(props).filter(function (key) {
|
|
79
49
|
return MODIFIER_LIST.indexOf(key) !== -1 && !!props[key];
|
|
@@ -81,54 +51,43 @@ var modifiers = function modifiers(props) {
|
|
|
81
51
|
return "ffe-grid__col--".concat(camelCaseToDashCase(key));
|
|
82
52
|
}).join(' ');
|
|
83
53
|
};
|
|
84
|
-
|
|
85
54
|
var backgroundClass = function backgroundClass(_ref) {
|
|
86
55
|
var background = _ref.background;
|
|
87
|
-
|
|
88
56
|
if (!background) {
|
|
89
57
|
return null;
|
|
90
58
|
}
|
|
91
|
-
|
|
92
59
|
if (_backgroundColors.removedColors.includes(background)) {
|
|
93
60
|
throw new Error("Support for the ".concat(background, " background on <GridCol> has been removed, please see the CHANGELOG"));
|
|
94
61
|
}
|
|
95
|
-
|
|
96
62
|
return _backgroundColors.default.includes(background) ? "ffe-grid__col--bg-".concat(background) : null;
|
|
97
63
|
};
|
|
98
|
-
|
|
99
64
|
var GridCol = /*#__PURE__*/function (_Component) {
|
|
100
65
|
_inherits(GridCol, _Component);
|
|
101
|
-
|
|
102
66
|
var _super = _createSuper(GridCol);
|
|
103
|
-
|
|
104
67
|
function GridCol() {
|
|
105
68
|
var _this;
|
|
106
|
-
|
|
107
69
|
_classCallCheck(this, GridCol);
|
|
108
|
-
|
|
109
70
|
_this = _super.call(this);
|
|
110
71
|
_this.ref = /*#__PURE__*/(0, _react.createRef)();
|
|
111
72
|
return _this;
|
|
112
73
|
}
|
|
113
|
-
|
|
114
74
|
_createClass(GridCol, [{
|
|
115
75
|
key: "render",
|
|
116
76
|
value: function render() {
|
|
117
77
|
var _this$props = this.props,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
78
|
+
children = _this$props.children,
|
|
79
|
+
className = _this$props.className,
|
|
80
|
+
Element = _this$props.element,
|
|
81
|
+
lg = _this$props.lg,
|
|
82
|
+
md = _this$props.md,
|
|
83
|
+
sm = _this$props.sm,
|
|
84
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
126
85
|
Object.keys(rest).forEach(function (key) {
|
|
127
86
|
if (MODIFIER_LIST.includes(key)) {
|
|
128
87
|
delete rest[key];
|
|
129
88
|
}
|
|
130
89
|
});
|
|
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) {
|
|
90
|
+
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) {
|
|
132
91
|
return x;
|
|
133
92
|
}).join(' ');
|
|
134
93
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
@@ -137,10 +96,8 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
137
96
|
}, rest), children);
|
|
138
97
|
}
|
|
139
98
|
}]);
|
|
140
|
-
|
|
141
99
|
return GridCol;
|
|
142
100
|
}(_react.Component);
|
|
143
|
-
|
|
144
101
|
exports.default = GridCol;
|
|
145
102
|
GridCol.defaultProps = {
|
|
146
103
|
element: 'div'
|
|
@@ -148,54 +105,40 @@ GridCol.defaultProps = {
|
|
|
148
105
|
GridCol.propTypes = {
|
|
149
106
|
/** Supported background colors */
|
|
150
107
|
background: (0, _propTypes.oneOf)(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
|
|
151
|
-
|
|
152
108
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__col classes */
|
|
153
109
|
className: _propTypes.string,
|
|
154
|
-
|
|
155
110
|
/** Specify the DOM element being used to create the GridCol */
|
|
156
111
|
element: _propTypes.node,
|
|
157
|
-
|
|
158
112
|
/** Center text content horizontally */
|
|
159
113
|
centerText: _propTypes.bool,
|
|
160
|
-
|
|
114
|
+
/** Center content vertically */
|
|
115
|
+
center: _propTypes.bool,
|
|
161
116
|
/** The content of the column */
|
|
162
117
|
children: _propTypes.node,
|
|
163
|
-
|
|
164
118
|
/** Size modifiers for small screen sizes */
|
|
165
|
-
sm: (0, _propTypes.oneOfType)([
|
|
166
|
-
/** Number of columns, 0-12 */
|
|
167
|
-
_propTypes.number,
|
|
168
|
-
/** Number of columns, 0-12 */
|
|
119
|
+
sm: (0, _propTypes.oneOfType)([/** Number of columns, 0-12 */
|
|
120
|
+
_propTypes.number, /** Number of columns, 0-12 */
|
|
169
121
|
_propTypes.string, (0, _propTypes.shape)({
|
|
170
122
|
/** Number of columns, 0-12 */
|
|
171
123
|
cols: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
172
|
-
|
|
173
124
|
/** Number of colums offset, 0-12 */
|
|
174
125
|
offset: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
|
|
175
126
|
})]),
|
|
176
|
-
|
|
177
127
|
/** Size modifiers for medium screen sizes */
|
|
178
|
-
md: (0, _propTypes.oneOfType)([
|
|
179
|
-
/** Number of columns, 0-12 */
|
|
180
|
-
_propTypes.number,
|
|
181
|
-
/** Number of columns, 0-12 */
|
|
128
|
+
md: (0, _propTypes.oneOfType)([/** Number of columns, 0-12 */
|
|
129
|
+
_propTypes.number, /** Number of columns, 0-12 */
|
|
182
130
|
_propTypes.string, (0, _propTypes.shape)({
|
|
183
131
|
/** Number of columns, 0-12 */
|
|
184
132
|
cols: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
185
|
-
|
|
186
133
|
/** Number of colums offset, 0-12 */
|
|
187
134
|
offset: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
|
|
188
135
|
})]),
|
|
189
|
-
|
|
190
136
|
/** Size modifiers for large screen sizes */
|
|
191
|
-
lg: (0, _propTypes.oneOfType)([
|
|
192
|
-
/** Number of columns, 0-12 */
|
|
193
|
-
_propTypes.number,
|
|
194
|
-
/** Number of columns, 0-12 */
|
|
137
|
+
lg: (0, _propTypes.oneOfType)([/** Number of columns, 0-12 */
|
|
138
|
+
_propTypes.number, /** Number of columns, 0-12 */
|
|
195
139
|
_propTypes.string, (0, _propTypes.shape)({
|
|
196
140
|
/** Number of columns, 0-12 */
|
|
197
141
|
cols: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
198
|
-
|
|
199
142
|
/** Number of colums offset, 0-12 */
|
|
200
143
|
offset: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
|
|
201
144
|
})])
|
package/lib/GridRow.js
CHANGED
|
@@ -1,75 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = GridRow;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _propTypes = require("prop-types");
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _backgroundColors = _interopRequireWildcard(require("./background-colors"));
|
|
17
|
-
|
|
18
12
|
var _excluded = ["background", "className", "children", "element", "padding", "margin"];
|
|
19
|
-
|
|
20
13
|
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
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
16
|
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); }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
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; }
|
|
33
|
-
|
|
34
20
|
function GridRow(_ref) {
|
|
35
21
|
var background = _ref.background,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
element = _ref.element,
|
|
25
|
+
padding = _ref.padding,
|
|
26
|
+
margin = _ref.margin,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
28
|
var hasBackgroundColor = _backgroundColors.default.includes(background);
|
|
44
|
-
|
|
45
29
|
var hasRemovedColor = _backgroundColors.removedColors.includes(background);
|
|
46
|
-
|
|
30
|
+
var content = hasBackgroundColor ? /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
+
className: "ffe-grid__row-wrapper"
|
|
32
|
+
}, children) : children;
|
|
47
33
|
if (hasRemovedColor) {
|
|
48
34
|
throw new Error("Support for the ".concat(background, " background on <GridRow> has been removed, please see the CHANGELOG"));
|
|
49
35
|
}
|
|
50
|
-
|
|
51
36
|
var Element = element || 'div';
|
|
52
37
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
53
38
|
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),
|
|
39
|
+
}, rest), content);
|
|
55
40
|
}
|
|
56
|
-
|
|
57
41
|
GridRow.propTypes = {
|
|
58
42
|
/** Supported background colors */
|
|
59
43
|
background: (0, _propTypes.oneOf)(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
|
|
60
|
-
|
|
61
44
|
/** Padding in the top and bottom of the row */
|
|
62
45
|
padding: (0, _propTypes.oneOf)(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
63
|
-
|
|
64
46
|
/** Margin in the top and bottom of the row */
|
|
65
47
|
margin: (0, _propTypes.oneOf)(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl']),
|
|
66
|
-
|
|
67
48
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__row classes */
|
|
68
49
|
className: _propTypes.string,
|
|
69
|
-
|
|
70
50
|
/** All children of a `<GridRow />` must be `<GridCol />`. */
|
|
71
51
|
children: _propTypes.node,
|
|
72
|
-
|
|
73
52
|
/** Specify the DOM element being used to create the GridRow */
|
|
74
53
|
element: _propTypes.string
|
|
75
54
|
};
|
package/lib/index.js
CHANGED
|
@@ -21,11 +21,7 @@ Object.defineProperty(exports, "GridRow", {
|
|
|
21
21
|
return _GridRow.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
25
24
|
var _Grid = _interopRequireDefault(require("./Grid"));
|
|
26
|
-
|
|
27
25
|
var _GridRow = _interopRequireDefault(require("./GridRow"));
|
|
28
|
-
|
|
29
26
|
var _GridCol = _interopRequireDefault(require("./GridCol"));
|
|
30
|
-
|
|
31
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/show-grid.js
CHANGED
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _ffeGridReact = require("@sb1/ffe-grid-react");
|
|
11
|
-
|
|
12
9
|
var _reactDom = require("react-dom");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
var createGridContainer = function createGridContainer() {
|
|
17
12
|
var css = "\n .ffe-grid-react-debug__grid-content {\n background: #e1e1e1;\n height: 100vh;\n opacity: 0.6;\n width: 100%;\n }\n\n .ffe-grid-react-debug__grid-container {\n height: 100%;\n pointer-events: none;\n position: fixed;\n top: 0;\n z-index: 9999;\n width: 100%;\n }\n ";
|
|
18
13
|
var style = document.createElement('style');
|
|
@@ -26,16 +21,13 @@ var createGridContainer = function createGridContainer() {
|
|
|
26
21
|
document.body.appendChild(div);
|
|
27
22
|
return div;
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
var showGrid = function showGrid() {
|
|
31
25
|
var div = document.getElementById('gridView');
|
|
32
|
-
|
|
33
26
|
if (div) {
|
|
34
27
|
var styleDiv = document.getElementById('gridViewStyle');
|
|
35
28
|
styleDiv.parentNode.removeChild(styleDiv);
|
|
36
29
|
return div.parentNode.removeChild(div);
|
|
37
30
|
}
|
|
38
|
-
|
|
39
31
|
var grid = /*#__PURE__*/_react.default.createElement(_ffeGridReact.Grid, null, /*#__PURE__*/_react.default.createElement(_ffeGridReact.GridRow, null, new Array(12).fill(null).map(function (_, index) {
|
|
40
32
|
return /*#__PURE__*/_react.default.createElement(_ffeGridReact.GridCol, {
|
|
41
33
|
lg: 1,
|
|
@@ -46,9 +38,7 @@ var showGrid = function showGrid() {
|
|
|
46
38
|
className: "ffe-grid-react-debug__grid-content"
|
|
47
39
|
}));
|
|
48
40
|
})));
|
|
49
|
-
|
|
50
41
|
(0, _reactDom.render)(grid, createGridContainer());
|
|
51
42
|
};
|
|
52
|
-
|
|
53
43
|
var _default = showGrid;
|
|
54
44
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
"name": "@sb1/ffe-grid-react",
|
|
3
|
+
"version": "12.0.2",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "SpareBank1",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib",
|
|
8
|
+
"es",
|
|
9
|
+
"types"
|
|
10
|
+
],
|
|
11
|
+
"main": "lib/index.js",
|
|
12
|
+
"module": "es/index.js",
|
|
13
|
+
"types": "types/index.d.ts",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "ssh://git@github.com:SpareBank1/designsystem.git"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "ffe-buildtool babel",
|
|
21
|
+
"watch": "ffe-buildtool babel-watch",
|
|
22
|
+
"lint": "eslint src",
|
|
23
|
+
"test": "ffe-buildtool jest",
|
|
24
|
+
"test:watch": "ffe-buildtool jest --watch"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"classnames": "^2.3.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@sb1/ffe-buildtool": "^0.4.1",
|
|
31
|
+
"react": "^16.9.0",
|
|
32
|
+
"react-dom": "^16.9.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@sb1/ffe-grid": "*",
|
|
36
|
+
"react": ">=16.9.0"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "3878d43f98432f838d8f2f2da396f8fc40d0d311"
|
|
42
42
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export interface GridColProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
66
66
|
children?: React.ReactNode;
|
|
67
67
|
className?: string;
|
|
68
68
|
element?: React.ReactNode;
|
|
69
|
+
center?: boolean;
|
|
69
70
|
centerText?: boolean;
|
|
70
71
|
sm?: ColumnsRange | string | GridColSize;
|
|
71
72
|
md?: ColumnsRange | string | GridColSize;
|