@elliemae/ds-system 2.0.0-alpha.10 → 2.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/utils.js CHANGED
@@ -8,44 +8,39 @@ export { createGlobalStyle, css, keyframes as kfrm, useTheme, withTheme } from '
8
8
 
9
9
  /* eslint-disable no-shadow */
10
10
  function truncate(width) {
11
- return props => css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? `width: ${props.width || width};` : '');
11
+ return props => css(["", " white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"], !!width || props.width ? "width: ".concat(props.width || width, ";") : '');
12
12
  }
13
13
  function flexCenter() {
14
- return `
15
- display: flex;
16
- justify-content: center;
17
- align-items: center;
18
- `;
14
+ return "\n display: flex;\n justify-content: center;\n align-items: center;\n ";
19
15
  }
20
16
  function disabled() {
21
- return `
22
- cursor: not-allowed;
23
- pointer-events: none;
24
- `;
17
+ return "\n cursor: not-allowed;\n pointer-events: none;\n ";
25
18
  }
26
19
  function keyframes(obj) {
27
- return keyframes$1(["", ""], reduce(obj, (result, value, key) => `
28
- ${result}
29
- ${key}% {
30
- ${value}
31
- }
32
- `, ''));
20
+ return keyframes$1(["", ""], reduce(obj, (result, value, key) => "\n ".concat(result, "\n ").concat(key, "% {\n ").concat(value, "\n }\n "), ''));
33
21
  } // eslint-disable-next-line max-params
34
22
 
35
- function boxShadow(top, left, blur, color, inset = false) {
36
- return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;
23
+ function boxShadow(top, left, blur, color) {
24
+ let inset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
25
+ return "box-shadow: ".concat(inset ? 'inset' : '', " ").concat(top, " ").concat(left, " ").concat(blur, " ").concat(color, ";");
37
26
  }
38
- function color(variant = 'neutral', type = 400) {
27
+ function color() {
28
+ let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
29
+ let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
39
30
  return css(["color:", ";"], props => props.theme.colors[variant][type]);
40
31
  }
41
- function border(color = theme.colors.brand[600], size = '1px', type = 'solid') {
42
- return `${size} ${type} ${color}`;
32
+ function border() {
33
+ let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.colors.brand[600];
34
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1px';
35
+ let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'solid';
36
+ return "".concat(size, " ").concat(type, " ").concat(color);
43
37
  }
44
38
  function animation(animationKeyframes, animationLength, animationTimingFn) {
45
39
  return props => css(["animation:", " ", " ", ";"], props.animationKeyframes || animationKeyframes, props.animationLength || animationLength, props.animationTimingFn || animationTimingFn);
46
40
  } // 0.0769
47
41
 
48
- function focus(color = theme.colors.brand[600]) {
42
+ function focus() {
43
+ let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : theme.colors.brand[600];
49
44
  return () => css(["outline:none;border:1px solid ", ";box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], color, lighten(0.3, color));
50
45
  }
51
46
  function focusAfter(color) {
@@ -57,96 +52,64 @@ function active() {
57
52
  function hover() {
58
53
  return props => css(["outline:1px solid ", ";outline-offset:-1px;"], props.theme.colors.brand[600]);
59
54
  }
60
- function textStyle(type, weight = 'regular') {
55
+ function textStyle(type) {
56
+ let weight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'regular';
61
57
  // eslint-disable-next-line complexity
62
58
  return props => {
63
- let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`; // eslint-disable-next-line default-case
59
+ let cssVar = "font-weight: ".concat(props.theme.fontWeights[weight], ";"); // eslint-disable-next-line default-case
64
60
 
65
61
  switch (type) {
66
62
  case 'h1':
67
- cssVar += `
68
- font-size: ${toMobile('2.7692rem')};
69
- line-height: normal;
70
- `;
63
+ cssVar += "\n font-size: ".concat(toMobile('2.7692rem'), ";\n line-height: normal;\n ");
71
64
  break;
72
65
 
73
66
  case 'h2':
74
- cssVar += `
75
- font-size: ${toMobile(props.theme.fontSizes.title[800])};
76
- line-height: normal;
77
- `;
67
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[800]), ";\n line-height: normal;\n ");
78
68
  break;
79
69
 
80
70
  case 'h3':
81
- cssVar += `
82
- font-size: ${toMobile(props.theme.fontSizes.title[700])};
83
- line-height: 1.2;
84
- `;
71
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[700]), ";\n line-height: 1.2;\n ");
85
72
  break;
86
73
 
87
74
  case 'h4':
88
- cssVar += `
89
- font-size: ${toMobile(props.theme.fontSizes.title[600])};
90
- line-height: normal;
91
- `;
75
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[600]), ";\n line-height: normal;\n ");
92
76
  break;
93
77
 
94
78
  case 'h5':
95
- cssVar += `
96
- font-size: ${toMobile(props.theme.fontSizes.title[500])};
97
- line-height: normal;
98
- `;
79
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n ");
99
80
  break;
100
81
 
101
82
  case 'section-header':
102
- cssVar += `
103
- font-size: ${toMobile(props.theme.fontSizes.title[500])};
104
- line-height: normal;
105
- text-transform: uppercase;
106
- `;
83
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.title[500]), ";\n line-height: normal;\n text-transform: uppercase;\n ");
107
84
  break;
108
85
 
109
86
  case 'body':
110
- cssVar += `
111
- font-size: ${toMobile(props.theme.fontSizes.value[400])};
112
- line-height: normal;
113
- `;
87
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
114
88
  break;
115
89
 
116
90
  case 'body-small':
117
- cssVar += `
118
- font-size: ${toMobile(props.theme.fontSizes.value[300])};
119
- line-height: normal;
120
- `;
91
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[300]), ";\n line-height: normal;\n ");
121
92
  break;
122
93
 
123
94
  case 'body-micro':
124
- cssVar += `
125
- font-size: ${toMobile(props.theme.fontSizes.microText[200])};
126
- line-height: normal;
127
- `;
95
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.microText[200]), ";\n line-height: normal;\n ");
128
96
  break;
129
97
 
130
98
  case 'list':
131
- cssVar += `
132
- font-size: ${toMobile(props.theme.fontSizes.value[400])};
133
- line-height: normal;
134
- `;
99
+ cssVar += "\n font-size: ".concat(toMobile(props.theme.fontSizes.value[400]), ";\n line-height: normal;\n ");
135
100
  break;
136
101
 
137
102
  case 'link':
138
- cssVar += `
139
- line-height: ${props.theme.xl};
140
- color: ${props.theme.colors.brand[600]};
141
- cursor: pointer;
142
- `;
103
+ cssVar += "\n line-height: ".concat(props.theme.xl, ";\n color: ").concat(props.theme.colors.brand[600], ";\n cursor: pointer;\n ");
143
104
  break;
144
105
  }
145
106
 
146
107
  return cssVar;
147
108
  };
148
109
  }
149
- function iconColor(variant = 'neutral', type = 400) {
110
+ function iconColor() {
111
+ let variant = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral';
112
+ let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
150
113
  return css(["fill:", ";"], props => props.theme.colors[variant][type]);
151
114
  }
152
115
  function fakeBorder() {
@@ -156,34 +119,18 @@ function fakeActive() {
156
119
  return css(["outline:none;box-shadow:inset 0 0 0 1px ", ";border-radius:2px;"], props => props.theme.colors.brand[700]);
157
120
  }
158
121
  function clearFocus() {
159
- return `
160
- border: none;
161
- box-shadow: none;
162
- `;
122
+ return "\n border: none;\n box-shadow: none;\n ";
163
123
  }
164
124
  function buttonLink() {
165
- return `
166
- background-color: transparent;
167
- border: 1px solid transparent;
168
- cursor: pointer;
169
- `;
170
- }
171
- function transition(t = 'all 1s ease') {
172
- return `
173
- transition: ${t};
174
- `;
175
- }
176
- function onlySafariAndFiredox(styles) {
177
- return css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
178
- }
179
- function onlySafari(styles) {
180
- return css(["@media not all and (min-resolution:0.001dpcm){", "}"], styles);
181
- }
182
- function onlyFirefox(styles) {
183
- return css(["@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles);
125
+ return "\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n ";
184
126
  }
185
- function safariAndFirefoxBold(color) {
186
- return css(["@media not all and (min-resolution:0.001dpcm){font-weight:400;-webkit-font-smoothing:subpixel-antialiased;-webkit-text-stroke:0.4px ", ";}@media screen and (min--moz-device-pixel-ratio:0){font-weight:400;-webkit-font-smoothing:subpixel-antialiased;-webkit-text-stroke:0.4px ", ";}"], color, color);
127
+ function transition() {
128
+ let t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all 1s ease';
129
+ return "\n transition: ".concat(t, ";\n ");
187
130
  }
131
+ const onlySafariAndFirefox = styles => css(["@media not all and (min-resolution:0.001dpcm){", "}@media screen and (min--moz-device-pixel-ratio:0){", "}"], styles, styles);
132
+ const onlySafari = styles => "\n @media not all and (min-resolution: 0.001dpcm) {\n ".concat(styles, "\n }\n ");
133
+ const onlyFirefox = styles => "\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ".concat(styles, "\n }\n ");
134
+ const safariAndFirefoxBold = color => "\n @media not all and (min-resolution: 0.001dpcm) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ".concat(color, ";\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n font-weight: 400;\n -webkit-font-smoothing: subpixel-antialiased;\n -webkit-text-stroke: 0.4px ").concat(color, ";\n }\n");
188
135
 
189
- export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFiredox, safariAndFirefoxBold, textStyle, transition, truncate };
136
+ export { active, animation, border, boxShadow, buttonLink, clearFocus, color, disabled, fakeActive, fakeBorder, flexCenter, focus, focusAfter, hover, iconColor, keyframes, onlyFirefox, onlySafari, onlySafariAndFirefox, safariAndFirefoxBold, textStyle, transition, truncate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-system",
3
- "version": "2.0.0-alpha.10",
3
+ "version": "2.0.0-alpha.14",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - System",
6
6
  "module": "./esm/index.js",
@@ -23,6 +23,26 @@
23
23
  "import": "./esm/theme.js",
24
24
  "require": "./cjs/theme.js"
25
25
  },
26
+ "./th": {
27
+ "import": "./esm/th.js",
28
+ "require": "./cjs/th.js"
29
+ },
30
+ "./styled/utils": {
31
+ "import": "./esm/styled/utils.js",
32
+ "require": "./cjs/styled/utils.js"
33
+ },
34
+ "./styled/types": {
35
+ "import": "./esm/styled/types.js",
36
+ "require": "./cjs/styled/types.js"
37
+ },
38
+ "./styled/styleGetters": {
39
+ "import": "./esm/styled/styleGetters.js",
40
+ "require": "./cjs/styled/styleGetters.js"
41
+ },
42
+ "./styled": {
43
+ "import": "./esm/styled/index.js",
44
+ "require": "./cjs/styled/index.js"
45
+ },
26
46
  "./spaceUtilities": {
27
47
  "import": "./esm/spaceUtilities.js",
28
48
  "require": "./cjs/spaceUtilities.js"
@@ -69,19 +89,19 @@
69
89
  "generateSubmodules": true
70
90
  },
71
91
  "dependencies": {
92
+ "@elliemae/ds-utilities": "2.0.0-alpha.14",
72
93
  "polished": "~3.6.7"
73
94
  },
74
95
  "devDependencies": {
75
- "@elliemae/pui-theme": "~2.2.3",
76
- "styled-components": "~5.3.1",
77
- "styled-system": "~5.1.5"
96
+ "@elliemae/pui-theme": "~2.2.5",
97
+ "@testing-library/jest-dom": "~5.15.0",
98
+ "styled-components": "~5.3.3"
78
99
  },
79
100
  "peerDependencies": {
80
- "@elliemae/pui-theme": "^2.2.3",
101
+ "@elliemae/pui-theme": "^2.2.5",
81
102
  "lodash": "^4.17.21",
82
103
  "react": "~17.0.2",
83
104
  "react-dom": "^17.0.2",
84
- "styled-components": "^5.3.1",
85
- "styled-system": "^5.1.5"
105
+ "styled-components": "^5.3.3"
86
106
  }
87
107
  }
@@ -1,5 +1,5 @@
1
- export declare function getNumberAndUnit(numberStrWithUnit: string): {
1
+ export declare function getNumberAndUnit(numberStrWithUnit: string | number): {
2
2
  number: string;
3
3
  unit: string;
4
4
  };
5
- export declare function op(operator: string, n1: string, n2: string): string;
5
+ export declare function op(operator: string, n1: string, n2: string | number): string;
package/types/index.d.ts CHANGED
@@ -3,5 +3,7 @@ export * from './spaceUtilities';
3
3
  export * from './mobileUtilities';
4
4
  export * from './utils';
5
5
  export * from './arithmetic';
6
+ export * from './th';
6
7
  export * from './theme';
8
+ export * from './styled';
7
9
  export { themeProviderHOC } from './themeProviderHOC';
@@ -0,0 +1,2 @@
1
+ import { Styled } from './types';
2
+ export declare const styled: Styled;
@@ -0,0 +1,4 @@
1
+ import type { Theme, CSSObject } from './types';
2
+ export declare const getStyleOverrides: (name: string, theme: Theme) => CSSObject | null;
3
+ export declare const getVariantStyles: (name: string, theme: Theme) => Record<string, CSSObject>;
4
+ export declare const variantsResolver: (props: Record<string, unknown>, styles: CSSObject, theme: Theme, name: string) => CSSObject[keyof CSSObject][];
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { Theme as PuiTheme } from '@elliemae/pui-theme';
3
+ import { AnyStyledComponent, CSSObject, Interpolation, InterpolationFunction, StyledComponent, StyledComponentInnerAttrs, StyledComponentInnerComponent, StyledComponentInnerOtherProps, StyledComponentPropsWithRef, ThemedStyledProps } from 'styled-components';
4
+ export { CSSObject } from 'styled-components';
5
+ export interface Theme extends PuiTheme {
6
+ components?: {
7
+ [componentName: string]: {
8
+ styleOverrides?: CSSObject;
9
+ variants?: {
10
+ props: Record<string, {
11
+ toString: () => string;
12
+ }>;
13
+ style: CSSObject;
14
+ }[];
15
+ };
16
+ };
17
+ }
18
+ export declare type ThemedStyledFunctionBase<C extends keyof JSX.IntrinsicElements | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> = <U extends object = {}>(first: TemplateStringsArray | CSSObject | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>, ...rest: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>>) => StyledComponent<C, T, O & U, A>;
19
+ declare type ThemedStyledComponentFactories<T extends object> = {
20
+ [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
21
+ };
22
+ export declare type StyledFunction = <C extends AnyStyledComponent | keyof JSX.IntrinsicElements | React.ComponentType<any>>(tag: C, options?: {
23
+ name: string | null;
24
+ slot: string | null;
25
+ }) => ThemedStyledFunctionBase<C extends AnyStyledComponent ? StyledComponentInnerComponent<C> : C, Theme, C extends AnyStyledComponent ? StyledComponentInnerOtherProps<C> : {}, C extends AnyStyledComponent ? StyledComponentInnerAttrs<C> : never>;
26
+ export interface StyledObject extends ThemedStyledComponentFactories<Theme> {
27
+ }
28
+ export declare type Styled = StyledFunction & StyledObject;
@@ -0,0 +1,6 @@
1
+ import type { Theme } from './types';
2
+ export declare const isEmpty: (string: string) => boolean;
3
+ export declare const coerceWithDefaultTheme: (themeInput: Theme) => Theme;
4
+ export declare const propsToClassKey: (props: Record<string, {
5
+ toString: () => string;
6
+ }>) => string;
package/types/th.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ declare type thGetter = (value: string, dfault: string) => (theme: any) => string;
2
+ declare type thConstructor = ((property: string) => thGetter) & {
3
+ space: thGetter;
4
+ fontSize: thGetter;
5
+ fontWeight: thGetter;
6
+ lineHeight: thGetter;
7
+ letterSpacing: thGetter;
8
+ font: thGetter;
9
+ color: thGetter;
10
+ breakpoint: thGetter;
11
+ media: thGetter;
12
+ };
13
+ export declare const th: thConstructor;
14
+ export {};
package/types/utils.d.ts CHANGED
@@ -2,26 +2,26 @@ import { rgba } from 'polished';
2
2
  import { Keyframes } from 'styled-components';
3
3
  import { css, withTheme, keyframes as kfrm, createGlobalStyle, useTheme } from 'styled-components';
4
4
  export { withTheme, createGlobalStyle, rgba, useTheme, kfrm, css };
5
- export declare function truncate(width: string): (props: any) => import("styled-components").FlattenSimpleInterpolation;
5
+ export declare function truncate(width?: string): (props: any) => import("styled-components").FlattenSimpleInterpolation;
6
6
  export declare function flexCenter(): string;
7
7
  export declare function disabled(): string;
8
8
  export declare function keyframes(obj: Record<string, unknown>): Keyframes;
9
9
  export declare function boxShadow(top: string, left: string, blur: string, color: string, inset?: boolean): string;
10
- export declare function color(variant?: string, type?: number): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
10
+ export declare function color(variant?: string, type?: number): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
11
11
  export declare function border(color?: string, size?: string, type?: string): string;
12
12
  export declare function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string): (props: any) => import("styled-components").FlattenSimpleInterpolation;
13
13
  export declare function focus(color?: string): () => import("styled-components").FlattenSimpleInterpolation;
14
- export declare function focusAfter(color: string): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
14
+ export declare function focusAfter(color: string): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
15
15
  export declare function active(): (props: any) => import("styled-components").FlattenSimpleInterpolation;
16
16
  export declare function hover(): (props: any) => import("styled-components").FlattenSimpleInterpolation;
17
17
  export declare function textStyle(type: string, weight?: string): (props: any) => string;
18
- export declare function iconColor(variant?: string, type?: number): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
19
- export declare function fakeBorder(): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
20
- export declare function fakeActive(): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
18
+ export declare function iconColor(variant?: string, type?: number): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
19
+ export declare function fakeBorder(): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
20
+ export declare function fakeActive(): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
21
21
  export declare function clearFocus(): string;
22
22
  export declare function buttonLink(): string;
23
23
  export declare function transition(t?: string): string;
24
- export declare function onlySafariAndFiredox(styles: string): string;
25
- export declare function onlySafari(styles: string): string;
26
- export declare function onlyFirefox(styles: string): string;
27
- export declare function safariAndFirefoxBold(color: string): string;
24
+ export declare const onlySafariAndFirefox: (styles: string) => string;
25
+ export declare const onlySafari: (styles: string) => string;
26
+ export declare const onlyFirefox: (styles: string) => string;
27
+ export declare const safariAndFirefoxBold: (color: string) => string;
package/cjs/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }
package/esm/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }