@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 2.67 kB
Source Map (JSON)
{"version":3,"file":"Radio.mjs","names":["Radio","BaseRadio"],"sources":["../../../src/base-ui/Radio/Radio.tsx"],"sourcesContent":["'use client';\n\nimport { Radio as BaseRadio } from '@base-ui/react/radio';\nimport { cx } from 'antd-style';\nimport { type CSSProperties, memo } from 'react';\n\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { RadioProps } from './type';\n\nconst Radio = memo<RadioProps>(\n ({\n size = 16,\n backgroundColor,\n children,\n className,\n classNames,\n styles: customStyles,\n style,\n textProps,\n disabled,\n ...rest\n }) => {\n const dotStyle: CSSProperties = {\n height: size,\n width: size,\n ...(backgroundColor ? { '--lobe-radio-bg': backgroundColor } : {}),\n ...(children ? {} : style),\n ...customStyles?.radio,\n };\n\n const dot = (\n <BaseRadio.Root\n className={cx(styles.root, children ? classNames?.radio : className, classNames?.radio)}\n disabled={disabled}\n style={dotStyle}\n {...rest}\n >\n <BaseRadio.Indicator\n className={styles.indicator}\n style={{ height: Math.round(size * 0.375), width: Math.round(size * 0.375) }}\n />\n </BaseRadio.Root>\n );\n\n if (!children) return dot;\n\n return (\n <label\n className={cx(styles.label, className, classNames?.wrapper)}\n style={{ gap: Math.floor(size / 2), ...style, ...customStyles?.wrapper }}\n >\n {dot}\n <Text\n as={'span'}\n className={classNames?.text}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </label>\n );\n },\n);\n\nRadio.displayName = 'Radio';\n\nexport default Radio;\n"],"mappings":";;;;;;;;AAWA,MAAMA,UAAQ,MACX,EACC,OAAO,IACP,iBACA,UACA,WACA,YACA,QAAQ,cACR,OACA,WACA,UACA,GAAG,WACC;CACJ,MAAM,WAA0B;EAC9B,QAAQ;EACR,OAAO;EACP,GAAI,kBAAkB,EAAE,mBAAmB,gBAAgB,IAAI,CAAC;EAChE,GAAI,WAAW,CAAC,IAAI;EACpB,GAAG,cAAc;CACnB;CAEA,MAAM,MACJ,oBAACC,MAAU,MAAX;EACE,WAAW,GAAG,OAAO,MAAM,WAAW,YAAY,QAAQ,WAAW,YAAY,KAAK;EAC5E;EACV,OAAO;EACP,GAAI;YAEJ,oBAACA,MAAU,WAAX;GACE,WAAW,OAAO;GAClB,OAAO;IAAE,QAAQ,KAAK,MAAM,OAAO,IAAK;IAAG,OAAO,KAAK,MAAM,OAAO,IAAK;GAAE;EAC5E,CAAA;CACa,CAAA;CAGlB,IAAI,CAAC,UAAU,OAAO;CAEtB,OACE,qBAAC,SAAD;EACE,WAAW,GAAG,OAAO,OAAO,WAAW,YAAY,OAAO;EAC1D,OAAO;GAAE,KAAK,KAAK,MAAM,OAAO,CAAC;GAAG,GAAG;GAAO,GAAG,cAAc;EAAQ;YAFzE,CAIG,KACD,oBAAC,MAAD;GACE,IAAI;GACJ,WAAW,YAAY;GACvB,OAAO,cAAc;GACrB,GAAI;GACJ,MAAM,WAAW,cAAc,WAAW;GAEzC;EACG,CAAA,CACD;;AAEX,CACF;AAEA,QAAM,cAAc"}