@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.
@@ -1,361 +0,0 @@
1
- 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); }
2
-
3
- import React from 'react';
4
- import { mount, shallow } from 'enzyme';
5
- import { Grid, GridRow, GridCol, InlineGrid } from '.';
6
- import backgroundColors from './background-colors';
7
- var defaultProps = {
8
- children: /*#__PURE__*/React.createElement("p", null, "blah")
9
- };
10
-
11
- var renderShallow = function renderShallow() {
12
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
- return shallow( /*#__PURE__*/React.createElement(GridCol, _extends({}, defaultProps, props)));
14
- };
15
-
16
- describe('GridCol', function () {
17
- it('renders with custom class', function () {
18
- var el = renderShallow({
19
- className: 'custom-class'
20
- });
21
- expect(el.hasClass('custom-class')).toBe(true);
22
- });
23
- it('renders provided children node', function () {
24
- var el = renderShallow();
25
- expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
26
- });
27
- it('supports setting cols as a number', function () {
28
- var el = renderShallow({
29
- lg: 10
30
- });
31
- expect(el.hasClass('ffe-grid__col--lg-10')).toBe(true);
32
- });
33
- it('supports setting cols as a string', function () {
34
- var el = renderShallow({
35
- sm: '1'
36
- });
37
- expect(el.hasClass('ffe-grid__col--sm-1')).toBe(true);
38
- });
39
- it('supports setting cols as an object', function () {
40
- var el = renderShallow({
41
- md: {
42
- cols: 4
43
- }
44
- });
45
- expect(el.hasClass('ffe-grid__col--md-4')).toBe(true);
46
- });
47
- it('supports setting cols and offset', function () {
48
- var el = renderShallow({
49
- sm: {
50
- cols: 4,
51
- offset: '2'
52
- }
53
- });
54
- expect(el.hasClass('ffe-grid__col--sm-4')).toBe(true);
55
- expect(el.hasClass('ffe-grid__col--sm-offset-2')).toBe(true);
56
- });
57
- it('does not set an offset class if no offset is provided', function () {
58
- var el = renderShallow({
59
- lg: {
60
- cols: 7
61
- }
62
- });
63
- expect(el.prop('className')).not.toContain('offset');
64
- });
65
- it('sets the center modifier if the value is boolean true', function () {
66
- var el = renderShallow({
67
- center: true
68
- });
69
- expect(el.hasClass('ffe-grid__col--center')).toBe(true);
70
- });
71
- it('sets the center modifier if the value is boolean true', function () {
72
- var el = renderShallow({
73
- centerText: true
74
- });
75
- expect(el.hasClass('ffe-grid__col--center-text')).toBe(true);
76
- });
77
- it('sets the center modifier as a string', function () {
78
- var el = renderShallow({
79
- center: 'true'
80
- });
81
- expect(el.hasClass('ffe-grid__col--center')).toBe(true);
82
- });
83
- it('sets the center modifier if the value is truthy', function () {
84
- var el = renderShallow({
85
- center: 'wombats'
86
- });
87
- expect(el.hasClass('ffe-grid__col--center')).toBe(true);
88
- });
89
- it('does not set the center modifier if the value is boolean false', function () {
90
- var el = renderShallow({
91
- center: false
92
- });
93
- expect(el.hasClass('ffe-grid__col--center')).not.toBe(true);
94
- });
95
- it('sets the top modifier', function () {
96
- var el = renderShallow({
97
- top: true
98
- });
99
- expect(el.hasClass('ffe-grid__col--top')).toBe(true);
100
- });
101
- it('sets background color class if valid', function () {
102
- backgroundColors.forEach(function (background) {
103
- var el = renderShallow({
104
- background: background
105
- });
106
- expect(el.hasClass("ffe-grid__col--bg-".concat(background))).toBe(true);
107
- });
108
- });
109
- it('does not set background color class if not valid', function () {
110
- var illegalBackgroundColors = ['ice-cream', 'log("hack")', '123456'];
111
- illegalBackgroundColors.forEach(function (background) {
112
- var el = renderShallow({
113
- background: background
114
- });
115
- expect(el.hasClass("ffe-grid__col--bg-".concat(background))).toBe(false);
116
- });
117
- });
118
- it('throws for removed background colours', function () {
119
- expect(function () {
120
- return renderShallow({
121
- background: 'blue-cobalt'
122
- });
123
- }).toThrow('Support for the blue-cobalt background on <GridCol> has been removed, please see the CHANGELOG');
124
- });
125
- it('sets all the things o/', function () {
126
- var el = renderShallow({
127
- sm: {
128
- cols: '6',
129
- offset: 2
130
- },
131
- md: 8,
132
- lg: {
133
- cols: 2
134
- },
135
- center: true,
136
- centerText: true,
137
- bottom: true,
138
- between: true,
139
- horizontal: true,
140
- reverse: true
141
- });
142
- expect(el.hasClass('ffe-grid__col--sm-6')).toBe(true);
143
- expect(el.hasClass('ffe-grid__col--sm-offset-2')).toBe(true);
144
- expect(el.hasClass('ffe-grid__col--md-8')).toBe(true);
145
- expect(el.hasClass('ffe-grid__col--lg-2')).toBe(true);
146
- expect(el.hasClass('ffe-grid__col--center')).toBe(true);
147
- expect(el.hasClass('ffe-grid__col--center-text')).toBe(true);
148
- expect(el.hasClass('ffe-grid__col--bottom')).toBe(true);
149
- expect(el.hasClass('ffe-grid__col--between')).toBe(true);
150
- expect(el.hasClass('ffe-grid__col--horizontal')).toBe(true);
151
- expect(el.hasClass('ffe-grid__col--reverse')).toBe(true);
152
- });
153
- it('preserves other attributes that are passed to it', function () {
154
- var handler = jest.fn();
155
- var el = renderShallow({
156
- onClick: handler
157
- });
158
- el.simulate('click');
159
- expect(handler).toHaveBeenCalledTimes(1);
160
- });
161
- it('can render a custom root element', function () {
162
- var el = renderShallow({
163
- element: 'section'
164
- });
165
- expect(el.type()).toBe('section');
166
- });
167
- it('does not pass on known properties to its root element', function () {
168
- var el = renderShallow({
169
- center: true,
170
- reverse: true
171
- });
172
- expect(el.props().center).toBe(undefined);
173
- expect(el.props().reverse).toBe(undefined);
174
- });
175
- it('can render with offset 0 and columns 0', function () {
176
- var el = renderShallow({
177
- md: {
178
- cols: 0,
179
- offset: 0
180
- }
181
- });
182
- expect(el.hasClass('ffe-grid__col--md-offset-0')).toBe(true);
183
- expect(el.hasClass('ffe-grid__col--md-0')).toBe(true);
184
- });
185
- it('can render with offset 1 and columns 1', function () {
186
- var el = renderShallow({
187
- md: {
188
- cols: 1,
189
- offset: 1
190
- }
191
- });
192
- expect(el.hasClass('ffe-grid__col--md-offset-1')).toBe(true);
193
- expect(el.hasClass('ffe-grid__col--md-1')).toBe(true);
194
- });
195
- it('defaults to sm={12} if no dimensions are provided', function () {
196
- var el = renderShallow();
197
- expect(el.hasClass('ffe-grid__col--sm-12')).toBe(true);
198
- });
199
- it('defaults to not setting the "--no-bottom-padding" modifier', function () {
200
- var el = renderShallow();
201
- expect(el.hasClass('ffe-grid__col--no-bottom-padding')).toBe(false);
202
- });
203
- it('sets the "--no-bottom-padding" modifier if "bottomPadding" prop is false', function () {
204
- var el = renderShallow({
205
- bottomPadding: false
206
- });
207
- expect(el.hasClass('ffe-grid__col--no-bottom-padding')).toBe(true);
208
- });
209
- describe('when mounting', function () {
210
- beforeEach(function () {
211
- console.error = jest.fn();
212
- });
213
- afterEach(function () {
214
- return console.error.mockRestore();
215
- });
216
- it('warns about using deprecated props on GridCol', function () {
217
- mount( /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, {
218
- vertical: true
219
- }))));
220
- expect(console.error).toHaveBeenCalled();
221
- expect(console.error.mock.calls.map(function (call) {
222
- return call[0];
223
- })).toContain('`<GridCol vertical={true} />` is the default behavior. You can safely remove this prop.');
224
- });
225
- it('warns about nested <GridCol> tag', function () {
226
- mount( /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement("div", null, "hadoken")))))))));
227
- expect(console.error).toHaveBeenCalledTimes(1);
228
- expect(console.error.mock.calls[0][0]).toContain('<GridCol />');
229
- });
230
- it('does not warn about nested <GridCol> tags inside an <InlineGrid> tag', function () {
231
- mount( /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement(InlineGrid, null, /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, null)))));
232
- expect(console.error).not.toHaveBeenCalled();
233
- });
234
- it('does not blow up if a null-child is received', function () {
235
- // The below inline check on "false" will result in the outer <GridCol>
236
- // receiving children as an array-like of [<GridCol />, null] which it needs
237
- // to handle when checking for nesten grid columns.
238
- mount( /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement(GridCol, null), false && /*#__PURE__*/React.createElement(GridCol, null)));
239
- });
240
- describe('checks cols and offset validity', function () {
241
- console.error = jest.fn();
242
-
243
- var renderWithModifier = function renderWithModifier(modifier) {
244
- var Component = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Grid;
245
- return mount( /*#__PURE__*/React.createElement(Component, null, /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, modifier))));
246
- };
247
-
248
- it('does not warn about valid columns and offsets for "lg" screens', function () {
249
- renderWithModifier({
250
- lg: {
251
- cols: 9,
252
- offset: 3
253
- }
254
- });
255
- renderWithModifier({
256
- lg: {
257
- cols: 1,
258
- offset: 11
259
- }
260
- });
261
- renderWithModifier({
262
- lg: {
263
- cols: 6,
264
- offset: 6
265
- }
266
- });
267
- expect(console.error).not.toHaveBeenCalled();
268
- });
269
- it('does not warn about valid columns and offsets for "md" screens', function () {
270
- renderWithModifier({
271
- md: {
272
- cols: 6,
273
- offset: 4
274
- }
275
- });
276
- renderWithModifier({
277
- md: {
278
- cols: 12,
279
- offset: 0
280
- }
281
- });
282
- renderWithModifier({
283
- md: {
284
- cols: 2,
285
- offset: 8
286
- }
287
- });
288
- renderWithModifier({
289
- md: 6
290
- });
291
- expect(console.error).not.toHaveBeenCalled();
292
- });
293
- it('does not warn about valid columns and offsets for "sm" screens', function () {
294
- renderWithModifier({
295
- sm: {
296
- cols: 6,
297
- offset: 6
298
- }
299
- });
300
- renderWithModifier({
301
- sm: {
302
- cols: 3,
303
- offset: 3
304
- }
305
- });
306
- renderWithModifier({
307
- sm: {
308
- cols: 12,
309
- offset: 0
310
- }
311
- });
312
- renderWithModifier({
313
- sm: 12
314
- });
315
- expect(console.error).not.toHaveBeenCalled();
316
- });
317
- it('warns about not sticking to 6 columns on "md" screens for objects', function () {
318
- renderWithModifier({
319
- md: {
320
- cols: 1,
321
- offset: 1
322
- }
323
- });
324
- expect(console.error).toHaveBeenCalledTimes(1);
325
- expect(console.error.mock.calls[0][0]).toContain('For "md" screensizes, both cols and offset should be multiples of 2');
326
- });
327
- it('warns about not sticking to 6 columns on "md" screens for numbers', function () {
328
- renderWithModifier({
329
- md: 9
330
- });
331
- expect(console.error).toHaveBeenCalledTimes(1);
332
- expect(console.error.mock.calls[0][0]).toContain('For "md" screensizes, both cols and offset should be multiples of 2');
333
- });
334
- it('warns about not sticking to 4 columns on "sm" screens for objects', function () {
335
- renderWithModifier({
336
- sm: {
337
- cols: 11,
338
- offset: 1
339
- }
340
- });
341
- expect(console.error).toHaveBeenCalledTimes(1);
342
- expect(console.error.mock.calls[0][0]).toContain('For "sm" screensizes, both cols and offset should be multiples of 3');
343
- });
344
- it('warns about not sticking to 4 columns on "sm" screens for numbers', function () {
345
- renderWithModifier({
346
- sm: 5
347
- });
348
- expect(console.error).toHaveBeenCalledTimes(1);
349
- expect(console.error.mock.calls[0][0]).toContain('For "sm" screensizes, both cols and offset should be multiples of 3');
350
- });
351
- describe('when nested inside an inline grid', function () {
352
- it('does not warn about usage of cols and offsets', function () {
353
- renderWithModifier({
354
- sm: 5
355
- }, InlineGrid);
356
- expect(console.error).not.toHaveBeenCalled();
357
- });
358
- });
359
- });
360
- });
361
- });
@@ -1,121 +0,0 @@
1
- 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); }
2
-
3
- import React from 'react';
4
- import { mount, shallow } from 'enzyme';
5
- import { GridRow, GridCol } from '.';
6
- import backgroundColors from './background-colors';
7
- import InlineGrid from './InlineGrid';
8
- var defaultProps = {
9
- children: /*#__PURE__*/React.createElement("p", null, "blah")
10
- };
11
-
12
- var renderShallow = function renderShallow() {
13
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
- return shallow( /*#__PURE__*/React.createElement(GridRow, _extends({}, defaultProps, props)));
15
- };
16
-
17
- describe('GridRow', function () {
18
- it('renders with default class and element', function () {
19
- var el = renderShallow();
20
- expect(el.prop('className')).toBe('ffe-grid__row');
21
- expect(el.type()).toBe('div');
22
- });
23
- it('renders with custom class', function () {
24
- var el = renderShallow({
25
- className: 'custom-class'
26
- });
27
- expect(el.hasClass('custom-class')).toBe(true);
28
- });
29
- it('renders provided children node', function () {
30
- var el = renderShallow();
31
- expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
32
- });
33
- it('sets the reverse modifier', function () {
34
- var el = renderShallow({
35
- reverse: true
36
- });
37
- expect(el.hasClass('ffe-grid__row')).toBe(true);
38
- expect(el.hasClass('ffe-grid__row--reverse')).toBe(true);
39
- });
40
- it('adds correct class for all valid background colors', function () {
41
- var el = renderShallow();
42
- backgroundColors.forEach(function (background) {
43
- el.setProps({
44
- background: background
45
- });
46
- expect(el.hasClass("ffe-grid__row--bg-".concat(background))).toBe(true);
47
- });
48
- });
49
- it('does not add any background-class for invalid background colors', function () {
50
- var el = renderShallow();
51
- console.error = jest.fn();
52
- ['illegal', 'color values', 'are ignored'].forEach(function (background) {
53
- el.setProps({
54
- background: background
55
- });
56
- expect(el.hasClass("ffe-grid__row--bg-".concat(background))).toBe(false);
57
- });
58
- });
59
- it('throws for removed background colours', function () {
60
- expect(function () {
61
- return renderShallow({
62
- background: 'blue-cobalt'
63
- });
64
- }).toThrow('Support for the blue-cobalt background on <GridRow> has been removed, please see the CHANGELOG');
65
- });
66
- it('renders coloured rows with extra wrappers', function () {
67
- backgroundColors.forEach(function (background) {
68
- var el = renderShallow({
69
- background: background,
70
- children: /*#__PURE__*/React.createElement(GridCol, {
71
- lg: 12
72
- }, /*#__PURE__*/React.createElement("p", null, "blah"))
73
- });
74
- expect(el.childAt(0).hasClass('ffe-grid__row-wrapper')).toBe(true);
75
- });
76
- });
77
- it('sets the topPadding modifier', function () {
78
- var el = renderShallow({
79
- topPadding: true
80
- });
81
- expect(el.hasClass('ffe-grid__row')).toBe(true);
82
- expect(el.hasClass('ffe-grid__row--top-padding')).toBe(true);
83
- });
84
- it('preserves other attributes that are passed to it', function () {
85
- var handler = jest.fn();
86
- var el = renderShallow({
87
- onClick: handler
88
- });
89
- el.simulate('click');
90
- expect(handler).toHaveBeenCalledTimes(1);
91
- });
92
- it('can render a custom root element', function () {
93
- var el = renderShallow({
94
- element: 'section'
95
- });
96
- expect(el.type()).toBe('section');
97
- });
98
- describe('when mounting', function () {
99
- beforeEach(function () {
100
- global.console.error = jest.fn();
101
- });
102
- afterEach(function () {
103
- return global.console.error.mockRestore();
104
- });
105
- it('warns about nested <GridRow> tag', function () {
106
- mount( /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(GridRow, null)))))));
107
- expect(console.error).toHaveBeenCalledTimes(1);
108
- expect(console.error.mock.calls[0][0]).toContain('<GridRow />');
109
- });
110
- it('does not warn about nested <GridRow> tags inside an <InlineGrid> tag', function () {
111
- mount( /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement(InlineGrid, null, /*#__PURE__*/React.createElement(GridRow, null)))));
112
- expect(console.error).not.toHaveBeenCalled();
113
- });
114
- it('does not blow up if a null-child is received', function () {
115
- // The below inline check on "false" will result in the outer <GridRow>
116
- // receiving children as an array-like of [<GridRow />, null] which it needs
117
- // to handle when checking for nesten grid rows.
118
- mount( /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridRow, null), false && /*#__PURE__*/React.createElement(GridRow, null)));
119
- });
120
- });
121
- });
@@ -1,62 +0,0 @@
1
- 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); }
2
-
3
- import React from 'react';
4
- import { mount, shallow } from 'enzyme';
5
- import { Grid, GridRow, GridCol, InlineGrid } from '.';
6
- var defaultProps = {
7
- children: /*#__PURE__*/React.createElement("p", null, "blah")
8
- };
9
-
10
- var renderShallow = function renderShallow() {
11
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
- return shallow( /*#__PURE__*/React.createElement(InlineGrid, _extends({}, defaultProps, props)));
13
- };
14
-
15
- describe('InlineGrid', function () {
16
- it('renders with default class and element', function () {
17
- var el = renderShallow();
18
- expect(el.hasClass('ffe-grid--inline')).toBe(true);
19
- expect(el.type()).toBe('div');
20
- });
21
- it('renders with custom class', function () {
22
- var el = renderShallow({
23
- className: 'custom-class'
24
- });
25
- expect(el.hasClass('custom-class')).toBe(true);
26
- });
27
- it('renders provided children node', function () {
28
- var el = renderShallow();
29
- expect(el.containsMatchingElement( /*#__PURE__*/React.createElement("p", null, "blah"))).toBe(true);
30
- });
31
- it('preserves other attributes that are passed to it', function () {
32
- var handler = jest.fn();
33
- var el = renderShallow({
34
- onClick: handler
35
- });
36
- el.simulate('click');
37
- expect(handler).toHaveBeenCalledTimes(1);
38
- });
39
- it('can render a custom root element', function () {
40
- var el = renderShallow({
41
- element: 'section'
42
- });
43
- expect(el.type()).toBe('section');
44
- });
45
- describe('when mounting', function () {
46
- beforeEach(function () {
47
- global.console.error = jest.fn();
48
- });
49
- afterEach(function () {
50
- return global.console.error.mockRestore();
51
- });
52
- it('warns about a <Grid> inside an <InlineGrid>', function () {
53
- mount( /*#__PURE__*/React.createElement(InlineGrid, null, /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement(Grid, null)))));
54
- expect(console.error).toHaveBeenCalled();
55
- expect(console.error.mock.calls[0][0]).toContain('InlineGrid');
56
- });
57
- it('allows an <InlineGrid> inside another <InlineGrid>', function () {
58
- mount( /*#__PURE__*/React.createElement(InlineGrid, null, /*#__PURE__*/React.createElement(GridRow, null, /*#__PURE__*/React.createElement(GridCol, null, /*#__PURE__*/React.createElement(InlineGrid, null)))));
59
- expect(console.error).not.toHaveBeenCalled();
60
- });
61
- });
62
- });
package/es/utils.dev.js DELETED
@@ -1,73 +0,0 @@
1
- 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); }
2
-
3
- import React from 'react';
4
- var ALLOWED_NESTED_COMPONENTS = ['InlineGrid'];
5
-
6
- var checkForNestedComponent = function checkForNestedComponent(children, Component, componentName) {
7
- return React.Children.forEach(children, function (child) {
8
- if (!child || child.type && child.type.name && ALLOWED_NESTED_COMPONENTS.some(function (c) {
9
- return c === child.type.name;
10
- })) {
11
- return;
12
- } else if (child.type === Component) {
13
- 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 "));
14
- } else if (child.props && child.props.children) {
15
- return checkForNestedComponent(child.props.children, Component, componentName);
16
- }
17
- });
18
- };
19
-
20
- var DEPRECATED_MODIFIERS = {
21
- vertical: '`<GridCol vertical={true} />` is the default behavior. You can safely remove this prop.'
22
- };
23
-
24
- var checkForDeprecatedModifiers = function checkForDeprecatedModifiers(props) {
25
- Object.keys(props).filter(function (propName) {
26
- return DEPRECATED_MODIFIERS[propName];
27
- }).forEach(function (propName) {
28
- return console.error(DEPRECATED_MODIFIERS[propName]);
29
- });
30
- };
31
-
32
- var checkValidMdColumns = function checkValidMdColumns(modifier) {
33
- var total = _typeof(modifier) === 'object' ? modifier.cols + modifier.offset : modifier;
34
-
35
- if (!(total % 2 === 0 && (modifier.cols || 0) % 2 === 0 && (modifier.offset || 0) % 2 === 0)) {
36
- 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 "));
37
- }
38
- };
39
-
40
- var checkValidSmColumns = function checkValidSmColumns(modifier) {
41
- var total = _typeof(modifier) === 'object' ? modifier.cols + modifier.offset : modifier;
42
-
43
- if (!(total % 3 === 0 && (modifier.cols || 0) % 3 === 0 && (modifier.offset || 0) % 3 === 0)) {
44
- 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 "));
45
- }
46
- };
47
-
48
- var checkValidColumnCount = function checkValidColumnCount(_ref, domNode) {
49
- var sm = _ref.sm,
50
- md = _ref.md;
51
-
52
- if (domNode) {
53
- var parent = domNode.parentElement;
54
-
55
- while (parent) {
56
- if (parent.className.indexOf('--inline') !== -1) {
57
- return;
58
- }
59
-
60
- parent = parent.parentElement;
61
- }
62
- }
63
-
64
- if (md) {
65
- checkValidMdColumns(md);
66
- }
67
-
68
- if (sm) {
69
- checkValidSmColumns(sm);
70
- }
71
- };
72
-
73
- export { checkForDeprecatedModifiers, checkForNestedComponent, checkValidColumnCount };
package/es/utils.js DELETED
@@ -1,12 +0,0 @@
1
- /* istanbul ignore if: I don't see any good way of getting around NODE_ENV */
2
- if (process.env.NODE_ENV === 'production') {
3
- var emptyFn = function emptyFn() {};
4
-
5
- module.exports = {
6
- checkForDeprecatedModifiers: emptyFn,
7
- checkForNestedComponent: emptyFn,
8
- checkValidColumnCount: emptyFn
9
- };
10
- } else {
11
- module.exports = require('./utils.dev');
12
- }