Skip to content

Commit edc8a41

Browse files
committed
feat: working single example with new dot notation
1 parent decc1ec commit edc8a41

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

apps/website/src/routes/docs/headless/checkbox/examples/pizza.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { component$, useSignal, useStyles$ } from '@builder.io/qwik';
2-
import { Checkbox } from '@qwik-ui/headless';
2+
import { Checkbox, Checklist } from '@qwik-ui/headless';
33
const toppingNames = ['hot peppers', 'ham', 'pineaple', 'mushroom'];
44
const toppingImages = ['🌶️', '🍗', '🍍', '🍄'];
55
export default component$(() => {
66
return (
77
<>
88
<h3 id="pizza-toppings">Pizza toppings</h3>
9-
<CheckList ariaLabeledBy="pizza-toppings" class="flex flex-col gap-4">
9+
<Checklist.Root ariaLabeledBy="pizza-toppings" class="flex flex-col gap-4">
1010
<Checkbox.Root
1111
class="flex items-center gap-3 border-2 border-black p-2"
1212
checkList={true}
@@ -26,14 +26,14 @@ export default component$(() => {
2626
{toppingNames.map((name, i) => {
2727
return (
2828
<Checkbox.Root class="ml-8 flex items-center gap-3 border-2 border-black p-2">
29-
<CheckboxIndicator class="flex h-[25px] w-[25px] items-center justify-center bg-slate-600">
29+
<Checkbox.Indicator class="flex h-[25px] w-[25px] items-center justify-center bg-slate-600">
3030
{toppingImages[i]}
31-
</CheckboxIndicator>
31+
</Checkbox.Indicator>
3232
{name}
3333
</Checkbox.Root>
3434
);
3535
})}
36-
</CheckList>
36+
</Checklist.Root>
3737
</>
3838
);
3939
});

apps/website/src/routes/docs/headless/checkbox/examples/test-list.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { component$, useSignal, useStyles$ } from '@builder.io/qwik';
2-
import { CheckboxIndicator } from 'packages/kit-headless/src/components/checkbox/checkbox-indicator';
3-
import { Checkbox } from 'packages/kit-headless/src/components/checkbox/checkbox';
4-
import { CheckList } from 'packages/kit-headless/src/components/checkbox/checklist';
5-
import { Checkbox } from '@qwik-ui/headless';
2+
import { Checkbox, Checklist } from '@qwik-ui/headless';
63
export default component$(() => {
74
return (
85
<>
96
<h3 id="test123">Pick a cat</h3>
107

11-
<CheckList class="flex flex-col gap-3" ariaLabeledBy="test123">
8+
<Checklist.Root class="flex flex-col gap-3" ariaLabeledBy="test123">
129
<Checkbox.Root
1310
class="flex items-center gap-3 bg-slate-900 p-2 text-white"
1411
checkList={true}
@@ -27,17 +24,17 @@ export default component$(() => {
2724
</Checkbox.Root>
2825

2926
<Checkbox.Root class="flex items-center gap-3 bg-slate-900 pr-2 text-white">
30-
<CheckboxIndicator class="w-fit bg-slate-600"></CheckboxIndicator>
27+
<Checkbox.Indicator class="w-fit bg-slate-600"></Checkbox.Indicator>
3128
<p>Cat One</p>
3229
</Checkbox.Root>
3330

3431
<Checkbox.Root class="bg-slate-900 text-white">
3532
<div class="flex items-center gap-3">
36-
<CheckboxIndicator class="w-fit bg-slate-600"></CheckboxIndicator>
33+
<Checkbox.Indicator class="w-fit bg-slate-600"></Checkbox.Indicator>
3734
<p>Cat Two</p>
3835
</div>
3936
</Checkbox.Root>
40-
</CheckList>
37+
</Checklist.Root>
4138
</>
4239
);
4340
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type JSXNode, Component, PropsOf } from '@builder.io/qwik';
2-
import { Checkbox, type MixedStateCheckboxProps } from '../checkbox/checkbox';
2+
import { CheckboxRoot, type MixedStateCheckboxProps } from '../checkbox/checkbox';
33
import { ChecklistContextWrapper, getTriBool } from './checklist-context-wrapper';
44

55
type CheckListProps = PropsOf<'ul'> & { ariaLabeledBy: string };
@@ -34,7 +34,7 @@ export const Checklist: Component<CheckListProps> = (props: CheckListProps) => {
3434
}
3535

3636
switch (child.type) {
37-
case Checkbox: {
37+
case CheckboxRoot: {
3838
const typedProps = child.props as MixedStateCheckboxProps;
3939
// FYI: Obj.assign mutates
4040
Object.assign(typedProps, { _useCheckListContext: true });

packages/kit-headless/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export * as Checkbox from './components/checkbox';
2-
export * as Checklist from './components/checklist/checklist';
2+
export * as Checklist from './components/checklist';
33
export * as Accordion from './components/accordion/';
44
export * as Carousel from './components/carousel';
55
export * as Collapsible from './components/collapsible';

0 commit comments

Comments
 (0)