Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prop setters accessible via ThemeResources #1491

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/styles/TextBox.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ IsDefaultStyle\*: Styles in this column will be set as the default implicit styl
| `FilledTextBoxCharacterSpacing` | `Int32` | `BodyLargeCharacterSpacing` |
| `FilledTextBoxBorderThicknessNormal` | `Double` | `TextBoxOutlinedStrokeHeight` |
| `FilledTextBoxBorderThicknessFocused` | `Double` | `TextBoxFocusStrokeWidth` |
| `FilledTextBoxBorderHeightPointerOver` | `Double` | 2 |
| `MaterialTextBoxClearGlyphWidth` | `Double` | 20 |
| `MaterialTextBoxClearGlyphHeight` | `Double` | 20 |
| `MaterialFilledTextBoxCornerRadius` | `CornerRadius` | 4,4,0,0 |
Expand All @@ -87,3 +88,7 @@ IsDefaultStyle\*: Styles in this column will be set as the default implicit styl
| `MaterialOutlinedTextBoxMinHeight` | `Double` | 56 |
| `MaterialOutlinedTextBoxBorderPadding` | `Thickness` | 1 |
| `MaterialOutlinedTextBoxBorderThicknessFocused` | `Double` | 2 |
| `MaterialOutlinedTextBoxPaddingFocused` | `Thickness` | 0 |
| `MaterialOutlinedTextBoxPaddingPointerOver` | `Thickness` | 0 |
| `MaterialOutlinedTextBoxBorderThicknessPointerOver`| `Double` | 2 |
| `MaterialFilledTextBoxBorderHeightNormal` | `Double` | 1 |
16 changes: 12 additions & 4 deletions src/library/Uno.Material/Styles/Controls/v2/TextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

<StaticResource x:Key="FilledTextBoxDeleteButtonForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<x:Double x:Key="FilledTextBoxBorderHeightPointerOver">2</x:Double>
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundFocused" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />

Expand Down Expand Up @@ -162,6 +163,9 @@
<x:Double x:Key="MaterialOutlinedTextBoxMinHeight">56</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxBorderPadding">1</Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessFocused">2</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxPaddingFocused">0</Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessPointerOver">2</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxPaddingPointerOver">0</Thickness>
<!--#endregion-->
</ResourceDictionary>

Kunal22shah marked this conversation as resolved.
Show resolved Hide resolved
Kunal22shah marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

@agneszitte agneszitte Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand Down Expand Up @@ -191,6 +195,7 @@

<StaticResource x:Key="FilledTextBoxDeleteButtonForeground" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundPointerOver" ResourceKey="OnSurfaceVariantBrush" />
<x:Double x:Key="FilledTextBoxBorderHeightPointerOver">2</x:Double>
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundFocused" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="FilledTextBoxDeleteButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />

Expand Down Expand Up @@ -271,6 +276,9 @@
<x:Double x:Key="MaterialOutlinedTextBoxMinHeight">56</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxBorderPadding">1</Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessFocused">2</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxPaddingFocused">0</Thickness>
<x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessPointerOver">2</x:Double>
<Thickness x:Key="MaterialOutlinedTextBoxPaddingPointerOver">0</Thickness>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
Expand Down Expand Up @@ -366,7 +374,7 @@
<Setter Target="HeaderElement.Foreground" Value="{ThemeResource FilledTextBoxHeaderForegroundPointerOver}" />
<Setter Target="ContentElement.Foreground" Value="{ThemeResource FilledTextBoxForegroundPointerOver}" />
<Setter Target="DeleteButton.Foreground" Value="{ThemeResource FilledTextBoxDeleteButtonForegroundPointerOver}" />
<Setter Target="NormalBorder.Height" Value="2" />
<Setter Target="NormalBorder.Height" Value="{ThemeResource FilledTextBoxBorderHeightPointerOver}" />
</VisualState.Setters>
</VisualState>

Expand Down Expand Up @@ -682,8 +690,8 @@
<Setter Target="ContentElement.Foreground" Value="{ThemeResource OutlinedTextBoxForegroundPointerOver}" />
<Setter Target="PlaceholderElement.Foreground" Value="{ThemeResource OutlinedTextBoxPlaceholderForegroundPointerOver}" />
<Setter Target="HeaderElement.Foreground" Value="{ThemeResource OutlinedTextBoxHeaderForegroundPointerOver}" />
<Setter Target="RootBorder.BorderThickness" Value="2" />
<Setter Target="RootBorder.Padding" Value="0" />
<Setter Target="RootBorder.BorderThickness" Value="{ThemeResource MaterialOutlinedTextBoxBorderThicknessPointerOver}" />
<Setter Target="RootBorder.Padding" Value="{ThemeResource MaterialOutlinedTextBoxPaddingPointerOver}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed" />
Expand All @@ -708,7 +716,7 @@
<Setter Target="PlaceholderElement.Foreground" Value="{ThemeResource OutlinedTextBoxPlaceholderForegroundFocused}" />
<Setter Target="HeaderElement.Foreground" Value="{ThemeResource OutlinedTextBoxHeaderForegroundFocused}" />
<Setter Target="RootBorder.BorderThickness" Value="{ThemeResource MaterialOutlinedTextBoxBorderThicknessFocused}" />
<Setter Target="RootBorder.Padding" Value="0" />
<Setter Target="RootBorder.Padding" Value="{ThemeResource MaterialOutlinedTextBoxPaddingFocused}" />
Comment on lines 716 to +719
Copy link
Contributor

@agneszitte agneszitte Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0, @eriklimakc, @Xiaoy312 please help me remember if there is a particular reason why we have a mismatch of OutlinedTextBox... and MaterialOutlinedTextBox... for the ThemeResources for example here please

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not that i remember of, other than negligence

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that from the very start of the lightweight style, this was already like that. You can see it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a reason for that, not that I recall

Copy link
Contributor

@agneszitte agneszitte Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0, @Xiaoy312, @eriklimakc We have all these resources below starting with "Material" that we will need to review I think then. I just wanted to make sure I did not forget a specific reason why it was kept "Material" in the name.
And I imagine it will be a breaking change as well for the resource's naming with the documentation update.

  • https://github.com/unoplatform/Uno.Themes/blob/master/doc/styles/TextBox.md
  • <!--#region Filled TextBox Style-->
    <CornerRadius x:Key="MaterialFilledTextBoxCornerRadius">4,4,0,0</CornerRadius>
    <macos:Thickness x:Key="MaterialFilledTextBoxPadding">16,7</macos:Thickness>
    <not_macos:Thickness x:Key="MaterialFilledTextBoxPadding">16,8</not_macos:Thickness>
    <x:Double x:Key="MaterialFilledTextBoxMinHeight">58</x:Double>
    <x:Double x:Key="MaterialFilledTextBoxBorderHeightFocused">2</x:Double>
    <!--#endregion-->
    <!--#region Outlined TextBox Style-->
    <x:Double x:Key="MaterialOutlinedTextBoxBorderThickness">1</x:Double>
    <CornerRadius x:Key="MaterialOutlinedTextBoxCornerRadius">4</CornerRadius>
    <macos:Thickness x:Key="MaterialOutlinedTextBoxPadding">16,7,14,7</macos:Thickness>
    <not_macos:Thickness x:Key="MaterialOutlinedTextBoxPadding">16,8</not_macos:Thickness>
    <x:Double x:Key="MaterialOutlinedTextBoxMinHeight">56</x:Double>
    <Thickness x:Key="MaterialOutlinedTextBoxBorderPadding">1</Thickness>
    <x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessFocused">2</x:Double>
    <Thickness x:Key="MaterialOutlinedTextBoxPaddingFocused">0</Thickness>
    <x:Double x:Key="MaterialOutlinedTextBoxBorderThicknessPointerOver">2</x:Double>
    <Thickness x:Key="MaterialOutlinedTextBoxPaddingPointerOver">0</Thickness>
    <!--#endregion-->

Seems we would need to double-check other controls also (maybe on separate PRs for other controls ? so it is easier to follow the adjustments):
https://github.com/search?q=repo%3Aunoplatform%2FUno.Themes+%22%7C+%60Material%22&type=code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kunal22shah, @kazo0 As mentioned by @Xiaoy312, renaming should be carefully reviewed (and normally a breaking change for lightweight styling, so breaking change should be mentioned in the commit message)

</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
Loading