From 172629face7c7105e5946c674eb4f57e662c405e Mon Sep 17 00:00:00 2001 From: Andreas Reinhold / reini Date: Mon, 14 Sep 2026 14:09:58 +0200 Subject: [PATCH] Give the one-line text field its own stylesheet entry marks its field root data-md-input, and components/input.css brings what it renders, the field and its icons, so an application imports one file per component (plan step 36). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- resources/css/components.css | 1 + resources/css/components/input.css | 13 +++++++++++++ resources/views/components/input.blade.php | 7 +++++-- tests/Feature/Components/FieldTest.php | 12 +++++++++++- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 resources/css/components/input.css diff --git a/resources/css/components.css b/resources/css/components.css index e1bde6d0..e9c833ec 100644 --- a/resources/css/components.css +++ b/resources/css/components.css @@ -16,6 +16,7 @@ /* Inputs, selection and data */ @import './components/form.css'; @import './components/field.css'; +@import './components/input.css'; /* Containment */ diff --git a/resources/css/components/input.css b/resources/css/components/input.css new file mode 100644 index 00000000..5440f65f --- /dev/null +++ b/resources/css/components/input.css @@ -0,0 +1,13 @@ +/* + * : M3's one-line text field (resources/views/components/input.blade.php). + * + * Nothing of its own to draw: the outlined and filled chrome, the floating label, the prefix and + * suffix, the clear and copy buttons and the character counter are the field's + * (components/field.css), and its icons are s. The field's root carries `data-md-input` + * for an application that wants to tell a one-line field from the others. + */ + +@layer material.reset, material.tokens, material.base, material.layout, material.components, material.text, material.visibility; + +@import './field.css'; +@import './icon.css'; diff --git a/resources/views/components/input.blade.php b/resources/views/components/input.blade.php index 49815ffe..f970d5d2 100644 --- a/resources/views/components/input.blade.php +++ b/resources/views/components/input.blade.php @@ -11,7 +11,10 @@ The placeholder is a single space when none is given, because the label can only tell an empty field from a filled one through `:placeholder-shown`. With a label, a real placeholder - shows only while the field has focus — until then the label stands where it would be. --}} + shows only while the field has focus — until then the label stands where it would be. + + The field's root carries `data-md-input`; everything it draws is the field's chrome + (resources/css/components/field.css), which resources/css/components/input.css imports. --}} @props([ 'label' => null, @@ -42,7 +45,7 @@ $fieldIconSize = ['sm' => 20, 'xs' => 16][$size] ?? 24; @endphp - + except(['class', 'id', 'placeholder'])->merge(['type' => 'text']) }} id="{{ $id }}" diff --git a/tests/Feature/Components/FieldTest.php b/tests/Feature/Components/FieldTest.php index 1997bc12..d7ddeb7a 100644 --- a/tests/Feature/Components/FieldTest.php +++ b/tests/Feature/Components/FieldTest.php @@ -5,6 +5,7 @@ it('draws an outlined field with a notched label unless told otherwise', functio expect($html) ->toContain('data-md-field') + ->toContain('data-md-input') ->toContain('data-md-variant="outlined"') ->toContain('Share name') ->toMatch('/