@elliemae/ds-system 3.1.0-next.4 → 3.1.0-next.7
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/dist/cjs/ds-styled/index.js +3 -0
- package/dist/cjs/ds-styled/index.js.map +2 -2
- package/dist/cjs/ds-styled/styled.js.map +2 -2
- package/dist/cjs/ds-styled/utilities/color.js +55 -0
- package/dist/cjs/ds-styled/utilities/color.js.map +7 -0
- package/dist/cjs/index.js +7 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/utils.js +12 -18
- package/dist/cjs/utils.js.map +2 -2
- package/dist/esm/ds-styled/index.js +4 -1
- package/dist/esm/ds-styled/index.js.map +2 -2
- package/dist/esm/ds-styled/styled.js.map +2 -2
- package/dist/esm/ds-styled/utilities/color.js +33 -0
- package/dist/esm/ds-styled/utilities/color.js.map +7 -0
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/utils.js +12 -18
- package/dist/esm/utils.js.map +2 -2
- package/package.json +1 -1
|
@@ -22,7 +22,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
var ds_styled_exports = {};
|
|
23
23
|
__export(ds_styled_exports, {
|
|
24
24
|
boxShadows: () => import_system.boxShadow,
|
|
25
|
+
color: () => import_color.color,
|
|
25
26
|
flexboxes: () => import_system.flexboxes,
|
|
27
|
+
fontSize: () => import_system.fontSize,
|
|
26
28
|
grids: () => import_system.grids,
|
|
27
29
|
layout: () => import_system.layout,
|
|
28
30
|
space: () => import_system.space
|
|
@@ -34,4 +36,5 @@ var import_system = require("@xstyled/system");
|
|
|
34
36
|
__reExport(ds_styled_exports, require("./utilities/border"), module.exports);
|
|
35
37
|
__reExport(ds_styled_exports, require("./utilities/background"), module.exports);
|
|
36
38
|
__reExport(ds_styled_exports, require("./utilities/sizing"), module.exports);
|
|
39
|
+
var import_color = require("./utilities/color");
|
|
37
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ds-styled/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './styled';\n\nexport { layout, space, flexboxes, grids, boxShadow as boxShadows } from '@xstyled/system';\nexport * from './utilities/border';\nexport * from './utilities/background';\nexport * from './utilities/sizing';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAc,qBAAd;AAEA,
|
|
4
|
+
"sourcesContent": ["export * from './styled';\n\nexport { layout, space, flexboxes, grids, boxShadow as boxShadows, fontSize } from '@xstyled/system';\nexport * from './utilities/border';\nexport * from './utilities/background';\nexport * from './utilities/sizing';\nexport { color } from './utilities/color';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAc,qBAAd;AAEA,oBAAmF;AACnF,8BAAc,+BAHd;AAIA,8BAAc,mCAJd;AAKA,8BAAc,+BALd;AAMA,mBAAsB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ds-styled/styled.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMvB,+BAA0B;AAC1B,oBAAgC;AAGhC,uBAOO;AAEP,MAAM,EAAE,KAAK,QAAQ,qBAAqB,sBAAsB,wCAAU,2BAAQ,oBAAM,CAAC;AAGzF,MAAM,iBAAmC,CAAC,KAAK,UAAU,EAAE,MAAM,MAAM,MAAM,KAAK,MAAM;AACtF,QAAM,EAAE,MAAM,eAAe,MAAM,kBAAkB;
|
|
4
|
+
"sourcesContent": ["/* 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 // @ts-ignore\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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings":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BAAqB,EAAE,KAAK,EAAE;AAC7D,4BAAsB,OAAO,OAAO,CAAC,GAAG,mBAAmB,GAAG,YAAY,GAAG;AAAA,QAC3E,KAAK,CAAC,GAAI,kBAA2C,KAAK,GAAG,YAAY;AAAA,MAC3E,CAAC;AAAA,IACH,WAAW,OAAO,sBAAsB,YAAY;AAElD,4BAAsB,CAAC,UACrB,kBAAkB,iCAAK,QAAL,EAAY,OAAO,6CAAuB,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var color_exports = {};
|
|
22
|
+
__export(color_exports, {
|
|
23
|
+
color: () => color
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(color_exports);
|
|
26
|
+
var React = __toESM(require("react"));
|
|
27
|
+
var import_system = require("@xstyled/system");
|
|
28
|
+
var import_th = require("../../th");
|
|
29
|
+
function colorGetter(value) {
|
|
30
|
+
return (props) => `${import_th.th.color(value, value)(props)}`;
|
|
31
|
+
}
|
|
32
|
+
const cssColorGetter = (value) => {
|
|
33
|
+
if (!value)
|
|
34
|
+
return null;
|
|
35
|
+
if (typeof value === "string") {
|
|
36
|
+
return (props) => ({
|
|
37
|
+
color: colorGetter(value)(props)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return (props) => Object.keys(value).reduce((prev, current) => {
|
|
41
|
+
if (current === "_")
|
|
42
|
+
prev.color = colorGetter(value[current])(props);
|
|
43
|
+
else
|
|
44
|
+
prev[`&:${current}`] = { color: colorGetter(value[current])(props) };
|
|
45
|
+
return prev;
|
|
46
|
+
}, {});
|
|
47
|
+
};
|
|
48
|
+
colorGetter.meta = {};
|
|
49
|
+
const colorStyled = (0, import_system.style)({
|
|
50
|
+
prop: ["color"],
|
|
51
|
+
css: cssColorGetter,
|
|
52
|
+
cssProps: ["color"]
|
|
53
|
+
});
|
|
54
|
+
const color = (0, import_system.compose)(colorStyled);
|
|
55
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/ds-styled/utilities/color.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { style, compose, CSSFromProps, CSSObject } from '@xstyled/system';\nimport { th } from '../../th';\nimport type { PropsWithTheme, ThProps } from '../types';\n\nfunction colorGetter(value: string) {\n return (props: PropsWithTheme): string => `${th.color(value, value)(props as ThProps)}`;\n}\n\nconst cssColorGetter = (value: string | Record<string, string>): CSSFromProps | null => {\n if (!value) return null;\n if (typeof value === 'string') {\n return (props: PropsWithTheme) => ({\n color: colorGetter(value)(props),\n });\n }\n return (props: PropsWithTheme) =>\n Object.keys(value).reduce((prev, current) => {\n if (current === '_') prev.color = colorGetter(value[current])(props);\n else prev[`&:${current}`] = { color: colorGetter(value[current])(props) };\n return prev;\n }, {} as CSSObject);\n};\n\ncolorGetter.meta = {};\n\nconst colorStyled = style({\n prop: ['color'],\n css: cssColorGetter,\n cssProps: ['color'],\n});\n\nexport const color = compose(colorStyled);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oBAAwD;AACxD,gBAAmB;AAGnB,qBAAqB,OAAe;AAClC,SAAO,CAAC,UAAkC,GAAG,aAAG,MAAM,OAAO,KAAK,EAAE,KAAgB;AACtF;AAEA,MAAM,iBAAiB,CAAC,UAAgE;AACtF,MAAI,CAAC;AAAO,WAAO;AACnB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,CAAC,UAA2B;AAAA,MACjC,OAAO,YAAY,KAAK,EAAE,KAAK;AAAA,IACjC;AAAA,EACF;AACA,SAAO,CAAC,UACN,OAAO,KAAK,KAAK,EAAE,OAAO,CAAC,MAAM,YAAY;AAC3C,QAAI,YAAY;AAAK,WAAK,QAAQ,YAAY,MAAM,QAAQ,EAAE,KAAK;AAAA;AAC9D,WAAK,KAAK,aAAa,EAAE,OAAO,YAAY,MAAM,QAAQ,EAAE,KAAK,EAAE;AACxE,WAAO;AAAA,EACT,GAAG,CAAC,CAAc;AACtB;AAEA,YAAY,OAAO,CAAC;AAEpB,MAAM,cAAc,yBAAM;AAAA,EACxB,MAAM,CAAC,OAAO;AAAA,EACd,KAAK;AAAA,EACL,UAAU,CAAC,OAAO;AACpB,CAAC;AAEM,MAAM,QAAQ,2BAAQ,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -21,11 +21,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
22
|
var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
|
24
|
-
LayoutProps: () =>
|
|
25
|
-
SizingProps: () =>
|
|
26
|
-
SpaceProps: () =>
|
|
24
|
+
LayoutProps: () => import_system.LayoutProps,
|
|
25
|
+
SizingProps: () => import_system.SizingProps,
|
|
26
|
+
SpaceProps: () => import_system.SpaceProps,
|
|
27
27
|
ThemeContext: () => import_styled_components.ThemeContext,
|
|
28
|
-
|
|
28
|
+
position: () => import_system.position,
|
|
29
|
+
themeProviderHOC: () => import_themeProviderHOC.themeProviderHOC,
|
|
30
|
+
typography: () => import_system.typography
|
|
29
31
|
});
|
|
30
32
|
module.exports = __toCommonJS(src_exports);
|
|
31
33
|
var React = __toESM(require("react"));
|
|
@@ -38,5 +40,6 @@ __reExport(src_exports, require("./th"), module.exports);
|
|
|
38
40
|
__reExport(src_exports, require("./theme"), module.exports);
|
|
39
41
|
__reExport(src_exports, require("./ds-styled"), module.exports);
|
|
40
42
|
var import_themeProviderHOC = require("./themeProviderHOC");
|
|
43
|
+
var import_system = require("@xstyled/system");
|
|
41
44
|
var import_styled_components = require("@xstyled/styled-components");
|
|
42
45
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["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';\nexport { SizingProps, SpaceProps, LayoutProps, ThemeContext } from '@xstyled/styled-components';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,2BAAd;AACA,wBAAc,6BADd;AAEA,wBAAc,8BAFd;AAGA,wBAAc,oBAHd;AAIA,wBAAc,yBAJd;AAKA,wBAAc,iBALd;AAMA,wBAAc,oBANd;AAOA,wBAAc,wBAPd;AAQA,8BAAiC;AACjC,+
|
|
4
|
+
"sourcesContent": ["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';\nexport { SizingProps, SpaceProps, LayoutProps, position, typography } from '@xstyled/system';\nexport { ThemeContext } from '@xstyled/styled-components';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,2BAAd;AACA,wBAAc,6BADd;AAEA,wBAAc,8BAFd;AAGA,wBAAc,oBAHd;AAIA,wBAAc,yBAJd;AAKA,wBAAc,iBALd;AAMA,wBAAc,oBANd;AAOA,wBAAc,wBAPd;AAQA,8BAAiC;AACjC,oBAA2E;AAC3E,+BAA6B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/utils.js
CHANGED
|
@@ -26,7 +26,6 @@ __export(utils_exports, {
|
|
|
26
26
|
boxShadow: () => boxShadow,
|
|
27
27
|
buttonLink: () => buttonLink,
|
|
28
28
|
clearFocus: () => clearFocus,
|
|
29
|
-
color: () => color,
|
|
30
29
|
disabled: () => disabled,
|
|
31
30
|
fakeActive: () => fakeActive,
|
|
32
31
|
fakeBorder: () => fakeBorder,
|
|
@@ -86,16 +85,11 @@ function keyframes(obj) {
|
|
|
86
85
|
`, "")}
|
|
87
86
|
`;
|
|
88
87
|
}
|
|
89
|
-
function boxShadow(top, left, blur,
|
|
90
|
-
return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${
|
|
88
|
+
function boxShadow(top, left, blur, color, inset = false) {
|
|
89
|
+
return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${color};`;
|
|
91
90
|
}
|
|
92
|
-
function color
|
|
93
|
-
return
|
|
94
|
-
color: ${import_th.th.color(`${variant}-${type}`)};
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
function border(color2 = import_theme.theme.colors.brand[600], size = "1px", type = "solid") {
|
|
98
|
-
return `${size} ${type} ${color2}`;
|
|
91
|
+
function border(color = import_theme.theme.colors.brand[600], size = "1px", type = "solid") {
|
|
92
|
+
return `${size} ${type} ${color}`;
|
|
99
93
|
}
|
|
100
94
|
function animation(animationKeyframes, animationLength, animationTimingFn) {
|
|
101
95
|
return (props) => import_styled_components2.css`
|
|
@@ -103,15 +97,15 @@ function animation(animationKeyframes, animationLength, animationTimingFn) {
|
|
|
103
97
|
${props.animationTimingFn || animationTimingFn};
|
|
104
98
|
`;
|
|
105
99
|
}
|
|
106
|
-
function focus(
|
|
100
|
+
function focus(color = import_theme.theme.colors.brand[600]) {
|
|
107
101
|
return () => import_styled_components2.css`
|
|
108
102
|
outline: none;
|
|
109
|
-
border: 1px solid ${
|
|
110
|
-
box-shadow: inset 0 0 0 1px ${(0, import_polished.lighten)(0.3,
|
|
103
|
+
border: 1px solid ${color};
|
|
104
|
+
box-shadow: inset 0 0 0 1px ${(0, import_polished.lighten)(0.3, color)};
|
|
111
105
|
border-radius: 2px;
|
|
112
106
|
`;
|
|
113
107
|
}
|
|
114
|
-
function focusAfter(
|
|
108
|
+
function focusAfter(color) {
|
|
115
109
|
return import_styled_components2.css`
|
|
116
110
|
outline: none;
|
|
117
111
|
position: relative;
|
|
@@ -124,7 +118,7 @@ function focusAfter(color2) {
|
|
|
124
118
|
width: 100%;
|
|
125
119
|
height: 100%;
|
|
126
120
|
pointer-events: none;
|
|
127
|
-
${focus(
|
|
121
|
+
${focus(color)}
|
|
128
122
|
}
|
|
129
123
|
`;
|
|
130
124
|
}
|
|
@@ -271,16 +265,16 @@ const onlyFirefox = (styles) => `
|
|
|
271
265
|
${styles}
|
|
272
266
|
}
|
|
273
267
|
`;
|
|
274
|
-
const safariAndFirefoxBold = (
|
|
268
|
+
const safariAndFirefoxBold = (color) => `
|
|
275
269
|
@media not all and (min-resolution: 0.001dpcm) {
|
|
276
270
|
font-weight: 400;
|
|
277
271
|
-webkit-font-smoothing: subpixel-antialiased;
|
|
278
|
-
-webkit-text-stroke: 0.4px ${
|
|
272
|
+
-webkit-text-stroke: 0.4px ${color};
|
|
279
273
|
}
|
|
280
274
|
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
281
275
|
font-weight: 400;
|
|
282
276
|
-webkit-font-smoothing: subpixel-antialiased;
|
|
283
|
-
-webkit-text-stroke: 0.4px ${
|
|
277
|
+
-webkit-text-stroke: 0.4px ${color};
|
|
284
278
|
}
|
|
285
279
|
`;
|
|
286
280
|
//# sourceMappingURL=utils.js.map
|
package/dist/cjs/utils.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { lighten, rgba } from 'polished';\nimport { reduce } from 'lodash';\nimport { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme';\nimport { toMobile } from './mobileUtilities';\nimport { th } from './th';\n\nexport { withTheme, rgba, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { lighten, rgba } from 'polished';\nimport { reduce } from 'lodash';\nimport { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme';\nimport { toMobile } from './mobileUtilities';\nimport { th } from './th';\n\nexport { withTheme, rgba, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\n// export function color(variant = 'neutral', type: string | number = 400) {\n// return css`\n// color: ${th.color(`${variant}-${type}`)};\n// `;\n// }\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props: { animationKeyframes?: string; animationLength?: string; animationTimingFn?: string }) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n// 0.0769\nexport function focus(color: string = theme.colors.brand[600]) {\n return () => css`\n outline: none;\n border: 1px solid ${color};\n box-shadow: inset 0 0 0 1px ${lighten(0.3, color)};\n border-radius: 2px;\n `;\n}\n\nexport function focusAfter(color: string) {\n return css`\n outline: none;\n position: relative;\n &:after {\n content: '';\n z-index: 10;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n ${focus(color)}\n }\n `;\n}\n\nexport function active() {\n return (props: PropsWithTheme) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props: PropsWithTheme) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight: keyof Theme['fontWeights'] = 'regular') {\n // eslint-disable-next-line complexity\n return (props: { theme: Theme }): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.space.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${th.color(`${variant}-${type}`)};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): FlattenSimpleInterpolation => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\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 ${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 ${color};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADSvB,sBAA8B;AAC9B,oBAAuB;AAEvB,gCAA4D;AAC5D,mBAAsB;AACtB,6BAAyB;AACzB,gBAAmB;AAMZ,kBAAkB,OAAgB;AACvC,SAAO,CAAC,UAA8C;AAAA,MAClD,CAAC,CAAC,SAAS,MAAM,QAAQ,UAAW,MAAM,SAAS,WAAsB;AAAA;AAAA;AAAA;AAAA;AAK/E;AAEO,sBAA8B;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAKT;AAEO,oBAA4B;AACjC,SAAO;AAAA;AAAA;AAAA;AAIT;AAEO,mBAAmB,KAAwC;AAChE,SAAO,sCAAO,0BACZ,KACA,CAAC,QAAQ,OAAO,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,QACE;AAAA;AAAA,KAGJ,EACF;AAAA;AAEF;AAGO,mBAAmB,KAAa,MAAc,MAAc,OAAe,QAAQ,OAAe;AACvG,SAAO,eAAe,QAAQ,UAAU,MAAM,OAAO,QAAQ,QAAQ;AACvE;AAQO,gBAAgB,QAAQ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,CAAC,WAA2B;AAAA;AAAA,QAE9C;AAAA;AAAA;AAID,MAAM,cAAc,CAAC,WAA2B;AAAA;AAAA,QAE/C;AAAA;AAAA;AAID,MAAM,uBAAuB,CAAC,UAA0B;AAAA;AAAA;AAAA;AAAA,iCAI9B;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export * from "./styled";
|
|
3
|
-
import { layout, space, flexboxes, grids, boxShadow } from "@xstyled/system";
|
|
3
|
+
import { layout, space, flexboxes, grids, boxShadow, fontSize } from "@xstyled/system";
|
|
4
4
|
export * from "./utilities/border";
|
|
5
5
|
export * from "./utilities/background";
|
|
6
6
|
export * from "./utilities/sizing";
|
|
7
|
+
import { color } from "./utilities/color";
|
|
7
8
|
export {
|
|
8
9
|
boxShadow as boxShadows,
|
|
10
|
+
color,
|
|
9
11
|
flexboxes,
|
|
12
|
+
fontSize,
|
|
10
13
|
grids,
|
|
11
14
|
layout,
|
|
12
15
|
space
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/ds-styled/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './styled';\n\nexport { layout, space, flexboxes, grids, boxShadow as boxShadows } from '@xstyled/system';\nexport * from './utilities/border';\nexport * from './utilities/background';\nexport * from './utilities/sizing';\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AAEA;AACA;AACA;AACA;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './styled';\n\nexport { layout, space, flexboxes, grids, boxShadow as boxShadows, fontSize } from '@xstyled/system';\nexport * from './utilities/border';\nexport * from './utilities/background';\nexport * from './utilities/sizing';\nexport { color } from './utilities/color';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA;AACA;AACA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,MAAM,MAAM,MAAM,KAAK,MAAM;AACtF,QAAM,EAAE,MAAM,eAAe,MAAM,kBAAkB;
|
|
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 // @ts-ignore\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,MAAM,MAAM,MAAM,KAAK,MAAM;AACtF,QAAM,EAAE,MAAM,eAAe,MAAM,kBAAkB;AAGrD,QAAM,wBAAwB,oBAAoB,GAAG;AAErD,QAAM,aAAa;AAAA,IACjB,OAAO,sBAAsB;AAAA,IAC7B,YAAY,sBAAsB;AAAA,EACpC;AAGA,QAAM,uBAAiD,CAAC,aAAa,gBAAgB;AAKnF,UAAM,CAAC,mBAAmB,wBAAwB,kBAAkB,UAAU,WAAW;AAOzF,UAAM,8BAA8B,uBAAuB,qBAAqB,IAAI,sBAAsB,IAAI,CAAC;AAE/G,QAAI,sBAAsB;AAK1B,QAAI,iBAAiB,eAAe;AAClC,kCAA4B,KAAK,CAAC,UAA0B;AAC1D,cAAM,QAAQ,uBAAuB,MAAM,KAAK;AAChD,cAAM,iBAAiB,kBAAkB,eAAe,KAAK;AAC7D,YAAI,gBAAgB;AAClB,iBAAO,CAAC,eAAe,cAAc;AAAA,QACvC;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAKA,QAAI,iBAAiB,kBAAkB,QAAQ;AAC7C,kCAA4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from "react";
|
|
2
|
+
import { style, compose } from "@xstyled/system";
|
|
3
|
+
import { th } from "../../th";
|
|
4
|
+
function colorGetter(value) {
|
|
5
|
+
return (props) => `${th.color(value, value)(props)}`;
|
|
6
|
+
}
|
|
7
|
+
const cssColorGetter = (value) => {
|
|
8
|
+
if (!value)
|
|
9
|
+
return null;
|
|
10
|
+
if (typeof value === "string") {
|
|
11
|
+
return (props) => ({
|
|
12
|
+
color: colorGetter(value)(props)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return (props) => Object.keys(value).reduce((prev, current) => {
|
|
16
|
+
if (current === "_")
|
|
17
|
+
prev.color = colorGetter(value[current])(props);
|
|
18
|
+
else
|
|
19
|
+
prev[`&:${current}`] = { color: colorGetter(value[current])(props) };
|
|
20
|
+
return prev;
|
|
21
|
+
}, {});
|
|
22
|
+
};
|
|
23
|
+
colorGetter.meta = {};
|
|
24
|
+
const colorStyled = style({
|
|
25
|
+
prop: ["color"],
|
|
26
|
+
css: cssColorGetter,
|
|
27
|
+
cssProps: ["color"]
|
|
28
|
+
});
|
|
29
|
+
const color = compose(colorStyled);
|
|
30
|
+
export {
|
|
31
|
+
color
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/ds-styled/utilities/color.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { style, compose, CSSFromProps, CSSObject } from '@xstyled/system';\nimport { th } from '../../th';\nimport type { PropsWithTheme, ThProps } from '../types';\n\nfunction colorGetter(value: string) {\n return (props: PropsWithTheme): string => `${th.color(value, value)(props as ThProps)}`;\n}\n\nconst cssColorGetter = (value: string | Record<string, string>): CSSFromProps | null => {\n if (!value) return null;\n if (typeof value === 'string') {\n return (props: PropsWithTheme) => ({\n color: colorGetter(value)(props),\n });\n }\n return (props: PropsWithTheme) =>\n Object.keys(value).reduce((prev, current) => {\n if (current === '_') prev.color = colorGetter(value[current])(props);\n else prev[`&:${current}`] = { color: colorGetter(value[current])(props) };\n return prev;\n }, {} as CSSObject);\n};\n\ncolorGetter.meta = {};\n\nconst colorStyled = style({\n prop: ['color'],\n css: cssColorGetter,\n cssProps: ['color'],\n});\n\nexport const color = compose(colorStyled);\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAGA,qBAAqB,OAAe;AAClC,SAAO,CAAC,UAAkC,GAAG,GAAG,MAAM,OAAO,KAAK,EAAE,KAAgB;AACtF;AAEA,MAAM,iBAAiB,CAAC,UAAgE;AACtF,MAAI,CAAC;AAAO,WAAO;AACnB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,CAAC,UAA2B;AAAA,MACjC,OAAO,YAAY,KAAK,EAAE,KAAK;AAAA,IACjC;AAAA,EACF;AACA,SAAO,CAAC,UACN,OAAO,KAAK,KAAK,EAAE,OAAO,CAAC,MAAM,YAAY;AAC3C,QAAI,YAAY;AAAK,WAAK,QAAQ,YAAY,MAAM,QAAQ,EAAE,KAAK;AAAA;AAC9D,WAAK,KAAK,aAAa,EAAE,OAAO,YAAY,MAAM,QAAQ,EAAE,KAAK,EAAE;AACxE,WAAO;AAAA,EACT,GAAG,CAAC,CAAc;AACtB;AAEA,YAAY,OAAO,CAAC;AAEpB,MAAM,cAAc,MAAM;AAAA,EACxB,MAAM,CAAC,OAAO;AAAA,EACd,KAAK;AAAA,EACL,UAAU,CAAC,OAAO;AACpB,CAAC;AAEM,MAAM,QAAQ,QAAQ,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -8,12 +8,15 @@ export * from "./th";
|
|
|
8
8
|
export * from "./theme";
|
|
9
9
|
export * from "./ds-styled";
|
|
10
10
|
import { themeProviderHOC } from "./themeProviderHOC";
|
|
11
|
-
import { SizingProps, SpaceProps, LayoutProps,
|
|
11
|
+
import { SizingProps, SpaceProps, LayoutProps, position, typography } from "@xstyled/system";
|
|
12
|
+
import { ThemeContext } from "@xstyled/styled-components";
|
|
12
13
|
export {
|
|
13
14
|
LayoutProps,
|
|
14
15
|
SizingProps,
|
|
15
16
|
SpaceProps,
|
|
16
17
|
ThemeContext,
|
|
17
|
-
|
|
18
|
+
position,
|
|
19
|
+
themeProviderHOC,
|
|
20
|
+
typography
|
|
18
21
|
};
|
|
19
22
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -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 './ds-styled';\nexport { themeProviderHOC } from './themeProviderHOC';\nexport { SizingProps, SpaceProps, LayoutProps, ThemeContext } from '@xstyled/styled-components';\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
|
|
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';\nexport { SizingProps, SpaceProps, LayoutProps, position, typography } from '@xstyled/system';\nexport { ThemeContext } from '@xstyled/styled-components';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/utils.js
CHANGED
|
@@ -35,16 +35,11 @@ function keyframes(obj) {
|
|
|
35
35
|
`, "")}
|
|
36
36
|
`;
|
|
37
37
|
}
|
|
38
|
-
function boxShadow(top, left, blur,
|
|
39
|
-
return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${
|
|
38
|
+
function boxShadow(top, left, blur, color, inset = false) {
|
|
39
|
+
return `box-shadow: ${inset ? "inset" : ""} ${top} ${left} ${blur} ${color};`;
|
|
40
40
|
}
|
|
41
|
-
function color
|
|
42
|
-
return
|
|
43
|
-
color: ${th.color(`${variant}-${type}`)};
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
46
|
-
function border(color2 = theme.colors.brand[600], size = "1px", type = "solid") {
|
|
47
|
-
return `${size} ${type} ${color2}`;
|
|
41
|
+
function border(color = theme.colors.brand[600], size = "1px", type = "solid") {
|
|
42
|
+
return `${size} ${type} ${color}`;
|
|
48
43
|
}
|
|
49
44
|
function animation(animationKeyframes, animationLength, animationTimingFn) {
|
|
50
45
|
return (props) => css`
|
|
@@ -52,15 +47,15 @@ function animation(animationKeyframes, animationLength, animationTimingFn) {
|
|
|
52
47
|
${props.animationTimingFn || animationTimingFn};
|
|
53
48
|
`;
|
|
54
49
|
}
|
|
55
|
-
function focus(
|
|
50
|
+
function focus(color = theme.colors.brand[600]) {
|
|
56
51
|
return () => css`
|
|
57
52
|
outline: none;
|
|
58
|
-
border: 1px solid ${
|
|
59
|
-
box-shadow: inset 0 0 0 1px ${lighten(0.3,
|
|
53
|
+
border: 1px solid ${color};
|
|
54
|
+
box-shadow: inset 0 0 0 1px ${lighten(0.3, color)};
|
|
60
55
|
border-radius: 2px;
|
|
61
56
|
`;
|
|
62
57
|
}
|
|
63
|
-
function focusAfter(
|
|
58
|
+
function focusAfter(color) {
|
|
64
59
|
return css`
|
|
65
60
|
outline: none;
|
|
66
61
|
position: relative;
|
|
@@ -73,7 +68,7 @@ function focusAfter(color2) {
|
|
|
73
68
|
width: 100%;
|
|
74
69
|
height: 100%;
|
|
75
70
|
pointer-events: none;
|
|
76
|
-
${focus(
|
|
71
|
+
${focus(color)}
|
|
77
72
|
}
|
|
78
73
|
`;
|
|
79
74
|
}
|
|
@@ -220,16 +215,16 @@ const onlyFirefox = (styles) => `
|
|
|
220
215
|
${styles}
|
|
221
216
|
}
|
|
222
217
|
`;
|
|
223
|
-
const safariAndFirefoxBold = (
|
|
218
|
+
const safariAndFirefoxBold = (color) => `
|
|
224
219
|
@media not all and (min-resolution: 0.001dpcm) {
|
|
225
220
|
font-weight: 400;
|
|
226
221
|
-webkit-font-smoothing: subpixel-antialiased;
|
|
227
|
-
-webkit-text-stroke: 0.4px ${
|
|
222
|
+
-webkit-text-stroke: 0.4px ${color};
|
|
228
223
|
}
|
|
229
224
|
@media screen and (min--moz-device-pixel-ratio: 0) {
|
|
230
225
|
font-weight: 400;
|
|
231
226
|
-webkit-font-smoothing: subpixel-antialiased;
|
|
232
|
-
-webkit-text-stroke: 0.4px ${
|
|
227
|
+
-webkit-text-stroke: 0.4px ${color};
|
|
233
228
|
}
|
|
234
229
|
`;
|
|
235
230
|
export {
|
|
@@ -239,7 +234,6 @@ export {
|
|
|
239
234
|
boxShadow,
|
|
240
235
|
buttonLink,
|
|
241
236
|
clearFocus,
|
|
242
|
-
color,
|
|
243
237
|
disabled,
|
|
244
238
|
fakeActive,
|
|
245
239
|
fakeBorder,
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { lighten, rgba } from 'polished';\nimport { reduce } from 'lodash';\nimport { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme';\nimport { toMobile } from './mobileUtilities';\nimport { th } from './th';\n\nexport { withTheme, rgba, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\
|
|
5
|
-
"mappings": "AAAA;ACSA;AACA;AAEA;AACA;AACA;AACA;AAMO,kBAAkB,OAAgB;AACvC,SAAO,CAAC,UAA8C;AAAA,MAClD,CAAC,CAAC,SAAS,MAAM,QAAQ,UAAW,MAAM,SAAS,WAAsB;AAAA;AAAA;AAAA;AAAA;AAK/E;AAEO,sBAA8B;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAKT;AAEO,oBAA4B;AACjC,SAAO;AAAA;AAAA;AAAA;AAIT;AAEO,mBAAmB,KAAwC;AAChE,SAAO,OAAO,OACZ,KACA,CAAC,QAAQ,OAAO,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,QACE;AAAA;AAAA,KAGJ,EACF;AAAA;AAEF;AAGO,mBAAmB,KAAa,MAAc,MAAc,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable no-shadow */\n/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-shadow */\n\n// https://github.com/styled-components/babel-plugin-styled-components/issues/216#issuecomment-516941240\n\nimport type { Theme } from '@elliemae/pui-theme';\nimport { lighten, rgba } from 'polished';\nimport { reduce } from 'lodash';\nimport { Keyframes, FlattenSimpleInterpolation } from 'styled-components';\nimport { css, withTheme, keyframes as kfrm, useTheme } from '@xstyled/styled-components';\nimport { theme } from './theme';\nimport { toMobile } from './mobileUtilities';\nimport { th } from './th';\n\nexport { withTheme, rgba, useTheme, kfrm };\n\ntype PropsWithTheme<T = Record<string, unknown>> = T & { theme: Theme };\n\nexport function truncate(width?: string) {\n return (props: PropsWithTheme<{ width?: string }>) => css`\n ${!!width || props.width ? `width: ${(props.width || width) as string};` : ''}\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n `;\n}\n\nexport function flexCenter(): string {\n return `\n display: flex;\n justify-content: center;\n align-items: center;\n `;\n}\n\nexport function disabled(): string {\n return `\n cursor: not-allowed;\n pointer-events: none;\n `;\n}\n\nexport function keyframes(obj: Record<string, string>): Keyframes {\n return kfrm`${reduce(\n obj,\n (result, value, key) => `\n ${result}\n ${key}% {\n ${value}\n }\n `,\n '',\n )}\n `;\n}\n\n// eslint-disable-next-line max-params\nexport function boxShadow(top: string, left: string, blur: string, color: string, inset = false): string {\n return `box-shadow: ${inset ? 'inset' : ''} ${top} ${left} ${blur} ${color};`;\n}\n\n// export function color(variant = 'neutral', type: string | number = 400) {\n// return css`\n// color: ${th.color(`${variant}-${type}`)};\n// `;\n// }\n\nexport function border(color = theme.colors.brand[600], size = '1px', type = 'solid'): string {\n return `${size} ${type} ${color}`;\n}\n\nexport function animation(animationKeyframes: string, animationLength: string, animationTimingFn: string) {\n return (props: { animationKeyframes?: string; animationLength?: string; animationTimingFn?: string }) => css`\n animation: ${props.animationKeyframes || animationKeyframes} ${props.animationLength || animationLength}\n ${props.animationTimingFn || animationTimingFn};\n `;\n}\n// 0.0769\nexport function focus(color: string = theme.colors.brand[600]) {\n return () => css`\n outline: none;\n border: 1px solid ${color};\n box-shadow: inset 0 0 0 1px ${lighten(0.3, color)};\n border-radius: 2px;\n `;\n}\n\nexport function focusAfter(color: string) {\n return css`\n outline: none;\n position: relative;\n &:after {\n content: '';\n z-index: 10;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n ${focus(color)}\n }\n `;\n}\n\nexport function active() {\n return (props: PropsWithTheme) => css`\n outline: none;\n border: 1px solid ${props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function hover() {\n return (props: PropsWithTheme) => css`\n outline: 1px solid ${props.theme.colors.brand[600]};\n outline-offset: -1px;\n `;\n}\n\nexport function textStyle(type: string, weight: keyof Theme['fontWeights'] = 'regular') {\n // eslint-disable-next-line complexity\n return (props: { theme: Theme }): string => {\n let cssVar = `font-weight: ${props.theme.fontWeights[weight]};`;\n // eslint-disable-next-line default-case\n switch (type) {\n case 'h1':\n cssVar += `\n font-size: ${toMobile('2.7692rem')};\n line-height: normal;\n `;\n break;\n case 'h2':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[800])};\n line-height: normal;\n `;\n break;\n case 'h3':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[700])};\n line-height: 1.2;\n `;\n break;\n case 'h4':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[600])};\n line-height: normal;\n `;\n break;\n case 'h5':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n `;\n break;\n case 'section-header':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.title[500])};\n line-height: normal;\n text-transform: uppercase;\n `;\n break;\n case 'body':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'body-small':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[300])};\n line-height: normal;\n `;\n break;\n case 'body-micro':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.microText[200])};\n line-height: normal;\n `;\n break;\n case 'list':\n cssVar += `\n font-size: ${toMobile(props.theme.fontSizes.value[400])};\n line-height: normal;\n `;\n break;\n case 'link':\n cssVar += `\n line-height: ${props.theme.space.xl};\n color: ${props.theme.colors.brand[600]};\n cursor: pointer;\n `;\n break;\n }\n return cssVar;\n };\n}\n\nexport function iconColor(variant = 'neutral', type = 400) {\n return css`\n fill: ${th.color(`${variant}-${type}`)};\n `;\n}\n\nexport function fakeBorder() {\n return css`\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.neutral[200]};\n border-radius: 2px;\n `;\n}\n\nexport function fakeActive() {\n return css`\n outline: none;\n box-shadow: inset 0 0 0 1px ${(props) => props.theme.colors.brand[700]};\n border-radius: 2px;\n `;\n}\n\nexport function clearFocus(): string {\n return `\n border: none;\n box-shadow: none;\n `;\n}\n\nexport function buttonLink(): string {\n return `\n background-color: transparent;\n border: 1px solid transparent;\n cursor: pointer;\n `;\n}\n\nexport function transition(t = 'all 1s ease'): string {\n return `\n transition: ${t};\n `;\n}\n\nexport const onlySafariAndFirefox = (styles: string): FlattenSimpleInterpolation => css`\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n`;\n\nexport const onlySafari = (styles: string): string => `\n @media not all and (min-resolution: 0.001dpcm) {\n ${styles}\n }\n `;\n\nexport const onlyFirefox = (styles: string): string => `\n @media screen and (min--moz-device-pixel-ratio: 0) {\n ${styles}\n }\n `;\n\nexport const safariAndFirefoxBold = (color: string): string => `\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 ${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 ${color};\n }\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACSA;AACA;AAEA;AACA;AACA;AACA;AAMO,kBAAkB,OAAgB;AACvC,SAAO,CAAC,UAA8C;AAAA,MAClD,CAAC,CAAC,SAAS,MAAM,QAAQ,UAAW,MAAM,SAAS,WAAsB;AAAA;AAAA;AAAA;AAAA;AAK/E;AAEO,sBAA8B;AACnC,SAAO;AAAA;AAAA;AAAA;AAAA;AAKT;AAEO,oBAA4B;AACjC,SAAO;AAAA;AAAA;AAAA;AAIT;AAEO,mBAAmB,KAAwC;AAChE,SAAO,OAAO,OACZ,KACA,CAAC,QAAQ,OAAO,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,QACE;AAAA;AAAA,KAGJ,EACF;AAAA;AAEF;AAGO,mBAAmB,KAAa,MAAc,MAAc,OAAe,QAAQ,OAAe;AACvG,SAAO,eAAe,QAAQ,UAAU,MAAM,OAAO,QAAQ,QAAQ;AACvE;AAQO,gBAAgB,QAAQ,MAAM,OAAO,MAAM,MAAM,OAAO,OAAO,OAAO,SAAiB;AAC5F,SAAO,GAAG,QAAQ,QAAQ;AAC5B;AAEO,mBAAmB,oBAA4B,iBAAyB,mBAA2B;AACxG,SAAO,CAAC,UAAiG;AAAA,iBAC1F,MAAM,sBAAsB,sBAAsB,MAAM,mBAAmB;AAAA,QACpF,MAAM,qBAAqB;AAAA;AAEnC;AAEO,eAAe,QAAgB,MAAM,OAAO,MAAM,MAAM;AAC7D,SAAO,MAAM;AAAA;AAAA,wBAES;AAAA,kCACU,QAAQ,KAAK,KAAK;AAAA;AAAA;AAGpD;AAEO,oBAAoB,OAAe;AACxC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAYD,MAAM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