import React, { createContext, useContext, ProviderProps } from 'react' import { OptionsOverlayCtxValue } from './Overlay' import { Value } from './common' export type SelectCtxValue = OptionsOverlayCtxValue /** Select 中传递信息的 context,包含当前值及选中操作的回调等信息 */ const selectCtx = createContext>({ selected: [], onSelect: () => undefined, multiple: false, size: 'default' }) export function useSelectCtx() { return useContext(selectCtx) as unknown as SelectCtxValue } export function SelectProvider({ value, children }: ProviderProps>) { return {children} }