@art-design-digital/payload-plugin-forms-v3 1.0.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.
- package/README.md +175 -0
- package/dist/collections/Forms.d.ts +3 -0
- package/dist/collections/Forms.js +64 -0
- package/dist/collections/Forms.js.map +1 -0
- package/dist/components/FormFieldRowLabel.d.ts +1 -0
- package/dist/components/FormFieldRowLabel.js +23 -0
- package/dist/components/FormFieldRowLabel.js.map +1 -0
- package/dist/components/OptionRowLabel.d.ts +1 -0
- package/dist/components/OptionRowLabel.js +21 -0
- package/dist/components/OptionRowLabel.js.map +1 -0
- package/dist/constants.d.ts +36 -0
- package/dist/constants.js +41 -0
- package/dist/constants.js.map +1 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +2 -0
- package/dist/exports/rsc.js.map +1 -0
- package/dist/fields/formFields/autocompleteField.d.ts +2 -0
- package/dist/fields/formFields/autocompleteField.js +63 -0
- package/dist/fields/formFields/autocompleteField.js.map +1 -0
- package/dist/fields/formFields/conditionGroup.d.ts +2 -0
- package/dist/fields/formFields/conditionGroup.js +36 -0
- package/dist/fields/formFields/conditionGroup.js.map +1 -0
- package/dist/fields/formFields/dateRow.d.ts +2 -0
- package/dist/fields/formFields/dateRow.js +29 -0
- package/dist/fields/formFields/dateRow.js.map +1 -0
- package/dist/fields/formFields/emptyDefaultField.d.ts +2 -0
- package/dist/fields/formFields/emptyDefaultField.js +13 -0
- package/dist/fields/formFields/emptyDefaultField.js.map +1 -0
- package/dist/fields/formFields/fieldTypeField.d.ts +2 -0
- package/dist/fields/formFields/fieldTypeField.js +64 -0
- package/dist/fields/formFields/fieldTypeField.js.map +1 -0
- package/dist/fields/formFields/index.d.ts +12 -0
- package/dist/fields/formFields/index.js +14 -0
- package/dist/fields/formFields/index.js.map +1 -0
- package/dist/fields/formFields/labelDescriptionRow.d.ts +6 -0
- package/dist/fields/formFields/labelDescriptionRow.js +31 -0
- package/dist/fields/formFields/labelDescriptionRow.js.map +1 -0
- package/dist/fields/formFields/lengthRow.d.ts +2 -0
- package/dist/fields/formFields/lengthRow.js +27 -0
- package/dist/fields/formFields/lengthRow.js.map +1 -0
- package/dist/fields/formFields/numberRow.d.ts +2 -0
- package/dist/fields/formFields/numberRow.js +37 -0
- package/dist/fields/formFields/numberRow.js.map +1 -0
- package/dist/fields/formFields/optionsArray.d.ts +6 -0
- package/dist/fields/formFields/optionsArray.js +44 -0
- package/dist/fields/formFields/optionsArray.js.map +1 -0
- package/dist/fields/formFields/placeholderDefaultRow.d.ts +6 -0
- package/dist/fields/formFields/placeholderDefaultRow.js +29 -0
- package/dist/fields/formFields/placeholderDefaultRow.js.map +1 -0
- package/dist/fields/formFields/requiredWidthRow.d.ts +2 -0
- package/dist/fields/formFields/requiredWidthRow.js +30 -0
- package/dist/fields/formFields/requiredWidthRow.js.map +1 -0
- package/dist/fields/formFields/textareaRow.d.ts +2 -0
- package/dist/fields/formFields/textareaRow.js +14 -0
- package/dist/fields/formFields/textareaRow.js.map +1 -0
- package/dist/fields/formFieldsArray.d.ts +6 -0
- package/dist/fields/formFieldsArray.js +41 -0
- package/dist/fields/formFieldsArray.js.map +1 -0
- package/dist/fields/index.d.ts +3 -0
- package/dist/fields/index.js +5 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/messagesGroup.d.ts +6 -0
- package/dist/fields/messagesGroup.js +37 -0
- package/dist/fields/messagesGroup.js.map +1 -0
- package/dist/fields/senderReceiverGroup.d.ts +2 -0
- package/dist/fields/senderReceiverGroup.js +54 -0
- package/dist/fields/senderReceiverGroup.js.map +1 -0
- package/dist/i18n/locales/de.d.ts +193 -0
- package/dist/i18n/locales/de.js +195 -0
- package/dist/i18n/locales/de.js.map +1 -0
- package/dist/i18n/locales/en.d.ts +193 -0
- package/dist/i18n/locales/en.js +195 -0
- package/dist/i18n/locales/en.js.map +1 -0
- package/dist/i18n/locales/es.d.ts +193 -0
- package/dist/i18n/locales/es.js +195 -0
- package/dist/i18n/locales/es.js.map +1 -0
- package/dist/i18n/locales/fr.d.ts +193 -0
- package/dist/i18n/locales/fr.js +195 -0
- package/dist/i18n/locales/fr.js.map +1 -0
- package/dist/i18n/locales/index.d.ts +5 -0
- package/dist/i18n/locales/index.js +7 -0
- package/dist/i18n/locales/index.js.map +1 -0
- package/dist/i18n/locales/nl.d.ts +193 -0
- package/dist/i18n/locales/nl.js +195 -0
- package/dist/i18n/locales/nl.js.map +1 -0
- package/dist/i18n/translations.d.ts +1166 -0
- package/dist/i18n/translations.js +223 -0
- package/dist/i18n/translations.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +104 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/conditions.d.ts +46 -0
- package/dist/utils/conditions.js +79 -0
- package/dist/utils/conditions.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { de } from './locales/de.js';
|
|
2
|
+
import { en } from './locales/en.js';
|
|
3
|
+
import { es } from './locales/es.js';
|
|
4
|
+
import { fr } from './locales/fr.js';
|
|
5
|
+
import { nl } from './locales/nl.js';
|
|
6
|
+
export const locales = {
|
|
7
|
+
de,
|
|
8
|
+
en,
|
|
9
|
+
es,
|
|
10
|
+
fr,
|
|
11
|
+
nl
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Creates a multi-language label object from all locales
|
|
15
|
+
* Payload expects: { de: 'German', en: 'English', ... }
|
|
16
|
+
*/ const t = (path)=>({
|
|
17
|
+
de: getNestedValue(de, path),
|
|
18
|
+
en: getNestedValue(en, path),
|
|
19
|
+
es: getNestedValue(es, path),
|
|
20
|
+
fr: getNestedValue(fr, path),
|
|
21
|
+
nl: getNestedValue(nl, path)
|
|
22
|
+
});
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
const getNestedValue = (obj, path)=>{
|
|
25
|
+
return path.split('.').reduce((current, key)=>current?.[key], obj);
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Multi-language labels for Payload admin UI
|
|
29
|
+
*/ export const labels = {
|
|
30
|
+
collection: {
|
|
31
|
+
description: t('collection.description'),
|
|
32
|
+
plural: t('collection.plural'),
|
|
33
|
+
singular: t('collection.singular')
|
|
34
|
+
},
|
|
35
|
+
fields: {
|
|
36
|
+
name: {
|
|
37
|
+
description: t('fields.name.description'),
|
|
38
|
+
label: t('fields.name.label')
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
formFields: {
|
|
42
|
+
description: t('formFields.description'),
|
|
43
|
+
fallback: t('formFields.fallback'),
|
|
44
|
+
fields: {
|
|
45
|
+
autocomplete: {
|
|
46
|
+
description: t('formFields.fields.autocomplete.description'),
|
|
47
|
+
label: t('formFields.fields.autocomplete.label'),
|
|
48
|
+
options: {
|
|
49
|
+
name: t('formFields.fields.autocomplete.options.name'),
|
|
50
|
+
'address-level2': t('formFields.fields.autocomplete.options.address-level2'),
|
|
51
|
+
country: t('formFields.fields.autocomplete.options.country'),
|
|
52
|
+
email: t('formFields.fields.autocomplete.options.email'),
|
|
53
|
+
'family-name': t('formFields.fields.autocomplete.options.family-name'),
|
|
54
|
+
'given-name': t('formFields.fields.autocomplete.options.given-name'),
|
|
55
|
+
off: t('formFields.fields.autocomplete.options.off'),
|
|
56
|
+
organization: t('formFields.fields.autocomplete.options.organization'),
|
|
57
|
+
'postal-code': t('formFields.fields.autocomplete.options.postal-code'),
|
|
58
|
+
'street-address': t('formFields.fields.autocomplete.options.street-address'),
|
|
59
|
+
tel: t('formFields.fields.autocomplete.options.tel'),
|
|
60
|
+
url: t('formFields.fields.autocomplete.options.url')
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
condition: {
|
|
64
|
+
description: t('formFields.fields.condition.description'),
|
|
65
|
+
field: {
|
|
66
|
+
description: t('formFields.fields.condition.field.description'),
|
|
67
|
+
label: t('formFields.fields.condition.field.label')
|
|
68
|
+
},
|
|
69
|
+
label: t('formFields.fields.condition.label'),
|
|
70
|
+
value: {
|
|
71
|
+
description: t('formFields.fields.condition.value.description'),
|
|
72
|
+
label: t('formFields.fields.condition.value.label')
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
default: {
|
|
76
|
+
description: t('formFields.fields.default.description'),
|
|
77
|
+
label: t('formFields.fields.default.label')
|
|
78
|
+
},
|
|
79
|
+
description: {
|
|
80
|
+
description: t('formFields.fields.description.description'),
|
|
81
|
+
label: t('formFields.fields.description.label')
|
|
82
|
+
},
|
|
83
|
+
emptyDefault: {
|
|
84
|
+
description: t('formFields.fields.emptyDefault.description'),
|
|
85
|
+
label: t('formFields.fields.emptyDefault.label')
|
|
86
|
+
},
|
|
87
|
+
fieldType: {
|
|
88
|
+
label: t('formFields.fields.fieldType.label'),
|
|
89
|
+
options: {
|
|
90
|
+
checkbox: t('formFields.fields.fieldType.options.checkbox'),
|
|
91
|
+
date: t('formFields.fields.fieldType.options.date'),
|
|
92
|
+
datetime: t('formFields.fields.fieldType.options.datetime'),
|
|
93
|
+
dropdown: t('formFields.fields.fieldType.options.dropdown'),
|
|
94
|
+
email: t('formFields.fields.fieldType.options.email'),
|
|
95
|
+
number: t('formFields.fields.fieldType.options.number'),
|
|
96
|
+
radio: t('formFields.fields.fieldType.options.radio'),
|
|
97
|
+
tel: t('formFields.fields.fieldType.options.tel'),
|
|
98
|
+
text: t('formFields.fields.fieldType.options.text'),
|
|
99
|
+
textarea: t('formFields.fields.fieldType.options.textarea'),
|
|
100
|
+
time: t('formFields.fields.fieldType.options.time'),
|
|
101
|
+
url: t('formFields.fields.fieldType.options.url')
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
label: {
|
|
105
|
+
description: t('formFields.fields.label.description'),
|
|
106
|
+
label: t('formFields.fields.label.label')
|
|
107
|
+
},
|
|
108
|
+
maxDate: {
|
|
109
|
+
description: t('formFields.fields.maxDate.description'),
|
|
110
|
+
label: t('formFields.fields.maxDate.label')
|
|
111
|
+
},
|
|
112
|
+
maxLength: {
|
|
113
|
+
label: t('formFields.fields.maxLength.label')
|
|
114
|
+
},
|
|
115
|
+
maxValue: {
|
|
116
|
+
label: t('formFields.fields.maxValue.label')
|
|
117
|
+
},
|
|
118
|
+
minDate: {
|
|
119
|
+
description: t('formFields.fields.minDate.description'),
|
|
120
|
+
label: t('formFields.fields.minDate.label')
|
|
121
|
+
},
|
|
122
|
+
minLength: {
|
|
123
|
+
label: t('formFields.fields.minLength.label')
|
|
124
|
+
},
|
|
125
|
+
minValue: {
|
|
126
|
+
label: t('formFields.fields.minValue.label')
|
|
127
|
+
},
|
|
128
|
+
options: {
|
|
129
|
+
description: t('formFields.fields.options.description'),
|
|
130
|
+
label: t('formFields.fields.options.label'),
|
|
131
|
+
optionLabel: {
|
|
132
|
+
description: t('formFields.fields.options.optionLabel.description'),
|
|
133
|
+
label: t('formFields.fields.options.optionLabel.label')
|
|
134
|
+
},
|
|
135
|
+
value: {
|
|
136
|
+
description: t('formFields.fields.options.value.description'),
|
|
137
|
+
label: t('formFields.fields.options.value.label')
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
placeholder: {
|
|
141
|
+
description: t('formFields.fields.placeholder.description'),
|
|
142
|
+
label: t('formFields.fields.placeholder.label')
|
|
143
|
+
},
|
|
144
|
+
required: {
|
|
145
|
+
label: t('formFields.fields.required.label')
|
|
146
|
+
},
|
|
147
|
+
rows: {
|
|
148
|
+
description: t('formFields.fields.rows.description'),
|
|
149
|
+
label: t('formFields.fields.rows.label')
|
|
150
|
+
},
|
|
151
|
+
step: {
|
|
152
|
+
description: t('formFields.fields.step.description'),
|
|
153
|
+
label: t('formFields.fields.step.label')
|
|
154
|
+
},
|
|
155
|
+
width: {
|
|
156
|
+
description: t('formFields.fields.width.description'),
|
|
157
|
+
label: t('formFields.fields.width.label')
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
label: t('formFields.label'),
|
|
161
|
+
optionFallback: t('formFields.optionFallback'),
|
|
162
|
+
plural: t('formFields.plural'),
|
|
163
|
+
singular: t('formFields.singular')
|
|
164
|
+
},
|
|
165
|
+
groups: {
|
|
166
|
+
messages: {
|
|
167
|
+
description: t('groups.messages.description'),
|
|
168
|
+
fields: {
|
|
169
|
+
errorMessage: {
|
|
170
|
+
defaultValue: t('groups.messages.fields.errorMessage.defaultValue'),
|
|
171
|
+
label: t('groups.messages.fields.errorMessage.label')
|
|
172
|
+
},
|
|
173
|
+
submitLabel: {
|
|
174
|
+
defaultValue: t('groups.messages.fields.submitLabel.defaultValue'),
|
|
175
|
+
label: t('groups.messages.fields.submitLabel.label')
|
|
176
|
+
},
|
|
177
|
+
successMessage: {
|
|
178
|
+
defaultValue: t('groups.messages.fields.successMessage.defaultValue'),
|
|
179
|
+
label: t('groups.messages.fields.successMessage.label')
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
label: t('groups.messages.label')
|
|
183
|
+
},
|
|
184
|
+
senderReceiver: {
|
|
185
|
+
description: t('groups.senderReceiver.description'),
|
|
186
|
+
fields: {
|
|
187
|
+
receiver: {
|
|
188
|
+
description: t('groups.senderReceiver.fields.receiver.description'),
|
|
189
|
+
label: t('groups.senderReceiver.fields.receiver.label')
|
|
190
|
+
},
|
|
191
|
+
senderMail: {
|
|
192
|
+
description: t('groups.senderReceiver.fields.senderMail.description'),
|
|
193
|
+
label: t('groups.senderReceiver.fields.senderMail.label')
|
|
194
|
+
},
|
|
195
|
+
senderName: {
|
|
196
|
+
description: t('groups.senderReceiver.fields.senderName.description'),
|
|
197
|
+
label: t('groups.senderReceiver.fields.senderName.label')
|
|
198
|
+
},
|
|
199
|
+
subject: {
|
|
200
|
+
description: t('groups.senderReceiver.fields.subject.description'),
|
|
201
|
+
label: t('groups.senderReceiver.fields.subject.label')
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
label: t('groups.senderReceiver.label')
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
tabs: {
|
|
208
|
+
formFields: {
|
|
209
|
+
description: t('tabs.formFields.description'),
|
|
210
|
+
label: t('tabs.formFields.label')
|
|
211
|
+
},
|
|
212
|
+
messages: {
|
|
213
|
+
description: t('tabs.messages.description'),
|
|
214
|
+
label: t('tabs.messages.label')
|
|
215
|
+
},
|
|
216
|
+
senderReceiver: {
|
|
217
|
+
description: t('tabs.senderReceiver.description'),
|
|
218
|
+
label: t('tabs.senderReceiver.label')
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=translations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/translations.ts"],"sourcesContent":["import { de } from './locales/de.js'\nimport { en } from './locales/en.js'\nimport { es } from './locales/es.js'\nimport { fr } from './locales/fr.js'\nimport { nl } from './locales/nl.js'\n\nexport type SupportedLanguage = 'de' | 'en' | 'es' | 'fr' | 'nl'\n\nexport const locales = { de, en, es, fr, nl } as const\n\ntype LocaleStrings = Record<SupportedLanguage, string>\n\n/**\n * Creates a multi-language label object from all locales\n * Payload expects: { de: 'German', en: 'English', ... }\n */\nconst t = (path: string): LocaleStrings => ({\n de: getNestedValue(de, path) as string,\n en: getNestedValue(en, path) as string,\n es: getNestedValue(es, path) as string,\n fr: getNestedValue(fr, path) as string,\n nl: getNestedValue(nl, path) as string,\n})\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getNestedValue = (obj: any, path: string): unknown => {\n return path.split('.').reduce((current, key) => current?.[key], obj)\n}\n\n/**\n * Multi-language labels for Payload admin UI\n */\nexport const labels = {\n collection: {\n description: t('collection.description'),\n plural: t('collection.plural'),\n singular: t('collection.singular'),\n },\n fields: {\n name: {\n description: t('fields.name.description'),\n label: t('fields.name.label'),\n },\n },\n formFields: {\n description: t('formFields.description'),\n fallback: t('formFields.fallback'),\n fields: {\n autocomplete: {\n description: t('formFields.fields.autocomplete.description'),\n label: t('formFields.fields.autocomplete.label'),\n options: {\n name: t('formFields.fields.autocomplete.options.name'),\n 'address-level2': t('formFields.fields.autocomplete.options.address-level2'),\n country: t('formFields.fields.autocomplete.options.country'),\n email: t('formFields.fields.autocomplete.options.email'),\n 'family-name': t('formFields.fields.autocomplete.options.family-name'),\n 'given-name': t('formFields.fields.autocomplete.options.given-name'),\n off: t('formFields.fields.autocomplete.options.off'),\n organization: t('formFields.fields.autocomplete.options.organization'),\n 'postal-code': t('formFields.fields.autocomplete.options.postal-code'),\n 'street-address': t('formFields.fields.autocomplete.options.street-address'),\n tel: t('formFields.fields.autocomplete.options.tel'),\n url: t('formFields.fields.autocomplete.options.url'),\n },\n },\n condition: {\n description: t('formFields.fields.condition.description'),\n field: {\n description: t('formFields.fields.condition.field.description'),\n label: t('formFields.fields.condition.field.label'),\n },\n label: t('formFields.fields.condition.label'),\n value: {\n description: t('formFields.fields.condition.value.description'),\n label: t('formFields.fields.condition.value.label'),\n },\n },\n default: {\n description: t('formFields.fields.default.description'),\n label: t('formFields.fields.default.label'),\n },\n description: {\n description: t('formFields.fields.description.description'),\n label: t('formFields.fields.description.label'),\n },\n emptyDefault: {\n description: t('formFields.fields.emptyDefault.description'),\n label: t('formFields.fields.emptyDefault.label'),\n },\n fieldType: {\n label: t('formFields.fields.fieldType.label'),\n options: {\n checkbox: t('formFields.fields.fieldType.options.checkbox'),\n date: t('formFields.fields.fieldType.options.date'),\n datetime: t('formFields.fields.fieldType.options.datetime'),\n dropdown: t('formFields.fields.fieldType.options.dropdown'),\n email: t('formFields.fields.fieldType.options.email'),\n number: t('formFields.fields.fieldType.options.number'),\n radio: t('formFields.fields.fieldType.options.radio'),\n tel: t('formFields.fields.fieldType.options.tel'),\n text: t('formFields.fields.fieldType.options.text'),\n textarea: t('formFields.fields.fieldType.options.textarea'),\n time: t('formFields.fields.fieldType.options.time'),\n url: t('formFields.fields.fieldType.options.url'),\n },\n },\n label: {\n description: t('formFields.fields.label.description'),\n label: t('formFields.fields.label.label'),\n },\n maxDate: {\n description: t('formFields.fields.maxDate.description'),\n label: t('formFields.fields.maxDate.label'),\n },\n maxLength: { label: t('formFields.fields.maxLength.label') },\n maxValue: { label: t('formFields.fields.maxValue.label') },\n minDate: {\n description: t('formFields.fields.minDate.description'),\n label: t('formFields.fields.minDate.label'),\n },\n minLength: { label: t('formFields.fields.minLength.label') },\n minValue: { label: t('formFields.fields.minValue.label') },\n options: {\n description: t('formFields.fields.options.description'),\n label: t('formFields.fields.options.label'),\n optionLabel: {\n description: t('formFields.fields.options.optionLabel.description'),\n label: t('formFields.fields.options.optionLabel.label'),\n },\n value: {\n description: t('formFields.fields.options.value.description'),\n label: t('formFields.fields.options.value.label'),\n },\n },\n placeholder: {\n description: t('formFields.fields.placeholder.description'),\n label: t('formFields.fields.placeholder.label'),\n },\n required: { label: t('formFields.fields.required.label') },\n rows: {\n description: t('formFields.fields.rows.description'),\n label: t('formFields.fields.rows.label'),\n },\n step: {\n description: t('formFields.fields.step.description'),\n label: t('formFields.fields.step.label'),\n },\n width: {\n description: t('formFields.fields.width.description'),\n label: t('formFields.fields.width.label'),\n },\n },\n label: t('formFields.label'),\n optionFallback: t('formFields.optionFallback'),\n plural: t('formFields.plural'),\n singular: t('formFields.singular'),\n },\n groups: {\n messages: {\n description: t('groups.messages.description'),\n fields: {\n errorMessage: {\n defaultValue: t('groups.messages.fields.errorMessage.defaultValue'),\n label: t('groups.messages.fields.errorMessage.label'),\n },\n submitLabel: {\n defaultValue: t('groups.messages.fields.submitLabel.defaultValue'),\n label: t('groups.messages.fields.submitLabel.label'),\n },\n successMessage: {\n defaultValue: t('groups.messages.fields.successMessage.defaultValue'),\n label: t('groups.messages.fields.successMessage.label'),\n },\n },\n label: t('groups.messages.label'),\n },\n senderReceiver: {\n description: t('groups.senderReceiver.description'),\n fields: {\n receiver: {\n description: t('groups.senderReceiver.fields.receiver.description'),\n label: t('groups.senderReceiver.fields.receiver.label'),\n },\n senderMail: {\n description: t('groups.senderReceiver.fields.senderMail.description'),\n label: t('groups.senderReceiver.fields.senderMail.label'),\n },\n senderName: {\n description: t('groups.senderReceiver.fields.senderName.description'),\n label: t('groups.senderReceiver.fields.senderName.label'),\n },\n subject: {\n description: t('groups.senderReceiver.fields.subject.description'),\n label: t('groups.senderReceiver.fields.subject.label'),\n },\n },\n label: t('groups.senderReceiver.label'),\n },\n },\n tabs: {\n formFields: {\n description: t('tabs.formFields.description'),\n label: t('tabs.formFields.label'),\n },\n messages: {\n description: t('tabs.messages.description'),\n label: t('tabs.messages.label'),\n },\n senderReceiver: {\n description: t('tabs.senderReceiver.description'),\n label: t('tabs.senderReceiver.label'),\n },\n },\n} as const\n"],"names":["de","en","es","fr","nl","locales","t","path","getNestedValue","obj","split","reduce","current","key","labels","collection","description","plural","singular","fields","name","label","formFields","fallback","autocomplete","options","country","email","off","organization","tel","url","condition","field","value","default","emptyDefault","fieldType","checkbox","date","datetime","dropdown","number","radio","text","textarea","time","maxDate","maxLength","maxValue","minDate","minLength","minValue","optionLabel","placeholder","required","rows","step","width","optionFallback","groups","messages","errorMessage","defaultValue","submitLabel","successMessage","senderReceiver","receiver","senderMail","senderName","subject","tabs"],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFormsCollection } from './collections/Forms.js';
|
|
2
|
+
export const formsPlugin = (pluginConfig = {})=>(config)=>{
|
|
3
|
+
if (!config.collections) {
|
|
4
|
+
config.collections = [];
|
|
5
|
+
}
|
|
6
|
+
// Add the Forms collection
|
|
7
|
+
config.collections.push(createFormsCollection(pluginConfig));
|
|
8
|
+
// Early return if disabled (schema is preserved for migrations)
|
|
9
|
+
if (pluginConfig.disabled) {
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
return config;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport type { FormsPluginConfig } from './types.js'\n\nimport { createFormsCollection } from './collections/Forms.js'\n\nexport type { FormsPluginConfig }\n\nexport const formsPlugin =\n (pluginConfig: FormsPluginConfig = {}) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = []\n }\n\n // Add the Forms collection\n config.collections.push(createFormsCollection(pluginConfig))\n\n // Early return if disabled (schema is preserved for migrations)\n if (pluginConfig.disabled) {\n return config\n }\n\n return config\n }\n"],"names":["createFormsCollection","formsPlugin","pluginConfig","config","collections","push","disabled"],"mappings":"AAIA,SAASA,qBAAqB,QAAQ,yBAAwB;AAI9D,OAAO,MAAMC,cACX,CAACC,eAAkC,CAAC,CAAC,GACrC,CAACC;QACC,IAAI,CAACA,OAAOC,WAAW,EAAE;YACvBD,OAAOC,WAAW,GAAG,EAAE;QACzB;QAEA,2BAA2B;QAC3BD,OAAOC,WAAW,CAACC,IAAI,CAACL,sBAAsBE;QAE9C,gEAAgE;QAChE,IAAIA,aAAaI,QAAQ,EAAE;YACzB,OAAOH;QACT;QAEA,OAAOA;IACT,EAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { CollectionConfig } from 'payload';
|
|
2
|
+
import type { FieldType, Width } from './constants.js';
|
|
3
|
+
export type FormsPluginConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* Access control for the Forms collection
|
|
6
|
+
* Override default access settings
|
|
7
|
+
*/
|
|
8
|
+
access?: CollectionConfig['access'];
|
|
9
|
+
/**
|
|
10
|
+
* Admin group name for the Forms collection
|
|
11
|
+
*/
|
|
12
|
+
adminGroup?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Disable the plugin (keeps schema for migrations)
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable localization for form fields
|
|
19
|
+
*/
|
|
20
|
+
localized?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use Width from constants.ts instead
|
|
24
|
+
*/
|
|
25
|
+
export type Widths = {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
full: string;
|
|
28
|
+
half: string;
|
|
29
|
+
onequarter: string;
|
|
30
|
+
threequarter: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Option for dropdown/radio form fields
|
|
34
|
+
*/
|
|
35
|
+
export type FormFieldOption = {
|
|
36
|
+
id?: string;
|
|
37
|
+
label: string;
|
|
38
|
+
value: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Autocomplete attribute values
|
|
42
|
+
*/
|
|
43
|
+
export type AutocompleteValue = 'address-level2' | 'country' | 'email' | 'family-name' | 'given-name' | 'name' | 'off' | 'organization' | 'postal-code' | 'street-address' | 'tel' | 'url';
|
|
44
|
+
/**
|
|
45
|
+
* Conditional display configuration
|
|
46
|
+
*/
|
|
47
|
+
export type FormFieldCondition = {
|
|
48
|
+
field?: string;
|
|
49
|
+
value?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Single form field configuration
|
|
53
|
+
*/
|
|
54
|
+
export type FormField = {
|
|
55
|
+
autocomplete?: AutocompleteValue;
|
|
56
|
+
condition?: FormFieldCondition;
|
|
57
|
+
default?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
emptyDefault?: boolean;
|
|
60
|
+
fieldType: FieldType;
|
|
61
|
+
id?: string;
|
|
62
|
+
label: string;
|
|
63
|
+
maxDate?: string;
|
|
64
|
+
maxLength?: number;
|
|
65
|
+
maxValue?: number;
|
|
66
|
+
minDate?: string;
|
|
67
|
+
minLength?: number;
|
|
68
|
+
minValue?: number;
|
|
69
|
+
options?: FormFieldOption[];
|
|
70
|
+
placeholder?: string;
|
|
71
|
+
required?: boolean;
|
|
72
|
+
rows?: number;
|
|
73
|
+
step?: number;
|
|
74
|
+
width: Width;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Sender/Receiver email configuration
|
|
78
|
+
*/
|
|
79
|
+
export type SenderReceiverGroup = {
|
|
80
|
+
receiver: string;
|
|
81
|
+
senderMail: string;
|
|
82
|
+
senderName: string;
|
|
83
|
+
subject: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Messages configuration (submit label, success/error messages)
|
|
87
|
+
*/
|
|
88
|
+
export type MessagesGroup = {
|
|
89
|
+
errorMessage: string;
|
|
90
|
+
submitLabel: string;
|
|
91
|
+
successMessage: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Complete form document type
|
|
95
|
+
*/
|
|
96
|
+
export type Form = {
|
|
97
|
+
createdAt: string;
|
|
98
|
+
formFields: FormField[];
|
|
99
|
+
id: string;
|
|
100
|
+
messagesGroup: MessagesGroup;
|
|
101
|
+
name: string;
|
|
102
|
+
senderReceiverGroup: SenderReceiverGroup;
|
|
103
|
+
updatedAt: string;
|
|
104
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nimport type { FieldType, Width } from './constants.js'\n\nexport type FormsPluginConfig = {\n /**\n * Access control for the Forms collection\n * Override default access settings\n */\n access?: CollectionConfig['access']\n\n /**\n * Admin group name for the Forms collection\n */\n adminGroup?: string\n\n /**\n * Disable the plugin (keeps schema for migrations)\n */\n disabled?: boolean\n\n /**\n * Enable localization for form fields\n */\n localized?: boolean\n}\n\n/**\n * @deprecated Use Width from constants.ts instead\n */\nexport type Widths = {\n [key: string]: string\n full: string\n half: string\n onequarter: string\n threequarter: string\n}\n\n/**\n * Option for dropdown/radio form fields\n */\nexport type FormFieldOption = {\n id?: string\n label: string\n value: string\n}\n\n/**\n * Autocomplete attribute values\n */\nexport type AutocompleteValue =\n | 'address-level2'\n | 'country'\n | 'email'\n | 'family-name'\n | 'given-name'\n | 'name'\n | 'off'\n | 'organization'\n | 'postal-code'\n | 'street-address'\n | 'tel'\n | 'url'\n\n/**\n * Conditional display configuration\n */\nexport type FormFieldCondition = {\n field?: string\n value?: string\n}\n\n/**\n * Single form field configuration\n */\nexport type FormField = {\n autocomplete?: AutocompleteValue\n condition?: FormFieldCondition\n default?: string\n description?: string\n emptyDefault?: boolean\n fieldType: FieldType\n id?: string\n label: string\n maxDate?: string\n maxLength?: number\n maxValue?: number\n minDate?: string\n minLength?: number\n minValue?: number\n options?: FormFieldOption[]\n placeholder?: string\n required?: boolean\n rows?: number\n step?: number\n width: Width\n}\n\n/**\n * Sender/Receiver email configuration\n */\nexport type SenderReceiverGroup = {\n receiver: string\n senderMail: string\n senderName: string\n subject: string\n}\n\n/**\n * Messages configuration (submit label, success/error messages)\n */\nexport type MessagesGroup = {\n errorMessage: string\n submitLabel: string\n successMessage: string\n}\n\n/**\n * Complete form document type\n */\nexport type Form = {\n createdAt: string\n formFields: FormField[]\n id: string\n messagesGroup: MessagesGroup\n name: string\n senderReceiverGroup: SenderReceiverGroup\n updatedAt: string\n}\n"],"names":[],"mappings":"AAqHA;;CAEC,GACD,WAQC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FieldType } from '../constants.js';
|
|
2
|
+
type SiblingData = {
|
|
3
|
+
emptyDefault?: boolean;
|
|
4
|
+
fieldType?: FieldType;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Shows field only for specific field types
|
|
8
|
+
*/
|
|
9
|
+
export declare const showForFieldTypes: (types: FieldType[]) => (_: unknown, siblingData: SiblingData) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Shows field for inputs with length validation (minLength/maxLength)
|
|
12
|
+
*/
|
|
13
|
+
export declare const showForLengthValidation: (_: unknown, siblingData: SiblingData) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Shows field for inputs with placeholder support
|
|
16
|
+
*/
|
|
17
|
+
export declare const showForPlaceholderInputs: (_: unknown, siblingData: SiblingData) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Shows field for inputs with default value support (excluding emptyDefault)
|
|
20
|
+
*/
|
|
21
|
+
export declare const showForDefaultValue: (_: unknown, siblingData: SiblingData) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Shows field for dropdown or radio types (fields with options)
|
|
24
|
+
*/
|
|
25
|
+
export declare const showForOptionsFields: (_: unknown, siblingData: SiblingData) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Shows field only for number type
|
|
28
|
+
*/
|
|
29
|
+
export declare const showForNumber: (_: unknown, siblingData: SiblingData) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Shows field only for textarea type
|
|
32
|
+
*/
|
|
33
|
+
export declare const showForTextarea: (_: unknown, siblingData: SiblingData) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Shows field for types with description support (all types)
|
|
36
|
+
*/
|
|
37
|
+
export declare const showForDescription: (_: unknown, siblingData: SiblingData) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Shows field for date/datetime types (minDate/maxDate)
|
|
40
|
+
*/
|
|
41
|
+
export declare const showForDateFields: (_: unknown, siblingData: SiblingData) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Shows field for types with autocomplete support
|
|
44
|
+
*/
|
|
45
|
+
export declare const showForAutocomplete: (_: unknown, siblingData: SiblingData) => boolean;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shows field only for specific field types
|
|
3
|
+
*/ export const showForFieldTypes = (types)=>(_, siblingData)=>types.includes(siblingData.fieldType);
|
|
4
|
+
/**
|
|
5
|
+
* Shows field for inputs with length validation (minLength/maxLength)
|
|
6
|
+
*/ export const showForLengthValidation = showForFieldTypes([
|
|
7
|
+
'text',
|
|
8
|
+
'textarea'
|
|
9
|
+
]);
|
|
10
|
+
/**
|
|
11
|
+
* Shows field for inputs with placeholder support
|
|
12
|
+
*/ export const showForPlaceholderInputs = showForFieldTypes([
|
|
13
|
+
'text',
|
|
14
|
+
'email',
|
|
15
|
+
'tel',
|
|
16
|
+
'url',
|
|
17
|
+
'number',
|
|
18
|
+
'textarea'
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* Shows field for inputs with default value support (excluding emptyDefault)
|
|
22
|
+
*/ export const showForDefaultValue = (_, siblingData)=>[
|
|
23
|
+
'text',
|
|
24
|
+
'email',
|
|
25
|
+
'tel',
|
|
26
|
+
'url',
|
|
27
|
+
'number',
|
|
28
|
+
'textarea',
|
|
29
|
+
'dropdown',
|
|
30
|
+
'radio'
|
|
31
|
+
].includes(siblingData.fieldType) && !siblingData.emptyDefault;
|
|
32
|
+
/**
|
|
33
|
+
* Shows field for dropdown or radio types (fields with options)
|
|
34
|
+
*/ export const showForOptionsFields = showForFieldTypes([
|
|
35
|
+
'dropdown',
|
|
36
|
+
'radio'
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Shows field only for number type
|
|
40
|
+
*/ export const showForNumber = showForFieldTypes([
|
|
41
|
+
'number'
|
|
42
|
+
]);
|
|
43
|
+
/**
|
|
44
|
+
* Shows field only for textarea type
|
|
45
|
+
*/ export const showForTextarea = showForFieldTypes([
|
|
46
|
+
'textarea'
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* Shows field for types with description support (all types)
|
|
50
|
+
*/ export const showForDescription = showForFieldTypes([
|
|
51
|
+
'checkbox',
|
|
52
|
+
'date',
|
|
53
|
+
'datetime',
|
|
54
|
+
'dropdown',
|
|
55
|
+
'email',
|
|
56
|
+
'number',
|
|
57
|
+
'radio',
|
|
58
|
+
'tel',
|
|
59
|
+
'text',
|
|
60
|
+
'textarea',
|
|
61
|
+
'time',
|
|
62
|
+
'url'
|
|
63
|
+
]);
|
|
64
|
+
/**
|
|
65
|
+
* Shows field for date/datetime types (minDate/maxDate)
|
|
66
|
+
*/ export const showForDateFields = showForFieldTypes([
|
|
67
|
+
'date',
|
|
68
|
+
'datetime'
|
|
69
|
+
]);
|
|
70
|
+
/**
|
|
71
|
+
* Shows field for types with autocomplete support
|
|
72
|
+
*/ export const showForAutocomplete = showForFieldTypes([
|
|
73
|
+
'text',
|
|
74
|
+
'email',
|
|
75
|
+
'tel',
|
|
76
|
+
'url'
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=conditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/conditions.ts"],"sourcesContent":["import type { FieldType } from '../constants.js'\n\ntype SiblingData = {\n emptyDefault?: boolean\n fieldType?: FieldType\n}\n\n/**\n * Shows field only for specific field types\n */\nexport const showForFieldTypes =\n (types: FieldType[]) =>\n (_: unknown, siblingData: SiblingData): boolean =>\n types.includes(siblingData.fieldType as FieldType)\n\n/**\n * Shows field for inputs with length validation (minLength/maxLength)\n */\nexport const showForLengthValidation = showForFieldTypes(['text', 'textarea'])\n\n/**\n * Shows field for inputs with placeholder support\n */\nexport const showForPlaceholderInputs = showForFieldTypes([\n 'text',\n 'email',\n 'tel',\n 'url',\n 'number',\n 'textarea',\n])\n\n/**\n * Shows field for inputs with default value support (excluding emptyDefault)\n */\nexport const showForDefaultValue = (_: unknown, siblingData: SiblingData): boolean =>\n ['text', 'email', 'tel', 'url', 'number', 'textarea', 'dropdown', 'radio'].includes(\n siblingData.fieldType as string,\n ) && !siblingData.emptyDefault\n\n/**\n * Shows field for dropdown or radio types (fields with options)\n */\nexport const showForOptionsFields = showForFieldTypes(['dropdown', 'radio'])\n\n/**\n * Shows field only for number type\n */\nexport const showForNumber = showForFieldTypes(['number'])\n\n/**\n * Shows field only for textarea type\n */\nexport const showForTextarea = showForFieldTypes(['textarea'])\n\n/**\n * Shows field for types with description support (all types)\n */\nexport const showForDescription = showForFieldTypes([\n 'checkbox',\n 'date',\n 'datetime',\n 'dropdown',\n 'email',\n 'number',\n 'radio',\n 'tel',\n 'text',\n 'textarea',\n 'time',\n 'url',\n])\n\n/**\n * Shows field for date/datetime types (minDate/maxDate)\n */\nexport const showForDateFields = showForFieldTypes(['date', 'datetime'])\n\n/**\n * Shows field for types with autocomplete support\n */\nexport const showForAutocomplete = showForFieldTypes(['text', 'email', 'tel', 'url'])\n"],"names":["showForFieldTypes","types","_","siblingData","includes","fieldType","showForLengthValidation","showForPlaceholderInputs","showForDefaultValue","emptyDefault","showForOptionsFields","showForNumber","showForTextarea","showForDescription","showForDateFields","showForAutocomplete"],"mappings":"AAOA;;CAEC,GACD,OAAO,MAAMA,oBACX,CAACC,QACD,CAACC,GAAYC,cACXF,MAAMG,QAAQ,CAACD,YAAYE,SAAS,EAAc;AAEtD;;CAEC,GACD,OAAO,MAAMC,0BAA0BN,kBAAkB;IAAC;IAAQ;CAAW,EAAC;AAE9E;;CAEC,GACD,OAAO,MAAMO,2BAA2BP,kBAAkB;IACxD;IACA;IACA;IACA;IACA;IACA;CACD,EAAC;AAEF;;CAEC,GACD,OAAO,MAAMQ,sBAAsB,CAACN,GAAYC,cAC9C;QAAC;QAAQ;QAAS;QAAO;QAAO;QAAU;QAAY;QAAY;KAAQ,CAACC,QAAQ,CACjFD,YAAYE,SAAS,KAClB,CAACF,YAAYM,YAAY,CAAA;AAEhC;;CAEC,GACD,OAAO,MAAMC,uBAAuBV,kBAAkB;IAAC;IAAY;CAAQ,EAAC;AAE5E;;CAEC,GACD,OAAO,MAAMW,gBAAgBX,kBAAkB;IAAC;CAAS,EAAC;AAE1D;;CAEC,GACD,OAAO,MAAMY,kBAAkBZ,kBAAkB;IAAC;CAAW,EAAC;AAE9D;;CAEC,GACD,OAAO,MAAMa,qBAAqBb,kBAAkB;IAClD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAC;AAEF;;CAEC,GACD,OAAO,MAAMc,oBAAoBd,kBAAkB;IAAC;IAAQ;CAAW,EAAC;AAExE;;CAEC,GACD,OAAO,MAAMe,sBAAsBf,kBAAkB;IAAC;IAAQ;IAAS;IAAO;CAAM,EAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@art-design-digital/payload-plugin-forms-v3",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Payload plugin for forms. This plugin adds a global collection of forms to your Payload instance. You can create and manage forms in the admin interface, and then render them in your frontend application.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./src/index.ts",
|
|
10
|
+
"types": "./src/index.ts",
|
|
11
|
+
"default": "./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"import": "./src/exports/client.ts",
|
|
15
|
+
"types": "./src/exports/client.ts",
|
|
16
|
+
"default": "./src/exports/client.ts"
|
|
17
|
+
},
|
|
18
|
+
"./rsc": {
|
|
19
|
+
"import": "./src/exports/rsc.ts",
|
|
20
|
+
"types": "./src/exports/rsc.ts",
|
|
21
|
+
"default": "./src/exports/rsc.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./src/index.ts",
|
|
25
|
+
"types": "./src/index.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
|
|
31
|
+
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
32
|
+
"build:types": "tsc --outDir dist --rootDir ./src",
|
|
33
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
34
|
+
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
35
|
+
"dev": "next dev dev --turbo",
|
|
36
|
+
"dev:generate-importmap": "pnpm dev:payload generate:importmap",
|
|
37
|
+
"dev:generate-types": "pnpm dev:payload generate:types",
|
|
38
|
+
"dev:payload": "cross-env PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload",
|
|
39
|
+
"generate:importmap": "pnpm dev:generate-importmap",
|
|
40
|
+
"generate:types": "pnpm dev:generate-types",
|
|
41
|
+
"lint": "eslint",
|
|
42
|
+
"lint:fix": "eslint ./src --fix",
|
|
43
|
+
"prepublishOnly": "pnpm clean && pnpm build",
|
|
44
|
+
"test": "pnpm test:int && pnpm test:e2e",
|
|
45
|
+
"test:e2e": "playwright test",
|
|
46
|
+
"test:int": "vitest"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
50
|
+
"@payloadcms/db-mongodb": "3.37.0",
|
|
51
|
+
"@payloadcms/db-postgres": "3.37.0",
|
|
52
|
+
"@payloadcms/db-sqlite": "3.37.0",
|
|
53
|
+
"@payloadcms/eslint-config": "3.9.0",
|
|
54
|
+
"@payloadcms/next": "3.37.0",
|
|
55
|
+
"@payloadcms/richtext-lexical": "3.37.0",
|
|
56
|
+
"@payloadcms/ui": "3.37.0",
|
|
57
|
+
"@playwright/test": "1.56.1",
|
|
58
|
+
"@swc-node/register": "1.10.9",
|
|
59
|
+
"@swc/cli": "0.6.0",
|
|
60
|
+
"@types/node": "^22.5.4",
|
|
61
|
+
"@types/react": "19.1.8",
|
|
62
|
+
"@types/react-dom": "19.1.6",
|
|
63
|
+
"copyfiles": "2.4.1",
|
|
64
|
+
"cross-env": "^7.0.3",
|
|
65
|
+
"eslint": "^9.23.0",
|
|
66
|
+
"eslint-config-next": "15.4.7",
|
|
67
|
+
"graphql": "^16.8.1",
|
|
68
|
+
"mongodb-memory-server": "10.1.4",
|
|
69
|
+
"next": "15.4.7",
|
|
70
|
+
"open": "^10.1.0",
|
|
71
|
+
"payload": "3.37.0",
|
|
72
|
+
"prettier": "^3.4.2",
|
|
73
|
+
"qs-esm": "7.0.2",
|
|
74
|
+
"react": "19.1.0",
|
|
75
|
+
"react-dom": "19.1.0",
|
|
76
|
+
"rimraf": "3.0.2",
|
|
77
|
+
"sharp": "0.34.2",
|
|
78
|
+
"sort-package-json": "^2.10.0",
|
|
79
|
+
"typescript": "5.7.3",
|
|
80
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
81
|
+
"vitest": "^3.1.2"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"payload": "^3.37.0"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": "^18.20.2 || >=20.9.0",
|
|
88
|
+
"pnpm": "^9 || ^10"
|
|
89
|
+
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"exports": {
|
|
92
|
+
".": {
|
|
93
|
+
"import": "./dist/index.js",
|
|
94
|
+
"types": "./dist/index.d.ts",
|
|
95
|
+
"default": "./dist/index.js"
|
|
96
|
+
},
|
|
97
|
+
"./client": {
|
|
98
|
+
"import": "./dist/exports/client.js",
|
|
99
|
+
"types": "./dist/exports/client.d.ts",
|
|
100
|
+
"default": "./dist/exports/client.js"
|
|
101
|
+
},
|
|
102
|
+
"./rsc": {
|
|
103
|
+
"import": "./dist/exports/rsc.js",
|
|
104
|
+
"types": "./dist/exports/rsc.d.ts",
|
|
105
|
+
"default": "./dist/exports/rsc.js"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"main": "./dist/index.js",
|
|
109
|
+
"types": "./dist/index.d.ts"
|
|
110
|
+
},
|
|
111
|
+
"pnpm": {
|
|
112
|
+
"onlyBuiltDependencies": [
|
|
113
|
+
"sharp",
|
|
114
|
+
"esbuild",
|
|
115
|
+
"unrs-resolver"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"registry": "https://registry.npmjs.org/",
|
|
119
|
+
"dependencies": {
|
|
120
|
+
"@payloadcms/translations": "^3.65.0"
|
|
121
|
+
}
|
|
122
|
+
}
|