@patternfly/documentation-framework 6.26.3 → 6.27.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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 6.27.0 (2025-10-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **sideNav:** Adds support for grouped nav with headers and dividers. ([#4754](https://github.com/patternfly/patternfly-org/issues/4754)) ([91f9227](https://github.com/patternfly/patternfly-org/commit/91f92276400dc255f931c7df6c75963adf2c54bc))
12
+
13
+
14
+
15
+
16
+
17
+ ## 6.26.4 (2025-10-09)
18
+
19
+ **Note:** Version bump only for package @patternfly/documentation-framework
20
+
21
+
22
+
23
+
24
+
6
25
  ## 6.26.3 (2025-10-09)
7
26
 
8
27
  **Note:** Version bump only for package @patternfly/documentation-framework
@@ -4,14 +4,21 @@ import {
4
4
  Label,
5
5
  Nav,
6
6
  NavList,
7
+ NavGroup,
7
8
  NavExpandable,
8
9
  PageContextConsumer,
9
10
  capitalize,
10
11
  Flex,
11
- FlexItem
12
+ FlexItem,
13
+ Divider
12
14
  } from '@patternfly/react-core';
13
15
  import { css } from '@patternfly/react-styles';
14
16
  import { Location } from '@reach/router';
17
+
18
+ const DIVIDER_STYLES = {
19
+ marginTop: 'var(--pf-t--global--spacer--md)',
20
+ marginBottom: 'var(--pf-t--global--spacer--md)'
21
+ };
15
22
  import { makeSlug } from '../../helpers';
16
23
  import globalBreakpointXl from '@patternfly/react-tokens/dist/esm/t_global_breakpoint_xl';
17
24
  import { trackEvent } from '../../helpers';
@@ -163,20 +170,45 @@ export const SideNav = ({ groupedRoutes = {}, navItems = [] }) => {
163
170
  }
164
171
  }, []);
165
172
 
173
+ const groupedItems = React.useMemo(() =>
174
+ (navItems || []).filter(entry => entry && entry.title), [navItems]);
175
+ const ungroupedItems = React.useMemo(() =>
176
+ (navItems || []).filter(entry => entry && !entry.title), [navItems]);
177
+
178
+ const renderNavItem = React.useCallback((item) => {
179
+ if (!item) return null;
180
+
181
+ return item.section ? (
182
+ <Location key={item.section}>
183
+ {({ location }) => ExpandableNav({ groupedRoutes, location, section: item.section })}
184
+ </Location>
185
+ ) : NavItem({
186
+ key: item.href || `nav-item-${Math.random()}`,
187
+ text: item.text || (item.href ? capitalize(item.href.replace(/\//g, '').replace(/-/g, ' ')) : 'Untitled'),
188
+ href: item.href
189
+ });
190
+ }, [groupedRoutes]);
191
+
166
192
  return (
167
193
  <Nav aria-label="Side Nav" theme="light">
168
- <NavList className="ws-side-nav-list">
169
- {navItems.map(({ section, text, href }) =>
170
- section ? (
171
- <Location key={section}>{({ location }) => ExpandableNav({ groupedRoutes, location, section })}</Location>
172
- ) : (
173
- NavItem({
174
- text: text || capitalize(href.replace(/\//g, '').replace(/-/g, ' ')),
175
- href: href
176
- })
177
- )
178
- )}
179
- </NavList>
194
+ {/* Render grouped items */}
195
+ {groupedItems.map((group) => (
196
+ <React.Fragment key={group.title}>
197
+ <NavGroup title={group.title}>
198
+ <NavList className="ws-side-nav-list" aria-label={`${group.title} navigation`}>
199
+ {group.items.map(renderNavItem)}
200
+ </NavList>
201
+ </NavGroup>
202
+ {group.hasDivider && <Divider style={DIVIDER_STYLES} />}
203
+ </React.Fragment>
204
+ ))}
205
+
206
+ {/* Render ungrouped items - this handles the current flat structure */}
207
+ {ungroupedItems.length > 0 && (
208
+ <NavList className="ws-side-nav-list">
209
+ {ungroupedItems.map(renderNavItem)}
210
+ </NavList>
211
+ )}
180
212
  </Nav>
181
213
  );
182
- };
214
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@patternfly/documentation-framework",
3
3
  "description": "A framework to build documentation for PatternFly.",
4
- "version": "6.26.3",
4
+ "version": "6.27.0",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -12,7 +12,7 @@
12
12
  "@babel/preset-env": "7.27.1",
13
13
  "@babel/preset-react": "^7.24.1",
14
14
  "@mdx-js/util": "1.6.16",
15
- "@patternfly/ast-helpers": "^1.4.0-alpha.288",
15
+ "@patternfly/ast-helpers": "^1.4.0-alpha.290",
16
16
  "@reach/router": "npm:@gatsbyjs/reach-router@1.3.9",
17
17
  "autoprefixer": "10.4.19",
18
18
  "babel-loader": "^9.1.3",
@@ -95,5 +95,5 @@
95
95
  "http-cache-semantics": ">=4.1.1",
96
96
  "nanoid": "3.3.8"
97
97
  },
98
- "gitHead": "e82225dc040a0e72d930004a05587785ce5227a4"
98
+ "gitHead": "777009a54b36e38d563933c2f39b5f34384abd86"
99
99
  }