@mui/x-tree-view 7.16.0 → 7.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,93 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.17.0
7
+
8
+ _Sep 13, 2024_
9
+
10
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 📊 Charts performance improvement
13
+ - 🧑‍💻 New Data Grid [custom columns demo](https://mui.com/x/react-data-grid/custom-columns/#full-example)
14
+ - 🐞 Bugfixes
15
+ - 📚 Documentation improvements
16
+ - 🌍 Improve Hungarian (hu-HU) locale on the Data Grid
17
+
18
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
19
+
20
+ ### Data Grid
21
+
22
+ #### `@mui/x-data-grid@7.17.0`
23
+
24
+ - [DataGrid] Add "does not equal" and "does not contain" filter operators (#14489) @KenanYusuf
25
+ - [DataGrid] Add demo to the "Custom columns" page that does not use generator (#13695) @arminmeh
26
+ - [DataGrid] Fix Voice Over reading the column name twice (#14482) @arminmeh
27
+ - [DataGrid] Fix bug in CRUD example (#14513) @michelengelen
28
+ - [DataGrid] Fix failing jsdom tests caused by `:has()` selectors (#14559) @KenanYusuf
29
+ - [DataGrid] Refactor string operator filter functions (#14564) @KenanYusuf
30
+ - [l10n] Improve Hungarian (hu-HU) locale (#14506) @ntamas
31
+
32
+ #### `@mui/x-data-grid-pro@7.17.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
33
+
34
+ Same changes as in `@mui/x-data-grid@7.17.0`.
35
+
36
+ #### `@mui/x-data-grid-premium@7.17.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
37
+
38
+ Same changes as in `@mui/x-data-grid-pro@7.17.0`.
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@7.17.0`
43
+
44
+ - [fields] Improve `useSplitFieldProps` and make it public (#14514) @flaviendelangle
45
+ - [pickers] Improve clear action label (#14243) @oliviertassinari
46
+ - [pickers] Add `"use client"` directive to every public component and hook (#14562) @flaviendelangle
47
+ - [pickers] Allow custom fields to validate the value (#14486) @flaviendelangle
48
+ - [pickers] Stop using utils in locales (#14505) @flaviendelangle
49
+
50
+ #### `@mui/x-date-pickers-pro@7.17.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-date-pickers@7.17.0`, plus:
53
+
54
+ - [DateRangePicker] Fix `currentMonthCalendarPosition` not scrolling to future sibling (#14442) @GMchris
55
+
56
+ ### Charts
57
+
58
+ #### `@mui/x-charts@7.17.0`
59
+
60
+ - [charts] Add `"use client"` directive to every public component and hook (#14578) @flaviendelangle
61
+ - [charts] Allow `onItemClick` on the `Legend` component (#14231) @JCQuintas
62
+ - [charts] Fix `onAxisClick` with `layout='horizontal'` (#14547) @alexfauquette
63
+ - [charts] Replace `path` with `circle` for performance improvement (#14518) @alexfauquette
64
+
65
+ #### `@mui/x-charts-pro@7.0.0-beta.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
66
+
67
+ Same changes as in `@mui/x-charts@7.17.0`.
68
+
69
+ ### Tree View
70
+
71
+ #### `@mui/x-tree-view@7.17.0`
72
+
73
+ - [TreeView] Make `useTreeItem2` stable (#14498) @flaviendelangle
74
+
75
+ ### Docs
76
+
77
+ - [docs] Add missing callout on "Imperative API" tree view sections (#14503) @flaviendelangle
78
+ - [docs] Fix broken redirection to MUI X v5 @oliviertassinari
79
+ - [docs] Fix multiple `console.error` messages on `charts` docs (#14554) @JCQuintas
80
+ - [docs] Fixed typo in Row Grouping recipes (#14549) @Miodini
81
+ - [docs] Match title with blog posts @oliviertassinari
82
+
83
+ ### Core
84
+
85
+ - [core] Move warning methods to `@mui/x-internals` (#14528) @k-rajat19
86
+ - [core] Sync with core release flow @oliviertassinari
87
+ - [code-infra] Fix charts benchmark workflow (#14573) @JCQuintas
88
+ - [docs-infra] Type interface API pages (#14138) @alexfauquette
89
+ - [infra] Create `ESLint plugins` renovate group (#14574) @LukasTy
90
+ - [license] Clean-up terminology to match codebase (#14531) @oliviertassinari
91
+ - [test] Remove dead `act()` logic (#14529) @oliviertassinari
92
+
6
93
  ## 7.16.0
7
94
 
8
95
  _Sep 5, 2024_
@@ -3,13 +3,13 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import composeClasses from '@mui/utils/composeClasses';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
+ import { warnOnce } from '@mui/x-internals/warning';
6
7
  import { getRichTreeViewUtilityClass } from "./richTreeViewClasses.js";
7
8
  import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
8
9
  import { useTreeView } from "../internals/useTreeView/index.js";
9
10
  import { TreeViewProvider } from "../internals/TreeViewProvider/index.js";
10
11
  import { RICH_TREE_VIEW_PLUGINS } from "./RichTreeView.plugins.js";
11
12
  import { TreeItem } from "../TreeItem/index.js";
12
- import { warnOnce } from "../internals/utils/warning.js";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  const useThemeProps = createUseThemeProps('MuiRichTreeView');
15
15
  const useUtilityClasses = ownerState => {
@@ -3,12 +3,12 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import composeClasses from '@mui/utils/composeClasses';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
+ import { warnOnce } from '@mui/x-internals/warning';
6
7
  import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
7
8
  import { getSimpleTreeViewUtilityClass } from "./simpleTreeViewClasses.js";
8
9
  import { useTreeView } from "../internals/useTreeView/index.js";
9
10
  import { TreeViewProvider } from "../internals/TreeViewProvider/index.js";
10
11
  import { SIMPLE_TREE_VIEW_PLUGINS } from "./SimpleTreeView.plugins.js";
11
- import { warnOnce } from "../internals/utils/warning.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  const useThemeProps = createUseThemeProps('MuiSimpleTreeView');
14
14
  const useUtilityClasses = ownerState => {
@@ -13,7 +13,7 @@ import useSlotProps from '@mui/utils/useSlotProps';
13
13
  import { shouldForwardProp } from '@mui/system/createStyled';
14
14
  import composeClasses from '@mui/utils/composeClasses';
15
15
  import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
16
- import { unstable_useTreeItem2 as useTreeItem2 } from "../useTreeItem2/index.js";
16
+ import { useTreeItem2 } from "../useTreeItem2/index.js";
17
17
  import { getTreeItemUtilityClass } from "../TreeItem/index.js";
18
18
  import { TreeItem2Icon } from "../TreeItem2Icon/index.js";
19
19
  import { TreeItem2DragAndDropOverlay } from "../TreeItem2DragAndDropOverlay/index.js";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v7.16.0
2
+ * @mui/x-tree-view v7.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -20,4 +20,3 @@ export type { UseTreeViewLabelSignature, UseTreeViewLabelParameters, } from './p
20
20
  export { useTreeViewJSXItems } from './plugins/useTreeViewJSXItems';
21
21
  export type { UseTreeViewJSXItemsSignature, UseTreeViewJSXItemsParameters, } from './plugins/useTreeViewJSXItems';
22
22
  export { isTargetInDescendants } from './utils/tree';
23
- export { warnOnce } from './utils/warning';
@@ -13,5 +13,4 @@ export { useTreeViewIcons } from "./plugins/useTreeViewIcons/index.js";
13
13
  export { useTreeViewItems, buildSiblingIndexes, TREE_VIEW_ROOT_PARENT_ID } from "./plugins/useTreeViewItems/index.js";
14
14
  export { useTreeViewLabel } from "./plugins/useTreeViewLabel/index.js";
15
15
  export { useTreeViewJSXItems } from "./plugins/useTreeViewJSXItems/index.js";
16
- export { isTargetInDescendants } from "./utils/tree.js";
17
- export { warnOnce } from "./utils/warning.js";
16
+ export { isTargetInDescendants } from "./utils/tree.js";
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { warnOnce } from "../../utils/warning.js";
3
+ import { warnOnce } from '@mui/x-internals/warning';
4
4
  import { useTreeViewLabelItemPlugin } from "./useTreeViewLabel.itemPlugin.js";
5
5
  export const useTreeViewLabel = ({
6
6
  instance,
@@ -3,13 +3,13 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import composeClasses from '@mui/utils/composeClasses';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
+ import { warnOnce } from '@mui/x-internals/warning';
6
7
  import { getRichTreeViewUtilityClass } from "./richTreeViewClasses.js";
7
8
  import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
8
9
  import { useTreeView } from "../internals/useTreeView/index.js";
9
10
  import { TreeViewProvider } from "../internals/TreeViewProvider/index.js";
10
11
  import { RICH_TREE_VIEW_PLUGINS } from "./RichTreeView.plugins.js";
11
12
  import { TreeItem } from "../TreeItem/index.js";
12
- import { warnOnce } from "../internals/utils/warning.js";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  const useThemeProps = createUseThemeProps('MuiRichTreeView');
15
15
  const useUtilityClasses = ownerState => {
@@ -3,12 +3,12 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import composeClasses from '@mui/utils/composeClasses';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
+ import { warnOnce } from '@mui/x-internals/warning';
6
7
  import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
7
8
  import { getSimpleTreeViewUtilityClass } from "./simpleTreeViewClasses.js";
8
9
  import { useTreeView } from "../internals/useTreeView/index.js";
9
10
  import { TreeViewProvider } from "../internals/TreeViewProvider/index.js";
10
11
  import { SIMPLE_TREE_VIEW_PLUGINS } from "./SimpleTreeView.plugins.js";
11
- import { warnOnce } from "../internals/utils/warning.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  const useThemeProps = createUseThemeProps('MuiSimpleTreeView');
14
14
  const useUtilityClasses = ownerState => {
@@ -13,7 +13,7 @@ import useSlotProps from '@mui/utils/useSlotProps';
13
13
  import { shouldForwardProp } from '@mui/system/createStyled';
14
14
  import composeClasses from '@mui/utils/composeClasses';
15
15
  import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
16
- import { unstable_useTreeItem2 as useTreeItem2 } from "../useTreeItem2/index.js";
16
+ import { useTreeItem2 } from "../useTreeItem2/index.js";
17
17
  import { getTreeItemUtilityClass } from "../TreeItem/index.js";
18
18
  import { TreeItem2Icon } from "../TreeItem2Icon/index.js";
19
19
  import { TreeItem2DragAndDropOverlay } from "../TreeItem2DragAndDropOverlay/index.js";
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v7.16.0
2
+ * @mui/x-tree-view v7.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -13,5 +13,4 @@ export { useTreeViewIcons } from "./plugins/useTreeViewIcons/index.js";
13
13
  export { useTreeViewItems, buildSiblingIndexes, TREE_VIEW_ROOT_PARENT_ID } from "./plugins/useTreeViewItems/index.js";
14
14
  export { useTreeViewLabel } from "./plugins/useTreeViewLabel/index.js";
15
15
  export { useTreeViewJSXItems } from "./plugins/useTreeViewJSXItems/index.js";
16
- export { isTargetInDescendants } from "./utils/tree.js";
17
- export { warnOnce } from "./utils/warning.js";
16
+ export { isTargetInDescendants } from "./utils/tree.js";
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { warnOnce } from "../../utils/warning.js";
3
+ import { warnOnce } from '@mui/x-internals/warning';
4
4
  import { useTreeViewLabelItemPlugin } from "./useTreeViewLabel.itemPlugin.js";
5
5
  export const useTreeViewLabel = ({
6
6
  instance,
@@ -1 +1,4 @@
1
- export { useTreeItem2 as unstable_useTreeItem2 } from "./useTreeItem2.js";
1
+ import { useTreeItem2 as useTreeItem2Export } from "./useTreeItem2.js";
2
+ export const useTreeItem2 = useTreeItem2Export;
3
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4
+ export const unstable_useTreeItem2 = useTreeItem2Export;
@@ -11,13 +11,13 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
13
13
  var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
14
+ var _warning = require("@mui/x-internals/warning");
14
15
  var _richTreeViewClasses = require("./richTreeViewClasses");
15
16
  var _zeroStyled = require("../internals/zero-styled");
16
17
  var _useTreeView = require("../internals/useTreeView");
17
18
  var _TreeViewProvider = require("../internals/TreeViewProvider");
18
19
  var _RichTreeView = require("./RichTreeView.plugins");
19
20
  var _TreeItem = require("../TreeItem");
20
- var _warning = require("../internals/utils/warning");
21
21
  var _jsxRuntime = require("react/jsx-runtime");
22
22
  const useThemeProps = (0, _zeroStyled.createUseThemeProps)('MuiRichTreeView');
23
23
  const useUtilityClasses = ownerState => {
@@ -11,12 +11,12 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
13
13
  var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
14
+ var _warning = require("@mui/x-internals/warning");
14
15
  var _zeroStyled = require("../internals/zero-styled");
15
16
  var _simpleTreeViewClasses = require("./simpleTreeViewClasses");
16
17
  var _useTreeView = require("../internals/useTreeView");
17
18
  var _TreeViewProvider = require("../internals/TreeViewProvider");
18
19
  var _SimpleTreeView = require("./SimpleTreeView.plugins");
19
- var _warning = require("../internals/utils/warning");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
21
  const useThemeProps = (0, _zeroStyled.createUseThemeProps)('MuiSimpleTreeView');
22
22
  const useUtilityClasses = ownerState => {
@@ -241,7 +241,7 @@ const TreeItem2 = exports.TreeItem2 = /*#__PURE__*/React.forwardRef(function Tre
241
241
  getLabelInputProps,
242
242
  getDragAndDropOverlayProps,
243
243
  status
244
- } = (0, _useTreeItem.unstable_useTreeItem2)({
244
+ } = (0, _useTreeItem.useTreeItem2)({
245
245
  id,
246
246
  itemId,
247
247
  children,
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v7.16.0
2
+ * @mui/x-tree-view v7.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -93,12 +93,6 @@ Object.defineProperty(exports, "useTreeViewSelection", {
93
93
  return _useTreeViewSelection.useTreeViewSelection;
94
94
  }
95
95
  });
96
- Object.defineProperty(exports, "warnOnce", {
97
- enumerable: true,
98
- get: function () {
99
- return _warning.warnOnce;
100
- }
101
- });
102
96
  var _useTreeView = require("./useTreeView");
103
97
  var _TreeViewProvider = require("./TreeViewProvider");
104
98
  var _useInstanceEventHandler = require("./hooks/useInstanceEventHandler");
@@ -110,5 +104,4 @@ var _useTreeViewIcons = require("./plugins/useTreeViewIcons");
110
104
  var _useTreeViewItems = require("./plugins/useTreeViewItems");
111
105
  var _useTreeViewLabel = require("./plugins/useTreeViewLabel");
112
106
  var _useTreeViewJSXItems = require("./plugins/useTreeViewJSXItems");
113
- var _tree = require("./utils/tree");
114
- var _warning = require("./utils/warning");
107
+ var _tree = require("./utils/tree");
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.useTreeViewLabel = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
- var _warning = require("../../utils/warning");
11
+ var _warning = require("@mui/x-internals/warning");
12
12
  var _useTreeViewLabel = require("./useTreeViewLabel.itemPlugin");
13
13
  const useTreeViewLabel = ({
14
14
  instance,
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "unstable_useTreeItem2", {
7
- enumerable: true,
8
- get: function () {
9
- return _useTreeItem.useTreeItem2;
10
- }
11
- });
12
- var _useTreeItem = require("./useTreeItem2");
6
+ exports.useTreeItem2 = exports.unstable_useTreeItem2 = void 0;
7
+ var _useTreeItem = require("./useTreeItem2");
8
+ const useTreeItem2 = exports.useTreeItem2 = _useTreeItem.useTreeItem2;
9
+ // eslint-disable-next-line @typescript-eslint/naming-convention
10
+ const unstable_useTreeItem2 = exports.unstable_useTreeItem2 = _useTreeItem.useTreeItem2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-tree-view",
3
- "version": "7.16.0",
3
+ "version": "7.17.0",
4
4
  "description": "The community edition of the Tree View components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -39,7 +39,7 @@
39
39
  "clsx": "^2.1.1",
40
40
  "prop-types": "^15.8.1",
41
41
  "react-transition-group": "^4.4.5",
42
- "@mui/x-internals": "7.16.0"
42
+ "@mui/x-internals": "7.17.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",
@@ -1,2 +1,3 @@
1
- export { useTreeItem2 as unstable_useTreeItem2 } from './useTreeItem2';
1
+ export declare const useTreeItem2: <TSignatures extends import("./useTreeItem2.types").UseTreeItem2MinimalPlugins = import("./useTreeItem2.types").UseTreeItem2MinimalPlugins, TOptionalSignatures extends import("./useTreeItem2.types").UseTreeItem2OptionalPlugins = readonly []>(parameters: import("./useTreeItem2.types").UseTreeItem2Parameters) => import("./useTreeItem2.types").UseTreeItem2ReturnValue<TSignatures, TOptionalSignatures>;
2
+ export declare const unstable_useTreeItem2: <TSignatures extends import("./useTreeItem2.types").UseTreeItem2MinimalPlugins = import("./useTreeItem2.types").UseTreeItem2MinimalPlugins, TOptionalSignatures extends import("./useTreeItem2.types").UseTreeItem2OptionalPlugins = readonly []>(parameters: import("./useTreeItem2.types").UseTreeItem2Parameters) => import("./useTreeItem2.types").UseTreeItem2ReturnValue<TSignatures, TOptionalSignatures>;
2
3
  export type { UseTreeItem2Parameters, UseTreeItem2ReturnValue, UseTreeItem2Status, UseTreeItem2RootSlotOwnProps, UseTreeItem2ContentSlotOwnProps, UseTreeItem2LabelInputSlotOwnProps, UseTreeItem2LabelSlotOwnProps, UseTreeItem2IconContainerSlotOwnProps, UseTreeItem2GroupTransitionSlotOwnProps, UseTreeItem2DragAndDropOverlaySlotOwnProps, } from './useTreeItem2.types';
@@ -1 +1,4 @@
1
- export { useTreeItem2 as unstable_useTreeItem2 } from "./useTreeItem2.js";
1
+ import { useTreeItem2 as useTreeItem2Export } from "./useTreeItem2.js";
2
+ export const useTreeItem2 = useTreeItem2Export;
3
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4
+ export const unstable_useTreeItem2 = useTreeItem2Export;
@@ -1,2 +0,0 @@
1
- export declare function warnOnce(message: string | string[], gravity?: 'warning' | 'error'): void;
2
- export declare function clearWarningsCache(): void;
@@ -1,21 +0,0 @@
1
- const warnedOnceCache = new Set();
2
-
3
- // TODO move to @mui/x-internals
4
- // TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
5
- export function warnOnce(message, gravity = 'warning') {
6
- if (process.env.NODE_ENV === 'production') {
7
- return;
8
- }
9
- const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
10
- if (!warnedOnceCache.has(cleanMessage)) {
11
- warnedOnceCache.add(cleanMessage);
12
- if (gravity === 'error') {
13
- console.error(cleanMessage);
14
- } else {
15
- console.warn(cleanMessage);
16
- }
17
- }
18
- }
19
- export function clearWarningsCache() {
20
- warnedOnceCache.clear();
21
- }
@@ -1,21 +0,0 @@
1
- const warnedOnceCache = new Set();
2
-
3
- // TODO move to @mui/x-internals
4
- // TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
5
- export function warnOnce(message, gravity = 'warning') {
6
- if (process.env.NODE_ENV === 'production') {
7
- return;
8
- }
9
- const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
10
- if (!warnedOnceCache.has(cleanMessage)) {
11
- warnedOnceCache.add(cleanMessage);
12
- if (gravity === 'error') {
13
- console.error(cleanMessage);
14
- } else {
15
- console.warn(cleanMessage);
16
- }
17
- }
18
- }
19
- export function clearWarningsCache() {
20
- warnedOnceCache.clear();
21
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clearWarningsCache = clearWarningsCache;
7
- exports.warnOnce = warnOnce;
8
- const warnedOnceCache = new Set();
9
-
10
- // TODO move to @mui/x-internals
11
- // TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
12
- function warnOnce(message, gravity = 'warning') {
13
- if (process.env.NODE_ENV === 'production') {
14
- return;
15
- }
16
- const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
17
- if (!warnedOnceCache.has(cleanMessage)) {
18
- warnedOnceCache.add(cleanMessage);
19
- if (gravity === 'error') {
20
- console.error(cleanMessage);
21
- } else {
22
- console.warn(cleanMessage);
23
- }
24
- }
25
- }
26
- function clearWarningsCache() {
27
- warnedOnceCache.clear();
28
- }