fix: injection warnings
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flowbite-vue",
|
"name": "flowbite-vue",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"repository": "https://github.com/themesberg/flowbite-vue.git",
|
"repository": "https://github.com/themesberg/flowbite-vue.git",
|
||||||
"author": "themesberg",
|
"author": "themesberg",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { FlowbiteTheme } from '../types'
|
import type { FlowbiteTheme } from '../types'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { computed, inject } from 'vue'
|
import { computed, inject, ref } from 'vue'
|
||||||
import { FLOWBITE_THEMABLE_INJECTION_KEY } from '../injection/config'
|
import { FLOWBITE_THEMABLE_INJECTION_KEY } from '../injection/config'
|
||||||
|
|
||||||
type UseFlowbiteThemableReturns = {
|
type UseFlowbiteThemableReturns = {
|
||||||
@@ -65,38 +65,38 @@ const flowbiteThemeClasses: FlowbiteThemes<FlowbiteTheme> = {
|
|||||||
|
|
||||||
export function useFlowbiteThemable(): UseFlowbiteThemableReturns {
|
export function useFlowbiteThemable(): UseFlowbiteThemableReturns {
|
||||||
|
|
||||||
const theme = inject<Ref<FlowbiteTheme>>(FLOWBITE_THEMABLE_INJECTION_KEY)
|
const theme = inject<Ref<FlowbiteTheme | null>>(FLOWBITE_THEMABLE_INJECTION_KEY, ref(null))
|
||||||
|
|
||||||
const isActive = computed(() => !!theme?.value)
|
const isActive = computed(() => !!theme?.value)
|
||||||
const color = computed(() => theme?.value)
|
const color = computed(() => theme?.value || undefined)
|
||||||
|
|
||||||
const backgroundClasses = computed(() => {
|
const backgroundClasses = computed(() => {
|
||||||
if(!theme) return ''
|
if(!theme.value) return ''
|
||||||
return flowbiteThemeClasses[theme.value].background
|
return flowbiteThemeClasses[theme.value].background
|
||||||
})
|
})
|
||||||
|
|
||||||
const disabledClasses = computed(() => {
|
const disabledClasses = computed(() => {
|
||||||
if(!theme) return ''
|
if(!theme.value) return ''
|
||||||
return flowbiteThemeClasses[theme.value].disabled
|
return flowbiteThemeClasses[theme.value].disabled
|
||||||
})
|
})
|
||||||
|
|
||||||
const hoverClasses = computed(() => {
|
const hoverClasses = computed(() => {
|
||||||
if(!theme) return ''
|
if(!theme.value) return ''
|
||||||
return flowbiteThemeClasses[theme.value].hover
|
return flowbiteThemeClasses[theme.value].hover
|
||||||
})
|
})
|
||||||
|
|
||||||
const textClasses = computed(() => {
|
const textClasses = computed(() => {
|
||||||
if(!theme) return ''
|
if(!theme.value) return ''
|
||||||
return flowbiteThemeClasses[theme.value].text
|
return flowbiteThemeClasses[theme.value].text
|
||||||
})
|
})
|
||||||
|
|
||||||
const borderClasses = computed(() => {
|
const borderClasses = computed(() => {
|
||||||
if(!theme) return ''
|
if(!theme.value) return ''
|
||||||
return flowbiteThemeClasses[theme.value].border
|
return flowbiteThemeClasses[theme.value].border
|
||||||
})
|
})
|
||||||
|
|
||||||
const focusClasses = computed(() => {
|
const focusClasses = computed(() => {
|
||||||
if(!theme) return ''
|
if(!theme.value) return ''
|
||||||
return flowbiteThemeClasses[theme.value].focus
|
return flowbiteThemeClasses[theme.value].focus
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user