move ui and api to seperate packages and add npm actions for them

This commit is contained in:
Gregor Vostrak
2024-08-21 14:28:31 +02:00
parent b7c9aa6f28
commit 635954f81d
185 changed files with 2755 additions and 712 deletions

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import type { HtmlButtonType } from '@/types/dom';
withDefaults(
defineProps<{
type?: HtmlButtonType;
}>(),
{
type: 'button',
}
);
</script>
Modal.vue
<template>
<button
:type="type"
class="inline-flex items-center justify-center px-4 py-2 bg-red-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-red-500 active:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition ease-in-out duration-150">
<slot />
</button>
</template>

View File

@@ -0,0 +1,25 @@
<script setup lang="ts">
import type { HtmlButtonType } from '@/types/dom';
import LoadingSpinner from '../LoadingSpinner.vue';
withDefaults(
defineProps<{
type: HtmlButtonType;
loading: boolean;
}>(),
{
type: 'submit',
loading: false,
}
);
</script>
<template>
<button
:type="type"
:disabled="loading"
class="inline-flex items-center px-2 sm:px-3 py-1 sm:py-2 bg-accent-300/10 border border-accent-300/20 rounded-md font-medium text-xs sm:text-sm text-white hover:bg-accent-300/20 active:bg-accent-300/20 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150">
<LoadingSpinner v-if="loading"></LoadingSpinner>
<slot />
</button>
</template>

View File

@@ -0,0 +1,46 @@
<script setup lang="ts">
import type { HtmlButtonType } from '@/types/dom';
import { twMerge } from 'tailwind-merge';
import { type Component } from 'vue';
const props = withDefaults(
defineProps<{
type: HtmlButtonType;
icon?: Component;
size: 'small' | 'base';
}>(),
{
type: 'button',
size: 'base',
}
);
const sizeClasses = {
small: 'text-xs px-2 sm:px-2.5 py-1 sm:py-1.5',
base: 'text-xs sm:text-sm px-2 sm:px-3 py-1 sm:py-2',
};
</script>
<template>
<button
:type="type"
:class="
twMerge(
'bg-button-secondary-background border border-button-secondary-border hover:bg-button-secondary-background-hover shadow-sm transition text-white rounded-lg font-semibold inline-flex items-center space-x-1.5 focus-visible:border-input-border-active focus:outline-none focus:ring-0 disabled:opacity-25 ease-in-out',
sizeClasses[props.size]
)
">
<span
:class="
twMerge('flex items-center ', props.icon ? 'space-x-1.5' : '')
">
<component
v-if="props.icon"
:is="props.icon"
class="w-4 sm:w-5 h-4 sm:h-5 -ml-0.5 sm:-ml-1"></component>
<span>
<slot />
</span>
</span>
</button>
</template>