fix show character limit not working (#386)

* fix  show character limit not working

* Improve code for char limit issue

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Favour Olayinka 2024-04-22 15:42:38 +01:00 committed by GitHub
parent 053a4a4976
commit e70d0955d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 39 additions and 12 deletions

View File

@ -22,6 +22,13 @@
:maxlength="maxCharLimit"
/>
<template
v-if="$slots.help"
#help
>
<slot name="help" />
</template>
<template
v-if="maxCharLimit && showCharLimit"
#bottom_after_help
@ -31,7 +38,10 @@
</small>
</template>
<template #error>
<template
v-if="$slots.error"
#error
>
<slot name="error" />
</template>
</input-wrapper>

View File

@ -29,7 +29,10 @@
@keydown.enter.prevent="onEnterPress"
>
<template #help>
<template
v-if="$slots.help"
#help
>
<slot name="help" />
</template>
@ -42,7 +45,10 @@
</small>
</template>
<template #error>
<template
v-if="$slots.error"
#error
>
<slot name="error" />
</template>
</input-wrapper>

View File

@ -1,5 +1,8 @@
<template>
<div class="flex mb-1 input-help">
<div
v-if="shouldRender"
class="flex mb-1 input-help"
>
<small
:class="helpClasses"
class="grow flex"
@ -19,8 +22,13 @@
</template>
<script setup>
defineProps({
const slots = useSlots()
const props = defineProps({
helpClasses: { type: String, default: "text-gray-400 dark:text-gray-500" },
help: { type: String, required: false },
})
const shouldRender = computed(() => {
return props.help || !!slots.help || !!slots['after-help']
})
</script>

View File

@ -18,10 +18,13 @@
name="help"
>
<InputHelp
v-if="help"
:help="help"
:help-classes="theme.default.help"
/>
>
<template #after-help>
<slot name="bottom_after_help" />
</template>
</InputHelp>
</slot>
<slot />
@ -30,7 +33,6 @@
name="help"
>
<InputHelp
v-if="help"
:help="help"
:help-classes="theme.default.help"
>

View File

@ -16,6 +16,7 @@ export const inputProps = {
placeholder: { type: String, default: null },
uppercaseLabels: { type: Boolean, default: false },
hideFieldName: { type: Boolean, default: false },
showCharLimit: { type: Boolean, default: false },
help: { type: String, default: null },
helpPosition: { type: String, default: "below_input" },
color: { type: String, default: "#3B82F6" },

View File

@ -1,11 +1,11 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import runtimeConfig from "./runtimeConfig";
import {sentryVitePlugin} from "@sentry/vite-plugin";
import sitemap from "./sitemap";
import runtimeConfig from "./runtimeConfig"
import {sentryVitePlugin} from "@sentry/vite-plugin"
import sitemap from "./sitemap"
export default defineNuxtConfig({
loglevel: process.env.NUXT_LOG_LEVEL || 'info',
devtools: {enabled: true},
devtools: {enabled: false},
css: ['~/scss/app.scss'],
modules: [
'@pinia/nuxt',