@qualtrics/ui-react 2.19.0 → 2.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/__shared/cjs/{index-4e4cc354.js → index-384184bd.js} +994 -1872
- package/dist/__shared/cjs/{index-bf07471d.js → index-4a5425cc.js} +10 -7
- package/dist/components/Accordion/Accordion.js +1 -5
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -8
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/BreakpointSwitch/Breakpoint.js +0 -2
- package/dist/components/BreakpointSwitch/BreakpointSwitch.js +0 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -7
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -2
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +11 -11
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox.js +1 -1
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +9 -30
- package/dist/components/ColorPicker/ColorPicker.js +33 -42
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyout.js +2 -1
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +20 -23
- package/dist/components/ColorPicker/Hue.js +2 -19
- package/dist/components/ColorPicker/Palette.js +7 -27
- package/dist/components/ColorPicker/Saturation.js +8 -29
- package/dist/components/ColorPicker/utils/calculateTargetId.js +10 -20
- package/dist/components/ColorPicker/utils/getMousePosition.js +4 -3
- package/dist/components/ColorPicker/utils/hexToHsv.js +0 -5
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +2 -4
- package/dist/components/ColorPicker/utils/hsvToHex.js +0 -3
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +12 -19
- package/dist/components/Combobox/Combobox.js +57 -127
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +2 -4
- package/dist/components/Combobox/ComboboxInput.js +4 -5
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane.js +0 -7
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/index.js +0 -1
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +34 -30
- package/dist/components/Dropdown/Dropdown.js +17 -68
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -33
- package/dist/components/Dropdown/DropdownHeader.js +2 -1
- package/dist/components/Dropdown/DropdownList.js +8 -7
- package/dist/components/Dropdown/DropdownOption.js +3 -10
- package/dist/components/Dropdown/DropdownSearch.js +6 -24
- package/dist/components/FilePicker/FilePicker.js +15 -26
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FormField/FormFieldContext.js +3 -6
- package/dist/components/FormField/ReadOnlyText.js +2 -1
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -11
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +3 -6
- package/dist/components/Icon/IconTypes.js +1 -0
- package/dist/components/IconButton/IconButton.js +1 -6
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +16 -33
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +3 -2
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -5
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/InputGroup/InputGroupProvider.js +0 -2
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionContainer.js +0 -2
- package/dist/components/LogicEditor/ConditionSet.js +8 -25
- package/dist/components/LogicEditor/Controls.js +2 -2
- package/dist/components/LogicEditor/LogicEditor.js +3 -12
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +9 -34
- package/dist/components/Modal/Modal.js +22 -35
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +43 -108
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -3
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +20 -32
- package/dist/components/NewMenu/parts/MenuItem.js +2 -3
- package/dist/components/NewMenu/parts/MenuSearchBox.js +2 -1
- package/dist/components/NumberStepper/NumberStepper.js +29 -44
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperIncrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperInput.js +10 -12
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +10 -6
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +8 -8
- package/dist/components/Pagination/PaginationPageInput.js +17 -22
- package/dist/components/Pagination/PaginationPreviousButton.js +8 -8
- package/dist/components/Popover/Popover.js +9 -18
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +3 -5
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +6 -23
- package/dist/components/Radio/Radio.js +11 -13
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +5 -11
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/ExpandCollapseButton.js +0 -2
- package/dist/components/SidebarNav/SidebarNav.js +5 -4
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -4
- package/dist/components/Slider/RangeSlider.js +8 -22
- package/dist/components/Slider/Slider.js +7 -26
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +7 -9
- package/dist/components/Switch/Switch.js +11 -11
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabContextProvider.js +1 -1
- package/dist/components/Tabs/TabList.js +9 -17
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/TabPanels.js +0 -2
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +12 -41
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/PortalTargetContext.js +0 -1
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -11
- package/dist/components/deprecated_ColorPicker/Color.js +9 -66
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -8
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -7
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -10
- package/dist/components/deprecated_ColorPicker/Saturation.js +7 -14
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -6
- package/dist/components/deprecated_ColorPicker/useMouseDrag.js +0 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper.js +14 -20
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +16 -17
- package/dist/components/deprecated_Tabs/Tabs.js +9 -25
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanels.js +3 -17
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +10 -26
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -18
- package/dist/hooks/useBreakpoints/useBreakpoints.js +3 -4
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -7
- package/dist/hooks/useClickOutsidePortals/useClickOutsidePortals.js +3 -6
- package/dist/hooks/useControllableState/useControllableState.js +5 -10
- package/dist/hooks/useDidUpdate/useDidUpdate.js +2 -4
- package/dist/hooks/useEventCallback/useEventCallback.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +1 -4
- package/dist/hooks/useFocusSequence/useFocusSequence.js +10 -17
- package/dist/hooks/useId/useId.js +1 -2
- package/dist/hooks/useIsFocused/useIsFocused.js +0 -1
- package/dist/hooks/useIsHovered/useIsHovered.js +0 -1
- package/dist/hooks/useIsTruncated/useIsTruncated.js +4 -3
- package/dist/hooks/useLatest/useLatest.js +0 -1
- package/dist/hooks/useMounted/useMounted.js +0 -1
- package/dist/hooks/useMouseDrag/useMouseDrag.js +0 -4
- package/dist/hooks/useOverlay/useOverlay.js +4 -10
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/usePrevious/usePrevious.js +0 -1
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +1 -4
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +11 -16
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/components/HeadsetIcon.js +6 -0
- package/dist/icons/components/PauseCircleIcon.js +1 -1
- package/dist/icons/createIconComponent.js +2 -3
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.es.js +1 -0
- package/dist/icons/index.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4 -3
- package/dist/index.js +6 -5
- package/dist/next/AdvancedTable/AdvancedTable.js +82 -188
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +4 -14
- package/dist/next/AdvancedTable/AdvancedTableCheckbox.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +11 -41
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +8 -14
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +4 -6
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -4
- package/dist/next/AdvancedTable/AdvancedTableRowExpandButton.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableTypes.js +1 -3
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +8 -13
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -20
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Combobox/ComboboxFlyout.js +3 -3
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +7 -20
- package/dist/next/Combobox/ComboboxOption.js +5 -6
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +37 -54
- package/dist/next/Combobox/hooks/useComboboxLoadingState/useComboboxLoadingState.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +5 -3
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +10 -10
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +1 -6
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +6 -6
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +4 -6
- package/dist/next/Drawer/Drawer.js +5 -16
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +7 -5
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +5 -8
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +10 -23
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuContext.js +0 -2
- package/dist/next/Menu/MenuItem.js +11 -15
- package/dist/next/Menu/MenuPane.js +11 -25
- package/dist/next/Menu/MenuSearch.js +15 -22
- package/dist/next/Menu/SubMenu.js +10 -27
- package/dist/next/Menu/usePaneSearch.js +2 -1
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +12 -19
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +6 -12
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/Stack/Stack.js +0 -3
- package/dist/next/TimePicker/TimeDropdown.js +4 -5
- package/dist/next/TimePicker/TimeInput.js +4 -5
- package/dist/next/TimePicker/TimePicker.js +12 -30
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +1 -3
- package/dist/next/TimePicker/utils.js +12 -52
- package/dist/next/ToggleButton/ToggleButton.js +0 -5
- package/dist/next/ToggleButton/ToggleButtonGroup.js +2 -1
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.js +376 -748
- package/dist/utils/Flyout/Flyout.js +4 -5
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +18 -25
- package/dist/utils/Portal/Portal.js +2 -1
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +4 -4
- package/dist/utils/Translation/Translate.js +0 -4
- package/dist/utils/Translation/TranslationProvider.js +0 -1
- package/dist/utils/Translation/containsComponentOrElement.js +1 -5
- package/dist/utils/Translation/insertPlaceholders.js +0 -1
- package/dist/utils/Translation/useTranslation.js +7 -14
- package/dist/utils/concatIds/concatIds.js +0 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/createContextUtilities/createContextUtilities.js +0 -4
- package/dist/utils/filterChildren/filterChildren.js +8 -17
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -2
- package/dist/utils/keyboardUser/keyboardUser.js +0 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -12
- package/dist/utils/mergeRefs/mergeRefs.js +1 -2
- package/dist/utils/wrapAround/wrapAround.js +1 -2
- package/dist/utils/wrapEvent/wrapEvent.js +2 -4
- package/icons/package.json +2 -1
- package/next/package.json +5 -1
- package/package.json +9 -4
|
@@ -25,29 +25,24 @@ const Tabs = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
25
25
|
...rest
|
|
26
26
|
} = _ref;
|
|
27
27
|
const tabsId = useId(externalId);
|
|
28
|
-
const tabIdPrefix =
|
|
29
|
-
const tabPanelIdPrefix =
|
|
28
|
+
const tabIdPrefix = `${tabsId}-tab-`;
|
|
29
|
+
const tabPanelIdPrefix = `${tabsId}-tab-panel-`;
|
|
30
30
|
const tabRefs = useRef({});
|
|
31
31
|
const [tabIndexOfActiveTab, setTabIndexOfActiveTab] = useState(0);
|
|
32
|
-
|
|
33
32
|
const focusOnIndex = index => {
|
|
34
33
|
const tabRefsLength = Object.keys(tabRefs.current).length;
|
|
35
34
|
const wrappedIndex = wrapAround(index, 0, tabRefsLength - 1);
|
|
36
35
|
tabRefs.current[wrappedIndex].focus();
|
|
37
36
|
};
|
|
38
|
-
|
|
39
37
|
const handleTablistFocus = () => {
|
|
40
38
|
setTabIndexOfActiveTab(-1);
|
|
41
39
|
};
|
|
42
|
-
|
|
43
40
|
const handleTablistBlur = () => {
|
|
44
41
|
setTabIndexOfActiveTab(0);
|
|
45
42
|
};
|
|
46
|
-
|
|
47
43
|
const handleSelect = key => {
|
|
48
|
-
onChange
|
|
44
|
+
onChange?.(key);
|
|
49
45
|
};
|
|
50
|
-
|
|
51
46
|
const handleKeyDown = (event, tabElementKey, index) => {
|
|
52
47
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
53
48
|
handleSelect(tabElementKey);
|
|
@@ -62,15 +57,12 @@ const Tabs = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
62
57
|
event.preventDefault();
|
|
63
58
|
tabRefs.current[Object.keys(tabRefs.current).length - 1].focus();
|
|
64
59
|
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
};
|
|
61
|
+
// Chose not to use `React.Children.toArray(..)` because it prefixes the keys (see https://reactjs.org/docs/react-api.html#reactchildrentoarray)
|
|
68
62
|
function getTabs() {
|
|
69
63
|
const tabs = [];
|
|
70
64
|
React__default.Children.forEach(children, (child, index) => {
|
|
71
65
|
if (child) {
|
|
72
|
-
var _child$props$id;
|
|
73
|
-
|
|
74
66
|
const key = child.key || String(index);
|
|
75
67
|
const active = key === activeKey;
|
|
76
68
|
const context = {
|
|
@@ -82,21 +74,17 @@ const Tabs = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
82
74
|
value: context
|
|
83
75
|
}, /*#__PURE__*/React__default.cloneElement(child, {
|
|
84
76
|
key,
|
|
85
|
-
id:
|
|
77
|
+
id: child.props.id ?? tabIdPrefix + key,
|
|
86
78
|
children: child.props.children,
|
|
87
79
|
ref: mergeRefs(child.ref, node => {
|
|
88
80
|
tabRefs.current[index] = node;
|
|
89
81
|
}),
|
|
90
82
|
onKeyDown: event => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
(_child$props$onKeyDow = (_child$props = child.props).onKeyDown) === null || _child$props$onKeyDow === void 0 ? void 0 : _child$props$onKeyDow.call(_child$props);
|
|
83
|
+
child.props.onKeyDown?.();
|
|
94
84
|
handleKeyDown(event, key, index);
|
|
95
85
|
},
|
|
96
86
|
onClick: () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
(_child$props$onClick = (_child$props2 = child.props).onClick) === null || _child$props$onClick === void 0 ? void 0 : _child$props$onClick.call(_child$props2);
|
|
87
|
+
child.props.onClick?.();
|
|
100
88
|
handleSelect(key);
|
|
101
89
|
},
|
|
102
90
|
'aria-controls': tabPanelIdPrefix + key
|
|
@@ -105,13 +93,10 @@ const Tabs = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
105
93
|
});
|
|
106
94
|
return tabs;
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
function getPanels() {
|
|
110
97
|
const panels = [];
|
|
111
98
|
React__default.Children.forEach(children, (child, index) => {
|
|
112
99
|
if (child) {
|
|
113
|
-
var _child$props$id2;
|
|
114
|
-
|
|
115
100
|
const key = child.key || String(index);
|
|
116
101
|
const isActive = key === activeKey;
|
|
117
102
|
const panelClasses = classNames(styles.panel, {
|
|
@@ -120,7 +105,7 @@ const Tabs = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
120
105
|
panels.push( /*#__PURE__*/React__default.createElement("div", {
|
|
121
106
|
key: key,
|
|
122
107
|
role: "tabpanel",
|
|
123
|
-
"aria-labelledby":
|
|
108
|
+
"aria-labelledby": child.props.id ?? tabIdPrefix + key,
|
|
124
109
|
className: panelClasses,
|
|
125
110
|
id: tabPanelIdPrefix + key
|
|
126
111
|
}, isActive ? child.props.children : null));
|
|
@@ -128,7 +113,6 @@ const Tabs = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
128
113
|
});
|
|
129
114
|
return panels;
|
|
130
115
|
}
|
|
131
|
-
|
|
132
116
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
133
117
|
ref: ref,
|
|
134
118
|
className: classNames(className, styles.tabs)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"tabs":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._N-5Gv{display:block}._7zMJM{display:flex;justify-content:left;border-bottom:1px solid #e5e5e5;height:52px}._8-JN5{color:#6a6d70;cursor:pointer;height:52px;padding:16px 12px;max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;border-bottom:1px solid transparent;border-radius:1px}._8-JN5:hover{color:#32363a}._8-JN5:focus{outline:none}._8-JN5._9XizX{margin-bottom:-1px;border-bottom:2px solid #0b6ed0;color:#32363a;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-weight:500}._tYbg0{padding-top:32px}._tYbg0._bpZi6{display:none}body.keyboard-user ._8-JN5:active:focus,body.keyboard-user ._8-JN5:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4
|
+
var styles = {"tabs":"_N-5Gv","bar":"_7zMJM","tab":"_8-JN5","active":"_9XizX","panel":"_tYbg0","inactive":"_bpZi6"};
|
|
5
|
+
var stylesheet="._N-5Gv{display:block}._7zMJM{display:flex;justify-content:left;border-bottom:1px solid #e5e5e5;height:52px}._8-JN5{color:#6a6d70;cursor:pointer;height:52px;padding:16px 12px;max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;border-bottom:1px solid transparent;border-radius:1px}._8-JN5:hover{color:#32363a}._8-JN5:focus{outline:none}._8-JN5._9XizX{margin-bottom:-1px;border-bottom:2px solid #0b6ed0;color:#32363a;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-weight:500}._tYbg0{padding-top:32px}._tYbg0._bpZi6{display:none}body.keyboard-user ._8-JN5:active:focus,body.keyboard-user ._8-JN5:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"toolbar":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._VtUL4,._zuBJ7{display:flex}._VtUL4{flex-direction:column;align-items:center;min-width:165px;max-width:240px;padding:12px 16px 16px;border-right:1px solid #898989;background-color:#fff}._aTCz7{width:69px;min-width:auto;max-width:none}._jje8M{width:100%}._FIGzL{margin-bottom:12px;background-color:transparent!important}._FIGzL:hover{background-color:rgba(11,110,208,.08)!important}._FIGzL:hover>svg{fill:#085caf}._FIGzL:hover>span{color:#085caf}._FIGzL:active{background-color:rgba(11,110,208,.12)!important}._FIGzL:active>svg{fill:#0854a1}._FIGzL:active>span{color:#0854a1}._FIGzL._klxKU{background-color:rgba(11,110,208,.08)!important}._FIGzL._klxKU>svg{fill:#0b6ed0}._FIGzL._klxKU>span{color:#0b6ed0;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-weight:500}._FIGzL._klxKU:hover{background-color:rgba(11,110,208,.08)!important}._FIGzL._klxKU:hover>svg{fill:#085caf}._FIGzL._klxKU:hover>span{color:#085caf}._FIGzL._klxKU:active{background-color:rgba(11,110,208,.12)!important}._FIGzL._klxKU:active>svg{fill:#0854a1}._FIGzL._klxKU:active>span{color:#0854a1}._ZazGv{border-radius:6px}._ZazGv>._gEpRy{display:block;fill:#515559}._fGTFN{margin-top:auto;margin-bottom:0}._RgTaN{position:relative;width:295px;background-color:#fff;padding:2px 1px 2px 2px;border-right:1px solid #898989}._RgTaN:hover>._D5Yhq{opacity:1}._ljIRE{width:0;border-width:0;padding:0}._s8gvY{border-radius:4px;min-width:100%;min-height:100%;outline:none}._5xdQX{width:36px;height:36px;position:absolute;top:48px;right:-18px;display:flex;justify-content:center;align-items:center;padding:0;background-color:transparent;border:2px solid transparent;border-radius:6px;outline:none;cursor:pointer;z-index:10}._D5Yhq{opacity:0}._5xdQX._qDhfG._qDhfG,._c4jtR,._D5Yhq:hover{opacity:1}._5xdQX._Tw4FZ._Tw4FZ{opacity:0}._5xdQX>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._5xdQX>span:hover{background-color:#0b6ed0;border-color:#0b6ed0}._5xdQX>span:hover>svg{fill:#fff}._5xdQX>span:active{background-color:#0854a1;border-color:#0854a1}._5xdQX>span:active>svg{fill:#fff}._5xdQX>span>svg{fill:#515559;border-radius:50%}._s8gvY._1EFws{display:none!important}._xRLFf{width:100%;height:36px;display:flex;align-items:center;border:1px solid transparent;border-radius:4px;outline:none;cursor:pointer;padding:0 7px}._uXEWV{font-size:14px;color:#515559;justify-self:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}._aUiXm{width:100%;height:36px;display:flex;align-items:center;border:1px solid transparent;border-radius:4px;outline:none;cursor:pointer;padding:0 5px}._xwFQK{fill:#515559}._KdT8p{font-size:14px;color:#515559;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:5px}body.keyboard-user ._aUiXm:active:focus,body.keyboard-user ._aUiXm:focus,body.keyboard-user ._s8gvY:active:focus,body.keyboard-user ._s8gvY:focus,body.keyboard-user ._xRLFf:active:focus,body.keyboard-user ._xRLFf:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}body.keyboard-user ._5xdQX:focus{border-color:#0a3f88}body.keyboard-user ._5xdQX:active>span{background-color:#0854a1;border-color:#0854a1}body.keyboard-user ._5xdQX:active>span>svg{fill:#fff}body.keyboard-user ._D5Yhq:focus{opacity:1}";
|
|
4
|
+
var styles = {"toolbar":"_zuBJ7","toolbarNav":"_VtUL4","toolbarNavCollapsed":"_aTCz7","toolbarTabs":"_jje8M","toolbarTab":"_FIGzL","selected":"_klxKU","toolbarTabIconButton":"_ZazGv","icon":"_gEpRy","tabsExpandCollapseButton":"_fGTFN","toolbarPanels":"_RgTaN","toolbarPanelExpandCollapseButtonDefaultHidden":"_D5Yhq","toolbarPanelsCollapsed":"_ljIRE","toolbarPanel":"_s8gvY","toolbarPanelExpandCollapseButton":"_5xdQX","toolbarPanelExpandCollapseButtonDefaultShown":"_c4jtR","overrideShow":"_qDhfG","overrideHide":"_Tw4FZ","notSelected":"_1EFws","buttonWithLabel":"_xRLFf","buttonWithLabelLabel":"_uXEWV","iconButtonWithLabel":"_aUiXm","iconButtonWithLabelIcon":"_xwFQK","iconButtonWithLabelLabel":"_KdT8p"};
|
|
5
|
+
var stylesheet="._VtUL4,._zuBJ7{display:flex}._VtUL4{flex-direction:column;align-items:center;min-width:165px;max-width:240px;padding:12px 16px 16px;border-right:1px solid #898989;background-color:#fff}._aTCz7{width:69px;min-width:auto;max-width:none}._jje8M{width:100%}._FIGzL{margin-bottom:12px;background-color:transparent!important}._FIGzL:hover{background-color:rgba(11,110,208,.08)!important}._FIGzL:hover>svg{fill:#085caf}._FIGzL:hover>span{color:#085caf}._FIGzL:active{background-color:rgba(11,110,208,.12)!important}._FIGzL:active>svg{fill:#0854a1}._FIGzL:active>span{color:#0854a1}._FIGzL._klxKU{background-color:rgba(11,110,208,.08)!important}._FIGzL._klxKU>svg{fill:#0b6ed0}._FIGzL._klxKU>span{color:#0b6ed0;font-family:\"72Duplex\",\"72\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;font-weight:500}._FIGzL._klxKU:hover{background-color:rgba(11,110,208,.08)!important}._FIGzL._klxKU:hover>svg{fill:#085caf}._FIGzL._klxKU:hover>span{color:#085caf}._FIGzL._klxKU:active{background-color:rgba(11,110,208,.12)!important}._FIGzL._klxKU:active>svg{fill:#0854a1}._FIGzL._klxKU:active>span{color:#0854a1}._ZazGv{border-radius:6px}._ZazGv>._gEpRy{display:block;fill:#515559}._fGTFN{margin-top:auto;margin-bottom:0}._RgTaN{position:relative;width:295px;background-color:#fff;padding:2px 1px 2px 2px;border-right:1px solid #898989}._RgTaN:hover>._D5Yhq{opacity:1}._ljIRE{width:0;border-width:0;padding:0}._s8gvY{border-radius:4px;min-width:100%;min-height:100%;outline:none}._5xdQX{width:36px;height:36px;position:absolute;top:48px;right:-18px;display:flex;justify-content:center;align-items:center;padding:0;background-color:transparent;border:2px solid transparent;border-radius:6px;outline:none;cursor:pointer;z-index:10}._D5Yhq{opacity:0}._5xdQX._qDhfG._qDhfG,._c4jtR,._D5Yhq:hover{opacity:1}._5xdQX._Tw4FZ._Tw4FZ{opacity:0}._5xdQX>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._5xdQX>span:hover{background-color:#0b6ed0;border-color:#0b6ed0}._5xdQX>span:hover>svg{fill:#fff}._5xdQX>span:active{background-color:#0854a1;border-color:#0854a1}._5xdQX>span:active>svg{fill:#fff}._5xdQX>span>svg{fill:#515559;border-radius:50%}._s8gvY._1EFws{display:none!important}._xRLFf{width:100%;height:36px;display:flex;align-items:center;border:1px solid transparent;border-radius:4px;outline:none;cursor:pointer;padding:0 7px}._uXEWV{font-size:14px;color:#515559;justify-self:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}._aUiXm{width:100%;height:36px;display:flex;align-items:center;border:1px solid transparent;border-radius:4px;outline:none;cursor:pointer;padding:0 5px}._xwFQK{fill:#515559}._KdT8p{font-size:14px;color:#515559;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:5px}body.keyboard-user ._aUiXm:active:focus,body.keyboard-user ._aUiXm:focus,body.keyboard-user ._s8gvY:active:focus,body.keyboard-user ._s8gvY:focus,body.keyboard-user ._xRLFf:active:focus,body.keyboard-user ._xRLFf:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}body.keyboard-user ._5xdQX:focus{border-color:#0a3f88}body.keyboard-user ._5xdQX:active>span{background-color:#0854a1;border-color:#0854a1}body.keyboard-user ._5xdQX:active>span>svg{fill:#fff}body.keyboard-user ._D5Yhq:focus{opacity:1}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -37,9 +37,9 @@ const ToolbarPanel = _ref => {
|
|
|
37
37
|
[styles.notSelected]: !isSelected
|
|
38
38
|
}),
|
|
39
39
|
tabIndex: isFocusable && isContainerInTabOrder ? 0 : -1,
|
|
40
|
-
"aria-labelledby": ariaLabelledby ||
|
|
41
|
-
id: id ||
|
|
42
|
-
"data-testid": dataTestId || getSubDataTestId(rootDataTestId,
|
|
40
|
+
"aria-labelledby": ariaLabelledby || `toolbar-${toolbarId}-tab-${index}`,
|
|
41
|
+
id: id || `toolbar-${toolbarId}-panel-${index}`,
|
|
42
|
+
"data-testid": dataTestId || getSubDataTestId(rootDataTestId, `panel-${index}`)
|
|
43
43
|
}), isFocusable ? children : null);
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -33,13 +33,11 @@ const ExpandCollapseButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
33
33
|
const hidePanelLabel = translate('hidePanel');
|
|
34
34
|
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
35
35
|
const [isHiddenByEscape, setIsHiddenByEscape] = useState(false);
|
|
36
|
-
|
|
37
36
|
const handleKeyDown = event => {
|
|
38
37
|
if (event.key === 'Escape' && !isCollapsed) {
|
|
39
38
|
setIsHiddenByEscape(true);
|
|
40
39
|
}
|
|
41
40
|
};
|
|
42
|
-
|
|
43
41
|
useEffect(() => {
|
|
44
42
|
setIsHiddenByEscape(false);
|
|
45
43
|
}, [isContainerHovered]);
|
|
@@ -71,7 +69,6 @@ const ExpandCollapseButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
71
69
|
"aria-hidden": "true"
|
|
72
70
|
}))));
|
|
73
71
|
});
|
|
74
|
-
|
|
75
72
|
/**
|
|
76
73
|
* @deprecated Instead, use:
|
|
77
74
|
* ```
|
|
@@ -79,8 +76,6 @@ const ExpandCollapseButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
79
76
|
* ```
|
|
80
77
|
*/
|
|
81
78
|
const ToolbarPanels = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
82
|
-
var _props$id, _React$Children$toArr, _React$Children$toArr2, _React$Children$toArr3;
|
|
83
|
-
|
|
84
79
|
let {
|
|
85
80
|
isCollapsible = true,
|
|
86
81
|
defaultIsCollapsed = false,
|
|
@@ -108,9 +103,7 @@ const ToolbarPanels = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
108
103
|
* Since the button is re-rendered, if there is keyboard focus, we need to programmatically re-focus the button because React doesn't know that it's the same button.
|
|
109
104
|
*/
|
|
110
105
|
if (isExpandCollapseButtonKeyboardFocused) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
(_expandCollapseButton = expandCollapseButtonRef.current) === null || _expandCollapseButton === void 0 ? void 0 : _expandCollapseButton.focus();
|
|
106
|
+
expandCollapseButtonRef.current?.focus();
|
|
114
107
|
}
|
|
115
108
|
}, [isCollapsed, isExpandCollapseButtonKeyboardFocused]);
|
|
116
109
|
useEffect(() => {
|
|
@@ -120,33 +113,26 @@ const ToolbarPanels = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
120
113
|
* This allows a screen reader user to click the expand/collapse button using their keyboard and have focus stay on the same button.
|
|
121
114
|
*/
|
|
122
115
|
if (wasExpandCollapseButtonClicked) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
(_expandCollapseButton2 = expandCollapseButtonRef.current) === null || _expandCollapseButton2 === void 0 ? void 0 : _expandCollapseButton2.focus();
|
|
116
|
+
expandCollapseButtonRef.current?.focus();
|
|
126
117
|
setWasExpandCollapseButtonClicked(false);
|
|
127
118
|
}
|
|
128
119
|
}, [wasExpandCollapseButtonClicked]);
|
|
129
|
-
|
|
130
120
|
const onExpandCollapseButtonMouseDown = () => {
|
|
131
121
|
setIsExpandCollapseButtonKeyboardFocused(false);
|
|
132
122
|
};
|
|
133
|
-
|
|
134
123
|
const onExpandCollapseButtonClick = () => {
|
|
135
124
|
setIsCollapsed(currentIsCollapsed => !currentIsCollapsed);
|
|
136
125
|
setWasExpandCollapseButtonClicked(true);
|
|
137
126
|
};
|
|
138
|
-
|
|
139
127
|
const onExpandCollapseButtonFocus = () => {
|
|
140
128
|
if (getIsKeyboardUser()) {
|
|
141
129
|
setIsExpandCollapseButtonKeyboardFocused(true);
|
|
142
130
|
}
|
|
143
131
|
};
|
|
144
|
-
|
|
145
132
|
const onExpandCollapseButtonBlur = () => {
|
|
146
133
|
setIsExpandCollapseButtonKeyboardFocused(false);
|
|
147
134
|
};
|
|
148
|
-
|
|
149
|
-
const selectedTabPanelId = (_props$id = (_React$Children$toArr = React__default.Children.toArray(children)) === null || _React$Children$toArr === void 0 ? void 0 : (_React$Children$toArr2 = _React$Children$toArr[Number(selectedIndex)]) === null || _React$Children$toArr2 === void 0 ? void 0 : (_React$Children$toArr3 = _React$Children$toArr2.props) === null || _React$Children$toArr3 === void 0 ? void 0 : _React$Children$toArr3.id) !== null && _props$id !== void 0 ? _props$id : "toolbar-".concat(toolbarId, "-panel-").concat(selectedIndex);
|
|
135
|
+
const selectedTabPanelId = React__default.Children.toArray(children)?.[Number(selectedIndex)]?.props?.id ?? `toolbar-${toolbarId}-panel-${selectedIndex}`;
|
|
150
136
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
151
137
|
ref: mergeRefs(ref, isToolbarPanelsContainerHoveredRef),
|
|
152
138
|
className: classNames(className, styles.toolbarPanels, {
|
|
@@ -12,9 +12,7 @@ import IconButton from '../IconButton/IconButton.js';
|
|
|
12
12
|
import ExcludeIcon from '../../icons/components/ExcludeIcon.js';
|
|
13
13
|
|
|
14
14
|
const getPrevIndex = (currentIndex, numItems) => (currentIndex - 1 + numItems) % numItems;
|
|
15
|
-
|
|
16
15
|
const getNextIndex = (currentIndex, numItems) => (currentIndex + 1) % numItems;
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
* @deprecated Instead, use:
|
|
20
18
|
* ```
|
|
@@ -44,11 +42,9 @@ const ToolbarTab = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
44
42
|
} = useToolbarContext();
|
|
45
43
|
const isFocused = focusedIndex === index;
|
|
46
44
|
const isSelected = selectedIndex === index;
|
|
47
|
-
|
|
48
45
|
const handleSelect = () => {
|
|
49
|
-
setSelectedIndex
|
|
46
|
+
setSelectedIndex?.(Number(index));
|
|
50
47
|
};
|
|
51
|
-
|
|
52
48
|
const handleClick = e => {
|
|
53
49
|
/*
|
|
54
50
|
* In some browsers, clicking on a button does not focus the button.
|
|
@@ -58,56 +54,46 @@ const ToolbarTab = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
58
54
|
e.currentTarget.focus();
|
|
59
55
|
handleSelect();
|
|
60
56
|
};
|
|
61
|
-
|
|
62
57
|
const handleKeyDown = e => {
|
|
63
58
|
switch (e.key) {
|
|
64
59
|
case 'Enter':
|
|
65
60
|
handleSelect();
|
|
66
61
|
break;
|
|
67
|
-
|
|
68
62
|
case 'ArrowDown':
|
|
69
63
|
case 'ArrowRight':
|
|
70
64
|
e.preventDefault(); // Prevent page scroll
|
|
71
|
-
|
|
72
|
-
focusTab === null || focusTab === void 0 ? void 0 : focusTab(getNextIndex(focusedIndex, numTabs));
|
|
65
|
+
focusTab?.(getNextIndex(focusedIndex, numTabs));
|
|
73
66
|
break;
|
|
74
|
-
|
|
75
67
|
case 'ArrowUp':
|
|
76
68
|
case 'ArrowLeft':
|
|
77
69
|
e.preventDefault(); // Prevent page scroll
|
|
78
|
-
|
|
79
|
-
focusTab === null || focusTab === void 0 ? void 0 : focusTab(getPrevIndex(focusedIndex, numTabs));
|
|
70
|
+
focusTab?.(getPrevIndex(focusedIndex, numTabs));
|
|
80
71
|
break;
|
|
81
|
-
|
|
82
72
|
case 'PageUp':
|
|
83
73
|
case 'Home':
|
|
84
74
|
e.preventDefault(); // Prevent page scroll
|
|
85
|
-
|
|
86
|
-
focusTab === null || focusTab === void 0 ? void 0 : focusTab(0);
|
|
75
|
+
focusTab?.(0);
|
|
87
76
|
break;
|
|
88
|
-
|
|
89
77
|
case 'PageDown':
|
|
90
78
|
case 'End':
|
|
91
79
|
e.preventDefault(); // Prevent page scroll
|
|
92
|
-
|
|
93
|
-
focusTab === null || focusTab === void 0 ? void 0 : focusTab(Number(numTabs) - 1);
|
|
80
|
+
focusTab?.(Number(numTabs) - 1);
|
|
94
81
|
break;
|
|
95
|
-
|
|
96
82
|
default:
|
|
97
83
|
}
|
|
98
84
|
};
|
|
99
|
-
|
|
100
|
-
|
|
85
|
+
const commonProps = {
|
|
86
|
+
...rest,
|
|
101
87
|
ref,
|
|
102
88
|
role: 'tab',
|
|
103
89
|
'aria-selected': isSelected,
|
|
104
|
-
'aria-controls': ariaControls ||
|
|
105
|
-
id: id ||
|
|
90
|
+
'aria-controls': ariaControls || `toolbar-${toolbarId}-panel-${index}`,
|
|
91
|
+
id: id || `toolbar-${toolbarId}-tab-${index}`,
|
|
106
92
|
// Exsures the correct tab is focused when tabbing into the Toolbar
|
|
107
93
|
tabIndex: isFocused ? 0 : -1,
|
|
108
94
|
onClick: handleClick,
|
|
109
95
|
onKeyDown: handleKeyDown,
|
|
110
|
-
'data-testid': dataTestId || getSubDataTestId(rootDataTestId,
|
|
96
|
+
'data-testid': dataTestId || getSubDataTestId(rootDataTestId, `tab-${index}`)
|
|
111
97
|
};
|
|
112
98
|
const iconButtonClassName = classNames(className, styles.toolbarTab, styles.toolbarTabIconButton, {
|
|
113
99
|
[styles.selected]: isSelected
|
|
@@ -122,7 +108,6 @@ const ToolbarTab = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
122
108
|
[styles.selected]: isSelected
|
|
123
109
|
});
|
|
124
110
|
let tabComponent;
|
|
125
|
-
|
|
126
111
|
if (isCollapsed) {
|
|
127
112
|
tabComponent = /*#__PURE__*/React__default.createElement(IconButton, _extends({}, commonProps, {
|
|
128
113
|
className: iconButtonClassName,
|
|
@@ -150,7 +135,6 @@ const ToolbarTab = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
150
135
|
className: styles.buttonWithLabelLabel
|
|
151
136
|
}, label));
|
|
152
137
|
}
|
|
153
|
-
|
|
154
138
|
return tabComponent;
|
|
155
139
|
});
|
|
156
140
|
|
|
@@ -43,21 +43,17 @@ const ToolbarTabs = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
43
43
|
const collapseToolbarTabsIconButtonWithLabelRef = useRef(null);
|
|
44
44
|
const [isExpandCollapseButtonFocused, setIsExpandCollapseButtonFocused] = useState(false);
|
|
45
45
|
const [isCollapsed, setIsCollapsed] = useControllableState(isCollapsible && defaultIsCollapsed, isCollapsible ? onIsCollapsedChange : undefined, isCollapsible && externalIsCollapsed);
|
|
46
|
+
|
|
46
47
|
/*
|
|
47
48
|
* Focuses the new expand/collapse button when the tabs expand/collapse and the old expand/collapse button was focused.
|
|
48
49
|
* When the tabs expand/collapse, a different expand/collapse button is rendered, which is why the programmatic focus is needed.
|
|
49
50
|
*/
|
|
50
|
-
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
if (isExpandCollapseButtonFocused) {
|
|
53
53
|
if (isCollapsed) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(_expandToolbarTabsIco = expandToolbarTabsIconButtonRef.current) === null || _expandToolbarTabsIco === void 0 ? void 0 : _expandToolbarTabsIco.focus();
|
|
54
|
+
expandToolbarTabsIconButtonRef.current?.focus();
|
|
57
55
|
} else {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(_collapseToolbarTabsI = collapseToolbarTabsIconButtonWithLabelRef.current) === null || _collapseToolbarTabsI === void 0 ? void 0 : _collapseToolbarTabsI.focus();
|
|
56
|
+
collapseToolbarTabsIconButtonWithLabelRef.current?.focus();
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
}, [isCollapsed, isExpandCollapseButtonFocused]);
|
|
@@ -69,26 +65,20 @@ const ToolbarTabs = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
69
65
|
} = useToolbarContext();
|
|
70
66
|
const [focusedIndex, setFocusedIndex] = useState(selectedIndex);
|
|
71
67
|
const numTabs = React__default.Children.count(children);
|
|
72
|
-
|
|
73
68
|
const focusTab = index => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
(_tabRefs$current = tabRefs.current) === null || _tabRefs$current === void 0 ? void 0 : (_tabRefs$current$inde = _tabRefs$current[index]) === null || _tabRefs$current$inde === void 0 ? void 0 : _tabRefs$current$inde.focus();
|
|
69
|
+
tabRefs.current?.[index]?.focus();
|
|
77
70
|
setFocusedIndex(index);
|
|
78
71
|
};
|
|
72
|
+
|
|
79
73
|
/*
|
|
80
74
|
* Sets the focused index back to the currently selected tab.
|
|
81
75
|
* This makes sure that when the user tabs back into the tablist, the focus is set on the currently selected tab.
|
|
82
76
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
77
|
const handleTabListBlur = () => {
|
|
86
78
|
setFocusedIndex(selectedIndex);
|
|
87
79
|
};
|
|
88
|
-
|
|
89
80
|
let expandCollapseButton;
|
|
90
81
|
const expandCollapseButtonDataTestIdSuffix = 'tabs-expand-collapse-button';
|
|
91
|
-
|
|
92
82
|
if (isCollapsible) {
|
|
93
83
|
if (isCollapsed) {
|
|
94
84
|
const expandToolbarTabsLabel = translate('showLabels');
|
|
@@ -116,14 +106,12 @@ const ToolbarTabs = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
116
106
|
onFocus: () => setIsExpandCollapseButtonFocused(true),
|
|
117
107
|
onBlur: () => setIsExpandCollapseButtonFocused(false),
|
|
118
108
|
ref: collapseToolbarTabsIconButtonWithLabelRef
|
|
119
|
-
/* eslint-disable-next-line react/jsx-boolean-value
|
|
120
|
-
,
|
|
109
|
+
/* eslint-disable-next-line react/jsx-boolean-value */,
|
|
121
110
|
"aria-pressed": true,
|
|
122
111
|
"data-testid": getSubDataTestId(rootDataTestId, expandCollapseButtonDataTestIdSuffix)
|
|
123
112
|
});
|
|
124
113
|
}
|
|
125
114
|
}
|
|
126
|
-
|
|
127
115
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
128
116
|
className: classNames(className, styles.toolbarNav, {
|
|
129
117
|
[styles.toolbarNavCollapsed]: isCollapsed
|
|
@@ -6,9 +6,8 @@ import { getMediaQueryValue, subscribe } from '../../utils/mediaQueryManager/med
|
|
|
6
6
|
import useLatest from '../useLatest/useLatest.js';
|
|
7
7
|
|
|
8
8
|
function getMinWidthQuery(length, unit) {
|
|
9
|
-
return
|
|
9
|
+
return `(min-width: ${length}${unit})`;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
function getInitialValues(breakpointsConfig, unit) {
|
|
13
12
|
const initialValues = {};
|
|
14
13
|
Object.entries(breakpointsConfig).forEach(_ref => {
|
|
@@ -18,7 +17,6 @@ function getInitialValues(breakpointsConfig, unit) {
|
|
|
18
17
|
});
|
|
19
18
|
return initialValues;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
function useBreakpoints() {
|
|
23
21
|
let breakpoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BREAKPOINTS;
|
|
24
22
|
let unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'em';
|
|
@@ -31,7 +29,8 @@ function useBreakpoints() {
|
|
|
31
29
|
let [breakpointName, breakpointValue] = _ref2;
|
|
32
30
|
const query = getMinWidthQuery(breakpointValue, unitRef.current);
|
|
33
31
|
const unsubscribe = subscribe(query, event => {
|
|
34
|
-
setMatches(prevValue => ({
|
|
32
|
+
setMatches(prevValue => ({
|
|
33
|
+
...prevValue,
|
|
35
34
|
[breakpointName]: event.matches
|
|
36
35
|
}));
|
|
37
36
|
});
|
|
@@ -3,30 +3,25 @@ import '../useEventListener/index.js';
|
|
|
3
3
|
import useEventListener from '../useEventListener/useEventListener.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable babel/no-unused-expressions */
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Listens for a `mousedown` or `touchstart` event that exists outside of the given ref element(s).
|
|
8
9
|
* @param refs - The ref elements to ignore events on.
|
|
9
10
|
* @param onClickOutside - An observer that is called when an outside click or touch occurs.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
function useClickOutside(refs, onClickOutside) {
|
|
13
13
|
const allRefs = useMemo(() => Array.isArray(refs) ? refs : [refs], [refs]);
|
|
14
|
-
|
|
15
14
|
const handler = event => {
|
|
16
15
|
const isInside = allRefs.some(ref => {
|
|
17
|
-
var _el$contains;
|
|
18
|
-
|
|
19
16
|
const {
|
|
20
17
|
current: el
|
|
21
18
|
} = ref;
|
|
22
|
-
return el
|
|
19
|
+
return el?.contains?.(event.target);
|
|
23
20
|
});
|
|
24
|
-
|
|
25
21
|
if (!isInside) {
|
|
26
22
|
onClickOutside(event);
|
|
27
23
|
}
|
|
28
24
|
};
|
|
29
|
-
|
|
30
25
|
useEventListener(document, 'mousedown', handler);
|
|
31
26
|
useEventListener(document, 'touchstart', handler);
|
|
32
27
|
}
|
|
@@ -3,28 +3,25 @@ import '../useEventListener/index.js';
|
|
|
3
3
|
import useEventListener from '../useEventListener/useEventListener.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable consistent-return */
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Listens for `click` event. The returned function is used to ignore the given `click` event.
|
|
8
9
|
* @param onClickOutside - An observer that is called when an outside click occurs.
|
|
9
10
|
* @param options.disabled - Indicates if the hook is disabled (i.e. won't call the observer)
|
|
10
11
|
* @returns A function that, when called, ignores the current outside click if one exists.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
13
|
function useClickOutsidePortals(onClickOutside) {
|
|
14
14
|
let {
|
|
15
15
|
disabled = false
|
|
16
16
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
17
17
|
const wasClickedInside = useRef(false);
|
|
18
|
-
|
|
19
18
|
const handleClick = e => {
|
|
20
19
|
if (!wasClickedInside.current) {
|
|
21
20
|
onClickOutside(e);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
}
|
|
22
|
+
// should reset clicked state after each click
|
|
25
23
|
wasClickedInside.current = false;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
25
|
useEventListener(document, 'mouseup', handleClick, {
|
|
29
26
|
isDisabled: disabled
|
|
30
27
|
});
|
|
@@ -5,6 +5,7 @@ import useLatest from '../useLatest/useLatest.js';
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
6
6
|
const BECAME_CONTROLLED_WARNING = 'WARNING: A component is changing from being uncontrolled to controlled. Components should not switch from being uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled component for the lifetime of the component. More info: https://fb.me/react-controlled-components';
|
|
7
7
|
const BECAME_UNCONTROLLED_WARNING = 'WARNING: A component is changing from being controlled to uncontrolled. Components should not switch from being controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled component for the lifetime of the component. More info: https://fb.me/react-controlled-components';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* An abstraction on top of useState that allows for state to either be controlled internally or externally.
|
|
10
11
|
* @param initialState - The state to begin with.
|
|
@@ -12,24 +13,24 @@ const BECAME_UNCONTROLLED_WARNING = 'WARNING: A component is changing from being
|
|
|
12
13
|
* @param externalState - State used to override the internal state.
|
|
13
14
|
* @returns An array where the first item is the current state and the second item is the state updater.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
16
|
function useControllableState(initialState, onChange, externalState) {
|
|
17
17
|
const [state, replaceState] = useState(initialState);
|
|
18
18
|
const onChangeRef = useLatest(onChange);
|
|
19
19
|
const externalStateRef = useLatest(externalState);
|
|
20
20
|
const internalStateRef = useLatest(state);
|
|
21
21
|
useControlledTransitionWarning(externalState);
|
|
22
|
+
|
|
22
23
|
/**
|
|
23
24
|
* The following useEffect is necessary in order to make transitions
|
|
24
25
|
* from using external state, to using internal state seamless and
|
|
25
26
|
* follows the behavior of React's native controllable input component
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (externalState !== undefined) {
|
|
30
30
|
replaceState(externalState);
|
|
31
31
|
}
|
|
32
32
|
}, [externalState]);
|
|
33
|
+
|
|
33
34
|
/**
|
|
34
35
|
* TODO: replace the effect above with this effect
|
|
35
36
|
*
|
|
@@ -49,30 +50,24 @@ function useControllableState(initialState, onChange, externalState) {
|
|
|
49
50
|
const setState = useCallback(function (input) {
|
|
50
51
|
const currentState = externalStateRef.current !== undefined ? externalStateRef.current : internalStateRef.current;
|
|
51
52
|
const nextState = typeof input === 'function' ? input(currentState) : input;
|
|
52
|
-
|
|
53
53
|
if (externalStateRef.current === undefined) {
|
|
54
54
|
replaceState(nextState);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
56
|
if (nextState !== currentState) {
|
|
58
|
-
var _onChangeRef$current;
|
|
59
|
-
|
|
60
57
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
61
58
|
args[_key - 1] = arguments[_key];
|
|
62
59
|
}
|
|
63
|
-
|
|
64
|
-
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, nextState, ...args);
|
|
60
|
+
onChangeRef.current?.(nextState, ...args);
|
|
65
61
|
}
|
|
66
62
|
}, [onChangeRef, externalStateRef, internalStateRef]);
|
|
67
63
|
const actualState = externalState === undefined ? state : externalState;
|
|
68
64
|
return [actualState, setState];
|
|
69
65
|
}
|
|
66
|
+
|
|
70
67
|
/**
|
|
71
68
|
* Logs a warning if the state switches from controlled to uncontrolled (or vice versa)
|
|
72
69
|
* @param externalState - The state being controlled externally.
|
|
73
70
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
71
|
function useControlledTransitionWarning(externalState) {
|
|
77
72
|
const isControlled = externalState !== undefined;
|
|
78
73
|
const isControlledRef = useRef(isControlled);
|
|
@@ -9,24 +9,22 @@ const useDidUpdateBase = (useEffectFunction, func, deps) => {
|
|
|
9
9
|
isFirstRenderRef.current = false;
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
return func();
|
|
14
13
|
}, deps);
|
|
15
14
|
};
|
|
15
|
+
|
|
16
16
|
/**
|
|
17
17
|
* Wrapper around useEffect that runs on dependency updates only, not on initial render.
|
|
18
18
|
* @param func - The effect function to run when dependencies have been updated.
|
|
19
19
|
* @param deps - The list of dependencies to watch for changes.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
21
|
const useDidUpdate = (func, deps) => useDidUpdateBase(useEffect, func, deps);
|
|
22
|
+
|
|
24
23
|
/**
|
|
25
24
|
* Wrapper around useSSRLayoutEffect that runs on dependency updates only, not on initial render.
|
|
26
25
|
* @param func - The effect function to run when dependencies have been updated.
|
|
27
26
|
* @param deps - The list of dependencies to watch for changes.
|
|
28
27
|
*/
|
|
29
|
-
|
|
30
28
|
const useEnhancedDidUpdate = (func, deps) => useDidUpdateBase(useSSRLayoutEffect, func, deps);
|
|
31
29
|
|
|
32
30
|
export { useDidUpdate, useEnhancedDidUpdate };
|
|
@@ -13,7 +13,8 @@ function useEventCallback(fn) {
|
|
|
13
13
|
useSSRLayoutEffect(() => {
|
|
14
14
|
fnRef.current = fn;
|
|
15
15
|
});
|
|
16
|
-
return useCallback(event =>
|
|
16
|
+
return useCallback(event =>
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
18
|
// @ts-ignore: Left side of comma operator is unused and has no side effects. See https://stackoverflow.com/questions/11541134/javascript-syntax-0-fnargs
|
|
18
19
|
(0, fnRef.current)(event), []);
|
|
19
20
|
}
|