@usgb/forms 0.1.0 → 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 +256 -71
- package/dist/forms-manifest.json +249 -0
- package/dist/index.js +1032 -31
- package/dist/src/contract/collectContext.d.ts +9 -0
- package/dist/src/contract/collectContext.d.ts.map +1 -0
- package/dist/src/contract/createStubAdapter.d.ts +9 -0
- package/dist/src/contract/createStubAdapter.d.ts.map +1 -0
- package/dist/src/contract/types.d.ts +90 -0
- package/dist/src/contract/types.d.ts.map +1 -0
- package/dist/src/definitions/consents.d.ts +37 -0
- package/dist/src/definitions/consents.d.ts.map +1 -0
- package/dist/src/definitions/fields.d.ts +19 -0
- package/dist/src/definitions/fields.d.ts.map +1 -0
- package/dist/src/definitions/index.d.ts +7 -0
- package/dist/src/definitions/index.d.ts.map +1 -0
- package/dist/src/definitions/manifest.d.ts +8 -0
- package/dist/src/definitions/manifest.d.ts.map +1 -0
- package/dist/src/definitions/types.d.ts +77 -0
- package/dist/src/definitions/types.d.ts.map +1 -0
- package/dist/src/form/FormShell.d.ts +10 -0
- package/dist/src/form/FormShell.d.ts.map +1 -0
- package/dist/src/form/RegisteredTextField.d.ts +14 -0
- package/dist/src/form/RegisteredTextField.d.ts.map +1 -0
- package/dist/src/form/UsgbForm.d.ts +25 -0
- package/dist/src/form/UsgbForm.d.ts.map +1 -0
- package/dist/src/form/chunkFields.d.ts +17 -0
- package/dist/src/form/chunkFields.d.ts.map +1 -0
- package/dist/src/form/kinds/LeadKindForm.d.ts +4 -0
- package/dist/src/form/kinds/LeadKindForm.d.ts.map +1 -0
- package/dist/src/form/kinds/NewsletterKindForm.d.ts +4 -0
- package/dist/src/form/kinds/NewsletterKindForm.d.ts.map +1 -0
- package/dist/src/form/kinds/index.d.ts +6 -0
- package/dist/src/form/kinds/index.d.ts.map +1 -0
- package/dist/src/form/kinds/types.d.ts +11 -0
- package/dist/src/form/kinds/types.d.ts.map +1 -0
- package/dist/src/form/useUsgbFormSession.d.ts +41 -0
- package/dist/src/form/useUsgbFormSession.d.ts.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/ui/Button.d.ts +7 -0
- package/dist/src/ui/Button.d.ts.map +1 -0
- package/dist/src/ui/ConsentField.d.ts +9 -0
- package/dist/src/ui/ConsentField.d.ts.map +1 -0
- package/dist/src/ui/FieldError.d.ts +8 -0
- package/dist/src/ui/FieldError.d.ts.map +1 -0
- package/dist/src/ui/FieldLabel.d.ts +9 -0
- package/dist/src/ui/FieldLabel.d.ts.map +1 -0
- package/dist/src/ui/TextField.d.ts +19 -0
- package/dist/src/ui/TextField.d.ts.map +1 -0
- package/dist/src/ui/icons.d.ts +4 -0
- package/dist/src/ui/icons.d.ts.map +1 -0
- package/dist/usgb-forms.1.0.0.js +44 -0
- package/dist/usgb-forms.css +574 -0
- package/dist/usgb-forms.js +44 -0
- package/forms-manifest.json +249 -0
- package/package.json +51 -46
- package/dist/index.cjs +0 -64
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -15
- package/dist/index.d.ts +0 -15
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"package": {
|
|
4
|
+
"name": "@usgb/forms",
|
|
5
|
+
"compatiblePackageVersions": "^1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"submissionContract": {
|
|
8
|
+
"version": "1.0.0",
|
|
9
|
+
"transport": "server-proxy",
|
|
10
|
+
"payloadShape": "data-and-context"
|
|
11
|
+
},
|
|
12
|
+
"trackingRegistry": {
|
|
13
|
+
"page_url": {
|
|
14
|
+
"destination": "form_submission_url",
|
|
15
|
+
"category": "page",
|
|
16
|
+
"collection": "server",
|
|
17
|
+
"required": true,
|
|
18
|
+
"states": ["collected", "unavailable"],
|
|
19
|
+
"description": "Canonical landing-page URL at submission time"
|
|
20
|
+
},
|
|
21
|
+
"page_title": {
|
|
22
|
+
"destination": "pageName",
|
|
23
|
+
"category": "page",
|
|
24
|
+
"collection": "server",
|
|
25
|
+
"required": false,
|
|
26
|
+
"states": ["collected", "unavailable"]
|
|
27
|
+
},
|
|
28
|
+
"referrer": {
|
|
29
|
+
"destination": "referrer",
|
|
30
|
+
"category": "page",
|
|
31
|
+
"collection": "browser",
|
|
32
|
+
"required": false,
|
|
33
|
+
"states": ["collected", "unavailable"]
|
|
34
|
+
},
|
|
35
|
+
"first_touch_url": {
|
|
36
|
+
"destination": "crossDomain_landing_url",
|
|
37
|
+
"category": "attribution",
|
|
38
|
+
"collection": "host-adapter",
|
|
39
|
+
"required": false,
|
|
40
|
+
"states": ["collected", "unavailable"]
|
|
41
|
+
},
|
|
42
|
+
"utm_source": {
|
|
43
|
+
"destination": "utm_source",
|
|
44
|
+
"category": "attribution",
|
|
45
|
+
"collection": "host-adapter",
|
|
46
|
+
"required": false,
|
|
47
|
+
"states": ["collected", "unavailable"]
|
|
48
|
+
},
|
|
49
|
+
"utm_medium": {
|
|
50
|
+
"destination": "utm_medium",
|
|
51
|
+
"category": "attribution",
|
|
52
|
+
"collection": "host-adapter",
|
|
53
|
+
"required": false,
|
|
54
|
+
"states": ["collected", "unavailable"]
|
|
55
|
+
},
|
|
56
|
+
"utm_campaign": {
|
|
57
|
+
"destination": "utm_campaign",
|
|
58
|
+
"category": "attribution",
|
|
59
|
+
"collection": "host-adapter",
|
|
60
|
+
"required": false,
|
|
61
|
+
"states": ["collected", "unavailable"]
|
|
62
|
+
},
|
|
63
|
+
"utm_term": {
|
|
64
|
+
"destination": "utm_term",
|
|
65
|
+
"category": "attribution",
|
|
66
|
+
"collection": "host-adapter",
|
|
67
|
+
"required": false,
|
|
68
|
+
"states": ["collected", "unavailable"]
|
|
69
|
+
},
|
|
70
|
+
"utm_content": {
|
|
71
|
+
"destination": "utm_content",
|
|
72
|
+
"category": "attribution",
|
|
73
|
+
"collection": "host-adapter",
|
|
74
|
+
"required": false,
|
|
75
|
+
"states": ["collected", "unavailable"]
|
|
76
|
+
},
|
|
77
|
+
"gclid": {
|
|
78
|
+
"destination": "gclid",
|
|
79
|
+
"category": "click-id",
|
|
80
|
+
"collection": "host-adapter",
|
|
81
|
+
"required": false,
|
|
82
|
+
"states": ["collected", "unavailable"]
|
|
83
|
+
},
|
|
84
|
+
"msclkid": {
|
|
85
|
+
"destination": "msclkid",
|
|
86
|
+
"category": "click-id",
|
|
87
|
+
"collection": "host-adapter",
|
|
88
|
+
"required": false,
|
|
89
|
+
"states": ["collected", "unavailable"]
|
|
90
|
+
},
|
|
91
|
+
"gbraid": {
|
|
92
|
+
"destination": "gbraid",
|
|
93
|
+
"category": "click-id",
|
|
94
|
+
"collection": "host-adapter",
|
|
95
|
+
"required": false,
|
|
96
|
+
"states": ["collected", "unavailable"]
|
|
97
|
+
},
|
|
98
|
+
"wbraid": {
|
|
99
|
+
"destination": "wbraid",
|
|
100
|
+
"category": "click-id",
|
|
101
|
+
"collection": "host-adapter",
|
|
102
|
+
"required": false,
|
|
103
|
+
"states": ["collected", "unavailable"]
|
|
104
|
+
},
|
|
105
|
+
"hubspot_utk": {
|
|
106
|
+
"destination": "hubspot_utk",
|
|
107
|
+
"category": "identity",
|
|
108
|
+
"collection": "host-adapter",
|
|
109
|
+
"required": false,
|
|
110
|
+
"states": ["collected", "unavailable", "consent-withheld"]
|
|
111
|
+
},
|
|
112
|
+
"ga_client_id": {
|
|
113
|
+
"destination": "ga_client_id",
|
|
114
|
+
"category": "analytics",
|
|
115
|
+
"collection": "host-adapter",
|
|
116
|
+
"required": false,
|
|
117
|
+
"states": ["collected", "unavailable", "consent-withheld"]
|
|
118
|
+
},
|
|
119
|
+
"ga_session_id": {
|
|
120
|
+
"destination": "session_id_start",
|
|
121
|
+
"category": "analytics",
|
|
122
|
+
"collection": "host-adapter",
|
|
123
|
+
"required": false,
|
|
124
|
+
"states": ["collected", "unavailable", "consent-withheld"]
|
|
125
|
+
},
|
|
126
|
+
"snowplow_id": {
|
|
127
|
+
"destination": "snowplow_id",
|
|
128
|
+
"category": "analytics",
|
|
129
|
+
"collection": "host-adapter",
|
|
130
|
+
"required": false,
|
|
131
|
+
"states": ["collected", "unavailable", "consent-withheld"]
|
|
132
|
+
},
|
|
133
|
+
"vwo_uuid": {
|
|
134
|
+
"destination": "vwo_uuid",
|
|
135
|
+
"category": "experiment",
|
|
136
|
+
"collection": "host-adapter",
|
|
137
|
+
"required": false,
|
|
138
|
+
"states": ["collected", "unavailable", "consent-withheld"]
|
|
139
|
+
},
|
|
140
|
+
"user_agent": {
|
|
141
|
+
"destination": "header_http_client_details",
|
|
142
|
+
"category": "technical",
|
|
143
|
+
"collection": "server",
|
|
144
|
+
"required": false,
|
|
145
|
+
"states": ["collected", "unavailable"]
|
|
146
|
+
},
|
|
147
|
+
"ip_address": {
|
|
148
|
+
"destination": "ipAddress",
|
|
149
|
+
"category": "technical",
|
|
150
|
+
"collection": "server",
|
|
151
|
+
"required": false,
|
|
152
|
+
"states": ["collected", "unavailable"]
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"forms": {
|
|
156
|
+
"main-investors-kit": {
|
|
157
|
+
"definitionVersion": "1",
|
|
158
|
+
"kind": "lead",
|
|
159
|
+
"flow": { "type": "single" },
|
|
160
|
+
"supportedHosts": ["pwa", "wordpress"],
|
|
161
|
+
"fields": [
|
|
162
|
+
{ "name": "firstname", "required": true, "group": "name" },
|
|
163
|
+
{ "name": "lastname", "required": true, "group": "name" },
|
|
164
|
+
{ "name": "email", "required": true },
|
|
165
|
+
{ "name": "phone", "required": false }
|
|
166
|
+
],
|
|
167
|
+
"trackingFields": [
|
|
168
|
+
"page_url",
|
|
169
|
+
"page_title",
|
|
170
|
+
"referrer",
|
|
171
|
+
"first_touch_url",
|
|
172
|
+
"utm_source",
|
|
173
|
+
"utm_medium",
|
|
174
|
+
"utm_campaign",
|
|
175
|
+
"utm_term",
|
|
176
|
+
"utm_content",
|
|
177
|
+
"gclid",
|
|
178
|
+
"msclkid",
|
|
179
|
+
"gbraid",
|
|
180
|
+
"wbraid",
|
|
181
|
+
"hubspot_utk",
|
|
182
|
+
"ga_client_id",
|
|
183
|
+
"ga_session_id",
|
|
184
|
+
"snowplow_id",
|
|
185
|
+
"vwo_uuid",
|
|
186
|
+
"user_agent",
|
|
187
|
+
"ip_address"
|
|
188
|
+
],
|
|
189
|
+
"consent": {
|
|
190
|
+
"definitionId": "lead-tcpa",
|
|
191
|
+
"definitionVersion": "1",
|
|
192
|
+
"required": true,
|
|
193
|
+
"submitFields": [
|
|
194
|
+
"tcpa_form_consent_granted",
|
|
195
|
+
"tcpa_form_opt_in_date"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"editor": {
|
|
199
|
+
"label": "Main Investors Kit",
|
|
200
|
+
"description": "Standard lead form: name, email, phone, TCPA consent. Use on full-width landing pages and PWA kit/sidebar placements.",
|
|
201
|
+
"whenToUse": "Default kit request. Do not use for affiliate landers or IRA-specific leads.",
|
|
202
|
+
"whenNotToUse": "Affiliate pages (separate definition). IRA kit (separate definition when added).",
|
|
203
|
+
"supportedAppearances": ["light", "navy"],
|
|
204
|
+
"supportedVariants": ["dense", "large", "sidebar", "two-column"]
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"newsletter": {
|
|
208
|
+
"definitionVersion": "1",
|
|
209
|
+
"kind": "newsletter",
|
|
210
|
+
"flow": { "type": "single" },
|
|
211
|
+
"supportedHosts": ["pwa"],
|
|
212
|
+
"fields": [{ "name": "email", "required": true }],
|
|
213
|
+
"trackingFields": [
|
|
214
|
+
"page_url",
|
|
215
|
+
"page_title",
|
|
216
|
+
"referrer",
|
|
217
|
+
"utm_source",
|
|
218
|
+
"utm_medium",
|
|
219
|
+
"utm_campaign",
|
|
220
|
+
"utm_term",
|
|
221
|
+
"utm_content"
|
|
222
|
+
],
|
|
223
|
+
"editor": {
|
|
224
|
+
"label": "Newsletter",
|
|
225
|
+
"description": "Email-only newsletter signup. No TCPA consent.",
|
|
226
|
+
"whenToUse": "Footer or landing newsletter capture where only an email is required.",
|
|
227
|
+
"whenNotToUse": "Lead kits that need name, phone, or TCPA consent.",
|
|
228
|
+
"supportedAppearances": ["light", "navy"],
|
|
229
|
+
"supportedVariants": []
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"hostAdapterContract": {
|
|
234
|
+
"hosts": ["pwa", "wordpress"],
|
|
235
|
+
"mayProvide": [
|
|
236
|
+
"browser cookies",
|
|
237
|
+
"URL parameters",
|
|
238
|
+
"page and placement context",
|
|
239
|
+
"host/store identity"
|
|
240
|
+
],
|
|
241
|
+
"mustNotDefine": [
|
|
242
|
+
"new tracking keys",
|
|
243
|
+
"destination property names",
|
|
244
|
+
"consent definitions",
|
|
245
|
+
"form fields",
|
|
246
|
+
"submission endpoints"
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
}
|
package/package.json
CHANGED
|
@@ -1,61 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usgb/forms",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared USGB lead-form package for PWA and WordPress",
|
|
6
5
|
"type": "module",
|
|
7
|
-
"
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"forms-manifest.json"
|
|
10
|
+
],
|
|
11
|
+
"main": "./dist/index.js",
|
|
8
12
|
"module": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
10
14
|
"exports": {
|
|
11
15
|
".": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js"
|
|
14
|
-
|
|
16
|
+
"types": "./dist/src/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./usgb-forms.css": "./dist/usgb-forms.css",
|
|
20
|
+
"./manifest": "./forms-manifest.json",
|
|
21
|
+
"./wc": {
|
|
22
|
+
"import": "./dist/usgb-forms.js"
|
|
15
23
|
}
|
|
16
24
|
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"sideEffects": false,
|
|
21
25
|
"scripts": {
|
|
22
|
-
"
|
|
26
|
+
"dev": "vite --config vite.playground.config.ts",
|
|
27
|
+
"build": "node scripts/build.mjs",
|
|
23
28
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
29
|
+
"lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
|
|
30
|
+
"lint:check": "eslint 'src/**/*.{js,ts,tsx}' --quiet",
|
|
31
|
+
"format": "prettier --write 'src/**/*.{js,ts,tsx,css,md,json}' '*.md' 'forms-manifest.json'",
|
|
32
|
+
"format:check": "prettier --check 'src/**/*.{js,ts,tsx,css,md,json}' '*.md' 'forms-manifest.json'",
|
|
33
|
+
"preview": "vite preview --config vite.playground.config.ts"
|
|
27
34
|
},
|
|
28
35
|
"peerDependencies": {
|
|
29
|
-
"react": "
|
|
30
|
-
"react-dom": "
|
|
36
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
37
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
31
38
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@types/react-dom": "^19.1.9",
|
|
37
|
-
"jsdom": "^26.1.0",
|
|
38
|
-
"react": "^19.1.1",
|
|
39
|
-
"react-dom": "^19.1.1",
|
|
40
|
-
"tsup": "^8.5.0",
|
|
41
|
-
"typescript": "^5.9.2",
|
|
42
|
-
"vitest": "^3.2.4"
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"classnames": "^2.5.1",
|
|
41
|
+
"email-validator": "^2.0.4",
|
|
42
|
+
"react-hook-form": "^7.54.2"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"react",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
46
|
+
"@eslint/js": "^9.39.4",
|
|
47
|
+
"@types/react": "^18.3.16",
|
|
48
|
+
"@types/react-dom": "^18.3.5",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.60.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.60.0",
|
|
51
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
52
|
+
"eslint": "^9.39.4",
|
|
53
|
+
"eslint-config-prettier": "^10.1.8",
|
|
54
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
55
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
56
|
+
"eslint-plugin-react": "^7.37.5",
|
|
57
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
58
|
+
"globals": "^16.0.0",
|
|
59
|
+
"prettier": "^2.2.1",
|
|
60
|
+
"react": "^18.3.1",
|
|
61
|
+
"react-dom": "^18.3.1",
|
|
62
|
+
"typescript": "^5.7.2",
|
|
63
|
+
"vite": "^6.0.4",
|
|
64
|
+
"vite-plugin-dts": "^4.4.0"
|
|
65
|
+
}
|
|
61
66
|
}
|
package/dist/index.cjs
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
Form: () => Form,
|
|
24
|
-
TextField: () => TextField
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
|
-
// src/Form.tsx
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
function Form({ children, ...props }) {
|
|
31
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { ...props, children });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// src/TextField.tsx
|
|
35
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
36
|
-
function TextField({
|
|
37
|
-
label,
|
|
38
|
-
error,
|
|
39
|
-
id,
|
|
40
|
-
name,
|
|
41
|
-
...props
|
|
42
|
-
}) {
|
|
43
|
-
const inputId = id ?? name;
|
|
44
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
45
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: inputId, children: label }),
|
|
46
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
47
|
-
"input",
|
|
48
|
-
{
|
|
49
|
-
id: inputId,
|
|
50
|
-
name,
|
|
51
|
-
...props,
|
|
52
|
-
"aria-invalid": error ? "true" : void 0,
|
|
53
|
-
"aria-describedby": error && inputId ? `${inputId}-error` : void 0
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { id: inputId ? `${inputId}-error` : void 0, role: "alert", children: error }) : null
|
|
57
|
-
] });
|
|
58
|
-
}
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
Form,
|
|
62
|
-
TextField
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/Form.tsx","../src/TextField.tsx"],"sourcesContent":["export { Form } from \"./Form\";\nexport type { FormProps } from \"./Form\";\n\nexport { TextField } from \"./TextField\";\nexport type { TextFieldProps } from \"./TextField\";\n","import type { FormHTMLAttributes, ReactNode } from \"react\";\n\nexport type FormProps = FormHTMLAttributes<HTMLFormElement> & {\n children: ReactNode;\n};\n\nexport function Form({ children, ...props }: FormProps) {\n return <form {...props}>{children}</form>;\n}\n","import type { InputHTMLAttributes } from \"react\";\n\nexport type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {\n label: string;\n error?: string;\n};\n\nexport function TextField({\n label,\n error,\n id,\n name,\n ...props\n}: TextFieldProps) {\n const inputId = id ?? name;\n\n return (\n <div>\n <label htmlFor={inputId}>{label}</label>\n <input\n id={inputId}\n name={name}\n {...props}\n aria-invalid={error ? \"true\" : undefined}\n aria-describedby={error && inputId ? `${inputId}-error` : undefined}\n />\n {error ? (\n <p id={inputId ? `${inputId}-error` : undefined} role=\"alert\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOS;AADF,SAAS,KAAK,EAAE,UAAU,GAAG,MAAM,GAAc;AACtD,SAAO,4CAAC,UAAM,GAAG,OAAQ,UAAS;AACpC;;;ACSI,IAAAA,sBAAA;AAVG,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,UAAU,MAAM;AAEtB,SACE,8CAAC,SACC;AAAA,iDAAC,WAAM,SAAS,SAAU,iBAAM;AAAA,IAChC;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ;AAAA,QACC,GAAG;AAAA,QACJ,gBAAc,QAAQ,SAAS;AAAA,QAC/B,oBAAkB,SAAS,UAAU,GAAG,OAAO,WAAW;AAAA;AAAA,IAC5D;AAAA,IACC,QACC,6CAAC,OAAE,IAAI,UAAU,GAAG,OAAO,WAAW,QAAW,MAAK,SACnD,iBACH,IACE;AAAA,KACN;AAEJ;","names":["import_jsx_runtime"]}
|
package/dist/index.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { FormHTMLAttributes, ReactNode, InputHTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
type FormProps = FormHTMLAttributes<HTMLFormElement> & {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
declare function Form({ children, ...props }: FormProps): react.JSX.Element;
|
|
8
|
-
|
|
9
|
-
type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
10
|
-
label: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
};
|
|
13
|
-
declare function TextField({ label, error, id, name, ...props }: TextFieldProps): react.JSX.Element;
|
|
14
|
-
|
|
15
|
-
export { Form, type FormProps, TextField, type TextFieldProps };
|
package/dist/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { FormHTMLAttributes, ReactNode, InputHTMLAttributes } from 'react';
|
|
3
|
-
|
|
4
|
-
type FormProps = FormHTMLAttributes<HTMLFormElement> & {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
declare function Form({ children, ...props }: FormProps): react.JSX.Element;
|
|
8
|
-
|
|
9
|
-
type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
10
|
-
label: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
};
|
|
13
|
-
declare function TextField({ label, error, id, name, ...props }: TextFieldProps): react.JSX.Element;
|
|
14
|
-
|
|
15
|
-
export { Form, type FormProps, TextField, type TextFieldProps };
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Form.tsx","../src/TextField.tsx"],"sourcesContent":["import type { FormHTMLAttributes, ReactNode } from \"react\";\n\nexport type FormProps = FormHTMLAttributes<HTMLFormElement> & {\n children: ReactNode;\n};\n\nexport function Form({ children, ...props }: FormProps) {\n return <form {...props}>{children}</form>;\n}\n","import type { InputHTMLAttributes } from \"react\";\n\nexport type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {\n label: string;\n error?: string;\n};\n\nexport function TextField({\n label,\n error,\n id,\n name,\n ...props\n}: TextFieldProps) {\n const inputId = id ?? name;\n\n return (\n <div>\n <label htmlFor={inputId}>{label}</label>\n <input\n id={inputId}\n name={name}\n {...props}\n aria-invalid={error ? \"true\" : undefined}\n aria-describedby={error && inputId ? `${inputId}-error` : undefined}\n />\n {error ? (\n <p id={inputId ? `${inputId}-error` : undefined} role=\"alert\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n"],"mappings":";AAOS;AADF,SAAS,KAAK,EAAE,UAAU,GAAG,MAAM,GAAc;AACtD,SAAO,oBAAC,UAAM,GAAG,OAAQ,UAAS;AACpC;;;ACSI,SACE,OAAAA,MADF;AAVG,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,UAAU,MAAM;AAEtB,SACE,qBAAC,SACC;AAAA,oBAAAA,KAAC,WAAM,SAAS,SAAU,iBAAM;AAAA,IAChC,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ;AAAA,QACC,GAAG;AAAA,QACJ,gBAAc,QAAQ,SAAS;AAAA,QAC/B,oBAAkB,SAAS,UAAU,GAAG,OAAO,WAAW;AAAA;AAAA,IAC5D;AAAA,IACC,QACC,gBAAAA,KAAC,OAAE,IAAI,UAAU,GAAG,OAAO,WAAW,QAAW,MAAK,SACnD,iBACH,IACE;AAAA,KACN;AAEJ;","names":["jsx"]}
|