@itwin/itwinui-react 1.36.0 → 1.37.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 +27 -0
- package/cjs/core/Alert/Alert.js +1 -1
- package/cjs/core/Badge/Badge.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/cjs/core/Buttons/Button/Button.js +2 -2
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -2
- package/cjs/core/Carousel/Carousel.js +1 -1
- package/cjs/core/Carousel/CarouselDotsList.js +1 -1
- package/cjs/core/Carousel/CarouselSlider.js +1 -1
- package/cjs/core/Checkbox/Checkbox.js +1 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +3 -3
- package/cjs/core/ColorPicker/ColorInputPanel.js +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +1 -1
- package/cjs/core/ComboBox/ComboBox.js +9 -6
- package/cjs/core/DatePicker/DatePicker.js +2 -2
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/cjs/core/Footer/Footer.js +2 -2
- package/cjs/core/Header/HeaderBreadcrumbs.js +1 -1
- package/cjs/core/Header/HeaderButton.js +1 -0
- package/cjs/core/InformationPanel/InformationPanel.js +2 -2
- package/cjs/core/Input/Input.js +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/cjs/core/Radio/Radio.js +1 -1
- package/cjs/core/Select/Select.js +3 -3
- package/cjs/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +50 -0
- package/cjs/core/SkipToContentLink/index.d.ts +4 -0
- package/cjs/core/SkipToContentLink/index.js +10 -0
- package/cjs/core/Slider/Slider.js +1 -1
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/Slider/Track.js +1 -1
- package/cjs/core/Surface/Surface.d.ts +32 -0
- package/cjs/core/Surface/Surface.js +70 -0
- package/cjs/core/Surface/index.d.ts +4 -0
- package/cjs/core/Surface/index.js +10 -0
- package/cjs/core/Table/Table.d.ts +6 -0
- package/cjs/core/Table/Table.js +34 -12
- package/cjs/core/Table/TablePaginator.js +6 -6
- package/cjs/core/Table/TableRowMemoized.js +1 -1
- package/cjs/core/Table/cells/EditableCell.js +2 -1
- package/cjs/core/Table/columns/actionColumn.js +2 -2
- package/cjs/core/Table/hooks/useSelectionCell.d.ts +1 -1
- package/cjs/core/Table/hooks/useSelectionCell.js +3 -2
- package/cjs/core/Table/utils.js +5 -5
- package/cjs/core/Tabs/Tabs.d.ts +1 -1
- package/cjs/core/Tabs/Tabs.js +7 -8
- package/cjs/core/Tag/Tag.js +6 -3
- package/cjs/core/Tag/TagContainer.js +1 -1
- package/cjs/core/Tile/Tile.d.ts +6 -2
- package/cjs/core/Tile/Tile.js +8 -3
- package/cjs/core/Toast/Toast.js +2 -2
- package/cjs/core/Toast/ToastWrapper.js +1 -1
- package/cjs/core/Tree/TreeNode.js +2 -2
- package/cjs/core/Typography/Text/Text.js +1 -1
- package/cjs/core/UserIcon/UserIcon.js +2 -2
- package/cjs/core/UserIconGroup/UserIconGroup.js +3 -3
- package/cjs/core/Wizard/Step.js +1 -1
- package/cjs/core/Wizard/Wizard.js +1 -1
- package/cjs/core/index.d.ts +4 -0
- package/cjs/core/index.js +6 -2
- package/cjs/core/utils/color/ColorValue.js +11 -11
- package/cjs/core/utils/color/index.js +5 -1
- package/cjs/core/utils/components/FocusTrap.js +6 -8
- package/cjs/core/utils/components/InputContainer.js +1 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
- package/cjs/core/utils/components/VirtualScroll.js +1 -1
- package/cjs/core/utils/components/WithCSSTransition.js +5 -5
- package/cjs/core/utils/components/index.js +5 -1
- package/cjs/core/utils/functions/focusable.js +1 -1
- package/cjs/core/utils/functions/index.js +5 -1
- package/cjs/core/utils/hooks/index.js +5 -1
- package/cjs/core/utils/hooks/useOverflow.js +3 -3
- package/cjs/core/utils/hooks/useTheme.js +1 -1
- package/cjs/core/utils/index.js +5 -1
- package/cjs/index.js +5 -1
- package/esm/core/Alert/Alert.js +1 -1
- package/esm/core/Badge/Badge.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/esm/core/Buttons/Button/Button.js +2 -2
- package/esm/core/Buttons/IconButton/IconButton.js +2 -2
- package/esm/core/Carousel/Carousel.js +1 -1
- package/esm/core/Carousel/CarouselDotsList.js +1 -1
- package/esm/core/Carousel/CarouselSlider.js +1 -1
- package/esm/core/Checkbox/Checkbox.js +1 -1
- package/esm/core/ColorPicker/ColorBuilder.js +3 -3
- package/esm/core/ColorPicker/ColorInputPanel.js +1 -1
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +1 -1
- package/esm/core/ComboBox/ComboBox.js +9 -6
- package/esm/core/DatePicker/DatePicker.js +2 -2
- package/esm/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/esm/core/Footer/Footer.js +2 -2
- package/esm/core/Header/HeaderBreadcrumbs.js +1 -1
- package/esm/core/Header/HeaderButton.js +1 -0
- package/esm/core/InformationPanel/InformationPanel.js +2 -2
- package/esm/core/Input/Input.js +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/esm/core/Radio/Radio.js +1 -1
- package/esm/core/Select/Select.js +3 -3
- package/esm/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
- package/esm/core/SkipToContentLink/SkipToContentLink.js +44 -0
- package/esm/core/SkipToContentLink/index.d.ts +4 -0
- package/esm/core/SkipToContentLink/index.js +6 -0
- package/esm/core/Slider/Slider.js +1 -1
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/Slider/Track.js +1 -1
- package/esm/core/Surface/Surface.d.ts +32 -0
- package/esm/core/Surface/Surface.js +64 -0
- package/esm/core/Surface/index.d.ts +4 -0
- package/esm/core/Surface/index.js +6 -0
- package/esm/core/Table/Table.d.ts +6 -0
- package/esm/core/Table/Table.js +34 -12
- package/esm/core/Table/TablePaginator.js +6 -6
- package/esm/core/Table/TableRowMemoized.js +1 -1
- package/esm/core/Table/cells/EditableCell.js +2 -1
- package/esm/core/Table/columns/actionColumn.js +2 -2
- package/esm/core/Table/hooks/useSelectionCell.d.ts +1 -1
- package/esm/core/Table/hooks/useSelectionCell.js +3 -2
- package/esm/core/Table/utils.js +5 -5
- package/esm/core/Tabs/Tabs.d.ts +1 -1
- package/esm/core/Tabs/Tabs.js +7 -8
- package/esm/core/Tag/Tag.js +6 -3
- package/esm/core/Tag/TagContainer.js +1 -1
- package/esm/core/Tile/Tile.d.ts +6 -2
- package/esm/core/Tile/Tile.js +8 -3
- package/esm/core/Toast/Toast.js +2 -2
- package/esm/core/Toast/ToastWrapper.js +1 -1
- package/esm/core/Tree/TreeNode.js +2 -2
- package/esm/core/Typography/Text/Text.js +1 -1
- package/esm/core/UserIcon/UserIcon.js +2 -2
- package/esm/core/UserIconGroup/UserIconGroup.js +3 -3
- package/esm/core/Wizard/Step.js +1 -1
- package/esm/core/Wizard/Wizard.js +1 -1
- package/esm/core/index.d.ts +4 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/color/ColorValue.js +11 -11
- package/esm/core/utils/components/FocusTrap.js +6 -8
- package/esm/core/utils/components/InputContainer.js +1 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
- package/esm/core/utils/components/VirtualScroll.js +1 -1
- package/esm/core/utils/components/WithCSSTransition.js +5 -5
- package/esm/core/utils/functions/focusable.js +1 -1
- package/esm/core/utils/hooks/useOverflow.js +3 -3
- package/esm/core/utils/hooks/useTheme.js +1 -1
- package/package.json +22 -21
|
@@ -64,7 +64,7 @@ export var Footer = function (props) {
|
|
|
64
64
|
var defaultElements = [
|
|
65
65
|
{
|
|
66
66
|
key: 'copyright',
|
|
67
|
-
title: "\u00A9 "
|
|
67
|
+
title: "\u00A9 ".concat(new Date().getFullYear(), " Bentley Systems, Incorporated"),
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
key: 'termsOfService',
|
|
@@ -101,7 +101,7 @@ export var Footer = function (props) {
|
|
|
101
101
|
}
|
|
102
102
|
return (React.createElement("footer", __assign({ className: cx('iui-legal-footer', className) }, rest),
|
|
103
103
|
React.createElement("ul", null, elements.map(function (element, index) {
|
|
104
|
-
return (React.createElement("li", { key: element.key || element.title
|
|
104
|
+
return (React.createElement("li", { key: element.key || "".concat(element.title, "-").concat(index) },
|
|
105
105
|
index > 0 && React.createElement("span", { className: 'iui-separator' }),
|
|
106
106
|
element.url ? (React.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title)));
|
|
107
107
|
}))));
|
|
@@ -52,7 +52,7 @@ export var HeaderBreadcrumbs = function (props) {
|
|
|
52
52
|
useTheme();
|
|
53
53
|
return (React.createElement("nav", __assign({ "aria-label": 'breadcrumbs' }, rest), items.reduce(function (previous, current, index) { return __spreadArray(__spreadArray([], previous, true), [
|
|
54
54
|
current,
|
|
55
|
-
index !== items.length - 1 && (React.createElement(SvgChevronRight, { key: "chevron"
|
|
55
|
+
index !== items.length - 1 && (React.createElement(SvgChevronRight, { key: "chevron".concat(index), "aria-hidden": true, className: 'iui-chevron' })),
|
|
56
56
|
], false); }, [])));
|
|
57
57
|
};
|
|
58
58
|
export default HeaderBreadcrumbs;
|
|
@@ -55,6 +55,7 @@ export var HeaderButton = React.forwardRef(function (props, ref) {
|
|
|
55
55
|
: undefined, styleType: 'borderless', className: cx({
|
|
56
56
|
'iui-header-button': !isSplitButton(props),
|
|
57
57
|
'iui-header-split-button': isSplitButton(props),
|
|
58
|
+
'iui-header-dropdown-button': !isSplitButton(props) && isDropdownButton(props),
|
|
58
59
|
'iui-active': isActive,
|
|
59
60
|
}, className), 'aria-current': isActive ? 'location' : undefined, children: (React.createElement(React.Fragment, null,
|
|
60
61
|
React.createElement("div", null, name),
|
|
@@ -76,10 +76,10 @@ export var InformationPanel = React.forwardRef(function (props, ref) {
|
|
|
76
76
|
}
|
|
77
77
|
var _a = infoPanelRef.current.getBoundingClientRect(), right = _a.right, bottom = _a.bottom;
|
|
78
78
|
if (orientation === 'vertical') {
|
|
79
|
-
infoPanelRef.current.style.width = right - e.clientX
|
|
79
|
+
infoPanelRef.current.style.width = "".concat(right - e.clientX, "px");
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
infoPanelRef.current.style.height = bottom - e.clientY
|
|
82
|
+
infoPanelRef.current.style.height = "".concat(bottom - e.clientY, "px");
|
|
83
83
|
}
|
|
84
84
|
}, [orientation]);
|
|
85
85
|
return (React.createElement("div", __assign({ className: cx('iui-information-panel', {
|
package/esm/core/Input/Input.js
CHANGED
|
@@ -46,6 +46,6 @@ export var Input = React.forwardRef(function (props, ref) {
|
|
|
46
46
|
inputRef.current.focus();
|
|
47
47
|
}
|
|
48
48
|
}, [setFocus]);
|
|
49
|
-
return (React.createElement("input", __assign({ className: cx('iui-input', (_a = {}, _a["iui-"
|
|
49
|
+
return (React.createElement("input", __assign({ className: cx('iui-input', (_a = {}, _a["iui-".concat(size)] = !!size, _a), className), ref: refs }, rest)));
|
|
50
50
|
});
|
|
51
51
|
export default Input;
|
|
@@ -15,7 +15,7 @@ export declare type ProgressLinearProps = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Labels array. One label will be centered, two will be put to the sides.
|
|
17
17
|
*/
|
|
18
|
-
labels?: React.
|
|
18
|
+
labels?: React.ReactNode[];
|
|
19
19
|
/**
|
|
20
20
|
* Apply animation to the value change, if determinate.
|
|
21
21
|
* @default false
|
|
@@ -49,13 +49,13 @@ export var ProgressLinear = function (props) {
|
|
|
49
49
|
useTheme();
|
|
50
50
|
var boundedValue = Math.min(100, Math.max(0, value));
|
|
51
51
|
return (React.createElement("div", __assign({ className: cx('iui-progress-indicator-linear', (_a = {},
|
|
52
|
-
_a["iui-"
|
|
52
|
+
_a["iui-".concat(status)] = !!status,
|
|
53
53
|
_a), className), style: style }, rest),
|
|
54
54
|
React.createElement("div", { className: 'iui-track' },
|
|
55
55
|
React.createElement("div", { className: cx('iui-fill', {
|
|
56
56
|
'iui-determinate': !indeterminate && isAnimated,
|
|
57
57
|
'iui-indeterminate': indeterminate,
|
|
58
|
-
}), style: { width: indeterminate ? '100%' : boundedValue
|
|
58
|
+
}), style: { width: indeterminate ? '100%' : "".concat(boundedValue, "%") } })),
|
|
59
59
|
labels.length > 0 && (React.createElement("div", { className: 'iui-label' }, labels.map(function (label, index) { return (React.createElement("span", { key: index }, label)); })))));
|
|
60
60
|
};
|
|
61
61
|
export default ProgressLinear;
|
|
@@ -63,8 +63,8 @@ export var ProgressRadial = function (props) {
|
|
|
63
63
|
'iui-determinate': !indeterminate,
|
|
64
64
|
'iui-indeterminate': indeterminate
|
|
65
65
|
},
|
|
66
|
-
_a["iui-"
|
|
67
|
-
_a["iui-"
|
|
66
|
+
_a["iui-".concat(size)] = !!size,
|
|
67
|
+
_a["iui-".concat(status)] = !!status,
|
|
68
68
|
_a), className), style: style }, rest),
|
|
69
69
|
React.createElement("svg", { className: 'iui-radial', viewBox: '0 0 32 32', "aria-hidden": 'true' },
|
|
70
70
|
React.createElement("circle", { className: 'iui-track', cx: '16', cy: '16', r: '14' }),
|
package/esm/core/Radio/Radio.js
CHANGED
|
@@ -50,7 +50,7 @@ export var Radio = React.forwardRef(function (props, ref) {
|
|
|
50
50
|
}
|
|
51
51
|
}, [setFocus]);
|
|
52
52
|
var radio = (React.createElement("input", __assign({ className: cx('iui-radio', className && (_a = {}, _a[className] = !label, _a), checkmarkClassName), style: __assign(__assign({}, (!label && style)), checkmarkStyle), disabled: disabled, type: 'radio', ref: refs }, rest)));
|
|
53
|
-
return !label ? (radio) : (React.createElement("label", { className: cx('iui-radio-wrapper', (_b = { 'iui-disabled': disabled }, _b["iui-"
|
|
53
|
+
return !label ? (radio) : (React.createElement("label", { className: cx('iui-radio-wrapper', (_b = { 'iui-disabled': disabled }, _b["iui-".concat(status)] = !!status, _b), className), style: style },
|
|
54
54
|
radio,
|
|
55
55
|
label && React.createElement("span", { className: 'iui-radio-label' }, label)));
|
|
56
56
|
});
|
|
@@ -127,7 +127,7 @@ export var Select = function (props) {
|
|
|
127
127
|
return options.map(function (option, index) {
|
|
128
128
|
var isSelected = value === option.value;
|
|
129
129
|
var menuItem = itemRenderer ? (itemRenderer(option, { close: close, isSelected: isSelected })) : (React.createElement(MenuItem, null, option.label));
|
|
130
|
-
return React.cloneElement(menuItem, __assign(__assign({ key: option.label
|
|
130
|
+
return React.cloneElement(menuItem, __assign(__assign({ key: "".concat(option.label, "-").concat(index), isSelected: isSelected, onClick: function () {
|
|
131
131
|
!option.disabled && (onChange === null || onChange === void 0 ? void 0 : onChange(option.value));
|
|
132
132
|
close();
|
|
133
133
|
}, ref: function (el) { return isSelected && (el === null || el === void 0 ? void 0 : el.scrollIntoView()); }, role: 'option' }, option), menuItem.props));
|
|
@@ -140,7 +140,7 @@ export var Select = function (props) {
|
|
|
140
140
|
return options.find(function (option) { return option.value === value; });
|
|
141
141
|
}, [options, value]);
|
|
142
142
|
return (React.createElement("div", __assign({ className: cx('iui-input-with-icon', className), "aria-expanded": isOpen, "aria-haspopup": 'listbox', style: style }, rest),
|
|
143
|
-
React.createElement(DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: cx('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min("
|
|
143
|
+
React.createElement(DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: cx('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min(".concat(minWidth * 2, "px, 90vw)"), maxHeight: "300px" }, menuStyle), role: 'listbox', onShow: onShowHandler, onHide: onHideHandler, disabled: disabled }, popoverProps, { visible: isOpen, onClickOutside: function (_, _a) {
|
|
144
144
|
var _b;
|
|
145
145
|
var target = _a.target;
|
|
146
146
|
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
@@ -151,7 +151,7 @@ export var Select = function (props) {
|
|
|
151
151
|
'iui-placeholder': !selectedItem && !!placeholder,
|
|
152
152
|
'iui-disabled': disabled
|
|
153
153
|
},
|
|
154
|
-
_a["iui-"
|
|
154
|
+
_a["iui-".concat(size)] = !!size,
|
|
155
155
|
_a)), onClick: function () { return !disabled && toggle(); }, onKeyDown: function (e) { return !disabled && onKeyDown(e, toggle); }, tabIndex: !disabled ? 0 : undefined },
|
|
156
156
|
!selectedItem && React.createElement("span", { className: 'iui-content' }, placeholder),
|
|
157
157
|
selectedItem &&
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/skip-to-content.css';
|
|
3
|
+
export declare type SkipToContentLinkProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The id of the main content that the link directs to. Don't forget the #!
|
|
6
|
+
*/
|
|
7
|
+
href: string;
|
|
8
|
+
/**
|
|
9
|
+
* Localize 'Skip to main content' label.
|
|
10
|
+
* @default 'Skip to main content'
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
} & Omit<React.ComponentPropsWithoutRef<'a'>, 'href'>;
|
|
14
|
+
/**
|
|
15
|
+
* `SkipToContentLink` is for screen reader and keyboard users and will not be visible unless tabbed to.
|
|
16
|
+
* Provides a shortcut to the main content of the page without navigating through the header, etc.
|
|
17
|
+
* Should be placed just inside the body. Set `href` to the id of your main content component. Don't forget the `#`!
|
|
18
|
+
* @example
|
|
19
|
+
* <body><SkipToContentLink href='#main-content-id' /> ... </body>
|
|
20
|
+
* <body><SkipToContentLink href='#main-content-id'>{localizedLabel}</SkipToContentLink> ... </body>
|
|
21
|
+
*/
|
|
22
|
+
export declare const SkipToContentLink: React.ForwardRefExoticComponent<{
|
|
23
|
+
/**
|
|
24
|
+
* The id of the main content that the link directs to. Don't forget the #!
|
|
25
|
+
*/
|
|
26
|
+
href: string;
|
|
27
|
+
/**
|
|
28
|
+
* Localize 'Skip to main content' label.
|
|
29
|
+
* @default 'Skip to main content'
|
|
30
|
+
*/
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
} & Omit<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>>, "href"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
33
|
+
export default SkipToContentLink;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { useTheme } from '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/skip-to-content.css';
|
|
31
|
+
/**
|
|
32
|
+
* `SkipToContentLink` is for screen reader and keyboard users and will not be visible unless tabbed to.
|
|
33
|
+
* Provides a shortcut to the main content of the page without navigating through the header, etc.
|
|
34
|
+
* Should be placed just inside the body. Set `href` to the id of your main content component. Don't forget the `#`!
|
|
35
|
+
* @example
|
|
36
|
+
* <body><SkipToContentLink href='#main-content-id' /> ... </body>
|
|
37
|
+
* <body><SkipToContentLink href='#main-content-id'>{localizedLabel}</SkipToContentLink> ... </body>
|
|
38
|
+
*/
|
|
39
|
+
export var SkipToContentLink = React.forwardRef(function (props, ref) {
|
|
40
|
+
var _a = props.children, children = _a === void 0 ? 'Skip to main content' : _a, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
41
|
+
useTheme();
|
|
42
|
+
return (React.createElement("a", __assign({ ref: ref, className: cx('iui-skip-to-content-link', className) }, rest), children));
|
|
43
|
+
});
|
|
44
|
+
export default SkipToContentLink;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export { SkipToContentLink } from './SkipToContentLink';
|
|
6
|
+
export default './SkipToContentLink';
|
|
@@ -74,7 +74,7 @@ var focusThumb = function (sliderContainer, activeIndex) {
|
|
|
74
74
|
var doc = sliderContainer.ownerDocument;
|
|
75
75
|
if (!sliderContainer.contains(doc.activeElement) ||
|
|
76
76
|
Number((_a = doc.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute('data-index')) !== activeIndex) {
|
|
77
|
-
var thumbToFocus = sliderContainer.querySelector("[data-index=\""
|
|
77
|
+
var thumbToFocus = sliderContainer.querySelector("[data-index=\"".concat(activeIndex, "\"]"));
|
|
78
78
|
thumbToFocus && thumbToFocus.focus();
|
|
79
79
|
}
|
|
80
80
|
};
|
package/esm/core/Slider/Thumb.js
CHANGED
|
@@ -67,5 +67,5 @@ export var Thumb = function (props) {
|
|
|
67
67
|
var leftPercent = (100.0 * (value - sliderMin)) / (sliderMax - sliderMin);
|
|
68
68
|
var _c = thumbProps || {}, style = _c.style, className = _c.className, rest = __rest(_c, ["style", "className"]);
|
|
69
69
|
return (React.createElement(Tooltip, __assign({ visible: isActive || hasFocus || isHovered, placement: 'top' }, tooltipProps),
|
|
70
|
-
React.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), { left: leftPercent
|
|
70
|
+
React.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), { left: "".concat(leftPercent, "%") }), className: cx('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
|
|
71
71
|
};
|
package/esm/core/Slider/Track.js
CHANGED
|
@@ -49,6 +49,6 @@ export var Track = function (props) {
|
|
|
49
49
|
var leftPercent = (100.0 * (segment.left - sliderMin)) / (sliderMax - sliderMin);
|
|
50
50
|
var rightPercent = (100.0 * (segment.right - sliderMin)) / (sliderMax - sliderMin);
|
|
51
51
|
rightPercent = 100.0 - rightPercent;
|
|
52
|
-
return (React.createElement(React.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (React.createElement("div", { className: 'iui-slider-track', style: { left: leftPercent
|
|
52
|
+
return (React.createElement(React.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (React.createElement("div", { className: 'iui-slider-track', style: { left: "".concat(leftPercent, "%"), right: "".concat(rightPercent, "%") } })) : null));
|
|
53
53
|
})));
|
|
54
54
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '../utils';
|
|
3
|
+
import '@itwin/itwinui-css/css/surface.css';
|
|
4
|
+
export declare type SurfaceProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Sets the elevation of the surface
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
|
+
/**
|
|
11
|
+
* Content in the surface.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
} & Omit<CommonProps, 'title'>;
|
|
15
|
+
/**
|
|
16
|
+
* The Surface container allows content to appear elevated through the use of a drop shadow
|
|
17
|
+
* @example
|
|
18
|
+
* <Surface>Surface Content</Surface>
|
|
19
|
+
* <Surface elevation={2}>Surface Content</Surface>
|
|
20
|
+
*/
|
|
21
|
+
export declare const Surface: React.ForwardRefExoticComponent<{
|
|
22
|
+
/**
|
|
23
|
+
* Sets the elevation of the surface
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Content in the surface.
|
|
29
|
+
*/
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
} & Omit<CommonProps, "title"> & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export default Surface;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { useTheme, getWindow } from '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/surface.css';
|
|
31
|
+
/**
|
|
32
|
+
* Helper function that returns one of the preset surface elevation values.
|
|
33
|
+
*/
|
|
34
|
+
var getSurfaceElevationValue = function (elevation) {
|
|
35
|
+
switch (elevation) {
|
|
36
|
+
case 1:
|
|
37
|
+
return '0 1px 5px rgba(0, 0, 0, 0.25)';
|
|
38
|
+
case 2:
|
|
39
|
+
return '0 1px 10px rgba(0, 0, 0, 0.25)';
|
|
40
|
+
case 3:
|
|
41
|
+
return '0 3px 14px rgba(0, 0, 0, 0.25)';
|
|
42
|
+
case 4:
|
|
43
|
+
return '0 6px 30px rgba(0, 0, 0, 0.25)';
|
|
44
|
+
case 5:
|
|
45
|
+
return '0 9px 46px rgba(0, 0, 0, 0.25)';
|
|
46
|
+
default:
|
|
47
|
+
return 'none';
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The Surface container allows content to appear elevated through the use of a drop shadow
|
|
52
|
+
* @example
|
|
53
|
+
* <Surface>Surface Content</Surface>
|
|
54
|
+
* <Surface elevation={2}>Surface Content</Surface>
|
|
55
|
+
*/
|
|
56
|
+
export var Surface = React.forwardRef(function (props, ref) {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
var _d = props.elevation, elevation = _d === void 0 ? 0 : _d, className = props.className, style = props.style, children = props.children, rest = __rest(props, ["elevation", "className", "style", "children"]);
|
|
59
|
+
useTheme();
|
|
60
|
+
var _style = ((_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, "--iui-surface-elevation: ".concat(getSurfaceElevationValue(elevation))))
|
|
61
|
+
? __assign({ '--iui-surface-elevation': getSurfaceElevationValue(elevation) }, style) : __assign({ boxShadow: getSurfaceElevationValue(elevation) }, style);
|
|
62
|
+
return (React.createElement("div", __assign({ className: cx('iui-surface', className), style: _style, ref: ref }, rest), children));
|
|
63
|
+
});
|
|
64
|
+
export default Surface;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export { Surface } from './Surface';
|
|
6
|
+
export default './Surface';
|
|
@@ -64,6 +64,12 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
|
|
|
64
64
|
* Handler for when a row is clicked. Must be memoized.
|
|
65
65
|
*/
|
|
66
66
|
onRowClick?: (event: React.MouseEvent, row: Row<T>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Modify the selection mode of the table.
|
|
69
|
+
* The column with checkboxes will not be present with 'single' selection mode.
|
|
70
|
+
* @default 'multi'
|
|
71
|
+
*/
|
|
72
|
+
selectionMode?: 'multi' | 'single';
|
|
67
73
|
/**
|
|
68
74
|
* Flag whether table columns can be sortable.
|
|
69
75
|
* @default false
|
package/esm/core/Table/Table.js
CHANGED
|
@@ -43,6 +43,16 @@ import { SELECTION_CELL_ID } from './columns';
|
|
|
43
43
|
var singleRowSelectedAction = 'singleRowSelected';
|
|
44
44
|
export var tableResizeStartAction = 'tableResizeStart';
|
|
45
45
|
var tableResizeEndAction = 'tableResizeEnd';
|
|
46
|
+
var flattenColumns = function (columns) {
|
|
47
|
+
var flatColumns = [];
|
|
48
|
+
columns.forEach(function (column) {
|
|
49
|
+
flatColumns.push(column);
|
|
50
|
+
if (column.columns) {
|
|
51
|
+
flatColumns.push.apply(flatColumns, flattenColumns(column.columns));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return flatColumns;
|
|
55
|
+
};
|
|
46
56
|
/**
|
|
47
57
|
* Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
|
|
48
58
|
* @example
|
|
@@ -87,8 +97,7 @@ var tableResizeEndAction = 'tableResizeEnd';
|
|
|
87
97
|
*/
|
|
88
98
|
export var Table = function (props) {
|
|
89
99
|
var _a;
|
|
90
|
-
var _b;
|
|
91
|
-
var data = props.data, columns = props.columns, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _d = props.isSelectable, isSelectable = _d === void 0 ? false : _d, onSelect = props.onSelect, onRowClick = props.onRowClick, _e = props.isSortable, isSortable = _e === void 0 ? false : _e, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _f = props.intersectionMargin, intersectionMargin = _f === void 0 ? 300 : _f, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _g = props.density, density = _g === void 0 ? 'default' : _g, _h = props.selectSubRows, selectSubRows = _h === void 0 ? true : _h, getSubRows = props.getSubRows, _j = props.selectRowOnClick, selectRowOnClick = _j === void 0 ? true : _j, paginatorRenderer = props.paginatorRenderer, _k = props.pageSize, pageSize = _k === void 0 ? 25 : _k, _l = props.isResizable, isResizable = _l === void 0 ? false : _l, _m = props.styleType, styleType = _m === void 0 ? 'default' : _m, _o = props.enableVirtualization, enableVirtualization = _o === void 0 ? false : _o, _p = props.enableColumnReordering, enableColumnReordering = _p === void 0 ? false : _p, 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", "enableVirtualization", "enableColumnReordering"]);
|
|
100
|
+
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.selectionMode, selectionMode = _d === void 0 ? 'multi' : _d, _e = props.isSortable, isSortable = _e === void 0 ? false : _e, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _f = props.intersectionMargin, intersectionMargin = _f === void 0 ? 300 : _f, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _g = props.density, density = _g === void 0 ? 'default' : _g, _h = props.selectSubRows, selectSubRows = _h === void 0 ? true : _h, getSubRows = props.getSubRows, _j = props.selectRowOnClick, selectRowOnClick = _j === void 0 ? true : _j, paginatorRenderer = props.paginatorRenderer, _k = props.pageSize, pageSize = _k === void 0 ? 25 : _k, _l = props.isResizable, isResizable = _l === void 0 ? false : _l, _m = props.styleType, styleType = _m === void 0 ? 'default' : _m, _o = props.enableVirtualization, enableVirtualization = _o === void 0 ? false : _o, _p = props.enableColumnReordering, enableColumnReordering = _p === void 0 ? false : _p, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "selectionMode", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType", "enableVirtualization", "enableColumnReordering"]);
|
|
92
101
|
useTheme();
|
|
93
102
|
var _q = React.useState(), ownerDocument = _q[0], setOwnerDocument = _q[1];
|
|
94
103
|
var defaultColumn = React.useMemo(function () { return ({
|
|
@@ -103,7 +112,10 @@ export var Table = function (props) {
|
|
|
103
112
|
onBottomReachedRef.current = onBottomReached;
|
|
104
113
|
onRowInViewportRef.current = onRowInViewport;
|
|
105
114
|
}, [onBottomReached, onRowInViewport]);
|
|
106
|
-
var hasManualSelectionColumn =
|
|
115
|
+
var hasManualSelectionColumn = React.useMemo(function () {
|
|
116
|
+
var flatColumns = flattenColumns(columns);
|
|
117
|
+
return flatColumns.some(function (column) { return column.id === SELECTION_CELL_ID; });
|
|
118
|
+
}, [columns]);
|
|
107
119
|
var tableStateReducer = React.useCallback(function (newState, action, previousState, instance) {
|
|
108
120
|
switch (action.type) {
|
|
109
121
|
case TableActions.toggleSortBy:
|
|
@@ -159,7 +171,7 @@ export var Table = function (props) {
|
|
|
159
171
|
return getSubRows ? getSubRows(item, index) : item.subRows;
|
|
160
172
|
});
|
|
161
173
|
}, [data, getSubRows]);
|
|
162
|
-
var instance = useTable(__assign(__assign({ manualPagination: !paginatorRenderer, paginateExpandedRows: false }, props), { columns: columns, defaultColumn: defaultColumn, disableSortBy: !isSortable, stateReducer: tableStateReducer, filterTypes: filterTypes, selectSubRows: selectSubRows, data: data, getSubRows: getSubRows, initialState: __assign({ pageSize: pageSize }, props.initialState) }), useFlexLayout, useResizeColumns(ownerDocument), useFilters, useSubRowFiltering(hasAnySubRows), useSortBy, useExpanded, usePagination, useRowSelect, useSubRowSelection, useExpanderCell(subComponent, expanderCell, isRowDisabled), useSelectionCell(isSelectable, isRowDisabled), useColumnOrder, useColumnDragAndDrop(enableColumnReordering));
|
|
174
|
+
var instance = useTable(__assign(__assign({ manualPagination: !paginatorRenderer, paginateExpandedRows: false }, props), { columns: columns, defaultColumn: defaultColumn, disableSortBy: !isSortable, stateReducer: tableStateReducer, filterTypes: filterTypes, selectSubRows: selectSubRows, data: data, getSubRows: getSubRows, initialState: __assign({ pageSize: pageSize }, props.initialState) }), useFlexLayout, useResizeColumns(ownerDocument), useFilters, useSubRowFiltering(hasAnySubRows), useSortBy, useExpanded, usePagination, useRowSelect, useSubRowSelection, useExpanderCell(subComponent, expanderCell, isRowDisabled), useSelectionCell(isSelectable, selectionMode, isRowDisabled), useColumnOrder, useColumnDragAndDrop(enableColumnReordering));
|
|
163
175
|
var getTableProps = instance.getTableProps, rows = instance.rows, headerGroups = instance.headerGroups, getTableBodyProps = instance.getTableBodyProps, prepareRow = instance.prepareRow, state = instance.state, allColumns = instance.allColumns, filteredFlatRows = instance.filteredFlatRows, dispatch = instance.dispatch, page = instance.page, gotoPage = instance.gotoPage, setPageSize = instance.setPageSize, flatHeaders = instance.flatHeaders;
|
|
164
176
|
var ariaDataAttributes = Object.entries(rest).reduce(function (result, _a) {
|
|
165
177
|
var key = _a[0], value = _a[1];
|
|
@@ -171,8 +183,14 @@ export var Table = function (props) {
|
|
|
171
183
|
var areFiltersSet = allColumns.some(function (column) { return !!column.filterValue; });
|
|
172
184
|
var onRowClickHandler = React.useCallback(function (event, row) {
|
|
173
185
|
var isDisabled = isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original);
|
|
174
|
-
if (
|
|
175
|
-
|
|
186
|
+
if (!isDisabled) {
|
|
187
|
+
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(event, row);
|
|
188
|
+
}
|
|
189
|
+
if (isSelectable &&
|
|
190
|
+
!isDisabled &&
|
|
191
|
+
selectRowOnClick &&
|
|
192
|
+
!event.isDefaultPrevented()) {
|
|
193
|
+
if (!row.isSelected && (selectionMode === 'single' || !event.ctrlKey)) {
|
|
176
194
|
dispatch({
|
|
177
195
|
type: singleRowSelectedAction,
|
|
178
196
|
id: row.id,
|
|
@@ -182,10 +200,14 @@ export var Table = function (props) {
|
|
|
182
200
|
row.toggleRowSelected(!row.isSelected);
|
|
183
201
|
}
|
|
184
202
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
203
|
+
}, [
|
|
204
|
+
isRowDisabled,
|
|
205
|
+
isSelectable,
|
|
206
|
+
selectRowOnClick,
|
|
207
|
+
selectionMode,
|
|
208
|
+
dispatch,
|
|
209
|
+
onRowClick,
|
|
210
|
+
]);
|
|
189
211
|
React.useEffect(function () {
|
|
190
212
|
setPageSize(pageSize);
|
|
191
213
|
}, [pageSize, setPageSize]);
|
|
@@ -266,7 +288,7 @@ export var Table = function (props) {
|
|
|
266
288
|
resizeRef(element);
|
|
267
289
|
}
|
|
268
290
|
}, id: id }, getTableProps({
|
|
269
|
-
className: cx('iui-table', (_a = {}, _a["iui-"
|
|
291
|
+
className: cx('iui-table', (_a = {}, _a["iui-".concat(density)] = density !== 'default', _a), className),
|
|
270
292
|
style: style,
|
|
271
293
|
}), ariaDataAttributes),
|
|
272
294
|
React.createElement("div", { className: 'iui-table-header', ref: headerRef }, headerGroups.slice(1).map(function (headerGroup) {
|
|
@@ -283,7 +305,7 @@ export var Table = function (props) {
|
|
|
283
305
|
} }),
|
|
284
306
|
column.render('Header'),
|
|
285
307
|
(data.length !== 0 || areFiltersSet) && (React.createElement(FilterToggle, { column: column, ownerDocument: ownerDocument })),
|
|
286
|
-
data.length !== 0 && column.canSort && (React.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (React.createElement(
|
|
308
|
+
data.length !== 0 && column.canSort && (React.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (React.createElement(SvgSortDown, { className: 'iui-icon iui-sort', "aria-hidden": true })) : (React.createElement(SvgSortUp, { className: 'iui-icon iui-sort', "aria-hidden": true })))),
|
|
287
309
|
isResizable &&
|
|
288
310
|
column.isResizerVisible &&
|
|
289
311
|
index !== headerGroup.headers.length - 1 && (React.createElement("div", __assign({}, column.getResizerProps(), { className: 'iui-resizer' }),
|
|
@@ -34,15 +34,15 @@ import { ProgressRadial } from '../ProgressIndicators';
|
|
|
34
34
|
import { MenuItem } from '../Menu';
|
|
35
35
|
import { getBoundedValue, useTheme, useOverflow, useContainerWidth, } from '../utils';
|
|
36
36
|
var defaultLocalization = {
|
|
37
|
-
pageSizeLabel: function (size) { return size
|
|
37
|
+
pageSizeLabel: function (size) { return "".concat(size, " per page"); },
|
|
38
38
|
rangeLabel: function (startIndex, endIndex, totalRows, isLoading) {
|
|
39
39
|
return isLoading
|
|
40
|
-
? startIndex
|
|
41
|
-
: startIndex
|
|
40
|
+
? "".concat(startIndex, "-").concat(endIndex, "\u2026")
|
|
41
|
+
: "".concat(startIndex, "-").concat(endIndex, " of ").concat(totalRows);
|
|
42
42
|
},
|
|
43
43
|
previousPage: 'Previous page',
|
|
44
44
|
nextPage: 'Next page',
|
|
45
|
-
goToPageLabel: function (page) { return "Go to page "
|
|
45
|
+
goToPageLabel: function (page) { return "Go to page ".concat(page); },
|
|
46
46
|
rowsPerPageLabel: 'Rows per page',
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
@@ -66,12 +66,12 @@ export var TablePaginator = function (props) {
|
|
|
66
66
|
var needFocus = React.useRef(false);
|
|
67
67
|
var isMounted = React.useRef(false);
|
|
68
68
|
React.useEffect(function () {
|
|
69
|
-
var _a, _b
|
|
69
|
+
var _a, _b;
|
|
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
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(); });
|
|
74
|
-
|
|
74
|
+
buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
|
|
75
75
|
needFocus.current = false;
|
|
76
76
|
}
|
|
77
77
|
isMounted.current = true;
|
|
@@ -31,7 +31,7 @@ export var TableRow = function (props) {
|
|
|
31
31
|
isLast && ((_b = onBottomReached.current) === null || _b === void 0 ? void 0 : _b.call(onBottomReached));
|
|
32
32
|
}, [isLast, onBottomReached, onRowInViewport, row.original]);
|
|
33
33
|
var rowRef = useIntersection(onIntersect, {
|
|
34
|
-
rootMargin: intersectionMargin
|
|
34
|
+
rootMargin: "".concat(intersectionMargin, "px"),
|
|
35
35
|
});
|
|
36
36
|
var userRowProps = rowProps === null || rowProps === void 0 ? void 0 : rowProps(row);
|
|
37
37
|
var mergedProps = __assign(__assign(__assign({}, row.getRowProps({ style: { flex: "0 0 auto", minWidth: '100%' } })), userRowProps), {
|
|
@@ -36,7 +36,8 @@ import React from 'react';
|
|
|
36
36
|
* }
|
|
37
37
|
*/
|
|
38
38
|
export var EditableCell = function (props) {
|
|
39
|
-
var cellElementProps = props.cellElementProps, cellProps = props.cellProps, onCellEdit = props.onCellEdit, children = props.children, rest = __rest(props, ["cellElementProps", "cellProps", "onCellEdit", "children"]);
|
|
39
|
+
var cellElementProps = props.cellElementProps, cellProps = props.cellProps, onCellEdit = props.onCellEdit, children = props.children, isDisabled = props.isDisabled, rest = __rest(props, ["cellElementProps", "cellProps", "onCellEdit", "children", "isDisabled"]);
|
|
40
|
+
isDisabled; // To omit and prevent eslint error.
|
|
40
41
|
var sanitizeString = function (text) {
|
|
41
42
|
return text.replace(/(\r\n|\n|\r)+/gm, ' ');
|
|
42
43
|
};
|
|
@@ -72,8 +72,8 @@ export var ActionColumn = function (_a) {
|
|
|
72
72
|
// Triggers an update to resize the widths of all visible columns
|
|
73
73
|
dispatch({ type: tableResizeStartAction });
|
|
74
74
|
};
|
|
75
|
-
return (React.createElement(MenuItem, { key: column.id, icon: React.createElement(Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: function (e) { return e.stopPropagation(); }, onChange: onClick, "aria-labelledby": "iui-column-"
|
|
76
|
-
React.createElement("div", { id: "iui-column-"
|
|
75
|
+
return (React.createElement(MenuItem, { key: column.id, icon: React.createElement(Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: function (e) { return e.stopPropagation(); }, onChange: onClick, "aria-labelledby": "iui-column-".concat(column.id) }), onClick: onClick, disabled: column.disableToggleVisibility },
|
|
76
|
+
React.createElement("div", { id: "iui-column-".concat(column.id) }, column.render('Header'))));
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
return (React.createElement(DropdownMenu, { menuItems: headerCheckBoxes, onHide: function () { return setIsOpen(false); }, onShow: function () { return setIsOpen(true); } },
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Hooks } from 'react-table';
|
|
2
|
-
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
2
|
+
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, selectionMode: 'multi' | 'single', isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
@@ -8,12 +8,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
10
|
import { SelectionColumn, SELECTION_CELL_ID } from '../columns';
|
|
11
|
-
export var useSelectionCell = function (isSelectable, isRowDisabled) { return function (hooks) {
|
|
11
|
+
export var useSelectionCell = function (isSelectable, selectionMode, isRowDisabled) { return function (hooks) {
|
|
12
12
|
if (!isSelectable) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
hooks.allColumns.push(function (columns) {
|
|
16
|
-
return
|
|
16
|
+
return selectionMode === 'single' ||
|
|
17
|
+
columns.find(function (c) { return c.id === SELECTION_CELL_ID; })
|
|
17
18
|
? columns
|
|
18
19
|
: __spreadArray([SelectionColumn({ isDisabled: isRowDisabled })], columns, true);
|
|
19
20
|
});
|