1 line
16 KiB
JSON
1 line
16 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport React from 'react';\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport classNames from 'classnames';\nimport Button from '../button';\nimport { useLocale } from '../locale';\nimport defaultLocale from '../locale/en_US';\nfunction isValidNode(node) {\n return node !== undefined && node !== null;\n}\n// Due to the independent design of Panel, it will be too coupled to put in rc-tour,\n// so a set of Panel logic is implemented separately in antd.\nconst TourPanel = props => {\n var _a, _b;\n const {\n stepProps,\n current,\n type,\n indicatorsRender\n } = props;\n const {\n prefixCls,\n total = 1,\n title,\n onClose,\n onPrev,\n onNext,\n onFinish,\n cover,\n description,\n nextButtonProps,\n prevButtonProps,\n type: stepType,\n closable\n } = stepProps;\n const mergedType = stepType !== null && stepType !== void 0 ? stepType : type;\n const mergedCloseIcon = /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n onClick: onClose,\n className: `${prefixCls}-close`\n }, (closable === null || closable === void 0 ? void 0 : closable.closeIcon) || /*#__PURE__*/React.createElement(CloseOutlined, {\n className: `${prefixCls}-close-icon`\n }));\n const isLastStep = current === total - 1;\n const prevBtnClick = () => {\n var _a;\n onPrev === null || onPrev === void 0 ? void 0 : onPrev();\n (_a = prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(prevButtonProps);\n };\n const nextBtnClick = () => {\n var _a;\n if (isLastStep) {\n onFinish === null || onFinish === void 0 ? void 0 : onFinish();\n } else {\n onNext === null || onNext === void 0 ? void 0 : onNext();\n }\n (_a = nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(nextButtonProps);\n };\n const headerNode = isValidNode(title) ? ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-header`\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-title`\n }, title))) : null;\n const descriptionNode = isValidNode(description) ? ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-description`\n }, description)) : null;\n const coverNode = isValidNode(cover) ? /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-cover`\n }, cover) : null;\n let mergedIndicatorNode;\n if (indicatorsRender) {\n mergedIndicatorNode = indicatorsRender(current, total);\n } else {\n mergedIndicatorNode = _toConsumableArray(Array.from({\n length: total\n }).keys()).map((stepItem, index) => ( /*#__PURE__*/React.createElement(\"span\", {\n key: stepItem,\n className: classNames(index === current && `${prefixCls}-indicator-active`, `${prefixCls}-indicator`)\n })));\n }\n const mainBtnType = mergedType === 'primary' ? 'default' : 'primary';\n const secondaryBtnProps = {\n type: 'default',\n ghost: mergedType === 'primary'\n };\n const [contextLocale] = useLocale('Tour', defaultLocale.Tour);\n return /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-content`\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-inner`\n }, closable && mergedCloseIcon, coverNode, headerNode, descriptionNode, /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-footer`\n }, total > 1 && /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-indicators`\n }, mergedIndicatorNode), /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-buttons`\n }, current !== 0 ? ( /*#__PURE__*/React.createElement(Button, Object.assign({}, secondaryBtnProps, prevButtonProps, {\n onClick: prevBtnClick,\n size: \"small\",\n className: classNa
|