@elliemae/ds-square-indicator 2.2.0-next.4

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,96 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _jsx = require('@babel/runtime/helpers/jsx');
6
+ var React = require('react');
7
+ var dsGrid = require('@elliemae/ds-grid');
8
+ var dsTooltip = require('@elliemae/ds-tooltip');
9
+ var reactDesc = require('react-desc');
10
+ var reactDescPropTypes = require('./react-desc-prop-types.js');
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
15
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
+
17
+ var _animate;
18
+ const sizeToPx = {
19
+ xs: '16px',
20
+ s: '24px',
21
+ m: '32px',
22
+ l: '48px',
23
+ xl: '56px',
24
+ xxl: '64px'
25
+ };
26
+ const sizeToWeight = {
27
+ xs: '3px',
28
+ s: '3px',
29
+ m: '3px',
30
+ l: '4px',
31
+ xl: '5px',
32
+ xxl: '6px'
33
+ };
34
+ const colorToHex = {
35
+ light: '#FFFFFF',
36
+ dark: '#0F364A'
37
+ };
38
+ const sizeToTextSize = {
39
+ xs: '12px',
40
+ s: '12px',
41
+ m: '12px',
42
+ l: '13px',
43
+ xl: '14px',
44
+ xxl: '16px'
45
+ };
46
+ const DSSquareIndicator = _ref => {
47
+ let {
48
+ size = 'm',
49
+ color = 'dark',
50
+ text = '',
51
+ showText = true,
52
+ withTooltip = false,
53
+ tooltipStartPlacementPreference = 'bottom'
54
+ } = _ref;
55
+ const Wrapper = withTooltip ? dsTooltip.DSTooltipV3 : React__default["default"].Fragment;
56
+ return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
57
+ gutter: "xs",
58
+ justifyContent: "center",
59
+ role: "status"
60
+ }, void 0, /*#__PURE__*/_jsx__default["default"](Wrapper, {
61
+ text: text,
62
+ textAlign: "center",
63
+ startPlacementPreference: tooltipStartPlacementPreference
64
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("svg", {
65
+ width: sizeToPx[size],
66
+ height: sizeToPx[size],
67
+ style: {
68
+ display: 'block',
69
+ margin: 'auto'
70
+ }
71
+ }, void 0, /*#__PURE__*/_jsx__default["default"]("rect", {
72
+ width: "100%",
73
+ height: "100%",
74
+ fill: "transparent",
75
+ strokeWidth: sizeToWeight[size],
76
+ strokeDasharray: "400% 400%",
77
+ stroke: colorToHex[color]
78
+ }, void 0, _animate || (_animate = /*#__PURE__*/_jsx__default["default"]("animate", {
79
+ attributeName: "stroke-dashoffset",
80
+ values: "800%;0",
81
+ keyTimes: "0;1",
82
+ dur: "2.5s",
83
+ repeatCount: "indefinite",
84
+ restart: "always"
85
+ })))), text !== '' && showText && /*#__PURE__*/_jsx__default["default"]("span", {
86
+ style: {
87
+ color: colorToHex[color],
88
+ fontSize: sizeToTextSize[size]
89
+ }
90
+ }, void 0, text)));
91
+ };
92
+ const DSSquareIndicatorWithSchema = reactDesc.describe(DSSquareIndicator);
93
+ DSSquareIndicatorWithSchema.propTypes = reactDescPropTypes.SquareIndicatorPropTypes;
94
+
95
+ exports.DSSquareIndicator = DSSquareIndicator;
96
+ exports.DSSquareIndicatorWithSchema = DSSquareIndicatorWithSchema;
package/cjs/index.js ADDED
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DSSquareIndicator = require('./DSSquareIndicator.js');
6
+
7
+
8
+
9
+ exports.DSSquareIndicator = DSSquareIndicator.DSSquareIndicator;
10
+ exports.DSSquareIndicatorWithSchema = DSSquareIndicator.DSSquareIndicatorWithSchema;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var reactDesc = require('react-desc');
6
+
7
+ /* eslint-disable max-lines */
8
+ const SquareIndicatorPropTypes = {
9
+ size: reactDesc.PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
10
+ color: reactDesc.PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
11
+ text: reactDesc.PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
12
+ showText: reactDesc.PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
13
+ withTooltip: reactDesc.PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
14
+ tooltipStartPlacementPreference: reactDesc.PropTypes.oneOf(['top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']).description('start placement preference for the tooltip').defaultValue('center')
15
+ };
16
+
17
+ exports.SquareIndicatorPropTypes = SquareIndicatorPropTypes;
@@ -0,0 +1,86 @@
1
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import React from 'react';
3
+ import { Grid } from '@elliemae/ds-grid';
4
+ import { DSTooltipV3 } from '@elliemae/ds-tooltip';
5
+ import { describe } from 'react-desc';
6
+ import { SquareIndicatorPropTypes } from './react-desc-prop-types.js';
7
+
8
+ var _animate;
9
+ const sizeToPx = {
10
+ xs: '16px',
11
+ s: '24px',
12
+ m: '32px',
13
+ l: '48px',
14
+ xl: '56px',
15
+ xxl: '64px'
16
+ };
17
+ const sizeToWeight = {
18
+ xs: '3px',
19
+ s: '3px',
20
+ m: '3px',
21
+ l: '4px',
22
+ xl: '5px',
23
+ xxl: '6px'
24
+ };
25
+ const colorToHex = {
26
+ light: '#FFFFFF',
27
+ dark: '#0F364A'
28
+ };
29
+ const sizeToTextSize = {
30
+ xs: '12px',
31
+ s: '12px',
32
+ m: '12px',
33
+ l: '13px',
34
+ xl: '14px',
35
+ xxl: '16px'
36
+ };
37
+ const DSSquareIndicator = _ref => {
38
+ let {
39
+ size = 'm',
40
+ color = 'dark',
41
+ text = '',
42
+ showText = true,
43
+ withTooltip = false,
44
+ tooltipStartPlacementPreference = 'bottom'
45
+ } = _ref;
46
+ const Wrapper = withTooltip ? DSTooltipV3 : React.Fragment;
47
+ return /*#__PURE__*/_jsx(Grid, {
48
+ gutter: "xs",
49
+ justifyContent: "center",
50
+ role: "status"
51
+ }, void 0, /*#__PURE__*/_jsx(Wrapper, {
52
+ text: text,
53
+ textAlign: "center",
54
+ startPlacementPreference: tooltipStartPlacementPreference
55
+ }, void 0, /*#__PURE__*/_jsx("svg", {
56
+ width: sizeToPx[size],
57
+ height: sizeToPx[size],
58
+ style: {
59
+ display: 'block',
60
+ margin: 'auto'
61
+ }
62
+ }, void 0, /*#__PURE__*/_jsx("rect", {
63
+ width: "100%",
64
+ height: "100%",
65
+ fill: "transparent",
66
+ strokeWidth: sizeToWeight[size],
67
+ strokeDasharray: "400% 400%",
68
+ stroke: colorToHex[color]
69
+ }, void 0, _animate || (_animate = /*#__PURE__*/_jsx("animate", {
70
+ attributeName: "stroke-dashoffset",
71
+ values: "800%;0",
72
+ keyTimes: "0;1",
73
+ dur: "2.5s",
74
+ repeatCount: "indefinite",
75
+ restart: "always"
76
+ })))), text !== '' && showText && /*#__PURE__*/_jsx("span", {
77
+ style: {
78
+ color: colorToHex[color],
79
+ fontSize: sizeToTextSize[size]
80
+ }
81
+ }, void 0, text)));
82
+ };
83
+ const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);
84
+ DSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;
85
+
86
+ export { DSSquareIndicator, DSSquareIndicatorWithSchema };
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export { DSSquareIndicator, DSSquareIndicatorWithSchema } from './DSSquareIndicator.js';
@@ -0,0 +1,13 @@
1
+ import { PropTypes } from 'react-desc';
2
+
3
+ /* eslint-disable max-lines */
4
+ const SquareIndicatorPropTypes = {
5
+ size: PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
6
+ color: PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
7
+ text: PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
8
+ showText: PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
9
+ withTooltip: PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
10
+ tooltipStartPlacementPreference: PropTypes.oneOf(['top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']).description('start placement preference for the tooltip').defaultValue('center')
11
+ };
12
+
13
+ export { SquareIndicatorPropTypes };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@elliemae/ds-square-indicator",
3
+ "version": "2.2.0-next.4",
4
+ "license": "MIT",
5
+ "description": "ICE MT - Dimsum - Indeterminate Progress Indicator",
6
+ "module": "./esm/index.js",
7
+ "main": "./cjs/index.js",
8
+ "types": "./types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./esm/index.js",
12
+ "require": "./cjs/index.js"
13
+ },
14
+ "./react-desc-prop-types": {
15
+ "import": "./esm/react-desc-prop-types.js",
16
+ "require": "./cjs/react-desc-prop-types.js"
17
+ },
18
+ "./DSSquareIndicator": {
19
+ "import": "./esm/DSSquareIndicator.js",
20
+ "require": "./cjs/DSSquareIndicator.js"
21
+ }
22
+ },
23
+ "sideEffects": [
24
+ "*.css",
25
+ "*.scss"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://git.elliemae.io/platform-ui/dimsum.git"
30
+ },
31
+ "engines": {
32
+ "npm": ">=7",
33
+ "node": ">=14"
34
+ },
35
+ "author": "ICE MT",
36
+ "scripts": {
37
+ "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
38
+ "prebuild": "exit 0",
39
+ "predev": "exit 0",
40
+ "build": "node ../../scripts/build/build.js"
41
+ },
42
+ "dependencies": {
43
+ "@elliemae/ds-grid": "2.2.0-next.1",
44
+ "react-desc": "~4.1.3"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "^17.0.2",
48
+ "react-dom": "^17.0.2"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public",
52
+ "directory": "dist",
53
+ "generateSubmodules": true
54
+ }
55
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
2
+ import React from 'react';
3
+ import { DSSquareIndicatorT } from './react-desc-prop-types';
4
+ export declare const DSSquareIndicator: React.ComponentType<DSSquareIndicatorT.Props>;
5
+ export declare const DSSquareIndicatorWithSchema: {
6
+ (props?: React.PropsWithChildren<DSSquareIndicatorT.Props> | undefined): JSX.Element;
7
+ propTypes: unknown;
8
+ toTypescript: () => import("react-desc").TypescriptSchema;
9
+ };
@@ -0,0 +1 @@
1
+ export * from './DSSquareIndicator';
@@ -0,0 +1,31 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
2
+ export declare namespace DSSquareIndicatorT {
3
+ interface Props {
4
+ size?: 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
5
+ color?: 'light' | 'dark';
6
+ text?: string;
7
+ showText?: boolean;
8
+ withTooltip: boolean;
9
+ tooltipStartPlacementPreference?: 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start';
10
+ }
11
+ }
12
+ export declare const SquareIndicatorPropTypes: {
13
+ size: {
14
+ deprecated: import("react-desc").PropTypesDescValidator;
15
+ };
16
+ color: {
17
+ deprecated: import("react-desc").PropTypesDescValidator;
18
+ };
19
+ text: {
20
+ deprecated: import("react-desc").PropTypesDescValidator;
21
+ };
22
+ showText: {
23
+ deprecated: import("react-desc").PropTypesDescValidator;
24
+ };
25
+ withTooltip: {
26
+ deprecated: import("react-desc").PropTypesDescValidator;
27
+ };
28
+ tooltipStartPlacementPreference: {
29
+ deprecated: import("react-desc").PropTypesDescValidator;
30
+ };
31
+ };