@sb1/ffe-grid-react 13.1.0 → 13.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Grid.js +2 -2
- package/es/GridCol.js +29 -34
- package/es/GridRow.js +2 -2
- package/lib/Grid.js +2 -2
- package/lib/GridCol.js +28 -33
- package/lib/GridRow.js +2 -2
- package/package.json +3 -3
- package/types/index.d.ts +1 -0
package/es/Grid.js
CHANGED
|
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
var _excluded = ["children", "className", "gap", "element"];
|
|
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
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
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; }
|
|
8
8
|
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; }
|
|
9
9
|
import React from 'react';
|
package/es/GridCol.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
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; }
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
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; }
|
|
8
|
-
function
|
|
9
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
9
|
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); }
|
|
12
10
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
-
function _isNativeReflectConstruct() {
|
|
11
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
12
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
|
+
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); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
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; }
|
|
16
|
-
function _toPropertyKey(
|
|
17
|
-
function _toPrimitive(
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
18
|
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); }
|
|
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, removedColors } from './background-colors';
|
|
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
24
|
switch (_typeof(def)) {
|
|
31
25
|
case 'undefined':
|
|
@@ -36,15 +30,13 @@ var sizeClasses = function sizeClasses(size, def) {
|
|
|
36
30
|
return "ffe-grid__col--".concat(size, "-").concat(def);
|
|
37
31
|
}
|
|
38
32
|
};
|
|
39
|
-
var
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}).join(' ');
|
|
33
|
+
var centerTextClass = function centerTextClass(centerText) {
|
|
34
|
+
return centerText ? 'ffe-grid__col--center-text' : null;
|
|
35
|
+
};
|
|
36
|
+
var centerClass = function centerClass(center) {
|
|
37
|
+
return center ? 'ffe-grid__col--center' : null;
|
|
45
38
|
};
|
|
46
|
-
var backgroundClass = function backgroundClass(
|
|
47
|
-
var background = _ref.background;
|
|
39
|
+
var backgroundClass = function backgroundClass(background) {
|
|
48
40
|
if (!background) {
|
|
49
41
|
return null;
|
|
50
42
|
}
|
|
@@ -53,13 +45,15 @@ var backgroundClass = function backgroundClass(_ref) {
|
|
|
53
45
|
}
|
|
54
46
|
return backgroundColors.includes(background) ? "ffe-grid__col--bg-".concat(background) : null;
|
|
55
47
|
};
|
|
48
|
+
var backgroundDarkClass = function backgroundDarkClass(backgroundDark) {
|
|
49
|
+
return backgroundDarkColors.includes(backgroundDark) ? "ffe-grid__col--bg-dark-".concat(backgroundDark) : null;
|
|
50
|
+
};
|
|
56
51
|
var GridCol = /*#__PURE__*/function (_Component) {
|
|
57
52
|
_inherits(GridCol, _Component);
|
|
58
|
-
var _super = _createSuper(GridCol);
|
|
59
53
|
function GridCol() {
|
|
60
54
|
var _this;
|
|
61
55
|
_classCallCheck(this, GridCol);
|
|
62
|
-
_this =
|
|
56
|
+
_this = _callSuper(this, GridCol);
|
|
63
57
|
_this.ref = /*#__PURE__*/createRef();
|
|
64
58
|
return _this;
|
|
65
59
|
}
|
|
@@ -67,19 +61,18 @@ var GridCol = /*#__PURE__*/function (_Component) {
|
|
|
67
61
|
key: "render",
|
|
68
62
|
value: function render() {
|
|
69
63
|
var _this$props = this.props,
|
|
70
|
-
|
|
64
|
+
background = _this$props.background,
|
|
65
|
+
backgroundDark = _this$props.backgroundDark,
|
|
71
66
|
className = _this$props.className,
|
|
72
67
|
Element = _this$props.element,
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
centerText = _this$props.centerText,
|
|
69
|
+
center = _this$props.center,
|
|
70
|
+
children = _this$props.children,
|
|
75
71
|
sm = _this$props.sm,
|
|
72
|
+
md = _this$props.md,
|
|
73
|
+
lg = _this$props.lg,
|
|
76
74
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
77
|
-
|
|
78
|
-
if (MODIFIER_LIST.includes(key)) {
|
|
79
|
-
delete rest[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
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) {
|
|
75
|
+
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) {
|
|
83
76
|
return x;
|
|
84
77
|
}).join(' ');
|
|
85
78
|
return /*#__PURE__*/React.createElement(Element, _extends({
|
|
@@ -96,7 +89,9 @@ GridCol.defaultProps = {
|
|
|
96
89
|
};
|
|
97
90
|
GridCol.propTypes = {
|
|
98
91
|
/** Supported background colors */
|
|
99
|
-
background: oneOf(
|
|
92
|
+
background: oneOf(backgroundColors),
|
|
93
|
+
/** Supported dark background colors */
|
|
94
|
+
backgroundDark: oneOf(backgroundDarkColors),
|
|
100
95
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__col classes */
|
|
101
96
|
className: string,
|
|
102
97
|
/** Specify the DOM element being used to create the GridCol */
|
package/es/GridRow.js
CHANGED
|
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
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
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
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; }
|
|
8
8
|
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; }
|
|
9
9
|
import React from 'react';
|
package/lib/Grid.js
CHANGED
|
@@ -12,8 +12,8 @@ var _excluded = ["children", "className", "gap", "element"];
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
15
|
-
function _toPropertyKey(
|
|
16
|
-
function _toPrimitive(
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
17
|
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; }
|
|
18
18
|
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
19
|
function Grid(_ref) {
|
package/lib/GridCol.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _backgroundColors = require("./background-colors");
|
|
11
|
-
var _excluded = ["
|
|
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; }
|
|
@@ -18,23 +18,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
18
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
20
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; }
|
|
21
|
-
function
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
21
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
24
22
|
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); }
|
|
25
23
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
26
|
-
function _isNativeReflectConstruct() {
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
25
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
26
|
+
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); }
|
|
27
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
28
|
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; }
|
|
29
|
-
function _toPropertyKey(
|
|
30
|
-
function _toPrimitive(
|
|
29
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
30
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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
33
|
switch (_typeof(def)) {
|
|
40
34
|
case 'undefined':
|
|
@@ -45,15 +39,13 @@ var sizeClasses = function sizeClasses(size, def) {
|
|
|
45
39
|
return "ffe-grid__col--".concat(size, "-").concat(def);
|
|
46
40
|
}
|
|
47
41
|
};
|
|
48
|
-
var
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}).join(' ');
|
|
42
|
+
var centerTextClass = function centerTextClass(centerText) {
|
|
43
|
+
return centerText ? 'ffe-grid__col--center-text' : null;
|
|
44
|
+
};
|
|
45
|
+
var centerClass = function centerClass(center) {
|
|
46
|
+
return center ? 'ffe-grid__col--center' : null;
|
|
54
47
|
};
|
|
55
|
-
var backgroundClass = function backgroundClass(
|
|
56
|
-
var background = _ref.background;
|
|
48
|
+
var backgroundClass = function backgroundClass(background) {
|
|
57
49
|
if (!background) {
|
|
58
50
|
return null;
|
|
59
51
|
}
|
|
@@ -62,13 +54,15 @@ var backgroundClass = function backgroundClass(_ref) {
|
|
|
62
54
|
}
|
|
63
55
|
return _backgroundColors.backgroundColors.includes(background) ? "ffe-grid__col--bg-".concat(background) : null;
|
|
64
56
|
};
|
|
57
|
+
var backgroundDarkClass = function backgroundDarkClass(backgroundDark) {
|
|
58
|
+
return _backgroundColors.backgroundDarkColors.includes(backgroundDark) ? "ffe-grid__col--bg-dark-".concat(backgroundDark) : null;
|
|
59
|
+
};
|
|
65
60
|
var GridCol = exports.default = /*#__PURE__*/function (_Component) {
|
|
66
61
|
_inherits(GridCol, _Component);
|
|
67
|
-
var _super = _createSuper(GridCol);
|
|
68
62
|
function GridCol() {
|
|
69
63
|
var _this;
|
|
70
64
|
_classCallCheck(this, GridCol);
|
|
71
|
-
_this =
|
|
65
|
+
_this = _callSuper(this, GridCol);
|
|
72
66
|
_this.ref = /*#__PURE__*/(0, _react.createRef)();
|
|
73
67
|
return _this;
|
|
74
68
|
}
|
|
@@ -76,19 +70,18 @@ var GridCol = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
76
70
|
key: "render",
|
|
77
71
|
value: function render() {
|
|
78
72
|
var _this$props = this.props,
|
|
79
|
-
|
|
73
|
+
background = _this$props.background,
|
|
74
|
+
backgroundDark = _this$props.backgroundDark,
|
|
80
75
|
className = _this$props.className,
|
|
81
76
|
Element = _this$props.element,
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
centerText = _this$props.centerText,
|
|
78
|
+
center = _this$props.center,
|
|
79
|
+
children = _this$props.children,
|
|
84
80
|
sm = _this$props.sm,
|
|
81
|
+
md = _this$props.md,
|
|
82
|
+
lg = _this$props.lg,
|
|
85
83
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
86
|
-
|
|
87
|
-
if (MODIFIER_LIST.includes(key)) {
|
|
88
|
-
delete rest[key];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
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) {
|
|
84
|
+
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) {
|
|
92
85
|
return x;
|
|
93
86
|
}).join(' ');
|
|
94
87
|
return /*#__PURE__*/_react.default.createElement(Element, _extends({
|
|
@@ -104,7 +97,9 @@ GridCol.defaultProps = {
|
|
|
104
97
|
};
|
|
105
98
|
GridCol.propTypes = {
|
|
106
99
|
/** Supported background colors */
|
|
107
|
-
background: (0, _propTypes.oneOf)(
|
|
100
|
+
background: (0, _propTypes.oneOf)(_backgroundColors.backgroundColors),
|
|
101
|
+
/** Supported dark background colors */
|
|
102
|
+
backgroundDark: (0, _propTypes.oneOf)(_backgroundColors.backgroundDarkColors),
|
|
108
103
|
/** Any extra classes are attached to the root node, in addition to ffe-grid__col classes */
|
|
109
104
|
className: _propTypes.string,
|
|
110
105
|
/** Specify the DOM element being used to create the GridCol */
|
package/lib/GridRow.js
CHANGED
|
@@ -13,8 +13,8 @@ var _excluded = ["background", "backgroundDark", "className", "children", "eleme
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
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); }
|
|
15
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; }
|
|
16
|
-
function _toPropertyKey(
|
|
17
|
-
function _toPrimitive(
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
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; }
|
|
19
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; }
|
|
20
20
|
function GridRow(_ref) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-grid-react",
|
|
3
|
-
"version": "13.1
|
|
3
|
+
"version": "13.2.1",
|
|
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.1
|
|
27
|
+
"@sb1/ffe-grid": "^14.2.1",
|
|
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": "ae86a1b0efce7a96908d46b2cc8eb523c660d8bf"
|
|
42
42
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export interface GridColSize {
|
|
|
66
66
|
|
|
67
67
|
export interface GridColProps extends React.ComponentProps<'div'> {
|
|
68
68
|
background?: BackgroundColors;
|
|
69
|
+
backgroundDark?: BackgroundDarkColors;
|
|
69
70
|
children?: React.ReactNode;
|
|
70
71
|
className?: string;
|
|
71
72
|
element?: React.ReactNode;
|