"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomizedRadioGroup = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_native_1 = require("react-native");
const radio_group_1 = require("@fluentui-react-native/radio-group");
const styles_1 = require("../Common/styles");
const styles = react_native_1.StyleSheet.create({
    tokensRow: {
        flexDirection: 'row',
        marginBottom: 10,
    },
    tokensColumn: {
        flexDirection: 'column',
        margin: 10,
    },
});
const CustomizedRadioGroup = () => {
    // RadioGroup
    const [groupColor, setGroupColor] = React.useState('black');
    const [requiredColor, setRequiredColor] = React.useState('red');
    const [requiredPadding, setRequiredPadding] = React.useState(2);
    // Radio
    const [borderColor, setBorderColor] = React.useState('white');
    const [borderWidth, setBorderWidth] = React.useState(1);
    const [borderRadius, setBorderRadius] = React.useState(1);
    const [radioBorderWidth, setRadioBorderWidth] = React.useState(1);
    const [radioVisibility, setRadioVisibility] = React.useState(1);
    const [radioBorder, setRadioBorder] = React.useState('black');
    const [radioOuterCircleSize, setRadioOuterCircleSize] = React.useState(20);
    const [radioInnerCircleSize, setRadioInnerCircleSize] = React.useState(10);
    const [radioFill, setRadioFill] = React.useState('blue');
    const [color, setColor] = React.useState('black');
    const [marginTop, setMarginTop] = React.useState(6);
    const [marginRight, setMarginRight] = React.useState(6);
    const [marginBottom, setMarginBottom] = React.useState(6);
    const [marginLeft, setMarginLeft] = React.useState(4);
    const [labelMarginVertical, setLabelMarginVertical] = React.useState(4);
    const [labelMarginRight, setLabelMarginRight] = React.useState(2);
    const [labelMarginLeft, setLabelMarginLeft] = React.useState(0);
    const [subtextMarginTop, setSubtextMarginTop] = React.useState(2);
    const [subtextMarginBottom, setSubtextMarginBottom] = React.useState(2);
    const CustomRadioGroup = React.useMemo(() => {
        const tokens = {
            color: groupColor,
            requiredColor,
            requiredPadding,
            disabled: {
                color: groupColor,
            },
        };
        return radio_group_1.RadioGroupV1.customize(tokens);
    }, [groupColor, requiredColor, requiredPadding]);
    const CustomRadio = React.useMemo(() => {
        const tokens = {
            borderColor,
            borderWidth,
            borderRadius,
            radioBorderWidth,
            radioVisibility,
            radioBorder,
            radioOuterCircleSize,
            radioInnerCircleSize,
            color,
            marginTop,
            marginRight,
            marginBottom,
            marginLeft,
            labelMarginVertical,
            labelMarginRight,
            labelMarginLeft,
            subtextMarginTop,
            subtextMarginBottom,
            labelPositionBelow: {
                marginLeft: marginLeft,
            },
            disabled: {
                radioBorder,
                color,
                radioVisibility,
            },
            hovered: {
                radioBorder,
                color,
                selected: {
                    radioBorder,
                    radioFill,
                    color,
                    radioVisibility,
                },
            },
            pressed: {
                radioBorder,
                color,
                selected: {
                    radioBorder,
                    radioFill,
                    color,
                    radioVisibility,
                },
            },
            focused: {
                borderColor,
                selected: {
                    radioVisibility,
                },
            },
            selected: {
                radioBorder,
                radioFill,
                color,
                radioVisibility,
                disabled: {
                    radioFill,
                },
            },
        };
        return radio_group_1.Radio.customize(tokens);
    }, [
        borderColor,
        borderWidth,
        borderRadius,
        radioBorderWidth,
        radioVisibility,
        radioBorder,
        radioOuterCircleSize,
        radioInnerCircleSize,
        radioFill,
        color,
        marginTop,
        marginRight,
        marginBottom,
        marginLeft,
        labelMarginVertical,
        labelMarginRight,
        labelMarginLeft,
        subtextMarginTop,
        subtextMarginBottom,
    ]);
    return (React.createElement(react_native_1.View, { style: styles.tokensColumn },
        React.createElement(react_native_1.View, { style: styles.tokensRow },
            React.createElement(react_native_1.View, null,
                React.createElement(react_native_1.Text, null, "RadioGroup Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "RadioGroup color", style: styles_1.commonTestStyles.textBox, placeholder: "color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setGroupColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "RadioGroup required color", style: styles_1.commonTestStyles.textBox, placeholder: "requiredColor", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRequiredColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "RadioGroup required padding", style: styles_1.commonTestStyles.textBox, placeholder: "requiredPadding", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRequiredPadding(parseInt(e.nativeEvent.text.toString()));
                    } }))),
        React.createElement(react_native_1.View, { style: styles.tokensRow },
            React.createElement(react_native_1.View, null,
                React.createElement(react_native_1.Text, null, "Radio Border Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio border color", style: styles_1.commonTestStyles.textBox, placeholder: "borderColor", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setBorderColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio border width", style: styles_1.commonTestStyles.textBox, placeholder: "borderWidth", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setBorderWidth(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio border radius", style: styles_1.commonTestStyles.textBox, placeholder: "borderRadius", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setBorderRadius(parseInt(e.nativeEvent.text.toString()));
                    } })),
            React.createElement(react_native_1.View, null,
                React.createElement(react_native_1.Text, null, "Radio Button Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button border width", style: styles_1.commonTestStyles.textBox, placeholder: "radioBorderWidth", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRadioBorderWidth(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button visibility", style: styles_1.commonTestStyles.textBox, placeholder: "radioVisibility", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRadioVisibility(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button border", style: styles_1.commonTestStyles.textBox, placeholder: "radioBorder", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRadioBorder(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button size", style: styles_1.commonTestStyles.textBox, placeholder: "radioOuterCircleSize", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRadioOuterCircleSize(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button inner circle size", style: styles_1.commonTestStyles.textBox, placeholder: "radioInnerCircleSize", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRadioInnerCircleSize(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button fill", style: styles_1.commonTestStyles.textBox, placeholder: "radioFill", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setRadioFill(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button margin top", style: styles_1.commonTestStyles.textBox, placeholder: "marginTop", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setMarginTop(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button margin right", style: styles_1.commonTestStyles.textBox, placeholder: "marginRight", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setMarginRight(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button margin bottom", style: styles_1.commonTestStyles.textBox, placeholder: "marginBottom", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setMarginBottom(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio button margin left", style: styles_1.commonTestStyles.textBox, placeholder: "marginLeft", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setMarginLeft(parseInt(e.nativeEvent.text.toString()));
                    } })),
            React.createElement(react_native_1.View, null,
                React.createElement(react_native_1.Text, null, "Radio Label Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio label color", style: styles_1.commonTestStyles.textBox, placeholder: "color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio label margin vertical", style: styles_1.commonTestStyles.textBox, placeholder: "marginVertical", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setLabelMarginVertical(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio label margin right", style: styles_1.commonTestStyles.textBox, placeholder: "marginRight", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setLabelMarginRight(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio label margin left", style: styles_1.commonTestStyles.textBox, placeholder: "marginLeft", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setLabelMarginLeft(parseInt(e.nativeEvent.text.toString()));
                    } })),
            React.createElement(react_native_1.View, null,
                React.createElement(react_native_1.Text, null, "Radio Subtext Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio subtext margin top", style: styles_1.commonTestStyles.textBox, placeholder: "marginTop", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setSubtextMarginTop(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Radio subtext margin bottom", style: styles_1.commonTestStyles.textBox, placeholder: "marginBottom", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setSubtextMarginBottom(parseInt(e.nativeEvent.text.toString()));
                    } }))),
        React.createElement(CustomRadioGroup, { required: true, label: "Custom RadioGroup", accessibilityLabel: "Custom Switch" },
            React.createElement(CustomRadio, { label: "Apple", subtext: "Fruit", value: "Apple" }),
            React.createElement(CustomRadio, { label: "Pear", value: "Pear" }),
            React.createElement(CustomRadio, { label: "Banana", value: "Banana" }),
            React.createElement(CustomRadio, { label: "Orange", value: "Orange" }))));
};
exports.CustomizedRadioGroup = CustomizedRadioGroup;
//# sourceMappingURL=CustomizedRadioGroup.js.map