@flodesk/grain 10.10.2 → 10.10.3

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", "borderColorHover", "borderSide", "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"];
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", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "borderXColor", "borderYColor", "borderWidth", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth", "borderXWidth", "borderYWidth"];
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
 
@@ -39,8 +39,6 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
39
39
  colorHover = _ref.colorHover,
40
40
  backgroundColor = _ref.backgroundColor,
41
41
  backgroundColorHover = _ref.backgroundColorHover,
42
- borderColorHover = _ref.borderColorHover,
43
- borderSide = _ref.borderSide,
44
42
  width = _ref.width,
45
43
  minWidth = _ref.minWidth,
46
44
  maxWidth = _ref.maxWidth,
@@ -87,6 +85,20 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
87
85
  children = _ref.children,
88
86
  className = _ref.className,
89
87
  style = _ref.style,
88
+ borderColor = _ref.borderColor,
89
+ borderTopColor = _ref.borderTopColor,
90
+ borderRightColor = _ref.borderRightColor,
91
+ borderBottomColor = _ref.borderBottomColor,
92
+ borderLeftColor = _ref.borderLeftColor,
93
+ borderXColor = _ref.borderXColor,
94
+ borderYColor = _ref.borderYColor,
95
+ borderWidth = _ref.borderWidth,
96
+ borderLeftWidth = _ref.borderLeftWidth,
97
+ borderRightWidth = _ref.borderRightWidth,
98
+ borderTopWidth = _ref.borderTopWidth,
99
+ borderBottomWidth = _ref.borderBottomWidth,
100
+ borderXWidth = _ref.borderXWidth,
101
+ borderYWidth = _ref.borderYWidth,
90
102
  otherProps = _objectWithoutProperties(_ref, _excluded);
91
103
 
92
104
  var styles = _objectSpread({}, generateStyleAttributes({
@@ -124,7 +136,14 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
124
136
  aspectRatio: aspectRatio,
125
137
  flex: flex,
126
138
  opacity: opacity,
127
- opacityHover: opacityHover
139
+ opacityHover: opacityHover,
140
+ borderColor: borderColor,
141
+ borderTopColor: borderTopColor,
142
+ borderRightColor: borderRightColor,
143
+ borderBottomColor: borderBottomColor,
144
+ borderLeftColor: borderLeftColor,
145
+ borderXColor: borderXColor,
146
+ borderYColor: borderYColor
128
147
  }));
129
148
 
130
149
  var propClassName = className ? className : '';
@@ -155,7 +174,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
155
174
  shadow: shadow,
156
175
  shadowHover: shadowHover,
157
176
  radius: radius
158
- }, _defineProperty(_generateClassNameAtt, "position", position), _defineProperty(_generateClassNameAtt, "overflow", overflow), _defineProperty(_generateClassNameAtt, "transition", transition), _defineProperty(_generateClassNameAtt, "transitionHover", transitionHover), _defineProperty(_generateClassNameAtt, "cursor", cursor), _defineProperty(_generateClassNameAtt, "alignSelf", alignSelf), _generateClassNameAtt)), propClassName].join(' ').replace(/\s+/g, ' ').trim();
177
+ }, _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, "borderTopColor", borderTopColor), _defineProperty(_generateClassNameAtt, "borderRightColor", borderRightColor), _defineProperty(_generateClassNameAtt, "borderBottomColor", borderBottomColor), _defineProperty(_generateClassNameAtt, "borderLeftColor", borderLeftColor), _defineProperty(_generateClassNameAtt, "borderXColor", borderXColor), _defineProperty(_generateClassNameAtt, "borderYColor", borderYColor), _defineProperty(_generateClassNameAtt, "borderWidth", borderWidth), _defineProperty(_generateClassNameAtt, "borderLeftWidth", borderLeftWidth), _defineProperty(_generateClassNameAtt, "borderRightWidth", borderRightWidth), _defineProperty(_generateClassNameAtt, "borderTopWidth", borderTopWidth), _defineProperty(_generateClassNameAtt, "borderBottomWidth", borderBottomWidth), _defineProperty(_generateClassNameAtt, "borderXWidth", borderXWidth), _defineProperty(_generateClassNameAtt, "borderYWidth", borderYWidth), _generateClassNameAtt)), propClassName].join(' ').replace(/\s+/g, ' ').trim();
159
178
  var Tag = tag;
160
179
  return ___EmotionJSX(Tag, _extends({
161
180
  ref: ref,
@@ -208,7 +227,7 @@ Box2.propTypes = {
208
227
  zIndex: types.zIndex,
209
228
  opacity: PropTypes.string,
210
229
  opacityHover: PropTypes.string,
211
- order: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
230
+ order: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]),
212
231
  alignSelf: types.alignSelf,
213
232
  flex: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
214
233
  transition: types.transition,
@@ -16,6 +16,7 @@ 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";
19
20
  import "core-js/modules/es.symbol.js";
20
21
  import "core-js/modules/es.symbol.description.js";
21
22
  import "core-js/modules/es.symbol.iterator.js";
@@ -101,9 +102,33 @@ var spaceProps = styleConfig.spaceProps,
101
102
  flexProps = styleConfig.flexProps,
102
103
  sizeProps = styleConfig.sizeProps,
103
104
  opacityProps = styleConfig.opacityProps,
104
- alignSelfProps = styleConfig.alignSelfProps;
105
- var classAndStyleDeclarationProps = [spaceProps, colorProps, shadowProps, radiusProps, transitionProps, sizeProps];
106
- var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps]);
105
+ alignSelfProps = styleConfig.alignSelfProps,
106
+ borderColorProps = styleConfig.borderColorProps,
107
+ borderWidthProps = styleConfig.borderWidthProps;
108
+ var classAndStyleDeclarationProps = [spaceProps, colorProps, shadowProps, radiusProps, transitionProps, sizeProps, borderColorProps];
109
+ var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps, borderWidthProps]);
107
110
  var styleDeclarationProps = [].concat(classAndStyleDeclarationProps, [dimensionProps, aspectRatioProps, orderProps, flexProps, opacityProps]);
108
- var utilities = "\n ".concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n");
111
+ var borderSides = {
112
+ t: 'top',
113
+ r: 'right',
114
+ b: 'bottom',
115
+ l: 'left',
116
+ x: 'inline',
117
+ y: 'block'
118
+ };
119
+
120
+ var generateBorderStyle = function generateBorderStyle() {
121
+ var css = '';
122
+ Object.entries(borderSides).map(function (_ref3) {
123
+ var _ref4 = _slicedToArray(_ref3, 2),
124
+ shortSide = _ref4[0],
125
+ side = _ref4[1];
126
+
127
+ css += "\n [class*=\"bd".concat(shortSide, "w-\"] { border-").concat(side, "-style: solid }\n ");
128
+ }).join('');
129
+ css += "\n [class*=\"bdw-\"] { border-style: solid }\n ";
130
+ return css;
131
+ };
132
+
133
+ var utilities = "\n ".concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n ").concat(generateBorderStyle(), "\n");
109
134
  export default utilities;
package/es/types.js CHANGED
@@ -20,12 +20,13 @@ export var flexWraps = ['nowrap', 'wrap', 'wrap-reverse'];
20
20
  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
+ export var sides = ['all', 'left', 'right', 'top', 'bottom', 'x', 'y'];
23
24
  export var types = {
24
25
  color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
25
26
  responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
26
27
  dimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
27
28
  responsiveDimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object]),
28
- side: PropTypes.oneOf(['all', 'left', 'right', 'top', 'bottom', 'x', 'y']),
29
+ side: PropTypes.oneOf(sides),
29
30
  radius: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.radii)), PropTypes.string, PropTypes.number]),
30
31
  shadow: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.shadows)), PropTypes.string]),
31
32
  position: PropTypes.oneOf(positions),
@@ -1,3 +1,7 @@
1
+ var _styleConfig;
2
+
3
+ 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; }
4
+
1
5
  import "core-js/modules/es.array.concat.js";
2
6
  import "core-js/modules/es.object.keys.js";
3
7
  import "core-js/modules/es.array.includes.js";
@@ -14,6 +18,7 @@ import "core-js/modules/web.dom-collections.iterator.js";
14
18
  import "core-js/modules/es.array.from.js";
15
19
  import "core-js/modules/es.array.slice.js";
16
20
  import "core-js/modules/es.regexp.exec.js";
21
+ import "core-js/modules/es.object.define-property.js";
17
22
 
18
23
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
24
 
@@ -37,7 +42,7 @@ var shadows = Object.keys(vars.shadows);
37
42
  var radii = Object.keys(vars.radii);
38
43
  var transitions = [].concat(_toConsumableArray(Object.keys(vars.transitions)), _toConsumableArray(Object.keys(vars.transitionUtils)));
39
44
  var sizes = Object.keys(vars.texts);
40
- export var styleConfig = {
45
+ export var styleConfig = (_styleConfig = {
41
46
  spaceProps: {
42
47
  props: [{
43
48
  propName: 'padding',
@@ -310,8 +315,90 @@ export var styleConfig = {
310
315
  variableChecker: function variableChecker(value) {
311
316
  return alignSelfs.includes(value);
312
317
  }
318
+ },
319
+ borderColorProps: {
320
+ props: [{
321
+ propName: 'borderColor',
322
+ property: 'border-color',
323
+ short: 'bdc'
324
+ }, {
325
+ propName: 'borderColorHover',
326
+ property: 'border-color',
327
+ short: 'bdc-h'
328
+ }],
329
+ valueTransformer: getColor
330
+ }
331
+ }, _defineProperty(_styleConfig, "borderColorProps", {
332
+ props: [{
333
+ propName: 'borderColor',
334
+ property: 'border-color',
335
+ short: 'bdc'
336
+ }, {
337
+ propName: 'borderTopColor',
338
+ property: 'border-top-color',
339
+ short: 'bdtc'
340
+ }, {
341
+ propName: 'borderRightColor',
342
+ property: 'border-right-color',
343
+ short: 'bdrc'
344
+ }, {
345
+ propName: 'borderBottomColor',
346
+ property: 'border-bottom-color',
347
+ short: 'bdbc'
348
+ }, {
349
+ propName: 'borderLeftColor',
350
+ property: 'border-left-color',
351
+ short: 'bdlc'
352
+ }, {
353
+ propName: 'borderXColor',
354
+ property: 'border-inline-color',
355
+ short: 'bdxc'
356
+ }, {
357
+ propName: 'borderYColor',
358
+ property: 'border-block-color',
359
+ short: 'bdyc'
360
+ }],
361
+ valueTransformer: getColor,
362
+ variableChecker: isColorVar,
363
+ variables: colors
364
+ }), _defineProperty(_styleConfig, "borderWidthProps", {
365
+ props: [{
366
+ propName: 'borderWidth',
367
+ property: 'border-width',
368
+ short: 'bdw'
369
+ }, {
370
+ propName: 'borderTopWidth',
371
+ property: 'border-top-width',
372
+ short: 'bdtw'
373
+ }, {
374
+ propName: 'borderRightWidth',
375
+ property: 'border-right-width',
376
+ short: 'bdrw'
377
+ }, {
378
+ propName: 'borderBottomWidth',
379
+ property: 'border-bottom-width',
380
+ short: 'bdbw'
381
+ }, {
382
+ propName: 'borderLeftWidth',
383
+ property: 'border-left-width',
384
+ short: 'bdlw'
385
+ }, {
386
+ propName: 'borderXWidth',
387
+ property: 'border-inline-width',
388
+ short: 'bdxw'
389
+ }, {
390
+ propName: 'borderYWidth',
391
+ property: 'border-block-width',
392
+ short: 'bdyw'
393
+ }],
394
+ valueTransformer: function valueTransformer(borderWidth) {
395
+ return "".concat(borderWidth, "px");
396
+ },
397
+ variables: ['1', '2', '3', '4'],
398
+ variableChecker: function variableChecker(value) {
399
+ return ['1', '2', '3', '4'].includes(value);
313
400
  }
314
- };
401
+ }), _styleConfig);
315
402
  export var propNameToShort = function propNameToShort(propName) {
316
403
  var _prop$props$find;
317
404
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.10.2",
3
+ "version": "10.10.3",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",