compote-ui 0.74.0 → 0.74.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
field,
|
|
9
9
|
helperText,
|
|
10
10
|
errorText,
|
|
11
|
+
hideMessageLine = false,
|
|
11
12
|
class: className,
|
|
12
13
|
invalid,
|
|
13
14
|
required,
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
<Field.ErrorText>{resolvedError}</Field.ErrorText>
|
|
38
39
|
{:else if helperText}
|
|
39
40
|
<Field.HelperText>{helperText}</Field.HelperText>
|
|
40
|
-
{:else}
|
|
41
|
+
{:else if !hideMessageLine}
|
|
41
42
|
<!--
|
|
42
43
|
Holds the message line open so a field does not change height when an
|
|
43
44
|
error appears. `1lh` resolves against this element's own line-height, so
|
|
@@ -19,6 +19,13 @@ export interface FieldRootProps extends FieldRootBaseProps {
|
|
|
19
19
|
* for `invalid` and `required`.
|
|
20
20
|
*/
|
|
21
21
|
errorText?: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to drop the spacer that otherwise holds the message line open
|
|
24
|
+
* when there is no error or helper text to show. Defaults to `false`. Set
|
|
25
|
+
* to `true` for a field that never surfaces validation (a toolbar search
|
|
26
|
+
* box, say), so it doesn't reserve height it will never use.
|
|
27
|
+
*/
|
|
28
|
+
hideMessageLine?: boolean;
|
|
22
29
|
}
|
|
23
30
|
export interface FieldLabelProps extends FieldLabelBaseProps {
|
|
24
31
|
class?: ClassValue;
|
package/package.json
CHANGED
|
@@ -36,7 +36,14 @@ genuinely need several, `<Field.ErrorText>` children still work.
|
|
|
36
36
|
|
|
37
37
|
The message line is **always held open**, so a field never changes height when an error appears and
|
|
38
38
|
nothing below it moves. Errors and `helperText` share that line — an error replaces the helper
|
|
39
|
-
rather than stacking under it.
|
|
39
|
+
rather than stacking under it. For a field that never surfaces validation (a toolbar search box,
|
|
40
|
+
say), pass `hideMessageLine` to drop the spacer entirely:
|
|
41
|
+
|
|
42
|
+
```svelte
|
|
43
|
+
<Field.Root hideMessageLine>
|
|
44
|
+
<Field.Input bind:value={search} placeholder="Search..." />
|
|
45
|
+
</Field.Root>
|
|
46
|
+
```
|
|
40
47
|
|
|
41
48
|
List controls use `{ value, label }` items:
|
|
42
49
|
|