mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
chore: revert ui. prefix when using useUI composable
This commit is contained in:
@@ -150,7 +150,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup (props, { emit, attrs: $attrs }) {
|
||||
const { ui, attrs } = useUI('ui.table', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('table', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const columns = computed(() => props.columns ?? Object.keys(omit(props.rows[0] ?? {}, ['click'])).map((key) => ({ key, label: upperFirst(key), sortable: false })))
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs } = useUI('ui.accordion', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('accordion', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const uiButton = computed<Partial<typeof configButton>>(() => configButton)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['close'],
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.alert', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('alert', props.ui, config)
|
||||
|
||||
const alertClass = computed(() => {
|
||||
const variant = ui.value.color?.[props.color as string]?.[props.variant as string] || ui.value.variant[props.variant]
|
||||
|
||||
@@ -90,7 +90,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.avatar', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('avatar', props.ui, config)
|
||||
|
||||
const url = computed(() => {
|
||||
if (typeof props.src === 'boolean') {
|
||||
|
||||
@@ -33,7 +33,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props, { slots }) {
|
||||
const { ui, attrs } = useUI('ui.avatarGroup', props.ui, avatarGroupConfig, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('avatarGroup', props.ui, avatarGroupConfig, { mergeWrapper: true })
|
||||
|
||||
const children = computed(() => getSlotsChildren(slots))
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.badge', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('badge', props.ui, config)
|
||||
|
||||
const badgeClass = computed(() => {
|
||||
const variant = ui.value.color?.[props.color as string]?.[props.variant as string] || ui.value.variant[props.variant]
|
||||
|
||||
@@ -124,7 +124,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props, { slots }) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.button', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('button', props.ui, config)
|
||||
|
||||
const isLeading = computed(() => {
|
||||
return (props.icon && props.leading) || (props.icon && !props.trailing) || (props.loading && !props.trailing) || props.leadingIcon
|
||||
|
||||
@@ -34,7 +34,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props, { slots }) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.buttonGroup', props.ui, buttonGroupConfig)
|
||||
const { ui, attrs, attrsClass } = useUI('buttonGroup', props.ui, buttonGroupConfig)
|
||||
|
||||
const children = computed(() => getSlotsChildren(slots))
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs } = useUI('ui.dropdown', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('dropdown', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const popper = computed<PopperOptions>(() => defu(props.mode === 'hover' ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper as PopperOptions))
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.kbd', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('kbd', props.ui, config)
|
||||
|
||||
const kbdClass = computed(() => {
|
||||
return twMerge(twJoin(
|
||||
|
||||
@@ -101,7 +101,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'change'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.checkbox', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('checkbox', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const { emitFormChange, formGroup } = useFormGroup()
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -77,7 +77,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs } = useUI('ui.formGroup', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('formGroup', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const formErrors = inject<Ref<FormError[]> | null>('form-errors', null)
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'blur'],
|
||||
setup (props, { emit, slots }) {
|
||||
const { ui, attrs } = useUI('ui.input', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('input', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const { emitFormBlur, emitFormInput, formGroup } = useFormGroup(props)
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -90,7 +90,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.radio', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('radio', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const { emitFormChange, formGroup } = useFormGroup()
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -90,7 +90,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'change'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.range', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('range', props.ui, config)
|
||||
|
||||
const { emitFormChange, formGroup } = useFormGroup(props)
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -178,7 +178,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'change'],
|
||||
setup (props, { emit, slots }) {
|
||||
const { ui, attrs } = useUI('ui.select', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('select', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const { emitFormChange, formGroup } = useFormGroup(props)
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -307,9 +307,9 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'open', 'close', 'change'],
|
||||
setup (props, { emit, slots }) {
|
||||
const { ui, attrs } = useUI('ui.select', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('select', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const { ui: uiMenu } = useUI('ui.selectMenu', props.uiMenu, configMenu)
|
||||
const { ui: uiMenu } = useUI('selectMenu', props.uiMenu, configMenu)
|
||||
|
||||
const popper = computed<PopperOptions>(() => defu({}, props.popper, uiMenu.value.popper as PopperOptions))
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'blur'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.textarea', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('textarea', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const { emitFormBlur, emitFormInput, formGroup } = useFormGroup(props)
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -80,7 +80,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.toggle', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('toggle', props.ui, config)
|
||||
|
||||
const { emitFormChange, formGroup } = useFormGroup(props)
|
||||
const color = computed(() => formGroup?.error?.value ? 'red' : props.color)
|
||||
|
||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.card', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('card', props.ui, config)
|
||||
|
||||
const cardClass = computed(() => {
|
||||
return twMerge(twJoin(
|
||||
|
||||
@@ -30,7 +30,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.container', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('container', props.ui, config)
|
||||
|
||||
const containerClass = computed(() => {
|
||||
return twMerge(twJoin(
|
||||
|
||||
@@ -24,7 +24,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.skeleton', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('skeleton', props.ui, config)
|
||||
|
||||
const skeletonClass = computed(() => {
|
||||
return twMerge(twJoin(
|
||||
|
||||
@@ -176,7 +176,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'close'],
|
||||
setup (props, { emit, expose }) {
|
||||
const { ui, attrs } = useUI('ui.commandPalette', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('commandPalette', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const query = ref('')
|
||||
const comboboxInput = ref<ComponentPublicInstance<HTMLInputElement>>()
|
||||
|
||||
@@ -113,7 +113,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.pagination', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('pagination', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const currentPage = computed({
|
||||
get () {
|
||||
|
||||
@@ -95,7 +95,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'change'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.tabs', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('tabs', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const listRef = ref<HTMLElement>()
|
||||
const itemRefs = ref<HTMLElement[]>([])
|
||||
|
||||
@@ -70,7 +70,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs } = useUI('ui.verticalNavigation', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('verticalNavigation', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
return {
|
||||
// eslint-disable-next-line vue/no-dupe-keys
|
||||
|
||||
@@ -47,7 +47,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'close'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.contextMenu', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('contextMenu', props.ui, config)
|
||||
|
||||
const popper = computed<PopperOptions>(() => defu({}, props.popper, ui.value.popper as PopperOptions))
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'close'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.modal', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('modal', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const isOpen = computed({
|
||||
get () {
|
||||
|
||||
@@ -113,7 +113,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['close'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.notification', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('notification', props.ui, config)
|
||||
|
||||
let timer: any = null
|
||||
const remaining = ref(props.timeout)
|
||||
|
||||
@@ -45,7 +45,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs, attrsClass } = useUI('ui.notifications', props.ui, config)
|
||||
const { ui, attrs, attrsClass } = useUI('notifications', props.ui, config)
|
||||
|
||||
const toast = useToast()
|
||||
const notifications = useState<Notification[]>('notifications', () => [])
|
||||
|
||||
@@ -75,7 +75,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs } = useUI('ui.popover', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('popover', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const popper = computed<PopperOptions>(() => defu(props.mode === 'hover' ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper as PopperOptions))
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export default defineComponent({
|
||||
},
|
||||
emits: ['update:modelValue', 'close'],
|
||||
setup (props, { emit }) {
|
||||
const { ui, attrs } = useUI('ui.slideover', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('slideover', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const isOpen: WritableComputedRef<boolean> = computed({
|
||||
get () {
|
||||
|
||||
@@ -74,7 +74,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup (props) {
|
||||
const { ui, attrs } = useUI('ui.tooltip', props.ui, config, { mergeWrapper: true })
|
||||
const { ui, attrs } = useUI('tooltip', props.ui, config, { mergeWrapper: true })
|
||||
|
||||
const popper = computed<PopperOptions>(() => defu({}, props.popper, ui.value.popper as PopperOptions))
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export const useUI = <T>(key, $ui: Partial<T & { strategy: Strategy }>, $config?
|
||||
$ui?.strategy || (appConfig.ui?.strategy as Strategy),
|
||||
mergeWrapper ? { wrapper: $attrs?.class } : {},
|
||||
$ui || {},
|
||||
process.dev ? get(appConfig, key, {}) : {},
|
||||
process.dev ? get(appConfig.ui, key, {}) : {},
|
||||
toValue($config || {})
|
||||
))
|
||||
const attrs = computed(() => omit($attrs, ['class']))
|
||||
|
||||
Reference in New Issue
Block a user