1 line
12 KiB
JSON
1 line
12 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useStyle from './style';\nconst Divider = props => {\n const {\n getPrefixCls,\n direction,\n divider\n } = React.useContext(ConfigContext);\n const {\n prefixCls: customizePrefixCls,\n type = 'horizontal',\n orientation = 'center',\n orientationMargin,\n className,\n rootClassName,\n children,\n dashed,\n variant = 'solid',\n plain,\n style\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"type\", \"orientation\", \"orientationMargin\", \"className\", \"rootClassName\", \"children\", \"dashed\", \"variant\", \"plain\", \"style\"]);\n const prefixCls = getPrefixCls('divider', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const hasChildren = !!children;\n const hasCustomMarginLeft = orientation === 'left' && orientationMargin != null;\n const hasCustomMarginRight = orientation === 'right' && orientationMargin != null;\n const classString = classNames(prefixCls, divider === null || divider === void 0 ? void 0 : divider.className, hashId, cssVarCls, `${prefixCls}-${type}`, {\n [`${prefixCls}-with-text`]: hasChildren,\n [`${prefixCls}-with-text-${orientation}`]: hasChildren,\n [`${prefixCls}-dashed`]: !!dashed,\n [`${prefixCls}-${variant}`]: variant !== 'solid',\n [`${prefixCls}-plain`]: !!plain,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n [`${prefixCls}-no-default-orientation-margin-left`]: hasCustomMarginLeft,\n [`${prefixCls}-no-default-orientation-margin-right`]: hasCustomMarginRight\n }, className, rootClassName);\n const memoizedOrientationMargin = React.useMemo(() => {\n if (typeof orientationMargin === 'number') {\n return orientationMargin;\n }\n if (/^\\d+$/.test(orientationMargin)) {\n return Number(orientationMargin);\n }\n return orientationMargin;\n }, [orientationMargin]);\n const innerStyle = Object.assign(Object.assign({}, hasCustomMarginLeft && {\n marginLeft: memoizedOrientationMargin\n }), hasCustomMarginRight && {\n marginRight: memoizedOrientationMargin\n });\n // Warning children not work in vertical mode\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Divider');\n process.env.NODE_ENV !== \"production\" ? warning(!children || type !== 'vertical', 'usage', '`children` not working in `vertical` mode.') : void 0;\n }\n return wrapCSSVar( /*#__PURE__*/React.createElement(\"div\", Object.assign({\n className: classString,\n style: Object.assign(Object.assign({}, divider === null || divider === void 0 ? void 0 : divider.style), style)\n }, restProps, {\n // biome-ignore lint/a11y/useAriaPropsForRole: divider do not need aria-value\n role: \"separator\"\n }), children && type !== 'vertical' && ( /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-inner-text`,\n style: innerStyle\n }, children))));\n};\nif (process.env.NODE_ENV !== 'production') {\n Divider.displayName = 'Divider';\n}\nexport default Divider;","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","devUseWarning","ConfigContext","useStyle","Divider","props","getPrefixCls","direction","divider","useContext","prefixCls","customizePrefixCls","type","orientation","orientationMargin","classN
|