@@ -12,6 +12,7 @@ A custom Unity UI component library for MapColonies projects with built-in Hebre
1212- [ Package Structure] ( #package-structure )
1313- [ UI Components] ( #ui-components )
1414 - [ YahalomButton] ( #yahalombutton )
15+ - [ YahalomInputField] ( #yahalominputfield )
1516 - [ Compass] ( #compass )
1617- [ Fonts] ( #fonts )
1718- [ Testing] ( #testing )
@@ -47,11 +48,15 @@ YahalomUIPackage/
4748├── Runtime/
4849│ ├── YahalomButton/
4950│ │ └── YahalomButton.cs # Button component script
51+ │ ├── YahalomInputField/
52+ │ │ └── YahalomInputField.cs # Input field component script
5053│ ├── Compass/
5154│ │ └── Compass.cs # Compass component script
5255│ └── Resources/
5356│ ├── YahalomButton/
5457│ │ └── YahalomButton.prefab # Button prefab
58+ │ ├── YahalomInputField/
59+ │ │ └── YahalomInputField.prefab # Input field prefab
5560│ └── Compass/
5661│ └── Compass.prefab # Compass prefab
5762├── Editor/
@@ -123,6 +128,79 @@ YahalomButton (Button, Image, HorizontalLayoutGroup)
123128
124129---
125130
131+ ### YahalomInputField
132+
133+ A customizable input field component with state-based color transitions, error validation support, and a clear button.
134+
135+ ** Location:** ` Runtime/YahalomInputField/YahalomInputField.cs `
136+ ** Prefab:** ` Runtime/Resources/YahalomInputField/YahalomInputField.prefab `
137+
138+ #### Features
139+
140+ - Extends Unity's ` TMP_InputField ` class
141+ - State-based text and placeholder color transitions
142+ - Built-in error state with custom validation predicate
143+ - Clear/close button to reset input content
144+ - RTL text support via TextMeshPro
145+
146+ #### Input States
147+
148+ | State | Description |
149+ | -------| -------------|
150+ | Normal | Default appearance |
151+ | Highlighted | Hover/focus state |
152+ | Pressed | Click/tap state |
153+ | Selected | Active/selected state with content |
154+ | Disabled | Inactive state |
155+ | Error | Validation failed state |
156+
157+ #### Usage
158+
159+ ** Adding to Scene:**
160+
161+ 1 . ** Via Prefab:** Drag ` YahalomInputField.prefab ` from ` Runtime/Resources/YahalomInputField/ ` into your Canvas
162+ 2 . ** Via Code:**
163+ ``` csharp
164+ var inputPrefab = Resources .Load <GameObject >(" YahalomInputField/YahalomInputField" );
165+ var inputField = Instantiate (inputPrefab , parentCanvas .transform );
166+ ```
167+
168+ ** Setting Up Error Validation:**
169+
170+ ``` csharp
171+ using YahalomUIPackage .Runtime .YahalomInputField ;
172+
173+ // Get reference to input field component
174+ YahalomInputField inputField = GetComponent <YahalomInputField >();
175+
176+ // Set custom error validation (e.g., minimum length)
177+ inputField .SetErrorPredicate (value => value .Length < 3 );
178+
179+ // Or validate email format
180+ inputField .SetErrorPredicate (value => ! value .Contains (" @" ));
181+ ```
182+
183+ #### Public API
184+
185+ | Method | Parameters | Description |
186+ | --------| ------------| -------------|
187+ | ` SetErrorPredicate(Func<string, bool>) ` | ` predicate ` : validation function | Sets the error validation function. Returns true if input is invalid. |
188+
189+ #### Inspector Properties
190+
191+ | Property | Description |
192+ | ----------| -------------|
193+ | Close Button | Reference to the clear/delete button |
194+ | Normal Text Color | Text color in default state |
195+ | Highlighted Text Color | Text color when focused/hovered |
196+ | Pressed Text Color | Text color when pressed |
197+ | Selected Text Color | Text color when selected with content |
198+ | Disabled Text Color | Text color when disabled |
199+ | Error Text Color | Text color in error state |
200+ | Error Image Color | Background color in error state |
201+
202+ ---
203+
126204### Compass
127205
128206A navigation compass component displaying heading direction, angle, and geographic coordinates.
@@ -225,6 +303,35 @@ These fonts are pre-configured as TextMesh Pro SDF assets for high-quality text
225303- Observe text and icon color changes between states
226304- Adjust fade duration to test transition smoothness
227305
306+ ### Testing YahalomInputField
307+
308+ 1 . Create a Canvas in your scene
309+ 2 . Drag the ` YahalomInputField.prefab ` into the Canvas
310+ 3 . Enter Play Mode
311+ 4 . Interact with the input field to verify:
312+ - Focus state (click on input)
313+ - Text input and color changes
314+ - Clear button functionality (click X to clear text)
315+ - Disabled state (disable via Inspector)
316+
317+ ** Testing Error Validation:**
318+
319+ ``` csharp
320+ using UnityEngine ;
321+ using YahalomUIPackage .Runtime .YahalomInputField ;
322+
323+ public class InputFieldTester : MonoBehaviour
324+ {
325+ public YahalomInputField inputField ;
326+
327+ void Start ()
328+ {
329+ // Set validation: error if less than 3 characters
330+ inputField .SetErrorPredicate (value => value .Length > 0 && value .Length < 3 );
331+ }
332+ }
333+ ```
334+
228335### Testing Compass
229336
2303371 . Create a Canvas in your scene
@@ -299,6 +406,32 @@ public class YahalomButton : Button
299406}
300407```
301408
409+ ### YahalomInputField
410+
411+ ** Namespace:** ` YahalomUIPackage.Runtime.YahalomInputField `
412+
413+ ``` csharp
414+ public class YahalomInputField : TMP_InputField
415+ {
416+ // Public Methods
417+ public void SetErrorPredicate (Func <string , bool > predicate );
418+
419+ // Serialized Fields (configurable in Inspector)
420+ [SerializeField ] private Button _closeButton ;
421+
422+ // Text color states
423+ [SerializeField ] private Color _normalTextColor ;
424+ [SerializeField ] private Color _highlightedTextColor ;
425+ [SerializeField ] private Color _pressedTextColor ;
426+ [SerializeField ] private Color _selectedTextColor ;
427+ [SerializeField ] private Color _disabledTextColor ;
428+ [SerializeField ] private Color _errorTextColor ;
429+
430+ // Image color states
431+ [SerializeField ] private Color _errorImageColor ;
432+ }
433+ ```
434+
302435### Compass
303436
304437** Namespace:** ` YahalomUIPackage.Runtime.Compass `
0 commit comments