@patternfly/patternfly-doc-core 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/.astro/collections/textContent.schema.json +6 -0
  2. package/.astro/content.d.ts +1 -9
  3. package/dist/_astro/{Button.eaCBj136.js → Button.C3_jB5tC.js} +1 -1
  4. package/dist/_astro/Navigation.Cede__Ud.js +1 -0
  5. package/dist/_astro/{PageContext.CXYSru7V.js → PageContext.C7BqCh9N.js} +1 -1
  6. package/dist/_astro/PageToggle.DDEjruql.js +1 -0
  7. package/dist/_astro/Toolbar.TAdHxLSQ.js +1 -0
  8. package/dist/_astro/divider.BSD-oFoh.js +1 -0
  9. package/dist/_astro/page.B65lVdBS.js +1 -0
  10. package/dist/design-foundations/typography/index.html +4 -4
  11. package/dist/design-foundations/usage-and-behavior/index.html +4 -4
  12. package/dist/get-started/contribute/index.html +4 -4
  13. package/dist/index.html +3 -3
  14. package/package.json +1 -1
  15. package/src/components/NavEntry.tsx +12 -1
  16. package/src/components/NavSection.tsx +25 -2
  17. package/src/components/Navigation.tsx +2 -1
  18. package/src/components/Page.astro +2 -4
  19. package/src/content.config.ts +8 -0
  20. package/src/content.ts +14 -1
  21. package/src/globals.ts +53 -0
  22. package/src/pages/[section]/{[...id].astro → [...page].astro} +10 -3
  23. package/src/pages/[section]/[page]/[...tab].astro +71 -0
  24. package/.astro/collections/dir.schema.json +0 -28
  25. package/dist/_astro/Navigation.DtAJEPqE.js +0 -1
  26. package/dist/_astro/PageToggle.Cfvh0Y0J.js +0 -1
  27. package/dist/_astro/Toolbar.Dy6s4jyx.js +0 -1
  28. package/dist/_astro/divider.rOVHdw7p.js +0 -1
  29. package/dist/_astro/page.DycaZ65G.js +0 -1
  30. /package/dist/_astro/{_id_.CXyz_BEo.css → _page_.CXyz_BEo.css} +0 -0
  31. /package/dist/_astro/{_id_.DVvr_Mfl.css → _page_.DVvr_Mfl.css} +0 -0
@@ -14,12 +14,20 @@ function defineContent(contentObj: CollectionDefinition) {
14
14
  return
15
15
  }
16
16
 
17
+ // TODO: Expand for other packages that remain under the react umbrella (Table, CodeEditor, etc)
18
+ const tabMap: any = {
19
+ 'react-component-docs': 'react',
20
+ 'core-component-docs': 'html'
21
+ };
22
+
17
23
  return defineCollection({
18
24
  loader: glob({ base: dir, pattern }),
19
25
  schema: z.object({
20
26
  id: z.string(),
21
27
  section: z.string(),
28
+ subsection: z.string().optional(),
22
29
  title: z.string().optional(),
30
+ tab: z.string().optional().default(tabMap[name])
23
31
  }),
24
32
  })
25
33
  }
package/src/content.ts CHANGED
@@ -1 +1,14 @@
1
- export const content = [{ base: 'textContent', pattern: '*.md', name: "textContent" }, { base: 'dir', pattern: '*.md', name: "dir" }]
1
+ export const content = [
2
+ { base: 'textContent', pattern: '*.md', name: "textContent" }
3
+ // TODO: Remove. Uncomment for local testing.
4
+ // {
5
+ // "packageName":"@patternfly/react-core",
6
+ // "pattern":"**/examples/**/*.md", // had to update this pattern to bring in demos docs
7
+ // "name":"react-component-docs"
8
+ // },
9
+ // {
10
+ // "packageName":"@patternfly/patternfly",
11
+ // "pattern":"**/examples/**/*.md", // had to update this pattern to bring in demos docs
12
+ // "name":"core-component-docs"
13
+ // }
14
+ ]
package/src/globals.ts ADDED
@@ -0,0 +1,53 @@
1
+ export const componentTabs: any = {};
2
+
3
+ export const tabNames: any = {
4
+ 'react': 'React',
5
+ 'react-demos': 'React demos',
6
+ 'react-deprecated': 'React deprecated',
7
+ 'html': 'HTML',
8
+ 'html-demos': 'HTML demos'
9
+ };
10
+
11
+ export const buildTab = (entry: any, tab: string) => {
12
+ const tabEntry = componentTabs[entry.data.id]
13
+
14
+ // if no dictionary entry exists, and tab data exists
15
+ if(tabEntry === undefined && tab) {
16
+ componentTabs[entry.data.id] = [tab]
17
+ // if dictionary entry & tab data exists, and entry does not include tab
18
+ } else if (tabEntry && tab && !tabEntry.includes(tab)) {
19
+ componentTabs[entry.data.id] = [...tabEntry, tab];
20
+ }
21
+ }
22
+
23
+ export const sortTabs = () => {
24
+ const defaultOrder = 50;
25
+ const sourceOrder: any = {
26
+ react: 1,
27
+ 'react-next': 1.1,
28
+ 'react-demos': 2,
29
+ 'react-deprecated': 2.1,
30
+ html: 3,
31
+ 'html-demos': 4,
32
+ 'design-guidelines': 99,
33
+ 'accessibility': 100,
34
+ 'upgrade-guide': 101,
35
+ 'release-notes': 102,
36
+ };
37
+
38
+ const sortSources = (s1: string, s2: string) => {
39
+ const s1Index = sourceOrder[s1] || defaultOrder;
40
+ const s2Index = sourceOrder[s2] || defaultOrder;
41
+ if (s1Index === defaultOrder && s2Index === defaultOrder) {
42
+ return s1.localeCompare(s2);
43
+ }
44
+
45
+ return s1Index > s2Index ? 1 : -1;
46
+ }
47
+
48
+ // Sort tabs entries based on above sort order
49
+ // Ensures all tabs are displayed in a consistent order & which tab gets displayed for a component route without a tab
50
+ Object.values(componentTabs).map((tabs: any) => {
51
+ tabs.sort(sortSources)
52
+ })
53
+ }
@@ -3,27 +3,34 @@ import { getCollection, render } from 'astro:content'
3
3
  import { Title } from '@patternfly/react-core'
4
4
  import MainLayout from '../../layouts/Main.astro'
5
5
  import { content } from "../../content"
6
+ import { kebabCase } from 'change-case'
7
+ import { componentTabs } from '../../globals'
6
8
 
7
9
  export async function getStaticPaths() {
8
10
  const collections = await Promise.all(content.map(async (entry) => await getCollection(entry.name as 'textContent')))
9
11
 
10
12
  return collections.flat().map((entry) => ({
11
- params: { id: entry.id, section: entry.data.section },
13
+ params: { page: kebabCase(entry.data.id), section: entry.data.section },
12
14
  props: { entry, title: entry.data.title },
13
15
  })
14
16
  )
15
17
  }
16
18
 
19
+
17
20
  const { entry } = Astro.props
18
- const { title } = entry.data
21
+ const { title, id, section } = entry.data
19
22
  const { Content } = await render(entry)
23
+
24
+ if(section === 'components') { // if section is components, rewrite to first tab content
25
+ return Astro.rewrite(`/components/${kebabCase(id)}/${componentTabs[id][0]}`);
26
+ }
20
27
  ---
21
28
 
22
29
  <MainLayout>
23
30
  {
24
31
  title && (
25
32
  <Title headingLevel="h1" size="4xl">
26
- {title}
33
+ {title}
27
34
  </Title>
28
35
  )
29
36
  }
@@ -0,0 +1,71 @@
1
+ ---
2
+ import { getCollection, render } from 'astro:content'
3
+ import { Title, PageSection, Content as PFContent } from '@patternfly/react-core'
4
+ import MainLayout from '../../../layouts/Main.astro'
5
+ import { content } from "../../../content"
6
+ import { kebabCase } from 'change-case'
7
+ import { componentTabs, tabNames, buildTab, sortTabs } from '../../../globals';
8
+
9
+ export async function getStaticPaths() {
10
+ const collections = await Promise.all(content.map(async (entry) => await getCollection(entry.name as 'textContent')))
11
+
12
+ const flatCol = collections.flat().map((entry) => {
13
+ // Build tabs dictionary
14
+ let tab = entry.data.tab;
15
+ if(tab) { // check for demos/deprecated
16
+ if(entry.id.includes('demos')) {
17
+ tab = `${tab}-demos`;
18
+ } else if (entry.id.includes('deprecated')) {
19
+ tab = `${tab}-deprecated`;
20
+ }
21
+ }
22
+ buildTab(entry, tab);
23
+
24
+ return {
25
+ params: { page: kebabCase(entry.data.id), section: entry.data.section, tab },
26
+ props: { entry, ...entry.data },
27
+ }
28
+ })
29
+
30
+ sortTabs()
31
+ return flatCol;
32
+ }
33
+
34
+ const { entry } = Astro.props
35
+ const { title, id, section } = entry.data
36
+ const { Content } = await render(entry)
37
+ const currentPath = Astro.url.pathname;
38
+ ---
39
+
40
+ <MainLayout>
41
+ {
42
+ title && (
43
+ <Title headingLevel="h1" size="4xl">
44
+ {title}
45
+ </Title>
46
+ )
47
+ }
48
+ {componentTabs[id] && (
49
+ <PageSection id="ws-sticky-nav-tabs" stickyOnBreakpoint={{ default: 'top' }} type="tabs">
50
+ <div class="pf-v6-c-tabs pf-m-page-insets pf-m-no-border-bottom">
51
+ <ul class="pf-v6-c-tabs__list">
52
+ {componentTabs[id].map((tab: string) => (
53
+ // eslint-disable-next-line react/jsx-key
54
+ <li
55
+ class={`pf-v6-c-tabs__item${currentPath === `/${section}/${kebabCase(id)}/${tab}` ? ' pf-m-current' : ''}`}
56
+ >
57
+ <a class="pf-v6-c-tabs__link" href={`/${section}/${kebabCase(id)}/${tab}`}>
58
+ {tabNames[tab]}
59
+ </a>
60
+ </li>
61
+ ))}
62
+ </ul>
63
+ </div>
64
+ </PageSection>
65
+ )}
66
+ <PageSection id="main-content" isFilled>
67
+ <PFContent>
68
+ <Content />
69
+ </PFContent>
70
+ </PageSection>
71
+ </MainLayout>
@@ -1,28 +0,0 @@
1
- {
2
- "$ref": "#/definitions/dir",
3
- "definitions": {
4
- "dir": {
5
- "type": "object",
6
- "properties": {
7
- "id": {
8
- "type": "string"
9
- },
10
- "section": {
11
- "type": "string"
12
- },
13
- "title": {
14
- "type": "string"
15
- },
16
- "$schema": {
17
- "type": "string"
18
- }
19
- },
20
- "required": [
21
- "id",
22
- "section"
23
- ],
24
- "additionalProperties": false
25
- }
26
- },
27
- "$schema": "http://json-schema.org/draft-07/schema#"
28
- }
@@ -1 +0,0 @@
1
- import{f as ee,_ as O,d as p,h as te,v as B,w as J,B as Q,u as ge,g as Ee,j as L}from"./Button.eaCBj136.js";import{r as n}from"./index.CTH3fVMn.js";/* empty css */import{g as Se,A as xe,a as $,d as be,P as Ie,m as ye}from"./divider.rOVHdw7p.js";import{s as F}from"./page.DycaZ65G.js";const c={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"},Le={},C=n.createContext(Le);class w extends n.Component{constructor(){super(...arguments),this.state={isScrollable:!1,ouiaStateId:ee(w.displayName,this.props.variant),flyoutRef:null},this.navRef=n.createRef()}onSelect(e,t,s,a,l,i){l&&e.preventDefault(),this.props.onSelect(e,{groupId:t,itemId:s,to:a}),i&&i(e,s,t,a)}onToggle(e,t,s){this.props.onToggle(e,{groupId:t,isExpanded:s})}render(){const e=this.props,{"aria-label":t,children:s,className:a,onSelect:l,onToggle:i,ouiaId:r,ouiaSafe:f,variant:m}=e,b=O(e,["aria-label","children","className","onSelect","onToggle","ouiaId","ouiaSafe","variant"]),S=["horizontal","horizontal-subnav"].includes(m);return n.createElement(C.Provider,{value:{onSelect:(h,I,g,R,N,P)=>this.onSelect(h,I,g,R,N,P),onToggle:(h,I,g)=>this.onToggle(h,I,g),updateIsScrollable:h=>this.setState({isScrollable:h}),isHorizontal:["horizontal","horizontal-subnav"].includes(m),flyoutRef:this.state.flyoutRef,setFlyoutRef:h=>this.setState({flyoutRef:h}),navRef:this.navRef}},n.createElement("nav",Object.assign({className:p(c.nav,S&&c.modifiers.horizontal,m==="horizontal-subnav"&&c.modifiers.subnav,this.state.isScrollable&&c.modifiers.scrollable,a),"aria-label":t||(m==="horizontal-subnav"?"Local":"Global"),ref:this.navRef},te(w.displayName,r!==void 0?r:this.state.ouiaStateId,f),b),s))}}w.displayName="Nav";w.defaultProps={onSelect:()=>{},onToggle:()=>{},ouiaSafe:!0};const Ne={isSidebarOpen:!0},M=n.createContext(Ne);class U extends n.Component{constructor(){super(...arguments),this.direction="ltr",this.state={scrollViewAtStart:!1,scrollViewAtEnd:!1},this.navList=n.createRef(),this.observer=()=>{},this.handleScrollButtons=()=>{const e=this.navList.current;if(e){const t=B(e,e.firstChild),s=B(e,e.lastChild);this.setState({scrollViewAtStart:t,scrollViewAtEnd:s}),this.context.updateIsScrollable(!t||!s)}},this.scrollBack=()=>{const e=this.navList.current;if(e){const t=Array.from(e.children);let s,a;for(let l=0;l<t.length&&!s;l++)B(e,t[l])&&(s=t[l],a=t[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 t=Array.from(e.children);let s,a;for(let l=t.length-1;l>=0&&!s;l--)B(e,t[l])&&(s=t[l],a=t[l+1]);a&&(this.direction==="ltr"?e.scrollLeft+=a.scrollWidth:e.scrollLeft-=a.scrollWidth),this.handleScrollButtons()}}}componentDidMount(){this.observer=Se(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:t,className:s,backScrollAriaLabel:a,forwardScrollAriaLabel:l}=e,i=O(e,["children","className","backScrollAriaLabel","forwardScrollAriaLabel"]),{scrollViewAtStart:r,scrollViewAtEnd:f}=this.state;return n.createElement(C.Consumer,null,({isHorizontal:m})=>n.createElement(M.Consumer,null,({isSidebarOpen:b})=>n.createElement(n.Fragment,null,m&&(!r||!f)&&n.createElement("div",{className:p(c.navScrollButton)},n.createElement(Q,{variant:"plain","aria-label":a,onClick:this.scrollBack,isDisabled:r,tabIndex:b?null:-1,icon:n.createElement(xe,null)})),n.createElement("ul",Object.assign({ref:this.navList,className:p(c.navList,s),onScroll:this.handleScrollButtons,role:"list"},i),t),m&&(!r||!f)&&n.createElement("div",{className:p(c.navScrollButton)},n.createElement(Q,{variant:"plain","aria-label":l,onClick:this.scrollForward,isDisabled:f,tabIndex:b?null:-1,icon:n.createElement($,null)})))))}}U.displayName="NavList";U.contextType=C;U.defaultProps={backScrollAriaLabel:"Scroll back",forwardScrollAriaLabel:"Scroll foward"};const W=o=>{var{children:e,styleChildren:t=!0,className:s,to:a,isActive:l=!1,groupId:i=null,itemId:r=null,preventDefault:f=!1,onClick:m,component:b="a",flyout:S,onShowFlyout:h,ouiaId:I,ouiaSafe:g,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:D,navRef:V}=n.useContext(C),{isSidebarOpen:ae}=n.useContext(M),[z,le]=n.useState(null),[oe,H]=n.useState(!1),y=n.useRef(),E=y===T,A=n.useRef(),v=S!==void 0,re=v?"button":b;a&&v&&console.error('NavItem cannot have both "to" and "flyout" props.');const j=(d,u)=>{(!E||u)&&d?D(y):(E||u)&&!d&&D(null),h&&d&&h()},ie=d=>{const u=d.target.closest(`.${c.navItem}.pf-m-flyout`);v&&!E?j(!0):T!==null&&!u&&D(null)},X=d=>{d.target.closest(".pf-m-flyout")||(v?j(!1,!0):T!==null&&D(null))},ce=d=>{var u,x;const k=d.key,K=d.target;(k===" "||k==="Enter"||k==="ArrowRight")&&v&&(!((u=y?.current)===null||u===void 0)&&u.contains(K))&&(d.stopPropagation(),d.preventDefault(),E||(j(!0),le(K))),(k==="Escape"||k==="ArrowLeft")&&((x=A?.current)===null||x===void 0?void 0:x.querySelectorAll(`.${ye.menu}`).length)===1&&E&&(d.stopPropagation(),d.preventDefault(),j(!1))};n.useEffect(()=>(v&&window.addEventListener("click",X),()=>{v&&window.removeEventListener("click",X)}),[]),n.useEffect(()=>{z&&(E?Array.from(A.current.getElementsByTagName("UL")[0].children).filter(u=>!(u.classList.contains("pf-m-disabled")||u.classList.contains(be.divider)))[0].firstChild.focus():z.focus())},[E,z]);const q=n.createElement("span",{className:p(c.navToggle)},n.createElement("span",{className:p(c.navToggleIcon)},n.createElement($,{"aria-hidden":!0}))),de={"aria-haspopup":"menu","aria-expanded":E},G=ae?null:-1,ue=d=>{const u=f||!a;return n.createElement(re,Object.assign({href:a,onClick:x=>d.onSelect(x,i,r,a,u,m),className:p(c.navLink,l&&c.modifiers.current,oe&&c.modifiers.hover,s),"aria-current":l?"page":null,tabIndex:G},v&&Object.assign({},de),P),N&&n.createElement("span",{className:p(c.navLinkIcon)},N),n.createElement("span",{className:p(`${c.nav}__link-text`)},e),S&&q)},pe=(d,u)=>n.cloneElement(u,Object.assign(Object.assign({onClick:x=>d.onSelect(x,i,r,a,f,m),"aria-current":l?"page":null},t&&{className:p(c.navLink,l&&c.modifiers.current,u.props&&u.props.className)}),{tabIndex:u.props.tabIndex||G,children:v?n.createElement(n.Fragment,null,u.props.children,q):u.props.children})),fe=ge(W.displayName,I,g),me=()=>{H(!0)},he=()=>{H(!1)},ve=n.createElement(Ie,{triggerRef:y,popper:n.createElement("div",{ref:A,onMouseEnter:me,onMouseLeave:he},S),popperRef:A,placement:"right-start",isVisible:E,onDocumentKeyDown:ce,zIndex:R,appendTo:V?.current});return n.createElement(n.Fragment,null,n.createElement("li",Object.assign({onMouseOver:ie,className:p(c.navItem,v&&c.modifiers.flyout,s),ref:y},fe),n.createElement(C.Consumer,null,d=>n.isValidElement(e)?pe(d,e):ue(d))),S&&ve)};W.displayName="NavItem";class _ extends n.Component{constructor(){super(...arguments),this.id=this.props.id||Ee(),this.state={expandedState:this.props.isExpanded,ouiaStateId:ee(_.displayName)},this.onExpand=(e,t)=>{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;t(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:t,srText:s,children:a,className:l,isActive:i,ouiaId:r,groupId:f,id:m,isExpanded:b,buttonProps:S,onExpand:h}=e,I=O(e,["title","srText","children","className","isActive","ouiaId","groupId","id","isExpanded","buttonProps","onExpand"]),{expandedState:g,ouiaStateId:R}=this.state;return n.createElement(C.Consumer,null,N=>n.createElement("li",Object.assign({className:p(c.navItem,g&&c.modifiers.expanded,i&&c.modifiers.current,l)},te(_.displayName,r!==void 0?r:R),I),n.createElement(M.Consumer,null,({isSidebarOpen:P})=>n.createElement("button",Object.assign({className:p(c.navLink),id:s?null:this.id,onClick:T=>this.onExpand(T,N.onToggle),"aria-expanded":g,tabIndex:P?null:-1},S),typeof t!="string"?n.createElement("span",{className:p(`${c.nav}__link-text`)},t):t,n.createElement("span",{className:p(c.navToggle)},n.createElement("span",{className:p(c.navToggleIcon)},n.createElement($,{"aria-hidden":"true"}))))),n.createElement("section",{className:p(c.navSubnav),"aria-labelledby":this.id,hidden:g?null:!0},s&&n.createElement("h2",{className:"pf-v6-screen-reader",id:this.id},s),n.createElement("ul",{className:p(c.navList),role:"list"},a))))}}_.displayName="NavExpandable";_.defaultProps={srText:"",isExpanded:!1,children:"",className:"",groupId:null,isActive:!1,id:""};const ne=o=>{var{children:e,className:t,usePageInsets:s,isFilled:a,isContextSelector:l}=o,i=O(o,["children","className","usePageInsets","isFilled","isContextSelector"]);return n.createElement("div",Object.assign({className:p(F.pageSidebarBody,s&&F.modifiers.pageInsets,a===!1&&F.modifiers.noFill,a===!0&&F.modifiers.fill,l===!0&&F.modifiers.contextSelector,t)},i),e)};ne.displayName="PageSidebarBody";const Ae=/([\p{Ll}\d])(\p{Lu})/gu,Ce=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,we=/(\d)\p{Ll}|(\p{L})\d/u,_e=/[^\p{L}\d]+/giu,Y="$1\0$2",Z="";function se(o){let e=o.trim();e=e.replace(Ae,Y).replace(Ce,Y),e=e.replace(_e,"\0");let t=0,s=e.length;for(;e.charAt(t)==="\0";)t++;if(t===s)return[];for(;e.charAt(s-1)==="\0";)s--;return e.slice(t,s).split(/\0/g)}function Re(o){const e=se(o);for(let t=0;t<e.length;t++){const s=e[t],a=we.exec(s);if(a){const l=a.index+(a[1]??a[2]).length;e.splice(t,1,s.slice(0,l),s.slice(l))}}return e}function Pe(o,e){const[t,s,a]=Oe(o,e),l=Te(e?.locale),i=ke(e?.locale),r=Fe(l,i);return t+s.map((f,m)=>m===0?r(f):l(f)).join(" ")+a}function Te(o){return e=>e.toLocaleLowerCase(o)}function ke(o){return e=>e.toLocaleUpperCase(o)}function Fe(o,e){return t=>`${e(t[0])}${o(t.slice(1))}`}function Oe(o,e={}){const t=e.split??(e.separateNumbers?Re:se),s=e.prefixCharacters??Z,a=e.suffixCharacters??Z;let l=0,i=o.length;for(;l<o.length;){const r=o.charAt(l);if(!s.includes(r))break;l++}for(;i>l;){const r=i-1,f=o.charAt(r);if(!a.includes(f))break;i=r}return[o.slice(0,l),t(o.slice(l,i)),o.slice(i)]}const De=({entry:o,isActive:e})=>{const{id:t}=o,{id:s,section:a}=o.data;return L.jsx(W,{itemId:t,to:`/${a}/${t}`,isActive:e,id:`nav-entry-${t}`,children:s})},je=({entries:o,sectionId:e,activeItem:t})=>{const s=window.location.pathname.includes(e),a=o.sort((r,f)=>r.data.id.localeCompare(f.data.id)),l=a.some(r=>r.id===t),i=a.map(r=>L.jsx(De,{entry:r,isActive:t===r.id},r.id));return L.jsx(_,{title:Pe(e),isActive:l,isExpanded:s,id:`nav-section-${e}`,children:i})},We=({navEntries:o})=>{const[e,t]=n.useState("");n.useEffect(()=>{t(window.location.pathname.split("/").reverse()[0])},[]);const s=(i,r)=>{t(r.itemId.toString())},a=new Set(o.map(i=>i.data.section)),l=Array.from(a).map(i=>{const r=o.filter(f=>f.data.section===i);return L.jsx(je,{entries:r,sectionId:i,activeItem:e},i)});return L.jsx(ne,{id:"page-sidebar-body",children:L.jsx(w,{onSelect:s,children:L.jsx(U,{children:l})})})};export{We as Navigation};
@@ -1 +0,0 @@
1
- import{_ as x,B as E,a as O,c as T,j as f}from"./Button.eaCBj136.js";import{s as c}from"./page.DycaZ65G.js";import{r as d}from"./index.CTH3fVMn.js";import{P as B}from"./PageContext.CXYSru7V.js";/* empty css */const m=n=>{var{children:i,isSidebarOpen:t=!0,onSidebarToggle:e=()=>{},id:s="nav-toggle"}=n,l=x(n,["children","isSidebarOpen","onSidebarToggle","id"]);return d.createElement(B,null,({isManagedSidebar:a,onSidebarToggle:b,isSidebarOpen:v})=>{const h=a?b:e,S=a?v:t;return d.createElement(E,Object.assign({id:s,onClick:h,"aria-label":"Side navigation toggle","aria-expanded":S?"true":"false",variant:O.plain},l),i)})};m.displayName="PageToggleButton";const y={name:"BarsIcon",height:512,width:448,svgPath:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z",yOffset:0,xOffset:0},I=T(y);let r=[],o=0;const u=4;let P=n=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let l=o+u;l<r.length;)r[l]===e?r.splice(l,u):l+=u;let s=i.indexOf(e);~s&&(i.splice(s,1),--t.lc||t.off())}},notify(e,s){let l=!r.length;for(let a of i)r.push(a,t.value,e,s);if(l){for(o=0;o<r.length;o+=u)r[o](r[o+1],r[o+2],r[o+3]);r.length=0}},off(){},set(e){let s=t.value;s!==e&&(t.value=e,t.notify(s))},subscribe(e){let s=t.listen(e);return e(t.value),s},value:n};return t};function C(n,i,t){let e=new Set([...i,void 0]);return n.listen((s,l,a)=>{e.has(a)&&t(s,l,a)})}let g=(n,i)=>t=>{n.current=t,i()};function L(n,{keys:i,deps:t=[n,i]}={}){let e=d.useRef();e.current=n.get();let s=d.useCallback(a=>i?.length>0?C(n,i,g(e,a)):n.listen(g(e,a)),t),l=()=>e.current;return d.useSyncExternalStore(s,l,l)}const p=P(!0),z=()=>{const n=L(p);function i(){p.set(!n)}return d.useEffect(()=>{const t=typeof window<"u",e=document.getElementById("page-sidebar-body")?.parentElement;!t||!e||(e.classList.contains(c.pageSidebar)?(e.classList.toggle(c.modifiers.expanded),e.classList.toggle(c.modifiers.collapsed)):e.classList.add(c.pageSidebar,n?c.modifiers.expanded:c.modifiers.collapsed),e.setAttribute("aria-hidden",`${!n}`))},[n]),f.jsx(m,{"aria-label":"Global navigation",onSidebarToggle:i,isSidebarOpen:n,children:f.jsx(I,{})})};export{z as PageToggle};