import { __assign } from "tslib";
import * as React from 'react';
import { Text as TextRN, View } from 'react-native';
import { StyleSheet } from 'react-native';
import { Text } from '@fluentui/react-native';
import { useFluentTheme } from '@fluentui-react-native/framework';
import { themedStyleSheet } from '@fluentui-react-native/themed-stylesheet';
import { THEME_TESTPAGE } from '../../../../E2E/src/Theme/consts';
import { commonTestStyles } from '../Common/styles';
import { Test } from '../Test';
var getThemedStyles = themedStyleSheet(function (theme) {
    return {
        swatch: {
            color: theme.colors.neutralForeground1,
        },
        rootView: {
            backgroundColor: theme.colors.brandBackground,
        },
    };
});
var styles = StyleSheet.create({
    swatchItem: {
        flexDirection: 'row',
        alignItems: 'center',
        marginVertical: 5,
    },
    panel: __assign(__assign({}, commonTestStyles.view), { borderWidth: 2, padding: 12, margin: 8 }),
    pickerContainer: {
        flexDirection: 'row',
        justifyContent: 'space-evenly',
    },
    stackStyle: {
        borderWidth: 2,
        padding: 12,
        margin: 8,
    },
});
var Panel = function () {
    var theme = useFluentTheme();
    var themedStyles = getThemedStyles(theme);
    return (React.createElement(View, null,
        React.createElement(Text, { style: { color: theme.colors.buttonBackgroundChecked } }, "buttonBackgroundChecked styled text"),
        React.createElement(Text, { style: { color: theme.colors.neutralForeground1 } }, "neutralForeground1 styled text"),
        React.createElement(Text, { style: { color: theme.colors.hostColorPink } }, "hostColorPink styled text"),
        React.createElement(Text, { style: { color: theme.colors.hostColorButtonBackground } }, "hostColorButtonBackground styled text"),
        React.createElement(Text, { style: { color: theme.colors.hostColorBrandText } }, "hostColorBrandText styled text"),
        React.createElement(TextRN, { style: { color: theme.colors.yellowBrandColor } }, "yellowBrandColor styled text"),
        React.createElement(TextRN, { style: themedStyles.swatch }, "Styled RN Text")));
};
var getSwatchColorStyle = function (name, color) {
    styles[name] = styles[name] || { backgroundColor: color };
    return styles[name];
};
var SemanticColor = function (p) {
    var themedStyles = getThemedStyles(useFluentTheme());
    return (React.createElement(View, { style: styles.swatchItem },
        React.createElement(View, { style: [getSwatchColorStyle(p.name, p.color), themedStyles.swatch] }),
        React.createElement(Text, null, p.name)));
};
var SwatchList = function () {
    var theme = useFluentTheme();
    var palette = theme.colors;
    var aggregator = React.useCallback(function (key) {
        return { key: key + ' (' + palette[key] + ')', color: palette[key] };
    }, [palette]);
    var flattenArray = React.useCallback(function () {
        return Object.keys(palette).sort().map(aggregator);
    }, [palette, aggregator]);
    var paletteAsArray = React.useMemo(flattenArray, [flattenArray]);
    var renderSwatch = React.useCallback(function (item) {
        var color = item.color, key = item.key;
        return React.createElement(SemanticColor, { key: key, color: color, name: key });
    }, []);
    return (React.createElement(View, { style: commonTestStyles.view },
        React.createElement(Text, null, "getColorsAndroid(theme: ITheme).palette"),
        React.createElement(View, { style: styles.stackStyle }, paletteAsArray.map(function (item) { return renderSwatch(item); }))));
};
var themeSections = [
    {
        name: 'Component Examples',
        testID: THEME_TESTPAGE,
        component: Panel,
    },
    {
        name: 'Theme.colors',
        component: function () { return React.createElement(SwatchList, null); },
    },
];
export var ThemeTest = function () {
    var status = {
        win32Status: 'Beta',
        uwpStatus: 'Experimental',
        iosStatus: 'Experimental',
        macosStatus: 'Experimental',
        androidStatus: 'Beta',
    };
    var description = 'The entire color palette of the controls is themeable. We provide a set of sensible defaults, but you can override all colors individually.';
    return React.createElement(Test, { name: "Theme Test", description: description, sections: themeSections, status: status });
};
//# sourceMappingURL=ThemeTest.android.js.map