@flodesk/grain 10.10.3 → 10.10.5

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", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "borderXColor", "borderYColor", "borderWidth", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth", "borderXWidth", "borderYWidth"];
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"];
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
 
@@ -86,19 +86,14 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
86
86
  className = _ref.className,
87
87
  style = _ref.style,
88
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,
89
+ borderColorHover = _ref.borderColorHover,
95
90
  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,
91
+ borderWidthLeft = _ref.borderWidthLeft,
92
+ borderWidthRight = _ref.borderWidthRight,
93
+ borderWidthTop = _ref.borderWidthTop,
94
+ borderWidthBottom = _ref.borderWidthBottom,
95
+ borderWidthX = _ref.borderWidthX,
96
+ borderWidthY = _ref.borderWidthY,
102
97
  otherProps = _objectWithoutProperties(_ref, _excluded);
103
98
 
104
99
  var styles = _objectSpread({}, generateStyleAttributes({
@@ -138,12 +133,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
138
133
  opacity: opacity,
139
134
  opacityHover: opacityHover,
140
135
  borderColor: borderColor,
141
- borderTopColor: borderTopColor,
142
- borderRightColor: borderRightColor,
143
- borderBottomColor: borderBottomColor,
144
- borderLeftColor: borderLeftColor,
145
- borderXColor: borderXColor,
146
- borderYColor: borderYColor
136
+ borderColorHover: borderColorHover
147
137
  }));
148
138
 
149
139
  var propClassName = className ? className : '';
@@ -174,7 +164,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
174
164
  shadow: shadow,
175
165
  shadowHover: shadowHover,
176
166
  radius: radius
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();
167
+ }, _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();
178
168
  var Tag = tag;
179
169
  return ___EmotionJSX(Tag, _extends({
180
170
  ref: ref,
@@ -188,10 +178,15 @@ Box2.propTypes = {
188
178
  colorHover: types.color,
189
179
  backgroundColor: types.color,
190
180
  backgroundColorHover: types.color,
191
- borderSide: types.side,
192
- borderWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
193
181
  borderColor: types.color,
194
182
  borderColorHover: types.color,
183
+ borderWidth: types.borderWidth,
184
+ borderWidthLeft: types.borderWidth,
185
+ borderWidthRight: types.borderWidth,
186
+ borderWidthTop: types.borderWidth,
187
+ borderWidthBottom: types.borderWidth,
188
+ borderWidthX: types.borderWidth,
189
+ borderWidthY: types.borderWidth,
195
190
  width: types.responsiveDimension,
196
191
  minWidth: types.responsiveDimension,
197
192
  maxWidth: types.responsiveDimension,
@@ -26,6 +26,7 @@ import "core-js/modules/web.dom-collections.iterator.js";
26
26
  import "core-js/modules/es.array.slice.js";
27
27
  import "core-js/modules/es.array.from.js";
28
28
  import "core-js/modules/es.regexp.exec.js";
29
+ import { borderWidths } from '../types';
29
30
  import { styleConfig } from '../utilities';
30
31
  import { propNameToShort } from '../utilities/style-config';
31
32
 
@@ -37,14 +38,10 @@ var generateUtilityClassDeclarations = function generateUtilityClassDeclarations
37
38
  var property = prop.property;
38
39
  var cssValue = set.valueTransformer ? set.valueTransformer(variable) : variable;
39
40
  var hasHover = prop.propName.includes('Hover');
40
-
41
- if (!hasHover) {
42
- css += "\n .".concat(propNameToShort(prop.propName), "-").concat(variable, " {\n ").concat(property, ": ").concat(cssValue, "\n }");
43
- }
44
-
45
- if (hasHover) {
46
- css += "\n .".concat(propNameToShort(prop.propName), "-").concat(variable, ":hover {\n ").concat(property, ": ").concat(cssValue, "\n }");
47
- }
41
+ var selector = ".".concat(propNameToShort(prop.propName), "-").concat(variable);
42
+ var declaration = "{".concat(property, ": ").concat(cssValue, "}");
43
+ if (!hasHover) css += "".concat(selector, " ").concat(declaration);
44
+ if (hasHover) css += "".concat(selector, ":hover ").concat(declaration);
48
45
  });
49
46
  });
50
47
  });
@@ -64,14 +61,9 @@ var generateStyleClassDeclarations = function generateStyleClassDeclarations(pro
64
61
  var propName = prop.propName;
65
62
  var cssVar = "--".concat(propNameToShort(propName));
66
63
  var hasHover = prop.propName.includes('Hover');
67
-
68
- if (!hasHover) {
69
- css += "[style*=\"".concat(cssVar, ":\"] {").concat(property, ": var(").concat(cssVar, ")}");
70
- }
71
-
72
- if (hasHover) {
73
- css += "[style*=\"".concat(cssVar, "\"]:hover {").concat(property, ": var(").concat(cssVar, ")}");
74
- }
64
+ var declaration = "{".concat(property, ": var(").concat(cssVar, ")}");
65
+ if (!hasHover) css += "[style*=\"".concat(cssVar, ":\"] ").concat(declaration);
66
+ if (hasHover) css += "[style*=\"".concat(cssVar, ":\"]:hover ").concat(declaration);
75
67
 
76
68
  if (set.isResponsive) {
77
69
  css += "\n [style*=\"".concat(cssVar, "-def\"] {").concat(property, ": var(").concat(cssVar, "-def)}\n ");
@@ -124,11 +116,14 @@ var generateBorderStyle = function generateBorderStyle() {
124
116
  shortSide = _ref4[0],
125
117
  side = _ref4[1];
126
118
 
127
- css += "\n [class*=\"bd".concat(shortSide, "w-\"] { border-").concat(side, "-style: solid }\n ");
119
+ css += "\n [class*=\"bdw-".concat(shortSide, "\"] { border-").concat(side, "-style: solid }\n ");
128
120
  }).join('');
129
- css += "\n [class*=\"bdw-\"] { border-style: solid }\n ";
121
+ css += "\n ".concat(borderWidths.map(function (w) {
122
+ return ".bdw-".concat(w);
123
+ }), " { border-style: solid }\n ");
130
124
  return css;
131
125
  };
132
126
 
133
- var utilities = "\n ".concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n ").concat(generateBorderStyle(), "\n");
127
+ var defaultBorderColor = "\n [class*=\"bd\"] {\n border-color: var(--grn-color-border);\n }\n";
128
+ var utilities = "\n ".concat(defaultBorderColor, "\n ").concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n ").concat(generateBorderStyle(), "\n");
134
129
  export default utilities;
package/es/types.js CHANGED
@@ -21,6 +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
25
  export var types = {
25
26
  color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
26
27
  responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
@@ -61,7 +62,8 @@ export var types = {
61
62
  buttonTag: PropTypes.oneOf(['button', 'a', 'span']),
62
63
  hint: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
63
64
  transition: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.transitions)), PropTypes.string]),
64
- cursor: PropTypes.oneOf(cursors)
65
+ cursor: PropTypes.oneOf(cursors),
66
+ borderWidth: PropTypes.oneOf(borderWidths)
65
67
  };
66
68
  export var defaultProps = {
67
69
  menuMaxHeight: '468px',
@@ -1,7 +1,3 @@
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
-
5
1
  import "core-js/modules/es.array.concat.js";
6
2
  import "core-js/modules/es.object.keys.js";
7
3
  import "core-js/modules/es.array.includes.js";
@@ -18,7 +14,6 @@ import "core-js/modules/web.dom-collections.iterator.js";
18
14
  import "core-js/modules/es.array.from.js";
19
15
  import "core-js/modules/es.array.slice.js";
20
16
  import "core-js/modules/es.regexp.exec.js";
21
- import "core-js/modules/es.object.define-property.js";
22
17
 
23
18
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
24
19
 
@@ -42,7 +37,7 @@ var shadows = Object.keys(vars.shadows);
42
37
  var radii = Object.keys(vars.radii);
43
38
  var transitions = [].concat(_toConsumableArray(Object.keys(vars.transitions)), _toConsumableArray(Object.keys(vars.transitionUtils)));
44
39
  var sizes = Object.keys(vars.texts);
45
- export var styleConfig = (_styleConfig = {
40
+ export var styleConfig = {
46
41
  spaceProps: {
47
42
  props: [{
48
43
  propName: 'padding',
@@ -326,79 +321,49 @@ export var styleConfig = (_styleConfig = {
326
321
  property: 'border-color',
327
322
  short: 'bdc-h'
328
323
  }],
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");
324
+ valueTransformer: getColor,
325
+ variableChecker: isColorVar,
326
+ variables: colors
396
327
  },
397
- variables: ['1', '2', '3', '4'],
398
- variableChecker: function variableChecker(value) {
399
- return ['1', '2', '3', '4'].includes(value);
328
+ borderWidthProps: {
329
+ props: [{
330
+ propName: 'borderWidth',
331
+ property: 'border-width',
332
+ 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
+ }],
358
+ valueTransformer: function valueTransformer(borderWidth) {
359
+ return "".concat(borderWidth, "px");
360
+ },
361
+ variables: ['1', '2', '3', '4'],
362
+ variableChecker: function variableChecker(value) {
363
+ return ['1', '2', '3', '4'].includes(value);
364
+ }
400
365
  }
401
- }), _styleConfig);
366
+ };
402
367
  export var propNameToShort = function propNameToShort(propName) {
403
368
  var _prop$props$find;
404
369
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.10.3",
3
+ "version": "10.10.5",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",