@elliemae/ds-system 2.2.0-alpha.1 → 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/esm/styled/utils.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const coerceWithDefaultTheme = themeInput => themeInput !== null && themeInput !== void 0 ? themeInput : systemTheme;
|
|
10
|
-
const propsToClassKey = props => Object.keys(props).sort().reduce((classKey, key) => {
|
|
11
|
-
if (key === 'color') {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { capitalize } from "@elliemae/ds-utilities";
|
|
3
|
+
import { theme as defaultTheme } from "../theme";
|
|
4
|
+
const systemTheme = defaultTheme;
|
|
5
|
+
const isEmpty = (string) => string.length === 0;
|
|
6
|
+
const coerceWithDefaultTheme = (themeInput) => themeInput ?? systemTheme;
|
|
7
|
+
const propsToClassKey = (props) => Object.keys(props).sort().reduce((classKey, key) => {
|
|
8
|
+
if (key === "color") {
|
|
12
9
|
return classKey + isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key]));
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
|
|
12
|
+
}, "");
|
|
13
|
+
export {
|
|
14
|
+
coerceWithDefaultTheme,
|
|
15
|
+
isEmpty,
|
|
16
|
+
propsToClassKey
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/styled/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { Theme } from './types';\nimport { capitalize } from '@elliemae/ds-utilities';\nimport { theme as defaultTheme } from '../theme';\n\nconst systemTheme = defaultTheme;\n\nexport const isEmpty = (string: string): boolean => string.length === 0;\n\nexport const coerceWithDefaultTheme = (themeInput: Theme): Theme => themeInput ?? systemTheme;\n\nexport const propsToClassKey = (props: Record<string, { toString: () => string }>): string =>\n Object.keys(props)\n .sort()\n .reduce((classKey, key) => {\n if (key === 'color') {\n return classKey + isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key]));\n }\n return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;\n }, '');\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AAEA,MAAM,cAAc;AAEb,MAAM,UAAU,CAAC,WAA4B,OAAO,WAAW;AAE/D,MAAM,yBAAyB,CAAC,eAA6B,cAAc;AAE3E,MAAM,kBAAkB,CAAC,UAC9B,OAAO,KAAK,OACT,OACA,OAAO,CAAC,UAAU,QAAQ;AACzB,MAAI,QAAQ,SAAS;AACnB,WAAO,WAAW,QAAQ,OAAO,aAAa,OAAO,MAAM,QAAQ,WAAW,OAAO,MAAM;AAAA;AAE7F,SAAO,GAAG,WAAW,QAAQ,OAAO,aAAa,MAAM,WAAW,OAAO,WAAW,MAAM,KAAK;AAAA,GAC9F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/th.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const th = property => (value, dfault) => _ref => {
|
|
6
|
-
var _result;
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
theme
|
|
10
|
-
} = _ref;
|
|
11
|
-
const parts = value.split('-');
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const th = (property) => (value, dfault) => ({ theme }) => {
|
|
3
|
+
const parts = value.split("-");
|
|
12
4
|
let result = theme[property];
|
|
13
|
-
parts.forEach(part => {
|
|
14
|
-
if (result)
|
|
5
|
+
parts.forEach((part) => {
|
|
6
|
+
if (result)
|
|
7
|
+
result = result[part];
|
|
15
8
|
});
|
|
16
|
-
return
|
|
9
|
+
return result ?? dfault;
|
|
17
10
|
};
|
|
18
|
-
th.space = th(
|
|
19
|
-
th.fontSize = th(
|
|
20
|
-
th.fontWeight = th(
|
|
21
|
-
th.lineHeight = th(
|
|
22
|
-
th.letterSpacing = th(
|
|
23
|
-
th.font = th(
|
|
24
|
-
th.color = th(
|
|
25
|
-
th.breakpoint = th(
|
|
26
|
-
th.media = th(
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
th.space = th("space");
|
|
12
|
+
th.fontSize = th("fontSizes");
|
|
13
|
+
th.fontWeight = th("fontWeights");
|
|
14
|
+
th.lineHeight = th("lineHeights");
|
|
15
|
+
th.letterSpacing = th("letterSpacings");
|
|
16
|
+
th.font = th("fonts");
|
|
17
|
+
th.color = th("colors");
|
|
18
|
+
th.breakpoint = th("breakpoints");
|
|
19
|
+
th.media = th("media");
|
|
20
|
+
export {
|
|
21
|
+
th
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=th.js.map
|
package/esm/th.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/th.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "type thGetter = (value: string, dfault: string) => (theme: any) => string;\ntype thConstructor = ((property: string) => thGetter) & {\n space: thGetter;\n fontSize: thGetter;\n fontWeight: thGetter;\n lineHeight: thGetter;\n letterSpacing: thGetter;\n font: thGetter;\n color: thGetter;\n breakpoint: thGetter;\n media: thGetter;\n};\n\nexport const th: thConstructor =\n (property) =>\n (value, dfault) =>\n ({ theme }) => {\n const parts = value.split('-');\n let result = theme[property];\n parts.forEach((part) => {\n if (result) result = result[part];\n });\n return result ?? dfault;\n };\n\nth.space = th('space');\nth.fontSize = th('fontSizes');\nth.fontWeight = th('fontWeights');\nth.lineHeight = th('lineHeights');\nth.letterSpacing = th('letterSpacings');\nth.font = th('fonts');\nth.color = th('colors');\nth.breakpoint = th('breakpoints');\nth.media = th('media');\n"],
|
|
5
|
+
"mappings": "AAAA;ACaO,MAAM,KACX,CAAC,aACD,CAAC,OAAO,WACR,CAAC,EAAE,YAAY;AACb,QAAM,QAAQ,MAAM,MAAM;AAC1B,MAAI,SAAS,MAAM;AACnB,QAAM,QAAQ,CAAC,SAAS;AACtB,QAAI;AAAQ,eAAS,OAAO;AAAA;AAE9B,SAAO,UAAU;AAAA;AAGrB,GAAG,QAAQ,GAAG;AACd,GAAG,WAAW,GAAG;AACjB,GAAG,aAAa,GAAG;AACnB,GAAG,aAAa,GAAG;AACnB,GAAG,gBAAgB,GAAG;AACtB,GAAG,OAAO,GAAG;AACb,GAAG,QAAQ,GAAG;AACd,GAAG,aAAa,GAAG;AACnB,GAAG,QAAQ,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/theme.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
3
3
|
const theme = getDefaultTheme();
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export {
|
|
5
|
+
theme
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=theme.js.map
|
package/esm/theme.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/theme.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\n\nexport const theme = getDefaultTheme() as Theme;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAGO,MAAM,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/themeProviderHOC.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
const themeProviderHOC = Component => props => /*#__PURE__*/_jsx2(ThemeProvider, {
|
|
17
|
-
theme: theme
|
|
18
|
-
}, void 0, /*#__PURE__*/jsx(Component, _objectSpread({}, props)));
|
|
19
|
-
|
|
20
|
-
export { themeProviderHOC };
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { ThemeProvider } from "styled-components";
|
|
4
|
+
import { theme } from "./theme";
|
|
5
|
+
const themeProviderHOC = (Component) => (props) => /* @__PURE__ */ React2.createElement(ThemeProvider, {
|
|
6
|
+
theme
|
|
7
|
+
}, /* @__PURE__ */ React2.createElement(Component, {
|
|
8
|
+
...props
|
|
9
|
+
}));
|
|
10
|
+
export {
|
|
11
|
+
themeProviderHOC
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=themeProviderHOC.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/themeProviderHOC.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEO,MAAM,mBAAmB,CAAC,cAAiC,CAChE,UAEA,qCAAC,eAAD;AAAA,EAAe;AAAA,GACb,qCAAC,WAAD;AAAA,KAAe;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/utils.js
CHANGED
|
@@ -1,136 +1,266 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { reduce } from
|
|
4
|
-
import { theme } from
|
|
5
|
-
import { toMobile } from
|
|
6
|
-
import { css, keyframes as
|
|
7
|
-
export { createGlobalStyle, css, keyframes as kfrm, useTheme, withTheme } from 'styled-components';
|
|
8
|
-
|
|
9
|
-
/* eslint-disable no-shadow */
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { lighten, rgba } from "polished";
|
|
3
|
+
import { reduce } from "lodash";
|
|
4
|
+
import { theme } from "./theme";
|
|
5
|
+
import { toMobile } from "./mobileUtilities";
|
|
6
|
+
import { css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from "styled-components";
|
|
10
7
|
function truncate(width) {
|
|
11
|
-
return props => css
|
|
8
|
+
return (props) => css`
|
|
9
|
+
${!!width || props.width ? `width: ${props.width || width};` : ""}
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
text-overflow: ellipsis;
|
|
13
|
+
`;
|
|
12
14
|
}
|
|
13
15
|
function flexCenter() {
|
|
14
|
-
return
|
|
16
|
+
return `
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
`;
|
|
15
21
|
}
|
|
16
22
|
function disabled() {
|
|
17
|
-
return
|
|
23
|
+
return `
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
`;
|
|
18
27
|
}
|
|
19
28
|
function keyframes(obj) {
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
return kfrm`${reduce(obj, (result, value, key) => `
|
|
30
|
+
${result}
|
|
31
|
+
${key}% {
|
|
32
|
+
${value}
|
|
33
|
+
}
|
|
34
|
+
`, "")}
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
function boxShadow(top, left, blur, color2, inset = false) {
|
|
38
|
+
return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${color2};`;
|
|
39
|
+
}
|
|
40
|
+
function color(variant = "neutral", type = 400) {
|
|
41
|
+
return css`
|
|
42
|
+
color: ${(props) => props.theme.colors[variant][type]};
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
function border(color2 = theme.colors.brand[600], size = "1px", type = "solid") {
|
|
46
|
+
return `${size} ${type} ${color2}`;
|
|
37
47
|
}
|
|
38
48
|
function animation(animationKeyframes, animationLength, animationTimingFn) {
|
|
39
|
-
return props => css
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
return (props) => css`
|
|
50
|
+
animation: ${props.animationKeyframes || animationKeyframes}
|
|
51
|
+
${props.animationLength || animationLength}
|
|
52
|
+
${props.animationTimingFn || animationTimingFn};
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
function focus(color2 = theme.colors.brand[600]) {
|
|
56
|
+
return () => css`
|
|
57
|
+
outline: none;
|
|
58
|
+
border: 1px solid ${color2};
|
|
59
|
+
box-shadow: inset 0 0 0 1px ${lighten(0.3, color2)};
|
|
60
|
+
border-radius: 2px;
|
|
61
|
+
`;
|
|
45
62
|
}
|
|
46
|
-
function focusAfter(
|
|
47
|
-
return css
|
|
63
|
+
function focusAfter(color2) {
|
|
64
|
+
return css`
|
|
65
|
+
outline: none;
|
|
66
|
+
position: relative;
|
|
67
|
+
&:after {
|
|
68
|
+
content: '';
|
|
69
|
+
z-index: 10;
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: 0;
|
|
72
|
+
left: 0;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
${focus(color2)}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
48
79
|
}
|
|
49
80
|
function active() {
|
|
50
|
-
return props => css
|
|
81
|
+
return (props) => css`
|
|
82
|
+
outline: none;
|
|
83
|
+
border: 1px solid ${props.theme.colors.brand[700]};
|
|
84
|
+
border-radius: 2px;
|
|
85
|
+
`;
|
|
51
86
|
}
|
|
52
87
|
function hover() {
|
|
53
|
-
return props => css
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
return (props) => css`
|
|
89
|
+
outline: 1px solid ${props.theme.colors.brand[600]};
|
|
90
|
+
outline-offset: -1px;
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
function textStyle(type, weight = "regular") {
|
|
94
|
+
return (props) => {
|
|
95
|
+
let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;
|
|
61
96
|
switch (type) {
|
|
62
|
-
case
|
|
63
|
-
cssVar +=
|
|
97
|
+
case "h1":
|
|
98
|
+
cssVar += `
|
|
99
|
+
font-size: ${toMobile("2.7692rem")};
|
|
100
|
+
line-height: normal;
|
|
101
|
+
`;
|
|
64
102
|
break;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
103
|
+
case "h2":
|
|
104
|
+
cssVar += `
|
|
105
|
+
font-size: ${toMobile(props.theme.fontSizes.title[800])};
|
|
106
|
+
line-height: normal;
|
|
107
|
+
`;
|
|
68
108
|
break;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
109
|
+
case "h3":
|
|
110
|
+
cssVar += `
|
|
111
|
+
font-size: ${toMobile(props.theme.fontSizes.title[700])};
|
|
112
|
+
line-height: 1.2;
|
|
113
|
+
`;
|
|
72
114
|
break;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
115
|
+
case "h4":
|
|
116
|
+
cssVar += `
|
|
117
|
+
font-size: ${toMobile(props.theme.fontSizes.title[600])};
|
|
118
|
+
line-height: normal;
|
|
119
|
+
`;
|
|
76
120
|
break;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
121
|
+
case "h5":
|
|
122
|
+
cssVar += `
|
|
123
|
+
font-size: ${toMobile(props.theme.fontSizes.title[500])};
|
|
124
|
+
line-height: normal;
|
|
125
|
+
`;
|
|
80
126
|
break;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
127
|
+
case "section-header":
|
|
128
|
+
cssVar += `
|
|
129
|
+
font-size: ${toMobile(props.theme.fontSizes.title[500])};
|
|
130
|
+
line-height: normal;
|
|
131
|
+
text-transform: uppercase;
|
|
132
|
+
`;
|
|
84
133
|
break;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
134
|
+
case "body":
|
|
135
|
+
cssVar += `
|
|
136
|
+
font-size: ${toMobile(props.theme.fontSizes.value[400])};
|
|
137
|
+
line-height: normal;
|
|
138
|
+
`;
|
|
88
139
|
break;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
140
|
+
case "body-small":
|
|
141
|
+
cssVar += `
|
|
142
|
+
font-size: ${toMobile(props.theme.fontSizes.value[300])};
|
|
143
|
+
line-height: normal;
|
|
144
|
+
`;
|
|
92
145
|
break;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
146
|
+
case "body-micro":
|
|
147
|
+
cssVar += `
|
|
148
|
+
font-size: ${toMobile(props.theme.fontSizes.microText[200])};
|
|
149
|
+
line-height: normal;
|
|
150
|
+
`;
|
|
96
151
|
break;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
152
|
+
case "list":
|
|
153
|
+
cssVar += `
|
|
154
|
+
font-size: ${toMobile(props.theme.fontSizes.value[400])};
|
|
155
|
+
line-height: normal;
|
|
156
|
+
`;
|
|
100
157
|
break;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
158
|
+
case "link":
|
|
159
|
+
cssVar += `
|
|
160
|
+
line-height: ${props.theme.xl};
|
|
161
|
+
color: ${props.theme.colors.brand[600]};
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
`;
|
|
104
164
|
break;
|
|
105
165
|
}
|
|
106
|
-
|
|
107
166
|
return cssVar;
|
|
108
167
|
};
|
|
109
168
|
}
|
|
110
|
-
function iconColor() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
169
|
+
function iconColor(variant = "neutral", type = 400) {
|
|
170
|
+
return css`
|
|
171
|
+
fill: ${(props) => props.theme.colors[variant][type]};
|
|
172
|
+
`;
|
|
114
173
|
}
|
|
115
174
|
function fakeBorder() {
|
|
116
|
-
return css
|
|
175
|
+
return css`
|
|
176
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};
|
|
177
|
+
border-radius: 2px;
|
|
178
|
+
`;
|
|
117
179
|
}
|
|
118
180
|
function fakeActive() {
|
|
119
|
-
return css
|
|
181
|
+
return css`
|
|
182
|
+
outline: none;
|
|
183
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};
|
|
184
|
+
border-radius: 2px;
|
|
185
|
+
`;
|
|
120
186
|
}
|
|
121
187
|
function clearFocus() {
|
|
122
|
-
return
|
|
188
|
+
return `
|
|
189
|
+
border: none;
|
|
190
|
+
box-shadow: none;
|
|
191
|
+
`;
|
|
123
192
|
}
|
|
124
193
|
function buttonLink() {
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
194
|
+
return `
|
|
195
|
+
background-color: transparent;
|
|
196
|
+
border: 1px solid transparent;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
`;
|
|
199
|
+
}
|
|
200
|
+
function transition(t = "all 1s ease") {
|
|
201
|
+
return `
|
|
202
|
+
transition: ${t};
|
|
203
|
+
`;
|
|
204
|
+
}
|
|
205
|
+
const onlySafariAndFirefox = (styles) => css`
|
|
206
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
207
|
+
${styles}
|
|
208
|
+
}
|
|
209
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
210
|
+
${styles}
|
|
211
|
+
}
|
|
212
|
+
`;
|
|
213
|
+
const onlySafari = (styles) => `
|
|
214
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
215
|
+
${styles}
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
const onlyFirefox = (styles) => `
|
|
219
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
220
|
+
${styles}
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
const safariAndFirefoxBold = (color2) => `
|
|
224
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
225
|
+
font-weight: 400;
|
|
226
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
227
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
228
|
+
}
|
|
229
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
230
|
+
font-weight: 400;
|
|
231
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
232
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
export {
|
|
236
|
+
active,
|
|
237
|
+
animation,
|
|
238
|
+
border,
|
|
239
|
+
boxShadow,
|
|
240
|
+
buttonLink,
|
|
241
|
+
clearFocus,
|
|
242
|
+
color,
|
|
243
|
+
createGlobalStyle,
|
|
244
|
+
css,
|
|
245
|
+
disabled,
|
|
246
|
+
fakeActive,
|
|
247
|
+
fakeBorder,
|
|
248
|
+
flexCenter,
|
|
249
|
+
focus,
|
|
250
|
+
focusAfter,
|
|
251
|
+
hover,
|
|
252
|
+
iconColor,
|
|
253
|
+
keyframes,
|
|
254
|
+
kfrm,
|
|
255
|
+
onlyFirefox,
|
|
256
|
+
onlySafari,
|
|
257
|
+
onlySafariAndFirefox,
|
|
258
|
+
rgba,
|
|
259
|
+
safariAndFirefoxBold,
|
|
260
|
+
textStyle,
|
|
261
|
+
transition,
|
|
262
|
+
truncate,
|
|
263
|
+
useTheme,
|
|
264
|
+
withTheme
|
|
265
|
+
};
|
|
266
|
+
//# sourceMappingURL=utils.js.map
|
package/esm/utils.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
|
|
5
|
+
"mappings": "AAAA;ACGA;AACA;AAEA;AACA;AACA;AAIO,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,OAAO,OACZ,KACA,CAAC,QAAQ,OAAO,QAAQ;AAAA,MACtB;AAAA,MACA;A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AA;AAAA;AAOF,oBAAoB,IAAI,eAAuB;AACpD,SAAO;AAAA,kBACS;AAAA;AAAA;AAIX,MAAM,uBAAuB,CAAC,WAA2B;AAAA;AAAA,MAE1D;AAAA;AAAA;AAAA,MAGA;AAAA;AAAA;AAIC,MAAM,aAAa,CAAC,WAA2B;AAAA;AAAA,QAE9C;AAAA;AAAA;AAID,MAAM,cAAc,CAAC,WAA2B;AAAA;AAAA,QAE/C;AAAA;AAAA;AAID,MAAM,uBAAuB,CAAC,WAA0B;AAAA;AAAA;AAAA;AAAA,iCAI9B;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-system",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - System",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"generateSubmodules": true
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@elliemae/ds-utilities": "2.2.0-alpha.
|
|
92
|
+
"@elliemae/ds-utilities": "2.2.0-alpha.2",
|
|
93
93
|
"polished": "~3.6.7"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|