ketekny-ui-kit 1.0.77 → 1.0.78
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/README.md +6 -2
- package/index.js +4 -2
- package/package.json +1 -1
- package/src/ui/kCheckbox.vue +143 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ketekny-ui-kit
|
|
1
|
+
# ketekny-ui-kit
|
|
2
2
|
|
|
3
3
|
Vue 3 UI component library with Tailwind CSS styling and utility plugins.
|
|
4
4
|
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
kSelect,
|
|
46
46
|
kDateSelector,
|
|
47
47
|
kToggle,
|
|
48
|
+
kCheckbox,
|
|
48
49
|
toastPlugin,
|
|
49
50
|
confirmPlugin,
|
|
50
51
|
alertPlugin,
|
|
@@ -59,6 +60,7 @@ app.component("kInput", kInput);
|
|
|
59
60
|
app.component("kSelect", kSelect);
|
|
60
61
|
app.component("kDateSelector", kDateSelector);
|
|
61
62
|
app.component("kToggle", kToggle);
|
|
63
|
+
app.component("kCheckbox", kCheckbox);
|
|
62
64
|
|
|
63
65
|
app.use(toastPlugin);
|
|
64
66
|
app.use(confirmPlugin);
|
|
@@ -159,7 +161,7 @@ Components:
|
|
|
159
161
|
- `kMessage`, `kCode`, `kToolbar`, `kTable`, `kTabs`, `kChip`
|
|
160
162
|
- `kSpinner`, `kDatatable`, `kIcon`, `kMenu`, `kSkeleton`
|
|
161
163
|
- `kProgressBar`, `kPagination`, `kTree`, `kButton`, `kSelect`, `kUploader`
|
|
162
|
-
- `kToggle`, `kInput`, `kDateSelector`, `kEditor`
|
|
164
|
+
- `kToggle`, `kCheckbox`, `kInput`, `kDateSelector`, `kEditor`
|
|
163
165
|
- `kSelectButton`, `kTags`, `kSearch`, `kArrayList`, `kList`, `kTextArea`
|
|
164
166
|
- `kDialog`, `kDrawer`
|
|
165
167
|
- `kAppHeader`, `kAppFooter`, `kAppMain`, `kHero`
|
|
@@ -199,3 +201,5 @@ ISC
|
|
|
199
201
|
|
|
200
202
|
- Live demo/docs: https://ui.ketekny.gr
|
|
201
203
|
- npm: https://www.npmjs.com/package/ketekny-ui-kit
|
|
204
|
+
|
|
205
|
+
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// UI Components
|
|
1
|
+
// UI Components
|
|
2
2
|
import kMessage from './src/ui/kMessage.vue'
|
|
3
3
|
import kButton from './src/ui/kButton.vue'
|
|
4
|
+
import kCheckbox from './src/ui/kCheckbox.vue'
|
|
4
5
|
import kChip from './src/ui/kChip.vue'
|
|
5
6
|
import kCode from './src/ui/kCode.vue'
|
|
6
7
|
import kDialog from './src/ui/kDialog.vue'
|
|
@@ -52,7 +53,7 @@ export {
|
|
|
52
53
|
kMessage, kCode, kToolbar, kTable, kTabs, kChip, kSpinner, kDatatable, kIcon, kMenu, kSkeleton, kProgressBar, kPagination, kTree,
|
|
53
54
|
|
|
54
55
|
// Form Components
|
|
55
|
-
kButton, kSelect, kUploader, kToggle, kInput, kDateSelector, kEditor, kSelectButton, kTags, kSearch, kArrayList, kList, kTextArea,
|
|
56
|
+
kButton, kCheckbox, kSelect, kUploader, kToggle, kInput, kDateSelector, kEditor, kSelectButton, kTags, kSearch, kArrayList, kList, kTextArea,
|
|
56
57
|
|
|
57
58
|
// Dialogs
|
|
58
59
|
kDialog, kDrawer,
|
|
@@ -66,3 +67,4 @@ export {
|
|
|
66
67
|
// Tailwind Config
|
|
67
68
|
tailwindPreset
|
|
68
69
|
}
|
|
70
|
+
|
package/package.json
CHANGED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
type="button"
|
|
4
|
+
class="admin-checkbox flex w-full items-center gap-2.5 rounded-2xl px-3 py-2 transition"
|
|
5
|
+
:class="[themeTextClass, isActive ? activeTextClass : inactiveTextClass, combinedContainerClass]"
|
|
6
|
+
:title="hoverCaption"
|
|
7
|
+
:aria-label="hoverCaption || label || 'Checkbox'"
|
|
8
|
+
@click="toggle"
|
|
9
|
+
>
|
|
10
|
+
<span
|
|
11
|
+
class="inline-flex shrink-0 items-center justify-center rounded-[6px] transition-colors"
|
|
12
|
+
:style="{ width: `${iconBoxSize}px`, height: `${iconBoxSize}px` }"
|
|
13
|
+
:class="isActive ? activeClass : inactiveClass"
|
|
14
|
+
>
|
|
15
|
+
<Check :size="iconSize" />
|
|
16
|
+
</span>
|
|
17
|
+
<span class="min-w-0 flex-1 text-left">
|
|
18
|
+
<span
|
|
19
|
+
class="block text-sm font-semibold leading-5"
|
|
20
|
+
:class="[truncateLabel ? 'truncate' : 'break-words', labelClass]"
|
|
21
|
+
>
|
|
22
|
+
{{ label }}
|
|
23
|
+
</span>
|
|
24
|
+
<span v-if="description" class="mt-0.5 block text-[11px] leading-4" :class="descriptionTextClass">
|
|
25
|
+
{{ description }}
|
|
26
|
+
</span>
|
|
27
|
+
</span>
|
|
28
|
+
</button>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import { Check } from '@lucide/vue'
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'kCheckbox',
|
|
36
|
+
components: { Check },
|
|
37
|
+
props: {
|
|
38
|
+
containerClass: {
|
|
39
|
+
type: [String, Array, Object],
|
|
40
|
+
default: '',
|
|
41
|
+
},
|
|
42
|
+
labelClass: {
|
|
43
|
+
type: [String, Array, Object],
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
theme: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: 'light',
|
|
49
|
+
validator: (value) => ['light', 'dark'].includes(String(value || '').trim().toLowerCase()),
|
|
50
|
+
},
|
|
51
|
+
hoverClass: {
|
|
52
|
+
type: [String, Array, Object],
|
|
53
|
+
default: '',
|
|
54
|
+
},
|
|
55
|
+
descriptionClass: {
|
|
56
|
+
type: [String, Array, Object],
|
|
57
|
+
default: '',
|
|
58
|
+
},
|
|
59
|
+
activeTextClass: {
|
|
60
|
+
type: [String, Array, Object],
|
|
61
|
+
default: '',
|
|
62
|
+
},
|
|
63
|
+
inactiveTextClass: {
|
|
64
|
+
type: [String, Array, Object],
|
|
65
|
+
default: '',
|
|
66
|
+
},
|
|
67
|
+
iconSize: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 14,
|
|
70
|
+
},
|
|
71
|
+
iconBoxSize: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: 24,
|
|
74
|
+
},
|
|
75
|
+
truncateLabel: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
78
|
+
},
|
|
79
|
+
modelValue: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: undefined,
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: '',
|
|
86
|
+
},
|
|
87
|
+
caption: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '',
|
|
90
|
+
},
|
|
91
|
+
description: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: '',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
emits: ['click', 'update:modelValue'],
|
|
97
|
+
computed: {
|
|
98
|
+
isActive() {
|
|
99
|
+
return this.modelValue === true
|
|
100
|
+
},
|
|
101
|
+
hoverCaption() {
|
|
102
|
+
const explicitCaption = String(this.caption || '').trim()
|
|
103
|
+
if (explicitCaption) return explicitCaption
|
|
104
|
+
if (this.truncateLabel) return String(this.label || '').trim()
|
|
105
|
+
return ''
|
|
106
|
+
},
|
|
107
|
+
themeTextClass() {
|
|
108
|
+
return this.theme === 'dark' ? 'text-slate-100 hover:text-white' : 'text-slate-700 hover:text-slate-900'
|
|
109
|
+
},
|
|
110
|
+
themeHoverClass() {
|
|
111
|
+
return this.theme === 'dark' ? 'hover:bg-white/5' : 'hover:bg-slate-50'
|
|
112
|
+
},
|
|
113
|
+
themeDescriptionClass() {
|
|
114
|
+
return this.theme === 'dark' ? 'text-slate-300' : 'text-slate-500'
|
|
115
|
+
},
|
|
116
|
+
themeActiveClass() {
|
|
117
|
+
return this.theme === 'dark' ? 'bg-cyan-400 text-cyan-950' : 'bg-sky-600 text-white'
|
|
118
|
+
},
|
|
119
|
+
themeInactiveClass() {
|
|
120
|
+
return this.theme === 'dark' ? 'bg-white/10 text-transparent' : 'bg-slate-200 text-transparent'
|
|
121
|
+
},
|
|
122
|
+
combinedContainerClass() {
|
|
123
|
+
return [this.themeHoverClass, this.hoverClass, this.containerClass]
|
|
124
|
+
},
|
|
125
|
+
activeClass() {
|
|
126
|
+
return this.themeActiveClass
|
|
127
|
+
},
|
|
128
|
+
inactiveClass() {
|
|
129
|
+
return this.themeInactiveClass
|
|
130
|
+
},
|
|
131
|
+
descriptionTextClass() {
|
|
132
|
+
return this.descriptionClass || this.themeDescriptionClass
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
toggle() {
|
|
137
|
+
const nextValue = !this.isActive
|
|
138
|
+
this.$emit('update:modelValue', nextValue)
|
|
139
|
+
this.$emit('click', nextValue)
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
</script>
|