@flodesk/grain 10.10.2 → 10.10.4

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", "borderColorHover", "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,15 @@ 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
+ borderColorHover = _ref.borderColorHover,
90
+ borderWidth = _ref.borderWidth,
91
+ borderLeftWidth = _ref.borderLeftWidth,
92
+ borderRightWidth = _ref.borderRightWidth,
93
+ borderTopWidth = _ref.borderTopWidth,
94
+ borderBottomWidth = _ref.borderBottomWidth,
95
+ borderXWidth = _ref.borderXWidth,
96
+ borderYWidth = _ref.borderYWidth,
90
97
  otherProps = _objectWithoutProperties(_ref, _excluded);
91
98
 
92
99
  var styles = _objectSpread({}, generateStyleAttributes({
@@ -124,7 +131,9 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
124
131
  aspectRatio: aspectRatio,
125
132
  flex: flex,
126
133
  opacity: opacity,
127
- opacityHover: opacityHover
134
+ opacityHover: opacityHover,
135
+ borderColor: borderColor,
136
+ borderColorHover: borderColorHover
128
137
  }));
129
138
 
130
139
  var propClassName = className ? className : '';
@@ -155,7 +164,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
155
164
  shadow: shadow,
156
165
  shadowHover: shadowHover,
157
166
  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();
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, "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
168
  var Tag = tag;
160
169
  return ___EmotionJSX(Tag, _extends({
161
170
  ref: ref,
@@ -169,10 +178,15 @@ Box2.propTypes = {
169
178
  colorHover: types.color,
170
179
  backgroundColor: types.color,
171
180
  backgroundColorHover: types.color,
172
- borderSide: types.side,
173
- borderWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
174
181
  borderColor: types.color,
175
182
  borderColorHover: types.color,
183
+ borderWidth: types.borderWidth,
184
+ borderLeftWidth: types.borderWidth,
185
+ borderRightWidth: types.borderWidth,
186
+ borderTopWidth: types.borderWidth,
187
+ borderBottomWidth: types.borderWidth,
188
+ borderXWidth: types.borderWidth,
189
+ borderYWidth: types.borderWidth,
176
190
  width: types.responsiveDimension,
177
191
  minWidth: types.responsiveDimension,
178
192
  maxWidth: types.responsiveDimension,
@@ -208,7 +222,7 @@ Box2.propTypes = {
208
222
  zIndex: types.zIndex,
209
223
  opacity: PropTypes.string,
210
224
  opacityHover: PropTypes.string,
211
- order: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
225
+ order: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]),
212
226
  alignSelf: types.alignSelf,
213
227
  flex: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
214
228
  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,34 @@ 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 defaultBorderColor = "\n [class*=\"bdw-\"]:not([class*=\"bdc-\"]),\n [class*=\"bdw-\"][class*=\"bdc-h\"]:not(:hover) {\n border-color: var(--grn-color-border);\n }\n";
134
+ var utilities = "\n ".concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n ").concat(generateBorderStyle(), "\n ").concat(defaultBorderColor, "\n");
109
135
  export default utilities;
package/es/types.js CHANGED
@@ -20,12 +20,14 @@ 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'];
24
+ export var borderWidths = ['1', '2', '3', '4'];
23
25
  export var types = {
24
26
  color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
25
27
  responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
26
28
  dimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
27
29
  responsiveDimension: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object]),
28
- side: PropTypes.oneOf(['all', 'left', 'right', 'top', 'bottom', 'x', 'y']),
30
+ side: PropTypes.oneOf(sides),
29
31
  radius: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.radii)), PropTypes.string, PropTypes.number]),
30
32
  shadow: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.shadows)), PropTypes.string]),
31
33
  position: PropTypes.oneOf(positions),
@@ -60,7 +62,8 @@ export var types = {
60
62
  buttonTag: PropTypes.oneOf(['button', 'a', 'span']),
61
63
  hint: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
62
64
  transition: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.transitions)), PropTypes.string]),
63
- cursor: PropTypes.oneOf(cursors)
65
+ cursor: PropTypes.oneOf(cursors),
66
+ borderWidth: PropTypes.oneOf(borderWidths)
64
67
  };
65
68
  export var defaultProps = {
66
69
  menuMaxHeight: '468px',
@@ -310,6 +310,58 @@ export var styleConfig = {
310
310
  variableChecker: function variableChecker(value) {
311
311
  return alignSelfs.includes(value);
312
312
  }
313
+ },
314
+ borderColorProps: {
315
+ props: [{
316
+ propName: 'borderColor',
317
+ property: 'border-color',
318
+ short: 'bdc'
319
+ }, {
320
+ propName: 'borderColorHover',
321
+ property: 'border-color',
322
+ short: 'bdc-h'
323
+ }],
324
+ valueTransformer: getColor,
325
+ variableChecker: isColorVar,
326
+ variables: colors
327
+ },
328
+ borderWidthProps: {
329
+ props: [{
330
+ propName: 'borderWidth',
331
+ property: 'border-width',
332
+ short: 'bdw'
333
+ }, {
334
+ propName: 'borderTopWidth',
335
+ property: 'border-top-width',
336
+ short: 'bdtw'
337
+ }, {
338
+ propName: 'borderRightWidth',
339
+ property: 'border-right-width',
340
+ short: 'bdrw'
341
+ }, {
342
+ propName: 'borderBottomWidth',
343
+ property: 'border-bottom-width',
344
+ short: 'bdbw'
345
+ }, {
346
+ propName: 'borderLeftWidth',
347
+ property: 'border-left-width',
348
+ short: 'bdlw'
349
+ }, {
350
+ propName: 'borderXWidth',
351
+ property: 'border-inline-width',
352
+ short: 'bdxw'
353
+ }, {
354
+ propName: 'borderYWidth',
355
+ property: 'border-block-width',
356
+ short: 'bdyw'
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
+ }
313
365
  }
314
366
  };
315
367
  export var propNameToShort = function propNameToShort(propName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.10.2",
3
+ "version": "10.10.4",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",