@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/utils.dev.js DELETED
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.checkValidColumnCount = exports.checkForNestedComponent = exports.checkForDeprecatedModifiers = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- 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); }
13
-
14
- var ALLOWED_NESTED_COMPONENTS = ['InlineGrid'];
15
-
16
- var checkForNestedComponent = function checkForNestedComponent(children, Component, componentName) {
17
- return _react.default.Children.forEach(children, function (child) {
18
- if (!child || child.type && child.type.name && ALLOWED_NESTED_COMPONENTS.some(function (c) {
19
- return c === child.type.name;
20
- })) {
21
- return;
22
- } else if (child.type === Component) {
23
- console.error("\n Detected a <".concat(Component.name, " /> child within an ").concat(componentName || Component.name, ".\n Do not nest these, the result will be unpredictable.\n "));
24
- } else if (child.props && child.props.children) {
25
- return checkForNestedComponent(child.props.children, Component, componentName);
26
- }
27
- });
28
- };
29
-
30
- exports.checkForNestedComponent = checkForNestedComponent;
31
- var DEPRECATED_MODIFIERS = {
32
- vertical: '`<GridCol vertical={true} />` is the default behavior. You can safely remove this prop.'
33
- };
34
-
35
- var checkForDeprecatedModifiers = function checkForDeprecatedModifiers(props) {
36
- Object.keys(props).filter(function (propName) {
37
- return DEPRECATED_MODIFIERS[propName];
38
- }).forEach(function (propName) {
39
- return console.error(DEPRECATED_MODIFIERS[propName]);
40
- });
41
- };
42
-
43
- exports.checkForDeprecatedModifiers = checkForDeprecatedModifiers;
44
-
45
- var checkValidMdColumns = function checkValidMdColumns(modifier) {
46
- var total = _typeof(modifier) === 'object' ? modifier.cols + modifier.offset : modifier;
47
-
48
- if (!(total % 2 === 0 && (modifier.cols || 0) % 2 === 0 && (modifier.offset || 0) % 2 === 0)) {
49
- console.error("\n For \"md\" screensizes, both cols and offset should be multiples of 2.\n Please consult the ffe-grid README.md for details.\n\n You've provided a <GridCol> with md={".concat(JSON.stringify(modifier), "}\n "));
50
- }
51
- };
52
-
53
- var checkValidSmColumns = function checkValidSmColumns(modifier) {
54
- var total = _typeof(modifier) === 'object' ? modifier.cols + modifier.offset : modifier;
55
-
56
- if (!(total % 3 === 0 && (modifier.cols || 0) % 3 === 0 && (modifier.offset || 0) % 3 === 0)) {
57
- console.error("\n For \"sm\" screensizes, both cols and offset should be multiples of 3.\n Please consult the ffe-grid README.md for details.\n\n You've provided a <GridCol> with sm={".concat(JSON.stringify(modifier), "}\n "));
58
- }
59
- };
60
-
61
- var checkValidColumnCount = function checkValidColumnCount(_ref, domNode) {
62
- var sm = _ref.sm,
63
- md = _ref.md;
64
-
65
- if (domNode) {
66
- var parent = domNode.parentElement;
67
-
68
- while (parent) {
69
- if (parent.className.indexOf('--inline') !== -1) {
70
- return;
71
- }
72
-
73
- parent = parent.parentElement;
74
- }
75
- }
76
-
77
- if (md) {
78
- checkValidMdColumns(md);
79
- }
80
-
81
- if (sm) {
82
- checkValidSmColumns(sm);
83
- }
84
- };
85
-
86
- exports.checkValidColumnCount = checkValidColumnCount;
package/lib/utils.js DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- /* istanbul ignore if: I don't see any good way of getting around NODE_ENV */
4
- if (process.env.NODE_ENV === 'production') {
5
- var emptyFn = function emptyFn() {};
6
-
7
- module.exports = {
8
- checkForDeprecatedModifiers: emptyFn,
9
- checkForNestedComponent: emptyFn,
10
- checkValidColumnCount: emptyFn
11
- };
12
- } else {
13
- module.exports = require('./utils.dev');
14
- }