@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/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 { capitalize } from '@elliemae/ds-utilities';\nimport type { Theme } from './types';\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;ACAA;AAEA;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,31 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
theme
|
|
12
|
-
} = _ref;
|
|
13
|
-
const parts = value.split('-');
|
|
14
|
-
let result = theme[property];
|
|
15
|
-
parts.forEach(part => {
|
|
16
|
-
if (result) result = result[part];
|
|
17
|
-
});
|
|
18
|
-
return (_result = result) !== null && _result !== void 0 ? _result : dfault;
|
|
19
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const th = (property) => (value, dfault) => ({ theme }) => {
|
|
3
|
+
const parts = value.split("-");
|
|
4
|
+
let result = theme[property];
|
|
5
|
+
parts.forEach((part) => {
|
|
6
|
+
if (result)
|
|
7
|
+
result = result[part];
|
|
8
|
+
});
|
|
9
|
+
return result ?? dfault;
|
|
20
10
|
};
|
|
21
|
-
th.space = th(
|
|
22
|
-
th.fontSize = th(
|
|
23
|
-
th.fontWeight = th(
|
|
24
|
-
th.lineHeight = th(
|
|
25
|
-
th.letterSpacing = th(
|
|
26
|
-
th.font = th(
|
|
27
|
-
th.color = th(
|
|
28
|
-
th.breakpoint = th(
|
|
29
|
-
th.media = th(
|
|
30
|
-
|
|
31
|
-
|
|
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,265 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { reduce } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from "styled-components";
|
|
5
|
+
import { theme } from "./theme";
|
|
6
|
+
import { toMobile } from "./mobileUtilities";
|
|
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} ${props.animationLength || animationLength}
|
|
51
|
+
${props.animationTimingFn || animationTimingFn};
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
function focus(color2 = theme.colors.brand[600]) {
|
|
55
|
+
return () => css`
|
|
56
|
+
outline: none;
|
|
57
|
+
border: 1px solid ${color2};
|
|
58
|
+
box-shadow: inset 0 0 0 1px ${lighten(0.3, color2)};
|
|
59
|
+
border-radius: 2px;
|
|
60
|
+
`;
|
|
45
61
|
}
|
|
46
|
-
function focusAfter(
|
|
47
|
-
return css
|
|
62
|
+
function focusAfter(color2) {
|
|
63
|
+
return css`
|
|
64
|
+
outline: none;
|
|
65
|
+
position: relative;
|
|
66
|
+
&:after {
|
|
67
|
+
content: '';
|
|
68
|
+
z-index: 10;
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 0;
|
|
71
|
+
left: 0;
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
${focus(color2)}
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
48
78
|
}
|
|
49
79
|
function active() {
|
|
50
|
-
return props => css
|
|
80
|
+
return (props) => css`
|
|
81
|
+
outline: none;
|
|
82
|
+
border: 1px solid ${props.theme.colors.brand[700]};
|
|
83
|
+
border-radius: 2px;
|
|
84
|
+
`;
|
|
51
85
|
}
|
|
52
86
|
function hover() {
|
|
53
|
-
return props => css
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
87
|
+
return (props) => css`
|
|
88
|
+
outline: 1px solid ${props.theme.colors.brand[600]};
|
|
89
|
+
outline-offset: -1px;
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
function textStyle(type, weight = "regular") {
|
|
93
|
+
return (props) => {
|
|
94
|
+
let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;
|
|
61
95
|
switch (type) {
|
|
62
|
-
case
|
|
63
|
-
cssVar +=
|
|
96
|
+
case "h1":
|
|
97
|
+
cssVar += `
|
|
98
|
+
font-size: ${toMobile("2.7692rem")};
|
|
99
|
+
line-height: normal;
|
|
100
|
+
`;
|
|
64
101
|
break;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
102
|
+
case "h2":
|
|
103
|
+
cssVar += `
|
|
104
|
+
font-size: ${toMobile(props.theme.fontSizes.title[800])};
|
|
105
|
+
line-height: normal;
|
|
106
|
+
`;
|
|
68
107
|
break;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
108
|
+
case "h3":
|
|
109
|
+
cssVar += `
|
|
110
|
+
font-size: ${toMobile(props.theme.fontSizes.title[700])};
|
|
111
|
+
line-height: 1.2;
|
|
112
|
+
`;
|
|
72
113
|
break;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
114
|
+
case "h4":
|
|
115
|
+
cssVar += `
|
|
116
|
+
font-size: ${toMobile(props.theme.fontSizes.title[600])};
|
|
117
|
+
line-height: normal;
|
|
118
|
+
`;
|
|
76
119
|
break;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
120
|
+
case "h5":
|
|
121
|
+
cssVar += `
|
|
122
|
+
font-size: ${toMobile(props.theme.fontSizes.title[500])};
|
|
123
|
+
line-height: normal;
|
|
124
|
+
`;
|
|
80
125
|
break;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
126
|
+
case "section-header":
|
|
127
|
+
cssVar += `
|
|
128
|
+
font-size: ${toMobile(props.theme.fontSizes.title[500])};
|
|
129
|
+
line-height: normal;
|
|
130
|
+
text-transform: uppercase;
|
|
131
|
+
`;
|
|
84
132
|
break;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
133
|
+
case "body":
|
|
134
|
+
cssVar += `
|
|
135
|
+
font-size: ${toMobile(props.theme.fontSizes.value[400])};
|
|
136
|
+
line-height: normal;
|
|
137
|
+
`;
|
|
88
138
|
break;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
139
|
+
case "body-small":
|
|
140
|
+
cssVar += `
|
|
141
|
+
font-size: ${toMobile(props.theme.fontSizes.value[300])};
|
|
142
|
+
line-height: normal;
|
|
143
|
+
`;
|
|
92
144
|
break;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
145
|
+
case "body-micro":
|
|
146
|
+
cssVar += `
|
|
147
|
+
font-size: ${toMobile(props.theme.fontSizes.microText[200])};
|
|
148
|
+
line-height: normal;
|
|
149
|
+
`;
|
|
96
150
|
break;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
151
|
+
case "list":
|
|
152
|
+
cssVar += `
|
|
153
|
+
font-size: ${toMobile(props.theme.fontSizes.value[400])};
|
|
154
|
+
line-height: normal;
|
|
155
|
+
`;
|
|
100
156
|
break;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
157
|
+
case "link":
|
|
158
|
+
cssVar += `
|
|
159
|
+
line-height: ${props.theme.xl};
|
|
160
|
+
color: ${props.theme.colors.brand[600]};
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
`;
|
|
104
163
|
break;
|
|
105
164
|
}
|
|
106
|
-
|
|
107
165
|
return cssVar;
|
|
108
166
|
};
|
|
109
167
|
}
|
|
110
|
-
function iconColor() {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
168
|
+
function iconColor(variant = "neutral", type = 400) {
|
|
169
|
+
return css`
|
|
170
|
+
fill: ${(props) => props.theme.colors[variant][type]};
|
|
171
|
+
`;
|
|
114
172
|
}
|
|
115
173
|
function fakeBorder() {
|
|
116
|
-
return css
|
|
174
|
+
return css`
|
|
175
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};
|
|
176
|
+
border-radius: 2px;
|
|
177
|
+
`;
|
|
117
178
|
}
|
|
118
179
|
function fakeActive() {
|
|
119
|
-
return css
|
|
180
|
+
return css`
|
|
181
|
+
outline: none;
|
|
182
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};
|
|
183
|
+
border-radius: 2px;
|
|
184
|
+
`;
|
|
120
185
|
}
|
|
121
186
|
function clearFocus() {
|
|
122
|
-
return
|
|
187
|
+
return `
|
|
188
|
+
border: none;
|
|
189
|
+
box-shadow: none;
|
|
190
|
+
`;
|
|
123
191
|
}
|
|
124
192
|
function buttonLink() {
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
193
|
+
return `
|
|
194
|
+
background-color: transparent;
|
|
195
|
+
border: 1px solid transparent;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
function transition(t = "all 1s ease") {
|
|
200
|
+
return `
|
|
201
|
+
transition: ${t};
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
204
|
+
const onlySafariAndFirefox = (styles) => css`
|
|
205
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
206
|
+
${styles}
|
|
207
|
+
}
|
|
208
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
209
|
+
${styles}
|
|
210
|
+
}
|
|
211
|
+
`;
|
|
212
|
+
const onlySafari = (styles) => `
|
|
213
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
214
|
+
${styles}
|
|
215
|
+
}
|
|
216
|
+
`;
|
|
217
|
+
const onlyFirefox = (styles) => `
|
|
218
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
219
|
+
${styles}
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
const safariAndFirefoxBold = (color2) => `
|
|
223
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
224
|
+
font-weight: 400;
|
|
225
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
226
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
227
|
+
}
|
|
228
|
+
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
229
|
+
font-weight: 400;
|
|
230
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
231
|
+
-webkit-text-stroke: 0.4px ${color2};
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
export {
|
|
235
|
+
active,
|
|
236
|
+
animation,
|
|
237
|
+
border,
|
|
238
|
+
boxShadow,
|
|
239
|
+
buttonLink,
|
|
240
|
+
clearFocus,
|
|
241
|
+
color,
|
|
242
|
+
createGlobalStyle,
|
|
243
|
+
css,
|
|
244
|
+
disabled,
|
|
245
|
+
fakeActive,
|
|
246
|
+
fakeBorder,
|
|
247
|
+
flexCenter,
|
|
248
|
+
focus,
|
|
249
|
+
focusAfter,
|
|
250
|
+
hover,
|
|
251
|
+
iconColor,
|
|
252
|
+
keyframes,
|
|
253
|
+
kfrm,
|
|
254
|
+
onlyFirefox,
|
|
255
|
+
onlySafari,
|
|
256
|
+
onlySafariAndFirefox,
|
|
257
|
+
rgba,
|
|
258
|
+
safariAndFirefoxBold,
|
|
259
|
+
textStyle,
|
|
260
|
+
transition,
|
|
261
|
+
truncate,
|
|
262
|
+
useTheme,
|
|
263
|
+
withTheme
|
|
264
|
+
};
|
|
265
|
+
//# 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, 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"],
|
|
5
|
+
"mappings": "AAAA;ACGA;AACA;AACA;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,mBA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AAK/D,sBAA8B;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAMF,sBAA8B;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;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.
|
|
3
|
+
"version": "2.3.0-alpha.1",
|
|
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.
|
|
92
|
+
"@elliemae/ds-utilities": "2.3.0-alpha.1",
|
|
93
93
|
"polished": "~3.6.7"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
package/types/styled/types.d.ts
CHANGED
|
@@ -23,6 +23,5 @@ export declare type StyledFunction = <C extends AnyStyledComponent | keyof JSX.I
|
|
|
23
23
|
name: string | null;
|
|
24
24
|
slot: string | null;
|
|
25
25
|
}) => ThemedStyledFunctionBase<C extends AnyStyledComponent ? StyledComponentInnerComponent<C> : C, Theme, C extends AnyStyledComponent ? StyledComponentInnerOtherProps<C> : {}, C extends AnyStyledComponent ? StyledComponentInnerAttrs<C> : never>;
|
|
26
|
-
export
|
|
27
|
-
}
|
|
26
|
+
export declare type StyledObject = ThemedStyledComponentFactories<Theme>;
|
|
28
27
|
export declare type Styled = StyledFunction & StyledObject;
|
package/types/th.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare type
|
|
2
|
-
declare type
|
|
3
|
-
space:
|
|
4
|
-
fontSize:
|
|
5
|
-
fontWeight:
|
|
6
|
-
lineHeight:
|
|
7
|
-
letterSpacing:
|
|
8
|
-
font:
|
|
9
|
-
color:
|
|
10
|
-
breakpoint:
|
|
11
|
-
media:
|
|
1
|
+
declare type thGetter = (value: string, dfault: string) => (theme: any) => string;
|
|
2
|
+
declare type thConstructor = ((property: string) => thGetter) & {
|
|
3
|
+
space: thGetter;
|
|
4
|
+
fontSize: thGetter;
|
|
5
|
+
fontWeight: thGetter;
|
|
6
|
+
lineHeight: thGetter;
|
|
7
|
+
letterSpacing: thGetter;
|
|
8
|
+
font: thGetter;
|
|
9
|
+
color: thGetter;
|
|
10
|
+
breakpoint: thGetter;
|
|
11
|
+
media: thGetter;
|
|
12
12
|
};
|
|
13
|
-
export declare const th:
|
|
13
|
+
export declare const th: thConstructor;
|
|
14
14
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { rgba } from 'polished';
|
|
2
|
-
import { Keyframes } from 'styled-components';
|
|
3
|
-
import { css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from 'styled-components';
|
|
2
|
+
import { Keyframes, css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from 'styled-components';
|
|
4
3
|
export { withTheme, createGlobalStyle, rgba, useTheme, kfrm, css };
|
|
5
4
|
export declare function truncate(width?: string): (props: any) => import("styled-components").FlattenSimpleInterpolation;
|
|
6
5
|
export declare function flexCenter(): string;
|