@itwin/itwinui-react 3.0.0-dev.1 → 3.0.0-dev.3
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 +25 -0
- package/cjs/core/Alert/Alert.d.ts +47 -28
- package/cjs/core/Alert/Alert.js +73 -21
- package/cjs/core/Avatar/Avatar.js +1 -1
- package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -4
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -5
- package/cjs/core/Carousel/Carousel.d.ts +2 -2
- package/cjs/core/Carousel/Carousel.js +3 -5
- package/cjs/core/Carousel/CarouselDotsList.js +8 -10
- package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/cjs/core/Carousel/CarouselNavigation.js +3 -5
- package/cjs/core/Carousel/CarouselSlider.js +10 -15
- package/cjs/core/ColorPicker/ColorBuilder.js +7 -10
- package/cjs/core/ColorPicker/ColorInputPanel.js +12 -15
- package/cjs/core/ColorPicker/ColorPalette.js +4 -6
- package/cjs/core/ColorPicker/ColorPicker.js +3 -3
- package/cjs/core/ComboBox/ComboBox.js +25 -32
- package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
- package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/cjs/core/ComboBox/helpers.js +4 -5
- package/cjs/core/DatePicker/DatePicker.js +32 -32
- package/cjs/core/Dialog/Dialog.js +11 -4
- package/cjs/core/Dialog/DialogBackdrop.js +1 -1
- package/cjs/core/Dialog/DialogContext.d.ts +11 -0
- package/cjs/core/Dialog/DialogMain.js +16 -22
- package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
- package/cjs/core/FileUpload/FileUpload.d.ts +3 -4
- package/cjs/core/FileUpload/FileUpload.js +5 -8
- package/cjs/core/FileUpload/FileUploadCard.js +9 -10
- package/cjs/core/FileUpload/FileUploadTemplate.d.ts +1 -0
- package/cjs/core/FileUpload/FileUploadTemplate.js +1 -0
- package/cjs/core/InformationPanel/InformationPanel.js +1 -4
- package/cjs/core/LabeledInput/LabeledInput.js +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/cjs/core/Menu/Menu.js +3 -4
- package/cjs/core/Menu/MenuItem.js +8 -11
- package/cjs/core/Modal/Modal.d.ts +8 -9
- package/cjs/core/Modal/Modal.js +7 -17
- package/cjs/core/SearchBox/SearchBox.js +12 -12
- package/cjs/core/Select/Select.js +12 -17
- package/cjs/core/SideNavigation/SideNavigation.js +2 -2
- package/cjs/core/Slider/Slider.js +16 -19
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/StatusMessage/StatusMessage.js +1 -1
- package/cjs/core/Stepper/Stepper.js +1 -1
- package/cjs/core/Stepper/StepperStep.js +1 -1
- package/cjs/core/Table/Table.js +15 -15
- package/cjs/core/Table/TablePaginator.js +2 -3
- package/cjs/core/Table/TableRowMemoized.js +38 -45
- package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
- package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
- package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
- package/cjs/core/Table/cells/DefaultCell.js +1 -1
- package/cjs/core/Table/cells/EditableCell.js +6 -12
- package/cjs/core/Table/columns/actionColumn.js +3 -6
- package/cjs/core/Table/columns/expanderColumn.js +3 -3
- package/cjs/core/Table/columns/selectionColumn.js +4 -4
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -2
- package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
- package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
- package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
- package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/cjs/core/Tabs/Tabs.js +13 -16
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +14 -13
- package/cjs/core/Tile/Tile.js +2 -3
- package/cjs/core/TimePicker/TimePicker.js +13 -13
- package/cjs/core/Toast/Toast.d.ts +5 -10
- package/cjs/core/Toast/Toast.js +17 -16
- package/cjs/core/Toast/Toaster.d.ts +24 -26
- package/cjs/core/Toast/Toaster.js +91 -121
- package/cjs/core/Toast/index.d.ts +1 -4
- package/cjs/core/Toast/index.js +3 -6
- package/cjs/core/TransferList/TransferList.js +3 -4
- package/cjs/core/Tree/Tree.js +9 -13
- package/cjs/core/Tree/TreeNode.js +9 -10
- package/cjs/core/index.d.ts +1 -2
- package/cjs/core/index.js +2 -5
- package/cjs/core/utils/color/ColorValue.js +9 -15
- package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/cjs/core/utils/components/FocusTrap.js +4 -4
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
- package/cjs/core/utils/components/Popover.d.ts +1 -1
- package/cjs/core/utils/components/Popover.js +5 -8
- package/cjs/core/utils/components/Resizer.js +7 -6
- package/cjs/core/utils/components/VirtualScroll.js +14 -21
- package/cjs/core/utils/functions/dom.d.ts +0 -8
- package/cjs/core/utils/functions/dom.js +3 -26
- package/cjs/core/utils/functions/polymorphic.d.ts +1 -1
- package/cjs/core/utils/functions/polymorphic.js +1 -1
- package/cjs/core/utils/functions/supports.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +0 -1
- package/cjs/core/utils/hooks/index.js +0 -1
- package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
- package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
- package/cjs/core/utils/hooks/useEventListener.js +1 -1
- package/cjs/core/utils/hooks/useGlobals.d.ts +9 -2
- package/cjs/core/utils/hooks/useGlobals.js +6 -4
- package/cjs/core/utils/hooks/useId.js +1 -2
- package/cjs/core/utils/hooks/useIntersection.js +2 -3
- package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
- package/cjs/core/utils/hooks/useOverflow.js +1 -2
- package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
- package/cjs/styles.js +1 -4
- package/esm/core/Alert/Alert.d.ts +47 -28
- package/esm/core/Alert/Alert.js +74 -22
- package/esm/core/Avatar/Avatar.js +1 -1
- package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -4
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -5
- package/esm/core/Carousel/Carousel.d.ts +2 -2
- package/esm/core/Carousel/Carousel.js +3 -5
- package/esm/core/Carousel/CarouselDotsList.js +8 -10
- package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/esm/core/Carousel/CarouselNavigation.js +3 -5
- package/esm/core/Carousel/CarouselSlider.js +10 -15
- package/esm/core/ColorPicker/ColorBuilder.js +7 -10
- package/esm/core/ColorPicker/ColorInputPanel.js +12 -15
- package/esm/core/ColorPicker/ColorPalette.js +4 -6
- package/esm/core/ColorPicker/ColorPicker.js +3 -3
- package/esm/core/ComboBox/ComboBox.js +25 -32
- package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/esm/core/ComboBox/ComboBoxInput.js +21 -20
- package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
- package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/esm/core/ComboBox/helpers.js +4 -5
- package/esm/core/DatePicker/DatePicker.js +32 -32
- package/esm/core/Dialog/Dialog.js +12 -5
- package/esm/core/Dialog/DialogBackdrop.js +1 -1
- package/esm/core/Dialog/DialogContext.d.ts +11 -0
- package/esm/core/Dialog/DialogMain.js +16 -22
- package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
- package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/esm/core/FileUpload/FileEmptyCard.js +1 -1
- package/esm/core/FileUpload/FileUpload.d.ts +3 -4
- package/esm/core/FileUpload/FileUpload.js +5 -8
- package/esm/core/FileUpload/FileUploadCard.js +9 -10
- package/esm/core/FileUpload/FileUploadTemplate.d.ts +1 -0
- package/esm/core/FileUpload/FileUploadTemplate.js +1 -0
- package/esm/core/InformationPanel/InformationPanel.js +1 -4
- package/esm/core/LabeledInput/LabeledInput.js +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/esm/core/Menu/Menu.js +3 -4
- package/esm/core/Menu/MenuItem.js +8 -11
- package/esm/core/Modal/Modal.d.ts +8 -9
- package/esm/core/Modal/Modal.js +3 -10
- package/esm/core/SearchBox/SearchBox.js +12 -12
- package/esm/core/Select/Select.js +12 -17
- package/esm/core/SideNavigation/SideNavigation.js +2 -2
- package/esm/core/Slider/Slider.js +16 -19
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/StatusMessage/StatusMessage.js +1 -1
- package/esm/core/Stepper/Stepper.js +1 -1
- package/esm/core/Stepper/StepperStep.js +1 -1
- package/esm/core/Table/Table.js +15 -15
- package/esm/core/Table/TablePaginator.js +2 -3
- package/esm/core/Table/TableRowMemoized.js +38 -45
- package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
- package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
- package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
- package/esm/core/Table/cells/DefaultCell.js +1 -1
- package/esm/core/Table/cells/EditableCell.js +6 -12
- package/esm/core/Table/columns/actionColumn.js +3 -6
- package/esm/core/Table/columns/expanderColumn.js +3 -3
- package/esm/core/Table/columns/selectionColumn.js +4 -4
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
- package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -2
- package/esm/core/Table/hooks/useResizeColumns.js +16 -22
- package/esm/core/Table/hooks/useScrollToRow.js +1 -2
- package/esm/core/Table/hooks/useStickyColumns.js +3 -5
- package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/esm/core/Tabs/Tabs.js +13 -16
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +15 -14
- package/esm/core/Tile/Tile.js +2 -3
- package/esm/core/TimePicker/TimePicker.js +13 -13
- package/esm/core/Toast/Toast.d.ts +5 -10
- package/esm/core/Toast/Toast.js +18 -17
- package/esm/core/Toast/Toaster.d.ts +24 -26
- package/esm/core/Toast/Toaster.js +85 -121
- package/esm/core/Toast/index.d.ts +1 -4
- package/esm/core/Toast/index.js +1 -3
- package/esm/core/TransferList/TransferList.js +3 -4
- package/esm/core/Tree/Tree.js +9 -13
- package/esm/core/Tree/TreeNode.js +9 -10
- package/esm/core/index.d.ts +1 -2
- package/esm/core/index.js +1 -1
- package/esm/core/utils/color/ColorValue.js +9 -15
- package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/esm/core/utils/components/FocusTrap.js +4 -4
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
- package/esm/core/utils/components/Popover.d.ts +1 -1
- package/esm/core/utils/components/Popover.js +5 -8
- package/esm/core/utils/components/Resizer.js +7 -6
- package/esm/core/utils/components/VirtualScroll.js +14 -21
- package/esm/core/utils/functions/dom.d.ts +0 -8
- package/esm/core/utils/functions/dom.js +2 -21
- package/esm/core/utils/functions/polymorphic.d.ts +1 -1
- package/esm/core/utils/functions/polymorphic.js +1 -1
- package/esm/core/utils/functions/supports.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +0 -1
- package/esm/core/utils/hooks/index.js +0 -1
- package/esm/core/utils/hooks/useContainerWidth.js +1 -1
- package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
- package/esm/core/utils/hooks/useEventListener.js +1 -1
- package/esm/core/utils/hooks/useGlobals.d.ts +9 -2
- package/esm/core/utils/hooks/useGlobals.js +6 -4
- package/esm/core/utils/hooks/useId.js +1 -2
- package/esm/core/utils/hooks/useIntersection.js +2 -3
- package/esm/core/utils/hooks/useMediaQuery.js +6 -8
- package/esm/core/utils/hooks/useOverflow.js +1 -2
- package/esm/core/utils/hooks/useResizeObserver.js +3 -4
- package/esm/styles.js +1 -4
- package/package.json +2 -2
- package/styles.css +19 -20
- package/cjs/core/Toast/ToastWrapper.d.ts +0 -10
- package/cjs/core/Toast/ToastWrapper.js +0 -49
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
- package/esm/core/Toast/ToastWrapper.d.ts +0 -10
- package/esm/core/Toast/ToastWrapper.js +0 -20
- package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
|
@@ -46,10 +46,9 @@ exports.MenuItem = React.forwardRef((props, ref) => {
|
|
|
46
46
|
const { ref: parentMenuItemRef } = React.useContext(MenuItemContext);
|
|
47
47
|
const subMenuRef = React.useRef(null);
|
|
48
48
|
const [isSubmenuVisible, setIsSubmenuVisible] = React.useState(false);
|
|
49
|
-
const startIcon = startIconProp
|
|
50
|
-
const endIcon = endIconProp
|
|
49
|
+
const startIcon = startIconProp ?? icon;
|
|
50
|
+
const endIcon = endIconProp ?? badge;
|
|
51
51
|
const onKeyDown = (event) => {
|
|
52
|
-
var _a;
|
|
53
52
|
if (event.altKey) {
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
@@ -57,7 +56,7 @@ exports.MenuItem = React.forwardRef((props, ref) => {
|
|
|
57
56
|
case 'Enter':
|
|
58
57
|
case ' ':
|
|
59
58
|
case 'Spacebar': {
|
|
60
|
-
!disabled &&
|
|
59
|
+
!disabled && onClick?.(value);
|
|
61
60
|
event.preventDefault();
|
|
62
61
|
break;
|
|
63
62
|
}
|
|
@@ -70,7 +69,7 @@ exports.MenuItem = React.forwardRef((props, ref) => {
|
|
|
70
69
|
break;
|
|
71
70
|
}
|
|
72
71
|
case 'ArrowLeft': {
|
|
73
|
-
|
|
72
|
+
parentMenuItemRef?.current?.focus();
|
|
74
73
|
event.stopPropagation();
|
|
75
74
|
event.preventDefault();
|
|
76
75
|
break;
|
|
@@ -79,10 +78,9 @@ exports.MenuItem = React.forwardRef((props, ref) => {
|
|
|
79
78
|
break;
|
|
80
79
|
}
|
|
81
80
|
};
|
|
82
|
-
const listItem = (React.createElement(ListItem_js_1.ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, onClick: () => !disabled &&
|
|
83
|
-
var _a;
|
|
81
|
+
const listItem = (React.createElement(ListItem_js_1.ListItem, { actionable: true, size: size, active: isSelected, disabled: disabled, onClick: () => !disabled && onClick?.(value), ref: refs, role: role, tabIndex: disabled || role === 'presentation' ? undefined : -1, "aria-selected": isSelected, "aria-haspopup": subMenuItems.length > 0, "aria-disabled": disabled, onKeyDown: onKeyDown, onMouseEnter: () => setIsSubmenuVisible(true), onMouseLeave: (e) => {
|
|
84
82
|
if (!(e.relatedTarget instanceof Node) ||
|
|
85
|
-
!
|
|
83
|
+
!subMenuRef.current?.contains(e.relatedTarget)) {
|
|
86
84
|
setIsSubmenuVisible(false);
|
|
87
85
|
}
|
|
88
86
|
}, ...rest },
|
|
@@ -95,10 +93,9 @@ exports.MenuItem = React.forwardRef((props, ref) => {
|
|
|
95
93
|
endIcon && (React.createElement(ListItem_js_1.ListItem.Icon, { as: 'span', "aria-hidden": true }, endIcon))));
|
|
96
94
|
return subMenuItems.length === 0 ? (listItem) : (React.createElement(MenuItemContext.Provider, { value: { ref: menuItemRef } },
|
|
97
95
|
React.createElement(index_js_1.Popover, { placement: 'right-start', visible: isSubmenuVisible, appendTo: 'parent', content: React.createElement("div", { onMouseLeave: () => setIsSubmenuVisible(false), onBlur: (e) => {
|
|
98
|
-
var _a, _b;
|
|
99
96
|
!!(e.relatedTarget instanceof Node) &&
|
|
100
|
-
!
|
|
101
|
-
!
|
|
97
|
+
!subMenuRef.current?.contains(e.relatedTarget) &&
|
|
98
|
+
!subMenuRef.current?.isEqualNode(e.relatedTarget) &&
|
|
102
99
|
setIsSubmenuVisible(false);
|
|
103
100
|
} },
|
|
104
101
|
React.createElement(Menu_js_1.Menu, { ref: subMenuRef }, subMenuItems)) }, listItem)));
|
|
@@ -30,16 +30,15 @@ declare type ModalProps = {
|
|
|
30
30
|
*/
|
|
31
31
|
onKeyDown?: React.KeyboardEventHandler;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* Document where the modal will be rendered.
|
|
39
|
-
* Can be specified to render in a different document (e.g. a popup window).
|
|
40
|
-
* @default document
|
|
33
|
+
* If true, the dialog will be portaled into a <div> inside the nearest `ThemeProvider`.
|
|
34
|
+
*
|
|
35
|
+
* Can be set to an object with a `to` property to portal into a specific element.
|
|
36
|
+
*
|
|
37
|
+
* @default true
|
|
41
38
|
*/
|
|
42
|
-
|
|
39
|
+
portal?: boolean | {
|
|
40
|
+
to: HTMLElement;
|
|
41
|
+
};
|
|
43
42
|
/**
|
|
44
43
|
* Content of the modal.
|
|
45
44
|
*/
|
package/cjs/core/Modal/Modal.js
CHANGED
|
@@ -22,9 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.Modal = void 0;
|
|
30
27
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -32,9 +29,7 @@ exports.Modal = void 0;
|
|
|
32
29
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
33
30
|
*--------------------------------------------------------------------------------------------*/
|
|
34
31
|
const React = __importStar(require("react"));
|
|
35
|
-
const
|
|
36
|
-
const index_js_1 = require("../utils/index.js");
|
|
37
|
-
const index_js_2 = require("../Dialog/index.js");
|
|
32
|
+
const index_js_1 = require("../Dialog/index.js");
|
|
38
33
|
/**
|
|
39
34
|
* Modal component which can wrap any content.
|
|
40
35
|
* @example
|
|
@@ -57,16 +52,11 @@ const index_js_2 = require("../Dialog/index.js");
|
|
|
57
52
|
* </Modal>
|
|
58
53
|
*/
|
|
59
54
|
exports.Modal = React.forwardRef((props, forwardedRef) => {
|
|
60
|
-
const { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return !!container ? (react_dom_1.default.createPortal(React.createElement(index_js_2.Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef },
|
|
67
|
-
React.createElement(index_js_2.Dialog.Backdrop, null),
|
|
68
|
-
React.createElement(index_js_2.Dialog.Main, { "aria-modal": true, ...rest },
|
|
69
|
-
React.createElement(index_js_2.Dialog.TitleBar, { titleText: title }),
|
|
70
|
-
children)), container)) : (React.createElement(React.Fragment, null));
|
|
55
|
+
const { isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = true, onClose, title, children, portal = true, ...rest } = props;
|
|
56
|
+
return (React.createElement(index_js_1.Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true, setFocus: true, ref: forwardedRef, portal: portal },
|
|
57
|
+
React.createElement(index_js_1.Dialog.Backdrop, null),
|
|
58
|
+
React.createElement(index_js_1.Dialog.Main, { "aria-modal": true, ...rest },
|
|
59
|
+
React.createElement(index_js_1.Dialog.TitleBar, { titleText: title }),
|
|
60
|
+
children)));
|
|
71
61
|
});
|
|
72
62
|
exports.default = exports.Modal;
|
|
@@ -43,16 +43,16 @@ const SearchBoxComponent = React.forwardRef((props, ref) => {
|
|
|
43
43
|
const inputRef = React.useRef(null);
|
|
44
44
|
const openButtonRef = React.useRef(null);
|
|
45
45
|
const [localExpanded, setLocalExpanded] = React.useState(isExpandedProp);
|
|
46
|
-
const isExpanded = isExpandedProp
|
|
46
|
+
const isExpanded = isExpandedProp ?? localExpanded;
|
|
47
47
|
const onCollapse = () => {
|
|
48
48
|
setLocalExpanded(false);
|
|
49
|
-
onCollapseProp
|
|
50
|
-
queueMicrotask(() =>
|
|
49
|
+
onCollapseProp?.();
|
|
50
|
+
queueMicrotask(() => openButtonRef.current?.focus({ preventScroll: true }));
|
|
51
51
|
};
|
|
52
52
|
const onExpand = () => {
|
|
53
53
|
setLocalExpanded(true);
|
|
54
|
-
onExpandProp
|
|
55
|
-
queueMicrotask(() =>
|
|
54
|
+
onExpandProp?.();
|
|
55
|
+
queueMicrotask(() => inputRef.current?.focus({ preventScroll: true }));
|
|
56
56
|
};
|
|
57
57
|
return (React.createElement(SearchBoxContext.Provider, { value: {
|
|
58
58
|
size,
|
|
@@ -66,7 +66,7 @@ const SearchBoxComponent = React.forwardRef((props, ref) => {
|
|
|
66
66
|
isExpanded,
|
|
67
67
|
expandable,
|
|
68
68
|
} },
|
|
69
|
-
React.createElement(index_js_1.InputFlexContainer, { ref: ref, className: (0, classnames_1.default)('iui-searchbox', { 'iui-expandable-searchbox': expandable }, className), "data-iui-size": size, isDisabled: isDisabled, "data-iui-expanded": isExpanded, ...rest }, children
|
|
69
|
+
React.createElement(index_js_1.InputFlexContainer, { ref: ref, className: (0, classnames_1.default)('iui-searchbox', { 'iui-expandable-searchbox': expandable }, className), "data-iui-size": size, isDisabled: isDisabled, "data-iui-expanded": isExpanded, ...rest }, children ?? (React.createElement(React.Fragment, null,
|
|
70
70
|
React.createElement(SearchBoxCollapsedState, null,
|
|
71
71
|
React.createElement(SearchBoxExpandButton, null)),
|
|
72
72
|
React.createElement(SearchBoxExpandedState, null,
|
|
@@ -80,7 +80,7 @@ const SearchBoxCollapsedState = ({ children, }) => {
|
|
|
80
80
|
if (!expandable || isExpanded) {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
|
-
return React.createElement(React.Fragment, null, children
|
|
83
|
+
return React.createElement(React.Fragment, null, children ?? React.createElement(SearchBoxExpandButton, null));
|
|
84
84
|
};
|
|
85
85
|
SearchBoxCollapsedState.displayName = 'SearchBox.CollapsedState';
|
|
86
86
|
// ----------------------------------------------------------------------------
|
|
@@ -95,7 +95,7 @@ SearchBoxExpandedState.displayName = 'SearchBox.ExpandedState';
|
|
|
95
95
|
// ----------------------------------------------------------------------------
|
|
96
96
|
const SearchBoxIcon = React.forwardRef((props, ref) => {
|
|
97
97
|
const { className, children, ...rest } = props;
|
|
98
|
-
return (React.createElement(index_js_1.Icon, { "aria-hidden": true, className: (0, classnames_1.default)('iui-search-icon', className), ref: ref, ...rest }, children
|
|
98
|
+
return (React.createElement(index_js_1.Icon, { "aria-hidden": true, className: (0, classnames_1.default)('iui-search-icon', className), ref: ref, ...rest }, children ?? React.createElement(index_js_1.SvgSearch, null)));
|
|
99
99
|
});
|
|
100
100
|
SearchBoxIcon.displayName = 'SearchBox.Icon';
|
|
101
101
|
// ----------------------------------------------------------------------------
|
|
@@ -107,28 +107,28 @@ const SearchBoxInput = React.forwardRef((props, ref) => {
|
|
|
107
107
|
setInputId(idProp);
|
|
108
108
|
}
|
|
109
109
|
}, [idProp, inputId, setInputId]);
|
|
110
|
-
return (React.createElement(index_js_1.Box, { as: 'input', id: idProp
|
|
110
|
+
return (React.createElement(index_js_1.Box, { as: 'input', id: idProp ?? inputId, ref: (0, index_js_1.useMergedRefs)(ref, inputRef), role: 'searchbox', type: 'text', className: (0, classnames_1.default)('iui-search-input', className), disabled: isDisabled, ...rest }));
|
|
111
111
|
});
|
|
112
112
|
SearchBoxInput.displayName = 'SearchBox.Input';
|
|
113
113
|
// ----------------------------------------------------------------------------
|
|
114
114
|
const SearchBoxButton = React.forwardRef((props, ref) => {
|
|
115
115
|
const { children, ...rest } = props;
|
|
116
116
|
const { size: sizeContext, isDisabled } = (0, index_js_1.useSafeContext)(SearchBoxContext);
|
|
117
|
-
return (React.createElement(index_js_2.IconButton, { styleType: 'borderless', size: sizeContext, ref: ref, disabled: isDisabled, ...rest }, children
|
|
117
|
+
return (React.createElement(index_js_2.IconButton, { styleType: 'borderless', size: sizeContext, ref: ref, disabled: isDisabled, ...rest }, children ?? React.createElement(index_js_1.SvgSearch, null)));
|
|
118
118
|
});
|
|
119
119
|
SearchBoxButton.displayName = 'SearchBox.Button';
|
|
120
120
|
// ----------------------------------------------------------------------------
|
|
121
121
|
const SearchBoxCollapseButton = React.forwardRef((props, ref) => {
|
|
122
122
|
const { children, onClick: onClickProp, ...rest } = props;
|
|
123
123
|
const { onCollapse, size: sizeContext, isDisabled, } = (0, index_js_1.useSafeContext)(SearchBoxContext);
|
|
124
|
-
return (React.createElement(SearchBoxButton, { ref: ref, "aria-label": 'Close searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onCollapse), ...rest }, children
|
|
124
|
+
return (React.createElement(SearchBoxButton, { ref: ref, "aria-label": 'Close searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onCollapse), ...rest }, children ?? React.createElement(index_js_1.SvgCloseSmall, null)));
|
|
125
125
|
});
|
|
126
126
|
SearchBoxCollapseButton.displayName = 'SearchBox.CollapseButton';
|
|
127
127
|
// ----------------------------------------------------------------------------
|
|
128
128
|
const SearchBoxExpandButton = React.forwardRef((props, ref) => {
|
|
129
129
|
const { children, className, onClick: onClickProp, ...rest } = props;
|
|
130
130
|
const { onExpand, size: sizeContext, isDisabled, openButtonRef, } = (0, index_js_1.useSafeContext)(SearchBoxContext);
|
|
131
|
-
return (React.createElement(SearchBoxButton, { ref: (0, index_js_1.useMergedRefs)(ref, openButtonRef), className: (0, classnames_1.default)('iui-searchbox-open-button', className), "aria-label": 'Expand searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onExpand), ...rest }, children
|
|
131
|
+
return (React.createElement(SearchBoxButton, { ref: (0, index_js_1.useMergedRefs)(ref, openButtonRef), className: (0, classnames_1.default)('iui-searchbox-open-button', className), "aria-label": 'Expand searchbox', size: sizeContext, disabled: isDisabled, onClick: (0, index_js_1.mergeEventHandlers)(onClickProp, onExpand), ...rest }, children ?? React.createElement(index_js_1.SvgSearch, null)));
|
|
132
132
|
});
|
|
133
133
|
SearchBoxExpandButton.displayName = 'SearchBox.ExpandButton';
|
|
134
134
|
// ----------------------------------------------------------------------------
|
|
@@ -94,24 +94,22 @@ const isSingleOnChange = (onChange, multiple) => {
|
|
|
94
94
|
* />
|
|
95
95
|
*/
|
|
96
96
|
const Select = (props) => {
|
|
97
|
-
var _a;
|
|
98
97
|
const uid = (0, index_js_2.useId)();
|
|
99
98
|
const { options, value, onChange, placeholder, disabled = false, size, setFocus = false, itemRenderer, selectedItemRenderer, className, style, menuClassName, menuStyle, onShow, onHide, popoverProps, multiple = false, triggerProps, ...rest } = props;
|
|
100
99
|
const [isOpenState, setIsOpen] = React.useState(false);
|
|
101
|
-
const isOpen =
|
|
100
|
+
const isOpen = popoverProps?.visible ?? isOpenState;
|
|
102
101
|
const [minWidth, setMinWidth] = React.useState(0);
|
|
103
102
|
const [liveRegionSelection, setLiveRegionSelection] = React.useState('');
|
|
104
103
|
const selectRef = React.useRef(null);
|
|
105
104
|
const toggleButtonRef = React.useRef(null);
|
|
106
105
|
const onShowHandler = React.useCallback((instance) => {
|
|
107
106
|
setIsOpen(true);
|
|
108
|
-
onShow
|
|
107
|
+
onShow?.(instance);
|
|
109
108
|
}, [onShow]);
|
|
110
109
|
const onHideHandler = React.useCallback((instance) => {
|
|
111
|
-
var _a;
|
|
112
110
|
setIsOpen(false);
|
|
113
|
-
|
|
114
|
-
onHide
|
|
111
|
+
selectRef.current?.focus({ preventScroll: true }); // move focus back to select button
|
|
112
|
+
onHide?.(instance);
|
|
115
113
|
}, [onHide]);
|
|
116
114
|
React.useEffect(() => {
|
|
117
115
|
if (selectRef.current && !disabled && setFocus) {
|
|
@@ -141,13 +139,12 @@ const Select = (props) => {
|
|
|
141
139
|
};
|
|
142
140
|
const menuItems = React.useMemo(() => {
|
|
143
141
|
return options.map((option, index) => {
|
|
144
|
-
var _a;
|
|
145
142
|
const isSelected = isMultipleEnabled(value, multiple)
|
|
146
|
-
?
|
|
143
|
+
? value?.includes(option.value) ?? false
|
|
147
144
|
: value === option.value;
|
|
148
145
|
const menuItem = itemRenderer ? (itemRenderer(option, { close: () => setIsOpen(false), isSelected })) : (React.createElement(index_js_1.MenuItem, null, option.label));
|
|
149
146
|
const { label, icon, startIcon: startIconProp, ...restOption } = option;
|
|
150
|
-
const startIcon = startIconProp
|
|
147
|
+
const startIcon = startIconProp ?? icon;
|
|
151
148
|
return React.cloneElement(menuItem, {
|
|
152
149
|
key: `${label}-${index}`,
|
|
153
150
|
isSelected,
|
|
@@ -157,11 +154,11 @@ const Select = (props) => {
|
|
|
157
154
|
return;
|
|
158
155
|
}
|
|
159
156
|
if (isSingleOnChange(onChange, multiple)) {
|
|
160
|
-
onChange
|
|
157
|
+
onChange?.(option.value);
|
|
161
158
|
setIsOpen(false);
|
|
162
159
|
}
|
|
163
160
|
else {
|
|
164
|
-
onChange
|
|
161
|
+
onChange?.(option.value, isSelected ? 'removed' : 'added');
|
|
165
162
|
}
|
|
166
163
|
// update live region
|
|
167
164
|
if (isMultipleEnabled(value, multiple)) {
|
|
@@ -178,7 +175,7 @@ const Select = (props) => {
|
|
|
178
175
|
},
|
|
179
176
|
ref: (el) => {
|
|
180
177
|
if (isSelected && !multiple) {
|
|
181
|
-
el
|
|
178
|
+
el?.scrollIntoView({ block: 'nearest' });
|
|
182
179
|
}
|
|
183
180
|
},
|
|
184
181
|
role: 'option',
|
|
@@ -204,15 +201,14 @@ const Select = (props) => {
|
|
|
204
201
|
maxWidth: `min(${minWidth * 2}px, 90vw)`,
|
|
205
202
|
...menuStyle,
|
|
206
203
|
}, id: `${uid}-menu`, key: `${uid}-menu` }, menuItems), placement: 'bottom-start', aria: { content: null }, onShow: onShowHandler, onHide: onHideHandler, ...popoverProps, visible: isOpen, onClickOutside: (_, { target }) => {
|
|
207
|
-
|
|
208
|
-
if (!((_a = toggleButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
|
|
204
|
+
if (!toggleButtonRef.current?.contains(target)) {
|
|
209
205
|
setIsOpen(false);
|
|
210
206
|
}
|
|
211
207
|
} },
|
|
212
208
|
React.createElement(index_js_2.Box, { tabIndex: 0, role: 'combobox', ref: selectRef, "data-iui-size": size, onClick: () => !disabled && setIsOpen((o) => !o), onKeyDown: (e) => !disabled && onKeyDown(e), "aria-disabled": disabled, "aria-autocomplete": 'none', "aria-expanded": isOpen, "aria-haspopup": 'listbox', "aria-controls": `${uid}-menu`, ...triggerProps, className: (0, classnames_1.default)('iui-select-button', {
|
|
213
209
|
'iui-placeholder': (!selectedItems || selectedItems.length === 0) && !!placeholder,
|
|
214
210
|
'iui-disabled': disabled,
|
|
215
|
-
}, triggerProps
|
|
211
|
+
}, triggerProps?.className) },
|
|
216
212
|
(!selectedItems || selectedItems.length === 0) && (React.createElement(index_js_2.Box, { as: 'span', className: 'iui-content' }, placeholder)),
|
|
217
213
|
isMultipleEnabled(selectedItems, multiple) ? (React.createElement(MultipleSelectButton, { selectedItems: selectedItems, selectedItemsRenderer: selectedItemRenderer, tagRenderer: tagRenderer })) : (React.createElement(SingleSelectButton, { selectedItem: selectedItems, selectedItemRenderer: selectedItemRenderer })))),
|
|
218
214
|
React.createElement(index_js_2.Box, { as: 'span', "aria-hidden": true, ref: toggleButtonRef, className: (0, classnames_1.default)('iui-end-icon', {
|
|
@@ -225,8 +221,7 @@ const Select = (props) => {
|
|
|
225
221
|
};
|
|
226
222
|
exports.Select = Select;
|
|
227
223
|
const SingleSelectButton = ({ selectedItem, selectedItemRenderer, }) => {
|
|
228
|
-
|
|
229
|
-
const startIcon = (_a = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.startIcon) !== null && _a !== void 0 ? _a : selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
|
|
224
|
+
const startIcon = selectedItem?.startIcon ?? selectedItem?.icon;
|
|
230
225
|
return (React.createElement(React.Fragment, null,
|
|
231
226
|
selectedItem &&
|
|
232
227
|
selectedItemRenderer &&
|
|
@@ -58,7 +58,7 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
58
58
|
}, [isExpanded]);
|
|
59
59
|
const ExpandButton = (React.createElement(index_js_2.IconButton, { className: 'iui-sidenav-button iui-expand', onClick: React.useCallback(() => {
|
|
60
60
|
_setIsExpanded((expanded) => !expanded);
|
|
61
|
-
onExpanderClick
|
|
61
|
+
onExpanderClick?.();
|
|
62
62
|
}, [onExpanderClick]) },
|
|
63
63
|
React.createElement(index_js_1.SvgChevronRight, null)));
|
|
64
64
|
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-side-navigation-wrapper', className), ref: forwardedRef, ...rest },
|
|
@@ -69,7 +69,7 @@ exports.SideNavigation = React.forwardRef((props, forwardedRef) => {
|
|
|
69
69
|
expanderPlacement === 'top' && ExpandButton,
|
|
70
70
|
React.createElement(index_js_1.Box, { className: 'iui-sidenav-content' },
|
|
71
71
|
React.createElement(index_js_1.Box, { className: 'iui-top' }, items.map((sidenavButton, index) => !_isExpanded ? (React.createElement(index_js_3.Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton))),
|
|
72
|
-
React.createElement(index_js_1.Box, { className: 'iui-bottom' }, secondaryItems
|
|
72
|
+
React.createElement(index_js_1.Box, { className: 'iui-bottom' }, secondaryItems?.map((sidenavButton, index) => !_isExpanded ? (React.createElement(index_js_3.Tooltip, { content: sidenavButton.props.children, placement: 'right', key: index }, sidenavButton)) : (sidenavButton)))),
|
|
73
73
|
expanderPlacement === 'bottom' && ExpandButton),
|
|
74
74
|
submenu && (React.createElement(index_js_1.WithCSSTransition, { in: isSubmenuOpen, dimension: 'width', timeout: 200, classNames: 'iui' }, submenu))));
|
|
75
75
|
});
|
|
@@ -71,10 +71,9 @@ const formatNumberValue = (value, step, numDecimals) => {
|
|
|
71
71
|
* Focus specified thumb on Slider control
|
|
72
72
|
*/
|
|
73
73
|
const focusThumb = (sliderContainer, activeIndex) => {
|
|
74
|
-
var _a;
|
|
75
74
|
const doc = sliderContainer.ownerDocument;
|
|
76
75
|
if (!sliderContainer.contains(doc.activeElement) ||
|
|
77
|
-
Number(
|
|
76
|
+
Number(doc.activeElement?.getAttribute('data-index')) !== activeIndex) {
|
|
78
77
|
const thumbToFocus = sliderContainer.querySelector(`[data-index="${activeIndex}"]`);
|
|
79
78
|
thumbToFocus && thumbToFocus.focus();
|
|
80
79
|
}
|
|
@@ -88,19 +87,18 @@ const focusThumb = (sliderContainer, activeIndex) => {
|
|
|
88
87
|
* thumbMode='allow-crossing' />
|
|
89
88
|
*/
|
|
90
89
|
exports.Slider = React.forwardRef((props, ref) => {
|
|
91
|
-
var _a, _b;
|
|
92
90
|
const { min = 0, max = 100, values, step = 1, setFocus = false, tooltipProps, disabled = false, tickLabels, minLabel, maxLabel, trackDisplayMode = 'auto', thumbMode = 'inhibit-crossing', onChange, onUpdate, thumbProps, className, railContainerProps, orientation = 'horizontal', ...rest } = props;
|
|
93
91
|
const [currentValues, setCurrentValues] = React.useState(values);
|
|
94
92
|
React.useEffect(() => {
|
|
95
93
|
setCurrentValues(values);
|
|
96
94
|
}, [values]);
|
|
97
|
-
const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel
|
|
95
|
+
const [minValueLabel, setMinValueLabel] = React.useState(() => minLabel ?? min.toString());
|
|
98
96
|
React.useEffect(() => {
|
|
99
|
-
setMinValueLabel(minLabel
|
|
97
|
+
setMinValueLabel(minLabel ?? min.toString());
|
|
100
98
|
}, [minLabel, min]);
|
|
101
|
-
const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel
|
|
99
|
+
const [maxValueLabel, setMaxValueLabel] = React.useState(() => maxLabel ?? max.toString());
|
|
102
100
|
React.useEffect(() => {
|
|
103
|
-
setMaxValueLabel(maxLabel
|
|
101
|
+
setMaxValueLabel(maxLabel ?? max.toString());
|
|
104
102
|
}, [maxLabel, max]);
|
|
105
103
|
const [trackDisplay, setTrackDisplay] = React.useState(() => getDefaultTrackDisplay(trackDisplayMode, currentValues));
|
|
106
104
|
React.useEffect(() => {
|
|
@@ -140,11 +138,11 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
140
138
|
newValues[activeThumbIndex] = pointerValue;
|
|
141
139
|
setCurrentValues(newValues);
|
|
142
140
|
'onChange' === callbackType
|
|
143
|
-
? onChange
|
|
144
|
-
: onUpdate
|
|
141
|
+
? onChange?.(newValues)
|
|
142
|
+
: onUpdate?.(newValues);
|
|
145
143
|
}
|
|
146
144
|
else if ('onChange' === callbackType) {
|
|
147
|
-
onChange
|
|
145
|
+
onChange?.(currentValues);
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
}, [
|
|
@@ -172,12 +170,12 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
172
170
|
return;
|
|
173
171
|
}
|
|
174
172
|
if (keyboardReleased) {
|
|
175
|
-
onChange
|
|
173
|
+
onChange?.(currentValues); // currentValues since key up should not change value but only stop continuous value selection
|
|
176
174
|
}
|
|
177
175
|
else {
|
|
178
176
|
const newValues = [...currentValues]; // newValues since key down should change value
|
|
179
177
|
newValues[index] = value;
|
|
180
|
-
onUpdate
|
|
178
|
+
onUpdate?.(newValues);
|
|
181
179
|
setCurrentValues(newValues);
|
|
182
180
|
}
|
|
183
181
|
}, [currentValues, onUpdate, onChange]);
|
|
@@ -207,8 +205,8 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
207
205
|
const newValues = [...currentValues];
|
|
208
206
|
newValues[closestValueIndex] = pointerValue;
|
|
209
207
|
setCurrentValues(newValues);
|
|
210
|
-
onChange
|
|
211
|
-
onUpdate
|
|
208
|
+
onChange?.(newValues);
|
|
209
|
+
onUpdate?.(newValues);
|
|
212
210
|
focusThumb(containerRef.current, closestValueIndex);
|
|
213
211
|
event.preventDefault();
|
|
214
212
|
event.stopPropagation();
|
|
@@ -223,8 +221,8 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
223
221
|
onUpdate,
|
|
224
222
|
orientation,
|
|
225
223
|
]);
|
|
226
|
-
(0, index_js_1.useEventListener)('pointermove', handlePointerMove,
|
|
227
|
-
(0, index_js_1.useEventListener)('pointerup', handlePointerUp,
|
|
224
|
+
(0, index_js_1.useEventListener)('pointermove', handlePointerMove, containerRef.current?.ownerDocument);
|
|
225
|
+
(0, index_js_1.useEventListener)('pointerup', handlePointerUp, containerRef.current?.ownerDocument);
|
|
228
226
|
const tickMarkArea = React.useMemo(() => {
|
|
229
227
|
if (!tickLabels) {
|
|
230
228
|
return null;
|
|
@@ -252,10 +250,9 @@ exports.Slider = React.forwardRef((props, ref) => {
|
|
|
252
250
|
}), onPointerDown: handlePointerDownOnSlider, ...railContainerProps },
|
|
253
251
|
React.createElement(index_js_1.Box, { className: 'iui-slider-rail' }),
|
|
254
252
|
currentValues.map((thumbValue, index) => {
|
|
255
|
-
var _a;
|
|
256
253
|
const [minVal, maxVal] = getAllowableThumbRange(index);
|
|
257
|
-
const thisThumbProps = thumbProps
|
|
258
|
-
return (React.createElement(Thumb_js_1.Thumb, { key:
|
|
254
|
+
const thisThumbProps = thumbProps?.(index);
|
|
255
|
+
return (React.createElement(Thumb_js_1.Thumb, { key: thisThumbProps?.id ?? index, index: index, disabled: disabled, isActive: activeThumbIndex === index, onThumbActivated: onThumbActivated, onThumbValueChanged: onThumbValueChanged, minVal: minVal, maxVal: maxVal, value: thumbValue, tooltipProps: generateTooltipProps(index, thumbValue), thumbProps: thisThumbProps, step: step, sliderMin: min, sliderMax: max, orientation: orientation }));
|
|
259
256
|
}),
|
|
260
257
|
React.createElement(Track_js_1.Track, { trackDisplayMode: trackDisplay, sliderMin: min, sliderMax: max, values: currentValues, orientation: orientation }),
|
|
261
258
|
tickMarkArea),
|
package/cjs/core/Slider/Thumb.js
CHANGED
|
@@ -86,7 +86,7 @@ const Thumb = (props) => {
|
|
|
86
86
|
return (100.0 * (adjustedValue - sliderMin)) / (sliderMax - sliderMin);
|
|
87
87
|
}, [adjustedValue, sliderMax, sliderMin]);
|
|
88
88
|
const { style, className, ...rest } = thumbProps || {};
|
|
89
|
-
return (React.createElement(index_js_1.Tooltip, { placement: 'top', trigger:
|
|
89
|
+
return (React.createElement(index_js_1.Tooltip, { placement: 'top', trigger: tooltipProps?.visible == null ? 'mouseenter click focus' : undefined, ...tooltipProps },
|
|
90
90
|
React.createElement(index_js_2.Box, { ...rest, "data-index": index, ref: thumbRef, style: {
|
|
91
91
|
...style,
|
|
92
92
|
...(orientation === 'horizontal'
|
|
@@ -37,7 +37,7 @@ const index_js_1 = require("../utils/index.js");
|
|
|
37
37
|
* <StatusMessage startIcon={<SvgStar />}>This is the text</StatusMessage>
|
|
38
38
|
*/
|
|
39
39
|
const StatusMessage = ({ startIcon: userStartIcon, children, status, }) => {
|
|
40
|
-
const icon = userStartIcon
|
|
40
|
+
const icon = userStartIcon ?? (status && index_js_1.StatusIconMap[status]());
|
|
41
41
|
return (React.createElement(React.Fragment, null,
|
|
42
42
|
!!icon ? (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-input-icon', "aria-hidden": true }, icon)) : null,
|
|
43
43
|
React.createElement(index_js_1.Box, { className: 'iui-message' }, children)));
|
|
@@ -36,7 +36,7 @@ const defaultStepperLocalization = {
|
|
|
36
36
|
};
|
|
37
37
|
exports.Stepper = React.forwardRef((props, ref) => {
|
|
38
38
|
const { currentStep, steps, type = 'default', localization = defaultStepperLocalization, onStepClick, ...rest } = props;
|
|
39
|
-
const boundedCurrentStep = Math.min(Math.max(0, currentStep
|
|
39
|
+
const boundedCurrentStep = Math.min(Math.max(0, currentStep ?? 0), steps.length - 1);
|
|
40
40
|
return (React.createElement(index_js_1.Box, { className: 'iui-stepper', ref: ref, ...rest },
|
|
41
41
|
React.createElement("ol", null, steps.map((s, index) => (React.createElement(StepperStep_js_1.StepperStep, { key: index, index: index, title: type === 'long' ? '' : s.name, currentStepNumber: boundedCurrentStep, totalSteps: steps.length, type: type, onClick: onStepClick, description: s.description })))),
|
|
42
42
|
type === 'long' && (React.createElement(index_js_1.Box, { className: 'iui-stepper-steps-label' },
|
|
@@ -42,7 +42,7 @@ exports.StepperStep = React.forwardRef((props, forwardedRef) => {
|
|
|
42
42
|
const isClickable = isPast && !!onClick;
|
|
43
43
|
const onCompletedClick = () => {
|
|
44
44
|
if (isClickable) {
|
|
45
|
-
onClick
|
|
45
|
+
onClick?.(index);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const onKeyDown = (e) => {
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -54,7 +54,7 @@ let isDev = false;
|
|
|
54
54
|
try {
|
|
55
55
|
isDev = process.env.NODE_ENV !== 'production';
|
|
56
56
|
}
|
|
57
|
-
catch
|
|
57
|
+
catch { }
|
|
58
58
|
const flattenColumns = (columns) => {
|
|
59
59
|
const flatColumns = [];
|
|
60
60
|
columns.forEach((column) => {
|
|
@@ -139,11 +139,11 @@ const Table = (props) => {
|
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
const ownerDoc = ownerDocument.current;
|
|
142
|
-
ownerDoc
|
|
143
|
-
ownerDoc
|
|
142
|
+
ownerDoc?.addEventListener('keydown', disableUserSelect);
|
|
143
|
+
ownerDoc?.addEventListener('keyup', enableUserSelect);
|
|
144
144
|
return () => {
|
|
145
|
-
ownerDoc
|
|
146
|
-
ownerDoc
|
|
145
|
+
ownerDoc?.removeEventListener('keydown', disableUserSelect);
|
|
146
|
+
ownerDoc?.removeEventListener('keyup', enableUserSelect);
|
|
147
147
|
};
|
|
148
148
|
}, [
|
|
149
149
|
isSelectable,
|
|
@@ -157,7 +157,7 @@ const Table = (props) => {
|
|
|
157
157
|
const tableStateReducer = React.useCallback((newState, action, previousState, instance) => {
|
|
158
158
|
switch (action.type) {
|
|
159
159
|
case react_table_1.actions.toggleSortBy:
|
|
160
|
-
onSort
|
|
160
|
+
onSort?.(newState);
|
|
161
161
|
break;
|
|
162
162
|
case react_table_1.actions.setFilter:
|
|
163
163
|
currentFilter.current = (0, index_js_5.onFilterHandler)(newState, action, previousState, currentFilter.current, instance);
|
|
@@ -243,13 +243,13 @@ const Table = (props) => {
|
|
|
243
243
|
return result;
|
|
244
244
|
}, {});
|
|
245
245
|
const areFiltersSet = allColumns.some((column) => column.filterValue != null && column.filterValue !== '') || !!globalFilterValue;
|
|
246
|
-
const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter;
|
|
246
|
+
const showFilterButton = (column) => (data.length !== 0 || areFiltersSet) && column.canFilter && !!column.Filter;
|
|
247
247
|
const showSortButton = (column) => data.length !== 0 && column.canSort;
|
|
248
248
|
const onRowClickHandler = React.useCallback((event, row) => {
|
|
249
|
-
const isDisabled = isRowDisabled
|
|
249
|
+
const isDisabled = isRowDisabled?.(row.original);
|
|
250
250
|
const ctrlPressed = event.ctrlKey || event.metaKey;
|
|
251
251
|
if (!isDisabled) {
|
|
252
|
-
onRowClick
|
|
252
|
+
onRowClick?.(event, row);
|
|
253
253
|
}
|
|
254
254
|
if (isSelectable &&
|
|
255
255
|
!isDisabled &&
|
|
@@ -290,7 +290,7 @@ const Table = (props) => {
|
|
|
290
290
|
React.useEffect(() => {
|
|
291
291
|
if (previousFilter.current !== currentFilter.current) {
|
|
292
292
|
previousFilter.current = currentFilter.current;
|
|
293
|
-
onFilter
|
|
293
|
+
onFilter?.(currentFilter.current, state, instance.filteredRows);
|
|
294
294
|
}
|
|
295
295
|
}, [state, instance.filteredRows, onFilter]);
|
|
296
296
|
const lastPassedColumns = React.useRef([]);
|
|
@@ -364,7 +364,7 @@ const Table = (props) => {
|
|
|
364
364
|
const getPreparedRow = React.useCallback((index) => {
|
|
365
365
|
const row = page[index];
|
|
366
366
|
prepareRow(row);
|
|
367
|
-
return (React.createElement(TableRowMemoized_js_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!
|
|
367
|
+
return (React.createElement(TableRowMemoized_js_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!isRowDisabled?.(row.original), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell, bodyRef: bodyRef.current, tableRowRef: enableVirtualization ? undefined : tableRowRef(row), density: density }));
|
|
368
368
|
}, [
|
|
369
369
|
page,
|
|
370
370
|
prepareRow,
|
|
@@ -409,7 +409,7 @@ const Table = (props) => {
|
|
|
409
409
|
const isHeaderDirectClick = React.useRef(false);
|
|
410
410
|
return (React.createElement(React.Fragment, null,
|
|
411
411
|
React.createElement(index_js_2.Box, { ref: (element) => {
|
|
412
|
-
ownerDocument.current = element
|
|
412
|
+
ownerDocument.current = element?.ownerDocument;
|
|
413
413
|
if (isResizable) {
|
|
414
414
|
resizeRef(element);
|
|
415
415
|
}
|
|
@@ -460,7 +460,7 @@ const Table = (props) => {
|
|
|
460
460
|
}, onClick: (e) => {
|
|
461
461
|
// Prevents from triggering sort when resizing and mouse is released in the middle of header
|
|
462
462
|
if (isHeaderDirectClick.current) {
|
|
463
|
-
onClick
|
|
463
|
+
onClick?.(e);
|
|
464
464
|
isHeaderDirectClick.current = false;
|
|
465
465
|
}
|
|
466
466
|
}, tabIndex: showSortButton(column) ? 0 : undefined, onKeyDown: (e) => {
|
|
@@ -509,8 +509,8 @@ const Table = (props) => {
|
|
|
509
509
|
!isLoading &&
|
|
510
510
|
(data.length === 0 || rows.length === 0) &&
|
|
511
511
|
areFiltersSet && (React.createElement(index_js_2.Box, { className: 'iui-table-empty' },
|
|
512
|
-
React.createElement("div", null, emptyFilteredTableContent)))),
|
|
513
|
-
paginatorRenderer(paginatorRendererProps))));
|
|
512
|
+
React.createElement("div", null, emptyFilteredTableContent)))),
|
|
513
|
+
paginatorRenderer?.(paginatorRendererProps))));
|
|
514
514
|
};
|
|
515
515
|
exports.Table = Table;
|
|
516
516
|
exports.default = exports.Table;
|
|
@@ -69,12 +69,11 @@ const TablePaginator = (props) => {
|
|
|
69
69
|
const needFocus = React.useRef(false);
|
|
70
70
|
const isMounted = React.useRef(false);
|
|
71
71
|
React.useEffect(() => {
|
|
72
|
-
var _a, _b;
|
|
73
72
|
// Checking `isMounted.current` prevents from focusing on initial load.
|
|
74
73
|
// Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
|
|
75
74
|
if (isMounted.current && needFocus.current) {
|
|
76
|
-
const buttonToFocus = Array.from(
|
|
77
|
-
buttonToFocus
|
|
75
|
+
const buttonToFocus = Array.from(pageListRef.current?.querySelectorAll('.iui-table-paginator-page-button') ?? []).find((el) => el.textContent?.trim() === (focusedIndex + 1).toString());
|
|
76
|
+
buttonToFocus?.focus();
|
|
78
77
|
needFocus.current = false;
|
|
79
78
|
}
|
|
80
79
|
isMounted.current = true;
|