@patternfly/patternfly-doc-core 1.8.0 → 1.8.2

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 (26) hide show
  1. package/dist/client/_astro/Navigation.zYUnVsp7.js +1 -0
  2. package/dist/client/_astro/{_page_.BWicMEzd.css → _page_.D1z73Byz.css} +1 -1
  3. package/dist/client/components/accordion/index.html +9 -9
  4. package/dist/client/components/accordion/react/index.html +9 -9
  5. package/dist/client/components/all-components/index.html +8 -8
  6. package/dist/client/design-foundations/typography/index.html +9 -9
  7. package/dist/client/design-foundations/usage-and-behavior/index.html +9 -9
  8. package/dist/client/get-started/contribute/index.html +9 -9
  9. package/dist/client/index.html +2 -2
  10. package/dist/server/chunks/{CSSTable_CG80uW98.mjs → AutoLinkHeader_C2GD0g-K.mjs} +45 -45
  11. package/dist/server/chunks/CSSTable_B8tlH3gz.mjs +18 -0
  12. package/dist/server/chunks/{PropsTables_DUo7F9VR.mjs → PropsTables_PVzRHJNB.mjs} +7 -6
  13. package/dist/server/chunks/{angle-down-icon_DtGGiMR5.mjs → angle-down-icon_BO1Ed-9Z.mjs} +1 -1
  14. package/dist/server/entry.mjs +3 -3
  15. package/dist/server/{manifest_CXkcH4VT.mjs → manifest_QF66rQCk.mjs} +1 -1
  16. package/package.json +2 -2
  17. package/src/components/Navigation.astro +3 -4
  18. package/src/components/Navigation.tsx +12 -10
  19. package/src/components/PropsTable.tsx +2 -2
  20. package/src/components/PropsTables.astro +24 -10
  21. package/src/layouts/Main.astro +28 -0
  22. package/src/styles/global.scss +1 -0
  23. package/dist/client/_astro/Navigation.CnvE1VCH.js +0 -1
  24. package/dist/server/chunks/CSSTable_Dj2CroFz.mjs +0 -4
  25. package/dist/server/chunks/Stack_Xm3fJVbK.mjs +0 -22
  26. /package/dist/server/chunks/{Button_DVSwQ8oX.mjs → Button_BKhHR-ak.mjs} +0 -0
@@ -15,8 +15,7 @@ const collections = await Promise.all(
15
15
  )
16
16
 
17
17
  const navDataRaw = collections.flat();
18
- const uniqueSections = new Set(navDataRaw.map((entry) => entry.data.section));
19
- const navData: Record<string, TextContentEntry[]> = {};
18
+ const uniqueSections = new Set(navDataRaw.map((entry) => entry.data.section as string));
20
19
 
21
20
  const [orderedSections, unorderedSections] = Array.from(uniqueSections).reduce(
22
21
  (acc, section) => {
@@ -37,7 +36,7 @@ const [orderedSections, unorderedSections] = Array.from(uniqueSections).reduce(
37
36
  )
38
37
 
39
38
  const sortedSections = [...orderedSections, ...unorderedSections.sort()]
40
- sortedSections.map((section) => {
39
+ const navData = sortedSections.map((section) => {
41
40
  const entries = navDataRaw
42
41
  .filter((entry) => entry.data.section === section)
43
42
  .map(entry => ({ id: entry.id, data: { id: entry.data.id, section, sortValue: entry.data.sortValue }} as TextContentEntry))
@@ -68,7 +67,7 @@ sortedSections.map((section) => {
68
67
  return a.data.id.localeCompare(b.data.id)
69
68
  })
70
69
 
71
- navData[section] = sortedUniqueEntries;
70
+ return sortedUniqueEntries
72
71
  })
73
72
 
74
73
  ---
@@ -2,9 +2,8 @@ import { useEffect, useState } from 'react'
2
2
  import { Nav, NavList, PageSidebarBody } from '@patternfly/react-core'
3
3
  import { NavSection } from './NavSection'
4
4
  import { type TextContentEntry } from './NavEntry'
5
-
6
5
  interface NavigationProps {
7
- navData: Record<string, TextContentEntry[]>
6
+ navData: TextContentEntry[][]
8
7
  }
9
8
 
10
9
  export const Navigation: React.FunctionComponent<NavigationProps> = ({
@@ -29,14 +28,17 @@ export const Navigation: React.FunctionComponent<NavigationProps> = ({
29
28
  <PageSidebarBody id="page-sidebar-body">
30
29
  <Nav onSelect={onNavSelect}>
31
30
  <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
- ))}
31
+ {navData.map((navEntries) => {
32
+ const { section } = navEntries[0].data
33
+ return (
34
+ <NavSection
35
+ key={section}
36
+ entries={navEntries}
37
+ sectionId={section}
38
+ activeItem={activeItem}
39
+ />
40
+ )
41
+ })}
40
42
  </NavList>
41
43
  </Nav>
42
44
  </PageSidebarBody>
@@ -11,6 +11,7 @@ import {
11
11
  import { css } from '@patternfly/react-styles'
12
12
  import accessibleStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility'
13
13
  import textStyles from '@patternfly/react-styles/css/utilities/Text/text'
14
+ import { Content } from '@patternfly/react-core'
14
15
 
15
16
  export type ComponentProp = {
16
17
  name: string
@@ -36,7 +37,6 @@ export const PropsTable: React.FunctionComponent<PropsTableProps> = ({
36
37
  componentDescription,
37
38
  componentProps,
38
39
  }) => {
39
- const SectionHeading = headingLevel
40
40
  const publicProps = componentProps?.filter((prop) => !prop.isHidden)
41
41
  const hasPropsToRender = !!publicProps?.length
42
42
 
@@ -77,7 +77,7 @@ export const PropsTable: React.FunctionComponent<PropsTableProps> = ({
77
77
 
78
78
  return (
79
79
  <div>
80
- <SectionHeading>{componentName}</SectionHeading>
80
+ <Content component={headingLevel}>{componentName}</Content>
81
81
  <Stack hasGutter>
82
82
  {componentDescription && (
83
83
  <div
@@ -1,5 +1,7 @@
1
1
  ---
2
2
  import { PropsTable } from './PropsTable'
3
+ import { Stack, StackItem } from '@patternfly/react-core'
4
+ import { AutoLinkHeader } from './AutoLinkHeader'
3
5
 
4
6
  async function getPropsData(propComponents?: string[]) {
5
7
  if (!propComponents || propComponents.length === 0) {
@@ -25,14 +27,26 @@ const propsData = await getPropsData(propComponents)
25
27
  ---
26
28
 
27
29
  {
28
- propsData
29
- .filter((comp: any) => !!comp)
30
- .map((component: any) => (
31
- <PropsTable
32
- key={component.name}
33
- componentName={component.name}
34
- componentDescription={component.description}
35
- componentProps={component.props}
36
- />
37
- ))
30
+ <Stack hasGutter>
31
+ <StackItem>
32
+ <AutoLinkHeader
33
+ headingLevel="h2"
34
+ className="pf-v6-c-content--h2"
35
+ id="props-table"
36
+ >
37
+ Props
38
+ </AutoLinkHeader>
39
+ </StackItem>
40
+ {propsData
41
+ .filter((comp: any) => !!comp)
42
+ .map((component: any) => (
43
+ <StackItem key={component.name}>
44
+ <PropsTable
45
+ componentName={component.name}
46
+ componentDescription={component.description}
47
+ componentProps={component.props}
48
+ />
49
+ </StackItem>
50
+ ))}
51
+ </Stack>
38
52
  }
@@ -38,4 +38,32 @@ import Navigation from '../components/Navigation.astro'
38
38
  ?.querySelector('html')
39
39
  ?.classList.toggle('pf-v6-theme-dark', themePreference === 'dark')
40
40
  })
41
+
42
+ const scrollToHash = (hash: string) => {
43
+ const targetElement = document.querySelector(hash)
44
+ if (targetElement) {
45
+ targetElement.scrollIntoView({ behavior: 'smooth' })
46
+ }
47
+ }
48
+
49
+ document.addEventListener('DOMContentLoaded', () => {
50
+ if (window.location.hash) {
51
+ const hash = window.location.hash
52
+
53
+ // Without this, page would focus on anchor link without scrolling to it
54
+ history.replaceState(null, '', ' ')
55
+
56
+ setTimeout(() => {
57
+ scrollToHash(hash)
58
+ history.replaceState(null, '', hash)
59
+ }, 500)
60
+ }
61
+ })
62
+
63
+ // Handle changes that happen after the initial page load
64
+ window.addEventListener('hashchange', () => {
65
+ if (window.location.hash) {
66
+ scrollToHash(window.location.hash)
67
+ }
68
+ })
41
69
  </script>
@@ -14,6 +14,7 @@
14
14
 
15
15
  .ws-heading {
16
16
  position: relative;
17
+ scroll-margin-top: 3rem;
17
18
  }
18
19
 
19
20
  .ws-heading-anchor {
@@ -1 +0,0 @@
1
- import{j as n}from"./Button.IBWho7ny.js";import{r as d}from"./index.eCxJ45ll.js";import{k as c,s as m}from"./index.CAChmxYj.js";import{c as p,b as l,e as v,N as x,d as j}from"./PageSidebarBody.vGxFk_DU.js";/* empty css */import"./angle-left-icon.C3MzYN3k.js";import"./divider.O4WEhuBq.js";import"./index.BQFV5hT1.js";import"./page.BTC3Kf3x.js";import"./PageContext.ipir86Hm.js";const u=({entry:s,isActive:o})=>{const{id:a}=s,{id:r,section:e}=s.data,t=e==="components"||e==="layouts"?c(r):a;return n.jsx(p,{itemId:t,to:`/${e}/${t}`,isActive:o,id:`nav-entry-${t}`,children:r})},N=({entries:s,sectionId:o,activeItem:a})=>{const r=window.location.pathname.includes(c(o)),e=s.some(i=>i.id===a),t=s.map(i=>n.jsx(u,{entry:i,isActive:a===i.id||window.location.pathname.includes(c(i.data.id))},i.id));return n.jsx(l,{title:m(o),isActive:e,isExpanded:r,id:`nav-section-${o}`,children:t})},k=({navData:s})=>{const[o,a]=d.useState("");d.useEffect(()=>{a(window.location.pathname.split("/").reverse()[0])},[]);const r=(e,t)=>{a(t.itemId.toString())};return n.jsx(v,{id:"page-sidebar-body",children:n.jsx(x,{onSelect:r,children:n.jsx(j,{children:Object.entries(s).map(([e,t],i)=>n.jsx(N,{entries:t,sectionId:e,activeItem:o},i))})})})};export{k as Navigation};
@@ -1,4 +0,0 @@
1
- import './astro/server_Cl9jPh4p.mjs';
2
- import 'kleur/colors';
3
- export { $ as default, a as file, b as url } from './CSSTable_CG80uW98.mjs';
4
- import './Stack_Xm3fJVbK.mjs';
@@ -1,22 +0,0 @@
1
- import { __rest } from 'tslib';
2
- import { jsx } from 'react/jsx-runtime';
3
- /* empty css */
4
- import { c as css } from './Button_DVSwQ8oX.mjs';
5
-
6
- const styles = {
7
- "modifiers": {
8
- "fill": "pf-m-fill",
9
- "gutter": "pf-m-gutter"
10
- },
11
- "stack": "pf-v6-l-stack",
12
- "stackItem": "pf-v6-l-stack__item"
13
- };
14
-
15
- const Stack = (_a) => {
16
- var { hasGutter = false, className = '', children = null, component = 'div' } = _a, props = __rest(_a, ["hasGutter", "className", "children", "component"]);
17
- const Component = component;
18
- return (jsx(Component, Object.assign({}, props, { className: css(styles.stack, hasGutter && styles.modifiers.gutter, className), children: children })));
19
- };
20
- Stack.displayName = 'Stack';
21
-
22
- export { Stack as S, styles as s };