@flodesk/grain 10.9.3 → 10.9.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.
- package/es/components/box2.js +132 -367
- package/es/styles/utilities.js +45 -88
- package/es/types.js +2 -1
- package/es/utilities/attributes.js +51 -0
- package/es/utilities/helpers.js +25 -1
- package/es/utilities/index.js +3 -1
- package/es/utilities/style-config.js +238 -0
- package/es/utilities/styles.js +11 -2
- package/package.json +1 -1
package/es/components/box2.js
CHANGED
|
@@ -3,7 +3,9 @@ import "core-js/modules/es.array.index-of.js";
|
|
|
3
3
|
import "core-js/modules/es.symbol.js";
|
|
4
4
|
import "core-js/modules/es.object.define-property.js";
|
|
5
5
|
import "core-js/modules/es.array.filter.js";
|
|
6
|
+
import "core-js/modules/es.object.to-string.js";
|
|
6
7
|
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
8
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
7
9
|
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
8
10
|
import "core-js/modules/es.object.define-properties.js";
|
|
9
11
|
import "core-js/modules/es.object.assign.js";
|
|
@@ -11,6 +13,10 @@ var _excluded = ["all", "color", "colorHover", "backgroundColor", "backgroundCol
|
|
|
11
13
|
|
|
12
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); }
|
|
13
15
|
|
|
16
|
+
import "core-js/modules/es.string.trim.js";
|
|
17
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
18
|
+
import "core-js/modules/es.string.replace.js";
|
|
19
|
+
|
|
14
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
21
|
|
|
16
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -21,380 +27,139 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
21
27
|
|
|
22
28
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
29
|
|
|
24
|
-
import "core-js/modules/es.object.to-string.js";
|
|
25
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
26
|
-
import "core-js/modules/es.array.concat.js";
|
|
27
|
-
import "core-js/modules/es.array.includes.js";
|
|
28
|
-
import "core-js/modules/es.string.includes.js";
|
|
29
|
-
import "core-js/modules/es.string.trim.js";
|
|
30
|
-
import "core-js/modules/es.regexp.exec.js";
|
|
31
|
-
import "core-js/modules/es.string.replace.js";
|
|
32
|
-
import { getColor, getShadow, getSpace, isObject, isSpaceVar, propNameToShorthand, getDimension, isColorVar, getRadius, isNumber } from '../utilities';
|
|
33
30
|
import React, { forwardRef } from 'react';
|
|
34
|
-
import {
|
|
31
|
+
import { types } from '../types';
|
|
35
32
|
import PropTypes from 'prop-types';
|
|
36
|
-
import {
|
|
33
|
+
import { styleConfig, generateStyleAttributes, generateClassNameAttributes } from '../utilities';
|
|
37
34
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
35
|
+
var dimensionProps = styleConfig.dimensionProps,
|
|
36
|
+
colorProps = styleConfig.colorProps,
|
|
37
|
+
zIndexProps = styleConfig.zIndexProps,
|
|
38
|
+
aspectRatioProps = styleConfig.aspectRatioProps,
|
|
39
|
+
flexProps = styleConfig.flexProps,
|
|
40
|
+
spaceProps = styleConfig.spaceProps,
|
|
41
|
+
shadowProps = styleConfig.shadowProps,
|
|
42
|
+
radiusProps = styleConfig.radiusProps,
|
|
43
|
+
orderProps = styleConfig.orderProps,
|
|
44
|
+
positionProps = styleConfig.positionProps,
|
|
45
|
+
overflowProps = styleConfig.overflowProps,
|
|
46
|
+
transitionProps = styleConfig.transitionProps,
|
|
47
|
+
cursorProps = styleConfig.cursorProps;
|
|
48
|
+
export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
49
|
+
var all = _ref.all,
|
|
50
|
+
color = _ref.color,
|
|
51
|
+
colorHover = _ref.colorHover,
|
|
52
|
+
backgroundColor = _ref.backgroundColor,
|
|
53
|
+
backgroundColorHover = _ref.backgroundColorHover,
|
|
54
|
+
borderColorHover = _ref.borderColorHover,
|
|
55
|
+
borderSide = _ref.borderSide,
|
|
56
|
+
width = _ref.width,
|
|
57
|
+
minWidth = _ref.minWidth,
|
|
58
|
+
maxWidth = _ref.maxWidth,
|
|
59
|
+
height = _ref.height,
|
|
60
|
+
minHeight = _ref.minHeight,
|
|
61
|
+
maxHeight = _ref.maxHeight,
|
|
62
|
+
radius = _ref.radius,
|
|
63
|
+
padding = _ref.padding,
|
|
64
|
+
paddingTop = _ref.paddingTop,
|
|
65
|
+
paddingBottom = _ref.paddingBottom,
|
|
66
|
+
paddingLeft = _ref.paddingLeft,
|
|
67
|
+
paddingRight = _ref.paddingRight,
|
|
68
|
+
paddingX = _ref.paddingX,
|
|
69
|
+
paddingY = _ref.paddingY,
|
|
70
|
+
margin = _ref.margin,
|
|
71
|
+
marginTop = _ref.marginTop,
|
|
72
|
+
marginBottom = _ref.marginBottom,
|
|
73
|
+
marginLeft = _ref.marginLeft,
|
|
74
|
+
marginRight = _ref.marginRight,
|
|
75
|
+
marginX = _ref.marginX,
|
|
76
|
+
marginY = _ref.marginY,
|
|
77
|
+
position = _ref.position,
|
|
78
|
+
top = _ref.top,
|
|
79
|
+
bottom = _ref.bottom,
|
|
80
|
+
left = _ref.left,
|
|
81
|
+
right = _ref.right,
|
|
82
|
+
shadow = _ref.shadow,
|
|
83
|
+
shadowHover = _ref.shadowHover,
|
|
84
|
+
overflow = _ref.overflow,
|
|
85
|
+
overflowX = _ref.overflowX,
|
|
86
|
+
overflowY = _ref.overflowY,
|
|
87
|
+
aspectRatio = _ref.aspectRatio,
|
|
88
|
+
zIndex = _ref.zIndex,
|
|
89
|
+
_ref$tag = _ref.tag,
|
|
90
|
+
tag = _ref$tag === void 0 ? 'div' : _ref$tag,
|
|
91
|
+
opacity = _ref.opacity,
|
|
92
|
+
opacityHover = _ref.opacityHover,
|
|
93
|
+
order = _ref.order,
|
|
94
|
+
alignSelf = _ref.alignSelf,
|
|
95
|
+
flex = _ref.flex,
|
|
96
|
+
transition = _ref.transition,
|
|
97
|
+
transitionHover = _ref.transitionHover,
|
|
98
|
+
cursor = _ref.cursor,
|
|
99
|
+
children = _ref.children,
|
|
100
|
+
className = _ref.className,
|
|
101
|
+
style = _ref.style,
|
|
102
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
103
|
+
|
|
104
|
+
var allProps = {
|
|
105
|
+
all: all,
|
|
106
|
+
color: color,
|
|
107
|
+
colorHover: colorHover,
|
|
108
|
+
backgroundColor: backgroundColor,
|
|
109
|
+
backgroundColorHover: backgroundColorHover,
|
|
110
|
+
borderColorHover: borderColorHover,
|
|
111
|
+
borderSide: borderSide,
|
|
112
|
+
width: width,
|
|
113
|
+
minWidth: minWidth,
|
|
114
|
+
maxWidth: maxWidth,
|
|
115
|
+
height: height,
|
|
116
|
+
minHeight: minHeight,
|
|
117
|
+
maxHeight: maxHeight,
|
|
118
|
+
radius: radius,
|
|
119
|
+
padding: padding,
|
|
120
|
+
paddingTop: paddingTop,
|
|
121
|
+
paddingBottom: paddingBottom,
|
|
122
|
+
paddingLeft: paddingLeft,
|
|
123
|
+
paddingRight: paddingRight,
|
|
124
|
+
paddingX: paddingX,
|
|
125
|
+
paddingY: paddingY,
|
|
126
|
+
margin: margin,
|
|
127
|
+
marginTop: marginTop,
|
|
128
|
+
marginBottom: marginBottom,
|
|
129
|
+
marginLeft: marginLeft,
|
|
130
|
+
marginRight: marginRight,
|
|
131
|
+
marginX: marginX,
|
|
132
|
+
marginY: marginY,
|
|
133
|
+
position: position,
|
|
134
|
+
top: top,
|
|
135
|
+
bottom: bottom,
|
|
136
|
+
left: left,
|
|
137
|
+
right: right,
|
|
138
|
+
shadow: shadow,
|
|
139
|
+
shadowHover: shadowHover,
|
|
140
|
+
overflow: overflow,
|
|
141
|
+
overflowX: overflowX,
|
|
142
|
+
overflowY: overflowY,
|
|
143
|
+
aspectRatio: aspectRatio,
|
|
144
|
+
zIndex: zIndex,
|
|
145
|
+
tag: tag,
|
|
146
|
+
opacity: opacity,
|
|
147
|
+
opacityHover: opacityHover,
|
|
148
|
+
order: order,
|
|
149
|
+
alignSelf: alignSelf,
|
|
150
|
+
flex: flex,
|
|
151
|
+
transition: transition,
|
|
152
|
+
transitionHover: transitionHover,
|
|
153
|
+
cursor: cursor
|
|
65
154
|
};
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
var generateOrderStyles = function generateOrderStyles(_ref3) {
|
|
69
|
-
var order = _ref3.order;
|
|
70
|
-
var styles = {};
|
|
71
|
-
var property = 'order';
|
|
72
|
-
|
|
73
|
-
if (isObject(order)) {
|
|
74
|
-
var defaultValue = order.default,
|
|
75
|
-
mobile = order.mobile,
|
|
76
|
-
tablet = order.tablet;
|
|
77
|
-
styles["--".concat(propNameToShorthand(property), "-dft")] = defaultValue;
|
|
78
|
-
styles["--".concat(propNameToShorthand(property), "-mbl")] = mobile;
|
|
79
|
-
styles["--".concat(propNameToShorthand(property), "-tbl")] = tablet;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (isNumber(order)) {
|
|
83
|
-
styles[property] = order;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return styles;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
var generateDimentionStyles = function generateDimentionStyles(_ref4) {
|
|
90
|
-
var dimentionsProps = _ref4.dimentionsProps;
|
|
91
|
-
var styles = {};
|
|
92
|
-
dimentionsProps.forEach(function (_ref5) {
|
|
93
|
-
var property = _ref5.property,
|
|
94
|
-
value = _ref5.value;
|
|
95
|
-
|
|
96
|
-
if (isObject(value)) {
|
|
97
|
-
var defaultValue = value.default,
|
|
98
|
-
mobile = value.mobile,
|
|
99
|
-
tablet = value.tablet;
|
|
100
|
-
styles["--".concat(propNameToShorthand(property), "-dft")] = getDimension(defaultValue);
|
|
101
|
-
styles["--".concat(propNameToShorthand(property), "-mbl")] = getDimension(mobile);
|
|
102
|
-
styles["--".concat(propNameToShorthand(property), "-tbl")] = getDimension(tablet);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
styles["--".concat(propNameToShorthand(property))] = getDimension(value);
|
|
107
|
-
});
|
|
108
|
-
return styles;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
var generateColorStyles = function generateColorStyles(_ref6) {
|
|
112
|
-
var colorProps = _ref6.colorProps;
|
|
113
|
-
var styles = {};
|
|
114
|
-
var classNames = [];
|
|
115
|
-
colorProps.forEach(function (_ref7) {
|
|
116
|
-
var property = _ref7.property,
|
|
117
|
-
value = _ref7.value;
|
|
118
|
-
|
|
119
|
-
if (isColorVar(value)) {
|
|
120
|
-
classNames.push("".concat(propNameToShorthand(property), "-").concat(value));
|
|
121
|
-
} else {
|
|
122
|
-
styles["--".concat(propNameToShorthand(property))] = getColor(value);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return {
|
|
126
|
-
className: classNames.join(' '),
|
|
127
|
-
style: styles
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
var genereateShadowStyles = function genereateShadowStyles(_ref8) {
|
|
132
|
-
var shadowProps = _ref8.shadowProps;
|
|
133
|
-
var styles = {};
|
|
134
|
-
var classNames = [];
|
|
135
|
-
shadowProps.forEach(function (_ref9) {
|
|
136
|
-
var property = _ref9.property,
|
|
137
|
-
value = _ref9.value;
|
|
138
|
-
|
|
139
|
-
if (value in vars.shadows) {
|
|
140
|
-
classNames.push("".concat(propNameToShorthand(property), "-").concat(value));
|
|
141
|
-
} else {
|
|
142
|
-
styles["--".concat(propNameToShorthand(property))] = getShadow(value);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
return {
|
|
146
|
-
className: classNames.join(' '),
|
|
147
|
-
style: styles
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
var generateRadiusStyles = function generateRadiusStyles(_ref10) {
|
|
152
|
-
var radiusProps = _ref10.radiusProps;
|
|
153
|
-
var styles = {};
|
|
154
|
-
var classNames = [];
|
|
155
|
-
radiusProps.forEach(function (_ref11) {
|
|
156
|
-
var property = _ref11.property,
|
|
157
|
-
value = _ref11.value;
|
|
158
|
-
|
|
159
|
-
if (value in vars.radii) {
|
|
160
|
-
classNames.push("".concat(propNameToShorthand(property), "-").concat(value));
|
|
161
|
-
} else {
|
|
162
|
-
styles["--".concat(propNameToShorthand(property))] = getRadius(value);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
return {
|
|
166
|
-
className: classNames.join(' '),
|
|
167
|
-
style: styles
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
var generateZIndexStyles = function generateZIndexStyles(_ref12) {
|
|
172
|
-
var zIndex = _ref12.zIndex;
|
|
173
|
-
var styles = {};
|
|
174
|
-
styles["zIndex"] = zIndex;
|
|
175
|
-
return styles;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
var generatePositionStyles = function generatePositionStyles(_ref13) {
|
|
179
|
-
var position = _ref13.position;
|
|
180
|
-
|
|
181
|
-
if (position) {
|
|
182
|
-
return "".concat(propNameToShorthand('position'), "-").concat(position);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
var generateOverflowStyles = function generateOverflowStyles(_ref14) {
|
|
187
|
-
var overflowProps = _ref14.overflowProps;
|
|
188
|
-
var classNames = [];
|
|
189
|
-
overflowProps.forEach(function (_ref15) {
|
|
190
|
-
var property = _ref15.property,
|
|
191
|
-
value = _ref15.value;
|
|
192
|
-
|
|
193
|
-
if (overflows.includes(value)) {
|
|
194
|
-
classNames.push("".concat(propNameToShorthand(property), "-").concat(value));
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
return classNames.join(' ');
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
export var Box2 = /*#__PURE__*/forwardRef(function (_ref16, ref) {
|
|
201
|
-
var all = _ref16.all,
|
|
202
|
-
color = _ref16.color,
|
|
203
|
-
colorHover = _ref16.colorHover,
|
|
204
|
-
backgroundColor = _ref16.backgroundColor,
|
|
205
|
-
backgroundColorHover = _ref16.backgroundColorHover,
|
|
206
|
-
borderColorHover = _ref16.borderColorHover,
|
|
207
|
-
borderSide = _ref16.borderSide,
|
|
208
|
-
width = _ref16.width,
|
|
209
|
-
minWidth = _ref16.minWidth,
|
|
210
|
-
maxWidth = _ref16.maxWidth,
|
|
211
|
-
height = _ref16.height,
|
|
212
|
-
minHeight = _ref16.minHeight,
|
|
213
|
-
maxHeight = _ref16.maxHeight,
|
|
214
|
-
radius = _ref16.radius,
|
|
215
|
-
padding = _ref16.padding,
|
|
216
|
-
paddingTop = _ref16.paddingTop,
|
|
217
|
-
paddingBottom = _ref16.paddingBottom,
|
|
218
|
-
paddingLeft = _ref16.paddingLeft,
|
|
219
|
-
paddingRight = _ref16.paddingRight,
|
|
220
|
-
paddingX = _ref16.paddingX,
|
|
221
|
-
paddingY = _ref16.paddingY,
|
|
222
|
-
margin = _ref16.margin,
|
|
223
|
-
marginTop = _ref16.marginTop,
|
|
224
|
-
marginBottom = _ref16.marginBottom,
|
|
225
|
-
marginLeft = _ref16.marginLeft,
|
|
226
|
-
marginRight = _ref16.marginRight,
|
|
227
|
-
marginX = _ref16.marginX,
|
|
228
|
-
marginY = _ref16.marginY,
|
|
229
|
-
position = _ref16.position,
|
|
230
|
-
top = _ref16.top,
|
|
231
|
-
bottom = _ref16.bottom,
|
|
232
|
-
left = _ref16.left,
|
|
233
|
-
right = _ref16.right,
|
|
234
|
-
shadow = _ref16.shadow,
|
|
235
|
-
shadowHover = _ref16.shadowHover,
|
|
236
|
-
overflow = _ref16.overflow,
|
|
237
|
-
overflowX = _ref16.overflowX,
|
|
238
|
-
overflowY = _ref16.overflowY,
|
|
239
|
-
aspectRatio = _ref16.aspectRatio,
|
|
240
|
-
zIndex = _ref16.zIndex,
|
|
241
|
-
_ref16$tag = _ref16.tag,
|
|
242
|
-
tag = _ref16$tag === void 0 ? 'div' : _ref16$tag,
|
|
243
|
-
opacity = _ref16.opacity,
|
|
244
|
-
opacityHover = _ref16.opacityHover,
|
|
245
|
-
order = _ref16.order,
|
|
246
|
-
alignSelf = _ref16.alignSelf,
|
|
247
|
-
flex = _ref16.flex,
|
|
248
|
-
transition = _ref16.transition,
|
|
249
|
-
transitionHover = _ref16.transitionHover,
|
|
250
|
-
cursor = _ref16.cursor,
|
|
251
|
-
children = _ref16.children,
|
|
252
|
-
className = _ref16.className,
|
|
253
|
-
style = _ref16.style,
|
|
254
|
-
otherProps = _objectWithoutProperties(_ref16, _excluded);
|
|
255
|
-
|
|
256
|
-
var spaceProps = [{
|
|
257
|
-
property: 'padding',
|
|
258
|
-
value: padding
|
|
259
|
-
}, {
|
|
260
|
-
property: 'paddingTop',
|
|
261
|
-
value: paddingTop
|
|
262
|
-
}, {
|
|
263
|
-
property: 'paddingBottom',
|
|
264
|
-
value: paddingBottom
|
|
265
|
-
}, {
|
|
266
|
-
property: 'paddingLeft',
|
|
267
|
-
value: paddingLeft
|
|
268
|
-
}, {
|
|
269
|
-
property: 'paddingRight',
|
|
270
|
-
value: paddingRight
|
|
271
|
-
}, {
|
|
272
|
-
property: 'paddingX',
|
|
273
|
-
value: paddingX
|
|
274
|
-
}, {
|
|
275
|
-
property: 'paddingY',
|
|
276
|
-
value: paddingY
|
|
277
|
-
}, {
|
|
278
|
-
property: 'margin',
|
|
279
|
-
value: margin
|
|
280
|
-
}, {
|
|
281
|
-
property: 'marginTop',
|
|
282
|
-
value: marginTop
|
|
283
|
-
}, {
|
|
284
|
-
property: 'marginBottom',
|
|
285
|
-
value: marginBottom
|
|
286
|
-
}, {
|
|
287
|
-
property: 'marginLeft',
|
|
288
|
-
value: marginLeft
|
|
289
|
-
}, {
|
|
290
|
-
property: 'marginRight',
|
|
291
|
-
value: marginRight
|
|
292
|
-
}, {
|
|
293
|
-
property: 'marginX',
|
|
294
|
-
value: marginX
|
|
295
|
-
}, {
|
|
296
|
-
property: 'marginY',
|
|
297
|
-
value: marginY
|
|
298
|
-
}, {
|
|
299
|
-
property: 'top',
|
|
300
|
-
value: top
|
|
301
|
-
}, {
|
|
302
|
-
property: 'bottom',
|
|
303
|
-
value: bottom
|
|
304
|
-
}, {
|
|
305
|
-
property: 'left',
|
|
306
|
-
value: left
|
|
307
|
-
}, {
|
|
308
|
-
property: 'right',
|
|
309
|
-
value: right
|
|
310
|
-
}];
|
|
311
|
-
var dimentionsProps = [{
|
|
312
|
-
property: 'width',
|
|
313
|
-
value: width
|
|
314
|
-
}, {
|
|
315
|
-
property: 'minWidth',
|
|
316
|
-
value: minWidth
|
|
317
|
-
}, {
|
|
318
|
-
property: 'maxWidth',
|
|
319
|
-
value: maxWidth
|
|
320
|
-
}, {
|
|
321
|
-
property: 'height',
|
|
322
|
-
value: height
|
|
323
|
-
}, {
|
|
324
|
-
property: 'minHeight',
|
|
325
|
-
value: minHeight
|
|
326
|
-
}, {
|
|
327
|
-
property: 'maxHeight',
|
|
328
|
-
value: maxHeight
|
|
329
|
-
}];
|
|
330
|
-
var colorProps = [{
|
|
331
|
-
property: 'color',
|
|
332
|
-
value: color
|
|
333
|
-
}, {
|
|
334
|
-
property: 'colorHover',
|
|
335
|
-
value: colorHover
|
|
336
|
-
}, {
|
|
337
|
-
property: 'backgroundColor',
|
|
338
|
-
value: backgroundColor
|
|
339
|
-
}, {
|
|
340
|
-
property: 'backgroundColorHover',
|
|
341
|
-
value: backgroundColorHover
|
|
342
|
-
}];
|
|
343
|
-
var shadowProps = [{
|
|
344
|
-
property: 'shadow',
|
|
345
|
-
value: shadow
|
|
346
|
-
}, {
|
|
347
|
-
property: 'shadowHover',
|
|
348
|
-
value: shadowHover
|
|
349
|
-
}];
|
|
350
|
-
var radiusProps = [{
|
|
351
|
-
property: 'radius',
|
|
352
|
-
value: radius
|
|
353
|
-
}];
|
|
354
|
-
var overflowProps = [{
|
|
355
|
-
property: 'overflow',
|
|
356
|
-
value: overflow
|
|
357
|
-
}, {
|
|
358
|
-
property: 'overflowX',
|
|
359
|
-
value: overflowX
|
|
360
|
-
}, {
|
|
361
|
-
property: 'overflowY',
|
|
362
|
-
value: overflowY
|
|
363
|
-
}];
|
|
364
155
|
|
|
365
|
-
var styles = _objectSpread(
|
|
366
|
-
dimentionsProps: dimentionsProps
|
|
367
|
-
})), generateSpaceStyles({
|
|
368
|
-
spaceProps: spaceProps
|
|
369
|
-
}).style), generateColorStyles({
|
|
370
|
-
colorProps: colorProps
|
|
371
|
-
}).style), genereateShadowStyles({
|
|
372
|
-
shadowProps: shadowProps
|
|
373
|
-
}).style), generateRadiusStyles({
|
|
374
|
-
radiusProps: radiusProps
|
|
375
|
-
}).style), generateOrderStyles({
|
|
376
|
-
order: order
|
|
377
|
-
})), generateZIndexStyles({
|
|
378
|
-
zIndex: zIndex
|
|
379
|
-
}));
|
|
156
|
+
var styles = _objectSpread({}, generateStyleAttributes([dimensionProps, colorProps, spaceProps, shadowProps, radiusProps, orderProps, zIndexProps, transitionProps, aspectRatioProps, flexProps], allProps));
|
|
380
157
|
|
|
381
|
-
var
|
|
382
|
-
var classNames = [
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
colorProps: colorProps
|
|
386
|
-
}).className, genereateShadowStyles({
|
|
387
|
-
shadowProps: shadowProps
|
|
388
|
-
}).className, generateRadiusStyles({
|
|
389
|
-
radiusProps: radiusProps
|
|
390
|
-
}).className, generatePositionStyles({
|
|
391
|
-
position: position
|
|
392
|
-
}), generateOverflowStyles({
|
|
393
|
-
overflowProps: overflowProps
|
|
394
|
-
}), propClassname].join(' ').replace(/\s+/g, ' ').trim();
|
|
395
|
-
return ___EmotionJSX("div", _extends({
|
|
158
|
+
var propClassName = className ? className : '';
|
|
159
|
+
var classNames = [generateClassNameAttributes([spaceProps, colorProps, shadowProps, radiusProps, positionProps, overflowProps, transitionProps, cursorProps], allProps), propClassName].join(' ').replace(/\s+/g, ' ').trim();
|
|
160
|
+
var Tag = tag;
|
|
161
|
+
return ___EmotionJSX(Tag, _extends({
|
|
396
162
|
ref: ref,
|
|
397
|
-
as: tag,
|
|
398
163
|
style: styles,
|
|
399
164
|
className: classNames
|
|
400
165
|
}, otherProps), children);
|
package/es/styles/utilities.js
CHANGED
|
@@ -1,108 +1,65 @@
|
|
|
1
|
-
import "core-js/modules/es.object.keys.js";
|
|
2
1
|
import "core-js/modules/es.object.to-string.js";
|
|
3
2
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
4
3
|
import "core-js/modules/es.array.concat.js";
|
|
5
|
-
import {
|
|
6
|
-
import { propertyToShorthand, getSpace, getColor, getShadow, getRadius } from '../utilities';
|
|
7
|
-
import { vars } from '../variables';
|
|
8
|
-
var spaces = Object.keys(vars.spaces);
|
|
9
|
-
var colors = Object.keys(vars.colors);
|
|
10
|
-
var shadows = Object.keys(vars.shadows);
|
|
11
|
-
var radii = Object.keys(vars.radii);
|
|
12
|
-
var spaceProperties = ['padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', 'padding-inline', 'padding-block', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'margin-inline', 'margin-block', 'top', 'bottom', 'left', 'right', 'width', 'height', 'min-width', 'max-width', 'min-height', 'max-height'];
|
|
13
|
-
var colorProperties = ['color', 'background-color'];
|
|
4
|
+
import { propertyToShorthand, propNameToShorthand, styleConfig } from '../utilities';
|
|
14
5
|
|
|
15
|
-
function
|
|
6
|
+
var generateUtilityClasses = function generateUtilityClasses(propertySets) {
|
|
16
7
|
var css = '';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
colorProperties.forEach(function (property) {
|
|
24
|
-
css += "\n .".concat(propertyToShorthand(property), "-").concat(color, " {\n ").concat(property, ": ").concat(getColor(color), "\n }");
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
[].concat(spaceProperties, colorProperties).forEach(function (property) {
|
|
28
|
-
css += "\n [style*=\"--".concat(propertyToShorthand(property), ":\"] {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), ")\n }");
|
|
29
|
-
});
|
|
30
|
-
return css;
|
|
31
|
-
}
|
|
8
|
+
propertySets.forEach(function (set) {
|
|
9
|
+
set.variables.forEach(function (variable) {
|
|
10
|
+
set.props.forEach(function (prop) {
|
|
11
|
+
var property = prop.property;
|
|
12
|
+
var cssValue = set.valueTransformer ? set.valueTransformer(variable) : variable;
|
|
13
|
+
var hasHover = prop.modifier === 'hover';
|
|
32
14
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
colorProperties.forEach(function (property) {
|
|
37
|
-
css += "\n .".concat(propertyToShorthand(property), "-hover-").concat(color, ":hover {\n ").concat(property, ": ").concat(getColor(color), "\n }\n ");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
colorProperties.forEach(function (property) {
|
|
41
|
-
css += "\n [style*=\"--".concat(propertyToShorthand(property), "-hover\"]:hover {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), "-hover)\n }\n ");
|
|
42
|
-
});
|
|
43
|
-
return css;
|
|
44
|
-
};
|
|
15
|
+
if (!hasHover) {
|
|
16
|
+
css += "\n .".concat(propNameToShorthand(prop.propName), "-").concat(variable, " {\n ").concat(property, ": ").concat(cssValue, "\n }");
|
|
17
|
+
}
|
|
45
18
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return css;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var generateShadowCSS = function generateShadowCSS() {
|
|
55
|
-
var css = '';
|
|
56
|
-
var property = 'box-shadow';
|
|
57
|
-
shadows.forEach(function (shadow) {
|
|
58
|
-
css += "\n .".concat(propertyToShorthand(property), "-").concat(shadow, " {\n ").concat(property, ": ").concat(getShadow(shadow), "\n }\n .").concat(propertyToShorthand(property), "-hover-").concat(shadow, ":hover {\n ").concat(property, ": ").concat(getShadow(shadow), "\n }\n ");
|
|
59
|
-
css += "\n [style*=\"--".concat(propertyToShorthand(property), "\"] {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), ")\n }\n [style*=\"--").concat(propertyToShorthand(property), "-hover\"]:hover {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), "-hover)\n }\n ");
|
|
19
|
+
if (hasHover) {
|
|
20
|
+
css += "\n .".concat(propNameToShorthand(prop.propName), "-").concat(variable, ":hover {\n ").concat(property, ": ").concat(cssValue, "\n }");
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
60
24
|
});
|
|
61
25
|
return css;
|
|
62
26
|
};
|
|
63
27
|
|
|
64
|
-
var
|
|
28
|
+
var generateStyleClasses = function generateStyleClasses(propertySets) {
|
|
65
29
|
var css = '';
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return css;
|
|
72
|
-
};
|
|
30
|
+
propertySets.forEach(function (set) {
|
|
31
|
+
set.props.forEach(function (prop) {
|
|
32
|
+
var property = prop.property;
|
|
33
|
+
var cssVar = "--".concat(propertyToShorthand(property));
|
|
34
|
+
var hasHover = prop.modifier === 'hover';
|
|
73
35
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
css += "\n [style*=\"--".concat(propertyToShorthand(property), "-dft\"] {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), "-dft)\n }\n @media (max-width: 1169px) {\n [style*=\"--").concat(propertyToShorthand(property), "-tbl\"] {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), "-tbl);\n }\n }\n @media (max-width: 767px) {\n [style*=\"--").concat(propertyToShorthand(property), "-mbl\"] {\n ").concat(property, ": var(--").concat(propertyToShorthand(property), "-mbl);\n }\n }\n ");
|
|
78
|
-
return css;
|
|
79
|
-
};
|
|
36
|
+
if (!hasHover) {
|
|
37
|
+
css += "\n [style*=\"".concat(cssVar, ":\"] {\n ").concat(property, ": var(").concat(cssVar, ")\n }");
|
|
38
|
+
}
|
|
80
39
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
positions.forEach(function (value) {
|
|
85
|
-
css += "\n .".concat(propertyToShorthand(property), "-").concat(value, " {\n ").concat(property, ": ").concat(value, "\n }\n ");
|
|
86
|
-
});
|
|
87
|
-
return css;
|
|
88
|
-
};
|
|
40
|
+
if (hasHover) {
|
|
41
|
+
css += "\n [style*=\"".concat(cssVar, "-hover\"]:hover {\n ").concat(property, ": var(").concat(cssVar, "-hover)\n }");
|
|
42
|
+
}
|
|
89
43
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
css += "\n .".concat(propertyToShorthand(property), "-").concat(value, " {\n ").concat(property, ": ").concat(value, "\n }\n ");
|
|
44
|
+
if (set.isResponsive) {
|
|
45
|
+
css += "\n [style*=\"".concat(cssVar, "-def\"] {\n ").concat(property, ": var(").concat(cssVar, "-def)\n }\n\n @media (max-width: 1169px) {\n [style*=\"").concat(cssVar, "-tab\"] {\n ").concat(property, ": var(").concat(cssVar, "-tab);\n }\n }\n\n @media (max-width: 767px) {\n [style*=\"").concat(cssVar, "-mob\"] {\n ").concat(property, ": var(").concat(cssVar, "-mob);\n }\n }\n ");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
95
48
|
});
|
|
96
49
|
return css;
|
|
97
50
|
};
|
|
98
51
|
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
52
|
+
var spaceProps = styleConfig.spaceProps,
|
|
53
|
+
colorProps = styleConfig.colorProps,
|
|
54
|
+
shadowProps = styleConfig.shadowProps,
|
|
55
|
+
radiusProps = styleConfig.radiusProps,
|
|
56
|
+
positionProps = styleConfig.positionProps,
|
|
57
|
+
overflowProps = styleConfig.overflowProps,
|
|
58
|
+
transitionProps = styleConfig.transitionProps,
|
|
59
|
+
cursorProps = styleConfig.cursorProps,
|
|
60
|
+
dimensionProps = styleConfig.dimensionProps,
|
|
61
|
+
aspectRatioProps = styleConfig.aspectRatioProps,
|
|
62
|
+
orderProps = styleConfig.orderProps,
|
|
63
|
+
flexProps = styleConfig.flexProps;
|
|
64
|
+
var utilities = "\n ".concat(generateUtilityClasses([spaceProps, colorProps, shadowProps, radiusProps, positionProps, overflowProps, transitionProps, cursorProps]), ";\n\n ").concat(generateStyleClasses([dimensionProps, spaceProps, colorProps, shadowProps, radiusProps, transitionProps, aspectRatioProps, orderProps, flexProps]), ";\n");
|
|
108
65
|
export default utilities;
|
package/es/types.js
CHANGED
|
@@ -19,6 +19,7 @@ export var alignSelfs = [].concat(axisAlignments, ['baseline']);
|
|
|
19
19
|
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
|
+
export var cursors = ['default', 'pointer'];
|
|
22
23
|
export var types = {
|
|
23
24
|
color: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.colors)), PropTypes.string]),
|
|
24
25
|
responsiveSpace: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.spaces)), PropTypes.number, PropTypes.string, PropTypes.object]),
|
|
@@ -59,7 +60,7 @@ export var types = {
|
|
|
59
60
|
buttonTag: PropTypes.oneOf(['button', 'a', 'span']),
|
|
60
61
|
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
61
62
|
transition: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(vars.transitions)), PropTypes.string]),
|
|
62
|
-
cursor: PropTypes.oneOf(
|
|
63
|
+
cursor: PropTypes.oneOf(cursors)
|
|
63
64
|
};
|
|
64
65
|
export var defaultProps = {
|
|
65
66
|
menuMaxHeight: '468px',
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "core-js/modules/es.object.to-string.js";
|
|
2
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
3
|
+
import "core-js/modules/es.array.concat.js";
|
|
4
|
+
import { isObject, propNameToShorthand } from './helpers';
|
|
5
|
+
export var generateStyleAttributes = function generateStyleAttributes(propsSets, allProps) {
|
|
6
|
+
var styles = {};
|
|
7
|
+
propsSets.forEach(function (propsSet) {
|
|
8
|
+
propsSet.props.forEach(function (_ref) {
|
|
9
|
+
var propName = _ref.propName;
|
|
10
|
+
var value = allProps[propName];
|
|
11
|
+
var hasVariable = propsSet.variableChecker ? propsSet.variableChecker(value) : false;
|
|
12
|
+
var hasTransformer = propsSet.valueTransformer ? true : false;
|
|
13
|
+
if (hasVariable) return;
|
|
14
|
+
if (!value) return;
|
|
15
|
+
var cssValue = hasTransformer ? propsSet.valueTransformer(value) : value;
|
|
16
|
+
var propNameShort = propNameToShorthand(propName);
|
|
17
|
+
|
|
18
|
+
if (!isObject(value)) {
|
|
19
|
+
styles["--".concat(propNameShort)] = cssValue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (isObject(value)) {
|
|
23
|
+
var def = value.default,
|
|
24
|
+
mobile = value.mobile,
|
|
25
|
+
tablet = value.tablet;
|
|
26
|
+
var defaultValueCss = hasTransformer ? propsSet.valueTransformer(def) : def;
|
|
27
|
+
var mobileValueCss = hasTransformer ? propsSet.valueTransformer(mobile) : mobile;
|
|
28
|
+
var tabletValueCss = hasTransformer ? propsSet.valueTransformer(tablet) : tablet;
|
|
29
|
+
styles["--".concat(propNameShort, "-def")] = defaultValueCss;
|
|
30
|
+
styles["--".concat(propNameShort, "-mob")] = mobileValueCss;
|
|
31
|
+
styles["--".concat(propNameShort, "-tab")] = tabletValueCss;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
return styles;
|
|
36
|
+
};
|
|
37
|
+
export var generateClassNameAttributes = function generateClassNameAttributes(propsSets, allProps) {
|
|
38
|
+
var classNames = [];
|
|
39
|
+
propsSets.forEach(function (propsSet) {
|
|
40
|
+
propsSet.props.forEach(function (_ref2) {
|
|
41
|
+
var propName = _ref2.propName;
|
|
42
|
+
var value = allProps[propName];
|
|
43
|
+
var hasVariable = propsSet.variableChecker ? propsSet.variableChecker(value) : false;
|
|
44
|
+
if (!hasVariable) return;
|
|
45
|
+
if (!value) return;
|
|
46
|
+
var className = "".concat(propNameToShorthand(propName), "-").concat(value);
|
|
47
|
+
classNames.push(className);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return classNames.join(' ');
|
|
51
|
+
};
|
package/es/utilities/helpers.js
CHANGED
|
@@ -173,7 +173,7 @@ var shortHandProps = [{
|
|
|
173
173
|
}, {
|
|
174
174
|
propName: 'order',
|
|
175
175
|
property: 'order',
|
|
176
|
-
value: '
|
|
176
|
+
value: 'ord'
|
|
177
177
|
}, {
|
|
178
178
|
propName: 'position',
|
|
179
179
|
property: 'position',
|
|
@@ -190,6 +190,30 @@ var shortHandProps = [{
|
|
|
190
190
|
propName: 'overflowY',
|
|
191
191
|
property: 'overflow-y',
|
|
192
192
|
value: 'ovf-y'
|
|
193
|
+
}, {
|
|
194
|
+
propName: 'zIndex',
|
|
195
|
+
property: 'z-index',
|
|
196
|
+
value: 'z'
|
|
197
|
+
}, {
|
|
198
|
+
propName: 'transition',
|
|
199
|
+
property: 'transition',
|
|
200
|
+
value: 'tr'
|
|
201
|
+
}, {
|
|
202
|
+
propName: 'transitionHover',
|
|
203
|
+
property: 'transition',
|
|
204
|
+
value: 'tr-hover'
|
|
205
|
+
}, {
|
|
206
|
+
propName: 'cursor',
|
|
207
|
+
property: 'cursor',
|
|
208
|
+
value: 'cur'
|
|
209
|
+
}, {
|
|
210
|
+
propName: 'aspectRatio',
|
|
211
|
+
property: 'aspect-ratio',
|
|
212
|
+
value: 'ar'
|
|
213
|
+
}, {
|
|
214
|
+
propName: 'flex',
|
|
215
|
+
property: 'flex',
|
|
216
|
+
value: 'flex'
|
|
193
217
|
}];
|
|
194
218
|
export var propertyToShorthand = function propertyToShorthand(property) {
|
|
195
219
|
var _shortHandProps$find;
|
package/es/utilities/index.js
CHANGED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import "core-js/modules/es.array.concat.js";
|
|
2
|
+
import "core-js/modules/es.object.keys.js";
|
|
3
|
+
import "core-js/modules/es.array.includes.js";
|
|
4
|
+
import "core-js/modules/es.string.includes.js";
|
|
5
|
+
import "core-js/modules/es.symbol.js";
|
|
6
|
+
import "core-js/modules/es.symbol.description.js";
|
|
7
|
+
import "core-js/modules/es.object.to-string.js";
|
|
8
|
+
import "core-js/modules/es.symbol.iterator.js";
|
|
9
|
+
import "core-js/modules/es.array.iterator.js";
|
|
10
|
+
import "core-js/modules/es.string.iterator.js";
|
|
11
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
12
|
+
import "core-js/modules/es.array.from.js";
|
|
13
|
+
import "core-js/modules/es.array.slice.js";
|
|
14
|
+
import "core-js/modules/es.regexp.exec.js";
|
|
15
|
+
|
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
+
|
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
|
+
|
|
24
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
import { cursors, overflows, positions } from '../types';
|
|
29
|
+
import { vars } from '../variables';
|
|
30
|
+
import { getDimension, getSpace, isSpaceVar } from './responsive';
|
|
31
|
+
import { getColor, getRadius, getShadow, getTransition, isColorVar, isRadiusVar, isShadowVar, isTrasitionVar } from './styles';
|
|
32
|
+
var spaces = [].concat(_toConsumableArray(Object.keys(vars.spaces)), _toConsumableArray(Object.keys(vars.spaceUtils)));
|
|
33
|
+
var colors = [].concat(_toConsumableArray(Object.keys(vars.colors)), _toConsumableArray(Object.keys(vars.colorUtils)));
|
|
34
|
+
var shadows = Object.keys(vars.shadows);
|
|
35
|
+
var radii = Object.keys(vars.radii);
|
|
36
|
+
var transitions = [].concat(_toConsumableArray(Object.keys(vars.transitions)), _toConsumableArray(Object.keys(vars.transitionUtils)));
|
|
37
|
+
export var styleConfig = {
|
|
38
|
+
spaceProps: {
|
|
39
|
+
props: [{
|
|
40
|
+
propName: 'padding',
|
|
41
|
+
property: 'padding'
|
|
42
|
+
}, {
|
|
43
|
+
propName: 'paddingTop',
|
|
44
|
+
property: 'padding-top'
|
|
45
|
+
}, {
|
|
46
|
+
propName: 'paddingBottom',
|
|
47
|
+
property: 'padding-bottom'
|
|
48
|
+
}, {
|
|
49
|
+
propName: 'paddingLeft',
|
|
50
|
+
property: 'padding-left'
|
|
51
|
+
}, {
|
|
52
|
+
propName: 'paddingRight',
|
|
53
|
+
property: 'padding-right'
|
|
54
|
+
}, {
|
|
55
|
+
propName: 'paddingX',
|
|
56
|
+
property: 'padding-inline'
|
|
57
|
+
}, {
|
|
58
|
+
propName: 'paddingY',
|
|
59
|
+
property: 'padding-block'
|
|
60
|
+
}, {
|
|
61
|
+
propName: 'margin',
|
|
62
|
+
property: 'margin'
|
|
63
|
+
}, {
|
|
64
|
+
propName: 'marginTop',
|
|
65
|
+
property: 'margin-top'
|
|
66
|
+
}, {
|
|
67
|
+
propName: 'marginBottom',
|
|
68
|
+
property: 'margin-bottom'
|
|
69
|
+
}, {
|
|
70
|
+
propName: 'marginLeft',
|
|
71
|
+
property: 'margin-left'
|
|
72
|
+
}, {
|
|
73
|
+
propName: 'marginRight',
|
|
74
|
+
property: 'margin-right'
|
|
75
|
+
}, {
|
|
76
|
+
propName: 'marginX',
|
|
77
|
+
property: 'margin-inline'
|
|
78
|
+
}, {
|
|
79
|
+
propName: 'marginY',
|
|
80
|
+
property: 'margin-block'
|
|
81
|
+
}, {
|
|
82
|
+
propName: 'top',
|
|
83
|
+
property: 'top'
|
|
84
|
+
}, {
|
|
85
|
+
propName: 'bottom',
|
|
86
|
+
property: 'bottom'
|
|
87
|
+
}, {
|
|
88
|
+
propName: 'left',
|
|
89
|
+
property: 'left'
|
|
90
|
+
}, {
|
|
91
|
+
propName: 'right',
|
|
92
|
+
property: 'right'
|
|
93
|
+
}],
|
|
94
|
+
valueTransformer: getSpace,
|
|
95
|
+
variableChecker: isSpaceVar,
|
|
96
|
+
variables: spaces,
|
|
97
|
+
isResponsive: true
|
|
98
|
+
},
|
|
99
|
+
dimensionProps: {
|
|
100
|
+
props: [{
|
|
101
|
+
propName: 'width',
|
|
102
|
+
property: 'width'
|
|
103
|
+
}, {
|
|
104
|
+
propName: 'minWidth',
|
|
105
|
+
property: 'height'
|
|
106
|
+
}, {
|
|
107
|
+
propName: 'maxWidth',
|
|
108
|
+
property: 'min-width'
|
|
109
|
+
}, {
|
|
110
|
+
propName: 'height',
|
|
111
|
+
property: 'max-width'
|
|
112
|
+
}, {
|
|
113
|
+
propName: 'minHeight',
|
|
114
|
+
property: 'min-height'
|
|
115
|
+
}, {
|
|
116
|
+
propName: 'maxHeight',
|
|
117
|
+
property: 'max-height'
|
|
118
|
+
}],
|
|
119
|
+
valueTransformer: getDimension,
|
|
120
|
+
isResponsive: true
|
|
121
|
+
},
|
|
122
|
+
colorProps: {
|
|
123
|
+
props: [{
|
|
124
|
+
propName: 'color',
|
|
125
|
+
property: 'color'
|
|
126
|
+
}, {
|
|
127
|
+
propName: 'colorHover',
|
|
128
|
+
property: 'color',
|
|
129
|
+
modifier: 'hover'
|
|
130
|
+
}, {
|
|
131
|
+
propName: 'backgroundColor',
|
|
132
|
+
property: 'background-color'
|
|
133
|
+
}, {
|
|
134
|
+
propName: 'backgroundColorHover',
|
|
135
|
+
property: 'background-color',
|
|
136
|
+
modifier: 'hover'
|
|
137
|
+
}],
|
|
138
|
+
valueTransformer: getColor,
|
|
139
|
+
variableChecker: isColorVar,
|
|
140
|
+
variables: colors
|
|
141
|
+
},
|
|
142
|
+
shadowProps: {
|
|
143
|
+
props: [{
|
|
144
|
+
propName: 'shadow',
|
|
145
|
+
property: 'box-shadow'
|
|
146
|
+
}, {
|
|
147
|
+
propName: 'shadowHover',
|
|
148
|
+
property: 'box-shadow',
|
|
149
|
+
modifier: 'hover'
|
|
150
|
+
}],
|
|
151
|
+
valueTransformer: getShadow,
|
|
152
|
+
variableChecker: isShadowVar,
|
|
153
|
+
variables: shadows
|
|
154
|
+
},
|
|
155
|
+
radiusProps: {
|
|
156
|
+
props: [{
|
|
157
|
+
propName: 'radius',
|
|
158
|
+
property: 'border-radius'
|
|
159
|
+
}],
|
|
160
|
+
valueTransformer: getRadius,
|
|
161
|
+
variableChecker: isRadiusVar,
|
|
162
|
+
variables: radii
|
|
163
|
+
},
|
|
164
|
+
orderProps: {
|
|
165
|
+
props: [{
|
|
166
|
+
propName: 'order',
|
|
167
|
+
property: 'order'
|
|
168
|
+
}]
|
|
169
|
+
},
|
|
170
|
+
flexProps: {
|
|
171
|
+
props: [{
|
|
172
|
+
propName: 'flex',
|
|
173
|
+
property: 'flex'
|
|
174
|
+
}],
|
|
175
|
+
isResponsive: true
|
|
176
|
+
},
|
|
177
|
+
zIndexProps: {
|
|
178
|
+
props: [{
|
|
179
|
+
propName: 'zIndex',
|
|
180
|
+
property: 'z-index'
|
|
181
|
+
}]
|
|
182
|
+
},
|
|
183
|
+
positionProps: {
|
|
184
|
+
props: [{
|
|
185
|
+
propName: 'position',
|
|
186
|
+
property: 'position'
|
|
187
|
+
}],
|
|
188
|
+
variableChecker: function variableChecker(value) {
|
|
189
|
+
return positions.includes(value);
|
|
190
|
+
},
|
|
191
|
+
variables: positions
|
|
192
|
+
},
|
|
193
|
+
overflowProps: {
|
|
194
|
+
props: [{
|
|
195
|
+
propName: 'overflow',
|
|
196
|
+
property: 'overflow'
|
|
197
|
+
}, {
|
|
198
|
+
propName: 'overflowX',
|
|
199
|
+
property: 'overflow-x'
|
|
200
|
+
}, {
|
|
201
|
+
propName: 'overflowY',
|
|
202
|
+
property: 'overflow-y'
|
|
203
|
+
}],
|
|
204
|
+
variableChecker: function variableChecker(value) {
|
|
205
|
+
return overflows.includes(value);
|
|
206
|
+
},
|
|
207
|
+
variables: overflows
|
|
208
|
+
},
|
|
209
|
+
transitionProps: {
|
|
210
|
+
props: [{
|
|
211
|
+
propName: 'transition',
|
|
212
|
+
property: 'transition'
|
|
213
|
+
}, {
|
|
214
|
+
propName: 'transitionHover',
|
|
215
|
+
property: 'transition',
|
|
216
|
+
modifier: 'hover'
|
|
217
|
+
}],
|
|
218
|
+
valueTransformer: getTransition,
|
|
219
|
+
variableChecker: isTrasitionVar,
|
|
220
|
+
variables: transitions
|
|
221
|
+
},
|
|
222
|
+
cursorProps: {
|
|
223
|
+
props: [{
|
|
224
|
+
propName: 'cursor',
|
|
225
|
+
property: 'cursor'
|
|
226
|
+
}],
|
|
227
|
+
variableChecker: function variableChecker(value) {
|
|
228
|
+
return cursors.includes(value);
|
|
229
|
+
},
|
|
230
|
+
variables: cursors
|
|
231
|
+
},
|
|
232
|
+
aspectRatioProps: {
|
|
233
|
+
props: [{
|
|
234
|
+
propName: 'aspectRatio',
|
|
235
|
+
property: 'aspect-ratio'
|
|
236
|
+
}]
|
|
237
|
+
}
|
|
238
|
+
};
|
package/es/utilities/styles.js
CHANGED
|
@@ -17,8 +17,11 @@ export var getColor = function getColor(color) {
|
|
|
17
17
|
|
|
18
18
|
return color;
|
|
19
19
|
};
|
|
20
|
+
export var isShadowVar = function isShadowVar(shadow) {
|
|
21
|
+
return shadow in vars.shadows;
|
|
22
|
+
};
|
|
20
23
|
export var getShadow = function getShadow(shadow) {
|
|
21
|
-
if (shadow
|
|
24
|
+
if (isShadowVar(shadow)) {
|
|
22
25
|
return getCssVar(varInfo.shadows.name, shadow);
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -29,8 +32,11 @@ export var getWeight = function getWeight(weight) {
|
|
|
29
32
|
return getCssVar(varInfo.weights.name, weight);
|
|
30
33
|
}
|
|
31
34
|
};
|
|
35
|
+
export var isRadiusVar = function isRadiusVar(radius) {
|
|
36
|
+
return radius in vars.radii;
|
|
37
|
+
};
|
|
32
38
|
export var getRadius = function getRadius(radius) {
|
|
33
|
-
if (radius
|
|
39
|
+
if (isRadiusVar(radius)) {
|
|
34
40
|
return getCssVar(varInfo.radii.name, radius);
|
|
35
41
|
}
|
|
36
42
|
|
|
@@ -38,6 +44,9 @@ export var getRadius = function getRadius(radius) {
|
|
|
38
44
|
if (isString(radius)) return radius;
|
|
39
45
|
if (isNumber(radius)) return u(radius);
|
|
40
46
|
};
|
|
47
|
+
export var isTrasitionVar = function isTrasitionVar(transition) {
|
|
48
|
+
return transition in vars.transitionUtils || transition in vars.transitions;
|
|
49
|
+
};
|
|
41
50
|
export var getTransition = function getTransition(transition) {
|
|
42
51
|
if (transition in vars.transitionUtils) {
|
|
43
52
|
return getCssVar(varInfo.transitionUtils.name, transition);
|