@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
86 lines (83 loc) • 2.91 kB
JavaScript
import { defineComponent, mergeDefaults, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { RenderStrategyPropsProvider } from '../../utils/use-render-strategy.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
import { ark } from '../factory.js';
import { useCombobox } from './use-combobox.js';
import { ComboboxProvider } from './use-combobox-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "combobox-root",
props: /* @__PURE__ */ mergeDefaults({
allowCustomValue: { type: Boolean },
autoFocus: { type: Boolean },
closeOnSelect: { type: Boolean },
collection: {},
composite: { type: Boolean },
defaultHighlightedValue: {},
defaultInputValue: {},
defaultOpen: { type: Boolean },
defaultValue: {},
disableLayer: { type: Boolean },
disabled: { type: Boolean },
form: {},
highlightedValue: {},
id: {},
ids: {},
inputBehavior: {},
inputValue: {},
invalid: { type: Boolean },
loopFocus: { type: Boolean },
modelValue: {},
multiple: { type: Boolean },
name: {},
navigate: { type: Function },
open: { type: Boolean },
openOnChange: { type: [Boolean, Function] },
openOnClick: { type: Boolean },
openOnKeyPress: { type: Boolean },
placeholder: {},
positioning: {},
readOnly: { type: Boolean },
required: { type: Boolean },
scrollToIndexFn: { type: Function },
selectionBehavior: {},
translations: {},
lazyMount: { type: Boolean },
unmountOnExit: { type: Boolean },
asChild: { type: Boolean }
}, {
allowCustomValue: void 0,
autoFocus: void 0,
closeOnSelect: void 0,
composite: void 0,
defaultOpen: void 0,
disabled: void 0,
disableLayer: void 0,
invalid: void 0,
loopFocus: void 0,
multiple: void 0,
open: void 0,
openOnChange: void 0,
openOnClick: void 0,
openOnKeyPress: void 0,
readOnly: void 0,
required: void 0
}),
emits: ["focusOutside", "highlightChange", "inputValueChange", "interactOutside", "openChange", "pointerDownOutside", "valueChange", "select", "update:modelValue", "update:highlightedValue", "update:inputValue", "update:open"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const combobox = useCombobox(props, emits);
ComboboxProvider(combobox);
RenderStrategyPropsProvider(computed(() => ({ lazyMount: props.lazyMount, unmountOnExit: props.unmountOnExit })));
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).div, mergeProps(unref(combobox).getRootProps(), { "as-child": _ctx.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };