PromoCursed/node_modules/.cache/babel-loader/78495a1fefed8199f66f5ca14e3331ecdbe7bc6995909e7ac02901710138a4b0.json

1 line
7.3 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"\"use client\";\n\nimport React from 'react';\nimport { cloneElement, isFragment } from '../_util/reactNode';\nconst rxTwoCNChar = /^[\\u4e00-\\u9fa5]{2}$/;\nexport const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);\nexport function convertLegacyProps(type) {\n if (type === 'danger') {\n return {\n danger: true\n };\n }\n return {\n type\n };\n}\nexport function isString(str) {\n return typeof str === 'string';\n}\nexport function isUnBorderedButtonType(type) {\n return type === 'text' || type === 'link';\n}\nfunction splitCNCharsBySpace(child, needInserted) {\n if (child === null || child === undefined) {\n return;\n }\n const SPACE = needInserted ? ' ' : '';\n if (typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && isTwoCNChar(child.props.children)) {\n return cloneElement(child, {\n children: child.props.children.split('').join(SPACE)\n });\n }\n if (isString(child)) {\n return isTwoCNChar(child) ? /*#__PURE__*/React.createElement(\"span\", null, child.split('').join(SPACE)) : /*#__PURE__*/React.createElement(\"span\", null, child);\n }\n if (isFragment(child)) {\n return /*#__PURE__*/React.createElement(\"span\", null, child);\n }\n return child;\n}\nexport function spaceChildren(children, needInserted) {\n let isPrevChildPure = false;\n const childList = [];\n React.Children.forEach(children, child => {\n const type = typeof child;\n const isCurrentChildPure = type === 'string' || type === 'number';\n if (isPrevChildPure && isCurrentChildPure) {\n const lastIndex = childList.length - 1;\n const lastChild = childList[lastIndex];\n childList[lastIndex] = `${lastChild}${child}`;\n } else {\n childList.push(child);\n }\n isPrevChildPure = isCurrentChildPure;\n });\n return React.Children.map(childList, child => splitCNCharsBySpace(child, needInserted));\n}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst ButtonTypes = ['default', 'primary', 'dashed', 'link', 'text'];\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst ButtonShapes = ['default', 'circle', 'round'];\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst ButtonHTMLTypes = ['submit', 'button', 'reset'];","map":{"version":3,"names":["React","cloneElement","isFragment","rxTwoCNChar","isTwoCNChar","test","bind","convertLegacyProps","type","danger","isString","str","isUnBorderedButtonType","splitCNCharsBySpace","child","needInserted","undefined","SPACE","props","children","split","join","createElement","spaceChildren","isPrevChildPure","childList","Children","forEach","isCurrentChildPure","lastIndex","length","lastChild","push","map","ButtonTypes","ButtonShapes","ButtonHTMLTypes"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/button/buttonHelpers.js"],"sourcesContent":["\"use client\";\n\nimport React from 'react';\nimport { cloneElement, isFragment } from '../_util/reactNode';\nconst rxTwoCNChar = /^[\\u4e00-\\u9fa5]{2}$/;\nexport const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);\nexport function convertLegacyProps(type) {\n if (type === 'danger') {\n return {\n danger: true\n };\n }\n return {\n type\n };\n}\nexport function isString(str) {\n return typeof str === 'string';\n}\nexport function isUnBorderedButtonType(type) {\n return type === 'text' || type === 'link';\n}\nfunction splitCNCharsBySpace(child, needInserted) {\n if (child === null || child === undefined) {\n return;\n }\n const SPACE = needInserted ? ' ' : '';\n if (typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && isTwoCNChar(child.props.children)) {\n return cloneElement(child, {\n children: child.props.children.split('').join(SPACE)\n });\n }\n if (isString(child)) {\n return isTwoCNChar(child) ? /*#__PURE__*/React.createElement(\"span\", null, child.split('').join(SPACE)) : /*#__PURE__*/React.createElement(\"span\", null, child);\n }\n if (isFragment(child)) {\n return /*#__PURE__*/R