UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

42 lines (41 loc) 2.18 kB
"use client"; require("../../../_virtual/_rolldown/runtime.cjs"); const require_get_ref_prop = require("../../../core/utils/get-ref-prop/get-ref-prop.cjs"); const require_get_single_element_child = require("../../../core/utils/get-single-element-child/get-single-element-child.cjs"); const require_use_props = require("../../../core/MantineProvider/use-props/use-props.cjs"); const require_factory = require("../../../core/factory/factory.cjs"); const require_Combobox_context = require("../Combobox.context.cjs"); const require_use_combobox_target_props = require("../use-combobox-target-props/use-combobox-target-props.cjs"); let react = require("react"); let _mantine_hooks = require("@mantine/hooks"); //#region packages/@mantine/core/src/components/Combobox/ComboboxEventsTarget/ComboboxEventsTarget.tsx const defaultProps = { refProp: "ref", targetType: "input", withKeyboardNavigation: true, withAriaAttributes: true, withExpandedAttribute: false, autoComplete: "off" }; const ComboboxEventsTarget = require_factory.factory((props) => { const { children, refProp, withKeyboardNavigation, withAriaAttributes, withExpandedAttribute, targetType, autoComplete, ref, ...others } = require_use_props.useProps("ComboboxEventsTarget", defaultProps, props); const child = require_get_single_element_child.getSingleElementChild(children); if (!child) throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"); const ctx = require_Combobox_context.useComboboxContext(); return (0, react.cloneElement)(child, { ...require_use_combobox_target_props.useComboboxTargetProps({ targetType, withAriaAttributes, withKeyboardNavigation, withExpandedAttribute, onKeyDown: child.props.onKeyDown, autoComplete }), ...others, [refProp]: (0, _mantine_hooks.useMergedRef)(ref, ctx.store.targetRef, require_get_ref_prop.getRefProp(child)) }); }); ComboboxEventsTarget.displayName = "@mantine/core/ComboboxEventsTarget"; //#endregion exports.ComboboxEventsTarget = ComboboxEventsTarget; //# sourceMappingURL=ComboboxEventsTarget.cjs.map