"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomizeUsage = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var react_native_1 = require("react-native");
var react_native_2 = require("@fluentui/react-native");
var theme_types_1 = require("@fluentui-react-native/theme-types");
var slider_1 = tslib_1.__importDefault(require("@react-native-community/slider"));
var styles_1 = require("./styles");
var styles_2 = require("../Common/styles");
var styles = react_native_1.StyleSheet.create({ slider: tslib_1.__assign(tslib_1.__assign({}, styles_2.commonTestStyles.vmargin), { flex: 1 }) });
var StyledSlider = function (props) {
    var title = props.title, min = props.min, max = props.max, initial = props.initial, onChange = props.onChange, current = props.current, step = props.step;
    var theme = (0, theme_types_1.useTheme)();
    return (React.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
        React.createElement(react_native_1.Text, { style: { flex: 0.5, color: theme.colors.inputText } }, title),
        React.createElement(slider_1.default, { step: step || 1, minimumValue: min, maximumValue: max, value: initial, style: styles.slider, onValueChange: onChange }),
        React.createElement(react_native_1.Text, { style: { flex: 0.2, color: theme.colors.inputText } }, current)));
};
var StyledTextInput = function (props) {
    var theme = (0, theme_types_1.useTheme)();
    var textInputStyles = [
        styles_2.commonTestStyles.textBox,
        { flex: 1, marginHorizontal: 5, borderColor: theme.colors.disabledBodyText, color: theme.colors.inputText },
    ];
    return (React.createElement(react_native_1.TextInput, tslib_1.__assign({ accessibilityLabel: props.placeholder, style: textInputStyles, placeholderTextColor: theme.colors.disabledBodyText, blurOnSubmit: true }, props)));
};
var StyledSwitch = function (props) {
    var title = props.title, value = props.value, onChange = props.onChange;
    var theme = (0, theme_types_1.useTheme)();
    return (React.createElement(react_native_1.View, { style: styles_2.commonTestStyles.switch },
        React.createElement(react_native_1.Text, { style: { color: theme.colors.inputText, flex: 1 } }, title),
        React.createElement(react_native_1.Switch, { style: { flex: 1 }, value: value, onValueChange: onChange })));
};
var CustomizeUsage = function () {
    var _a = React.useState(true), showImage = _a[0], setShowImage = _a[1];
    var _b = React.useState(true), showRings = _b[0], setShowRings = _b[1];
    var _c = React.useState(true), showPresence = _c[0], setShowPresence = _c[1];
    var _d = React.useState(false), showColoredBackground = _d[0], setShowColoredBackground = _d[1];
    var _e = React.useState(false), transparent = _e[0], setTransparent = _e[1];
    var _f = React.useState('green'), coinColor = _f[0], setCoinColor = _f[1];
    var _g = React.useState('white'), textColor = _g[0], setTextColor = _g[1];
    var _h = React.useState(88), coinSize = _h[0], setCoinsize = _h[1];
    var _j = React.useState(4), ringThickness = _j[0], setRingThickness = _j[1];
    var _k = React.useState(4), innerGap = _k[0], setInnerGap = _k[1];
    var _l = React.useState(20), iconSize = _l[0], setIconSize = _l[1];
    var _m = React.useState(4), iconStrokeWidth = _m[0], setIconStrokeWidth = _m[1];
    var _o = React.useState('green'), ringColor = _o[0], setRingColor = _o[1];
    var _p = React.useState(undefined), ringBackgroundColor = _p[0], setRingBackgroundColor = _p[1];
    var CustomizedPersonaCoin = React.useMemo(function () {
        var tokens = {
            backgroundColor: coinColor,
            color: textColor,
            ring: { ringColor: 'red' },
            coinSize: coinSize,
            iconSize: iconSize,
            iconStrokeWidth: iconStrokeWidth,
        };
        return react_native_2.PersonaCoin.customize({ tokens: tokens });
    }, [coinColor, textColor, coinSize, iconSize, iconStrokeWidth]);
    return (React.createElement(react_native_1.View, { style: { flexDirection: 'column', padding: 10, backgroundColor: showColoredBackground ? 'gray' : 'transparent' } },
        React.createElement(react_native_1.View, { style: { flexDirection: 'row', padding: 20, alignItems: 'center' } },
            React.createElement(react_native_1.View, { style: { width: '35%', alignItems: 'center' } },
                React.createElement(CustomizedPersonaCoin, { initials: "SB", imageDescription: "Photo of Satya Nadella", imageUrl: showImage ? styles_1.steveBallmerPhotoUrl : undefined, presence: showPresence && iconSize ? 'away' : undefined, ring: showRings && ringThickness
                        ? {
                            ringColor: ringColor,
                            ringBackgroundColor: ringBackgroundColor,
                            ringThickness: ringThickness,
                            innerGap: innerGap,
                            transparent: transparent,
                        }
                        : undefined })),
            React.createElement(react_native_1.View, { style: { width: '50%', marginLeft: 30 } },
                React.createElement(StyledSwitch, { title: "Change Background", value: showColoredBackground, onChange: setShowColoredBackground }),
                React.createElement(StyledSwitch, { title: "Show Image", value: showImage, onChange: setShowImage }),
                React.createElement(StyledSwitch, { title: "Show Presence", value: showPresence, onChange: setShowPresence }),
                React.createElement(StyledSwitch, { title: "Show Rings", value: showRings, onChange: setShowRings }),
                React.createElement(StyledSwitch, { title: "Show transparent rings", value: transparent, onChange: setTransparent }))),
        React.createElement(react_native_1.View, null,
            React.createElement(StyledSlider, { min: 8, max: 120, initial: 88, onChange: setCoinsize, current: coinSize, step: 8, title: "coinSize" }),
            React.createElement(StyledSlider, { min: 0, max: 8, initial: 4, onChange: setRingThickness, current: ringThickness, title: "ringThickness" }),
            React.createElement(StyledSlider, { min: 0, max: 8, initial: 4, onChange: setInnerGap, current: innerGap, title: "innerGap" }),
            React.createElement(StyledSlider, { min: 0, max: 28, initial: 20, onChange: setIconSize, current: iconSize, step: 4, title: "iconSize" }),
            React.createElement(StyledSlider, { min: 2, max: 8, initial: 4, onChange: setIconStrokeWidth, current: iconStrokeWidth, title: "iconStrokeWidth" }),
            React.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
                React.createElement(StyledTextInput, { placeholder: "Ring glow color", onSubmitEditing: function (e) {
                        setRingColor(e.nativeEvent.text);
                    } }),
                React.createElement(StyledTextInput, { placeholder: "Ring background color", onSubmitEditing: function (e) {
                        setRingBackgroundColor(e.nativeEvent.text);
                    } })),
            React.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
                React.createElement(StyledTextInput, { placeholder: "Background color", onSubmitEditing: function (e) {
                        setCoinColor(e.nativeEvent.text);
                    } }),
                React.createElement(StyledTextInput, { placeholder: "Initials text color", onSubmitEditing: function (e) {
                        setTextColor(e.nativeEvent.text);
                    } })))));
};
exports.CustomizeUsage = CustomizeUsage;
//# sourceMappingURL=CustomizeUsage.mobile.js.map