UNPKG

@empathyco/x-components

Version:
61 lines (58 loc) 1.99 kB
import { defineComponent, computed } from 'vue'; import BaseEventButton from '../../../components/base-event-button.vue.js'; import { useState } from '../../../composables/use-state.js'; import { historyQueriesXModule } from '../x-module.js'; /** * A button that when is pressed, emits the * {@link HistoryQueriesXEvents.UserPressedClearHistoryQueries} event, expressing the user * intention to clear the whole history of queries. * * @public */ var _sfc_main = defineComponent({ name: 'ClearHistoryQueries', xModule: historyQueriesXModule.name, components: { BaseEventButton, }, setup() { /** * The whole history queries. * * @internal */ const { historyQueries } = useState('historyQueries'); /** * Returns if the array of history queries is empty. * * @returns `true` if the {@link historyQueries} array is empty, `false` otherwise. * @internal */ const isHistoryQueriesEmpty = computed(() => historyQueries.value.length === 0); /** * Dynamic CSS classes to add to the root element of this component. * * @returns A booleans dictionary where each key is the class name to add, and the boolean value * tells if it should be added or not. * @internal */ const dynamicClasses = computed(() => ({ 'x-clear-history-queries--is-empty': isHistoryQueriesEmpty.value, })); /** * The list of events that are going to be emitted when the button is pressed. * * @internal */ const clearHistoryQueriesEvents = { UserPressedClearHistoryQueries: undefined, }; return { dynamicClasses, clearHistoryQueriesEvents, isHistoryQueriesEmpty, }; }, }); export { _sfc_main as default }; //# sourceMappingURL=clear-history-queries.vue2.js.map