@sb1/ffe-grid-react 10.1.4 → 11.1.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/lib/GridRow.js CHANGED
@@ -5,9 +5,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.default = GridRow;
9
9
 
10
- var _react = _interopRequireWildcard(require("react"));
10
+ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _propTypes = require("prop-types");
13
13
 
@@ -15,13 +15,13 @@ var _classnames = _interopRequireDefault(require("classnames"));
15
15
 
16
16
  var _backgroundColors = _interopRequireWildcard(require("./background-colors"));
17
17
 
18
- var _utils = require("./utils");
18
+ var _excluded = ["background", "className", "children", "element", "reverse", "topPadding"];
19
19
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
 
22
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
22
+ 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
23
 
24
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
26
  function _extends() { _extends = Object.assign || 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
27
 
@@ -31,94 +31,47 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
31
31
 
32
32
  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
33
 
34
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
- 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); } }
37
-
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
39
-
40
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
-
42
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
34
+ function GridRow(_ref) {
35
+ var background = _ref.background,
36
+ className = _ref.className,
37
+ children = _ref.children,
38
+ element = _ref.element,
39
+ reverse = _ref.reverse,
40
+ topPadding = _ref.topPadding,
41
+ rest = _objectWithoutProperties(_ref, _excluded);
43
42
 
44
- 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); }; }
43
+ var content = children;
45
44
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
45
+ var hasBackgroundColor = _backgroundColors.default.includes(background);
47
46
 
48
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
+ var hasRemovedColor = _backgroundColors.removedColors.includes(background);
49
48
 
50
- 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; } }
51
-
52
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
53
-
54
- var GridRow = /*#__PURE__*/function (_Component) {
55
- _inherits(GridRow, _Component);
56
-
57
- var _super = _createSuper(GridRow);
58
-
59
- function GridRow() {
60
- _classCallCheck(this, GridRow);
49
+ if (hasBackgroundColor) {
50
+ content = /*#__PURE__*/_react.default.createElement("div", {
51
+ className: "ffe-grid__row-wrapper"
52
+ }, children);
53
+ }
61
54
 
62
- return _super.apply(this, arguments);
55
+ if (hasRemovedColor) {
56
+ throw new Error("Support for the ".concat(background, " background on <GridRow> has been removed, please see the CHANGELOG"));
63
57
  }
64
58
 
65
- _createClass(GridRow, [{
66
- key: "componentDidMount",
67
- value: function componentDidMount() {
68
- /* istanbul ignore else: there is no else */
69
- if (process.env.NODE_ENV !== 'production') {
70
- (0, _utils.checkForNestedComponent)(this.props.children, GridRow);
71
- }
72
- }
73
- }, {
74
- key: "render",
75
- value: function render() {
76
- var _this$props = this.props,
77
- background = _this$props.background,
78
- className = _this$props.className,
79
- children = _this$props.children,
80
- element = _this$props.element,
81
- reverse = _this$props.reverse,
82
- topPadding = _this$props.topPadding,
83
- rest = _objectWithoutProperties(_this$props, ["background", "className", "children", "element", "reverse", "topPadding"]);
84
-
85
- var content = children;
86
-
87
- var hasBackgroundColor = _backgroundColors.default.includes(background);
88
-
89
- var hasRemovedColor = _backgroundColors.removedColors.includes(background);
90
-
91
- if (hasBackgroundColor) {
92
- content = /*#__PURE__*/_react.default.createElement("div", {
93
- className: "ffe-grid__row-wrapper"
94
- }, children);
95
- }
96
-
97
- if (hasRemovedColor) {
98
- throw new Error("Support for the ".concat(background, " background on <GridRow> has been removed, please see the CHANGELOG"));
99
- }
100
-
101
- var Element = element || 'div';
102
- return /*#__PURE__*/_react.default.createElement(Element, _extends({
103
- className: (0, _classnames.default)(className, 'ffe-grid__row', _defineProperty({}, "ffe-grid__row--bg-".concat(background), hasBackgroundColor), {
104
- 'ffe-grid__row--reverse': reverse
105
- }, {
106
- 'ffe-grid__row--top-padding': topPadding
107
- })
108
- }, rest), content);
109
- }
110
- }]);
111
-
112
- return GridRow;
113
- }(_react.Component);
59
+ var Element = element || 'div';
60
+ 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
+ 'ffe-grid__row--reverse': reverse
63
+ }, {
64
+ 'ffe-grid__row--top-padding': topPadding
65
+ })
66
+ }, rest), content);
67
+ }
114
68
 
115
- exports.default = GridRow;
116
69
  GridRow.defaultProps = {
117
70
  topPadding: false
118
71
  };
119
72
  GridRow.propTypes = {
120
73
  /** Supported background colors */
121
- background: (0, _propTypes.oneOf)(['blue-ice', 'blue-pale', 'green-mint', 'grey-cloud', 'sand', 'grey-warm', 'orange-salmon', 'red', 'blue-sky', 'white']),
74
+ background: (0, _propTypes.oneOf)(['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit']),
122
75
 
123
76
  /** Any extra classes are attached to the root node, in addition to ffe-grid__row classes */
124
77
  className: _propTypes.string,
package/lib/InlineGrid.js CHANGED
@@ -1,91 +1,36 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.default = void 0;
6
+ exports.default = InlineGrid;
9
7
 
10
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
11
9
 
12
10
  var _classnames = _interopRequireDefault(require("classnames"));
13
11
 
14
12
  var _propTypes = require("prop-types");
15
13
 
16
- var _utils = require("./utils");
17
-
18
- var _ = require(".");
14
+ var _excluded = ["className", "element"];
19
15
 
20
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
17
 
22
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
23
-
24
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
25
-
26
18
  function _extends() { _extends = Object.assign || 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
19
 
28
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; }
29
21
 
30
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; }
31
23
 
32
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
- 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); } }
35
-
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
37
-
38
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
-
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
42
- 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); }; }
43
-
44
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
24
+ function InlineGrid(_ref) {
25
+ var className = _ref.className,
26
+ Element = _ref.element,
27
+ rest = _objectWithoutProperties(_ref, _excluded);
45
28
 
46
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
+ return /*#__PURE__*/_react.default.createElement(Element, _extends({
30
+ className: (0, _classnames.default)(className, 'ffe-grid', 'ffe-grid--inline')
31
+ }, rest));
32
+ }
47
33
 
48
- 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; } }
49
-
50
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
52
- var InlineGrid = /*#__PURE__*/function (_Component) {
53
- _inherits(InlineGrid, _Component);
54
-
55
- var _super = _createSuper(InlineGrid);
56
-
57
- function InlineGrid() {
58
- _classCallCheck(this, InlineGrid);
59
-
60
- return _super.apply(this, arguments);
61
- }
62
-
63
- _createClass(InlineGrid, [{
64
- key: "componentDidMount",
65
- value: function componentDidMount() {
66
- /* istanbul ignore else: there is no else */
67
- if (process.env.NODE_ENV !== 'production') {
68
- (0, _utils.checkForNestedComponent)(this.props.children, _.Grid, 'InlineGrid');
69
- }
70
- }
71
- }, {
72
- key: "render",
73
- value: function render() {
74
- var _this$props = this.props,
75
- className = _this$props.className,
76
- Element = _this$props.element,
77
- rest = _objectWithoutProperties(_this$props, ["className", "element"]);
78
-
79
- return /*#__PURE__*/_react.default.createElement(Element, _extends({
80
- className: (0, _classnames.default)(className, 'ffe-grid', 'ffe-grid--inline')
81
- }, rest));
82
- }
83
- }]);
84
-
85
- return InlineGrid;
86
- }(_react.Component);
87
-
88
- exports.default = InlineGrid;
89
34
  InlineGrid.propTypes = {
90
35
  /** Any children of a InlineGrid must be a GridRow */
91
36
  children: _propTypes.node,
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.removedColors = exports.default = void 0;
7
- var _default = ['blue-ice', 'blue-pale', 'green-mint', 'grey-cloud', 'sand', 'grey-warm', 'orange-salmon', 'red', 'blue-sky', 'white'];
7
+ var _default = ['frost-30', 'sand', 'sand-70', 'sand-30', 'syrin-70', 'syrin-30', 'vann', 'vann-30', 'fjell', 'hvit'];
8
8
  exports.default = _default;
9
- var removedColors = ['blue-cobalt', 'blue-royal', 'purple-magenta'];
9
+ var removedColors = ['blue-cobalt', 'blue-royal', 'purple-magenta', 'blue-ice', 'blue-pale', 'green-mint', 'grey-cloud', 'grey-warm', 'orange-salmon', 'red', 'blue-sky', 'white'];
10
10
  exports.removedColors = removedColors;
package/lib/index.js CHANGED
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "Grid", {
9
9
  return _Grid.default;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "InlineGrid", {
12
+ Object.defineProperty(exports, "GridCol", {
13
13
  enumerable: true,
14
14
  get: function get() {
15
- return _InlineGrid.default;
15
+ return _GridCol.default;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "GridRow", {
@@ -21,10 +21,10 @@ Object.defineProperty(exports, "GridRow", {
21
21
  return _GridRow.default;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "GridCol", {
24
+ Object.defineProperty(exports, "InlineGrid", {
25
25
  enumerable: true,
26
26
  get: function get() {
27
- return _GridCol.default;
27
+ return _InlineGrid.default;
28
28
  }
29
29
  });
30
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-grid-react",
3
- "version": "10.1.4",
3
+ "version": "11.1.1",
4
4
  "license": "MIT",
5
5
  "author": "SpareBank1",
6
6
  "files": [
@@ -17,11 +17,8 @@
17
17
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
18
18
  },
19
19
  "scripts": {
20
- "build": "npm run build:cjs && npm run build:es && npm run build:types",
21
- "build:cjs": "babel -d lib/. --root-mode=upward --env-name=cjs --ignore=*.spec.js src/.",
22
- "build:es": "babel -d es/. --root-mode=upward --env-name=es --ignore=*.spec.js src/.",
23
- "build:types": "copyfiles -f src/index.d.ts types/",
24
- "lint": "eslint src/.",
20
+ "build": "ffe-buildtool babel",
21
+ "lint": "eslint src",
25
22
  "test": "jest",
26
23
  "test:watch": "jest --watch"
27
24
  },
@@ -29,9 +26,10 @@
29
26
  "setupTestFrameworkScriptFile": "../../test-setup.js"
30
27
  },
31
28
  "dependencies": {
32
- "classnames": "^2.2.5"
29
+ "classnames": "^2.3.1"
33
30
  },
34
31
  "devDependencies": {
32
+ "@sb1/ffe-buildtool": "^0.1.0",
35
33
  "enzyme": "^3.7.0",
36
34
  "enzyme-adapter-react-16": "^1.7.0",
37
35
  "jest": "^26.0.0",
@@ -45,5 +43,5 @@
45
43
  "publishConfig": {
46
44
  "access": "public"
47
45
  },
48
- "gitHead": "274d896b03703139da2bfeab8ab32652f6b4c1e2"
46
+ "gitHead": "59eb2e12625e744f1a116c14a40cf69f1bbecdc6"
49
47
  }
package/types/index.d.ts CHANGED
@@ -15,16 +15,14 @@ export interface InlineGridProps extends React.HTMLAttributes<HTMLElement> {
15
15
  }
16
16
 
17
17
  type BackgroundColors =
18
- | 'blue-ice'
19
- | 'blue-pale'
20
- | 'green-mint'
21
- | 'grey-cloud'
18
+ | 'frost-30'
22
19
  | 'sand'
23
- | 'grey-warm'
24
- | 'orange-salmon'
25
- | 'red'
26
- | 'blue-sky'
27
- | 'white';
20
+ | 'sand-70'
21
+ | 'sand-30'
22
+ | 'vann'
23
+ | 'vann-30'
24
+ | 'fjell'
25
+ | 'hvit';
28
26
 
29
27
  export interface GridRowProps extends React.HTMLAttributes<HTMLElement> {
30
28
  background?: BackgroundColors;