@flodesk/grain 10.10.7 → 10.10.9

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.
@@ -9,7 +9,7 @@ import "core-js/modules/web.dom-collections.for-each.js";
9
9
  import "core-js/modules/es.object.get-own-property-descriptors.js";
10
10
  import "core-js/modules/es.object.define-properties.js";
11
11
  import "core-js/modules/es.object.assign.js";
12
- var _excluded = ["color", "colorHover", "backgroundColor", "backgroundColorHover", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "radius", "padding", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "paddingX", "paddingY", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight", "marginX", "marginY", "position", "top", "bottom", "left", "right", "shadow", "shadowHover", "overflow", "overflowX", "overflowY", "aspectRatio", "zIndex", "tag", "opacity", "opacityHover", "order", "alignSelf", "flex", "transition", "transitionHover", "cursor", "children", "className", "style", "borderColor", "borderColorHover", "borderWidth", "borderWidthLeft", "borderWidthRight", "borderWidthTop", "borderWidthBottom", "borderWidthX", "borderWidthY"];
12
+ var _excluded = ["color", "colorHover", "backgroundColor", "backgroundColorHover", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "radius", "padding", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "paddingX", "paddingY", "margin", "marginTop", "marginBottom", "marginLeft", "marginRight", "marginX", "marginY", "position", "top", "bottom", "left", "right", "shadow", "shadowHover", "overflow", "overflowX", "overflowY", "aspectRatio", "zIndex", "tag", "opacity", "opacityHover", "order", "alignSelf", "flex", "transition", "transitionHover", "cursor", "children", "className", "style", "borderColor", "borderColorHover", "borderWidth", "borderSide"];
13
13
 
14
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
15
 
@@ -88,12 +88,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
88
88
  borderColor = _ref.borderColor,
89
89
  borderColorHover = _ref.borderColorHover,
90
90
  borderWidth = _ref.borderWidth,
91
- borderWidthLeft = _ref.borderWidthLeft,
92
- borderWidthRight = _ref.borderWidthRight,
93
- borderWidthTop = _ref.borderWidthTop,
94
- borderWidthBottom = _ref.borderWidthBottom,
95
- borderWidthX = _ref.borderWidthX,
96
- borderWidthY = _ref.borderWidthY,
91
+ borderSide = _ref.borderSide,
97
92
  otherProps = _objectWithoutProperties(_ref, _excluded);
98
93
 
99
94
  var styles = _objectSpread({}, generateStyleAttributes({
@@ -168,7 +163,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
168
163
  shadow: shadow,
169
164
  shadowHover: shadowHover,
170
165
  radius: radius
171
- }, _defineProperty(_generateClassNameAtt, "position", position), _defineProperty(_generateClassNameAtt, "overflow", overflow), _defineProperty(_generateClassNameAtt, "transition", transition), _defineProperty(_generateClassNameAtt, "transitionHover", transitionHover), _defineProperty(_generateClassNameAtt, "cursor", cursor), _defineProperty(_generateClassNameAtt, "alignSelf", alignSelf), _defineProperty(_generateClassNameAtt, "borderColor", borderColor), _defineProperty(_generateClassNameAtt, "borderColorHover", borderColorHover), _defineProperty(_generateClassNameAtt, "borderWidth", borderWidth), _defineProperty(_generateClassNameAtt, "borderWidthLeft", borderWidthLeft), _defineProperty(_generateClassNameAtt, "borderWidthRight", borderWidthRight), _defineProperty(_generateClassNameAtt, "borderWidthTop", borderWidthTop), _defineProperty(_generateClassNameAtt, "borderWidthBottom", borderWidthBottom), _defineProperty(_generateClassNameAtt, "borderWidthX", borderWidthX), _defineProperty(_generateClassNameAtt, "borderWidthY", borderWidthY), _generateClassNameAtt)), propClassName].join(' ').replace(/\s+/g, ' ').trim();
166
+ }, _defineProperty(_generateClassNameAtt, "position", position), _defineProperty(_generateClassNameAtt, "overflow", overflow), _defineProperty(_generateClassNameAtt, "transition", transition), _defineProperty(_generateClassNameAtt, "transitionHover", transitionHover), _defineProperty(_generateClassNameAtt, "cursor", cursor), _defineProperty(_generateClassNameAtt, "alignSelf", alignSelf), _defineProperty(_generateClassNameAtt, "borderColor", borderColor), _defineProperty(_generateClassNameAtt, "borderColorHover", borderColorHover), _defineProperty(_generateClassNameAtt, "borderWidth", borderWidth), _defineProperty(_generateClassNameAtt, "borderSide", borderSide), _generateClassNameAtt)), propClassName].join(' ').replace(/\s+/g, ' ').trim();
172
167
  var Tag = tag;
173
168
  return ___EmotionJSX(Tag, _extends({
174
169
  ref: ref,
@@ -185,12 +180,6 @@ Box2.propTypes = {
185
180
  borderColor: types.color,
186
181
  borderColorHover: types.color,
187
182
  borderWidth: types.borderWidth,
188
- borderWidthLeft: types.borderWidth,
189
- borderWidthRight: types.borderWidth,
190
- borderWidthTop: types.borderWidth,
191
- borderWidthBottom: types.borderWidth,
192
- borderWidthX: types.borderWidth,
193
- borderWidthY: types.borderWidth,
194
183
  width: types.responsiveDimension,
195
184
  minWidth: types.responsiveDimension,
196
185
  maxWidth: types.responsiveDimension,
@@ -16,10 +16,6 @@ import "core-js/modules/es.array.includes.js";
16
16
  import "core-js/modules/es.string.includes.js";
17
17
  import "core-js/modules/es.array.concat.js";
18
18
  import "core-js/modules/es.object.entries.js";
19
- import "core-js/modules/es.array.map.js";
20
- import "core-js/modules/es.object.values.js";
21
- import "core-js/modules/es.regexp.exec.js";
22
- import "core-js/modules/es.string.replace.js";
23
19
  import "core-js/modules/es.symbol.js";
24
20
  import "core-js/modules/es.symbol.description.js";
25
21
  import "core-js/modules/es.symbol.iterator.js";
@@ -28,7 +24,7 @@ import "core-js/modules/es.string.iterator.js";
28
24
  import "core-js/modules/web.dom-collections.iterator.js";
29
25
  import "core-js/modules/es.array.slice.js";
30
26
  import "core-js/modules/es.array.from.js";
31
- import { borderWidths } from '../types';
27
+ import "core-js/modules/es.regexp.exec.js";
32
28
  import { styleConfig } from '../utilities';
33
29
  import { propNameToShort } from '../utilities/style-config';
34
30
 
@@ -99,28 +95,14 @@ var spaceProps = styleConfig.spaceProps,
99
95
  alignSelfProps = styleConfig.alignSelfProps,
100
96
  borderColorProps = styleConfig.borderColorProps,
101
97
  borderWidthProps = styleConfig.borderWidthProps,
98
+ borderSideProps = styleConfig.borderSideProps,
102
99
  alignProps = styleConfig.alignProps,
103
100
  weightProps = styleConfig.weightProps,
104
101
  displayProps = styleConfig.displayProps,
105
102
  zIndexProps = styleConfig.zIndexProps;
106
103
  var classAndStyleDeclarationProps = [spaceProps, colorProps, shadowProps, radiusProps, transitionProps, sizeProps, borderColorProps];
107
- var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps, borderWidthProps, alignProps, weightProps, displayProps]);
104
+ var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps, borderWidthProps, alignProps, weightProps, displayProps, borderSideProps]);
108
105
  var styleDeclarationProps = [].concat(classAndStyleDeclarationProps, [dimensionProps, aspectRatioProps, orderProps, flexProps, opacityProps, zIndexProps]);
109
-
110
- var generateBorderStyle = function generateBorderStyle() {
111
- var css = '';
112
- Object.values(borderWidthProps.props).map(function (prop) {
113
- var property = prop.property.replace('width', 'style');
114
- if (prop.propName === 'borderWidth') return;
115
- css += "\n [class*=\"".concat(prop.short, "\"] { ").concat(property, ": solid }\n ");
116
- }).join('');
117
- var allSideSelector = borderWidthProps.props[0].short;
118
- css += "\n ".concat(borderWidths.map(function (w) {
119
- return ".".concat(allSideSelector, "-").concat(w);
120
- }), " { border-style: solid }\n ");
121
- return css;
122
- };
123
-
124
- var defaultBorderColor = "\n [class*=\"bd\"] {\n border-color: var(--grn-color-border);\n }\n";
125
- var utilities = "\n ".concat(defaultBorderColor, "\n ").concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n ").concat(generateBorderStyle(), "\n");
106
+ var defaultBorder = "\n [class*=\"bd\"] {\n border-color: var(--grn-color-border);\n border-width: 1px;\n }\n";
107
+ var utilities = "\n ".concat(defaultBorder, "\n ").concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n");
126
108
  export default utilities;
package/es/types.js CHANGED
@@ -21,7 +21,7 @@ export var overflows = ['visible', 'hidden', 'scroll', 'auto'];
21
21
  export var positions = ['static', 'relative', 'fixed', 'absolute', 'sticky'];
22
22
  export var cursors = ['default', 'pointer'];
23
23
  export var sides = ['all', 'left', 'right', 'top', 'bottom', 'x', 'y'];
24
- export var borderWidths = ['1', '2', '3', '4'];
24
+ export var borderWidths = ['1px', '2px', '3px', '4px'];
25
25
  export var types = {
26
26
  color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
27
27
  responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
@@ -1,5 +1,6 @@
1
1
  import "core-js/modules/es.array.concat.js";
2
2
  import "core-js/modules/es.object.keys.js";
3
+ import "core-js/modules/es.array.map.js";
3
4
  import "core-js/modules/es.array.includes.js";
4
5
  import "core-js/modules/es.string.includes.js";
5
6
  import "core-js/modules/es.array.find.js";
@@ -27,7 +28,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
27
28
 
28
29
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
29
30
 
30
- import { alignSelfs, cursors, overflows, positions } from '../types';
31
+ import { alignSelfs, borderWidths, cursors, overflows, positions, sides } from '../types';
31
32
  import { vars } from '../variables';
32
33
  import { getDimension, getSpace, getTextSize, isSpaceVar } from './responsive';
33
34
  import { getColor, getRadius, getShadow, getTransition, getWeight, isColorVar, isRadiusVar, isShadowVar, isTrasitionVar } from './styles';
@@ -37,6 +38,23 @@ var shadows = Object.keys(vars.shadows);
37
38
  var radii = Object.keys(vars.radii);
38
39
  var transitions = [].concat(_toConsumableArray(Object.keys(vars.transitions)), _toConsumableArray(Object.keys(vars.transitionUtils)));
39
40
  var sizes = Object.keys(vars.texts);
41
+
42
+ var borderSideToStyle = function borderSideToStyle(side) {
43
+ if (side === 'all') return 'solid';
44
+ var borderConfig = {
45
+ top: ['top'],
46
+ right: ['right'],
47
+ bottom: ['bottom'],
48
+ left: ['left'],
49
+ y: ['top', 'bottom'],
50
+ x: ['right', 'left']
51
+ };
52
+ var borderStyles = ['top', 'right', 'bottom', 'left'].map(function (s) {
53
+ return borderConfig[side].includes(s) ? 'solid' : 'none';
54
+ });
55
+ return borderStyles.join(' ');
56
+ };
57
+
40
58
  export var styleConfig = {
41
59
  spaceProps: {
42
60
  props: [{
@@ -330,37 +348,25 @@ export var styleConfig = {
330
348
  propName: 'borderWidth',
331
349
  property: 'border-width',
332
350
  short: 'bdw'
333
- }, {
334
- propName: 'borderWidthTop',
335
- property: 'border-top-width',
336
- short: 'bdw-t'
337
- }, {
338
- propName: 'borderWidthRight',
339
- property: 'border-right-width',
340
- short: 'bdw-r'
341
- }, {
342
- propName: 'borderWidthBottom',
343
- property: 'border-bottom-width',
344
- short: 'bdw-b'
345
- }, {
346
- propName: 'borderWidthLeft',
347
- property: 'border-left-width',
348
- short: 'bdw-l'
349
- }, {
350
- propName: 'borderWidthX',
351
- property: 'border-inline-width',
352
- short: 'bdw-x'
353
- }, {
354
- propName: 'borderWidthY',
355
- property: 'border-block-width',
356
- short: 'bdw-y'
357
351
  }],
358
352
  valueTransformer: function valueTransformer(borderWidth) {
359
- return "".concat(borderWidth, "px");
353
+ return borderWidth;
360
354
  },
361
- variables: ['1', '2', '3', '4'],
355
+ variables: borderWidths,
356
+ variableChecker: function variableChecker(value) {
357
+ return borderWidths.includes(value);
358
+ }
359
+ },
360
+ borderSideProps: {
361
+ props: [{
362
+ propName: 'borderSide',
363
+ property: 'border-style',
364
+ short: 'bds'
365
+ }],
366
+ valueTransformer: borderSideToStyle,
367
+ variables: sides,
362
368
  variableChecker: function variableChecker(value) {
363
- return ['1', '2', '3', '4'].includes(value);
369
+ return sides.includes(value);
364
370
  }
365
371
  },
366
372
  alignProps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.10.7",
3
+ "version": "10.10.9",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",