
package.dist.components.combobox.combobox-root.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react Show documentation
Show all versions of react Show documentation
A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.
The newest version!
'use client';
import { jsx } from 'react/jsx-runtime';
import { mergeProps } from '@zag-js/react';
import { forwardRef } from 'react';
import { createSplitProps } from '../../utils/create-split-props.js';
import { ark } from '../factory.js';
import { splitPresenceProps } from '../presence/split-presence-props.js';
import { usePresence } from '../presence/use-presence.js';
import { PresenceProvider } from '../presence/use-presence-context.js';
import { useCombobox } from './use-combobox.js';
import { ComboboxProvider } from './use-combobox-context.js';
const ComboboxImpl = (props, ref) => {
const [presenceProps, comboboxProps] = splitPresenceProps(props);
const [useComboboxProps, localProps] = createSplitProps()(comboboxProps, [
"allowCustomValue",
"autoFocus",
"closeOnSelect",
"composite",
"collection",
"defaultOpen",
"defaultValue",
"disabled",
"disableLayer",
"form",
"highlightedValue",
"id",
"ids",
"inputBehavior",
"inputValue",
"invalid",
"loopFocus",
"multiple",
"name",
"onFocusOutside",
"onHighlightChange",
"onInputValueChange",
"onInteractOutside",
"onOpenChange",
"onOpenChange",
"onPointerDownOutside",
"onValueChange",
"open",
"openOnChange",
"openOnClick",
"openOnKeyPress",
"placeholder",
"positioning",
"readOnly",
"required",
"scrollToIndexFn",
"selectionBehavior",
"translations",
"value"
]);
const combobox = useCombobox(useComboboxProps);
const presence = usePresence(mergeProps({ present: combobox.open }, presenceProps));
const mergedProps = mergeProps(combobox.getRootProps(), localProps);
return /* @__PURE__ */ jsx(ComboboxProvider, { value: combobox, children: /* @__PURE__ */ jsx(PresenceProvider, { value: presence, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) }) });
};
const ComboboxRoot = forwardRef(ComboboxImpl);
export { ComboboxRoot };
© 2015 - 2025 Weber Informatics LLC | Privacy Policy