antd-mobile 5.33.0 → 5.33.2
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/2x/README.md +1 -1
- package/2x/bundle/antd-mobile.cjs.development.js +1843 -1829
- package/2x/bundle/antd-mobile.cjs.js +9 -9
- package/2x/bundle/antd-mobile.es.development.js +1025 -1007
- package/2x/bundle/antd-mobile.es.js +5315 -5259
- package/2x/bundle/antd-mobile.umd.development.js +2194 -2180
- package/2x/bundle/antd-mobile.umd.js +9 -9
- package/2x/bundle/style.css +4 -4
- package/2x/cjs/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/2x/cjs/components/calendar-picker/calendar-picker.js +5 -3
- package/2x/cjs/components/cascader/cascader.js +6 -1
- package/2x/cjs/components/cascader-view/cascader-view.js +4 -1
- package/2x/cjs/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/2x/cjs/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/2x/cjs/components/dropdown/dropdown.js +3 -1
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +4 -0
- package/2x/cjs/components/image-viewer/image-viewer.js +11 -8
- package/2x/cjs/components/mask/mask.js +1 -0
- package/2x/cjs/components/number-keyboard/number-keyboard.js +15 -7
- package/2x/cjs/components/popover/popover-menu.js +3 -1
- package/2x/cjs/components/popover/popover.js +5 -5
- package/2x/cjs/components/popup/popup.js +1 -0
- package/2x/cjs/components/switch/switch.css +2 -2
- package/2x/cjs/components/tabs/tabs.d.ts +6 -0
- package/2x/cjs/components/tabs/tabs.js +14 -12
- package/2x/cjs/components/virtual-input/virtual-input.js +11 -4
- package/2x/cjs/global/global.css +2 -2
- package/2x/es/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/2x/es/components/calendar-picker/calendar-picker.js +5 -3
- package/2x/es/components/cascader/cascader.js +6 -1
- package/2x/es/components/cascader-view/cascader-view.js +4 -1
- package/2x/es/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/2x/es/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/2x/es/components/dropdown/dropdown.js +3 -1
- package/2x/es/components/image-viewer/image-viewer.d.ts +4 -0
- package/2x/es/components/image-viewer/image-viewer.js +11 -8
- package/2x/es/components/mask/mask.js +1 -0
- package/2x/es/components/number-keyboard/number-keyboard.js +15 -7
- package/2x/es/components/popover/popover-menu.js +3 -1
- package/2x/es/components/popover/popover.js +5 -5
- package/2x/es/components/popup/popup.js +1 -0
- package/2x/es/components/switch/switch.css +2 -2
- package/2x/es/components/tabs/tabs.d.ts +6 -0
- package/2x/es/components/tabs/tabs.js +14 -12
- package/2x/es/components/virtual-input/virtual-input.js +11 -4
- package/2x/es/global/global.css +2 -2
- package/2x/package.json +1 -1
- package/README.md +1 -1
- package/bundle/antd-mobile.cjs.development.js +1843 -1829
- package/bundle/antd-mobile.cjs.js +9 -9
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +1025 -1007
- package/bundle/antd-mobile.es.js +5315 -5259
- package/bundle/antd-mobile.umd.development.js +2194 -2180
- package/bundle/antd-mobile.umd.js +9 -9
- package/bundle/style.css +1 -1
- package/cjs/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/cjs/components/calendar-picker/calendar-picker.js +5 -3
- package/cjs/components/cascader/cascader.js +6 -1
- package/cjs/components/cascader-view/cascader-view.js +4 -1
- package/cjs/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/cjs/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/cjs/components/dropdown/dropdown.js +3 -1
- package/cjs/components/image-viewer/image-viewer.d.ts +4 -0
- package/cjs/components/image-viewer/image-viewer.js +11 -8
- package/cjs/components/mask/mask.js +1 -0
- package/cjs/components/number-keyboard/number-keyboard.js +15 -7
- package/cjs/components/popover/popover-menu.js +3 -1
- package/cjs/components/popover/popover.js +5 -5
- package/cjs/components/popup/popup.js +1 -0
- package/cjs/components/switch/switch.css +2 -2
- package/cjs/components/tabs/tabs.d.ts +6 -0
- package/cjs/components/tabs/tabs.js +14 -12
- package/cjs/components/virtual-input/virtual-input.js +11 -4
- package/cjs/global/global.css +2 -2
- package/es/components/calendar-picker/calendar-picker.d.ts +5 -0
- package/es/components/calendar-picker/calendar-picker.js +5 -3
- package/es/components/cascader/cascader.js +6 -1
- package/es/components/cascader-view/cascader-view.js +4 -1
- package/es/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
- package/es/components/cascader-view/use-cascader-value-extend.js +9 -5
- package/es/components/dropdown/dropdown.js +3 -1
- package/es/components/image-viewer/image-viewer.d.ts +4 -0
- package/es/components/image-viewer/image-viewer.js +11 -8
- package/es/components/mask/mask.js +1 -0
- package/es/components/number-keyboard/number-keyboard.js +15 -7
- package/es/components/popover/popover-menu.js +3 -1
- package/es/components/popover/popover.js +5 -5
- package/es/components/popup/popup.js +1 -0
- package/es/components/switch/switch.css +2 -2
- package/es/components/tabs/tabs.d.ts +6 -0
- package/es/components/tabs/tabs.js +14 -12
- package/es/components/virtual-input/virtual-input.js +11 -4
- package/es/global/global.css +2 -2
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -51,8 +51,10 @@ const Dropdown = forwardRef((p, ref) => {
|
|
|
51
51
|
const navs = React.Children.map(props.children, child => {
|
|
52
52
|
if (isValidElement(child)) {
|
|
53
53
|
const childProps = Object.assign(Object.assign({}, child.props), {
|
|
54
|
-
onClick:
|
|
54
|
+
onClick: event => {
|
|
55
|
+
var _a, _b;
|
|
55
56
|
changeActive(child.key);
|
|
57
|
+
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
56
58
|
},
|
|
57
59
|
active: child.key === value,
|
|
58
60
|
arrow: child.props.arrow === undefined ? props.arrow : child.props.arrow
|
|
@@ -10,6 +10,10 @@ export declare type ImageViewerProps = {
|
|
|
10
10
|
onClose?: () => void;
|
|
11
11
|
afterClose?: () => void;
|
|
12
12
|
renderFooter?: (image: string) => ReactNode;
|
|
13
|
+
classNames?: {
|
|
14
|
+
mask?: string;
|
|
15
|
+
body?: string;
|
|
16
|
+
};
|
|
13
17
|
};
|
|
14
18
|
export declare const ImageViewer: FC<ImageViewerProps>;
|
|
15
19
|
export declare type MultiImageViewerRef = SlidesRef;
|
|
@@ -5,6 +5,7 @@ import Mask from '../mask';
|
|
|
5
5
|
import SafeArea from '../safe-area';
|
|
6
6
|
import { Slide } from './slide';
|
|
7
7
|
import { Slides } from './slides';
|
|
8
|
+
import classNames from 'classnames';
|
|
8
9
|
const classPrefix = `adm-image-viewer`;
|
|
9
10
|
const defaultProps = {
|
|
10
11
|
maxZoom: 3,
|
|
@@ -12,23 +13,24 @@ const defaultProps = {
|
|
|
12
13
|
visible: false
|
|
13
14
|
};
|
|
14
15
|
export const ImageViewer = p => {
|
|
15
|
-
var _a;
|
|
16
|
+
var _a, _b, _c;
|
|
16
17
|
const props = mergeProps(defaultProps, p);
|
|
17
18
|
const node = React.createElement(Mask, {
|
|
18
19
|
visible: props.visible,
|
|
19
20
|
disableBodyScroll: false,
|
|
20
21
|
opacity: 'thick',
|
|
21
22
|
afterClose: props.afterClose,
|
|
22
|
-
destroyOnClose: true
|
|
23
|
+
destroyOnClose: true,
|
|
24
|
+
className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
|
|
23
25
|
}, React.createElement("div", {
|
|
24
|
-
className: `${classPrefix}-content
|
|
26
|
+
className: classNames(`${classPrefix}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
|
|
25
27
|
}, props.image && React.createElement(Slide, {
|
|
26
28
|
image: props.image,
|
|
27
29
|
onTap: props.onClose,
|
|
28
30
|
maxZoom: props.maxZoom
|
|
29
31
|
})), props.image && React.createElement("div", {
|
|
30
32
|
className: `${classPrefix}-footer`
|
|
31
|
-
}, (
|
|
33
|
+
}, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React.createElement(SafeArea, {
|
|
32
34
|
position: 'bottom'
|
|
33
35
|
})));
|
|
34
36
|
return renderToContainer(props.getContainer, node);
|
|
@@ -37,7 +39,7 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps), {
|
|
|
37
39
|
defaultIndex: 0
|
|
38
40
|
});
|
|
39
41
|
export const MultiImageViewer = forwardRef((p, ref) => {
|
|
40
|
-
var _a;
|
|
42
|
+
var _a, _b, _c;
|
|
41
43
|
const props = mergeProps(multiDefaultProps, p);
|
|
42
44
|
const [index, setIndex] = useState(props.defaultIndex);
|
|
43
45
|
const slidesRef = useRef(null);
|
|
@@ -59,9 +61,10 @@ export const MultiImageViewer = forwardRef((p, ref) => {
|
|
|
59
61
|
disableBodyScroll: false,
|
|
60
62
|
opacity: 'thick',
|
|
61
63
|
afterClose: props.afterClose,
|
|
62
|
-
destroyOnClose: true
|
|
64
|
+
destroyOnClose: true,
|
|
65
|
+
className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
|
|
63
66
|
}, React.createElement("div", {
|
|
64
|
-
className: `${classPrefix}-content
|
|
67
|
+
className: classNames(`${classPrefix}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
|
|
65
68
|
}, props.images && React.createElement(Slides, {
|
|
66
69
|
ref: slidesRef,
|
|
67
70
|
defaultIndex: index,
|
|
@@ -71,7 +74,7 @@ export const MultiImageViewer = forwardRef((p, ref) => {
|
|
|
71
74
|
maxZoom: props.maxZoom
|
|
72
75
|
})), props.images && React.createElement("div", {
|
|
73
76
|
className: `${classPrefix}-footer`
|
|
74
|
-
}, (
|
|
77
|
+
}, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index], index), React.createElement(SafeArea, {
|
|
75
78
|
position: 'bottom'
|
|
76
79
|
})));
|
|
77
80
|
return renderToContainer(props.getContainer, node);
|
|
@@ -71,6 +71,7 @@ export const Mask = p => {
|
|
|
71
71
|
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement(animated.div, {
|
|
72
72
|
className: classPrefix,
|
|
73
73
|
ref: ref,
|
|
74
|
+
"aria-hidden": true,
|
|
74
75
|
style: Object.assign(Object.assign({}, props.style), {
|
|
75
76
|
background,
|
|
76
77
|
opacity,
|
|
@@ -7,6 +7,7 @@ import Popup from '../popup';
|
|
|
7
7
|
import { withNativeProps } from '../../utils/native-props';
|
|
8
8
|
import SafeArea from '../safe-area';
|
|
9
9
|
import { useMemoizedFn } from 'ahooks';
|
|
10
|
+
import { useConfig } from '../config-provider';
|
|
10
11
|
const classPrefix = 'adm-number-keyboard';
|
|
11
12
|
const defaultProps = {
|
|
12
13
|
defaultVisible: false,
|
|
@@ -30,6 +31,9 @@ export const NumberKeyboard = p => {
|
|
|
30
31
|
showCloseButton,
|
|
31
32
|
onInput
|
|
32
33
|
} = props;
|
|
34
|
+
const {
|
|
35
|
+
locale
|
|
36
|
+
} = useConfig();
|
|
33
37
|
const keyboardRef = useRef(null);
|
|
34
38
|
const keys = useMemo(() => {
|
|
35
39
|
const defaultKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
@@ -88,7 +92,7 @@ export const NumberKeyboard = p => {
|
|
|
88
92
|
className: classNames(`${classPrefix}-header`, {
|
|
89
93
|
[`${classPrefix}-header-with-title`]: !!title
|
|
90
94
|
})
|
|
91
|
-
},
|
|
95
|
+
}, !!title && React.createElement("div", {
|
|
92
96
|
className: `${classPrefix}-title`,
|
|
93
97
|
"aria-label": title
|
|
94
98
|
}, title), showCloseButton && React.createElement("span", {
|
|
@@ -97,8 +101,8 @@ export const NumberKeyboard = p => {
|
|
|
97
101
|
var _a;
|
|
98
102
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
99
103
|
},
|
|
100
|
-
role: '
|
|
101
|
-
title:
|
|
104
|
+
role: 'button',
|
|
105
|
+
title: locale.common.close,
|
|
102
106
|
tabIndex: -1
|
|
103
107
|
}, React.createElement(DownOutline, null)));
|
|
104
108
|
};
|
|
@@ -110,7 +114,7 @@ export const NumberKeyboard = p => {
|
|
|
110
114
|
[`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
|
|
111
115
|
});
|
|
112
116
|
const ariaProps = key ? {
|
|
113
|
-
role: '
|
|
117
|
+
role: 'button',
|
|
114
118
|
title: key,
|
|
115
119
|
tabIndex: -1
|
|
116
120
|
} : undefined;
|
|
@@ -163,13 +167,17 @@ export const NumberKeyboard = p => {
|
|
|
163
167
|
onKeyPress(e, 'BACKSPACE');
|
|
164
168
|
onBackspacePressEnd();
|
|
165
169
|
},
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
onContextMenu: e => {
|
|
171
|
+
// Long press should not trigger native context menu
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
},
|
|
174
|
+
title: locale.Input.clear,
|
|
175
|
+
role: 'button',
|
|
168
176
|
tabIndex: -1
|
|
169
177
|
}, React.createElement(TextDeletionOutline, null)), React.createElement("div", {
|
|
170
178
|
className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-ok`,
|
|
171
179
|
onTouchEnd: e => onKeyPress(e, 'OK'),
|
|
172
|
-
role: '
|
|
180
|
+
role: 'button',
|
|
173
181
|
tabIndex: -1,
|
|
174
182
|
"aria-label": confirmText
|
|
175
183
|
}, confirmText))), props.safeArea && React.createElement("div", {
|
|
@@ -32,7 +32,9 @@ export const PopoverMenu = forwardRef((props, ref) => {
|
|
|
32
32
|
var _a;
|
|
33
33
|
return React.createElement("a", {
|
|
34
34
|
key: (_a = action.key) !== null && _a !== void 0 ? _a : index,
|
|
35
|
-
className: classNames(`${classPrefix}-item`, 'adm-plain-anchor',
|
|
35
|
+
className: classNames(`${classPrefix}-item`, 'adm-plain-anchor', {
|
|
36
|
+
[`${classPrefix}-item-disabled`]: action.disabled
|
|
37
|
+
}),
|
|
36
38
|
onClick: () => {
|
|
37
39
|
var _a;
|
|
38
40
|
if (action.disabled) return;
|
|
@@ -18,13 +18,11 @@ const defaultProps = {
|
|
|
18
18
|
placement: 'top',
|
|
19
19
|
defaultVisible: false,
|
|
20
20
|
stopPropagation: ['click'],
|
|
21
|
-
getContainer: () => document.body
|
|
21
|
+
getContainer: () => document.body,
|
|
22
|
+
mode: 'light'
|
|
22
23
|
};
|
|
23
24
|
export const Popover = forwardRef((p, ref) => {
|
|
24
25
|
const props = mergeProps(defaultProps, p);
|
|
25
|
-
const {
|
|
26
|
-
mode = 'light'
|
|
27
|
-
} = props;
|
|
28
26
|
const placement = normalizePlacement(props.placement);
|
|
29
27
|
const [visible, setVisible] = usePropsValue({
|
|
30
28
|
value: props.visible,
|
|
@@ -40,7 +38,9 @@ export const Popover = forwardRef((p, ref) => {
|
|
|
40
38
|
const floatingRef = useRef(null);
|
|
41
39
|
const arrowRef = useRef(null);
|
|
42
40
|
const floating = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
|
|
43
|
-
className: classNames(classPrefix, `${classPrefix}-${mode}`,
|
|
41
|
+
className: classNames(classPrefix, `${classPrefix}-${props.mode}`, {
|
|
42
|
+
[`${classPrefix}-hidden`]: !visible
|
|
43
|
+
}),
|
|
44
44
|
ref: floatingRef
|
|
45
45
|
}, React.createElement("div", {
|
|
46
46
|
className: `${classPrefix}-arrow`,
|
|
@@ -93,6 +93,7 @@ export const Popup = p => {
|
|
|
93
93
|
}), React.createElement(animated.div, {
|
|
94
94
|
className: bodyCls,
|
|
95
95
|
style: Object.assign(Object.assign({}, props.bodyStyle), {
|
|
96
|
+
pointerEvents: percent.to(v => v === 0 ? 'unset' : 'none'),
|
|
96
97
|
transform: percent.to(v => {
|
|
97
98
|
if (props.position === 'bottom') {
|
|
98
99
|
return `translate(0, ${v}%)`;
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
display: flex;
|
|
67
67
|
justify-content: center;
|
|
68
68
|
align-items: center;
|
|
69
|
-
margin: 0 8px 0 calc(var(--height) - var(--border-width) +
|
|
69
|
+
margin: 0 8px 0 calc(var(--height) - var(--border-width) + 5px);
|
|
70
70
|
height: 100%;
|
|
71
71
|
color: var(--adm-color-weak);
|
|
72
72
|
transition: margin 200ms;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
left: calc(100% - (var(--height) - var(--border-width)));
|
|
83
83
|
}
|
|
84
84
|
.adm-switch.adm-switch-checked .adm-switch-inner {
|
|
85
|
-
margin: 0 calc(var(--height) - var(--border-width) + 5px) 0
|
|
85
|
+
margin: 0 calc(var(--height) - var(--border-width) + 5px) 0 8px;
|
|
86
86
|
color: var(--adm-color-text-light-solid);
|
|
87
87
|
}
|
|
88
88
|
.adm-switch.adm-switch-disabled {
|
|
@@ -16,5 +16,11 @@ export declare type TabsProps = {
|
|
|
16
16
|
onChange?: (key: string) => void;
|
|
17
17
|
children?: ReactNode;
|
|
18
18
|
direction?: 'ltr' | 'rtl';
|
|
19
|
+
/**
|
|
20
|
+
* @experimental Support disabled auto scroll when Tabs header content change.
|
|
21
|
+
* This API name or function may change in the future.
|
|
22
|
+
* Please lock the version if you want to use it.
|
|
23
|
+
*/
|
|
24
|
+
autoScroll?: boolean;
|
|
19
25
|
} & NativeProps<'--fixed-active-line-width' | '--active-line-height' | '--active-line-border-radius' | '--title-font-size' | '--content-padding' | '--active-title-color' | '--active-line-color'>;
|
|
20
26
|
export declare const Tabs: FC<TabsProps>;
|
|
@@ -51,7 +51,7 @@ export const Tabs = p => {
|
|
|
51
51
|
const [{
|
|
52
52
|
x,
|
|
53
53
|
width
|
|
54
|
-
},
|
|
54
|
+
}, inkApi] = useSpring(() => ({
|
|
55
55
|
x: 0,
|
|
56
56
|
width: 0,
|
|
57
57
|
config: {
|
|
@@ -78,12 +78,12 @@ export const Tabs = p => {
|
|
|
78
78
|
clamp: true
|
|
79
79
|
}
|
|
80
80
|
}));
|
|
81
|
-
function animate(immediate = false) {
|
|
81
|
+
function animate(immediate = false, fromMutation = false) {
|
|
82
82
|
const container = tabListContainerRef.current;
|
|
83
83
|
if (!container) return;
|
|
84
84
|
const activeIndex = keyToIndexRecord[activeKey];
|
|
85
85
|
if (activeIndex === undefined) {
|
|
86
|
-
|
|
86
|
+
inkApi.start({
|
|
87
87
|
x: 0,
|
|
88
88
|
width: 0,
|
|
89
89
|
immediate: true
|
|
@@ -121,7 +121,7 @@ export const Tabs = p => {
|
|
|
121
121
|
const w = ['auto', 'full'].includes(props.activeLineMode) ? width : activeLineWidth;
|
|
122
122
|
x = -(containerWidth - x - w);
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
inkApi.start({
|
|
125
125
|
x,
|
|
126
126
|
width,
|
|
127
127
|
immediate
|
|
@@ -138,13 +138,15 @@ export const Tabs = p => {
|
|
|
138
138
|
} else {
|
|
139
139
|
nextScrollLeft = bound(activeTabLeft - (containerWidth - activeTabWidth) / 2, 0, maxScrollDistance);
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
if (!fromMutation || props.autoScroll !== false) {
|
|
142
|
+
scrollApi.start({
|
|
143
|
+
scrollLeft: nextScrollLeft,
|
|
144
|
+
from: {
|
|
145
|
+
scrollLeft: containerScrollLeft
|
|
146
|
+
},
|
|
147
|
+
immediate
|
|
148
|
+
});
|
|
149
|
+
}
|
|
148
150
|
}
|
|
149
151
|
useIsomorphicLayoutEffect(() => {
|
|
150
152
|
animate(!x.isAnimating);
|
|
@@ -156,7 +158,7 @@ export const Tabs = p => {
|
|
|
156
158
|
animate(!x.isAnimating);
|
|
157
159
|
}, tabListContainerRef);
|
|
158
160
|
useMutationEffect(() => {
|
|
159
|
-
animate(!x.isAnimating);
|
|
161
|
+
animate(!x.isAnimating, true);
|
|
160
162
|
}, tabListContainerRef, {
|
|
161
163
|
subtree: true,
|
|
162
164
|
childList: true,
|
|
@@ -71,9 +71,16 @@ export const VirtualInput = forwardRef((p, ref) => {
|
|
|
71
71
|
},
|
|
72
72
|
visible: hasFocus,
|
|
73
73
|
onClose: () => {
|
|
74
|
-
var _a, _b, _c;
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
var _a, _b, _c, _d;
|
|
75
|
+
const activeElement = document.activeElement;
|
|
76
|
+
// Long press makes `activeElement` to be the child of rootRef
|
|
77
|
+
// We will trigger blur on the child element instead
|
|
78
|
+
if (activeElement && ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(activeElement))) {
|
|
79
|
+
activeElement.blur();
|
|
80
|
+
} else {
|
|
81
|
+
(_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
82
|
+
}
|
|
83
|
+
(_d = (_c = keyboard.props).onClose) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
77
84
|
},
|
|
78
85
|
getContainer: null
|
|
79
86
|
});
|
|
@@ -83,7 +90,7 @@ export const VirtualInput = forwardRef((p, ref) => {
|
|
|
83
90
|
[`${classPrefix}-disabled`]: props.disabled
|
|
84
91
|
}),
|
|
85
92
|
tabIndex: props.disabled ? undefined : 0,
|
|
86
|
-
role: '
|
|
93
|
+
role: 'textbox',
|
|
87
94
|
onFocus: onFocus,
|
|
88
95
|
onBlur: onBlur,
|
|
89
96
|
onClick: props.onClick
|
package/es/global/global.css
CHANGED