@flodesk/grain 10.10.4 → 10.10.6
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 +14 -14
- package/es/styles/utilities.js +21 -34
- package/es/utilities/style-config.js +12 -12
- 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", "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
|
|
|
@@ -88,12 +88,12 @@ 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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
borderWidthLeft = _ref.borderWidthLeft,
|
|
92
|
+
borderWidthRight = _ref.borderWidthRight,
|
|
93
|
+
borderWidthTop = _ref.borderWidthTop,
|
|
94
|
+
borderWidthBottom = _ref.borderWidthBottom,
|
|
95
|
+
borderWidthX = _ref.borderWidthX,
|
|
96
|
+
borderWidthY = _ref.borderWidthY,
|
|
97
97
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
98
98
|
|
|
99
99
|
var styles = _objectSpread({}, generateStyleAttributes({
|
|
@@ -164,7 +164,7 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
164
164
|
shadow: shadow,
|
|
165
165
|
shadowHover: shadowHover,
|
|
166
166
|
radius: radius
|
|
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, "
|
|
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();
|
|
168
168
|
var Tag = tag;
|
|
169
169
|
return ___EmotionJSX(Tag, _extends({
|
|
170
170
|
ref: ref,
|
|
@@ -181,12 +181,12 @@ Box2.propTypes = {
|
|
|
181
181
|
borderColor: types.color,
|
|
182
182
|
borderColorHover: types.color,
|
|
183
183
|
borderWidth: types.borderWidth,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
borderWidthLeft: types.borderWidth,
|
|
185
|
+
borderWidthRight: types.borderWidth,
|
|
186
|
+
borderWidthTop: types.borderWidth,
|
|
187
|
+
borderWidthBottom: types.borderWidth,
|
|
188
|
+
borderWidthX: types.borderWidth,
|
|
189
|
+
borderWidthY: types.borderWidth,
|
|
190
190
|
width: types.responsiveDimension,
|
|
191
191
|
minWidth: types.responsiveDimension,
|
|
192
192
|
maxWidth: types.responsiveDimension,
|
package/es/styles/utilities.js
CHANGED
|
@@ -17,6 +17,9 @@ 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
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";
|
|
20
23
|
import "core-js/modules/es.symbol.js";
|
|
21
24
|
import "core-js/modules/es.symbol.description.js";
|
|
22
25
|
import "core-js/modules/es.symbol.iterator.js";
|
|
@@ -25,7 +28,7 @@ import "core-js/modules/es.string.iterator.js";
|
|
|
25
28
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
26
29
|
import "core-js/modules/es.array.slice.js";
|
|
27
30
|
import "core-js/modules/es.array.from.js";
|
|
28
|
-
import
|
|
31
|
+
import { borderWidths } from '../types';
|
|
29
32
|
import { styleConfig } from '../utilities';
|
|
30
33
|
import { propNameToShort } from '../utilities/style-config';
|
|
31
34
|
|
|
@@ -37,14 +40,10 @@ var generateUtilityClassDeclarations = function generateUtilityClassDeclarations
|
|
|
37
40
|
var property = prop.property;
|
|
38
41
|
var cssValue = set.valueTransformer ? set.valueTransformer(variable) : variable;
|
|
39
42
|
var hasHover = prop.propName.includes('Hover');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (hasHover) {
|
|
46
|
-
css += "\n .".concat(propNameToShort(prop.propName), "-").concat(variable, ":hover {\n ").concat(property, ": ").concat(cssValue, "\n }");
|
|
47
|
-
}
|
|
43
|
+
var selector = ".".concat(propNameToShort(prop.propName), "-").concat(variable);
|
|
44
|
+
var declaration = "{".concat(property, ": ").concat(cssValue, "}");
|
|
45
|
+
if (!hasHover) css += "".concat(selector, " ").concat(declaration);
|
|
46
|
+
if (hasHover) css += "".concat(selector, ":hover ").concat(declaration);
|
|
48
47
|
});
|
|
49
48
|
});
|
|
50
49
|
});
|
|
@@ -64,14 +63,9 @@ var generateStyleClassDeclarations = function generateStyleClassDeclarations(pro
|
|
|
64
63
|
var propName = prop.propName;
|
|
65
64
|
var cssVar = "--".concat(propNameToShort(propName));
|
|
66
65
|
var hasHover = prop.propName.includes('Hover');
|
|
67
|
-
|
|
68
|
-
if (!hasHover)
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (hasHover) {
|
|
73
|
-
css += "[style*=\"".concat(cssVar, "\"]:hover {").concat(property, ": var(").concat(cssVar, ")}");
|
|
74
|
-
}
|
|
66
|
+
var declaration = "{".concat(property, ": var(").concat(cssVar, ")}");
|
|
67
|
+
if (!hasHover) css += "[style*=\"".concat(cssVar, ":\"] ").concat(declaration);
|
|
68
|
+
if (hasHover) css += "[style*=\"".concat(cssVar, ":\"]:hover ").concat(declaration);
|
|
75
69
|
|
|
76
70
|
if (set.isResponsive) {
|
|
77
71
|
css += "\n [style*=\"".concat(cssVar, "-def\"] {").concat(property, ": var(").concat(cssVar, "-def)}\n ");
|
|
@@ -108,28 +102,21 @@ var spaceProps = styleConfig.spaceProps,
|
|
|
108
102
|
var classAndStyleDeclarationProps = [spaceProps, colorProps, shadowProps, radiusProps, transitionProps, sizeProps, borderColorProps];
|
|
109
103
|
var classDeclarationProps = [].concat(classAndStyleDeclarationProps, [positionProps, overflowProps, cursorProps, sizeProps, alignSelfProps, borderWidthProps]);
|
|
110
104
|
var styleDeclarationProps = [].concat(classAndStyleDeclarationProps, [dimensionProps, aspectRatioProps, orderProps, flexProps, opacityProps]);
|
|
111
|
-
var borderSides = {
|
|
112
|
-
t: 'top',
|
|
113
|
-
r: 'right',
|
|
114
|
-
b: 'bottom',
|
|
115
|
-
l: 'left',
|
|
116
|
-
x: 'inline',
|
|
117
|
-
y: 'block'
|
|
118
|
-
};
|
|
119
105
|
|
|
120
106
|
var generateBorderStyle = function generateBorderStyle() {
|
|
121
107
|
var css = '';
|
|
122
|
-
Object.
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
css += "\n [class*=\"bd".concat(shortSide, "w-\"] { border-").concat(side, "-style: solid }\n ");
|
|
108
|
+
Object.values(borderWidthProps.props).map(function (prop) {
|
|
109
|
+
var property = prop.property.replace('width', 'style');
|
|
110
|
+
if (prop.propName === 'borderWidth') return;
|
|
111
|
+
css += "\n [class*=\"".concat(prop.short, "\"] { ").concat(property, ": solid }\n ");
|
|
128
112
|
}).join('');
|
|
129
|
-
|
|
113
|
+
var allSideSelector = borderWidthProps.props[0].short;
|
|
114
|
+
css += "\n ".concat(borderWidths.map(function (w) {
|
|
115
|
+
return ".".concat(allSideSelector, "-").concat(w);
|
|
116
|
+
}), " { border-style: solid }\n ");
|
|
130
117
|
return css;
|
|
131
118
|
};
|
|
132
119
|
|
|
133
|
-
var defaultBorderColor = "\n [class*=\"
|
|
134
|
-
var utilities = "\n ".concat(
|
|
120
|
+
var defaultBorderColor = "\n [class*=\"bd\"] {\n border-color: var(--grn-color-border);\n }\n";
|
|
121
|
+
var utilities = "\n ".concat(defaultBorderColor, "\n ").concat(generateUtilityClassDeclarations(classDeclarationProps), ";\n ").concat(generateStyleClassDeclarations(styleDeclarationProps), ";\n ").concat(generateBorderStyle(), "\n");
|
|
135
122
|
export default utilities;
|
|
@@ -331,29 +331,29 @@ export var styleConfig = {
|
|
|
331
331
|
property: 'border-width',
|
|
332
332
|
short: 'bdw'
|
|
333
333
|
}, {
|
|
334
|
-
propName: '
|
|
334
|
+
propName: 'borderWidthTop',
|
|
335
335
|
property: 'border-top-width',
|
|
336
|
-
short: '
|
|
336
|
+
short: 'bdw-t'
|
|
337
337
|
}, {
|
|
338
|
-
propName: '
|
|
338
|
+
propName: 'borderWidthRight',
|
|
339
339
|
property: 'border-right-width',
|
|
340
|
-
short: '
|
|
340
|
+
short: 'bdw-r'
|
|
341
341
|
}, {
|
|
342
|
-
propName: '
|
|
342
|
+
propName: 'borderWidthBottom',
|
|
343
343
|
property: 'border-bottom-width',
|
|
344
|
-
short: '
|
|
344
|
+
short: 'bdw-b'
|
|
345
345
|
}, {
|
|
346
|
-
propName: '
|
|
346
|
+
propName: 'borderWidthLeft',
|
|
347
347
|
property: 'border-left-width',
|
|
348
|
-
short: '
|
|
348
|
+
short: 'bdw-l'
|
|
349
349
|
}, {
|
|
350
|
-
propName: '
|
|
350
|
+
propName: 'borderWidthX',
|
|
351
351
|
property: 'border-inline-width',
|
|
352
|
-
short: '
|
|
352
|
+
short: 'bdw-x'
|
|
353
353
|
}, {
|
|
354
|
-
propName: '
|
|
354
|
+
propName: 'borderWidthY',
|
|
355
355
|
property: 'border-block-width',
|
|
356
|
-
short: '
|
|
356
|
+
short: 'bdw-y'
|
|
357
357
|
}],
|
|
358
358
|
valueTransformer: function valueTransformer(borderWidth) {
|
|
359
359
|
return "".concat(borderWidth, "px");
|