@nutui/nutui-react-taro 3.0.0-beta.1 → 3.0.0-beta.3
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/cjs/packages/avatar/avatar.js +14 -16
- package/dist/cjs/packages/avatar/style/avatar.scss +7 -60
- package/dist/cjs/packages/avatar/style/style.css +5 -43
- package/dist/cjs/packages/avatar/style/style.harmony.css +5 -43
- package/dist/cjs/packages/badge/badge.js +67 -12
- package/dist/cjs/packages/badge/style/badge.scss +18 -24
- package/dist/cjs/packages/badge/style/style.css +17 -15
- package/dist/cjs/packages/badge/style/style.harmony.css +22 -17
- package/dist/cjs/packages/button/button.js +1 -1
- package/dist/cjs/packages/calendarcard/calendarcard.js +8 -3
- package/dist/cjs/packages/calendarcard/icon.js +14 -2
- package/dist/cjs/packages/calendarcard/style/calendarcard.scss +25 -4
- package/dist/cjs/packages/calendarcard/style/style.css +27 -2
- package/dist/cjs/packages/image/image.js +5 -5
- package/dist/cjs/packages/input/input.js +3 -5
- package/dist/cjs/packages/input/style/input.scss +4 -0
- package/dist/cjs/packages/input/style/style.css +4 -0
- package/dist/cjs/packages/input/style/style.harmony.css +4 -0
- package/dist/cjs/packages/navbar/navbar.js +17 -8
- package/dist/cjs/packages/navbar/style/navbar.scss +46 -101
- package/dist/cjs/packages/navbar/style/style.css +44 -89
- package/dist/cjs/packages/navbar/style/style.harmony.css +45 -93
- package/dist/cjs/packages/overlay/style/style.harmony.css +5 -3
- package/dist/cjs/packages/pagination/pagination.js +2 -0
- package/dist/cjs/packages/pagination/style/pagination.scss +6 -12
- package/dist/cjs/packages/pagination/style/style.css +8 -14
- package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +1 -1
- package/dist/cjs/packages/radio/index.d.ts +8 -2
- package/dist/cjs/packages/radio/index.js +6 -1
- package/dist/cjs/packages/radio/radio.d.ts +2 -5
- package/dist/cjs/packages/radio/radio.js +2 -4
- package/dist/cjs/packages/radio/style/radio.scss +1 -0
- package/dist/cjs/packages/radiogroup/radiogroup.d.ts +2 -1
- package/dist/cjs/packages/radiogroup/radiogroup.js +3 -2
- package/dist/cjs/packages/safearea/style/safearea.scss +1 -1
- package/dist/cjs/packages/safearea/style/style.css +1 -1
- package/dist/cjs/packages/safearea/style/style.harmony.css +1 -1
- package/dist/cjs/packages/searchbar/searchbar.d.ts +1 -1
- package/dist/cjs/packages/searchbar/searchbar.js +31 -33
- package/dist/cjs/packages/searchbar/style/searchbar.scss +10 -7
- package/dist/cjs/packages/searchbar/style/style.css +11 -8
- package/dist/cjs/packages/searchbar/style/style.harmony.css +25 -12
- package/dist/cjs/packages/skeleton/style/style.css +5 -43
- package/dist/cjs/packages/tabbar/style/style.css +17 -15
- package/dist/cjs/packages/tabbaritem/style/style.css +17 -15
- package/dist/cjs/packages/tag/tag.d.ts +1 -1
- package/dist/cjs/packages/tag/tag.js +5 -11
- package/dist/cjs/packages/toast/style/style.css +56 -30
- package/dist/cjs/packages/toast/style/style.harmony.css +51 -62
- package/dist/cjs/packages/toast/style/toast.scss +65 -49
- package/dist/cjs/packages/toast/toast.d.ts +7 -7
- package/dist/cjs/packages/toast/toast.js +24 -19
- package/dist/cjs/packages/trendarrow/style/style.css +2 -1
- package/dist/cjs/packages/trendarrow/style/style.harmony.css +3 -2
- package/dist/cjs/packages/trendarrow/style/trendarrow.scss +2 -1
- package/dist/cjs/packages/trendarrow/trendarrow.js +6 -4
- package/dist/cjs/packages/video/video.js +3 -3
- package/dist/es/packages/avatar/avatar.js +14 -16
- package/dist/es/packages/avatar/style/avatar.scss +7 -60
- package/dist/es/packages/avatar/style/style.css +5 -43
- package/dist/es/packages/avatar/style/style.harmony.css +5 -43
- package/dist/es/packages/badge/badge.d.ts +7 -35
- package/dist/es/packages/badge/badge.js +66 -12
- package/dist/es/packages/badge/style/badge.scss +18 -24
- package/dist/es/packages/badge/style/style.css +17 -15
- package/dist/es/packages/badge/style/style.harmony.css +22 -17
- package/dist/es/packages/button/button.js +1 -1
- package/dist/es/packages/calendarcard/calendarcard.d.ts +13 -65
- package/dist/es/packages/calendarcard/calendarcard.js +9 -4
- package/dist/es/packages/calendarcard/icon.js +15 -3
- package/dist/es/packages/calendarcard/style/calendarcard.scss +25 -4
- package/dist/es/packages/calendarcard/style/style.css +27 -2
- package/dist/es/packages/image/image.js +5 -5
- package/dist/es/packages/input/input.js +3 -5
- package/dist/es/packages/input/style/input.scss +4 -0
- package/dist/es/packages/input/style/style.css +4 -0
- package/dist/es/packages/input/style/style.harmony.css +4 -0
- package/dist/es/packages/loading/loading.d.ts +3 -15
- package/dist/es/packages/navbar/navbar.js +17 -8
- package/dist/es/packages/navbar/style/navbar.scss +46 -101
- package/dist/es/packages/navbar/style/style.css +44 -89
- package/dist/es/packages/navbar/style/style.harmony.css +45 -93
- package/dist/es/packages/overlay/style/style.harmony.css +5 -3
- package/dist/es/packages/pagination/pagination.js +2 -0
- package/dist/es/packages/pagination/style/pagination.scss +6 -12
- package/dist/es/packages/pagination/style/style.css +8 -14
- package/dist/es/packages/pulltorefresh/pulltorefresh.js +2 -2
- package/dist/es/packages/radio/index.d.ts +8 -2
- package/dist/es/packages/radio/index.js +5 -1
- package/dist/es/packages/radio/radio.d.ts +11 -50
- package/dist/es/packages/radio/radio.js +3 -5
- package/dist/es/packages/radio/style/radio.scss +1 -0
- package/dist/es/packages/radiogroup/radiogroup.d.ts +9 -36
- package/dist/es/packages/radiogroup/radiogroup.js +3 -2
- package/dist/es/packages/safearea/safearea.d.ts +1 -5
- package/dist/es/packages/safearea/style/safearea.scss +1 -1
- package/dist/es/packages/safearea/style/style.css +1 -1
- package/dist/es/packages/safearea/style/style.harmony.css +1 -1
- package/dist/es/packages/searchbar/searchbar.d.ts +19 -95
- package/dist/es/packages/searchbar/searchbar.js +32 -34
- package/dist/es/packages/searchbar/style/searchbar.scss +10 -7
- package/dist/es/packages/searchbar/style/style.css +11 -8
- package/dist/es/packages/searchbar/style/style.harmony.css +25 -12
- package/dist/es/packages/skeleton/style/style.css +5 -43
- package/dist/es/packages/tabbar/style/style.css +17 -15
- package/dist/es/packages/tabbaritem/style/style.css +17 -15
- package/dist/es/packages/tag/tag.d.ts +1 -1
- package/dist/es/packages/tag/tag.js +6 -14
- package/dist/es/packages/toast/style/style.css +56 -30
- package/dist/es/packages/toast/style/style.harmony.css +51 -62
- package/dist/es/packages/toast/style/toast.scss +65 -49
- package/dist/es/packages/toast/toast.d.ts +15 -71
- package/dist/es/packages/toast/toast.js +25 -20
- package/dist/es/packages/trendarrow/style/style.css +2 -1
- package/dist/es/packages/trendarrow/style/style.harmony.css +3 -2
- package/dist/es/packages/trendarrow/style/trendarrow.scss +2 -1
- package/dist/es/packages/trendarrow/trendarrow.d.ts +11 -55
- package/dist/es/packages/trendarrow/trendarrow.js +6 -4
- package/dist/es/packages/video/video.d.ts +5 -25
- package/dist/es/packages/video/video.js +3 -3
- package/dist/nutui.react.umd.js +533 -437
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +28 -28
- package/dist/styles/variables-jrkf.scss +21 -27
- package/dist/styles/variables.scss +7 -4
- package/package.json +2 -2
|
@@ -15,7 +15,7 @@ import { rubberbandIfOutOfBounds } from "../../utils/rubberband";
|
|
|
15
15
|
import { sleep } from "../../utils/sleep";
|
|
16
16
|
import { ComponentDefaults } from "../../utils/typings";
|
|
17
17
|
import pxTransform from "../../utils/px-transform";
|
|
18
|
-
import {
|
|
18
|
+
import { rn } from "../../utils/platform-taro";
|
|
19
19
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
20
20
|
type: 'default',
|
|
21
21
|
pullingText: '',
|
|
@@ -50,7 +50,7 @@ export var PullToRefresh = function(p) {
|
|
|
50
50
|
var _useState1 = _sliced_to_array(useState(0), 2), height = _useState1[0], setHeight = _useState1[1];
|
|
51
51
|
var timer = useRef();
|
|
52
52
|
var renderIcons = function(status) {
|
|
53
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, (status === 'pulling' || status === 'complete') &&
|
|
53
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, (status === 'pulling' || status === 'complete') && /*#__PURE__*/ React.createElement(Loading, null), (status === 'canRelease' || status === 'refreshing') && /*#__PURE__*/ React.createElement(More, null));
|
|
54
54
|
};
|
|
55
55
|
var renderStatusIcon = function() {
|
|
56
56
|
if (props.renderIcon) {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioProps } from "./radio";
|
|
3
|
+
import { RadioGroup } from "../radiogroup/radiogroup";
|
|
2
4
|
export type { RadioProps } from "./radio";
|
|
3
5
|
export type { RadioShape, RadioPosition } from './types';
|
|
4
|
-
|
|
6
|
+
type CompoundedComponent = React.FC<Partial<RadioProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>> & {
|
|
7
|
+
Group: typeof RadioGroup;
|
|
8
|
+
};
|
|
9
|
+
declare const InnerRadio: CompoundedComponent;
|
|
10
|
+
export default InnerRadio;
|
|
@@ -1,54 +1,15 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import RadioGroup from "../radiogroup/index";
|
|
1
|
+
import React, { FC } from 'react';
|
|
3
2
|
import { BasicComponent } from "../../utils/typings";
|
|
4
3
|
import { RadioPosition, RadioShape } from "./types";
|
|
5
4
|
export interface RadioProps extends BasicComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
checked: boolean
|
|
16
|
-
/**
|
|
17
|
-
* 初始是否选中
|
|
18
|
-
* @default -
|
|
19
|
-
*/
|
|
20
|
-
defaultChecked: boolean
|
|
21
|
-
/**
|
|
22
|
-
* 形状
|
|
23
|
-
* @default round
|
|
24
|
-
*/
|
|
25
|
-
shape: RadioShape
|
|
26
|
-
/**
|
|
27
|
-
* 文本所在的位置
|
|
28
|
-
* @default right
|
|
29
|
-
*/
|
|
30
|
-
labelPosition: RadioPosition
|
|
31
|
-
/**
|
|
32
|
-
* <a href="#/icon">图标名称</a>,选中前(建议和activeIcon一起修改)
|
|
33
|
-
* @default 'CheckNormal'
|
|
34
|
-
*/
|
|
35
|
-
icon: React.ReactNode
|
|
36
|
-
/**
|
|
37
|
-
* <a href="#/icon">图标名称</a>,选中后(建议和icon一起修改)
|
|
38
|
-
* @default 'CheckChecked'
|
|
39
|
-
*/
|
|
40
|
-
activeIcon: React.ReactNode
|
|
41
|
-
/**
|
|
42
|
-
* 携带的标识值,用于 Group 模式
|
|
43
|
-
* @default -
|
|
44
|
-
*/
|
|
45
|
-
value: string | number
|
|
46
|
-
/**
|
|
47
|
-
* 选中态变化时触发
|
|
48
|
-
* @default -
|
|
49
|
-
*/
|
|
50
|
-
onChange: (checked: boolean) => void
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
defaultChecked: boolean;
|
|
8
|
+
shape: RadioShape;
|
|
9
|
+
labelPosition: RadioPosition;
|
|
10
|
+
icon: React.ReactNode;
|
|
11
|
+
activeIcon: React.ReactNode;
|
|
12
|
+
value: string | number;
|
|
13
|
+
onChange: (checked: boolean) => void;
|
|
51
14
|
}
|
|
52
|
-
export declare const Radio:
|
|
53
|
-
Group: typeof RadioGroup;
|
|
54
|
-
};
|
|
15
|
+
export declare const Radio: FC<Partial<RadioProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>>;
|
|
@@ -4,11 +4,10 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
4
4
|
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
6
|
import React, { useContext } from "react";
|
|
7
|
-
import { CheckChecked,
|
|
7
|
+
import { CheckChecked, CheckDisabled, CheckNormal } from "@nutui/icons-react-taro";
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import { View } from "@tarojs/components";
|
|
10
10
|
import RadioContext from "../radiogroup/context";
|
|
11
|
-
import RadioGroup from "../radiogroup/index";
|
|
12
11
|
import { ComponentDefaults } from "../../utils/typings";
|
|
13
12
|
import { usePropsValue } from "../../utils/use-props-value";
|
|
14
13
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
@@ -86,14 +85,14 @@ export var Radio = function(props) {
|
|
|
86
85
|
};
|
|
87
86
|
var renderLabel = function() {
|
|
88
87
|
var labelcls = classNames("".concat(classPrefix, "-label"), _define_property({}, "".concat(classPrefix, "-label-disabled"), disabled));
|
|
89
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, renderIcon(), /*#__PURE__*/ React.createElement(
|
|
88
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, renderIcon(), /*#__PURE__*/ React.createElement(View, {
|
|
90
89
|
className: labelcls
|
|
91
90
|
}, children));
|
|
92
91
|
};
|
|
93
92
|
var renderButton = function() {
|
|
94
93
|
var _obj;
|
|
95
94
|
var buttoncls = classNames("".concat(classPrefix, "-button"), (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-button-active"), checkedStatement), _define_property(_obj, "".concat(classPrefix, "-button-disabled"), disabled), _obj));
|
|
96
|
-
return /*#__PURE__*/ React.createElement(
|
|
95
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
97
96
|
className: buttoncls
|
|
98
97
|
}, children);
|
|
99
98
|
};
|
|
@@ -115,4 +114,3 @@ export var Radio = function(props) {
|
|
|
115
114
|
}, renderRadioItem());
|
|
116
115
|
};
|
|
117
116
|
Radio.displayName = 'NutRadio';
|
|
118
|
-
Radio.Group = RadioGroup;
|
|
@@ -1,41 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ViewProps } from '@tarojs/components/types/View';
|
|
2
3
|
import { RadioGroupDirection, RadioGroupOption, RadioGroupPosition, RadioGroupShape } from './types';
|
|
3
4
|
export interface RadioGroupProps {
|
|
4
|
-
|
|
5
|
-
* 当前选中项的标识符
|
|
6
|
-
* @default -
|
|
7
|
-
*/
|
|
8
|
-
value?: string | number
|
|
5
|
+
value?: string | number;
|
|
9
6
|
defaultValue?: string | number;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* 使用横纵方向
|
|
17
|
-
* @default vertical
|
|
18
|
-
*/
|
|
19
|
-
direction: RadioGroupDirection
|
|
20
|
-
/**
|
|
21
|
-
* 形状
|
|
22
|
-
* @default -
|
|
23
|
-
*/
|
|
24
|
-
shape?: RadioGroupShape
|
|
25
|
-
/**
|
|
26
|
-
* 是否禁用
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean
|
|
30
|
-
/**
|
|
31
|
-
* 配置 options 渲染单选按钮
|
|
32
|
-
* @default -
|
|
33
|
-
*/
|
|
34
|
-
options: RadioGroupOption[]
|
|
35
|
-
/**
|
|
36
|
-
* 值变化时触发
|
|
37
|
-
* @default -
|
|
38
|
-
*/
|
|
39
|
-
onChange: (value: string | number) => void
|
|
7
|
+
labelPosition: RadioGroupPosition;
|
|
8
|
+
direction: RadioGroupDirection;
|
|
9
|
+
shape?: RadioGroupShape;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
options: RadioGroupOption[];
|
|
12
|
+
onChange: (value: string | number) => void;
|
|
40
13
|
}
|
|
41
|
-
export declare const RadioGroup: React.ForwardRefExoticComponent<Partial<RadioGroupProps> & Omit<
|
|
14
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<Omit<Partial<RadioGroupProps> & Omit<ViewProps, "onChange">, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -5,6 +5,7 @@ import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_
|
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
6
|
import React, { useCallback } from "react";
|
|
7
7
|
import classNames from "classnames";
|
|
8
|
+
import { View } from "@tarojs/components";
|
|
8
9
|
import RadioContext from "./context";
|
|
9
10
|
import Radio from "../radio/index";
|
|
10
11
|
import { usePropsValue } from "../../utils/use-props-value";
|
|
@@ -28,7 +29,7 @@ export var RadioGroup = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
28
29
|
"options",
|
|
29
30
|
"disabled"
|
|
30
31
|
]);
|
|
31
|
-
var cls = classNames(classPrefix, _define_property({}, "".concat(classPrefix, "-").concat(
|
|
32
|
+
var cls = classNames(classPrefix, _define_property({}, "".concat(classPrefix, "-").concat(direction), direction), className);
|
|
32
33
|
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
33
34
|
defaultValue: props.defaultValue,
|
|
34
35
|
value: props.value,
|
|
@@ -71,7 +72,7 @@ export var RadioGroup = /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
|
|
71
72
|
setVal2State('');
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
}, /*#__PURE__*/ React.createElement(
|
|
75
|
+
}, /*#__PURE__*/ React.createElement(View, _object_spread({
|
|
75
76
|
className: cls
|
|
76
77
|
}, rest), (options === null || options === void 0 ? void 0 : options.length) ? renderOptionsChildren() : children));
|
|
77
78
|
});
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { BasicComponent } from "../../utils/typings";
|
|
3
3
|
export interface SafeAreaProps extends BasicComponent {
|
|
4
|
-
|
|
5
|
-
* 安全区的位置
|
|
6
|
-
* @default -
|
|
7
|
-
*/
|
|
8
|
-
position: 'top' | 'bottom'
|
|
4
|
+
position: 'top' | 'bottom';
|
|
9
5
|
}
|
|
10
6
|
export declare const SafeArea: FC<SafeAreaProps>;
|
|
@@ -3,100 +3,24 @@ import type { ChangeEvent, FocusEvent, MouseEvent } from 'react';
|
|
|
3
3
|
import { ITouchEvent } from '@tarojs/components';
|
|
4
4
|
import { BasicComponent } from "../../utils/typings";
|
|
5
5
|
export interface SearchBarProps extends BasicComponent {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
disabled?: boolean
|
|
26
|
-
/**
|
|
27
|
-
* 最大输入长度
|
|
28
|
-
* @default 9999
|
|
29
|
-
*/
|
|
30
|
-
maxLength?: number
|
|
31
|
-
/**
|
|
32
|
-
* 是否展示清除按钮
|
|
33
|
-
* @default true
|
|
34
|
-
*/
|
|
35
|
-
clearable?: boolean
|
|
36
|
-
/**
|
|
37
|
-
* 输入框只读
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
readOnly?: boolean
|
|
41
|
-
/**
|
|
42
|
-
* 是否自动聚焦
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
autoFocus?: boolean
|
|
46
|
-
/**
|
|
47
|
-
* 是否展示返回按钮
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
backable: boolean
|
|
51
|
-
/**
|
|
52
|
-
* 搜索框左侧区域
|
|
53
|
-
* @default -
|
|
54
|
-
*/
|
|
55
|
-
left: React.ReactNode
|
|
56
|
-
/**
|
|
57
|
-
* 搜搜框右侧区域
|
|
58
|
-
* @default -
|
|
59
|
-
*/
|
|
60
|
-
right: React.ReactNode
|
|
61
|
-
/**
|
|
62
|
-
* 输入框内左侧区域
|
|
63
|
-
* @default <Search size="12" />
|
|
64
|
-
*/
|
|
65
|
-
leftIn: React.ReactNode
|
|
66
|
-
/**
|
|
67
|
-
* 输入框内右侧区域
|
|
68
|
-
* @default -
|
|
69
|
-
*/
|
|
70
|
-
rightIn: React.ReactNode
|
|
71
|
-
/**
|
|
72
|
-
* 确定搜索时触发
|
|
73
|
-
* @default -
|
|
74
|
-
*/
|
|
75
|
-
onSearch?: (val: string) => void
|
|
76
|
-
/**
|
|
77
|
-
* 输入内容时触发
|
|
78
|
-
* @default -
|
|
79
|
-
*/
|
|
80
|
-
onChange?: (value: string, event?: ChangeEvent<HTMLInputElement>) => void
|
|
81
|
-
/**
|
|
82
|
-
* 聚焦时触发
|
|
83
|
-
* @default -
|
|
84
|
-
*/
|
|
85
|
-
onFocus?: (value: string, event: FocusEvent<HTMLInputElement>) => void
|
|
86
|
-
/**
|
|
87
|
-
* 失焦时触发
|
|
88
|
-
* @default -
|
|
89
|
-
*/
|
|
90
|
-
onBlur?: (value: string, event: FocusEvent<HTMLInputElement>) => void
|
|
91
|
-
/**
|
|
92
|
-
* 点击清空时触发
|
|
93
|
-
* @default -
|
|
94
|
-
*/
|
|
95
|
-
onClear?: (event: React.MouseEvent<Element, MouseEvent> | ITouchEvent) => void
|
|
96
|
-
/**
|
|
97
|
-
* 点击输入区域时触发
|
|
98
|
-
* @default -
|
|
99
|
-
*/
|
|
100
|
-
onInputClick?: (event: MouseEvent<HTMLInputElement>) => void
|
|
6
|
+
value?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
shape?: 'square' | 'round';
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
clearable?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
autoFocus?: boolean;
|
|
14
|
+
backable: boolean;
|
|
15
|
+
left: React.ReactNode;
|
|
16
|
+
right: React.ReactNode;
|
|
17
|
+
leftIn: React.ReactNode;
|
|
18
|
+
rightIn: React.ReactNode;
|
|
19
|
+
onSearch?: (val: string) => void;
|
|
20
|
+
onChange?: (value: string, event?: ChangeEvent<HTMLInputElement>) => void;
|
|
21
|
+
onFocus?: (value: string, event: FocusEvent<HTMLInputElement>) => void;
|
|
22
|
+
onBlur?: (value: string, event: FocusEvent<HTMLInputElement>) => void;
|
|
23
|
+
onClear?: (event: React.MouseEvent<Element, MouseEvent> | ITouchEvent) => void;
|
|
24
|
+
onInputClick?: (event: MouseEvent<HTMLInputElement>) => void;
|
|
101
25
|
}
|
|
102
26
|
export declare const SearchBar: FunctionComponent<Partial<SearchBarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onFocus' | 'onBlur'>>;
|
|
@@ -2,7 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
4
|
import React, { useEffect, useRef, useState } from "react";
|
|
5
|
-
import { View } from "@tarojs/components";
|
|
5
|
+
import { View, Input as TaroInput } from "@tarojs/components";
|
|
6
6
|
import { MaskClose, Search, ArrowLeft } from "@nutui/icons-react-taro";
|
|
7
7
|
import { useConfig } from "../configprovider/configprovider";
|
|
8
8
|
import { ComponentDefaults } from "../../utils/typings";
|
|
@@ -34,21 +34,23 @@ export var SearchBar = function(props) {
|
|
|
34
34
|
var searchSelf = searchRef.current;
|
|
35
35
|
searchSelf && searchSelf.focus();
|
|
36
36
|
};
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
var onInput = function(event) {
|
|
38
|
+
var _event_detail;
|
|
39
|
+
var eventValue = event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value;
|
|
40
|
+
if (value === eventValue) return;
|
|
41
|
+
onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(eventValue, event));
|
|
42
|
+
setValue(eventValue);
|
|
43
|
+
eventValue === '' && forceFocus();
|
|
42
44
|
};
|
|
43
45
|
var focus = function(event) {
|
|
44
|
-
var
|
|
45
|
-
onFocus && (
|
|
46
|
+
var _event_detail;
|
|
47
|
+
onFocus && onFocus(event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
|
|
46
48
|
};
|
|
47
49
|
var blur = function(event) {
|
|
50
|
+
var _event_detail;
|
|
48
51
|
var searchSelf = searchRef.current;
|
|
49
52
|
searchSelf && searchSelf.blur();
|
|
50
|
-
|
|
51
|
-
onBlur && (onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, event));
|
|
53
|
+
onBlur && onBlur(event === null || event === void 0 ? void 0 : (_event_detail = event.detail) === null || _event_detail === void 0 ? void 0 : _event_detail.value, event);
|
|
52
54
|
};
|
|
53
55
|
useEffect(function() {
|
|
54
56
|
setValue(outerValue || '');
|
|
@@ -61,28 +63,21 @@ export var SearchBar = function(props) {
|
|
|
61
63
|
autoFocus
|
|
62
64
|
]);
|
|
63
65
|
var renderField = function() {
|
|
64
|
-
return /*#__PURE__*/ React.createElement(
|
|
66
|
+
return /*#__PURE__*/ React.createElement(TaroInput, {
|
|
65
67
|
className: "".concat(classPrefix, "-input ").concat(clearable ? "".concat(classPrefix, "-input-clear") : ''),
|
|
66
68
|
ref: searchRef,
|
|
67
69
|
style: style,
|
|
68
70
|
value: value || '',
|
|
69
71
|
placeholder: placeholder || locale.placeholder,
|
|
70
|
-
disabled: disabled,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
onBlur: function(e) {
|
|
81
|
-
return blur(e);
|
|
82
|
-
},
|
|
83
|
-
onClick: function(e) {
|
|
84
|
-
return clickInput(e);
|
|
85
|
-
}
|
|
72
|
+
disabled: disabled || readOnly,
|
|
73
|
+
maxlength: maxLength,
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
// onKeyDown={onKeypress}
|
|
76
|
+
onInput: onInput,
|
|
77
|
+
onFocus: focus,
|
|
78
|
+
onBlur: blur,
|
|
79
|
+
onClick: clickInput,
|
|
80
|
+
onConfirm: onConfirm
|
|
86
81
|
});
|
|
87
82
|
};
|
|
88
83
|
var clickInput = function(e) {
|
|
@@ -133,13 +128,16 @@ export var SearchBar = function(props) {
|
|
|
133
128
|
onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(''));
|
|
134
129
|
onClear && onClear(event);
|
|
135
130
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
// const onKeypress = (event: any) => {
|
|
132
|
+
// if (event?.detail?.keyCode === 13) {
|
|
133
|
+
// if (typeof event.cancelable !== 'boolean' || event.cancelable) {
|
|
134
|
+
// event.preventDefault()
|
|
135
|
+
// }
|
|
136
|
+
// onSearch && onSearch(value as string)
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
139
|
+
var onConfirm = function() {
|
|
140
|
+
onSearch && onSearch(value);
|
|
143
141
|
};
|
|
144
142
|
return /*#__PURE__*/ React.createElement(View, {
|
|
145
143
|
className: "".concat(classPrefix, " ").concat(disabled ? "".concat(classPrefix, "-disabled") : '', " ").concat(className || ''),
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
|
|
36
36
|
&-left,
|
|
37
37
|
&-right {
|
|
38
|
-
display: flex;
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
39
40
|
|
|
40
41
|
&.nut-icon {
|
|
41
42
|
width: 20px;
|
|
@@ -48,7 +49,9 @@
|
|
|
48
49
|
|
|
49
50
|
& > div,
|
|
50
51
|
& > span,
|
|
51
|
-
& >
|
|
52
|
+
& > i,
|
|
53
|
+
& > svg,
|
|
54
|
+
.nut-icon {
|
|
52
55
|
margin-right: $searchbar-gap;
|
|
53
56
|
|
|
54
57
|
&:last-child {
|
|
@@ -59,10 +62,11 @@
|
|
|
59
62
|
|
|
60
63
|
&-right {
|
|
61
64
|
margin-left: $searchbar-gap;
|
|
62
|
-
|
|
63
65
|
& > div,
|
|
64
66
|
& > span,
|
|
65
|
-
& >
|
|
67
|
+
& > i,
|
|
68
|
+
& > svg,
|
|
69
|
+
.nut-icon {
|
|
66
70
|
margin-left: $searchbar-gap;
|
|
67
71
|
|
|
68
72
|
&:first-child {
|
|
@@ -89,7 +93,8 @@
|
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
&-input-box
|
|
96
|
+
&-input-box,
|
|
97
|
+
&-input {
|
|
93
98
|
display: flex;
|
|
94
99
|
align-items: center;
|
|
95
100
|
flex: 1;
|
|
@@ -100,8 +105,6 @@
|
|
|
100
105
|
outline: 0;
|
|
101
106
|
box-sizing: border-box;
|
|
102
107
|
width: 100%;
|
|
103
|
-
height: $searchbar-input-height;
|
|
104
|
-
line-height: $searchbar-input-height;
|
|
105
108
|
padding: $searchbar-input-padding;
|
|
106
109
|
font-size: $searchbar-font-size;
|
|
107
110
|
color: $searchbar-input-text-color;
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
color: var(--nutui-black-5);
|
|
31
31
|
}
|
|
32
32
|
.nut-searchbar-left, .nut-searchbar-right {
|
|
33
|
-
display: flex;
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
34
35
|
}
|
|
35
36
|
.nut-searchbar-left.nut-icon, .nut-searchbar-right.nut-icon {
|
|
36
37
|
width: 20px;
|
|
@@ -39,19 +40,23 @@
|
|
|
39
40
|
.nut-searchbar-left {
|
|
40
41
|
margin-right: var(--nutui-searchbar-gap, 16px);
|
|
41
42
|
}
|
|
42
|
-
.nut-searchbar-left > div, .nut-searchbar-left > span, .nut-searchbar-left > svg
|
|
43
|
+
.nut-searchbar-left > div, .nut-searchbar-left > span, .nut-searchbar-left > i, .nut-searchbar-left > svg,
|
|
44
|
+
.nut-searchbar-left .nut-icon {
|
|
43
45
|
margin-right: var(--nutui-searchbar-gap, 16px);
|
|
44
46
|
}
|
|
45
|
-
.nut-searchbar-left > div:last-child, .nut-searchbar-left > span:last-child, .nut-searchbar-left > svg:last-child
|
|
47
|
+
.nut-searchbar-left > div:last-child, .nut-searchbar-left > span:last-child, .nut-searchbar-left > i:last-child, .nut-searchbar-left > svg:last-child,
|
|
48
|
+
.nut-searchbar-left .nut-icon:last-child {
|
|
46
49
|
margin-right: 0;
|
|
47
50
|
}
|
|
48
51
|
.nut-searchbar-right {
|
|
49
52
|
margin-left: var(--nutui-searchbar-gap, 16px);
|
|
50
53
|
}
|
|
51
|
-
.nut-searchbar-right > div, .nut-searchbar-right > span, .nut-searchbar-right > svg
|
|
54
|
+
.nut-searchbar-right > div, .nut-searchbar-right > span, .nut-searchbar-right > i, .nut-searchbar-right > svg,
|
|
55
|
+
.nut-searchbar-right .nut-icon {
|
|
52
56
|
margin-left: var(--nutui-searchbar-gap, 16px);
|
|
53
57
|
}
|
|
54
|
-
.nut-searchbar-right > div:first-child, .nut-searchbar-right > span:first-child, .nut-searchbar-right > svg:first-child
|
|
58
|
+
.nut-searchbar-right > div:first-child, .nut-searchbar-right > span:first-child, .nut-searchbar-right > i:first-child, .nut-searchbar-right > svg:first-child,
|
|
59
|
+
.nut-searchbar-right .nut-icon:first-child {
|
|
55
60
|
margin-left: 0;
|
|
56
61
|
}
|
|
57
62
|
.nut-searchbar-left > text, .nut-searchbar-left > view {
|
|
@@ -66,7 +71,7 @@
|
|
|
66
71
|
.nut-searchbar-right > text:first-child, .nut-searchbar-right > view:first-child {
|
|
67
72
|
margin-left: 0;
|
|
68
73
|
}
|
|
69
|
-
.nut-searchbar-input-box {
|
|
74
|
+
.nut-searchbar-input-box, .nut-searchbar-input {
|
|
70
75
|
display: flex;
|
|
71
76
|
align-items: center;
|
|
72
77
|
flex: 1;
|
|
@@ -76,8 +81,6 @@
|
|
|
76
81
|
outline: 0;
|
|
77
82
|
box-sizing: border-box;
|
|
78
83
|
width: 100%;
|
|
79
|
-
height: var(--nutui-searchbar-input-height, 32px);
|
|
80
|
-
line-height: var(--nutui-searchbar-input-height, 32px);
|
|
81
84
|
padding: var(--nutui-searchbar-input-padding, 0 4px);
|
|
82
85
|
font-size: var(--nutui-searchbar-font-size, var(--nutui-font-size-base, 14px));
|
|
83
86
|
color: var(--nutui-searchbar-input-text-color, var(--nutui-color-title, #1a1a1a));
|