{"version":3,"file":"ClassicCopyButton-M9AP3MKD.mjs","names":[],"sources":["../src/components/form/ClassicCopyButton.vue","../src/components/form/ClassicCopyButton.vue"],"sourcesContent":["<template>\n  <div>\n    <button\n      :class=\"classBtn\"\n      @click=\"onCopyCode(afterCopy)\"\n    >\n      {{ textDisplayed }}\n    </button>\n    <SnackBar \n      v-if=\"lazyLoadingSnackbar\" \n      ref=\"snackbar\" \n      position=\"bottom-left\"\n    />\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport SnackBar from \"../misc/SnackBar.vue\";\nimport displayHelper from \"../../helper/displayHelper\";\nimport { computed, ref, useTemplateRef } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\n\n\n//Props \nconst props = defineProps({\n  text: { default: undefined, type: String },\n  textAfterCopy: { default: undefined, type: String },\n  dataToCopy: { default: undefined, type: String },\n  snackbarText: { default: undefined, type: String },\n  classBtn: { default: \"btn btn-primary w-fit-content my-3\", type: String },\n})\n\n//Data \nconst hasBeenCopied = ref(false);\nconst lazyLoadingSnackbar = ref(false);\nconst snackBarRef = useTemplateRef('snackbar');\n\n\n//Composables\nconst { t } = useI18n();\n\n\n//Computed\nconst textDisplayed = computed(() => hasBeenCopied.value ? props.textAfterCopy : props.text);\n\n//Methods\nfunction onCopyCode(callback: () => void){\n  displayHelper.onCopyCode(props.dataToCopy??\"\", callback);\n}\nfunction afterCopy(): void {\n  hasBeenCopied.value = true;\n  if (!lazyLoadingSnackbar.value) {\n    lazyLoadingSnackbar.value = true;\n    setTimeout(() => {\n      afterCopy();\n    }, 500);\n  } else {\n    (snackBarRef?.value as InstanceType<typeof SnackBar>).open(props.snackbarText ?? t(\"Data in clipboard\"));\n  }\n}\n</script>\n","<template>\n  <div>\n    <button\n      :class=\"classBtn\"\n      @click=\"onCopyCode(afterCopy)\"\n    >\n      {{ textDisplayed }}\n    </button>\n    <SnackBar \n      v-if=\"lazyLoadingSnackbar\" \n      ref=\"snackbar\" \n      position=\"bottom-left\"\n    />\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport SnackBar from \"../misc/SnackBar.vue\";\nimport displayHelper from \"../../helper/displayHelper\";\nimport { computed, ref, useTemplateRef } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\n\n\n//Props \nconst props = defineProps({\n  text: { default: undefined, type: String },\n  textAfterCopy: { default: undefined, type: String },\n  dataToCopy: { default: undefined, type: String },\n  snackbarText: { default: undefined, type: String },\n  classBtn: { default: \"btn btn-primary w-fit-content my-3\", type: String },\n})\n\n//Data \nconst hasBeenCopied = ref(false);\nconst lazyLoadingSnackbar = ref(false);\nconst snackBarRef = useTemplateRef('snackbar');\n\n\n//Composables\nconst { t } = useI18n();\n\n\n//Computed\nconst textDisplayed = computed(() => hasBeenCopied.value ? props.textAfterCopy : props.text);\n\n//Methods\nfunction onCopyCode(callback: () => void){\n  displayHelper.onCopyCode(props.dataToCopy??\"\", callback);\n}\nfunction afterCopy(): void {\n  hasBeenCopied.value = true;\n  if (!lazyLoadingSnackbar.value) {\n    lazyLoadingSnackbar.value = true;\n    setTimeout(() => {\n      afterCopy();\n    }, 500);\n  } else {\n    (snackBarRef?.value as InstanceType<typeof SnackBar>).open(props.snackbarText ?? t(\"Data in clipboard\"));\n  }\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EASd,MAAM,gBAAgB,IAAI,KAAK;EAC/B,MAAM,sBAAsB,IAAI,KAAK;EACrC,MAAM,cAAc,eAAe,UAAU;EAI7C,MAAM,EAAE,MAAM,QAAQ;EAItB,MAAM,gBAAgB,eAAe,cAAc,QAAQ,MAAM,gBAAgB,MAAM,IAAI;EAG3F,SAAS,WAAW,UAAqB;GACvC,sBAAc,WAAW,MAAM,cAAY,IAAI,QAAQ;EACzD;EACA,SAAS,YAAkB;GACzB,cAAc,QAAQ;GACtB,IAAI,CAAC,oBAAoB,OAAO;IAC9B,oBAAoB,QAAQ;IAC5B,iBAAiB;KACf,UAAU;IACZ,GAAG,GAAG;GACR,OACE,CAAC,aAAa,OAAwC,KAAK,MAAM,gBAAgB,EAAE,mBAAmB,CAAC;EAE3G;;;;;;;;;;;;;;;;;;;;;;;qBC1DE,mBAYM,OAAA,MAAA,CAXJ,mBAKS,UAAA;EAJN,OAAK,eAAE,OAAA,QAAQ;EACf,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,OAAA,WAAW,OAAA,SAAS;oBAEzB,OAAA,aAAa,GAAA,CAAA,GAGV,OAAA,uBAAA,UAAA,GADR,YAIE,OAAA,aAAA;;EAFA,KAAI;EACJ,UAAS"}