ketekny-ui-kit 1.0.21 → 1.0.23

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 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ketekny-ui-kit",
3
3
  "type": "module",
4
- "version": "1.0.21",
4
+ "version": "1.0.23",
5
5
  "description": "A Vue 3 UI component library with Tailwind CSS styling",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -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>
@@ -57,7 +57,7 @@
57
57
  <SelectViewport
58
58
  ref="viewportRef"
59
59
  class="select-viewport p-1 overflow-y-scroll"
60
- :style="{ maxHeight: dropdownHeight }"
60
+ :style="{ maxHeight: resolvedDropdownHeight }"
61
61
  @keydown="handleViewportKeydown"
62
62
  >
63
63
  <SelectItem
@@ -138,9 +138,44 @@ const defaultStyle = "w-full px-3 py-2 border rounded-lg transition shadow-sm fo
138
138
  const errorStyle = "border-red-500 focus:ring focus:ring-red-300";
139
139
  const disabledStyle = "!bg-gray-100 !text-gray-400 !cursor-not-allowed";
140
140
 
141
+ function normalizeDropdownHeight(value) {
142
+ const raw = String(value ?? "").trim();
143
+ if (!raw) return "min(400px, 40vh)";
144
+
145
+ // Accept Tailwind arbitrary values like max-h-[400px] / min-h-[20rem].
146
+ const arbitraryMatch = raw.match(/^(?:max-h|min-h)-\[(.+)\]$/);
147
+ if (arbitraryMatch) return arbitraryMatch[1].trim();
148
+
149
+ // Accept Tailwind scale values like max-h-80 -> 20rem.
150
+ const scaleMatch = raw.match(/^(?:max-h|min-h)-(\d+(?:\.\d+)?)$/);
151
+ if (scaleMatch) {
152
+ const scale = Number(scaleMatch[1]);
153
+ if (Number.isFinite(scale)) return `${scale * 0.25}rem`;
154
+ }
155
+
156
+ // Accept common Tailwind keywords.
157
+ const keywordMap = {
158
+ "max-h-full": "100%",
159
+ "min-h-full": "100%",
160
+ "max-h-screen": "100vh",
161
+ "min-h-screen": "100vh",
162
+ "max-h-fit": "fit-content",
163
+ "min-h-fit": "fit-content",
164
+ "max-h-min": "min-content",
165
+ "min-h-min": "min-content",
166
+ "max-h-max": "max-content",
167
+ "min-h-max": "max-content",
168
+ };
169
+ if (keywordMap[raw]) return keywordMap[raw];
170
+
171
+ // Already valid CSS values (e.g. 20rem, 400px, min(400px, 40vh)).
172
+ return raw;
173
+ }
174
+
141
175
  const computedId = computed(() => (props.id != null && props.id !== "" ? props.id : generatedId));
142
176
  const hasError = computed(() => props.error != null && props.error !== false);
143
177
  const isSelectionSet = computed(() => props.modelValue !== null && props.modelValue !== undefined && props.modelValue !== "");
178
+ const resolvedDropdownHeight = computed(() => normalizeDropdownHeight(props.dropdownHeight));
144
179
 
145
180
  const internalValue = computed({
146
181
  get() {
@@ -1,5 +1,6 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  export default {
3
+ darkMode: "class",
3
4
  content: [
4
5
  "./index.html",
5
6
  "./src/**/*.{vue,js,ts,jsx,tsx}",