@itwin/itwinui-react 1.34.2 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -0
- package/cjs/core/Carousel/Carousel.d.ts +68 -0
- package/cjs/core/Carousel/Carousel.js +130 -0
- package/cjs/core/Carousel/CarouselContext.d.ts +37 -0
- package/cjs/core/Carousel/CarouselContext.js +12 -0
- package/cjs/core/Carousel/CarouselDot.d.ts +13 -0
- package/cjs/core/Carousel/CarouselDot.js +46 -0
- package/cjs/core/Carousel/CarouselDotsList.d.ts +32 -0
- package/cjs/core/Carousel/CarouselDotsList.js +132 -0
- package/cjs/core/Carousel/CarouselNavigation.d.ts +15 -0
- package/cjs/core/Carousel/CarouselNavigation.js +88 -0
- package/cjs/core/Carousel/CarouselSlide.d.ts +14 -0
- package/cjs/core/Carousel/CarouselSlide.js +63 -0
- package/cjs/core/Carousel/CarouselSlider.d.ts +5 -0
- package/cjs/core/Carousel/CarouselSlider.js +94 -0
- package/cjs/core/Carousel/index.d.ts +4 -0
- package/cjs/core/Carousel/index.js +10 -0
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/DatePicker/DatePicker.d.ts +5 -0
- package/cjs/core/DatePicker/DatePicker.js +38 -13
- package/cjs/core/Header/HeaderButton.js +1 -0
- package/cjs/core/Menu/Menu.js +8 -3
- package/cjs/core/Modal/Modal.d.ts +5 -0
- package/cjs/core/Modal/Modal.js +11 -9
- package/cjs/core/Modal/ModalContent.d.ts +14 -0
- package/cjs/core/Modal/ModalContent.js +46 -0
- package/cjs/core/Modal/index.d.ts +2 -0
- package/cjs/core/Modal/index.js +3 -1
- 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/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 +7 -0
- package/cjs/core/Table/Table.js +51 -27
- package/cjs/core/Table/TableCell.js +3 -3
- package/cjs/core/Table/TableRowMemoized.js +12 -7
- package/cjs/core/Table/actionHandlers/index.d.ts +2 -1
- package/cjs/core/Table/actionHandlers/index.js +5 -1
- package/cjs/core/Table/cells/DefaultCell.d.ts +1 -1
- package/cjs/core/Table/cells/DefaultCell.js +5 -2
- package/cjs/core/Table/columns/actionColumn.d.ts +35 -0
- package/cjs/core/Table/columns/actionColumn.js +91 -0
- package/cjs/core/Table/columns/expanderColumn.d.ts +47 -0
- package/cjs/core/Table/columns/expanderColumn.js +81 -0
- package/cjs/core/Table/columns/index.d.ts +3 -0
- package/cjs/core/Table/columns/index.js +15 -0
- package/cjs/core/Table/columns/selectionColumn.d.ts +35 -0
- package/cjs/core/Table/columns/selectionColumn.js +67 -0
- package/cjs/core/Table/hooks/index.d.ts +2 -2
- package/cjs/core/Table/hooks/index.js +1 -3
- package/cjs/core/Table/hooks/useExpanderCell.d.ts +0 -1
- package/cjs/core/Table/hooks/useExpanderCell.js +25 -39
- package/cjs/core/Table/hooks/useResizeColumns.js +8 -2
- package/cjs/core/Table/hooks/useSelectionCell.d.ts +1 -2
- package/cjs/core/Table/hooks/useSelectionCell.js +8 -53
- package/cjs/core/Table/index.d.ts +1 -0
- package/cjs/core/Table/index.js +5 -1
- package/cjs/core/Table/utils.js +1 -1
- package/cjs/core/Tag/Tag.js +6 -3
- package/cjs/core/Tile/Tile.d.ts +6 -2
- package/cjs/core/Tile/Tile.js +7 -2
- package/cjs/core/Toast/Toast.js +1 -1
- package/cjs/core/Typography/Anchor/Anchor.d.ts +1 -0
- package/cjs/core/Typography/Anchor/Anchor.js +1 -0
- package/cjs/core/index.d.ts +9 -3
- package/cjs/core/index.js +13 -2
- package/cjs/core/utils/components/Popover.js +13 -1
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useMediaQuery.d.ts +2 -0
- package/cjs/core/utils/hooks/useMediaQuery.js +46 -0
- package/cjs/core/utils/hooks/useTheme.d.ts +5 -0
- package/cjs/core/utils/hooks/useTheme.js +20 -14
- package/cjs/types/react-table-config.d.ts +18 -0
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -0
- package/esm/core/Carousel/Carousel.d.ts +68 -0
- package/esm/core/Carousel/Carousel.js +124 -0
- package/esm/core/Carousel/CarouselContext.d.ts +37 -0
- package/esm/core/Carousel/CarouselContext.js +6 -0
- package/esm/core/Carousel/CarouselDot.d.ts +13 -0
- package/esm/core/Carousel/CarouselDot.js +40 -0
- package/esm/core/Carousel/CarouselDotsList.d.ts +32 -0
- package/esm/core/Carousel/CarouselDotsList.js +126 -0
- package/esm/core/Carousel/CarouselNavigation.d.ts +15 -0
- package/esm/core/Carousel/CarouselNavigation.js +82 -0
- package/esm/core/Carousel/CarouselSlide.d.ts +14 -0
- package/esm/core/Carousel/CarouselSlide.js +57 -0
- package/esm/core/Carousel/CarouselSlider.d.ts +5 -0
- package/esm/core/Carousel/CarouselSlider.js +88 -0
- package/esm/core/Carousel/index.d.ts +4 -0
- package/esm/core/Carousel/index.js +6 -0
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/DatePicker/DatePicker.d.ts +5 -0
- package/esm/core/DatePicker/DatePicker.js +38 -13
- package/esm/core/Header/HeaderButton.js +1 -0
- package/esm/core/Menu/Menu.js +8 -3
- package/esm/core/Modal/Modal.d.ts +5 -0
- package/esm/core/Modal/Modal.js +11 -9
- package/esm/core/Modal/ModalContent.d.ts +14 -0
- package/esm/core/Modal/ModalContent.js +39 -0
- package/esm/core/Modal/index.d.ts +2 -0
- package/esm/core/Modal/index.js +1 -0
- 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/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 +7 -0
- package/esm/core/Table/Table.js +47 -23
- package/esm/core/Table/TableCell.js +2 -2
- package/esm/core/Table/TableRowMemoized.js +12 -7
- package/esm/core/Table/actionHandlers/index.d.ts +2 -1
- package/esm/core/Table/actionHandlers/index.js +2 -1
- package/esm/core/Table/cells/DefaultCell.d.ts +1 -1
- package/esm/core/Table/cells/DefaultCell.js +5 -2
- package/esm/core/Table/columns/actionColumn.d.ts +35 -0
- package/esm/core/Table/columns/actionColumn.js +84 -0
- package/esm/core/Table/columns/expanderColumn.d.ts +47 -0
- package/esm/core/Table/columns/expanderColumn.js +74 -0
- package/esm/core/Table/columns/index.d.ts +3 -0
- package/esm/core/Table/columns/index.js +7 -0
- package/esm/core/Table/columns/selectionColumn.d.ts +35 -0
- package/esm/core/Table/columns/selectionColumn.js +60 -0
- package/esm/core/Table/hooks/index.d.ts +2 -2
- package/esm/core/Table/hooks/index.js +2 -2
- package/esm/core/Table/hooks/useExpanderCell.d.ts +0 -1
- package/esm/core/Table/hooks/useExpanderCell.js +24 -35
- package/esm/core/Table/hooks/useResizeColumns.js +8 -2
- package/esm/core/Table/hooks/useSelectionCell.d.ts +1 -2
- package/esm/core/Table/hooks/useSelectionCell.js +7 -49
- package/esm/core/Table/index.d.ts +1 -0
- package/esm/core/Table/index.js +1 -0
- package/esm/core/Table/utils.js +1 -1
- package/esm/core/Tag/Tag.js +6 -3
- package/esm/core/Tile/Tile.d.ts +6 -2
- package/esm/core/Tile/Tile.js +7 -2
- package/esm/core/Toast/Toast.js +1 -1
- package/esm/core/Typography/Anchor/Anchor.d.ts +1 -0
- package/esm/core/Typography/Anchor/Anchor.js +1 -0
- package/esm/core/index.d.ts +9 -3
- package/esm/core/index.js +5 -2
- package/esm/core/utils/components/Popover.js +13 -1
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useMediaQuery.d.ts +2 -0
- package/esm/core/utils/hooks/useMediaQuery.js +39 -0
- package/esm/core/utils/hooks/useTheme.d.ts +5 -0
- package/esm/core/utils/hooks/useTheme.js +20 -14
- package/esm/types/react-table-config.d.ts +18 -0
- package/package.json +3 -2
package/esm/core/Tile/Tile.js
CHANGED
|
@@ -51,12 +51,17 @@ import { IconButton } from '../Buttons';
|
|
|
51
51
|
* />
|
|
52
52
|
*/
|
|
53
53
|
export var Tile = function (props) {
|
|
54
|
-
var className = props.className, name = props.name, description = props.description, metadata = props.metadata, thumbnail = props.thumbnail, buttons = props.buttons, leftIcon = props.leftIcon, rightIcon = props.rightIcon, badge = props.badge, isNew = props.isNew, isSelected = props.isSelected, moreOptions = props.moreOptions, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children"]);
|
|
54
|
+
var className = props.className, name = props.name, description = props.description, metadata = props.metadata, thumbnail = props.thumbnail, buttons = props.buttons, leftIcon = props.leftIcon, rightIcon = props.rightIcon, badge = props.badge, isNew = props.isNew, isSelected = props.isSelected, moreOptions = props.moreOptions, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, isActionable = props.isActionable, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children", "isActionable"]);
|
|
55
55
|
useTheme();
|
|
56
56
|
var _b = React.useState(false), isMenuVisible = _b[0], setIsMenuVisible = _b[1];
|
|
57
57
|
var showMenu = React.useCallback(function () { return setIsMenuVisible(true); }, []);
|
|
58
58
|
var hideMenu = React.useCallback(function () { return setIsMenuVisible(false); }, []);
|
|
59
|
-
return (React.createElement("div", __assign({ className: cx('iui-tile', {
|
|
59
|
+
return (React.createElement("div", __assign({ className: cx('iui-tile', {
|
|
60
|
+
'iui-folder': variant === 'folder',
|
|
61
|
+
'iui-new': isNew,
|
|
62
|
+
'iui-selected': isSelected,
|
|
63
|
+
'iui-actionable': isActionable,
|
|
64
|
+
}, className), tabIndex: isActionable ? 0 : undefined }, rest),
|
|
60
65
|
thumbnail && (React.createElement("div", { className: 'iui-tile-thumbnail' },
|
|
61
66
|
typeof thumbnail === 'string' ? (React.createElement("div", { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: "url(" + thumbnail + ")" } })) : thumbnail && thumbnail.type === 'img' ? (React.cloneElement(thumbnail, {
|
|
62
67
|
className: 'iui-tile-thumbnail-picture',
|
package/esm/core/Toast/Toast.js
CHANGED
|
@@ -136,7 +136,7 @@ export var ToastPresentation = function (props) {
|
|
|
136
136
|
return (React.createElement("div", __assign({ className: cx("iui-toast iui-" + category, className) }, rest),
|
|
137
137
|
React.createElement("div", { className: 'iui-status-area' }, React.createElement(StatusIcon, { className: 'iui-icon' })),
|
|
138
138
|
React.createElement("div", { className: 'iui-message' }, content),
|
|
139
|
-
link && (React.createElement("a", { className: 'iui-anchor', onClick: link.onClick }, link.title)),
|
|
139
|
+
link && (React.createElement("a", { className: 'iui-toast-anchor', onClick: link.onClick }, link.title)),
|
|
140
140
|
(type === 'persisting' || hasCloseButton) && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
141
141
|
React.createElement(SvgCloseSmall, null)))));
|
|
142
142
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/anchor.css';
|
|
2
3
|
export declare const Anchor: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & React.RefAttributes<HTMLAnchorElement>>;
|
|
3
4
|
export default Anchor;
|
|
@@ -27,6 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
27
27
|
import React from 'react';
|
|
28
28
|
import cx from 'classnames';
|
|
29
29
|
import { useTheme } from '../../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/anchor.css';
|
|
30
31
|
export var Anchor = React.forwardRef(function (_a, ref) {
|
|
31
32
|
var className = _a.className, rest = __rest(_a, ["className"]);
|
|
32
33
|
useTheme();
|
package/esm/core/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { Button, DropdownButton, IconButton, IdeasButton, SplitButton, } from '.
|
|
|
8
8
|
export type { ButtonProps, DropdownButtonProps, IconButtonProps, IdeasButtonProps, SplitButtonProps, } from './Buttons';
|
|
9
9
|
export { ButtonGroup } from './ButtonGroup';
|
|
10
10
|
export type { ButtonGroupProps } from './ButtonGroup';
|
|
11
|
+
export { Carousel } from './Carousel';
|
|
12
|
+
export type { CarouselProps } from './Carousel';
|
|
11
13
|
export { Checkbox } from './Checkbox';
|
|
12
14
|
export type { CheckboxProps } from './Checkbox';
|
|
13
15
|
export { ColorPicker, ColorSwatch, ColorBuilder, ColorInputPanel, ColorPalette, } from './ColorPicker';
|
|
@@ -48,8 +50,8 @@ export { LabeledTextarea } from './LabeledTextarea';
|
|
|
48
50
|
export type { LabeledTextareaProps } from './LabeledTextarea';
|
|
49
51
|
export { Menu, MenuItem, MenuDivider, MenuExtraContent } from './Menu';
|
|
50
52
|
export type { MenuProps, MenuItemProps, MenuDividerProps, MenuExtraContentProps, } from './Menu';
|
|
51
|
-
export { Modal, ModalButtonBar } from './Modal';
|
|
52
|
-
export type { ModalProps, ModalButtonBarProps } from './Modal';
|
|
53
|
+
export { Modal, ModalButtonBar, ModalContent } from './Modal';
|
|
54
|
+
export type { ModalProps, ModalButtonBarProps, ModalContentProps, } from './Modal';
|
|
53
55
|
export { ProgressLinear, ProgressRadial } from './ProgressIndicators';
|
|
54
56
|
export type { ProgressLinearProps, ProgressRadialProps, } from './ProgressIndicators';
|
|
55
57
|
export { Radio } from './Radio';
|
|
@@ -60,11 +62,15 @@ export { Select } from './Select';
|
|
|
60
62
|
export type { SelectProps, SelectOption, ItemRendererProps } from './Select';
|
|
61
63
|
export { SideNavigation, SidenavButton, SidenavSubmenu, SidenavSubmenuHeader, } from './SideNavigation';
|
|
62
64
|
export type { SideNavigationProps, SidenavButtonProps, SidenavSubmenuProps, SidenavSubmenuHeaderProps, } from './SideNavigation';
|
|
65
|
+
export { SkipToContentLink } from './SkipToContentLink';
|
|
66
|
+
export type { SkipToContentLinkProps } from './SkipToContentLink';
|
|
63
67
|
export { Slider } from './Slider';
|
|
64
68
|
export type { SliderProps } from './Slider';
|
|
65
69
|
export { StatusMessage } from './StatusMessage';
|
|
66
70
|
export type { StatusMessageProps } from './StatusMessage';
|
|
67
|
-
export {
|
|
71
|
+
export { Surface } from './Surface';
|
|
72
|
+
export type { SurfaceProps } from './Surface';
|
|
73
|
+
export { Table, tableFilters, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, ActionColumn, ExpanderColumn, SelectionColumn, } from './Table';
|
|
68
74
|
export type { TableProps, TableFilterProps, TableFilterValue, DateRangeFilterOptions, FilterButtonBarProps, DefaultCellProps, EditableCellProps, TablePaginatorProps, TablePaginatorRendererProps, } from './Table';
|
|
69
75
|
export { Tag, TagContainer } from './Tag';
|
|
70
76
|
export type { TagProps, TagContainerProps } from './Tag';
|
package/esm/core/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { Badge } from './Badge';
|
|
|
7
7
|
export { Breadcrumbs } from './Breadcrumbs';
|
|
8
8
|
export { Button, DropdownButton, IconButton, IdeasButton, SplitButton, } from './Buttons';
|
|
9
9
|
export { ButtonGroup } from './ButtonGroup';
|
|
10
|
+
export { Carousel } from './Carousel';
|
|
10
11
|
export { Checkbox } from './Checkbox';
|
|
11
12
|
export { ColorPicker, ColorSwatch, ColorBuilder, ColorInputPanel, ColorPalette, } from './ColorPicker';
|
|
12
13
|
export { ComboBox } from './ComboBox';
|
|
@@ -27,15 +28,17 @@ export { InputGroup } from './InputGroup';
|
|
|
27
28
|
export { LabeledSelect } from './LabeledSelect';
|
|
28
29
|
export { LabeledTextarea } from './LabeledTextarea';
|
|
29
30
|
export { Menu, MenuItem, MenuDivider, MenuExtraContent } from './Menu';
|
|
30
|
-
export { Modal, ModalButtonBar } from './Modal';
|
|
31
|
+
export { Modal, ModalButtonBar, ModalContent } from './Modal';
|
|
31
32
|
export { ProgressLinear, ProgressRadial } from './ProgressIndicators';
|
|
32
33
|
export { Radio } from './Radio';
|
|
33
34
|
export { RadioTile, RadioTileGroup } from './RadioTiles';
|
|
34
35
|
export { Select } from './Select';
|
|
35
36
|
export { SideNavigation, SidenavButton, SidenavSubmenu, SidenavSubmenuHeader, } from './SideNavigation';
|
|
37
|
+
export { SkipToContentLink } from './SkipToContentLink';
|
|
36
38
|
export { Slider } from './Slider';
|
|
37
39
|
export { StatusMessage } from './StatusMessage';
|
|
38
|
-
export {
|
|
40
|
+
export { Surface } from './Surface';
|
|
41
|
+
export { Table, tableFilters, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, ActionColumn, ExpanderColumn, SelectionColumn, } from './Table';
|
|
39
42
|
export { Tag, TagContainer } from './Tag';
|
|
40
43
|
export { Textarea } from './Textarea';
|
|
41
44
|
export { Tile } from './Tile';
|
|
@@ -72,7 +72,19 @@ export var Popover = React.forwardRef(function (props, ref) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
|
|
75
|
+
// Fixing issue where elements below Popover gets click events.
|
|
76
|
+
// Tippy uses react Portal, which propagates events by react tree, not dom tree.
|
|
77
|
+
// Read more: https://reactjs.org/docs/portals.html#event-bubbling-through-portals
|
|
78
|
+
var clonedContent = React.isValidElement(props.content)
|
|
79
|
+
? React.cloneElement(props.content, {
|
|
80
|
+
onClick: function (e) {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
(_b = (_a = props.content.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
: props.content;
|
|
87
|
+
computedProps.content = mounted ? clonedContent : '';
|
|
76
88
|
}
|
|
77
89
|
return React.createElement(Tippy, __assign({}, computedProps, { ref: refs }));
|
|
78
90
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
import React from 'react';
|
|
6
|
+
import { getWindow } from '../functions';
|
|
7
|
+
export var useMediaQuery = function (queryString) {
|
|
8
|
+
var _a = React.useState(), matches = _a[0], setMatches = _a[1];
|
|
9
|
+
React.useLayoutEffect(function () {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
var mediaQueryList = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, queryString);
|
|
12
|
+
var handleChange = function (_a) {
|
|
13
|
+
var matches = _a.matches;
|
|
14
|
+
return setMatches(matches);
|
|
15
|
+
};
|
|
16
|
+
if (mediaQueryList != undefined) {
|
|
17
|
+
setMatches(mediaQueryList.matches);
|
|
18
|
+
try {
|
|
19
|
+
mediaQueryList.addEventListener('change', handleChange);
|
|
20
|
+
}
|
|
21
|
+
catch (_d) {
|
|
22
|
+
// Safari 13 fallback
|
|
23
|
+
(_c = mediaQueryList.addListener) === null || _c === void 0 ? void 0 : _c.call(mediaQueryList, handleChange);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return function () {
|
|
27
|
+
var _a;
|
|
28
|
+
try {
|
|
29
|
+
mediaQueryList === null || mediaQueryList === void 0 ? void 0 : mediaQueryList.removeEventListener('change', handleChange);
|
|
30
|
+
}
|
|
31
|
+
catch (_b) {
|
|
32
|
+
// Safari 13 fallback
|
|
33
|
+
(_a = mediaQueryList === null || mediaQueryList === void 0 ? void 0 : mediaQueryList.removeListener) === null || _a === void 0 ? void 0 : _a.call(mediaQueryList, handleChange);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}, [queryString]);
|
|
37
|
+
return !!matches;
|
|
38
|
+
};
|
|
39
|
+
export default useMediaQuery;
|
|
@@ -6,6 +6,11 @@ export declare type ThemeOptions = {
|
|
|
6
6
|
* @default document
|
|
7
7
|
*/
|
|
8
8
|
ownerDocument?: Document;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to apply high-contrast versions of light and dark themes.
|
|
11
|
+
* Will default to user preference if browser supports it.
|
|
12
|
+
*/
|
|
13
|
+
highContrast?: boolean;
|
|
9
14
|
};
|
|
10
15
|
export declare type ThemeType = 'light' | 'dark' | 'os';
|
|
11
16
|
/**
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import '@itwin/itwinui-css/css/global.css';
|
|
7
7
|
import { getDocument, getWindow } from '../functions/dom';
|
|
8
|
+
import { useMediaQuery } from './useMediaQuery';
|
|
8
9
|
/**
|
|
9
10
|
* Hook that applies styling and theme to all components.
|
|
10
11
|
* Defaults to light theme if none provided or set elsewhere.
|
|
@@ -14,6 +15,8 @@ import { getDocument, getWindow } from '../functions/dom';
|
|
|
14
15
|
export var useTheme = function (theme, themeOptions) {
|
|
15
16
|
var _a;
|
|
16
17
|
var ownerDocument = (_a = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.ownerDocument) !== null && _a !== void 0 ? _a : getDocument();
|
|
18
|
+
var prefersHighContrast = useMediaQuery('(prefers-contrast: more)');
|
|
19
|
+
var highContrast = React.useMemo(function () { var _a; return !!((_a = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.highContrast) !== null && _a !== void 0 ? _a : prefersHighContrast); }, [prefersHighContrast, themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.highContrast]);
|
|
17
20
|
React.useLayoutEffect(function () {
|
|
18
21
|
if (!(ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.classList.contains('iui-body'))) {
|
|
19
22
|
ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.classList.add('iui-body');
|
|
@@ -28,20 +31,20 @@ export var useTheme = function (theme, themeOptions) {
|
|
|
28
31
|
var addOSTheme = function (_a) {
|
|
29
32
|
var isDark = _a.matches;
|
|
30
33
|
if (isDark) {
|
|
31
|
-
|
|
34
|
+
applyTheme('dark', { ownerDocument: ownerDocument, highContrast: highContrast });
|
|
32
35
|
}
|
|
33
36
|
else {
|
|
34
|
-
|
|
37
|
+
applyTheme('light', { ownerDocument: ownerDocument, highContrast: highContrast });
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
40
|
switch (theme) {
|
|
38
41
|
case 'light':
|
|
39
42
|
(_c = prefersDarkMediaQuery === null || prefersDarkMediaQuery === void 0 ? void 0 : prefersDarkMediaQuery.removeEventListener) === null || _c === void 0 ? void 0 : _c.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
40
|
-
|
|
43
|
+
applyTheme('light', { ownerDocument: ownerDocument, highContrast: highContrast });
|
|
41
44
|
break;
|
|
42
45
|
case 'dark':
|
|
43
46
|
(_d = prefersDarkMediaQuery === null || prefersDarkMediaQuery === void 0 ? void 0 : prefersDarkMediaQuery.removeEventListener) === null || _d === void 0 ? void 0 : _d.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
44
|
-
|
|
47
|
+
applyTheme('dark', { ownerDocument: ownerDocument, highContrast: highContrast });
|
|
45
48
|
break;
|
|
46
49
|
case 'os':
|
|
47
50
|
if (prefersDarkMediaQuery != undefined) {
|
|
@@ -49,25 +52,28 @@ export var useTheme = function (theme, themeOptions) {
|
|
|
49
52
|
(_e = prefersDarkMediaQuery.addEventListener) === null || _e === void 0 ? void 0 : _e.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
50
53
|
}
|
|
51
54
|
else {
|
|
52
|
-
|
|
55
|
+
applyTheme('light', { ownerDocument: ownerDocument, highContrast: highContrast });
|
|
53
56
|
}
|
|
54
57
|
break;
|
|
55
58
|
default:
|
|
56
59
|
if (ownerDocument.documentElement.className.indexOf('iui-theme') === -1) {
|
|
57
|
-
|
|
60
|
+
applyTheme('light', { ownerDocument: ownerDocument, highContrast: highContrast });
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
return function () {
|
|
61
64
|
var _a;
|
|
62
65
|
(_a = prefersDarkMediaQuery === null || prefersDarkMediaQuery === void 0 ? void 0 : prefersDarkMediaQuery.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
63
66
|
};
|
|
64
|
-
}, [ownerDocument, theme]);
|
|
67
|
+
}, [highContrast, ownerDocument, theme]);
|
|
65
68
|
};
|
|
66
|
-
var
|
|
67
|
-
ownerDocument.
|
|
68
|
-
ownerDocument.documentElement.classList
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
var applyTheme = function (theme, _a) {
|
|
70
|
+
var ownerDocument = _a.ownerDocument, highContrast = _a.highContrast;
|
|
71
|
+
var classList = ownerDocument.documentElement.classList;
|
|
72
|
+
var currentTheme = Array.from(classList).find(function (cls) {
|
|
73
|
+
return cls.startsWith('iui-theme');
|
|
74
|
+
});
|
|
75
|
+
if (currentTheme) {
|
|
76
|
+
classList.remove(currentTheme);
|
|
77
|
+
}
|
|
78
|
+
classList.add("iui-theme-" + theme + (highContrast ? '-hc' : ''));
|
|
73
79
|
};
|
|
@@ -2,9 +2,22 @@
|
|
|
2
2
|
declare module 'react-table' {
|
|
3
3
|
type FieldType = 'text' | 'number' | 'date' | string;
|
|
4
4
|
type CellRendererProps<D extends object = {}> = {
|
|
5
|
+
/**
|
|
6
|
+
* Cell HTML props passed from the Table.
|
|
7
|
+
*/
|
|
5
8
|
cellElementProps: TableCellProps;
|
|
9
|
+
/**
|
|
10
|
+
* Table specific cell props like `column`, `row`.
|
|
11
|
+
*/
|
|
6
12
|
cellProps: CellProps<D>;
|
|
13
|
+
/**
|
|
14
|
+
* Cell's content.
|
|
15
|
+
*/
|
|
7
16
|
children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Function that returns whether the cell is disabled.
|
|
19
|
+
*/
|
|
20
|
+
isDisabled?: (rowData: D) => boolean;
|
|
8
21
|
};
|
|
9
22
|
interface TableOptions<D extends object = {}> extends Omit<UseTableOptions<D>, 'data'>, UseRowSelectOptions<D>, UseExpandedOptions<D>, UseFiltersOptions<D>, UsePaginationOptions<D>, Omit<UseResizeColumnsOptions<D>, 'disableResizing'>, UseSortByOptions<D> {
|
|
10
23
|
/**
|
|
@@ -73,6 +86,11 @@ declare module 'react-table' {
|
|
|
73
86
|
* @default false
|
|
74
87
|
*/
|
|
75
88
|
disableReordering?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* If true, column's visibility cannot be toggled.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
disableToggleVisibility?: boolean;
|
|
76
94
|
}
|
|
77
95
|
interface ColumnInstance<D extends object = {}> extends UseFiltersColumnProps<D>, UseGroupByColumnProps<D>, UseResizeColumnsColumnProps<D>, UseSortByColumnProps<D> {
|
|
78
96
|
originalWidth: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"build-storybook": "build-storybook"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@itwin/itwinui-css": "^0.
|
|
43
|
+
"@itwin/itwinui-css": "^0.55.0",
|
|
44
44
|
"@itwin/itwinui-icons-react": "^1.5.0",
|
|
45
45
|
"@itwin/itwinui-illustrations-react": "^1.0.1",
|
|
46
46
|
"@tippyjs/react": "^4.2.5",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@babel/core": "^7.12.10",
|
|
54
|
+
"@storybook/addon-a11y": "^6.4.19",
|
|
54
55
|
"@storybook/addon-essentials": "~6.4.19",
|
|
55
56
|
"@storybook/addon-storysource": "~6.4.19",
|
|
56
57
|
"@storybook/addons": "~6.4.19",
|