antd-mobile 5.12.3 → 5.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/2x/cjs/components/action-sheet/action-sheet.css +22 -7
  2. package/2x/cjs/components/action-sheet/action-sheet.js +8 -16
  3. package/2x/cjs/components/badge/badge.d.ts +1 -1
  4. package/2x/cjs/components/badge/badge.js +3 -1
  5. package/2x/cjs/components/badge/index.d.ts +2 -4
  6. package/2x/cjs/components/badge/index.js +2 -4
  7. package/2x/cjs/components/button/button.d.ts +6 -4
  8. package/2x/cjs/components/button/button.js +5 -1
  9. package/2x/cjs/components/calendar/calendar.css +4 -0
  10. package/2x/cjs/components/calendar/calendar.d.ts +1 -0
  11. package/2x/cjs/components/calendar/calendar.js +1 -1
  12. package/2x/cjs/components/form/form-item.js +1 -4
  13. package/2x/cjs/components/image/broken-image-icon.d.ts +1 -0
  14. package/2x/cjs/components/image/broken-image-icon.js +21 -0
  15. package/2x/cjs/components/image/image-icon.d.ts +1 -0
  16. package/2x/cjs/components/image/image-icon.js +21 -0
  17. package/2x/cjs/components/image/image.css +4 -2
  18. package/2x/cjs/components/image/image.d.ts +1 -0
  19. package/2x/cjs/components/image/image.js +10 -6
  20. package/2x/cjs/components/infinite-scroll/infinite-scroll.js +8 -6
  21. package/2x/cjs/components/popover/popover.css +1 -0
  22. package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
  23. package/2x/cjs/components/search-bar/search-bar.js +3 -0
  24. package/2x/cjs/components/side-bar/side-bar.d.ts +2 -1
  25. package/2x/cjs/components/swiper/index.d.ts +1 -1
  26. package/2x/cjs/components/swiper/swiper.d.ts +1 -1
  27. package/2x/cjs/components/text-area/text-area.js +2 -1
  28. package/2x/cjs/components/toast/toast.css +1 -1
  29. package/2x/es/components/action-sheet/action-sheet.css +22 -7
  30. package/2x/es/components/action-sheet/action-sheet.js +8 -15
  31. package/2x/es/components/badge/badge.d.ts +1 -1
  32. package/2x/es/components/badge/badge.js +1 -1
  33. package/2x/es/components/badge/index.d.ts +2 -4
  34. package/2x/es/components/badge/index.js +2 -3
  35. package/2x/es/components/button/button.d.ts +6 -4
  36. package/2x/es/components/button/button.js +5 -1
  37. package/2x/es/components/calendar/calendar.css +4 -0
  38. package/2x/es/components/calendar/calendar.d.ts +1 -0
  39. package/2x/es/components/calendar/calendar.js +1 -1
  40. package/2x/es/components/form/form-item.js +1 -4
  41. package/2x/es/components/image/broken-image-icon.d.ts +1 -0
  42. package/2x/es/components/image/broken-image-icon.js +9 -0
  43. package/2x/es/components/image/image-icon.d.ts +1 -0
  44. package/2x/es/components/image/image-icon.js +9 -0
  45. package/2x/es/components/image/image.css +4 -2
  46. package/2x/es/components/image/image.d.ts +1 -0
  47. package/2x/es/components/image/image.js +8 -5
  48. package/2x/es/components/infinite-scroll/infinite-scroll.js +8 -6
  49. package/2x/es/components/popover/popover.css +1 -0
  50. package/2x/es/components/search-bar/search-bar.d.ts +1 -1
  51. package/2x/es/components/search-bar/search-bar.js +3 -0
  52. package/2x/es/components/side-bar/side-bar.d.ts +2 -1
  53. package/2x/es/components/swiper/index.d.ts +1 -1
  54. package/2x/es/components/swiper/swiper.d.ts +1 -1
  55. package/2x/es/components/text-area/text-area.js +2 -1
  56. package/2x/es/components/toast/toast.css +1 -1
  57. package/2x/package.json +4 -4
  58. package/bundle/antd-mobile.cjs.js +195 -177
  59. package/bundle/antd-mobile.es.js +197 -179
  60. package/bundle/style.css +99 -81
  61. package/cjs/components/action-sheet/action-sheet.css +19 -7
  62. package/cjs/components/action-sheet/action-sheet.js +8 -16
  63. package/cjs/components/badge/badge.d.ts +1 -1
  64. package/cjs/components/badge/badge.js +3 -1
  65. package/cjs/components/badge/index.d.ts +2 -4
  66. package/cjs/components/badge/index.js +2 -4
  67. package/cjs/components/button/button.d.ts +6 -4
  68. package/cjs/components/button/button.js +5 -1
  69. package/cjs/components/calendar/calendar.css +3 -0
  70. package/cjs/components/calendar/calendar.d.ts +1 -0
  71. package/cjs/components/calendar/calendar.js +1 -1
  72. package/cjs/components/form/form-item.js +1 -4
  73. package/cjs/components/image/broken-image-icon.d.ts +1 -0
  74. package/cjs/components/image/broken-image-icon.js +21 -0
  75. package/cjs/components/image/image-icon.d.ts +1 -0
  76. package/cjs/components/image/image-icon.js +21 -0
  77. package/cjs/components/image/image.css +4 -2
  78. package/cjs/components/image/image.d.ts +1 -0
  79. package/cjs/components/image/image.js +10 -6
  80. package/cjs/components/infinite-scroll/infinite-scroll.js +8 -6
  81. package/cjs/components/popover/popover.css +1 -0
  82. package/cjs/components/search-bar/search-bar.d.ts +1 -1
  83. package/cjs/components/search-bar/search-bar.js +3 -0
  84. package/cjs/components/side-bar/side-bar.d.ts +2 -1
  85. package/cjs/components/swiper/index.d.ts +1 -1
  86. package/cjs/components/swiper/swiper.d.ts +1 -1
  87. package/cjs/components/text-area/text-area.js +2 -1
  88. package/cjs/components/toast/toast.css +1 -1
  89. package/es/components/action-sheet/action-sheet.css +19 -7
  90. package/es/components/action-sheet/action-sheet.js +8 -15
  91. package/es/components/badge/badge.d.ts +1 -1
  92. package/es/components/badge/badge.js +1 -1
  93. package/es/components/badge/index.d.ts +2 -4
  94. package/es/components/badge/index.js +2 -3
  95. package/es/components/button/button.d.ts +6 -4
  96. package/es/components/button/button.js +5 -1
  97. package/es/components/calendar/calendar.css +3 -0
  98. package/es/components/calendar/calendar.d.ts +1 -0
  99. package/es/components/calendar/calendar.js +1 -1
  100. package/es/components/form/form-item.js +1 -4
  101. package/es/components/image/broken-image-icon.d.ts +1 -0
  102. package/es/components/image/broken-image-icon.js +9 -0
  103. package/es/components/image/image-icon.d.ts +1 -0
  104. package/es/components/image/image-icon.js +9 -0
  105. package/es/components/image/image.css +4 -2
  106. package/es/components/image/image.d.ts +1 -0
  107. package/es/components/image/image.js +8 -5
  108. package/es/components/infinite-scroll/infinite-scroll.js +8 -6
  109. package/es/components/popover/popover.css +1 -0
  110. package/es/components/search-bar/search-bar.d.ts +1 -1
  111. package/es/components/search-bar/search-bar.js +3 -0
  112. package/es/components/side-bar/side-bar.d.ts +2 -1
  113. package/es/components/swiper/index.d.ts +1 -1
  114. package/es/components/swiper/swiper.d.ts +1 -1
  115. package/es/components/text-area/text-area.js +2 -1
  116. package/es/components/toast/toast.css +1 -1
  117. package/package.json +4 -4
  118. package/umd/antd-mobile.js +1 -1
@@ -96,6 +96,9 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
96
96
 
97
97
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
98
98
  (_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
99
+ },
100
+ onMouseDown: e => {
101
+ e.preventDefault();
99
102
  }
100
103
  }, props.cancelText));
101
104
  };
@@ -1,10 +1,11 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import { BadgeProps } from '../badge';
3
4
  import { NativeProps } from '../../utils/native-props';
4
5
  export declare type SideBarItemProps = {
5
6
  title?: ReactNode;
6
7
  disabled?: boolean;
7
- badge?: ReactNode;
8
+ badge?: BadgeProps['content'];
8
9
  } & NativeProps;
9
10
  export declare const SideBarItem: FC<SideBarItemProps>;
10
11
  export declare type SideBarProps = {
@@ -16,7 +16,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
16
16
  stuckAtBoundary?: boolean | undefined;
17
17
  rubberband?: boolean | undefined;
18
18
  children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
19
- } & import("../../utils/native-props").NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
19
+ } & import("../../utils/native-props").NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
20
20
  Item: import("react").FC<{
21
21
  onClick?: ((e: import("react").MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
22
22
  children?: import("react").ReactNode;
@@ -37,4 +37,4 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
37
37
  stuckAtBoundary?: boolean | undefined;
38
38
  rubberband?: boolean | undefined;
39
39
  children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
40
- } & NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
40
+ } & NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
@@ -123,7 +123,8 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
123
123
  compositingRef.current = false;
124
124
 
125
125
  if (maxLength) {
126
- setValue([...value].slice(0, maxLength).join(''));
126
+ const v = e.target.value;
127
+ setValue([...v].slice(0, maxLength).join(''));
127
128
  }
128
129
 
129
130
  (_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
@@ -13,7 +13,7 @@
13
13
  transform: translate(-50%, -50%);
14
14
  width: auto;
15
15
  min-width: 96px;
16
- max-width: 70%;
16
+ max-width: 200px;
17
17
  max-height: 70%;
18
18
  overflow: auto;
19
19
  color: white;
@@ -8,19 +8,31 @@
8
8
  justify-content: center;
9
9
  color: var(--adm-color-weak);
10
10
  font-size: 15px;
11
- padding: 18px 16px;
11
+ padding: 18px 12px;
12
+ border-bottom: 1px solid var(--adm-border-color);
13
+ }
14
+ .adm-action-sheet-button-list {
12
15
  border-bottom: 1px solid var(--adm-border-color);
13
16
  }
14
17
  .adm-action-sheet-button-item-wrapper {
15
- background-color: #ffffff;
16
- border-top: 1px solid var(--adm-border-color);
18
+ border-bottom: 1px solid var(--adm-border-color);
17
19
  }
18
- .adm-action-sheet-button-item-wrapper:first-child {
19
- border-top: none;
20
+ .adm-action-sheet-button-item-wrapper:last-child {
21
+ border-bottom: none;
20
22
  }
21
23
  .adm-action-sheet-button-item {
22
- padding: 14px;
23
24
  text-align: center;
25
+ display: block;
26
+ background-color: #ffffff;
27
+ padding: 16px;
28
+ }
29
+ .adm-action-sheet-button-item:active {
30
+ background-color: #eeeeee;
31
+ }
32
+ .adm-action-sheet-button-item-disabled {
33
+ cursor: not-allowed;
34
+ pointer-events: none;
35
+ opacity: 0.4;
24
36
  }
25
37
  .adm-action-sheet-button-item-name {
26
38
  color: var(--adm-color-text);
@@ -29,7 +41,7 @@
29
41
  .adm-action-sheet-button-item-description {
30
42
  font-size: 12px;
31
43
  color: var(--adm-color-weak);
32
- padding-top: 4px;
44
+ padding-top: 2px;
33
45
  }
34
46
  .adm-action-sheet-button-item-danger .adm-action-sheet-button-item-name {
35
47
  color: var(--adm-color-danger);
@@ -3,7 +3,6 @@ import { withNativeProps } from '../../utils/native-props';
3
3
  import { mergeProps } from '../../utils/with-default-props';
4
4
  import classNames from 'classnames';
5
5
  import Popup from '../popup';
6
- import Button from '../button';
7
6
  import SafeArea from '../safe-area';
8
7
  import { renderImperatively } from '../../utils/render-imperatively';
9
8
  const classPrefix = `adm-action-sheet`;
@@ -41,11 +40,11 @@ export const ActionSheet = p => {
41
40
  }, props.actions.map((action, index) => React.createElement("div", {
42
41
  key: action.key,
43
42
  className: `${classPrefix}-button-item-wrapper`
44
- }, React.createElement(Button, {
45
- block: true,
46
- fill: 'none',
47
- shape: 'rectangular',
48
- disabled: action.disabled,
43
+ }, React.createElement("a", {
44
+ className: classNames('adm-plain-anchor', `${classPrefix}-button-item`, {
45
+ [`${classPrefix}-button-item-danger`]: action.danger,
46
+ [`${classPrefix}-button-item-disabled`]: action.disabled
47
+ }),
49
48
  onClick: () => {
50
49
  var _a, _b, _c;
51
50
 
@@ -55,10 +54,7 @@ export const ActionSheet = p => {
55
54
  if (props.closeOnAction) {
56
55
  (_c = props.onClose) === null || _c === void 0 ? void 0 : _c.call(props);
57
56
  }
58
- },
59
- className: classNames(`${classPrefix}-button-item`, {
60
- [`${classPrefix}-button-item-danger`]: action.danger
61
- })
57
+ }
62
58
  }, React.createElement("div", {
63
59
  className: `${classPrefix}-button-item-name`
64
60
  }, action.text), action.description && React.createElement("div", {
@@ -67,11 +63,8 @@ export const ActionSheet = p => {
67
63
  className: `${classPrefix}-cancel`
68
64
  }, React.createElement("div", {
69
65
  className: `${classPrefix}-button-item-wrapper`
70
- }, React.createElement(Button, {
71
- block: true,
72
- fill: 'none',
73
- shape: 'rectangular',
74
- className: `${classPrefix}-button-item`,
66
+ }, React.createElement("a", {
67
+ className: classNames('adm-plain-anchor', `${classPrefix}-button-item`),
75
68
  onClick: () => {
76
69
  var _a;
77
70
 
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
- export declare const dot: unique symbol;
3
+ export declare const dot: JSX.Element;
4
4
  export declare type BadgeProps = {
5
5
  content?: React.ReactNode | typeof dot;
6
6
  color?: string;
@@ -2,7 +2,7 @@ import classNames from 'classnames';
2
2
  import React from 'react';
3
3
  import { withNativeProps } from '../../utils/native-props';
4
4
  const classPrefix = `adm-badge`;
5
- export const dot = Symbol();
5
+ export const dot = React.createElement(React.Fragment, null);
6
6
  export const Badge = props => {
7
7
  const {
8
8
  content,
@@ -1,9 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import './badge.less';
3
- import { dot } from './badge';
4
3
  export type { BadgeProps } from './badge';
5
- declare type Properties = {
6
- dot: typeof dot;
4
+ declare const _default: import("react").FC<import("./badge").BadgeProps> & {
5
+ dot: JSX.Element;
7
6
  };
8
- declare const _default: import("react").FC<import("./badge").BadgeProps> & Properties;
9
7
  export default _default;
@@ -1,7 +1,6 @@
1
1
  import "./badge.css";
2
2
  import { Badge, dot } from './badge';
3
3
  import { attachPropertiesToComponent } from '../../utils/attach-properties-to-component';
4
- const properties = {
4
+ export default attachPropertiesToComponent(Badge, {
5
5
  dot
6
- };
7
- export default attachPropertiesToComponent(Badge, properties);
6
+ });
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ declare type NativeButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
3
4
  export declare type ButtonProps = {
4
5
  color?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
5
6
  fill?: 'solid' | 'outline' | 'none';
@@ -9,11 +10,11 @@ export declare type ButtonProps = {
9
10
  loadingText?: string;
10
11
  loadingIcon?: React.ReactNode;
11
12
  disabled?: boolean;
12
- onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>;
13
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void> | unknown;
13
14
  type?: 'submit' | 'reset' | 'button';
14
15
  shape?: 'default' | 'rounded' | 'rectangular';
15
16
  children?: React.ReactNode;
16
- } & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
17
+ } & Pick<NativeButtonProps, 'onMouseDown' | 'onMouseUp' | 'onTouchStart' | 'onTouchEnd'> & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
17
18
  export declare type ButtonRef = {
18
19
  nativeElement: HTMLButtonElement | null;
19
20
  };
@@ -26,8 +27,9 @@ export declare const Button: React.ForwardRefExoticComponent<{
26
27
  loadingText?: string | undefined;
27
28
  loadingIcon?: React.ReactNode;
28
29
  disabled?: boolean | undefined;
29
- onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
30
+ onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void> | unknown) | undefined;
30
31
  type?: "reset" | "submit" | "button" | undefined;
31
32
  shape?: "default" | "rounded" | "rectangular" | undefined;
32
33
  children?: React.ReactNode;
33
- } & NativeProps<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color"> & React.RefAttributes<ButtonRef>>;
34
+ } & Pick<NativeButtonProps, "onMouseDown" | "onMouseUp" | "onTouchEnd" | "onTouchStart"> & NativeProps<"--border-radius" | "--text-color" | "--background-color" | "--border-width" | "--border-style" | "--border-color"> & React.RefAttributes<ButtonRef>>;
35
+ export {};
@@ -61,7 +61,11 @@ export const Button = forwardRef((p, ref) => {
61
61
  [`${classPrefix}-large`]: props.size === 'large',
62
62
  [`${classPrefix}-loading`]: loading
63
63
  }, `${classPrefix}-shape-${props.shape}`),
64
- disabled: disabled
64
+ disabled: disabled,
65
+ onMouseDown: props.onMouseDown,
66
+ onMouseUp: props.onMouseUp,
67
+ onTouchStart: props.onTouchStart,
68
+ onTouchEnd: props.onTouchEnd
65
69
  }, loading ? React.createElement("div", {
66
70
  className: `${classPrefix}-loading-wrapper`
67
71
  }, props.loadingIcon, props.loadingText) : props.children));
@@ -71,6 +71,9 @@
71
71
  border-top-right-radius: 4px;
72
72
  border-bottom-right-radius: 4px;
73
73
  }
74
+ .adm-calendar-cell.adm-calendar-cell-disabled.adm-calendar-cell.adm-calendar-cell-selected {
75
+ color: var(--adm-color-light);
76
+ }
74
77
  .adm-calendar-cell .adm-calendar-cell-top {
75
78
  flex: none;
76
79
  font-size: 18px;
@@ -19,6 +19,7 @@ export declare type CalendarProps = {
19
19
  allowClear?: boolean;
20
20
  max?: Date;
21
21
  min?: Date;
22
+ shouldDisableDate?: (date: Date) => boolean;
22
23
  } & ({
23
24
  selectionMode?: undefined;
24
25
  value?: undefined;
@@ -125,7 +125,7 @@ export const Calendar = forwardRef((p, ref) => {
125
125
  }
126
126
 
127
127
  const inThisMonth = d.month() === current.month();
128
- const disabled = maxDay && d.isAfter(maxDay, 'day') || minDay && d.isBefore(minDay, 'day');
128
+ const disabled = props.shouldDisableDate ? props.shouldDisableDate(d.toDate()) : maxDay && d.isAfter(maxDay, 'day') || minDay && d.isBefore(minDay, 'day');
129
129
  cells.push(React.createElement("div", {
130
130
  key: d.valueOf(),
131
131
  className: classNames(`${classPrefix}-cell`, (disabled || !inThisMonth) && `${classPrefix}-cell-disabled`, inThisMonth && {
@@ -228,10 +228,7 @@ export const FormItem = props => {
228
228
  }
229
229
 
230
230
  let Variables = {};
231
-
232
- if (typeof label === 'string') {
233
- Variables.label = label;
234
- }
231
+ Variables.label = typeof label === 'string' ? label : '';
235
232
 
236
233
  if (messageVariables) {
237
234
  Variables = Object.assign(Object.assign({}, Variables), messageVariables);
@@ -0,0 +1 @@
1
+ export declare const BrokenImageIcon: () => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export const BrokenImageIcon = () => React.createElement("svg", {
3
+ viewBox: '0 0 48 48',
4
+ xmlns: 'http://www.w3.org/2000/svg'
5
+ }, React.createElement("path", {
6
+ d: 'M19.233 6.233 17.42 9.08l-10.817.001a.665.665 0 0 0-.647.562l-.007.096V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.415 2.415 0 0 1 1.807.625l.126.127 4.182 4.525 2.267-3.292 5.461 7.841-4.065 7.375H6.604c-1.86 0-3.382-1.47-3.482-3.317l-.005-.192V9.744c0-1.872 1.461-3.405 3.296-3.505l.19-.005h12.63Zm22.163 0c1.86 0 3.382 1.472 3.482 3.314l.005.192v29.14a3.507 3.507 0 0 1-3.3 3.505l-.191.006H27.789l3.63-6.587.06-.119a1.87 1.87 0 0 0-.163-1.853l-6.928-9.949 3.047-4.422a2.374 2.374 0 0 1 1.96-1.01 2.4 2.4 0 0 1 1.86.87l.106.14L42.05 34.89V9.74a.664.664 0 0 0-.654-.658H21.855l1.812-2.848h17.73Zm-28.305 5.611c.794 0 1.52.298 2.07.788l-.843 1.325-.067.114a1.87 1.87 0 0 0 .11 1.959l.848 1.217c-.556.515-1.3.83-2.118.83a3.122 3.122 0 0 1-3.117-3.116 3.119 3.119 0 0 1 3.117-3.117Z',
7
+ fill: '#DBDBDB',
8
+ fillRule: 'nonzero'
9
+ }));
@@ -0,0 +1 @@
1
+ export declare const ImageIcon: () => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export const ImageIcon = () => React.createElement("svg", {
3
+ viewBox: '0 0 48 48',
4
+ xmlns: 'http://www.w3.org/2000/svg'
5
+ }, React.createElement("path", {
6
+ d: 'M41.396 6.234c1.923 0 3.487 1.574 3.487 3.505v29.14c0 1.937-1.568 3.51-3.491 3.51H6.604c-1.923 0-3.487-1.573-3.487-3.51V9.745c0-1.936 1.564-3.51 3.487-3.51Zm0 2.847H6.604c-.355 0-.654.3-.654.658V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.405 2.405 0 0 1 1.933.752l4.182 4.525 7.58-11.005a2.374 2.374 0 0 1 1.96-1.01c.79 0 1.532.38 1.966 1.01L42.05 34.89V9.74a.664.664 0 0 0-.654-.658Zm-28.305 2.763a3.119 3.119 0 0 1 3.117 3.117 3.119 3.119 0 0 1-3.117 3.117 3.122 3.122 0 0 1-3.117-3.117 3.119 3.119 0 0 1 3.117-3.117Z',
7
+ fill: '#DBDBDB',
8
+ fillRule: 'nonzero'
9
+ }));
@@ -12,12 +12,14 @@
12
12
  }
13
13
  .adm-image-tip {
14
14
  position: relative;
15
- background-color: #f3f3f3;
15
+ background-color: #f5f5f5;
16
16
  height: 100%;
17
17
  min-height: 24px;
18
18
  min-width: 24px;
19
19
  }
20
- .adm-image-tip > .antd-mobile-icon {
20
+ .adm-image-tip > svg {
21
+ width: 24px;
22
+ height: 24px;
21
23
  position: absolute;
22
24
  left: 50%;
23
25
  top: 50%;
@@ -9,6 +9,7 @@ export declare type ImageProps = {
9
9
  placeholder?: ReactNode;
10
10
  fallback?: ReactNode;
11
11
  lazy?: boolean;
12
+ draggable?: boolean;
12
13
  onClick?: (event: React.MouseEvent<HTMLImageElement, Event>) => void;
13
14
  onError?: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
14
15
  onLoad?: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
@@ -1,21 +1,23 @@
1
1
  import { mergeProps } from '../../utils/with-default-props';
2
2
  import React, { useState, useRef } from 'react';
3
3
  import { withNativeProps } from '../../utils/native-props';
4
- import { PictureOutline, PictureWrongOutline } from 'antd-mobile-icons';
5
4
  import { staged } from 'staged-components';
6
5
  import { toCSSLength } from '../../utils/to-css-length';
7
6
  import { LazyDetector } from './lazy-detector';
8
7
  import { useIsomorphicUpdateLayoutEffect } from '../../utils/use-isomorphic-update-layout-effect';
8
+ import { ImageIcon } from './image-icon';
9
+ import { BrokenImageIcon } from './broken-image-icon';
9
10
  const classPrefix = `adm-image`;
10
11
  const defaultProps = {
11
12
  fit: 'fill',
12
13
  placeholder: React.createElement("div", {
13
14
  className: `${classPrefix}-tip`
14
- }, React.createElement(PictureOutline, null)),
15
+ }, React.createElement(ImageIcon, null)),
15
16
  fallback: React.createElement("div", {
16
17
  className: `${classPrefix}-tip`
17
- }, React.createElement(PictureWrongOutline, null)),
18
- lazy: false
18
+ }, React.createElement(BrokenImageIcon, null)),
19
+ lazy: false,
20
+ draggable: false
19
21
  };
20
22
  export const Image = staged(p => {
21
23
  const props = mergeProps(defaultProps, p);
@@ -64,7 +66,8 @@ export const Image = staged(p => {
64
66
  referrerPolicy: props.referrerPolicy,
65
67
  sizes: props.sizes,
66
68
  srcSet: srcSet,
67
- useMap: props.useMap
69
+ useMap: props.useMap,
70
+ draggable: props.draggable
68
71
  });
69
72
  return React.createElement(React.Fragment, null, !loaded && props.placeholder, img);
70
73
  }
@@ -27,9 +27,11 @@ export const InfiniteScroll = p => {
27
27
  threshold: 250
28
28
  }, p);
29
29
  const doLoadMore = useLockFn(() => props.loadMore());
30
- const elementRef = useRef(null);
30
+ const elementRef = useRef(null); // Prevent duplicated trigger of `check` function
31
+
31
32
  const [flag, setFlag] = useState({});
32
33
  const nextFlagRef = useRef(flag);
34
+ const [scrollParent, setScrollParent] = useState();
33
35
  const check = useMemoizedFn(() => __awaiter(void 0, void 0, void 0, function* () {
34
36
  if (nextFlagRef.current !== flag) return;
35
37
  if (!props.hasMore) return;
@@ -37,6 +39,7 @@ export const InfiniteScroll = p => {
37
39
  if (!element) return;
38
40
  if (!element.offsetParent) return;
39
41
  const parent = getScrollParent(element);
42
+ setScrollParent(parent);
40
43
  if (!parent) return;
41
44
  const rect = element.getBoundingClientRect();
42
45
  const elementTop = rect.top;
@@ -56,18 +59,17 @@ export const InfiniteScroll = p => {
56
59
  useEffect(() => {
57
60
  const element = elementRef.current;
58
61
  if (!element) return;
59
- const parent = getScrollParent(element);
60
- if (!parent) return;
62
+ if (!scrollParent) return;
61
63
 
62
64
  function onScroll() {
63
65
  check();
64
66
  }
65
67
 
66
- parent.addEventListener('scroll', onScroll);
68
+ scrollParent.addEventListener('scroll', onScroll);
67
69
  return () => {
68
- parent.removeEventListener('scroll', onScroll);
70
+ scrollParent.removeEventListener('scroll', onScroll);
69
71
  };
70
- }, []);
72
+ }, [scrollParent]);
71
73
  return withNativeProps(props, React.createElement("div", {
72
74
  className: classPrefix,
73
75
  ref: elementRef
@@ -35,6 +35,7 @@
35
35
  border-radius: 8px;
36
36
  box-shadow: 0 0 30px 0 rgba(51, 51, 51, 0.2);
37
37
  font-size: 15px;
38
+ width: max-content;
38
39
  min-width: 32px;
39
40
  max-width: calc(100vw - 24px);
40
41
  overflow-y: hidden;
@@ -31,4 +31,4 @@ export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps,
31
31
  onSearch?: ((val: string) => void) | undefined;
32
32
  onChange?: ((val: string) => void) | undefined;
33
33
  onCancel?: (() => void) | undefined;
34
- } & NativeProps<"--border-radius" | "--height" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
34
+ } & NativeProps<"--height" | "--border-radius" | "--padding-left" | "--background" | "--placeholder-color"> & React.RefAttributes<InputRef>>;
@@ -74,6 +74,9 @@ export const SearchBar = forwardRef((p, ref) => {
74
74
 
75
75
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
76
76
  (_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
77
+ },
78
+ onMouseDown: e => {
79
+ e.preventDefault();
77
80
  }
78
81
  }, props.cancelText));
79
82
  };
@@ -1,10 +1,11 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import { BadgeProps } from '../badge';
3
4
  import { NativeProps } from '../../utils/native-props';
4
5
  export declare type SideBarItemProps = {
5
6
  title?: ReactNode;
6
7
  disabled?: boolean;
7
- badge?: ReactNode;
8
+ badge?: BadgeProps['content'];
8
9
  } & NativeProps;
9
10
  export declare const SideBarItem: FC<SideBarItemProps>;
10
11
  export declare type SideBarProps = {
@@ -16,7 +16,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
16
16
  stuckAtBoundary?: boolean | undefined;
17
17
  rubberband?: boolean | undefined;
18
18
  children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
19
- } & import("../../utils/native-props").NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
19
+ } & import("../../utils/native-props").NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
20
20
  Item: import("react").FC<{
21
21
  onClick?: ((e: import("react").MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
22
22
  children?: import("react").ReactNode;
@@ -37,4 +37,4 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
37
37
  stuckAtBoundary?: boolean | undefined;
38
38
  rubberband?: boolean | undefined;
39
39
  children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
40
- } & NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
40
+ } & NativeProps<"--width" | "--height" | "--border-radius" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
@@ -106,7 +106,8 @@ export const TextArea = forwardRef((p, ref) => {
106
106
  compositingRef.current = false;
107
107
 
108
108
  if (maxLength) {
109
- setValue([...value].slice(0, maxLength).join(''));
109
+ const v = e.target.value;
110
+ setValue([...v].slice(0, maxLength).join(''));
110
111
  }
111
112
 
112
113
  (_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
@@ -13,7 +13,7 @@
13
13
  transform: translate(-50%, -50%);
14
14
  width: auto;
15
15
  min-width: 96px;
16
- max-width: 70%;
16
+ max-width: 200px;
17
17
  max-height: 70%;
18
18
  overflow: auto;
19
19
  color: white;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.12.3",
3
+ "version": "5.12.6",
4
4
  "dependencies": {
5
- "@floating-ui/dom": "^0.4.5",
5
+ "@floating-ui/dom": "^0.5.1",
6
6
  "@react-spring/web": "^9.4.5",
7
7
  "@use-gesture/react": "10.2.12",
8
- "ahooks": "^3.3.10",
8
+ "ahooks": "^3.3.12",
9
9
  "antd-mobile-icons": "^0.2.2",
10
10
  "antd-mobile-v5-count": "^1.0.1",
11
11
  "big.js": "^6.1.1",
@@ -15,7 +15,7 @@
15
15
  "rc-field-form": "^1.26.4",
16
16
  "react-is": "^17.0.2",
17
17
  "staged-components": "^1.1.2",
18
- "tslib": "^2.3.1"
18
+ "tslib": "^2.4.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"