2024-07-05 12:22:31 +00:00
|
|
|
<template>
|
2024-07-08 10:03:25 +00:00
|
|
|
<button :class="rootClasses" @click="useRipple($event, true)">
|
|
|
|
<div :class="outerClasses">
|
|
|
|
<div :class="innerClasses">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</button>
|
2024-07-05 12:22:31 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-07-09 09:00:50 +00:00
|
|
|
// import { useRipple } from "#imports";
|
2024-07-08 10:03:25 +00:00
|
|
|
import { computed, ref } from "vue";
|
|
|
|
import type { ButtonProps, PTAttribs } from "./types";
|
|
|
|
import { twMerge } from "tailwind-merge";
|
2024-07-05 12:22:31 +00:00
|
|
|
|
|
|
|
const props = withDefaults(defineProps<ButtonProps>(), {
|
2024-07-08 10:03:25 +00:00
|
|
|
rounded: true,
|
|
|
|
spinerSize: "6",
|
|
|
|
spinerColor: "accent1",
|
|
|
|
spinerPlace: "prefix",
|
2024-07-05 12:22:31 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const classes = ref({
|
2024-07-08 10:03:25 +00:00
|
|
|
root: {
|
2024-07-08 11:37:36 +00:00
|
|
|
class: ``,
|
2024-07-08 10:03:25 +00:00
|
|
|
},
|
|
|
|
outer: {
|
2024-07-08 11:37:36 +00:00
|
|
|
class: ``,
|
2024-07-08 10:03:25 +00:00
|
|
|
},
|
|
|
|
inner: {
|
2024-07-08 11:37:36 +00:00
|
|
|
class: ``,
|
2024-07-08 10:03:25 +00:00
|
|
|
},
|
2024-07-05 12:22:31 +00:00
|
|
|
} as PTAttribs);
|
|
|
|
|
2024-07-08 10:03:25 +00:00
|
|
|
const rootClasses = computed(() =>
|
|
|
|
twMerge(classes.value.root?.class, props.pt?.root?.class)
|
|
|
|
);
|
|
|
|
const innerClasses = computed(() =>
|
|
|
|
twMerge(classes.value.inner?.class, props.pt?.inner?.class)
|
|
|
|
);
|
|
|
|
const outerClasses = computed(() =>
|
|
|
|
twMerge(classes.value.outer?.class, props.pt?.outer?.class)
|
|
|
|
);
|
2024-07-05 12:22:31 +00:00
|
|
|
</script>
|