Skip to content

Commit 8c07ff7

Browse files
update changelog
1 parent 96438cc commit 8c07ff7

File tree

5 files changed

+58
-9
lines changed

5 files changed

+58
-9
lines changed

.changeset/two-glasses-fix.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,44 @@
22
'@qwik-ui/headless': minor
33
---
44

5+
### Accordion
6+
7+
The Accordion has been refactored from the ground up to be more accessible and performant.
8+
9+
The entire Qwik UI library now does not execute code until interaction.
10+
11+
#### Accordion.Root
12+
13+
- The `behavior="multi"` prop has been replaced with `multiple` on the `<Accordion.Root />` component.
14+
15+
- The default behavior is a single item open at a time.
16+
17+
- The `animated` prop has been deprecated. Animation entry and exit are now automatically handled by the component.
18+
19+
- `onSelectIndexChange$` has been deprecated in favor of `onChange$`.
20+
21+
- `onFocusIndexChange$` has been deprecated
22+
23+
- Reactively control the accordion with the `bind:value` prop.
24+
25+
- Control the initial value with the `value` prop.
26+
27+
- Disable the entire accordion by using the `disabled` prop.
28+
29+
#### Accordion.Item
30+
31+
- Pass distinct values to the `<Accordion.Item />` component with the `value` prop.
32+
33+
- Disable Accordion items by setting the `disabled` prop to true on the `<Accordion.Item />` component.
34+
35+
For more information, please refer to the updated Accordion documentation.
36+
37+
### Collapsible
38+
39+
- The `onOpenChange$` prop has been deprecated. Use the `onChange$` prop instead.
40+
41+
For more information, please refer to the updated Collapsible documentation.
42+
543
### Deprecated Components
644

745
In 0.4, we have deprecated the following headless components:

apps/website/src/routes/docs/headless/accordion/index.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,20 +199,15 @@ You have custom control over how to render items in the Accordion, allowing for
199199
<APITable
200200
propDescriptors={[
201201
{
202-
name: 'multiple',
203-
type: 'boolean',
204-
description: 'Allows multiple items to be expanded.',
202+
name: 'value',
203+
type: 'string',
204+
description: 'The initial selectedd item of the accordion.',
205205
},
206206
{
207207
name: 'bind:value',
208208
type: 'Signal',
209209
description: 'Reactive signal that controls the selected item.',
210210
},
211-
{
212-
name: 'initialIndex',
213-
type: 'number',
214-
description: 'Index of the initially expanded item.',
215-
},
216211
{
217212
name: 'onChange$',
218213
type: 'function',
@@ -228,6 +223,11 @@ You have custom control over how to render items in the Accordion, allowing for
228223
type: 'boolean',
229224
description: 'Allows items to be collapsible.',
230225
},
226+
{
227+
name: 'multiple',
228+
type: 'boolean',
229+
description: 'Allows multiple items to be expanded.',
230+
},
231231
]}
232232
/>
233233

packages/kit-headless/src/components/accordion/accordion-item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const HAccordionItem = component$(
104104
id={itemId}
105105
disabled={context.disabled || props.disabled}
106106
collapsible={context.collapsible}
107+
accordionItem
107108
{...props}
108109
>
109110
<Slot />

packages/kit-headless/src/components/collapsible/collapsible-content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const HCollapsibleContent = component$((props: CollapsibleContentProps) =
4141

4242
/* check if there's a transition or animation */
4343
const { animationDuration, transitionDuration } = getComputedStyle(
44-
context.contentRef.value!,
44+
context.contentRef.value,
4545
);
4646

4747
// don't animate if initially open

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type CollapsibleProps = PropsOf<'div'> & {
2424
disabled?: boolean;
2525
triggerRef?: Signal<HTMLButtonElement>;
2626
collapsible?: boolean;
27+
accordionItem?: boolean;
2728
};
2829

2930
export const HCollapsible = component$((props: CollapsibleProps) => {
@@ -36,6 +37,7 @@ export const HCollapsible = component$((props: CollapsibleProps) => {
3637
triggerRef: givenTriggerRef,
3738
collapsible = true,
3839
open,
40+
accordionItem,
3941
...rest
4042
} = props;
4143

@@ -78,6 +80,14 @@ export const HCollapsible = component$((props: CollapsibleProps) => {
7880
'--qwikui-collapsible-content-height',
7981
`${contentHeightSig.value}px`,
8082
);
83+
84+
// support previous accordion animations
85+
if (accordionItem) {
86+
contentRef.value.style.setProperty(
87+
'--qwikui-accordion-content-height',
88+
`${contentHeightSig.value}px`,
89+
);
90+
}
8191
}
8292
});
8393

0 commit comments

Comments
 (0)