@dargmuesli/nuxt-vio 8.1.2 → 8.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <VioForm :form="v$" :is-form-sent="isFormSent" @submit="submit">
3
+ <input type="hidden" name="static-form-name" value="contact" />
4
+ <VioFormInput
5
+ id-label="input-name"
6
+ :placeholder="t('placeholderName')"
7
+ :title="t('name')"
8
+ type="text"
9
+ :value="v$.name"
10
+ @input="form.name = $event"
11
+ >
12
+ <template #stateError>
13
+ <!-- <VioFormInputStateError
14
+ :form-input="v$.name"
15
+ validation-property="maxLength"
16
+ >
17
+ {{ t('globalValidationLength') }}
18
+ </VioFormInputStateError> -->
19
+ <VioFormInputStateError
20
+ :form-input="v$.name"
21
+ validation-property="required"
22
+ >
23
+ {{ t('globalValidationRequired') }}
24
+ </VioFormInputStateError>
25
+ </template>
26
+ </VioFormInput>
27
+ <VioFormInputEmailAddress
28
+ :form-input="v$.emailAddress"
29
+ @input="form.emailAddress = $event"
30
+ />
31
+ <VioFormInput
32
+ id-label="input-message"
33
+ :title="t('message')"
34
+ type="textarea"
35
+ :value="v$.message"
36
+ >
37
+ <textarea
38
+ v-if="v$.message"
39
+ :id="`${siteConfig.id}-${
40
+ runtimeConfig.public.vio.isInProduction ? 'prod' : 'dev'
41
+ }-input-message`"
42
+ class="form-input"
43
+ name="message"
44
+ :placeholder="t('placeholderMessage')"
45
+ rows="10"
46
+ :value="v$.message.$model"
47
+ @input="form.message = ($event.target as HTMLInputElement).value"
48
+ />
49
+ <template #stateError>
50
+ <!-- <VioFormInputStateError
51
+ :form-input="v$.message"
52
+ validation-property="maxLength"
53
+ >
54
+ {{ t('globalValidationLength') }}
55
+ </VioFormInputStateError> -->
56
+ <VioFormInputStateError
57
+ :form-input="v$.message"
58
+ validation-property="required"
59
+ >
60
+ {{ t('globalValidationRequired') }}
61
+ </VioFormInputStateError>
62
+ </template>
63
+ </VioFormInput>
64
+ </VioForm>
65
+ </template>
66
+
67
+ <script setup lang="ts">
68
+ import { useVuelidate } from '@vuelidate/core'
69
+ import { required } from '@vuelidate/validators'
70
+
71
+ const { t } = useI18n()
72
+ const runtimeConfig = useRuntimeConfig()
73
+ const siteConfig = useSiteConfig()
74
+
75
+ // data
76
+ const form = reactive({
77
+ emailAddress: ref<string>(),
78
+ name: ref<string>(),
79
+ message: ref<string>(),
80
+ })
81
+ const isFormSent = ref(false)
82
+
83
+ // methods
84
+ const submit = async (e: Event) =>
85
+ !(await isFormValid({ v$, isFormSent })) ? e.preventDefault() : undefined
86
+
87
+ // vuelidate
88
+ const rules = {
89
+ emailAddress: {
90
+ // maxLength: maxLength(100),
91
+ required,
92
+ },
93
+ name: {
94
+ // maxLength: maxLength(250),
95
+ required,
96
+ },
97
+ message: {
98
+ // maxLength: maxLength(100),
99
+ required,
100
+ },
101
+ }
102
+ const v$ = useVuelidate(rules, form)
103
+ </script>
104
+
105
+ <i18n lang="yaml">
106
+ de:
107
+ message: Nachricht
108
+ name: Name
109
+ placeholderMessage: Guten Tag, …
110
+ placeholderName: Manu Musterperson
111
+ en:
112
+ message: Message
113
+ name: Name
114
+ placeholderMessage: Hello, …
115
+ placeholderName: Person Doe
116
+ </i18n>
@@ -43,6 +43,7 @@
43
43
  }"
44
44
  :disabled="isDisabled"
45
45
  :placeholder="placeholder"
46
+ :name="name || idLabelFull"
46
47
  :readonly="isReadonly"
47
48
  :type="type"
48
49
  :value="valueFormatter(value?.$model as string)"
@@ -119,12 +120,13 @@ import type { BaseValidation } from '@vuelidate/core'
119
120
  import { consola } from 'consola'
120
121
 
121
122
  export interface Props {
123
+ idLabel?: string
122
124
  isDisabled?: boolean
123
125
  isOptional?: boolean
124
126
  isReadonly?: boolean
125
127
  isRequired?: boolean
126
128
  isValidatable?: boolean
127
- idLabel?: string
129
+ name?: string
128
130
  placeholder?: string
129
131
  success?: boolean
130
132
  title: string
@@ -135,12 +137,13 @@ export interface Props {
135
137
  warning?: boolean
136
138
  }
137
139
  const props = withDefaults(defineProps<Props>(), {
140
+ idLabel: undefined,
138
141
  isDisabled: false,
139
142
  isOptional: false,
140
143
  isReadonly: false,
141
144
  isRequired: false,
142
145
  isValidatable: false,
143
- idLabel: undefined,
146
+ name: undefined,
144
147
  placeholder: undefined,
145
148
  success: false,
146
149
  type: undefined,
@@ -24,7 +24,6 @@
24
24
  {{ t('globalValidationLength') }}
25
25
  </VioFormInputStateError>
26
26
  <VioFormInputStateError
27
- v-if="isRequired"
28
27
  :form-input="formInput"
29
28
  validation-property="required"
30
29
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-vio",
3
- "version": "8.1.2",
3
+ "version": "8.2.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dargmuesli/vio.git"
@@ -12,7 +12,7 @@
12
12
  "engines": {
13
13
  "node": "20"
14
14
  },
15
- "packageManager": "pnpm@8.7.5",
15
+ "packageManager": "pnpm@8.7.6",
16
16
  "files": [
17
17
  "assets",
18
18
  "components",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@axe-core/playwright": "4.7.3",
69
- "@dargmuesli/nuxt-cookie-control": "6.4.2",
69
+ "@dargmuesli/nuxt-cookie-control": "7.0.0-beta.1",
70
70
  "@heroicons/vue": "2.0.18",
71
71
  "@http-util/status-i18n": "0.8.1",
72
72
  "@intlify/eslint-plugin-vue-i18n": "3.0.0-next.3",
@@ -76,14 +76,14 @@
76
76
  "@nuxtjs/html-validator": "1.5.2",
77
77
  "@nuxtjs/i18n": "8.0.0-rc.4",
78
78
  "@nuxtjs/tailwindcss": "6.8.0",
79
- "@nuxtseo/module": "2.0.0-beta.30",
79
+ "@nuxtseo/module": "2.0.0-beta.31",
80
80
  "@pinia/nuxt": "0.4.11",
81
- "@playwright/test": "1.38.0",
81
+ "@playwright/test": "1.38.1",
82
82
  "@tailwindcss/forms": "0.5.6",
83
83
  "@tailwindcss/typography": "0.5.10",
84
84
  "@types/cookie": "0.5.2",
85
85
  "@types/lodash-es": "4.17.9",
86
- "@urql/core": "4.1.2",
86
+ "@urql/core": "4.1.3",
87
87
  "@urql/devtools": "2.0.3",
88
88
  "@urql/exchange-graphcache": "6.3.3",
89
89
  "@urql/vue": "1.1.2",
@@ -117,9 +117,9 @@
117
117
  "tailwindcss": "3.3.3",
118
118
  "vue": "3.3.4",
119
119
  "vue-gtag": "2.0.1",
120
- "vue-tsc": "1.8.11"
120
+ "vue-tsc": "1.8.13"
121
121
  },
122
122
  "peerDependencies": {
123
- "playwright-core": "1.38.0"
123
+ "playwright-core": "1.38.1"
124
124
  }
125
125
  }