@nubisco/ui 5.54.0 → 5.56.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/{AccordionItem--XeLRz2P.js → AccordionItem-BY-p8UkV.js} +1 -1
- package/dist/{AccordionItem-BYSH6dZK.cjs → AccordionItem-p0mYXIj8.cjs} +1 -1
- package/dist/{ActionGroup-Cn22xj1t.js → ActionGroup-CjRSKyOa.js} +1 -1
- package/dist/{ActionGroup-0rG92kFk.cjs → ActionGroup-DIMZhC7N.cjs} +1 -1
- package/dist/AiLabel-BDccQ2iQ.js +242 -0
- package/dist/AiLabel-jRrBTu6c.cjs +1 -0
- package/dist/{AiProvider-CLtCD_UR.cjs → AiProvider-CGB9EiSf.cjs} +1 -1
- package/dist/{AiProvider-gprbR5ts.js → AiProvider-CMbPWtU-.js} +2 -2
- package/dist/{BatchActions-Ckx8kyZt.js → BatchActions-Kr2S6CJI.js} +1 -1
- package/dist/{BatchActions-6IO5GRFm.cjs → BatchActions-jfvfpZeT.cjs} +1 -1
- package/dist/{Board-BdqGOVNF.js → Board-C3_cXRl6.js} +177 -176
- package/dist/Board-D6A-irdx.cjs +1 -0
- package/dist/{Breadcrumbs-BzyDVvEk.cjs → Breadcrumbs-0rRFiO31.cjs} +1 -1
- package/dist/{Breadcrumbs-Bc-acmPE.js → Breadcrumbs-DqagVknq.js} +1 -1
- package/dist/{Briefing-DwKWCOGm.cjs → Briefing-B-O-9bhN.cjs} +1 -1
- package/dist/{Briefing-BiEICh1u.js → Briefing-DNH-707q.js} +1 -1
- package/dist/{ChatMessage-1L_xCXZF.cjs → ChatMessage-B45Xhl8x.cjs} +1 -1
- package/dist/{ChatMessage-C2Ecm175.js → ChatMessage-BDOdvI4h.js} +1 -1
- package/dist/{ChatThread-B_F3xTdE.cjs → ChatThread-B7F1r4t4.cjs} +1 -1
- package/dist/{ChatThread-COdOb1rH.js → ChatThread-DqvsnVOr.js} +1 -1
- package/dist/CommandPalette-BaRqoURY.cjs +1 -0
- package/dist/CommandPalette-DWv1UV8r.js +294 -0
- package/dist/{Confirm-Baz2WG7b.cjs → Confirm-B5vMzPbN.cjs} +1 -1
- package/dist/{Confirm-CvMuXK9Q.js → Confirm-C4lT-6HD.js} +1 -1
- package/dist/{DataTable-B8THDBLS.js → DataTable-CcwD0PSJ.js} +2 -2
- package/dist/{DataTable-DeFzOlcP.cjs → DataTable-xEw-NvHM.cjs} +1 -1
- package/dist/{DatePicker-BrUXcNUj.js → DatePicker-3pCNky8d.js} +234 -230
- package/dist/DatePicker-BrMicYUx.cjs +1 -0
- package/dist/FloatingToolbar-BV-iGNxe.js +120 -0
- package/dist/FloatingToolbar-C8xB4BzH.cjs +1 -0
- package/dist/{ImagePicker-vhg7b-UL.cjs → ImagePicker-5qPI77Jo.cjs} +1 -1
- package/dist/{ImagePicker-LhpR7jjR.js → ImagePicker-BnHg403Q.js} +1 -1
- package/dist/InfoHint-CdluaJqE.cjs +1 -0
- package/dist/InfoHint-zMuSw_99.js +182 -0
- package/dist/{InlineLoading-CA0_IT29.cjs → InlineLoading-CqGrNWHf.cjs} +1 -1
- package/dist/{InlineLoading-Cknqq0vv.js → InlineLoading-_j2KKhNQ.js} +1 -1
- package/dist/Menu-CWxBEMC4.js +193 -0
- package/dist/Menu-D0TerdRm.cjs +1 -0
- package/dist/{MenuBarItem-yr5aizl3.js → MenuBarItem-BYh4YWR4.js} +1 -1
- package/dist/{MenuBarItem-DlnIAhRw.cjs → MenuBarItem-DTOqacvg.cjs} +1 -1
- package/dist/Modal-CmGFLEo4.cjs +1 -0
- package/dist/{Modal-CESCi2dE.js → Modal-DwL90AoV.js} +73 -69
- package/dist/NotificationCenter-EMlV-oPh.cjs +1 -0
- package/dist/{NotificationCenter-DkGc0ETD.js → NotificationCenter-YZnPMH7c.js} +217 -213
- package/dist/{OverflowMenu-BWZ7c8oI.js → OverflowMenu-DliuDrTK.js} +1 -1
- package/dist/{OverflowMenu-C8q28FrD.cjs → OverflowMenu-DuRgj1DU.cjs} +1 -1
- package/dist/{PageHeader-DElq_kdh.cjs → PageHeader-BoEdR_T5.cjs} +1 -1
- package/dist/{PageHeader-DOYN9sto.js → PageHeader-c6117xYf.js} +1 -1
- package/dist/{Pagination-9mPN8ych.cjs → Pagination-B3lmxggo.cjs} +1 -1
- package/dist/{Pagination-CxBHFwy0.js → Pagination-DwAc-4d9.js} +1 -1
- package/dist/Select-CDs-7QtW.js +619 -0
- package/dist/Select-CJqwMI69.cjs +1 -0
- package/dist/{SidebarCollapseToggle-DraqbhwM.js → SidebarCollapseToggle-C38R19gG.js} +1 -1
- package/dist/{SidebarCollapseToggle-CABmF-PC.cjs → SidebarCollapseToggle-DOck3Txy.cjs} +1 -1
- package/dist/SidebarMenuItem-DzJ_R2__.cjs +1 -0
- package/dist/SidebarMenuItem-E410HTei.js +302 -0
- package/dist/Spinner-BlzVODzE.js +161 -0
- package/dist/Spinner-Bpfgl-mN.cjs +1 -0
- package/dist/{Stat-BCvXYr-z.cjs → Stat-BByeMKkT.cjs} +1 -1
- package/dist/{Stat-No3RhGB3.js → Stat-DWliDbWE.js} +1 -1
- package/dist/Submenu-BkHGYo7X.js +168 -0
- package/dist/Submenu-CCQnBpln.cjs +1 -0
- package/dist/{SuggestionList-Cxy4jjjd.cjs → SuggestionList-C61Dj6en.cjs} +1 -1
- package/dist/{SuggestionList-Dv4yQAi-.js → SuggestionList-D48Ojcf3.js} +1 -1
- package/dist/Toaster-Dwjm0bsR.js +285 -0
- package/dist/Toaster-aJJvxlEr.cjs +1 -0
- package/dist/{UserMenu-CjmhyTwN.js → UserMenu-BTihjCKC.js} +94 -90
- package/dist/UserMenu-CHkbByFS.cjs +1 -0
- package/dist/{Walkthrough-DYYqtpwJ.js → Walkthrough-BqGB1yaX.js} +63 -59
- package/dist/Walkthrough-sGAypY5d.cjs +1 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +284 -283
- package/dist/components/AccordionItem.cjs +1 -1
- package/dist/components/AccordionItem.mjs +1 -1
- package/dist/components/ActionGroup.cjs +1 -1
- package/dist/components/ActionGroup.mjs +1 -1
- package/dist/components/AiLabel.cjs +1 -1
- package/dist/components/AiLabel.mjs +1 -1
- package/dist/components/AiLabel.vue.d.ts.map +1 -1
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/BatchActions.cjs +1 -1
- package/dist/components/BatchActions.mjs +1 -1
- package/dist/components/Board.cjs +1 -1
- package/dist/components/Board.mjs +1 -1
- package/dist/components/Board.vue.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs.mjs +1 -1
- package/dist/components/Briefing.cjs +1 -1
- package/dist/components/Briefing.mjs +1 -1
- package/dist/components/ChatMessage.cjs +1 -1
- package/dist/components/ChatMessage.mjs +1 -1
- package/dist/components/ChatThread.cjs +1 -1
- package/dist/components/ChatThread.mjs +1 -1
- package/dist/components/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette.mjs +1 -1
- package/dist/components/CommandPalette.vue.d.ts.map +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/FloatingToolbar.cjs +1 -1
- package/dist/components/FloatingToolbar.mjs +1 -1
- package/dist/components/FloatingToolbar.vue.d.ts.map +1 -1
- package/dist/components/ImagePicker.cjs +1 -1
- package/dist/components/ImagePicker.mjs +1 -1
- package/dist/components/InfoHint.cjs +1 -1
- package/dist/components/InfoHint.mjs +1 -1
- package/dist/components/InfoHint.vue.d.ts.map +1 -1
- package/dist/components/InlineLoading.cjs +1 -1
- package/dist/components/InlineLoading.mjs +1 -1
- package/dist/components/Menu.cjs +1 -1
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/Menu.vue.d.ts.map +1 -1
- package/dist/components/MenuBarItem.cjs +1 -1
- package/dist/components/MenuBarItem.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter.mjs +1 -1
- package/dist/components/NotificationCenter.vue.d.ts.map +1 -1
- package/dist/components/OverflowMenu.cjs +1 -1
- package/dist/components/OverflowMenu.mjs +1 -1
- package/dist/components/PageHeader.cjs +1 -1
- package/dist/components/PageHeader.mjs +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/SidebarCollapseToggle.cjs +1 -1
- package/dist/components/SidebarCollapseToggle.mjs +1 -1
- package/dist/components/SidebarMenuItem.cjs +1 -1
- package/dist/components/SidebarMenuItem.mjs +1 -1
- package/dist/components/SidebarMenuItem.vue.d.ts.map +1 -1
- package/dist/components/Spinner.cjs +1 -1
- package/dist/components/Spinner.mjs +1 -1
- package/dist/components/Spinner.vue.d.ts.map +1 -1
- package/dist/components/Stat.cjs +1 -1
- package/dist/components/Stat.mjs +1 -1
- package/dist/components/Submenu.cjs +1 -1
- package/dist/components/Submenu.mjs +1 -1
- package/dist/components/Submenu.vue.d.ts.map +1 -1
- package/dist/components/SuggestionList.cjs +1 -1
- package/dist/components/SuggestionList.mjs +1 -1
- package/dist/components/Toaster.cjs +1 -1
- package/dist/components/Toaster.mjs +1 -1
- package/dist/components/Toaster.vue.d.ts.map +1 -1
- package/dist/components/UserMenu.cjs +1 -1
- package/dist/components/UserMenu.mjs +1 -1
- package/dist/components/UserMenu.vue.d.ts.map +1 -1
- package/dist/components/Walkthrough.cjs +1 -1
- package/dist/components/Walkthrough.mjs +1 -1
- package/dist/components/Walkthrough.vue.d.ts.map +1 -1
- package/dist/components/labs/Spreadsheet.d.ts +14 -0
- package/dist/components/labs/Spreadsheet.vue.d.ts +1 -0
- package/dist/components/labs/Spreadsheet.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -2
- package/dist/composables/useTeleportReady.composable.cjs +1 -0
- package/dist/composables/useTeleportReady.composable.d.ts +30 -0
- package/dist/composables/useTeleportReady.composable.d.ts.map +1 -0
- package/dist/composables/useTeleportReady.composable.mjs +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +152 -151
- package/dist/{main-D6qY7QeE.js → main-B-SiH7ks.js} +305 -237
- package/dist/main-CH_BN_4v.cjs +4 -0
- package/dist/main.d.ts +10 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/AiLabel.css +1 -1
- package/dist/styles/FloatingToolbar.css +1 -1
- package/dist/styles/InfoHint.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/dist/styles/SidebarMenuItem.css +1 -1
- package/dist/styles/Spinner.css +1 -1
- package/dist/styles/Toaster.css +1 -1
- package/dist/styles/Walkthrough.css +1 -1
- package/dist/styles/main.css +1 -1
- package/dist/ui.css +9 -9
- package/package.json +1 -1
- package/dist/AiLabel-AGSSBanb.cjs +0 -1
- package/dist/AiLabel-D32aNf1F.js +0 -240
- package/dist/Board-DtOWyvKh.cjs +0 -1
- package/dist/CommandPalette-CC_Aj4Uh.cjs +0 -1
- package/dist/CommandPalette-zqTMjpm8.js +0 -290
- package/dist/DatePicker-B5YRb64p.cjs +0 -1
- package/dist/FloatingToolbar-BikX_AsP.js +0 -116
- package/dist/FloatingToolbar-DWVY8Fxo.cjs +0 -1
- package/dist/InfoHint-BEzkNQTM.cjs +0 -1
- package/dist/InfoHint-BlHxrTw6.js +0 -178
- package/dist/Menu-7EgnchVu.js +0 -189
- package/dist/Menu-Bs2Co1sl.cjs +0 -1
- package/dist/Modal-C_EWDvmH.cjs +0 -1
- package/dist/NotificationCenter-DxZgHQyt.cjs +0 -1
- package/dist/Select-7gJ3_fWh.js +0 -615
- package/dist/Select-Dg4HSHOu.cjs +0 -1
- package/dist/SidebarMenuItem-DQRQtqrp.js +0 -300
- package/dist/SidebarMenuItem-Dwk7vKN5.cjs +0 -1
- package/dist/Spinner-DYFhiTB1.js +0 -160
- package/dist/Spinner-j13gRoUF.cjs +0 -1
- package/dist/Submenu-BDs-yAqv.js +0 -164
- package/dist/Submenu-BLjx2kWl.cjs +0 -1
- package/dist/Toaster-ByObLDkk.js +0 -284
- package/dist/Toaster-CJAbZ9pv.cjs +0 -1
- package/dist/UserMenu-BjSO_Uml.cjs +0 -1
- package/dist/Walkthrough-DxAIdo3M.cjs +0 -1
- package/dist/main-Cs0FFBfV.cjs +0 -4
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { useTeleportReady as e } from "./composables/useTeleportReady.composable.mjs";
|
|
2
|
+
import { t } from "./Icon-B2tiGiqZ.js";
|
|
3
|
+
import { usePhoneLayout as n } from "./composables/usePhoneLayout.composable.mjs";
|
|
4
|
+
import { Fragment as r, Teleport as i, Transition as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, inject as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, openBlock as v, ref as y, renderSlot as b, toDisplayString as x, unref as S, useId as C, watch as w, withCtx as T, withKeys as E, withModifiers as D } from "vue";
|
|
5
|
+
import { regular as ee } from "@nubisco/ui/icons/caret-right";
|
|
6
|
+
//#region src/components/Submenu.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var O = [
|
|
8
|
+
"aria-expanded",
|
|
9
|
+
"aria-disabled",
|
|
10
|
+
"aria-describedby",
|
|
11
|
+
"data-nb-explained",
|
|
12
|
+
"onKeydown"
|
|
13
|
+
], k = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "nb-menu-item__text"
|
|
16
|
+
}, A = { class: "nb-menu-item__label" }, j = {
|
|
17
|
+
key: 2,
|
|
18
|
+
class: "nb-menu-item__label"
|
|
19
|
+
}, M = /* @__PURE__ */ f({
|
|
20
|
+
__name: "Submenu",
|
|
21
|
+
props: {
|
|
22
|
+
icon: { default: void 0 },
|
|
23
|
+
label: {},
|
|
24
|
+
disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
disabledReason: { default: void 0 }
|
|
29
|
+
},
|
|
30
|
+
setup(f) {
|
|
31
|
+
let M = e(), { phone: N } = n(), P = () => N.value ? "var(--nb-zindex-modal-dropdown)" : "var(--nb-zindex-menu)", F = f, I = o(() => F.disabled && !!F.disabledReason), L = `nb-submenu-reason-${C()}`, R = y(null), z = y(null), B = y(!1), V = p("nb-menu", null), H = null, U = null, W = o(() => `nb-menu--${V?.size ?? "md"}`), G = y({
|
|
32
|
+
position: "fixed",
|
|
33
|
+
top: "0px",
|
|
34
|
+
left: "0px",
|
|
35
|
+
zIndex: P()
|
|
36
|
+
});
|
|
37
|
+
function K() {
|
|
38
|
+
if (!R.value) return;
|
|
39
|
+
let e = R.value.getBoundingClientRect(), t = e.right, n = e.top;
|
|
40
|
+
t + 200 > window.innerWidth && (t = e.left - 200), n + 200 > window.innerHeight && (n = Math.max(8, window.innerHeight - 200)), G.value = {
|
|
41
|
+
position: "fixed",
|
|
42
|
+
top: `${n}px`,
|
|
43
|
+
left: `${t}px`,
|
|
44
|
+
zIndex: P()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function q() {
|
|
48
|
+
F.disabled || ($(), B.value = !0, K(), m(() => {
|
|
49
|
+
if (z.value && R.value) {
|
|
50
|
+
let e = R.value.getBoundingClientRect(), t = z.value.getBoundingClientRect(), n = e.right;
|
|
51
|
+
n + t.width > window.innerWidth && (n = e.left - t.width);
|
|
52
|
+
let r = e.top;
|
|
53
|
+
r + t.height > window.innerHeight && (r = Math.max(8, window.innerHeight - t.height)), G.value = {
|
|
54
|
+
position: "fixed",
|
|
55
|
+
top: `${r}px`,
|
|
56
|
+
left: `${n}px`,
|
|
57
|
+
zIndex: P()
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
function J() {
|
|
63
|
+
if ($(), !B.value) return;
|
|
64
|
+
let e = !!z.value?.contains(document.activeElement);
|
|
65
|
+
B.value = !1, e && R.value?.focus();
|
|
66
|
+
}
|
|
67
|
+
function Y() {
|
|
68
|
+
return z.value ? Array.from(z.value.querySelectorAll("[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]")) : [];
|
|
69
|
+
}
|
|
70
|
+
function X(e, t) {
|
|
71
|
+
let n = Y();
|
|
72
|
+
for (let r = e; r >= 0 && r < n.length; r += t) if (n[r].getAttribute("aria-disabled") !== "true" || n[r].hasAttribute("data-nb-explained")) {
|
|
73
|
+
n[r].focus();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function Z() {
|
|
78
|
+
F.disabled || (q(), m(() => X(0, 1)));
|
|
79
|
+
}
|
|
80
|
+
function Q(e) {
|
|
81
|
+
let t = Y().indexOf(document.activeElement);
|
|
82
|
+
e.key === "ArrowDown" ? (e.preventDefault(), e.stopPropagation(), X(t + 1, 1)) : e.key === "ArrowUp" ? (e.preventDefault(), e.stopPropagation(), t > 0 && X(t - 1, -1)) : e.key === "ArrowLeft" || e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), J()) : e.key === "Tab" && (J(), V?.close());
|
|
83
|
+
}
|
|
84
|
+
w(z, (e, t) => {
|
|
85
|
+
t && V?.unregisterSurface(t), e && V?.registerSurface(e);
|
|
86
|
+
});
|
|
87
|
+
function $() {
|
|
88
|
+
H &&= (clearTimeout(H), null), U &&= (clearTimeout(U), null);
|
|
89
|
+
}
|
|
90
|
+
function te() {
|
|
91
|
+
$(), H = setTimeout(q, 150);
|
|
92
|
+
}
|
|
93
|
+
function ne() {
|
|
94
|
+
$(), U = setTimeout(J, 150);
|
|
95
|
+
}
|
|
96
|
+
function re() {
|
|
97
|
+
$();
|
|
98
|
+
}
|
|
99
|
+
function ie() {
|
|
100
|
+
$(), U = setTimeout(J, 150);
|
|
101
|
+
}
|
|
102
|
+
function ae() {
|
|
103
|
+
F.disabled || (B.value ? J() : q());
|
|
104
|
+
}
|
|
105
|
+
return _(() => {
|
|
106
|
+
$(), z.value && V?.unregisterSurface(z.value);
|
|
107
|
+
}), (e, n) => (v(), l(r, null, [u("li", {
|
|
108
|
+
ref_key: "triggerRef",
|
|
109
|
+
ref: R,
|
|
110
|
+
class: h(["nb-menu-item nb-submenu-trigger", {
|
|
111
|
+
"nb-menu-item--disabled": f.disabled,
|
|
112
|
+
"nb-menu-item--explained": I.value,
|
|
113
|
+
"nb-menu-item--highlighted": B.value
|
|
114
|
+
}]),
|
|
115
|
+
role: "menuitem",
|
|
116
|
+
"aria-haspopup": "menu",
|
|
117
|
+
"aria-expanded": B.value,
|
|
118
|
+
"aria-disabled": f.disabled || void 0,
|
|
119
|
+
"aria-describedby": I.value ? L : void 0,
|
|
120
|
+
"data-nb-explained": I.value || void 0,
|
|
121
|
+
tabindex: -1,
|
|
122
|
+
onMouseenter: te,
|
|
123
|
+
onMouseleave: ne,
|
|
124
|
+
onKeydown: [
|
|
125
|
+
E(D(Z, ["prevent"]), ["right"]),
|
|
126
|
+
E(D(Z, ["prevent"]), ["enter"]),
|
|
127
|
+
E(D(Z, ["prevent"]), ["space"]),
|
|
128
|
+
E(D(J, ["prevent"]), ["left"]),
|
|
129
|
+
E(D(J, ["prevent"]), ["escape"])
|
|
130
|
+
],
|
|
131
|
+
onClick: ae
|
|
132
|
+
}, [
|
|
133
|
+
f.icon ? (v(), s(t, {
|
|
134
|
+
key: 0,
|
|
135
|
+
name: f.icon,
|
|
136
|
+
size: 16,
|
|
137
|
+
class: "nb-menu-item__icon"
|
|
138
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
139
|
+
I.value ? (v(), l("span", k, [u("span", A, x(f.label), 1), u("span", {
|
|
140
|
+
id: L,
|
|
141
|
+
class: "nb-menu-item__reason"
|
|
142
|
+
}, x(f.disabledReason), 1)])) : (v(), l("span", j, x(f.label), 1)),
|
|
143
|
+
d(t, {
|
|
144
|
+
name: S(ee),
|
|
145
|
+
size: "sm",
|
|
146
|
+
class: "nb-submenu-trigger__caret"
|
|
147
|
+
}, null, 8, ["name"])
|
|
148
|
+
], 42, O), (v(), s(i, {
|
|
149
|
+
to: "body",
|
|
150
|
+
disabled: !S(M)
|
|
151
|
+
}, [d(a, { name: "nb-submenu" }, {
|
|
152
|
+
default: T(() => [B.value ? (v(), l("ul", {
|
|
153
|
+
key: 0,
|
|
154
|
+
ref_key: "submenuRef",
|
|
155
|
+
ref: z,
|
|
156
|
+
role: "menu",
|
|
157
|
+
class: h(["nb-menu nb-submenu", [W.value]]),
|
|
158
|
+
style: g(G.value),
|
|
159
|
+
onMouseenter: re,
|
|
160
|
+
onMouseleave: ie,
|
|
161
|
+
onKeydown: Q
|
|
162
|
+
}, [b(e.$slots, "default")], 38)) : c("", !0)]),
|
|
163
|
+
_: 3
|
|
164
|
+
})], 8, ["disabled"]))], 64));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
//#endregion
|
|
168
|
+
export { M as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useTeleportReady.composable.cjs`),t=require(`./Icon-CssV4E2-.cjs`),n=require(`./composables/usePhoneLayout.composable.cjs`);let r=require(`vue`),i=require(`@nubisco/ui/icons/caret-right`);var a=[`aria-expanded`,`aria-disabled`,`aria-describedby`,`data-nb-explained`,`onKeydown`],o={key:1,class:`nb-menu-item__text`},s={class:`nb-menu-item__label`},c={key:2,class:`nb-menu-item__label`},l=(0,r.defineComponent)({__name:`Submenu`,props:{icon:{default:void 0},label:{},disabled:{type:Boolean,default:!1},disabledReason:{default:void 0}},setup(l){let u=e.useTeleportReady(),{phone:d}=n.usePhoneLayout(),f=()=>d.value?`var(--nb-zindex-modal-dropdown)`:`var(--nb-zindex-menu)`,p=l,m=(0,r.computed)(()=>p.disabled&&!!p.disabledReason),h=`nb-submenu-reason-${(0,r.useId)()}`,g=(0,r.ref)(null),_=(0,r.ref)(null),v=(0,r.ref)(!1),y=(0,r.inject)(`nb-menu`,null),b=null,x=null,S=(0,r.computed)(()=>`nb-menu--${y?.size??`md`}`),C=(0,r.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:f()});function w(){if(!g.value)return;let e=g.value.getBoundingClientRect(),t=e.right,n=e.top;t+200>window.innerWidth&&(t=e.left-200),n+200>window.innerHeight&&(n=Math.max(8,window.innerHeight-200)),C.value={position:`fixed`,top:`${n}px`,left:`${t}px`,zIndex:f()}}function T(){p.disabled||(j(),v.value=!0,w(),(0,r.nextTick)(()=>{if(_.value&&g.value){let e=g.value.getBoundingClientRect(),t=_.value.getBoundingClientRect(),n=e.right;n+t.width>window.innerWidth&&(n=e.left-t.width);let r=e.top;r+t.height>window.innerHeight&&(r=Math.max(8,window.innerHeight-t.height)),C.value={position:`fixed`,top:`${r}px`,left:`${n}px`,zIndex:f()}}}))}function E(){if(j(),!v.value)return;let e=!!_.value?.contains(document.activeElement);v.value=!1,e&&g.value?.focus()}function D(){return _.value?Array.from(_.value.querySelectorAll(`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`)):[]}function O(e,t){let n=D();for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].getAttribute(`aria-disabled`)!==`true`||n[r].hasAttribute(`data-nb-explained`)){n[r].focus();return}}function k(){p.disabled||(T(),(0,r.nextTick)(()=>O(0,1)))}function A(e){let t=D().indexOf(document.activeElement);e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),O(t+1,1)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),t>0&&O(t-1,-1)):e.key===`ArrowLeft`||e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),E()):e.key===`Tab`&&(E(),y?.close())}(0,r.watch)(_,(e,t)=>{t&&y?.unregisterSurface(t),e&&y?.registerSurface(e)});function j(){b&&=(clearTimeout(b),null),x&&=(clearTimeout(x),null)}function M(){j(),b=setTimeout(T,150)}function N(){j(),x=setTimeout(E,150)}function P(){j()}function F(){j(),x=setTimeout(E,150)}function I(){p.disabled||(v.value?E():T())}return(0,r.onBeforeUnmount)(()=>{j(),_.value&&y?.unregisterSurface(_.value)}),(e,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,[(0,r.createElementVNode)(`li`,{ref_key:`triggerRef`,ref:g,class:(0,r.normalizeClass)([`nb-menu-item nb-submenu-trigger`,{"nb-menu-item--disabled":l.disabled,"nb-menu-item--explained":m.value,"nb-menu-item--highlighted":v.value}]),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":v.value,"aria-disabled":l.disabled||void 0,"aria-describedby":m.value?h:void 0,"data-nb-explained":m.value||void 0,tabindex:-1,onMouseenter:M,onMouseleave:N,onKeydown:[(0,r.withKeys)((0,r.withModifiers)(k,[`prevent`]),[`right`]),(0,r.withKeys)((0,r.withModifiers)(k,[`prevent`]),[`enter`]),(0,r.withKeys)((0,r.withModifiers)(k,[`prevent`]),[`space`]),(0,r.withKeys)((0,r.withModifiers)(E,[`prevent`]),[`left`]),(0,r.withKeys)((0,r.withModifiers)(E,[`prevent`]),[`escape`])],onClick:I},[l.icon?((0,r.openBlock)(),(0,r.createBlock)(t.t,{key:0,name:l.icon,size:16,class:`nb-menu-item__icon`},null,8,[`name`])):(0,r.createCommentVNode)(``,!0),m.value?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,o,[(0,r.createElementVNode)(`span`,s,(0,r.toDisplayString)(l.label),1),(0,r.createElementVNode)(`span`,{id:h,class:`nb-menu-item__reason`},(0,r.toDisplayString)(l.disabledReason),1)])):((0,r.openBlock)(),(0,r.createElementBlock)(`span`,c,(0,r.toDisplayString)(l.label),1)),(0,r.createVNode)(t.t,{name:(0,r.unref)(i.regular),size:`sm`,class:`nb-submenu-trigger__caret`},null,8,[`name`])],42,a),((0,r.openBlock)(),(0,r.createBlock)(r.Teleport,{to:`body`,disabled:!(0,r.unref)(u)},[(0,r.createVNode)(r.Transition,{name:`nb-submenu`},{default:(0,r.withCtx)(()=>[v.value?((0,r.openBlock)(),(0,r.createElementBlock)(`ul`,{key:0,ref_key:`submenuRef`,ref:_,role:`menu`,class:(0,r.normalizeClass)([`nb-menu nb-submenu`,[S.value]]),style:(0,r.normalizeStyle)(C.value),onMouseenter:P,onMouseleave:F,onKeydown:A},[(0,r.renderSlot)(e.$slots,`default`)],38)):(0,r.createCommentVNode)(``,!0)]),_:3})],8,[`disabled`]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-D0Q0f7-M.cjs`),t=require(`./composables/useStableId.composable.cjs`),n=require(`./InlineLoading-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-D0Q0f7-M.cjs`),t=require(`./composables/useStableId.composable.cjs`),n=require(`./InlineLoading-CqGrNWHf.cjs`),r=require(`./TextInput.context-pJ99Jqwr.cjs`);let i=require(`vue`);var a=[`id`,`aria-label`,`aria-busy`],o=[`role`,`aria-labelledby`],s=[`id`],c=[`id`,`aria-selected`,`onMousemove`,`onClick`],l={key:0,class:`nb-suggestion-list__loading`,role:`presentation`},u={key:1,class:`nb-suggestion-list__empty`,role:`presentation`},d=(0,i.defineComponent)({__name:`SuggestionList`,props:{items:{},open:{type:Boolean,default:!0},itemLabel:{type:Function,default:void 0},itemKey:{type:Function,default:void 0},emptyText:{default:``},loading:{type:Boolean,default:!1},loadingText:{default:``},placement:{default:`bottom`},itemGroup:{type:Function,default:void 0},label:{default:``},for:{default:void 0},id:{default:void 0}},emits:[`select`,`update:open`,`close`],setup(e,{expose:d,emit:f}){let p=e,m=f,h=(0,i.useSlots)(),g=t.useStableId({id:p.id}),_=(0,i.ref)(null),v=(0,i.ref)(0),y=(0,i.inject)(r.t,null),b=(0,i.computed)(()=>!!p.emptyText||!!h.empty),x=(0,i.computed)(()=>p.open&&(p.items.length>0||b.value||p.loading)),S=(0,i.computed)(()=>{let e=[];return p.items.forEach((t,n)=>{let r=p.itemGroup?.(t)??``,i=e[e.length-1];if(i&&i.name===r){i.entries.push({item:t,index:n});return}e.push({key:`${e.length}:${r}`,name:r,headingId:`${g}-group-${e.length}`,entries:[{item:t,index:n}]})}),e});function C(e){return p.itemLabel?p.itemLabel(e):e&&typeof e==`object`&&`label`in e?String(e.label):String(e)}function w(e,t){return p.itemKey?p.itemKey(e,t):C(e)}function T(e){return`${g}-option-${e}`}function E(){if(p.for&&typeof document<`u`){let e=document.getElementById(p.for);if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e}return y?.field.value??null}function D(){m(`update:open`,!1),m(`close`)}function O(e){let t=p.items[e];t!==void 0&&(m(`select`,t,e),D())}function k(e){let t=p.items.length;t!==0&&(v.value=(e+t)%t)}function A(e){if(!x.value||e.isComposing)return;let t=p.items.length>0;switch(e.key){case`ArrowDown`:if(!t)return;k(v.value+1);break;case`ArrowUp`:if(!t)return;k(v.value-1);break;case`Home`:case`End`:if(!t||!(e.ctrlKey||e.metaKey))return;v.value=e.key===`Home`?0:p.items.length-1;break;case`Enter`:case`Tab`:if(!t)return;O(v.value);break;case`Escape`:D(),e.stopPropagation();break;default:return}e.preventDefault()}function j(){p.open&&D()}let M=[`role`,`aria-autocomplete`,`aria-expanded`,`aria-controls`,`aria-activedescendant`],N=null;function P(){N&&(N.setAttribute(`role`,`combobox`),N.setAttribute(`aria-autocomplete`,`list`),N.setAttribute(`aria-expanded`,String(x.value)),x.value?N.setAttribute(`aria-controls`,g):N.removeAttribute(`aria-controls`),x.value&&p.items.length>0?N.setAttribute(`aria-activedescendant`,T(v.value)):N.removeAttribute(`aria-activedescendant`))}function F(){let e=E();if(e===N||(I(),!e))return;N=e;let t=e;t.addEventListener(`keydown`,A,!0),t.addEventListener(`blur`,j),P()}function I(){if(N){N.removeEventListener(`keydown`,A,!0),N.removeEventListener(`blur`,j);for(let e of M)N.removeAttribute(e);N=null}}function L(){(_.value?.querySelectorAll(`.nb-suggestion-list__item`))?.[v.value]?.scrollIntoView?.({block:`nearest`})}return(0,i.watch)(()=>p.items,()=>{v.value=0}),(0,i.watch)(()=>p.open,e=>{e&&(v.value=0)}),(0,i.watch)([x,v,()=>p.items.length],async()=>{P(),await(0,i.nextTick)(),L()}),(0,i.onMounted)(()=>{F(),N||(0,i.nextTick)(F)}),(0,i.onBeforeUnmount)(I),d({onKeydown:A,activeIndex:v}),(t,r)=>x.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,id:(0,i.unref)(g),ref_key:`listRef`,ref:_,class:(0,i.normalizeClass)([`nb-suggestion-list`,`nb-suggestion-list--${e.placement}`]),role:`listbox`,"aria-label":e.label||void 0,"aria-busy":e.loading||void 0},[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(S.value,e=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:e.key,role:e.name?`group`:void 0,"aria-labelledby":e.name?e.headingId:void 0,class:(0,i.normalizeClass)({"nb-suggestion-list__section":e.name}),style:(0,i.normalizeStyle)(e.name?void 0:{display:`contents`})},[e.name?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,id:e.headingId,class:`nb-suggestion-list__group`,role:`presentation`},[(0,i.renderSlot)(t.$slots,`group`,{group:e.name},()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.name),1)],!0)],8,s)):(0,i.createCommentVNode)(``,!0),((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(e.entries,({item:e,index:n})=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{id:T(n),key:w(e,n),class:(0,i.normalizeClass)([`nb-suggestion-list__item`,{"nb-suggestion-list__item--active":n===v.value}]),role:`option`,"aria-selected":n===v.value,onMousedown:r[0]||=(0,i.withModifiers)(()=>{},[`prevent`]),onMousemove:e=>v.value=n,onClick:e=>O(n)},[(0,i.renderSlot)(t.$slots,`item`,{item:e,index:n,active:n===v.value},()=>[(0,i.createTextVNode)((0,i.toDisplayString)(C(e)),1)],!0)],42,c))),128))],14,o))),128)),e.loading?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,l,[(0,i.renderSlot)(t.$slots,`loading`,{},()=>[(0,i.createVNode)(n.t,{status:`active`,label:e.loadingText,"reserve-space":!1},null,8,[`label`])],!0)])):e.items.length===0?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,u,[(0,i.renderSlot)(t.$slots,`empty`,{},()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.emptyText),1)],!0)])):(0,i.createCommentVNode)(``,!0)],10,a)):(0,i.createCommentVNode)(``,!0)}}),f=e.t(d,[[`__scopeId`,`data-v-ed911e2f`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-C6QCLu9I.js";
|
|
2
2
|
import { useStableId as t } from "./composables/useStableId.composable.mjs";
|
|
3
|
-
import { t as n } from "./InlineLoading-
|
|
3
|
+
import { t as n } from "./InlineLoading-_j2KKhNQ.js";
|
|
4
4
|
import { t as r } from "./TextInput.context-CIHw4T0Y.js";
|
|
5
5
|
import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, inject as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, onMounted as ee, openBlock as g, ref as _, renderList as v, renderSlot as y, toDisplayString as b, unref as x, useSlots as S, watch as C, withModifiers as w } from "vue";
|
|
6
6
|
//#region src/components/SuggestionList.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { useTeleportReady as e } from "./composables/useTeleportReady.composable.mjs";
|
|
2
|
+
import { t } from "./_plugin-vue_export-helper-C6QCLu9I.js";
|
|
3
|
+
import { t as n } from "./Toast-DIf2XRCa.js";
|
|
4
|
+
import { NB_TOAST_QUEUE_KEY as r, useToast as i } from "./composables/useToast.composable.mjs";
|
|
5
|
+
import { Fragment as a, Teleport as o, TransitionGroup as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, inject as ee, nextTick as h, normalizeClass as te, onBeforeUnmount as g, onMounted as _, openBlock as v, ref as y, renderList as ne, renderSlot as re, toDisplayString as b, unref as x, watch as S, withCtx as ie } from "vue";
|
|
6
|
+
//#region src/components/Toaster.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var ae = { class: "nb-toaster__announcer" }, oe = {
|
|
8
|
+
role: "status",
|
|
9
|
+
"aria-live": "polite",
|
|
10
|
+
"aria-atomic": "true"
|
|
11
|
+
}, se = {
|
|
12
|
+
role: "alert",
|
|
13
|
+
"aria-live": "assertive",
|
|
14
|
+
"aria-atomic": "true"
|
|
15
|
+
}, ce = ["aria-label", "data-paused"], le = ["data-toast-id"], C = /* @__PURE__ */ new Map();
|
|
16
|
+
function w(e, t) {
|
|
17
|
+
let n = (C.get(e) ?? 0) + t;
|
|
18
|
+
n <= 0 ? C.delete(e) : C.set(e, n), !(t < 0 || n < 2) && (typeof process < "u" && process.env.NODE_ENV === "production" || console.warn("[NbToaster] Two hosts are rendering the same queue. Every toast will be shown and announced twice, and both hosts write to queue.max. Mount one NbToaster per application, and give any second host (a demo, a dialog) its own createToastQueue()."));
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/Toaster.vue
|
|
22
|
+
var T = /* @__PURE__ */ t(/* @__PURE__ */ m({
|
|
23
|
+
__name: "Toaster",
|
|
24
|
+
props: {
|
|
25
|
+
queue: { default: void 0 },
|
|
26
|
+
placement: { default: "bottom-end" },
|
|
27
|
+
max: { default: void 0 },
|
|
28
|
+
label: { default: "Notifications" },
|
|
29
|
+
to: {
|
|
30
|
+
type: [String, Boolean],
|
|
31
|
+
default: "body"
|
|
32
|
+
},
|
|
33
|
+
hotkey: { default: "alt+t" },
|
|
34
|
+
hotkeyHint: { default: "Press Alt plus T to reach it." }
|
|
35
|
+
},
|
|
36
|
+
setup(t, { expose: m }) {
|
|
37
|
+
let C = e(), T = t, ue = ee(r, null), E = c(() => T.queue ?? ue ?? i()), D = c(() => E.value.visible.value), O = c(() => [...D.value].reverse()), k = y(null), A = c(() => T.to === !1 ? "body" : T.to), j = null;
|
|
38
|
+
function M() {
|
|
39
|
+
j && (j.queue.max.value = j.previous), j = null;
|
|
40
|
+
}
|
|
41
|
+
S([E, () => T.max], ([e, t]) => {
|
|
42
|
+
j && (j.queue !== e || t === void 0) && M(), t !== void 0 && (j ||= {
|
|
43
|
+
queue: e,
|
|
44
|
+
previous: e.max.value
|
|
45
|
+
}, e.max.value = t);
|
|
46
|
+
}, { immediate: !0 });
|
|
47
|
+
let N = null;
|
|
48
|
+
function P(e) {
|
|
49
|
+
N !== e && (N && w(N, -1), N = e, e && w(e, 1));
|
|
50
|
+
}
|
|
51
|
+
S(E, (e) => {
|
|
52
|
+
N && P(e);
|
|
53
|
+
});
|
|
54
|
+
function de(e) {
|
|
55
|
+
return e.variant === "error" || e.variant === "warning";
|
|
56
|
+
}
|
|
57
|
+
let F = y(""), I = y(""), L = {
|
|
58
|
+
polite: {
|
|
59
|
+
text: F,
|
|
60
|
+
buffer: [],
|
|
61
|
+
draining: !1,
|
|
62
|
+
handle: null
|
|
63
|
+
},
|
|
64
|
+
assertive: {
|
|
65
|
+
text: I,
|
|
66
|
+
buffer: [],
|
|
67
|
+
draining: !1,
|
|
68
|
+
handle: null
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
function R(e) {
|
|
72
|
+
let t = [
|
|
73
|
+
E.value.labels.status[e.variant],
|
|
74
|
+
e.title,
|
|
75
|
+
e.message
|
|
76
|
+
].filter(Boolean).join(". ");
|
|
77
|
+
if (!e.cta) return t;
|
|
78
|
+
let n = T.hotkey ? ` ${T.hotkeyHint}` : "";
|
|
79
|
+
return `${t}. ${e.cta.label} action available.${n}`;
|
|
80
|
+
}
|
|
81
|
+
async function z(e) {
|
|
82
|
+
let t = e.buffer.shift();
|
|
83
|
+
if (t === void 0) {
|
|
84
|
+
e.draining = !1;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
e.draining = !0, e.text.value = "", await h(), e.text.value = t, e.handle = setTimeout(() => {
|
|
88
|
+
e.handle = null, z(e);
|
|
89
|
+
}, 500);
|
|
90
|
+
}
|
|
91
|
+
function B(e) {
|
|
92
|
+
let t = L[de(e) ? "assertive" : "polite"];
|
|
93
|
+
t.buffer.push(R(e)), t.draining || z(t);
|
|
94
|
+
}
|
|
95
|
+
g(() => {
|
|
96
|
+
for (let e of Object.values(L)) e.handle && clearTimeout(e.handle), e.handle = null, e.buffer.length = 0, e.draining = !1;
|
|
97
|
+
});
|
|
98
|
+
let V = /* @__PURE__ */ new Set();
|
|
99
|
+
S(D, (e) => {
|
|
100
|
+
let t = new Set(e.map((e) => e.id));
|
|
101
|
+
for (let e of [...V]) t.has(e.slice(0, e.lastIndexOf(":"))) || V.delete(e);
|
|
102
|
+
for (let t of e) {
|
|
103
|
+
let e = `${t.id}:${t.cycle}`;
|
|
104
|
+
V.has(e) || (V.add(e), B(t));
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
deep: !0,
|
|
108
|
+
immediate: !0
|
|
109
|
+
});
|
|
110
|
+
let H = /* @__PURE__ */ new Set(), U = !1;
|
|
111
|
+
function W(e) {
|
|
112
|
+
H.size === 0 && (U = E.value.paused.value), H.add(e), E.value.pause();
|
|
113
|
+
}
|
|
114
|
+
function G(e) {
|
|
115
|
+
H.delete(e) && H.size === 0 && !U && E.value.resume();
|
|
116
|
+
}
|
|
117
|
+
let K = null;
|
|
118
|
+
function q(e) {
|
|
119
|
+
let t = e.target;
|
|
120
|
+
!t || t === document.body || k.value?.contains(t) || (K = t);
|
|
121
|
+
}
|
|
122
|
+
function fe() {
|
|
123
|
+
W("focus");
|
|
124
|
+
}
|
|
125
|
+
function pe(e) {
|
|
126
|
+
let t = e.relatedTarget;
|
|
127
|
+
t && k.value?.contains(t) || G("focus");
|
|
128
|
+
}
|
|
129
|
+
function me(e) {
|
|
130
|
+
if (e.key !== "Escape") return;
|
|
131
|
+
let t = (document.activeElement?.closest(".nb-toaster__item"))?.dataset.toastId ?? O.value[0]?.id;
|
|
132
|
+
t && (e.stopPropagation(), e.preventDefault(), Z(t));
|
|
133
|
+
}
|
|
134
|
+
let J = [
|
|
135
|
+
"button:not([disabled])",
|
|
136
|
+
"[href]",
|
|
137
|
+
"input:not([disabled]):not([type=\"hidden\"])",
|
|
138
|
+
"select:not([disabled])",
|
|
139
|
+
"textarea:not([disabled])",
|
|
140
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
141
|
+
].join(",");
|
|
142
|
+
function he(e) {
|
|
143
|
+
return k.value?.querySelector(`[data-toast-id="${e}"]`) ?? null;
|
|
144
|
+
}
|
|
145
|
+
function Y(e) {
|
|
146
|
+
let t = he(e);
|
|
147
|
+
return t ? t.matches(J) ? t : t.querySelector(J) : null;
|
|
148
|
+
}
|
|
149
|
+
let X = /* @__PURE__ */ new Set();
|
|
150
|
+
S(D, (e, t) => {
|
|
151
|
+
if (!t) return;
|
|
152
|
+
let n = document.activeElement;
|
|
153
|
+
if (!n || !k.value?.contains(n)) return;
|
|
154
|
+
let r = n.closest("[data-toast-id]")?.dataset.toastId;
|
|
155
|
+
if (!r || e.some((e) => e.id === r)) return;
|
|
156
|
+
let i = [...t].reverse().map((e) => e.id), a = new Set(e.map((e) => e.id)), o = i.indexOf(r), s;
|
|
157
|
+
for (let e = o + 1; e < i.length && !s; e += 1) a.has(i[e]) && (s = i[e]);
|
|
158
|
+
for (let e = o - 1; e >= 0 && !s; --e) a.has(i[e]) && (s = i[e]);
|
|
159
|
+
let c = K;
|
|
160
|
+
h(() => {
|
|
161
|
+
let e = s ? Y(s) : null;
|
|
162
|
+
if (e) {
|
|
163
|
+
e.focus();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
c?.isConnected && c.focus(), K = null;
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
function Z(e, t) {
|
|
170
|
+
E.value.dismiss(e, t ?? (X.has(e) ? "action" : "user")), X.delete(e);
|
|
171
|
+
}
|
|
172
|
+
let ge = {
|
|
173
|
+
space: "Space",
|
|
174
|
+
enter: "Enter",
|
|
175
|
+
escape: "Escape",
|
|
176
|
+
comma: "Comma",
|
|
177
|
+
period: "Period",
|
|
178
|
+
slash: "Slash",
|
|
179
|
+
backslash: "Backslash",
|
|
180
|
+
backquote: "Backquote",
|
|
181
|
+
minus: "Minus",
|
|
182
|
+
equal: "Equal"
|
|
183
|
+
};
|
|
184
|
+
function _e(e) {
|
|
185
|
+
return /^[a-z]$/.test(e) ? `Key${e.toUpperCase()}` : /^[0-9]$/.test(e) ? `Digit${e}` : ge[e] ?? null;
|
|
186
|
+
}
|
|
187
|
+
function ve(e) {
|
|
188
|
+
if (!T.hotkey) return !1;
|
|
189
|
+
let t = T.hotkey.toLowerCase().split("+"), n = t[t.length - 1], r = _e(n);
|
|
190
|
+
if (r ? e.code !== r : e.key.toLowerCase() !== n) return !1;
|
|
191
|
+
let i = (e) => t.includes(e);
|
|
192
|
+
return e.altKey === i("alt") && e.ctrlKey === i("ctrl") && e.shiftKey === i("shift") && e.metaKey === i("meta");
|
|
193
|
+
}
|
|
194
|
+
function ye() {
|
|
195
|
+
let e = document.querySelectorAll("[aria-modal=\"true\"]");
|
|
196
|
+
for (let t of e) if (!(k.value && t.contains(k.value))) return t;
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
function Q(e) {
|
|
200
|
+
if (!ve(e) || O.value.length === 0) return;
|
|
201
|
+
if (k.value?.contains(document.activeElement)) {
|
|
202
|
+
e.preventDefault(), K?.isConnected ? K.focus() : document.activeElement?.blur();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (ye()) return;
|
|
206
|
+
let t = Y(O.value[0].id);
|
|
207
|
+
t && (e.preventDefault(), t.focus());
|
|
208
|
+
}
|
|
209
|
+
function $() {
|
|
210
|
+
document.visibilityState === "hidden" ? W("hidden") : G("hidden");
|
|
211
|
+
}
|
|
212
|
+
return _(() => {
|
|
213
|
+
P(E.value), $(), document.addEventListener("visibilitychange", $), document.addEventListener("focusin", q), document.addEventListener("keydown", Q);
|
|
214
|
+
}), g(() => {
|
|
215
|
+
document.removeEventListener("visibilitychange", $), document.removeEventListener("focusin", q), document.removeEventListener("keydown", Q);
|
|
216
|
+
let e = H.size > 0 && !U;
|
|
217
|
+
H.clear(), e && E.value.resume(), P(null), M();
|
|
218
|
+
}), S(() => D.value.length, (e) => {
|
|
219
|
+
if (e > 0) return;
|
|
220
|
+
let t = H.delete("pointer"), n = H.delete("focus");
|
|
221
|
+
!t && !n || H.size === 0 && !U && E.value.resume();
|
|
222
|
+
}), m({ queue: E }), (e, t) => (v(), l(o, {
|
|
223
|
+
to: A.value,
|
|
224
|
+
disabled: !x(C) || T.to === !1
|
|
225
|
+
}, [f("div", ae, [f("div", oe, b(F.value), 1), f("div", se, b(I.value), 1)]), D.value.length > 0 ? (v(), d("div", {
|
|
226
|
+
key: 0,
|
|
227
|
+
ref_key: "regionRef",
|
|
228
|
+
ref: k,
|
|
229
|
+
class: te(["nb-toaster", `nb-toaster--${T.placement}`]),
|
|
230
|
+
role: "region",
|
|
231
|
+
"aria-label": T.label,
|
|
232
|
+
"data-paused": E.value.paused.value ? "true" : void 0,
|
|
233
|
+
onMouseenter: t[0] ||= (e) => W("pointer"),
|
|
234
|
+
onMouseleave: t[1] ||= (e) => G("pointer"),
|
|
235
|
+
onFocusin: fe,
|
|
236
|
+
onFocusout: pe,
|
|
237
|
+
onKeydown: me
|
|
238
|
+
}, [p(s, {
|
|
239
|
+
tag: "div",
|
|
240
|
+
class: "nb-toaster__stack",
|
|
241
|
+
name: "nb-toaster"
|
|
242
|
+
}, {
|
|
243
|
+
default: ie(() => [(v(!0), d(a, null, ne(O.value, (t) => (v(), d("div", {
|
|
244
|
+
key: t.id,
|
|
245
|
+
class: "nb-toaster__item",
|
|
246
|
+
"data-toast-id": t.id
|
|
247
|
+
}, [re(e.$slots, "toast", {
|
|
248
|
+
toast: t,
|
|
249
|
+
paused: E.value.paused.value,
|
|
250
|
+
dismiss: (e) => Z(t.id, e),
|
|
251
|
+
action: () => x(X).add(t.id)
|
|
252
|
+
}, () => [p(n, {
|
|
253
|
+
message: t.message,
|
|
254
|
+
title: t.title,
|
|
255
|
+
variant: t.variant,
|
|
256
|
+
cta: t.cta,
|
|
257
|
+
duration: t.duration,
|
|
258
|
+
cycle: t.cycle,
|
|
259
|
+
managed: "",
|
|
260
|
+
paused: E.value.paused.value,
|
|
261
|
+
role: "none",
|
|
262
|
+
"aria-live": "off",
|
|
263
|
+
"status-label": E.value.labels.status[t.variant],
|
|
264
|
+
"close-label": E.value.labels.close,
|
|
265
|
+
onAction: (e) => x(X).add(t.id),
|
|
266
|
+
onClose: (e) => Z(t.id)
|
|
267
|
+
}, null, 8, [
|
|
268
|
+
"message",
|
|
269
|
+
"title",
|
|
270
|
+
"variant",
|
|
271
|
+
"cta",
|
|
272
|
+
"duration",
|
|
273
|
+
"cycle",
|
|
274
|
+
"paused",
|
|
275
|
+
"status-label",
|
|
276
|
+
"close-label",
|
|
277
|
+
"onAction",
|
|
278
|
+
"onClose"
|
|
279
|
+
])], !0)], 8, le))), 128))]),
|
|
280
|
+
_: 3
|
|
281
|
+
})], 42, ce)) : u("", !0)], 8, ["to", "disabled"]));
|
|
282
|
+
}
|
|
283
|
+
}), [["__scopeId", "data-v-d01c41a8"]]);
|
|
284
|
+
//#endregion
|
|
285
|
+
export { T as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useTeleportReady.composable.cjs`),t=require(`./_plugin-vue_export-helper-D0Q0f7-M.cjs`),n=require(`./Toast-CN5Jzkr5.cjs`),r=require(`./composables/useToast.composable.cjs`);let i=require(`vue`);var a={class:`nb-toaster__announcer`},o={role:`status`,"aria-live":`polite`,"aria-atomic":`true`},s={role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`},c=[`aria-label`,`data-paused`],l=[`data-toast-id`],u=new Map;function d(e,t){let n=(u.get(e)??0)+t;n<=0?u.delete(e):u.set(e,n),!(t<0||n<2)&&(typeof process<`u`&&process.env.NODE_ENV===`production`||console.warn(`[NbToaster] Two hosts are rendering the same queue. Every toast will be shown and announced twice, and both hosts write to queue.max. Mount one NbToaster per application, and give any second host (a demo, a dialog) its own createToastQueue().`))}var f=(0,i.defineComponent)({__name:`Toaster`,props:{queue:{default:void 0},placement:{default:`bottom-end`},max:{default:void 0},label:{default:`Notifications`},to:{type:[String,Boolean],default:`body`},hotkey:{default:`alt+t`},hotkeyHint:{default:`Press Alt plus T to reach it.`}},setup(t,{expose:u}){let f=e.useTeleportReady(),p=t,m=(0,i.inject)(r.NB_TOAST_QUEUE_KEY,null),h=(0,i.computed)(()=>p.queue??m??r.useToast()),g=(0,i.computed)(()=>h.value.visible.value),_=(0,i.computed)(()=>[...g.value].reverse()),v=(0,i.ref)(null),y=(0,i.computed)(()=>p.to===!1?`body`:p.to),b=null;function x(){b&&(b.queue.max.value=b.previous),b=null}(0,i.watch)([h,()=>p.max],([e,t])=>{b&&(b.queue!==e||t===void 0)&&x(),t!==void 0&&(b||={queue:e,previous:e.max.value},e.max.value=t)},{immediate:!0});let S=null;function C(e){S!==e&&(S&&d(S,-1),S=e,e&&d(e,1))}(0,i.watch)(h,e=>{S&&C(e)});function w(e){return e.variant===`error`||e.variant===`warning`}let T=(0,i.ref)(``),E=(0,i.ref)(``),D={polite:{text:T,buffer:[],draining:!1,handle:null},assertive:{text:E,buffer:[],draining:!1,handle:null}};function O(e){let t=[h.value.labels.status[e.variant],e.title,e.message].filter(Boolean).join(`. `);if(!e.cta)return t;let n=p.hotkey?` ${p.hotkeyHint}`:``;return`${t}. ${e.cta.label} action available.${n}`}async function k(e){let t=e.buffer.shift();if(t===void 0){e.draining=!1;return}e.draining=!0,e.text.value=``,await(0,i.nextTick)(),e.text.value=t,e.handle=setTimeout(()=>{e.handle=null,k(e)},500)}function A(e){let t=D[w(e)?`assertive`:`polite`];t.buffer.push(O(e)),t.draining||k(t)}(0,i.onBeforeUnmount)(()=>{for(let e of Object.values(D))e.handle&&clearTimeout(e.handle),e.handle=null,e.buffer.length=0,e.draining=!1});let j=new Set;(0,i.watch)(g,e=>{let t=new Set(e.map(e=>e.id));for(let e of[...j])t.has(e.slice(0,e.lastIndexOf(`:`)))||j.delete(e);for(let t of e){let e=`${t.id}:${t.cycle}`;j.has(e)||(j.add(e),A(t))}},{deep:!0,immediate:!0});let M=new Set,N=!1;function P(e){M.size===0&&(N=h.value.paused.value),M.add(e),h.value.pause()}function F(e){M.delete(e)&&M.size===0&&!N&&h.value.resume()}let I=null;function L(e){let t=e.target;!t||t===document.body||v.value?.contains(t)||(I=t)}function R(){P(`focus`)}function z(e){let t=e.relatedTarget;t&&v.value?.contains(t)||F(`focus`)}function B(e){if(e.key!==`Escape`)return;let t=(document.activeElement?.closest(`.nb-toaster__item`))?.dataset.toastId??_.value[0]?.id;t&&(e.stopPropagation(),e.preventDefault(),G(t))}let V=[`button:not([disabled])`,`[href]`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function H(e){return v.value?.querySelector(`[data-toast-id="${e}"]`)??null}function U(e){let t=H(e);return t?t.matches(V)?t:t.querySelector(V):null}let W=new Set;(0,i.watch)(g,(e,t)=>{if(!t)return;let n=document.activeElement;if(!n||!v.value?.contains(n))return;let r=n.closest(`[data-toast-id]`)?.dataset.toastId;if(!r||e.some(e=>e.id===r))return;let a=[...t].reverse().map(e=>e.id),o=new Set(e.map(e=>e.id)),s=a.indexOf(r),c;for(let e=s+1;e<a.length&&!c;e+=1)o.has(a[e])&&(c=a[e]);for(let e=s-1;e>=0&&!c;--e)o.has(a[e])&&(c=a[e]);let l=I;(0,i.nextTick)(()=>{let e=c?U(c):null;if(e){e.focus();return}l?.isConnected&&l.focus(),I=null})});function G(e,t){h.value.dismiss(e,t??(W.has(e)?`action`:`user`)),W.delete(e)}let K={space:`Space`,enter:`Enter`,escape:`Escape`,comma:`Comma`,period:`Period`,slash:`Slash`,backslash:`Backslash`,backquote:`Backquote`,minus:`Minus`,equal:`Equal`};function q(e){return/^[a-z]$/.test(e)?`Key${e.toUpperCase()}`:/^[0-9]$/.test(e)?`Digit${e}`:K[e]??null}function J(e){if(!p.hotkey)return!1;let t=p.hotkey.toLowerCase().split(`+`),n=t[t.length-1],r=q(n);if(r?e.code!==r:e.key.toLowerCase()!==n)return!1;let i=e=>t.includes(e);return e.altKey===i(`alt`)&&e.ctrlKey===i(`ctrl`)&&e.shiftKey===i(`shift`)&&e.metaKey===i(`meta`)}function Y(){let e=document.querySelectorAll(`[aria-modal="true"]`);for(let t of e)if(!(v.value&&t.contains(v.value)))return t;return null}function X(e){if(!J(e)||_.value.length===0)return;if(v.value?.contains(document.activeElement)){e.preventDefault(),I?.isConnected?I.focus():document.activeElement?.blur();return}if(Y())return;let t=U(_.value[0].id);t&&(e.preventDefault(),t.focus())}function Z(){document.visibilityState===`hidden`?P(`hidden`):F(`hidden`)}return(0,i.onMounted)(()=>{C(h.value),Z(),document.addEventListener(`visibilitychange`,Z),document.addEventListener(`focusin`,L),document.addEventListener(`keydown`,X)}),(0,i.onBeforeUnmount)(()=>{document.removeEventListener(`visibilitychange`,Z),document.removeEventListener(`focusin`,L),document.removeEventListener(`keydown`,X);let e=M.size>0&&!N;M.clear(),e&&h.value.resume(),C(null),x()}),(0,i.watch)(()=>g.value.length,e=>{if(e>0)return;let t=M.delete(`pointer`),n=M.delete(`focus`);!t&&!n||M.size===0&&!N&&h.value.resume()}),u({queue:h}),(e,t)=>((0,i.openBlock)(),(0,i.createBlock)(i.Teleport,{to:y.value,disabled:!(0,i.unref)(f)||p.to===!1},[(0,i.createElementVNode)(`div`,a,[(0,i.createElementVNode)(`div`,o,(0,i.toDisplayString)(T.value),1),(0,i.createElementVNode)(`div`,s,(0,i.toDisplayString)(E.value),1)]),g.value.length>0?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,ref_key:`regionRef`,ref:v,class:(0,i.normalizeClass)([`nb-toaster`,`nb-toaster--${p.placement}`]),role:`region`,"aria-label":p.label,"data-paused":h.value.paused.value?`true`:void 0,onMouseenter:t[0]||=e=>P(`pointer`),onMouseleave:t[1]||=e=>F(`pointer`),onFocusin:R,onFocusout:z,onKeydown:B},[(0,i.createVNode)(i.TransitionGroup,{tag:`div`,class:`nb-toaster__stack`,name:`nb-toaster`},{default:(0,i.withCtx)(()=>[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(_.value,t=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:t.id,class:`nb-toaster__item`,"data-toast-id":t.id},[(0,i.renderSlot)(e.$slots,`toast`,{toast:t,paused:h.value.paused.value,dismiss:e=>G(t.id,e),action:()=>(0,i.unref)(W).add(t.id)},()=>[(0,i.createVNode)(n.t,{message:t.message,title:t.title,variant:t.variant,cta:t.cta,duration:t.duration,cycle:t.cycle,managed:``,paused:h.value.paused.value,role:`none`,"aria-live":`off`,"status-label":h.value.labels.status[t.variant],"close-label":h.value.labels.close,onAction:e=>(0,i.unref)(W).add(t.id),onClose:e=>G(t.id)},null,8,[`message`,`title`,`variant`,`cta`,`duration`,`cycle`,`paused`,`status-label`,`close-label`,`onAction`,`onClose`])],!0)],8,l))),128))]),_:3})],42,c)):(0,i.createCommentVNode)(``,!0)],8,[`to`,`disabled`]))}}),p=t.t(f,[[`__scopeId`,`data-v-d01c41a8`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|