Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/cuddly-readers-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@qwik-ui/headless': patch
---

fix: packages now have a variable range of peer dependencies

fix: async computed signals are now sync in preparation for v2
2 changes: 1 addition & 1 deletion packages/kit-headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"private": false,
"peerDependencies": {
"@builder.io/qwik": "^1.9"
"@builder.io/qwik": ">=1.9"
},
"dependencies": {
"@floating-ui/core": "^1.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const HComboboxInput = component$(
getActiveDescendant$,
} = useCombobox();

const activeDescendantSig = useComputed$(async () => {
const activeDescendantSig = useComputed$(() => {
if (context.isListboxOpenSig.value) {
return getActiveDescendant$(context.highlightedIndexSig.value ?? -1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const HSelectDisplayValue = component$((props: SelectValueProps) => {
const context = useContext(SelectContextId);
const valueId = `${context.localId}-value`;

const displayStrSig = useComputed$(async () => {
const displayStrSig = useComputed$(() => {
if (context.multiple) {
// for more customization when multiple is true
return <Slot />;
Expand Down
22 changes: 7 additions & 15 deletions packages/kit-headless/src/hooks/combined-refs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Signal, useSignal, useTask$, $, useComputed$ } from '@builder.io/qwik';
import { Signal, useSignal, useTask$, useComputed$ } from '@builder.io/qwik';

/* This hook merges a consumer passed ref with our internal ref. It allows consumers to pass a reference to the component and get access to the underlying element. */

Expand All @@ -13,26 +13,18 @@ export function useCombinedRef(externalRef: any, ctxOpts?: CtxOpts) {
// we create a ref in case the consumer does not pass a ref
const internalRef = useSignal<HTMLElement>();

/** Grab the key name so it updates context Ex: context.triggerRef => triggerRef */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getContextKey = $((context: any, ref: Signal): string | undefined => {
for (const key in context) {
if (context[key] === ref) {
// we get the ref from the context if it exists
const ctxRefNameSig = useComputed$(() => {
if (!ctxOpts?.context || !ctxOpts?.givenContextRef) return;

for (const key in ctxOpts.context) {
if (ctxOpts.context[key] === ctxOpts.givenContextRef) {
return key;
}
}
return undefined;
});

// we get the ref from the context if it exists
const ctxRefNameSig = useComputed$(async () => {
if (!ctxOpts?.context) return;

return (
ctxOpts?.givenContextRef &&
(await getContextKey(ctxOpts.context, ctxOpts.givenContextRef))
);
});
const contextRefExists = ctxRefNameSig.value !== undefined;
const contextRef = contextRefExists && ctxOpts?.context?.[ctxRefNameSig.value!];

Expand Down
2 changes: 1 addition & 1 deletion packages/kit-styled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"private": false,
"scripts": {},
"peerDependencies": {
"@builder.io/qwik": "^1.9"
"@builder.io/qwik": ">=1.9"
},
"devDependencies": {
"@qwik-ui/headless": "^0.6.0",
Expand Down
18,480 changes: 10,135 additions & 8,345 deletions pnpm-lock.yaml

Large diffs are not rendered by default.