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

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 +4 -0
  2. package/package.json +12 -13
  3. package/patternfly-docs/generated/components/about-modal/react.js +149 -0
  4. package/patternfly-docs/generated/components/accordion/react.js +262 -0
  5. package/patternfly-docs/generated/components/action-list/react.js +144 -0
  6. package/patternfly-docs/generated/components/alert/react-demos.js +56 -0
  7. package/patternfly-docs/generated/components/alert/react.js +1433 -0
  8. package/patternfly-docs/generated/components/avatar/react.js +166 -0
  9. package/patternfly-docs/generated/components/back-to-top/react-demos.js +60 -0
  10. package/patternfly-docs/generated/components/back-to-top/react.js +77 -0
  11. package/patternfly-docs/generated/components/backdrop/react.js +64 -0
  12. package/patternfly-docs/generated/components/background-image/react.js +62 -0
  13. package/patternfly-docs/generated/components/badge/react.js +97 -0
  14. package/patternfly-docs/generated/components/banner/react-demos.js +57 -0
  15. package/patternfly-docs/generated/components/banner/react.js +148 -0
  16. package/patternfly-docs/generated/components/brand/react.js +142 -0
  17. package/patternfly-docs/generated/components/breadcrumb/react.js +206 -0
  18. package/patternfly-docs/generated/components/button/react-demos.js +57 -0
  19. package/patternfly-docs/generated/components/button/react.js +826 -0
  20. package/patternfly-docs/generated/components/card/react-demos.js +201 -0
  21. package/patternfly-docs/generated/components/card/react.js +1015 -0
  22. package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +1350 -0
  23. package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +1334 -0
  24. package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +1282 -0
  25. package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +848 -0
  26. package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +192 -0
  27. package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +426 -0
  28. package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +804 -0
  29. package/patternfly-docs/generated/components/charts/legends/-Victory.js +3230 -0
  30. package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +1178 -0
  31. package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +525 -0
  32. package/patternfly-docs/generated/components/charts/patterns/-Victory.js +3382 -0
  33. package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +377 -0
  34. package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +2475 -0
  35. package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +538 -0
  36. package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +1551 -0
  37. package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +4115 -0
  38. package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +955 -0
  39. package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +1173 -0
  40. package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +1166 -0
  41. package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +413 -0
  42. package/patternfly-docs/generated/components/chip/react-deprecated.js +323 -0
  43. package/patternfly-docs/generated/components/clipboard-copy/react.js +373 -0
  44. package/patternfly-docs/generated/components/code-block/react.js +148 -0
  45. package/patternfly-docs/generated/components/code-editor/react.js +659 -0
  46. package/patternfly-docs/generated/components/compass/react-demos.js +147 -0
  47. package/patternfly-docs/generated/components/compass/react.js +440 -0
  48. package/patternfly-docs/generated/components/content/react.js +248 -0
  49. package/patternfly-docs/generated/components/data-list/react-demos.js +90 -0
  50. package/patternfly-docs/generated/components/data-list/react.js +709 -0
  51. package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +283 -0
  52. package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +64 -0
  53. package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +83 -0
  54. package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +395 -0
  55. package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +241 -0
  56. package/patternfly-docs/generated/components/description-list/react-demos.js +58 -0
  57. package/patternfly-docs/generated/components/description-list/react.js +743 -0
  58. package/patternfly-docs/generated/components/divider/react.js +126 -0
  59. package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +351 -0
  60. package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +184 -0
  61. package/patternfly-docs/generated/components/drag-and-drop/react.js +137 -0
  62. package/patternfly-docs/generated/components/drawer/react.js +598 -0
  63. package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +772 -0
  64. package/patternfly-docs/generated/components/dual-list-selector/react.js +594 -0
  65. package/patternfly-docs/generated/components/empty-state/react.js +199 -0
  66. package/patternfly-docs/generated/components/expandable-section/react-demos.js +65 -0
  67. package/patternfly-docs/generated/components/expandable-section/react.js +408 -0
  68. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +52 -0
  69. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +398 -0
  70. package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +749 -0
  71. package/patternfly-docs/generated/components/forms/checkbox/react.js +222 -0
  72. package/patternfly-docs/generated/components/forms/form/react.js +1106 -0
  73. package/patternfly-docs/generated/components/forms/form-select/react.js +208 -0
  74. package/patternfly-docs/generated/components/forms/radio/react.js +212 -0
  75. package/patternfly-docs/generated/components/forms/text-area/react.js +160 -0
  76. package/patternfly-docs/generated/components/forms/text-input/react.js +216 -0
  77. package/patternfly-docs/generated/components/helper-text/react-demos.js +180 -0
  78. package/patternfly-docs/generated/components/helper-text/react.js +164 -0
  79. package/patternfly-docs/generated/components/hero/react.js +88 -0
  80. package/patternfly-docs/generated/components/hint/react.js +169 -0
  81. package/patternfly-docs/generated/components/icon/react.js +215 -0
  82. package/patternfly-docs/generated/components/input-group/react.js +182 -0
  83. package/patternfly-docs/generated/components/jump-links/react-demos.js +154 -0
  84. package/patternfly-docs/generated/components/jump-links/react.js +212 -0
  85. package/patternfly-docs/generated/components/label/react-demos.js +57 -0
  86. package/patternfly-docs/generated/components/label/react.js +417 -0
  87. package/patternfly-docs/generated/components/list/react.js +175 -0
  88. package/patternfly-docs/generated/components/login-page/react.js +587 -0
  89. package/patternfly-docs/generated/components/masthead/react-demos.js +79 -0
  90. package/patternfly-docs/generated/components/masthead/react.js +291 -0
  91. package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +769 -0
  92. package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +665 -0
  93. package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +187 -0
  94. package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +163 -0
  95. package/patternfly-docs/generated/components/menus/dropdown/react.js +998 -0
  96. package/patternfly-docs/generated/components/menus/menu/react.js +1540 -0
  97. package/patternfly-docs/generated/components/menus/menu-toggle/react.js +747 -0
  98. package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +508 -0
  99. package/patternfly-docs/generated/components/menus/select/react-templates.js +257 -0
  100. package/patternfly-docs/generated/components/menus/select/react.js +998 -0
  101. package/patternfly-docs/generated/components/modal/react-deprecated.js +554 -0
  102. package/patternfly-docs/generated/components/modal/react.js +597 -0
  103. package/patternfly-docs/generated/components/navigation/react-demos.js +356 -0
  104. package/patternfly-docs/generated/components/navigation/react.js +409 -0
  105. package/patternfly-docs/generated/components/notification-badge/react.js +196 -0
  106. package/patternfly-docs/generated/components/notification-drawer/react-demos.js +107 -0
  107. package/patternfly-docs/generated/components/notification-drawer/react.js +394 -0
  108. package/patternfly-docs/generated/components/number-input/react.js +210 -0
  109. package/patternfly-docs/generated/components/overflow-menu/react.js +274 -0
  110. package/patternfly-docs/generated/components/page/react-demos.js +149 -0
  111. package/patternfly-docs/generated/components/page/react.js +1352 -0
  112. package/patternfly-docs/generated/components/pagination/react.js +492 -0
  113. package/patternfly-docs/generated/components/panel/react.js +236 -0
  114. package/patternfly-docs/generated/components/popover/react.js +390 -0
  115. package/patternfly-docs/generated/components/progress/react-demos.js +59 -0
  116. package/patternfly-docs/generated/components/progress/react.js +283 -0
  117. package/patternfly-docs/generated/components/progress-stepper/react-demos.js +45 -0
  118. package/patternfly-docs/generated/components/progress-stepper/react.js +219 -0
  119. package/patternfly-docs/generated/components/search-input/react-demos.js +113 -0
  120. package/patternfly-docs/generated/components/search-input/react.js +263 -0
  121. package/patternfly-docs/generated/components/sidebar/react.js +236 -0
  122. package/patternfly-docs/generated/components/simple-list/react.js +200 -0
  123. package/patternfly-docs/generated/components/skeleton/react-demos.js +44 -0
  124. package/patternfly-docs/generated/components/skeleton/react.js +122 -0
  125. package/patternfly-docs/generated/components/skip-to-content/react.js +73 -0
  126. package/patternfly-docs/generated/components/slider/react.js +309 -0
  127. package/patternfly-docs/generated/components/spinner/react.js +111 -0
  128. package/patternfly-docs/generated/components/switch/react.js +163 -0
  129. package/patternfly-docs/generated/components/table/react-demos.js +355 -0
  130. package/patternfly-docs/generated/components/table/react-deprecated.js +1350 -0
  131. package/patternfly-docs/generated/components/table/react.js +3241 -0
  132. package/patternfly-docs/generated/components/tabs/react-demos.js +108 -0
  133. package/patternfly-docs/generated/components/tabs/react.js +1359 -0
  134. package/patternfly-docs/generated/components/text-input-group/react-demos.js +152 -0
  135. package/patternfly-docs/generated/components/text-input-group/react.js +278 -0
  136. package/patternfly-docs/generated/components/tile/react-deprecated.js +242 -0
  137. package/patternfly-docs/generated/components/timestamp/react.js +283 -0
  138. package/patternfly-docs/generated/components/title/react.js +94 -0
  139. package/patternfly-docs/generated/components/toggle-group/react.js +299 -0
  140. package/patternfly-docs/generated/components/toolbar/react-demos.js +66 -0
  141. package/patternfly-docs/generated/components/toolbar/react.js +932 -0
  142. package/patternfly-docs/generated/components/tooltip/react.js +241 -0
  143. package/patternfly-docs/generated/components/tree-view/react.js +429 -0
  144. package/patternfly-docs/generated/components/truncate/react.js +211 -0
  145. package/patternfly-docs/generated/components/wizard/react-demos.js +87 -0
  146. package/patternfly-docs/generated/components/wizard/react-deprecated.js +788 -0
  147. package/patternfly-docs/generated/components/wizard/react.js +986 -0
  148. package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +285 -0
  149. package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +70 -0
  150. package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +506 -0
  151. package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +94 -0
  152. package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +272 -0
  153. package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +87 -0
  154. package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +124 -0
  155. package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +112 -0
  156. package/patternfly-docs/generated/index.js +1769 -0
  157. package/patternfly-docs/generated/patterns/card-view/react-demos.js +78 -0
  158. package/patternfly-docs/generated/patterns/filters/react-demos.js +141 -0
  159. package/patternfly-docs/generated/patterns/password-generator/react-demos.js +51 -0
  160. package/patternfly-docs/generated/patterns/password-strength/react-demos.js +61 -0
  161. package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +124 -0
  162. package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +81 -0
  163. package/LICENSE +0 -21
@@ -0,0 +1,395 @@
1
+ import React from 'react';
2
+ import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
+ import { Fragment, useState, useRef } from 'react';
4
+ const pageData = {
5
+ "id": "Date picker",
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/date-picker/react",
16
+ "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/DatePicker/examples/DatePicker.md",
17
+ "relPath": "packages/react-core/src/components/DatePicker/examples/DatePicker.md",
18
+ "propComponents": [
19
+ {
20
+ "name": "DatePicker",
21
+ "description": "The main date picker component.",
22
+ "props": [
23
+ {
24
+ "name": "appendTo",
25
+ "type": "HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline'",
26
+ "description": "The container to append the 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:\nmenuAppendTo={() => document.body};\nmenuAppendTo={document.getElementById('target')}",
27
+ "defaultValue": "'inline'"
28
+ },
29
+ {
30
+ "name": "aria-label",
31
+ "type": "string",
32
+ "description": "Accessible label for the date picker.",
33
+ "defaultValue": "'Date picker'"
34
+ },
35
+ {
36
+ "name": "buttonAriaLabel",
37
+ "type": "string",
38
+ "description": "Accessible label for the button to open the date picker.",
39
+ "defaultValue": "'Toggle date picker'"
40
+ },
41
+ {
42
+ "name": "cellAriaLabel",
43
+ "type": "(date: Date) => string",
44
+ "description": "Accessible label for the date cells."
45
+ },
46
+ {
47
+ "name": "className",
48
+ "type": "string",
49
+ "description": "Additional classes added to the date picker."
50
+ },
51
+ {
52
+ "name": "dateFormat",
53
+ "type": "(date: Date) => string",
54
+ "description": "How to format the date in the text input.",
55
+ "defaultValue": "(date: Date) =>\n`${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date\n .getDate()\n .toString()\n .padStart(2, '0')}`"
56
+ },
57
+ {
58
+ "name": "dateParse",
59
+ "type": "(value: string) => Date",
60
+ "description": "How to parse the date in the text input.",
61
+ "defaultValue": "(val: string) => (val.split('-').length === 3 ? new Date(`${val}T00:00:00`) : new Date(undefined))"
62
+ },
63
+ {
64
+ "name": "dayFormat",
65
+ "type": "(date: Date) => React.ReactNode",
66
+ "description": "How to format days in buttons in table cells."
67
+ },
68
+ {
69
+ "name": "helperText",
70
+ "type": "React.ReactNode",
71
+ "description": "Helper text to display alongside the date picker. Expects a HelperText component."
72
+ },
73
+ {
74
+ "name": "inlineProps",
75
+ "type": "CalendarMonthInlineProps",
76
+ "description": "Props used to ensure accessibility when displaying the calendar month inline."
77
+ },
78
+ {
79
+ "name": "inputProps",
80
+ "type": "TextInputProps",
81
+ "description": "Additional props for the text input.",
82
+ "defaultValue": "{}"
83
+ },
84
+ {
85
+ "name": "invalidFormatText",
86
+ "type": "string",
87
+ "description": "Error message to display when the text input contains a non-empty value in an invalid format.",
88
+ "defaultValue": "'Invalid date'"
89
+ },
90
+ {
91
+ "name": "isDisabled",
92
+ "type": "boolean",
93
+ "description": "Flag indicating the date picker is disabled.",
94
+ "defaultValue": "false"
95
+ },
96
+ {
97
+ "name": "locale",
98
+ "type": "string",
99
+ "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",
100
+ "defaultValue": "undefined"
101
+ },
102
+ {
103
+ "name": "longWeekdayFormat",
104
+ "type": "(date: Date) => React.ReactNode",
105
+ "description": "How to format days in header for screen readers."
106
+ },
107
+ {
108
+ "name": "monthFormat",
109
+ "type": "(date: Date) => React.ReactNode",
110
+ "description": "How to format months in month select."
111
+ },
112
+ {
113
+ "name": "nextMonthAriaLabel",
114
+ "type": "string",
115
+ "description": "Accessible label for the next month button."
116
+ },
117
+ {
118
+ "name": "onBlur",
119
+ "type": "(event: any, value: string, date?: Date) => void",
120
+ "description": "Callback called every time the text input loses focus.",
121
+ "defaultValue": "(): any => undefined"
122
+ },
123
+ {
124
+ "name": "onChange",
125
+ "type": "(event: React.FormEvent<HTMLInputElement>, value: string, date?: Date) => void",
126
+ "description": "Callback called every time the text input value changes.",
127
+ "defaultValue": "(): any => undefined"
128
+ },
129
+ {
130
+ "name": "placeholder",
131
+ "type": "string",
132
+ "description": "String to display in the empty text input as a hint for the expected date format.",
133
+ "defaultValue": "'YYYY-MM-DD'"
134
+ },
135
+ {
136
+ "name": "popoverProps",
137
+ "type": "Partial<Omit<PopoverProps, 'appendTo'>>",
138
+ "description": "Props to pass to the popover that contains the calendar month component."
139
+ },
140
+ {
141
+ "name": "prevMonthAriaLabel",
142
+ "type": "string",
143
+ "description": "Accessible label for the previous month button."
144
+ },
145
+ {
146
+ "name": "rangeStart",
147
+ "type": "Date",
148
+ "description": "Which date to start range styles from."
149
+ },
150
+ {
151
+ "name": "requiredDateOptions",
152
+ "type": "DatePickerRequiredObject",
153
+ "description": "Options to customize the requirement of a date"
154
+ },
155
+ {
156
+ "name": "style",
157
+ "type": "No type info",
158
+ "defaultValue": "{}"
159
+ },
160
+ {
161
+ "name": "validators",
162
+ "type": "((date: Date) => string)[]",
163
+ "description": "Functions that returns an error message if a date is invalid.",
164
+ "defaultValue": "[]"
165
+ },
166
+ {
167
+ "name": "value",
168
+ "type": "string",
169
+ "description": "Value of the text input.",
170
+ "defaultValue": "''"
171
+ },
172
+ {
173
+ "name": "weekdayFormat",
174
+ "type": "(date: Date) => React.ReactNode",
175
+ "description": "How to format week days in header."
176
+ },
177
+ {
178
+ "name": "weekStart",
179
+ "type": "0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday",
180
+ "description": "Day of week that starts the week. 0 is Sunday, 6 is Saturday."
181
+ },
182
+ {
183
+ "name": "yearInputAriaLabel",
184
+ "type": "string",
185
+ "description": "Accessible label for the year input."
186
+ }
187
+ ]
188
+ },
189
+ {
190
+ "name": "CalendarFormat",
191
+ "description": "Additional properties that extend from and can be passed to the main component. These\nproperties allow customizing the calendar formatting and aria-labels.",
192
+ "props": [
193
+ {
194
+ "name": "cellAriaLabel",
195
+ "type": "(date: Date) => string",
196
+ "description": "Accessible label for the date cells."
197
+ },
198
+ {
199
+ "name": "dayFormat",
200
+ "type": "(date: Date) => React.ReactNode",
201
+ "description": "How to format days in buttons in table cells."
202
+ },
203
+ {
204
+ "name": "inlineProps",
205
+ "type": "CalendarMonthInlineProps",
206
+ "description": "Props used to ensure accessibility when displaying the calendar month inline."
207
+ },
208
+ {
209
+ "name": "locale",
210
+ "type": "string",
211
+ "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"
212
+ },
213
+ {
214
+ "name": "longWeekdayFormat",
215
+ "type": "(date: Date) => React.ReactNode",
216
+ "description": "How to format days in header for screen readers."
217
+ },
218
+ {
219
+ "name": "monthFormat",
220
+ "type": "(date: Date) => React.ReactNode",
221
+ "description": "How to format months in month select."
222
+ },
223
+ {
224
+ "name": "nextMonthAriaLabel",
225
+ "type": "string",
226
+ "description": "Accessible label for the next month button."
227
+ },
228
+ {
229
+ "name": "prevMonthAriaLabel",
230
+ "type": "string",
231
+ "description": "Accessible label for the previous month button."
232
+ },
233
+ {
234
+ "name": "rangeStart",
235
+ "type": "Date",
236
+ "description": "Which date to start range styles from."
237
+ },
238
+ {
239
+ "name": "weekdayFormat",
240
+ "type": "(date: Date) => React.ReactNode",
241
+ "description": "How to format week days in header."
242
+ },
243
+ {
244
+ "name": "weekStart",
245
+ "type": "0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday",
246
+ "description": "Day of week that starts the week. 0 is Sunday, 6 is Saturday."
247
+ },
248
+ {
249
+ "name": "yearInputAriaLabel",
250
+ "type": "string",
251
+ "description": "Accessible label for the year input."
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ "name": "DatePickerRef",
257
+ "description": "Allows finer control over the calendar's open state when a React ref is passed into the\ndate picker component. Accessed via ref.current[property], e.g. ref.current.toggleCalendar().",
258
+ "props": [
259
+ {
260
+ "name": "isCalendarOpen",
261
+ "type": "boolean",
262
+ "description": "Current calendar open status.",
263
+ "required": true
264
+ },
265
+ {
266
+ "name": "setCalendarOpen",
267
+ "type": "(isOpen: boolean) => void",
268
+ "description": "Sets the calendar open status.",
269
+ "required": true
270
+ },
271
+ {
272
+ "name": "toggleCalendar",
273
+ "type": "(isOpen?: boolean) => void",
274
+ "description": "Toggles the calendar open status. If no parameters are passed, the calendar will simply\ntoggle its open status.\nIf the isOpen parameter is passed, that will set the calendar open status to the value\nof the isOpen parameter.\nIf the eventKey parameter is set to 'Escape', that will invoke the date pickers\nonEscapePress event to toggle the correct control appropriately.",
275
+ "required": true
276
+ }
277
+ ]
278
+ },
279
+ {
280
+ "name": "DatePickerRequiredObject",
281
+ "description": "Props that customize the requirement of a date",
282
+ "props": [
283
+ {
284
+ "name": "emptyDateText",
285
+ "type": "string",
286
+ "description": "Error message to display when the text input is empty and the isRequired prop is also passed in."
287
+ },
288
+ {
289
+ "name": "isRequired",
290
+ "type": "boolean",
291
+ "description": "Flag indicating the date is required."
292
+ }
293
+ ]
294
+ }
295
+ ],
296
+ "cssPrefix": [
297
+ "pf-v6-c-date-picker"
298
+ ],
299
+ "examples": [
300
+ "Basic",
301
+ "Required",
302
+ "American format",
303
+ "Helper text",
304
+ "Min and max date",
305
+ "French",
306
+ "Controlled",
307
+ "Controlled required",
308
+ "Controlling the date picker calendar state"
309
+ ]
310
+ };
311
+ pageData.liveContext = {
312
+ Fragment,
313
+ useState,
314
+ useRef
315
+ };
316
+ pageData.examples = {
317
+ 'Basic': props =>
318
+ <Example {...pageData} {...props} {...{"code":"import { DatePicker } from '@patternfly/react-core';\n\nexport const DatePickerBasic: React.FunctionComponent = () => (\n <DatePicker\n // eslint-disable-next-line no-console\n onBlur={(_event, str, date) => console.log('onBlur', str, date)}\n // eslint-disable-next-line no-console\n onChange={(_event, str, date) => console.log('onChange', str, date)}\n />\n);\n","title":"Basic","lang":"ts","className":""}}>
319
+
320
+ </Example>,
321
+ 'Required': props =>
322
+ <Example {...pageData} {...props} {...{"code":"import { DatePicker } from '@patternfly/react-core';\n\nexport const DatePickerRequired: React.FunctionComponent = () => (\n <DatePicker requiredDateOptions={{ isRequired: true, emptyDateText: 'Date is required' }} />\n);\n","title":"Required","lang":"ts","className":""}}>
323
+
324
+ <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
325
+ {`To require users to select a date before continuing, use the `}
326
+
327
+ <code {...{"className":"ws-code "}}>
328
+ {`requiredDateOptions.isRequired`}
329
+ </code>
330
+ {` property.`}
331
+ </p>
332
+
333
+ <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
334
+ {`A required date picker will be invalid when the text input is empty and either the text input loses focus or the date picker popover is closed.`}
335
+ </p>
336
+
337
+ <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
338
+ {`The error message can be customized via the `}
339
+
340
+ <code {...{"className":"ws-code "}}>
341
+ {`requiredDateOptions.emptyDateText`}
342
+ </code>
343
+ {` property.`}
344
+ </p>
345
+ </Example>,
346
+ 'American format': props =>
347
+ <Example {...pageData} {...props} {...{"code":"import { DatePicker } from '@patternfly/react-core';\n\nexport const DatePickerAmerican: React.FunctionComponent = () => {\n const dateFormat = (date: Date) =>\n date.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\\//g, '-');\n const dateParse = (date: string) => {\n const split = date.split('-');\n if (split.length !== 3) {\n return new Date();\n }\n const month = split[0];\n const day = split[1];\n const year = split[2];\n return new Date(`${year.padStart(4, '0')}-${month.padStart(2, '0')}-${day.padStart(2, '0')}T00:00:00`);\n };\n\n return <DatePicker value=\"03-05-2020\" placeholder=\"MM-DD-YYYY\" dateFormat={dateFormat} dateParse={dateParse} />;\n};\n","title":"American format","lang":"ts","className":""}}>
348
+
349
+ </Example>,
350
+ 'Helper text': props =>
351
+ <Example {...pageData} {...props} {...{"code":"import { DatePicker, HelperText, HelperTextItem } from '@patternfly/react-core';\n\nexport const DatePickerHelperText: React.FunctionComponent = () => (\n <DatePicker\n value=\"2020-03-05\"\n helperText={\n <HelperText>\n <HelperTextItem>Select a date.</HelperTextItem>\n </HelperText>\n }\n />\n);\n","title":"Helper text","lang":"ts","className":""}}>
352
+
353
+ </Example>,
354
+ 'Min and max date': props =>
355
+ <Example {...pageData} {...props} {...{"code":"import { DatePicker } from '@patternfly/react-core';\n\nexport const DatePickerMinMax: React.FunctionComponent = () => {\n const minDate = new Date(2020, 2, 16);\n const maxDate = new Date(2020, 2, 20);\n const rangeValidator = (date: Date) => {\n if (date < minDate) {\n return 'Date is before the allowable range.';\n } else if (date > maxDate) {\n return 'Date is after the allowable range.';\n }\n\n return '';\n };\n return <DatePicker value=\"2020-03-17\" validators={[rangeValidator]} />;\n};\n","title":"Min and max date","lang":"ts","className":""}}>
356
+
357
+ </Example>,
358
+ 'French': props =>
359
+ <Example {...pageData} {...props} {...{"code":"import { DatePicker, Weekday } from '@patternfly/react-core';\n\nexport const DatePickerFrench: React.FunctionComponent = () => {\n const minDate = new Date(2020, 2, 16);\n const maxDate = new Date(2020, 2, 20);\n const rangeValidator = (date: Date) => {\n if (date < minDate) {\n return 'Cette date est antérieure à la première date valide.';\n } else if (date > maxDate) {\n return 'Cette date est postérieure à la dernière date valide.';\n }\n\n return '';\n };\n return (\n <DatePicker\n value=\"2020-03-17\"\n validators={[rangeValidator]}\n placeholder=\"aaaa-mm-jj\"\n invalidFormatText=\"Cette date est invalide.\"\n locale=\"fr\"\n weekStart={Weekday.Monday}\n />\n );\n};\n","title":"French","lang":"ts","className":""}}>
360
+
361
+ </Example>,
362
+ 'Controlled': props =>
363
+ <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, DatePicker, Flex, FlexItem } from '@patternfly/react-core';\n\nexport const DatePickerControlled: React.FunctionComponent = () => {\n const initialValue = '2020-03-17';\n const [value, setValue] = useState(initialValue);\n return (\n <Fragment>\n <DatePicker value={value} onChange={(_event, value) => setValue(value)} />\n <br />\n <br />\n <Flex>\n <FlexItem>\n <Button onClick={() => setValue(initialValue)}>Reset date</Button>\n </FlexItem>\n <FlexItem>\n <Button onClick={() => setValue('')}>Clear date</Button>\n </FlexItem>\n </Flex>\n </Fragment>\n );\n};\n","title":"Controlled","lang":"ts","className":""}}>
364
+
365
+ </Example>,
366
+ 'Controlled required': props =>
367
+ <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, DatePicker, Flex, FlexItem } from '@patternfly/react-core';\n\nexport const DatePickerControlled: React.FunctionComponent = () => {\n const initialValue = '2020-03-17';\n const [value, setValue] = useState(initialValue);\n return (\n <Fragment>\n <DatePicker\n requiredDateOptions={{ isRequired: true, emptyDateText: 'Date is required' }}\n value={value}\n onChange={(_event, value) => setValue(value)}\n />\n <br />\n <br />\n <Flex>\n <FlexItem>\n <Button onClick={() => setValue(initialValue)}>Reset date</Button>\n </FlexItem>\n <FlexItem>\n <Button onClick={() => setValue('')}>Clear date</Button>\n </FlexItem>\n </Flex>\n </Fragment>\n );\n};\n","title":"Controlled required","lang":"ts","className":""}}>
368
+
369
+ </Example>,
370
+ 'Controlling the date picker calendar state': props =>
371
+ <Example {...pageData} {...props} {...{"code":"import { Fragment, useRef } from 'react';\nimport { Button, DatePicker } from '@patternfly/react-core';\n\nexport const DatePickerControlledCalendar: React.FunctionComponent = () => {\n const dateRef = useRef(null);\n const onClick = () => {\n if (dateRef.current) {\n dateRef.current.toggleCalendar();\n }\n };\n return (\n <Fragment>\n <DatePicker ref={dateRef} />\n <br />\n <br />\n <Button onClick={onClick}>Toggle calendar</Button>\n </Fragment>\n );\n};\n","title":"Controlling the date picker calendar state","lang":"ts","className":""}}>
372
+
373
+ </Example>
374
+ };
375
+
376
+ const Component = () => (
377
+ <React.Fragment>
378
+ <AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
379
+ {`Examples`}
380
+ </AutoLinkHeader>
381
+ {React.createElement(pageData.examples["Basic"])}
382
+ {React.createElement(pageData.examples["Required"])}
383
+ {React.createElement(pageData.examples["American format"])}
384
+ {React.createElement(pageData.examples["Helper text"])}
385
+ {React.createElement(pageData.examples["Min and max date"])}
386
+ {React.createElement(pageData.examples["French"])}
387
+ {React.createElement(pageData.examples["Controlled"])}
388
+ {React.createElement(pageData.examples["Controlled required"])}
389
+ {React.createElement(pageData.examples["Controlling the date picker calendar state"])}
390
+ </React.Fragment>
391
+ );
392
+ Component.displayName = 'ComponentsDateAndTimeDatePickerReactDocs';
393
+ Component.pageData = pageData;
394
+
395
+ export default Component;
@@ -0,0 +1,241 @@
1
+ import React from 'react';
2
+ import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
+ import { TimePicker } from '@patternfly/react-core';
4
+ const pageData = {
5
+ "id": "Time picker",
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/time-picker/react",
16
+ "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/TimePicker/examples/TimePicker.md",
17
+ "relPath": "packages/react-core/src/components/TimePicker/examples/TimePicker.md",
18
+ "propComponents": [
19
+ {
20
+ "name": "TimePicker",
21
+ "description": "",
22
+ "props": [
23
+ {
24
+ "name": "aria-label",
25
+ "type": "string",
26
+ "description": "Accessible label for the time picker",
27
+ "defaultValue": "'Time picker'"
28
+ },
29
+ {
30
+ "name": "className",
31
+ "type": "string",
32
+ "description": "Additional classes added to the time picker.",
33
+ "defaultValue": "''"
34
+ },
35
+ {
36
+ "name": "delimiter",
37
+ "type": "string",
38
+ "description": "Character to display between the hour and minute",
39
+ "defaultValue": "':'"
40
+ },
41
+ {
42
+ "name": "id",
43
+ "type": "string",
44
+ "description": "Id of the time picker"
45
+ },
46
+ {
47
+ "name": "includeSeconds",
48
+ "type": "boolean",
49
+ "description": "Includes number of seconds with the chosen time and allows users to manually edit the seconds value."
50
+ },
51
+ {
52
+ "name": "inputProps",
53
+ "type": "TextInputProps",
54
+ "description": "Additional props for input field",
55
+ "defaultValue": "{}"
56
+ },
57
+ {
58
+ "name": "invalidFormatErrorMessage",
59
+ "type": "string",
60
+ "description": "Error message to display when the time is provided in an invalid format.",
61
+ "defaultValue": "'Invalid time format'"
62
+ },
63
+ {
64
+ "name": "invalidMinMaxErrorMessage",
65
+ "type": "string",
66
+ "description": "Error message to display when the time provided is not within the minTime/maxTime constraints",
67
+ "defaultValue": "'Invalid time entered'"
68
+ },
69
+ {
70
+ "name": "is24Hour",
71
+ "type": "boolean",
72
+ "description": "True if the time is 24 hour time. False if the time is 12 hour time",
73
+ "defaultValue": "false"
74
+ },
75
+ {
76
+ "name": "isDisabled",
77
+ "type": "boolean",
78
+ "description": "Flag indicating the time picker is disabled",
79
+ "defaultValue": "false"
80
+ },
81
+ {
82
+ "name": "isOpen",
83
+ "type": "boolean",
84
+ "description": "Flag to control the opened state of the time picker menu",
85
+ "defaultValue": "false"
86
+ },
87
+ {
88
+ "name": "maxTime",
89
+ "type": "string | Date",
90
+ "description": "A time string indicating the maximum value allowed. The format could be an ISO 8601 formatted date string or in 'HH{delimiter}MM' format",
91
+ "defaultValue": "''"
92
+ },
93
+ {
94
+ "name": "menuAppendTo",
95
+ "type": "HTMLElement | (() => HTMLElement) | 'inline' | 'parent'",
96
+ "description": "The container to append the 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:\nmenuAppendTo=\"parent\"\nmenuAppendTo={() => document.body}\nmenuAppendTo={document.getElementById('target')}",
97
+ "defaultValue": "'inline'"
98
+ },
99
+ {
100
+ "name": "minTime",
101
+ "type": "string | Date",
102
+ "description": "A time string indicating the minimum value allowed. The format could be an ISO 8601 formatted date string or in 'HH{delimiter}MM' format",
103
+ "defaultValue": "''"
104
+ },
105
+ {
106
+ "name": "onChange",
107
+ "type": "(\n event: React.FormEvent<HTMLInputElement>,\n time: string,\n hour?: number,\n minute?: number,\n seconds?: number,\n isValid?: boolean\n) => void",
108
+ "description": "Optional event handler called each time the value in the time picker input changes."
109
+ },
110
+ {
111
+ "name": "placeholder",
112
+ "type": "string",
113
+ "description": "String to display in the empty time picker field as a hint for the expected time format",
114
+ "defaultValue": "'hh:mm'"
115
+ },
116
+ {
117
+ "name": "setIsOpen",
118
+ "type": "(isOpen?: boolean) => void",
119
+ "description": "Handler invoked each time the open state of time picker updates",
120
+ "defaultValue": "() => {}"
121
+ },
122
+ {
123
+ "name": "stepMinutes",
124
+ "type": "number",
125
+ "description": "Size of step between time options in minutes.",
126
+ "defaultValue": "30"
127
+ },
128
+ {
129
+ "name": "time",
130
+ "type": "string | Date",
131
+ "description": "A time string. The format could be an ISO 8601 formatted date string or in 'HH{delimiter}MM' format",
132
+ "defaultValue": "''"
133
+ },
134
+ {
135
+ "name": "validateTime",
136
+ "type": "(time: string) => boolean",
137
+ "description": "Optional validator can be provided to override the internal time validator."
138
+ },
139
+ {
140
+ "name": "width",
141
+ "type": "string",
142
+ "description": "Width of the time picker.",
143
+ "defaultValue": "'150px'"
144
+ },
145
+ {
146
+ "name": "zIndex",
147
+ "type": "number",
148
+ "description": "z-index of the time picker",
149
+ "defaultValue": "9999"
150
+ }
151
+ ]
152
+ }
153
+ ],
154
+ "cssPrefix": [
155
+ "pf-v6-c-time-picker"
156
+ ],
157
+ "examples": [
158
+ "Basic 12 hour",
159
+ "Basic 24 hour",
160
+ "Custom delimiter",
161
+ "Minimum/maximum times",
162
+ "With seconds",
163
+ "Basic 24 hours with seconds"
164
+ ]
165
+ };
166
+ pageData.liveContext = {
167
+ TimePicker
168
+ };
169
+ pageData.examples = {
170
+ 'Basic 12 hour': props =>
171
+ <Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport { TimePicker } from '@patternfly/react-core';\n\nexport const TimePickerBasic12Hour: React.FunctionComponent = () => {\n const onChange = (\n _event: React.FormEvent<HTMLInputElement>,\n time: string,\n hour: number,\n minute: number,\n seconds: number,\n isValid: boolean\n ) => {\n console.log('time', time);\n console.log('hour', hour);\n console.log('minute', minute);\n console.log('seconds', seconds);\n console.log('isValid', isValid);\n };\n\n return <TimePicker time=\"3:35 AM\" onChange={onChange} />;\n};\n","title":"Basic 12 hour","lang":"ts","className":""}}>
172
+
173
+ </Example>,
174
+ 'Basic 24 hour': props =>
175
+ <Example {...pageData} {...props} {...{"code":"import { TimePicker } from '@patternfly/react-core';\n\nexport const TimePickerBasic24Hour: React.FunctionComponent = () => <TimePicker time=\"2020-10-14T18:06:02Z\" is24Hour />;\n","title":"Basic 24 hour","lang":"ts","className":""}}>
176
+
177
+ </Example>,
178
+ 'Custom delimiter': props =>
179
+ <Example {...pageData} {...props} {...{"code":"import { TimePicker } from '@patternfly/react-core';\n\nexport const TimePickerCustomDelimiter: React.FunctionComponent = () => (\n <TimePicker is24Hour delimiter=\"h\" placeholder=\"\" />\n);\n","title":"Custom delimiter","lang":"ts","className":""}}>
180
+
181
+ </Example>,
182
+ 'Minimum/maximum times': props =>
183
+ <Example {...pageData} {...props} {...{"code":"import { TimePicker } from '@patternfly/react-core';\n\nexport const TimePickerMinMaxTimes: React.FunctionComponent = () => (\n <TimePicker is24Hour minTime=\"9:30\" maxTime=\"17:15\" placeholder=\"14:00\" />\n);\n","title":"Minimum/maximum times","lang":"ts","className":""}}>
184
+
185
+ <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
186
+ {`The `}
187
+
188
+ <code {...{"className":"ws-code "}}>
189
+ {`minTime`}
190
+ </code>
191
+ {`/`}
192
+
193
+ <code {...{"className":"ws-code "}}>
194
+ {`maxTime`}
195
+ </code>
196
+ {` props restrict the options shown for the user to select from as well as trigger the `}
197
+
198
+ <code {...{"className":"ws-code "}}>
199
+ {`invalidMinMaxErrorMessage`}
200
+ </code>
201
+ {` if the user enters a time outside this range.`}
202
+ </p>
203
+ </Example>,
204
+ 'With seconds': props =>
205
+ <Example {...pageData} {...props} {...{"code":"import { TimePicker } from '@patternfly/react-core';\n\nexport const TimePickerWithSeconds: React.FunctionComponent = () => <TimePicker time=\"3:35:20 PM\" includeSeconds />;\n","title":"With seconds","lang":"ts","className":""}}>
206
+
207
+ </Example>,
208
+ 'Basic 24 hours with seconds': props =>
209
+ <Example {...pageData} {...props} {...{"code":"import { TimePicker } from '@patternfly/react-core';\n\nexport const TimePickerBasic24HourWithSeconds: React.FunctionComponent = () => (\n <TimePicker time=\"12:35:50\" includeSeconds is24Hour />\n);\n","title":"Basic 24 hours with seconds","lang":"ts","className":""}}>
210
+
211
+ </Example>
212
+ };
213
+
214
+ const Component = () => (
215
+ <React.Fragment>
216
+ <AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
217
+ {`Examples`}
218
+ </AutoLinkHeader>
219
+ <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
220
+ {`Appending the TimePicker to the `}
221
+ <code {...{"className":"ws-code "}}>
222
+ {`document.body`}
223
+ </code>
224
+ {` may cause accessibility issues, including being unable to navigate into the menu via keyboard or other assistive technologies. Instead, appending to the `}
225
+ <code {...{"className":"ws-code "}}>
226
+ {`"parent"`}
227
+ </code>
228
+ {` is recommended.`}
229
+ </p>
230
+ {React.createElement(pageData.examples["Basic 12 hour"])}
231
+ {React.createElement(pageData.examples["Basic 24 hour"])}
232
+ {React.createElement(pageData.examples["Custom delimiter"])}
233
+ {React.createElement(pageData.examples["Minimum/maximum times"])}
234
+ {React.createElement(pageData.examples["With seconds"])}
235
+ {React.createElement(pageData.examples["Basic 24 hours with seconds"])}
236
+ </React.Fragment>
237
+ );
238
+ Component.displayName = 'ComponentsDateAndTimeTimePickerReactDocs';
239
+ Component.pageData = pageData;
240
+
241
+ export default Component;