<template>
  <DropdownWrapper 
  ref="dropdown"
  :top-offset="topOffset"
  :disabled="disabled" 
  :position="position">
    <template #trigger>
      <slot name="trigger"></slot>
    </template>
    <div class="pui-dropdown">
      <ul>
        <slot />
      </ul>
    </div>
  </DropdownWrapper>
</template>

<script>
import DropdownWrapper from './DropdownWrapper.vue'
import { POSITION_TYPES } from './const.js'

export default {
  name: "PDropdown",
  components: { DropdownWrapper },
  props: {
    disabled: Boolean,
    position: {
      type: String,
      default: POSITION_TYPES[0],
      validator(value) {
        return POSITION_TYPES.indexOf(value) > -1
      }
    },
    topOffset: {
			type: [Number, String],
			default: 0
		}
  },
  methods: {
		away() {
      this.$refs['dropdown'].away();
    }
  }
};
</script>