UNPKG

@ariakit/react-core

Version:

Ariakit React core

54 lines (51 loc) 1.3 kB
"use client"; import { usePopoverStoreProps } from "./6RB43CMC.js"; import { useCompositeStoreOptions, useCompositeStoreProps } from "./VEHC2EHR.js"; import { useComboboxProviderContext } from "./7P7IWEBR.js"; import { useStore, useStoreProps } from "./Q3KUZPD7.js"; import { useUpdateEffect } from "./K2XTQB3X.js"; // src/select/select-store.ts import * as Core from "@ariakit/core/select/select-store"; function useSelectStoreOptions(props) { const combobox = useComboboxProviderContext(); props = { ...props, combobox: props.combobox !== void 0 ? props.combobox : combobox }; return useCompositeStoreOptions(props); } function useSelectStoreProps(store, update, props) { useUpdateEffect(update, [props.combobox]); useStoreProps(store, props, "value", "setValue"); useStoreProps(store, props, "setValueOnMove"); return Object.assign( usePopoverStoreProps( useCompositeStoreProps(store, update, props), update, props ), { combobox: props.combobox } ); } function useSelectStore(props = {}) { props = useSelectStoreOptions(props); const [store, update] = useStore(Core.createSelectStore, props); return useSelectStoreProps(store, update, props); } export { useSelectStoreOptions, useSelectStoreProps, useSelectStore };