@patternfly/react-core 4.222.11 → 4.222.14
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 +27 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +3 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +21 -14
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.d.ts +14 -4
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +20 -8
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/Label/Label.js +3 -3
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/LabelGroup/LabelGroup.d.ts +2 -0
- package/dist/esm/components/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/esm/components/LabelGroup/LabelGroup.js +4 -3
- package/dist/esm/components/LabelGroup/LabelGroup.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +2 -2
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts +6 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +32 -19
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +3 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +21 -14
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts +14 -4
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +20 -8
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Label/Label.js +3 -3
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/LabelGroup/LabelGroup.d.ts +2 -0
- package/dist/js/components/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/js/components/LabelGroup/LabelGroup.js +4 -3
- package/dist/js/components/LabelGroup/LabelGroup.js.map +1 -1
- package/dist/js/components/Popover/Popover.js +1 -1
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts +6 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +32 -19
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/umd/react-core.css +21 -0
- package/dist/umd/react-core.js +83 -49
- package/dist/umd/react-core.min.css +21 -0
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/CalendarMonth/CalendarMonth.tsx +21 -13
- package/src/components/DatePicker/DatePicker.tsx +36 -11
- package/src/components/Label/Label.tsx +3 -3
- package/src/components/LabelGroup/LabelGroup.tsx +5 -1
- package/src/components/LabelGroup/examples/LabelGroup.md +7 -0
- package/src/components/LabelGroup/examples/LabelGroupEditableAdd.tsx +74 -0
- package/src/components/LabelGroup/examples/LabelGroupEditableAddDropdown.tsx +138 -0
- package/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx +356 -0
- package/src/components/Modal/examples/Modal.md +2 -0
- package/src/components/OverflowMenu/examples/OverflowMenu.md +8 -0
- package/src/components/Popover/Popover.tsx +2 -2
- package/src/components/TimePicker/TimePicker.tsx +36 -19
- package/src/components/Toolbar/examples/Toolbar.md +4 -0
- package/src/demos/Card/Card.md +2 -0
- package/src/demos/{DatePicker.md → DatePicker/DatePicker.md} +8 -0
- package/src/demos/DatePicker/examples/DateTimePickerInModal.tsx +51 -0
- package/src/demos/LabelGroupDemos.md +18 -0
- package/src/demos/PrimaryDetail.md +10 -6
package/dist/umd/react-core.js
CHANGED
|
@@ -8614,19 +8614,24 @@
|
|
|
8614
8614
|
const today = new Date();
|
|
8615
8615
|
const CalendarMonth = (_a) => {
|
|
8616
8616
|
var { date: dateProp, locale = undefined, monthFormat = date => date.toLocaleDateString(locale, { month: 'long' }), weekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'narrow' }), longWeekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'long' }), dayFormat = date => date.getDate(), weekStart = 0, // Use the American Sunday as a default
|
|
8617
|
-
onChange = () => { }, validators = [() => true], className, onSelectToggle = () => { }, rangeStart, prevMonthAriaLabel = 'Previous month', nextMonthAriaLabel = 'Next month', yearInputAriaLabel = 'Select year', cellAriaLabel } = _a, props = __rest$1(_a, ["date", "locale", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "onChange", "validators", "className", "onSelectToggle", "rangeStart", "prevMonthAriaLabel", "nextMonthAriaLabel", "yearInputAriaLabel", "cellAriaLabel"]);
|
|
8617
|
+
onChange = () => { }, validators = [() => true], className, onSelectToggle = () => { }, rangeStart, prevMonthAriaLabel = 'Previous month', nextMonthAriaLabel = 'Next month', yearInputAriaLabel = 'Select year', cellAriaLabel, isDateFocused = false } = _a, props = __rest$1(_a, ["date", "locale", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "onChange", "validators", "className", "onSelectToggle", "rangeStart", "prevMonthAriaLabel", "nextMonthAriaLabel", "yearInputAriaLabel", "cellAriaLabel", "isDateFocused"]);
|
|
8618
8618
|
const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(monthNum => new Date(1990, monthNum)).map(monthFormat);
|
|
8619
8619
|
const [isSelectOpen, setIsSelectOpen] = React__default["default"].useState(false);
|
|
8620
8620
|
// eslint-disable-next-line prefer-const
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
if (isValidDate(
|
|
8624
|
-
|
|
8621
|
+
const [focusedDate, setFocusedDate] = React__default["default"].useState(() => {
|
|
8622
|
+
const initDate = new Date(dateProp);
|
|
8623
|
+
if (isValidDate(initDate)) {
|
|
8624
|
+
return initDate;
|
|
8625
8625
|
}
|
|
8626
8626
|
else {
|
|
8627
|
-
|
|
8627
|
+
if (isValidDate(rangeStart)) {
|
|
8628
|
+
return rangeStart;
|
|
8629
|
+
}
|
|
8630
|
+
else {
|
|
8631
|
+
return today;
|
|
8632
|
+
}
|
|
8628
8633
|
}
|
|
8629
|
-
}
|
|
8634
|
+
});
|
|
8630
8635
|
const [hoveredDate, setHoveredDate] = React__default["default"].useState(new Date(focusedDate));
|
|
8631
8636
|
const focusRef = React__default["default"].useRef();
|
|
8632
8637
|
const [hiddenMonthId] = React__default["default"].useState(getUniqueId('hidden-month-span'));
|
|
@@ -8634,21 +8639,23 @@
|
|
|
8634
8639
|
const isValidated = (date) => validators.every(validator => validator(date));
|
|
8635
8640
|
const focusedDateValidated = isValidated(focusedDate);
|
|
8636
8641
|
React.useEffect(() => {
|
|
8637
|
-
if (
|
|
8642
|
+
if (isValidDate(dateProp) && !isSameDate(focusedDate, dateProp)) {
|
|
8638
8643
|
setFocusedDate(dateProp);
|
|
8639
8644
|
}
|
|
8645
|
+
else if (!dateProp) {
|
|
8646
|
+
setFocusedDate(today);
|
|
8647
|
+
}
|
|
8640
8648
|
}, [dateProp]);
|
|
8641
8649
|
React.useEffect(() => {
|
|
8642
|
-
//
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
}
|
|
8650
|
+
// Calendar month should not be focused on page load
|
|
8651
|
+
// Datepicker should place focus in calendar month when opened
|
|
8652
|
+
if ((shouldFocus || isDateFocused) && focusedDateValidated && focusRef.current) {
|
|
8653
|
+
focusRef.current.focus();
|
|
8647
8654
|
}
|
|
8648
8655
|
else {
|
|
8649
8656
|
setShouldFocus(true);
|
|
8650
8657
|
}
|
|
8651
|
-
}, [focusedDate]);
|
|
8658
|
+
}, [focusedDate, isDateFocused, focusedDateValidated, focusRef]);
|
|
8652
8659
|
const onMonthClick = (newDate) => {
|
|
8653
8660
|
setFocusedDate(newDate);
|
|
8654
8661
|
setHoveredDate(newDate);
|
|
@@ -8785,6 +8792,7 @@
|
|
|
8785
8792
|
"cardHeader": "pf-c-card__header",
|
|
8786
8793
|
"cardHeaderToggle": "pf-c-card__header-toggle",
|
|
8787
8794
|
"cardHeaderToggleIcon": "pf-c-card__header-toggle-icon",
|
|
8795
|
+
"cardSrInput": "pf-c-card__sr-input",
|
|
8788
8796
|
"cardTitle": "pf-c-card__title",
|
|
8789
8797
|
"divider": "pf-c-divider",
|
|
8790
8798
|
"modifiers": {
|
|
@@ -8806,7 +8814,8 @@
|
|
|
8806
8814
|
"noOffset": "pf-m-no-offset",
|
|
8807
8815
|
"noFill": "pf-m-no-fill",
|
|
8808
8816
|
"overpassFont": "pf-m-overpass-font"
|
|
8809
|
-
}
|
|
8817
|
+
},
|
|
8818
|
+
"themeDark": "pf-theme-dark"
|
|
8810
8819
|
};
|
|
8811
8820
|
|
|
8812
8821
|
const CardContext = React__namespace.createContext({
|
|
@@ -9209,7 +9218,7 @@
|
|
|
9209
9218
|
const hasCustomMinWidth = minWidth !== popoverMinWidth.value;
|
|
9210
9219
|
const hasCustomMaxWidth = maxWidth !== popoverMaxWidth.value;
|
|
9211
9220
|
const onDocumentKeyDown = (event) => {
|
|
9212
|
-
if (event.
|
|
9221
|
+
if (event.key === KeyTypes.Escape && visible) {
|
|
9213
9222
|
if (triggerManually) {
|
|
9214
9223
|
shouldClose(null, hide, event);
|
|
9215
9224
|
}
|
|
@@ -10300,7 +10309,7 @@
|
|
|
10300
10309
|
.toString()
|
|
10301
10310
|
.padStart(2, '0')}`;
|
|
10302
10311
|
const DatePickerBase = (_a, ref) => {
|
|
10303
|
-
var { className, locale = undefined, dateFormat = yyyyMMddFormat, dateParse = (val) => val.split('-').length === 3 && new Date(`${val}T00:00:00`), isDisabled = false, placeholder = 'YYYY-MM-DD', value: valueProp = '', 'aria-label': ariaLabel = 'Date picker', buttonAriaLabel = 'Toggle date picker', onChange = () => undefined, onBlur = () => undefined, invalidFormatText = 'Invalid date', helperText, appendTo, popoverProps, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, validators = [], rangeStart, style: styleProps = {}, inputProps = {} } = _a, props = __rest$1(_a, ["className", "locale", "dateFormat", "dateParse", "isDisabled", "placeholder", "value", 'aria-label', "buttonAriaLabel", "onChange", "onBlur", "invalidFormatText", "helperText", "appendTo", "popoverProps", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "validators", "rangeStart", "style", "inputProps"]);
|
|
10312
|
+
var { className, locale = undefined, dateFormat = yyyyMMddFormat, dateParse = (val) => val.split('-').length === 3 && new Date(`${val}T00:00:00`), isDisabled = false, placeholder = 'YYYY-MM-DD', value: valueProp = '', 'aria-label': ariaLabel = 'Date picker', buttonAriaLabel = 'Toggle date picker', onChange = () => undefined, onBlur = () => undefined, invalidFormatText = 'Invalid date', helperText, appendTo = 'parent', popoverProps, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, validators = [], rangeStart, style: styleProps = {}, inputProps = {} } = _a, props = __rest$1(_a, ["className", "locale", "dateFormat", "dateParse", "isDisabled", "placeholder", "value", 'aria-label', "buttonAriaLabel", "onChange", "onBlur", "invalidFormatText", "helperText", "appendTo", "popoverProps", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "validators", "rangeStart", "style", "inputProps"]);
|
|
10304
10313
|
const [value, setValue] = React__namespace.useState(valueProp);
|
|
10305
10314
|
const [valueDate, setValueDate] = React__namespace.useState(dateParse(value));
|
|
10306
10315
|
const [errorText, setErrorText] = React__namespace.useState('');
|
|
@@ -10310,6 +10319,7 @@
|
|
|
10310
10319
|
const widthChars = React__namespace.useMemo(() => Math.max(dateFormat(new Date()).length, placeholder.length), [dateFormat]);
|
|
10311
10320
|
const style = Object.assign({ '--pf-c-date-picker__input--c-form-control--width-chars': widthChars }, styleProps);
|
|
10312
10321
|
const buttonRef = React__namespace.useRef();
|
|
10322
|
+
const datePickerWrapperRef = React__namespace.useRef();
|
|
10313
10323
|
React__namespace.useEffect(() => {
|
|
10314
10324
|
setValue(valueProp);
|
|
10315
10325
|
setValueDate(dateParse(valueProp));
|
|
@@ -10364,15 +10374,22 @@
|
|
|
10364
10374
|
};
|
|
10365
10375
|
React.useImperativeHandle(ref, () => ({
|
|
10366
10376
|
setCalendarOpen: (isOpen) => setPopoverOpen(isOpen),
|
|
10367
|
-
toggleCalendar: () =>
|
|
10368
|
-
|
|
10369
|
-
|
|
10377
|
+
toggleCalendar: (setOpen, eventKey) => {
|
|
10378
|
+
if (eventKey === KeyTypes.Escape && popoverOpen && !selectOpen) {
|
|
10379
|
+
setPopoverOpen(prev => (setOpen !== undefined ? setOpen : !prev));
|
|
10380
|
+
}
|
|
10381
|
+
},
|
|
10382
|
+
isCalendarOpen: popoverOpen
|
|
10383
|
+
}), [setPopoverOpen, popoverOpen, selectOpen]);
|
|
10384
|
+
const getParentElement = () => datePickerWrapperRef && datePickerWrapperRef.current ? datePickerWrapperRef.current : null;
|
|
10385
|
+
return (React__namespace.createElement("div", Object.assign({ className: css(datePickerStyles.datePicker, className), ref: datePickerWrapperRef, style: style }, props),
|
|
10370
10386
|
React__namespace.createElement(Popover, Object.assign({ position: "bottom", bodyContent: React__namespace.createElement(CalendarMonth, { date: valueDate, onChange: onDateClick, locale: locale,
|
|
10371
10387
|
// Use truthy values of strings
|
|
10372
|
-
validators: validators.map(validator => (date) => !validator(date)), onSelectToggle: open => setSelectOpen(open), monthFormat: monthFormat, weekdayFormat: weekdayFormat, longWeekdayFormat: longWeekdayFormat, dayFormat: dayFormat, weekStart: weekStart, rangeStart: rangeStart }), showClose: false, isVisible: popoverOpen, shouldClose: (_1, _2, event) => {
|
|
10388
|
+
validators: validators.map(validator => (date) => !validator(date)), onSelectToggle: open => setSelectOpen(open), monthFormat: monthFormat, weekdayFormat: weekdayFormat, longWeekdayFormat: longWeekdayFormat, dayFormat: dayFormat, weekStart: weekStart, rangeStart: rangeStart, isDateFocused: true }), showClose: false, isVisible: popoverOpen, shouldClose: (_1, _2, event) => {
|
|
10373
10389
|
event = event;
|
|
10374
|
-
|
|
10375
|
-
|
|
10390
|
+
if (event.key === KeyTypes.Escape && selectOpen) {
|
|
10391
|
+
event.stopPropagation();
|
|
10392
|
+
setSelectOpen(false);
|
|
10376
10393
|
return false;
|
|
10377
10394
|
}
|
|
10378
10395
|
// Let our button handle toggling
|
|
@@ -10380,8 +10397,11 @@
|
|
|
10380
10397
|
return false;
|
|
10381
10398
|
}
|
|
10382
10399
|
setPopoverOpen(false);
|
|
10400
|
+
if (event.key === KeyTypes.Escape && popoverOpen) {
|
|
10401
|
+
event.stopPropagation();
|
|
10402
|
+
}
|
|
10383
10403
|
return true;
|
|
10384
|
-
}, withFocusTrap: true, hasNoPadding: true, hasAutoWidth: true, appendTo: appendTo }, popoverProps),
|
|
10404
|
+
}, withFocusTrap: true, hasNoPadding: true, hasAutoWidth: true, appendTo: appendTo === 'parent' ? getParentElement() : appendTo }, popoverProps),
|
|
10385
10405
|
React__namespace.createElement("div", { className: datePickerStyles.datePickerInput },
|
|
10386
10406
|
React__namespace.createElement(InputGroup, null,
|
|
10387
10407
|
React__namespace.createElement(TextInput, Object.assign({ isDisabled: isDisabled, "aria-label": ariaLabel, placeholder: placeholder, validated: errorText ? 'error' : 'default', value: value, onChange: onTextInput, onBlur: onInputBlur, onKeyPress: onKeyPress }, inputProps)),
|
|
@@ -14562,14 +14582,14 @@
|
|
|
14562
14582
|
const editableButtonRef = React__namespace.useRef();
|
|
14563
14583
|
const editableInputRef = React__namespace.useRef();
|
|
14564
14584
|
React__namespace.useEffect(() => {
|
|
14565
|
-
document.addEventListener('
|
|
14585
|
+
document.addEventListener('mousedown', onDocMouseDown);
|
|
14566
14586
|
document.addEventListener('keydown', onKeyDown);
|
|
14567
14587
|
return () => {
|
|
14568
|
-
document.removeEventListener('
|
|
14588
|
+
document.removeEventListener('mousedown', onDocMouseDown);
|
|
14569
14589
|
document.removeEventListener('keydown', onKeyDown);
|
|
14570
14590
|
};
|
|
14571
14591
|
});
|
|
14572
|
-
const
|
|
14592
|
+
const onDocMouseDown = (event) => {
|
|
14573
14593
|
if (isEditableActive &&
|
|
14574
14594
|
editableInputRef &&
|
|
14575
14595
|
editableInputRef.current &&
|
|
@@ -14706,9 +14726,9 @@
|
|
|
14706
14726
|
render() {
|
|
14707
14727
|
const _a = this.props, { categoryName, children, className, isClosable, isCompact, closeBtnAriaLabel, 'aria-label': ariaLabel, onClick, numLabels, expandedText, collapsedText,
|
|
14708
14728
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
14709
|
-
defaultIsOpen, tooltipPosition, isVertical, isEditable, hasEditableTextArea, editableTextAreaProps } = _a,
|
|
14729
|
+
defaultIsOpen, tooltipPosition, isVertical, isEditable, hasEditableTextArea, editableTextAreaProps, addLabelControl } = _a,
|
|
14710
14730
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
14711
|
-
rest = __rest$1(_a, ["categoryName", "children", "className", "isClosable", "isCompact", "closeBtnAriaLabel", 'aria-label', "onClick", "numLabels", "expandedText", "collapsedText", "defaultIsOpen", "tooltipPosition", "isVertical", "isEditable", "hasEditableTextArea", "editableTextAreaProps"]);
|
|
14731
|
+
rest = __rest$1(_a, ["categoryName", "children", "className", "isClosable", "isCompact", "closeBtnAriaLabel", 'aria-label', "onClick", "numLabels", "expandedText", "collapsedText", "defaultIsOpen", "tooltipPosition", "isVertical", "isEditable", "hasEditableTextArea", "editableTextAreaProps", "addLabelControl"]);
|
|
14712
14732
|
const { isOpen } = this.state;
|
|
14713
14733
|
const numChildren = React__namespace.Children.count(children);
|
|
14714
14734
|
const collapsedTextResult = fillTemplate(collapsedText, {
|
|
@@ -14724,6 +14744,7 @@
|
|
|
14724
14744
|
labelArray.map((child, i) => (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem), key: i }, child))),
|
|
14725
14745
|
numChildren > numLabels && (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem) },
|
|
14726
14746
|
React__namespace.createElement(Label, { isOverflowLabel: true, onClick: this.toggleCollapse, className: css(isCompact && labelStyles.modifiers.compact) }, isOpen ? expandedText : collapsedTextResult))),
|
|
14747
|
+
addLabelControl && React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem) }, addLabelControl),
|
|
14727
14748
|
isEditable && hasEditableTextArea && (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem, styles$D.modifiers.textarea) },
|
|
14728
14749
|
React__namespace.createElement("textarea", Object.assign({ className: css(styles$D.labelGroupTextarea), rows: 1, tabIndex: 0 }, editableTextAreaProps)))))));
|
|
14729
14750
|
const close = (React__namespace.createElement("div", { className: css(styles$D.labelGroupClose) },
|
|
@@ -14733,7 +14754,7 @@
|
|
|
14733
14754
|
React__namespace.createElement("div", { className: css(styles$D.labelGroupMain) }, content),
|
|
14734
14755
|
isClosable && close));
|
|
14735
14756
|
};
|
|
14736
|
-
return numChildren === 0 ? null : (React__namespace.createElement(GenerateId, null, randomId => renderLabelGroup(this.props.id || randomId)));
|
|
14757
|
+
return numChildren === 0 && addLabelControl === undefined ? null : (React__namespace.createElement(GenerateId, null, randomId => renderLabelGroup(this.props.id || randomId)));
|
|
14737
14758
|
}
|
|
14738
14759
|
}
|
|
14739
14760
|
LabelGroup.displayName = 'LabelGroup';
|
|
@@ -19598,19 +19619,19 @@
|
|
|
19598
19619
|
var _a, _b, _c, _d;
|
|
19599
19620
|
const clickedOnToggle = (_b = (_a = this.toggleRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.contains(event.target);
|
|
19600
19621
|
const clickedWithinMenu = (_d = (_c = this.menuRef) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.contains(event.target);
|
|
19601
|
-
if (this.state.
|
|
19622
|
+
if (this.state.isTimeOptionsOpen && !(clickedOnToggle || clickedWithinMenu)) {
|
|
19602
19623
|
this.onToggle(false);
|
|
19603
19624
|
}
|
|
19604
19625
|
};
|
|
19605
19626
|
this.handleGlobalKeys = (event) => {
|
|
19606
19627
|
var _a, _b, _c, _d;
|
|
19607
|
-
const {
|
|
19628
|
+
const { isTimeOptionsOpen, focusedIndex, scrollIndex } = this.state;
|
|
19608
19629
|
// keyboard pressed while focus on toggle
|
|
19609
19630
|
if ((_b = (_a = this.inputRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.contains(event.target)) {
|
|
19610
|
-
if (!
|
|
19631
|
+
if (!isTimeOptionsOpen && event.key !== KeyTypes.Tab && event.key !== KeyTypes.Escape) {
|
|
19611
19632
|
this.onToggle(true);
|
|
19612
19633
|
}
|
|
19613
|
-
else if (
|
|
19634
|
+
else if (isTimeOptionsOpen) {
|
|
19614
19635
|
if (event.key === KeyTypes.Escape || event.key === KeyTypes.Tab) {
|
|
19615
19636
|
this.onToggle(false);
|
|
19616
19637
|
}
|
|
@@ -19767,27 +19788,32 @@
|
|
|
19767
19788
|
const { delimiter, is24Hour, includeSeconds } = this.props;
|
|
19768
19789
|
const time = parseTime(prevState.timeState, timeRegex, delimiter, !is24Hour, includeSeconds);
|
|
19769
19790
|
return {
|
|
19770
|
-
isOpen,
|
|
19791
|
+
isTimeOptionsOpen: isOpen,
|
|
19771
19792
|
timeState: time,
|
|
19772
19793
|
isInvalid: isOpen ? isInvalid : !this.isValid(time)
|
|
19773
19794
|
};
|
|
19774
19795
|
});
|
|
19796
|
+
this.props.setIsOpen(isOpen);
|
|
19797
|
+
if (!isOpen) {
|
|
19798
|
+
this.inputRef.current.focus();
|
|
19799
|
+
}
|
|
19775
19800
|
};
|
|
19776
19801
|
this.onSelect = (e) => {
|
|
19777
19802
|
const { timeRegex, timeState } = this.state;
|
|
19778
|
-
const { delimiter, is24Hour, includeSeconds } = this.props;
|
|
19803
|
+
const { delimiter, is24Hour, includeSeconds, setIsOpen } = this.props;
|
|
19779
19804
|
const time = parseTime(e.target.textContent, timeRegex, delimiter, !is24Hour, includeSeconds);
|
|
19780
19805
|
if (time !== timeState) {
|
|
19781
19806
|
this.onInputChange(time);
|
|
19782
19807
|
}
|
|
19783
19808
|
this.inputRef.current.focus();
|
|
19784
19809
|
this.setState({
|
|
19785
|
-
|
|
19810
|
+
isTimeOptionsOpen: false,
|
|
19786
19811
|
isInvalid: false
|
|
19787
19812
|
});
|
|
19813
|
+
setIsOpen(false);
|
|
19788
19814
|
};
|
|
19789
19815
|
this.onInputClick = (e) => {
|
|
19790
|
-
if (!this.state.
|
|
19816
|
+
if (!this.state.isTimeOptionsOpen) {
|
|
19791
19817
|
this.onToggle(true);
|
|
19792
19818
|
}
|
|
19793
19819
|
e.stopPropagation();
|
|
@@ -19811,7 +19837,7 @@
|
|
|
19811
19837
|
isInvalid: !this.isValid(time)
|
|
19812
19838
|
});
|
|
19813
19839
|
};
|
|
19814
|
-
const { is24Hour, delimiter, time, includeSeconds } = this.props;
|
|
19840
|
+
const { is24Hour, delimiter, time, includeSeconds, isOpen } = this.props;
|
|
19815
19841
|
let { minTime, maxTime } = this.props;
|
|
19816
19842
|
if (minTime === '') {
|
|
19817
19843
|
const minSeconds = includeSeconds ? `${delimiter}00` : '';
|
|
@@ -19824,7 +19850,7 @@
|
|
|
19824
19850
|
const timeRegex = this.getRegExp();
|
|
19825
19851
|
this.state = {
|
|
19826
19852
|
isInvalid: false,
|
|
19827
|
-
|
|
19853
|
+
isTimeOptionsOpen: isOpen,
|
|
19828
19854
|
timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds),
|
|
19829
19855
|
focusedIndex: null,
|
|
19830
19856
|
scrollIndex: 0,
|
|
@@ -19844,9 +19870,12 @@
|
|
|
19844
19870
|
document.removeEventListener('keydown', this.handleGlobalKeys);
|
|
19845
19871
|
}
|
|
19846
19872
|
componentDidUpdate(prevProps, prevState) {
|
|
19847
|
-
const { timeState,
|
|
19848
|
-
const { time, is24Hour, delimiter, includeSeconds } = this.props;
|
|
19849
|
-
if (isOpen
|
|
19873
|
+
const { timeState, isTimeOptionsOpen, isInvalid, timeRegex } = this.state;
|
|
19874
|
+
const { time, is24Hour, delimiter, includeSeconds, isOpen } = this.props;
|
|
19875
|
+
if (prevProps.isOpen !== isOpen) {
|
|
19876
|
+
this.onToggle(isOpen);
|
|
19877
|
+
}
|
|
19878
|
+
if (isTimeOptionsOpen && !prevState.isTimeOptionsOpen && timeState && !isInvalid) {
|
|
19850
19879
|
this.scrollToSelection(timeState);
|
|
19851
19880
|
}
|
|
19852
19881
|
if (delimiter !== prevProps.delimiter) {
|
|
@@ -19863,10 +19892,14 @@
|
|
|
19863
19892
|
render() {
|
|
19864
19893
|
const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, invalidMinMaxErrorMessage, stepMinutes, width, delimiter, inputProps,
|
|
19865
19894
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19866
|
-
onChange,
|
|
19895
|
+
onChange,
|
|
19896
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19897
|
+
setIsOpen,
|
|
19898
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19899
|
+
isOpen, time, validateTime, minTime, maxTime, includeSeconds } = _a,
|
|
19867
19900
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
19868
|
-
props = __rest$1(_a, ['aria-label', "isDisabled", "className", "placeholder", "id", "menuAppendTo", "is24Hour", "invalidFormatErrorMessage", "invalidMinMaxErrorMessage", "stepMinutes", "width", "delimiter", "inputProps", "onChange", "time", "validateTime", "minTime", "maxTime", "includeSeconds"]);
|
|
19869
|
-
const { timeState,
|
|
19901
|
+
props = __rest$1(_a, ['aria-label', "isDisabled", "className", "placeholder", "id", "menuAppendTo", "is24Hour", "invalidFormatErrorMessage", "invalidMinMaxErrorMessage", "stepMinutes", "width", "delimiter", "inputProps", "onChange", "setIsOpen", "isOpen", "time", "validateTime", "minTime", "maxTime", "includeSeconds"]);
|
|
19902
|
+
const { timeState, isTimeOptionsOpen, isInvalid, minTimeState, maxTimeState } = this.state;
|
|
19870
19903
|
const style = { '--pf-c-date-picker__input--c-form-control--Width': width };
|
|
19871
19904
|
const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState, includeSeconds);
|
|
19872
19905
|
const isValidFormat = this.isValidFormat(timeState);
|
|
@@ -19885,8 +19918,8 @@
|
|
|
19885
19918
|
React__namespace.createElement("div", Object.assign({ className: css(datePickerStyles.datePickerInput), style: style }, props),
|
|
19886
19919
|
React__namespace.createElement(InputGroup, null,
|
|
19887
19920
|
React__namespace.createElement("div", { id: randomId },
|
|
19888
|
-
React__namespace.createElement("div", { ref: this.toggleRef, style: { paddingLeft: '0' } }, menuAppendTo !== 'inline' ? (React__namespace.createElement(Popper, { appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, trigger: textInput, popper: menuContainer, isVisible:
|
|
19889
|
-
|
|
19921
|
+
React__namespace.createElement("div", { ref: this.toggleRef, style: { paddingLeft: '0' } }, menuAppendTo !== 'inline' ? (React__namespace.createElement(Popper, { appendTo: menuAppendTo === 'parent' ? getParentElement() : menuAppendTo, trigger: textInput, popper: menuContainer, isVisible: isTimeOptionsOpen })) : (textInput)),
|
|
19922
|
+
isTimeOptionsOpen && menuAppendTo === 'inline' && menuContainer)),
|
|
19890
19923
|
isInvalid && (React__namespace.createElement("div", { className: css(datePickerStyles.datePickerHelperText, datePickerStyles.modifiers.error) }, !isValidFormat ? invalidFormatErrorMessage : invalidMinMaxErrorMessage)))));
|
|
19891
19924
|
}
|
|
19892
19925
|
}
|
|
@@ -19906,7 +19939,8 @@
|
|
|
19906
19939
|
stepMinutes: 30,
|
|
19907
19940
|
inputProps: {},
|
|
19908
19941
|
minTime: '',
|
|
19909
|
-
maxTime: ''
|
|
19942
|
+
maxTime: '',
|
|
19943
|
+
setIsOpen: () => { }
|
|
19910
19944
|
};
|
|
19911
19945
|
|
|
19912
19946
|
Promise.resolve().then(function () { return toggleGroup; });
|
|
@@ -2919,6 +2919,8 @@ button.pf-c-breadcrumb__link {
|
|
|
2919
2919
|
--pf-c-card__header--m-toggle-right--toggle--MarginRight: calc(var(--pf-global--spacer--form-element) * -1);
|
|
2920
2920
|
--pf-c-card__header--m-toggle-right--toggle--MarginLeft: var(--pf-global--spacer--xs);
|
|
2921
2921
|
--pf-c-card__header--m-toggle-right--actions--MarginRight: 0;
|
|
2922
|
+
--pf-c-card__input--focus--BorderWidth: var(--pf-global--BorderWidth--md);
|
|
2923
|
+
--pf-c-card__input--focus--BorderColor: var(--pf-global--primary-color--100);
|
|
2922
2924
|
display: flex;
|
|
2923
2925
|
flex-direction: column;
|
|
2924
2926
|
background-color: var(--pf-c-card--BackgroundColor);
|
|
@@ -3178,10 +3180,28 @@ button.pf-c-breadcrumb__link {
|
|
|
3178
3180
|
font-size: var(--pf-c-card__footer--FontSize);
|
|
3179
3181
|
}
|
|
3180
3182
|
|
|
3183
|
+
.pf-c-card__sr-input:focus + .pf-c-card::after {
|
|
3184
|
+
position: absolute;
|
|
3185
|
+
top: 0;
|
|
3186
|
+
right: 0;
|
|
3187
|
+
bottom: 0;
|
|
3188
|
+
left: 0;
|
|
3189
|
+
content: "";
|
|
3190
|
+
border: var(--pf-c-card__input--focus--BorderWidth) solid var(--pf-c-card__input--focus--BorderColor);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3181
3193
|
.pf-m-overpass-font .pf-c-card .pf-c-card__title {
|
|
3182
3194
|
font-weight: var(--pf-global--FontWeight--normal);
|
|
3183
3195
|
}
|
|
3184
3196
|
|
|
3197
|
+
:where(.pf-theme-dark) .pf-c-card {
|
|
3198
|
+
--pf-c-card--BoxShadow: var(--pf-global--BoxShadow--md);
|
|
3199
|
+
--pf-c-card--m-hoverable-raised--hover--BoxShadow: var(--pf-global--BoxShadow--lg);
|
|
3200
|
+
--pf-c-card--m-selectable-raised--hover--BoxShadow: var(--pf-global--BoxShadow--lg);
|
|
3201
|
+
--pf-c-card--m-selectable-raised--focus--BoxShadow: var(--pf-global--BoxShadow--lg);
|
|
3202
|
+
--pf-c-card--m-selectable-raised--active--BoxShadow: var(--pf-global--BoxShadow--lg);
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3185
3205
|
.pf-c-check {
|
|
3186
3206
|
--pf-c-check--GridGap: var(--pf-global--spacer--xs) var(--pf-global--spacer--sm);
|
|
3187
3207
|
--pf-c-check__label--disabled--Color: var(--pf-global--disabled-color--100);
|
|
@@ -17092,6 +17112,7 @@ label.pf-c-menu__item:where(:not([disabled], .pf-m-disabled)) {
|
|
|
17092
17112
|
font-weight: var(--pf-c-progress-stepper__step-title--FontWeight);
|
|
17093
17113
|
color: var(--pf-c-progress-stepper__step-title--Color);
|
|
17094
17114
|
text-align: var(--pf-c-progress-stepper__step-title--TextAlign);
|
|
17115
|
+
border: 0;
|
|
17095
17116
|
}
|
|
17096
17117
|
|
|
17097
17118
|
.pf-c-progress-stepper__step-title.pf-m-help-text {
|