mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-23 08:20:39 +01:00
chore(CommandPalette): start preset
This commit is contained in:
@@ -7,23 +7,24 @@
|
|||||||
:nullable="nullable"
|
:nullable="nullable"
|
||||||
@update:model-value="onSelect"
|
@update:model-value="onSelect"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col flex-1 min-h-0 divide-y divide-gray-100 dark:divide-gray-800">
|
<div :class="$ui.commandPalette.wrapper">
|
||||||
<div v-show="searchable" class="relative flex items-center">
|
<div v-show="searchable" class="relative flex items-center">
|
||||||
<Icon :name="inputIcon" class="pointer-events-none absolute top-3.5 left-5 h-5 w-5 u-text-gray-400" aria-hidden="true" />
|
<Icon :name="inputIcon" :class="$ui.commandPalette.input.icon.base" aria-hidden="true" />
|
||||||
<ComboboxInput
|
<ComboboxInput
|
||||||
ref="comboboxInput"
|
ref="comboboxInput"
|
||||||
:value="query"
|
:value="query"
|
||||||
class="w-full h-12 pr-4 placeholder-gray-400 dark:placeholder-gray-500 bg-transparent border-0 pl-[3.25rem] u-text-gray-900 focus:ring-0 sm:text-sm"
|
:class="$ui.commandPalette.input.base"
|
||||||
:placeholder="inputPlaceholder"
|
:placeholder="inputPlaceholder"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
@change="query = $event.target.value"
|
@change="query = $event.target.value"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
v-if="closeIcon"
|
v-if="inputCloseIcon"
|
||||||
:icon="closeIcon"
|
:icon="inputCloseIcon"
|
||||||
variant="transparent"
|
:class="$ui.commandPalette.input.close.base"
|
||||||
class="absolute right-2"
|
:size="$ui.commandPalette.input.close.size"
|
||||||
|
:variant="$ui.commandPalette.input.close.variant"
|
||||||
aria-label="close"
|
aria-label="close"
|
||||||
@click="onClear"
|
@click="onClear"
|
||||||
/>
|
/>
|
||||||
@@ -59,6 +60,7 @@ import type { Group, Command } from '../../types/command-palette'
|
|||||||
import Icon from '../elements/Icon.vue'
|
import Icon from '../elements/Icon.vue'
|
||||||
import Button from '../elements/Button.vue'
|
import Button from '../elements/Button.vue'
|
||||||
import CommandPaletteGroup from './CommandPaletteGroup.vue'
|
import CommandPaletteGroup from './CommandPaletteGroup.vue'
|
||||||
|
import $ui from '#build/ui'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@@ -85,13 +87,13 @@ const props = defineProps({
|
|||||||
type: Array as PropType<Group[]>,
|
type: Array as PropType<Group[]>,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
closeIcon: {
|
|
||||||
type: String,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
inputIcon: {
|
inputIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'heroicons-outline:search'
|
default: () => $ui.commandPalette.input.icon.name
|
||||||
|
},
|
||||||
|
inputCloseIcon: {
|
||||||
|
type: String,
|
||||||
|
default: () => $ui.commandPalette.input.close.icon.name
|
||||||
},
|
},
|
||||||
inputPlaceholder: {
|
inputPlaceholder: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -99,7 +101,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
emptyIcon: {
|
emptyIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'heroicons-outline:search'
|
default: () => $ui.commandPalette.empty.icon.name
|
||||||
},
|
},
|
||||||
groupAttribute: {
|
groupAttribute: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
@@ -566,6 +566,30 @@ export default function defaultPreset (variantColors: string[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commandPalette = {
|
||||||
|
wrapper: 'flex flex-col flex-1 min-h-0 divide-y divide-gray-100 dark:divide-gray-800',
|
||||||
|
input: {
|
||||||
|
base: 'w-full h-12 pr-4 placeholder-gray-400 dark:placeholder-gray-500 bg-transparent border-0 pl-[3.25rem] u-text-gray-900 focus:ring-0 sm:text-sm',
|
||||||
|
icon: {
|
||||||
|
base: 'pointer-events-none absolute top-3.5 left-5 h-5 w-5 u-text-gray-400',
|
||||||
|
name: 'heroicons-outline:search'
|
||||||
|
},
|
||||||
|
close: {
|
||||||
|
base: 'absolute right-2',
|
||||||
|
variant: 'transparent',
|
||||||
|
size: 'md',
|
||||||
|
icon: {
|
||||||
|
name: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
empty: {
|
||||||
|
icon: {
|
||||||
|
name: 'heroicons-outline:search'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
card,
|
card,
|
||||||
modal,
|
modal,
|
||||||
@@ -591,7 +615,8 @@ export default function defaultPreset (variantColors: string[]) {
|
|||||||
notification,
|
notification,
|
||||||
tooltip,
|
tooltip,
|
||||||
popover,
|
popover,
|
||||||
contextMenu
|
contextMenu,
|
||||||
|
commandPalette
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user