compote-ui 0.74.0 → 0.74.2

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.
@@ -290,7 +290,7 @@
290
290
  : allOptions}
291
291
  {@const selected = getSelectValues(column)}
292
292
  <div class="flex flex-col gap-1">
293
- <Field.Root>
293
+ <Field.Root hideMessageLine>
294
294
  <Field.Input
295
295
  placeholder="Search..."
296
296
  value={search}
@@ -325,7 +325,7 @@
325
325
  </ScrollArea.Root>
326
326
  </div>
327
327
  {:else}
328
- <Field.Root>
328
+ <Field.Root hideMessageLine>
329
329
  <Field.Input
330
330
  placeholder="Search..."
331
331
  value={localText[column.id] ?? ''}
@@ -37,7 +37,7 @@
37
37
  }
38
38
  </script>
39
39
 
40
- <Field.Root class={cn(className)}>
40
+ <Field.Root class={cn(className)} hideMessageLine>
41
41
  <Field.Input {placeholder} value={globalFilter} oninput={handleInput}>
42
42
  {#snippet startIcon()}
43
43
  <PhMagnifyingGlass class="size-4" />
@@ -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;
@@ -120,7 +120,7 @@
120
120
  {/snippet}
121
121
  </TreeView.Context>
122
122
  <div class="flex-1">
123
- <Field.Root>
123
+ <Field.Root hideMessageLine>
124
124
  <Field.Input bind:value={searchTerm} placeholder="Search...">
125
125
  {#snippet startIcon()}
126
126
  <PhMagnifyingGlass />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.74.0",
3
+ "version": "0.74.2",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev --open",
@@ -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