UNPKG

@uiw/react-json-view

Version:
34 lines 1 kB
import { useStore } from '../store'; import { useExpandsStore } from '../store/Expands'; import { BracketsClose } from '../symbol'; import { jsx as _jsx } from "react/jsx-runtime"; export var NestedClose = props => { var _expands$expandKey; var { value, expandKey, level } = props; var expands = useExpandsStore(); var isArray = Array.isArray(value); var { collapsed } = useStore(); var isMySet = value instanceof Set; var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false; var len = Object.keys(value).length; if (isExpanded || len === 0) { return null; } var style = { paddingLeft: 4 }; return /*#__PURE__*/_jsx("div", { style: style, children: /*#__PURE__*/_jsx(BracketsClose, { isBrackets: isArray || isMySet, isVisiable: true }) }); }; NestedClose.displayName = 'JVR.NestedClose';