@empathyco/x-components
Version:
Empathy X Components
77 lines (74 loc) • 2.53 kB
JavaScript
import { defineComponent, ref } from 'vue';
import { AnimationProp } from '../../types/animation-prop.js';
import '../animations/animate-clip-path/animate-clip-path.style.scss.js';
import '../animations/animate-scale/animate-scale.style.scss.js';
import '../animations/animate-translate/animate-translate.style.scss.js';
import '../animations/animate-width.vue2.js';
import '../animations/animate-width.vue3.js';
import '../animations/change-height.vue2.js';
import '../animations/collapse-height.vue2.js';
import '../animations/collapse-height.vue3.js';
import '../animations/collapse-width.vue2.js';
import '../animations/collapse-width.vue3.js';
import '../animations/cross-fade.vue2.js';
import '../animations/cross-fade.vue3.js';
import '../animations/fade-and-slide.vue2.js';
import '../animations/fade-and-slide.vue3.js';
import '../animations/fade.vue2.js';
import '../animations/fade.vue3.js';
import _sfc_main$1 from '../animations/no-animation.vue.js';
import '../animations/staggered-fade-and-slide.vue2.js';
import '../animations/staggered-fade-and-slide.vue3.js';
import BaseTogglePanel from './base-toggle-panel.vue.js';
/**
* Toggle panel which uses the base toggle panel, adds a header and manage the
* open / close state of the panel.
*
* @public
*/
var _sfc_main = defineComponent({
name: 'BaseHeaderTogglePanel',
components: { BaseTogglePanel },
props: {
/** Animation component that will be used to animate the base-toggle-panel. */
animation: {
type: AnimationProp,
default: () => _sfc_main$1,
},
/** Handles if the panel is open by default. */
startCollapsed: Boolean,
/** Class inherited by content element. */
headerClass: String,
},
setup(props, { emit }) {
/**
* Handles if the base panel is open or closed.
*
* @internal
*/
const open = ref(!props.startCollapsed);
/**
* Emits open status event.
*
* @internal
*/
const emitOpenStatusEvent = () => {
emit(open.value ? 'open' : 'close');
};
/**
* Toggles the open property.
*
* @internal
*/
const toggleOpen = () => {
open.value = !open.value;
emitOpenStatusEvent();
};
return {
open,
toggleOpen,
};
},
});
export { _sfc_main as default };
//# sourceMappingURL=base-header-toggle-panel.vue2.js.map