From d19da0e658d4394d7db87aea60dd508e53d37395 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sun, 20 Sep 2026 06:04:20 +0330 Subject: [PATCH 1/9] Improve theme infra of BitCalendar #13292 --- .../Inputs/Calendar/BitCalendar.razor | 354 ++++--- .../Inputs/Calendar/BitCalendar.razor.cs | 915 +++++++++++++++--- .../Inputs/Calendar/BitCalendar.scss | 527 +++++----- .../Inputs/Calendar/BitCalendarClassStyles.cs | 10 + .../JsInterop/CalendarsJsRuntimeExtensions.cs | 4 +- .../Bit.BlazorUI/Scripts/Calendars.ts | 4 +- .../Inputs/Calendar/BitCalendarDemo.razor | 579 +++++------ .../Inputs/Calendar/BitCalendarDemo.razor.cs | 474 ++++++++- .../Calendar/BitCalendarDemo.razor.samples.cs | 398 ++++---- .../Calendar/BitCalendarDemo.razor.scss | 6 + .../Inputs/Calendar/BitCalendarTests.cs | 438 +++++++++ 11 files changed, 2775 insertions(+), 934 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor index 9a5c9b2fb3b..0ff2453398a 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor @@ -1,4 +1,4 @@ -@namespace Bit.BlazorUI +@namespace Bit.BlazorUI @inherits BitInputBase @{ @@ -6,6 +6,7 @@ var todayYear = _culture.Calendar.GetYear(today); var todayMonth = _culture.Calendar.GetMonth(today); var focusableDay = GetFocusableDay(); + var isInvalid = ValueInvalid is true; var prevMonthNavIconCss = BitIconInfo.From(PrevMonthNavIcon, PrevMonthNavIconName ?? "Up")?.GetCssClasses(); var nextMonthNavIconCss = BitIconInfo.From(NextMonthNavIcon, NextMonthNavIconName ?? "Up bit-ico-r180")?.GetCssClasses(); @@ -23,15 +24,27 @@ var decreaseMinuteIconCss = BitIconInfo.From(TimePickerDecreaseMinuteIcon, TimePickerDecreaseMinuteIconName ?? "ChevronDownSmall")?.GetCssClasses(); } +@* A calendar is a composite of labelled grids, so it needs no role of its own - but one given a name is a + named group, which is what lets a screen reader say which of two calendars on a page the focus is in. *@
-
+ @if (HeaderTemplate is not null) + { +
@HeaderTemplate
+ } + +
+ @* The selection as words, for a screen reader alone: the day cell carries it as aria-selected, which + is state rather than something announced when it changes. Left empty while nothing is selected, so + clearing the value does not announce a selection of nothing. *@
- @(string.Format(SelectedDateAriaAtomic, CurrentValueAsString)) + @(CurrentValueAsString.HasValue() ? string.Format(SelectedDateAriaAtomic, CurrentValueAsString) : null)
@if (DayPickerIsVisible()) @@ -42,7 +55,6 @@ { var title = string.Format(MonthPickerToggleTitle, _monthTitle); } else { -
@@ -73,10 +83,10 @@