diff --git a/resources/css/components.css b/resources/css/components.css index 744b244a..ccf4f998 100644 --- a/resources/css/components.css +++ b/resources/css/components.css @@ -18,6 +18,7 @@ @import './components/field.css'; @import './components/input.css'; @import './components/password.css'; +@import './components/textarea.css'; /* Containment */ diff --git a/resources/css/components/field.css b/resources/css/components/field.css index 79536af4..89648471 100644 --- a/resources/css/components/field.css +++ b/resources/css/components/field.css @@ -138,35 +138,6 @@ transition: background-color 604800s, color 604800s; } - /* The browser draws the resize grip in the textarea's own corner, so the - textarea reaches to just inside the outline's end and bottom — the grip sits - in the field's corner, not on the bottom outline a padding in from it — and - its padding puts the text back where it was. */ - textarea[data-md-field-control] { - --field-grip: var(--md-sys-measurement-space50); - - /* The first half-line of the top offset is a margin, not padding: text scrolled up in a full - textarea disappears under the edge instead of running through the label. */ - --textarea-clear: var(--md-sys-measurement-space100); - --textarea-pad-top: calc((var(--field-height) - 1.5rem) / 2 - var(--textarea-clear)); - --textarea-pad-bottom: calc((var(--field-height) - 1.5rem) / 2 - var(--field-grip)); - - margin-block: var(--textarea-clear) var(--field-grip); - margin-inline-end: calc(var(--field-grip) - var(--field-pad)); - padding-block: var(--textarea-pad-top) var(--textarea-pad-bottom); - padding-inline-end: calc(var(--field-pad) - var(--field-grip)); - resize: vertical; - } - - /* `` grows with what is typed, from `rows` lines up to `max-rows`. Where the browser - cannot size a field to its content, resources/js/field.js sets the height instead. */ - textarea[data-md-field-control][data-md-autogrow] { - field-sizing: content; - min-block-size: calc(var(--field-rows, 3) * 1.5rem + var(--textarea-pad-top) + var(--textarea-pad-bottom)); - max-block-size: calc(var(--field-max-rows, 1000) * 1.5rem + var(--textarea-pad-top) + var(--textarea-pad-bottom)); - resize: none; - } - /* A select covers its whole field — out over the padding and the leading icon at the start, under the arrow to the end — and its own padding puts the value back where it was. So a press anywhere on the field opens it, and the list, which @@ -413,11 +384,6 @@ font: var(--md-sys-typescale-body-md); } - /* A textarea's label rests on its first line, not in the middle of the box. */ - [data-md-field]:not([data-md-floated]):has([data-md-field-label]):has(textarea[data-md-field-control]:placeholder-shown):not(:focus-within) [data-md-field-label] { - top: calc(var(--field-height) / 2); - } - [data-md-field]:has([data-md-field-label]):not(:focus-within) [data-md-field-control]::placeholder { color: transparent; } @@ -561,14 +527,6 @@ padding-block: var(--md-sys-measurement-space300) var(--md-sys-measurement-space100); } - [data-md-field][data-md-variant='filled']:has([data-md-field-label]) textarea[data-md-field-control] { - --textarea-clear: var(--md-sys-measurement-space300); - --textarea-pad-top: 0px; - --textarea-pad-bottom: calc(var(--md-sys-measurement-space100) - var(--field-grip)); - - padding-block: var(--textarea-pad-top) var(--textarea-pad-bottom); - } - /* A file picker's button is taller than a line of text: it sits lower, and a little smaller. */ [data-md-field][data-md-variant='filled']:has([data-md-field-label]) input[type='file'][data-md-field-control] { padding-block: 22px var(--md-sys-measurement-space75); diff --git a/resources/css/components/textarea.css b/resources/css/components/textarea.css new file mode 100644 index 00000000..7701cbbc --- /dev/null +++ b/resources/css/components/textarea.css @@ -0,0 +1,63 @@ +/* + * : the text field grown to several lines (resources/views/components/textarea.blade.php). + * + * The chrome is the field's (components/field.css); this file is what a