1 line
9.9 KiB
JSON
1 line
9.9 KiB
JSON
|
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport * as React from 'react';\nimport { genDataNodeKey, getRemovable } from \"../util\";\nvar TabNode = function TabNode(props) {\n var prefixCls = props.prefixCls,\n id = props.id,\n active = props.active,\n _props$tab = props.tab,\n key = _props$tab.key,\n label = _props$tab.label,\n disabled = _props$tab.disabled,\n closeIcon = _props$tab.closeIcon,\n icon = _props$tab.icon,\n closable = props.closable,\n renderWrapper = props.renderWrapper,\n removeAriaLabel = props.removeAriaLabel,\n editable = props.editable,\n onClick = props.onClick,\n onFocus = props.onFocus,\n style = props.style;\n var tabPrefix = \"\".concat(prefixCls, \"-tab\");\n var removable = getRemovable(closable, closeIcon, editable, disabled);\n function onInternalClick(e) {\n if (disabled) {\n return;\n }\n onClick(e);\n }\n function onRemoveTab(event) {\n event.preventDefault();\n event.stopPropagation();\n editable.onEdit('remove', {\n key: key,\n event: event\n });\n }\n var labelNode = React.useMemo(function () {\n return icon && typeof label === 'string' ? /*#__PURE__*/React.createElement(\"span\", null, label) : label;\n }, [label, icon]);\n var node = /*#__PURE__*/React.createElement(\"div\", {\n key: key\n // ref={ref}\n ,\n\n \"data-node-key\": genDataNodeKey(key),\n className: classNames(tabPrefix, _defineProperty(_defineProperty(_defineProperty({}, \"\".concat(tabPrefix, \"-with-remove\"), removable), \"\".concat(tabPrefix, \"-active\"), active), \"\".concat(tabPrefix, \"-disabled\"), disabled)),\n style: style,\n onClick: onInternalClick\n }, /*#__PURE__*/React.createElement(\"div\", {\n role: \"tab\",\n \"aria-selected\": active,\n id: id && \"\".concat(id, \"-tab-\").concat(key),\n className: \"\".concat(tabPrefix, \"-btn\"),\n \"aria-controls\": id && \"\".concat(id, \"-panel-\").concat(key),\n \"aria-disabled\": disabled,\n tabIndex: disabled ? null : 0,\n onClick: function onClick(e) {\n e.stopPropagation();\n onInternalClick(e);\n },\n onKeyDown: function onKeyDown(e) {\n if ([KeyCode.SPACE, KeyCode.ENTER].includes(e.which)) {\n e.preventDefault();\n onInternalClick(e);\n }\n },\n onFocus: onFocus\n }, icon && /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(tabPrefix, \"-icon\")\n }, icon), label && labelNode), removable && /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n \"aria-label\": removeAriaLabel || 'remove',\n tabIndex: 0,\n className: \"\".concat(tabPrefix, \"-remove\"),\n onClick: function onClick(e) {\n e.stopPropagation();\n onRemoveTab(e);\n }\n }, closeIcon || editable.removeIcon || '×'));\n return renderWrapper ? renderWrapper(node) : node;\n};\nexport default TabNode;","map":{"version":3,"names":["_defineProperty","classNames","KeyCode","React","genDataNodeKey","getRemovable","TabNode","props","prefixCls","id","active","_props$tab","tab","key","label","disabled","closeIcon","icon","closable","renderWrapper","removeAriaLabel","editable","onClick","onFocus","style","tabPrefix","concat","removable","onInternalClick","e","onRemoveTab","event","preventDefault","stopPropagation","onEdit","labelNode","useMemo","createElement","node","className","role","tabIndex","onKeyDown","SPACE","ENTER","includes","which","type","removeIcon"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-tabs/es/TabNavList/TabNode.js"],"sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport * as React from 'react';\nimport { genDataNodeKey, getRemovable } from \"../util\";\nvar TabNode = function TabNode(props) {\n var prefixCls = props.prefixCls,\n id =
|