@wix/headless-forms 0.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 +46 -0
- package/cjs/dist/react/Form.d.ts +802 -0
- package/cjs/dist/react/Form.js +776 -0
- package/cjs/dist/react/Phone.d.ts +47 -0
- package/cjs/dist/react/Phone.js +56 -0
- package/cjs/dist/react/constants/calling-country-codes.d.ts +242 -0
- package/cjs/dist/react/constants/calling-country-codes.js +242 -0
- package/cjs/dist/react/context/FieldContext.d.ts +12 -0
- package/cjs/dist/react/context/FieldContext.js +16 -0
- package/cjs/dist/react/context/FieldLayoutContext.d.ts +12 -0
- package/cjs/dist/react/context/FieldLayoutContext.js +21 -0
- package/cjs/dist/react/core/Form.d.ts +342 -0
- package/cjs/dist/react/core/Form.js +278 -0
- package/cjs/dist/react/index.d.ts +3 -0
- package/cjs/dist/react/index.js +42 -0
- package/cjs/dist/react/types.d.ts +3 -0
- package/cjs/dist/react/types.js +2 -0
- package/cjs/dist/react/utils.d.ts +13 -0
- package/cjs/dist/react/utils.js +20 -0
- package/cjs/dist/services/form-service.d.ts +114 -0
- package/cjs/dist/services/form-service.js +152 -0
- package/cjs/dist/services/index.d.ts +1 -0
- package/cjs/dist/services/index.js +17 -0
- package/cjs/package.json +3 -0
- package/dist/react/Form.d.ts +802 -0
- package/dist/react/Form.js +740 -0
- package/dist/react/Phone.d.ts +47 -0
- package/dist/react/Phone.js +50 -0
- package/dist/react/constants/calling-country-codes.d.ts +242 -0
- package/dist/react/constants/calling-country-codes.js +241 -0
- package/dist/react/context/FieldContext.d.ts +12 -0
- package/dist/react/context/FieldContext.js +9 -0
- package/dist/react/context/FieldLayoutContext.d.ts +12 -0
- package/dist/react/context/FieldLayoutContext.js +13 -0
- package/dist/react/core/Form.d.ts +342 -0
- package/dist/react/core/Form.js +269 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +3 -0
- package/dist/react/types.d.ts +3 -0
- package/dist/react/types.js +1 -0
- package/dist/react/utils.d.ts +13 -0
- package/dist/react/utils.js +17 -0
- package/dist/services/form-service.d.ts +114 -0
- package/dist/services/form-service.js +148 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/package.json +62 -0
- package/react/package.json +4 -0
- package/services/package.json +4 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PhoneFieldProps {
|
|
3
|
+
id: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PhoneLabelProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PhoneLabelRequiredProps {
|
|
14
|
+
required?: boolean;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
asChild?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const Required: React.ForwardRefExoticComponent<PhoneLabelRequiredProps & React.RefAttributes<HTMLSpanElement>>;
|
|
20
|
+
interface PhoneLabelComponent extends React.ForwardRefExoticComponent<PhoneLabelProps & React.RefAttributes<HTMLDivElement>> {
|
|
21
|
+
Required: typeof Required;
|
|
22
|
+
}
|
|
23
|
+
export declare const Label: PhoneLabelComponent;
|
|
24
|
+
export interface PhoneErrorProps {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
declare const Error: React.ForwardRefExoticComponent<PhoneErrorProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export interface CountryCodeProps {
|
|
31
|
+
asChild?: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
declare const CountryCode: React.ForwardRefExoticComponent<CountryCodeProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export interface PhoneFieldInputProps {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
declare const Input: React.ForwardRefExoticComponent<PhoneFieldInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
interface PhoneFieldComponent extends React.ForwardRefExoticComponent<PhoneFieldProps & React.RefAttributes<HTMLDivElement>> {
|
|
41
|
+
Label: typeof Label;
|
|
42
|
+
Error: typeof Error;
|
|
43
|
+
Input: typeof Input;
|
|
44
|
+
CountryCode: typeof CountryCode;
|
|
45
|
+
}
|
|
46
|
+
export declare const PhoneField: PhoneFieldComponent;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PhoneField = exports.Label = exports.Required = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const react_2 = require("@wix/headless-forms/react");
|
|
10
|
+
const form_public_1 = require("@wix/form-public");
|
|
11
|
+
const Root = react_1.default.forwardRef((props, ref) => {
|
|
12
|
+
const { id, children, asChild, className } = props;
|
|
13
|
+
const { description } = (0, form_public_1.useFieldProps)();
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Form.Field, { ref: ref, id: id, asChild: asChild, className: className, children: (0, jsx_runtime_1.jsx)(react_2.Form.Field.InputWrapper, { children: (0, jsx_runtime_1.jsx)(react_2.Form.Field.Input, { description: description, children: children }) }) }));
|
|
15
|
+
});
|
|
16
|
+
Root.displayName = 'PhoneField';
|
|
17
|
+
const LabelRoot = react_1.default.forwardRef((props, ref) => {
|
|
18
|
+
const { asChild, className, children } = props;
|
|
19
|
+
const { id, label, showLabel } = (0, form_public_1.useFieldProps)();
|
|
20
|
+
if (!showLabel) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Form.Field.Label, { ref: ref, asChild: asChild, className: className, children: (0, jsx_runtime_1.jsxs)("label", { htmlFor: id, children: [label, children] }) }));
|
|
24
|
+
});
|
|
25
|
+
LabelRoot.displayName = 'PhoneField.Label';
|
|
26
|
+
exports.Required = react_1.default.forwardRef((props, ref) => {
|
|
27
|
+
const { required } = (0, form_public_1.useFieldProps)();
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(react_2.Form.Field.Label.Required, { ...props, ref: ref, required: required });
|
|
29
|
+
});
|
|
30
|
+
exports.Required.displayName = 'PhoneField.Label.Required';
|
|
31
|
+
exports.Label = LabelRoot;
|
|
32
|
+
exports.Label.Required = exports.Required;
|
|
33
|
+
const Error = react_1.default.forwardRef((props, ref) => {
|
|
34
|
+
const { children, ...rest } = props;
|
|
35
|
+
const { errorMessage } = (0, form_public_1.useFieldProps)();
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Form.Field.Error, { ref: ref, ...rest, children: errorMessage }));
|
|
37
|
+
});
|
|
38
|
+
Error.displayName = 'PhoneField.Error';
|
|
39
|
+
const CountryCode = react_1.default.forwardRef((props, ref) => {
|
|
40
|
+
const { asChild, className, ...rest } = props;
|
|
41
|
+
const { id, countryCodes, defaultCountryCode, readOnly, onChange, onBlur, onFocus, } = (0, form_public_1.useFieldProps)();
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Form.Field.Input, { ref: ref, asChild: asChild, className: className, ...rest, children: (0, jsx_runtime_1.jsx)("select", { id: `${id}-country`, defaultValue: defaultCountryCode || '', disabled: readOnly, onChange: (e) => onChange?.(e.target.value), onBlur: () => onBlur?.(), onFocus: () => onFocus?.(), children: countryCodes?.map((code) => ((0, jsx_runtime_1.jsx)("option", { value: code, children: code }, code))) }) }));
|
|
43
|
+
});
|
|
44
|
+
CountryCode.displayName = 'PhoneField.CountryCode';
|
|
45
|
+
const Input = react_1.default.forwardRef((props, ref) => {
|
|
46
|
+
const { asChild, className, ...rest } = props;
|
|
47
|
+
const { id, value, required, readOnly, placeholder, onChange, onBlur, onFocus, description, } = (0, form_public_1.useFieldProps)();
|
|
48
|
+
const descriptionId = description ? `${id}-description` : undefined;
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(react_2.Form.Field.Input, { ref: ref, asChild: asChild, className: className, ...rest, children: (0, jsx_runtime_1.jsx)("input", { id: id, type: "tel", value: value || '', required: required, readOnly: readOnly, placeholder: placeholder, "aria-describedby": descriptionId, "aria-invalid": !!(required && !value), "aria-required": required, onChange: (e) => onChange?.(e.target.value), onBlur: () => onBlur?.(), onFocus: () => onFocus?.() }) }));
|
|
50
|
+
});
|
|
51
|
+
Input.displayName = 'PhoneField.Input';
|
|
52
|
+
exports.PhoneField = Root;
|
|
53
|
+
exports.PhoneField.Label = exports.Label;
|
|
54
|
+
exports.PhoneField.Error = Error;
|
|
55
|
+
exports.PhoneField.Input = Input;
|
|
56
|
+
exports.PhoneField.CountryCode = CountryCode;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
declare const CALLING_COUNTRY_CODES: {
|
|
2
|
+
readonly AW: "ABW";
|
|
3
|
+
readonly AO: "AGO";
|
|
4
|
+
readonly AF: "AFG";
|
|
5
|
+
readonly AI: "AIA";
|
|
6
|
+
readonly AX: "ALA";
|
|
7
|
+
readonly AL: "ALB";
|
|
8
|
+
readonly AD: "AND";
|
|
9
|
+
readonly AE: "ARE";
|
|
10
|
+
readonly AR: "ARG";
|
|
11
|
+
readonly AM: "ARM";
|
|
12
|
+
readonly AS: "ASM";
|
|
13
|
+
readonly AG: "ATG";
|
|
14
|
+
readonly AU: "AUS";
|
|
15
|
+
readonly AT: "AUT";
|
|
16
|
+
readonly AZ: "AZE";
|
|
17
|
+
readonly BI: "BDI";
|
|
18
|
+
readonly BE: "BEL";
|
|
19
|
+
readonly BJ: "BEN";
|
|
20
|
+
readonly BQ: "BES";
|
|
21
|
+
readonly BF: "BFA";
|
|
22
|
+
readonly BD: "BGD";
|
|
23
|
+
readonly BG: "BGR";
|
|
24
|
+
readonly BH: "BHR";
|
|
25
|
+
readonly BS: "BHS";
|
|
26
|
+
readonly BA: "BIH";
|
|
27
|
+
readonly BL: "BLM";
|
|
28
|
+
readonly BY: "BLR";
|
|
29
|
+
readonly BZ: "BLZ";
|
|
30
|
+
readonly BM: "BMU";
|
|
31
|
+
readonly BO: "BOL";
|
|
32
|
+
readonly BR: "BRA";
|
|
33
|
+
readonly BB: "BRB";
|
|
34
|
+
readonly BN: "BRN";
|
|
35
|
+
readonly BT: "BTN";
|
|
36
|
+
readonly BW: "BWA";
|
|
37
|
+
readonly CF: "CAF";
|
|
38
|
+
readonly CA: "CAN";
|
|
39
|
+
readonly CC: "CCK";
|
|
40
|
+
readonly CH: "CHE";
|
|
41
|
+
readonly CL: "CHL";
|
|
42
|
+
readonly CN: "CHN";
|
|
43
|
+
readonly CI: "CIV";
|
|
44
|
+
readonly CM: "CMR";
|
|
45
|
+
readonly CD: "COD";
|
|
46
|
+
readonly CG: "COG";
|
|
47
|
+
readonly CK: "COK";
|
|
48
|
+
readonly CO: "COL";
|
|
49
|
+
readonly KM: "COM";
|
|
50
|
+
readonly CV: "CPV";
|
|
51
|
+
readonly CR: "CRI";
|
|
52
|
+
readonly CW: "CUW";
|
|
53
|
+
readonly CX: "CXR";
|
|
54
|
+
readonly KY: "CYM";
|
|
55
|
+
readonly CY: "CYP";
|
|
56
|
+
readonly CZ: "CZE";
|
|
57
|
+
readonly DE: "DEU";
|
|
58
|
+
readonly DJ: "DJI";
|
|
59
|
+
readonly DM: "DMA";
|
|
60
|
+
readonly DK: "DNK";
|
|
61
|
+
readonly DO: "DOM";
|
|
62
|
+
readonly DZ: "DZA";
|
|
63
|
+
readonly EC: "ECU";
|
|
64
|
+
readonly EG: "EGY";
|
|
65
|
+
readonly ER: "ERI";
|
|
66
|
+
readonly ES: "ESP";
|
|
67
|
+
readonly EE: "EST";
|
|
68
|
+
readonly ET: "ETH";
|
|
69
|
+
readonly FI: "FIN";
|
|
70
|
+
readonly FJ: "FJI";
|
|
71
|
+
readonly FK: "FLK";
|
|
72
|
+
readonly FR: "FRA";
|
|
73
|
+
readonly FO: "FRO";
|
|
74
|
+
readonly FM: "FSM";
|
|
75
|
+
readonly GA: "GAB";
|
|
76
|
+
readonly GB: "GBR";
|
|
77
|
+
readonly GE: "GEO";
|
|
78
|
+
readonly GG: "GGY";
|
|
79
|
+
readonly GH: "GHA";
|
|
80
|
+
readonly GI: "GIB";
|
|
81
|
+
readonly GN: "GIN";
|
|
82
|
+
readonly GP: "GLP";
|
|
83
|
+
readonly GM: "GMB";
|
|
84
|
+
readonly GW: "GNB";
|
|
85
|
+
readonly GQ: "GNQ";
|
|
86
|
+
readonly GR: "GRC";
|
|
87
|
+
readonly GD: "GRD";
|
|
88
|
+
readonly GL: "GRL";
|
|
89
|
+
readonly GT: "GTM";
|
|
90
|
+
readonly GF: "GUF";
|
|
91
|
+
readonly GU: "GUM";
|
|
92
|
+
readonly GY: "GUY";
|
|
93
|
+
readonly HK: "HKG";
|
|
94
|
+
readonly HN: "HND";
|
|
95
|
+
readonly HR: "HRV";
|
|
96
|
+
readonly HT: "HTI";
|
|
97
|
+
readonly HU: "HUN";
|
|
98
|
+
readonly ID: "IDN";
|
|
99
|
+
readonly IM: "IMN";
|
|
100
|
+
readonly IN: "IND";
|
|
101
|
+
readonly IO: "IOT";
|
|
102
|
+
readonly IE: "IRL";
|
|
103
|
+
readonly IS: "ISL";
|
|
104
|
+
readonly IL: "ISR";
|
|
105
|
+
readonly IT: "ITA";
|
|
106
|
+
readonly IQ: "IRQ";
|
|
107
|
+
readonly JM: "JAM";
|
|
108
|
+
readonly JE: "JEY";
|
|
109
|
+
readonly JO: "JOR";
|
|
110
|
+
readonly JP: "JPN";
|
|
111
|
+
readonly KZ: "KAZ";
|
|
112
|
+
readonly KE: "KEN";
|
|
113
|
+
readonly KG: "KGZ";
|
|
114
|
+
readonly KH: "KHM";
|
|
115
|
+
readonly KI: "KIR";
|
|
116
|
+
readonly KN: "KNA";
|
|
117
|
+
readonly KR: "KOR";
|
|
118
|
+
readonly KW: "KWT";
|
|
119
|
+
readonly LA: "LAO";
|
|
120
|
+
readonly LB: "LBN";
|
|
121
|
+
readonly LR: "LBR";
|
|
122
|
+
readonly LY: "LBY";
|
|
123
|
+
readonly LC: "LCA";
|
|
124
|
+
readonly LI: "LIE";
|
|
125
|
+
readonly LK: "LKA";
|
|
126
|
+
readonly LS: "LSO";
|
|
127
|
+
readonly LT: "LTU";
|
|
128
|
+
readonly LU: "LUX";
|
|
129
|
+
readonly LV: "LVA";
|
|
130
|
+
readonly MO: "MAC";
|
|
131
|
+
readonly MF: "MAF";
|
|
132
|
+
readonly MA: "MAR";
|
|
133
|
+
readonly MC: "MCO";
|
|
134
|
+
readonly MD: "MDA";
|
|
135
|
+
readonly MG: "MDG";
|
|
136
|
+
readonly MV: "MDV";
|
|
137
|
+
readonly MX: "MEX";
|
|
138
|
+
readonly MH: "MHL";
|
|
139
|
+
readonly MK: "MKD";
|
|
140
|
+
readonly ML: "MLI";
|
|
141
|
+
readonly MT: "MLT";
|
|
142
|
+
readonly MM: "MMR";
|
|
143
|
+
readonly ME: "MNE";
|
|
144
|
+
readonly MN: "MNG";
|
|
145
|
+
readonly MP: "MNP";
|
|
146
|
+
readonly MZ: "MOZ";
|
|
147
|
+
readonly MR: "MRT";
|
|
148
|
+
readonly MS: "MSR";
|
|
149
|
+
readonly MQ: "MTQ";
|
|
150
|
+
readonly MU: "MUS";
|
|
151
|
+
readonly MW: "MWI";
|
|
152
|
+
readonly MY: "MYS";
|
|
153
|
+
readonly YT: "MYT";
|
|
154
|
+
readonly NA: "NAM";
|
|
155
|
+
readonly NC: "NCL";
|
|
156
|
+
readonly NE: "NER";
|
|
157
|
+
readonly NF: "NFK";
|
|
158
|
+
readonly NG: "NGA";
|
|
159
|
+
readonly NI: "NIC";
|
|
160
|
+
readonly NU: "NIU";
|
|
161
|
+
readonly NL: "NLD";
|
|
162
|
+
readonly NO: "NOR";
|
|
163
|
+
readonly NP: "NPL";
|
|
164
|
+
readonly NR: "NRU";
|
|
165
|
+
readonly NZ: "NZL";
|
|
166
|
+
readonly OM: "OMN";
|
|
167
|
+
readonly PK: "PAK";
|
|
168
|
+
readonly PA: "PAN";
|
|
169
|
+
readonly PE: "PER";
|
|
170
|
+
readonly PH: "PHL";
|
|
171
|
+
readonly PW: "PLW";
|
|
172
|
+
readonly PG: "PNG";
|
|
173
|
+
readonly PL: "POL";
|
|
174
|
+
readonly PR: "PRI";
|
|
175
|
+
readonly PT: "PRT";
|
|
176
|
+
readonly PY: "PRY";
|
|
177
|
+
readonly PS: "PSE";
|
|
178
|
+
readonly PF: "PYF";
|
|
179
|
+
readonly QA: "QAT";
|
|
180
|
+
readonly RE: "REU";
|
|
181
|
+
readonly RO: "ROU";
|
|
182
|
+
readonly RU: "RUS";
|
|
183
|
+
readonly RW: "RWA";
|
|
184
|
+
readonly SA: "SAU";
|
|
185
|
+
readonly SD: "SDN";
|
|
186
|
+
readonly SN: "SEN";
|
|
187
|
+
readonly SG: "SGP";
|
|
188
|
+
readonly SH: "SHN";
|
|
189
|
+
readonly SJ: "SJM";
|
|
190
|
+
readonly SB: "SLB";
|
|
191
|
+
readonly SL: "SLE";
|
|
192
|
+
readonly SV: "SLV";
|
|
193
|
+
readonly SM: "SMR";
|
|
194
|
+
readonly SO: "SOM";
|
|
195
|
+
readonly PM: "SPM";
|
|
196
|
+
readonly RS: "SRB";
|
|
197
|
+
readonly SS: "SSD";
|
|
198
|
+
readonly ST: "STP";
|
|
199
|
+
readonly SR: "SUR";
|
|
200
|
+
readonly SK: "SVK";
|
|
201
|
+
readonly SI: "SVN";
|
|
202
|
+
readonly SE: "SWE";
|
|
203
|
+
readonly SZ: "SWZ";
|
|
204
|
+
readonly SX: "SXM";
|
|
205
|
+
readonly SC: "SYC";
|
|
206
|
+
readonly TC: "TCA";
|
|
207
|
+
readonly TD: "TCD";
|
|
208
|
+
readonly TG: "TGO";
|
|
209
|
+
readonly TH: "THA";
|
|
210
|
+
readonly TJ: "TJK";
|
|
211
|
+
readonly TK: "TKL";
|
|
212
|
+
readonly TM: "TKM";
|
|
213
|
+
readonly TL: "TLS";
|
|
214
|
+
readonly TO: "TON";
|
|
215
|
+
readonly TT: "TTO";
|
|
216
|
+
readonly TN: "TUN";
|
|
217
|
+
readonly TR: "TUR";
|
|
218
|
+
readonly TV: "TUV";
|
|
219
|
+
readonly TW: "TWN";
|
|
220
|
+
readonly TZ: "TZA";
|
|
221
|
+
readonly UG: "UGA";
|
|
222
|
+
readonly UA: "UKR";
|
|
223
|
+
readonly UY: "URY";
|
|
224
|
+
readonly US: "USA";
|
|
225
|
+
readonly UZ: "UZB";
|
|
226
|
+
readonly VA: "VAT";
|
|
227
|
+
readonly VC: "VCT";
|
|
228
|
+
readonly VE: "VEN";
|
|
229
|
+
readonly VG: "VGB";
|
|
230
|
+
readonly VI: "VIR";
|
|
231
|
+
readonly VN: "VNM";
|
|
232
|
+
readonly VU: "VUT";
|
|
233
|
+
readonly WF: "WLF";
|
|
234
|
+
readonly WS: "WSM";
|
|
235
|
+
readonly XK: "KOS";
|
|
236
|
+
readonly YE: "YEM";
|
|
237
|
+
readonly ZA: "ZAF";
|
|
238
|
+
readonly ZM: "ZMB";
|
|
239
|
+
readonly ZW: "ZWE";
|
|
240
|
+
};
|
|
241
|
+
export type CallingCountryCode = keyof typeof CALLING_COUNTRY_CODES;
|
|
242
|
+
export {};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const CALLING_COUNTRY_CODES = {
|
|
4
|
+
AW: 'ABW',
|
|
5
|
+
AO: 'AGO',
|
|
6
|
+
AF: 'AFG',
|
|
7
|
+
AI: 'AIA',
|
|
8
|
+
AX: 'ALA',
|
|
9
|
+
AL: 'ALB',
|
|
10
|
+
AD: 'AND',
|
|
11
|
+
AE: 'ARE',
|
|
12
|
+
AR: 'ARG',
|
|
13
|
+
AM: 'ARM',
|
|
14
|
+
AS: 'ASM',
|
|
15
|
+
AG: 'ATG',
|
|
16
|
+
AU: 'AUS',
|
|
17
|
+
AT: 'AUT',
|
|
18
|
+
AZ: 'AZE',
|
|
19
|
+
BI: 'BDI',
|
|
20
|
+
BE: 'BEL',
|
|
21
|
+
BJ: 'BEN',
|
|
22
|
+
BQ: 'BES',
|
|
23
|
+
BF: 'BFA',
|
|
24
|
+
BD: 'BGD',
|
|
25
|
+
BG: 'BGR',
|
|
26
|
+
BH: 'BHR',
|
|
27
|
+
BS: 'BHS',
|
|
28
|
+
BA: 'BIH',
|
|
29
|
+
BL: 'BLM',
|
|
30
|
+
BY: 'BLR',
|
|
31
|
+
BZ: 'BLZ',
|
|
32
|
+
BM: 'BMU',
|
|
33
|
+
BO: 'BOL',
|
|
34
|
+
BR: 'BRA',
|
|
35
|
+
BB: 'BRB',
|
|
36
|
+
BN: 'BRN',
|
|
37
|
+
BT: 'BTN',
|
|
38
|
+
BW: 'BWA',
|
|
39
|
+
CF: 'CAF',
|
|
40
|
+
CA: 'CAN',
|
|
41
|
+
CC: 'CCK',
|
|
42
|
+
CH: 'CHE',
|
|
43
|
+
CL: 'CHL',
|
|
44
|
+
CN: 'CHN',
|
|
45
|
+
CI: 'CIV',
|
|
46
|
+
CM: 'CMR',
|
|
47
|
+
CD: 'COD',
|
|
48
|
+
CG: 'COG',
|
|
49
|
+
CK: 'COK',
|
|
50
|
+
CO: 'COL',
|
|
51
|
+
KM: 'COM',
|
|
52
|
+
CV: 'CPV',
|
|
53
|
+
CR: 'CRI',
|
|
54
|
+
CW: 'CUW',
|
|
55
|
+
CX: 'CXR',
|
|
56
|
+
KY: 'CYM',
|
|
57
|
+
CY: 'CYP',
|
|
58
|
+
CZ: 'CZE',
|
|
59
|
+
DE: 'DEU',
|
|
60
|
+
DJ: 'DJI',
|
|
61
|
+
DM: 'DMA',
|
|
62
|
+
DK: 'DNK',
|
|
63
|
+
DO: 'DOM',
|
|
64
|
+
DZ: 'DZA',
|
|
65
|
+
EC: 'ECU',
|
|
66
|
+
EG: 'EGY',
|
|
67
|
+
ER: 'ERI',
|
|
68
|
+
ES: 'ESP',
|
|
69
|
+
EE: 'EST',
|
|
70
|
+
ET: 'ETH',
|
|
71
|
+
FI: 'FIN',
|
|
72
|
+
FJ: 'FJI',
|
|
73
|
+
FK: 'FLK',
|
|
74
|
+
FR: 'FRA',
|
|
75
|
+
FO: 'FRO',
|
|
76
|
+
FM: 'FSM',
|
|
77
|
+
GA: 'GAB',
|
|
78
|
+
GB: 'GBR',
|
|
79
|
+
GE: 'GEO',
|
|
80
|
+
GG: 'GGY',
|
|
81
|
+
GH: 'GHA',
|
|
82
|
+
GI: 'GIB',
|
|
83
|
+
GN: 'GIN',
|
|
84
|
+
GP: 'GLP',
|
|
85
|
+
GM: 'GMB',
|
|
86
|
+
GW: 'GNB',
|
|
87
|
+
GQ: 'GNQ',
|
|
88
|
+
GR: 'GRC',
|
|
89
|
+
GD: 'GRD',
|
|
90
|
+
GL: 'GRL',
|
|
91
|
+
GT: 'GTM',
|
|
92
|
+
GF: 'GUF',
|
|
93
|
+
GU: 'GUM',
|
|
94
|
+
GY: 'GUY',
|
|
95
|
+
HK: 'HKG',
|
|
96
|
+
HN: 'HND',
|
|
97
|
+
HR: 'HRV',
|
|
98
|
+
HT: 'HTI',
|
|
99
|
+
HU: 'HUN',
|
|
100
|
+
ID: 'IDN',
|
|
101
|
+
IM: 'IMN',
|
|
102
|
+
IN: 'IND',
|
|
103
|
+
IO: 'IOT',
|
|
104
|
+
IE: 'IRL',
|
|
105
|
+
IS: 'ISL',
|
|
106
|
+
IL: 'ISR',
|
|
107
|
+
IT: 'ITA',
|
|
108
|
+
IQ: 'IRQ',
|
|
109
|
+
JM: 'JAM',
|
|
110
|
+
JE: 'JEY',
|
|
111
|
+
JO: 'JOR',
|
|
112
|
+
JP: 'JPN',
|
|
113
|
+
KZ: 'KAZ',
|
|
114
|
+
KE: 'KEN',
|
|
115
|
+
KG: 'KGZ',
|
|
116
|
+
KH: 'KHM',
|
|
117
|
+
KI: 'KIR',
|
|
118
|
+
KN: 'KNA',
|
|
119
|
+
KR: 'KOR',
|
|
120
|
+
KW: 'KWT',
|
|
121
|
+
LA: 'LAO',
|
|
122
|
+
LB: 'LBN',
|
|
123
|
+
LR: 'LBR',
|
|
124
|
+
LY: 'LBY',
|
|
125
|
+
LC: 'LCA',
|
|
126
|
+
LI: 'LIE',
|
|
127
|
+
LK: 'LKA',
|
|
128
|
+
LS: 'LSO',
|
|
129
|
+
LT: 'LTU',
|
|
130
|
+
LU: 'LUX',
|
|
131
|
+
LV: 'LVA',
|
|
132
|
+
MO: 'MAC',
|
|
133
|
+
MF: 'MAF',
|
|
134
|
+
MA: 'MAR',
|
|
135
|
+
MC: 'MCO',
|
|
136
|
+
MD: 'MDA',
|
|
137
|
+
MG: 'MDG',
|
|
138
|
+
MV: 'MDV',
|
|
139
|
+
MX: 'MEX',
|
|
140
|
+
MH: 'MHL',
|
|
141
|
+
MK: 'MKD',
|
|
142
|
+
ML: 'MLI',
|
|
143
|
+
MT: 'MLT',
|
|
144
|
+
MM: 'MMR',
|
|
145
|
+
ME: 'MNE',
|
|
146
|
+
MN: 'MNG',
|
|
147
|
+
MP: 'MNP',
|
|
148
|
+
MZ: 'MOZ',
|
|
149
|
+
MR: 'MRT',
|
|
150
|
+
MS: 'MSR',
|
|
151
|
+
MQ: 'MTQ',
|
|
152
|
+
MU: 'MUS',
|
|
153
|
+
MW: 'MWI',
|
|
154
|
+
MY: 'MYS',
|
|
155
|
+
YT: 'MYT',
|
|
156
|
+
NA: 'NAM',
|
|
157
|
+
NC: 'NCL',
|
|
158
|
+
NE: 'NER',
|
|
159
|
+
NF: 'NFK',
|
|
160
|
+
NG: 'NGA',
|
|
161
|
+
NI: 'NIC',
|
|
162
|
+
NU: 'NIU',
|
|
163
|
+
NL: 'NLD',
|
|
164
|
+
NO: 'NOR',
|
|
165
|
+
NP: 'NPL',
|
|
166
|
+
NR: 'NRU',
|
|
167
|
+
NZ: 'NZL',
|
|
168
|
+
OM: 'OMN',
|
|
169
|
+
PK: 'PAK',
|
|
170
|
+
PA: 'PAN',
|
|
171
|
+
PE: 'PER',
|
|
172
|
+
PH: 'PHL',
|
|
173
|
+
PW: 'PLW',
|
|
174
|
+
PG: 'PNG',
|
|
175
|
+
PL: 'POL',
|
|
176
|
+
PR: 'PRI',
|
|
177
|
+
PT: 'PRT',
|
|
178
|
+
PY: 'PRY',
|
|
179
|
+
PS: 'PSE',
|
|
180
|
+
PF: 'PYF',
|
|
181
|
+
QA: 'QAT',
|
|
182
|
+
RE: 'REU',
|
|
183
|
+
RO: 'ROU',
|
|
184
|
+
RU: 'RUS',
|
|
185
|
+
RW: 'RWA',
|
|
186
|
+
SA: 'SAU',
|
|
187
|
+
SD: 'SDN',
|
|
188
|
+
SN: 'SEN',
|
|
189
|
+
SG: 'SGP',
|
|
190
|
+
SH: 'SHN',
|
|
191
|
+
SJ: 'SJM',
|
|
192
|
+
SB: 'SLB',
|
|
193
|
+
SL: 'SLE',
|
|
194
|
+
SV: 'SLV',
|
|
195
|
+
SM: 'SMR',
|
|
196
|
+
SO: 'SOM',
|
|
197
|
+
PM: 'SPM',
|
|
198
|
+
RS: 'SRB',
|
|
199
|
+
SS: 'SSD',
|
|
200
|
+
ST: 'STP',
|
|
201
|
+
SR: 'SUR',
|
|
202
|
+
SK: 'SVK',
|
|
203
|
+
SI: 'SVN',
|
|
204
|
+
SE: 'SWE',
|
|
205
|
+
SZ: 'SWZ',
|
|
206
|
+
SX: 'SXM',
|
|
207
|
+
SC: 'SYC',
|
|
208
|
+
TC: 'TCA',
|
|
209
|
+
TD: 'TCD',
|
|
210
|
+
TG: 'TGO',
|
|
211
|
+
TH: 'THA',
|
|
212
|
+
TJ: 'TJK',
|
|
213
|
+
TK: 'TKL',
|
|
214
|
+
TM: 'TKM',
|
|
215
|
+
TL: 'TLS',
|
|
216
|
+
TO: 'TON',
|
|
217
|
+
TT: 'TTO',
|
|
218
|
+
TN: 'TUN',
|
|
219
|
+
TR: 'TUR',
|
|
220
|
+
TV: 'TUV',
|
|
221
|
+
TW: 'TWN',
|
|
222
|
+
TZ: 'TZA',
|
|
223
|
+
UG: 'UGA',
|
|
224
|
+
UA: 'UKR',
|
|
225
|
+
UY: 'URY',
|
|
226
|
+
US: 'USA',
|
|
227
|
+
UZ: 'UZB',
|
|
228
|
+
VA: 'VAT',
|
|
229
|
+
VC: 'VCT',
|
|
230
|
+
VE: 'VEN',
|
|
231
|
+
VG: 'VGB',
|
|
232
|
+
VI: 'VIR',
|
|
233
|
+
VN: 'VNM',
|
|
234
|
+
VU: 'VUT',
|
|
235
|
+
WF: 'WLF',
|
|
236
|
+
WS: 'WSM',
|
|
237
|
+
XK: 'KOS',
|
|
238
|
+
YE: 'YEM',
|
|
239
|
+
ZA: 'ZAF',
|
|
240
|
+
ZM: 'ZMB',
|
|
241
|
+
ZW: 'ZWE',
|
|
242
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Layout } from '../core/Form.js';
|
|
3
|
+
export interface FieldContextValue {
|
|
4
|
+
id: string;
|
|
5
|
+
layout: Layout;
|
|
6
|
+
gridStyles: {
|
|
7
|
+
label: React.CSSProperties;
|
|
8
|
+
input: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const FieldContext: React.Context<FieldContextValue | null>;
|
|
12
|
+
export declare function useFieldContext(): FieldContextValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FieldContext = void 0;
|
|
7
|
+
exports.useFieldContext = useFieldContext;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
exports.FieldContext = react_1.default.createContext(null);
|
|
10
|
+
function useFieldContext() {
|
|
11
|
+
const context = react_1.default.useContext(exports.FieldContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('Field components must be used within a Form.Field component');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Layout } from '../core/Form.js';
|
|
3
|
+
export interface FieldLayoutMap {
|
|
4
|
+
[fieldId: string]: Layout;
|
|
5
|
+
}
|
|
6
|
+
export declare const FieldLayoutContext: React.Context<FieldLayoutMap | null>;
|
|
7
|
+
export interface FieldLayoutProviderProps {
|
|
8
|
+
value: FieldLayoutMap;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const FieldLayoutProvider: React.FC<FieldLayoutProviderProps>;
|
|
12
|
+
export declare function useFieldLayout(fieldId: string): Layout | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FieldLayoutProvider = exports.FieldLayoutContext = void 0;
|
|
7
|
+
exports.useFieldLayout = useFieldLayout;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
exports.FieldLayoutContext = react_1.default.createContext(null);
|
|
11
|
+
const FieldLayoutProvider = ({ value, children, }) => {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(exports.FieldLayoutContext.Provider, { value: value, children: children }));
|
|
13
|
+
};
|
|
14
|
+
exports.FieldLayoutProvider = FieldLayoutProvider;
|
|
15
|
+
function useFieldLayout(fieldId) {
|
|
16
|
+
const layoutMap = react_1.default.useContext(exports.FieldLayoutContext);
|
|
17
|
+
if (!layoutMap) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return layoutMap[fieldId] || null;
|
|
21
|
+
}
|