mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-19 06:21:46 +01:00
chore(module): lint
This commit is contained in:
@@ -12,7 +12,7 @@ export interface UseComponentIconsProps {
|
||||
loadingIcon?: IconProps['name']
|
||||
}
|
||||
|
||||
export function useComponentIcons (props: UseComponentIconsProps) {
|
||||
export function useComponentIcons(props: UseComponentIconsProps) {
|
||||
const appConfig = useAppConfig()
|
||||
|
||||
const isLeading = computed(() => (props.icon && props.leading) || (props.icon && !props.trailing) || (props.loading && !props.trailing && !props.trailingIcon) || !!props.leadingIcon)
|
||||
|
||||
@@ -5,16 +5,16 @@ import type { FormEvent, FormInputEvents, FormFieldInjectedOptions, FormInjected
|
||||
type Props<T> = {
|
||||
id?: string
|
||||
name?: string
|
||||
// @ts-ignore FIXME: TS doesn't like this
|
||||
// @ts-expect-error FIXME: TS doesn't like this
|
||||
size?: T['size']
|
||||
// @ts-ignore FIXME: TS doesn't like this
|
||||
// @ts-expect-error FIXME: TS doesn't like this
|
||||
color?: T['color']
|
||||
eagerValidation?: boolean
|
||||
legend?: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
export function useFormField <T> (inputProps?: Props<T>) {
|
||||
export function useFormField<T>(inputProps?: Props<T>) {
|
||||
const formOptions = inject<FormInjectedOptions | undefined>('form-options', undefined)
|
||||
const formBus = inject<UseEventBusReturn<FormEvent, string> | undefined>('form-events', undefined)
|
||||
const formField = inject<FormFieldInjectedOptions<T> | undefined>('form-field', undefined)
|
||||
@@ -33,18 +33,18 @@ export function useFormField <T> (inputProps?: Props<T>) {
|
||||
|
||||
const blurred = ref(false)
|
||||
|
||||
function emitFormEvent (type: FormInputEvents, name: string) {
|
||||
function emitFormEvent(type: FormInputEvents, name: string) {
|
||||
if (formBus && formField) {
|
||||
formBus.emit({ type, name })
|
||||
}
|
||||
}
|
||||
|
||||
function emitFormBlur () {
|
||||
function emitFormBlur() {
|
||||
emitFormEvent('blur', formField?.name.value as string)
|
||||
blurred.value = true
|
||||
}
|
||||
|
||||
function emitFormChange () {
|
||||
function emitFormChange() {
|
||||
emitFormEvent('change', formField?.name.value as string)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ export interface Toast extends Omit<ToastProps, 'defaultOpen'> {
|
||||
click?: (toast: Toast) => void
|
||||
}
|
||||
|
||||
export function useToast () {
|
||||
export function useToast() {
|
||||
const toasts = useState<Toast[]>('toasts', () => [])
|
||||
|
||||
function add (toast: Partial<Toast>): Toast {
|
||||
function add(toast: Partial<Toast>): Toast {
|
||||
const body = {
|
||||
id: new Date().getTime().toString(),
|
||||
open: true,
|
||||
@@ -26,7 +26,7 @@ export function useToast () {
|
||||
return body
|
||||
}
|
||||
|
||||
function update (id: string | number, toast: Partial<Toast>) {
|
||||
function update(id: string | number, toast: Partial<Toast>) {
|
||||
const index = toasts.value.findIndex((t: Toast) => t.id === id)
|
||||
if (index !== -1) {
|
||||
toasts.value[index] = {
|
||||
@@ -36,7 +36,7 @@ export function useToast () {
|
||||
}
|
||||
}
|
||||
|
||||
function remove (id: string | number) {
|
||||
function remove(id: string | number) {
|
||||
const index = toasts.value.findIndex((t: Toast) => t.id === id)
|
||||
if (index !== -1) {
|
||||
toasts.value[index] = {
|
||||
|
||||
Reference in New Issue
Block a user