@itwin/itwinui-react 3.11.0 → 3.11.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 +20 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +13 -3
- package/cjs/core/Buttons/IconButton.d.ts +1 -1
- package/cjs/core/Carousel/Carousel.d.ts +4 -4
- package/cjs/core/Carousel/CarouselNavigation.d.ts +4 -4
- package/cjs/core/ComboBox/ComboBox.js +2 -2
- package/cjs/core/Header/Header.d.ts +3 -3
- package/cjs/core/Header/Header.js +3 -3
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
- package/cjs/core/Table/cells/EditableCell.js +6 -2
- package/cjs/core/ThemeProvider/ThemeProvider.js +26 -16
- package/cjs/core/Tile/Tile.d.ts +2 -2
- package/cjs/utils/providers/ScopeProvider.js +5 -3
- package/esm/core/Breadcrumbs/Breadcrumbs.js +13 -3
- package/esm/core/Buttons/IconButton.d.ts +1 -1
- package/esm/core/Carousel/Carousel.d.ts +4 -4
- package/esm/core/Carousel/CarouselNavigation.d.ts +4 -4
- package/esm/core/ComboBox/ComboBox.js +2 -2
- package/esm/core/Header/Header.d.ts +3 -3
- package/esm/core/Header/Header.js +3 -3
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
- package/esm/core/Table/cells/EditableCell.js +3 -2
- package/esm/core/ThemeProvider/ThemeProvider.js +26 -16
- package/esm/core/Tile/Tile.d.ts +2 -2
- package/esm/utils/providers/ScopeProvider.js +5 -3
- package/package.json +7 -1
- package/styles.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2084](https://github.com/iTwin/iTwinUI/pull/2084): Fixed an issue where a portaled `ThemeProvider` would try to re-render infinitely.
|
|
8
|
+
- [#2083](https://github.com/iTwin/iTwinUI/pull/2083): Removed the accidentally added no-op `loading` prop in `IconButton`.
|
|
9
|
+
- [#2083](https://github.com/iTwin/iTwinUI/pull/2083): Fixed a visual bug where elements like `startIcon` and `endIcon` inside the `Button` (or its derivatives) were not hidden when the button was in a loading state. Now,`loading={true}` on `Button` hides _all_ its children except the `ProgressRadial`.
|
|
10
|
+
|
|
11
|
+
## 3.11.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#2074](https://github.com/iTwin/iTwinUI/pull/2074): Fixed indentation of `Tree` nodes to be aligned regardless of the presence of expander button.
|
|
16
|
+
- [#2064](https://github.com/iTwin/iTwinUI/pull/2064): Adjusted `Dialog` and `ExpandableBlock` to round some CSS `transform` values. This helps avoid blurry text on Windows in some cases.
|
|
17
|
+
- [#2055](https://github.com/iTwin/iTwinUI/pull/2055): Fixed an issue in `Breadcrumbs.Item` where using a custom link component (e.g. `as={Link}` for client side routing) would break the CSS styling.
|
|
18
|
+
- [#2071](https://github.com/iTwin/iTwinUI/pull/2071): Fixed a minor issue in `ComboBox` where a `label` attribute was accidentally being added to options in the DOM.
|
|
19
|
+
- [#2068](https://github.com/iTwin/iTwinUI/pull/2068): Fixed `EditableCell` so that it correctly merges `className` and `style` props with the corresponding internal props.
|
|
20
|
+
- [#2073](https://github.com/iTwin/iTwinUI/pull/2073): Fixed CommonJS types exports for the `/react-table` entrypoint.
|
|
21
|
+
- [#2055](https://github.com/iTwin/iTwinUI/pull/2055): Fixed a regression from `v3.10.0` where non-button and non-link `Breadcrumbs.Item`s were getting a hover styling as if it were a button.
|
|
22
|
+
|
|
3
23
|
## 3.11.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -102,9 +102,19 @@ const ListItem = ({ item, isActive, }) => {
|
|
|
102
102
|
const Separator = ({ separator }) => (React.createElement(index_js_1.Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(index_js_1.SvgChevronRight, null)));
|
|
103
103
|
// ----------------------------------------------------------------------------
|
|
104
104
|
const BreadcrumbsItem = React.forwardRef((props, forwardedRef) => {
|
|
105
|
-
const {
|
|
106
|
-
const
|
|
107
|
-
|
|
105
|
+
const { as: asProp, ...rest } = props;
|
|
106
|
+
const commonProps = {
|
|
107
|
+
...rest,
|
|
108
|
+
className: (0, classnames_1.default)('iui-breadcrumbs-content', props.className),
|
|
109
|
+
ref: forwardedRef,
|
|
110
|
+
};
|
|
111
|
+
if (String(asProp) === 'span' ||
|
|
112
|
+
(props.href == null && props.onClick == null && asProp == null)) {
|
|
113
|
+
return React.createElement(index_js_1.Box, { as: 'span', ...commonProps });
|
|
114
|
+
}
|
|
115
|
+
return (React.createElement(Button_js_1.Button, { as: (asProp === 'a' || (asProp == null && !!props.href)
|
|
116
|
+
? Anchor_js_1.Anchor
|
|
117
|
+
: asProp), styleType: 'borderless', ...commonProps }));
|
|
108
118
|
});
|
|
109
119
|
BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
|
|
110
120
|
// ----------------------------------------------------------------------------
|
|
@@ -21,7 +21,7 @@ export type IconButtonProps = {
|
|
|
21
21
|
* Passes props to IconButton icon.
|
|
22
22
|
*/
|
|
23
23
|
iconProps?: React.ComponentProps<'span'>;
|
|
24
|
-
} & Omit<ButtonProps, 'startIcon' | 'endIcon' | 'startIconProps' | 'endIconProps' | 'labelProps'>;
|
|
24
|
+
} & Omit<ButtonProps, 'startIcon' | 'endIcon' | 'startIconProps' | 'endIconProps' | 'labelProps' | 'loading'>;
|
|
25
25
|
/**
|
|
26
26
|
* Icon button
|
|
27
27
|
* @example
|
|
@@ -42,7 +42,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
42
42
|
Navigation: PolymorphicForwardRefComponent<"div", {}> & {
|
|
43
43
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
44
44
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
45
|
-
}, "label" | "as" | "
|
|
45
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
46
46
|
isActive?: boolean | undefined;
|
|
47
47
|
label?: React.ReactNode;
|
|
48
48
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -100,12 +100,12 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
100
100
|
as?: "div" | undefined;
|
|
101
101
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
102
102
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
103
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
103
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
104
104
|
as?: "button" | undefined;
|
|
105
105
|
}>;
|
|
106
106
|
NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
107
107
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
108
|
-
}, "label" | "as" | "
|
|
108
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
109
109
|
isActive?: boolean | undefined;
|
|
110
110
|
label?: React.ReactNode;
|
|
111
111
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -163,7 +163,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
163
163
|
as?: "div" | undefined;
|
|
164
164
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
165
165
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
166
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
166
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
167
167
|
as?: "button" | undefined;
|
|
168
168
|
}>;
|
|
169
169
|
};
|
|
@@ -9,7 +9,7 @@ import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
|
9
9
|
export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {}> & {
|
|
10
10
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
11
11
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
12
|
-
}, "label" | "as" | "
|
|
12
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
13
13
|
isActive?: boolean | undefined;
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -67,12 +67,12 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
|
|
|
67
67
|
as?: "div" | undefined;
|
|
68
68
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
69
69
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
70
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
70
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
71
71
|
as?: "button" | undefined;
|
|
72
72
|
}>;
|
|
73
73
|
NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
74
74
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
75
|
-
}, "label" | "as" | "
|
|
75
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
76
76
|
isActive?: boolean | undefined;
|
|
77
77
|
label?: React.ReactNode;
|
|
78
78
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -130,7 +130,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
|
|
|
130
130
|
as?: "div" | undefined;
|
|
131
131
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
132
132
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
133
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
133
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
134
134
|
as?: "button" | undefined;
|
|
135
135
|
}>;
|
|
136
136
|
};
|
|
@@ -264,7 +264,7 @@ exports.ComboBox = React.forwardRef((props, forwardedRef) => {
|
|
|
264
264
|
const getMenuItem = React.useCallback((option, filteredIndex) => {
|
|
265
265
|
const optionId = getOptionId(option, id);
|
|
266
266
|
const { __originalIndex } = optionsExtraInfoRef.current[optionId];
|
|
267
|
-
const { icon, startIcon: startIconProp, ...restOptions } = option;
|
|
267
|
+
const { icon, startIcon: startIconProp, label, ...restOptions } = option;
|
|
268
268
|
const startIcon = startIconProp ?? icon;
|
|
269
269
|
const customItem = itemRenderer
|
|
270
270
|
? itemRenderer(option, {
|
|
@@ -291,7 +291,7 @@ exports.ComboBox = React.forwardRef((props, forwardedRef) => {
|
|
|
291
291
|
}),
|
|
292
292
|
})) : (React.createElement(ComboBoxMenuItem_js_1.ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
|
|
293
293
|
onClickHandler(__originalIndex);
|
|
294
|
-
}, index: __originalIndex, "data-iui-filtered-index": filteredIndex },
|
|
294
|
+
}, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, label));
|
|
295
295
|
}, [
|
|
296
296
|
enableVirtualization,
|
|
297
297
|
focusedIndex,
|
|
@@ -71,7 +71,7 @@ type HeaderProps = {
|
|
|
71
71
|
* appLogo={<HeaderLogo logo={<SvgImodelHollow />}>iTwin Application</HeaderLogo>}
|
|
72
72
|
* breadcrumbs={
|
|
73
73
|
* <HeaderBreadcrumbs items={[
|
|
74
|
-
* <HeaderButton key='project' name='Project A'
|
|
74
|
+
* <HeaderButton key='project' name='Project A' />,
|
|
75
75
|
* <HeaderButton key='imodel' name='IModel X' />
|
|
76
76
|
* ]} />
|
|
77
77
|
* }
|
|
@@ -82,9 +82,9 @@ type HeaderProps = {
|
|
|
82
82
|
* <SvgHelpCircularHollow />
|
|
83
83
|
* </IconButton>
|
|
84
84
|
* </DropdownMenu>,
|
|
85
|
-
* <DropdownMenu menuItems={
|
|
85
|
+
* <DropdownMenu menuItems={…}>
|
|
86
86
|
* <IconButton styleType='borderless'>
|
|
87
|
-
* <Avatar
|
|
87
|
+
* <Avatar … />
|
|
88
88
|
* </IconButton>
|
|
89
89
|
* </DropdownMenu>
|
|
90
90
|
* ]}
|
|
@@ -46,7 +46,7 @@ const defaultTranslations = {
|
|
|
46
46
|
* appLogo={<HeaderLogo logo={<SvgImodelHollow />}>iTwin Application</HeaderLogo>}
|
|
47
47
|
* breadcrumbs={
|
|
48
48
|
* <HeaderBreadcrumbs items={[
|
|
49
|
-
* <HeaderButton key='project' name='Project A'
|
|
49
|
+
* <HeaderButton key='project' name='Project A' />,
|
|
50
50
|
* <HeaderButton key='imodel' name='IModel X' />
|
|
51
51
|
* ]} />
|
|
52
52
|
* }
|
|
@@ -57,9 +57,9 @@ const defaultTranslations = {
|
|
|
57
57
|
* <SvgHelpCircularHollow />
|
|
58
58
|
* </IconButton>
|
|
59
59
|
* </DropdownMenu>,
|
|
60
|
-
* <DropdownMenu menuItems={
|
|
60
|
+
* <DropdownMenu menuItems={…}>
|
|
61
61
|
* <IconButton styleType='borderless'>
|
|
62
|
-
* <Avatar
|
|
62
|
+
* <Avatar … />
|
|
63
63
|
* </IconButton>
|
|
64
64
|
* </DropdownMenu>
|
|
65
65
|
* ]}
|
|
@@ -32,7 +32,7 @@ export declare const InputWithDecorations: PolymorphicForwardRefComponent<"div",
|
|
|
32
32
|
*/
|
|
33
33
|
Button: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
34
34
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
35
|
-
}, "label" | "as" | "
|
|
35
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & Omit<import("../Buttons/IconButton.js").IconButtonProps, "styleType"> & {
|
|
36
36
|
styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
|
|
37
37
|
} & {
|
|
38
38
|
as?: "button" | undefined;
|
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.EditableCell = void 0;
|
|
27
30
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -30,6 +33,7 @@ exports.EditableCell = void 0;
|
|
|
30
33
|
*--------------------------------------------------------------------------------------------*/
|
|
31
34
|
const React = __importStar(require("react"));
|
|
32
35
|
const index_js_1 = require("../../../utils/index.js");
|
|
36
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
33
37
|
/**
|
|
34
38
|
* Editable cell.
|
|
35
39
|
* It should be passed to `cellRenderer`.
|
|
@@ -41,7 +45,7 @@ const index_js_1 = require("../../../utils/index.js");
|
|
|
41
45
|
* }
|
|
42
46
|
*/
|
|
43
47
|
const EditableCell = (props) => {
|
|
44
|
-
const { cellElementProps, cellProps, onCellEdit, children, isDisabled, ...rest } = props;
|
|
48
|
+
const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, cellProps, onCellEdit, children, isDisabled, className, style, ...rest } = props;
|
|
45
49
|
isDisabled; // To omit and prevent eslint error.
|
|
46
50
|
const sanitizeString = (text) => {
|
|
47
51
|
return text.replace(/(\r\n|\n|\r)+/gm, ' ');
|
|
@@ -52,7 +56,7 @@ const EditableCell = (props) => {
|
|
|
52
56
|
}, [cellProps.value]);
|
|
53
57
|
const [key, setKey] = React.useState((0, index_js_1.getRandomValue)(10));
|
|
54
58
|
const [isDirty, setIsDirty] = React.useState(false);
|
|
55
|
-
return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
|
|
59
|
+
return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, className: (0, classnames_1.default)(cellElementClassName, className), style: { ...cellElementStyle, ...style }, onInput: (e) => {
|
|
56
60
|
setValue(sanitizeString(e.target.innerText));
|
|
57
61
|
setIsDirty(true);
|
|
58
62
|
props.onInput?.(e);
|
|
@@ -101,10 +101,13 @@ const Root = React.forwardRef((props, forwardedRef) => {
|
|
|
101
101
|
const shouldApplyDark = theme === 'dark' || (theme === 'os' && prefersDark);
|
|
102
102
|
const shouldApplyHC = themeOptions?.highContrast ?? prefersHighContrast;
|
|
103
103
|
const shouldApplyBackground = themeOptions?.applyBackground;
|
|
104
|
-
const setOwnerDocument = (0, index_js_1.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const [ownerDocument, setOwnerDocument] = (0, index_js_1.useScopedAtom)(ownerDocumentAtom);
|
|
105
|
+
const findOwnerDocumentFromRef = React.useCallback((el) => {
|
|
106
|
+
if (el && el.ownerDocument !== ownerDocument) {
|
|
107
|
+
setOwnerDocument(el.ownerDocument);
|
|
108
|
+
}
|
|
109
|
+
}, [ownerDocument, setOwnerDocument]);
|
|
110
|
+
return (React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-root', { 'iui-root-background': shouldApplyBackground }, className), "data-iui-theme": shouldApplyDark ? 'dark' : 'light', "data-iui-contrast": shouldApplyHC ? 'high' : 'default', ref: (0, index_js_1.useMergedRefs)(forwardedRef, findOwnerDocumentFromRef), ...rest }, children));
|
|
108
111
|
});
|
|
109
112
|
// ----------------------------------------------------------------------------
|
|
110
113
|
/**
|
|
@@ -159,33 +162,40 @@ const useParentThemeAndContext = (rootElement) => {
|
|
|
159
162
|
*/
|
|
160
163
|
const PortalContainer = React.memo(({ portalContainerProp, portalContainerFromParent, isInheritingTheme, }) => {
|
|
161
164
|
const [ownerDocument] = (0, index_js_1.useScopedAtom)(ownerDocumentAtom);
|
|
162
|
-
const
|
|
165
|
+
const setPortalContainer = (0, index_js_1.useScopedSetAtom)(index_js_1.portalContainerAtom);
|
|
163
166
|
// bail if not hydrated, because portals don't work on server
|
|
164
167
|
const isHydrated = (0, index_js_1.useHydration)() === 'hydrated';
|
|
165
168
|
if (!isHydrated) {
|
|
166
169
|
return null;
|
|
167
170
|
}
|
|
171
|
+
if (portalContainerProp) {
|
|
172
|
+
return React.createElement(PortaledToaster, { target: portalContainerProp });
|
|
173
|
+
}
|
|
168
174
|
// Create a new portal container only if necessary:
|
|
169
175
|
// - not inheriting theme
|
|
170
176
|
// - no parent portal container to portal into
|
|
171
177
|
// - parent portal container is in a different window (#2006)
|
|
172
|
-
if (!
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
if (!isInheritingTheme ||
|
|
179
|
+
!portalContainerFromParent ||
|
|
180
|
+
(!!ownerDocument &&
|
|
175
181
|
portalContainerFromParent.ownerDocument !== ownerDocument)) {
|
|
176
182
|
return (React.createElement("div", { style: { display: 'contents' }, ref: setPortalContainer },
|
|
177
183
|
React.createElement(Toaster_js_1.Toaster, null)));
|
|
178
184
|
}
|
|
179
|
-
|
|
180
|
-
// Synchronize atom with the correct portal container if necessary.
|
|
181
|
-
if (portalTarget && portalTarget !== portalContainer) {
|
|
182
|
-
setPortalContainer(portalTarget);
|
|
183
|
-
}
|
|
184
|
-
return portalTarget
|
|
185
|
-
? ReactDOM.createPortal(React.createElement(Toaster_js_1.Toaster, null), portalTarget)
|
|
186
|
-
: null;
|
|
185
|
+
return React.createElement(PortaledToaster, { target: portalContainerFromParent });
|
|
187
186
|
});
|
|
188
187
|
// ----------------------------------------------------------------------------
|
|
188
|
+
const PortaledToaster = ({ target }) => {
|
|
189
|
+
const [portalContainer, setPortalContainer] = (0, index_js_1.useScopedAtom)(index_js_1.portalContainerAtom);
|
|
190
|
+
// Synchronize atom with the correct portal target if necessary.
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
if (target && target !== portalContainer) {
|
|
193
|
+
setPortalContainer(target);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
return target ? ReactDOM.createPortal(React.createElement(Toaster_js_1.Toaster, null), target) : null;
|
|
197
|
+
};
|
|
198
|
+
// ----------------------------------------------------------------------------
|
|
189
199
|
/**
|
|
190
200
|
* When `@itwin/itwinui-react/styles.css` is not imported, we will attempt to
|
|
191
201
|
* dynamically import it (if possible) and fallback to loading it from a CDN.
|
package/cjs/core/Tile/Tile.d.ts
CHANGED
|
@@ -249,7 +249,7 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps
|
|
|
249
249
|
*/
|
|
250
250
|
IconButton: PolymorphicForwardRefComponent<"button", Omit<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
251
251
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
252
|
-
}, "label" | "as" | "
|
|
252
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
253
253
|
isActive?: boolean | undefined;
|
|
254
254
|
label?: React.ReactNode;
|
|
255
255
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -323,7 +323,7 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps
|
|
|
323
323
|
as?: "div" | undefined;
|
|
324
324
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
325
325
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
326
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
326
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
327
327
|
as?: "button" | undefined;
|
|
328
328
|
}, "ref">>;
|
|
329
329
|
/**
|
|
@@ -60,9 +60,11 @@ const useScopedAtom = (atom) => {
|
|
|
60
60
|
const setAtom = (0, exports.useScopedSetAtom)(atom);
|
|
61
61
|
const value = (0, jotai_1.useAtomValue)(atom, { store });
|
|
62
62
|
const inheritedValue = (0, jotai_1.useAtomValue)(atom, { store: parentStore || store });
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
if (value == undefined && inheritedValue != undefined) {
|
|
65
|
+
setAtom(inheritedValue);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
66
68
|
return [value, setAtom];
|
|
67
69
|
};
|
|
68
70
|
exports.useScopedAtom = useScopedAtom;
|
|
@@ -73,9 +73,19 @@ const ListItem = ({ item, isActive, }) => {
|
|
|
73
73
|
const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(SvgChevronRight, null)));
|
|
74
74
|
// ----------------------------------------------------------------------------
|
|
75
75
|
const BreadcrumbsItem = React.forwardRef((props, forwardedRef) => {
|
|
76
|
-
const {
|
|
77
|
-
const
|
|
78
|
-
|
|
76
|
+
const { as: asProp, ...rest } = props;
|
|
77
|
+
const commonProps = {
|
|
78
|
+
...rest,
|
|
79
|
+
className: cx('iui-breadcrumbs-content', props.className),
|
|
80
|
+
ref: forwardedRef,
|
|
81
|
+
};
|
|
82
|
+
if (String(asProp) === 'span' ||
|
|
83
|
+
(props.href == null && props.onClick == null && asProp == null)) {
|
|
84
|
+
return React.createElement(Box, { as: 'span', ...commonProps });
|
|
85
|
+
}
|
|
86
|
+
return (React.createElement(Button, { as: (asProp === 'a' || (asProp == null && !!props.href)
|
|
87
|
+
? Anchor
|
|
88
|
+
: asProp), styleType: 'borderless', ...commonProps }));
|
|
79
89
|
});
|
|
80
90
|
BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
|
|
81
91
|
// ----------------------------------------------------------------------------
|
|
@@ -21,7 +21,7 @@ export type IconButtonProps = {
|
|
|
21
21
|
* Passes props to IconButton icon.
|
|
22
22
|
*/
|
|
23
23
|
iconProps?: React.ComponentProps<'span'>;
|
|
24
|
-
} & Omit<ButtonProps, 'startIcon' | 'endIcon' | 'startIconProps' | 'endIconProps' | 'labelProps'>;
|
|
24
|
+
} & Omit<ButtonProps, 'startIcon' | 'endIcon' | 'startIconProps' | 'endIconProps' | 'labelProps' | 'loading'>;
|
|
25
25
|
/**
|
|
26
26
|
* Icon button
|
|
27
27
|
* @example
|
|
@@ -42,7 +42,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
42
42
|
Navigation: PolymorphicForwardRefComponent<"div", {}> & {
|
|
43
43
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
44
44
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
45
|
-
}, "label" | "as" | "
|
|
45
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
46
46
|
isActive?: boolean | undefined;
|
|
47
47
|
label?: React.ReactNode;
|
|
48
48
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -100,12 +100,12 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
100
100
|
as?: "div" | undefined;
|
|
101
101
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
102
102
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
103
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
103
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
104
104
|
as?: "button" | undefined;
|
|
105
105
|
}>;
|
|
106
106
|
NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
107
107
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
108
|
-
}, "label" | "as" | "
|
|
108
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
109
109
|
isActive?: boolean | undefined;
|
|
110
110
|
label?: React.ReactNode;
|
|
111
111
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -163,7 +163,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
|
|
|
163
163
|
as?: "div" | undefined;
|
|
164
164
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
165
165
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
166
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
166
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
167
167
|
as?: "button" | undefined;
|
|
168
168
|
}>;
|
|
169
169
|
};
|
|
@@ -9,7 +9,7 @@ import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
|
9
9
|
export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {}> & {
|
|
10
10
|
PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
11
11
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
12
|
-
}, "label" | "as" | "
|
|
12
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
13
13
|
isActive?: boolean | undefined;
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -67,12 +67,12 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
|
|
|
67
67
|
as?: "div" | undefined;
|
|
68
68
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
69
69
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
70
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
70
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
71
71
|
as?: "button" | undefined;
|
|
72
72
|
}>;
|
|
73
73
|
NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
74
74
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
75
|
-
}, "label" | "as" | "
|
|
75
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
|
|
76
76
|
isActive?: boolean | undefined;
|
|
77
77
|
label?: React.ReactNode;
|
|
78
78
|
labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -130,7 +130,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
|
|
|
130
130
|
as?: "div" | undefined;
|
|
131
131
|
}, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
|
|
132
132
|
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
133
|
-
} & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
133
|
+
} & Omit<import("../Buttons/Button.js").ButtonProps, "loading" | "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
134
134
|
as?: "button" | undefined;
|
|
135
135
|
}>;
|
|
136
136
|
};
|
|
@@ -238,7 +238,7 @@ export const ComboBox = React.forwardRef((props, forwardedRef) => {
|
|
|
238
238
|
const getMenuItem = React.useCallback((option, filteredIndex) => {
|
|
239
239
|
const optionId = getOptionId(option, id);
|
|
240
240
|
const { __originalIndex } = optionsExtraInfoRef.current[optionId];
|
|
241
|
-
const { icon, startIcon: startIconProp, ...restOptions } = option;
|
|
241
|
+
const { icon, startIcon: startIconProp, label, ...restOptions } = option;
|
|
242
242
|
const startIcon = startIconProp ?? icon;
|
|
243
243
|
const customItem = itemRenderer
|
|
244
244
|
? itemRenderer(option, {
|
|
@@ -265,7 +265,7 @@ export const ComboBox = React.forwardRef((props, forwardedRef) => {
|
|
|
265
265
|
}),
|
|
266
266
|
})) : (React.createElement(ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
|
|
267
267
|
onClickHandler(__originalIndex);
|
|
268
|
-
}, index: __originalIndex, "data-iui-filtered-index": filteredIndex },
|
|
268
|
+
}, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, label));
|
|
269
269
|
}, [
|
|
270
270
|
enableVirtualization,
|
|
271
271
|
focusedIndex,
|
|
@@ -71,7 +71,7 @@ type HeaderProps = {
|
|
|
71
71
|
* appLogo={<HeaderLogo logo={<SvgImodelHollow />}>iTwin Application</HeaderLogo>}
|
|
72
72
|
* breadcrumbs={
|
|
73
73
|
* <HeaderBreadcrumbs items={[
|
|
74
|
-
* <HeaderButton key='project' name='Project A'
|
|
74
|
+
* <HeaderButton key='project' name='Project A' />,
|
|
75
75
|
* <HeaderButton key='imodel' name='IModel X' />
|
|
76
76
|
* ]} />
|
|
77
77
|
* }
|
|
@@ -82,9 +82,9 @@ type HeaderProps = {
|
|
|
82
82
|
* <SvgHelpCircularHollow />
|
|
83
83
|
* </IconButton>
|
|
84
84
|
* </DropdownMenu>,
|
|
85
|
-
* <DropdownMenu menuItems={
|
|
85
|
+
* <DropdownMenu menuItems={…}>
|
|
86
86
|
* <IconButton styleType='borderless'>
|
|
87
|
-
* <Avatar
|
|
87
|
+
* <Avatar … />
|
|
88
88
|
* </IconButton>
|
|
89
89
|
* </DropdownMenu>
|
|
90
90
|
* ]}
|
|
@@ -17,7 +17,7 @@ const defaultTranslations = {
|
|
|
17
17
|
* appLogo={<HeaderLogo logo={<SvgImodelHollow />}>iTwin Application</HeaderLogo>}
|
|
18
18
|
* breadcrumbs={
|
|
19
19
|
* <HeaderBreadcrumbs items={[
|
|
20
|
-
* <HeaderButton key='project' name='Project A'
|
|
20
|
+
* <HeaderButton key='project' name='Project A' />,
|
|
21
21
|
* <HeaderButton key='imodel' name='IModel X' />
|
|
22
22
|
* ]} />
|
|
23
23
|
* }
|
|
@@ -28,9 +28,9 @@ const defaultTranslations = {
|
|
|
28
28
|
* <SvgHelpCircularHollow />
|
|
29
29
|
* </IconButton>
|
|
30
30
|
* </DropdownMenu>,
|
|
31
|
-
* <DropdownMenu menuItems={
|
|
31
|
+
* <DropdownMenu menuItems={…}>
|
|
32
32
|
* <IconButton styleType='borderless'>
|
|
33
|
-
* <Avatar
|
|
33
|
+
* <Avatar … />
|
|
34
34
|
* </IconButton>
|
|
35
35
|
* </DropdownMenu>
|
|
36
36
|
* ]}
|
|
@@ -32,7 +32,7 @@ export declare const InputWithDecorations: PolymorphicForwardRefComponent<"div",
|
|
|
32
32
|
*/
|
|
33
33
|
Button: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
34
34
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
35
|
-
}, "label" | "as" | "
|
|
35
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & Omit<import("../Buttons/IconButton.js").IconButtonProps, "styleType"> & {
|
|
36
36
|
styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
|
|
37
37
|
} & {
|
|
38
38
|
as?: "button" | undefined;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Box, getRandomValue } from '../../../utils/index.js';
|
|
7
|
+
import cx from 'classnames';
|
|
7
8
|
/**
|
|
8
9
|
* Editable cell.
|
|
9
10
|
* It should be passed to `cellRenderer`.
|
|
@@ -15,7 +16,7 @@ import { Box, getRandomValue } from '../../../utils/index.js';
|
|
|
15
16
|
* }
|
|
16
17
|
*/
|
|
17
18
|
export const EditableCell = (props) => {
|
|
18
|
-
const { cellElementProps, cellProps, onCellEdit, children, isDisabled, ...rest } = props;
|
|
19
|
+
const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, cellProps, onCellEdit, children, isDisabled, className, style, ...rest } = props;
|
|
19
20
|
isDisabled; // To omit and prevent eslint error.
|
|
20
21
|
const sanitizeString = (text) => {
|
|
21
22
|
return text.replace(/(\r\n|\n|\r)+/gm, ' ');
|
|
@@ -26,7 +27,7 @@ export const EditableCell = (props) => {
|
|
|
26
27
|
}, [cellProps.value]);
|
|
27
28
|
const [key, setKey] = React.useState(getRandomValue(10));
|
|
28
29
|
const [isDirty, setIsDirty] = React.useState(false);
|
|
29
|
-
return (React.createElement(Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
|
|
30
|
+
return (React.createElement(Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, className: cx(cellElementClassName, className), style: { ...cellElementStyle, ...style }, onInput: (e) => {
|
|
30
31
|
setValue(sanitizeString(e.target.innerText));
|
|
31
32
|
setIsDirty(true);
|
|
32
33
|
props.onInput?.(e);
|