@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
|
@@ -48,7 +48,6 @@ const ELLIPSIS_CHAR = '…';
|
|
|
48
48
|
* />
|
|
49
49
|
*/
|
|
50
50
|
const MiddleTextTruncation = (props) => {
|
|
51
|
-
var _a;
|
|
52
51
|
const { text, endCharsCount = 6, textRenderer, style, ...rest } = props;
|
|
53
52
|
const [ref, visibleCount] = (0, useOverflow_js_1.useOverflow)(text);
|
|
54
53
|
const truncatedText = React.useMemo(() => {
|
|
@@ -65,7 +64,7 @@ const MiddleTextTruncation = (props) => {
|
|
|
65
64
|
flexGrow: 1,
|
|
66
65
|
whiteSpace: 'nowrap',
|
|
67
66
|
...style,
|
|
68
|
-
}, ref: ref, ...rest },
|
|
67
|
+
}, ref: ref, ...rest }, textRenderer?.(truncatedText, text) ?? truncatedText));
|
|
69
68
|
};
|
|
70
69
|
exports.MiddleTextTruncation = MiddleTextTruncation;
|
|
71
70
|
exports.default = exports.MiddleTextTruncation;
|
|
@@ -42,7 +42,6 @@ const ThemeContext_js_1 = require("../../ThemeProvider/ThemeContext.js");
|
|
|
42
42
|
* @private
|
|
43
43
|
*/
|
|
44
44
|
exports.Popover = React.forwardRef((props, ref) => {
|
|
45
|
-
var _a;
|
|
46
45
|
const [mounted, setMounted] = React.useState(false);
|
|
47
46
|
const themeInfo = React.useContext(ThemeContext_js_1.ThemeContext);
|
|
48
47
|
const isDomAvailable = (0, index_js_1.useIsClient)();
|
|
@@ -59,15 +58,14 @@ exports.Popover = React.forwardRef((props, ref) => {
|
|
|
59
58
|
const removeTabIndex = {
|
|
60
59
|
fn: () => ({
|
|
61
60
|
onCreate: (instance) => {
|
|
62
|
-
|
|
63
|
-
(_a = instance.popper.firstElementChild) === null || _a === void 0 ? void 0 : _a.removeAttribute('tabindex');
|
|
61
|
+
instance.popper.firstElementChild?.removeAttribute('tabindex');
|
|
64
62
|
},
|
|
65
63
|
}),
|
|
66
64
|
};
|
|
67
65
|
const computedProps = {
|
|
68
66
|
allowHTML: true,
|
|
69
67
|
animation: false,
|
|
70
|
-
appendTo: (el) =>
|
|
68
|
+
appendTo: (el) => themeInfo?.portalContainerRef?.current || el.ownerDocument.body,
|
|
71
69
|
arrow: false,
|
|
72
70
|
duration: 0,
|
|
73
71
|
interactive: true,
|
|
@@ -92,7 +90,7 @@ exports.Popover = React.forwardRef((props, ref) => {
|
|
|
92
90
|
modifiers: [
|
|
93
91
|
{ name: 'flip' },
|
|
94
92
|
{ name: 'preventOverflow', options: { padding: 0 } },
|
|
95
|
-
...(
|
|
93
|
+
...(props.popperOptions?.modifiers || []),
|
|
96
94
|
],
|
|
97
95
|
},
|
|
98
96
|
};
|
|
@@ -107,9 +105,8 @@ exports.Popover = React.forwardRef((props, ref) => {
|
|
|
107
105
|
const clonedContent = React.isValidElement(props.content)
|
|
108
106
|
? React.cloneElement(props.content, {
|
|
109
107
|
onClick: (e) => {
|
|
110
|
-
var _a, _b;
|
|
111
108
|
e.stopPropagation();
|
|
112
|
-
|
|
109
|
+
props.content.props.onClick?.(e);
|
|
113
110
|
},
|
|
114
111
|
})
|
|
115
112
|
: props.content;
|
|
@@ -126,7 +123,7 @@ exports.hideOnEscOrTab = {
|
|
|
126
123
|
/** @returns true if none of the children are tabbable */
|
|
127
124
|
const shouldHideOnTab = () => {
|
|
128
125
|
const descendents = Array.from(instance.popper.querySelectorAll('*'));
|
|
129
|
-
return !descendents.some((el) =>
|
|
126
|
+
return !descendents.some((el) => el?.tabIndex >= 0);
|
|
130
127
|
};
|
|
131
128
|
const onKeyDown = (event) => {
|
|
132
129
|
if (event.altKey) {
|
|
@@ -64,17 +64,18 @@ const Resizer = (props) => {
|
|
|
64
64
|
const originalUserSelect = ownerDocument.body.style.userSelect;
|
|
65
65
|
ownerDocument.body.style.userSelect = 'none';
|
|
66
66
|
const onResizePointerMove = (event) => {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
68
67
|
if (!elementRef.current) {
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
71
70
|
if (!isResizing.current) {
|
|
72
71
|
isResizing.current = true;
|
|
73
|
-
onResizeStart
|
|
72
|
+
onResizeStart?.();
|
|
74
73
|
}
|
|
75
|
-
const containerRect =
|
|
76
|
-
const clientX = (0, index_js_1.getBoundedValue)(event.clientX,
|
|
77
|
-
const clientY = (0, index_js_1.getBoundedValue)(event.clientY,
|
|
74
|
+
const containerRect = containerRef?.current?.getBoundingClientRect();
|
|
75
|
+
const clientX = (0, index_js_1.getBoundedValue)(event.clientX, containerRect?.left ?? 0, containerRect?.right ?? ownerDocument.documentElement.clientWidth ?? 0);
|
|
76
|
+
const clientY = (0, index_js_1.getBoundedValue)(event.clientY, containerRect?.top ?? 0, containerRect?.bottom ??
|
|
77
|
+
ownerDocument.documentElement.clientHeight ??
|
|
78
|
+
0);
|
|
78
79
|
const diffX = initialPointerX - clientX;
|
|
79
80
|
const diffY = initialPointerY - clientY;
|
|
80
81
|
switch (resizer) {
|
|
@@ -155,7 +156,7 @@ const Resizer = (props) => {
|
|
|
155
156
|
if (elementRef.current) {
|
|
156
157
|
ownerDocument.body.style.userSelect = originalUserSelect;
|
|
157
158
|
isResizing.current = false;
|
|
158
|
-
onResizeEnd
|
|
159
|
+
onResizeEnd?.({
|
|
159
160
|
width,
|
|
160
161
|
height,
|
|
161
162
|
transform: `translate(${translateX}px, ${translateY}px)`,
|
|
@@ -22,7 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var _a;
|
|
26
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
26
|
exports.useVirtualization = exports.VirtualScroll = void 0;
|
|
28
27
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -32,7 +31,7 @@ exports.useVirtualization = exports.VirtualScroll = void 0;
|
|
|
32
31
|
const React = __importStar(require("react"));
|
|
33
32
|
const ReactDOM = __importStar(require("react-dom"));
|
|
34
33
|
const index_js_1 = require("../hooks/index.js");
|
|
35
|
-
const unstable_batchedUpdates =
|
|
34
|
+
const unstable_batchedUpdates = ReactDOM.unstable_batchedUpdates ?? ((cb) => void cb());
|
|
36
35
|
const getScrollableParent = (element, ownerDocument = document) => {
|
|
37
36
|
if (!element || element === ownerDocument.body) {
|
|
38
37
|
return ownerDocument.body;
|
|
@@ -49,8 +48,7 @@ const getElementStyle = (element, prop) => {
|
|
|
49
48
|
return getComputedStyle(element, null).getPropertyValue(prop);
|
|
50
49
|
};
|
|
51
50
|
const getElementHeight = (element) => {
|
|
52
|
-
|
|
53
|
-
return (_a = element === null || element === void 0 ? void 0 : element.getBoundingClientRect().height) !== null && _a !== void 0 ? _a : 0;
|
|
51
|
+
return element?.getBoundingClientRect().height ?? 0;
|
|
54
52
|
};
|
|
55
53
|
const getElementHeightWithMargins = (element) => {
|
|
56
54
|
if (!element) {
|
|
@@ -135,10 +133,8 @@ const useVirtualization = (props) => {
|
|
|
135
133
|
// Used to mark when scroll container has height (updated by resize observer)
|
|
136
134
|
// because before that calculations are not right
|
|
137
135
|
const [isMounted, setIsMounted] = React.useState(false);
|
|
138
|
-
const getScrollableContainer = () =>
|
|
139
|
-
|
|
140
|
-
return (_a = scrollContainer.current) !== null && _a !== void 0 ? _a : (_b = parentRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument.scrollingElement;
|
|
141
|
-
};
|
|
136
|
+
const getScrollableContainer = () => scrollContainer.current ??
|
|
137
|
+
parentRef.current?.ownerDocument.scrollingElement;
|
|
142
138
|
const visibleChildren = React.useMemo(() => {
|
|
143
139
|
const arr = [];
|
|
144
140
|
const endIndex = Math.min(itemsLength, startNode + visibleNodeCount + bufferSize * 2);
|
|
@@ -148,18 +144,18 @@ const useVirtualization = (props) => {
|
|
|
148
144
|
return arr;
|
|
149
145
|
}, [itemsLength, itemRenderer, bufferSize, startNode, visibleNodeCount]);
|
|
150
146
|
const updateChildHeight = React.useCallback(() => {
|
|
151
|
-
var _a, _b, _c, _d, _e, _f;
|
|
152
147
|
if (!parentRef.current || !visibleChildren.length) {
|
|
153
148
|
return;
|
|
154
149
|
}
|
|
155
150
|
const firstChild = parentRef.current.children.item(0);
|
|
156
151
|
const secondChild = parentRef.current.children.item(1);
|
|
157
152
|
const lastChild = parentRef.current.children.item(parentRef.current.children.length - 1);
|
|
158
|
-
const firstChildHeight = Number(
|
|
153
|
+
const firstChildHeight = Number(getElementHeightWithMargins(firstChild)?.toFixed(2) ?? 0);
|
|
159
154
|
childHeight.current = {
|
|
160
155
|
first: firstChildHeight,
|
|
161
|
-
middle: Number(
|
|
162
|
-
|
|
156
|
+
middle: Number(getElementHeightWithMargins(secondChild)?.toFixed(2) ??
|
|
157
|
+
firstChildHeight),
|
|
158
|
+
last: Number(getElementHeightWithMargins(lastChild)?.toFixed(2) ?? firstChildHeight),
|
|
163
159
|
};
|
|
164
160
|
}, [visibleChildren.length]);
|
|
165
161
|
const onResize = React.useCallback(({ height }) => {
|
|
@@ -177,14 +173,13 @@ const useVirtualization = (props) => {
|
|
|
177
173
|
// Find scrollable parent
|
|
178
174
|
// Needed only on init
|
|
179
175
|
(0, index_js_1.useIsomorphicLayoutEffect)(() => {
|
|
180
|
-
|
|
181
|
-
const scrollableParent = getScrollableParent(parentRef.current, (_a = parentRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
|
|
176
|
+
const scrollableParent = getScrollableParent(parentRef.current, parentRef.current?.ownerDocument);
|
|
182
177
|
scrollContainer.current = scrollableParent;
|
|
183
178
|
resizeRef(scrollableParent);
|
|
184
179
|
}, [resizeRef]);
|
|
185
180
|
// Stop watching resize, when virtual scroll is unmounted
|
|
186
181
|
(0, index_js_1.useIsomorphicLayoutEffect)(() => {
|
|
187
|
-
return () => resizeObserver
|
|
182
|
+
return () => resizeObserver?.disconnect();
|
|
188
183
|
}, [resizeObserver]);
|
|
189
184
|
// Get child height when children available
|
|
190
185
|
(0, index_js_1.useIsomorphicLayoutEffect)(() => updateChildHeight(), [updateChildHeight]);
|
|
@@ -211,23 +206,21 @@ const useVirtualization = (props) => {
|
|
|
211
206
|
updateVirtualScroll();
|
|
212
207
|
}, [updateVirtualScroll]);
|
|
213
208
|
const removeScrollListener = React.useCallback(() => {
|
|
214
|
-
var _a, _b;
|
|
215
209
|
if (!onScrollRef.current) {
|
|
216
210
|
return;
|
|
217
211
|
}
|
|
218
212
|
!scrollContainer.current ||
|
|
219
|
-
scrollContainer.current ===
|
|
220
|
-
?
|
|
213
|
+
scrollContainer.current === parentRef.current?.ownerDocument.body
|
|
214
|
+
? parentRef.current?.ownerDocument.removeEventListener('scroll', onScrollRef.current)
|
|
221
215
|
: scrollContainer.current.removeEventListener('scroll', onScrollRef.current);
|
|
222
216
|
}, []);
|
|
223
217
|
// Add event listener to the scrollable container.
|
|
224
218
|
(0, index_js_1.useIsomorphicLayoutEffect)(() => {
|
|
225
|
-
var _a, _b;
|
|
226
219
|
removeScrollListener();
|
|
227
220
|
onScrollRef.current = onScroll;
|
|
228
221
|
if (!scrollContainer.current ||
|
|
229
|
-
scrollContainer.current ===
|
|
230
|
-
|
|
222
|
+
scrollContainer.current === parentRef.current?.ownerDocument.body) {
|
|
223
|
+
parentRef.current?.ownerDocument.addEventListener('scroll', onScroll);
|
|
231
224
|
}
|
|
232
225
|
else {
|
|
233
226
|
scrollContainer.current.addEventListener('scroll', onScroll);
|
|
@@ -17,12 +17,12 @@ const styles_js_1 = __importDefault(require("../../../styles.js"));
|
|
|
17
17
|
* @param ownerDocument Can be changed if the container should be in a different document (e.g. in popup).
|
|
18
18
|
*/
|
|
19
19
|
const getContainer = (containerId, ownerDocument = (0, exports.getDocument)()) => {
|
|
20
|
-
|
|
21
|
-
let container = (_a = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.getElementById(containerId)) !== null && _a !== void 0 ? _a : undefined;
|
|
20
|
+
let container = ownerDocument?.getElementById(containerId) ?? undefined;
|
|
22
21
|
if (container == null && !!ownerDocument) {
|
|
23
22
|
container = ownerDocument.createElement('div');
|
|
24
23
|
container.setAttribute('id', containerId);
|
|
25
|
-
const root =
|
|
24
|
+
const root = ownerDocument.querySelector(`.${styles_js_1.default['iui-root']}`) ??
|
|
25
|
+
ownerDocument.body;
|
|
26
26
|
root.appendChild(container);
|
|
27
27
|
}
|
|
28
28
|
return container;
|
|
@@ -50,8 +50,8 @@ exports.getWindow = getWindow;
|
|
|
50
50
|
*/
|
|
51
51
|
const mergeEventHandlers = (...callbacks) => (event) => {
|
|
52
52
|
for (const cb of callbacks) {
|
|
53
|
-
cb
|
|
54
|
-
if (event
|
|
53
|
+
cb?.(event);
|
|
54
|
+
if (event?.defaultPrevented) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -40,7 +40,7 @@ const _base = (defaultElement) => {
|
|
|
40
40
|
const Comp = React.forwardRef(({ as = defaultElement, ...props }, ref) => {
|
|
41
41
|
const Element = as || 'div'; // eslint-disable-line
|
|
42
42
|
(0, useGlobals_js_1.useGlobals)();
|
|
43
|
-
return (React.createElement(Element, { ref: ref, ...attrs, ...props, className: getScopedClassName((0, classnames_1.default)(className, attrs
|
|
43
|
+
return (React.createElement(Element, { ref: ref, ...attrs, ...props, className: getScopedClassName((0, classnames_1.default)(className, attrs?.className, props.className)) }));
|
|
44
44
|
});
|
|
45
45
|
Comp.displayName = getDisplayNameFromClass(className);
|
|
46
46
|
return Comp;
|
|
@@ -9,5 +9,5 @@ const dom_js_1 = require("./dom.js");
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns true if the :has selector is supported in the browser
|
|
11
11
|
*/
|
|
12
|
-
const supportsHas = () =>
|
|
12
|
+
const supportsHas = () => (0, dom_js_1.getWindow)()?.CSS?.supports?.('selector(:has(+ *))');
|
|
13
13
|
exports.supportsHas = supportsHas;
|
|
@@ -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';
|
|
@@ -29,6 +29,5 @@ __exportStar(require("./useMediaQuery.js"), exports);
|
|
|
29
29
|
__exportStar(require("./useSafeContext.js"), exports);
|
|
30
30
|
__exportStar(require("./useLatestRef.js"), exports);
|
|
31
31
|
__exportStar(require("./useIsomorphicLayoutEffect.js"), exports);
|
|
32
|
-
__exportStar(require("./useIsThemeAlreadySet.js"), exports);
|
|
33
32
|
__exportStar(require("./useIsClient.js"), exports);
|
|
34
33
|
__exportStar(require("./useId.js"), exports);
|
|
@@ -57,7 +57,7 @@ const useContainerWidth = (watchResizes = true) => {
|
|
|
57
57
|
const updateWidth = React.useCallback(({ width }) => setContentWidth(width), []);
|
|
58
58
|
const [resizeRef, resizeObserver] = (0, useResizeObserver_js_1.useResizeObserver)(updateWidth);
|
|
59
59
|
if (!watchResizes) {
|
|
60
|
-
resizeObserver
|
|
60
|
+
resizeObserver?.disconnect();
|
|
61
61
|
}
|
|
62
62
|
const refs = (0, useMergedRefs_js_1.useMergedRefs)(ref, watchResizes ? resizeRef : undefined);
|
|
63
63
|
return [refs, contentWidth];
|
|
@@ -33,13 +33,12 @@ const index_js_1 = require("../functions/index.js");
|
|
|
33
33
|
const useEventListener_js_1 = require("./useEventListener.js");
|
|
34
34
|
const useResizeObserver_js_1 = require("./useResizeObserver.js");
|
|
35
35
|
const getContainerRect = (containerRef) => {
|
|
36
|
-
|
|
37
|
-
const containerRect = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
36
|
+
const containerRect = containerRef?.current?.getBoundingClientRect();
|
|
38
37
|
return {
|
|
39
|
-
top:
|
|
40
|
-
right:
|
|
41
|
-
bottom:
|
|
42
|
-
left:
|
|
38
|
+
top: containerRect?.top ?? 0,
|
|
39
|
+
right: containerRect?.right ?? (0, index_js_1.getWindow)()?.innerWidth ?? 0,
|
|
40
|
+
bottom: containerRect?.bottom ?? (0, index_js_1.getWindow)()?.innerHeight ?? 0,
|
|
41
|
+
left: containerRect?.left ?? 0,
|
|
43
42
|
};
|
|
44
43
|
};
|
|
45
44
|
/**
|
|
@@ -57,11 +56,10 @@ const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
|
|
|
57
56
|
const translateY = React.useRef();
|
|
58
57
|
const containerRectRef = React.useRef(getContainerRect(containerRef));
|
|
59
58
|
const adjustTransform = React.useCallback(() => {
|
|
60
|
-
var _a;
|
|
61
59
|
if (!elementRef.current || !enabled) {
|
|
62
60
|
return;
|
|
63
61
|
}
|
|
64
|
-
const { top, right, bottom, left } =
|
|
62
|
+
const { top, right, bottom, left } = elementRef.current?.getBoundingClientRect();
|
|
65
63
|
let [newTranslateX, newTranslateY] = (0, index_js_1.getTranslateValues)(elementRef.current);
|
|
66
64
|
containerRectRef.current = getContainerRect(containerRef);
|
|
67
65
|
if (bottom > containerRectRef.current.bottom) {
|
|
@@ -81,10 +79,10 @@ const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
|
|
|
81
79
|
elementRef.current.style.transform = `translate(${newTranslateX}px, ${newTranslateY}px)`;
|
|
82
80
|
}, [containerRef, elementRef, enabled]);
|
|
83
81
|
const [resizeRef, resizeObserver] = (0, useResizeObserver_js_1.useResizeObserver)(adjustTransform);
|
|
84
|
-
resizeRef(containerRef
|
|
82
|
+
resizeRef(containerRef?.current);
|
|
85
83
|
React.useEffect(() => {
|
|
86
84
|
return () => {
|
|
87
|
-
resizeObserver
|
|
85
|
+
resizeObserver?.disconnect();
|
|
88
86
|
};
|
|
89
87
|
}, [resizeObserver]);
|
|
90
88
|
(0, useEventListener_js_1.useEventListener)('resize', () => {
|
|
@@ -51,7 +51,7 @@ const useEventListener = (eventName, handler, element) => {
|
|
|
51
51
|
if (!element) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const eventListener = (event) =>
|
|
54
|
+
const eventListener = (event) => savedHandler.current?.(event);
|
|
55
55
|
element.addEventListener(eventName, eventListener);
|
|
56
56
|
return () => {
|
|
57
57
|
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;
|
|
@@ -35,25 +35,27 @@ let isDev = false;
|
|
|
35
35
|
try {
|
|
36
36
|
isDev = process.env.NODE_ENV !== 'production';
|
|
37
37
|
}
|
|
38
|
-
catch
|
|
38
|
+
catch { }
|
|
39
39
|
const didLogWarning = {
|
|
40
40
|
fontSize: false,
|
|
41
41
|
themeProvider: false,
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* Hook used in every component for any shared setup and side effects.
|
|
45
|
+
* Returns the nearest ThemeContext.
|
|
45
46
|
*
|
|
46
47
|
* @private
|
|
47
48
|
*/
|
|
48
49
|
const useGlobals = () => {
|
|
49
|
-
|
|
50
|
+
const themeContext = React.useContext(ThemeContext_js_1.ThemeContext);
|
|
51
|
+
(0, exports.useThemeProviderWarning)(themeContext);
|
|
50
52
|
useRootFontSizeWarning();
|
|
53
|
+
return themeContext;
|
|
51
54
|
};
|
|
52
55
|
exports.useGlobals = useGlobals;
|
|
53
56
|
// ----------------------------------------------------------------------------
|
|
54
57
|
/** Shows console error if ThemeProvider is not used */
|
|
55
|
-
const useThemeProviderWarning = () => {
|
|
56
|
-
const themeContext = React.useContext(ThemeContext_js_1.ThemeContext);
|
|
58
|
+
const useThemeProviderWarning = (themeContext) => {
|
|
57
59
|
React.useEffect(() => {
|
|
58
60
|
if (isDev && !didLogWarning.themeProvider && !themeContext) {
|
|
59
61
|
console.error('iTwinUI components must be used within a tree wrapped in a ThemeProvider.');
|
|
@@ -26,7 +26,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
__setModuleDefault(result, mod);
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
|
-
var _a;
|
|
30
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
30
|
exports.useId = void 0;
|
|
32
31
|
const React = __importStar(require("react"));
|
|
@@ -43,4 +42,4 @@ exports.useId = useId;
|
|
|
43
42
|
// This is needed to avoid bundlers trying to import non-existing export.
|
|
44
43
|
// Read more: https://github.com/webpack/webpack/issues/14814
|
|
45
44
|
const _React = React;
|
|
46
|
-
const useUniqueValue =
|
|
45
|
+
const useUniqueValue = _React.useId ?? (() => (0, numbers_js_1.getRandomValue)(10));
|
|
@@ -46,10 +46,9 @@ const useIntersection = (onIntersect, options = {}, once = true) => {
|
|
|
46
46
|
const { root, rootMargin, threshold } = options;
|
|
47
47
|
const cleanupRef = React.useRef(() => { });
|
|
48
48
|
const setRef = React.useCallback((node) => {
|
|
49
|
-
|
|
50
|
-
(_a = cleanupRef.current) === null || _a === void 0 ? void 0 : _a.call(cleanupRef);
|
|
49
|
+
cleanupRef.current?.();
|
|
51
50
|
cleanupRef.current = () => { }; // ensure it doesn't try to clean up again
|
|
52
|
-
if (!node || !(
|
|
51
|
+
if (!node || !(0, dom_js_1.getWindow)()?.IntersectionObserver) {
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
55
54
|
const observer = new IntersectionObserver(([entry], obs) => {
|
|
@@ -34,27 +34,25 @@ const useIsomorphicLayoutEffect_js_1 = require("./useIsomorphicLayoutEffect.js")
|
|
|
34
34
|
const useMediaQuery = (queryString) => {
|
|
35
35
|
const [matches, setMatches] = React.useState();
|
|
36
36
|
(0, useIsomorphicLayoutEffect_js_1.useIsomorphicLayoutEffect)(() => {
|
|
37
|
-
|
|
38
|
-
const mediaQueryList = (_b = (_a = (0, index_js_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, queryString);
|
|
37
|
+
const mediaQueryList = (0, index_js_1.getWindow)()?.matchMedia?.(queryString);
|
|
39
38
|
const handleChange = ({ matches }) => setMatches(matches);
|
|
40
39
|
if (mediaQueryList != undefined) {
|
|
41
40
|
setMatches(mediaQueryList.matches);
|
|
42
41
|
try {
|
|
43
42
|
mediaQueryList.addEventListener('change', handleChange);
|
|
44
43
|
}
|
|
45
|
-
catch
|
|
44
|
+
catch {
|
|
46
45
|
// Safari 13 fallback
|
|
47
|
-
|
|
46
|
+
mediaQueryList.addListener?.(handleChange);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
return () => {
|
|
51
|
-
var _a;
|
|
52
50
|
try {
|
|
53
|
-
mediaQueryList
|
|
51
|
+
mediaQueryList?.removeEventListener('change', handleChange);
|
|
54
52
|
}
|
|
55
|
-
catch
|
|
53
|
+
catch {
|
|
56
54
|
// Safari 13 fallback
|
|
57
|
-
|
|
55
|
+
mediaQueryList?.removeListener?.(handleChange);
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
58
|
}, [queryString]);
|
|
@@ -75,9 +75,8 @@ const useOverflow = (items, disabled = false, orientation = 'horizontal') => {
|
|
|
75
75
|
}, [containerSize, disabled, items]);
|
|
76
76
|
const mergedRefs = (0, useMergedRefs_js_1.useMergedRefs)(containerRef, resizeRef);
|
|
77
77
|
(0, useIsomorphicLayoutEffect_js_1.useIsomorphicLayoutEffect)(() => {
|
|
78
|
-
var _a;
|
|
79
78
|
if (!containerRef.current || disabled) {
|
|
80
|
-
|
|
79
|
+
resizeObserverRef.current?.disconnect();
|
|
81
80
|
return;
|
|
82
81
|
}
|
|
83
82
|
const dimension = orientation === 'horizontal' ? 'Width' : 'Height';
|
|
@@ -45,14 +45,13 @@ const dom_js_1 = require("../functions/dom.js");
|
|
|
45
45
|
const useResizeObserver = (onResize) => {
|
|
46
46
|
const resizeObserver = React.useRef();
|
|
47
47
|
const elementRef = React.useCallback((element) => {
|
|
48
|
-
|
|
49
|
-
if (!((_a = (0, dom_js_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.ResizeObserver)) {
|
|
48
|
+
if (!(0, dom_js_1.getWindow)()?.ResizeObserver) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
|
-
|
|
51
|
+
resizeObserver.current?.disconnect();
|
|
53
52
|
if (element) {
|
|
54
53
|
resizeObserver.current = new ResizeObserver(([{ contentRect }]) => onResize(contentRect));
|
|
55
|
-
|
|
54
|
+
resizeObserver.current?.observe(element);
|
|
56
55
|
}
|
|
57
56
|
}, [onResize]);
|
|
58
57
|
return [elementRef, resizeObserver.current];
|
package/cjs/styles.js
CHANGED
|
@@ -6,10 +6,8 @@ const styles = {
|
|
|
6
6
|
"iui-root-background": "_iui3-root-background",
|
|
7
7
|
"iui-alert": "_iui3-alert",
|
|
8
8
|
"iui-alert-link": "_iui3-alert-link",
|
|
9
|
-
"iui-
|
|
10
|
-
"iui-alert-icon": "_iui3-alert-icon",
|
|
9
|
+
"iui-button": "_iui3-button",
|
|
11
10
|
"iui-alert-message": "_iui3-alert-message",
|
|
12
|
-
"iui-alert-button-icon": "_iui3-alert-button-icon",
|
|
13
11
|
"iui-anchor": "_iui3-anchor",
|
|
14
12
|
"iui-anchor-external": "_iui3-anchor-external",
|
|
15
13
|
"iui-avatar": "_iui3-avatar",
|
|
@@ -38,7 +36,6 @@ const styles = {
|
|
|
38
36
|
"iui-breadcrumbs-list": "_iui3-breadcrumbs-list",
|
|
39
37
|
"iui-breadcrumbs-item": "_iui3-breadcrumbs-item",
|
|
40
38
|
"iui-breadcrumbs-item-overrides": "_iui3-breadcrumbs-item-overrides",
|
|
41
|
-
"iui-button": "_iui3-button",
|
|
42
39
|
"iui-breadcrumbs-text": "_iui3-breadcrumbs-text",
|
|
43
40
|
"iui-breadcrumbs-button": "_iui3-breadcrumbs-button",
|
|
44
41
|
"iui-breadcrumbs-separator": "_iui3-breadcrumbs-separator",
|
|
@@ -1,47 +1,66 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
-
declare type
|
|
3
|
+
declare type AlertOwnProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Type of the alert.
|
|
6
6
|
* @default 'informational'
|
|
7
7
|
*/
|
|
8
8
|
type?: 'positive' | 'warning' | 'negative' | 'informational';
|
|
9
|
-
/**
|
|
10
|
-
* Text for the link you want to provide.
|
|
11
|
-
*/
|
|
12
|
-
clickableText?: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Props for the clickable text. Used for providing `href` and other attributes.
|
|
15
|
-
*/
|
|
16
|
-
clickableTextProps?: React.ComponentPropsWithRef<'a'>;
|
|
17
|
-
/**
|
|
18
|
-
* Action handler for close.
|
|
19
|
-
*/
|
|
20
|
-
onClose?: () => void;
|
|
21
9
|
/**
|
|
22
10
|
* Stick the alert to the top.
|
|
23
11
|
* @default false
|
|
24
12
|
*/
|
|
25
13
|
isSticky?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Alert message text.
|
|
28
|
-
*/
|
|
29
|
-
children: React.ReactNode;
|
|
30
14
|
};
|
|
31
15
|
/**
|
|
32
16
|
* A small box to quickly grab user attention and communicate a brief message
|
|
33
17
|
* @example
|
|
34
|
-
* <Alert>
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* <Alert
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* >
|
|
43
|
-
*
|
|
18
|
+
* <Alert>
|
|
19
|
+
* <Alert.Message>This is an alert.</Alert.Message>
|
|
20
|
+
* </Alert>
|
|
21
|
+
* @example
|
|
22
|
+
* <Alert type='informational'>
|
|
23
|
+
* <Alert.Icon />
|
|
24
|
+
* <Alert.Message>This is an informational alert.</Alert.Message>
|
|
25
|
+
* <Alert.CloseButton onClick={() => {}} />
|
|
26
|
+
* </Alert>
|
|
27
|
+
* @example
|
|
28
|
+
* <Alert type='positive'>
|
|
29
|
+
* <Alert.Icon>
|
|
30
|
+
* <SvgSmileyHappy />
|
|
31
|
+
* </Alert.Icon>
|
|
32
|
+
* <Alert.Message>
|
|
33
|
+
* This is an alert.
|
|
34
|
+
* <Alert.Action>This is clickable text.</Alert.Action>
|
|
35
|
+
* </Alert.Message>
|
|
36
|
+
* <Alert.CloseButton onClick={() => {}}>
|
|
37
|
+
* <SvgCollapse />
|
|
38
|
+
* </Alert.CloseButton>
|
|
44
39
|
* </Alert>
|
|
45
40
|
*/
|
|
46
|
-
export declare const Alert: PolymorphicForwardRefComponent<"div",
|
|
41
|
+
export declare const Alert: PolymorphicForwardRefComponent<"div", AlertOwnProps> & {
|
|
42
|
+
/**
|
|
43
|
+
* Alert icon subcomponent
|
|
44
|
+
*/
|
|
45
|
+
Icon: PolymorphicForwardRefComponent<"span", Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
46
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
47
|
+
}, "as" | "fill" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
48
|
+
size?: "small" | "auto" | "medium" | "large" | import("../utils/types.js").AnyString | undefined;
|
|
49
|
+
fill?: "default" | "positive" | "warning" | "negative" | import("../utils/types.js").AnyString | "informational" | undefined;
|
|
50
|
+
} & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
51
|
+
as?: "span" | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Alert message subcomponent
|
|
55
|
+
*/
|
|
56
|
+
Message: PolymorphicForwardRefComponent<"span", {}>;
|
|
57
|
+
/**
|
|
58
|
+
* Alert action subcomponent for the link you want to provide.
|
|
59
|
+
*/
|
|
60
|
+
Action: PolymorphicForwardRefComponent<"a", {}>;
|
|
61
|
+
/**
|
|
62
|
+
* Alert close button subcomponent
|
|
63
|
+
*/
|
|
64
|
+
CloseButton: PolymorphicForwardRefComponent<"button", {}>;
|
|
65
|
+
};
|
|
47
66
|
export default Alert;
|