@patternfly/react-core 4.181.4 → 4.182.2

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 (86) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +1 -0
  3. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  4. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +5 -0
  5. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  6. package/dist/esm/components/OverflowMenu/OverflowMenuControl.d.ts.map +1 -1
  7. package/dist/esm/components/OverflowMenu/OverflowMenuControl.js +8 -4
  8. package/dist/esm/components/OverflowMenu/OverflowMenuControl.js.map +1 -1
  9. package/dist/esm/components/OverflowMenu/OverflowMenuGroup.d.ts.map +1 -1
  10. package/dist/esm/components/OverflowMenu/OverflowMenuGroup.js +5 -1
  11. package/dist/esm/components/OverflowMenu/OverflowMenuGroup.js.map +1 -1
  12. package/dist/esm/components/Pagination/Navigation.d.ts +2 -0
  13. package/dist/esm/components/Pagination/Navigation.d.ts.map +1 -1
  14. package/dist/esm/components/Pagination/Navigation.js +3 -2
  15. package/dist/esm/components/Pagination/Navigation.js.map +1 -1
  16. package/dist/esm/components/Pagination/Pagination.d.ts +2 -0
  17. package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
  18. package/dist/esm/components/Pagination/Pagination.js +2 -1
  19. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  20. package/dist/esm/components/TimePicker/TimePicker.d.ts +13 -0
  21. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  22. package/dist/esm/components/TimePicker/TimePicker.js +28 -9
  23. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  24. package/dist/esm/components/TimePicker/TimePickerUtils.d.ts +2 -1
  25. package/dist/esm/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
  26. package/dist/esm/components/TimePicker/TimePickerUtils.js +45 -19
  27. package/dist/esm/components/TimePicker/TimePickerUtils.js.map +1 -1
  28. package/dist/esm/components/Toolbar/Toolbar.d.ts +2 -0
  29. package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
  30. package/dist/esm/components/Toolbar/Toolbar.js +2 -2
  31. package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
  32. package/dist/esm/components/Toolbar/ToolbarChipGroupContent.d.ts +2 -0
  33. package/dist/esm/components/Toolbar/ToolbarChipGroupContent.d.ts.map +1 -1
  34. package/dist/esm/components/Toolbar/ToolbarChipGroupContent.js +4 -5
  35. package/dist/esm/components/Toolbar/ToolbarChipGroupContent.js.map +1 -1
  36. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +1 -0
  37. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  38. package/dist/js/components/ClipboardCopy/ClipboardCopy.js +5 -0
  39. package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  40. package/dist/js/components/OverflowMenu/OverflowMenuControl.d.ts.map +1 -1
  41. package/dist/js/components/OverflowMenu/OverflowMenuControl.js +7 -4
  42. package/dist/js/components/OverflowMenu/OverflowMenuControl.js.map +1 -1
  43. package/dist/js/components/OverflowMenu/OverflowMenuGroup.d.ts.map +1 -1
  44. package/dist/js/components/OverflowMenu/OverflowMenuGroup.js +4 -1
  45. package/dist/js/components/OverflowMenu/OverflowMenuGroup.js.map +1 -1
  46. package/dist/js/components/Pagination/Navigation.d.ts +2 -0
  47. package/dist/js/components/Pagination/Navigation.d.ts.map +1 -1
  48. package/dist/js/components/Pagination/Navigation.js +3 -2
  49. package/dist/js/components/Pagination/Navigation.js.map +1 -1
  50. package/dist/js/components/Pagination/Pagination.d.ts +2 -0
  51. package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
  52. package/dist/js/components/Pagination/Pagination.js +2 -1
  53. package/dist/js/components/Pagination/Pagination.js.map +1 -1
  54. package/dist/js/components/TimePicker/TimePicker.d.ts +13 -0
  55. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  56. package/dist/js/components/TimePicker/TimePicker.js +27 -8
  57. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  58. package/dist/js/components/TimePicker/TimePickerUtils.d.ts +2 -1
  59. package/dist/js/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
  60. package/dist/js/components/TimePicker/TimePickerUtils.js +47 -20
  61. package/dist/js/components/TimePicker/TimePickerUtils.js.map +1 -1
  62. package/dist/js/components/Toolbar/Toolbar.d.ts +2 -0
  63. package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
  64. package/dist/js/components/Toolbar/Toolbar.js +2 -2
  65. package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
  66. package/dist/js/components/Toolbar/ToolbarChipGroupContent.d.ts +2 -0
  67. package/dist/js/components/Toolbar/ToolbarChipGroupContent.d.ts.map +1 -1
  68. package/dist/js/components/Toolbar/ToolbarChipGroupContent.js +4 -5
  69. package/dist/js/components/Toolbar/ToolbarChipGroupContent.js.map +1 -1
  70. package/dist/umd/react-core.js +99 -42
  71. package/dist/umd/react-core.min.js +4 -4
  72. package/package.json +5 -5
  73. package/src/components/ClipboardCopy/ClipboardCopy.tsx +6 -0
  74. package/src/components/OverflowMenu/OverflowMenuControl.tsx +6 -2
  75. package/src/components/OverflowMenu/OverflowMenuGroup.tsx +3 -1
  76. package/src/components/Pagination/Navigation.tsx +5 -1
  77. package/src/components/Pagination/Pagination.tsx +4 -0
  78. package/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +1 -0
  79. package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +31 -0
  80. package/src/components/TimePicker/TimePicker.tsx +48 -9
  81. package/src/components/TimePicker/TimePickerUtils.tsx +54 -24
  82. package/src/components/TimePicker/examples/TimePicker.md +11 -0
  83. package/src/components/Toolbar/Toolbar.tsx +4 -0
  84. package/src/components/Toolbar/ToolbarChipGroupContent.tsx +6 -2
  85. package/src/components/Toolbar/__tests__/Generated/__snapshots__/Toolbar.test.tsx.snap +1 -0
  86. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarToggleGroup.test.tsx.snap +2 -0
@@ -7865,6 +7865,11 @@
7865
7865
  this.updateText(this.props.children);
7866
7866
  }
7867
7867
  };
7868
+ this.componentWillUnmount = () => {
7869
+ if (this.timer) {
7870
+ window.clearTimeout(this.timer);
7871
+ }
7872
+ };
7868
7873
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7869
7874
  this.expandContent = (_event) => {
7870
7875
  this.setState(prevState => ({
@@ -15840,16 +15845,22 @@
15840
15845
  OverflowMenu.displayName = 'OverflowMenu';
15841
15846
  OverflowMenu.contextType = OverflowMenuContext;
15842
15847
 
15843
- const OverflowMenuControl = ({ className, children, hasAdditionalOptions }) => (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (value.isBelowBreakpoint || hasAdditionalOptions) && (React__namespace.createElement("div", { className: css(_default$r.overflowMenuControl, className) },
15844
- " ",
15845
- children,
15846
- " "))));
15848
+ const OverflowMenuControl = (_a) => {
15849
+ var { className, children, hasAdditionalOptions } = _a, props = __rest$1(_a, ["className", "children", "hasAdditionalOptions"]);
15850
+ return (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (value.isBelowBreakpoint || hasAdditionalOptions) && (React__namespace.createElement("div", Object.assign({ className: css(_default$r.overflowMenuControl, className) }, props),
15851
+ ' ',
15852
+ children,
15853
+ ' '))));
15854
+ };
15847
15855
  OverflowMenuControl.displayName = 'OverflowMenuControl';
15848
15856
 
15849
15857
  const OverflowMenuContent = ({ className, children, isPersistent }) => (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (!value.isBelowBreakpoint || isPersistent) && (React__namespace.createElement("div", { className: css(_default$r.overflowMenuContent, className) }, children))));
15850
15858
  OverflowMenuContent.displayName = 'OverflowMenuContent';
15851
15859
 
15852
- const OverflowMenuGroup = ({ className, children, isPersistent = false, groupType }) => (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (isPersistent || !value.isBelowBreakpoint) && (React__namespace.createElement("div", { className: css(_default$r.overflowMenuGroup, groupType === 'button' && _default$r.modifiers.buttonGroup, groupType === 'icon' && _default$r.modifiers.iconButtonGroup, className) }, children))));
15860
+ const OverflowMenuGroup = (_a) => {
15861
+ var { className, children, isPersistent = false, groupType } = _a, props = __rest$1(_a, ["className", "children", "isPersistent", "groupType"]);
15862
+ return (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (isPersistent || !value.isBelowBreakpoint) && (React__namespace.createElement("div", Object.assign({ className: css(_default$r.overflowMenuGroup, groupType === 'button' && _default$r.modifiers.buttonGroup, groupType === 'icon' && _default$r.modifiers.iconButtonGroup, className) }, props), children))));
15863
+ };
15853
15864
  OverflowMenuGroup.displayName = 'OverflowMenuGroup';
15854
15865
 
15855
15866
  const OverflowMenuItem = ({ className, children, isPersistent = false }) => (React__namespace.createElement(OverflowMenuContext.Consumer, null, value => (isPersistent || !value.isBelowBreakpoint) && (React__namespace.createElement("div", { className: css(_default$r.overflowMenuItem, className) },
@@ -16065,7 +16076,7 @@
16065
16076
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
16066
16077
  perPage,
16067
16078
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
16068
- onSetPage, isDisabled, itemCount, lastPage, firstPage, pagesTitle, toLastPage, toNextPage, toFirstPage, toPreviousPage, currPage, paginationTitle, ofWord, onNextClick, onPreviousClick, onFirstClick, onLastClick, onPageInput, className, isCompact } = _a, props = __rest$1(_a, ["page", "perPage", "onSetPage", "isDisabled", "itemCount", "lastPage", "firstPage", "pagesTitle", "toLastPage", "toNextPage", "toFirstPage", "toPreviousPage", "currPage", "paginationTitle", "ofWord", "onNextClick", "onPreviousClick", "onFirstClick", "onLastClick", "onPageInput", "className", "isCompact"]);
16079
+ onSetPage, isDisabled, itemCount, lastPage, firstPage, pagesTitle, pagesTitlePlural, toLastPage, toNextPage, toFirstPage, toPreviousPage, currPage, paginationTitle, ofWord, onNextClick, onPreviousClick, onFirstClick, onLastClick, onPageInput, className, isCompact } = _a, props = __rest$1(_a, ["page", "perPage", "onSetPage", "isDisabled", "itemCount", "lastPage", "firstPage", "pagesTitle", "pagesTitlePlural", "toLastPage", "toNextPage", "toFirstPage", "toPreviousPage", "currPage", "paginationTitle", "ofWord", "onNextClick", "onPreviousClick", "onFirstClick", "onLastClick", "onPageInput", "className", "isCompact"]);
16069
16080
  const { userInputPage } = this.state;
16070
16081
  return (React__namespace.createElement("nav", Object.assign({ className: css(_default$q.paginationNav, className), "aria-label": paginationTitle }, props),
16071
16082
  !isCompact && (React__namespace.createElement("div", { className: css(_default$q.paginationNavControl, _default$q.modifiers.first) },
@@ -16088,7 +16099,7 @@
16088
16099
  (itemCount || itemCount === 0) && (React__namespace.createElement("span", { "aria-hidden": "true" },
16089
16100
  ofWord,
16090
16101
  " ",
16091
- pagesTitle ? pluralize(lastPage, pagesTitle) : lastPage)))),
16102
+ pagesTitle ? pluralize(lastPage, pagesTitle, pagesTitlePlural) : lastPage)))),
16092
16103
  React__namespace.createElement("div", { className: _default$q.paginationNavControl },
16093
16104
  React__namespace.createElement(Button, { variant: exports.ButtonVariant.plain, isDisabled: isDisabled || page === lastPage, "aria-label": toNextPage, "data-action": "next", onClick: event => {
16094
16105
  const newPage = page + 1 <= lastPage ? page + 1 : lastPage;
@@ -16114,6 +16125,7 @@
16114
16125
  lastPage: 0,
16115
16126
  firstPage: 0,
16116
16127
  pagesTitle: '',
16128
+ pagesTitlePlural: '',
16117
16129
  toLastPage: 'Go to last page',
16118
16130
  toNextPage: 'Go to next page',
16119
16131
  toFirstPage: 'Go to first page',
@@ -16317,7 +16329,7 @@
16317
16329
  toggleTemplate(toggleTemplateProps),
16318
16330
  !toggleTemplate && (React__namespace.createElement(ToggleTemplate, { firstIndex: firstIndex, lastIndex: lastIndex, itemCount: itemCount, itemsTitle: titles.items, ofWord: titles.ofWord })))),
16319
16331
  React__namespace.createElement(PaginationOptionsMenu, { itemsPerPageTitle: titles.itemsPerPage, perPageSuffix: titles.perPageSuffix, itemsTitle: isCompact ? '' : titles.items, optionsToggle: titles.optionsToggle, perPageOptions: perPageOptions, firstIndex: itemsStart !== null ? itemsStart : firstIndex, lastIndex: itemsEnd !== null ? itemsEnd : lastIndex, ofWord: titles.ofWord, defaultToFullPage: defaultToFullPage, itemCount: itemCount, page: page, perPage: perPage, lastPage: lastPage, onPerPageSelect: onPerPageSelect, dropDirection: dropDirection, widgetId: widgetId, toggleTemplate: toggleTemplate, isDisabled: isDisabled }),
16320
- React__namespace.createElement(Navigation, { pagesTitle: titles.page, toLastPage: titles.toLastPage, toPreviousPage: titles.toPreviousPage, toNextPage: titles.toNextPage, toFirstPage: titles.toFirstPage, currPage: titles.currPage, paginationTitle: titles.paginationTitle, ofWord: titles.ofWord, page: itemCount && itemCount <= 0 ? 0 : page, perPage: perPage, itemCount: itemCount, firstPage: itemsStart !== null ? itemsStart : 1, lastPage: lastPage, onSetPage: onSetPage, onFirstClick: onFirstClick, onPreviousClick: onPreviousClick, onNextClick: onNextClick, onLastClick: onLastClick, onPageInput: onPageInput, isDisabled: isDisabled, isCompact: isCompact }),
16332
+ React__namespace.createElement(Navigation, { pagesTitle: titles.page, pagesTitlePlural: titles.pages, toLastPage: titles.toLastPage, toPreviousPage: titles.toPreviousPage, toNextPage: titles.toNextPage, toFirstPage: titles.toFirstPage, currPage: titles.currPage, paginationTitle: titles.paginationTitle, ofWord: titles.ofWord, page: itemCount && itemCount <= 0 ? 0 : page, perPage: perPage, itemCount: itemCount, firstPage: itemsStart !== null ? itemsStart : 1, lastPage: lastPage, onSetPage: onSetPage, onFirstClick: onFirstClick, onPreviousClick: onPreviousClick, onNextClick: onNextClick, onLastClick: onLastClick, onPageInput: onPageInput, isDisabled: isDisabled, isCompact: isCompact }),
16321
16333
  children));
16322
16334
  }
16323
16335
  }
@@ -16333,6 +16345,7 @@
16333
16345
  titles: {
16334
16346
  items: '',
16335
16347
  page: '',
16348
+ pages: '',
16336
16349
  itemsPerPage: 'Items per page',
16337
16350
  perPageSuffix: 'per page',
16338
16351
  toFirstPage: 'Go to first page',
@@ -17762,7 +17775,7 @@
17762
17775
 
17763
17776
  const amSuffix = ' AM';
17764
17777
  const pmSuffix = ' PM';
17765
- const makeTimeOptions = (stepMinutes, hour12, delimiter) => {
17778
+ const makeTimeOptions = (stepMinutes, hour12, delimiter, minTime, maxTime) => {
17766
17779
  const res = [];
17767
17780
  const iter = new Date(new Date().setHours(0, 0, 0, 0));
17768
17781
  const iterDay = iter.getDay();
@@ -17780,13 +17793,16 @@
17780
17793
  hour %= 12;
17781
17794
  }
17782
17795
  }
17783
- res.push((hour12 ? hour.toString() : hour.toString().padStart(2, '0')) +
17784
- delimiter +
17785
- iter
17786
- .getMinutes()
17787
- .toString()
17788
- .padStart(2, '0') +
17789
- (hour12 ? suffix : ''));
17796
+ hour = hour12 ? hour.toString() : hour.toString().padStart(2, '0');
17797
+ const minutes = iter
17798
+ .getMinutes()
17799
+ .toString()
17800
+ .padStart(2, '0');
17801
+ const timeOption = hour + delimiter + minutes + (hour12 ? suffix : '');
17802
+ // time option is valid if within min/max constraints
17803
+ if (isWithinMinMax(minTime, maxTime, timeOption, delimiter)) {
17804
+ res.push(timeOption);
17805
+ }
17790
17806
  iter.setMinutes(iter.getMinutes() + stepMinutes);
17791
17807
  }
17792
17808
  return res;
@@ -17811,20 +17827,14 @@
17811
17827
  else if (typeof time === 'string') {
17812
17828
  time = time.trim();
17813
17829
  if (is12Hour && time !== '' && validateTime(time, timeRegex, delimiter, is12Hour)) {
17830
+ const [, hours, minutes, suffix = ''] = timeRegex.exec(time);
17831
+ const uppercaseSuffix = suffix.toUpperCase();
17814
17832
  // Format AM/PM according to design
17815
17833
  let ampm = '';
17816
- if (time.toUpperCase().includes(amSuffix.toUpperCase().trim())) {
17817
- time = time
17818
- .toUpperCase()
17819
- .replace(amSuffix.toUpperCase().trim(), '')
17820
- .trim();
17834
+ if (uppercaseSuffix === amSuffix.toUpperCase().trim()) {
17821
17835
  ampm = amSuffix;
17822
17836
  }
17823
- else if (time.toUpperCase().includes(pmSuffix.toUpperCase().trim())) {
17824
- time = time
17825
- .toUpperCase()
17826
- .replace(pmSuffix.toUpperCase().trim(), '')
17827
- .trim();
17837
+ else if (uppercaseSuffix === pmSuffix.toUpperCase().trim()) {
17828
17838
  ampm = pmSuffix;
17829
17839
  }
17830
17840
  else {
@@ -17832,7 +17842,7 @@
17832
17842
  // append am/pm depending on time of day
17833
17843
  ampm = new Date().getHours() > 11 ? pmSuffix : amSuffix;
17834
17844
  }
17835
- return `${time}${ampm}`;
17845
+ return `${hours}${delimiter}${minutes}${ampm}`;
17836
17846
  }
17837
17847
  }
17838
17848
  return time.toString();
@@ -17867,6 +17877,35 @@
17867
17877
  const parts = time.match(timeRegex);
17868
17878
  return parts && parts.length ? parseInt(parts[2]) : null;
17869
17879
  };
17880
+ const isWithinMinMax = (minTime, maxTime, time, delimiter) => {
17881
+ // do not throw error if empty string
17882
+ if (time.trim() === '') {
17883
+ return true;
17884
+ }
17885
+ const convertTo24Hour = (time) => {
17886
+ const timeReg = new RegExp(`^\\s*(\\d\\d?)${delimiter}([0-5]\\d)\\s*([AaPp][Mm])?\\s*$`);
17887
+ const regMatches = timeReg.exec(time);
17888
+ if (!regMatches || !regMatches.length) {
17889
+ return;
17890
+ }
17891
+ let hours = regMatches[1].padStart(2, '0');
17892
+ const minutes = regMatches[2];
17893
+ const suffix = regMatches[3] || '';
17894
+ if (suffix.toUpperCase() === 'PM' && hours !== '12') {
17895
+ hours = `${parseInt(hours) + 12}`;
17896
+ }
17897
+ else if (suffix.toUpperCase() === 'AM' && hours === '12') {
17898
+ hours = '00';
17899
+ }
17900
+ return `${hours}${delimiter}${minutes}`;
17901
+ };
17902
+ // correctly format as 24hr times (12:30AM => 00:30, 1:15 => 01:15)
17903
+ minTime = convertTo24Hour(minTime);
17904
+ time = convertTo24Hour(time);
17905
+ maxTime = convertTo24Hour(maxTime);
17906
+ // simple string comparison for 24hr times
17907
+ return minTime <= time && time <= maxTime;
17908
+ };
17870
17909
 
17871
17910
  class TimePicker extends React__namespace.Component {
17872
17911
  constructor(props) {
@@ -17991,13 +18030,19 @@
17991
18030
  ? new RegExp(`^\\s*(\\d\\d?)${this.props.delimiter}([0-5]\\d)\\s*$`)
17992
18031
  : new RegExp(`^\\s*(\\d\\d?)${this.props.delimiter}([0-5]\\d)\\s*([AaPp][Mm])?\\s*$`);
17993
18032
  this.getOptions = () => (this.menuRef && this.menuRef.current ? Array.from(this.menuRef.current.children) : []);
17994
- this.isValid = (time) => {
18033
+ this.isValidFormat = (time) => {
17995
18034
  if (this.props.validateTime) {
17996
18035
  return this.props.validateTime(time);
17997
18036
  }
17998
18037
  const { delimiter, is24Hour } = this.props;
17999
18038
  return validateTime(time, this.state.timeRegex, delimiter, !is24Hour);
18000
18039
  };
18040
+ this.isValidTime = (time) => {
18041
+ const { delimiter } = this.props;
18042
+ const { minTimeState, maxTimeState } = this.state;
18043
+ return isWithinMinMax(minTimeState, maxTimeState, time, delimiter);
18044
+ };
18045
+ this.isValid = (time) => this.isValidFormat(time) && this.isValidTime(time);
18001
18046
  this.onToggle = (isOpen) => {
18002
18047
  // on close, parse and validate input
18003
18048
  this.setState(prevState => {
@@ -18047,6 +18092,13 @@
18047
18092
  });
18048
18093
  };
18049
18094
  const { is24Hour, delimiter, time } = this.props;
18095
+ let { minTime, maxTime } = this.props;
18096
+ if (minTime === '') {
18097
+ minTime = is24Hour ? `00${delimiter}00` : `12${delimiter}00AM`;
18098
+ }
18099
+ if (maxTime === '') {
18100
+ maxTime = is24Hour ? `23${delimiter}59` : `11${delimiter}59PM`;
18101
+ }
18050
18102
  const timeRegex = this.getRegExp();
18051
18103
  this.state = {
18052
18104
  isInvalid: false,
@@ -18054,7 +18106,9 @@
18054
18106
  timeState: parseTime(time, timeRegex, delimiter, !is24Hour),
18055
18107
  focusedIndex: null,
18056
18108
  scrollIndex: 0,
18057
- timeRegex
18109
+ timeRegex,
18110
+ minTimeState: parseTime(minTime, timeRegex, delimiter, !is24Hour),
18111
+ maxTimeState: parseTime(maxTime, timeRegex, delimiter, !is24Hour)
18058
18112
  };
18059
18113
  }
18060
18114
  componentDidMount() {
@@ -18085,12 +18139,13 @@
18085
18139
  }
18086
18140
  }
18087
18141
  render() {
18088
- const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, direction, stepMinutes, width, delimiter,
18142
+ const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, invalidMinMaxErrorMessage, direction, stepMinutes, width, delimiter,
18089
18143
  /* eslint-disable @typescript-eslint/no-unused-vars */
18090
- onChange, time, validateTime, inputProps } = _a, props = __rest$1(_a, ['aria-label', "isDisabled", "className", "placeholder", "id", "menuAppendTo", "is24Hour", "invalidFormatErrorMessage", "direction", "stepMinutes", "width", "delimiter", "onChange", "time", "validateTime", "inputProps"]);
18091
- const { timeState, isOpen, isInvalid, focusedIndex } = this.state;
18144
+ onChange, time, validateTime, inputProps, minTime, maxTime } = _a, props = __rest$1(_a, ['aria-label', "isDisabled", "className", "placeholder", "id", "menuAppendTo", "is24Hour", "invalidFormatErrorMessage", "invalidMinMaxErrorMessage", "direction", "stepMinutes", "width", "delimiter", "onChange", "time", "validateTime", "inputProps", "minTime", "maxTime"]);
18145
+ const { timeState, isOpen, isInvalid, focusedIndex, minTimeState, maxTimeState } = this.state;
18092
18146
  const style = { '--pf-c-date-picker__input--c-form-control--Width': width };
18093
- const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter);
18147
+ const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState);
18148
+ const isValidFormat = this.isValidFormat(timeState);
18094
18149
  const randomId = id || getUniqueId('time-picker');
18095
18150
  const menuContainer = (React__namespace.createElement("ul", { ref: this.menuRef, className: css(_default$12.selectMenu), role: "listbox", "aria-labelledby": `${id}-input`, style: { maxHeight: '200px', overflowY: 'auto' } }, options.map((option, index) => (React__namespace.createElement(TimeOption, { key: index, value: option, index: index, onSelect: this.onSelect, isFocused: index === focusedIndex, id: `${id}-option-${index}` })))));
18096
18151
  const inputAndToggle = (React__namespace.createElement("div", Object.assign({ className: css(_default$R.datePickerInput), style: style }, props),
@@ -18099,7 +18154,7 @@
18099
18154
  React__namespace.createElement("div", { ref: this.toggleRef, className: css(_default$12.selectToggle, isDisabled && _default$12.modifiers.disabled, _default$12.modifiers.typeahead), style: { paddingLeft: '0' } },
18100
18155
  React__namespace.createElement(TextInput, Object.assign({ className: css(_default$1b.formControl, _default$12.selectToggleTypeahead), id: `${randomId}-input`, "aria-label": ariaLabel, validated: isInvalid ? 'error' : 'default', placeholder: placeholder, value: timeState || '', type: "text", iconVariant: "clock", onClick: this.onInputFocus, onFocus: this.onInputFocus, onChange: this.onInputChange, onBlur: this.onBlur, autoComplete: "off", isDisabled: isDisabled, ref: this.inputRef }, inputProps))),
18101
18156
  isOpen && menuAppendTo === 'inline' && menuContainer)),
18102
- isInvalid && (React__namespace.createElement("div", { className: css(_default$R.datePickerHelperText, _default$R.modifiers.error) }, invalidFormatErrorMessage))));
18157
+ isInvalid && (React__namespace.createElement("div", { className: css(_default$R.datePickerHelperText, _default$R.modifiers.error) }, !isValidFormat ? invalidFormatErrorMessage : invalidMinMaxErrorMessage))));
18103
18158
  const popperContainer = (React__namespace.createElement("div", { className: css(_default$12.select, isOpen && _default$12.modifiers.expanded, direction === exports.SelectDirection.up && _default$12.modifiers.top, className) }, isOpen && menuContainer));
18104
18159
  return (React__namespace.createElement("div", { className: css(_default$R.datePicker, className) }, menuAppendTo === 'inline' ? (inputAndToggle) : (React__namespace.createElement(Popper, { trigger: inputAndToggle, popper: popperContainer, direction: direction, appendTo: menuAppendTo, isVisible: isOpen }))));
18105
18160
  }
@@ -18111,6 +18166,7 @@
18111
18166
  time: '',
18112
18167
  is24Hour: false,
18113
18168
  invalidFormatErrorMessage: 'Invalid time format',
18169
+ invalidMinMaxErrorMessage: 'Invalid time entered',
18114
18170
  placeholder: 'hh:mm',
18115
18171
  delimiter: ':',
18116
18172
  'aria-label': 'Time picker',
@@ -18118,7 +18174,9 @@
18118
18174
  direction: 'down',
18119
18175
  width: 150,
18120
18176
  stepMinutes: 30,
18121
- inputProps: {}
18177
+ inputProps: {},
18178
+ minTime: '',
18179
+ maxTime: ''
18122
18180
  };
18123
18181
 
18124
18182
  var _default$d = {
@@ -18400,7 +18458,7 @@
18400
18458
 
18401
18459
  class ToolbarChipGroupContent extends React__namespace.Component {
18402
18460
  render() {
18403
- const _a = this.props, { className, isExpanded, chipGroupContentRef, clearAllFilters, showClearFiltersButton, clearFiltersButtonText, collapseListedFiltersBreakpoint, numberOfFilters } = _a, props = __rest$1(_a, ["className", "isExpanded", "chipGroupContentRef", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText", "collapseListedFiltersBreakpoint", "numberOfFilters"]);
18461
+ const _a = this.props, { className, isExpanded, chipGroupContentRef, clearAllFilters, showClearFiltersButton, clearFiltersButtonText, collapseListedFiltersBreakpoint, numberOfFilters, numberOfFiltersText } = _a, props = __rest$1(_a, ["className", "isExpanded", "chipGroupContentRef", "clearAllFilters", "showClearFiltersButton", "clearFiltersButtonText", "collapseListedFiltersBreakpoint", "numberOfFilters", "numberOfFiltersText"]);
18404
18462
  const clearChipGroups = () => {
18405
18463
  clearAllFilters();
18406
18464
  };
@@ -18415,9 +18473,7 @@
18415
18473
  return (React__namespace.createElement("div", Object.assign({ className: css(_default$c.toolbarContent, (numberOfFilters === 0 || isExpanded) && _default$c.modifiers.hidden, className) }, ((numberOfFilters === 0 || isExpanded) && { hidden: true }), { ref: chipGroupContentRef }, props),
18416
18474
  React__namespace.createElement(ToolbarGroup, Object.assign({ className: css(collapseListedFilters && _default$c.modifiers.hidden) }, (collapseListedFilters && { hidden: true }), (collapseListedFilters && { 'aria-hidden': true }))),
18417
18475
  collapseListedFilters && numberOfFilters > 0 && !isExpanded && (React__namespace.createElement(ToolbarGroup, null,
18418
- React__namespace.createElement(ToolbarItem, null,
18419
- numberOfFilters,
18420
- " filters applied"))),
18476
+ React__namespace.createElement(ToolbarItem, null, numberOfFiltersText(numberOfFilters)))),
18421
18477
  showClearFiltersButton && !isExpanded && (React__namespace.createElement(ToolbarItem, null,
18422
18478
  React__namespace.createElement(Button, { variant: "link", onClick: clearChipGroups, isInline: true }, clearFiltersButtonText)))));
18423
18479
  }
@@ -18425,7 +18481,8 @@
18425
18481
  ToolbarChipGroupContent.displayName = 'ToolbarChipGroupContent';
18426
18482
  ToolbarChipGroupContent.defaultProps = {
18427
18483
  clearFiltersButtonText: 'Clear all filters',
18428
- collapseListedFiltersBreakpoint: 'lg'
18484
+ collapseListedFiltersBreakpoint: 'lg',
18485
+ numberOfFiltersText: (numberOfFilters) => `${numberOfFilters} filters applied`
18429
18486
  };
18430
18487
 
18431
18488
  class Toolbar extends React__namespace.Component {
@@ -18463,7 +18520,7 @@
18463
18520
  };
18464
18521
  this.getNumberOfFilters = () => Object.values(this.state.filterInfo).reduce((acc, cur) => acc + cur, 0);
18465
18522
  this.renderToolbar = (randomId) => {
18466
- const _a = this.props, { clearAllFilters, clearFiltersButtonText, collapseListedFiltersBreakpoint, isExpanded: isExpandedProp, toggleIsExpanded, className, children, isFullHeight, isStatic, inset, usePageInsets, isSticky, ouiaId } = _a, props = __rest$1(_a, ["clearAllFilters", "clearFiltersButtonText", "collapseListedFiltersBreakpoint", "isExpanded", "toggleIsExpanded", "className", "children", "isFullHeight", "isStatic", "inset", "usePageInsets", "isSticky", "ouiaId"]);
18523
+ const _a = this.props, { clearAllFilters, clearFiltersButtonText, collapseListedFiltersBreakpoint, isExpanded: isExpandedProp, toggleIsExpanded, className, children, isFullHeight, isStatic, inset, usePageInsets, isSticky, ouiaId, numberOfFiltersText } = _a, props = __rest$1(_a, ["clearAllFilters", "clearFiltersButtonText", "collapseListedFiltersBreakpoint", "isExpanded", "toggleIsExpanded", "className", "children", "isFullHeight", "isStatic", "inset", "usePageInsets", "isSticky", "ouiaId", "numberOfFiltersText"]);
18467
18524
  const { isManagedToggleExpanded } = this.state;
18468
18525
  const isToggleManaged = this.isToggleManaged();
18469
18526
  const isExpanded = isToggleManaged ? isManagedToggleExpanded : isExpandedProp;
@@ -18482,7 +18539,7 @@
18482
18539
  toolbarId: randomId
18483
18540
  } },
18484
18541
  children,
18485
- React__namespace.createElement(ToolbarChipGroupContent, { isExpanded: isExpanded, chipGroupContentRef: this.chipGroupContentRef, clearAllFilters: clearAllFilters, showClearFiltersButton: showClearFiltersButton, clearFiltersButtonText: clearFiltersButtonText, numberOfFilters: numberOfFilters, collapseListedFiltersBreakpoint: collapseListedFiltersBreakpoint }))));
18542
+ React__namespace.createElement(ToolbarChipGroupContent, { isExpanded: isExpanded, chipGroupContentRef: this.chipGroupContentRef, clearAllFilters: clearAllFilters, showClearFiltersButton: showClearFiltersButton, clearFiltersButtonText: clearFiltersButtonText, numberOfFilters: numberOfFilters, numberOfFiltersText: numberOfFiltersText, collapseListedFiltersBreakpoint: collapseListedFiltersBreakpoint }))));
18486
18543
  };
18487
18544
  }
18488
18545
  componentDidMount() {