mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Enable `better-tailwindcss/enforce-consistent-class-order` lint rule and auto-fix all 1027 violations across 263 files. Stacked on #9427. ## Changes - **What**: Sort Tailwind classes into consistent order via `eslint --fix` - Enable `enforce-consistent-class-order` as `'error'` in eslint config - Purely cosmetic reordering — no behavioral or visual changes ## Review Focus Mechanical auto-fix PR — all changes are class reordering only. This is the largest diff but lowest risk since it changes no class names, only their order. **Stack:** #9417 → #9427 → **this PR** Fixes #9300 (partial — 3 of 3 rules) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9428-fix-enable-enforce-consistent-class-order-tailwind-lint-rule-31a6d73d3650811c9065f5178ba3e724) by [Unito](https://www.unito.io)
133 lines
2.9 KiB
Vue
133 lines
2.9 KiB
Vue
<template>
|
|
<ComboboxRoot :ignore-filter="true" :open="false" :disabled="disabled">
|
|
<ComboboxAnchor
|
|
:class="
|
|
cn(
|
|
searchInputVariants({ size }),
|
|
disabled && 'pointer-events-none opacity-50',
|
|
className
|
|
)
|
|
"
|
|
@click="focus"
|
|
>
|
|
<Button
|
|
v-if="modelValue"
|
|
:class="cn('absolute', sizeConfig.clearPos)"
|
|
variant="textonly"
|
|
size="icon-sm"
|
|
:aria-label="$t('g.clear')"
|
|
@click.stop="clearSearch"
|
|
>
|
|
<i :class="cn('icon-[lucide--x]', sizeConfig.icon)" />
|
|
</Button>
|
|
<i
|
|
v-else-if="loading"
|
|
:class="
|
|
cn(
|
|
'pointer-events-none absolute icon-[lucide--loader-circle] animate-spin',
|
|
sizeConfig.iconPos,
|
|
sizeConfig.icon
|
|
)
|
|
"
|
|
/>
|
|
<i
|
|
v-else
|
|
:class="
|
|
cn(
|
|
'pointer-events-none absolute',
|
|
sizeConfig.iconPos,
|
|
sizeConfig.icon,
|
|
icon
|
|
)
|
|
"
|
|
/>
|
|
|
|
<ComboboxInput
|
|
ref="inputRef"
|
|
v-model="modelValue"
|
|
:class="
|
|
cn(
|
|
'size-full border-none bg-transparent outline-none',
|
|
sizeConfig.inputPl,
|
|
sizeConfig.inputText
|
|
)
|
|
"
|
|
:placeholder="placeholderText"
|
|
:auto-focus="autofocus"
|
|
/>
|
|
</ComboboxAnchor>
|
|
</ComboboxRoot>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { HTMLAttributes } from 'vue'
|
|
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
import { watchDebounced } from '@vueuse/core'
|
|
import { ComboboxAnchor, ComboboxInput, ComboboxRoot } from 'reka-ui'
|
|
import { computed, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import type { SearchInputVariants } from './searchInput.variants'
|
|
import {
|
|
searchInputSizeConfig,
|
|
searchInputVariants
|
|
} from './searchInput.variants'
|
|
|
|
const { t } = useI18n()
|
|
|
|
const {
|
|
placeholder,
|
|
icon = 'icon-[lucide--search]',
|
|
debounceTime = 300,
|
|
autofocus = false,
|
|
loading = false,
|
|
disabled = false,
|
|
size = 'md',
|
|
class: className
|
|
} = defineProps<{
|
|
placeholder?: string
|
|
icon?: string
|
|
debounceTime?: number
|
|
autofocus?: boolean
|
|
loading?: boolean
|
|
disabled?: boolean
|
|
size?: SearchInputVariants['size']
|
|
class?: HTMLAttributes['class']
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
search: [value: string]
|
|
}>()
|
|
|
|
const sizeConfig = computed(() => searchInputSizeConfig[size])
|
|
|
|
const modelValue = defineModel<string>({ required: true })
|
|
|
|
const inputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
|
|
|
|
function focus() {
|
|
inputRef.value?.$el?.focus()
|
|
}
|
|
|
|
defineExpose({ focus })
|
|
|
|
const placeholderText = computed(
|
|
() => placeholder ?? t('g.searchPlaceholder', { subject: '' })
|
|
)
|
|
|
|
function clearSearch() {
|
|
modelValue.value = ''
|
|
focus()
|
|
}
|
|
|
|
watchDebounced(
|
|
modelValue,
|
|
(value: string) => {
|
|
emit('search', value)
|
|
},
|
|
{ debounce: debounceTime }
|
|
)
|
|
</script>
|