@elliemae/ds-system 2.2.0-next.6 → 2.3.0-alpha.1
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 -93
- 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 +50 -33
- 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 +256 -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 -79
- 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 +22 -30
- 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 +227 -98
- package/esm/utils.js.map +7 -0
- package/package.json +2 -2
- package/types/styled/types.d.ts +1 -2
- package/types/th.d.ts +12 -12
- package/types/utils.d.ts +1 -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 = 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 = require("styled-components");
|
|
35
|
+
var import_theme = 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,294 @@
|
|
|
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_components.createGlobalStyle,
|
|
38
|
+
css: () => import_styled_components.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_components.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_components.useTheme,
|
|
58
|
+
withTheme: () => import_styled_components.withTheme
|
|
59
|
+
});
|
|
60
|
+
var React = __toESM(require("react"));
|
|
61
|
+
var import_polished = require("polished");
|
|
62
|
+
var import_lodash = require("lodash");
|
|
63
|
+
var import_styled_components = require("styled-components");
|
|
64
|
+
var import_theme = require("./theme");
|
|
65
|
+
var import_mobileUtilities = require("./mobileUtilities");
|
|
12
66
|
function truncate(width) {
|
|
13
|
-
return props =>
|
|
67
|
+
return (props) => import_styled_components.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_components.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_components.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_components.css`
|
|
109
|
+
animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}
|
|
110
|
+
${props.animationTimingFn || animationTimingFn};
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
function focus(color2 = import_theme.theme.colors.brand[600]) {
|
|
114
|
+
return () => import_styled_components.css`
|
|
115
|
+
outline: none;
|
|
116
|
+
border: 1px solid ${color2};
|
|
117
|
+
box-shadow: inset 0 0 0 1px ${(0, import_polished.lighten)(0.3, color2)};
|
|
118
|
+
border-radius: 2px;
|
|
119
|
+
`;
|
|
47
120
|
}
|
|
48
|
-
function focusAfter(
|
|
49
|
-
return
|
|
121
|
+
function focusAfter(color2) {
|
|
122
|
+
return import_styled_components.css`
|
|
123
|
+
outline: none;
|
|
124
|
+
position: relative;
|
|
125
|
+
&:after {
|
|
126
|
+
content: '';
|
|
127
|
+
z-index: 10;
|
|
128
|
+
position: absolute;
|
|
129
|
+
top: 0;
|
|
130
|
+
left: 0;
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
pointer-events: none;
|
|
134
|
+
${focus(color2)}
|
|
135
|
+
}
|
|
136
|
+
`;
|
|
50
137
|
}
|
|
51
138
|
function active() {
|
|
52
|
-
return props =>
|
|
139
|
+
return (props) => import_styled_components.css`
|
|
140
|
+
outline: none;
|
|
141
|
+
border: 1px solid ${props.theme.colors.brand[700]};
|
|
142
|
+
border-radius: 2px;
|
|
143
|
+
`;
|
|
53
144
|
}
|
|
54
145
|
function hover() {
|
|
55
|
-
return props =>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
146
|
+
return (props) => import_styled_components.css`
|
|
147
|
+
outline: 1px solid ${props.theme.colors.brand[600]};
|
|
148
|
+
outline-offset: -1px;
|
|
149
|
+
`;
|
|
150
|
+
}
|
|
151
|
+
function textStyle(type, weight = "regular") {
|
|
152
|
+
return (props) => {
|
|
153
|
+
let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;
|
|
63
154
|
switch (type) {
|
|
64
|
-
case
|
|
65
|
-
cssVar +=
|
|
155
|
+
case "h1":
|
|
156
|
+
cssVar += `
|
|
157
|
+
font-size: ${(0, import_mobileUtilities.toMobile)("2.7692rem")};
|
|
158
|
+
line-height: normal;
|
|
159
|
+
`;
|
|
66
160
|
break;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
161
|
+
case "h2":
|
|
162
|
+
cssVar += `
|
|
163
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[800])};
|
|
164
|
+
line-height: normal;
|
|
165
|
+
`;
|
|
70
166
|
break;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
167
|
+
case "h3":
|
|
168
|
+
cssVar += `
|
|
169
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[700])};
|
|
170
|
+
line-height: 1.2;
|
|
171
|
+
`;
|
|
74
172
|
break;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
173
|
+
case "h4":
|
|
174
|
+
cssVar += `
|
|
175
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[600])};
|
|
176
|
+
line-height: normal;
|
|
177
|
+
`;
|
|
78
178
|
break;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
179
|
+
case "h5":
|
|
180
|
+
cssVar += `
|
|
181
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
|
|
182
|
+
line-height: normal;
|
|
183
|
+
`;
|
|
82
184
|
break;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
185
|
+
case "section-header":
|
|
186
|
+
cssVar += `
|
|
187
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.title[500])};
|
|
188
|
+
line-height: normal;
|
|
189
|
+
text-transform: uppercase;
|
|
190
|
+
`;
|
|
86
191
|
break;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
192
|
+
case "body":
|
|
193
|
+
cssVar += `
|
|
194
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
|
|
195
|
+
line-height: normal;
|
|
196
|
+
`;
|
|
90
197
|
break;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
198
|
+
case "body-small":
|
|
199
|
+
cssVar += `
|
|
200
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[300])};
|
|
201
|
+
line-height: normal;
|
|
202
|
+
`;
|
|
94
203
|
break;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
204
|
+
case "body-micro":
|
|
205
|
+
cssVar += `
|
|
206
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.microText[200])};
|
|
207
|
+
line-height: normal;
|
|
208
|
+
`;
|
|
98
209
|
break;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
210
|
+
case "list":
|
|
211
|
+
cssVar += `
|
|
212
|
+
font-size: ${(0, import_mobileUtilities.toMobile)(props.theme.fontSizes.value[400])};
|
|
213
|
+
line-height: normal;
|
|
214
|
+
`;
|
|
102
215
|
break;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
216
|
+
case "link":
|
|
217
|
+
cssVar += `
|
|
218
|
+
line-height: ${props.theme.xl};
|
|
219
|
+
color: ${props.theme.colors.brand[600]};
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
`;
|
|
106
222
|
break;
|
|
107
223
|
}
|
|
108
|
-
|
|
109
224
|
return cssVar;
|
|
110
225
|
};
|
|
111
226
|
}
|
|
112
|
-
function iconColor() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
227
|
+
function iconColor(variant = "neutral", type = 400) {
|
|
228
|
+
return import_styled_components.css`
|
|
229
|
+
fill: ${(props) => props.theme.colors[variant][type]};
|
|
230
|
+
`;
|
|
116
231
|
}
|
|
117
232
|
function fakeBorder() {
|
|
118
|
-
return
|
|
233
|
+
return import_styled_components.css`
|
|
234
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};
|
|
235
|
+
border-radius: 2px;
|
|
236
|
+
`;
|
|
119
237
|
}
|
|
120
238
|
function fakeActive() {
|
|
121
|
-
return
|
|
239
|
+
return import_styled_components.css`
|
|
240
|
+
outline: none;
|
|
241
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};
|
|
242
|
+
border-radius: 2px;
|
|
243
|
+
`;
|
|
122
244
|
}
|
|
123
245
|
function clearFocus() {
|
|
124
|
-
return
|
|
246
|
+
return `
|
|
247
|
+
border: none;
|
|
248
|
+
box-shadow: none;
|
|
249
|
+
`;
|
|
125
250
|
}
|
|
126
251
|
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;
|
|
252
|
+
return `
|
|
253
|
+
background-color: transparent;
|
|
254
|
+
border: 1px solid transparent;
|
|
255
|
+
cursor: pointer;
|
|
256
|
+
`;
|
|
257
|
+
}
|
|
258
|
+
function transition(t = "all 1s ease") {
|
|
259
|
+
return `
|
|
260
|
+
transition: ${t};
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
263
|
+
const onlySafariAndFirefox = (styles) => import_styled_components.css`
|
|
264
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
265
|
+
${styles}
|
|
266
|
+
}
|
|
267
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
268
|
+
${styles}
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
const onlySafari = (styles) => `
|
|
272
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
273
|
+
${styles}
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
const onlyFirefox = (styles) => `
|
|
277
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
278
|
+
${styles}
|
|
279
|
+
}
|
|
280
|
+
`;
|
|
281
|
+
const safariAndFirefoxBold = (color2) => `
|
|
282
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
283
|
+
font-weight: 400;
|
|
284
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
285
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
286
|
+
}
|
|
287
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
288
|
+
font-weight: 400;
|
|
289
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
290
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
291
|
+
}
|
|
292
|
+
`;
|
|
293
|
+
module.exports = __toCommonJS(utils_exports);
|
|
294
|
+
//# 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, css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from 'styled-components';\nimport { theme } from './theme';\nimport { toMobile } from './mobileUtilities';\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(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${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;AACvB,+BAA0F;AAC1F,mBAAsB;AACtB,6BAAyB;AAIlB,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,qCAAO,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;AACrD,SAAO;AAAA,aACI,CAAC,UAAU,MAAM,MAAM,OAAO,SAAS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