Compare commits

..

28 Commits

Author SHA1 Message Date
Benjamin Canac
04d5ce1c51 chore(release): 0.1.6 2022-11-15 12:08:10 +01:00
Benjamin Canac
3a300f72c1 fix(SelectCustom): add w-full on ComboboxButton 2022-11-10 14:37:37 +01:00
Benjamin Canac
927debfb6b chore(SelectCustom): add missing inline-flex on button 2022-11-10 13:54:43 +01:00
Benjamin Canac
44176ee897 chore(Notification): improve actions text color 2022-11-09 11:52:52 +01:00
Benjamin Canac
7f9d69183c chore(release): 0.1.5 2022-11-08 16:44:13 +01:00
Benjamin Canac
23e5f4c501 chore(CommandPalette): add autoclear prop 2022-11-08 16:43:18 +01:00
Benjamin Canac
24998e3ac5 chore(release): 0.1.4 2022-11-08 11:02:42 +01:00
Benjamin Canac
bebf18a89a chore(deps): bump 2022-11-08 11:02:22 +01:00
Anthony Fu
1b56b50d4d fix(button): support RouteLocationRaw type for to (#112) 2022-11-08 10:57:55 +01:00
Benjamin Canac
3337559b89 chore(release): 0.1.3 2022-11-04 12:21:08 +01:00
Benjamin Canac
d33a23ebc0 chore(deps): bump 2022-11-04 12:19:20 +01:00
Baptiste Leproux
28586c35a5 fix(types): add missing field in command palette type (#111) 2022-11-02 16:04:50 +01:00
Benjamin Canac
e521e1ac24 fix(docs): component input string field 2022-11-02 11:21:35 +01:00
Sylvain Marroufin
8ea3223071 chore(typescript): minor fixes (#110) 2022-11-02 10:50:40 +01:00
Benjamin Canac
4cbe983f61 chore(release): 0.1.2 2022-10-27 16:05:16 +02:00
Benjamin Canac
e42969f003 chore(Tooltip): improve design 2022-10-27 16:04:49 +02:00
Benjamin Canac
c93e37a0eb chore(Tooltip): handle shortcuts 2022-10-27 14:26:31 +02:00
Sylvain Marroufin
9e20f96b65 chore(Dropdown): don't show outline on keyboard navigation (#108) 2022-10-27 11:52:16 +02:00
Benjamin Canac
9f6f132a76 chore(release): 0.1.1 2022-10-26 13:13:13 +02:00
Sylvain Marroufin
5517cc2846 fix(Dropdown): close on click item with to (#103)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2022-10-26 13:05:41 +02:00
Benjamin Canac
8c24b5dc97 chore(module): add d.ts file 2022-10-26 13:04:36 +02:00
Benjamin Canac
ec8bd5cdc4 fix(SelectCustom): types and lint 2022-10-26 13:04:36 +02:00
Benjamin Canac
6fab68baa8 fix(CommandPalette): lint 2022-10-26 13:04:36 +02:00
Benjamin Canac
fc951e2980 chore(CommandPalette): improve types 2022-10-26 13:04:36 +02:00
Benjamin Canac
08ff6e6c09 docs: update 2022-10-26 13:04:36 +02:00
Sylvain Marroufin
9dcdaf474e chore(Dropdown|Popover|Tooltip): hover delay (#104) 2022-10-26 11:59:49 +02:00
Sylvain Marroufin
e9f0224b91 fix(Popover): avoid crash on mount if ref not loaded (#105) 2022-10-26 11:57:13 +02:00
Benjamin Canac
929192fd46 chore(deps): bump vueuse 2022-10-25 16:32:42 +02:00
20 changed files with 841 additions and 756 deletions

View File

@@ -2,6 +2,42 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.1.6](https://github.com/nuxtlabs/ui/compare/v0.1.5...v0.1.6) (2022-11-15)
### Bug Fixes
* **SelectCustom:** add `w-full` on `ComboboxButton` ([3a300f7](https://github.com/nuxtlabs/ui/commit/3a300f72c1eca756ffd8f07ab871bf9c7bd7868d))
### [0.1.5](https://github.com/nuxtlabs/ui/compare/v0.1.4...v0.1.5) (2022-11-08)
### [0.1.4](https://github.com/nuxtlabs/ui/compare/v0.1.3...v0.1.4) (2022-11-08)
### Bug Fixes
* **button:** support `RouteLocationRaw` type for `to` ([#112](https://github.com/nuxtlabs/ui/issues/112)) ([1b56b50](https://github.com/nuxtlabs/ui/commit/1b56b50d4d54a5cb9e5febacdf42867988ae6c5d))
### [0.1.3](https://github.com/nuxtlabs/ui/compare/v0.1.2...v0.1.3) (2022-11-04)
### Bug Fixes
* **docs:** component input string field ([e521e1a](https://github.com/nuxtlabs/ui/commit/e521e1ac2421dc331652f1ea4ac2b0b2959dc069))
* **types:** add missing field in command palette type ([#111](https://github.com/nuxtlabs/ui/issues/111)) ([28586c3](https://github.com/nuxtlabs/ui/commit/28586c35a558d9e925094f86e07acdb928d54ad7))
### [0.1.2](https://github.com/nuxtlabs/ui/compare/v0.1.1...v0.1.2) (2022-10-27)
### [0.1.1](https://github.com/nuxtlabs/ui/compare/v0.1.0...v0.1.1) (2022-10-26)
### Bug Fixes
* **CommandPalette:** lint ([6fab68b](https://github.com/nuxtlabs/ui/commit/6fab68baa836c97680446e8cfdee7c5a64008539))
* **Dropdown:** close on click item with `to` ([#103](https://github.com/nuxtlabs/ui/issues/103)) ([5517cc2](https://github.com/nuxtlabs/ui/commit/5517cc28467f957956a20126c1ce48e64677cb82))
* **Popover:** avoid crash on mount if ref not loaded ([#105](https://github.com/nuxtlabs/ui/issues/105)) ([e9f0224](https://github.com/nuxtlabs/ui/commit/e9f0224b919445260d3b19511420a3fd448e4ea7))
* **SelectCustom:** types and lint ([ec8bd5c](https://github.com/nuxtlabs/ui/commit/ec8bd5cdc49feb924dfdff352d9f3d788653c583))
## [0.1.0](https://github.com/nuxtlabs/ui/compare/v0.0.3...v0.1.0) (2022-10-25)

View File

@@ -10,7 +10,9 @@
</div>
<div class="flex items-center gap-3">
<UButton variant="transparent" :icon="colorMode.value === 'dark' ? 'heroicons-outline:moon' : 'heroicons-outline:sun'" @click="toggleDark" />
<ColorScheme placeholder="" tag="span">
<UButton variant="transparent" :icon="colorMode.value === 'dark' ? 'heroicons-outline:moon' : 'heroicons-outline:sun'" @click="toggleDark" />
</ColorScheme>
<UButton to="https://github.com/nuxtlabs/ui" target="_blank" variant="transparent" icon="fa-brands:github" />
</div>
</div>
@@ -19,7 +21,7 @@
<UContainer class="mt-16">
<div class="lg:grid lg:grid-cols-10 lg:gap-10 lg:relative">
<aside class="lg:flex lg:flex-col lg:relative pb-8 lg:pb-0 lg:sticky lg:top-0 px-4 sm:px-6 lg:px-0 lg:pt-16 lg:-mt-16 lg:self-start lg:col-span-2 lg:overflow-hidden lg:sticky lg:h-screen">
<aside class="lg:flex lg:flex-col pb-8 lg:pb-0 lg:sticky lg:top-0 px-4 sm:px-6 lg:px-0 lg:pt-16 lg:-mt-16 lg:self-start lg:col-span-2 lg:overflow-hidden lg:h-screen">
<nav class="overflow-y-auto h-auto pt-8 lg:py-12">
<ul class="space-y-6">
<li v-for="section of sections" :key="section">

View File

@@ -1,4 +1,3 @@
import { defineNuxtConfig } from 'nuxt'
import defaultTheme from 'tailwindcss/defaultTheme'
import nuxtUI from '../src/module'

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-template-shadow -->
<!-- eslint-disable vue/no-v-html -->
<!-- eslint-disable vue/no-v-text-v-html-on-component -->
<template>
@@ -66,7 +67,7 @@
size="sm"
/>
<UInput
v-else-if="prop.type === 'String' && typeof prop.value === 'string'"
v-else-if="prop.type === 'String'"
v-model="prop.value"
:name="prop.key"
size="sm"

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<div class="space-y-4">
<div class="pb-10 border-b u-border-gray-200 mb-10">
@@ -153,8 +154,8 @@
Tooltip:
</div>
<UTooltip text="Hello tooltip!">
<UIcon name="heroicons-outline:information-circle" class="w-6 h-6 text-black cursor-pointer" />
<UTooltip text="Hello tooltip!" :shortcuts="['⌘', 'G']">
<UIcon name="heroicons-outline:information-circle" class="w-6 h-6 u-text-gray-900 cursor-pointer" />
</UTooltip>
</div>

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<div class="space-y-4">
<div class="pb-10 border-b u-border-gray-200 mb-10">

View File

@@ -1,6 +1,6 @@
{
"name": "@nuxthq/ui",
"version": "0.1.0",
"version": "0.1.6",
"repository": "https://github.com/nuxtlabs/ui",
"license": "MIT",
"exports": {
@@ -24,28 +24,28 @@
"release": "yarn lint && standard-version && git push --follow-tags"
},
"dependencies": {
"@headlessui/vue": "^1.7.3",
"@headlessui/vue": "^1.7.4",
"@iconify/vue": "^4.0.0",
"@nuxt/kit": "^3.0.0-rc.12",
"@nuxt/kit": "^3.0.0-rc.13",
"@nuxtjs/color-mode": "^3.1.8",
"@nuxtjs/tailwindcss": "^6.1.1",
"@nuxtjs/tailwindcss": "^6.1.3",
"@popperjs/core": "^2.11.6",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/line-clamp": "^0.4.2",
"@tailwindcss/typography": "^0.5.7",
"@vueuse/core": "^9.3.1",
"@vueuse/integrations": "^9.3.1",
"@tailwindcss/typography": "^0.5.8",
"@vueuse/core": "^9.4.0",
"@vueuse/integrations": "^9.4.0",
"defu": "^6.1.0",
"fuse.js": "^6.6.2",
"lodash-es": "^4.17.21",
"tailwindcss": "^3.2.1"
"tailwindcss": "^3.2.2"
},
"devDependencies": {
"@nuxt/module-builder": "^0.2.0",
"@nuxtjs/eslint-config-typescript": "^11.0.0",
"@types/lodash-es": "^4.17.6",
"eslint": "^8.26.0",
"eslint": "^8.27.0",
"nuxt": "^3.0.0-rc.9",
"standard-version": "^9.5.0",
"vue-tsc": "^1.0.9"

View File

@@ -114,6 +114,11 @@ export default defineNuxtModule<ModuleOptions>({
filename: 'ui.mjs',
getContents: () => `export default ${JSON.stringify(ui)}`
})
addTemplate({
filename: 'ui.d.ts',
write: true,
getContents: () => 'declare const d: any; export default d;'
})
})
await installModule('@nuxtjs/color-mode', { classSuffix: '' })

View File

@@ -15,7 +15,7 @@
<script setup lang="ts">
import { ref, computed, useSlots } from 'vue'
import type { PropType } from 'vue'
import type { RouteLocationNormalized } from 'vue-router'
import type { RouteLocationNormalized, RouteLocationRaw } from 'vue-router'
import NuxtLink from '#app/components/nuxt-link'
import Icon from '../elements/Icon.vue'
import { classNames } from '../../utils'
@@ -81,7 +81,7 @@ const props = defineProps({
default: false
},
to: {
type: [String, Object] as PropType<string | RouteLocationNormalized>,
type: [String, Object] as PropType<string | RouteLocationNormalized | RouteLocationRaw>,
default: null
},
target: {

View File

@@ -10,8 +10,8 @@
<transition appear v-bind="transitionClass">
<MenuItems :class="baseClass" static>
<div v-for="(subItems, index) of items" :key="index" :class="groupClass">
<MenuItem v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ active, disabled }" :disabled="item.disabled" as="div">
<Component v-bind="item" :is="(item.to && NuxtLink) || (item.click && 'button') || 'div'" :class="resolveItemClass({ active, disabled })" @click="e => onItemClick(e, item)">
<MenuItem v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ active, disabled }" :disabled="item.disabled" @click="e => item.click?.(e)">
<Component v-bind="item" :is="(item.to && NuxtLink) || (item.click && 'button') || 'div'" :class="resolveItemClass({ active, disabled })">
<slot :name="item.slot" :item="item">
<Icon v-if="item.icon" :name="item.icon" :class="[itemIconClass, item.iconClass]" />
<Avatar v-if="item.avatar" v-bind="{ size: 'xxs', ...item.avatar }" :class="itemAvatarClass" />
@@ -129,6 +129,14 @@ const props = defineProps({
popperOptions: {
type: Object as PropType<PopperOptions>,
default: () => {}
},
openDelay: {
type: Number,
default: 50
},
closeDelay: {
type: Number,
default: 0
}
})
@@ -144,17 +152,9 @@ function resolveItemClass ({ active, disabled }: { active: boolean, disabled: bo
)
}
function onItemClick (e, item: any) {
if (item.disabled) {
return
}
if (item.click) {
item.click(e)
}
}
// https://github.com/tailwindlabs/headlessui/blob/f66f4926c489fc15289d528294c23a3dc2aee7b1/packages/%40headlessui-vue/src/components/menu/menu.ts#L131
const menuApi: Ref<any> = ref(null)
let openTimeout: NodeJS.Timeout | null = null
let closeTimeout: NodeJS.Timeout | null = null
@@ -167,7 +167,7 @@ onMounted(() => {
const menuProvidesSymbols = Object.getOwnPropertySymbols(menuProvides)
menuApi.value = menuProvidesSymbols.length && menuProvides[menuProvidesSymbols[0]]
// stop trigger click propagation on hover
menuApi.value?.buttonRef.addEventListener('click', (e: Event) => {
menuApi.value?.buttonRef?.addEventListener('click', (e: Event) => {
if (props.mode === 'hover') {
e.stopPropagation()
}
@@ -192,7 +192,7 @@ function onMouseOver () {
openTimeout = openTimeout || setTimeout(() => {
menuApi.value.openMenu && menuApi.value.openMenu()
openTimeout = null
}, 50)
}, props.openDelay)
}
function onMouseLeave () {
@@ -212,7 +212,7 @@ function onMouseLeave () {
closeTimeout = closeTimeout || setTimeout(() => {
menuApi.value.closeMenu && menuApi.value.closeMenu()
closeTimeout = null
}, 0)
}, props.closeDelay)
}
</script>

View File

@@ -12,8 +12,8 @@
>
<input :value="modelValue" :required="required" class="absolute inset-0 w-px opacity-0 cursor-default" tabindex="-1">
<ComboboxButton ref="trigger" v-slot="{ disabled }" as="div">
<slot :open="open" :disabled="disabled">
<ComboboxButton ref="trigger" v-slot="{ disabled: buttonDisabled }" as="div" class="inline-flex w-full">
<slot :open="open" :disabled="buttonDisabled">
<button :class="selectCustomClass" :disabled="disabled" type="button">
<slot name="label">
<span v-if="modelValue" class="block truncate">{{ modelValue[textAttribute] }}</span>
@@ -44,13 +44,13 @@
/>
<ComboboxOption
v-for="(option, index) in filteredOptions"
v-slot="{ active, selected, disabled }"
v-slot="{ active, selected, disabled: optionDisabled }"
:key="index"
as="template"
:value="option"
:disabled="option.disabled"
>
<li :class="resolveOptionClass({ active, selected, disabled })">
<li :class="resolveOptionClass({ active, selected, disabled: optionDisabled })">
<div :class="listOptionContainerClass">
<slot name="option" :option="option" :active="active" :selected="selected">
<span class="block truncate">{{ option[textAttribute] }}</span>
@@ -110,7 +110,7 @@ const props = defineProps({
default: undefined
},
options: {
type: Array as PropType<{ disabled?: boolean }[]>,
type: Array as PropType<{ [key: string]: any, disabled?: boolean }[]>,
default: () => []
},
required: {

View File

@@ -110,6 +110,10 @@ const props = defineProps({
type: Boolean,
default: true
},
autoclear: {
type: Boolean,
default: true
},
placeholder: {
type: Boolean,
default: true
@@ -166,7 +170,7 @@ const groups = computed(() => map(groupBy(results.value, command => command.item
return {
...props.groups.find(group => group.key === key),
commands: commands.slice(0, options.value.resultLimit)
}
} as Group
}))
// Methods
@@ -183,7 +187,7 @@ function onSelect (option: Command | Command[]) {
emit('update:modelValue', option, { query: query.value })
// Clear input after selection
if (!props.multiple) {
if (props.autoclear) {
setTimeout(() => {
query.value = ''
}, 0)

View File

@@ -26,6 +26,7 @@
<div class="flex items-center gap-1.5 min-w-0" :class="{ 'opacity-50': command.disabled }">
<slot :name="`${group.key}-command`" :group="group" :command="command">
<span v-if="command.prefix" class="u-text-gray-400">{{ command.prefix }}</span>
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-if="command.matches?.length" class="truncate" :class="{ 'flex-none': command.suffix }" v-html="highlight(command.matches[0])" />
<span v-else class="truncate" :class="{ 'flex-none': command.suffix }">{{ command[commandAttribute] }}</span>
<span v-if="command.suffix" class="u-text-gray-400 truncate">{{ command.suffix }}</span>

View File

@@ -9,7 +9,8 @@
</template>
<script setup lang="ts">
import { PropType, computed, toRef } from 'vue'
import type { PropType } from 'vue'
import { computed, toRef } from 'vue'
import { defu } from 'defu'
import { usePopper } from '../../composables/usePopper'
import type { PopperOptions } from '../../types'

View File

@@ -20,14 +20,14 @@
</p>
<div v-if="description && actions.length" class="mt-3 flex items-center gap-6">
<button v-for="(action, index) of actions" :key="index" type="button" class="text-sm font-medium focus:outline-none text-primary-500 hover:text-primary-600 dark:hover:text-primary-400" @click.stop="onAction(action)">
<button v-for="(action, index) of actions" :key="index" type="button" class="text-sm font-medium focus:outline-none text-primary-500 dark:text-primary-400 hover:text-primary-400 dark:hover:text-primary-500" @click.stop="onAction(action)">
{{ action.label }}
</button>
</div>
</div>
<div class="flex-shrink-0 flex items-center gap-3">
<div v-if="!description && actions.length" class="flex items-center gap-2">
<button v-for="(action, index) of actions" :key="index" type="button" class="text-sm font-medium focus:outline-none text-primary-500 hover:text-primary-600 dark:hover:text-primary-400" @click.stop="onAction(action)">
<button v-for="(action, index) of actions" :key="index" type="button" class="text-sm font-medium focus:outline-none text-primary-500 dark:text-primary-400 hover:text-primary-400 dark:hover:text-primary-500" @click.stop="onAction(action)">
{{ action.label }}
</button>
</div>

View File

@@ -56,6 +56,14 @@ const props = defineProps({
popperOptions: {
type: Object as PropType<PopperOptions>,
default: () => {}
},
openDelay: {
type: Number,
default: 50
},
closeDelay: {
type: Number,
default: 0
}
})
@@ -63,6 +71,7 @@ const popperOptions = computed<PopperOptions>(() => defu({}, props.popperOptions
const [trigger, container] = usePopper(popperOptions.value)
// https://github.com/tailwindlabs/headlessui/blob/f66f4926c489fc15289d528294c23a3dc2aee7b1/packages/%40headlessui-vue/src/components/popover/popover.ts#L151
const popoverApi: Ref<any> = ref(null)
let openTimeout: NodeJS.Timeout | null = null
@@ -77,7 +86,7 @@ onMounted(() => {
const popoverProvidesSymbols = Object.getOwnPropertySymbols(popoverProvides)
popoverApi.value = popoverProvidesSymbols.length && popoverProvides[popoverProvidesSymbols[0]]
// stop trigger click propagation on hover
popoverApi.value.button.addEventListener('click', (e: Event) => {
popoverApi.value?.button?.addEventListener('click', (e: Event) => {
if (props.mode === 'hover') {
e.stopPropagation()
}
@@ -89,6 +98,7 @@ function onMouseOver () {
if (props.mode !== 'hover' || !popoverApi.value) {
return
}
// cancel programmed closing
if (closeTimeout) {
clearTimeout(closeTimeout)
@@ -101,13 +111,14 @@ function onMouseOver () {
openTimeout = openTimeout || setTimeout(() => {
popoverApi.value.togglePopover && popoverApi.value.togglePopover()
openTimeout = null
}, 50)
}, props.openDelay)
}
function onMouseLeave () {
if (props.mode !== 'hover' || !popoverApi.value) {
return
}
// cancel programmed opening
if (openTimeout) {
clearTimeout(openTimeout)
@@ -120,7 +131,7 @@ function onMouseLeave () {
closeTimeout = closeTimeout || setTimeout(() => {
popoverApi.value.closePopover && popoverApi.value.closePopover()
closeTimeout = null
}, 0)
}, props.closeDelay)
}
</script>

View File

@@ -1,15 +1,22 @@
<template>
<div ref="trigger" :class="wrapperClass" @mouseover="open = true" @mouseleave="open = false">
<div ref="trigger" :class="wrapperClass" @mouseover="onMouseOver" @mouseleave="onMouseLeave">
<slot :open="open">
Hover me
</slot>
<div v-if="open" ref="container" :class="[containerClass, widthClass]">
<transition appear v-bind="transitionClass">
<div :class="baseClass">
<div :class="[baseClass, backgroundClass, roundedClass, shadowClass, ringClass]">
<slot name="text">
{{ text }}
<span class="truncate">{{ text }}</span>
</slot>
<span v-if="shortcuts?.length" class="inline-flex items-center justify-end flex-shrink-0 gap-0.5 ml-1">
<span class="mr-1 u-text-gray-700">&middot;</span>
<kbd v-for="shortcut of shortcuts" :key="shortcut" class="flex items-center justify-center font-sans px-1 h-4 min-w-[16px] text-[10px] u-bg-gray-100 rounded u-text-gray-900">
{{ shortcut }}
</kbd>
</span>
</div>
</transition>
</div>
@@ -29,6 +36,10 @@ const props = defineProps({
type: String,
default: null
},
shortcuts: {
type: Array as PropType<string[]>,
default: () => []
},
wrapperClass: {
type: String,
default: () => $ui.tooltip.wrapper
@@ -41,6 +52,22 @@ const props = defineProps({
type: String,
default: () => $ui.tooltip.width
},
backgroundClass: {
type: String,
default: () => $ui.tooltip.background
},
shadowClass: {
type: String,
default: () => $ui.tooltip.shadow
},
ringClass: {
type: String,
default: () => $ui.tooltip.ring
},
roundedClass: {
type: String,
default: () => $ui.tooltip.rounded
},
baseClass: {
type: String,
default: () => $ui.tooltip.base
@@ -52,6 +79,14 @@ const props = defineProps({
popperOptions: {
type: Object as PropType<PopperOptions>,
default: () => {}
},
openDelay: {
type: Number,
default: 0
},
closeDelay: {
type: Number,
default: 0
}
})
@@ -60,6 +95,43 @@ const popperOptions = computed<PopperOptions>(() => defu({}, props.popperOptions
const [trigger, container] = usePopper(popperOptions.value)
const open = ref(false)
let openTimeout: NodeJS.Timeout | null = null
let closeTimeout: NodeJS.Timeout | null = null
// Methods
function onMouseOver () {
// cancel programmed closing
if (closeTimeout) {
clearTimeout(closeTimeout)
closeTimeout = null
}
// dropdown already open
if (open.value) {
return
}
openTimeout = openTimeout || setTimeout(() => {
open.value = true
openTimeout = null
}, props.openDelay)
}
function onMouseLeave () {
// cancel programmed opening
if (openTimeout) {
clearTimeout(openTimeout)
openTimeout = null
}
// dropdown already closed
if (!open.value) {
return
}
closeTimeout = closeTimeout || setTimeout(() => {
open.value = false
closeTimeout = null
}, props.closeDelay)
}
</script>
<script lang="ts">

View File

@@ -342,7 +342,7 @@ export default (variantColors: string[]) => {
wrapper: 'relative inline-flex text-left',
container: 'z-20',
width: 'w-48',
base: 'u-bg-white divide-y u-divide-gray-100 rounded-md ring-1 u-ring-gray-200 shadow-lg',
base: 'u-bg-white divide-y u-divide-gray-100 rounded-md ring-1 u-ring-gray-200 shadow-lg focus:outline-none',
group: 'py-1',
item: {
base: 'group flex items-center gap-3 px-4 py-2 text-sm w-full',
@@ -487,7 +487,11 @@ export default (variantColors: string[]) => {
wrapper: 'relative inline-flex',
container: 'z-20',
width: 'max-w-xs',
base: 'invisible w-auto h-6 px-2 py-1 space-x-1 truncate rounded shadow lg:visible u-bg-gray-800 truncate u-text-gray-50 text-xs',
background: 'u-bg-white',
shadow: 'shadow',
rounded: 'rounded',
ring: 'ring-1 u-ring-gray-200',
base: 'invisible lg:visible h-6 px-2 py-1 text-xs font-normal',
transition: {
enterActiveClass: 'transition ease-out duration-200',
enterFromClass: 'opacity-0 translate-y-1',

View File

@@ -1,6 +1,6 @@
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
import type { FuseSortFunctionMatch, FuseSortFunctionMatchList } from 'fuse.js'
import type { Avatar } from './avatar'
export interface Command {
id: string | number
prefix?: string
@@ -11,6 +11,10 @@ export interface Command {
chip?: string
disabled?: boolean
shortcuts?: string[]
group?: string
score?: number
matches?: (FuseSortFunctionMatch | FuseSortFunctionMatchList)[]
[key: string]: any
}
export interface Group {
@@ -19,4 +23,5 @@ export interface Group {
inactive?: string
commands: Command[]
options?: Partial<UseFuseOptions<Command>>
[key: string]: any
}

1352
yarn.lock

File diff suppressed because it is too large Load Diff