@elliemae/ds-system 2.1.0-rc.7 → 2.2.0-alpha.2
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/cjs/arithmetic.js +42 -30
- package/cjs/arithmetic.js.map +7 -0
- package/cjs/constants.js +43 -15
- package/cjs/constants.js.map +7 -0
- package/cjs/globalStyles.js +44 -22
- package/cjs/globalStyles.js.map +7 -0
- package/cjs/index.js +42 -83
- package/cjs/index.js.map +7 -0
- package/cjs/mobileUtilities.js +57 -26
- package/cjs/mobileUtilities.js.map +7 -0
- package/cjs/spaceUtilities.js +72 -46
- package/cjs/spaceUtilities.js.map +7 -0
- package/cjs/styled/index.d.js +27 -2
- package/cjs/styled/index.d.js.map +7 -0
- package/cjs/styled/index.js +57 -92
- package/cjs/styled/index.js.map +7 -0
- package/cjs/styled/styleGetters.js +42 -30
- package/cjs/styled/styleGetters.js.map +7 -0
- package/cjs/styled/types.js +34 -11
- package/cjs/styled/types.js.map +7 -0
- package/cjs/styled/utils.js +46 -23
- package/cjs/styled/utils.js.map +7 -0
- package/cjs/th.js +49 -29
- package/cjs/th.js.map +7 -0
- package/cjs/theme.js +36 -9
- package/cjs/theme.js.map +7 -0
- package/cjs/themeProviderHOC.js +42 -29
- package/cjs/themeProviderHOC.js.map +7 -0
- package/cjs/utils.js +257 -146
- package/cjs/utils.js.map +7 -0
- package/esm/arithmetic.js +13 -25
- package/esm/arithmetic.js.map +7 -0
- package/esm/constants.js +14 -9
- package/esm/constants.js.map +7 -0
- package/esm/globalStyles.js +16 -15
- package/esm/globalStyles.js.map +7 -0
- package/esm/index.js +14 -11
- package/esm/index.js.map +7 -0
- package/esm/mobileUtilities.js +26 -17
- package/esm/mobileUtilities.js.map +7 -0
- package/esm/spaceUtilities.js +43 -35
- package/esm/spaceUtilities.js.map +7 -0
- package/esm/styled/index.d.js +2 -1
- package/esm/styled/index.d.js.map +7 -0
- package/esm/styled/index.js +23 -78
- package/esm/styled/index.js.map +7 -0
- package/esm/styled/styleGetters.js +12 -23
- package/esm/styled/styleGetters.js.map +7 -0
- package/esm/styled/types.js +6 -1
- package/esm/styled/types.js.map +7 -0
- package/esm/styled/utils.js +16 -16
- package/esm/styled/utils.js.map +7 -0
- package/esm/th.js +20 -25
- package/esm/th.js.map +7 -0
- package/esm/theme.js +6 -4
- package/esm/theme.js.map +7 -0
- package/esm/themeProviderHOC.js +13 -20
- package/esm/themeProviderHOC.js.map +7 -0
- package/esm/utils.js +228 -98
- package/esm/utils.js.map +7 -0
- package/package.json +2 -2
package/cjs/theme.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var theme_exports = {};
|
|
29
|
+
__export(theme_exports, {
|
|
30
|
+
theme: () => theme
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_pui_theme = __toESM(require("@elliemae/pui-theme"));
|
|
34
|
+
const theme = (0, import_pui_theme.getDefaultTheme)();
|
|
35
|
+
module.exports = __toCommonJS(theme_exports);
|
|
36
|
+
//# sourceMappingURL=theme.js.map
|
package/cjs/theme.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/theme.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\n\nexport const theme = getDefaultTheme() as Theme;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAgC;AAGzB,MAAM,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/themeProviderHOC.js
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var themeProviderHOC_exports = {};
|
|
29
|
+
__export(themeProviderHOC_exports, {
|
|
30
|
+
themeProviderHOC: () => themeProviderHOC
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
35
|
+
var import_theme = __toESM(require("./theme"));
|
|
36
|
+
const themeProviderHOC = (Component) => (props) => /* @__PURE__ */ import_react.default.createElement(import_styled_components.ThemeProvider, {
|
|
37
|
+
theme: import_theme.theme
|
|
38
|
+
}, /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
39
|
+
...props
|
|
40
|
+
}));
|
|
41
|
+
module.exports = __toCommonJS(themeProviderHOC_exports);
|
|
42
|
+
//# sourceMappingURL=themeProviderHOC.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/themeProviderHOC.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { ThemeProvider } from 'styled-components';\nimport { theme } from './theme';\n\nexport const themeProviderHOC = (Component: React.ElementType) => (\n props: Record<string, unknown>,\n): JSX.Element => (\n <ThemeProvider theme={theme}>\n <Component {...props} />\n </ThemeProvider>\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,+BAA8B;AAC9B,mBAAsB;AAEf,MAAM,mBAAmB,CAAC,cAAiC,CAChE,UAEA,mDAAC,wCAAD;AAAA,EAAe,OAAO;AAAA,GACpB,mDAAC,WAAD;AAAA,KAAe;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/utils.js
CHANGED
|
@@ -1,184 +1,295 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var utils_exports = {};
|
|
29
|
+
__export(utils_exports, {
|
|
30
|
+
active: () => active,
|
|
31
|
+
animation: () => animation,
|
|
32
|
+
border: () => border,
|
|
33
|
+
boxShadow: () => boxShadow,
|
|
34
|
+
buttonLink: () => buttonLink,
|
|
35
|
+
clearFocus: () => clearFocus,
|
|
36
|
+
color: () => color,
|
|
37
|
+
createGlobalStyle: () => import_styled_components2.createGlobalStyle,
|
|
38
|
+
css: () => import_styled_components2.css,
|
|
39
|
+
disabled: () => disabled,
|
|
40
|
+
fakeActive: () => fakeActive,
|
|
41
|
+
fakeBorder: () => fakeBorder,
|
|
42
|
+
flexCenter: () => flexCenter,
|
|
43
|
+
focus: () => focus,
|
|
44
|
+
focusAfter: () => focusAfter,
|
|
45
|
+
hover: () => hover,
|
|
46
|
+
iconColor: () => iconColor,
|
|
47
|
+
keyframes: () => keyframes,
|
|
48
|
+
kfrm: () => import_styled_components2.keyframes,
|
|
49
|
+
onlyFirefox: () => onlyFirefox,
|
|
50
|
+
onlySafari: () => onlySafari,
|
|
51
|
+
onlySafariAndFirefox: () => onlySafariAndFirefox,
|
|
52
|
+
rgba: () => import_polished.rgba,
|
|
53
|
+
safariAndFirefoxBold: () => safariAndFirefoxBold,
|
|
54
|
+
textStyle: () => textStyle,
|
|
55
|
+
transition: () => transition,
|
|
56
|
+
truncate: () => truncate,
|
|
57
|
+
useTheme: () => import_styled_components2.useTheme,
|
|
58
|
+
withTheme: () => import_styled_components2.withTheme
|
|
59
|
+
});
|
|
60
|
+
var React = __toESM(require("react"));
|
|
61
|
+
var import_polished = __toESM(require("polished"));
|
|
62
|
+
var import_lodash = __toESM(require("lodash"));
|
|
63
|
+
var import_theme = __toESM(require("./theme"));
|
|
64
|
+
var import_mobileUtilities = __toESM(require("./mobileUtilities"));
|
|
65
|
+
var import_styled_components2 = __toESM(require("styled-components"));
|
|
12
66
|
function truncate(width) {
|
|
13
|
-
return props =>
|
|
67
|
+
return (props) => import_styled_components2.css`
|
|
68
|
+
${!!width || props.width ? `width: ${props.width || width};` : ""}
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
`;
|
|
14
73
|
}
|
|
15
74
|
function flexCenter() {
|
|
16
|
-
return
|
|
75
|
+
return `
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
`;
|
|
17
80
|
}
|
|
18
81
|
function disabled() {
|
|
19
|
-
return
|
|
82
|
+
return `
|
|
83
|
+
cursor: not-allowed;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
`;
|
|
20
86
|
}
|
|
21
87
|
function keyframes(obj) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
88
|
+
return import_styled_components2.keyframes`${(0, import_lodash.reduce)(obj, (result, value, key) => `
|
|
89
|
+
${result}
|
|
90
|
+
${key}% {
|
|
91
|
+
${value}
|
|
92
|
+
}
|
|
93
|
+
`, "")}
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
function boxShadow(top, left, blur, color2, inset = false) {
|
|
97
|
+
return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${color2};`;
|
|
98
|
+
}
|
|
99
|
+
function color(variant = "neutral", type = 400) {
|
|
100
|
+
return import_styled_components2.css`
|
|
101
|
+
color: ${(props) => props.theme.colors[variant][type]};
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
function border(color2 = import_theme.theme.colors.brand[600], size = "1px", type = "solid") {
|
|
105
|
+
return `${size} ${type} ${color2}`;
|
|
39
106
|
}
|
|
40
107
|
function animation(animationKeyframes, animationLength, animationTimingFn) {
|
|
41
|
-
return props =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
108
|
+
return (props) => import_styled_components2.css`
|
|
109
|
+
animation: ${props.animationKeyframes || animationKeyframes}
|
|
110
|
+
${props.animationLength || animationLength}
|
|
111
|
+
${props.animationTimingFn || animationTimingFn};
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
function focus(color2 = import_theme.theme.colors.brand[600]) {
|
|
115
|
+
return () => import_styled_components2.css`
|
|
116
|
+
outline: none;
|
|
117
|
+
border: 1px solid ${color2};
|
|
118
|
+
box-shadow: inset 0 0 0 1px ${(0, import_polished.lighten)(0.3, color2)};
|
|
119
|
+
border-radius: 2px;
|
|
120
|
+
`;
|
|
47
121
|
}
|
|
48
|
-
function focusAfter(
|
|
49
|
-
return
|
|
122
|
+
function focusAfter(color2) {
|
|
123
|
+
return import_styled_components2.css`
|
|
124
|
+
outline: none;
|
|
125
|
+
position: relative;
|
|
126
|
+
&:after {
|
|
127
|
+
content: '';
|
|
128
|
+
z-index: 10;
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: 0;
|
|
131
|
+
left: 0;
|
|
132
|
+
width: 100%;
|
|
133
|
+
height: 100%;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
${focus(color2)}
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
50
138
|
}
|
|
51
139
|
function active() {
|
|
52
|
-
return props =>
|
|
140
|
+
return (props) => import_styled_components2.css`
|
|
141
|
+
outline: none;
|
|
142
|
+
border: 1px solid ${props.theme.colors.brand[700]};
|
|
143
|
+
border-radius: 2px;
|
|
144
|
+
`;
|
|
53
145
|
}
|
|
54
146
|
function hover() {
|
|
55
|
-
return props =>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
147
|
+
return (props) => import_styled_components2.css`
|
|
148
|
+
outline: 1px solid ${props.theme.colors.brand[600]};
|
|
149
|
+
outline-offset: -1px;
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
function textStyle(type, weight = "regular") {
|
|
153
|
+
return (props) => {
|
|
154
|
+
let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;
|
|
63
155
|
switch (type) {
|
|
64
|
-
case
|
|
65
|
-
cssVar +=
|
|
156
|
+
case "h1":
|
|
157
|
+
cssVar += `
|
|
158
|
+
font-size: ${(0, import_mobileUtilities.toMobile)("2.7692rem")};
|
|
159
|
+
line-height: normal;
|
|
160
|
+
`;
|
|
66
161
|
break;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
162
|
+
case "h2":
|
|
163
|
+
cssVar += `
|
|
164
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[800])};
|
|
165
|
+
line-height: normal;
|
|
166
|
+
`;
|
|
70
167
|
break;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
168
|
+
case "h3":
|
|
169
|
+
cssVar += `
|
|
170
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[700])};
|
|
171
|
+
line-height: 1.2;
|
|
172
|
+
`;
|
|
74
173
|
break;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
174
|
+
case "h4":
|
|
175
|
+
cssVar += `
|
|
176
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[600])};
|
|
177
|
+
line-height: normal;
|
|
178
|
+
`;
|
|
78
179
|
break;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
180
|
+
case "h5":
|
|
181
|
+
cssVar += `
|
|
182
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
|
|
183
|
+
line-height: normal;
|
|
184
|
+
`;
|
|
82
185
|
break;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
186
|
+
case "section-header":
|
|
187
|
+
cssVar += `
|
|
188
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
|
|
189
|
+
line-height: normal;
|
|
190
|
+
text-transform: uppercase;
|
|
191
|
+
`;
|
|
86
192
|
break;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
193
|
+
case "body":
|
|
194
|
+
cssVar += `
|
|
195
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
|
|
196
|
+
line-height: normal;
|
|
197
|
+
`;
|
|
90
198
|
break;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
199
|
+
case "body-small":
|
|
200
|
+
cssVar += `
|
|
201
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[300])};
|
|
202
|
+
line-height: normal;
|
|
203
|
+
`;
|
|
94
204
|
break;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
205
|
+
case "body-micro":
|
|
206
|
+
cssVar += `
|
|
207
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.microText[200])};
|
|
208
|
+
line-height: normal;
|
|
209
|
+
`;
|
|
98
210
|
break;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
211
|
+
case "list":
|
|
212
|
+
cssVar += `
|
|
213
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
|
|
214
|
+
line-height: normal;
|
|
215
|
+
`;
|
|
102
216
|
break;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
217
|
+
case "link":
|
|
218
|
+
cssVar += `
|
|
219
|
+
line-height: ${props.theme.xl};
|
|
220
|
+
color: ${props.theme.colors.brand[600]};
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
`;
|
|
106
223
|
break;
|
|
107
224
|
}
|
|
108
|
-
|
|
109
225
|
return cssVar;
|
|
110
226
|
};
|
|
111
227
|
}
|
|
112
|
-
function iconColor() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
228
|
+
function iconColor(variant = "neutral", type = 400) {
|
|
229
|
+
return import_styled_components2.css`
|
|
230
|
+
fill: ${(props) => props.theme.colors[variant][type]};
|
|
231
|
+
`;
|
|
116
232
|
}
|
|
117
233
|
function fakeBorder() {
|
|
118
|
-
return
|
|
234
|
+
return import_styled_components2.css`
|
|
235
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};
|
|
236
|
+
border-radius: 2px;
|
|
237
|
+
`;
|
|
119
238
|
}
|
|
120
239
|
function fakeActive() {
|
|
121
|
-
return
|
|
240
|
+
return import_styled_components2.css`
|
|
241
|
+
outline: none;
|
|
242
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};
|
|
243
|
+
border-radius: 2px;
|
|
244
|
+
`;
|
|
122
245
|
}
|
|
123
246
|
function clearFocus() {
|
|
124
|
-
return
|
|
247
|
+
return `
|
|
248
|
+
border: none;
|
|
249
|
+
box-shadow: none;
|
|
250
|
+
`;
|
|
125
251
|
}
|
|
126
252
|
function buttonLink() {
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
exports
|
|
169
|
-
|
|
170
|
-
exports.fakeActive = fakeActive;
|
|
171
|
-
exports.fakeBorder = fakeBorder;
|
|
172
|
-
exports.flexCenter = flexCenter;
|
|
173
|
-
exports.focus = focus;
|
|
174
|
-
exports.focusAfter = focusAfter;
|
|
175
|
-
exports.hover = hover;
|
|
176
|
-
exports.iconColor = iconColor;
|
|
177
|
-
exports.keyframes = keyframes;
|
|
178
|
-
exports.onlyFirefox = onlyFirefox;
|
|
179
|
-
exports.onlySafari = onlySafari;
|
|
180
|
-
exports.onlySafariAndFirefox = onlySafariAndFirefox;
|
|
181
|
-
exports.safariAndFirefoxBold = safariAndFirefoxBold;
|
|
182
|
-
exports.textStyle = textStyle;
|
|
183
|
-
exports.transition = transition;
|
|
184
|
-
exports.truncate = truncate;
|
|
253
|
+
return `
|
|
254
|
+
background-color: transparent;
|
|
255
|
+
border: 1px solid transparent;
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
`;
|
|
258
|
+
}
|
|
259
|
+
function transition(t = "all 1s ease") {
|
|
260
|
+
return `
|
|
261
|
+
transition: ${t};
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
const onlySafariAndFirefox = (styles) => import_styled_components2.css`
|
|
265
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
266
|
+
${styles}
|
|
267
|
+
}
|
|
268
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
269
|
+
${styles}
|
|
270
|
+
}
|
|
271
|
+
`;
|
|
272
|
+
const onlySafari = (styles) => `
|
|
273
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
274
|
+
${styles}
|
|
275
|
+
}
|
|
276
|
+
`;
|
|
277
|
+
const onlyFirefox = (styles) => `
|
|
278
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
279
|
+
${styles}
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
const safariAndFirefoxBold = (color2) => `
|
|
283
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
284
|
+
font-weight: 400;
|
|
285
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
286
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
287
|
+
}
|
|
288
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
289
|
+
font-weight: 400;
|
|
290
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
291
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
292
|
+
}
|
|
293
|
+
`;
|
|
294
|
+
module.exports = __toCommonJS(utils_exports);
|
|
295
|
+
//# sourceMappingURL=utils.js.map
|
package/cjs/utils.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\nimport { lighten, rgba } from 'polished';\nimport { reduce } from 'lodash';\nimport { Keyframes } from 'styled-components';\nimport { theme } from './theme';\nimport { toMobile } from './mobileUtilities';\nimport { css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from 'styled-components';\n\nexport { withTheme, createGlobalStyle, rgba, useTheme, kfrm, css };\n\nexport function truncate(width?: string) {\n return (props) => css`\n ${!!width || props.width ? `width: ${props.width || width};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, unknown>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\nexport function color(variant = 'neutral', type = 400) {\n return css`\n color: ${(props) => props.theme.colors[variant][type]};\n `;\n}\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(\n animationKeyframes: string,\n animationLength: string,\n animationTimingFn: string,\n) {\n return (props) => css`\n animation: ${props.animationKeyframes || animationKeyframes}\n ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n// 0.0769\nexport function focus(color: string = theme.colors.brand[600]) {\n return () => css`\n outline: none;\n border: 1px solid ${color};\n box-shadow: inset 0 0 0 1px ${lighten(0.3, color)};\n border-radius: 2px;\n `;\n}\n\nexport function focusAfter(color: string) {\n return css`\n outline: none;\n position: relative;\n &:after {\n content: '';\n z-index: 10;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n ${focus(color)}\n }\n `;\n}\n\nexport function active() {\n return (props) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight = 'regular') {\n // eslint-disable-next-line complexity\n return (props): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${(props) => props.theme.colors[variant][type]};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): string => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ${color};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,sBAA8B;AAC9B,oBAAuB;AAEvB,mBAAsB;AACtB,6BAAyB;AACzB,gCAA+E;AAIxE,kBAAkB,OAAgB;AACvC,SAAO,CAAC,UAAU;AAAA,MACd,CAAC,CAAC,SAAS,MAAM,QAAQ,UAAU,MAAM,SAAS,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAO5D,sBAA8B;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOF,oBAA4B;AACjC,SAAO;AAAA;AAAA;AAAA;AAAA;AAMF,mBAAmB,KAAyC;AACjE,SAAO,sCAAO,0BACZ,KACA,CAAC,QAAQ,OAAO,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,QACE;AAAA;AAAA,KAGJ;AAAA;AAAA;AAMG,mBAAmB,KAAa,MAAc,MAAc,QAAe,QAAQ,OAAe;AACvG,SAAO,eAAe,QAAQ,UAAU,MAAM,OAAO,QAAQ,QAAQ;AAAA;AAGhE,eAAe,UAAU,WAAW,OAAO,KAAK;AACr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