fix: injection warnings

This commit is contained in:
Alexandr
2022-07-26 17:02:46 +03:00
parent 8cae1213b3
commit 22847ad50f
2 changed files with 10 additions and 10 deletions

View File

@@ -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",

View File

@@ -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
}) })