@patternfly/react-core 6.5.0-prerelease.25 → 6.5.0-prerelease.27

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 (163) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/components/package.json +1 -1
  4. package/deprecated/package.json +1 -1
  5. package/dist/dynamic/components/AboutModal/package.json +1 -1
  6. package/dist/dynamic/components/Accordion/package.json +1 -1
  7. package/dist/dynamic/components/ActionList/package.json +1 -1
  8. package/dist/dynamic/components/Alert/package.json +1 -1
  9. package/dist/dynamic/components/Avatar/package.json +1 -1
  10. package/dist/dynamic/components/BackToTop/package.json +1 -1
  11. package/dist/dynamic/components/Backdrop/package.json +1 -1
  12. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  13. package/dist/dynamic/components/Badge/package.json +1 -1
  14. package/dist/dynamic/components/Banner/package.json +1 -1
  15. package/dist/dynamic/components/Brand/package.json +1 -1
  16. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  17. package/dist/dynamic/components/Button/package.json +1 -1
  18. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  19. package/dist/dynamic/components/Card/package.json +1 -1
  20. package/dist/dynamic/components/Checkbox/package.json +1 -1
  21. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  22. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  23. package/dist/dynamic/components/Compass/package.json +1 -1
  24. package/dist/dynamic/components/Content/package.json +1 -1
  25. package/dist/dynamic/components/DataList/package.json +1 -1
  26. package/dist/dynamic/components/DatePicker/package.json +1 -1
  27. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  28. package/dist/dynamic/components/Divider/package.json +1 -1
  29. package/dist/dynamic/components/Drawer/package.json +1 -1
  30. package/dist/dynamic/components/Dropdown/package.json +1 -1
  31. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  32. package/dist/dynamic/components/EmptyState/package.json +1 -1
  33. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  34. package/dist/dynamic/components/FileUpload/package.json +1 -1
  35. package/dist/dynamic/components/Form/package.json +1 -1
  36. package/dist/dynamic/components/FormSelect/package.json +1 -1
  37. package/dist/dynamic/components/HelperText/package.json +1 -1
  38. package/dist/dynamic/components/Hero/package.json +1 -1
  39. package/dist/dynamic/components/Hint/package.json +1 -1
  40. package/dist/dynamic/components/Icon/package.json +1 -1
  41. package/dist/dynamic/components/InputGroup/package.json +1 -1
  42. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  43. package/dist/dynamic/components/Label/package.json +1 -1
  44. package/dist/dynamic/components/List/package.json +1 -1
  45. package/dist/dynamic/components/LoginPage/package.json +1 -1
  46. package/dist/dynamic/components/Masthead/package.json +1 -1
  47. package/dist/dynamic/components/Menu/package.json +1 -1
  48. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  49. package/dist/dynamic/components/Modal/package.json +1 -1
  50. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  51. package/dist/dynamic/components/Nav/package.json +1 -1
  52. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  53. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  54. package/dist/dynamic/components/NumberInput/package.json +1 -1
  55. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  56. package/dist/dynamic/components/Page/package.json +1 -1
  57. package/dist/dynamic/components/Pagination/package.json +1 -1
  58. package/dist/dynamic/components/Panel/package.json +1 -1
  59. package/dist/dynamic/components/Popover/package.json +1 -1
  60. package/dist/dynamic/components/Progress/package.json +1 -1
  61. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  62. package/dist/dynamic/components/Radio/package.json +1 -1
  63. package/dist/dynamic/components/SearchInput/package.json +1 -1
  64. package/dist/dynamic/components/Select/package.json +1 -1
  65. package/dist/dynamic/components/Sidebar/package.json +1 -1
  66. package/dist/dynamic/components/SimpleList/package.json +1 -1
  67. package/dist/dynamic/components/Skeleton/package.json +1 -1
  68. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  69. package/dist/dynamic/components/Slider/package.json +1 -1
  70. package/dist/dynamic/components/Spinner/package.json +1 -1
  71. package/dist/dynamic/components/Switch/package.json +1 -1
  72. package/dist/dynamic/components/Tabs/package.json +1 -1
  73. package/dist/dynamic/components/TextArea/package.json +1 -1
  74. package/dist/dynamic/components/TextInput/package.json +1 -1
  75. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  76. package/dist/dynamic/components/TimePicker/package.json +1 -1
  77. package/dist/dynamic/components/Timestamp/package.json +1 -1
  78. package/dist/dynamic/components/Title/package.json +1 -1
  79. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  80. package/dist/dynamic/components/Toolbar/package.json +1 -1
  81. package/dist/dynamic/components/Tooltip/package.json +1 -1
  82. package/dist/dynamic/components/TreeView/package.json +1 -1
  83. package/dist/dynamic/components/Truncate/package.json +1 -1
  84. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  85. package/dist/dynamic/components/Wizard/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
  90. package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
  91. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  92. package/dist/dynamic/deprecated/components/package.json +1 -1
  93. package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
  94. package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
  95. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  96. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  97. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  98. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  99. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  100. package/dist/dynamic/helpers/constants/package.json +1 -1
  101. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  102. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  103. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  104. package/dist/dynamic/helpers/package.json +1 -1
  105. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  106. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  107. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  108. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  109. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  110. package/dist/dynamic/helpers/util/package.json +1 -1
  111. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  112. package/dist/dynamic/layouts/Flex/package.json +1 -1
  113. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  114. package/dist/dynamic/layouts/Grid/package.json +1 -1
  115. package/dist/dynamic/layouts/Level/package.json +1 -1
  116. package/dist/dynamic/layouts/Split/package.json +1 -1
  117. package/dist/dynamic/layouts/Stack/package.json +1 -1
  118. package/dist/dynamic/styles/package.json +1 -1
  119. package/dist/esm/components/Label/Label.js +1 -1
  120. package/dist/esm/components/Label/Label.js.map +1 -1
  121. package/dist/js/components/Label/Label.js +1 -1
  122. package/dist/js/components/Label/Label.js.map +1 -1
  123. package/dist/umd/assets/{output-ClqppqYH.css → output-k590n8-M.css} +18743 -18743
  124. package/dist/umd/react-core.min.js +1 -1
  125. package/helpers/package.json +1 -1
  126. package/layouts/package.json +1 -1
  127. package/next/package.json +1 -1
  128. package/package.json +4 -4
  129. package/src/components/Label/Label.tsx +1 -1
  130. package/src/demos/Banner.md +2 -139
  131. package/src/demos/DateTimePicker.md +2 -86
  132. package/src/demos/JumpLinks.md +2 -129
  133. package/src/demos/ProgressDemo.md +2 -65
  134. package/src/demos/ProgressStepperDemo.md +1 -72
  135. package/src/demos/Tabs.md +6 -417
  136. package/src/demos/examples/Banner/BannerBasicSticky.tsx +55 -0
  137. package/src/demos/examples/Banner/BannerTopBottom.tsx +81 -0
  138. package/src/demos/examples/DateTimePicker/DateTimeRangePicker.tsx +93 -0
  139. package/src/demos/examples/JumpLinks/JumpLinksScrollspy.tsx +125 -0
  140. package/src/demos/examples/JumpLinks/{JumpLinksWithDrawer.js → JumpLinksWithDrawer.tsx} +1 -1
  141. package/src/demos/examples/Progress/ProgressBasic.tsx +32 -0
  142. package/src/demos/examples/Progress/ProgressWithOnlyIncreasing.tsx +33 -0
  143. package/src/demos/examples/ProgressStepper/ProgressStepperBasic.tsx +72 -0
  144. package/src/demos/examples/Tabs/TabsOpen.tsx +185 -0
  145. package/src/demos/examples/Tabs/TabsOpenWithSecondaryTabs.tsx +228 -0
  146. package/src/layouts/Gallery/examples/Gallery.md +8 -99
  147. package/src/layouts/Gallery/examples/GalleryAdjustingMaxWidths.tsx +21 -0
  148. package/src/layouts/Gallery/examples/GalleryAdjustingMinMaxWidths.tsx +25 -0
  149. package/src/layouts/Gallery/examples/GalleryAdjustingMinWidths.tsx +22 -0
  150. package/src/layouts/Gallery/examples/GalleryAlternativeComponents.tsx +11 -0
  151. package/src/layouts/Gallery/examples/GalleryBasic.tsx +14 -0
  152. package/src/layouts/Gallery/examples/GalleryWithGutters.tsx +12 -0
  153. package/src/layouts/Grid/examples/Grid.md +8 -104
  154. package/src/layouts/Grid/examples/GridAlternativeComponents.tsx +11 -0
  155. package/src/layouts/Grid/examples/GridBasic.tsx +22 -0
  156. package/src/layouts/Grid/examples/GridGroupingOrdering.tsx +18 -0
  157. package/src/layouts/Grid/examples/GridResponsiveOrdering.tsx +9 -0
  158. package/src/layouts/Grid/examples/GridStandardOrdering.tsx +9 -0
  159. package/src/layouts/Grid/examples/GridWithGutters.tsx +22 -0
  160. package/src/layouts/Grid/examples/GridWithOverrides.tsx +20 -0
  161. package/src/layouts/Stack/examples/Stack.md +2 -16
  162. package/src/layouts/Stack/examples/StackBasic.tsx +9 -0
  163. package/src/layouts/Stack/examples/StackWithGutter.tsx +9 -0
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.5.0-prerelease.24","private":true}
1
+ {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.5.0-prerelease.26","private":true}
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.5.0-prerelease.24","private":true}
1
+ {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.5.0-prerelease.26","private":true}
package/next/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.5.0-prerelease.24","private":true}
1
+ {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.5.0-prerelease.26","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "6.5.0-prerelease.25",
3
+ "version": "6.5.0-prerelease.27",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,8 +46,8 @@
46
46
  "subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
47
47
  },
48
48
  "dependencies": {
49
- "@patternfly/react-icons": "^6.5.0-prerelease.11",
50
- "@patternfly/react-styles": "^6.5.0-prerelease.9",
49
+ "@patternfly/react-icons": "^6.5.0-prerelease.12",
50
+ "@patternfly/react-styles": "^6.5.0-prerelease.10",
51
51
  "@patternfly/react-tokens": "^6.5.0-prerelease.9",
52
52
  "focus-trap": "7.6.6",
53
53
  "react-dropzone": "^14.3.5",
@@ -63,5 +63,5 @@
63
63
  "react": "^17 || ^18 || ^19",
64
64
  "react-dom": "^17 || ^18 || ^19"
65
65
  },
66
- "gitHead": "e9f9e1fc3f1dfdc3f9474618a303d2f811ea06c5"
66
+ "gitHead": "097dae1319f634100648d173b0334f97308dc4d2"
67
67
  }
@@ -338,7 +338,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
338
338
  );
339
339
  }
340
340
 
341
- const LabelComponent = (isOverflowLabel ? 'button' : 'span') as any;
341
+ const LabelComponent = (isOverflowLabel || isAddLabel ? 'button' : 'span') as any;
342
342
 
343
343
  return (
344
344
  <LabelComponent
@@ -11,148 +11,11 @@ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/Dashboard
11
11
 
12
12
  ### Basic sticky banner
13
13
 
14
- ```js isFullscreen
15
- import { Fragment } from 'react';
16
- import { Banner, Card, CardBody, Flex, Gallery, GalleryItem, PageSection, Content } from '@patternfly/react-core';
17
-
18
- import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
19
- import { css } from '@patternfly/react-styles';
20
- import display from '@patternfly/react-styles/css/utilities/Display/display';
21
-
22
- class BannerDemo extends React.Component {
23
- render() {
24
- const banner = (
25
- <Banner isSticky>
26
- <Flex
27
- justifyContent={{ default: 'justifyContentCenter', lg: 'justifyContentSpaceBetween' }}
28
- flexWrap={{ default: 'nowrap' }}
29
- >
30
- <div className={css(display.displayNone, display.displayBlockOnLg)}>Localhost</div>
31
- <div className={css(display.displayNone, display.displayBlockOnLg)}>
32
- This message is sticky to the top of the page.
33
- </div>
34
- <div className={css(display.displayNoneOnLg)}>Drop some text on mobile, truncate if needed.</div>
35
- <div className={css(display.displayNone, display.displayBlockOnLg)}>Ned Username</div>
36
- </Flex>
37
- </Banner>
38
- );
39
- return (
40
- <Fragment>
41
- <DashboardWrapper banner={banner} breadcrumb={null}>
42
- <PageSection aria-labelledby="main-title">
43
- <Content>
44
- <h1 id="main-title">Main title</h1>
45
- <p>
46
- Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because <br />
47
- of it’s relative line height of 1.5.
48
- </p>
49
- </Content>
50
- </PageSection>
51
- <PageSection aria-label='Cards gallery'>
52
- <Gallery hasGutter>
53
- {Array.from({ length: 30 }).map((_value, index) => (
54
- <GalleryItem key={index}>
55
- <Card key={index}>
56
- <CardBody>This is a card</CardBody>
57
- </Card>
58
- </GalleryItem>
59
- ))}
60
- </Gallery>
61
- </PageSection>
62
- </DashboardWrapper>
63
- </Fragment>
64
- );
65
- }
66
- }
14
+ ```ts file="examples/Banner/BannerBasicSticky.tsx" isFullscreen
67
15
  ```
68
16
 
69
17
  ### Top and bottom banner
70
18
 
71
- ```js isFullscreen
72
- import { Fragment } from 'react';
73
- import {
74
- Banner,
75
- Card,
76
- CardBody,
77
- Flex,
78
- FlexItem,
79
- Gallery,
80
- GalleryItem,
81
- PageSection,
82
- Content
83
- } from '@patternfly/react-core';
84
- import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
85
- import { css } from '@patternfly/react-styles';
86
- import display from '@patternfly/react-styles/css/utilities/Display/display';
19
+ ```ts file="examples/Banner/BannerTopBottom.tsx" isFullscreen
87
20
 
88
- class BannerDemo extends React.Component {
89
- render() {
90
- return (
91
- <Fragment>
92
- <Flex
93
- direction={{ default: 'column' }}
94
- flexWrap={{ default: 'nowrap' }}
95
- spaceItems={{ default: 'spaceItemsNone' }}
96
- style={{ height: '100%' }}
97
- >
98
- <FlexItem>
99
- <Banner isSticky>
100
- <Flex
101
- justifyContent={{ default: 'justifyContentCenter', lg: 'justifyContentSpaceBetween' }}
102
- flexWrap={{ default: 'nowrap' }}
103
- >
104
- <div className={css(display.displayNone, display.displayBlockOnLg)}>Localhost</div>
105
- <div className={css(display.displayNone, display.displayBlockOnLg)}>
106
- This message is sticky to the top of the page.
107
- </div>
108
- <div className={css(display.displayNoneOnLg)}>Drop some text on mobile, truncate if needed.</div>
109
- <div className={css(display.displayNone, display.displayBlockOnLg)}>Ned Username</div>
110
- </Flex>
111
- </Banner>
112
- </FlexItem>
113
- <FlexItem grow={{ default: 'grow' }} style={{ minHeight: 0 }}>
114
- <DashboardWrapper breadcrumb={null}>
115
- <PageSection aria-labelledby="main-title">
116
- <Content>
117
- <h1 id='main-title'>Main title</h1>
118
- <p>
119
- Body text should be Red Hat Text at 1rem(16px). It should have leading of 1.5rem(24px) because{' '}
120
- <br />
121
- of it’s relative line height of 1.5.
122
- </p>
123
- </Content>
124
- </PageSection>
125
- <PageSection aria-label='Cards gallery'>
126
- <Gallery hasGutter>
127
- {Array.from({ length: 30 }).map((_value, index) => (
128
- <GalleryItem key={index}>
129
- <Card key={index}>
130
- <CardBody>This is a card</CardBody>
131
- </Card>
132
- </GalleryItem>
133
- ))}
134
- </Gallery>
135
- </PageSection>
136
- </DashboardWrapper>
137
- </FlexItem>
138
- <FlexItem>
139
- <Banner isSticky>
140
- <Flex
141
- justifyContent={{ default: 'justifyContentCenter', lg: 'justifyContentSpaceBetween' }}
142
- flexWrap={{ default: 'nowrap' }}
143
- >
144
- <div className={css(display.displayNone, display.displayBlockOnLg)}>Localhost</div>
145
- <div className={css(display.displayNone, display.displayBlockOnLg)}>
146
- This message is sticky to the bottom of the page.
147
- </div>
148
- <div className={css(display.displayNoneOnLg)}>Drop some text on mobile, truncate if needed.</div>
149
- <div className={css(display.displayNone, display.displayBlockOnLg)}>Ned Username</div>
150
- </Flex>
151
- </Banner>
152
- </FlexItem>
153
- </Flex>
154
- </Fragment>
155
- );
156
- }
157
- }
158
21
  ```
@@ -14,96 +14,12 @@ In this demo, learn how to use a [CalendarMonth](/components/date-and-time/calen
14
14
 
15
15
  ### Date and time picker
16
16
 
17
- ```ts file="./examples/DateTimePicker/DateTimePicker.tsx"
17
+ ```ts file="examples/DateTimePicker/DateTimePicker.tsx"
18
18
 
19
19
  ```
20
20
 
21
21
  ### Date and time range picker
22
22
 
23
- ```js
24
- import { useState } from 'react';
25
- import { Flex, FlexItem, InputGroup, InputGroupItem, DatePicker, isValidDate, TimePicker, yyyyMMddFormat, updateDateTime } from '@patternfly/react-core';
26
-
27
- DateTimeRangePicker = () => {
28
- const [from, setFrom] = useState();
29
- const [to, setTo] = useState();
30
-
31
- const toValidator = (date) => {
32
- return isValidDate(from) && yyyyMMddFormat(date) >= yyyyMMddFormat(from)
33
- ? ''
34
- : 'The "to" date must be after the "from" date';
35
- };
36
-
37
- const onFromDateChange = (_event, inputDate, newFromDate) => {
38
- if (isValidDate(from) && isValidDate(newFromDate) && inputDate === yyyyMMddFormat(newFromDate)) {
39
- newFromDate.setHours(from.getHours());
40
- newFromDate.setMinutes(from.getMinutes());
41
- }
42
- if (isValidDate(newFromDate) && inputDate === yyyyMMddFormat(newFromDate)) {
43
- setFrom(new Date(newFromDate));
44
- }
45
- };
46
-
47
- const onFromTimeChange = (_event, time, hour, minute) => {
48
- if (isValidDate(from)) {
49
- const updatedFromDate = new Date(from);
50
- updatedFromDate.setHours(hour);
51
- updatedFromDate.setMinutes(minute);
52
- setFrom(updatedFromDate);
53
- }
54
- };
55
-
56
- const onToDateChange = (_event, inputDate, newToDate) => {
57
- if (isValidDate(to) && isValidDate(newToDate) && inputDate === yyyyMMddFormat(newToDate)) {
58
- newToDate.setHours(to.getHours());
59
- newToDate.setMinutes(to.getMinutes());
60
- }
61
- if (isValidDate(newToDate) && inputDate === yyyyMMddFormat(newToDate)) {
62
- setTo(newToDate);
63
- }
64
- };
65
-
66
- const onToTimeChange = (_event, time, hour, minute) => {
67
- if (isValidDate(to)) {
68
- const updatedToDate = new Date(to);
69
- updatedToDate.setHours(hour);
70
- updatedToDate.setMinutes(minute);
71
- setTo(updatedToDate);
72
- }
73
- };
23
+ ```ts file="examples/DateTimePicker/DateTimeRangePicker.tsx"
74
24
 
75
- return (
76
- <Flex direction={{ default: 'column', lg: 'row' }}>
77
- <FlexItem>
78
- <InputGroup>
79
- <InputGroupItem>
80
- <DatePicker onChange={onFromDateChange} aria-label="Start date" placeholder="YYYY-MM-DD" />
81
- </InputGroupItem>
82
- <InputGroupItem>
83
- <TimePicker aria-label="Start time" style={{ width: '150px' }} onChange={onFromTimeChange} />
84
- </InputGroupItem>
85
- </InputGroup>
86
- </FlexItem>
87
- <FlexItem>to</FlexItem>
88
- <FlexItem>
89
- <InputGroup>
90
- <InputGroupItem>
91
- <DatePicker
92
- value={isValidDate(to) ? yyyyMMddFormat(to) : to}
93
- onChange={onToDateChange}
94
- isDisabled={!isValidDate(from)}
95
- rangeStart={from}
96
- validators={[toValidator]}
97
- aria-label="End date"
98
- placeholder="YYYY-MM-DD"
99
- />
100
- </InputGroupItem>
101
- <InputGroupItem>
102
- <TimePicker style={{ width: '150px' }} onChange={onToTimeChange} isDisabled={!isValidDate(from)} />
103
- </InputGroupItem>
104
- </InputGroup>
105
- </FlexItem>
106
- </Flex>
107
- );
108
- }
109
25
  ```
@@ -21,134 +21,7 @@ JumpLinks has a scrollspy built-in to make your implementation easier. When impl
21
21
 
22
22
  This demo expands on the previous to show the JumpLinks in a vertical layout with subsections. It scrolls the [Page](/components/page)'s `mainContainerId` with an `offset` calculated based on the height of the masthead and the nav list when it appears above the content. The headings are given a tab index to allow the jump links to focus on them.
23
23
 
24
- ```js isFullscreen
25
- import { useEffect, useState } from 'react';
26
- import {
27
- PageSection,
28
- JumpLinks,
29
- JumpLinksItem,
30
- JumpLinksList,
31
- PageGroup,
32
- Sidebar,
33
- SidebarContent,
34
- SidebarPanel,
35
- Switch,
36
- Title,
37
- Content,
38
- getResizeObserver
39
- } from '@patternfly/react-core';
40
- import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
41
- import mastheadStyles from '@patternfly/react-styles/css/components/Masthead/masthead';
42
-
43
- ScrollspyH2 = () => {
44
- const headings = [1, 2, 3, 4, 5];
45
-
46
- const [isVertical, setIsVertical] = useState(true);
47
- const [offsetHeight, setOffsetHeight] = useState(10);
48
- const offsetForPadding = 10;
49
- let masthead;
50
-
51
- // Update offset based on the masthead and jump links nav heights.
52
- useEffect(() => {
53
- masthead = document.getElementsByClassName(mastheadStyles.masthead)[0];
54
-
55
- if (isVertical) {
56
- setOffsetHeight(masthead.offsetHeight + offsetForPadding);
57
- } else {
58
- // Append jump links nav height to the masthead height when value exists.
59
- const jumpLinksHeaderHeight = document.getElementsByClassName('pf-m-sticky')[0].offsetHeight;
60
- jumpLinksHeaderHeight && setOffsetHeight(masthead.offsetHeight + jumpLinksHeaderHeight + offsetForPadding);
61
- }
62
-
63
-
64
- }, [isVertical]);
65
-
66
- getResizeObserver(
67
- document.getElementsByClassName(mastheadStyles.masthead)[0],
68
- () => {
69
- if (isVertical) {
70
- setOffsetHeight(masthead.offsetHeight + offsetForPadding);
71
- } else {
72
- // Append jump links nav height to the masthead height when value exists.
73
- const jumpLinksHeaderHeight = document.getElementsByClassName('pf-m-sticky')[0].offsetHeight;
74
- jumpLinksHeaderHeight && setOffsetHeight(masthead.offsetHeight + jumpLinksHeaderHeight + offsetForPadding);
75
- }
76
- },
77
- true
78
- );
79
-
80
- return (
81
- <DashboardWrapper breadcrumb={null} mainContainerId="scrollable-element">
82
- <PageSection aria-labelledby='main-title'>
83
- <Title headingLevel="h1" size="2xl" id='main-title'>
84
- Main title
85
- </Title>
86
- <Switch
87
- id="is-vertical"
88
- label="Vertical jump links"
89
- isChecked={isVertical}
90
- onChange={(_event, check) => setIsVertical(check)}
91
- />
92
- </PageSection>
93
- <PageSection padding={{ default: 'noPadding' }} >
94
- <Sidebar hasGutter orientation={!isVertical && 'stack'}>
95
- <SidebarPanel variant="sticky">
96
- <PageSection aria-label='Jump links navigation'>
97
- <JumpLinks
98
- isVertical={isVertical}
99
- isCentered={!isVertical}
100
- label="Jump to section"
101
- scrollableSelector=".pf-v6-c-page__main-container"
102
- offset={offsetHeight}
103
- expandable={{ default: isVertical ? 'expandable' : 'nonExpandable', md: 'nonExpandable' }}
104
- isExpanded
105
- >
106
- {headings.map(i => (
107
- <JumpLinksItem key={i} href={`#heading-${i}`}>
108
- {`Heading ${i}`}
109
- <JumpLinksList></JumpLinksList>
110
- </JumpLinksItem>
111
- ))}
112
- </JumpLinks>
113
- </PageSection>
114
- </SidebarPanel>
115
- <SidebarContent hasNoBackground>
116
- <PageSection aria-label='Main content'>
117
- <Content>
118
- {headings.map(i => (
119
- <div key={i} style={{ maxWidth: '800px', marginBottom: '32px' }}>
120
- <h2 id={`heading-${i}`} tabIndex={-1}>
121
- {`Heading ${i}`}
122
- </h2>
123
- <p>
124
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
125
- labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
126
- nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
127
- esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
128
- in culpa qui officia deserunt mollit anim id est laborum.
129
- </p>
130
- <br />
131
- <p>
132
- At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum
133
- deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non
134
- provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum
135
- fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta
136
- nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus,
137
- omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis
138
- debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non
139
- recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus
140
- maiores alias consequatur aut perferendis doloribus asperiores repellat.
141
- </p>
142
- </div>
143
- ))}
144
- </Content>
145
- </PageSection>
146
- </SidebarContent>
147
- </Sidebar>
148
- </PageSection>
149
- </DashboardWrapper>
150
- );
151
- };
24
+ ```ts file="examples/JumpLinks/JumpLinksScrollspy.tsx" isFullscreen
152
25
  ```
153
26
 
154
27
  ### With drawer
@@ -157,5 +30,5 @@ This demo shows how jump links can be used in combination with a drawer.
157
30
 
158
31
  This demo uses a `scrollableRef` prop on the JumpLinks component, which is a React ref to the `DrawerContent` component.
159
32
 
160
- ```js isFullscreen file="./examples/JumpLinks/JumpLinksWithDrawer.js"
33
+ ```ts file="examples/JumpLinks/JumpLinksWithDrawer.tsx" isFullscreen
161
34
  ```
@@ -9,77 +9,14 @@ import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessib
9
9
 
10
10
  ### Basic
11
11
 
12
- ```js
13
- import { useState } from 'react';
14
- import { Progress, Button, Stack, StackItem } from '@patternfly/react-core';
15
- import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
16
-
17
- ProgressStepperDemo = () => {
18
- const [currentValue, setCurrentValue] = useState(0);
19
-
20
- const onProgressUpdate = (nextValue) => {
21
- setCurrentValue(nextValue);
22
- };
12
+ ```ts file="examples/Progress/ProgressBasic.tsx"
23
13
 
24
- return (
25
- <Stack>
26
- <StackItem>
27
- <Button onClick={() => onProgressUpdate(currentValue - 10)} isDisabled={currentValue === 0}>
28
- Decrease value
29
- </Button>{' '}
30
- <Button onClick={() => onProgressUpdate(currentValue + 10)} isDisabled={currentValue === 100}>
31
- Increase value
32
- </Button>
33
- <br />
34
- <br />
35
- </StackItem>
36
- <StackItem>
37
- <div className={accessibilityStyles.screenReader} aria-live="polite">
38
- {`Progress value is ${currentValue}%.`}
39
- </div>
40
- <Progress value={currentValue} title="Title" />
41
- </StackItem>
42
- </Stack>
43
- );
44
- };
45
14
  ```
46
15
 
47
16
  ### With only increasing progress
48
17
 
49
18
  Sometimes a progress bar should only show increases to progress state. In this case, before the next value is set it should be checked against the current progress. The `Decrease progress` button attempts to set a lower progress value, simulating an update to a progress state that isn't desired, but won't change the progress state due to this check.
50
19
 
51
- ```js
52
- import { useState } from 'react';
53
- import { Progress, Button, Stack, StackItem } from '@patternfly/react-core';
54
-
55
- ProgressStepperDemo = () => {
56
- const [currentValue, setCurrentValue] = useState(0);
57
-
58
- const onProgressUpdate = (nextValue) => {
59
- if (nextValue > currentValue) {
60
- setCurrentValue(nextValue);
61
- }
62
- };
20
+ ```ts file="examples/Progress/ProgressWithOnlyIncreasing.tsx"
63
21
 
64
- return (
65
- <Stack>
66
- <StackItem>
67
- <Button onClick={() => onProgressUpdate(currentValue - 10)} isDisabled={currentValue === 0}>
68
- Decrease value
69
- </Button>{' '}
70
- <Button onClick={() => onProgressUpdate(currentValue + 10)} isDisabled={currentValue === 100}>
71
- Increase value
72
- </Button>
73
- <br />
74
- <br />
75
- </StackItem>
76
- <StackItem>
77
- <div className={accessibilityStyles.screenReader} aria-live="polite">
78
- {`Progress value is ${currentValue}%.`}
79
- </div>
80
- <Progress value={currentValue} title="Title" />
81
- </StackItem>
82
- </Stack>
83
- );
84
- };
85
22
  ```
@@ -10,77 +10,6 @@ import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessib
10
10
 
11
11
  ### Basic
12
12
 
13
- ```js
14
- import { useState } from 'react';
15
- import { ProgressStepper, ProgressStep, Button, Stack, StackItem } from '@patternfly/react-core';
16
- import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
17
-
18
- ProgressStepperDemo = () => {
19
- const [currentStep, setCurrentStep] = useState(0);
20
-
21
- const steps = [
22
- { title: 'First step', id: 'step1' },
23
- { title: 'Second step', id: 'step2' },
24
- { title: 'Third step', id: 'step3' },
25
- { title: 'Fourth step', id: 'step4' },
26
- { title: 'Fifth step', id: 'step5' }
27
- ];
28
-
29
- const onStepForward = event => {
30
- const next = currentStep + 1;
31
- setCurrentStep(next <= 5 ? next : 4);
32
- };
33
-
34
- const onStepBack = event => {
35
- const next = currentStep - 1;
36
- setCurrentStep(next > 0 ? next : 0);
37
- };
38
-
39
- return (
40
- <Stack>
41
- <StackItem>
42
- <Button onClick={onStepBack} isDisabled={currentStep === 0}>
43
- Step back
44
- </Button>{' '}
45
- <Button onClick={onStepForward} isDisabled={currentStep === 5}>
46
- Step forward
47
- </Button>
48
- <br />
49
- <br />
50
- </StackItem>
51
- <StackItem>
52
- <div className={accessibilityStyles.screenReader} aria-live="polite">
53
- {steps[currentStep] && `On ${steps[currentStep].title}.`}
54
- {steps[currentStep - 1] && `${steps[currentStep - 1].title} was successful.`}
55
- </div>
56
- <ProgressStepper>
57
- {steps.map((step, index) => {
58
- let variant = 'pending';
59
- let ariaLabel = 'pending step';
60
- if (index < currentStep) {
61
- variant = 'success';
62
- ariaLabel = 'completed step, step with success';
63
- } else if (index === currentStep) {
64
- variant = 'info';
65
- ariaLabel = 'current step';
66
- }
13
+ ```ts file="examples/ProgressStepper/ProgressStepperBasic.tsx"
67
14
 
68
- return (
69
- <ProgressStep
70
- id={index}
71
- titleId={step.id}
72
- key={index}
73
- variant={variant}
74
- isCurrent={index === currentStep}
75
- aria-label={ariaLabel}
76
- >
77
- {step.title}
78
- </ProgressStep>
79
- );
80
- })}
81
- </ProgressStepper>
82
- </StackItem>
83
- </Stack>
84
- );
85
- };
86
15
  ```