UNPKG

linkmore-design

Version:

🌈 πŸš€lmη»„δ»ΆεΊ“γ€‚πŸš€

34 lines β€’ 1.08 kB
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["tab"]; import * as React from 'react'; import toArray from 'rc-util/lib/Children/toArray'; import warning from "../../_util/warning"; function filter(items) { return items.filter(function (item) { return item; }); } export default function useLegacyItems(items, children) { if (items) { return items; } warning(!children, 'Tabs', 'Tabs.TabPane is deprecated. Please use `items` directly.'); var childrenItems = toArray(children).map(function (node) { if ( /*#__PURE__*/React.isValidElement(node)) { var key = node.key, props = node.props; var _ref = props || {}, tab = _ref.tab, restProps = _objectWithoutProperties(_ref, _excluded); var item = _objectSpread(_objectSpread({ key: String(key) }, restProps), {}, { label: tab }); return item; } return null; }); return filter(childrenItems); }