ketekny-ui-kit 1.0.21 → 1.0.22
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/index.js +2 -1
- package/package.json +1 -1
- package/src/ui/kList.vue +110 -0
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import kMenu from './src/ui/kMenu.vue'
|
|
|
22
22
|
import kTags from './src/ui/kTags.vue'
|
|
23
23
|
import kSearch from './src/ui/kSearch.vue'
|
|
24
24
|
import kArrayList from './src/ui/kArrayList.vue'
|
|
25
|
+
import kList from './src/ui/kList.vue'
|
|
25
26
|
import kSkeleton from './src/ui/kSkeleton.vue'
|
|
26
27
|
import kProgressBar from './src/ui/kProgressBar.vue'
|
|
27
28
|
import kTextArea from './src/ui/kTextArea.vue'
|
|
@@ -49,7 +50,7 @@ export {
|
|
|
49
50
|
kMessage, kCode, kToolbar, kTable, kTabs, kChip, kSpinner, kDatatable, kIcon, kMenu, kSkeleton, kProgressBar, kTree,
|
|
50
51
|
|
|
51
52
|
// Form Components
|
|
52
|
-
kButton, kSelect, kUploader, kToggle, kInput, kDateSelector, kEditor, kSelectButton, kTags, kSearch, kArrayList, kTextArea,
|
|
53
|
+
kButton, kSelect, kUploader, kToggle, kInput, kDateSelector, kEditor, kSelectButton, kTags, kSearch, kArrayList, kList, kTextArea,
|
|
53
54
|
|
|
54
55
|
// Dialogs
|
|
55
56
|
kDialog, kDrawer,
|
package/package.json
CHANGED
package/src/ui/kList.vue
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-full">
|
|
3
|
+
<dl
|
|
4
|
+
v-if="!isRowFormat"
|
|
5
|
+
class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-for="(stat, index) in normalizedStats"
|
|
9
|
+
:key="resolveKey(stat, index)"
|
|
10
|
+
class="flex items-center gap-3 p-3 border border-gray-200 rounded-xl bg-white"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
v-if="stat.icon"
|
|
14
|
+
class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10 text-primary"
|
|
15
|
+
>
|
|
16
|
+
<kIcon
|
|
17
|
+
v-if="typeof stat.icon === 'string'"
|
|
18
|
+
:name="stat.icon"
|
|
19
|
+
:size="18"
|
|
20
|
+
/>
|
|
21
|
+
<component
|
|
22
|
+
:is="stat.icon"
|
|
23
|
+
v-else
|
|
24
|
+
class="w-[18px] h-[18px]"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="min-w-0">
|
|
29
|
+
<dt class="text-sm text-gray-500 truncate">{{ stat.label }}</dt>
|
|
30
|
+
<dd class="text-xl font-semibold text-gray-900 truncate">{{ stat.value }}</dd>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</dl>
|
|
34
|
+
|
|
35
|
+
<div v-else class="overflow-hidden bg-white border border-gray-200 rounded-xl">
|
|
36
|
+
<table class="w-full">
|
|
37
|
+
<tbody>
|
|
38
|
+
<tr
|
|
39
|
+
v-for="(stat, index) in normalizedStats"
|
|
40
|
+
:key="resolveKey(stat, index)"
|
|
41
|
+
class="border-b border-gray-200 last:border-b-0"
|
|
42
|
+
>
|
|
43
|
+
<td class="px-4 py-3 text-sm text-gray-600">
|
|
44
|
+
<div class="flex items-center gap-2">
|
|
45
|
+
<div
|
|
46
|
+
v-if="stat.icon"
|
|
47
|
+
class="flex items-center justify-center w-7 h-7 rounded-md bg-primary/10 text-primary"
|
|
48
|
+
>
|
|
49
|
+
<kIcon
|
|
50
|
+
v-if="typeof stat.icon === 'string'"
|
|
51
|
+
:name="stat.icon"
|
|
52
|
+
:size="14"
|
|
53
|
+
/>
|
|
54
|
+
<component
|
|
55
|
+
:is="stat.icon"
|
|
56
|
+
v-else
|
|
57
|
+
class="w-[14px] h-[14px]"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
<span>{{ stat.label }}</span>
|
|
61
|
+
</div>
|
|
62
|
+
</td>
|
|
63
|
+
<td class="px-4 py-3 text-base font-semibold text-right text-gray-900">
|
|
64
|
+
{{ stat.value }}
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</tbody>
|
|
68
|
+
</table>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
import kIcon from './kIcon.vue'
|
|
75
|
+
|
|
76
|
+
export default {
|
|
77
|
+
name: 'kList',
|
|
78
|
+
components: {
|
|
79
|
+
kIcon,
|
|
80
|
+
},
|
|
81
|
+
props: {
|
|
82
|
+
stats: {
|
|
83
|
+
type: Array,
|
|
84
|
+
default: () => [],
|
|
85
|
+
},
|
|
86
|
+
format: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'col',
|
|
89
|
+
validator: (value) => ['col', 'row'].includes(value),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
isRowFormat() {
|
|
94
|
+
return this.format === 'row'
|
|
95
|
+
},
|
|
96
|
+
normalizedStats() {
|
|
97
|
+
return this.stats.map((stat) => ({
|
|
98
|
+
label: stat?.label ?? '',
|
|
99
|
+
value: stat?.value ?? '-',
|
|
100
|
+
icon: stat?.icon ?? null,
|
|
101
|
+
}))
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
methods: {
|
|
105
|
+
resolveKey(stat, index) {
|
|
106
|
+
return `${String(stat.label)}-${index}`
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
</script>
|