@patternfly/react-core 4.221.16 → 4.221.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.221.16",
3
+ "version": "4.221.17",
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.72.16",
38
- "@patternfly/react-styles": "^4.71.16",
39
- "@patternfly/react-tokens": "^4.73.16",
37
+ "@patternfly/react-icons": "^4.72.17",
38
+ "@patternfly/react-styles": "^4.71.17",
39
+ "@patternfly/react-tokens": "^4.73.17",
40
40
  "focus-trap": "6.9.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": "5d2d632484b0028c60bd5f13e970a27216727bd1"
63
+ "gitHead": "836df9bc9e7e1288ea3ee9e7681da5447a4c30a5"
64
64
  }
@@ -2,8 +2,9 @@ import React, { useEffect } from 'react';
2
2
  import { TextInput } from '../TextInput/TextInput';
3
3
  import { Button } from '../Button/Button';
4
4
  import { Select, SelectOption } from '../Select';
5
- import ArrowLeftIcon from '@patternfly/react-icons/dist/esm/icons/arrow-left-icon';
6
- import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
5
+ import { InputGroup } from '../InputGroup';
6
+ import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
7
+ import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
7
8
  import { css } from '@patternfly/react-styles';
8
9
  import styles from '@patternfly/react-styles/css/components/CalendarMonth/calendar-month';
9
10
  import { getUniqueId } from '../../helpers/util';
@@ -63,7 +64,7 @@ const buildCalendar = (year: number, month: number, weekStart: number, validator
63
64
  const defaultDate = new Date(year, month);
64
65
  const firstDayOfWeek = new Date(defaultDate);
65
66
  firstDayOfWeek.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay() + weekStart);
66
- // We will always show 6 weeks like google calendar
67
+ // We will show a maximum of 6 weeks like Google calendar
67
68
  // Assume we just want the numbers for now...
68
69
  const calendarWeeks = [];
69
70
  for (let i = 0; i < 6; i++) {
@@ -77,6 +78,9 @@ const buildCalendar = (year: number, month: number, weekStart: number, validator
77
78
  firstDayOfWeek.setDate(firstDayOfWeek.getDate() + 1);
78
79
  }
79
80
  calendarWeeks.push(week);
81
+ if (firstDayOfWeek.getMonth() !== defaultDate.getMonth()) {
82
+ break;
83
+ }
80
84
  }
81
85
 
82
86
  return calendarWeeks;
@@ -204,62 +208,64 @@ export const CalendarMonth = ({
204
208
  <div className={styles.calendarMonthHeader}>
205
209
  <div className={css(styles.calendarMonthHeaderNavControl, styles.modifiers.prevMonth)}>
206
210
  <Button variant="plain" aria-label={prevMonthAriaLabel} onClick={() => onMonthClick(prevMonth)}>
207
- <ArrowLeftIcon aria-hidden={true} />
211
+ <AngleLeftIcon aria-hidden={true} />
208
212
  </Button>
209
213
  </div>
210
- <div className={styles.calendarMonthHeaderMonth}>
211
- <span id={hiddenMonthId} hidden>
212
- Month
213
- </span>
214
- <Select
215
- // Max width with "September"
216
- width="140px"
217
- aria-labelledby={hiddenMonthId}
218
- isOpen={isSelectOpen}
219
- onToggle={() => {
220
- setIsSelectOpen(!isSelectOpen);
221
- onSelectToggle(!isSelectOpen);
222
- }}
223
- onSelect={(_ev, monthNum) => {
224
- // When we put CalendarMonth in a Popover we want the Popover's onDocumentClick
225
- // to see the SelectOption as a child so it doesn't close the Popover.
226
- setTimeout(() => {
227
- setIsSelectOpen(false);
228
- onSelectToggle(false);
214
+ <InputGroup>
215
+ <div className={styles.calendarMonthHeaderMonth}>
216
+ <span id={hiddenMonthId} hidden>
217
+ Month
218
+ </span>
219
+ <Select
220
+ // Max width with "September"
221
+ width="140px"
222
+ aria-labelledby={hiddenMonthId}
223
+ isOpen={isSelectOpen}
224
+ onToggle={() => {
225
+ setIsSelectOpen(!isSelectOpen);
226
+ onSelectToggle(!isSelectOpen);
227
+ }}
228
+ onSelect={(_ev, monthNum) => {
229
+ // When we put CalendarMonth in a Popover we want the Popover's onDocumentClick
230
+ // to see the SelectOption as a child so it doesn't close the Popover.
231
+ setTimeout(() => {
232
+ setIsSelectOpen(false);
233
+ onSelectToggle(false);
234
+ const newDate = new Date(focusedDate);
235
+ newDate.setMonth(Number(monthNum as string));
236
+ setFocusedDate(newDate);
237
+ setHoveredDate(newDate);
238
+ setShouldFocus(false);
239
+ }, 0);
240
+ }}
241
+ variant="single"
242
+ selections={monthFormatted}
243
+ >
244
+ {longMonths.map((longMonth, index) => (
245
+ <SelectOption key={index} value={index} isSelected={longMonth === monthFormatted}>
246
+ {longMonth}
247
+ </SelectOption>
248
+ ))}
249
+ </Select>
250
+ </div>
251
+ <div className={styles.calendarMonthHeaderYear}>
252
+ <TextInput
253
+ aria-label={yearInputAriaLabel}
254
+ type="number"
255
+ value={yearFormatted}
256
+ onChange={year => {
229
257
  const newDate = new Date(focusedDate);
230
- newDate.setMonth(Number(monthNum as string));
258
+ newDate.setFullYear(+year);
231
259
  setFocusedDate(newDate);
232
260
  setHoveredDate(newDate);
233
261
  setShouldFocus(false);
234
- }, 0);
235
- }}
236
- variant="single"
237
- selections={monthFormatted}
238
- >
239
- {longMonths.map((longMonth, index) => (
240
- <SelectOption key={index} value={index} isSelected={longMonth === monthFormatted}>
241
- {longMonth}
242
- </SelectOption>
243
- ))}
244
- </Select>
245
- </div>
246
- <div className={styles.calendarMonthHeaderYear}>
247
- <TextInput
248
- aria-label={yearInputAriaLabel}
249
- type="number"
250
- value={yearFormatted}
251
- onChange={year => {
252
- const newDate = new Date(focusedDate);
253
- newDate.setFullYear(+year);
254
- setFocusedDate(newDate);
255
- setHoveredDate(newDate);
256
- setShouldFocus(false);
257
- }}
258
- />
259
- </div>
262
+ }}
263
+ />
264
+ </div>
265
+ </InputGroup>
260
266
  <div className={css(styles.calendarMonthHeaderNavControl, styles.modifiers.nextMonth)}>
261
267
  <Button variant="plain" aria-label={nextMonthAriaLabel} onClick={() => onMonthClick(nextMonth)}>
262
- <ArrowRightIcon aria-hidden={true} />
268
+ <AngleRightIcon aria-hidden={true} />
263
269
  </Button>
264
270
  </div>
265
271
  </div>