ketekny-ui-kit 1.0.64 → 1.0.66

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ketekny-ui-kit",
3
3
  "type": "module",
4
- "version": "1.0.64",
4
+ "version": "1.0.66",
5
5
  "description": "A Vue 3 UI component library with Tailwind CSS styling",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -83,7 +83,7 @@
83
83
  <component
84
84
  v-for="item in normalizedMainMenu"
85
85
  :key="item.key"
86
- :is="item.isLink ? RouterLink : item.isExternal ? 'a' : 'button'"
86
+ :is="menuItemTag(item)"
87
87
  v-bind="item.bindings"
88
88
  class="flex w-full items-start gap-3 rounded-2xl border px-4 py-4 text-left transition-all duration-200"
89
89
  :class="item.classes"
@@ -203,6 +203,7 @@
203
203
  </template>
204
204
 
205
205
  <script>
206
+ import { h } from 'vue'
206
207
  import kButton from '../ui/kButton.vue'
207
208
  import kIcon from '../ui/kIcon.vue'
208
209
  import { RouterLink } from 'vue-router'
@@ -226,23 +227,32 @@ const SidebarIconLink = {
226
227
  if (this.onClick) this.onClick(event)
227
228
  },
228
229
  },
229
- template: `
230
- <component
231
- :is="to ? RouterLink : isExternal ? 'a' : 'button'"
232
- :to="to"
233
- :href="href"
234
- :target="isExternal ? target : null"
235
- :rel="isExternal ? rel : null"
236
- :type="to || isExternal ? null : 'button'"
237
- :title="title"
238
- class="group relative flex h-14 w-14 items-center justify-center rounded-xl border border-white/15 transition"
239
- :class="active ? 'bg-slate-950 text-white' : warning ? 'bg-[#d97706] text-white hover:bg-[#b45309]' : 'bg-white/5 text-white hover:border-cyan-400/40 hover:bg-white/10'"
240
- @click="handleClick"
241
- >
242
- <kIcon :name="icon" size="20" class="text-current" />
243
- </component>
244
- `,
245
- components: { RouterLink, kIcon },
230
+ render() {
231
+ const isLink = Boolean(this.to)
232
+ const tag = isLink ? RouterLink : this.isExternal ? 'a' : 'button'
233
+
234
+ return h(
235
+ tag,
236
+ {
237
+ to: this.to,
238
+ href: this.href,
239
+ target: this.isExternal ? this.target : null,
240
+ rel: this.isExternal ? this.rel : null,
241
+ type: isLink || this.isExternal ? null : 'button',
242
+ title: this.title,
243
+ class: [
244
+ 'group relative flex h-14 w-14 items-center justify-center rounded-xl border border-white/15 transition',
245
+ this.active
246
+ ? 'bg-slate-950 text-white'
247
+ : this.warning
248
+ ? 'bg-[#d97706] text-white hover:bg-[#b45309]'
249
+ : 'bg-white/5 text-white hover:border-cyan-400/40 hover:bg-white/10',
250
+ ],
251
+ onClick: this.handleClick,
252
+ },
253
+ [h(kIcon, { name: this.icon, size: '20', color: '#ffffff' })]
254
+ )
255
+ },
246
256
  }
247
257
 
248
258
  const DEFAULT_STORAGE_KEY = 'two-col-layout-sidebar-collapsed'
@@ -325,6 +335,11 @@ export default {
325
335
  this.isSidebarCollapsed = !this.isSidebarCollapsed
326
336
  this.persistSidebarState()
327
337
  },
338
+ menuItemTag(item) {
339
+ if (item?.isLink) return 'RouterLink'
340
+ if (item?.isExternal) return 'a'
341
+ return 'button'
342
+ },
328
343
  },
329
344
  computed: {
330
345
  normalizedMainMenu() {