@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.
- package/dist/assets/LatoLatin-Regular.woff2 +0 -0
- package/dist/assets/LatoLatin-Semibold.woff2 +0 -0
- package/dist/index.js +8395 -0
- package/dist/style.css +1 -0
- package/index.js +13 -0
- package/package.json +31 -55
- package/.browserslistrc +0 -6
- package/.editorconfig +0 -15
- package/.eslintrc +0 -25
- package/.gitattributes +0 -4
- package/.husky/pre-commit +0 -4
- package/.stylelintrc.json +0 -14
- package/LICENSE +0 -21
- package/README.md +0 -3
- package/dist/Icon-shared.js +0 -33
- package/dist/button/index.js +0 -159
- package/dist/button/style/index.css +0 -1
- package/dist/checkbox/index.js +0 -61
- package/dist/checkbox/style/index.css +0 -1
- package/dist/icon/index.js +0 -4
- package/dist/icon/style/index.css +0 -1
- package/dist/index-shared.js +0 -146
- package/dist/style/fonts/icomoon-practical.eot +0 -0
- package/dist/style/fonts/icomoon-practical.svg +0 -12
- package/dist/style/fonts/icomoon-practical.ttf +0 -0
- package/dist/style/fonts/icomoon-practical.woff +0 -0
- package/dist/style/index.css +0 -1
- package/docz.config.js +0 -3
- package/gatsby-config.js +0 -3
- package/gulpfile.js +0 -48
- package/lib/_fonts/icomoon-practical-v1.0/Read Me.txt +0 -7
- package/lib/_fonts/icomoon-practical-v1.0/demo-files/demo.css +0 -152
- package/lib/_fonts/icomoon-practical-v1.0/demo-files/demo.js +0 -30
- package/lib/_fonts/icomoon-practical-v1.0/demo.html +0 -66
- package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.eot +0 -0
- package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.svg +0 -12
- package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.ttf +0 -0
- package/lib/_fonts/icomoon-practical-v1.0/fonts/icomoon-practical.woff +0 -0
- package/lib/_fonts/icomoon-practical-v1.0/selection.json +0 -1
- package/lib/_fonts/icomoon-practical-v1.0/style.css +0 -33
- package/lib/_variables.scss +0 -20
- package/lib/button/Button.js +0 -118
- package/lib/button/doc/button.mdx +0 -119
- package/lib/button/index.js +0 -1
- package/lib/button/style/button.scss +0 -195
- package/lib/checkbox/Checkbox.js +0 -46
- package/lib/checkbox/doc/checkbox.mdx +0 -82
- package/lib/checkbox/index.js +0 -1
- package/lib/checkbox/style/checkbox.scss +0 -127
- package/lib/icon/Icon.js +0 -30
- package/lib/icon/doc/icon.mdx +0 -45
- package/lib/icon/index.js +0 -1
- package/lib/icon/style/icon.scss +0 -20
- package/lib/input/Input.js +0 -3
- package/lib/input/index.js +0 -1
- package/lib/util/index.js +0 -1
- package/lib/util/useThrottleFn.js +0 -31
- package/prettier.config.js +0 -20
- package/rollup.config.js +0 -30
- package/src/gatsby-theme-docz/wrapper.js +0 -9
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@font-face{font-family:v-sans;font-weight:400;src:url(./assets/LatoLatin-Regular.woff2)}@font-face{font-family:v-sans;font-weight:600;src:url(./assets/LatoLatin-Semibold.woff2)}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{text-size-adjust:100%;-webkit-tap-highlight-color:transparent;background-color:#fff;color:#333639;font-size:14px;font-family:v-sans,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;line-height:1.6;transition:color .3s cubic-bezier(.4,0,.2,1),background-color .3s cubic-bezier(.4,0,.2,1)}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}
|
package/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PConfigProvider } from './config-provider/index.js'
|
|
2
|
+
import { PButton } from './button/index.js'
|
|
3
|
+
import { PInput } from './input/index.js'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
install: (app, options = {}) => {
|
|
7
|
+
const { prefix = 'p' } = options
|
|
8
|
+
|
|
9
|
+
app.component(`${prefix}-config-provider`, PConfigProvider)
|
|
10
|
+
app.component(`${prefix}-button`, PButton)
|
|
11
|
+
app.component(`${prefix}-input`, PInput)
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,67 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avilang/practical-ui",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.1
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.2.1",
|
|
5
|
+
"description": "Practical UI components created based on vue3",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
5
10
|
"scripts": {
|
|
6
|
-
"build
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"docz:dev": "rimraf .docz && docz dev",
|
|
11
|
-
"docz:build": "docz build",
|
|
12
|
-
"docz:serve": "docz build && docz serve",
|
|
13
|
-
"prepare": "husky install"
|
|
11
|
+
"build": "vite build",
|
|
12
|
+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix",
|
|
13
|
+
"format": "prettier . --write",
|
|
14
|
+
"prepare": "cd ../.. && husky packages/components/.husky"
|
|
14
15
|
},
|
|
15
16
|
"lint-staged": {
|
|
16
|
-
"*.js":
|
|
17
|
-
|
|
17
|
+
"*.{js,jsx,vue}": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"prettier --check"
|
|
20
|
+
],
|
|
21
|
+
"*.{css,less}": "prettier --check"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"naive-ui",
|
|
25
|
+
"vue3",
|
|
26
|
+
"practical ui"
|
|
27
|
+
],
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"vue": "^3.5.10"
|
|
18
30
|
},
|
|
19
31
|
"dependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
32
|
+
"grapheme-splitter": "1.0.4",
|
|
33
|
+
"naive-ui": "2.40.1",
|
|
34
|
+
"vfonts": "0.0.3"
|
|
22
35
|
},
|
|
23
36
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^4.0.0",
|
|
28
|
-
"@typescript-eslint/parser": "^4.0.0",
|
|
29
|
-
"babel-eslint": "^10.0.0",
|
|
30
|
-
"docz": "^2.3.1",
|
|
31
|
-
"eslint": "^7.25.0",
|
|
32
|
-
"eslint-config-airbnb": "^18.2.1",
|
|
33
|
-
"eslint-config-prettier": "^8.3.0",
|
|
34
|
-
"eslint-config-react-app": "^6.0.0",
|
|
35
|
-
"eslint-plugin-flowtype": "^5.2.0",
|
|
36
|
-
"eslint-plugin-import": "^2.22.0",
|
|
37
|
-
"eslint-plugin-jsx-a11y": "^6.3.1",
|
|
38
|
-
"eslint-plugin-prettier": "^3.4.0",
|
|
39
|
-
"eslint-plugin-react": "^7.20.3",
|
|
40
|
-
"eslint-plugin-react-hooks": "^4.0.8",
|
|
41
|
-
"gatsby-plugin-sass": "^4.4.0",
|
|
42
|
-
"gulp": "^4.0.2",
|
|
43
|
-
"gulp-autoprefixer": "^7.0.1",
|
|
44
|
-
"gulp-clean-css": "^4.3.0",
|
|
45
|
-
"gulp-cli": "^2.3.0",
|
|
46
|
-
"gulp-rename": "^2.0.0",
|
|
47
|
-
"gulp-sass": "^4.1.0",
|
|
48
|
-
"husky": "^6.0.0",
|
|
49
|
-
"lint-staged": "^10.5.4",
|
|
50
|
-
"node-sass": "^5.0.0",
|
|
51
|
-
"postcss": "^8.2.15",
|
|
52
|
-
"prettier": "^2.2.1",
|
|
53
|
-
"react": "^17.0.2",
|
|
54
|
-
"react-dom": "^17.0.2",
|
|
55
|
-
"rimraf": "^3.0.2",
|
|
56
|
-
"rollup": "^2.48.0",
|
|
57
|
-
"rollup-plugin-postcss": "^4.0.0",
|
|
58
|
-
"stylelint": "^13.13.1",
|
|
59
|
-
"stylelint-config-recess-order": "^2.4.0",
|
|
60
|
-
"stylelint-config-sass-guidelines": "^8.0.0",
|
|
61
|
-
"stylelint-config-standard": "^22.0.0"
|
|
62
|
-
},
|
|
63
|
-
"engines": {
|
|
64
|
-
"node": ">=14.16.1 <15"
|
|
37
|
+
"@laynezh/vite-plugin-lib-assets": "^0.5.24",
|
|
38
|
+
"@vitejs/plugin-vue": "^5.1.4",
|
|
39
|
+
"vite": "^5.4.8"
|
|
65
40
|
},
|
|
41
|
+
"author": "avilang <1985945885@qq.com> (https://github.com/avilang)",
|
|
66
42
|
"license": "MIT"
|
|
67
43
|
}
|
package/.browserslistrc
DELETED
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
indent_style = space
|
|
6
|
-
indent_size = 2
|
|
7
|
-
end_of_line = lf
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.md]
|
|
12
|
-
trim_trailing_whitespace = false
|
|
13
|
-
|
|
14
|
-
[*.html]
|
|
15
|
-
insert_final_newline = false
|
package/.eslintrc
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"react-app",
|
|
4
|
-
"airbnb",
|
|
5
|
-
"airbnb/hooks",
|
|
6
|
-
"plugin:jsx-a11y/recommended",
|
|
7
|
-
"plugin:prettier/recommended"
|
|
8
|
-
],
|
|
9
|
-
"plugins": ["jsx-a11y"],
|
|
10
|
-
"rules": {
|
|
11
|
-
"func-names": ["error", "never"],
|
|
12
|
-
"prefer-destructuring": "off",
|
|
13
|
-
"no-unused-expressions": "off",
|
|
14
|
-
"no-useless-return": "off",
|
|
15
|
-
"consistent-return": "off",
|
|
16
|
-
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
|
|
17
|
-
"import/prefer-default-export": "off",
|
|
18
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
19
|
-
"react/jsx-props-no-spreading": "off",
|
|
20
|
-
"react/forbid-prop-types": "off",
|
|
21
|
-
"react/prop-types": ["error", { "ignore": ["children"] }],
|
|
22
|
-
"react/require-default-props": "off",
|
|
23
|
-
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }]
|
|
24
|
-
}
|
|
25
|
-
}
|
package/.gitattributes
DELETED
package/.husky/pre-commit
DELETED
package/.stylelintrc.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"stylelint-config-standard",
|
|
4
|
-
"stylelint-config-sass-guidelines",
|
|
5
|
-
"stylelint-config-recess-order"
|
|
6
|
-
],
|
|
7
|
-
"ignoreFiles": ["**/*.js", "lib/_fonts/**/*.css"],
|
|
8
|
-
"rules": {
|
|
9
|
-
"max-nesting-depth": 3,
|
|
10
|
-
"property-no-unknown": null,
|
|
11
|
-
"order/properties-alphabetical-order": null,
|
|
12
|
-
"scss/selector-no-redundant-nesting-selector": null
|
|
13
|
-
}
|
|
14
|
-
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 avilang
|
|
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.
|
package/README.md
DELETED
package/dist/Icon-shared.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { c as classNames, a as _defineProperty } from './index-shared.js';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
function Icon(props) {
|
|
6
|
-
var _classNames;
|
|
7
|
-
|
|
8
|
-
var type = props.type,
|
|
9
|
-
style = props.style,
|
|
10
|
-
spin = props.spin;
|
|
11
|
-
var classes = classNames('practical-sign', (_classNames = {}, _defineProperty(_classNames, "practical-icon-".concat(type), true), _defineProperty(_classNames, 'practical-sign-spin', spin), _classNames));
|
|
12
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
13
|
-
className: classes,
|
|
14
|
-
style: style
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Icon.displayName = 'PracticalUi.Icon';
|
|
19
|
-
Icon.defaultProps = {
|
|
20
|
-
style: {},
|
|
21
|
-
spin: false
|
|
22
|
-
};
|
|
23
|
-
Icon.propTypes = {
|
|
24
|
-
type: PropTypes.string.isRequired,
|
|
25
|
-
|
|
26
|
-
/** 设置图标的样式,例如 fontSize 和 color */
|
|
27
|
-
style: PropTypes.object,
|
|
28
|
-
|
|
29
|
-
/** 是否有旋转动画 */
|
|
30
|
-
spin: PropTypes.bool
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { Icon as I };
|
package/dist/button/index.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, c as classNames, a as _defineProperty, b as _extends, d as _typeof } from '../index-shared.js';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, { useCallback, useRef, useEffect } from 'react';
|
|
4
|
-
import { I as Icon } from '../Icon-shared.js';
|
|
5
|
-
|
|
6
|
-
function useThrottleFn(fn, delay) {
|
|
7
|
-
var _useRef = useRef({
|
|
8
|
-
fn: fn,
|
|
9
|
-
timer: null
|
|
10
|
-
}),
|
|
11
|
-
current = _useRef.current;
|
|
12
|
-
|
|
13
|
-
useEffect(function () {
|
|
14
|
-
current.fn = fn;
|
|
15
|
-
}, [fn]);
|
|
16
|
-
useEffect(function () {
|
|
17
|
-
return function () {
|
|
18
|
-
if (current.timer) {
|
|
19
|
-
clearTimeout(current.timer);
|
|
20
|
-
current.timer = null;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}, []);
|
|
24
|
-
return useCallback(function () {
|
|
25
|
-
if (!current.timer) {
|
|
26
|
-
var _current$fn;
|
|
27
|
-
|
|
28
|
-
current.timer = setTimeout(function () {
|
|
29
|
-
current.timer = null;
|
|
30
|
-
}, delay);
|
|
31
|
-
|
|
32
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
|
-
args[_key] = arguments[_key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
(_current$fn = current.fn).call.apply(_current$fn, [this].concat(args));
|
|
37
|
-
}
|
|
38
|
-
}, []);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function insertSpace(child, needInserted) {
|
|
42
|
-
var rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
|
|
43
|
-
var isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
|
|
44
|
-
if (child == null) return;
|
|
45
|
-
|
|
46
|
-
if (_typeof(child).toLocaleLowerCase() === 'string') {
|
|
47
|
-
var space = needInserted ? ' ' : '';
|
|
48
|
-
var newChild = child;
|
|
49
|
-
if (isTwoCNChar(child)) newChild = child.split('').join(space);
|
|
50
|
-
return /*#__PURE__*/React.createElement("span", null, newChild);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return child;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function Button(props) {
|
|
57
|
-
var _classNames;
|
|
58
|
-
|
|
59
|
-
var children = props.children,
|
|
60
|
-
htmlType = props.htmlType,
|
|
61
|
-
theme = props.theme,
|
|
62
|
-
autoInsertSpace = props.autoInsertSpace,
|
|
63
|
-
danger = props.danger,
|
|
64
|
-
disabled = props.disabled,
|
|
65
|
-
loading = props.loading,
|
|
66
|
-
icon = props.icon,
|
|
67
|
-
block = props.block,
|
|
68
|
-
text = props.text,
|
|
69
|
-
onClick = props.onClick,
|
|
70
|
-
rest = _objectWithoutProperties(props, ["children", "htmlType", "theme", "autoInsertSpace", "danger", "disabled", "loading", "icon", "block", "text", "onClick"]);
|
|
71
|
-
|
|
72
|
-
var typeForIcon = '';
|
|
73
|
-
var isLoading = false;
|
|
74
|
-
|
|
75
|
-
if (loading) {
|
|
76
|
-
typeForIcon = 'loading';
|
|
77
|
-
isLoading = true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (loading === false && icon !== '') typeForIcon = icon;
|
|
81
|
-
var classes = classNames('practical-button-reset', 'practical-button-default', (_classNames = {}, _defineProperty(_classNames, "practical-button-".concat(theme), theme !== 'default'), _defineProperty(_classNames, 'practical-button-danger', danger), _defineProperty(_classNames, 'practical-button-loading', isLoading), _defineProperty(_classNames, 'practical-button-block', block), _defineProperty(_classNames, 'practical-button-text', text), _classNames));
|
|
82
|
-
var handleClick = useThrottleFn(function (e) {
|
|
83
|
-
if (isLoading || disabled) {
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
var dataset = e.target.dataset;
|
|
89
|
-
if (e.target.tagName.toLocaleLowerCase() !== 'button') dataset = e.target.parentNode.dataset;
|
|
90
|
-
onClick && onClick(e, dataset);
|
|
91
|
-
}, 500);
|
|
92
|
-
return (
|
|
93
|
-
/*#__PURE__*/
|
|
94
|
-
// eslint-disable-next-line react/button-has-type
|
|
95
|
-
React.createElement("button", _extends({
|
|
96
|
-
className: classes,
|
|
97
|
-
type: htmlType,
|
|
98
|
-
disabled: disabled
|
|
99
|
-
}, rest, {
|
|
100
|
-
onClick: handleClick
|
|
101
|
-
}), typeForIcon && !text ? /*#__PURE__*/React.createElement(Icon, {
|
|
102
|
-
style: {
|
|
103
|
-
marginRight: isLoading ? 0 : 4
|
|
104
|
-
},
|
|
105
|
-
type: typeForIcon,
|
|
106
|
-
spin: isLoading
|
|
107
|
-
}) : null, !isLoading && React.Children.map(children, function (child) {
|
|
108
|
-
return insertSpace(child, autoInsertSpace);
|
|
109
|
-
}), isLoading && text && React.Children.map(children, function (child) {
|
|
110
|
-
return insertSpace(child, autoInsertSpace);
|
|
111
|
-
}))
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
Button.displayName = 'PracticalUi.Button';
|
|
116
|
-
Button.defaultProps = {
|
|
117
|
-
htmlType: 'button',
|
|
118
|
-
theme: 'default',
|
|
119
|
-
autoInsertSpace: true,
|
|
120
|
-
danger: false,
|
|
121
|
-
disabled: false,
|
|
122
|
-
loading: false,
|
|
123
|
-
block: false,
|
|
124
|
-
text: false,
|
|
125
|
-
icon: ''
|
|
126
|
-
};
|
|
127
|
-
Button.propTypes = {
|
|
128
|
-
/** 设置 button 原生的 type 值 */
|
|
129
|
-
htmlType: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
130
|
-
|
|
131
|
-
/** 设置按钮类型 */
|
|
132
|
-
theme: PropTypes.oneOf(['default', 'primary', 'secondary', 'dashed']),
|
|
133
|
-
|
|
134
|
-
/** 是否在按钮内(文本按钮除外)只有两个汉字时自动添加空格 */
|
|
135
|
-
autoInsertSpace: PropTypes.bool,
|
|
136
|
-
|
|
137
|
-
/** 设置危险按钮 */
|
|
138
|
-
danger: PropTypes.bool,
|
|
139
|
-
|
|
140
|
-
/** 按钮失效状态 */
|
|
141
|
-
disabled: PropTypes.bool,
|
|
142
|
-
|
|
143
|
-
/** 设置按钮载入状态 */
|
|
144
|
-
loading: PropTypes.bool,
|
|
145
|
-
|
|
146
|
-
/** 将按钮宽度调整为其父宽度的选项 */
|
|
147
|
-
block: PropTypes.bool,
|
|
148
|
-
|
|
149
|
-
/** 文本按钮 */
|
|
150
|
-
text: PropTypes.bool,
|
|
151
|
-
|
|
152
|
-
/** 和 <Icon /> 组件 type 参数一致 */
|
|
153
|
-
icon: PropTypes.string,
|
|
154
|
-
|
|
155
|
-
/** 点击按钮时的回调 | (event, dataset) => void | dataset 参数为 data-attributes 传递的参数 */
|
|
156
|
-
onClick: PropTypes.func
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export { Button };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.practical-button-reset{margin:0;overflow:visible;text-transform:none;-webkit-appearance:button;-moz-appearance:button;appearance:button}.practical-button-reset::-moz-focus-inner{padding:0;border-style:none}.practical-button-reset:-moz-focusring{outline:1px dotted ButtonText}.practical-button-default{box-sizing:border-box;display:inline-block;height:34px;padding:5px 12px;font-family:inherit;font-size:14px;font-weight:400;line-height:1.5715;color:rgba(0,0,0,0.85);text-align:center;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff;border-color:#d9d9d9;border-style:solid;border-width:1px;border-radius:2px;outline:none;transition:all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)}.practical-button-default,.practical-button-default:active,.practical-button-default:focus{outline:0}.practical-button-default:hover{color:#1890ff;border-color:#1890ff}.practical-button-default>span{display:inline-block;margin-top:1px}.practical-button-default.practical-button-block{width:100%}.practical-button-default.practical-button-primary{color:#fff;background-color:#1890ff;border-color:#1890ff}.practical-button-default.practical-button-primary:hover{background-color:#40a9ff;border-color:#40a9ff}.practical-button-default.practical-button-secondary{color:#fff;background-color:#52c41a;border-color:#52c41a}.practical-button-default.practical-button-secondary:hover{background-color:#73d13d;border-color:#73d13d}.practical-button-default.practical-button-dashed{border-style:dashed}.practical-button-default.practical-button-danger{color:#f5222d;border-color:#f5222d}.practical-button-default.practical-button-danger:hover{opacity:0.7}.practical-button-default.practical-button-primary.practical-button-danger,.practical-button-default.practical-button-secondary.practical-button-danger{color:#fff;background-color:#f5222d;border-color:#f5222d}.practical-button-default.practical-button-text{height:auto;padding:0;background-color:transparent;border-color:transparent;border-width:0}.practical-button-default.practical-button-text>span{margin-top:0}.practical-button-default.practical-button-text:hover{color:rgba(0,0,0,0.85);background-color:transparent;border-color:transparent;opacity:1}.practical-button-default.practical-button-text:hover>span{text-decoration:underline}.practical-button-default.practical-button-text.practical-button-primary{color:#1890ff}.practical-button-default.practical-button-text.practical-button-secondary{color:#52c41a}.practical-button-default.practical-button-text.practical-button-danger{color:#f5222d}.practical-button-default.practical-button-text.practical-button-primary.practical-button-danger,.practical-button-default.practical-button-text.practical-button-secondary.practical-button-danger{color:#f5222d;background-color:transparent;border-color:transparent}.practical-button-default[disabled],.practical-button-default[disabled]:hover,.practical-button-default[disabled]:focus,.practical-button-default[disabled]:active,.practical-button-default[disabled].practical-button-danger{color:rgba(0,0,0,0.25);cursor:not-allowed;background-color:#f5f5f5;border-color:#d9d9d9}.practical-button-default[disabled]:hover,.practical-button-default[disabled]:hover:hover,.practical-button-default[disabled]:focus:hover,.practical-button-default[disabled]:active:hover,.practical-button-default[disabled].practical-button-danger:hover{opacity:1}.practical-button-default[disabled].practical-button-text,.practical-button-default[disabled].practical-button-danger.practical-button-text{color:rgba(0,0,0,0.25);cursor:not-allowed;background-color:transparent;border-color:transparent}.practical-button-default[disabled].practical-button-text:hover{opacity:1}.practical-button-default[disabled].practical-button-text:hover>span{text-decoration:none}.practical-button-default.practical-button-loading{position:relative;pointer-events:none}.practical-button-default.practical-button-loading::before{position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;z-index:1;pointer-events:none;content:'';background:#fff;border-radius:inherit;opacity:0.35;transition:opacity 0.2s}
|
package/dist/checkbox/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, c as classNames, b as _extends } from '../index-shared.js';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
function Checkbox(props) {
|
|
6
|
-
var children = props.children,
|
|
7
|
-
checked = props.checked,
|
|
8
|
-
indeterminate = props.indeterminate,
|
|
9
|
-
disabled = props.disabled,
|
|
10
|
-
onChange = props.onChange,
|
|
11
|
-
rest = _objectWithoutProperties(props, ["children", "checked", "indeterminate", "disabled", "onChange"]);
|
|
12
|
-
|
|
13
|
-
var classes = classNames('practical-checkbox', {
|
|
14
|
-
'practical-checkbox-checked': checked,
|
|
15
|
-
'practical-checkbox-disabled': disabled,
|
|
16
|
-
'practical-checkbox-indeterminate': checked === false && indeterminate
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
var handleChange = function handleChange(e) {
|
|
20
|
-
if (disabled) return;
|
|
21
|
-
onChange && onChange(e, e.target.checked);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
/*#__PURE__*/
|
|
26
|
-
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
27
|
-
React.createElement("label", _extends({
|
|
28
|
-
className: classes
|
|
29
|
-
}, rest), /*#__PURE__*/React.createElement("span", {
|
|
30
|
-
className: "practical-checkbox-sign"
|
|
31
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
32
|
-
type: "checkbox",
|
|
33
|
-
checked: checked,
|
|
34
|
-
onChange: handleChange
|
|
35
|
-
})), children && /*#__PURE__*/React.createElement("span", {
|
|
36
|
-
className: "practical-checkbox-text"
|
|
37
|
-
}, children))
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Checkbox.displayName = 'PracticalUi.Checkbox';
|
|
42
|
-
Checkbox.defaultProps = {
|
|
43
|
-
checked: false,
|
|
44
|
-
disabled: false,
|
|
45
|
-
indeterminate: false
|
|
46
|
-
};
|
|
47
|
-
Checkbox.propTypes = {
|
|
48
|
-
/** 指定当前是否选中 */
|
|
49
|
-
checked: PropTypes.bool,
|
|
50
|
-
|
|
51
|
-
/** 失效状态 */
|
|
52
|
-
disabled: PropTypes.bool,
|
|
53
|
-
|
|
54
|
-
/** 设置 indeterminate 状态,只负责样式控制 */
|
|
55
|
-
indeterminate: PropTypes.bool,
|
|
56
|
-
|
|
57
|
-
/** 变化时回调函数 | (event, checked) => void | checked 参数为 checkbox 的 checked 状态值 */
|
|
58
|
-
onChange: PropTypes.func
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { Checkbox };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.practical-checkbox{box-sizing:border-box;display:inline-block;padding:0;margin:0;font-size:14px;line-height:1.5715;color:rgba(0,0,0,0.85);list-style:none;touch-action:manipulation;cursor:pointer}.practical-checkbox>span{vertical-align:middle}.practical-checkbox:hover .practical-checkbox-sign{border-color:#1890ff}.practical-checkbox-checked .practical-checkbox-sign{background-color:#1890ff;border-color:#1890ff}.practical-checkbox-checked .practical-checkbox-sign::after{position:absolute;top:50%;left:22%;box-sizing:border-box;display:table;width:5.71428571px;height:9.14285714px;content:' ';border:2px solid #fff;border-top:0;border-left:0;opacity:1;transition:all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;transform:rotate(45deg) scale(1) translate(-50%, -50%)}.practical-checkbox-indeterminate .practical-checkbox-sign::after{position:absolute;top:50%;left:50%;box-sizing:border-box;display:table;width:8px;height:8px;content:' ';background-color:#1890ff;border:0;border-radius:2px;opacity:1;transition:all 0.1s cubic-bezier(0.71, -0.46, 0.88, 0.6),opacity 0.1s;transform:translate(-50%, -50%) scale(1)}.practical-checkbox-disabled{color:rgba(0,0,0,0.25);cursor:not-allowed}.practical-checkbox-disabled .practical-checkbox-sign{background-color:#f5f5f5;border-color:#d9d9d9}.practical-checkbox-disabled .practical-checkbox-sign::after{border-color:rgba(0,0,0,0.25)}.practical-checkbox-disabled:hover .practical-checkbox-sign{border-color:#d9d9d9}.practical-checkbox-disabled.practical-checkbox-indeterminate .practical-checkbox-sign::after{background-color:rgba(0,0,0,0.25)}.practical-checkbox-sign{position:relative;top:-1px;box-sizing:border-box;display:inline-block;width:16px;height:16px;overflow:hidden;background-color:#fff;border:1px solid #d9d9d9;border-radius:2px;transition:all 0.3s}.practical-checkbox-sign>input{position:absolute;top:0;left:-18px;padding:0;margin:0;overflow:visible;outline:none;opacity:0;-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.practical-checkbox-text{padding-left:4px}
|
package/dist/icon/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@-webkit-keyframes iconLoadingCircle{to{transform:rotate(1turn)}}@keyframes iconLoadingCircle{to{transform:rotate(1turn)}}.practical-sign{display:inline-block;font-style:normal;-webkit-font-smoothing:antialiased;line-height:0;text-transform:none;text-rendering:optimizeLegibility}.practical-sign-spin{-webkit-animation:iconLoadingCircle 1s linear infinite;animation:iconLoadingCircle 1s linear infinite}
|
package/dist/index-shared.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) {
|
|
2
|
-
"@babel/helpers - typeof";
|
|
3
|
-
|
|
4
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
5
|
-
_typeof = function (obj) {
|
|
6
|
-
return typeof obj;
|
|
7
|
-
};
|
|
8
|
-
} else {
|
|
9
|
-
_typeof = function (obj) {
|
|
10
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return _typeof(obj);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function _defineProperty(obj, key, value) {
|
|
18
|
-
if (key in obj) {
|
|
19
|
-
Object.defineProperty(obj, key, {
|
|
20
|
-
value: value,
|
|
21
|
-
enumerable: true,
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true
|
|
24
|
-
});
|
|
25
|
-
} else {
|
|
26
|
-
obj[key] = value;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _extends() {
|
|
33
|
-
_extends = Object.assign || function (target) {
|
|
34
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
35
|
-
var source = arguments[i];
|
|
36
|
-
|
|
37
|
-
for (var key in source) {
|
|
38
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
39
|
-
target[key] = source[key];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return target;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return _extends.apply(this, arguments);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
51
|
-
if (source == null) return {};
|
|
52
|
-
var target = {};
|
|
53
|
-
var sourceKeys = Object.keys(source);
|
|
54
|
-
var key, i;
|
|
55
|
-
|
|
56
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
57
|
-
key = sourceKeys[i];
|
|
58
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
59
|
-
target[key] = source[key];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return target;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function _objectWithoutProperties(source, excluded) {
|
|
66
|
-
if (source == null) return {};
|
|
67
|
-
|
|
68
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
69
|
-
|
|
70
|
-
var key, i;
|
|
71
|
-
|
|
72
|
-
if (Object.getOwnPropertySymbols) {
|
|
73
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
74
|
-
|
|
75
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
76
|
-
key = sourceSymbolKeys[i];
|
|
77
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
78
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
79
|
-
target[key] = source[key];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return target;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
var classnames = {exports: {}};
|
|
87
|
-
|
|
88
|
-
/*!
|
|
89
|
-
Copyright (c) 2018 Jed Watson.
|
|
90
|
-
Licensed under the MIT License (MIT), see
|
|
91
|
-
http://jedwatson.github.io/classnames
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
(function (module) {
|
|
95
|
-
/* global define */
|
|
96
|
-
|
|
97
|
-
(function () {
|
|
98
|
-
|
|
99
|
-
var hasOwn = {}.hasOwnProperty;
|
|
100
|
-
|
|
101
|
-
function classNames() {
|
|
102
|
-
var classes = [];
|
|
103
|
-
|
|
104
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
105
|
-
var arg = arguments[i];
|
|
106
|
-
if (!arg) continue;
|
|
107
|
-
|
|
108
|
-
var argType = typeof arg;
|
|
109
|
-
|
|
110
|
-
if (argType === 'string' || argType === 'number') {
|
|
111
|
-
classes.push(arg);
|
|
112
|
-
} else if (Array.isArray(arg)) {
|
|
113
|
-
if (arg.length) {
|
|
114
|
-
var inner = classNames.apply(null, arg);
|
|
115
|
-
if (inner) {
|
|
116
|
-
classes.push(inner);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
} else if (argType === 'object') {
|
|
120
|
-
if (arg.toString === Object.prototype.toString) {
|
|
121
|
-
for (var key in arg) {
|
|
122
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
123
|
-
classes.push(key);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
} else {
|
|
127
|
-
classes.push(arg.toString());
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return classes.join(' ');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (module.exports) {
|
|
136
|
-
classNames.default = classNames;
|
|
137
|
-
module.exports = classNames;
|
|
138
|
-
} else {
|
|
139
|
-
window.classNames = classNames;
|
|
140
|
-
}
|
|
141
|
-
}());
|
|
142
|
-
}(classnames));
|
|
143
|
-
|
|
144
|
-
var classNames = classnames.exports;
|
|
145
|
-
|
|
146
|
-
export { _objectWithoutProperties as _, _defineProperty as a, _extends as b, classNames as c, _typeof as d };
|
|
Binary file
|
|
@@ -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=" " horiz-adv-x="512" d="" />
|
|
10
|
-
<glyph unicode="" 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="" 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>
|
|
Binary file
|