@itwin/itwinui-react 3.0.0-dev.1 → 3.0.0-dev.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 +18 -0
- package/cjs/core/Alert/Alert.d.ts +47 -28
- package/cjs/core/Alert/Alert.js +73 -21
- package/cjs/core/Avatar/Avatar.js +1 -1
- package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -4
- package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -5
- package/cjs/core/Carousel/Carousel.d.ts +2 -2
- package/cjs/core/Carousel/Carousel.js +3 -5
- package/cjs/core/Carousel/CarouselDotsList.js +8 -10
- package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/cjs/core/Carousel/CarouselNavigation.js +3 -5
- package/cjs/core/Carousel/CarouselSlider.js +10 -15
- package/cjs/core/ColorPicker/ColorBuilder.js +7 -10
- package/cjs/core/ColorPicker/ColorInputPanel.js +12 -15
- package/cjs/core/ColorPicker/ColorPalette.js +4 -6
- package/cjs/core/ColorPicker/ColorPicker.js +3 -3
- package/cjs/core/ComboBox/ComboBox.js +25 -32
- package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
- package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/cjs/core/ComboBox/helpers.js +4 -5
- package/cjs/core/DatePicker/DatePicker.js +32 -32
- package/cjs/core/Dialog/Dialog.js +11 -4
- package/cjs/core/Dialog/DialogBackdrop.js +1 -1
- package/cjs/core/Dialog/DialogContext.d.ts +11 -0
- package/cjs/core/Dialog/DialogMain.js +16 -22
- package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
- package/cjs/core/FileUpload/FileUpload.js +3 -6
- package/cjs/core/FileUpload/FileUploadCard.js +9 -10
- package/cjs/core/InformationPanel/InformationPanel.js +1 -4
- package/cjs/core/LabeledInput/LabeledInput.js +1 -1
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/cjs/core/Menu/Menu.js +3 -4
- package/cjs/core/Menu/MenuItem.js +8 -11
- package/cjs/core/Modal/Modal.d.ts +8 -9
- package/cjs/core/Modal/Modal.js +7 -17
- package/cjs/core/SearchBox/SearchBox.js +12 -12
- package/cjs/core/Select/Select.js +12 -17
- package/cjs/core/SideNavigation/SideNavigation.js +2 -2
- package/cjs/core/Slider/Slider.js +16 -19
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/StatusMessage/StatusMessage.js +1 -1
- package/cjs/core/Stepper/Stepper.js +1 -1
- package/cjs/core/Stepper/StepperStep.js +1 -1
- package/cjs/core/Table/Table.js +15 -15
- package/cjs/core/Table/TablePaginator.js +2 -3
- package/cjs/core/Table/TableRowMemoized.js +38 -45
- package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
- package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
- package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
- package/cjs/core/Table/cells/DefaultCell.js +1 -1
- package/cjs/core/Table/cells/EditableCell.js +6 -12
- package/cjs/core/Table/columns/actionColumn.js +3 -6
- package/cjs/core/Table/columns/expanderColumn.js +3 -3
- package/cjs/core/Table/columns/selectionColumn.js +4 -4
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -2
- package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
- package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
- package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
- package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/cjs/core/Tabs/Tabs.js +13 -16
- package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -3
- package/cjs/core/ThemeProvider/ThemeProvider.js +11 -13
- package/cjs/core/Tile/Tile.js +2 -3
- package/cjs/core/TimePicker/TimePicker.js +13 -13
- package/cjs/core/Toast/Toast.js +2 -3
- package/cjs/core/Toast/Toaster.js +6 -11
- package/cjs/core/TransferList/TransferList.js +3 -4
- package/cjs/core/Tree/Tree.js +9 -13
- package/cjs/core/Tree/TreeNode.js +9 -10
- package/cjs/core/utils/color/ColorValue.js +9 -15
- package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/cjs/core/utils/components/FocusTrap.js +4 -4
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
- package/cjs/core/utils/components/Popover.js +5 -8
- package/cjs/core/utils/components/Resizer.js +7 -6
- package/cjs/core/utils/components/VirtualScroll.js +14 -21
- package/cjs/core/utils/functions/dom.js +5 -5
- package/cjs/core/utils/functions/polymorphic.js +1 -1
- package/cjs/core/utils/functions/supports.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +0 -1
- package/cjs/core/utils/hooks/index.js +0 -1
- package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
- package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
- package/cjs/core/utils/hooks/useEventListener.js +1 -1
- package/cjs/core/utils/hooks/useGlobals.d.ts +9 -2
- package/cjs/core/utils/hooks/useGlobals.js +6 -4
- package/cjs/core/utils/hooks/useId.js +1 -2
- package/cjs/core/utils/hooks/useIntersection.js +2 -3
- package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
- package/cjs/core/utils/hooks/useOverflow.js +1 -2
- package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
- package/cjs/styles.js +1 -4
- package/esm/core/Alert/Alert.d.ts +47 -28
- package/esm/core/Alert/Alert.js +74 -22
- package/esm/core/Avatar/Avatar.js +1 -1
- package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -4
- package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -5
- package/esm/core/Carousel/Carousel.d.ts +2 -2
- package/esm/core/Carousel/Carousel.js +3 -5
- package/esm/core/Carousel/CarouselDotsList.js +8 -10
- package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
- package/esm/core/Carousel/CarouselNavigation.js +3 -5
- package/esm/core/Carousel/CarouselSlider.js +10 -15
- package/esm/core/ColorPicker/ColorBuilder.js +7 -10
- package/esm/core/ColorPicker/ColorInputPanel.js +12 -15
- package/esm/core/ColorPicker/ColorPalette.js +4 -6
- package/esm/core/ColorPicker/ColorPicker.js +3 -3
- package/esm/core/ComboBox/ComboBox.js +25 -32
- package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
- package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
- package/esm/core/ComboBox/ComboBoxInput.js +21 -20
- package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
- package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
- package/esm/core/ComboBox/helpers.js +4 -5
- package/esm/core/DatePicker/DatePicker.js +32 -32
- package/esm/core/Dialog/Dialog.js +12 -5
- package/esm/core/Dialog/DialogBackdrop.js +1 -1
- package/esm/core/Dialog/DialogContext.d.ts +11 -0
- package/esm/core/Dialog/DialogMain.js +16 -22
- package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
- package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/esm/core/FileUpload/FileEmptyCard.js +1 -1
- package/esm/core/FileUpload/FileUpload.js +3 -6
- package/esm/core/FileUpload/FileUploadCard.js +9 -10
- package/esm/core/InformationPanel/InformationPanel.js +1 -4
- package/esm/core/LabeledInput/LabeledInput.js +1 -1
- package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
- package/esm/core/Menu/Menu.js +3 -4
- package/esm/core/Menu/MenuItem.js +8 -11
- package/esm/core/Modal/Modal.d.ts +8 -9
- package/esm/core/Modal/Modal.js +3 -10
- package/esm/core/SearchBox/SearchBox.js +12 -12
- package/esm/core/Select/Select.js +12 -17
- package/esm/core/SideNavigation/SideNavigation.js +2 -2
- package/esm/core/Slider/Slider.js +16 -19
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/StatusMessage/StatusMessage.js +1 -1
- package/esm/core/Stepper/Stepper.js +1 -1
- package/esm/core/Stepper/StepperStep.js +1 -1
- package/esm/core/Table/Table.js +15 -15
- package/esm/core/Table/TablePaginator.js +2 -3
- package/esm/core/Table/TableRowMemoized.js +38 -45
- package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
- package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
- package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
- package/esm/core/Table/cells/DefaultCell.js +1 -1
- package/esm/core/Table/cells/EditableCell.js +6 -12
- package/esm/core/Table/columns/actionColumn.js +3 -6
- package/esm/core/Table/columns/expanderColumn.js +3 -3
- package/esm/core/Table/columns/selectionColumn.js +4 -4
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
- package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -2
- package/esm/core/Table/hooks/useResizeColumns.js +16 -22
- package/esm/core/Table/hooks/useScrollToRow.js +1 -2
- package/esm/core/Table/hooks/useStickyColumns.js +3 -5
- package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
- package/esm/core/Tabs/Tabs.js +13 -16
- package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -3
- package/esm/core/ThemeProvider/ThemeProvider.js +12 -14
- package/esm/core/Tile/Tile.js +2 -3
- package/esm/core/TimePicker/TimePicker.js +13 -13
- package/esm/core/Toast/Toast.js +2 -3
- package/esm/core/Toast/Toaster.js +6 -11
- package/esm/core/TransferList/TransferList.js +3 -4
- package/esm/core/Tree/Tree.js +9 -13
- package/esm/core/Tree/TreeNode.js +9 -10
- package/esm/core/utils/color/ColorValue.js +9 -15
- package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
- package/esm/core/utils/components/FocusTrap.js +4 -4
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
- package/esm/core/utils/components/Popover.js +5 -8
- package/esm/core/utils/components/Resizer.js +7 -6
- package/esm/core/utils/components/VirtualScroll.js +14 -21
- package/esm/core/utils/functions/dom.js +5 -5
- package/esm/core/utils/functions/polymorphic.js +1 -1
- package/esm/core/utils/functions/supports.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +0 -1
- package/esm/core/utils/hooks/index.js +0 -1
- package/esm/core/utils/hooks/useContainerWidth.js +1 -1
- package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
- package/esm/core/utils/hooks/useEventListener.js +1 -1
- package/esm/core/utils/hooks/useGlobals.d.ts +9 -2
- package/esm/core/utils/hooks/useGlobals.js +6 -4
- package/esm/core/utils/hooks/useId.js +1 -2
- package/esm/core/utils/hooks/useIntersection.js +2 -3
- package/esm/core/utils/hooks/useMediaQuery.js +6 -8
- package/esm/core/utils/hooks/useOverflow.js +1 -2
- package/esm/core/utils/hooks/useResizeObserver.js +3 -4
- package/esm/styles.js +1 -4
- package/package.json +2 -2
- package/styles.css +18 -20
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
- package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
- package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
/*---------------------------------------------------------------------------------------------
|
|
3
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -6,7 +5,7 @@ var _a;
|
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import * as ReactDOM from 'react-dom';
|
|
8
7
|
import { mergeRefs, useResizeObserver, useIsomorphicLayoutEffect, } from '../hooks/index.js';
|
|
9
|
-
const unstable_batchedUpdates =
|
|
8
|
+
const unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates ?? ((cb) => void cb());
|
|
10
9
|
const getScrollableParent = (element, ownerDocument = document) => {
|
|
11
10
|
if (!element || element === ownerDocument.body) {
|
|
12
11
|
return ownerDocument.body;
|
|
@@ -23,8 +22,7 @@ const getElementStyle = (element, prop) => {
|
|
|
23
22
|
return getComputedStyle(element, null).getPropertyValue(prop);
|
|
24
23
|
};
|
|
25
24
|
const getElementHeight = (element) => {
|
|
26
|
-
|
|
27
|
-
return (_a = element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height) !== null && _a !== void 0 ? _a : 0;
|
|
25
|
+
return element?.getBoundingClientRect().height ?? 0;
|
|
28
26
|
};
|
|
29
27
|
const getElementHeightWithMargins = (element) => {
|
|
30
28
|
if (!element) {
|
|
@@ -109,10 +107,8 @@ export const useVirtualization = (props) => {
|
|
|
109
107
|
// Used to mark when scroll container has height (updated by resize observer)
|
|
110
108
|
// because before that calculations are not right
|
|
111
109
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
112
|
-
const getScrollableContainer = () =>
|
|
113
|
-
|
|
114
|
-
return (_a = scrollContainer.current) !== null && _a !== void 0 ? _a : (_b = parentRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument.scrollingElement;
|
|
115
|
-
};
|
|
110
|
+
const getScrollableContainer = () => scrollContainer.current ??
|
|
111
|
+
parentRef.current?.ownerDocument.scrollingElement;
|
|
116
112
|
const visibleChildren = React.useMemo(() => {
|
|
117
113
|
const arr = [];
|
|
118
114
|
const endIndex = Math.min(itemsLength, startNode + visibleNodeCount + bufferSize * 2);
|
|
@@ -122,18 +118,18 @@ export const useVirtualization = (props) => {
|
|
|
122
118
|
return arr;
|
|
123
119
|
}, [itemsLength, itemRenderer, bufferSize, startNode, visibleNodeCount]);
|
|
124
120
|
const updateChildHeight = React.useCallback(() => {
|
|
125
|
-
var _a, _b, _c, _d, _e, _f;
|
|
126
121
|
if (!parentRef.current || !visibleChildren.length) {
|
|
127
122
|
return;
|
|
128
123
|
}
|
|
129
124
|
const firstChild = parentRef.current.children.item(0);
|
|
130
125
|
const secondChild = parentRef.current.children.item(1);
|
|
131
126
|
const lastChild = parentRef.current.children.item(parentRef.current.children.length - 1);
|
|
132
|
-
const firstChildHeight = Number(
|
|
127
|
+
const firstChildHeight = Number(getElementHeightWithMargins(firstChild)?.toFixed(2) ?? 0);
|
|
133
128
|
childHeight.current = {
|
|
134
129
|
first: firstChildHeight,
|
|
135
|
-
middle: Number(
|
|
136
|
-
|
|
130
|
+
middle: Number(getElementHeightWithMargins(secondChild)?.toFixed(2) ??
|
|
131
|
+
firstChildHeight),
|
|
132
|
+
last: Number(getElementHeightWithMargins(lastChild)?.toFixed(2) ?? firstChildHeight),
|
|
137
133
|
};
|
|
138
134
|
}, [visibleChildren.length]);
|
|
139
135
|
const onResize = React.useCallback(({ height }) => {
|
|
@@ -151,14 +147,13 @@ export const useVirtualization = (props) => {
|
|
|
151
147
|
// Find scrollable parent
|
|
152
148
|
// Needed only on init
|
|
153
149
|
useIsomorphicLayoutEffect(() => {
|
|
154
|
-
|
|
155
|
-
const scrollableParent = getScrollableParent(parentRef.current, (_a = parentRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
|
|
150
|
+
const scrollableParent = getScrollableParent(parentRef.current, parentRef.current?.ownerDocument);
|
|
156
151
|
scrollContainer.current = scrollableParent;
|
|
157
152
|
resizeRef(scrollableParent);
|
|
158
153
|
}, [resizeRef]);
|
|
159
154
|
// Stop watching resize, when virtual scroll is unmounted
|
|
160
155
|
useIsomorphicLayoutEffect(() => {
|
|
161
|
-
return () => resizeObserver
|
|
156
|
+
return () => resizeObserver?.disconnect();
|
|
162
157
|
}, [resizeObserver]);
|
|
163
158
|
// Get child height when children available
|
|
164
159
|
useIsomorphicLayoutEffect(() => updateChildHeight(), [updateChildHeight]);
|
|
@@ -185,23 +180,21 @@ export const useVirtualization = (props) => {
|
|
|
185
180
|
updateVirtualScroll();
|
|
186
181
|
}, [updateVirtualScroll]);
|
|
187
182
|
const removeScrollListener = React.useCallback(() => {
|
|
188
|
-
var _a, _b;
|
|
189
183
|
if (!onScrollRef.current) {
|
|
190
184
|
return;
|
|
191
185
|
}
|
|
192
186
|
!scrollContainer.current ||
|
|
193
|
-
scrollContainer.current ===
|
|
194
|
-
?
|
|
187
|
+
scrollContainer.current === parentRef.current?.ownerDocument.body
|
|
188
|
+
? parentRef.current?.ownerDocument.removeEventListener('scroll', onScrollRef.current)
|
|
195
189
|
: scrollContainer.current.removeEventListener('scroll', onScrollRef.current);
|
|
196
190
|
}, []);
|
|
197
191
|
// Add event listener to the scrollable container.
|
|
198
192
|
useIsomorphicLayoutEffect(() => {
|
|
199
|
-
var _a, _b;
|
|
200
193
|
removeScrollListener();
|
|
201
194
|
onScrollRef.current = onScroll;
|
|
202
195
|
if (!scrollContainer.current ||
|
|
203
|
-
scrollContainer.current ===
|
|
204
|
-
|
|
196
|
+
scrollContainer.current === parentRef.current?.ownerDocument.body) {
|
|
197
|
+
parentRef.current?.ownerDocument.addEventListener('scroll', onScroll);
|
|
205
198
|
}
|
|
206
199
|
else {
|
|
207
200
|
scrollContainer.current.addEventListener('scroll', onScroll);
|
|
@@ -11,12 +11,12 @@ import styles from '../../../styles.js';
|
|
|
11
11
|
* @param ownerDocument Can be changed if the container should be in a different document (e.g. in popup).
|
|
12
12
|
*/
|
|
13
13
|
export const getContainer = (containerId, ownerDocument = getDocument()) => {
|
|
14
|
-
|
|
15
|
-
let container = (_a = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.getElementById(containerId)) !== null && _a !== void 0 ? _a : undefined;
|
|
14
|
+
let container = ownerDocument?.getElementById(containerId) ?? undefined;
|
|
16
15
|
if (container == null && !!ownerDocument) {
|
|
17
16
|
container = ownerDocument.createElement('div');
|
|
18
17
|
container.setAttribute('id', containerId);
|
|
19
|
-
const root =
|
|
18
|
+
const root = ownerDocument.querySelector(`.${styles['iui-root']}`) ??
|
|
19
|
+
ownerDocument.body;
|
|
20
20
|
root.appendChild(container);
|
|
21
21
|
}
|
|
22
22
|
return container;
|
|
@@ -41,8 +41,8 @@ export const getWindow = () => {
|
|
|
41
41
|
*/
|
|
42
42
|
export const mergeEventHandlers = (...callbacks) => (event) => {
|
|
43
43
|
for (const cb of callbacks) {
|
|
44
|
-
cb
|
|
45
|
-
if (event
|
|
44
|
+
cb?.(event);
|
|
45
|
+
if (event?.defaultPrevented) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -11,7 +11,7 @@ const _base = (defaultElement) => {
|
|
|
11
11
|
const Comp = React.forwardRef(({ as = defaultElement, ...props }, ref) => {
|
|
12
12
|
const Element = as || 'div'; // eslint-disable-line
|
|
13
13
|
useGlobals();
|
|
14
|
-
return (React.createElement(Element, { ref: ref, ...attrs, ...props, className: getScopedClassName(cx(className, attrs
|
|
14
|
+
return (React.createElement(Element, { ref: ref, ...attrs, ...props, className: getScopedClassName(cx(className, attrs?.className, props.className)) }));
|
|
15
15
|
});
|
|
16
16
|
Comp.displayName = getDisplayNameFromClass(className);
|
|
17
17
|
return Comp;
|
|
@@ -6,4 +6,4 @@ import { getWindow } from './dom.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns true if the :has selector is supported in the browser
|
|
8
8
|
*/
|
|
9
|
-
export const supportsHas = () =>
|
|
9
|
+
export const supportsHas = () => getWindow()?.CSS?.supports?.('selector(:has(+ *))');
|
|
@@ -9,6 +9,5 @@ export * from './useMediaQuery.js';
|
|
|
9
9
|
export * from './useSafeContext.js';
|
|
10
10
|
export * from './useLatestRef.js';
|
|
11
11
|
export * from './useIsomorphicLayoutEffect.js';
|
|
12
|
-
export * from './useIsThemeAlreadySet.js';
|
|
13
12
|
export * from './useIsClient.js';
|
|
14
13
|
export * from './useId.js';
|
|
@@ -13,6 +13,5 @@ export * from './useMediaQuery.js';
|
|
|
13
13
|
export * from './useSafeContext.js';
|
|
14
14
|
export * from './useLatestRef.js';
|
|
15
15
|
export * from './useIsomorphicLayoutEffect.js';
|
|
16
|
-
export * from './useIsThemeAlreadySet.js';
|
|
17
16
|
export * from './useIsClient.js';
|
|
18
17
|
export * from './useId.js';
|
|
@@ -31,7 +31,7 @@ export const useContainerWidth = (watchResizes = true) => {
|
|
|
31
31
|
const updateWidth = React.useCallback(({ width }) => setContentWidth(width), []);
|
|
32
32
|
const [resizeRef, resizeObserver] = useResizeObserver(updateWidth);
|
|
33
33
|
if (!watchResizes) {
|
|
34
|
-
resizeObserver
|
|
34
|
+
resizeObserver?.disconnect();
|
|
35
35
|
}
|
|
36
36
|
const refs = useMergedRefs(ref, watchResizes ? resizeRef : undefined);
|
|
37
37
|
return [refs, contentWidth];
|
|
@@ -7,13 +7,12 @@ import { getTranslateValues, getWindow } from '../functions/index.js';
|
|
|
7
7
|
import { useEventListener } from './useEventListener.js';
|
|
8
8
|
import { useResizeObserver } from './useResizeObserver.js';
|
|
9
9
|
const getContainerRect = (containerRef) => {
|
|
10
|
-
|
|
11
|
-
const containerRect = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
10
|
+
const containerRect = containerRef?.current?.getBoundingClientRect();
|
|
12
11
|
return {
|
|
13
|
-
top:
|
|
14
|
-
right:
|
|
15
|
-
bottom:
|
|
16
|
-
left:
|
|
12
|
+
top: containerRect?.top ?? 0,
|
|
13
|
+
right: containerRect?.right ?? getWindow()?.innerWidth ?? 0,
|
|
14
|
+
bottom: containerRect?.bottom ?? getWindow()?.innerHeight ?? 0,
|
|
15
|
+
left: containerRect?.left ?? 0,
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
18
|
/**
|
|
@@ -31,11 +30,10 @@ export const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
|
|
|
31
30
|
const translateY = React.useRef();
|
|
32
31
|
const containerRectRef = React.useRef(getContainerRect(containerRef));
|
|
33
32
|
const adjustTransform = React.useCallback(() => {
|
|
34
|
-
var _a;
|
|
35
33
|
if (!elementRef.current || !enabled) {
|
|
36
34
|
return;
|
|
37
35
|
}
|
|
38
|
-
const { top, right, bottom, left } =
|
|
36
|
+
const { top, right, bottom, left } = elementRef.current?.getBoundingClientRect();
|
|
39
37
|
let [newTranslateX, newTranslateY] = getTranslateValues(elementRef.current);
|
|
40
38
|
containerRectRef.current = getContainerRect(containerRef);
|
|
41
39
|
if (bottom > containerRectRef.current.bottom) {
|
|
@@ -55,10 +53,10 @@ export const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
|
|
|
55
53
|
elementRef.current.style.transform = `translate(${newTranslateX}px, ${newTranslateY}px)`;
|
|
56
54
|
}, [containerRef, elementRef, enabled]);
|
|
57
55
|
const [resizeRef, resizeObserver] = useResizeObserver(adjustTransform);
|
|
58
|
-
resizeRef(containerRef
|
|
56
|
+
resizeRef(containerRef?.current);
|
|
59
57
|
React.useEffect(() => {
|
|
60
58
|
return () => {
|
|
61
|
-
resizeObserver
|
|
59
|
+
resizeObserver?.disconnect();
|
|
62
60
|
};
|
|
63
61
|
}, [resizeObserver]);
|
|
64
62
|
useEventListener('resize', () => {
|
|
@@ -25,7 +25,7 @@ export const useEventListener = (eventName, handler, element) => {
|
|
|
25
25
|
if (!element) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
const eventListener = (event) =>
|
|
28
|
+
const eventListener = (event) => savedHandler.current?.(event);
|
|
29
29
|
element.addEventListener(eventName, eventListener);
|
|
30
30
|
return () => {
|
|
31
31
|
element.removeEventListener(eventName, eventListener);
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ThemeContext } from '../../ThemeProvider/ThemeContext.js';
|
|
1
3
|
/**
|
|
2
4
|
* Hook used in every component for any shared setup and side effects.
|
|
5
|
+
* Returns the nearest ThemeContext.
|
|
3
6
|
*
|
|
4
7
|
* @private
|
|
5
8
|
*/
|
|
6
|
-
export declare const useGlobals: () =>
|
|
9
|
+
export declare const useGlobals: () => {
|
|
10
|
+
theme?: import("../../index.js").ThemeType | undefined;
|
|
11
|
+
themeOptions?: import("../../ThemeProvider/ThemeProvider.js").ThemeOptions | undefined;
|
|
12
|
+
portalContainerRef?: React.RefObject<HTMLElement> | undefined;
|
|
13
|
+
} | undefined;
|
|
7
14
|
/** Shows console error if ThemeProvider is not used */
|
|
8
|
-
export declare const useThemeProviderWarning: () => void;
|
|
15
|
+
export declare const useThemeProviderWarning: (themeContext: React.ContextType<typeof ThemeContext>) => void;
|
|
@@ -9,24 +9,26 @@ let isDev = false;
|
|
|
9
9
|
try {
|
|
10
10
|
isDev = process.env.NODE_ENV !== 'production';
|
|
11
11
|
}
|
|
12
|
-
catch
|
|
12
|
+
catch { }
|
|
13
13
|
const didLogWarning = {
|
|
14
14
|
fontSize: false,
|
|
15
15
|
themeProvider: false,
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Hook used in every component for any shared setup and side effects.
|
|
19
|
+
* Returns the nearest ThemeContext.
|
|
19
20
|
*
|
|
20
21
|
* @private
|
|
21
22
|
*/
|
|
22
23
|
export const useGlobals = () => {
|
|
23
|
-
|
|
24
|
+
const themeContext = React.useContext(ThemeContext);
|
|
25
|
+
useThemeProviderWarning(themeContext);
|
|
24
26
|
useRootFontSizeWarning();
|
|
27
|
+
return themeContext;
|
|
25
28
|
};
|
|
26
29
|
// ----------------------------------------------------------------------------
|
|
27
30
|
/** Shows console error if ThemeProvider is not used */
|
|
28
|
-
export const useThemeProviderWarning = () => {
|
|
29
|
-
const themeContext = React.useContext(ThemeContext);
|
|
31
|
+
export const useThemeProviderWarning = (themeContext) => {
|
|
30
32
|
React.useEffect(() => {
|
|
31
33
|
if (isDev && !didLogWarning.themeProvider && !themeContext) {
|
|
32
34
|
console.error('iTwinUI components must be used within a tree wrapped in a ThemeProvider.');
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
var _a;
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import { getRandomValue } from '../functions/numbers.js';
|
|
8
7
|
/**
|
|
@@ -16,4 +15,4 @@ export const useId = () => {
|
|
|
16
15
|
// This is needed to avoid bundlers trying to import non-existing export.
|
|
17
16
|
// Read more: https://github.com/webpack/webpack/issues/14814
|
|
18
17
|
const _React = React;
|
|
19
|
-
const useUniqueValue =
|
|
18
|
+
const useUniqueValue = _React.useId ?? (() => getRandomValue(10));
|
|
@@ -20,10 +20,9 @@ export const useIntersection = (onIntersect, options = {}, once = true) => {
|
|
|
20
20
|
const { root, rootMargin, threshold } = options;
|
|
21
21
|
const cleanupRef = React.useRef(() => { });
|
|
22
22
|
const setRef = React.useCallback((node) => {
|
|
23
|
-
|
|
24
|
-
(_a = cleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(cleanupRef);
|
|
23
|
+
cleanupRef.current?.();
|
|
25
24
|
cleanupRef.current = () => { }; // ensure it doesn't try to clean up again
|
|
26
|
-
if (!node || !
|
|
25
|
+
if (!node || !getWindow()?.IntersectionObserver) {
|
|
27
26
|
return;
|
|
28
27
|
}
|
|
29
28
|
const observer = new IntersectionObserver(([entry], obs) => {
|
|
@@ -8,27 +8,25 @@ import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
|
|
|
8
8
|
export const useMediaQuery = (queryString) => {
|
|
9
9
|
const [matches, setMatches] = React.useState();
|
|
10
10
|
useIsomorphicLayoutEffect(() => {
|
|
11
|
-
|
|
12
|
-
const mediaQueryList = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, queryString);
|
|
11
|
+
const mediaQueryList = getWindow()?.matchMedia?.(queryString);
|
|
13
12
|
const handleChange = ({ matches }) => setMatches(matches);
|
|
14
13
|
if (mediaQueryList != undefined) {
|
|
15
14
|
setMatches(mediaQueryList.matches);
|
|
16
15
|
try {
|
|
17
16
|
mediaQueryList.addEventListener('change', handleChange);
|
|
18
17
|
}
|
|
19
|
-
catch
|
|
18
|
+
catch {
|
|
20
19
|
// Safari 13 fallback
|
|
21
|
-
|
|
20
|
+
mediaQueryList.addListener?.(handleChange);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
return () => {
|
|
25
|
-
var _a;
|
|
26
24
|
try {
|
|
27
|
-
mediaQueryList
|
|
25
|
+
mediaQueryList?.removeEventListener('change', handleChange);
|
|
28
26
|
}
|
|
29
|
-
catch
|
|
27
|
+
catch {
|
|
30
28
|
// Safari 13 fallback
|
|
31
|
-
|
|
29
|
+
mediaQueryList?.removeListener?.(handleChange);
|
|
32
30
|
}
|
|
33
31
|
};
|
|
34
32
|
}, [queryString]);
|
|
@@ -49,9 +49,8 @@ export const useOverflow = (items, disabled = false, orientation = 'horizontal')
|
|
|
49
49
|
}, [containerSize, disabled, items]);
|
|
50
50
|
const mergedRefs = useMergedRefs(containerRef, resizeRef);
|
|
51
51
|
useIsomorphicLayoutEffect(() => {
|
|
52
|
-
var _a;
|
|
53
52
|
if (!containerRef.current || disabled) {
|
|
54
|
-
|
|
53
|
+
resizeObserverRef.current?.disconnect();
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
56
|
const dimension = orientation === 'horizontal' ? 'Width' : 'Height';
|
|
@@ -19,14 +19,13 @@ import { getWindow } from '../functions/dom.js';
|
|
|
19
19
|
export const useResizeObserver = (onResize) => {
|
|
20
20
|
const resizeObserver = React.useRef();
|
|
21
21
|
const elementRef = React.useCallback((element) => {
|
|
22
|
-
|
|
23
|
-
if (!((_a = getWindow()) === null || _a === void 0 ? void 0 : _a.ResizeObserver)) {
|
|
22
|
+
if (!getWindow()?.ResizeObserver) {
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
resizeObserver.current?.disconnect();
|
|
27
26
|
if (element) {
|
|
28
27
|
resizeObserver.current = new ResizeObserver(([{ contentRect }]) => onResize(contentRect));
|
|
29
|
-
|
|
28
|
+
resizeObserver.current?.observe(element);
|
|
30
29
|
}
|
|
31
30
|
}, [onResize]);
|
|
32
31
|
return [elementRef, resizeObserver.current];
|
package/esm/styles.js
CHANGED
|
@@ -5,10 +5,8 @@ const styles = {
|
|
|
5
5
|
"iui-root-background": "_iui3-root-background",
|
|
6
6
|
"iui-alert": "_iui3-alert",
|
|
7
7
|
"iui-alert-link": "_iui3-alert-link",
|
|
8
|
-
"iui-
|
|
9
|
-
"iui-alert-icon": "_iui3-alert-icon",
|
|
8
|
+
"iui-button": "_iui3-button",
|
|
10
9
|
"iui-alert-message": "_iui3-alert-message",
|
|
11
|
-
"iui-alert-button-icon": "_iui3-alert-button-icon",
|
|
12
10
|
"iui-anchor": "_iui3-anchor",
|
|
13
11
|
"iui-anchor-external": "_iui3-anchor-external",
|
|
14
12
|
"iui-avatar": "_iui3-avatar",
|
|
@@ -37,7 +35,6 @@ const styles = {
|
|
|
37
35
|
"iui-breadcrumbs-list": "_iui3-breadcrumbs-list",
|
|
38
36
|
"iui-breadcrumbs-item": "_iui3-breadcrumbs-item",
|
|
39
37
|
"iui-breadcrumbs-item-overrides": "_iui3-breadcrumbs-item-overrides",
|
|
40
|
-
"iui-button": "_iui3-button",
|
|
41
38
|
"iui-breadcrumbs-text": "_iui3-breadcrumbs-text",
|
|
42
39
|
"iui-breadcrumbs-button": "_iui3-breadcrumbs-button",
|
|
43
40
|
"iui-breadcrumbs-separator": "_iui3-breadcrumbs-separator",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.2",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@babel/core": "^7.12.10",
|
|
85
|
-
"@itwin/itwinui-css": "^2.0.0-dev.
|
|
85
|
+
"@itwin/itwinui-css": "^2.0.0-dev.2",
|
|
86
86
|
"@itwin/itwinui-variables": "2.1.0-dev.0",
|
|
87
87
|
"@swc/cli": "^0.1.57",
|
|
88
88
|
"@swc/core": "^1.3.21",
|
package/styles.css
CHANGED
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
:where(._iui3-root,._iui3-root *)::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--iui-color-foreground-hsl)/var(--iui-opacity-3))}
|
|
354
354
|
:where(._iui3-root,._iui3-root *)::-webkit-scrollbar-track,:where(._iui3-root,._iui3-root *)::-webkit-scrollbar-corner{background-color:#0000}
|
|
355
355
|
:where(._iui3-root,._iui3-root *),:where(._iui3-root,._iui3-root *):before,:where(._iui3-root,._iui3-root *):after{box-sizing:border-box}
|
|
356
|
-
._iui3-alert{vertical-align:baseline;--_iui-alert-border-color:var(--iui-color-border);border-radius:var(--iui-border-radius-1);color:var(--iui-color-text);background-color:var(--iui-color-background);border:none;border:1px solid var(--_iui-alert-border-color);box-shadow:inset var(--iui-size-2xs)0 0 var(--_iui-alert-border-color);align-items:center;margin:0;padding:
|
|
356
|
+
._iui3-alert{vertical-align:baseline;--_iui-alert-border-color:var(--iui-color-border);border-radius:var(--iui-border-radius-1);color:var(--iui-color-text);background-color:var(--iui-color-background);border:none;border:1px solid var(--_iui-alert-border-color);box-shadow:inset var(--iui-size-2xs)0 0 var(--_iui-alert-border-color);padding:0;align-items:center;margin:0;padding-inline-start:var(--iui-size-m);padding-inline-end:var(--iui-size-xs);display:flex}
|
|
357
357
|
._iui3-alert:where([data-iui-status=informational]){--_iui-alert-border-color:var(--iui-color-border-informational);--_iui-alert-icon-color:var(--iui-color-icon-informational)}
|
|
358
358
|
._iui3-alert:where([data-iui-status=informational])::selection,._iui3-alert:where([data-iui-status=informational]) ::selection{background-color:hsl(var(--iui-color-informational-hsl)/var(--iui-opacity-5))}
|
|
359
359
|
._iui3-alert:where([data-iui-status=informational]) ._iui3-alert-link{color:var(--iui-color-text-informational);-webkit-tap-highlight-color:hsl(var(--iui-color-informational-hsl)/var(--iui-opacity-6))}
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
@supports not selector(*:focus-visible){._iui3-alert:where([data-iui-status=informational]) ._iui3-alert-link:focus{outline:1px solid var(--iui-color-text-informational);outline-offset:1px}}
|
|
362
362
|
._iui3-alert:where([data-iui-status=informational]) ._iui3-alert-link::selection,._iui3-alert:where([data-iui-status=informational]) ._iui3-alert-link ::selection{background-color:hsl(var(--iui-color-informational-hsl)/var(--iui-opacity-5))}
|
|
363
363
|
._iui3-alert:where([data-iui-status=informational]) ._iui3-alert-link:hover{color:var(--iui-color-text-informational-hover)}
|
|
364
|
-
._iui3-alert:where([data-iui-status=informational]) ._iui3-
|
|
364
|
+
._iui3-alert:where([data-iui-status=informational]) ._iui3-button:focus{outline-color:var(--iui-color-text-informational)}
|
|
365
365
|
._iui3-alert:where([data-iui-status=positive]){--_iui-alert-border-color:var(--iui-color-border-positive);--_iui-alert-icon-color:var(--iui-color-icon-positive)}
|
|
366
366
|
._iui3-alert:where([data-iui-status=positive])::selection,._iui3-alert:where([data-iui-status=positive]) ::selection{background-color:hsl(var(--iui-color-positive-hsl)/var(--iui-opacity-5))}
|
|
367
367
|
._iui3-alert:where([data-iui-status=positive]) ._iui3-alert-link{color:var(--iui-color-text-positive);-webkit-tap-highlight-color:hsl(var(--iui-color-positive-hsl)/var(--iui-opacity-6))}
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
@supports not selector(*:focus-visible){._iui3-alert:where([data-iui-status=positive]) ._iui3-alert-link:focus{outline:1px solid var(--iui-color-text-positive);outline-offset:1px}}
|
|
370
370
|
._iui3-alert:where([data-iui-status=positive]) ._iui3-alert-link::selection,._iui3-alert:where([data-iui-status=positive]) ._iui3-alert-link ::selection{background-color:hsl(var(--iui-color-positive-hsl)/var(--iui-opacity-5))}
|
|
371
371
|
._iui3-alert:where([data-iui-status=positive]) ._iui3-alert-link:hover{color:var(--iui-color-text-positive-hover)}
|
|
372
|
-
._iui3-alert:where([data-iui-status=positive]) ._iui3-
|
|
372
|
+
._iui3-alert:where([data-iui-status=positive]) ._iui3-button:focus{outline-color:var(--iui-color-text-positive)}
|
|
373
373
|
._iui3-alert:where([data-iui-status=warning]){--_iui-alert-border-color:var(--iui-color-border-warning);--_iui-alert-icon-color:var(--iui-color-icon-warning)}
|
|
374
374
|
._iui3-alert:where([data-iui-status=warning])::selection,._iui3-alert:where([data-iui-status=warning]) ::selection{background-color:hsl(var(--iui-color-warning-hsl)/var(--iui-opacity-5))}
|
|
375
375
|
._iui3-alert:where([data-iui-status=warning]) ._iui3-alert-link{color:var(--iui-color-text-warning);-webkit-tap-highlight-color:hsl(var(--iui-color-warning-hsl)/var(--iui-opacity-6))}
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
@supports not selector(*:focus-visible){._iui3-alert:where([data-iui-status=warning]) ._iui3-alert-link:focus{outline:1px solid var(--iui-color-text-warning);outline-offset:1px}}
|
|
378
378
|
._iui3-alert:where([data-iui-status=warning]) ._iui3-alert-link::selection,._iui3-alert:where([data-iui-status=warning]) ._iui3-alert-link ::selection{background-color:hsl(var(--iui-color-warning-hsl)/var(--iui-opacity-5))}
|
|
379
379
|
._iui3-alert:where([data-iui-status=warning]) ._iui3-alert-link:hover{color:var(--iui-color-text-warning-hover)}
|
|
380
|
-
._iui3-alert:where([data-iui-status=warning]) ._iui3-
|
|
380
|
+
._iui3-alert:where([data-iui-status=warning]) ._iui3-button:focus{outline-color:var(--iui-color-text-warning)}
|
|
381
381
|
._iui3-alert:where([data-iui-status=negative]){--_iui-alert-border-color:var(--iui-color-border-negative);--_iui-alert-icon-color:var(--iui-color-icon-negative)}
|
|
382
382
|
._iui3-alert:where([data-iui-status=negative])::selection,._iui3-alert:where([data-iui-status=negative]) ::selection{background-color:hsl(var(--iui-color-negative-hsl)/var(--iui-opacity-5))}
|
|
383
383
|
._iui3-alert:where([data-iui-status=negative]) ._iui3-alert-link{color:var(--iui-color-text-negative);-webkit-tap-highlight-color:hsl(var(--iui-color-negative-hsl)/var(--iui-opacity-6))}
|
|
@@ -385,21 +385,17 @@
|
|
|
385
385
|
@supports not selector(*:focus-visible){._iui3-alert:where([data-iui-status=negative]) ._iui3-alert-link:focus{outline:1px solid var(--iui-color-text-negative);outline-offset:1px}}
|
|
386
386
|
._iui3-alert:where([data-iui-status=negative]) ._iui3-alert-link::selection,._iui3-alert:where([data-iui-status=negative]) ._iui3-alert-link ::selection{background-color:hsl(var(--iui-color-negative-hsl)/var(--iui-opacity-5))}
|
|
387
387
|
._iui3-alert:where([data-iui-status=negative]) ._iui3-alert-link:hover{color:var(--iui-color-text-negative-hover)}
|
|
388
|
-
._iui3-alert:where([data-iui-status=negative]) ._iui3-
|
|
388
|
+
._iui3-alert:where([data-iui-status=negative]) ._iui3-button:focus{outline-color:var(--iui-color-text-negative)}
|
|
389
389
|
._iui3-alert:where([data-iui-variant=sticky]){border-radius:0;position:sticky;top:0;left:0}
|
|
390
|
-
._iui3-alert-
|
|
391
|
-
|
|
392
|
-
._iui3-alert-
|
|
393
|
-
._iui3-alert-link{
|
|
394
|
-
._iui3-alert-link:
|
|
395
|
-
._iui3-alert-
|
|
396
|
-
._iui3-alert-
|
|
397
|
-
|
|
398
|
-
._iui3-alert-
|
|
399
|
-
._iui3-alert-button:where(:focus){outline-offset:-1px;outline-width:1px}
|
|
400
|
-
._iui3-alert-button:where([disabled],:disabled,[aria-disabled=true]){--_iui-button-text-color:var(--iui-color-text-disabled);--_iui-button-background-color:transparent;--_iui-button-border-color:transparent;--_iui-button-icon-fill:var(--iui-color-icon-disabled)}
|
|
401
|
-
._iui3-alert-button-icon{display:inline-flex}
|
|
402
|
-
._iui3-alert-button-icon svg{width:var(--iui-size-m);height:var(--iui-size-m);transition:fill var(--iui-duration-1)ease-out;fill:var(--_iui-button-icon-fill,currentColor);flex-shrink:0;display:flex}
|
|
390
|
+
._iui3-alert-message{margin:var(--iui-size-s)var(--iui-size-m);word-break:normal;overflow-wrap:anywhere;flex:999}
|
|
391
|
+
._iui3-alert-link{color:var(--iui-color-text-accent);-webkit-tap-highlight-color:hsl(var(--iui-color-accent-hsl)/var(--iui-opacity-6));border-radius:var(--iui-border-radius-1);cursor:pointer;border-radius:var(--iui-border-radius-1);cursor:pointer;margin-left:var(--iui-size-xs);-webkit-user-select:none;user-select:none;white-space:nowrap;text-decoration:underline}
|
|
392
|
+
._iui3-alert-link:where(button){font:inherit;background:0 0;border:none;padding:0}
|
|
393
|
+
._iui3-alert-link:focus-visible{outline:1px solid var(--iui-color-text-accent);outline-offset:1px}
|
|
394
|
+
@supports not selector(*:focus-visible){._iui3-alert-link:focus{outline:1px solid var(--iui-color-text-accent);outline-offset:1px}}
|
|
395
|
+
._iui3-alert-link:hover{color:var(--iui-color-text-accent-hover);text-decoration:underline}
|
|
396
|
+
@media (prefers-contrast:more){._iui3-alert-link{text-decoration:underline}._iui3-alert-link:hover{text-decoration:none}}
|
|
397
|
+
:is([data-iui-contrast=high] ._iui3-alert-link){text-decoration:underline}
|
|
398
|
+
:is([data-iui-contrast=high] ._iui3-alert-link):hover,._iui3-alert-link:hover{text-decoration:none}
|
|
403
399
|
._iui3-anchor{color:var(--iui-color-text-accent);-webkit-tap-highlight-color:hsl(var(--iui-color-accent-hsl)/var(--iui-opacity-6));border-radius:var(--iui-border-radius-1);cursor:pointer;text-decoration:none}
|
|
404
400
|
._iui3-anchor:where(button){font:inherit;background:0 0;border:none;padding:0}
|
|
405
401
|
._iui3-anchor:focus-visible{outline:1px solid var(--iui-color-text-accent);outline-offset:1px}
|
|
@@ -601,6 +597,7 @@
|
|
|
601
597
|
._iui3-carousel-navigation-right{justify-content:flex-end}
|
|
602
598
|
._iui3-checkbox-wrapper{vertical-align:baseline;font-size:var(--iui-font-size-1);width:-moz-fit-content;width:fit-content;-webkit-user-select:none;user-select:none;cursor:pointer;color:var(--iui-color-text);align-items:center;gap:var(--iui-size-xs);border:none;margin:0;padding:0;display:flex;position:relative}
|
|
603
599
|
._iui3-checkbox-wrapper._iui3-loading{cursor:progress;color:var(--iui-color-text-disabled);font-style:italic}
|
|
600
|
+
._iui3-checkbox-wrapper>._iui3-checkbox-label,._iui3-checkbox-wrapper>._iui3-radio-label{line-height:var(--iui-size-l)}
|
|
604
601
|
._iui3-checkbox-wrapper>._iui3-checkbox-label svg,._iui3-checkbox-wrapper>._iui3-radio-label svg{width:var(--iui-size-m);height:var(--iui-size-m);vertical-align:middle;fill:var(--iui-color-icon);flex-shrink:0;display:flex}
|
|
605
602
|
._iui3-checkbox-wrapper._iui3-disabled{cursor:not-allowed;color:var(--iui-color-text-disabled)}
|
|
606
603
|
._iui3-checkbox-wrapper._iui3-disabled svg{fill:var(--iui-color-icon-disabled)}
|
|
@@ -935,7 +932,7 @@
|
|
|
935
932
|
._iui3-information-body-content._iui3-inline{row-gap:var(--iui-size-s);grid-template-columns:auto 1fr;align-items:center}
|
|
936
933
|
._iui3-information-body-content._iui3-inline ._iui3-input-label{margin:0 var(--iui-size-m)0 0;text-align:end;justify-self:end}
|
|
937
934
|
._iui3-information-body-content._iui3-inline ._iui3-input-label._iui3-required{margin-right:calc(var(--iui-size-2xs)*1.5 - 1px)}
|
|
938
|
-
._iui3-input{--_iui-input-background-color:var(--iui-color-background);--_iui-input-border-color:var(--iui-color-border-foreground);--_iui-input-text-color:var(--iui-color-text);vertical-align:baseline;width:100%;font-family:inherit;font-size:var(--iui-font-size-1);font-weight:var(--iui-font-weight-normal);border-radius:var(--iui-border-radius-1);-webkit-appearance:none;appearance:none;min-height:var(--_iui-input-min-height);padding:0;padding-block:var(--_iui-input-padding-block);padding-inline:var(--iui-size-s);color:var(--_iui-input-text-color);background-color:var(--_iui-input-background-color);border:none;border:1px solid var(--_iui-input-border-color);transition:border-color var(--iui-duration-1)ease-out;--_iui-input-padding-block:var(--iui-size-2xs);--_iui-input-min-height:var(--iui-component-height);margin:0}
|
|
935
|
+
._iui3-input{--_iui-input-background-color:var(--iui-color-background);--_iui-input-border-color:var(--iui-color-border-foreground);--_iui-input-text-color:var(--iui-color-text);vertical-align:baseline;width:100%;font-family:inherit;font-size:var(--iui-font-size-1);font-weight:var(--iui-font-weight-normal);line-height:var(--iui-size-l);border-radius:var(--iui-border-radius-1);-webkit-appearance:none;appearance:none;min-height:var(--_iui-input-min-height);padding:0;padding-block:var(--_iui-input-padding-block);padding-inline:var(--iui-size-s);color:var(--_iui-input-text-color);background-color:var(--_iui-input-background-color);border:none;border:1px solid var(--_iui-input-border-color);transition:border-color var(--iui-duration-1)ease-out;--_iui-input-padding-block:var(--iui-size-2xs);--_iui-input-min-height:var(--iui-component-height);margin:0}
|
|
939
936
|
._iui3-input:focus-visible{outline:2px solid var(--iui-color-border-accent);outline-offset:-2px}
|
|
940
937
|
@supports not selector(*:focus-visible){._iui3-input:focus{outline:2px solid var(--iui-color-border-accent);outline-offset:-2px}}
|
|
941
938
|
._iui3-input::placeholder{--_iui-input-text-color:var(--iui-color-text-disabled);-webkit-user-select:none;user-select:none;color:var(--_iui-input-text-color)}
|
|
@@ -1166,6 +1163,7 @@
|
|
|
1166
1163
|
._iui3-progress-indicator-overlay ._iui3-overlay-exiting{animation:_iui3-closeAnimation var(--iui-duration-1)linear}
|
|
1167
1164
|
._iui3-radio-wrapper{vertical-align:baseline;font-size:var(--iui-font-size-1);width:-moz-fit-content;width:fit-content;-webkit-user-select:none;user-select:none;cursor:pointer;color:var(--iui-color-text);align-items:center;gap:var(--iui-size-xs);border:none;margin:0;padding:0;display:flex;position:relative}
|
|
1168
1165
|
._iui3-radio-wrapper._iui3-loading{cursor:progress;color:var(--iui-color-text-disabled);font-style:italic}
|
|
1166
|
+
._iui3-radio-wrapper>._iui3-checkbox-label,._iui3-radio-wrapper>._iui3-radio-label{line-height:var(--iui-size-l)}
|
|
1169
1167
|
._iui3-radio-wrapper>._iui3-checkbox-label svg,._iui3-radio-wrapper>._iui3-radio-label svg{width:var(--iui-size-m);height:var(--iui-size-m);vertical-align:middle;fill:var(--iui-color-icon);flex-shrink:0;display:flex}
|
|
1170
1168
|
._iui3-radio-wrapper._iui3-disabled{cursor:not-allowed;color:var(--iui-color-text-disabled)}
|
|
1171
1169
|
._iui3-radio-wrapper._iui3-disabled svg{fill:var(--iui-color-icon-disabled)}
|
|
@@ -1229,7 +1227,7 @@
|
|
|
1229
1227
|
._iui3-expandable-searchbox:where([data-iui-expanded=true]){width:100%;border-color:var(--_iui-input-border-color)}
|
|
1230
1228
|
._iui3-search-icon{margin:0 var(--iui-size-s)}
|
|
1231
1229
|
._iui3-search-icon:is(:first-child){margin:0 var(--_iui-flex-input-icon-margin,10px)}
|
|
1232
|
-
._iui3-select-button{width:100%;border-radius:var(--iui-border-radius-1);min-height:var(--_iui-select-min-height);padding-block:var(--_iui-select-padding-block);padding-inline:var(--iui-size-s);gap:var(--iui-size-xs);transition:border-color var(--iui-duration-1)ease-out;-webkit-user-select:none;user-select:none;color:var(--iui-color-text);background-color:var(--iui-color-background);border:1px solid var(--iui-color-border-foreground);--_iui-select-padding-block:var(--iui-size-2xs);--_iui-select-min-height:var(--iui-component-height);align-items:center;display:flex;position:relative;overflow:hidden}
|
|
1230
|
+
._iui3-select-button{width:100%;border-radius:var(--iui-border-radius-1);min-height:var(--_iui-select-min-height);padding-block:var(--_iui-select-padding-block);padding-inline:var(--iui-size-s);gap:var(--iui-size-xs);transition:border-color var(--iui-duration-1)ease-out;-webkit-user-select:none;user-select:none;color:var(--iui-color-text);background-color:var(--iui-color-background);border:1px solid var(--iui-color-border-foreground);line-height:var(--iui-size-l);--_iui-select-padding-block:var(--iui-size-2xs);--_iui-select-min-height:var(--iui-component-height);align-items:center;display:flex;position:relative;overflow:hidden}
|
|
1233
1231
|
._iui3-select-button:focus-visible{outline:2px solid var(--iui-color-border-accent);outline-offset:-2px}
|
|
1234
1232
|
@supports not selector(*:focus-visible){._iui3-select-button:focus{outline:2px solid var(--iui-color-border-accent);outline-offset:-2px}}
|
|
1235
1233
|
._iui3-select-button._iui3-disabled{background-color:var(--iui-color-background-disabled);border-color:var(--iui-color-border-disabled);--_iui-input-with-icon-hover-border-color:var(--iui-color-border-disabled);cursor:not-allowed}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that returns a boolean ref which is true if either:
|
|
4
|
-
* - There is a parent `ThemeProvider` in the tree, or
|
|
5
|
-
* - The <body> element has data-iui-theme attribute
|
|
6
|
-
*/
|
|
7
|
-
export declare const useIsThemeAlreadySet: (ownerDocument?: Document | undefined) => React.MutableRefObject<boolean>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.useIsThemeAlreadySet = void 0;
|
|
27
|
-
/*---------------------------------------------------------------------------------------------
|
|
28
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
-
*--------------------------------------------------------------------------------------------*/
|
|
31
|
-
const React = __importStar(require("react"));
|
|
32
|
-
const ThemeContext_js_1 = require("../../ThemeProvider/ThemeContext.js");
|
|
33
|
-
const useIsomorphicLayoutEffect_js_1 = require("./useIsomorphicLayoutEffect.js");
|
|
34
|
-
const index_js_1 = require("../functions/index.js");
|
|
35
|
-
/**
|
|
36
|
-
* Hook that returns a boolean ref which is true if either:
|
|
37
|
-
* - There is a parent `ThemeProvider` in the tree, or
|
|
38
|
-
* - The <body> element has data-iui-theme attribute
|
|
39
|
-
*/
|
|
40
|
-
const useIsThemeAlreadySet = (ownerDocument = (0, index_js_1.getDocument)()) => {
|
|
41
|
-
const parentContext = React.useContext(ThemeContext_js_1.ThemeContext);
|
|
42
|
-
const isThemeAlreadySet = React.useRef(!!parentContext || !!(ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.dataset.iuiTheme));
|
|
43
|
-
(0, useIsomorphicLayoutEffect_js_1.useIsomorphicLayoutEffect)(() => {
|
|
44
|
-
if (parentContext ||
|
|
45
|
-
(ownerDocument && !!ownerDocument.body.dataset.iuiTheme)) {
|
|
46
|
-
isThemeAlreadySet.current = true;
|
|
47
|
-
}
|
|
48
|
-
return () => {
|
|
49
|
-
isThemeAlreadySet.current = false;
|
|
50
|
-
};
|
|
51
|
-
}, [parentContext, ownerDocument]);
|
|
52
|
-
return isThemeAlreadySet;
|
|
53
|
-
};
|
|
54
|
-
exports.useIsThemeAlreadySet = useIsThemeAlreadySet;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that returns a boolean ref which is true if either:
|
|
4
|
-
* - There is a parent `ThemeProvider` in the tree, or
|
|
5
|
-
* - The <body> element has data-iui-theme attribute
|
|
6
|
-
*/
|
|
7
|
-
export declare const useIsThemeAlreadySet: (ownerDocument?: Document | undefined) => React.MutableRefObject<boolean>;
|