vant 4.6.6 → 4.6.8

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 (136) hide show
  1. package/README.md +1 -1
  2. package/es/action-sheet/ActionSheet.d.ts +1 -1
  3. package/es/action-sheet/index.d.ts +1 -1
  4. package/es/address-edit/AddressEditDetail.d.ts +1 -1
  5. package/es/address-list/AddressList.d.ts +1 -1
  6. package/es/address-list/index.d.ts +1 -1
  7. package/es/button/Button.d.ts +2 -2
  8. package/es/button/index.d.ts +2 -2
  9. package/es/calendar/Calendar.d.ts +1 -1
  10. package/es/calendar/index.d.ts +1 -1
  11. package/es/cell/Cell.d.ts +1 -1
  12. package/es/cell/index.css +1 -1
  13. package/es/cell/index.d.ts +1 -1
  14. package/es/cell-group/CellGroup.d.ts +1 -1
  15. package/es/cell-group/index.d.ts +1 -1
  16. package/es/checkbox/Checkbox.d.ts +13 -0
  17. package/es/checkbox/Checkbox.mjs +11 -2
  18. package/es/checkbox/Checker.d.ts +9 -0
  19. package/es/checkbox/Checker.mjs +10 -4
  20. package/es/checkbox/index.css +1 -1
  21. package/es/checkbox/index.d.ts +9 -0
  22. package/es/collapse-item/CollapseItem.d.ts +1 -1
  23. package/es/collapse-item/index.d.ts +1 -1
  24. package/es/config-provider/ConfigProvider.d.ts +14 -0
  25. package/es/config-provider/ConfigProvider.mjs +35 -2
  26. package/es/config-provider/index.d.ts +10 -1
  27. package/es/config-provider/types.d.ts +61 -1
  28. package/es/contact-list/ContactList.d.ts +1 -1
  29. package/es/contact-list/index.d.ts +1 -1
  30. package/es/divider/Divider.d.ts +1 -1
  31. package/es/divider/index.d.ts +1 -1
  32. package/es/field/Field.d.ts +1 -1
  33. package/es/field/index.d.ts +1 -1
  34. package/es/grid/Grid.d.ts +1 -1
  35. package/es/grid/index.d.ts +1 -1
  36. package/es/image/Image.d.ts +1 -1
  37. package/es/image/index.d.ts +1 -1
  38. package/es/index.d.ts +1 -1
  39. package/es/index.mjs +1 -1
  40. package/es/nav-bar/NavBar.d.ts +8 -0
  41. package/es/nav-bar/NavBar.mjs +18 -4
  42. package/es/nav-bar/index.css +1 -1
  43. package/es/nav-bar/index.d.ts +6 -0
  44. package/es/number-keyboard/NumberKeyboard.d.ts +2 -2
  45. package/es/number-keyboard/index.d.ts +2 -2
  46. package/es/popup/Popup.d.ts +1 -1
  47. package/es/popup/index.d.ts +1 -1
  48. package/es/share-sheet/ShareSheet.d.ts +1 -1
  49. package/es/share-sheet/index.d.ts +1 -1
  50. package/es/signature/Signature.d.ts +1 -1
  51. package/es/signature/index.d.ts +1 -1
  52. package/es/skeleton/Skeleton.d.ts +1 -1
  53. package/es/skeleton/index.d.ts +1 -1
  54. package/es/slider/Slider.d.ts +1 -1
  55. package/es/slider/index.d.ts +1 -1
  56. package/es/space/Space.d.ts +4 -4
  57. package/es/space/index.d.ts +3 -3
  58. package/es/stepper/Stepper.d.ts +2 -2
  59. package/es/stepper/index.d.ts +2 -2
  60. package/es/tabs/Tabs.d.ts +1 -1
  61. package/es/tabs/index.d.ts +1 -1
  62. package/es/tag/Tag.d.ts +1 -1
  63. package/es/tag/index.d.ts +1 -1
  64. package/es/uploader/Uploader.d.ts +1 -1
  65. package/es/uploader/index.d.ts +1 -1
  66. package/lib/action-sheet/ActionSheet.d.ts +1 -1
  67. package/lib/action-sheet/index.d.ts +1 -1
  68. package/lib/address-edit/AddressEditDetail.d.ts +1 -1
  69. package/lib/address-list/AddressList.d.ts +1 -1
  70. package/lib/address-list/index.d.ts +1 -1
  71. package/lib/button/Button.d.ts +2 -2
  72. package/lib/button/index.d.ts +2 -2
  73. package/lib/calendar/Calendar.d.ts +1 -1
  74. package/lib/calendar/index.d.ts +1 -1
  75. package/lib/cell/Cell.d.ts +1 -1
  76. package/lib/cell/index.css +1 -1
  77. package/lib/cell/index.d.ts +1 -1
  78. package/lib/cell-group/CellGroup.d.ts +1 -1
  79. package/lib/cell-group/index.d.ts +1 -1
  80. package/lib/checkbox/Checkbox.d.ts +13 -0
  81. package/lib/checkbox/Checkbox.js +11 -2
  82. package/lib/checkbox/Checker.d.ts +9 -0
  83. package/lib/checkbox/Checker.js +10 -4
  84. package/lib/checkbox/index.css +1 -1
  85. package/lib/checkbox/index.d.ts +9 -0
  86. package/lib/collapse-item/CollapseItem.d.ts +1 -1
  87. package/lib/collapse-item/index.d.ts +1 -1
  88. package/lib/config-provider/ConfigProvider.d.ts +14 -0
  89. package/lib/config-provider/ConfigProvider.js +35 -2
  90. package/lib/config-provider/index.d.ts +10 -1
  91. package/lib/config-provider/types.d.ts +61 -1
  92. package/lib/contact-list/ContactList.d.ts +1 -1
  93. package/lib/contact-list/index.d.ts +1 -1
  94. package/lib/divider/Divider.d.ts +1 -1
  95. package/lib/divider/index.d.ts +1 -1
  96. package/lib/field/Field.d.ts +1 -1
  97. package/lib/field/index.d.ts +1 -1
  98. package/lib/grid/Grid.d.ts +1 -1
  99. package/lib/grid/index.d.ts +1 -1
  100. package/lib/image/Image.d.ts +1 -1
  101. package/lib/image/index.d.ts +1 -1
  102. package/lib/index.css +1 -1
  103. package/lib/index.d.ts +1 -1
  104. package/lib/index.js +1 -1
  105. package/lib/nav-bar/NavBar.d.ts +8 -0
  106. package/lib/nav-bar/NavBar.js +18 -4
  107. package/lib/nav-bar/index.css +1 -1
  108. package/lib/nav-bar/index.d.ts +6 -0
  109. package/lib/number-keyboard/NumberKeyboard.d.ts +2 -2
  110. package/lib/number-keyboard/index.d.ts +2 -2
  111. package/lib/popup/Popup.d.ts +1 -1
  112. package/lib/popup/index.d.ts +1 -1
  113. package/lib/share-sheet/ShareSheet.d.ts +1 -1
  114. package/lib/share-sheet/index.d.ts +1 -1
  115. package/lib/signature/Signature.d.ts +1 -1
  116. package/lib/signature/index.d.ts +1 -1
  117. package/lib/skeleton/Skeleton.d.ts +1 -1
  118. package/lib/skeleton/index.d.ts +1 -1
  119. package/lib/slider/Slider.d.ts +1 -1
  120. package/lib/slider/index.d.ts +1 -1
  121. package/lib/space/Space.d.ts +4 -4
  122. package/lib/space/index.d.ts +3 -3
  123. package/lib/stepper/Stepper.d.ts +2 -2
  124. package/lib/stepper/index.d.ts +2 -2
  125. package/lib/tabs/Tabs.d.ts +1 -1
  126. package/lib/tabs/index.d.ts +1 -1
  127. package/lib/tag/Tag.d.ts +1 -1
  128. package/lib/tag/index.d.ts +1 -1
  129. package/lib/uploader/Uploader.d.ts +1 -1
  130. package/lib/uploader/index.d.ts +1 -1
  131. package/lib/vant.cjs.js +75 -13
  132. package/lib/vant.es.js +75 -13
  133. package/lib/vant.js +75 -13
  134. package/lib/vant.min.js +1 -1
  135. package/lib/web-types.json +1 -1
  136. package/package.json +18 -10
package/lib/vant.cjs.js CHANGED
@@ -629,15 +629,32 @@ const configProviderProps = {
629
629
  themeVars: Object,
630
630
  themeVarsDark: Object,
631
631
  themeVarsLight: Object,
632
+ themeVarsScope: makeStringProp("local"),
632
633
  iconPrefix: String
633
634
  };
635
+ function insertDash(str) {
636
+ return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
637
+ }
634
638
  function mapThemeVarsToCSSVars(themeVars) {
635
639
  const cssVars = {};
636
640
  Object.keys(themeVars).forEach((key) => {
637
- cssVars[`--van-${kebabCase(key)}`] = themeVars[key];
641
+ const formattedKey = insertDash(kebabCase(key));
642
+ cssVars[`--van-${formattedKey}`] = themeVars[key];
638
643
  });
639
644
  return cssVars;
640
645
  }
646
+ function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
647
+ Object.keys(newStyle).forEach((key) => {
648
+ if (newStyle[key] !== oldStyle[key]) {
649
+ document.documentElement.style.setProperty(key, newStyle[key]);
650
+ }
651
+ });
652
+ Object.keys(oldStyle).forEach((key) => {
653
+ if (!newStyle[key]) {
654
+ document.documentElement.style.removeProperty(key);
655
+ }
656
+ });
657
+ }
641
658
  var stdin_default$1R = vue.defineComponent({
642
659
  name: name$1H,
643
660
  props: configProviderProps,
@@ -663,6 +680,22 @@ var stdin_default$1R = vue.defineComponent({
663
680
  vue.onActivated(addTheme);
664
681
  vue.onDeactivated(removeTheme);
665
682
  vue.onBeforeUnmount(removeTheme);
683
+ vue.watch(style, (newStyle, oldStyle) => {
684
+ if (props2.themeVarsScope === "global") {
685
+ syncThemeVarsOnRoot(newStyle, oldStyle);
686
+ }
687
+ });
688
+ vue.watch(() => props2.themeVarsScope, (newScope, oldScope) => {
689
+ if (oldScope === "global") {
690
+ syncThemeVarsOnRoot({}, style.value);
691
+ }
692
+ if (newScope === "global") {
693
+ syncThemeVarsOnRoot(style.value, {});
694
+ }
695
+ });
696
+ if (props2.themeVarsScope === "global") {
697
+ syncThemeVarsOnRoot(style.value, {});
698
+ }
666
699
  }
667
700
  vue.provide(CONFIG_PROVIDER_KEY, props2);
668
701
  vue.watchEffect(() => {
@@ -672,7 +705,7 @@ var stdin_default$1R = vue.defineComponent({
672
705
  });
673
706
  return () => vue.createVNode(props2.tag, {
674
707
  "class": bem$1C(),
675
- "style": style.value
708
+ "style": props2.themeVarsScope === "local" ? style.value : void 0
676
709
  }, {
677
710
  default: () => {
678
711
  var _a;
@@ -5315,7 +5348,11 @@ var stdin_default$1n = vue.defineComponent({
5315
5348
  shape: String,
5316
5349
  parent: Object,
5317
5350
  checked: Boolean,
5318
- bindGroup: truthProp
5351
+ bindGroup: truthProp,
5352
+ indeterminate: {
5353
+ type: Boolean,
5354
+ default: null
5355
+ }
5319
5356
  }),
5320
5357
  emits: ["click", "toggle"],
5321
5358
  setup(props2, {
@@ -5369,14 +5406,16 @@ var stdin_default$1n = vue.defineComponent({
5369
5406
  var _a, _b;
5370
5407
  const {
5371
5408
  bem: bem2,
5372
- checked
5409
+ checked,
5410
+ indeterminate
5373
5411
  } = props2;
5374
5412
  const iconSize = props2.iconSize || getParentProp("iconSize");
5375
5413
  return vue.createVNode("div", {
5376
5414
  "ref": iconRef,
5377
5415
  "class": bem2("icon", [shape.value, {
5378
5416
  disabled: disabled.value,
5379
- checked
5417
+ checked,
5418
+ indeterminate
5380
5419
  }]),
5381
5420
  "style": shape.value !== "dot" ? {
5382
5421
  fontSize: addUnit(iconSize)
@@ -5389,7 +5428,7 @@ var stdin_default$1n = vue.defineComponent({
5389
5428
  checked,
5390
5429
  disabled: disabled.value
5391
5430
  }) : shape.value !== "dot" ? vue.createVNode(Icon, {
5392
- "name": "success",
5431
+ "name": indeterminate ? "minus" : "success",
5393
5432
  "style": iconStyle.value
5394
5433
  }, null) : vue.createVNode("div", {
5395
5434
  "class": bem2("icon--dot__icon"),
@@ -7485,7 +7524,11 @@ var stdin_default$19 = vue.defineComponent({
7485
7524
  const [name$$, bem$_] = createNamespace("checkbox");
7486
7525
  const checkboxProps = extend({}, checkerProps, {
7487
7526
  shape: String,
7488
- bindGroup: truthProp
7527
+ bindGroup: truthProp,
7528
+ indeterminate: {
7529
+ type: Boolean,
7530
+ default: null
7531
+ }
7489
7532
  });
7490
7533
  var stdin_default$18 = vue.defineComponent({
7491
7534
  name: name$$,
@@ -7537,8 +7580,13 @@ var stdin_default$18 = vue.defineComponent({
7537
7580
  } else {
7538
7581
  emit("update:modelValue", newValue);
7539
7582
  }
7583
+ if (props2.indeterminate !== null)
7584
+ emit("change", newValue);
7540
7585
  };
7541
- vue.watch(() => props2.modelValue, (value) => emit("change", value));
7586
+ vue.watch(() => props2.modelValue, (value) => {
7587
+ if (props2.indeterminate === null)
7588
+ emit("change", value);
7589
+ });
7542
7590
  useExpose({
7543
7591
  toggle,
7544
7592
  props: props2,
@@ -11160,6 +11208,8 @@ const navBarProps = {
11160
11208
  border: truthProp,
11161
11209
  leftText: String,
11162
11210
  rightText: String,
11211
+ leftDisabled: Boolean,
11212
+ rightDisabled: Boolean,
11163
11213
  leftArrow: Boolean,
11164
11214
  placeholder: Boolean,
11165
11215
  safeAreaInsetTop: Boolean,
@@ -11175,8 +11225,16 @@ var stdin_default$I = vue.defineComponent({
11175
11225
  }) {
11176
11226
  const navBarRef = vue.ref();
11177
11227
  const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
11178
- const onClickLeft = (event) => emit("clickLeft", event);
11179
- const onClickRight = (event) => emit("clickRight", event);
11228
+ const onClickLeft = (event) => {
11229
+ if (!props2.leftDisabled) {
11230
+ emit("clickLeft", event);
11231
+ }
11232
+ };
11233
+ const onClickRight = (event) => {
11234
+ if (!props2.rightDisabled) {
11235
+ emit("clickRight", event);
11236
+ }
11237
+ };
11180
11238
  const renderLeft = () => {
11181
11239
  if (slots.left) {
11182
11240
  return slots.left();
@@ -11218,12 +11276,16 @@ var stdin_default$I = vue.defineComponent({
11218
11276
  }, [vue.createVNode("div", {
11219
11277
  "class": bem$z("content")
11220
11278
  }, [hasLeft && vue.createVNode("div", {
11221
- "class": [bem$z("left"), props2.clickable ? HAPTICS_FEEDBACK : ""],
11279
+ "class": [bem$z("left", {
11280
+ disabled: props2.leftDisabled
11281
+ }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
11222
11282
  "onClick": onClickLeft
11223
11283
  }, [renderLeft()]), vue.createVNode("div", {
11224
11284
  "class": [bem$z("title"), "van-ellipsis"]
11225
11285
  }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
11226
- "class": [bem$z("right"), props2.clickable ? HAPTICS_FEEDBACK : ""],
11286
+ "class": [bem$z("right", {
11287
+ disabled: props2.rightDisabled
11288
+ }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
11227
11289
  "onClick": onClickRight
11228
11290
  }, [renderRight()])])]);
11229
11291
  };
@@ -16413,7 +16475,7 @@ const Lazyload = {
16413
16475
  });
16414
16476
  }
16415
16477
  };
16416
- const version = "4.6.6";
16478
+ const version = "4.6.8";
16417
16479
  function install(app) {
16418
16480
  const components = [
16419
16481
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -627,15 +627,32 @@ const configProviderProps = {
627
627
  themeVars: Object,
628
628
  themeVarsDark: Object,
629
629
  themeVarsLight: Object,
630
+ themeVarsScope: makeStringProp("local"),
630
631
  iconPrefix: String
631
632
  };
633
+ function insertDash(str) {
634
+ return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
635
+ }
632
636
  function mapThemeVarsToCSSVars(themeVars) {
633
637
  const cssVars = {};
634
638
  Object.keys(themeVars).forEach((key) => {
635
- cssVars[`--van-${kebabCase(key)}`] = themeVars[key];
639
+ const formattedKey = insertDash(kebabCase(key));
640
+ cssVars[`--van-${formattedKey}`] = themeVars[key];
636
641
  });
637
642
  return cssVars;
638
643
  }
644
+ function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
645
+ Object.keys(newStyle).forEach((key) => {
646
+ if (newStyle[key] !== oldStyle[key]) {
647
+ document.documentElement.style.setProperty(key, newStyle[key]);
648
+ }
649
+ });
650
+ Object.keys(oldStyle).forEach((key) => {
651
+ if (!newStyle[key]) {
652
+ document.documentElement.style.removeProperty(key);
653
+ }
654
+ });
655
+ }
639
656
  var stdin_default$1R = defineComponent({
640
657
  name: name$1H,
641
658
  props: configProviderProps,
@@ -661,6 +678,22 @@ var stdin_default$1R = defineComponent({
661
678
  onActivated(addTheme);
662
679
  onDeactivated(removeTheme);
663
680
  onBeforeUnmount(removeTheme);
681
+ watch(style, (newStyle, oldStyle) => {
682
+ if (props2.themeVarsScope === "global") {
683
+ syncThemeVarsOnRoot(newStyle, oldStyle);
684
+ }
685
+ });
686
+ watch(() => props2.themeVarsScope, (newScope, oldScope) => {
687
+ if (oldScope === "global") {
688
+ syncThemeVarsOnRoot({}, style.value);
689
+ }
690
+ if (newScope === "global") {
691
+ syncThemeVarsOnRoot(style.value, {});
692
+ }
693
+ });
694
+ if (props2.themeVarsScope === "global") {
695
+ syncThemeVarsOnRoot(style.value, {});
696
+ }
664
697
  }
665
698
  provide(CONFIG_PROVIDER_KEY, props2);
666
699
  watchEffect(() => {
@@ -670,7 +703,7 @@ var stdin_default$1R = defineComponent({
670
703
  });
671
704
  return () => createVNode(props2.tag, {
672
705
  "class": bem$1C(),
673
- "style": style.value
706
+ "style": props2.themeVarsScope === "local" ? style.value : void 0
674
707
  }, {
675
708
  default: () => {
676
709
  var _a;
@@ -5313,7 +5346,11 @@ var stdin_default$1n = defineComponent({
5313
5346
  shape: String,
5314
5347
  parent: Object,
5315
5348
  checked: Boolean,
5316
- bindGroup: truthProp
5349
+ bindGroup: truthProp,
5350
+ indeterminate: {
5351
+ type: Boolean,
5352
+ default: null
5353
+ }
5317
5354
  }),
5318
5355
  emits: ["click", "toggle"],
5319
5356
  setup(props2, {
@@ -5367,14 +5404,16 @@ var stdin_default$1n = defineComponent({
5367
5404
  var _a, _b;
5368
5405
  const {
5369
5406
  bem: bem2,
5370
- checked
5407
+ checked,
5408
+ indeterminate
5371
5409
  } = props2;
5372
5410
  const iconSize = props2.iconSize || getParentProp("iconSize");
5373
5411
  return createVNode("div", {
5374
5412
  "ref": iconRef,
5375
5413
  "class": bem2("icon", [shape.value, {
5376
5414
  disabled: disabled.value,
5377
- checked
5415
+ checked,
5416
+ indeterminate
5378
5417
  }]),
5379
5418
  "style": shape.value !== "dot" ? {
5380
5419
  fontSize: addUnit(iconSize)
@@ -5387,7 +5426,7 @@ var stdin_default$1n = defineComponent({
5387
5426
  checked,
5388
5427
  disabled: disabled.value
5389
5428
  }) : shape.value !== "dot" ? createVNode(Icon, {
5390
- "name": "success",
5429
+ "name": indeterminate ? "minus" : "success",
5391
5430
  "style": iconStyle.value
5392
5431
  }, null) : createVNode("div", {
5393
5432
  "class": bem2("icon--dot__icon"),
@@ -7483,7 +7522,11 @@ var stdin_default$19 = defineComponent({
7483
7522
  const [name$$, bem$_] = createNamespace("checkbox");
7484
7523
  const checkboxProps = extend({}, checkerProps, {
7485
7524
  shape: String,
7486
- bindGroup: truthProp
7525
+ bindGroup: truthProp,
7526
+ indeterminate: {
7527
+ type: Boolean,
7528
+ default: null
7529
+ }
7487
7530
  });
7488
7531
  var stdin_default$18 = defineComponent({
7489
7532
  name: name$$,
@@ -7535,8 +7578,13 @@ var stdin_default$18 = defineComponent({
7535
7578
  } else {
7536
7579
  emit("update:modelValue", newValue);
7537
7580
  }
7581
+ if (props2.indeterminate !== null)
7582
+ emit("change", newValue);
7538
7583
  };
7539
- watch(() => props2.modelValue, (value) => emit("change", value));
7584
+ watch(() => props2.modelValue, (value) => {
7585
+ if (props2.indeterminate === null)
7586
+ emit("change", value);
7587
+ });
7540
7588
  useExpose({
7541
7589
  toggle,
7542
7590
  props: props2,
@@ -11158,6 +11206,8 @@ const navBarProps = {
11158
11206
  border: truthProp,
11159
11207
  leftText: String,
11160
11208
  rightText: String,
11209
+ leftDisabled: Boolean,
11210
+ rightDisabled: Boolean,
11161
11211
  leftArrow: Boolean,
11162
11212
  placeholder: Boolean,
11163
11213
  safeAreaInsetTop: Boolean,
@@ -11173,8 +11223,16 @@ var stdin_default$I = defineComponent({
11173
11223
  }) {
11174
11224
  const navBarRef = ref();
11175
11225
  const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
11176
- const onClickLeft = (event) => emit("clickLeft", event);
11177
- const onClickRight = (event) => emit("clickRight", event);
11226
+ const onClickLeft = (event) => {
11227
+ if (!props2.leftDisabled) {
11228
+ emit("clickLeft", event);
11229
+ }
11230
+ };
11231
+ const onClickRight = (event) => {
11232
+ if (!props2.rightDisabled) {
11233
+ emit("clickRight", event);
11234
+ }
11235
+ };
11178
11236
  const renderLeft = () => {
11179
11237
  if (slots.left) {
11180
11238
  return slots.left();
@@ -11216,12 +11274,16 @@ var stdin_default$I = defineComponent({
11216
11274
  }, [createVNode("div", {
11217
11275
  "class": bem$z("content")
11218
11276
  }, [hasLeft && createVNode("div", {
11219
- "class": [bem$z("left"), props2.clickable ? HAPTICS_FEEDBACK : ""],
11277
+ "class": [bem$z("left", {
11278
+ disabled: props2.leftDisabled
11279
+ }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
11220
11280
  "onClick": onClickLeft
11221
11281
  }, [renderLeft()]), createVNode("div", {
11222
11282
  "class": [bem$z("title"), "van-ellipsis"]
11223
11283
  }, [slots.title ? slots.title() : title]), hasRight && createVNode("div", {
11224
- "class": [bem$z("right"), props2.clickable ? HAPTICS_FEEDBACK : ""],
11284
+ "class": [bem$z("right", {
11285
+ disabled: props2.rightDisabled
11286
+ }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
11225
11287
  "onClick": onClickRight
11226
11288
  }, [renderRight()])])]);
11227
11289
  };
@@ -16411,7 +16473,7 @@ const Lazyload = {
16411
16473
  });
16412
16474
  }
16413
16475
  };
16414
- const version = "4.6.6";
16476
+ const version = "4.6.8";
16415
16477
  function install(app) {
16416
16478
  const components = [
16417
16479
  ActionBar,
package/lib/vant.js CHANGED
@@ -1017,15 +1017,32 @@
1017
1017
  themeVars: Object,
1018
1018
  themeVarsDark: Object,
1019
1019
  themeVarsLight: Object,
1020
+ themeVarsScope: makeStringProp("local"),
1020
1021
  iconPrefix: String
1021
1022
  };
1023
+ function insertDash(str) {
1024
+ return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
1025
+ }
1022
1026
  function mapThemeVarsToCSSVars(themeVars) {
1023
1027
  const cssVars = {};
1024
1028
  Object.keys(themeVars).forEach((key) => {
1025
- cssVars[`--van-${kebabCase(key)}`] = themeVars[key];
1029
+ const formattedKey = insertDash(kebabCase(key));
1030
+ cssVars[`--van-${formattedKey}`] = themeVars[key];
1026
1031
  });
1027
1032
  return cssVars;
1028
1033
  }
1034
+ function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
1035
+ Object.keys(newStyle).forEach((key) => {
1036
+ if (newStyle[key] !== oldStyle[key]) {
1037
+ document.documentElement.style.setProperty(key, newStyle[key]);
1038
+ }
1039
+ });
1040
+ Object.keys(oldStyle).forEach((key) => {
1041
+ if (!newStyle[key]) {
1042
+ document.documentElement.style.removeProperty(key);
1043
+ }
1044
+ });
1045
+ }
1029
1046
  var stdin_default$1R = vue.defineComponent({
1030
1047
  name: name$1H,
1031
1048
  props: configProviderProps,
@@ -1051,6 +1068,22 @@
1051
1068
  vue.onActivated(addTheme);
1052
1069
  vue.onDeactivated(removeTheme);
1053
1070
  vue.onBeforeUnmount(removeTheme);
1071
+ vue.watch(style, (newStyle, oldStyle) => {
1072
+ if (props2.themeVarsScope === "global") {
1073
+ syncThemeVarsOnRoot(newStyle, oldStyle);
1074
+ }
1075
+ });
1076
+ vue.watch(() => props2.themeVarsScope, (newScope, oldScope) => {
1077
+ if (oldScope === "global") {
1078
+ syncThemeVarsOnRoot({}, style.value);
1079
+ }
1080
+ if (newScope === "global") {
1081
+ syncThemeVarsOnRoot(style.value, {});
1082
+ }
1083
+ });
1084
+ if (props2.themeVarsScope === "global") {
1085
+ syncThemeVarsOnRoot(style.value, {});
1086
+ }
1054
1087
  }
1055
1088
  vue.provide(CONFIG_PROVIDER_KEY, props2);
1056
1089
  vue.watchEffect(() => {
@@ -1060,7 +1093,7 @@
1060
1093
  });
1061
1094
  return () => vue.createVNode(props2.tag, {
1062
1095
  "class": bem$1C(),
1063
- "style": style.value
1096
+ "style": props2.themeVarsScope === "local" ? style.value : void 0
1064
1097
  }, {
1065
1098
  default: () => {
1066
1099
  var _a;
@@ -5774,7 +5807,11 @@
5774
5807
  shape: String,
5775
5808
  parent: Object,
5776
5809
  checked: Boolean,
5777
- bindGroup: truthProp
5810
+ bindGroup: truthProp,
5811
+ indeterminate: {
5812
+ type: Boolean,
5813
+ default: null
5814
+ }
5778
5815
  }),
5779
5816
  emits: ["click", "toggle"],
5780
5817
  setup(props2, {
@@ -5828,14 +5865,16 @@
5828
5865
  var _a, _b;
5829
5866
  const {
5830
5867
  bem: bem2,
5831
- checked
5868
+ checked,
5869
+ indeterminate
5832
5870
  } = props2;
5833
5871
  const iconSize = props2.iconSize || getParentProp("iconSize");
5834
5872
  return vue.createVNode("div", {
5835
5873
  "ref": iconRef,
5836
5874
  "class": bem2("icon", [shape.value, {
5837
5875
  disabled: disabled.value,
5838
- checked
5876
+ checked,
5877
+ indeterminate
5839
5878
  }]),
5840
5879
  "style": shape.value !== "dot" ? {
5841
5880
  fontSize: addUnit(iconSize)
@@ -5848,7 +5887,7 @@
5848
5887
  checked,
5849
5888
  disabled: disabled.value
5850
5889
  }) : shape.value !== "dot" ? vue.createVNode(Icon, {
5851
- "name": "success",
5890
+ "name": indeterminate ? "minus" : "success",
5852
5891
  "style": iconStyle.value
5853
5892
  }, null) : vue.createVNode("div", {
5854
5893
  "class": bem2("icon--dot__icon"),
@@ -7941,7 +7980,11 @@
7941
7980
  const [name$$, bem$_] = createNamespace("checkbox");
7942
7981
  const checkboxProps = extend({}, checkerProps, {
7943
7982
  shape: String,
7944
- bindGroup: truthProp
7983
+ bindGroup: truthProp,
7984
+ indeterminate: {
7985
+ type: Boolean,
7986
+ default: null
7987
+ }
7945
7988
  });
7946
7989
  var stdin_default$18 = vue.defineComponent({
7947
7990
  name: name$$,
@@ -7993,8 +8036,13 @@
7993
8036
  } else {
7994
8037
  emit("update:modelValue", newValue);
7995
8038
  }
8039
+ if (props2.indeterminate !== null)
8040
+ emit("change", newValue);
7996
8041
  };
7997
- vue.watch(() => props2.modelValue, (value) => emit("change", value));
8042
+ vue.watch(() => props2.modelValue, (value) => {
8043
+ if (props2.indeterminate === null)
8044
+ emit("change", value);
8045
+ });
7998
8046
  useExpose({
7999
8047
  toggle,
8000
8048
  props: props2,
@@ -11587,6 +11635,8 @@
11587
11635
  border: truthProp,
11588
11636
  leftText: String,
11589
11637
  rightText: String,
11638
+ leftDisabled: Boolean,
11639
+ rightDisabled: Boolean,
11590
11640
  leftArrow: Boolean,
11591
11641
  placeholder: Boolean,
11592
11642
  safeAreaInsetTop: Boolean,
@@ -11602,8 +11652,16 @@
11602
11652
  }) {
11603
11653
  const navBarRef = vue.ref();
11604
11654
  const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
11605
- const onClickLeft = (event) => emit("clickLeft", event);
11606
- const onClickRight = (event) => emit("clickRight", event);
11655
+ const onClickLeft = (event) => {
11656
+ if (!props2.leftDisabled) {
11657
+ emit("clickLeft", event);
11658
+ }
11659
+ };
11660
+ const onClickRight = (event) => {
11661
+ if (!props2.rightDisabled) {
11662
+ emit("clickRight", event);
11663
+ }
11664
+ };
11607
11665
  const renderLeft = () => {
11608
11666
  if (slots.left) {
11609
11667
  return slots.left();
@@ -11645,12 +11703,16 @@
11645
11703
  }, [vue.createVNode("div", {
11646
11704
  "class": bem$z("content")
11647
11705
  }, [hasLeft && vue.createVNode("div", {
11648
- "class": [bem$z("left"), props2.clickable ? HAPTICS_FEEDBACK : ""],
11706
+ "class": [bem$z("left", {
11707
+ disabled: props2.leftDisabled
11708
+ }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
11649
11709
  "onClick": onClickLeft
11650
11710
  }, [renderLeft()]), vue.createVNode("div", {
11651
11711
  "class": [bem$z("title"), "van-ellipsis"]
11652
11712
  }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
11653
- "class": [bem$z("right"), props2.clickable ? HAPTICS_FEEDBACK : ""],
11713
+ "class": [bem$z("right", {
11714
+ disabled: props2.rightDisabled
11715
+ }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
11654
11716
  "onClick": onClickRight
11655
11717
  }, [renderRight()])])]);
11656
11718
  };
@@ -17623,7 +17685,7 @@
17623
17685
  });
17624
17686
  }
17625
17687
  };
17626
- const version = "4.6.6";
17688
+ const version = "4.6.8";
17627
17689
  function install(app) {
17628
17690
  const components = [
17629
17691
  ActionBar,