@gameap/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/GBreadcrumbs.vue +49 -0
- package/components/GDeletableList.vue +36 -0
- package/components/GStatusBadge.vue +33 -0
- package/components/Loading.vue +32 -0
- package/components/Progressbar.vue +23 -0
- package/index.js +15 -0
- package/package.json +31 -0
- package/style.css +35 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Breadcrumb -->
|
|
3
|
+
<nav class="flex pt-3 pb-3 py-4 px-4 mb-4 text-stone-700 border border-stone-200 rounded-lg bg-stone-100 dark:bg-stone-800 dark:border-stone-700" aria-label="Breadcrumb">
|
|
4
|
+
<ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
|
|
5
|
+
<li v-for="item in items.slice(0, 1)" class="inline-flex items-center">
|
|
6
|
+
<a v-if="item.link" :href="item.link" class="inline-flex items-center text-sm font-medium text-stone-700 hover:text-blue-600 dark:text-stone-400 dark:hover:text-white">
|
|
7
|
+
<i v-if="item.icon" :class="item.icon" class="align-middle mr-0.5"></i>
|
|
8
|
+
<span class="align-middle">{{ item.text }}</span>
|
|
9
|
+
</a>
|
|
10
|
+
<router-link v-else-if="item.route" :to="item.route" class="ms-1 text-sm font-medium text-stone-700 hover:text-blue-600 md:ms-2 dark:text-stone-400 dark:hover:text-white">
|
|
11
|
+
<i v-if="item.icon" :class="item.icon" class="align-middle mr-0.5"></i>
|
|
12
|
+
<span class="align-middle">{{ item.text }}</span>
|
|
13
|
+
</router-link>
|
|
14
|
+
<span v-else class="ms-1 text-sm font-medium text-stone-500 md:ms-2 dark:text-stone-400">{{ item.text }}</span>
|
|
15
|
+
</li>
|
|
16
|
+
|
|
17
|
+
<li v-for="item in items.slice(1)">
|
|
18
|
+
<div class="flex items-center">
|
|
19
|
+
<i class="fa-solid fa-chevron-right align-middle w-3 h-3 mx-2 text-stone-400"></i>
|
|
20
|
+
<a v-if="item.link" :href="item.link" class="ms-1 text-sm font-medium text-stone-700 hover:text-blue-600 md:ms-2 dark:text-stone-400 dark:hover:text-white">
|
|
21
|
+
<i v-if="item.icon !== ''" :class="item.icon" class="align-middle mr-0.5"></i>
|
|
22
|
+
<span class="align-middle">{{ item.text }}</span>
|
|
23
|
+
</a>
|
|
24
|
+
<router-link v-else-if="item.route" :to="item.route" class="ms-1 text-sm font-medium text-stone-700 hover:text-blue-600 md:ms-2 dark:text-stone-400 dark:hover:text-white">
|
|
25
|
+
<i v-if="item.icon !== ''" :class="item.icon" class="align-middle mr-0.5"></i>
|
|
26
|
+
<span class="align-middle">{{ item.text }}</span>
|
|
27
|
+
</router-link>
|
|
28
|
+
<span v-else-if="item.render" class="ms-1 text-sm font-medium text-stone-500 md:ms-2 dark:text-stone-400">
|
|
29
|
+
<render :render="item.render" />
|
|
30
|
+
</span>
|
|
31
|
+
<span v-else class="ms-1 text-sm font-medium text-stone-500 md:ms-2 dark:text-stone-400">
|
|
32
|
+
{{ item.text }}
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
</li>
|
|
36
|
+
</ol>
|
|
37
|
+
</nav>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup>
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
items: null,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const render = (attr) => {
|
|
46
|
+
return attr.render()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$attrs.class">
|
|
3
|
+
<div v-for="item in items" class="flex mb-1 md:w-full">
|
|
4
|
+
<div
|
|
5
|
+
class="text-xs text-center h-full md:w-full inline-flex px-2 py-1 bg-stone-500 hover:bg-stone-600 text-white rounded-s cursor-pointer"
|
|
6
|
+
@click="onClick(item.gameCode, item.id)"
|
|
7
|
+
>
|
|
8
|
+
{{ item.name }}
|
|
9
|
+
</div>
|
|
10
|
+
<div
|
|
11
|
+
class="ml-[2px] text-xs h-full inline-flex items-center px-2 py-1 bg-red-500 hover:bg-red-600 text-white rounded-e cursor-pointer"
|
|
12
|
+
@click="onClickDelete(item.id)"
|
|
13
|
+
>
|
|
14
|
+
<i class="fa-solid fa-trash"></i>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
items: [],
|
|
24
|
+
clickCallback: Function,
|
|
25
|
+
deleteCallback: Function,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const onClickDelete = (id) => {
|
|
29
|
+
props.deleteCallback(id)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const onClick = (code, id) => {
|
|
33
|
+
props.clickCallback(code, id)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="spanClass">{{ statusText }}</span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import {computed, defineProps} from "vue"
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
status: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
text: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const badgeClasses = {
|
|
19
|
+
waiting: 'badge-light',
|
|
20
|
+
working: 'badge-blue',
|
|
21
|
+
error: 'badge-red',
|
|
22
|
+
success: 'badge-green',
|
|
23
|
+
canceled: 'badge-stone',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const spanClass = computed(() => {
|
|
27
|
+
return badgeClasses[props.status] ?? 'badge-light'
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const statusText = computed(() => {
|
|
31
|
+
return props.text ? props.text : props.status
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex justify-center">
|
|
3
|
+
<TransitionRoot
|
|
4
|
+
:show="showTransition"
|
|
5
|
+
enter="transition-opacity duration-[2000ms]"
|
|
6
|
+
enter-from="opacity-0"
|
|
7
|
+
enter-to="opacity-100"
|
|
8
|
+
leave="transition-opacity duration-150"
|
|
9
|
+
leave-from="opacity-100"
|
|
10
|
+
leave-to="opacity-0"
|
|
11
|
+
>
|
|
12
|
+
<div class="fa-3x">
|
|
13
|
+
<i class="fa-solid fa-gear fa-spin"></i>
|
|
14
|
+
</div>
|
|
15
|
+
</TransitionRoot>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup>
|
|
20
|
+
import { onMounted, ref } from "vue"
|
|
21
|
+
import { TransitionRoot } from '@headlessui/vue'
|
|
22
|
+
|
|
23
|
+
const showTransition = ref(false)
|
|
24
|
+
|
|
25
|
+
onMounted(() => {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
showTransition.value = true
|
|
28
|
+
}, 10)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="progress">
|
|
3
|
+
<div
|
|
4
|
+
class="progress-bar progress-bar-info"
|
|
5
|
+
role="progressbar"
|
|
6
|
+
:aria-valuenow="progress"
|
|
7
|
+
aria-valuemin="0"
|
|
8
|
+
aria-valuemax="100"
|
|
9
|
+
:style="{ width: progress + '%'}"
|
|
10
|
+
>
|
|
11
|
+
{{ progress }}%
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
defineProps({
|
|
18
|
+
progress: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 0
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
</script>
|
package/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as GBreadcrumbs } from './components/GBreadcrumbs.vue'
|
|
2
|
+
export { default as GDeletableList } from './components/GDeletableList.vue'
|
|
3
|
+
export { default as GStatusBadge } from './components/GStatusBadge.vue'
|
|
4
|
+
export { default as Loading } from './components/Loading.vue'
|
|
5
|
+
export { default as Progressbar } from './components/Progressbar.vue'
|
|
6
|
+
|
|
7
|
+
export function install(app) {
|
|
8
|
+
app.component('GBreadcrumbs', GBreadcrumbs)
|
|
9
|
+
app.component('GDeletableList', GDeletableList)
|
|
10
|
+
app.component('GStatusBadge', GStatusBadge)
|
|
11
|
+
app.component('Loading', Loading)
|
|
12
|
+
app.component('Progressbar', Progressbar)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default { install }
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gameap/ui",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"module": "./index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./style.css": "./style.css"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"style.css",
|
|
16
|
+
"components"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"vue": "^3.5.0",
|
|
20
|
+
"vue-router": "^4.0.0",
|
|
21
|
+
"@headlessui/vue": "^1.7.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependenciesMeta": {
|
|
24
|
+
"vue-router": {
|
|
25
|
+
"optional": true
|
|
26
|
+
},
|
|
27
|
+
"@headlessui/vue": {
|
|
28
|
+
"optional": true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
package/style.css
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.badge-red {
|
|
2
|
+
@apply bg-red-500 text-white text-xs font-medium me-2 px-1.5 py-0.5 rounded dark:bg-red-900;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.badge-green {
|
|
6
|
+
@apply bg-lime-500 text-white text-xs font-medium me-2 px-1.5 py-0.5 rounded dark:bg-lime-900;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.badge-orange {
|
|
10
|
+
@apply bg-orange-500 text-white text-xs font-medium me-2 px-1.5 py-0.5 rounded dark:bg-orange-900;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.badge-blue {
|
|
14
|
+
@apply bg-sky-500 text-white text-xs font-medium me-2 px-1.5 py-0.5 rounded dark:bg-sky-900;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.badge-stone {
|
|
18
|
+
@apply bg-stone-500 text-white text-xs font-medium me-2 px-1.5 py-0.5 rounded dark:bg-stone-900;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.badge-light {
|
|
22
|
+
@apply bg-stone-50 text-stone-600 me-2 px-1.5 py-0.5 rounded ring-1 ring-inset ring-stone-500/10;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.progress {
|
|
26
|
+
@apply w-full bg-stone-200 rounded-full h-4 dark:bg-stone-700;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.progress-bar {
|
|
30
|
+
@apply h-4 rounded-full text-xs text-center text-white;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.progress-bar-info {
|
|
34
|
+
@apply bg-blue-500;
|
|
35
|
+
}
|