mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-31 12:17:54 +01:00
fix: update to fix type issues (#151)
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import { defineNuxtModule, installModule, addComponentsDir, addImportsDir, createResolver, addPlugin } from '@nuxt/kit'
|
import { defineNuxtModule, installModule, addComponentsDir, addImportsDir, createResolver, addPlugin } from '@nuxt/kit'
|
||||||
import colors from 'tailwindcss/colors.js'
|
import colors from 'tailwindcss/colors.js'
|
||||||
import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons'
|
import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons'
|
||||||
|
import { defu } from 'defu'
|
||||||
import { name, version } from '../package.json'
|
import { name, version } from '../package.json'
|
||||||
import { colorsAsRegex, excludeColors } from './runtime/utils/colors'
|
import { colorsAsRegex, excludeColors } from './runtime/utils/colors'
|
||||||
import preset from './runtime/app.config'
|
import { ui as preset } from './preset'
|
||||||
import type { DeepPartial } from './runtime/types'
|
import type { DeepPartial } from './runtime/types'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -23,7 +24,7 @@ declare module 'nuxt/schema' {
|
|||||||
primary?: string
|
primary?: string
|
||||||
gray?: string
|
gray?: string
|
||||||
colors?: string[]
|
colors?: string[]
|
||||||
} & DeepPartial<typeof preset.ui>
|
} & DeepPartial<typeof preset>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +65,8 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
|
|
||||||
nuxt.options.css.push(resolve(runtimeDir, 'ui.css'))
|
nuxt.options.css.push(resolve(runtimeDir, 'ui.css'))
|
||||||
|
|
||||||
|
nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui, preset)
|
||||||
|
|
||||||
nuxt.hook('app:resolve', (app) => {
|
nuxt.hook('app:resolve', (app) => {
|
||||||
app.configs.push(resolve(runtimeDir, 'app.config'))
|
app.configs.push(resolve(runtimeDir, 'app.config'))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -677,8 +677,7 @@ const notifications = {
|
|||||||
container: 'px-4 sm:px-6 py-6 space-y-3 overflow-y-auto'
|
container: 'px-4 sm:px-6 py-6 space-y-3 overflow-y-auto'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export const ui = {
|
||||||
ui: {
|
|
||||||
avatar,
|
avatar,
|
||||||
avatarGroup,
|
avatarGroup,
|
||||||
badge,
|
badge,
|
||||||
@@ -705,4 +704,3 @@ export default {
|
|||||||
notification,
|
notification,
|
||||||
notifications
|
notifications
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
:autocomplete="autocomplete"
|
:autocomplete="autocomplete"
|
||||||
:spellcheck="spellcheck"
|
:spellcheck="spellcheck"
|
||||||
:class="inputClass"
|
:class="inputClass"
|
||||||
@input="onInput(($event.target as any).value)"
|
@input="onInput"
|
||||||
@focus="$emit('focus', $event)"
|
@focus="$emit('focus', $event)"
|
||||||
@blur="$emit('blur', $event)"
|
@blur="$emit('blur', $event)"
|
||||||
>
|
>
|
||||||
@@ -147,8 +147,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onInput = (value: string) => {
|
const onInput = (event: InputEvent) => {
|
||||||
emit('update:modelValue', value)
|
emit('update:modelValue', (event.target as any).value)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
:required="required"
|
:required="required"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:class="selectClass"
|
:class="selectClass"
|
||||||
@input="onInput(($event.target as any).value)"
|
@input="onInput"
|
||||||
>
|
>
|
||||||
<template v-for="(option, index) in normalizedOptionsWithPlaceholder">
|
<template v-for="(option, index) in normalizedOptionsWithPlaceholder">
|
||||||
<optgroup
|
<optgroup
|
||||||
@@ -127,8 +127,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
const ui = computed<Partial<typeof appConfig.ui.select>>(() => defu({}, props.ui, appConfig.ui.select))
|
const ui = computed<Partial<typeof appConfig.ui.select>>(() => defu({}, props.ui, appConfig.ui.select))
|
||||||
|
|
||||||
const onInput = (value: string) => {
|
const onInput = (event: InputEvent) => {
|
||||||
emit('update:modelValue', value)
|
emit('update:modelValue', (event.target as any).value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const guessOptionValue = (option: any) => {
|
const guessOptionValue = (option: any) => {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<slot name="label">
|
<slot name="label">
|
||||||
<span v-if="modelValue" class="block truncate">{{ typeof modelValue === 'string' ? modelValue : (modelValue as any)[optionAttribute] }}</span>
|
<span v-if="modelValue" class="block truncate">{{ typeof modelValue === 'string' ? modelValue : modelValue[optionAttribute] }}</span>
|
||||||
<span v-else class="block truncate text-gray-400 dark:text-gray-500">{{ placeholder || ' ' }}</span>
|
<span v-else class="block truncate text-gray-400 dark:text-gray-500">{{ placeholder || ' ' }}</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:autocomplete="autocomplete"
|
:autocomplete="autocomplete"
|
||||||
:class="textareaClass"
|
:class="textareaClass"
|
||||||
@input="onInput(($event.target as any).value)"
|
@input="onInput"
|
||||||
@focus="$emit('focus', $event)"
|
@focus="$emit('focus', $event)"
|
||||||
@blur="$emit('blur', $event)"
|
@blur="$emit('blur', $event)"
|
||||||
/>
|
/>
|
||||||
@@ -128,10 +128,10 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onInput = (value: string) => {
|
const onInput = (event: InputEvent) => {
|
||||||
autoResize()
|
autoResize()
|
||||||
|
|
||||||
emit('update:modelValue', value)
|
emit('update:modelValue', (event.target as any).value)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.modelValue, () => {
|
watch(() => props.modelValue, () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user