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
  }, {
@@ -8,18 +8,19 @@ var _vue = require("vue");
8
8
  var _utils = require("../utils");
9
9
 
10
10
  var [name, bem] = (0, _utils.createNamespace)('password-input');
11
+ var passwordInputProps = {
12
+ info: String,
13
+ mask: _utils.truthProp,
14
+ value: (0, _utils.makeStringProp)(''),
15
+ gutter: _utils.numericProp,
16
+ length: (0, _utils.makeNumericProp)(6),
17
+ focused: Boolean,
18
+ errorInfo: String
19
+ };
11
20
 
12
21
  var _default = (0, _vue.defineComponent)({
13
22
  name,
14
- props: {
15
- info: String,
16
- mask: _utils.truthProp,
17
- value: (0, _utils.makeStringProp)(''),
18
- gutter: _utils.numericProp,
19
- length: (0, _utils.makeNumericProp)(6),
20
- focused: Boolean,
21
- errorInfo: String
22
- },
23
+ props: passwordInputProps,
23
24
  emits: ['focus'],
24
25
 
25
26
  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';
@@ -145,6 +145,8 @@ var _default = (0, _vue.defineComponent)({
145
145
  "style": {
146
146
  color
147
147
  },
148
+ "tabindex": disabled ? undefined : 0,
149
+ "aria-disabled": disabled || undefined,
148
150
  "onClick": () => onClickAction(action, index)
149
151
  }, [icon && (0, _vue.createVNode)(_icon.Icon, {
150
152
  "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;
@@ -44,7 +44,7 @@ var _default = (0, _vue.defineComponent)({
44
44
  name,
45
45
  inheritAttrs: false,
46
46
  props: popupProps,
47
- emits: ['open', 'close', 'click', 'opened', 'closed', 'update:show', 'click-overlay', 'click-close-icon'],
47
+ emits: ['open', 'close', 'opened', 'closed', 'update:show', 'click-overlay', 'click-close-icon'],
48
48
 
49
49
  setup(props, _ref) {
50
50
  var {
@@ -136,8 +136,6 @@ var _default = (0, _vue.defineComponent)({
136
136
  }
137
137
  };
138
138
 
139
- var onClick = event => emit('click', event);
140
-
141
139
  var onOpened = () => emit('opened');
142
140
 
143
141
  var onClosed = () => emit('closed');
@@ -156,8 +154,7 @@ var _default = (0, _vue.defineComponent)({
156
154
  [position]: position
157
155
  }), {
158
156
  'van-safe-area-bottom': safeAreaInsetBottom
159
- }],
160
- "onClick": onClick
157
+ }]
161
158
  }, attrs), [slots.default == null ? void 0 : slots.default(), renderCloseIcon()]), [[_vue.vShow, props.show]]);
162
159
  });
163
160
 
@@ -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;
@@ -67,8 +67,8 @@ var _default = (0, _vue.defineComponent)({
67
67
  height: (0, _utils.addUnit)(strokeWidth)
68
68
  };
69
69
  var portionStyle = {
70
- background: background.value,
71
- transform: "scaleX(" + +percentage / 100 + ")"
70
+ width: percentage + "%",
71
+ background: background.value
72
72
  };
73
73
  return (0, _vue.createVNode)("div", {
74
74
  "class": bem(),
package/lib/rate/Rate.js CHANGED
@@ -183,8 +183,8 @@ var _default = (0, _vue.defineComponent)({
183
183
  "role": "radio",
184
184
  "style": style,
185
185
  "class": bem('item'),
186
- "tabindex": 0,
187
- "aria-setsize": +count,
186
+ "tabindex": disabled ? undefined : 0,
187
+ "aria-setsize": count,
188
188
  "aria-posinset": score,
189
189
  "aria-checked": !isVoid,
190
190
  "onClick": onClickItem
@@ -219,7 +219,9 @@ var _default = (0, _vue.defineComponent)({
219
219
  readonly: props.readonly,
220
220
  disabled: props.disabled
221
221
  }),
222
- "tabindex": 0,
222
+ "tabindex": props.disabled ? undefined : 0,
223
+ "aria-disabled": props.disabled,
224
+ "aria-readonly": props.readonly,
223
225
  "onTouchstart": onTouchStart,
224
226
  "onTouchmove": onTouchMove
225
227
  }, [list.value.map(renderStar)]);
@@ -9,6 +9,8 @@ var _utils = require("../utils");
9
9
 
10
10
  var _Field = require("../field/Field");
11
11
 
12
+ var _useId = require("../composables/use-id");
13
+
12
14
  var _useExpose = require("../composables/use-expose");
13
15
 
14
16
  var _field = require("../field");
@@ -38,6 +40,7 @@ var _default = (0, _vue.defineComponent)({
38
40
  slots,
39
41
  attrs
40
42
  } = _ref;
43
+ var id = (0, _useId.useId)();
41
44
  var filedRef = (0, _vue.ref)();
42
45
 
43
46
  var onCancel = () => {
@@ -56,11 +59,13 @@ var _default = (0, _vue.defineComponent)({
56
59
  }
57
60
  };
58
61
 
62
+ var getInputId = () => props.id || id + "-input";
63
+
59
64
  var renderLabel = () => {
60
65
  if (slots.label || props.label) {
61
66
  return (0, _vue.createVNode)("label", {
62
67
  "class": bem('label'),
63
- "for": props.id
68
+ "for": getInputId()
64
69
  }, [slots.label ? slots.label() : props.label]);
65
70
  }
66
71
  };
@@ -92,7 +97,9 @@ var _default = (0, _vue.defineComponent)({
92
97
  var fieldPropNames = Object.keys(_Field.fieldSharedProps);
93
98
 
94
99
  var renderField = () => {
95
- var fieldAttrs = (0, _utils.extend)({}, attrs, (0, _utils.pick)(props, fieldPropNames));
100
+ var fieldAttrs = (0, _utils.extend)({}, attrs, (0, _utils.pick)(props, fieldPropNames), {
101
+ id: getInputId()
102
+ });
96
103
 
97
104
  var onInput = value => emit('update:modelValue', value);
98
105
 
@@ -44,6 +44,7 @@ var _default = (0, _vue.defineComponent)({
44
44
  setActive
45
45
  });
46
46
  return () => (0, _vue.createVNode)("div", {
47
+ "role": "tablist",
47
48
  "class": bem()
48
49
  }, [slots.default == null ? void 0 : slots.default()]);
49
50
  }
@@ -68,11 +68,14 @@ var _default = (0, _vue.defineComponent)({
68
68
  disabled
69
69
  } = props;
70
70
  var selected = index.value === parent.getActive();
71
- return (0, _vue.createVNode)("a", {
71
+ return (0, _vue.createVNode)("div", {
72
+ "role": "tab",
72
73
  "class": bem({
73
74
  select: selected,
74
75
  disabled
75
76
  }),
77
+ "tabindex": disabled ? undefined : 0,
78
+ "aria-selected": selected,
76
79
  "onClick": onClick
77
80
  }, [(0, _vue.createVNode)(_badge.Badge, {
78
81
  "dot": dot,
@@ -294,10 +294,12 @@ var _default = (0, _vue.defineComponent)({
294
294
  return (0, _vue.createVNode)("div", {
295
295
  "role": "slider",
296
296
  "class": getButtonClassName(index),
297
- "tabindex": props.disabled || props.readonly ? -1 : 0,
298
- "aria-valuemin": +props.min,
297
+ "tabindex": props.disabled ? undefined : 0,
298
+ "aria-valuemin": props.min,
299
299
  "aria-valuenow": current,
300
- "aria-valuemax": +props.max,
300
+ "aria-valuemax": props.max,
301
+ "aria-disabled": props.disabled || undefined,
302
+ "aria-readonly": props.readonly || undefined,
301
303
  "aria-orientation": props.vertical ? 'vertical' : 'horizontal',
302
304
  "onTouchstart": event => {
303
305
  if (typeof index === 'number') {
@@ -219,14 +219,14 @@ var _default = (0, _vue.defineComponent)({
219
219
  // fix mobile safari page scroll down issue
220
220
  // see: https://github.com/youzan/vant/issues/7690
221
221
  if (props.disableInput) {
222
- event.preventDefault();
222
+ (0, _utils.preventDefault)(event);
223
223
  }
224
224
  };
225
225
 
226
226
  var createListeners = type => ({
227
227
  onClick: event => {
228
228
  // disable double tap scrolling on mobile safari
229
- event.preventDefault();
229
+ (0, _utils.preventDefault)(event);
230
230
  actionType = type;
231
231
  onChange();
232
232
  },
@@ -238,7 +238,7 @@ var _default = (0, _vue.defineComponent)({
238
238
  onTouchcancel: onTouchEnd
239
239
  });
240
240
 
241
- (0, _vue.watch)([() => props.max, () => props.min, () => props.integer, () => props.decimalLength], check);
241
+ (0, _vue.watch)(() => [props.max, props.min, props.integer, props.decimalLength], check);
242
242
  (0, _vue.watch)(() => props.modelValue, value => {
243
243
  if (!isEqual(value, current.value)) {
244
244
  current.value = format(value);
@@ -252,6 +252,7 @@ var _default = (0, _vue.defineComponent)({
252
252
  });
253
253
  (0, _use.useCustomFieldValue)(() => props.modelValue);
254
254
  return () => (0, _vue.createVNode)("div", {
255
+ "role": "group",
255
256
  "class": bem([props.theme])
256
257
  }, [(0, _vue.withDirectives)((0, _vue.createVNode)("button", (0, _vue.mergeProps)({
257
258
  "type": "button",
@@ -260,7 +261,8 @@ var _default = (0, _vue.defineComponent)({
260
261
  disabled: minusDisabled.value
261
262
  }), {
262
263
  [_utils.HAPTICS_FEEDBACK]: !minusDisabled.value
263
- }]
264
+ }],
265
+ "aria-disabled": minusDisabled.value || undefined
264
266
  }, createListeners('minus')), null), [[_vue.vShow, props.showMinus]]), (0, _vue.withDirectives)((0, _vue.createVNode)("input", {
265
267
  "ref": inputRef,
266
268
  "type": props.integer ? 'tel' : 'text',
@@ -272,9 +274,9 @@ var _default = (0, _vue.defineComponent)({
272
274
  "readonly": props.disableInput,
273
275
  "inputmode": props.integer ? 'numeric' : 'decimal',
274
276
  "placeholder": props.placeholder,
275
- "aria-valuemax": +props.max,
276
- "aria-valuemin": +props.min,
277
- "aria-valuenow": +current.value,
277
+ "aria-valuemax": props.max,
278
+ "aria-valuemin": props.min,
279
+ "aria-valuenow": current.value,
278
280
  "onBlur": onBlur,
279
281
  "onInput": onInput,
280
282
  "onFocus": onFocus,
@@ -286,7 +288,8 @@ var _default = (0, _vue.defineComponent)({
286
288
  disabled: plusDisabled.value
287
289
  }), {
288
290
  [_utils.HAPTICS_FEEDBACK]: !plusDisabled.value
289
- }]
291
+ }],
292
+ "aria-disabled": plusDisabled.value || undefined
290
293
  }, createListeners('plus')), null), [[_vue.vShow, props.showPlus]])]);
291
294
  }
292
295
 
@@ -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';
@@ -55,7 +55,6 @@ var _default = (0, _vue.defineComponent)({
55
55
  swiping: false
56
56
  });
57
57
  var touch = (0, _useTouch.useTouch)();
58
- var windowSize = (0, _use.useWindowSize)();
59
58
  var {
60
59
  children,
61
60
  linkChildren
@@ -271,10 +270,16 @@ var _default = (0, _vue.defineComponent)({
271
270
 
272
271
  var onTouchMove = event => {
273
272
  if (props.touchable && state.swiping) {
274
- touch.move(event);
273
+ touch.move(event); // if user starting to touchmove, prevent the event bubbling to
274
+ // avoid affecting the parent components
275
275
 
276
- if (isCorrectDirection.value) {
276
+ var shouldPrevent = isCorrectDirection.value || touch.offsetY.value > touch.offsetX.value === props.vertical;
277
+
278
+ if (shouldPrevent) {
277
279
  (0, _utils.preventDefault)(event, props.stopPropagation);
280
+ }
281
+
282
+ if (isCorrectDirection.value) {
278
283
  move({
279
284
  offset: delta.value
280
285
  });
@@ -391,7 +396,7 @@ var _default = (0, _vue.defineComponent)({
391
396
  (0, _vue.watch)(() => props.initialSwipe, value => initialize(+value));
392
397
  (0, _vue.watch)(count, () => initialize(state.active));
393
398
  (0, _vue.watch)(() => props.autoplay, autoplay);
394
- (0, _vue.watch)([windowSize.width, windowSize.height], resize);
399
+ (0, _vue.watch)([_utils.windowWidth, _utils.windowHeight], resize);
395
400
  (0, _vue.watch)((0, _use.usePageVisibility)(), visible => {
396
401
  if (visible === 'visible') {
397
402
  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 = {
@@ -81,6 +81,7 @@ var _default = (0, _vue.defineComponent)({
81
81
  disabled
82
82
  }),
83
83
  "style": style,
84
+ "tabindex": disabled ? undefined : 0,
84
85
  "aria-checked": checked,
85
86
  "onClick": onClick
86
87
  }, [(0, _vue.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/lib/tab/Tab.js CHANGED
@@ -11,6 +11,10 @@ var _Tabs = require("../tabs/Tabs");
11
11
 
12
12
  var _use = require("@vant/use");
13
13
 
14
+ var _useId = require("../composables/use-id");
15
+
16
+ var _useExpose = require("../composables/use-expose");
17
+
14
18
  var _useRoute = require("../composables/use-route");
15
19
 
16
20
  var _useTabStatus = require("../composables/use-tab-status");
@@ -40,6 +44,7 @@ var _default = (0, _vue.defineComponent)({
40
44
  var {
41
45
  slots
42
46
  } = _ref;
47
+ var id = (0, _useId.useId)();
43
48
  var inited = (0, _vue.ref)(false);
44
49
  var {
45
50
  parent,
@@ -85,6 +90,7 @@ var _default = (0, _vue.defineComponent)({
85
90
  });
86
91
  (0, _vue.provide)(_useTabStatus.TAB_STATUS_KEY, active);
87
92
  return () => {
93
+ var label = parent.id + "-" + index.value;
88
94
  var {
89
95
  animated,
90
96
  swipeable,
@@ -100,23 +106,32 @@ var _default = (0, _vue.defineComponent)({
100
106
 
101
107
  if (animated || swipeable) {
102
108
  return (0, _vue.createVNode)(_swipeItem.SwipeItem, {
109
+ "id": id,
103
110
  "role": "tabpanel",
104
- "aria-hidden": !active.value,
105
- "class": bem('pane-wrapper', {
111
+ "class": bem('panel-wrapper', {
106
112
  inactive: !active.value
107
- })
113
+ }),
114
+ "tabindex": active.value ? 0 : -1,
115
+ "aria-hidden": !active.value,
116
+ "aria-labelledby": label
108
117
  }, {
109
118
  default: () => [(0, _vue.createVNode)("div", {
110
- "class": bem('pane')
119
+ "class": bem('panel')
111
120
  }, [slots.default == null ? void 0 : slots.default()])]
112
121
  });
113
122
  }
114
123
 
115
124
  var shouldRender = inited.value || scrollspy || !lazyRender;
116
125
  var Content = shouldRender ? slots.default == null ? void 0 : slots.default() : null;
126
+ (0, _useExpose.useExpose)({
127
+ id
128
+ });
117
129
  return (0, _vue.withDirectives)((0, _vue.createVNode)("div", {
130
+ "id": id,
118
131
  "role": "tabpanel",
119
- "class": bem('pane')
132
+ "class": bem('panel'),
133
+ "tabindex": show ? 0 : -1,
134
+ "aria-labelledby": label
120
135
  }, [Content]), [[_vue.vShow, show]]);
121
136
  };
122
137
  }
package/lib/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}
@@ -1,5 +1,5 @@
1
1
  .van-tab {
2
- &__pane {
2
+ &__panel {
3
3
  &,
4
4
  &-wrapper {
5
5
  flex-shrink: 0;