import * as React from 'react';
import { View, Switch } from 'react-native';
import { SPINNER_TESTPAGE } from '@fluentui-react-native/e2e-testing';
import { Spinner } from '@fluentui-react-native/spinner';
import { Stack } from '@fluentui-react-native/stack';
import { Text, TextV1 } from '@fluentui-react-native/text';
import { E2ETestingSpinner } from './SpinnerE2ETest';
import { stackStyle, commonTestStyles as commonStyles, commonTestStyles } from '../Common/styles';
import { Test } from '../Test';
const BasicSpinnerTest = () => {
    const [status, setStatus] = React.useState('active');
    const [hidesWhenStopped, setHidesWhenStopped] = React.useState(true);
    return (React.createElement(Stack, { style: stackStyle },
        React.createElement(View, { style: commonStyles.root },
            React.createElement(View, { style: commonStyles.settings },
                React.createElement(View, { style: commonStyles.switch },
                    React.createElement(Text, null, "Animating"),
                    React.createElement(Switch, { value: status === 'active', onValueChange: (value) => {
                            value ? setStatus('active') : setStatus('inactive');
                        } })),
                React.createElement(View, { style: commonStyles.switch },
                    React.createElement(Text, null, "HidesWhenStopped"),
                    React.createElement(Switch, { value: hidesWhenStopped, onValueChange: setHidesWhenStopped }))),
            React.createElement(Spinner, { status: status, hidesWhenStopped: hidesWhenStopped }))));
};
const CustomisedSpinner = Spinner.customize({
    trackColor: 'red',
    size: 'medium',
});
const SpinnerSizeTest = () => {
    const memoizedStyles = React.useMemo(() => ({ ...commonTestStyles.androidContainer, height: 250 }), []);
    return (React.createElement(Stack, { style: stackStyle },
        React.createElement(View, { style: memoizedStyles },
            React.createElement(View, null,
                React.createElement(TextV1, null, "xx-small"),
                React.createElement(Spinner, { size: "xx-small" })),
            React.createElement(View, null,
                React.createElement(TextV1, null, "x-small"),
                React.createElement(Spinner, { size: "x-small" })),
            React.createElement(View, null,
                React.createElement(TextV1, null, "medium"),
                React.createElement(Spinner, { size: "medium" })),
            React.createElement(View, null,
                React.createElement(TextV1, null, "large"),
                React.createElement(Spinner, { size: "large" })),
            React.createElement(View, null,
                React.createElement(TextV1, null, "x-large"),
                React.createElement(Spinner, { size: "x-large" })))));
};
const spinnerSections = [
    {
        name: 'Basic Spinner',
        testID: SPINNER_TESTPAGE,
        component: BasicSpinnerTest,
    },
    {
        name: 'Spinner Size Test',
        component: SpinnerSizeTest,
    },
    {
        name: 'Customized Spinner Test',
        component: () => React.createElement(CustomisedSpinner, null),
    },
    {
        name: 'Spinner for E2E Testing',
        component: () => React.createElement(E2ETestingSpinner, null),
    },
];
export const SpinnerTest = () => {
    const status = {
        win32Status: 'Production',
        uwpStatus: 'Backlog',
        iosStatus: 'Production',
        macosStatus: 'Production',
        androidStatus: 'Production',
    };
    const description = 'Spinner is a visual representation that data is being loaded. It is implemented with a View wrapping an Animated SVG. The View is to ensure that AccessibilityRole works. AccessibilityRole currently does not work on SVGs.';
    return React.createElement(Test, { name: "Spinner Test", description: description, sections: spinnerSections, status: status });
};
//# sourceMappingURL=SpinnerTest.js.map