wave-ui 1.48.0 → 1.49.3

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.
@@ -476,9 +476,6 @@ const _WaveUI = class {
476
476
  else {
477
477
  __privateSet(this, _notificationManager, new NotificationManager$1());
478
478
  mergeConfig(options);
479
- if (config.disableColorShades) {
480
- consoleWarn("WARNING - Since version 1.30, the option `disableColorShades` is replaced with `css.colorShades`.\nhttps://antoniandre.github.io/wave-ui/release-notes");
481
- }
482
479
  if (config.css.colorShades) {
483
480
  config.colorShades = {};
484
481
  for (let color in config.colors) {
@@ -804,7 +801,7 @@ var render$M = function() {
804
801
  return _vm.notifManager.dismiss(notif._uid);
805
802
  } }, model: { value: notif._value, callback: function($$v) {
806
803
  _vm.$set(notif, "_value", $$v);
807
- }, expression: "notif._value" } }, "w-alert", notif, false), [_vm._v(_vm._s(notif.message))]) : _vm._e()];
804
+ }, expression: "notif._value" } }, "w-alert", _vm.notifProps(notif), false), [_c("div", { domProps: { "innerHTML": _vm._s(notif.message) } })]) : _vm._e()];
808
805
  })], 2);
809
806
  };
810
807
  var staticRenderFns$M = [];
@@ -826,6 +823,12 @@ const __vue2_script$M = {
826
823
  return this.conf.transition ? this.conf.transition.replace("default", `slide-${this.conf.align === "left" ? "right" : "left"}`) : "";
827
824
  }
828
825
  },
826
+ methods: {
827
+ notifProps(notif) {
828
+ const _a = notif, { _value, _uid: _uid2, message, timeout } = _a, props = __objRest(_a, ["_value", "_uid", "message", "timeout"]);
829
+ return props;
830
+ }
831
+ },
829
832
  created() {
830
833
  this.notifManager = new NotificationManager$1();
831
834
  },
@@ -2633,7 +2636,7 @@ const __vue2_script$u = {
2633
2636
  case "file":
2634
2637
  return !!this.inputFiles.length;
2635
2638
  case "number":
2636
- return this.inputNumberError;
2639
+ return this.inputValue || this.inputValue === 0 || this.inputNumberError;
2637
2640
  case "date":
2638
2641
  case "time":
2639
2642
  return true;
@@ -3079,6 +3082,25 @@ var wList = /* @__PURE__ */ function() {
3079
3082
  return __component__$t.exports;
3080
3083
  }();
3081
3084
  var DetachableMixin = {
3085
+ props: {
3086
+ detachTo: { type: [String, Boolean, Object], deprecated: true },
3087
+ appendTo: { type: [String, Boolean, Object] },
3088
+ fixed: { type: Boolean },
3089
+ top: { type: Boolean },
3090
+ bottom: { type: Boolean },
3091
+ left: { type: Boolean },
3092
+ right: { type: Boolean },
3093
+ alignTop: { type: Boolean },
3094
+ alignBottom: { type: Boolean },
3095
+ alignLeft: { type: Boolean },
3096
+ alignRight: { type: Boolean },
3097
+ noPosition: { type: Boolean },
3098
+ zIndex: { type: [Number, String, Boolean] },
3099
+ activator: { type: String }
3100
+ },
3101
+ data: () => ({
3102
+ docAEventListenersHandlers: []
3103
+ }),
3082
3104
  computed: {
3083
3105
  appendToTarget() {
3084
3106
  const defaultTarget = ".w-app";
@@ -3106,6 +3128,24 @@ var DetachableMixin = {
3106
3128
  },
3107
3129
  detachableParentEl() {
3108
3130
  return this.appendToTarget;
3131
+ },
3132
+ hasSeparateActivator() {
3133
+ return !this.$scopedSlots.activator && typeof this.activator === "string";
3134
+ },
3135
+ activatorEl: {
3136
+ get() {
3137
+ if (this.hasSeparateActivator)
3138
+ return document.querySelector(this.activator);
3139
+ return this.$el.firstElementChild;
3140
+ },
3141
+ set() {
3142
+ }
3143
+ },
3144
+ position() {
3145
+ return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3146
+ },
3147
+ alignment() {
3148
+ return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
3109
3149
  }
3110
3150
  },
3111
3151
  methods: {
@@ -3186,14 +3226,72 @@ var DetachableMixin = {
3186
3226
  this.$nextTick(() => {
3187
3227
  var _a;
3188
3228
  this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
3189
- this.appendToTarget.appendChild(this.detachableEl);
3229
+ if (this.detachableEl)
3230
+ this.appendToTarget.appendChild(this.detachableEl);
3190
3231
  resolve();
3191
3232
  });
3192
3233
  });
3193
3234
  },
3194
3235
  removeFromDOM() {
3195
- if (this.detachableEl && this.detachableEl.parentNode)
3236
+ document.removeEventListener("mousedown", this.onOutsideMousedown);
3237
+ window.removeEventListener("resize", this.onResize);
3238
+ if (this.detachableEl && this.detachableEl.parentNode) {
3239
+ this.detachableVisible = false;
3196
3240
  this.detachableEl.remove();
3241
+ this.detachableEl = null;
3242
+ }
3243
+ }
3244
+ },
3245
+ mounted() {
3246
+ var _a;
3247
+ const wrapper = this.$el;
3248
+ if (this.$scopedSlots.activator)
3249
+ wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3250
+ else if (this.activator) {
3251
+ Object.entries(this.activatorEventHandlers).forEach(([eventName, handler]) => {
3252
+ eventName = eventName.replace("mouseenter", "mouseover").replace("mouseleave", "mouseout");
3253
+ const handlerWrap = (e) => {
3254
+ var _a2;
3255
+ if (((_a2 = e.target) == null ? void 0 : _a2.matches) && e.target.matches(this.activator))
3256
+ handler(e);
3257
+ };
3258
+ document.addEventListener(eventName, handlerWrap);
3259
+ this.docAEventListenersHandlers.push({ eventName, handler: handlerWrap });
3260
+ });
3261
+ }
3262
+ if (this.overlay) {
3263
+ this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3264
+ wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3265
+ }
3266
+ if (this.value)
3267
+ this.toggleMenu({ type: "click", target: this.activatorEl });
3268
+ },
3269
+ beforeDestroy() {
3270
+ var _a;
3271
+ this.close();
3272
+ this.removeFromDOM();
3273
+ if (this.docAEventListenersHandlers.length) {
3274
+ this.docAEventListenersHandlers.forEach(({ eventName, handler }) => {
3275
+ document.removeEventListener(eventName, handler);
3276
+ });
3277
+ }
3278
+ if (this.overlay && this.overlayEl.parentNode)
3279
+ this.overlayEl.remove();
3280
+ if (((_a = this.activatorEl) == null ? void 0 : _a.parentNode) && this.$scopedSlots.activator)
3281
+ this.activatorEl.remove();
3282
+ },
3283
+ watch: {
3284
+ value(bool) {
3285
+ if (!!bool !== this.detachableVisible)
3286
+ this.toggle({ type: "click", target: this.activatorEl });
3287
+ },
3288
+ detachTo() {
3289
+ this.removeFromDOM();
3290
+ this.insertInDOM();
3291
+ },
3292
+ appendTo() {
3293
+ this.removeFromDOM();
3294
+ this.insertInDOM();
3197
3295
  }
3198
3296
  }
3199
3297
  };
@@ -3242,24 +3340,12 @@ const __vue2_script$s = {
3242
3340
  titleClass: { type: [String, Object, Array] },
3243
3341
  contentClass: { type: [String, Object, Array] },
3244
3342
  arrow: { type: Boolean },
3245
- detachTo: { type: [String, Boolean, Object], deprecated: true },
3246
- appendTo: { type: [String, Boolean, Object] },
3247
- fixed: { type: Boolean },
3248
- top: { type: Boolean },
3249
- bottom: { type: Boolean },
3250
- left: { type: Boolean },
3251
- right: { type: Boolean },
3252
- alignTop: { type: Boolean },
3253
- alignBottom: { type: Boolean },
3254
- alignLeft: { type: Boolean },
3255
- alignRight: { type: Boolean },
3256
- zIndex: { type: [Number, String, Boolean] },
3257
3343
  minWidth: { type: [Number, String] },
3258
3344
  overlay: { type: Boolean },
3259
3345
  overlayClass: { type: [String, Object, Array] },
3260
3346
  overlayProps: { type: Object },
3261
3347
  persistent: { type: Boolean },
3262
- noPosition: { type: Boolean }
3348
+ delay: { type: Number }
3263
3349
  },
3264
3350
  emits: ["input", "update:modelValue", "open", "close"],
3265
3351
  data: () => ({
@@ -3270,7 +3356,6 @@ const __vue2_script$s = {
3270
3356
  top: 0,
3271
3357
  left: 0
3272
3358
  },
3273
- activatorEl: null,
3274
3359
  activatorWidth: 0,
3275
3360
  detachableEl: null,
3276
3361
  timeoutId: null
@@ -3279,12 +3364,6 @@ const __vue2_script$s = {
3279
3364
  transitionName() {
3280
3365
  return this.transition || "scale-fade";
3281
3366
  },
3282
- position() {
3283
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3284
- },
3285
- alignment() {
3286
- return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
3287
- },
3288
3367
  menuMinWidth() {
3289
3368
  if (this.minWidth === "activator")
3290
3369
  return this.activatorWidth ? `${this.activatorWidth}px` : 0;
@@ -3331,8 +3410,8 @@ const __vue2_script$s = {
3331
3410
  let handlers = {};
3332
3411
  if (this.showOnHover) {
3333
3412
  handlers = {
3334
- focus: this.toggleMenu,
3335
- blur: this.toggleMenu,
3413
+ focus: this.toggle,
3414
+ blur: this.toggle,
3336
3415
  mouseenter: (e) => {
3337
3416
  this.hoveringActivator = true;
3338
3417
  this.open(e);
@@ -3346,15 +3425,15 @@ const __vue2_script$s = {
3346
3425
  }
3347
3426
  };
3348
3427
  if (typeof window !== "undefined" && "ontouchstart" in window) {
3349
- handlers.click = this.toggleMenu;
3428
+ handlers.click = this.toggle;
3350
3429
  }
3351
3430
  } else
3352
- handlers = { click: this.toggleMenu };
3431
+ handlers = { click: this.toggle };
3353
3432
  return handlers;
3354
3433
  }
3355
3434
  },
3356
3435
  methods: {
3357
- toggleMenu(e) {
3436
+ toggle(e) {
3358
3437
  let shouldShowMenu = this.detachableVisible;
3359
3438
  if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
3360
3439
  shouldShowMenu = !shouldShowMenu;
@@ -3368,16 +3447,17 @@ const __vue2_script$s = {
3368
3447
  shouldShowMenu = false;
3369
3448
  }
3370
3449
  this.timeoutId = clearTimeout(this.timeoutId);
3371
- if (shouldShowMenu) {
3372
- this.$emit("update:modelValue", this.detachableVisible = true);
3373
- this.$emit("input", true);
3374
- this.$emit("open");
3450
+ if (shouldShowMenu)
3375
3451
  this.open(e);
3376
- } else
3452
+ else
3377
3453
  this.close();
3378
3454
  },
3379
3455
  async open(e) {
3456
+ if (this.delay)
3457
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
3380
3458
  this.detachableVisible = true;
3459
+ if (this.activator)
3460
+ this.activatorEl = e.target;
3381
3461
  await this.insertInDOM();
3382
3462
  if (this.minWidth === "activator")
3383
3463
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -3407,39 +3487,6 @@ const __vue2_script$s = {
3407
3487
  document.removeEventListener("mousedown", this.onOutsideMousedown);
3408
3488
  window.removeEventListener("resize", this.onResize);
3409
3489
  }
3410
- },
3411
- mounted() {
3412
- var _a;
3413
- const wrapper = this.$el;
3414
- this.activatorEl = wrapper.firstElementChild;
3415
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3416
- if (this.overlay) {
3417
- this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3418
- wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3419
- }
3420
- if (this.value)
3421
- this.toggleMenu({ type: "click", target: this.activatorEl });
3422
- },
3423
- beforeDestroy() {
3424
- this.removeFromDOM();
3425
- if (this.overlay && this.overlayEl.parentNode)
3426
- this.overlayEl.remove();
3427
- if (this.activatorEl && this.activatorEl.parentNode)
3428
- this.activatorEl.remove();
3429
- },
3430
- watch: {
3431
- value(bool) {
3432
- if (!!bool !== this.detachableVisible)
3433
- this.toggleMenu({ type: "click", target: this.activatorEl });
3434
- },
3435
- detachTo() {
3436
- this.removeFromDOM();
3437
- this.insertInDOM();
3438
- },
3439
- appendTo() {
3440
- this.removeFromDOM();
3441
- this.insertInDOM();
3442
- }
3443
3490
  }
3444
3491
  };
3445
3492
  const __cssModules$s = {};
@@ -4296,8 +4343,9 @@ const __vue2_script$k = {
4296
4343
  openMenu() {
4297
4344
  this.showMenu = true;
4298
4345
  setTimeout(() => {
4346
+ var _a;
4299
4347
  const itemIndex = this.inputValue.length ? this.inputValue[0].index : 0;
4300
- this.$refs["w-list"].$el.querySelector(`#w-select-menu--${this._uid}_item-${itemIndex + 1}`).focus();
4348
+ (_a = this.$refs["w-list"].$el.querySelector(`#w-select-menu--${this._uid}_item-${itemIndex + 1}`)) == null ? void 0 : _a.focus();
4301
4349
  }, 100);
4302
4350
  },
4303
4351
  closeMenu() {
@@ -5576,7 +5624,7 @@ var render$8 = function() {
5576
5624
  var _vm = this;
5577
5625
  var _h = _vm.$createElement;
5578
5626
  var _c = _vm._self._c || _h;
5579
- return _c("div", { staticClass: "w-tooltip-wrap" }, [_vm._t("activator", null, { "on": _vm.eventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.detachableVisible ? _c("div", { ref: "detachable", staticClass: "w-tooltip", class: _vm.classes, style: _vm.styles }, [_vm._t("default")], 2) : _vm._e()])], 2);
5627
+ return _c("div", { staticClass: "w-tooltip-wrap" }, [_vm._t("activator", null, { "on": _vm.activatorEventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.detachableVisible ? _c("div", { ref: "detachable", staticClass: "w-tooltip", class: _vm.classes, style: _vm.styles }, [_vm._t("default")], 2) : _vm._e()])], 2);
5580
5628
  };
5581
5629
  var staticRenderFns$8 = [];
5582
5630
  var wTooltip_vue_vue_type_style_index_0_lang = "";
@@ -5594,20 +5642,8 @@ const __vue2_script$8 = {
5594
5642
  round: { type: Boolean },
5595
5643
  transition: { type: String },
5596
5644
  tooltipClass: { type: [String, Object, Array] },
5597
- detachTo: { type: [String, Boolean, Object], deprecated: true },
5598
- appendTo: { type: [String, Boolean, Object] },
5599
- fixed: { type: Boolean },
5600
- top: { type: Boolean },
5601
- bottom: { type: Boolean },
5602
- left: { type: Boolean },
5603
- right: { type: Boolean },
5604
- alignTop: { type: Boolean },
5605
- alignBottom: { type: Boolean },
5606
- alignLeft: { type: Boolean },
5607
- alignRight: { type: Boolean },
5608
- zIndex: { type: [Number, String, Boolean] },
5609
5645
  persistent: { type: Boolean },
5610
- noPosition: { type: Boolean }
5646
+ delay: { type: Number }
5611
5647
  },
5612
5648
  emits: ["input", "update:modelValue", "open", "close"],
5613
5649
  data: () => ({
@@ -5617,7 +5653,6 @@ const __vue2_script$8 = {
5617
5653
  top: 0,
5618
5654
  left: 0
5619
5655
  },
5620
- activatorEl: null,
5621
5656
  detachableEl: null,
5622
5657
  timeoutId: null
5623
5658
  }),
@@ -5629,12 +5664,6 @@ const __vue2_script$8 = {
5629
5664
  const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
5630
5665
  return this.transition || `w-tooltip-slide-fade-${direction}`;
5631
5666
  },
5632
- position() {
5633
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
5634
- },
5635
- alignment() {
5636
- return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
5637
- },
5638
5667
  classes() {
5639
5668
  return __spreadProps(__spreadValues({
5640
5669
  [this.color]: this.color,
@@ -5658,7 +5687,7 @@ const __vue2_script$8 = {
5658
5687
  "--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
5659
5688
  };
5660
5689
  },
5661
- eventHandlers() {
5690
+ activatorEventHandlers() {
5662
5691
  let handlers = {};
5663
5692
  if (this.showOnClick)
5664
5693
  handlers = { click: this.toggle };
@@ -5694,16 +5723,17 @@ const __vue2_script$8 = {
5694
5723
  else if (["mouseleave", "blur"].includes(e.type) && !this.showOnClick)
5695
5724
  shouldShowTooltip = false;
5696
5725
  this.timeoutId = clearTimeout(this.timeoutId);
5697
- if (shouldShowTooltip) {
5698
- this.$emit("update:modelValue", this.detachableVisible = true);
5699
- this.$emit("input", true);
5700
- this.$emit("open");
5726
+ if (shouldShowTooltip)
5701
5727
  this.open(e);
5702
- } else
5728
+ else
5703
5729
  this.close();
5704
5730
  },
5705
5731
  async open(e) {
5732
+ if (this.delay)
5733
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
5706
5734
  this.detachableVisible = true;
5735
+ if (this.activator)
5736
+ this.activatorEl = e.target;
5707
5737
  await this.insertInDOM();
5708
5738
  if (this.minWidth === "activator")
5709
5739
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -5733,32 +5763,6 @@ const __vue2_script$8 = {
5733
5763
  document.removeEventListener("mousedown", this.onOutsideMousedown);
5734
5764
  window.removeEventListener("resize", this.onResize);
5735
5765
  }
5736
- },
5737
- mounted() {
5738
- const wrapper = this.$el;
5739
- this.activatorEl = wrapper.firstElementChild;
5740
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
5741
- if (this.value)
5742
- this.toggle({ type: "click", target: this.activatorEl });
5743
- },
5744
- beforeDestroy() {
5745
- this.removeFromDOM();
5746
- if (this.activatorEl && this.activatorEl.parentNode)
5747
- this.activatorEl.remove();
5748
- },
5749
- watch: {
5750
- value(bool) {
5751
- if (bool !== this.detachableVisible)
5752
- this.toggle({ type: "click", target: this.activatorEl });
5753
- },
5754
- detachTo() {
5755
- this.removeFromDOM();
5756
- this.insertInDOM();
5757
- },
5758
- appendTo() {
5759
- this.removeFromDOM();
5760
- this.insertInDOM();
5761
- }
5762
5766
  }
5763
5767
  };
5764
5768
  const __cssModules$8 = {};