Skip to content

Commit 866e6c4

Browse files
authored
Enhance API docs and meta data for Carousel, Collapse, and Confirm Dialog (#1219)
* Enhance API docs and metadata for Carousel & Collapse Add [AddedVersion], [DefaultValue], [Description], and [ParameterTypeName] attributes to Carousel, CarouselItem, CarouselCaption, and Collapse components for improved API documentation and tooling support. Refine XML docs for clarity and explicit defaults. Change Interval properties to non-nullable int with default 5000. Make ChildContent parameters nullable and optional. Update Collapse Parent to nullable and simplify Toggle. Add CarouselAutoPlay enum with full documentation. Improves discoverability and maintainability of component APIs. * Enhance ConfirmDialogOptions with metadata attributes Added [AddedVersion], [DefaultValue], and [Description] attributes to key properties in ConfirmDialogOptions for improved documentation and tooling support. Updated XML comments to clarify default values and behaviors. Explicitly set default values for button colors, texts, and dialog size. These changes improve discoverability and versioning clarity for consumers and tools.
1 parent f3c84e3 commit 866e6c4

6 files changed

Lines changed: 211 additions & 57 deletions

File tree

blazorbootstrap/Components/Carousel/Carousel.razor.cs

Lines changed: 62 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public async Task bslide(CarouselEventArgs args)
8080
/// Shows <see cref="CarouselItem" /> by index.
8181
/// </summary>
8282
/// <param name="index"></param>
83+
[AddedVersion("3.0.0")]
84+
[Description("Shows <b>CarouselItem</b> by index.")]
8385
public ValueTask ShowItemByIndexAsync(int index)
8486
{
8587
if (!isDefaultActiveCarouselItemSet)
@@ -99,11 +101,15 @@ internal void AddItem(CarouselItem carouselItem)
99101
/// <summary>
100102
/// Shows next <see cref="CarouselItem" />.
101103
/// </summary>
104+
[AddedVersion("3.0.0")]
105+
[Description("Shows next <b>CarouselItem</b>.")]
102106
public ValueTask PauseCarouselAsync() => JSRuntime.InvokeVoidAsync(CarouselInterop.Pause, Id);
103107

104108
/// <summary>
105109
/// Shows next <see cref="CarouselItem" />.
106110
/// </summary>
111+
[AddedVersion("3.0.0")]
112+
[Description("Shows next <b>CarouselItem</b>.")]
107113
public ValueTask ShowNextItemAsync()
108114
{
109115
var nextIndex = activeIndex + 1;
@@ -115,6 +121,8 @@ public ValueTask ShowNextItemAsync()
115121
/// <summary>
116122
/// Shows previous <see cref="CarouselItem" />.
117123
/// </summary>
124+
[AddedVersion("3.0.0")]
125+
[Description("Shows previous <b>CarouselItem</b>.")]
118126
public ValueTask ShowPreviousItemAsync()
119127
{
120128
var previousIndex = activeIndex - 1;
@@ -137,90 +145,119 @@ public ValueTask ShowPreviousItemAsync()
137145

138146
/// <summary>
139147
/// Controls the autoplay behavior of the carousel.
140-
/// </summary>
141-
/// <remarks>
148+
/// <para>
142149
/// Default value is <see cref="CarouselAutoPlay.None" />.
143-
/// </remarks>
150+
/// </para>
151+
/// </summary>
152+
[AddedVersion("3.0.0")]
153+
[DefaultValue(CarouselAutoPlay.None)]
154+
[Description("Controls the autoplay behavior of the carousel.")]
144155
[Parameter]
145156
public CarouselAutoPlay Autoplay { get; set; } = CarouselAutoPlay.None;
146157

147158
/// <summary>
148159
/// Gets or sets the content to be rendered within the component.
160+
/// <para>
161+
/// Default value is <see langword="null"/>.
162+
/// </para>
149163
/// </summary>
150-
/// <remarks>
151-
/// Default value is null.
152-
/// </remarks>
164+
[AddedVersion("3.0.0")]
165+
[DefaultValue(null)]
166+
[Description("Gets or sets the content to be rendered within the component.")]
167+
[ParameterTypeName("RenderFragment?")]
153168
[Parameter]
154169
public RenderFragment? ChildContent { get; set; }
155170

156171
/// <summary>
157172
/// Determines whether to use a crossfade effect when transitioning between slides.
158-
/// </summary>
159-
/// <remarks>
173+
/// <para>
160174
/// Default value is <see langword="false" />.
161-
/// </remarks>
175+
/// </para>
176+
/// </summary>
177+
[AddedVersion("3.0.0")]
178+
[DefaultValue(false)]
179+
[Description("Determines whether to use a crossfade effect when transitioning between slides.")]
162180
[Parameter]
163181
public bool Crossfade { get; set; }
164182

165183
private bool HasItems => items.Any();
166184

167185
/// <summary>
168186
/// The amount of time to delay between automatically cycling an item.
169-
/// </summary>
170-
/// <remarks>
187+
/// <para>
171188
/// Default value is 5000 milliseconds.
172-
/// </remarks>
189+
/// </para>
190+
/// </summary>
191+
[AddedVersion("3.0.0")]
192+
[DefaultValue(5000)]
193+
[Description("The amount of time to delay between automatically cycling an item.")]
173194
[Parameter]
174-
public int? Interval { get; set; } = 5000;
195+
public int Interval { get; set; } = 5000;
175196

176197
private int ItemCount => items.Count;
177198

178199
/// <summary>
179200
/// Whether the carousel should react to keyboard events.
180-
/// </summary>
181-
/// <remarks>
201+
/// <para>
182202
/// Default value is <see langword="true" />.
183-
/// </remarks>
203+
/// </para>
204+
/// </summary>
205+
[AddedVersion("3.0.0")]
206+
[DefaultValue(true)]
207+
[Description("Whether the carousel should react to keyboard events.")]
184208
[Parameter]
185209
public bool Keyboard { get; set; } = true;
186210

187211
/// <summary>
188212
/// Fired when the carousel has completed its slide transition.
189213
/// </summary>
214+
[AddedVersion("3.0.0")]
215+
[Description("Fired when the carousel has completed its slide transition.")]
190216
[Parameter]
191217
public EventCallback<CarouselEventArgs> Onslid { get; set; }
192218

193219
/// <summary>
194220
/// Fires immediately when the slide instance method is invoked.
195221
/// </summary>
222+
[AddedVersion("3.0.0")]
223+
[Description("Fires immediately when the slide instance method is invoked.")]
196224
[Parameter]
197225
public EventCallback<CarouselEventArgs> Onslide { get; set; }
198226

199227
/// <summary>
200228
/// Indicates whether to show indicators (dots) below the carousel to navigate between slides.
201-
/// </summary>
202-
/// <remarks>
229+
/// <para>
203230
/// Default value is <see langword="false" />.
204-
/// </remarks>
231+
/// </para>
232+
/// </summary>
233+
[AddedVersion("3.0.0")]
234+
[DefaultValue(false)]
235+
[Description("Indicates whether to show indicators (dots) below the carousel to navigate between slides.")]
205236
[Parameter]
206237
public bool ShowIndicators { get; set; }
207238

208239
/// <summary>
209240
/// Specifies whether to display the previous and next controls (arrows) for navigating slides.
210-
/// </summary>
211-
/// <remarks>
241+
/// <para>
212242
/// Default value is <see langword="true" />.
213-
/// </remarks>
243+
/// </para>
244+
/// </summary>
245+
[AddedVersion("3.0.0")]
246+
[DefaultValue(true)]
247+
[Description("Specifies whether to display the previous and next controls (arrows) for navigating slides.")]
214248
[Parameter]
215249
public bool ShowPreviousNextControls { get; set; } = true;
216250

217251
/// <summary>
218252
/// Carousels support swiping left/right on touchscreen devices to move between slides.
219253
/// This can be disabled by setting the <see cref="Touch" /> parameter to <see langword="false" />.
220-
/// </summary>
221-
/// <remarks>
254+
/// <para>
222255
/// Default value is <see langword="true" />.
223-
/// </remarks>
256+
/// </para>
257+
/// </summary>
258+
[AddedVersion("3.0.0")]
259+
[DefaultValue(true)]
260+
[Description("Carousels support swiping left/right on touchscreen devices to move between slides. This can be disabled by setting the <b>Touch</b> parameter to <b>false</b>.")]
224261
[Parameter]
225262
public bool Touch { get; set; } = true;
226263

blazorbootstrap/Components/Carousel/CarouselCaption.razor.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ public partial class CarouselCaption : BlazorBootstrapComponentBase
1414

1515
/// <summary>
1616
/// Gets or sets the content to be rendered within the component.
17-
/// </summary>
18-
/// <remarks>
17+
/// <para>
1918
/// Default value is <see langword="null" />.
20-
/// </remarks>
19+
/// </para>
20+
/// </summary>
21+
[AddedVersion("3.0.0")]
22+
[DefaultValue(null)]
23+
[Description("Gets or sets the content to be rendered within the component.")]
24+
[ParameterTypeName("RenderFragment?")]
2125
[Parameter]
2226
public RenderFragment? ChildContent { get; set; }
2327

blazorbootstrap/Components/Carousel/CarouselItem.razor.cs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,51 @@ protected override async Task OnInitializedAsync()
2424

2525
/// <summary>
2626
/// Gets or sets the active state.
27-
/// </summary>
28-
/// <remarks>
27+
/// <para>
2928
/// Default value is <see langword="false" />.
30-
/// </remarks>
29+
/// </para>
30+
/// </summary>
31+
[AddedVersion("3.0.0")]
32+
[DefaultValue(false)]
33+
[Description("Gets or sets the active state.")]
3134
[Parameter]
3235
public bool Active { get; set; }
3336

3437
/// <summary>
3538
/// Gets or sets the content to be rendered within the component.
36-
/// </summary>
37-
/// <remarks>
39+
/// <para>
3840
/// Default value is <see langword="null" />.
39-
/// </remarks>
41+
/// </para>
42+
/// </summary>
43+
[AddedVersion("3.0.0")]
44+
[DefaultValue(null)]
45+
[Description("Gets or sets the content to be rendered within the component.")]
46+
[ParameterTypeName("RenderFragment?")]
4047
[Parameter]
4148
public RenderFragment? ChildContent { get; set; }
4249

4350
/// <summary>
4451
/// The amount of time to delay between automatically cycling an item.
52+
/// <para>
53+
/// Default value is 5000 milliseconds.
54+
/// </para>
4555
/// </summary>
46-
/// <remarks>
47-
/// Default value is 5000.
48-
/// </remarks>
56+
[AddedVersion("3.0.0")]
57+
[DefaultValue(5000)]
58+
[Description("The amount of time to delay between automatically cycling an item.")]
4959
[Parameter]
50-
public int? Interval { get; set; } = 5000;
60+
public int Interval { get; set; } = 5000;
5161

5262
/// <summary>
5363
/// Gets or sets the aria-label.
64+
/// <para>
65+
/// Default value is <see langword="null" />.
66+
/// </para>
5467
/// </summary>
68+
[AddedVersion("3.0.0")]
69+
[DefaultValue(null)]
70+
[Description("Gets or sets the aria-label.")]
71+
[ParameterTypeName("string?")]
5572
[Parameter]
5673
public string? Label { get; set; }
5774

blazorbootstrap/Components/Collapse/Collapse.razor.cs

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,22 @@ protected override async Task OnInitializedAsync()
6161
/// <summary>
6262
/// Hides a collapsible element.
6363
/// </summary>
64+
[AddedVersion("1.7.0")]
65+
[Description("Hides a collapsible element.")]
6466
public async Task HideAsync() => await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.collapse.hide", Id);
6567

6668
/// <summary>
6769
/// Shows a collapsible element.
6870
/// </summary>
71+
[AddedVersion("1.7.0")]
72+
[Description("Shows a collapsible element.")]
6973
public async Task ShowAsync() => await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.collapse.show", Id);
7074

7175
/// <summary>
7276
/// Toggles a collapsible element to shown or hidden.
7377
/// </summary>
78+
[AddedVersion("1.7.0")]
79+
[Description("Toggles a collapsible element to shown or hidden.")]
7480
public async Task ToggleAsync() => await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.collapse.toggle", Id);
7581

7682
#endregion
@@ -84,45 +90,59 @@ protected override async Task OnInitializedAsync()
8490

8591
/// <summary>
8692
/// Gets or sets the content to be rendered within the component.
93+
/// <para>
94+
/// Default value is <see langword="null"/>.
95+
/// </para>
8796
/// </summary>
88-
/// <remarks>
89-
/// Default value is null.
90-
/// </remarks>
91-
[Parameter]
97+
[AddedVersion("1.7.0")]
98+
[DefaultValue(null)]
99+
[Description("Gets or sets the content to be rendered within the component.")]
92100
[EditorRequired]
93-
public RenderFragment ChildContent { get; set; } = default!;
101+
[ParameterTypeName("RenderFragment?")]
102+
[Parameter]
103+
public RenderFragment? ChildContent { get; set; }
94104

95105
/// <summary>
96106
/// Gets or sets the horizontal collapsing.
107+
/// <para>
108+
/// Default value is <see langword="false"/>.
109+
/// </para>
97110
/// </summary>
98-
/// <remarks>
99-
/// Default value is false.
100-
/// </remarks>
111+
[AddedVersion("1.7.0")]
112+
[DefaultValue(false)]
113+
[Description("Gets or sets the horizontal collapsing.")]
101114
[Parameter]
102115
public bool Horizontal { get; set; }
103116

104117
/// <summary>
105118
/// This event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
106119
/// </summary>
120+
[AddedVersion("1.7.0")]
121+
[Description("This event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).")]
107122
[Parameter]
108123
public EventCallback OnHidden { get; set; }
109124

110125
/// <summary>
111126
/// This event is fired immediately when the hide method has been called.
112127
/// </summary>
128+
[AddedVersion("1.7.0")]
129+
[Description("This event is fired immediately when the hide method has been called.")]
113130
[Parameter]
114131
public EventCallback OnHiding { get; set; }
115132

116133
/// <summary>
117134
/// This event fires immediately when the show instance method is called.
118135
/// </summary>
136+
[AddedVersion("1.7.0")]
137+
[Description("This event fires immediately when the show instance method is called.")]
119138
[Parameter]
120139
public EventCallback OnShowing { get; set; }
121140

122141
/// <summary>
123-
/// This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to
124-
/// complete).
142+
/// This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
125143
/// </summary>
144+
[AddedVersion("1.7.0")]
145+
[Description("This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).")]
126146
[Parameter]
127147
public EventCallback OnShown { get; set; }
128148

@@ -131,18 +151,27 @@ protected override async Task OnInitializedAsync()
131151
/// If parent is provided, then all collapsible elements under the specified parent will be closed when this collapsible
132152
/// item is shown. (similar to traditional accordion behavior - this is dependent on the card class).
133153
/// The attribute has to be set on the target collapsible area.
154+
/// <para>
155+
/// Default value is <see langword="null" />.
156+
/// </para>
134157
/// </summary>
158+
[AddedVersion("1.7.0")]
159+
[DefaultValue(null)]
160+
[Description("Gets or sets the parent selector, DOM element. If parent is provided, then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the card class). The attribute has to be set on the target collapsible area.")]
135161
[Parameter]
136-
public object Parent { get; set; } = default!;
162+
public object? Parent { get; set; }
137163

138164
/// <summary>
139165
/// Toggles the collapsible element on invocation.
166+
/// <para>
167+
/// Default value is <see langword="false" />.
168+
/// </para>
140169
/// </summary>
141-
/// <remarks>
142-
/// Default value is false.
143-
/// </remarks>
170+
[AddedVersion("1.7.0")]
171+
[DefaultValue(false)]
172+
[Description("Toggles the collapsible element on invocation.")]
144173
[Parameter]
145-
public bool Toggle { get; set; } = false;
174+
public bool Toggle { get; set; }
146175

147176
#endregion
148177
}

0 commit comments

Comments
 (0)