Files
Khaemhat/src/Khaemhat.Web/Components/Ui/KhChip.razor
T
Alby96andClaude Opus 5.5 d958e7372d feat: Kh component library, record pages and profile security (M3, part 2)
Adds the building blocks every later screen uses, so modules are built from
one set of components instead of ad hoc markup:

- Form components (KhForm, KhTextBox, KhNumberBox, KhDateBox, KhSelect,
  KhCheck, KhSwitch, KhHotlink) with Italian number and date input, inline
  calculation (=10*3), field messages plus a summary that focuses the field,
  and service errors added by field name.
- Display and window components (panels, tiles, badges, chips, money, tabs
  with Alt+1..9, steps, dialog, side drawer and DrawerService).
- KhIconToolbar that keeps one line and moves less used commands into the
  "..." menu, KhDocHead, and the RecordPage/DocumentPage/MasterDataPage bases
  with standard commands, shortcuts and save/cancel/delete flow (#27, #29).
- Development-only component catalog and sample document page.
- Profile: personal data, password change that ends other sessions, TOTP
  enable/disable and recovery codes through ProfileService (#31).

Refs #27 #29 #31

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:11:16 +01:00

58 lines
1.5 KiB
Plaintext

@* A chip (SPEC §10.5.2, §10.7). Info chips summarise a condition: icon, a short label and a bold value ("Pagamento
RB 60 gg"). With OnRemove it becomes a filter chip with a remove button. *@
@if (OnRemove.HasDelegate)
{
<span class="chip">
@Text @Value
<button type="button" class="x kh-chipx" aria-label="@T.Format("Ui.Chip.Remove", Text + " " + Value)" @onclick="OnRemove"><KhIcon Name="x" Class="sm" /></button>
</span>
}
else
{
<span class="ichip @ToneClass" title="@Title">
@if (Icon is not null)
{
<KhIcon Name="@Icon" />
}
@Text
@if (Value is not null)
{
<b>@Value</b>
}
</span>
}
@code {
/// <summary>The icon.</summary>
[Parameter]
public string? Icon { get; set; }
/// <summary>The label.</summary>
[Parameter]
public string? Text { get; set; }
/// <summary>The value, in bold.</summary>
[Parameter]
public string? Value { get; set; }
/// <summary>A tooltip with the details.</summary>
[Parameter]
public string? Title { get; set; }
/// <summary>The tone: accent, warning, error.</summary>
[Parameter]
public KhTone Tone { get; set; }
/// <summary>Makes it a removable filter chip.</summary>
[Parameter]
public EventCallback OnRemove { get; set; }
private string? ToneClass => Tone switch
{
KhTone.Accent => "acc",
KhTone.Warning => "warn",
KhTone.Error => "err",
_ => null,
};
}