import React from "react"; import styled from "styled-components"; import { ComponentProps } from "components/designSystems/appsmith/BaseComponent"; import { RadioOption } from "widgets/RadioGroupWidget"; import { RadioGroup, Radio, ControlGroup, Label, Classes, } from "@blueprintjs/core"; import { WIDGET_PADDING } from "constants/WidgetConstants"; import { labelStyle } from "constants/DefaultTheme"; const StyledControlGroup = styled(ControlGroup)` &&& { & > label { ${labelStyle} flex: 0 1 30%; align-self: flex-start; text-align: right; margin: 0 ${WIDGET_PADDING * 2}px 0 0; } } `; const StyledRadioGroup = styled(RadioGroup)``; class RadioGroupComponent extends React.Component { render() { return ( {this.props.label && ( )} {this.props.options.map(option => { return ( ); })} ); } onRadioSelectionChange = (event: React.FormEvent) => { this.props.onRadioSelectionChange(event.currentTarget.value); }; } export interface RadioGroupComponentProps extends ComponentProps { label: string; options: RadioOption[]; onRadioSelectionChange: (updatedOptionValue: string) => void; selectedOptionValue: string; isLoading: boolean; } export default RadioGroupComponent;