@1337exp/taoui 5.13.0 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1502,14 +1502,15 @@ const _hoisted_8$b = {
1502
1502
  class: "tao-modal__footer"
1503
1503
  };
1504
1504
  const _sfc_main$1a = /* @__PURE__ */ defineComponent({
1505
- ...{ name: "TaoModal" },
1505
+ ...{ name: "TaoModal", inheritAttrs: false },
1506
1506
  __name: "TaoModal",
1507
1507
  props: {
1508
1508
  modelValue: { type: Boolean },
1509
1509
  title: { default: "" },
1510
1510
  closable: { type: Boolean, default: true },
1511
1511
  closeLabel: {},
1512
- fullscreen: { type: [Boolean, String], default: false }
1512
+ fullscreen: { type: [Boolean, String], default: false },
1513
+ surface: { default: "flat" }
1513
1514
  },
1514
1515
  emits: ["update:modelValue", "close"],
1515
1516
  setup(__props, { emit: __emit }) {
@@ -1573,15 +1574,15 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
1573
1574
  onPointerup: onOverlayPointerUp,
1574
1575
  onKeydown: onKeydown2
1575
1576
  }, [
1576
- createElementVNode("div", {
1577
+ createElementVNode("div", mergeProps(_ctx.$attrs, {
1577
1578
  ref_key: "panelRef",
1578
1579
  ref: panelRef,
1579
- class: "tao-modal",
1580
+ class: ["tao-modal", unref(surfaceClass)(__props.surface)],
1580
1581
  role: "dialog",
1581
1582
  "aria-modal": "true",
1582
1583
  "aria-labelledby": __props.title ? unref(titleId) : void 0,
1583
1584
  tabindex: "-1"
1584
- }, [
1585
+ }), [
1585
1586
  __props.title || _ctx.$slots.header || __props.closable ? (openBlock(), createElementBlock("div", _hoisted_2$R, [
1586
1587
  renderSlot(_ctx.$slots, "header", {}, () => [
1587
1588
  __props.title ? (openBlock(), createElementBlock("h2", {
@@ -1610,7 +1611,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
1610
1611
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_8$b, [
1611
1612
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
1612
1613
  ])) : createCommentVNode("", true)
1613
- ], 8, _hoisted_1$$)
1614
+ ], 16, _hoisted_1$$)
1614
1615
  ], 34)) : createCommentVNode("", true)
1615
1616
  ]),
1616
1617
  _: 3
@@ -1619,7 +1620,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
1619
1620
  };
1620
1621
  }
1621
1622
  });
1622
- const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-4beb767f"]]);
1623
+ const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__scopeId", "data-v-ea0d125e"]]);
1623
1624
  const _hoisted_1$_ = ["id", "aria-selected", "aria-controls", "tabindex", "disabled", "onClick"];
1624
1625
  const _hoisted_2$Q = ["id", "aria-labelledby"];
1625
1626
  const _sfc_main$19 = /* @__PURE__ */ defineComponent({
@@ -4710,7 +4711,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4710
4711
  }
4711
4712
  });
4712
4713
  const _hoisted_1$H = { class: "tao-dropdown-menu" };
4713
- const _hoisted_2$B = ["aria-expanded", "aria-label"];
4714
+ const _hoisted_2$B = ["tabindex", "aria-expanded", "aria-label"];
4714
4715
  const _hoisted_3$w = {
4715
4716
  key: 1,
4716
4717
  "aria-hidden": "true"
@@ -4722,7 +4723,9 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4722
4723
  items: { default: () => [] },
4723
4724
  placement: { default: "bottom-end" },
4724
4725
  menuLabel: {},
4725
- closeOnScroll: { type: Boolean, default: false }
4726
+ closeOnScroll: { type: Boolean, default: false },
4727
+ size: { default: void 0 },
4728
+ tabbable: { type: Boolean, default: true }
4726
4729
  },
4727
4730
  emits: ["select"],
4728
4731
  setup(__props, { emit: __emit }) {
@@ -4752,7 +4755,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4752
4755
  ref_key: "triggerRef",
4753
4756
  ref: triggerRef,
4754
4757
  type: "button",
4755
- class: "tao-dropdown-menu__button",
4758
+ class: normalizeClass(["tao-dropdown-menu__button", __props.size ? [unref(sizeClass)(__props.size), "tao-dropdown-menu__button--sized"] : void 0]),
4759
+ tabindex: __props.tabbable ? void 0 : -1,
4756
4760
  "aria-haspopup": "menu",
4757
4761
  "aria-expanded": isOpen.value,
4758
4762
  "aria-label": _ctx.$slots.button ? void 0 : unref(l10n).menuLabel,
@@ -4764,7 +4768,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4764
4768
  createVNode(TaoIcon, { name: "tao-more-vertical" })
4765
4769
  ], true)
4766
4770
  ]))
4767
- ], 40, _hoisted_2$B),
4771
+ ], 42, _hoisted_2$B),
4768
4772
  createVNode(_sfc_main$K, {
4769
4773
  items: __props.items,
4770
4774
  open: isOpen.value,
@@ -4787,7 +4791,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4787
4791
  };
4788
4792
  }
4789
4793
  });
4790
- const TaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-e1b857ad"]]);
4794
+ const TaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-0e71d618"]]);
4791
4795
  const _sfc_main$I = /* @__PURE__ */ defineComponent({
4792
4796
  ...{ name: "TaoContextMenu" },
4793
4797
  __name: "TaoContextMenu",
@@ -5930,7 +5934,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5930
5934
  moreLabel: { default: void 0 },
5931
5935
  floating: { type: Boolean, default: false },
5932
5936
  indicator: { default: "pill" },
5933
- surface: { default: "flat" }
5937
+ surface: { default: "flat" },
5938
+ badgeTone: { default: "accent" }
5934
5939
  },
5935
5940
  emits: ["update:modelValue", "select"],
5936
5941
  setup(__props, { emit: __emit }) {
@@ -5977,7 +5982,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
5977
5982
  }
5978
5983
  return (_ctx, _cache) => {
5979
5984
  return openBlock(), createElementBlock("div", {
5980
- class: normalizeClass(["tao-nav", [`tao-nav--${__props.layout}`, `tao-nav--indicator-${__props.indicator}`, { "tao-nav--standalone": standalone.value, "tao-nav--floating": __props.floating }]])
5985
+ class: normalizeClass(["tao-nav", [`tao-nav--${__props.layout}`, `tao-nav--indicator-${__props.indicator}`, { "tao-nav--standalone": standalone.value, "tao-nav--floating": __props.floating, "tao-nav--badges-neutral": __props.badgeTone === "neutral" }]])
5981
5986
  }, [
5982
5987
  createElementVNode("div", _hoisted_1$y, [
5983
5988
  createElementVNode("nav", {
@@ -6071,7 +6076,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
6071
6076
  };
6072
6077
  }
6073
6078
  });
6074
- const TaoNav = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-93f7c67b"]]);
6079
+ const TaoNav = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-525f9dce"]]);
6075
6080
  function visibleRows(nodes, expanded, children) {
6076
6081
  const rows = [];
6077
6082
  const walk = (list, level, parentId) => {
@@ -10390,7 +10395,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10390
10395
  divided: { type: Boolean, default: true },
10391
10396
  maxHeight: {},
10392
10397
  empty: { type: Boolean, default: false },
10393
- ariaLabel: { default: "" }
10398
+ ariaLabel: { default: "" },
10399
+ roving: { type: Boolean, default: false }
10394
10400
  },
10395
10401
  setup(__props) {
10396
10402
  const appLocale = useTaoLocale();
@@ -10399,8 +10405,85 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10399
10405
  const value = toCssLength(props.maxHeight);
10400
10406
  return value ? { maxHeight: value } : void 0;
10401
10407
  });
10408
+ const listRef = ref(null);
10409
+ const current2 = ref(-1);
10410
+ function rows() {
10411
+ const list = listRef.value;
10412
+ if (!list) {
10413
+ return [];
10414
+ }
10415
+ return [...list.children].filter((el) => el instanceof HTMLElement && el.tagName === "LI" && !el.classList.contains("tao-list__empty")).map((el) => {
10416
+ const hit = [...el.children].find((child) => child.matches("button.tao-list-item__hit"));
10417
+ return { el, target: hit ?? el, enabled: el.getAttribute("aria-disabled") !== "true" && !hit?.disabled };
10418
+ });
10419
+ }
10420
+ const isSelected = (row) => row.el.classList.contains("tao-list-item--selected") || row.el.getAttribute("aria-current") === "true" || row.target.getAttribute("aria-current") === "true";
10421
+ function sync() {
10422
+ if (!props.roving) {
10423
+ return;
10424
+ }
10425
+ const all = rows();
10426
+ let index = current2.value;
10427
+ if (!all[index]?.enabled) {
10428
+ const selected = all.findIndex((row) => row.enabled && isSelected(row));
10429
+ index = selected >= 0 ? selected : all.findIndex((row) => row.enabled);
10430
+ }
10431
+ current2.value = index;
10432
+ all.forEach((row, i) => row.target.setAttribute("tabindex", i === index ? "0" : "-1"));
10433
+ }
10434
+ function release() {
10435
+ for (const row of rows()) {
10436
+ row.target.removeAttribute("tabindex");
10437
+ }
10438
+ }
10439
+ function onKeydown2(event) {
10440
+ if (!props.roving || event.altKey || event.metaKey) {
10441
+ return;
10442
+ }
10443
+ const all = rows();
10444
+ const from = all.findIndex((row) => row.target === event.target);
10445
+ if (from < 0) {
10446
+ return;
10447
+ }
10448
+ const enabled = all.map((row) => row.enabled);
10449
+ const to = event.key === "ArrowDown" ? stepEnabled(enabled, from, 1, false) : event.key === "ArrowUp" ? stepEnabled(enabled, from, -1, false) : event.key === "Home" ? firstEnabled(enabled) : event.key === "End" ? lastEnabled(enabled) : -2;
10450
+ if (to === -2) {
10451
+ return;
10452
+ }
10453
+ event.preventDefault();
10454
+ if (to >= 0 && to !== from) {
10455
+ current2.value = to;
10456
+ sync();
10457
+ all[to].target.focus();
10458
+ }
10459
+ }
10460
+ function onFocusIn(event) {
10461
+ if (!props.roving) {
10462
+ return;
10463
+ }
10464
+ const index = rows().findIndex((row) => row.target === event.target);
10465
+ if (index >= 0 && index !== current2.value) {
10466
+ current2.value = index;
10467
+ sync();
10468
+ }
10469
+ }
10470
+ let observer;
10471
+ onMounted(() => {
10472
+ sync();
10473
+ if (typeof MutationObserver !== "undefined" && listRef.value) {
10474
+ observer = new MutationObserver(() => sync());
10475
+ observer.observe(listRef.value, { childList: true, subtree: true });
10476
+ }
10477
+ });
10478
+ onBeforeUnmount(() => observer?.disconnect());
10479
+ watch(
10480
+ () => props.roving,
10481
+ (on) => nextTick(() => on ? sync() : release())
10482
+ );
10402
10483
  return (_ctx, _cache) => {
10403
10484
  return openBlock(), createElementBlock("ul", {
10485
+ ref_key: "listRef",
10486
+ ref: listRef,
10404
10487
  class: normalizeClass(["tao-list", [
10405
10488
  unref(sizeClass)(__props.size),
10406
10489
  {
@@ -10408,22 +10491,25 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
10408
10491
  "tao-list--divided": __props.divided,
10409
10492
  "tao-list--plain": !__props.bordered,
10410
10493
  "tao-list--empty": __props.empty,
10411
- "tao-list--scroll": Boolean(__props.maxHeight)
10494
+ "tao-list--scroll": Boolean(__props.maxHeight),
10495
+ "tao-list--roving": __props.roving
10412
10496
  }
10413
10497
  ]]),
10414
10498
  style: normalizeStyle(listStyle.value),
10415
- "aria-label": __props.ariaLabel || void 0
10499
+ "aria-label": __props.ariaLabel || void 0,
10500
+ onKeydown: onKeydown2,
10501
+ onFocusin: onFocusIn
10416
10502
  }, [
10417
10503
  __props.empty ? (openBlock(), createElementBlock("li", _hoisted_2$9, [
10418
10504
  renderSlot(_ctx.$slots, "empty", {}, () => [
10419
10505
  createTextVNode(toDisplayString(unref(appLocale).list.emptyText), 1)
10420
10506
  ], true)
10421
10507
  ])) : renderSlot(_ctx.$slots, "default", {}, void 0, true, 1)
10422
- ], 14, _hoisted_1$b);
10508
+ ], 46, _hoisted_1$b);
10423
10509
  };
10424
10510
  }
10425
10511
  });
10426
- const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-c883af92"]]);
10512
+ const TaoList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-ddec81f4"]]);
10427
10513
  const _hoisted_1$a = ["aria-current", "aria-disabled"];
10428
10514
  const _hoisted_2$8 = {
10429
10515
  key: 0,
@@ -10526,7 +10612,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10526
10612
  };
10527
10613
  }
10528
10614
  });
10529
- const TaoListItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-5b58c12a"]]);
10615
+ const TaoListItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-dd4f25c2"]]);
10530
10616
  const _hoisted_1$9 = {
10531
10617
  class: "tao-skeleton-group",
10532
10618
  "aria-hidden": true
@@ -10577,12 +10663,13 @@ const _hoisted_9$1 = {
10577
10663
  class: "tao-drawer__footer"
10578
10664
  };
10579
10665
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10580
- ...{ name: "TaoDrawer" },
10666
+ ...{ name: "TaoDrawer", inheritAttrs: false },
10581
10667
  __name: "TaoDrawer",
10582
10668
  props: {
10583
10669
  modelValue: { type: Boolean },
10584
10670
  title: { default: "" },
10585
10671
  side: { default: "right" },
10672
+ surface: { default: "flat" },
10586
10673
  closable: { type: Boolean, default: true },
10587
10674
  closeLabel: {}
10588
10675
  },
@@ -10639,15 +10726,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10639
10726
  class: "tao-drawer__overlay",
10640
10727
  onClick: close
10641
10728
  }),
10642
- createElementVNode("aside", {
10729
+ createElementVNode("aside", mergeProps(_ctx.$attrs, {
10643
10730
  ref_key: "panelRef",
10644
10731
  ref: panelRef,
10645
- class: "tao-drawer__panel",
10732
+ class: ["tao-drawer__panel", unref(surfaceClass)(__props.surface)],
10646
10733
  role: "dialog",
10647
10734
  "aria-modal": "true",
10648
10735
  "aria-labelledby": __props.title ? unref(titleId) : void 0,
10649
10736
  tabindex: "-1"
10650
- }, [
10737
+ }), [
10651
10738
  __props.side === "bottom" ? (openBlock(), createElementBlock("span", _hoisted_2$7)) : createCommentVNode("", true),
10652
10739
  __props.title || __props.closable ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
10653
10740
  __props.title ? (openBlock(), createElementBlock("h2", {
@@ -10675,7 +10762,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10675
10762
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_9$1, [
10676
10763
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
10677
10764
  ])) : createCommentVNode("", true)
10678
- ], 8, _hoisted_1$8)
10765
+ ], 16, _hoisted_1$8)
10679
10766
  ], 34)) : createCommentVNode("", true)
10680
10767
  ]),
10681
10768
  _: 3
@@ -10684,7 +10771,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
10684
10771
  };
10685
10772
  }
10686
10773
  });
10687
- const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-56339177"]]);
10774
+ const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-45f19c52"]]);
10688
10775
  const _hoisted_1$7 = ["title"];
10689
10776
  const _hoisted_2$6 = { class: "tao-avatar__face" };
10690
10777
  const _hoisted_3$5 = ["src", "alt"];