@elliemae/ds-square-indicator 2.3.0-alpha.8 → 2.3.0-next.10
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/cjs/DSSquareIndicator.js +169 -0
- package/cjs/constants.js +37 -0
- package/cjs/index.js +10 -0
- package/cjs/react-desc-prop-types.js +39 -0
- package/cjs/styled.js +86 -0
- package/esm/DSSquareIndicator.js +159 -0
- package/esm/constants.js +30 -0
- package/esm/index.js +1 -0
- package/esm/react-desc-prop-types.js +30 -0
- package/esm/styled.js +74 -0
- package/package.json +31 -25
- package/types/DSSquareIndicator.d.ts +4 -0
- package/types/constants.d.ts +28 -0
- package/types/index.d.ts +1 -0
- package/types/react-desc-prop-types.d.ts +14 -0
- package/types/styled.d.ts +10 -0
- package/dist/cjs/DSSquareIndicator.js +0 -111
- package/dist/cjs/DSSquareIndicator.js.map +0 -7
- package/dist/cjs/index.js +0 -36
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/react-desc-prop-types.js +0 -56
- package/dist/cjs/react-desc-prop-types.js.map +0 -7
- package/dist/esm/DSSquareIndicator.js +0 -82
- package/dist/esm/DSSquareIndicator.js.map +0 -7
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/react-desc-prop-types.js +0 -27
- package/dist/esm/react-desc-prop-types.js.map +0 -7
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var react = require('react');
|
|
13
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
14
|
+
var dsTooltip = require('@elliemae/ds-tooltip');
|
|
15
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
16
|
+
var uid = require('uid');
|
|
17
|
+
var reactDescPropTypes = require('./react-desc-prop-types.js');
|
|
18
|
+
var styled = require('./styled.js');
|
|
19
|
+
var constants = require('./constants.js');
|
|
20
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
21
|
+
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
+
|
|
24
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
+
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
26
|
+
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
+
const DSSquareIndicator = props => {
|
|
31
|
+
const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props, reactDescPropTypes.defaultProps);
|
|
32
|
+
const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault);
|
|
33
|
+
const {
|
|
34
|
+
size,
|
|
35
|
+
color,
|
|
36
|
+
text,
|
|
37
|
+
showText,
|
|
38
|
+
withTooltip,
|
|
39
|
+
tooltipStartPlacementPreference,
|
|
40
|
+
__duration
|
|
41
|
+
} = propsWithDefault;
|
|
42
|
+
const Wrapper = react.useMemo(() => withTooltip ? dsTooltip.DSTooltipV3 : _ref => {
|
|
43
|
+
let {
|
|
44
|
+
children
|
|
45
|
+
} = _ref;
|
|
46
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
49
|
+
}, [withTooltip]);
|
|
50
|
+
const uniqueId = react.useMemo(() => uid.uid(16), []);
|
|
51
|
+
const paddedCoordinate = react.useMemo(() => "calc(100% - ".concat(constants.sizeToWeight[size], ")"), [size]);
|
|
52
|
+
const hexColor = react.useMemo(() => constants.colorToHex[color], [color]);
|
|
53
|
+
return /*#__PURE__*/jsxRuntime.jsx(dsGrid.Grid, _objectSpread(_objectSpread({
|
|
54
|
+
gutter: "xs",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
role: "status"
|
|
57
|
+
}, globalAttributes), {}, {
|
|
58
|
+
children: /*#__PURE__*/_jsx2__default["default"](Wrapper, {
|
|
59
|
+
text: text,
|
|
60
|
+
textAlign: "center",
|
|
61
|
+
startPlacementPreference: tooltipStartPlacementPreference
|
|
62
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("svg", {
|
|
63
|
+
width: constants.sizeToPx[size],
|
|
64
|
+
height: constants.sizeToPx[size],
|
|
65
|
+
style: {
|
|
66
|
+
display: 'block',
|
|
67
|
+
margin: 'auto'
|
|
68
|
+
}
|
|
69
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("defs", {}, void 0, /*#__PURE__*/_jsx2__default["default"]("linearGradient", {
|
|
70
|
+
id: "".concat(uniqueId, "-lg1"),
|
|
71
|
+
x1: "0",
|
|
72
|
+
y1: "0",
|
|
73
|
+
x2: "0",
|
|
74
|
+
y2: "100%"
|
|
75
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
76
|
+
offset: "20%",
|
|
77
|
+
stopColor: "".concat(hexColor, "FF")
|
|
78
|
+
}), /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
79
|
+
offset: "80%",
|
|
80
|
+
stopColor: "".concat(hexColor, "00")
|
|
81
|
+
})), /*#__PURE__*/_jsx2__default["default"]("linearGradient", {
|
|
82
|
+
id: "".concat(uniqueId, "-lg2"),
|
|
83
|
+
x1: "0",
|
|
84
|
+
y1: "0",
|
|
85
|
+
x2: "100%",
|
|
86
|
+
y2: "0"
|
|
87
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
88
|
+
offset: "10%",
|
|
89
|
+
stopColor: "".concat(hexColor, "00")
|
|
90
|
+
}), /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
91
|
+
offset: "50%",
|
|
92
|
+
stopColor: "".concat(hexColor, "FF")
|
|
93
|
+
})), /*#__PURE__*/_jsx2__default["default"]("linearGradient", {
|
|
94
|
+
id: "".concat(uniqueId, "-lg3"),
|
|
95
|
+
x1: "0",
|
|
96
|
+
y1: "0",
|
|
97
|
+
x2: "0",
|
|
98
|
+
y2: "100%"
|
|
99
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
100
|
+
offset: "10%",
|
|
101
|
+
stopColor: "".concat(hexColor, "00")
|
|
102
|
+
}), /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
103
|
+
offset: "50%",
|
|
104
|
+
stopColor: "".concat(hexColor, "FF")
|
|
105
|
+
})), /*#__PURE__*/_jsx2__default["default"]("linearGradient", {
|
|
106
|
+
id: "".concat(uniqueId, "-lg4"),
|
|
107
|
+
x1: "0",
|
|
108
|
+
y1: "0",
|
|
109
|
+
x2: "100%",
|
|
110
|
+
y2: "0"
|
|
111
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
112
|
+
offset: "50%",
|
|
113
|
+
stopColor: "".concat(hexColor, "FF")
|
|
114
|
+
}), /*#__PURE__*/_jsx2__default["default"]("stop", {
|
|
115
|
+
offset: "90%",
|
|
116
|
+
stopColor: "".concat(hexColor, "00")
|
|
117
|
+
})), /*#__PURE__*/_jsx2__default["default"]("clipPath", {
|
|
118
|
+
id: "".concat(uniqueId, "-lcp1")
|
|
119
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("rect", {
|
|
120
|
+
x: constants.sizeToWeight[size],
|
|
121
|
+
y: 0,
|
|
122
|
+
width: "100%",
|
|
123
|
+
height: constants.sizeToWeight[size]
|
|
124
|
+
})), /*#__PURE__*/_jsx2__default["default"]("clipPath", {
|
|
125
|
+
id: "".concat(uniqueId, "-lcp2")
|
|
126
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("rect", {
|
|
127
|
+
x: paddedCoordinate,
|
|
128
|
+
y: constants.sizeToWeight[size],
|
|
129
|
+
width: constants.sizeToWeight[size],
|
|
130
|
+
height: "100%"
|
|
131
|
+
})), /*#__PURE__*/_jsx2__default["default"]("clipPath", {
|
|
132
|
+
id: "".concat(uniqueId, "-lcp3")
|
|
133
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"]("rect", {
|
|
134
|
+
x: 0,
|
|
135
|
+
y: paddedCoordinate,
|
|
136
|
+
width: paddedCoordinate,
|
|
137
|
+
height: constants.sizeToWeight[size]
|
|
138
|
+
}))), /*#__PURE__*/_jsx2__default["default"](styled.StyledLineLeft, {
|
|
139
|
+
size: size,
|
|
140
|
+
__duration: __duration,
|
|
141
|
+
fill: "url(#".concat(uniqueId, "-lg1)")
|
|
142
|
+
}), /*#__PURE__*/_jsx2__default["default"](styled.StyledLineTop, {
|
|
143
|
+
size: size,
|
|
144
|
+
__duration: __duration,
|
|
145
|
+
fill: "url(#".concat(uniqueId, "-lg2)"),
|
|
146
|
+
clipPath: "url(#".concat(uniqueId, "-lcp1)")
|
|
147
|
+
}), /*#__PURE__*/_jsx2__default["default"](styled.StyledLineRight, {
|
|
148
|
+
size: size,
|
|
149
|
+
__duration: __duration,
|
|
150
|
+
fill: "url(#".concat(uniqueId, "-lg3)"),
|
|
151
|
+
clipPath: "url(#".concat(uniqueId, "-lcp2)")
|
|
152
|
+
}), /*#__PURE__*/_jsx2__default["default"](styled.StyledLineBottom, {
|
|
153
|
+
size: size,
|
|
154
|
+
__duration: __duration,
|
|
155
|
+
fill: "url(#".concat(uniqueId, "-lg4)"),
|
|
156
|
+
clipPath: "url(#".concat(uniqueId, "-lcp3)")
|
|
157
|
+
})), text !== '' && showText && /*#__PURE__*/_jsx2__default["default"]("span", {
|
|
158
|
+
style: {
|
|
159
|
+
color: constants.colorToHex[color],
|
|
160
|
+
fontSize: constants.sizeToTextSize[size]
|
|
161
|
+
}
|
|
162
|
+
}, void 0, text))
|
|
163
|
+
}));
|
|
164
|
+
};
|
|
165
|
+
const DSSquareIndicatorWithSchema = dsPropsHelpers.describe(DSSquareIndicator);
|
|
166
|
+
DSSquareIndicatorWithSchema.propTypes = reactDescPropTypes.SquareIndicatorPropTypes;
|
|
167
|
+
|
|
168
|
+
exports.DSSquareIndicator = DSSquareIndicator;
|
|
169
|
+
exports.DSSquareIndicatorWithSchema = DSSquareIndicatorWithSchema;
|
package/cjs/constants.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const sizeToPx = {
|
|
6
|
+
xs: '16px',
|
|
7
|
+
s: '24px',
|
|
8
|
+
m: '32px',
|
|
9
|
+
l: '48px',
|
|
10
|
+
xl: '56px',
|
|
11
|
+
xxl: '64px'
|
|
12
|
+
};
|
|
13
|
+
const sizeToWeight = {
|
|
14
|
+
xs: '3px',
|
|
15
|
+
s: '3px',
|
|
16
|
+
m: '3px',
|
|
17
|
+
l: '4px',
|
|
18
|
+
xl: '5px',
|
|
19
|
+
xxl: '6px'
|
|
20
|
+
};
|
|
21
|
+
const colorToHex = {
|
|
22
|
+
light: '#FFFFFF',
|
|
23
|
+
dark: '#0F364A'
|
|
24
|
+
};
|
|
25
|
+
const sizeToTextSize = {
|
|
26
|
+
xs: '12px',
|
|
27
|
+
s: '12px',
|
|
28
|
+
m: '12px',
|
|
29
|
+
l: '13px',
|
|
30
|
+
xl: '14px',
|
|
31
|
+
xxl: '16px'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.colorToHex = colorToHex;
|
|
35
|
+
exports.sizeToPx = sizeToPx;
|
|
36
|
+
exports.sizeToTextSize = sizeToTextSize;
|
|
37
|
+
exports.sizeToWeight = sizeToWeight;
|
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,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
|
+
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
+
const SquareIndicatorPropTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
|
|
21
|
+
size: dsPropsHelpers.PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
|
|
22
|
+
color: dsPropsHelpers.PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
|
|
23
|
+
text: dsPropsHelpers.PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
|
|
24
|
+
showText: dsPropsHelpers.PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
|
|
25
|
+
withTooltip: dsPropsHelpers.PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
|
|
26
|
+
tooltipStartPlacementPreference: dsPropsHelpers.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')
|
|
27
|
+
});
|
|
28
|
+
const defaultProps = {
|
|
29
|
+
size: 'm',
|
|
30
|
+
color: 'dark',
|
|
31
|
+
text: '',
|
|
32
|
+
showText: true,
|
|
33
|
+
withTooltip: false,
|
|
34
|
+
tooltipStartPlacementPreference: 'bottom',
|
|
35
|
+
__duration: 2.5
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.SquareIndicatorPropTypes = SquareIndicatorPropTypes;
|
|
39
|
+
exports.defaultProps = defaultProps;
|
package/cjs/styled.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
|
+
var styled = require('styled-components');
|
|
7
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
8
|
+
var constants = require('./constants.js');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
13
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
14
|
+
|
|
15
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
16
|
+
const lineLeftAnimation = dsSystem.kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\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"])));
|
|
17
|
+
const lineTopAnimation = dsSystem.kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\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"])));
|
|
18
|
+
const lineRightAnimation = dsSystem.kfrm(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\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"])));
|
|
19
|
+
const lineBottomAnimation = dsSystem.kfrm(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\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"])));
|
|
20
|
+
const StyledLineLeft = /*#__PURE__*/styled__default["default"].rect.withConfig({
|
|
21
|
+
componentId: "sc-df9quy-0"
|
|
22
|
+
})(["x:0;y:0%;width:", ";height:100%;animation:", " ", "s linear 0s infinite;"], _ref => {
|
|
23
|
+
let {
|
|
24
|
+
size
|
|
25
|
+
} = _ref;
|
|
26
|
+
return constants.sizeToWeight[size];
|
|
27
|
+
}, lineLeftAnimation, _ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
__duration
|
|
30
|
+
} = _ref2;
|
|
31
|
+
return __duration;
|
|
32
|
+
});
|
|
33
|
+
const StyledLineTop = /*#__PURE__*/styled__default["default"].rect.withConfig({
|
|
34
|
+
componentId: "sc-df9quy-1"
|
|
35
|
+
})(["x:-100%;y:0;width:200%;height:", ";animation:", " ", "s linear 0s infinite;"], _ref3 => {
|
|
36
|
+
let {
|
|
37
|
+
size
|
|
38
|
+
} = _ref3;
|
|
39
|
+
return constants.sizeToWeight[size];
|
|
40
|
+
}, lineTopAnimation, _ref4 => {
|
|
41
|
+
let {
|
|
42
|
+
__duration
|
|
43
|
+
} = _ref4;
|
|
44
|
+
return __duration;
|
|
45
|
+
});
|
|
46
|
+
const StyledLineRight = /*#__PURE__*/styled__default["default"].rect.withConfig({
|
|
47
|
+
componentId: "sc-df9quy-2"
|
|
48
|
+
})(["x:calc(100% - ", ");y:-100%;width:", ";height:200%;animation:", " ", "s linear 0s infinite;"], _ref5 => {
|
|
49
|
+
let {
|
|
50
|
+
size
|
|
51
|
+
} = _ref5;
|
|
52
|
+
return constants.sizeToWeight[size];
|
|
53
|
+
}, _ref6 => {
|
|
54
|
+
let {
|
|
55
|
+
size
|
|
56
|
+
} = _ref6;
|
|
57
|
+
return constants.sizeToWeight[size];
|
|
58
|
+
}, lineRightAnimation, _ref7 => {
|
|
59
|
+
let {
|
|
60
|
+
__duration
|
|
61
|
+
} = _ref7;
|
|
62
|
+
return __duration;
|
|
63
|
+
});
|
|
64
|
+
const StyledLineBottom = /*#__PURE__*/styled__default["default"].rect.withConfig({
|
|
65
|
+
componentId: "sc-df9quy-3"
|
|
66
|
+
})(["x:0%;y:calc(100% - ", ");width:200%;height:", ";animation:", " ", "s linear 0s infinite;"], _ref8 => {
|
|
67
|
+
let {
|
|
68
|
+
size
|
|
69
|
+
} = _ref8;
|
|
70
|
+
return constants.sizeToWeight[size];
|
|
71
|
+
}, _ref9 => {
|
|
72
|
+
let {
|
|
73
|
+
size
|
|
74
|
+
} = _ref9;
|
|
75
|
+
return constants.sizeToWeight[size];
|
|
76
|
+
}, lineBottomAnimation, _ref10 => {
|
|
77
|
+
let {
|
|
78
|
+
__duration
|
|
79
|
+
} = _ref10;
|
|
80
|
+
return __duration;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
exports.StyledLineBottom = StyledLineBottom;
|
|
84
|
+
exports.StyledLineLeft = StyledLineLeft;
|
|
85
|
+
exports.StyledLineRight = StyledLineRight;
|
|
86
|
+
exports.StyledLineTop = StyledLineTop;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import { useMemo } from 'react';
|
|
9
|
+
import { Grid } from '@elliemae/ds-grid';
|
|
10
|
+
import { DSTooltipV3 } from '@elliemae/ds-tooltip';
|
|
11
|
+
import { describe, useMemoMergePropsWithDefault, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
|
|
12
|
+
import { uid } from 'uid';
|
|
13
|
+
import { SquareIndicatorPropTypes, defaultProps } from './react-desc-prop-types.js';
|
|
14
|
+
import { StyledLineLeft, StyledLineTop, StyledLineRight, StyledLineBottom } from './styled.js';
|
|
15
|
+
import { sizeToWeight, colorToHex, sizeToPx, sizeToTextSize } from './constants.js';
|
|
16
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
const DSSquareIndicator = props => {
|
|
22
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
23
|
+
const globalAttributes = useGetGlobalAttributes(propsWithDefault);
|
|
24
|
+
const {
|
|
25
|
+
size,
|
|
26
|
+
color,
|
|
27
|
+
text,
|
|
28
|
+
showText,
|
|
29
|
+
withTooltip,
|
|
30
|
+
tooltipStartPlacementPreference,
|
|
31
|
+
__duration
|
|
32
|
+
} = propsWithDefault;
|
|
33
|
+
const Wrapper = useMemo(() => withTooltip ? DSTooltipV3 : _ref => {
|
|
34
|
+
let {
|
|
35
|
+
children
|
|
36
|
+
} = _ref;
|
|
37
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
}, [withTooltip]);
|
|
41
|
+
const uniqueId = useMemo(() => uid(16), []);
|
|
42
|
+
const paddedCoordinate = useMemo(() => "calc(100% - ".concat(sizeToWeight[size], ")"), [size]);
|
|
43
|
+
const hexColor = useMemo(() => colorToHex[color], [color]);
|
|
44
|
+
return /*#__PURE__*/jsx(Grid, _objectSpread(_objectSpread({
|
|
45
|
+
gutter: "xs",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
role: "status"
|
|
48
|
+
}, globalAttributes), {}, {
|
|
49
|
+
children: /*#__PURE__*/_jsx2(Wrapper, {
|
|
50
|
+
text: text,
|
|
51
|
+
textAlign: "center",
|
|
52
|
+
startPlacementPreference: tooltipStartPlacementPreference
|
|
53
|
+
}, void 0, /*#__PURE__*/_jsx2("svg", {
|
|
54
|
+
width: sizeToPx[size],
|
|
55
|
+
height: sizeToPx[size],
|
|
56
|
+
style: {
|
|
57
|
+
display: 'block',
|
|
58
|
+
margin: 'auto'
|
|
59
|
+
}
|
|
60
|
+
}, void 0, /*#__PURE__*/_jsx2("defs", {}, void 0, /*#__PURE__*/_jsx2("linearGradient", {
|
|
61
|
+
id: "".concat(uniqueId, "-lg1"),
|
|
62
|
+
x1: "0",
|
|
63
|
+
y1: "0",
|
|
64
|
+
x2: "0",
|
|
65
|
+
y2: "100%"
|
|
66
|
+
}, void 0, /*#__PURE__*/_jsx2("stop", {
|
|
67
|
+
offset: "20%",
|
|
68
|
+
stopColor: "".concat(hexColor, "FF")
|
|
69
|
+
}), /*#__PURE__*/_jsx2("stop", {
|
|
70
|
+
offset: "80%",
|
|
71
|
+
stopColor: "".concat(hexColor, "00")
|
|
72
|
+
})), /*#__PURE__*/_jsx2("linearGradient", {
|
|
73
|
+
id: "".concat(uniqueId, "-lg2"),
|
|
74
|
+
x1: "0",
|
|
75
|
+
y1: "0",
|
|
76
|
+
x2: "100%",
|
|
77
|
+
y2: "0"
|
|
78
|
+
}, void 0, /*#__PURE__*/_jsx2("stop", {
|
|
79
|
+
offset: "10%",
|
|
80
|
+
stopColor: "".concat(hexColor, "00")
|
|
81
|
+
}), /*#__PURE__*/_jsx2("stop", {
|
|
82
|
+
offset: "50%",
|
|
83
|
+
stopColor: "".concat(hexColor, "FF")
|
|
84
|
+
})), /*#__PURE__*/_jsx2("linearGradient", {
|
|
85
|
+
id: "".concat(uniqueId, "-lg3"),
|
|
86
|
+
x1: "0",
|
|
87
|
+
y1: "0",
|
|
88
|
+
x2: "0",
|
|
89
|
+
y2: "100%"
|
|
90
|
+
}, void 0, /*#__PURE__*/_jsx2("stop", {
|
|
91
|
+
offset: "10%",
|
|
92
|
+
stopColor: "".concat(hexColor, "00")
|
|
93
|
+
}), /*#__PURE__*/_jsx2("stop", {
|
|
94
|
+
offset: "50%",
|
|
95
|
+
stopColor: "".concat(hexColor, "FF")
|
|
96
|
+
})), /*#__PURE__*/_jsx2("linearGradient", {
|
|
97
|
+
id: "".concat(uniqueId, "-lg4"),
|
|
98
|
+
x1: "0",
|
|
99
|
+
y1: "0",
|
|
100
|
+
x2: "100%",
|
|
101
|
+
y2: "0"
|
|
102
|
+
}, void 0, /*#__PURE__*/_jsx2("stop", {
|
|
103
|
+
offset: "50%",
|
|
104
|
+
stopColor: "".concat(hexColor, "FF")
|
|
105
|
+
}), /*#__PURE__*/_jsx2("stop", {
|
|
106
|
+
offset: "90%",
|
|
107
|
+
stopColor: "".concat(hexColor, "00")
|
|
108
|
+
})), /*#__PURE__*/_jsx2("clipPath", {
|
|
109
|
+
id: "".concat(uniqueId, "-lcp1")
|
|
110
|
+
}, void 0, /*#__PURE__*/_jsx2("rect", {
|
|
111
|
+
x: sizeToWeight[size],
|
|
112
|
+
y: 0,
|
|
113
|
+
width: "100%",
|
|
114
|
+
height: sizeToWeight[size]
|
|
115
|
+
})), /*#__PURE__*/_jsx2("clipPath", {
|
|
116
|
+
id: "".concat(uniqueId, "-lcp2")
|
|
117
|
+
}, void 0, /*#__PURE__*/_jsx2("rect", {
|
|
118
|
+
x: paddedCoordinate,
|
|
119
|
+
y: sizeToWeight[size],
|
|
120
|
+
width: sizeToWeight[size],
|
|
121
|
+
height: "100%"
|
|
122
|
+
})), /*#__PURE__*/_jsx2("clipPath", {
|
|
123
|
+
id: "".concat(uniqueId, "-lcp3")
|
|
124
|
+
}, void 0, /*#__PURE__*/_jsx2("rect", {
|
|
125
|
+
x: 0,
|
|
126
|
+
y: paddedCoordinate,
|
|
127
|
+
width: paddedCoordinate,
|
|
128
|
+
height: sizeToWeight[size]
|
|
129
|
+
}))), /*#__PURE__*/_jsx2(StyledLineLeft, {
|
|
130
|
+
size: size,
|
|
131
|
+
__duration: __duration,
|
|
132
|
+
fill: "url(#".concat(uniqueId, "-lg1)")
|
|
133
|
+
}), /*#__PURE__*/_jsx2(StyledLineTop, {
|
|
134
|
+
size: size,
|
|
135
|
+
__duration: __duration,
|
|
136
|
+
fill: "url(#".concat(uniqueId, "-lg2)"),
|
|
137
|
+
clipPath: "url(#".concat(uniqueId, "-lcp1)")
|
|
138
|
+
}), /*#__PURE__*/_jsx2(StyledLineRight, {
|
|
139
|
+
size: size,
|
|
140
|
+
__duration: __duration,
|
|
141
|
+
fill: "url(#".concat(uniqueId, "-lg3)"),
|
|
142
|
+
clipPath: "url(#".concat(uniqueId, "-lcp2)")
|
|
143
|
+
}), /*#__PURE__*/_jsx2(StyledLineBottom, {
|
|
144
|
+
size: size,
|
|
145
|
+
__duration: __duration,
|
|
146
|
+
fill: "url(#".concat(uniqueId, "-lg4)"),
|
|
147
|
+
clipPath: "url(#".concat(uniqueId, "-lcp3)")
|
|
148
|
+
})), text !== '' && showText && /*#__PURE__*/_jsx2("span", {
|
|
149
|
+
style: {
|
|
150
|
+
color: colorToHex[color],
|
|
151
|
+
fontSize: sizeToTextSize[size]
|
|
152
|
+
}
|
|
153
|
+
}, void 0, text))
|
|
154
|
+
}));
|
|
155
|
+
};
|
|
156
|
+
const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);
|
|
157
|
+
DSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;
|
|
158
|
+
|
|
159
|
+
export { DSSquareIndicator, DSSquareIndicatorWithSchema };
|
package/esm/constants.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const sizeToPx = {
|
|
2
|
+
xs: '16px',
|
|
3
|
+
s: '24px',
|
|
4
|
+
m: '32px',
|
|
5
|
+
l: '48px',
|
|
6
|
+
xl: '56px',
|
|
7
|
+
xxl: '64px'
|
|
8
|
+
};
|
|
9
|
+
const sizeToWeight = {
|
|
10
|
+
xs: '3px',
|
|
11
|
+
s: '3px',
|
|
12
|
+
m: '3px',
|
|
13
|
+
l: '4px',
|
|
14
|
+
xl: '5px',
|
|
15
|
+
xxl: '6px'
|
|
16
|
+
};
|
|
17
|
+
const colorToHex = {
|
|
18
|
+
light: '#FFFFFF',
|
|
19
|
+
dark: '#0F364A'
|
|
20
|
+
};
|
|
21
|
+
const sizeToTextSize = {
|
|
22
|
+
xs: '12px',
|
|
23
|
+
s: '12px',
|
|
24
|
+
m: '12px',
|
|
25
|
+
l: '13px',
|
|
26
|
+
xl: '14px',
|
|
27
|
+
xxl: '16px'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { colorToHex, sizeToPx, sizeToTextSize, sizeToWeight };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DSSquareIndicator, DSSquareIndicatorWithSchema } from './DSSquareIndicator.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import { PropTypes, globalAttributesPropTypes } from '@elliemae/ds-props-helpers';
|
|
8
|
+
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
const SquareIndicatorPropTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}, {
|
|
13
|
+
size: PropTypes.oneOf(['xs', 's', 'm', 'l', 'xl', 'xxl']).description('Size of the indicator').defaultValue('m'),
|
|
14
|
+
color: PropTypes.oneOf(['light', 'dark']).description('Color mode for the indicator').defaultValue('dark'),
|
|
15
|
+
text: PropTypes.string.description('Optional text to show under the indicator').defaultValue(''),
|
|
16
|
+
showText: PropTypes.bool.description('Whether to show the optional text or not').defaultValue(true),
|
|
17
|
+
withTooltip: PropTypes.bool.description('Whether to include a tooltip that shows the optional text on hover').defaultValue(false),
|
|
18
|
+
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')
|
|
19
|
+
});
|
|
20
|
+
const defaultProps = {
|
|
21
|
+
size: 'm',
|
|
22
|
+
color: 'dark',
|
|
23
|
+
text: '',
|
|
24
|
+
showText: true,
|
|
25
|
+
withTooltip: false,
|
|
26
|
+
tooltipStartPlacementPreference: 'bottom',
|
|
27
|
+
__duration: 2.5
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { SquareIndicatorPropTypes, defaultProps };
|
package/esm/styled.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { kfrm } from '@elliemae/ds-system';
|
|
4
|
+
import { sizeToWeight } from './constants.js';
|
|
5
|
+
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
7
|
+
const lineLeftAnimation = kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
|
|
8
|
+
const lineTopAnimation = kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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"])));
|
|
9
|
+
const lineRightAnimation = kfrm(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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"])));
|
|
10
|
+
const lineBottomAnimation = kfrm(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\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"])));
|
|
11
|
+
const StyledLineLeft = /*#__PURE__*/styled.rect.withConfig({
|
|
12
|
+
componentId: "sc-df9quy-0"
|
|
13
|
+
})(["x:0;y:0%;width:", ";height:100%;animation:", " ", "s linear 0s infinite;"], _ref => {
|
|
14
|
+
let {
|
|
15
|
+
size
|
|
16
|
+
} = _ref;
|
|
17
|
+
return sizeToWeight[size];
|
|
18
|
+
}, lineLeftAnimation, _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
__duration
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return __duration;
|
|
23
|
+
});
|
|
24
|
+
const StyledLineTop = /*#__PURE__*/styled.rect.withConfig({
|
|
25
|
+
componentId: "sc-df9quy-1"
|
|
26
|
+
})(["x:-100%;y:0;width:200%;height:", ";animation:", " ", "s linear 0s infinite;"], _ref3 => {
|
|
27
|
+
let {
|
|
28
|
+
size
|
|
29
|
+
} = _ref3;
|
|
30
|
+
return sizeToWeight[size];
|
|
31
|
+
}, lineTopAnimation, _ref4 => {
|
|
32
|
+
let {
|
|
33
|
+
__duration
|
|
34
|
+
} = _ref4;
|
|
35
|
+
return __duration;
|
|
36
|
+
});
|
|
37
|
+
const StyledLineRight = /*#__PURE__*/styled.rect.withConfig({
|
|
38
|
+
componentId: "sc-df9quy-2"
|
|
39
|
+
})(["x:calc(100% - ", ");y:-100%;width:", ";height:200%;animation:", " ", "s linear 0s infinite;"], _ref5 => {
|
|
40
|
+
let {
|
|
41
|
+
size
|
|
42
|
+
} = _ref5;
|
|
43
|
+
return sizeToWeight[size];
|
|
44
|
+
}, _ref6 => {
|
|
45
|
+
let {
|
|
46
|
+
size
|
|
47
|
+
} = _ref6;
|
|
48
|
+
return sizeToWeight[size];
|
|
49
|
+
}, lineRightAnimation, _ref7 => {
|
|
50
|
+
let {
|
|
51
|
+
__duration
|
|
52
|
+
} = _ref7;
|
|
53
|
+
return __duration;
|
|
54
|
+
});
|
|
55
|
+
const StyledLineBottom = /*#__PURE__*/styled.rect.withConfig({
|
|
56
|
+
componentId: "sc-df9quy-3"
|
|
57
|
+
})(["x:0%;y:calc(100% - ", ");width:200%;height:", ";animation:", " ", "s linear 0s infinite;"], _ref8 => {
|
|
58
|
+
let {
|
|
59
|
+
size
|
|
60
|
+
} = _ref8;
|
|
61
|
+
return sizeToWeight[size];
|
|
62
|
+
}, _ref9 => {
|
|
63
|
+
let {
|
|
64
|
+
size
|
|
65
|
+
} = _ref9;
|
|
66
|
+
return sizeToWeight[size];
|
|
67
|
+
}, lineBottomAnimation, _ref10 => {
|
|
68
|
+
let {
|
|
69
|
+
__duration
|
|
70
|
+
} = _ref10;
|
|
71
|
+
return __duration;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export { StyledLineBottom, StyledLineLeft, StyledLineRight, StyledLineTop };
|
package/package.json
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-square-indicator",
|
|
3
|
-
"version": "2.3.0-
|
|
3
|
+
"version": "2.3.0-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Indeterminate Progress Indicator",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"module": "./dist/esm/index.js",
|
|
10
|
-
"main": "./dist/cjs/index.js",
|
|
11
|
-
"types": "./dist/types/index.d.ts",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
12
9
|
"exports": {
|
|
13
10
|
".": {
|
|
14
|
-
"import": "./
|
|
15
|
-
"require": "./
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./styled": {
|
|
15
|
+
"import": "./esm/styled.js",
|
|
16
|
+
"require": "./cjs/styled.js"
|
|
16
17
|
},
|
|
17
18
|
"./react-desc-prop-types": {
|
|
18
|
-
"import": "./
|
|
19
|
-
"require": "./
|
|
19
|
+
"import": "./esm/react-desc-prop-types.js",
|
|
20
|
+
"require": "./cjs/react-desc-prop-types.js"
|
|
20
21
|
},
|
|
21
22
|
"./DSSquareIndicator": {
|
|
22
|
-
"import": "./
|
|
23
|
-
"require": "./
|
|
23
|
+
"import": "./esm/DSSquareIndicator.js",
|
|
24
|
+
"require": "./cjs/DSSquareIndicator.js"
|
|
25
|
+
},
|
|
26
|
+
"./constants": {
|
|
27
|
+
"import": "./esm/constants.js",
|
|
28
|
+
"require": "./cjs/constants.js"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"sideEffects": [
|
|
@@ -32,14 +37,20 @@
|
|
|
32
37
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
33
38
|
},
|
|
34
39
|
"engines": {
|
|
35
|
-
"
|
|
36
|
-
"node": ">=
|
|
40
|
+
"npm": ">=7",
|
|
41
|
+
"node": ">=14"
|
|
37
42
|
},
|
|
38
43
|
"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"
|
|
49
|
+
},
|
|
39
50
|
"dependencies": {
|
|
40
|
-
"@elliemae/ds-grid": "2.3.0-
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"
|
|
51
|
+
"@elliemae/ds-grid": "2.3.0-next.10",
|
|
52
|
+
"@elliemae/ds-props-helpers": "2.3.0-next.10",
|
|
53
|
+
"uid": "~2.0.0"
|
|
43
54
|
},
|
|
44
55
|
"peerDependencies": {
|
|
45
56
|
"react": "^17.0.2",
|
|
@@ -47,12 +58,7 @@
|
|
|
47
58
|
},
|
|
48
59
|
"publishConfig": {
|
|
49
60
|
"access": "public",
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"scripts": {
|
|
53
|
-
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
54
|
-
"prebuild": "exit 0",
|
|
55
|
-
"predev": "exit 0",
|
|
56
|
-
"build": "node ../../scripts/build/build.js"
|
|
61
|
+
"directory": "dist",
|
|
62
|
+
"generateSubmodules": true
|
|
57
63
|
}
|
|
58
64
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DSSquareIndicatorT } from './react-desc-prop-types';
|
|
3
|
+
export declare const DSSquareIndicator: React.ComponentType<DSSquareIndicatorT.Props>;
|
|
4
|
+
export declare const DSSquareIndicatorWithSchema: import("@elliemae/ds-props-helpers/types/propTypes/types").DocumentedReactComponent<DSSquareIndicatorT.Props>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const sizeToPx: {
|
|
2
|
+
xs: string;
|
|
3
|
+
s: string;
|
|
4
|
+
m: string;
|
|
5
|
+
l: string;
|
|
6
|
+
xl: string;
|
|
7
|
+
xxl: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const sizeToWeight: {
|
|
10
|
+
xs: string;
|
|
11
|
+
s: string;
|
|
12
|
+
m: string;
|
|
13
|
+
l: string;
|
|
14
|
+
xl: string;
|
|
15
|
+
xxl: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const colorToHex: {
|
|
18
|
+
light: string;
|
|
19
|
+
dark: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const sizeToTextSize: {
|
|
22
|
+
xs: string;
|
|
23
|
+
s: string;
|
|
24
|
+
m: string;
|
|
25
|
+
l: string;
|
|
26
|
+
xl: string;
|
|
27
|
+
xxl: string;
|
|
28
|
+
};
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DSSquareIndicator';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WeakValidationMap } from 'react';
|
|
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
|
+
__duration: number;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const SquareIndicatorPropTypes: WeakValidationMap<unknown>;
|
|
14
|
+
export declare const defaultProps: DSSquareIndicatorT.Props;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DSSquareIndicatorT } from './react-desc-prop-types';
|
|
2
|
+
interface RectProps {
|
|
3
|
+
size: Required<DSSquareIndicatorT.Props>['size'];
|
|
4
|
+
__duration: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const StyledLineLeft: import("styled-components").StyledComponent<"rect", import("styled-components").DefaultTheme, RectProps, never>;
|
|
7
|
+
export declare const StyledLineTop: import("styled-components").StyledComponent<"rect", import("styled-components").DefaultTheme, RectProps, never>;
|
|
8
|
+
export declare const StyledLineRight: import("styled-components").StyledComponent<"rect", import("styled-components").DefaultTheme, RectProps, never>;
|
|
9
|
+
export declare const StyledLineBottom: import("styled-components").StyledComponent<"rect", import("styled-components").DefaultTheme, RectProps, never>;
|
|
10
|
+
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DSSquareIndicator_exports = {};
|
|
29
|
-
__export(DSSquareIndicator_exports, {
|
|
30
|
-
DSSquareIndicator: () => DSSquareIndicator,
|
|
31
|
-
DSSquareIndicatorWithSchema: () => DSSquareIndicatorWithSchema
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_ds_grid = require("@elliemae/ds-grid");
|
|
36
|
-
var import_ds_tooltip = require("@elliemae/ds-tooltip");
|
|
37
|
-
var import_react_desc = require("react-desc");
|
|
38
|
-
var import_react_desc_prop_types = require("./react-desc-prop-types");
|
|
39
|
-
const sizeToPx = {
|
|
40
|
-
xs: "16px",
|
|
41
|
-
s: "24px",
|
|
42
|
-
m: "32px",
|
|
43
|
-
l: "48px",
|
|
44
|
-
xl: "56px",
|
|
45
|
-
xxl: "64px"
|
|
46
|
-
};
|
|
47
|
-
const sizeToWeight = {
|
|
48
|
-
xs: "3px",
|
|
49
|
-
s: "3px",
|
|
50
|
-
m: "3px",
|
|
51
|
-
l: "4px",
|
|
52
|
-
xl: "5px",
|
|
53
|
-
xxl: "6px"
|
|
54
|
-
};
|
|
55
|
-
const colorToHex = {
|
|
56
|
-
light: "#FFFFFF",
|
|
57
|
-
dark: "#0F364A"
|
|
58
|
-
};
|
|
59
|
-
const sizeToTextSize = {
|
|
60
|
-
xs: "12px",
|
|
61
|
-
s: "12px",
|
|
62
|
-
m: "12px",
|
|
63
|
-
l: "13px",
|
|
64
|
-
xl: "14px",
|
|
65
|
-
xxl: "16px"
|
|
66
|
-
};
|
|
67
|
-
const DSSquareIndicator = ({
|
|
68
|
-
size = "m",
|
|
69
|
-
color = "dark",
|
|
70
|
-
text = "",
|
|
71
|
-
showText = true,
|
|
72
|
-
withTooltip = false,
|
|
73
|
-
tooltipStartPlacementPreference = "bottom",
|
|
74
|
-
__duration = 2.5
|
|
75
|
-
}) => {
|
|
76
|
-
const Wrapper = withTooltip ? import_ds_tooltip.DSTooltipV3 : ({ children }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children);
|
|
77
|
-
return /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
|
|
78
|
-
gutter: "xs",
|
|
79
|
-
justifyContent: "center",
|
|
80
|
-
role: "status"
|
|
81
|
-
}, /* @__PURE__ */ import_react.default.createElement(Wrapper, {
|
|
82
|
-
text,
|
|
83
|
-
textAlign: "center",
|
|
84
|
-
startPlacementPreference: tooltipStartPlacementPreference
|
|
85
|
-
}, /* @__PURE__ */ import_react.default.createElement("svg", {
|
|
86
|
-
width: sizeToPx[size],
|
|
87
|
-
height: sizeToPx[size],
|
|
88
|
-
style: { display: "block", margin: "auto" }
|
|
89
|
-
}, /* @__PURE__ */ import_react.default.createElement("rect", {
|
|
90
|
-
width: "100%",
|
|
91
|
-
height: "100%",
|
|
92
|
-
fill: "transparent",
|
|
93
|
-
strokeWidth: sizeToWeight[size],
|
|
94
|
-
strokeDasharray: "400% 400%",
|
|
95
|
-
stroke: colorToHex[color]
|
|
96
|
-
}, /* @__PURE__ */ import_react.default.createElement("animate", {
|
|
97
|
-
attributeName: "stroke-dashoffset",
|
|
98
|
-
values: "800%;0",
|
|
99
|
-
keyTimes: "0;1",
|
|
100
|
-
dur: `${__duration}s`,
|
|
101
|
-
repeatCount: "indefinite",
|
|
102
|
-
restart: "always"
|
|
103
|
-
}))), text !== "" && showText && /* @__PURE__ */ import_react.default.createElement("span", {
|
|
104
|
-
style: { color: colorToHex[color], fontSize: sizeToTextSize[size] }
|
|
105
|
-
}, text)));
|
|
106
|
-
};
|
|
107
|
-
DSSquareIndicator.propTypes = import_react_desc_prop_types.SquareIndicatorPropTypes;
|
|
108
|
-
const DSSquareIndicatorWithSchema = (0, import_react_desc.describe)(DSSquareIndicator);
|
|
109
|
-
DSSquareIndicatorWithSchema.propTypes = import_react_desc_prop_types.SquareIndicatorPropTypes;
|
|
110
|
-
module.exports = __toCommonJS(DSSquareIndicator_exports);
|
|
111
|
-
//# sourceMappingURL=DSSquareIndicator.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSSquareIndicator.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { PropsWithChildren, WeakValidationMap } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { describe } from 'react-desc';\nimport { DSSquareIndicatorT, SquareIndicatorPropTypes } from './react-desc-prop-types';\n\nconst sizeToPx = {\n xs: '16px',\n s: '24px',\n m: '32px',\n l: '48px',\n xl: '56px',\n xxl: '64px',\n};\n\nconst sizeToWeight = {\n xs: '3px',\n s: '3px',\n m: '3px',\n l: '4px',\n xl: '5px',\n xxl: '6px',\n};\n\nconst colorToHex = {\n light: '#FFFFFF',\n dark: '#0F364A',\n};\n\nconst sizeToTextSize = {\n xs: '12px',\n s: '12px',\n m: '12px',\n l: '13px',\n xl: '14px',\n xxl: '16px',\n};\n\nexport const DSSquareIndicator: React.ComponentType<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 const Wrapper = withTooltip ? DSTooltipV3 : ({ children }: PropsWithChildren<unknown>) => <>{children}</>;\n\n return (\n <Grid gutter=\"xs\" justifyContent=\"center\" role=\"status\">\n <Wrapper text={text} textAlign=\"center\" startPlacementPreference={tooltipStartPlacementPreference}>\n <svg width={sizeToPx[size]} height={sizeToPx[size]} style={{ display: 'block', margin: 'auto' }}>\n <rect\n width=\"100%\"\n height=\"100%\"\n fill=\"transparent\"\n strokeWidth={sizeToWeight[size]}\n strokeDasharray=\"400% 400%\"\n stroke={colorToHex[color]}\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n values=\"800%;0\"\n keyTimes=\"0;1\"\n dur={`${__duration}s`}\n repeatCount=\"indefinite\"\n restart=\"always\"\n />\n </rect>\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 as WeakValidationMap<unknown>;\n\nexport const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);\nDSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4D;AAC5D,qBAAqB;AACrB,wBAA4B;AAC5B,wBAAyB;AACzB,mCAA6D;AAE7D,MAAM,WAAW;AAAA,EACf,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGP,MAAM,eAAe;AAAA,EACnB,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGP,MAAM,aAAa;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA;AAGR,MAAM,iBAAiB;AAAA,EACrB,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGA,MAAM,oBAAmE,CAAC;AAAA,EAC/E,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AAAA,EACX,cAAc;AAAA,EACd,kCAAkC;AAAA,EAClC,aAAa;AAAA,MACT;AACJ,QAAM,UAAU,cAAc,gCAAc,CAAC,EAAE,eAA2C,wFAAG;AAE7F,SACE,mDAAC,qBAAD;AAAA,IAAM,QAAO;AAAA,IAAK,gBAAe;AAAA,IAAS,MAAK;AAAA,KAC7C,mDAAC,SAAD;AAAA,IAAS;AAAA,IAAY,WAAU;AAAA,IAAS,0BAA0B;AAAA,KAChE,mDAAC,OAAD;AAAA,IAAK,OAAO,SAAS;AAAA,IAAO,QAAQ,SAAS;AAAA,IAAO,OAAO,EAAE,SAAS,SAAS,QAAQ;AAAA,KACrF,mDAAC,QAAD;AAAA,IACE,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,aAAa,aAAa;AAAA,IAC1B,iBAAgB;AAAA,IAChB,QAAQ,WAAW;AAAA,KAEnB,mDAAC,WAAD;AAAA,IACE,eAAc;AAAA,IACd,QAAO;AAAA,IACP,UAAS;AAAA,IACT,KAAK,GAAG;AAAA,IACR,aAAY;AAAA,IACZ,SAAQ;AAAA,QAIb,SAAS,MAAM,YACd,mDAAC,QAAD;AAAA,IAAM,OAAO,EAAE,OAAO,WAAW,QAAQ,UAAU,eAAe;AAAA,KAAU;AAAA;AAOtF,kBAAkB,YAAY;AAEvB,MAAM,8BAA8B,gCAAS;AACpD,4BAA4B,YAAY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
DSSquareIndicator: () => import_DSSquareIndicator.DSSquareIndicator,
|
|
31
|
-
DSSquareIndicatorWithSchema: () => import_DSSquareIndicator.DSSquareIndicatorWithSchema
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_DSSquareIndicator = require("./DSSquareIndicator");
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export { DSSquareIndicator, DSSquareIndicatorWithSchema } from './DSSquareIndicator';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAA+D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var react_desc_prop_types_exports = {};
|
|
29
|
-
__export(react_desc_prop_types_exports, {
|
|
30
|
-
SquareIndicatorPropTypes: () => SquareIndicatorPropTypes
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react_desc = require("react-desc");
|
|
34
|
-
const SquareIndicatorPropTypes = {
|
|
35
|
-
size: import_react_desc.PropTypes.oneOf(["xs", "s", "m", "l", "xl", "xxl"]).description("Size of the indicator").defaultValue("m"),
|
|
36
|
-
color: import_react_desc.PropTypes.oneOf(["light", "dark"]).description("Color mode for the indicator").defaultValue("dark"),
|
|
37
|
-
text: import_react_desc.PropTypes.string.description("Optional text to show under the indicator").defaultValue(""),
|
|
38
|
-
showText: import_react_desc.PropTypes.bool.description("Whether to show the optional text or not").defaultValue(true),
|
|
39
|
-
withTooltip: import_react_desc.PropTypes.bool.description("Whether to include a tooltip that shows the optional text on hover").defaultValue(false),
|
|
40
|
-
tooltipStartPlacementPreference: import_react_desc.PropTypes.oneOf([
|
|
41
|
-
"top-start",
|
|
42
|
-
"top",
|
|
43
|
-
"top-end",
|
|
44
|
-
"right-start",
|
|
45
|
-
"right",
|
|
46
|
-
"right-end",
|
|
47
|
-
"bottom-end",
|
|
48
|
-
"bottom",
|
|
49
|
-
"bottom-start",
|
|
50
|
-
"left-end",
|
|
51
|
-
"left",
|
|
52
|
-
"left-start"
|
|
53
|
-
]).description("start placement preference for the tooltip").defaultValue("center")
|
|
54
|
-
};
|
|
55
|
-
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
56
|
-
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { PropTypes } from 'react-desc';\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 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};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,wBAA0B;AA0BnB,MAAM,2BAA2B;AAAA,EACtC,MAAM,4BAAU,MAAM,CAAC,MAAM,KAAK,KAAK,KAAK,MAAM,QAAQ,YAAY,yBAAyB,aAAa;AAAA,EAC5G,OAAO,4BAAU,MAAM,CAAC,SAAS,SAAS,YAAY,gCAAgC,aAAa;AAAA,EACnG,MAAM,4BAAU,OAAO,YAAY,6CAA6C,aAAa;AAAA,EAC7F,UAAU,4BAAU,KAAK,YAAY,4CAA4C,aAAa;AAAA,EAC9F,aAAa,4BAAU,KACpB,YAAY,sEACZ,aAAa;AAAA,EAChB,iCAAiC,4BAAU,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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2 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";
|
|
7
|
-
const sizeToPx = {
|
|
8
|
-
xs: "16px",
|
|
9
|
-
s: "24px",
|
|
10
|
-
m: "32px",
|
|
11
|
-
l: "48px",
|
|
12
|
-
xl: "56px",
|
|
13
|
-
xxl: "64px"
|
|
14
|
-
};
|
|
15
|
-
const sizeToWeight = {
|
|
16
|
-
xs: "3px",
|
|
17
|
-
s: "3px",
|
|
18
|
-
m: "3px",
|
|
19
|
-
l: "4px",
|
|
20
|
-
xl: "5px",
|
|
21
|
-
xxl: "6px"
|
|
22
|
-
};
|
|
23
|
-
const colorToHex = {
|
|
24
|
-
light: "#FFFFFF",
|
|
25
|
-
dark: "#0F364A"
|
|
26
|
-
};
|
|
27
|
-
const sizeToTextSize = {
|
|
28
|
-
xs: "12px",
|
|
29
|
-
s: "12px",
|
|
30
|
-
m: "12px",
|
|
31
|
-
l: "13px",
|
|
32
|
-
xl: "14px",
|
|
33
|
-
xxl: "16px"
|
|
34
|
-
};
|
|
35
|
-
const DSSquareIndicator = ({
|
|
36
|
-
size = "m",
|
|
37
|
-
color = "dark",
|
|
38
|
-
text = "",
|
|
39
|
-
showText = true,
|
|
40
|
-
withTooltip = false,
|
|
41
|
-
tooltipStartPlacementPreference = "bottom",
|
|
42
|
-
__duration = 2.5
|
|
43
|
-
}) => {
|
|
44
|
-
const Wrapper = withTooltip ? DSTooltipV3 : ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
45
|
-
return /* @__PURE__ */ React2.createElement(Grid, {
|
|
46
|
-
gutter: "xs",
|
|
47
|
-
justifyContent: "center",
|
|
48
|
-
role: "status"
|
|
49
|
-
}, /* @__PURE__ */ React2.createElement(Wrapper, {
|
|
50
|
-
text,
|
|
51
|
-
textAlign: "center",
|
|
52
|
-
startPlacementPreference: tooltipStartPlacementPreference
|
|
53
|
-
}, /* @__PURE__ */ React2.createElement("svg", {
|
|
54
|
-
width: sizeToPx[size],
|
|
55
|
-
height: sizeToPx[size],
|
|
56
|
-
style: { display: "block", margin: "auto" }
|
|
57
|
-
}, /* @__PURE__ */ React2.createElement("rect", {
|
|
58
|
-
width: "100%",
|
|
59
|
-
height: "100%",
|
|
60
|
-
fill: "transparent",
|
|
61
|
-
strokeWidth: sizeToWeight[size],
|
|
62
|
-
strokeDasharray: "400% 400%",
|
|
63
|
-
stroke: colorToHex[color]
|
|
64
|
-
}, /* @__PURE__ */ React2.createElement("animate", {
|
|
65
|
-
attributeName: "stroke-dashoffset",
|
|
66
|
-
values: "800%;0",
|
|
67
|
-
keyTimes: "0;1",
|
|
68
|
-
dur: `${__duration}s`,
|
|
69
|
-
repeatCount: "indefinite",
|
|
70
|
-
restart: "always"
|
|
71
|
-
}))), text !== "" && showText && /* @__PURE__ */ React2.createElement("span", {
|
|
72
|
-
style: { color: colorToHex[color], fontSize: sizeToTextSize[size] }
|
|
73
|
-
}, text)));
|
|
74
|
-
};
|
|
75
|
-
DSSquareIndicator.propTypes = SquareIndicatorPropTypes;
|
|
76
|
-
const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);
|
|
77
|
-
DSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;
|
|
78
|
-
export {
|
|
79
|
-
DSSquareIndicator,
|
|
80
|
-
DSSquareIndicatorWithSchema
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=DSSquareIndicator.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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", "import React, { PropsWithChildren, WeakValidationMap } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { describe } from 'react-desc';\nimport { DSSquareIndicatorT, SquareIndicatorPropTypes } from './react-desc-prop-types';\n\nconst sizeToPx = {\n xs: '16px',\n s: '24px',\n m: '32px',\n l: '48px',\n xl: '56px',\n xxl: '64px',\n};\n\nconst sizeToWeight = {\n xs: '3px',\n s: '3px',\n m: '3px',\n l: '4px',\n xl: '5px',\n xxl: '6px',\n};\n\nconst colorToHex = {\n light: '#FFFFFF',\n dark: '#0F364A',\n};\n\nconst sizeToTextSize = {\n xs: '12px',\n s: '12px',\n m: '12px',\n l: '13px',\n xl: '14px',\n xxl: '16px',\n};\n\nexport const DSSquareIndicator: React.ComponentType<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 const Wrapper = withTooltip ? DSTooltipV3 : ({ children }: PropsWithChildren<unknown>) => <>{children}</>;\n\n return (\n <Grid gutter=\"xs\" justifyContent=\"center\" role=\"status\">\n <Wrapper text={text} textAlign=\"center\" startPlacementPreference={tooltipStartPlacementPreference}>\n <svg width={sizeToPx[size]} height={sizeToPx[size]} style={{ display: 'block', margin: 'auto' }}>\n <rect\n width=\"100%\"\n height=\"100%\"\n fill=\"transparent\"\n strokeWidth={sizeToWeight[size]}\n strokeDasharray=\"400% 400%\"\n stroke={colorToHex[color]}\n >\n <animate\n attributeName=\"stroke-dashoffset\"\n values=\"800%;0\"\n keyTimes=\"0;1\"\n dur={`${__duration}s`}\n repeatCount=\"indefinite\"\n restart=\"always\"\n />\n </rect>\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 as WeakValidationMap<unknown>;\n\nexport const DSSquareIndicatorWithSchema = describe(DSSquareIndicator);\nDSSquareIndicatorWithSchema.propTypes = SquareIndicatorPropTypes;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,MAAM,WAAW;AAAA,EACf,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGP,MAAM,eAAe;AAAA,EACnB,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGP,MAAM,aAAa;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA;AAGR,MAAM,iBAAiB;AAAA,EACrB,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,IAAI;AAAA,EACJ,KAAK;AAAA;AAGA,MAAM,oBAAmE,CAAC;AAAA,EAC/E,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AAAA,EACX,cAAc;AAAA,EACd,kCAAkC;AAAA,EAClC,aAAa;AAAA,MACT;AACJ,QAAM,UAAU,cAAc,cAAc,CAAC,EAAE,eAA2C,4DAAG;AAE7F,SACE,qCAAC,MAAD;AAAA,IAAM,QAAO;AAAA,IAAK,gBAAe;AAAA,IAAS,MAAK;AAAA,KAC7C,qCAAC,SAAD;AAAA,IAAS;AAAA,IAAY,WAAU;AAAA,IAAS,0BAA0B;AAAA,KAChE,qCAAC,OAAD;AAAA,IAAK,OAAO,SAAS;AAAA,IAAO,QAAQ,SAAS;AAAA,IAAO,OAAO,EAAE,SAAS,SAAS,QAAQ;AAAA,KACrF,qCAAC,QAAD;AAAA,IACE,OAAM;AAAA,IACN,QAAO;AAAA,IACP,MAAK;AAAA,IACL,aAAa,aAAa;AAAA,IAC1B,iBAAgB;AAAA,IAChB,QAAQ,WAAW;AAAA,KAEnB,qCAAC,WAAD;AAAA,IACE,eAAc;AAAA,IACd,QAAO;AAAA,IACP,UAAS;AAAA,IACT,KAAK,GAAG;AAAA,IACR,aAAY;AAAA,IACZ,SAAQ;AAAA,QAIb,SAAS,MAAM,YACd,qCAAC,QAAD;AAAA,IAAM,OAAO,EAAE,OAAO,WAAW,QAAQ,UAAU,eAAe;AAAA,KAAU;AAAA;AAOtF,kBAAkB,YAAY;AAEvB,MAAM,8BAA8B,SAAS;AACpD,4BAA4B,YAAY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/index.js
DELETED
package/dist/esm/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { PropTypes } from "react-desc";
|
|
3
|
-
const SquareIndicatorPropTypes = {
|
|
4
|
-
size: PropTypes.oneOf(["xs", "s", "m", "l", "xl", "xxl"]).description("Size of the indicator").defaultValue("m"),
|
|
5
|
-
color: PropTypes.oneOf(["light", "dark"]).description("Color mode for the indicator").defaultValue("dark"),
|
|
6
|
-
text: PropTypes.string.description("Optional text to show under the indicator").defaultValue(""),
|
|
7
|
-
showText: PropTypes.bool.description("Whether to show the optional text or not").defaultValue(true),
|
|
8
|
-
withTooltip: PropTypes.bool.description("Whether to include a tooltip that shows the optional text on hover").defaultValue(false),
|
|
9
|
-
tooltipStartPlacementPreference: PropTypes.oneOf([
|
|
10
|
-
"top-start",
|
|
11
|
-
"top",
|
|
12
|
-
"top-end",
|
|
13
|
-
"right-start",
|
|
14
|
-
"right",
|
|
15
|
-
"right-end",
|
|
16
|
-
"bottom-end",
|
|
17
|
-
"bottom",
|
|
18
|
-
"bottom-start",
|
|
19
|
-
"left-end",
|
|
20
|
-
"left",
|
|
21
|
-
"left-start"
|
|
22
|
-
]).description("start placement preference for the tooltip").defaultValue("center")
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
SquareIndicatorPropTypes
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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 } from 'react-desc';\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 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};\n"],
|
|
5
|
-
"mappings": "AAAA;ACCA;AA0BO,MAAM,2BAA2B;AAAA,EACtC,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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|