antd-mobile 5.7.2 → 5.8.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.
Files changed (139) hide show
  1. package/2x/cjs/components/dialog/dialog.js +2 -2
  2. package/2x/cjs/components/form/form-array.d.ts +1 -0
  3. package/2x/cjs/components/form/form-array.js +1 -1
  4. package/2x/cjs/components/form/form-item.d.ts +1 -1
  5. package/2x/cjs/components/image-uploader/image-uploader.js +2 -1
  6. package/2x/cjs/components/input/input.d.ts +3 -2
  7. package/2x/cjs/components/input/input.js +6 -0
  8. package/2x/cjs/components/modal/modal.js +2 -2
  9. package/2x/cjs/components/popover/popover.js +6 -7
  10. package/2x/cjs/components/search-bar/search-bar.js +7 -0
  11. package/2x/cjs/components/slider/slider.css +2 -0
  12. package/2x/cjs/components/slider/slider.d.ts +2 -1
  13. package/2x/cjs/components/slider/slider.js +3 -1
  14. package/2x/cjs/components/slider/thumb.d.ts +2 -1
  15. package/2x/cjs/components/slider/thumb.js +3 -2
  16. package/2x/cjs/components/text-area/text-area.d.ts +2 -2
  17. package/2x/cjs/components/text-area/text-area.js +1 -0
  18. package/2x/cjs/locales/base.d.ts +1 -0
  19. package/2x/cjs/locales/base.js +1 -0
  20. package/2x/cjs/locales/en-US.d.ts +1 -0
  21. package/2x/cjs/locales/es-ES.d.ts +102 -0
  22. package/2x/cjs/locales/es-ES.js +115 -0
  23. package/2x/cjs/locales/fa-IR.d.ts +1 -0
  24. package/2x/cjs/locales/fa-IR.js +1 -0
  25. package/2x/cjs/locales/zh-CN.d.ts +1 -0
  26. package/2x/cjs/locales/zh-CN.js +1 -0
  27. package/2x/cjs/locales/zh-HK.d.ts +1 -0
  28. package/2x/cjs/locales/zh-HK.js +1 -0
  29. package/2x/cjs/locales/zh-TW.d.ts +1 -0
  30. package/2x/cjs/locales/zh-TW.js +1 -0
  31. package/2x/cjs/utils/measure-css-length.d.ts +1 -1
  32. package/2x/cjs/utils/measure-css-length.js +8 -0
  33. package/2x/es/components/dialog/dialog.js +2 -2
  34. package/2x/es/components/form/form-array.d.ts +1 -0
  35. package/2x/es/components/form/form-array.js +1 -1
  36. package/2x/es/components/form/form-item.d.ts +1 -1
  37. package/2x/es/components/image-uploader/image-uploader.js +2 -1
  38. package/2x/es/components/input/input.d.ts +3 -2
  39. package/2x/es/components/input/input.js +6 -0
  40. package/2x/es/components/modal/modal.js +2 -2
  41. package/2x/es/components/popover/popover.js +1 -2
  42. package/2x/es/components/search-bar/search-bar.js +7 -0
  43. package/2x/es/components/slider/slider.css +2 -0
  44. package/2x/es/components/slider/slider.d.ts +2 -1
  45. package/2x/es/components/slider/slider.js +3 -1
  46. package/2x/es/components/slider/thumb.d.ts +2 -1
  47. package/2x/es/components/slider/thumb.js +3 -2
  48. package/2x/es/components/text-area/text-area.d.ts +2 -2
  49. package/2x/es/components/text-area/text-area.js +1 -0
  50. package/2x/es/locales/base.d.ts +1 -0
  51. package/2x/es/locales/base.js +1 -0
  52. package/2x/es/locales/en-US.d.ts +1 -0
  53. package/2x/es/locales/es-ES.d.ts +102 -0
  54. package/2x/es/locales/es-ES.js +105 -0
  55. package/2x/es/locales/fa-IR.d.ts +1 -0
  56. package/2x/es/locales/fa-IR.js +1 -0
  57. package/2x/es/locales/zh-CN.d.ts +1 -0
  58. package/2x/es/locales/zh-CN.js +1 -0
  59. package/2x/es/locales/zh-HK.d.ts +1 -0
  60. package/2x/es/locales/zh-HK.js +1 -0
  61. package/2x/es/locales/zh-TW.d.ts +1 -0
  62. package/2x/es/locales/zh-TW.js +1 -0
  63. package/2x/es/utils/measure-css-length.d.ts +1 -1
  64. package/2x/es/utils/measure-css-length.js +8 -0
  65. package/2x/package.json +8 -8
  66. package/cjs/components/dialog/dialog.js +2 -2
  67. package/cjs/components/form/form-array.d.ts +1 -0
  68. package/cjs/components/form/form-array.js +1 -1
  69. package/cjs/components/form/form-item.d.ts +1 -1
  70. package/cjs/components/image-uploader/image-uploader.js +2 -1
  71. package/cjs/components/input/input.d.ts +3 -2
  72. package/cjs/components/input/input.js +6 -0
  73. package/cjs/components/modal/modal.js +2 -2
  74. package/cjs/components/popover/popover.js +6 -7
  75. package/cjs/components/search-bar/search-bar.js +7 -0
  76. package/cjs/components/slider/slider.css +2 -0
  77. package/cjs/components/slider/slider.d.ts +2 -1
  78. package/cjs/components/slider/slider.js +3 -1
  79. package/cjs/components/slider/thumb.d.ts +2 -1
  80. package/cjs/components/slider/thumb.js +3 -2
  81. package/cjs/components/text-area/text-area.d.ts +2 -2
  82. package/cjs/components/text-area/text-area.js +1 -0
  83. package/cjs/locales/base.d.ts +1 -0
  84. package/cjs/locales/base.js +1 -0
  85. package/cjs/locales/en-US.d.ts +1 -0
  86. package/cjs/locales/es-ES.d.ts +102 -0
  87. package/cjs/locales/es-ES.js +115 -0
  88. package/cjs/locales/fa-IR.d.ts +1 -0
  89. package/cjs/locales/fa-IR.js +1 -0
  90. package/cjs/locales/zh-CN.d.ts +1 -0
  91. package/cjs/locales/zh-CN.js +1 -0
  92. package/cjs/locales/zh-HK.d.ts +1 -0
  93. package/cjs/locales/zh-HK.js +1 -0
  94. package/cjs/locales/zh-TW.d.ts +1 -0
  95. package/cjs/locales/zh-TW.js +1 -0
  96. package/cjs/utils/measure-css-length.d.ts +1 -1
  97. package/cjs/utils/measure-css-length.js +8 -0
  98. package/es/components/dialog/dialog.js +2 -2
  99. package/es/components/form/form-array.d.ts +1 -0
  100. package/es/components/form/form-array.js +1 -1
  101. package/es/components/form/form-item.d.ts +1 -1
  102. package/es/components/image-uploader/image-uploader.js +2 -1
  103. package/es/components/input/input.d.ts +3 -2
  104. package/es/components/input/input.js +6 -0
  105. package/es/components/modal/modal.js +2 -2
  106. package/es/components/popover/popover.js +1 -2
  107. package/es/components/search-bar/search-bar.js +7 -0
  108. package/es/components/slider/slider.css +2 -0
  109. package/es/components/slider/slider.d.ts +2 -1
  110. package/es/components/slider/slider.js +3 -1
  111. package/es/components/slider/thumb.d.ts +2 -1
  112. package/es/components/slider/thumb.js +3 -2
  113. package/es/components/text-area/text-area.d.ts +2 -2
  114. package/es/components/text-area/text-area.js +1 -0
  115. package/es/locales/base.d.ts +1 -0
  116. package/es/locales/base.js +1 -0
  117. package/es/locales/en-US.d.ts +1 -0
  118. package/es/locales/es-ES.d.ts +102 -0
  119. package/es/locales/es-ES.js +105 -0
  120. package/es/locales/fa-IR.d.ts +1 -0
  121. package/es/locales/fa-IR.js +1 -0
  122. package/es/locales/zh-CN.d.ts +1 -0
  123. package/es/locales/zh-CN.js +1 -0
  124. package/es/locales/zh-HK.d.ts +1 -0
  125. package/es/locales/zh-HK.js +1 -0
  126. package/es/locales/zh-TW.d.ts +1 -0
  127. package/es/locales/zh-TW.js +1 -0
  128. package/es/utils/measure-css-length.d.ts +1 -1
  129. package/es/utils/measure-css-length.js +8 -0
  130. package/package.json +8 -8
  131. package/umd/antd-mobile.js +1 -1
  132. package/2x/cjs/components/popover/temp-floating-ui.min.d.ts +0 -1
  133. package/2x/cjs/components/popover/temp-floating-ui.min.js +0 -1
  134. package/2x/es/components/popover/temp-floating-ui.min.d.ts +0 -1
  135. package/2x/es/components/popover/temp-floating-ui.min.js +0 -1
  136. package/cjs/components/popover/temp-floating-ui.min.d.ts +0 -1
  137. package/cjs/components/popover/temp-floating-ui.min.js +0 -1
  138. package/es/components/popover/temp-floating-ui.min.d.ts +0 -1
  139. package/es/components/popover/temp-floating-ui.min.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4
- export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
4
+ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
5
5
  value?: string;
6
6
  defaultValue?: string;
7
7
  onChange?: (val: string) => void;
@@ -20,8 +20,9 @@ export declare type InputRef = {
20
20
  clear: () => void;
21
21
  focus: () => void;
22
22
  blur: () => void;
23
+ nativeElement: HTMLInputElement | null;
23
24
  };
24
- export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
25
+ export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "autoFocus" | "maxLength" | "minLength"> & {
25
26
  value?: string | undefined;
26
27
  defaultValue?: string | undefined;
27
28
  onChange?: ((val: string) => void) | undefined;
@@ -28,7 +28,12 @@ export const Input = forwardRef((p, ref) => {
28
28
  var _a;
29
29
 
30
30
  (_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
31
+ },
32
+
33
+ get nativeElement() {
34
+ return nativeInputRef.current;
31
35
  }
36
+
32
37
  }));
33
38
 
34
39
  const handleKeydown = e => {
@@ -96,6 +101,7 @@ export const Input = forwardRef((p, ref) => {
96
101
  max: props.max,
97
102
  min: props.min,
98
103
  autoComplete: props.autoComplete,
104
+ autoFocus: props.autoFocus,
99
105
  pattern: props.pattern,
100
106
  inputMode: props.inputMode,
101
107
  type: props.type,
@@ -29,9 +29,9 @@ export const Modal = p => {
29
29
  scale: props.visible ? 1 : 0.8,
30
30
  opacity: props.visible ? 1 : 0,
31
31
  config: {
32
- mass: 1,
32
+ mass: 1.2,
33
33
  tension: 200,
34
- friction: 30,
34
+ friction: 25,
35
35
  clamp: true
36
36
  },
37
37
  onStart: () => {
@@ -7,7 +7,7 @@ import { withNativeProps } from '../../utils/native-props';
7
7
  import { withStopPropagation } from '../../utils/with-stop-propagation';
8
8
  import { Arrow } from './arrow';
9
9
  import { renderToContainer } from '../../utils/render-to-container';
10
- import { arrow, computePosition, flip, offset, autoUpdate, hide, shift, limitShift } from './temp-floating-ui.min.js';
10
+ import { arrow, computePosition, flip, offset, autoUpdate, hide, shift, limitShift } from '@floating-ui/dom';
11
11
  import { Wrapper } from './wrapper';
12
12
  import { useShouldRender } from '../../utils/should-render';
13
13
  import { useClickAway, useIsomorphicLayoutEffect } from 'ahooks';
@@ -121,7 +121,6 @@ export const Popover = forwardRef((p, ref) => {
121
121
  if (!props.trigger) return;
122
122
 
123
123
  function handleClick() {
124
- console.log('handleClick');
125
124
  setVisible(v => !v);
126
125
  }
127
126
 
@@ -40,7 +40,14 @@ export const SearchBar = forwardRef((p, ref) => {
40
40
  var _a;
41
41
 
42
42
  return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
43
+ },
44
+
45
+ get nativeElement() {
46
+ var _a, _b;
47
+
48
+ return (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.nativeElement) !== null && _b !== void 0 ? _b : null;
43
49
  }
50
+
44
51
  }));
45
52
 
46
53
  const renderCancelButton = () => {
@@ -50,6 +50,8 @@
50
50
  height: 44px;
51
51
  margin: 10px;
52
52
  border-radius: 50%;
53
+ text-align: center;
54
+ line-height: 44px;
53
55
  background: var(--adm-color-white);
54
56
  box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.12), 0 3px 6px -4px rgba(0, 0, 0, 0.25);
55
57
  }
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  import { SliderMarks } from './marks';
4
4
  export declare type SliderValue = number | [number, number];
@@ -12,6 +12,7 @@ export declare type SliderProps = {
12
12
  ticks?: boolean;
13
13
  disabled?: boolean;
14
14
  range?: boolean;
15
+ icon?: React.ReactNode;
15
16
  onChange?: (value: SliderValue) => void;
16
17
  onAfterChange?: (value: SliderValue) => void;
17
18
  } & NativeProps<'--fill-color'>;
@@ -26,7 +26,8 @@ export const Slider = p => {
26
26
  disabled,
27
27
  marks,
28
28
  ticks,
29
- step
29
+ step,
30
+ icon
30
31
  } = props;
31
32
 
32
33
  function sortValue(val) {
@@ -126,6 +127,7 @@ export const Slider = p => {
126
127
 
127
128
  const renderThumb = index => {
128
129
  return React.createElement(Thumb, {
130
+ icon: icon,
129
131
  key: index,
130
132
  value: sliderValue[index],
131
133
  min: min,
@@ -1,4 +1,4 @@
1
- import { FC, RefObject } from 'react';
1
+ import React, { FC, RefObject } from 'react';
2
2
  declare type ThumbProps = {
3
3
  value: number;
4
4
  min: number;
@@ -6,6 +6,7 @@ declare type ThumbProps = {
6
6
  disabled: boolean;
7
7
  onDrag: (value: number, first: boolean, last: boolean) => void;
8
8
  trackRef: RefObject<HTMLDivElement>;
9
+ icon?: React.ReactNode;
9
10
  };
10
11
  declare const Thumb: FC<ThumbProps>;
11
12
  export default Thumb;
@@ -9,7 +9,8 @@ const Thumb = props => {
9
9
  min,
10
10
  max,
11
11
  disabled,
12
- onDrag
12
+ onDrag,
13
+ icon
13
14
  } = props;
14
15
  const prevValue = useRef(value);
15
16
 
@@ -45,7 +46,7 @@ const Thumb = props => {
45
46
  style: currentPosition()
46
47
  }, bind()), React.createElement("div", {
47
48
  className: `${classPrefix}-thumb`
48
- }, React.createElement(ThumbIcon, {
49
+ }, icon ? icon : React.createElement(ThumbIcon, {
49
50
  className: `${classPrefix}-thumb-icon`
50
51
  })));
51
52
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ReactNode } from 'react';
3
3
  import { NativeProps } from '../../utils/native-props';
4
- export declare type TextAreaProps = Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'autoComplete' | 'disabled' | 'readOnly' | 'onFocus' | 'onBlur' | 'onCompositionStart' | 'onCompositionEnd'> & {
4
+ export declare type TextAreaProps = Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'autoComplete' | 'autoFocus' | 'disabled' | 'readOnly' | 'onFocus' | 'onBlur' | 'onCompositionStart' | 'onCompositionEnd'> & {
5
5
  onChange?: (val: string) => void;
6
6
  value?: string;
7
7
  defaultValue?: string;
@@ -20,7 +20,7 @@ export declare type TextAreaRef = {
20
20
  focus: () => void;
21
21
  blur: () => void;
22
22
  };
23
- export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoComplete" | "readOnly"> & {
23
+ export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoComplete" | "autoFocus" | "readOnly"> & {
24
24
  onChange?: ((val: string) => void) | undefined;
25
25
  value?: string | undefined;
26
26
  defaultValue?: string | undefined;
@@ -111,6 +111,7 @@ export const TextArea = forwardRef((p, ref) => {
111
111
  (_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
112
112
  },
113
113
  autoComplete: props.autoComplete,
114
+ autoFocus: props.autoFocus,
114
115
  disabled: props.disabled,
115
116
  readOnly: props.readOnly,
116
117
  onFocus: props.onFocus,
@@ -1,4 +1,5 @@
1
1
  export declare const base: {
2
+ locale: string;
2
3
  common: {
3
4
  confirm: string;
4
5
  cancel: string;
@@ -1,5 +1,6 @@
1
1
  const typeTemplate = '${label} is not a valid ${type}';
2
2
  export const base = {
3
+ locale: 'en',
3
4
  common: {
4
5
  confirm: 'Confirm',
5
6
  cancel: 'Cancel',
@@ -1,4 +1,5 @@
1
1
  declare const enUS: {
2
+ locale: string;
2
3
  common: {
3
4
  confirm: string;
4
5
  cancel: string;
@@ -0,0 +1,102 @@
1
+ declare const esES: {
2
+ locale: string;
3
+ common: {
4
+ confirm: string;
5
+ cancel: string;
6
+ loading: string;
7
+ };
8
+ Calendar: {
9
+ markItems: string[];
10
+ renderYearAndMonth: (year: number, month: number) => string;
11
+ };
12
+ Cascader: {
13
+ placeholder: string;
14
+ };
15
+ Dialog: {
16
+ ok: string;
17
+ };
18
+ ErrorBlock: {
19
+ default: {
20
+ title: string;
21
+ description: string;
22
+ };
23
+ busy: {
24
+ title: string;
25
+ description: string;
26
+ };
27
+ disconnected: {
28
+ title: string;
29
+ description: string;
30
+ };
31
+ empty: {
32
+ title: string;
33
+ description: string;
34
+ };
35
+ };
36
+ Form: {
37
+ required: string;
38
+ optional: string;
39
+ defaultValidateMessages: {
40
+ default: string;
41
+ required: string;
42
+ enum: string;
43
+ whitespace: string;
44
+ date: {
45
+ format: string;
46
+ parse: string;
47
+ invalid: string;
48
+ };
49
+ types: {
50
+ string: string;
51
+ method: string;
52
+ array: string;
53
+ object: string;
54
+ number: string;
55
+ date: string;
56
+ boolean: string;
57
+ integer: string;
58
+ float: string;
59
+ regexp: string;
60
+ email: string;
61
+ url: string;
62
+ hex: string;
63
+ };
64
+ string: {
65
+ len: string;
66
+ min: string;
67
+ max: string;
68
+ range: string;
69
+ };
70
+ number: {
71
+ len: string;
72
+ min: string;
73
+ max: string;
74
+ range: string;
75
+ };
76
+ array: {
77
+ len: string;
78
+ min: string;
79
+ max: string;
80
+ range: string;
81
+ };
82
+ pattern: {
83
+ mismatch: string;
84
+ };
85
+ };
86
+ };
87
+ ImageUploader: {
88
+ uploading: string;
89
+ };
90
+ Mask: {
91
+ name: string;
92
+ };
93
+ Modal: {
94
+ ok: string;
95
+ };
96
+ PullToRefresh: {
97
+ pulling: string;
98
+ canRelease: string;
99
+ complete: string;
100
+ };
101
+ };
102
+ export default esES;
@@ -0,0 +1,105 @@
1
+ import { mergeLocale } from '../utils/merge-locale';
2
+ import { base } from './base';
3
+ const typeTemplate = '${label} no es un ${type} válido';
4
+ const esES = mergeLocale(base, {
5
+ locale: 'es',
6
+ common: {
7
+ confirm: 'Confirmar',
8
+ cancel: 'Cancelar',
9
+ loading: 'Cargando...'
10
+ },
11
+ Calendar: {
12
+ markItems: ['Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab', 'Dom'],
13
+ renderYearAndMonth: (year, month) => `${year}/${month}`
14
+ },
15
+ Cascader: {
16
+ placeholder: 'Seleccionando'
17
+ },
18
+ Dialog: {
19
+ ok: 'OK'
20
+ },
21
+ ErrorBlock: {
22
+ default: {
23
+ title: 'Oops, algo salió mal',
24
+ description: 'Por favor espere un minuto e intente nuevamente'
25
+ },
26
+ busy: {
27
+ title: 'Oops, no está cargando',
28
+ description: 'Intente refrescar la página'
29
+ },
30
+ disconnected: {
31
+ title: 'La red se encuentra ocupada',
32
+ description: 'Intente refrescar la página'
33
+ },
34
+ empty: {
35
+ title: "Hmm, no pudimos encontrar eso...",
36
+ description: 'Quieres intentar una nueva búsqueda?'
37
+ }
38
+ },
39
+ Form: {
40
+ required: 'Requerido',
41
+ optional: 'Opcional',
42
+ defaultValidateMessages: {
43
+ default: 'Error de validación para el campo ${label}',
44
+ required: 'Por favor ingrese ${label}',
45
+ enum: '${label} debe ser uno de los siguientes [${enum}]',
46
+ whitespace: '${label} no puede ser un caracter en blanco',
47
+ date: {
48
+ format: '${label} el formato de fecha es inválido',
49
+ parse: '${label} no puede ser convertido a fecha',
50
+ invalid: '${label} no es una fecha válida'
51
+ },
52
+ types: {
53
+ string: typeTemplate,
54
+ method: typeTemplate,
55
+ array: typeTemplate,
56
+ object: typeTemplate,
57
+ number: typeTemplate,
58
+ date: typeTemplate,
59
+ boolean: typeTemplate,
60
+ integer: typeTemplate,
61
+ float: typeTemplate,
62
+ regexp: typeTemplate,
63
+ email: typeTemplate,
64
+ url: typeTemplate,
65
+ hex: typeTemplate
66
+ },
67
+ string: {
68
+ len: '${label} debe tener ${len} caracteres',
69
+ min: '${label} debe tener al menos ${min} caracteres',
70
+ max: '${label} debe tener como mucho ${max} caracteres',
71
+ range: '${label} debe tener entre ${min}-${max} caracteres'
72
+ },
73
+ number: {
74
+ len: '${label} debe ser igual a ${len}',
75
+ min: '${label} debe ser mínimo ${min}',
76
+ max: '${label} debe ser máximo ${max}',
77
+ range: '${label} debe ser entre ${min}-${max}'
78
+ },
79
+ array: {
80
+ len: 'Debe ser ${len} ${label}',
81
+ min: 'Al menos ${min} ${label}',
82
+ max: 'Como mucho ${max} ${label}',
83
+ range: 'La cantidad de ${label} debe ser entre ${min}-${max}'
84
+ },
85
+ pattern: {
86
+ mismatch: '${label} no coincide con el patrón ${pattern}'
87
+ }
88
+ }
89
+ },
90
+ ImageUploader: {
91
+ uploading: 'Subiendo...'
92
+ },
93
+ Mask: {
94
+ name: 'Máscara'
95
+ },
96
+ Modal: {
97
+ ok: 'OK'
98
+ },
99
+ PullToRefresh: {
100
+ pulling: 'Desplácese hacia abajo para refrescar',
101
+ canRelease: 'Suelte para refrescar inmediatamente',
102
+ complete: 'Refrescó exitosamente'
103
+ }
104
+ });
105
+ export default esES;
@@ -1,4 +1,5 @@
1
1
  declare const faIR: {
2
+ locale: string;
2
3
  common: {
3
4
  confirm: string;
4
5
  cancel: string;
@@ -2,6 +2,7 @@ import { mergeLocale } from '../utils/merge-locale';
2
2
  import { base } from './base';
3
3
  const typeTemplate = '${label} یک ${type} معتبر نیست';
4
4
  const faIR = mergeLocale(base, {
5
+ locale: 'fa-IR',
5
6
  common: {
6
7
  confirm: 'تایید',
7
8
  cancel: 'لغو'
@@ -1,4 +1,5 @@
1
1
  declare const zhCN: {
2
+ locale: string;
2
3
  common: {
3
4
  confirm: string;
4
5
  cancel: string;
@@ -2,6 +2,7 @@ import { mergeLocale } from '../utils/merge-locale';
2
2
  import { base } from './base';
3
3
  const typeTemplate = '${label}不是一个有效的${type}';
4
4
  const zhCN = mergeLocale(base, {
5
+ locale: 'zh-CH',
5
6
  common: {
6
7
  confirm: '确定',
7
8
  cancel: '取消',
@@ -1,4 +1,5 @@
1
1
  declare const zhHK: {
2
+ locale: string;
2
3
  common: {
3
4
  confirm: string;
4
5
  cancel: string;
@@ -1,6 +1,7 @@
1
1
  import { mergeLocale } from '../utils/merge-locale';
2
2
  import { base } from './base';
3
3
  const zhHK = mergeLocale(base, {
4
+ locale: 'zh-HK',
4
5
  common: {
5
6
  confirm: '確定',
6
7
  cancel: '取消',
@@ -1,4 +1,5 @@
1
1
  declare const zhTW: {
2
+ locale: string;
2
3
  common: {
3
4
  confirm: string;
4
5
  cancel: string;
@@ -1,6 +1,7 @@
1
1
  import { mergeLocale } from '../utils/merge-locale';
2
2
  import { base } from './base';
3
3
  const zhTW = mergeLocale(base, {
4
+ locale: 'zh-TW',
4
5
  common: {
5
6
  confirm: '確定',
6
7
  cancel: '取消',
@@ -1 +1 @@
1
- export declare function measureCSSLength(raw: string): number;
1
+ export declare function measureCSSLength(raw: string | undefined | null): number;
@@ -1,6 +1,14 @@
1
1
  import { isDev } from './is-dev';
2
2
  import { devError } from './dev-log';
3
3
  export function measureCSSLength(raw) {
4
+ if (raw === null || raw === undefined) {
5
+ if (isDev) {
6
+ devError('Global', 'Seems like the you will encounter a style messed problem. Please check the browser environment to make sure it supports CSS variables.');
7
+ }
8
+
9
+ return 0;
10
+ }
11
+
4
12
  const withUnit = raw.trim();
5
13
 
6
14
  if (withUnit.endsWith('px')) {
package/2x/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.7.2",
3
+ "version": "5.8.2",
4
4
  "dependencies": {
5
- "@floating-ui/dom": "^0.3.1",
6
- "@react-spring/web": "^9.4.3",
5
+ "@floating-ui/dom": "^0.4.1",
6
+ "@react-spring/web": "^9.4.4",
7
7
  "@types/resize-observer-browser": "^0.1.7",
8
- "@use-gesture/react": "^10.2.7",
9
- "ahooks": "^3.1.10",
8
+ "@use-gesture/react": "^10.2.10",
9
+ "ahooks": "^3.1.14",
10
10
  "antd-mobile-icons": "^0.2.2",
11
11
  "antd-mobile-v5-count": "^1.0.1",
12
12
  "classnames": "^2.3.1",
13
- "dayjs": "^1.10.8",
13
+ "dayjs": "^1.11.0",
14
14
  "lodash": "^4.17.21",
15
- "rc-field-form": "^1.23.1",
15
+ "rc-field-form": "^1.24.0",
16
16
  "staged-components": "^1.1.2",
17
17
  "tslib": "^2.3.1"
18
18
  },
@@ -39,5 +39,5 @@
39
39
  "branch": "master",
40
40
  "platform": "github"
41
41
  },
42
- "packageManager": "yarn@3.1.1"
42
+ "packageManager": "yarn@3.2.0"
43
43
  }
@@ -53,9 +53,9 @@ const Dialog = p => {
53
53
  scale: props.visible ? 1 : 0.8,
54
54
  opacity: props.visible ? 1 : 0,
55
55
  config: {
56
- mass: 1,
56
+ mass: 1.2,
57
57
  tension: 200,
58
- friction: 30,
58
+ friction: 25,
59
59
  clamp: true
60
60
  },
61
61
  onStart: () => {
@@ -13,6 +13,7 @@ export interface FormArrayProps {
13
13
  name: string | number | (string | number)[];
14
14
  initialValue?: any[];
15
15
  renderHeader?: (field: FormArrayField, operation: FormArrayOperation) => ReactNode;
16
+ onAdd?: (operation: FormArrayOperation) => void;
16
17
  renderAdd?: () => ReactNode;
17
18
  children: (fields: FormArrayField[], operation: FormArrayOperation) => ReactElement[];
18
19
  }
@@ -39,7 +39,7 @@ const FormArray = props => {
39
39
  }, _react.default.createElement(_list.default.Item, {
40
40
  className: 'adm-form-list-operation',
41
41
  onClick: () => {
42
- operation.add();
42
+ props.onAdd ? props.onAdd(operation) : operation.add();
43
43
  },
44
44
  arrow: false
45
45
  }, props.renderAdd())));
@@ -17,7 +17,7 @@ export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePr
17
17
  hidden?: boolean;
18
18
  layout?: FormLayout;
19
19
  childElementPosition?: 'normal' | 'right';
20
- children: ChildrenType;
20
+ children?: ChildrenType;
21
21
  } & NativeProps;
22
22
  export declare const FormItem: FC<FormItemProps>;
23
23
  export {};
@@ -172,7 +172,8 @@ const ImageUploader = p => {
172
172
  className: classPrefix
173
173
  }, _react.default.createElement(_space.default, {
174
174
  className: `${classPrefix}-space`,
175
- wrap: true
175
+ wrap: true,
176
+ block: true
176
177
  }, value.map((fileItem, index) => {
177
178
  var _a, _b;
178
179
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4
- export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
4
+ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
5
5
  value?: string;
6
6
  defaultValue?: string;
7
7
  onChange?: (val: string) => void;
@@ -20,8 +20,9 @@ export declare type InputRef = {
20
20
  clear: () => void;
21
21
  focus: () => void;
22
22
  blur: () => void;
23
+ nativeElement: HTMLInputElement | null;
23
24
  };
24
- export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
25
+ export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "autoFocus" | "maxLength" | "minLength"> & {
25
26
  value?: string | undefined;
26
27
  defaultValue?: string | undefined;
27
28
  onChange?: ((val: string) => void) | undefined;
@@ -49,7 +49,12 @@ const Input = (0, _react.forwardRef)((p, ref) => {
49
49
  var _a;
50
50
 
51
51
  (_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
52
+ },
53
+
54
+ get nativeElement() {
55
+ return nativeInputRef.current;
52
56
  }
57
+
53
58
  }));
54
59
 
55
60
  const handleKeydown = e => {
@@ -117,6 +122,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
117
122
  max: props.max,
118
123
  min: props.min,
119
124
  autoComplete: props.autoComplete,
125
+ autoFocus: props.autoFocus,
120
126
  pattern: props.pattern,
121
127
  inputMode: props.inputMode,
122
128
  type: props.type,
@@ -58,9 +58,9 @@ const Modal = p => {
58
58
  scale: props.visible ? 1 : 0.8,
59
59
  opacity: props.visible ? 1 : 0,
60
60
  config: {
61
- mass: 1,
61
+ mass: 1.2,
62
62
  tension: 200,
63
- friction: 30,
63
+ friction: 25,
64
64
  clamp: true
65
65
  },
66
66
  onStart: () => {