diff --git a/src/uix/eidos/components/search-field/search-field-input.svelte b/src/uix/eidos/components/search-field/search-field-input.svelte index e03b2cc5d..6b72f7553 100644 --- a/src/uix/eidos/components/search-field/search-field-input.svelte +++ b/src/uix/eidos/components/search-field/search-field-input.svelte @@ -2,9 +2,9 @@ import * as SearchField from '$soma/components/search-field'; import type { SearchFieldInputProps } from './types'; - let { children, ...rest }: SearchFieldInputProps = $props(); + let { ref = $bindable(null), children, ...rest }: SearchFieldInputProps = $props(); - + {@render children?.()} diff --git a/src/uix/eidos/components/search-field/search-field.css b/src/uix/eidos/components/search-field/search-field.css index 948ddd0c6..cadf478a1 100644 --- a/src/uix/eidos/components/search-field/search-field.css +++ b/src/uix/eidos/components/search-field/search-field.css @@ -140,6 +140,21 @@ outline: none; } +/* Hide the browser's native clear button for `` — + * the canonical clear affordance is ``. Covers + * WebKit/Blink (cancel + decoration) and Edge legacy (ms-clear). */ +[data-search-field-input]::-webkit-search-cancel-button, +[data-search-field-input]::-webkit-search-decoration { + -webkit-appearance: none; + appearance: none; + display: none; +} +[data-search-field-input]::-ms-clear { + display: none; + inline-size: 0; + block-size: 0; +} + [data-search-field-input]::placeholder { color: var(--search-field-placeholder-color); } diff --git a/web/routes/uix/components/search-field/+page.svelte b/web/routes/uix/components/search-field/+page.svelte index 41b223a96..2409fc329 100644 --- a/web/routes/uix/components/search-field/+page.svelte +++ b/web/routes/uix/components/search-field/+page.svelte @@ -5,6 +5,8 @@ type SearchFieldSize, type SearchFieldVariant } from '$uix/eidos/components/search-field'; + import { Popover } from '$uix/eidos/components/popover'; + import { PickerShell } from '$uix/eidos/components/picker-shell'; import { Search, X } from '$uix/eidos/components/icon'; import { compileMorfo } from '$uix/morfo'; import { searchFieldMorfo } from '@/uix/morfo/components/search-field'; @@ -33,6 +35,8 @@ let lastValueChange = $state('—'); let trace = $state([]); let stageRef = $state(null); + let resultsOpen = $state(false); + let inputRef = $state(null); const compiled = compileMorfo(searchFieldMorfo); const partsList = $derived([...compiled.parts.byKebab.values()]); @@ -186,62 +190,97 @@
- { - lastValueChange = next === '' ? 'empty' : next; - lastValueChangeAt = Date.now(); - }} - onSubmit={(next) => (lastSubmit = next || 'empty')} - onClear={() => (lastSubmit = 'cleared')} - > - - - - - - + { + if (!disabled && !readonly) resultsOpen = true; + }} > - - - - - -
    - {#if results.length === 0} -
  • - No matches for "{value}" -
  • - {:else} - {#each results as item (item.name)} -
  • - {item.name} - {item.group} -
  • - {/each} - {/if} -
-
- results - {results.length} / {components.length} -
+ { + lastValueChange = next === '' ? 'empty' : next; + lastValueChangeAt = Date.now(); + if (!disabled && !readonly) resultsOpen = true; + }} + onSubmit={(next) => { + lastSubmit = next || 'empty'; + resultsOpen = false; + }} + onClear={() => { + lastSubmit = 'cleared'; + resultsOpen = false; + }} + > + + + + + + + + + + + + e.preventDefault()} + onCloseAutoFocus={(e) => e.preventDefault()} + > + + +
    + {#if results.length === 0} +
  • + No matches for "{value}" +
  • + {:else} + {#each results as item (item.name)} +
  • + +
  • + {/each} + {/if} +
+
+ results + {results.length} / {components.length} +
+
+
+
+
@@ -636,48 +675,60 @@