@avilang/practical-ui 0.1.5 → 0.2.1

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 (60) hide show
  1. package/dist/assets/LatoLatin-Regular.woff2 +0 -0
  2. package/dist/assets/LatoLatin-Semibold.woff2 +0 -0
  3. package/dist/index.js +8395 -0
  4. package/dist/style.css +1 -0
  5. package/index.js +13 -0
  6. package/package.json +31 -55
  7. package/.browserslistrc +0 -6
  8. package/.editorconfig +0 -15
  9. package/.eslintrc +0 -25
  10. package/.gitattributes +0 -4
  11. package/.husky/pre-commit +0 -4
  12. package/.stylelintrc.json +0 -14
  13. package/LICENSE +0 -21
  14. package/README.md +0 -3
  15. package/dist/Icon-shared.js +0 -33
  16. package/dist/button/index.js +0 -159
  17. package/dist/button/style/index.css +0 -1
  18. package/dist/checkbox/index.js +0 -61
  19. package/dist/checkbox/style/index.css +0 -1
  20. package/dist/icon/index.js +0 -4
  21. package/dist/icon/style/index.css +0 -1
  22. package/dist/index-shared.js +0 -146
  23. package/dist/style/fonts/icomoon-practical.eot +0 -0
  24. package/dist/style/fonts/icomoon-practical.svg +0 -12
  25. package/dist/style/fonts/icomoon-practical.ttf +0 -0
  26. package/dist/style/fonts/icomoon-practical.woff +0 -0
  27. package/dist/style/index.css +0 -1
  28. package/docz.config.js +0 -3
  29. package/gatsby-config.js +0 -3
  30. package/gulpfile.js +0 -48
  31. package/lib/_fonts/icomoon-practical-v1.0/Read Me.txt +0 -7
  32. package/lib/_fonts/icomoon-practical-v1.0/demo-files/demo.css +0 -152
  33. package/lib/_fonts/icomoon-practical-v1.0/demo-files/demo.js +0 -30
  34. package/lib/_fonts/icomoon-practical-v1.0/demo.html +0 -66
  35. package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.eot +0 -0
  36. package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.svg +0 -12
  37. package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.ttf +0 -0
  38. package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.woff +0 -0
  39. package/lib/_fonts/icomoon-practical-v1.0/selection.json +0 -1
  40. package/lib/_fonts/icomoon-practical-v1.0/style.css +0 -33
  41. package/lib/_variables.scss +0 -20
  42. package/lib/button/Button.js +0 -118
  43. package/lib/button/doc/button.mdx +0 -119
  44. package/lib/button/index.js +0 -1
  45. package/lib/button/style/button.scss +0 -195
  46. package/lib/checkbox/Checkbox.js +0 -46
  47. package/lib/checkbox/doc/checkbox.mdx +0 -82
  48. package/lib/checkbox/index.js +0 -1
  49. package/lib/checkbox/style/checkbox.scss +0 -127
  50. package/lib/icon/Icon.js +0 -30
  51. package/lib/icon/doc/icon.mdx +0 -45
  52. package/lib/icon/index.js +0 -1
  53. package/lib/icon/style/icon.scss +0 -20
  54. package/lib/input/Input.js +0 -3
  55. package/lib/input/index.js +0 -1
  56. package/lib/util/index.js +0 -1
  57. package/lib/util/useThrottleFn.js +0 -31
  58. package/prettier.config.js +0 -20
  59. package/rollup.config.js +0 -30
  60. package/src/gatsby-theme-docz/wrapper.js +0 -9
@@ -1 +0,0 @@
1
- @font-face{font-family:icomoon-practical;src:url(fonts/icomoon-practical.eot?k3ocmb);src:url(fonts/icomoon-practical.eot?k3ocmb#iefix) format('embedded-opentype'),url(fonts/icomoon-practical.ttf?k3ocmb) format('truetype'),url(fonts/icomoon-practical.woff?k3ocmb) format('woff'),url(fonts/icomoon-practical.svg?k3ocmb#icomoon-practical) format('svg');font-weight:400;font-style:normal;font-display:block}[class*=" practical-icon-"],[class^=practical-icon-]{font-family:icomoon-practical!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.practical-icon-loading:before{content:"\e900"}.practical-icon-search:before{content:"\e901"}
package/docz.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- files: '**/*.mdx'
3
- };
package/gatsby-config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- plugins: ['gatsby-plugin-sass']
3
- };
package/gulpfile.js DELETED
@@ -1,48 +0,0 @@
1
- const { src, dest, parallel } = require('gulp');
2
- const sass = require('gulp-sass');
3
- const rename = require('gulp-rename');
4
- const autoprefixer = require('gulp-autoprefixer');
5
- const cleanCSS = require('gulp-clean-css');
6
-
7
- sass.compiler = require('node-sass');
8
-
9
- function scss() {
10
- return src('lib/**/*.scss')
11
- .pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
12
- .pipe(
13
- autoprefixer({
14
- cascade: false
15
- })
16
- )
17
- .pipe(
18
- rename(function (path) {
19
- return {
20
- dirname: path.dirname,
21
- basename: 'index',
22
- extname: path.extname
23
- };
24
- })
25
- )
26
- .pipe(dest('./dist'));
27
- }
28
-
29
- function style() {
30
- return src('lib/_fonts/icomoon-practical-v1.0/style.css')
31
- .pipe(cleanCSS({ compatibility: 'ie8', level: 1 }))
32
- .pipe(
33
- rename(function () {
34
- return {
35
- dirname: 'style',
36
- basename: 'index',
37
- extname: '.css'
38
- };
39
- })
40
- )
41
- .pipe(dest('./dist'));
42
- }
43
-
44
- function staticFile() {
45
- return src('lib/_fonts/icomoon-practical-v1.0/fonts/**/*').pipe(dest('./dist/style/fonts'));
46
- }
47
-
48
- exports.default = parallel(style, staticFile, scss);
@@ -1,7 +0,0 @@
1
- Open *demo.html* to see a list of all the glyphs in your font along with their codes/ligatures.
2
-
3
- To use the generated font in desktop programs, you can install the TTF font. In order to copy the character associated with each icon, refer to the text box at the bottom right corner of each glyph in demo.html. The character inside this text box may be invisible; but it can still be copied. See this guide for more info: https://icomoon.io/#docs/local-fonts
4
-
5
- You won't need any of the files located under the *demo-files* directory when including the generated font in your own projects.
6
-
7
- You can import *selection.json* back to the IcoMoon app using the *Import Icons* button (or via Main Menu → Manage Projects) to retrieve your icon selection.
@@ -1,152 +0,0 @@
1
- body {
2
- padding: 0;
3
- margin: 0;
4
- font-family: sans-serif;
5
- font-size: 1em;
6
- line-height: 1.5;
7
- color: #555;
8
- background: #fff;
9
- }
10
- h1 {
11
- font-size: 1.5em;
12
- font-weight: normal;
13
- }
14
- small {
15
- font-size: .66666667em;
16
- }
17
- a {
18
- color: #e74c3c;
19
- text-decoration: none;
20
- }
21
- a:hover, a:focus {
22
- box-shadow: 0 1px #e74c3c;
23
- }
24
- .bshadow0, input {
25
- box-shadow: inset 0 -2px #e7e7e7;
26
- }
27
- input:hover {
28
- box-shadow: inset 0 -2px #ccc;
29
- }
30
- input, fieldset {
31
- font-family: sans-serif;
32
- font-size: 1em;
33
- margin: 0;
34
- padding: 0;
35
- border: 0;
36
- }
37
- input {
38
- color: inherit;
39
- line-height: 1.5;
40
- height: 1.5em;
41
- padding: .25em 0;
42
- }
43
- input:focus {
44
- outline: none;
45
- box-shadow: inset 0 -2px #449fdb;
46
- }
47
- .glyph {
48
- font-size: 16px;
49
- width: 15em;
50
- padding-bottom: 1em;
51
- margin-right: 4em;
52
- margin-bottom: 1em;
53
- float: left;
54
- overflow: hidden;
55
- }
56
- .liga {
57
- width: 80%;
58
- width: calc(100% - 2.5em);
59
- }
60
- .talign-right {
61
- text-align: right;
62
- }
63
- .talign-center {
64
- text-align: center;
65
- }
66
- .bgc1 {
67
- background: #f1f1f1;
68
- }
69
- .fgc1 {
70
- color: #999;
71
- }
72
- .fgc0 {
73
- color: #000;
74
- }
75
- p {
76
- margin-top: 1em;
77
- margin-bottom: 1em;
78
- }
79
- .mvm {
80
- margin-top: .75em;
81
- margin-bottom: .75em;
82
- }
83
- .mtn {
84
- margin-top: 0;
85
- }
86
- .mtl, .mal {
87
- margin-top: 1.5em;
88
- }
89
- .mbl, .mal {
90
- margin-bottom: 1.5em;
91
- }
92
- .mal, .mhl {
93
- margin-left: 1.5em;
94
- margin-right: 1.5em;
95
- }
96
- .mhmm {
97
- margin-left: 1em;
98
- margin-right: 1em;
99
- }
100
- .mls {
101
- margin-left: .25em;
102
- }
103
- .ptl {
104
- padding-top: 1.5em;
105
- }
106
- .pbs, .pvs {
107
- padding-bottom: .25em;
108
- }
109
- .pvs, .pts {
110
- padding-top: .25em;
111
- }
112
- .unit {
113
- float: left;
114
- }
115
- .unitRight {
116
- float: right;
117
- }
118
- .size1of2 {
119
- width: 50%;
120
- }
121
- .size1of1 {
122
- width: 100%;
123
- }
124
- .clearfix:before, .clearfix:after {
125
- content: " ";
126
- display: table;
127
- }
128
- .clearfix:after {
129
- clear: both;
130
- }
131
- .hidden-true {
132
- display: none;
133
- }
134
- .textbox0 {
135
- width: 3em;
136
- background: #f1f1f1;
137
- padding: .25em .5em;
138
- line-height: 1.5;
139
- height: 1.5em;
140
- }
141
- #testDrive {
142
- display: block;
143
- padding-top: 24px;
144
- line-height: 1.5;
145
- }
146
- .fs0 {
147
- font-size: 16px;
148
- }
149
- .fs1 {
150
- font-size: 20px;
151
- }
152
-
@@ -1,30 +0,0 @@
1
- if (!('boxShadow' in document.body.style)) {
2
- document.body.setAttribute('class', 'noBoxShadow');
3
- }
4
-
5
- document.body.addEventListener("click", function(e) {
6
- var target = e.target;
7
- if (target.tagName === "INPUT" &&
8
- target.getAttribute('class').indexOf('liga') === -1) {
9
- target.select();
10
- }
11
- });
12
-
13
- (function() {
14
- var fontSize = document.getElementById('fontSize'),
15
- testDrive = document.getElementById('testDrive'),
16
- testText = document.getElementById('testText');
17
- function updateTest() {
18
- testDrive.innerHTML = testText.value || String.fromCharCode(160);
19
- if (window.icomoonLiga) {
20
- window.icomoonLiga(testDrive);
21
- }
22
- }
23
- function updateSize() {
24
- testDrive.style.fontSize = fontSize.value + 'px';
25
- }
26
- fontSize.addEventListener('change', updateSize, false);
27
- testText.addEventListener('input', updateTest, false);
28
- testText.addEventListener('change', updateTest, false);
29
- updateSize();
30
- }());
@@ -1,66 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>IcoMoon Demo</title>
6
- <meta name="description" content="An Icon Font Generated By IcoMoon.io">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <link rel="stylesheet" href="demo-files/demo.css">
9
- <link rel="stylesheet" href="style.css"></head>
10
- <body>
11
- <div class="bgc1 clearfix">
12
- <h1 class="mhmm mvm"><span class="fgc1">Font Name:</span> icomoon-practical <small class="fgc1">(Glyphs:&nbsp;2)</small></h1>
13
- </div>
14
- <div class="clearfix mhl ptl">
15
- <h1 class="mvm mtn fgc1">Grid Size: Unknown</h1>
16
- <div class="glyph fs1">
17
- <div class="clearfix bshadow0 pbs">
18
- <span class="practical-icon-loading"></span>
19
- <span class="mls"> practical-icon-loading</span>
20
- </div>
21
- <fieldset class="fs0 size1of1 clearfix hidden-false">
22
- <input type="text" readonly value="e900" class="unit size1of2" />
23
- <input type="text" maxlength="1" readonly value="&#xe900;" class="unitRight size1of2 talign-right" />
24
- </fieldset>
25
- <div class="fs0 bshadow0 clearfix hidden-true">
26
- <span class="unit pvs fgc1">liga: </span>
27
- <input type="text" readonly value="" class="liga unitRight" />
28
- </div>
29
- </div>
30
- <div class="glyph fs1">
31
- <div class="clearfix bshadow0 pbs">
32
- <span class="practical-icon-search"></span>
33
- <span class="mls"> practical-icon-search</span>
34
- </div>
35
- <fieldset class="fs0 size1of1 clearfix hidden-false">
36
- <input type="text" readonly value="e901" class="unit size1of2" />
37
- <input type="text" maxlength="1" readonly value="&#xe901;" class="unitRight size1of2 talign-right" />
38
- </fieldset>
39
- <div class="fs0 bshadow0 clearfix hidden-true">
40
- <span class="unit pvs fgc1">liga: </span>
41
- <input type="text" readonly value="" class="liga unitRight" />
42
- </div>
43
- </div>
44
- </div>
45
-
46
- <!--[if gt IE 8]><!-->
47
- <div class="mhl clearfix mbl">
48
- <h1>Font Test Drive</h1>
49
- <label>
50
- Font Size: <input id="fontSize" type="number" class="textbox0 mbm"
51
- min="8" value="48" />
52
- px
53
- </label>
54
- <input id="testText" type="text" class="phl size1of1 mvl"
55
- placeholder="Type some text to test..." value=""/>
56
- <div id="testDrive" class="practical-icon-" style="font-family: icomoon-practical">&nbsp;
57
- </div>
58
- </div>
59
- <!--<![endif]-->
60
- <div class="bgc1 clearfix">
61
- <p class="mhl">Generated by <a href="https://icomoon.io/app">IcoMoon</a></p>
62
- </div>
63
-
64
- <script src="demo-files/demo.js"></script>
65
- </body>
66
- </html>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Generated by IcoMoon</metadata>
5
- <defs>
6
- <font id="icomoon-practical" horiz-adv-x="1024">
7
- <font-face units-per-em="1024" ascent="960" descent="-64" />
8
- <missing-glyph horiz-adv-x="1024" />
9
- <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
- <glyph unicode="&#xe900;" glyph-name="loading" d="M270.4 758.4c65.6 54.4 149.6 86.4 241.6 86.4 212 0 384-172 384-384h64c0 247.2-200.8 448-448 448-107.2 0-205.6-37.6-282.4-100l40.8-50.4z" />
11
- <glyph unicode="&#xe901;" glyph-name="search" d="M426.667 930.133q77.995 0 149.163-30.507t122.496-81.835 81.835-122.496 30.507-149.163q0-66.987-21.845-128.341t-62.165-111.317l242.347-242.005q12.331-12.331 12.331-30.336 0-18.347-12.16-30.507t-30.507-12.16q-18.005 0-30.336 12.331l-242.005 242.347q-50.005-40.32-111.317-62.165t-128.341-21.845q-77.995 0-149.163 30.507t-122.496 81.835-81.835 122.496-30.507 149.163 30.507 149.163 81.835 122.496 122.496 81.835 149.163 30.507zM426.667 844.8q-60.672 0-116.011-23.68t-95.317-63.659-63.659-95.317-23.68-116.011 23.68-116.011 63.659-95.317 95.317-63.659 116.011-23.68 116.011 23.68 95.317 63.659 63.659 95.317 23.68 116.011-23.68 116.011-63.659 95.317-95.317 63.659-116.011 23.68z" />
12
- </font></defs></svg>
@@ -1 +0,0 @@
1
- {"IcoMoonType":"selection","icons":[{"icon":{"paths":["M270.4 214.4c65.6-54.4 149.6-86.4 241.6-86.4 212 0 384 172 384 384h64c0-247.2-200.8-448-448-448-107.2 0-205.6 37.6-282.4 100l40.8 50.4z"],"attrs":[{}],"isMulticolor":false,"isMulticolor2":false,"tags":["loading"],"grid":0},"attrs":[{}],"properties":{"order":13,"id":0,"name":"loading","prevSize":20,"code":59648},"setIdx":0,"setId":0,"iconIdx":0},{"icon":{"paths":["M426.667 42.667q77.995 0 149.163 30.507t122.496 81.835 81.835 122.496 30.507 149.163q0 66.987-21.845 128.341t-62.165 111.317l242.347 242.005q12.331 12.331 12.331 30.336 0 18.347-12.16 30.507t-30.507 12.16q-18.005 0-30.336-12.331l-242.005-242.347q-50.005 40.32-111.317 62.165t-128.341 21.845q-77.995 0-149.163-30.507t-122.496-81.835-81.835-122.496-30.507-149.163 30.507-149.163 81.835-122.496 122.496-81.835 149.163-30.507zM426.667 128q-60.672 0-116.011 23.68t-95.317 63.659-63.659 95.317-23.68 116.011 23.68 116.011 63.659 95.317 95.317 63.659 116.011 23.68 116.011-23.68 95.317-63.659 63.659-95.317 23.68-116.011-23.68-116.011-63.659-95.317-95.317-63.659-116.011-23.68z"],"attrs":[],"isMulticolor":false,"isMulticolor2":false,"tags":["search"],"grid":0},"attrs":[],"properties":{"order":11,"id":1,"name":"search","prevSize":20,"code":59649},"setIdx":0,"setId":0,"iconIdx":1}],"height":1024,"metadata":{"name":"icomoon-practical"},"preferences":{"showGlyphs":true,"showQuickUse":true,"showQuickUse2":true,"showSVGs":true,"fontPref":{"prefix":"practical-icon-","metadata":{"fontFamily":"icomoon-practical","majorVersion":1,"minorVersion":0},"metrics":{"emSize":1024,"baseline":6.25,"whitespace":50},"embed":false,"showSelector":false,"showMetrics":false,"showMetadata":false,"showVersion":false,"includeMetadata":false,"cssVars":false,"cssVarsFormat":"scss","flutter":false,"noie8":false,"ie7":false,"selector":"","classSelector":".icon"},"imagePref":{"prefix":"icon-","png":true,"useClassSelector":true,"color":0,"bgColor":16777215,"classSelector":".icon"},"historySize":50,"showCodes":true,"gridSize":16}}
@@ -1,33 +0,0 @@
1
- @font-face {
2
- font-family: 'icomoon-practical';
3
- src: url('fonts/icomoon-practical.eot?k3ocmb');
4
- src: url('fonts/icomoon-practical.eot?k3ocmb#iefix') format('embedded-opentype'),
5
- url('fonts/icomoon-practical.ttf?k3ocmb') format('truetype'),
6
- url('fonts/icomoon-practical.woff?k3ocmb') format('woff'),
7
- url('fonts/icomoon-practical.svg?k3ocmb#icomoon-practical') format('svg');
8
- font-weight: normal;
9
- font-style: normal;
10
- font-display: block;
11
- }
12
-
13
- [class^="practical-icon-"], [class*=" practical-icon-"] {
14
- /* use !important to prevent issues with browser extensions that change fonts */
15
- font-family: 'icomoon-practical' !important;
16
- speak: never;
17
- font-style: normal;
18
- font-weight: normal;
19
- font-variant: normal;
20
- text-transform: none;
21
- line-height: 1;
22
-
23
- /* Better Font Rendering =========== */
24
- -webkit-font-smoothing: antialiased;
25
- -moz-osx-font-smoothing: grayscale;
26
- }
27
-
28
- .practical-icon-loading:before {
29
- content: "\e900";
30
- }
31
- .practical-icon-search:before {
32
- content: "\e901";
33
- }
@@ -1,20 +0,0 @@
1
- $prefix: practical;
2
-
3
- /** 颜色 */
4
- $blue-5: #40a9ff;
5
- $blue-6: #1890ff;
6
-
7
- $green-5: #73d13d;
8
- $green-6: #52c41a;
9
-
10
- $red-6: #f5222d;
11
-
12
- $border-color: #d9d9d9;
13
- $background-color: #f5f5f5;
14
-
15
- /** 字体颜色 */
16
- $primary-text: rgba(0, 0, 0, 0.85);
17
- $disable-text: rgba(0, 0, 0, 0.25);
18
-
19
- /** 行高 */
20
- $line-height: 1.5715;
@@ -1,118 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import classNames from 'classnames';
4
- import { useThrottleFn } from '../util';
5
- import { Icon } from '../icon';
6
- import './style/button.scss';
7
-
8
- function insertSpace(child, needInserted) {
9
- const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
10
- const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
11
-
12
- if (child == null) return;
13
-
14
- if ((typeof child).toLocaleLowerCase() === 'string') {
15
- const space = needInserted ? ' ' : '';
16
- let newChild = child;
17
-
18
- if (isTwoCNChar(child)) newChild = child.split('').join(space);
19
-
20
- return <span>{newChild}</span>;
21
- }
22
-
23
- return child;
24
- }
25
-
26
- function Button(props) {
27
- const {
28
- children,
29
- htmlType,
30
- theme,
31
- autoInsertSpace,
32
- danger,
33
- disabled,
34
- loading,
35
- icon,
36
- block,
37
- text,
38
- onClick,
39
- ...rest
40
- } = props;
41
-
42
- let typeForIcon = '';
43
- let isLoading = false;
44
- if (loading) {
45
- typeForIcon = 'loading';
46
- isLoading = true;
47
- }
48
- if (loading === false && icon !== '') typeForIcon = icon;
49
-
50
- const classes = classNames('practical-button-reset', 'practical-button-default', {
51
- [`practical-button-${theme}`]: theme !== 'default',
52
- 'practical-button-danger': danger,
53
- 'practical-button-loading': isLoading,
54
- 'practical-button-block': block,
55
- 'practical-button-text': text
56
- });
57
-
58
- const handleClick = useThrottleFn((e) => {
59
- if (isLoading || disabled) {
60
- e.preventDefault();
61
- return;
62
- }
63
-
64
- let dataset = e.target.dataset;
65
- if (e.target.tagName.toLocaleLowerCase() !== 'button') dataset = e.target.parentNode.dataset;
66
- onClick && onClick(e, dataset);
67
- }, 500);
68
-
69
- return (
70
- // eslint-disable-next-line react/button-has-type
71
- <button className={classes} type={htmlType} disabled={disabled} {...rest} onClick={handleClick}>
72
- {typeForIcon && !text ? (
73
- <Icon style={{ marginRight: isLoading ? 0 : 4 }} type={typeForIcon} spin={isLoading} />
74
- ) : null}
75
- {!isLoading && React.Children.map(children, (child) => insertSpace(child, autoInsertSpace))}
76
- {isLoading &&
77
- text &&
78
- React.Children.map(children, (child) => insertSpace(child, autoInsertSpace))}
79
- </button>
80
- );
81
- }
82
-
83
- Button.displayName = 'PracticalUi.Button';
84
- Button.defaultProps = {
85
- htmlType: 'button',
86
- theme: 'default',
87
- autoInsertSpace: true,
88
- danger: false,
89
- disabled: false,
90
- loading: false,
91
- block: false,
92
- text: false,
93
- icon: ''
94
- };
95
- Button.propTypes = {
96
- /** 设置 button 原生的 type 值 */
97
- htmlType: PropTypes.oneOf(['button', 'submit', 'reset']),
98
- /** 设置按钮类型 */
99
- theme: PropTypes.oneOf(['default', 'primary', 'secondary', 'dashed']),
100
- /** 是否在按钮内(文本按钮除外)只有两个汉字时自动添加空格 */
101
- autoInsertSpace: PropTypes.bool,
102
- /** 设置危险按钮 */
103
- danger: PropTypes.bool,
104
- /** 按钮失效状态 */
105
- disabled: PropTypes.bool,
106
- /** 设置按钮载入状态 */
107
- loading: PropTypes.bool,
108
- /** 将按钮宽度调整为其父宽度的选项 */
109
- block: PropTypes.bool,
110
- /** 文本按钮 */
111
- text: PropTypes.bool,
112
- /** 和 <Icon /> 组件 type 参数一致 */
113
- icon: PropTypes.string,
114
- /** 点击按钮时的回调 | (event, dataset) => void | dataset 参数为 data-attributes 传递的参数 */
115
- onClick: PropTypes.func
116
- };
117
-
118
- export default Button;
@@ -1,119 +0,0 @@
1
- ---
2
- name: Button 按钮
3
- route: /button
4
- ---
5
-
6
- import { Playground, Props } from 'docz';
7
- import { Button } from '../index';
8
-
9
- # Button 按钮
10
-
11
- 默认使用 `throttle` 防止快速多次点击,触发事件。
12
-
13
- ## 按钮类型
14
-
15
- <Playground>
16
- <Button htmlType="submit">确认</Button>
17
- <Button style={{ marginLeft: 8 }} theme="primary">
18
- Primary Button
19
- </Button>
20
- <Button style={{ marginLeft: 8 }} theme="secondary">
21
- Secondary Button
22
- </Button>
23
- <Button style={{ marginLeft: 8 }} theme="dashed">
24
- Dashed Button
25
- </Button>
26
- <Button style={{ marginLeft: 8 }} text>
27
- Default Text Button
28
- </Button>
29
- <Button style={{ marginLeft: 8 }} theme="primary" text>
30
- Primary Text Button
31
- </Button>
32
- <Button style={{ marginLeft: 8 }} theme="secondary" text>
33
- Secondary Text Button
34
- </Button>
35
- </Playground>
36
-
37
- ## 危险按钮
38
-
39
- <Playground>
40
- <Button theme="secondary" danger>
41
- Danger Secondary Button
42
- </Button>
43
- <Button style={{ marginLeft: 8 }} danger>
44
- Danger Default Button
45
- </Button>
46
- <Button style={{ marginLeft: 8 }} theme="dashed" danger>
47
- Danger Dashed Button
48
- </Button>
49
- <Button style={{ marginLeft: 8 }} danger text>
50
- Danger Default Text Button
51
- </Button>
52
- </Playground>
53
-
54
- ## 图标按钮
55
-
56
- <Playground>
57
- <Button icon="search">提交</Button>
58
- <Button style={{ marginLeft: 8 }} theme="primary" icon="search">
59
- 确认
60
- </Button>
61
- <Button style={{ marginLeft: 8 }} theme="secondary" icon="search" danger>
62
- 取消
63
- </Button>
64
- <Button style={{ marginLeft: 8 }} theme="secondary" icon="search" disabled>
65
- 搜索
66
- </Button>
67
- <Button style={{ marginLeft: 8 }} theme="dashed" icon="search">
68
- 增加
69
- </Button>
70
- </Playground>
71
-
72
- ## Block 按钮
73
-
74
- `block` 属性将使按钮适合其父宽度。
75
-
76
- <Playground>
77
- <Button theme="dashed" block>
78
- Block Dashed Button
79
- </Button>
80
- <Button style={{ marginTop: 8 }} theme="primary" block>
81
- 确认
82
- </Button>
83
- </Playground>
84
-
85
- ## 不可用状态
86
-
87
- <Playground>
88
- <Button disabled>Disabled Default Button</Button>
89
- <Button style={{ marginLeft: 8 }} theme="secondary" danger disabled>
90
- Disabled Danger Secondary Button
91
- </Button>
92
- <Button style={{ marginLeft: 8 }} theme="dashed" disabled>
93
- Disabled Dashed Button
94
- </Button>
95
- <Button style={{ marginLeft: 8 }} theme="primary" danger disabled text>
96
- Disabled Danger Secondary Text Button
97
- </Button>
98
- </Playground>
99
-
100
- ## 加载中状态
101
-
102
- <Playground>
103
- <Button loading>提交</Button>
104
- <Button style={{ marginLeft: 8, width: 80 }} theme="primary" loading>
105
- 提交
106
- </Button>
107
- <Button style={{ marginLeft: 8, width: 120 }} danger loading>
108
- 提交
109
- </Button>
110
- <Button style={{ marginLeft: 20 }} theme="secondary" autoInsertSpace={false} text loading>
111
- 保存
112
- </Button>
113
- </Playground>
114
-
115
- ## API
116
-
117
- <Props of={Button} />
118
-
119
- 支持原生 button 的其他所有属性。
@@ -1 +0,0 @@
1
- export { default as Button } from './Button';