wave-ui 2.28.1 → 2.31.1

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.
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { reactive, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, withKeys, createBlock, withModifiers, createCommentVNode, renderSlot, createVNode, withCtx, mergeProps, toHandlers, createTextVNode, toDisplayString, TransitionGroup, Transition, normalizeStyle, resolveDynamicComponent, createSlots, withDirectives, vModelText, vModelDynamic, resolveDirective, KeepAlive, vShow } from "vue";
36
+ import { reactive, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, withKeys, createBlock, withModifiers, createCommentVNode, renderSlot, createVNode, withCtx, mergeProps, toHandlers, createTextVNode, toDisplayString, TransitionGroup, Transition, normalizeStyle, resolveDynamicComponent, createSlots, withDirectives, vModelText, vModelDynamic, resolveDirective, KeepAlive } from "vue";
37
37
  const config = reactive({
38
38
  breakpoints: {
39
39
  xs: 600,
@@ -447,9 +447,6 @@ const _WaveUI = class {
447
447
  app.use(_WaveUI);
448
448
  notificationManager = reactive(new NotificationManager$1());
449
449
  mergeConfig(options);
450
- if (config.disableColorShades) {
451
- consoleWarn("WARNING - Since version 1.30 (Vue 2) & 2.17 (Vue 3), the option `disableColorShades` is replaced with `css.colorShades`.\nhttps://antoniandre.github.io/wave-ui/release-notes");
452
- }
453
450
  if (config.css.colorShades) {
454
451
  config.colorShades = {};
455
452
  for (let color in config.colors) {
@@ -500,10 +497,10 @@ let WaveUI = _WaveUI;
500
497
  __publicField(WaveUI, "instance", null);
501
498
  __publicField(WaveUI, "vueInstance", null);
502
499
  WaveUI.version = "__VERSION__";
503
- const _hoisted_1$s = ["aria-expanded"];
504
- const _hoisted_2$f = ["onClick", "onFocus", "onKeypress", "tabindex"];
505
- const _hoisted_3$c = ["innerHTML"];
506
- const _hoisted_4$b = ["innerHTML"];
500
+ const _hoisted_1$u = ["aria-expanded"];
501
+ const _hoisted_2$e = ["onClick", "onFocus", "onKeypress", "tabindex"];
502
+ const _hoisted_3$b = ["innerHTML"];
503
+ const _hoisted_4$a = ["innerHTML"];
507
504
  function render$O(_ctx, _cache, $props, $setup, $data, $options) {
508
505
  const _component_w_button = resolveComponent("w-button");
509
506
  const _component_w_transition_expand = resolveComponent("w-transition-expand");
@@ -525,7 +522,7 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) {
525
522
  }, [
526
523
  $props.expandIcon && !$props.expandIconRight ? (openBlock(), createBlock(_component_w_button, {
527
524
  key: 0,
528
- class: "w-accordion__expand-icon",
525
+ class: normalizeClass(["w-accordion__expand-icon", { "w-accordion__expand-icon--expanded": item._expanded }]),
529
526
  icon: item._expanded && $props.collapseIcon || $props.expandIcon,
530
527
  disabled: item._disabled || null,
531
528
  tabindex: -1,
@@ -533,7 +530,7 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) {
533
530
  onKeypress: _cache[0] || (_cache[0] = withModifiers(() => {
534
531
  }, ["stop"])),
535
532
  onClick: withModifiers(($event) => !item._disabled && $options.toggleItem(item, $event), ["stop"])
536
- }, null, 8, ["icon", "disabled", "onClick"])) : createCommentVNode("", true),
533
+ }, null, 8, ["icon", "disabled", "onClick", "class"])) : createCommentVNode("", true),
537
534
  _ctx.$slots[`item-title.${item.id || i + 1}`] ? renderSlot(_ctx.$slots, `item-title.${item.id || i + 1}`, {
538
535
  key: 1,
539
536
  item: $options.getOriginalItem(item),
@@ -548,18 +545,18 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) {
548
545
  createElementVNode("div", {
549
546
  class: "grow",
550
547
  innerHTML: item[$props.itemTitleKey]
551
- }, null, 8, _hoisted_3$c)
548
+ }, null, 8, _hoisted_3$b)
552
549
  ]),
553
550
  $props.expandIcon && $props.expandIconRight ? (openBlock(), createBlock(_component_w_button, {
554
551
  key: 3,
555
- class: "w-accordion__expand-icon",
552
+ class: normalizeClass(["w-accordion__expand-icon", { "w-accordion__expand-icon--expanded": item._expanded }]),
556
553
  icon: item._expanded && $props.collapseIcon || $props.expandIcon,
557
554
  text: "",
558
555
  onKeypress: _cache[1] || (_cache[1] = withModifiers(() => {
559
556
  }, ["stop"])),
560
557
  onClick: withModifiers(($event) => !item._disabled && $options.toggleItem(item, $event), ["stop"])
561
- }, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
562
- ], 42, _hoisted_2$f),
558
+ }, null, 8, ["icon", "onClick", "class"])) : createCommentVNode("", true)
559
+ ], 42, _hoisted_2$e),
563
560
  createVNode(_component_w_transition_expand, { y: "" }, {
564
561
  default: withCtx(() => [
565
562
  item._expanded ? (openBlock(), createElementBlock("div", {
@@ -579,22 +576,23 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) {
579
576
  }, () => [
580
577
  createElementVNode("div", {
581
578
  innerHTML: item[$props.itemContentKey]
582
- }, null, 8, _hoisted_4$b)
579
+ }, null, 8, _hoisted_4$a)
583
580
  ])
584
581
  ], 2)) : createCommentVNode("", true)
585
582
  ]),
586
583
  _: 2
587
584
  }, 1024)
588
- ], 10, _hoisted_1$s);
585
+ ], 10, _hoisted_1$u);
589
586
  }), 128))
590
587
  ], 2);
591
588
  }
592
589
  var wAccordion_vue_vue_type_style_index_0_lang = "";
593
590
  var _export_sfc = (sfc, props) => {
591
+ const target = sfc.__vccOpts || sfc;
594
592
  for (const [key, val] of props) {
595
- sfc[key] = val;
593
+ target[key] = val;
596
594
  }
597
- return sfc;
595
+ return target;
598
596
  };
599
597
  const _sfc_main$O = {
600
598
  name: "w-accordion",
@@ -669,7 +667,7 @@ const _sfc_main$O = {
669
667
  }
670
668
  };
671
669
  var wAccordion = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", render$O]]);
672
- const _hoisted_1$r = { class: "w-alert__content" };
670
+ const _hoisted_1$t = { class: "w-alert__content" };
673
671
  function render$N(_ctx, _cache, $props, $setup, $data, $options) {
674
672
  const _component_w_icon = resolveComponent("w-icon");
675
673
  const _component_w_button = resolveComponent("w-button");
@@ -687,7 +685,7 @@ function render$N(_ctx, _cache, $props, $setup, $data, $options) {
687
685
  ]),
688
686
  _: 1
689
687
  })) : createCommentVNode("", true),
690
- createElementVNode("div", _hoisted_1$r, [
688
+ createElementVNode("div", _hoisted_1$t, [
691
689
  renderSlot(_ctx.$slots, "default")
692
690
  ]),
693
691
  $props.dismiss ? (openBlock(), createBlock(_component_w_button, {
@@ -784,6 +782,7 @@ const _sfc_main$N = {
784
782
  }
785
783
  };
786
784
  var wAlert = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", render$N]]);
785
+ const _hoisted_1$s = ["innerHTML"];
787
786
  function render$M(_ctx, _cache, $props, $setup, $data, $options) {
788
787
  const _component_w_alert = resolveComponent("w-alert");
789
788
  return openBlock(), createBlock(TransitionGroup, {
@@ -802,9 +801,11 @@ function render$M(_ctx, _cache, $props, $setup, $data, $options) {
802
801
  modelValue: notif._value,
803
802
  "onUpdate:modelValue": ($event) => notif._value = $event,
804
803
  onClose: ($event) => _ctx.notifManager.dismiss(notif._uid)
805
- }, notif), {
804
+ }, $options.notifProps(notif)), {
806
805
  default: withCtx(() => [
807
- createTextVNode(toDisplayString(notif.message), 1)
806
+ createElementVNode("div", {
807
+ innerHTML: notif.message
808
+ }, null, 8, _hoisted_1$s)
808
809
  ]),
809
810
  _: 2
810
811
  }, 1040, ["modelValue", "onUpdate:modelValue", "onClose"])) : createCommentVNode("", true)
@@ -832,6 +833,12 @@ const _sfc_main$M = {
832
833
  return this.conf.transition ? this.conf.transition.replace("default", `slide-${this.conf.align === "left" ? "right" : "left"}`) : "";
833
834
  }
834
835
  },
836
+ methods: {
837
+ notifProps(notif) {
838
+ const _a = notif, { _value, _uid, message, timeout } = _a, props = __objRest(_a, ["_value", "_uid", "message", "timeout"]);
839
+ return props;
840
+ }
841
+ },
835
842
  created() {
836
843
  this.notifManager = new NotificationManager$1();
837
844
  },
@@ -991,7 +998,7 @@ const _sfc_main$L = {
991
998
  classes() {
992
999
  return {
993
1000
  "d-block": this.block,
994
- "row": this.row,
1001
+ row: this.row,
995
1002
  "align-center": this.alignCenter,
996
1003
  "align-end": this.alignEnd,
997
1004
  "justify-center": this.justifyCenter,
@@ -1134,7 +1141,7 @@ const _sfc_main$K = {
1134
1141
  }
1135
1142
  };
1136
1143
  var wBadge = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", render$K]]);
1137
- const _hoisted_1$q = ["innerHTML"];
1144
+ const _hoisted_1$r = ["innerHTML"];
1138
1145
  function render$J(_ctx, _cache, $props, $setup, $data, $options) {
1139
1146
  const _component_w_icon = resolveComponent("w-icon");
1140
1147
  return openBlock(), createElementBlock("div", {
@@ -1186,7 +1193,7 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
1186
1193
  }) : (openBlock(), createElementBlock("span", {
1187
1194
  key: `${i}f`,
1188
1195
  innerHTML: item[$props.itemLabelKey]
1189
- }, null, 8, _hoisted_1$q))
1196
+ }, null, 8, _hoisted_1$r))
1190
1197
  ], 64);
1191
1198
  }), 256))
1192
1199
  ], 2);
@@ -1224,11 +1231,11 @@ const _sfc_main$J = {
1224
1231
  }
1225
1232
  };
1226
1233
  var wBreadcrumbs = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", render$J]]);
1227
- const _hoisted_1$p = {
1234
+ const _hoisted_1$q = {
1228
1235
  key: 0,
1229
1236
  class: "w-button__loader"
1230
1237
  };
1231
- const _hoisted_2$e = /* @__PURE__ */ createElementVNode("svg", { viewBox: "0 0 40 40" }, [
1238
+ const _hoisted_2$d = /* @__PURE__ */ createElementVNode("svg", { viewBox: "0 0 40 40" }, [
1232
1239
  /* @__PURE__ */ createElementVNode("circle", {
1233
1240
  cx: "20",
1234
1241
  cy: "20",
@@ -1256,9 +1263,9 @@ function render$I(_ctx, _cache, $props, $setup, $data, $options) {
1256
1263
  })) : renderSlot(_ctx.$slots, "default", { key: 1 }),
1257
1264
  createVNode(Transition, { name: "scale-fade" }, {
1258
1265
  default: withCtx(() => [
1259
- $props.loading ? (openBlock(), createElementBlock("div", _hoisted_1$p, [
1266
+ $props.loading ? (openBlock(), createElementBlock("div", _hoisted_1$q, [
1260
1267
  renderSlot(_ctx.$slots, "loading", {}, () => [
1261
- _hoisted_2$e
1268
+ _hoisted_2$d
1262
1269
  ])
1263
1270
  ])) : createCommentVNode("", true)
1264
1271
  ]),
@@ -1365,11 +1372,11 @@ var wButton = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", render$I]]);
1365
1372
  const objectifyClasses = (classes = {}) => {
1366
1373
  if (typeof classes === "string")
1367
1374
  classes = { [classes]: true };
1368
- else if (typeof classes === "array")
1375
+ else if (Array.isArray(classes))
1369
1376
  classes = { [classes.join(" ")]: true };
1370
1377
  return classes;
1371
1378
  };
1372
- const _hoisted_1$o = ["innerHTML"];
1379
+ const _hoisted_1$p = ["innerHTML"];
1373
1380
  function render$H(_ctx, _cache, $props, $setup, $data, $options) {
1374
1381
  const _component_w_image = resolveComponent("w-image");
1375
1382
  return openBlock(), createElementBlock("div", {
@@ -1385,7 +1392,7 @@ function render$H(_ctx, _cache, $props, $setup, $data, $options) {
1385
1392
  key: 1,
1386
1393
  class: normalizeClass(["w-card__title", $options.titleClasses]),
1387
1394
  innerHTML: $props.title
1388
- }, null, 10, _hoisted_1$o)) : createCommentVNode("", true),
1395
+ }, null, 10, _hoisted_1$p)) : createCommentVNode("", true),
1389
1396
  $props.image ? (openBlock(), createBlock(_component_w_image, mergeProps({
1390
1397
  key: 2,
1391
1398
  class: "w-card__image",
@@ -1494,10 +1501,10 @@ var FormElementMixin = {
1494
1501
  }
1495
1502
  }
1496
1503
  };
1497
- const _hoisted_1$n = ["id", "name", "checked", "disabled", "required", "tabindex", "aria-checked"];
1498
- const _hoisted_2$d = ["for"];
1499
- const _hoisted_3$b = ["for", "innerHTML"];
1500
- const _hoisted_4$a = /* @__PURE__ */ createElementVNode("svg", {
1504
+ const _hoisted_1$o = ["id", "name", "checked", "disabled", "required", "tabindex", "aria-checked"];
1505
+ const _hoisted_2$c = ["for"];
1506
+ const _hoisted_3$a = ["for", "innerHTML"];
1507
+ const _hoisted_4$9 = /* @__PURE__ */ createElementVNode("svg", {
1501
1508
  width: "11px",
1502
1509
  height: "9px",
1503
1510
  viewbox: "0 0 12 9"
@@ -1505,7 +1512,7 @@ const _hoisted_4$a = /* @__PURE__ */ createElementVNode("svg", {
1505
1512
  /* @__PURE__ */ createElementVNode("polyline", { points: "1 5 4 8 10 2" })
1506
1513
  ], -1);
1507
1514
  const _hoisted_5$8 = [
1508
- _hoisted_4$a
1515
+ _hoisted_4$9
1509
1516
  ];
1510
1517
  const _hoisted_6$5 = ["for"];
1511
1518
  const _hoisted_7$5 = ["for", "innerHTML"];
@@ -1535,7 +1542,7 @@ function render$G(_ctx, _cache, $props, $setup, $data, $options) {
1535
1542
  onKeypress: _cache[3] || (_cache[3] = withKeys((...args) => $options.onInput && $options.onInput(...args), ["enter"])),
1536
1543
  "aria-checked": $data.isChecked || "false",
1537
1544
  role: "checkbox"
1538
- }, null, 40, _hoisted_1$n),
1545
+ }, null, 40, _hoisted_1$o),
1539
1546
  $options.hasLabel && $props.labelOnLeft ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1540
1547
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
1541
1548
  key: 0,
@@ -1543,12 +1550,12 @@ function render$G(_ctx, _cache, $props, $setup, $data, $options) {
1543
1550
  for: `w-checkbox--${_ctx._.uid}`
1544
1551
  }, [
1545
1552
  renderSlot(_ctx.$slots, "default")
1546
- ], 8, _hoisted_2$d)) : $props.label ? (openBlock(), createElementBlock("label", {
1553
+ ], 8, _hoisted_2$c)) : $props.label ? (openBlock(), createElementBlock("label", {
1547
1554
  key: 1,
1548
1555
  class: "w-checkbox__label w-form-el-shakable pr2",
1549
1556
  for: `w-checkbox--${_ctx._.uid}`,
1550
1557
  innerHTML: $props.label
1551
- }, null, 8, _hoisted_3$b)) : createCommentVNode("", true)
1558
+ }, null, 8, _hoisted_3$a)) : createCommentVNode("", true)
1552
1559
  ], 64)) : createCommentVNode("", true),
1553
1560
  createElementVNode("div", {
1554
1561
  class: normalizeClass(["w-checkbox__input", this.color]),
@@ -1645,7 +1652,7 @@ const _sfc_main$G = {
1645
1652
  }
1646
1653
  };
1647
1654
  var wCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", render$G]]);
1648
- const _hoisted_1$m = ["innerHTML"];
1655
+ const _hoisted_1$n = ["innerHTML"];
1649
1656
  function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1650
1657
  const _component_w_checkbox = resolveComponent("w-checkbox");
1651
1658
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.formRegister ? "w-form-element" : "div"), mergeProps({ ref: "formEl" }, _ctx.formRegister && { validators: _ctx.validators, inputValue: $options.checkboxItems.some((item) => item._isChecked), disabled: _ctx.isDisabled }, {
@@ -1688,7 +1695,7 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1688
1695
  }) : item.label ? (openBlock(), createElementBlock("div", {
1689
1696
  key: 2,
1690
1697
  innerHTML: item.label
1691
- }, null, 8, _hoisted_1$m)) : createCommentVNode("", true)
1698
+ }, null, 8, _hoisted_1$n)) : createCommentVNode("", true)
1692
1699
  ]),
1693
1700
  _: 2
1694
1701
  }, 1032, ["model-value", "name", "label", "label-on-left", "color", "round", "onUpdate:modelValue", "disabled", "readonly", "class"]);
@@ -1754,21 +1761,18 @@ const _sfc_main$F = {
1754
1761
  }
1755
1762
  };
1756
1763
  var wCheckboxes = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", render$F]]);
1757
- const _hoisted_1$l = { class: "w-confirm" };
1758
- const _hoisted_2$c = /* @__PURE__ */ createTextVNode("Are you sure?");
1759
- const _hoisted_3$a = /* @__PURE__ */ createTextVNode("Cancel");
1760
- const _hoisted_4$9 = /* @__PURE__ */ createTextVNode("Confirm");
1764
+ const _hoisted_1$m = { class: "w-confirm" };
1761
1765
  function render$E(_ctx, _cache, $props, $setup, $data, $options) {
1762
1766
  const _component_w_button = resolveComponent("w-button");
1763
1767
  const _component_w_flex = resolveComponent("w-flex");
1764
1768
  const _component_w_menu = resolveComponent("w-menu");
1765
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
1769
+ return openBlock(), createElementBlock("div", _hoisted_1$m, [
1766
1770
  createVNode(_component_w_menu, mergeProps({
1767
1771
  modelValue: _ctx.showPopup,
1768
1772
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.showPopup = $event)
1769
1773
  }, $options.wMenuProps), {
1770
1774
  activator: withCtx(({ on }) => [
1771
- createVNode(_component_w_button, mergeProps({ class: "w-confirm__button" }, toHandlers(on), $options.buttonProps), {
1775
+ createVNode(_component_w_button, mergeProps({ class: "w-confirm__button" }, __spreadValues(__spreadValues(__spreadValues({}, _ctx.$attrs), $options.buttonProps), on)), {
1772
1776
  default: withCtx(() => [
1773
1777
  renderSlot(_ctx.$slots, "default")
1774
1778
  ]),
@@ -1783,33 +1787,33 @@ function render$E(_ctx, _cache, $props, $setup, $data, $options) {
1783
1787
  default: withCtx(() => [
1784
1788
  createElementVNode("div", null, [
1785
1789
  renderSlot(_ctx.$slots, "question", {}, () => [
1786
- _hoisted_2$c
1790
+ createTextVNode(toDisplayString($props.question), 1)
1787
1791
  ])
1788
1792
  ]),
1789
1793
  createElementVNode("div", {
1790
1794
  class: normalizeClass(["w-flex justify-end", $props.inline ? "ml2" : "mt2"])
1791
1795
  }, [
1792
- !$props.noCancel ? (openBlock(), createBlock(_component_w_button, mergeProps({
1796
+ $props.cancel !== false ? (openBlock(), createBlock(_component_w_button, mergeProps({
1793
1797
  key: 0,
1794
1798
  class: "mr2"
1795
- }, $props.cancelButton, {
1796
- "bg-color": ($props.cancelButton || {}).bgColor || "error",
1799
+ }, $options.cancelButtonProps, {
1800
+ "bg-color": ($options.cancelButton || {}).bgColor || "error",
1797
1801
  onClick: $options.onCancel
1798
1802
  }), {
1799
1803
  default: withCtx(() => [
1800
1804
  renderSlot(_ctx.$slots, "cancel", {}, () => [
1801
- _hoisted_3$a
1805
+ createTextVNode(toDisplayString($options.cancelButton.label), 1)
1802
1806
  ])
1803
1807
  ]),
1804
1808
  _: 3
1805
1809
  }, 16, ["bg-color", "onClick"])) : createCommentVNode("", true),
1806
- createVNode(_component_w_button, mergeProps($props.confirmButton, {
1807
- "bg-color": ($props.confirmButton || {}).bgColor || "success",
1810
+ createVNode(_component_w_button, mergeProps($options.confirmButtonProps, {
1811
+ "bg-color": ($options.confirmButton || {}).bgColor || "success",
1808
1812
  onClick: $options.onConfirm
1809
1813
  }), {
1810
1814
  default: withCtx(() => [
1811
1815
  renderSlot(_ctx.$slots, "confirm", {}, () => [
1812
- _hoisted_4$9
1816
+ createTextVNode(toDisplayString($options.confirmButton.label), 1)
1813
1817
  ])
1814
1818
  ]),
1815
1819
  _: 3
@@ -1830,9 +1834,9 @@ const _sfc_main$E = {
1830
1834
  color: { type: String },
1831
1835
  icon: { type: String },
1832
1836
  mainButton: { type: Object },
1833
- noCancel: { type: Boolean },
1834
- cancelButton: { type: [Boolean, Object] },
1835
- confirmButton: { type: Object },
1837
+ question: { type: String, default: "Are you sure?" },
1838
+ cancel: { type: [Boolean, Object, String], default: void 0 },
1839
+ confirm: { type: [Object, String] },
1836
1840
  inline: { type: Boolean },
1837
1841
  menu: { type: Object },
1838
1842
  noArrow: { type: Boolean },
@@ -1853,6 +1857,26 @@ const _sfc_main$E = {
1853
1857
  props: []
1854
1858
  }),
1855
1859
  computed: {
1860
+ cancelButton() {
1861
+ let button = { label: typeof this.cancel === "string" ? this.cancel : "Cancel" };
1862
+ if (typeof this.cancel === "object")
1863
+ button = Object.assign({}, button, this.cancel);
1864
+ return button;
1865
+ },
1866
+ cancelButtonProps() {
1867
+ const _a = this.cancelButton, { label } = _a, props = __objRest(_a, ["label"]);
1868
+ return props;
1869
+ },
1870
+ confirmButton() {
1871
+ let button = { label: typeof this.confirm === "string" ? this.confirm : "Confirm" };
1872
+ if (typeof this.confirm === "object")
1873
+ button = Object.assign({}, button, this.confirm);
1874
+ return button;
1875
+ },
1876
+ confirmButtonProps() {
1877
+ const _a = this.confirmButton, { label } = _a, props = __objRest(_a, ["label"]);
1878
+ return props;
1879
+ },
1856
1880
  wMenuProps() {
1857
1881
  return __spreadValues({
1858
1882
  top: this.top,
@@ -2061,7 +2085,7 @@ const _sfc_main$B = {
2061
2085
  }
2062
2086
  };
2063
2087
  var wDivider = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", render$B]]);
2064
- const _hoisted_1$k = { class: "w-drawer-wrap__pushable" };
2088
+ const _hoisted_1$l = { class: "w-drawer-wrap__pushable" };
2065
2089
  function render$A(_ctx, _cache, $props, $setup, $data, $options) {
2066
2090
  const _component_w_overlay = resolveComponent("w-overlay");
2067
2091
  return $data.showWrapper || $props.pushContent ? (openBlock(), createElementBlock("div", {
@@ -2073,7 +2097,7 @@ function render$A(_ctx, _cache, $props, $setup, $data, $options) {
2073
2097
  class: "w-drawer-wrap__track",
2074
2098
  style: normalizeStyle($options.trackStyles)
2075
2099
  }, [
2076
- createElementVNode("div", _hoisted_1$k, [
2100
+ createElementVNode("div", _hoisted_1$l, [
2077
2101
  !$props.noOverlay ? (openBlock(), createBlock(_component_w_overlay, {
2078
2102
  key: 0,
2079
2103
  modelValue: $data.showDrawer,
@@ -2283,6 +2307,7 @@ const _sfc_main$z = {
2283
2307
  justifyEnd: { type: Boolean },
2284
2308
  justifySpaceBetween: { type: Boolean },
2285
2309
  justifySpaceAround: { type: Boolean },
2310
+ justifySpaceEvenly: { type: Boolean },
2286
2311
  basisZero: { type: Boolean },
2287
2312
  gap: { type: Number, default: 0 }
2288
2313
  },
@@ -2304,6 +2329,7 @@ const _sfc_main$z = {
2304
2329
  "justify-end": this.justifyEnd,
2305
2330
  "justify-space-between": this.justifySpaceBetween,
2306
2331
  "justify-space-around": this.justifySpaceAround,
2332
+ "justify-space-evenly": this.justifySpaceEvenly,
2307
2333
  "basis-zero": this.basisZero,
2308
2334
  [`w-flex--gap${this.gap}`]: this.gap
2309
2335
  };
@@ -2451,7 +2477,7 @@ const _sfc_main$y = {
2451
2477
  }
2452
2478
  };
2453
2479
  var wForm = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", render$y]]);
2454
- const _hoisted_1$j = {
2480
+ const _hoisted_1$k = {
2455
2481
  key: 0,
2456
2482
  class: "w-form-el__error error w-form-el__error w-form-el__error"
2457
2483
  };
@@ -2469,7 +2495,7 @@ function render$x(_ctx, _cache, $props, $setup, $data, $options) {
2469
2495
  createVNode(_component_w_transition_expand, { y: "" }, {
2470
2496
  default: withCtx(() => [
2471
2497
  _ctx.Validation.message ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2472
- _ctx.$slots["error-message"] ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
2498
+ _ctx.$slots["error-message"] ? (openBlock(), createElementBlock("div", _hoisted_1$k, [
2473
2499
  renderSlot(_ctx.$slots, "error-message", {
2474
2500
  message: _ctx.Validation.message
2475
2501
  })
@@ -2649,7 +2675,7 @@ const _sfc_main$w = {
2649
2675
  }
2650
2676
  };
2651
2677
  var wIcon = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", render$w]]);
2652
- const _hoisted_1$i = {
2678
+ const _hoisted_1$j = {
2653
2679
  key: 0,
2654
2680
  class: "w-image__loader"
2655
2681
  };
@@ -2674,7 +2700,7 @@ function render$v(_ctx, _cache, $props, $setup, $data, $options) {
2674
2700
  ]),
2675
2701
  _: 1
2676
2702
  }, 8, ["name"]),
2677
- !$props.noSpinner && $data.loading ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
2703
+ !$props.noSpinner && $data.loading ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
2678
2704
  _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(_component_w_progress, {
2679
2705
  key: 1,
2680
2706
  circle: "",
@@ -2819,11 +2845,11 @@ const _sfc_main$v = {
2819
2845
  }
2820
2846
  };
2821
2847
  var wImage = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", render$v]]);
2822
- const _hoisted_1$h = ["name"];
2848
+ const _hoisted_1$i = ["name"];
2823
2849
  const _hoisted_2$a = ["for"];
2824
2850
  const _hoisted_3$9 = ["for", "innerHTML"];
2825
2851
  const _hoisted_4$8 = ["id", "type", "name", "placeholder", "step", "min", "max", "minlength", "maxlength", "readonly", "aria-readonly", "disabled", "required", "tabindex"];
2826
- const _hoisted_5$7 = ["id", "name", "multiple"];
2852
+ const _hoisted_5$7 = ["id", "name", "multiple", "data-progress"];
2827
2853
  const _hoisted_6$4 = {
2828
2854
  class: "w-input__no-file",
2829
2855
  key: "no-file"
@@ -2854,22 +2880,22 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2854
2880
  type: "hidden",
2855
2881
  name: _ctx.name || null,
2856
2882
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.inputValue = $event)
2857
- }, null, 8, _hoisted_1$h)), [
2883
+ }, null, 8, _hoisted_1$i)), [
2858
2884
  [vModelText, $data.inputValue]
2859
2885
  ]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2860
2886
  $props.labelPosition === "left" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2861
2887
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
2862
2888
  key: 0,
2863
- class: "w-input__label w-input__label--left w-form-el-shakable",
2889
+ class: normalizeClass(["w-input__label w-input__label--left w-form-el-shakable", $options.validationClasses]),
2864
2890
  for: `w-input--${_ctx._.uid}`
2865
2891
  }, [
2866
2892
  renderSlot(_ctx.$slots, "default")
2867
- ], 8, _hoisted_2$a)) : $props.label ? (openBlock(), createElementBlock("label", {
2893
+ ], 10, _hoisted_2$a)) : $props.label ? (openBlock(), createElementBlock("label", {
2868
2894
  key: 1,
2869
- class: "w-input__label w-input__label--left w-form-el-shakable",
2895
+ class: normalizeClass(["w-input__label w-input__label--left w-form-el-shakable", $options.validationClasses]),
2870
2896
  for: `w-input--${_ctx._.uid}`,
2871
2897
  innerHTML: $props.label
2872
- }, null, 8, _hoisted_3$9)) : createCommentVNode("", true)
2898
+ }, null, 10, _hoisted_3$9)) : createCommentVNode("", true)
2873
2899
  ], 64)) : createCommentVNode("", true),
2874
2900
  createElementVNode("div", {
2875
2901
  class: normalizeClass(["w-input__input-wrap", $options.inputWrapClasses])
@@ -2889,6 +2915,7 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2889
2915
  $props.type !== "file" ? withDirectives((openBlock(), createElementBlock("input", mergeProps({
2890
2916
  key: 1,
2891
2917
  class: "w-input__input",
2918
+ ref: "input",
2892
2919
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.inputValue = $event)
2893
2920
  }, toHandlers($options.listeners), {
2894
2921
  onInput: _cache[3] || (_cache[3] = (...args) => $options.onInput && $options.onInput(...args)),
@@ -2910,9 +2937,9 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2910
2937
  tabindex: _ctx.tabindex || null
2911
2938
  }, $options.attrs), null, 16, _hoisted_4$8)), [
2912
2939
  [vModelDynamic, $data.inputValue]
2913
- ]) : createCommentVNode("", true),
2914
- $props.type === "file" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2940
+ ]) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2915
2941
  createElementVNode("input", mergeProps({
2942
+ ref: "input",
2916
2943
  id: `w-input--${_ctx._.uid}`,
2917
2944
  type: "file",
2918
2945
  name: _ctx.name || null,
@@ -2920,7 +2947,9 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2920
2947
  onBlur: _cache[7] || (_cache[7] = (...args) => $options.onBlur && $options.onBlur(...args)),
2921
2948
  onChange: _cache[8] || (_cache[8] = (...args) => $options.onFileChange && $options.onFileChange(...args)),
2922
2949
  multiple: $props.multiple || null
2923
- }, $options.attrs), null, 16, _hoisted_5$7),
2950
+ }, $options.attrs, {
2951
+ "data-progress": $options.overallFilesProgress
2952
+ }), null, 16, _hoisted_5$7),
2924
2953
  createVNode(TransitionGroup, {
2925
2954
  class: "w-input__input w-input__input--file",
2926
2955
  tag: "label",
@@ -2944,23 +2973,23 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2944
2973
  class: "filename",
2945
2974
  key: `${i}b`
2946
2975
  }, toDisplayString(file.base), 1)),
2947
- createTextVNode(toDisplayString(file.extension), 1)
2976
+ createTextVNode(toDisplayString(file.extension ? `.${file.extension}` : ""), 1)
2948
2977
  ]);
2949
2978
  }), 128))
2950
2979
  ]),
2951
2980
  _: 3
2952
2981
  }, 8, ["for"])
2953
- ], 64)) : createCommentVNode("", true),
2982
+ ], 64)),
2954
2983
  $props.labelPosition === "inside" && $options.showLabelInside ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
2955
2984
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
2956
2985
  key: 0,
2957
- class: normalizeClass(["w-input__label w-input__label--inside w-form-el-shakable", $data.isFocused && { [_ctx.valid === false ? "error" : $props.color]: $props.color || _ctx.valid === false }]),
2986
+ class: normalizeClass(["w-input__label w-input__label--inside w-form-el-shakable", $options.validationClasses]),
2958
2987
  for: `w-input--${_ctx._.uid}`
2959
2988
  }, [
2960
2989
  renderSlot(_ctx.$slots, "default")
2961
2990
  ], 10, _hoisted_8$3)) : $props.label ? (openBlock(), createElementBlock("label", {
2962
2991
  key: 1,
2963
- class: normalizeClass(["w-input__label w-input__label--inside w-form-el-shakable", $data.isFocused && { [_ctx.valid === false ? "error" : $props.color]: $props.color || _ctx.valid === false }]),
2992
+ class: normalizeClass(["w-input__label w-input__label--inside w-form-el-shakable", $options.validationClasses]),
2964
2993
  for: `w-input--${_ctx._.uid}`,
2965
2994
  innerHTML: $props.label
2966
2995
  }, null, 10, _hoisted_9$3)) : createCommentVNode("", true)
@@ -2976,9 +3005,16 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2976
3005
  createTextVNode(toDisplayString($props.innerIconRight), 1)
2977
3006
  ]),
2978
3007
  _: 1
2979
- }, 8, ["for"])) : createCommentVNode("", true)
3008
+ }, 8, ["for"])) : createCommentVNode("", true),
3009
+ $options.hasLoading || $props.showProgress && ($options.uploadInProgress || $options.uploadComplete) ? (openBlock(), createBlock(_component_w_progress, {
3010
+ key: 5,
3011
+ class: "fill-width",
3012
+ size: "2",
3013
+ color: $props.progressColor || $props.color,
3014
+ "model-value": $props.showProgress ? ($options.uploadInProgress || $options.uploadComplete) && $options.overallFilesProgress : $options.loadingValue
3015
+ }, null, 8, ["color", "model-value"])) : createCommentVNode("", true)
2980
3016
  ], 2),
2981
- $props.type === "file" && $data.inputFiles.length ? (openBlock(), createElementBlock("label", {
3017
+ $props.type === "file" && $props.preview && $data.inputFiles.length ? (openBlock(), createElementBlock("label", {
2982
3018
  key: 1,
2983
3019
  class: "d-flex",
2984
3020
  for: `w-input--${_ctx._.uid}`
@@ -2994,32 +3030,26 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2994
3030
  src: file.preview,
2995
3031
  alt: ""
2996
3032
  }, null, 8, _hoisted_11$2)) : (openBlock(), createElementBlock("i", {
2997
- class: "w-icon wi-file w-input__file-preview primary",
3033
+ class: normalizeClass(["w-icon w-input__file-preview primary size--md", $props.preview && typeof $props.preview === "string" ? $props.preview : "wi-file"]),
2998
3034
  key: `${i}c`
2999
- }))
3035
+ }, null, 2))
3000
3036
  ], 64);
3001
3037
  }), 256))
3002
3038
  ], 8, _hoisted_10$3)) : createCommentVNode("", true),
3003
3039
  $props.labelPosition === "right" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3004
3040
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
3005
3041
  key: 0,
3006
- class: "w-input__label w-input__label--right w-form-el-shakable",
3042
+ class: normalizeClass(["w-input__label w-input__label--right w-form-el-shakable", $options.validationClasses]),
3007
3043
  for: `w-input--${_ctx._.uid}`
3008
3044
  }, [
3009
3045
  renderSlot(_ctx.$slots, "default")
3010
- ], 8, _hoisted_12$1)) : $props.label ? (openBlock(), createElementBlock("label", {
3046
+ ], 10, _hoisted_12$1)) : $props.label ? (openBlock(), createElementBlock("label", {
3011
3047
  key: 1,
3012
- class: "w-input__label w-input__label--right w-form-el-shakable",
3048
+ class: normalizeClass(["w-input__label w-input__label--right w-form-el-shakable", $options.validationClasses]),
3013
3049
  for: `w-input--${_ctx._.uid}`,
3014
3050
  innerHTML: $props.label
3015
- }, null, 8, _hoisted_13$1)) : createCommentVNode("", true)
3016
- ], 64)) : createCommentVNode("", true),
3017
- $props.loading ? (openBlock(), createBlock(_component_w_progress, {
3018
- key: 3,
3019
- class: "fill-width",
3020
- size: "2",
3021
- color: $props.progressColor || $props.color
3022
- }, null, 8, ["color"])) : createCommentVNode("", true)
3051
+ }, null, 10, _hoisted_13$1)) : createCommentVNode("", true)
3052
+ ], 64)) : createCommentVNode("", true)
3023
3053
  ], 64))
3024
3054
  ]),
3025
3055
  _: 3
@@ -3052,17 +3082,20 @@ const _sfc_main$u = {
3052
3082
  shadow: { type: Boolean },
3053
3083
  tile: { type: Boolean },
3054
3084
  multiple: { type: Boolean },
3055
- preview: { type: Boolean },
3056
- loading: { type: Boolean }
3085
+ preview: { type: [Boolean, String], default: true },
3086
+ loading: { type: [Boolean, Number], default: false },
3087
+ showProgress: { type: [Boolean] },
3088
+ files: { type: Array }
3057
3089
  },
3058
- emits: ["input", "update:modelValue", "focus", "blur", "click:inner-icon-left", "click:inner-icon-right"],
3090
+ emits: ["input", "update:modelValue", "focus", "blur", "click:inner-icon-left", "click:inner-icon-right", "update:overallProgress"],
3059
3091
  data() {
3060
3092
  return {
3061
3093
  inputValue: this.modelValue,
3062
3094
  inputNumberError: false,
3063
3095
  isFocused: false,
3064
3096
  inputFiles: [],
3065
- fileReader: null
3097
+ fileReader: null,
3098
+ isAutofilled: false
3066
3099
  };
3067
3100
  },
3068
3101
  computed: {
@@ -3079,21 +3112,55 @@ const _sfc_main$u = {
3079
3112
  return htmlAttrs;
3080
3113
  },
3081
3114
  hasValue() {
3082
- return this.inputValue || ["date", "time"].includes(this.type) || this.type === "number" && this.inputNumberError || this.type === "file" && this.inputFiles.length;
3115
+ switch (this.type) {
3116
+ case "file":
3117
+ return !!this.inputFiles.length;
3118
+ case "number":
3119
+ return this.inputValue || this.inputValue === 0 || this.inputNumberError;
3120
+ case "date":
3121
+ case "time":
3122
+ return true;
3123
+ default:
3124
+ return this.inputValue || this.inputValue === 0;
3125
+ }
3083
3126
  },
3084
3127
  hasLabel() {
3085
3128
  return this.label || this.$slots.default;
3086
3129
  },
3130
+ hasLoading() {
3131
+ return ![void 0, false].includes(this.loading);
3132
+ },
3133
+ loadingValue() {
3134
+ let value;
3135
+ if (typeof this.loading === "number")
3136
+ value = this.loading;
3137
+ else if (this.loading) {
3138
+ value = this.type === "file" && this.overallFilesProgress ? this.overallFilesProgress : void 0;
3139
+ }
3140
+ return value;
3141
+ },
3087
3142
  showLabelInside() {
3088
3143
  return !this.staticLabel || !this.hasValue && !this.placeholder;
3089
3144
  },
3145
+ overallFilesProgress() {
3146
+ const progress = this.inputFiles.reduce((total2, file) => total2 + file.progress, 0);
3147
+ const total = progress / this.inputFiles.length;
3148
+ this.$emit("update:overallProgress", this.inputFiles.length ? total : void 0);
3149
+ return total;
3150
+ },
3151
+ uploadInProgress() {
3152
+ return this.overallFilesProgress > 0 && this.overallFilesProgress < 100;
3153
+ },
3154
+ uploadComplete() {
3155
+ return this.overallFilesProgress === 100;
3156
+ },
3090
3157
  classes() {
3091
3158
  return {
3092
3159
  "w-input": true,
3093
3160
  "w-input--file": this.type === "file",
3094
3161
  "w-input--disabled": this.isDisabled,
3095
3162
  "w-input--readonly": this.isReadonly,
3096
- [`w-input--${this.hasValue ? "filled" : "empty"}`]: true,
3163
+ [`w-input--${this.hasValue || this.isAutofilled ? "filled" : "empty"}`]: true,
3097
3164
  "w-input--focused": this.isFocused && !this.isReadonly,
3098
3165
  "w-input--dark": this.dark,
3099
3166
  "w-input--floating-label": this.hasLabel && this.labelPosition === "inside" && !this.staticLabel,
@@ -3103,6 +3170,11 @@ const _sfc_main$u = {
3103
3170
  "w-input--inner-icon-right": this.innerIconRight
3104
3171
  };
3105
3172
  },
3173
+ validationClasses() {
3174
+ return this.isFocused && {
3175
+ [this.valid === false ? "error" : this.color]: this.color || this.valid === false
3176
+ };
3177
+ },
3106
3178
  inputWrapClasses() {
3107
3179
  return {
3108
3180
  [this.valid === false ? "error" : this.color]: this.color || this.valid === false,
@@ -3114,7 +3186,8 @@ const _sfc_main$u = {
3114
3186
  "w-input__input-wrap--underline": !this.outline,
3115
3187
  "w-input__input-wrap--shadow": this.shadow,
3116
3188
  "w-input__input-wrap--no-padding": !this.outline && !this.bgColor && !this.shadow && !this.round,
3117
- "w-input__input-wrap--loading": this.loading
3189
+ "w-input__input-wrap--loading": this.loading || this.showProgress && this.uploadInProgress,
3190
+ "w-input__input-wrap--upload-complete": this.uploadComplete
3118
3191
  };
3119
3192
  }
3120
3193
  },
@@ -3134,29 +3207,34 @@ const _sfc_main$u = {
3134
3207
  },
3135
3208
  onFileChange(e) {
3136
3209
  this.inputFiles = [...e.target.files].map((original) => {
3137
- const [, base, extension] = original.name.match(/^(.*)(\..*?)$/);
3210
+ const [, base = "", extension = "", full = ""] = original.name.match(/^(.*?)\.([^.]*)$|(.*)/);
3138
3211
  const file = reactive({
3139
3212
  name: original.name,
3140
- base,
3213
+ base: base || full,
3141
3214
  extension,
3142
3215
  type: original.type,
3143
3216
  size: original.size,
3144
3217
  lastModified: original.lastModified,
3145
3218
  preview: null,
3146
- progress: 0
3219
+ progress: 0,
3220
+ file: original
3147
3221
  });
3148
- this.filePreview(original, file);
3222
+ this.readFile(original, file);
3149
3223
  return file;
3150
3224
  });
3151
3225
  this.$emit("update:modelValue", this.inputFiles);
3226
+ this.$emit("input", this.inputFiles);
3152
3227
  },
3153
- filePreview(original, file) {
3228
+ readFile(original, file) {
3154
3229
  const reader = new FileReader();
3155
- if (original.type && original.type.startsWith("image/")) {
3230
+ const isPreviewAnIcon = typeof this.preview === "string";
3231
+ const isFileAnImage = original.type && original.type.startsWith("image/");
3232
+ if (this.preview && !isPreviewAnIcon && isFileAnImage) {
3156
3233
  reader.addEventListener("load", (e) => {
3157
3234
  file.preview = e.target.result;
3158
3235
  });
3159
- }
3236
+ } else
3237
+ delete file.preview;
3160
3238
  reader.addEventListener("progress", (e) => {
3161
3239
  if (e.loaded && e.total)
3162
3240
  file.progress = e.loaded * 100 / e.total;
@@ -3164,9 +3242,17 @@ const _sfc_main$u = {
3164
3242
  reader.readAsDataURL(original);
3165
3243
  }
3166
3244
  },
3245
+ mounted() {
3246
+ setTimeout(() => {
3247
+ if (this.$refs.input && this.$refs.input.matches(":-webkit-autofill"))
3248
+ this.isAutofilled = true;
3249
+ }, 400);
3250
+ },
3167
3251
  watch: {
3168
3252
  modelValue(value) {
3169
3253
  this.inputValue = value;
3254
+ if (!value && value !== 0)
3255
+ this.isAutofilled = false;
3170
3256
  }
3171
3257
  }
3172
3258
  };
@@ -3503,34 +3589,248 @@ const _sfc_main$t = {
3503
3589
  }
3504
3590
  };
3505
3591
  var wList = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", render$t]]);
3506
- const _hoisted_1$g = { class: "w-menu-wrap" };
3592
+ var DetachableMixin = {
3593
+ props: {
3594
+ detachTo: { type: [String, Boolean, Object], deprecated: true },
3595
+ appendTo: { type: [String, Boolean, Object] },
3596
+ fixed: { type: Boolean },
3597
+ top: { type: Boolean },
3598
+ bottom: { type: Boolean },
3599
+ left: { type: Boolean },
3600
+ right: { type: Boolean },
3601
+ alignTop: { type: Boolean },
3602
+ alignBottom: { type: Boolean },
3603
+ alignLeft: { type: Boolean },
3604
+ alignRight: { type: Boolean },
3605
+ noPosition: { type: Boolean },
3606
+ zIndex: { type: [Number, String, Boolean] },
3607
+ activator: { type: String }
3608
+ },
3609
+ data: () => ({
3610
+ docAEventListenersHandlers: []
3611
+ }),
3612
+ computed: {
3613
+ appendToTarget() {
3614
+ const defaultTarget = ".w-app";
3615
+ if (this.detachTo && !this.appendTo) {
3616
+ consoleWarn(`The ${this.$options.name} prop \`detach-to\` is deprecated. You can replace it with \`append-to\`.`);
3617
+ }
3618
+ let target = this.appendTo || this.detachTo || defaultTarget;
3619
+ if (target === true)
3620
+ target = defaultTarget;
3621
+ else if (this.appendTo === "activator")
3622
+ target = this.$el.previousElementSibling;
3623
+ else if (target && !["object", "string"].includes(typeof target))
3624
+ target = defaultTarget;
3625
+ else if (typeof target === "object" && !target.nodeType) {
3626
+ target = defaultTarget;
3627
+ consoleWarn(`Invalid node provided in ${this.$options.name} \`append-to\`. Falling back to .w-app.`);
3628
+ }
3629
+ if (typeof target === "string")
3630
+ target = document.querySelector(target);
3631
+ if (!target) {
3632
+ consoleWarn(`Unable to locate ${this.appendTo ? `target ${this.appendTo}` : defaultTarget}`);
3633
+ target = document.querySelector(defaultTarget);
3634
+ }
3635
+ return target;
3636
+ },
3637
+ detachableParentEl() {
3638
+ return this.appendToTarget;
3639
+ },
3640
+ hasSeparateActivator() {
3641
+ return !this.$slots.activator && typeof this.activator === "string";
3642
+ },
3643
+ activatorEl: {
3644
+ get() {
3645
+ if (this.hasSeparateActivator)
3646
+ return document.querySelector(this.activator);
3647
+ return this.$el.firstElementChild;
3648
+ },
3649
+ set() {
3650
+ }
3651
+ },
3652
+ position() {
3653
+ return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3654
+ },
3655
+ alignment() {
3656
+ 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" || "";
3657
+ }
3658
+ },
3659
+ methods: {
3660
+ getActivatorCoordinates(e) {
3661
+ const { top, left, width, height } = (e ? e.target : this.activatorEl).getBoundingClientRect();
3662
+ let coords = { top, left, width, height };
3663
+ if (!this.fixed) {
3664
+ const { top: targetTop, left: targetLeft } = this.detachableParentEl.getBoundingClientRect();
3665
+ const computedStyles2 = window.getComputedStyle(this.detachableParentEl, null);
3666
+ coords = __spreadProps(__spreadValues({}, coords), {
3667
+ top: top - targetTop + this.detachableParentEl.scrollTop - parseInt(computedStyles2.getPropertyValue("border-top-width")),
3668
+ left: left - targetLeft + this.detachableParentEl.scrollLeft - parseInt(computedStyles2.getPropertyValue("border-left-width"))
3669
+ });
3670
+ }
3671
+ return coords;
3672
+ },
3673
+ computeDetachableCoords(e) {
3674
+ let { top, left, width, height } = this.getActivatorCoordinates(e);
3675
+ this.detachableEl.style.visibility = "hidden";
3676
+ this.detachableEl.style.display = "flex";
3677
+ const computedStyles2 = window.getComputedStyle(this.detachableEl, null);
3678
+ switch (this.position) {
3679
+ case "top": {
3680
+ top -= this.detachableEl.offsetHeight;
3681
+ if (this.alignRight) {
3682
+ left += width - this.detachableEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
3683
+ } else if (!this.alignLeft)
3684
+ left += (width - this.detachableEl.offsetWidth) / 2;
3685
+ break;
3686
+ }
3687
+ case "bottom": {
3688
+ top += height;
3689
+ if (this.alignRight) {
3690
+ left += width - this.detachableEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
3691
+ } else if (!this.alignLeft)
3692
+ left += (width - this.detachableEl.offsetWidth) / 2;
3693
+ break;
3694
+ }
3695
+ case "left": {
3696
+ left -= this.detachableEl.offsetWidth;
3697
+ if (this.alignBottom)
3698
+ top += height - this.detachableEl.offsetHeight;
3699
+ else if (!this.alignTop)
3700
+ top += (height - this.detachableEl.offsetHeight) / 2;
3701
+ break;
3702
+ }
3703
+ case "right": {
3704
+ left += width;
3705
+ if (this.alignBottom) {
3706
+ top += height - this.detachableEl.offsetHeight + parseInt(computedStyles2.getPropertyValue("margin-top"));
3707
+ } else if (!this.alignTop) {
3708
+ top += (height - this.detachableEl.offsetHeight) / 2 + parseInt(computedStyles2.getPropertyValue("margin-top"));
3709
+ }
3710
+ break;
3711
+ }
3712
+ }
3713
+ this.detachableEl.style.visibility = null;
3714
+ if (!this.detachableVisible)
3715
+ this.detachableEl.style.display = "none";
3716
+ this.detachableCoords = { top, left };
3717
+ },
3718
+ onResize() {
3719
+ if (this.minWidth === "activator")
3720
+ this.activatorWidth = this.activatorEl.offsetWidth;
3721
+ this.computeDetachableCoords();
3722
+ },
3723
+ onOutsideMousedown(e) {
3724
+ if (!this.detachableEl.contains(e.target) && !this.activatorEl.contains(e.target)) {
3725
+ this.$emit("update:modelValue", this.detachableVisible = false);
3726
+ this.$emit("input", false);
3727
+ this.$emit("close");
3728
+ document.removeEventListener("mousedown", this.onOutsideMousedown);
3729
+ window.removeEventListener("resize", this.onResize);
3730
+ }
3731
+ },
3732
+ insertInDOM() {
3733
+ return new Promise((resolve) => {
3734
+ this.$nextTick(() => {
3735
+ var _a;
3736
+ this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
3737
+ if (this.detachableEl)
3738
+ this.appendToTarget.appendChild(this.detachableEl);
3739
+ resolve();
3740
+ });
3741
+ });
3742
+ },
3743
+ removeFromDOM() {
3744
+ document.removeEventListener("mousedown", this.onOutsideMousedown);
3745
+ window.removeEventListener("resize", this.onResize);
3746
+ if (this.detachableEl && this.detachableEl.parentNode) {
3747
+ this.detachableVisible = false;
3748
+ this.detachableEl.remove();
3749
+ this.detachableEl = null;
3750
+ }
3751
+ }
3752
+ },
3753
+ mounted() {
3754
+ var _a;
3755
+ const wrapper = this.$el;
3756
+ if (this.$slots.activator)
3757
+ wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3758
+ else if (this.activator) {
3759
+ Object.entries(this.activatorEventHandlers).forEach(([eventName, handler]) => {
3760
+ eventName = eventName.replace("mouseenter", "mouseover").replace("mouseleave", "mouseout");
3761
+ const handlerWrap = (e) => {
3762
+ var _a2;
3763
+ if (((_a2 = e.target) == null ? void 0 : _a2.matches) && e.target.matches(this.activator))
3764
+ handler(e);
3765
+ };
3766
+ document.addEventListener(eventName, handlerWrap);
3767
+ this.docAEventListenersHandlers.push({ eventName, handler: handlerWrap });
3768
+ });
3769
+ }
3770
+ if (this.overlay) {
3771
+ this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3772
+ wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3773
+ }
3774
+ if (this.modelValue)
3775
+ this.toggleMenu({ type: "click", target: this.activatorEl });
3776
+ },
3777
+ beforeUnmount() {
3778
+ var _a;
3779
+ this.close();
3780
+ this.removeFromDOM();
3781
+ if (this.docAEventListenersHandlers.length) {
3782
+ this.docAEventListenersHandlers.forEach(({ eventName, handler }) => {
3783
+ document.removeEventListener(eventName, handler);
3784
+ });
3785
+ }
3786
+ if (this.overlay && this.overlayEl.parentNode)
3787
+ this.overlayEl.remove();
3788
+ if (((_a = this.activatorEl) == null ? void 0 : _a.parentNode) && this.$slots.activator)
3789
+ this.activatorEl.remove();
3790
+ },
3791
+ watch: {
3792
+ modelValue(bool) {
3793
+ if (!!bool !== this.detachableVisible)
3794
+ this.toggle({ type: "click", target: this.activatorEl });
3795
+ },
3796
+ detachTo() {
3797
+ this.removeFromDOM();
3798
+ this.insertInDOM();
3799
+ },
3800
+ appendTo() {
3801
+ this.removeFromDOM();
3802
+ this.insertInDOM();
3803
+ }
3804
+ }
3805
+ };
3806
+ const _hoisted_1$h = { class: "w-menu-wrap" };
3507
3807
  function render$s(_ctx, _cache, $props, $setup, $data, $options) {
3508
3808
  const _component_w_card = resolveComponent("w-card");
3509
3809
  const _component_w_overlay = resolveComponent("w-overlay");
3510
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
3810
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
3511
3811
  renderSlot(_ctx.$slots, "activator", { on: $options.activatorEventHandlers }),
3512
3812
  createVNode(Transition, {
3513
3813
  name: $options.transitionName,
3514
3814
  appear: ""
3515
3815
  }, {
3516
3816
  default: withCtx(() => [
3517
- $props.custom && _ctx.menuVisible ? (openBlock(), createElementBlock("div", {
3817
+ $props.custom && _ctx.detachableVisible ? (openBlock(), createElementBlock("div", {
3518
3818
  key: 0,
3519
3819
  class: normalizeClass(["w-menu", $options.classes]),
3520
- ref: "menu",
3521
- onClick: _cache[0] || (_cache[0] = ($event) => $props.hideOnMenuClick && $options.closeMenu(true)),
3820
+ ref: "detachable",
3821
+ onClick: _cache[0] || (_cache[0] = ($event) => $props.hideOnMenuClick && $options.close(true)),
3522
3822
  onMouseenter: _cache[1] || (_cache[1] = ($event) => $props.showOnHover && (_ctx.hoveringMenu = true)),
3523
- onMouseleave: _cache[2] || (_cache[2] = ($event) => $props.showOnHover && (_ctx.hoveringMenu = false, $options.closeMenu())),
3823
+ onMouseleave: _cache[2] || (_cache[2] = ($event) => $props.showOnHover && (_ctx.hoveringMenu = false, $options.close())),
3524
3824
  style: normalizeStyle($options.styles)
3525
3825
  }, [
3526
3826
  renderSlot(_ctx.$slots, "default")
3527
- ], 38)) : _ctx.menuVisible ? (openBlock(), createBlock(_component_w_card, {
3827
+ ], 38)) : _ctx.detachableVisible ? (openBlock(), createBlock(_component_w_card, {
3528
3828
  key: 1,
3529
3829
  class: normalizeClass(["w-menu", $options.classes]),
3530
- ref: "menu",
3531
- onClick: _cache[3] || (_cache[3] = ($event) => $props.hideOnMenuClick && $options.closeMenu(true)),
3830
+ ref: "detachable",
3831
+ onClick: _cache[3] || (_cache[3] = ($event) => $props.hideOnMenuClick && $options.close(true)),
3532
3832
  onMouseenter: _cache[4] || (_cache[4] = ($event) => $props.showOnHover && (_ctx.hoveringMenu = true)),
3533
- onMouseleave: _cache[5] || (_cache[5] = ($event) => $props.showOnHover && (_ctx.hoveringMenu = false, $options.closeMenu())),
3833
+ onMouseleave: _cache[5] || (_cache[5] = ($event) => $props.showOnHover && (_ctx.hoveringMenu = false, $options.close())),
3534
3834
  tile: $props.tile,
3535
3835
  "title-class": $options.titleClasses,
3536
3836
  "content-class": $options.contentClasses,
@@ -3562,18 +3862,19 @@ function render$s(_ctx, _cache, $props, $setup, $data, $options) {
3562
3862
  $props.overlay ? (openBlock(), createBlock(_component_w_overlay, mergeProps({
3563
3863
  key: 0,
3564
3864
  ref: "overlay",
3565
- "model-value": _ctx.menuVisible,
3865
+ "model-value": _ctx.detachableVisible,
3566
3866
  persistent: $props.persistent,
3567
3867
  class: $options.overlayClasses
3568
3868
  }, $props.overlayProps, {
3569
- "z-index": ($props.zIndex || 200) - 1,
3570
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.menuVisible = false)
3869
+ "z-index": (_ctx.zIndex || 200) - 1,
3870
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.detachableVisible = false)
3571
3871
  }), null, 16, ["model-value", "persistent", "class", "z-index"])) : createCommentVNode("", true)
3572
3872
  ]);
3573
3873
  }
3574
3874
  var wMenu_vue_vue_type_style_index_0_lang = "";
3575
3875
  const _sfc_main$s = {
3576
3876
  name: "w-menu",
3877
+ mixins: [DetachableMixin],
3577
3878
  props: {
3578
3879
  modelValue: {},
3579
3880
  showOnHover: { type: Boolean },
@@ -3590,75 +3891,36 @@ const _sfc_main$s = {
3590
3891
  titleClass: { type: [String, Object, Array] },
3591
3892
  contentClass: { type: [String, Object, Array] },
3592
3893
  arrow: { type: Boolean },
3593
- detachTo: { type: [String, Boolean, Object] },
3594
- fixed: { type: Boolean },
3595
- top: { type: Boolean },
3596
- bottom: { type: Boolean },
3597
- left: { type: Boolean },
3598
- right: { type: Boolean },
3599
- alignTop: { type: Boolean },
3600
- alignBottom: { type: Boolean },
3601
- alignLeft: { type: Boolean },
3602
- alignRight: { type: Boolean },
3603
- zIndex: { type: [Number, String, Boolean] },
3604
3894
  minWidth: { type: [Number, String] },
3605
3895
  overlay: { type: Boolean },
3606
3896
  overlayClass: { type: [String, Object, Array] },
3607
3897
  overlayProps: { type: Object },
3608
3898
  persistent: { type: Boolean },
3609
- noPosition: { type: Boolean }
3899
+ delay: { type: Number }
3610
3900
  },
3611
3901
  emits: ["input", "update:modelValue", "open", "close"],
3612
3902
  data: () => ({
3613
- menuVisible: false,
3903
+ detachableVisible: false,
3614
3904
  hoveringActivator: false,
3615
3905
  hoveringMenu: false,
3616
- menuCoordinates: {
3906
+ detachableCoords: {
3617
3907
  top: 0,
3618
3908
  left: 0
3619
3909
  },
3620
- activatorEl: null,
3621
3910
  activatorWidth: 0,
3622
- menuEl: null,
3911
+ detachableEl: null,
3623
3912
  timeoutId: null
3624
3913
  }),
3625
3914
  computed: {
3626
3915
  transitionName() {
3627
3916
  return this.transition || "scale-fade";
3628
3917
  },
3629
- detachToTarget() {
3630
- let target = this.detachTo || ".w-app";
3631
- if (target === true)
3632
- target = ".w-app";
3633
- else if (target && !["object", "string"].includes(typeof target))
3634
- target = ".w-app";
3635
- else if (typeof target === "object" && !target.nodeType) {
3636
- target = ".w-app";
3637
- consoleWarn("Invalid node provided in w-menu `detach-to`. Falling back to .w-app.");
3638
- }
3639
- if (typeof target === "string")
3640
- target = document.querySelector(target);
3641
- if (!target) {
3642
- consoleWarn(`Unable to locate ${this.detachTo ? `target ${this.detachTo}` : ".w-app"}`);
3643
- target = document.querySelector(".w-app");
3644
- }
3645
- return target;
3646
- },
3647
- menuParentEl() {
3648
- return this.detachToTarget;
3649
- },
3650
- position() {
3651
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3652
- },
3653
3918
  menuMinWidth() {
3654
3919
  if (this.minWidth === "activator")
3655
3920
  return this.activatorWidth ? `${this.activatorWidth}px` : 0;
3656
3921
  else
3657
3922
  return isNaN(this.minWidth) ? this.minWidth : this.minWidth ? `${this.minWidth}px` : 0;
3658
3923
  },
3659
- alignment() {
3660
- return (this.top || this.bottom) && this.alignLeft && "left" || (this.top || this.bottom) && this.alignRight && "right" || (this.left || this.right) && this.alignTop && "top" || (this.left || this.right) && this.alignBottom && "bottom" || "";
3661
- },
3662
3924
  menuClasses() {
3663
3925
  return objectifyClasses(this.menuClass);
3664
3926
  },
@@ -3689,8 +3951,8 @@ const _sfc_main$s = {
3689
3951
  styles() {
3690
3952
  return {
3691
3953
  zIndex: this.zIndex || this.zIndex === 0 || this.overlay && !this.zIndex && 200 || null,
3692
- top: this.menuCoordinates.top && `${~~this.menuCoordinates.top}px` || null,
3693
- left: this.menuCoordinates.left && `${~~this.menuCoordinates.left}px` || null,
3954
+ top: this.detachableCoords.top && `${~~this.detachableCoords.top}px` || null,
3955
+ left: this.detachableCoords.left && `${~~this.detachableCoords.left}px` || null,
3694
3956
  minWidth: this.minWidth && this.menuMinWidth || null,
3695
3957
  "--w-menu-bg-color": this.arrow && this.$waveui.colors[this.bgColor || "white"]
3696
3958
  };
@@ -3699,30 +3961,31 @@ const _sfc_main$s = {
3699
3961
  let handlers = {};
3700
3962
  if (this.showOnHover) {
3701
3963
  handlers = {
3702
- focus: this.toggleMenu,
3703
- blur: this.toggleMenu,
3964
+ focus: this.toggle,
3965
+ blur: this.toggle,
3704
3966
  mouseenter: (e) => {
3705
3967
  this.hoveringActivator = true;
3706
- this.openMenu(e);
3968
+ this.open(e);
3707
3969
  },
3708
3970
  mouseleave: (e) => {
3709
3971
  this.hoveringActivator = false;
3710
3972
  setTimeout(() => {
3711
3973
  if (!this.hoveringMenu)
3712
- this.closeMenu();
3974
+ this.close();
3713
3975
  }, 10);
3714
3976
  }
3715
3977
  };
3716
- if ("ontouchstart" in window)
3717
- handlers.click = this.toggleMenu;
3978
+ if (typeof window !== "undefined" && "ontouchstart" in window) {
3979
+ handlers.click = this.toggle;
3980
+ }
3718
3981
  } else
3719
- handlers = { click: this.toggleMenu };
3982
+ handlers = { click: this.toggle };
3720
3983
  return handlers;
3721
3984
  }
3722
3985
  },
3723
3986
  methods: {
3724
- toggleMenu(e) {
3725
- let shouldShowMenu = this.menuVisible;
3987
+ toggle(e) {
3988
+ let shouldShowMenu = this.detachableVisible;
3726
3989
  if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
3727
3990
  shouldShowMenu = !shouldShowMenu;
3728
3991
  } else if (e.type === "click" && !this.showOnHover)
@@ -3735,21 +3998,22 @@ const _sfc_main$s = {
3735
3998
  shouldShowMenu = false;
3736
3999
  }
3737
4000
  this.timeoutId = clearTimeout(this.timeoutId);
3738
- if (shouldShowMenu) {
3739
- this.$emit("update:modelValue", this.menuVisible = true);
3740
- this.$emit("input", true);
3741
- this.$emit("open");
3742
- this.openMenu(e);
3743
- } else
3744
- this.closeMenu();
3745
- },
3746
- async openMenu(e) {
3747
- this.menuVisible = true;
3748
- await this.insertMenu();
4001
+ if (shouldShowMenu)
4002
+ this.open(e);
4003
+ else
4004
+ this.close();
4005
+ },
4006
+ async open(e) {
4007
+ if (this.delay)
4008
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
4009
+ this.detachableVisible = true;
4010
+ if (this.activator)
4011
+ this.activatorEl = e.target;
4012
+ await this.insertInDOM();
3749
4013
  if (this.minWidth === "activator")
3750
4014
  this.activatorWidth = this.activatorEl.offsetWidth;
3751
4015
  if (!this.noPosition)
3752
- this.computeMenuPosition(e);
4016
+ this.computeDetachableCoords(e);
3753
4017
  this.timeoutId = setTimeout(() => {
3754
4018
  this.$emit("update:modelValue", true);
3755
4019
  this.$emit("input", true);
@@ -3760,134 +4024,19 @@ const _sfc_main$s = {
3760
4024
  if (!this.noPosition)
3761
4025
  window.addEventListener("resize", this.onResize);
3762
4026
  },
3763
- async closeMenu(force = false) {
3764
- if (!this.menuVisible)
4027
+ async close(force = false) {
4028
+ if (!this.detachableVisible)
3765
4029
  return;
3766
4030
  if (this.showOnHover && !force) {
3767
4031
  await new Promise((resolve) => setTimeout(resolve, 10));
3768
4032
  if (this.showOnHover && (this.hoveringMenu || this.hoveringActivator))
3769
4033
  return;
3770
4034
  }
3771
- this.$emit("update:modelValue", this.menuVisible = false);
4035
+ this.$emit("update:modelValue", this.detachableVisible = false);
3772
4036
  this.$emit("input", false);
3773
4037
  this.$emit("close");
3774
4038
  document.removeEventListener("mousedown", this.onOutsideMousedown);
3775
4039
  window.removeEventListener("resize", this.onResize);
3776
- },
3777
- onOutsideMousedown(e) {
3778
- if (!this.menuEl.contains(e.target) && !this.activatorEl.contains(e.target)) {
3779
- this.$emit("update:modelValue", this.menuVisible = false);
3780
- this.$emit("input", false);
3781
- this.$emit("close");
3782
- document.removeEventListener("mousedown", this.onOutsideMousedown);
3783
- window.removeEventListener("resize", this.onResize);
3784
- }
3785
- },
3786
- onResize() {
3787
- if (this.minWidth === "activator")
3788
- this.activatorWidth = this.activatorEl.offsetWidth;
3789
- this.computeMenuPosition();
3790
- },
3791
- getCoordinates(e) {
3792
- const { top, left, width, height } = (e ? e.target : this.activatorEl).getBoundingClientRect();
3793
- let coords = { top, left, width, height };
3794
- if (!this.fixed) {
3795
- const { top: targetTop, left: targetLeft } = this.menuParentEl.getBoundingClientRect();
3796
- const computedStyles2 = window.getComputedStyle(this.menuParentEl, null);
3797
- coords = __spreadProps(__spreadValues({}, coords), {
3798
- top: top - targetTop + this.menuParentEl.scrollTop - parseInt(computedStyles2.getPropertyValue("border-top-width")),
3799
- left: left - targetLeft + this.menuParentEl.scrollLeft - parseInt(computedStyles2.getPropertyValue("border-left-width"))
3800
- });
3801
- }
3802
- return coords;
3803
- },
3804
- computeMenuPosition(e) {
3805
- let { top, left, width, height } = this.getCoordinates(e);
3806
- this.menuEl.style.visibility = "hidden";
3807
- this.menuEl.style.display = "flex";
3808
- const computedStyles2 = window.getComputedStyle(this.menuEl, null);
3809
- switch (this.position) {
3810
- case "top": {
3811
- top -= this.menuEl.offsetHeight;
3812
- if (this.alignRight) {
3813
- left += width - this.menuEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
3814
- } else if (!this.alignLeft)
3815
- left += (width - this.menuEl.offsetWidth) / 2;
3816
- break;
3817
- }
3818
- case "bottom": {
3819
- top += height;
3820
- if (this.alignRight) {
3821
- left += width - this.menuEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
3822
- } else if (!this.alignLeft)
3823
- left += (width - this.menuEl.offsetWidth) / 2;
3824
- break;
3825
- }
3826
- case "left": {
3827
- left -= this.menuEl.offsetWidth;
3828
- if (this.alignBottom)
3829
- top += height - this.menuEl.offsetHeight;
3830
- else if (!this.alignTop)
3831
- top += (height - this.menuEl.offsetHeight) / 2;
3832
- break;
3833
- }
3834
- case "right": {
3835
- left += width;
3836
- if (this.alignBottom) {
3837
- top += height - this.menuEl.offsetHeight + parseInt(computedStyles2.getPropertyValue("margin-top"));
3838
- } else if (!this.alignTop) {
3839
- top += (height - this.menuEl.offsetHeight) / 2 + parseInt(computedStyles2.getPropertyValue("margin-top"));
3840
- }
3841
- break;
3842
- }
3843
- }
3844
- this.menuEl.style.visibility = null;
3845
- if (!this.menuVisible)
3846
- this.menuEl.style.display = "none";
3847
- this.menuCoordinates = { top, left };
3848
- },
3849
- insertMenu() {
3850
- return new Promise((resolve) => {
3851
- this.$nextTick(() => {
3852
- var _a;
3853
- this.menuEl = ((_a = this.$refs.menu) == null ? void 0 : _a.$el) || this.$refs.menu;
3854
- this.detachToTarget.appendChild(this.menuEl);
3855
- resolve();
3856
- });
3857
- });
3858
- },
3859
- removeMenu() {
3860
- if (this.menuEl && this.menuEl.parentNode)
3861
- this.menuEl.remove();
3862
- }
3863
- },
3864
- mounted() {
3865
- var _a;
3866
- const wrapper = this.$el;
3867
- this.activatorEl = wrapper.firstElementChild;
3868
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3869
- if (this.overlay) {
3870
- this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3871
- wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3872
- }
3873
- if (this.modelValue)
3874
- this.toggleMenu({ type: "click", target: this.activatorEl });
3875
- },
3876
- beforeUnmount() {
3877
- this.removeMenu();
3878
- if (this.overlay && this.overlayEl.parentNode)
3879
- this.overlayEl.remove();
3880
- if (this.activatorEl && this.activatorEl.parentNode)
3881
- this.activatorEl.remove();
3882
- },
3883
- watch: {
3884
- modelValue(bool) {
3885
- if (!!bool !== this.menuVisible)
3886
- this.toggleMenu({ type: "click", target: this.activatorEl });
3887
- },
3888
- detachTo() {
3889
- this.removeMenu();
3890
- this.insertMenu();
3891
4040
  }
3892
4041
  }
3893
4042
  };
@@ -4125,9 +4274,9 @@ const _sfc_main$q = {
4125
4274
  }
4126
4275
  };
4127
4276
  var wOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", render$q]]);
4128
- const _hoisted_1$f = { class: "w-parallax" };
4277
+ const _hoisted_1$g = { class: "w-parallax" };
4129
4278
  function render$p(_ctx, _cache, $props, $setup, $data, $options) {
4130
- return openBlock(), createElementBlock("div", _hoisted_1$f);
4279
+ return openBlock(), createElementBlock("div", _hoisted_1$g);
4131
4280
  }
4132
4281
  var wParallax_vue_vue_type_style_index_0_lang = "";
4133
4282
  const _sfc_main$p = {
@@ -4137,7 +4286,7 @@ const _sfc_main$p = {
4137
4286
  data: () => ({})
4138
4287
  };
4139
4288
  var wParallax = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", render$p]]);
4140
- const _hoisted_1$e = ["viewBox"];
4289
+ const _hoisted_1$f = ["viewBox"];
4141
4290
  const _hoisted_2$9 = ["cx", "cy", "r", "stroke-dasharray", "stroke-width"];
4142
4291
  const _hoisted_3$8 = ["viewBox"];
4143
4292
  const _hoisted_4$7 = ["cx", "cy", "r", "stroke-width", "stroke-linecap", "stroke-dasharray"];
@@ -4164,7 +4313,7 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) {
4164
4313
  "stroke-dasharray": _ctx.circleCircumference,
4165
4314
  "stroke-width": $props.stroke
4166
4315
  }, null, 10, _hoisted_2$9)) : createCommentVNode("", true)
4167
- ], 8, _hoisted_1$e)),
4316
+ ], 8, _hoisted_1$f)),
4168
4317
  (openBlock(), createElementBlock("svg", {
4169
4318
  class: "w-progress__progress",
4170
4319
  viewBox: `${$options.circleCenter / 2} ${$options.circleCenter / 2} ${$options.circleCenter} ${$options.circleCenter}`,
@@ -4263,7 +4412,7 @@ const _sfc_main$o = {
4263
4412
  }
4264
4413
  };
4265
4414
  var wProgress = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", render$o]]);
4266
- const _hoisted_1$d = ["id", "name", "checked", "disabled", "required", "tabindex", "aria-checked"];
4415
+ const _hoisted_1$e = ["id", "name", "checked", "disabled", "required", "tabindex", "aria-checked"];
4267
4416
  const _hoisted_2$8 = ["for"];
4268
4417
  const _hoisted_3$7 = ["for", "innerHTML"];
4269
4418
  const _hoisted_4$6 = ["for"];
@@ -4292,7 +4441,7 @@ function render$n(_ctx, _cache, $props, $setup, $data, $options) {
4292
4441
  onChange: _cache[1] || (_cache[1] = ($event) => $options.onInput($event)),
4293
4442
  "aria-checked": _ctx.inputValue || "false",
4294
4443
  role: "radio"
4295
- }, null, 40, _hoisted_1$d),
4444
+ }, null, 40, _hoisted_1$e),
4296
4445
  $options.hasLabel && $props.labelOnLeft ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4297
4446
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
4298
4447
  key: 0,
@@ -4402,7 +4551,7 @@ const _sfc_main$n = {
4402
4551
  }
4403
4552
  };
4404
4553
  var wRadio = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", render$n]]);
4405
- const _hoisted_1$c = ["innerHTML"];
4554
+ const _hoisted_1$d = ["innerHTML"];
4406
4555
  function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4407
4556
  const _component_w_radio = resolveComponent("w-radio");
4408
4557
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.formRegister ? "w-form-element" : "div"), mergeProps({ ref: "formEl" }, _ctx.formRegister && { validators: _ctx.validators, inputValue: _ctx.inputValue, disabled: _ctx.isDisabled }, {
@@ -4447,7 +4596,7 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4447
4596
  }) : item.label ? (openBlock(), createElementBlock("div", {
4448
4597
  key: 2,
4449
4598
  innerHTML: item.label
4450
- }, null, 8, _hoisted_1$c)) : createCommentVNode("", true)
4599
+ }, null, 8, _hoisted_1$d)) : createCommentVNode("", true)
4451
4600
  ]),
4452
4601
  _: 2
4453
4602
  }, 1032, ["model-value", "onUpdate:modelValue", "name", "label", "label-on-left", "color", "disabled", "readonly", "class"]);
@@ -4505,12 +4654,13 @@ const _sfc_main$m = {
4505
4654
  }
4506
4655
  };
4507
4656
  var wRadios = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", render$m]]);
4508
- const _hoisted_1$b = ["id", "name", "value"];
4657
+ const _hoisted_1$c = ["id", "name", "value"];
4509
4658
  const _hoisted_2$7 = ["disabled", "onMouseenter", "onClick", "tabindex"];
4510
4659
  function render$l(_ctx, _cache, $props, $setup, $data, $options) {
4511
4660
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.formRegister ? "w-form-element" : "div"), mergeProps({ ref: "formEl" }, _ctx.formRegister && { validators: _ctx.validators, inputValue: $data.rating, disabled: _ctx.isDisabled, readonly: _ctx.isReadonly }, {
4512
4661
  valid: _ctx.valid,
4513
- onReset: _cache[4] || (_cache[4] = ($event) => {
4662
+ "onUpdate:valid": _cache[4] || (_cache[4] = ($event) => _ctx.valid = $event),
4663
+ onReset: _cache[5] || (_cache[5] = ($event) => {
4514
4664
  _ctx.$emit("update:modelValue", $data.rating = null);
4515
4665
  _ctx.$emit("input", null);
4516
4666
  }),
@@ -4522,7 +4672,7 @@ function render$l(_ctx, _cache, $props, $setup, $data, $options) {
4522
4672
  name: _ctx.inputName,
4523
4673
  type: "hidden",
4524
4674
  value: $data.rating
4525
- }, null, 8, _hoisted_1$b),
4675
+ }, null, 8, _hoisted_1$c),
4526
4676
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.max, (i) => {
4527
4677
  return openBlock(), createElementBlock(Fragment, { key: i }, [
4528
4678
  _ctx.$slots.item ? renderSlot(_ctx.$slots, "item", {
@@ -4661,7 +4811,7 @@ const _sfc_main$l = {
4661
4811
  }
4662
4812
  };
4663
4813
  var wRating = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", render$l]]);
4664
- const _hoisted_1$a = ["for"];
4814
+ const _hoisted_1$b = ["for"];
4665
4815
  const _hoisted_2$6 = ["for", "innerHTML"];
4666
4816
  const _hoisted_3$6 = ["aria-expanded", "aria-owns", "aria-activedescendant"];
4667
4817
  const _hoisted_4$5 = {
@@ -4693,7 +4843,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
4693
4843
  for: `w-select--${_ctx._.uid}`
4694
4844
  }, [
4695
4845
  renderSlot(_ctx.$slots, "default")
4696
- ], 8, _hoisted_1$a)) : $props.label ? (openBlock(), createElementBlock("label", {
4846
+ ], 8, _hoisted_1$b)) : $props.label ? (openBlock(), createElementBlock("label", {
4697
4847
  key: 1,
4698
4848
  class: "w-select__label w-select__label--left w-form-el-shakable",
4699
4849
  for: `w-select--${_ctx._.uid}`,
@@ -4705,7 +4855,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
4705
4855
  "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.showMenu = $event),
4706
4856
  "menu-class": `w-select__menu ${$props.menuClass || ""}`,
4707
4857
  transition: "slide-fade-down",
4708
- "detach-to": ($props.menuProps || {}).detachTo !== void 0 ? ($props.menuProps || {}).detachTo : ".w-app",
4858
+ "append-to": ($props.menuProps || {}).appendTo !== void 0 ? ($props.menuProps || {}).appendTo : ".w-app",
4709
4859
  "align-left": "",
4710
4860
  custom: "",
4711
4861
  "min-width": "activator"
@@ -4834,7 +4984,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
4834
4984
  ]), 1032, ["model-value", "onUpdate:modelValue", "onItemSelect", "onKeydown:escape", "items", "multiple", "add-ids", "no-unselect", "selection-color", "item-color-key"])
4835
4985
  ]),
4836
4986
  _: 3
4837
- }, 16, ["modelValue", "menu-class", "detach-to"]),
4987
+ }, 16, ["modelValue", "menu-class", "append-to"]),
4838
4988
  $props.labelPosition === "right" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4839
4989
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
4840
4990
  key: 0,
@@ -5005,8 +5155,9 @@ const _sfc_main$k = {
5005
5155
  openMenu() {
5006
5156
  this.showMenu = true;
5007
5157
  setTimeout(() => {
5158
+ var _a;
5008
5159
  const itemIndex = this.inputValue.length ? this.inputValue[0].index : 0;
5009
- this.$refs["w-list"].$el.querySelector(`#w-select-menu--${this._.uid}_item-${itemIndex + 1}`).focus();
5160
+ (_a = this.$refs["w-list"].$el.querySelector(`#w-select-menu--${this._.uid}_item-${itemIndex + 1}`)) == null ? void 0 : _a.focus();
5010
5161
  }, 100);
5011
5162
  },
5012
5163
  closeMenu() {
@@ -5030,7 +5181,7 @@ const _sfc_main$k = {
5030
5181
  }
5031
5182
  };
5032
5183
  var wSelect = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", render$k]]);
5033
- const _hoisted_1$9 = ["for"];
5184
+ const _hoisted_1$a = ["for"];
5034
5185
  const _hoisted_2$5 = ["for", "innerHTML"];
5035
5186
  const _hoisted_3$5 = { class: "w-slider__track-wrap" };
5036
5187
  const _hoisted_4$4 = ["aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-readonly"];
@@ -5062,7 +5213,7 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) {
5062
5213
  for: `button--${_ctx._.uid}`
5063
5214
  }, [
5064
5215
  renderSlot(_ctx.$slots, "label-left")
5065
- ], 8, _hoisted_1$9)) : $props.labelLeft ? (openBlock(), createElementBlock("label", {
5216
+ ], 8, _hoisted_1$a)) : $props.labelLeft ? (openBlock(), createElementBlock("label", {
5066
5217
  key: 1,
5067
5218
  class: "w-slider__label w-slider__label--left w-form-el-shakable",
5068
5219
  for: `button--${_ctx._.uid}`,
@@ -5317,21 +5468,21 @@ const _sfc_main$j = {
5317
5468
  }
5318
5469
  };
5319
5470
  var wSlider = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", render$j]]);
5320
- const _hoisted_1$8 = { key: 0 };
5471
+ const _hoisted_1$9 = { key: 0 };
5321
5472
  function render$i(_ctx, _cache, $props, $setup, $data, $options) {
5322
- return $props.value || $props.value === void 0 ? (openBlock(), createElementBlock("div", {
5473
+ return $props.modelValue || $props.modelValue === void 0 ? (openBlock(), createElementBlock("div", {
5323
5474
  key: 0,
5324
5475
  class: normalizeClass(["w-spinner", $options.classes]),
5325
5476
  style: normalizeStyle($options.styles)
5326
5477
  }, [
5327
- $options.isThreeDots ? (openBlock(), createElementBlock("span", _hoisted_1$8)) : createCommentVNode("", true)
5478
+ $options.isThreeDots ? (openBlock(), createElementBlock("span", _hoisted_1$9)) : createCommentVNode("", true)
5328
5479
  ], 6)) : createCommentVNode("", true);
5329
5480
  }
5330
5481
  var wSpinner_vue_vue_type_style_index_0_lang = "";
5331
5482
  const _sfc_main$i = {
5332
5483
  name: "w-spinner",
5333
5484
  props: {
5334
- value: {},
5485
+ modelValue: {},
5335
5486
  color: { type: String, default: "primary" },
5336
5487
  xs: { type: Boolean },
5337
5488
  sm: { type: Boolean },
@@ -5368,9 +5519,9 @@ const _sfc_main$i = {
5368
5519
  }
5369
5520
  };
5370
5521
  var wSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", render$i]]);
5371
- const _hoisted_1$7 = { class: "w-steps" };
5522
+ const _hoisted_1$8 = { class: "w-steps" };
5372
5523
  function render$h(_ctx, _cache, $props, $setup, $data, $options) {
5373
- return openBlock(), createElementBlock("div", _hoisted_1$7);
5524
+ return openBlock(), createElementBlock("div", _hoisted_1$8);
5374
5525
  }
5375
5526
  var wSteps_vue_vue_type_style_index_0_lang = "";
5376
5527
  const _sfc_main$h = {
@@ -5380,7 +5531,7 @@ const _sfc_main$h = {
5380
5531
  data: () => ({})
5381
5532
  };
5382
5533
  var wSteps = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", render$h]]);
5383
- const _hoisted_1$6 = ["id", "name", "checked", "disabled", "readonly", "aria-readonly", "required", "tabindex", "aria-checked"];
5534
+ const _hoisted_1$7 = ["id", "name", "checked", "disabled", "readonly", "aria-readonly", "required", "tabindex", "aria-checked"];
5384
5535
  const _hoisted_2$4 = ["for"];
5385
5536
  const _hoisted_3$4 = ["for", "innerHTML"];
5386
5537
  const _hoisted_4$3 = ["for"];
@@ -5411,7 +5562,7 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) {
5411
5562
  onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("focus", $event)),
5412
5563
  "aria-checked": $data.isOn || "false",
5413
5564
  role: "switch"
5414
- }, null, 40, _hoisted_1$6),
5565
+ }, null, 40, _hoisted_1$7),
5415
5566
  $options.hasLabel && $props.labelOnLeft ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5416
5567
  _ctx.$slots.default ? (openBlock(), createElementBlock("label", {
5417
5568
  key: 0,
@@ -5523,15 +5674,15 @@ const _sfc_main$g = {
5523
5674
  }
5524
5675
  };
5525
5676
  var wSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", render$g]]);
5526
- const _hoisted_1$5 = { class: "w-tabs__content" };
5677
+ const _hoisted_1$6 = { class: "w-tabs__content" };
5527
5678
  function render$f(_ctx, _cache, $props, $setup, $data, $options) {
5528
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
5679
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
5529
5680
  renderSlot(_ctx.$slots, "default")
5530
5681
  ]);
5531
5682
  }
5532
5683
  const _sfc_main$f = {};
5533
5684
  var TabContent = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", render$f]]);
5534
- const _hoisted_1$4 = ["onClick", "onFocus", "tabindex", "onKeypress", "aria-selected"];
5685
+ const _hoisted_1$5 = ["onClick", "onFocus", "tabindex", "onKeypress", "aria-selected"];
5535
5686
  const _hoisted_2$3 = ["innerHTML"];
5536
5687
  const _hoisted_3$3 = {
5537
5688
  key: 0,
@@ -5577,7 +5728,7 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) {
5577
5728
  innerHTML: item[$props.itemTitleKey]
5578
5729
  }, null, 8, _hoisted_2$3)
5579
5730
  ])
5580
- ], 42, _hoisted_1$4);
5731
+ ], 42, _hoisted_1$5);
5581
5732
  }), 128)),
5582
5733
  _ctx.$slots["tabs-bar-extra"] ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
5583
5734
  renderSlot(_ctx.$slots, "tabs-bar-extra")
@@ -5785,7 +5936,7 @@ const _sfc_main$e = {
5785
5936
  }
5786
5937
  };
5787
5938
  var index = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", render$e]]);
5788
- const _hoisted_1$3 = { ref: "colgroup" };
5939
+ const _hoisted_1$4 = { ref: "colgroup" };
5789
5940
  const _hoisted_2$2 = ["width"];
5790
5941
  const _hoisted_3$2 = { key: 0 };
5791
5942
  const _hoisted_4$1 = ["onClick"];
@@ -5828,7 +5979,7 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) {
5828
5979
  onMouseover: _cache[2] || (_cache[2] = (...args) => $options.onMouseOver && $options.onMouseOver(...args)),
5829
5980
  onMouseout: _cache[3] || (_cache[3] = (...args) => $options.onMouseOut && $options.onMouseOut(...args))
5830
5981
  }, [
5831
- createElementVNode("colgroup", _hoisted_1$3, [
5982
+ createElementVNode("colgroup", _hoisted_1$4, [
5832
5983
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (header, i) => {
5833
5984
  return openBlock(), createElementBlock("col", {
5834
5985
  class: "w-table__col",
@@ -6266,7 +6417,7 @@ const _sfc_main$d = {
6266
6417
  }
6267
6418
  };
6268
6419
  var wTable = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", render$d]]);
6269
- const _hoisted_1$2 = ["role", "aria-pressed", "tabindex"];
6420
+ const _hoisted_1$3 = ["role", "aria-pressed", "tabindex"];
6270
6421
  function render$c(_ctx, _cache, $props, $setup, $data, $options) {
6271
6422
  return openBlock(), createElementBlock("span", mergeProps({ class: "w-tag" }, toHandlers(_ctx.$attrs), {
6272
6423
  onClick: _cache[1] || (_cache[1] = ($event) => {
@@ -6294,7 +6445,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) {
6294
6445
  role: "icon",
6295
6446
  "aria-hidden": "true"
6296
6447
  })) : createCommentVNode("", true)
6297
- ], 16, _hoisted_1$2);
6448
+ ], 16, _hoisted_1$3);
6298
6449
  }
6299
6450
  var wTag_vue_vue_type_style_index_0_lang = "";
6300
6451
  const _sfc_main$c = {
@@ -6346,7 +6497,7 @@ const _sfc_main$c = {
6346
6497
  }
6347
6498
  };
6348
6499
  var wTag = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", render$c]]);
6349
- const _hoisted_1$1 = ["for"];
6500
+ const _hoisted_1$2 = ["for"];
6350
6501
  const _hoisted_2$1 = ["for", "innerHTML"];
6351
6502
  const _hoisted_3$1 = ["id", "name", "placeholder", "rows", "cols", "readonly", "aria-readonly", "disabled", "required", "tabindex"];
6352
6503
  const _hoisted_4 = ["for"];
@@ -6373,7 +6524,7 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
6373
6524
  for: `w-textarea--${_ctx._.uid}`
6374
6525
  }, [
6375
6526
  renderSlot(_ctx.$slots, "default")
6376
- ], 8, _hoisted_1$1)) : $props.label ? (openBlock(), createElementBlock("label", {
6527
+ ], 8, _hoisted_1$2)) : $props.label ? (openBlock(), createElementBlock("label", {
6377
6528
  key: 1,
6378
6529
  class: "w-textarea__label w-textarea__label--left w-form-el-shakable",
6379
6530
  for: `w-textarea--${_ctx._.uid}`,
@@ -6500,7 +6651,7 @@ const _sfc_main$b = {
6500
6651
  return listeners;
6501
6652
  },
6502
6653
  hasValue() {
6503
- return this.inputValue;
6654
+ return this.inputValue || this.inputValue === 0;
6504
6655
  },
6505
6656
  hasLabel() {
6506
6657
  return this.label || this.$slots.default;
@@ -6597,11 +6748,11 @@ const _sfc_main$b = {
6597
6748
  }
6598
6749
  };
6599
6750
  var wTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", render$b]]);
6600
- const _hoisted_1 = { class: "w-timeline" };
6751
+ const _hoisted_1$1 = { class: "w-timeline" };
6601
6752
  const _hoisted_2 = ["innerHTML"];
6602
6753
  const _hoisted_3 = ["innerHTML"];
6603
6754
  function render$a(_ctx, _cache, $props, $setup, $data, $options) {
6604
- return openBlock(), createElementBlock("ul", _hoisted_1, [
6755
+ return openBlock(), createElementBlock("ul", _hoisted_1$1, [
6605
6756
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.items, (item, i) => {
6606
6757
  return openBlock(), createElementBlock("li", {
6607
6758
  class: "w-timeline-item",
@@ -6696,41 +6847,32 @@ const _sfc_main$9 = {
6696
6847
  }
6697
6848
  };
6698
6849
  var wToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", render$9]]);
6850
+ const _hoisted_1 = { class: "w-tooltip-wrap" };
6699
6851
  function render$8(_ctx, _cache, $props, $setup, $data, $options) {
6700
- return openBlock(), createElementBlock("div", {
6701
- class: normalizeClass(["w-tooltip-wrap", { "w-tooltip-wrap--attached": !$props.detachTo }]),
6702
- ref: "wrapper"
6703
- }, [
6704
- renderSlot(_ctx.$slots, "activator", { on: $options.eventHandlers }),
6852
+ return openBlock(), createElementBlock("div", _hoisted_1, [
6853
+ renderSlot(_ctx.$slots, "activator", { on: $options.activatorEventHandlers }),
6705
6854
  createVNode(Transition, {
6706
6855
  name: $options.transitionName,
6707
6856
  appear: ""
6708
6857
  }, {
6709
6858
  default: withCtx(() => [
6710
- withDirectives((openBlock(), createElementBlock("div", {
6859
+ _ctx.detachableVisible ? (openBlock(), createElementBlock("div", {
6711
6860
  class: normalizeClass(["w-tooltip", $options.classes]),
6712
- ref: (el) => _ctx.tooltipEl = el,
6861
+ ref: "detachable",
6713
6862
  key: _ctx._.uid,
6714
6863
  style: normalizeStyle($options.styles)
6715
6864
  }, [
6716
- $props.bgColor ? (openBlock(), createElementBlock("div", {
6717
- key: 0,
6718
- class: normalizeClass($props.color)
6719
- }, [
6720
- renderSlot(_ctx.$slots, "default")
6721
- ], 2)) : renderSlot(_ctx.$slots, "default", { key: 1 })
6722
- ], 6)), [
6723
- [vShow, _ctx.showTooltip]
6724
- ])
6865
+ renderSlot(_ctx.$slots, "default")
6866
+ ], 6)) : createCommentVNode("", true)
6725
6867
  ]),
6726
6868
  _: 3
6727
6869
  }, 8, ["name"])
6728
- ], 2);
6870
+ ]);
6729
6871
  }
6730
6872
  var wTooltip_vue_vue_type_style_index_0_lang = "";
6731
- const marginFromWindowSide = 4;
6732
6873
  const _sfc_main$8 = {
6733
6874
  name: "w-tooltip",
6875
+ mixins: [DetachableMixin],
6734
6876
  props: {
6735
6877
  modelValue: {},
6736
6878
  showOnClick: { type: Boolean },
@@ -6742,25 +6884,18 @@ const _sfc_main$8 = {
6742
6884
  round: { type: Boolean },
6743
6885
  transition: { type: String },
6744
6886
  tooltipClass: { type: [String, Object, Array] },
6745
- detachTo: {},
6746
- fixed: { type: Boolean },
6747
- top: { type: Boolean },
6748
- bottom: { type: Boolean },
6749
- left: { type: Boolean },
6750
- right: { type: Boolean },
6751
- zIndex: { type: [Number, String, Boolean] }
6887
+ persistent: { type: Boolean },
6888
+ delay: { type: Number }
6752
6889
  },
6753
6890
  emits: ["input", "update:modelValue", "open", "close"],
6754
6891
  data: () => ({
6755
- showTooltip: false,
6756
- coordinates: {
6892
+ detachableVisible: false,
6893
+ hoveringActivator: false,
6894
+ detachableCoords: {
6757
6895
  top: 0,
6758
- left: 0,
6759
- width: 0,
6760
- height: 0
6896
+ left: 0
6761
6897
  },
6762
- activatorEl: null,
6763
- tooltipEl: null,
6898
+ detachableEl: null,
6764
6899
  timeoutId: null
6765
6900
  }),
6766
6901
  computed: {
@@ -6771,68 +6906,17 @@ const _sfc_main$8 = {
6771
6906
  const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
6772
6907
  return this.transition || `w-tooltip-slide-fade-${direction}`;
6773
6908
  },
6774
- detachToTarget() {
6775
- let target = this.detachTo || ".w-app";
6776
- if (target === true)
6777
- target = ".w-app";
6778
- else if (target && !["object", "string"].includes(typeof target))
6779
- target = ".w-app";
6780
- else if (typeof target === "object" && !target.nodeType) {
6781
- target = ".w-app";
6782
- consoleWarn("Invalid node provided in w-tooltip `attach-to`. Falling back to .w-app.");
6783
- }
6784
- if (typeof target === "string")
6785
- target = document.querySelector(target);
6786
- if (!target) {
6787
- consoleWarn(`Unable to locate ${this.detachTo ? `target ${this.detachTo}` : ".w-app"}`);
6788
- target = document.querySelector(".w-app");
6789
- }
6790
- return target;
6791
- },
6792
- tooltipParentEl() {
6793
- return this.detachTo ? this.detachToTarget : this.$refs.wrapper;
6794
- },
6795
- position() {
6796
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
6797
- },
6798
- tooltipCoordinates() {
6799
- const coords = {};
6800
- const { top, left, width, height } = this.coordinates;
6801
- switch (this.position) {
6802
- case "top": {
6803
- coords.top = top;
6804
- coords.left = left + width / 2;
6805
- break;
6806
- }
6807
- case "bottom": {
6808
- coords.top = top + height;
6809
- coords.left = left + width / 2;
6810
- break;
6811
- }
6812
- case "left": {
6813
- coords.top = top + height / 2;
6814
- coords.left = left;
6815
- break;
6816
- }
6817
- case "right": {
6818
- coords.top = top + height / 2;
6819
- coords.left = left + width;
6820
- break;
6821
- }
6822
- }
6823
- return coords;
6824
- },
6825
6909
  classes() {
6826
6910
  return __spreadProps(__spreadValues({
6827
- [this.color]: !this.bgColor,
6828
- [`${this.bgColor} ${this.bgColor}--bg`]: this.bgColor
6911
+ [this.color]: this.color,
6912
+ [`${this.bgColor}--bg`]: this.bgColor
6829
6913
  }, this.tooltipClasses), {
6830
- [`w-tooltip--${this.position}`]: true,
6914
+ [`w-tooltip--${this.position}`]: !this.noPosition,
6915
+ [`w-tooltip--align-${this.alignment}`]: !this.noPosition && this.alignment,
6831
6916
  "w-tooltip--tile": this.tile,
6832
6917
  "w-tooltip--round": this.round,
6833
6918
  "w-tooltip--shadow": this.shadow,
6834
6919
  "w-tooltip--fixed": this.fixed,
6835
- "w-tooltip--active": this.showTooltip,
6836
6920
  "w-tooltip--no-border": this.noBorder || this.bgColor,
6837
6921
  "w-tooltip--custom-transition": this.transition
6838
6922
  });
@@ -6840,11 +6924,12 @@ const _sfc_main$8 = {
6840
6924
  styles() {
6841
6925
  return {
6842
6926
  zIndex: this.zIndex || this.zIndex === 0 || null,
6843
- top: `${~~this.tooltipCoordinates.top}px`,
6844
- left: `${~~this.tooltipCoordinates.left}px`
6927
+ top: this.detachableCoords.top && `${~~this.detachableCoords.top}px` || null,
6928
+ left: this.detachableCoords.left && `${~~this.detachableCoords.left}px` || null,
6929
+ "--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
6845
6930
  };
6846
6931
  },
6847
- eventHandlers() {
6932
+ activatorEventHandlers() {
6848
6933
  let handlers = {};
6849
6934
  if (this.showOnClick)
6850
6935
  handlers = { click: this.toggle };
@@ -6852,10 +6937,16 @@ const _sfc_main$8 = {
6852
6937
  handlers = {
6853
6938
  focus: this.toggle,
6854
6939
  blur: this.toggle,
6855
- mouseenter: this.toggle,
6856
- mouseleave: this.toggle
6940
+ mouseenter: (e) => {
6941
+ this.hoveringActivator = true;
6942
+ this.open(e);
6943
+ },
6944
+ mouseleave: (e) => {
6945
+ this.hoveringActivator = false;
6946
+ this.close();
6947
+ }
6857
6948
  };
6858
- if ("ontouchstart" in window)
6949
+ if (typeof window !== "undefined" && "ontouchstart" in window)
6859
6950
  handlers.click = this.toggle;
6860
6951
  }
6861
6952
  return handlers;
@@ -6863,8 +6954,8 @@ const _sfc_main$8 = {
6863
6954
  },
6864
6955
  methods: {
6865
6956
  toggle(e) {
6866
- let shouldShowTooltip = this.showTooltip;
6867
- if ("ontouchstart" in window) {
6957
+ let shouldShowTooltip = this.detachableVisible;
6958
+ if (typeof window !== "undefined" && "ontouchstart" in window) {
6868
6959
  if (e.type === "click")
6869
6960
  shouldShowTooltip = !shouldShowTooltip;
6870
6961
  } else if (e.type === "click" && this.showOnClick)
@@ -6874,89 +6965,45 @@ const _sfc_main$8 = {
6874
6965
  else if (["mouseleave", "blur"].includes(e.type) && !this.showOnClick)
6875
6966
  shouldShowTooltip = false;
6876
6967
  this.timeoutId = clearTimeout(this.timeoutId);
6877
- if (shouldShowTooltip) {
6878
- this.coordinates = this.getCoordinates(e);
6879
- this.timeoutId = setTimeout(() => {
6880
- this.showTooltip = true;
6881
- this.$emit("update:modelValue", true);
6882
- this.$emit("input", true);
6883
- this.$emit("open");
6884
- }, 10);
6885
- } else {
6886
- this.showTooltip = false;
6887
- this.$emit("update:modelValue", false);
6888
- this.$emit("input", false);
6889
- this.$emit("close");
6890
- }
6968
+ if (shouldShowTooltip)
6969
+ this.open(e);
6970
+ else
6971
+ this.close();
6972
+ },
6973
+ async open(e) {
6974
+ if (this.delay)
6975
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
6976
+ this.detachableVisible = true;
6977
+ if (this.activator)
6978
+ this.activatorEl = e.target;
6979
+ await this.insertInDOM();
6980
+ if (this.minWidth === "activator")
6981
+ this.activatorWidth = this.activatorEl.offsetWidth;
6982
+ if (!this.noPosition)
6983
+ this.computeDetachableCoords(e);
6984
+ this.timeoutId = setTimeout(() => {
6985
+ this.$emit("update:modelValue", true);
6986
+ this.$emit("input", true);
6987
+ this.$emit("open");
6988
+ }, 0);
6989
+ if (!this.persistent)
6990
+ document.addEventListener("mousedown", this.onOutsideMousedown);
6991
+ if (!this.noPosition)
6992
+ window.addEventListener("resize", this.onResize);
6891
6993
  },
6892
- getCoordinates() {
6893
- const { top, left, width, height } = this.activatorEl.getBoundingClientRect();
6894
- let coords = { top, left, width, height };
6895
- if (!this.fixed) {
6896
- const { top: targetTop, left: targetLeft } = this.tooltipParentEl.getBoundingClientRect();
6897
- coords = __spreadProps(__spreadValues({}, coords), { top: top - targetTop, left: left - targetLeft });
6898
- }
6899
- const tooltip = this.tooltipEl;
6900
- tooltip.style.visibility = "hidden";
6901
- tooltip.style.display = "table";
6902
- const computedStyles2 = window.getComputedStyle(tooltip, null);
6903
- if (this.position === "top" && top - tooltip.offsetHeight < 0) {
6904
- const margin = -parseInt(computedStyles2.getPropertyValue("margin-top"));
6905
- coords.top -= top - tooltip.offsetHeight - margin - marginFromWindowSide;
6906
- } else if (this.position === "left" && left - tooltip.offsetWidth < 0) {
6907
- const margin = -parseInt(computedStyles2.getPropertyValue("margin-left"));
6908
- coords.left -= left - tooltip.offsetWidth - margin - marginFromWindowSide;
6909
- } else if (this.position === "right" && left + width + tooltip.offsetWidth > window.innerWidth) {
6910
- const margin = parseInt(computedStyles2.getPropertyValue("margin-left"));
6911
- coords.left -= left + width + tooltip.offsetWidth - window.innerWidth + margin + marginFromWindowSide;
6912
- } else if (this.position === "bottom" && top + height + tooltip.offsetHeight > window.innerHeight) {
6913
- const margin = parseInt(computedStyles2.getPropertyValue("margin-top"));
6914
- coords.top -= top + height + tooltip.offsetHeight - window.innerHeight + margin + marginFromWindowSide;
6915
- }
6916
- if (this.transition) {
6917
- if (["top", "bottom"].includes(this.position))
6918
- coords.left -= tooltip.offsetWidth / 2;
6919
- if (["left", "right"].includes(this.position))
6920
- coords.top -= tooltip.offsetHeight / 2;
6921
- if (this.position === "left")
6922
- coords.left -= tooltip.offsetWidth;
6923
- if (this.position === "top")
6924
- coords.top -= tooltip.offsetHeight;
6994
+ async close(force = false) {
6995
+ if (!this.detachableVisible)
6996
+ return;
6997
+ if (this.showOnHover && !force) {
6998
+ await new Promise((resolve) => setTimeout(resolve, 10));
6999
+ if (this.showOnHover && this.hoveringActivator)
7000
+ return;
6925
7001
  }
6926
- tooltip.style.visibility = null;
6927
- tooltip.style.display = "none";
6928
- return coords;
6929
- },
6930
- insertTooltip() {
6931
- const wrapper = this.$refs.wrapper;
6932
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
6933
- this.detachToTarget.appendChild(this.tooltipEl);
6934
- },
6935
- removeTooltip() {
6936
- if (this.tooltipEl && this.tooltipEl.parentNode)
6937
- this.tooltipEl.remove();
6938
- }
6939
- },
6940
- mounted() {
6941
- this.activatorEl = this.$refs.wrapper.firstElementChild;
6942
- if (this.detachTo)
6943
- this.insertTooltip();
6944
- if (this.modelValue)
6945
- this.toggle({ type: "click", target: this.activatorEl });
6946
- },
6947
- beforeUnmount() {
6948
- this.removeTooltip();
6949
- if (this.activatorEl && this.activatorEl.parentNode)
6950
- this.activatorEl.remove();
6951
- },
6952
- watch: {
6953
- modelValue(bool) {
6954
- if (bool !== this.showTooltip)
6955
- this.toggle({ type: "click", target: this.activatorEl });
6956
- },
6957
- detachTo() {
6958
- this.removeTooltip();
6959
- this.insertTooltip();
7002
+ this.$emit("update:modelValue", this.detachableVisible = false);
7003
+ this.$emit("input", false);
7004
+ this.$emit("close");
7005
+ document.removeEventListener("mousedown", this.onOutsideMousedown);
7006
+ window.removeEventListener("resize", this.onResize);
6960
7007
  }
6961
7008
  }
6962
7009
  };