Skip to content

Commit 5af8083

Browse files
Merge pull request #416 from thejackshelton/feat-combobox
fix(combobox): removing extra ref api
2 parents 792ace0 + 73c5f1f commit 5af8083

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

apps/website/src/routes/docs/headless/(components)/combobox/examples.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,6 @@ export const ContextChild = component$(() => {
11731173
export const SearchBar = component$(() => {
11741174
const inputValueSig = useSignal('');
11751175
const highlightedIndexSig = useSignal(0);
1176-
const inputRef = useSignal<HTMLInputElement>();
11771176
const isListboxOpenSig = useSignal(false);
11781177

11791178
type MyComponents = {
@@ -1199,7 +1198,6 @@ export const SearchBar = component$(() => {
11991198
<div>
12001199
<Combobox
12011200
bind:inputValueSig={inputValueSig}
1202-
bind:inputRef={inputRef}
12031201
bind:highlightedIndexSig={highlightedIndexSig}
12041202
bind:isListboxOpenSig={isListboxOpenSig}
12051203
optionValueKey="component"
@@ -1228,7 +1226,6 @@ export const SearchBar = component$(() => {
12281226
aria-label="clear search"
12291227
onMouseDown$={() => {
12301228
inputValueSig.value = '';
1231-
inputRef.value?.focus();
12321229
}}
12331230
class="w-6 h-6 flex justify-center items-center absolute top-0 right-0"
12341231
>

apps/website/src/routes/docs/headless/(components)/combobox/index.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,11 +1103,6 @@ This involves creating a signal and passing it in using the [bind syntax](https:
11031103
type: 'Signal',
11041104
description: 'Controls the current value of the input.',
11051105
},
1106-
{
1107-
name: 'bind:inputRef',
1108-
type: 'Signal',
1109-
description: 'Controls the reference of the input.',
1110-
},
11111106
]}
11121107
/>
11131108

packages/kit-headless/src/components/combobox/combobox.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export type ComboboxProps<O extends Option = Option> = {
4848
'bind:isInputFocusedSig'?: Signal<boolean | undefined>;
4949
'bind:inputValueSig'?: Signal<string>;
5050
'bind:highlightedIndexSig'?: Signal<number>;
51-
'bind:inputRef'?: Signal<HTMLInputElement | undefined>;
5251
} & QwikIntrinsicElements['div'];
5352

5453
export const Combobox = component$(
@@ -58,7 +57,6 @@ export const Combobox = component$(
5857
'bind:isInputFocusedSig': givenInputFocusedSig,
5958
'bind:inputValueSig': givenInputValueSig,
6059
'bind:highlightedIndexSig': givenHighlightedIndexSig,
61-
'bind:inputRef': givenInputRef,
6260
options,
6361
defaultLabel = '',
6462
optionValueKey = 'value',
@@ -127,8 +125,7 @@ export const Combobox = component$(
127125

128126
const labelRef = useSignal<HTMLLabelElement>();
129127
const listboxRef = useSignal<HTMLUListElement>();
130-
const defaultInputRef = useSignal<HTMLInputElement>();
131-
const inputRef = givenInputRef || defaultInputRef;
128+
const inputRef = useSignal<HTMLInputElement>();
132129

133130
const triggerRef = useSignal<HTMLButtonElement>();
134131

0 commit comments

Comments
 (0)