ComponentDefinitions:
  StatusPill:
    DefinitionType: CanvasComponent
    Description: Rounded status label with five tones. One place for status colors instead of one copy per screen.
    CustomProperties:
      Label:
        PropertyKind: Input
        DisplayName: Label
        DataType: Text
        RaiseOnReset: false
        Description: Text shown in the pill.
        Default: ="Approved"
      Tone:
        PropertyKind: Input
        DisplayName: Tone
        DataType: Text
        RaiseOnReset: false
        Description: One of success, warning, error, info, neutral. Anything else renders as neutral.
        Default: ="success"
    Properties:
      Fill: =RGBA(0, 0, 0, 0)
      Height: =28
      Width: =120
    Children:
      - conPillRoot:
          Control: GroupContainer
          Variant: AutoLayout
          Properties:
            DropShadow: =DropShadow.None
            Fill: =Switch(Lower(StatusPill.Tone), "success", RGBA(227, 242, 232, 1), "warning", RGBA(252, 239, 217, 1), "error", RGBA(250, 231, 232, 1), "info", RGBA(230, 238, 248, 1), RGBA(236, 240, 242, 1))
            Height: =StatusPill.Height
            LayoutAlignItems: =LayoutAlignItems.Center
            LayoutDirection: =LayoutDirection.Horizontal
            LayoutJustifyContent: =LayoutJustifyContent.Center
            PaddingLeft: =8
            PaddingRight: =8
            RadiusBottomLeft: =StatusPill.Height / 2
            RadiusBottomRight: =StatusPill.Height / 2
            RadiusTopLeft: =StatusPill.Height / 2
            RadiusTopRight: =StatusPill.Height / 2
            Width: =StatusPill.Width
            X: =0
            Y: =0
          Children:
            - txtPillLabel:
                Control: ModernText
                Properties:
                  AccessibleLabel: =StatusPill.Label
                  Align: =Align.Center
                  Color: =Switch(Lower(StatusPill.Tone), "success", RGBA(27, 106, 58, 1), "warning", RGBA(125, 69, 0, 1), "error", RGBA(161, 38, 44, 1), "info", RGBA(29, 78, 134, 1), RGBA(63, 79, 87, 1))
                  Font: =Font.'Segoe UI'
                  FontWeight: =FontWeight.Semibold
                  Height: =StatusPill.Height - 4
                  LayoutMinHeight: =0
                  LayoutMinWidth: =0
                  PaddingBottom: =0
                  PaddingLeft: =0
                  PaddingRight: =0
                  PaddingTop: =0
                  Size: =Max(10, StatusPill.Height * 0.46)
                  Text: =StatusPill.Label
                  VerticalAlign: =VerticalAlign.Middle
                  Width: =StatusPill.Width - 16
                  Wrap: =false
