@varlet/ui 2.11.2 → 2.11.3-alpha.1685455534947

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.
package/lib/varlet.cjs.js CHANGED
@@ -15203,7 +15203,7 @@ var __sfc__$F = vue.defineComponent({
15203
15203
  if (scroller !== window) {
15204
15204
  var {
15205
15205
  top: top2
15206
- } = scroller.getBoundingClientRect();
15206
+ } = getRect(scroller);
15207
15207
  scrollerTop = top2;
15208
15208
  }
15209
15209
  var wrapper3 = wrapperEl.value;
@@ -15211,7 +15211,7 @@ var __sfc__$F = vue.defineComponent({
15211
15211
  var {
15212
15212
  top: stickyTop,
15213
15213
  left: stickyLeft
15214
- } = sticky2.getBoundingClientRect();
15214
+ } = getRect(sticky2);
15215
15215
  var currentOffsetTop = stickyTop - scrollerTop;
15216
15216
  if (currentOffsetTop <= offsetTop.value) {
15217
15217
  if (!cssMode) {
@@ -15793,10 +15793,6 @@ var props$y = {
15793
15793
  type: Boolean,
15794
15794
  default: false
15795
15795
  },
15796
- alwaysCustomPlaceholder: {
15797
- type: Boolean,
15798
- default: true
15799
- },
15800
15796
  onClick: defineListenerProp(),
15801
15797
  onClear: defineListenerProp()
15802
15798
  };
@@ -15819,7 +15815,6 @@ function __render__$B(_ctx, _cache) {
15819
15815
  "div",
15820
15816
  {
15821
15817
  class: vue.normalizeClass(_ctx.classes(_ctx.n("controller"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.errorMessage, _ctx.n("--error")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")])),
15822
- ref: "controllerEl",
15823
15818
  style: vue.normalizeStyle({
15824
15819
  color: _ctx.color,
15825
15820
  cursor: _ctx.cursor,
@@ -15837,21 +15832,18 @@ function __render__$B(_ctx, _cache) {
15837
15832
  ), vue.createElementVNode(
15838
15833
  "div",
15839
15834
  {
15840
- ref: "middleEl",
15841
15835
  class: vue.normalizeClass(_ctx.classes(_ctx.n("middle"), [!_ctx.hint, _ctx.n("--middle-non-hint")]))
15842
15836
  },
15843
15837
  [vue.renderSlot(_ctx.$slots, "default")],
15844
15838
  2
15845
15839
  /* CLASS */
15846
- ), (_ctx.hint || _ctx.alwaysCustomPlaceholder) && _ctx.placeholderTransform ? (vue.openBlock(), vue.createElementBlock(
15840
+ ), _ctx.hint ? (vue.openBlock(), vue.createElementBlock(
15847
15841
  "label",
15848
15842
  {
15849
15843
  key: 0,
15850
- class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")], [!_ctx.hint, _ctx.n("--placeholder-non-hint")], _ctx.computePlaceholderState())),
15844
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")], _ctx.computePlaceholderState())),
15851
15845
  style: vue.normalizeStyle({
15852
- color: _ctx.color,
15853
- transform: _ctx.placeholderTransform,
15854
- maxWidth: _ctx.placeholderMaxWidth
15846
+ color: _ctx.color
15855
15847
  }),
15856
15848
  for: _ctx.id
15857
15849
  },
@@ -15864,16 +15856,6 @@ function __render__$B(_ctx, _cache) {
15864
15856
  )],
15865
15857
  14,
15866
15858
  _hoisted_1$f
15867
- )) : vue.createCommentVNode("v-if", true), _ctx.variant === "outlined" ? (vue.openBlock(), vue.createElementBlock(
15868
- "span",
15869
- {
15870
- key: 1,
15871
- ref: "placeholderTextEl",
15872
- class: vue.normalizeClass([_ctx.n("placeholder-text"), _ctx.n("$--ellipsis")])
15873
- },
15874
- vue.toDisplayString(_ctx.placeholder),
15875
- 3
15876
- /* TEXT, CLASS */
15877
15859
  )) : vue.createCommentVNode("v-if", true), vue.createElementVNode(
15878
15860
  "div",
15879
15861
  {
@@ -15919,7 +15901,19 @@ function __render__$B(_ctx, _cache) {
15919
15901
  width: _ctx.legendWidth
15920
15902
  })
15921
15903
  },
15922
- null,
15904
+ [_ctx.hint ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
15905
+ key: 0,
15906
+ to: "body"
15907
+ }, [vue.createElementVNode(
15908
+ "span",
15909
+ {
15910
+ ref: "placeholderTextEl",
15911
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder-text"), _ctx.n("$--ellipsis"), [_ctx.size === "small", _ctx.n("placeholder-text--small")]))
15912
+ },
15913
+ vue.toDisplayString(_ctx.placeholder),
15914
+ 3
15915
+ /* TEXT, CLASS */
15916
+ )])) : vue.createCommentVNode("v-if", true)],
15923
15917
  6
15924
15918
  /* CLASS, STYLE */
15925
15919
  )],
@@ -15962,15 +15956,14 @@ var __sfc__$C = vue.defineComponent({
15962
15956
  VarIcon: Icon
15963
15957
  },
15964
15958
  props: props$y,
15965
- setup(props2) {
15966
- var controllerEl = vue.ref(null);
15967
- var middleEl = vue.ref(null);
15959
+ setup(props2, _ref) {
15960
+ var {
15961
+ slots
15962
+ } = _ref;
15968
15963
  var placeholderTextEl = vue.ref(null);
15969
15964
  var legendWidth = vue.ref("");
15970
- var placeholderTransform = vue.ref("");
15971
- var placeholderMaxWidth = vue.ref("");
15972
15965
  var color = vue.computed(() => !props2.errorMessage ? props2.isFocus ? props2.focusColor : props2.blurColor : void 0);
15973
- var isFloating = vue.computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocus));
15966
+ var isFloating = vue.computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocus || slots["prepend-icon"]));
15974
15967
  var computePlaceholderState = () => {
15975
15968
  var {
15976
15969
  hint,
@@ -15980,33 +15973,23 @@ var __sfc__$C = vue.defineComponent({
15980
15973
  if (!hint && (!isEmpty(value) || composing)) {
15981
15974
  return n$A("--placeholder-hidden");
15982
15975
  }
15976
+ if (isFloating.value) {
15977
+ return n$A("--placeholder-hint");
15978
+ }
15983
15979
  };
15984
15980
  var resize = () => {
15985
15981
  var {
15986
15982
  size,
15987
15983
  hint,
15988
- placeholder,
15989
15984
  variant
15990
15985
  } = props2;
15991
- if (!isFloating.value || !placeholder) {
15992
- var controllerRect = getRect(controllerEl.value);
15993
- var middleRect = getRect(middleEl.value);
15994
- var translateX = middleRect.left - controllerRect.left + "px";
15995
- placeholderTransform.value = hint ? "translate(" + translateX + ", calc(var(--field-decorator-" + variant + "-" + size + "-placeholder-translate-y) + var(--field-decorator-middle-offset-y))) scale(1)" : "translate(" + translateX + ", -50%)";
15996
- placeholderMaxWidth.value = middleRect.width + "px";
15986
+ if (!hint || variant !== "outlined") {
15987
+ legendWidth.value = "";
15997
15988
  return;
15998
15989
  }
15999
- var controllerStyle = getStyle$1(controllerEl.value);
16000
- var translateY = variant === "outlined" ? "-50%" : "0";
16001
- placeholderTransform.value = "translate(" + controllerStyle.paddingLeft + ", " + translateY + ") scale(0.75)";
16002
- if (variant === "outlined") {
16003
- var placeholderTextStyle = getStyle$1(placeholderTextEl.value);
16004
- var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
16005
- legendWidth.value = "calc(" + placeholderTextStyle.width + " * 0.75 + " + placeholderSpace + " * 2)";
16006
- placeholderMaxWidth.value = "calc((100% - var(--field-decorator-outlined-" + size + "-padding-left) - var(--field-decorator-outlined-" + size + "-padding-right)) * 1.33)";
16007
- } else {
16008
- placeholderMaxWidth.value = "133%";
16009
- }
15990
+ var placeholderTextStyle = getStyle$1(placeholderTextEl.value);
15991
+ var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
15992
+ legendWidth.value = "calc(" + placeholderTextStyle.width + " * 0.75 + " + placeholderSpace + " * 2)";
16010
15993
  };
16011
15994
  var handleClear = (e) => {
16012
15995
  call(props2.onClear, e);
@@ -16014,15 +15997,11 @@ var __sfc__$C = vue.defineComponent({
16014
15997
  var handleClick = (e) => {
16015
15998
  call(props2.onClick, e);
16016
15999
  };
16017
- vue.onUpdated(resize);
16018
16000
  useMounted(resize);
16001
+ vue.watch(() => [props2.size, props2.hint, props2.variant], resize);
16019
16002
  useEventListener(() => window, "resize", resize);
16020
16003
  return {
16021
- controllerEl,
16022
- middleEl,
16023
16004
  placeholderTextEl,
16024
- placeholderTransform,
16025
- placeholderMaxWidth,
16026
16005
  color,
16027
16006
  legendWidth,
16028
16007
  isFloating,
@@ -16145,12 +16124,10 @@ function __render__$A(_ctx, _cache) {
16145
16124
  clearable: _ctx.clearable,
16146
16125
  cursor: _ctx.cursor,
16147
16126
  composing: _ctx.isComposing,
16148
- alwaysCustomPlaceholder: false,
16149
16127
  onClick: _ctx.handleClick,
16150
16128
  onClear: _ctx.handleClear
16151
16129
  })),
16152
- {
16153
- "prepend-icon": vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "prepend-icon")]),
16130
+ vue.createSlots({
16154
16131
  "append-icon": vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "append-icon")]),
16155
16132
  default: vue.withCtx(() => [_ctx.normalizedType === "password" ? (vue.openBlock(), vue.createElementBlock(
16156
16133
  "input",
@@ -16259,11 +16236,15 @@ function __render__$A(_ctx, _cache) {
16259
16236
  46,
16260
16237
  _hoisted_3$8
16261
16238
  ))]),
16262
- _: 3
16263
- /* FORWARDED */
16264
- },
16265
- 16
16266
- /* FULL_PROPS */
16239
+ _: 2
16240
+ /* DYNAMIC */
16241
+ }, [_ctx.$slots["prepend-icon"] ? {
16242
+ name: "prepend-icon",
16243
+ fn: vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "prepend-icon")]),
16244
+ key: "0"
16245
+ } : void 0]),
16246
+ 1040
16247
+ /* FULL_PROPS, DYNAMIC_SLOTS */
16267
16248
  ), vue.createVNode(
16268
16249
  _component_var_form_details,
16269
16250
  {
@@ -19048,7 +19029,7 @@ var __sfc__$s = vue.defineComponent({
19048
19029
  if (controlPosition.value === 0) {
19049
19030
  var {
19050
19031
  width
19051
- } = controlNode.value.getBoundingClientRect();
19032
+ } = getRect(controlNode.value);
19052
19033
  controlPosition.value = -(width + width * 0.25);
19053
19034
  }
19054
19035
  startY = event.touches[0].clientY;
@@ -20438,8 +20419,7 @@ function __render__$f(_ctx, _cache) {
20438
20419
  onClick: _ctx.handleClick,
20439
20420
  onClear: _ctx.handleClear
20440
20421
  })),
20441
- {
20442
- "prepend-icon": vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "prepend-icon")]),
20422
+ vue.createSlots({
20443
20423
  "append-icon": vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "append-icon")]),
20444
20424
  default: vue.withCtx(() => [vue.createElementVNode(
20445
20425
  "div",
@@ -20524,7 +20504,19 @@ function __render__$f(_ctx, _cache) {
20524
20504
  ))]) : vue.createCommentVNode("v-if", true)],
20525
20505
  2
20526
20506
  /* CLASS */
20527
- ), vue.renderSlot(_ctx.$slots, "arrow-icon", {
20507
+ ), _ctx.useCustomPlaceholder ? (vue.openBlock(), vue.createElementBlock(
20508
+ "span",
20509
+ {
20510
+ key: 0,
20511
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"))),
20512
+ style: vue.normalizeStyle({
20513
+ color: _ctx.placeholderColor
20514
+ })
20515
+ },
20516
+ vue.toDisplayString(_ctx.placeholder),
20517
+ 7
20518
+ /* TEXT, CLASS, STYLE */
20519
+ )) : vue.createCommentVNode("v-if", true), vue.renderSlot(_ctx.$slots, "arrow-icon", {
20528
20520
  focus: _ctx.isFocus
20529
20521
  }, () => [vue.createVNode(
20530
20522
  _component_var_icon,
@@ -20541,11 +20533,15 @@ function __render__$f(_ctx, _cache) {
20541
20533
  6
20542
20534
  /* CLASS, STYLE */
20543
20535
  )]),
20544
- _: 3
20545
- /* FORWARDED */
20546
- },
20547
- 16
20548
- /* FULL_PROPS */
20536
+ _: 2
20537
+ /* DYNAMIC */
20538
+ }, [_ctx.$slots["prepend-icon"] ? {
20539
+ name: "prepend-icon",
20540
+ fn: vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "prepend-icon")]),
20541
+ key: "0"
20542
+ } : void 0]),
20543
+ 1040
20544
+ /* FULL_PROPS, DYNAMIC_SLOTS */
20549
20545
  )]),
20550
20546
  _: 3
20551
20547
  /* FORWARDED */
@@ -20604,6 +20600,24 @@ var __sfc__$g = vue.defineComponent({
20604
20600
  } = useValidation();
20605
20601
  var menuEl = vue.ref(null);
20606
20602
  var placement = vue.computed(() => props2.variant === "outlined" ? "bottom-start" : "cover-top-start");
20603
+ var placeholderColor = vue.computed(() => {
20604
+ var {
20605
+ hint,
20606
+ blurColor,
20607
+ focusColor: focusColor2
20608
+ } = props2;
20609
+ if (hint) {
20610
+ return void 0;
20611
+ }
20612
+ if (errorMessage.value) {
20613
+ return "var(--field-decorator-error-color)";
20614
+ }
20615
+ if (isFocus.value) {
20616
+ return focusColor2 || "var(--field-decorator-focus-color)";
20617
+ }
20618
+ return blurColor || "var(--field-decorator-blur-color)";
20619
+ });
20620
+ var useCustomPlaceholder = vue.computed(() => !props2.hint && isEmpty(props2.modelValue) && !isFocus.value);
20607
20621
  var computeLabel = () => {
20608
20622
  var {
20609
20623
  multiple: multiple2,
@@ -20818,6 +20832,8 @@ var __sfc__$g = vue.defineComponent({
20818
20832
  menuEl,
20819
20833
  placement,
20820
20834
  cursor,
20835
+ placeholderColor,
20836
+ useCustomPlaceholder,
20821
20837
  n: n$h,
20822
20838
  classes: classes$d,
20823
20839
  handleFocus,
@@ -21389,7 +21405,7 @@ var __sfc__$e = vue.defineComponent({
21389
21405
  if (!isVertical.value) {
21390
21406
  return e.clientX - getLeft(currentTarget);
21391
21407
  }
21392
- return maxDistance.value - (e.clientY - currentTarget.getBoundingClientRect().top);
21408
+ return maxDistance.value - (e.clientY - getRect(currentTarget).top);
21393
21409
  };
21394
21410
  var thumbStyle = (thumb) => {
21395
21411
  var key = isVertical.value ? "bottom" : "left";
@@ -24244,7 +24260,7 @@ var __sfc__$2 = vue.defineComponent({
24244
24260
  var {
24245
24261
  width,
24246
24262
  height
24247
- } = inner.value.getBoundingClientRect();
24263
+ } = getRect(inner.value);
24248
24264
  return {
24249
24265
  width,
24250
24266
  height
@@ -24698,7 +24714,7 @@ var __sfc__$1 = vue.defineComponent({
24698
24714
  top: top2,
24699
24715
  width,
24700
24716
  height
24701
- } = container.value.getBoundingClientRect();
24717
+ } = getRect(container.value);
24702
24718
  center.x = left2 + width / 2;
24703
24719
  center.y = top2 + height / 2;
24704
24720
  if (type.value === "hour" && props2.format === "24hr") {
@@ -25548,7 +25564,7 @@ const TimePickerSfc = "";
25548
25564
  const TooltipSfc = "";
25549
25565
  const uploader = "";
25550
25566
  const UploaderSfc = "";
25551
- const version = "2.11.2";
25567
+ const version = "2.11.3-alpha.1685455534947";
25552
25568
  function install(app) {
25553
25569
  ActionSheet.install && app.use(ActionSheet);
25554
25570
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.11.2",
3
+ "version": "2.11.3-alpha.1685455534947",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -46,9 +46,9 @@
46
46
  "@popperjs/core": "^2.11.6",
47
47
  "dayjs": "^1.10.4",
48
48
  "decimal.js": "^10.2.1",
49
- "@varlet/icons": "2.11.2",
50
- "@varlet/shared": "2.11.2",
51
- "@varlet/use": "2.11.2"
49
+ "@varlet/icons": "2.11.3-alpha.1685455534947",
50
+ "@varlet/shared": "2.11.3-alpha.1685455534947",
51
+ "@varlet/use": "2.11.3-alpha.1685455534947"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@vue/runtime-core": "3.3.1",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^4.4.4",
64
64
  "vue": "3.3.2",
65
65
  "vue-router": "4.2.0",
66
- "@varlet/cli": "2.11.2",
67
- "@varlet/touch-emulator": "2.11.2"
66
+ "@varlet/cli": "2.11.3-alpha.1685455534947",
67
+ "@varlet/touch-emulator": "2.11.3-alpha.1685455534947"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",