Skip to content

Commit

Permalink
feat(CommandPalette): bind active and selected to scoped slot (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
KeJunMao committed Jul 24, 2023
1 parent 4f4a659 commit b0440f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/components/navigation/CommandPaletteGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
>
<div :class="[ui.group.command.base, active ? ui.group.command.active : ui.group.command.inactive, command.disabled ? 'cursor-not-allowed' : 'cursor-pointer']">
<div :class="ui.group.command.container">
<slot :name="`${group.key}-icon`" :group="group" :command="command">
<slot :name="`${group.key}-icon`" :group="group" :command="command" :active="active" :selected="selected">
<UIcon v-if="command.icon" :name="command.icon" :class="[ui.group.command.icon.base, active ? ui.group.command.icon.active : ui.group.command.icon.inactive, command.iconClass]" aria-hidden="true" />
<UAvatar
v-else-if="command.avatar"
Expand All @@ -27,7 +27,7 @@
</slot>

<div :class="[ui.group.command.label, command.disabled && ui.group.command.disabled]">
<slot :name="`${group.key}-command`" :group="group" :command="command">
<slot :name="`${group.key}-command`" :group="group" :command="command" :active="active" :selected="selected">
<span v-if="command.prefix" class="flex-shrink-0" :class="command.prefixClass || ui.group.command.prefix">{{ command.prefix }}</span>

<span class="truncate" :class="{ 'flex-none': command.suffix || command.matches?.length }">{{ command[commandAttribute] }}</span>
Expand All @@ -40,10 +40,10 @@
</div>
<UIcon v-if="selected" :name="selectedIcon" :class="ui.group.command.selectedIcon.base" aria-hidden="true" />
<slot v-else-if="active && (group.active || $slots[`${group.key}-active`])" :name="`${group.key}-active`" :group="group" :command="command">
<slot v-else-if="active && (group.active || $slots[`${group.key}-active`])" :name="`${group.key}-active`" :group="group" :command="command" :active="active" :selected="selected">

Check failure on line 43 in src/runtime/components/navigation/CommandPaletteGroup.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

':selected' should be on a new line
<span v-if="group.active" :class="ui.group.active">{{ group.active }}</span>
</slot>
<slot v-else :name="`${group.key}-inactive`" :group="group" :command="command">
<slot v-else :name="`${group.key}-inactive`" :group="group" :command="command" :active="active" :selected="selected">

Check failure on line 46 in src/runtime/components/navigation/CommandPaletteGroup.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

':selected' should be on a new line
<span v-if="command.shortcuts?.length" :class="ui.group.command.shortcuts">
<UKbd v-for="shortcut of command.shortcuts" :key="shortcut">{{ shortcut }}</UKbd>
</span>
Expand Down

1 comment on commit b0440f8

@vercel
Copy link

@vercel vercel bot commented on b0440f8 Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-nuxtlabs.vercel.app
ui.nuxtlabs.com
ui-git-dev-nuxtlabs.vercel.app

Please sign in to comment.