Skip to content

Commit 00d6ae1

Browse files
committed
Update nimble-select, nimble-combobox, nimble-text-area, nimble-number-field, and nimble-text-field to support appearance-readonly and full-bleed
1 parent 7cc8c70 commit 00d6ae1

17 files changed

+135
-2
lines changed

packages/blazor-workspace/NimbleBlazor/Components/NimbleCombobox.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
error-text="@ErrorText"
1313
error-visible="@ErrorVisible"
1414
required-visible="@RequiredVisible"
15+
appearance-readonly="@AppearanceReadOnly"
16+
full-bleed="@FullBleed"
1517
@attributes="AdditionalAttributes">
1618
@ChildContent
1719
</nimble-combobox>

packages/blazor-workspace/NimbleBlazor/Components/NimbleCombobox.razor.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ public partial class NimbleCombobox : NimbleInputBase<string?>
6363
[Parameter]
6464
public bool? RequiredVisible { get; set; }
6565

66+
/// <summary>
67+
/// Gets or set whether or not the combobox should be rendered as
68+
/// read only when it is disabled.
69+
/// </summary>
70+
[Parameter]
71+
public bool? AppearanceReadOnly { get; set; }
72+
73+
/// <summary>
74+
/// Gets or set whether or not the start and end margins of the control are removed.
75+
/// This only applies when the <see cref="Appearance"/> is <see cref="DropdownAppearance.Frameless"/>.
76+
/// </summary>
77+
[Parameter]
78+
public bool? FullBleed { get; set; }
79+
6680
/// <summary>
6781
/// Gets or sets the child content to be rendered inside the combobox
6882
/// </summary>

packages/blazor-workspace/NimbleBlazor/Components/NimbleNumberField.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
error-text="@ErrorText"
1515
error-visible="@ErrorVisible"
1616
required-visible="@RequiredVisible"
17+
appearance-readonly="@AppearanceReadOnly"
18+
full-bleed="@FullBleed"
1719
@attributes="AdditionalAttributes">
1820
@ChildContent
1921
</nimble-number-field>

packages/blazor-workspace/NimbleBlazor/Components/NimbleNumberField.razor.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ public partial class NimbleNumberField : NimbleInputBase<double?>
7878
[Parameter]
7979
public bool? RequiredVisible { get; set; }
8080

81+
/// <summary>
82+
/// Gets or set whether or not the number field should be rendered as
83+
/// read only when it is disabled.
84+
/// </summary>
85+
[Parameter]
86+
public bool? AppearanceReadOnly { get; set; }
87+
88+
/// <summary>
89+
/// Gets or set whether or not the start and end margins of the control are removed.
90+
/// This only applies when the <see cref="Appearance"/> is <see cref="NumberFieldAppearance.Frameless"/>.
91+
/// </summary>
92+
[Parameter]
93+
public bool? FullBleed { get; set; }
94+
8195
/// <summary>
8296
/// Gets or sets the child content to be rendered inside the combobox
8397
/// </summary>

packages/blazor-workspace/NimbleBlazor/Components/NimbleSelect.razor

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
error-text="@ErrorText"
1414
error-visible="@ErrorVisible"
1515
required-visible="@RequiredVisible"
16+
appearance-readonly="@AppearanceReadOnly"
17+
full-bleed="@FullBleed"
1618
@attributes="AdditionalAttributes">
1719
@ChildContent
1820
</nimble-select>

packages/blazor-workspace/NimbleBlazor/Components/NimbleSelect.razor.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ public partial class NimbleSelect : NimbleInputBase<string?>
6262
[Parameter]
6363
public bool? RequiredVisible { get; set; }
6464

65+
/// <summary>
66+
/// Gets or set whether or not the select should be rendered as
67+
/// read only when it is disabled.
68+
/// </summary>
69+
[Parameter]
70+
public bool? AppearanceReadOnly { get; set; }
71+
72+
/// <summary>
73+
/// Gets or set whether or not the start and end margins of the control are removed.
74+
/// This only applies when the <see cref="Appearance"/> is <see cref="DropdownAppearance.Frameless"/>.
75+
/// </summary>
76+
[Parameter]
77+
public bool? FullBleed { get; set; }
78+
6579
/// <summary>
6680
/// Gets or sets the child content to be rendering inside the <see cref="NimbleSelect"/>.
6781
/// </summary>

packages/blazor-workspace/NimbleBlazor/Components/NimbleTextArea.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
required="@Required"
1919
placeholder="@Placeholder"
2020
required-visible="@RequiredVisible"
21+
appearance-readonly="@AppearanceReadOnly"
2122
@attributes="AdditionalAttributes">
2223
@ChildContent
2324
</nimble-text-area>

packages/blazor-workspace/NimbleBlazor/Components/NimbleTextArea.razor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ public partial class NimbleTextArea : NimbleInputBase<string?>
9595
[Parameter]
9696
public bool? RequiredVisible { get; set; }
9797

98+
/// <summary>
99+
/// Gets or set whether or not the text area should be rendered as
100+
/// read only when it is disabled.
101+
/// </summary>
102+
[Parameter]
103+
public bool? AppearanceReadOnly { get; set; }
104+
98105
/// <summary>
99106
/// Gets or sets the child content of the control
100107
/// </summary>

packages/blazor-workspace/NimbleBlazor/Components/NimbleTextField.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
error-visible="@ErrorVisible"
1919
full-bleed="@FullBleed"
2020
required-visible="@RequiredVisible"
21+
appearance-readonly="@AppearanceReadOnly"
2122
@attributes="AdditionalAttributes">
2223
@ChildContent
2324
</nimble-text-field>

packages/blazor-workspace/NimbleBlazor/Components/NimbleTextField.razor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public partial class NimbleTextField : NimbleInputBase<string?>
5959
[Parameter]
6060
public bool? RequiredVisible { get; set; }
6161

62+
/// <summary>
63+
/// Gets or set whether or not the text field should be rendered as
64+
/// read only when it is disabled.
65+
/// </summary>
66+
[Parameter]
67+
public bool? AppearanceReadOnly { get; set; }
68+
6269
[Parameter]
6370
public RenderFragment? ChildContent { get; set; }
6471

packages/blazor-workspace/NimbleBlazor/DropdownAppearance.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ public enum DropdownAppearance
44
{
55
Underline,
66
Outline,
7-
Block
7+
Block,
8+
Frameless
89
}
910

1011
internal static class DropdownAppearanceExtensions

packages/blazor-workspace/NimbleBlazor/NumberFieldAppearance.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ public enum NumberFieldAppearance
44
{
55
Underline,
66
Outline,
7-
Block
7+
Block,
8+
Frameless
89
}
910

1011
internal static class NumberFieldAppearanceExtensions

packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleComboboxTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void ComboboxAutoComplete_AttributeIsSet(AutoComplete value, string expec
5757
[InlineData(DropdownAppearance.Block, "block")]
5858
[InlineData(DropdownAppearance.Underline, "underline")]
5959
[InlineData(DropdownAppearance.Outline, "outline")]
60+
[InlineData(DropdownAppearance.Frameless, "frameless")]
6061
public void ComboboxAppearance_AttributeIsSet(DropdownAppearance value, string expectedAttribute)
6162
{
6263
var combobox = RenderWithPropertySet(x => x.Appearance, value);
@@ -97,6 +98,22 @@ public void ComboboxRequiredVisible_AttributeIsSet()
9798
Assert.Contains("required-visible", combobox.Markup);
9899
}
99100

101+
[Fact]
102+
public void ComboboxAppearanceReadOnly_AttributeIsSet()
103+
{
104+
var combobox = RenderWithPropertySet(x => x.AppearanceReadOnly, true);
105+
106+
Assert.Contains("appearance-readonly", combobox.Markup);
107+
}
108+
109+
[Fact]
110+
public void ComboboxFullBleed_AttributeIsSet()
111+
{
112+
var combobox = RenderWithPropertySet(x => x.FullBleed, true);
113+
114+
Assert.Contains("full-bleed", combobox.Markup);
115+
}
116+
100117
[Fact]
101118
public void ComboboxWithOption_HasListOptionMarkup()
102119
{

packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleNumberFieldTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public void NimbleNumberField_SupportsAdditionalAttributes()
5353
[InlineData(NumberFieldAppearance.Outline, "outline")]
5454
[InlineData(NumberFieldAppearance.Block, "block")]
5555
[InlineData(NumberFieldAppearance.Underline, "underline")]
56+
[InlineData(NumberFieldAppearance.Frameless, "frameless")]
5657
public void NumberFieldAppearance_AttributeIsSet(NumberFieldAppearance value, string expectedAttribute)
5758
{
5859
var numberField = RenderWithPropertySet(x => x.Appearance, value);
@@ -140,6 +141,22 @@ public void NumberFieldRequiredVisible_AttributeIsSet()
140141
Assert.Contains("required-visible", numberField.Markup);
141142
}
142143

144+
[Fact]
145+
public void NumberFieldAppearanceReadOnly_AttributeIsSet()
146+
{
147+
var numberField = RenderWithPropertySet(x => x.AppearanceReadOnly, true);
148+
149+
Assert.Contains("appearance-readonly", numberField.Markup);
150+
}
151+
152+
[Fact]
153+
public void NumberFieldFullBleed_AttributeIsSet()
154+
{
155+
var numberField = RenderWithPropertySet(x => x.FullBleed, true);
156+
157+
Assert.Contains("full-bleed", numberField.Markup);
158+
}
159+
143160
private IRenderedComponent<NimbleNumberField> RenderWithPropertySet<TProperty>(Expression<Func<NimbleNumberField, TProperty>> propertyGetter, TProperty propertyValue)
144161
{
145162
var context = new TestContext();

packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleSelectTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public void SelectWithOption_HasListOptionMarkup()
7878
[InlineData(DropdownAppearance.Outline, "outline")]
7979
[InlineData(DropdownAppearance.Block, "block")]
8080
[InlineData(DropdownAppearance.Underline, "underline")]
81+
[InlineData(DropdownAppearance.Frameless, "frameless")]
8182
public void DropdownAppearance_AttributeIsSet(DropdownAppearance value, string expectedAttribute)
8283
{
8384
var select = RenderWithPropertySet(x => x.Appearance, value);
@@ -110,6 +111,22 @@ public void SelectClearable_AttributeIsSet()
110111
Assert.Contains("clearable", select.Markup);
111112
}
112113

114+
[Fact]
115+
public void SelectAppearanceReadOnly_AttributeIsSet()
116+
{
117+
var select = RenderWithPropertySet(x => x.AppearanceReadOnly, true);
118+
119+
Assert.Contains("appearance-readonly", select.Markup);
120+
}
121+
122+
[Fact]
123+
public void SelectFullBleed_AttributeIsSet()
124+
{
125+
var select = RenderWithPropertySet(x => x.FullBleed, true);
126+
127+
Assert.Contains("full-bleed", select.Markup);
128+
}
129+
113130
private IRenderedComponent<NimbleSelect> RenderWithPropertySet<TProperty>(Expression<Func<NimbleSelect, TProperty>> propertyGetter, TProperty propertyValue)
114131
{
115132
var context = new TestContext();

packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleTextAreaTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ public void TextAreaRequiredVisible_AttributeIsSet()
7777
Assert.Contains("required-visible", textArea.Markup);
7878
}
7979

80+
[Fact]
81+
public void TextAreaAppearanceReadOnly_AttributeIsSet()
82+
{
83+
var textArea = RenderWithPropertySet(x => x.AppearanceReadOnly, true);
84+
85+
Assert.Contains("appearance-readonly", textArea.Markup);
86+
}
87+
8088
private IRenderedComponent<NimbleTextArea> RenderNimbleTextArea(TextAreaResize textAreaResize)
8189
{
8290
var context = new TestContext();

packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleTextFieldTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ public void TextFieldRequiredVisible_AttributeIsSet()
8888
Assert.Contains("required-visible", textField.Markup);
8989
}
9090

91+
[Fact]
92+
public void TextFieldAppearanceReadOnly_AttributeIsSet()
93+
{
94+
var textField = RenderWithPropertySet(x => x.AppearanceReadOnly, true);
95+
96+
Assert.Contains("appearance-readonly", textField.Markup);
97+
}
98+
9199
private IRenderedComponent<NimbleTextField> RenderWithPropertySet<TProperty>(Expression<Func<NimbleTextField, TProperty>> propertyGetter, TProperty propertyValue)
92100
{
93101
var context = new TestContext();

0 commit comments

Comments
 (0)