"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SwitchTest = void 0;
const React = __importStar(require("react"));
const react_native_1 = require("react-native");
const react_native_2 = require("react-native");
const button_1 = require("@fluentui-react-native/button");
const e2e_testing_1 = require("@fluentui-react-native/e2e-testing");
const switch_1 = require("@fluentui-react-native/switch");
const CustomizedSwitch_1 = require("./CustomizedSwitch");
const E2ESwitchTest_1 = require("./E2ESwitchTest");
const styles_1 = require("../Common/styles");
const Test_1 = require("../Test");
const styles = react_native_1.StyleSheet.create({
    square: {
        backgroundColor: 'red',
        width: 100,
        height: 100,
    },
});
const StandardUsage = () => {
    const memoizedStyles = React.useMemo(() => (react_native_2.Platform.OS === 'android' ? { ...styles_1.commonTestStyles.androidContainer, height: 180 } : styles_1.commonTestStyles.settingsPicker), []);
    return (React.createElement(react_native_1.View, { style: memoizedStyles },
        React.createElement(switch_1.Switch, { defaultChecked: true, label: 'Default Checked True' }),
        React.createElement(switch_1.Switch, { defaultChecked: false, label: 'Default Checked False' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, label: 'Disabled Default Checked True', disabled: true }),
        React.createElement(switch_1.Switch, { defaultChecked: false, label: 'Disabled Default Checked False', disabled: true })));
};
const OnChangeUsage = () => {
    const [displaySquare, setDisplaySquare] = React.useState(true);
    const defaultToggleSquare = (_e, checked) => {
        setDisplaySquare(checked);
    };
    const memoizedStyles = React.useMemo(() => (react_native_2.Platform.OS === 'android' ? { ...styles_1.commonTestStyles.androidContainer, height: 150 } : styles_1.commonTestStyles.settingsPicker), []);
    return (React.createElement(react_native_1.View, { style: memoizedStyles },
        React.createElement(switch_1.Switch, { label: 'Toggle Square', defaultChecked: true, onChange: defaultToggleSquare }),
        displaySquare && React.createElement(react_native_1.View, { style: styles.square })));
};
const ControlSwitchValues = () => {
    const [toggleSwitch, setToggleSwitch] = React.useState(true);
    const toggleSwitchTrue = () => {
        setToggleSwitch(true);
    };
    const toggleSwitchFalse = () => {
        setToggleSwitch(false);
    };
    const memoizedStyles = React.useMemo(() => (react_native_2.Platform.OS === 'android' ? { ...styles_1.commonTestStyles.androidContainer, height: 150 } : styles_1.commonTestStyles.settingsPicker), []);
    return (React.createElement(react_native_1.View, { style: memoizedStyles },
        React.createElement(button_1.ButtonV1, { onClick: toggleSwitchTrue }, "Toggle Switch True"),
        React.createElement(button_1.ButtonV1, { onClick: toggleSwitchFalse }, "Toggle Switch False"),
        React.createElement(switch_1.Switch, { label: 'Switch Value Being Controlled', checked: toggleSwitch })));
};
const LabelPosition = () => {
    return (React.createElement(react_native_1.View, { style: styles_1.commonTestStyles.settingsPicker },
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'before', label: 'before' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'after', label: 'after' }),
        react_native_2.Platform.OS !== 'android' && React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'above', label: 'above' })));
};
const OnOffText = () => {
    return (React.createElement(react_native_1.View, { style: styles_1.commonTestStyles.settingsPicker },
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'before', label: 'Autosave', onText: 'On', offText: 'Off' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'above', label: 'Autosave', onText: 'On', offText: 'Off' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'after', label: 'Autosave', onText: 'On', offText: 'Off' })));
};
const toggleSections = [
    {
        name: 'Standard Usage',
        testID: e2e_testing_1.SWITCH_TESTPAGE,
        component: () => React.createElement(StandardUsage, null),
    },
    {
        name: 'onChange Usage',
        component: () => React.createElement(OnChangeUsage, null),
    },
    {
        name: 'Control Switch Values',
        component: () => React.createElement(ControlSwitchValues, null),
    },
    react_native_2.Platform.select({
        android: null,
        default: {
            name: 'Label Position',
            component: () => React.createElement(LabelPosition, null),
        },
    }),
    react_native_2.Platform.select({
        android: null,
        default: {
            name: 'On/Off Text',
            component: () => React.createElement(OnOffText, null),
        },
    }),
    react_native_2.Platform.select({
        android: null,
        default: {
            name: 'Customized Tokens',
            component: () => React.createElement(CustomizedSwitch_1.CustomizedSwitch, null),
        },
    }),
];
const e2eSections = [
    {
        name: 'Switch E2E Testing',
        component: E2ESwitchTest_1.E2ESwitchTest,
    },
];
const SwitchTest = () => {
    const status = {
        win32Status: 'Production',
        uwpStatus: 'Backlog',
        iosStatus: 'Production',
        macosStatus: 'Production',
        androidStatus: 'Production',
    };
    const description = 'Switch is a control that has two mutually exclusive states.';
    const spec = 'https://github.com/microsoft/fluentui-react-native/blob/main/packages/components/Switch/SPEC.md';
    return (React.createElement(Test_1.Test, { name: "Switch Test", description: description, spec: spec, sections: toggleSections, status: status, e2eSections: e2eSections }));
};
exports.SwitchTest = SwitchTest;
//# sourceMappingURL=SwitchTest.js.map