@flodesk/grain 10.10.7 → 10.10.8
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.
- package/es/components/box2.js +3 -14
- package/es/styles/utilities.js +5 -23
- package/es/types.js +1 -1
- package/es/utilities/style-config.js +29 -28
- package/package.json +1 -1
package/es/components/box2.js
CHANGED
|
@@ -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", "
|
|
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
|
-
|
|
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, "
|
|
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,
|
package/es/styles/utilities.js
CHANGED
|
@@ -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
|
|
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
|
|
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 = ['
|
|
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]),
|
|
@@ -27,7 +27,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
27
27
|
|
|
28
28
|
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
29
|
|
|
30
|
-
import { alignSelfs, cursors, overflows, positions } from '../types';
|
|
30
|
+
import { alignSelfs, borderWidths, cursors, overflows, positions, sides } from '../types';
|
|
31
31
|
import { vars } from '../variables';
|
|
32
32
|
import { getDimension, getSpace, getTextSize, isSpaceVar } from './responsive';
|
|
33
33
|
import { getColor, getRadius, getShadow, getTransition, getWeight, isColorVar, isRadiusVar, isShadowVar, isTrasitionVar } from './styles';
|
|
@@ -37,6 +37,19 @@ var shadows = Object.keys(vars.shadows);
|
|
|
37
37
|
var radii = Object.keys(vars.radii);
|
|
38
38
|
var transitions = [].concat(_toConsumableArray(Object.keys(vars.transitions)), _toConsumableArray(Object.keys(vars.transitionUtils)));
|
|
39
39
|
var sizes = Object.keys(vars.texts);
|
|
40
|
+
|
|
41
|
+
var borderSideToStyle = function borderSideToStyle(s) {
|
|
42
|
+
var none = 'none';
|
|
43
|
+
var solid = 'solid';
|
|
44
|
+
if (s === 'all') return solid;
|
|
45
|
+
var top = s === 'top' || s === 'all' || s === 'y' ? solid : none;
|
|
46
|
+
var right = s === 'right' || s === 'all' || s === 'x' ? solid : none;
|
|
47
|
+
var bottom = s === 'bottom' || s === 'all' || s === 'y' ? solid : none;
|
|
48
|
+
var left = s === 'left' || s === 'all' || s === 'x' ? solid : none;
|
|
49
|
+
var side = "".concat(top, " ").concat(right, " ").concat(bottom, " ").concat(left);
|
|
50
|
+
return side;
|
|
51
|
+
};
|
|
52
|
+
|
|
40
53
|
export var styleConfig = {
|
|
41
54
|
spaceProps: {
|
|
42
55
|
props: [{
|
|
@@ -330,37 +343,25 @@ export var styleConfig = {
|
|
|
330
343
|
propName: 'borderWidth',
|
|
331
344
|
property: 'border-width',
|
|
332
345
|
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
346
|
}],
|
|
358
347
|
valueTransformer: function valueTransformer(borderWidth) {
|
|
359
|
-
return
|
|
348
|
+
return borderWidth;
|
|
360
349
|
},
|
|
361
|
-
variables:
|
|
350
|
+
variables: borderWidths,
|
|
351
|
+
variableChecker: function variableChecker(value) {
|
|
352
|
+
return borderWidths.includes(value);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
borderSideProps: {
|
|
356
|
+
props: [{
|
|
357
|
+
propName: 'borderSide',
|
|
358
|
+
property: 'border-style',
|
|
359
|
+
short: 'bds'
|
|
360
|
+
}],
|
|
361
|
+
valueTransformer: borderSideToStyle,
|
|
362
|
+
variables: sides,
|
|
362
363
|
variableChecker: function variableChecker(value) {
|
|
363
|
-
return
|
|
364
|
+
return sides.includes(value);
|
|
364
365
|
}
|
|
365
366
|
},
|
|
366
367
|
alignProps: {
|