@cypress-design/vue-docmenu 0.2.2 → 0.4.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/.turbo/turbo-build.log +6 -5
- package/CHANGELOG.md +19 -0
- package/DocMenu.vue +16 -3
- package/DocMenuVue.cy.tsx +40 -2
- package/ReadMe.md +12 -12
- package/_DocGroup.vue +17 -9
- package/_DocLink.vue +9 -6
- package/dist/DocMenu.vue.d.ts +7 -1
- package/dist/DocMenu.vue.d.ts.map +1 -1
- package/dist/_DocGroup.vue.d.ts +5 -2
- package/dist/_DocGroup.vue.d.ts.map +1 -1
- package/dist/_DocLink.vue.d.ts +6 -3
- package/dist/_DocLink.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +113 -143
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/DocMenu.rootstory.tsx +0 -6
package/dist/index.es.mjs
CHANGED
|
@@ -1,209 +1,179 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const T = ({
|
|
5
|
-
body: p,
|
|
6
|
-
compiledClasses: e,
|
|
7
|
-
size: l,
|
|
8
|
-
...o
|
|
9
|
-
}) => {
|
|
10
|
-
const n = Object.keys(o).reduce(
|
|
11
|
-
(a, h) => (!H.includes(
|
|
12
|
-
h
|
|
13
|
-
) && h !== "name" && (a[h] = o[h]), a),
|
|
14
|
-
{}
|
|
15
|
-
), c = {
|
|
16
|
-
width: l,
|
|
17
|
-
height: l,
|
|
18
|
-
viewBox: `0 0 ${l} ${l}`,
|
|
19
|
-
fill: "none",
|
|
20
|
-
innerHTML: p,
|
|
21
|
-
class: void 0,
|
|
22
|
-
...n
|
|
23
|
-
// add all standard attributes back to the svg tag
|
|
24
|
-
};
|
|
25
|
-
return e.length && (c.class = e.join(" ")), c;
|
|
26
|
-
}, A = (p) => {
|
|
27
|
-
const { interactiveColorsOnGroup: e, name: l, ...o } = p, { sizeWithDefault: n, compiledClasses: c } = V.getComponentAttributes({
|
|
28
|
-
...o,
|
|
29
|
-
availableSizes: ["8", "16"],
|
|
30
|
-
interactiveColorsOnGroup: e
|
|
31
|
-
}), a = {
|
|
32
|
-
8: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 2.5 3 3 3-3" class="icon-dark"/>',
|
|
33
|
-
16: '<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m4 6 4 4 4-4" class="icon-dark"/>'
|
|
34
|
-
}[n];
|
|
35
|
-
if (!a)
|
|
36
|
-
throw Error(`Icon "chevron-down-small" is not available in size ${n}`);
|
|
37
|
-
return E("svg", T({
|
|
38
|
-
...o,
|
|
39
|
-
size: n,
|
|
40
|
-
body: a,
|
|
41
|
-
compiledClasses: c
|
|
42
|
-
}));
|
|
43
|
-
}, y = {
|
|
1
|
+
import { defineComponent as v, openBlock as t, createElementBlock as p, normalizeClass as a, createBlock as u, resolveDynamicComponent as x, withCtx as B, normalizeStyle as w, createCommentVNode as k, createTextVNode as $, toDisplayString as D, ref as C, computed as g, Fragment as d, unref as m, withDirectives as G, createElementVNode as H, renderList as z, createVNode as S, vShow as L } from "vue";
|
|
2
|
+
import { IconChevronDownSmall as M } from "@cypress-design/vue-icon";
|
|
3
|
+
const b = {
|
|
44
4
|
button: "flex leading-[24px] py-[10px] items-center relative w-full",
|
|
45
5
|
topButton: "leading-[24px] text-[16px] pl-[24px] font-medium",
|
|
46
6
|
leafButton: "leading-[20px] text-[14px] pl-[40px]"
|
|
47
|
-
},
|
|
7
|
+
}, N = /* @__PURE__ */ v({
|
|
48
8
|
__name: "_DocLink",
|
|
49
9
|
props: {
|
|
50
10
|
item: {},
|
|
11
|
+
collapsible: { type: Boolean },
|
|
51
12
|
depth: { default: -1 },
|
|
52
|
-
|
|
13
|
+
linkComponent: {}
|
|
53
14
|
},
|
|
54
|
-
setup(
|
|
55
|
-
return (
|
|
56
|
-
class:
|
|
57
|
-
"pl-[16px]":
|
|
15
|
+
setup(h) {
|
|
16
|
+
return (l, o) => (t(), p("li", {
|
|
17
|
+
class: a(["list-none p-0", {
|
|
18
|
+
"pl-[16px]": l.depth >= 0
|
|
58
19
|
}])
|
|
59
20
|
}, [
|
|
60
|
-
|
|
61
|
-
class:
|
|
62
|
-
"text-indigo-500
|
|
63
|
-
"py-[8px] text-[16px] leading-[24px]":
|
|
64
|
-
"leading-[20px] text-[14px] py-[12px]":
|
|
21
|
+
(t(), u(x(l.linkComponent), {
|
|
22
|
+
class: a(["group relative block w-full pl-[24px]", {
|
|
23
|
+
"text-indigo-500": l.item.active,
|
|
24
|
+
"py-[8px] text-[16px] leading-[24px]": l.depth < 0,
|
|
25
|
+
"leading-[20px] text-[14px] py-[12px]": l.depth >= 0
|
|
65
26
|
}]),
|
|
66
|
-
href:
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
27
|
+
href: l.item.href
|
|
28
|
+
}, {
|
|
29
|
+
default: B(() => [
|
|
30
|
+
l.depth >= 0 ? (t(), p("div", {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: a(["absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden", {
|
|
33
|
+
"group-hover:block bg-gray-300": !l.item.active && l.collapsible
|
|
34
|
+
}]),
|
|
35
|
+
style: w({
|
|
36
|
+
left: `-${18.5 + l.depth * 7.5}px`
|
|
37
|
+
})
|
|
38
|
+
}, null, 6)) : k("", !0),
|
|
39
|
+
$(" " + D(l.item.label), 1)
|
|
40
|
+
]),
|
|
41
|
+
_: 1
|
|
42
|
+
}, 8, ["class", "href"]))
|
|
79
43
|
], 2));
|
|
80
44
|
}
|
|
81
|
-
}),
|
|
45
|
+
}), O = {
|
|
82
46
|
key: 0,
|
|
83
47
|
class: "relative list-none p-0"
|
|
84
|
-
},
|
|
48
|
+
}, V = /* @__PURE__ */ v({
|
|
85
49
|
__name: "_DocGroup",
|
|
86
50
|
props: {
|
|
87
51
|
group: {},
|
|
88
52
|
collapsible: { type: Boolean },
|
|
53
|
+
linkComponent: {},
|
|
89
54
|
depth: { default: 0 }
|
|
90
55
|
},
|
|
91
|
-
setup(
|
|
92
|
-
const
|
|
93
|
-
(
|
|
94
|
-
|
|
56
|
+
setup(h, { expose: l }) {
|
|
57
|
+
const o = h, n = C(o.depth === 0), c = C([]), I = g(() => c.value && n.value ? c.value.reduce(
|
|
58
|
+
(e, { height: i }) => e + i,
|
|
59
|
+
o.group.items.length
|
|
95
60
|
) : 0);
|
|
96
|
-
|
|
97
|
-
height:
|
|
61
|
+
l({
|
|
62
|
+
height: I
|
|
98
63
|
});
|
|
99
|
-
const
|
|
100
|
-
var
|
|
101
|
-
const
|
|
102
|
-
(
|
|
64
|
+
const E = g(() => {
|
|
65
|
+
var y;
|
|
66
|
+
const e = o.group.items.findIndex(
|
|
67
|
+
(s) => "href" in s && s.active
|
|
103
68
|
);
|
|
104
|
-
let
|
|
105
|
-
(
|
|
69
|
+
let i = o.group.items.filter(
|
|
70
|
+
(s, f) => !("href" in s) && f < e
|
|
106
71
|
).length;
|
|
107
|
-
const
|
|
108
|
-
return (
|
|
109
|
-
}),
|
|
110
|
-
() =>
|
|
72
|
+
const r = (y = c.value) == null ? void 0 : y.reduce((s, f) => i < -1 ? s : (i--, s + f.height), 0);
|
|
73
|
+
return (e + r) * 44;
|
|
74
|
+
}), F = g(
|
|
75
|
+
() => o.collapsible ? "button" : o.group.href ? "a" : "div"
|
|
111
76
|
);
|
|
112
|
-
return (
|
|
113
|
-
(
|
|
114
|
-
class:
|
|
115
|
-
|
|
77
|
+
return (e, i) => (t(), p(d, null, [
|
|
78
|
+
(t(), u(x(F.value), {
|
|
79
|
+
class: a([
|
|
80
|
+
m(b).button,
|
|
116
81
|
{
|
|
117
|
-
[
|
|
118
|
-
[
|
|
119
|
-
"text-indigo-500
|
|
82
|
+
[m(b).topButton]: e.depth === 0,
|
|
83
|
+
[m(b).leafButton]: e.depth,
|
|
84
|
+
"text-indigo-500": o.group.active
|
|
120
85
|
}
|
|
121
86
|
]),
|
|
122
|
-
href:
|
|
123
|
-
onClick:
|
|
124
|
-
|
|
87
|
+
href: o.group.href,
|
|
88
|
+
onClick: i[0] || (i[0] = () => {
|
|
89
|
+
e.collapsible && (n.value = !n.value);
|
|
125
90
|
})
|
|
126
91
|
}, {
|
|
127
|
-
default:
|
|
128
|
-
|
|
92
|
+
default: B(() => [
|
|
93
|
+
o.collapsible ? (t(), u(m(M), {
|
|
129
94
|
key: 0,
|
|
130
95
|
"stroke-color": "gray-400",
|
|
131
|
-
size:
|
|
132
|
-
class:
|
|
133
|
-
"rotate-0":
|
|
134
|
-
"-rotate-90": !
|
|
135
|
-
"ml-[16px]":
|
|
96
|
+
size: e.depth ? "8" : "16",
|
|
97
|
+
class: a(["absolute left-0 transform transition-transform", {
|
|
98
|
+
"rotate-0": n.value,
|
|
99
|
+
"-rotate-90": !n.value,
|
|
100
|
+
"ml-[16px]": e.depth
|
|
136
101
|
}])
|
|
137
|
-
}, null, 8, ["size", "class"])) :
|
|
138
|
-
|
|
102
|
+
}, null, 8, ["size", "class"])) : k("", !0),
|
|
103
|
+
$(" " + D(e.group.label), 1)
|
|
139
104
|
]),
|
|
140
105
|
_: 1
|
|
141
106
|
}, 8, ["class", "href"])),
|
|
142
|
-
|
|
107
|
+
o.collapsible && e.depth >= 0 && n.value && e.group.items.some((r) => "href" in r && r.active) ? (t(), p("div", {
|
|
143
108
|
key: 0,
|
|
144
109
|
class: "absolute h-[36px] w-[4px] z-10 rounded-full bg-indigo-500 transition-all duration-300 ml-[6px] mt-[48px]",
|
|
145
|
-
style:
|
|
146
|
-
top: `${
|
|
147
|
-
left: `-${
|
|
110
|
+
style: w({
|
|
111
|
+
top: `${E.value}px`,
|
|
112
|
+
left: `-${e.depth === 0 ? 0 : e.depth * 7.5 + 1}px`
|
|
148
113
|
})
|
|
149
|
-
}, null, 4)) :
|
|
150
|
-
|
|
151
|
-
class:
|
|
152
|
-
"border-l border-gray-100":
|
|
114
|
+
}, null, 4)) : k("", !0),
|
|
115
|
+
G(H("ul", {
|
|
116
|
+
class: a(["list-none p-0 ml-[7.5px]", {
|
|
117
|
+
"border-l border-gray-100": e.depth === 0 && o.collapsible
|
|
153
118
|
}])
|
|
154
119
|
}, [
|
|
155
|
-
(
|
|
156
|
-
|
|
157
|
-
|
|
120
|
+
(t(!0), p(d, null, z(e.group.items, (r) => (t(), p(d, null, [
|
|
121
|
+
r && "items" in r ? (t(), p("li", O, [
|
|
122
|
+
S(V, {
|
|
158
123
|
ref_for: !0,
|
|
159
124
|
ref_key: "$groups",
|
|
160
|
-
ref:
|
|
161
|
-
group:
|
|
162
|
-
depth:
|
|
163
|
-
collapsible:
|
|
164
|
-
|
|
165
|
-
|
|
125
|
+
ref: c,
|
|
126
|
+
group: r,
|
|
127
|
+
depth: e.depth + 1,
|
|
128
|
+
collapsible: o.collapsible,
|
|
129
|
+
"link-component": o.linkComponent
|
|
130
|
+
}, null, 8, ["group", "depth", "collapsible", "link-component"])
|
|
131
|
+
])) : (t(), u(N, {
|
|
166
132
|
key: 1,
|
|
167
|
-
item:
|
|
168
|
-
depth:
|
|
169
|
-
collapsible:
|
|
170
|
-
|
|
133
|
+
item: r,
|
|
134
|
+
depth: e.depth,
|
|
135
|
+
collapsible: e.collapsible,
|
|
136
|
+
"link-component": o.linkComponent
|
|
137
|
+
}, null, 8, ["item", "depth", "collapsible", "link-component"]))
|
|
171
138
|
], 64))), 256))
|
|
172
139
|
], 2), [
|
|
173
|
-
[
|
|
140
|
+
[L, n.value]
|
|
174
141
|
])
|
|
175
142
|
], 64));
|
|
176
143
|
}
|
|
177
|
-
}),
|
|
144
|
+
}), T = { class: "overflow-y-hidden list-none p-0" }, j = {
|
|
178
145
|
key: 0,
|
|
179
146
|
class: "relative list-none p-0"
|
|
180
|
-
},
|
|
147
|
+
}, A = /* @__PURE__ */ v({
|
|
181
148
|
__name: "DocMenu",
|
|
182
149
|
props: {
|
|
183
150
|
items: {},
|
|
184
|
-
collapsible: { type: Boolean, default: !0 }
|
|
151
|
+
collapsible: { type: Boolean, default: !0 },
|
|
152
|
+
linkComponent: { type: [Object, Function, String], default: "a" }
|
|
185
153
|
},
|
|
186
|
-
setup(
|
|
187
|
-
return (
|
|
188
|
-
(
|
|
189
|
-
"items" in
|
|
190
|
-
|
|
191
|
-
group:
|
|
154
|
+
setup(h) {
|
|
155
|
+
return (l, o) => (t(), p("ul", T, [
|
|
156
|
+
(t(!0), p(d, null, z(l.items, (n) => (t(), p(d, null, [
|
|
157
|
+
"items" in n ? (t(), p("li", j, [
|
|
158
|
+
S(V, {
|
|
159
|
+
group: n,
|
|
192
160
|
depth: 0,
|
|
193
|
-
collapsible:
|
|
194
|
-
|
|
195
|
-
|
|
161
|
+
collapsible: l.collapsible,
|
|
162
|
+
"link-component": l.linkComponent
|
|
163
|
+
}, null, 8, ["group", "collapsible", "link-component"])
|
|
164
|
+
])) : (t(), u(N, {
|
|
196
165
|
key: 1,
|
|
197
|
-
item:
|
|
198
|
-
collapsible:
|
|
199
|
-
|
|
166
|
+
item: n,
|
|
167
|
+
collapsible: l.collapsible,
|
|
168
|
+
"link-component": l.linkComponent
|
|
169
|
+
}, null, 8, ["item", "collapsible", "link-component"]))
|
|
200
170
|
], 64))), 256))
|
|
201
171
|
]));
|
|
202
172
|
}
|
|
203
173
|
});
|
|
204
174
|
export {
|
|
205
|
-
|
|
175
|
+
A as default
|
|
206
176
|
};
|
|
207
177
|
//# sourceMappingURL=index.es.mjs.map
|
|
208
178
|
|
|
209
|
-
/* <wind-keep class="overflow-y-hidden list-none p-0 relative filter text-indigo-500
|
|
179
|
+
/* <wind-keep class="overflow-y-hidden list-none p-0 relative filter text-indigo-500 absolute left-0 transform transition-transform rotate-0 -rotate-90 ml-[16px] h-[36px] w-[4px] z-10 rounded-full bg-indigo-500 transition-all duration-300 ml-[6px] mt-[48px] ml-[7.5px] border-l border-gray-100 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%] hidden group-hover:block bg-gray-300 flex py-[10px] items-center font-medium pl-[40px]"> */
|