@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
17 lines (16 loc) • 1.75 kB
JavaScript
import { __assign } from "tslib";
import clsx from 'clsx';
import React from 'react';
import AbstractSwitch from '../internal/components/abstract-switch';
import { fireNonCancelableEvent } from '../internal/events';
import styles from './styles.css.js';
export default function RadioButton(_a) {
var _b, _c;
var name = _a.name, label = _a.label, value = _a.value, checked = _a.checked, withoutLabel = _a.withoutLabel, description = _a.description, disabled = _a.disabled, controlId = _a.controlId, onChange = _a.onChange;
return (React.createElement(AbstractSwitch, { className: clsx(styles.radio, description && styles['radio--has-description']), controlClassName: styles['radio-control'], label: label, description: description, disabled: disabled, controlId: controlId, nativeControl: function (nativeControlProps) { return (React.createElement("input", __assign({}, nativeControlProps, { className: styles.input, type: "radio", name: name, value: value, checked: checked, onChange: onChange && (function () { return fireNonCancelableEvent(onChange, { value: value }); }) }))); }, styledControl: React.createElement("svg", { viewBox: "0 0 100 100", focusable: "false", "aria-hidden": "true" },
React.createElement("circle", { className: clsx(styles['styled-circle-border'], (_b = {}, _b[styles['styled-circle-disabled']] = disabled, _b)), strokeWidth: 8, cx: 50, cy: 50, r: 46 }),
React.createElement("circle", { className: clsx(styles['styled-circle-fill'], (_c = {},
_c[styles['styled-circle-disabled']] = disabled,
_c[styles['styled-circle-checked']] = checked,
_c)), strokeWidth: 30, cx: 50, cy: 50, r: 35 })), withoutLabel: withoutLabel }));
}