@cypress-design/react-docmenu 0.1.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.
@@ -0,0 +1,6 @@
1
+ $ yarn build:module && yarn build:types
2
+ $ rollup -c ./rollup.config.mjs
3
+ 
4
+ ./index.ts → ./dist/index.umd.js, ./dist/index.es.mjs...
5
+ created ./dist/index.umd.js, ./dist/index.es.mjs in 28s
6
+ $ tsc --project ./tsconfig.build.json
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @cypress-design/react-docmenu
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#178](https://github.com/cypress-io/cypress-design/pull/178) [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650) Thanks [@elevatebart](https://github.com/elevatebart)! - deliver new docs and improved components
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251), [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650)]:
12
+ - @cypress-design/react-icon@0.19.0
@@ -0,0 +1,7 @@
1
+ import * as React from 'react'
2
+ import type { NavGroup, NavItemLink } from '../constants'
3
+ import DocMenu from './DocMenu'
4
+
5
+ export default ({ items }: { items: (NavGroup | NavItemLink)[] }) => {
6
+ return <DocMenu items={items} />
7
+ }
package/DocMenu.tsx ADDED
@@ -0,0 +1,34 @@
1
+ import * as React from 'react'
2
+ import { NavGroup, NavItemLink } from '../constants'
3
+ import { DocLink } from './_DocLink'
4
+ import { DocGroup } from './_DocGroup'
5
+ import clsx from 'clsx'
6
+
7
+ export type NavItem = NavGroup | NavItemLink
8
+
9
+ export interface DocMenuProps extends React.HTMLAttributes<HTMLUListElement> {
10
+ items: NavItem[]
11
+ collapsible?: boolean
12
+ }
13
+
14
+ export const DocMenu: React.FC<DocMenuProps> = ({
15
+ items,
16
+ collapsible = true,
17
+ ...rest
18
+ }) => {
19
+ return (
20
+ <ul {...rest} className={clsx('list-none p-0', rest.className)}>
21
+ {items.map((item, index) =>
22
+ 'items' in item ? (
23
+ <li key={index} className="relative list-none p-0">
24
+ <DocGroup group={item} collapsible={collapsible} />
25
+ </li>
26
+ ) : (
27
+ <DocLink key={index} item={item} collapsible={collapsible} />
28
+ )
29
+ )}
30
+ </ul>
31
+ )
32
+ }
33
+
34
+ export default DocMenu
@@ -0,0 +1,14 @@
1
+ /// <reference types="cypress" />
2
+
3
+ import * as React from 'react'
4
+ import { mount } from 'cypress/react18'
5
+ import DocMenuStory from './DocMenu.rootstory'
6
+ import assertions from '../assertions'
7
+ import { NavGroup, NavItemLink } from '../constants'
8
+
9
+ describe('<DocMenu/>', () => {
10
+ function mountStory(items: (NavItemLink | NavGroup)[] = []) {
11
+ mount(<DocMenuStory items={items} />)
12
+ }
13
+ assertions(mountStory)
14
+ })
package/ReadMe.md ADDED
@@ -0,0 +1,77 @@
1
+ # DocMenu
2
+
3
+ ## Summary
4
+
5
+ Describe your component here.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @cypress-design/react-docmenu
11
+ ```
12
+
13
+ or with yarn
14
+
15
+ ```bash
16
+ yarn add @cypress-design/react-docmenu
17
+ ```
18
+
19
+ ```tsx live
20
+ <DocMenu
21
+ items={[
22
+ {
23
+ text: 'Get Started',
24
+ href: '#',
25
+ },
26
+ {
27
+ text: 'Overview',
28
+ items: [
29
+ {
30
+ text: 'Overview Item 1',
31
+ href: '#',
32
+ },
33
+ {
34
+ text: 'Overview Item 2',
35
+ href: '#',
36
+ active: true,
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ text: 'Getting Started',
42
+ items: [
43
+ {
44
+ text: 'Item 1',
45
+ href: '#',
46
+ },
47
+ {
48
+ text: 'Group',
49
+ items: [
50
+ {
51
+ text: 'Item 1',
52
+ href: '#',
53
+ },
54
+ {
55
+ text: 'Item 2',
56
+ href: '#',
57
+ },
58
+ {
59
+ text: 'Item 3',
60
+ href: '#',
61
+ },
62
+ {
63
+ text: 'Item 4',
64
+ href: '#',
65
+ },
66
+ ],
67
+ },
68
+ {
69
+ text: 'Item 5',
70
+ href: '#',
71
+ active: true,
72
+ },
73
+ ],
74
+ },
75
+ ]}
76
+ />
77
+ ```
package/_DocGroup.tsx ADDED
@@ -0,0 +1,121 @@
1
+ import * as React from 'react'
2
+ import { IconChevronDownSmall } from '@cypress-design/react-icon'
3
+ import clsx from 'clsx'
4
+ import { NavGroup, classes } from '../constants'
5
+ import { DocLink } from './_DocLink'
6
+
7
+ export interface DocGroupProps {
8
+ group: NavGroup
9
+ collapsible: boolean
10
+ depth?: number
11
+ setHeight?: (height: number) => void
12
+ }
13
+
14
+ export const DocGroup: React.FC<DocGroupProps> = ({
15
+ group,
16
+ collapsible,
17
+ depth = 0,
18
+ setHeight,
19
+ }) => {
20
+ const [open, setOpen] = React.useState(depth === 0)
21
+ const [itemsHeights, setItemsHeights] = React.useState<number[]>(
22
+ Array(group.items.length).fill(1)
23
+ )
24
+
25
+ React.useEffect(() => {
26
+ setHeight?.(open ? itemsHeights.reduce((a, b) => a + b, 1) : 1)
27
+ }, [itemsHeights, open])
28
+
29
+ const [activeTop, setActiveTop] = React.useState(0)
30
+
31
+ React.useEffect(() => {
32
+ const activeItem = group.items.findIndex(
33
+ (item) => 'href' in item && item.active
34
+ )
35
+ if (activeItem >= 0) {
36
+ setActiveTop(
37
+ itemsHeights.slice(0, activeItem).reduce((a, b) => a + b, 1) * 44
38
+ )
39
+ }
40
+ }, [itemsHeights])
41
+
42
+ function toggleMenu(open: boolean) {
43
+ if (!collapsible) return
44
+ setOpen(open)
45
+ }
46
+
47
+ function onSetHeight(index: number, height: number) {
48
+ setItemsHeights((prev) => {
49
+ const newHeights = [...prev]
50
+ newHeights[index] = height
51
+ return newHeights
52
+ })
53
+ }
54
+
55
+ const Head = collapsible ? 'button' : group.href ? 'a' : 'div'
56
+
57
+ return (
58
+ <>
59
+ <Head
60
+ onClick={() => toggleMenu(!open)}
61
+ href={group.href}
62
+ className={clsx(classes.button, {
63
+ [classes.topButton]: depth === 0,
64
+ [classes.leafButton]: depth,
65
+ })}
66
+ >
67
+ {collapsible ? (
68
+ <IconChevronDownSmall
69
+ stroke-color="gray-400"
70
+ size={depth ? '8' : '16'}
71
+ className={clsx('absolute transform transition-transform left-0', {
72
+ 'rotate-0': open,
73
+ '-rotate-90': !open,
74
+ 'ml-[16px]': depth,
75
+ })}
76
+ />
77
+ ) : null}
78
+ {group.text}
79
+ </Head>
80
+ {collapsible &&
81
+ depth >= 0 &&
82
+ open &&
83
+ group.items.some((item) => 'href' in item && item.active) ? (
84
+ <div
85
+ className="absolute h-[36px] w-[4px] z-10 rounded-full bg-indigo-500 transition-all duration-300 ml-[6px] mt-[4px]"
86
+ style={{
87
+ top: `${activeTop}px`,
88
+ left: `${depth === 0 ? 0.5 : -(depth * 8) - 0.5}px`,
89
+ }}
90
+ />
91
+ ) : null}
92
+ <ul
93
+ className={clsx('ml-[8px] list-none p-0', {
94
+ 'border-l border-gray-100': depth === 0 && collapsible,
95
+ hidden: !open,
96
+ })}
97
+ >
98
+ {group.items.map((item, index) =>
99
+ 'items' in item ? (
100
+ <li key={index} className="relative list-none p-0">
101
+ <DocGroup
102
+ group={item}
103
+ depth={depth + 1}
104
+ setHeight={(height) => onSetHeight(index, height)}
105
+ collapsible={collapsible}
106
+ />
107
+ </li>
108
+ ) : (
109
+ <DocLink
110
+ key={index}
111
+ item={item}
112
+ collapsible={collapsible}
113
+ depth={depth}
114
+ onActive={(top) => setActiveTop(top)}
115
+ />
116
+ )
117
+ )}
118
+ </ul>
119
+ </>
120
+ )
121
+ }
package/_DocLink.tsx ADDED
@@ -0,0 +1,60 @@
1
+ import * as React from 'react'
2
+ import clsx from 'clsx'
3
+ import { NavItemLink } from '../constants'
4
+
5
+ export interface DocLinkProps {
6
+ item: NavItemLink
7
+ collapsible: boolean
8
+ depth?: number
9
+ onActive?: (top: number) => void
10
+ }
11
+
12
+ export const DocLink: React.FC<DocLinkProps> = ({
13
+ item,
14
+ collapsible,
15
+ depth = -1,
16
+ onActive,
17
+ }) => {
18
+ const activeLIRef = React.useRef<HTMLLIElement>(null)
19
+
20
+ // on mount, if the item is active,
21
+ // send the top position to the parent
22
+ React.useEffect(() => {
23
+ if (item.active) {
24
+ onActive?.(activeLIRef?.current?.offsetTop || 0)
25
+ }
26
+ }, [])
27
+
28
+ return (
29
+ <li
30
+ ref={activeLIRef}
31
+ className={clsx('list-none p-0', {
32
+ 'pl-[16px]': depth >= 0,
33
+ })}
34
+ >
35
+ <a
36
+ className={clsx('group relative inline-block pl-[24px]', {
37
+ 'text-indigo-500 dark:text-indigo-200': item.active,
38
+ 'py-[8px] text-[16px] leading-[24px]': depth < 0,
39
+ 'py-[12px] leading-[20px] text-[14px]': depth >= 0,
40
+ })}
41
+ href={item.href}
42
+ >
43
+ {depth >= 0 ? (
44
+ <div
45
+ className={clsx(
46
+ 'absolute w-[4px] z-10 top-[10%] h-[80%] rounded-full hidden',
47
+ {
48
+ 'group-hover:block bg-gray-300': !item.active && collapsible,
49
+ }
50
+ )}
51
+ style={{
52
+ left: `-${18.5 + depth * 8}px`,
53
+ }}
54
+ />
55
+ ) : null}
56
+ {item.text}
57
+ </a>
58
+ </li>
59
+ )
60
+ }
@@ -0,0 +1,17 @@
1
+ export interface NavItemBase {
2
+ text: string;
3
+ href?: string;
4
+ active?: boolean;
5
+ }
6
+ export interface NavItemLink extends NavItemBase {
7
+ href: string;
8
+ }
9
+ export interface NavGroup extends NavItemBase {
10
+ items: (NavItemLink | NavGroup)[];
11
+ }
12
+ export declare const classes: {
13
+ readonly button: "flex leading-[24px] py-[10px] items-center relative w-full";
14
+ readonly topButton: "leading-[24px] text-[16px] pl-[24px] font-medium";
15
+ readonly leafButton: "leading-[20px] text-[14px] pl-[40px]";
16
+ };
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../constants.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAS,SAAQ,WAAW;IAC3C,KAAK,EAAE,CAAC,WAAW,GAAG,QAAQ,CAAC,EAAE,CAAA;CAClC;AAED,eAAO,MAAM,OAAO;;;;CAIV,CAAA"}
@@ -0,0 +1,227 @@
1
+ import * as React from 'react';
2
+ import clsx from 'clsx';
3
+ import * as iconsRegistry from '@cypress-design/icon-registry';
4
+ import { ICON_COLOR_PROP_NAMES } from '@cypress-design/icon-registry';
5
+
6
+ /******************************************************************************
7
+ Copyright (c) Microsoft Corporation.
8
+
9
+ Permission to use, copy, modify, and/or distribute this software for any
10
+ purpose with or without fee is hereby granted.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
+ PERFORMANCE OF THIS SOFTWARE.
19
+ ***************************************************************************** */
20
+
21
+ var __assign$1 = function() {
22
+ __assign$1 = Object.assign || function __assign(t) {
23
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
24
+ s = arguments[i];
25
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
26
+ }
27
+ return t;
28
+ };
29
+ return __assign$1.apply(this, arguments);
30
+ };
31
+
32
+ function __rest$1(s, e) {
33
+ var t = {};
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
35
+ t[p] = s[p];
36
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
37
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
38
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
39
+ t[p[i]] = s[p[i]];
40
+ }
41
+ return t;
42
+ }
43
+
44
+ function __spreadArray(to, from, pack) {
45
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
46
+ if (ar || !(i in from)) {
47
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48
+ ar[i] = from[i];
49
+ }
50
+ }
51
+ return to.concat(ar || Array.prototype.slice.call(from));
52
+ }
53
+
54
+ var DocLink = function (_a) {
55
+ var item = _a.item, collapsible = _a.collapsible, _b = _a.depth, depth = _b === void 0 ? -1 : _b, onActive = _a.onActive;
56
+ var activeLIRef = React.useRef(null);
57
+ // on mount, if the item is active,
58
+ // send the top position to the parent
59
+ React.useEffect(function () {
60
+ var _a;
61
+ if (item.active) {
62
+ onActive === null || onActive === void 0 ? void 0 : onActive(((_a = activeLIRef === null || activeLIRef === void 0 ? void 0 : activeLIRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0);
63
+ }
64
+ }, []);
65
+ return (React.createElement("li", { ref: activeLIRef, className: clsx('list-none p-0', {
66
+ 'pl-[16px]': depth >= 0,
67
+ }) },
68
+ React.createElement("a", { className: clsx('group relative inline-block pl-[24px]', {
69
+ 'text-indigo-500 dark:text-indigo-200': item.active,
70
+ 'py-[8px] text-[16px] leading-[24px]': depth < 0,
71
+ 'py-[12px] leading-[20px] text-[14px]': depth >= 0,
72
+ }), href: item.href },
73
+ depth >= 0 ? (React.createElement("div", { className: clsx('absolute w-[4px] z-10 top-[10%] h-[80%] rounded-full hidden', {
74
+ 'group-hover:block bg-gray-300': !item.active && collapsible,
75
+ }), style: {
76
+ left: "-".concat(18.5 + depth * 8, "px"),
77
+ } })) : null,
78
+ item.text)));
79
+ };
80
+
81
+ /******************************************************************************
82
+ Copyright (c) Microsoft Corporation.
83
+
84
+ Permission to use, copy, modify, and/or distribute this software for any
85
+ purpose with or without fee is hereby granted.
86
+
87
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
88
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
89
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
90
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
91
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
92
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
93
+ PERFORMANCE OF THIS SOFTWARE.
94
+ ***************************************************************************** */
95
+
96
+ var __assign = function() {
97
+ __assign = Object.assign || function __assign(t) {
98
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
99
+ s = arguments[i];
100
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
101
+ }
102
+ return t;
103
+ };
104
+ return __assign.apply(this, arguments);
105
+ };
106
+
107
+ function __rest(s, e) {
108
+ var t = {};
109
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
110
+ t[p] = s[p];
111
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
112
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
113
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
114
+ t[p[i]] = s[p[i]];
115
+ }
116
+ return t;
117
+ }
118
+
119
+ var compileReactIconProperties = function (_a) {
120
+ var body = _a.body, compiledClasses = _a.compiledClasses, size = _a.size, attributes = __rest(_a, ["body", "compiledClasses", "size"]);
121
+ var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
122
+ if (!ICON_COLOR_PROP_NAMES.includes(attrName) && attrName !== 'name') {
123
+ newAttributes[attrName] =
124
+ attributes[attrName];
125
+ }
126
+ return newAttributes;
127
+ }, {});
128
+ var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
129
+ __html: body,
130
+ } }, filteredAttributes);
131
+ if (attributes.className) {
132
+ compiledClasses.push(attributes.className);
133
+ }
134
+ if (compiledClasses.length) {
135
+ componentProps.className = compiledClasses.join(' ');
136
+ }
137
+ return componentProps;
138
+ };
139
+ var IconChevronDownSmall = function (props) {
140
+ var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, props), { availableSizes: ["8", "16"] })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
141
+ var iconBodies = {
142
+ "8": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m1 2.5 3 3 3-3\" class=\"icon-dark\"/>",
143
+ "16": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m4 6 4 4 4-4\" class=\"icon-dark\"/>"
144
+ };
145
+ var body = iconBodies[size];
146
+ if (!body) {
147
+ throw Error("Icon \"chevron-down-small\" is not available in size ".concat(size));
148
+ }
149
+ return React.createElement('svg', compileReactIconProperties(__assign(__assign({}, props), { size: size, body: body, compiledClasses: compiledClasses })));
150
+ };
151
+
152
+
153
+ /* <windicss-keep class=""> */
154
+
155
+ var classes = {
156
+ button: 'flex leading-[24px] py-[10px] items-center relative w-full',
157
+ topButton: 'leading-[24px] text-[16px] pl-[24px] font-medium',
158
+ leafButton: 'leading-[20px] text-[14px] pl-[40px]',
159
+ };
160
+
161
+ var DocGroup = function (_a) {
162
+ var _b;
163
+ var group = _a.group, collapsible = _a.collapsible, _c = _a.depth, depth = _c === void 0 ? 0 : _c, setHeight = _a.setHeight;
164
+ var _d = React.useState(depth === 0), open = _d[0], setOpen = _d[1];
165
+ var _e = React.useState(Array(group.items.length).fill(1)), itemsHeights = _e[0], setItemsHeights = _e[1];
166
+ React.useEffect(function () {
167
+ setHeight === null || setHeight === void 0 ? void 0 : setHeight(open ? itemsHeights.reduce(function (a, b) { return a + b; }, 1) : 1);
168
+ }, [itemsHeights, open]);
169
+ var _f = React.useState(0), activeTop = _f[0], setActiveTop = _f[1];
170
+ React.useEffect(function () {
171
+ var activeItem = group.items.findIndex(function (item) { return 'href' in item && item.active; });
172
+ if (activeItem >= 0) {
173
+ setActiveTop(itemsHeights.slice(0, activeItem).reduce(function (a, b) { return a + b; }, 1) * 44);
174
+ }
175
+ }, [itemsHeights]);
176
+ function toggleMenu(open) {
177
+ if (!collapsible)
178
+ return;
179
+ setOpen(open);
180
+ }
181
+ function onSetHeight(index, height) {
182
+ setItemsHeights(function (prev) {
183
+ var newHeights = __spreadArray([], prev, true);
184
+ newHeights[index] = height;
185
+ return newHeights;
186
+ });
187
+ }
188
+ var Head = collapsible ? 'button' : group.href ? 'a' : 'div';
189
+ return (React.createElement(React.Fragment, null,
190
+ React.createElement(Head, { onClick: function () { return toggleMenu(!open); }, href: group.href, className: clsx(classes.button, (_b = {},
191
+ _b[classes.topButton] = depth === 0,
192
+ _b[classes.leafButton] = depth,
193
+ _b)) },
194
+ collapsible ? (React.createElement(IconChevronDownSmall, { "stroke-color": "gray-400", size: depth ? '8' : '16', className: clsx('absolute transform transition-transform left-0', {
195
+ 'rotate-0': open,
196
+ '-rotate-90': !open,
197
+ 'ml-[16px]': depth,
198
+ }) })) : null,
199
+ group.text),
200
+ collapsible &&
201
+ depth >= 0 &&
202
+ open &&
203
+ group.items.some(function (item) { return 'href' in item && item.active; }) ? (React.createElement("div", { className: "absolute h-[36px] w-[4px] z-10 rounded-full bg-indigo-500 transition-all duration-300 ml-[6px] mt-[4px]", style: {
204
+ top: "".concat(activeTop, "px"),
205
+ left: "".concat(depth === 0 ? 0.5 : -(depth * 8) - 0.5, "px"),
206
+ } })) : null,
207
+ React.createElement("ul", { className: clsx('ml-[8px] list-none p-0', {
208
+ 'border-l border-gray-100': depth === 0 && collapsible,
209
+ hidden: !open,
210
+ }) }, group.items.map(function (item, index) {
211
+ return 'items' in item ? (React.createElement("li", { key: index, className: "relative list-none p-0" },
212
+ React.createElement(DocGroup, { group: item, depth: depth + 1, setHeight: function (height) { return onSetHeight(index, height); }, collapsible: collapsible }))) : (React.createElement(DocLink, { key: index, item: item, collapsible: collapsible, depth: depth, onActive: function (top) { return setActiveTop(top); } }));
213
+ }))));
214
+ };
215
+
216
+ var DocMenu = function (_a) {
217
+ var items = _a.items, _b = _a.collapsible, collapsible = _b === void 0 ? true : _b, rest = __rest$1(_a, ["items", "collapsible"]);
218
+ return (React.createElement("ul", __assign$1({}, rest, { className: clsx('list-none p-0', rest.className) }), items.map(function (item, index) {
219
+ return 'items' in item ? (React.createElement("li", { key: index, className: "relative list-none p-0" },
220
+ React.createElement(DocGroup, { group: item, collapsible: collapsible }))) : (React.createElement(DocLink, { key: index, item: item, collapsible: collapsible }));
221
+ })));
222
+ };
223
+
224
+ export { DocMenu as default };
225
+ //# sourceMappingURL=index.es.mjs.map
226
+
227
+ /* <windicss-keep class="list-none p-0 relative pl-[16px] inline-block pl-[24px] text-indigo-500 dark:text-indigo-200 py-[8px] text-[16px] leading-[24px] py-[12px] leading-[20px] text-[14px] absolute w-[4px] z-10 top-[10%] h-[80%] rounded-full hidden group-hover:block bg-gray-300 transform transition-transform left-0 rotate-0 -rotate-90 ml-[16px] h-[36px] bg-indigo-500 transition-all duration-300 ml-[6px] mt-[4px] ml-[8px] border-l border-gray-100 flex py-[10px] items-center w-full font-medium pl-[40px]"> */