<UserControl
    x:Class="Pixeval.Controls.TokenInput"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls1="using:Pixeval.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:fluent="using:FluentIcons.WinUI"
    xmlns:labs="using:CommunityToolkit.Labs.WinUI"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <StackPanel
        HorizontalAlignment="Stretch"
        VerticalAlignment="Stretch"
        Spacing="5">
        <labs:TokenView
            HorizontalAlignment="Stretch"
            CanRemoveTokens="True"
            IsWrapped="True"
            ItemsSource="{x:Bind TokenSource, Mode=OneWay}"
            SelectionMode="None">
            <labs:TokenView.ItemTemplate>
                <DataTemplate x:DataType="controls1:Token">
                    <StackPanel
                        Orientation="Horizontal"
                        Spacing="10"
                        ToolTipService.ToolTip="{x:Bind Tooltip, Mode=OneWay}">
                        <TextBlock Text="{x:Bind TokenContent}" />
                        <fluent:SymbolIcon
                            FontSize="{StaticResource SmallIconFontSize}"
                            Symbol="TextChangeCase"
                            Visibility="{x:Bind controls1:C.ToVisibility(CaseSensitive)}" />
                        <fluent:SymbolIcon
                            FontSize="{StaticResource SmallIconFontSize}"
                            Symbol="Code"
                            Visibility="{x:Bind controls1:C.ToVisibility(IsRegularExpression)}" />
                    </StackPanel>
                </DataTemplate>
            </labs:TokenView.ItemTemplate>
        </labs:TokenView>
        <controls1:TokenInputTextBox
            HorizontalAlignment="Stretch"
            PlaceholderText="{x:Bind PlaceholderText, Mode=OneWay}"
            SubmitEnable="True"
            Token="{x:Bind Token, Mode=OneWay}"
            TokenSubmitted="TokenInputTextBox_OnTokenSubmitted" />
    </StackPanel>
</UserControl>
