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