@itwin/itwinui-react 3.14.0 → 3.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -12
- package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/DEV-cjs/core/Buttons/IconButton.js +1 -1
- package/DEV-cjs/core/Menu/MenuItem.js +1 -1
- package/DEV-cjs/core/Popover/Popover.js +16 -26
- package/DEV-cjs/core/Table/Table.js +2 -2
- package/DEV-cjs/styles.js +1 -1
- package/DEV-cjs/utils/functions/dev.js +3 -23
- package/DEV-cjs/utils/hooks/index.js +1 -0
- package/DEV-cjs/utils/hooks/useWarningLogger.js +43 -0
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/DEV-esm/core/Buttons/IconButton.js +2 -2
- package/DEV-esm/core/Menu/MenuItem.js +2 -2
- package/DEV-esm/core/Popover/Popover.js +17 -30
- package/DEV-esm/core/Table/Table.js +3 -3
- package/DEV-esm/styles.js +1 -1
- package/DEV-esm/utils/functions/dev.js +1 -12
- package/DEV-esm/utils/hooks/index.js +1 -0
- package/DEV-esm/utils/hooks/useWarningLogger.js +31 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/cjs/core/Buttons/IconButton.js +1 -1
- package/cjs/core/Menu/MenuItem.js +1 -1
- package/cjs/core/Popover/Popover.js +16 -26
- package/cjs/core/Table/Table.js +2 -2
- package/cjs/styles.js +1 -1
- package/cjs/utils/functions/dev.d.ts +1 -16
- package/cjs/utils/functions/dev.js +3 -13
- package/cjs/utils/hooks/index.d.ts +1 -0
- package/cjs/utils/hooks/index.js +1 -0
- package/cjs/utils/hooks/useWarningLogger.d.ts +15 -0
- package/cjs/utils/hooks/useWarningLogger.js +17 -0
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/esm/core/Buttons/IconButton.js +2 -2
- package/esm/core/Menu/MenuItem.js +2 -2
- package/esm/core/Popover/Popover.js +17 -30
- package/esm/core/Table/Table.js +3 -3
- package/esm/styles.js +1 -1
- package/esm/utils/functions/dev.d.ts +1 -16
- package/esm/utils/functions/dev.js +1 -2
- package/esm/utils/hooks/index.d.ts +1 -0
- package/esm/utils/hooks/index.js +1 -0
- package/esm/utils/hooks/useWarningLogger.d.ts +15 -0
- package/esm/utils/hooks/useWarningLogger.js +5 -0
- package/package.json +1 -1
- package/styles.css +8 -8
package/cjs/core/Table/Table.js
CHANGED
|
@@ -35,7 +35,6 @@ const singleRowSelectedAction = 'singleRowSelected';
|
|
|
35
35
|
const shiftRowSelectedAction = 'shiftRowSelected';
|
|
36
36
|
const tableResizeStartAction = 'tableResizeStart';
|
|
37
37
|
const tableResizeEndAction = 'tableResizeEnd';
|
|
38
|
-
const logWarning = (0, _index.createWarningLogger)();
|
|
39
38
|
const flattenColumns = (columns) => {
|
|
40
39
|
let flatColumns = [];
|
|
41
40
|
columns.forEach((column) => {
|
|
@@ -282,6 +281,7 @@ const Table = (props) => {
|
|
|
282
281
|
setGlobalFilter,
|
|
283
282
|
} = instance;
|
|
284
283
|
let headerGroups = _headerGroups;
|
|
284
|
+
let logWarning = (0, _index.useWarningLogger)();
|
|
285
285
|
if (1 === columns.length && 'columns' in columns[0])
|
|
286
286
|
headerGroups = _headerGroups.slice(1);
|
|
287
287
|
let ariaDataAttributes = Object.entries(rest).reduce(
|
|
@@ -571,7 +571,7 @@ const Table = (props) => {
|
|
|
571
571
|
let dragAndDropProps = column.getDragAndDropProps();
|
|
572
572
|
return _react.createElement(_ColumnHeader.ColumnHeader, {
|
|
573
573
|
...dragAndDropProps,
|
|
574
|
-
key: dragAndDropProps.key,
|
|
574
|
+
key: dragAndDropProps.key || column.id || index,
|
|
575
575
|
columnRefs: columnRefs,
|
|
576
576
|
column: column,
|
|
577
577
|
index: index,
|
package/cjs/styles.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
declare const isUnitTest: boolean;
|
|
2
|
-
|
|
3
|
-
* Returns a function that can be used to log one-time warnings in dev environments.
|
|
4
|
-
*
|
|
5
|
-
* **Note**: The actual log call should be wrapped in a check against `process.env.NODE_ENV === 'development'`
|
|
6
|
-
* to ensure that it is removed from the production build output (by SWC).
|
|
7
|
-
* Read more about the [`NODE_ENV` convention](https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production).
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const logWarning = createWarningLogger();
|
|
11
|
-
*
|
|
12
|
-
* if (process.env.NODE_ENV === 'development') {
|
|
13
|
-
* logWarning("please don't use this")
|
|
14
|
-
* }
|
|
15
|
-
*/
|
|
16
|
-
declare const createWarningLogger: () => (message: string) => void;
|
|
17
|
-
export { isUnitTest, createWarningLogger };
|
|
2
|
+
export { isUnitTest };
|
|
@@ -2,18 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, '__esModule', {
|
|
3
3
|
value: true,
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: all[name],
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
createWarningLogger: function () {
|
|
14
|
-
return createWarningLogger;
|
|
15
|
-
},
|
|
16
|
-
isUnitTest: function () {
|
|
5
|
+
Object.defineProperty(exports, 'isUnitTest', {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
17
8
|
return isUnitTest;
|
|
18
9
|
},
|
|
19
10
|
});
|
|
@@ -24,4 +15,3 @@ const isMocha =
|
|
|
24
15
|
`${globalThis.beforeEach}`.replace(/\s/g, '');
|
|
25
16
|
const isVitest = void 0 !== globalThis.__vitest_index__;
|
|
26
17
|
const isUnitTest = isJest || isVitest || isMocha;
|
|
27
|
-
const createWarningLogger = () => () => {};
|
package/cjs/utils/hooks/index.js
CHANGED
|
@@ -19,3 +19,4 @@ _export_star._(require('./useId.js'), exports);
|
|
|
19
19
|
_export_star._(require('./useControlledState.js'), exports);
|
|
20
20
|
_export_star._(require('./useSyncExternalStore.js'), exports);
|
|
21
21
|
_export_star._(require('./useVirtualScroll.js'), exports);
|
|
22
|
+
_export_star._(require('./useWarningLogger.js'), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that can be used to log one-time warnings in dev environments.
|
|
3
|
+
*
|
|
4
|
+
* **Note**: The actual log call should be wrapped in a check against `process.env.NODE_ENV === 'development'`
|
|
5
|
+
* to ensure that it is removed from the production build output (by SWC).
|
|
6
|
+
* Read more about the [`NODE_ENV` convention](https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const logWarning = useWarningLogger();
|
|
10
|
+
*
|
|
11
|
+
* if (process.env.NODE_ENV === 'development') {
|
|
12
|
+
* logWarning("please don't use this")
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export declare const useWarningLogger: () => (message: string) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {
|
|
3
|
+
value: true,
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, 'useWarningLogger', {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () {
|
|
8
|
+
return useWarningLogger;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
12
|
+
const _react = _interop_require_wildcard._(require('react'));
|
|
13
|
+
const _dev = require('../functions/dev.js');
|
|
14
|
+
const _React = _react;
|
|
15
|
+
const ReactInternals =
|
|
16
|
+
_React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
17
|
+
const useWarningLogger = () => () => {};
|
|
@@ -5,11 +5,10 @@ import {
|
|
|
5
5
|
useOverflow,
|
|
6
6
|
SvgChevronRight,
|
|
7
7
|
Box,
|
|
8
|
-
|
|
8
|
+
useWarningLogger,
|
|
9
9
|
} from '../../utils/index.js';
|
|
10
10
|
import { Button } from '../Buttons/Button.js';
|
|
11
11
|
import { Anchor } from '../Typography/Anchor.js';
|
|
12
|
-
let logWarning = createWarningLogger();
|
|
13
12
|
let BreadcrumbsComponent = React.forwardRef((props, ref) => {
|
|
14
13
|
let {
|
|
15
14
|
children: items,
|
|
@@ -102,6 +101,7 @@ let BreadcrumbsComponent = React.forwardRef((props, ref) => {
|
|
|
102
101
|
});
|
|
103
102
|
let ListItem = ({ item, isActive }) => {
|
|
104
103
|
let children = item;
|
|
104
|
+
let logWarning = useWarningLogger();
|
|
105
105
|
if (
|
|
106
106
|
children?.type === 'span' ||
|
|
107
107
|
children?.type === 'a' ||
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Box, ButtonBase,
|
|
3
|
+
import { Box, ButtonBase, useWarningLogger } from '../../utils/index.js';
|
|
4
4
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
5
5
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
6
6
|
import { ButtonGroupContext } from '../ButtonGroup/ButtonGroup.js';
|
|
7
7
|
import { PopoverOpenContext } from '../Popover/Popover.js';
|
|
8
|
-
let logWarning = createWarningLogger();
|
|
9
8
|
export const IconButton = React.forwardRef((props, ref) => {
|
|
10
9
|
let {
|
|
11
10
|
isActive,
|
|
@@ -21,6 +20,7 @@ export const IconButton = React.forwardRef((props, ref) => {
|
|
|
21
20
|
} = props;
|
|
22
21
|
let buttonGroupOrientation = React.useContext(ButtonGroupContext);
|
|
23
22
|
let hasPopoverOpen = React.useContext(PopoverOpenContext);
|
|
23
|
+
let logWarning = useWarningLogger();
|
|
24
24
|
let button = React.createElement(
|
|
25
25
|
ButtonBase,
|
|
26
26
|
{
|
|
@@ -3,12 +3,11 @@ import {
|
|
|
3
3
|
SvgCaretRightSmall,
|
|
4
4
|
useMergedRefs,
|
|
5
5
|
useId,
|
|
6
|
-
|
|
6
|
+
useWarningLogger,
|
|
7
7
|
} from '../../utils/index.js';
|
|
8
8
|
import { Menu, MenuContext } from './Menu.js';
|
|
9
9
|
import { ListItem } from '../List/ListItem.js';
|
|
10
10
|
import cx from 'classnames';
|
|
11
|
-
let logWarning = createWarningLogger();
|
|
12
11
|
export const MenuItem = React.forwardRef((props, forwardedRef) => {
|
|
13
12
|
let {
|
|
14
13
|
className,
|
|
@@ -27,6 +26,7 @@ export const MenuItem = React.forwardRef((props, forwardedRef) => {
|
|
|
27
26
|
subMenuItems = [],
|
|
28
27
|
...rest
|
|
29
28
|
} = props;
|
|
29
|
+
let logWarning = useWarningLogger();
|
|
30
30
|
let parentMenu = React.useContext(MenuContext);
|
|
31
31
|
let menuItemRef = React.useRef(null);
|
|
32
32
|
let submenuId = useId();
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
useMergedRefs,
|
|
33
33
|
} from '../../utils/index.js';
|
|
34
34
|
import { usePortalTo } from '../../utils/components/Portal.js';
|
|
35
|
-
import { ThemeProvider } from '../ThemeProvider/ThemeProvider.js';
|
|
36
35
|
export const PopoverOpenContext = React.createContext(void 0);
|
|
37
36
|
export const usePopover = (options) => {
|
|
38
37
|
let {
|
|
@@ -224,12 +223,7 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
224
223
|
role: 'dialog',
|
|
225
224
|
middleware,
|
|
226
225
|
});
|
|
227
|
-
let
|
|
228
|
-
let popoverRef = useMergedRefs(
|
|
229
|
-
popover.refs.setFloating,
|
|
230
|
-
forwardedRef,
|
|
231
|
-
setPopoverElement,
|
|
232
|
-
);
|
|
226
|
+
let popoverRef = useMergedRefs(popover.refs.setFloating, forwardedRef);
|
|
233
227
|
let triggerId = `${useId()}-trigger`;
|
|
234
228
|
let hasAriaLabel = !!props['aria-labelledby'] || !!props['aria-label'];
|
|
235
229
|
useLayoutEffect(() => {
|
|
@@ -258,34 +252,27 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
258
252
|
portal: portal,
|
|
259
253
|
},
|
|
260
254
|
React.createElement(
|
|
261
|
-
|
|
255
|
+
FloatingFocusManager,
|
|
262
256
|
{
|
|
263
|
-
|
|
257
|
+
context: popover.context,
|
|
258
|
+
modal: false,
|
|
264
259
|
},
|
|
265
|
-
React.createElement(DisplayContents, null),
|
|
266
260
|
React.createElement(
|
|
267
|
-
|
|
261
|
+
Box,
|
|
268
262
|
{
|
|
269
|
-
|
|
270
|
-
|
|
263
|
+
className: cx(
|
|
264
|
+
{
|
|
265
|
+
'iui-popover-surface': applyBackground,
|
|
266
|
+
},
|
|
267
|
+
className,
|
|
268
|
+
),
|
|
269
|
+
'aria-labelledby': hasAriaLabel
|
|
270
|
+
? void 0
|
|
271
|
+
: popover.refs.domReference.current?.id,
|
|
272
|
+
...popover.getFloatingProps(rest),
|
|
273
|
+
ref: popoverRef,
|
|
271
274
|
},
|
|
272
|
-
|
|
273
|
-
Box,
|
|
274
|
-
{
|
|
275
|
-
className: cx(
|
|
276
|
-
{
|
|
277
|
-
'iui-popover-surface': applyBackground,
|
|
278
|
-
},
|
|
279
|
-
className,
|
|
280
|
-
),
|
|
281
|
-
'aria-labelledby': hasAriaLabel
|
|
282
|
-
? void 0
|
|
283
|
-
: popover.refs.domReference.current?.id,
|
|
284
|
-
...popover.getFloatingProps(rest),
|
|
285
|
-
ref: popoverRef,
|
|
286
|
-
},
|
|
287
|
-
content,
|
|
288
|
-
),
|
|
275
|
+
content,
|
|
289
276
|
),
|
|
290
277
|
),
|
|
291
278
|
)
|
package/esm/core/Table/Table.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
useResizeObserver,
|
|
19
19
|
useLayoutEffect,
|
|
20
20
|
Box,
|
|
21
|
-
|
|
21
|
+
useWarningLogger,
|
|
22
22
|
ShadowRoot,
|
|
23
23
|
useMergedRefs,
|
|
24
24
|
useLatestRef,
|
|
@@ -52,7 +52,6 @@ let singleRowSelectedAction = 'singleRowSelected';
|
|
|
52
52
|
let shiftRowSelectedAction = 'shiftRowSelected';
|
|
53
53
|
export const tableResizeStartAction = 'tableResizeStart';
|
|
54
54
|
let tableResizeEndAction = 'tableResizeEnd';
|
|
55
|
-
let logWarning = createWarningLogger();
|
|
56
55
|
let flattenColumns = (columns) => {
|
|
57
56
|
let flatColumns = [];
|
|
58
57
|
columns.forEach((column) => {
|
|
@@ -292,6 +291,7 @@ export const Table = (props) => {
|
|
|
292
291
|
setGlobalFilter,
|
|
293
292
|
} = instance;
|
|
294
293
|
let headerGroups = _headerGroups;
|
|
294
|
+
let logWarning = useWarningLogger();
|
|
295
295
|
if (1 === columns.length && 'columns' in columns[0])
|
|
296
296
|
headerGroups = _headerGroups.slice(1);
|
|
297
297
|
let ariaDataAttributes = Object.entries(rest).reduce(
|
|
@@ -578,7 +578,7 @@ export const Table = (props) => {
|
|
|
578
578
|
let dragAndDropProps = column.getDragAndDropProps();
|
|
579
579
|
return React.createElement(ColumnHeader, {
|
|
580
580
|
...dragAndDropProps,
|
|
581
|
-
key: dragAndDropProps.key,
|
|
581
|
+
key: dragAndDropProps.key || column.id || index,
|
|
582
582
|
columnRefs: columnRefs,
|
|
583
583
|
column: column,
|
|
584
584
|
index: index,
|
package/esm/styles.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
declare const isUnitTest: boolean;
|
|
2
|
-
|
|
3
|
-
* Returns a function that can be used to log one-time warnings in dev environments.
|
|
4
|
-
*
|
|
5
|
-
* **Note**: The actual log call should be wrapped in a check against `process.env.NODE_ENV === 'development'`
|
|
6
|
-
* to ensure that it is removed from the production build output (by SWC).
|
|
7
|
-
* Read more about the [`NODE_ENV` convention](https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production).
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const logWarning = createWarningLogger();
|
|
11
|
-
*
|
|
12
|
-
* if (process.env.NODE_ENV === 'development') {
|
|
13
|
-
* logWarning("please don't use this")
|
|
14
|
-
* }
|
|
15
|
-
*/
|
|
16
|
-
declare const createWarningLogger: () => (message: string) => void;
|
|
17
|
-
export { isUnitTest, createWarningLogger };
|
|
2
|
+
export { isUnitTest };
|
|
@@ -5,5 +5,4 @@ let isMocha =
|
|
|
5
5
|
`${globalThis.beforeEach}`.replace(/\s/g, '');
|
|
6
6
|
let isVitest = void 0 !== globalThis.__vitest_index__;
|
|
7
7
|
let isUnitTest = isJest || isVitest || isMocha;
|
|
8
|
-
|
|
9
|
-
export { isUnitTest, createWarningLogger };
|
|
8
|
+
export { isUnitTest };
|
package/esm/utils/hooks/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that can be used to log one-time warnings in dev environments.
|
|
3
|
+
*
|
|
4
|
+
* **Note**: The actual log call should be wrapped in a check against `process.env.NODE_ENV === 'development'`
|
|
5
|
+
* to ensure that it is removed from the production build output (by SWC).
|
|
6
|
+
* Read more about the [`NODE_ENV` convention](https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const logWarning = useWarningLogger();
|
|
10
|
+
*
|
|
11
|
+
* if (process.env.NODE_ENV === 'development') {
|
|
12
|
+
* logWarning("please don't use this")
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export declare const useWarningLogger: () => (message: string) => void;
|