@elliemae/ds-square-indicator 2.3.1 → 3.0.0-alpha.3

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.
@@ -0,0 +1,148 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import * as React from "react";
18
+ import React2, { useMemo } from "react";
19
+ import { Grid } from "@elliemae/ds-grid";
20
+ import { DSTooltipV3 } from "@elliemae/ds-tooltip";
21
+ import { describe, useGetGlobalAttributes, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
22
+ import { uid } from "uid";
23
+ import { defaultProps, SquareIndicatorPropTypes } from "./react-desc-prop-types";
24
+ import { StyledLineLeft, StyledLineTop, StyledLineRight, StyledLineBottom } from "./styled";
25
+ import { colorToHex, sizeToPx, sizeToTextSize, sizeToWeight } from "./constants";
26
+ const DSSquareIndicator = (props) => {
27
+ const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
28
+ const globalAttributes = useGetGlobalAttributes(propsWithDefault);
29
+ const { size, color, text, showText, withTooltip, tooltipStartPlacementPreference, __duration } = propsWithDefault;
30
+ const Wrapper = useMemo(() => withTooltip ? DSTooltipV3 : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children), [withTooltip]);
31
+ const uniqueId = useMemo(() => uid(16), []);
32
+ const paddedCoordinate = useMemo(() => `calc(100% - ${sizeToWeight[size]})`, [size]);
33
+ const hexColor = useMemo(() => colorToHex[color], [color]);
34
+ return /* @__PURE__ */ React2.createElement(Grid, __spreadValues({
35
+ gutter: "xs",
36
+ justifyContent: "center",
37
+ role: "status"
38
+ }, globalAttributes), /* @__PURE__ */ React2.createElement(Wrapper, {
39
+ text,
40
+ textAlign: "center",
41
+ startPlacementPreference: tooltipStartPlacementPreference
42
+ }, /* @__PURE__ */ React2.createElement("svg", {
43
+ width: sizeToPx[size],
44
+ height: sizeToPx[size],
45
+ style: {
46
+ display: "block",
47
+ margin: "auto"
48
+ }
49
+ }, /* @__PURE__ */ React2.createElement("defs", null, /* @__PURE__ */ React2.createElement("linearGradient", {
50
+ id: `${uniqueId}-lg1`,
51
+ x1: "0",
52
+ y1: "0",
53
+ x2: "0",
54
+ y2: "100%"
55
+ }, /* @__PURE__ */ React2.createElement("stop", {
56
+ offset: "20%",
57
+ stopColor: `${hexColor}FF`
58
+ }), /* @__PURE__ */ React2.createElement("stop", {
59
+ offset: "80%",
60
+ stopColor: `${hexColor}00`
61
+ })), /* @__PURE__ */ React2.createElement("linearGradient", {
62
+ id: `${uniqueId}-lg2`,
63
+ x1: "0",
64
+ y1: "0",
65
+ x2: "100%",
66
+ y2: "0"
67
+ }, /* @__PURE__ */ React2.createElement("stop", {
68
+ offset: "10%",
69
+ stopColor: `${hexColor}00`
70
+ }), /* @__PURE__ */ React2.createElement("stop", {
71
+ offset: "50%",
72
+ stopColor: `${hexColor}FF`
73
+ })), /* @__PURE__ */ React2.createElement("linearGradient", {
74
+ id: `${uniqueId}-lg3`,
75
+ x1: "0",
76
+ y1: "0",
77
+ x2: "0",
78
+ y2: "100%"
79
+ }, /* @__PURE__ */ React2.createElement("stop", {
80
+ offset: "10%",
81
+ stopColor: `${hexColor}00`
82
+ }), /* @__PURE__ */ React2.createElement("stop", {
83
+ offset: "50%",
84
+ stopColor: `${hexColor}FF`
85
+ })), /* @__PURE__ */ React2.createElement("linearGradient", {
86
+ id: `${uniqueId}-lg4`,
87
+ x1: "0",
88
+ y1: "0",
89
+ x2: "100%",
90
+ y2: "0"
91
+ }, /* @__PURE__ */ React2.createElement("stop", {
92
+ offset: "50%",
93
+ stopColor: `${hexColor}FF`
94
+ }), /* @__PURE__ */ React2.createElement("stop", {
95
+ offset: "90%",
96
+ stopColor: `${hexColor}00`
97
+ })), /* @__PURE__ */ React2.createElement("clipPath", {
98
+ id: `${uniqueId}-lcp1`
99
+ }, /* @__PURE__ */ React2.createElement("rect", {
100
+ x: sizeToWeight[size],
101
+ y: 0,
102
+ width: "100%",
103
+ height: sizeToWeight[size]
104
+ })), /* @__PURE__ */ React2.createElement("clipPath", {
105
+ id: `${uniqueId}-lcp2`
106
+ }, /* @__PURE__ */ React2.createElement("rect", {
107
+ x: paddedCoordinate,
108
+ y: sizeToWeight[size],
109
+ width: sizeToWeight[size],
110
+ height: "100%"
111
+ })), /* @__PURE__ */ React2.createElement("clipPath", {
112
+ id: `${uniqueId}-lcp3`
113
+ }, /* @__PURE__ */ React2.createElement("rect", {
114
+ x: 0,
115
+ y: paddedCoordinate,
116
+ width: paddedCoordinate,
117
+ height: sizeToWeight[size]
118
+ }))), /* @__PURE__ */ React2.createElement(StyledLineLeft, {
119
+ size,
120
+ __duration,
121
+ fill: `url(#${uniqueId}-lg1)`
122
+ }), /* @__PURE__ */ React2.createElement(StyledLineTop, {
123
+ size,
124
+ __duration,
125
+ fill: `url(#${uniqueId}-lg2)`,
126
+ clipPath: `url(#${uniqueId}-lcp1)`
127
+ }), /* @__PURE__ */ React2.createElement(StyledLineRight, {
128
+ size,
129
+ __duration,
130
+ fill: `url(#${uniqueId}-lg3)`,
131
+ clipPath: `url(#${uniqueId}-lcp2)`
132
+ }), /* @__PURE__ */ React2.createElement(StyledLineBottom, {
133
+ size,
134
+ __duration,
135
+ fill: `url(#${uniqueId}-lg4)`,
136
+ clipPath: `url(#${uniqueId}-lcp3)`
137
+ })), text !== "" && showText && /* @__PURE__ */ React2.createElement("span", {
138
+ style: { color: colorToHex[color], fontSize: sizeToTextSize[size] }
139
+ }, text)));
140
+ };
141
+ DSSquareIndicator.propTypes = SquareIndicatorPropTypes;
142
+ const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);
143
+ DSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;
144
+ export {
145
+ DSSquareIndicator,
146
+ DSSquareIndicatorWithSchema
147
+ };
148
+ //# sourceMappingURL=DSSquareIndicator.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSSquareIndicator.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/naming-convention */\nimport React, { PropsWithChildren, useMemo } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { describe, useGetGlobalAttributes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { defaultProps, DSSquareIndicatorT, SquareIndicatorPropTypes } from './react-desc-prop-types';\nimport { StyledLineLeft, StyledLineTop, StyledLineRight, StyledLineBottom } from './styled';\nimport { colorToHex, sizeToPx, sizeToTextSize, sizeToWeight } from './constants';\n\nexport const DSSquareIndicator: React.ComponentType<DSSquareIndicatorT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<Required<DSSquareIndicatorT.Props>>(props, defaultProps);\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n\n const { size, color, text, showText, withTooltip, tooltipStartPlacementPreference, __duration } = propsWithDefault;\n\n const Wrapper: typeof DSTooltipV3 = useMemo(\n () => (withTooltip ? DSTooltipV3 : ({ children }: PropsWithChildren<unknown>) => <>{children}</>),\n [withTooltip],\n );\n\n const uniqueId = useMemo(() => uid(16), []);\n const paddedCoordinate = useMemo(() => `calc(100% - ${sizeToWeight[size]})`, [size]);\n\n const hexColor = useMemo(() => colorToHex[color], [color]);\n\n return (\n <Grid gutter=\"xs\" justifyContent=\"center\" role=\"status\" {...globalAttributes}>\n <Wrapper text={text} textAlign=\"center\" startPlacementPreference={tooltipStartPlacementPreference}>\n <svg\n width={sizeToPx[size]}\n height={sizeToPx[size]}\n style={{\n display: 'block',\n margin: 'auto',\n }}\n >\n <defs>\n <linearGradient id={`${uniqueId}-lg1`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"100%\">\n <stop offset=\"20%\" stopColor={`${hexColor}FF`} />\n <stop offset=\"80%\" stopColor={`${hexColor}00`} />\n </linearGradient>\n <linearGradient id={`${uniqueId}-lg2`} x1=\"0\" y1=\"0\" x2=\"100%\" y2=\"0\">\n <stop offset=\"10%\" stopColor={`${hexColor}00`} />\n <stop offset=\"50%\" stopColor={`${hexColor}FF`} />\n </linearGradient>\n <linearGradient id={`${uniqueId}-lg3`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"100%\">\n <stop offset=\"10%\" stopColor={`${hexColor}00`} />\n <stop offset=\"50%\" stopColor={`${hexColor}FF`} />\n </linearGradient>\n <linearGradient id={`${uniqueId}-lg4`} x1=\"0\" y1=\"0\" x2=\"100%\" y2=\"0\">\n <stop offset=\"50%\" stopColor={`${hexColor}FF`} />\n <stop offset=\"90%\" stopColor={`${hexColor}00`} />\n </linearGradient>\n <clipPath id={`${uniqueId}-lcp1`}>\n <rect x={sizeToWeight[size]} y={0} width=\"100%\" height={sizeToWeight[size]} />\n </clipPath>\n <clipPath id={`${uniqueId}-lcp2`}>\n <rect x={paddedCoordinate} y={sizeToWeight[size]} width={sizeToWeight[size]} height=\"100%\" />\n </clipPath>\n <clipPath id={`${uniqueId}-lcp3`}>\n <rect x={0} y={paddedCoordinate} width={paddedCoordinate} height={sizeToWeight[size]} />\n </clipPath>\n </defs>\n <StyledLineLeft size={size} __duration={__duration} fill={`url(#${uniqueId}-lg1)`} />\n <StyledLineTop\n size={size}\n __duration={__duration}\n fill={`url(#${uniqueId}-lg2)`}\n clipPath={`url(#${uniqueId}-lcp1)`}\n />\n <StyledLineRight\n size={size}\n __duration={__duration}\n fill={`url(#${uniqueId}-lg3)`}\n clipPath={`url(#${uniqueId}-lcp2)`}\n />\n <StyledLineBottom\n size={size}\n __duration={__duration}\n fill={`url(#${uniqueId}-lg4)`}\n clipPath={`url(#${uniqueId}-lcp3)`}\n />\n </svg>\n {text !== '' && showText && (\n <span style={{ color: colorToHex[color], fontSize: sizeToTextSize[size] }}>{text}</span>\n )}\n </Wrapper>\n </Grid>\n );\n};\n\nDSSquareIndicator.propTypes = SquareIndicatorPropTypes;\n\nexport const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);\nDSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ const sizeToPx = {
3
+ xs: "16px",
4
+ s: "24px",
5
+ m: "32px",
6
+ l: "48px",
7
+ xl: "56px",
8
+ xxl: "64px"
9
+ };
10
+ const sizeToWeight = {
11
+ xs: "3px",
12
+ s: "3px",
13
+ m: "3px",
14
+ l: "4px",
15
+ xl: "5px",
16
+ xxl: "6px"
17
+ };
18
+ const colorToHex = {
19
+ light: "#FFFFFF",
20
+ dark: "#0F364A"
21
+ };
22
+ const sizeToTextSize = {
23
+ xs: "12px",
24
+ s: "12px",
25
+ m: "12px",
26
+ l: "13px",
27
+ xl: "14px",
28
+ xxl: "16px"
29
+ };
30
+ export {
31
+ colorToHex,
32
+ sizeToPx,
33
+ sizeToTextSize,
34
+ sizeToWeight
35
+ };
36
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/constants.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const sizeToPx = {\n xs: '16px',\n s: '24px',\n m: '32px',\n l: '48px',\n xl: '56px',\n xxl: '64px',\n};\n\nexport const sizeToWeight = {\n xs: '3px',\n s: '3px',\n m: '3px',\n l: '4px',\n xl: '5px',\n xxl: '6px',\n};\n\nexport const colorToHex = {\n light: '#FFFFFF',\n dark: '#0F364A',\n};\n\nexport const sizeToTextSize = {\n xs: '12px',\n s: '12px',\n m: '12px',\n l: '13px',\n xl: '14px',\n xxl: '16px',\n};\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,WAAW;AAAA,EACtB,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGA,MAAM,eAAe;AAAA,EAC1B,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGA,MAAM,aAAa;AAAA,EACxB,OAAO;AAAA,EACP,MAAM;AAAA;AAGD,MAAM,iBAAiB;AAAA,EAC5B,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { DSSquareIndicator, DSSquareIndicatorWithSchema } from "./DSSquareIndicator";
3
+ export {
4
+ DSSquareIndicator,
5
+ DSSquareIndicatorWithSchema
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSSquareIndicator, DSSquareIndicatorWithSchema } from './DSSquareIndicator';\n"],
5
+ "mappings": "AAAA;ACAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,56 @@
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 { PropTypes, globalAttributesPropTypes } from "@elliemae/ds-props-helpers";
22
+ const SquareIndicatorPropTypes = __spreadProps(__spreadValues({}, globalAttributesPropTypes), {
23
+ size: PropTypes.oneOf(["xs", "s", "m", "l", "xl", "xxl"]).description("Size of the indicator").defaultValue("m"),
24
+ color: PropTypes.oneOf(["light", "dark"]).description("Color mode for the indicator").defaultValue("dark"),
25
+ text: PropTypes.string.description("Optional text to show under the indicator").defaultValue(""),
26
+ showText: PropTypes.bool.description("Whether to show the optional text or not").defaultValue(true),
27
+ withTooltip: PropTypes.bool.description("Whether to include a tooltip that shows the optional text on hover").defaultValue(false),
28
+ tooltipStartPlacementPreference: PropTypes.oneOf([
29
+ "top-start",
30
+ "top",
31
+ "top-end",
32
+ "right-start",
33
+ "right",
34
+ "right-end",
35
+ "bottom-end",
36
+ "bottom",
37
+ "bottom-start",
38
+ "left-end",
39
+ "left",
40
+ "left-start"
41
+ ]).description("start placement preference for the tooltip").defaultValue("center")
42
+ });
43
+ const defaultProps = {
44
+ size: "m",
45
+ color: "dark",
46
+ text: "",
47
+ showText: true,
48
+ withTooltip: false,
49
+ tooltipStartPlacementPreference: "bottom",
50
+ __duration: 2.5
51
+ };
52
+ export {
53
+ SquareIndicatorPropTypes,
54
+ defaultProps
55
+ };
56
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { PropTypes, globalAttributesPropTypes } from '@elliemae/ds-props-helpers';\nimport { WeakValidationMap } from 'react';\n\nexport declare namespace DSSquareIndicatorT {\n interface Props {\n size?: 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n color?: 'light' | 'dark';\n text?: string;\n showText?: boolean;\n withTooltip: boolean;\n tooltipStartPlacementPreference?:\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'right-start'\n | 'right'\n | 'right-end'\n | 'bottom-end'\n | 'bottom'\n | 'bottom-start'\n | 'left-end'\n | 'left'\n | 'left-start';\n __duration: number;\n }\n}\n\nexport const SquareIndicatorPropTypes = {\n ...globalAttributesPropTypes,\n size: PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),\n color: PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),\n text: PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),\n showText: PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),\n withTooltip: PropTypes.bool\n .description('Whether to include a tooltip that shows the optional text on hover')\n .defaultValue(false),\n tooltipStartPlacementPreference: PropTypes.oneOf([\n 'top-start',\n 'top',\n 'top-end',\n 'right-start',\n 'right',\n 'right-end',\n 'bottom-end',\n 'bottom',\n 'bottom-start',\n 'left-end',\n 'left',\n 'left-start',\n ])\n .description('start placement preference for the tooltip')\n .defaultValue('center'),\n} as WeakValidationMap<unknown>;\n\nexport const defaultProps: DSSquareIndicatorT.Props = {\n size: 'm',\n color: 'dark',\n text: '',\n showText: true,\n withTooltip: false,\n tooltipStartPlacementPreference: 'bottom',\n __duration: 2.5,\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACCA;AA2BO,MAAM,2BAA2B,iCACnC,4BADmC;AAAA,EAEtC,MAAM,UAAU,MAAM,CAAC,MAAM,KAAK,KAAK,KAAK,MAAM,QAAQ,YAAY,yBAAyB,aAAa;AAAA,EAC5G,OAAO,UAAU,MAAM,CAAC,SAAS,SAAS,YAAY,gCAAgC,aAAa;AAAA,EACnG,MAAM,UAAU,OAAO,YAAY,6CAA6C,aAAa;AAAA,EAC7F,UAAU,UAAU,KAAK,YAAY,4CAA4C,aAAa;AAAA,EAC9F,aAAa,UAAU,KACpB,YAAY,sEACZ,aAAa;AAAA,EAChB,iCAAiC,UAAU,MAAM;AAAA,IAC/C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,KAEC,YAAY,8CACZ,aAAa;AAAA;AAGX,MAAM,eAAyC;AAAA,EACpD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,iCAAiC;AAAA,EACjC,YAAY;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,95 @@
1
+ import * as React from "react";
2
+ import styled from "styled-components";
3
+ import { kfrm } from "@elliemae/ds-system";
4
+ import { sizeToWeight } from "./constants";
5
+ const lineLeftAnimation = kfrm`
6
+ 0% {
7
+ y: 100%;
8
+ height: 100%;
9
+ }
10
+ 12.5%, 50% {
11
+ y: 0;
12
+ height: 100%;
13
+ }
14
+ 62.5%, 100% {
15
+ y: -100%;
16
+ height: 100%;
17
+ }
18
+ `;
19
+ const lineTopAnimation = kfrm`
20
+ 0% {
21
+ x: -100%;
22
+ width: 0%;
23
+ }
24
+ 25%, 50% {
25
+ x: -100%;
26
+ width: 200%;
27
+ }
28
+ 75%, 100% {
29
+ x: 100%;
30
+ width: 200%;
31
+ }
32
+ `;
33
+ const lineRightAnimation = kfrm`
34
+ 0%, 12.5% {
35
+ y: -100%;
36
+ height: 0%;
37
+ }
38
+ 37.5%, 62.5% {
39
+ y: -100%;
40
+ height: 200%;
41
+ }
42
+ 87.5%, 100% {
43
+ y: 100%;
44
+ height: 200%;
45
+ }
46
+ `;
47
+ const lineBottomAnimation = kfrm`
48
+ 0%, 25% {
49
+ x: 200%;
50
+ width: 200%;
51
+ }
52
+ 50%, 75% {
53
+ x: 0%;
54
+ width: 200%;
55
+ }
56
+ 100% {
57
+ x: -200%;
58
+ width: 200%;
59
+ }
60
+ `;
61
+ const StyledLineLeft = styled.rect`
62
+ x: 0;
63
+ y: 0%;
64
+ width: ${({ size }) => sizeToWeight[size]};
65
+ height: 100%;
66
+ animation: ${lineLeftAnimation} ${({ __duration }) => __duration}s linear 0s infinite;
67
+ `;
68
+ const StyledLineTop = styled.rect`
69
+ x: -100%;
70
+ y: 0;
71
+ width: 200%;
72
+ height: ${({ size }) => sizeToWeight[size]};
73
+ animation: ${lineTopAnimation} ${({ __duration }) => __duration}s linear 0s infinite;
74
+ `;
75
+ const StyledLineRight = styled.rect`
76
+ x: calc(100% - ${({ size }) => sizeToWeight[size]});
77
+ y: -100%;
78
+ width: ${({ size }) => sizeToWeight[size]};
79
+ height: 200%;
80
+ animation: ${lineRightAnimation} ${({ __duration }) => __duration}s linear 0s infinite;
81
+ `;
82
+ const StyledLineBottom = styled.rect`
83
+ x: 0%;
84
+ y: calc(100% - ${({ size }) => sizeToWeight[size]});
85
+ width: 200%;
86
+ height: ${({ size }) => sizeToWeight[size]};
87
+ animation: ${lineBottomAnimation} ${({ __duration }) => __duration}s linear 0s infinite;
88
+ `;
89
+ export {
90
+ StyledLineBottom,
91
+ StyledLineLeft,
92
+ StyledLineRight,
93
+ StyledLineTop
94
+ };
95
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport { kfrm } from '@elliemae/ds-system';\nimport { DSSquareIndicatorT } from './react-desc-prop-types';\nimport { sizeToWeight } from './constants';\n\ninterface RectProps {\n size: Required<DSSquareIndicatorT.Props>['size'];\n __duration: number;\n}\n\nconst lineLeftAnimation = kfrm`\n 0% {\n y: 100%;\n height: 100%;\n }\n 12.5%, 50% {\n y: 0;\n height: 100%;\n }\n 62.5%, 100% {\n y: -100%;\n height: 100%;\n }\n`;\n\nconst lineTopAnimation = kfrm`\n 0% {\n x: -100%;\n width: 0%;\n }\n 25%, 50% {\n x: -100%;\n width: 200%;\n }\n 75%, 100% {\n x: 100%;\n width: 200%;\n }\n`;\n\nconst lineRightAnimation = kfrm`\n 0%, 12.5% {\n y: -100%;\n height: 0%;\n }\n 37.5%, 62.5% {\n y: -100%;\n height: 200%;\n }\n 87.5%, 100% {\n y: 100%;\n height: 200%;\n }\n`;\n\nconst lineBottomAnimation = kfrm`\n 0%, 25% {\n x: 200%;\n width: 200%;\n }\n 50%, 75% {\n x: 0%;\n width: 200%;\n }\n 100% {\n x: -200%;\n width: 200%;\n }\n`;\n\nexport const StyledLineLeft = styled.rect<RectProps>`\n x: 0;\n y: 0%;\n width: ${({ size }) => sizeToWeight[size]};\n height: 100%;\n animation: ${lineLeftAnimation} ${({ __duration }) => __duration}s linear 0s infinite;\n`;\n\nexport const StyledLineTop = styled.rect<RectProps>`\n x: -100%;\n y: 0;\n width: 200%;\n height: ${({ size }) => sizeToWeight[size]};\n animation: ${lineTopAnimation} ${({ __duration }) => __duration}s linear 0s infinite;\n`;\n\nexport const StyledLineRight = styled.rect<RectProps>`\n x: calc(100% - ${({ size }) => sizeToWeight[size]});\n y: -100%;\n width: ${({ size }) => sizeToWeight[size]};\n height: 200%;\n animation: ${lineRightAnimation} ${({ __duration }) => __duration}s linear 0s infinite;\n`;\n\nexport const StyledLineBottom = styled.rect<RectProps>`\n x: 0%;\n y: calc(100% - ${({ size }) => sizeToWeight[size]});\n width: 200%;\n height: ${({ size }) => sizeToWeight[size]};\n animation: ${lineBottomAnimation} ${({ __duration }) => __duration}s linear 0s infinite;\n`;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA;AAOA,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe1B,MAAM,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAezB,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe3B,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAerB,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA,WAG1B,CAAC,EAAE,WAAW,aAAa;AAAA;AAAA,eAEvB,qBAAqB,CAAC,EAAE,iBAAiB;AAAA;AAGjD,MAAM,gBAAgB,OAAO;AAAA;AAAA;AAAA;AAAA,YAIxB,CAAC,EAAE,WAAW,aAAa;AAAA,eACxB,oBAAoB,CAAC,EAAE,iBAAiB;AAAA;AAGhD,MAAM,kBAAkB,OAAO;AAAA,mBACnB,CAAC,EAAE,WAAW,aAAa;AAAA;AAAA,WAEnC,CAAC,EAAE,WAAW,aAAa;AAAA;AAAA,eAEvB,sBAAsB,CAAC,EAAE,iBAAiB;AAAA;AAGlD,MAAM,mBAAmB,OAAO;AAAA;AAAA,mBAEpB,CAAC,EAAE,WAAW,aAAa;AAAA;AAAA,YAElC,CAAC,EAAE,WAAW,aAAa;AAAA,eACxB,uBAAuB,CAAC,EAAE,iBAAiB;AAAA;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,31 +1,26 @@
1
1
  {
2
2
  "name": "@elliemae/ds-square-indicator",
3
- "version": "2.3.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Indeterminate Progress Indicator",
6
- "module": "./esm/index.js",
7
- "main": "./cjs/index.js",
8
- "types": "./types/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
9
12
  "exports": {
10
13
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js"
13
- },
14
- "./styled": {
15
- "import": "./esm/styled.js",
16
- "require": "./cjs/styled.js"
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
17
16
  },
18
17
  "./react-desc-prop-types": {
19
- "import": "./esm/react-desc-prop-types.js",
20
- "require": "./cjs/react-desc-prop-types.js"
18
+ "import": "./dist/esm/react-desc-prop-types.js",
19
+ "require": "./dist/cjs/react-desc-prop-types.js"
21
20
  },
22
21
  "./DSSquareIndicator": {
23
- "import": "./esm/DSSquareIndicator.js",
24
- "require": "./cjs/DSSquareIndicator.js"
25
- },
26
- "./constants": {
27
- "import": "./esm/constants.js",
28
- "require": "./cjs/constants.js"
22
+ "import": "./dist/esm/DSSquareIndicator.js",
23
+ "require": "./dist/cjs/DSSquareIndicator.js"
29
24
  }
30
25
  },
31
26
  "sideEffects": [
@@ -37,31 +32,35 @@
37
32
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
38
33
  },
39
34
  "engines": {
40
- "npm": ">=7",
41
- "node": ">=14"
35
+ "pnpm": ">=6",
36
+ "node": ">=16"
42
37
  },
43
38
  "author": "ICE MT",
44
- "scripts": {
45
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
46
- "prebuild": "exit 0",
47
- "predev": "exit 0",
48
- "build": "node ../../scripts/build/build.js"
39
+ "jestSonar": {
40
+ "sonar56x": true,
41
+ "reportPath": "reports",
42
+ "reportFile": "tests.xml",
43
+ "indent": 4
49
44
  },
50
45
  "dependencies": {
51
- "@elliemae/ds-grid": "2.3.1",
52
- "@elliemae/ds-props-helpers": "2.3.1",
53
- "@elliemae/ds-system": "2.3.1",
54
- "@elliemae/ds-tooltip": "2.3.1",
55
- "uid": "~2.0.0"
46
+ "@elliemae/ds-grid": "3.0.0-alpha.3",
47
+ "@elliemae/ds-props-helpers": "3.0.0-alpha.3",
48
+ "@elliemae/ds-tooltip": "3.0.0-alpha.3",
49
+ "react-desc": "~4.1.3"
56
50
  },
57
51
  "peerDependencies": {
58
52
  "react": "^17.0.2",
59
- "react-dom": "^17.0.2",
60
- "styled-components": "^5.3.3"
53
+ "react-dom": "^17.0.2"
61
54
  },
62
55
  "publishConfig": {
63
56
  "access": "public",
64
- "directory": "dist",
65
- "generateSubmodules": true
57
+ "typeSafety": false
58
+ },
59
+ "scripts": {
60
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
61
+ "test": "node ../../scripts/testing/test.mjs",
62
+ "lint": "node ../../scripts/lint.mjs",
63
+ "dts": "node ../../scripts/dts.mjs",
64
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
66
65
  }
67
66
  }