@patternfly/react-core 4.222.12 → 4.222.15
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 +24 -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/styles/base-no-reset.css +5 -0
- package/dist/styles/base.css +5 -0
- package/dist/umd/react-core.css +255 -28
- package/dist/umd/react-core.js +100 -51
- package/dist/umd/react-core.min.css +255 -28
- package/dist/umd/react-core.min.js +5 -5
- 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)),
|
|
@@ -10395,6 +10415,7 @@
|
|
|
10395
10415
|
|
|
10396
10416
|
Promise.resolve().then(function () { return descriptionList; });
|
|
10397
10417
|
var styles$N = {
|
|
10418
|
+
"card": "pf-c-card",
|
|
10398
10419
|
"descriptionList": "pf-c-description-list",
|
|
10399
10420
|
"descriptionListDescription": "pf-c-description-list__description",
|
|
10400
10421
|
"descriptionListGroup": "pf-c-description-list__group",
|
|
@@ -10408,6 +10429,8 @@
|
|
|
10408
10429
|
"compact": "pf-m-compact",
|
|
10409
10430
|
"fluid": "pf-m-fluid",
|
|
10410
10431
|
"fillColumns": "pf-m-fill-columns",
|
|
10432
|
+
"displayLg": "pf-m-display-lg",
|
|
10433
|
+
"display_2xl": "pf-m-display-2xl",
|
|
10411
10434
|
"helpText": "pf-m-help-text",
|
|
10412
10435
|
"1Col": "pf-m-1-col",
|
|
10413
10436
|
"2Col": "pf-m-2-col",
|
|
@@ -14562,14 +14585,14 @@
|
|
|
14562
14585
|
const editableButtonRef = React__namespace.useRef();
|
|
14563
14586
|
const editableInputRef = React__namespace.useRef();
|
|
14564
14587
|
React__namespace.useEffect(() => {
|
|
14565
|
-
document.addEventListener('
|
|
14588
|
+
document.addEventListener('mousedown', onDocMouseDown);
|
|
14566
14589
|
document.addEventListener('keydown', onKeyDown);
|
|
14567
14590
|
return () => {
|
|
14568
|
-
document.removeEventListener('
|
|
14591
|
+
document.removeEventListener('mousedown', onDocMouseDown);
|
|
14569
14592
|
document.removeEventListener('keydown', onKeyDown);
|
|
14570
14593
|
};
|
|
14571
14594
|
});
|
|
14572
|
-
const
|
|
14595
|
+
const onDocMouseDown = (event) => {
|
|
14573
14596
|
if (isEditableActive &&
|
|
14574
14597
|
editableInputRef &&
|
|
14575
14598
|
editableInputRef.current &&
|
|
@@ -14706,9 +14729,9 @@
|
|
|
14706
14729
|
render() {
|
|
14707
14730
|
const _a = this.props, { categoryName, children, className, isClosable, isCompact, closeBtnAriaLabel, 'aria-label': ariaLabel, onClick, numLabels, expandedText, collapsedText,
|
|
14708
14731
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
14709
|
-
defaultIsOpen, tooltipPosition, isVertical, isEditable, hasEditableTextArea, editableTextAreaProps } = _a,
|
|
14732
|
+
defaultIsOpen, tooltipPosition, isVertical, isEditable, hasEditableTextArea, editableTextAreaProps, addLabelControl } = _a,
|
|
14710
14733
|
/* 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"]);
|
|
14734
|
+
rest = __rest$1(_a, ["categoryName", "children", "className", "isClosable", "isCompact", "closeBtnAriaLabel", 'aria-label', "onClick", "numLabels", "expandedText", "collapsedText", "defaultIsOpen", "tooltipPosition", "isVertical", "isEditable", "hasEditableTextArea", "editableTextAreaProps", "addLabelControl"]);
|
|
14712
14735
|
const { isOpen } = this.state;
|
|
14713
14736
|
const numChildren = React__namespace.Children.count(children);
|
|
14714
14737
|
const collapsedTextResult = fillTemplate(collapsedText, {
|
|
@@ -14724,6 +14747,7 @@
|
|
|
14724
14747
|
labelArray.map((child, i) => (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem), key: i }, child))),
|
|
14725
14748
|
numChildren > numLabels && (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem) },
|
|
14726
14749
|
React__namespace.createElement(Label, { isOverflowLabel: true, onClick: this.toggleCollapse, className: css(isCompact && labelStyles.modifiers.compact) }, isOpen ? expandedText : collapsedTextResult))),
|
|
14750
|
+
addLabelControl && React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem) }, addLabelControl),
|
|
14727
14751
|
isEditable && hasEditableTextArea && (React__namespace.createElement("li", { className: css(styles$D.labelGroupListItem, styles$D.modifiers.textarea) },
|
|
14728
14752
|
React__namespace.createElement("textarea", Object.assign({ className: css(styles$D.labelGroupTextarea), rows: 1, tabIndex: 0 }, editableTextAreaProps)))))));
|
|
14729
14753
|
const close = (React__namespace.createElement("div", { className: css(styles$D.labelGroupClose) },
|
|
@@ -14733,7 +14757,7 @@
|
|
|
14733
14757
|
React__namespace.createElement("div", { className: css(styles$D.labelGroupMain) }, content),
|
|
14734
14758
|
isClosable && close));
|
|
14735
14759
|
};
|
|
14736
|
-
return numChildren === 0 ? null : (React__namespace.createElement(GenerateId, null, randomId => renderLabelGroup(this.props.id || randomId)));
|
|
14760
|
+
return numChildren === 0 && addLabelControl === undefined ? null : (React__namespace.createElement(GenerateId, null, randomId => renderLabelGroup(this.props.id || randomId)));
|
|
14737
14761
|
}
|
|
14738
14762
|
}
|
|
14739
14763
|
LabelGroup.displayName = 'LabelGroup';
|
|
@@ -15064,11 +15088,21 @@
|
|
|
15064
15088
|
"collapsed": "pf-m-collapsed",
|
|
15065
15089
|
"limitWidth": "pf-m-limit-width",
|
|
15066
15090
|
"alignCenter": "pf-m-align-center",
|
|
15067
|
-
"stickyTop": "pf-m-sticky-top",
|
|
15068
|
-
"stickyBottom": "pf-m-sticky-bottom",
|
|
15069
15091
|
"overflowScroll": "pf-m-overflow-scroll",
|
|
15070
15092
|
"shadowBottom": "pf-m-shadow-bottom",
|
|
15071
15093
|
"shadowTop": "pf-m-shadow-top",
|
|
15094
|
+
"stickyTop": "pf-m-sticky-top",
|
|
15095
|
+
"stickyBottom": "pf-m-sticky-bottom",
|
|
15096
|
+
"stickyTopOnSmHeight": "pf-m-sticky-top-on-sm-height",
|
|
15097
|
+
"stickyBottomOnSmHeight": "pf-m-sticky-bottom-on-sm-height",
|
|
15098
|
+
"stickyTopOnMdHeight": "pf-m-sticky-top-on-md-height",
|
|
15099
|
+
"stickyBottomOnMdHeight": "pf-m-sticky-bottom-on-md-height",
|
|
15100
|
+
"stickyTopOnLgHeight": "pf-m-sticky-top-on-lg-height",
|
|
15101
|
+
"stickyBottomOnLgHeight": "pf-m-sticky-bottom-on-lg-height",
|
|
15102
|
+
"stickyTopOnXlHeight": "pf-m-sticky-top-on-xl-height",
|
|
15103
|
+
"stickyBottomOnXlHeight": "pf-m-sticky-bottom-on-xl-height",
|
|
15104
|
+
"stickyTopOn_2xlHeight": "pf-m-sticky-top-on-2xl-height",
|
|
15105
|
+
"stickyBottomOn_2xlHeight": "pf-m-sticky-bottom-on-2xl-height",
|
|
15072
15106
|
"fill": "pf-m-fill",
|
|
15073
15107
|
"noFill": "pf-m-no-fill",
|
|
15074
15108
|
"light_100": "pf-m-light-100",
|
|
@@ -19021,6 +19055,7 @@
|
|
|
19021
19055
|
"expanded": "pf-m-expanded",
|
|
19022
19056
|
"pageInsets": "pf-m-page-insets",
|
|
19023
19057
|
"action": "pf-m-action",
|
|
19058
|
+
"active": "pf-m-active",
|
|
19024
19059
|
"disabled": "pf-m-disabled",
|
|
19025
19060
|
"ariaDisabled": "pf-m-aria-disabled",
|
|
19026
19061
|
"insetNone": "pf-m-inset-none",
|
|
@@ -19068,6 +19103,7 @@
|
|
|
19068
19103
|
"tabsItemIcon": "pf-c-tabs__item-icon",
|
|
19069
19104
|
"tabsItemText": "pf-c-tabs__item-text",
|
|
19070
19105
|
"tabsLink": "pf-c-tabs__link",
|
|
19106
|
+
"tabsLinkToggleIcon": "pf-c-tabs__link-toggle-icon",
|
|
19071
19107
|
"tabsList": "pf-c-tabs__list",
|
|
19072
19108
|
"tabsScrollButton": "pf-c-tabs__scroll-button",
|
|
19073
19109
|
"tabsToggle": "pf-c-tabs__toggle",
|
|
@@ -19598,19 +19634,19 @@
|
|
|
19598
19634
|
var _a, _b, _c, _d;
|
|
19599
19635
|
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
19636
|
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.
|
|
19637
|
+
if (this.state.isTimeOptionsOpen && !(clickedOnToggle || clickedWithinMenu)) {
|
|
19602
19638
|
this.onToggle(false);
|
|
19603
19639
|
}
|
|
19604
19640
|
};
|
|
19605
19641
|
this.handleGlobalKeys = (event) => {
|
|
19606
19642
|
var _a, _b, _c, _d;
|
|
19607
|
-
const {
|
|
19643
|
+
const { isTimeOptionsOpen, focusedIndex, scrollIndex } = this.state;
|
|
19608
19644
|
// keyboard pressed while focus on toggle
|
|
19609
19645
|
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 (!
|
|
19646
|
+
if (!isTimeOptionsOpen && event.key !== KeyTypes.Tab && event.key !== KeyTypes.Escape) {
|
|
19611
19647
|
this.onToggle(true);
|
|
19612
19648
|
}
|
|
19613
|
-
else if (
|
|
19649
|
+
else if (isTimeOptionsOpen) {
|
|
19614
19650
|
if (event.key === KeyTypes.Escape || event.key === KeyTypes.Tab) {
|
|
19615
19651
|
this.onToggle(false);
|
|
19616
19652
|
}
|
|
@@ -19767,27 +19803,32 @@
|
|
|
19767
19803
|
const { delimiter, is24Hour, includeSeconds } = this.props;
|
|
19768
19804
|
const time = parseTime(prevState.timeState, timeRegex, delimiter, !is24Hour, includeSeconds);
|
|
19769
19805
|
return {
|
|
19770
|
-
isOpen,
|
|
19806
|
+
isTimeOptionsOpen: isOpen,
|
|
19771
19807
|
timeState: time,
|
|
19772
19808
|
isInvalid: isOpen ? isInvalid : !this.isValid(time)
|
|
19773
19809
|
};
|
|
19774
19810
|
});
|
|
19811
|
+
this.props.setIsOpen(isOpen);
|
|
19812
|
+
if (!isOpen) {
|
|
19813
|
+
this.inputRef.current.focus();
|
|
19814
|
+
}
|
|
19775
19815
|
};
|
|
19776
19816
|
this.onSelect = (e) => {
|
|
19777
19817
|
const { timeRegex, timeState } = this.state;
|
|
19778
|
-
const { delimiter, is24Hour, includeSeconds } = this.props;
|
|
19818
|
+
const { delimiter, is24Hour, includeSeconds, setIsOpen } = this.props;
|
|
19779
19819
|
const time = parseTime(e.target.textContent, timeRegex, delimiter, !is24Hour, includeSeconds);
|
|
19780
19820
|
if (time !== timeState) {
|
|
19781
19821
|
this.onInputChange(time);
|
|
19782
19822
|
}
|
|
19783
19823
|
this.inputRef.current.focus();
|
|
19784
19824
|
this.setState({
|
|
19785
|
-
|
|
19825
|
+
isTimeOptionsOpen: false,
|
|
19786
19826
|
isInvalid: false
|
|
19787
19827
|
});
|
|
19828
|
+
setIsOpen(false);
|
|
19788
19829
|
};
|
|
19789
19830
|
this.onInputClick = (e) => {
|
|
19790
|
-
if (!this.state.
|
|
19831
|
+
if (!this.state.isTimeOptionsOpen) {
|
|
19791
19832
|
this.onToggle(true);
|
|
19792
19833
|
}
|
|
19793
19834
|
e.stopPropagation();
|
|
@@ -19811,7 +19852,7 @@
|
|
|
19811
19852
|
isInvalid: !this.isValid(time)
|
|
19812
19853
|
});
|
|
19813
19854
|
};
|
|
19814
|
-
const { is24Hour, delimiter, time, includeSeconds } = this.props;
|
|
19855
|
+
const { is24Hour, delimiter, time, includeSeconds, isOpen } = this.props;
|
|
19815
19856
|
let { minTime, maxTime } = this.props;
|
|
19816
19857
|
if (minTime === '') {
|
|
19817
19858
|
const minSeconds = includeSeconds ? `${delimiter}00` : '';
|
|
@@ -19824,7 +19865,7 @@
|
|
|
19824
19865
|
const timeRegex = this.getRegExp();
|
|
19825
19866
|
this.state = {
|
|
19826
19867
|
isInvalid: false,
|
|
19827
|
-
|
|
19868
|
+
isTimeOptionsOpen: isOpen,
|
|
19828
19869
|
timeState: parseTime(time, timeRegex, delimiter, !is24Hour, includeSeconds),
|
|
19829
19870
|
focusedIndex: null,
|
|
19830
19871
|
scrollIndex: 0,
|
|
@@ -19844,9 +19885,12 @@
|
|
|
19844
19885
|
document.removeEventListener('keydown', this.handleGlobalKeys);
|
|
19845
19886
|
}
|
|
19846
19887
|
componentDidUpdate(prevProps, prevState) {
|
|
19847
|
-
const { timeState,
|
|
19848
|
-
const { time, is24Hour, delimiter, includeSeconds } = this.props;
|
|
19849
|
-
if (isOpen
|
|
19888
|
+
const { timeState, isTimeOptionsOpen, isInvalid, timeRegex } = this.state;
|
|
19889
|
+
const { time, is24Hour, delimiter, includeSeconds, isOpen } = this.props;
|
|
19890
|
+
if (prevProps.isOpen !== isOpen) {
|
|
19891
|
+
this.onToggle(isOpen);
|
|
19892
|
+
}
|
|
19893
|
+
if (isTimeOptionsOpen && !prevState.isTimeOptionsOpen && timeState && !isInvalid) {
|
|
19850
19894
|
this.scrollToSelection(timeState);
|
|
19851
19895
|
}
|
|
19852
19896
|
if (delimiter !== prevProps.delimiter) {
|
|
@@ -19863,10 +19907,14 @@
|
|
|
19863
19907
|
render() {
|
|
19864
19908
|
const _a = this.props, { 'aria-label': ariaLabel, isDisabled, className, placeholder, id, menuAppendTo, is24Hour, invalidFormatErrorMessage, invalidMinMaxErrorMessage, stepMinutes, width, delimiter, inputProps,
|
|
19865
19909
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19866
|
-
onChange,
|
|
19910
|
+
onChange,
|
|
19911
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19912
|
+
setIsOpen,
|
|
19913
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19914
|
+
isOpen, time, validateTime, minTime, maxTime, includeSeconds } = _a,
|
|
19867
19915
|
/* 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,
|
|
19916
|
+
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"]);
|
|
19917
|
+
const { timeState, isTimeOptionsOpen, isInvalid, minTimeState, maxTimeState } = this.state;
|
|
19870
19918
|
const style = { '--pf-c-date-picker__input--c-form-control--Width': width };
|
|
19871
19919
|
const options = makeTimeOptions(stepMinutes, !is24Hour, delimiter, minTimeState, maxTimeState, includeSeconds);
|
|
19872
19920
|
const isValidFormat = this.isValidFormat(timeState);
|
|
@@ -19885,8 +19933,8 @@
|
|
|
19885
19933
|
React__namespace.createElement("div", Object.assign({ className: css(datePickerStyles.datePickerInput), style: style }, props),
|
|
19886
19934
|
React__namespace.createElement(InputGroup, null,
|
|
19887
19935
|
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
|
-
|
|
19936
|
+
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)),
|
|
19937
|
+
isTimeOptionsOpen && menuAppendTo === 'inline' && menuContainer)),
|
|
19890
19938
|
isInvalid && (React__namespace.createElement("div", { className: css(datePickerStyles.datePickerHelperText, datePickerStyles.modifiers.error) }, !isValidFormat ? invalidFormatErrorMessage : invalidMinMaxErrorMessage)))));
|
|
19891
19939
|
}
|
|
19892
19940
|
}
|
|
@@ -19906,7 +19954,8 @@
|
|
|
19906
19954
|
stepMinutes: 30,
|
|
19907
19955
|
inputProps: {},
|
|
19908
19956
|
minTime: '',
|
|
19909
|
-
maxTime: ''
|
|
19957
|
+
maxTime: '',
|
|
19958
|
+
setIsOpen: () => { }
|
|
19910
19959
|
};
|
|
19911
19960
|
|
|
19912
19961
|
Promise.resolve().then(function () { return toggleGroup; });
|