@patternfly/patternfly-doc-core 1.4.0 → 1.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/.vscode/launch.json +31 -10
- package/dist/client/_astro/Navigation.CULUlMEB.js +1 -0
- package/dist/client/design-foundations/typography/index.html +18 -18
- package/dist/client/design-foundations/usage-and-behavior/index.html +18 -18
- package/dist/client/get-started/contribute/index.html +18 -18
- package/dist/client/index.html +15 -15
- package/dist/server/_@astrojs-ssr-adapter.mjs +1 -1
- package/dist/server/chunks/{PropsTables_D_v4KAMn.mjs → PropsTables_MQNZVYdD.mjs} +1 -1
- package/dist/server/chunks/{_@astrojs-ssr-adapter_ByVMUK8O.mjs → _@astrojs-ssr-adapter_8jk9s5dg.mjs} +2 -2
- package/dist/server/chunks/{_astro_assets_CLOMnm-3.mjs → _astro_assets_CmxVRFAY.mjs} +2 -2
- package/dist/server/chunks/astro/{server_D4f31GMD.mjs → server_zRMEhmuT.mjs} +1 -1
- package/dist/server/chunks/{astro-designed-error-pages_CpHpbfhr.mjs → astro-designed-error-pages_DRBnGamN.mjs} +1 -1
- package/dist/server/chunks/{sharp_BYpUyJGL.mjs → sharp_BAxaBZQw.mjs} +2 -2
- package/dist/server/entry.mjs +3 -3
- package/dist/server/{manifest_CBenwYiZ.mjs → manifest_7YAgSoyv.mjs} +3 -3
- package/dist/server/pages/_image.astro.mjs +1 -1
- package/package.json +1 -1
- package/src/components/Masthead.astro +1 -1
- package/src/components/NavEntry.tsx +0 -2
- package/src/components/NavSection.tsx +3 -23
- package/src/components/Navigation.astro +52 -7
- package/src/components/Navigation.tsx +13 -43
- package/dist/client/_astro/Navigation.75VF_8AW.js +0 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { getCollection } from 'astro:content'
|
|
3
3
|
|
|
4
4
|
import { Navigation as ReactNav } from './Navigation.tsx'
|
|
5
|
+
import { TextContentEntry } from './NavEntry.tsx'
|
|
5
6
|
|
|
6
7
|
import { content } from '../content'
|
|
7
8
|
|
|
@@ -13,12 +14,56 @@ const collections = await Promise.all(
|
|
|
13
14
|
),
|
|
14
15
|
)
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
+
const navDataRaw = collections.flat();
|
|
18
|
+
const uniqueSections = new Set(navDataRaw.map((entry) => entry.data.section));
|
|
19
|
+
const navData: Record<string, TextContentEntry[]> = {};
|
|
20
|
+
|
|
21
|
+
const [orderedSections, unorderedSections] = Array.from(uniqueSections).reduce(
|
|
22
|
+
(acc, section) => {
|
|
23
|
+
if (!config.navSectionOrder) {
|
|
24
|
+
acc[1].push(section)
|
|
25
|
+
return acc
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const index = config.navSectionOrder.indexOf(section)
|
|
29
|
+
if (index > -1) {
|
|
30
|
+
acc[0][index] = section
|
|
31
|
+
} else {
|
|
32
|
+
acc[1].push(section)
|
|
33
|
+
}
|
|
34
|
+
return acc
|
|
35
|
+
},
|
|
36
|
+
[[], []] as [string[], string[]],
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const sortedSections = [...orderedSections, ...unorderedSections.sort()]
|
|
40
|
+
sortedSections.map((section) => {
|
|
41
|
+
const entries = navDataRaw
|
|
42
|
+
.filter((entry) => entry.data.section === section)
|
|
43
|
+
.map(entry => ({ id: entry.id, data: { id: entry.data.id, section }} as TextContentEntry))
|
|
44
|
+
|
|
45
|
+
const sortedEntries = entries.sort((a, b) =>
|
|
46
|
+
a.data.id.localeCompare(b.data.id),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
let navEntries = sortedEntries
|
|
50
|
+
if (section === 'components' || section === 'layouts') {
|
|
51
|
+
// only display unique entry.data.id in the nav list if the section is components
|
|
52
|
+
navEntries = [
|
|
53
|
+
...sortedEntries
|
|
54
|
+
.reduce((map, entry) => {
|
|
55
|
+
if (!map.has(entry.data.id)) {
|
|
56
|
+
map.set(entry.data.id, entry)
|
|
57
|
+
}
|
|
58
|
+
return map
|
|
59
|
+
}, new Map())
|
|
60
|
+
.values(),
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
navData[section] = navEntries;
|
|
65
|
+
})
|
|
66
|
+
|
|
17
67
|
---
|
|
18
68
|
|
|
19
|
-
<ReactNav
|
|
20
|
-
client:only="react"
|
|
21
|
-
navEntries={navEntries}
|
|
22
|
-
navSectionOrder={config.navSectionOrder}
|
|
23
|
-
transition:animate="fade"
|
|
24
|
-
/>
|
|
69
|
+
<ReactNav client:only="react" navData={navData} transition:animate="fade" />
|
|
@@ -4,19 +4,17 @@ import { NavSection } from './NavSection'
|
|
|
4
4
|
import { type TextContentEntry } from './NavEntry'
|
|
5
5
|
|
|
6
6
|
interface NavigationProps {
|
|
7
|
-
|
|
8
|
-
navSectionOrder?: string[]
|
|
7
|
+
navData: Record<string, TextContentEntry[]>
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
export const Navigation: React.FunctionComponent<NavigationProps> = ({
|
|
12
|
-
|
|
13
|
-
navSectionOrder,
|
|
11
|
+
navData,
|
|
14
12
|
}: NavigationProps) => {
|
|
15
13
|
const [activeItem, setActiveItem] = useState('')
|
|
16
14
|
|
|
17
15
|
useEffect(() => {
|
|
18
16
|
// TODO: Needs an alternate solution because of /tab in the path
|
|
19
|
-
setActiveItem(window.location.pathname.split('/').reverse()[0])
|
|
17
|
+
setActiveItem(window.location.pathname.split('/').reverse()[0])
|
|
20
18
|
}, [])
|
|
21
19
|
|
|
22
20
|
const onNavSelect = (
|
|
@@ -26,48 +24,20 @@ export const Navigation: React.FunctionComponent<NavigationProps> = ({
|
|
|
26
24
|
setActiveItem(selectedItem.itemId.toString())
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
const uniqueSections = Array.from(
|
|
30
|
-
new Set(navEntries.map((entry) => entry.data.section)),
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
// We want to list any ordered sections first, followed by any unordered sections sorted alphabetically
|
|
34
|
-
const [orderedSections, unorderedSections] = uniqueSections.reduce(
|
|
35
|
-
(acc, section) => {
|
|
36
|
-
if (!navSectionOrder) {
|
|
37
|
-
acc[1].push(section)
|
|
38
|
-
return acc
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const index = navSectionOrder.indexOf(section)
|
|
42
|
-
if (index > -1) {
|
|
43
|
-
acc[0][index] = section
|
|
44
|
-
} else {
|
|
45
|
-
acc[1].push(section)
|
|
46
|
-
}
|
|
47
|
-
return acc
|
|
48
|
-
},
|
|
49
|
-
[[], []] as [string[], string[]],
|
|
50
|
-
)
|
|
51
|
-
const sortedSections = [...orderedSections, ...unorderedSections.sort()]
|
|
52
|
-
|
|
53
|
-
const navSections = sortedSections.map((section) => {
|
|
54
|
-
const entries = navEntries.filter((entry) => entry.data.section === section)
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<NavSection
|
|
58
|
-
key={section}
|
|
59
|
-
entries={entries}
|
|
60
|
-
sectionId={section}
|
|
61
|
-
activeItem={activeItem}
|
|
62
|
-
/>
|
|
63
|
-
)
|
|
64
|
-
})
|
|
65
|
-
|
|
66
27
|
return (
|
|
67
28
|
// Can possibly add back PageSidebar wrapper when https://github.com/patternfly/patternfly/issues/7377 goes in
|
|
68
29
|
<PageSidebarBody id="page-sidebar-body">
|
|
69
30
|
<Nav onSelect={onNavSelect}>
|
|
70
|
-
<NavList>
|
|
31
|
+
<NavList>
|
|
32
|
+
{Object.entries(navData).map(([key, value], index) => (
|
|
33
|
+
<NavSection
|
|
34
|
+
key={index}
|
|
35
|
+
entries={value}
|
|
36
|
+
sectionId={key}
|
|
37
|
+
activeItem={activeItem}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</NavList>
|
|
71
41
|
</Nav>
|
|
72
42
|
</PageSidebarBody>
|
|
73
43
|
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as ee,_ as O,d as h,h as te,v as B,w as J,B as Q,u as xe,g as be,j as y}from"./Button.C3_jB5tC.js";import{r as t}from"./index.CTH3fVMn.js";/* empty css */import{g as Ie,A as Le,a as $,d as ye,P as Ne,m as Ce}from"./divider.BSD-oFoh.js";import{s as F}from"./page.B65lVdBS.js";const i={modifiers:{expanded:"pf-m-expanded",hover:"pf-m-hover",current:"pf-m-current",flyout:"pf-m-flyout",horizontal:"pf-m-horizontal",subnav:"pf-m-subnav",scrollable:"pf-m-scrollable"},nav:"pf-v6-c-nav",navItem:"pf-v6-c-nav__item",navLink:"pf-v6-c-nav__link",navLinkIcon:"pf-v6-c-nav__link-icon",navList:"pf-v6-c-nav__list",navScrollButton:"pf-v6-c-nav__scroll-button",navSubnav:"pf-v6-c-nav__subnav",navToggle:"pf-v6-c-nav__toggle",navToggleIcon:"pf-v6-c-nav__toggle-icon"},Ae={},A=t.createContext(Ae);class w extends t.Component{constructor(){super(...arguments),this.state={isScrollable:!1,ouiaStateId:ee(w.displayName,this.props.variant),flyoutRef:null},this.navRef=t.createRef()}onSelect(e,n,s,a,l,c){l&&e.preventDefault(),this.props.onSelect(e,{groupId:n,itemId:s,to:a}),c&&c(e,s,n,a)}onToggle(e,n,s){this.props.onToggle(e,{groupId:n,isExpanded:s})}render(){const e=this.props,{"aria-label":n,children:s,className:a,onSelect:l,onToggle:c,ouiaId:d,ouiaSafe:r,variant:p}=e,m=O(e,["aria-label","children","className","onSelect","onToggle","ouiaId","ouiaSafe","variant"]),v=["horizontal","horizontal-subnav"].includes(p);return t.createElement(A.Provider,{value:{onSelect:(g,I,E,R,N,P)=>this.onSelect(g,I,E,R,N,P),onToggle:(g,I,E)=>this.onToggle(g,I,E),updateIsScrollable:g=>this.setState({isScrollable:g}),isHorizontal:["horizontal","horizontal-subnav"].includes(p),flyoutRef:this.state.flyoutRef,setFlyoutRef:g=>this.setState({flyoutRef:g}),navRef:this.navRef}},t.createElement("nav",Object.assign({className:h(i.nav,v&&i.modifiers.horizontal,p==="horizontal-subnav"&&i.modifiers.subnav,this.state.isScrollable&&i.modifiers.scrollable,a),"aria-label":n||(p==="horizontal-subnav"?"Local":"Global"),ref:this.navRef},te(w.displayName,d!==void 0?d:this.state.ouiaStateId,r),m),s))}}w.displayName="Nav";w.defaultProps={onSelect:()=>{},onToggle:()=>{},ouiaSafe:!0};const we={isSidebarOpen:!0},M=t.createContext(we);class U extends t.Component{constructor(){super(...arguments),this.direction="ltr",this.state={scrollViewAtStart:!1,scrollViewAtEnd:!1},this.navList=t.createRef(),this.observer=()=>{},this.handleScrollButtons=()=>{const e=this.navList.current;if(e){const n=B(e,e.firstChild),s=B(e,e.lastChild);this.setState({scrollViewAtStart:n,scrollViewAtEnd:s}),this.context.updateIsScrollable(!n||!s)}},this.scrollBack=()=>{const e=this.navList.current;if(e){const n=Array.from(e.children);let s,a;for(let l=0;l<n.length&&!s;l++)B(e,n[l])&&(s=n[l],a=n[l-1]);a&&(this.direction==="ltr"?e.scrollLeft-=a.scrollWidth:e.scrollLeft+=a.scrollWidth),this.handleScrollButtons()}},this.scrollForward=()=>{const e=this.navList.current;if(e){const n=Array.from(e.children);let s,a;for(let l=n.length-1;l>=0&&!s;l--)B(e,n[l])&&(s=n[l],a=n[l+1]);a&&(this.direction==="ltr"?e.scrollLeft+=a.scrollWidth:e.scrollLeft-=a.scrollWidth),this.handleScrollButtons()}}}componentDidMount(){this.observer=Ie(this.navList.current,this.handleScrollButtons),this.direction=J(this.navList.current),this.handleScrollButtons()}componentWillUnmount(){this.observer()}componentDidUpdate(){this.direction=J(this.navList.current)}render(){const e=this.props,{children:n,className:s,backScrollAriaLabel:a,forwardScrollAriaLabel:l}=e,c=O(e,["children","className","backScrollAriaLabel","forwardScrollAriaLabel"]),{scrollViewAtStart:d,scrollViewAtEnd:r}=this.state;return t.createElement(A.Consumer,null,({isHorizontal:p})=>t.createElement(M.Consumer,null,({isSidebarOpen:m})=>t.createElement(t.Fragment,null,p&&(!d||!r)&&t.createElement("div",{className:h(i.navScrollButton)},t.createElement(Q,{variant:"plain","aria-label":a,onClick:this.scrollBack,isDisabled:d,tabIndex:m?null:-1,icon:t.createElement(Le,null)})),t.createElement("ul",Object.assign({ref:this.navList,className:h(i.navList,s),onScroll:this.handleScrollButtons,role:"list"},c),n),p&&(!d||!r)&&t.createElement("div",{className:h(i.navScrollButton)},t.createElement(Q,{variant:"plain","aria-label":l,onClick:this.scrollForward,isDisabled:r,tabIndex:m?null:-1,icon:t.createElement($,null)})))))}}U.displayName="NavList";U.contextType=A;U.defaultProps={backScrollAriaLabel:"Scroll back",forwardScrollAriaLabel:"Scroll foward"};const W=o=>{var{children:e,styleChildren:n=!0,className:s,to:a,isActive:l=!1,groupId:c=null,itemId:d=null,preventDefault:r=!1,onClick:p,component:m="a",flyout:v,onShowFlyout:g,ouiaId:I,ouiaSafe:E,zIndex:R=9999,icon:N}=o,P=O(o,["children","styleChildren","className","to","isActive","groupId","itemId","preventDefault","onClick","component","flyout","onShowFlyout","ouiaId","ouiaSafe","zIndex","icon"]);const{flyoutRef:T,setFlyoutRef:j,navRef:V}=t.useContext(A),{isSidebarOpen:re}=t.useContext(M),[z,ie]=t.useState(null),[ce,H]=t.useState(!1),L=t.useRef(),x=L===T,C=t.useRef(),S=v!==void 0,de=S?"button":m;a&&S&&console.error('NavItem cannot have both "to" and "flyout" props.');const D=(u,f)=>{(!x||f)&&u?j(L):(x||f)&&!u&&j(null),g&&u&&g()},ue=u=>{const f=u.target.closest(`.${i.navItem}.pf-m-flyout`);S&&!x?D(!0):T!==null&&!f&&j(null)},q=u=>{u.target.closest(".pf-m-flyout")||(S?D(!1,!0):T!==null&&j(null))},pe=u=>{var f,b;const k=u.key,K=u.target;(k===" "||k==="Enter"||k==="ArrowRight")&&S&&(!((f=L?.current)===null||f===void 0)&&f.contains(K))&&(u.stopPropagation(),u.preventDefault(),x||(D(!0),ie(K))),(k==="Escape"||k==="ArrowLeft")&&((b=C?.current)===null||b===void 0?void 0:b.querySelectorAll(`.${Ce.menu}`).length)===1&&x&&(u.stopPropagation(),u.preventDefault(),D(!1))};t.useEffect(()=>(S&&window.addEventListener("click",q),()=>{S&&window.removeEventListener("click",q)}),[]),t.useEffect(()=>{z&&(x?Array.from(C.current.getElementsByTagName("UL")[0].children).filter(f=>!(f.classList.contains("pf-m-disabled")||f.classList.contains(ye.divider)))[0].firstChild.focus():z.focus())},[x,z]);const X=t.createElement("span",{className:h(i.navToggle)},t.createElement("span",{className:h(i.navToggleIcon)},t.createElement($,{"aria-hidden":!0}))),fe={"aria-haspopup":"menu","aria-expanded":x},G=re?null:-1,me=u=>{const f=r||!a;return t.createElement(de,Object.assign({href:a,onClick:b=>u.onSelect(b,c,d,a,f,p),className:h(i.navLink,l&&i.modifiers.current,ce&&i.modifiers.hover,s),"aria-current":l?"page":null,tabIndex:G},S&&Object.assign({},fe),P),N&&t.createElement("span",{className:h(i.navLinkIcon)},N),t.createElement("span",{className:h(`${i.nav}__link-text`)},e),v&&X)},he=(u,f)=>t.cloneElement(f,Object.assign(Object.assign({onClick:b=>u.onSelect(b,c,d,a,r,p),"aria-current":l?"page":null},n&&{className:h(i.navLink,l&&i.modifiers.current,f.props&&f.props.className)}),{tabIndex:f.props.tabIndex||G,children:S?t.createElement(t.Fragment,null,f.props.children,X):f.props.children})),ve=xe(W.displayName,I,E),ge=()=>{H(!0)},Se=()=>{H(!1)},Ee=t.createElement(Ne,{triggerRef:L,popper:t.createElement("div",{ref:C,onMouseEnter:ge,onMouseLeave:Se},v),popperRef:C,placement:"right-start",isVisible:x,onDocumentKeyDown:pe,zIndex:R,appendTo:V?.current});return t.createElement(t.Fragment,null,t.createElement("li",Object.assign({onMouseOver:ue,className:h(i.navItem,S&&i.modifiers.flyout,s),ref:L},ve),t.createElement(A.Consumer,null,u=>t.isValidElement(e)?he(u,e):me(u))),v&&Ee)};W.displayName="NavItem";class _ extends t.Component{constructor(){super(...arguments),this.id=this.props.id||be(),this.state={expandedState:this.props.isExpanded,ouiaStateId:ee(_.displayName)},this.onExpand=(e,n)=>{const{expandedState:s}=this.state;if(this.props.onExpand)this.props.onExpand(e,!s);else{this.setState(l=>({expandedState:!l.expandedState}));const{groupId:a}=this.props;n(e,a,!s)}}}componentDidMount(){this.setState({expandedState:this.props.isExpanded})}componentDidUpdate(e){this.props.isExpanded!==e.isExpanded&&this.setState({expandedState:this.props.isExpanded})}render(){const e=this.props,{title:n,srText:s,children:a,className:l,isActive:c,ouiaId:d,groupId:r,id:p,isExpanded:m,buttonProps:v,onExpand:g}=e,I=O(e,["title","srText","children","className","isActive","ouiaId","groupId","id","isExpanded","buttonProps","onExpand"]),{expandedState:E,ouiaStateId:R}=this.state;return t.createElement(A.Consumer,null,N=>t.createElement("li",Object.assign({className:h(i.navItem,E&&i.modifiers.expanded,c&&i.modifiers.current,l)},te(_.displayName,d!==void 0?d:R),I),t.createElement(M.Consumer,null,({isSidebarOpen:P})=>t.createElement("button",Object.assign({className:h(i.navLink),id:s?null:this.id,onClick:T=>this.onExpand(T,N.onToggle),"aria-expanded":E,tabIndex:P?null:-1},v),typeof n!="string"?t.createElement("span",{className:h(`${i.nav}__link-text`)},n):n,t.createElement("span",{className:h(i.navToggle)},t.createElement("span",{className:h(i.navToggleIcon)},t.createElement($,{"aria-hidden":"true"}))))),t.createElement("section",{className:h(i.navSubnav),"aria-labelledby":this.id,hidden:E?null:!0},s&&t.createElement("h2",{className:"pf-v6-screen-reader",id:this.id},s),t.createElement("ul",{className:h(i.navList),role:"list"},a))))}}_.displayName="NavExpandable";_.defaultProps={srText:"",isExpanded:!1,children:"",className:"",groupId:null,isActive:!1,id:""};const ne=o=>{var{children:e,className:n,usePageInsets:s,isFilled:a,isContextSelector:l}=o,c=O(o,["children","className","usePageInsets","isFilled","isContextSelector"]);return t.createElement("div",Object.assign({className:h(F.pageSidebarBody,s&&F.modifiers.pageInsets,a===!1&&F.modifiers.noFill,a===!0&&F.modifiers.fill,l===!0&&F.modifiers.contextSelector,n)},c),e)};ne.displayName="PageSidebarBody";const _e=/([\p{Ll}\d])(\p{Lu})/gu,Re=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,Pe=/(\d)\p{Ll}|(\p{L})\d/u,Te=/[^\p{L}\d]+/giu,Y="$1\0$2",Z="";function se(o){let e=o.trim();e=e.replace(_e,Y).replace(Re,Y),e=e.replace(Te,"\0");let n=0,s=e.length;for(;e.charAt(n)==="\0";)n++;if(n===s)return[];for(;e.charAt(s-1)==="\0";)s--;return e.slice(n,s).split(/\0/g)}function ke(o){const e=se(o);for(let n=0;n<e.length;n++){const s=e[n],a=Pe.exec(s);if(a){const l=a.index+(a[1]??a[2]).length;e.splice(n,1,s.slice(0,l),s.slice(l))}}return e}function Fe(o,e){const[n,s,a]=oe(o,e);return n+s.map(le(e?.locale)).join(e?.delimiter??" ")+a}function ae(o,e){return Fe(o,{delimiter:"-",...e})}function Oe(o,e){const[n,s,a]=oe(o,e),l=le(e?.locale),c=je(e?.locale),d=De(l,c);return n+s.map((r,p)=>p===0?d(r):l(r)).join(" ")+a}function le(o){return o===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(o)}function je(o){return e=>e.toLocaleUpperCase(o)}function De(o,e){return n=>`${e(n[0])}${o(n.slice(1))}`}function oe(o,e={}){const n=e.split??(e.separateNumbers?ke:se),s=e.prefixCharacters??Z,a=e.suffixCharacters??Z;let l=0,c=o.length;for(;l<o.length;){const d=o.charAt(l);if(!s.includes(d))break;l++}for(;c>l;){const d=c-1,r=o.charAt(d);if(!a.includes(r))break;c=d}return[o.slice(0,l),n(o.slice(l,c)),o.slice(c)]}const Be=({entry:o,isActive:e})=>{const{id:n}=o,{id:s,section:a}=o.data,l=a==="components"||a==="layouts"?ae(s):n;return y.jsx(W,{itemId:l,to:`/${a}/${l}`,isActive:e,id:`nav-entry-${l}`,children:s})},Ue=({entries:o,sectionId:e,activeItem:n})=>{const s=window.location.pathname.includes(e),a=o.sort((r,p)=>r.data.id.localeCompare(p.data.id)),l=a.some(r=>r.id===n);let c=a;(e==="components"||e==="layouts")&&(c=[...a.reduce((r,p)=>(r.has(p.data.id)||r.set(p.data.id,p),r),new Map).values()]);const d=c.map(r=>y.jsx(Be,{entry:r,isActive:n===r.id||window.location.pathname.includes(ae(r.data.id))},r.id));return y.jsx(_,{title:Oe(e),isActive:l,isExpanded:s,id:`nav-section-${e}`,children:d})},qe=({navEntries:o,navSectionOrder:e})=>{const[n,s]=t.useState("");t.useEffect(()=>{s(window.location.pathname.split("/").reverse()[0])},[]);const a=(m,v)=>{s(v.itemId.toString())},l=Array.from(new Set(o.map(m=>m.data.section))),[c,d]=l.reduce((m,v)=>{if(!e)return m[1].push(v),m;const g=e.indexOf(v);return g>-1?m[0][g]=v:m[1].push(v),m},[[],[]]),p=[...c,...d.sort()].map(m=>{const v=o.filter(g=>g.data.section===m);return y.jsx(Ue,{entries:v,sectionId:m,activeItem:n},m)});return y.jsx(ne,{id:"page-sidebar-body",children:y.jsx(w,{onSelect:a,children:y.jsx(U,{children:p})})})};export{qe as Navigation};
|