@itwin/itwinui-react 1.27.0 → 1.29.2
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 +33 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/cjs/core/ButtonGroup/ButtonGroup.js +2 -4
- package/cjs/core/Buttons/Button/Button.d.ts +6 -26
- package/cjs/core/Buttons/Button/Button.js +2 -2
- package/cjs/core/Buttons/DropdownButton/DropdownButton.d.ts +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +3 -8
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -2
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -7
- package/cjs/core/Buttons/SplitButton/SplitButton.js +11 -6
- package/cjs/core/Checkbox/Checkbox.js +2 -2
- package/cjs/core/ColorPicker/ColorInputPanel.js +2 -2
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/DatePicker/DatePicker.js +14 -15
- package/cjs/core/Header/HeaderButton.d.ts +6 -4
- package/cjs/core/Header/HeaderButton.js +3 -4
- package/cjs/core/LabeledInput/LabeledInput.d.ts +1 -1
- package/cjs/core/Modal/Modal.js +4 -1
- package/cjs/core/SideNavigation/SidenavButton.d.ts +3 -13
- package/cjs/core/Table/Table.d.ts +5 -0
- package/cjs/core/Table/Table.js +13 -5
- package/cjs/core/Table/TablePaginator.js +11 -5
- package/cjs/core/Table/TableRowMemoized.js +1 -1
- package/cjs/core/Table/filters/BaseFilter.js +3 -1
- package/cjs/core/Table/filters/FilterToggle.js +4 -3
- package/cjs/core/Table/hooks/useResizeColumns.js +2 -0
- package/cjs/core/Typography/Anchor/Anchor.d.ts +3 -0
- package/cjs/core/Typography/Anchor/Anchor.js +41 -0
- package/cjs/core/Typography/Anchor/index.d.ts +3 -0
- package/cjs/core/Typography/Anchor/index.js +10 -0
- package/cjs/core/Typography/Text/Text.d.ts +6 -10
- package/cjs/core/Typography/Text/Text.js +3 -4
- package/cjs/core/Typography/index.d.ts +1 -0
- package/cjs/core/Typography/index.js +3 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +2 -1
- package/cjs/core/utils/hooks/useTheme.js +20 -3
- package/cjs/core/utils/props.d.ts +29 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/esm/core/ButtonGroup/ButtonGroup.js +2 -4
- package/esm/core/Buttons/Button/Button.d.ts +6 -26
- package/esm/core/Buttons/Button/Button.js +3 -3
- package/esm/core/Buttons/DropdownButton/DropdownButton.d.ts +1 -1
- package/esm/core/Buttons/IconButton/IconButton.d.ts +3 -8
- package/esm/core/Buttons/IconButton/IconButton.js +2 -2
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -7
- package/esm/core/Buttons/SplitButton/SplitButton.js +11 -5
- package/esm/core/Checkbox/Checkbox.js +2 -2
- package/esm/core/ColorPicker/ColorInputPanel.js +2 -2
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/DatePicker/DatePicker.js +14 -15
- package/esm/core/Header/HeaderButton.d.ts +6 -4
- package/esm/core/Header/HeaderButton.js +3 -3
- package/esm/core/LabeledInput/LabeledInput.d.ts +1 -1
- package/esm/core/Modal/Modal.js +4 -1
- package/esm/core/SideNavigation/SidenavButton.d.ts +3 -13
- package/esm/core/Table/Table.d.ts +5 -0
- package/esm/core/Table/Table.js +13 -5
- package/esm/core/Table/TablePaginator.js +11 -5
- package/esm/core/Table/TableRowMemoized.js +1 -1
- package/esm/core/Table/filters/BaseFilter.js +3 -1
- package/esm/core/Table/filters/FilterToggle.js +4 -3
- package/esm/core/Table/hooks/useResizeColumns.js +2 -0
- package/esm/core/Typography/Anchor/Anchor.d.ts +3 -0
- package/esm/core/Typography/Anchor/Anchor.js +35 -0
- package/esm/core/Typography/Anchor/index.d.ts +3 -0
- package/esm/core/Typography/Anchor/index.js +6 -0
- package/esm/core/Typography/Text/Text.d.ts +6 -10
- package/esm/core/Typography/Text/Text.js +4 -4
- package/esm/core/Typography/index.d.ts +1 -0
- package/esm/core/Typography/index.js +1 -0
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/utils/hooks/useTheme.js +20 -3
- package/esm/core/utils/props.d.ts +29 -1
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### [1.29.2](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.1...v1.29.2) (2022-01-24)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
* **Button:** Fix event typings for inline handlers ([#519](https://www.github.com/iTwin/iTwinUI-react/issues/519)) ([c72f5fd](https://www.github.com/iTwin/iTwinUI-react/commit/c72f5fdae00f61d38295f30111f36c403590ebfe))
|
|
8
|
+
* **Modal:** Dont use `stopPropagation` for closing on backdrop click ([#518](https://www.github.com/iTwin/iTwinUI-react/issues/518)) ([83a2400](https://www.github.com/iTwin/iTwinUI-react/commit/83a240046f4f04cc625fa8e53fe62d83a7af4c8b))
|
|
9
|
+
|
|
10
|
+
### [1.29.1](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.0...v1.29.1) (2022-01-19)
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
* **Button:** Improve polymorphic handling ([#512](https://www.github.com/iTwin/iTwinUI-react/issues/512)) ([6827264](https://www.github.com/iTwin/iTwinUI-react/commit/6827264397b3be5edde70426e43419a8ff161894))
|
|
15
|
+
|
|
16
|
+
## [1.29.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.28.0...v1.29.0) (2022-01-11)
|
|
17
|
+
|
|
18
|
+
### What's new
|
|
19
|
+
|
|
20
|
+
* **Button:** Allow rendering as anchor element using `as` prop ([#409](https://www.github.com/iTwin/iTwinUI-react/issues/409)) ([9dfcef7](https://www.github.com/iTwin/iTwinUI-react/commit/9dfcef7ba1c2dc2a43b49fc8e40ef2dcbd89bd0b))
|
|
21
|
+
* **Anchor:** Add new anchor component ([#501](https://www.github.com/iTwin/iTwinUI-react/issues/501)) ([684c18b](https://www.github.com/iTwin/iTwinUI-react/commit/684c18b313a3a7485a766b784d28a482e38e1a3d))
|
|
22
|
+
* **useTheme:** Add event listener to respond to theme changes ([#491](https://www.github.com/iTwin/iTwinUI-react/issues/491)) ([b940ef0](https://www.github.com/iTwin/iTwinUI-react/commit/b940ef0eccc762e07c76bb46beb4a7e8de793d11))
|
|
23
|
+
|
|
24
|
+
## [1.28.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.27.0...v1.28.0) (2021-12-21)
|
|
25
|
+
|
|
26
|
+
### What's new
|
|
27
|
+
|
|
28
|
+
* **ButtonGroup:** Add support for input+button combo ([#492](https://www.github.com/iTwin/iTwinUI-react/issues/492), [#481](https://github.com/iTwin/iTwinUI-react/pull/481)) ([b8b15fd](https://www.github.com/iTwin/iTwinUI-react/commit/b8b15fd4a6f67fac03063a6fdeec1ea6216899c4))
|
|
29
|
+
* **Table:** Added zebra stripes to rows ([#478](https://www.github.com/iTwin/iTwinUI-react/issues/478)) ([76d3eda](https://www.github.com/iTwin/iTwinUI-react/commit/76d3eda5d14aab2b02187c58fab70e93878c73cc))
|
|
30
|
+
* **Table:** Proper support for horizontal scroll ([#495](https://www.github.com/iTwin/iTwinUI-react/issues/495)) ([079c2c0](https://www.github.com/iTwin/iTwinUI-react/commit/079c2c020be46f14ff41d407e81eee1487adfcab))
|
|
31
|
+
|
|
32
|
+
### Fixes
|
|
33
|
+
|
|
34
|
+
* **Table:** Prevents from triggering sort when filtering ([#487](https://www.github.com/iTwin/iTwinUI-react/issues/487)) ([d1e6165](https://www.github.com/iTwin/iTwinUI-react/commit/d1e61655bddffc37fa3f91b95766145f18392844))
|
|
35
|
+
|
|
3
36
|
## [1.27.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.26.1...v1.27.0) (2021-12-14)
|
|
4
37
|
|
|
5
38
|
### What's new
|
|
@@ -84,7 +84,7 @@ exports.Breadcrumbs = react_1.default.forwardRef(function (props, ref) {
|
|
|
84
84
|
react_1.default.createElement(Separator, null))),
|
|
85
85
|
items.length - visibleCount > 0 && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
86
86
|
react_1.default.createElement("li", { className: 'iui-breadcrumbs-item' },
|
|
87
|
-
react_1.default.createElement("span",
|
|
87
|
+
react_1.default.createElement("span", null, "\u2026")),
|
|
88
88
|
react_1.default.createElement(Separator, null))),
|
|
89
89
|
items
|
|
90
90
|
.slice(visibleCount > 1
|
|
@@ -64,14 +64,12 @@ require("@itwin/itwinui-css/css/button.css");
|
|
|
64
64
|
*/
|
|
65
65
|
exports.ButtonGroup = react_1.default.forwardRef(function (props, ref) {
|
|
66
66
|
var children = props.children, className = props.className, style = props.style, overflowButton = props.overflowButton, rest = __rest(props, ["children", "className", "style", "overflowButton"]);
|
|
67
|
-
var items = react_1.default.useMemo(function () { return react_1.default.Children.
|
|
68
|
-
children,
|
|
69
|
-
]);
|
|
67
|
+
var items = react_1.default.useMemo(function () { var _a; return (_a = react_1.default.Children.map(children, function (child) { return react_1.default.createElement("div", null, child); })) !== null && _a !== void 0 ? _a : []; }, [children]);
|
|
70
68
|
(0, utils_1.useTheme)();
|
|
71
69
|
var _a = (0, utils_1.useOverflow)(items, !overflowButton), overflowRef = _a[0], visibleCount = _a[1];
|
|
72
70
|
var refs = (0, utils_1.useMergedRefs)(overflowRef, ref);
|
|
73
71
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-button-group', className), style: __assign(__assign({}, (!!overflowButton && { width: '100%' })), style), ref: refs }, rest), !!overflowButton && visibleCount < items.length ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
74
72
|
items.slice(0, visibleCount - 1),
|
|
75
|
-
overflowButton(visibleCount))) : (
|
|
73
|
+
overflowButton(visibleCount))) : (items)));
|
|
76
74
|
});
|
|
77
75
|
exports.default = exports.ButtonGroup;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { PolymorphicComponentProps, PolymorphicForwardRefComponent } from '../../utils';
|
|
2
3
|
import '@itwin/itwinui-css/css/button.css';
|
|
3
|
-
|
|
4
|
+
declare type ButtonOwnProps = {
|
|
4
5
|
/**
|
|
5
6
|
* Modify size of the button.
|
|
6
7
|
*/
|
|
@@ -23,7 +24,9 @@ export declare type ButtonProps = {
|
|
|
23
24
|
* Content of the button.
|
|
24
25
|
*/
|
|
25
26
|
children?: React.ReactNode;
|
|
26
|
-
}
|
|
27
|
+
};
|
|
28
|
+
export declare type ButtonProps<T extends React.ElementType = 'button'> = PolymorphicComponentProps<T, ButtonOwnProps>;
|
|
29
|
+
declare type ButtonComponent = PolymorphicForwardRefComponent<'button', ButtonOwnProps>;
|
|
27
30
|
/**
|
|
28
31
|
* Generic button component
|
|
29
32
|
* @example
|
|
@@ -33,28 +36,5 @@ export declare type ButtonProps = {
|
|
|
33
36
|
* <Button size='small' styleType='cta'>This is a small call to action button</Button>
|
|
34
37
|
* <Button startIcon={<SvgAdd />}>New</Button>
|
|
35
38
|
*/
|
|
36
|
-
export declare const Button:
|
|
37
|
-
/**
|
|
38
|
-
* Modify size of the button.
|
|
39
|
-
*/
|
|
40
|
-
size?: "small" | "large" | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Style of the button.
|
|
43
|
-
* Use 'borderless' to hide outline.
|
|
44
|
-
* @default 'default'
|
|
45
|
-
*/
|
|
46
|
-
styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Icon shown before the main button content.
|
|
49
|
-
*/
|
|
50
|
-
startIcon?: JSX.Element | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Icon shown after the main button content.
|
|
53
|
-
*/
|
|
54
|
-
endIcon?: JSX.Element | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Content of the button.
|
|
57
|
-
*/
|
|
58
|
-
children?: React.ReactNode;
|
|
59
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
39
|
+
export declare const Button: ButtonComponent;
|
|
60
40
|
export default Button;
|
|
@@ -45,9 +45,9 @@ require("@itwin/itwinui-css/css/button.css");
|
|
|
45
45
|
*/
|
|
46
46
|
exports.Button = react_1.default.forwardRef(function (props, ref) {
|
|
47
47
|
var _a;
|
|
48
|
-
var children = props.children, className = props.className, size = props.size, style = props.style, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, _c = props.type, type = _c === void 0 ? 'button' : _c, startIcon = props.startIcon, endIcon = props.endIcon, rest = __rest(props, ["children", "className", "size", "style", "styleType", "type", "startIcon", "endIcon"]);
|
|
48
|
+
var children = props.children, className = props.className, size = props.size, style = props.style, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, _c = props.type, type = _c === void 0 ? 'button' : _c, startIcon = props.startIcon, endIcon = props.endIcon, _d = props.as, Element = _d === void 0 ? 'button' : _d, rest = __rest(props, ["children", "className", "size", "style", "styleType", "type", "startIcon", "endIcon", "as"]);
|
|
49
49
|
(0, utils_1.useTheme)();
|
|
50
|
-
return (react_1.default.createElement(
|
|
50
|
+
return (react_1.default.createElement(Element, __assign({ ref: ref, className: (0, classnames_1.default)('iui-button', "iui-" + styleType, (_a = {},
|
|
51
51
|
_a["iui-" + size] = !!size,
|
|
52
52
|
_a), className), style: style, type: type }, rest),
|
|
53
53
|
startIcon &&
|
|
@@ -37,5 +37,5 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<{
|
|
|
37
37
|
* @default 'default'
|
|
38
38
|
*/
|
|
39
39
|
styleType?: "default" | "borderless" | undefined;
|
|
40
|
-
} & Omit<ButtonProps
|
|
40
|
+
} & Omit<ButtonProps<"button">, "onClick" | "styleType" | "endIcon"> & React.RefAttributes<HTMLButtonElement>>;
|
|
41
41
|
export default DropdownButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ButtonProps } from '../Button';
|
|
2
|
+
import { PolymorphicForwardRefComponent } from '../../utils';
|
|
3
3
|
import '@itwin/itwinui-css/css/button.css';
|
|
4
4
|
export declare type IconButtonProps = {
|
|
5
5
|
/**
|
|
@@ -8,17 +8,12 @@ export declare type IconButtonProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
isActive?: boolean;
|
|
10
10
|
} & Omit<ButtonProps, 'startIcon' | 'endIcon'>;
|
|
11
|
+
declare type IconButtonComponent = PolymorphicForwardRefComponent<'button', IconButtonProps>;
|
|
11
12
|
/**
|
|
12
13
|
* Icon button
|
|
13
14
|
* @example
|
|
14
15
|
* <IconButton><SvgAdd /></IconButton>
|
|
15
16
|
* <IconButton styleType='borderless'><SvgAdd /></IconButton>
|
|
16
17
|
*/
|
|
17
|
-
export declare const IconButton:
|
|
18
|
-
/**
|
|
19
|
-
* Button gets active style.
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
isActive?: boolean | undefined;
|
|
23
|
-
} & Omit<ButtonProps, "startIcon" | "endIcon"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export declare const IconButton: IconButtonComponent;
|
|
24
19
|
export default IconButton;
|
|
@@ -42,9 +42,9 @@ require("@itwin/itwinui-css/css/button.css");
|
|
|
42
42
|
*/
|
|
43
43
|
exports.IconButton = react_1.default.forwardRef(function (props, ref) {
|
|
44
44
|
var _a;
|
|
45
|
-
var isActive = props.isActive, children = props.children, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, _c = props.type, type = _c === void 0 ? 'button' : _c, className = props.className, rest = __rest(props, ["isActive", "children", "styleType", "size", "type", "className"]);
|
|
45
|
+
var isActive = props.isActive, children = props.children, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, _c = props.type, type = _c === void 0 ? 'button' : _c, className = props.className, _d = props.as, Element = _d === void 0 ? 'button' : _d, rest = __rest(props, ["isActive", "children", "styleType", "size", "type", "className", "as"]);
|
|
46
46
|
(0, utils_1.useTheme)();
|
|
47
|
-
return (react_1.default.createElement(
|
|
47
|
+
return (react_1.default.createElement(Element, __assign({ ref: ref, className: (0, classnames_1.default)('iui-button', "iui-" + styleType, (_a = {},
|
|
48
48
|
_a["iui-" + size] = !!size,
|
|
49
49
|
_a['iui-active'] = isActive,
|
|
50
50
|
_a), className), type: type }, rest), react_1.default.cloneElement(children, {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../Button';
|
|
3
3
|
import { Placement } from 'tippy.js';
|
|
4
|
+
import { PolymorphicForwardRefComponent } from '../../utils';
|
|
4
5
|
import '@itwin/itwinui-css/css/button.css';
|
|
5
|
-
export declare type SplitButtonProps = {
|
|
6
|
-
/**
|
|
7
|
-
* Callback fired on clicking the primary button.
|
|
8
|
-
*/
|
|
9
|
-
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
export declare type SplitButtonProps = ButtonProps & {
|
|
10
7
|
/**
|
|
11
8
|
* Items in the dropdown menu.
|
|
12
9
|
* Pass a function that takes the `close` argument (to close the menu),
|
|
@@ -22,9 +19,14 @@ export declare type SplitButtonProps = {
|
|
|
22
19
|
* Content of primary button.
|
|
23
20
|
*/
|
|
24
21
|
children: React.ReactNode;
|
|
25
|
-
}
|
|
22
|
+
};
|
|
23
|
+
declare type SplitButtonComponent = PolymorphicForwardRefComponent<'button', SplitButtonProps>;
|
|
26
24
|
/**
|
|
27
25
|
* Split button component with a DropdownMenu.
|
|
26
|
+
*
|
|
27
|
+
* The delegated props and forwarded ref are passed onto the primary button.
|
|
28
|
+
* It also supports using the `as` prop to change which element is rendered.
|
|
29
|
+
*
|
|
28
30
|
* @example
|
|
29
31
|
* const menuItems = (close: () => void) => [
|
|
30
32
|
* <MenuItem key={1} onClick={onClick(1, close)}>Item #1</MenuItem>,
|
|
@@ -33,5 +35,5 @@ export declare type SplitButtonProps = {
|
|
|
33
35
|
* <SplitButton onClick={onClick} menuItems={menuItems}>Default</SplitButton>
|
|
34
36
|
* <SplitButton onClick={onClick} menuItems={menuItems} styleType='high-visibility'>High visibility</SplitButton>
|
|
35
37
|
*/
|
|
36
|
-
export declare const SplitButton:
|
|
38
|
+
export declare const SplitButton: SplitButtonComponent;
|
|
37
39
|
export default SplitButton;
|
|
@@ -41,6 +41,10 @@ var utils_1 = require("../../utils");
|
|
|
41
41
|
require("@itwin/itwinui-css/css/button.css");
|
|
42
42
|
/**
|
|
43
43
|
* Split button component with a DropdownMenu.
|
|
44
|
+
*
|
|
45
|
+
* The delegated props and forwarded ref are passed onto the primary button.
|
|
46
|
+
* It also supports using the `as` prop to change which element is rendered.
|
|
47
|
+
*
|
|
44
48
|
* @example
|
|
45
49
|
* const menuItems = (close: () => void) => [
|
|
46
50
|
* <MenuItem key={1} onClick={onClick(1, close)}>Item #1</MenuItem>,
|
|
@@ -49,7 +53,7 @@ require("@itwin/itwinui-css/css/button.css");
|
|
|
49
53
|
* <SplitButton onClick={onClick} menuItems={menuItems}>Default</SplitButton>
|
|
50
54
|
* <SplitButton onClick={onClick} menuItems={menuItems} styleType='high-visibility'>High visibility</SplitButton>
|
|
51
55
|
*/
|
|
52
|
-
|
|
56
|
+
exports.SplitButton = react_1.default.forwardRef(function (props, forwardedRef) {
|
|
53
57
|
var onClick = props.onClick, menuItems = props.menuItems, className = props.className, _a = props.menuPlacement, menuPlacement = _a === void 0 ? 'bottom-end' : _a, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, children = props.children, style = props.style, title = props.title, rest = __rest(props, ["onClick", "menuItems", "className", "menuPlacement", "styleType", "size", "children", "style", "title"]);
|
|
54
58
|
(0, utils_1.useTheme)();
|
|
55
59
|
var _c = react_1.default.useState(false), isMenuOpen = _c[0], setIsMenuOpen = _c[1];
|
|
@@ -63,9 +67,10 @@ var SplitButton = function (props) {
|
|
|
63
67
|
return (react_1.default.createElement("span", { className: (0, classnames_1.default)(className, 'iui-button-split-menu', {
|
|
64
68
|
'iui-disabled': props.disabled,
|
|
65
69
|
}), style: style, title: title, ref: ref },
|
|
66
|
-
react_1.default.createElement(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
70
|
-
|
|
70
|
+
react_1.default.createElement("div", null,
|
|
71
|
+
react_1.default.createElement(Button_1.Button, __assign({ styleType: styleType, size: size, onClick: onClick, ref: forwardedRef }, rest), children)),
|
|
72
|
+
react_1.default.createElement("div", null,
|
|
73
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { placement: menuPlacement, menuItems: menuItems, style: { minWidth: menuWidth }, onShow: react_1.default.useCallback(function () { return setIsMenuOpen(true); }, []), onHide: react_1.default.useCallback(function () { return setIsMenuOpen(false); }, []) },
|
|
74
|
+
react_1.default.createElement(IconButton_1.IconButton, { styleType: styleType, size: size, disabled: props.disabled }, isMenuOpen ? react_1.default.createElement(CaretUpSmall_1.default, null) : react_1.default.createElement(CaretDownSmall_1.default, null))))));
|
|
75
|
+
});
|
|
71
76
|
exports.default = exports.SplitButton;
|
|
@@ -66,8 +66,8 @@ exports.Checkbox = react_1.default.forwardRef(function (props, ref) {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
var defaultCheckbox = (react_1.default.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
69
|
-
react_1.default.createElement("path", { className: 'iui-check', d: '
|
|
70
|
-
react_1.default.createElement("path", { className: 'iui-check-partial', d: '
|
|
69
|
+
react_1.default.createElement("path", { className: 'iui-check', d: 'm6.5 12.5-4.5-4.5 1.5-1.5 3 3 6-6 1.5 1.5z' }),
|
|
70
|
+
react_1.default.createElement("path", { className: 'iui-check-partial', d: 'm2.75 6.875h10.5v2.25h-10.5z' })));
|
|
71
71
|
var visibilityCheckbox = (react_1.default.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
72
72
|
react_1.default.createElement("path", { className: 'iui-check', d: 'm8 2.99051a8.81883 8.81883 0 0 0 -8 4.95062 8.74664 8.74664 0 0 0 8 5.06836 8.63266 8.63266 0 0 0 8-5.06836 8.83631 8.83631 0 0 0 -8-4.95062zm-1.31445 1.86981a1.47663 1.47663 0 1 1 -1.47663 1.47668 1.47665 1.47665 0 0 1 1.47663-1.47668zm1.31445 6.64917a7.17486 7.17486 0 0 1 -6.30475-3.55237 7.4952 7.4952 0 0 1 2.81475-2.6336 3.83956 3.83956 0 1 0 6.98126.00244 7.522 7.522 0 0 1 2.81774 2.63916 7.09785 7.09785 0 0 1 -6.309 3.54437z' }),
|
|
73
73
|
react_1.default.createElement("g", { className: 'iui-check-partial' },
|
|
@@ -36,6 +36,7 @@ var Buttons_1 = require("../Buttons");
|
|
|
36
36
|
var Input_1 = require("../Input");
|
|
37
37
|
var utils_1 = require("../utils");
|
|
38
38
|
var ColorPickerContext_1 = require("./ColorPickerContext");
|
|
39
|
+
var Swap_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/Swap"));
|
|
39
40
|
require("@itwin/itwinui-css/css/color-picker.css");
|
|
40
41
|
/**
|
|
41
42
|
* `ColorInputPanel` shows input fields to enter precise color values in the specified format.
|
|
@@ -302,8 +303,7 @@ exports.ColorInputPanel = react_1.default.forwardRef(function (props, ref) {
|
|
|
302
303
|
: currentFormat.toUpperCase()),
|
|
303
304
|
react_1.default.createElement("div", { className: 'iui-color-input' },
|
|
304
305
|
allowedColorFormats.length > 1 && (react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', onClick: swapColorFormat, size: 'small' },
|
|
305
|
-
react_1.default.createElement(
|
|
306
|
-
react_1.default.createElement("path", { d: 'm5 15-3.78125-3.5 3.78125-3.5v2h8v3h-8zm6-7 3.78125-3.5-3.78125-3.5v2h-8v3h8z' })))),
|
|
306
|
+
react_1.default.createElement(Swap_1.default, null))),
|
|
307
307
|
react_1.default.createElement("div", { ref: inputsContainerRef, className: 'iui-color-input-fields' },
|
|
308
308
|
currentFormat === 'hex' && hexInputField,
|
|
309
309
|
currentFormat === 'rgb' && rgbInputs,
|
|
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
|
|
|
17
17
|
* <ColorSwatch color='#23450b' onClick={onClick}/>
|
|
18
18
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
19
19
|
*/
|
|
20
|
-
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
|
@@ -254,22 +254,21 @@ var DatePicker = function (props) {
|
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
256
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-date-picker', className), style: style }, rest),
|
|
257
|
-
react_1.default.createElement("div",
|
|
258
|
-
react_1.default.createElement("div", { className: 'iui-
|
|
259
|
-
react_1.default.createElement(
|
|
260
|
-
react_1.default.createElement(
|
|
261
|
-
|
|
262
|
-
react_1.default.createElement("span", {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
react_1.default.createElement(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return (react_1.default.createElement("div", { key: "week-" + displayedMonthIndex + "-" + weekIndex, className: 'iui-week' }, weekDays.map(function (weekDay, dayIndex) {
|
|
257
|
+
react_1.default.createElement("div", null,
|
|
258
|
+
react_1.default.createElement("div", { className: 'iui-calendar-month-year' },
|
|
259
|
+
react_1.default.createElement(IconButton_1.IconButton, { styleType: 'borderless', onClick: handleMoveToPreviousMonth, "aria-label": 'Previous month' },
|
|
260
|
+
react_1.default.createElement(ChevronLeft_1.default, null)),
|
|
261
|
+
react_1.default.createElement("span", { "aria-live": 'polite' },
|
|
262
|
+
react_1.default.createElement("span", { className: 'iui-calendar-month', title: monthNames[displayedMonthIndex] }, monthNames[displayedMonthIndex]),
|
|
263
|
+
"\u00A0",
|
|
264
|
+
displayedYear),
|
|
265
|
+
react_1.default.createElement(IconButton_1.IconButton, { styleType: 'borderless', onClick: handleMoveToNextMonth, "aria-label": 'Next month' },
|
|
266
|
+
react_1.default.createElement(ChevronRight_1.default, null))),
|
|
267
|
+
react_1.default.createElement("div", { className: 'iui-calendar-weekdays' }, shortDays.map(function (day, index) { return (react_1.default.createElement("div", { key: day, title: longDays[index] }, day)); })),
|
|
268
|
+
react_1.default.createElement("div", { onKeyDown: handleCalendarKeyDown, role: 'listbox' }, weeks.map(function (weekDays, weekIndex) {
|
|
269
|
+
return (react_1.default.createElement("div", { key: "week-" + displayedMonthIndex + "-" + weekIndex, className: 'iui-calendar-week' }, weekDays.map(function (weekDay, dayIndex) {
|
|
271
270
|
var dateValue = weekDay.getDate();
|
|
272
|
-
return (react_1.default.createElement("div", { key: "day-" + displayedMonthIndex + "-" + dayIndex, className: (0, classnames_1.default)('iui-
|
|
271
|
+
return (react_1.default.createElement("div", { key: "day-" + displayedMonthIndex + "-" + dayIndex, className: (0, classnames_1.default)('iui-calendar-day', {
|
|
273
272
|
'iui-outside-month': weekDay.getMonth() !== displayedMonthIndex,
|
|
274
273
|
'iui-today': isSameDay(weekDay, new Date()),
|
|
275
274
|
'iui-selected': isSameDay(weekDay, selectedDay),
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps, DropdownButtonProps } from '../Buttons';
|
|
3
|
+
import { PolymorphicForwardRefComponent } from '../utils';
|
|
3
4
|
import '@itwin/itwinui-css/css/header.css';
|
|
4
5
|
export declare type HeaderButtonProps = {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Main label of the header button.
|
|
7
8
|
*/
|
|
8
9
|
name: React.ReactNode;
|
|
9
10
|
/**
|
|
10
|
-
* Description shown below the
|
|
11
|
+
* Description shown below the main label, will be hidden in `Header` slim mode.
|
|
11
12
|
*/
|
|
12
13
|
description?: React.ReactNode;
|
|
13
14
|
/**
|
|
@@ -15,7 +16,8 @@ export declare type HeaderButtonProps = {
|
|
|
15
16
|
* @default false
|
|
16
17
|
*/
|
|
17
18
|
isActive?: boolean;
|
|
18
|
-
} &
|
|
19
|
+
} & Partial<Pick<DropdownButtonProps, 'menuItems'>> & Pick<ButtonProps, 'startIcon' | 'endIcon'>;
|
|
20
|
+
declare type HeaderButtonComponent = PolymorphicForwardRefComponent<'button', HeaderButtonProps>;
|
|
19
21
|
/**
|
|
20
22
|
* Header button that handles slim state of the `Header` it's in.
|
|
21
23
|
* When in slim mode, will only display the name and reduce icon size.
|
|
@@ -26,5 +28,5 @@ export declare type HeaderButtonProps = {
|
|
|
26
28
|
* <HeaderButton name='Project C' startIcon={<img style={{ objectFit: 'cover' }} src='project.png' />} />
|
|
27
29
|
* <HeaderButton name='Project D' isActive />
|
|
28
30
|
*/
|
|
29
|
-
export declare const HeaderButton:
|
|
31
|
+
export declare const HeaderButton: HeaderButtonComponent;
|
|
30
32
|
export default HeaderButton;
|
|
@@ -51,7 +51,7 @@ var isDropdownButton = function (props) {
|
|
|
51
51
|
* <HeaderButton name='Project C' startIcon={<img style={{ objectFit: 'cover' }} src='project.png' />} />
|
|
52
52
|
* <HeaderButton name='Project D' isActive />
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
exports.HeaderButton = react_1.default.forwardRef(function (props, ref) {
|
|
55
55
|
var name = props.name, description = props.description, _a = props.isActive, isActive = _a === void 0 ? false : _a, className = props.className, startIcon = props.startIcon, menuItems = props.menuItems, rest = __rest(props, ["name", "description", "isActive", "className", "startIcon", "menuItems"]);
|
|
56
56
|
(0, utils_1.useTheme)();
|
|
57
57
|
var buttonProps = __assign(__assign({ startIcon: react_1.default.isValidElement(startIcon)
|
|
@@ -64,7 +64,7 @@ var HeaderButton = function (props) {
|
|
|
64
64
|
'iui-active': isActive,
|
|
65
65
|
}, className), 'aria-current': isActive ? 'location' : undefined, children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
66
66
|
react_1.default.createElement("div", null, name),
|
|
67
|
-
description && react_1.default.createElement("div", { className: 'iui-description' }, description))) }, (!!menuItems && { menuItems: menuItems })), rest);
|
|
67
|
+
description && react_1.default.createElement("div", { className: 'iui-description' }, description))), ref: ref }, (!!menuItems && { menuItems: menuItems })), rest);
|
|
68
68
|
if (isSplitButton(buttonProps)) {
|
|
69
69
|
return react_1.default.createElement(Buttons_1.SplitButton, __assign({}, buttonProps));
|
|
70
70
|
}
|
|
@@ -72,6 +72,5 @@ var HeaderButton = function (props) {
|
|
|
72
72
|
return react_1.default.createElement(Buttons_1.DropdownButton, __assign({}, buttonProps));
|
|
73
73
|
}
|
|
74
74
|
return react_1.default.createElement(Buttons_1.Button, __assign({}, buttonProps));
|
|
75
|
-
};
|
|
76
|
-
exports.HeaderButton = HeaderButton;
|
|
75
|
+
});
|
|
77
76
|
exports.default = exports.HeaderButton;
|
|
@@ -84,7 +84,7 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
|
|
|
84
84
|
* - 'inline' - appears in the same line as input.
|
|
85
85
|
* @default 'default'
|
|
86
86
|
*/
|
|
87
|
-
displayStyle?: "
|
|
87
|
+
displayStyle?: "default" | "inline" | undefined;
|
|
88
88
|
/**
|
|
89
89
|
* Set display style of icon.
|
|
90
90
|
* Supported values:
|
package/cjs/core/Modal/Modal.js
CHANGED
|
@@ -110,13 +110,16 @@ var Modal = function (props) {
|
|
|
110
110
|
var handleMouseDown = function (event) {
|
|
111
111
|
// Prevents React from resetting its properties
|
|
112
112
|
event.persist();
|
|
113
|
+
if (event.target !== overlayRef.current) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
113
116
|
if (isDismissible && closeOnExternalClick && onClose) {
|
|
114
117
|
onClose(event);
|
|
115
118
|
}
|
|
116
119
|
};
|
|
117
120
|
return !!container ? (react_dom_1.default.createPortal(isOpen && (react_1.default.createElement(utils_1.FocusTrap, null,
|
|
118
121
|
react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-modal', 'iui-modal-visible', className), tabIndex: -1, onKeyDown: handleKeyDown, ref: overlayRef, onMouseDown: handleMouseDown }, rest),
|
|
119
|
-
react_1.default.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true'
|
|
122
|
+
react_1.default.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true' },
|
|
120
123
|
react_1.default.createElement("div", { className: 'iui-title-bar' },
|
|
121
124
|
react_1.default.createElement("div", { className: 'iui-title' }, title),
|
|
122
125
|
isDismissible && (react_1.default.createElement(IconButton_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PolymorphicForwardRefComponent } from '../utils';
|
|
2
2
|
import { ButtonProps } from '../Buttons';
|
|
3
3
|
import '@itwin/itwinui-css/css/side-navigation.css';
|
|
4
4
|
export declare type SidenavButtonProps = {
|
|
@@ -13,20 +13,10 @@ export declare type SidenavButtonProps = {
|
|
|
13
13
|
*/
|
|
14
14
|
isSubmenuOpen?: boolean;
|
|
15
15
|
} & Omit<ButtonProps, 'styleType' | 'size'>;
|
|
16
|
+
declare type SideNavButtonComponent = PolymorphicForwardRefComponent<'button', SidenavButtonProps>;
|
|
16
17
|
/**
|
|
17
18
|
* Wrapper around Button to be used as SideNavigation items.
|
|
18
19
|
* Label is hidden when sidenav is collapsed.
|
|
19
20
|
*/
|
|
20
|
-
export declare const SidenavButton:
|
|
21
|
-
/**
|
|
22
|
-
* Whether the sidenav button is active,
|
|
23
|
-
* i.e. the current page corresponds to this button.
|
|
24
|
-
*/
|
|
25
|
-
isActive?: boolean | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Whether the sidenav button only has submenu open,
|
|
28
|
-
* i.e. submenu is open but the current page does not correspond to this button.
|
|
29
|
-
*/
|
|
30
|
-
isSubmenuOpen?: boolean | undefined;
|
|
31
|
-
} & Omit<ButtonProps, "size" | "styleType"> & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
export declare const SidenavButton: SideNavButtonComponent;
|
|
32
22
|
export default SidenavButton;
|
|
@@ -155,6 +155,11 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
|
|
|
155
155
|
* @default false
|
|
156
156
|
*/
|
|
157
157
|
isResizable?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Style of the table.
|
|
160
|
+
* @default 'default'
|
|
161
|
+
*/
|
|
162
|
+
styleType?: 'default' | 'zebra-rows';
|
|
158
163
|
} & Omit<CommonProps, 'title'>;
|
|
159
164
|
/**
|
|
160
165
|
* Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -93,9 +93,9 @@ var tableResizeEndAction = 'tableResizeEnd';
|
|
|
93
93
|
*/
|
|
94
94
|
var Table = function (props) {
|
|
95
95
|
var _a;
|
|
96
|
-
var data = props.data, columns = props.columns, _b = props.isLoading, isLoading = _b === void 0 ? false : _b, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _c = props.isSelectable, isSelectable = _c === void 0 ? false : _c, onSelect = props.onSelect, onRowClick = props.onRowClick, _d = props.isSortable, isSortable = _d === void 0 ? false : _d, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _e = props.intersectionMargin, intersectionMargin = _e === void 0 ? 300 : _e, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _f = props.density, density = _f === void 0 ? 'default' : _f, _g = props.selectSubRows, selectSubRows = _g === void 0 ? true : _g, getSubRows = props.getSubRows, _h = props.selectRowOnClick, selectRowOnClick = _h === void 0 ? true : _h, paginatorRenderer = props.paginatorRenderer, _j = props.pageSize, pageSize = _j === void 0 ? 25 : _j, _k = props.isResizable, isResizable = _k === void 0 ? false : _k, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable"]);
|
|
96
|
+
var data = props.data, columns = props.columns, _b = props.isLoading, isLoading = _b === void 0 ? false : _b, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _c = props.isSelectable, isSelectable = _c === void 0 ? false : _c, onSelect = props.onSelect, onRowClick = props.onRowClick, _d = props.isSortable, isSortable = _d === void 0 ? false : _d, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _e = props.intersectionMargin, intersectionMargin = _e === void 0 ? 300 : _e, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _f = props.density, density = _f === void 0 ? 'default' : _f, _g = props.selectSubRows, selectSubRows = _g === void 0 ? true : _g, getSubRows = props.getSubRows, _h = props.selectRowOnClick, selectRowOnClick = _h === void 0 ? true : _h, paginatorRenderer = props.paginatorRenderer, _j = props.pageSize, pageSize = _j === void 0 ? 25 : _j, _k = props.isResizable, isResizable = _k === void 0 ? false : _k, _l = props.styleType, styleType = _l === void 0 ? 'default' : _l, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType"]);
|
|
97
97
|
(0, utils_1.useTheme)();
|
|
98
|
-
var
|
|
98
|
+
var _m = react_1.default.useState(), ownerDocument = _m[0], setOwnerDocument = _m[1];
|
|
99
99
|
var defaultColumn = react_1.default.useMemo(function () { return ({
|
|
100
100
|
maxWidth: 0,
|
|
101
101
|
minWidth: 0,
|
|
@@ -231,6 +231,8 @@ var Table = function (props) {
|
|
|
231
231
|
dispatch({ type: tableResizeEndAction, columnWidths: newColumnWidths_1 });
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
|
+
var headerRef = react_1.default.useRef(null);
|
|
235
|
+
var bodyRef = react_1.default.useRef(null);
|
|
234
236
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
235
237
|
react_1.default.createElement("div", __assign({ ref: function (element) {
|
|
236
238
|
setOwnerDocument(element === null || element === void 0 ? void 0 : element.ownerDocument);
|
|
@@ -241,7 +243,7 @@ var Table = function (props) {
|
|
|
241
243
|
className: (0, classnames_1.default)('iui-table', (_a = {}, _a["iui-" + density] = density !== 'default', _a), className),
|
|
242
244
|
style: style,
|
|
243
245
|
}), ariaDataAttributes),
|
|
244
|
-
react_1.default.createElement("div", { className: 'iui-table-header' }, headerGroups.slice(1).map(function (headerGroup) {
|
|
246
|
+
react_1.default.createElement("div", { className: 'iui-table-header', ref: headerRef }, headerGroups.slice(1).map(function (headerGroup) {
|
|
245
247
|
var headerGroupProps = headerGroup.getHeaderGroupProps({
|
|
246
248
|
className: 'iui-row',
|
|
247
249
|
});
|
|
@@ -264,8 +266,14 @@ var Table = function (props) {
|
|
|
264
266
|
})));
|
|
265
267
|
})),
|
|
266
268
|
react_1.default.createElement("div", __assign({}, getTableBodyProps({
|
|
267
|
-
className: 'iui-table-body',
|
|
268
|
-
|
|
269
|
+
className: (0, classnames_1.default)('iui-table-body', {
|
|
270
|
+
'iui-zebra-striping': styleType === 'zebra-rows',
|
|
271
|
+
}),
|
|
272
|
+
}), { ref: bodyRef, onScroll: function () {
|
|
273
|
+
if (headerRef.current && bodyRef.current) {
|
|
274
|
+
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
275
|
+
}
|
|
276
|
+
} }),
|
|
269
277
|
data.length !== 0 &&
|
|
270
278
|
page.map(function (row) {
|
|
271
279
|
prepareRow(row);
|