@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
74 lines (71 loc) • 2.38 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 { useSelect } from './use-select.js';
import { SelectProvider } from './use-select-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "select-root",
props: /* @__PURE__ */ mergeDefaults({
closeOnSelect: { type: Boolean },
collection: {},
composite: { type: Boolean },
defaultHighlightedValue: {},
defaultOpen: { type: Boolean },
defaultValue: {},
deselectable: { type: Boolean },
disabled: { type: Boolean },
form: {},
highlightedValue: {},
id: {},
ids: {},
invalid: { type: Boolean },
loopFocus: { type: Boolean },
modelValue: {},
multiple: { type: Boolean },
name: {},
open: { type: Boolean },
positioning: {},
readOnly: { type: Boolean },
required: { type: Boolean },
scrollToIndexFn: { type: Function },
lazyMount: { type: Boolean },
unmountOnExit: { type: Boolean },
asChild: { type: Boolean }
}, {
closeOnSelect: void 0,
composite: void 0,
defaultOpen: void 0,
deselectable: void 0,
disabled: void 0,
invalid: void 0,
loopFocus: void 0,
multiple: void 0,
open: void 0,
readOnly: void 0,
required: void 0
}),
emits: ["focusOutside", "highlightChange", "interactOutside", "openChange", "pointerDownOutside", "select", "valueChange", "update:modelValue", "update:open", "update:highlightedValue"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const select = useSelect(props, emits);
SelectProvider(select);
RenderStrategyPropsProvider(
computed(() => ({
lazyMount: props.lazyMount,
unmountOnExit: props.unmountOnExit
}))
);
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).div, mergeProps(unref(select).getRootProps(), { "as-child": _ctx.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };