import * as React from 'react';
import { Alert, View, StyleSheet, Text, TextInput } from 'react-native';
import { Platform } from 'react-native';
import { LinkV1 as Link } from '@fluentui/react-native';
import { Stack } from '@fluentui-react-native/stack';
import { E2ELinkV1Test } from './E2ELinkV1Test';
import { InlineLinks } from './InlineLinksTest';
import { LINKV1_TESTPAGE } from '../../../../E2E/src/LinkV1/consts';
import { stackStyle, commonTestStyles as commonStyles } from '../Common/styles';
import { Test } from '../Test';
var DefaultLinks = function () {
    var doPress = React.useCallback(function () { return Alert.alert('Alert.', 'You have been alerted.'); }, []);
    var doAllyTap = React.useCallback(function () { return Alert.alert('Alert.', 'You have invoked onAllyTap.'); }, []);
    return (React.createElement(Stack, { style: stackStyle },
        React.createElement(Link, { tooltip: 'https://www.bing.com/', url: "https://www.bing.com/" }, "Click to navigate."),
        React.createElement(Link, { onPress: doPress, onAccessibilityTap: doAllyTap }, "Click to alert."),
        React.createElement(Link, { disabled: true }, "Disabled Link")));
};
var SubtleLinks = function () {
    var doPress = React.useCallback(function () { return Alert.alert('Alert.', 'You have been alerted.'); }, []);
    var doAllyTap = React.useCallback(function () { return Alert.alert('Alert.', 'You have invoked onAllyTap.'); }, []);
    var supportsInlineLink = Platform.OS !== 'win32';
    return (React.createElement(Stack, { style: stackStyle },
        React.createElement(Link, { appearance: "subtle", url: "https://www.bing.com/" }, "Click to navigate."),
        supportsInlineLink && (React.createElement(Text, null,
            "This is inline Link.",
            ' ',
            React.createElement(Link, { appearance: "subtle", inline: true, onPress: doPress, onAccessibilityTap: doAllyTap }, "Click to alert."))),
        React.createElement(Link, { appearance: "subtle", onPress: doPress, disabled: true }, "Disabled Link")));
};
var styles = StyleSheet.create({
    tokensRow: {
        flexDirection: 'row',
        marginBottom: 10,
    },
    tokensColumn: {
        flexDirection: 'column',
        margin: 10,
    },
});
var BlueHeaderBold = Link.customize({ variant: 'headerStandard', fontWeight: '700', color: '#0229c4', textAlign: 'right' });
var CustomLinks = function () {
    var _a = React.useState('blue'), linkColor = _a[0], setLinkColor = _a[1];
    var _b = React.useState('Ariel'), linkFont = _b[0], setLinkFont = _b[1];
    var _c = React.useState(12), linkFontSize = _c[0], setLinkFontSize = _c[1];
    var _d = React.useState('Click to Navigate'), linkText = _d[0], setLinkText = _d[1];
    var _e = React.useState('https://www.bing.com/'), linkUrl = _e[0], setLinkUrl = _e[1];
    var CustomLink = React.useMemo(function () {
        var tokens = {
            color: linkColor,
            fontFamily: linkFont,
            fontSize: linkFontSize,
        };
        return Link.customize(tokens);
    }, [linkColor, linkFont, linkFontSize]);
    return (React.createElement(View, { style: styles.tokensColumn },
        React.createElement(View, { style: styles.tokensRow },
            React.createElement(View, null,
                React.createElement(Text, null, "Text Tokens"),
                React.createElement(TextInput, { accessibilityLabel: "Link color", style: commonStyles.textBox, placeholder: "Link color", blurOnSubmit: true, onSubmitEditing: function (e) {
                        setLinkColor(e.nativeEvent.text);
                    } }),
                React.createElement(TextInput, { accessibilityLabel: "Link font", style: commonStyles.textBox, placeholder: "Link font", blurOnSubmit: true, onSubmitEditing: function (e) {
                        setLinkFont(e.nativeEvent.text);
                    } }),
                React.createElement(TextInput, { accessibilityLabel: "Link font size", style: commonStyles.textBox, placeholder: "Link font size", blurOnSubmit: true, onSubmitEditing: function (e) {
                        setLinkFontSize(parseInt(e.nativeEvent.text));
                    } })),
            React.createElement(View, null,
                React.createElement(Text, null, "Content and URL customize"),
                React.createElement(TextInput, { accessibilityLabel: "Link text", style: commonStyles.textBox, placeholder: "Link text", blurOnSubmit: true, onSubmitEditing: function (e) {
                        setLinkText(e.nativeEvent.text);
                    } }),
                React.createElement(TextInput, { accessibilityLabel: "Link Url", style: commonStyles.textBox, placeholder: "Link URL", blurOnSubmit: true, onSubmitEditing: function (e) {
                        setLinkUrl(e.nativeEvent.text);
                    } }))),
        React.createElement(CustomLink, { align: "end", url: linkUrl }, linkText),
        React.createElement(BlueHeaderBold, null, "BlueHeaderBold")));
};
var linkSections = [
    {
        name: 'Default Links',
        testID: LINKV1_TESTPAGE,
        component: DefaultLinks,
    },
    {
        name: 'Inline Links',
        component: InlineLinks,
    },
    Platform.select({
        // As per design discussion, there is no use case for subtle link on Android, no tokens available for the same.
        android: null,
        default: {
            name: 'Subtle Links',
            component: SubtleLinks,
        },
    }),
    Platform.select({
        android: null,
        default: {
            name: 'Custom Link',
            component: CustomLinks,
        },
    }),
];
var e2eSections = [
    {
        name: 'Link E2E Test',
        component: E2ELinkV1Test,
    },
];
export var LinkV1Test = function () {
    var status = {
        win32Status: 'Production',
        uwpStatus: 'Backlog',
        iosStatus: 'Production',
        macosStatus: 'Production',
        androidStatus: 'Production',
    };
    var description = 'With a Link, users can navigate to another page, window, or Help topic; display a definition; initiate a command; or choose an option. A Link indicates that it can be clicked, typically by being displayed using the visited or unvisited link system colors. Traditionally, Links are underlined as well, but that approach is often unnecessary and falling out of favor to reduce visual clutter.\n\nA Link is the lightest weight clickable control, and is often used to reduce the visual complexity of a design.';
    return React.createElement(Test, { name: "LinkV1 Test", description: description, sections: linkSections, status: status, e2eSections: e2eSections });
};
//# sourceMappingURL=LinkV1Test.js.map