"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomizeUsage = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_native_1 = require("react-native");
const react_native_2 = require("@fluentui/react-native");
const theme_types_1 = require("@fluentui-react-native/theme-types");
const themed_stylesheet_1 = require("@fluentui-react-native/themed-stylesheet");
const styles_1 = require("./styles");
const AlignmentPicker_1 = require("../Common/AlignmentPicker");
const Slider_1 = require("../Common/Slider");
const styles_2 = require("../Common/styles");
const getThemedStyles = (0, themed_stylesheet_1.themedStyleSheet)((t) => {
    return { textbox: { ...styles_2.commonTestStyles.textBox, borderColor: t.colors.inputBorder } };
});
const CustomizeUsage = () => {
    const [showImage, setShowImage] = React.useState(true);
    const [coinColor, setCoinColor] = React.useState();
    const [textColor, setTextColor] = React.useState();
    const [physicalSize, setPhysicalSize] = React.useState(80);
    const [iconSize, setIconSize] = React.useState(24);
    const [iconStrokeWidth, setIconStrokeWidth] = React.useState(2);
    const [iconStrokeColor, setIconStrokeColor] = React.useState(undefined);
    const [initialsSize, setInitialsSize] = React.useState(14);
    const [horizontalAlignment, setHorizontalAlignment] = React.useState();
    const [verticalAlignment, setVerticalAlignment] = React.useState();
    const [ringColor, setRingColor] = React.useState('red');
    const [ringBackgroundColor, setRingBackgroundColor] = React.useState(undefined);
    const [showRing, setShowRing] = React.useState(true);
    const [transparent, setTransparent] = React.useState(false);
    const theme = (0, theme_types_1.useTheme)();
    const textBoxBorderStyle = getThemedStyles(theme);
    const CustomizedPersonaCoin = React.useMemo(() => {
        const tokens = {
            backgroundColor: coinColor,
            color: textColor,
            horizontalIconAlignment: horizontalAlignment,
            verticalIconAlignment: verticalAlignment,
            iconSize: iconSize,
            iconStrokeWidth: iconStrokeWidth,
            iconStrokeColor: iconStrokeColor,
            initialsSize: initialsSize,
            coinSize: physicalSize,
        };
        return react_native_2.PersonaCoin.customize({ tokens });
    }, [
        coinColor,
        textColor,
        horizontalAlignment,
        verticalAlignment,
        iconSize,
        iconStrokeWidth,
        iconStrokeColor,
        initialsSize,
        physicalSize,
    ]);
    return (React.createElement(react_native_1.View, { style: styles_2.commonTestStyles.root },
        React.createElement(react_native_1.View, { style: styles_2.commonTestStyles.settings },
            React.createElement(react_native_1.View, { style: styles_2.commonTestStyles.switch },
                React.createElement(react_native_1.Text, null, "Show image"),
                React.createElement(react_native_1.Switch, { value: showImage, onValueChange: setShowImage })),
            React.createElement(react_native_1.View, { style: styles_2.commonTestStyles.switch },
                React.createElement(react_native_1.Text, null, "Show rings"),
                React.createElement(react_native_1.Switch, { value: showRing, onValueChange: setShowRing })),
            React.createElement(react_native_1.View, { style: styles_2.commonTestStyles.switch },
                React.createElement(react_native_1.Text, null, "Transparent Ring"),
                React.createElement(react_native_1.Switch, { value: transparent, onValueChange: setTransparent })),
            React.createElement(react_native_1.TextInput, { accessibilityLabel: "Background color", style: textBoxBorderStyle.textbox, placeholder: "Background color", blurOnSubmit: true, onSubmitEditing: (e) => {
                    setCoinColor(e.nativeEvent.text);
                } }),
            React.createElement(react_native_1.TextInput, { accessibilityLabel: "Initials text color", style: textBoxBorderStyle.textbox, placeholder: "Initials text color", blurOnSubmit: true, onSubmitEditing: (e) => {
                    setTextColor(e.nativeEvent.text);
                } }),
            React.createElement(react_native_1.TextInput, { accessibilityLabel: "Icon stroke color", style: textBoxBorderStyle.textbox, placeholder: "Icon stroke color", blurOnSubmit: true, onSubmitEditing: (e) => {
                    setIconStrokeColor(e.nativeEvent.text);
                } }),
            React.createElement(react_native_1.TextInput, { accessibilityLabel: "Ring color", style: textBoxBorderStyle.textbox, placeholder: "Ring color", blurOnSubmit: true, onSubmitEditing: (e) => {
                    setRingColor(e.nativeEvent.text);
                } }),
            React.createElement(react_native_1.TextInput, { accessibilityLabel: "Ring background color", style: textBoxBorderStyle.textbox, placeholder: "Ring background color", blurOnSubmit: true, onSubmitEditing: (e) => {
                    setRingBackgroundColor(e.nativeEvent.text);
                } }),
            React.createElement(AlignmentPicker_1.AlignmentPicker, { style: styles_2.commonTestStyles.header, label: "Horizontal icon alignment", onSelectionChange: setHorizontalAlignment }),
            React.createElement(AlignmentPicker_1.AlignmentPicker, { style: styles_2.commonTestStyles.header, label: "Vertical icon alignment", onSelectionChange: setVerticalAlignment }),
            React.createElement(react_native_1.Text, null, "Coin size"),
            React.createElement(Slider_1.Slider, { minimum: 8, maximum: 200, initialValue: 80, style: styles_2.commonTestStyles.vmargin, onChange: setPhysicalSize }),
            React.createElement(react_native_1.Text, null, "Icon size"),
            React.createElement(Slider_1.Slider, { minimum: 8, maximum: 100, initialValue: 24, style: styles_2.commonTestStyles.vmargin, onChange: setIconSize }),
            React.createElement(react_native_1.Text, null, "Icon stroke width"),
            React.createElement(Slider_1.Slider, { minimum: 0, maximum: 8, initialValue: 2, style: styles_2.commonTestStyles.vmargin, onChange: setIconStrokeWidth }),
            React.createElement(react_native_1.Text, null, "Font size"),
            React.createElement(Slider_1.Slider, { minimum: 5, maximum: 50, initialValue: 14, style: styles_2.commonTestStyles.vmargin, onChange: setInitialsSize })),
        React.createElement(CustomizedPersonaCoin, { initials: "SB", imageDescription: "Former CEO of Microsoft", presence: "blocked", imageUrl: showImage ? styles_1.steveBallmerPhotoUrl : undefined, ring: showRing
                ? {
                    ringColor,
                    ringBackgroundColor,
                    ringThickness: 4,
                    innerGap: 4,
                    transparent,
                }
                : undefined })));
};
exports.CustomizeUsage = CustomizeUsage;
//# sourceMappingURL=CustomizeUsage.js.map