@aria-ui/combobox
Advanced tools
Comparing version 0.0.6 to 0.0.7
import { BaseElement, ConnectableElement, SignalState } from '@aria-ui/core'; | ||
import { ListboxEmptyProps, ListboxItemProps } from '@aria-ui/listbox'; | ||
/** | ||
* A custom ComboboxRoot element. | ||
* A custom ComboboxEmpty element. | ||
* | ||
* @group ComboboxRoot | ||
* @group ComboboxEmpty | ||
*/ | ||
declare class ComboboxRootElement extends BaseElement { | ||
declare class ComboboxEmptyElement extends BaseElement { | ||
constructor(); | ||
@@ -13,15 +14,25 @@ } | ||
/** | ||
* @group ComboboxEmpty | ||
* @internal | ||
*/ | ||
interface ComboboxEmptyProps extends ListboxEmptyProps { | ||
} | ||
/** | ||
* @group ComboboxEmpty | ||
* @internal | ||
*/ | ||
declare const defaultComboboxEmptyProps: Readonly<{}>; | ||
/** | ||
* @group ComboboxEmpty | ||
*/ | ||
declare function useComboboxEmpty(element: ConnectableElement): void; | ||
/** | ||
* @group ComboboxItem | ||
*/ | ||
interface ComboboxItemProps { | ||
/** | ||
* {@inheritDoc @aria-ui/listbox!ListboxItemProps.value} | ||
* | ||
* @default "" | ||
*/ | ||
value: string; | ||
interface ComboboxItemProps extends ListboxItemProps { | ||
} | ||
/** | ||
* @group ComboboxList | ||
* | ||
* @group ComboboxItem | ||
* @internal | ||
@@ -31,2 +42,3 @@ */ | ||
value: ""; | ||
onSelect: null; | ||
}>; | ||
@@ -46,5 +58,12 @@ | ||
/** @hidden */ set value(v: ComboboxItemProps["value"]); | ||
/** @hidden */ get onSelect(): ComboboxItemProps["onSelect"]; | ||
/** @hidden */ set onSelect(v: ComboboxItemProps["onSelect"]); | ||
} | ||
/** | ||
* @group ComboboxItem | ||
*/ | ||
declare function useComboboxItem(element: ConnectableElement, props?: Partial<ComboboxItemProps>): SignalState<ComboboxItemProps>; | ||
/** | ||
* A custom ComboboxList element. | ||
@@ -59,16 +78,20 @@ * | ||
/** | ||
* @group ComboboxRoot | ||
* @group ComboboxList | ||
*/ | ||
declare function useComboboxRoot(element: ConnectableElement): void; | ||
declare function useComboboxList(element: ConnectableElement): void; | ||
/** | ||
* @group ComboboxItem | ||
* A custom ComboboxRoot element. | ||
* | ||
* @group ComboboxRoot | ||
*/ | ||
declare function useComboboxItem(element: ConnectableElement, props?: Partial<ComboboxItemProps>): SignalState<ComboboxItemProps>; | ||
declare class ComboboxRootElement extends BaseElement { | ||
constructor(); | ||
} | ||
/** | ||
* @group ComboboxList | ||
* @group ComboboxRoot | ||
*/ | ||
declare function useComboboxList(element: ConnectableElement): void; | ||
declare function useComboboxRoot(element: ConnectableElement): void; | ||
export { ComboboxItemElement, type ComboboxItemProps, ComboboxListElement, ComboboxRootElement, defaultComboboxItemProps, useComboboxItem, useComboboxList, useComboboxRoot }; | ||
export { ComboboxEmptyElement, type ComboboxEmptyProps, ComboboxItemElement, type ComboboxItemProps, ComboboxListElement, ComboboxRootElement, defaultComboboxEmptyProps, defaultComboboxItemProps, useComboboxEmpty, useComboboxItem, useComboboxList, useComboboxRoot }; |
@@ -1,12 +0,71 @@ | ||
// src/combobox-root.element.gen.ts | ||
// src/combobox-empty.element.gen.ts | ||
import { BaseElement } from "@aria-ui/core"; | ||
// src/combobox-root.state.ts | ||
// src/combobox-empty.state.ts | ||
import { useListboxEmpty } from "@aria-ui/listbox"; | ||
function useComboboxEmpty(element) { | ||
return useListboxEmpty(element); | ||
} | ||
// src/combobox-empty.element.gen.ts | ||
var ComboboxEmptyElement = class extends BaseElement { | ||
constructor() { | ||
super(); | ||
useComboboxEmpty(this); | ||
} | ||
}; | ||
// src/combobox-empty.props.ts | ||
var defaultComboboxEmptyProps = Object.freeze( | ||
{} | ||
); | ||
// src/combobox-item.element.gen.ts | ||
import { BaseElement as BaseElement2 } from "@aria-ui/core"; | ||
// src/combobox-item.state.ts | ||
import { useListboxItem } from "@aria-ui/listbox"; | ||
function useComboboxItem(element, props) { | ||
return useListboxItem(element, props); | ||
} | ||
// src/combobox-item.element.gen.ts | ||
var ComboboxItemElement = class extends BaseElement2 { | ||
constructor(props) { | ||
super(); | ||
this._s = useComboboxItem(this, props); | ||
} | ||
/** @hidden */ | ||
get value() { | ||
return this._s.value.value; | ||
} | ||
/** @hidden */ | ||
set value(v) { | ||
this._s.value.value = v; | ||
} | ||
/** @hidden */ | ||
get onSelect() { | ||
return this._s.onSelect.value; | ||
} | ||
/** @hidden */ | ||
set onSelect(v) { | ||
this._s.onSelect.value = v; | ||
} | ||
}; | ||
// src/combobox-item.props.ts | ||
import { | ||
createSignal, | ||
useAriaRole, | ||
useEffect, | ||
useQuerySelector | ||
} from "@aria-ui/core"; | ||
defaultListboxItemProps | ||
} from "@aria-ui/listbox"; | ||
var defaultComboboxItemProps = Object.freeze({ | ||
...defaultListboxItemProps | ||
}); | ||
// src/combobox-list.element.gen.ts | ||
import { BaseElement as BaseElement3 } from "@aria-ui/core"; | ||
// src/combobox-list.state.ts | ||
import { useEffect } from "@aria-ui/core"; | ||
import { useListbox } from "@aria-ui/listbox"; | ||
// src/combobox-item.context.ts | ||
@@ -23,7 +82,41 @@ import { createContext } from "@aria-ui/core"; | ||
// src/combobox-list.state.ts | ||
function useComboboxList(element) { | ||
const keydownHandler = keydownHandlerContext.consume(element); | ||
const { query } = useListbox(element, { | ||
onKeydownHandlerAdd: (handler) => { | ||
keydownHandler.value = handler; | ||
return () => { | ||
keydownHandler.value = null; | ||
}; | ||
} | ||
}); | ||
const inputValue = inputValueContext.consume(element); | ||
useEffect(element, () => { | ||
query.value = inputValue.value; | ||
}); | ||
} | ||
// src/combobox-list.element.gen.ts | ||
var ComboboxListElement = class extends BaseElement3 { | ||
constructor() { | ||
super(); | ||
useComboboxList(this); | ||
} | ||
}; | ||
// src/combobox-root.element.gen.ts | ||
import { BaseElement as BaseElement4 } from "@aria-ui/core"; | ||
// src/combobox-root.state.ts | ||
import { | ||
createSignal, | ||
useAriaRole, | ||
useEffect as useEffect2, | ||
useQuerySelector | ||
} from "@aria-ui/core"; | ||
function useInputValue(element) { | ||
const input = useQuerySelector(element, "input"); | ||
const inputValue = createSignal(""); | ||
useEffect(element, () => { | ||
useEffect2(element, () => { | ||
const inputElement = input.value; | ||
@@ -49,3 +142,3 @@ if (!inputElement) { | ||
); | ||
useEffect(element, () => { | ||
useEffect2(element, () => { | ||
const keydownHandlerValue = keydownHandler.value; | ||
@@ -68,3 +161,3 @@ if (keydownHandlerValue) { | ||
// src/combobox-root.element.gen.ts | ||
var ComboboxRootElement = class extends BaseElement { | ||
var ComboboxRootElement = class extends BaseElement4 { | ||
constructor() { | ||
@@ -75,73 +168,10 @@ super(); | ||
}; | ||
// src/combobox-item.element.gen.ts | ||
import { BaseElement as BaseElement2 } from "@aria-ui/core"; | ||
// src/combobox-item.state.ts | ||
import { | ||
useEffect as useEffect2 | ||
} from "@aria-ui/core"; | ||
import { useListboxItem } from "@aria-ui/listbox"; | ||
function useComboboxItem(element, props) { | ||
const listboxItemState = useListboxItem(element, { | ||
...props | ||
}); | ||
const inputValue = inputValueContext.consume(element); | ||
useEffect2(element, () => { | ||
listboxItemState.query.value = inputValue.value; | ||
}); | ||
const { value } = listboxItemState; | ||
return { value }; | ||
} | ||
// src/combobox-item.element.gen.ts | ||
var ComboboxItemElement = class extends BaseElement2 { | ||
constructor(props) { | ||
super(); | ||
this._s = useComboboxItem(this, props); | ||
} | ||
/** @hidden */ | ||
get value() { | ||
return this._s.value.value; | ||
} | ||
/** @hidden */ | ||
set value(v) { | ||
this._s.value.value = v; | ||
} | ||
}; | ||
// src/combobox-list.element.gen.ts | ||
import { BaseElement as BaseElement3 } from "@aria-ui/core"; | ||
// src/combobox-list.state.ts | ||
import { useListbox } from "@aria-ui/listbox"; | ||
function useComboboxList(element) { | ||
const keydownHandler = keydownHandlerContext.consume(element); | ||
useListbox(element, { | ||
onKeydownHandlerAdd: (handler) => { | ||
keydownHandler.value = handler; | ||
return () => { | ||
keydownHandler.value = null; | ||
}; | ||
} | ||
}); | ||
} | ||
// src/combobox-list.element.gen.ts | ||
var ComboboxListElement = class extends BaseElement3 { | ||
constructor() { | ||
super(); | ||
useComboboxList(this); | ||
} | ||
}; | ||
// src/combobox-item.props.ts | ||
var defaultComboboxItemProps = Object.freeze({ | ||
value: "" | ||
}); | ||
export { | ||
ComboboxEmptyElement, | ||
ComboboxItemElement, | ||
ComboboxListElement, | ||
ComboboxRootElement, | ||
defaultComboboxEmptyProps, | ||
defaultComboboxItemProps, | ||
useComboboxEmpty, | ||
useComboboxItem, | ||
@@ -148,0 +178,0 @@ useComboboxList, |
{ | ||
"name": "@aria-ui/combobox", | ||
"type": "module", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"private": false, | ||
@@ -12,4 +12,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@aria-ui/core": "^0.0.11", | ||
"@aria-ui/listbox": "^0.0.6" | ||
"@aria-ui/core": "^0.0.12", | ||
"@aria-ui/listbox": "^0.0.7" | ||
}, | ||
@@ -16,0 +16,0 @@ "devDependencies": { |
# @aria-ui/combobox | ||
## ComboboxEmpty | ||
### ComboboxEmptyElement | ||
A custom ComboboxEmpty element. | ||
```ts | ||
new ComboboxEmptyElement(): ComboboxEmptyElement | ||
``` | ||
### useComboboxEmpty() | ||
```ts | ||
function useComboboxEmpty(element: ConnectableElement): void; | ||
``` | ||
## ComboboxItem | ||
@@ -19,2 +35,3 @@ | ||
| :-- | :-- | :-- | | ||
| `onSelect` | `null` \| `VoidFunction` | The function to call when the item is selected.<br /><br />**Default**<br />`null` | | ||
| `value` | `string` | The value of the item. Every item must have a unique value in the parent<br />list.<br /><br />**Default**<br />`""` | | ||
@@ -21,0 +38,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9693
242
78
1
+ Added@aria-ui/collection@0.0.2(transitive)
+ Added@aria-ui/core@0.0.12(transitive)
+ Added@aria-ui/listbox@0.0.7(transitive)
+ Added@aria-ui/presence@0.0.7(transitive)
+ Addedimmer@10.1.1(transitive)
- Removed@aria-ui/collection@0.0.1(transitive)
- Removed@aria-ui/core@0.0.11(transitive)
- Removed@aria-ui/listbox@0.0.6(transitive)
- Removed@aria-ui/presence@0.0.6(transitive)
Updated@aria-ui/core@^0.0.12
Updated@aria-ui/listbox@^0.0.7