-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(Forms): transparent background color on validation error #765
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d7d3bdd
fix(Forms): transparent background color on validation error
Haythamasalama 65504ca
chore: update background color when white for `select` ,`selectMenu`,β¦
Haythamasalama fbc09f2
feat: add examples to test case
Haythamasalama d9ba5c2
Merge branch 'dev' into fix/background-inputs
Haythamasalama b0a02d5
Merge branch 'dev' into fix/background-inputs
Haythamasalama d20a757
Merge branch 'dev' into fix/background-inputs
Haythamasalama 2869a3a
Merge branch 'dev' into fix/background-inputs
Haythamasalama d4586b7
Merge branch 'dev' into fix/background-inputs
Haythamasalama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
export default defineAppConfig({ | ||
ui: { | ||
primary: 'green', | ||
gray: 'slate' | ||
gray: 'slate', | ||
|
||
input: { | ||
color: { | ||
white: { | ||
'background': '' | ||
} | ||
} | ||
}, | ||
|
||
select: { | ||
color: { | ||
white: { | ||
'background': '' | ||
} | ||
} | ||
}, | ||
|
||
selectMenu: { | ||
color: { | ||
white: { | ||
'background': '' | ||
} | ||
} | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,131 @@ | ||
<template> | ||
<UContainer class="min-h-screen flex items-center"> | ||
<UCard class="flex-1" :ui="{ background: 'bg-gray-50 dark:bg-gray-800/50', ring: 'ring-1 ring-gray-300 dark:ring-gray-700', divide: 'divide-y divide-gray-300 dark:divide-gray-700', header: { base: 'font-bold' } }"> | ||
<template #header> | ||
Welcome to the playground! | ||
</template> | ||
|
||
<p class="text-gray-500 dark:text-gray-400"> | ||
Try your components here! | ||
</p> | ||
</UCard> | ||
</UContainer> | ||
</template> | ||
<script setup lang="ts"> | ||
|
||
<script setup> | ||
const colorMode = useColorMode() | ||
const isDark = computed({ | ||
get () { | ||
return colorMode.value === 'dark' | ||
}, | ||
set () { | ||
colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark' | ||
} | ||
}) | ||
|
||
</script> | ||
const people = ['Wade Cooper', 'Arlene Mccoy', 'Devon Webb', 'Tom Cook', 'Tanya Fox', 'Hellen Schmidt', 'Caroline Schultz', 'Mason Heaney', 'Claudie Smitham', 'Emil Schaefer'] | ||
const countries = ['United States', 'Canada', 'Mexico'] | ||
|
||
const state = ref({ | ||
email: undefined, | ||
password: undefined, | ||
people: undefined, | ||
country: undefined, | ||
notification: undefined | ||
}) | ||
|
||
<style> | ||
body { | ||
@apply antialiased font-sans text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-900; | ||
const validate = (state) => { | ||
const errors = [] | ||
if (!state.email) errors.push({ path: 'email', message: 'Required' }) | ||
if (!state.password) errors.push({ path: 'password', message: 'Required' }) | ||
if (!state.people) errors.push({ path: 'people', message: 'Required' }) | ||
if (!state.country) errors.push({ path: 'country', message: 'Required' }) | ||
if (!state.notification) errors.push({ path: 'notification', message: 'Required' }) | ||
return errors | ||
} | ||
</style> | ||
|
||
async function submit (event) {} | ||
</script> | ||
|
||
<template> | ||
<Body class="bg-gray-400" /> | ||
|
||
<!-- with bg --> | ||
<UCard class="m-4"> | ||
<div class="flex flex-col gap-4"> | ||
<UButton | ||
:icon="isDark ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'" | ||
color="gray" | ||
:label="isDark ? 'Dark' : 'Light'" | ||
aria-label="Theme" | ||
@click="isDark = !isDark" | ||
/> | ||
|
||
<UForm :validate="validate" :state="state" class="flex flex-col gap-6 py-6" @submit="submit"> | ||
<UFormGroup name="password"> | ||
<UInput v-model="state.password" type="text" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="password"> | ||
<UTextarea v-model="state.password" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="country"> | ||
<USelect v-model="state.country" :options="countries" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="people"> | ||
<USelectMenu v-model="state.people" :options="people" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="notification"> | ||
<UCheckbox v-model="state.notification" name="notifications" label="Notifications" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="notification"> | ||
<URadio v-model="state.notification" name="notifications" label="Notifications" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="notification"> | ||
<UToggle v-model="state.notification" name="notifications" /> | ||
</UFormGroup> | ||
|
||
<UButton type="submit"> | ||
Submit | ||
</UButton> | ||
</UForm> | ||
</div> | ||
</UCard> | ||
|
||
<!-- without bg --> | ||
<div class="m-4 flex flex-col gap-4 border rounded p-5"> | ||
<UButton | ||
:icon="isDark ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'" | ||
color="gray" | ||
:label="isDark ? 'Dark' : 'Light'" | ||
aria-label="Theme" | ||
@click="isDark = !isDark" | ||
/> | ||
|
||
<UForm :validate="validate" :state="state" class="flex flex-col gap-6 py-6" @submit="submit"> | ||
<UFormGroup name="password"> | ||
<UInput v-model="state.password" type="text" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="password"> | ||
<UTextarea v-model="state.password" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="country"> | ||
<USelect v-model="state.country" :options="countries" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="people"> | ||
<USelectMenu v-model="state.people" :options="people" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="notification"> | ||
<UCheckbox v-model="state.notification" name="notifications" label="Notifications" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="notification"> | ||
<URadio v-model="state.notification" name="notifications" label="Notifications" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup name="notification"> | ||
<UToggle v-model="state.notification" name="notifications" /> | ||
</UFormGroup> | ||
|
||
<UButton type="submit"> | ||
Submit | ||
</UButton> | ||
</UForm> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjamincanac
I added this to enable you to test cases. Once you're finished, we will remove it.