UNPKG

23.3 kBJavaScriptView Raw
1import { createContext, useContext, createElement, forwardRef, useMemo, useState } from 'react';
2
3function createNullCache() {
4 return {
5 get: function get() {
6 return undefined;
7 },
8 set: function set(_, value) {
9 return value;
10 }
11 };
12}
13
14function createSimpleCache() {
15 var recs = {};
16 return {
17 get: function get(name) {
18 return recs[name];
19 },
20 set: function set(name, value) {
21 recs[name] = value;
22 return value;
23 }
24 };
25}
26
27function _typeof(obj) {
28 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
29 _typeof = function (obj) {
30 return typeof obj;
31 };
32 } else {
33 _typeof = function (obj) {
34 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
35 };
36 }
37
38 return _typeof(obj);
39}
40
41function _defineProperty(obj, key, value) {
42 if (key in obj) {
43 Object.defineProperty(obj, key, {
44 value: value,
45 enumerable: true,
46 configurable: true,
47 writable: true
48 });
49 } else {
50 obj[key] = value;
51 }
52
53 return obj;
54}
55
56function _objectSpread(target) {
57 for (var i = 1; i < arguments.length; i++) {
58 var source = arguments[i] != null ? arguments[i] : {};
59 var ownKeys = Object.keys(source);
60
61 if (typeof Object.getOwnPropertySymbols === 'function') {
62 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
63 return Object.getOwnPropertyDescriptor(source, sym).enumerable;
64 }));
65 }
66
67 ownKeys.forEach(function (key) {
68 _defineProperty(target, key, source[key]);
69 });
70 }
71
72 return target;
73}
74
75function _objectWithoutPropertiesLoose(source, excluded) {
76 if (source == null) return {};
77 var target = {};
78 var sourceKeys = Object.keys(source);
79 var key, i;
80
81 for (i = 0; i < sourceKeys.length; i++) {
82 key = sourceKeys[i];
83 if (excluded.indexOf(key) >= 0) continue;
84 target[key] = source[key];
85 }
86
87 return target;
88}
89
90function _objectWithoutProperties(source, excluded) {
91 if (source == null) return {};
92
93 var target = _objectWithoutPropertiesLoose(source, excluded);
94
95 var key, i;
96
97 if (Object.getOwnPropertySymbols) {
98 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
99
100 for (i = 0; i < sourceSymbolKeys.length; i++) {
101 key = sourceSymbolKeys[i];
102 if (excluded.indexOf(key) >= 0) continue;
103 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
104 target[key] = source[key];
105 }
106 }
107
108 return target;
109}
110
111function _slicedToArray(arr, i) {
112 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
113}
114
115function _toConsumableArray(arr) {
116 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
117}
118
119function _arrayWithoutHoles(arr) {
120 if (Array.isArray(arr)) {
121 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
122
123 return arr2;
124 }
125}
126
127function _arrayWithHoles(arr) {
128 if (Array.isArray(arr)) return arr;
129}
130
131function _iterableToArray(iter) {
132 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
133}
134
135function _iterableToArrayLimit(arr, i) {
136 var _arr = [];
137 var _n = true;
138 var _d = false;
139 var _e = undefined;
140
141 try {
142 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
143 _arr.push(_s.value);
144
145 if (i && _arr.length === i) break;
146 }
147 } catch (err) {
148 _d = true;
149 _e = err;
150 } finally {
151 try {
152 if (!_n && _i["return"] != null) _i["return"]();
153 } finally {
154 if (_d) throw _e;
155 }
156 }
157
158 return _arr;
159}
160
161function _nonIterableSpread() {
162 throw new TypeError("Invalid attempt to spread non-iterable instance");
163}
164
165function _nonIterableRest() {
166 throw new TypeError("Invalid attempt to destructure non-iterable instance");
167}
168
169var DesignSystemContext = createContext({});
170
171function useDesignSystem() {
172 return useContext(DesignSystemContext);
173}
174
175function useStyle(componentName, props, options) {
176 var ds = useDesignSystem();
177 return ds.applyStyles(componentName, props, options);
178}
179
180function arrayize(val) {
181 if (Array.isArray(val)) {
182 return val;
183 }
184
185 return [val];
186}
187
188function cleanProps(props, blacklist) {
189 return Object.keys(props).reduce(function (result, propName) {
190 if (blacklist.includes(propName)) {
191 return result;
192 }
193
194 return _objectSpread({}, result, _defineProperty({}, propName, props[propName]));
195 }, {});
196}
197
198function convertUnit(unit) {
199 var multiplier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
200 var unitType = arguments.length > 2 ? arguments[2] : undefined;
201 var num = Number(unit);
202
203 if (Number.isNaN(num)) {
204 return unit.replace(/^(-?\d+(?:\.\d+)?)(?:\s*([a-zA-Z%]+))?$/, function (_, parsedNumber, parsedUnit) {
205 return convertUnit(parsedNumber, multiplier, parsedUnit);
206 });
207 }
208
209 var isInt = Number.isInteger(num);
210
211 if (isInt) {
212 return "".concat(num * multiplier).concat(unitType || 'px');
213 } else if (unitType != null) {
214 return "".concat(num * multiplier).concat(unitType);
215 }
216
217 return "".concat(num * multiplier * 100, "%");
218}
219
220function getResponsiveValue(breakpoint, value, defaultValue) {
221 var defaultLength = Array.isArray(defaultValue) ? defaultValue.length : defaultValue !== undefined ? 1 : 0;
222 var valueLength = value.length;
223 var maxLength = Math.max(valueLength, defaultLength);
224 var currentValue;
225 var currentDefault;
226
227 if (value[breakpoint] === null) {
228 return null;
229 }
230
231 if (defaultValue === undefined) {
232 for (var i = 0; i < valueLength; i++) {
233 currentValue = value[i] === undefined ? currentValue : value[i];
234
235 if (i === breakpoint) {
236 break;
237 }
238 }
239
240 return currentValue === undefined ? null : currentValue;
241 }
242
243 var defaultValues = Array.isArray(defaultValue) ? defaultValue : Array(maxLength).fill(defaultValue);
244
245 for (var _i = 0; _i < maxLength; _i++) {
246 currentDefault = defaultValues[_i] === undefined ? currentDefault : defaultValues[_i];
247 currentValue = value[_i] === null ? null : value[_i] === undefined ? currentDefault : value[_i];
248
249 if (_i === breakpoint) {
250 break;
251 }
252 }
253
254 return currentValue === undefined ? null : currentValue;
255}
256
257function createComponentFactory(_ref) {
258 var createStyle = _ref.createStyle;
259 return function createComponent(componentName, component) {
260 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
261 var _options$cacheProps = options.cacheProps,
262 cacheProps = _options$cacheProps === void 0 ? [] : _options$cacheProps,
263 _options$stripProps = options.stripProps,
264 stripProps = _options$stripProps === void 0 ? [] : _options$stripProps,
265 style = options.style,
266 _options$styles = options.styles,
267 styles = _options$styles === void 0 ? [] : _options$styles;
268 var opts = {
269 cacheProps: cacheProps,
270 stripProps: stripProps,
271 styles: styles
272 };
273
274 if (style) {
275 opts.styles = [createStyle(cacheProps, style, stripProps)].concat(_toConsumableArray(styles));
276 }
277
278 if (styles) {
279 styles.forEach(function (styler) {
280 var _opts$cacheProps, _opts$stripProps;
281
282 (_opts$cacheProps = opts.cacheProps).push.apply(_opts$cacheProps, _toConsumableArray(styler.propNames));
283
284 (_opts$stripProps = opts.stripProps).push.apply(_opts$stripProps, _toConsumableArray(styler.stripProps));
285 });
286 }
287
288 var factory = forwardRef(function (_ref2, ref) {
289 var _ref2$as = _ref2.as,
290 as = _ref2$as === void 0 ? component : _ref2$as,
291 restProps = _objectWithoutProperties(_ref2, ["as"]);
292
293 var isDsComp = typeof as !== 'string' && as.$$nprdds;
294 var props = useStyle(componentName, restProps, _objectSpread({}, opts, {
295 passthrough: isDsComp
296 }));
297 return createElement(as, _objectSpread({}, isDsComp ? props : cleanProps(props, props.stripProps), {
298 ref: ref
299 }));
300 });
301 factory.displayName = componentName;
302 factory.$$nprdds = true;
303 return factory;
304 };
305}
306
307function formatStyleResult(value, cssAttributes, formatter) {
308 if (value == null) {
309 return {};
310 }
311
312 var formattedValue = formatter(value);
313
314 if (cssAttributes.length === 1) {
315 return _defineProperty({}, cssAttributes[0], formattedValue);
316 }
317
318 return cssAttributes.reduce(function (res, attrName) {
319 return _objectSpread({}, res, _defineProperty({}, attrName, formattedValue));
320 }, {});
321}
322
323function createSimpleStyle(propName, cssAttribute, formatter, defaultValue) {
324 var cssAttributes = Array.isArray(cssAttribute) ? cssAttribute : [cssAttribute];
325 return {
326 apply: function apply(props, _ref) {
327 var bp = _ref.viewport;
328 var propValue = arrayize(props[propName]);
329 var bpValue = getResponsiveValue(bp, propValue, defaultValue);
330 return formatStyleResult(bpValue, cssAttributes, formatter);
331 },
332 propNames: [propName],
333 stripProps: [propName]
334 };
335}
336function createNumericStyle(propName, cssAttribute, defaultValue) {
337 return createSimpleStyle(propName, cssAttribute, convertUnit, defaultValue);
338}
339function createStringStyle(propName, cssAttribute, defaultValue) {
340 return createSimpleStyle(propName, cssAttribute, function (val) {
341 return val;
342 }, defaultValue);
343}
344
345function createSystemStyle(propName, cssAttribute, systemName, formatter, defaultValue) {
346 var cssAttributes = arrayize(cssAttribute);
347 return {
348 apply: function apply(props, _ref) {
349 var theme = _ref.theme,
350 bp = _ref.viewport;
351 var propValue = arrayize(props[propName]);
352 var systemValue = theme.get(systemName);
353 var bpValue = getResponsiveValue(bp, propValue, defaultValue);
354
355 if (bpValue == null) {
356 return formatStyleResult(null, cssAttributes, formatter);
357 }
358
359 var bpValueNum = Number(bpValue);
360 var isNegativeInt = !Number.isNaN(bpValueNum) && Number.isInteger(bpValueNum) && bpValueNum < 0;
361 var systemBpValue = systemValue[isNegativeInt ? -bpValue : bpValue] || bpValue;
362 return formatStyleResult(isNegativeInt ? -Number(systemBpValue) : systemBpValue, cssAttributes, formatter);
363 },
364 propNames: [propName],
365 stripProps: [propName]
366 };
367}
368function createNumericSystemStyle(propName, cssAttribute, systemName, defaultValue) {
369 return createSystemStyle(propName, cssAttribute, systemName, convertUnit, defaultValue);
370}
371function createStringSystemStyle(propName, cssAttribute, systemName, defaultValue) {
372 return createSystemStyle(propName, cssAttribute, systemName, function (val) {
373 return val;
374 }, defaultValue);
375}
376function createScaledFontSizeSystemStyle(propName, defaultValue) {
377 return {
378 apply: function apply(props, _ref2) {
379 var theme = _ref2.theme,
380 bp = _ref2.viewport;
381 var sizeIndex = getResponsiveValue(bp, arrayize(props.fontSize), 0);
382 var size = theme.get('fontSizes')[sizeIndex || 0] || sizeIndex;
383 var value = getResponsiveValue(bp, arrayize(props[propName]), theme.get(propName) || defaultValue);
384
385 if (Number.isNaN(Number(value))) {
386 return _defineProperty({}, propName, value.replace(/^(-?\d+(?:\.\d+)?)(?:\s*([a-zA-Z%]+))?$/, function (_, parsedNumber, parsedUnit) {
387 return convertUnit(parsedUnit === '%' ? size : parsedNumber, parsedUnit === '%' ? parsedNumber / 100 : 1);
388 }));
389 }
390
391 return _defineProperty({}, propName, convertUnit(size, Number(value)));
392 },
393 propNames: [propName],
394 stripProps: [propName]
395 };
396}
397
398var bgColor = createStringSystemStyle('bgColor', 'backgroundColor', 'colors');
399var borderColor = createStringSystemStyle('borderColor', 'borderColor', 'colors');
400var color = createStringSystemStyle('color', 'color', 'colors');
401var opacity = createStringStyle('opacity', 'opacity');
402var shadow = createStringStyle('shadow', 'boxShadow');
403
404var borderRadius = createNumericSystemStyle('borderRadius', 'borderRadius', 'borderRadiuses');
405var borderRadiusTopLeft = createNumericSystemStyle('borderRadiusTopLeft', 'borderTopLeftRadius', 'borderRadiuses');
406var borderRadiusTopRight = createNumericSystemStyle('borderRadiusTopRight', 'borderTopRightRadius', 'borderRadiuses');
407var borderRadiusBottomLeft = createNumericSystemStyle('borderRadiusBottomLeft', 'borderBottomLeftRadius', 'borderRadiuses');
408var borderRadiusBottomRight = createNumericSystemStyle('borderRadiusBottomRight', 'borderBottomRightRadius', 'borderRadiuses');
409var borderStyle = createStringStyle('borderStyle', 'borderStyle');
410var borderWidth = createNumericStyle('borderWidth', 'borderWidth');
411var display = createStringStyle('display', 'display');
412var height = createNumericStyle('height', 'height');
413var minHeight = createNumericStyle('minHeight', 'minHeight');
414var minWidth = createNumericStyle('minWidth', 'minWidth');
415var maxHeight = createNumericStyle('maxHeight', 'maxHeight');
416var maxWidth = createNumericSystemStyle('maxWidth', 'maxWidth', 'containerSizes');
417var width = createNumericStyle('width', 'width');
418
419var alignContent = createStringStyle('alignContent', 'alignContent');
420var alignItems = createStringStyle('alignItems', 'alignItems');
421var alignSelf = createStringStyle('alignSelf', 'alignSelf');
422var flex = createStringStyle('flex', 'flex');
423var flexBasis = createNumericStyle('flexBasis', 'flexBasis');
424var flexDirection = createStringStyle('flexDirection', 'flexDirection');
425var flexGrow = createStringStyle('flexGrow', 'flexGrow');
426var flexOrder = createStringStyle('flexOrder', 'order');
427var flexShrink = createStringStyle('flexShrink', 'flexShrink');
428var flexWrap = createStringStyle('flexWrap', 'flexWrap');
429var justifyContent = createStringStyle('justifyContent', 'justifyContent');
430
431var overflow = createStringStyle('overflow', 'overflow');
432var overflowX = createStringStyle('overflowX', 'overflowX');
433var overflowY = createStringStyle('overflowY', 'overflowY');
434var transition = createStringStyle('transition', 'transition');
435
436var cursor = createStringStyle('cursor', 'cursor', null);
437var pointerEvents = createStringStyle('pointerEvents', 'pointerEvents', null);
438
439var bottom = createNumericStyle('bottom', 'bottom');
440var left = createNumericStyle('left', 'left');
441var right = createNumericStyle('right', 'right');
442var position = createStringStyle('position', 'position');
443var top = createNumericStyle('top', 'top');
444var zIndex = createStringStyle('zIndex', 'zIndex');
445
446var m = createNumericSystemStyle('m', 'margin', 'spacing');
447var mb = createNumericSystemStyle('mb', 'marginBottom', 'spacing');
448var ml = createNumericSystemStyle('ml', 'marginLeft', 'spacing');
449var mr = createNumericSystemStyle('mr', 'marginRight', 'spacing');
450var mt = createNumericSystemStyle('mt', 'marginTop', 'spacing');
451var mx = createNumericSystemStyle('mx', ['marginLeft', 'marginRight'], 'spacing');
452var my = createNumericSystemStyle('my', ['marginTop', 'marginBottom'], 'spacing');
453var p = createNumericSystemStyle('p', 'padding', 'spacing');
454var pb = createNumericSystemStyle('pb', 'paddingBottom', 'spacing');
455var pl = createNumericSystemStyle('pl', 'paddingLeft', 'spacing');
456var pr = createNumericSystemStyle('pr', 'paddingRight', 'spacing');
457var pt = createNumericSystemStyle('pt', 'paddingTop', 'spacing');
458var px = createNumericSystemStyle('px', ['paddingLeft', 'paddingRight'], 'spacing');
459var py = createNumericSystemStyle('py', ['paddingTop', 'paddingBottom'], 'spacing');
460
461var fontFamily = createStringSystemStyle('fontFamily', 'fontFamily', 'fontFamilies', 'default');
462var fontSize = createNumericSystemStyle('fontSize', 'fontSize', 'fontSizes', 0);
463var fontWeight = createStringStyle('fontWeight', 'fontWeight');
464var lineHeight = createScaledFontSizeSystemStyle('lineHeight');
465var textAlign = createStringStyle('textAlign', 'textAlign');
466var textOverflow = createStringStyle('textOverflow', 'textOverflow');
467var textTransform = createStringStyle('textTransform', 'textTransform');
468var whiteSpace = createStringStyle('whiteSpace', 'whiteSpace');
469
470
471
472var index = /*#__PURE__*/Object.freeze({
473 bgColor: bgColor,
474 borderColor: borderColor,
475 color: color,
476 opacity: opacity,
477 shadow: shadow,
478 borderRadius: borderRadius,
479 borderRadiusTopLeft: borderRadiusTopLeft,
480 borderRadiusTopRight: borderRadiusTopRight,
481 borderRadiusBottomLeft: borderRadiusBottomLeft,
482 borderRadiusBottomRight: borderRadiusBottomRight,
483 borderStyle: borderStyle,
484 borderWidth: borderWidth,
485 display: display,
486 height: height,
487 minHeight: minHeight,
488 minWidth: minWidth,
489 maxHeight: maxHeight,
490 maxWidth: maxWidth,
491 width: width,
492 alignContent: alignContent,
493 alignItems: alignItems,
494 alignSelf: alignSelf,
495 flex: flex,
496 flexBasis: flexBasis,
497 flexDirection: flexDirection,
498 flexGrow: flexGrow,
499 flexOrder: flexOrder,
500 flexShrink: flexShrink,
501 flexWrap: flexWrap,
502 justifyContent: justifyContent,
503 overflow: overflow,
504 overflowX: overflowX,
505 overflowY: overflowY,
506 transition: transition,
507 cursor: cursor,
508 pointerEvents: pointerEvents,
509 bottom: bottom,
510 left: left,
511 right: right,
512 position: position,
513 top: top,
514 zIndex: zIndex,
515 m: m,
516 mb: mb,
517 ml: ml,
518 mr: mr,
519 mt: mt,
520 mx: mx,
521 my: my,
522 p: p,
523 pb: pb,
524 pl: pl,
525 pr: pr,
526 pt: pt,
527 px: px,
528 py: py,
529 fontFamily: fontFamily,
530 fontSize: fontSize,
531 fontWeight: fontWeight,
532 lineHeight: lineHeight,
533 textAlign: textAlign,
534 textOverflow: textOverflow,
535 textTransform: textTransform,
536 whiteSpace: whiteSpace
537});
538
539var styleList = [alignContent, alignItems, alignSelf, bgColor, borderColor, borderRadius, borderStyle, borderWidth, borderRadiusBottomLeft, borderRadiusBottomRight, borderRadiusTopLeft, borderRadiusTopRight, bottom, color, cursor, display, flex, flexBasis, flexDirection, flexGrow, flexOrder, flexShrink, flexWrap, fontFamily, fontSize, fontWeight, height, justifyContent, left, lineHeight, m, mx, my, mb, ml, mr, mt, minHeight, minWidth, maxHeight, maxWidth, opacity, overflow, overflowX, overflowY, p, px, py, pt, pb, pl, pr, pointerEvents, position, right, shadow, transition, textAlign, textOverflow, textTransform, top, width, whiteSpace, zIndex];
540
541function createSystem(_ref) {
542 var cache = _ref.cache,
543 _ref$componentStyles = _ref.componentStyles,
544 componentStyles = _ref$componentStyles === void 0 ? {} : _ref$componentStyles,
545 _ref$globalStyles = _ref.globalStyles,
546 globalStyles = _ref$globalStyles === void 0 ? [] : _ref$globalStyles,
547 styleApplicatorFactory = _ref.styleApplicatorFactory,
548 theme = _ref.theme,
549 _ref$viewport = _ref.viewport,
550 viewport = _ref$viewport === void 0 ? 0 : _ref$viewport;
551
552 var _useState = useState(viewport),
553 _useState2 = _slicedToArray(_useState, 2),
554 currentViewport = _useState2[0],
555 setViewport = _useState2[1];
556
557 var styleApplicator = useMemo(function () {
558 return styleApplicatorFactory({
559 cache: cache,
560 componentStyles: componentStyles,
561 globalStyles: globalStyles
562 });
563 }, [cache, componentStyles, globalStyles]);
564 var applyStyles = useMemo(function () {
565 return function (componentName, props) {
566 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
567 return styleApplicator.apply(componentName, props, {
568 theme: theme,
569 viewport: currentViewport
570 }, options);
571 };
572 }, [currentViewport, theme]);
573 return {
574 applyStyles: applyStyles,
575 setViewport: setViewport,
576 theme: theme,
577 viewport: currentViewport
578 };
579}
580
581function createTheme(settings) {
582 return {
583 color: function color(valueOrName, defaultValueOrName) {
584 var color = settings.colors[valueOrName];
585
586 if (color == null) {
587 if (defaultValueOrName != null) {
588 return settings.colors[defaultValueOrName] || defaultValueOrName;
589 }
590
591 return valueOrName;
592 }
593
594 return color;
595 },
596 get: function get(attributeName, defaultValue) {
597 var attributeValues = settings[attributeName];
598
599 if (attributeValues == null) {
600 if (defaultValue == null) {
601 throw new Error("There is no ".concat(attributeName, " defined in theme"));
602 } else {
603 return defaultValue;
604 }
605 } else if (_typeof(attributeValues) === 'object' && !Array.isArray(attributeValues) && defaultValue != null) {
606 return attributeValues[defaultValue] || defaultValue;
607 }
608
609 return attributeValues;
610 }
611 };
612}
613
614var MOBILE_BP = "only screen";
615var TABLET_BP = "screen and (min-width: ".concat(641 / 16, "em)");
616var DESKTOP_BP = "screen and (min-width: ".concat(1025 / 16, "em)");
617var L_DESKTOP_BP = "screen and (min-width: ".concat(1280 / 16, "em)");
618var XL_DESKTOP_BP = "screen and (min-width: ".concat(1441 / 16, "em)");
619var XXL_DESKTOP_BP = "screen and (min-width: ".concat(1921 / 16, "em)");
620var colors = {
621 blue: '#3B5998',
622 green: '#3CD048',
623 greenDarker: '#54BC5D',
624 grey: '#A8A8A8',
625 greyDark: '#4A4A4A',
626 greyDarkest: '#303030',
627 greyLight: '#E7E7E7',
628 greyLighter: '#F7F7F7',
629 greyLightest: '#FFFFFF',
630 lightBlue: '#4B6EB9',
631 lightTransparent: 'rgba(255,255,255, 0.9)',
632 lighterTransparent: 'rgba(255,255,255, 0.8)',
633 orange: '#FD7400',
634 pinkDark: '#AA2554',
635 primary: '#D03C70',
636 primaryLight: '#FA4B88',
637 red: '#EA2E49',
638 turqoise: '#1E839D',
639 turqoiseDark: '#197187',
640 turqoiseLight: '#26A8C9',
641 twitter: '#1B95E0',
642 twitterLight: '#1B95E0',
643 white: '#FFFFFF',
644 yellow: '#FFE11A'
645};
646var defaultTheme = createTheme({
647 borderRadiuses: ['5px', '15px', '30px', '99999px'],
648 breakpoints: [MOBILE_BP, TABLET_BP, DESKTOP_BP, L_DESKTOP_BP, XL_DESKTOP_BP, XXL_DESKTOP_BP],
649 colors: colors,
650 containerSizes: ['100%', '100%', '968px', '1240px', '1400px'],
651 fontFamilies: {
652 default: '"Palanquin", "Helvetica", sans-serif'
653 },
654 fontSizes: [16, 20, 24, 32, 48, 64, 72],
655 gutters: [12, 12, 12],
656 importFonts: ["@import url('https://fonts.googleapis.com/css?family=Palanquin:400,500,600&subset=latin-ext')"],
657 lineHeight: 'normal',
658 spacing: [0, 4, 8, 16, 32, 64, 128, 256, 512]
659});
660
661var IfViewport = function IfViewport(_ref) {
662 var children = _ref.children,
663 gt = _ref.gt,
664 gte = _ref.gte,
665 is = _ref.is,
666 lt = _ref.lt,
667 lte = _ref.lte;
668
669 var _useDesignSystem = useDesignSystem(),
670 viewport = _useDesignSystem.viewport;
671
672 if (is != null) {
673 if (Array.isArray(is) && is.includes(viewport)) {
674 return children();
675 }
676
677 if (is === viewport) {
678 return children();
679 }
680 }
681
682 if (gt != null && viewport > gt || lt != null && viewport < lt || gte != null && viewport >= gte || lte != null && viewport <= lte) {
683 return children();
684 }
685
686 if (lt != null && viewport < lt) {
687 return children();
688 }
689
690 return null;
691};
692
693IfViewport.displayName = 'IfViewport';
694
695export { defaultTheme, DesignSystemContext, IfViewport, createComponentFactory, createNullCache, createSimpleCache, useDesignSystem, useStyle, index as styles, styleList, createSimpleStyle, createNumericStyle, createStringStyle, createSystemStyle, createNumericSystemStyle, createStringSystemStyle, createScaledFontSizeSystemStyle, createSystem, createTheme, arrayize, cleanProps, convertUnit, getResponsiveValue };