diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JButton.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JButton.cs index 9adf5bd5..82c9079a 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JButton.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JButton.cs @@ -109,7 +109,7 @@ private void ApplyBaseStyles() // Font styling style.fontSize = Tokens.FontSize.Base; - style.unityFontStyleAndWeight = FontStyle.Bold; + style.unityFontStyleAndWeight = FontStyle.Normal; // No border for glassmorphic look style.borderTopWidth = 0; @@ -124,6 +124,9 @@ private void ApplyBaseStyles() // Smooth glassmorphic transitions JTheme.ApplyTransition(this); + + // Pointer cursor for clickable element + JTheme.ApplyPointerCursor(this); } /// diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JIconButton.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JIconButton.cs new file mode 100644 index 00000000..42602da9 --- /dev/null +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JIconButton.cs @@ -0,0 +1,136 @@ +// JIconButton.cs +// +// Author: +// JasonXuDeveloper +// +// Copyright (c) 2025 JEngine +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using JEngine.UI.Editor.Theming; +using UnityEngine; +using UnityEngine.UIElements; + +namespace JEngine.UI.Editor.Components.Button +{ + /// + /// A small icon button with transparent background, suitable for toolbars and inline actions. + /// + public class JIconButton : UnityEngine.UIElements.Button + { + /// + /// Creates a new icon button. + /// + /// The button text (typically an icon character or short text). + /// Click handler. + /// Optional tooltip. + public JIconButton(string text, Action onClick = null, string tooltip = null) + { + this.text = text; + this.tooltip = tooltip; + + AddToClassList("j-icon-button"); + ApplyStyles(); + + if (onClick != null) + { + clicked += onClick; + } + + // Hover events + RegisterCallback(OnMouseEnter); + RegisterCallback(OnMouseLeave); + } + + private void ApplyStyles() + { + // Small size + style.width = 22; + style.height = 18; + style.minWidth = 18; + style.minHeight = 18; + + // No padding/margin + style.marginLeft = 2; + style.marginRight = 0; + style.marginTop = 0; + style.marginBottom = 0; + style.paddingLeft = 0; + style.paddingRight = 0; + style.paddingTop = 0; + style.paddingBottom = 0; + + // Transparent background + style.backgroundColor = Color.clear; + + // No border + style.borderTopWidth = 0; + style.borderRightWidth = 0; + style.borderBottomWidth = 0; + style.borderLeftWidth = 0; + style.borderTopLeftRadius = Tokens.BorderRadius.Sm; + style.borderTopRightRadius = Tokens.BorderRadius.Sm; + style.borderBottomLeftRadius = Tokens.BorderRadius.Sm; + style.borderBottomRightRadius = Tokens.BorderRadius.Sm; + + // Text styling + style.fontSize = Tokens.FontSize.Xs; + style.color = Tokens.Colors.TextMuted; + style.unityTextAlign = TextAnchor.MiddleCenter; + + // Pointer cursor + JTheme.ApplyPointerCursor(this); + + // Smooth transitions + JTheme.ApplyTransition(this); + } + + private void OnMouseEnter(MouseEnterEvent evt) + { + style.color = Tokens.Colors.TextPrimary; + style.backgroundColor = Tokens.Colors.BgElevated; + } + + private void OnMouseLeave(MouseLeaveEvent evt) + { + style.color = Tokens.Colors.TextMuted; + style.backgroundColor = Color.clear; + } + + /// + /// Sets the button tooltip. + /// + public JIconButton WithTooltip(string tooltip) + { + this.tooltip = tooltip; + return this; + } + + /// + /// Sets custom size for the button. + /// + public JIconButton WithSize(float width, float height) + { + style.width = width; + style.height = height; + return this; + } + } +} diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormSection.cs.meta b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JIconButton.cs.meta similarity index 83% rename from UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormSection.cs.meta rename to UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JIconButton.cs.meta index 045f454c..71aa729c 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormSection.cs.meta +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JIconButton.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9ee6d4507273b4da79e1f9a1b962962c +guid: 39fb795d6da084770a8bb4418999da7b MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JToggleButton.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JToggleButton.cs index 79bbf96e..94ec056e 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JToggleButton.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Button/JToggleButton.cs @@ -103,10 +103,10 @@ private void ApplyBaseStyles() style.borderTopRightRadius = Tokens.BorderRadius.Sm; style.borderBottomLeftRadius = Tokens.BorderRadius.Sm; style.borderBottomRightRadius = Tokens.BorderRadius.Sm; - style.paddingTop = 4; - style.paddingRight = 10; - style.paddingBottom = 4; - style.paddingLeft = 10; + style.paddingTop = Tokens.Spacing.Sm; + style.paddingRight = Tokens.Spacing.MD; + style.paddingBottom = Tokens.Spacing.Sm; + style.paddingLeft = Tokens.Spacing.MD; // Remove all margins (like JDropdown does) style.marginLeft = 0; style.marginRight = 0; @@ -114,7 +114,7 @@ private void ApplyBaseStyles() style.marginBottom = 0; style.minHeight = 22; style.maxHeight = 24; - style.fontSize = 11; + style.fontSize = Tokens.FontSize.Sm; style.unityFontStyleAndWeight = FontStyle.Normal; // No border for cleaner look style.borderTopWidth = 0; @@ -126,6 +126,9 @@ private void ApplyBaseStyles() style.overflow = Overflow.Hidden; style.textOverflow = TextOverflow.Ellipsis; style.whiteSpace = WhiteSpace.NoWrap; + + // Pointer cursor for clickable element + JTheme.ApplyPointerCursor(this); } private void OnClicked() diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Feedback/JLogView.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Feedback/JLogView.cs index ba347a38..f60a9995 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Feedback/JLogView.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Feedback/JLogView.cs @@ -24,7 +24,6 @@ // THE SOFTWARE. using JEngine.UI.Editor.Theming; -using UnityEngine; using UnityEngine.UIElements; namespace JEngine.UI.Editor.Components.Feedback @@ -48,11 +47,8 @@ public JLogView(int maxLines = 100) : base("j-log-view") _currentLineCount = 0; // Apply theme-aware background - // Dark mode: subtle layer (not too dark) - // Light mode: surface layer (grey) - style.backgroundColor = Tokens.IsDarkTheme - ? Tokens.Colors.BgSubtle - : Tokens.Colors.BgSurface; + // Use input background for consistent control styling + style.backgroundColor = Tokens.Colors.BgInput; // Standard borders style.borderTopColor = Tokens.Colors.Border; @@ -135,7 +131,7 @@ public JLogView Log(string message, bool isError = false) entry.style.fontSize = Tokens.FontSize.Sm; entry.style.paddingTop = Tokens.Spacing.Xs; entry.style.paddingBottom = Tokens.Spacing.Xs; - entry.style.borderBottomColor = new Color(1, 1, 1, 0.05f); + entry.style.borderBottomColor = Tokens.Colors.BorderSubtle; entry.style.borderBottomWidth = 1; entry.style.color = isError ? Tokens.Colors.StatusError : Tokens.Colors.TextSecondary; entry.style.whiteSpace = WhiteSpace.Normal; diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JDropdown.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JDropdown.cs index 3b9b4538..fc4ed012 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JDropdown.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JDropdown.cs @@ -25,53 +25,78 @@ using System; using System.Collections.Generic; +using System.Linq; +using JEngine.UI.Editor.Theming; using JEngine.UI.Editor.Utilities; using UnityEngine.UIElements; namespace JEngine.UI.Editor.Components.Form { /// - /// A styled dropdown matching the JEngine dark theme. + /// A styled dropdown for string choices. /// - public class JDropdown : VisualElement + public class JDropdown : JDropdown { - private readonly PopupField _popupField; - private Action _onValueChanged; - private bool _stylesApplied; - /// /// Creates a new styled dropdown. /// /// Available choices. /// Default selected value. public JDropdown(List choices, string defaultValue = null) + : base(choices, defaultValue, v => v, v => v) + { + } + } + + /// + /// A styled generic dropdown that works with any type including enums. + /// + /// The type of values in the dropdown. + public class JDropdown : VisualElement + { + private readonly PopupField _popupField; + private Action _onValueChanged; + private VisualElement _inputElement; + + /// + /// Creates a new styled generic dropdown. + /// + /// Available choices. + /// Default selected value. + /// Function to format the selected value display. + /// Function to format list item display. + public JDropdown( + List choices, + T defaultValue = default, + Func formatSelectedValue = null, + Func formatListItem = null) { AddToClassList("j-dropdown"); // Ensure choices list is valid if (choices == null || choices.Count == 0) { - choices = new List { "" }; + throw new ArgumentException("Choices list cannot be null or empty", nameof(choices)); } // Determine initial index int defaultIndex = 0; - if (!string.IsNullOrEmpty(defaultValue) && choices.Contains(defaultValue)) + if (defaultValue != null && choices.Contains(defaultValue)) { defaultIndex = choices.IndexOf(defaultValue); } - _popupField = new PopupField(choices, defaultIndex); + // Create popup field with formatters (use ToString as default) + _popupField = new PopupField( + choices, + defaultIndex, + formatSelectedValue ?? (v => v?.ToString() ?? ""), + formatListItem ?? (v => v?.ToString() ?? "")); - // Style the container - style.flexGrow = 1; - style.flexShrink = 1; - style.minWidth = 80; - style.minHeight = 20; - style.maxHeight = 24; - style.alignSelf = Align.Center; + // Style the container using shared input styles + JTheme.ApplyInputContainerStyle(this); - // Apply styles + // Apply styles to popup field _popupField.style.flexGrow = 1; _popupField.style.marginLeft = 0; _popupField.style.marginRight = 0; @@ -80,31 +105,66 @@ public JDropdown(List choices, string defaultValue = null) Add(_popupField); - // Apply styles using GeometryChangedEvent (fires after layout) - _popupField.RegisterCallback(OnGeometryChanged); + // Apply styles when attached to panel + _popupField.RegisterCallback(OnAttachToPanel); } - private void OnGeometryChanged(GeometryChangedEvent evt) + private void OnAttachToPanel(AttachToPanelEvent evt) { - // Apply styles only once - if (_stylesApplied) return; + // Apply stylesheets to enable USS :hover + StyleSheetManager.ApplyAllStyleSheets(this); - // Unregister to prevent multiple calls - _popupField.UnregisterCallback(OnGeometryChanged); + // Also apply inline styles for theme token colors + ApplyInternalStyles(); + } - // Use PopupFieldStyleHelper for reliable styling - PopupFieldStyleHelper.ApplyStylesToPopupField( - _popupField, - enableHoverEffects: true, - enableDebugLogging: false); // Set to true for debugging + private void ApplyInternalStyles() + { + // Style the input element using shared styles + _inputElement = _popupField.Q(className: "unity-base-popup-field__input"); + JTheme.ApplyInputElementStyle(_inputElement); + + // Register hover on the wrapper (this) - PopupField internal elements have event issues + // Using PointerOverEvent/PointerOutEvent as alternative to MouseEnter/MouseLeave + RegisterCallback(OnPointerOver); + RegisterCallback(OnPointerOut); + + // Style the arrow + var arrowElement = _popupField.Q(className: "unity-base-popup-field__arrow"); + if (arrowElement != null) + { + arrowElement.style.unityBackgroundImageTintColor = Tokens.Colors.TextMuted; + } + + // Style the text using shared styles + var textElement = _popupField.Q(); + JTheme.ApplyInputTextStyle(textElement); + + // Pointer cursor on all elements + JTheme.ApplyPointerCursor(this); + JTheme.ApplyPointerCursor(_popupField); + JTheme.ApplyPointerCursor(_inputElement); + if (textElement != null) JTheme.ApplyPointerCursor(textElement); + if (arrowElement != null) JTheme.ApplyPointerCursor(arrowElement); + + // Hide the label if present + JTheme.HideFieldLabel(_popupField); + } - _stylesApplied = true; + private void OnPointerOver(PointerOverEvent evt) + { + JTheme.ApplyInputHoverState(_inputElement); + } + + private void OnPointerOut(PointerOutEvent evt) + { + JTheme.ApplyInputNormalState(_inputElement); } /// /// Gets or sets the selected value. /// - public string Value + public T Value { get => _popupField.value; set => _popupField.value = value; @@ -113,12 +173,12 @@ public string Value /// /// Gets the internal PopupField for advanced operations. /// - public PopupField PopupField => _popupField; + public PopupField PopupField => _popupField; /// /// Gets or sets the choices. /// - public List Choices + public List Choices { get => _popupField.choices; set => _popupField.choices = value; @@ -127,7 +187,7 @@ public List Choices /// /// Registers a callback for value changes. /// - public void RegisterValueChangedCallback(EventCallback> callback) + public void RegisterValueChangedCallback(EventCallback> callback) { _popupField.RegisterValueChangedCallback(callback); } @@ -135,11 +195,27 @@ public void RegisterValueChangedCallback(EventCallback> call /// /// Sets the value changed callback. /// - public JDropdown OnValueChanged(Action callback) + public JDropdown OnValueChanged(Action callback) { _onValueChanged = callback; _popupField.RegisterValueChangedCallback(evt => _onValueChanged?.Invoke(evt.newValue)); return this; } + + /// + /// Creates a dropdown for an enum type. + /// + /// The enum type. + /// Default selected value. + /// A new dropdown configured for the enum. + public static JDropdown ForEnum(TEnum defaultValue = default) where TEnum : Enum + { + var values = Enum.GetValues(typeof(TEnum)).Cast().ToList(); + return new JDropdown( + values, + defaultValue, + v => v.ToString(), + v => v.ToString()); + } } } diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormField.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormField.cs index 3a7a45af..87a9bc32 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormField.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormField.cs @@ -52,14 +52,14 @@ public JFormField(string labelText, VisualElement control = null) : base("j-form style.maxHeight = 28; style.overflow = Overflow.Hidden; - // Create label - compact + // Create label - compact, using shared tokens _label = new Label(labelText); _label.AddToClassList("j-form-field__label"); _label.style.width = Tokens.Layout.FormLabelWidth; _label.style.minWidth = Tokens.Layout.FormLabelMinWidth; _label.style.maxWidth = 180; _label.style.color = Tokens.Colors.TextSecondary; - _label.style.fontSize = 11; + _label.style.fontSize = Tokens.FontSize.Sm; _label.style.paddingRight = Tokens.Spacing.Sm; _label.style.flexShrink = 1; _label.style.overflow = Overflow.Hidden; diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormSection.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormSection.cs deleted file mode 100644 index 6929d3e0..00000000 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JFormSection.cs +++ /dev/null @@ -1,129 +0,0 @@ -// JFormSection.cs -// -// Author: -// JasonXuDeveloper -// -// Copyright (c) 2025 JEngine -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using JEngine.UI.Editor.Theming; -using UnityEngine; -using UnityEngine.UIElements; - -namespace JEngine.UI.Editor.Components.Form -{ - /// - /// A section containing grouped form fields with an optional header. - /// - public class JFormSection : JComponent - { - private readonly Label _header; - private readonly VisualElement _fields; - - /// - /// Creates a new form section with an optional header. - /// - /// The section header text, or null for no header. - public JFormSection(string headerText = null) : base("j-form-section") - { - style.marginBottom = Tokens.Spacing.Lg; - - // Create header if provided - if (!string.IsNullOrEmpty(headerText)) - { - _header = new Label(headerText); - _header.AddToClassList("j-form-section__header"); - _header.style.color = Tokens.Colors.TextMuted; - _header.style.fontSize = Tokens.FontSize.Sm; - _header.style.unityFontStyleAndWeight = FontStyle.Bold; - _header.style.marginBottom = Tokens.Spacing.MD; - base.Add(_header); - } - - // Create fields container - _fields = new VisualElement(); - _fields.style.flexDirection = FlexDirection.Column; - base.Add(_fields); - } - - /// - /// Gets the header label. - /// - public Label Header => _header; - - /// - /// Gets the fields container. - /// - public VisualElement Fields => _fields; - - /// - /// Adds a form field with label and control. - /// - /// The field label. - /// The control element. - /// This form section for chaining. - public JFormSection AddField(string label, VisualElement control) - { - var field = new JFormField(label, control); - _fields.Add(field); - return this; - } - - /// - /// Adds a pre-built form field. - /// - /// The form field to add. - /// This form section for chaining. - public JFormSection AddField(JFormField field) - { - _fields.Add(field); - return this; - } - - /// - /// Adds child elements to the fields container. - /// - public new JFormSection Add(params VisualElement[] children) - { - foreach (var child in children) - { - if (child != null) - { - _fields.Add(child); - } - } - return this; - } - - /// - /// Sets the header text. - /// - /// The new header text. - /// This form section for chaining. - public JFormSection WithHeader(string text) - { - if (_header != null) - { - _header.text = text; - } - return this; - } - } -} diff --git a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JObjectField.cs b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JObjectField.cs index 9af422c9..16ec8deb 100644 --- a/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JObjectField.cs +++ b/UnityProject/Packages/com.jasonxudeveloper.jengine.ui/Editor/Components/Form/JObjectField.cs @@ -23,8 +23,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; using JEngine.UI.Editor.Theming; +using JEngine.UI.Editor.Utilities; using UnityEditor; using UnityEditor.UIElements; using UnityEngine; @@ -36,154 +36,7 @@ namespace JEngine.UI.Editor.Components.Form /// /// A styled object field matching the JEngine dark theme. /// - public class JObjectField : VisualElement - { - private readonly ObjectField _objectField; - - /// - /// Creates a new styled object field. - /// - /// The type of object to accept. - /// Whether to allow scene objects. - public JObjectField(Type objectType, bool allowSceneObjects = true) - { - AddToClassList("j-object-field"); - - _objectField = new ObjectField - { - objectType = objectType, - allowSceneObjects = allowSceneObjects - }; - - // Style the container - style.flexGrow = 1; - style.flexShrink = 1; - style.minWidth = 80; - style.minHeight = 20; - style.maxHeight = 24; - style.alignSelf = Align.Center; - - _objectField.style.flexGrow = 1; - _objectField.style.marginLeft = 0; - _objectField.style.marginRight = 0; - _objectField.style.marginTop = 0; - _objectField.style.marginBottom = 0; - _objectField.style.height = 22; - - _objectField.RegisterCallback(OnAttachToPanel); - - Add(_objectField); - } - - private void ApplyInternalStyles() - { - // Style the input container - var input = _objectField.Q(className: "unity-object-field__input"); - if (input != null) - { - input.style.backgroundColor = Tokens.Colors.BgInput; - input.style.borderTopColor = Tokens.Colors.BorderSubtle; - input.style.borderRightColor = Tokens.Colors.BorderSubtle; - input.style.borderBottomColor = Tokens.Colors.BorderSubtle; - input.style.borderLeftColor = Tokens.Colors.BorderSubtle; - input.style.borderTopWidth = 1; - input.style.borderRightWidth = 1; - input.style.borderBottomWidth = 1; - input.style.borderLeftWidth = 1; - input.style.borderTopLeftRadius = Tokens.BorderRadius.Sm; - input.style.borderTopRightRadius = Tokens.BorderRadius.Sm; - input.style.borderBottomLeftRadius = Tokens.BorderRadius.Sm; - input.style.borderBottomRightRadius = Tokens.BorderRadius.Sm; - input.style.paddingLeft = Tokens.Spacing.Sm; - input.style.paddingRight = Tokens.Spacing.Sm; - input.style.minHeight = 22; - input.style.height = 22; - input.style.alignItems = Align.Center; - - // Hover effect - input.RegisterCallback(static (_, element) => - { - element.style.backgroundColor = Tokens.Colors.BgHover; - }, input); - - input.RegisterCallback(static (_, element) => - { - element.style.backgroundColor = Tokens.Colors.BgInput; - }, input); - } - - // Style the object display container (icon + label) - var display = _objectField.Q(className: "unity-object-field__display"); - if (display != null) - { - display.style.alignItems = Align.Center; - display.style.height = 20; - } - - // Style the object label - ensure vertical centering - var objectLabel = _objectField.Q(className: "unity-object-field-display__label"); - if (objectLabel != null) - { - objectLabel.style.color = Tokens.Colors.TextPrimary; - objectLabel.style.fontSize = Tokens.FontSize.Sm; - objectLabel.style.unityTextAlign = TextAnchor.MiddleLeft; - objectLabel.style.alignSelf = Align.Center; - } - - // Style the icon - var icon = _objectField.Q(className: "unity-object-field-display__icon"); - if (icon != null) - { - icon.style.alignSelf = Align.Center; - } - - // Hide the field label if present - var label = _objectField.Q