assui 2.0.2 → 2.0.6
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/es/button-drawer/index.d.ts +10 -0
- package/es/button-drawer/index.js +116 -0
- package/es/button-drawer/style/index.d.ts +1 -0
- package/es/button-drawer/style/index.js +1 -0
- package/es/button-modal/index.d.ts +14 -0
- package/es/button-modal/index.js +131 -0
- package/es/button-modal/style/index.d.ts +1 -0
- package/es/button-modal/style/index.js +1 -0
- package/es/condition-input/index.d.ts +15 -0
- package/es/condition-input/index.js +108 -0
- package/es/condition-input/parse2RegexOption.d.ts +13 -0
- package/es/condition-input/parse2RegexOption.js +57 -0
- package/es/condition-input/style/index.d.ts +1 -0
- package/es/condition-input/style/index.js +1 -0
- package/es/copy-to-clipboard/index.d.ts +22 -0
- package/es/copy-to-clipboard/index.js +95 -0
- package/es/copy-to-clipboard/style/index.css +249 -0
- package/es/copy-to-clipboard/style/index.d.ts +1 -0
- package/es/copy-to-clipboard/style/index.js +1 -0
- package/es/copy-to-clipboard/style/index.less +1 -0
- package/es/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/es/highlight-textarea/HighlighedContents.js +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.js +159 -0
- package/es/highlight-textarea/getRanges.d.ts +2 -0
- package/es/highlight-textarea/getRanges.js +142 -0
- package/es/highlight-textarea/getType.d.ts +2 -0
- package/es/highlight-textarea/getType.js +29 -0
- package/es/highlight-textarea/index.d.ts +12 -0
- package/es/highlight-textarea/index.js +132 -0
- package/es/highlight-textarea/style/index.css +38 -0
- package/es/highlight-textarea/style/index.d.ts +2 -0
- package/es/highlight-textarea/style/index.js +2 -0
- package/es/highlight-textarea/style/index.less +42 -0
- package/es/highlight-textarea/types.d.ts +16 -0
- package/es/highlight-textarea/types.js +0 -0
- package/es/highlight-words/index.d.ts +3 -0
- package/es/highlight-words/index.js +2 -0
- package/es/highlight-words/style/index.d.ts +1 -0
- package/es/highlight-words/style/index.js +0 -0
- package/es/icon/demo/svg/check-circle-filled.svg +6 -0
- package/es/icon/demo/svg/coin-circle.svg +9 -0
- package/es/icon/index.d.ts +27 -0
- package/es/icon/index.js +95 -0
- package/es/icon/style/index.d.ts +1 -0
- package/es/icon/style/index.js +0 -0
- package/es/icon/utils.d.ts +6 -0
- package/es/icon/utils.js +22 -0
- package/es/img-crop/EasyCrop.d.ts +6 -0
- package/es/img-crop/EasyCrop.js +113 -0
- package/es/img-crop/getCroppedImg.d.ts +6 -0
- package/es/img-crop/getCroppedImg.js +199 -0
- package/es/img-crop/index.d.ts +53 -0
- package/es/img-crop/index.js +531 -0
- package/es/img-crop/style/index.css +52 -0
- package/es/img-crop/style/index.d.ts +3 -0
- package/es/img-crop/style/index.js +3 -0
- package/es/img-crop/style/index.less +54 -0
- package/es/index.d.ts +34 -2
- package/es/index.js +18 -2
- package/es/keep-tab/demo/index.modules.less +66 -0
- package/es/keep-tab/index.d.ts +29 -0
- package/es/keep-tab/index.js +129 -0
- package/es/keep-tab/style/index.css +1129 -0
- package/es/keep-tab/style/index.d.ts +2 -0
- package/es/keep-tab/style/index.js +2 -0
- package/es/keep-tab/style/index.less +2 -0
- package/es/number-input/index.d.ts +22 -7
- package/es/number-input/index.js +22 -11
- package/es/number-input/style/index.d.ts +1 -1
- package/es/number-input/style/index.js +1 -1
- package/es/number-input/utils.d.ts +10 -11
- package/es/number-input/utils.js +7 -7
- package/es/rc-echart/core.d.ts +32 -0
- package/es/rc-echart/core.js +136 -0
- package/es/rc-echart/index.d.ts +21 -0
- package/es/rc-echart/index.js +27 -0
- package/es/rc-echart/style/index.d.ts +1 -0
- package/es/rc-echart/style/index.js +0 -0
- package/es/rc-motion/demo/CSSMotion.less +91 -0
- package/es/rc-motion/index.d.ts +2 -0
- package/es/rc-motion/index.js +2 -0
- package/es/rc-motion/style/index.d.ts +1 -0
- package/es/rc-motion/style/index.js +0 -0
- package/es/rc-qrcode/index.d.ts +20 -0
- package/es/rc-qrcode/index.js +57 -0
- package/es/rc-qrcode/style/index.d.ts +1 -0
- package/es/rc-qrcode/style/index.js +0 -0
- package/es/rc-qrcode/useQrcode.d.ts +4 -0
- package/es/rc-qrcode/useQrcode.js +50 -0
- package/es/rc-transition-group/index.d.ts +2 -0
- package/es/rc-transition-group/index.js +2 -0
- package/es/rc-transition-group/style/index.d.ts +1 -0
- package/es/rc-transition-group/style/index.js +0 -0
- package/es/single-img-upload/index.d.ts +19 -0
- package/es/single-img-upload/index.js +199 -0
- package/es/single-img-upload/style/index.css +74 -0
- package/es/single-img-upload/style/index.d.ts +3 -0
- package/es/single-img-upload/style/index.js +3 -0
- package/es/single-img-upload/style/index.less +85 -0
- package/es/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/es/sortable-hoc/demo/index.modules.less +248 -0
- package/es/sortable-hoc/index.d.ts +2 -0
- package/es/sortable-hoc/index.js +2 -0
- package/es/sortable-hoc/style/index.d.ts +1 -0
- package/es/sortable-hoc/style/index.js +0 -0
- package/es/split-pane/index.d.ts +59 -0
- package/es/split-pane/index.js +21 -0
- package/es/split-pane/style/index.css +41 -0
- package/es/split-pane/style/index.d.ts +1 -0
- package/es/split-pane/style/index.js +1 -0
- package/es/split-pane/style/index.less +49 -0
- package/es/text-area/index.d.ts +12 -0
- package/es/text-area/index.js +96 -0
- package/es/text-area/style/index.d.ts +1 -0
- package/es/text-area/style/index.js +1 -0
- package/es/text-input/index.d.ts +5 -0
- package/es/text-input/index.js +85 -0
- package/es/{number-input → text-input}/style/index.css +0 -3
- package/es/text-input/style/index.d.ts +1 -0
- package/es/text-input/style/index.js +1 -0
- package/es/{number-input → text-input}/style/index.less +0 -4
- package/lib/button-drawer/index.d.ts +10 -0
- package/lib/button-drawer/index.js +164 -0
- package/lib/button-drawer/style/index.d.ts +1 -0
- package/lib/button-drawer/style/index.js +7 -0
- package/lib/button-modal/index.d.ts +14 -0
- package/lib/button-modal/index.js +178 -0
- package/lib/button-modal/style/index.d.ts +1 -0
- package/lib/button-modal/style/index.js +7 -0
- package/lib/condition-input/index.d.ts +15 -0
- package/lib/condition-input/index.js +158 -0
- package/lib/condition-input/parse2RegexOption.d.ts +13 -0
- package/lib/condition-input/parse2RegexOption.js +72 -0
- package/lib/condition-input/style/index.d.ts +1 -0
- package/lib/condition-input/style/index.js +7 -0
- package/lib/copy-to-clipboard/index.d.ts +22 -0
- package/lib/copy-to-clipboard/index.js +143 -0
- package/lib/copy-to-clipboard/style/index.css +249 -0
- package/lib/copy-to-clipboard/style/index.d.ts +1 -0
- package/lib/copy-to-clipboard/style/index.js +7 -0
- package/lib/copy-to-clipboard/style/index.less +1 -0
- package/lib/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/lib/highlight-textarea/HighlighedContents.js +29 -0
- package/lib/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/lib/highlight-textarea/extractSpansOfClasses.js +173 -0
- package/lib/highlight-textarea/getRanges.d.ts +2 -0
- package/lib/highlight-textarea/getRanges.js +156 -0
- package/lib/highlight-textarea/getType.d.ts +2 -0
- package/lib/highlight-textarea/getType.js +37 -0
- package/lib/highlight-textarea/index.d.ts +12 -0
- package/lib/highlight-textarea/index.js +183 -0
- package/lib/highlight-textarea/style/index.css +38 -0
- package/lib/highlight-textarea/style/index.d.ts +2 -0
- package/lib/highlight-textarea/style/index.js +9 -0
- package/lib/highlight-textarea/style/index.less +42 -0
- package/lib/highlight-textarea/types.d.ts +16 -0
- package/lib/highlight-textarea/types.js +5 -0
- package/lib/highlight-words/index.d.ts +3 -0
- package/lib/highlight-words/index.js +15 -0
- package/lib/highlight-words/style/index.d.ts +1 -0
- package/lib/highlight-words/style/index.js +0 -0
- package/lib/icon/demo/svg/check-circle-filled.svg +6 -0
- package/lib/icon/demo/svg/coin-circle.svg +9 -0
- package/lib/icon/index.d.ts +27 -0
- package/lib/icon/index.js +143 -0
- package/lib/icon/style/index.d.ts +1 -0
- package/lib/icon/style/index.js +0 -0
- package/lib/icon/utils.d.ts +6 -0
- package/lib/icon/utils.js +32 -0
- package/lib/img-crop/EasyCrop.d.ts +6 -0
- package/lib/img-crop/EasyCrop.js +160 -0
- package/lib/img-crop/getCroppedImg.d.ts +6 -0
- package/lib/img-crop/getCroppedImg.js +205 -0
- package/lib/img-crop/index.d.ts +53 -0
- package/lib/img-crop/index.js +582 -0
- package/lib/img-crop/style/index.css +52 -0
- package/lib/img-crop/style/index.d.ts +3 -0
- package/lib/img-crop/style/index.js +11 -0
- package/lib/img-crop/style/index.less +54 -0
- package/lib/index.d.ts +34 -2
- package/lib/index.js +160 -9
- package/lib/keep-tab/demo/index.modules.less +66 -0
- package/lib/keep-tab/index.d.ts +29 -0
- package/lib/keep-tab/index.js +181 -0
- package/lib/keep-tab/style/index.css +1129 -0
- package/lib/keep-tab/style/index.d.ts +2 -0
- package/lib/keep-tab/style/index.js +9 -0
- package/lib/keep-tab/style/index.less +2 -0
- package/lib/number-input/index.d.ts +22 -7
- package/lib/number-input/index.js +22 -11
- package/lib/number-input/style/index.d.ts +1 -1
- package/lib/number-input/style/index.js +1 -1
- package/lib/number-input/utils.d.ts +10 -11
- package/lib/number-input/utils.js +8 -8
- package/lib/rc-echart/core.d.ts +32 -0
- package/lib/rc-echart/core.js +185 -0
- package/lib/rc-echart/index.d.ts +21 -0
- package/lib/rc-echart/index.js +75 -0
- package/lib/rc-echart/style/index.d.ts +1 -0
- package/lib/rc-echart/style/index.js +0 -0
- package/lib/rc-motion/demo/CSSMotion.less +91 -0
- package/lib/rc-motion/index.d.ts +2 -0
- package/lib/rc-motion/index.js +43 -0
- package/lib/rc-motion/style/index.d.ts +1 -0
- package/lib/rc-motion/style/index.js +0 -0
- package/lib/rc-qrcode/index.d.ts +20 -0
- package/lib/rc-qrcode/index.js +108 -0
- package/lib/rc-qrcode/style/index.d.ts +1 -0
- package/lib/rc-qrcode/style/index.js +0 -0
- package/lib/rc-qrcode/useQrcode.d.ts +4 -0
- package/lib/rc-qrcode/useQrcode.js +66 -0
- package/lib/rc-transition-group/index.d.ts +2 -0
- package/lib/rc-transition-group/index.js +43 -0
- package/lib/rc-transition-group/style/index.d.ts +1 -0
- package/lib/rc-transition-group/style/index.js +0 -0
- package/lib/single-img-upload/index.d.ts +19 -0
- package/lib/single-img-upload/index.js +250 -0
- package/lib/single-img-upload/style/index.css +74 -0
- package/lib/single-img-upload/style/index.d.ts +3 -0
- package/lib/single-img-upload/style/index.js +11 -0
- package/lib/single-img-upload/style/index.less +85 -0
- package/lib/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/lib/sortable-hoc/demo/index.modules.less +248 -0
- package/lib/sortable-hoc/index.d.ts +2 -0
- package/lib/sortable-hoc/index.js +43 -0
- package/lib/sortable-hoc/style/index.d.ts +1 -0
- package/lib/sortable-hoc/style/index.js +0 -0
- package/lib/split-pane/index.d.ts +59 -0
- package/lib/split-pane/index.js +69 -0
- package/lib/split-pane/style/index.css +41 -0
- package/lib/split-pane/style/index.d.ts +1 -0
- package/lib/split-pane/style/index.js +7 -0
- package/lib/split-pane/style/index.less +49 -0
- package/lib/text-area/index.d.ts +12 -0
- package/lib/text-area/index.js +144 -0
- package/lib/text-area/style/index.d.ts +1 -0
- package/lib/text-area/style/index.js +7 -0
- package/lib/text-input/index.d.ts +5 -0
- package/lib/text-input/index.js +99 -0
- package/lib/{number-input → text-input}/style/index.css +0 -3
- package/lib/text-input/style/index.d.ts +1 -0
- package/lib/text-input/style/index.js +7 -0
- package/lib/{number-input → text-input}/style/index.less +0 -4
- package/package.json +20 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
|
2
|
+
y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
|
3
|
+
<circle fill="currentColor" cx="8" cy="8" r="8" />
|
|
4
|
+
<path fill="inherit" class="st0" d="M12.5,4.4c-0.2-0.2-0.5-0.2-0.7,0l-5,5c0,0,0,0,0,0c-0.2,0.2-0.5,0.2-0.7,0l-2-2C4,7.2,3.7,7.2,3.5,7.4L2.8,8.2
|
|
5
|
+
c-0.2,0.2-0.2,0.5,0,0.7l3.3,3.3c0.2,0.2,0.6,0.2,0.8,0l6.3-6.3c0.2-0.2,0.2-0.5,0-0.7L12.5,4.4z" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
|
2
|
+
y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
|
3
|
+
<path fill="currentColor" d="M8,9.9c-2,0-3.7-0.6-3.7-1.7v1c0,1,1.7,1.9,3.7,1.9s3.7-0.8,3.7-1.9v-1C11.7,9.2,10,9.9,8,9.9z M8,11.7
|
|
4
|
+
c-2,0-3.7-0.6-3.7-1.7v1c0,1,1.7,1.9,3.7,1.9s3.7-0.8,3.7-1.9v-1C11.7,11.1,10,11.7,8,11.7L8,11.7z M8,8C6,8,4.3,7.4,4.3,6.3v1
|
|
5
|
+
c0,1,1.7,1.9,3.7,1.9s3.7-0.8,3.7-1.9v-1C11.7,7.4,10,8,8,8z M8,3.1c-2,0-3.7,0.8-3.7,1.9v0.6c0,1,1.7,1.9,3.7,1.9s3.7-0.8,3.7-1.9
|
|
6
|
+
V4.9C11.7,3.9,10,3.1,8,3.1z" />
|
|
7
|
+
<path fill="currentColor" d="M8,0.8c4,0,7.3,3.3,7.3,7.2S12,15.3,8,15.3S0.7,12,0.7,8S4,0.8,8,0.8 M8,0C3.6,0,0,3.6,0,8c0,4.4,3.6,8,8,8s8-3.6,8-8
|
|
8
|
+
C16,3.6,12.4,0,8,0L8,0z" />
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface IconBaseProps extends React.HTMLProps<HTMLSpanElement> {
|
|
3
|
+
spin?: boolean;
|
|
4
|
+
rotate?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CustomIconComponentProps {
|
|
7
|
+
width?: string | number;
|
|
8
|
+
height?: string | number;
|
|
9
|
+
fill?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
viewBox?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IconProps extends IconBaseProps {
|
|
15
|
+
className?: string;
|
|
16
|
+
component?: React.ComponentType<CustomIconComponentProps | React.SVGProps<SVGSVGElement>>;
|
|
17
|
+
viewBox?: string;
|
|
18
|
+
tabIndex?: number;
|
|
19
|
+
style?: React.CSSProperties;
|
|
20
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
declare const Icon: {
|
|
24
|
+
(props: IconProps): JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export default Icon;
|
package/es/icon/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
|
|
20
|
+
for (var p in s) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
import * as React from 'react';
|
|
31
|
+
import classNames from 'classnames';
|
|
32
|
+
import { svgBaseProps, useInsertStyles } from './utils';
|
|
33
|
+
|
|
34
|
+
var Icon = function Icon(props) {
|
|
35
|
+
var className = props.className,
|
|
36
|
+
Component = props.component,
|
|
37
|
+
viewBox = props.viewBox,
|
|
38
|
+
spin = props.spin,
|
|
39
|
+
rotate = props.rotate,
|
|
40
|
+
tabIndex = props.tabIndex,
|
|
41
|
+
onClick = props.onClick,
|
|
42
|
+
children = props.children,
|
|
43
|
+
restProps = __rest(props, ["className", "component", "viewBox", "spin", "rotate", "tabIndex", "onClick", "children"]);
|
|
44
|
+
|
|
45
|
+
useInsertStyles();
|
|
46
|
+
var classString = classNames('spotecicon', className);
|
|
47
|
+
var svgClassString = classNames({
|
|
48
|
+
'spotecicon-spin': !!spin
|
|
49
|
+
});
|
|
50
|
+
var svgStyle = rotate ? {
|
|
51
|
+
msTransform: "rotate(" + rotate + "deg)",
|
|
52
|
+
transform: "rotate(" + rotate + "deg)"
|
|
53
|
+
} : undefined;
|
|
54
|
+
|
|
55
|
+
var innerSvgProps = __assign(__assign({}, svgBaseProps), {
|
|
56
|
+
className: svgClassString,
|
|
57
|
+
style: svgStyle,
|
|
58
|
+
viewBox: viewBox
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (!viewBox) {
|
|
62
|
+
delete innerSvgProps.viewBox;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var renderInnerNode = function renderInnerNode() {
|
|
66
|
+
if (Component) {
|
|
67
|
+
return /*#__PURE__*/React.createElement(Component, __assign({}, innerSvgProps), children);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (children) {
|
|
71
|
+
return /*#__PURE__*/React.createElement("svg", __assign({}, innerSvgProps, {
|
|
72
|
+
viewBox: viewBox
|
|
73
|
+
}), children);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return null;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var iconTabIndex = tabIndex;
|
|
80
|
+
|
|
81
|
+
if (iconTabIndex === undefined && onClick) {
|
|
82
|
+
iconTabIndex = -1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return /*#__PURE__*/React.createElement("span", __assign({
|
|
86
|
+
role: "img"
|
|
87
|
+
}, restProps, {
|
|
88
|
+
tabIndex: iconTabIndex,
|
|
89
|
+
onClick: onClick,
|
|
90
|
+
className: classString
|
|
91
|
+
}), renderInnerNode());
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
Icon.displayName = 'SpotecIcon';
|
|
95
|
+
export default Icon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const svgBaseProps: {
|
|
2
|
+
'aria-hidden': string;
|
|
3
|
+
focusable: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const iconStyles = "\n.spotecicon {\n display: inline-block;\n width: 16px;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.spotecicon > * {\n line-height: 1;\n}\n\n.spotecicon svg {\n display: inline-block;\n}\n\n.spotecicon::before {\n display: none;\n}\n\n.spotecicon .spotecicon-icon {\n display: block;\n}\n\n.spotecicon[tabindex] {\n cursor: pointer;\n}\n\n.spotecicon-spin::before,\n.spotecicon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
|
|
6
|
+
export declare const useInsertStyles: (styleStr?: string) => void;
|
package/es/icon/utils.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { insertCss } from 'insert-css';
|
|
3
|
+
export var svgBaseProps = {
|
|
4
|
+
'aria-hidden': 'true',
|
|
5
|
+
focusable: 'false'
|
|
6
|
+
};
|
|
7
|
+
export var iconStyles = "\n.spotecicon {\n display: inline-block;\n width: 16px;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.spotecicon > * {\n line-height: 1;\n}\n\n.spotecicon svg {\n display: inline-block;\n}\n\n.spotecicon::before {\n display: none;\n}\n\n.spotecicon .spotecicon-icon {\n display: block;\n}\n\n.spotecicon[tabindex] {\n cursor: pointer;\n}\n\n.spotecicon-spin::before,\n.spotecicon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
|
|
8
|
+
var cssInjectedFlag = false;
|
|
9
|
+
export var useInsertStyles = function useInsertStyles(styleStr) {
|
|
10
|
+
if (styleStr === void 0) {
|
|
11
|
+
styleStr = iconStyles;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
if (!cssInjectedFlag) {
|
|
16
|
+
insertCss(styleStr, {
|
|
17
|
+
prepend: true
|
|
18
|
+
});
|
|
19
|
+
cssInjectedFlag = true;
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CropperProps } from 'react-easy-crop';
|
|
2
|
+
export interface EasyCropProps extends Omit<CropperProps, 'onCropChange' | 'mediaProps' | 'crop' | 'zoomSpeed' | 'restrictPosition' | 'style'> {
|
|
3
|
+
onComplete: (value: any) => void;
|
|
4
|
+
}
|
|
5
|
+
declare const EasyCrop: (props: EasyCropProps) => JSX.Element;
|
|
6
|
+
export default EasyCrop;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
|
|
20
|
+
for (var p in s) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var __read = this && this.__read || function (o, n) {
|
|
31
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32
|
+
if (!m) return o;
|
|
33
|
+
var i = m.call(o),
|
|
34
|
+
r,
|
|
35
|
+
ar = [],
|
|
36
|
+
e;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
40
|
+
ar.push(r.value);
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
e = {
|
|
44
|
+
error: error
|
|
45
|
+
};
|
|
46
|
+
} finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
} finally {
|
|
50
|
+
if (e) throw e.error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return ar;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
import * as React from 'react';
|
|
58
|
+
import Cropper from 'react-easy-crop';
|
|
59
|
+
|
|
60
|
+
var EasyCrop = function EasyCrop(props) {
|
|
61
|
+
var aspect = props.aspect,
|
|
62
|
+
minZoom = props.minZoom,
|
|
63
|
+
maxZoom = props.maxZoom,
|
|
64
|
+
onComplete = props.onComplete,
|
|
65
|
+
restProps = __rest(props, ["aspect", "minZoom", "maxZoom", "onComplete"]);
|
|
66
|
+
|
|
67
|
+
var _a = __read(React.useState({
|
|
68
|
+
x: 0,
|
|
69
|
+
y: 0
|
|
70
|
+
}), 2),
|
|
71
|
+
crop = _a[0],
|
|
72
|
+
setCrop = _a[1];
|
|
73
|
+
|
|
74
|
+
var _b = __read(React.useState({
|
|
75
|
+
width: 0,
|
|
76
|
+
height: 0
|
|
77
|
+
}), 2),
|
|
78
|
+
cropSize = _b[0],
|
|
79
|
+
setCropSize = _b[1];
|
|
80
|
+
|
|
81
|
+
var onCropComplete = React.useCallback(function (_, croppedAreaPixels) {
|
|
82
|
+
onComplete(croppedAreaPixels);
|
|
83
|
+
}, [onComplete]);
|
|
84
|
+
var onMediaLoaded = React.useCallback(function (mediaSize) {
|
|
85
|
+
var width = mediaSize.width,
|
|
86
|
+
height = mediaSize.height;
|
|
87
|
+
var ratioWidth = height * aspect;
|
|
88
|
+
|
|
89
|
+
if (width > ratioWidth) {
|
|
90
|
+
setCropSize({
|
|
91
|
+
width: ratioWidth,
|
|
92
|
+
height: height
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
setCropSize({
|
|
96
|
+
width: width,
|
|
97
|
+
height: width / aspect
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [aspect]);
|
|
101
|
+
return /*#__PURE__*/React.createElement(Cropper, __assign({}, restProps, {
|
|
102
|
+
crop: crop,
|
|
103
|
+
cropSize: cropSize,
|
|
104
|
+
onCropChange: setCrop,
|
|
105
|
+
aspect: aspect,
|
|
106
|
+
minZoom: minZoom,
|
|
107
|
+
maxZoom: maxZoom,
|
|
108
|
+
onCropComplete: onCropComplete,
|
|
109
|
+
onMediaLoaded: onMediaLoaded
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default EasyCrop;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function step(result) {
|
|
26
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
34
|
+
var _ = {
|
|
35
|
+
label: 0,
|
|
36
|
+
sent: function sent() {
|
|
37
|
+
if (t[0] & 1) throw t[1];
|
|
38
|
+
return t[1];
|
|
39
|
+
},
|
|
40
|
+
trys: [],
|
|
41
|
+
ops: []
|
|
42
|
+
},
|
|
43
|
+
f,
|
|
44
|
+
y,
|
|
45
|
+
t,
|
|
46
|
+
g;
|
|
47
|
+
return g = {
|
|
48
|
+
next: verb(0),
|
|
49
|
+
"throw": verb(1),
|
|
50
|
+
"return": verb(2)
|
|
51
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
52
|
+
return this;
|
|
53
|
+
}), g;
|
|
54
|
+
|
|
55
|
+
function verb(n) {
|
|
56
|
+
return function (v) {
|
|
57
|
+
return step([n, v]);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function step(op) {
|
|
62
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
63
|
+
|
|
64
|
+
while (_) {
|
|
65
|
+
try {
|
|
66
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
67
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
68
|
+
|
|
69
|
+
switch (op[0]) {
|
|
70
|
+
case 0:
|
|
71
|
+
case 1:
|
|
72
|
+
t = op;
|
|
73
|
+
break;
|
|
74
|
+
|
|
75
|
+
case 4:
|
|
76
|
+
_.label++;
|
|
77
|
+
return {
|
|
78
|
+
value: op[1],
|
|
79
|
+
done: false
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
case 5:
|
|
83
|
+
_.label++;
|
|
84
|
+
y = op[1];
|
|
85
|
+
op = [0];
|
|
86
|
+
continue;
|
|
87
|
+
|
|
88
|
+
case 7:
|
|
89
|
+
op = _.ops.pop();
|
|
90
|
+
|
|
91
|
+
_.trys.pop();
|
|
92
|
+
|
|
93
|
+
continue;
|
|
94
|
+
|
|
95
|
+
default:
|
|
96
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
97
|
+
_ = 0;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
102
|
+
_.label = op[1];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
107
|
+
_.label = t[1];
|
|
108
|
+
t = op;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (t && _.label < t[2]) {
|
|
113
|
+
_.label = t[2];
|
|
114
|
+
|
|
115
|
+
_.ops.push(op);
|
|
116
|
+
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (t[2]) _.ops.pop();
|
|
121
|
+
|
|
122
|
+
_.trys.pop();
|
|
123
|
+
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
op = body.call(thisArg, _);
|
|
128
|
+
} catch (e) {
|
|
129
|
+
op = [6, e];
|
|
130
|
+
y = 0;
|
|
131
|
+
} finally {
|
|
132
|
+
f = t = 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (op[0] & 5) throw op[1];
|
|
137
|
+
return {
|
|
138
|
+
value: op[0] ? op[1] : void 0,
|
|
139
|
+
done: true
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
var createImage = function createImage(url) {
|
|
145
|
+
return new Promise(function (resolve, reject) {
|
|
146
|
+
var image = new Image();
|
|
147
|
+
image.addEventListener('load', function () {
|
|
148
|
+
return resolve(image);
|
|
149
|
+
});
|
|
150
|
+
image.addEventListener('error', function (error) {
|
|
151
|
+
return reject(error);
|
|
152
|
+
});
|
|
153
|
+
image.setAttribute('crossOrigin', 'anonymous'); // needed to avoid cross-origin issues on CodeSandbox
|
|
154
|
+
|
|
155
|
+
image.src = url;
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
function getCroppedImg(imageSrc, pixelCrop, name, type) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
+
var _a, width, _b, height, image, bodyEl, canvas, ctx;
|
|
162
|
+
|
|
163
|
+
return __generator(this, function (_c) {
|
|
164
|
+
switch (_c.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
_a = pixelCrop.width, width = _a === void 0 ? 670 : _a, _b = pixelCrop.height, height = _b === void 0 ? 280 : _b;
|
|
167
|
+
return [4
|
|
168
|
+
/*yield*/
|
|
169
|
+
, createImage(imageSrc)];
|
|
170
|
+
|
|
171
|
+
case 1:
|
|
172
|
+
image = _c.sent();
|
|
173
|
+
bodyEl = document.querySelector('body');
|
|
174
|
+
bodyEl.appendChild(image);
|
|
175
|
+
canvas = document.createElement('canvas');
|
|
176
|
+
ctx = canvas.getContext('2d');
|
|
177
|
+
canvas.width = width;
|
|
178
|
+
canvas.height = height;
|
|
179
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(image, 0, 0, width, height);
|
|
180
|
+
bodyEl.removeChild(image); // As a blob
|
|
181
|
+
|
|
182
|
+
return [2
|
|
183
|
+
/*return*/
|
|
184
|
+
, new Promise(function (resolve) {
|
|
185
|
+
canvas.toBlob(function (file) {
|
|
186
|
+
resolve({
|
|
187
|
+
url: URL.createObjectURL(file),
|
|
188
|
+
fileObj: new File([file], name, {
|
|
189
|
+
type: type
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
}, type);
|
|
193
|
+
})];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export default getCroppedImg;
|