srcdev-nuxt-forms 2.0.3 → 2.0.5

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.
Files changed (35) hide show
  1. package/composables/useZodValidation.ts +1 -1
  2. package/package.json +21 -3
  3. package/.editorconfig +0 -12
  4. package/.eslintignore +0 -7
  5. package/.eslintrc.cjs +0 -12
  6. package/.nmprc +0 -2
  7. package/.nuxtrc +0 -1
  8. package/.playground/components/scaffolding/footer/NavFooter.vue +0 -62
  9. package/.playground/components/ui/content-grid/ContentGrid.vue +0 -85
  10. package/.playground/composables/useApiRequest.ts +0 -25
  11. package/.playground/composables/useErrorMessages.ts +0 -59
  12. package/.playground/composables/useFormControl.ts +0 -248
  13. package/.playground/composables/useSleep.ts +0 -5
  14. package/.playground/composables/useStyleClassPassthrough.ts +0 -30
  15. package/.playground/composables/useZodValidation.ts +0 -120
  16. package/.playground/layouts/default.vue +0 -72
  17. package/.playground/nuxt.config.ts +0 -27
  18. package/.playground/pages/forms/examples/buttons/index.vue +0 -155
  19. package/.playground/pages/forms/examples/material/cssbattle.vue +0 -60
  20. package/.playground/pages/forms/examples/material/text-fields.vue +0 -594
  21. package/.playground/pages/index.vue +0 -33
  22. package/.playground/pages/limit-text.vue +0 -43
  23. package/.playground/pages/typography.vue +0 -83
  24. package/.playground/server/api/places/list.get.ts +0 -23
  25. package/.playground/server/api/textFields.post.ts +0 -37
  26. package/.playground/server/api/utils/index.get.ts +0 -20
  27. package/.playground/server/data/places/cities.json +0 -43
  28. package/.playground/server/data/places/countries.json +0 -55
  29. package/.playground/server/data/utils/title.json +0 -49
  30. package/.playground/types/types.forms.ts +0 -216
  31. package/.playground/types/types.places.ts +0 -8
  32. package/.playground/types/types.zodFormControl.ts +0 -21
  33. package/.prettierrc +0 -5
  34. package/.release-it.json +0 -6
  35. package/tsconfig.json +0 -3
@@ -1,83 +0,0 @@
1
- <template>
2
- <div>
3
- <NuxtLayout name="default">
4
- <template #layout-content>
5
- <h1 class="heading-3">Typography</h1>
6
- <h2 class="heading-4">Headings</h2>
7
- <ul>
8
- <li class="heading-1">Heading 1</li>
9
- <li class="heading-2">Heading 2</li>
10
- <li class="heading-3">Heading 3</li>
11
- <li class="heading-4">Heading 4</li>
12
- <li class="heading-5">Heading 5</li>
13
- <li class="heading-6">Heading 6</li>
14
- </ul>
15
-
16
- <h2 class="heading-4">Body Regular</h2>
17
- <ul>
18
- <li class="body-large">Body Large</li>
19
- <li class="body-normal">Body Normal</li>
20
- <li class="body-small">Body Small</li>
21
- <li class="body-xsmall">Body X-Small</li>
22
- </ul>
23
-
24
- <h2 class="heading-4">Body Semi-Bold</h2>
25
- <ul>
26
- <li class="body-large-semibold">Body Large Semi-Bold</li>
27
- <li class="body-normal-semibold">Body Normal Semi-Bold</li>
28
- <li class="body-small-semibold">Body Small Semi-Bold</li>
29
- <li class="body-xsmall-semibold">Body X-Small Semi-Bold</li>
30
- </ul>
31
-
32
- <h2 class="heading-4">Body Bold</h2>
33
- <ul>
34
- <li class="body-large-bold">Body Large Bold</li>
35
- <li class="body-normal-bold">Body Normal Bold</li>
36
- <li class="body-small-bold">Body Small Bold</li>
37
- <li class="body-xsmall-bold">Body X-Small Bold</li>
38
- </ul>
39
-
40
- <h2 class="heading-4">Links</h2>
41
- <ul>
42
- <li class="link-large">Link Large</li>
43
- <li class="link-normal">Link Normal</li>
44
- <li class="link-small">Link Small</li>
45
- <li class="link-xsmall">Link X-Small</li>
46
- </ul>
47
- </template>
48
- </NuxtLayout>
49
- </div>
50
- </template>
51
-
52
- <script setup lang="ts">
53
- definePageMeta({
54
- layout: false,
55
- });
56
-
57
- useHead({
58
- title: 'Typography Examples',
59
- meta: [{ name: 'description', content: 'Typography' }],
60
- bodyAttrs: {
61
- class: 'typography',
62
- },
63
- });
64
- </script>
65
-
66
- <style lang="css">
67
- .typography {
68
- /* font-family: 'Poppins', Sans-serif; */
69
- /* font-family: var(--font-family); */
70
-
71
- ul {
72
- list-style-type: none;
73
- padding: 0;
74
-
75
- li {
76
- background: var(--surface-subtle);
77
- border-radius: 5px;
78
- padding: 10px;
79
- margin-block-end: 20px;
80
- }
81
- }
82
- }
83
- </style>
@@ -1,23 +0,0 @@
1
- import cities from '../../data/places/cities.json';
2
- import countries from '../../data/places/countries.json';
3
-
4
- export default defineEventHandler(async (event) => {
5
- const sleep = async (ms: number) => {
6
- return new Promise((resolve) => setTimeout(resolve, ms));
7
- };
8
-
9
- const query = getQuery(event);
10
-
11
- let timeout = 0;
12
- if (typeof query.delay !== 'undefined') {
13
- timeout = Number(query.delay);
14
- }
15
-
16
- await sleep(timeout);
17
-
18
- if (query.category === 'cities') {
19
- return cities;
20
- } else if (query.category === 'countries') {
21
- return countries;
22
- }
23
- });
@@ -1,37 +0,0 @@
1
- import { createError } from 'h3';
2
-
3
- export default defineEventHandler(async (event: any) => {
4
- const body = await readBody<{ emailAddress: string; password: string; username: string }>(event);
5
-
6
- const { emailAddress, password, username } = body;
7
-
8
- let throwError = false;
9
-
10
- if (emailAddress === 'test@test.com') {
11
- throwError = true;
12
- }
13
-
14
- const response = {
15
- status: 200,
16
- statusText: 'success',
17
- };
18
-
19
- // set some other response status cde
20
- // setResponseStatus(event, 202)
21
-
22
- // Throw some server side errors
23
- if (throwError) {
24
- throw createError({
25
- statusCode: 400,
26
- statusMessage: 'error',
27
- data: {
28
- errors: {
29
- emailAddress: 'Email address already registered',
30
- username: 'Username already registered',
31
- password: ['Password is too weak', 'Password is too short'],
32
- },
33
- },
34
- });
35
- }
36
- return response;
37
- });
@@ -1,20 +0,0 @@
1
- import title from '../../data/utils/title.json';
2
-
3
- export default defineEventHandler(async (event) => {
4
- const sleep = async (ms: number) => {
5
- return new Promise((resolve) => setTimeout(resolve, ms));
6
- };
7
-
8
- const query = getQuery(event);
9
-
10
- let timeout = 0;
11
- if (typeof query.delay !== 'undefined') {
12
- timeout = Number(query.delay);
13
- }
14
-
15
- await sleep(timeout);
16
-
17
- if (query.category === 'title') {
18
- return title;
19
- }
20
- });
@@ -1,43 +0,0 @@
1
- {
2
- "data": [
3
- {
4
- "id": "bradford-on-avon",
5
- "name": "cities",
6
- "value": "cities-2",
7
- "label": "Bradford on Avon"
8
- },
9
- {
10
- "id": "bath",
11
- "name": "cities",
12
- "value": "cities-12",
13
- "label": "Bath"
14
- },
15
- {
16
- "id": "bristol",
17
- "name": "cities",
18
- "value": "cities-23",
19
- "label": "Bristol"
20
- },
21
- {
22
- "id": "london",
23
- "name": "cities",
24
- "value": "cities-42",
25
- "label": "London"
26
- },
27
- {
28
- "id": "sunderland",
29
- "name": "cities",
30
- "value": "cities-56",
31
- "label": "Sunderland"
32
- },
33
- {
34
- "id": "penzance",
35
- "name": "cities",
36
- "value": "cities-09",
37
- "label": "Penzance"
38
- }
39
- ],
40
- "total": 6,
41
- "skip": 0,
42
- "limit": 10
43
- }
@@ -1,55 +0,0 @@
1
- {
2
- "data": [
3
- {
4
- "id": "uk",
5
- "name": "countries",
6
- "value": "countries-12",
7
- "label": "United Kingdom"
8
- },
9
- {
10
- "id": "france",
11
- "name": "countries",
12
- "value": "countries-23",
13
- "label": "France"
14
- },
15
- {
16
- "id": "spain",
17
- "name": "countries",
18
- "value": "countries-42",
19
- "label": "Spain"
20
- },
21
- {
22
- "id": "italy",
23
- "name": "countries",
24
- "value": "countries-56",
25
- "label": "Italy"
26
- },
27
- {
28
- "id": "greece",
29
- "name": "countries",
30
- "value": "countries-09",
31
- "label": "Greece"
32
- },
33
- {
34
- "id": "turkey",
35
- "name": "countries",
36
- "value": "countries-13",
37
- "label": "Turkey"
38
- },
39
- {
40
- "id": "germany",
41
- "name": "countries",
42
- "value": "countries-76",
43
- "label": "Germany"
44
- },
45
- {
46
- "id": "portugal",
47
- "name": "countries",
48
- "value": "countries-34",
49
- "label": "Portugal"
50
- }
51
- ],
52
- "total": 5,
53
- "skip": 0,
54
- "limit": 10
55
- }
@@ -1,49 +0,0 @@
1
- {
2
- "data": [
3
- {
4
- "id": "mr",
5
- "name": "title",
6
- "value": "title-12",
7
- "label": "Mr"
8
- },
9
- {
10
- "id": "Mrs",
11
- "name": "title",
12
- "value": "title-23",
13
- "label": "Mrs"
14
- },
15
- {
16
- "id": "ms",
17
- "name": "title",
18
- "value": "title-42",
19
- "label": "Ms"
20
- },
21
- {
22
- "id": "madam",
23
- "name": "title",
24
- "value": "title-56",
25
- "label": "Madam"
26
- },
27
- {
28
- "id": "prof",
29
- "name": "title",
30
- "value": "title-09",
31
- "label": "Professor"
32
- },
33
- {
34
- "id": "sir",
35
- "name": "title",
36
- "value": "title-11",
37
- "label": "Sir"
38
- },
39
- {
40
- "id": "lady",
41
- "name": "title",
42
- "value": "title-22",
43
- "label": "Lady"
44
- }
45
- ],
46
- "total": 5,
47
- "skip": 0,
48
- "limit": 10
49
- }
@@ -1,216 +0,0 @@
1
- export interface IValidationPatterns {
2
- pattern: string;
3
- minlength: string;
4
- maxlength: string;
5
- hint: string;
6
- }
7
-
8
- export interface IOptionsConfig {
9
- id: string;
10
- name: string;
11
- value: string;
12
- label: string;
13
- }
14
-
15
- export interface IFormMultipleOptions {
16
- data: IOptionsConfig[];
17
- total: number;
18
- skip: number;
19
- limit: number;
20
- }
21
-
22
- export interface IOptionsValueArr {
23
- [key: string]: string | boolean | number | URL | object;
24
- }
25
-
26
- export interface IFieldsInitialState {
27
- [key: string]: null | string | boolean | number | URL | object | IOptionsValueArr[];
28
- }
29
-
30
- export type TFieldsInitialState = {
31
- [key: string]: null | string | boolean | number | URL | object | IOptionsValueArr[];
32
- };
33
-
34
- export interface IValidityState {
35
- badInput: boolean;
36
- customError: boolean;
37
- patternMismatch: boolean;
38
- rangeOverflow: boolean;
39
- rangeUnderflow: boolean;
40
- stepMismatch: boolean;
41
- tooLong: boolean;
42
- tooShort: boolean;
43
- typeMismatch: boolean;
44
- valid: boolean;
45
- valueMissing: boolean;
46
- }
47
-
48
- export interface IValidityStateArr {
49
- [key: string]: {
50
- badInput: boolean;
51
- customError: boolean;
52
- patternMismatch: boolean;
53
- rangeOverflow: boolean;
54
- rangeUnderflow: boolean;
55
- stepMismatch: boolean;
56
- tooLong: boolean;
57
- tooShort: boolean;
58
- typeMismatch: boolean;
59
- valid: boolean;
60
- valueMissing: boolean;
61
- };
62
- }
63
-
64
- export interface IFormFieldsState {
65
- [key: string]: boolean;
66
- }
67
-
68
- export interface ICustomErrorMessage {
69
- useCustomError: boolean;
70
- message: string;
71
- }
72
-
73
- export interface InpuTextC12 {
74
- label: string;
75
- placeholder: string;
76
- errorMessage: string;
77
- }
78
-
79
- export interface IErrorMessagesArr {
80
- [x: string]: ICustomErrorMessage;
81
- }
82
-
83
- export interface IFormFieldC12 {
84
- label: string;
85
- placeholder: string;
86
- errorMessage: string;
87
- useCustomError: boolean;
88
- customErrors: null | string | string[];
89
- isValid: boolean;
90
- isDirty: boolean;
91
- type: string;
92
- previousValue: null | string | boolean | number | URL | object;
93
- }
94
-
95
- export interface IFormFieldsC12 {
96
- [x: string]: IFormFieldC12;
97
- }
98
-
99
- export interface IFormFieldState {
100
- isValid: boolean;
101
- isDirty: boolean;
102
- previousValue: null | string | boolean | number | URL | object;
103
- }
104
-
105
- export interface IFormFieldStateObj {
106
- [x: string]: IFormFieldState;
107
- }
108
-
109
- export interface IFormData {
110
- [x: string]: string | boolean | number | URL | object;
111
- data: IFieldsInitialState;
112
- validityState: IFormFieldsState;
113
- dirtyFields: IFormFieldsState;
114
- focusedField: string;
115
- isPending: boolean;
116
- errorCount: number;
117
- errorMessages: IErrorMessagesArr;
118
- formFieldsC12: IFormFieldsC12;
119
- formIsValid: boolean;
120
- submitAttempted: boolean;
121
- submitDisabled: boolean;
122
- submitSuccess: boolean;
123
- displayErrorMessages: boolean;
124
- }
125
-
126
- export interface IApiErrorMessages {
127
- [x: string]: string;
128
- }
129
-
130
- // New types
131
-
132
- export interface C12nInputText {
133
- type: string;
134
- id: string;
135
- name: string;
136
- label: string;
137
- placeholder: string;
138
- errorMessage: string;
139
- fieldHasError: boolean;
140
- required: boolean;
141
- styleClassPassthrough: string[];
142
- }
143
-
144
- export interface C12nMultipleCheckboxes {
145
- id: string;
146
- name: string;
147
- label: string;
148
- legend: string;
149
- placeholder: string;
150
- errorMessage: string;
151
- fieldHasError: boolean;
152
- required: boolean;
153
- styleClassPassthrough: string[];
154
- }
155
-
156
- export interface C12nInputCheckboxWithLabel {
157
- id: string;
158
- name: string;
159
- required: string;
160
- label: string;
161
- placeholder: string;
162
- errorMessage: string | string[];
163
- fieldHasError: boolean;
164
- styleClassPassthrough: string[];
165
- }
166
-
167
- export interface C12nInputRange {
168
- id: string;
169
- name: string;
170
- label: string;
171
- min: number;
172
- max: number;
173
- step: number;
174
- placeholder: string;
175
- errorMessage: string;
176
- fieldHasError: boolean;
177
- required: boolean;
178
- styleClassPassthrough: string[];
179
- }
180
-
181
- export interface C12nInputTextCore {
182
- type: string;
183
- id: string;
184
- name: string;
185
- label: string;
186
- placeholder: string;
187
- errorMessage: string;
188
- fieldHasError: boolean;
189
- required: boolean;
190
- }
191
-
192
- export interface InputTextWithLabel {
193
- type: string;
194
- id: string;
195
- name: string;
196
- label: string;
197
- placeholder: string;
198
- errorMessage: string;
199
- fieldHasError: boolean;
200
- required: boolean;
201
- styleClassPassthrough: string[];
202
- deepCssClassPassthrough: string[];
203
- }
204
-
205
- export interface ApiErrorResponse {
206
- url: string;
207
- statusCode: number;
208
- statusMessage: string;
209
- message: string;
210
- stack: string;
211
- data: {
212
- errors: {
213
- [key: string]: string | string[]; // Index signature for dynamic keys
214
- };
215
- };
216
- }
@@ -1,8 +0,0 @@
1
- import type { IOptionsConfig } from '@/types/types.forms';
2
-
3
- export interface IFormMultipleOptions {
4
- data: IOptionsConfig[];
5
- total: number;
6
- skip: number;
7
- limit: number;
8
- }
@@ -1,21 +0,0 @@
1
- import type { IFieldsInitialState, IFormFieldsState, IFormFieldsC12, IFormFieldC12, IApiErrorMessages, ICustomErrorMessage, IErrorMessagesArr } from '@/types/types.forms';
2
-
3
- export interface IZodeFormControl {
4
- [x: string]: string | boolean | number | URL | object;
5
- data: IFieldsInitialState;
6
- validityState: IFormFieldsState;
7
- dirtyFields: IFormFieldsState;
8
- focusedField: string;
9
- isDisabled: boolean;
10
- isPending: boolean;
11
- errorCount: number;
12
- errorMessages: IErrorMessagesArr;
13
- formFieldsC12: IFormFieldsC12;
14
- formIsValid: boolean;
15
- submitAttempted: boolean;
16
- submitDisabled: boolean;
17
- submitSuccess: boolean;
18
- displayErrorMessages: boolean;
19
- displayLoader: boolean;
20
- submitSuccessful: boolean;
21
- }
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "semi": true,
3
- "singleQuote": true,
4
- "printWidth": 200
5
- }
package/.release-it.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/release-it/schema/release-it.json",
3
- "github": {
4
- "release": true
5
- }
6
- }
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "./.nuxt/tsconfig.json"
3
- }