@patternfly/react-core 4.189.4 → 4.191.1

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 (54) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
  3. package/dist/esm/components/NumberInput/NumberInput.js +13 -1
  4. package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
  5. package/dist/esm/components/Tabs/Tabs.d.ts +2 -0
  6. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  7. package/dist/esm/components/Tabs/Tabs.js +24 -18
  8. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  9. package/dist/esm/components/TimePicker/TimePicker.d.ts +6 -4
  10. package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
  11. package/dist/esm/components/TimePicker/TimePicker.js +37 -26
  12. package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
  13. package/dist/esm/components/TimePicker/TimePickerUtils.d.ts +3 -2
  14. package/dist/esm/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
  15. package/dist/esm/components/TimePicker/TimePickerUtils.js +57 -42
  16. package/dist/esm/components/TimePicker/TimePickerUtils.js.map +1 -1
  17. package/dist/esm/helpers/util.d.ts +2 -1
  18. package/dist/esm/helpers/util.d.ts.map +1 -1
  19. package/dist/esm/helpers/util.js +5 -4
  20. package/dist/esm/helpers/util.js.map +1 -1
  21. package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
  22. package/dist/js/components/NumberInput/NumberInput.js +13 -1
  23. package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
  24. package/dist/js/components/Tabs/Tabs.d.ts +2 -0
  25. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  26. package/dist/js/components/Tabs/Tabs.js +24 -18
  27. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  28. package/dist/js/components/TimePicker/TimePicker.d.ts +6 -4
  29. package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
  30. package/dist/js/components/TimePicker/TimePicker.js +36 -25
  31. package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
  32. package/dist/js/components/TimePicker/TimePickerUtils.d.ts +3 -2
  33. package/dist/js/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
  34. package/dist/js/components/TimePicker/TimePickerUtils.js +59 -43
  35. package/dist/js/components/TimePicker/TimePickerUtils.js.map +1 -1
  36. package/dist/js/helpers/util.d.ts +2 -1
  37. package/dist/js/helpers/util.d.ts.map +1 -1
  38. package/dist/js/helpers/util.js +5 -4
  39. package/dist/js/helpers/util.js.map +1 -1
  40. package/dist/umd/react-core.css +69 -69
  41. package/dist/umd/react-core.js +134 -90
  42. package/dist/umd/react-core.min.css +34 -34
  43. package/dist/umd/react-core.min.js +2 -2
  44. package/package.json +5 -5
  45. package/src/components/NumberInput/NumberInput.tsx +17 -0
  46. package/src/components/NumberInput/__tests__/__snapshots__/NumberInput.test.tsx.snap +10 -0
  47. package/src/components/NumberInput/examples/NumberInput.md +43 -0
  48. package/src/components/Tabs/Tabs.tsx +25 -18
  49. package/src/components/TimePicker/TimePicker.tsx +54 -31
  50. package/src/components/TimePicker/TimePickerUtils.tsx +76 -39
  51. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +49 -11
  52. package/src/components/TimePicker/examples/TimePicker.md +19 -2
  53. package/src/demos/Button.md +67 -0
  54. package/src/helpers/util.ts +10 -4
@@ -21569,75 +21569,6 @@ svg.pf-c-spinner.pf-m-xl {
21569
21569
  box-shadow: var(--pf-c-panel__footer--BoxShadow);
21570
21570
  }
21571
21571
 
21572
- .pf-l-gallery {
21573
- --pf-l-gallery--m-gutter--GridGap: var(--pf-global--gutter);
21574
- --pf-l-gallery--GridTemplateColumns--min: 250px;
21575
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
21576
- --pf-l-gallery--GridTemplateColumns--max: 1fr;
21577
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
21578
- --pf-l-gallery--GridTemplateColumns: repeat(auto-fill, minmax(var(--pf-l-gallery--GridTemplateColumns--minmax--min), var(--pf-l-gallery--GridTemplateColumns--minmax--max)));
21579
- --pf-l-gallery--GridTemplateRows: auto;
21580
- display: grid;
21581
- grid-template-columns: var(--pf-l-gallery--GridTemplateColumns);
21582
- grid-template-rows: var(--pf-l-gallery--GridTemplateRows);
21583
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
21584
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
21585
- }
21586
-
21587
- .pf-l-gallery.pf-m-gutter {
21588
- grid-gap: var(--pf-l-gallery--m-gutter--GridGap);
21589
- }
21590
-
21591
- @media (min-width: 576px) {
21592
- .pf-l-gallery {
21593
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min));
21594
- }
21595
- }
21596
- @media (min-width: 768px) {
21597
- .pf-l-gallery {
21598
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)));
21599
- }
21600
- }
21601
- @media (min-width: 992px) {
21602
- .pf-l-gallery {
21603
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))));
21604
- }
21605
- }
21606
- @media (min-width: 1200px) {
21607
- .pf-l-gallery {
21608
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)))));
21609
- }
21610
- }
21611
- @media (min-width: 1450px) {
21612
- .pf-l-gallery {
21613
- --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-2xl, var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))))));
21614
- }
21615
- }
21616
- @media (min-width: 576px) {
21617
- .pf-l-gallery {
21618
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max));
21619
- }
21620
- }
21621
- @media (min-width: 768px) {
21622
- .pf-l-gallery {
21623
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)));
21624
- }
21625
- }
21626
- @media (min-width: 992px) {
21627
- .pf-l-gallery {
21628
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))));
21629
- }
21630
- }
21631
- @media (min-width: 1200px) {
21632
- .pf-l-gallery {
21633
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)))));
21634
- }
21635
- }
21636
- @media (min-width: 1450px) {
21637
- .pf-l-gallery {
21638
- --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-2xl, var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))))));
21639
- }
21640
- }
21641
21572
  .pf-l-flex {
21642
21573
  --pf-l-flex--Display: flex;
21643
21574
  --pf-l-flex--FlexWrap: wrap;
@@ -23714,6 +23645,75 @@ svg.pf-c-spinner.pf-m-xl {
23714
23645
  --pf-l-flex--spacer: var(--pf-l-flex--spacer--4xl);
23715
23646
  }
23716
23647
  }
23648
+ .pf-l-gallery {
23649
+ --pf-l-gallery--m-gutter--GridGap: var(--pf-global--gutter);
23650
+ --pf-l-gallery--GridTemplateColumns--min: 250px;
23651
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
23652
+ --pf-l-gallery--GridTemplateColumns--max: 1fr;
23653
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
23654
+ --pf-l-gallery--GridTemplateColumns: repeat(auto-fill, minmax(var(--pf-l-gallery--GridTemplateColumns--minmax--min), var(--pf-l-gallery--GridTemplateColumns--minmax--max)));
23655
+ --pf-l-gallery--GridTemplateRows: auto;
23656
+ display: grid;
23657
+ grid-template-columns: var(--pf-l-gallery--GridTemplateColumns);
23658
+ grid-template-rows: var(--pf-l-gallery--GridTemplateRows);
23659
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min);
23660
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max);
23661
+ }
23662
+
23663
+ .pf-l-gallery.pf-m-gutter {
23664
+ grid-gap: var(--pf-l-gallery--m-gutter--GridGap);
23665
+ }
23666
+
23667
+ @media (min-width: 576px) {
23668
+ .pf-l-gallery {
23669
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min));
23670
+ }
23671
+ }
23672
+ @media (min-width: 768px) {
23673
+ .pf-l-gallery {
23674
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)));
23675
+ }
23676
+ }
23677
+ @media (min-width: 992px) {
23678
+ .pf-l-gallery {
23679
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))));
23680
+ }
23681
+ }
23682
+ @media (min-width: 1200px) {
23683
+ .pf-l-gallery {
23684
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min)))));
23685
+ }
23686
+ }
23687
+ @media (min-width: 1450px) {
23688
+ .pf-l-gallery {
23689
+ --pf-l-gallery--GridTemplateColumns--minmax--min: var(--pf-l-gallery--GridTemplateColumns--min-on-2xl, var(--pf-l-gallery--GridTemplateColumns--min-on-xl, var(--pf-l-gallery--GridTemplateColumns--min-on-lg, var(--pf-l-gallery--GridTemplateColumns--min-on-md, var(--pf-l-gallery--GridTemplateColumns--min-on-sm, var(--pf-l-gallery--GridTemplateColumns--min))))));
23690
+ }
23691
+ }
23692
+ @media (min-width: 576px) {
23693
+ .pf-l-gallery {
23694
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max));
23695
+ }
23696
+ }
23697
+ @media (min-width: 768px) {
23698
+ .pf-l-gallery {
23699
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)));
23700
+ }
23701
+ }
23702
+ @media (min-width: 992px) {
23703
+ .pf-l-gallery {
23704
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))));
23705
+ }
23706
+ }
23707
+ @media (min-width: 1200px) {
23708
+ .pf-l-gallery {
23709
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max)))));
23710
+ }
23711
+ }
23712
+ @media (min-width: 1450px) {
23713
+ .pf-l-gallery {
23714
+ --pf-l-gallery--GridTemplateColumns--minmax--max: var(--pf-l-gallery--GridTemplateColumns--max-on-2xl, var(--pf-l-gallery--GridTemplateColumns--max-on-xl, var(--pf-l-gallery--GridTemplateColumns--max-on-lg, var(--pf-l-gallery--GridTemplateColumns--max-on-md, var(--pf-l-gallery--GridTemplateColumns--max-on-sm, var(--pf-l-gallery--GridTemplateColumns--max))))));
23715
+ }
23716
+ }
23717
23717
  .pf-l-grid {
23718
23718
  --pf-l-grid--m-gutter--GridGap: var(--pf-global--gutter);
23719
23719
  --pf-l-grid__item--GridColumnStart: auto;
@@ -987,22 +987,23 @@
987
987
  * @param {HTMLElement} container The container to check if the element is in view of.
988
988
  * @param {HTMLElement} element The element to check if it is view
989
989
  * @param {boolean} partial true if partial view is allowed
990
+ * @param {boolean} strict true if strict mode is set, never consider the container width and element width
990
991
  *
991
992
  * @returns { boolean } True if the component is in View.
992
993
  */
993
- function isElementInView(container, element, partial) {
994
+ function isElementInView(container, element, partial, strict = false) {
994
995
  if (!container || !element) {
995
996
  return false;
996
997
  }
997
998
  const containerBounds = container.getBoundingClientRect();
998
999
  const elementBounds = element.getBoundingClientRect();
999
- const containerBoundsLeft = Math.floor(containerBounds.left);
1000
+ const containerBoundsLeft = Math.ceil(containerBounds.left);
1000
1001
  const containerBoundsRight = Math.floor(containerBounds.right);
1001
- const elementBoundsLeft = Math.floor(elementBounds.left);
1002
+ const elementBoundsLeft = Math.ceil(elementBounds.left);
1002
1003
  const elementBoundsRight = Math.floor(elementBounds.right);
1003
1004
  // Check if in view
1004
1005
  const isTotallyInView = elementBoundsLeft >= containerBoundsLeft && elementBoundsRight <= containerBoundsRight;
1005
- const isPartiallyInView = partial &&
1006
+ const isPartiallyInView = (partial || (!strict && containerBounds.width < elementBounds.width)) &&
1006
1007
  ((elementBoundsLeft < containerBoundsLeft && elementBoundsRight > containerBoundsLeft) ||
1007
1008
  (elementBoundsRight > containerBoundsRight && elementBoundsLeft < containerBoundsRight));
1008
1009
  // Return outcome
@@ -17546,25 +17547,30 @@
17546
17547
  constructor(props) {
17547
17548
  super(props);
17548
17549
  this.tabList = React__namespace.createRef();
17550
+ this.scrollTimeout = null;
17549
17551
  this.handleScrollButtons = () => {
17550
- const container = this.tabList.current;
17551
- let disableLeftScrollButton = true;
17552
- let disableRightScrollButton = true;
17553
- let showScrollButtons = false;
17554
- if (container && !this.props.isVertical) {
17555
- // get first element and check if it is in view
17556
- const overflowOnLeft = !isElementInView(container, container.firstChild, false);
17557
- // get last element and check if it is in view
17558
- const overflowOnRight = !isElementInView(container, container.lastChild, false);
17559
- showScrollButtons = overflowOnLeft || overflowOnRight;
17560
- disableLeftScrollButton = !overflowOnLeft;
17561
- disableRightScrollButton = !overflowOnRight;
17562
- }
17563
- this.setState({
17564
- showScrollButtons,
17565
- disableLeftScrollButton,
17566
- disableRightScrollButton
17567
- });
17552
+ // add debounce to the scroll event
17553
+ clearTimeout(this.scrollTimeout);
17554
+ this.scrollTimeout = setTimeout(() => {
17555
+ const container = this.tabList.current;
17556
+ let disableLeftScrollButton = true;
17557
+ let disableRightScrollButton = true;
17558
+ let showScrollButtons = false;
17559
+ if (container && !this.props.isVertical) {
17560
+ // get first element and check if it is in view
17561
+ const overflowOnLeft = !isElementInView(container, container.firstChild, false);
17562
+ // get last element and check if it is in view
17563
+ const overflowOnRight = !isElementInView(container, container.lastChild, false);
17564
+ showScrollButtons = overflowOnLeft || overflowOnRight;
17565
+ disableLeftScrollButton = !overflowOnLeft;
17566
+ disableRightScrollButton = !overflowOnRight;
17567
+ }
17568
+ this.setState({
17569
+ showScrollButtons,
17570
+ disableLeftScrollButton,
17571
+ disableRightScrollButton
17572
+ });
17573
+ }, 100);
17568
17574
  };
17569
17575
  this.scrollLeft = () => {
17570
17576
  // find first Element that is fully in view on the left, then scroll to the element before it
@@ -17663,6 +17669,7 @@
17663
17669
  window.removeEventListener('resize', this.handleScrollButtons, false);
17664
17670
  }
17665
17671
  }
17672
+ clearTimeout(this.scrollTimeout);
17666
17673
  }
17667
17674
  componentDidUpdate(prevProps) {
17668
17675
  const { activeKey, mountOnEnter } = this.props;
@@ -17814,7 +17821,7 @@
17814
17821
  .getMinutes()
17815
17822
  .toString()
17816
17823
  .padStart(2, '0');
17817
- const timeOption = hour + delimiter + minutes + (hour12 ? suffix : '');
17824
+ const timeOption = `${hour}${delimiter}${minutes}${hour12 ? suffix : ''}`;
17818
17825
  // time option is valid if within min/max constraints
17819
17826
  if (isWithinMinMax(minTime, maxTime, timeOption, delimiter)) {
17820
17827
  res.push(timeOption);
@@ -17823,7 +17830,7 @@
17823
17830
  }
17824
17831
  return res;
17825
17832
  };
17826
- const parseTime = (time, timeRegex, delimiter, is12Hour) => {
17833
+ const parseTime = (time, timeRegex, delimiter, is12Hour, includeSeconds) => {
17827
17834
  const date = new Date(time);
17828
17835
  // if default time is a ISO 8601 formatted date string, we parse it to hh:mm(am/pm) format
17829
17836
  if (!isNaN(date.getDate()) && (time instanceof Date || time.includes('T'))) {
@@ -17831,6 +17838,8 @@
17831
17838
  ? `${date.getHours() > 12 ? date.getHours() - 12 : date.getHours()}`
17832
17839
  : `${date.getHours()}`.padStart(2, '0');
17833
17840
  const minutes = `${date.getMinutes()}`.padStart(2, '0');
17841
+ const seconds = includeSeconds ? `${date.getSeconds()}`.padStart(2, '0') : '';
17842
+ const secondsWithDelimiter = seconds ? `${delimiter}${seconds}` : '';
17834
17843
  let ampm = '';
17835
17844
  if (is12Hour && date.getHours() > 11) {
17836
17845
  ampm = pmSuffix;
@@ -17838,27 +17847,30 @@
17838
17847
  else if (is12Hour) {
17839
17848
  ampm = amSuffix;
17840
17849
  }
17841
- return `${hours}${delimiter}${minutes}${ampm}`;
17850
+ return `${hours}${delimiter}${minutes}${secondsWithDelimiter}${ampm}`;
17842
17851
  }
17843
17852
  else if (typeof time === 'string') {
17844
17853
  time = time.trim();
17845
- if (is12Hour && time !== '' && validateTime(time, timeRegex, delimiter, is12Hour)) {
17846
- const [, hours, minutes, suffix = ''] = timeRegex.exec(time);
17847
- const uppercaseSuffix = suffix.toUpperCase();
17848
- // Format AM/PM according to design
17854
+ if (time !== '' && validateTime(time, timeRegex, delimiter, is12Hour)) {
17855
+ const [, hours, minutes, seconds, suffix = ''] = timeRegex.exec(time);
17856
+ const secondsWithDelimiter = includeSeconds ? `${delimiter}${seconds !== null && seconds !== void 0 ? seconds : '00'}` : '';
17849
17857
  let ampm = '';
17850
- if (uppercaseSuffix === amSuffix.toUpperCase().trim()) {
17851
- ampm = amSuffix;
17852
- }
17853
- else if (uppercaseSuffix === pmSuffix.toUpperCase().trim()) {
17854
- ampm = pmSuffix;
17855
- }
17856
- else {
17857
- // if this 12 hour time is missing am/pm but otherwise valid,
17858
- // append am/pm depending on time of day
17859
- ampm = new Date().getHours() > 11 ? pmSuffix : amSuffix;
17858
+ // Format AM/PM according to design
17859
+ if (is12Hour) {
17860
+ const uppercaseSuffix = suffix.toUpperCase();
17861
+ if (uppercaseSuffix === amSuffix.toUpperCase().trim()) {
17862
+ ampm = amSuffix;
17863
+ }
17864
+ else if (uppercaseSuffix === pmSuffix.toUpperCase().trim()) {
17865
+ ampm = pmSuffix;
17866
+ }
17867
+ else {
17868
+ // if this 12 hour time is missing am/pm but otherwise valid,
17869
+ // append am/pm depending on time of day
17870
+ ampm = new Date().getHours() > 11 ? pmSuffix : amSuffix;
17871
+ }
17860
17872
  }
17861
- return `${hours}${delimiter}${minutes}${ampm}`;
17873
+ return `${hours}${delimiter}${minutes}${secondsWithDelimiter}${ampm}`;
17862
17874
  }
17863
17875
  }
17864
17876
  return time.toString();
@@ -17879,10 +17891,10 @@
17879
17891
  const getHours = (time, timeRegex) => {
17880
17892
  const parts = time.match(timeRegex);
17881
17893
  if (parts && parts.length) {
17882
- if (/pm/i.test(parts[3])) {
17894
+ if (/pm/i.test(parts[4])) {
17883
17895
  return parseInt(parts[1]) === 12 ? parseInt(parts[1]) : parseInt(parts[1]) + 12;
17884
17896
  }
17885
- if (/am/i.test(parts[3])) {
17897
+ if (/am/i.test(parts[4])) {
17886
17898
  return parseInt(parts[1]) === 12 ? 0 : parseInt(parts[1]);
17887
17899
  }
17888
17900
  return parseInt(parts[1]);
@@ -17893,34 +17905,44 @@
17893
17905
  const parts = time.match(timeRegex);
17894
17906
  return parts && parts.length ? parseInt(parts[2]) : null;
17895
17907
  };
17896
- const isWithinMinMax = (minTime, maxTime, time, delimiter) => {
17908
+ const getSeconds = (time, timeRegex) => {
17909
+ var _a;
17910
+ const seconds = (_a = time.match(timeRegex)) === null || _a === void 0 ? void 0 : _a[3];
17911
+ return seconds ? parseInt(seconds) : null;
17912
+ };
17913
+ const isWithinMinMax = (minTime, maxTime, time, delimiter, includeSeconds) => {
17897
17914
  // do not throw error if empty string
17898
17915
  if (time.trim() === '') {
17899
17916
  return true;
17900
17917
  }
17901
- const convertTo24Hour = (time) => {
17902
- const timeReg = new RegExp(`^\\s*(\\d\\d?)${delimiter}([0-5]\\d)\\s*([AaPp][Mm])?\\s*$`);
17903
- const regMatches = timeReg.exec(time);
17904
- if (!regMatches || !regMatches.length) {
17905
- return;
17906
- }
17907
- let hours = regMatches[1].padStart(2, '0');
17908
- const minutes = regMatches[2];
17909
- const suffix = regMatches[3] || '';
17910
- if (suffix.toUpperCase() === 'PM' && hours !== '12') {
17911
- hours = `${parseInt(hours) + 12}`;
17912
- }
17913
- else if (suffix.toUpperCase() === 'AM' && hours === '12') {
17914
- hours = '00';
17915
- }
17916
- return `${hours}${delimiter}${minutes}`;
17917
- };
17918
17918
  // correctly format as 24hr times (12:30AM => 00:30, 1:15 => 01:15)
17919
- minTime = convertTo24Hour(minTime);
17920
- time = convertTo24Hour(time);
17921
- maxTime = convertTo24Hour(maxTime);
17919
+ const min24HourTime = convertTo24Hour(minTime, delimiter, includeSeconds);
17920
+ const selected24HourTime = convertTo24Hour(time, delimiter, includeSeconds);
17921
+ const max24HourTime = convertTo24Hour(maxTime, delimiter, includeSeconds);
17922
17922
  // simple string comparison for 24hr times
17923
- return minTime <= time && time <= maxTime;
17923
+ return min24HourTime <= selected24HourTime && selected24HourTime <= max24HourTime;
17924
+ };
17925
+ const convertTo24Hour = (time, delimiter, includeSeconds) => {
17926
+ const timeReg = new RegExp(`^\\s*(\\d\\d?)${delimiter}([0-5]\\d)${delimiter}?([0-5]\\d)?\\s*([AaPp][Mm])?\\s*$`);
17927
+ const regMatches = timeReg.exec(time);
17928
+ if (!regMatches || !regMatches.length) {
17929
+ return;
17930
+ }
17931
+ let hours = regMatches[1].padStart(2, '0');
17932
+ const minutes = regMatches[2];
17933
+ let seconds = regMatches[3] ? `${delimiter}${regMatches[3]}` : '';
17934
+ // When seconds is empty and 'includeSeconds' is enabled, append 0 seconds.
17935
+ if (!seconds && includeSeconds) {
17936
+ seconds = `${delimiter}00`;
17937
+ }
17938
+ const suffix = regMatches[4] || '';
17939
+ if (suffix.toUpperCase() === 'PM' && hours !== '12') {
17940
+ hours = `${parseInt(hours) + 12}`;
17941
+ }
17942
+ else if (suffix.toUpperCase() === 'AM' && hours === '12') {
17943
+ hours = '00';
17944
+ }
17945
+ return `${hours}${delimiter}${minutes}${seconds}`;
17924
17946
  };
17925
17947
 
17926
17948
  class TimePicker extends React__namespace.Component {
@@ -18042,29 +18064,34 @@
18042
18064
  scrollIndex
18043
18065
  });
18044
18066
  };
18045
- this.getRegExp = () => this.props.is24Hour
18046
- ? new RegExp(`^\\s*(\\d\\d?)${this.props.delimiter}([0-5]\\d)\\s*$`)
18047
- : new RegExp(`^\\s*(\\d\\d?)${this.props.delimiter}([0-5]\\d)\\s*([AaPp][Mm])?\\s*$`);
18067
+ this.getRegExp = (includeSeconds = true) => {
18068
+ const { is24Hour, delimiter } = this.props;
18069
+ let baseRegex = `\\s*(\\d\\d?)${delimiter}([0-5]\\d)`;
18070
+ if (includeSeconds) {
18071
+ baseRegex += `${delimiter}?([0-5]\\d)?`;
18072
+ }
18073
+ return new RegExp(`^${baseRegex}${is24Hour ? '' : '\\s*([AaPp][Mm])?'}\\s*$`);
18074
+ };
18048
18075
  this.getOptions = () => (this.menuRef && this.menuRef.current ? Array.from(this.menuRef.current.children) : []);
18049
18076
  this.isValidFormat = (time) => {
18050
18077
  if (this.props.validateTime) {
18051
18078
  return this.props.validateTime(time);
18052
18079
  }
18053
- const { delimiter, is24Hour } = this.props;
18054
- return validateTime(time, this.state.timeRegex, delimiter, !is24Hour);
18080
+ const { delimiter, is24Hour, includeSeconds } = this.props;
18081
+ return validateTime(time, this.getRegExp(includeSeconds), delimiter, !is24Hour);
18055
18082
  };
18056
18083
  this.isValidTime = (time) => {
18057
- const { delimiter } = this.props;
18084
+ const { delimiter, includeSeconds } = this.props;
18058
18085
  const { minTimeState, maxTimeState } = this.state;
18059
- return isWithinMinMax(minTimeState, maxTimeState, time, delimiter);
18086
+ return isWithinMinMax(minTimeState, maxTimeState, time, delimiter, includeSeconds);
18060
18087
  };
18061
18088
  this.isValid = (time) => this.isValidFormat(time) && this.isValidTime(time);
18062
18089
  this.onToggle = (isOpen) => {
18063
18090
  // on close, parse and validate input
18064
18091
  this.setState(prevState => {
18065
18092
  const { timeRegex, isInvalid } = prevState;
18066
- const { delimiter, is24Hour } = this.props;
18067
- const time = parseTime(prevState.timeState, timeRegex, delimiter, !is24Hour);
18093
+ const { delimiter, is24Hour, includeSeconds } = this.props;
18094
+ const time = parseTime(prevState.timeState, timeRegex, delimiter, !is24Hour, includeSeconds);
18068
18095
  return {
18069
18096
  isOpen,
18070
18097
  timeState: time,
@@ -18074,8 +18101,8 @@
18074
18101
  };
18075
18102
  this.onSelect = (selection) => {
18076
18103
  const { timeRegex, timeState } = this.state;
18077
- const { delimiter, is24Hour } = this.props;
18078
- const time = parseTime(selection, timeRegex, delimiter, !is24Hour);
18104
+ const { delimiter, is24Hour, includeSeconds } = this.props;
18105
+ const time = parseTime(selection, timeRegex, delimiter, !is24Hour, includeSeconds);
18079
18106
  if (time !== timeState) {
18080
18107
  this.onInputChange(time);
18081
18108
  }
@@ -18090,8 +18117,10 @@
18090
18117
  e.stopPropagation();
18091
18118
  };
18092
18119
  this.onInputChange = (newTime) => {
18093
- if (this.props.onChange) {
18094
- this.props.onChange(newTime, getHours(newTime, this.state.timeRegex), getMinutes(newTime, this.state.timeRegex), this.isValid(newTime));
18120
+ const { onChange } = this.props;
18121
+ const { timeRegex } = this.state;
18122
+ if (onChange) {
18123
+ onChange(newTime, getHours(newTime, timeRegex), getMinutes(newTime, timeRegex), getSeconds(newTime, timeRegex), this.isValid(newTime));
18095
18124
  }
18096
18125
  this.scrollToSelection(newTime);
18097
18126
  this.setState({
@@ -18101,30 +18130,32 @@
18101
18130
  };
18102
18131
  this.onBlur = (event) => {
18103
18132
  const { timeRegex } = this.state;
18104
- const { delimiter, is24Hour } = this.props;
18105
- const time = parseTime(event.currentTarget.value, timeRegex, delimiter, !is24Hour);
18133
+ const { delimiter, is24Hour, includeSeconds } = this.props;
18134
+ const time = parseTime(event.currentTarget.value, timeRegex, delimiter, !is24Hour, includeSeconds);
18106
18135
  this.setState({
18107
18136
  isInvalid: !this.isValid(time)
18108
18137
  });
18109
18138
  };
18110
- const { is24Hour, delimiter, time } = this.props;
18139
+ const { is24Hour, delimiter, time, includeSeconds } = this.props;
18111
18140
  let { minTime, maxTime } = this.props;
18112
18141
  if (minTime === '') {
18113
- minTime = is24Hour ? `00${delimiter}00` : `12${delimiter}00AM`;
18142
+ const minSeconds = includeSeconds ? `${delimiter}00` : '';
18143
+ minTime = is24Hour ? `00${delimiter}00${minSeconds}` : `12${delimiter}00${minSeconds} AM`;
18114
18144
  }
18115
18145
  if (maxTime === '') {
18116
- maxTime = is24Hour ? `23${delimiter}59` : `11${delimiter}59PM`;
18146
+ const maxSeconds = includeSeconds ? `${delimiter}59` : '';
18147
+ maxTime = is24Hour ? `23${delimiter}59${maxSeconds}` : `11${delimiter}59${maxSeconds} PM`;
18117
18148
  }
18118
18149
  const timeRegex = this.getRegExp();
18119
18150
  this.state = {
18120
18151
  isInvalid: false,
18121
18152
  isOpen: false,
18122
- timeState: parseTime(time, timeRegex, delimiter, !is24Hour),
18153
+ timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds),
18123
18154
  focusedIndex: null,
18124
18155
  scrollIndex: 0,
18125
18156
  timeRegex,
18126
- minTimeState: parseTime(minTime, timeRegex, delimiter, !is24Hour),
18127
- maxTimeState: parseTime(maxTime, timeRegex, delimiter, !is24Hour)
18157
+ minTimeState: parseTime(minTime, timeRegex, delimiter, !is24Hour, includeSeconds),
18158
+ maxTimeState: parseTime(maxTime, timeRegex, delimiter, !is24Hour, includeSeconds)
18128
18159
  };
18129
18160
  }
18130
18161
  componentDidMount() {
@@ -18139,7 +18170,7 @@
18139
18170
  }
18140
18171
  componentDidUpdate(prevProps, prevState) {
18141
18172
  const { timeState, isOpen, isInvalid, timeRegex } = this.state;
18142
- const { time, is24Hour, delimiter } = this.props;
18173
+ const { time, is24Hour, delimiter, includeSeconds } = this.props;
18143
18174
  if (isOpen && !prevState.isOpen && timeState && !isInvalid) {
18144
18175
  this.scrollToSelection(timeState);
18145
18176
  }
@@ -18150,14 +18181,16 @@
18150
18181
  }
18151
18182
  if (time !== '' && time !== prevProps.time) {
18152
18183
  this.setState({
18153
- timeState: parseTime(time, timeRegex, delimiter, !is24Hour)
18184
+ timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds)
18154
18185
  });
18155
18186
  }
18156
18187
  }
18157
18188
  render() {
18158
- const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, invalidMinMaxErrorMessage, direction, stepMinutes, width, delimiter,
18189
+ const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, invalidMinMaxErrorMessage, direction, stepMinutes, width, delimiter, inputProps,
18159
18190
  /* eslint-disable @typescript-eslint/no-unused-vars */
18160
- 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"]);
18191
+ onChange, time, validateTime, minTime, maxTime, includeSeconds } = _a,
18192
+ /* eslint-enable @typescript-eslint/no-unused-vars */
18193
+ props = __rest$1(_a, ['aria-label', "isDisabled", "className", "placeholder", "id", "menuAppendTo", "is24Hour", "invalidFormatErrorMessage", "invalidMinMaxErrorMessage", "direction", "stepMinutes", "width", "delimiter", "inputProps", "onChange", "time", "validateTime", "minTime", "maxTime", "includeSeconds"]);
18161
18194
  const { timeState, isOpen, isInvalid, focusedIndex, minTimeState, maxTimeState } = this.state;
18162
18195
  const style = { '--pf-c-date-picker__input--c-form-control--Width': width };
18163
18196
  const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState);
@@ -18747,9 +18780,20 @@
18747
18780
 
18748
18781
  var PlusIcon$1 = PlusIcon;
18749
18782
 
18783
+ const defaultKeyDownHandler = (args) => (event) => {
18784
+ if (KEY_CODES.ARROW_UP === event.keyCode && args.onPlus) {
18785
+ event.preventDefault();
18786
+ args.onPlus(null, args.inputName);
18787
+ }
18788
+ if (KEY_CODES.ARROW_DOWN === event.keyCode && args.onMinus) {
18789
+ event.preventDefault();
18790
+ args.onMinus(null, args.inputName);
18791
+ }
18792
+ };
18750
18793
  const NumberInput = (_a) => {
18751
18794
  var { value = 0, className, widthChars, isDisabled = false, onMinus = () => { }, onChange, onPlus = () => { }, unit, unitPosition = 'after', min, max, inputName, inputAriaLabel = 'Input', minusBtnAriaLabel = 'Minus', plusBtnAriaLabel = 'Plus', inputProps, minusBtnProps, plusBtnProps } = _a, props = __rest$1(_a, ["value", "className", "widthChars", "isDisabled", "onMinus", "onChange", "onPlus", "unit", "unitPosition", "min", "max", "inputName", "inputAriaLabel", "minusBtnAriaLabel", "plusBtnAriaLabel", "inputProps", "minusBtnProps", "plusBtnProps"]);
18752
18795
  const numberInputUnit = React__namespace.createElement("div", { className: css(_default$b.numberInputUnit) }, unit);
18796
+ const keyDownHandler = inputProps && inputProps.onKeyDown ? inputProps.onKeyDown : defaultKeyDownHandler({ inputName, onMinus, onPlus });
18753
18797
  return (React__namespace.createElement("div", Object.assign({ className: css(_default$b.numberInput, className) }, (widthChars && {
18754
18798
  style: Object.assign({ '--pf-c-number-input--c-form-control--width-chars': widthChars }, props.style)
18755
18799
  }), props),
@@ -18758,7 +18802,7 @@
18758
18802
  React__namespace.createElement(Button, Object.assign({ variant: "control", "aria-label": minusBtnAriaLabel, isDisabled: isDisabled || value === min, onClick: evt => onMinus(evt, inputName) }, minusBtnProps),
18759
18803
  React__namespace.createElement("span", { className: css(_default$b.numberInputIcon) },
18760
18804
  React__namespace.createElement(MinusIcon$1, { "aria-hidden": "true" }))),
18761
- React__namespace.createElement("input", Object.assign({ className: css(_default$b.formControl), type: "number", value: value, name: inputName, "aria-label": inputAriaLabel }, (isDisabled && { disabled: isDisabled }), (onChange && { onChange }), (!onChange && { readOnly: true }), inputProps)),
18805
+ React__namespace.createElement("input", Object.assign({ className: css(_default$b.formControl), type: "number", value: value, name: inputName, "aria-label": inputAriaLabel }, (isDisabled && { disabled: isDisabled }), (onChange && { onChange }), (!onChange && { readOnly: true }), inputProps, { onKeyDown: keyDownHandler })),
18762
18806
  React__namespace.createElement(Button, Object.assign({ variant: "control", "aria-label": plusBtnAriaLabel, isDisabled: isDisabled || value === max, onClick: evt => onPlus(evt, inputName) }, plusBtnProps),
18763
18807
  React__namespace.createElement("span", { className: css(_default$b.numberInputIcon) },
18764
18808
  React__namespace.createElement(PlusIcon$1, { "aria-hidden": "true" })))),
@@ -1305,40 +1305,6 @@ textarea.pf-c-form-control {
1305
1305
  display: block;
1306
1306
  }
1307
1307
 
1308
- .pf-c-badge {
1309
- --pf-c-badge--BorderRadius: var(--pf-global--BorderRadius--lg);
1310
- --pf-c-badge--FontSize: var(--pf-global--FontSize--xs);
1311
- --pf-c-badge--FontWeight: var(--pf-global--FontWeight--bold);
1312
- --pf-c-badge--PaddingRight: var(--pf-global--spacer--sm);
1313
- --pf-c-badge--PaddingLeft: var(--pf-global--spacer--sm);
1314
- --pf-c-badge--Color: var(--pf-global--Color--dark-100);
1315
- --pf-c-badge--MinWidth: var(--pf-global--spacer--xl);
1316
- --pf-c-badge--m-read--BackgroundColor: var(--pf-global--BackgroundColor--200);
1317
- --pf-c-badge--m-read--Color: var(--pf-global--Color--dark-100);
1318
- --pf-c-badge--m-unread--BackgroundColor: var(--pf-global--primary-color--100);
1319
- --pf-c-badge--m-unread--Color: var(--pf-global--Color--light-100);
1320
- display: inline-block;
1321
- min-width: var(--pf-c-badge--MinWidth);
1322
- padding-right: var(--pf-c-badge--PaddingRight);
1323
- padding-left: var(--pf-c-badge--PaddingLeft);
1324
- font-size: var(--pf-c-badge--FontSize);
1325
- font-weight: var(--pf-c-badge--FontWeight);
1326
- color: var(--pf-c-badge--Color);
1327
- text-align: center;
1328
- background-color: var(--pf-c-badge--BackgroundColor);
1329
- border-radius: var(--pf-c-badge--BorderRadius);
1330
- }
1331
-
1332
- .pf-c-badge.pf-m-read {
1333
- --pf-c-badge--Color: var(--pf-c-badge--m-read--Color);
1334
- --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-read--BackgroundColor);
1335
- }
1336
-
1337
- .pf-c-badge.pf-m-unread {
1338
- --pf-c-badge--Color: var(--pf-c-badge--m-unread--Color);
1339
- --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-unread--BackgroundColor);
1340
- }
1341
-
1342
1308
  .pf-c-banner.pf-m-warning, .pf-c-banner.pf-m-info {
1343
1309
  --pf-global--Color--100: var(--pf-global--Color--dark-100);
1344
1310
  --pf-global--Color--200: var(--pf-global--Color--dark-200);
@@ -1480,6 +1446,40 @@ textarea.pf-c-form-control {
1480
1446
  cursor: not-allowed;
1481
1447
  }
1482
1448
 
1449
+ .pf-c-badge {
1450
+ --pf-c-badge--BorderRadius: var(--pf-global--BorderRadius--lg);
1451
+ --pf-c-badge--FontSize: var(--pf-global--FontSize--xs);
1452
+ --pf-c-badge--FontWeight: var(--pf-global--FontWeight--bold);
1453
+ --pf-c-badge--PaddingRight: var(--pf-global--spacer--sm);
1454
+ --pf-c-badge--PaddingLeft: var(--pf-global--spacer--sm);
1455
+ --pf-c-badge--Color: var(--pf-global--Color--dark-100);
1456
+ --pf-c-badge--MinWidth: var(--pf-global--spacer--xl);
1457
+ --pf-c-badge--m-read--BackgroundColor: var(--pf-global--BackgroundColor--200);
1458
+ --pf-c-badge--m-read--Color: var(--pf-global--Color--dark-100);
1459
+ --pf-c-badge--m-unread--BackgroundColor: var(--pf-global--primary-color--100);
1460
+ --pf-c-badge--m-unread--Color: var(--pf-global--Color--light-100);
1461
+ display: inline-block;
1462
+ min-width: var(--pf-c-badge--MinWidth);
1463
+ padding-right: var(--pf-c-badge--PaddingRight);
1464
+ padding-left: var(--pf-c-badge--PaddingLeft);
1465
+ font-size: var(--pf-c-badge--FontSize);
1466
+ font-weight: var(--pf-c-badge--FontWeight);
1467
+ color: var(--pf-c-badge--Color);
1468
+ text-align: center;
1469
+ background-color: var(--pf-c-badge--BackgroundColor);
1470
+ border-radius: var(--pf-c-badge--BorderRadius);
1471
+ }
1472
+
1473
+ .pf-c-badge.pf-m-read {
1474
+ --pf-c-badge--Color: var(--pf-c-badge--m-read--Color);
1475
+ --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-read--BackgroundColor);
1476
+ }
1477
+
1478
+ .pf-c-badge.pf-m-unread {
1479
+ --pf-c-badge--Color: var(--pf-c-badge--m-unread--Color);
1480
+ --pf-c-badge--BackgroundColor: var(--pf-c-badge--m-unread--BackgroundColor);
1481
+ }
1482
+
1483
1483
  .pf-c-breadcrumb {
1484
1484
  --pf-c-breadcrumb__item--FontSize: var(--pf-global--FontSize--sm);
1485
1485
  --pf-c-breadcrumb__item--LineHeight: var(--pf-global--LineHeight--sm);