@patternfly/react-docs 7.6.0-prerelease.8 → 7.6.0-prerelease.9

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 +6 -0
  2. package/LICENSE +21 -0
  3. package/package.json +12 -11
  4. package/patternfly-docs/generated/components/about-modal/react.js +0 -149
  5. package/patternfly-docs/generated/components/accordion/react.js +0 -262
  6. package/patternfly-docs/generated/components/action-list/react.js +0 -144
  7. package/patternfly-docs/generated/components/alert/react-demos.js +0 -56
  8. package/patternfly-docs/generated/components/alert/react.js +0 -1433
  9. package/patternfly-docs/generated/components/avatar/react.js +0 -166
  10. package/patternfly-docs/generated/components/back-to-top/react-demos.js +0 -60
  11. package/patternfly-docs/generated/components/back-to-top/react.js +0 -77
  12. package/patternfly-docs/generated/components/backdrop/react.js +0 -64
  13. package/patternfly-docs/generated/components/background-image/react.js +0 -62
  14. package/patternfly-docs/generated/components/badge/react.js +0 -97
  15. package/patternfly-docs/generated/components/banner/react-demos.js +0 -57
  16. package/patternfly-docs/generated/components/banner/react.js +0 -148
  17. package/patternfly-docs/generated/components/brand/react.js +0 -142
  18. package/patternfly-docs/generated/components/breadcrumb/react.js +0 -206
  19. package/patternfly-docs/generated/components/button/react-demos.js +0 -57
  20. package/patternfly-docs/generated/components/button/react.js +0 -826
  21. package/patternfly-docs/generated/components/card/react-demos.js +0 -201
  22. package/patternfly-docs/generated/components/card/react.js +0 -1015
  23. package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +0 -1350
  24. package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +0 -1334
  25. package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +0 -1282
  26. package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +0 -848
  27. package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +0 -192
  28. package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +0 -426
  29. package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +0 -804
  30. package/patternfly-docs/generated/components/charts/legends/-Victory.js +0 -3230
  31. package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +0 -1178
  32. package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +0 -525
  33. package/patternfly-docs/generated/components/charts/patterns/-Victory.js +0 -3382
  34. package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +0 -377
  35. package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +0 -2475
  36. package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +0 -538
  37. package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +0 -1551
  38. package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +0 -4115
  39. package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +0 -955
  40. package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +0 -1173
  41. package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +0 -1166
  42. package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +0 -413
  43. package/patternfly-docs/generated/components/chip/react-deprecated.js +0 -323
  44. package/patternfly-docs/generated/components/clipboard-copy/react.js +0 -373
  45. package/patternfly-docs/generated/components/code-block/react.js +0 -148
  46. package/patternfly-docs/generated/components/code-editor/react.js +0 -659
  47. package/patternfly-docs/generated/components/compass/react-demos.js +0 -147
  48. package/patternfly-docs/generated/components/compass/react.js +0 -440
  49. package/patternfly-docs/generated/components/content/react.js +0 -248
  50. package/patternfly-docs/generated/components/data-list/react-demos.js +0 -90
  51. package/patternfly-docs/generated/components/data-list/react.js +0 -709
  52. package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +0 -283
  53. package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +0 -64
  54. package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +0 -83
  55. package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +0 -395
  56. package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +0 -241
  57. package/patternfly-docs/generated/components/description-list/react-demos.js +0 -58
  58. package/patternfly-docs/generated/components/description-list/react.js +0 -743
  59. package/patternfly-docs/generated/components/divider/react.js +0 -126
  60. package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +0 -351
  61. package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +0 -184
  62. package/patternfly-docs/generated/components/drag-and-drop/react.js +0 -137
  63. package/patternfly-docs/generated/components/drawer/react.js +0 -598
  64. package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +0 -772
  65. package/patternfly-docs/generated/components/dual-list-selector/react.js +0 -594
  66. package/patternfly-docs/generated/components/empty-state/react.js +0 -199
  67. package/patternfly-docs/generated/components/expandable-section/react-demos.js +0 -65
  68. package/patternfly-docs/generated/components/expandable-section/react.js +0 -408
  69. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +0 -52
  70. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +0 -398
  71. package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +0 -749
  72. package/patternfly-docs/generated/components/forms/checkbox/react.js +0 -222
  73. package/patternfly-docs/generated/components/forms/form/react.js +0 -1106
  74. package/patternfly-docs/generated/components/forms/form-select/react.js +0 -208
  75. package/patternfly-docs/generated/components/forms/radio/react.js +0 -212
  76. package/patternfly-docs/generated/components/forms/text-area/react.js +0 -160
  77. package/patternfly-docs/generated/components/forms/text-input/react.js +0 -216
  78. package/patternfly-docs/generated/components/helper-text/react-demos.js +0 -180
  79. package/patternfly-docs/generated/components/helper-text/react.js +0 -164
  80. package/patternfly-docs/generated/components/hero/react.js +0 -88
  81. package/patternfly-docs/generated/components/hint/react.js +0 -169
  82. package/patternfly-docs/generated/components/icon/react.js +0 -215
  83. package/patternfly-docs/generated/components/input-group/react.js +0 -182
  84. package/patternfly-docs/generated/components/jump-links/react-demos.js +0 -154
  85. package/patternfly-docs/generated/components/jump-links/react.js +0 -212
  86. package/patternfly-docs/generated/components/label/react-demos.js +0 -57
  87. package/patternfly-docs/generated/components/label/react.js +0 -417
  88. package/patternfly-docs/generated/components/list/react.js +0 -175
  89. package/patternfly-docs/generated/components/login-page/react.js +0 -587
  90. package/patternfly-docs/generated/components/masthead/react-demos.js +0 -79
  91. package/patternfly-docs/generated/components/masthead/react.js +0 -291
  92. package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +0 -769
  93. package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +0 -665
  94. package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +0 -187
  95. package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +0 -163
  96. package/patternfly-docs/generated/components/menus/dropdown/react.js +0 -998
  97. package/patternfly-docs/generated/components/menus/menu/react.js +0 -1540
  98. package/patternfly-docs/generated/components/menus/menu-toggle/react.js +0 -747
  99. package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +0 -508
  100. package/patternfly-docs/generated/components/menus/select/react-templates.js +0 -257
  101. package/patternfly-docs/generated/components/menus/select/react.js +0 -998
  102. package/patternfly-docs/generated/components/modal/react-deprecated.js +0 -554
  103. package/patternfly-docs/generated/components/modal/react.js +0 -597
  104. package/patternfly-docs/generated/components/navigation/react-demos.js +0 -356
  105. package/patternfly-docs/generated/components/navigation/react.js +0 -409
  106. package/patternfly-docs/generated/components/notification-badge/react.js +0 -196
  107. package/patternfly-docs/generated/components/notification-drawer/react-demos.js +0 -107
  108. package/patternfly-docs/generated/components/notification-drawer/react.js +0 -394
  109. package/patternfly-docs/generated/components/number-input/react.js +0 -210
  110. package/patternfly-docs/generated/components/overflow-menu/react.js +0 -274
  111. package/patternfly-docs/generated/components/page/react-demos.js +0 -149
  112. package/patternfly-docs/generated/components/page/react.js +0 -1352
  113. package/patternfly-docs/generated/components/pagination/react.js +0 -492
  114. package/patternfly-docs/generated/components/panel/react.js +0 -236
  115. package/patternfly-docs/generated/components/popover/react.js +0 -390
  116. package/patternfly-docs/generated/components/progress/react-demos.js +0 -59
  117. package/patternfly-docs/generated/components/progress/react.js +0 -283
  118. package/patternfly-docs/generated/components/progress-stepper/react-demos.js +0 -45
  119. package/patternfly-docs/generated/components/progress-stepper/react.js +0 -219
  120. package/patternfly-docs/generated/components/search-input/react-demos.js +0 -113
  121. package/patternfly-docs/generated/components/search-input/react.js +0 -263
  122. package/patternfly-docs/generated/components/sidebar/react.js +0 -236
  123. package/patternfly-docs/generated/components/simple-list/react.js +0 -200
  124. package/patternfly-docs/generated/components/skeleton/react-demos.js +0 -44
  125. package/patternfly-docs/generated/components/skeleton/react.js +0 -122
  126. package/patternfly-docs/generated/components/skip-to-content/react.js +0 -73
  127. package/patternfly-docs/generated/components/slider/react.js +0 -309
  128. package/patternfly-docs/generated/components/spinner/react.js +0 -111
  129. package/patternfly-docs/generated/components/switch/react.js +0 -163
  130. package/patternfly-docs/generated/components/table/react-demos.js +0 -355
  131. package/patternfly-docs/generated/components/table/react-deprecated.js +0 -1350
  132. package/patternfly-docs/generated/components/table/react.js +0 -3241
  133. package/patternfly-docs/generated/components/tabs/react-demos.js +0 -108
  134. package/patternfly-docs/generated/components/tabs/react.js +0 -1359
  135. package/patternfly-docs/generated/components/text-input-group/react-demos.js +0 -152
  136. package/patternfly-docs/generated/components/text-input-group/react.js +0 -278
  137. package/patternfly-docs/generated/components/tile/react-deprecated.js +0 -242
  138. package/patternfly-docs/generated/components/timestamp/react.js +0 -283
  139. package/patternfly-docs/generated/components/title/react.js +0 -94
  140. package/patternfly-docs/generated/components/toggle-group/react.js +0 -299
  141. package/patternfly-docs/generated/components/toolbar/react-demos.js +0 -66
  142. package/patternfly-docs/generated/components/toolbar/react.js +0 -932
  143. package/patternfly-docs/generated/components/tooltip/react.js +0 -241
  144. package/patternfly-docs/generated/components/tree-view/react.js +0 -429
  145. package/patternfly-docs/generated/components/truncate/react.js +0 -211
  146. package/patternfly-docs/generated/components/wizard/react-demos.js +0 -87
  147. package/patternfly-docs/generated/components/wizard/react-deprecated.js +0 -788
  148. package/patternfly-docs/generated/components/wizard/react.js +0 -986
  149. package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +0 -285
  150. package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +0 -70
  151. package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +0 -506
  152. package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +0 -94
  153. package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +0 -272
  154. package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +0 -87
  155. package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +0 -124
  156. package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +0 -112
  157. package/patternfly-docs/generated/index.js +0 -1769
  158. package/patternfly-docs/generated/patterns/card-view/react-demos.js +0 -78
  159. package/patternfly-docs/generated/patterns/filters/react-demos.js +0 -141
  160. package/patternfly-docs/generated/patterns/password-generator/react-demos.js +0 -51
  161. package/patternfly-docs/generated/patterns/password-strength/react-demos.js +0 -61
  162. package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +0 -124
  163. package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +0 -81
@@ -1,283 +0,0 @@
1
- import React from 'react';
2
- import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
- import { useState } from 'react';
4
- const pageData = {
5
- "id": "Calendar month",
6
- "section": "components",
7
- "subsection": "date-and-time",
8
- "deprecated": false,
9
- "template": false,
10
- "beta": false,
11
- "demo": false,
12
- "newImplementationLink": false,
13
- "source": "react",
14
- "tabName": null,
15
- "slug": "/components/date-and-time/calendar-month/react",
16
- "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/CalendarMonth/examples/CalendarMonth.md",
17
- "relPath": "packages/react-core/src/components/CalendarMonth/examples/CalendarMonth.md",
18
- "propComponents": [
19
- {
20
- "name": "CalendarMonth",
21
- "description": "The main calendar month component.",
22
- "props": [
23
- {
24
- "name": "cellAriaLabel",
25
- "type": "(date: Date) => string",
26
- "description": "Accessible label for the date cells."
27
- },
28
- {
29
- "name": "className",
30
- "type": "string",
31
- "description": "Additional classes to add to the outer div of the calendar month."
32
- },
33
- {
34
- "name": "date",
35
- "type": "Date",
36
- "description": "Month/year to base other dates around."
37
- },
38
- {
39
- "name": "dayFormat",
40
- "type": "(date: Date) => React.ReactNode",
41
- "description": "How to format days in buttons in table cells.",
42
- "defaultValue": "(date) => date.getDate()"
43
- },
44
- {
45
- "name": "inlineProps",
46
- "type": "CalendarMonthInlineProps",
47
- "description": "Props used to ensure accessibility when displaying the calendar month inline."
48
- },
49
- {
50
- "name": "isDateFocused",
51
- "type": "boolean",
52
- "description": "Flag to set browser focus on the passed date. *",
53
- "defaultValue": "false"
54
- },
55
- {
56
- "name": "locale",
57
- "type": "string",
58
- "description": "If using the default formatters which locale to use. Undefined defaults to current locale.\nSee https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation",
59
- "defaultValue": "undefined"
60
- },
61
- {
62
- "name": "longWeekdayFormat",
63
- "type": "(date: Date) => React.ReactNode",
64
- "description": "How to format days in header for screen readers.",
65
- "defaultValue": "(date) => date.toLocaleDateString(locale, { weekday: 'long' })"
66
- },
67
- {
68
- "name": "monthAppendTo",
69
- "type": "HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline'",
70
- "description": "The container to append the month select menu to. Defaults to 'inline'.\nIf your menu is being cut off you can append it to an element higher up the DOM tree.\nSome examples:\nmonthAppendTo={() => document.body};\nmonthAppendTo={document.getElementById('target')}",
71
- "defaultValue": "'inline'"
72
- },
73
- {
74
- "name": "monthFormat",
75
- "type": "(date: Date) => React.ReactNode",
76
- "description": "How to format months in month select.",
77
- "defaultValue": "(date) => date.toLocaleDateString(locale, { month: 'long' })"
78
- },
79
- {
80
- "name": "nextMonthAriaLabel",
81
- "type": "string",
82
- "description": "Accessible label for the next month button.",
83
- "defaultValue": "'Next month'"
84
- },
85
- {
86
- "name": "onChange",
87
- "type": "(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, date: Date) => void",
88
- "description": "Callback when date is selected.",
89
- "defaultValue": "() => {}"
90
- },
91
- {
92
- "name": "onMonthChange",
93
- "type": "(\n event?: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement>,\n newDate?: Date\n) => void",
94
- "description": "Callback when month or year is changed.",
95
- "defaultValue": "() => {}"
96
- },
97
- {
98
- "name": "prevMonthAriaLabel",
99
- "type": "string",
100
- "description": "Accessible label for the previous month button.",
101
- "defaultValue": "'Previous month'"
102
- },
103
- {
104
- "name": "rangeStart",
105
- "type": "Date",
106
- "description": "Which date to start range styles from."
107
- },
108
- {
109
- "name": "validators",
110
- "type": "((date: Date) => boolean)[]",
111
- "description": "Functions that returns if a date is valid and selectable.",
112
- "defaultValue": "[() => true]"
113
- },
114
- {
115
- "name": "weekdayFormat",
116
- "type": "(date: Date) => React.ReactNode",
117
- "description": "How to format week days in header.",
118
- "defaultValue": "(date) => date.toLocaleDateString(locale, { weekday: 'narrow' })"
119
- },
120
- {
121
- "name": "weekStart",
122
- "type": "0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday",
123
- "description": "Day of week that starts the week. 0 is Sunday, 6 is Saturday.",
124
- "defaultValue": "0"
125
- },
126
- {
127
- "name": "yearInputAriaLabel",
128
- "type": "string",
129
- "description": "Accessible label for the year input.",
130
- "defaultValue": "'Select year'"
131
- }
132
- ]
133
- },
134
- {
135
- "name": "CalendarFormat",
136
- "description": "Additional properties that extend from and can be passed to the main component. These\nproperties allow customizing the calendar formatting and aria-labels.",
137
- "props": [
138
- {
139
- "name": "cellAriaLabel",
140
- "type": "(date: Date) => string",
141
- "description": "Accessible label for the date cells."
142
- },
143
- {
144
- "name": "dayFormat",
145
- "type": "(date: Date) => React.ReactNode",
146
- "description": "How to format days in buttons in table cells."
147
- },
148
- {
149
- "name": "inlineProps",
150
- "type": "CalendarMonthInlineProps",
151
- "description": "Props used to ensure accessibility when displaying the calendar month inline."
152
- },
153
- {
154
- "name": "locale",
155
- "type": "string",
156
- "description": "If using the default formatters which locale to use. Undefined defaults to current locale.\nSee https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation"
157
- },
158
- {
159
- "name": "longWeekdayFormat",
160
- "type": "(date: Date) => React.ReactNode",
161
- "description": "How to format days in header for screen readers."
162
- },
163
- {
164
- "name": "monthFormat",
165
- "type": "(date: Date) => React.ReactNode",
166
- "description": "How to format months in month select."
167
- },
168
- {
169
- "name": "nextMonthAriaLabel",
170
- "type": "string",
171
- "description": "Accessible label for the next month button."
172
- },
173
- {
174
- "name": "prevMonthAriaLabel",
175
- "type": "string",
176
- "description": "Accessible label for the previous month button."
177
- },
178
- {
179
- "name": "rangeStart",
180
- "type": "Date",
181
- "description": "Which date to start range styles from."
182
- },
183
- {
184
- "name": "weekdayFormat",
185
- "type": "(date: Date) => React.ReactNode",
186
- "description": "How to format week days in header."
187
- },
188
- {
189
- "name": "weekStart",
190
- "type": "0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday",
191
- "description": "Day of week that starts the week. 0 is Sunday, 6 is Saturday."
192
- },
193
- {
194
- "name": "yearInputAriaLabel",
195
- "type": "string",
196
- "description": "Accessible label for the year input."
197
- }
198
- ]
199
- },
200
- {
201
- "name": "CalendarMonthInlineProps",
202
- "description": "",
203
- "props": [
204
- {
205
- "name": "ariaLabelledby",
206
- "type": "string",
207
- "description": "Id of the accessible label of the calendar month. Recommended to map to the title."
208
- },
209
- {
210
- "name": "component",
211
- "type": "keyof React.JSX.IntrinsicElements",
212
- "description": "Component wrapping the calendar month when used inline. Recommended to be 'article'."
213
- },
214
- {
215
- "name": "title",
216
- "type": "React.ReactNode",
217
- "description": "Title of the calendar rendered above the inline calendar month. Recommended to be a 'title' component."
218
- }
219
- ]
220
- }
221
- ],
222
- "cssPrefix": [
223
- "pf-v6-c-calendar-month"
224
- ],
225
- "examples": [
226
- "Selectable date",
227
- "Date range"
228
- ]
229
- };
230
- pageData.liveContext = {
231
- useState
232
- };
233
- pageData.examples = {
234
- 'Selectable date': props =>
235
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core';\n\nexport const CalendarMonthSelectableDate: React.FunctionComponent = () => {\n const [date, setDate] = useState(new Date(2020, 10, 24));\n\n const onMonthChange = (\n _event: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement> | undefined,\n newDate: Date\n ) => {\n // eslint-disable-next-line no-console\n console.log(`updated month: ${newDate.getMonth()}, updated year: ${newDate.getFullYear()}`);\n };\n\n const inlineProps: CalendarMonthInlineProps = {\n component: 'article',\n title: (\n <Title headingLevel=\"h4\" id=\"favorite-date\">\n Select your favorite date\n </Title>\n ),\n ariaLabelledby: 'favorite-date'\n };\n\n return (\n <>\n <CalendarMonth\n date={date}\n onChange={(_event: React.MouseEvent<HTMLButtonElement, MouseEvent>, date: Date) => setDate(date)}\n onMonthChange={onMonthChange}\n inlineProps={inlineProps}\n />\n <pre>Selected date: {date.toString()}</pre>\n </>\n );\n};\n","title":"Selectable date","lang":"ts","className":""}}>
236
-
237
- </Example>,
238
- 'Date range': props =>
239
- <Example {...pageData} {...props} {...{"code":"import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core';\n\nexport const CalendarMonthDateRange: React.FunctionComponent = () => {\n const startDate = new Date(2020, 10, 11);\n const endDate = new Date(2020, 10, 24);\n const disablePreStartDates = (date: Date) => date >= startDate;\n\n const inlineProps: CalendarMonthInlineProps = {\n component: 'article',\n title: (\n <Title id=\"display-range\" headingLevel=\"h4\">\n Calendar month displaying a range\n </Title>\n ),\n ariaLabelledby: 'display-range'\n };\n\n return (\n <CalendarMonth\n validators={[disablePreStartDates]}\n date={endDate}\n rangeStart={startDate}\n inlineProps={inlineProps}\n />\n );\n};\n","title":"Date range","lang":"ts","className":""}}>
240
-
241
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
242
- {`In this example, there are 2 dates selected: a range start date (via the `}
243
-
244
- <code {...{"className":"ws-code "}}>
245
- {`rangeStart`}
246
- </code>
247
- {` prop) and a range end date (via the `}
248
-
249
- <code {...{"className":"ws-code "}}>
250
- {`date`}
251
- </code>
252
- {` prop). Additionally, any dates prior to the range start date are disabled by passing in an array of functions to the `}
253
-
254
- <code {...{"className":"ws-code "}}>
255
- {`validators`}
256
- </code>
257
- {` prop. In this case a single function is passed in, which checks whether a date is greater than or equal to the range start date.`}
258
- </p>
259
-
260
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
261
- {`For this example, these dates are static and cannot be updated. For an interactive demo, see our `}
262
-
263
- <PatternflyThemeLink {...{"to":"/components/date-and-time/date-picker/react-demos","className":""}}>
264
- {`Date picker demos`}
265
- </PatternflyThemeLink>
266
- {`.`}
267
- </p>
268
- </Example>
269
- };
270
-
271
- const Component = () => (
272
- <React.Fragment>
273
- <AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
274
- {`Examples`}
275
- </AutoLinkHeader>
276
- {React.createElement(pageData.examples["Selectable date"])}
277
- {React.createElement(pageData.examples["Date range"])}
278
- </React.Fragment>
279
- );
280
- Component.displayName = 'ComponentsDateAndTimeCalendarMonthReactDocs';
281
- Component.pageData = pageData;
282
-
283
- export default Component;
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
- import { useState } from 'react';
4
- import RhUiCalendarIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-calendar-icon';
5
- import RhUiClockIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-clock-icon';
6
- const pageData = {
7
- "id": "Date and time picker",
8
- "section": "components",
9
- "subsection": "date-and-time",
10
- "deprecated": false,
11
- "template": false,
12
- "beta": false,
13
- "demo": false,
14
- "newImplementationLink": false,
15
- "source": "react-demos",
16
- "tabName": null,
17
- "slug": "/components/date-and-time/date-and-time-picker/react-demos",
18
- "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/demos/DateTimePicker.md",
19
- "relPath": "packages/react-core/src/demos/DateTimePicker.md",
20
- "examples": [
21
- "Date and time picker",
22
- "Date and time range picker"
23
- ]
24
- };
25
- pageData.liveContext = {
26
- useState,
27
- RhUiCalendarIcon,
28
- RhUiClockIcon
29
- };
30
- pageData.examples = {
31
- 'Date and time picker': props =>
32
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n CalendarMonth,\n InputGroup,\n InputGroupItem,\n TextInput,\n Button,\n Popover,\n Dropdown,\n DropdownItem,\n DropdownList,\n MenuToggle,\n MenuToggleElement\n} from '@patternfly/react-core';\nimport RhUiCalendarIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-calendar-icon';\nimport RhUiClockIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-clock-icon';\n\nexport const DateTimePicker: React.FunctionComponent = () => {\n const [isCalendarOpen, setIsCalendarOpen] = useState(false);\n const [isTimeOpen, setIsTimeOpen] = useState(false);\n const [valueDate, setValueDate] = useState('MM-DD-YYYY');\n const [valueTime, setValueTime] = useState('HH:MM');\n const times = Array.from(new Array(10), (_, i) => i + 8);\n const defaultTime = '0:00';\n const dateFormat = (date: Date) =>\n date.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\\//g, '-');\n\n const onToggleCalendar = () => {\n setIsCalendarOpen(!isCalendarOpen);\n setIsTimeOpen(false);\n };\n\n const onToggleTime = () => {\n setIsTimeOpen(!isTimeOpen);\n setIsCalendarOpen(false);\n };\n\n const onSelectCalendar = (_event: React.MouseEvent<HTMLButtonElement, MouseEvent>, newValueDate: Date) => {\n const newValue = dateFormat(newValueDate);\n setValueDate(newValue);\n setIsCalendarOpen(!isCalendarOpen);\n // setting default time when it is not picked\n if (valueTime === 'HH:MM') {\n setValueTime(defaultTime);\n }\n };\n\n const onSelectTime = (ev: React.MouseEvent<Element, MouseEvent> | undefined) => {\n setValueTime(ev?.currentTarget?.textContent as string);\n setIsTimeOpen(!isTimeOpen);\n };\n\n const timeOptions = times.map((time) => <DropdownItem key={time}>{`${time}:00`}</DropdownItem>);\n\n const calendar = <CalendarMonth date={new Date(valueDate)} onChange={onSelectCalendar} />;\n\n const time = (\n <Dropdown\n onSelect={onSelectTime}\n isOpen={isTimeOpen}\n onOpenChange={(isOpen: boolean) => setIsTimeOpen(isOpen)}\n toggle={(toggleRef: React.Ref<MenuToggleElement>) => (\n <MenuToggle\n ref={toggleRef}\n onClick={onToggleTime}\n isExpanded={isTimeOpen}\n aria-label=\"Time picker\"\n icon={<RhUiClockIcon />}\n />\n )}\n >\n <DropdownList>{timeOptions}</DropdownList>\n </Dropdown>\n );\n\n const calendarButton = (\n <Button variant=\"control\" aria-label=\"Toggle the calendar\" onClick={onToggleCalendar} icon={<RhUiCalendarIcon />} />\n );\n\n return (\n <div style={{ width: '300px' }}>\n <Popover\n position=\"bottom\"\n bodyContent={calendar}\n showClose={false}\n isVisible={isCalendarOpen}\n hasNoPadding\n hasAutoWidth\n >\n <InputGroup>\n <InputGroupItem>\n <TextInput\n type=\"text\"\n id=\"date-time\"\n aria-label=\"date and time picker demo\"\n value={valueDate + ' ' + valueTime}\n readOnlyVariant=\"default\"\n />\n </InputGroupItem>\n <InputGroupItem>{calendarButton}</InputGroupItem>\n <InputGroupItem>{time}</InputGroupItem>\n </InputGroup>\n </Popover>\n </div>\n );\n};\n","title":"Date and time picker","lang":"ts","className":""}}>
33
-
34
- </Example>,
35
- 'Date and time range picker': props =>
36
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Flex,\n FlexItem,\n InputGroup,\n InputGroupItem,\n DatePicker,\n isValidDate,\n TimePicker,\n yyyyMMddFormat\n} from '@patternfly/react-core';\n\nexport const DateTimeRangePicker: React.FunctionComponent = () => {\n const [from, setFrom] = useState<Date | undefined>(undefined);\n const [to, setTo] = useState<Date | undefined>(undefined);\n\n const toValidator = (date: Date) =>\n isValidDate(from) && yyyyMMddFormat(date) >= yyyyMMddFormat(from)\n ? ''\n : 'The \"to\" date must be after the \"from\" date';\n\n const onFromDateChange = (_event: React.FormEvent<HTMLInputElement>, inputDate: string, newFromDate: Date) => {\n if (isValidDate(from) && isValidDate(newFromDate) && inputDate === yyyyMMddFormat(newFromDate)) {\n newFromDate.setHours(from.getHours());\n newFromDate.setMinutes(from.getMinutes());\n }\n if (isValidDate(newFromDate) && inputDate === yyyyMMddFormat(newFromDate)) {\n setFrom(new Date(newFromDate));\n }\n };\n\n const onFromTimeChange = (_event: React.FormEvent<HTMLInputElement>, _time: string, hour: number, minute: number) => {\n if (isValidDate(from)) {\n const updatedFromDate = new Date(from);\n updatedFromDate.setHours(hour);\n updatedFromDate.setMinutes(minute);\n setFrom(updatedFromDate);\n }\n };\n\n const onToDateChange = (_event: React.FormEvent<HTMLInputElement>, inputDate: string, newToDate: Date) => {\n if (isValidDate(to) && isValidDate(newToDate) && inputDate === yyyyMMddFormat(newToDate)) {\n newToDate.setHours(to.getHours());\n newToDate.setMinutes(to.getMinutes());\n }\n if (isValidDate(newToDate) && inputDate === yyyyMMddFormat(newToDate)) {\n setTo(newToDate);\n }\n };\n\n const onToTimeChange = (_event: React.FormEvent<HTMLInputElement>, _time: string, hour: number, minute: number) => {\n if (isValidDate(to)) {\n const updatedToDate = new Date(to);\n updatedToDate.setHours(hour);\n updatedToDate.setMinutes(minute);\n setTo(updatedToDate);\n }\n };\n\n return (\n <Flex direction={{ default: 'column', lg: 'row' }}>\n <FlexItem>\n <InputGroup>\n <InputGroupItem>\n <DatePicker onChange={onFromDateChange} aria-label=\"Start date\" placeholder=\"YYYY-MM-DD\" />\n </InputGroupItem>\n <InputGroupItem>\n <TimePicker aria-label=\"Start time\" style={{ width: '150px' }} onChange={onFromTimeChange} />\n </InputGroupItem>\n </InputGroup>\n </FlexItem>\n <FlexItem>to</FlexItem>\n <FlexItem>\n <InputGroup>\n <InputGroupItem>\n <DatePicker\n value={isValidDate(to) ? yyyyMMddFormat(to) : to}\n onChange={onToDateChange}\n isDisabled={!isValidDate(from)}\n rangeStart={from}\n validators={[toValidator]}\n aria-label=\"End date\"\n placeholder=\"YYYY-MM-DD\"\n />\n </InputGroupItem>\n <InputGroupItem>\n <TimePicker style={{ width: '150px' }} onChange={onToTimeChange} isDisabled={!isValidDate(from)} />\n </InputGroupItem>\n </InputGroup>\n </FlexItem>\n </Flex>\n );\n};\n","title":"Date and time range picker","lang":"ts","className":""}}>
37
-
38
- </Example>
39
- };
40
-
41
- const Component = () => (
42
- <React.Fragment>
43
- <AutoLinkHeader {...{"id":"demos","headingLevel":"h2","className":"ws-title ws-h2"}}>
44
- {`Demos`}
45
- </AutoLinkHeader>
46
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
47
- {`In this demo, learn how to use a `}
48
- <PatternflyThemeLink {...{"to":"/components/date-and-time/calendar-month","className":""}}>
49
- {`CalendarMonth`}
50
- </PatternflyThemeLink>
51
- {` component and a `}
52
- <PatternflyThemeLink {...{"to":"/components/menus/dropdown","className":""}}>
53
- {`Dropdown`}
54
- </PatternflyThemeLink>
55
- {` component to compose a simple DateTimePicker. The input is read only, meaning that the following example does not cover pasting a copied date and time. Also, you can pick the time only from the predefined options and cannot change it in the input.`}
56
- </p>
57
- {React.createElement(pageData.examples["Date and time picker"])}
58
- {React.createElement(pageData.examples["Date and time range picker"])}
59
- </React.Fragment>
60
- );
61
- Component.displayName = 'ComponentsDateAndTimeDateAndTimePickerReactDemosDocs';
62
- Component.pageData = pageData;
63
-
64
- export default Component;
@@ -1,83 +0,0 @@
1
- import React from 'react';
2
- import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
- import { Fragment, useRef, useState } from 'react';
4
- import { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';
5
- const pageData = {
6
- "id": "Date picker",
7
- "section": "components",
8
- "subsection": "date-and-time",
9
- "deprecated": false,
10
- "template": false,
11
- "beta": false,
12
- "demo": false,
13
- "newImplementationLink": false,
14
- "source": "react-demos",
15
- "tabName": null,
16
- "slug": "/components/date-and-time/date-picker/react-demos",
17
- "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/demos/DatePicker/DatePicker.md",
18
- "relPath": "packages/react-core/src/demos/DatePicker/DatePicker.md",
19
- "examples": [
20
- "Date range picker",
21
- "Date and time pickers in modal"
22
- ]
23
- };
24
- pageData.liveContext = {
25
- Fragment,
26
- useRef,
27
- useState,
28
- ModalDeprecated,
29
- ModalVariantDeprecated
30
- };
31
- pageData.examples = {
32
- 'Date range picker': props =>
33
- <Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Split, SplitItem, DatePicker, isValidDate, yyyyMMddFormat } from '@patternfly/react-core';\n\nexport const DatePickerRange: React.FunctionComponent = () => {\n const [from, setFrom] = useState<Date | undefined>();\n const [to, setTo] = useState<string>('');\n\n const toValidator = (date: Date) =>\n isValidDate(from) && date >= from ? '' : 'The \"to\" date must be after the \"from\" date';\n\n const onFromChange = (_event: React.MouseEvent<HTMLElement>, _value: string, date: Date) => {\n setFrom(new Date(date));\n if (isValidDate(date)) {\n date.setDate(date.getDate() + 1);\n setTo(yyyyMMddFormat(date));\n } else {\n setTo('');\n }\n };\n\n const onToChange = (_event: React.MouseEvent<HTMLElement>, _value: string, date: Date) => {\n if (isValidDate(date)) {\n setTo(yyyyMMddFormat(date));\n }\n };\n\n return (\n <Split>\n <SplitItem>\n <DatePicker onChange={onFromChange} aria-label=\"Start date\" placeholder=\"YYYY-MM-DD\" />\n </SplitItem>\n <SplitItem style={{ padding: '6px 12px 0 12px' }}>to</SplitItem>\n <SplitItem>\n <DatePicker\n value={to}\n onChange={onToChange}\n isDisabled={!isValidDate(from)}\n rangeStart={from}\n validators={[toValidator]}\n aria-label=\"End date\"\n placeholder=\"YYYY-MM-DD\"\n />\n </SplitItem>\n </Split>\n );\n};\n","title":"Date range picker","lang":"ts","className":""}}>
34
-
35
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
36
- {`This is intended to be used as a filter. After selecting a start date, the next date is automatically selected.`}
37
- </p>
38
- </Example>,
39
- 'Date and time pickers in modal': props =>
40
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useRef, useState } from 'react';\nimport {\n DatePicker,\n Button,\n TimePicker,\n InputGroup,\n InputGroupItem,\n Modal,\n ModalVariant,\n ModalHeader,\n ModalBody,\n ModalFooter\n} from '@patternfly/react-core';\n\nexport const SimpleModal = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isTimePickerOpen, setIsTimePickerOpen] = useState(false);\n const dateRef = useRef(null);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n const onEscapePress = (event: KeyboardEvent) => {\n if (dateRef && dateRef.current && dateRef.current.isCalendarOpen) {\n dateRef.current.toggleCalendar(false, event.key);\n } else if (isTimePickerOpen) {\n setIsTimePickerOpen(false);\n } else {\n handleModalToggle(event);\n }\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Launch modal\n </Button>\n <Modal\n id=\"date-time-picker-modal\"\n variant={ModalVariant.small}\n isOpen={isModalOpen}\n onEscapePress={onEscapePress}\n onClose={handleModalToggle}\n >\n <ModalHeader title=\"Generic modal header\" />\n <ModalBody>\n <InputGroup>\n <InputGroupItem>\n <DatePicker ref={dateRef} appendTo={() => document.body} />\n </InputGroupItem>\n <InputGroupItem>\n <TimePicker\n menuAppendTo={() => document.body}\n isOpen={isTimePickerOpen}\n setIsOpen={setIsTimePickerOpen}\n />\n </InputGroupItem>\n </InputGroup>\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Date and time pickers in modal","lang":"ts","className":""}}>
41
-
42
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
43
- {`Modals trap focus and watch a few document level events. In order to place a date picker in a modal:`}
44
- </p>
45
-
46
- <ul {...{"className":"pf-v6-c-content--ul pf-m-editorial ws-ul "}}>
47
-
48
-
49
-
50
- <li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
51
- {`To avoid the modal's escape press event handler from overruling the date picker's escape press handlers, use the `}
52
-
53
- <code {...{"className":"ws-code "}}>
54
- {`DatePickerRef`}
55
- </code>
56
- {` to close the calendar when it is open and the escape key is pressed.`}
57
- </li>
58
-
59
-
60
-
61
- <li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
62
- {`Append the calendar to the modal to keep it as close to the date picker in the DOM while maintaining correct layouts visually
63
- In order to place a time picker in the modal, its menu must be appended to the time picker's parent.`}
64
- </li>
65
-
66
-
67
- </ul>
68
- </Example>
69
- };
70
-
71
- const Component = () => (
72
- <React.Fragment>
73
- <AutoLinkHeader {...{"id":"demos","headingLevel":"h2","className":"ws-title ws-h2"}}>
74
- {`Demos`}
75
- </AutoLinkHeader>
76
- {React.createElement(pageData.examples["Date range picker"])}
77
- {React.createElement(pageData.examples["Date and time pickers in modal"])}
78
- </React.Fragment>
79
- );
80
- Component.displayName = 'ComponentsDateAndTimeDatePickerReactDemosDocs';
81
- Component.pageData = pageData;
82
-
83
- export default Component;