@patternfly/react-core 4.189.3 → 4.191.0
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/CHANGELOG.md +41 -0
- package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +13 -1
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +2 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +24 -18
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts +6 -4
- package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +37 -26
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePickerUtils.d.ts +3 -2
- package/dist/esm/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePickerUtils.js +57 -42
- package/dist/esm/components/TimePicker/TimePickerUtils.js.map +1 -1
- package/dist/esm/helpers/util.d.ts +2 -1
- package/dist/esm/helpers/util.d.ts.map +1 -1
- package/dist/esm/helpers/util.js +5 -4
- package/dist/esm/helpers/util.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +13 -1
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +2 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +24 -18
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts +6 -4
- package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +36 -25
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/TimePicker/TimePickerUtils.d.ts +3 -2
- package/dist/js/components/TimePicker/TimePickerUtils.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePickerUtils.js +59 -43
- package/dist/js/components/TimePicker/TimePickerUtils.js.map +1 -1
- package/dist/js/helpers/util.d.ts +2 -1
- package/dist/js/helpers/util.d.ts.map +1 -1
- package/dist/js/helpers/util.js +5 -4
- package/dist/js/helpers/util.js.map +1 -1
- package/dist/umd/react-core.css +18 -0
- package/dist/umd/react-core.js +135 -90
- package/dist/umd/react-core.min.css +18 -0
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +6 -6
- package/src/components/NumberInput/NumberInput.tsx +17 -0
- package/src/components/NumberInput/__tests__/__snapshots__/NumberInput.test.tsx.snap +10 -0
- package/src/components/NumberInput/examples/NumberInput.md +43 -0
- package/src/components/Tabs/Tabs.tsx +25 -18
- package/src/components/TimePicker/TimePicker.tsx +54 -31
- package/src/components/TimePicker/TimePickerUtils.tsx +76 -39
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +49 -11
- package/src/components/TimePicker/examples/TimePicker.md +19 -2
- package/src/helpers/util.ts +10 -4
package/dist/umd/react-core.js
CHANGED
|
@@ -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.
|
|
1000
|
+
const containerBoundsLeft = Math.ceil(containerBounds.left);
|
|
1000
1001
|
const containerBoundsRight = Math.floor(containerBounds.right);
|
|
1001
|
-
const elementBoundsLeft = Math.
|
|
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
|
|
@@ -9315,6 +9316,7 @@
|
|
|
9315
9316
|
"descriptionListDescription": "pf-c-description-list__description",
|
|
9316
9317
|
"descriptionListGroup": "pf-c-description-list__group",
|
|
9317
9318
|
"descriptionListTerm": "pf-c-description-list__term",
|
|
9319
|
+
"descriptionListTermIcon": "pf-c-description-list__term-icon",
|
|
9318
9320
|
"descriptionListText": "pf-c-description-list__text",
|
|
9319
9321
|
"modifiers": {
|
|
9320
9322
|
"inlineGrid": "pf-m-inline-grid",
|
|
@@ -17545,25 +17547,30 @@
|
|
|
17545
17547
|
constructor(props) {
|
|
17546
17548
|
super(props);
|
|
17547
17549
|
this.tabList = React__namespace.createRef();
|
|
17550
|
+
this.scrollTimeout = null;
|
|
17548
17551
|
this.handleScrollButtons = () => {
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
|
|
17566
|
-
|
|
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);
|
|
17567
17574
|
};
|
|
17568
17575
|
this.scrollLeft = () => {
|
|
17569
17576
|
// find first Element that is fully in view on the left, then scroll to the element before it
|
|
@@ -17662,6 +17669,7 @@
|
|
|
17662
17669
|
window.removeEventListener('resize', this.handleScrollButtons, false);
|
|
17663
17670
|
}
|
|
17664
17671
|
}
|
|
17672
|
+
clearTimeout(this.scrollTimeout);
|
|
17665
17673
|
}
|
|
17666
17674
|
componentDidUpdate(prevProps) {
|
|
17667
17675
|
const { activeKey, mountOnEnter } = this.props;
|
|
@@ -17813,7 +17821,7 @@
|
|
|
17813
17821
|
.getMinutes()
|
|
17814
17822
|
.toString()
|
|
17815
17823
|
.padStart(2, '0');
|
|
17816
|
-
const timeOption = hour
|
|
17824
|
+
const timeOption = `${hour}${delimiter}${minutes}${hour12 ? suffix : ''}`;
|
|
17817
17825
|
// time option is valid if within min/max constraints
|
|
17818
17826
|
if (isWithinMinMax(minTime, maxTime, timeOption, delimiter)) {
|
|
17819
17827
|
res.push(timeOption);
|
|
@@ -17822,7 +17830,7 @@
|
|
|
17822
17830
|
}
|
|
17823
17831
|
return res;
|
|
17824
17832
|
};
|
|
17825
|
-
const parseTime = (time, timeRegex, delimiter, is12Hour) => {
|
|
17833
|
+
const parseTime = (time, timeRegex, delimiter, is12Hour, includeSeconds) => {
|
|
17826
17834
|
const date = new Date(time);
|
|
17827
17835
|
// if default time is a ISO 8601 formatted date string, we parse it to hh:mm(am/pm) format
|
|
17828
17836
|
if (!isNaN(date.getDate()) && (time instanceof Date || time.includes('T'))) {
|
|
@@ -17830,6 +17838,8 @@
|
|
|
17830
17838
|
? `${date.getHours() > 12 ? date.getHours() - 12 : date.getHours()}`
|
|
17831
17839
|
: `${date.getHours()}`.padStart(2, '0');
|
|
17832
17840
|
const minutes = `${date.getMinutes()}`.padStart(2, '0');
|
|
17841
|
+
const seconds = includeSeconds ? `${date.getSeconds()}`.padStart(2, '0') : '';
|
|
17842
|
+
const secondsWithDelimiter = seconds ? `${delimiter}${seconds}` : '';
|
|
17833
17843
|
let ampm = '';
|
|
17834
17844
|
if (is12Hour && date.getHours() > 11) {
|
|
17835
17845
|
ampm = pmSuffix;
|
|
@@ -17837,27 +17847,30 @@
|
|
|
17837
17847
|
else if (is12Hour) {
|
|
17838
17848
|
ampm = amSuffix;
|
|
17839
17849
|
}
|
|
17840
|
-
return `${hours}${delimiter}${minutes}${ampm}`;
|
|
17850
|
+
return `${hours}${delimiter}${minutes}${secondsWithDelimiter}${ampm}`;
|
|
17841
17851
|
}
|
|
17842
17852
|
else if (typeof time === 'string') {
|
|
17843
17853
|
time = time.trim();
|
|
17844
|
-
if (
|
|
17845
|
-
const [, hours, minutes, suffix = ''] = timeRegex.exec(time);
|
|
17846
|
-
const
|
|
17847
|
-
// 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'}` : '';
|
|
17848
17857
|
let ampm = '';
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
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
|
+
}
|
|
17859
17872
|
}
|
|
17860
|
-
return `${hours}${delimiter}${minutes}${ampm}`;
|
|
17873
|
+
return `${hours}${delimiter}${minutes}${secondsWithDelimiter}${ampm}`;
|
|
17861
17874
|
}
|
|
17862
17875
|
}
|
|
17863
17876
|
return time.toString();
|
|
@@ -17878,10 +17891,10 @@
|
|
|
17878
17891
|
const getHours = (time, timeRegex) => {
|
|
17879
17892
|
const parts = time.match(timeRegex);
|
|
17880
17893
|
if (parts && parts.length) {
|
|
17881
|
-
if (/pm/i.test(parts[
|
|
17894
|
+
if (/pm/i.test(parts[4])) {
|
|
17882
17895
|
return parseInt(parts[1]) === 12 ? parseInt(parts[1]) : parseInt(parts[1]) + 12;
|
|
17883
17896
|
}
|
|
17884
|
-
if (/am/i.test(parts[
|
|
17897
|
+
if (/am/i.test(parts[4])) {
|
|
17885
17898
|
return parseInt(parts[1]) === 12 ? 0 : parseInt(parts[1]);
|
|
17886
17899
|
}
|
|
17887
17900
|
return parseInt(parts[1]);
|
|
@@ -17892,34 +17905,44 @@
|
|
|
17892
17905
|
const parts = time.match(timeRegex);
|
|
17893
17906
|
return parts && parts.length ? parseInt(parts[2]) : null;
|
|
17894
17907
|
};
|
|
17895
|
-
const
|
|
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) => {
|
|
17896
17914
|
// do not throw error if empty string
|
|
17897
17915
|
if (time.trim() === '') {
|
|
17898
17916
|
return true;
|
|
17899
17917
|
}
|
|
17900
|
-
const convertTo24Hour = (time) => {
|
|
17901
|
-
const timeReg = new RegExp(`^\\s*(\\d\\d?)${delimiter}([0-5]\\d)\\s*([AaPp][Mm])?\\s*$`);
|
|
17902
|
-
const regMatches = timeReg.exec(time);
|
|
17903
|
-
if (!regMatches || !regMatches.length) {
|
|
17904
|
-
return;
|
|
17905
|
-
}
|
|
17906
|
-
let hours = regMatches[1].padStart(2, '0');
|
|
17907
|
-
const minutes = regMatches[2];
|
|
17908
|
-
const suffix = regMatches[3] || '';
|
|
17909
|
-
if (suffix.toUpperCase() === 'PM' && hours !== '12') {
|
|
17910
|
-
hours = `${parseInt(hours) + 12}`;
|
|
17911
|
-
}
|
|
17912
|
-
else if (suffix.toUpperCase() === 'AM' && hours === '12') {
|
|
17913
|
-
hours = '00';
|
|
17914
|
-
}
|
|
17915
|
-
return `${hours}${delimiter}${minutes}`;
|
|
17916
|
-
};
|
|
17917
17918
|
// correctly format as 24hr times (12:30AM => 00:30, 1:15 => 01:15)
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17919
|
+
const min24HourTime = convertTo24Hour(minTime, delimiter, includeSeconds);
|
|
17920
|
+
const selected24HourTime = convertTo24Hour(time, delimiter, includeSeconds);
|
|
17921
|
+
const max24HourTime = convertTo24Hour(maxTime, delimiter, includeSeconds);
|
|
17921
17922
|
// simple string comparison for 24hr times
|
|
17922
|
-
return
|
|
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}`;
|
|
17923
17946
|
};
|
|
17924
17947
|
|
|
17925
17948
|
class TimePicker extends React__namespace.Component {
|
|
@@ -18041,29 +18064,34 @@
|
|
|
18041
18064
|
scrollIndex
|
|
18042
18065
|
});
|
|
18043
18066
|
};
|
|
18044
|
-
this.getRegExp = () =>
|
|
18045
|
-
|
|
18046
|
-
|
|
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
|
+
};
|
|
18047
18075
|
this.getOptions = () => (this.menuRef && this.menuRef.current ? Array.from(this.menuRef.current.children) : []);
|
|
18048
18076
|
this.isValidFormat = (time) => {
|
|
18049
18077
|
if (this.props.validateTime) {
|
|
18050
18078
|
return this.props.validateTime(time);
|
|
18051
18079
|
}
|
|
18052
|
-
const { delimiter, is24Hour } = this.props;
|
|
18053
|
-
return validateTime(time, this.
|
|
18080
|
+
const { delimiter, is24Hour, includeSeconds } = this.props;
|
|
18081
|
+
return validateTime(time, this.getRegExp(includeSeconds), delimiter, !is24Hour);
|
|
18054
18082
|
};
|
|
18055
18083
|
this.isValidTime = (time) => {
|
|
18056
|
-
const { delimiter } = this.props;
|
|
18084
|
+
const { delimiter, includeSeconds } = this.props;
|
|
18057
18085
|
const { minTimeState, maxTimeState } = this.state;
|
|
18058
|
-
return isWithinMinMax(minTimeState, maxTimeState, time, delimiter);
|
|
18086
|
+
return isWithinMinMax(minTimeState, maxTimeState, time, delimiter, includeSeconds);
|
|
18059
18087
|
};
|
|
18060
18088
|
this.isValid = (time) => this.isValidFormat(time) && this.isValidTime(time);
|
|
18061
18089
|
this.onToggle = (isOpen) => {
|
|
18062
18090
|
// on close, parse and validate input
|
|
18063
18091
|
this.setState(prevState => {
|
|
18064
18092
|
const { timeRegex, isInvalid } = prevState;
|
|
18065
|
-
const { delimiter, is24Hour } = this.props;
|
|
18066
|
-
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);
|
|
18067
18095
|
return {
|
|
18068
18096
|
isOpen,
|
|
18069
18097
|
timeState: time,
|
|
@@ -18073,8 +18101,8 @@
|
|
|
18073
18101
|
};
|
|
18074
18102
|
this.onSelect = (selection) => {
|
|
18075
18103
|
const { timeRegex, timeState } = this.state;
|
|
18076
|
-
const { delimiter, is24Hour } = this.props;
|
|
18077
|
-
const time = parseTime(selection, timeRegex, delimiter, !is24Hour);
|
|
18104
|
+
const { delimiter, is24Hour, includeSeconds } = this.props;
|
|
18105
|
+
const time = parseTime(selection, timeRegex, delimiter, !is24Hour, includeSeconds);
|
|
18078
18106
|
if (time !== timeState) {
|
|
18079
18107
|
this.onInputChange(time);
|
|
18080
18108
|
}
|
|
@@ -18089,8 +18117,10 @@
|
|
|
18089
18117
|
e.stopPropagation();
|
|
18090
18118
|
};
|
|
18091
18119
|
this.onInputChange = (newTime) => {
|
|
18092
|
-
|
|
18093
|
-
|
|
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));
|
|
18094
18124
|
}
|
|
18095
18125
|
this.scrollToSelection(newTime);
|
|
18096
18126
|
this.setState({
|
|
@@ -18100,30 +18130,32 @@
|
|
|
18100
18130
|
};
|
|
18101
18131
|
this.onBlur = (event) => {
|
|
18102
18132
|
const { timeRegex } = this.state;
|
|
18103
|
-
const { delimiter, is24Hour } = this.props;
|
|
18104
|
-
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);
|
|
18105
18135
|
this.setState({
|
|
18106
18136
|
isInvalid: !this.isValid(time)
|
|
18107
18137
|
});
|
|
18108
18138
|
};
|
|
18109
|
-
const { is24Hour, delimiter, time } = this.props;
|
|
18139
|
+
const { is24Hour, delimiter, time, includeSeconds } = this.props;
|
|
18110
18140
|
let { minTime, maxTime } = this.props;
|
|
18111
18141
|
if (minTime === '') {
|
|
18112
|
-
|
|
18142
|
+
const minSeconds = includeSeconds ? `${delimiter}00` : '';
|
|
18143
|
+
minTime = is24Hour ? `00${delimiter}00${minSeconds}` : `12${delimiter}00${minSeconds} AM`;
|
|
18113
18144
|
}
|
|
18114
18145
|
if (maxTime === '') {
|
|
18115
|
-
|
|
18146
|
+
const maxSeconds = includeSeconds ? `${delimiter}59` : '';
|
|
18147
|
+
maxTime = is24Hour ? `23${delimiter}59${maxSeconds}` : `11${delimiter}59${maxSeconds} PM`;
|
|
18116
18148
|
}
|
|
18117
18149
|
const timeRegex = this.getRegExp();
|
|
18118
18150
|
this.state = {
|
|
18119
18151
|
isInvalid: false,
|
|
18120
18152
|
isOpen: false,
|
|
18121
|
-
timeState: parseTime(time, timeRegex, delimiter, !is24Hour),
|
|
18153
|
+
timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds),
|
|
18122
18154
|
focusedIndex: null,
|
|
18123
18155
|
scrollIndex: 0,
|
|
18124
18156
|
timeRegex,
|
|
18125
|
-
minTimeState: parseTime(minTime, timeRegex, delimiter, !is24Hour),
|
|
18126
|
-
maxTimeState: parseTime(maxTime, timeRegex, delimiter, !is24Hour)
|
|
18157
|
+
minTimeState: parseTime(minTime, timeRegex, delimiter, !is24Hour, includeSeconds),
|
|
18158
|
+
maxTimeState: parseTime(maxTime, timeRegex, delimiter, !is24Hour, includeSeconds)
|
|
18127
18159
|
};
|
|
18128
18160
|
}
|
|
18129
18161
|
componentDidMount() {
|
|
@@ -18138,7 +18170,7 @@
|
|
|
18138
18170
|
}
|
|
18139
18171
|
componentDidUpdate(prevProps, prevState) {
|
|
18140
18172
|
const { timeState, isOpen, isInvalid, timeRegex } = this.state;
|
|
18141
|
-
const { time, is24Hour, delimiter } = this.props;
|
|
18173
|
+
const { time, is24Hour, delimiter, includeSeconds } = this.props;
|
|
18142
18174
|
if (isOpen && !prevState.isOpen && timeState && !isInvalid) {
|
|
18143
18175
|
this.scrollToSelection(timeState);
|
|
18144
18176
|
}
|
|
@@ -18149,14 +18181,16 @@
|
|
|
18149
18181
|
}
|
|
18150
18182
|
if (time !== '' && time !== prevProps.time) {
|
|
18151
18183
|
this.setState({
|
|
18152
|
-
timeState: parseTime(time, timeRegex, delimiter, !is24Hour)
|
|
18184
|
+
timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds)
|
|
18153
18185
|
});
|
|
18154
18186
|
}
|
|
18155
18187
|
}
|
|
18156
18188
|
render() {
|
|
18157
|
-
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,
|
|
18158
18190
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
18159
|
-
onChange, time, validateTime,
|
|
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"]);
|
|
18160
18194
|
const { timeState, isOpen, isInvalid, focusedIndex, minTimeState, maxTimeState } = this.state;
|
|
18161
18195
|
const style = { '--pf-c-date-picker__input--c-form-control--Width': width };
|
|
18162
18196
|
const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState);
|
|
@@ -18746,9 +18780,20 @@
|
|
|
18746
18780
|
|
|
18747
18781
|
var PlusIcon$1 = PlusIcon;
|
|
18748
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
|
+
};
|
|
18749
18793
|
const NumberInput = (_a) => {
|
|
18750
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"]);
|
|
18751
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 });
|
|
18752
18797
|
return (React__namespace.createElement("div", Object.assign({ className: css(_default$b.numberInput, className) }, (widthChars && {
|
|
18753
18798
|
style: Object.assign({ '--pf-c-number-input--c-form-control--width-chars': widthChars }, props.style)
|
|
18754
18799
|
}), props),
|
|
@@ -18757,7 +18802,7 @@
|
|
|
18757
18802
|
React__namespace.createElement(Button, Object.assign({ variant: "control", "aria-label": minusBtnAriaLabel, isDisabled: isDisabled || value === min, onClick: evt => onMinus(evt, inputName) }, minusBtnProps),
|
|
18758
18803
|
React__namespace.createElement("span", { className: css(_default$b.numberInputIcon) },
|
|
18759
18804
|
React__namespace.createElement(MinusIcon$1, { "aria-hidden": "true" }))),
|
|
18760
|
-
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 })),
|
|
18761
18806
|
React__namespace.createElement(Button, Object.assign({ variant: "control", "aria-label": plusBtnAriaLabel, isDisabled: isDisabled || value === max, onClick: evt => onPlus(evt, inputName) }, plusBtnProps),
|
|
18762
18807
|
React__namespace.createElement("span", { className: css(_default$b.numberInputIcon) },
|
|
18763
18808
|
React__namespace.createElement(PlusIcon$1, { "aria-hidden": "true" })))),
|
|
@@ -4907,9 +4907,14 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
4907
4907
|
--pf-c-description-list__group--GridColumn: auto;
|
|
4908
4908
|
--pf-c-description-list--m-compact--RowGap: var(--pf-global--gutter);
|
|
4909
4909
|
--pf-c-description-list--m-compact--ColumnGap: var(--pf-global--spacer--sm);
|
|
4910
|
+
--pf-c-description-list__term--Display: inline;
|
|
4911
|
+
--pf-c-description-list__term--sm--Display: flex;
|
|
4910
4912
|
--pf-c-description-list__term--FontWeight: var(--pf-global--FontWeight--bold);
|
|
4911
4913
|
--pf-c-description-list__term--FontSize: var(--pf-global--FontSize--sm);
|
|
4912
4914
|
--pf-c-description-list__term--LineHeight: var(--pf-global--LineHeight--sm);
|
|
4915
|
+
--pf-c-description-list__term-icon--MinWidth: var(--pf-global--icon--FontSize--sm);
|
|
4916
|
+
--pf-c-description-list__term-icon--MarginRight: var(--pf-global--spacer--sm);
|
|
4917
|
+
--pf-c-description-list__term-icon--Color: var(--pf-global--icon--Color--light);
|
|
4913
4918
|
--pf-c-description-list--m-vertical__group--GridTemplateColumns: repeat(var(--pf-c-description-list--GridTemplateColumns--count));
|
|
4914
4919
|
--pf-c-description-list--m-horizontal__term--width: 12ch;
|
|
4915
4920
|
--pf-c-description-list--m-horizontal__description--width: minmax(10ch, auto);
|
|
@@ -4931,6 +4936,11 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
4931
4936
|
grid-template-columns: var(--pf-c-description-list--GridTemplateColumns);
|
|
4932
4937
|
}
|
|
4933
4938
|
|
|
4939
|
+
@media screen and (min-width: 576px) {
|
|
4940
|
+
.pf-c-description-list {
|
|
4941
|
+
--pf-c-description-list__term--Display: var(--pf-c-description-list__term--sm--Display);
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4934
4944
|
.pf-c-description-list[class*=pf-m-horizontal] {
|
|
4935
4945
|
--pf-c-description-list__term--width: var(--pf-c-description-list--m-horizontal__term--width);
|
|
4936
4946
|
}
|
|
@@ -5040,6 +5050,7 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
5040
5050
|
}
|
|
5041
5051
|
|
|
5042
5052
|
.pf-c-description-list__term {
|
|
5053
|
+
display: var(--pf-c-description-list__term--Display);
|
|
5043
5054
|
font-size: var(--pf-c-description-list__term--FontSize);
|
|
5044
5055
|
font-weight: var(--pf-c-description-list__term--FontWeight);
|
|
5045
5056
|
line-height: var(--pf-c-description-list__term--LineHeight);
|
|
@@ -5049,6 +5060,13 @@ label.pf-c-check, .pf-c-check__label,
|
|
|
5049
5060
|
display: inline;
|
|
5050
5061
|
}
|
|
5051
5062
|
|
|
5063
|
+
.pf-c-description-list__term-icon {
|
|
5064
|
+
flex-shrink: 0;
|
|
5065
|
+
min-width: var(--pf-c-description-list__term-icon--MinWidth);
|
|
5066
|
+
margin-right: var(--pf-c-description-list__term-icon--MarginRight);
|
|
5067
|
+
color: var(--pf-c-description-list__term-icon--Color);
|
|
5068
|
+
}
|
|
5069
|
+
|
|
5052
5070
|
.pf-c-description-list__text.pf-m-help-text {
|
|
5053
5071
|
text-decoration: underline;
|
|
5054
5072
|
cursor: pointer;
|