@patternfly/react-core 5.0.0-alpha.15 → 5.0.0-alpha.16
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 +6 -0
- package/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/components/ClipboardCopy/ClipboardCopyButton.js +3 -2
- package/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/components/ContextSelector/ContextSelector.js +1 -1
- package/components/ContextSelector/ContextSelector.js.map +1 -1
- package/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/components/DatePicker/DatePicker.js +6 -5
- package/components/DatePicker/DatePicker.js.map +1 -1
- package/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/components/Dropdown/DropdownWithContext.js +4 -3
- package/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/components/DualListSelector/DualListSelectorControl.js +1 -1
- package/components/DualListSelector/DualListSelectorControl.js.map +1 -1
- package/components/InputGroup/InputGroup.d.ts +3 -2
- package/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/components/InputGroup/InputGroup.js +3 -2
- package/components/InputGroup/InputGroup.js.map +1 -1
- package/components/Label/Label.js +1 -1
- package/components/Label/Label.js.map +1 -1
- package/components/Nav/NavItem.d.ts.map +1 -1
- package/components/Nav/NavItem.js +3 -3
- package/components/Nav/NavItem.js.map +1 -1
- package/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/components/Pagination/PaginationOptionsMenu.js +4 -4
- package/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/components/Popover/Popover.d.ts +9 -8
- package/components/Popover/Popover.d.ts.map +1 -1
- package/components/Popover/Popover.js +4 -3
- package/components/Popover/Popover.js.map +1 -1
- package/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/components/SearchInput/SearchInput.js +5 -3
- package/components/SearchInput/SearchInput.js.map +1 -1
- package/components/Select/Select.d.ts.map +1 -1
- package/components/Select/Select.js +3 -2
- package/components/Select/Select.js.map +1 -1
- package/components/Slider/Slider.js +5 -5
- package/components/Slider/Slider.js.map +1 -1
- package/components/Tabs/OverflowTab.js +5 -5
- package/components/Tabs/OverflowTab.js.map +1 -1
- package/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/components/TimePicker/TimePicker.js +1 -1
- package/components/TimePicker/TimePicker.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +8 -7
- package/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/components/Tooltip/Tooltip.js +5 -4
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js +3 -2
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +6 -5
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.js +4 -3
- package/dist/esm/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorControl.js +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorControl.js.map +1 -1
- package/dist/esm/components/InputGroup/InputGroup.d.ts +3 -2
- package/dist/esm/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/esm/components/InputGroup/InputGroup.js +3 -2
- package/dist/esm/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/esm/components/Label/Label.js +1 -1
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavItem.js +3 -3
- package/dist/esm/components/Nav/NavItem.js.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js +4 -4
- package/dist/esm/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/esm/components/Popover/Popover.d.ts +9 -8
- package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
- package/dist/esm/components/Popover/Popover.js +4 -3
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +5 -3
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +3 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Slider/Slider.js +5 -5
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/components/Tabs/OverflowTab.js +5 -5
- package/dist/esm/components/Tabs/OverflowTab.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js +1 -1
- package/dist/esm/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.d.ts +8 -7
- package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +5 -4
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +10 -7
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +11 -14
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.js +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/next/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/next/components/Select/Select.js +1 -1
- package/dist/esm/next/components/Select/Select.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js +3 -2
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +6 -5
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.js +4 -3
- package/dist/js/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorControl.js +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorControl.js.map +1 -1
- package/dist/js/components/InputGroup/InputGroup.d.ts +3 -2
- package/dist/js/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/js/components/InputGroup/InputGroup.js +5 -4
- package/dist/js/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/js/components/Label/Label.js +1 -1
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Nav/NavItem.d.ts.map +1 -1
- package/dist/js/components/Nav/NavItem.js +3 -3
- package/dist/js/components/Nav/NavItem.js.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.d.ts.map +1 -1
- package/dist/js/components/Pagination/PaginationOptionsMenu.js +4 -4
- package/dist/js/components/Pagination/PaginationOptionsMenu.js.map +1 -1
- package/dist/js/components/Popover/Popover.d.ts +9 -8
- package/dist/js/components/Popover/Popover.d.ts.map +1 -1
- package/dist/js/components/Popover/Popover.js +4 -3
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js +5 -3
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +3 -2
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Slider/Slider.js +5 -5
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/components/Tabs/OverflowTab.js +5 -5
- package/dist/js/components/Tabs/OverflowTab.js.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/js/components/TimePicker/TimePicker.js +1 -1
- package/dist/js/components/TimePicker/TimePicker.js.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.d.ts +8 -7
- package/dist/js/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/js/components/Tooltip/Tooltip.js +5 -4
- package/dist/js/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +10 -7
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +11 -14
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.js +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/next/components/Select/Select.d.ts.map +1 -1
- package/dist/js/next/components/Select/Select.js +1 -1
- package/dist/js/next/components/Select/Select.js.map +1 -1
- package/dist/umd/react-core.min.js +3 -3
- package/helpers/Popper/Popper.d.ts +10 -7
- package/helpers/Popper/Popper.d.ts.map +1 -1
- package/helpers/Popper/Popper.js +11 -14
- package/helpers/Popper/Popper.js.map +1 -1
- package/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/next/components/Dropdown/Dropdown.js +1 -1
- package/next/components/Dropdown/Dropdown.js.map +1 -1
- package/next/components/Select/Select.d.ts.map +1 -1
- package/next/components/Select/Select.js +1 -1
- package/next/components/Select/Select.js.map +1 -1
- package/package.json +2 -2
- package/src/components/ClipboardCopy/ClipboardCopyButton.tsx +30 -24
- package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopy.test.tsx.snap +23 -27
- package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopyButton.test.tsx.snap +23 -27
- package/src/components/ContextSelector/ContextSelector.tsx +2 -0
- package/src/components/DatePicker/DatePicker.tsx +7 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +732 -744
- package/src/components/Dropdown/DropdownWithContext.tsx +6 -1
- package/src/components/DualListSelector/DualListSelectorControl.tsx +1 -1
- package/src/components/InputGroup/InputGroup.tsx +7 -3
- package/src/components/Label/Label.tsx +1 -1
- package/src/components/LabelGroup/examples/LabelGroupEditableAddDropdown.tsx +10 -1
- package/src/components/LabelGroup/examples/LabelGroupEditableAddModal.tsx +4 -0
- package/src/components/Nav/NavItem.tsx +4 -3
- package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +7 -11
- package/src/components/Pagination/PaginationOptionsMenu.tsx +5 -3
- package/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap +35 -39
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +694 -774
- package/src/components/Popover/Popover.tsx +14 -10
- package/src/components/Popover/examples/PopoverReactRef.tsx +1 -1
- package/src/components/Popover/examples/PopoverSelectorRef.tsx +1 -1
- package/src/components/ProgressStepper/examples/ProgressStepperHelpPopover.tsx +6 -6
- package/src/components/SearchInput/SearchInput.tsx +6 -2
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +411 -427
- package/src/components/Select/Select.tsx +4 -0
- package/src/components/Slider/Slider.tsx +5 -5
- package/src/components/Slider/_tests_/__snapshots__/Slider.test.tsx.snap +10 -14
- package/src/components/Tabs/OverflowTab.tsx +5 -5
- package/src/components/Tabs/examples/TabsHelp.tsx +1 -1
- package/src/components/Tabs/examples/TabsHelpAndClose.tsx +6 -2
- package/src/components/Tabs/examples/TabsTooltipReactRef.tsx +1 -1
- package/src/components/TimePicker/TimePicker.tsx +2 -0
- package/src/components/Tooltip/Tooltip.tsx +15 -11
- package/src/components/Tooltip/__tests__/Tooltip.test.tsx +6 -2
- package/src/components/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +4 -12
- package/src/components/Tooltip/examples/TooltipReactRef.tsx +1 -1
- package/src/components/Tooltip/examples/TooltipSelectorRef.tsx +1 -1
- package/src/demos/ComposableMenu/examples/ComposableActionsMenu.tsx +11 -2
- package/src/demos/ComposableMenu/examples/ComposableApplicationLauncher.tsx +23 -14
- package/src/demos/ComposableMenu/examples/ComposableContextSelector.tsx +11 -2
- package/src/demos/ComposableMenu/examples/ComposableDateSelect.tsx +10 -1
- package/src/demos/ComposableMenu/examples/ComposableDrilldownMenu.tsx +10 -1
- package/src/demos/ComposableMenu/examples/ComposableDropdwnVariants.tsx +7 -5
- package/src/demos/ComposableMenu/examples/ComposableFlyout.tsx +11 -2
- package/src/demos/ComposableMenu/examples/ComposableMultipleTypeaheadSelect.tsx +12 -10
- package/src/demos/ComposableMenu/examples/ComposableOptionsMenuVariants.tsx +1 -1
- package/src/demos/ComposableMenu/examples/ComposableSimpleCheckboxSelect.tsx +4 -4
- package/src/demos/ComposableMenu/examples/ComposableSimpleDropdown.tsx +2 -2
- package/src/demos/ComposableMenu/examples/ComposableSimpleSelect.tsx +1 -1
- package/src/demos/ComposableMenu/examples/ComposableTreeViewMenu.tsx +22 -11
- package/src/demos/ComposableMenu/examples/ComposableTypeaheadSelect.tsx +11 -9
- package/src/demos/Filters/examples/FilterAttributeSearch.tsx +13 -5
- package/src/demos/Filters/examples/FilterCheckboxSelect.tsx +16 -7
- package/src/demos/Filters/examples/FilterFaceted.tsx +18 -9
- package/src/demos/Filters/examples/FilterMixedSelectGroup.tsx +11 -5
- package/src/demos/Filters/examples/FilterSameSelectGroup.tsx +10 -4
- package/src/demos/Filters/examples/FilterSearchInput.tsx +6 -4
- package/src/demos/Filters/examples/FilterSingleSelect.tsx +14 -5
- package/src/demos/PasswordGenerator.md +6 -2
- package/src/demos/SearchInput/SearchInput.md +5 -1
- package/src/demos/examples/TextInputGroup/AttributeValueFiltering.tsx +13 -4
- package/src/demos/examples/TextInputGroup/AutoCompleteSearch.tsx +5 -3
- package/src/helpers/Popper/Popper.tsx +31 -23
- package/src/next/components/Dropdown/Dropdown.tsx +2 -0
- package/src/next/components/Select/Select.tsx +2 -0
|
@@ -1285,6 +1285,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
1285
1285
|
|
|
1286
1286
|
const menuContainer = footer ? <div className={css(styles.selectMenu)}> {innerMenu} </div> : innerMenu;
|
|
1287
1287
|
|
|
1288
|
+
const popperRef = React.createRef<HTMLDivElement>();
|
|
1288
1289
|
const popperContainer = (
|
|
1289
1290
|
<div
|
|
1290
1291
|
className={css(
|
|
@@ -1296,6 +1297,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
1296
1297
|
direction === SelectDirection.up && styles.modifiers.top,
|
|
1297
1298
|
className
|
|
1298
1299
|
)}
|
|
1300
|
+
ref={popperRef}
|
|
1299
1301
|
{...(width && { style: { width } })}
|
|
1300
1302
|
{...(validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })}
|
|
1301
1303
|
>
|
|
@@ -1476,7 +1478,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
1476
1478
|
) : (
|
|
1477
1479
|
<Popper
|
|
1478
1480
|
trigger={mainContainer}
|
|
1481
|
+
triggerRef={this.parentRef}
|
|
1479
1482
|
popper={popperContainer}
|
|
1483
|
+
popperRef={popperRef}
|
|
1480
1484
|
direction={direction}
|
|
1481
1485
|
appendTo={menuAppendTo === 'parent' ? getParentElement() : menuAppendTo}
|
|
1482
1486
|
isVisible={isOpen}
|
|
@@ -152,7 +152,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
152
152
|
|
|
153
153
|
const findAriaTextValue = () => {
|
|
154
154
|
if (!areCustomStepsContinuous && customSteps) {
|
|
155
|
-
const matchingStep = customSteps.find(stepObj => stepObj.value === localValue);
|
|
155
|
+
const matchingStep = customSteps.find((stepObj) => stepObj.value === localValue);
|
|
156
156
|
if (matchingStep) {
|
|
157
157
|
return matchingStep.label;
|
|
158
158
|
}
|
|
@@ -243,7 +243,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
243
243
|
if (customSteps[customSteps.length - 1].value !== 100) {
|
|
244
244
|
percentage = (newPercentage * (max - min)) / 100 + min;
|
|
245
245
|
}
|
|
246
|
-
const stepIndex = customSteps.findIndex(stepObj => stepObj.value >= percentage);
|
|
246
|
+
const stepIndex = customSteps.findIndex((stepObj) => stepObj.value >= percentage);
|
|
247
247
|
if (customSteps[stepIndex].value === percentage) {
|
|
248
248
|
snapValue = customSteps[stepIndex].value;
|
|
249
249
|
} else {
|
|
@@ -278,7 +278,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
278
278
|
e.preventDefault();
|
|
279
279
|
let newValue: number = localValue;
|
|
280
280
|
if (!areCustomStepsContinuous && customSteps) {
|
|
281
|
-
const stepIndex = customSteps.findIndex(stepObj => stepObj.value === localValue);
|
|
281
|
+
const stepIndex = customSteps.findIndex((stepObj) => stepObj.value === localValue);
|
|
282
282
|
if (key === 'ArrowRight') {
|
|
283
283
|
if (stepIndex + 1 < customSteps.length) {
|
|
284
284
|
{
|
|
@@ -397,7 +397,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
397
397
|
</div>
|
|
398
398
|
{customSteps && (
|
|
399
399
|
<div className={css(styles.sliderSteps)} aria-hidden="true">
|
|
400
|
-
{customSteps.map(stepObj => {
|
|
400
|
+
{customSteps.map((stepObj) => {
|
|
401
401
|
const minValue = customSteps[0].value;
|
|
402
402
|
const maxValue = customSteps[customSteps.length - 1].value;
|
|
403
403
|
const stepValue = getStepValue(stepObj.value, minValue, maxValue);
|
|
@@ -423,7 +423,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
|
|
|
423
423
|
<div className={css(styles.sliderValue, styles.modifiers.floating)}>{displayInput()}</div>
|
|
424
424
|
)}
|
|
425
425
|
{hasTooltipOverThumb ? (
|
|
426
|
-
<Tooltip entryDelay={0} content={findAriaTextValue()}>
|
|
426
|
+
<Tooltip triggerRef={thumbRef} entryDelay={0} content={findAriaTextValue()}>
|
|
427
427
|
{thumbComponent}
|
|
428
428
|
</Tooltip>
|
|
429
429
|
) : (
|
|
@@ -639,20 +639,16 @@ exports[`slider renders slider with tooltip on thumb 1`] = `
|
|
|
639
639
|
</div>
|
|
640
640
|
</div>
|
|
641
641
|
<div
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
role="slider"
|
|
653
|
-
tabindex="0"
|
|
654
|
-
/>
|
|
655
|
-
</div>
|
|
642
|
+
aria-disabled="false"
|
|
643
|
+
aria-label="Value"
|
|
644
|
+
aria-valuemax="100"
|
|
645
|
+
aria-valuemin="0"
|
|
646
|
+
aria-valuenow="50"
|
|
647
|
+
aria-valuetext="50"
|
|
648
|
+
class="pf-c-slider__thumb"
|
|
649
|
+
role="slider"
|
|
650
|
+
tabindex="0"
|
|
651
|
+
/>
|
|
656
652
|
</div>
|
|
657
653
|
</div>
|
|
658
654
|
</DocumentFragment>
|
|
@@ -70,11 +70,11 @@ export const OverflowTab: React.FunctionComponent<OverflowTabProps> = ({
|
|
|
70
70
|
};
|
|
71
71
|
}, [isExpanded, menuRef, overflowTabRef]);
|
|
72
72
|
|
|
73
|
-
const selectedTab = overflowingTabs.find(tab => tab.eventKey === localActiveKey);
|
|
73
|
+
const selectedTab = overflowingTabs.find((tab) => tab.eventKey === localActiveKey);
|
|
74
74
|
const tabTitle = selectedTab?.title ? selectedTab.title : defaultTitleText;
|
|
75
75
|
|
|
76
76
|
const toggleMenu = () => {
|
|
77
|
-
setIsExpanded(prevIsExpanded => !prevIsExpanded);
|
|
77
|
+
setIsExpanded((prevIsExpanded) => !prevIsExpanded);
|
|
78
78
|
setTimeout(() => {
|
|
79
79
|
if (menuRef?.current) {
|
|
80
80
|
const firstElement = menuRef.current.querySelector('li > button,input:not(:disabled)');
|
|
@@ -111,7 +111,7 @@ export const OverflowTab: React.FunctionComponent<OverflowTabProps> = ({
|
|
|
111
111
|
</li>
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
const tabs = overflowingTabs.map(tab => (
|
|
114
|
+
const tabs = overflowingTabs.map((tab) => (
|
|
115
115
|
<MenuItem key={tab.eventKey} itemId={tab.eventKey} isSelected={localActiveKey === tab.eventKey}>
|
|
116
116
|
{tab.title}
|
|
117
117
|
</MenuItem>
|
|
@@ -119,7 +119,7 @@ export const OverflowTab: React.FunctionComponent<OverflowTabProps> = ({
|
|
|
119
119
|
|
|
120
120
|
const onTabSelect = (event: React.MouseEvent<HTMLElement, MouseEvent>, key: number | string) => {
|
|
121
121
|
closeMenu();
|
|
122
|
-
const selectedTabRef = overflowingTabs.find(tab => tab.eventKey === key).tabContentRef;
|
|
122
|
+
const selectedTabRef = overflowingTabs.find((tab) => tab.eventKey === key).tabContentRef;
|
|
123
123
|
handleTabClick(event, key, selectedTabRef);
|
|
124
124
|
};
|
|
125
125
|
|
|
@@ -135,7 +135,7 @@ export const OverflowTab: React.FunctionComponent<OverflowTabProps> = ({
|
|
|
135
135
|
<React.Fragment>
|
|
136
136
|
{overflowTab}
|
|
137
137
|
<Popper
|
|
138
|
-
|
|
138
|
+
triggerRef={overflowTabRef}
|
|
139
139
|
popper={overflowMenu}
|
|
140
140
|
popperRef={menuRef}
|
|
141
141
|
isVisible={isExpanded}
|
|
@@ -32,7 +32,7 @@ export const TabsHelpAndClose: React.FunctionComponent = () => {
|
|
|
32
32
|
</div>
|
|
33
33
|
}
|
|
34
34
|
footerContent="Popover footer"
|
|
35
|
-
|
|
35
|
+
triggerRef={popoverRef}
|
|
36
36
|
/>
|
|
37
37
|
);
|
|
38
38
|
|
|
@@ -68,7 +68,11 @@ export const TabsHelpAndClose: React.FunctionComponent = () => {
|
|
|
68
68
|
<TabAction aria-label={`Help for ${tab}`} ref={ref}>
|
|
69
69
|
<HelpIcon />
|
|
70
70
|
</TabAction>
|
|
71
|
-
<TabAction
|
|
71
|
+
<TabAction
|
|
72
|
+
aria-label={`Close ${tab}`}
|
|
73
|
+
onClick={(e) => onClose(e, index)}
|
|
74
|
+
isDisabled={tabs.length === 1}
|
|
75
|
+
>
|
|
72
76
|
<TimesIcon />
|
|
73
77
|
</TabAction>
|
|
74
78
|
{helpPopover(`Help popover for ${tab}`, ref)}
|
|
@@ -55,7 +55,7 @@ export const TabsTooltipReactRef: React.FunctionComponent = () => {
|
|
|
55
55
|
<Tooltip
|
|
56
56
|
id="tooltip-ref1"
|
|
57
57
|
content="Aria-disabled tabs are like disabled tabs, but focusable. Allows for tooltip support."
|
|
58
|
-
|
|
58
|
+
triggerRef={tooltipRef}
|
|
59
59
|
/>
|
|
60
60
|
<div style={{ marginTop: '20px' }}>
|
|
61
61
|
<Checkbox
|
|
@@ -528,7 +528,9 @@ export class TimePicker extends React.Component<TimePickerProps, TimePickerState
|
|
|
528
528
|
<Popper
|
|
529
529
|
appendTo={calculatedAppendTo}
|
|
530
530
|
trigger={textInput}
|
|
531
|
+
triggerRef={this.inputRef}
|
|
531
532
|
popper={menuContainer}
|
|
533
|
+
popperRef={this.menuRef}
|
|
532
534
|
isVisible={isTimeOptionsOpen}
|
|
533
535
|
zIndex={zIndex}
|
|
534
536
|
/>
|
|
@@ -35,23 +35,24 @@ export interface TooltipProps extends Omit<React.HTMLProps<HTMLDivElement>, 'con
|
|
|
35
35
|
*/
|
|
36
36
|
aria?: 'describedby' | 'labelledby' | 'none';
|
|
37
37
|
/**
|
|
38
|
-
* Determines whether the tooltip is an aria-live region. If the
|
|
38
|
+
* Determines whether the tooltip is an aria-live region. If the triggerRef prop is passed in the
|
|
39
39
|
* default behavior is 'polite' in order to ensure the tooltip contents is announced to
|
|
40
40
|
* assistive technologies. Otherwise the default behavior is 'off'.
|
|
41
41
|
*/
|
|
42
42
|
'aria-live'?: 'off' | 'polite';
|
|
43
43
|
/**
|
|
44
|
-
* The reference element to which the Tooltip is relatively placed to.
|
|
45
|
-
* If you cannot wrap the
|
|
44
|
+
* The trigger reference element to which the Tooltip is relatively placed to.
|
|
45
|
+
* If you cannot wrap the element with the Tooltip, you can use the triggerRef prop instead.
|
|
46
46
|
* Usage: <Tooltip><Button>Reference</Button></Tooltip>
|
|
47
47
|
*/
|
|
48
48
|
children?: ReactElement<any>;
|
|
49
49
|
/**
|
|
50
|
-
* The reference element to which the Tooltip is relatively placed to.
|
|
51
|
-
* If you can wrap the
|
|
52
|
-
*
|
|
50
|
+
* The trigger reference element to which the Tooltip is relatively placed to.
|
|
51
|
+
* If you can wrap the element with the Tooltip, you can use the children prop instead, or both props together.
|
|
52
|
+
* When passed along with the trigger prop, the div element that wraps the trigger will be removed.
|
|
53
|
+
* Usage: <Tooltip triggerRef={() => document.getElementById('reference-element')} />
|
|
53
54
|
*/
|
|
54
|
-
|
|
55
|
+
triggerRef?: HTMLElement | (() => HTMLElement) | React.RefObject<any>;
|
|
55
56
|
/** Tooltip additional class */
|
|
56
57
|
className?: string;
|
|
57
58
|
/** Tooltip content */
|
|
@@ -158,8 +159,8 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
158
159
|
id = `pf-tooltip-${pfTooltipIdCounter++}`,
|
|
159
160
|
children,
|
|
160
161
|
animationDuration = 300,
|
|
161
|
-
|
|
162
|
-
'aria-live': ariaLive =
|
|
162
|
+
triggerRef,
|
|
163
|
+
'aria-live': ariaLive = triggerRef ? 'polite' : 'off',
|
|
163
164
|
onTooltipHidden = () => {},
|
|
164
165
|
...rest
|
|
165
166
|
}: TooltipProps) => {
|
|
@@ -174,11 +175,12 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
174
175
|
const transitionTimerRef = React.useRef(null);
|
|
175
176
|
const showTimerRef = React.useRef(null);
|
|
176
177
|
const hideTimerRef = React.useRef(null);
|
|
178
|
+
const popperRef = React.createRef<HTMLDivElement>();
|
|
177
179
|
|
|
178
180
|
const prevExitDelayRef = React.useRef<number>();
|
|
179
181
|
|
|
180
182
|
const clearTimeouts = (timeoutRefs: React.RefObject<any>[]) => {
|
|
181
|
-
timeoutRefs.forEach(ref => {
|
|
183
|
+
timeoutRefs.forEach((ref) => {
|
|
182
184
|
if (ref.current) {
|
|
183
185
|
clearTimeout(ref.current);
|
|
184
186
|
}
|
|
@@ -274,6 +276,7 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
274
276
|
opacity,
|
|
275
277
|
transition: getOpacityTransition(animationDuration)
|
|
276
278
|
}}
|
|
279
|
+
ref={popperRef}
|
|
277
280
|
{...rest}
|
|
278
281
|
>
|
|
279
282
|
<TooltipArrow />
|
|
@@ -315,8 +318,9 @@ export const Tooltip: React.FunctionComponent<TooltipProps> = ({
|
|
|
315
318
|
return (
|
|
316
319
|
<Popper
|
|
317
320
|
trigger={aria !== 'none' && visible ? addAriaToTrigger() : children}
|
|
318
|
-
|
|
321
|
+
triggerRef={triggerRef}
|
|
319
322
|
popper={content}
|
|
323
|
+
popperRef={popperRef}
|
|
320
324
|
popperMatchesTriggerWidth={false}
|
|
321
325
|
appendTo={appendTo}
|
|
322
326
|
isVisible={visible}
|
|
@@ -3,16 +3,18 @@ import { render } from '@testing-library/react';
|
|
|
3
3
|
import { Tooltip } from '../Tooltip';
|
|
4
4
|
|
|
5
5
|
test('tooltip renders', () => {
|
|
6
|
+
const ref = React.createRef<HTMLDivElement>();
|
|
6
7
|
const { asFragment } = render(
|
|
7
8
|
<Tooltip
|
|
8
9
|
position="top"
|
|
10
|
+
triggerRef={ref}
|
|
9
11
|
content={
|
|
10
12
|
<div>
|
|
11
13
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
|
|
12
14
|
</div>
|
|
13
15
|
}
|
|
14
16
|
>
|
|
15
|
-
<div>Toggle tooltip</div>
|
|
17
|
+
<div ref={ref}>Toggle tooltip</div>
|
|
16
18
|
</Tooltip>
|
|
17
19
|
);
|
|
18
20
|
expect(asFragment()).toMatchSnapshot();
|
|
@@ -20,17 +22,19 @@ test('tooltip renders', () => {
|
|
|
20
22
|
|
|
21
23
|
test('tooltip renders in strict mode', () => {
|
|
22
24
|
const consoleError = jest.spyOn(console, 'error');
|
|
25
|
+
const ref = React.createRef<HTMLDivElement>();
|
|
23
26
|
const { asFragment } = render(
|
|
24
27
|
<React.StrictMode>
|
|
25
28
|
<Tooltip
|
|
26
29
|
position="top"
|
|
30
|
+
triggerRef={ref}
|
|
27
31
|
content={
|
|
28
32
|
<div>
|
|
29
33
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
|
|
30
34
|
</div>
|
|
31
35
|
}
|
|
32
36
|
>
|
|
33
|
-
<div>Toggle tooltip</div>
|
|
37
|
+
<div ref={ref}>Toggle tooltip</div>
|
|
34
38
|
</Tooltip>
|
|
35
39
|
</React.StrictMode>
|
|
36
40
|
);
|
|
@@ -2,24 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`tooltip renders 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
<div>
|
|
9
|
-
Toggle tooltip
|
|
10
|
-
</div>
|
|
5
|
+
<div>
|
|
6
|
+
Toggle tooltip
|
|
11
7
|
</div>
|
|
12
8
|
</DocumentFragment>
|
|
13
9
|
`;
|
|
14
10
|
|
|
15
11
|
exports[`tooltip renders in strict mode 1`] = `
|
|
16
12
|
<DocumentFragment>
|
|
17
|
-
<div
|
|
18
|
-
|
|
19
|
-
>
|
|
20
|
-
<div>
|
|
21
|
-
Toggle tooltip
|
|
22
|
-
</div>
|
|
13
|
+
<div>
|
|
14
|
+
Toggle tooltip
|
|
23
15
|
</div>
|
|
24
16
|
</DocumentFragment>
|
|
25
17
|
`;
|
|
@@ -15,7 +15,7 @@ export const TooltipReactRef: React.FunctionComponent = () => {
|
|
|
15
15
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
|
|
16
16
|
</div>
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
triggerRef={tooltipRef}
|
|
19
19
|
/>
|
|
20
20
|
</div>
|
|
21
21
|
);
|
|
@@ -13,7 +13,7 @@ export const TooltipSelectorRef: React.FunctionComponent = () => (
|
|
|
13
13
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
|
|
14
14
|
</div>
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
triggerRef={() => document.getElementById('tooltip-selector') as HTMLButtonElement}
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
19
19
|
);
|
|
@@ -41,7 +41,7 @@ export const ComposableActionsMenu: React.FunctionComponent = () => {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (selectedItems.includes(itemId)) {
|
|
44
|
-
setSelectedItems(selectedItems.filter(id => id !== itemId));
|
|
44
|
+
setSelectedItems(selectedItems.filter((id) => id !== itemId));
|
|
45
45
|
} else {
|
|
46
46
|
setSelectedItems([...selectedItems, itemId]);
|
|
47
47
|
}
|
|
@@ -122,5 +122,14 @@ export const ComposableActionsMenu: React.FunctionComponent = () => {
|
|
|
122
122
|
</Menu>
|
|
123
123
|
);
|
|
124
124
|
|
|
125
|
-
return
|
|
125
|
+
return (
|
|
126
|
+
<Popper
|
|
127
|
+
trigger={toggle}
|
|
128
|
+
triggerRef={toggleRef}
|
|
129
|
+
popper={menu}
|
|
130
|
+
popperRef={menuRef}
|
|
131
|
+
isVisible={isOpen}
|
|
132
|
+
popperMatchesTriggerWidth={false}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
126
135
|
};
|
|
@@ -90,7 +90,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
90
90
|
id="1"
|
|
91
91
|
isFavorited={favorites.includes('1')}
|
|
92
92
|
to="#default-link2"
|
|
93
|
-
onClick={ev => ev.preventDefault()}
|
|
93
|
+
onClick={(ev) => ev.preventDefault()}
|
|
94
94
|
>
|
|
95
95
|
Application 2
|
|
96
96
|
</MenuItem>
|
|
@@ -103,7 +103,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
103
103
|
itemId="2"
|
|
104
104
|
id="2"
|
|
105
105
|
isFavorited={favorites.includes('2')}
|
|
106
|
-
component={props => <Link {...props} to="#router-link" />}
|
|
106
|
+
component={(props) => <Link {...props} to="#router-link" />}
|
|
107
107
|
>
|
|
108
108
|
@reach/router Link
|
|
109
109
|
</MenuItem>
|
|
@@ -113,7 +113,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
113
113
|
isFavorited={favorites.includes('3')}
|
|
114
114
|
isExternalLink
|
|
115
115
|
icon={<img src={pfIcon} />}
|
|
116
|
-
component={props => <Link {...props} to="#router-link2" />}
|
|
116
|
+
component={(props) => <Link {...props} to="#router-link2" />}
|
|
117
117
|
>
|
|
118
118
|
@reach/router Link with icon
|
|
119
119
|
</MenuItem>
|
|
@@ -135,15 +135,15 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
135
135
|
const createFavorites = (favIds: string[]) => {
|
|
136
136
|
const favorites: unknown[] = [];
|
|
137
137
|
|
|
138
|
-
menuItems.forEach(item => {
|
|
138
|
+
menuItems.forEach((item) => {
|
|
139
139
|
if (item.type === MenuList) {
|
|
140
|
-
item.props.children.filter(child => {
|
|
140
|
+
item.props.children.filter((child) => {
|
|
141
141
|
if (favIds.includes(child.props.itemId)) {
|
|
142
142
|
favorites.push(child);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
} else if (item.type === MenuGroup) {
|
|
146
|
-
item.props.children.props.children.filter(child => {
|
|
146
|
+
item.props.children.props.children.filter((child) => {
|
|
147
147
|
if (favIds.includes(child.props.itemId)) {
|
|
148
148
|
favorites.push(child);
|
|
149
149
|
}
|
|
@@ -164,11 +164,11 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
164
164
|
}
|
|
165
165
|
let keepDivider = false;
|
|
166
166
|
const filteredCopy = items
|
|
167
|
-
.map(group => {
|
|
167
|
+
.map((group) => {
|
|
168
168
|
if (group.type === MenuGroup) {
|
|
169
169
|
const filteredGroup = React.cloneElement(group, {
|
|
170
170
|
children: React.cloneElement(group.props.children, {
|
|
171
|
-
children: group.props.children.props.children.filter(child => {
|
|
171
|
+
children: group.props.children.props.children.filter((child) => {
|
|
172
172
|
if (filteredIds.includes(child.props.itemId)) {
|
|
173
173
|
return child;
|
|
174
174
|
}
|
|
@@ -184,7 +184,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
184
184
|
}
|
|
185
185
|
} else if (group.type === MenuList) {
|
|
186
186
|
const filteredGroup = React.cloneElement(group, {
|
|
187
|
-
children: group.props.children.filter(child => {
|
|
187
|
+
children: group.props.children.filter((child) => {
|
|
188
188
|
if (filteredIds.includes(child.props.itemId)) {
|
|
189
189
|
return child;
|
|
190
190
|
}
|
|
@@ -202,7 +202,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
})
|
|
205
|
-
.filter(newGroup => newGroup);
|
|
205
|
+
.filter((newGroup) => newGroup);
|
|
206
206
|
|
|
207
207
|
if (filteredCopy.length > 0) {
|
|
208
208
|
const lastGroup = filteredCopy.pop();
|
|
@@ -222,8 +222,8 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
222
222
|
|
|
223
223
|
const filteredIds =
|
|
224
224
|
refFullOptions
|
|
225
|
-
?.filter(item => (item as HTMLElement).innerText.toLowerCase().includes(textValue.toString().toLowerCase()))
|
|
226
|
-
.map(item => item.id) || [];
|
|
225
|
+
?.filter((item) => (item as HTMLElement).innerText.toLowerCase().includes(textValue.toString().toLowerCase()))
|
|
226
|
+
.map((item) => item.id) || [];
|
|
227
227
|
setFilteredIds(filteredIds);
|
|
228
228
|
};
|
|
229
229
|
|
|
@@ -232,7 +232,7 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
232
232
|
if (actionId === 'fav') {
|
|
233
233
|
const isFavorite = favorites.includes(itemId);
|
|
234
234
|
if (isFavorite) {
|
|
235
|
-
setFavorites(favorites.filter(fav => fav !== itemId));
|
|
235
|
+
setFavorites(favorites.filter((fav) => fav !== itemId));
|
|
236
236
|
} else {
|
|
237
237
|
setFavorites([...favorites, itemId]);
|
|
238
238
|
}
|
|
@@ -265,5 +265,14 @@ export const ComposableApplicationLauncher: React.FunctionComponent = () => {
|
|
|
265
265
|
</MenuContent>
|
|
266
266
|
</Menu>
|
|
267
267
|
);
|
|
268
|
-
return
|
|
268
|
+
return (
|
|
269
|
+
<Popper
|
|
270
|
+
trigger={toggle}
|
|
271
|
+
triggerRef={toggleRef}
|
|
272
|
+
popper={menu}
|
|
273
|
+
popperRef={menuRef}
|
|
274
|
+
isVisible={isOpen}
|
|
275
|
+
popperMatchesTriggerWidth={false}
|
|
276
|
+
/>
|
|
277
|
+
);
|
|
269
278
|
};
|
|
@@ -130,7 +130,7 @@ export const ComposableContextSelector: React.FunctionComponent = () => {
|
|
|
130
130
|
const filtered =
|
|
131
131
|
searchInputValue === ''
|
|
132
132
|
? items
|
|
133
|
-
: items.filter(item => {
|
|
133
|
+
: items.filter((item) => {
|
|
134
134
|
const str = typeof item === 'string' ? item : item.text;
|
|
135
135
|
return str.toLowerCase().indexOf(searchInputValue.toLowerCase()) !== -1;
|
|
136
136
|
});
|
|
@@ -198,5 +198,14 @@ export const ComposableContextSelector: React.FunctionComponent = () => {
|
|
|
198
198
|
</MenuFooter>
|
|
199
199
|
</Menu>
|
|
200
200
|
);
|
|
201
|
-
return
|
|
201
|
+
return (
|
|
202
|
+
<Popper
|
|
203
|
+
trigger={toggle}
|
|
204
|
+
triggerRef={toggleRef}
|
|
205
|
+
popper={menu}
|
|
206
|
+
popperRef={menuRef}
|
|
207
|
+
isVisible={isOpen}
|
|
208
|
+
popperMatchesTriggerWidth={false}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
202
211
|
};
|
|
@@ -109,5 +109,14 @@ export const ComposableSimpleDropdown: React.FunctionComponent = () => {
|
|
|
109
109
|
</MenuContent>
|
|
110
110
|
</Menu>
|
|
111
111
|
);
|
|
112
|
-
return
|
|
112
|
+
return (
|
|
113
|
+
<Popper
|
|
114
|
+
trigger={toggle}
|
|
115
|
+
triggerRef={toggleRef}
|
|
116
|
+
popper={menu}
|
|
117
|
+
popperRef={menuRef}
|
|
118
|
+
isVisible={isOpen}
|
|
119
|
+
popperMatchesTriggerWidth={false}
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
113
122
|
};
|
|
@@ -247,5 +247,14 @@ export const ComposableDrilldownMenu: React.FunctionComponent = () => {
|
|
|
247
247
|
</MenuContent>
|
|
248
248
|
</Menu>
|
|
249
249
|
);
|
|
250
|
-
return
|
|
250
|
+
return (
|
|
251
|
+
<Popper
|
|
252
|
+
trigger={toggle}
|
|
253
|
+
triggerRef={toggleRef}
|
|
254
|
+
popper={menu}
|
|
255
|
+
popperRef={menuRef}
|
|
256
|
+
isVisible={isOpen}
|
|
257
|
+
popperMatchesTriggerWidth={false}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
251
260
|
};
|
|
@@ -133,7 +133,7 @@ export const ComposableDropdwnVariants: React.FunctionComponent = () => {
|
|
|
133
133
|
itemId={0}
|
|
134
134
|
to="#default-link0"
|
|
135
135
|
// just for demo so that navigation is not triggered
|
|
136
|
-
onClick={event => event.preventDefault()}
|
|
136
|
+
onClick={(event) => event.preventDefault()}
|
|
137
137
|
>
|
|
138
138
|
My profile
|
|
139
139
|
</MenuItem>
|
|
@@ -141,7 +141,7 @@ export const ComposableDropdwnVariants: React.FunctionComponent = () => {
|
|
|
141
141
|
itemId={1}
|
|
142
142
|
to="#default-link1"
|
|
143
143
|
// just for demo so that navigation is not triggered
|
|
144
|
-
onClick={event => event.preventDefault()}
|
|
144
|
+
onClick={(event) => event.preventDefault()}
|
|
145
145
|
>
|
|
146
146
|
User management
|
|
147
147
|
</MenuItem>
|
|
@@ -149,7 +149,7 @@ export const ComposableDropdwnVariants: React.FunctionComponent = () => {
|
|
|
149
149
|
itemId={2}
|
|
150
150
|
to="#default-link2"
|
|
151
151
|
// just for demo so that navigation is not triggered
|
|
152
|
-
onClick={event => event.preventDefault()}
|
|
152
|
+
onClick={(event) => event.preventDefault()}
|
|
153
153
|
>
|
|
154
154
|
Logout
|
|
155
155
|
</MenuItem>
|
|
@@ -163,7 +163,7 @@ export const ComposableDropdwnVariants: React.FunctionComponent = () => {
|
|
|
163
163
|
itemId={0}
|
|
164
164
|
to="#default-link0"
|
|
165
165
|
// just for demo so that navigation is not triggered
|
|
166
|
-
onClick={event => event.preventDefault()}
|
|
166
|
+
onClick={(event) => event.preventDefault()}
|
|
167
167
|
>
|
|
168
168
|
Link
|
|
169
169
|
</MenuItem>
|
|
@@ -173,7 +173,7 @@ export const ComposableDropdwnVariants: React.FunctionComponent = () => {
|
|
|
173
173
|
isDisabled
|
|
174
174
|
to="#default-link2"
|
|
175
175
|
// just for demo so that navigation is not triggered
|
|
176
|
-
onClick={event => event.preventDefault()}
|
|
176
|
+
onClick={(event) => event.preventDefault()}
|
|
177
177
|
>
|
|
178
178
|
Disabled link
|
|
179
179
|
</MenuItem>
|
|
@@ -228,7 +228,9 @@ export const ComposableDropdwnVariants: React.FunctionComponent = () => {
|
|
|
228
228
|
<br />
|
|
229
229
|
<Popper
|
|
230
230
|
trigger={buildToggle()}
|
|
231
|
+
triggerRef={toggleRef}
|
|
231
232
|
popper={menu}
|
|
233
|
+
popperRef={menuRef}
|
|
232
234
|
isVisible={isOpen}
|
|
233
235
|
popperMatchesTriggerWidth={['image', 'checkbox'].includes(toggleSelected)}
|
|
234
236
|
/>
|
|
@@ -17,7 +17,7 @@ const FlyoutMenu: React.FunctionComponent<FlyoutMenuProps> = ({ depth, children
|
|
|
17
17
|
<MenuItem flyoutMenu={children} itemId={`next-menu-${depth}`}>
|
|
18
18
|
Next menu
|
|
19
19
|
</MenuItem>
|
|
20
|
-
{Array.from(new Array(15 - depth), (x, i) => i + 1).map(j => (
|
|
20
|
+
{Array.from(new Array(15 - depth), (x, i) => i + 1).map((j) => (
|
|
21
21
|
<MenuItem key={`${depth}-${j}`} itemId={`${depth}-${j}`}>
|
|
22
22
|
Menu {depth} item {j}
|
|
23
23
|
</MenuItem>
|
|
@@ -100,5 +100,14 @@ export const ComposableFlyout: React.FunctionComponent = () => {
|
|
|
100
100
|
</Menu>
|
|
101
101
|
);
|
|
102
102
|
|
|
103
|
-
return
|
|
103
|
+
return (
|
|
104
|
+
<Popper
|
|
105
|
+
trigger={toggle}
|
|
106
|
+
triggerRef={toggleRef}
|
|
107
|
+
popper={menu}
|
|
108
|
+
popperRef={menuRef}
|
|
109
|
+
isVisible={isOpen}
|
|
110
|
+
popperMatchesTriggerWidth={false}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
104
113
|
};
|