@varlet/ui 1.27.8 → 1.27.10

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 (66) hide show
  1. package/es/badge/Badge.js +1 -1
  2. package/es/bottom-navigation-item/BottomNavigationItem.js +3 -1
  3. package/es/card/Card.js +228 -19
  4. package/es/card/card.css +1 -1
  5. package/es/card/card.less +108 -5
  6. package/es/card/props.js +25 -0
  7. package/es/index-bar/IndexBar.js +4 -4
  8. package/es/index-bar/props.js +1 -1
  9. package/es/loading/Loading.js +5 -14
  10. package/es/loading/loading.css +1 -1
  11. package/es/loading/loading.less +20 -0
  12. package/es/picker/Picker.js +2 -1
  13. package/es/progress/Progress.js +14 -11
  14. package/es/progress/progress.css +1 -1
  15. package/es/progress/progress.less +3 -0
  16. package/es/progress/props.js +1 -1
  17. package/es/rate/Rate.js +4 -2
  18. package/es/rate/props.js +2 -4
  19. package/es/rate/rate.css +1 -1
  20. package/es/rate/rate.less +7 -0
  21. package/es/select/Select.js +3 -1
  22. package/es/slider/Slider.js +10 -9
  23. package/es/style.css +1 -1
  24. package/es/switch/Switch.js +22 -19
  25. package/es/switch/props.js +1 -2
  26. package/es/switch/switch.css +1 -1
  27. package/es/switch/switch.less +18 -4
  28. package/es/utils/elements.js +13 -0
  29. package/es/utils/jest.js +19 -0
  30. package/es/varlet.esm.js +334 -96
  31. package/highlight/attributes.json +21 -5
  32. package/highlight/tags.json +6 -2
  33. package/highlight/web-types.json +50 -6
  34. package/lib/badge/Badge.js +1 -1
  35. package/lib/bottom-navigation-item/BottomNavigationItem.js +3 -1
  36. package/lib/card/Card.js +228 -15
  37. package/lib/card/card.css +1 -1
  38. package/lib/card/card.less +108 -5
  39. package/lib/card/props.js +25 -0
  40. package/lib/index-bar/IndexBar.js +3 -3
  41. package/lib/index-bar/props.js +1 -1
  42. package/lib/loading/Loading.js +6 -15
  43. package/lib/loading/loading.css +1 -1
  44. package/lib/loading/loading.less +20 -0
  45. package/lib/picker/Picker.js +2 -1
  46. package/lib/progress/Progress.js +15 -11
  47. package/lib/progress/progress.css +1 -1
  48. package/lib/progress/progress.less +3 -0
  49. package/lib/progress/props.js +1 -1
  50. package/lib/rate/Rate.js +3 -1
  51. package/lib/rate/props.js +2 -4
  52. package/lib/rate/rate.css +1 -1
  53. package/lib/rate/rate.less +7 -0
  54. package/lib/select/Select.js +3 -1
  55. package/lib/slider/Slider.js +9 -8
  56. package/lib/style.css +1 -1
  57. package/lib/switch/Switch.js +22 -19
  58. package/lib/switch/props.js +1 -2
  59. package/lib/switch/switch.css +1 -1
  60. package/lib/switch/switch.less +18 -4
  61. package/lib/utils/elements.js +17 -1
  62. package/lib/utils/jest.js +21 -0
  63. package/package.json +10 -9
  64. package/types/card.d.ts +9 -0
  65. package/types/indexBar.d.ts +1 -1
  66. package/umd/varlet.js +4 -4
package/es/varlet.esm.js CHANGED
@@ -134,7 +134,7 @@ function kebabCase(str) {
134
134
  var ret = str.replace(/([A-Z])/g, " $1").trim();
135
135
  return ret.split(" ").join("-").toLowerCase();
136
136
  }
137
- function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
137
+ function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
138
138
  try {
139
139
  var info = gen[key](arg);
140
140
  var value = info.value;
@@ -148,16 +148,16 @@ function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
148
148
  Promise.resolve(value).then(_next, _throw);
149
149
  }
150
150
  }
151
- function _asyncToGenerator$c(fn) {
151
+ function _asyncToGenerator$d(fn) {
152
152
  return function() {
153
153
  var self = this, args = arguments;
154
154
  return new Promise(function(resolve, reject) {
155
155
  var gen = fn.apply(self, args);
156
156
  function _next(value) {
157
- asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "next", value);
157
+ asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, "next", value);
158
158
  }
159
159
  function _throw(err) {
160
- asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "throw", err);
160
+ asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, "throw", err);
161
161
  }
162
162
  _next(void 0);
163
163
  });
@@ -187,7 +187,7 @@ function inViewport(_x) {
187
187
  return _inViewport.apply(this, arguments);
188
188
  }
189
189
  function _inViewport() {
190
- _inViewport = _asyncToGenerator$c(function* (element) {
190
+ _inViewport = _asyncToGenerator$d(function* (element) {
191
191
  yield doubleRaf();
192
192
  var {
193
193
  top,
@@ -278,6 +278,17 @@ var toSizeUnit = (value) => {
278
278
  }
279
279
  return toPxNum(value) + "px";
280
280
  };
281
+ var multiplySizeUnit = function(value, quantity) {
282
+ if (quantity === void 0) {
283
+ quantity = 1;
284
+ }
285
+ if (value == null) {
286
+ return void 0;
287
+ }
288
+ var legalSize = toSizeUnit(value);
289
+ var unit = legalSize.match(/(vh|%|rem|px|vw)$/)[0];
290
+ return "" + parseFloat(legalSize) * quantity + unit;
291
+ };
281
292
  function requestAnimationFrame(fn) {
282
293
  return globalThis.requestAnimationFrame ? globalThis.requestAnimationFrame(fn) : globalThis.setTimeout(fn, 16);
283
294
  }
@@ -335,7 +346,7 @@ function supportTouch() {
335
346
  return inBrowser2 && "ontouchstart" in window;
336
347
  }
337
348
  var _excluded = ["collect", "clear"];
338
- function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
349
+ function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
339
350
  try {
340
351
  var info = gen[key](arg);
341
352
  var value = info.value;
@@ -349,16 +360,16 @@ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
349
360
  Promise.resolve(value).then(_next, _throw);
350
361
  }
351
362
  }
352
- function _asyncToGenerator$b(fn) {
363
+ function _asyncToGenerator$c(fn) {
353
364
  return function() {
354
365
  var self = this, args = arguments;
355
366
  return new Promise(function(resolve, reject) {
356
367
  var gen = fn.apply(self, args);
357
368
  function _next(value) {
358
- asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
369
+ asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "next", value);
359
370
  }
360
371
  function _throw(err) {
361
- asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
372
+ asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "throw", err);
362
373
  }
363
374
  _next(void 0);
364
375
  });
@@ -545,7 +556,7 @@ function keyInProvides(key) {
545
556
  function useValidation() {
546
557
  var errorMessage = ref("");
547
558
  var validate = /* @__PURE__ */ function() {
548
- var _ref = _asyncToGenerator$b(function* (rules, value, apis) {
559
+ var _ref = _asyncToGenerator$c(function* (rules, value, apis) {
549
560
  if (!isArray(rules) || !rules.length) {
550
561
  return true;
551
562
  }
@@ -566,7 +577,7 @@ function useValidation() {
566
577
  errorMessage.value = "";
567
578
  };
568
579
  var validateWithTrigger = /* @__PURE__ */ function() {
569
- var _ref2 = _asyncToGenerator$b(function* (validateTrigger, trigger, rules, value, apis) {
580
+ var _ref2 = _asyncToGenerator$c(function* (validateTrigger, trigger, rules, value, apis) {
570
581
  if (validateTrigger.includes(trigger)) {
571
582
  (yield validate(rules, value, apis)) && (errorMessage.value = "");
572
583
  }
@@ -1090,7 +1101,7 @@ var props$T = {
1090
1101
  type: Function
1091
1102
  }
1092
1103
  };
1093
- function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
1104
+ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
1094
1105
  try {
1095
1106
  var info = gen[key](arg);
1096
1107
  var value = info.value;
@@ -1104,16 +1115,16 @@ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
1104
1115
  Promise.resolve(value).then(_next, _throw);
1105
1116
  }
1106
1117
  }
1107
- function _asyncToGenerator$a(fn) {
1118
+ function _asyncToGenerator$b(fn) {
1108
1119
  return function() {
1109
1120
  var self = this, args = arguments;
1110
1121
  return new Promise(function(resolve, reject) {
1111
1122
  var gen = fn.apply(self, args);
1112
1123
  function _next(value) {
1113
- asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
1124
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
1114
1125
  }
1115
1126
  function _throw(err) {
1116
- asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
1127
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
1117
1128
  }
1118
1129
  _next(void 0);
1119
1130
  });
@@ -1145,7 +1156,7 @@ var Icon = defineComponent({
1145
1156
  var nextName = ref("");
1146
1157
  var shrinking = ref(false);
1147
1158
  var handleNameChange = /* @__PURE__ */ function() {
1148
- var _ref = _asyncToGenerator$a(function* (newName, oldName) {
1159
+ var _ref = _asyncToGenerator$b(function* (newName, oldName) {
1149
1160
  var {
1150
1161
  transition
1151
1162
  } = props2;
@@ -1683,10 +1694,10 @@ function render$W(_ctx, _cache) {
1683
1694
  key: 0,
1684
1695
  class: normalizeClass(_ctx.n("circle"))
1685
1696
  }, [createElementVNode("span", {
1686
- class: normalizeClass(_ctx.n("circle-block")),
1697
+ class: normalizeClass(_ctx.classes(_ctx.n("circle-block"), _ctx.n("circle-block--" + _ctx.size))),
1687
1698
  style: normalizeStyle({
1688
- width: _ctx.getRadius * 2 + "px",
1689
- height: _ctx.getRadius * 2 + "px",
1699
+ width: _ctx.multiplySizeUnit(_ctx.radius, 2),
1700
+ height: _ctx.multiplySizeUnit(_ctx.radius, 2),
1690
1701
  color: _ctx.color
1691
1702
  })
1692
1703
  }, _hoisted_2$7, 6)], 2)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.loadingTypeDict, (nums, key) => {
@@ -1726,15 +1737,6 @@ var Loading = defineComponent({
1726
1737
  rect: 8,
1727
1738
  disappear: 3
1728
1739
  };
1729
- var sizeDict = {
1730
- mini: 9,
1731
- small: 12,
1732
- normal: 15,
1733
- large: 18
1734
- };
1735
- var getRadius = computed(() => {
1736
- return props2.radius ? toNumber(props2.radius) : sizeDict[props2.size];
1737
- });
1738
1740
  var isShow = computed(() => {
1739
1741
  if (!call(slots.default))
1740
1742
  return true;
@@ -1743,8 +1745,8 @@ var Loading = defineComponent({
1743
1745
  return {
1744
1746
  n: n$Z,
1745
1747
  classes: classes$O,
1748
+ multiplySizeUnit,
1746
1749
  loadingTypeDict,
1747
- getRadius,
1748
1750
  isShow
1749
1751
  };
1750
1752
  }
@@ -2110,7 +2112,7 @@ var Badge = defineComponent({
2110
2112
  icon: icon2
2111
2113
  } = props2;
2112
2114
  var positionBasic = slots.default && n$W("position") + " " + n$W("--" + position);
2113
- var dotClass = dot && n$W("dot");
2115
+ var dotClass = dot ? n$W("dot") : null;
2114
2116
  var positionClass = getPositionClass();
2115
2117
  var iconClass = icon2 ? n$W("icon") : null;
2116
2118
  return [n$W("--" + type), positionBasic, dotClass, positionClass, iconClass];
@@ -2500,7 +2502,8 @@ var BottomNavigationItem = defineComponent({
2500
2502
  return active.value === name.value || active.value === index.value ? activeColor.value : inactiveColor.value;
2501
2503
  };
2502
2504
  var handleClick = () => {
2503
- var active2 = name.value || index.value;
2505
+ var _name$value;
2506
+ var active2 = (_name$value = name.value) != null ? _name$value : index.value;
2504
2507
  call(props2.onClick, active2);
2505
2508
  call(bottomNavigation2.onToggle, active2);
2506
2509
  };
@@ -2540,6 +2543,27 @@ var props$K = {
2540
2543
  height: {
2541
2544
  type: [String, Number]
2542
2545
  },
2546
+ imageHeight: {
2547
+ type: [String, Number]
2548
+ },
2549
+ imageWidth: {
2550
+ type: [String, Number]
2551
+ },
2552
+ layout: {
2553
+ type: String,
2554
+ default: "column"
2555
+ },
2556
+ floating: {
2557
+ type: Boolean,
2558
+ default: false
2559
+ },
2560
+ "onUpdate:floating": {
2561
+ type: Function
2562
+ },
2563
+ floatingDuration: {
2564
+ type: Number,
2565
+ default: 250
2566
+ },
2543
2567
  alt: {
2544
2568
  type: String
2545
2569
  },
@@ -2563,28 +2587,82 @@ var props$K = {
2563
2587
  type: Function
2564
2588
  }
2565
2589
  };
2590
+ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
2591
+ try {
2592
+ var info = gen[key](arg);
2593
+ var value = info.value;
2594
+ } catch (error) {
2595
+ reject(error);
2596
+ return;
2597
+ }
2598
+ if (info.done) {
2599
+ resolve(value);
2600
+ } else {
2601
+ Promise.resolve(value).then(_next, _throw);
2602
+ }
2603
+ }
2604
+ function _asyncToGenerator$a(fn) {
2605
+ return function() {
2606
+ var self = this, args = arguments;
2607
+ return new Promise(function(resolve, reject) {
2608
+ var gen = fn.apply(self, args);
2609
+ function _next(value) {
2610
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
2611
+ }
2612
+ function _throw(err) {
2613
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
2614
+ }
2615
+ _next(void 0);
2616
+ });
2617
+ };
2618
+ }
2566
2619
  var {
2567
2620
  n: n$T,
2568
2621
  classes: classes$I
2569
2622
  } = createNamespace("card");
2623
+ var RIPPLE_DELAY = 500;
2570
2624
  var _hoisted_1$g = ["src", "alt"];
2571
2625
  function render$Q(_ctx, _cache) {
2626
+ var _component_var_icon = resolveComponent("var-icon");
2627
+ var _component_var_button = resolveComponent("var-button");
2572
2628
  var _directive_ripple = resolveDirective("ripple");
2573
2629
  return withDirectives((openBlock(), createElementBlock("div", {
2574
- class: normalizeClass(_ctx.classes(_ctx.n(), [_ctx.elevation, "var-elevation--" + _ctx.elevation, "var-elevation--2"])),
2630
+ ref: "card",
2631
+ class: normalizeClass(_ctx.classes(_ctx.n(), [_ctx.isRow, _ctx.n("--layout-row")], [_ctx.elevation, "var-elevation--" + _ctx.elevation, "var-elevation--1"])),
2632
+ style: normalizeStyle({
2633
+ zIndex: _ctx.floated ? _ctx.zIndex : void 0
2634
+ }),
2575
2635
  onClick: _cache[0] || (_cache[0] = function() {
2576
2636
  return _ctx.onClick && _ctx.onClick(...arguments);
2577
2637
  })
2578
- }, [renderSlot(_ctx.$slots, "image", {}, () => [_ctx.src ? (openBlock(), createElementBlock("img", {
2579
- key: 0,
2580
- class: normalizeClass(_ctx.n("image")),
2638
+ }, [createElementVNode("div", {
2639
+ ref: "cardFloater",
2640
+ class: normalizeClass(_ctx.classes(_ctx.n("floater"))),
2581
2641
  style: normalizeStyle({
2582
- objectFit: _ctx.fit,
2583
- height: _ctx.toSizeUnit(_ctx.height)
2584
- }),
2585
- src: _ctx.src,
2586
- alt: _ctx.alt
2587
- }, null, 14, _hoisted_1$g)) : createCommentVNode("v-if", true)]), renderSlot(_ctx.$slots, "title", {}, () => [_ctx.title ? (openBlock(), createElementBlock("div", {
2642
+ width: _ctx.floaterWidth,
2643
+ height: _ctx.floaterHeight,
2644
+ top: _ctx.floaterTop,
2645
+ left: _ctx.floaterLeft,
2646
+ overflow: _ctx.floaterOverflow,
2647
+ position: _ctx.floaterPosition,
2648
+ transition: _ctx.floated ? "background-color " + _ctx.floatingDuration + "ms, width " + _ctx.floatingDuration + "ms, height " + _ctx.floatingDuration + "ms, top " + _ctx.floatingDuration + "ms, left " + _ctx.floatingDuration + "ms" : void 0
2649
+ })
2650
+ }, [renderSlot(_ctx.$slots, "image", {}, () => {
2651
+ var _ctx$imageHeight;
2652
+ return [_ctx.src ? (openBlock(), createElementBlock("img", {
2653
+ key: 0,
2654
+ class: normalizeClass(_ctx.n("image")),
2655
+ style: normalizeStyle({
2656
+ objectFit: _ctx.fit,
2657
+ height: _ctx.toSizeUnit((_ctx$imageHeight = _ctx.imageHeight) != null ? _ctx$imageHeight : _ctx.height),
2658
+ width: _ctx.toSizeUnit(_ctx.imageWidth)
2659
+ }),
2660
+ src: _ctx.src,
2661
+ alt: _ctx.alt
2662
+ }, null, 14, _hoisted_1$g)) : createCommentVNode("v-if", true)];
2663
+ }), createElementVNode("div", {
2664
+ class: normalizeClass(_ctx.n("container"))
2665
+ }, [renderSlot(_ctx.$slots, "title", {}, () => [_ctx.title ? (openBlock(), createElementBlock("div", {
2588
2666
  key: 0,
2589
2667
  class: normalizeClass(_ctx.n("title"))
2590
2668
  }, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true)]), renderSlot(_ctx.$slots, "subtitle", {}, () => [_ctx.subtitle ? (openBlock(), createElementBlock("div", {
@@ -2596,8 +2674,42 @@ function render$Q(_ctx, _cache) {
2596
2674
  }, toDisplayString(_ctx.description), 3)) : createCommentVNode("v-if", true)]), _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
2597
2675
  key: 0,
2598
2676
  class: normalizeClass(_ctx.n("footer"))
2599
- }, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("v-if", true)], 2)), [[_directive_ripple, {
2600
- disabled: !_ctx.ripple
2677
+ }, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("v-if", true), _ctx.$slots.content && !_ctx.isRow ? (openBlock(), createElementBlock("div", {
2678
+ key: 1,
2679
+ class: normalizeClass(_ctx.n("content")),
2680
+ style: normalizeStyle({
2681
+ height: _ctx.contentHeight,
2682
+ opacity: _ctx.opacity,
2683
+ transition: "opacity " + _ctx.floatingDuration * 2 + "ms"
2684
+ })
2685
+ }, [renderSlot(_ctx.$slots, "content")], 6)) : createCommentVNode("v-if", true)], 2), _ctx.showFloatingButtons ? (openBlock(), createElementBlock("div", {
2686
+ key: 0,
2687
+ class: normalizeClass(_ctx.classes(_ctx.n("floating-buttons"), "var--box")),
2688
+ style: normalizeStyle({
2689
+ zIndex: _ctx.zIndex,
2690
+ opacity: _ctx.opacity,
2691
+ transition: "opacity " + _ctx.floatingDuration * 2 + "ms"
2692
+ })
2693
+ }, [renderSlot(_ctx.$slots, "close-button", {}, () => [createVNode(_component_var_button, {
2694
+ "var-card-cover": "",
2695
+ round: "",
2696
+ class: normalizeClass(_ctx.classes(_ctx.n("close-button"), "var-elevation--6")),
2697
+ onClick: withModifiers(_ctx.close, ["stop"])
2698
+ }, {
2699
+ default: withCtx(() => [createVNode(_component_var_icon, {
2700
+ "var-card-cover": "",
2701
+ name: "window-close",
2702
+ class: normalizeClass(_ctx.n("close-button-icon"))
2703
+ }, null, 8, ["class"])]),
2704
+ _: 1
2705
+ }, 8, ["class", "onClick"])])], 6)) : createCommentVNode("v-if", true)], 6), createElementVNode("div", {
2706
+ class: normalizeClass(_ctx.n("holder")),
2707
+ style: normalizeStyle({
2708
+ width: _ctx.holderWidth,
2709
+ height: _ctx.holderHeight
2710
+ })
2711
+ }, null, 6)], 6)), [[_directive_ripple, {
2712
+ disabled: !_ctx.ripple || _ctx.floater
2601
2713
  }]]);
2602
2714
  }
2603
2715
  var Card = defineComponent({
@@ -2606,12 +2718,131 @@ var Card = defineComponent({
2606
2718
  directives: {
2607
2719
  Ripple
2608
2720
  },
2721
+ components: {
2722
+ VarIcon: Icon,
2723
+ VarButton: Button
2724
+ },
2609
2725
  props: props$K,
2610
- setup() {
2726
+ setup(props2) {
2727
+ var card2 = ref(null);
2728
+ var cardFloater = ref(null);
2729
+ var holderWidth = ref("auto");
2730
+ var holderHeight = ref("auto");
2731
+ var floaterWidth = ref("100%");
2732
+ var floaterHeight = ref("100%");
2733
+ var floaterTop = ref("auto");
2734
+ var floaterLeft = ref("auto");
2735
+ var floaterPosition = ref(void 0);
2736
+ var floaterOverflow = ref("hidden");
2737
+ var contentHeight = ref("0px");
2738
+ var opacity = ref("0");
2739
+ var {
2740
+ zIndex
2741
+ } = useZIndex(() => props2.floating, 1);
2742
+ var isRow = computed(() => props2.layout === "row");
2743
+ var showFloatingButtons = ref(false);
2744
+ var floated = ref(false);
2745
+ useLock(() => props2.floating, () => isRow);
2746
+ var dropdownFloaterTop = "auto";
2747
+ var dropdownFloaterLeft = "auto";
2748
+ var dropper = null;
2749
+ var floater = ref(null);
2750
+ var floating = /* @__PURE__ */ function() {
2751
+ var _ref = _asyncToGenerator$a(function* () {
2752
+ clearTimeout(floater.value);
2753
+ clearTimeout(dropper);
2754
+ floater.value = null;
2755
+ floater.value = setTimeout(/* @__PURE__ */ _asyncToGenerator$a(function* () {
2756
+ var {
2757
+ width,
2758
+ height,
2759
+ left,
2760
+ top
2761
+ } = card2.value.getBoundingClientRect();
2762
+ holderWidth.value = toSizeUnit(width);
2763
+ holderHeight.value = toSizeUnit(height);
2764
+ floaterWidth.value = holderWidth.value;
2765
+ floaterHeight.value = holderHeight.value;
2766
+ floaterTop.value = toSizeUnit(top);
2767
+ floaterLeft.value = toSizeUnit(left);
2768
+ floaterPosition.value = "fixed";
2769
+ dropdownFloaterTop = floaterTop.value;
2770
+ dropdownFloaterLeft = floaterLeft.value;
2771
+ showFloatingButtons.value = true;
2772
+ yield doubleRaf();
2773
+ floaterTop.value = "0";
2774
+ floaterLeft.value = "0";
2775
+ floaterWidth.value = "100vw";
2776
+ floaterHeight.value = "100vh";
2777
+ contentHeight.value = "auto";
2778
+ opacity.value = "1";
2779
+ floaterOverflow.value = "auto";
2780
+ floated.value = true;
2781
+ }), props2.ripple ? RIPPLE_DELAY : 0);
2782
+ });
2783
+ return function floating2() {
2784
+ return _ref.apply(this, arguments);
2785
+ };
2786
+ }();
2787
+ var dropdown = () => {
2788
+ clearTimeout(dropper);
2789
+ clearTimeout(floater.value);
2790
+ floater.value = null;
2791
+ floaterWidth.value = holderWidth.value;
2792
+ floaterHeight.value = holderHeight.value;
2793
+ floaterTop.value = dropdownFloaterTop;
2794
+ floaterLeft.value = dropdownFloaterLeft;
2795
+ contentHeight.value = "0px";
2796
+ opacity.value = "0";
2797
+ showFloatingButtons.value = false;
2798
+ dropper = setTimeout(() => {
2799
+ holderWidth.value = "auto";
2800
+ holderHeight.value = "auto";
2801
+ floaterWidth.value = "100%";
2802
+ floaterHeight.value = "100%";
2803
+ floaterTop.value = "auto";
2804
+ floaterLeft.value = "auto";
2805
+ dropdownFloaterTop = "auto";
2806
+ dropdownFloaterLeft = "auto";
2807
+ floaterOverflow.value = "hidden";
2808
+ floaterPosition.value = void 0;
2809
+ floated.value = false;
2810
+ }, props2.floatingDuration);
2811
+ };
2812
+ var close = () => {
2813
+ call(props2["onUpdate:floating"], false);
2814
+ };
2815
+ watch(() => props2.floating, (value) => {
2816
+ if (isRow.value)
2817
+ return;
2818
+ nextTick(() => {
2819
+ value ? floating() : dropdown();
2820
+ });
2821
+ }, {
2822
+ immediate: true
2823
+ });
2611
2824
  return {
2612
2825
  n: n$T,
2613
2826
  classes: classes$I,
2614
- toSizeUnit
2827
+ toSizeUnit,
2828
+ card: card2,
2829
+ cardFloater,
2830
+ holderWidth,
2831
+ holderHeight,
2832
+ floater,
2833
+ floaterWidth,
2834
+ floaterHeight,
2835
+ floaterTop,
2836
+ floaterLeft,
2837
+ floaterPosition,
2838
+ floaterOverflow,
2839
+ contentHeight,
2840
+ opacity,
2841
+ zIndex,
2842
+ isRow,
2843
+ close,
2844
+ showFloatingButtons,
2845
+ floated
2615
2846
  };
2616
2847
  }
2617
2848
  });
@@ -10325,7 +10556,7 @@ var props$q = {
10325
10556
  default: true
10326
10557
  },
10327
10558
  stickyOffsetTop: {
10328
- type: Number,
10559
+ type: [String, Number],
10329
10560
  default: 0
10330
10561
  },
10331
10562
  cssMode: {
@@ -10405,7 +10636,7 @@ function render$r(_ctx, _cache) {
10405
10636
  style: normalizeStyle({
10406
10637
  color: _ctx.active === anchorName && _ctx.highlightColor ? _ctx.highlightColor : ""
10407
10638
  }),
10408
- onClick: ($event) => _ctx.anchorClick(anchorName)
10639
+ onClick: ($event) => _ctx.anchorClick(anchorName, true)
10409
10640
  }, toDisplayString(anchorName), 15, _hoisted_1$a);
10410
10641
  }), 128))], 6)], 2);
10411
10642
  }
@@ -10426,7 +10657,7 @@ var IndexBar = defineComponent({
10426
10657
  var active = ref();
10427
10658
  var sticky2 = computed(() => props2.sticky);
10428
10659
  var cssMode = computed(() => props2.cssMode);
10429
- var stickyOffsetTop = computed(() => props2.stickyOffsetTop);
10660
+ var stickyOffsetTop = computed(() => toPxNum(props2.stickyOffsetTop));
10430
10661
  var zIndex = computed(() => props2.zIndex);
10431
10662
  var indexBarProvider = {
10432
10663
  active,
@@ -10498,7 +10729,7 @@ var IndexBar = defineComponent({
10498
10729
  };
10499
10730
  }();
10500
10731
  var scrollTo$1 = (index) => {
10501
- requestAnimationFrame(() => anchorClick(index, true));
10732
+ requestAnimationFrame(() => anchorClick(index));
10502
10733
  };
10503
10734
  watch(() => length.value, /* @__PURE__ */ _asyncToGenerator$5(function* () {
10504
10735
  yield doubleRaf();
@@ -12114,7 +12345,8 @@ var VarPicker = defineComponent({
12114
12345
  } = getPicked();
12115
12346
  prevIndexes = [...indexes];
12116
12347
  }, {
12117
- immediate: true
12348
+ immediate: true,
12349
+ deep: true
12118
12350
  });
12119
12351
  return {
12120
12352
  n: n$o,
@@ -12243,7 +12475,7 @@ var props$j = {
12243
12475
  default: false
12244
12476
  },
12245
12477
  size: {
12246
- type: Number,
12478
+ type: [Number, String],
12247
12479
  default: 40
12248
12480
  },
12249
12481
  rotate: {
@@ -12271,7 +12503,7 @@ function render$l(_ctx, _cache) {
12271
12503
  }, [createElementVNode("div", mergeProps({
12272
12504
  class: _ctx.n("linear-block"),
12273
12505
  style: {
12274
- height: _ctx.lineWidth + "px"
12506
+ height: _ctx.toSizeUnit(_ctx.lineWidth)
12275
12507
  }
12276
12508
  }, _ctx.$attrs), [_ctx.track ? (openBlock(), createElementBlock("div", {
12277
12509
  key: 0,
@@ -12292,8 +12524,8 @@ function render$l(_ctx, _cache) {
12292
12524
  key: 1,
12293
12525
  class: normalizeClass(_ctx.n("circle")),
12294
12526
  style: normalizeStyle({
12295
- width: _ctx.size + "px",
12296
- height: _ctx.size + "px"
12527
+ width: _ctx.toSizeUnit(_ctx.size),
12528
+ height: _ctx.toSizeUnit(_ctx.size)
12297
12529
  })
12298
12530
  }, [(openBlock(), createElementBlock("svg", {
12299
12531
  class: normalizeClass(_ctx.n("circle-svg")),
@@ -12304,22 +12536,22 @@ function render$l(_ctx, _cache) {
12304
12536
  }, [_ctx.track ? (openBlock(), createElementBlock("circle", {
12305
12537
  key: 0,
12306
12538
  class: normalizeClass(_ctx.n("circle-background")),
12307
- cx: _ctx.size / 2,
12308
- cy: _ctx.size / 2,
12539
+ cx: _ctx.multiplySizeUnit(_ctx.size, 0.5),
12540
+ cy: _ctx.multiplySizeUnit(_ctx.size, 0.5),
12309
12541
  r: _ctx.circleProps.radius,
12310
12542
  fill: "transparent",
12311
- "stroke-width": _ctx.lineWidth,
12543
+ "stroke-width": _ctx.toSizeUnit(_ctx.lineWidth),
12312
12544
  style: normalizeStyle({
12313
12545
  strokeDasharray: _ctx.circleProps.perimeter,
12314
12546
  stroke: _ctx.trackColor
12315
12547
  })
12316
12548
  }, null, 14, _hoisted_2$3)) : createCommentVNode("v-if", true), createElementVNode("circle", {
12317
12549
  class: normalizeClass(_ctx.n("circle-certain")),
12318
- cx: _ctx.size / 2,
12319
- cy: _ctx.size / 2,
12550
+ cx: _ctx.multiplySizeUnit(_ctx.size, 0.5),
12551
+ cy: _ctx.multiplySizeUnit(_ctx.size, 0.5),
12320
12552
  r: _ctx.circleProps.radius,
12321
12553
  fill: "transparent",
12322
- "stroke-width": _ctx.lineWidth,
12554
+ "stroke-width": _ctx.toSizeUnit(_ctx.lineWidth),
12323
12555
  style: normalizeStyle({
12324
12556
  strokeDasharray: _ctx.circleProps.strokeDasharray,
12325
12557
  stroke: _ctx.color
@@ -12350,9 +12582,9 @@ var Progress = defineComponent({
12350
12582
  lineWidth,
12351
12583
  value
12352
12584
  } = props2;
12353
- var viewBox = "0 0 " + size + " " + size;
12585
+ var viewBox = "0 0 " + toPxNum(size) + " " + toPxNum(size);
12354
12586
  var roundValue = toNumber(value) > 100 ? 100 : Math.round(toNumber(value));
12355
- var radius = (size - toNumber(lineWidth)) / 2;
12587
+ var radius = (toPxNum(size) - toPxNum(lineWidth)) / 2;
12356
12588
  var perimeter = 2 * Math.PI * radius;
12357
12589
  var strokeDasharray = roundValue / 100 * perimeter + ", " + perimeter;
12358
12590
  return {
@@ -12366,6 +12598,8 @@ var Progress = defineComponent({
12366
12598
  return {
12367
12599
  n: n$n,
12368
12600
  classes: classes$i,
12601
+ toSizeUnit,
12602
+ multiplySizeUnit,
12369
12603
  linearProps,
12370
12604
  circleProps
12371
12605
  };
@@ -12981,12 +13215,10 @@ var props$f = {
12981
13215
  default: "star-outline"
12982
13216
  },
12983
13217
  size: {
12984
- type: [String, Number],
12985
- default: "24"
13218
+ type: [String, Number]
12986
13219
  },
12987
13220
  gap: {
12988
- type: [String, Number],
12989
- default: "2"
13221
+ type: [String, Number]
12990
13222
  },
12991
13223
  namespace: {
12992
13224
  type: String
@@ -13043,13 +13275,15 @@ function render$h(_ctx, _cache) {
13043
13275
  class: normalizeClass(_ctx.getClass(val)),
13044
13276
  onClick: ($event) => _ctx.handleClick(val, $event)
13045
13277
  }, [createVNode(_component_var_icon, {
13278
+ class: normalizeClass(_ctx.n("content-icon")),
13279
+ "var-rate-cover": "",
13046
13280
  transition: 0,
13047
13281
  namespace: _ctx.namespace,
13048
13282
  name: _ctx.getIconName(val),
13049
13283
  style: normalizeStyle({
13050
13284
  fontSize: _ctx.toSizeUnit(_ctx.size)
13051
13285
  })
13052
- }, null, 8, ["namespace", "name", "style"])], 14, _hoisted_1$5)), [[_directive_ripple, {
13286
+ }, null, 8, ["class", "namespace", "name", "style"])], 14, _hoisted_1$5)), [[_directive_ripple, {
13053
13287
  disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled || !_ctx.ripple
13054
13288
  }]]);
13055
13289
  }), 128))], 2), createVNode(_component_var_form_details, {
@@ -13550,6 +13784,7 @@ var Select = defineComponent({
13550
13784
  return label2.value;
13551
13785
  };
13552
13786
  var findLabel = (modelValue) => {
13787
+ var _option$label$value, _option;
13553
13788
  var option2 = options.find((_ref2) => {
13554
13789
  var {
13555
13790
  value
@@ -13564,7 +13799,7 @@ var Select = defineComponent({
13564
13799
  return label2.value === modelValue;
13565
13800
  });
13566
13801
  }
13567
- return option2.label.value;
13802
+ return (_option$label$value = (_option = option2) == null ? void 0 : _option.label.value) != null ? _option$label$value : "";
13568
13803
  };
13569
13804
  var computePlaceholderState = () => {
13570
13805
  var {
@@ -13980,8 +14215,8 @@ function render$d(_ctx, _cache) {
13980
14215
  }, [createElementVNode("div", {
13981
14216
  class: normalizeClass(_ctx.classes(_ctx.n("block"), [_ctx.isDisabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")])),
13982
14217
  style: normalizeStyle({
13983
- height: _ctx.thumbSize === void 0 ? _ctx.thumbSize : 3 * _ctx.toNumber(_ctx.thumbSize) + "px",
13984
- margin: _ctx.thumbSize === void 0 ? _ctx.thumbSize : "0 " + _ctx.toNumber(_ctx.thumbSize) / 2 + "px"
14218
+ height: _ctx.thumbSize === void 0 ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 3),
14219
+ margin: _ctx.thumbSize === void 0 ? _ctx.thumbSize : "0 " + _ctx.multiplySizeUnit(_ctx.thumbSize, 0.5)
13985
14220
  }),
13986
14221
  ref: "sliderEl",
13987
14222
  onClick: _cache[0] || (_cache[0] = function() {
@@ -13993,7 +14228,7 @@ function render$d(_ctx, _cache) {
13993
14228
  class: normalizeClass(_ctx.n("track-background")),
13994
14229
  style: normalizeStyle({
13995
14230
  background: _ctx.trackColor,
13996
- height: _ctx.trackHeight + "px"
14231
+ height: _ctx.multiplySizeUnit(_ctx.trackHeight)
13997
14232
  })
13998
14233
  }, null, 6), createElementVNode("div", {
13999
14234
  class: normalizeClass(_ctx.n("track-fill")),
@@ -14016,8 +14251,8 @@ function render$d(_ctx, _cache) {
14016
14251
  class: normalizeClass(_ctx.n("thumb-block")),
14017
14252
  style: normalizeStyle({
14018
14253
  background: _ctx.thumbColor,
14019
- height: _ctx.thumbSize + "px",
14020
- width: _ctx.thumbSize + "px"
14254
+ height: _ctx.multiplySizeUnit(_ctx.thumbSize),
14255
+ width: _ctx.multiplySizeUnit(_ctx.thumbSize)
14021
14256
  })
14022
14257
  }, null, 6), createElementVNode("div", {
14023
14258
  class: normalizeClass(_ctx.classes(_ctx.n("thumb-ripple"), [_ctx.thumbsProps[item.enumValue].active, _ctx.n("thumb-ripple--active")])),
@@ -14029,8 +14264,8 @@ function render$d(_ctx, _cache) {
14029
14264
  style: normalizeStyle({
14030
14265
  background: _ctx.labelColor,
14031
14266
  color: _ctx.labelTextColor,
14032
- height: _ctx.thumbSize === void 0 ? _ctx.thumbSize : 2 * _ctx.toNumber(_ctx.thumbSize) + "px",
14033
- width: _ctx.thumbSize === void 0 ? _ctx.thumbSize : 2 * _ctx.toNumber(_ctx.thumbSize) + "px"
14267
+ height: _ctx.thumbSize === void 0 ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2),
14268
+ width: _ctx.thumbSize === void 0 ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2)
14034
14269
  })
14035
14270
  }, [createElementVNode("span", null, toDisplayString(item.value), 1)], 6)])], 46, _hoisted_1$3);
14036
14271
  }), 128))], 6), createVNode(_component_var_form_details, {
@@ -14092,7 +14327,7 @@ var Slider = defineComponent({
14092
14327
  var getRippleSize = (item) => {
14093
14328
  var size;
14094
14329
  if (props2.thumbSize !== void 0) {
14095
- size = thumbsProps[item.enumValue].active ? 3 * toNumber(props2.thumbSize) + "px" : "0px";
14330
+ size = thumbsProps[item.enumValue].active ? multiplySizeUnit(props2.thumbSize, 3) : "0px";
14096
14331
  }
14097
14332
  return {
14098
14333
  height: size,
@@ -14286,6 +14521,7 @@ var Slider = defineComponent({
14286
14521
  errorMessage,
14287
14522
  thumbsProps,
14288
14523
  thumbList,
14524
+ multiplySizeUnit,
14289
14525
  toNumber,
14290
14526
  getRippleSize,
14291
14527
  showLabel,
@@ -15141,8 +15377,7 @@ var props$6 = {
15141
15377
  type: String
15142
15378
  },
15143
15379
  size: {
15144
- type: [String, Number],
15145
- default: 20
15380
+ type: [String, Number]
15146
15381
  },
15147
15382
  rules: {
15148
15383
  type: Array
@@ -15179,16 +15414,16 @@ function render$8(_ctx, _cache) {
15179
15414
  style: normalizeStyle(_ctx.styleComputed.switch)
15180
15415
  }, [createElementVNode("div", {
15181
15416
  style: normalizeStyle(_ctx.styleComputed.track),
15182
- class: normalizeClass(_ctx.classes(_ctx.n("track"), [_ctx.modelValue === _ctx.activeValue, _ctx.n("track-active")], [_ctx.errorMessage, _ctx.n("track-error")]))
15417
+ class: normalizeClass(_ctx.classes(_ctx.n("track"), [_ctx.modelValue === _ctx.activeValue, _ctx.n("track--active")], [_ctx.errorMessage, _ctx.n("track--error")]))
15183
15418
  }, null, 6), withDirectives((openBlock(), createElementBlock("div", {
15184
- class: normalizeClass(_ctx.n("ripple")),
15419
+ class: normalizeClass(_ctx.classes(_ctx.n("ripple"), [_ctx.modelValue === _ctx.activeValue, _ctx.n("ripple--active")])),
15185
15420
  style: normalizeStyle(_ctx.styleComputed.ripple)
15186
15421
  }, [createElementVNode("div", {
15187
15422
  style: normalizeStyle(_ctx.styleComputed.handle),
15188
- class: normalizeClass(_ctx.classes(_ctx.n("handle"), "var-elevation--2", [_ctx.modelValue === _ctx.activeValue, _ctx.n("handle-active")], [_ctx.errorMessage, _ctx.n("handle-error")]))
15423
+ class: normalizeClass(_ctx.classes(_ctx.n("handle"), "var-elevation--2", [_ctx.modelValue === _ctx.activeValue, _ctx.n("handle--active")], [_ctx.errorMessage, _ctx.n("handle--error")]))
15189
15424
  }, [_ctx.loading ? (openBlock(), createBlock(_component_var_loading, {
15190
15425
  key: 0,
15191
- radius: _ctx.toNumber(_ctx.size) / 2 - 2
15426
+ radius: _ctx.radius
15192
15427
  }, null, 8, ["radius"])) : createCommentVNode("v-if", true)], 6)], 6)), [[_directive_ripple, {
15193
15428
  disabled: !_ctx.ripple || _ctx.disabled || _ctx.loading || _ctx.formDisabled
15194
15429
  }]])], 6), createVNode(_component_var_form_details, {
@@ -15228,35 +15463,38 @@ var Switch = defineComponent({
15228
15463
  loadingColor,
15229
15464
  activeValue
15230
15465
  } = props2;
15231
- var sizeNum = toNumber(size);
15232
- var switchWidth = sizeNum * 2;
15233
- var switchHeight = sizeNum * 1.2;
15234
15466
  return {
15235
15467
  handle: {
15236
- width: size + "px",
15237
- height: size + "px",
15468
+ width: multiplySizeUnit(size),
15469
+ height: multiplySizeUnit(size),
15238
15470
  backgroundColor: modelValue === activeValue ? color || "" : closeColor || "",
15239
15471
  color: loadingColor && loadingColor
15240
15472
  },
15241
15473
  ripple: {
15242
- left: modelValue === activeValue ? sizeNum / 2 + "px" : "-" + sizeNum / 2 + "px",
15474
+ left: modelValue === activeValue ? multiplySizeUnit(size, 0.5) : "-" + multiplySizeUnit(size, 0.5),
15243
15475
  color: modelValue === activeValue ? color || "" : closeColor || "#999",
15244
- width: sizeNum * 2 + "px",
15245
- height: sizeNum * 2 + "px"
15476
+ width: multiplySizeUnit(size, 2),
15477
+ height: multiplySizeUnit(size, 2)
15246
15478
  },
15247
15479
  track: {
15248
- height: switchHeight * 0.6 + "px",
15249
- width: switchWidth - 2 + "px",
15250
- borderRadius: switchWidth / 3 + "px",
15480
+ height: multiplySizeUnit(size, 0.72),
15481
+ width: multiplySizeUnit(size, 1.9),
15482
+ borderRadius: multiplySizeUnit(size, 2 / 3),
15251
15483
  filter: modelValue === activeValue || errorMessage != null && errorMessage.value ? "opacity(.6)" : "brightness(.6)",
15252
15484
  backgroundColor: modelValue === activeValue ? color || "" : closeColor || ""
15253
15485
  },
15254
15486
  switch: {
15255
- height: switchHeight + "px",
15256
- width: switchWidth + "px"
15487
+ height: multiplySizeUnit(size, 1.2),
15488
+ width: multiplySizeUnit(size, 2)
15257
15489
  }
15258
15490
  };
15259
15491
  });
15492
+ var radius = computed(() => {
15493
+ var {
15494
+ size = "5.333vw"
15495
+ } = props2;
15496
+ return multiplySizeUnit(size, 0.4);
15497
+ });
15260
15498
  var switchActive = (event) => {
15261
15499
  var {
15262
15500
  onClick,
@@ -15291,7 +15529,7 @@ var Switch = defineComponent({
15291
15529
  n: n$8,
15292
15530
  classes: classes$7,
15293
15531
  switchActive,
15294
- toNumber,
15532
+ radius,
15295
15533
  styleComputed,
15296
15534
  errorMessage,
15297
15535
  formDisabled: form == null ? void 0 : form.disabled,