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.
Files changed (245) hide show
  1. package/es/button-drawer/index.d.ts +10 -0
  2. package/es/button-drawer/index.js +116 -0
  3. package/es/button-drawer/style/index.d.ts +1 -0
  4. package/es/button-drawer/style/index.js +1 -0
  5. package/es/button-modal/index.d.ts +14 -0
  6. package/es/button-modal/index.js +131 -0
  7. package/es/button-modal/style/index.d.ts +1 -0
  8. package/es/button-modal/style/index.js +1 -0
  9. package/es/condition-input/index.d.ts +15 -0
  10. package/es/condition-input/index.js +108 -0
  11. package/es/condition-input/parse2RegexOption.d.ts +13 -0
  12. package/es/condition-input/parse2RegexOption.js +57 -0
  13. package/es/condition-input/style/index.d.ts +1 -0
  14. package/es/condition-input/style/index.js +1 -0
  15. package/es/copy-to-clipboard/index.d.ts +22 -0
  16. package/es/copy-to-clipboard/index.js +95 -0
  17. package/es/copy-to-clipboard/style/index.css +249 -0
  18. package/es/copy-to-clipboard/style/index.d.ts +1 -0
  19. package/es/copy-to-clipboard/style/index.js +1 -0
  20. package/es/copy-to-clipboard/style/index.less +1 -0
  21. package/es/highlight-textarea/HighlighedContents.d.ts +7 -0
  22. package/es/highlight-textarea/HighlighedContents.js +15 -0
  23. package/es/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
  24. package/es/highlight-textarea/extractSpansOfClasses.js +159 -0
  25. package/es/highlight-textarea/getRanges.d.ts +2 -0
  26. package/es/highlight-textarea/getRanges.js +142 -0
  27. package/es/highlight-textarea/getType.d.ts +2 -0
  28. package/es/highlight-textarea/getType.js +29 -0
  29. package/es/highlight-textarea/index.d.ts +12 -0
  30. package/es/highlight-textarea/index.js +132 -0
  31. package/es/highlight-textarea/style/index.css +38 -0
  32. package/es/highlight-textarea/style/index.d.ts +2 -0
  33. package/es/highlight-textarea/style/index.js +2 -0
  34. package/es/highlight-textarea/style/index.less +42 -0
  35. package/es/highlight-textarea/types.d.ts +16 -0
  36. package/es/highlight-textarea/types.js +0 -0
  37. package/es/highlight-words/index.d.ts +3 -0
  38. package/es/highlight-words/index.js +2 -0
  39. package/es/highlight-words/style/index.d.ts +1 -0
  40. package/es/highlight-words/style/index.js +0 -0
  41. package/es/icon/demo/svg/check-circle-filled.svg +6 -0
  42. package/es/icon/demo/svg/coin-circle.svg +9 -0
  43. package/es/icon/index.d.ts +27 -0
  44. package/es/icon/index.js +95 -0
  45. package/es/icon/style/index.d.ts +1 -0
  46. package/es/icon/style/index.js +0 -0
  47. package/es/icon/utils.d.ts +6 -0
  48. package/es/icon/utils.js +22 -0
  49. package/es/img-crop/EasyCrop.d.ts +6 -0
  50. package/es/img-crop/EasyCrop.js +113 -0
  51. package/es/img-crop/getCroppedImg.d.ts +6 -0
  52. package/es/img-crop/getCroppedImg.js +199 -0
  53. package/es/img-crop/index.d.ts +53 -0
  54. package/es/img-crop/index.js +531 -0
  55. package/es/img-crop/style/index.css +52 -0
  56. package/es/img-crop/style/index.d.ts +3 -0
  57. package/es/img-crop/style/index.js +3 -0
  58. package/es/img-crop/style/index.less +54 -0
  59. package/es/index.d.ts +34 -2
  60. package/es/index.js +18 -2
  61. package/es/keep-tab/demo/index.modules.less +66 -0
  62. package/es/keep-tab/index.d.ts +29 -0
  63. package/es/keep-tab/index.js +129 -0
  64. package/es/keep-tab/style/index.css +1129 -0
  65. package/es/keep-tab/style/index.d.ts +2 -0
  66. package/es/keep-tab/style/index.js +2 -0
  67. package/es/keep-tab/style/index.less +2 -0
  68. package/es/number-input/index.d.ts +22 -7
  69. package/es/number-input/index.js +22 -11
  70. package/es/number-input/style/index.d.ts +1 -1
  71. package/es/number-input/style/index.js +1 -1
  72. package/es/number-input/utils.d.ts +10 -11
  73. package/es/number-input/utils.js +7 -7
  74. package/es/rc-echart/core.d.ts +32 -0
  75. package/es/rc-echart/core.js +136 -0
  76. package/es/rc-echart/index.d.ts +21 -0
  77. package/es/rc-echart/index.js +27 -0
  78. package/es/rc-echart/style/index.d.ts +1 -0
  79. package/es/rc-echart/style/index.js +0 -0
  80. package/es/rc-motion/demo/CSSMotion.less +91 -0
  81. package/es/rc-motion/index.d.ts +2 -0
  82. package/es/rc-motion/index.js +2 -0
  83. package/es/rc-motion/style/index.d.ts +1 -0
  84. package/es/rc-motion/style/index.js +0 -0
  85. package/es/rc-qrcode/index.d.ts +20 -0
  86. package/es/rc-qrcode/index.js +57 -0
  87. package/es/rc-qrcode/style/index.d.ts +1 -0
  88. package/es/rc-qrcode/style/index.js +0 -0
  89. package/es/rc-qrcode/useQrcode.d.ts +4 -0
  90. package/es/rc-qrcode/useQrcode.js +50 -0
  91. package/es/rc-transition-group/index.d.ts +2 -0
  92. package/es/rc-transition-group/index.js +2 -0
  93. package/es/rc-transition-group/style/index.d.ts +1 -0
  94. package/es/rc-transition-group/style/index.js +0 -0
  95. package/es/single-img-upload/index.d.ts +19 -0
  96. package/es/single-img-upload/index.js +199 -0
  97. package/es/single-img-upload/style/index.css +74 -0
  98. package/es/single-img-upload/style/index.d.ts +3 -0
  99. package/es/single-img-upload/style/index.js +3 -0
  100. package/es/single-img-upload/style/index.less +85 -0
  101. package/es/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
  102. package/es/sortable-hoc/demo/index.modules.less +248 -0
  103. package/es/sortable-hoc/index.d.ts +2 -0
  104. package/es/sortable-hoc/index.js +2 -0
  105. package/es/sortable-hoc/style/index.d.ts +1 -0
  106. package/es/sortable-hoc/style/index.js +0 -0
  107. package/es/split-pane/index.d.ts +59 -0
  108. package/es/split-pane/index.js +21 -0
  109. package/es/split-pane/style/index.css +41 -0
  110. package/es/split-pane/style/index.d.ts +1 -0
  111. package/es/split-pane/style/index.js +1 -0
  112. package/es/split-pane/style/index.less +49 -0
  113. package/es/text-area/index.d.ts +12 -0
  114. package/es/text-area/index.js +96 -0
  115. package/es/text-area/style/index.d.ts +1 -0
  116. package/es/text-area/style/index.js +1 -0
  117. package/es/text-input/index.d.ts +5 -0
  118. package/es/text-input/index.js +85 -0
  119. package/es/{number-input → text-input}/style/index.css +0 -3
  120. package/es/text-input/style/index.d.ts +1 -0
  121. package/es/text-input/style/index.js +1 -0
  122. package/es/{number-input → text-input}/style/index.less +0 -4
  123. package/lib/button-drawer/index.d.ts +10 -0
  124. package/lib/button-drawer/index.js +164 -0
  125. package/lib/button-drawer/style/index.d.ts +1 -0
  126. package/lib/button-drawer/style/index.js +7 -0
  127. package/lib/button-modal/index.d.ts +14 -0
  128. package/lib/button-modal/index.js +178 -0
  129. package/lib/button-modal/style/index.d.ts +1 -0
  130. package/lib/button-modal/style/index.js +7 -0
  131. package/lib/condition-input/index.d.ts +15 -0
  132. package/lib/condition-input/index.js +158 -0
  133. package/lib/condition-input/parse2RegexOption.d.ts +13 -0
  134. package/lib/condition-input/parse2RegexOption.js +72 -0
  135. package/lib/condition-input/style/index.d.ts +1 -0
  136. package/lib/condition-input/style/index.js +7 -0
  137. package/lib/copy-to-clipboard/index.d.ts +22 -0
  138. package/lib/copy-to-clipboard/index.js +143 -0
  139. package/lib/copy-to-clipboard/style/index.css +249 -0
  140. package/lib/copy-to-clipboard/style/index.d.ts +1 -0
  141. package/lib/copy-to-clipboard/style/index.js +7 -0
  142. package/lib/copy-to-clipboard/style/index.less +1 -0
  143. package/lib/highlight-textarea/HighlighedContents.d.ts +7 -0
  144. package/lib/highlight-textarea/HighlighedContents.js +29 -0
  145. package/lib/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
  146. package/lib/highlight-textarea/extractSpansOfClasses.js +173 -0
  147. package/lib/highlight-textarea/getRanges.d.ts +2 -0
  148. package/lib/highlight-textarea/getRanges.js +156 -0
  149. package/lib/highlight-textarea/getType.d.ts +2 -0
  150. package/lib/highlight-textarea/getType.js +37 -0
  151. package/lib/highlight-textarea/index.d.ts +12 -0
  152. package/lib/highlight-textarea/index.js +183 -0
  153. package/lib/highlight-textarea/style/index.css +38 -0
  154. package/lib/highlight-textarea/style/index.d.ts +2 -0
  155. package/lib/highlight-textarea/style/index.js +9 -0
  156. package/lib/highlight-textarea/style/index.less +42 -0
  157. package/lib/highlight-textarea/types.d.ts +16 -0
  158. package/lib/highlight-textarea/types.js +5 -0
  159. package/lib/highlight-words/index.d.ts +3 -0
  160. package/lib/highlight-words/index.js +15 -0
  161. package/lib/highlight-words/style/index.d.ts +1 -0
  162. package/lib/highlight-words/style/index.js +0 -0
  163. package/lib/icon/demo/svg/check-circle-filled.svg +6 -0
  164. package/lib/icon/demo/svg/coin-circle.svg +9 -0
  165. package/lib/icon/index.d.ts +27 -0
  166. package/lib/icon/index.js +143 -0
  167. package/lib/icon/style/index.d.ts +1 -0
  168. package/lib/icon/style/index.js +0 -0
  169. package/lib/icon/utils.d.ts +6 -0
  170. package/lib/icon/utils.js +32 -0
  171. package/lib/img-crop/EasyCrop.d.ts +6 -0
  172. package/lib/img-crop/EasyCrop.js +160 -0
  173. package/lib/img-crop/getCroppedImg.d.ts +6 -0
  174. package/lib/img-crop/getCroppedImg.js +205 -0
  175. package/lib/img-crop/index.d.ts +53 -0
  176. package/lib/img-crop/index.js +582 -0
  177. package/lib/img-crop/style/index.css +52 -0
  178. package/lib/img-crop/style/index.d.ts +3 -0
  179. package/lib/img-crop/style/index.js +11 -0
  180. package/lib/img-crop/style/index.less +54 -0
  181. package/lib/index.d.ts +34 -2
  182. package/lib/index.js +160 -9
  183. package/lib/keep-tab/demo/index.modules.less +66 -0
  184. package/lib/keep-tab/index.d.ts +29 -0
  185. package/lib/keep-tab/index.js +181 -0
  186. package/lib/keep-tab/style/index.css +1129 -0
  187. package/lib/keep-tab/style/index.d.ts +2 -0
  188. package/lib/keep-tab/style/index.js +9 -0
  189. package/lib/keep-tab/style/index.less +2 -0
  190. package/lib/number-input/index.d.ts +22 -7
  191. package/lib/number-input/index.js +22 -11
  192. package/lib/number-input/style/index.d.ts +1 -1
  193. package/lib/number-input/style/index.js +1 -1
  194. package/lib/number-input/utils.d.ts +10 -11
  195. package/lib/number-input/utils.js +8 -8
  196. package/lib/rc-echart/core.d.ts +32 -0
  197. package/lib/rc-echart/core.js +185 -0
  198. package/lib/rc-echart/index.d.ts +21 -0
  199. package/lib/rc-echart/index.js +75 -0
  200. package/lib/rc-echart/style/index.d.ts +1 -0
  201. package/lib/rc-echart/style/index.js +0 -0
  202. package/lib/rc-motion/demo/CSSMotion.less +91 -0
  203. package/lib/rc-motion/index.d.ts +2 -0
  204. package/lib/rc-motion/index.js +43 -0
  205. package/lib/rc-motion/style/index.d.ts +1 -0
  206. package/lib/rc-motion/style/index.js +0 -0
  207. package/lib/rc-qrcode/index.d.ts +20 -0
  208. package/lib/rc-qrcode/index.js +108 -0
  209. package/lib/rc-qrcode/style/index.d.ts +1 -0
  210. package/lib/rc-qrcode/style/index.js +0 -0
  211. package/lib/rc-qrcode/useQrcode.d.ts +4 -0
  212. package/lib/rc-qrcode/useQrcode.js +66 -0
  213. package/lib/rc-transition-group/index.d.ts +2 -0
  214. package/lib/rc-transition-group/index.js +43 -0
  215. package/lib/rc-transition-group/style/index.d.ts +1 -0
  216. package/lib/rc-transition-group/style/index.js +0 -0
  217. package/lib/single-img-upload/index.d.ts +19 -0
  218. package/lib/single-img-upload/index.js +250 -0
  219. package/lib/single-img-upload/style/index.css +74 -0
  220. package/lib/single-img-upload/style/index.d.ts +3 -0
  221. package/lib/single-img-upload/style/index.js +11 -0
  222. package/lib/single-img-upload/style/index.less +85 -0
  223. package/lib/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
  224. package/lib/sortable-hoc/demo/index.modules.less +248 -0
  225. package/lib/sortable-hoc/index.d.ts +2 -0
  226. package/lib/sortable-hoc/index.js +43 -0
  227. package/lib/sortable-hoc/style/index.d.ts +1 -0
  228. package/lib/sortable-hoc/style/index.js +0 -0
  229. package/lib/split-pane/index.d.ts +59 -0
  230. package/lib/split-pane/index.js +69 -0
  231. package/lib/split-pane/style/index.css +41 -0
  232. package/lib/split-pane/style/index.d.ts +1 -0
  233. package/lib/split-pane/style/index.js +7 -0
  234. package/lib/split-pane/style/index.less +49 -0
  235. package/lib/text-area/index.d.ts +12 -0
  236. package/lib/text-area/index.js +144 -0
  237. package/lib/text-area/style/index.d.ts +1 -0
  238. package/lib/text-area/style/index.js +7 -0
  239. package/lib/text-input/index.d.ts +5 -0
  240. package/lib/text-input/index.js +99 -0
  241. package/lib/{number-input → text-input}/style/index.css +0 -3
  242. package/lib/text-input/style/index.d.ts +1 -0
  243. package/lib/text-input/style/index.js +7 -0
  244. package/lib/{number-input → text-input}/style/index.less +0 -4
  245. package/package.json +20 -3
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;
@@ -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;
@@ -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,6 @@
1
+ interface pixelCropType {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ declare function getCroppedImg(imageSrc: string, pixelCrop: pixelCropType, name: string, type: string): Promise<unknown>;
6
+ export default getCroppedImg;
@@ -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;