@elliemae/ds-system 2.4.2-rc.11 → 2.4.2-rc.14

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 CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
-
7
5
  function getNumberAndUnit(numberStrWithUnit) {
8
6
  const [number, unit] = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
9
7
  return {
@@ -2,25 +2,29 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
5
  require('polished');
7
6
  require('lodash');
8
7
  var styled_component = require('styled-components');
9
8
  require('./theme.js');
10
- require('core-js/modules/web.dom-collections.iterator.js');
11
9
  require('react');
12
10
  require('./th.js');
13
11
 
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+ const GlobalStyles = styled_component.createGlobalStyle`
13
+ :root, body {
14
+ overscroll-behavior-y: none;
15
15
 
16
- var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
16
+ font-size: ${props => props.device === 'desktop' ? '13px' : '16px'};
17
17
 
18
- var _templateObject;
19
- const GlobalStyles = styled_component.createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n :root, body {\n overscroll-behavior-y: none;\n\n font-size: ", ";\n\n @media(min-width: ", ") {\n font-size: ", ";\n }\n\n }\n"])), props => props.device === 'desktop' ? '13px' : '16px', _ref => {
18
+ @media(min-width: ${_ref => {
20
19
  let {
21
20
  theme
22
21
  } = _ref;
23
22
  return theme.breakpoints.small;
24
- }, props => props.device === 'mobile' ? '16px' : '13px');
23
+ }}) {
24
+ font-size: ${props => props.device === 'mobile' ? '16px' : '13px'};
25
+ }
26
+
27
+ }
28
+ `;
25
29
 
26
30
  exports.GlobalStyles = GlobalStyles;
@@ -2,18 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
5
  var react = require('react');
7
6
  var theme = require('./theme.js');
8
7
  var constants = require('./constants.js');
9
8
 
10
9
  function __UNSAFE_SPACE_TO_DIMSUM(unit) {
11
10
  if (constants.translateUnits[unit]) return constants.translateUnits[unit];
12
- return "".concat(parseFloat(unit) * (constants.mobileBaseFont / constants.desktopBaseFont) / 2, "px");
11
+ return `${parseFloat(unit) * (constants.mobileBaseFont / constants.desktopBaseFont) / 2}px`;
13
12
  }
14
13
  function toMobile(unit) {
15
14
  if (!isMobile()) return unit;
16
- return "".concat(parseFloat(unit) * (constants.desktopBaseFont / constants.mobileBaseFont), "rem");
15
+ return `${parseFloat(unit) * (constants.desktopBaseFont / constants.mobileBaseFont)}rem`;
17
16
  }
18
17
  const useIsMobile = () => {
19
18
  const [mobile, setMobile] = react.useState(isMobile());
@@ -13,20 +13,20 @@ var theme = require('./theme.js');
13
13
  function mapGap(gutter) {
14
14
  if (!gutter) return '0rem';
15
15
  if (String(gutter).includes('rem') || String(gutter).includes('px')) return gutter;
16
- return "".concat(theme.theme.space[gutter]);
16
+ return `${theme.theme.space[gutter]}`;
17
17
  }
18
18
  function mapGutter(gutter) {
19
19
  if (!gutter) return '0rem';
20
- return "".concat(theme.theme.space[gutter], " * 2");
20
+ return `${theme.theme.space[gutter]} * 2`;
21
21
  }
22
22
  function mapSpace(width) {
23
- if (typeof width === 'string') return lodash.get(theme.theme, width) ? "".concat(lodash.get(theme.theme, width)) : width;
24
- return "".concat(width * 100, "%");
23
+ if (typeof width === 'string') return lodash.get(theme.theme, width) ? `${lodash.get(theme.theme, width)}` : width;
24
+ return `${width * 100}%`;
25
25
  }
26
26
  function fixSpaceGutter(width, gutter) {
27
27
  if (!width) return '';
28
- if (Array.isArray(width)) return width.map(w => "calc(".concat(mapSpace(w), " - (").concat(mapGutter(gutter), "))"));
29
- return "calc(".concat(mapSpace(width), " - (").concat(mapGutter(gutter), "))");
28
+ if (Array.isArray(width)) return width.map(w => `calc(${mapSpace(w)} - (${mapGutter(gutter)}))`);
29
+ return `calc(${mapSpace(width)} - (${mapGutter(gutter)}))`;
30
30
  }
31
31
  function fixSpace(width) {
32
32
  if (!width) return '';
@@ -35,13 +35,13 @@ function fixSpace(width) {
35
35
  }
36
36
  function numbersToFr(grid) {
37
37
  const den = grid.map(f => f < 1 ? Math.floor(1 / f) : f);
38
- return den.map(d => "".concat(d, "fr"));
38
+ return den.map(d => `${d}fr`);
39
39
  }
40
40
  function mapGrid(width) {
41
- if (lodash.get(theme.theme, width)) return "".concat(lodash.get(theme.theme, width));
41
+ if (lodash.get(theme.theme, width)) return `${lodash.get(theme.theme, width)}`;
42
42
  if (typeof width === 'string') return width;
43
43
  const den = width < 1 ? Math.floor(1 / width) : width;
44
- return "".concat(den, "fr");
44
+ return `${den}fr`;
45
45
  }
46
46
  function mapTemplateGrid(grid) {
47
47
  if (Array.isArray(grid)) {
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
6
  require('core-js/modules/esnext.async-iterator.map.js');
7
7
  require('core-js/modules/esnext.iterator.map.js');
8
- require('core-js/modules/web.dom-collections.iterator.js');
9
8
  require('core-js/modules/esnext.async-iterator.reduce.js');
10
9
  require('core-js/modules/esnext.iterator.constructor.js');
11
10
  require('core-js/modules/esnext.iterator.reduce.js');
@@ -94,11 +93,11 @@ const styledFunction = function (tag) {
94
93
  }
95
94
 
96
95
  let Component = /*#__PURE__*/styled_component__default["default"](tag);
97
- const displayName = componentName !== null && componentSlot !== null ? "".concat(componentName, "-").concat(componentSlot) : null;
96
+ const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;
98
97
 
99
98
  if (displayName !== null) {
100
99
  Component = Component.attrs({
101
- className: "".concat(componentName, "-").concat(componentSlot)
100
+ className: `${componentName}-${componentSlot}`
102
101
  });
103
102
  }
104
103
 
@@ -9,15 +9,9 @@ require('core-js/modules/esnext.async-iterator.every.js');
9
9
  require('core-js/modules/esnext.iterator.every.js');
10
10
  var utils = require('./utils.js');
11
11
 
12
- const getStyleOverrides = (name, theme) => {
13
- var _theme$components, _theme$components$nam;
14
-
15
- return ((_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : (_theme$components$nam = _theme$components[name]) === null || _theme$components$nam === void 0 ? void 0 : _theme$components$nam.styleOverrides) || null;
16
- };
12
+ const getStyleOverrides = (name, theme) => theme.components?.[name]?.styleOverrides || null;
17
13
  const getVariantStyles = (name, theme) => {
18
- var _theme$components2, _theme$components2$na;
19
-
20
- const variants = ((_theme$components2 = theme.components) === null || _theme$components2 === void 0 ? void 0 : (_theme$components2$na = _theme$components2[name]) === null || _theme$components2$na === void 0 ? void 0 : _theme$components2$na.variants) || [];
14
+ const variants = theme.components?.[name]?.variants || [];
21
15
  return variants.reduce((styles, definition) => {
22
16
  const key = utils.propsToClassKey(definition.props);
23
17
  styles[key] = definition.style;
@@ -25,9 +19,7 @@ const getVariantStyles = (name, theme) => {
25
19
  }, {});
26
20
  };
27
21
  const variantsResolver = (props, styles, theme, name) => {
28
- var _theme$components3, _theme$components3$na;
29
-
30
- const themeVariants = (theme === null || theme === void 0 ? void 0 : (_theme$components3 = theme.components) === null || _theme$components3 === void 0 ? void 0 : (_theme$components3$na = _theme$components3[name]) === null || _theme$components3$na === void 0 ? void 0 : _theme$components3$na.variants) || [];
22
+ const themeVariants = theme?.components?.[name]?.variants || [];
31
23
  return themeVariants.reduce((variantsStyles, themeVariant) => {
32
24
  const isMatch = Object.keys(themeVariant.props).every(key => props[key] === themeVariant.props[key]);
33
25
 
@@ -10,13 +10,13 @@ var theme = require('../theme.js');
10
10
 
11
11
  const systemTheme = theme.theme;
12
12
  const isEmpty = string => string.length === 0;
13
- const coerceWithDefaultTheme = themeInput => themeInput !== null && themeInput !== void 0 ? themeInput : systemTheme;
13
+ const coerceWithDefaultTheme = themeInput => themeInput ?? systemTheme;
14
14
  const propsToClassKey = props => Object.keys(props).sort().reduce((classKey, key) => {
15
15
  if (key === 'color') {
16
16
  return classKey + isEmpty(String(classKey)) ? String(props[key]) : dsUtilities.capitalize(String(props[key]));
17
17
  }
18
18
 
19
- return "".concat(classKey).concat(isEmpty(String(classKey)) ? key : dsUtilities.capitalize(key)).concat(dsUtilities.capitalize(props[key].toString()));
19
+ return `${classKey}${isEmpty(String(classKey)) ? key : dsUtilities.capitalize(key)}${dsUtilities.capitalize(props[key].toString())}`;
20
20
  }, '');
21
21
 
22
22
  exports.coerceWithDefaultTheme = coerceWithDefaultTheme;
package/cjs/th.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
5
+ require('core-js/modules/es.error.cause.js');
6
6
  require('core-js/modules/esnext.async-iterator.for-each.js');
7
7
  require('core-js/modules/esnext.iterator.constructor.js');
8
8
  require('core-js/modules/esnext.iterator.for-each.js');
@@ -20,7 +20,7 @@ const colorGetter = value => _ref => {
20
20
  if (!themeColor) throw new Error('Invalid color value');
21
21
 
22
22
  if (alpha) {
23
- const alphaFloatingNumber = "0.".concat(alpha.slice(1));
23
+ const alphaFloatingNumber = `0.${alpha.slice(1)}`;
24
24
  return utils.hexToRgba(themeColor, alphaFloatingNumber);
25
25
  }
26
26
 
@@ -30,8 +30,6 @@ const colorGetter = value => _ref => {
30
30
  const genericGetter = property => function (value) {
31
31
  let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
32
32
  return _ref2 => {
33
- var _ref3;
34
-
35
33
  let {
36
34
  theme
37
35
  } = _ref2;
@@ -40,7 +38,7 @@ const genericGetter = property => function (value) {
40
38
  parts.forEach(part => {
41
39
  if (result) result = result[part];
42
40
  });
43
- return (_ref3 = result) !== null && _ref3 !== void 0 ? _ref3 : dfault;
41
+ return result ?? dfault;
44
42
  };
45
43
  };
46
44
 
package/cjs/utils.js CHANGED
@@ -11,21 +11,33 @@ var th = require('./th.js');
11
11
 
12
12
  /* eslint-disable no-shadow */
13
13
  function truncate(width) {
14
- return props => styled_component.css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
14
+ return props => styled_component.css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? `width: ${props.width || width};` : '');
15
15
  }
16
16
  function flexCenter() {
17
- return "\n display: flex;\n justify-content: center;\n align-items: center;\n ";
17
+ return `
18
+ display: flex;
19
+ justify-content: center;
20
+ align-items: center;
21
+ `;
18
22
  }
19
23
  function disabled() {
20
- return "\n cursor: not-allowed;\n pointer-events: none;\n ";
24
+ return `
25
+ cursor: not-allowed;
26
+ pointer-events: none;
27
+ `;
21
28
  }
22
29
  function keyframes(obj) {
23
- return styled_component.keyframes(["", ""], lodash.reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
30
+ return styled_component.keyframes(["", ""], lodash.reduce(obj, (result, value, key) => `
31
+ ${result}
32
+ ${key}% {
33
+ ${value}
34
+ }
35
+ `, ''));
24
36
  } // eslint-disable-next-line max-params
25
37
 
26
38
  function boxShadow(top, left, blur, color) {
27
39
  let inset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
28
- return "box-shadow: ".concat(inset ? 'inset' : '', " ").concat(top, " ").concat(left, " ").concat(blur, " ").concat(color, ";");
40
+ return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;
29
41
  }
30
42
  function color() {
31
43
  let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
@@ -36,7 +48,7 @@ function border() {
36
48
  let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.theme.colors.brand[600];
37
49
  let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1px';
38
50
  let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'solid';
39
- return "".concat(size, " ").concat(type, " ").concat(color);
51
+ return `${size} ${type} ${color}`;
40
52
  }
41
53
  function animation(animationKeyframes, animationLength, animationTimingFn) {
42
54
  return props => styled_component.css(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
@@ -59,51 +71,86 @@ function textStyle(type) {
59
71
  let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'regular';
60
72
  // eslint-disable-next-line complexity
61
73
  return props => {
62
- let cssVar = "font-weight: ".concat(props.theme.fontWeights[weight], ";"); // eslint-disable-next-line default-case
74
+ let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`; // eslint-disable-next-line default-case
63
75
 
64
76
  switch (type) {
65
77
  case 'h1':
66
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile('2.7692rem'), ";\n line-height: normal;\n ");
78
+ cssVar += `
79
+ font-size: ${mobileUtilities.toMobile('2.7692rem')};
80
+ line-height: normal;
81
+ `;
67
82
  break;
68
83
 
69
84
  case 'h2':
70
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[800]), ";\n line-height: normal;\n ");
85
+ cssVar += `
86
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.title[800])};
87
+ line-height: normal;
88
+ `;
71
89
  break;
72
90
 
73
91
  case 'h3':
74
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[700]), ";\n line-height: 1.2;\n ");
92
+ cssVar += `
93
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.title[700])};
94
+ line-height: 1.2;
95
+ `;
75
96
  break;
76
97
 
77
98
  case 'h4':
78
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[600]), ";\n line-height: normal;\n ");
99
+ cssVar += `
100
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.title[600])};
101
+ line-height: normal;
102
+ `;
79
103
  break;
80
104
 
81
105
  case 'h5':
82
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n ");
106
+ cssVar += `
107
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.title[500])};
108
+ line-height: normal;
109
+ `;
83
110
  break;
84
111
 
85
112
  case 'section-header':
86
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n text-transform: uppercase;\n ");
113
+ cssVar += `
114
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.title[500])};
115
+ line-height: normal;
116
+ text-transform: uppercase;
117
+ `;
87
118
  break;
88
119
 
89
120
  case 'body':
90
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
121
+ cssVar += `
122
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.value[400])};
123
+ line-height: normal;
124
+ `;
91
125
  break;
92
126
 
93
127
  case 'body-small':
94
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[300]), ";\n line-height: normal;\n ");
128
+ cssVar += `
129
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.value[300])};
130
+ line-height: normal;
131
+ `;
95
132
  break;
96
133
 
97
134
  case 'body-micro':
98
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.microText[200]), ";\n line-height: normal;\n ");
135
+ cssVar += `
136
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.microText[200])};
137
+ line-height: normal;
138
+ `;
99
139
  break;
100
140
 
101
141
  case 'list':
102
- cssVar += "\n font-size: ".concat(mobileUtilities.toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
142
+ cssVar += `
143
+ font-size: ${mobileUtilities.toMobile(props.theme.fontSizes.value[400])};
144
+ line-height: normal;
145
+ `;
103
146
  break;
104
147
 
105
148
  case 'link':
106
- cssVar += "\n line-height: ".concat(props.theme.xl, ";\n color: ").concat(props.theme.colors.brand[600], ";\n cursor: pointer;\n ");
149
+ cssVar += `
150
+ line-height: ${props.theme.xl};
151
+ color: ${props.theme.colors.brand[600]};
152
+ cursor: pointer;
153
+ `;
107
154
  break;
108
155
  }
109
156
 
@@ -122,37 +169,65 @@ function fakeActive() {
122
169
  return styled_component.css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
123
170
  }
124
171
  function clearFocus() {
125
- return "\n border: none;\n box-shadow: none;\n ";
172
+ return `
173
+ border: none;
174
+ box-shadow: none;
175
+ `;
126
176
  }
127
177
  function buttonLink() {
128
- return "\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n ";
178
+ return `
179
+ background-color: transparent;
180
+ border: 1px solid transparent;
181
+ cursor: pointer;
182
+ `;
129
183
  }
130
184
  function transition() {
131
185
  let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
132
- return "\n transition: ".concat(t, ";\n ");
186
+ return `
187
+ transition: ${t};
188
+ `;
133
189
  }
134
190
  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);
135
- const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
136
- const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
137
- 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");
191
+ const onlySafari = styles => `
192
+ @media not all and (min-resolution: 0.001dpcm) {
193
+ ${styles}
194
+ }
195
+ `;
196
+ const onlyFirefox = styles => `
197
+ @media screen and (min--moz-device-pixel-ratio: 0) {
198
+ ${styles}
199
+ }
200
+ `;
201
+ const safariAndFirefoxBold = color => `
202
+ @media not all and (min-resolution: 0.001dpcm) {
203
+ font-weight: 400;
204
+ -webkit-font-smoothing: subpixel-antialiased;
205
+ -webkit-text-stroke: 0.4px ${color};
206
+ }
207
+ @media screen and (min--moz-device-pixel-ratio: 0) {
208
+ font-weight: 400;
209
+ -webkit-font-smoothing: subpixel-antialiased;
210
+ -webkit-text-stroke: 0.4px ${color};
211
+ }
212
+ `;
138
213
  const backgroundColorSetter = /*#__PURE__*/styled_component.css(["", "}"], _ref => {
139
214
  let {
140
215
  bg,
141
216
  backgroundColor,
142
217
  theme
143
218
  } = _ref;
144
- return bg || backgroundColor ? "background-color: ".concat(th.th.color(bg || backgroundColor, bg || backgroundColor)({
219
+ return bg || backgroundColor ? `background-color: ${th.th.color(bg || backgroundColor, bg || backgroundColor)({
145
220
  theme
146
- }), ";") : "";
221
+ })};` : ``;
147
222
  });
148
223
  const hexToRgba = (hex, alpha) => {
149
224
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
150
225
 
151
226
  if (result) {
152
- return "rgba(".concat(parseInt(result[1], 16), ", ").concat(parseInt(result[2], 16), ", ").concat(parseInt(result[3], 16), ", ").concat(alpha, ")");
227
+ return `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${alpha})`;
153
228
  }
154
229
 
155
- return "";
230
+ return ``;
156
231
  };
157
232
 
158
233
  Object.defineProperty(exports, 'rgba', {
package/esm/arithmetic.js CHANGED
@@ -1,5 +1,3 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
-
3
1
  function getNumberAndUnit(numberStrWithUnit) {
4
2
  const [number, unit] = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
5
3
  return {
@@ -1,18 +1,26 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
1
  import 'polished';
3
2
  import 'lodash';
4
3
  import { createGlobalStyle } from 'styled-components';
5
4
  import './theme.js';
6
- import 'core-js/modules/web.dom-collections.iterator.js';
7
5
  import 'react';
8
6
  import './th.js';
9
7
 
10
- var _templateObject;
11
- const GlobalStyles = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :root, body {\n overscroll-behavior-y: none;\n\n font-size: ", ";\n\n @media(min-width: ", ") {\n font-size: ", ";\n }\n\n }\n"])), props => props.device === 'desktop' ? '13px' : '16px', _ref => {
8
+ const GlobalStyles = createGlobalStyle`
9
+ :root, body {
10
+ overscroll-behavior-y: none;
11
+
12
+ font-size: ${props => props.device === 'desktop' ? '13px' : '16px'};
13
+
14
+ @media(min-width: ${_ref => {
12
15
  let {
13
16
  theme
14
17
  } = _ref;
15
18
  return theme.breakpoints.small;
16
- }, props => props.device === 'mobile' ? '16px' : '13px');
19
+ }}) {
20
+ font-size: ${props => props.device === 'mobile' ? '16px' : '13px'};
21
+ }
22
+
23
+ }
24
+ `;
17
25
 
18
26
  export { GlobalStyles };
@@ -1,15 +1,14 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import { useState, useEffect } from 'react';
3
2
  import { theme } from './theme.js';
4
3
  import { translateUnits, mobileBaseFont, desktopBaseFont } from './constants.js';
5
4
 
6
5
  function __UNSAFE_SPACE_TO_DIMSUM(unit) {
7
6
  if (translateUnits[unit]) return translateUnits[unit];
8
- return "".concat(parseFloat(unit) * (mobileBaseFont / desktopBaseFont) / 2, "px");
7
+ return `${parseFloat(unit) * (mobileBaseFont / desktopBaseFont) / 2}px`;
9
8
  }
10
9
  function toMobile(unit) {
11
10
  if (!isMobile()) return unit;
12
- return "".concat(parseFloat(unit) * (desktopBaseFont / mobileBaseFont), "rem");
11
+ return `${parseFloat(unit) * (desktopBaseFont / mobileBaseFont)}rem`;
13
12
  }
14
13
  const useIsMobile = () => {
15
14
  const [mobile, setMobile] = useState(isMobile());
@@ -9,20 +9,20 @@ import { theme } from './theme.js';
9
9
  function mapGap(gutter) {
10
10
  if (!gutter) return '0rem';
11
11
  if (String(gutter).includes('rem') || String(gutter).includes('px')) return gutter;
12
- return "".concat(theme.space[gutter]);
12
+ return `${theme.space[gutter]}`;
13
13
  }
14
14
  function mapGutter(gutter) {
15
15
  if (!gutter) return '0rem';
16
- return "".concat(theme.space[gutter], " * 2");
16
+ return `${theme.space[gutter]} * 2`;
17
17
  }
18
18
  function mapSpace(width) {
19
- if (typeof width === 'string') return get(theme, width) ? "".concat(get(theme, width)) : width;
20
- return "".concat(width * 100, "%");
19
+ if (typeof width === 'string') return get(theme, width) ? `${get(theme, width)}` : width;
20
+ return `${width * 100}%`;
21
21
  }
22
22
  function fixSpaceGutter(width, gutter) {
23
23
  if (!width) return '';
24
- if (Array.isArray(width)) return width.map(w => "calc(".concat(mapSpace(w), " - (").concat(mapGutter(gutter), "))"));
25
- return "calc(".concat(mapSpace(width), " - (").concat(mapGutter(gutter), "))");
24
+ if (Array.isArray(width)) return width.map(w => `calc(${mapSpace(w)} - (${mapGutter(gutter)}))`);
25
+ return `calc(${mapSpace(width)} - (${mapGutter(gutter)}))`;
26
26
  }
27
27
  function fixSpace(width) {
28
28
  if (!width) return '';
@@ -31,13 +31,13 @@ function fixSpace(width) {
31
31
  }
32
32
  function numbersToFr(grid) {
33
33
  const den = grid.map(f => f < 1 ? Math.floor(1 / f) : f);
34
- return den.map(d => "".concat(d, "fr"));
34
+ return den.map(d => `${d}fr`);
35
35
  }
36
36
  function mapGrid(width) {
37
- if (get(theme, width)) return "".concat(get(theme, width));
37
+ if (get(theme, width)) return `${get(theme, width)}`;
38
38
  if (typeof width === 'string') return width;
39
39
  const den = width < 1 ? Math.floor(1 / width) : width;
40
- return "".concat(den, "fr");
40
+ return `${den}fr`;
41
41
  }
42
42
  function mapTemplateGrid(grid) {
43
43
  if (Array.isArray(grid)) {
@@ -5,7 +5,6 @@ import 'core-js/modules/esnext.iterator.for-each.js';
5
5
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
6
6
  import 'core-js/modules/esnext.async-iterator.map.js';
7
7
  import 'core-js/modules/esnext.iterator.map.js';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
8
  import 'core-js/modules/esnext.async-iterator.reduce.js';
10
9
  import 'core-js/modules/esnext.iterator.constructor.js';
11
10
  import 'core-js/modules/esnext.iterator.reduce.js';
@@ -85,11 +84,11 @@ const styledFunction = function (tag) {
85
84
  }
86
85
 
87
86
  let Component = /*#__PURE__*/styled_component(tag);
88
- const displayName = componentName !== null && componentSlot !== null ? "".concat(componentName, "-").concat(componentSlot) : null;
87
+ const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;
89
88
 
90
89
  if (displayName !== null) {
91
90
  Component = Component.attrs({
92
- className: "".concat(componentName, "-").concat(componentSlot)
91
+ className: `${componentName}-${componentSlot}`
93
92
  });
94
93
  }
95
94
 
@@ -5,15 +5,9 @@ import 'core-js/modules/esnext.async-iterator.every.js';
5
5
  import 'core-js/modules/esnext.iterator.every.js';
6
6
  import { propsToClassKey } from './utils.js';
7
7
 
8
- const getStyleOverrides = (name, theme) => {
9
- var _theme$components, _theme$components$nam;
10
-
11
- return ((_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : (_theme$components$nam = _theme$components[name]) === null || _theme$components$nam === void 0 ? void 0 : _theme$components$nam.styleOverrides) || null;
12
- };
8
+ const getStyleOverrides = (name, theme) => theme.components?.[name]?.styleOverrides || null;
13
9
  const getVariantStyles = (name, theme) => {
14
- var _theme$components2, _theme$components2$na;
15
-
16
- const variants = ((_theme$components2 = theme.components) === null || _theme$components2 === void 0 ? void 0 : (_theme$components2$na = _theme$components2[name]) === null || _theme$components2$na === void 0 ? void 0 : _theme$components2$na.variants) || [];
10
+ const variants = theme.components?.[name]?.variants || [];
17
11
  return variants.reduce((styles, definition) => {
18
12
  const key = propsToClassKey(definition.props);
19
13
  styles[key] = definition.style;
@@ -21,9 +15,7 @@ const getVariantStyles = (name, theme) => {
21
15
  }, {});
22
16
  };
23
17
  const variantsResolver = (props, styles, theme, name) => {
24
- var _theme$components3, _theme$components3$na;
25
-
26
- const themeVariants = (theme === null || theme === void 0 ? void 0 : (_theme$components3 = theme.components) === null || _theme$components3 === void 0 ? void 0 : (_theme$components3$na = _theme$components3[name]) === null || _theme$components3$na === void 0 ? void 0 : _theme$components3$na.variants) || [];
18
+ const themeVariants = theme?.components?.[name]?.variants || [];
27
19
  return themeVariants.reduce((variantsStyles, themeVariant) => {
28
20
  const isMatch = Object.keys(themeVariant.props).every(key => props[key] === themeVariant.props[key]);
29
21
 
@@ -6,13 +6,13 @@ import { theme } from '../theme.js';
6
6
 
7
7
  const systemTheme = theme;
8
8
  const isEmpty = string => string.length === 0;
9
- const coerceWithDefaultTheme = themeInput => themeInput !== null && themeInput !== void 0 ? themeInput : systemTheme;
9
+ const coerceWithDefaultTheme = themeInput => themeInput ?? systemTheme;
10
10
  const propsToClassKey = props => Object.keys(props).sort().reduce((classKey, key) => {
11
11
  if (key === 'color') {
12
12
  return classKey + isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key]));
13
13
  }
14
14
 
15
- return "".concat(classKey).concat(isEmpty(String(classKey)) ? key : capitalize(key)).concat(capitalize(props[key].toString()));
15
+ return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
16
16
  }, '');
17
17
 
18
18
  export { coerceWithDefaultTheme, isEmpty, propsToClassKey };
package/esm/th.js CHANGED
@@ -1,4 +1,4 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
1
+ import 'core-js/modules/es.error.cause.js';
2
2
  import 'core-js/modules/esnext.async-iterator.for-each.js';
3
3
  import 'core-js/modules/esnext.iterator.constructor.js';
4
4
  import 'core-js/modules/esnext.iterator.for-each.js';
@@ -16,7 +16,7 @@ const colorGetter = value => _ref => {
16
16
  if (!themeColor) throw new Error('Invalid color value');
17
17
 
18
18
  if (alpha) {
19
- const alphaFloatingNumber = "0.".concat(alpha.slice(1));
19
+ const alphaFloatingNumber = `0.${alpha.slice(1)}`;
20
20
  return hexToRgba(themeColor, alphaFloatingNumber);
21
21
  }
22
22
 
@@ -26,8 +26,6 @@ const colorGetter = value => _ref => {
26
26
  const genericGetter = property => function (value) {
27
27
  let dfault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
28
28
  return _ref2 => {
29
- var _ref3;
30
-
31
29
  let {
32
30
  theme
33
31
  } = _ref2;
@@ -36,7 +34,7 @@ const genericGetter = property => function (value) {
36
34
  parts.forEach(part => {
37
35
  if (result) result = result[part];
38
36
  });
39
- return (_ref3 = result) !== null && _ref3 !== void 0 ? _ref3 : dfault;
37
+ return result ?? dfault;
40
38
  };
41
39
  };
42
40
 
package/esm/utils.js CHANGED
@@ -9,21 +9,33 @@ import { th } from './th.js';
9
9
 
10
10
  /* eslint-disable no-shadow */
11
11
  function truncate(width) {
12
- return props => css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
12
+ return props => css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? `width: ${props.width || width};` : '');
13
13
  }
14
14
  function flexCenter() {
15
- return "\n display: flex;\n justify-content: center;\n align-items: center;\n ";
15
+ return `
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ `;
16
20
  }
17
21
  function disabled() {
18
- return "\n cursor: not-allowed;\n pointer-events: none;\n ";
22
+ return `
23
+ cursor: not-allowed;
24
+ pointer-events: none;
25
+ `;
19
26
  }
20
27
  function keyframes(obj) {
21
- return keyframes$1(["", ""], reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
28
+ return keyframes$1(["", ""], reduce(obj, (result, value, key) => `
29
+ ${result}
30
+ ${key}% {
31
+ ${value}
32
+ }
33
+ `, ''));
22
34
  } // eslint-disable-next-line max-params
23
35
 
24
36
  function boxShadow(top, left, blur, color) {
25
37
  let inset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
26
- return "box-shadow: ".concat(inset ? 'inset' : '', " ").concat(top, " ").concat(left, " ").concat(blur, " ").concat(color, ";");
38
+ return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;
27
39
  }
28
40
  function color() {
29
41
  let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
@@ -34,7 +46,7 @@ function border() {
34
46
  let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.colors.brand[600];
35
47
  let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1px';
36
48
  let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'solid';
37
- return "".concat(size, " ").concat(type, " ").concat(color);
49
+ return `${size} ${type} ${color}`;
38
50
  }
39
51
  function animation(animationKeyframes, animationLength, animationTimingFn) {
40
52
  return props => css(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
@@ -57,51 +69,86 @@ function textStyle(type) {
57
69
  let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'regular';
58
70
  // eslint-disable-next-line complexity
59
71
  return props => {
60
- let cssVar = "font-weight: ".concat(props.theme.fontWeights[weight], ";"); // eslint-disable-next-line default-case
72
+ let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`; // eslint-disable-next-line default-case
61
73
 
62
74
  switch (type) {
63
75
  case 'h1':
64
- cssVar += "\n font-size: ".concat(toMobile('2.7692rem'), ";\n line-height: normal;\n ");
76
+ cssVar += `
77
+ font-size: ${toMobile('2.7692rem')};
78
+ line-height: normal;
79
+ `;
65
80
  break;
66
81
 
67
82
  case 'h2':
68
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[800]), ";\n line-height: normal;\n ");
83
+ cssVar += `
84
+ font-size: ${toMobile(props.theme.fontSizes.title[800])};
85
+ line-height: normal;
86
+ `;
69
87
  break;
70
88
 
71
89
  case 'h3':
72
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[700]), ";\n line-height: 1.2;\n ");
90
+ cssVar += `
91
+ font-size: ${toMobile(props.theme.fontSizes.title[700])};
92
+ line-height: 1.2;
93
+ `;
73
94
  break;
74
95
 
75
96
  case 'h4':
76
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[600]), ";\n line-height: normal;\n ");
97
+ cssVar += `
98
+ font-size: ${toMobile(props.theme.fontSizes.title[600])};
99
+ line-height: normal;
100
+ `;
77
101
  break;
78
102
 
79
103
  case 'h5':
80
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n ");
104
+ cssVar += `
105
+ font-size: ${toMobile(props.theme.fontSizes.title[500])};
106
+ line-height: normal;
107
+ `;
81
108
  break;
82
109
 
83
110
  case 'section-header':
84
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n text-transform: uppercase;\n ");
111
+ cssVar += `
112
+ font-size: ${toMobile(props.theme.fontSizes.title[500])};
113
+ line-height: normal;
114
+ text-transform: uppercase;
115
+ `;
85
116
  break;
86
117
 
87
118
  case 'body':
88
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
119
+ cssVar += `
120
+ font-size: ${toMobile(props.theme.fontSizes.value[400])};
121
+ line-height: normal;
122
+ `;
89
123
  break;
90
124
 
91
125
  case 'body-small':
92
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[300]), ";\n line-height: normal;\n ");
126
+ cssVar += `
127
+ font-size: ${toMobile(props.theme.fontSizes.value[300])};
128
+ line-height: normal;
129
+ `;
93
130
  break;
94
131
 
95
132
  case 'body-micro':
96
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.microText[200]), ";\n line-height: normal;\n ");
133
+ cssVar += `
134
+ font-size: ${toMobile(props.theme.fontSizes.microText[200])};
135
+ line-height: normal;
136
+ `;
97
137
  break;
98
138
 
99
139
  case 'list':
100
- cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
140
+ cssVar += `
141
+ font-size: ${toMobile(props.theme.fontSizes.value[400])};
142
+ line-height: normal;
143
+ `;
101
144
  break;
102
145
 
103
146
  case 'link':
104
- cssVar += "\n line-height: ".concat(props.theme.xl, ";\n color: ").concat(props.theme.colors.brand[600], ";\n cursor: pointer;\n ");
147
+ cssVar += `
148
+ line-height: ${props.theme.xl};
149
+ color: ${props.theme.colors.brand[600]};
150
+ cursor: pointer;
151
+ `;
105
152
  break;
106
153
  }
107
154
 
@@ -120,37 +167,65 @@ function fakeActive() {
120
167
  return css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
121
168
  }
122
169
  function clearFocus() {
123
- return "\n border: none;\n box-shadow: none;\n ";
170
+ return `
171
+ border: none;
172
+ box-shadow: none;
173
+ `;
124
174
  }
125
175
  function buttonLink() {
126
- return "\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n ";
176
+ return `
177
+ background-color: transparent;
178
+ border: 1px solid transparent;
179
+ cursor: pointer;
180
+ `;
127
181
  }
128
182
  function transition() {
129
183
  let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
130
- return "\n transition: ".concat(t, ";\n ");
184
+ return `
185
+ transition: ${t};
186
+ `;
131
187
  }
132
188
  const onlySafariAndFirefox = styles => css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
133
- const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
134
- const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
135
- 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");
189
+ const onlySafari = styles => `
190
+ @media not all and (min-resolution: 0.001dpcm) {
191
+ ${styles}
192
+ }
193
+ `;
194
+ const onlyFirefox = styles => `
195
+ @media screen and (min--moz-device-pixel-ratio: 0) {
196
+ ${styles}
197
+ }
198
+ `;
199
+ const safariAndFirefoxBold = color => `
200
+ @media not all and (min-resolution: 0.001dpcm) {
201
+ font-weight: 400;
202
+ -webkit-font-smoothing: subpixel-antialiased;
203
+ -webkit-text-stroke: 0.4px ${color};
204
+ }
205
+ @media screen and (min--moz-device-pixel-ratio: 0) {
206
+ font-weight: 400;
207
+ -webkit-font-smoothing: subpixel-antialiased;
208
+ -webkit-text-stroke: 0.4px ${color};
209
+ }
210
+ `;
136
211
  const backgroundColorSetter = /*#__PURE__*/css(["", "}"], _ref => {
137
212
  let {
138
213
  bg,
139
214
  backgroundColor,
140
215
  theme
141
216
  } = _ref;
142
- return bg || backgroundColor ? "background-color: ".concat(th.color(bg || backgroundColor, bg || backgroundColor)({
217
+ return bg || backgroundColor ? `background-color: ${th.color(bg || backgroundColor, bg || backgroundColor)({
143
218
  theme
144
- }), ";") : "";
219
+ })};` : ``;
145
220
  });
146
221
  const hexToRgba = (hex, alpha) => {
147
222
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
148
223
 
149
224
  if (result) {
150
- return "rgba(".concat(parseInt(result[1], 16), ", ").concat(parseInt(result[2], 16), ", ").concat(parseInt(result[3], 16), ", ").concat(alpha, ")");
225
+ return `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${alpha})`;
151
226
  }
152
227
 
153
- return "";
228
+ return ``;
154
229
  };
155
230
 
156
231
  export { active, animation, backgroundColorSetter, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hexToRgba, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-system",
3
- "version": "2.4.2-rc.11",
3
+ "version": "2.4.2-rc.14",
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.4.2-rc.11",
92
+ "@elliemae/ds-utilities": "2.4.2-rc.14",
93
93
  "polished": "~3.6.7"
94
94
  },
95
95
  "devDependencies": {