/** @jsx jsx */ import { jsx, css } from '@emotion/react' import { Fragment, forwardRef } from 'react' const Radio = forwardRef( ( { label, error, onClear, isClear, loading, children, hasValue, placeholder, name, value, isCheckbox, ...props }, ref ) => { const namespace = `${name}_${value}` return isClear ? ( ) : ( ) } ) export type RadioProps = React.InputHTMLAttributes & { label?: string placeholder?: string // style: React.CSSProperties error?: boolean onClear?: () => void isClear?: boolean isCheckbox?: boolean loading?: boolean hasValue?: boolean name: string } export default Radio const checkboxStyles = css` display: none; &:checked + label > div > svg { opacity: 1; } &:checked + label div { background-color: transparent; } &:checked + label .isCheckbox, &:not(:checked) + label:hover div { border-color: transparent; } ` const boxStyle = css` position: relative; display: inline-block; width: 20px; height: 20px; background-color: transparent; border: 1px solid #c3c3c3; border-radius: 1000px; transition: background-color 0.3s; ` const labelStyle = css` display: inline-flex; align-items: center; margin-right: 1em; cursor: pointer; user-select: none; margin-bottom: 0; &:hover div { background-color: #e2e3e7; } ` const svgStyle = css` opacity: 0; ` const valueStyle = css` display: inline-block; margin-left: 0.5em; vertical-align: middle; ` const clearStyles = css` border: 0; background: none; padding: 0; width: 20px; height: 20px; opacity: 0.5; transition: opacity 0.3s; cursor: pointer; position: absolute; right: 1em; top: calc(50% + 2px); &:hover { opacity: 1; } &:disabled { pointer-events: none; } `