antd-mobile 5.0.0-rc.27 → 5.0.0-rc.28

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 (123) hide show
  1. package/2x/README.md +1 -1
  2. package/2x/cjs/components/calendar/calendar.d.ts +1 -0
  3. package/2x/cjs/components/calendar/calendar.js +5 -0
  4. package/2x/cjs/components/checkbox/checkbox.js +12 -12
  5. package/2x/cjs/components/form/form-item.css +16 -6
  6. package/2x/cjs/components/form/form-item.d.ts +1 -1
  7. package/2x/cjs/components/form/form-item.js +17 -8
  8. package/2x/cjs/components/form/form.css +0 -9
  9. package/2x/cjs/components/form/form.js +1 -1
  10. package/2x/cjs/components/form/index.css +16 -15
  11. package/2x/cjs/components/image-uploader/image-uploader.d.ts +1 -1
  12. package/2x/cjs/components/image-uploader/image-uploader.js +1 -1
  13. package/2x/cjs/components/input/input.css +1 -0
  14. package/2x/cjs/components/popover/index.d.ts +1 -1
  15. package/2x/cjs/components/popover/popover-menu.d.ts +1 -1
  16. package/2x/cjs/components/progress-bar/progress-bar.css +1 -1
  17. package/2x/cjs/components/progress-circle/progress-circle.css +4 -4
  18. package/2x/cjs/components/progress-circle/progress-circle.js +1 -2
  19. package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +7 -1
  20. package/2x/cjs/components/radio/radio.js +14 -0
  21. package/2x/cjs/components/rate/rate.css +2 -1
  22. package/2x/cjs/components/rate/rate.d.ts +1 -1
  23. package/2x/cjs/components/slider/slider.css +12 -7
  24. package/2x/cjs/components/slider/thumb-icon.d.ts +3 -0
  25. package/2x/cjs/components/slider/thumb-icon.js +38 -0
  26. package/2x/cjs/components/slider/thumb.js +5 -1
  27. package/2x/cjs/components/tabs/tabs.js +3 -3
  28. package/2x/cjs/components/text-area/text-area.js +10 -1
  29. package/2x/cjs/utils/is-dev.js +1 -1
  30. package/2x/es/components/calendar/calendar.d.ts +1 -0
  31. package/2x/es/components/calendar/calendar.js +6 -1
  32. package/2x/es/components/checkbox/checkbox.js +11 -12
  33. package/2x/es/components/form/form-item.css +16 -6
  34. package/2x/es/components/form/form-item.d.ts +1 -1
  35. package/2x/es/components/form/form-item.js +15 -6
  36. package/2x/es/components/form/form.css +0 -9
  37. package/2x/es/components/form/form.js +1 -1
  38. package/2x/es/components/form/index.css +16 -15
  39. package/2x/es/components/image-uploader/image-uploader.d.ts +1 -1
  40. package/2x/es/components/image-uploader/image-uploader.js +1 -1
  41. package/2x/es/components/input/input.css +1 -0
  42. package/2x/es/components/popover/index.d.ts +1 -1
  43. package/2x/es/components/popover/popover-menu.d.ts +1 -1
  44. package/2x/es/components/progress-bar/progress-bar.css +1 -1
  45. package/2x/es/components/progress-circle/progress-circle.css +4 -4
  46. package/2x/es/components/progress-circle/progress-circle.js +1 -2
  47. package/2x/es/components/pull-to-refresh/pull-to-refresh.js +8 -2
  48. package/2x/es/components/radio/radio.js +12 -0
  49. package/2x/es/components/rate/rate.css +2 -1
  50. package/2x/es/components/rate/rate.d.ts +1 -1
  51. package/2x/es/components/slider/slider.css +12 -7
  52. package/2x/es/components/slider/thumb-icon.d.ts +3 -0
  53. package/2x/es/components/slider/thumb-icon.js +25 -0
  54. package/2x/es/components/slider/thumb.js +4 -1
  55. package/2x/es/components/tabs/tabs.js +3 -3
  56. package/2x/es/components/text-area/text-area.js +9 -1
  57. package/2x/es/utils/is-dev.js +1 -1
  58. package/2x/package.json +3 -2
  59. package/README.md +1 -1
  60. package/cjs/components/calendar/calendar.d.ts +1 -0
  61. package/cjs/components/calendar/calendar.js +5 -0
  62. package/cjs/components/checkbox/checkbox.js +12 -12
  63. package/cjs/components/form/form-item.css +14 -6
  64. package/cjs/components/form/form-item.d.ts +1 -1
  65. package/cjs/components/form/form-item.js +17 -8
  66. package/cjs/components/form/form.css +0 -7
  67. package/cjs/components/form/form.js +1 -1
  68. package/cjs/components/form/index.css +14 -13
  69. package/cjs/components/image-uploader/image-uploader.d.ts +1 -1
  70. package/cjs/components/image-uploader/image-uploader.js +1 -1
  71. package/cjs/components/input/input.css +1 -0
  72. package/cjs/components/popover/index.d.ts +1 -1
  73. package/cjs/components/popover/popover-menu.d.ts +1 -1
  74. package/cjs/components/progress-bar/progress-bar.css +1 -1
  75. package/cjs/components/progress-circle/progress-circle.css +4 -4
  76. package/cjs/components/progress-circle/progress-circle.js +1 -2
  77. package/cjs/components/pull-to-refresh/pull-to-refresh.js +7 -1
  78. package/cjs/components/radio/radio.js +14 -0
  79. package/cjs/components/rate/rate.css +2 -1
  80. package/cjs/components/rate/rate.d.ts +1 -1
  81. package/cjs/components/slider/slider.css +11 -7
  82. package/cjs/components/slider/thumb-icon.d.ts +3 -0
  83. package/cjs/components/slider/thumb-icon.js +38 -0
  84. package/cjs/components/slider/thumb.js +5 -1
  85. package/cjs/components/tabs/tabs.js +3 -3
  86. package/cjs/components/text-area/text-area.js +10 -1
  87. package/cjs/utils/is-dev.js +1 -1
  88. package/es/components/calendar/calendar.d.ts +1 -0
  89. package/es/components/calendar/calendar.js +6 -1
  90. package/es/components/checkbox/checkbox.js +11 -12
  91. package/es/components/form/form-item.css +14 -6
  92. package/es/components/form/form-item.d.ts +1 -1
  93. package/es/components/form/form-item.js +15 -6
  94. package/es/components/form/form.css +0 -7
  95. package/es/components/form/form.js +1 -1
  96. package/es/components/form/index.css +14 -13
  97. package/es/components/image-uploader/image-uploader.d.ts +1 -1
  98. package/es/components/image-uploader/image-uploader.js +1 -1
  99. package/es/components/input/input.css +1 -0
  100. package/es/components/popover/index.d.ts +1 -1
  101. package/es/components/popover/popover-menu.d.ts +1 -1
  102. package/es/components/progress-bar/progress-bar.css +1 -1
  103. package/es/components/progress-circle/progress-circle.css +4 -4
  104. package/es/components/progress-circle/progress-circle.js +1 -2
  105. package/es/components/pull-to-refresh/pull-to-refresh.js +8 -2
  106. package/es/components/radio/radio.js +12 -0
  107. package/es/components/rate/rate.css +2 -1
  108. package/es/components/rate/rate.d.ts +1 -1
  109. package/es/components/slider/slider.css +11 -7
  110. package/es/components/slider/thumb-icon.d.ts +3 -0
  111. package/es/components/slider/thumb-icon.js +25 -0
  112. package/es/components/slider/thumb.js +4 -1
  113. package/es/components/tabs/tabs.js +3 -3
  114. package/es/components/text-area/text-area.js +9 -1
  115. package/es/utils/is-dev.js +1 -1
  116. package/package.json +3 -2
  117. package/umd/antd-mobile.js +1 -1
  118. package/2x/assets/slider-thumb.svg +0 -14
  119. package/2x/cjs/assets/slider-thumb.svg +0 -14
  120. package/2x/es/assets/slider-thumb.svg +0 -14
  121. package/assets/slider-thumb.svg +0 -14
  122. package/cjs/assets/slider-thumb.svg +0 -14
  123. package/es/assets/slider-thumb.svg +0 -14
@@ -7,6 +7,7 @@ import { mergeProps } from '../../utils/with-default-props';
7
7
  import { devWarning } from '../../utils/dev-log';
8
8
  import { CheckIcon } from './check-icon';
9
9
  import { IndeterminateIcon } from './indeterminate-icon';
10
+ import { isDev } from '../../utils/is-dev';
10
11
  const classPrefix = `adm-checkbox`;
11
12
  const defaultProps = {
12
13
  defaultChecked: false,
@@ -21,23 +22,21 @@ export const Checkbox = p => {
21
22
  onChange: props.onChange
22
23
  });
23
24
  let disabled = props.disabled;
24
-
25
- const usageWarning = () => {
26
- if (p.checked !== undefined) {
27
- devWarning('Checkbox', 'When used with `Checkbox.Group`, the `checked` prop of `Checkbox` will not work if `value` prop of `Checkbox` is not undefined.');
28
- }
29
-
30
- if (p.defaultChecked !== undefined) {
31
- devWarning('Checkbox', 'When used with `Checkbox.Group`, the `defaultChecked` prop of `Checkbox` will not work if `value` prop of `Checkbox` is not undefined.');
32
- }
33
- };
34
-
35
25
  const {
36
26
  value
37
27
  } = props;
38
28
 
39
29
  if (groupContext && value !== undefined) {
40
- usageWarning();
30
+ if (isDev) {
31
+ if (p.checked !== undefined) {
32
+ devWarning('Checkbox', 'When used within `Checkbox.Group`, the `checked` prop of `Checkbox` will not work.');
33
+ }
34
+
35
+ if (p.defaultChecked !== undefined) {
36
+ devWarning('Checkbox', 'When used within `Checkbox.Group`, the `defaultChecked` prop of `Checkbox` will not work.');
37
+ }
38
+ }
39
+
41
40
  checked = groupContext.value.includes(value);
42
41
 
43
42
  setChecked = checked => {
@@ -8,6 +8,7 @@
8
8
  line-height: 1.5;
9
9
  box-sizing: border-box;
10
10
  position: relative;
11
+ color: #666666;
11
12
  }
12
13
 
13
14
  .adm-form-item-label-required {
@@ -19,6 +20,10 @@
19
20
  user-select: none;
20
21
  }
21
22
 
23
+ .adm-form-item-label-help {
24
+ margin-left: 8px;
25
+ }
26
+
22
27
  .adm-form-item-footer {
23
28
  color: var(--adm-color-danger);
24
29
  margin-top: 8px;
@@ -28,16 +33,21 @@
28
33
  display: none;
29
34
  }
30
35
 
31
- .adm-form-vertical .adm-form-item-label {
32
- font-size: 30px;
33
- margin-bottom: 8px;
36
+ .adm-form-item.adm-form-item-horizontal.adm-list-item {
37
+ --align-items: stretch;
38
+ --prefix-width: 6em;
34
39
  }
35
40
 
36
- .adm-form-horizontal .adm-list-item-content-prefix {
41
+ .adm-form-item.adm-form-item-horizontal .adm-list-item-content-prefix {
37
42
  padding-top: 24px;
38
43
  padding-bottom: 24px;
39
44
  }
40
45
 
41
- .adm-form-item-label {
42
- color: #666666;
46
+ .adm-form-item.adm-form-item-horizontal .adm-list-item-content-extra {
47
+ align-self: center;
48
+ }
49
+
50
+ .adm-form-item.adm-form-item-vertical .adm-form-item-label {
51
+ font-size: 30px;
52
+ margin-bottom: 8px;
43
53
  }
@@ -7,7 +7,7 @@ import type { FormLayout } from './index';
7
7
  declare type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
8
8
  declare type ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;
9
9
  declare type RcFieldProps = Omit<FieldProps, 'children'>;
10
- export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue'> & Pick<ListItemProps, 'style' | 'onClick' | 'extra' | 'arrow'> & {
10
+ export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue'> & Pick<ListItemProps, 'style' | 'onClick' | 'extra' | 'arrow' | 'description'> & {
11
11
  label?: React.ReactNode;
12
12
  help?: React.ReactNode;
13
13
  hasFeedback?: boolean;
@@ -7,6 +7,8 @@ import { devWarning } from '../../utils/dev-log';
7
7
  import { FormContext, NoStyleItemContext } from './context';
8
8
  import { toArray } from './utils';
9
9
  import List from '../list';
10
+ import Popover from '../popover';
11
+ import { QuestionCircleOutline } from 'antd-mobile-icons';
10
12
  const NAME_SPLIT = '__SPLIT__';
11
13
  const classPrefix = `adm-form-item`;
12
14
  const MemoInput = React.memo(({
@@ -26,7 +28,8 @@ const FormItemLayout = props => {
26
28
  htmlFor,
27
29
  hidden,
28
30
  errors,
29
- arrow
31
+ arrow,
32
+ description
30
33
  } = props;
31
34
  const context = useContext(FormContext);
32
35
  const hasFeedback = props.hasFeedback !== undefined ? props.hasFeedback : context.hasFeedback;
@@ -39,17 +42,21 @@ const FormItemLayout = props => {
39
42
  className: `${classPrefix}-label-required`
40
43
  }, "*"), help && React.createElement("span", {
41
44
  className: `${classPrefix}-label-help`
42
- }, help)) : null;
43
- const descriptionElement = feedback && React.createElement("div", {
45
+ }, React.createElement(Popover, {
46
+ content: help,
47
+ mode: 'dark',
48
+ trigger: 'click'
49
+ }, React.createElement(QuestionCircleOutline, null)))) : null;
50
+ const descriptionElement = feedback || description ? React.createElement(React.Fragment, null, description, React.createElement("div", {
44
51
  className: `${classPrefix}-footer`
45
- }, feedback);
52
+ }, feedback)) : null;
46
53
  return React.createElement(List.Item, {
47
54
  style: style,
48
55
  title: layout === 'vertical' && labelElement,
49
56
  prefix: layout === 'horizontal' && labelElement,
50
57
  extra: extra,
51
58
  description: descriptionElement,
52
- className: classNames(classPrefix, className, {
59
+ className: classNames(classPrefix, className, `${classPrefix}-${layout}`, {
53
60
  [`${classPrefix}-hidden`]: hidden
54
61
  }),
55
62
  disabled: disabled,
@@ -73,6 +80,7 @@ export const FormItem = props => {
73
80
  noStyle,
74
81
  hidden,
75
82
  layout,
83
+ description,
76
84
  // Field 相关
77
85
  disabled,
78
86
  rules,
@@ -85,7 +93,7 @@ export const FormItem = props => {
85
93
  dependencies,
86
94
  arrow
87
95
  } = props,
88
- fieldProps = __rest(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "arrow"]);
96
+ fieldProps = __rest(props, ["className", "style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "arrow"]);
89
97
 
90
98
  const {
91
99
  validateTrigger: contextValidateTrigger
@@ -134,6 +142,7 @@ export const FormItem = props => {
134
142
  label: label,
135
143
  extra: extra,
136
144
  help: help,
145
+ description: description,
137
146
  required: isRequired,
138
147
  disabled: disabled,
139
148
  hasFeedback: hasFeedback,
@@ -3,15 +3,6 @@
3
3
  --padding-right: 24px;
4
4
  }
5
5
 
6
- .adm-form-horizontal .adm-list.adm-list {
7
- --prefix-width: 6em;
8
- --align-items: stretch;
9
- }
10
-
11
- .adm-form-horizontal .adm-list.adm-list .adm-list-item-content-extra {
12
- align-self: center;
13
- }
14
-
15
6
  .adm-form .adm-form-footer {
16
7
  padding: 40px 24px;
17
8
  }
@@ -51,7 +51,7 @@ export const Form = forwardRef((p, ref) => {
51
51
  });
52
52
  collect();
53
53
  return React.createElement(RcForm, Object.assign({
54
- className: classNames(classPrefix, `${classPrefix}-${layout}`, className),
54
+ className: classNames(classPrefix, className),
55
55
  style: style,
56
56
  ref: ref
57
57
  }, formProps), React.createElement(FormContext.Provider, {
@@ -3,15 +3,6 @@
3
3
  --padding-right: 24px;
4
4
  }
5
5
 
6
- .adm-form-horizontal .adm-list.adm-list {
7
- --prefix-width: 6em;
8
- --align-items: stretch;
9
- }
10
-
11
- .adm-form-horizontal .adm-list.adm-list .adm-list-item-content-extra {
12
- align-self: center;
13
- }
14
-
15
6
  .adm-form .adm-form-footer {
16
7
  padding: 40px 24px;
17
8
  }
@@ -26,6 +17,7 @@
26
17
  line-height: 1.5;
27
18
  box-sizing: border-box;
28
19
  position: relative;
20
+ color: #666666;
29
21
  }
30
22
 
31
23
  .adm-form-item-label-required {
@@ -37,6 +29,10 @@
37
29
  user-select: none;
38
30
  }
39
31
 
32
+ .adm-form-item-label-help {
33
+ margin-left: 8px;
34
+ }
35
+
40
36
  .adm-form-item-footer {
41
37
  color: var(--adm-color-danger);
42
38
  margin-top: 8px;
@@ -46,16 +42,21 @@
46
42
  display: none;
47
43
  }
48
44
 
49
- .adm-form-vertical .adm-form-item-label {
50
- font-size: 30px;
51
- margin-bottom: 8px;
45
+ .adm-form-item.adm-form-item-horizontal.adm-list-item {
46
+ --align-items: stretch;
47
+ --prefix-width: 6em;
52
48
  }
53
49
 
54
- .adm-form-horizontal .adm-list-item-content-prefix {
50
+ .adm-form-item.adm-form-item-horizontal .adm-list-item-content-prefix {
55
51
  padding-top: 24px;
56
52
  padding-bottom: 24px;
57
53
  }
58
54
 
59
- .adm-form-item-label {
60
- color: #666666;
55
+ .adm-form-item.adm-form-item-horizontal .adm-list-item-content-extra {
56
+ align-self: center;
57
+ }
58
+
59
+ .adm-form-item.adm-form-item-vertical .adm-form-item-label {
60
+ font-size: 30px;
61
+ margin-bottom: 8px;
61
62
  }
@@ -19,7 +19,7 @@ export declare type ImageUploaderProps = {
19
19
  showUpload?: boolean;
20
20
  deletable?: boolean;
21
21
  capture?: InputHTMLAttributes<unknown>['capture'];
22
- onPreview?: (index: number) => void;
22
+ onPreview?: (index: number, item: ImageUploadItem) => void;
23
23
  beforeUpload?: (file: File[]) => Promise<File[]> | File[];
24
24
  upload: (file: File) => Promise<ImageUploadItem>;
25
25
  onDelete?: (item: ImageUploadItem) => boolean | Promise<boolean> | void;
@@ -144,7 +144,7 @@ export const ImageUploader = p => {
144
144
  previewImage(index);
145
145
  }
146
146
 
147
- onPreview && onPreview(index);
147
+ onPreview && onPreview(index, fileItem);
148
148
  },
149
149
  onDelete: () => __awaiter(void 0, void 0, void 0, function* () {
150
150
  var _c;
@@ -10,6 +10,7 @@
10
10
  width: 100%;
11
11
  max-width: 100%;
12
12
  max-height: 100%;
13
+ min-height: 48px;
13
14
  background-color: var(--background-color);
14
15
  }
15
16
 
@@ -13,7 +13,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
13
13
  stopPropagation?: "click"[] | undefined;
14
14
  content: import("react").ReactNode;
15
15
  } & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "align" | "defaultVisible" | "onVisibleChange"> & import("../../utils/native-props").NativeProps<"--z-index"> & import("react").RefAttributes<import("./popover").PopoverRef>> & {
16
- Menu: import("react").ForwardRefExoticComponent<Pick<import("./popover").PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
16
+ Menu: import("react").ForwardRefExoticComponent<Pick<import("./popover").PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "defaultVisible" | "onVisibleChange" | "trigger" | "placement" | "destroyOnHide"> & {
17
17
  actions: import("./popover-menu").Action[];
18
18
  onAction?: ((item: import("./popover-menu").Action) => void) | undefined;
19
19
  } & import("react").RefAttributes<import("./popover").PopoverRef>>;
@@ -11,7 +11,7 @@ export declare type PopoverMenuProps = Omit<PopoverProps, 'content'> & {
11
11
  actions: Action[];
12
12
  onAction?: (item: Action) => void;
13
13
  };
14
- export declare const PopoverMenu: React.ForwardRefExoticComponent<Pick<PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
14
+ export declare const PopoverMenu: React.ForwardRefExoticComponent<Pick<PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "defaultVisible" | "onVisibleChange" | "trigger" | "placement" | "destroyOnHide"> & {
15
15
  actions: Action[];
16
16
  onAction?: ((item: Action) => void) | undefined;
17
17
  } & React.RefAttributes<PopoverRef>>;
@@ -1,7 +1,7 @@
1
1
  .adm-progress-bar {
2
2
  --track-width: var(--adm-progress-bar-track-width, 6px);
3
3
  --track-color: var(--adm-progress-bar-track-color, #e5e5e5);
4
- --fill-color: var(--adm-progress-bar-fill-color, #1677ff);
4
+ --fill-color: var(--adm-progress-bar-fill-color, var(--adm-color-primary));
5
5
  }
6
6
 
7
7
  .adm-progress-bar-trail {
@@ -1,10 +1,10 @@
1
1
  /*进度圈*/
2
2
 
3
3
  .adm-progress-circle {
4
- --track-width: 6px;
5
- --size: 100px;
6
- --track-color: #e5e5e5;
7
- --fill-color: #1677ff;
4
+ --track-width: var(--adm-progress-circle-track-width, 6px);
5
+ --size: var(--adm-progress-circle-size, 100px);
6
+ --track-color: var(--adm-progress-circle-track-color, #e5e5e5);
7
+ --fill-color: var(--adm-progress-circle-fill-color, var(--adm-color-primary));
8
8
  --percent: 0;
9
9
  --pi: 3.14159265;
10
10
  --radius: calc(var(--size) / 2 - var(--track-width) / 2);
@@ -4,8 +4,7 @@ import { mergeProps } from '../../utils/with-default-props';
4
4
  const classPrefix = `adm-progress-circle`;
5
5
  export const ProgressCircle = p => {
6
6
  const props = mergeProps({
7
- percent: 0,
8
- strokeColor: '#1677FF'
7
+ percent: 0
9
8
  }, p);
10
9
  const style = {
11
10
  '--percent': props.percent.toString()
@@ -3,7 +3,7 @@ import { mergeProps } from '../../utils/with-default-props';
3
3
  import { animated, useSpring } from '@react-spring/web';
4
4
  import { useDrag } from '@use-gesture/react';
5
5
  import { getScrollParent } from '../../utils/get-scroll-parent';
6
- import React, { useRef, useState } from 'react';
6
+ import React, { useEffect, useRef, useState } from 'react';
7
7
  import { supportsPassive } from '../../utils/supports-passive';
8
8
  import { convertPx } from '../../utils/convert-px';
9
9
  import { rubberbandIfOutOfBounds } from '../../utils/rubberband';
@@ -36,7 +36,13 @@ export const PullToRefresh = p => {
36
36
  }
37
37
  }));
38
38
  const elementRef = useRef(null);
39
- const pullingRef = useRef(false);
39
+ const pullingRef = useRef(false); //防止下拉时抖动
40
+
41
+ useEffect(() => {
42
+ var _a;
43
+
44
+ (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('touchmove', () => {});
45
+ }, []);
40
46
 
41
47
  function doRefresh() {
42
48
  return __awaiter(this, void 0, void 0, function* () {
@@ -5,6 +5,8 @@ import { RadioGroupContext } from './group-context';
5
5
  import { usePropsValue } from '../../utils/use-props-value';
6
6
  import { mergeProps } from '../../utils/with-default-props';
7
7
  import { CheckIcon } from '../checkbox/check-icon';
8
+ import { devWarning } from '../../utils/dev-log';
9
+ import { isDev } from '../../utils/is-dev';
8
10
  const classPrefix = `adm-radio`;
9
11
  const defaultProps = {
10
12
  defaultChecked: false
@@ -23,6 +25,16 @@ export const Radio = p => {
23
25
  } = props;
24
26
 
25
27
  if (groupContext && value !== undefined) {
28
+ if (isDev) {
29
+ if (p.checked !== undefined) {
30
+ devWarning('Radio', 'When used within `Radio.Group`, the `checked` prop of `Radio` will not work.');
31
+ }
32
+
33
+ if (p.defaultChecked !== undefined) {
34
+ devWarning('Radio', 'When used within `Radio.Group`, the `defaultChecked` prop of `Radio` will not work.');
35
+ }
36
+ }
37
+
26
38
  checked = groupContext.value.includes(value);
27
39
 
28
40
  setChecked = checked => {
@@ -1,6 +1,7 @@
1
1
  .adm-rate {
2
2
  --star-size: 48px;
3
3
  --active-color: #ffd21e;
4
+ --inactive-color: var(--adm-color-light);
4
5
  display: inline-flex;
5
6
  }
6
7
 
@@ -12,7 +13,7 @@
12
13
  padding: calc(var(--star-size) / 8);
13
14
  line-height: var(--star-size);
14
15
  font-size: var(--star-size);
15
- color: var(--adm-color-light);
16
+ color: var(--inactive-color);
16
17
  text-align: center;
17
18
  overflow: hidden;
18
19
  cursor: pointer;
@@ -9,5 +9,5 @@ export declare type RateProps = {
9
9
  readOnly?: boolean;
10
10
  value?: number;
11
11
  onChange?: (value: number) => void;
12
- } & NativeProps<'--star-size' | '--active-color'>;
12
+ } & NativeProps<'--star-size' | '--active-color' | '--inactive-color'>;
13
13
  export declare const Rate: FC<RateProps>;
@@ -18,6 +18,7 @@
18
18
 
19
19
  .adm-slider-fill {
20
20
  position: absolute;
21
+ z-index: 1;
21
22
  height: 8px;
22
23
  background-color: var(--fill-color);
23
24
  }
@@ -44,16 +45,11 @@
44
45
  }
45
46
 
46
47
  .adm-slider-thumb {
47
- touch-action: none;
48
- position: absolute;
49
48
  width: 44px;
50
49
  height: 44px;
50
+ margin: 10px;
51
51
  border-radius: 50%;
52
- left: 50%;
53
- top: 50%;
54
- transform: translate(-50%, -50%);
55
- background: #fff url('../../assets/slider-thumb.svg') no-repeat center center;
56
- background-size: 20px 20px;
52
+ background: var(--adm-color-white);
57
53
  box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.12), 0 3px 6px -4px rgba(0, 0, 0, 0.25);
58
54
  }
59
55
 
@@ -61,9 +57,18 @@
61
57
  outline: none;
62
58
  }
63
59
 
60
+ .adm-slider-thumb-icon {
61
+ width: 20px;
62
+ height: 20px;
63
+ margin: 12px;
64
+ user-select: none;
65
+ }
66
+
64
67
  .adm-slider-thumb-container {
68
+ cursor: grab;
65
69
  touch-action: none;
66
70
  position: absolute;
71
+ z-index: 2;
67
72
  width: 64px;
68
73
  height: 64px;
69
74
  border-radius: 50%;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { NativeProps } from '../../utils/native-props';
3
+ export declare const ThumbIcon: FC<NativeProps>;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { withNativeProps } from '../../utils/native-props';
3
+ export const ThumbIcon = props => {
4
+ return withNativeProps(props, React.createElement("svg", {
5
+ viewBox: '0 0 20 20'
6
+ }, React.createElement("g", {
7
+ stroke: 'none',
8
+ strokeWidth: '1',
9
+ fill: 'none',
10
+ fillRule: 'evenodd'
11
+ }, React.createElement("g", {
12
+ transform: 'translate(-604.000000, -656.000000)',
13
+ fill: '#999999'
14
+ }, React.createElement("g", {
15
+ transform: 'translate(592.000000, 644.000000)'
16
+ }, React.createElement("g", {
17
+ transform: 'translate(12.000000, 12.000000)'
18
+ }, React.createElement("polygon", {
19
+ points: '0 3.33333333 2.22222222 3.33333333 2.22222222 17.7777778 0 17.7777778'
20
+ }), React.createElement("polygon", {
21
+ points: '17.7777778 3.33333333 20 3.33333333 20 17.7777778 17.7777778 17.7777778'
22
+ }), React.createElement("path", {
23
+ d: 'M10.8888889,0 L9.11111111,0 C8.98888889,0 8.88888889,0.107142857 8.88888889,0.238095238 L8.88888889,19.7619048 C8.88888889,19.8928571 8.98888889,20 9.11111111,20 L10.8888889,20 C11.0111111,20 11.1111111,19.8928571 11.1111111,19.7619048 L11.1111111,0.238095238 C11.1111111,0.107142857 11.0111111,0 10.8888889,0 Z'
24
+ })))))));
25
+ };
@@ -1,5 +1,6 @@
1
1
  import React, { useRef } from 'react';
2
2
  import { useDrag } from '@use-gesture/react';
3
+ import { ThumbIcon } from './thumb-icon';
3
4
  const classPrefix = `adm-slider`;
4
5
 
5
6
  const Thumb = props => {
@@ -44,7 +45,9 @@ const Thumb = props => {
44
45
  style: currentPosition()
45
46
  }, bind()), React.createElement("div", {
46
47
  className: `${classPrefix}-thumb`
47
- }));
48
+ }, React.createElement(ThumbIcon, {
49
+ className: `${classPrefix}-thumb-icon`
50
+ })));
48
51
  };
49
52
 
50
53
  export default Thumb;
@@ -135,16 +135,16 @@ export const Tabs = p => {
135
135
  }
136
136
 
137
137
  useIsomorphicLayoutEffect(() => {
138
- animate(true);
138
+ animate(!x.isAnimating);
139
139
  }, []);
140
140
  useUpdateLayoutEffect(() => {
141
141
  animate();
142
142
  }, [activeKey]);
143
143
  useResizeEffect(() => {
144
- animate(true);
144
+ animate(!x.isAnimating);
145
145
  }, tabListContainerRef);
146
146
  useMutationEffect(() => {
147
- animate(true);
147
+ animate(!x.isAnimating);
148
148
  }, tabListContainerRef, {
149
149
  subtree: true,
150
150
  childList: true,
@@ -2,6 +2,7 @@ import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react
2
2
  import { withNativeProps } from '../../utils/native-props';
3
3
  import { usePropsValue } from '../../utils/use-props-value';
4
4
  import { mergeProps } from '../../utils/with-default-props';
5
+ import { devError } from '../../utils/dev-log';
5
6
  const classPrefix = 'adm-text-area';
6
7
  const defaultProps = {
7
8
  rows: 2,
@@ -16,7 +17,14 @@ export const TextArea = forwardRef((p, ref) => {
16
17
  showCount,
17
18
  maxLength
18
19
  } = props;
19
- const [value, setValue] = usePropsValue(props);
20
+ const [value, setValue] = usePropsValue(Object.assign(Object.assign({}, props), {
21
+ value: props.value === null ? '' : props.value
22
+ }));
23
+
24
+ if (props.value === null) {
25
+ devError('TextArea', '`value` prop on `TextArea` should not be `null`. Consider using an empty string to clear the component.');
26
+ }
27
+
20
28
  const nativeTextAreaRef = useRef(null);
21
29
  useImperativeHandle(ref, () => ({
22
30
  clear: () => {
@@ -1 +1 @@
1
- export const isDev = process.env.NODE_ENV === 'development';
1
+ export const isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
package/2x/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.0.0-rc.27",
3
+ "version": "5.0.0-rc.28",
4
4
  "dependencies": {
5
5
  "@react-spring/web": "^9.4.3",
6
6
  "@types/resize-observer-browser": "^0.1.7",
@@ -39,5 +39,6 @@
39
39
  "url": "git+https://github.com/ant-design/ant-design-mobile.git",
40
40
  "branch": "master",
41
41
  "platform": "github"
42
- }
42
+ },
43
+ "packageManager": "yarn@3.1.1"
43
44
  }
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img src="https://gw.alipayobjects.com/mdn/rms_ee68a8/afts/img/A*8HtNS4uMKkAAAAAAAAAAAAAAARQnAQ" alt="logo" width="100%" />
1
+ <img src="https://gw.alipayobjects.com/mdn/rms_ee68a8/afts/img/A*C3OZT6SF5BUAAAAAAAAAAAAAARQnAQ" alt="logo" width="100%" />
2
2
 
3
3
  ![npm (tag)](https://img.shields.io/npm/v/antd-mobile/next)
4
4
  ![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/ant-design/ant-design-mobile)
@@ -3,6 +3,7 @@ import { NativeProps } from '../../utils/native-props';
3
3
  export declare type CalendarProps = {
4
4
  weekStartsOn?: 'Monday' | 'Sunday';
5
5
  renderLabel?: (date: Date) => string | null | undefined;
6
+ onPageChange?: (year: number, month: number) => void;
6
7
  } & ({
7
8
  selectionMode?: undefined;
8
9
  value?: undefined;
@@ -52,6 +52,11 @@ const Calendar = p => {
52
52
  }
53
53
 
54
54
  const [current, setCurrent] = (0, _react.useState)(() => (0, _dayjs.default)().date(1));
55
+ (0, _ahooks.useUpdateEffect)(() => {
56
+ var _a;
57
+
58
+ (_a = props.onPageChange) === null || _a === void 0 ? void 0 : _a.call(props, current.year(), current.month() + 1);
59
+ }, [current]);
55
60
 
56
61
  const header = _react.default.createElement("div", {
57
62
  className: `${classPrefix}-header`
@@ -23,6 +23,8 @@ var _checkIcon = require("./check-icon");
23
23
 
24
24
  var _indeterminateIcon = require("./indeterminate-icon");
25
25
 
26
+ var _isDev = require("../../utils/is-dev");
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -44,23 +46,21 @@ const Checkbox = p => {
44
46
  onChange: props.onChange
45
47
  });
46
48
  let disabled = props.disabled;
47
-
48
- const usageWarning = () => {
49
- if (p.checked !== undefined) {
50
- (0, _devLog.devWarning)('Checkbox', 'When used with `Checkbox.Group`, the `checked` prop of `Checkbox` will not work if `value` prop of `Checkbox` is not undefined.');
51
- }
52
-
53
- if (p.defaultChecked !== undefined) {
54
- (0, _devLog.devWarning)('Checkbox', 'When used with `Checkbox.Group`, the `defaultChecked` prop of `Checkbox` will not work if `value` prop of `Checkbox` is not undefined.');
55
- }
56
- };
57
-
58
49
  const {
59
50
  value
60
51
  } = props;
61
52
 
62
53
  if (groupContext && value !== undefined) {
63
- usageWarning();
54
+ if (_isDev.isDev) {
55
+ if (p.checked !== undefined) {
56
+ (0, _devLog.devWarning)('Checkbox', 'When used within `Checkbox.Group`, the `checked` prop of `Checkbox` will not work.');
57
+ }
58
+
59
+ if (p.defaultChecked !== undefined) {
60
+ (0, _devLog.devWarning)('Checkbox', 'When used within `Checkbox.Group`, the `defaultChecked` prop of `Checkbox` will not work.');
61
+ }
62
+ }
63
+
64
64
  checked = groupContext.value.includes(value);
65
65
 
66
66
  setChecked = checked => {