@nextlyhq/plugin-form-builder 0.0.2-alpha.33 → 0.0.2-alpha.35
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 +4 -5
- package/dist/admin/index.d.ts +101 -303
- package/dist/admin/index.js +3583 -3245
- package/dist/admin/index.js.map +1 -1
- package/dist/chunk-I4VFGPNR.js +506 -0
- package/dist/chunk-I4VFGPNR.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +422 -573
- package/dist/index.js.map +1 -1
- package/dist/{index-BRumOEsE.d.ts → types-C-DcuYGF.d.ts} +61 -93
- package/package.json +26 -31
- package/dist/CheckboxFieldEditor-K4T6QX52.js +0 -121
- package/dist/CheckboxFieldEditor-K4T6QX52.js.map +0 -1
- package/dist/DateFieldEditor-JFJFAVOH.js +0 -187
- package/dist/DateFieldEditor-JFJFAVOH.js.map +0 -1
- package/dist/EmailFieldEditor-ZZ4VSKKB.js +0 -138
- package/dist/EmailFieldEditor-ZZ4VSKKB.js.map +0 -1
- package/dist/NumberFieldEditor-UISAYR6Z.js +0 -175
- package/dist/NumberFieldEditor-UISAYR6Z.js.map +0 -1
- package/dist/RadioFieldEditor-6UQFH4WT.js +0 -165
- package/dist/RadioFieldEditor-6UQFH4WT.js.map +0 -1
- package/dist/SelectFieldEditor-PSO4KHV4.js +0 -213
- package/dist/SelectFieldEditor-PSO4KHV4.js.map +0 -1
- package/dist/TextFieldEditor-5EU64EA5.js +0 -187
- package/dist/TextFieldEditor-5EU64EA5.js.map +0 -1
- package/dist/TextareaFieldEditor-773G3LNM.js +0 -190
- package/dist/TextareaFieldEditor-773G3LNM.js.map +0 -1
- package/dist/admin/index.css +0 -934
- package/dist/admin/index.css.map +0 -1
- package/dist/chunk-ABNZFTQK.js +0 -586
- package/dist/chunk-ABNZFTQK.js.map +0 -1
- package/dist/chunk-XTCEPJ7B.js +0 -256
- package/dist/chunk-XTCEPJ7B.js.map +0 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -9
- package/dist/components/index.js.map +0 -1
- package/dist/styles/form-builder.css +0 -1150
- package/dist/styles/submissions-filter.css +0 -75
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { ComponentType } from 'react';
|
|
2
1
|
import { RequestContext, CollectionConfig, FieldDefinition } from 'nextly';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Form Builder Plugin Types
|
|
@@ -47,6 +47,13 @@ interface FormEmailNotification {
|
|
|
47
47
|
variables: Record<string, unknown>;
|
|
48
48
|
/** Email provider id; undefined = system default. */
|
|
49
49
|
providerId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Resolved sender address (rule's senderEmail, else the plugin's
|
|
52
|
+
* defaultFrom); undefined = template/provider default.
|
|
53
|
+
*/
|
|
54
|
+
from?: string;
|
|
55
|
+
/** Resolved Reply-To address, if the rule configured one. */
|
|
56
|
+
replyTo?: string;
|
|
50
57
|
/** CC addresses, if any. */
|
|
51
58
|
cc?: string[];
|
|
52
59
|
/** BCC addresses, if any. */
|
|
@@ -55,19 +62,25 @@ interface FormEmailNotification {
|
|
|
55
62
|
notificationId?: string;
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
|
-
* A single email notification
|
|
59
|
-
* Matches the shape saved by the form builder admin UI.
|
|
65
|
+
* A single email notification rule stored on a form.
|
|
66
|
+
* Matches the shape saved by the form builder admin UI. This is the ONE
|
|
67
|
+
* notification rule type — the admin context re-exports it rather than
|
|
68
|
+
* keeping a parallel copy.
|
|
60
69
|
*/
|
|
61
|
-
interface
|
|
70
|
+
interface FormNotification {
|
|
62
71
|
/** Unique ID for this notification */
|
|
63
72
|
id: string;
|
|
64
|
-
/** Display name for this
|
|
73
|
+
/** Display name for this notification rule */
|
|
65
74
|
name: string;
|
|
66
75
|
/** Whether this notification is active */
|
|
67
76
|
enabled: boolean;
|
|
68
77
|
/** ID of the email provider to use; undefined = system default */
|
|
69
78
|
providerId?: string;
|
|
70
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Sender email override. Resolution order at send time:
|
|
81
|
+
* this value, else the plugin's `notifications.defaultFrom` option, else
|
|
82
|
+
* the template/provider default.
|
|
83
|
+
*/
|
|
71
84
|
senderEmail?: string;
|
|
72
85
|
/** How the recipient address is determined */
|
|
73
86
|
recipientType: "static" | "field";
|
|
@@ -77,9 +90,26 @@ interface FormNotificationItem {
|
|
|
77
90
|
cc: string[];
|
|
78
91
|
/** BCC email addresses */
|
|
79
92
|
bcc: string[];
|
|
93
|
+
/**
|
|
94
|
+
* Reply-To address: a `{{fieldName}}` reference to one of the form's
|
|
95
|
+
* email fields (resolved against the submission) or a literal address.
|
|
96
|
+
*/
|
|
97
|
+
replyTo?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Optional send condition evaluated against the submitted data. When set
|
|
100
|
+
* and unmet, the rule is skipped for that submission. A single condition
|
|
101
|
+
* covers the common case; the JSON storage leaves room to grow into a
|
|
102
|
+
* multi-condition tree without a migration.
|
|
103
|
+
*/
|
|
104
|
+
condition?: ConditionalLogicCondition;
|
|
80
105
|
/** Slug of the email template to use */
|
|
81
106
|
templateSlug?: string;
|
|
82
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Use {@link FormNotification}. Alias kept so existing imports
|
|
110
|
+
* keep compiling during the alpha; will be removed before a stable release.
|
|
111
|
+
*/
|
|
112
|
+
type FormNotificationItem = FormNotification;
|
|
83
113
|
/**
|
|
84
114
|
* Form document structure (stored in database).
|
|
85
115
|
*/
|
|
@@ -89,7 +119,7 @@ interface FormDocument {
|
|
|
89
119
|
name: string;
|
|
90
120
|
fields: FormField[];
|
|
91
121
|
settings: FormSettings;
|
|
92
|
-
notifications:
|
|
122
|
+
notifications: FormNotification[];
|
|
93
123
|
webhooks?: WebhookConfig[];
|
|
94
124
|
status: "draft" | "published" | "closed";
|
|
95
125
|
createdAt: Date;
|
|
@@ -650,11 +680,19 @@ interface FormSettings {
|
|
|
650
680
|
/**
|
|
651
681
|
* Confirmation type after successful submission.
|
|
652
682
|
* - "message": Display a success message
|
|
653
|
-
* - "redirect": Redirect to a URL
|
|
683
|
+
* - "redirect": Redirect to a URL
|
|
684
|
+
* - "relationship": Redirect to a linked document (requires
|
|
685
|
+
* `redirectRelationships` in the plugin options)
|
|
654
686
|
*
|
|
655
687
|
* @default "message"
|
|
656
688
|
*/
|
|
657
|
-
confirmationType?: "message" | "redirect";
|
|
689
|
+
confirmationType?: "message" | "redirect" | "relationship";
|
|
690
|
+
/**
|
|
691
|
+
* Linked document for relationship-based redirects (the collection's
|
|
692
|
+
* `redirectPage` relationship value). Preserved verbatim — resolution
|
|
693
|
+
* happens where the relationship is rendered.
|
|
694
|
+
*/
|
|
695
|
+
redirectPage?: unknown;
|
|
658
696
|
/** Success message (supports HTML) - used when confirmationType is "message" */
|
|
659
697
|
successMessage?: string;
|
|
660
698
|
/** Redirect URL after successful submission - used when confirmationType is "redirect" */
|
|
@@ -667,13 +705,20 @@ interface FormSettings {
|
|
|
667
705
|
relationTo: string;
|
|
668
706
|
value: string;
|
|
669
707
|
};
|
|
670
|
-
/** Allow multiple submissions from same
|
|
708
|
+
/** Allow multiple submissions from same IP (default true) */
|
|
671
709
|
allowMultipleSubmissions?: boolean;
|
|
672
|
-
/**
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
710
|
+
/**
|
|
711
|
+
* Per-form honeypot override. Unset inherits the plugin's
|
|
712
|
+
* `spamProtection.honeypot`; the form wins where set.
|
|
713
|
+
*/
|
|
714
|
+
honeypotEnabled?: boolean;
|
|
715
|
+
/**
|
|
716
|
+
* Per-form reCAPTCHA override. Unset inherits the plugin's
|
|
717
|
+
* `spamProtection.recaptcha.enabled`; the form wins where set.
|
|
718
|
+
*/
|
|
719
|
+
captchaEnabled?: boolean;
|
|
720
|
+
/** reCAPTCHA site key (client-facing) when captcha is enabled per-form */
|
|
721
|
+
captchaSiteKey?: string;
|
|
677
722
|
}
|
|
678
723
|
/**
|
|
679
724
|
* Email notification configuration for a form.
|
|
@@ -932,81 +977,4 @@ declare function isCheckboxFormField(field: FormField): field is CheckboxFormFie
|
|
|
932
977
|
*/
|
|
933
978
|
declare function isFileFormField(field: FormField): field is FileFormField;
|
|
934
979
|
|
|
935
|
-
|
|
936
|
-
* Props for the SubmissionList component.
|
|
937
|
-
*/
|
|
938
|
-
interface SubmissionListProps {
|
|
939
|
-
/** Form document containing field definitions */
|
|
940
|
-
form: FormDocument;
|
|
941
|
-
/** Array of submission documents to display */
|
|
942
|
-
submissions: SubmissionDocument[];
|
|
943
|
-
/** Whether data is currently loading */
|
|
944
|
-
isLoading?: boolean;
|
|
945
|
-
/** Callback when submission status is changed */
|
|
946
|
-
onStatusChange?: (id: string, status: "new" | "read" | "archived") => Promise<void>;
|
|
947
|
-
/** Callback when submission is deleted */
|
|
948
|
-
onDelete?: (id: string) => Promise<void>;
|
|
949
|
-
/** Callback when bulk delete is triggered */
|
|
950
|
-
onBulkDelete?: (ids: string[]) => Promise<void>;
|
|
951
|
-
/** Callback when bulk status change is triggered */
|
|
952
|
-
onBulkStatusChange?: (ids: string[], status: "new" | "read" | "archived") => Promise<void>;
|
|
953
|
-
/** Callback when export is triggered */
|
|
954
|
-
onExport?: (format: "csv" | "json") => void;
|
|
955
|
-
/** Callback when a submission is clicked for detail view */
|
|
956
|
-
onViewDetail?: (submission: SubmissionDocument) => void;
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Submission List Component
|
|
960
|
-
*
|
|
961
|
-
* Displays form submissions in a table with filtering, selection, and actions.
|
|
962
|
-
*
|
|
963
|
-
* @example
|
|
964
|
-
* ```tsx
|
|
965
|
-
* <SubmissionList
|
|
966
|
-
* form={form}
|
|
967
|
-
* submissions={submissions}
|
|
968
|
-
* onStatusChange={handleStatusChange}
|
|
969
|
-
* onDelete={handleDelete}
|
|
970
|
-
* onExport={handleExport}
|
|
971
|
-
* onViewDetail={handleViewDetail}
|
|
972
|
-
* />
|
|
973
|
-
* ```
|
|
974
|
-
*/
|
|
975
|
-
declare function SubmissionList({ form, submissions, isLoading, onStatusChange, onDelete, onBulkDelete, onBulkStatusChange, onExport, onViewDetail, }: SubmissionListProps): React.ReactElement;
|
|
976
|
-
|
|
977
|
-
/**
|
|
978
|
-
* Props for the SubmissionDetail component.
|
|
979
|
-
*/
|
|
980
|
-
interface SubmissionDetailProps {
|
|
981
|
-
/** Form document containing field definitions */
|
|
982
|
-
form: FormDocument;
|
|
983
|
-
/** Submission document to display */
|
|
984
|
-
submission: SubmissionDocument;
|
|
985
|
-
/** Callback when status is changed */
|
|
986
|
-
onStatusChange?: (status: "new" | "read" | "archived") => Promise<void>;
|
|
987
|
-
/** Callback when notes are updated */
|
|
988
|
-
onNotesUpdate?: (notes: string) => Promise<void>;
|
|
989
|
-
/** Callback when back button is clicked */
|
|
990
|
-
onBack?: () => void;
|
|
991
|
-
/** Callback when delete is triggered */
|
|
992
|
-
onDelete?: () => Promise<void>;
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* Submission Detail Component
|
|
996
|
-
*
|
|
997
|
-
* Displays full submission data with status management and notes.
|
|
998
|
-
*
|
|
999
|
-
* @example
|
|
1000
|
-
* ```tsx
|
|
1001
|
-
* <SubmissionDetail
|
|
1002
|
-
* form={form}
|
|
1003
|
-
* submission={submission}
|
|
1004
|
-
* onStatusChange={handleStatusChange}
|
|
1005
|
-
* onNotesUpdate={handleNotesUpdate}
|
|
1006
|
-
* onBack={handleBack}
|
|
1007
|
-
* />
|
|
1008
|
-
* ```
|
|
1009
|
-
*/
|
|
1010
|
-
declare function SubmissionDetail({ form, submission, onStatusChange, onNotesUpdate, onBack, onDelete, }: SubmissionDetailProps): React.ReactElement;
|
|
1011
|
-
|
|
1012
|
-
export { isFormFieldType as A, type BaseFormField as B, type CheckboxFormField as C, type DateFormField as D, type EmailFormField as E, type FormBuilderPluginOptions as F, isSelectFormField as G, type HiddenFormField as H, isTextFormField as I, SubmissionDetail as J, SubmissionList as K, type NumberFormField as N, type PhoneFormField as P, type ResolvedFormBuilderConfig as R, type SelectFormField as S, type TextFormField as T, type UrlFormField as U, type ValidationRules as V, type WebhookEvent as W, type FormConfig as a, type FormSettings as b, type FormNotifications as c, type FileFormField as d, type RadioFormField as e, type TextareaFormField as f, type TimeFormField as g, type ConditionalLogic as h, type FormField as i, type SubmissionDocument as j, type FormDocument as k, type ConditionalLogicCondition as l, type EmailConfig as m, type FieldBlockConfig as n, type FormAccess as o, type FormFieldType as p, type FormHookContext as q, type FormHooks as r, type FormSubmission as s, type SubmissionDetailProps as t, type SubmissionListProps as u, type WebhookConfig as v, isCheckboxFormField as w, isEmailFormField as x, isFileFormField as y, isFormField as z };
|
|
980
|
+
export { isFormFieldType as A, type BaseFormField as B, type CheckboxFormField as C, type DateFormField as D, type EmailFormField as E, type FormBuilderPluginOptions as F, isSelectFormField as G, type HiddenFormField as H, isTextFormField as I, type NumberFormField as N, type PhoneFormField as P, type ResolvedFormBuilderConfig as R, type SelectFormField as S, type TextFormField as T, type UrlFormField as U, type ValidationRules as V, type WebhookEvent as W, type FormConfig as a, type FormSettings as b, type FormNotifications as c, type FileFormField as d, type RadioFormField as e, type TextareaFormField as f, type TimeFormField as g, type ConditionalLogic as h, type FormField as i, type SubmissionDocument as j, type FormDocument as k, type ConditionalLogicCondition as l, type EmailConfig as m, type FieldBlockConfig as n, type FormAccess as o, type FormFieldType as p, type FormHookContext as q, type FormHooks as r, type FormNotification as s, type FormNotificationItem as t, type FormSubmission as u, type WebhookConfig as v, isCheckboxFormField as w, isEmailFormField as x, isFileFormField as y, isFormField as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextlyhq/plugin-form-builder",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.35",
|
|
4
4
|
"description": "Visual form builder plugin for Nextly with Code-First and Schema Builder support",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,54 +10,49 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js"
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
14
15
|
},
|
|
15
16
|
"./admin": {
|
|
16
17
|
"types": "./dist/admin/index.d.ts",
|
|
17
|
-
"import": "./dist/admin/index.js"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"types": "./dist/components/index.d.ts",
|
|
21
|
-
"import": "./dist/components/index.js"
|
|
22
|
-
},
|
|
23
|
-
"./styles/builder.css": "./dist/styles/form-builder.css",
|
|
24
|
-
"./styles/submissions-filter.css": "./dist/styles/submissions-filter.css"
|
|
18
|
+
"import": "./dist/admin/index.js",
|
|
19
|
+
"default": "./dist/admin/index.js"
|
|
20
|
+
}
|
|
25
21
|
},
|
|
26
22
|
"files": [
|
|
27
23
|
"dist",
|
|
28
24
|
"README.md"
|
|
29
25
|
],
|
|
30
26
|
"dependencies": {
|
|
31
|
-
"@dnd-kit/core": "^6.1
|
|
32
|
-
"@dnd-kit/sortable": "^
|
|
27
|
+
"@dnd-kit/core": "^6.3.1",
|
|
28
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
33
29
|
"@dnd-kit/utilities": "^3.2.2",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@hookform/resolvers": "^3.3.4"
|
|
30
|
+
"react-hook-form": "^7.66.0",
|
|
31
|
+
"zod": "^4.1.12"
|
|
37
32
|
},
|
|
38
33
|
"peerDependencies": {
|
|
39
|
-
"@nextlyhq/admin": "0.0.2-alpha.
|
|
40
|
-
"
|
|
41
|
-
"@nextlyhq/ui": "0.0.2-alpha.33",
|
|
34
|
+
"@nextlyhq/admin": "0.0.2-alpha.35",
|
|
35
|
+
"@nextlyhq/ui": "0.0.2-alpha.35",
|
|
42
36
|
"@tanstack/react-query": ">=5.0.0",
|
|
43
37
|
"lucide-react": ">=0.400.0",
|
|
44
|
-
"react": "^18.0.0 || ^19.0.0",
|
|
45
38
|
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
46
|
-
"
|
|
39
|
+
"nextly": "0.0.2-alpha.35",
|
|
40
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
41
|
+
"@nextlyhq/plugin-sdk": "0.0.2-alpha.35"
|
|
47
42
|
},
|
|
48
43
|
"devDependencies": {
|
|
49
|
-
"@tanstack/react-query": "^5.
|
|
50
|
-
"@types/node": "^20.
|
|
44
|
+
"@tanstack/react-query": "^5.62.0",
|
|
45
|
+
"@types/node": "^20.19.17",
|
|
51
46
|
"@types/react": "19.2.0",
|
|
52
|
-
"lucide-react": "^0.
|
|
53
|
-
"tsup": "^8.
|
|
54
|
-
"typescript": "^5.3
|
|
47
|
+
"lucide-react": "^0.544.0",
|
|
48
|
+
"tsup": "^8.5.0",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
55
50
|
"vitest": "^4.0.8",
|
|
56
|
-
"@nextlyhq/
|
|
57
|
-
"@nextlyhq/
|
|
58
|
-
"
|
|
59
|
-
"@nextlyhq/
|
|
60
|
-
"
|
|
51
|
+
"@nextlyhq/admin": "0.0.2-alpha.35",
|
|
52
|
+
"@nextlyhq/plugin-sdk": "0.0.2-alpha.35",
|
|
53
|
+
"@nextlyhq/tsconfig": "0.0.2-alpha.35",
|
|
54
|
+
"@nextlyhq/ui": "0.0.2-alpha.35",
|
|
55
|
+
"nextly": "0.0.2-alpha.35"
|
|
61
56
|
},
|
|
62
57
|
"engines": {
|
|
63
58
|
"node": ">=20.0.0"
|
|
@@ -89,7 +84,7 @@
|
|
|
89
84
|
"author": "Nextly <contact@nextlyhq.com> (https://nextlyhq.com)",
|
|
90
85
|
"scripts": {
|
|
91
86
|
"build": "tsup",
|
|
92
|
-
"dev": "tsup src/index.ts src/admin/index.ts
|
|
87
|
+
"dev": "tsup src/index.ts src/admin/index.ts --format esm --dts --watch",
|
|
93
88
|
"check-types": "tsc --noEmit",
|
|
94
89
|
"lint": "eslint . --max-warnings 0",
|
|
95
90
|
"lint:fix": "eslint . --fix",
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/admin/fields/CheckboxFieldEditor.tsx
|
|
4
|
-
import { Input } from "@nextlyhq/ui";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
function CheckboxFieldEditor({
|
|
7
|
-
field,
|
|
8
|
-
onUpdate
|
|
9
|
-
}) {
|
|
10
|
-
const updateValidation = (key, value) => {
|
|
11
|
-
onUpdate({
|
|
12
|
-
validation: {
|
|
13
|
-
...field.validation,
|
|
14
|
-
[key]: value
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
return /* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor", children: [
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__section", children: [
|
|
20
|
-
/* @__PURE__ */ jsx("h4", { className: "checkbox-field-editor__section-title", children: "General" }),
|
|
21
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__field", children: [
|
|
22
|
-
/* @__PURE__ */ jsx("label", { className: "checkbox-field-editor__label", htmlFor: "field-label", children: "Label" }),
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
Input,
|
|
25
|
-
{
|
|
26
|
-
id: "field-label",
|
|
27
|
-
type: "text",
|
|
28
|
-
value: field.label || "",
|
|
29
|
-
onChange: (e) => onUpdate({ label: e.target.value }),
|
|
30
|
-
placeholder: "I agree to the terms and conditions"
|
|
31
|
-
}
|
|
32
|
-
),
|
|
33
|
-
/* @__PURE__ */ jsx("p", { className: "checkbox-field-editor__hint", children: "Text displayed next to the checkbox" })
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__field", children: [
|
|
36
|
-
/* @__PURE__ */ jsx("label", { className: "checkbox-field-editor__label", htmlFor: "field-name", children: "Field Name" }),
|
|
37
|
-
/* @__PURE__ */ jsx(
|
|
38
|
-
Input,
|
|
39
|
-
{
|
|
40
|
-
id: "field-name",
|
|
41
|
-
type: "text",
|
|
42
|
-
value: field.name || "",
|
|
43
|
-
onChange: (e) => onUpdate({
|
|
44
|
-
name: e.target.value.replace(/\s+/g, "_").replace(/[^a-zA-Z0-9_]/g, "").toLowerCase()
|
|
45
|
-
}),
|
|
46
|
-
placeholder: "field_name",
|
|
47
|
-
className: "checkbox-field-editor__input--mono"
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
/* @__PURE__ */ jsx("p", { className: "checkbox-field-editor__hint", children: "Used as the key in submission data. Only letters, numbers, and underscores." })
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__field", children: [
|
|
53
|
-
/* @__PURE__ */ jsx("label", { className: "checkbox-field-editor__label", htmlFor: "field-help", children: "Help Text" }),
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
55
|
-
Input,
|
|
56
|
-
{
|
|
57
|
-
id: "field-help",
|
|
58
|
-
type: "text",
|
|
59
|
-
value: field.helpText || "",
|
|
60
|
-
onChange: (e) => onUpdate({ helpText: e.target.value }),
|
|
61
|
-
placeholder: "Additional guidance for users"
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
/* @__PURE__ */ jsx("p", { className: "checkbox-field-editor__hint", children: "Displayed below the field" })
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__field checkbox-field-editor__field--inline", children: [
|
|
67
|
-
/* @__PURE__ */ jsxs("label", { className: "checkbox-field-editor__checkbox-label", children: [
|
|
68
|
-
/* @__PURE__ */ jsx(
|
|
69
|
-
"input",
|
|
70
|
-
{
|
|
71
|
-
type: "checkbox",
|
|
72
|
-
checked: field.defaultValue || false,
|
|
73
|
-
onChange: (e) => onUpdate({ defaultValue: e.target.checked }),
|
|
74
|
-
className: "checkbox-field-editor__checkbox"
|
|
75
|
-
}
|
|
76
|
-
),
|
|
77
|
-
/* @__PURE__ */ jsx("span", { children: "Checked by default" })
|
|
78
|
-
] }),
|
|
79
|
-
/* @__PURE__ */ jsx("p", { className: "checkbox-field-editor__hint", children: "Whether the checkbox is pre-checked when the form loads" })
|
|
80
|
-
] }),
|
|
81
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__field checkbox-field-editor__field--inline", children: [
|
|
82
|
-
/* @__PURE__ */ jsxs("label", { className: "checkbox-field-editor__checkbox-label", children: [
|
|
83
|
-
/* @__PURE__ */ jsx(
|
|
84
|
-
"input",
|
|
85
|
-
{
|
|
86
|
-
type: "checkbox",
|
|
87
|
-
checked: field.required || false,
|
|
88
|
-
onChange: (e) => onUpdate({ required: e.target.checked }),
|
|
89
|
-
className: "checkbox-field-editor__checkbox"
|
|
90
|
-
}
|
|
91
|
-
),
|
|
92
|
-
/* @__PURE__ */ jsx("span", { children: "Required field" })
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ jsx("p", { className: "checkbox-field-editor__hint", children: "User must check this box to submit the form (useful for terms acceptance)" })
|
|
95
|
-
] })
|
|
96
|
-
] }),
|
|
97
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__section", children: [
|
|
98
|
-
/* @__PURE__ */ jsx("h4", { className: "checkbox-field-editor__section-title", children: "Validation" }),
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: "checkbox-field-editor__field", children: [
|
|
100
|
-
/* @__PURE__ */ jsx("label", { className: "checkbox-field-editor__label", htmlFor: "field-error", children: "Error Message" }),
|
|
101
|
-
/* @__PURE__ */ jsx(
|
|
102
|
-
Input,
|
|
103
|
-
{
|
|
104
|
-
id: "field-error",
|
|
105
|
-
type: "text",
|
|
106
|
-
value: field.validation?.errorMessage || "",
|
|
107
|
-
onChange: (e) => updateValidation("errorMessage", e.target.value || void 0),
|
|
108
|
-
placeholder: "You must accept the terms to continue"
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
/* @__PURE__ */ jsx("p", { className: "checkbox-field-editor__hint", children: "Custom message shown when required checkbox is not checked" })
|
|
112
|
-
] })
|
|
113
|
-
] })
|
|
114
|
-
] });
|
|
115
|
-
}
|
|
116
|
-
var CheckboxFieldEditor_default = CheckboxFieldEditor;
|
|
117
|
-
export {
|
|
118
|
-
CheckboxFieldEditor,
|
|
119
|
-
CheckboxFieldEditor_default as default
|
|
120
|
-
};
|
|
121
|
-
//# sourceMappingURL=CheckboxFieldEditor-K4T6QX52.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/admin/fields/CheckboxFieldEditor.tsx"],"sourcesContent":["/**\n * Checkbox Field Editor\n *\n * Editor component for configuring checkbox field properties.\n * Includes general settings (label, name, help text, required) and\n * default value configuration.\n *\n * Checkbox fields are typically used for:\n * - Terms and conditions acceptance\n * - Newsletter opt-in\n * - Boolean yes/no questions\n *\n * @module admin/fields/CheckboxFieldEditor\n * @since 0.1.0\n */\n\n\"use client\";\n\nimport { Input } from \"@nextlyhq/ui\";\n\nimport type { CheckboxFormField } from \"../../types\";\n\nimport type { FieldEditorProps } from \"./index\";\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\n/**\n * CheckboxFieldEditor - Configure checkbox field properties\n *\n * Provides configuration options for:\n * - Label: Text shown next to the checkbox (e.g., \"I agree to the terms\")\n * - Field Name: Key used in submission data (auto-formatted)\n * - Help Text: Additional guidance shown below the field\n * - Required: Whether the checkbox must be checked (for consent forms)\n * - Default Value: Whether the checkbox is checked by default\n * - Validation: error message\n *\n * @example\n * ```tsx\n * <CheckboxFieldEditor\n * field={checkboxField}\n * allFields={formFields}\n * onUpdate={(updates) => handleUpdate(updates)}\n * />\n * ```\n */\nexport function CheckboxFieldEditor({\n field,\n onUpdate,\n}: FieldEditorProps<CheckboxFormField>) {\n // Helper to update validation properties\n const updateValidation = (key: string, value: unknown) => {\n onUpdate({\n validation: {\n ...field.validation,\n [key]: value,\n },\n });\n };\n\n return (\n <div className=\"checkbox-field-editor\">\n {/* General Settings Section */}\n <div className=\"checkbox-field-editor__section\">\n <h4 className=\"checkbox-field-editor__section-title\">General</h4>\n\n {/* Label */}\n <div className=\"checkbox-field-editor__field\">\n <label className=\"checkbox-field-editor__label\" htmlFor=\"field-label\">\n Label\n </label>\n <Input\n id=\"field-label\"\n type=\"text\"\n value={field.label || \"\"}\n onChange={e => onUpdate({ label: e.target.value })}\n placeholder=\"I agree to the terms and conditions\"\n />\n <p className=\"checkbox-field-editor__hint\">\n Text displayed next to the checkbox\n </p>\n </div>\n\n {/* Field Name */}\n <div className=\"checkbox-field-editor__field\">\n <label className=\"checkbox-field-editor__label\" htmlFor=\"field-name\">\n Field Name\n </label>\n <Input\n id=\"field-name\"\n type=\"text\"\n value={field.name || \"\"}\n onChange={e =>\n onUpdate({\n name: e.target.value\n .replace(/\\s+/g, \"_\")\n .replace(/[^a-zA-Z0-9_]/g, \"\")\n .toLowerCase(),\n })\n }\n placeholder=\"field_name\"\n className=\"checkbox-field-editor__input--mono\"\n />\n <p className=\"checkbox-field-editor__hint\">\n Used as the key in submission data. Only letters, numbers, and\n underscores.\n </p>\n </div>\n\n {/* Help Text */}\n <div className=\"checkbox-field-editor__field\">\n <label className=\"checkbox-field-editor__label\" htmlFor=\"field-help\">\n Help Text\n </label>\n <Input\n id=\"field-help\"\n type=\"text\"\n value={field.helpText || \"\"}\n onChange={e => onUpdate({ helpText: e.target.value })}\n placeholder=\"Additional guidance for users\"\n />\n <p className=\"checkbox-field-editor__hint\">\n Displayed below the field\n </p>\n </div>\n\n {/* Default Value */}\n <div className=\"checkbox-field-editor__field checkbox-field-editor__field--inline\">\n <label className=\"checkbox-field-editor__checkbox-label\">\n <input\n type=\"checkbox\"\n checked={field.defaultValue || false}\n onChange={e => onUpdate({ defaultValue: e.target.checked })}\n className=\"checkbox-field-editor__checkbox\"\n />\n <span>Checked by default</span>\n </label>\n <p className=\"checkbox-field-editor__hint\">\n Whether the checkbox is pre-checked when the form loads\n </p>\n </div>\n\n {/* Required */}\n <div className=\"checkbox-field-editor__field checkbox-field-editor__field--inline\">\n <label className=\"checkbox-field-editor__checkbox-label\">\n <input\n type=\"checkbox\"\n checked={field.required || false}\n onChange={e => onUpdate({ required: e.target.checked })}\n className=\"checkbox-field-editor__checkbox\"\n />\n <span>Required field</span>\n </label>\n <p className=\"checkbox-field-editor__hint\">\n User must check this box to submit the form (useful for terms\n acceptance)\n </p>\n </div>\n </div>\n\n {/* Validation Section */}\n <div className=\"checkbox-field-editor__section\">\n <h4 className=\"checkbox-field-editor__section-title\">Validation</h4>\n\n {/* Error Message */}\n <div className=\"checkbox-field-editor__field\">\n <label className=\"checkbox-field-editor__label\" htmlFor=\"field-error\">\n Error Message\n </label>\n <Input\n id=\"field-error\"\n type=\"text\"\n value={field.validation?.errorMessage || \"\"}\n onChange={e =>\n updateValidation(\"errorMessage\", e.target.value || undefined)\n }\n placeholder=\"You must accept the terms to continue\"\n />\n <p className=\"checkbox-field-editor__hint\">\n Custom message shown when required checkbox is not checked\n </p>\n </div>\n </div>\n </div>\n );\n}\n\nexport default CheckboxFieldEditor;\n"],"mappings":"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","names":[]}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/admin/fields/DateFieldEditor.tsx
|
|
4
|
-
import { Input } from "@nextlyhq/ui";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
function DateFieldEditor({
|
|
7
|
-
field,
|
|
8
|
-
onUpdate
|
|
9
|
-
}) {
|
|
10
|
-
const updateValidation = (key, value) => {
|
|
11
|
-
onUpdate({
|
|
12
|
-
validation: {
|
|
13
|
-
...field.validation,
|
|
14
|
-
[key]: value
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
return /* @__PURE__ */ jsxs("div", { className: "date-field-editor", children: [
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__section", children: [
|
|
20
|
-
/* @__PURE__ */ jsx("h4", { className: "date-field-editor__section-title", children: "General" }),
|
|
21
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field", children: [
|
|
22
|
-
/* @__PURE__ */ jsx("label", { className: "date-field-editor__label", htmlFor: "field-label", children: "Label" }),
|
|
23
|
-
/* @__PURE__ */ jsx(
|
|
24
|
-
Input,
|
|
25
|
-
{
|
|
26
|
-
id: "field-label",
|
|
27
|
-
type: "text",
|
|
28
|
-
value: field.label || "",
|
|
29
|
-
onChange: (e) => onUpdate({ label: e.target.value }),
|
|
30
|
-
placeholder: "Enter field label"
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
] }),
|
|
34
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field", children: [
|
|
35
|
-
/* @__PURE__ */ jsx("label", { className: "date-field-editor__label", htmlFor: "field-name", children: "Field Name" }),
|
|
36
|
-
/* @__PURE__ */ jsx(
|
|
37
|
-
Input,
|
|
38
|
-
{
|
|
39
|
-
id: "field-name",
|
|
40
|
-
type: "text",
|
|
41
|
-
value: field.name || "",
|
|
42
|
-
onChange: (e) => onUpdate({
|
|
43
|
-
name: e.target.value.replace(/\s+/g, "_").replace(/[^a-zA-Z0-9_]/g, "").toLowerCase()
|
|
44
|
-
}),
|
|
45
|
-
placeholder: "field_name",
|
|
46
|
-
className: "date-field-editor__input--mono"
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
/* @__PURE__ */ jsx("p", { className: "date-field-editor__hint", children: "Used as the key in submission data. Only letters, numbers, and underscores." })
|
|
50
|
-
] }),
|
|
51
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field", children: [
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
53
|
-
"label",
|
|
54
|
-
{
|
|
55
|
-
className: "date-field-editor__label",
|
|
56
|
-
htmlFor: "field-placeholder",
|
|
57
|
-
children: "Placeholder"
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ jsx(
|
|
61
|
-
Input,
|
|
62
|
-
{
|
|
63
|
-
id: "field-placeholder",
|
|
64
|
-
type: "text",
|
|
65
|
-
value: field.placeholder || "",
|
|
66
|
-
onChange: (e) => onUpdate({ placeholder: e.target.value }),
|
|
67
|
-
placeholder: "Select a date..."
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
] }),
|
|
71
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field", children: [
|
|
72
|
-
/* @__PURE__ */ jsx("label", { className: "date-field-editor__label", htmlFor: "field-help", children: "Help Text" }),
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
Input,
|
|
75
|
-
{
|
|
76
|
-
id: "field-help",
|
|
77
|
-
type: "text",
|
|
78
|
-
value: field.helpText || "",
|
|
79
|
-
onChange: (e) => onUpdate({ helpText: e.target.value }),
|
|
80
|
-
placeholder: "Additional guidance for users"
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
/* @__PURE__ */ jsx("p", { className: "date-field-editor__hint", children: "Displayed below the field" })
|
|
84
|
-
] }),
|
|
85
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field", children: [
|
|
86
|
-
/* @__PURE__ */ jsx(
|
|
87
|
-
"label",
|
|
88
|
-
{
|
|
89
|
-
className: "date-field-editor__label",
|
|
90
|
-
htmlFor: "field-default-value",
|
|
91
|
-
children: "Default Value"
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
/* @__PURE__ */ jsx(
|
|
95
|
-
"input",
|
|
96
|
-
{
|
|
97
|
-
id: "field-default-value",
|
|
98
|
-
type: "date",
|
|
99
|
-
value: field.defaultValue || "",
|
|
100
|
-
onChange: (e) => onUpdate({ defaultValue: e.target.value || void 0 }),
|
|
101
|
-
className: "date-field-editor__date-input"
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
/* @__PURE__ */ jsx("p", { className: "date-field-editor__hint", children: "Pre-selected date when the form loads" })
|
|
105
|
-
] }),
|
|
106
|
-
/* @__PURE__ */ jsx("div", { className: "date-field-editor__field date-field-editor__field--inline", children: /* @__PURE__ */ jsxs("label", { className: "date-field-editor__checkbox-label", children: [
|
|
107
|
-
/* @__PURE__ */ jsx(
|
|
108
|
-
"input",
|
|
109
|
-
{
|
|
110
|
-
type: "checkbox",
|
|
111
|
-
checked: field.required || false,
|
|
112
|
-
onChange: (e) => onUpdate({ required: e.target.checked }),
|
|
113
|
-
className: "date-field-editor__checkbox"
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
/* @__PURE__ */ jsx("span", { children: "Required field" })
|
|
117
|
-
] }) })
|
|
118
|
-
] }),
|
|
119
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__section", children: [
|
|
120
|
-
/* @__PURE__ */ jsx("h4", { className: "date-field-editor__section-title", children: "Validation" }),
|
|
121
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field-row", children: [
|
|
122
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field date-field-editor__field--half", children: [
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
"label",
|
|
125
|
-
{
|
|
126
|
-
className: "date-field-editor__label",
|
|
127
|
-
htmlFor: "field-min-date",
|
|
128
|
-
children: "Min Date"
|
|
129
|
-
}
|
|
130
|
-
),
|
|
131
|
-
/* @__PURE__ */ jsx(
|
|
132
|
-
"input",
|
|
133
|
-
{
|
|
134
|
-
id: "field-min-date",
|
|
135
|
-
type: "date",
|
|
136
|
-
value: field.min || "",
|
|
137
|
-
onChange: (e) => onUpdate({ min: e.target.value || void 0 }),
|
|
138
|
-
className: "date-field-editor__date-input"
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
/* @__PURE__ */ jsx("p", { className: "date-field-editor__hint", children: "Earliest allowed date" })
|
|
142
|
-
] }),
|
|
143
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field date-field-editor__field--half", children: [
|
|
144
|
-
/* @__PURE__ */ jsx(
|
|
145
|
-
"label",
|
|
146
|
-
{
|
|
147
|
-
className: "date-field-editor__label",
|
|
148
|
-
htmlFor: "field-max-date",
|
|
149
|
-
children: "Max Date"
|
|
150
|
-
}
|
|
151
|
-
),
|
|
152
|
-
/* @__PURE__ */ jsx(
|
|
153
|
-
"input",
|
|
154
|
-
{
|
|
155
|
-
id: "field-max-date",
|
|
156
|
-
type: "date",
|
|
157
|
-
value: field.max || "",
|
|
158
|
-
onChange: (e) => onUpdate({ max: e.target.value || void 0 }),
|
|
159
|
-
className: "date-field-editor__date-input"
|
|
160
|
-
}
|
|
161
|
-
),
|
|
162
|
-
/* @__PURE__ */ jsx("p", { className: "date-field-editor__hint", children: "Latest allowed date" })
|
|
163
|
-
] })
|
|
164
|
-
] }),
|
|
165
|
-
/* @__PURE__ */ jsxs("div", { className: "date-field-editor__field", children: [
|
|
166
|
-
/* @__PURE__ */ jsx("label", { className: "date-field-editor__label", htmlFor: "field-error", children: "Error Message" }),
|
|
167
|
-
/* @__PURE__ */ jsx(
|
|
168
|
-
Input,
|
|
169
|
-
{
|
|
170
|
-
id: "field-error",
|
|
171
|
-
type: "text",
|
|
172
|
-
value: field.validation?.errorMessage || "",
|
|
173
|
-
onChange: (e) => updateValidation("errorMessage", e.target.value || void 0),
|
|
174
|
-
placeholder: "Please select a valid date"
|
|
175
|
-
}
|
|
176
|
-
),
|
|
177
|
-
/* @__PURE__ */ jsx("p", { className: "date-field-editor__hint", children: "Custom message shown when validation fails" })
|
|
178
|
-
] })
|
|
179
|
-
] })
|
|
180
|
-
] });
|
|
181
|
-
}
|
|
182
|
-
var DateFieldEditor_default = DateFieldEditor;
|
|
183
|
-
export {
|
|
184
|
-
DateFieldEditor,
|
|
185
|
-
DateFieldEditor_default as default
|
|
186
|
-
};
|
|
187
|
-
//# sourceMappingURL=DateFieldEditor-JFJFAVOH.js.map
|