@teamturing/react-kit 1.1.0
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/core/Chip/index.d.ts +25 -0
- package/dist/core/GradientText/index.d.ts +287 -0
- package/dist/core/Grid/index.d.ts +25 -0
- package/dist/core/IconButton/index.d.ts +53 -0
- package/dist/core/IconToggleButton/index.d.ts +28 -0
- package/dist/core/ItemList/index.d.ts +10 -0
- package/dist/core/Space/index.d.ts +8 -0
- package/dist/core/Spinner/index.d.ts +487 -0
- package/dist/core/Stack/index.d.ts +19 -0
- package/dist/core/StyledIcon/index.d.ts +10 -0
- package/dist/core/Text/index.d.ts +10 -0
- package/dist/core/View/index.d.ts +8 -0
- package/dist/core/_UnstyledButton.d.ts +6 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +4010 -0
- package/dist/utils/forcePixelValue.d.ts +6 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/isArray.d.ts +1 -0
- package/dist/utils/isNullable.d.ts +1 -0
- package/dist/utils/styled-system/index.d.ts +31 -0
- package/esm/_virtual/_commonjsHelpers.js +5 -0
- package/esm/_virtual/_rollupPluginBabelHelpers.js +16 -0
- package/esm/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +12 -0
- package/esm/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js +9 -0
- package/esm/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +51 -0
- package/esm/node_modules/@styled-system/background/dist/index.esm.js +16 -0
- package/esm/node_modules/@styled-system/border/dist/index.esm.js +131 -0
- package/esm/node_modules/@styled-system/color/dist/index.esm.js +17 -0
- package/esm/node_modules/@styled-system/core/dist/index.esm.js +178 -0
- package/esm/node_modules/@styled-system/css/dist/index.esm.js +209 -0
- package/esm/node_modules/@styled-system/flexbox/dist/index.esm.js +21 -0
- package/esm/node_modules/@styled-system/grid/dist/index.esm.js +34 -0
- package/esm/node_modules/@styled-system/layout/dist/index.esm.js +47 -0
- package/esm/node_modules/@styled-system/position/dist/index.esm.js +35 -0
- package/esm/node_modules/@styled-system/shadow/dist/index.esm.js +14 -0
- package/esm/node_modules/@styled-system/space/dist/index.esm.js +121 -0
- package/esm/node_modules/@styled-system/typography/dist/index.esm.js +33 -0
- package/esm/node_modules/@styled-system/variant/dist/index.esm.js +40 -0
- package/esm/node_modules/object-assign/index.js +83 -0
- package/esm/node_modules/styled-components/dist/styled-components.esm.js +657 -0
- package/esm/node_modules/styled-system/dist/index.esm.js +77 -0
- package/esm/node_modules/stylis/src/Enum.js +11 -0
- package/esm/node_modules/stylis/src/Middleware.js +85 -0
- package/esm/node_modules/stylis/src/Parser.js +187 -0
- package/esm/node_modules/stylis/src/Prefixer.js +197 -0
- package/esm/node_modules/stylis/src/Serializer.js +39 -0
- package/esm/node_modules/stylis/src/Tokenizer.js +242 -0
- package/esm/node_modules/stylis/src/Utility.js +128 -0
- package/esm/node_modules/tslib/tslib.es6.js +44 -0
- package/esm/packages/icons/src/ProgressGradient.js +41 -0
- package/esm/packages/react-kit/src/core/Chip/index.js +179 -0
- package/esm/packages/react-kit/src/core/GradientText/index.js +13 -0
- package/esm/packages/react-kit/src/core/Grid/index.js +106 -0
- package/esm/packages/react-kit/src/core/IconButton/index.js +212 -0
- package/esm/packages/react-kit/src/core/IconToggleButton/index.js +105 -0
- package/esm/packages/react-kit/src/core/ItemList/index.js +11 -0
- package/esm/packages/react-kit/src/core/Space/index.js +12 -0
- package/esm/packages/react-kit/src/core/Spinner/index.js +23 -0
- package/esm/packages/react-kit/src/core/Stack/index.js +57 -0
- package/esm/packages/react-kit/src/core/StyledIcon/index.js +20 -0
- package/esm/packages/react-kit/src/core/Text/index.js +49 -0
- package/esm/packages/react-kit/src/core/View/index.js +18 -0
- package/esm/packages/react-kit/src/core/_UnstyledButton.js +14 -0
- package/esm/packages/react-kit/src/index.js +12 -0
- package/esm/packages/react-kit/src/utils/forcePixelValue.js +8 -0
- package/esm/packages/react-kit/src/utils/isArray.js +3 -0
- package/esm/packages/react-kit/src/utils/isNullable.js +3 -0
- package/esm/packages/react-kit/src/utils/styled-system/index.js +27 -0
- package/esm/packages/token-studio/src/foundation/palette/index.js +90 -0
- package/esm/packages/token-studio/src/foundation/rounding/index.js +13 -0
- package/esm/packages/token-studio/src/foundation/spacing/index.js +56 -0
- package/esm/packages/token-studio/src/foundation/typography/fontSize/index.js +18 -0
- package/esm/packages/token-studio/src/foundation/typography/fontWeight/index.js +13 -0
- package/esm/packages/token-studio/src/foundation/typography/lineHeight/index.js +6 -0
- package/esm/packages/token-studio/src/token/color/index.js +140 -0
- package/esm/packages/token-studio/src/token/radii/index.js +15 -0
- package/esm/packages/token-studio/src/token/space/index.js +55 -0
- package/esm/packages/token-studio/src/token/typography/fontSizes.js +17 -0
- package/esm/packages/token-studio/src/token/typography/fontWeights.js +9 -0
- package/esm/packages/token-studio/src/token/typography/index.js +133 -0
- package/esm/packages/token-studio/src/token/typography/lineHeights.js +8 -0
- package/package.json +59 -0
- package/src/index.ts +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isArray: (value: any) => value is any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNullable: (value: any) => value is null | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SystemStyleObject } from '@styled-system/css';
|
|
2
|
+
import * as CSS from 'csstype';
|
|
3
|
+
import { RequiredTheme, ResponsiveValue, Theme } from 'styled-system';
|
|
4
|
+
type CSSCustomProperties = {
|
|
5
|
+
[key: `--${string}`]: string | number;
|
|
6
|
+
};
|
|
7
|
+
type CSSSelectorObject = {
|
|
8
|
+
[cssSelector: string]: SystemStyleObject | CSSCustomProperties;
|
|
9
|
+
};
|
|
10
|
+
type BetterSystemStyleObject = SystemStyleObject | CSSCustomProperties | CSSSelectorObject;
|
|
11
|
+
type AsProp = {
|
|
12
|
+
as?: any | undefined;
|
|
13
|
+
};
|
|
14
|
+
export interface SxProp {
|
|
15
|
+
sx?: BetterSystemStyleObject;
|
|
16
|
+
}
|
|
17
|
+
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
|
18
|
+
type TextDecorationProps<ThemeType extends Theme = RequiredTheme> = {
|
|
19
|
+
textDecoration?: ResponsiveValue<CSS.Property.TextDecoration, ThemeType> | undefined;
|
|
20
|
+
};
|
|
21
|
+
declare const textDecoration: import("styled-system").styleFn;
|
|
22
|
+
type WhiteSpaceProps<ThemeType extends Theme = RequiredTheme> = {
|
|
23
|
+
whiteSpace?: ResponsiveValue<CSS.Property.WhiteSpace, ThemeType> | undefined;
|
|
24
|
+
};
|
|
25
|
+
declare const whiteSpace: import("styled-system").styleFn;
|
|
26
|
+
type WordBreakProps<ThemeType extends Theme = RequiredTheme> = {
|
|
27
|
+
wordBreak?: ResponsiveValue<CSS.Property.WordBreak, ThemeType> | undefined;
|
|
28
|
+
};
|
|
29
|
+
declare const wordBreak: import("styled-system").styleFn;
|
|
30
|
+
export { sx, textDecoration, whiteSpace, wordBreak };
|
|
31
|
+
export type { BetterSystemStyleObject, AsProp, TextDecorationProps, WhiteSpaceProps, WordBreakProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
3
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
+
var source = arguments[i];
|
|
5
|
+
for (var key in source) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
+
target[key] = source[key];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return target;
|
|
12
|
+
};
|
|
13
|
+
return _extends.apply(this, arguments);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { _extends as extends };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import memoize from '../../memoize/dist/emotion-memoize.esm.js';
|
|
2
|
+
|
|
3
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
4
|
+
|
|
5
|
+
var isPropValid = /* #__PURE__ */memoize(function (prop) {
|
|
6
|
+
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
7
|
+
/* o */ && prop.charCodeAt(1) === 110
|
|
8
|
+
/* n */ && prop.charCodeAt(2) < 91;
|
|
9
|
+
}
|
|
10
|
+
/* Z+1 */);
|
|
11
|
+
|
|
12
|
+
export { isPropValid as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var unitlessKeys = {
|
|
2
|
+
animationIterationCount: 1,
|
|
3
|
+
aspectRatio: 1,
|
|
4
|
+
borderImageOutset: 1,
|
|
5
|
+
borderImageSlice: 1,
|
|
6
|
+
borderImageWidth: 1,
|
|
7
|
+
boxFlex: 1,
|
|
8
|
+
boxFlexGroup: 1,
|
|
9
|
+
boxOrdinalGroup: 1,
|
|
10
|
+
columnCount: 1,
|
|
11
|
+
columns: 1,
|
|
12
|
+
flex: 1,
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
flexPositive: 1,
|
|
15
|
+
flexShrink: 1,
|
|
16
|
+
flexNegative: 1,
|
|
17
|
+
flexOrder: 1,
|
|
18
|
+
gridRow: 1,
|
|
19
|
+
gridRowEnd: 1,
|
|
20
|
+
gridRowSpan: 1,
|
|
21
|
+
gridRowStart: 1,
|
|
22
|
+
gridColumn: 1,
|
|
23
|
+
gridColumnEnd: 1,
|
|
24
|
+
gridColumnSpan: 1,
|
|
25
|
+
gridColumnStart: 1,
|
|
26
|
+
msGridRow: 1,
|
|
27
|
+
msGridRowSpan: 1,
|
|
28
|
+
msGridColumn: 1,
|
|
29
|
+
msGridColumnSpan: 1,
|
|
30
|
+
fontWeight: 1,
|
|
31
|
+
lineHeight: 1,
|
|
32
|
+
opacity: 1,
|
|
33
|
+
order: 1,
|
|
34
|
+
orphans: 1,
|
|
35
|
+
tabSize: 1,
|
|
36
|
+
widows: 1,
|
|
37
|
+
zIndex: 1,
|
|
38
|
+
zoom: 1,
|
|
39
|
+
WebkitLineClamp: 1,
|
|
40
|
+
// SVG-related properties
|
|
41
|
+
fillOpacity: 1,
|
|
42
|
+
floodOpacity: 1,
|
|
43
|
+
stopOpacity: 1,
|
|
44
|
+
strokeDasharray: 1,
|
|
45
|
+
strokeDashoffset: 1,
|
|
46
|
+
strokeMiterlimit: 1,
|
|
47
|
+
strokeOpacity: 1,
|
|
48
|
+
strokeWidth: 1
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { unitlessKeys as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { system } from '../../core/dist/index.esm.js';
|
|
2
|
+
|
|
3
|
+
var config = {
|
|
4
|
+
background: true,
|
|
5
|
+
backgroundImage: true,
|
|
6
|
+
backgroundSize: true,
|
|
7
|
+
backgroundPosition: true,
|
|
8
|
+
backgroundRepeat: true
|
|
9
|
+
};
|
|
10
|
+
config.bgImage = config.backgroundImage;
|
|
11
|
+
config.bgSize = config.backgroundSize;
|
|
12
|
+
config.bgPosition = config.backgroundPosition;
|
|
13
|
+
config.bgRepeat = config.backgroundRepeat;
|
|
14
|
+
var background = system(config);
|
|
15
|
+
|
|
16
|
+
export { background, background as default };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { system } from '../../core/dist/index.esm.js';
|
|
2
|
+
|
|
3
|
+
var config = {
|
|
4
|
+
border: {
|
|
5
|
+
property: 'border',
|
|
6
|
+
scale: 'borders'
|
|
7
|
+
},
|
|
8
|
+
borderWidth: {
|
|
9
|
+
property: 'borderWidth',
|
|
10
|
+
scale: 'borderWidths'
|
|
11
|
+
},
|
|
12
|
+
borderStyle: {
|
|
13
|
+
property: 'borderStyle',
|
|
14
|
+
scale: 'borderStyles'
|
|
15
|
+
},
|
|
16
|
+
borderColor: {
|
|
17
|
+
property: 'borderColor',
|
|
18
|
+
scale: 'colors'
|
|
19
|
+
},
|
|
20
|
+
borderRadius: {
|
|
21
|
+
property: 'borderRadius',
|
|
22
|
+
scale: 'radii'
|
|
23
|
+
},
|
|
24
|
+
borderTop: {
|
|
25
|
+
property: 'borderTop',
|
|
26
|
+
scale: 'borders'
|
|
27
|
+
},
|
|
28
|
+
borderTopLeftRadius: {
|
|
29
|
+
property: 'borderTopLeftRadius',
|
|
30
|
+
scale: 'radii'
|
|
31
|
+
},
|
|
32
|
+
borderTopRightRadius: {
|
|
33
|
+
property: 'borderTopRightRadius',
|
|
34
|
+
scale: 'radii'
|
|
35
|
+
},
|
|
36
|
+
borderRight: {
|
|
37
|
+
property: 'borderRight',
|
|
38
|
+
scale: 'borders'
|
|
39
|
+
},
|
|
40
|
+
borderBottom: {
|
|
41
|
+
property: 'borderBottom',
|
|
42
|
+
scale: 'borders'
|
|
43
|
+
},
|
|
44
|
+
borderBottomLeftRadius: {
|
|
45
|
+
property: 'borderBottomLeftRadius',
|
|
46
|
+
scale: 'radii'
|
|
47
|
+
},
|
|
48
|
+
borderBottomRightRadius: {
|
|
49
|
+
property: 'borderBottomRightRadius',
|
|
50
|
+
scale: 'radii'
|
|
51
|
+
},
|
|
52
|
+
borderLeft: {
|
|
53
|
+
property: 'borderLeft',
|
|
54
|
+
scale: 'borders'
|
|
55
|
+
},
|
|
56
|
+
borderX: {
|
|
57
|
+
properties: ['borderLeft', 'borderRight'],
|
|
58
|
+
scale: 'borders'
|
|
59
|
+
},
|
|
60
|
+
borderY: {
|
|
61
|
+
properties: ['borderTop', 'borderBottom'],
|
|
62
|
+
scale: 'borders'
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
config.borderTopWidth = {
|
|
66
|
+
property: 'borderTopWidth',
|
|
67
|
+
scale: 'borderWidths'
|
|
68
|
+
};
|
|
69
|
+
config.borderTopColor = {
|
|
70
|
+
property: 'borderTopColor',
|
|
71
|
+
scale: 'colors'
|
|
72
|
+
};
|
|
73
|
+
config.borderTopStyle = {
|
|
74
|
+
property: 'borderTopStyle',
|
|
75
|
+
scale: 'borderStyles'
|
|
76
|
+
};
|
|
77
|
+
config.borderTopLeftRadius = {
|
|
78
|
+
property: 'borderTopLeftRadius',
|
|
79
|
+
scale: 'radii'
|
|
80
|
+
};
|
|
81
|
+
config.borderTopRightRadius = {
|
|
82
|
+
property: 'borderTopRightRadius',
|
|
83
|
+
scale: 'radii'
|
|
84
|
+
};
|
|
85
|
+
config.borderBottomWidth = {
|
|
86
|
+
property: 'borderBottomWidth',
|
|
87
|
+
scale: 'borderWidths'
|
|
88
|
+
};
|
|
89
|
+
config.borderBottomColor = {
|
|
90
|
+
property: 'borderBottomColor',
|
|
91
|
+
scale: 'colors'
|
|
92
|
+
};
|
|
93
|
+
config.borderBottomStyle = {
|
|
94
|
+
property: 'borderBottomStyle',
|
|
95
|
+
scale: 'borderStyles'
|
|
96
|
+
};
|
|
97
|
+
config.borderBottomLeftRadius = {
|
|
98
|
+
property: 'borderBottomLeftRadius',
|
|
99
|
+
scale: 'radii'
|
|
100
|
+
};
|
|
101
|
+
config.borderBottomRightRadius = {
|
|
102
|
+
property: 'borderBottomRightRadius',
|
|
103
|
+
scale: 'radii'
|
|
104
|
+
};
|
|
105
|
+
config.borderLeftWidth = {
|
|
106
|
+
property: 'borderLeftWidth',
|
|
107
|
+
scale: 'borderWidths'
|
|
108
|
+
};
|
|
109
|
+
config.borderLeftColor = {
|
|
110
|
+
property: 'borderLeftColor',
|
|
111
|
+
scale: 'colors'
|
|
112
|
+
};
|
|
113
|
+
config.borderLeftStyle = {
|
|
114
|
+
property: 'borderLeftStyle',
|
|
115
|
+
scale: 'borderStyles'
|
|
116
|
+
};
|
|
117
|
+
config.borderRightWidth = {
|
|
118
|
+
property: 'borderRightWidth',
|
|
119
|
+
scale: 'borderWidths'
|
|
120
|
+
};
|
|
121
|
+
config.borderRightColor = {
|
|
122
|
+
property: 'borderRightColor',
|
|
123
|
+
scale: 'colors'
|
|
124
|
+
};
|
|
125
|
+
config.borderRightStyle = {
|
|
126
|
+
property: 'borderRightStyle',
|
|
127
|
+
scale: 'borderStyles'
|
|
128
|
+
};
|
|
129
|
+
var border = system(config);
|
|
130
|
+
|
|
131
|
+
export { border, border as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { system } from '../../core/dist/index.esm.js';
|
|
2
|
+
|
|
3
|
+
var config = {
|
|
4
|
+
color: {
|
|
5
|
+
property: 'color',
|
|
6
|
+
scale: 'colors'
|
|
7
|
+
},
|
|
8
|
+
backgroundColor: {
|
|
9
|
+
property: 'backgroundColor',
|
|
10
|
+
scale: 'colors'
|
|
11
|
+
},
|
|
12
|
+
opacity: true
|
|
13
|
+
};
|
|
14
|
+
config.bg = config.backgroundColor;
|
|
15
|
+
var color = system(config);
|
|
16
|
+
|
|
17
|
+
export { color, color as default };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import assign from '../../../object-assign/index.js';
|
|
2
|
+
|
|
3
|
+
var merge = function merge(a, b) {
|
|
4
|
+
var result = assign({}, a, b);
|
|
5
|
+
for (var key in a) {
|
|
6
|
+
var _assign;
|
|
7
|
+
if (!a[key] || typeof b[key] !== 'object') continue;
|
|
8
|
+
assign(result, (_assign = {}, _assign[key] = assign(a[key], b[key]), _assign));
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}; // sort object-value responsive styles
|
|
12
|
+
|
|
13
|
+
var sort = function sort(obj) {
|
|
14
|
+
var next = {};
|
|
15
|
+
Object.keys(obj).sort(function (a, b) {
|
|
16
|
+
return a.localeCompare(b, undefined, {
|
|
17
|
+
numeric: true,
|
|
18
|
+
sensitivity: 'base'
|
|
19
|
+
});
|
|
20
|
+
}).forEach(function (key) {
|
|
21
|
+
next[key] = obj[key];
|
|
22
|
+
});
|
|
23
|
+
return next;
|
|
24
|
+
};
|
|
25
|
+
var defaults = {
|
|
26
|
+
breakpoints: [40, 52, 64].map(function (n) {
|
|
27
|
+
return n + 'em';
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
var createMediaQuery = function createMediaQuery(n) {
|
|
31
|
+
return "@media screen and (min-width: " + n + ")";
|
|
32
|
+
};
|
|
33
|
+
var getValue = function getValue(n, scale) {
|
|
34
|
+
return get(scale, n, n);
|
|
35
|
+
};
|
|
36
|
+
var get = function get(obj, key, def, p, undef) {
|
|
37
|
+
key = key && key.split ? key.split('.') : [key];
|
|
38
|
+
for (p = 0; p < key.length; p++) {
|
|
39
|
+
obj = obj ? obj[key[p]] : undef;
|
|
40
|
+
}
|
|
41
|
+
return obj === undef ? def : obj;
|
|
42
|
+
};
|
|
43
|
+
var createParser = function createParser(config) {
|
|
44
|
+
var cache = {};
|
|
45
|
+
var parse = function parse(props) {
|
|
46
|
+
var styles = {};
|
|
47
|
+
var shouldSort = false;
|
|
48
|
+
var isCacheDisabled = props.theme && props.theme.disableStyledSystemCache;
|
|
49
|
+
for (var key in props) {
|
|
50
|
+
if (!config[key]) continue;
|
|
51
|
+
var sx = config[key];
|
|
52
|
+
var raw = props[key];
|
|
53
|
+
var scale = get(props.theme, sx.scale, sx.defaults);
|
|
54
|
+
if (typeof raw === 'object') {
|
|
55
|
+
cache.breakpoints = !isCacheDisabled && cache.breakpoints || get(props.theme, 'breakpoints', defaults.breakpoints);
|
|
56
|
+
if (Array.isArray(raw)) {
|
|
57
|
+
cache.media = !isCacheDisabled && cache.media || [null].concat(cache.breakpoints.map(createMediaQuery));
|
|
58
|
+
styles = merge(styles, parseResponsiveStyle(cache.media, sx, scale, raw, props));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (raw !== null) {
|
|
62
|
+
styles = merge(styles, parseResponsiveObject(cache.breakpoints, sx, scale, raw, props));
|
|
63
|
+
shouldSort = true;
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
assign(styles, sx(raw, scale, props));
|
|
68
|
+
} // sort object-based responsive styles
|
|
69
|
+
|
|
70
|
+
if (shouldSort) {
|
|
71
|
+
styles = sort(styles);
|
|
72
|
+
}
|
|
73
|
+
return styles;
|
|
74
|
+
};
|
|
75
|
+
parse.config = config;
|
|
76
|
+
parse.propNames = Object.keys(config);
|
|
77
|
+
parse.cache = cache;
|
|
78
|
+
var keys = Object.keys(config).filter(function (k) {
|
|
79
|
+
return k !== 'config';
|
|
80
|
+
});
|
|
81
|
+
if (keys.length > 1) {
|
|
82
|
+
keys.forEach(function (key) {
|
|
83
|
+
var _createParser;
|
|
84
|
+
parse[key] = createParser((_createParser = {}, _createParser[key] = config[key], _createParser));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return parse;
|
|
88
|
+
};
|
|
89
|
+
var parseResponsiveStyle = function parseResponsiveStyle(mediaQueries, sx, scale, raw, _props) {
|
|
90
|
+
var styles = {};
|
|
91
|
+
raw.slice(0, mediaQueries.length).forEach(function (value, i) {
|
|
92
|
+
var media = mediaQueries[i];
|
|
93
|
+
var style = sx(value, scale, _props);
|
|
94
|
+
if (!media) {
|
|
95
|
+
assign(styles, style);
|
|
96
|
+
} else {
|
|
97
|
+
var _assign2;
|
|
98
|
+
assign(styles, (_assign2 = {}, _assign2[media] = assign({}, styles[media], style), _assign2));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return styles;
|
|
102
|
+
};
|
|
103
|
+
var parseResponsiveObject = function parseResponsiveObject(breakpoints, sx, scale, raw, _props) {
|
|
104
|
+
var styles = {};
|
|
105
|
+
for (var key in raw) {
|
|
106
|
+
var breakpoint = breakpoints[key];
|
|
107
|
+
var value = raw[key];
|
|
108
|
+
var style = sx(value, scale, _props);
|
|
109
|
+
if (!breakpoint) {
|
|
110
|
+
assign(styles, style);
|
|
111
|
+
} else {
|
|
112
|
+
var _assign3;
|
|
113
|
+
var media = createMediaQuery(breakpoint);
|
|
114
|
+
assign(styles, (_assign3 = {}, _assign3[media] = assign({}, styles[media], style), _assign3));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return styles;
|
|
118
|
+
};
|
|
119
|
+
var createStyleFunction = function createStyleFunction(_ref) {
|
|
120
|
+
var properties = _ref.properties,
|
|
121
|
+
property = _ref.property,
|
|
122
|
+
scale = _ref.scale,
|
|
123
|
+
_ref$transform = _ref.transform,
|
|
124
|
+
transform = _ref$transform === void 0 ? getValue : _ref$transform,
|
|
125
|
+
defaultScale = _ref.defaultScale;
|
|
126
|
+
properties = properties || [property];
|
|
127
|
+
var sx = function sx(value, scale, _props) {
|
|
128
|
+
var result = {};
|
|
129
|
+
var n = transform(value, scale, _props);
|
|
130
|
+
if (n === null) return;
|
|
131
|
+
properties.forEach(function (prop) {
|
|
132
|
+
result[prop] = n;
|
|
133
|
+
});
|
|
134
|
+
return result;
|
|
135
|
+
};
|
|
136
|
+
sx.scale = scale;
|
|
137
|
+
sx.defaults = defaultScale;
|
|
138
|
+
return sx;
|
|
139
|
+
}; // new v5 API
|
|
140
|
+
|
|
141
|
+
var system = function system(args) {
|
|
142
|
+
if (args === void 0) {
|
|
143
|
+
args = {};
|
|
144
|
+
}
|
|
145
|
+
var config = {};
|
|
146
|
+
Object.keys(args).forEach(function (key) {
|
|
147
|
+
var conf = args[key];
|
|
148
|
+
if (conf === true) {
|
|
149
|
+
// shortcut definition
|
|
150
|
+
config[key] = createStyleFunction({
|
|
151
|
+
property: key,
|
|
152
|
+
scale: key
|
|
153
|
+
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (typeof conf === 'function') {
|
|
157
|
+
config[key] = conf;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
config[key] = createStyleFunction(conf);
|
|
161
|
+
});
|
|
162
|
+
var parser = createParser(config);
|
|
163
|
+
return parser;
|
|
164
|
+
};
|
|
165
|
+
var compose = function compose() {
|
|
166
|
+
var config = {};
|
|
167
|
+
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
168
|
+
parsers[_key] = arguments[_key];
|
|
169
|
+
}
|
|
170
|
+
parsers.forEach(function (parser) {
|
|
171
|
+
if (!parser || !parser.config) return;
|
|
172
|
+
assign(config, parser.config);
|
|
173
|
+
});
|
|
174
|
+
var parser = createParser(config);
|
|
175
|
+
return parser;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export { compose, createParser, createStyleFunction, get, merge, system };
|