diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Dropdown/BitDropdownTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Dropdown/BitDropdownTests.cs index 209dd0dc9a..3df7d9b18d 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Dropdown/BitDropdownTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Dropdown/BitDropdownTests.cs @@ -999,25 +999,25 @@ public void BitDropdownCaretDownTemplateTest(string iconFragment) } [DataTestMethod, - DataRow(true), - DataRow(false) + DataRow(BitDir.Rtl), + DataRow(BitDir.Ltr) ] - public void BitDropdownIsRtlTest(bool isRtl) + public void BitDropdownDirTest(BitDir dir) { var component = RenderComponent, string>>(parameters => { - parameters.Add(p => p.IsRtl, isRtl); + parameters.Add(p => p.Dir, dir); }); var bitDrp = component.Find(".bit-drp"); - if (isRtl) + if (dir is BitDir.Rtl) { - Assert.IsTrue(bitDrp.ClassList.Contains("bit-drp-rtl")); + Assert.IsTrue(bitDrp.ClassList.Contains("bit-rtl")); } else { - Assert.IsFalse(bitDrp.ClassList.Contains("bit-drp-rtl")); + Assert.IsFalse(bitDrp.ClassList.Contains("bit-rtl")); } } diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor index e53211eca7..7c94b3ea85 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor @@ -11,6 +11,7 @@ id="@_Id" style="@StyleBuilder.Value" class="@ClassBuilder.Value" + dir="@Dir?.ToString().ToLower()" aria-owns="@(IsOpen ? _calloutId : null)"> @if (LabelTemplate is not null) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs index 611e26b0bf..0d6cdc378b 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs @@ -143,22 +143,6 @@ public bool IsRequired [Parameter] public bool IsResponsive { get; set; } - /// - /// Enables the RTL direction for the component. - /// - [Parameter] - public bool IsRtl - { - get => isRtl; - set - { - if (isRtl == value) return; - - isRtl = value; - ClassBuilder.Reset(); - } - } - /// /// The list of items to display in the callout. /// @@ -564,8 +548,6 @@ protected override void RegisterCssClasses() ClassBuilder.Register(() => IsRequired ? $"{RootElementClass}-req" : string.Empty); - ClassBuilder.Register(() => IsRtl ? $"{RootElementClass}-rtl" : string.Empty); - ClassBuilder.Register(() => _selectedItems?.Count > 0 ? $"{RootElementClass}-hvl" : string.Empty); ClassBuilder.Register(() => Chips ? $"{RootElementClass}-sch" : string.Empty); @@ -854,7 +836,7 @@ private async Task ToggleCallout() IsOpen, IsResponsive ? BitResponsiveMode.Panel : BitResponsiveMode.None, DropDirection, - IsRtl, + Dir is BitDir.Rtl, _scrollContainerId, ShowSearchBox && Combo is false ? 32 : 0, CalloutHeaderTemplate is not null ? _headerId : "", diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scss b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scss index 3e93a5290b..1be7ee45c4 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scss +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scss @@ -81,6 +81,26 @@ } } + &.bit-rtl { + .bit-drp-sb { + padding: spacing(0.125) spacing(1) spacing(0.125) 0; + } + + .bit-drp-tcn { + padding-left: 0; + padding-right: spacing(1); + } + + .bit-drp-cls { + margin-left: unset; + margin-right: auto; + } + + .bit-drp-rsp { + animation-name: bit-fade-show, bit-drp-trans-x-reverse; + } + } + @keyframes bit-drp-trans-x { 0% { pointer-events: none; @@ -665,8 +685,8 @@ display: flex; cursor: pointer; overflow: hidden; - text-align: left; font-weight: 400; + text-align: start; user-select: none; position: relative; white-space: nowrap; @@ -777,25 +797,3 @@ justify-content: space-between; } } - -.bit-drp-rtl { - direction: rtl; - - .bit-drp-sb { - padding: spacing(0.125) spacing(1) spacing(0.125) 0; - } - - .bit-drp-tcn { - padding-left: 0; - padding-right: spacing(1); - } - - .bit-drp-cls { - margin-left: unset; - margin-right: auto; - } - - .bit-drp-rsp { - animation-name: bit-fade-show, bit-drp-trans-x-reverse; - } -} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cs index f2a66bea02..fef90cf224 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cs @@ -138,13 +138,6 @@ public partial class BitDropdownDemo Description = "Enables the responsive mode of the component for small screens.", }, new() - { - Name = "IsRtl", - Type = "bool", - DefaultValue = "false", - Description = "Enables the RTL direction for the component.", - }, - new() { Name = "Items", Type = "ICollection?", diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor index 51f39234c5..12c9187605 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor @@ -381,14 +381,14 @@ Items="GetRtlCustoms()" NameSelectors="nameSelectors" Placeholder="لطفا انتخاب کنید" - IsRtl="true" /> + Dir="BitDir.Rtl" /> + Dir="BitDir.Rtl" /> diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs index ef88f5afae..caa8eac3b5 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownCustomDemo.razor.samples.cs @@ -722,14 +722,14 @@ public class BitDropdownCustom Items=""GetRtlCustoms()"" NameSelectors=""nameSelectors"" Placeholder=""لطفا انتخاب کنید"" - IsRtl=""true"" /> + Dir=""BitDir.Rtl"" /> "; + Dir=""BitDir.Rtl"" />"; private readonly string example9CsharpCode = @" public class BitDropdownCustom { diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor index 4961116575..4369343a25 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor @@ -373,14 +373,14 @@ Items="GetRtlItems()" DefaultValue="@string.Empty" Placeholder="لطفا انتخاب کنید" - IsRtl="true" /> + Dir="BitDir.Rtl" /> + Dir="BitDir.Rtl" /> diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs index 37effaf9f4..f59d83fb00 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs @@ -494,14 +494,14 @@ Combo Chips Dynamic Items=""GetRtlItems()"" DefaultValue=""@string.Empty"" Placeholder=""لطفا انتخاب کنید"" - IsRtl=""true"" /> + Dir=""BitDir.Rtl"" /> "; + Dir=""BitDir.Rtl"" />"; private readonly string example9CsharpCode = @" private List> GetRtlItems() => new() { diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor index c51dd98483..3b9a46017e 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor @@ -537,7 +537,7 @@
@foreach (var item in rtlItems) { @@ -548,7 +548,7 @@ @foreach (var item in rtlItems) { diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs index 0834e3876d..9c083ffd76 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor.samples.cs @@ -646,7 +646,7 @@ private void HandleOnDynamicAdd(BitDropdownOption item) private readonly string example9RazorCode = @" "" TValue=""string""> @foreach (var item in rtlItems) { @@ -657,7 +657,7 @@ private void HandleOnDynamicAdd(BitDropdownOption item) "" TValue=""string""> @foreach (var item in rtlItems) {