"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomizedSwitch = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_native_1 = require("react-native");
const switch_1 = require("@fluentui-react-native/switch");
const text_1 = require("@fluentui-react-native/text");
const styles_1 = require("../Common/styles");
const styles = react_native_1.StyleSheet.create({
    tokensRow: {
        flexDirection: 'row',
        marginBottom: 10,
    },
    tokensColumn: {
        flexDirection: 'column',
        margin: 10,
    },
});
const CustomizedSwitch = () => {
    const [trackColor, setTrackColor] = React.useState('blue');
    const [thumbColorOn, setThumbColorOn] = React.useState('white');
    const [thumbColorOff, setThumbColorOff] = React.useState('grey');
    const [thumbSize, setThumbSize] = React.useState(20);
    const [trackWidth, setTrackWidth] = React.useState(100);
    const [trackHeight, setTrackHeight] = React.useState(30);
    const [focusStrokeColor, setFocusStrokeColor] = React.useState('black');
    const [focusBorderRadius, setFocusBorderRadius] = React.useState(4);
    const [focusBorderWidth, setFocusBorderWidth] = React.useState(1);
    const [thumbRadius, setThumbRadius] = React.useState(20);
    const [padding, setPadding] = React.useState(4);
    const [color, setColor] = React.useState('black');
    const [minWidth, setMinWidth] = React.useState(trackWidth);
    const [minHeight, setMinHeight] = React.useState(trackHeight);
    const [borderWidth, setBorderWidth] = React.useState(1);
    const [borderRadius, setBorderRadius] = React.useState(20);
    const [borderColor, setBorderColor] = React.useState(trackColor);
    const CustomSwitch = React.useMemo(() => {
        const tokens = {
            trackWidth,
            trackHeight,
            minWidth,
            minHeight,
            thumbSize,
            thumbRadius,
            padding,
            color,
            borderWidth,
            borderRadius,
            toggleOn: {
                thumbColor: thumbColorOn,
                trackColor,
                borderColor,
                hovered: {
                    borderColor,
                    trackColor,
                    thumbColor: thumbColorOn,
                },
                pressed: {
                    borderColor: trackColor,
                    trackColor,
                    thumbColor: thumbColorOn,
                },
            },
            toggleOff: {
                thumbColor: thumbColorOff,
                hovered: {
                    thumbColor: thumbColorOff,
                },
                pressed: {
                    thumbColor: thumbColorOff,
                },
            },
            focused: {
                focusBorderRadius,
                focusStrokeColor,
                focusBorderWidth,
            },
        };
        return switch_1.Switch.customize(tokens);
    }, [
        trackColor,
        thumbColorOn,
        thumbColorOff,
        thumbSize,
        thumbRadius,
        trackWidth,
        trackHeight,
        focusStrokeColor,
        focusBorderRadius,
        focusBorderWidth,
        padding,
        color,
        minWidth,
        minHeight,
        borderWidth,
        borderRadius,
        borderColor,
    ]);
    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(text_1.TextV1, null, "Track Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Track color", style: styles_1.commonTestStyles.textBox, placeholder: "Track color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setTrackColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Track border color", style: styles_1.commonTestStyles.textBox, placeholder: "Track border color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setBorderColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Track width", style: styles_1.commonTestStyles.textBox, placeholder: "Track width", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setTrackWidth(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Track height", style: styles_1.commonTestStyles.textBox, placeholder: "Track height", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setTrackHeight(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Track border width", style: styles_1.commonTestStyles.textBox, placeholder: "Track border width", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setBorderWidth(parseInt(e.nativeEvent.text.toString()));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Track border radius", style: styles_1.commonTestStyles.textBox, placeholder: "Track border radius", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setBorderRadius(parseInt(e.nativeEvent.text.toString()));
                    } })),
            React.createElement(react_native_1.View, null,
                React.createElement(text_1.TextV1, null, "Thumb Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Thumb on color", style: styles_1.commonTestStyles.textBox, placeholder: "Thumb on color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setThumbColorOn(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Thumb off color", style: styles_1.commonTestStyles.textBox, placeholder: "Thumb off color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setThumbColorOff(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Thumb size", style: styles_1.commonTestStyles.textBox, placeholder: "Thumb size", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setThumbSize(parseInt(e.nativeEvent.text));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Thumb radius", style: styles_1.commonTestStyles.textBox, placeholder: "Thumb radius", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setThumbRadius(parseInt(e.nativeEvent.text));
                    } }))),
        React.createElement(react_native_1.View, { style: styles.tokensRow },
            React.createElement(react_native_1.View, null,
                React.createElement(text_1.TextV1, null, "Focus Stroke Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Focus stroke color", style: styles_1.commonTestStyles.textBox, placeholder: "Focus stroke color", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setFocusStrokeColor(e.nativeEvent.text);
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Focus stroke border radius", style: styles_1.commonTestStyles.textBox, placeholder: "Focus stroke border radius", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setFocusBorderRadius(parseInt(e.nativeEvent.text));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Focus stroke border width", style: styles_1.commonTestStyles.textBox, placeholder: "Focus stroke border width", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setFocusBorderWidth(parseInt(e.nativeEvent.text));
                    } })),
            React.createElement(react_native_1.View, null,
                React.createElement(text_1.TextV1, null, "Other Tokens"),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Minimum width", style: styles_1.commonTestStyles.textBox, placeholder: "Minimum width", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setMinWidth(parseInt(e.nativeEvent.text));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Minimum height", style: styles_1.commonTestStyles.textBox, placeholder: "Minimum height", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setMinHeight(parseInt(e.nativeEvent.text));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Padding", style: styles_1.commonTestStyles.textBox, placeholder: "Padding", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setPadding(parseInt(e.nativeEvent.text));
                    } }),
                React.createElement(react_native_1.TextInput, { accessibilityLabel: "Text colors", style: styles_1.commonTestStyles.textBox, placeholder: "Text colors", blurOnSubmit: true, onSubmitEditing: (e) => {
                        setColor(e.nativeEvent.text);
                    } }))),
        React.createElement(CustomSwitch, { label: "Custom Switch", onText: "On", offText: "Off", accessibilityLabel: "Custom Switch" })));
};
exports.CustomizedSwitch = CustomizedSwitch;
//# sourceMappingURL=CustomizedSwitch.js.map