@itwin/itwinui-react 1.48.1 → 2.0.0-dev.0
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/README.md +4 -22
- package/cjs/core/Alert/Alert.d.ts +7 -6
- package/cjs/core/Alert/Alert.js +12 -7
- package/cjs/core/Avatar/Avatar.d.ts +69 -0
- package/cjs/core/{UserIcon/UserIcon.js → Avatar/Avatar.js} +15 -11
- package/cjs/core/Avatar/index.d.ts +4 -0
- package/cjs/core/{UserIcon → Avatar}/index.js +5 -4
- package/cjs/core/AvatarGroup/AvatarGroup.d.ts +70 -0
- package/cjs/core/{UserIconGroup/UserIconGroup.js → AvatarGroup/AvatarGroup.js} +23 -19
- package/cjs/core/AvatarGroup/index.d.ts +4 -0
- package/cjs/core/{UserIconGroup → AvatarGroup}/index.js +5 -4
- package/cjs/core/Badge/Badge.js +2 -4
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/cjs/core/Buttons/Button/Button.js +5 -14
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.js +3 -9
- package/cjs/core/Buttons/IdeasButton/IdeasButton.js +1 -1
- package/cjs/core/Buttons/SplitButton/SplitButton.js +4 -6
- package/cjs/core/Checkbox/Checkbox.d.ts +1 -29
- package/cjs/core/Checkbox/Checkbox.js +3 -3
- package/cjs/core/ColorPicker/ColorBuilder.js +16 -27
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +1 -6
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.js +2 -4
- package/cjs/core/Dialog/Dialog.d.ts +4 -4
- package/cjs/core/Dialog/Dialog.js +1 -1
- package/cjs/core/Dialog/DialogBackdrop.d.ts +1 -1
- package/cjs/core/Dialog/DialogBackdrop.js +5 -2
- package/cjs/core/Dialog/DialogMain.d.ts +1 -1
- package/cjs/core/Dialog/DialogMain.js +7 -1
- package/cjs/core/Dialog/DialogTitleBar.d.ts +1 -1
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +4 -4
- package/cjs/core/Header/Header.d.ts +16 -6
- package/cjs/core/Header/Header.js +7 -9
- package/cjs/core/Header/HeaderBasicButton.d.ts +6 -0
- package/cjs/core/Header/HeaderBasicButton.js +52 -0
- package/cjs/core/Header/HeaderBreadcrumbs.js +6 -4
- package/cjs/core/Header/HeaderButton.d.ts +3 -2
- package/cjs/core/Header/HeaderButton.js +10 -18
- package/cjs/core/Header/HeaderDropdownButton.d.ts +6 -0
- package/cjs/core/Header/HeaderDropdownButton.js +56 -0
- package/cjs/core/Header/HeaderLogo.js +3 -3
- package/cjs/core/Header/HeaderSplitButton.d.ts +6 -0
- package/cjs/core/Header/HeaderSplitButton.js +56 -0
- package/cjs/core/Input/Input.d.ts +1 -1
- package/cjs/core/Input/Input.js +3 -4
- package/cjs/core/InputGroup/InputGroup.d.ts +1 -1
- package/cjs/core/InputGroup/InputGroup.js +1 -1
- package/cjs/core/Label/Label.d.ts +1 -1
- package/cjs/core/Label/Label.js +1 -1
- package/cjs/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/cjs/core/LabeledInput/LabeledInput.js +1 -1
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +1 -1
- package/cjs/core/LabeledSelect/LabeledSelect.js +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/cjs/core/Radio/Radio.d.ts +1 -29
- package/cjs/core/Radio/Radio.js +3 -3
- package/cjs/core/RadioTiles/RadioTileGroup.d.ts +1 -1
- package/cjs/core/RadioTiles/RadioTileGroup.js +1 -1
- package/cjs/core/Select/Select.d.ts +1 -1
- package/cjs/core/Select/Select.js +9 -12
- package/cjs/core/Select/SelectTag.d.ts +1 -1
- package/cjs/core/Select/SelectTag.js +1 -1
- package/cjs/core/SideNavigation/SidenavButton.js +1 -2
- package/cjs/core/Stepper/Stepper.d.ts +40 -0
- package/cjs/core/{Wizard/Wizard.js → Stepper/Stepper.js} +11 -28
- package/cjs/core/{Wizard/Step.d.ts → Stepper/StepperStep.d.ts} +6 -7
- package/cjs/core/{Wizard/Step.js → Stepper/StepperStep.js} +10 -10
- package/cjs/core/Stepper/Wizard.d.ts +46 -0
- package/cjs/core/Stepper/Wizard.js +55 -0
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +6 -0
- package/cjs/core/Stepper/WorkflowDiagram.js +43 -0
- package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +5 -0
- package/cjs/core/Stepper/WorkflowDiagramStep.js +42 -0
- package/cjs/core/Stepper/index.d.ts +8 -0
- package/cjs/core/{Wizard → Stepper}/index.js +5 -1
- package/cjs/core/Surface/Surface.js +2 -4
- package/cjs/core/Table/SubRowExpander.js +1 -1
- package/cjs/core/Table/Table.d.ts +5 -4
- package/cjs/core/Table/Table.js +30 -21
- package/cjs/core/Table/TableCell.js +4 -4
- package/cjs/core/Table/TablePaginator.js +14 -15
- package/cjs/core/Table/TableRowMemoized.d.ts +2 -0
- package/cjs/core/Table/TableRowMemoized.js +10 -13
- package/cjs/core/Table/cells/DefaultCell.js +4 -9
- package/cjs/core/Table/columns/actionColumn.js +1 -1
- package/cjs/core/Table/columns/expanderColumn.js +1 -1
- package/cjs/core/Table/filters/BaseFilter.js +1 -1
- package/cjs/core/Table/filters/FilterToggle.js +1 -1
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +4 -4
- package/cjs/core/Table/hooks/useResizeColumns.js +110 -106
- package/cjs/core/Tabs/Tab.d.ts +0 -8
- package/cjs/core/Tabs/Tab.js +1 -5
- package/cjs/core/Tabs/Tabs.js +8 -11
- package/cjs/core/Tabs/index.d.ts +2 -2
- package/cjs/core/Tabs/index.js +1 -2
- package/cjs/core/Textarea/Textarea.d.ts +1 -1
- package/cjs/core/Textarea/Textarea.js +2 -2
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +27 -17
- package/cjs/core/ThemeProvider/ThemeProvider.js +64 -7
- package/cjs/core/Tile/Tile.d.ts +19 -1
- package/cjs/core/Tile/Tile.js +35 -12
- package/cjs/core/Toast/Toast.d.ts +3 -3
- package/cjs/core/Toast/Toast.js +3 -3
- package/cjs/core/Toast/ToastWrapper.d.ts +1 -1
- package/cjs/core/Toast/ToastWrapper.js +1 -1
- package/cjs/core/Tree/TreeNode.js +1 -7
- package/cjs/core/index.d.ts +8 -8
- package/cjs/core/index.js +13 -10
- package/cjs/core/utils/components/Popover.d.ts +2 -2
- package/cjs/core/utils/components/Popover.js +1 -1
- package/cjs/core/utils/components/Resizer.d.ts +5 -0
- package/cjs/core/utils/components/Resizer.js +7 -1
- package/cjs/core/utils/components/VisuallyHidden.d.ts +1 -0
- package/cjs/core/utils/components/VisuallyHidden.js +1 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useIsomorphicLayoutEffect.d.ts +7 -0
- package/cjs/core/utils/hooks/useIsomorphicLayoutEffect.js +17 -0
- package/cjs/core/utils/hooks/useMediaQuery.js +2 -1
- package/cjs/core/utils/hooks/useTheme.d.ts +20 -3
- package/cjs/core/utils/hooks/useTheme.js +57 -58
- package/esm/core/Alert/Alert.d.ts +7 -6
- package/esm/core/Alert/Alert.js +12 -7
- package/esm/core/Avatar/Avatar.d.ts +69 -0
- package/esm/core/{UserIcon/UserIcon.js → Avatar/Avatar.js} +13 -9
- package/esm/core/Avatar/index.d.ts +4 -0
- package/esm/core/{UserIcon → Avatar}/index.js +2 -2
- package/esm/core/AvatarGroup/AvatarGroup.d.ts +70 -0
- package/esm/core/{UserIconGroup/UserIconGroup.js → AvatarGroup/AvatarGroup.js} +21 -17
- package/esm/core/AvatarGroup/index.d.ts +4 -0
- package/esm/core/{UserIconGroup → AvatarGroup}/index.js +2 -2
- package/esm/core/Badge/Badge.js +3 -5
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/esm/core/Buttons/Button/Button.js +5 -14
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/esm/core/Buttons/IconButton/IconButton.js +3 -9
- package/esm/core/Buttons/IdeasButton/IdeasButton.js +1 -1
- package/esm/core/Buttons/SplitButton/SplitButton.js +4 -6
- package/esm/core/Checkbox/Checkbox.d.ts +1 -29
- package/esm/core/Checkbox/Checkbox.js +3 -3
- package/esm/core/ColorPicker/ColorBuilder.js +17 -28
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +2 -7
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.js +2 -4
- package/esm/core/Dialog/Dialog.d.ts +4 -4
- package/esm/core/Dialog/Dialog.js +1 -1
- package/esm/core/Dialog/DialogBackdrop.d.ts +1 -1
- package/esm/core/Dialog/DialogBackdrop.js +5 -2
- package/esm/core/Dialog/DialogMain.d.ts +1 -1
- package/esm/core/Dialog/DialogMain.js +7 -1
- package/esm/core/Dialog/DialogTitleBar.d.ts +1 -1
- package/esm/core/ExpandableBlock/ExpandableBlock.js +4 -4
- package/esm/core/Header/Header.d.ts +16 -6
- package/esm/core/Header/Header.js +7 -9
- package/esm/core/Header/HeaderBasicButton.d.ts +6 -0
- package/esm/core/Header/HeaderBasicButton.js +46 -0
- package/esm/core/Header/HeaderBreadcrumbs.js +6 -4
- package/esm/core/Header/HeaderButton.d.ts +3 -2
- package/esm/core/Header/HeaderButton.js +10 -18
- package/esm/core/Header/HeaderDropdownButton.d.ts +6 -0
- package/esm/core/Header/HeaderDropdownButton.js +50 -0
- package/esm/core/Header/HeaderLogo.js +3 -3
- package/esm/core/Header/HeaderSplitButton.d.ts +6 -0
- package/esm/core/Header/HeaderSplitButton.js +50 -0
- package/esm/core/Input/Input.d.ts +1 -1
- package/esm/core/Input/Input.js +3 -4
- package/esm/core/InputGroup/InputGroup.d.ts +1 -1
- package/esm/core/InputGroup/InputGroup.js +1 -1
- package/esm/core/Label/Label.d.ts +1 -1
- package/esm/core/Label/Label.js +1 -1
- package/esm/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/esm/core/LabeledInput/LabeledInput.js +1 -1
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +1 -1
- package/esm/core/LabeledSelect/LabeledSelect.js +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/esm/core/Radio/Radio.d.ts +1 -29
- package/esm/core/Radio/Radio.js +3 -3
- package/esm/core/RadioTiles/RadioTileGroup.d.ts +1 -1
- package/esm/core/RadioTiles/RadioTileGroup.js +1 -1
- package/esm/core/Select/Select.d.ts +1 -1
- package/esm/core/Select/Select.js +9 -12
- package/esm/core/Select/SelectTag.d.ts +1 -1
- package/esm/core/Select/SelectTag.js +1 -1
- package/esm/core/SideNavigation/SidenavButton.js +1 -2
- package/esm/core/Stepper/Stepper.d.ts +40 -0
- package/esm/core/{Wizard/Wizard.js → Stepper/Stepper.js} +10 -27
- package/esm/core/{Wizard/Step.d.ts → Stepper/StepperStep.d.ts} +6 -7
- package/esm/core/{Wizard/Step.js → Stepper/StepperStep.js} +8 -8
- package/esm/core/Stepper/Wizard.d.ts +46 -0
- package/esm/core/Stepper/Wizard.js +49 -0
- package/esm/core/Stepper/WorkflowDiagram.d.ts +6 -0
- package/esm/core/Stepper/WorkflowDiagram.js +37 -0
- package/esm/core/Stepper/WorkflowDiagramStep.d.ts +5 -0
- package/esm/core/Stepper/WorkflowDiagramStep.js +35 -0
- package/esm/core/Stepper/index.d.ts +8 -0
- package/esm/core/{Wizard → Stepper}/index.js +2 -0
- package/esm/core/Surface/Surface.js +3 -5
- package/esm/core/Table/SubRowExpander.js +1 -1
- package/esm/core/Table/Table.d.ts +5 -4
- package/esm/core/Table/Table.js +30 -21
- package/esm/core/Table/TableCell.js +4 -4
- package/esm/core/Table/TablePaginator.js +14 -15
- package/esm/core/Table/TableRowMemoized.d.ts +2 -0
- package/esm/core/Table/TableRowMemoized.js +10 -13
- package/esm/core/Table/cells/DefaultCell.js +4 -9
- package/esm/core/Table/columns/actionColumn.js +1 -1
- package/esm/core/Table/columns/expanderColumn.js +1 -1
- package/esm/core/Table/filters/BaseFilter.js +1 -1
- package/esm/core/Table/filters/FilterToggle.js +1 -1
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +4 -4
- package/esm/core/Table/hooks/useResizeColumns.js +110 -106
- package/esm/core/Tabs/Tab.d.ts +0 -8
- package/esm/core/Tabs/Tab.js +0 -4
- package/esm/core/Tabs/Tabs.js +9 -12
- package/esm/core/Tabs/index.d.ts +2 -2
- package/esm/core/Tabs/index.js +1 -1
- package/esm/core/Textarea/Textarea.d.ts +1 -1
- package/esm/core/Textarea/Textarea.js +2 -2
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +27 -17
- package/esm/core/ThemeProvider/ThemeProvider.js +64 -6
- package/esm/core/Tile/Tile.d.ts +19 -1
- package/esm/core/Tile/Tile.js +36 -13
- package/esm/core/Toast/Toast.d.ts +3 -3
- package/esm/core/Toast/Toast.js +3 -3
- package/esm/core/Toast/ToastWrapper.d.ts +1 -1
- package/esm/core/Toast/ToastWrapper.js +1 -1
- package/esm/core/Tree/TreeNode.js +2 -8
- package/esm/core/index.d.ts +8 -8
- package/esm/core/index.js +4 -4
- package/esm/core/utils/components/Popover.d.ts +2 -2
- package/esm/core/utils/components/Popover.js +1 -1
- package/esm/core/utils/components/Resizer.d.ts +5 -0
- package/esm/core/utils/components/Resizer.js +7 -1
- package/esm/core/utils/components/VisuallyHidden.d.ts +1 -0
- package/esm/core/utils/components/VisuallyHidden.js +1 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useIsomorphicLayoutEffect.d.ts +7 -0
- package/esm/core/utils/hooks/useIsomorphicLayoutEffect.js +11 -0
- package/esm/core/utils/hooks/useMediaQuery.js +2 -1
- package/esm/core/utils/hooks/useTheme.d.ts +20 -3
- package/esm/core/utils/hooks/useTheme.js +56 -57
- package/package.json +3 -2
- package/cjs/core/UserIcon/UserIcon.d.ts +0 -57
- package/cjs/core/UserIcon/index.d.ts +0 -4
- package/cjs/core/UserIconGroup/UserIconGroup.d.ts +0 -62
- package/cjs/core/UserIconGroup/index.d.ts +0 -4
- package/cjs/core/Wizard/Wizard.d.ts +0 -54
- package/cjs/core/Wizard/index.d.ts +0 -4
- package/esm/core/UserIcon/UserIcon.d.ts +0 -57
- package/esm/core/UserIcon/index.d.ts +0 -4
- package/esm/core/UserIconGroup/UserIconGroup.d.ts +0 -62
- package/esm/core/UserIconGroup/index.d.ts +0 -4
- package/esm/core/Wizard/Wizard.d.ts +0 -54
- package/esm/core/Wizard/index.d.ts +0 -4
|
@@ -55,11 +55,11 @@ var defaultLocalization = {
|
|
|
55
55
|
* />
|
|
56
56
|
*/
|
|
57
57
|
export var TablePaginator = function (props) {
|
|
58
|
-
var currentPage = props.currentPage, totalRowsCount = props.totalRowsCount, pageSize = props.pageSize, onPageChange = props.onPageChange, _a = props.focusActivationMode, focusActivationMode =
|
|
58
|
+
var currentPage = props.currentPage, totalRowsCount = props.totalRowsCount, pageSize = props.pageSize, onPageChange = props.onPageChange, _a = props.totalSelectedRowsCount, totalSelectedRowsCount = _a === void 0 ? 0 : _a, _b = props.focusActivationMode, focusActivationMode = _b === void 0 ? 'manual' : _b, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.size, size = _d === void 0 ? 'default' : _d, pageSizeList = props.pageSizeList, onPageSizeChange = props.onPageSizeChange, userLocalization = props.localization, className = props.className, rest = __rest(props, ["currentPage", "totalRowsCount", "pageSize", "onPageChange", "totalSelectedRowsCount", "focusActivationMode", "isLoading", "size", "pageSizeList", "onPageSizeChange", "localization", "className"]);
|
|
59
59
|
useTheme();
|
|
60
60
|
var localization = React.useMemo(function () { return (__assign(__assign({}, defaultLocalization), userLocalization)); }, [userLocalization]);
|
|
61
61
|
var pageListRef = React.useRef(null);
|
|
62
|
-
var
|
|
62
|
+
var _e = React.useState(currentPage), focusedIndex = _e[0], setFocusedIndex = _e[1];
|
|
63
63
|
React.useEffect(function () {
|
|
64
64
|
setFocusedIndex(currentPage);
|
|
65
65
|
}, [currentPage]);
|
|
@@ -70,7 +70,7 @@ export var TablePaginator = function (props) {
|
|
|
70
70
|
// Checking `isMounted.current` prevents from focusing on initial load.
|
|
71
71
|
// Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
|
|
72
72
|
if (isMounted.current && needFocus.current) {
|
|
73
|
-
var buttonToFocus = Array.from((_b = (_a = pageListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.iui-paginator-page-button')) !== null && _b !== void 0 ? _b : []).find(function (el) { var _a; return ((_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (focusedIndex + 1).toString(); });
|
|
73
|
+
var buttonToFocus = Array.from((_b = (_a = pageListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.iui-table-paginator-page-button')) !== null && _b !== void 0 ? _b : []).find(function (el) { var _a; return ((_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (focusedIndex + 1).toString(); });
|
|
74
74
|
buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
|
|
75
75
|
needFocus.current = false;
|
|
76
76
|
}
|
|
@@ -79,10 +79,9 @@ export var TablePaginator = function (props) {
|
|
|
79
79
|
var buttonSize = size != 'default' ? 'small' : undefined;
|
|
80
80
|
var pageButton = React.useCallback(function (index, tabIndex) {
|
|
81
81
|
if (tabIndex === void 0) { tabIndex = index === focusedIndex ? 0 : -1; }
|
|
82
|
-
return (React.createElement("button", { key: index, className: cx('iui-paginator-page-button', {
|
|
83
|
-
'iui-
|
|
84
|
-
|
|
85
|
-
}), onClick: function () { return onPageChange(index); }, "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1));
|
|
82
|
+
return (React.createElement("button", { key: index, className: cx('iui-table-paginator-page-button', {
|
|
83
|
+
'iui-table-paginator-page-button-small': buttonSize === 'small',
|
|
84
|
+
}), "data-iui-active": index === currentPage, onClick: function () { return onPageChange(index); }, "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1));
|
|
86
85
|
}, [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
87
86
|
var totalPagesCount = Math.ceil(totalRowsCount / pageSize);
|
|
88
87
|
var pageList = React.useMemo(function () {
|
|
@@ -90,8 +89,8 @@ export var TablePaginator = function (props) {
|
|
|
90
89
|
.fill(null)
|
|
91
90
|
.map(function (_, index) { return pageButton(index); });
|
|
92
91
|
}, [pageButton, totalPagesCount]);
|
|
93
|
-
var
|
|
94
|
-
var
|
|
92
|
+
var _f = useOverflow(pageList), overflowRef = _f[0], visibleCount = _f[1];
|
|
93
|
+
var _g = useContainerWidth(), paginatorResizeRef = _g[0], paginatorWidth = _g[1];
|
|
95
94
|
var onKeyDown = function (event) {
|
|
96
95
|
// alt + arrow keys are used by browser/assistive technologies
|
|
97
96
|
if (event.altKey) {
|
|
@@ -144,19 +143,19 @@ export var TablePaginator = function (props) {
|
|
|
144
143
|
var hasNoRows = totalPagesCount === 0;
|
|
145
144
|
var showPagesList = totalPagesCount > 1 || isLoading;
|
|
146
145
|
var showPageSizeList = pageSizeList && !!onPageSizeChange && !!totalRowsCount;
|
|
147
|
-
var ellipsis = (React.createElement("span", { className: cx('iui-paginator-ellipsis', {
|
|
148
|
-
'iui-paginator-ellipsis-small': size === 'small',
|
|
146
|
+
var ellipsis = (React.createElement("span", { className: cx('iui-table-paginator-ellipsis', {
|
|
147
|
+
'iui-table-paginator-ellipsis-small': size === 'small',
|
|
149
148
|
}) }, "\u2026"));
|
|
150
149
|
var noRowsContent = (React.createElement(React.Fragment, null, isLoading ? (React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })) : (React.createElement(Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
|
|
151
150
|
if (!showPagesList && !showPageSizeList) {
|
|
152
151
|
return null;
|
|
153
152
|
}
|
|
154
|
-
return (React.createElement("div", __assign({ className: cx('iui-paginator', className), ref: paginatorResizeRef }, rest),
|
|
155
|
-
React.createElement("div", { className: 'iui-left' }),
|
|
153
|
+
return (React.createElement("div", __assign({ className: cx('iui-table-paginator', className), ref: paginatorResizeRef }, rest),
|
|
154
|
+
React.createElement("div", { className: 'iui-left' }, totalSelectedRowsCount > 0 && (React.createElement("span", null, "".concat(totalSelectedRowsCount, " ").concat(totalSelectedRowsCount === 1 ? 'row' : 'rows', " selected")))),
|
|
156
155
|
showPagesList && (React.createElement("div", { className: 'iui-center', ref: overflowRef },
|
|
157
156
|
React.createElement(IconButton, { styleType: 'borderless', disabled: currentPage === 0, onClick: function () { return onPageChange(currentPage - 1); }, size: buttonSize, "aria-label": localization.previousPage },
|
|
158
157
|
React.createElement(SvgChevronLeft, null)),
|
|
159
|
-
React.createElement("span", { className: 'iui-paginator-pages-group', onKeyDown: onKeyDown, ref: pageListRef }, (function () {
|
|
158
|
+
React.createElement("span", { className: 'iui-table-paginator-pages-group', onKeyDown: onKeyDown, ref: pageListRef }, (function () {
|
|
160
159
|
if (hasNoRows) {
|
|
161
160
|
return noRowsContent;
|
|
162
161
|
}
|
|
@@ -179,7 +178,7 @@ export var TablePaginator = function (props) {
|
|
|
179
178
|
React.createElement(SvgChevronRight, null)))),
|
|
180
179
|
React.createElement("div", { className: 'iui-right' }, showPageSizeList && (React.createElement(React.Fragment, null,
|
|
181
180
|
localization.rowsPerPageLabel !== null &&
|
|
182
|
-
paginatorWidth >= 1024 && (React.createElement("span", { className: 'iui-paginator-page-size-label' }, localization.rowsPerPageLabel)),
|
|
181
|
+
paginatorWidth >= 1024 && (React.createElement("span", { className: 'iui-table-paginator-page-size-label' }, localization.rowsPerPageLabel)),
|
|
183
182
|
React.createElement(DropdownButton, { styleType: 'borderless', size: buttonSize, menuItems: function (close) {
|
|
184
183
|
return pageSizeList.map(function (size) { return (React.createElement(MenuItem, { key: size, isSelected: size === pageSize, onClick: function () {
|
|
185
184
|
close();
|
|
@@ -12,6 +12,7 @@ export declare const TableRow: <T extends Record<string, unknown>>(props: {
|
|
|
12
12
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
13
13
|
} & {
|
|
14
14
|
status?: "positive" | "warning" | "negative" | undefined;
|
|
15
|
+
isLoading?: boolean | undefined;
|
|
15
16
|
}) | undefined;
|
|
16
17
|
isLast: boolean;
|
|
17
18
|
onRowInViewport: React.MutableRefObject<((rowData: T) => void) | undefined>;
|
|
@@ -33,6 +34,7 @@ export declare const TableRowMemoized: <T extends Record<string, unknown>>(props
|
|
|
33
34
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
34
35
|
} & {
|
|
35
36
|
status?: "positive" | "warning" | "negative" | undefined;
|
|
37
|
+
isLoading?: boolean | undefined;
|
|
36
38
|
}) | undefined;
|
|
37
39
|
isLast: boolean;
|
|
38
40
|
onRowInViewport: React.MutableRefObject<((rowData: T) => void) | undefined>;
|
|
@@ -36,7 +36,6 @@ import { TableCell } from './TableCell';
|
|
|
36
36
|
*/
|
|
37
37
|
export var TableRow = function (props) {
|
|
38
38
|
var _a;
|
|
39
|
-
var _b;
|
|
40
39
|
var row = props.row, rowProps = props.rowProps, isLast = props.isLast, onRowInViewport = props.onRowInViewport, onBottomReached = props.onBottomReached, intersectionMargin = props.intersectionMargin, onClick = props.onClick, subComponent = props.subComponent, isDisabled = props.isDisabled, tableHasSubRows = props.tableHasSubRows, tableInstance = props.tableInstance, expanderCell = props.expanderCell, bodyRef = props.bodyRef, tableRowRef = props.tableRowRef;
|
|
41
40
|
var onIntersect = React.useCallback(function () {
|
|
42
41
|
var _a, _b;
|
|
@@ -57,16 +56,16 @@ export var TableRow = function (props) {
|
|
|
57
56
|
rootMargin: "".concat(intersectionMargin, "px"),
|
|
58
57
|
root: intersectionRoot,
|
|
59
58
|
});
|
|
60
|
-
var userRowProps = (
|
|
61
|
-
var status = userRowProps.status, restUserRowProps = __rest(userRowProps, ["status"]);
|
|
59
|
+
var userRowProps = (_a = rowProps === null || rowProps === void 0 ? void 0 : rowProps(row)) !== null && _a !== void 0 ? _a : {};
|
|
60
|
+
var status = userRowProps.status, isLoading = userRowProps.isLoading, restUserRowProps = __rest(userRowProps, ["status", "isLoading"]);
|
|
62
61
|
var mergedProps = __assign(__assign(__assign({}, row.getRowProps({ style: { flex: "0 0 auto", minWidth: '100%' } })), restUserRowProps), {
|
|
63
|
-
className: cx('iui-row',
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
className: cx('iui-table-row', {
|
|
63
|
+
'iui-table-row-expanded': row.isExpanded && subComponent,
|
|
64
|
+
'iui-loading': isLoading,
|
|
65
|
+
}, userRowProps === null || userRowProps === void 0 ? void 0 : userRowProps.className),
|
|
66
|
+
'aria-selected': row.isSelected || undefined,
|
|
67
|
+
'aria-disabled': isDisabled || undefined,
|
|
68
|
+
'data-iui-status': status,
|
|
70
69
|
});
|
|
71
70
|
var refs = useMergedRefs(intersectionRef, mergedProps.ref, tableRowRef);
|
|
72
71
|
return (React.createElement(React.Fragment, null,
|
|
@@ -78,9 +77,7 @@ export var TableRow = function (props) {
|
|
|
78
77
|
return (React.createElement(TableCell, { key: cell.getCellProps().key, cell: cell, cellIndex: index, isDisabled: isDisabled, tableHasSubRows: tableHasSubRows, tableInstance: tableInstance, expanderCell: expanderCell }));
|
|
79
78
|
})),
|
|
80
79
|
subComponent && (React.createElement(WithCSSTransition, { in: row.isExpanded },
|
|
81
|
-
React.createElement("div", { className: cx('iui-row', 'iui-expanded-content',
|
|
82
|
-
'iui-disabled': isDisabled,
|
|
83
|
-
}) }, subComponent(row))))));
|
|
80
|
+
React.createElement("div", { className: cx('iui-table-row', 'iui-table-expanded-content'), "aria-disabled": isDisabled }, subComponent(row))))));
|
|
84
81
|
};
|
|
85
82
|
var hasAnySelectedSubRow = function (row, selectedRowIds) {
|
|
86
83
|
if (selectedRowIds === null || selectedRowIds === void 0 ? void 0 : selectedRowIds[row.id]) {
|
|
@@ -38,17 +38,12 @@ import cx from 'classnames';
|
|
|
38
38
|
* }
|
|
39
39
|
*/
|
|
40
40
|
export var DefaultCell = function (props) {
|
|
41
|
-
var _a;
|
|
42
41
|
// Omitting `cellProps`
|
|
43
42
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
-
var
|
|
45
|
-
return (React.createElement("div", __assign({}, cellElementProps, rest, { className: cx(cellElementClassName, className, (
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
_a["iui-".concat(status)] = !!status,
|
|
49
|
-
_a)), style: __assign(__assign({}, cellElementStyle), style) }),
|
|
50
|
-
startIcon && React.createElement("div", { className: 'iui-cell-start-icon' }, startIcon),
|
|
43
|
+
var _a = props.cellElementProps, cellElementClassName = _a.className, cellElementStyle = _a.style, cellElementProps = __rest(_a, ["className", "style"]), children = props.children, startIcon = props.startIcon, endIcon = props.endIcon, cellProps = props.cellProps, isDisabled = props.isDisabled, className = props.className, style = props.style, status = props.status, rest = __rest(props, ["cellElementProps", "children", "startIcon", "endIcon", "cellProps", "isDisabled", "className", "style", "status"]);
|
|
44
|
+
return (React.createElement("div", __assign({}, cellElementProps, rest, { className: cx(cellElementClassName, className), "aria-disabled": (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(cellProps.row.original)) || undefined, "data-iui-status": status, style: __assign(__assign({}, cellElementStyle), style) }),
|
|
45
|
+
startIcon && (React.createElement("div", { className: 'iui-table-cell-start-icon' }, startIcon)),
|
|
51
46
|
children,
|
|
52
|
-
endIcon && React.createElement("div", { className: 'iui-cell-end-icon' }, endIcon)));
|
|
47
|
+
endIcon && React.createElement("div", { className: 'iui-table-cell-end-icon' }, endIcon)));
|
|
53
48
|
};
|
|
54
49
|
export default DefaultCell;
|
|
@@ -107,7 +107,7 @@ export var ActionColumn = function (_a) {
|
|
|
107
107
|
var _a;
|
|
108
108
|
setIsOpen(true);
|
|
109
109
|
(_a = dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
|
|
110
|
-
},
|
|
110
|
+
}, className: cx('iui-scroll', dropdownMenuProps.className) }),
|
|
111
111
|
React.createElement(IconButton, { styleType: 'borderless', isActive: isOpen, ref: buttonRef },
|
|
112
112
|
React.createElement(SvgColumnManager, null))));
|
|
113
113
|
},
|
|
@@ -63,7 +63,7 @@ export var ExpanderColumn = function (props) {
|
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
return (React.createElement(IconButton, { className: 'iui-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
|
|
66
|
+
return (React.createElement(IconButton, { className: 'iui-table-row-expander', styleType: 'borderless', size: 'small', onClick: function (e) {
|
|
67
67
|
e.stopPropagation();
|
|
68
68
|
row.toggleRowExpanded();
|
|
69
69
|
}, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(props.row.original) }, React.createElement(SvgChevronRight, null)));
|
|
@@ -23,7 +23,7 @@ import { useTheme } from '../../utils';
|
|
|
23
23
|
export var BaseFilter = function (props) {
|
|
24
24
|
var children = props.children, className = props.className, style = props.style, id = props.id;
|
|
25
25
|
useTheme();
|
|
26
|
-
return (React.createElement("div", { className: cx('iui-column-filter', className), style: style,
|
|
26
|
+
return (React.createElement("div", { className: cx('iui-table-column-filter', className), style: style,
|
|
27
27
|
// Prevents from triggering sort
|
|
28
28
|
onClick: function (e) {
|
|
29
29
|
e.stopPropagation();
|
|
@@ -49,7 +49,7 @@ export var FilterToggle = function (props) {
|
|
|
49
49
|
}, [close, column]);
|
|
50
50
|
var isColumnFiltered = column.filterValue != null && column.filterValue !== '';
|
|
51
51
|
return (React.createElement(React.Fragment, null, column.canFilter && column.Filter && (React.createElement(Popover, { content: column.render('Filter', { close: close, setFilter: setFilter, clearFilter: clearFilter }), placement: 'bottom-start', visible: isVisible, onClickOutside: close },
|
|
52
|
-
React.createElement(IconButton, __assign({ styleType: 'borderless', isActive: isVisible || isColumnFiltered, className: cx('iui-filter-button', className), onClick: function (e) {
|
|
52
|
+
React.createElement(IconButton, __assign({ styleType: 'borderless', isActive: isVisible || isColumnFiltered, className: cx('iui-table-filter-button', className), onClick: function (e) {
|
|
53
53
|
setIsVisible(function (v) { return !v; });
|
|
54
54
|
// Prevents from triggering sort
|
|
55
55
|
e.stopPropagation();
|
|
@@ -41,13 +41,13 @@ var defaultGetDragAndDropProps = function (isEnabled) { return function (props,
|
|
|
41
41
|
};
|
|
42
42
|
var setOnDragColumnStyle = function (event, position) {
|
|
43
43
|
var columnElement = event.currentTarget;
|
|
44
|
-
columnElement.classList.remove('iui-reorder-column-right');
|
|
45
|
-
columnElement.classList.remove('iui-reorder-column-left');
|
|
44
|
+
columnElement.classList.remove('iui-table-reorder-column-right');
|
|
45
|
+
columnElement.classList.remove('iui-table-reorder-column-left');
|
|
46
46
|
if (position === 'left') {
|
|
47
|
-
columnElement.classList.add('iui-reorder-column-left');
|
|
47
|
+
columnElement.classList.add('iui-table-reorder-column-left');
|
|
48
48
|
}
|
|
49
49
|
else if (position === 'right') {
|
|
50
|
-
columnElement.classList.add('iui-reorder-column-right');
|
|
50
|
+
columnElement.classList.add('iui-table-reorder-column-right');
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
var reorderColumns = function (tableColumns, srcIndex, dstIndex) {
|
|
@@ -19,122 +19,126 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
21
|
import { actions, makePropGetter, useGetLatest, } from 'react-table';
|
|
22
|
-
export var useResizeColumns = function (ownerDocument) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
export var useResizeColumns = function (ownerDocument) {
|
|
23
|
+
return function (hooks) {
|
|
24
|
+
hooks.getResizerProps = [defaultGetResizerProps(ownerDocument)];
|
|
25
|
+
hooks.stateReducers.push(reducer);
|
|
26
|
+
hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions);
|
|
27
|
+
};
|
|
28
|
+
};
|
|
27
29
|
var isTouchEvent = function (event) {
|
|
28
30
|
return event.type === 'touchstart';
|
|
29
31
|
};
|
|
30
|
-
var defaultGetResizerProps = function (ownerDocument) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
d
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
var defaultGetResizerProps = function (ownerDocument) {
|
|
33
|
+
return function (props, _a) {
|
|
34
|
+
var instance = _a.instance, header = _a.header, nextHeader = _a.nextHeader;
|
|
35
|
+
var dispatch = instance.dispatch;
|
|
36
|
+
var onResizeStart = function (e, header) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
// lets not respond to multiple touches (e.g. 2 or 3 fingers)
|
|
39
|
+
if (isTouchEvent(e) && e.touches && e.touches.length > 1) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var headerIdWidths = getLeafHeaders(header).map(function (d) { return [
|
|
43
|
+
d.id,
|
|
44
|
+
getHeaderWidth(d),
|
|
45
|
+
]; });
|
|
46
|
+
var nextHeaderIdWidths = nextHeader
|
|
47
|
+
? getLeafHeaders(nextHeader).map(function (d) { return [d.id, getHeaderWidth(d)]; })
|
|
48
|
+
: [];
|
|
49
|
+
var clientX = isTouchEvent(e)
|
|
50
|
+
? Math.round(e.touches[0].clientX)
|
|
51
|
+
: e.clientX;
|
|
52
|
+
var dispatchMove = function (clientXPos) {
|
|
53
|
+
return dispatch({ type: actions.columnResizing, clientX: clientXPos });
|
|
54
|
+
};
|
|
55
|
+
var dispatchEnd = function () {
|
|
56
|
+
return dispatch({
|
|
57
|
+
type: actions.columnDoneResizing,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var handlersAndEvents = {
|
|
61
|
+
mouse: {
|
|
62
|
+
moveEvent: 'mousemove',
|
|
63
|
+
moveHandler: function (e) { return dispatchMove(e.clientX); },
|
|
64
|
+
upEvent: 'mouseup',
|
|
65
|
+
upHandler: function () {
|
|
66
|
+
var _a, _b, _c;
|
|
67
|
+
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
|
|
68
|
+
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
|
|
69
|
+
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
|
|
70
|
+
dispatchEnd();
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
touch: {
|
|
74
|
+
moveEvent: 'touchmove',
|
|
75
|
+
moveHandler: function (e) {
|
|
76
|
+
if (e.cancelable) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
}
|
|
80
|
+
dispatchMove(e.touches[0].clientX);
|
|
81
|
+
},
|
|
82
|
+
upEvent: 'touchend',
|
|
83
|
+
upHandler: function () {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
|
|
86
|
+
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
|
|
87
|
+
dispatchEnd();
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
var events = isTouchEvent(e)
|
|
92
|
+
? handlersAndEvents.touch
|
|
93
|
+
: handlersAndEvents.mouse;
|
|
94
|
+
var passiveIfSupported = passiveEventSupported()
|
|
95
|
+
? { passive: false }
|
|
96
|
+
: false;
|
|
97
|
+
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
|
|
98
|
+
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
|
|
99
|
+
if (!isTouchEvent(e)) {
|
|
100
|
+
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
|
|
101
|
+
}
|
|
102
|
+
dispatch({
|
|
103
|
+
type: actions.columnStartResizing,
|
|
104
|
+
columnId: header.id,
|
|
105
|
+
columnWidth: getHeaderWidth(header),
|
|
106
|
+
nextColumnWidth: getHeaderWidth(nextHeader),
|
|
107
|
+
headerIdWidths: headerIdWidths,
|
|
108
|
+
nextHeaderIdWidths: nextHeaderIdWidths,
|
|
109
|
+
clientX: clientX,
|
|
55
110
|
});
|
|
56
111
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var _a, _b, _c;
|
|
64
|
-
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
|
|
65
|
-
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
|
|
66
|
-
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
|
|
67
|
-
dispatchEnd();
|
|
112
|
+
return [
|
|
113
|
+
props,
|
|
114
|
+
{
|
|
115
|
+
onClick: function (e) {
|
|
116
|
+
// Prevents from triggering sort
|
|
117
|
+
e.stopPropagation();
|
|
68
118
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
dispatchMove(e.touches[0].clientX);
|
|
119
|
+
onMouseDown: function (e) {
|
|
120
|
+
e.persist();
|
|
121
|
+
// Prevents from triggering drag'n'drop
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
// Prevents from triggering sort
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
onResizeStart(e, header);
|
|
78
126
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
(
|
|
84
|
-
dispatchEnd();
|
|
127
|
+
onTouchStart: function (e) {
|
|
128
|
+
e.persist();
|
|
129
|
+
// Prevents from triggering drag'n'drop
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
onResizeStart(e, header);
|
|
85
132
|
},
|
|
133
|
+
style: {
|
|
134
|
+
cursor: 'col-resize',
|
|
135
|
+
},
|
|
136
|
+
draggable: false,
|
|
137
|
+
role: 'separator',
|
|
86
138
|
},
|
|
87
|
-
|
|
88
|
-
var events = isTouchEvent(e)
|
|
89
|
-
? handlersAndEvents.touch
|
|
90
|
-
: handlersAndEvents.mouse;
|
|
91
|
-
var passiveIfSupported = passiveEventSupported()
|
|
92
|
-
? { passive: false }
|
|
93
|
-
: false;
|
|
94
|
-
(_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
|
|
95
|
-
(_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
|
|
96
|
-
if (!isTouchEvent(e)) {
|
|
97
|
-
(_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
|
|
98
|
-
}
|
|
99
|
-
dispatch({
|
|
100
|
-
type: actions.columnStartResizing,
|
|
101
|
-
columnId: header.id,
|
|
102
|
-
columnWidth: getHeaderWidth(header),
|
|
103
|
-
nextColumnWidth: getHeaderWidth(nextHeader),
|
|
104
|
-
headerIdWidths: headerIdWidths,
|
|
105
|
-
nextHeaderIdWidths: nextHeaderIdWidths,
|
|
106
|
-
clientX: clientX,
|
|
107
|
-
});
|
|
139
|
+
];
|
|
108
140
|
};
|
|
109
|
-
|
|
110
|
-
props,
|
|
111
|
-
{
|
|
112
|
-
onClick: function (e) {
|
|
113
|
-
// Prevents from triggering sort
|
|
114
|
-
e.stopPropagation();
|
|
115
|
-
},
|
|
116
|
-
onMouseDown: function (e) {
|
|
117
|
-
e.persist();
|
|
118
|
-
// Prevents from triggering drag'n'drop
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
// Prevents from triggering sort
|
|
121
|
-
e.stopPropagation();
|
|
122
|
-
onResizeStart(e, header);
|
|
123
|
-
},
|
|
124
|
-
onTouchStart: function (e) {
|
|
125
|
-
e.persist();
|
|
126
|
-
// Prevents from triggering drag'n'drop
|
|
127
|
-
e.preventDefault();
|
|
128
|
-
onResizeStart(e, header);
|
|
129
|
-
},
|
|
130
|
-
style: {
|
|
131
|
-
cursor: 'col-resize',
|
|
132
|
-
},
|
|
133
|
-
draggable: false,
|
|
134
|
-
role: 'separator',
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
}; };
|
|
141
|
+
};
|
|
138
142
|
useResizeColumns.pluginName = 'useResizeColumns';
|
|
139
143
|
var reducer = function (newState, action, previousState, instance) {
|
|
140
144
|
if (action.type === actions.init) {
|
package/esm/core/Tabs/Tab.d.ts
CHANGED
|
@@ -22,10 +22,6 @@ export declare type TabProps = {
|
|
|
22
22
|
*/
|
|
23
23
|
children?: React.ReactNode;
|
|
24
24
|
} & React.HTMLAttributes<HTMLButtonElement>;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Use `TabProps` instead.
|
|
27
|
-
*/
|
|
28
|
-
export declare type HorizontalTabProps = TabProps;
|
|
29
25
|
/**
|
|
30
26
|
* Individual tab component to be used in the `labels` prop of `Tabs`.
|
|
31
27
|
* @example
|
|
@@ -35,8 +31,4 @@ export declare type HorizontalTabProps = TabProps;
|
|
|
35
31
|
* ];
|
|
36
32
|
*/
|
|
37
33
|
export declare const Tab: (props: TabProps) => JSX.Element;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated Use `Tab` instead.
|
|
40
|
-
*/
|
|
41
|
-
export declare const HorizontalTab: (props: TabProps) => JSX.Element;
|
|
42
34
|
export default TabProps;
|
package/esm/core/Tabs/Tab.js
CHANGED
package/esm/core/Tabs/Tabs.js
CHANGED
|
@@ -26,7 +26,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
27
|
import cx from 'classnames';
|
|
28
28
|
import React from 'react';
|
|
29
|
-
import { useTheme, useMergedRefs, getBoundedValue,
|
|
29
|
+
import { useTheme, useMergedRefs, getBoundedValue, useContainerWidth, } from '../utils';
|
|
30
30
|
import '@itwin/itwinui-css/css/tabs.css';
|
|
31
31
|
import { Tab } from './Tab';
|
|
32
32
|
/**
|
|
@@ -54,24 +54,23 @@ import { Tab } from './Tab';
|
|
|
54
54
|
* <Tabs labels={tabsWithIcons} type='pill' />
|
|
55
55
|
*/
|
|
56
56
|
export var Tabs = function (props) {
|
|
57
|
-
var _a, _b, _c;
|
|
58
|
-
var labels = props.labels, activeIndex = props.activeIndex, onTabSelected = props.onTabSelected, _d = props.focusActivationMode, focusActivationMode = _d === void 0 ? 'auto' : _d, _e = props.type, type = _e === void 0 ? 'default' : _e, _f = props.color, color = _f === void 0 ? 'blue' : _f, _g = props.orientation, orientation = _g === void 0 ? 'horizontal' : _g, tabsClassName = props.tabsClassName, contentClassName = props.contentClassName, wrapperClassName = props.wrapperClassName, children = props.children, rest = __rest(props, ["labels", "activeIndex", "onTabSelected", "focusActivationMode", "type", "color", "orientation", "tabsClassName", "contentClassName", "wrapperClassName", "children"]);
|
|
57
|
+
var labels = props.labels, activeIndex = props.activeIndex, onTabSelected = props.onTabSelected, _a = props.focusActivationMode, focusActivationMode = _a === void 0 ? 'auto' : _a, _b = props.type, type = _b === void 0 ? 'default' : _b, _c = props.color, color = _c === void 0 ? 'blue' : _c, _d = props.orientation, orientation = _d === void 0 ? 'horizontal' : _d, tabsClassName = props.tabsClassName, contentClassName = props.contentClassName, wrapperClassName = props.wrapperClassName, children = props.children, rest = __rest(props, ["labels", "activeIndex", "onTabSelected", "focusActivationMode", "type", "color", "orientation", "tabsClassName", "contentClassName", "wrapperClassName", "children"]);
|
|
59
58
|
useTheme();
|
|
60
59
|
var tablistRef = React.useRef(null);
|
|
61
|
-
var
|
|
60
|
+
var _e = useContainerWidth(type !== 'default'), tablistSizeRef = _e[0], tabsWidth = _e[1];
|
|
62
61
|
var refs = useMergedRefs(tablistRef, tablistSizeRef);
|
|
63
|
-
var
|
|
62
|
+
var _f = React.useState(function () {
|
|
64
63
|
return activeIndex != null
|
|
65
64
|
? getBoundedValue(activeIndex, 0, labels.length - 1)
|
|
66
65
|
: 0;
|
|
67
|
-
}), currentActiveIndex =
|
|
66
|
+
}), currentActiveIndex = _f[0], setCurrentActiveIndex = _f[1];
|
|
68
67
|
React.useLayoutEffect(function () {
|
|
69
68
|
if (activeIndex != null && currentActiveIndex !== activeIndex) {
|
|
70
69
|
setCurrentActiveIndex(getBoundedValue(activeIndex, 0, labels.length - 1));
|
|
71
70
|
}
|
|
72
71
|
}, [activeIndex, currentActiveIndex, labels.length]);
|
|
73
72
|
// CSS custom properties to place the active stripe
|
|
74
|
-
var
|
|
73
|
+
var _g = React.useState({}), stripeProperties = _g[0], setStripeProperties = _g[1];
|
|
75
74
|
React.useLayoutEffect(function () {
|
|
76
75
|
if (type !== 'default' && tablistRef.current != undefined) {
|
|
77
76
|
var activeTab = tablistRef.current.children[currentActiveIndex];
|
|
@@ -85,14 +84,14 @@ export var Tabs = function (props) {
|
|
|
85
84
|
})));
|
|
86
85
|
}
|
|
87
86
|
}, [currentActiveIndex, type, orientation, tabsWidth]);
|
|
88
|
-
var
|
|
87
|
+
var _h = React.useState(), focusedIndex = _h[0], setFocusedIndex = _h[1];
|
|
89
88
|
React.useEffect(function () {
|
|
90
89
|
if (tablistRef.current && focusedIndex !== undefined) {
|
|
91
90
|
var tab = tablistRef.current.querySelectorAll('.iui-tab')[focusedIndex];
|
|
92
91
|
tab === null || tab === void 0 ? void 0 : tab.focus();
|
|
93
92
|
}
|
|
94
93
|
}, [focusedIndex]);
|
|
95
|
-
var
|
|
94
|
+
var _j = React.useState(false), hasSublabel = _j[0], setHasSublabel = _j[1]; // used for setting size
|
|
96
95
|
React.useLayoutEffect(function () {
|
|
97
96
|
var _a;
|
|
98
97
|
setHasSublabel(type !== 'pill' && // pill tabs should never have sublabels
|
|
@@ -165,12 +164,10 @@ export var Tabs = function (props) {
|
|
|
165
164
|
break;
|
|
166
165
|
}
|
|
167
166
|
};
|
|
168
|
-
var isIE = !((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, '--stripe-width', '100px'));
|
|
169
167
|
return (React.createElement("div", { className: cx('iui-tabs-wrapper', "iui-".concat(orientation), wrapperClassName), style: stripeProperties },
|
|
170
168
|
React.createElement("ul", __assign({ className: cx('iui-tabs', "iui-".concat(type), {
|
|
171
169
|
'iui-green': color === 'green',
|
|
172
|
-
'iui-animated': type !== 'default'
|
|
173
|
-
'iui-not-animated': isIE,
|
|
170
|
+
'iui-animated': type !== 'default',
|
|
174
171
|
'iui-large': hasSublabel,
|
|
175
172
|
}, tabsClassName), role: 'tablist', ref: refs, onKeyDown: onKeyDown }, rest), labels.map(function (label, index) {
|
|
176
173
|
var onClick = function () {
|
package/esm/core/Tabs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { VerticalTabs, HorizontalTabs } from './Tabs';
|
|
2
2
|
export type { VerticalTabsProps, HorizontalTabsProps } from './Tabs';
|
|
3
|
-
export { Tab
|
|
4
|
-
export type { TabProps
|
|
3
|
+
export { Tab } from './Tab';
|
|
4
|
+
export type { TabProps } from './Tab';
|
package/esm/core/Tabs/index.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { VerticalTabs, HorizontalTabs } from './Tabs';
|
|
6
|
-
export { Tab
|
|
6
|
+
export { Tab } from './Tab';
|
|
@@ -27,7 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
27
27
|
import cx from 'classnames';
|
|
28
28
|
import React from 'react';
|
|
29
29
|
import { useMergedRefs, useTheme } from '../utils';
|
|
30
|
-
import '@itwin/itwinui-css/css/
|
|
30
|
+
import '@itwin/itwinui-css/css/input.css';
|
|
31
31
|
/**
|
|
32
32
|
* Basic textarea component
|
|
33
33
|
* @example
|
|
@@ -44,6 +44,6 @@ export var Textarea = React.forwardRef(function (props, ref) {
|
|
|
44
44
|
textAreaRef.current.focus();
|
|
45
45
|
}
|
|
46
46
|
}, [setFocus]);
|
|
47
|
-
return (React.createElement("textarea", __assign({ className: cx('iui-
|
|
47
|
+
return (React.createElement("textarea", __assign({ className: cx('iui-input', className), rows: rows, ref: refs }, rest)));
|
|
48
48
|
});
|
|
49
49
|
export default Textarea;
|