-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* aria-controls on ListboxButton * IListbox selectedOption * listbox aria-controls * ListboxOptions aria-activedescendant * listbox aria attributes * code format * only set aria-controls if Listbox is open * aria concept * code format * ARIA concept * aria-popup listbox * rework HeadlessUI components (Listbox) * make all listbox components generic * remove redundant interfaces * refactor IDynamicParentComponent concept * remove redundant interfaces * fixes * fixes * generics * generics * fixes * refactor dynamic parent components * refactor dynamic parent components * refactor dynamic parent components * refactor dynamic parent components * introduce IgnisDynamicComponentBase and remove IgnisRigidComponentBase * IgnisDynamicComponentBase * rename component bases * refactor dynamic components * refactor dynamic components * refactor dynamic components * fixes * cascade non-generic IAriaPopup * fix transitions * fixes * refactor dialog * refactor disclosure (aria) * extract aria extensions & refactor menu * aria popup * code format * refactor popover * code format * radio group aria concept * radio group aria component * aria radio group * aria check group * aria tabs * transitions * code format * fixes * code format * docs * bump dependencies * fix tests * don't render transitions if not needed * code format
- Loading branch information
1 parent
66a6104
commit f99ac90
Showing
122 changed files
with
1,254 additions
and
2,726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Ignis.Components; | ||
|
||
public abstract class DynamicComponentBase<T> : IgnisComponentBase, IDynamicParentComponent<T> | ||
where T : DynamicComponentBase<T> | ||
{ | ||
private const string AttributesNotSetExceptionMessage = | ||
"Dynamic component attributes not set. Please use the SetAttributes method in the component's constructor."; | ||
|
||
private AttributeCollection? _attributes; | ||
|
||
private Type? _asComponent; | ||
private string? _asElement; | ||
|
||
[Parameter] | ||
public string? AsElement | ||
{ | ||
get => _asElement; | ||
set | ||
{ | ||
_asElement = value; | ||
_asComponent = null; | ||
} | ||
} | ||
|
||
[Parameter] | ||
public Type? AsComponent | ||
{ | ||
get => _asComponent; | ||
set | ||
{ | ||
_asComponent = value; | ||
_asElement = null; | ||
} | ||
} | ||
|
||
[Parameter] public RenderFragment<T>? _ { get; set; } | ||
|
||
[Parameter(CaptureUnmatchedValues = true)] | ||
public IEnumerable<KeyValuePair<string, object?>>? AdditionalAttributes | ||
{ | ||
get => _attributes?.AdditionalAttributes; | ||
set | ||
{ | ||
if (_attributes == null) throw new InvalidOperationException(AttributesNotSetExceptionMessage); | ||
|
||
_attributes.AdditionalAttributes = value; | ||
} | ||
} | ||
|
||
public ElementReference? Element { get; set; } | ||
|
||
public object? Component { get; set; } | ||
|
||
public IEnumerable<KeyValuePair<string, object?>>? Attributes => _attributes; | ||
|
||
protected DynamicComponentBase(string asElement) | ||
{ | ||
_asElement = asElement ?? throw new ArgumentNullException(nameof(asElement)); | ||
} | ||
|
||
protected DynamicComponentBase(Type asComponent) | ||
{ | ||
_asComponent = asComponent ?? throw new ArgumentNullException(nameof(asComponent)); | ||
} | ||
|
||
protected void SetAttributes(IEnumerable<Func<KeyValuePair<string, object?>>> attributes) | ||
{ | ||
if (attributes == null) throw new ArgumentNullException(nameof(attributes)); | ||
|
||
if (_attributes != null) throw new InvalidOperationException("Attributes already set."); | ||
|
||
_attributes = new AttributeCollection(attributes); | ||
} | ||
|
||
internal override Task OnInitializedCoreAsync() | ||
{ | ||
if (_attributes == null) throw new InvalidOperationException(AttributesNotSetExceptionMessage); | ||
|
||
return base.OnInitializedCoreAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.