@yup/taro-ui 0.0.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/LICENSE +21 -0
- package/README.md +3 -0
- package/es/_virtual/_commonjsHelpers.js +3 -0
- package/es/_virtual/_rollupPluginBabelHelpers.js +120 -0
- package/es/_virtual/index.js +1 -0
- package/es/_virtual/jsx-runtime.js +1 -0
- package/es/_virtual/react-jsx-runtime.development.js +1 -0
- package/es/_virtual/react-jsx-runtime.production.min.js +1 -0
- package/es/components/button/index.d.ts +19 -0
- package/es/components/button/index.js +35 -0
- package/es/components/button/style/button.css +3 -0
- package/es/components/button/style/button.less +3 -0
- package/es/components/button/style/css.js +1 -0
- package/es/components/button/style/index.css +67 -0
- package/es/components/button/style/index.d.ts +1 -0
- package/es/components/button/style/index.js +1 -0
- package/es/components/button/style/index.less +81 -0
- package/es/components/checkbox/checkbox-group.d.ts +10 -0
- package/es/components/checkbox/checkbox-group.js +12 -0
- package/es/components/checkbox/index.d.ts +13 -0
- package/es/components/checkbox/index.js +23 -0
- package/es/components/checkbox/style/css.js +1 -0
- package/es/components/checkbox/style/index.css +45 -0
- package/es/components/checkbox/style/index.d.ts +1 -0
- package/es/components/checkbox/style/index.js +1 -0
- package/es/components/checkbox/style/index.less +59 -0
- package/es/components/form/form-item.d.ts +10 -0
- package/es/components/form/form-item.js +14 -0
- package/es/components/form/index.d.ts +15 -0
- package/es/components/form/index.js +18 -0
- package/es/components/form/style/css.js +1 -0
- package/es/components/form/style/index.css +33 -0
- package/es/components/form/style/index.d.ts +1 -0
- package/es/components/form/style/index.js +1 -0
- package/es/components/form/style/index.less +51 -0
- package/es/components/input/index.d.ts +22 -0
- package/es/components/input/index.js +57 -0
- package/es/components/input/style/css.js +1 -0
- package/es/components/input/style/index.css +30 -0
- package/es/components/input/style/index.d.ts +1 -0
- package/es/components/input/style/index.js +1 -0
- package/es/components/input/style/index.less +36 -0
- package/es/components/radio/index.d.ts +13 -0
- package/es/components/radio/index.js +18 -0
- package/es/components/radio/radio-group.d.ts +10 -0
- package/es/components/radio/radio-group.js +16 -0
- package/es/components/radio/style/css.js +2 -0
- package/es/components/radio/style/group.css +12 -0
- package/es/components/radio/style/group.less +12 -0
- package/es/components/radio/style/index.d.ts +2 -0
- package/es/components/radio/style/index.js +2 -0
- package/es/components/radio/style/radio.css +28 -0
- package/es/components/radio/style/radio.less +32 -0
- package/es/components/toast/index.d.ts +2 -0
- package/es/components/toast/index.js +1 -0
- package/es/components/toast/style/css.js +1 -0
- package/es/components/toast/style/index.css +22 -0
- package/es/components/toast/style/index.d.ts +1 -0
- package/es/components/toast/style/index.js +1 -0
- package/es/components/toast/style/index.less +23 -0
- package/es/components/toast/toast.d.ts +18 -0
- package/es/components/toast/toast.js +89 -0
- package/es/components/toast/withToast.d.ts +2 -0
- package/es/components/toast/withToast.js +9 -0
- package/es/global/global.less +1 -0
- package/es/global/index.d.ts +1 -0
- package/es/global/theme-default.less +37 -0
- package/es/global.css +20 -0
- package/es/index.d.ts +7 -0
- package/es/index.js +2 -0
- package/es/node_modules/classnames/index.js +56 -0
- package/es/node_modules/react/cjs/react-jsx-runtime.development.js +1137 -0
- package/es/node_modules/react/cjs/react-jsx-runtime.production.min.js +48 -0
- package/es/node_modules/react/jsx-runtime.js +6 -0
- package/es/utils/debounce.d.ts +1 -0
- package/es/utils/is.d.ts +7 -0
- package/es/utils/is.js +9 -0
- package/es/utils/react.d.ts +2 -0
- package/es/utils/throttle.d.ts +4 -0
- package/es/utils/tool.d.ts +4 -0
- package/package.json +127 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--form-item-label-width: 60px;
|
|
3
|
+
}
|
|
4
|
+
.ypmini-form.ypmini-form-vertical .ypmini-form-item .yp-form-item-label {
|
|
5
|
+
margin-bottom: 12px;
|
|
6
|
+
padding-top: 16px;
|
|
7
|
+
}
|
|
8
|
+
.ypmini-form.ypmini-form-vertical .ypmini-form-item:not(:first-child) {
|
|
9
|
+
margin-top: 16px;
|
|
10
|
+
}
|
|
11
|
+
.ypmini-form.ypmini-form-horizontal .ypmini-form-item {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
.ypmini-form.ypmini-form-horizontal .ypmini-form-item .yp-form-item-label {
|
|
16
|
+
width: var(--form-item-label-width);
|
|
17
|
+
text-align: left;
|
|
18
|
+
}
|
|
19
|
+
.ypmini-form.ypmini-form-horizontal .ypmini-form-item .yp-form-item-children {
|
|
20
|
+
flex: 1;
|
|
21
|
+
}
|
|
22
|
+
.ypmini-form.ypmini-form-horizontal .ypmini-form-item:not(:first-child) {
|
|
23
|
+
margin-top: 16px;
|
|
24
|
+
}
|
|
25
|
+
.ypmini-form-item-required .yp-form-item-label::before {
|
|
26
|
+
content: '*';
|
|
27
|
+
color: red;
|
|
28
|
+
}
|
|
29
|
+
.ypmini-form-item .yp-form-item-label {
|
|
30
|
+
color: #000000d9;
|
|
31
|
+
font-weight: bold;
|
|
32
|
+
font-size: 19px;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--form-item-label-width: 60px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ypmini-form {
|
|
6
|
+
&.ypmini-form-vertical {
|
|
7
|
+
.ypmini-form-item {
|
|
8
|
+
.yp-form-item-label {
|
|
9
|
+
margin-bottom: 12px;
|
|
10
|
+
padding-top: 16px;
|
|
11
|
+
}
|
|
12
|
+
&:not(:first-child) {
|
|
13
|
+
margin-top: 16px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
&.ypmini-form-horizontal {
|
|
18
|
+
.ypmini-form-item {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
.yp-form-item-label {
|
|
22
|
+
width: var(--form-item-label-width);
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
25
|
+
.yp-form-item-children {
|
|
26
|
+
flex: 1;
|
|
27
|
+
}
|
|
28
|
+
&:not(:first-child) {
|
|
29
|
+
margin-top: 16px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ypmini-form-item-required {
|
|
36
|
+
.yp-form-item-label {
|
|
37
|
+
&::before {
|
|
38
|
+
content: '*';
|
|
39
|
+
color: red;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ypmini-form-item {
|
|
45
|
+
.yp-form-item-label {
|
|
46
|
+
color: #000000d9;
|
|
47
|
+
font-weight: bold;
|
|
48
|
+
font-size: 19px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputProps as TaroInputProps } from '@tarojs/components';
|
|
3
|
+
export interface InputProps extends TaroInputProps {
|
|
4
|
+
/**
|
|
5
|
+
* 是否显示删除按钮
|
|
6
|
+
*/
|
|
7
|
+
allowClear?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 自定义删除按钮
|
|
10
|
+
*/
|
|
11
|
+
clearIcon?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* 是否显示字数统计
|
|
14
|
+
*/
|
|
15
|
+
showCount?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 边框样式 outlined 边框 borderless 无边框
|
|
18
|
+
*/
|
|
19
|
+
variant?: 'outlined' | 'borderless';
|
|
20
|
+
}
|
|
21
|
+
declare const Input: React.FC<InputProps>;
|
|
22
|
+
export default Input;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {objectWithoutProperties as _objectWithoutProperties,slicedToArray as _slicedToArray,objectSpread2 as _objectSpread2}from'../../_virtual/_rollupPluginBabelHelpers.js';import {j as jsxRuntimeExports}from'../../node_modules/react/jsx-runtime.js';import React from'react';import cns from'../../node_modules/classnames/index.js';import {View,Input as Input$1,Text}from'@tarojs/components';var _excluded = ["variant", "allowClear", "showCount", "clearIcon", "className", "style", "onClick", "onInput", "maxlength", "placeholderStyle", "defaultValue"];
|
|
2
|
+
var Input = function Input(_ref) {
|
|
3
|
+
_ref.variant;
|
|
4
|
+
_ref.allowClear;
|
|
5
|
+
var showCount = _ref.showCount;
|
|
6
|
+
_ref.clearIcon;
|
|
7
|
+
var className = _ref.className,
|
|
8
|
+
style = _ref.style,
|
|
9
|
+
onClick = _ref.onClick,
|
|
10
|
+
onInput = _ref.onInput,
|
|
11
|
+
maxlength = _ref.maxlength;
|
|
12
|
+
_ref.placeholderStyle;
|
|
13
|
+
var defaultValue = _ref.defaultValue,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
var _React$useState = React.useState(defaultValue || ''),
|
|
16
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
17
|
+
innerValue = _React$useState2[0],
|
|
18
|
+
setInnerValue = _React$useState2[1];
|
|
19
|
+
var handleChange = function handleChange(e) {
|
|
20
|
+
setInnerValue(e.detail.value);
|
|
21
|
+
onInput && onInput(e);
|
|
22
|
+
};
|
|
23
|
+
// 受控
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
if ("value" in props) {
|
|
26
|
+
setInnerValue(props.value || "");
|
|
27
|
+
}
|
|
28
|
+
}, [props]);
|
|
29
|
+
return jsxRuntimeExports.jsxs(View, {
|
|
30
|
+
className: cns("ypmini-taro-input-wrapper", className),
|
|
31
|
+
style: style,
|
|
32
|
+
onClick: onClick,
|
|
33
|
+
children: [jsxRuntimeExports.jsx(Input$1, _objectSpread2({
|
|
34
|
+
placeholderStyle: "font-size: 17px;color: #00000040;",
|
|
35
|
+
placeholderTextColor: "#00000040",
|
|
36
|
+
value: innerValue,
|
|
37
|
+
onInput: handleChange,
|
|
38
|
+
maxlength: maxlength,
|
|
39
|
+
className: "ypmini-taro-input"
|
|
40
|
+
}, props)), jsxRuntimeExports.jsx(View, {
|
|
41
|
+
className: "ypmini-taro-input-clear"
|
|
42
|
+
}), showCount ? jsxRuntimeExports.jsxs(View, {
|
|
43
|
+
className: "ypmini-taro-input-count",
|
|
44
|
+
children: [jsxRuntimeExports.jsx(Text, {
|
|
45
|
+
className: cns("ypmini-taro-input-count-current", {
|
|
46
|
+
"ypmini-taro-input-count-current-light": (innerValue === null || innerValue === void 0 ? void 0 : innerValue.length) > 0
|
|
47
|
+
}),
|
|
48
|
+
children: innerValue === null || innerValue === void 0 ? void 0 : innerValue.length
|
|
49
|
+
}), maxlength ? jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
50
|
+
children: ["/", jsxRuntimeExports.jsx(Text, {
|
|
51
|
+
className: "ypmini-taro-input-count-total",
|
|
52
|
+
children: maxlength || 0
|
|
53
|
+
})]
|
|
54
|
+
}) : null]
|
|
55
|
+
}) : null]
|
|
56
|
+
});
|
|
57
|
+
};export{Input as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--input-placeholder-color: rgba(0, 0, 0, 0.25);
|
|
3
|
+
--input-text-color: var(--yp-color-text);
|
|
4
|
+
--input-font-size: var(--yp-font-size-default);
|
|
5
|
+
}
|
|
6
|
+
.ypmini-taro-input-wrapper {
|
|
7
|
+
display: flex;
|
|
8
|
+
font-size: var(--input-font-size);
|
|
9
|
+
padding: 16px 12px;
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
border: 1px solid #e9edf3;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
.ypmini-taro-input {
|
|
15
|
+
color: var(--input-text-color);
|
|
16
|
+
flex: 1;
|
|
17
|
+
border: none;
|
|
18
|
+
}
|
|
19
|
+
.ypmini-input-placeholder {
|
|
20
|
+
color: var(--input-placeholder-color);
|
|
21
|
+
}
|
|
22
|
+
.ypmini-taro-input-count {
|
|
23
|
+
color: rgba(0, 0, 0, 0.45);
|
|
24
|
+
font-size: 15px;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
.ypmini-taro-input-count .ypmini-taro-input-count-current-light {
|
|
29
|
+
color: var(--yp-color-text-light);
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--input-placeholder-color: rgba(0, 0, 0, 0.25);
|
|
3
|
+
--input-text-color: var(--yp-color-text);
|
|
4
|
+
--input-font-size: var(--yp-font-size-default);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ypmini-taro-input-wrapper {
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
font-size: var(--input-font-size);
|
|
11
|
+
padding: 16px 12px;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
border: 1px solid rgba(233, 237, 243, 1);
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ypmini-taro-input {
|
|
18
|
+
color: var(--input-text-color);
|
|
19
|
+
flex: 1;
|
|
20
|
+
border: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ypmini-input-placeholder {
|
|
24
|
+
color: var(--input-placeholder-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ypmini-taro-input-count {
|
|
28
|
+
color: rgba(0, 0, 0, 0.45);
|
|
29
|
+
font-size: 15px;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
|
|
33
|
+
.ypmini-taro-input-count-current-light {
|
|
34
|
+
color: var(--yp-color-text-light);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioProps as YpRadioProps } from '@yup/taro-radio';
|
|
3
|
+
import RadioGroup from './radio-group';
|
|
4
|
+
export interface RadioProps extends YpRadioProps {
|
|
5
|
+
/**
|
|
6
|
+
* button按钮样式,auto默认选中样式
|
|
7
|
+
*/
|
|
8
|
+
type?: 'button' | 'default';
|
|
9
|
+
}
|
|
10
|
+
declare const Radio: React.FC<RadioProps> & {
|
|
11
|
+
Group: typeof RadioGroup;
|
|
12
|
+
};
|
|
13
|
+
export default Radio;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {objectWithoutProperties as _objectWithoutProperties,objectSpread2 as _objectSpread2}from'../../_virtual/_rollupPluginBabelHelpers.js';import {j as jsxRuntimeExports}from'../../node_modules/react/jsx-runtime.js';import {View}from'@tarojs/components';import cns from'../../node_modules/classnames/index.js';import YpRadio from'@yup/taro-radio';import RadioGroup from'./radio-group.js';var _excluded = ["children", "type"];
|
|
2
|
+
var Radio = function Radio(_ref) {
|
|
3
|
+
var children = _ref.children;
|
|
4
|
+
_ref.type;
|
|
5
|
+
var rstProps = _objectWithoutProperties(_ref, _excluded);
|
|
6
|
+
return jsxRuntimeExports.jsx(YpRadio, _objectSpread2({
|
|
7
|
+
className: 'ypmini-taro-radio',
|
|
8
|
+
icon: function icon(checked) {
|
|
9
|
+
return jsxRuntimeExports.jsx(View, {
|
|
10
|
+
className: cns("ypmini-taro-radio-button", {
|
|
11
|
+
'ypmini-taro-radio-button-checked': checked
|
|
12
|
+
}),
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}, rstProps));
|
|
17
|
+
};
|
|
18
|
+
Radio.Group = RadioGroup;export{Radio as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioGroupProps as YpRadioGroupProps } from '@yup/taro-radio/dist/types/type';
|
|
3
|
+
export interface RadioGroupProps extends YpRadioGroupProps {
|
|
4
|
+
/**
|
|
5
|
+
* button按钮样式,auto默认选中样式
|
|
6
|
+
*/
|
|
7
|
+
type?: 'button' | 'default';
|
|
8
|
+
}
|
|
9
|
+
declare const RadioGroup: React.FC<RadioGroupProps>;
|
|
10
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {objectWithoutProperties as _objectWithoutProperties,objectSpread2 as _objectSpread2}from'../../_virtual/_rollupPluginBabelHelpers.js';import {j as jsxRuntimeExports}from'../../node_modules/react/jsx-runtime.js';import cns from'../../node_modules/classnames/index.js';import YpRadio from'@yup/taro-radio';var _excluded = ["children", "type", "block"];
|
|
2
|
+
var RadioGroup = function RadioGroup(_ref) {
|
|
3
|
+
var children = _ref.children,
|
|
4
|
+
type = _ref.type,
|
|
5
|
+
_ref$block = _ref.block,
|
|
6
|
+
block = _ref$block === void 0 ? false : _ref$block,
|
|
7
|
+
rst = _objectWithoutProperties(_ref, _excluded);
|
|
8
|
+
return jsxRuntimeExports.jsx(YpRadio.Group, _objectSpread2(_objectSpread2({
|
|
9
|
+
className: cns("ypmini-radio-group", {
|
|
10
|
+
'ypmini-radio-group--button': type === 'button',
|
|
11
|
+
'ypmini-radio-group--block': block
|
|
12
|
+
})
|
|
13
|
+
}, rst), {}, {
|
|
14
|
+
children: children
|
|
15
|
+
}));
|
|
16
|
+
};export{RadioGroup as default};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--radio-button-font-size: 17px;
|
|
3
|
+
--radio-button-border-radius: 8px;
|
|
4
|
+
--radio-button-background-color: #f5f7fc;
|
|
5
|
+
--radio-button-text-color: #000000d9;
|
|
6
|
+
--radio-button-checked-background-color: #e0f3ff;
|
|
7
|
+
--radio-button-checked-text-color: var(--yp-color-primary);
|
|
8
|
+
--radio-button-checked-border-color: var(--yp-color-primary);
|
|
9
|
+
--radio-button-height: 52px;
|
|
10
|
+
}
|
|
11
|
+
.ypmini-taro-radio-button {
|
|
12
|
+
background-color: var(--radio-button-background-color);
|
|
13
|
+
color: var(--radio-button-text-color);
|
|
14
|
+
font-size: var(--radio-button-font-size);
|
|
15
|
+
text-align: center;
|
|
16
|
+
padding: 0px 16px;
|
|
17
|
+
height: var(--radio-button-height);
|
|
18
|
+
line-height: var(--radio-button-height);
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
border-radius: var(--radio-button-border-radius);
|
|
21
|
+
}
|
|
22
|
+
.ypmini-taro-radio-button-checked {
|
|
23
|
+
background-color: var(--radio-button-checked-background-color);
|
|
24
|
+
color: var(--radio-button-checked-text-color);
|
|
25
|
+
border-color: var(--radio-button-checked-border-color);
|
|
26
|
+
border-width: 1px;
|
|
27
|
+
border-style: solid;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--radio-button-font-size: 17px;
|
|
3
|
+
--radio-button-border-radius: 8px;
|
|
4
|
+
--radio-button-background-color: #f5f7fc;
|
|
5
|
+
--radio-button-text-color: #000000d9;
|
|
6
|
+
--radio-button-checked-background-color: #e0f3ff;
|
|
7
|
+
--radio-button-checked-text-color: var(--yp-color-primary);
|
|
8
|
+
--radio-button-checked-border-color: var(--yp-color-primary);
|
|
9
|
+
--radio-button-height: 52px;
|
|
10
|
+
}
|
|
11
|
+
.ypmini-taro-radio {
|
|
12
|
+
|
|
13
|
+
&-button {
|
|
14
|
+
background-color: var(--radio-button-background-color);
|
|
15
|
+
color: var(--radio-button-text-color);
|
|
16
|
+
font-size: var(--radio-button-font-size);
|
|
17
|
+
text-align: center;
|
|
18
|
+
padding: 0px 16px;
|
|
19
|
+
height: var(--radio-button-height);
|
|
20
|
+
line-height: var(--radio-button-height);
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
border-radius: var(--radio-button-border-radius);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-button-checked {
|
|
26
|
+
background-color: var(--radio-button-checked-background-color);
|
|
27
|
+
color: var(--radio-button-checked-text-color);
|
|
28
|
+
border-color: var(--radio-button-checked-border-color);
|
|
29
|
+
border-width: 1px;
|
|
30
|
+
border-style: solid;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Toast from'./toast.js';import withToast from'./withToast.js';Toast.withToast = withToast;export{Toast as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--toast-z-index: 9999;
|
|
3
|
+
}
|
|
4
|
+
.ypmini-toast-container {
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 50%;
|
|
7
|
+
left: 50%;
|
|
8
|
+
transform: translate(-50%, -50%);
|
|
9
|
+
background: rgba(0, 0, 0, 0.7);
|
|
10
|
+
color: #fff;
|
|
11
|
+
padding: 12px;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
z-index: var(--toast-z-index);
|
|
16
|
+
max-width: 80%;
|
|
17
|
+
height: auto;
|
|
18
|
+
word-break: break-word;
|
|
19
|
+
}
|
|
20
|
+
.ypmini-toast-content {
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--toast-z-index: 9999;
|
|
3
|
+
}
|
|
4
|
+
.ypmini-toast-container {
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 50%;
|
|
7
|
+
left: 50%;
|
|
8
|
+
transform: translate(-50%, -50%);
|
|
9
|
+
background: rgba(0,0,0,0.7);
|
|
10
|
+
color: #fff;
|
|
11
|
+
padding: 12px;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
z-index: var(--toast-z-index);
|
|
16
|
+
max-width: 80%;
|
|
17
|
+
height: auto;
|
|
18
|
+
word-break: break-word;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ypmini-toast-content {
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from '@tarojs/components';
|
|
3
|
+
export interface ToastProps extends ViewProps {
|
|
4
|
+
content?: React.ReactNode;
|
|
5
|
+
duration?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastRefType {
|
|
9
|
+
show: (options: ToastProps | string) => void;
|
|
10
|
+
hide: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: {
|
|
13
|
+
createToast: Function;
|
|
14
|
+
show: (options: ToastProps) => void;
|
|
15
|
+
hide: () => void;
|
|
16
|
+
withToast: (Component: React.FC) => React.FC;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {slicedToArray as _slicedToArray,objectWithoutProperties as _objectWithoutProperties,objectSpread2 as _objectSpread2}from'../../_virtual/_rollupPluginBabelHelpers.js';import {j as jsxRuntimeExports}from'../../node_modules/react/jsx-runtime.js';import React,{useState}from'react';import {View,Text}from'@tarojs/components';import cns from'../../node_modules/classnames/index.js';import {isNumber}from'../../utils/is.js';var _excluded = ["content", "duration"],
|
|
2
|
+
_excluded2 = ["className"];
|
|
3
|
+
var toastInstance = {};
|
|
4
|
+
var Toast = React.forwardRef(function (props, ref) {
|
|
5
|
+
var _useState = useState(false),
|
|
6
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
7
|
+
visible = _useState2[0],
|
|
8
|
+
setVisible = _useState2[1];
|
|
9
|
+
var _useState3 = useState(''),
|
|
10
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
11
|
+
content = _useState4[0],
|
|
12
|
+
setContent = _useState4[1];
|
|
13
|
+
var _React$useState = React.useState(),
|
|
14
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
15
|
+
wrapperRstProps = _React$useState2[0],
|
|
16
|
+
setWrapperRstProps = _React$useState2[1];
|
|
17
|
+
var durationRef = React.useRef(2000);
|
|
18
|
+
var timer = React.useRef(null);
|
|
19
|
+
React.useImperativeHandle(ref, function () {
|
|
20
|
+
return {
|
|
21
|
+
show: function show(options) {
|
|
22
|
+
if (typeof options === 'string') {
|
|
23
|
+
setContent(options);
|
|
24
|
+
} else {
|
|
25
|
+
var _content = options.content,
|
|
26
|
+
_options$duration = options.duration,
|
|
27
|
+
duration = _options$duration === void 0 ? 2000 : _options$duration,
|
|
28
|
+
rst = _objectWithoutProperties(options, _excluded);
|
|
29
|
+
if (isNumber(duration)) {
|
|
30
|
+
durationRef.current = duration;
|
|
31
|
+
}
|
|
32
|
+
setWrapperRstProps(rst);
|
|
33
|
+
setContent(_content);
|
|
34
|
+
}
|
|
35
|
+
if (timer.current) {
|
|
36
|
+
clearTimeout(timer.current);
|
|
37
|
+
}
|
|
38
|
+
setVisible(true);
|
|
39
|
+
var t = setTimeout(function () {
|
|
40
|
+
setVisible(false);
|
|
41
|
+
}, durationRef.current);
|
|
42
|
+
timer.current = t;
|
|
43
|
+
},
|
|
44
|
+
hide: function hide() {
|
|
45
|
+
clearTimeout(timer.current);
|
|
46
|
+
setVisible(false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
if (!visible) return null;
|
|
51
|
+
var _ref = wrapperRstProps || {},
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
rstProps = _objectWithoutProperties(_ref, _excluded2);
|
|
54
|
+
return jsxRuntimeExports.jsx(View, _objectSpread2(_objectSpread2({
|
|
55
|
+
className: cns('ypmini-toast-container', className)
|
|
56
|
+
}, rstProps), {}, {
|
|
57
|
+
children: jsxRuntimeExports.jsx(Text, {
|
|
58
|
+
className: 'ypmini-toast-content',
|
|
59
|
+
children: content
|
|
60
|
+
})
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
function createToast() {
|
|
64
|
+
var _toastInstance;
|
|
65
|
+
if (!((_toastInstance = toastInstance) !== null && _toastInstance !== void 0 && _toastInstance.ref)) {
|
|
66
|
+
var ref = React.createRef();
|
|
67
|
+
var ToastWrapper = function ToastWrapper() {
|
|
68
|
+
return jsxRuntimeExports.jsx(Toast, {
|
|
69
|
+
ref: ref
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
toastInstance = {
|
|
73
|
+
ref: ref,
|
|
74
|
+
ToastWrapper: ToastWrapper
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return toastInstance;
|
|
78
|
+
}
|
|
79
|
+
var Toast$1 = {
|
|
80
|
+
createToast: createToast,
|
|
81
|
+
show: function show(options) {
|
|
82
|
+
var _toastInstance2;
|
|
83
|
+
(_toastInstance2 = toastInstance) === null || _toastInstance2 === void 0 || (_toastInstance2 = _toastInstance2.ref) === null || _toastInstance2 === void 0 || (_toastInstance2 = _toastInstance2.current) === null || _toastInstance2 === void 0 || _toastInstance2.show(options);
|
|
84
|
+
},
|
|
85
|
+
hide: function hide() {
|
|
86
|
+
var _toastInstance3;
|
|
87
|
+
(_toastInstance3 = toastInstance) === null || _toastInstance3 === void 0 || (_toastInstance3 = _toastInstance3.ref) === null || _toastInstance3 === void 0 || (_toastInstance3 = _toastInstance3.current) === null || _toastInstance3 === void 0 || _toastInstance3.hide();
|
|
88
|
+
}
|
|
89
|
+
};export{Toast$1 as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {objectSpread2 as _objectSpread2}from'../../_virtual/_rollupPluginBabelHelpers.js';import {j as jsxRuntimeExports}from'../../node_modules/react/jsx-runtime.js';import Toast from'./toast.js';function withToast(WrappedComponent) {
|
|
2
|
+
var _Toast$createToast = Toast.createToast(),
|
|
3
|
+
ToastWrapper = _Toast$createToast.ToastWrapper;
|
|
4
|
+
return function (props) {
|
|
5
|
+
return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
6
|
+
children: [jsxRuntimeExports.jsx(ToastWrapper, {}), jsxRuntimeExports.jsx(WrappedComponent, _objectSpread2({}, props))]
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
}export{withToast as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('./theme-default.less');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './global.less';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
// 主题色
|
|
3
|
+
--yp-color-primary: #0092ff;
|
|
4
|
+
// 基础字体颜色
|
|
5
|
+
--yp-color-text: rgba(0, 0, 0, 0.85);
|
|
6
|
+
// 字体高亮
|
|
7
|
+
--yp-color-text-light: rgba(0, 146, 255, 1);
|
|
8
|
+
// 弱化的字体颜色
|
|
9
|
+
--yp-color-text-weak: rgba(0, 0, 0, 0.45);
|
|
10
|
+
// 边框颜色
|
|
11
|
+
--yp-border-color: rgba(233, 237, 243, 1);
|
|
12
|
+
|
|
13
|
+
// 字体颜色
|
|
14
|
+
--yp-color-text-primary: #333;
|
|
15
|
+
--yp-color-text-link: var(--yp-color-primary);
|
|
16
|
+
--yp-color-text-secondary: #666;
|
|
17
|
+
--yp-color-text-disabled: #ccc;
|
|
18
|
+
--yp-color-text-placeholder: #999;
|
|
19
|
+
|
|
20
|
+
// 字体
|
|
21
|
+
--yp-font-size-default: 17px;
|
|
22
|
+
|
|
23
|
+
// radio组件背景色
|
|
24
|
+
--yp-radio-circle-checked-color: var(--yp-color-primary);
|
|
25
|
+
--yp-radio-button-checked-color: var(--yp-color-primary);
|
|
26
|
+
|
|
27
|
+
// checkbox组件背景色
|
|
28
|
+
--yp-checkbox-circle-checked-color: var(--yp-color-primary);
|
|
29
|
+
--yp-checkbox-button-checked-color: var(--yp-color-primary);
|
|
30
|
+
|
|
31
|
+
// 圆角
|
|
32
|
+
--yp-border-radius-base: 4px;
|
|
33
|
+
--yp-border-radius-button: 8px;
|
|
34
|
+
|
|
35
|
+
// 间距
|
|
36
|
+
--yp-space-horizontal-base: 12px; // 水平间距
|
|
37
|
+
}
|