@falcondev-oss/nuxt-layers-base 0.31.3 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ const props = defineProps<
19
19
  FormFieldProps & {
20
20
  field: FormField<T>
21
21
  errorInline?: boolean
22
+ errorPreferPlaceholder?: boolean
22
23
  }
23
24
  >()
24
25
 
@@ -62,7 +63,7 @@ const formFieldProps = computed<FormFieldProps>(() => {
62
63
  const bind = computed(() => {
63
64
  const field = forwardedProps.value.field
64
65
 
65
- const placeholder = (field.errors && field.errors.join('\n')) || field.schema.default?.toString()
66
+ const placeholder = (field.errors && field.errors[0]) || field.schema.default?.toString()
66
67
 
67
68
  return {
68
69
  'modelValue': field.value,
@@ -116,7 +117,14 @@ const [DefineErrorTemplate, ErrorTemplate] = createReusableTemplate({
116
117
  </ul>
117
118
  </DefineErrorTemplate>
118
119
 
119
- <template v-if="field.errors && errorInline" #error>
120
+ <template
121
+ v-if="
122
+ field.errors &&
123
+ errorInline &&
124
+ (errorPreferPlaceholder ? String(field.value).length > 0 : true)
125
+ "
126
+ #error
127
+ >
120
128
  <ErrorTemplate :errors="field.errors" />
121
129
 
122
130
  <template v-if="typeof error === 'string'">
@@ -127,7 +135,7 @@ const [DefineErrorTemplate, ErrorTemplate] = createReusableTemplate({
127
135
  <template v-else #hint="{ hint }">
128
136
  <span class="flex items-center gap-1.5">
129
137
  <UPopover
130
- v-if="!!field.errors"
138
+ v-if="!!field.errors && (errorPreferPlaceholder ? String(field.value).length > 0 : true)"
131
139
  mode="hover"
132
140
  :open-delay="0"
133
141
  :ui="{
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@falcondev-oss/nuxt-layers-base",
3
3
  "type": "module",
4
- "version": "0.31.3",
4
+ "version": "0.32.0",
5
5
  "description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
6
6
  "license": "MIT",
7
7
  "repository": "github:falcondev-oss/nuxt-layers",