@patternfly/patternfly-doc-core 1.7.0 → 1.8.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 (57) hide show
  1. package/.astro/collections/examples.schema.json +3 -0
  2. package/.astro/collections/textContent.schema.json +3 -0
  3. package/.astro/content-modules.mjs +1 -0
  4. package/dist/client/_astro/{CSSTable.DHtMmTtQ.js → CSSTable.V4xaGXjj.js} +2 -2
  5. package/dist/client/_astro/Content.Dv9vgAns.js +1 -0
  6. package/dist/client/_astro/DropdownGroup.DmTizX-Q.js +1 -0
  7. package/dist/client/_astro/DropdownList.BUcpBUVP.js +1 -0
  8. package/dist/client/_astro/LiveExample.CiM2pGMB.js +18 -0
  9. package/dist/client/_astro/Navigation.CnvE1VCH.js +1 -0
  10. package/dist/client/_astro/PageSidebarBody.vGxFk_DU.js +1 -0
  11. package/dist/client/_astro/SearchInput.BwWsXfyf.js +1 -0
  12. package/dist/client/_astro/SectionGallery.DqD5bUWQ.js +1 -0
  13. package/dist/client/_astro/Toolbar.BmilfRHR.js +1 -0
  14. package/dist/client/_astro/ToolbarContent.Cd-kqxku.js +1 -0
  15. package/dist/client/_astro/angle-left-icon.C3MzYN3k.js +1 -0
  16. package/dist/client/_astro/divider.O4WEhuBq.js +1 -0
  17. package/dist/client/_astro/help-icon.Du6t7nyh.js +8 -0
  18. package/dist/client/_astro/index.BkswdOFP.js +16 -0
  19. package/dist/client/_astro/index.CAChmxYj.js +1 -0
  20. package/dist/client/components/accordion/index.html +16 -16
  21. package/dist/client/components/accordion/react/index.html +110 -0
  22. package/dist/client/components/all-components/index.html +97 -0
  23. package/dist/client/design-foundations/typography/index.html +11 -9
  24. package/dist/client/design-foundations/usage-and-behavior/index.html +11 -9
  25. package/dist/client/get-started/contribute/index.html +11 -9
  26. package/dist/client/index.html +1 -1
  27. package/dist/server/chunks/_astro_data-layer-content_D4Ib_RjR.mjs +1 -0
  28. package/dist/server/chunks/content-modules_fX1c2JRG.mjs +1 -0
  29. package/dist/server/entry.mjs +1 -1
  30. package/dist/server/{manifest_Dpwo8Jjv.mjs → manifest_CXkcH4VT.mjs} +1 -1
  31. package/package.json +1 -1
  32. package/src/components/NavEntry.tsx +3 -0
  33. package/src/components/Navigation.astro +16 -9
  34. package/src/components/section-gallery/SectionGallery.astro +19 -0
  35. package/src/components/section-gallery/SectionGallery.css +20 -0
  36. package/src/components/section-gallery/SectionGallery.tsx +111 -0
  37. package/src/components/section-gallery/SectionGalleryGridLayout.tsx +97 -0
  38. package/src/components/section-gallery/SectionGalleryListLayout.tsx +108 -0
  39. package/src/components/section-gallery/SectionGalleryToolbar.tsx +93 -0
  40. package/src/content.config.ts +2 -1
  41. package/src/pages/[section]/[...page].astro +17 -13
  42. package/src/pages/[section]/[page]/[...tab].astro +17 -20
  43. package/textContent/AllComponents.mdx +16 -0
  44. package/textContent/components-data.js +476 -0
  45. package/textContent/examples/Accordion/Accordion.mdx +1 -0
  46. package/dist/client/_astro/LiveExample.CwKQ5TSc.js +0 -33
  47. package/dist/client/_astro/Navigation.BSSYIa2f.js +0 -1
  48. package/dist/client/_astro/PageSidebarBody.tzSXGYXP.js +0 -1
  49. package/dist/client/_astro/SearchInput.BjY-zTwj.js +0 -1
  50. package/dist/client/_astro/Toolbar.D4TQG77s.js +0 -1
  51. package/dist/client/_astro/ToolbarContent.DzYW_pmy.js +0 -1
  52. package/dist/client/_astro/divider.DTvtnAAt.js +0 -1
  53. package/dist/client/_astro/help-icon.CDKTE3GW.js +0 -8
  54. /package/dist/server/chunks/{Accordion_CGgMUho2.mjs → Accordion_BJka4Qvb.mjs} +0 -0
  55. /package/dist/server/chunks/{Accordion_DlM2LvlF.mjs → Accordion_BQIphkaZ.mjs} +0 -0
  56. /package/dist/server/chunks/{_astro_data-layer-content_1EAcQtZj.mjs → AllComponents_CRhgTsiT.mjs} +0 -0
  57. /package/dist/server/chunks/{content-modules_BzUEG69n.mjs → AllComponents_CjOtwUH6.mjs} +0 -0
@@ -0,0 +1,97 @@
1
+ import React from 'react'
2
+ import {
3
+ Gallery,
4
+ GalleryItem,
5
+ Card,
6
+ CardHeader,
7
+ CardTitle,
8
+ CardBody,
9
+ CardFooter,
10
+ Label,
11
+ Content,
12
+ } from '@patternfly/react-core'
13
+ import { SectionGalleryItem } from './SectionGallery'
14
+ import { sentenceCase } from 'change-case'
15
+ import { convertToReactComponent } from '@patternfly/ast-helpers'
16
+
17
+ interface SectionGalleryGridLayoutProps {
18
+ /** Section where the gallery is located */
19
+ section: string
20
+ /** List of gallery items */
21
+ galleryItems: SectionGalleryItem[]
22
+ /** Indicates the grid layout has item summary text */
23
+ hasGridText: boolean
24
+ /** Indicates the grid layout has item images */
25
+ hasGridImages: boolean
26
+ }
27
+
28
+ export const SectionGalleryGridLayout = ({
29
+ section,
30
+ galleryItems,
31
+ hasGridText,
32
+ hasGridImages,
33
+ }: SectionGalleryGridLayoutProps) => (
34
+ <Gallery hasGutter>
35
+ {galleryItems.map(({ name, img, data }, idx) => {
36
+ const itemLink = data.link || `/${section}/${name}`
37
+
38
+ //TODO: rethink how JSX / enriched content is passed to framework
39
+ const summaryNoLinks = data.summary.replace(
40
+ /<a[^>]*>([^<]+)<\/a>/gm,
41
+ '$1',
42
+ )
43
+ const { code } = convertToReactComponent(`<>${summaryNoLinks}</>`)
44
+ const getSummaryComponent = new Function('React', code)
45
+
46
+ return (
47
+ <GalleryItem span={4} key={idx}>
48
+ <Card id={name} key={idx} isClickable>
49
+ <CardHeader
50
+ selectableActions={{
51
+ to: itemLink,
52
+ selectableActionId: `${name}-input`,
53
+ selectableActionAriaLabelledby: name,
54
+ name: `clickable-card-${idx}`,
55
+ }}
56
+ >
57
+ <CardTitle>{sentenceCase(name)}</CardTitle>
58
+ </CardHeader>
59
+ {(hasGridImages || hasGridText) && (
60
+ <CardBody>
61
+ {hasGridImages && img && (
62
+ <img src={img.src} alt={`${name} illustration`} /> // verify whether this img.src approach is correct
63
+ )}
64
+ {hasGridText && (
65
+ <Content isEditorial>
66
+ <Content component="p">
67
+ {getSummaryComponent(React)}
68
+ </Content>
69
+ </Content>
70
+ )}
71
+ </CardBody>
72
+ )}
73
+ {data.label && (
74
+ <CardFooter>
75
+ {data.label === 'beta' && (
76
+ <Label color="blue" isCompact>
77
+ Beta
78
+ </Label>
79
+ )}
80
+ {data.label === 'deprecated' && (
81
+ <Label color="grey" isCompact>
82
+ Deprecated
83
+ </Label>
84
+ )}
85
+ {data.label === 'demo' && (
86
+ <Label color="purple" isCompact>
87
+ Demo
88
+ </Label>
89
+ )}
90
+ </CardFooter>
91
+ )}
92
+ </Card>
93
+ </GalleryItem>
94
+ )
95
+ })}
96
+ </Gallery>
97
+ )
@@ -0,0 +1,108 @@
1
+ import React from 'react'
2
+ import {
3
+ DataList,
4
+ DataListItem,
5
+ DataListItemRow,
6
+ DataListItemCells,
7
+ DataListCell,
8
+ Split,
9
+ SplitItem,
10
+ Label,
11
+ Content,
12
+ ContentVariants,
13
+ } from '@patternfly/react-core'
14
+ import { SectionGalleryItem } from './SectionGallery'
15
+ import { sentenceCase } from 'change-case'
16
+ import { convertToReactComponent } from '@patternfly/ast-helpers'
17
+
18
+ interface SectionGalleryListLayoutProps {
19
+ /** Section where the gallery is located */
20
+ section: string
21
+ /** List of gallery items */
22
+ galleryItems: SectionGalleryItem[]
23
+ /** Indicates the list layout has item summary text */
24
+ hasListText: boolean
25
+ /** Indicates the list layout has item images */
26
+ hasListImages: boolean
27
+ }
28
+
29
+ export const SectionGalleryListLayout = ({
30
+ section,
31
+ galleryItems,
32
+ hasListText,
33
+ hasListImages,
34
+ }: SectionGalleryListLayoutProps) => (
35
+ <DataList onSelectDataListItem={() => {}} aria-label="gallery-list">
36
+ {galleryItems.map(({ name, img, data }, idx) => {
37
+ const itemLink = data.link || `/${section}/${name}`
38
+
39
+ //TODO: rethink how JSX / enriched content is passed to framework
40
+ const summaryNoLinks = data.summary.replace(
41
+ /<a[^>]*>([^<]+)<\/a>/gm,
42
+ '$1',
43
+ )
44
+ const { code } = convertToReactComponent(`<>${summaryNoLinks}</>`)
45
+ const getSummaryComponent = new Function('React', code)
46
+
47
+ return (
48
+ <a href={itemLink} key={idx} className="ws-section-gallery-item">
49
+ <DataListItem>
50
+ <DataListItemRow>
51
+ <DataListItemCells
52
+ dataListCells={[
53
+ hasListImages && img && (
54
+ <DataListCell width={1} key="illustration">
55
+ <div>
56
+ <img
57
+ src={img.src} // same as GridLayout, check whether this is the best method
58
+ alt={`${name} illustration`}
59
+ />
60
+ </div>
61
+ </DataListCell>
62
+ ),
63
+ <DataListCell width={5} key="text-description">
64
+ <Split
65
+ className={hasListText ? 'pf-v6-u-mb-md' : undefined}
66
+ >
67
+ <SplitItem isFilled>
68
+ <Content isEditorial>
69
+ <Content component={ContentVariants.h2}>
70
+ <span>{sentenceCase(name)}</span>
71
+ </Content>
72
+ </Content>
73
+ </SplitItem>
74
+ <SplitItem>
75
+ {data.label === 'beta' && (
76
+ <Label color="blue" isCompact>
77
+ Beta
78
+ </Label>
79
+ )}
80
+ {data.label === 'deprecated' && (
81
+ <Label color="grey" isCompact>
82
+ Deprecated
83
+ </Label>
84
+ )}
85
+ {data.label === 'demo' && (
86
+ <Label color="purple" isCompact>
87
+ Demo
88
+ </Label>
89
+ )}
90
+ </SplitItem>
91
+ </Split>
92
+ {hasListText && (
93
+ <Content isEditorial>
94
+ <Content component="p">
95
+ {getSummaryComponent(React)}
96
+ </Content>
97
+ </Content>
98
+ )}
99
+ </DataListCell>,
100
+ ]}
101
+ />
102
+ </DataListItemRow>
103
+ </DataListItem>
104
+ </a>
105
+ )
106
+ })}
107
+ </DataList>
108
+ )
@@ -0,0 +1,93 @@
1
+ import { CSSProperties, Dispatch, SetStateAction } from 'react'
2
+ import {
3
+ Button,
4
+ SearchInput,
5
+ Toolbar,
6
+ ToolbarContent,
7
+ ToolbarItem,
8
+ Content,
9
+ ContentVariants,
10
+ ToggleGroup,
11
+ ToggleGroupItem,
12
+ } from '@patternfly/react-core'
13
+ import ListIcon from '@patternfly/react-icons/dist/esm/icons/list-icon'
14
+ import ThIcon from '@patternfly/react-icons/dist/esm/icons/th-icon'
15
+
16
+ interface SectionGalleryToolbarProps {
17
+ /** Total count of gallery items */
18
+ galleryItemCount: number
19
+ /** Current search term */
20
+ searchTerm: string
21
+ /** Setter for search term */
22
+ setSearchTerm: Dispatch<SetStateAction<string>>
23
+ /** Current layout */
24
+ layoutView: 'grid' | 'list'
25
+ /** Setter for layout */
26
+ setLayoutView: Dispatch<SetStateAction<'grid' | 'list'>>
27
+ /** Placeholder text for the gallery search input */
28
+ placeholderText?: string
29
+ /** Text for the amount of gallery items */
30
+ countText?: string
31
+ }
32
+
33
+ export const SectionGalleryToolbar = ({
34
+ galleryItemCount,
35
+ searchTerm,
36
+ setSearchTerm,
37
+ layoutView,
38
+ setLayoutView,
39
+ placeholderText = 'Search by name',
40
+ countText = ' items',
41
+ }: SectionGalleryToolbarProps) => (
42
+ <Toolbar isSticky>
43
+ <ToolbarContent>
44
+ <ToolbarItem>
45
+ <SearchInput
46
+ value={searchTerm}
47
+ placeholder={placeholderText}
48
+ onChange={(_evt, val) => {
49
+ setSearchTerm(val)
50
+ }}
51
+ />
52
+ </ToolbarItem>
53
+ {searchTerm && (
54
+ <ToolbarItem>
55
+ <Button variant="link" onClick={() => setSearchTerm('')}>
56
+ Reset
57
+ </Button>
58
+ </ToolbarItem>
59
+ )}
60
+ <ToolbarItem>
61
+ <ToggleGroup>
62
+ <ToggleGroupItem
63
+ icon={<ThIcon />}
64
+ aria-label="grid icon button"
65
+ isSelected={layoutView === 'grid'}
66
+ onChange={() => setLayoutView('grid')}
67
+ ></ToggleGroupItem>
68
+ <ToggleGroupItem
69
+ icon={<ListIcon />}
70
+ aria-label="list icon button"
71
+ isSelected={layoutView === 'list'}
72
+ onChange={() => setLayoutView('list')}
73
+ ></ToggleGroupItem>
74
+ </ToggleGroup>
75
+ </ToolbarItem>
76
+ <ToolbarItem
77
+ variant="pagination"
78
+ gap={{ default: 'gapMd', md: 'gapNone' }}
79
+ style={
80
+ {
81
+ '--pf-v6-c-toolbar__item--MinWidth': 'max-content',
82
+ } as CSSProperties
83
+ }
84
+ className="pf-m-align-self-center"
85
+ >
86
+ <Content isEditorial component={ContentVariants.small}>
87
+ {galleryItemCount}
88
+ {countText}
89
+ </Content>
90
+ </ToolbarItem>
91
+ </ToolbarContent>
92
+ </Toolbar>
93
+ )
@@ -28,7 +28,8 @@ function defineContent(contentObj: CollectionDefinition) {
28
28
  subsection: z.string().optional(),
29
29
  title: z.string().optional(),
30
30
  propComponents: z.array(z.string()).optional(),
31
- tab: z.string().optional().default(tabMap[name]),
31
+ tab: z.string().optional().default(tabMap[name]), // for component tabs
32
+ sortValue: z.number().optional(), // used for sorting nav entries,
32
33
  cssPrefix: z
33
34
  .union([
34
35
  z.string().transform((val) => [val]),
@@ -1,12 +1,13 @@
1
1
  ---
2
2
  import { getCollection, render } from 'astro:content'
3
- import { Title, Stack, StackItem } from '@patternfly/react-core'
3
+ import { Title, PageSection, Stack, StackItem } from '@patternfly/react-core'
4
4
  import MainLayout from '../../layouts/Main.astro'
5
5
  import { content } from '../../content'
6
6
  import { kebabCase } from 'change-case'
7
7
  import { componentTabs } from '../../globals'
8
8
  import PropsTables from '../../components/PropsTables.astro'
9
9
  import CSSTable from '../../components/CSSTable.astro'
10
+ import SectionGallery from '../../components/section-gallery/SectionGallery.astro'
10
11
 
11
12
  export async function getStaticPaths() {
12
13
  const collections = await Promise.all(
@@ -30,9 +31,8 @@ const { entry, propComponents, cssPrefix } = Astro.props
30
31
  const { title, id, section } = entry.data
31
32
  const { Content } = await render(entry)
32
33
 
33
- if (section === 'components') {
34
- // if section is components, rewrite to first tab content
35
- return Astro.rewrite(`/components/${kebabCase(id)}/${componentTabs[id][0]}`)
34
+ if(section === 'components' && componentTabs[id]) { // if section is components & tab exists, rewrite to first tab content
35
+ return Astro.rewrite(`/components/${kebabCase(id)}/${componentTabs[id][0]}`);
36
36
  }
37
37
  ---
38
38
 
@@ -44,13 +44,17 @@ if (section === 'components') {
44
44
  </Title>
45
45
  )
46
46
  }
47
- <Content />
48
- <Stack hasGutter>
49
- <StackItem>
50
- <PropsTables propComponents={propComponents} server:defer />
51
- </StackItem>
52
- <StackItem>
53
- <CSSTable cssPrefix={cssPrefix} server:defer />
54
- </StackItem>
55
- </Stack>
47
+ <PageSection id="main-content" isFilled>
48
+ <Content components={{
49
+ SectionGallery
50
+ }}/>
51
+ <Stack hasGutter>
52
+ <StackItem>
53
+ <PropsTables propComponents={propComponents} server:defer />
54
+ </StackItem>
55
+ <StackItem>
56
+ <CSSTable cssPrefix={cssPrefix} server:defer />
57
+ </StackItem>
58
+ </Stack>
59
+ </PageSection>
56
60
  </MainLayout>
@@ -36,28 +36,25 @@ export async function getStaticPaths() {
36
36
  ),
37
37
  )
38
38
 
39
- const flatCol = collections.flat().map((entry) => {
40
- // Build tabs dictionary
41
- let tab = entry.data.tab
42
- if (tab) {
43
- // check for demos/deprecated
44
- if (entry.id.includes('demos')) {
45
- tab = `${tab}-demos`
46
- } else if (entry.id.includes('deprecated')) {
47
- tab = `${tab}-deprecated`
39
+ const flatCol = collections.flat()
40
+ .filter((entry) => entry.data.tab) // only pages with a tab should match this route
41
+ .map((entry) => {
42
+ // Build tabs dictionary
43
+ let tab = entry.data.tab;
44
+ if(tab) { // check for demos/deprecated
45
+ if(entry.id.includes('demos')) {
46
+ tab = `${tab}-demos`;
47
+ } else if (entry.id.includes('deprecated')) {
48
+ tab = `${tab}-deprecated`;
49
+ }
48
50
  }
49
- }
50
- buildTab(entry, tab)
51
+ buildTab(entry, tab);
51
52
 
52
- return {
53
- params: {
54
- page: kebabCase(entry.data.id),
55
- section: entry.data.section,
56
- tab,
57
- },
58
- props: { entry, ...entry.data },
59
- }
60
- })
53
+ return {
54
+ params: { page: kebabCase(entry.data.id), section: entry.data.section, tab },
55
+ props: { entry, ...entry.data },
56
+ }
57
+ })
61
58
 
62
59
  sortTabs()
63
60
  return flatCol
@@ -0,0 +1,16 @@
1
+ ---
2
+ id: All components
3
+ title: All components
4
+ section: components
5
+ sortValue: 1
6
+ ---
7
+
8
+ import { componentsData } from './components-data.js'
9
+
10
+ <SectionGallery
11
+ section="components"
12
+ galleryItemsData={componentsData}
13
+ placeholderText="Search components by name"
14
+ hasGridText
15
+ hasListText
16
+ />