@elliemae/ds-system 2.2.0-alpha.4 → 3.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/cjs/arithmetic.js +30 -42
  2. package/cjs/constants.js +15 -43
  3. package/cjs/globalStyles.js +22 -44
  4. package/cjs/index.js +83 -42
  5. package/cjs/mobileUtilities.js +26 -57
  6. package/cjs/spaceUtilities.js +46 -72
  7. package/cjs/styled/index.d.js +2 -27
  8. package/cjs/styled/index.js +93 -57
  9. package/cjs/styled/styleGetters.js +30 -42
  10. package/cjs/styled/types.js +11 -34
  11. package/cjs/styled/utils.js +23 -46
  12. package/cjs/th.js +29 -49
  13. package/cjs/theme.js +9 -36
  14. package/cjs/themeProviderHOC.js +29 -42
  15. package/cjs/utils.js +146 -256
  16. package/esm/arithmetic.js +25 -13
  17. package/esm/constants.js +9 -14
  18. package/esm/globalStyles.js +15 -16
  19. package/esm/index.js +11 -14
  20. package/esm/mobileUtilities.js +17 -26
  21. package/esm/spaceUtilities.js +35 -43
  22. package/esm/styled/index.d.js +1 -2
  23. package/esm/styled/index.js +79 -23
  24. package/esm/styled/styleGetters.js +23 -12
  25. package/esm/styled/types.js +1 -6
  26. package/esm/styled/utils.js +16 -16
  27. package/esm/th.js +25 -20
  28. package/esm/theme.js +4 -6
  29. package/esm/themeProviderHOC.js +20 -13
  30. package/esm/utils.js +98 -227
  31. package/package.json +5 -5
  32. package/types/styled/types.d.ts +2 -1
  33. package/types/utils.d.ts +2 -1
  34. package/cjs/arithmetic.js.map +0 -7
  35. package/cjs/constants.js.map +0 -7
  36. package/cjs/globalStyles.js.map +0 -7
  37. package/cjs/index.js.map +0 -7
  38. package/cjs/mobileUtilities.js.map +0 -7
  39. package/cjs/spaceUtilities.js.map +0 -7
  40. package/cjs/styled/index.d.js.map +0 -7
  41. package/cjs/styled/index.js.map +0 -7
  42. package/cjs/styled/styleGetters.js.map +0 -7
  43. package/cjs/styled/types.js.map +0 -7
  44. package/cjs/styled/utils.js.map +0 -7
  45. package/cjs/th.js.map +0 -7
  46. package/cjs/theme.js.map +0 -7
  47. package/cjs/themeProviderHOC.js.map +0 -7
  48. package/cjs/utils.js.map +0 -7
  49. package/esm/arithmetic.js.map +0 -7
  50. package/esm/constants.js.map +0 -7
  51. package/esm/globalStyles.js.map +0 -7
  52. package/esm/index.js.map +0 -7
  53. package/esm/mobileUtilities.js.map +0 -7
  54. package/esm/spaceUtilities.js.map +0 -7
  55. package/esm/styled/index.d.js.map +0 -7
  56. package/esm/styled/index.js.map +0 -7
  57. package/esm/styled/styleGetters.js.map +0 -7
  58. package/esm/styled/types.js.map +0 -7
  59. package/esm/styled/utils.js.map +0 -7
  60. package/esm/th.js.map +0 -7
  61. package/esm/theme.js.map +0 -7
  62. package/esm/themeProviderHOC.js.map +0 -7
  63. package/esm/utils.js.map +0 -7
@@ -1,89 +1,125 @@
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);
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
+ require('core-js/modules/esnext.async-iterator.map.js');
7
+ require('core-js/modules/esnext.iterator.map.js');
8
+ require('core-js/modules/web.dom-collections.iterator.js');
9
+ require('core-js/modules/esnext.async-iterator.reduce.js');
10
+ require('core-js/modules/esnext.iterator.constructor.js');
11
+ require('core-js/modules/esnext.iterator.reduce.js');
12
+ require('core-js/modules/esnext.async-iterator.filter.js');
13
+ require('core-js/modules/esnext.iterator.filter.js');
14
+ require('core-js/modules/esnext.async-iterator.for-each.js');
15
+ require('core-js/modules/esnext.iterator.for-each.js');
16
+ var styled_component = require('styled-components');
17
+ var styleGetters = require('./styleGetters.js');
18
+ var utils = require('./utils.js');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
+
22
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
23
+ var styled_component__default = /*#__PURE__*/_interopDefaultLegacy(styled_component);
24
+
25
+ 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; }
26
+
27
+ 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; }
28
+
29
+ const styledFunction = function (tag) {
30
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
31
+ name: null,
32
+ slot: null
26
33
  };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var styled_exports = {};
29
- __export(styled_exports, {
30
- styled: () => styled
31
- });
32
- var React = __toESM(require("react"));
33
- var import_styled_components = __toESM(require("styled-components"));
34
- var import_styleGetters = require("./styleGetters");
35
- var import_utils = require("./utils");
36
- const styledFunction = (tag, options = { name: null, slot: null }) => {
37
- const { name: componentName = null, slot: componentSlot = null } = options;
38
- const func = (styleArg, ...expressions) => {
39
- const expressionsWithDefaultTheme = expressions ? expressions.map((stylesArg) => typeof stylesArg === "function" ? (props) => stylesArg({
40
- ...props,
41
- theme: (0, import_utils.coerceWithDefaultTheme)(props.theme)
42
- }) : stylesArg) : [];
34
+ const {
35
+ name: componentName,
36
+ slot: componentSlot,
37
+ displayName: componentDisplayName = null
38
+ } = options;
39
+
40
+ const func = function (styleArg) {
41
+ for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
42
+ expressions[_key - 1] = arguments[_key];
43
+ }
44
+
45
+ /*
46
+ * These are the internal expression written in dimsum
47
+ * We just coerce with the default theme in case users
48
+ * forget to add the ThemeProvider
49
+ */
50
+ const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => typeof stylesArg === 'function' ? props => stylesArg(_objectSpread(_objectSpread({}, props), {}, {
51
+ theme: utils.coerceWithDefaultTheme(props.theme)
52
+ })) : stylesArg) : [];
43
53
  let transformedStyleArg = styleArg;
54
+ /*
55
+ * Here we get the style overrides from the user
56
+ */
57
+
44
58
  if (componentName && componentSlot) {
45
- expressionsWithDefaultTheme.push((props) => {
46
- const theme = (0, import_utils.coerceWithDefaultTheme)(props.theme);
47
- const styleOverrides = (0, import_styleGetters.getStyleOverrides)(componentName, theme);
59
+ expressionsWithDefaultTheme.push(props => {
60
+ const theme = utils.coerceWithDefaultTheme(props.theme);
61
+ const styleOverrides = styleGetters.getStyleOverrides(componentName, theme);
62
+
48
63
  if (styleOverrides) {
49
64
  return [styleOverrides[componentSlot]];
50
65
  }
66
+
51
67
  return null;
52
68
  });
53
69
  }
54
- if (componentName && componentSlot === "root") {
55
- expressionsWithDefaultTheme.push((props) => {
56
- const theme = (0, import_utils.coerceWithDefaultTheme)(props.theme);
57
- return (0, import_styleGetters.variantsResolver)(props, (0, import_styleGetters.getVariantStyles)(componentName, theme), theme, componentName);
70
+ /*
71
+ * Here we get the variant overrides from the user (only for the root)
72
+ */
73
+
74
+
75
+ if (componentName && componentSlot === 'root') {
76
+ expressionsWithDefaultTheme.push(props => {
77
+ const theme = utils.coerceWithDefaultTheme(props.theme);
78
+ return styleGetters.variantsResolver(props, styleGetters.getVariantStyles(componentName, theme), theme, componentName);
58
79
  });
59
80
  }
81
+
60
82
  const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
83
+
61
84
  if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
62
- const placeholders = new Array(numOfCustomFnsApplied).fill("");
85
+ // Here we are adding placeholders for all the new functions that we are gonna call
86
+ const placeholders = new Array(numOfCustomFnsApplied).fill('');
63
87
  transformedStyleArg = Object.assign([...styleArg, ...placeholders], {
64
88
  raw: [...styleArg.raw, ...placeholders]
65
89
  });
66
- } else if (typeof styleArg === "function") {
67
- transformedStyleArg = (props) => styleArg({ ...props, theme: (0, import_utils.coerceWithDefaultTheme)(props.theme) });
90
+ } else if (typeof styleArg === 'function') {
91
+ // Here we just coerce with the default theme
92
+ transformedStyleArg = props => styleArg(_objectSpread(_objectSpread({}, props), {}, {
93
+ theme: utils.coerceWithDefaultTheme(props.theme)
94
+ }));
68
95
  }
69
- let Component = (0, import_styled_components.default)(tag);
70
- const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;
96
+
97
+ let Component = /*#__PURE__*/styled_component__default["default"](tag);
98
+ const displayName = componentName !== null && componentSlot !== null ? "".concat(componentName, "-").concat(componentSlot) : componentDisplayName;
99
+
71
100
  if (displayName !== null) {
72
- Component = Component.attrs({ className: `${componentName}${componentSlot}` });
101
+ Component = Component.attrs({
102
+ className: "".concat(componentName, "-").concat(componentSlot)
103
+ });
73
104
  }
105
+
74
106
  Component = Component(transformedStyleArg, ...expressionsWithDefaultTheme);
107
+
75
108
  if (displayName !== null) {
76
109
  Component.displayName = displayName;
77
110
  }
111
+
78
112
  return Component;
79
113
  };
114
+
80
115
  return func;
81
116
  };
82
- const styledObject = Object.keys(import_styled_components.default).reduce((obj, key) => {
117
+
118
+ const styledObject = Object.keys(styled_component__default["default"]).reduce((obj, key) => {
83
119
  const castedKey = key;
84
120
  obj[castedKey] = styledFunction(castedKey);
85
121
  return obj;
86
122
  }, {});
87
123
  const styled = Object.assign(styledFunction, styledObject);
88
- module.exports = __toCommonJS(styled_exports);
89
- //# sourceMappingURL=index.js.map
124
+
125
+ exports.styled = styled;
@@ -1,56 +1,44 @@
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 });
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.reduce.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.reduce.js');
8
+ require('core-js/modules/esnext.async-iterator.every.js');
9
+ require('core-js/modules/esnext.iterator.every.js');
10
+ var utils = require('./utils.js');
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;
11
16
  };
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 styleGetters_exports = {};
29
- __export(styleGetters_exports, {
30
- getStyleOverrides: () => getStyleOverrides,
31
- getVariantStyles: () => getVariantStyles,
32
- variantsResolver: () => variantsResolver
33
- });
34
- var React = __toESM(require("react"));
35
- var import_utils = require("./utils");
36
- const getStyleOverrides = (name, theme) => theme.components?.[name]?.styleOverrides || null;
37
17
  const getVariantStyles = (name, theme) => {
38
- const variants = theme.components?.[name]?.variants || [];
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) || [];
39
21
  return variants.reduce((styles, definition) => {
40
- const key = (0, import_utils.propsToClassKey)(definition.props);
22
+ const key = utils.propsToClassKey(definition.props);
41
23
  styles[key] = definition.style;
42
24
  return styles;
43
25
  }, {});
44
26
  };
45
27
  const variantsResolver = (props, styles, theme, name) => {
46
- const themeVariants = theme?.components?.[name]?.variants || [];
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) || [];
47
31
  return themeVariants.reduce((variantsStyles, themeVariant) => {
48
- const isMatch = Object.keys(themeVariant.props).every((key) => props[key] === themeVariant.props[key]);
32
+ const isMatch = Object.keys(themeVariant.props).every(key => props[key] === themeVariant.props[key]);
33
+
49
34
  if (isMatch) {
50
- variantsStyles.push(styles[(0, import_utils.propsToClassKey)(themeVariant.props)]);
35
+ variantsStyles.push(styles[utils.propsToClassKey(themeVariant.props)]);
51
36
  }
37
+
52
38
  return variantsStyles;
53
39
  }, []);
54
40
  };
55
- module.exports = __toCommonJS(styleGetters_exports);
56
- //# sourceMappingURL=styleGetters.js.map
41
+
42
+ exports.getStyleOverrides = getStyleOverrides;
43
+ exports.getVariantStyles = getVariantStyles;
44
+ exports.variantsResolver = variantsResolver;
@@ -1,35 +1,12 @@
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 types_exports = {};
29
- __export(types_exports, {
30
- CSSObject: () => import_styled_components2.CSSObject
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var styled_component = require('styled-components');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, 'CSSObject', {
10
+ enumerable: true,
11
+ get: function () { return styled_component.CSSObject; }
31
12
  });
32
- var React = __toESM(require("react"));
33
- var import_styled_components2 = require("styled-components");
34
- module.exports = __toCommonJS(types_exports);
35
- //# sourceMappingURL=types.js.map
@@ -1,47 +1,24 @@
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 });
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.reduce.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.reduce.js');
8
+ var dsUtilities = require('@elliemae/ds-utilities');
9
+ var theme = require('../theme.js');
10
+
11
+ const systemTheme = theme.theme;
12
+ const isEmpty = string => string.length === 0;
13
+ const coerceWithDefaultTheme = themeInput => themeInput !== null && themeInput !== void 0 ? themeInput : systemTheme;
14
+ const propsToClassKey = props => Object.keys(props).sort().reduce((classKey, key) => {
15
+ if (key === 'color') {
16
+ return classKey + isEmpty(String(classKey)) ? String(props[key]) : dsUtilities.capitalize(String(props[key]));
17
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
- coerceWithDefaultTheme: () => coerceWithDefaultTheme,
31
- isEmpty: () => isEmpty,
32
- propsToClassKey: () => propsToClassKey
33
- });
34
- var React = __toESM(require("react"));
35
- var import_ds_utilities = require("@elliemae/ds-utilities");
36
- var import_theme = require("../theme");
37
- const systemTheme = import_theme.theme;
38
- const isEmpty = (string) => string.length === 0;
39
- const coerceWithDefaultTheme = (themeInput) => themeInput ?? systemTheme;
40
- const propsToClassKey = (props) => Object.keys(props).sort().reduce((classKey, key) => {
41
- if (key === "color") {
42
- return classKey + isEmpty(String(classKey)) ? String(props[key]) : (0, import_ds_utilities.capitalize)(String(props[key]));
43
- }
44
- return `${classKey}${isEmpty(String(classKey)) ? key : (0, import_ds_utilities.capitalize)(key)}${(0, import_ds_utilities.capitalize)(props[key].toString())}`;
45
- }, "");
46
- module.exports = __toCommonJS(utils_exports);
47
- //# sourceMappingURL=utils.js.map
18
+
19
+ return "".concat(classKey).concat(isEmpty(String(classKey)) ? key : dsUtilities.capitalize(key)).concat(dsUtilities.capitalize(props[key].toString()));
20
+ }, '');
21
+
22
+ exports.coerceWithDefaultTheme = coerceWithDefaultTheme;
23
+ exports.isEmpty = isEmpty;
24
+ exports.propsToClassKey = propsToClassKey;
package/cjs/th.js CHANGED
@@ -1,52 +1,32 @@
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 th_exports = {};
29
- __export(th_exports, {
30
- th: () => th
31
- });
32
- var React = __toESM(require("react"));
33
- const th = (property) => (value, dfault) => ({ theme }) => {
34
- const parts = value.split("-");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/esnext.async-iterator.for-each.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.for-each.js');
8
+
9
+ const th = property => (value, dfault) => _ref => {
10
+ var _result;
11
+
12
+ let {
13
+ theme
14
+ } = _ref;
15
+ const parts = value.split('-');
35
16
  let result = theme[property];
36
- parts.forEach((part) => {
37
- if (result)
38
- result = result[part];
17
+ parts.forEach(part => {
18
+ if (result) result = result[part];
39
19
  });
40
- return result ?? dfault;
20
+ return (_result = result) !== null && _result !== void 0 ? _result : dfault;
41
21
  };
42
- th.space = th("space");
43
- th.fontSize = th("fontSizes");
44
- th.fontWeight = th("fontWeights");
45
- th.lineHeight = th("lineHeights");
46
- th.letterSpacing = th("letterSpacings");
47
- th.font = th("fonts");
48
- th.color = th("colors");
49
- th.breakpoint = th("breakpoints");
50
- th.media = th("media");
51
- module.exports = __toCommonJS(th_exports);
52
- //# sourceMappingURL=th.js.map
22
+ th.space = th('space');
23
+ th.fontSize = th('fontSizes');
24
+ th.fontWeight = th('fontWeights');
25
+ th.lineHeight = th('lineHeights');
26
+ th.letterSpacing = th('letterSpacings');
27
+ th.font = th('fonts');
28
+ th.color = th('colors');
29
+ th.breakpoint = th('breakpoints');
30
+ th.media = th('media');
31
+
32
+ exports.th = th;
package/cjs/theme.js CHANGED
@@ -1,36 +1,9 @@
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
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,42 +1,29 @@
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
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;