@flodesk/grain 10.10.4 → 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.
- package/es/components/box2.js +14 -14
- package/es/styles/utilities.js +14 -20
- 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
|
@@ -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
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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,12 +116,14 @@ var generateBorderStyle = function generateBorderStyle() {
|
|
|
124
116
|
shortSide = _ref4[0],
|
|
125
117
|
side = _ref4[1];
|
|
126
118
|
|
|
127
|
-
css += "\n [class*=\"
|
|
119
|
+
css += "\n [class*=\"bdw-".concat(shortSide, "\"] { border-").concat(side, "-style: solid }\n ");
|
|
128
120
|
}).join('');
|
|
129
|
-
css += "\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 defaultBorderColor = "\n [class*=\"
|
|
134
|
-
var utilities = "\n ".concat(
|
|
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");
|
|
135
129
|
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");
|