@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.
Files changed (64) hide show
  1. package/cjs/arithmetic.js +42 -30
  2. package/cjs/arithmetic.js.map +7 -0
  3. package/cjs/constants.js +43 -15
  4. package/cjs/constants.js.map +7 -0
  5. package/cjs/globalStyles.js +44 -22
  6. package/cjs/globalStyles.js.map +7 -0
  7. package/cjs/index.js +42 -83
  8. package/cjs/index.js.map +7 -0
  9. package/cjs/mobileUtilities.js +57 -26
  10. package/cjs/mobileUtilities.js.map +7 -0
  11. package/cjs/spaceUtilities.js +72 -46
  12. package/cjs/spaceUtilities.js.map +7 -0
  13. package/cjs/styled/index.d.js +27 -2
  14. package/cjs/styled/index.d.js.map +7 -0
  15. package/cjs/styled/index.js +57 -93
  16. package/cjs/styled/index.js.map +7 -0
  17. package/cjs/styled/styleGetters.js +42 -30
  18. package/cjs/styled/styleGetters.js.map +7 -0
  19. package/cjs/styled/types.js +34 -11
  20. package/cjs/styled/types.js.map +7 -0
  21. package/cjs/styled/utils.js +46 -23
  22. package/cjs/styled/utils.js.map +7 -0
  23. package/cjs/th.js +50 -33
  24. package/cjs/th.js.map +7 -0
  25. package/cjs/theme.js +36 -9
  26. package/cjs/theme.js.map +7 -0
  27. package/cjs/themeProviderHOC.js +42 -29
  28. package/cjs/themeProviderHOC.js.map +7 -0
  29. package/cjs/utils.js +256 -146
  30. package/cjs/utils.js.map +7 -0
  31. package/esm/arithmetic.js +13 -25
  32. package/esm/arithmetic.js.map +7 -0
  33. package/esm/constants.js +14 -9
  34. package/esm/constants.js.map +7 -0
  35. package/esm/globalStyles.js +16 -15
  36. package/esm/globalStyles.js.map +7 -0
  37. package/esm/index.js +14 -11
  38. package/esm/index.js.map +7 -0
  39. package/esm/mobileUtilities.js +26 -17
  40. package/esm/mobileUtilities.js.map +7 -0
  41. package/esm/spaceUtilities.js +43 -35
  42. package/esm/spaceUtilities.js.map +7 -0
  43. package/esm/styled/index.d.js +2 -1
  44. package/esm/styled/index.d.js.map +7 -0
  45. package/esm/styled/index.js +23 -79
  46. package/esm/styled/index.js.map +7 -0
  47. package/esm/styled/styleGetters.js +12 -23
  48. package/esm/styled/styleGetters.js.map +7 -0
  49. package/esm/styled/types.js +6 -1
  50. package/esm/styled/types.js.map +7 -0
  51. package/esm/styled/utils.js +16 -16
  52. package/esm/styled/utils.js.map +7 -0
  53. package/esm/th.js +22 -30
  54. package/esm/th.js.map +7 -0
  55. package/esm/theme.js +6 -4
  56. package/esm/theme.js.map +7 -0
  57. package/esm/themeProviderHOC.js +13 -20
  58. package/esm/themeProviderHOC.js.map +7 -0
  59. package/esm/utils.js +227 -98
  60. package/esm/utils.js.map +7 -0
  61. package/package.json +2 -2
  62. package/types/styled/types.d.ts +1 -2
  63. package/types/th.d.ts +12 -12
  64. package/types/utils.d.ts +1 -2
@@ -1,18 +1,18 @@
1
- import 'core-js/modules/esnext.async-iterator.reduce.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.reduce.js';
4
- import { capitalize } from '@elliemae/ds-utilities';
5
- import { theme } from '../theme.js';
6
-
7
- const systemTheme = theme;
8
- const isEmpty = string => string.length === 0;
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
- return "".concat(classKey).concat(isEmpty(String(classKey)) ? key : capitalize(key)).concat(capitalize(props[key].toString()));
16
- }, '');
17
-
18
- export { coerceWithDefaultTheme, isEmpty, propsToClassKey };
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 'core-js/modules/esnext.async-iterator.for-each.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.for-each.js';
4
-
5
- const th = property => function (value) {
6
- let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
7
- return _ref => {
8
- var _result;
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('space');
22
- th.fontSize = th('fontSizes');
23
- th.fontWeight = th('fontWeights');
24
- th.lineHeight = th('lineHeights');
25
- th.letterSpacing = th('letterSpacings');
26
- th.font = th('fonts');
27
- th.color = th('colors');
28
- th.breakpoint = th('breakpoints');
29
- th.media = th('media');
30
-
31
- export { th };
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 { getDefaultTheme } from '@elliemae/pui-theme';
2
-
1
+ import * as React from "react";
2
+ import { getDefaultTheme } from "@elliemae/pui-theme";
3
3
  const theme = getDefaultTheme();
4
-
5
- export { theme };
4
+ export {
5
+ theme
6
+ };
7
+ //# sourceMappingURL=theme.js.map
@@ -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
+ }
@@ -1,20 +1,13 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _jsx2 from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import 'react';
9
- import { ThemeProvider } from 'styled-components';
10
- import { theme } from './theme.js';
11
- import { jsx } from 'react/jsx-runtime';
12
-
13
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
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 { lighten } from 'polished';
2
- export { rgba } from 'polished';
3
- import { reduce } from 'lodash';
4
- import { theme } from './theme.js';
5
- import { toMobile } from './mobileUtilities.js';
6
- import { css, keyframes as keyframes$1 } from 'styled-components';
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(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
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 "\n display: flex;\n justify-content: center;\n align-items: center;\n ";
16
+ return `
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ `;
15
21
  }
16
22
  function disabled() {
17
- return "\n cursor: not-allowed;\n pointer-events: none;\n ";
23
+ return `
24
+ cursor: not-allowed;
25
+ pointer-events: none;
26
+ `;
18
27
  }
19
28
  function keyframes(obj) {
20
- return keyframes$1(["", ""], reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
21
- } // eslint-disable-next-line max-params
22
-
23
- function boxShadow(top, left, blur, color) {
24
- let inset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
25
- return "box-shadow: ".concat(inset ? 'inset' : '', " ").concat(top, " ").concat(left, " ").concat(blur, " ").concat(color, ";");
26
- }
27
- function color() {
28
- let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
29
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
30
- return css(["color:", ";"], props => props.theme.colors[variant][type]);
31
- }
32
- function border() {
33
- let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.colors.brand[600];
34
- let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1px';
35
- let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'solid';
36
- return "".concat(size, " ").concat(type, " ").concat(color);
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(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
40
- } // 0.0769
41
-
42
- function focus() {
43
- let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.colors.brand[600];
44
- return () => css(["outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], color, lighten(0.3, color));
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(color) {
47
- return css(["outline:none;position:relative;&:after{content:'';z-index:10;position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;", "}"], focus(color));
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(["outline:none;border:1px solid ", ";border-radius:2px;"], props.theme.colors.brand[700]);
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(["outline:1px solid ", ";outline-offset:-1px;"], props.theme.colors.brand[600]);
54
- }
55
- function textStyle(type) {
56
- let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'regular';
57
- // eslint-disable-next-line complexity
58
- return props => {
59
- let cssVar = "font-weight: ".concat(props.theme.fontWeights[weight], ";"); // eslint-disable-next-line default-case
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 'h1':
63
- cssVar += "\n font-size: ".concat(toMobile('2.7692rem'), ";\n line-height: normal;\n ");
96
+ case "h1":
97
+ cssVar += `
98
+ font-size: ${toMobile("2.7692rem")};
99
+ line-height: normal;
100
+ `;
64
101
  break;
65
-
66
- case 'h2':
67
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[800]), ";\n line-height: normal;\n ");
102
+ case "h2":
103
+ cssVar += `
104
+ font-size: ${toMobile(props.theme.fontSizes.title[800])};
105
+ line-height: normal;
106
+ `;
68
107
  break;
69
-
70
- case 'h3':
71
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[700]), ";\n line-height: 1.2;\n ");
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
- case 'h4':
75
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[600]), ";\n line-height: normal;\n ");
114
+ case "h4":
115
+ cssVar += `
116
+ font-size: ${toMobile(props.theme.fontSizes.title[600])};
117
+ line-height: normal;
118
+ `;
76
119
  break;
77
-
78
- case 'h5':
79
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n ");
120
+ case "h5":
121
+ cssVar += `
122
+ font-size: ${toMobile(props.theme.fontSizes.title[500])};
123
+ line-height: normal;
124
+ `;
80
125
  break;
81
-
82
- case 'section-header':
83
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n text-transform: uppercase;\n ");
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
- case 'body':
87
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
133
+ case "body":
134
+ cssVar += `
135
+ font-size: ${toMobile(props.theme.fontSizes.value[400])};
136
+ line-height: normal;
137
+ `;
88
138
  break;
89
-
90
- case 'body-small':
91
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[300]), ";\n line-height: normal;\n ");
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
- case 'body-micro':
95
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.microText[200]), ";\n line-height: normal;\n ");
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
- case 'list':
99
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
151
+ case "list":
152
+ cssVar += `
153
+ font-size: ${toMobile(props.theme.fontSizes.value[400])};
154
+ line-height: normal;
155
+ `;
100
156
  break;
101
-
102
- case 'link':
103
- cssVar += "\n line-height: ".concat(props.theme.xl, ";\n color: ").concat(props.theme.colors.brand[600], ";\n cursor: pointer;\n ");
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
- let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
112
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
113
- return css(["fill:", ";"], props => props.theme.colors[variant][type]);
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(["box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.neutral[200]);
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(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
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 "\n border: none;\n box-shadow: none;\n ";
187
+ return `
188
+ border: none;
189
+ box-shadow: none;
190
+ `;
123
191
  }
124
192
  function buttonLink() {
125
- return "\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n ";
126
- }
127
- function transition() {
128
- let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
129
- return "\n transition: ".concat(t, ";\n ");
130
- }
131
- const onlySafariAndFirefox = styles => css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
132
- const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
133
- const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
134
- const safariAndFirefoxBold = color => "\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 ".concat(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 ").concat(color, ";\n }\n");
135
-
136
- export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate };
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
@@ -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;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,OAAO,KAAK;AACzD,SAAO;AAAA,YACG,CAAC,UAAU,MAAM,MAAM,OAAO,SAAS;AAAA;AAAA;AAI5C,sBAAsB;AAC3B,SAAO;AAAA,kCACyB,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAKjE,sBAAsB;AAC3B,SAAO;AAAA;AAAA,kCAEyB,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;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.2.0-next.6",
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.2.0-next.6",
92
+ "@elliemae/ds-utilities": "2.3.0-alpha.1",
93
93
  "polished": "~3.6.7"
94
94
  },
95
95
  "devDependencies": {
@@ -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 interface StyledObject extends ThemedStyledComponentFactories<Theme> {
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 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;
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: ThConstructor;
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;