Skip to content

Commit 096f847

Browse files
committed
v1.0
1 parent 74c6982 commit 096f847

29 files changed

+20335
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/node_modules
2+
/lib
3+
/cjs
4+
/esm
5+
/dist

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md

.prettierrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"endOfLine": "auto",
5+
"htmlWhitespaceSensitivity": "css",
6+
"insertPragma": false,
7+
"jsxBracketSameLine": false,
8+
"jsxSingleQuote": false,
9+
"printWidth": 100,
10+
"proseWrap": "preserve",
11+
"quoteProps": "as-needed",
12+
"requirePragma": false,
13+
"semi": true,
14+
"singleQuote": false,
15+
"tabWidth": 4,
16+
"trailingComma": "es5",
17+
"useTabs": true
18+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 nobo react-widget-spinner
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,128 @@
1-
# react-widget-spinner
1+
# react-widget-spinner
2+
3+
4+
## 安装
5+
6+
```
7+
npm install --save react-widget-spinner
8+
```
9+
10+
## 使用
11+
12+
[![Edit react-widget-spinner](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/white-fog-smdx6?fontsize=14&hidenavigation=1&theme=dark)
13+
14+
```js
15+
import Spinner from 'react-widget-spinner';
16+
import 'react-widget-spinner/style';
17+
18+
<Spinner />;
19+
20+
```
21+
22+
### Interfaces
23+
24+
```ts
25+
declare const sizeMap: {
26+
small: number;
27+
default: number;
28+
medium: number;
29+
large: number;
30+
};
31+
export interface SpinnerProps extends React.HTMLAttributes<any> {
32+
/** 样式前缀 */
33+
prefixCls?: string;
34+
/** 组件大小 */
35+
size?: keyof typeof sizeMap | number;
36+
/** TODO: 延迟显示加载效果的时间 ms */
37+
delay?: number;
38+
/** 圈圈周长:0-1 */
39+
value?: number;
40+
/** 风格,默认:primary */
41+
type?: "none" | "primary" | "success" | "warning" | "danger";
42+
/** 边框大小 */
43+
strokeWidth?: number;
44+
/** 是否为加载中状态 */
45+
spinning?: boolean;
46+
tagName?: React.ElementType;
47+
}
48+
export declare const Spinner: React.FC<SpinnerProps>;
49+
export default Spinner;
50+
51+
```
52+
53+
### defaultProps
54+
55+
```js
56+
{
57+
prefixCls: "rw-spinner",
58+
size: "default",
59+
type: "primary",
60+
spinning: true,
61+
tagName: "div",
62+
value: 0.25,
63+
}
64+
```
65+
66+
### 基础样式
67+
68+
```css
69+
@keyframes rw-spinner-animation {
70+
from {
71+
transform: rotate(0deg);
72+
}
73+
to {
74+
transform: rotate(360deg);
75+
}
76+
}
77+
78+
.rw-spinner {
79+
display: none;
80+
align-items: center;
81+
justify-content: center;
82+
83+
overflow: visible;
84+
vertical-align: middle;
85+
86+
transition: color 500ms linear;
87+
}
88+
89+
.rw-spinner-spinning {
90+
display: inline-flex;
91+
}
92+
93+
.rw-spinner-primary {
94+
color: #1890ff;
95+
}
96+
.rw-spinner-success {
97+
color: #52c41a;
98+
}
99+
.rw-spinner-warning {
100+
color: #faad14;
101+
}
102+
.rw-spinner-danger {
103+
color: #ff4d4f;
104+
}
105+
106+
.rw-spinner svg {
107+
display: block;
108+
}
109+
110+
.rw-spinner path {
111+
fill-opacity: 0;
112+
}
113+
114+
.rw-spinner-head {
115+
transform-origin: center;
116+
transition: stroke-dashoffset 200ms cubic-bezier(0.4, 1, 0.75, 0.9);
117+
stroke-linecap: round;
118+
}
119+
120+
.rw-spinner-track {
121+
stroke: rgba(92, 112, 128, 0.2);
122+
}
123+
124+
.rw-spinner .rw-spinner-animation {
125+
animation: rw-spinner-animation 500ms linear infinite;
126+
}
127+
128+
```

babel.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = api => {
2+
const isTest = api.env("test");
3+
if (!isTest) return {};
4+
5+
return {
6+
presets: [
7+
[
8+
"babel-preset-packez",
9+
{
10+
modules: "cjs",
11+
},
12+
],
13+
],
14+
};
15+
};

docs/asset-manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"index.css": "static/css/index.a48f4805.chunk.css",
3+
"index.js": "static/js/index.a48f4805.chunk.js",
4+
"runtime-index.js": "static/js/runtime-index.92eae014.js",
5+
"static/js/2.fde574d2.chunk.js": "static/js/2.fde574d2.chunk.js",
6+
"index.html": "index.html"
7+
}

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!doctype html><html><head><meta charset="utf-8"/><title>Spinner</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"/><style>.demo{width:80%;margin:100px auto;background:#fff;font-size:12px;overflow:auto}</style><link href="static/css/index.a48f4805.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime-index.92eae014.js"></script><script src="static/js/2.fde574d2.chunk.js"></script><script src="static/js/index.a48f4805.chunk.js"></script></body></html>

docs/static/css/index.a48f4805.chunk.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/static/js/2.fde574d2.chunk.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)