@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
24 lines (23 loc) • 1.32 kB
JavaScript
;
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useTreeViewContext = exports.TreeViewContext = void 0;
var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
var React = _interopRequireWildcard(require("react"));
/**
* @ignore - internal component.
*/
const TreeViewContext = exports.TreeViewContext = /*#__PURE__*/React.createContext(null);
if (process.env.NODE_ENV !== "production") TreeViewContext.displayName = "TreeViewContext";
const useTreeViewContext = () => {
const context = React.useContext(TreeViewContext);
if (context == null) {
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Tree View: Could not find the Tree View context. ' + 'This happens when a component is rendered outside of a SimpleTreeView or RichTreeView parent component. ' + 'Ensure your component is a child of a Tree View component. ' + 'This can also happen if you are bundling multiple versions of the Tree View.' : (0, _formatErrorMessage2.default)(190));
}
return context;
};
exports.useTreeViewContext = useTreeViewContext;