Ejemplo n.º 1
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            base.BuildAttributeSet(builder);

            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, ClassNames.BorderRounded, ClassNames.HoverDefault, ClassNames.ActiveDefault, ClassNames.Unselectable)
                                      .Add(ClassNames.Border, !Value && Appearance == Appearance.Outlined)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Active, Value)
                                      .AddAppearance(Appearance)
                                      .AddSize(Size));

            builder.AddAttribute("role", "checkbox");
            builder.AddAttribute("data-lx-interaction", "3");
        }
Ejemplo n.º 2
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, ClassNames.Unselectable, ClassNames.HoverDefault, ClassNames.ActiveDefault)
                                      .Add(ClassNames.Border, Appearance == Appearance.Outlined)
                                      .Add(ClassNames.FlexReverse, HasText && HasIcon && _icon !.Trailing)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Active, _isActive)
                                      .Add("lx-button-icon", HasIcon && !HasText)
                                      .Add("lx-button-round", ClassNames.BorderRounded, IsRounded)
                                      .AddTextTransform(TextTransform)
                                      .AddFontColor(_backgroundColor, Appearance)
                                      .AddAppearance(Appearance)
                                      .AddSize(Size));

            builder.AddAttribute("role", "button");
            builder.AddAttribute("data-lx-interaction", "3");
        }
Ejemplo n.º 3
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, ClassNames.Unselectable)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Extended, IsExtended)
                                      .AddSize(Size));

            builder.AddAttribute("role", "combobox");
        }
Ejemplo n.º 4
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, "px-4", ClassNames.HoverDefault, ClassNames.ActiveDefault)
                                      .Add(ClassNames.Unselectable)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Active, IsActive));

            builder.AddAttribute("data-lx-interaction", "3");
        }
Ejemplo n.º 5
0
        private void BuildAttributeSetInternal(AttributeSetBuilder builder)
        {
            BuildAttributeSet(builder);

            // Info: If parameter names (for components) gets checked "case sensitive"
            // we would need to correct that in "SetParametersAsync()" method (to "Class" and "Style")
            // -> Currently not the case, but could possible change during development of Blazor

            object?classMergeFactory(object?existingValue) => existingValue == null
                ? Class
                : (existingValue + " " + Class).TrimEnd();

            object?styleMergeFactory(object?existingValue)
            {
                if (existingValue == null)
                {
                    return(Style);
                }

                var value = existingValue.ToString();

                // Determine if we need to add a semicolon ";" to the previous string
                return(value !.EndsWith(";")
                    ? existingValue + Style
                    : existingValue + ";" + Style);
            }

            // Merge values of component with the "AttributSetBuilder"
            // -> All attributes which gets applied to the root-element of the component
            builder.AddAttribute("class", classMergeFactory, true, false);
            builder.AddAttribute("style", styleMergeFactory, true, false);

            if (StyleScope != null)
            {
                builder.AddAttribute("data-lx-scope", StyleScope);
            }
            else if (StyleContext.Style != null)
            {
                builder.AddAttribute("data-lx-scope", StyleContext.Style.Identifier);
            }
        }
Ejemplo n.º 6
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            base.BuildAttributeSet(builder);

            builder.AddAttribute("role", "progressbar");
            builder.AddAriaAttribute("busy", "true");

            builder.AddClassAttribute("lx-skeleton", Shape switch
            {
                SkeletonShape.Rectangle => "lx-skeleton-rect",
                SkeletonShape.Ellipsis => "lx-skeleton-ellipsis",
                SkeletonShape.Pill => "lx-skeleton-pill",
                _ => "lx-skeleton-text", // default
            });
Ejemplo n.º 7
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            base.BuildAttributeSet(builder);

            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, ClassNames.Unselectable)
                                      .Add(ClassNames.Border, !Value && Appearance == Appearance.Outlined)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Active, Value)
                                      .AddAppearance(Appearance)
                                      .AddSize(Size));

            builder.AddAttribute("role", "switch");
        }
Ejemplo n.º 8
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            builder.AddAttribute("role", "img");
            builder.AddAriaAttribute("hidden", "true");
            builder.AddClassAttribute(ClassName);

            builder.AddStyleAttribute(x => x
                                      .AddProperty("height", Size.ToString())
                                      .AddProperty("min-height", Size.ToString())
                                      .AddProperty("width", Size.ToString())
                                      .AddProperty("min-width", Size.ToString())
                                      .AddProperty("fill", Fill.IsEmpty ? _fillColor.ToRgbStr() : Fill.ToRgbaStr(), _isSourceResource)
                                      .AddProperty("color", Fill.IsEmpty ? _fillColor.ToRgbStr() : Fill.ToRgbaStr(), _isSourceResource));
        }
Ejemplo n.º 9
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            base.BuildAttributeSet(builder);

            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, ClassNames.BorderRounded, ClassNames.FlexRow)
                                      .Add(ClassNames.Border, Appearance == Appearance.Outlined)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Focused, _hasFocus)
                                      .AddAppearance(Appearance)
                                      .AddFontColor(_backgroundColor, Appearance)
                                      .AddSize(Size));

            builder.AddAttribute("role", "textbox");
        }
Ejemplo n.º 10
0
        protected override void BuildAttributeSet(AttributeSetBuilder builder)
        {
            builder.AddClassAttribute(x => x
                                      .AddMultiple(ClassName, _className, ClassNames.Unselectable)
                                      .Add(ClassNames.HoverDefault + " " + ClassNames.ActiveDefault, IsInteractable())
                                      .Add(ClassNames.BorderRounded, !_rounded)
                                      .Add(ClassNames.Border, !IsActive && Appearance == Appearance.Outlined)
                                      .Add(ClassNames.Disabled, !IsEnabled)
                                      .Add(ClassNames.Active, IsActive)
                                      .AddFontColor(IsActive ? _activeBackgroundColor : _backgroundColor, IsActive || Appearance != Appearance.Outlined)
                                      .AddAppearance(Appearance)
                                      .AddSize(Size));

            builder.AddAttribute("data-lx-interaction", "3");
        }
Ejemplo n.º 11
0
 protected override void BuildAttributeSet(AttributeSetBuilder builder)
 {
     builder.AddClassAttribute(ClassName, ClassNames.BorderRounded);
     builder.AddAttribute("role", "grid");
 }