@elliemae/ds-system 3.0.0-next.7 → 3.0.0-next.72

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 (95) hide show
  1. package/dist/cjs/arithmetic.js +20 -22
  2. package/dist/cjs/arithmetic.js.map +2 -2
  3. package/dist/cjs/constants.js +9 -16
  4. package/dist/cjs/constants.js.map +1 -1
  5. package/dist/cjs/ds-styled/index.js +37 -0
  6. package/dist/cjs/ds-styled/index.js.map +7 -0
  7. package/dist/cjs/ds-styled/styled.js +103 -0
  8. package/dist/cjs/ds-styled/styled.js.map +7 -0
  9. package/dist/cjs/ds-styled/types.js +20 -0
  10. package/dist/cjs/ds-styled/types.js.map +7 -0
  11. package/dist/cjs/ds-styled/utilities/background.js +41 -0
  12. package/dist/cjs/ds-styled/utilities/background.js.map +7 -0
  13. package/dist/cjs/ds-styled/utilities/border.js +174 -0
  14. package/dist/cjs/ds-styled/utilities/border.js.map +7 -0
  15. package/dist/cjs/ds-styled/utilities/helpers.js +66 -0
  16. package/dist/cjs/ds-styled/utilities/helpers.js.map +7 -0
  17. package/dist/cjs/ds-styled/utilities/index.js +27 -0
  18. package/dist/cjs/ds-styled/utilities/index.js.map +7 -0
  19. package/dist/cjs/ds-styled/utilities/magicCssTransform.js +58 -0
  20. package/dist/cjs/ds-styled/utilities/magicCssTransform.js.map +7 -0
  21. package/dist/cjs/ds-styled/utilities/resolvers.js +49 -0
  22. package/dist/cjs/ds-styled/utilities/resolvers.js.map +7 -0
  23. package/dist/cjs/ds-styled/utilities/sizing.js +59 -0
  24. package/dist/cjs/ds-styled/utilities/sizing.js.map +7 -0
  25. package/dist/cjs/globalStyles.js +11 -18
  26. package/dist/cjs/globalStyles.js.map +2 -2
  27. package/dist/cjs/index.js +18 -24
  28. package/dist/cjs/index.js.map +2 -2
  29. package/dist/cjs/mobileUtilities.js +17 -26
  30. package/dist/cjs/mobileUtilities.js.map +2 -2
  31. package/dist/cjs/spaceUtilities.js +9 -16
  32. package/dist/cjs/spaceUtilities.js.map +1 -1
  33. package/dist/cjs/th.js +48 -29
  34. package/dist/cjs/th.js.map +2 -2
  35. package/dist/cjs/theme.js +9 -16
  36. package/dist/cjs/theme.js.map +1 -1
  37. package/dist/cjs/themeProviderHOC.js +16 -20
  38. package/dist/cjs/themeProviderHOC.js.map +2 -2
  39. package/dist/cjs/utils.js +29 -37
  40. package/dist/cjs/utils.js.map +2 -2
  41. package/dist/esm/arithmetic.js +11 -6
  42. package/dist/esm/arithmetic.js.map +2 -2
  43. package/dist/esm/constants.js.map +1 -1
  44. package/dist/esm/ds-styled/index.js +14 -0
  45. package/dist/esm/ds-styled/index.js.map +7 -0
  46. package/dist/esm/{styled/index.js → ds-styled/styled.js} +35 -23
  47. package/dist/esm/ds-styled/styled.js.map +7 -0
  48. package/dist/esm/ds-styled/types.js +2 -0
  49. package/dist/esm/{styled/index.d.js.map → ds-styled/types.js.map} +0 -0
  50. package/dist/esm/ds-styled/utilities/background.js +19 -0
  51. package/dist/esm/ds-styled/utilities/background.js.map +7 -0
  52. package/dist/esm/ds-styled/utilities/border.js +152 -0
  53. package/dist/esm/ds-styled/utilities/border.js.map +7 -0
  54. package/dist/esm/ds-styled/utilities/helpers.js +46 -0
  55. package/dist/esm/ds-styled/utilities/helpers.js.map +7 -0
  56. package/dist/esm/ds-styled/utilities/index.js +8 -0
  57. package/dist/esm/ds-styled/utilities/index.js.map +7 -0
  58. package/dist/esm/ds-styled/utilities/magicCssTransform.js +36 -0
  59. package/dist/esm/ds-styled/utilities/magicCssTransform.js.map +7 -0
  60. package/dist/esm/{styled/styleGetters.js → ds-styled/utilities/resolvers.js} +2 -2
  61. package/dist/esm/ds-styled/utilities/resolvers.js.map +7 -0
  62. package/dist/esm/ds-styled/utilities/sizing.js +37 -0
  63. package/dist/esm/ds-styled/utilities/sizing.js.map +7 -0
  64. package/dist/esm/globalStyles.js +1 -1
  65. package/dist/esm/globalStyles.js.map +1 -1
  66. package/dist/esm/index.js +1 -1
  67. package/dist/esm/index.js.map +1 -1
  68. package/dist/esm/mobileUtilities.js +8 -10
  69. package/dist/esm/mobileUtilities.js.map +2 -2
  70. package/dist/esm/spaceUtilities.js.map +1 -1
  71. package/dist/esm/th.js +39 -13
  72. package/dist/esm/th.js.map +2 -2
  73. package/dist/esm/theme.js.map +1 -1
  74. package/dist/esm/themeProviderHOC.js +7 -4
  75. package/dist/esm/themeProviderHOC.js.map +2 -2
  76. package/dist/esm/utils.js +5 -6
  77. package/dist/esm/utils.js.map +2 -2
  78. package/package.json +13 -13
  79. package/dist/cjs/styled/index.d.js +0 -27
  80. package/dist/cjs/styled/index.d.js.map +0 -7
  81. package/dist/cjs/styled/index.js +0 -105
  82. package/dist/cjs/styled/index.js.map +0 -7
  83. package/dist/cjs/styled/styleGetters.js +0 -56
  84. package/dist/cjs/styled/styleGetters.js.map +0 -7
  85. package/dist/cjs/styled/types.js +0 -35
  86. package/dist/cjs/styled/types.js.map +0 -7
  87. package/dist/cjs/styled/utils.js +0 -47
  88. package/dist/cjs/styled/utils.js.map +0 -7
  89. package/dist/esm/styled/index.d.js +0 -2
  90. package/dist/esm/styled/index.js.map +0 -7
  91. package/dist/esm/styled/styleGetters.js.map +0 -7
  92. package/dist/esm/styled/types.js +0 -6
  93. package/dist/esm/styled/types.js.map +0 -7
  94. package/dist/esm/styled/utils.js +0 -18
  95. package/dist/esm/styled/utils.js.map +0 -7
@@ -18,16 +18,28 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
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";
21
+ import { createCss } from "@xstyled/styled-components";
22
+ import { system, compose } from "@xstyled/system";
23
+ import {
24
+ coerceWithDefaultTheme,
25
+ getStyleOverrides,
26
+ magicCssTransform,
27
+ getVariantStyles,
28
+ stylesArgThemeCoercion,
29
+ variantsResolver
30
+ } from "./utilities";
31
+ const { css, styled: baseStyledComponent, createGlobalStyle } = createCss(compose(system));
24
32
  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;
33
+ const { name: componentName, slot: componentSlot } = options;
34
+ const defaultStyledResolver = baseStyledComponent(tag);
35
+ const attributes = {
36
+ attrs: defaultStyledResolver.attrs,
37
+ withConfig: defaultStyledResolver.withConfig
38
+ };
39
+ const dimsumStyledResolver = (styleArg, ...expressions) => {
40
+ const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressions);
41
+ const expressionsWithDefaultTheme = expressionsWithMagic ? expressionsWithMagic.map(stylesArgThemeCoercion) : [];
42
+ let transformedStyleArg = styleArgWithMagic;
31
43
  if (componentName && componentSlot) {
32
44
  expressionsWithDefaultTheme.push((props) => {
33
45
  const theme = coerceWithDefaultTheme(props.theme);
@@ -44,35 +56,35 @@ const styledFunction = (tag, options = { name: null, slot: null }) => {
44
56
  return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
45
57
  });
46
58
  }
47
- const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
48
- if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
59
+ const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressionsWithMagic.length;
60
+ if (Array.isArray(styleArgWithMagic) && numOfCustomFnsApplied > 0) {
49
61
  const placeholders = new Array(numOfCustomFnsApplied).fill("");
50
- transformedStyleArg = Object.assign([...styleArg, ...placeholders], {
51
- raw: [...styleArg.raw, ...placeholders]
62
+ transformedStyleArg = Object.assign([...styleArgWithMagic, ...placeholders], {
63
+ raw: [...styleArgWithMagic.raw, ...placeholders]
52
64
  });
53
- } else if (typeof styleArg === "function") {
54
- transformedStyleArg = (props) => styleArg(__spreadProps(__spreadValues({}, props), { theme: coerceWithDefaultTheme(props.theme) }));
65
+ } else if (typeof styleArgWithMagic === "function") {
66
+ transformedStyleArg = (props) => styleArgWithMagic(__spreadProps(__spreadValues({}, props), { theme: coerceWithDefaultTheme(props.theme) }));
55
67
  }
56
- let Component = styled_component(tag);
57
68
  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);
69
+ const classNameObject = displayName !== null ? { className: displayName } : {};
70
+ const defaultStyledResolverWithClassName = defaultStyledResolver.attrs(classNameObject);
71
+ const Component = defaultStyledResolverWithClassName(transformedStyleArg, ...expressionsWithDefaultTheme);
62
72
  if (displayName !== null) {
63
73
  Component.displayName = displayName;
64
74
  }
65
75
  return Component;
66
76
  };
67
- return func;
77
+ return Object.assign(dimsumStyledResolver, attributes);
68
78
  };
69
- const styledObject = Object.keys(styled_component).reduce((obj, key) => {
79
+ const styledObject = Object.keys(baseStyledComponent).reduce((obj, key) => {
70
80
  const castedKey = key;
71
81
  obj[castedKey] = styledFunction(castedKey);
72
82
  return obj;
73
83
  }, {});
74
84
  const styled = Object.assign(styledFunction, styledObject);
75
85
  export {
86
+ createGlobalStyle,
87
+ css,
76
88
  styled
77
89
  };
78
- //# sourceMappingURL=index.js.map
90
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/ds-styled/styled.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/unbound-method */\n/* eslint-disable complexity */\nimport { createCss } from '@xstyled/styled-components';\nimport { system, compose } from '@xstyled/system';\nimport { StyledComponentInnerComponent, StyledComponentPropsWithRef } from 'styled-components';\nimport { DSStyledFunction, DSStyledFunctionInternal, DSStyledObject, PropsWithTheme } from './types';\nimport {\n coerceWithDefaultTheme,\n getStyleOverrides,\n magicCssTransform,\n getVariantStyles,\n stylesArgThemeCoercion,\n variantsResolver,\n} from './utilities';\n\nconst { css, styled: baseStyledComponent, createGlobalStyle } = createCss(compose(system));\n\n// @ts-ignore\nconst styledFunction: DSStyledFunction = (tag, options = { name: null, slot: null }) => {\n const { name: componentName, slot: componentSlot } = options;\n\n const defaultStyledResolver = baseStyledComponent(tag);\n\n const attributes = {\n attrs: defaultStyledResolver.attrs,\n withConfig: defaultStyledResolver.withConfig,\n };\n\n // @ts-ignore\n const dimsumStyledResolver: DSStyledFunctionInternal = (styleArg, ...expressions) => {\n /**\n * Here we apply a CSS transformation to support MAGIC styled components\n */\n\n const [styleArgWithMagic, expressionsWithMagic] = magicCssTransform(styleArg, expressions);\n\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 = expressionsWithMagic ? expressionsWithMagic.map(stylesArgThemeCoercion) : [];\n\n let transformedStyleArg = styleArgWithMagic;\n\n /*\n * Here we get the style overrides from the user\n */\n if (componentName && componentSlot) {\n expressionsWithDefaultTheme.push((props: PropsWithTheme) => {\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: PropsWithTheme) => {\n const theme = coerceWithDefaultTheme(props.theme);\n return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);\n });\n }\n\n const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressionsWithMagic.length;\n\n if (Array.isArray(styleArgWithMagic) && numOfCustomFnsApplied > 0) {\n // Here we are adding placeholders for all the new functions that we are gonna call\n const placeholders = new Array(numOfCustomFnsApplied).fill('') as string[];\n transformedStyleArg = Object.assign([...styleArgWithMagic, ...placeholders], {\n raw: [...(styleArgWithMagic as TemplateStringsArray).raw, ...placeholders],\n });\n } else if (typeof styleArgWithMagic === 'function') {\n // Here we just coerce with the default theme\n transformedStyleArg = (props: PropsWithTheme) =>\n styleArgWithMagic({ ...props, theme: coerceWithDefaultTheme(props.theme) });\n }\n\n const displayName = componentName !== null && componentSlot !== null ? `${componentName}-${componentSlot}` : null;\n\n const classNameObject = displayName !== null ? { className: displayName } : {};\n\n const defaultStyledResolverWithClassName = defaultStyledResolver.attrs(\n classNameObject as unknown as Partial<StyledComponentPropsWithRef<StyledComponentInnerComponent<any>>>,\n );\n\n const Component = defaultStyledResolverWithClassName(transformedStyleArg, ...expressionsWithDefaultTheme);\n\n if (displayName !== null) {\n Component.displayName = displayName;\n }\n\n return Component;\n };\n\n return Object.assign(dimsumStyledResolver, attributes);\n};\n\n// Here we create an object with the IntrinsicElements keys pointing to the styledFunction\nconst styledObject = Object.keys(baseStyledComponent).reduce((obj, key) => {\n const castedKey = key as keyof JSX.IntrinsicElements;\n obj[castedKey] = styledFunction(castedKey);\n return obj;\n}, {} as DSStyledObject);\n\nexport const styled = Object.assign(styledFunction, styledObject);\nexport { css, createGlobalStyle };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACMA;AACA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,EAAE,KAAK,QAAQ,qBAAqB,sBAAsB,UAAU,QAAQ,MAAM,CAAC;AAGzF,MAAM,iBAAmC,CAAC,KAAK,UAAU,EAAE,MAA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MAAM,KAAK,EAAE,EAAC;AAAA,IAC9E;AAEA,UAAM,cAAc,kBAAkB,QAAQ,kBAAkB,OAAO,GAAG,iBAAiB,kBAAkB;AAE7G,UAAM,kBAAkB,gBAAgB,OAAO,EAAE,WAAW,YAAY,IAAI,CAAC;AAE7E,UAAM,qCAAqC,sBAAsB,MAC/D,eACF;AAEA,UAAM,YAAY,mCAAmC,qBAAqB,GAAG,2BAA2B;AAExG,QAAI,gBAAgB,MAAM;AACxB,gBAAU,cAAc;AAAA,IAC1B;AAEA,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,OAAO,sBAAsB,UAAU;AACvD;AAGA,MAAM,eAAe,OAAO,KAAK,mBAAmB,EAAE,OAAO,CAAC,KAAK,QAAQ;AACzE,QAAM,YAAY;AAClB,MAAI,aAAa,eAAe,SAAS;AACzC,SAAO;AACT,GAAG,CAAC,CAAmB;AAEhB,MAAM,SAAS,OAAO,OAAO,gBAAgB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { style, compose } from "@xstyled/system";
3
+ import { th } from "../../th";
4
+ function bgColorGetter(value) {
5
+ return function(props) {
6
+ return `${th.color(value, value)(props)}`;
7
+ };
8
+ }
9
+ bgColorGetter.meta = {};
10
+ const bg = style({
11
+ prop: ["backgroundColor", "bg"],
12
+ css: "background-color",
13
+ themeGet: bgColorGetter
14
+ });
15
+ const background = compose(bg);
16
+ export {
17
+ background
18
+ };
19
+ //# sourceMappingURL=background.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/background.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { style, compose } from '@xstyled/system';\nimport { th } from '../../th';\nimport type { GetterProps, ThProps } from '../types';\n\nfunction bgColorGetter(value: string) {\n return function (props: GetterProps): string {\n return `${th.color(value, value)(props as ThProps)}`;\n };\n}\n\nbgColorGetter.meta = {};\n\nconst bg = style({\n prop: ['backgroundColor', 'bg'],\n css: 'background-color',\n themeGet: bgColorGetter,\n});\n\nexport const background = compose(bg);\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAGA,uBAAuB,OAAe;AACpC,SAAO,SAAU,OAA4B;AAC3C,WAAO,GAAG,GAAG,MAAM,OAAO,KAAK,EAAE,KAAgB;AAAA,EACnD;AACF;AAEA,cAAc,OAAO,CAAC;AAEtB,MAAM,KAAK,MAAM;AAAA,EACf,MAAM,CAAC,mBAAmB,IAAI;AAAA,EAC9B,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAEM,MAAM,aAAa,QAAQ,EAAE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,152 @@
1
+ import * as React from "react";
2
+ import { style, compose } from "@xstyled/system";
3
+ import { th } from "../../th";
4
+ const colorReg = /(?:neutral|brand|success|danger|warning)-[0-9]{3}(?:-a[0-9]{2})?/;
5
+ function borderGetter(value) {
6
+ return function(props) {
7
+ const color = value.match(colorReg);
8
+ let borderCss = ``;
9
+ if (color) {
10
+ const widthAndStyle = value.replace(color[0], "").trim();
11
+ borderCss = `${th.color(color[0])(props)} ${widthAndStyle}`;
12
+ } else {
13
+ borderCss = value;
14
+ }
15
+ return borderCss;
16
+ };
17
+ }
18
+ borderGetter.meta = {};
19
+ function borderColorGetter(value) {
20
+ return function(props) {
21
+ return `${th.color(value, value)(props)}`;
22
+ };
23
+ }
24
+ borderColorGetter.meta = {};
25
+ function borderStyleGetter(value) {
26
+ return function(props) {
27
+ return value;
28
+ };
29
+ }
30
+ borderStyleGetter.meta = {};
31
+ function borderWidthGetter(value) {
32
+ return function(props) {
33
+ return `${th.space(value, value)(props)}`;
34
+ };
35
+ }
36
+ borderWidthGetter.meta = {};
37
+ function borderRadiusGetter(value) {
38
+ return function(props) {
39
+ return `${th.space(value, value)(props)}`;
40
+ };
41
+ }
42
+ borderRadiusGetter.meta = {};
43
+ const border = style({
44
+ prop: "border",
45
+ css: "border",
46
+ themeGet: borderGetter
47
+ });
48
+ const borderTop = style({
49
+ prop: "borderTop",
50
+ css: "border-top",
51
+ themeGet: borderGetter
52
+ });
53
+ const borderBottom = style({
54
+ prop: "borderBottom",
55
+ css: "border-bottom",
56
+ themeGet: borderGetter
57
+ });
58
+ const borderRight = style({
59
+ prop: "borderRight",
60
+ css: "border-right",
61
+ themeGet: borderGetter
62
+ });
63
+ const borderLeft = style({
64
+ prop: "borderLeft",
65
+ css: "border-left",
66
+ themeGet: borderGetter
67
+ });
68
+ const borderColor = style({
69
+ prop: "borderColor",
70
+ css: "border-color",
71
+ themeGet: borderColorGetter
72
+ });
73
+ const borderTopColor = style({
74
+ prop: "borderTopColor",
75
+ css: "border-top-color",
76
+ themeGet: borderColorGetter
77
+ });
78
+ const borderBottomColor = style({
79
+ prop: "borderBottomColor",
80
+ css: "border-bottom-color",
81
+ themeGet: borderColorGetter
82
+ });
83
+ const borderRightColor = style({
84
+ prop: "borderRightColor",
85
+ css: "border-right-color",
86
+ themeGet: borderColorGetter
87
+ });
88
+ const borderLeftColor = style({
89
+ prop: "borderLeftColor",
90
+ css: "border-left-color",
91
+ themeGet: borderColorGetter
92
+ });
93
+ const borderStyle = style({
94
+ prop: "borderStyle",
95
+ css: "border-style",
96
+ themeGet: borderStyleGetter
97
+ });
98
+ const borderTopStyle = style({
99
+ prop: "borderTopStyle",
100
+ css: "border-top-style",
101
+ themeGet: borderStyleGetter
102
+ });
103
+ const borderBottomStyle = style({
104
+ prop: "borderBottomStyle",
105
+ css: "border-bottom-style",
106
+ themeGet: borderStyleGetter
107
+ });
108
+ const borderRightStyle = style({
109
+ prop: "borderRightStyle",
110
+ css: "border-right-style",
111
+ themeGet: borderStyleGetter
112
+ });
113
+ const borderLeftStyle = style({
114
+ prop: "borderLeftStyle",
115
+ css: "border-left-style",
116
+ themeGet: borderStyleGetter
117
+ });
118
+ const borderWidth = style({
119
+ prop: "borderWidth",
120
+ css: "border-width",
121
+ themeGet: borderWidthGetter
122
+ });
123
+ const borderTopWidth = style({
124
+ prop: "borderTopWidth",
125
+ css: "border-top-width",
126
+ themeGet: borderWidthGetter
127
+ });
128
+ const borderBottomWidth = style({
129
+ prop: "borderBottomWidth",
130
+ css: "border-bottom-width",
131
+ themeGet: borderWidthGetter
132
+ });
133
+ const borderRightWidth = style({
134
+ prop: "borderRightWidth",
135
+ css: "border-right-width",
136
+ themeGet: borderWidthGetter
137
+ });
138
+ const borderLeftWidth = style({
139
+ prop: "borderLeftWidth",
140
+ css: "border-left-width",
141
+ themeGet: borderWidthGetter
142
+ });
143
+ const borderRadius = style({
144
+ prop: "borderRadius",
145
+ css: "border-radius",
146
+ themeGet: borderRadiusGetter
147
+ });
148
+ const borders = compose(border, borderTop, borderBottom, borderLeft, borderRight, borderColor, borderTopColor, borderBottomColor, borderLeftColor, borderRightColor, borderStyle, borderTopStyle, borderBottomStyle, borderLeftStyle, borderRightStyle, borderWidth, borderTopWidth, borderBottomWidth, borderLeftWidth, borderRightWidth, borderRadius);
149
+ export {
150
+ borders
151
+ };
152
+ //# sourceMappingURL=border.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/border.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { style, compose } from '@xstyled/system';\nimport { th } from '../../th';\nimport type { GetterProps, ThProps } from '../types';\n\nconst colorReg = /(?:neutral|brand|success|danger|warning)-[0-9]{3}(?:-a[0-9]{2})?/;\n\nfunction borderGetter(value: string) {\n return function (props: GetterProps): string {\n const color = value.match(colorReg);\n let borderCss = ``;\n\n if (color) {\n const widthAndStyle = value.replace(color[0], '').trim();\n borderCss = `${th.color(color[0])(props as ThProps)} ${widthAndStyle}`;\n } else {\n borderCss = value;\n }\n\n return borderCss;\n };\n}\n\nborderGetter.meta = {};\n\nfunction borderColorGetter(value: string) {\n return function (props: GetterProps): string {\n return `${th.color(value, value)(props as ThProps)}`;\n };\n}\n\nborderColorGetter.meta = {};\n\nfunction borderStyleGetter(value: string) {\n return function (props: GetterProps): string {\n return value;\n };\n}\n\nborderStyleGetter.meta = {};\n\nfunction borderWidthGetter(value: string) {\n return function (props: GetterProps): string {\n return `${th.space(value, value)(props as ThProps)}`;\n };\n}\n\nborderWidthGetter.meta = {};\n\nfunction borderRadiusGetter(value: string) {\n return function (props: GetterProps): string {\n return `${th.space(value, value)(props as ThProps)}`;\n };\n}\n\nborderRadiusGetter.meta = {};\n\nconst border = style({\n prop: 'border',\n css: 'border',\n themeGet: borderGetter,\n});\n\nconst borderTop = style({\n prop: 'borderTop',\n css: 'border-top',\n themeGet: borderGetter,\n});\n\nconst borderBottom = style({\n prop: 'borderBottom',\n css: 'border-bottom',\n themeGet: borderGetter,\n});\n\nconst borderRight = style({\n prop: 'borderRight',\n css: 'border-right',\n themeGet: borderGetter,\n});\n\nconst borderLeft = style({\n prop: 'borderLeft',\n css: 'border-left',\n themeGet: borderGetter,\n});\n\nconst borderColor = style({\n prop: 'borderColor',\n css: 'border-color',\n themeGet: borderColorGetter,\n});\n\nconst borderTopColor = style({\n prop: 'borderTopColor',\n css: 'border-top-color',\n themeGet: borderColorGetter,\n});\n\nconst borderBottomColor = style({\n prop: 'borderBottomColor',\n css: 'border-bottom-color',\n themeGet: borderColorGetter,\n});\n\nconst borderRightColor = style({\n prop: 'borderRightColor',\n css: 'border-right-color',\n themeGet: borderColorGetter,\n});\n\nconst borderLeftColor = style({\n prop: 'borderLeftColor',\n css: 'border-left-color',\n themeGet: borderColorGetter,\n});\n\nconst borderStyle = style({\n prop: 'borderStyle',\n css: 'border-style',\n themeGet: borderStyleGetter,\n});\n\nconst borderTopStyle = style({\n prop: 'borderTopStyle',\n css: 'border-top-style',\n themeGet: borderStyleGetter,\n});\n\nconst borderBottomStyle = style({\n prop: 'borderBottomStyle',\n css: 'border-bottom-style',\n themeGet: borderStyleGetter,\n});\n\nconst borderRightStyle = style({\n prop: 'borderRightStyle',\n css: 'border-right-style',\n themeGet: borderStyleGetter,\n});\n\nconst borderLeftStyle = style({\n prop: 'borderLeftStyle',\n css: 'border-left-style',\n themeGet: borderStyleGetter,\n});\n\nconst borderWidth = style({\n prop: 'borderWidth',\n css: 'border-width',\n themeGet: borderWidthGetter,\n});\n\nconst borderTopWidth = style({\n prop: 'borderTopWidth',\n css: 'border-top-width',\n themeGet: borderWidthGetter,\n});\n\nconst borderBottomWidth = style({\n prop: 'borderBottomWidth',\n css: 'border-bottom-width',\n themeGet: borderWidthGetter,\n});\n\nconst borderRightWidth = style({\n prop: 'borderRightWidth',\n css: 'border-right-width',\n themeGet: borderWidthGetter,\n});\n\nconst borderLeftWidth = style({\n prop: 'borderLeftWidth',\n css: 'border-left-width',\n themeGet: borderWidthGetter,\n});\n\nconst borderRadius = style({\n prop: 'borderRadius',\n css: 'border-radius',\n themeGet: borderRadiusGetter,\n});\n\nexport const borders = compose(\n border,\n borderTop,\n borderBottom,\n borderLeft,\n borderRight,\n borderColor,\n borderTopColor,\n borderBottomColor,\n borderLeftColor,\n borderRightColor,\n borderStyle,\n borderTopStyle,\n borderBottomStyle,\n borderLeftStyle,\n borderRightStyle,\n borderWidth,\n borderTopWidth,\n borderBottomWidth,\n borderLeftWidth,\n borderRightWidth,\n borderRadius,\n);\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAGA,MAAM,WAAW;AAEjB,sBAAsB,OAAe;AACnC,SAAO,SAAU,OAA4B;AAC3C,UAAM,QAAQ,MAAM,MAAM,QAAQ;AAClC,QAAI,YAAY;AAEhB,QAAI,OAAO;AACT,YAAM,gBAAgB,MAAM,QAAQ,MAAM,IAAI,EAAE,EAAE,KAAK;AACvD,kBAAY,GAAG,GAAG,MAAM,MAAM,EAAE,EAAE,KAAgB,KAAK;AAAA,IACzD,OAAO;AACL,kBAAY;AAAA,IACd;AAEA,WAAO;AAAA,EACT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,WACA,cACA,YACA,aACA,aACA,gBACA,mBACA,iBACA,kBACA,aACA,gBACA,mBACA,iBACA,kBACA,aACA,gBACA,mBACA,iBACA,kBACA,YACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,46 @@
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 { capitalize } from "@elliemae/ds-utilities";
22
+ import { theme as defaultTheme } from "../../theme";
23
+ const systemTheme = defaultTheme;
24
+ const isEmpty = (string) => string.length === 0;
25
+ const coerceWithDefaultTheme = (themeInput) => themeInput ?? systemTheme;
26
+ const stylesArgThemeCoercion = (stylesArg) => {
27
+ if (typeof stylesArg === "function") {
28
+ return (props) => stylesArg(__spreadProps(__spreadValues({}, props), {
29
+ theme: coerceWithDefaultTheme(props.theme)
30
+ }));
31
+ }
32
+ return stylesArg;
33
+ };
34
+ const propsToClassKey = (props) => Object.keys(props).sort().reduce((classKey, key) => {
35
+ if (key === "color") {
36
+ return classKey + (isEmpty(String(classKey)) ? String(props[key]) : capitalize(String(props[key])));
37
+ }
38
+ return `${classKey}${isEmpty(String(classKey)) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
39
+ }, "");
40
+ export {
41
+ coerceWithDefaultTheme,
42
+ isEmpty,
43
+ propsToClassKey,
44
+ stylesArgThemeCoercion
45
+ };
46
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/helpers.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Interpolation } from 'styled-components';\nimport { capitalize } from '@elliemae/ds-utilities';\nimport type { PropsWithTheme, 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 | undefined): Theme => themeInput ?? systemTheme;\n\nexport const stylesArgThemeCoercion = (stylesArg: Interpolation<any>): Interpolation<any> => {\n if (typeof stylesArg === 'function') {\n return (props: PropsWithTheme) =>\n stylesArg({\n ...props,\n theme: coerceWithDefaultTheme(props.theme),\n });\n }\n return stylesArg;\n};\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;ACEA;AAEA;AAEA,MAAM,cAAc;AAEb,MAAM,UAAU,CAAC,WAA4B,OAAO,WAAW;AAE/D,MAAM,yBAAyB,CAAC,eAAyC,cAAc;AAEvF,MAAM,yBAAyB,CAAC,cAAsD;AAC3F,MAAI,OAAO,cAAc,YAAY;AACnC,WAAO,CAAC,UACN,UAAU,iCACL,QADK;AAAA,MAER,OAAO,uBAAuB,MAAM,KAAK;AAAA,IAC3C,EAAC;AAAA,EACL;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,UAC9B,OAAO,KAAK,KAAK,EACd,KAAK,EACL,OAAO,CAAC,UAAU,QAAQ;AACzB,MAAI,QAAQ,SAAS;AACnB,WAAO,WAAY,SAAQ,OAAO,QAAQ,CAAC,IAAI,OAAO,MAAM,IAAI,IAAI,WAAW,OAAO,MAAM,IAAI,CAAC;AAAA,EACnG;AACA,SAAO,GAAG,WAAW,QAAQ,OAAO,QAAQ,CAAC,IAAI,MAAM,WAAW,GAAG,IAAI,WAAW,MAAM,KAAK,SAAS,CAAC;AAC3G,GAAG,EAAE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export * from "./magicCssTransform";
3
+ export * from "./resolvers";
4
+ export * from "./helpers";
5
+ export * from "./sizing";
6
+ export * from "./border";
7
+ export * from "./background";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/index.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './magicCssTransform';\nexport * from './resolvers';\nexport * from './helpers';\nexport * from './sizing';\nexport * from './border';\nexport * from './background';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import { th } from "../../th";
3
+ const COLOR_REGEX = /(neutral|brand|success|warning|danger)-(100|200|300|400|500|600|700|800|900|000|050|080)/g;
4
+ const magicfyCss = (rawValue) => {
5
+ let matches;
6
+ let lastIndex = 0;
7
+ const splittedValue = [];
8
+ const themeGetters = [];
9
+ while (matches = COLOR_REGEX.exec(rawValue)) {
10
+ const [match] = matches;
11
+ splittedValue.push(rawValue.slice(lastIndex, matches.index));
12
+ themeGetters.push(th.color(match, match));
13
+ lastIndex = matches.index + match.length;
14
+ }
15
+ splittedValue.push(rawValue.slice(lastIndex, rawValue.length));
16
+ return [splittedValue, themeGetters];
17
+ };
18
+ const magicCssTransform = (styleArg, expressions) => {
19
+ if (!Array.isArray(styleArg))
20
+ return [styleArg, expressions];
21
+ const magicStyleArg = [];
22
+ const magicExpressions = [];
23
+ const templateStringArray = styleArg;
24
+ templateStringArray.forEach((templateString, index) => {
25
+ const [splittedTemplateString, themeGetters] = magicfyCss(templateString);
26
+ magicStyleArg.push(...splittedTemplateString);
27
+ magicExpressions.push(...themeGetters);
28
+ if (index < expressions.length)
29
+ magicExpressions.push(expressions[index]);
30
+ });
31
+ return [Object.assign(magicStyleArg, { raw: [...magicStyleArg] }), magicExpressions];
32
+ };
33
+ export {
34
+ magicCssTransform
35
+ };
36
+ //# sourceMappingURL=magicCssTransform.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/magicCssTransform.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-cond-assign */\nimport { CSSObject, Interpolation, InterpolationFunction } from 'styled-components';\nimport { th } from '../../th';\n\ntype StyleArg = CSSObject | InterpolationFunction<any> | TemplateStringsArray;\ntype Expressions = Interpolation<any>[];\ntype MagicCssTransform = (styleArg: StyleArg, expressions: Expressions) => [StyleArg, Expressions];\n\n// This file is heavily inspired by https://github.com/gregberge/xstyled/blob/c0c92b459bb3a5de46d7854be3667861f816baa5/packages/core/src/transform.ts#L65\n// Please refer to that file to understand of the idea of the css transformer\n\nconst COLOR_REGEX = /(neutral|brand|success|warning|danger)-(100|200|300|400|500|600|700|800|900|000|050|080)/g;\n\nconst magicfyCss = (rawValue: string): [string[], Interpolation<any>[]] => {\n let matches;\n let lastIndex = 0;\n const splittedValue: string[] = [];\n const themeGetters = [];\n while ((matches = COLOR_REGEX.exec(rawValue))) {\n const [match] = matches;\n splittedValue.push(rawValue.slice(lastIndex, matches.index));\n\n themeGetters.push(th.color(match, match));\n\n lastIndex = matches.index + match.length;\n }\n splittedValue.push(rawValue.slice(lastIndex, rawValue.length));\n return [splittedValue, themeGetters];\n};\n\nexport const magicCssTransform: MagicCssTransform = (styleArg, expressions) => {\n if (!Array.isArray(styleArg)) return [styleArg, expressions];\n\n const magicStyleArg: string[] = [];\n const magicExpressions: Expressions = [];\n\n const templateStringArray = styleArg as TemplateStringsArray;\n\n templateStringArray.forEach((templateString, index) => {\n const [splittedTemplateString, themeGetters] = magicfyCss(templateString);\n magicStyleArg.push(...splittedTemplateString);\n magicExpressions.push(...themeGetters);\n if (index < expressions.length) magicExpressions.push(expressions[index]);\n });\n\n return [Object.assign(magicStyleArg, { raw: [...magicStyleArg] }), magicExpressions];\n};\n"],
5
+ "mappings": "AAAA;ACIA;AASA,MAAM,cAAc;AAEpB,MAAM,aAAa,CAAC,aAAuD;AACzE,MAAI;AACJ,MAAI,YAAY;AAChB,QAAM,gBAA0B,CAAC;AACjC,QAAM,eAAe,CAAC;AACtB,SAAQ,UAAU,YAAY,KAAK,QAAQ,GAAI;AAC7C,UAAM,CAAC,SAAS;AAChB,kBAAc,KAAK,SAAS,MAAM,WAAW,QAAQ,KAAK,CAAC;AAE3D,iBAAa,KAAK,GAAG,MAAM,OAAO,KAAK,CAAC;AAExC,gBAAY,QAAQ,QAAQ,MAAM;AAAA,EACpC;AACA,gBAAc,KAAK,SAAS,MAAM,WAAW,SAAS,MAAM,CAAC;AAC7D,SAAO,CAAC,eAAe,YAAY;AACrC;AAEO,MAAM,oBAAuC,CAAC,UAAU,gBAAgB;AAC7E,MAAI,CAAC,MAAM,QAAQ,QAAQ;AAAG,WAAO,CAAC,UAAU,WAAW;AAE3D,QAAM,gBAA0B,CAAC;AACjC,QAAM,mBAAgC,CAAC;AAEvC,QAAM,sBAAsB;AAE5B,sBAAoB,QAAQ,CAAC,gBAAgB,UAAU;AACrD,UAAM,CAAC,wBAAwB,gBAAgB,WAAW,cAAc;AACxE,kBAAc,KAAK,GAAG,sBAAsB;AAC5C,qBAAiB,KAAK,GAAG,YAAY;AACrC,QAAI,QAAQ,YAAY;AAAQ,uBAAiB,KAAK,YAAY,MAAM;AAAA,EAC1E,CAAC;AAED,SAAO,CAAC,OAAO,OAAO,eAAe,EAAE,KAAK,CAAC,GAAG,aAAa,EAAE,CAAC,GAAG,gBAAgB;AACrF;",
6
+ "names": []
7
+ }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { propsToClassKey } from "./utils";
2
+ import { propsToClassKey } from "./helpers";
3
3
  const getStyleOverrides = (name, theme) => theme.components?.[name]?.styleOverrides || null;
4
4
  const getVariantStyles = (name, theme) => {
5
5
  const variants = theme.components?.[name]?.variants || [];
@@ -24,4 +24,4 @@ export {
24
24
  getVariantStyles,
25
25
  variantsResolver
26
26
  };
27
- //# sourceMappingURL=styleGetters.js.map
27
+ //# sourceMappingURL=resolvers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/resolvers.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport type { CSSObject } from 'styled-components';\nimport type { Theme } from '../types';\nimport { propsToClassKey } from './helpers';\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;ACGA;AAEO,MAAM,oBAAoB,CAAC,MAAc,UAC9C,MAAM,aAAa,OAAO,kBAAkB;AAEvC,MAAM,mBAAmB,CAAC,MAAc,UAA4C;AACzF,QAAM,WAAW,MAAM,aAAa,OAAO,YAAY,CAAC;AAExD,SAAO,SAAS,OAAO,CAAC,QAAQ,eAAe;AAC7C,UAAM,MAAM,gBAAgB,WAAW,KAAK;AAC5C,WAAO,OAAO,WAAW;AACzB,WAAO;AAAA,EACT,GAAG,CAAC,CAA8B;AACpC;AAEO,MAAM,mBAAmB,CAC9B,OACA,QACA,OACA,SACiC;AACjC,QAAM,gBAAgB,OAAO,aAAa,OAAO,YAAY,CAAC;AAE9D,SAAO,cAAc,OAAO,CAAC,gBAAgB,iBAAiB;AAC5D,UAAM,UAAU,OAAO,KAAK,aAAa,KAAK,EAAE,MAAM,CAAC,QAAQ,MAAM,SAAS,aAAa,MAAM,IAAI;AACrG,QAAI,SAAS;AACX,qBAAe,KAAK,OAAO,gBAAgB,aAAa,KAAK,EAAE;AAAA,IACjE;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAiC;AACvC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,37 @@
1
+ import * as React from "react";
2
+ import { style, compose, getSize } from "@xstyled/system";
3
+ const width = style({
4
+ prop: ["width", "w"],
5
+ css: "width",
6
+ themeGet: getSize
7
+ });
8
+ const height = style({
9
+ prop: ["height", "h"],
10
+ css: "height",
11
+ themeGet: getSize
12
+ });
13
+ const maxHeight = style({
14
+ prop: ["maxH", "maxHeight"],
15
+ css: "max-height",
16
+ themeGet: getSize
17
+ });
18
+ const maxWidth = style({
19
+ prop: ["maxW", "maxWidth"],
20
+ css: "max-width",
21
+ themeGet: getSize
22
+ });
23
+ const minHeight = style({
24
+ prop: ["minH", "minHeight"],
25
+ css: "min-height",
26
+ themeGet: getSize
27
+ });
28
+ const minWidth = style({
29
+ prop: ["minW", "minWidth"],
30
+ css: "min-width",
31
+ themeGet: getSize
32
+ });
33
+ const sizing = compose(width, maxWidth, height, maxHeight, minHeight, minWidth);
34
+ export {
35
+ sizing
36
+ };
37
+ //# sourceMappingURL=sizing.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/sizing.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { style, compose, getSize } from '@xstyled/system';\n\nconst width = style({\n prop: ['width', 'w'],\n css: 'width',\n themeGet: getSize,\n});\n\nconst height = style({\n prop: ['height', 'h'],\n css: 'height',\n themeGet: getSize,\n});\n\nconst maxHeight = style({\n prop: ['maxH', 'maxHeight'],\n css: 'max-height',\n themeGet: getSize,\n});\n\nconst maxWidth = style({\n prop: ['maxW', 'maxWidth'],\n css: 'max-width',\n themeGet: getSize,\n});\n\nconst minHeight = style({\n prop: ['minH', 'minHeight'],\n css: 'min-height',\n themeGet: getSize,\n});\n\nconst minWidth = style({\n prop: ['minW', 'minWidth'],\n css: 'min-width',\n themeGet: getSize,\n});\n\nexport const sizing = compose(width, maxWidth, height, maxHeight, minHeight, minWidth);\n"],
5
+ "mappings": "AAAA;ACAA;AAEA,MAAM,QAAQ,MAAM;AAAA,EAClB,MAAM,CAAC,SAAS,GAAG;AAAA,EACnB,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAED,MAAM,SAAS,MAAM;AAAA,EACnB,MAAM,CAAC,UAAU,GAAG;AAAA,EACpB,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAED,MAAM,YAAY,MAAM;AAAA,EACtB,MAAM,CAAC,QAAQ,WAAW;AAAA,EAC1B,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAED,MAAM,WAAW,MAAM;AAAA,EACrB,MAAM,CAAC,QAAQ,UAAU;AAAA,EACzB,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAED,MAAM,YAAY,MAAM;AAAA,EACtB,MAAM,CAAC,QAAQ,WAAW;AAAA,EAC1B,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAED,MAAM,WAAW,MAAM;AAAA,EACrB,MAAM,CAAC,QAAQ,UAAU;AAAA,EACzB,KAAK;AAAA,EACL,UAAU;AACZ,CAAC;AAEM,MAAM,SAAS,QAAQ,OAAO,UAAU,QAAQ,WAAW,WAAW,QAAQ;",
6
+ "names": []
7
+ }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { createGlobalStyle } from "./utils";
2
+ import { createGlobalStyle } from "./ds-styled";
3
3
  const GlobalStyles = createGlobalStyle`
4
4
  :root, body {
5
5
  overscroll-behavior-y: none;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createGlobalStyle } from './ds-styled';\n\nexport const GlobalStyles = createGlobalStyle<{ device: 'desktop' | 'mobile' }>`\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
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
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@ export * from "./utils";
6
6
  export * from "./arithmetic";
7
7
  export * from "./th";
8
8
  export * from "./theme";
9
- export * from "./styled";
9
+ export * from "./ds-styled";
10
10
  import { themeProviderHOC } from "./themeProviderHOC";
11
11
  export {
12
12
  themeProviderHOC
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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"],
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 './ds-styled';\nexport { themeProviderHOC } from './themeProviderHOC';\n"],
5
5
  "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
6
6
  "names": []
7
7
  }
@@ -3,10 +3,15 @@ import { useState, useEffect } from "react";
3
3
  import { theme } from "./theme";
4
4
  import { desktopBaseFont, mobileBaseFont, translateUnits } from "./constants";
5
5
  function __UNSAFE_SPACE_TO_DIMSUM(unit) {
6
- if (translateUnits[unit])
6
+ if (unit in translateUnits)
7
7
  return translateUnits[unit];
8
8
  return `${parseFloat(unit) * (mobileBaseFont / desktopBaseFont) / 2}px`;
9
9
  }
10
+ const isMobile = () => {
11
+ if (!window)
12
+ return false;
13
+ return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
14
+ };
10
15
  function toMobile(unit) {
11
16
  if (!isMobile())
12
17
  return unit;
@@ -18,22 +23,15 @@ const useIsMobile = () => {
18
23
  function handleResize() {
19
24
  setMobile(isMobile());
20
25
  }
21
- if (window)
22
- window.addEventListener("resize", handleResize);
26
+ window?.addEventListener("resize", handleResize);
23
27
  return () => {
24
- if (window)
25
- window.removeEventListener("resize", handleResize);
28
+ window?.removeEventListener("resize", handleResize);
26
29
  };
27
30
  }, []);
28
31
  if (!window)
29
32
  return false;
30
33
  return mobile;
31
34
  };
32
- const isMobile = () => {
33
- if (!window)
34
- return false;
35
- return Number(theme.breakpoints.medium.split("px")[0]) - window.innerWidth >= 0;
36
- };
37
35
  export {
38
36
  __UNSAFE_SPACE_TO_DIMSUM,
39
37
  isMobile,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/naming-convention */\nimport { 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 (unit in translateUnits) return translateUnits[unit as keyof typeof translateUnits];\n return `${(parseFloat(unit) * (mobileBaseFont / desktopBaseFont)) / 2}px`;\n}\n\nexport const isMobile = (): boolean => {\n if (!window) return false;\n return Number(theme.breakpoints.medium.split('px')[0]) - window.innerWidth >= 0;\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\n useEffect(() => {\n function handleResize() {\n setMobile(isMobile());\n }\n window?.addEventListener('resize', handleResize);\n return () => {\n window?.removeEventListener('resize', handleResize);\n };\n }, []);\n\n if (!window) return false;\n return mobile;\n};\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AAGO,kCAAkC,MAAsB;AAC7D,MAAI,QAAQ;AAAgB,WAAO,eAAe;AAClD,SAAO,GAAI,WAAW,IAAI,IAAK,kBAAiB,mBAAoB;AACtE;AAEO,MAAM,WAAW,MAAe;AACrC,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO,OAAO,MAAM,YAAY,OAAO,MAAM,IAAI,EAAE,EAAE,IAAI,OAAO,cAAc;AAChF;AAEO,kBAAkB,MAAsB;AAC7C,MAAI,CAAC,SAAS;AAAG,WAAO;AACxB,SAAO,GAAG,WAAW,IAAI,IAAK,mBAAkB;AAClD;AAEO,MAAM,cAAc,MAAe;AACxC,QAAM,CAAC,QAAQ,aAAa,SAAkB,SAAS,CAAC;AAExD,YAAU,MAAM;AACd,4BAAwB;AACtB,gBAAU,SAAS,CAAC;AAAA,IACtB;AACA,YAAQ,iBAAiB,UAAU,YAAY;AAC/C,WAAO,MAAM;AACX,cAAQ,oBAAoB,UAAU,YAAY;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,MAAI,CAAC;AAAQ,WAAO;AACpB,SAAO;AACT;",
6
6
  "names": []
7
7
  }