{"version":3,"file":"buttons-cdGcewjB.mjs","names":[],"sources":["../src/components/buttons/ActionButton.vue","../src/components/buttons/ActionButton.vue","../src/components/buttons/ClassicButton.vue","../src/components/buttons/ClassicButton.vue"],"sourcesContent":["<template>\n    <div>\n        <!-- The button with an icon to trigger the action -->\n        <button\n            class=\"btn btn-transparent\"\n            :title=\"action\"\n            @click=\"onClick\"\n        >\n            <component :is=\"icon\" />\n        </button>\n\n        <!-- Modal to ask for confirmation -->\n        <MessageModal\n            v-if=\"showModal\"\n            :title=\"confirmModal.title\"\n            :message=\"confirmModal.message\"\n            :validatetext=\"$t('Yes')\"\n            :canceltext=\"$t('No')\"\n            @validate=\"onConfirmModal\"\n            @cancel=\"showModal = false\"\n            @close=\"showModal = false\"\n        />\n    </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { type Component, computed, ref } from 'vue';\nimport MessageModal from '../misc/modal/MessageModal.vue'; \nimport Icons from '../icons';\n\n/** Actions available to the button */\nenum Action {\n    Edit = 'edit',\n    Delete = 'delete'\n}\n\nexport interface ConfirmModalData {\n    title: string;\n    message: string;\n}\n\nconst { action, confirmModal } = defineProps<{\n    /** The type of action provided by the button */\n    action: Action;\n    /** When set, clicking on the button will first open a confirm modal */\n    confirmModal?: ConfirmModalData;\n}>();\n\nconst emit = defineEmits<{\n    /**\n     * Event trigger when the button is clicked, or after confirmation in the\n     * modal if `withConfirmModal` is true.\n     */\n    (e: 'click'): void\n}>();\n\n/************************\n * Using button\n ***********************/\n\n/** Method called when clicking on button */\nfunction onClick(): void {\n    if (confirmModal === undefined) {\n        emit('click');\n    } else {\n        showModal.value = true;\n    }\n}\n\n/***********************\n * Modal\n **********************/\n/** Display modal when true */\nconst showModal = ref(false);\n\n/** Method called when the modal is validated */\nfunction onConfirmModal(): void {\n    showModal.value = false;\n    emit('click');\n}\n\n/***********************\n * Button appearance\n **********************/\n\n/** The icon displayed by the button */\nconst icon = computed((): Component => {\n    switch (action) {\n        case Action.Edit:\n            return Icons.Edit;\n\n        case Action.Delete:\n            return Icons.Delete;\n\n        default:\n            return;\n    }\n});\n</script>\n","<template>\n    <div>\n        <!-- The button with an icon to trigger the action -->\n        <button\n            class=\"btn btn-transparent\"\n            :title=\"action\"\n            @click=\"onClick\"\n        >\n            <component :is=\"icon\" />\n        </button>\n\n        <!-- Modal to ask for confirmation -->\n        <MessageModal\n            v-if=\"showModal\"\n            :title=\"confirmModal.title\"\n            :message=\"confirmModal.message\"\n            :validatetext=\"$t('Yes')\"\n            :canceltext=\"$t('No')\"\n            @validate=\"onConfirmModal\"\n            @cancel=\"showModal = false\"\n            @close=\"showModal = false\"\n        />\n    </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { type Component, computed, ref } from 'vue';\nimport MessageModal from '../misc/modal/MessageModal.vue'; \nimport Icons from '../icons';\n\n/** Actions available to the button */\nenum Action {\n    Edit = 'edit',\n    Delete = 'delete'\n}\n\nexport interface ConfirmModalData {\n    title: string;\n    message: string;\n}\n\nconst { action, confirmModal } = defineProps<{\n    /** The type of action provided by the button */\n    action: Action;\n    /** When set, clicking on the button will first open a confirm modal */\n    confirmModal?: ConfirmModalData;\n}>();\n\nconst emit = defineEmits<{\n    /**\n     * Event trigger when the button is clicked, or after confirmation in the\n     * modal if `withConfirmModal` is true.\n     */\n    (e: 'click'): void\n}>();\n\n/************************\n * Using button\n ***********************/\n\n/** Method called when clicking on button */\nfunction onClick(): void {\n    if (confirmModal === undefined) {\n        emit('click');\n    } else {\n        showModal.value = true;\n    }\n}\n\n/***********************\n * Modal\n **********************/\n/** Display modal when true */\nconst showModal = ref(false);\n\n/** Method called when the modal is validated */\nfunction onConfirmModal(): void {\n    showModal.value = false;\n    emit('click');\n}\n\n/***********************\n * Button appearance\n **********************/\n\n/** The icon displayed by the button */\nconst icon = computed((): Component => {\n    switch (action) {\n        case Action.Edit:\n            return Icons.Edit;\n\n        case Action.Delete:\n            return Icons.Delete;\n\n        default:\n            return;\n    }\n});\n</script>\n","<!-- A simple button with accessibility in mind -->\n<template>\n    <button\n        :class=\"classes\"\n        :aria-disabled=\"disabled\"\n        :title=\"title\"\n        :aria-label=\"title\"\n        @click=\"onClick\"\n    >\n        <slot />\n    </button>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nconst props = defineProps<{\n    /** Disable the button */\n    disabled?: boolean;\n    /** Title of the button */\n    title?: string;\n    /** Primary style for button */\n    primary?: boolean;\n    /** Icon style for button */\n    icon?: boolean;\n}>();\n\nconst emit = defineEmits<{\n    /** Emitted when the user clicks on the button */\n    (e: 'click'): void;\n}>();\n\nconst classes = computed((): Array<string> => {\n    const ary: Array<string> = ['btn', 'd-flex'];\n    if (props.primary) {\n        ary.push('btn-primary');\n    }\n    if (props.icon) {\n        ary.push('btn-icon');\n    }\n    return ary;\n});\n\nfunction onClick(): void {\n    if (!props.disabled) {\n        emit('click');\n    }\n}\n</script>\n","<!-- A simple button with accessibility in mind -->\n<template>\n    <button\n        :class=\"classes\"\n        :aria-disabled=\"disabled\"\n        :title=\"title\"\n        :aria-label=\"title\"\n        @click=\"onClick\"\n    >\n        <slot />\n    </button>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\n\nconst props = defineProps<{\n    /** Disable the button */\n    disabled?: boolean;\n    /** Title of the button */\n    title?: string;\n    /** Primary style for button */\n    primary?: boolean;\n    /** Icon style for button */\n    icon?: boolean;\n}>();\n\nconst emit = defineEmits<{\n    /** Emitted when the user clicks on the button */\n    (e: 'click'): void;\n}>();\n\nconst classes = computed((): Array<string> => {\n    const ary: Array<string> = ['btn', 'd-flex'];\n    if (props.primary) {\n        ary.push('btn-primary');\n    }\n    if (props.icon) {\n        ary.push('btn-icon');\n    }\n    return ary;\n});\n\nfunction onClick(): void {\n    if (!props.disabled) {\n        emit('click');\n    }\n}\n</script>\n"],"mappings":";;;;;;AA+BA,IAAK,SAAL,yBAAA,QAAA;CACI,OAAA,UAAA;CACA,OAAA,YAAA;;AACJ,EAHK,UAAA,CAAA,CAGL;;;;;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