@cypress-design/vue-docmenu 0.4.1 → 0.5.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.es.mjs CHANGED
@@ -1,10 +1,12 @@
1
- import { defineComponent as y, ref as c, computed as B, watch as M, nextTick as G, openBlock as p, createElementBlock as d, Fragment as $, createBlock as b, resolveDynamicComponent as w, normalizeClass as k, unref as g, withCtx as S, createCommentVNode as A, createTextVNode as D, toDisplayString as T, withDirectives as U, createVNode as C, vShow as x, onMounted as H, normalizeStyle as z, renderList as R } from "vue";
2
- import { IconChevronDownSmall as F } from "@cypress-design/vue-icon";
3
- const P = {
4
- button: "flex leading-[24px] py-[10px] items-center relative w-full",
1
+ import { defineComponent as C, ref as u, computed as P, inject as I, watch as M, openBlock as p, createElementBlock as f, Fragment as B, createBlock as $, resolveDynamicComponent as L, normalizeClass as k, unref as g, withCtx as S, createCommentVNode as A, createTextVNode as D, toDisplayString as G, createElementVNode as z, createVNode as w, onMounted as H, normalizeStyle as T, renderList as N, provide as V } from "vue";
2
+ import { IconChevronDownSmall as j } from "@cypress-design/vue-icon";
3
+ const b = {
4
+ expandedIcon: "absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700",
5
+ button: "flex leading-[24px] py-[10px] items-center relative w-full text-start",
5
6
  topButton: "leading-[24px] text-[16px] pl-[24px] font-medium",
6
- leafButton: "leading-[20px] text-[14px] pl-[40px]"
7
- }, I = /* @__PURE__ */ y({
7
+ leafButton: "leading-[20px] text-[14px] pl-[48px]",
8
+ openListBorderLeft: "absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"
9
+ }, F = /* @__PURE__ */ C({
8
10
  __name: "_DocGroup",
9
11
  props: {
10
12
  group: {},
@@ -13,72 +15,103 @@ const P = {
13
15
  linkComponent: {},
14
16
  depth: { default: 0 }
15
17
  },
16
- emits: ["updateActivePosition", "hideMarker", "updateMarkerPosition"],
17
- setup(f, { expose: v, emit: m }) {
18
- const i = f, n = c(i.group.collapsed !== !0), u = c(), l = B(
19
- () => i.collapsible ? "button" : i.group.href ? "a" : "div"
20
- ), e = m;
21
- function s(t = i.group.items) {
22
- return t.some((a) => "items" in a ? s(a.items) : a.href === i.activePath);
23
- }
24
- function o() {
18
+ emits: ["updateActivePosition", "updateMarkerPosition", "hideMarker"],
19
+ setup(h, { expose: v, emit: d }) {
20
+ const n = h, i = u(n.group.collapsed !== !0), m = u(), c = u(), r = P(
21
+ () => n.collapsible ? "button" : n.group.href ? "a" : "div"
22
+ ), e = d, o = P(
23
+ () => n.group.items.some((t) => "items" in t ? x(t.items, n.activePath) : t.href === n.activePath)
24
+ );
25
+ function a() {
25
26
  var t;
26
- (t = u.value) == null || t.reTriggerSetActiveGroup();
27
+ (t = m.value) == null || t.reTriggerSetActiveGroup();
27
28
  }
28
- const r = B(() => i.group.href === i.activePath);
29
- return M(r, (t) => {
29
+ const l = P(() => n.group.href === n.activePath), y = I("transition-is-moving", u(!1));
30
+ return M(i, () => {
31
+ var t, s;
32
+ (t = c.value) == null || t.addEventListener(
33
+ "transitionstart",
34
+ () => {
35
+ y.value = !0;
36
+ },
37
+ { once: !0 }
38
+ ), (s = c.value) == null || s.addEventListener(
39
+ "transitionend",
40
+ () => {
41
+ y.value = !1, (i.value || !o.value) && e("updateMarkerPosition");
42
+ },
43
+ { once: !0 }
44
+ );
45
+ }), M(l, (t) => {
30
46
  t && e("hideMarker");
31
- }), M(n, async (t) => {
32
- await G(), s() ? t ? o() : e("hideMarker") : e("updateMarkerPosition");
47
+ }), M(i, (t) => {
48
+ o.value ? t ? a() : e("hideMarker") : e("updateMarkerPosition");
33
49
  }), v({
34
- reTriggerSetActiveGroup: o
35
- }), (t, a) => (p(), d($, null, [
36
- (p(), b(w(l.value), {
50
+ reTriggerSetActiveGroup: a
51
+ }), (t, s) => (p(), f(B, null, [
52
+ (p(), $(L(r.value), {
37
53
  class: k([
38
- g(P).button,
54
+ g(b).button,
39
55
  {
40
- [g(P).topButton]: t.depth === 0,
41
- [g(P).leafButton]: t.depth,
42
- "text-indigo-500": r.value
56
+ [g(b).topButton]: t.depth === 0,
57
+ [g(b).leafButton]: t.depth,
58
+ "text-indigo-500": l.value,
59
+ "text-gray-900 dark:text-gray-200": !o.value && !l.value && t.depth === 0,
60
+ "text-gray-700 dark:text-gray-500": !o.value && !l.value && t.depth >= 0
43
61
  }
44
62
  ]),
45
63
  href: t.group.href,
46
- onClick: a[0] || (a[0] = () => {
47
- t.collapsible ? n.value = !n.value : e("updateActivePosition");
64
+ onClick: s[0] || (s[0] = () => {
65
+ t.collapsible ? i.value = !i.value : e("updateActivePosition");
48
66
  })
49
67
  }, {
50
68
  default: S(() => [
51
- i.collapsible ? (p(), b(g(F), {
69
+ n.collapsible ? (p(), $(g(j), {
52
70
  key: 0,
53
- "stroke-color": "gray-400",
71
+ "stroke-color": "current",
54
72
  size: t.depth ? "8" : "16",
55
- class: k(["absolute left-0 transform transition-transform", {
56
- "rotate-0": n.value,
57
- "-rotate-90": !n.value,
58
- "ml-[16px]": t.depth
59
- }])
73
+ class: k([
74
+ g(b).expandedIcon,
75
+ {
76
+ "rotate-0": i.value,
77
+ "-rotate-90": !i.value,
78
+ "ml-[28px]": t.depth
79
+ }
80
+ ])
60
81
  }, null, 8, ["size", "class"])) : A("", !0),
61
- D(" " + T(t.group.label), 1)
82
+ D(" " + G(t.group.label), 1)
62
83
  ]),
63
84
  _: 1
64
85
  }, 8, ["class", "href"])),
65
- U(C(E, {
66
- ref_key: "$groupElements",
67
- ref: u,
68
- depth: t.depth,
69
- items: t.group.items,
70
- "active-path": t.activePath,
71
- collapsible: t.collapsible,
72
- "link-component": t.linkComponent,
73
- onHideMarker: a[1] || (a[1] = (h) => e("hideMarker")),
74
- onUpdateMarkerPosition: a[2] || (a[2] = (h) => e("updateMarkerPosition")),
75
- onUpdateActivePosition: a[3] || (a[3] = (h) => e("updateActivePosition", h))
76
- }, null, 8, ["depth", "items", "active-path", "collapsible", "link-component"]), [
77
- [x, n.value]
78
- ])
86
+ z("div", {
87
+ class: k(["grid transition-all relative", {
88
+ "grid-rows-[0fr]": !i.value && t.collapsible,
89
+ "grid-rows-[1fr]": i.value || !t.collapsible
90
+ }]),
91
+ ref_key: "$listWrapper",
92
+ ref: c
93
+ }, [
94
+ i.value && t.collapsible && t.depth === 0 ? (p(), f("div", {
95
+ key: 0,
96
+ class: k(g(b).openListBorderLeft)
97
+ }, null, 2)) : A("", !0),
98
+ w(U, {
99
+ ref_key: "$groupElements",
100
+ ref: m,
101
+ class: "overflow-hidden",
102
+ depth: t.depth,
103
+ items: t.group.items,
104
+ "active-path": t.activePath,
105
+ collapsible: t.collapsible,
106
+ "link-component": t.linkComponent,
107
+ onHideMarker: s[1] || (s[1] = (E) => e("hideMarker")),
108
+ onUpdateMarkerPosition: s[2] || (s[2] = () => e("updateMarkerPosition")),
109
+ onUpdateActivePosition: s[3] || (s[3] = (E) => i.value ? e("updateActivePosition", E) : null)
110
+ }, null, 8, ["depth", "items", "active-path", "collapsible", "link-component"])
111
+ ], 2)
79
112
  ], 64));
80
113
  }
81
- }), N = /* @__PURE__ */ y({
114
+ }), R = /* @__PURE__ */ C({
82
115
  __name: "_DocLink",
83
116
  props: {
84
117
  item: {},
@@ -88,63 +121,68 @@ const P = {
88
121
  linkComponent: {}
89
122
  },
90
123
  emits: ["update:active"],
91
- setup(f, { expose: v, emit: m }) {
92
- const i = f, n = m, u = c();
93
- function l() {
124
+ setup(h, { expose: v, emit: d }) {
125
+ const n = h, i = d, m = u(), c = I("transition-is-moving", u(!1));
126
+ function r() {
94
127
  var e;
95
- if (i.active) {
96
- const { top: s = 0, height: o = 36 } = ((e = u.value) == null ? void 0 : e.getBoundingClientRect()) ?? {};
97
- n("update:active", i.active, {
98
- top: s,
99
- height: o
128
+ if (n.active) {
129
+ const { top: o = 0, height: a = 36 } = ((e = m.value) == null ? void 0 : e.getBoundingClientRect()) ?? {};
130
+ i("update:active", n.active, {
131
+ top: o,
132
+ height: a
100
133
  });
101
134
  }
102
135
  }
103
136
  return H(() => {
104
137
  M(
105
- () => i.active,
138
+ () => n.active,
106
139
  (e) => {
107
- e ? l() : n("update:active", e);
140
+ e ? r() : i("update:active", e);
108
141
  },
109
142
  { immediate: !0 }
110
143
  );
111
144
  }), v({
112
- setActiveMarkerPosition: l
113
- }), (e, s) => (p(), d("li", {
145
+ setActiveMarkerPosition: r
146
+ }), (e, o) => (p(), f("li", {
114
147
  ref_key: "$container",
115
- ref: u,
116
- class: k(["list-none p-0", {
117
- "pl-[16px]": e.depth >= 0
118
- }])
148
+ ref: m,
149
+ class: "list-none p-0"
119
150
  }, [
120
- (p(), b(w(e.linkComponent), {
151
+ (p(), $(L(e.linkComponent), {
121
152
  class: k(["group relative block w-full pl-[24px]", {
122
153
  "text-indigo-500": e.active,
154
+ "text-gray-700 dark:text-gray-500": !e.active,
123
155
  "py-[8px] text-[16px] leading-[24px]": e.depth < 0,
124
156
  "leading-[20px] text-[14px] py-[12px]": e.depth >= 0
125
157
  }]),
158
+ style: T({
159
+ paddingLeft: e.depth >= 0 ? `${e.depth * 12 + 48}px` : void 0
160
+ }),
126
161
  href: e.item.href
127
162
  }, {
128
163
  default: S(() => [
129
- e.depth >= 0 ? (p(), d("div", {
164
+ e.depth >= 0 ? (p(), f("div", {
130
165
  key: 0,
131
- class: k(["absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden", {
132
- "group-hover:block bg-gray-300": !e.active && e.collapsible
133
- }]),
134
- style: z({
135
- left: `-${18.5 + e.depth * 7.5}px`
136
- })
137
- }, null, 6)) : A("", !0),
138
- D(" " + T(e.item.label), 1)
166
+ class: k(["left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full", {
167
+ hidden: !g(c) || !e.active,
168
+ "group-hover:block bg-gray-300": !e.active && e.collapsible,
169
+ "bg-indigo-500": e.active && g(c)
170
+ }])
171
+ }, null, 2)) : A("", !0),
172
+ D(" " + G(e.item.label), 1)
139
173
  ]),
140
174
  _: 1
141
- }, 8, ["class", "href"]))
142
- ], 2));
175
+ }, 8, ["class", "style", "href"]))
176
+ ], 512));
143
177
  }
144
- }), V = {
178
+ }), O = { class: "list-none p-0" }, W = {
145
179
  key: 0,
146
180
  class: "relative list-none p-0"
147
- }, E = /* @__PURE__ */ y({
181
+ };
182
+ function x(h, v) {
183
+ return h.some((d) => "items" in d ? x(d.items, v) : d.href === v);
184
+ }
185
+ const U = /* @__PURE__ */ C({
148
186
  __name: "_DocGroupElements",
149
187
  props: {
150
188
  items: {},
@@ -153,63 +191,64 @@ const P = {
153
191
  linkComponent: { type: [Object, Function, String] },
154
192
  depth: {}
155
193
  },
156
- emits: ["updateActivePosition", "hideMarker", "updateMarkerPosition"],
157
- setup(f, { expose: v, emit: m }) {
158
- const i = f, n = m, u = c([]), l = c([]);
159
- function e(o = i.items) {
160
- return o.some((r) => "items" in r ? e(r.items) : r.href === i.activePath);
161
- }
162
- function s() {
163
- u.value.forEach((o) => {
164
- o.setActiveMarkerPosition();
165
- }), l.value.forEach((o) => {
166
- o.reTriggerSetActiveGroup();
194
+ emits: ["updateActivePosition", "updateMarkerPosition", "hideMarker"],
195
+ setup(h, { expose: v, emit: d }) {
196
+ const n = h, i = d, m = u([]), c = u([]), r = P(
197
+ () => n.items.some((o) => "items" in o ? x(o.items, n.activePath) : o.href === n.activePath)
198
+ );
199
+ function e(o = -1) {
200
+ m.value.forEach((l) => {
201
+ l.setActiveMarkerPosition();
202
+ });
203
+ const a = o - // remove all the items that are not groups from the array and count them
204
+ n.items.slice(0, o).filter((l) => !("items" in l)).length;
205
+ c.value.slice(a + 1).forEach((l) => {
206
+ l.reTriggerSetActiveGroup();
167
207
  });
168
208
  }
169
209
  return v({
170
- reTriggerSetActiveGroup: s
171
- }), (o, r) => (p(), d("ul", {
172
- class: k(["list-none p-0", {
173
- "border-l border-gray-100": o.depth === 0 && o.collapsible,
174
- "ml-[8px]": o.depth >= 0
175
- }])
176
- }, [
177
- (p(!0), d($, null, R(o.items, (t) => (p(), d($, null, [
178
- t && "items" in t ? (p(), d("li", V, [
179
- C(I, {
210
+ reTriggerSetActiveGroup: e
211
+ }), (o, a) => (p(), f("ul", O, [
212
+ (p(!0), f(B, null, N(o.items, (l, y) => (p(), f(B, null, [
213
+ l && "items" in l ? (p(), f("li", W, [
214
+ w(F, {
180
215
  ref_for: !0,
181
216
  ref_key: "$groups",
182
- ref: l,
217
+ ref: c,
183
218
  "active-path": o.activePath,
184
- group: t,
219
+ group: l,
185
220
  depth: o.depth + 1,
186
221
  collapsible: o.collapsible,
187
222
  "link-component": o.linkComponent,
188
- onUpdateActivePosition: r[0] || (r[0] = (a) => {
189
- n("updateActivePosition", a);
223
+ onUpdateActivePosition: a[0] || (a[0] = (t) => {
224
+ i("updateActivePosition", t);
190
225
  }),
191
- onUpdateMarkerPosition: r[1] || (r[1] = () => {
192
- e() ? s() : n("updateMarkerPosition");
193
- })
194
- }, null, 8, ["active-path", "group", "depth", "collapsible", "link-component"])
195
- ])) : (p(), b(N, {
226
+ onUpdateMarkerPosition: () => {
227
+ r.value ? e(y) : i("updateMarkerPosition");
228
+ },
229
+ onHideMarker: a[1] || (a[1] = (t) => i("hideMarker"))
230
+ }, null, 8, ["active-path", "group", "depth", "collapsible", "link-component", "onUpdateMarkerPosition"])
231
+ ])) : (p(), $(R, {
196
232
  key: 1,
197
233
  ref_for: !0,
198
234
  ref_key: "$items",
199
- ref: u,
200
- item: t,
201
- active: t.href === o.activePath,
235
+ ref: m,
236
+ item: l,
237
+ active: l.href === o.activePath,
202
238
  depth: o.depth,
203
239
  collapsible: o.collapsible,
204
240
  "link-component": o.linkComponent,
205
- "onUpdate:active": r[2] || (r[2] = (a, h) => {
206
- h && n("updateActivePosition", h);
241
+ "onUpdate:active": a[2] || (a[2] = (t, s) => {
242
+ if (s)
243
+ o.depth < 0 ? i("hideMarker") : i("updateActivePosition", s);
244
+ else
245
+ return;
207
246
  })
208
247
  }, null, 8, ["item", "active", "depth", "collapsible", "link-component"]))
209
248
  ], 64))), 256))
210
- ], 2));
249
+ ]));
211
250
  }
212
- }), O = /* @__PURE__ */ y({
251
+ }), K = /* @__PURE__ */ C({
213
252
  __name: "DocMenu",
214
253
  props: {
215
254
  items: {},
@@ -217,42 +256,43 @@ const P = {
217
256
  collapsible: { type: Boolean, default: !0 },
218
257
  linkComponent: { type: [Object, Function, String], default: "a" }
219
258
  },
220
- setup(f) {
221
- const v = c(), m = c(0), i = c(36), n = c(!1);
222
- function u({ top: l, height: e } = { height: 0, top: 0 }) {
223
- var o;
224
- const s = ((o = v.value) == null ? void 0 : o.getBoundingClientRect().top) || 0;
225
- m.value = l - s, i.value = e, n.value = !0;
259
+ setup(h) {
260
+ const v = u(), d = u(0), n = u(36), i = u(!1);
261
+ function m({ top: r, height: e } = { height: 0, top: 0 }) {
262
+ var a;
263
+ const o = ((a = v.value) == null ? void 0 : a.getBoundingClientRect().top) || 0;
264
+ d.value = r - o, n.value = e, i.value = !0;
226
265
  }
227
- return (l, e) => (p(), d("div", {
266
+ const c = u(!1);
267
+ return V("transition-is-moving", c), (r, e) => (p(), f("div", {
228
268
  ref_key: "$container",
229
269
  ref: v,
230
270
  class: "relative"
231
271
  }, [
232
- n.value && l.collapsible ? (p(), d("div", {
272
+ i.value && r.collapsible && !c.value ? (p(), f("div", {
233
273
  key: 0,
234
274
  "data-cy": "doc-menu-active-marker",
235
275
  class: "absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]",
236
- style: z({
237
- top: `${m.value + 4}px`,
238
- height: `${i.value - 8}px`
276
+ style: T({
277
+ top: `${d.value}px`,
278
+ height: `${n.value - 8}px`
239
279
  })
240
280
  }, null, 4)) : A("", !0),
241
- C(E, {
242
- items: l.items,
243
- "active-path": l.activePath,
244
- collapsible: l.collapsible,
245
- "link-component": l.linkComponent,
281
+ w(U, {
282
+ items: r.items,
283
+ "active-path": r.activePath,
284
+ collapsible: r.collapsible,
285
+ "link-component": r.linkComponent,
246
286
  depth: -1,
247
- onUpdateActivePosition: u,
248
- onHideMarker: e[0] || (e[0] = (s) => n.value = !1)
287
+ onUpdateActivePosition: m,
288
+ onHideMarker: e[0] || (e[0] = (o) => i.value = !1)
249
289
  }, null, 8, ["items", "active-path", "collapsible", "link-component"])
250
290
  ], 512));
251
291
  }
252
292
  });
253
293
  export {
254
- O as default
294
+ K as default
255
295
  };
256
296
  //# sourceMappingURL=index.es.mjs.map
257
297
 
258
- /* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px] list-none p-0 border-l border-gray-100 ml-[8px] text-indigo-500 left-0 transform transition-transform rotate-0 -rotate-90 ml-[16px] icon-dark-gray-400 pl-[16px] block w-full pl-[24px] py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] h-[80%] top-[10%] z-10 hidden group-hover:block bg-gray-300 flex py-[10px] items-center font-medium pl-[40px]"> */
298
+ /* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px] filter list-none p-0 text-indigo-500 text-gray-900 dark:text-gray-200 text-gray-700 dark:text-gray-500 rotate-0 -rotate-90 ml-[28px] grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden text-gray-200 text-gray-500 icon-dark-current block w-full pl-[24px] py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.mjs","sources":["../../constants/dist/index.js","../_DocGroup.vue","../_DocLink.vue","../_DocGroupElements.vue","../DocMenu.vue"],"sourcesContent":["export const classes = {\n button: 'flex leading-[24px] py-[10px] items-center relative w-full',\n topButton: 'leading-[24px] text-[16px] pl-[24px] font-medium',\n leafButton: 'leading-[20px] text-[14px] pl-[40px]',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, nextTick } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements from './_DocGroupElements.vue'\n\nconst props = withDefaults(\n defineProps<{\n group: NavGroup\n activePath?: string\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth?: number\n }>(),\n {\n depth: 0,\n },\n)\n\nconst open = ref(props.group.collapsed !== true)\nconst $groupElements = ref<typeof DocGroupElements>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<{\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n (event: 'hideMarker'): void\n (event: 'updateMarkerPosition'): void\n}>()\n\nfunction hasActiveItemRecursively(items = props.group.items): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items)\n }\n return item.href === props.activePath\n })\n}\n\nfunction reTriggerSetActiveGroup() {\n $groupElements.value?.reTriggerSetActiveGroup()\n}\n\nconst active = computed(() => props.group.href === props.activePath)\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, async (open) => {\n await nextTick()\n if (hasActiveItemRecursively()) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <component\n :is=\"Head\"\n :class=\"[\n classes.button,\n {\n [classes.topButton]: depth === 0,\n [classes.leafButton]: depth,\n 'text-indigo-500': active,\n },\n ]\"\n :href=\"group.href\"\n @click=\"\n () => {\n if (collapsible) {\n open = !open\n } else {\n emit('updateActivePosition')\n }\n }\n \"\n >\n <IconChevronDownSmall\n v-if=\"props.collapsible\"\n stroke-color=\"gray-400\"\n :size=\"depth ? '8' : '16'\"\n class=\"absolute left-0 transform transition-transform\"\n :class=\"{\n 'rotate-0': open,\n '-rotate-90': !open,\n 'ml-[16px]': depth,\n }\"\n />\n {{ group.label }}\n </component>\n <DocGroupElements\n ref=\"$groupElements\"\n v-show=\"open\"\n :depth=\"depth\"\n :items=\"group.items\"\n :active-path=\"activePath\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @hide-marker=\"emit('hideMarker')\"\n @update-marker-position=\"emit('updateMarkerPosition')\"\n @update-active-position=\"(opts) => emit('updateActivePosition', opts)\"\n />\n</template>\n","<script lang=\"ts\" setup>\nimport { watch, type DefineComponent, ref, onMounted } from 'vue'\nimport type { NavItemLink } from '@cypress-design/constants-docmenu'\n\nconst props = withDefaults(\n defineProps<{\n item: NavItemLink\n active: boolean\n collapsible: boolean\n depth?: number\n linkComponent: DefineComponent | 'a'\n }>(),\n {\n depth: -1,\n },\n)\n\nconst emit = defineEmits<{\n (\n event: 'update:active',\n active: boolean,\n opts?: { top: number; height: number },\n ): void\n}>()\n\nconst $container = ref<HTMLLIElement>()\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n const { top = 0, height = 36 } =\n $container.value?.getBoundingClientRect() ?? {}\n\n emit('update:active', props.active, {\n top,\n height,\n })\n }\n}\n\nonMounted(() => {\n watch(\n () => props.active,\n (active) => {\n if (active) {\n setActiveMarkerPosition()\n } else {\n emit('update:active', active)\n }\n },\n { immediate: true },\n )\n})\n\ndefineExpose({\n setActiveMarkerPosition,\n})\n</script>\n\n<template>\n <li\n ref=\"$container\"\n class=\"list-none p-0\"\n :class=\"{\n 'pl-[16px]': depth >= 0,\n }\"\n >\n <component\n :is=\"linkComponent\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500': active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :href=\"item.href\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden\"\n :class=\"{\n 'group-hover:block bg-gray-300': !active && collapsible,\n }\"\n :style=\"{\n left: `-${18.5 + depth * 7.5}px`,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\" setup>\nimport { DefineComponent, ref } from 'vue'\nimport { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu'\nimport DocGroup from './_DocGroup.vue'\nimport DocLink from './_DocLink.vue'\n\nconst props = defineProps<{\n items: (NavGroup | NavItemLink)[]\n activePath?: string\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth: number\n}>()\n\nconst emit = defineEmits<{\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n (event: 'hideMarker'): void\n (event: 'updateMarkerPosition'): void\n}>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nfunction hasActiveItemRecursively(items = props.items): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items)\n }\n return item.href === props.activePath\n })\n}\n\nfunction reTriggerSetActiveGroup() {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n $groups.value.forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul\n class=\"list-none p-0\"\n :class=\"{\n 'border-l border-gray-100': depth === 0 && collapsible,\n 'ml-[8px]': depth >= 0,\n }\"\n >\n <template v-for=\"item in items\">\n <li class=\"relative list-none p-0\" v-if=\"item && 'items' in item\">\n <DocGroup\n ref=\"$groups\"\n :active-path=\"activePath\"\n :group=\"item\"\n :depth=\"depth + 1\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @update-active-position=\"\n (opts) => {\n emit('updateActivePosition', opts)\n }\n \"\n @update-marker-position=\"\n () => {\n if (hasActiveItemRecursively()) {\n reTriggerSetActiveGroup()\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n />\n </li>\n <DocLink\n v-else\n ref=\"$items\"\n :item=\"item\"\n :active=\"item.href === activePath\"\n :depth=\"depth\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @update:active=\"\n (_, opts) => {\n if (!opts) return\n emit('updateActivePosition', opts)\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent } from 'vue'\nimport { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu'\nimport DocGroupElements from './_DocGroupElements.vue'\n\nwithDefaults(\n defineProps<{\n items: (NavItemLink | NavGroup)[]\n activePath?: string\n collapsible?: boolean\n linkComponent?: DefineComponent | 'a'\n }>(),\n {\n linkComponent: 'a',\n collapsible: true,\n activePath: undefined,\n },\n)\n\nconst $container = ref<HTMLDivElement>()\n\nconst activeTop = ref(0)\nconst activeHeight = ref(36)\nconst showMarker = ref(false)\n\nfunction updateActiveMarkerPosition({ top, height } = { height: 0, top: 0 }) {\n const containerTop = $container.value?.getBoundingClientRect().top || 0\n activeTop.value = top - containerTop\n activeHeight.value = height\n showMarker.value = true\n}\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible\"\n data-cy=\"doc-menu-active-marker\"\n class=\"absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]\"\n :style=\"{\n top: `${activeTop + 4}px`,\n height: `${activeHeight - 8}px`,\n }\"\n />\n <DocGroupElements\n :items=\"items\"\n :active-path=\"activePath\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n :depth=\"-1\"\n @update-active-position=\"updateActiveMarkerPosition\"\n @hide-marker=\"showMarker = false\"\n />\n </div>\n</template>\n"],"names":["classes","props","__props","open","ref","$groupElements","Head","computed","emit","__emit","hasActiveItemRecursively","items","item","reTriggerSetActiveGroup","_a","active","watch","nextTick","__expose","$container","setActiveMarkerPosition","top","height","onMounted","$items","$groups","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop"],"mappings":"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"}
1
+ {"version":3,"file":"index.es.mjs","sources":["../../constants/dist/index.js","../_DocGroup.vue","../_DocLink.vue","../_DocGroupElements.vue","../DocMenu.vue"],"sourcesContent":["export const classes = {\n expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',\n button: 'flex leading-[24px] py-[10px] items-center relative w-full text-start',\n topButton: 'leading-[24px] text-[16px] pl-[24px] font-medium',\n leafButton: 'leading-[20px] text-[14px] pl-[48px]',\n openListBorderLeft: 'absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, inject } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements, {\n hasActiveItemRecursively,\n type DocGroupEventsEmitted,\n} from './_DocGroupElements.vue'\n\nconst props = withDefaults(\n defineProps<{\n group: NavGroup\n activePath?: string\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth?: number\n }>(),\n {\n depth: 0,\n },\n)\n\nconst open = ref(props.group.collapsed !== true)\nconst $groupElements = ref<typeof DocGroupElements>()\nconst $listWrapper = ref<HTMLDivElement>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<DocGroupEventsEmitted>()\n\nconst hasActiveItem = computed(() =>\n props.group.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\n }\n return item.href === props.activePath\n }),\n)\n\nfunction reTriggerSetActiveGroup() {\n $groupElements.value?.reTriggerSetActiveGroup()\n}\n\nconst active = computed(() => props.group.href === props.activePath)\n\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nwatch(open, () => {\n $listWrapper.value?.addEventListener(\n 'transitionstart',\n () => {\n markerIsMoving.value = true\n },\n { once: true },\n )\n\n $listWrapper.value?.addEventListener(\n 'transitionend',\n () => {\n markerIsMoving.value = false\n if (open.value || !hasActiveItem.value) {\n emit('updateMarkerPosition')\n }\n },\n { once: true },\n )\n})\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, (open) => {\n if (hasActiveItem.value) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <component\n :is=\"Head\"\n :class=\"[\n classes.button,\n {\n [classes.topButton]: depth === 0,\n [classes.leafButton]: depth,\n 'text-indigo-500': active,\n 'text-gray-900 dark:text-gray-200':\n !hasActiveItem && !active && depth === 0,\n 'text-gray-700 dark:text-gray-500':\n !hasActiveItem && !active && depth >= 0,\n },\n ]\"\n :href=\"group.href\"\n @click=\"\n () => {\n if (collapsible) {\n open = !open\n } else {\n emit('updateActivePosition')\n }\n }\n \"\n >\n <IconChevronDownSmall\n v-if=\"props.collapsible\"\n stroke-color=\"current\"\n :size=\"depth ? '8' : '16'\"\n :class=\"[\n classes.expandedIcon,\n {\n 'rotate-0': open,\n '-rotate-90': !open,\n 'ml-[28px]': depth,\n },\n ]\"\n />\n {{ group.label }}\n </component>\n <div\n class=\"grid transition-all relative\"\n ref=\"$listWrapper\"\n :class=\"{\n 'grid-rows-[0fr]': !open && collapsible,\n 'grid-rows-[1fr]': open || !collapsible,\n }\"\n >\n <div\n v-if=\"open && collapsible && depth === 0\"\n :class=\"classes.openListBorderLeft\"\n />\n <DocGroupElements\n ref=\"$groupElements\"\n class=\"overflow-hidden\"\n :depth=\"depth\"\n :items=\"group.items\"\n :active-path=\"activePath\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @hide-marker=\"emit('hideMarker')\"\n @update-marker-position=\"() => emit('updateMarkerPosition')\"\n @update-active-position=\"\n (opts) => (open ? emit('updateActivePosition', opts) : null)\n \"\n />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport { watch, type DefineComponent, ref, onMounted, inject } from 'vue'\nimport type { NavItemLink } from '@cypress-design/constants-docmenu'\n\nconst props = withDefaults(\n defineProps<{\n item: NavItemLink\n active: boolean\n collapsible: boolean\n depth?: number\n linkComponent: DefineComponent | 'a'\n }>(),\n {\n depth: -1,\n },\n)\n\nconst emit = defineEmits<{\n (\n event: 'update:active',\n active: boolean,\n opts?: { top: number; height: number },\n ): void\n}>()\n\nconst $container = ref<HTMLLIElement>()\n\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n const { top = 0, height = 36 } =\n $container.value?.getBoundingClientRect() ?? {}\n\n emit('update:active', props.active, {\n top,\n height,\n })\n }\n}\n\nonMounted(() => {\n watch(\n () => props.active,\n (active) => {\n if (active) {\n setActiveMarkerPosition()\n } else {\n emit('update:active', active)\n }\n },\n { immediate: true },\n )\n})\n\ndefineExpose({\n setActiveMarkerPosition,\n})\n</script>\n\n<template>\n <li ref=\"$container\" class=\"list-none p-0\">\n <component\n :is=\"linkComponent\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500': active,\n 'text-gray-700 dark:text-gray-500': !active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :style=\"{\n paddingLeft: depth >= 0 ? `${depth * 12 + 48}px` : undefined,\n }\"\n :href=\"item.href\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full\"\n :class=\"{\n hidden: !markerIsMoving || !active,\n 'group-hover:block bg-gray-300': !active && collapsible,\n 'bg-indigo-500': active && markerIsMoving,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\">\nexport function hasActiveItemRecursively(\n items: (NavGroup | NavItemLink)[],\n activePath?: string,\n): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, activePath)\n }\n return item.href === activePath\n })\n}\n\nexport interface DocGroupEventsEmitted {\n /**\n * If the group is not collapsed, this event will emit the\n * active marker position all the way to the menu component\n */\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n /**\n * This event will trigger a re-render of the active marker\n * to update its position if not in the current subtree\n */\n (event: 'updateMarkerPosition'): void\n /**\n * This event will bubble-up and hide the active marker\n */\n (event: 'hideMarker'): void\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { DefineComponent, computed, ref } from 'vue'\nimport { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu'\nimport DocGroup from './_DocGroup.vue'\nimport DocLink from './_DocLink.vue'\n\nconst props = defineProps<{\n items: (NavGroup | NavItemLink)[]\n activePath?: string\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth: number\n}>()\n\nconst emit = defineEmits<DocGroupEventsEmitted>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nconst hasActiveItem = computed(() =>\n props.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\n }\n return item.href === props.activePath\n }),\n)\n\n/**\n * update the position of the marker when opening a group\n * @param index\n */\nfunction reTriggerSetActiveGroup(index = -1) {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n\n // calculate the index of the calling group in the list of groups\n const indexGroup =\n index -\n // remove all the items that are not groups from the array and count them\n props.items.slice(0, index).filter((item) => !('items' in item)).length\n\n // only update groups that come after the toggled one\n // others will not need to update the marker\n // since they are \"before\" in the rendering tree\n $groups.value.slice(indexGroup + 1).forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul class=\"list-none p-0\">\n <template v-for=\"(item, index) in items\">\n <li class=\"relative list-none p-0\" v-if=\"item && 'items' in item\">\n <DocGroup\n ref=\"$groups\"\n :active-path=\"activePath\"\n :group=\"item\"\n :depth=\"depth + 1\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @update-active-position=\"\n (opts) => {\n emit('updateActivePosition', opts)\n }\n \"\n @update-marker-position=\"\n () => {\n if (hasActiveItem) {\n reTriggerSetActiveGroup(index)\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n @hide-marker=\"emit('hideMarker')\"\n />\n </li>\n <DocLink\n v-else\n ref=\"$items\"\n :item=\"item\"\n :active=\"item.href === activePath\"\n :depth=\"depth\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @update:active=\"\n (_, opts) => {\n if (!opts) {\n return\n } else if (depth < 0) {\n emit('hideMarker')\n } else {\n emit('updateActivePosition', opts)\n }\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent, provide } from 'vue'\nimport { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu'\nimport DocGroupElements from './_DocGroupElements.vue'\n\nwithDefaults(\n defineProps<{\n items: (NavItemLink | NavGroup)[]\n activePath?: string\n collapsible?: boolean\n linkComponent?: DefineComponent | 'a'\n }>(),\n {\n linkComponent: 'a',\n collapsible: true,\n activePath: undefined,\n },\n)\n\nconst $container = ref<HTMLDivElement>()\n\nconst activeTop = ref(0)\nconst activeHeight = ref(36)\nconst showMarker = ref(false)\n\nfunction updateActiveMarkerPosition({ top, height } = { height: 0, top: 0 }) {\n const containerTop = $container.value?.getBoundingClientRect().top || 0\n activeTop.value = top - containerTop\n activeHeight.value = height\n showMarker.value = true\n}\n\nconst markerIsMoving = ref(false)\n\nprovide('transition-is-moving', markerIsMoving)\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible && !markerIsMoving\"\n data-cy=\"doc-menu-active-marker\"\n class=\"absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]\"\n :style=\"{\n top: `${activeTop}px`,\n height: `${activeHeight - 8}px`,\n }\"\n />\n <DocGroupElements\n :items=\"items\"\n :active-path=\"activePath\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n :depth=\"-1\"\n @update-active-position=\"updateActiveMarkerPosition\"\n @hide-marker=\"showMarker = false\"\n />\n </div>\n</template>\n"],"names":["classes","props","__props","open","ref","$groupElements","$listWrapper","Head","computed","emit","__emit","hasActiveItem","item","hasActiveItemRecursively","reTriggerSetActiveGroup","_a","active","markerIsMoving","inject","watch","_b","__expose","$container","setActiveMarkerPosition","top","height","onMounted","items","activePath","$items","$groups","index","indexGroup","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop","provide"],"mappings":"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"}
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(e,k){typeof exports=="object"&&typeof module<"u"?module.exports=k(require("vue"),require("@cypress-design/vue-icon")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/vue-icon"],k):(e=typeof globalThis<"u"?globalThis:e||self,e.DocMenu=k(e.Vue,e.CyIcon))})(this,function(e,k){"use strict";const h={button:"flex leading-[24px] py-[10px] items-center relative w-full",topButton:"leading-[24px] text-[16px] pl-[24px] font-medium",leafButton:"leading-[20px] text-[14px] pl-[40px]"},y=e.defineComponent({__name:"_DocGroup",props:{group:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{default:0}},emits:["updateActivePosition","hideMarker","updateMarkerPosition"],setup(f,{expose:d,emit:m}){const i=f,l=e.ref(i.group.collapsed!==!0),c=e.ref(),r=e.computed(()=>i.collapsible?"button":i.group.href?"a":"div"),t=m;function s(o=i.group.items){return o.some(a=>"items"in a?s(a.items):a.href===i.activePath)}function n(){var o;(o=c.value)==null||o.reTriggerSetActiveGroup()}const p=e.computed(()=>i.group.href===i.activePath);return e.watch(p,o=>{o&&t("hideMarker")}),e.watch(l,async o=>{await e.nextTick(),s()?o?n():t("hideMarker"):t("updateMarkerPosition")}),d({reTriggerSetActiveGroup:n}),(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{class:e.normalizeClass([e.unref(h).button,{[e.unref(h).topButton]:o.depth===0,[e.unref(h).leafButton]:o.depth,"text-indigo-500":p.value}]),href:o.group.href,onClick:a[0]||(a[0]=()=>{o.collapsible?l.value=!l.value:t("updateActivePosition")})},{default:e.withCtx(()=>[i.collapsible?(e.openBlock(),e.createBlock(e.unref(k.IconChevronDownSmall),{key:0,"stroke-color":"gray-400",size:o.depth?"8":"16",class:e.normalizeClass(["absolute left-0 transform transition-transform",{"rotate-0":l.value,"-rotate-90":!l.value,"ml-[16px]":o.depth}])},null,8,["size","class"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.group.label),1)]),_:1},8,["class","href"])),e.withDirectives(e.createVNode(g,{ref_key:"$groupElements",ref:c,depth:o.depth,items:o.group.items,"active-path":o.activePath,collapsible:o.collapsible,"link-component":o.linkComponent,onHideMarker:a[1]||(a[1]=u=>t("hideMarker")),onUpdateMarkerPosition:a[2]||(a[2]=u=>t("updateMarkerPosition")),onUpdateActivePosition:a[3]||(a[3]=u=>t("updateActivePosition",u))},null,8,["depth","items","active-path","collapsible","link-component"]),[[e.vShow,l.value]])],64))}}),b=e.defineComponent({__name:"_DocLink",props:{item:{},active:{type:Boolean},collapsible:{type:Boolean},depth:{default:-1},linkComponent:{}},emits:["update:active"],setup(f,{expose:d,emit:m}){const i=f,l=m,c=e.ref();function r(){var t;if(i.active){const{top:s=0,height:n=36}=((t=c.value)==null?void 0:t.getBoundingClientRect())??{};l("update:active",i.active,{top:s,height:n})}}return e.onMounted(()=>{e.watch(()=>i.active,t=>{t?r():l("update:active",t)},{immediate:!0})}),d({setActiveMarkerPosition:r}),(t,s)=>(e.openBlock(),e.createElementBlock("li",{ref_key:"$container",ref:c,class:e.normalizeClass(["list-none p-0",{"pl-[16px]":t.depth>=0}])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.linkComponent),{class:e.normalizeClass(["group relative block w-full pl-[24px]",{"text-indigo-500":t.active,"py-[8px] text-[16px] leading-[24px]":t.depth<0,"leading-[20px] text-[14px] py-[12px]":t.depth>=0}]),href:t.item.href},{default:e.withCtx(()=>[t.depth>=0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden",{"group-hover:block bg-gray-300":!t.active&&t.collapsible}]),style:e.normalizeStyle({left:`-${18.5+t.depth*7.5}px`})},null,6)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.item.label),1)]),_:1},8,["class","href"]))],2))}}),B={key:0,class:"relative list-none p-0"},g=e.defineComponent({__name:"_DocGroupElements",props:{items:{},activePath:{},collapsible:{type:Boolean},linkComponent:{type:[Object,Function,String]},depth:{}},emits:["updateActivePosition","hideMarker","updateMarkerPosition"],setup(f,{expose:d,emit:m}){const i=f,l=m,c=e.ref([]),r=e.ref([]);function t(n=i.items){return n.some(p=>"items"in p?t(p.items):p.href===i.activePath)}function s(){c.value.forEach(n=>{n.setActiveMarkerPosition()}),r.value.forEach(n=>{n.reTriggerSetActiveGroup()})}return d({reTriggerSetActiveGroup:s}),(n,p)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(["list-none p-0",{"border-l border-gray-100":n.depth===0&&n.collapsible,"ml-[8px]":n.depth>=0}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o&&"items"in o?(e.openBlock(),e.createElementBlock("li",B,[e.createVNode(y,{ref_for:!0,ref_key:"$groups",ref:r,"active-path":n.activePath,group:o,depth:n.depth+1,collapsible:n.collapsible,"link-component":n.linkComponent,onUpdateActivePosition:p[0]||(p[0]=a=>{l("updateActivePosition",a)}),onUpdateMarkerPosition:p[1]||(p[1]=()=>{t()?s():l("updateMarkerPosition")})},null,8,["active-path","group","depth","collapsible","link-component"])])):(e.openBlock(),e.createBlock(b,{key:1,ref_for:!0,ref_key:"$items",ref:c,item:o,active:o.href===n.activePath,depth:n.depth,collapsible:n.collapsible,"link-component":n.linkComponent,"onUpdate:active":p[2]||(p[2]=(a,u)=>{u&&l("updateActivePosition",u)})},null,8,["item","active","depth","collapsible","link-component"]))],64))),256))],2))}});return e.defineComponent({__name:"DocMenu",props:{items:{},activePath:{default:void 0},collapsible:{type:Boolean,default:!0},linkComponent:{type:[Object,Function,String],default:"a"}},setup(f){const d=e.ref(),m=e.ref(0),i=e.ref(36),l=e.ref(!1);function c({top:r,height:t}={height:0,top:0}){var n;const s=((n=d.value)==null?void 0:n.getBoundingClientRect().top)||0;m.value=r-s,i.value=t,l.value=!0}return(r,t)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"$container",ref:d,class:"relative"},[l.value&&r.collapsible?(e.openBlock(),e.createElementBlock("div",{key:0,"data-cy":"doc-menu-active-marker",class:"absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]",style:e.normalizeStyle({top:`${m.value+4}px`,height:`${i.value-8}px`})},null,4)):e.createCommentVNode("",!0),e.createVNode(g,{items:r.items,"active-path":r.activePath,collapsible:r.collapsible,"link-component":r.linkComponent,depth:-1,onUpdateActivePosition:c,onHideMarker:t[0]||(t[0]=s=>l.value=!1)},null,8,["items","active-path","collapsible","link-component"])],512))}})});
1
+ (function(e,k){typeof exports=="object"&&typeof module<"u"?module.exports=k(require("vue"),require("@cypress-design/vue-icon")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/vue-icon"],k):(e=typeof globalThis<"u"?globalThis:e||self,e.DocMenu=k(e.Vue,e.CyIcon))})(this,function(e,k){"use strict";const h={expandedIcon:"absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700",button:"flex leading-[24px] py-[10px] items-center relative w-full text-start",topButton:"leading-[24px] text-[16px] pl-[24px] font-medium",leafButton:"leading-[20px] text-[14px] pl-[48px]",openListBorderLeft:"absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"},v=e.defineComponent({__name:"_DocGroup",props:{group:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{default:0}},emits:["updateActivePosition","updateMarkerPosition","hideMarker"],setup(u,{expose:m,emit:c}){const r=u,i=e.ref(r.group.collapsed!==!0),f=e.ref(),d=e.ref(),s=e.computed(()=>r.collapsible?"button":r.group.href?"a":"div"),t=c,n=e.computed(()=>r.group.items.some(o=>"items"in o?y(o.items,r.activePath):o.href===r.activePath));function l(){var o;(o=f.value)==null||o.reTriggerSetActiveGroup()}const a=e.computed(()=>r.group.href===r.activePath),g=e.inject("transition-is-moving",e.ref(!1));return e.watch(i,()=>{var o,p;(o=d.value)==null||o.addEventListener("transitionstart",()=>{g.value=!0},{once:!0}),(p=d.value)==null||p.addEventListener("transitionend",()=>{g.value=!1,(i.value||!n.value)&&t("updateMarkerPosition")},{once:!0})}),e.watch(a,o=>{o&&t("hideMarker")}),e.watch(i,o=>{n.value?o?l():t("hideMarker"):t("updateMarkerPosition")}),m({reTriggerSetActiveGroup:l}),(o,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),{class:e.normalizeClass([e.unref(h).button,{[e.unref(h).topButton]:o.depth===0,[e.unref(h).leafButton]:o.depth,"text-indigo-500":a.value,"text-gray-900 dark:text-gray-200":!n.value&&!a.value&&o.depth===0,"text-gray-700 dark:text-gray-500":!n.value&&!a.value&&o.depth>=0}]),href:o.group.href,onClick:p[0]||(p[0]=()=>{o.collapsible?i.value=!i.value:t("updateActivePosition")})},{default:e.withCtx(()=>[r.collapsible?(e.openBlock(),e.createBlock(e.unref(k.IconChevronDownSmall),{key:0,"stroke-color":"current",size:o.depth?"8":"16",class:e.normalizeClass([e.unref(h).expandedIcon,{"rotate-0":i.value,"-rotate-90":!i.value,"ml-[28px]":o.depth}])},null,8,["size","class"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.group.label),1)]),_:1},8,["class","href"])),e.createElementVNode("div",{class:e.normalizeClass(["grid transition-all relative",{"grid-rows-[0fr]":!i.value&&o.collapsible,"grid-rows-[1fr]":i.value||!o.collapsible}]),ref_key:"$listWrapper",ref:d},[i.value&&o.collapsible&&o.depth===0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(h).openListBorderLeft)},null,2)):e.createCommentVNode("",!0),e.createVNode(b,{ref_key:"$groupElements",ref:f,class:"overflow-hidden",depth:o.depth,items:o.group.items,"active-path":o.activePath,collapsible:o.collapsible,"link-component":o.linkComponent,onHideMarker:p[1]||(p[1]=B=>t("hideMarker")),onUpdateMarkerPosition:p[2]||(p[2]=()=>t("updateMarkerPosition")),onUpdateActivePosition:p[3]||(p[3]=B=>i.value?t("updateActivePosition",B):null)},null,8,["depth","items","active-path","collapsible","link-component"])],2)],64))}}),C=e.defineComponent({__name:"_DocLink",props:{item:{},active:{type:Boolean},collapsible:{type:Boolean},depth:{default:-1},linkComponent:{}},emits:["update:active"],setup(u,{expose:m,emit:c}){const r=u,i=c,f=e.ref(),d=e.inject("transition-is-moving",e.ref(!1));function s(){var t;if(r.active){const{top:n=0,height:l=36}=((t=f.value)==null?void 0:t.getBoundingClientRect())??{};i("update:active",r.active,{top:n,height:l})}}return e.onMounted(()=>{e.watch(()=>r.active,t=>{t?s():i("update:active",t)},{immediate:!0})}),m({setActiveMarkerPosition:s}),(t,n)=>(e.openBlock(),e.createElementBlock("li",{ref_key:"$container",ref:f,class:"list-none p-0"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.linkComponent),{class:e.normalizeClass(["group relative block w-full pl-[24px]",{"text-indigo-500":t.active,"text-gray-700 dark:text-gray-500":!t.active,"py-[8px] text-[16px] leading-[24px]":t.depth<0,"leading-[20px] text-[14px] py-[12px]":t.depth>=0}]),style:e.normalizeStyle({paddingLeft:t.depth>=0?`${t.depth*12+48}px`:void 0}),href:t.item.href},{default:e.withCtx(()=>[t.depth>=0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full",{hidden:!e.unref(d)||!t.active,"group-hover:block bg-gray-300":!t.active&&t.collapsible,"bg-indigo-500":t.active&&e.unref(d)}])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.item.label),1)]),_:1},8,["class","style","href"]))],512))}}),P={class:"list-none p-0"},M={key:0,class:"relative list-none p-0"};function y(u,m){return u.some(c=>"items"in c?y(c.items,m):c.href===m)}const b=e.defineComponent({__name:"_DocGroupElements",props:{items:{},activePath:{},collapsible:{type:Boolean},linkComponent:{type:[Object,Function,String]},depth:{}},emits:["updateActivePosition","updateMarkerPosition","hideMarker"],setup(u,{expose:m,emit:c}){const r=u,i=c,f=e.ref([]),d=e.ref([]),s=e.computed(()=>r.items.some(n=>"items"in n?y(n.items,r.activePath):n.href===r.activePath));function t(n=-1){f.value.forEach(a=>{a.setActiveMarkerPosition()});const l=n-r.items.slice(0,n).filter(a=>!("items"in a)).length;d.value.slice(l+1).forEach(a=>{a.reTriggerSetActiveGroup()})}return m({reTriggerSetActiveGroup:t}),(n,l)=>(e.openBlock(),e.createElementBlock("ul",P,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(a,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[a&&"items"in a?(e.openBlock(),e.createElementBlock("li",M,[e.createVNode(v,{ref_for:!0,ref_key:"$groups",ref:d,"active-path":n.activePath,group:a,depth:n.depth+1,collapsible:n.collapsible,"link-component":n.linkComponent,onUpdateActivePosition:l[0]||(l[0]=o=>{i("updateActivePosition",o)}),onUpdateMarkerPosition:()=>{s.value?t(g):i("updateMarkerPosition")},onHideMarker:l[1]||(l[1]=o=>i("hideMarker"))},null,8,["active-path","group","depth","collapsible","link-component","onUpdateMarkerPosition"])])):(e.openBlock(),e.createBlock(C,{key:1,ref_for:!0,ref_key:"$items",ref:f,item:a,active:a.href===n.activePath,depth:n.depth,collapsible:n.collapsible,"link-component":n.linkComponent,"onUpdate:active":l[2]||(l[2]=(o,p)=>{if(p)n.depth<0?i("hideMarker"):i("updateActivePosition",p);else return})},null,8,["item","active","depth","collapsible","link-component"]))],64))),256))]))}});return e.defineComponent({__name:"DocMenu",props:{items:{},activePath:{default:void 0},collapsible:{type:Boolean,default:!0},linkComponent:{type:[Object,Function,String],default:"a"}},setup(u){const m=e.ref(),c=e.ref(0),r=e.ref(36),i=e.ref(!1);function f({top:s,height:t}={height:0,top:0}){var l;const n=((l=m.value)==null?void 0:l.getBoundingClientRect().top)||0;c.value=s-n,r.value=t,i.value=!0}const d=e.ref(!1);return e.provide("transition-is-moving",d),(s,t)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"$container",ref:m,class:"relative"},[i.value&&s.collapsible&&!d.value?(e.openBlock(),e.createElementBlock("div",{key:0,"data-cy":"doc-menu-active-marker",class:"absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]",style:e.normalizeStyle({top:`${c.value}px`,height:`${r.value-8}px`})},null,4)):e.createCommentVNode("",!0),e.createVNode(b,{items:s.items,"active-path":s.activePath,collapsible:s.collapsible,"link-component":s.linkComponent,depth:-1,onUpdateActivePosition:f,onHideMarker:t[0]||(t[0]=n=>i.value=!1)},null,8,["items","active-path","collapsible","link-component"])],512))}})});
2
2
  //# sourceMappingURL=index.umd.js.map
3
3
 
4
- /* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px] list-none p-0 border-l border-gray-100 ml-[8px] text-indigo-500 left-0 transform transition-transform rotate-0 -rotate-90 ml-[16px] icon-dark-gray-400 pl-[16px] block w-full pl-[24px] py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] h-[80%] top-[10%] z-10 hidden group-hover:block bg-gray-300 flex py-[10px] items-center font-medium pl-[40px]"> */
4
+ /* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px] filter list-none p-0 text-indigo-500 text-gray-900 dark:text-gray-200 text-gray-700 dark:text-gray-500 rotate-0 -rotate-90 ml-[28px] grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden text-gray-200 text-gray-500 icon-dark-current block w-full pl-[24px] py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */