@elliemae/ds-system 3.0.0-next.2 → 3.0.0-next.6

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 (105) hide show
  1. package/dist/cjs/arithmetic.js +55 -0
  2. package/dist/cjs/arithmetic.js.map +7 -0
  3. package/dist/cjs/constants.js +47 -0
  4. package/dist/cjs/constants.js.map +7 -0
  5. package/dist/cjs/globalStyles.js +47 -0
  6. package/dist/cjs/globalStyles.js.map +7 -0
  7. package/dist/cjs/index.js +43 -0
  8. package/dist/cjs/index.js.map +7 -0
  9. package/dist/cjs/mobileUtilities.js +72 -0
  10. package/dist/cjs/mobileUtilities.js.map +7 -0
  11. package/dist/cjs/spaceUtilities.js +94 -0
  12. package/dist/cjs/spaceUtilities.js.map +7 -0
  13. package/dist/cjs/styled/index.d.js +27 -0
  14. package/dist/cjs/styled/index.d.js.map +7 -0
  15. package/dist/cjs/styled/index.js +105 -0
  16. package/dist/cjs/styled/index.js.map +7 -0
  17. package/dist/cjs/styled/styleGetters.js +56 -0
  18. package/dist/cjs/styled/styleGetters.js.map +7 -0
  19. package/dist/cjs/styled/types.js +35 -0
  20. package/dist/cjs/styled/types.js.map +7 -0
  21. package/dist/cjs/styled/utils.js +47 -0
  22. package/dist/cjs/styled/utils.js.map +7 -0
  23. package/dist/cjs/th.js +58 -0
  24. package/dist/cjs/th.js.map +7 -0
  25. package/dist/cjs/theme.js +36 -0
  26. package/dist/cjs/theme.js.map +7 -0
  27. package/dist/cjs/themeProviderHOC.js +54 -0
  28. package/dist/cjs/themeProviderHOC.js.map +7 -0
  29. package/dist/cjs/utils.js +294 -0
  30. package/dist/cjs/utils.js.map +7 -0
  31. package/{esm → dist/esm}/arithmetic.js +13 -25
  32. package/dist/esm/arithmetic.js.map +7 -0
  33. package/dist/esm/constants.js +18 -0
  34. package/dist/esm/constants.js.map +7 -0
  35. package/dist/esm/globalStyles.js +18 -0
  36. package/dist/esm/globalStyles.js.map +7 -0
  37. package/dist/esm/index.js +14 -0
  38. package/dist/esm/index.js.map +7 -0
  39. package/dist/esm/mobileUtilities.js +43 -0
  40. package/dist/esm/mobileUtilities.js.map +7 -0
  41. package/dist/esm/spaceUtilities.js +65 -0
  42. package/dist/esm/spaceUtilities.js.map +7 -0
  43. package/dist/esm/styled/index.d.js +2 -0
  44. package/dist/esm/styled/index.d.js.map +7 -0
  45. package/dist/esm/styled/index.js +78 -0
  46. package/dist/esm/styled/index.js.map +7 -0
  47. package/dist/esm/styled/styleGetters.js +27 -0
  48. package/dist/esm/styled/styleGetters.js.map +7 -0
  49. package/dist/esm/styled/types.js +6 -0
  50. package/dist/esm/styled/types.js.map +7 -0
  51. package/dist/esm/styled/utils.js +18 -0
  52. package/dist/esm/styled/utils.js.map +7 -0
  53. package/dist/esm/th.js +29 -0
  54. package/dist/esm/th.js.map +7 -0
  55. package/dist/esm/theme.js +7 -0
  56. package/dist/esm/theme.js.map +7 -0
  57. package/dist/esm/themeProviderHOC.js +27 -0
  58. package/dist/esm/themeProviderHOC.js.map +7 -0
  59. package/dist/esm/utils.js +265 -0
  60. package/dist/esm/utils.js.map +7 -0
  61. package/package.json +53 -44
  62. package/cjs/arithmetic.js +0 -43
  63. package/cjs/constants.js +0 -19
  64. package/cjs/globalStyles.js +0 -25
  65. package/cjs/index.js +0 -84
  66. package/cjs/mobileUtilities.js +0 -41
  67. package/cjs/spaceUtilities.js +0 -68
  68. package/cjs/styled/index.d.js +0 -2
  69. package/cjs/styled/index.js +0 -125
  70. package/cjs/styled/styleGetters.js +0 -44
  71. package/cjs/styled/types.js +0 -12
  72. package/cjs/styled/utils.js +0 -24
  73. package/cjs/th.js +0 -32
  74. package/cjs/theme.js +0 -9
  75. package/cjs/themeProviderHOC.js +0 -29
  76. package/cjs/utils.js +0 -184
  77. package/esm/constants.js +0 -13
  78. package/esm/globalStyles.js +0 -17
  79. package/esm/index.js +0 -11
  80. package/esm/mobileUtilities.js +0 -34
  81. package/esm/spaceUtilities.js +0 -57
  82. package/esm/styled/index.d.js +0 -1
  83. package/esm/styled/index.js +0 -116
  84. package/esm/styled/styleGetters.js +0 -38
  85. package/esm/styled/types.js +0 -1
  86. package/esm/styled/utils.js +0 -18
  87. package/esm/th.js +0 -28
  88. package/esm/theme.js +0 -5
  89. package/esm/themeProviderHOC.js +0 -20
  90. package/esm/utils.js +0 -136
  91. package/types/arithmetic.d.ts +0 -5
  92. package/types/constants.d.ts +0 -11
  93. package/types/globalStyles.d.ts +0 -1
  94. package/types/index.d.ts +0 -9
  95. package/types/mobileUtilities.d.ts +0 -4
  96. package/types/spaceUtilities.d.ts +0 -13
  97. package/types/styled/index.d.ts +0 -2
  98. package/types/styled/styleGetters.d.ts +0 -4
  99. package/types/styled/types.d.ts +0 -28
  100. package/types/styled/utils.d.ts +0 -6
  101. package/types/tests/arithmetic.test.d.ts +0 -1
  102. package/types/th.d.ts +0 -14
  103. package/types/theme.d.ts +0 -2
  104. package/types/themeProviderHOC.d.ts +0 -2
  105. package/types/utils.d.ts +0 -27
@@ -1,38 +1,26 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
-
1
+ import * as React from "react";
3
2
  function getNumberAndUnit(numberStrWithUnit) {
4
3
  const [number, unit] = String(numberStrWithUnit).match(/[a-z]+|[(/^\-?\d*.\d+|\d+),?]+/gi);
5
- return {
6
- number,
7
- unit
8
- };
4
+ return { number, unit };
9
5
  }
10
6
  function op(operator, n1, n2) {
11
- const {
12
- number,
13
- unit
14
- } = getNumberAndUnit(n1);
15
- const {
16
- number: number2,
17
- unit: unit2
18
- } = getNumberAndUnit(n2);
19
-
7
+ const { number, unit } = getNumberAndUnit(n1);
8
+ const { number: number2, unit: unit2 } = getNumberAndUnit(n2);
20
9
  switch (operator) {
21
- case '*':
10
+ case "*":
22
11
  return Number(number) * Number(number2) + (unit || unit2);
23
-
24
- case '+':
12
+ case "+":
25
13
  return Number(number) + Number(number2) + (unit || unit2);
26
-
27
- case '-':
14
+ case "-":
28
15
  return Number(number) - Number(number2) + (unit || unit2);
29
-
30
- case '/':
16
+ case "/":
31
17
  return Number(number) / Number(number2) + (unit || unit2);
32
-
33
18
  default:
34
19
  return Number(number) + Number(number2) + (unit || unit2);
35
20
  }
36
21
  }
37
-
38
- export { getNumberAndUnit, op };
22
+ export {
23
+ getNumberAndUnit,
24
+ op
25
+ };
26
+ //# sourceMappingURL=arithmetic.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/arithmetic.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function getNumberAndUnit(\n numberStrWithUnit: string | number,\n): { number: string; unit: string } {\n const [number, unit] = String(numberStrWithUnit).match(\n /[a-z]+|[(/^\\-?\\d*.\\d+|\\d+),?]+/gi,\n );\n return { number, unit };\n}\n\nexport function op(operator: string, n1: string, n2: string | number): string {\n const { number, unit } = getNumberAndUnit(n1);\n const { number: number2, unit: unit2 } = getNumberAndUnit(n2);\n switch (operator) {\n case '*':\n return Number(number) * Number(number2) + (unit || unit2);\n case '+':\n return Number(number) + Number(number2) + (unit || unit2);\n case '-':\n return Number(number) - Number(number2) + (unit || unit2);\n case '/':\n return Number(number) / Number(number2) + (unit || unit2);\n default:\n return Number(number) + Number(number2) + (unit || unit2);\n }\n}\n"],
5
+ "mappings": "AAAA;ACAO,0BACL,mBACkC;AAClC,QAAM,CAAC,QAAQ,QAAQ,OAAO,mBAAmB,MAC/C;AAEF,SAAO,EAAE,QAAQ;AAAA;AAGZ,YAAY,UAAkB,IAAY,IAA6B;AAC5E,QAAM,EAAE,QAAQ,SAAS,iBAAiB;AAC1C,QAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,iBAAiB;AAC1D,UAAQ;AAAA,SACD;AACH,aAAO,OAAO,UAAU,OAAO,WAAY,SAAQ;AAAA,SAChD;AACH,aAAO,OAAO,UAAU,OAAO,WAAY,SAAQ;AAAA,SAChD;AACH,aAAO,OAAO,UAAU,OAAO,WAAY,SAAQ;AAAA,SAChD;AACH,aAAO,OAAO,UAAU,OAAO,WAAY,SAAQ;AAAA;AAEnD,aAAO,OAAO,UAAU,OAAO,WAAY,SAAQ;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ const desktopBaseFont = 13;
3
+ const mobileBaseFont = 16;
4
+ const translateUnits = {
5
+ "8px": "4px",
6
+ "16px": "8px",
7
+ "32px": "16px",
8
+ "48px": "24px",
9
+ "56px": "32px",
10
+ "64px": "48px",
11
+ "72px": "64px"
12
+ };
13
+ export {
14
+ desktopBaseFont,
15
+ mobileBaseFont,
16
+ translateUnits
17
+ };
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/constants.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const desktopBaseFont = 13;\n\nexport const mobileBaseFont = 16;\n\nexport const translateUnits = {\n '8px': '4px',\n '16px': '8px',\n '32px': '16px',\n '48px': '24px',\n '56px': '32px',\n '64px': '48px',\n '72px': '64px',\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,kBAAkB;AAExB,MAAM,iBAAiB;AAEvB,MAAM,iBAAiB;AAAA,EAC5B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { createGlobalStyle } from "./utils";
3
+ const GlobalStyles = createGlobalStyle`
4
+ :root, body {
5
+ overscroll-behavior-y: none;
6
+
7
+ font-size: ${(props) => props.device === "desktop" ? "13px" : "16px"};
8
+
9
+ @media(min-width: ${({ theme }) => theme.breakpoints.small}) {
10
+ font-size: ${(props) => props.device === "mobile" ? "16px" : "13px"};
11
+ }
12
+
13
+ }
14
+ `;
15
+ export {
16
+ GlobalStyles
17
+ };
18
+ //# sourceMappingURL=globalStyles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/globalStyles.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createGlobalStyle } from './utils';\n\nexport const GlobalStyles = createGlobalStyle`\n :root, body {\n overscroll-behavior-y: none;\n\n font-size: ${(props) => (props.device === 'desktop' ? '13px' : '16px')};\n\n @media(min-width: ${({ theme }) => theme.breakpoints.small}) {\n font-size: ${(props) => (props.device === 'mobile' ? '16px' : '13px')};\n }\n\n }\n`;\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,iBAIX,CAAC,UAAW,MAAM,WAAW,YAAY,SAAS;AAAA;AAAA,wBAE3C,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA,mBACtC,CAAC,UAAW,MAAM,WAAW,WAAW,SAAS;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ export * from "./globalStyles";
3
+ export * from "./spaceUtilities";
4
+ export * from "./mobileUtilities";
5
+ export * from "./utils";
6
+ export * from "./arithmetic";
7
+ export * from "./th";
8
+ export * from "./theme";
9
+ export * from "./styled";
10
+ import { themeProviderHOC } from "./themeProviderHOC";
11
+ export {
12
+ themeProviderHOC
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './globalStyles';\nexport * from './spaceUtilities';\nexport * from './mobileUtilities';\nexport * from './utils';\nexport * from './arithmetic';\nexport * from './th';\nexport * from './theme';\nexport * from './styled';\nexport { themeProviderHOC } from './themeProviderHOC';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,43 @@
1
+ import * as React from "react";
2
+ import { useState, useEffect } from "react";
3
+ import { theme } from "./theme";
4
+ import { desktopBaseFont, mobileBaseFont, translateUnits } from "./constants";
5
+ function __UNSAFE_SPACE_TO_DIMSUM(unit) {
6
+ if (translateUnits[unit])
7
+ return translateUnits[unit];
8
+ return `${parseFloat(unit) * (mobileBaseFont / desktopBaseFont) / 2}px`;
9
+ }
10
+ function toMobile(unit) {
11
+ if (!isMobile())
12
+ return unit;
13
+ return `${parseFloat(unit) * (desktopBaseFont / mobileBaseFont)}rem`;
14
+ }
15
+ const useIsMobile = () => {
16
+ const [mobile, setMobile] = useState(isMobile());
17
+ useEffect(() => {
18
+ function handleResize() {
19
+ setMobile(isMobile());
20
+ }
21
+ if (window)
22
+ window.addEventListener("resize", handleResize);
23
+ return () => {
24
+ if (window)
25
+ window.removeEventListener("resize", handleResize);
26
+ };
27
+ }, []);
28
+ if (!window)
29
+ return false;
30
+ return mobile;
31
+ };
32
+ const isMobile = () => {
33
+ if (!window)
34
+ return false;
35
+ return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
36
+ };
37
+ export {
38
+ __UNSAFE_SPACE_TO_DIMSUM,
39
+ isMobile,
40
+ toMobile,
41
+ useIsMobile
42
+ };
43
+ //# sourceMappingURL=mobileUtilities.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/mobileUtilities.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useState, useEffect } from 'react';\nimport { theme } from './theme';\nimport { desktopBaseFont, mobileBaseFont, translateUnits } from './constants';\n\n// eslint-disable-next-line no-underscore-dangle\nexport function __UNSAFE_SPACE_TO_DIMSUM(unit: string): string {\n if (translateUnits[unit]) return translateUnits[unit];\n return `${(parseFloat(unit) * (mobileBaseFont / desktopBaseFont)) / 2}px`;\n}\n\nexport function toMobile(unit: string): string {\n if (!isMobile()) return unit;\n return `${parseFloat(unit) * (desktopBaseFont / mobileBaseFont)}rem`;\n}\n\nexport const useIsMobile = (): boolean => {\n const [mobile, setMobile] = useState<boolean>(isMobile());\n useEffect(() => {\n function handleResize() {\n setMobile(isMobile());\n }\n if (window) window.addEventListener('resize', handleResize);\n return () => {\n if (window) window.removeEventListener('resize', handleResize);\n };\n }, []);\n if (!window) return false;\n return mobile;\n};\n\nexport const isMobile = (): boolean => {\n if (!window) return false;\n return (\n Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0\n );\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AAGO,kCAAkC,MAAsB;AAC7D,MAAI,eAAe;AAAO,WAAO,eAAe;AAChD,SAAO,GAAI,WAAW,QAAS,kBAAiB,mBAAoB;AAAA;AAG/D,kBAAkB,MAAsB;AAC7C,MAAI,CAAC;AAAY,WAAO;AACxB,SAAO,GAAG,WAAW,QAAS,mBAAkB;AAAA;AAG3C,MAAM,cAAc,MAAe;AACxC,QAAM,CAAC,QAAQ,aAAa,SAAkB;AAC9C,YAAU,MAAM;AACd,4BAAwB;AACtB,gBAAU;AAAA;AAEZ,QAAI;AAAQ,aAAO,iBAAiB,UAAU;AAC9C,WAAO,MAAM;AACX,UAAI;AAAQ,eAAO,oBAAoB,UAAU;AAAA;AAAA,KAElD;AACH,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AAAA;AAGF,MAAM,WAAW,MAAe;AACrC,MAAI,CAAC;AAAQ,WAAO;AACpB,SACE,OAAO,MAAM,YAAY,OAAO,MAAM,MAAM,MAAM,OAAO,cAAc;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,65 @@
1
+ import * as React from "react";
2
+ import { get } from "lodash";
3
+ import { theme } from "./theme";
4
+ function mapGap(gutter) {
5
+ if (!gutter)
6
+ return "0rem";
7
+ if (String(gutter).includes("rem") || String(gutter).includes("px"))
8
+ return gutter;
9
+ return `${theme.space[gutter]}`;
10
+ }
11
+ function mapGutter(gutter) {
12
+ if (!gutter)
13
+ return "0rem";
14
+ return `${theme.space[gutter]} * 2`;
15
+ }
16
+ function mapSpace(width) {
17
+ if (typeof width === "string")
18
+ return get(theme, width) ? `${get(theme, width)}` : width;
19
+ return `${width * 100}%`;
20
+ }
21
+ function fixSpaceGutter(width, gutter) {
22
+ if (!width)
23
+ return "";
24
+ if (Array.isArray(width))
25
+ return width.map((w) => `calc(${mapSpace(w)} - (${mapGutter(gutter)}))`);
26
+ return `calc(${mapSpace(width)} - (${mapGutter(gutter)}))`;
27
+ }
28
+ function fixSpace(width) {
29
+ if (!width)
30
+ return "";
31
+ if (Array.isArray(width))
32
+ return width.map((w) => mapSpace(w));
33
+ return mapSpace(width);
34
+ }
35
+ function numbersToFr(grid) {
36
+ const den = grid.map((f) => f < 1 ? Math.floor(1 / f) : f);
37
+ return den.map((d) => `${d}fr`);
38
+ }
39
+ function mapGrid(width) {
40
+ if (get(theme, width))
41
+ return `${get(theme, width)}`;
42
+ if (typeof width === "string")
43
+ return width;
44
+ const den = width < 1 ? Math.floor(1 / width) : width;
45
+ return `${den}fr`;
46
+ }
47
+ function mapTemplateGrid(grid) {
48
+ if (Array.isArray(grid)) {
49
+ if (grid.some((w) => typeof w === "string"))
50
+ return grid.map((w) => mapGrid(w));
51
+ return numbersToFr(grid);
52
+ }
53
+ return mapGrid(grid);
54
+ }
55
+ export {
56
+ fixSpace,
57
+ fixSpaceGutter,
58
+ mapGap,
59
+ mapGrid,
60
+ mapGutter,
61
+ mapSpace,
62
+ mapTemplateGrid,
63
+ numbersToFr
64
+ };
65
+ //# sourceMappingURL=spaceUtilities.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/spaceUtilities.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { get } from 'lodash';\nimport { theme } from './theme';\n\nexport function mapGap(gutter: number | string): number | string {\n if (!gutter) return '0rem';\n if (String(gutter).includes('rem') || String(gutter).includes('px')) return gutter;\n return `${theme.space[gutter as keyof typeof theme.space]}`;\n}\n\nexport function mapGutter(gutter: string | number | undefined): string {\n if (!gutter) return '0rem';\n return `${theme.space[gutter as keyof typeof theme.space]} * 2`;\n}\n\nexport function mapSpace(width: string | number): string {\n if (typeof width === 'string') return get(theme, width) ? `${get(theme, width)}` : width;\n return `${width * 100}%`;\n}\n\nexport function fixSpaceGutter(\n width: string | number | string[] | number[],\n gutter?: string | number,\n): string | string[] {\n if (!width) return '';\n if (Array.isArray(width)) return width.map((w) => `calc(${mapSpace(w)} - (${mapGutter(gutter)}))`);\n return `calc(${mapSpace(width)} - (${mapGutter(gutter)}))`;\n}\n\nexport function fixSpace(width: string | number | string[] | number[]): string | string[] {\n if (!width) return '';\n if (Array.isArray(width)) return width.map((w) => mapSpace(w));\n return mapSpace(width);\n}\n\nexport function numbersToFr(grid: number[]): string[] {\n const den = grid.map((f) => (f < 1 ? Math.floor(1 / f) : f));\n return den.map((d) => `${d}fr`);\n}\nexport function mapGrid(width: string | number): string {\n if (get(theme, width)) return `${get(theme, width)}`;\n if (typeof width === 'string') return width;\n const den = width < 1 ? Math.floor(1 / width) : width;\n return `${den}fr`;\n}\n\nexport function mapTemplateGrid(grid: (number | string)[]): string | string[] {\n if (Array.isArray(grid)) {\n if (grid.some((w) => typeof w === 'string')) return grid.map((w) => mapGrid(w));\n return numbersToFr(grid as number[]);\n }\n return mapGrid(grid);\n}\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEO,gBAAgB,QAA0C;AAC/D,MAAI,CAAC;AAAQ,WAAO;AACpB,MAAI,OAAO,QAAQ,SAAS,UAAU,OAAO,QAAQ,SAAS;AAAO,WAAO;AAC5E,SAAO,GAAG,MAAM,MAAM;AAAA;AAGjB,mBAAmB,QAA6C;AACrE,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO,GAAG,MAAM,MAAM;AAAA;AAGjB,kBAAkB,OAAgC;AACvD,MAAI,OAAO,UAAU;AAAU,WAAO,IAAI,OAAO,SAAS,GAAG,IAAI,OAAO,WAAW;AACnF,SAAO,GAAG,QAAQ;AAAA;AAGb,wBACL,OACA,QACmB;AACnB,MAAI,CAAC;AAAO,WAAO;AACnB,MAAI,MAAM,QAAQ;AAAQ,WAAO,MAAM,IAAI,CAAC,MAAM,QAAQ,SAAS,SAAS,UAAU;AACtF,SAAO,QAAQ,SAAS,aAAa,UAAU;AAAA;AAG1C,kBAAkB,OAAiE;AACxF,MAAI,CAAC;AAAO,WAAO;AACnB,MAAI,MAAM,QAAQ;AAAQ,WAAO,MAAM,IAAI,CAAC,MAAM,SAAS;AAC3D,SAAO,SAAS;AAAA;AAGX,qBAAqB,MAA0B;AACpD,QAAM,MAAM,KAAK,IAAI,CAAC,MAAO,IAAI,IAAI,KAAK,MAAM,IAAI,KAAK;AACzD,SAAO,IAAI,IAAI,CAAC,MAAM,GAAG;AAAA;AAEpB,iBAAiB,OAAgC;AACtD,MAAI,IAAI,OAAO;AAAQ,WAAO,GAAG,IAAI,OAAO;AAC5C,MAAI,OAAO,UAAU;AAAU,WAAO;AACtC,QAAM,MAAM,QAAQ,IAAI,KAAK,MAAM,IAAI,SAAS;AAChD,SAAO,GAAG;AAAA;AAGL,yBAAyB,MAA8C;AAC5E,MAAI,MAAM,QAAQ,OAAO;AACvB,QAAI,KAAK,KAAK,CAAC,MAAM,OAAO,MAAM;AAAW,aAAO,KAAK,IAAI,CAAC,MAAM,QAAQ;AAC5E,WAAO,YAAY;AAAA;AAErB,SAAO,QAAQ;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,78 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import styled_component from "styled-components";
22
+ import { getStyleOverrides, getVariantStyles, variantsResolver } from "./styleGetters";
23
+ import { coerceWithDefaultTheme } from "./utils";
24
+ const styledFunction = (tag, options = { name: null, slot: null }) => {
25
+ const { name: componentName = null, slot: componentSlot = null } = options;
26
+ const func = (styleArg, ...expressions) => {
27
+ const expressionsWithDefaultTheme = expressions ? expressions.map((stylesArg) => typeof stylesArg === "function" ? (props) => stylesArg(__spreadProps(__spreadValues({}, props), {
28
+ theme: coerceWithDefaultTheme(props.theme)
29
+ })) : stylesArg) : [];
30
+ let transformedStyleArg = styleArg;
31
+ if (componentName && componentSlot) {
32
+ expressionsWithDefaultTheme.push((props) => {
33
+ const theme = coerceWithDefaultTheme(props.theme);
34
+ const styleOverrides = getStyleOverrides(componentName, theme);
35
+ if (styleOverrides) {
36
+ return [styleOverrides[componentSlot]];
37
+ }
38
+ return null;
39
+ });
40
+ }
41
+ if (componentName && componentSlot === "root") {
42
+ expressionsWithDefaultTheme.push((props) => {
43
+ const theme = coerceWithDefaultTheme(props.theme);
44
+ return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
45
+ });
46
+ }
47
+ const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
48
+ if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
49
+ const placeholders = new Array(numOfCustomFnsApplied).fill("");
50
+ transformedStyleArg = Object.assign([...styleArg, ...placeholders], {
51
+ raw: [...styleArg.raw, ...placeholders]
52
+ });
53
+ } else if (typeof styleArg === "function") {
54
+ transformedStyleArg = (props) => styleArg(__spreadProps(__spreadValues({}, props), { theme: coerceWithDefaultTheme(props.theme) }));
55
+ }
56
+ let Component = styled_component(tag);
57
+ const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;
58
+ if (displayName !== null) {
59
+ Component = Component.attrs({ className: `${componentName}${componentSlot}` });
60
+ }
61
+ Component = Component(transformedStyleArg, ...expressionsWithDefaultTheme);
62
+ if (displayName !== null) {
63
+ Component.displayName = displayName;
64
+ }
65
+ return Component;
66
+ };
67
+ return func;
68
+ };
69
+ const styledObject = Object.keys(styled_component).reduce((obj, key) => {
70
+ const castedKey = key;
71
+ obj[castedKey] = styledFunction(castedKey);
72
+ return obj;
73
+ }, {});
74
+ const styled = Object.assign(styledFunction, styledObject);
75
+ export {
76
+ styled
77
+ };
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/styled/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled_component, { StyledComponentPropsWithRef } from 'styled-components';\nimport { Styled, StyledFunction, StyledObject } from './types';\nimport { getStyleOverrides, getVariantStyles, variantsResolver } from './styleGetters';\nimport { coerceWithDefaultTheme } from './utils';\n\nconst styledFunction: StyledFunction = (tag, options = { name: null, slot: null }) => {\n const { name: componentName = null, slot: componentSlot = null } = options;\n const func: ReturnType<StyledFunction> = (styleArg, ...expressions) => {\n /*\n * These are the internal expression written in dimsum\n * We just coerce with the default theme in case users\n * forget to add the ThemeProvider\n */\n const expressionsWithDefaultTheme = expressions\n ? expressions.map<typeof expressions[number]>((stylesArg) =>\n typeof stylesArg === 'function'\n ? (props) =>\n stylesArg({\n ...props,\n theme: coerceWithDefaultTheme(props.theme),\n })\n : stylesArg,\n )\n : [];\n\n let transformedStyleArg = styleArg;\n\n /*\n * Here we get the style overrides from the user\n */\n if (componentName && componentSlot) {\n expressionsWithDefaultTheme.push((props) => {\n const theme = coerceWithDefaultTheme(props.theme);\n const styleOverrides = getStyleOverrides(componentName, theme);\n if (styleOverrides) {\n return [styleOverrides[componentSlot]];\n }\n return null;\n });\n }\n\n /*\n * Here we get the variant overrides from the user (only for the root)\n */\n if (componentName && componentSlot === 'root') {\n expressionsWithDefaultTheme.push((props) => {\n const theme = coerceWithDefaultTheme(props.theme);\n return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);\n });\n }\n\n const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;\n\n if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {\n // Here we are adding placeholders for all the new functions that we are gonna call\n const placeholders: string[] = new Array(numOfCustomFnsApplied).fill('');\n transformedStyleArg = Object.assign([...styleArg, ...placeholders], {\n raw: [...(styleArg as TemplateStringsArray).raw, ...placeholders],\n });\n } else if (typeof styleArg === 'function') {\n // Here we just coerce with the default theme\n transformedStyleArg = (props) => styleArg({ ...props, theme: coerceWithDefaultTheme(props.theme) });\n }\n let Component = styled_component(tag);\n\n const displayName =\n componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;\n\n if (displayName !== null) {\n Component = Component.attrs({ className: `${componentName}${componentSlot}` } as unknown as Partial<\n StyledComponentPropsWithRef<typeof tag>\n >);\n }\n\n Component = Component(transformedStyleArg, ...expressionsWithDefaultTheme);\n\n if (displayName !== null) {\n Component.displayName = displayName;\n }\n\n return Component;\n };\n return func;\n};\n\nconst styledObject = Object.keys(styled_component).reduce((obj, key) => {\n const castedKey = key as keyof JSX.IntrinsicElements;\n obj[castedKey] = styledFunction(castedKey);\n return obj;\n}, {} as StyledObject);\n\nexport const styled: Styled = Object.assign(styledFunction, styledObject);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AAEA;AACA;AAEA,MAAM,iBAAiC,CAAC,KAAK,UAAU,EAAE,MAAM,MAAM,MAAM,WAAW;AACpF,QAAM,EAAE,MAAM,gBAAgB,MAAM,MAAM,gBAAgB,SAAS;AACnE,QAAM,OAAmC,CAAC,aAAa,gBAAgB;AAMrE,UAAM,8BAA8B,cAChC,YAAY,IAAgC,CAAC,cAC7C,OAAO,cAAc,aACjB,CAAC,UACD,UAAU,iCACL,QADK;AAAA,MAER,OAAO,uBAAuB,MAAM;AAAA,UAEtC,aAEJ;AAEJ,QAAI,sBAAsB;AAK1B,QAAI,iBAAiB,eAAe;AAClC,kCAA4B,KAAK,CAAC,UAAU;AAC1C,cAAM,QAAQ,uBAAuB,MAAM;AAC3C,cAAM,iBAAiB,kBAAkB,eAAe;AACxD,YAAI,gBAAgB;AAClB,iBAAO,CAAC,eAAe;AAAA;AAEzB,eAAO;AAAA;AAAA;AAOX,QAAI,iBAAiB,kBAAkB,QAAQ;AAC7C,kCAA4B,KAAK,CAAC,UAAU;AAC1C,cAAM,QAAQ,uBAAuB,MAAM;AAC3C,eAAO,iBAAiB,OAAO,iBAAiB,eAAe,QAAQ,OAAO;AAAA;AAAA;AAIlF,UAAM,wBAAwB,4BAA4B,SAAS,YAAY;AAE/E,QAAI,MAAM,QAAQ,aAAa,wBAAwB,GAAG;AAExD,YAAM,eAAyB,IAAI,MAAM,uBAAuB,KAAK;AACrE,4BAAsB,OAAO,OAAO,CAAC,GAAG,UAAU,GAAG,eAAe;AAAA,QAClE,KAAK,CAAC,GAAI,SAAkC,KAAK,GAAG;AAAA;AAAA,eAE7C,OAAO,aAAa,YAAY;AAEzC,4BAAsB,CAAC,UAAU,SAAS,iCAAK,QAAL,EAAY,OAAO,uBAAuB,MAAM;AAAA;AAE5F,QAAI,YAAY,iBAAiB;AAEjC,UAAM,cACJ,kBAAkB,QAAQ,kBAAkB,OAAO,GAAG,iBAAiB,kBAAkB;AAE3F,QAAI,gBAAgB,MAAM;AACxB,kBAAY,UAAU,MAAM,EAAE,WAAW,GAAG,gBAAgB;AAAA;AAK9D,gBAAY,UAAU,qBAAqB,GAAG;AAE9C,QAAI,gBAAgB,MAAM;AACxB,gBAAU,cAAc;AAAA;AAG1B,WAAO;AAAA;AAET,SAAO;AAAA;AAGT,MAAM,eAAe,OAAO,KAAK,kBAAkB,OAAO,CAAC,KAAK,QAAQ;AACtE,QAAM,YAAY;AAClB,MAAI,aAAa,eAAe;AAChC,SAAO;AAAA,GACN;AAEI,MAAM,SAAiB,OAAO,OAAO,gBAAgB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import { propsToClassKey } from "./utils";
3
+ const getStyleOverrides = (name, theme) => theme.components?.[name]?.styleOverrides || null;
4
+ const getVariantStyles = (name, theme) => {
5
+ const variants = theme.components?.[name]?.variants || [];
6
+ return variants.reduce((styles, definition) => {
7
+ const key = propsToClassKey(definition.props);
8
+ styles[key] = definition.style;
9
+ return styles;
10
+ }, {});
11
+ };
12
+ const variantsResolver = (props, styles, theme, name) => {
13
+ const themeVariants = theme?.components?.[name]?.variants || [];
14
+ return themeVariants.reduce((variantsStyles, themeVariant) => {
15
+ const isMatch = Object.keys(themeVariant.props).every((key) => props[key] === themeVariant.props[key]);
16
+ if (isMatch) {
17
+ variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);
18
+ }
19
+ return variantsStyles;
20
+ }, []);
21
+ };
22
+ export {
23
+ getStyleOverrides,
24
+ getVariantStyles,
25
+ variantsResolver
26
+ };
27
+ //# sourceMappingURL=styleGetters.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/styled/styleGetters.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport type { Theme, CSSObject } from './types';\nimport { propsToClassKey } from './utils';\n\nexport const getStyleOverrides = (name: string, theme: Theme): CSSObject | null =>\n theme.components?.[name]?.styleOverrides || null;\n\nexport const getVariantStyles = (name: string, theme: Theme): Record<string, CSSObject> => {\n const variants = theme.components?.[name]?.variants || [];\n\n return variants.reduce((styles, definition) => {\n const key = propsToClassKey(definition.props);\n styles[key] = definition.style;\n return styles;\n }, {} as Record<string, CSSObject>);\n};\n\nexport const variantsResolver = (\n props: Record<string, unknown>,\n styles: CSSObject,\n theme: Theme,\n name: string,\n): CSSObject[keyof CSSObject][] => {\n const themeVariants = theme?.components?.[name]?.variants || [];\n\n return themeVariants.reduce((variantsStyles, themeVariant) => {\n const isMatch = Object.keys(themeVariant.props).every((key) => props[key] === themeVariant.props[key]);\n if (isMatch) {\n variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);\n }\n return variantsStyles;\n }, [] as CSSObject[keyof CSSObject][]);\n};\n"],
5
+ "mappings": "AAAA;ACEA;AAEO,MAAM,oBAAoB,CAAC,MAAc,UAC9C,MAAM,aAAa,OAAO,kBAAkB;AAEvC,MAAM,mBAAmB,CAAC,MAAc,UAA4C;AACzF,QAAM,WAAW,MAAM,aAAa,OAAO,YAAY;AAEvD,SAAO,SAAS,OAAO,CAAC,QAAQ,eAAe;AAC7C,UAAM,MAAM,gBAAgB,WAAW;AACvC,WAAO,OAAO,WAAW;AACzB,WAAO;AAAA,KACN;AAAA;AAGE,MAAM,mBAAmB,CAC9B,OACA,QACA,OACA,SACiC;AACjC,QAAM,gBAAgB,OAAO,aAAa,OAAO,YAAY;AAE7D,SAAO,cAAc,OAAO,CAAC,gBAAgB,iBAAiB;AAC5D,UAAM,UAAU,OAAO,KAAK,aAAa,OAAO,MAAM,CAAC,QAAQ,MAAM,SAAS,aAAa,MAAM;AACjG,QAAI,SAAS;AACX,qBAAe,KAAK,OAAO,gBAAgB,aAAa;AAAA;AAE1D,WAAO;AAAA,KACN;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { CSSObject as CSSObject2 } from "styled-components";
3
+ export {
4
+ CSSObject2 as CSSObject
5
+ };
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/styled/types.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { Theme as PuiTheme } from '@elliemae/pui-theme';\nimport {\n AnyStyledComponent,\n CSSObject,\n Interpolation,\n InterpolationFunction,\n StyledComponent,\n StyledComponentInnerAttrs,\n StyledComponentInnerComponent,\n StyledComponentInnerOtherProps,\n StyledComponentPropsWithRef,\n ThemedStyledProps,\n StyledConfig,\n} from 'styled-components';\n\ntype Attrs<P, A extends Partial<P>, T> = ((props: ThemedStyledProps<P, T>) => A) | A;\n\nexport { CSSObject } from 'styled-components';\n\nexport interface Theme extends PuiTheme {\n components?: {\n [componentName: string]: {\n styleOverrides?: CSSObject;\n variants?: { props: Record<string, { toString: () => string }>; style: CSSObject }[];\n };\n };\n}\n\nexport type ThemedStyledFunctionBase<\n C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,\n T extends object,\n O extends object = Record<string, unknown>,\n A extends keyof any = never,\n> = <U extends object = Record<string, unknown>>(\n first:\n | TemplateStringsArray\n | CSSObject\n | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>,\n ...rest: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>>\n) => StyledComponent<C, T, O & U, A>;\n\ninterface ThemedStyledFunction<\n C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,\n T extends object,\n O extends object = Record<string, unknown>,\n A extends keyof any = never,\n> extends ThemedStyledFunctionBase<C, T, O, A> {\n attrs<\n U,\n NewA extends Partial<StyledComponentPropsWithRef<C> & U> & {\n [others: string]: any;\n } = any,\n >(\n attrs: Attrs<StyledComponentPropsWithRef<C> & U, NewA, T>,\n ): ThemedStyledFunction<C, T, O & NewA, A | keyof NewA>;\n\n withConfig: <Props extends O = O>(\n config: StyledConfig<StyledComponentPropsWithRef<C> & Props>,\n ) => ThemedStyledFunction<C, T, Props, A>;\n}\n\ntype ThemedStyledComponentFactories<T extends object> = {\n [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction<TTag, T>;\n};\n\nexport type StyledFunction = <C extends AnyStyledComponent | keyof JSX.IntrinsicElements | React.ComponentType<any>>(\n tag: C,\n options?: { name: string | null; slot: string | null },\n) => ThemedStyledFunction<\n C extends AnyStyledComponent ? StyledComponentInnerComponent<C> : C,\n Theme,\n C extends AnyStyledComponent ? StyledComponentInnerOtherProps<C> : unknown,\n C extends AnyStyledComponent ? StyledComponentInnerAttrs<C> : never\n>;\n\nexport type StyledObject = ThemedStyledComponentFactories<Theme>;\n\nexport type Styled = StyledFunction & StyledObject;\n"],
5
+ "mappings": "AAAA;ACkBA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import { capitalize } from "@elliemae/ds-utilities";
3
+ import { theme as defaultTheme } from "../theme";
4
+ const systemTheme = defaultTheme;
5
+ const isEmpty = (string) => string.length === 0;
6
+ const coerceWithDefaultTheme = (themeInput) => themeInput ?? systemTheme;
7
+ const propsToClassKey = (props) => Object.keys(props).sort().reduce((classKey, key) => {
8
+ if (key === "color") {
9
+ return classKey + isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key]));
10
+ }
11
+ return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
12
+ }, "");
13
+ export {
14
+ coerceWithDefaultTheme,
15
+ isEmpty,
16
+ propsToClassKey
17
+ };
18
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/styled/utils.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { capitalize } from '@elliemae/ds-utilities';\nimport type { Theme } from './types';\nimport { theme as defaultTheme } from '../theme';\n\nconst systemTheme = defaultTheme;\n\nexport const isEmpty = (string: string): boolean => string.length === 0;\n\nexport const coerceWithDefaultTheme = (themeInput: Theme): Theme => themeInput ?? systemTheme;\n\nexport const propsToClassKey = (props: Record<string, { toString: () => string }>): string =>\n Object.keys(props)\n .sort()\n .reduce((classKey, key) => {\n if (key === 'color') {\n return classKey + isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key]));\n }\n return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;\n }, '');\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AAEA,MAAM,cAAc;AAEb,MAAM,UAAU,CAAC,WAA4B,OAAO,WAAW;AAE/D,MAAM,yBAAyB,CAAC,eAA6B,cAAc;AAE3E,MAAM,kBAAkB,CAAC,UAC9B,OAAO,KAAK,OACT,OACA,OAAO,CAAC,UAAU,QAAQ;AACzB,MAAI,QAAQ,SAAS;AACnB,WAAO,WAAW,QAAQ,OAAO,aAAa,OAAO,MAAM,QAAQ,WAAW,OAAO,MAAM;AAAA;AAE7F,SAAO,GAAG,WAAW,QAAQ,OAAO,aAAa,MAAM,WAAW,OAAO,WAAW,MAAM,KAAK;AAAA,GAC9F;",
6
+ "names": []
7
+ }
package/dist/esm/th.js ADDED
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ const th = (property) => {
3
+ const thGetter = (value, dfault = "") => {
4
+ const func = ({ theme }) => {
5
+ const parts = value.split("-");
6
+ let result = theme[property];
7
+ parts.forEach((part) => {
8
+ if (result)
9
+ result = result[part];
10
+ });
11
+ return result ?? dfault;
12
+ };
13
+ return func;
14
+ };
15
+ return thGetter;
16
+ };
17
+ th.space = th("space");
18
+ th.fontSize = th("fontSizes");
19
+ th.fontWeight = th("fontWeights");
20
+ th.lineHeight = th("lineHeights");
21
+ th.letterSpacing = th("letterSpacings");
22
+ th.font = th("fonts");
23
+ th.color = th("colors");
24
+ th.breakpoint = th("breakpoints");
25
+ th.media = th("media");
26
+ export {
27
+ th
28
+ };
29
+ //# sourceMappingURL=th.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/th.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { Theme } from '@elliemae/pui-theme';\ntype ThGetter = (value: string, dfault?: string) => ({ theme }: { theme: Theme }) => string;\ntype ThConstructor = ((property: keyof Theme) => ThGetter) & {\n space: ThGetter;\n fontSize: ThGetter;\n fontWeight: ThGetter;\n lineHeight: ThGetter;\n letterSpacing: ThGetter;\n font: ThGetter;\n color: ThGetter;\n breakpoint: ThGetter;\n media: ThGetter;\n};\n\nexport const th: ThConstructor = (property): ThGetter => {\n const thGetter: ThGetter = (value, dfault = '') => {\n const func: ReturnType<ThGetter> = ({ theme }) => {\n const parts = value.split('-');\n let result = theme[property];\n parts.forEach((part) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n if (result) result = result[part as keyof typeof result];\n });\n return (result as unknown as string) ?? dfault;\n };\n return func;\n };\n return thGetter;\n};\nth.space = th('space');\nth.fontSize = th('fontSizes');\nth.fontWeight = th('fontWeights');\nth.lineHeight = th('lineHeights');\nth.letterSpacing = th('letterSpacings');\nth.font = th('fonts');\nth.color = th('colors');\nth.breakpoint = th('breakpoints');\nth.media = th('media');\n"],
5
+ "mappings": "AAAA;ACcO,MAAM,KAAoB,CAAC,aAAuB;AACvD,QAAM,WAAqB,CAAC,OAAO,SAAS,OAAO;AACjD,UAAM,OAA6B,CAAC,EAAE,YAAY;AAChD,YAAM,QAAQ,MAAM,MAAM;AAC1B,UAAI,SAAS,MAAM;AACnB,YAAM,QAAQ,CAAC,SAAS;AAEtB,YAAI;AAAQ,mBAAS,OAAO;AAAA;AAE9B,aAAQ,UAAgC;AAAA;AAE1C,WAAO;AAAA;AAET,SAAO;AAAA;AAET,GAAG,QAAQ,GAAG;AACd,GAAG,WAAW,GAAG;AACjB,GAAG,aAAa,GAAG;AACnB,GAAG,aAAa,GAAG;AACnB,GAAG,gBAAgB,GAAG;AACtB,GAAG,OAAO,GAAG;AACb,GAAG,QAAQ,GAAG;AACd,GAAG,aAAa,GAAG;AACnB,GAAG,QAAQ,GAAG;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { getDefaultTheme } from "@elliemae/pui-theme";
3
+ const theme = getDefaultTheme();
4
+ export {
5
+ theme
6
+ };
7
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/theme.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { getDefaultTheme } from '@elliemae/pui-theme';\nimport type { Theme } from '@elliemae/pui-theme';\n\nexport const theme = getDefaultTheme() as Theme;\n"],
5
+ "mappings": "AAAA;ACAA;AAGO,MAAM,QAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import * as React from "react";
18
+ import React2 from "react";
19
+ import { ThemeProvider } from "styled-components";
20
+ import { theme } from "./theme";
21
+ const themeProviderHOC = (Component) => (props) => /* @__PURE__ */ React2.createElement(ThemeProvider, {
22
+ theme
23
+ }, /* @__PURE__ */ React2.createElement(Component, __spreadValues({}, props)));
24
+ export {
25
+ themeProviderHOC
26
+ };
27
+ //# sourceMappingURL=themeProviderHOC.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/themeProviderHOC.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { ThemeProvider } from 'styled-components';\nimport { theme } from './theme';\n\nexport const themeProviderHOC = (Component: React.ElementType) => (\n props: Record<string, unknown>,\n): JSX.Element => (\n <ThemeProvider theme={theme}>\n <Component {...props} />\n </ThemeProvider>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAEO,MAAM,mBAAmB,CAAC,cAAiC,CAChE,UAEA,qCAAC,eAAD;AAAA,EAAe;AAAA,GACb,qCAAC,WAAD,mBAAe;",
6
+ "names": []
7
+ }