@itwin/itwinui-react 1.48.1 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -22
- package/cjs/core/Alert/Alert.d.ts +7 -6
- package/cjs/core/Alert/Alert.js +12 -7
- package/cjs/core/Avatar/Avatar.d.ts +69 -0
- package/cjs/core/{UserIcon/UserIcon.js → Avatar/Avatar.js} +15 -11
- package/cjs/core/Avatar/index.d.ts +4 -0
- package/cjs/core/{UserIcon → Avatar}/index.js +5 -4
- package/cjs/core/AvatarGroup/AvatarGroup.d.ts +70 -0
- package/cjs/core/{UserIconGroup/UserIconGroup.js → AvatarGroup/AvatarGroup.js} +23 -19
- package/cjs/core/AvatarGroup/index.d.ts +4 -0
- package/cjs/core/{UserIconGroup → AvatarGroup}/index.js +5 -4
- package/cjs/core/Badge/Badge.js +2 -4
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/cjs/core/Buttons/Button/Button.js +5 -14
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.js +3 -9
- package/cjs/core/Buttons/IdeasButton/IdeasButton.js +1 -1
- package/cjs/core/Buttons/SplitButton/SplitButton.js +4 -6
- package/cjs/core/Checkbox/Checkbox.d.ts +1 -29
- package/cjs/core/Checkbox/Checkbox.js +3 -3
- package/cjs/core/ColorPicker/ColorBuilder.js +16 -27
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +1 -6
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenu.js +2 -4
- package/cjs/core/Dialog/Dialog.d.ts +4 -4
- package/cjs/core/Dialog/Dialog.js +1 -1
- package/cjs/core/Dialog/DialogBackdrop.d.ts +1 -1
- package/cjs/core/Dialog/DialogBackdrop.js +5 -2
- package/cjs/core/Dialog/DialogMain.d.ts +1 -1
- package/cjs/core/Dialog/DialogMain.js +7 -1
- package/cjs/core/Dialog/DialogTitleBar.d.ts +1 -1
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +4 -4
- package/cjs/core/Header/Header.d.ts +16 -6
- package/cjs/core/Header/Header.js +7 -9
- package/cjs/core/Header/HeaderBasicButton.d.ts +6 -0
- package/cjs/core/Header/HeaderBasicButton.js +52 -0
- package/cjs/core/Header/HeaderBreadcrumbs.js +6 -4
- package/cjs/core/Header/HeaderButton.d.ts +3 -2
- package/cjs/core/Header/HeaderButton.js +10 -18
- package/cjs/core/Header/HeaderDropdownButton.d.ts +6 -0
- package/cjs/core/Header/HeaderDropdownButton.js +56 -0
- package/cjs/core/Header/HeaderLogo.js +3 -3
- package/cjs/core/Header/HeaderSplitButton.d.ts +6 -0
- package/cjs/core/Header/HeaderSplitButton.js +56 -0
- package/cjs/core/Input/Input.d.ts +1 -1
- package/cjs/core/Input/Input.js +3 -4
- package/cjs/core/InputGroup/InputGroup.d.ts +1 -1
- package/cjs/core/InputGroup/InputGroup.js +1 -1
- package/cjs/core/Label/Label.d.ts +1 -1
- package/cjs/core/Label/Label.js +1 -1
- package/cjs/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/cjs/core/LabeledInput/LabeledInput.js +1 -1
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +1 -1
- package/cjs/core/LabeledSelect/LabeledSelect.js +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/cjs/core/Radio/Radio.d.ts +1 -29
- package/cjs/core/Radio/Radio.js +3 -3
- package/cjs/core/RadioTiles/RadioTileGroup.d.ts +1 -1
- package/cjs/core/RadioTiles/RadioTileGroup.js +1 -1
- package/cjs/core/Select/Select.d.ts +1 -1
- package/cjs/core/Select/Select.js +9 -12
- package/cjs/core/Select/SelectTag.d.ts +1 -1
- package/cjs/core/Select/SelectTag.js +1 -1
- package/cjs/core/SideNavigation/SidenavButton.js +1 -2
- package/cjs/core/Stepper/Stepper.d.ts +40 -0
- package/cjs/core/{Wizard/Wizard.js → Stepper/Stepper.js} +11 -28
- package/cjs/core/{Wizard/Step.d.ts → Stepper/StepperStep.d.ts} +6 -7
- package/cjs/core/{Wizard/Step.js → Stepper/StepperStep.js} +10 -10
- package/cjs/core/Stepper/Wizard.d.ts +46 -0
- package/cjs/core/Stepper/Wizard.js +55 -0
- package/cjs/core/Stepper/WorkflowDiagram.d.ts +6 -0
- package/cjs/core/Stepper/WorkflowDiagram.js +43 -0
- package/cjs/core/Stepper/WorkflowDiagramStep.d.ts +5 -0
- package/cjs/core/Stepper/WorkflowDiagramStep.js +42 -0
- package/cjs/core/Stepper/index.d.ts +8 -0
- package/cjs/core/{Wizard → Stepper}/index.js +5 -1
- package/cjs/core/Surface/Surface.js +2 -4
- package/cjs/core/Table/SubRowExpander.js +1 -1
- package/cjs/core/Table/Table.d.ts +5 -4
- package/cjs/core/Table/Table.js +30 -21
- package/cjs/core/Table/TableCell.js +4 -4
- package/cjs/core/Table/TablePaginator.js +14 -15
- package/cjs/core/Table/TableRowMemoized.d.ts +2 -0
- package/cjs/core/Table/TableRowMemoized.js +10 -13
- package/cjs/core/Table/cells/DefaultCell.js +4 -9
- package/cjs/core/Table/columns/actionColumn.js +1 -1
- package/cjs/core/Table/columns/expanderColumn.js +1 -1
- package/cjs/core/Table/filters/BaseFilter.js +1 -1
- package/cjs/core/Table/filters/FilterToggle.js +1 -1
- package/cjs/core/Table/hooks/useColumnDragAndDrop.js +4 -4
- package/cjs/core/Table/hooks/useResizeColumns.js +110 -106
- package/cjs/core/Tabs/Tab.d.ts +0 -8
- package/cjs/core/Tabs/Tab.js +1 -5
- package/cjs/core/Tabs/Tabs.js +8 -11
- package/cjs/core/Tabs/index.d.ts +2 -2
- package/cjs/core/Tabs/index.js +1 -2
- package/cjs/core/Textarea/Textarea.d.ts +1 -1
- package/cjs/core/Textarea/Textarea.js +2 -2
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +27 -17
- package/cjs/core/ThemeProvider/ThemeProvider.js +64 -7
- package/cjs/core/Tile/Tile.d.ts +19 -1
- package/cjs/core/Tile/Tile.js +35 -12
- package/cjs/core/Toast/Toast.d.ts +3 -3
- package/cjs/core/Toast/Toast.js +3 -3
- package/cjs/core/Toast/ToastWrapper.d.ts +1 -1
- package/cjs/core/Toast/ToastWrapper.js +1 -1
- package/cjs/core/Tree/TreeNode.js +1 -7
- package/cjs/core/index.d.ts +8 -8
- package/cjs/core/index.js +13 -10
- package/cjs/core/utils/components/Popover.d.ts +2 -2
- package/cjs/core/utils/components/Popover.js +1 -1
- package/cjs/core/utils/components/Resizer.d.ts +5 -0
- package/cjs/core/utils/components/Resizer.js +7 -1
- package/cjs/core/utils/components/VisuallyHidden.d.ts +1 -0
- package/cjs/core/utils/components/VisuallyHidden.js +1 -0
- package/cjs/core/utils/functions/colors.d.ts +1 -1
- package/cjs/core/utils/functions/colors.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useIsomorphicLayoutEffect.d.ts +7 -0
- package/cjs/core/utils/hooks/useIsomorphicLayoutEffect.js +17 -0
- package/cjs/core/utils/hooks/useMediaQuery.js +2 -1
- package/cjs/core/utils/hooks/useTheme.d.ts +20 -3
- package/cjs/core/utils/hooks/useTheme.js +57 -58
- package/esm/core/Alert/Alert.d.ts +7 -6
- package/esm/core/Alert/Alert.js +12 -7
- package/esm/core/Avatar/Avatar.d.ts +69 -0
- package/esm/core/{UserIcon/UserIcon.js → Avatar/Avatar.js} +13 -9
- package/esm/core/Avatar/index.d.ts +4 -0
- package/esm/core/{UserIcon → Avatar}/index.js +2 -2
- package/esm/core/AvatarGroup/AvatarGroup.d.ts +70 -0
- package/esm/core/{UserIconGroup/UserIconGroup.js → AvatarGroup/AvatarGroup.js} +21 -17
- package/esm/core/AvatarGroup/index.d.ts +4 -0
- package/esm/core/{UserIconGroup → AvatarGroup}/index.js +2 -2
- package/esm/core/Badge/Badge.js +3 -5
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/esm/core/Buttons/Button/Button.js +5 -14
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +1 -1
- package/esm/core/Buttons/IconButton/IconButton.js +3 -9
- package/esm/core/Buttons/IdeasButton/IdeasButton.js +1 -1
- package/esm/core/Buttons/SplitButton/SplitButton.js +4 -6
- package/esm/core/Checkbox/Checkbox.d.ts +1 -29
- package/esm/core/Checkbox/Checkbox.js +3 -3
- package/esm/core/ColorPicker/ColorBuilder.js +17 -28
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +2 -7
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenu.js +2 -4
- package/esm/core/Dialog/Dialog.d.ts +4 -4
- package/esm/core/Dialog/Dialog.js +1 -1
- package/esm/core/Dialog/DialogBackdrop.d.ts +1 -1
- package/esm/core/Dialog/DialogBackdrop.js +5 -2
- package/esm/core/Dialog/DialogMain.d.ts +1 -1
- package/esm/core/Dialog/DialogMain.js +7 -1
- package/esm/core/Dialog/DialogTitleBar.d.ts +1 -1
- package/esm/core/ExpandableBlock/ExpandableBlock.js +4 -4
- package/esm/core/Header/Header.d.ts +16 -6
- package/esm/core/Header/Header.js +7 -9
- package/esm/core/Header/HeaderBasicButton.d.ts +6 -0
- package/esm/core/Header/HeaderBasicButton.js +46 -0
- package/esm/core/Header/HeaderBreadcrumbs.js +6 -4
- package/esm/core/Header/HeaderButton.d.ts +3 -2
- package/esm/core/Header/HeaderButton.js +10 -18
- package/esm/core/Header/HeaderDropdownButton.d.ts +6 -0
- package/esm/core/Header/HeaderDropdownButton.js +50 -0
- package/esm/core/Header/HeaderLogo.js +3 -3
- package/esm/core/Header/HeaderSplitButton.d.ts +6 -0
- package/esm/core/Header/HeaderSplitButton.js +50 -0
- package/esm/core/Input/Input.d.ts +1 -1
- package/esm/core/Input/Input.js +3 -4
- package/esm/core/InputGroup/InputGroup.d.ts +1 -1
- package/esm/core/InputGroup/InputGroup.js +1 -1
- package/esm/core/Label/Label.d.ts +1 -1
- package/esm/core/Label/Label.js +1 -1
- package/esm/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/esm/core/LabeledInput/LabeledInput.js +1 -1
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +1 -1
- package/esm/core/LabeledSelect/LabeledSelect.js +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/esm/core/Radio/Radio.d.ts +1 -29
- package/esm/core/Radio/Radio.js +3 -3
- package/esm/core/RadioTiles/RadioTileGroup.d.ts +1 -1
- package/esm/core/RadioTiles/RadioTileGroup.js +1 -1
- package/esm/core/Select/Select.d.ts +1 -1
- package/esm/core/Select/Select.js +9 -12
- package/esm/core/Select/SelectTag.d.ts +1 -1
- package/esm/core/Select/SelectTag.js +1 -1
- package/esm/core/SideNavigation/SidenavButton.js +1 -2
- package/esm/core/Stepper/Stepper.d.ts +40 -0
- package/esm/core/{Wizard/Wizard.js → Stepper/Stepper.js} +10 -27
- package/esm/core/{Wizard/Step.d.ts → Stepper/StepperStep.d.ts} +6 -7
- package/esm/core/{Wizard/Step.js → Stepper/StepperStep.js} +8 -8
- package/esm/core/Stepper/Wizard.d.ts +46 -0
- package/esm/core/Stepper/Wizard.js +49 -0
- package/esm/core/Stepper/WorkflowDiagram.d.ts +6 -0
- package/esm/core/Stepper/WorkflowDiagram.js +37 -0
- package/esm/core/Stepper/WorkflowDiagramStep.d.ts +5 -0
- package/esm/core/Stepper/WorkflowDiagramStep.js +35 -0
- package/esm/core/Stepper/index.d.ts +8 -0
- package/esm/core/{Wizard → Stepper}/index.js +2 -0
- package/esm/core/Surface/Surface.js +3 -5
- package/esm/core/Table/SubRowExpander.js +1 -1
- package/esm/core/Table/Table.d.ts +5 -4
- package/esm/core/Table/Table.js +30 -21
- package/esm/core/Table/TableCell.js +4 -4
- package/esm/core/Table/TablePaginator.js +14 -15
- package/esm/core/Table/TableRowMemoized.d.ts +2 -0
- package/esm/core/Table/TableRowMemoized.js +10 -13
- package/esm/core/Table/cells/DefaultCell.js +4 -9
- package/esm/core/Table/columns/actionColumn.js +1 -1
- package/esm/core/Table/columns/expanderColumn.js +1 -1
- package/esm/core/Table/filters/BaseFilter.js +1 -1
- package/esm/core/Table/filters/FilterToggle.js +1 -1
- package/esm/core/Table/hooks/useColumnDragAndDrop.js +4 -4
- package/esm/core/Table/hooks/useResizeColumns.js +110 -106
- package/esm/core/Tabs/Tab.d.ts +0 -8
- package/esm/core/Tabs/Tab.js +0 -4
- package/esm/core/Tabs/Tabs.js +9 -12
- package/esm/core/Tabs/index.d.ts +2 -2
- package/esm/core/Tabs/index.js +1 -1
- package/esm/core/Textarea/Textarea.d.ts +1 -1
- package/esm/core/Textarea/Textarea.js +2 -2
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +27 -17
- package/esm/core/ThemeProvider/ThemeProvider.js +64 -6
- package/esm/core/Tile/Tile.d.ts +19 -1
- package/esm/core/Tile/Tile.js +36 -13
- package/esm/core/Toast/Toast.d.ts +3 -3
- package/esm/core/Toast/Toast.js +3 -3
- package/esm/core/Toast/ToastWrapper.d.ts +1 -1
- package/esm/core/Toast/ToastWrapper.js +1 -1
- package/esm/core/Tree/TreeNode.js +2 -8
- package/esm/core/index.d.ts +8 -8
- package/esm/core/index.js +4 -4
- package/esm/core/utils/components/Popover.d.ts +2 -2
- package/esm/core/utils/components/Popover.js +1 -1
- package/esm/core/utils/components/Resizer.d.ts +5 -0
- package/esm/core/utils/components/Resizer.js +7 -1
- package/esm/core/utils/components/VisuallyHidden.d.ts +1 -0
- package/esm/core/utils/components/VisuallyHidden.js +1 -0
- package/esm/core/utils/functions/colors.d.ts +1 -1
- package/esm/core/utils/functions/colors.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useIsomorphicLayoutEffect.d.ts +7 -0
- package/esm/core/utils/hooks/useIsomorphicLayoutEffect.js +11 -0
- package/esm/core/utils/hooks/useMediaQuery.js +2 -1
- package/esm/core/utils/hooks/useTheme.d.ts +20 -3
- package/esm/core/utils/hooks/useTheme.js +56 -57
- package/package.json +3 -2
- package/cjs/core/UserIcon/UserIcon.d.ts +0 -57
- package/cjs/core/UserIcon/index.d.ts +0 -4
- package/cjs/core/UserIconGroup/UserIconGroup.d.ts +0 -62
- package/cjs/core/UserIconGroup/index.d.ts +0 -4
- package/cjs/core/Wizard/Wizard.d.ts +0 -54
- package/cjs/core/Wizard/index.d.ts +0 -4
- package/esm/core/UserIcon/UserIcon.d.ts +0 -57
- package/esm/core/UserIcon/index.d.ts +0 -4
- package/esm/core/UserIconGroup/UserIconGroup.d.ts +0 -62
- package/esm/core/UserIconGroup/index.d.ts +0 -4
- package/esm/core/Wizard/Wizard.d.ts +0 -54
- package/esm/core/Wizard/index.d.ts +0 -4
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ThemeOptions, ThemeType } from '../utils';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
theme?: ThemeType;
|
|
8
|
-
/**
|
|
9
|
-
* Optional children.
|
|
10
|
-
*/
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Options that can be specified to override default theming behavior.
|
|
14
|
-
*/
|
|
15
|
-
themeOptions?: ThemeOptions;
|
|
16
|
-
};
|
|
2
|
+
import type { PolymorphicComponentProps, PolymorphicForwardRefComponent, ThemeOptions, ThemeType, UseThemeProps } from '../utils';
|
|
3
|
+
import '@itwin/itwinui-css/css/global.css';
|
|
4
|
+
import '@itwin/itwinui-variables/index.css';
|
|
5
|
+
export declare type ThemeProviderProps<T extends React.ElementType = 'div'> = PolymorphicComponentProps<T, UseThemeProps>;
|
|
17
6
|
/**
|
|
18
|
-
*
|
|
7
|
+
* This component provides global styles and applies theme to the entire tree
|
|
8
|
+
* that it is wrapping around. The `theme` prop is optional and defaults to the
|
|
9
|
+
* light theme.
|
|
10
|
+
*
|
|
11
|
+
* If you want to theme the entire app, you should use this component at the root.
|
|
12
|
+
* The `as` prop can be used to render a `<body>` element instead of a `<div>`.
|
|
13
|
+
*
|
|
14
|
+
* You can also use this component to apply a different theme to only a part of the tree.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <ThemeProvider theme='os'>
|
|
18
|
+
* <App />
|
|
19
|
+
* </ThemeProvider>
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <ThemeProvider as='body'>
|
|
23
|
+
* <App />
|
|
24
|
+
* </ThemeProvider>
|
|
19
25
|
*/
|
|
20
|
-
export declare const ThemeProvider:
|
|
26
|
+
export declare const ThemeProvider: PolymorphicForwardRefComponent<"div", UseThemeProps>;
|
|
21
27
|
export default ThemeProvider;
|
|
28
|
+
export declare const ThemeContext: React.Context<{
|
|
29
|
+
theme?: ThemeType | undefined;
|
|
30
|
+
themeOptions?: ThemeOptions | undefined;
|
|
31
|
+
} | undefined>;
|
|
@@ -1,15 +1,73 @@
|
|
|
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
|
+
};
|
|
1
23
|
/*---------------------------------------------------------------------------------------------
|
|
2
24
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
25
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
26
|
*--------------------------------------------------------------------------------------------*/
|
|
5
27
|
import React from 'react';
|
|
6
|
-
import
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { useTheme, useMediaQuery } from '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/global.css';
|
|
31
|
+
import '@itwin/itwinui-variables/index.css';
|
|
7
32
|
/**
|
|
8
|
-
*
|
|
33
|
+
* This component provides global styles and applies theme to the entire tree
|
|
34
|
+
* that it is wrapping around. The `theme` prop is optional and defaults to the
|
|
35
|
+
* light theme.
|
|
36
|
+
*
|
|
37
|
+
* If you want to theme the entire app, you should use this component at the root.
|
|
38
|
+
* The `as` prop can be used to render a `<body>` element instead of a `<div>`.
|
|
39
|
+
*
|
|
40
|
+
* You can also use this component to apply a different theme to only a part of the tree.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <ThemeProvider theme='os'>
|
|
44
|
+
* <App />
|
|
45
|
+
* </ThemeProvider>
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <ThemeProvider as='body'>
|
|
49
|
+
* <App />
|
|
50
|
+
* </ThemeProvider>
|
|
9
51
|
*/
|
|
10
|
-
export var ThemeProvider = function (props) {
|
|
11
|
-
var
|
|
52
|
+
export var ThemeProvider = React.forwardRef(function (props, ref) {
|
|
53
|
+
var _a;
|
|
54
|
+
var theme = props.theme, children = props.children, themeOptions = props.themeOptions, _b = props.as, Element = _b === void 0 ? 'div' : _b, className = props.className, rest = __rest(props, ["theme", "children", "themeOptions", "as", "className"]);
|
|
55
|
+
var hasChildren = React.Children.count(children) > 0;
|
|
56
|
+
var parentContext = React.useContext(ThemeContext);
|
|
57
|
+
var prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
58
|
+
var prefersHighContrast = useMediaQuery('(prefers-contrast: more)');
|
|
59
|
+
var shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
60
|
+
var shouldApplyHC = (_a = themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.highContrast) !== null && _a !== void 0 ? _a : prefersHighContrast;
|
|
61
|
+
// only provide context if wrapped around children
|
|
62
|
+
return hasChildren ? (React.createElement(ThemeContext.Provider, { value: { theme: theme, themeOptions: themeOptions } },
|
|
63
|
+
React.createElement(Element, __assign({ className: cx('iui-root', className), "data-iui-theme": shouldApplyDark ? 'dark' : 'light', "data-iui-contrast": shouldApplyHC ? 'high' : 'default', ref: ref }, rest), children))) : (
|
|
64
|
+
// otherwise just apply theme on the root using this wrapper component
|
|
65
|
+
React.createElement(ThemeLogicWrapper, { theme: theme !== null && theme !== void 0 ? theme : parentContext === null || parentContext === void 0 ? void 0 : parentContext.theme, themeOptions: themeOptions !== null && themeOptions !== void 0 ? themeOptions : parentContext === null || parentContext === void 0 ? void 0 : parentContext.themeOptions }));
|
|
66
|
+
});
|
|
67
|
+
export default ThemeProvider;
|
|
68
|
+
export var ThemeContext = React.createContext(undefined);
|
|
69
|
+
var ThemeLogicWrapper = function (_a) {
|
|
70
|
+
var theme = _a.theme, themeOptions = _a.themeOptions;
|
|
12
71
|
useTheme(theme, themeOptions);
|
|
13
|
-
return React.createElement(React.Fragment, null
|
|
72
|
+
return React.createElement(React.Fragment, null);
|
|
14
73
|
};
|
|
15
|
-
export default ThemeProvider;
|
package/esm/core/Tile/Tile.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare type TileProps = {
|
|
|
33
33
|
* // ...
|
|
34
34
|
* thumbnail='/url/to/image.jpg'
|
|
35
35
|
* // or
|
|
36
|
-
* thumbnail={<
|
|
36
|
+
* thumbnail={<Avatar image={<img src='icon.png' />} />}
|
|
37
37
|
* // or
|
|
38
38
|
* thumbnail={<SvgImodelHollow />}
|
|
39
39
|
* />
|
|
@@ -61,6 +61,10 @@ export declare type TileProps = {
|
|
|
61
61
|
* Dropdown menu containing `MenuItem`s.
|
|
62
62
|
*/
|
|
63
63
|
moreOptions?: React.ReactNode[];
|
|
64
|
+
/**
|
|
65
|
+
* Status of the tile.
|
|
66
|
+
*/
|
|
67
|
+
status?: 'positive' | 'warning' | 'negative';
|
|
64
68
|
/**
|
|
65
69
|
* Whether the tile is selected or in "active" state.
|
|
66
70
|
* Gets highlighted and shows a checkmark icon near tile name.
|
|
@@ -84,6 +88,20 @@ export declare type TileProps = {
|
|
|
84
88
|
* It becomes focusable and gets on hover styling.
|
|
85
89
|
*/
|
|
86
90
|
isActionable?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Display a loading state.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
isLoading?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Flag whether the tile is disabled.
|
|
98
|
+
*
|
|
99
|
+
* Note: This only affects the tile. You need to manually disable
|
|
100
|
+
* the buttons and other interactive elements inside the tile.
|
|
101
|
+
*
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
isDisabled?: boolean;
|
|
87
105
|
} & React.ComponentPropsWithoutRef<'div'>;
|
|
88
106
|
/**
|
|
89
107
|
* Tile component that displays content and actions in a card-like format.
|
package/esm/core/Tile/Tile.js
CHANGED
|
@@ -29,10 +29,11 @@ import cx from 'classnames';
|
|
|
29
29
|
import SvgCheckmark from '@itwin/itwinui-icons-react/cjs/icons/Checkmark';
|
|
30
30
|
import SvgMore from '@itwin/itwinui-icons-react/cjs/icons/More';
|
|
31
31
|
import SvgNew from '@itwin/itwinui-icons-react/cjs/icons/New';
|
|
32
|
-
import { useTheme } from '../utils';
|
|
32
|
+
import { StatusIconMap, useTheme } from '../utils';
|
|
33
33
|
import '@itwin/itwinui-css/css/tile.css';
|
|
34
34
|
import { DropdownMenu } from '../DropdownMenu';
|
|
35
35
|
import { IconButton } from '../Buttons';
|
|
36
|
+
import { ProgressRadial } from '../ProgressIndicators';
|
|
36
37
|
/**
|
|
37
38
|
* Tile component that displays content and actions in a card-like format.
|
|
38
39
|
* @example
|
|
@@ -51,17 +52,21 @@ import { IconButton } from '../Buttons';
|
|
|
51
52
|
* />
|
|
52
53
|
*/
|
|
53
54
|
export var Tile = function (props) {
|
|
54
|
-
var
|
|
55
|
+
var _a;
|
|
56
|
+
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, _b = props.variant, variant = _b === void 0 ? 'default' : _b, children = props.children, isActionable = props.isActionable, status = props.status, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, _d = props.isDisabled, isDisabled = _d === void 0 ? false : _d, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children", "isActionable", "status", "isLoading", "isDisabled"]);
|
|
55
57
|
useTheme();
|
|
56
|
-
var
|
|
58
|
+
var _e = React.useState(false), isMenuVisible = _e[0], setIsMenuVisible = _e[1];
|
|
57
59
|
var showMenu = React.useCallback(function () { return setIsMenuVisible(true); }, []);
|
|
58
60
|
var hideMenu = React.useCallback(function () { return setIsMenuVisible(false); }, []);
|
|
59
|
-
return (React.createElement("div", __assign({ className: cx('iui-tile', {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
return (React.createElement("div", __assign({ className: cx('iui-tile', (_a = {
|
|
62
|
+
'iui-folder': variant === 'folder',
|
|
63
|
+
'iui-new': isNew,
|
|
64
|
+
'iui-selected': isSelected,
|
|
65
|
+
'iui-actionable': isActionable
|
|
66
|
+
},
|
|
67
|
+
_a["iui-".concat(status)] = !!status,
|
|
68
|
+
_a['iui-loading'] = isLoading,
|
|
69
|
+
_a), className), "aria-disabled": isDisabled, tabIndex: isActionable && !isDisabled ? 0 : undefined }, rest),
|
|
65
70
|
thumbnail && (React.createElement("div", { className: 'iui-tile-thumbnail' },
|
|
66
71
|
typeof thumbnail === 'string' ? (React.createElement("div", { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: "url(".concat(thumbnail, ")") } })) : thumbnail && thumbnail.type === 'img' ? (React.cloneElement(thumbnail, {
|
|
67
72
|
className: 'iui-tile-thumbnail-picture',
|
|
@@ -70,17 +75,18 @@ export var Tile = function (props) {
|
|
|
70
75
|
})) : (thumbnail),
|
|
71
76
|
leftIcon &&
|
|
72
77
|
React.cloneElement(leftIcon, {
|
|
73
|
-
className: 'iui-
|
|
78
|
+
className: 'iui-tile-thumbnail-type-indicator',
|
|
79
|
+
'data-iui-size': 'small',
|
|
74
80
|
}),
|
|
75
81
|
rightIcon &&
|
|
76
82
|
React.cloneElement(rightIcon, {
|
|
77
|
-
className: 'iui-
|
|
83
|
+
className: 'iui-tile-thumbnail-quick-action',
|
|
84
|
+
'data-iui-size': 'small',
|
|
78
85
|
}),
|
|
79
86
|
badge && (React.createElement("div", { className: 'iui-tile-thumbnail-badge-container' }, badge)))),
|
|
80
87
|
React.createElement("div", { className: 'iui-tile-content' },
|
|
81
88
|
React.createElement("div", { className: 'iui-tile-name' },
|
|
82
|
-
|
|
83
|
-
isNew && (React.createElement(SvgNew, { className: cx('iui-tile-status-icon', 'iui-positive'), "aria-hidden": true })),
|
|
89
|
+
React.createElement(TitleIcon, { isLoading: isLoading, isSelected: isSelected, isNew: isNew, status: status }),
|
|
84
90
|
React.createElement("span", { className: 'iui-tile-name-label' }, name)),
|
|
85
91
|
description != undefined && (React.createElement("div", { className: 'iui-tile-description' }, description)),
|
|
86
92
|
metadata != undefined && (React.createElement("div", { className: 'iui-tile-metadata' }, metadata)),
|
|
@@ -103,4 +109,21 @@ export var Tile = function (props) {
|
|
|
103
109
|
children),
|
|
104
110
|
buttons && React.createElement("div", { className: 'iui-tile-buttons' }, buttons)));
|
|
105
111
|
};
|
|
112
|
+
var TitleIcon = function (_a) {
|
|
113
|
+
var _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.isNew, isNew = _d === void 0 ? false : _d, status = _a.status;
|
|
114
|
+
var StatusIcon = !!status && StatusIconMap[status];
|
|
115
|
+
if (isLoading) {
|
|
116
|
+
return (React.createElement(ProgressRadial, { className: 'iui-tile-status-icon', "aria-hidden": true, indeterminate: true }));
|
|
117
|
+
}
|
|
118
|
+
if (isSelected) {
|
|
119
|
+
return React.createElement(SvgCheckmark, { className: 'iui-tile-status-icon', "aria-hidden": true });
|
|
120
|
+
}
|
|
121
|
+
if (isNew) {
|
|
122
|
+
return React.createElement(SvgNew, { className: 'iui-tile-status-icon', "aria-hidden": true });
|
|
123
|
+
}
|
|
124
|
+
if (StatusIcon) {
|
|
125
|
+
return React.createElement(StatusIcon, { className: 'iui-tile-status-icon' });
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
};
|
|
106
129
|
export default Tile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CommonProps } from '../utils';
|
|
3
|
-
import '@itwin/itwinui-css/css/toast
|
|
3
|
+
import '@itwin/itwinui-css/css/toast.css';
|
|
4
4
|
export declare type ToastCategory = 'informational' | 'negative' | 'positive' | 'warning';
|
|
5
5
|
export declare type ToastProps = {
|
|
6
6
|
/**
|
|
@@ -58,7 +58,7 @@ export declare type ToastProps = {
|
|
|
58
58
|
placementPosition?: 'top' | 'bottom';
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
|
-
* Generic Toast
|
|
61
|
+
* Generic Toast Component
|
|
62
62
|
* @example
|
|
63
63
|
* <Toast type='persisting' content='Job processing completed.' category='positive' link={{onClick:() => {alert('Link callback')}, title:'View the report'}} />
|
|
64
64
|
* <Toast type='temporary' content='Processing completed.' category='positive' />
|
|
@@ -70,7 +70,7 @@ export declare type ToastPresentationProps = Omit<ToastProps, 'duration' | 'id'
|
|
|
70
70
|
onClose?: () => void;
|
|
71
71
|
} & CommonProps;
|
|
72
72
|
/**
|
|
73
|
-
* The presentational part of a toast
|
|
73
|
+
* The presentational part of a toast, without any animation or logic.
|
|
74
74
|
* @private
|
|
75
75
|
*/
|
|
76
76
|
export declare const ToastPresentation: (props: ToastPresentationProps) => JSX.Element;
|
package/esm/core/Toast/Toast.js
CHANGED
|
@@ -29,10 +29,10 @@ import { Transition } from 'react-transition-group';
|
|
|
29
29
|
import SvgCloseSmall from '@itwin/itwinui-icons-react/cjs/icons/CloseSmall';
|
|
30
30
|
import cx from 'classnames';
|
|
31
31
|
import { useTheme, getWindow, StatusIconMap } from '../utils';
|
|
32
|
-
import '@itwin/itwinui-css/css/toast
|
|
32
|
+
import '@itwin/itwinui-css/css/toast.css';
|
|
33
33
|
import { IconButton } from '../Buttons';
|
|
34
34
|
/**
|
|
35
|
-
* Generic Toast
|
|
35
|
+
* Generic Toast Component
|
|
36
36
|
* @example
|
|
37
37
|
* <Toast type='persisting' content='Job processing completed.' category='positive' link={{onClick:() => {alert('Link callback')}, title:'View the report'}} />
|
|
38
38
|
* <Toast type='temporary' content='Processing completed.' category='positive' />
|
|
@@ -127,7 +127,7 @@ export var Toast = function (props) {
|
|
|
127
127
|
React.createElement(ToastPresentation, { category: category, content: content, link: link, type: type, hasCloseButton: hasCloseButton, onClose: close })))));
|
|
128
128
|
};
|
|
129
129
|
/**
|
|
130
|
-
* The presentational part of a toast
|
|
130
|
+
* The presentational part of a toast, without any animation or logic.
|
|
131
131
|
* @private
|
|
132
132
|
*/
|
|
133
133
|
export var ToastPresentation = function (props) {
|
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
14
14
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
15
15
|
*--------------------------------------------------------------------------------------------*/
|
|
16
|
-
import '@itwin/itwinui-css/css/toast
|
|
16
|
+
import '@itwin/itwinui-css/css/toast.css';
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import cx from 'classnames';
|
|
19
19
|
import Toast from './Toast';
|
|
@@ -25,7 +25,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
27
|
import React from 'react';
|
|
28
|
-
import { getFocusableElements,
|
|
28
|
+
import { getFocusableElements, useTheme } from '../utils';
|
|
29
29
|
import '@itwin/itwinui-css/css/tree.css';
|
|
30
30
|
import cx from 'classnames';
|
|
31
31
|
import { TreeNodeExpander } from './TreeNodeExpander';
|
|
@@ -55,12 +55,6 @@ export var TreeNode = function (props) {
|
|
|
55
55
|
var _e = useTreeContext(), nodeDepth = _e.nodeDepth, _f = _e.subNodeIds, subNodeIds = _f === void 0 ? [] : _f, parentNodeId = _e.parentNodeId, scrollToParent = _e.scrollToParent, groupSize = _e.groupSize, indexInGroup = _e.indexInGroup;
|
|
56
56
|
var _g = React.useState(false), isFocused = _g[0], setIsFocused = _g[1];
|
|
57
57
|
var nodeRef = React.useRef(null);
|
|
58
|
-
var styleDepth = React.useMemo(function () {
|
|
59
|
-
var _a, _b, _c;
|
|
60
|
-
return ((_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, "--level: ".concat(nodeDepth)))
|
|
61
|
-
? { '--level': nodeDepth }
|
|
62
|
-
: { marginLeft: nodeDepth ? nodeDepth * 28 : 0 };
|
|
63
|
-
}, [nodeDepth]);
|
|
64
58
|
var onKeyDown = function (event) {
|
|
65
59
|
var _a, _b, _c, _d, _e, _f;
|
|
66
60
|
var isNodeFocused = nodeRef.current === ((_a = nodeRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.activeElement);
|
|
@@ -138,7 +132,7 @@ export var TreeNode = function (props) {
|
|
|
138
132
|
React.createElement("div", { className: cx('iui-tree-node', {
|
|
139
133
|
'iui-active': isSelected,
|
|
140
134
|
'iui-disabled': isDisabled,
|
|
141
|
-
}), style:
|
|
135
|
+
}), style: { '--level': nodeDepth }, onClick: function () { return !isDisabled && (onSelected === null || onSelected === void 0 ? void 0 : onSelected(nodeId, !isSelected)); } },
|
|
142
136
|
checkbox && React.isValidElement(checkbox)
|
|
143
137
|
? React.cloneElement(checkbox, {
|
|
144
138
|
className: cx('iui-tree-node-checkbox', checkbox.props.className),
|
package/esm/core/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { Alert } from './Alert';
|
|
2
2
|
export type { AlertProps } from './Alert';
|
|
3
|
+
export { Avatar, UserIcon } from './Avatar';
|
|
4
|
+
export type { AvatarProps, StatusTitles, AvatarStatus, UserIconProps, UserIconStatus, } from './Avatar';
|
|
5
|
+
export { AvatarGroup, UserIconGroup } from './AvatarGroup';
|
|
6
|
+
export type { AvatarGroupProps, UserIconGroupProps } from './AvatarGroup';
|
|
3
7
|
export { Backdrop } from './Backdrop';
|
|
4
8
|
export type { BackdropProps } from './Backdrop';
|
|
5
9
|
export { Badge } from './Badge';
|
|
@@ -36,8 +40,8 @@ export { Footer, defaultFooterElements } from './Footer';
|
|
|
36
40
|
export type { FooterProps, FooterElement, TitleTranslations } from './Footer';
|
|
37
41
|
export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
|
|
38
42
|
export type { HeaderProps, HeaderBreadcrumbsProps, HeaderButtonProps, HeaderLogoProps, } from './Header';
|
|
39
|
-
export { VerticalTabs, Tab, HorizontalTabs
|
|
40
|
-
export type { VerticalTabsProps, TabProps, HorizontalTabsProps
|
|
43
|
+
export { VerticalTabs, Tab, HorizontalTabs } from './Tabs';
|
|
44
|
+
export type { VerticalTabsProps, TabProps, HorizontalTabsProps } from './Tabs';
|
|
41
45
|
export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel';
|
|
42
46
|
export type { InformationPanelProps, InformationPanelWrapperProps, InformationPanelHeaderProps, InformationPanelBodyProps, InformationPanelContentProps, } from './InformationPanel';
|
|
43
47
|
export { Input } from './Input';
|
|
@@ -96,11 +100,7 @@ export { Tree, TreeNode, TreeNodeExpander } from './Tree';
|
|
|
96
100
|
export type { TreeProps, TreeNodeProps, TreeNodeExpanderProps, NodeData, NodeRenderProps, } from './Tree';
|
|
97
101
|
export { Anchor, Body, Headline, Leading, Small, Subheading, Title, Blockquote, Code, Kbd, KbdKeys, Text, } from './Typography';
|
|
98
102
|
export type { BodyProps, HeadlineProps, LeadingProps, SmallProps, SubheadingProps, TitleProps, BlockquoteProps, CodeProps, KbdProps, TextProps, } from './Typography';
|
|
99
|
-
export {
|
|
100
|
-
export type {
|
|
101
|
-
export { UserIconGroup } from './UserIconGroup';
|
|
102
|
-
export type { UserIconGroupProps } from './UserIconGroup';
|
|
103
|
-
export { Wizard } from './Wizard';
|
|
104
|
-
export type { WizardProps, StepProperties, WizardType, WizardLocalization, } from './Wizard';
|
|
103
|
+
export { Wizard, Stepper, WorkflowDiagram } from './Stepper';
|
|
104
|
+
export type { WizardProps, StepProperties, WizardType, WizardLocalization, StepperProps, StepperLocalization, WorkflowDiagramProps, } from './Stepper';
|
|
105
105
|
export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, } from './utils';
|
|
106
106
|
export type { ThemeType, MiddleTextTruncationProps } from './utils';
|
package/esm/core/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { Alert } from './Alert';
|
|
6
|
+
export { Avatar, UserIcon } from './Avatar';
|
|
7
|
+
export { AvatarGroup, UserIconGroup } from './AvatarGroup';
|
|
6
8
|
export { Backdrop } from './Backdrop';
|
|
7
9
|
export { Badge } from './Badge';
|
|
8
10
|
export { Breadcrumbs } from './Breadcrumbs';
|
|
@@ -21,7 +23,7 @@ export { Fieldset } from './Fieldset';
|
|
|
21
23
|
export { FileUpload, FileUploadTemplate } from './FileUpload';
|
|
22
24
|
export { Footer, defaultFooterElements } from './Footer';
|
|
23
25
|
export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
|
|
24
|
-
export { VerticalTabs, Tab, HorizontalTabs
|
|
26
|
+
export { VerticalTabs, Tab, HorizontalTabs } from './Tabs';
|
|
25
27
|
export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel';
|
|
26
28
|
export { Input } from './Input';
|
|
27
29
|
export { Label } from './Label';
|
|
@@ -51,7 +53,5 @@ export { ToggleSwitch } from './ToggleSwitch';
|
|
|
51
53
|
export { Tooltip } from './Tooltip';
|
|
52
54
|
export { Tree, TreeNode, TreeNodeExpander } from './Tree';
|
|
53
55
|
export { Anchor, Body, Headline, Leading, Small, Subheading, Title, Blockquote, Code, Kbd, KbdKeys, Text, } from './Typography';
|
|
54
|
-
export {
|
|
55
|
-
export { UserIconGroup } from './UserIconGroup';
|
|
56
|
-
export { Wizard } from './Wizard';
|
|
56
|
+
export { Wizard, Stepper, WorkflowDiagram } from './Stepper';
|
|
57
57
|
export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, } from './utils';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TippyProps } from '@tippyjs/react';
|
|
3
3
|
import type { Placement, Instance } from 'tippy.js';
|
|
4
4
|
export declare type PopoverInstance = Instance;
|
|
5
|
-
import '@itwin/itwinui-css/css/
|
|
5
|
+
import '@itwin/itwinui-css/css/utils.css';
|
|
6
6
|
export declare type PopoverProps = {
|
|
7
7
|
/**
|
|
8
8
|
* Controlled flag for whether the popover is visible.
|
|
@@ -26,7 +26,7 @@ export declare type PopoverProps = {
|
|
|
26
26
|
* with pre-configured props and plugins (e.g. lazy mounting, focus, etc).
|
|
27
27
|
* @private
|
|
28
28
|
*/
|
|
29
|
-
export declare const Popover: React.ForwardRefExoticComponent<Pick<PopoverProps, "disabled" | "children" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "
|
|
29
|
+
export declare const Popover: React.ForwardRefExoticComponent<Pick<PopoverProps, "disabled" | "theme" | "className" | "role" | "children" | "plugins" | "placement" | "trigger" | "visible" | "content" | "render" | "animateFill" | "appendTo" | "aria" | "delay" | "duration" | "followCursor" | "getReferenceClientRect" | "hideOnClick" | "ignoreAttributes" | "inlinePositioning" | "interactive" | "interactiveBorder" | "interactiveDebounce" | "moveTransition" | "offset" | "popperOptions" | "showOnCreate" | "sticky" | "touch" | "triggerTarget" | "onAfterUpdate" | "onBeforeUpdate" | "onCreate" | "onDestroy" | "onHidden" | "onHide" | "onMount" | "onShow" | "onShown" | "onTrigger" | "onUntrigger" | "onClickOutside" | "allowHTML" | "animation" | "arrow" | "inertia" | "maxWidth" | "zIndex" | "singleton" | "reference"> & React.RefAttributes<unknown>>;
|
|
30
30
|
/**
|
|
31
31
|
* Plugin to hide Popover when either Esc key is pressed,
|
|
32
32
|
* or when the content inside is not tabbable and Tab key is pressed.
|
|
@@ -26,7 +26,7 @@ import React from 'react';
|
|
|
26
26
|
import cx from 'classnames';
|
|
27
27
|
import Tippy from '@tippyjs/react';
|
|
28
28
|
import { useMergedRefs } from '../hooks/useMergedRefs';
|
|
29
|
-
import '@itwin/itwinui-css/css/
|
|
29
|
+
import '@itwin/itwinui-css/css/utils.css';
|
|
30
30
|
/**
|
|
31
31
|
* Wrapper around [tippy.js](https://atomiks.github.io/tippyjs)
|
|
32
32
|
* with pre-configured props and plugins (e.g. lazy mounting, focus, etc).
|
|
@@ -9,6 +9,11 @@ export declare type ResizerProps = {
|
|
|
9
9
|
* If not passed, viewport will be used.
|
|
10
10
|
*/
|
|
11
11
|
containerRef?: React.RefObject<HTMLElement>;
|
|
12
|
+
/**
|
|
13
|
+
* Callback that is being called on resize start.
|
|
14
|
+
* Useful to set state, style, or other properties when resizing is started.
|
|
15
|
+
*/
|
|
16
|
+
onResizeStart?: () => void;
|
|
12
17
|
/**
|
|
13
18
|
* Callback that is being called on resize end.
|
|
14
19
|
* Useful to preserve state if element is being closed.
|
|
@@ -17,7 +17,8 @@ import { getBoundedValue, getTranslateValues } from '../functions';
|
|
|
17
17
|
* );
|
|
18
18
|
*/
|
|
19
19
|
export var Resizer = function (props) {
|
|
20
|
-
var elementRef = props.elementRef, containerRef = props.containerRef, onResizeEnd = props.onResizeEnd;
|
|
20
|
+
var elementRef = props.elementRef, containerRef = props.containerRef, onResizeStart = props.onResizeStart, onResizeEnd = props.onResizeEnd;
|
|
21
|
+
var isResizing = React.useRef(false);
|
|
21
22
|
var onResizePointerDown = function (event) {
|
|
22
23
|
if (!elementRef.current || event.button !== 0) {
|
|
23
24
|
return;
|
|
@@ -40,6 +41,10 @@ export var Resizer = function (props) {
|
|
|
40
41
|
if (!elementRef.current) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
44
|
+
if (!isResizing.current) {
|
|
45
|
+
isResizing.current = true;
|
|
46
|
+
onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart();
|
|
47
|
+
}
|
|
43
48
|
var containerRect = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
44
49
|
var clientX = getBoundedValue(event.clientX, (_b = containerRect === null || containerRect === void 0 ? void 0 : containerRect.left) !== null && _b !== void 0 ? _b : 0, (_d = (_c = containerRect === null || containerRect === void 0 ? void 0 : containerRect.right) !== null && _c !== void 0 ? _c : elementRef.current.ownerDocument.documentElement.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
45
50
|
var clientY = getBoundedValue(event.clientY, (_e = containerRect === null || containerRect === void 0 ? void 0 : containerRect.top) !== null && _e !== void 0 ? _e : 0, (_g = (_f = containerRect === null || containerRect === void 0 ? void 0 : containerRect.bottom) !== null && _f !== void 0 ? _f : elementRef.current.ownerDocument.documentElement.clientHeight) !== null && _g !== void 0 ? _g : 0);
|
|
@@ -122,6 +127,7 @@ export var Resizer = function (props) {
|
|
|
122
127
|
document.removeEventListener('pointermove', onResizePointerMove);
|
|
123
128
|
if (elementRef.current) {
|
|
124
129
|
elementRef.current.ownerDocument.body.style.userSelect = originalUserSelect;
|
|
130
|
+
isResizing.current = false;
|
|
125
131
|
onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd({
|
|
126
132
|
width: width,
|
|
127
133
|
height: height,
|
|
@@ -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 '../hooks';
|
|
30
|
+
import '@itwin/itwinui-css/css/utils.css';
|
|
30
31
|
/**
|
|
31
32
|
* Hides content visually but is still accessible to screen readers.
|
|
32
33
|
*/
|
|
@@ -15,6 +15,6 @@ export declare const SoftBackgrounds: {
|
|
|
15
15
|
export declare const isSoftBackground: (value: string) => value is "skyblue" | "celery" | "froly" | "steelblue" | "sunglow" | "seabuckthorn" | "montecarlo" | "poloblue" | "bouquet" | "ash" | "oak";
|
|
16
16
|
/**
|
|
17
17
|
* Generate color from user name or email.
|
|
18
|
-
* Recommended to use for `backgroundColor` in `
|
|
18
|
+
* Recommended to use for `backgroundColor` in `Avatar` component.
|
|
19
19
|
*/
|
|
20
20
|
export declare const getUserColor: (emailOrName: string) => string;
|
|
@@ -34,7 +34,7 @@ var USER_COLORS = [
|
|
|
34
34
|
];
|
|
35
35
|
/**
|
|
36
36
|
* Generate color from user name or email.
|
|
37
|
-
* Recommended to use for `backgroundColor` in `
|
|
37
|
+
* Recommended to use for `backgroundColor` in `Avatar` component.
|
|
38
38
|
*/
|
|
39
39
|
export var getUserColor = function (emailOrName) {
|
|
40
40
|
var normalizedString = emailOrName.trim().toLowerCase();
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* SSR-safe version of `useLayoutEffect` that replaces it with `useEffect` on the server.
|
|
8
|
+
*
|
|
9
|
+
* @see https://fb.me/react-uselayouteffect-ssr
|
|
10
|
+
*/
|
|
11
|
+
export var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getWindow } from '../functions';
|
|
7
|
+
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
|
|
7
8
|
export var useMediaQuery = function (queryString) {
|
|
8
9
|
var _a = React.useState(), matches = _a[0], setMatches = _a[1];
|
|
9
|
-
|
|
10
|
+
useIsomorphicLayoutEffect(function () {
|
|
10
11
|
var _a, _b, _c;
|
|
11
12
|
var mediaQueryList = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, queryString);
|
|
12
13
|
var handleChange = function (_a) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import '@itwin/itwinui-css/css/global.css';
|
|
2
|
+
import '@itwin/itwinui-variables/index.css';
|
|
2
3
|
export declare type ThemeOptions = {
|
|
3
4
|
/**
|
|
4
5
|
* Document to which the theme will be applied.
|
|
5
6
|
* Can be specified to handle popup windows.
|
|
6
7
|
* @default document
|
|
8
|
+
*
|
|
9
|
+
* @deprecated This prop will continue to work in `useTheme` but
|
|
10
|
+
* we recommend rendering `ThemeProvider` in the correct document instead.
|
|
7
11
|
*/
|
|
8
12
|
ownerDocument?: Document;
|
|
9
13
|
/**
|
|
@@ -13,10 +17,23 @@ export declare type ThemeOptions = {
|
|
|
13
17
|
highContrast?: boolean;
|
|
14
18
|
};
|
|
15
19
|
export declare type ThemeType = 'light' | 'dark' | 'os';
|
|
20
|
+
export declare type UseThemeProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Theme to be applied. If not set, light theme will be used.
|
|
23
|
+
*/
|
|
24
|
+
theme?: ThemeType;
|
|
25
|
+
/**
|
|
26
|
+
* Options that can be specified to override default theming behavior.
|
|
27
|
+
*/
|
|
28
|
+
themeOptions?: ThemeOptions;
|
|
29
|
+
};
|
|
16
30
|
/**
|
|
17
|
-
* Hook that applies styling and theme to all components.
|
|
18
|
-
* Defaults to light theme if none provided
|
|
31
|
+
* Hook that conditionally applies styling and theme to all components.
|
|
32
|
+
* Defaults to light theme if none provided.
|
|
33
|
+
*
|
|
34
|
+
* If ThemeProvider is used as an ancestor, this hook will not do anything.
|
|
35
|
+
*
|
|
19
36
|
* @param theme Light, dark, or based on OS setting.
|
|
20
37
|
* @param themeOptions Options that override default theming behavior.
|
|
21
38
|
*/
|
|
22
|
-
export declare const useTheme: (theme?:
|
|
39
|
+
export declare const useTheme: (theme?: UseThemeProps['theme'], themeOptions?: UseThemeProps['themeOptions']) => void;
|