vant 3.2.7 → 3.3.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 (191) hide show
  1. package/es/address-edit/AddressEdit.js +154 -180
  2. package/es/address-edit/AddressEditDetail.d.ts +10 -9
  3. package/es/address-edit/AddressEditDetail.js +6 -6
  4. package/es/button/Button.js +2 -2
  5. package/es/calendar/Calendar.js +8 -14
  6. package/es/calendar/CalendarHeader.js +1 -3
  7. package/es/calendar/CalendarMonth.js +11 -10
  8. package/es/calendar/types.d.ts +1 -1
  9. package/es/cascader/Cascader.js +17 -5
  10. package/es/checkbox/Checker.js +1 -1
  11. package/es/checkbox/types.d.ts +2 -6
  12. package/es/composables/use-id.d.ts +1 -0
  13. package/es/composables/use-id.js +14 -0
  14. package/es/composables/use-route.d.ts +1 -1
  15. package/es/composables/use-route.js +4 -4
  16. package/es/count-down/CountDown.js +1 -0
  17. package/es/coupon-list/CouponList.js +40 -24
  18. package/es/coupon-list/index.css +1 -1
  19. package/es/coupon-list/index.less +0 -5
  20. package/es/dropdown-item/DropdownItem.js +7 -2
  21. package/es/dropdown-item/types.d.ts +2 -6
  22. package/es/dropdown-menu/DropdownMenu.js +7 -3
  23. package/es/dropdown-menu/types.d.ts +1 -0
  24. package/es/empty/Network.js +22 -34
  25. package/es/field/Field.d.ts +1 -1
  26. package/es/field/Field.js +13 -5
  27. package/es/field/index.d.ts +2 -2
  28. package/es/field/types.d.ts +7 -6
  29. package/es/form/Form.js +2 -2
  30. package/es/image/Image.js +4 -9
  31. package/es/image-preview/ImagePreview.js +3 -4
  32. package/es/index.d.ts +1 -1
  33. package/es/index.js +1 -1
  34. package/es/lazyload/index.d.ts +1 -1
  35. package/es/lazyload/index.js +1 -1
  36. package/es/lazyload/vue-lazyload/index.d.ts +55 -0
  37. package/es/lazyload/vue-lazyload/index.js +46 -0
  38. package/es/lazyload/vue-lazyload/lazy-component.js +53 -0
  39. package/es/lazyload/vue-lazyload/lazy-container.js +98 -0
  40. package/es/lazyload/vue-lazyload/lazy-image.js +115 -0
  41. package/es/lazyload/vue-lazyload/lazy.js +507 -0
  42. package/es/lazyload/vue-lazyload/listener.js +241 -0
  43. package/es/lazyload/vue-lazyload/util.js +183 -0
  44. package/es/list/List.js +3 -1
  45. package/es/nav-bar/NavBar.d.ts +1 -1
  46. package/es/nav-bar/index.d.ts +1 -1
  47. package/es/number-keyboard/NumberKeyboardKey.js +4 -4
  48. package/es/pagination/Pagination.js +67 -49
  49. package/es/pagination/index.css +1 -1
  50. package/es/pagination/index.less +32 -31
  51. package/es/password-input/PasswordInput.d.ts +21 -1
  52. package/es/password-input/PasswordInput.js +10 -9
  53. package/es/password-input/index.d.ts +2 -1
  54. package/es/popover/Popover.js +2 -0
  55. package/es/popup/Popup.d.ts +1 -2
  56. package/es/popup/Popup.js +2 -5
  57. package/es/popup/index.d.ts +1 -2
  58. package/es/progress/Progress.js +2 -2
  59. package/es/rate/Rate.js +5 -3
  60. package/es/search/Search.js +8 -2
  61. package/es/sidebar/Sidebar.js +1 -0
  62. package/es/sidebar-item/SidebarItem.js +4 -1
  63. package/es/slider/Slider.js +5 -3
  64. package/es/stepper/Stepper.js +11 -8
  65. package/es/submit-bar/SubmitBar.d.ts +4 -3
  66. package/es/submit-bar/index.d.ts +3 -2
  67. package/es/swipe/Swipe.js +11 -6
  68. package/es/swipe/types.d.ts +1 -3
  69. package/es/switch/Switch.js +1 -0
  70. package/es/switch/index.css +1 -1
  71. package/es/switch/index.less +2 -0
  72. package/es/tab/Tab.js +18 -5
  73. package/es/tab/index.css +1 -1
  74. package/es/tab/index.less +1 -1
  75. package/es/tabbar/Tabbar.d.ts +1 -1
  76. package/es/tabbar/Tabbar.js +10 -10
  77. package/es/tabbar-item/TabbarItem.js +16 -7
  78. package/es/tabs/Tabs.js +17 -11
  79. package/es/tabs/TabsTitle.d.ts +6 -0
  80. package/es/tabs/TabsTitle.js +7 -1
  81. package/es/tabs/types.d.ts +1 -0
  82. package/es/uploader/UploaderPreviewItem.js +4 -1
  83. package/es/uploader/utils.d.ts +2 -2
  84. package/es/uploader/utils.js +2 -2
  85. package/es/utils/dom.d.ts +1 -0
  86. package/es/utils/dom.js +6 -2
  87. package/es/utils/format.js +6 -5
  88. package/es/vue-tsx-shim.d.ts +1 -0
  89. package/lib/address-edit/AddressEdit.js +155 -180
  90. package/lib/address-edit/AddressEditDetail.d.ts +10 -9
  91. package/lib/address-edit/AddressEditDetail.js +6 -6
  92. package/lib/button/Button.js +1 -1
  93. package/lib/calendar/Calendar.js +8 -14
  94. package/lib/calendar/CalendarHeader.js +1 -3
  95. package/lib/calendar/CalendarMonth.js +11 -10
  96. package/lib/calendar/types.d.ts +1 -1
  97. package/lib/cascader/Cascader.js +17 -5
  98. package/lib/checkbox/Checker.js +1 -1
  99. package/lib/checkbox/types.d.ts +2 -6
  100. package/lib/composables/use-id.d.ts +1 -0
  101. package/lib/composables/use-id.js +21 -0
  102. package/lib/composables/use-route.d.ts +1 -1
  103. package/lib/composables/use-route.js +4 -4
  104. package/lib/count-down/CountDown.js +1 -0
  105. package/lib/coupon-list/CouponList.js +39 -22
  106. package/lib/coupon-list/index.css +1 -1
  107. package/lib/coupon-list/index.less +0 -5
  108. package/lib/dropdown-item/DropdownItem.js +7 -2
  109. package/lib/dropdown-item/types.d.ts +2 -6
  110. package/lib/dropdown-menu/DropdownMenu.js +7 -2
  111. package/lib/dropdown-menu/types.d.ts +1 -0
  112. package/lib/empty/Network.js +22 -34
  113. package/lib/field/Field.d.ts +1 -1
  114. package/lib/field/Field.js +14 -5
  115. package/lib/field/index.d.ts +2 -2
  116. package/lib/field/types.d.ts +7 -6
  117. package/lib/form/Form.js +1 -1
  118. package/lib/image/Image.js +4 -9
  119. package/lib/image-preview/ImagePreview.js +1 -2
  120. package/lib/index.css +1 -1
  121. package/lib/index.d.ts +1 -1
  122. package/lib/index.js +1 -1
  123. package/lib/lazyload/index.d.ts +1 -1
  124. package/lib/lazyload/index.js +3 -3
  125. package/lib/lazyload/vue-lazyload/index.d.ts +55 -0
  126. package/lib/lazyload/vue-lazyload/index.js +58 -0
  127. package/lib/lazyload/vue-lazyload/lazy-component.js +62 -0
  128. package/lib/lazyload/vue-lazyload/lazy-container.js +106 -0
  129. package/lib/lazyload/vue-lazyload/lazy-image.js +125 -0
  130. package/lib/lazyload/vue-lazyload/lazy.js +520 -0
  131. package/lib/lazyload/vue-lazyload/listener.js +251 -0
  132. package/lib/lazyload/vue-lazyload/util.js +213 -0
  133. package/lib/list/List.js +3 -1
  134. package/lib/nav-bar/NavBar.d.ts +1 -1
  135. package/lib/nav-bar/index.d.ts +1 -1
  136. package/lib/number-keyboard/NumberKeyboardKey.js +3 -3
  137. package/lib/pagination/Pagination.js +65 -47
  138. package/lib/pagination/index.css +1 -1
  139. package/lib/pagination/index.less +32 -31
  140. package/lib/password-input/PasswordInput.d.ts +21 -1
  141. package/lib/password-input/PasswordInput.js +10 -9
  142. package/lib/password-input/index.d.ts +2 -1
  143. package/lib/popover/Popover.js +2 -0
  144. package/lib/popup/Popup.d.ts +1 -2
  145. package/lib/popup/Popup.js +2 -5
  146. package/lib/popup/index.d.ts +1 -2
  147. package/lib/progress/Progress.js +2 -2
  148. package/lib/rate/Rate.js +5 -3
  149. package/lib/search/Search.js +9 -2
  150. package/lib/sidebar/Sidebar.js +1 -0
  151. package/lib/sidebar-item/SidebarItem.js +4 -1
  152. package/lib/slider/Slider.js +5 -3
  153. package/lib/stepper/Stepper.js +11 -8
  154. package/lib/submit-bar/SubmitBar.d.ts +4 -3
  155. package/lib/submit-bar/index.d.ts +3 -2
  156. package/lib/swipe/Swipe.js +9 -4
  157. package/lib/swipe/types.d.ts +1 -3
  158. package/lib/switch/Switch.js +1 -0
  159. package/lib/switch/index.css +1 -1
  160. package/lib/switch/index.less +2 -0
  161. package/lib/tab/Tab.js +20 -5
  162. package/lib/tab/index.css +1 -1
  163. package/lib/tab/index.less +1 -1
  164. package/lib/tabbar/Tabbar.d.ts +1 -1
  165. package/lib/tabbar/Tabbar.js +10 -10
  166. package/lib/tabbar-item/TabbarItem.js +16 -7
  167. package/lib/tabs/Tabs.js +16 -9
  168. package/lib/tabs/TabsTitle.d.ts +6 -0
  169. package/lib/tabs/TabsTitle.js +7 -1
  170. package/lib/tabs/types.d.ts +1 -0
  171. package/lib/uploader/UploaderPreviewItem.js +3 -0
  172. package/lib/uploader/utils.d.ts +2 -2
  173. package/lib/uploader/utils.js +3 -2
  174. package/lib/utils/dom.d.ts +1 -0
  175. package/lib/utils/dom.js +9 -2
  176. package/lib/utils/format.js +7 -5
  177. package/lib/vant.cjs.js +14407 -0
  178. package/lib/vant.cjs.min.js +1 -0
  179. package/lib/vant.es.js +1217 -2203
  180. package/lib/vant.es.min.js +1217 -2203
  181. package/lib/vant.js +1349 -1254
  182. package/lib/vant.min.js +1 -1
  183. package/lib/vue-tsx-shim.d.ts +1 -0
  184. package/package.json +27 -13
  185. package/vetur/attributes.json +115 -115
  186. package/vetur/tags.json +35 -35
  187. package/vetur/web-types.json +370 -366
  188. package/es/composables/use-link-field.d.ts +0 -0
  189. package/es/composables/use-link-field.js +0 -0
  190. package/lib/composables/use-link-field.d.ts +0 -0
  191. package/lib/composables/use-link-field.js +0 -1
@@ -13,9 +13,12 @@
13
13
  }
14
14
 
15
15
  .van-pagination {
16
- display: flex;
17
16
  font-size: var(--van-pagination-font-size);
18
17
 
18
+ &__items {
19
+ display: flex;
20
+ }
21
+
19
22
  &__item,
20
23
  &__page-desc {
21
24
  display: flex;
@@ -33,58 +36,56 @@
33
36
  cursor: pointer;
34
37
  user-select: none;
35
38
 
39
+ button {
40
+ flex: 1;
41
+ height: 100%;
42
+ border: none;
43
+ padding: 0;
44
+ background: transparent;
45
+
46
+ &[disabled] {
47
+ cursor: not-allowed;
48
+ }
49
+ }
50
+
36
51
  &:active {
37
52
  color: var(--van-white);
38
53
  background-color: var(--van-pagination-item-default-color);
39
54
  }
40
55
 
41
- &::after {
42
- border-width: var(--van-border-width-base) 0 var(--van-border-width-base)
43
- var(--van-border-width-base);
44
- }
45
-
46
- &:last-child::after {
47
- border-right-width: var(--van-border-width-base);
56
+ &:not(:last-child)::after {
57
+ border-right-width: 0;
48
58
  }
49
59
 
50
60
  &--active {
51
61
  color: var(--van-white);
52
62
  background-color: var(--van-pagination-item-default-color);
53
63
  }
54
- }
55
64
 
56
- &__prev,
57
- &__next {
58
- padding: 0 var(--van-padding-base);
59
- cursor: pointer;
60
- }
65
+ &--page {
66
+ flex-grow: 0;
67
+ }
61
68
 
62
- &__item--disabled {
63
- &,
64
- &:active {
69
+ &--prev,
70
+ &--next {
71
+ padding: 0 var(--van-padding-base);
72
+ cursor: pointer;
73
+ }
74
+
75
+ &--border::after {
76
+ border-width: var(--van-border-width-base);
77
+ }
78
+
79
+ &--disabled {
65
80
  color: var(--van-pagination-item-disabled-color);
66
81
  background-color: var(--van-pagination-item-disabled-background-color);
67
- cursor: not-allowed;
68
82
  opacity: var(--van-pagination-disabled-opacity);
69
83
  }
70
84
  }
71
85
 
72
- &__page {
73
- flex-grow: 0;
74
- }
75
-
76
86
  &__page-desc {
77
87
  flex: 1;
78
88
  height: var(--van-pagination-height);
79
89
  color: var(--van-pagination-desc-color);
80
90
  }
81
-
82
- &--simple {
83
- .van-pagination__prev,
84
- .van-pagination__next {
85
- &::after {
86
- border-width: var(--van-border-width-base);
87
- }
88
- }
89
- }
90
91
  }
@@ -1,3 +1,23 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+ declare const passwordInputProps: {
3
+ info: StringConstructor;
4
+ mask: {
5
+ type: BooleanConstructor;
6
+ default: true;
7
+ };
8
+ value: {
9
+ type: import("vue").PropType<string>;
10
+ default: string;
11
+ };
12
+ gutter: (NumberConstructor | StringConstructor)[];
13
+ length: {
14
+ type: (NumberConstructor | StringConstructor)[];
15
+ default: number;
16
+ };
17
+ focused: BooleanConstructor;
18
+ errorInfo: StringConstructor;
19
+ };
20
+ export declare type PasswordInputProps = ExtractPropTypes<typeof passwordInputProps>;
1
21
  declare const _default: import("vue").DefineComponent<{
2
22
  info: StringConstructor;
3
23
  mask: {
@@ -29,9 +49,9 @@ declare const _default: import("vue").DefineComponent<{
29
49
  value: string;
30
50
  focused: boolean;
31
51
  } & {
32
- errorInfo?: string | undefined;
33
52
  gutter?: string | number | undefined;
34
53
  info?: string | undefined;
54
+ errorInfo?: string | undefined;
35
55
  }> & {
36
56
  onFocus?: ((...args: any[]) => any) | undefined;
37
57
  }, {
@@ -2,17 +2,18 @@ import { createVNode as _createVNode } from "vue";
2
2
  import { defineComponent } from 'vue';
3
3
  import { addUnit, truthProp, numericProp, BORDER_LEFT, makeStringProp, BORDER_SURROUND, createNamespace, makeNumericProp } from '../utils';
4
4
  var [name, bem] = createNamespace('password-input');
5
+ var passwordInputProps = {
6
+ info: String,
7
+ mask: truthProp,
8
+ value: makeStringProp(''),
9
+ gutter: numericProp,
10
+ length: makeNumericProp(6),
11
+ focused: Boolean,
12
+ errorInfo: String
13
+ };
5
14
  export default defineComponent({
6
15
  name,
7
- props: {
8
- info: String,
9
- mask: truthProp,
10
- value: makeStringProp(''),
11
- gutter: numericProp,
12
- length: makeNumericProp(6),
13
- focused: Boolean,
14
- errorInfo: String
15
- },
16
+ props: passwordInputProps,
16
17
  emits: ['focus'],
17
18
 
18
19
  setup(props, _ref) {
@@ -29,9 +29,9 @@ export declare const PasswordInput: import("../utils").WithInstall<import("vue")
29
29
  value: string;
30
30
  focused: boolean;
31
31
  } & {
32
- errorInfo?: string | undefined;
33
32
  gutter?: string | number | undefined;
34
33
  info?: string | undefined;
34
+ errorInfo?: string | undefined;
35
35
  }> & {
36
36
  onFocus?: ((...args: any[]) => any) | undefined;
37
37
  }, {
@@ -41,3 +41,4 @@ export declare const PasswordInput: import("../utils").WithInstall<import("vue")
41
41
  focused: boolean;
42
42
  }>>;
43
43
  export default PasswordInput;
44
+ export type { PasswordInputProps } from './PasswordInput';
@@ -135,6 +135,8 @@ export default defineComponent({
135
135
  "style": {
136
136
  color
137
137
  },
138
+ "tabindex": disabled ? undefined : 0,
139
+ "aria-disabled": disabled || undefined,
138
140
  "onClick": () => onClickAction(action, index)
139
141
  }, [icon && _createVNode(Icon, {
140
142
  "name": icon,
@@ -91,7 +91,7 @@ declare const _default: import("vue").DefineComponent<{
91
91
  default: PopupCloseIconPosition;
92
92
  };
93
93
  safeAreaInsetBottom: BooleanConstructor;
94
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "click" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon")[], "open" | "click" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<{
94
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon")[], "open" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<{
95
95
  show?: unknown;
96
96
  zIndex?: unknown;
97
97
  overlay?: unknown;
@@ -137,7 +137,6 @@ declare const _default: import("vue").DefineComponent<{
137
137
  overlayClass?: unknown;
138
138
  transition?: string | undefined;
139
139
  }> & {
140
- onClick?: ((...args: any[]) => any) | undefined;
141
140
  onOpen?: ((...args: any[]) => any) | undefined;
142
141
  onClose?: ((...args: any[]) => any) | undefined;
143
142
  onOpened?: ((...args: any[]) => any) | undefined;
package/es/popup/Popup.js CHANGED
@@ -29,7 +29,7 @@ export default defineComponent({
29
29
  name,
30
30
  inheritAttrs: false,
31
31
  props: popupProps,
32
- emits: ['open', 'close', 'click', 'opened', 'closed', 'update:show', 'click-overlay', 'click-close-icon'],
32
+ emits: ['open', 'close', 'opened', 'closed', 'update:show', 'click-overlay', 'click-close-icon'],
33
33
 
34
34
  setup(props, _ref) {
35
35
  var {
@@ -121,8 +121,6 @@ export default defineComponent({
121
121
  }
122
122
  };
123
123
 
124
- var onClick = event => emit('click', event);
125
-
126
124
  var onOpened = () => emit('opened');
127
125
 
128
126
  var onClosed = () => emit('closed');
@@ -141,8 +139,7 @@ export default defineComponent({
141
139
  [position]: position
142
140
  }), {
143
141
  'van-safe-area-bottom': safeAreaInsetBottom
144
- }],
145
- "onClick": onClick
142
+ }]
146
143
  }, attrs), [slots.default == null ? void 0 : slots.default(), renderCloseIcon()]), [[_vShow, props.show]]);
147
144
  });
148
145
 
@@ -42,7 +42,7 @@ export declare const Popup: import("../utils").WithInstall<import("vue").DefineC
42
42
  default: import("./Popup").PopupCloseIconPosition;
43
43
  };
44
44
  safeAreaInsetBottom: BooleanConstructor;
45
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "click" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon")[], "open" | "click" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<{
45
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("open" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon")[], "open" | "close" | "opened" | "closed" | "update:show" | "click-overlay" | "click-close-icon", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<{
46
46
  show?: unknown;
47
47
  zIndex?: unknown;
48
48
  overlay?: unknown;
@@ -88,7 +88,6 @@ export declare const Popup: import("../utils").WithInstall<import("vue").DefineC
88
88
  overlayClass?: unknown;
89
89
  transition?: string | undefined;
90
90
  }> & {
91
- onClick?: ((...args: any[]) => any) | undefined;
92
91
  onOpen?: ((...args: any[]) => any) | undefined;
93
92
  onClose?: ((...args: any[]) => any) | undefined;
94
93
  onOpened?: ((...args: any[]) => any) | undefined;
@@ -60,8 +60,8 @@ export default defineComponent({
60
60
  height: addUnit(strokeWidth)
61
61
  };
62
62
  var portionStyle = {
63
- background: background.value,
64
- transform: "scaleX(" + +percentage / 100 + ")"
63
+ width: percentage + "%",
64
+ background: background.value
65
65
  };
66
66
  return _createVNode("div", {
67
67
  "class": bem(),
package/es/rate/Rate.js CHANGED
@@ -172,8 +172,8 @@ export default defineComponent({
172
172
  "role": "radio",
173
173
  "style": style,
174
174
  "class": bem('item'),
175
- "tabindex": 0,
176
- "aria-setsize": +count,
175
+ "tabindex": disabled ? undefined : 0,
176
+ "aria-setsize": count,
177
177
  "aria-posinset": score,
178
178
  "aria-checked": !isVoid,
179
179
  "onClick": onClickItem
@@ -208,7 +208,9 @@ export default defineComponent({
208
208
  readonly: props.readonly,
209
209
  disabled: props.disabled
210
210
  }),
211
- "tabindex": 0,
211
+ "tabindex": props.disabled ? undefined : 0,
212
+ "aria-disabled": props.disabled,
213
+ "aria-readonly": props.readonly,
212
214
  "onTouchstart": onTouchStart,
213
215
  "onTouchmove": onTouchMove
214
216
  }, [list.value.map(renderStar)]);
@@ -4,6 +4,7 @@ import { ref, defineComponent } from 'vue'; // Utils
4
4
  import { pick, extend, truthProp, preventDefault, makeStringProp, createNamespace } from '../utils';
5
5
  import { fieldSharedProps } from '../field/Field'; // Composables
6
6
 
7
+ import { useId } from '../composables/use-id';
7
8
  import { useExpose } from '../composables/use-expose'; // Components
8
9
 
9
10
  import { Field } from '../field'; // Types
@@ -29,6 +30,7 @@ export default defineComponent({
29
30
  slots,
30
31
  attrs
31
32
  } = _ref;
33
+ var id = useId();
32
34
  var filedRef = ref();
33
35
 
34
36
  var onCancel = () => {
@@ -47,11 +49,13 @@ export default defineComponent({
47
49
  }
48
50
  };
49
51
 
52
+ var getInputId = () => props.id || id + "-input";
53
+
50
54
  var renderLabel = () => {
51
55
  if (slots.label || props.label) {
52
56
  return _createVNode("label", {
53
57
  "class": bem('label'),
54
- "for": props.id
58
+ "for": getInputId()
55
59
  }, [slots.label ? slots.label() : props.label]);
56
60
  }
57
61
  };
@@ -83,7 +87,9 @@ export default defineComponent({
83
87
  var fieldPropNames = Object.keys(fieldSharedProps);
84
88
 
85
89
  var renderField = () => {
86
- var fieldAttrs = extend({}, attrs, pick(props, fieldPropNames));
90
+ var fieldAttrs = extend({}, attrs, pick(props, fieldPropNames), {
91
+ id: getInputId()
92
+ });
87
93
 
88
94
  var onInput = value => emit('update:modelValue', value);
89
95
 
@@ -35,6 +35,7 @@ export default defineComponent({
35
35
  setActive
36
36
  });
37
37
  return () => _createVNode("div", {
38
+ "role": "tablist",
38
39
  "class": bem()
39
40
  }, [slots.default == null ? void 0 : slots.default()]);
40
41
  }
@@ -57,11 +57,14 @@ export default defineComponent({
57
57
  disabled
58
58
  } = props;
59
59
  var selected = index.value === parent.getActive();
60
- return _createVNode("a", {
60
+ return _createVNode("div", {
61
+ "role": "tab",
61
62
  "class": bem({
62
63
  select: selected,
63
64
  disabled
64
65
  }),
66
+ "tabindex": disabled ? undefined : 0,
67
+ "aria-selected": selected,
65
68
  "onClick": onClick
66
69
  }, [_createVNode(Badge, {
67
70
  "dot": dot,
@@ -285,10 +285,12 @@ export default defineComponent({
285
285
  return _createVNode("div", {
286
286
  "role": "slider",
287
287
  "class": getButtonClassName(index),
288
- "tabindex": props.disabled || props.readonly ? -1 : 0,
289
- "aria-valuemin": +props.min,
288
+ "tabindex": props.disabled ? undefined : 0,
289
+ "aria-valuemin": props.min,
290
290
  "aria-valuenow": current,
291
- "aria-valuemax": +props.max,
291
+ "aria-valuemax": props.max,
292
+ "aria-disabled": props.disabled || undefined,
293
+ "aria-readonly": props.readonly || undefined,
292
294
  "aria-orientation": props.vertical ? 'vertical' : 'horizontal',
293
295
  "onTouchstart": event => {
294
296
  if (typeof index === 'number') {
@@ -211,14 +211,14 @@ export default defineComponent({
211
211
  // fix mobile safari page scroll down issue
212
212
  // see: https://github.com/youzan/vant/issues/7690
213
213
  if (props.disableInput) {
214
- event.preventDefault();
214
+ preventDefault(event);
215
215
  }
216
216
  };
217
217
 
218
218
  var createListeners = type => ({
219
219
  onClick: event => {
220
220
  // disable double tap scrolling on mobile safari
221
- event.preventDefault();
221
+ preventDefault(event);
222
222
  actionType = type;
223
223
  onChange();
224
224
  },
@@ -230,7 +230,7 @@ export default defineComponent({
230
230
  onTouchcancel: onTouchEnd
231
231
  });
232
232
 
233
- watch([() => props.max, () => props.min, () => props.integer, () => props.decimalLength], check);
233
+ watch(() => [props.max, props.min, props.integer, props.decimalLength], check);
234
234
  watch(() => props.modelValue, value => {
235
235
  if (!isEqual(value, current.value)) {
236
236
  current.value = format(value);
@@ -244,6 +244,7 @@ export default defineComponent({
244
244
  });
245
245
  useCustomFieldValue(() => props.modelValue);
246
246
  return () => _createVNode("div", {
247
+ "role": "group",
247
248
  "class": bem([props.theme])
248
249
  }, [_withDirectives(_createVNode("button", _mergeProps({
249
250
  "type": "button",
@@ -252,7 +253,8 @@ export default defineComponent({
252
253
  disabled: minusDisabled.value
253
254
  }), {
254
255
  [HAPTICS_FEEDBACK]: !minusDisabled.value
255
- }]
256
+ }],
257
+ "aria-disabled": minusDisabled.value || undefined
256
258
  }, createListeners('minus')), null), [[_vShow, props.showMinus]]), _withDirectives(_createVNode("input", {
257
259
  "ref": inputRef,
258
260
  "type": props.integer ? 'tel' : 'text',
@@ -264,9 +266,9 @@ export default defineComponent({
264
266
  "readonly": props.disableInput,
265
267
  "inputmode": props.integer ? 'numeric' : 'decimal',
266
268
  "placeholder": props.placeholder,
267
- "aria-valuemax": +props.max,
268
- "aria-valuemin": +props.min,
269
- "aria-valuenow": +current.value,
269
+ "aria-valuemax": props.max,
270
+ "aria-valuemin": props.min,
271
+ "aria-valuenow": current.value,
270
272
  "onBlur": onBlur,
271
273
  "onInput": onInput,
272
274
  "onFocus": onFocus,
@@ -278,7 +280,8 @@ export default defineComponent({
278
280
  disabled: plusDisabled.value
279
281
  }), {
280
282
  [HAPTICS_FEEDBACK]: !plusDisabled.value
281
- }]
283
+ }],
284
+ "aria-disabled": plusDisabled.value || undefined
282
285
  }, createListeners('plus')), null), [[_vShow, props.showPlus]])]);
283
286
  }
284
287
 
@@ -1,5 +1,6 @@
1
1
  import { PropType, ExtractPropTypes } from 'vue';
2
2
  import { ButtonType } from '../button';
3
+ export declare type SubmitBarTextAlign = 'left' | 'right';
3
4
  declare const submitBarProps: {
4
5
  tip: StringConstructor;
5
6
  label: StringConstructor;
@@ -11,7 +12,7 @@ declare const submitBarProps: {
11
12
  default: string;
12
13
  };
13
14
  disabled: BooleanConstructor;
14
- textAlign: PropType<import("csstype").TextAlignProperty | undefined>;
15
+ textAlign: PropType<SubmitBarTextAlign>;
15
16
  buttonText: StringConstructor;
16
17
  buttonType: {
17
18
  type: PropType<ButtonType>;
@@ -40,7 +41,7 @@ declare const _default: import("vue").DefineComponent<{
40
41
  default: string;
41
42
  };
42
43
  disabled: BooleanConstructor;
43
- textAlign: PropType<import("csstype").TextAlignProperty | undefined>;
44
+ textAlign: PropType<SubmitBarTextAlign>;
44
45
  buttonText: StringConstructor;
45
46
  buttonType: {
46
47
  type: PropType<ButtonType>;
@@ -81,7 +82,7 @@ declare const _default: import("vue").DefineComponent<{
81
82
  } & {
82
83
  label?: string | undefined;
83
84
  price?: number | undefined;
84
- textAlign?: import("csstype").TextAlignProperty | undefined;
85
+ textAlign?: SubmitBarTextAlign | undefined;
85
86
  tip?: string | undefined;
86
87
  tipIcon?: string | undefined;
87
88
  buttonText?: string | undefined;
@@ -9,7 +9,7 @@ export declare const SubmitBar: import("../utils").WithInstall<import("vue").Def
9
9
  default: string;
10
10
  };
11
11
  disabled: BooleanConstructor;
12
- textAlign: import("vue").PropType<import("csstype").TextAlignProperty | undefined>;
12
+ textAlign: import("vue").PropType<import("./SubmitBar").SubmitBarTextAlign>;
13
13
  buttonText: StringConstructor;
14
14
  buttonType: {
15
15
  type: import("vue").PropType<import("..").ButtonType>;
@@ -50,7 +50,7 @@ export declare const SubmitBar: import("../utils").WithInstall<import("vue").Def
50
50
  } & {
51
51
  label?: string | undefined;
52
52
  price?: number | undefined;
53
- textAlign?: import("csstype").TextAlignProperty | undefined;
53
+ textAlign?: import("./SubmitBar").SubmitBarTextAlign | undefined;
54
54
  tip?: string | undefined;
55
55
  tipIcon?: string | undefined;
56
56
  buttonText?: string | undefined;
@@ -67,3 +67,4 @@ export declare const SubmitBar: import("../utils").WithInstall<import("vue").Def
67
67
  buttonType: import("..").ButtonType;
68
68
  }>>;
69
69
  export default SubmitBar;
70
+ export type { SubmitBarProps, SubmitBarTextAlign } from './SubmitBar';
package/es/swipe/Swipe.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { ref, watch, reactive, computed, onMounted, onActivated, onDeactivated, onBeforeUnmount, defineComponent } from 'vue'; // Utils
3
3
 
4
- import { clamp, isHidden, truthProp, numericProp, preventDefault, createNamespace, makeNumericProp } from '../utils'; // Composables
4
+ import { clamp, isHidden, truthProp, numericProp, windowWidth, windowHeight, preventDefault, createNamespace, makeNumericProp } from '../utils'; // Composables
5
5
 
6
- import { doubleRaf, useChildren, useWindowSize, usePageVisibility } from '@vant/use';
6
+ import { doubleRaf, useChildren, usePageVisibility } from '@vant/use';
7
7
  import { useTouch } from '../composables/use-touch';
8
8
  import { useExpose } from '../composables/use-expose';
9
9
  import { onPopupReopen } from '../composables/on-popup-reopen'; // Types
@@ -44,7 +44,6 @@ export default defineComponent({
44
44
  swiping: false
45
45
  });
46
46
  var touch = useTouch();
47
- var windowSize = useWindowSize();
48
47
  var {
49
48
  children,
50
49
  linkChildren
@@ -260,10 +259,16 @@ export default defineComponent({
260
259
 
261
260
  var onTouchMove = event => {
262
261
  if (props.touchable && state.swiping) {
263
- touch.move(event);
262
+ touch.move(event); // if user starting to touchmove, prevent the event bubbling to
263
+ // avoid affecting the parent components
264
264
 
265
- if (isCorrectDirection.value) {
265
+ var shouldPrevent = isCorrectDirection.value || touch.offsetY.value > touch.offsetX.value === props.vertical;
266
+
267
+ if (shouldPrevent) {
266
268
  preventDefault(event, props.stopPropagation);
269
+ }
270
+
271
+ if (isCorrectDirection.value) {
267
272
  move({
268
273
  offset: delta.value
269
274
  });
@@ -380,7 +385,7 @@ export default defineComponent({
380
385
  watch(() => props.initialSwipe, value => initialize(+value));
381
386
  watch(count, () => initialize(state.active));
382
387
  watch(() => props.autoplay, autoplay);
383
- watch([windowSize.width, windowSize.height], resize);
388
+ watch([windowWidth, windowHeight], resize);
384
389
  watch(usePageVisibility(), visible => {
385
390
  if (visible === 'visible') {
386
391
  autoplay();
@@ -19,9 +19,7 @@ export declare type SwipeExpose = {
19
19
  next: () => void;
20
20
  resize: () => void;
21
21
  swipeTo: (index: number, options?: SwipeToOptions) => void;
22
- /**
23
- * @private
24
- */
22
+ /** @private */
25
23
  state: SwipeState;
26
24
  };
27
25
  export declare type SwipeProvide = {
@@ -72,6 +72,7 @@ export default defineComponent({
72
72
  disabled
73
73
  }),
74
74
  "style": style,
75
+ "tabindex": disabled ? undefined : 0,
75
76
  "aria-checked": checked,
76
77
  "onClick": onClick
77
78
  }, [_createVNode("div", {
@@ -1 +1 @@
1
- :root{--van-switch-size:30px;--van-switch-width:2em;--van-switch-height:1em;--van-switch-node-size:1em;--van-switch-node-background-color:var(--van-white);--van-switch-node-box-shadow:0 3px 1px 0 rgba(0, 0, 0, 0.05),0 2px 2px 0 rgba(0, 0, 0, 0.1),0 3px 3px 0 rgba(0, 0, 0, 0.05);--van-switch-background-color:var(--van-background-color-light);--van-switch-on-background-color:var(--van-primary-color);--van-switch-transition-duration:var(--van-animation-duration-base);--van-switch-disabled-opacity:var(--van-disabled-opacity);--van-switch-border:var(--van-border-width-base) solid rgba(0, 0, 0, 0.1)}.van-switch{position:relative;display:inline-block;box-sizing:content-box;width:var(--van-switch-width);height:var(--van-switch-height);font-size:var(--van-switch-size);background:var(--van-switch-background-color);border:var(--van-switch-border);border-radius:var(--van-switch-node-size);cursor:pointer;transition:background-color var(--van-switch-transition-duration)}.van-switch__node{position:absolute;top:0;left:0;width:var(--van-switch-node-size);height:var(--van-switch-node-size);background:var(--van-switch-node-background-color);border-radius:100%;box-shadow:var(--van-switch-node-box-shadow);transition:transform var(--van-switch-transition-duration) cubic-bezier(.3, 1.05, .4, 1.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;line-height:1}.van-switch--on{background:var(--van-switch-on-background-color)}.van-switch--on .van-switch__node{transform:translateX(calc(var(--van-switch-width) - var(--van-switch-node-size)))}.van-switch--on .van-switch__loading{color:var(--van-switch-on-background-color)}.van-switch--disabled{cursor:not-allowed;opacity:var(--van-switch-disabled-opacity)}.van-switch--loading{cursor:default}
1
+ :root{--van-switch-size:30px;--van-switch-width:2em;--van-switch-height:1em;--van-switch-node-size:1em;--van-switch-node-background-color:var(--van-white);--van-switch-node-box-shadow:0 3px 1px 0 rgba(0, 0, 0, 0.05),0 2px 2px 0 rgba(0, 0, 0, 0.1),0 3px 3px 0 rgba(0, 0, 0, 0.05);--van-switch-background-color:var(--van-background-color-light);--van-switch-on-background-color:var(--van-primary-color);--van-switch-transition-duration:var(--van-animation-duration-base);--van-switch-disabled-opacity:var(--van-disabled-opacity);--van-switch-border:var(--van-border-width-base) solid rgba(0, 0, 0, 0.1)}.van-switch{position:relative;display:inline-block;box-sizing:content-box;width:var(--van-switch-width);height:var(--van-switch-height);font-size:var(--van-switch-size);background:var(--van-switch-background-color);border:var(--van-switch-border);border-radius:var(--van-switch-node-size);cursor:pointer;transition:background-color var(--van-switch-transition-duration)}.van-switch__node{position:absolute;top:0;left:0;width:var(--van-switch-node-size);height:var(--van-switch-node-size);font-size:inherit;background:var(--van-switch-node-background-color);border-radius:100%;box-shadow:var(--van-switch-node-box-shadow);transition:transform var(--van-switch-transition-duration) cubic-bezier(.3, 1.05, .4, 1.05)}.van-switch__loading{top:25%;left:25%;width:50%;height:50%;line-height:1}.van-switch--on{background:var(--van-switch-on-background-color)}.van-switch--on .van-switch__node{transform:translateX(calc(var(--van-switch-width) - var(--van-switch-node-size)))}.van-switch--on .van-switch__loading{color:var(--van-switch-on-background-color)}.van-switch--disabled{cursor:not-allowed;opacity:var(--van-switch-disabled-opacity)}.van-switch--loading{cursor:default}
@@ -33,6 +33,8 @@
33
33
  left: 0;
34
34
  width: var(--van-switch-node-size);
35
35
  height: var(--van-switch-node-size);
36
+ // https://github.com/youzan/vant/issues/9839
37
+ font-size: inherit;
36
38
  background: var(--van-switch-node-background-color);
37
39
  border-radius: 100%;
38
40
  box-shadow: var(--van-switch-node-box-shadow);
package/es/tab/Tab.js CHANGED
@@ -5,6 +5,8 @@ import { extend, truthProp, unknownProp, numericProp, createNamespace } from '..
5
5
  import { TABS_KEY } from '../tabs/Tabs'; // Composables
6
6
 
7
7
  import { useParent } from '@vant/use';
8
+ import { useId } from '../composables/use-id';
9
+ import { useExpose } from '../composables/use-expose';
8
10
  import { routeProps } from '../composables/use-route';
9
11
  import { TAB_STATUS_KEY } from '../composables/use-tab-status'; // Components
10
12
 
@@ -28,6 +30,7 @@ export default defineComponent({
28
30
  var {
29
31
  slots
30
32
  } = _ref;
33
+ var id = useId();
31
34
  var inited = ref(false);
32
35
  var {
33
36
  parent,
@@ -73,6 +76,7 @@ export default defineComponent({
73
76
  });
74
77
  provide(TAB_STATUS_KEY, active);
75
78
  return () => {
79
+ var label = parent.id + "-" + index.value;
76
80
  var {
77
81
  animated,
78
82
  swipeable,
@@ -88,23 +92,32 @@ export default defineComponent({
88
92
 
89
93
  if (animated || swipeable) {
90
94
  return _createVNode(SwipeItem, {
95
+ "id": id,
91
96
  "role": "tabpanel",
92
- "aria-hidden": !active.value,
93
- "class": bem('pane-wrapper', {
97
+ "class": bem('panel-wrapper', {
94
98
  inactive: !active.value
95
- })
99
+ }),
100
+ "tabindex": active.value ? 0 : -1,
101
+ "aria-hidden": !active.value,
102
+ "aria-labelledby": label
96
103
  }, {
97
104
  default: () => [_createVNode("div", {
98
- "class": bem('pane')
105
+ "class": bem('panel')
99
106
  }, [slots.default == null ? void 0 : slots.default()])]
100
107
  });
101
108
  }
102
109
 
103
110
  var shouldRender = inited.value || scrollspy || !lazyRender;
104
111
  var Content = shouldRender ? slots.default == null ? void 0 : slots.default() : null;
112
+ useExpose({
113
+ id
114
+ });
105
115
  return _withDirectives(_createVNode("div", {
116
+ "id": id,
106
117
  "role": "tabpanel",
107
- "class": bem('pane')
118
+ "class": bem('panel'),
119
+ "tabindex": show ? 0 : -1,
120
+ "aria-labelledby": label
108
121
  }, [Content]), [[_vShow, show]]);
109
122
  };
110
123
  }
package/es/tab/index.css CHANGED
@@ -1 +1 @@
1
- .van-tab__pane,.van-tab__pane-wrapper{flex-shrink:0;box-sizing:border-box;width:100%}.van-tab__pane-wrapper--inactive{height:0;overflow:visible}
1
+ .van-tab__panel,.van-tab__panel-wrapper{flex-shrink:0;box-sizing:border-box;width:100%}.van-tab__panel-wrapper--inactive{height:0;overflow:visible}
package/es/tab/index.less CHANGED
@@ -1,5 +1,5 @@
1
1
  .van-tab {
2
- &__pane {
2
+ &__panel {
3
3
  &,
4
4
  &-wrapper {
5
5
  flex-shrink: 0;