Skip to content

Commit

Permalink
fix(chip): remove check-glyph
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoy312 committed Jan 11, 2024
1 parent ad60f28 commit f154714
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 62 deletions.
2 changes: 0 additions & 2 deletions doc/controls/ChipAndChipGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ xmlns:utu="using:Uno.Toolkit.UI"

Key|Type|Value
-|-|-
ChipCheckGlyphSize|Double|20
ChipContentMinHeight|Double|20
ChipDeleteIconContainerLength|Double|18
ChipDeleteIconLength|Double|11
Expand All @@ -103,7 +102,6 @@ ChipIconSize|Double|18
ChipSize|Double|12
ChipCornerRadius|CornerRadius|8
ChipBorderThickness|Thickness|1
ChipCheckGlyphPadding|Thickness|2
ChipContentMargin|Thickness|8,0
ChipElevationBorderThickness|Thickness|0
ChipElevationMargin|Thickness|4
Expand Down
27 changes: 1 addition & 26 deletions src/Uno.Toolkit.UI/Controls/Chips/Chip.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<x:Double x:Key="ChipCheckGlyphSize">20</x:Double>
<x:Double x:Key="ChipContentMinHeight">20</x:Double>
<x:Double x:Key="ChipDeleteIconContainerLength">18</x:Double>
<x:Double x:Key="ChipDeleteIconLength">11</x:Double>
Expand All @@ -23,7 +22,6 @@

<CornerRadius x:Key="ChipCornerRadius">2</CornerRadius>
<Thickness x:Key="ChipBorderThickness">1</Thickness>
<Thickness x:Key="ChipCheckGlyphPadding">2</Thickness>
<Thickness x:Key="ChipContentMargin">8,0</Thickness>
<Thickness x:Key="ChipElevationMargin">4</Thickness>
<Thickness x:Key="ChipPadding">8,0</Thickness>
Expand Down Expand Up @@ -90,7 +88,6 @@
</ResourceDictionary>

<ResourceDictionary x:Key="Light">
<x:Double x:Key="ChipCheckGlyphSize">20</x:Double>
<x:Double x:Key="ChipContentMinHeight">20</x:Double>
<x:Double x:Key="ChipDeleteIconContainerLength">18</x:Double>
<x:Double x:Key="ChipDeleteIconLength">11</x:Double>
Expand All @@ -102,7 +99,6 @@

<CornerRadius x:Key="ChipCornerRadius">2</CornerRadius>
<Thickness x:Key="ChipBorderThickness">1</Thickness>
<Thickness x:Key="ChipCheckGlyphPadding">2</Thickness>
<Thickness x:Key="ChipContentMargin">8,0</Thickness>
<Thickness x:Key="ChipElevationMargin">4</Thickness>
<Thickness x:Key="ChipPadding">8,0</Thickness>
Expand Down Expand Up @@ -170,7 +166,6 @@
</ResourceDictionary.ThemeDictionaries>

<x:String x:Key="ChipDeleteIcon">M11.25 1.8075L10.1925 0.75L6 4.9425L1.8075 0.75L0.75 1.8075L4.9425 6L0.75 10.1925L1.8075 11.25L6 7.0575L10.1925 11.25L11.25 10.1925L7.0575 6L11.25 1.8075Z</x:String>
<x:String x:Key="CheckGlyphPathData">M28.718018,0L32,3.2819897 10.666016,24.616999 0,13.951997 3.2810059,10.670007 10.666016,18.055033z</x:String>

<Style x:Key="ChipDeleteIconButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{ThemeResource ChipDeleteIconForeground}" />
Expand Down Expand Up @@ -242,7 +237,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!--
C0: Leading Icon / Check Glyph
C0: Leading Icon
fixme: ContentControl/Presenter template-binding to icon would crash on uwp
-->
<ContentPresenter
Expand All @@ -257,23 +252,6 @@
Foreground="{ThemeResource ChipIconForeground}"
Visibility="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource NullToCollapsed}, FallbackValue=Collapsed}" />

<Grid
x:Name="CheckGlyphElement"
Grid.Column="0"
Width="{ThemeResource ChipCheckGlyphSize}"
Height="{ThemeResource ChipCheckGlyphSize}"
Padding="{ThemeResource ChipCheckGlyphPadding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Visibility="Collapsed">
<Path
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Data="{StaticResource CheckGlyphPathData}"
Fill="{TemplateBinding Foreground}"
Stretch="Uniform"
Visibility="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource NullToVisible}, FallbackValue=Collapsed}" />
</Grid>
<!-- C1: Content -->
<ContentPresenter
x:Name="ContentPresenter"
Expand Down Expand Up @@ -336,7 +314,6 @@
<Setter Target="StateOverlay.Background" Value="{ThemeResource ChipStateOverlayChecked}" />
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ChipForegroundChecked}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ChipIconForegroundChecked}" />
<Setter Target="CheckGlyphElement.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="CheckedPointerOver">
Expand All @@ -346,7 +323,6 @@
<Setter Target="StateOverlay.Background" Value="{ThemeResource ChipStateOverlayCheckedPointerOver}" />
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ChipForegroundCheckedPointerOver}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ChipIconForegroundCheckedPointerOver}" />
<Setter Target="CheckGlyphElement.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="CheckedPressed">
Expand All @@ -356,7 +332,6 @@
<Setter Target="StateOverlay.Background" Value="{ThemeResource ChipStateOverlayCheckedPressed}" />
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ChipForegroundCheckedPressed}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ChipIconForegroundCheckedPressed}" />
<Setter Target="CheckGlyphElement.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
26 changes: 1 addition & 25 deletions src/library/Uno.Toolkit.Material/Styles/Controls/v2/Chip.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<x:Double x:Key="ChipCheckGlyphSize">20</x:Double>
<x:Double x:Key="ChipContentMinHeight">20</x:Double>
<x:Double x:Key="ChipDeleteIconContainerLength">18</x:Double>
<x:Double x:Key="ChipDeleteIconLength">11</x:Double>
Expand All @@ -23,7 +22,6 @@

<CornerRadius x:Key="ChipCornerRadius">8</CornerRadius>
<Thickness x:Key="ChipBorderThickness">1</Thickness>
<Thickness x:Key="ChipCheckGlyphPadding">2</Thickness>
<Thickness x:Key="ChipContentMargin">8,0</Thickness>
<Thickness x:Key="ChipElevationBorderThickness">0</Thickness>
<Thickness x:Key="ChipElevationMargin">4</Thickness>
Expand Down Expand Up @@ -148,7 +146,6 @@
</ResourceDictionary>

<ResourceDictionary x:Key="Light">
<x:Double x:Key="ChipCheckGlyphSize">20</x:Double>
<x:Double x:Key="ChipContentMinHeight">20</x:Double>
<x:Double x:Key="ChipDeleteIconContainerLength">18</x:Double>
<x:Double x:Key="ChipDeleteIconLength">11</x:Double>
Expand All @@ -160,7 +157,6 @@

<CornerRadius x:Key="ChipCornerRadius">8</CornerRadius>
<Thickness x:Key="ChipBorderThickness">1</Thickness>
<Thickness x:Key="ChipCheckGlyphPadding">2</Thickness>
<Thickness x:Key="ChipContentMargin">8,0</Thickness>
<Thickness x:Key="ChipElevationBorderThickness">0</Thickness>
<Thickness x:Key="ChipElevationMargin">4</Thickness>
Expand Down Expand Up @@ -286,7 +282,6 @@
</ResourceDictionary.ThemeDictionaries>

<x:String x:Key="MaterialChipDeleteIcon">M11.25 1.8075L10.1925 0.75L6 4.9425L1.8075 0.75L0.75 1.8075L4.9425 6L0.75 10.1925L1.8075 11.25L6 7.0575L10.1925 11.25L11.25 10.1925L7.0575 6L11.25 1.8075Z</x:String>
<x:String x:Key="MaterialCheckGlyphPathData">M28.718018,0L32,3.2819897 10.666016,24.616999 0,13.951997 3.2810059,10.670007 10.666016,18.055033z</x:String>

<Style x:Key="MaterialChipDeleteIconButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{ThemeResource ChipDeleteIconForeground}" />
Expand Down Expand Up @@ -357,7 +352,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<!-- C0: Leading Icon / Check Glyph -->
<!-- C0: Leading Icon -->
<!-- fixme: ContentControl/Presenter template-binding to icon would crash on uwp -->
<ContentPresenter x:Name="IconPresenter"
Grid.Column="0"
Expand All @@ -370,22 +365,6 @@
Foreground="{ThemeResource ChipIconForeground}"
Visibility="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource MaterialNullToCollapsedConverter}, FallbackValue=Collapsed}" />

<Grid x:Name="CheckGlyphElement"
Grid.Column="0"
Width="{ThemeResource ChipCheckGlyphSize}"
Height="{ThemeResource ChipCheckGlyphSize}"
Padding="{ThemeResource ChipCheckGlyphPadding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Visibility="Collapsed">
<Path HorizontalAlignment="Center"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Data="{StaticResource MaterialCheckGlyphPathData}"
Fill="{TemplateBinding Foreground}"
Stretch="Uniform"
Visibility="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource MaterialEmptyOrNullToVisible}, FallbackValue=Collapsed}" />
</Grid>

<!-- C1: Content -->
<ContentPresenter x:Name="ContentPresenter"
Grid.Column="1"
Expand Down Expand Up @@ -449,7 +428,6 @@
<Setter Target="StateOverlay.Background" Value="{ThemeResource ChipStateOverlayChecked}" />
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ChipForegroundChecked}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ChipIconForegroundChecked}" />
<Setter Target="CheckGlyphElement.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="CheckedPointerOver">
Expand All @@ -459,7 +437,6 @@
<Setter Target="StateOverlay.Background" Value="{ThemeResource ChipStateOverlayCheckedPointerOver}" />
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ChipForegroundCheckedPointerOver}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ChipIconForegroundCheckedPointerOver}" />
<Setter Target="CheckGlyphElement.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="CheckedPressed">
Expand All @@ -469,7 +446,6 @@
<Setter Target="StateOverlay.Background" Value="{ThemeResource ChipStateOverlayCheckedPressed}" />
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource ChipForegroundCheckedPressed}" />
<Setter Target="IconPresenter.Foreground" Value="{ThemeResource ChipIconForegroundCheckedPressed}" />
<Setter Target="CheckGlyphElement.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
9 changes: 0 additions & 9 deletions src/library/Uno.Toolkit.WinUI.Markup/Theme/Chip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,6 @@ public static partial class Foreground
public static ThemeResourceKey<Brush> CheckedDisabled => new("ChipForegroundCheckedDisabled");
}

public static partial class CheckGlyph
{
[ResourceKeyDefinition(typeof(Thickness), "ChipCheckGlyphPadding")]
public static ThemeResourceKey<Thickness> Padding => new("ChipCheckGlyphPadding");

[ResourceKeyDefinition(typeof(double), "ChipCheckGlyphSize")]
public static ThemeResourceKey<double> Size => new("ChipCheckGlyphSize");
}

public static partial class Icon
{
public static partial class Foreground
Expand Down

0 comments on commit f154714

Please sign in to comment.