@nubisco/ui 5.4.1 → 5.6.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.
Files changed (161) hide show
  1. package/README.md +4 -3
  2. package/dist/{Blueprint-BgmsyoIu.js → Blueprint-ClU0eIiy.js} +2 -2
  3. package/dist/{Blueprint-CvOpJq_7.cjs → Blueprint-DbehXPR2.cjs} +1 -1
  4. package/dist/{BlueprintCard-BdT657ax.cjs → BlueprintCard-MDfxqPyE.cjs} +1 -1
  5. package/dist/{BlueprintCard-BJlyW5LC.js → BlueprintCard-VfWPpR6_.js} +1 -1
  6. package/dist/{BlueprintControls-DCUQ9LQ7.cjs → BlueprintControls-BR12TLQ1.cjs} +1 -1
  7. package/dist/{BlueprintControls-DwGxskS4.js → BlueprintControls-pnaU1lCY.js} +1 -1
  8. package/dist/Button-Cw4D6w9K.js +121 -0
  9. package/dist/Button-D-XSNjSL.cjs +1 -0
  10. package/dist/{Confirm-bPSArUzM.js → Confirm-BewLtgMD.js} +1 -1
  11. package/dist/{Confirm-Dmhkb56Q.cjs → Confirm-DHWWbfmu.cjs} +1 -1
  12. package/dist/{DataTable-DueT6mHP.js → DataTable-CVih75pn.js} +1 -1
  13. package/dist/{DataTable-CtjSxLmA.cjs → DataTable-DLuSmiTV.cjs} +1 -1
  14. package/dist/{FileUploader-OqfHo3LH.js → FileUploader-Ba0H8UPw.js} +1 -1
  15. package/dist/{FileUploader-DEBpnSuZ.cjs → FileUploader-CN7XPX9n.cjs} +1 -1
  16. package/dist/InfoHint-DX3lgnTX.cjs +1 -0
  17. package/dist/{InfoHint-Dvdnc-vI.js → InfoHint-DjAgTkgL.js} +32 -32
  18. package/dist/Menu-BSbPfsiE.cjs +1 -0
  19. package/dist/{Menu-Dzg_RrG-.js → Menu-Dy1JwMdl.js} +31 -17
  20. package/dist/{MenuBarItem-DyS1SWrP.js → MenuBarItem-CYofbcgq.js} +1 -1
  21. package/dist/{MenuBarItem-ma4XHwRB.cjs → MenuBarItem-Ya88A6xZ.cjs} +1 -1
  22. package/dist/{NotificationCenter-BYQdkoja.cjs → NotificationCenter-DCi4hoKm.cjs} +1 -1
  23. package/dist/{NotificationCenter-_K5ZQ82b.js → NotificationCenter-Yhez667P.js} +1 -1
  24. package/dist/{Pagination-NaWfr8Rs.cjs → Pagination-CcZB4Lp_.cjs} +1 -1
  25. package/dist/{Pagination-Mu8uhAwJ.js → Pagination-DDIc4vUH.js} +2 -2
  26. package/dist/Select-BMamCNcN.cjs +1 -0
  27. package/dist/Select-CB4BSCaj.js +405 -0
  28. package/dist/Submenu-QgPVi2bN.cjs +1 -0
  29. package/dist/Submenu-SQTJc81U.js +148 -0
  30. package/dist/TableOfContents-BD-79w4n.cjs +1 -0
  31. package/dist/TableOfContents-fTZdpn-L.js +253 -0
  32. package/dist/{Tree-DUfjBsuG.js → Tree-DHdPsRXV.js} +1 -1
  33. package/dist/{Tree-CHJvaRgP.cjs → Tree-DI_ouWnv.cjs} +1 -1
  34. package/dist/TreeNode-CME77z98.js +165 -0
  35. package/dist/TreeNode-CpV3GOzv.cjs +1 -0
  36. package/dist/{Walkthrough-DpGi2slp.js → Walkthrough-B4E8LruL.js} +1 -1
  37. package/dist/{Walkthrough-ClLGKPYd.cjs → Walkthrough-DuX31BAz.cjs} +1 -1
  38. package/dist/all.cjs +1 -1
  39. package/dist/all.mjs +59 -57
  40. package/dist/component-styles.json +5 -0
  41. package/dist/components/AiLabel.cjs +1 -1
  42. package/dist/components/AiLabel.mjs +1 -1
  43. package/dist/components/Blueprint.cjs +1 -1
  44. package/dist/components/Blueprint.mjs +1 -1
  45. package/dist/components/BlueprintBackground.cjs +1 -1
  46. package/dist/components/BlueprintBackground.mjs +1 -1
  47. package/dist/components/BlueprintCard.cjs +1 -1
  48. package/dist/components/BlueprintCard.mjs +1 -1
  49. package/dist/components/BlueprintControls.cjs +1 -1
  50. package/dist/components/BlueprintControls.mjs +1 -1
  51. package/dist/components/BlueprintMinimap.cjs +1 -1
  52. package/dist/components/BlueprintMinimap.mjs +1 -1
  53. package/dist/components/BottomPanel.cjs +1 -1
  54. package/dist/components/BottomPanel.mjs +1 -1
  55. package/dist/components/Button.cjs +1 -1
  56. package/dist/components/Button.mjs +1 -1
  57. package/dist/components/Button.vue.d.ts +6 -9
  58. package/dist/components/Button.vue.d.ts.map +1 -1
  59. package/dist/components/Confirm.cjs +1 -1
  60. package/dist/components/Confirm.mjs +1 -1
  61. package/dist/components/DataTable.cjs +1 -1
  62. package/dist/components/DataTable.mjs +1 -1
  63. package/dist/components/FileUploader.cjs +1 -1
  64. package/dist/components/FileUploader.mjs +1 -1
  65. package/dist/components/Form.cjs +1 -1
  66. package/dist/components/Form.mjs +1 -1
  67. package/dist/components/ImageCropper.cjs +1 -1
  68. package/dist/components/ImageCropper.mjs +1 -1
  69. package/dist/components/InfoHint.cjs +1 -1
  70. package/dist/components/InfoHint.mjs +1 -1
  71. package/dist/components/InfoHint.vue.d.ts.map +1 -1
  72. package/dist/components/Menu.cjs +1 -1
  73. package/dist/components/Menu.d.ts +7 -0
  74. package/dist/components/Menu.mjs +1 -1
  75. package/dist/components/Menu.vue.d.ts.map +1 -1
  76. package/dist/components/MenuBarItem.cjs +1 -1
  77. package/dist/components/MenuBarItem.mjs +1 -1
  78. package/dist/components/NotificationCenter.cjs +1 -1
  79. package/dist/components/NotificationCenter.mjs +1 -1
  80. package/dist/components/Pagination.cjs +1 -1
  81. package/dist/components/Pagination.mjs +1 -1
  82. package/dist/components/Select.cjs +1 -1
  83. package/dist/components/Select.d.ts +10 -0
  84. package/dist/components/Select.mjs +1 -1
  85. package/dist/components/Select.vue.d.ts +7 -7
  86. package/dist/components/Select.vue.d.ts.map +1 -1
  87. package/dist/components/ShellPanel.cjs +1 -1
  88. package/dist/components/ShellPanel.mjs +1 -1
  89. package/dist/components/Submenu.cjs +1 -1
  90. package/dist/components/Submenu.mjs +1 -1
  91. package/dist/components/Submenu.vue.d.ts.map +1 -1
  92. package/dist/components/TableOfContents.cjs +1 -0
  93. package/dist/components/TableOfContents.d.ts +104 -0
  94. package/dist/components/TableOfContents.mjs +2 -0
  95. package/dist/components/TableOfContents.vue.d.ts +44 -0
  96. package/dist/components/TableOfContents.vue.d.ts.map +1 -0
  97. package/dist/components/TableOfContentsList.vue.d.ts +14 -0
  98. package/dist/components/TableOfContentsList.vue.d.ts.map +1 -0
  99. package/dist/components/Tabs.cjs +1 -1
  100. package/dist/components/Tabs.mjs +1 -1
  101. package/dist/components/Tree.cjs +1 -1
  102. package/dist/components/Tree.d.ts +14 -0
  103. package/dist/components/Tree.mjs +1 -1
  104. package/dist/components/TreeNode.cjs +1 -1
  105. package/dist/components/TreeNode.mjs +1 -1
  106. package/dist/components/TreeNode.vue.d.ts +2 -0
  107. package/dist/components/TreeNode.vue.d.ts.map +1 -1
  108. package/dist/components/Walkthrough.cjs +1 -1
  109. package/dist/components/Walkthrough.mjs +1 -1
  110. package/dist/components/index.d.ts.map +1 -1
  111. package/dist/components/manifest.d.ts +1 -0
  112. package/dist/components/manifest.d.ts.map +1 -1
  113. package/dist/components/manifest.js +1 -0
  114. package/dist/composables/useBlueprint.composable.cjs +1 -1
  115. package/dist/composables/useBlueprint.composable.mjs +1 -1
  116. package/dist/composables/useConfirm.composable.cjs +1 -1
  117. package/dist/composables/useConfirm.composable.mjs +1 -1
  118. package/dist/global.d.ts +4 -0
  119. package/dist/index.cjs +1 -1
  120. package/dist/index.mjs +38 -37
  121. package/dist/main.d.ts +2 -0
  122. package/dist/main.d.ts.map +1 -1
  123. package/dist/styles/Button.css +1 -1
  124. package/dist/styles/InfoHint.css +1 -1
  125. package/dist/styles/Select.css +1 -1
  126. package/dist/styles/TableOfContents.css +1 -0
  127. package/dist/styles/TreeNode.css +1 -1
  128. package/dist/ui.css +5 -4
  129. package/package.json +1 -1
  130. package/dist/Button-B2ngznxj.cjs +0 -1
  131. package/dist/Button-CnwG9SUU.js +0 -99
  132. package/dist/InfoHint-BOYN7Jig.cjs +0 -1
  133. package/dist/Menu-CTCkLSMW.cjs +0 -1
  134. package/dist/Select-BbsEiJ4j.cjs +0 -1
  135. package/dist/Select-Ep1fFBFj.js +0 -378
  136. package/dist/Submenu-D5C02DV5.js +0 -123
  137. package/dist/Submenu-DuMYz-uf.cjs +0 -1
  138. package/dist/TreeNode-CyOc2r4y.cjs +0 -1
  139. package/dist/TreeNode-S_qQNbsJ.js +0 -143
  140. /package/dist/{AiLabel-BmUhIOFk.js → AiLabel-BciBQAKB.js} +0 -0
  141. /package/dist/{AiLabel-PATTi5dO.cjs → AiLabel-ClnMVvCl.cjs} +0 -0
  142. /package/dist/{Blueprint.context-BOAtPYlo.js → Blueprint.context-CHfek6nW.js} +0 -0
  143. /package/dist/{Blueprint.context-BUzhZPrF.cjs → Blueprint.context-C_y0TS6a.cjs} +0 -0
  144. /package/dist/{BlueprintBackground-Cd_30GvD.cjs → BlueprintBackground-D58A6eXS.cjs} +0 -0
  145. /package/dist/{BlueprintBackground-1IxGPyUh.js → BlueprintBackground-SJ-ibrkF.js} +0 -0
  146. /package/dist/{BlueprintMinimap-w3Y0VvIx.cjs → BlueprintMinimap-BPqaGiY0.cjs} +0 -0
  147. /package/dist/{BlueprintMinimap-CmFRuqou.js → BlueprintMinimap-De8KVP54.js} +0 -0
  148. /package/dist/{BottomPanel-VNTVAMs3.js → BottomPanel-C7VWbs0V.js} +0 -0
  149. /package/dist/{BottomPanel-CK1NsXtz.cjs → BottomPanel-Di3pv797.cjs} +0 -0
  150. /package/dist/{Form-HC4yg8DG.js → Form-BPHdzd8_.js} +0 -0
  151. /package/dist/{Form-rRMK9twU.cjs → Form-C-l_4RHC.cjs} +0 -0
  152. /package/dist/{ImageCropper-BKKcVuPn.cjs → ImageCropper-BbW7o5mE.cjs} +0 -0
  153. /package/dist/{ImageCropper-CR8HCvg4.js → ImageCropper-DS3QiZ-X.js} +0 -0
  154. /package/dist/{ShellPanel-DnleEQR7.js → ShellPanel-B1byDSRC.js} +0 -0
  155. /package/dist/{ShellPanel-62ajcug-.cjs → ShellPanel-c3FBvVMm.cjs} +0 -0
  156. /package/dist/{Tabs-B2XvVchi.cjs → Tabs-B4r8l7vl.cjs} +0 -0
  157. /package/dist/{Tabs-CSizMNKI.js → Tabs-Cs5i4IGp.js} +0 -0
  158. /package/dist/{TreeContext-XcdJsmjK.cjs → TreeContext-BH2qpPud.cjs} +0 -0
  159. /package/dist/{TreeContext-RyZC10Bs.js → TreeContext-DMADOfuO.js} +0 -0
  160. /package/dist/{pixi-scene-BLuFyySv.cjs → pixi-scene-BmwgRql_.cjs} +0 -0
  161. /package/dist/{pixi-scene-BEkv7XH4.js → pixi-scene-CeviVGrf.js} +0 -0
@@ -0,0 +1,405 @@
1
+ import { t as e } from "./Icon-rREAqsu0.js";
2
+ import { t } from "./Label-glcQoGCr.js";
3
+ import { t as n } from "./Message-Ciyc2nN6.js";
4
+ import { t as r } from "./Grid-CgUyhsw4.js";
5
+ import { Fragment as i, Teleport as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as ee, openBlock as _, ref as v, renderList as te, renderSlot as y, toDisplayString as b, unref as x, useId as S, vModelText as ne, watch as re, withCtx as C, withDirectives as ie, withKeys as ae, withModifiers as w } from "vue";
6
+ import { regular as T } from "@nubisco/ui/icons/caret-down";
7
+ import { regular as E } from "@nubisco/ui/icons/caret-up";
8
+ //#region src/components/Select.vue?vue&type=script&setup=true&lang.ts
9
+ var oe = [
10
+ "id",
11
+ "aria-expanded",
12
+ "aria-disabled",
13
+ "aria-required",
14
+ "disabled"
15
+ ], se = [
16
+ "id",
17
+ "aria-expanded",
18
+ "aria-disabled",
19
+ "aria-required",
20
+ "disabled"
21
+ ], ce = {
22
+ key: 1,
23
+ class: "nb-select__inner-label"
24
+ }, le = {
25
+ key: 0,
26
+ class: "nb-select__asterisk",
27
+ "aria-hidden": "true"
28
+ }, ue = ["aria-multiselectable"], de = [
29
+ "aria-selected",
30
+ "aria-disabled",
31
+ "onMouseenter",
32
+ "onClick"
33
+ ], fe = {
34
+ key: 0,
35
+ class: "nb-select__option-check",
36
+ "aria-hidden": "true"
37
+ }, pe = {
38
+ key: 0,
39
+ viewBox: "0 0 10 8",
40
+ fill: "none",
41
+ width: "10",
42
+ height: "8"
43
+ }, me = { class: "nb-select__option-label" }, D = {
44
+ key: 0,
45
+ class: "nb-select__empty"
46
+ }, O = ["placeholder", "onKeydown"], k = /* @__PURE__ */ p({
47
+ __name: "Select",
48
+ props: {
49
+ modelValue: { default: null },
50
+ options: { default: () => [] },
51
+ multiple: {
52
+ type: Boolean,
53
+ default: !1
54
+ },
55
+ creatable: {
56
+ type: Boolean,
57
+ default: !1
58
+ },
59
+ createPlaceholder: { default: "" },
60
+ placeholder: { default: "Select…" },
61
+ name: { default: "" },
62
+ disabled: {
63
+ type: Boolean,
64
+ default: !1
65
+ },
66
+ required: {
67
+ type: Boolean,
68
+ default: !1
69
+ },
70
+ id: { default: void 0 },
71
+ label: { default: "" },
72
+ error: { default: "" },
73
+ warning: { default: "" },
74
+ helper: { default: "" },
75
+ variant: { default: "default" },
76
+ size: { default: "md" }
77
+ },
78
+ emits: [
79
+ "update:modelValue",
80
+ "change",
81
+ "create"
82
+ ],
83
+ setup(p, { expose: k, emit: A }) {
84
+ let j = p, M = A, N = v("");
85
+ function he() {
86
+ let e = N.value.trim();
87
+ e && (M("create", e), N.value = "");
88
+ }
89
+ let P = v(!1), F = v(!1), I = v(-1), L = v(null), R = v(null), z = v(null), B = v({
90
+ position: "fixed",
91
+ top: "0px",
92
+ left: "0px",
93
+ width: "0px",
94
+ zIndex: "9999"
95
+ }), ge = `nb-select-${S()}`, V = o(() => j.id ?? ge), H = o(() => j.modelValue == null ? [] : Array.isArray(j.modelValue) ? j.modelValue : [j.modelValue]), U = o(() => {
96
+ if (!(j.multiple || H.value.length !== 1)) return (j.options ?? []).find((e) => e.value === H.value[0])?.icon;
97
+ }), W = o(() => {
98
+ if (H.value.length === 0) return "";
99
+ let e = j.options ?? [];
100
+ return j.multiple ? H.value.length === 1 ? e.find((e) => e.value === H.value[0])?.label ?? String(H.value[0]) : H.value.length === 2 ? H.value.map((t) => e.find((e) => e.value === t)?.label ?? String(t)).join(", ") : `${H.value.length} selected` : e.find((e) => e.value === H.value[0])?.label ?? String(H.value[0]);
101
+ });
102
+ function G(e) {
103
+ return H.value.includes(e);
104
+ }
105
+ function K(e) {
106
+ if (e.disabled) return;
107
+ let t;
108
+ if (j.multiple) {
109
+ let n = [...H.value], r = n.indexOf(e.value);
110
+ r >= 0 ? n.splice(r, 1) : n.push(e.value), t = n;
111
+ } else t = e.value, Y();
112
+ M("update:modelValue", t), M("change", t);
113
+ }
114
+ function q() {
115
+ if (!R.value) return;
116
+ let e = R.value.getBoundingClientRect(), t = z.value?.offsetHeight ?? 0, n = window.innerHeight - e.bottom, r = e.top;
117
+ B.value = {
118
+ position: "fixed",
119
+ top: t > 0 && n < t && r > n ? `${e.top - t}px` : `${e.bottom}px`,
120
+ left: `${e.left}px`,
121
+ width: `${e.width}px`,
122
+ zIndex: "9999"
123
+ };
124
+ }
125
+ function J() {
126
+ if (j.disabled) return;
127
+ P.value = !0, q();
128
+ let e = j.options ?? [];
129
+ I.value = H.value.length > 0 ? Math.max(0, e.findIndex((e) => e.value === H.value[0])) : -1, m(() => {
130
+ q(), $();
131
+ });
132
+ }
133
+ function Y() {
134
+ P.value = !1, I.value = -1;
135
+ }
136
+ function X() {
137
+ P.value ? Y() : J();
138
+ }
139
+ function Z(e) {
140
+ let t = e.target, n = L.value?.contains(t) ?? !1, r = z.value?.contains(t) ?? !1;
141
+ !n && !r && Y();
142
+ }
143
+ function Q() {
144
+ P.value && q();
145
+ }
146
+ re(P, (e) => {
147
+ e ? (document.addEventListener("mousedown", Z), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q)) : (document.removeEventListener("mousedown", Z), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q));
148
+ }), ee(() => {
149
+ document.removeEventListener("mousedown", Z), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
150
+ });
151
+ function _e(e) {
152
+ let t = j.options ?? [];
153
+ if (!P.value) {
154
+ (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), J());
155
+ return;
156
+ }
157
+ e.key === "Escape" ? (Y(), e.preventDefault()) : e.key === "Tab" ? Y() : e.key === "ArrowDown" ? (e.preventDefault(), I.value = Math.min(I.value + 1, t.length - 1), $()) : e.key === "ArrowUp" ? (e.preventDefault(), I.value = Math.max(I.value - 1, 0), $()) : (e.key === "Enter" || e.key === " ") && I.value >= 0 && (e.preventDefault(), K(t[I.value]));
158
+ }
159
+ function $() {
160
+ m(() => {
161
+ !z.value || I.value < 0 || z.value.querySelectorAll(".nb-select__option")[I.value]?.scrollIntoView({ block: "nearest" });
162
+ });
163
+ }
164
+ let ve = o(() => [
165
+ "nb-select",
166
+ `nb-select--${j.variant}`,
167
+ `nb-select--${j.size}`,
168
+ {
169
+ "nb-select--open": P.value,
170
+ "nb-select--focused": F.value && !P.value,
171
+ "nb-select--error": !!j.error,
172
+ "nb-select--warning": !j.error && !!j.warning,
173
+ "nb-select--multiple": j.multiple
174
+ }
175
+ ]);
176
+ return k({
177
+ open: J,
178
+ close: Y
179
+ }), (o, m) => (_(), l(i, null, [u("div", {
180
+ ref_key: "rootRef",
181
+ ref: L,
182
+ class: h(ve.value),
183
+ onKeydown: _e
184
+ }, [p.variant === "default" ? (_(), l(i, { key: 0 }, [
185
+ o.$slots.label ? y(o.$slots, "label", { key: 0 }) : p.label ? (_(), s(t, {
186
+ key: 1,
187
+ for: V.value,
188
+ required: p.required,
189
+ disabled: p.disabled
190
+ }, {
191
+ default: C(() => [d(b(p.label), 1)]),
192
+ _: 1
193
+ }, 8, [
194
+ "for",
195
+ "required",
196
+ "disabled"
197
+ ])) : c("", !0),
198
+ u("button", {
199
+ id: V.value,
200
+ ref_key: "triggerRef",
201
+ ref: R,
202
+ type: "button",
203
+ class: "nb-select__trigger",
204
+ role: "combobox",
205
+ "aria-expanded": P.value,
206
+ "aria-haspopup": "listbox",
207
+ "aria-disabled": p.disabled || void 0,
208
+ "aria-required": p.required || void 0,
209
+ disabled: p.disabled || void 0,
210
+ onClick: X,
211
+ onFocus: m[0] ||= (e) => F.value = !0,
212
+ onBlur: m[1] ||= (e) => F.value = !1
213
+ }, [
214
+ u("span", { class: h(["nb-select__value", {
215
+ "nb-select__value--placeholder": !W.value,
216
+ "nb-select__value--with-icon": !!U.value
217
+ }]) }, [U.value ? (_(), s(e, {
218
+ key: 0,
219
+ class: "nb-select__value-icon",
220
+ name: U.value,
221
+ size: 16
222
+ }, null, 8, ["name"])) : c("", !0), W.value ? y(o.$slots, "value", {
223
+ key: 1,
224
+ values: H.value
225
+ }, () => [d(b(W.value), 1)]) : (_(), l(i, { key: 2 }, [d(b(p.placeholder), 1)], 64))], 2),
226
+ p.error ? (_(), s(n, {
227
+ key: 0,
228
+ variant: "error",
229
+ "icon-only": !0,
230
+ class: "nb-select__status-icon"
231
+ }, {
232
+ default: C(() => [d(b(p.error), 1)]),
233
+ _: 1
234
+ })) : p.warning ? (_(), s(n, {
235
+ key: 1,
236
+ variant: "warning",
237
+ "icon-only": !0,
238
+ class: "nb-select__status-icon"
239
+ }, {
240
+ default: C(() => [d(b(p.warning), 1)]),
241
+ _: 1
242
+ })) : c("", !0),
243
+ f(r, {
244
+ align: "center",
245
+ justify: "center",
246
+ class: "nb-select__caret"
247
+ }, {
248
+ default: C(() => [f(e, {
249
+ name: P.value ? x(E) : x(T),
250
+ size: 16
251
+ }, null, 8, ["name"])]),
252
+ _: 1
253
+ })
254
+ ], 40, oe),
255
+ p.error ? (_(), s(n, {
256
+ key: 2,
257
+ variant: "error",
258
+ class: "nb-select__message"
259
+ }, {
260
+ default: C(() => [d(b(p.error), 1)]),
261
+ _: 1
262
+ })) : p.warning ? (_(), s(n, {
263
+ key: 3,
264
+ variant: "warning",
265
+ class: "nb-select__message"
266
+ }, {
267
+ default: C(() => [d(b(p.warning), 1)]),
268
+ _: 1
269
+ })) : p.helper ? (_(), s(n, {
270
+ key: 4,
271
+ variant: "helper",
272
+ class: "nb-select__message"
273
+ }, {
274
+ default: C(() => [d(b(p.helper), 1)]),
275
+ _: 1
276
+ })) : c("", !0)
277
+ ], 64)) : p.variant === "fluid" ? (_(), l(i, { key: 1 }, [u("button", {
278
+ id: V.value,
279
+ ref_key: "triggerRef",
280
+ ref: R,
281
+ type: "button",
282
+ class: "nb-select__trigger",
283
+ role: "combobox",
284
+ "aria-expanded": P.value,
285
+ "aria-haspopup": "listbox",
286
+ "aria-disabled": p.disabled || void 0,
287
+ "aria-required": p.required || void 0,
288
+ disabled: p.disabled || void 0,
289
+ onClick: X,
290
+ onFocus: m[2] ||= (e) => F.value = !0,
291
+ onBlur: m[3] ||= (e) => F.value = !1
292
+ }, [p.label || o.$slots.label ? (_(), s(r, {
293
+ key: 0,
294
+ dir: "row",
295
+ align: "center",
296
+ gap: "xs",
297
+ class: "nb-select__inner-header"
298
+ }, {
299
+ default: C(() => [o.$slots.label ? y(o.$slots, "label", { key: 0 }) : (_(), l("label", ce, [d(b(p.label) + " ", 1), p.required ? (_(), l("span", le, "*")) : c("", !0)])), p.helper && !p.error && !p.warning ? (_(), s(n, {
300
+ key: 2,
301
+ variant: "helper",
302
+ "icon-only": !0,
303
+ class: "nb-select__inner-message"
304
+ }, {
305
+ default: C(() => [d(b(p.helper), 1)]),
306
+ _: 1
307
+ })) : c("", !0)]),
308
+ _: 3
309
+ })) : c("", !0), f(r, {
310
+ dir: "row",
311
+ align: "end",
312
+ flex: "",
313
+ class: "nb-select__value-row"
314
+ }, {
315
+ default: C(() => [u("span", { class: h(["nb-select__value", {
316
+ "nb-select__value--placeholder": !W.value,
317
+ "nb-select__value--with-icon": !!U.value
318
+ }]) }, [U.value ? (_(), s(e, {
319
+ key: 0,
320
+ class: "nb-select__value-icon",
321
+ name: U.value,
322
+ size: 16
323
+ }, null, 8, ["name"])) : c("", !0), W.value ? y(o.$slots, "value", {
324
+ key: 1,
325
+ values: H.value
326
+ }, () => [d(b(W.value), 1)]) : (_(), l(i, { key: 2 }, [d(b(p.placeholder), 1)], 64))], 2), f(r, {
327
+ align: "center",
328
+ justify: "center",
329
+ class: "nb-select__caret"
330
+ }, {
331
+ default: C(() => [f(e, {
332
+ name: P.value ? x(E) : x(T),
333
+ size: 16
334
+ }, null, 8, ["name"])]),
335
+ _: 1
336
+ })]),
337
+ _: 3
338
+ })], 40, se), p.error ? (_(), s(n, {
339
+ key: 0,
340
+ variant: "error",
341
+ class: "nb-select__fluid-message"
342
+ }, {
343
+ default: C(() => [d(b(p.error), 1)]),
344
+ _: 1
345
+ })) : p.warning ? (_(), s(n, {
346
+ key: 1,
347
+ variant: "warning",
348
+ class: "nb-select__fluid-message"
349
+ }, {
350
+ default: C(() => [d(b(p.warning), 1)]),
351
+ _: 1
352
+ })) : c("", !0)], 64)) : c("", !0)], 34), (_(), s(a, { to: "body" }, [P.value ? (_(), l("div", {
353
+ key: 0,
354
+ ref_key: "dropdownRef",
355
+ ref: z,
356
+ class: "nb-select__dropdown",
357
+ style: g(B.value),
358
+ role: "listbox",
359
+ "aria-multiselectable": p.multiple || void 0
360
+ }, [
361
+ (_(!0), l(i, null, te(p.options, (t, n) => (_(), l("div", {
362
+ key: t.value,
363
+ class: h(["nb-select__option", {
364
+ "nb-select__option--selected": G(t.value),
365
+ "nb-select__option--highlighted": I.value === n,
366
+ "nb-select__option--disabled": t.disabled
367
+ }]),
368
+ role: "option",
369
+ "aria-selected": G(t.value),
370
+ "aria-disabled": t.disabled || void 0,
371
+ onMouseenter: (e) => I.value = n,
372
+ onClick: (e) => K(t)
373
+ }, [
374
+ p.multiple ? (_(), l("span", fe, [G(t.value) ? (_(), l("svg", pe, [...m[7] ||= [u("path", {
375
+ d: "M1 4l3 3 5-6",
376
+ stroke: "currentColor",
377
+ "stroke-width": "1.5",
378
+ "stroke-linecap": "round",
379
+ "stroke-linejoin": "round"
380
+ }, null, -1)]])) : c("", !0)])) : c("", !0),
381
+ t.icon ? (_(), s(e, {
382
+ key: 1,
383
+ class: "nb-select__option-icon",
384
+ name: t.icon,
385
+ size: 16
386
+ }, null, 8, ["name"])) : c("", !0),
387
+ u("span", me, [y(o.$slots, "option", { option: t }, () => [d(b(t.label), 1)])])
388
+ ], 42, de))), 128)),
389
+ !p.options || p.options.length === 0 ? (_(), l("div", D, " No options ")) : c("", !0),
390
+ p.creatable ? (_(), l("div", {
391
+ key: 1,
392
+ class: "nb-select__create",
393
+ onMousedown: m[6] ||= w(() => {}, ["prevent"])
394
+ }, [ie(u("input", {
395
+ "onUpdate:modelValue": m[4] ||= (e) => N.value = e,
396
+ type: "text",
397
+ class: "nb-select__create-input",
398
+ placeholder: p.createPlaceholder || "Add new…",
399
+ onKeydown: [ae(w(he, ["prevent"]), ["enter"]), m[5] ||= w(() => {}, ["stop"])]
400
+ }, null, 40, O), [[ne, N.value]])], 32)) : c("", !0)
401
+ ], 12, ue)) : c("", !0)]))], 64));
402
+ }
403
+ });
404
+ //#endregion
405
+ export { k as t };
@@ -0,0 +1 @@
1
+ require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`);let t=require(`vue`),n=require(`@nubisco/ui/icons/caret-right`);var r=[`aria-expanded`,`aria-disabled`,`onKeydown`],i={class:`nb-menu-item__label`},a=(0,t.defineComponent)({__name:`Submenu`,props:{icon:{default:void 0},label:{},disabled:{type:Boolean,default:!1}},setup(a){let o=a,s=(0,t.ref)(null),c=(0,t.ref)(null),l=(0,t.ref)(!1),u=(0,t.inject)(`nb-menu`,null),d=null,f=null,p=(0,t.computed)(()=>`nb-menu--${u?.size??`md`}`),m=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:`var(--nb-zindex-menu)`});function h(){if(!s.value)return;let e=s.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)),m.value={position:`fixed`,top:`${n}px`,left:`${t}px`,zIndex:`var(--nb-zindex-menu)`}}function g(){o.disabled||(S(),l.value=!0,h(),(0,t.nextTick)(()=>{if(c.value&&s.value){let e=s.value.getBoundingClientRect(),t=c.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)),m.value={position:`fixed`,top:`${r}px`,left:`${n}px`,zIndex:`var(--nb-zindex-menu)`}}}))}function _(){if(S(),!l.value)return;let e=!!c.value?.contains(document.activeElement);l.value=!1,e&&s.value?.focus()}function v(){return c.value?Array.from(c.value.querySelectorAll(`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`)):[]}function y(e,t){let n=v();for(let r=e;r>=0&&r<n.length;r+=t)if(n[r].getAttribute(`aria-disabled`)!==`true`){n[r].focus();return}}function b(){o.disabled||(g(),(0,t.nextTick)(()=>y(0,1)))}function x(e){let t=v().indexOf(document.activeElement);e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),y(t+1,1)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),t>0&&y(t-1,-1)):e.key===`ArrowLeft`||e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),_()):e.key===`Tab`&&(_(),u?.close())}(0,t.watch)(c,(e,t)=>{t&&u?.unregisterSurface(t),e&&u?.registerSurface(e)});function S(){d&&=(clearTimeout(d),null),f&&=(clearTimeout(f),null)}function C(){S(),d=setTimeout(g,150)}function w(){S(),f=setTimeout(_,150)}function T(){S()}function E(){S(),f=setTimeout(_,150)}function D(){o.disabled||(l.value?_():g())}return(0,t.onBeforeUnmount)(()=>{S(),c.value&&u?.unregisterSurface(c.value)}),(o,u)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`li`,{ref_key:`triggerRef`,ref:s,class:(0,t.normalizeClass)([`nb-menu-item nb-submenu-trigger`,{"nb-menu-item--disabled":a.disabled,"nb-menu-item--highlighted":l.value}]),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":l.value,"aria-disabled":a.disabled||void 0,tabindex:-1,onMouseenter:C,onMouseleave:w,onKeydown:[(0,t.withKeys)((0,t.withModifiers)(b,[`prevent`]),[`right`]),(0,t.withKeys)((0,t.withModifiers)(b,[`prevent`]),[`enter`]),(0,t.withKeys)((0,t.withModifiers)(b,[`prevent`]),[`space`]),(0,t.withKeys)((0,t.withModifiers)(_,[`prevent`]),[`left`]),(0,t.withKeys)((0,t.withModifiers)(_,[`prevent`]),[`escape`])],onClick:D},[a.icon?((0,t.openBlock)(),(0,t.createBlock)(e.t,{key:0,name:a.icon,size:16,class:`nb-menu-item__icon`},null,8,[`name`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,i,(0,t.toDisplayString)(a.label),1),(0,t.createVNode)(e.t,{name:(0,t.unref)(n.regular),size:14,class:`nb-submenu-trigger__caret`},null,8,[`name`])],42,r),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[(0,t.createVNode)(t.Transition,{name:`nb-submenu`},{default:(0,t.withCtx)(()=>[l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`ul`,{key:0,ref_key:`submenuRef`,ref:c,role:`menu`,class:(0,t.normalizeClass)([`nb-menu nb-submenu`,[p.value]]),style:(0,t.normalizeStyle)(m.value),onMouseenter:T,onMouseleave:E,onKeydown:x},[(0,t.renderSlot)(o.$slots,`default`)],38)):(0,t.createCommentVNode)(``,!0)]),_:3})]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
@@ -0,0 +1,148 @@
1
+ import { t as e } from "./Icon-rREAqsu0.js";
2
+ import { Fragment as t, Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, inject as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, openBlock as g, ref as _, renderSlot as v, toDisplayString as y, unref as b, watch as x, withCtx as S, withKeys as C, withModifiers as w } from "vue";
3
+ import { regular as T } from "@nubisco/ui/icons/caret-right";
4
+ //#region src/components/Submenu.vue?vue&type=script&setup=true&lang.ts
5
+ var E = [
6
+ "aria-expanded",
7
+ "aria-disabled",
8
+ "onKeydown"
9
+ ], D = { class: "nb-menu-item__label" }, O = /* @__PURE__ */ u({
10
+ __name: "Submenu",
11
+ props: {
12
+ icon: { default: void 0 },
13
+ label: {},
14
+ disabled: {
15
+ type: Boolean,
16
+ default: !1
17
+ }
18
+ },
19
+ setup(u) {
20
+ let O = u, k = _(null), A = _(null), j = _(!1), M = d("nb-menu", null), N = null, P = null, F = i(() => `nb-menu--${M?.size ?? "md"}`), I = _({
21
+ position: "fixed",
22
+ top: "0px",
23
+ left: "0px",
24
+ zIndex: "var(--nb-zindex-menu)"
25
+ });
26
+ function L() {
27
+ if (!k.value) return;
28
+ let e = k.value.getBoundingClientRect(), t = e.right, n = e.top;
29
+ t + 200 > window.innerWidth && (t = e.left - 200), n + 200 > window.innerHeight && (n = Math.max(8, window.innerHeight - 200)), I.value = {
30
+ position: "fixed",
31
+ top: `${n}px`,
32
+ left: `${t}px`,
33
+ zIndex: "var(--nb-zindex-menu)"
34
+ };
35
+ }
36
+ function R() {
37
+ O.disabled || (W(), j.value = !0, L(), f(() => {
38
+ if (A.value && k.value) {
39
+ let e = k.value.getBoundingClientRect(), t = A.value.getBoundingClientRect(), n = e.right;
40
+ n + t.width > window.innerWidth && (n = e.left - t.width);
41
+ let r = e.top;
42
+ r + t.height > window.innerHeight && (r = Math.max(8, window.innerHeight - t.height)), I.value = {
43
+ position: "fixed",
44
+ top: `${r}px`,
45
+ left: `${n}px`,
46
+ zIndex: "var(--nb-zindex-menu)"
47
+ };
48
+ }
49
+ }));
50
+ }
51
+ function z() {
52
+ if (W(), !j.value) return;
53
+ let e = !!A.value?.contains(document.activeElement);
54
+ j.value = !1, e && k.value?.focus();
55
+ }
56
+ function B() {
57
+ return A.value ? Array.from(A.value.querySelectorAll("[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]")) : [];
58
+ }
59
+ function V(e, t) {
60
+ let n = B();
61
+ for (let r = e; r >= 0 && r < n.length; r += t) if (n[r].getAttribute("aria-disabled") !== "true") {
62
+ n[r].focus();
63
+ return;
64
+ }
65
+ }
66
+ function H() {
67
+ O.disabled || (R(), f(() => V(0, 1)));
68
+ }
69
+ function U(e) {
70
+ let t = B().indexOf(document.activeElement);
71
+ e.key === "ArrowDown" ? (e.preventDefault(), e.stopPropagation(), V(t + 1, 1)) : e.key === "ArrowUp" ? (e.preventDefault(), e.stopPropagation(), t > 0 && V(t - 1, -1)) : e.key === "ArrowLeft" || e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), z()) : e.key === "Tab" && (z(), M?.close());
72
+ }
73
+ x(A, (e, t) => {
74
+ t && M?.unregisterSurface(t), e && M?.registerSurface(e);
75
+ });
76
+ function W() {
77
+ N &&= (clearTimeout(N), null), P &&= (clearTimeout(P), null);
78
+ }
79
+ function G() {
80
+ W(), N = setTimeout(R, 150);
81
+ }
82
+ function K() {
83
+ W(), P = setTimeout(z, 150);
84
+ }
85
+ function q() {
86
+ W();
87
+ }
88
+ function J() {
89
+ W(), P = setTimeout(z, 150);
90
+ }
91
+ function Y() {
92
+ O.disabled || (j.value ? z() : R());
93
+ }
94
+ return h(() => {
95
+ W(), A.value && M?.unregisterSurface(A.value);
96
+ }), (i, d) => (g(), s(t, null, [c("li", {
97
+ ref_key: "triggerRef",
98
+ ref: k,
99
+ class: p(["nb-menu-item nb-submenu-trigger", {
100
+ "nb-menu-item--disabled": u.disabled,
101
+ "nb-menu-item--highlighted": j.value
102
+ }]),
103
+ role: "menuitem",
104
+ "aria-haspopup": "menu",
105
+ "aria-expanded": j.value,
106
+ "aria-disabled": u.disabled || void 0,
107
+ tabindex: -1,
108
+ onMouseenter: G,
109
+ onMouseleave: K,
110
+ onKeydown: [
111
+ C(w(H, ["prevent"]), ["right"]),
112
+ C(w(H, ["prevent"]), ["enter"]),
113
+ C(w(H, ["prevent"]), ["space"]),
114
+ C(w(z, ["prevent"]), ["left"]),
115
+ C(w(z, ["prevent"]), ["escape"])
116
+ ],
117
+ onClick: Y
118
+ }, [
119
+ u.icon ? (g(), a(e, {
120
+ key: 0,
121
+ name: u.icon,
122
+ size: 16,
123
+ class: "nb-menu-item__icon"
124
+ }, null, 8, ["name"])) : o("", !0),
125
+ c("span", D, y(u.label), 1),
126
+ l(e, {
127
+ name: b(T),
128
+ size: 14,
129
+ class: "nb-submenu-trigger__caret"
130
+ }, null, 8, ["name"])
131
+ ], 42, E), (g(), a(n, { to: "body" }, [l(r, { name: "nb-submenu" }, {
132
+ default: S(() => [j.value ? (g(), s("ul", {
133
+ key: 0,
134
+ ref_key: "submenuRef",
135
+ ref: A,
136
+ role: "menu",
137
+ class: p(["nb-menu nb-submenu", [F.value]]),
138
+ style: m(I.value),
139
+ onMouseenter: q,
140
+ onMouseleave: J,
141
+ onKeydown: U
142
+ }, [v(i.$slots, "default")], 38)) : o("", !0)]),
143
+ _: 3
144
+ })]))], 64));
145
+ }
146
+ });
147
+ //#endregion
148
+ export { O as t };
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./composables/useReducedMotion.composable.cjs`),n=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),r=require(`./composables/useStableId.composable.cjs`),i=require(`./composables/useSurfaceLayer.composable.cjs`),a=require(`./Button-D-XSNjSL.cjs`);let o=require(`vue`),s=require(`@nubisco/ui/icons/caret-right`);s=e.n(s);let c=require(`@nubisco/ui/icons/list-dashes`);c=e.n(c);var l=[`href`,`aria-current`,`data-id`,`onClick`],u=(0,o.defineComponent)({name:`TableOfContentsList`,__name:`TableOfContentsList`,props:{nodes:{},active:{},nested:{type:Boolean}},emits:[`go`],setup(e,{emit:t}){let n=t;function r(e,t){e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button===0&&(e.preventDefault(),n(`go`,t))}return(t,i)=>{let a=(0,o.resolveComponent)(`TableOfContentsList`,!0);return(0,o.openBlock)(),(0,o.createElementBlock)(`ol`,{class:(0,o.normalizeClass)([`nb-toc-list`,{"nb-toc-list--nested":e.nested}])},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.nodes,t=>((0,o.openBlock)(),(0,o.createElementBlock)(`li`,{key:t.id,class:`nb-toc-list__item`},[(0,o.createElementVNode)(`a`,{class:(0,o.normalizeClass)([`nb-toc-list__link`,{"nb-toc-list__link--active":t.id===e.active}]),href:`#${t.id}`,"aria-current":t.id===e.active?`location`:void 0,"data-id":t.id,onClick:e=>r(e,t)},(0,o.toDisplayString)(t.label),11,l),t.children.length>0?((0,o.openBlock)(),(0,o.createBlock)(a,{key:0,nodes:t.children,active:e.active,nested:``,onGo:i[0]||=e=>n(`go`,e)},null,8,[`nodes`,`active`])):(0,o.createCommentVNode)(``,!0)]))),128))],2)}}}),d=n.t(u,[[`__scopeId`,`data-v-d0f98dc3`]]),f=[`aria-label`],p={class:`nb-toc__head`},m={class:`nb-toc__title`},h=(0,o.defineComponent)({__name:`TableOfContents`,props:{items:{},active:{default:void 0},open:{type:Boolean,default:void 0},variant:{default:`docked`},collapsible:{type:Boolean,default:!0},title:{default:`Contents`},label:{default:`Table of contents`},showLabel:{default:`Show contents`},hideLabel:{default:`Hide contents`},root:{default:null},resolveTarget:{type:Function,default:void 0},spy:{type:Boolean,default:!0},offset:{default:96},updateHash:{type:Boolean,default:!0},followHash:{type:Boolean,default:!1}},emits:[`update:active`,`update:open`,`navigate`],setup(e,{expose:n,emit:l}){let u=e,h=l,g=`${r.useStableId({})}-nav`,_=(0,o.ref)(null),v=(0,o.ref)(null),{layerProps:y}=i.useSurfaceLayer({overlay:!0}),b=(0,o.computed)(()=>u.variant===`floating`?y.value:{}),x=(0,o.ref)(u.variant!==`floating`),S=(0,o.computed)(()=>u.open??x.value),C=(0,o.computed)(()=>u.variant===`floating`||u.collapsible);function w(e){!e&&!C.value||(x.value=e,h(`update:open`,e),e||(0,o.nextTick)(()=>T()))}function T(){(v.value?.$el)?.focus()}function E(e){u.variant!==`floating`||!S.value||(e.stopPropagation(),w(!1))}(0,o.watch)(()=>u.variant,e=>{x.value=e!==`floating`});let D=(0,o.computed)(()=>{let e=[],t=[];for(let n of u.items){let r={...n,children:[]};for(;t.length>0&&t[t.length-1].level>=n.level;)t.pop();t.length===0?e.push(r):t[t.length-1].children.push(r),t.push(r)}return e}),O=(0,o.ref)(null),k=(0,o.computed)(()=>u.active===void 0?O.value:u.active);function A(e){e!==k.value&&(O.value=e,h(`update:active`,e))}function j(e,t){return u.resolveTarget?u.resolveTarget(e,t):u.root?u.root.querySelector(`[id="${e.id.replace(/(["\\])/g,`\\$1`)}"]`):typeof document>`u`?null:document.getElementById(e.id)}function M(e){let t=e?.parentElement??null;for(;t;){let{overflowY:e}=getComputedStyle(t);if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return window}function N(e,t,n,r){if(n){for(let t=e.length-1;t>=0;t--)if(e[t]<r)return t}let i=-1;for(let n=0;n<e.length&&e[n]<=t;n++)i=n;return i}let P=null,F=null,I=0;function L(){if(F=null,!u.spy||typeof window>`u`||Date.now()<I)return;let e=u.items.map((e,t)=>({item:e,el:j(e,t)})).filter(e=>!!e.el);if(e.length===0){A(null);return}let t=P??window,n=0,r=window.innerHeight,i=window.scrollY,a=document.documentElement.scrollHeight;if(t!==window){let e=t;n=e.getBoundingClientRect().top,r=e.clientHeight,i=e.scrollTop,a=e.scrollHeight}let o=a>r&&i+r>=a-2,s=N(e.map(({el:e})=>e.getBoundingClientRect().top-n),u.offset,o,r);A(s>=0?e[s].item.id:null)}function R(){F===null&&(F=typeof requestAnimationFrame==`function`?requestAnimationFrame(L):setTimeout(L,16))}function z(){B(),!(!u.spy||typeof window>`u`)&&(P=M(u.items.map((e,t)=>j(e,t)).find(Boolean)??u.root??_.value),P.addEventListener(`scroll`,R,{passive:!0}),window.addEventListener(`resize`,R,{passive:!0}),R())}function B(){P?.removeEventListener(`scroll`,R),typeof window<`u`&&window.removeEventListener(`resize`,R),P=null}function V(e,n={}){let r=typeof e==`string`?e:e.id,i=u.items.findIndex(e=>e.id===r);if(i<0)return;let a=u.items[i],o=j(a,i);if(!o)return;let s=n.instant||t.prefersReducedMotion();if(o.scrollIntoView?.({behavior:s?`auto`:`smooth`,block:`start`}),A(r),I=s?0:Date.now()+700,u.updateHash)try{let{pathname:e,search:t}=window.location;window.history.replaceState(window.history.state,``,`${e}${t}#${r}`)}catch{}o.closest(`[contenteditable="true"]`)||(o.hasAttribute(`tabindex`)||o.setAttribute(`tabindex`,`-1`),o.focus({preventScroll:!0})),u.variant===`floating`&&(x.value=!1,h(`update:open`,!1)),h(`navigate`,a)}let H=!1;function U(){if(!u.followHash||H||typeof window>`u`)return;let e=decodeURIComponent(window.location.hash.slice(1));if(!e){H=!0;return}let t=u.items.findIndex(t=>t.id===e);t<0||!j(u.items[t],t)||(H=!0,V(e,{instant:!0}))}return(0,o.watch)(()=>u.items,()=>void(0,o.nextTick)(()=>{z(),U()}),{flush:`post`,deep:!0}),(0,o.watch)(()=>[u.root,u.spy],()=>void(0,o.nextTick)(z),{flush:`post`}),(0,o.onMounted)(()=>{z(),(0,o.nextTick)(U)}),(0,o.onBeforeUnmount)(()=>{B(),F!==null&&(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(F),clearTimeout(F))}),n({go:V,measure:L}),(t,n)=>((0,o.openBlock)(),(0,o.createElementBlock)(`div`,{ref_key:`rootEl`,ref:_,class:(0,o.normalizeClass)([`nb-toc`,`nb-toc--${e.variant}`,{"nb-toc--open":S.value}]),onKeydown:(0,o.withKeys)(E,[`esc`])},[S.value?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,(0,o.mergeProps)({key:1,class:`nb-toc__body`},b.value),[(0,o.createElementVNode)(`nav`,{id:g,class:`nb-toc__nav`,"aria-label":e.label},[(0,o.createElementVNode)(`div`,p,[(0,o.createElementVNode)(`span`,m,(0,o.toDisplayString)(e.title),1),C.value?((0,o.openBlock)(),(0,o.createBlock)(a.t,{key:0,size:`xs`,variant:`ghost`,icon:s,"aria-label":e.hideLabel,title:e.hideLabel,"aria-expanded":!0,"aria-controls":g,onClick:n[1]||=e=>w(!1)},null,8,[`aria-label`,`title`])):(0,o.createCommentVNode)(``,!0)]),(0,o.createVNode)(d,{nodes:D.value,active:k.value,onGo:V},null,8,[`nodes`,`active`])],8,f)],16)):((0,o.openBlock)(),(0,o.createBlock)(a.t,{key:0,ref_key:`showButton`,ref:v,size:`sm`,variant:`ghost`,icon:c,class:`nb-toc__show`,"aria-label":e.showLabel,title:e.showLabel,"aria-expanded":!1,"aria-controls":g,onClick:n[0]||=e=>w(!0)},null,8,[`aria-label`,`title`]))],34))}}),g=n.t(h,[[`__scopeId`,`data-v-cb6a1ca7`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return g}});