@varlet/ui 1.27.7 → 1.27.9-alpha.1653036733481

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 (77) hide show
  1. package/es/badge/Badge.js +1 -1
  2. package/es/card/Card.js +213 -12
  3. package/es/card/card.css +1 -1
  4. package/es/card/card.less +109 -7
  5. package/es/card/props.js +18 -0
  6. package/es/col/Col.js +6 -6
  7. package/es/col/col.css +1 -1
  8. package/es/col/col.less +27 -2
  9. package/es/index-bar/IndexBar.js +4 -4
  10. package/es/index-bar/props.js +1 -1
  11. package/es/loading/Loading.js +5 -14
  12. package/es/loading/loading.css +1 -1
  13. package/es/loading/loading.less +20 -0
  14. package/es/picker/Picker.js +10 -7
  15. package/es/picker/props.js +4 -0
  16. package/es/progress/Progress.js +14 -11
  17. package/es/progress/progress.css +1 -1
  18. package/es/progress/progress.less +3 -0
  19. package/es/progress/props.js +1 -1
  20. package/es/rate/Rate.js +4 -2
  21. package/es/rate/props.js +2 -4
  22. package/es/rate/rate.css +1 -1
  23. package/es/rate/rate.less +7 -0
  24. package/es/select/Select.js +3 -1
  25. package/es/slider/Slider.js +10 -9
  26. package/es/snackbar/style/index.js +1 -1
  27. package/es/snackbar/style/less.js +1 -1
  28. package/es/style.css +1 -1
  29. package/es/switch/Switch.js +22 -19
  30. package/es/switch/props.js +1 -2
  31. package/es/switch/switch.css +1 -1
  32. package/es/switch/switch.less +18 -4
  33. package/es/utils/elements.js +13 -0
  34. package/es/utils/jest.js +19 -0
  35. package/es/varlet.esm.js +338 -103
  36. package/highlight/attributes.json +24 -4
  37. package/highlight/tags.json +6 -1
  38. package/highlight/web-types.json +58 -5
  39. package/lib/badge/Badge.js +1 -1
  40. package/lib/card/Card.js +213 -8
  41. package/lib/card/card.css +1 -1
  42. package/lib/card/card.less +109 -7
  43. package/lib/card/props.js +18 -0
  44. package/lib/col/Col.js +6 -6
  45. package/lib/col/col.css +1 -1
  46. package/lib/col/col.less +27 -2
  47. package/lib/index-bar/IndexBar.js +3 -3
  48. package/lib/index-bar/props.js +1 -1
  49. package/lib/loading/Loading.js +6 -15
  50. package/lib/loading/loading.css +1 -1
  51. package/lib/loading/loading.less +20 -0
  52. package/lib/picker/Picker.js +10 -7
  53. package/lib/picker/props.js +4 -0
  54. package/lib/progress/Progress.js +15 -11
  55. package/lib/progress/progress.css +1 -1
  56. package/lib/progress/progress.less +3 -0
  57. package/lib/progress/props.js +1 -1
  58. package/lib/rate/Rate.js +3 -1
  59. package/lib/rate/props.js +2 -4
  60. package/lib/rate/rate.css +1 -1
  61. package/lib/rate/rate.less +7 -0
  62. package/lib/select/Select.js +3 -1
  63. package/lib/slider/Slider.js +9 -8
  64. package/lib/snackbar/style/index.js +1 -1
  65. package/lib/snackbar/style/less.js +1 -1
  66. package/lib/style.css +1 -1
  67. package/lib/switch/Switch.js +22 -19
  68. package/lib/switch/props.js +1 -2
  69. package/lib/switch/switch.css +1 -1
  70. package/lib/switch/switch.less +18 -4
  71. package/lib/utils/elements.js +17 -1
  72. package/lib/utils/jest.js +21 -0
  73. package/package.json +10 -9
  74. package/types/card.d.ts +2 -0
  75. package/types/indexBar.d.ts +1 -1
  76. package/types/picker.d.ts +2 -0
  77. package/umd/varlet.js +4 -4
@@ -10,6 +10,8 @@ var _props = require("./props");
10
10
 
11
11
  var _shared = require("../utils/shared");
12
12
 
13
+ var _elements = require("../utils/elements");
14
+
13
15
  var _components = require("../utils/components");
14
16
 
15
17
  var {
@@ -32,7 +34,7 @@ function render(_ctx, _cache) {
32
34
  }, [(0, _vue.createElementVNode)("div", (0, _vue.mergeProps)({
33
35
  class: _ctx.n('linear-block'),
34
36
  style: {
35
- height: _ctx.lineWidth + "px"
37
+ height: _ctx.toSizeUnit(_ctx.lineWidth)
36
38
  }
37
39
  }, _ctx.$attrs), [_ctx.track ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
38
40
  key: 0,
@@ -65,8 +67,8 @@ function render(_ctx, _cache) {
65
67
  key: 1,
66
68
  class: (0, _vue.normalizeClass)(_ctx.n('circle')),
67
69
  style: (0, _vue.normalizeStyle)({
68
- width: _ctx.size + "px",
69
- height: _ctx.size + "px"
70
+ width: _ctx.toSizeUnit(_ctx.size),
71
+ height: _ctx.toSizeUnit(_ctx.size)
70
72
  })
71
73
  }, [((0, _vue.openBlock)(), (0, _vue.createElementBlock)("svg", {
72
74
  class: (0, _vue.normalizeClass)(_ctx.n('circle-svg')),
@@ -77,11 +79,11 @@ function render(_ctx, _cache) {
77
79
  }, [_ctx.track ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("circle", {
78
80
  key: 0,
79
81
  class: (0, _vue.normalizeClass)(_ctx.n('circle-background')),
80
- cx: _ctx.size / 2,
81
- cy: _ctx.size / 2,
82
+ cx: _ctx.multiplySizeUnit(_ctx.size, 0.5),
83
+ cy: _ctx.multiplySizeUnit(_ctx.size, 0.5),
82
84
  r: _ctx.circleProps.radius,
83
85
  fill: "transparent",
84
- "stroke-width": _ctx.lineWidth,
86
+ "stroke-width": _ctx.toSizeUnit(_ctx.lineWidth),
85
87
  style: (0, _vue.normalizeStyle)({
86
88
  strokeDasharray: _ctx.circleProps.perimeter,
87
89
  stroke: _ctx.trackColor
@@ -90,11 +92,11 @@ function render(_ctx, _cache) {
90
92
  /* CLASS, STYLE, PROPS */
91
93
  , _hoisted_2)) : (0, _vue.createCommentVNode)("v-if", true), (0, _vue.createElementVNode)("circle", {
92
94
  class: (0, _vue.normalizeClass)(_ctx.n('circle-certain')),
93
- cx: _ctx.size / 2,
94
- cy: _ctx.size / 2,
95
+ cx: _ctx.multiplySizeUnit(_ctx.size, 0.5),
96
+ cy: _ctx.multiplySizeUnit(_ctx.size, 0.5),
95
97
  r: _ctx.circleProps.radius,
96
98
  fill: "transparent",
97
- "stroke-width": _ctx.lineWidth,
99
+ "stroke-width": _ctx.toSizeUnit(_ctx.lineWidth),
98
100
  style: (0, _vue.normalizeStyle)({
99
101
  strokeDasharray: _ctx.circleProps.strokeDasharray,
100
102
  stroke: _ctx.color
@@ -139,9 +141,9 @@ var _default = (0, _vue.defineComponent)({
139
141
  lineWidth,
140
142
  value
141
143
  } = props;
142
- var viewBox = "0 0 " + size + " " + size;
144
+ var viewBox = "0 0 " + (0, _elements.toPxNum)(size) + " " + (0, _elements.toPxNum)(size);
143
145
  var roundValue = (0, _shared.toNumber)(value) > 100 ? 100 : Math.round((0, _shared.toNumber)(value));
144
- var radius = (size - (0, _shared.toNumber)(lineWidth)) / 2;
146
+ var radius = ((0, _elements.toPxNum)(size) - (0, _elements.toPxNum)(lineWidth)) / 2;
145
147
  var perimeter = 2 * Math.PI * radius;
146
148
  var strokeDasharray = roundValue / 100 * perimeter + ", " + perimeter;
147
149
  return {
@@ -155,6 +157,8 @@ var _default = (0, _vue.defineComponent)({
155
157
  return {
156
158
  n,
157
159
  classes,
160
+ toSizeUnit: _elements.toSizeUnit,
161
+ multiplySizeUnit: _elements.multiplySizeUnit,
158
162
  linearProps,
159
163
  circleProps
160
164
  };
@@ -1 +1 @@
1
- :root { --progress-font-size: var(--font-size-sm); --progress-ripple-color: #fff; --progress-track-color: #d8d8d8; --progress-background: var(--color-primary);}.var-progress { position: relative; font-size: var(--progress-font-size);}.var-progress__linear { display: flex; align-items: center;}.var-progress__linear-block { flex: 1; position: relative; overflow: hidden;}.var-progress__linear-background,.var-progress__linear-certain { width: 100%; height: 100%;}.var-progress__linear-ripple::after { position: absolute; width: 0; background-color: var(--progress-ripple-color); height: 100%; opacity: 0; animation: ripple 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; content: '';}.var-progress__linear-background { background-color: var(--progress-track-color);}.var-progress__linear-certain { position: absolute; background-color: var(--progress-background); top: 0; left: 0; transition: all 0.2s, background-color 0.8s;}.var-progress__linear-label { margin-left: 8px; flex: 0;}@keyframes ripple { 0% { width: 0; opacity: 0.1; } 20% { width: 0; opacity: 0.5; } 80% { width: 100%; opacity: 0; }}.var-progress__circle { position: relative;}.var-progress__circle-background { stroke: var(--progress-track-color);}.var-progress__circle-certain { transition: all 0.2s; stroke: var(--progress-background); position: absolute;}.var-progress__circle-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);}
1
+ :root { --progress-font-size: var(--font-size-sm); --progress-ripple-color: #fff; --progress-track-color: #d8d8d8; --progress-background: var(--color-primary);}.var-progress { position: relative; font-size: var(--progress-font-size);}.var-progress__linear { display: flex; align-items: center;}.var-progress__linear-block { flex: 1; position: relative; overflow: hidden; height: 4px;}.var-progress__linear-background,.var-progress__linear-certain { width: 100%; height: 100%;}.var-progress__linear-ripple::after { position: absolute; width: 0; background-color: var(--progress-ripple-color); height: 100%; opacity: 0; animation: ripple 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; content: '';}.var-progress__linear-background { background-color: var(--progress-track-color);}.var-progress__linear-certain { position: absolute; background-color: var(--progress-background); top: 0; left: 0; transition: all 0.2s, background-color 0.8s;}.var-progress__linear-label { margin-left: 8px; flex: 0;}@keyframes ripple { 0% { width: 0; opacity: 0.1; } 20% { width: 0; opacity: 0.5; } 80% { width: 100%; opacity: 0; }}.var-progress__circle { position: relative; width: 40px; height: 40px;}.var-progress__circle-background { stroke: var(--progress-track-color);}.var-progress__circle-certain { transition: all 0.2s; stroke: var(--progress-background); position: absolute;}.var-progress__circle-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);}
@@ -22,6 +22,7 @@
22
22
  flex: 1;
23
23
  position: relative;
24
24
  overflow: hidden;
25
+ height: 4px;
25
26
  }
26
27
 
27
28
  &-background,
@@ -77,6 +78,8 @@
77
78
 
78
79
  &__circle {
79
80
  position: relative;
81
+ width: 40px;
82
+ height: 40px;
80
83
 
81
84
  &-background {
82
85
  stroke: var(--progress-track-color);
@@ -44,7 +44,7 @@ var props = {
44
44
  },
45
45
  // circle 的尺寸
46
46
  size: {
47
- type: Number,
47
+ type: [Number, String],
48
48
  default: 40
49
49
  },
50
50
  // circle的原点
package/lib/rate/Rate.js CHANGED
@@ -50,6 +50,8 @@ function render(_ctx, _cache) {
50
50
  class: (0, _vue.normalizeClass)(_ctx.getClass(val)),
51
51
  onClick: $event => _ctx.handleClick(val, $event)
52
52
  }, [(0, _vue.createVNode)(_component_var_icon, {
53
+ class: (0, _vue.normalizeClass)(_ctx.n('content-icon')),
54
+ "var-rate-cover": "",
53
55
  transition: 0,
54
56
  namespace: _ctx.namespace,
55
57
  name: _ctx.getIconName(val),
@@ -58,7 +60,7 @@ function render(_ctx, _cache) {
58
60
  })
59
61
  }, null, 8
60
62
  /* PROPS */
61
- , ["namespace", "name", "style"])], 14
63
+ , ["class", "namespace", "name", "style"])], 14
62
64
  /* CLASS, STYLE, PROPS */
63
65
  , _hoisted_1)), [[_directive_ripple, {
64
66
  disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled || !_ctx.ripple
package/lib/rate/props.js CHANGED
@@ -26,12 +26,10 @@ var props = {
26
26
  default: 'star-outline'
27
27
  },
28
28
  size: {
29
- type: [String, Number],
30
- default: '24'
29
+ type: [String, Number]
31
30
  },
32
31
  gap: {
33
- type: [String, Number],
34
- default: '2'
32
+ type: [String, Number]
35
33
  },
36
34
  namespace: {
37
35
  type: String
package/lib/rate/rate.css CHANGED
@@ -1 +1 @@
1
- :root { --rate-disabled-color: var(--color-text-disabled); --rate-error-color: var(--color-danger); --rate-action-padding: 4px; --rate-primary-color: var(--color-primary);}.var-rate { display: flex; transform: translateX(calc(-1 * var(--rate-action-padding)));}.var-rate__content { padding: var(--rate-action-padding); box-sizing: unset; cursor: pointer; display: flex; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-rate--primary { color: var(--rate-primary-color);}.var-rate--disabled { color: var(--rate-disabled-color); cursor: not-allowed;}.var-rate--error { color: var(--rate-error-color);}
1
+ :root { --rate-disabled-color: var(--color-text-disabled); --rate-error-color: var(--color-danger); --rate-action-padding: 4px; --rate-primary-color: var(--color-primary);}.var-rate { display: flex; transform: translateX(calc(-1 * var(--rate-action-padding)));}.var-rate__content { padding: var(--rate-action-padding); box-sizing: unset; cursor: pointer; display: flex; width: 24px; height: 24px; margin-right: 2px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-rate__content-icon[var-rate-cover] { font-size: 24px;}.var-rate--primary { color: var(--rate-primary-color);}.var-rate--disabled { color: var(--rate-disabled-color); cursor: not-allowed;}.var-rate--error { color: var(--rate-error-color);}
@@ -19,7 +19,14 @@
19
19
  box-sizing: unset;
20
20
  cursor: pointer;
21
21
  display: flex;
22
+ width: 24px;
23
+ height: 24px;
24
+ margin-right: 2px;
22
25
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
26
+
27
+ &-icon[var-rate-cover] {
28
+ font-size: 24px;
29
+ }
23
30
  }
24
31
 
25
32
  &--primary {
@@ -268,6 +268,8 @@ var _default = (0, _vue.defineComponent)({
268
268
  };
269
269
 
270
270
  var findLabel = modelValue => {
271
+ var _option$label$value, _option;
272
+
271
273
  var option = options.find(_ref2 => {
272
274
  var {
273
275
  value
@@ -284,7 +286,7 @@ var _default = (0, _vue.defineComponent)({
284
286
  });
285
287
  }
286
288
 
287
- return option.label.value;
289
+ return (_option$label$value = (_option = option) == null ? void 0 : _option.label.value) != null ? _option$label$value : '';
288
290
  };
289
291
 
290
292
  var computePlaceholderState = () => {
@@ -45,8 +45,8 @@ function render(_ctx, _cache) {
45
45
  }, [(0, _vue.createElementVNode)("div", {
46
46
  class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('block'), [_ctx.isDisabled, _ctx.n('--disabled')], [_ctx.errorMessage, _ctx.n('--error')])),
47
47
  style: (0, _vue.normalizeStyle)({
48
- height: _ctx.thumbSize === undefined ? _ctx.thumbSize : 3 * _ctx.toNumber(_ctx.thumbSize) + "px",
49
- margin: _ctx.thumbSize === undefined ? _ctx.thumbSize : "0 " + _ctx.toNumber(_ctx.thumbSize) / 2 + "px"
48
+ height: _ctx.thumbSize === undefined ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 3),
49
+ margin: _ctx.thumbSize === undefined ? _ctx.thumbSize : "0 " + _ctx.multiplySizeUnit(_ctx.thumbSize, 0.5)
50
50
  }),
51
51
  ref: "sliderEl",
52
52
  onClick: _cache[0] || (_cache[0] = function () {
@@ -58,7 +58,7 @@ function render(_ctx, _cache) {
58
58
  class: (0, _vue.normalizeClass)(_ctx.n('track-background')),
59
59
  style: (0, _vue.normalizeStyle)({
60
60
  background: _ctx.trackColor,
61
- height: _ctx.trackHeight + 'px'
61
+ height: _ctx.multiplySizeUnit(_ctx.trackHeight)
62
62
  })
63
63
  }, null, 6
64
64
  /* CLASS, STYLE */
@@ -87,8 +87,8 @@ function render(_ctx, _cache) {
87
87
  class: (0, _vue.normalizeClass)(_ctx.n('thumb-block')),
88
88
  style: (0, _vue.normalizeStyle)({
89
89
  background: _ctx.thumbColor,
90
- height: _ctx.thumbSize + 'px',
91
- width: _ctx.thumbSize + 'px'
90
+ height: _ctx.multiplySizeUnit(_ctx.thumbSize),
91
+ width: _ctx.multiplySizeUnit(_ctx.thumbSize)
92
92
  })
93
93
  }, null, 6
94
94
  /* CLASS, STYLE */
@@ -104,8 +104,8 @@ function render(_ctx, _cache) {
104
104
  style: (0, _vue.normalizeStyle)({
105
105
  background: _ctx.labelColor,
106
106
  color: _ctx.labelTextColor,
107
- height: _ctx.thumbSize === undefined ? _ctx.thumbSize : 2 * _ctx.toNumber(_ctx.thumbSize) + "px",
108
- width: _ctx.thumbSize === undefined ? _ctx.thumbSize : 2 * _ctx.toNumber(_ctx.thumbSize) + "px"
107
+ height: _ctx.thumbSize === undefined ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2),
108
+ width: _ctx.thumbSize === undefined ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2)
109
109
  })
110
110
  }, [(0, _vue.createElementVNode)("span", null, (0, _vue.toDisplayString)(item.value), 1
111
111
  /* TEXT */
@@ -191,7 +191,7 @@ var _default = (0, _vue.defineComponent)({
191
191
  var size;
192
192
 
193
193
  if (props.thumbSize !== undefined) {
194
- size = thumbsProps[item.enumValue].active ? 3 * (0, _shared.toNumber)(props.thumbSize) + "px" : '0px';
194
+ size = thumbsProps[item.enumValue].active ? (0, _elements.multiplySizeUnit)(props.thumbSize, 3) : '0px';
195
195
  }
196
196
 
197
197
  return {
@@ -400,6 +400,7 @@ var _default = (0, _vue.defineComponent)({
400
400
  errorMessage,
401
401
  thumbsProps,
402
402
  thumbList,
403
+ multiplySizeUnit: _elements.multiplySizeUnit,
403
404
  toNumber: _shared.toNumber,
404
405
  getRippleSize,
405
406
  showLabel,
@@ -1,8 +1,8 @@
1
1
  require('../../styles/common.css')
2
+ require('../SnackbarSfc.css')
2
3
  require('../../styles/elevation.css')
3
4
  require('../../loading/loading.css')
4
5
  require('../../button/button.css')
5
6
  require('../../icon/icon.css')
6
7
  require('../snackbar.css')
7
8
  require('../coreSfc.css')
8
- require('../SnackbarSfc.css')
@@ -1,8 +1,8 @@
1
1
  require('../../styles/common.less')
2
+ require('../SnackbarSfc.less')
2
3
  require('../../styles/elevation.less')
3
4
  require('../../loading/loading.less')
4
5
  require('../../button/button.less')
5
6
  require('../../icon/icon.less')
6
7
  require('../snackbar.less')
7
8
  require('../coreSfc.less')
8
- require('../SnackbarSfc.less')