@patternfly/react-core 4.202.18 → 4.202.19

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 (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  3. package/dist/esm/components/CalendarMonth/CalendarMonth.js +12 -4
  4. package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
  5. package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
  6. package/dist/js/components/CalendarMonth/CalendarMonth.js +12 -4
  7. package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
  8. package/dist/umd/react-core.js +12 -4
  9. package/dist/umd/react-core.min.css +460 -460
  10. package/dist/umd/react-core.min.js +1 -1
  11. package/package.json +5 -5
  12. package/src/components/CalendarMonth/CalendarMonth.tsx +10 -4
  13. package/src/components/CalendarMonth/examples/CalendarMonth.md +9 -0
  14. package/src/components/CalendarMonth/examples/CalendarMonthDateRange.tsx +10 -0
  15. package/src/components/DescriptionList/examples/DescriptionList.md +22 -930
  16. package/src/components/DescriptionList/examples/DescriptionListAutoFitBasic.tsx +40 -0
  17. package/src/components/DescriptionList/examples/DescriptionListAutoFitMinWidthModified.tsx +40 -0
  18. package/src/components/DescriptionList/examples/DescriptionListAutoFitMinWidthResponsive.tsx +40 -0
  19. package/src/components/DescriptionList/examples/DescriptionListBasic.tsx +40 -0
  20. package/src/components/DescriptionList/examples/DescriptionListColumnFill.tsx +42 -0
  21. package/src/components/DescriptionList/examples/DescriptionListCompact.tsx +40 -0
  22. package/src/components/DescriptionList/examples/DescriptionListCompactHorizontal.tsx +40 -0
  23. package/src/components/DescriptionList/examples/DescriptionListDefaultAutoColumn.tsx +40 -0
  24. package/src/components/DescriptionList/examples/DescriptionListDefaultInlineGrid.tsx +40 -0
  25. package/src/components/DescriptionList/examples/DescriptionListDefaultResponsiveColumns.tsx +40 -0
  26. package/src/components/DescriptionList/examples/DescriptionListDefaultThreeColLg.tsx +40 -0
  27. package/src/components/DescriptionList/examples/DescriptionListDefaultTwoCol.tsx +44 -0
  28. package/src/components/DescriptionList/examples/DescriptionListFluidHorizontal.tsx +40 -0
  29. package/src/components/DescriptionList/examples/DescriptionListHorizontal.tsx +40 -0
  30. package/src/components/DescriptionList/examples/DescriptionListHorizontalAutoColumn.tsx +40 -0
  31. package/src/components/DescriptionList/examples/DescriptionListHorizontalCustomTermWidth.tsx +50 -0
  32. package/src/components/DescriptionList/examples/DescriptionListHorizontalResponsiveColumns.tsx +40 -0
  33. package/src/components/DescriptionList/examples/DescriptionListHorizontalThreeColLg.tsx +40 -0
  34. package/src/components/DescriptionList/examples/DescriptionListHorizontalTwoCol.tsx +40 -0
  35. package/src/components/DescriptionList/examples/DescriptionListIconsOnTerms.tsx +45 -0
  36. package/src/components/DescriptionList/examples/DescriptionListResponsiveHoriVertGroup.tsx +48 -0
  37. package/src/components/DescriptionList/examples/DescriptionListWithTermHelpText.tsx +62 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.202.18",
3
+ "version": "4.202.19",
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",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.53.18",
38
- "@patternfly/react-styles": "^4.52.18",
39
- "@patternfly/react-tokens": "^4.54.18",
37
+ "@patternfly/react-icons": "^4.53.19",
38
+ "@patternfly/react-styles": "^4.52.19",
39
+ "@patternfly/react-tokens": "^4.54.19",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "fd2bf430267635cb2473b40153f591fa853b47ad"
63
+ "gitHead": "9e9d16ac392a83a7141cd1720079d46bc6bd796b"
64
64
  }
@@ -113,7 +113,11 @@ export const CalendarMonth = ({
113
113
  // eslint-disable-next-line prefer-const
114
114
  let [focusedDate, setFocusedDate] = React.useState(new Date(dateProp));
115
115
  if (!isValidDate(focusedDate)) {
116
- focusedDate = today;
116
+ if (isValidDate(rangeStart)) {
117
+ focusedDate = rangeStart;
118
+ } else {
119
+ focusedDate = today;
120
+ }
117
121
  }
118
122
  const [hoveredDate, setHoveredDate] = React.useState(new Date(focusedDate));
119
123
  const focusRef = React.useRef<HTMLButtonElement>();
@@ -279,13 +283,15 @@ export const CalendarMonth = ({
279
283
  const isSelected = isValidDate(dateProp) && isSameDate(date, dateProp);
280
284
  const isFocused = isSameDate(date, focusedDate);
281
285
  const isAdjacentMonth = date.getMonth() !== focusedDate.getMonth();
286
+ const isRangeStart = isValidDate(rangeStart) && isSameDate(date, rangeStart);
282
287
  let isInRange = false;
283
- let isRangeStart = false;
284
288
  let isRangeEnd = false;
285
- if (isValidDate(rangeStart) && isHoveredDateValid) {
289
+ if (isValidDate(rangeStart) && isValidDate(dateProp)) {
290
+ isInRange = date > rangeStart && date < dateProp;
291
+ isRangeEnd = isSameDate(date, dateProp);
292
+ } else if (isValidDate(rangeStart) && isHoveredDateValid) {
286
293
  if (hoveredDate > rangeStart || isSameDate(hoveredDate, rangeStart)) {
287
294
  isInRange = date > rangeStart && date < hoveredDate;
288
- isRangeStart = isSameDate(date, rangeStart);
289
295
  isRangeEnd = isSameDate(date, hoveredDate);
290
296
  }
291
297
  // Don't handle focused dates before start dates for now.
@@ -17,3 +17,12 @@ beta: true
17
17
 
18
18
  ```ts file="./CalendarMonthSelectableDate.tsx"
19
19
  ```
20
+
21
+ ### Date range
22
+
23
+ In this example, there are 2 dates selected: a range start date (via the `rangeStart` prop) and a range end date (via the `date` prop). Additionally, any dates prior to the range start date are disabled by passing in an array of functions to the `validators` 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.
24
+
25
+ For this example, these dates are static and cannot be updated. For an interactive demo, see our [Date picker demos](https://www.patternfly.org/v4/components/date-picker/react-demos).
26
+
27
+ ```ts file="./CalendarMonthDateRange.tsx"
28
+ ```
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { CalendarMonth } from '@patternfly/react-core';
3
+
4
+ export const CalendarMonthDateRange: React.FunctionComponent = () => {
5
+ const startDate = new Date(2020, 10, 11);
6
+ const endDate = new Date(2020, 10, 24);
7
+ const disablePreStartDates = (date: Date) => date >= startDate;
8
+
9
+ return <CalendarMonth validators={[disablePreStartDates]} date={endDate} rangeStart={startDate} />;
10
+ };