Skip to content

Commit

Permalink
fix(components): use relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jul 25, 2024
1 parent 4614aca commit ea721a3
Show file tree
Hide file tree
Showing 22 changed files with 78 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default defineNuxtModule<ModuleOptions>({

// Modules

await installModule('@nuxt/icon', { componentName: 'UIcon' })
await installModule('@nuxt/icon')
await installModule('@nuxtjs/color-mode', { classSuffix: '' })
await installTailwind(options, nuxt, resolve)

Expand Down
5 changes: 4 additions & 1 deletion src/runtime/components/data/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ import type { PropType, AriaAttributes } from 'vue'
import { upperFirst } from 'scule'
import { defu } from 'defu'
import { useVModel } from '@vueuse/core'
import { UIcon, UButton, UProgress, UCheckbox } from '#components'
import UIcon from '../elements/Icon.vue'
import UButton from '../elements/Button.vue'
import UProgress from '../elements/Progress.vue'
import UCheckbox from '../forms/Checkbox.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, get } from '../../utils'
import type { Strategy, Button, ProgressColor, ProgressAnimation } from '../../types'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/elements/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
import { ref, computed, toRef, defineComponent, watch } from 'vue'
import type { PropType } from 'vue'
import { Disclosure as HDisclosure, DisclosureButton as HDisclosureButton, DisclosurePanel as HDisclosurePanel, provideUseId } from '@headlessui/vue'
import { UIcon, UButton } from '#components'
import UIcon from '../elements/Icon.vue'
import UButton from '../elements/Button.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, omit } from '../../utils'
import type { AccordionItem, Strategy } from '../../types'
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/components/elements/Alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
import { computed, toRef, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar, UButton } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UButton from '../elements/Button.vue'
import { useUI } from '../../composables/useUI'
import type { Avatar, Button, AlertColor, AlertVariant, AlertAction, Strategy } from '../../types'
import { mergeConfig } from '../../utils'
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/elements/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import { defineComponent, ref, computed, toRef, watch } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon } from '#components'
import UIcon from '../elements/Icon.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { AvatarSize, AvatarChipColor, AvatarChipPosition, Strategy } from '../../types'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/elements/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import { computed, defineComponent, toRef } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, ULink } from '#components'
import UIcon from '../elements/Icon.vue'
import ULink from '../elements/Link.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, nuxtLinkProps, getNuxtLinkProps } from '../../utils'
import { useInjectButtonGroup } from '../../composables/useButtonGroup'
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/components/elements/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ import type { PropType } from 'vue'
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem, provideUseId } from '@headlessui/vue'
import { defu } from 'defu'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar, UKbd } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UKbd from '../elements/Kbd.vue'
import { useUI } from '../../composables/useUI'
import { usePopper } from '../../composables/usePopper'
import { mergeConfig, getNuxtLinkProps } from '../../utils'
Expand Down
32 changes: 32 additions & 0 deletions src/runtime/components/elements/Icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<Icon v-bind="$props" />
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import type { PropType } from 'vue'
export default defineComponent({
props: {
name: {
type: String,
required: true
},
mode: {
type: String as PropType<'svg' | 'css'>,
required: false,
default: null
},
size: {
type: [Number, String],
required: false,
default: null
},
customize: {
type: Function,
required: false,
default: null
}
}
})
</script>
2 changes: 1 addition & 1 deletion src/runtime/components/elements/Meter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { computed, defineComponent, toRef } from 'vue'
import type { SlotsType, PropType } from 'vue'
import { twJoin } from 'tailwind-merge'
import { UIcon } from '#components'
import UIcon from '../elements/Icon.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { Strategy, MeterColor, MeterSize } from '../../types'
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/elements/MeterGroup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { h, cloneVNode, computed, toRef, defineComponent } from 'vue'
import type { ComputedRef, VNode, SlotsType, PropType } from 'vue'
import { twJoin } from 'tailwind-merge'
import { UIcon } from '#components'
import UIcon from '../elements/Icon.vue'
import Meter from './Meter.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, getSlotsChildren } from '../../utils'
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/forms/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import { ref, computed, toRef, onMounted, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon } from '#components'
import UIcon from '../elements/Icon.vue'
import { defu } from 'defu'
import { useUI } from '../../composables/useUI'
import { useFormGroup } from '../../composables/useFormGroup'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/forms/InputMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ import {
import { computedAsync, useDebounceFn } from '@vueuse/core'
import { defu } from 'defu'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import { useUI } from '../../composables/useUI'
import { usePopper } from '../../composables/usePopper'
import { useFormGroup } from '../../composables/useFormGroup'
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/forms/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import { computed, toRef, defineComponent } from 'vue'
import type { PropType, ComputedRef } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon } from '#components'
import UIcon from '../elements/Icon.vue'
import { useUI } from '../../composables/useUI'
import { useFormGroup } from '../../composables/useFormGroup'
import { mergeConfig, get } from '../../utils'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/forms/SelectMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ import {
import { computedAsync, useDebounceFn } from '@vueuse/core'
import { defu } from 'defu'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import { useUI } from '../../composables/useUI'
import { usePopper } from '../../composables/usePopper'
import { useFormGroup } from '../../composables/useFormGroup'
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/forms/Toggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { computed, toRef, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { Switch as HSwitch, provideUseId } from '@headlessui/vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon } from '#components'
import UIcon from '../elements/Icon.vue'
import { useUI } from '../../composables/useUI'
import { useFormGroup } from '../../composables/useFormGroup'
import { mergeConfig } from '../../utils'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/layout/Divider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import { toRef, computed, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
import type { Avatar, DividerSize, Strategy } from '../../types'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/navigation/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
import { defineComponent, toRef } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, ULink } from '#components'
import UIcon from '../elements/Icon.vue'
import ULink from '../elements/Link.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, getULinkProps } from '../../utils'
import type { BreadcrumbLink, Strategy } from '../../types'
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/components/navigation/CommandPalette.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ import { useFuse } from '@vueuse/integrations/useFuse'
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
import { twJoin } from 'tailwind-merge'
import { defu } from 'defu'
import { UIcon, UButton } from '#components'
import UIcon from '../elements/Icon.vue'
import UButton from '../elements/Button.vue'
import CommandPaletteGroup from './CommandPaletteGroup.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig } from '../../utils'
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/components/navigation/CommandPaletteGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
import { computed, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue'
import { UIcon, UAvatar, UKbd } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UKbd from '../elements/Kbd.vue'
import type { Command, Group } from '../../types'
import { commandPalette } from '#ui/ui.config'
import { useId } from '#imports'
Expand Down
5 changes: 4 additions & 1 deletion src/runtime/components/navigation/HorizontalNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
import { toRef, defineComponent, computed } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar, UBadge, ULink } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UBadge from '../elements/Badge.vue'
import ULink from '../elements/Link.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, getULinkProps } from '../../utils'
import type { HorizontalNavigationLink, Strategy } from '../../types'
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/components/navigation/VerticalNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
import { toRef, defineComponent, computed } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar, UBadge, ULink, UDivider } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UBadge from '../elements/Badge.vue'
import ULink from '../elements/Link.vue'
import UDivider from '../layout/Divider.vue'
import { useUI } from '../../composables/useUI'
import { mergeConfig, getULinkProps } from '../../utils'
import type { VerticalNavigationLink, Strategy } from '../../types'
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/components/overlays/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
import { ref, computed, toRef, onMounted, onUnmounted, watch, watchEffect, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import { UIcon, UAvatar, UButton } from '#components'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
import UButton from '../elements/Button.vue'
import { useUI } from '../../composables/useUI'
import { useTimer } from '../../composables/useTimer'
import { mergeConfig } from '../../utils'
Expand Down

0 comments on commit ea721a3

Please sign in to comment.