UNPKG

@ariakit/react-core

Version:

Ariakit React core

57 lines (54 loc) 1.4 kB
"use client"; import { usePopoverStoreProps } from "./O2PQ2652.js"; import { useCompositeStoreOptions, useCompositeStoreProps } from "./4CMBR7SL.js"; import { useComboboxProviderContext } from "./S43UC3DV.js"; import { useStore, useStoreProps } from "./YV4JVR4I.js"; import { useUpdateEffect } from "./ABQUS43J.js"; import { __spreadProps, __spreadValues } from "./3YLGPPWQ.js"; // src/select/select-store.ts import * as Core from "@ariakit/core/select/select-store"; function useSelectStoreOptions(props) { const combobox = useComboboxProviderContext(); props = __spreadProps(__spreadValues({}, 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 };