@ant-design/x
Version:
Craft AI-driven interfaces effortlessly
48 lines (46 loc) • 1.6 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { clsx } from 'clsx';
import React from 'react';
import useXComponentConfig from "../_util/hooks/use-x-component-config";
import { useXProviderContext } from "../x-provider";
import Bubble from "./Bubble";
import useStyle from "./style";
const SystemBubble = ({
prefixCls: customizePrefixCls,
content,
variant = 'shadow',
shape,
style,
className,
styles = {},
classNames = {},
rootClassName,
...restProps
}, ref) => {
// ===================== Component Config =========================
const contextConfig = useXComponentConfig('bubble');
// ============================ Prefix ============================
const {
getPrefixCls
} = useXProviderContext();
const prefixCls = getPrefixCls('bubble', customizePrefixCls);
const [hashId, cssVarCls] = useStyle(prefixCls);
// ============================ Styles ============================
const cls = `${prefixCls}-system`;
const rootMergedCls = clsx(hashId, cssVarCls, cls, prefixCls, contextConfig.className, contextConfig.classNames.root, classNames.root, className, rootClassName);
return /*#__PURE__*/React.createElement(Bubble, _extends({
ref: ref,
style: style,
className: rootMergedCls,
styles: styles,
classNames: classNames,
variant: variant,
shape: shape,
content: content
}, restProps));
};
const ForwardSystemBubble = /*#__PURE__*/React.forwardRef(SystemBubble);
if (process.env.NODE_ENV !== 'production') {
ForwardSystemBubble.displayName = 'SystemBubble';
}
export default ForwardSystemBubble;