Skip to content

Commit 093833e

Browse files
thejacksheltonwmertens
authored andcommitted
docs(combobox): adding initial docs for autocomplete config
1 parent 4c6142b commit 093833e

File tree

6 files changed

+44
-11
lines changed

6 files changed

+44
-11
lines changed

apps/website/src/routes/docs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
}
4444

4545
blockquote {
46-
@apply bg-[#BFDBFE] dark:bg-[#312E81] p-4 border-l-[3px] dark:border-[#F3F3F3] border-[#333333] rounded-sm;
46+
@apply bg-[#BFDBFE] dark:bg-[#312E81] p-4 border-l-[3px] dark:border-[#F3F3F3] border-[#333333] rounded-sm my-4;
4747
}
4848

4949
ul {

apps/website/src/routes/docs/_components/code-example/code-example.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { component$, Slot } from '@builder.io/qwik';
22

3-
export const CodeExample = component$(() => {
3+
export const CodeExample = component$((props: { classes?: string }) => {
44
return (
5-
<div class="p-12 mb-6 rounded-xl bg-slate-900">
5+
<div class={`p-12 mb-6 rounded-xl bg-slate-900 ${props.classes}`}>
66
<section class="overflow-x-auto">
77
<Slot />
88
</section>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Qwik UI's Accordion implementation follows the [WAI-Aria](https://www.w3.org/WAI
101101
- Animatable, dynamic, and resumable.
102102

103103
<div class="mb-6 flex flex-col gap-2">
104-
[View Source Code ↗️](https://github.com/qwikifiers/qwik-ui/tree/main/packages/kit-headless/src/components/accordion)
104+
[View Source Code ↗️](https://github.com/qwikifiers/qwik-ui/tree/main/packages/kit-headless/src/components/accordion)
105105

106106
[Report an issue 🚨](https://github.com/qwikifiers/qwik-ui/issues)
107107

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const objectExample: Array<Trainer> = [
4444
{ testValue: 'joseph', testLabel: 'Joseph', disabled: false }
4545
];
4646

47-
export const Example01 = component$(() => {
47+
export const HeroExample = component$(() => {
4848
const stringsExampleSig = useSignal(stringsExample);
4949
const objectExampleSig = useSignal(objectExample);
5050
const isComboboxVisibleSig = useSignal(true);

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

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
ComboboxOption,
1212
} from '@qwik-ui/headless';
1313

14-
import { Example01, StringCombobox, Example03 } from './examples';
14+
import { HeroExample, StringCombobox, Example03 } from './examples';
1515
import { CodeExample } from '../../../_components/code-example/code-example';
1616
import { KeyboardInteractionTable } from '../../../_components/keyboard-interaction-table/keyboard-interaction-table';
1717
import { APITable } from '../../../_components/api-table/api-table';
@@ -26,7 +26,7 @@ import {statusByComponent} from '../../../../../_state/component-statuses';
2626

2727
{' '}
2828

29-
<Example01>
29+
<HeroExample>
3030
```tsx
3131
<Combobox class="relative text-white">
3232
<ComboboxLabel class="text-inherit font-semibold">
@@ -63,7 +63,40 @@ import {statusByComponent} from '../../../../../_state/component-statuses';
6363
</ComboboxPortal>
6464
</Combobox>
6565
```
66-
</Example01>
66+
</HeroExample>
67+
68+
<div class="bg-[#9A3412] p-4 rounded-sm border-l-[3px] dark:border-[#F3F3F3] border-[#333333]">
69+
<p class="pb-4">The Combobox component makes use of **portals**. A basic use case for a portal is to prevent overflow issues in your UI. To support portals in Qwik UI, please add the following around your layout.tsx.</p>
70+
<CodeExample classes="!mb-0 !p-6 !rounded-md">
71+
```tsx
72+
<body>
73+
<QwikUIProvider>
74+
<slot />
75+
</QwikUIProvider>
76+
</body>
77+
```
78+
</CodeExample>
79+
</div>
80+
81+
> In Beta, we're currently supporting the **Autocomplete** configuration. We aim to support other combobox configurations according to our [roadmap](https://github.com/qwikifiers/qwik-ui/issues/405)
82+
83+
##### ✨ Features
84+
85+
- Full keyboard navigation.
86+
- Single or Multi Accordion.
87+
- Controlled or uncontrolled.
88+
- Animatable, dynamic, and resumable.
89+
90+
Qwik UI's Combobox implementation follows the [WAI-Aria](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) design pattern, along with some additional API's that enhance the flexibility, types, and performance.
91+
92+
<div class="mb-6 flex flex-col gap-2">
93+
[View Source Code ↗️](https://github.com/qwikifiers/qwik-ui/tree/main/packages/kit-headless/src/components/combobox)
94+
95+
[Report an issue 🚨](https://github.com/qwikifiers/qwik-ui/issues)
96+
97+
[Edit This Page 🗒️](<https://github.com/qwikifiers/qwik-ui/edit/main/apps/website/src/routes/docs/headless/(components)/combobox/index.mdx>)
98+
99+
</div>
67100

68101
## Building blocks
69102

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const ComboboxInput = component$(({ ...props }: ComboboxInputProps) => {
2828
const inputId = `${context.localId}-input`;
2929
const listboxId = `${context.localId}-listbox`;
3030

31-
const isDefaultLabelNeeded = useSignal<boolean>(true);
31+
const isDefaultLabelNeededSig = useSignal<boolean>(true);
3232

3333
const onKeydownBehavior$ = $((e: QwikKeyboardEvent) => {
3434
const highlightedOptionLabel = getOptionLabel(
@@ -97,7 +97,7 @@ export const ComboboxInput = component$(({ ...props }: ComboboxInputProps) => {
9797
}
9898

9999
if (context.inputRef.value.value === context.defaultLabel) {
100-
isDefaultLabelNeeded.value = false;
100+
isDefaultLabelNeededSig.value = false;
101101
}
102102
});
103103

@@ -152,7 +152,7 @@ export const ComboboxInput = component$(({ ...props }: ComboboxInputProps) => {
152152
context.onInputChange$(inputElement.value);
153153
}
154154
}}
155-
value={isDefaultLabelNeeded && context.defaultLabel}
155+
value={isDefaultLabelNeededSig && context.defaultLabel}
156156
onBlur$={() => (context.isListboxOpenSig.value = false)}
157157
onKeyDown$={[onKeydownBehavior$, props.onKeyDown$]}
158158
{...props}

0 commit comments

Comments
 (0)