@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
69 lines (66 loc) • 2.18 kB
JavaScript
import { defineComponent, mergeDefaults, computed, renderSlot } from 'vue';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
import { usePresence } from '../presence/use-presence.js';
import { PresenceProvider } from '../presence/use-presence-context.js';
import { useFloatingPanel } from './use-floating-panel.js';
import { FloatingPanelProvider } from './use-floating-panel-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "floating-panel-root",
props: /* @__PURE__ */ mergeDefaults({
allowOverflow: { type: Boolean },
closeOnEscape: { type: Boolean },
defaultOpen: { type: Boolean },
defaultPosition: {},
defaultSize: {},
dir: {},
disabled: { type: Boolean },
draggable: { type: Boolean },
getAnchorPosition: { type: Function },
getBoundaryEl: { type: Function },
gridSize: {},
id: {},
ids: {},
lockAspectRatio: { type: Boolean },
maxSize: {},
minSize: {},
open: { type: Boolean },
persistRect: { type: Boolean },
position: {},
resizable: { type: Boolean },
size: {},
strategy: {},
translations: {},
lazyMount: { type: Boolean },
unmountOnExit: { type: Boolean }
}, {
closeOnEscape: void 0,
defaultOpen: void 0,
open: void 0,
lockAspectRatio: void 0,
persistRect: void 0,
resizable: void 0,
allowOverflow: void 0,
disabled: void 0,
draggable: void 0
}),
emits: ["openChange", "update:open", "positionChange", "update:position", "positionChangeEnd", "sizeChange", "update:size", "sizeChangeEnd", "stageChange"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const floatingPanel = useFloatingPanel(props, emits);
FloatingPanelProvider(floatingPanel);
const presence = usePresence(
computed(() => ({
present: floatingPanel.value.open,
lazyMount: props.lazyMount,
unmountOnExit: props.unmountOnExit
}))
);
PresenceProvider(presence);
useForwardExpose();
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default");
};
}
});
export { _sfc_main as default };