@flodesk/grain 11.0.4 → 11.0.6

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.
@@ -32,8 +32,6 @@ import PropTypes from 'prop-types';
32
32
  import { generateAttributes } from '../utilities';
33
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
34
34
  export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
35
- var _objectSpread2;
36
-
37
35
  var color = _ref.color,
38
36
  colorHover = _ref.colorHover,
39
37
  backgroundColor = _ref.backgroundColor,
@@ -140,9 +138,15 @@ export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
140
138
  opacity: opacity,
141
139
  opacityHover: opacityHover
142
140
  }, sharedProps),
143
- classNameProps: _objectSpread((_objectSpread2 = {
144
- position: position
145
- }, _defineProperty(_objectSpread2, "position", position), _defineProperty(_objectSpread2, "overflow", overflow), _defineProperty(_objectSpread2, "cursor", cursor), _defineProperty(_objectSpread2, "borderWidth", borderWidth), _defineProperty(_objectSpread2, "borderSide", borderSide), _objectSpread2), sharedProps)
141
+ classNameProps: _objectSpread({
142
+ position: position,
143
+ cursor: cursor,
144
+ borderWidth: borderWidth,
145
+ borderSide: borderSide,
146
+ overflow: overflow,
147
+ overflowX: overflowX,
148
+ overflowY: overflowY
149
+ }, sharedProps)
146
150
  });
147
151
  var classAttributes = "".concat(attributes.classNames, " ").concat(propClassName).trim();
148
152
 
@@ -0,0 +1,50 @@
1
+ import _styled from "@emotion/styled/base";
2
+ var _excluded = ["children", "gap"];
3
+
4
+ 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); }
5
+
6
+ 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; }
7
+
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
+
10
+ import "core-js/modules/es.array.includes.js";
11
+ import "core-js/modules/es.object.keys.js";
12
+ import "core-js/modules/es.array.index-of.js";
13
+ import "core-js/modules/es.symbol.js";
14
+ import "core-js/modules/es.object.assign.js";
15
+ import { getResponsiveSpace } from '../utilities';
16
+ import PropTypes from 'prop-types';
17
+ import React, { forwardRef } from 'react';
18
+ import { types } from '../types';
19
+ import { Box } from './box';
20
+ import { jsx as ___EmotionJSX } from "@emotion/react";
21
+
22
+ var Root = /*#__PURE__*/_styled(Box, process.env.NODE_ENV === "production" ? {
23
+ shouldForwardProp: function shouldForwardProp(prop) {
24
+ return !['gap'].includes(prop);
25
+ },
26
+ target: "e17bgatr0"
27
+ } : {
28
+ shouldForwardProp: function shouldForwardProp(prop) {
29
+ return !['gap'].includes(prop);
30
+ },
31
+ target: "e17bgatr0",
32
+ label: "Root"
33
+ })("&>*+*{", function (p) {
34
+ return getResponsiveSpace('margin-top', p.gap);
35
+ }, ";}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb25lbnRzL3N0YWNrLmpzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPZ0YiLCJmaWxlIjoiLi4vLi4vc3JjL2NvbXBvbmVudHMvc3RhY2suanN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZ2V0UmVzcG9uc2l2ZVNwYWNlIH0gZnJvbSAnLi4vdXRpbGl0aWVzJztcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcyc7XG5pbXBvcnQgUmVhY3QsIHsgZm9yd2FyZFJlZiB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IHR5cGVzIH0gZnJvbSAnLi4vdHlwZXMnO1xuaW1wb3J0IHsgQm94IH0gZnJvbSAnLi9ib3gnO1xuXG5jb25zdCBSb290ID0gc3R5bGVkKEJveCwgeyBzaG91bGRGb3J3YXJkUHJvcDogcHJvcCA9PiAhWydnYXAnXS5pbmNsdWRlcyhwcm9wKSB9KWBcbiAgJiA+ICogKyAqIHtcbiAgICAke3AgPT4gZ2V0UmVzcG9uc2l2ZVNwYWNlKCdtYXJnaW4tdG9wJywgcC5nYXApfTtcbiAgfVxuYDtcblxuZXhwb3J0IGNvbnN0IFN0YWNrID0gZm9yd2FyZFJlZigoeyBjaGlsZHJlbiwgZ2FwLCAuLi5wcm9wcyB9LCByZWYpID0+IChcbiAgPFJvb3QgcmVmPXtyZWZ9IGdhcD17Z2FwfSB7Li4ucHJvcHN9PlxuICAgIHtjaGlsZHJlbn1cbiAgPC9Sb290PlxuKSk7XG5cblN0YWNrLnByb3BUeXBlcyA9IHtcbiAgY2hpbGRyZW46IFByb3BUeXBlcy5ub2RlLFxuICBnYXA6IHR5cGVzLnJlc3BvbnNpdmVTcGFjZSxcbn07XG4iXX0= */"));
36
+
37
+ export var Stack = /*#__PURE__*/forwardRef(function (_ref, ref) {
38
+ var children = _ref.children,
39
+ gap = _ref.gap,
40
+ props = _objectWithoutProperties(_ref, _excluded);
41
+
42
+ return ___EmotionJSX(Root, _extends({
43
+ ref: ref,
44
+ gap: gap
45
+ }, props), children);
46
+ });
47
+ Stack.propTypes = {
48
+ children: PropTypes.node,
49
+ gap: types.responsiveSpace
50
+ };
@@ -24,7 +24,11 @@ import "core-js/modules/es.array.slice.js";
24
24
  import "core-js/modules/es.array.from.js";
25
25
  import "core-js/modules/es.regexp.exec.js";
26
26
  import { getCssVar, isNumber, isString, u, isObject } from '.';
27
- import { vars, varInfo } from '../variables';
27
+ import { vars, varInfo, breakpoints } from '../variables';
28
+ var mediaQueries = {
29
+ mobile: "@media (max-width: ".concat(breakpoints.mobile, "px)"),
30
+ tablet: "@media (max-width: ".concat(breakpoints.tablet, "px)")
31
+ };
28
32
  export var getMediaCss = function getMediaCss(mediaQuery, property, value) {
29
33
  var getValue = function getValue(val) {
30
34
  if (val === 0) return '0';
@@ -36,7 +40,11 @@ export var getMediaCss = function getMediaCss(mediaQuery, property, value) {
36
40
  return "".concat(property, ": ").concat(getValue(value), ";");
37
41
  }
38
42
 
39
- return "\n ".concat(mediaQuery, " {\n ").concat(property, ": ").concat(getValue(value), ";\n }\n ");
43
+ if (mediaQuery in mediaQueries) {
44
+ return "\n ".concat(mediaQueries[mediaQuery], " {\n ").concat(property, ": ").concat(getValue(value), ";\n }\n ");
45
+ } else {
46
+ return "\n ".concat(mediaQuery, " {\n ").concat(property, ": ").concat(getValue(value), ";\n }\n ");
47
+ }
40
48
  };
41
49
  export var mapObjToMedia = function mapObjToMedia(property, obj, type) {
42
50
  var checkValueInVars = function checkValueInVars(value) {
@@ -120,10 +120,6 @@ export var styleConfig = {
120
120
  propName: 'columnGap',
121
121
  property: 'column-gap',
122
122
  short: 'cg'
123
- }, {
124
- propName: 'stackGap',
125
- property: '--stackGap',
126
- short: 'sg'
127
123
  }],
128
124
  valueTransformer: getSpace,
129
125
  variableChecker: isSpaceVar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "11.0.4",
3
+ "version": "11.0.6",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",
@@ -1,68 +0,0 @@
1
- import "core-js/modules/es.object.keys.js";
2
- import "core-js/modules/es.array.index-of.js";
3
- import "core-js/modules/es.symbol.js";
4
- import "core-js/modules/es.object.define-property.js";
5
- import "core-js/modules/es.array.filter.js";
6
- import "core-js/modules/es.object.to-string.js";
7
- import "core-js/modules/es.object.get-own-property-descriptor.js";
8
- import "core-js/modules/web.dom-collections.for-each.js";
9
- import "core-js/modules/es.object.get-own-property-descriptors.js";
10
- import "core-js/modules/es.object.define-properties.js";
11
- import "core-js/modules/es.object.assign.js";
12
- var _excluded = ["children", "gap", "style", "className"];
13
-
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
-
16
- import "core-js/modules/es.regexp.exec.js";
17
- import "core-js/modules/es.string.replace.js";
18
- import "core-js/modules/es.string.trim.js";
19
- import "core-js/modules/es.array.concat.js";
20
-
21
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
-
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
-
25
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
-
27
- 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; }
28
-
29
- 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; }
30
-
31
- import PropTypes from 'prop-types';
32
- import React, { forwardRef } from 'react';
33
- import { types } from '../../types';
34
- import { Box } from '../box';
35
- import { generateAttributes } from '../../utilities';
36
- import styles from './styles.module.css';
37
- import { jsx as ___EmotionJSX } from "@emotion/react";
38
- export var Stack = /*#__PURE__*/forwardRef(function (_ref, ref) {
39
- var children = _ref.children,
40
- stackGap = _ref.gap,
41
- style = _ref.style,
42
- className = _ref.className,
43
- props = _objectWithoutProperties(_ref, _excluded);
44
-
45
- var propClassName = className ? className : '';
46
- var propStyle = style ? style : {};
47
- var attributes = generateAttributes({
48
- styleProps: {
49
- stackGap: stackGap
50
- },
51
- classNameProps: {
52
- stackGap: stackGap
53
- }
54
- });
55
-
56
- var styleAttributes = _objectSpread(_objectSpread({}, attributes.styles), propStyle);
57
-
58
- var classAttributes = "".concat(propClassName, " ").concat(attributes.classNames, " ").concat(styles.stack).trim().replace(/\s+/g, ' ');
59
- return ___EmotionJSX(Box, _extends({
60
- ref: ref,
61
- style: styleAttributes,
62
- className: classAttributes
63
- }, props), children);
64
- });
65
- Stack.propTypes = {
66
- children: PropTypes.node,
67
- gap: types.responsiveSpace
68
- };
@@ -1,3 +0,0 @@
1
- .stack > *:not(:last-child) {
2
- margin-bottom: var(--stackGap);
3
- }