@react-spectrum/form 3.0.0-nightly.2519 → 3.0.0-nightly.2531
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/dist/import.mjs +105 -61
- package/dist/main.js +104 -60
- package/dist/main.js.map +1 -1
- package/dist/module.js +105 -61
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/Form.tsx +14 -4
package/dist/import.mjs
CHANGED
|
@@ -1,71 +1,83 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {useStyleProps as $011V3$useStyleProps, useDOMRef as $011V3$useDOMRef, classNames as $011V3$classNames} from "@react-spectrum/utils";
|
|
3
3
|
import {filterDOMProps as $011V3$filterDOMProps} from "@react-aria/utils";
|
|
4
|
+
import {FormValidationContext as $011V3$FormValidationContext} from "@react-stately/form";
|
|
4
5
|
import {useProviderProps as $011V3$useProviderProps, Provider as $011V3$Provider} from "@react-spectrum/provider";
|
|
5
6
|
import $011V3$react, {useContext as $011V3$useContext} from "react";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
return a && a.__esModule ? a.default : a;
|
|
9
|
-
}
|
|
8
|
+
|
|
10
9
|
function $parcel$export(e, n, v, s) {
|
|
11
10
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
11
|
}
|
|
13
|
-
/*
|
|
14
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
-
* governing permissions and limitations under the License.
|
|
23
|
-
*/ /// <reference types="css-module-types" />
|
|
24
|
-
/*
|
|
25
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
26
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
27
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
28
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
-
*
|
|
30
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
31
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
32
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
33
|
-
* governing permissions and limitations under the License.
|
|
34
|
-
*/
|
|
35
12
|
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var $parcel$global = globalThis;
|
|
18
|
+
|
|
19
|
+
var $parcel$modules = {};
|
|
20
|
+
var $parcel$inits = {};
|
|
21
|
+
|
|
22
|
+
var parcelRequire = $parcel$global["parcelRequire7f0c"];
|
|
36
23
|
|
|
24
|
+
if (parcelRequire == null) {
|
|
25
|
+
parcelRequire = function(id) {
|
|
26
|
+
if (id in $parcel$modules) {
|
|
27
|
+
return $parcel$modules[id].exports;
|
|
28
|
+
}
|
|
29
|
+
if (id in $parcel$inits) {
|
|
30
|
+
var init = $parcel$inits[id];
|
|
31
|
+
delete $parcel$inits[id];
|
|
32
|
+
var module = {id: id, exports: {}};
|
|
33
|
+
$parcel$modules[id] = module;
|
|
34
|
+
init.call(module.exports, module, module.exports);
|
|
35
|
+
return module.exports;
|
|
36
|
+
}
|
|
37
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
38
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
39
|
+
throw err;
|
|
40
|
+
};
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
$parcel$
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$parcel$export(
|
|
49
|
-
$parcel$export(
|
|
50
|
-
$parcel$export(
|
|
51
|
-
$parcel$export(
|
|
52
|
-
$parcel$export(
|
|
53
|
-
$parcel$export(
|
|
54
|
-
$parcel$export(
|
|
55
|
-
$parcel$export(
|
|
56
|
-
$parcel$export(
|
|
57
|
-
$parcel$export(
|
|
58
|
-
$parcel$export(
|
|
59
|
-
$parcel$export(
|
|
60
|
-
$parcel$export(
|
|
61
|
-
$parcel$export(
|
|
62
|
-
$parcel$export(
|
|
63
|
-
$parcel$export(
|
|
64
|
-
$parcel$export(
|
|
65
|
-
$parcel$export(
|
|
66
|
-
$parcel$export(
|
|
67
|
-
$parcel$export(
|
|
68
|
-
$parcel$export(
|
|
42
|
+
parcelRequire.register = function register(id, init) {
|
|
43
|
+
$parcel$inits[id] = init;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
$parcel$global["parcelRequire7f0c"] = parcelRequire;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var parcelRegister = parcelRequire.register;
|
|
50
|
+
parcelRegister("hBWiT", function(module, exports) {
|
|
51
|
+
|
|
52
|
+
$parcel$export(module.exports, "contextualHelp", () => $cd231e464c886c86$export$4ba534aba1836d, (v) => $cd231e464c886c86$export$4ba534aba1836d = v);
|
|
53
|
+
$parcel$export(module.exports, "field", () => $cd231e464c886c86$export$e0f35d825088c098, (v) => $cd231e464c886c86$export$e0f35d825088c098 = v);
|
|
54
|
+
$parcel$export(module.exports, "focus-ring", () => $cd231e464c886c86$export$f39a09f249340e2a, (v) => $cd231e464c886c86$export$f39a09f249340e2a = v);
|
|
55
|
+
$parcel$export(module.exports, "helpText", () => $cd231e464c886c86$export$431a3b688422af44, (v) => $cd231e464c886c86$export$431a3b688422af44 = v);
|
|
56
|
+
$parcel$export(module.exports, "i18nFontFamily", () => $cd231e464c886c86$export$8c4ee2c50c22c514, (v) => $cd231e464c886c86$export$8c4ee2c50c22c514 = v);
|
|
57
|
+
$parcel$export(module.exports, "is-disabled", () => $cd231e464c886c86$export$d35bc1e505d1ebbf, (v) => $cd231e464c886c86$export$d35bc1e505d1ebbf = v);
|
|
58
|
+
$parcel$export(module.exports, "label", () => $cd231e464c886c86$export$1237798dc640739a, (v) => $cd231e464c886c86$export$1237798dc640739a = v);
|
|
59
|
+
$parcel$export(module.exports, "spectrum-Field", () => $cd231e464c886c86$export$f6d480ae1e56eba0, (v) => $cd231e464c886c86$export$f6d480ae1e56eba0 = v);
|
|
60
|
+
$parcel$export(module.exports, "spectrum-Field--alignEnd", () => $cd231e464c886c86$export$5354c9be7ada5f83, (v) => $cd231e464c886c86$export$5354c9be7ada5f83 = v);
|
|
61
|
+
$parcel$export(module.exports, "spectrum-Field--hasContextualHelp", () => $cd231e464c886c86$export$9ba23707a252cdd4, (v) => $cd231e464c886c86$export$9ba23707a252cdd4 = v);
|
|
62
|
+
$parcel$export(module.exports, "spectrum-Field--positionSide", () => $cd231e464c886c86$export$2963225c91179589, (v) => $cd231e464c886c86$export$2963225c91179589 = v);
|
|
63
|
+
$parcel$export(module.exports, "spectrum-Field--positionTop", () => $cd231e464c886c86$export$a4ea780a9064d7f9, (v) => $cd231e464c886c86$export$a4ea780a9064d7f9 = v);
|
|
64
|
+
$parcel$export(module.exports, "spectrum-Field-contextualHelp", () => $cd231e464c886c86$export$24fb860d16dd2d3f, (v) => $cd231e464c886c86$export$24fb860d16dd2d3f = v);
|
|
65
|
+
$parcel$export(module.exports, "spectrum-Field-field", () => $cd231e464c886c86$export$3ab8a3dc7f0563d, (v) => $cd231e464c886c86$export$3ab8a3dc7f0563d = v);
|
|
66
|
+
$parcel$export(module.exports, "spectrum-Field-labelCell", () => $cd231e464c886c86$export$9cde5aecff012641, (v) => $cd231e464c886c86$export$9cde5aecff012641 = v);
|
|
67
|
+
$parcel$export(module.exports, "spectrum-Field-labelWrapper", () => $cd231e464c886c86$export$a872a8c78b26c9e0, (v) => $cd231e464c886c86$export$a872a8c78b26c9e0 = v);
|
|
68
|
+
$parcel$export(module.exports, "spectrum-Field-wrapper", () => $cd231e464c886c86$export$127df0b7290eb8ef, (v) => $cd231e464c886c86$export$127df0b7290eb8ef = v);
|
|
69
|
+
$parcel$export(module.exports, "spectrum-FieldLabel", () => $cd231e464c886c86$export$493d18e796ae054, (v) => $cd231e464c886c86$export$493d18e796ae054 = v);
|
|
70
|
+
$parcel$export(module.exports, "spectrum-FieldLabel--alignEnd", () => $cd231e464c886c86$export$885efcc08143a987, (v) => $cd231e464c886c86$export$885efcc08143a987 = v);
|
|
71
|
+
$parcel$export(module.exports, "spectrum-FieldLabel--positionSide", () => $cd231e464c886c86$export$9e6f19dc21f22f2e, (v) => $cd231e464c886c86$export$9e6f19dc21f22f2e = v);
|
|
72
|
+
$parcel$export(module.exports, "spectrum-FieldLabel-requiredIcon", () => $cd231e464c886c86$export$7c47642c7d46f3c9, (v) => $cd231e464c886c86$export$7c47642c7d46f3c9 = v);
|
|
73
|
+
$parcel$export(module.exports, "spectrum-FocusRing-ring", () => $cd231e464c886c86$export$4109102f950813a6, (v) => $cd231e464c886c86$export$4109102f950813a6 = v);
|
|
74
|
+
$parcel$export(module.exports, "spectrum-FocusRing", () => $cd231e464c886c86$export$24c7f46a6e3605dd, (v) => $cd231e464c886c86$export$24c7f46a6e3605dd = v);
|
|
75
|
+
$parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $cd231e464c886c86$export$2927016961429360, (v) => $cd231e464c886c86$export$2927016961429360 = v);
|
|
76
|
+
$parcel$export(module.exports, "spectrum-Form", () => $cd231e464c886c86$export$94d2bcc94afabd89, (v) => $cd231e464c886c86$export$94d2bcc94afabd89 = v);
|
|
77
|
+
$parcel$export(module.exports, "spectrum-Form--positionSide", () => $cd231e464c886c86$export$7f44db659563c8f4, (v) => $cd231e464c886c86$export$7f44db659563c8f4 = v);
|
|
78
|
+
$parcel$export(module.exports, "spectrum-Form--positionTop", () => $cd231e464c886c86$export$11b8bc81fe551057, (v) => $cd231e464c886c86$export$11b8bc81fe551057 = v);
|
|
79
|
+
$parcel$export(module.exports, "spectrum-Form-itemLabel", () => $cd231e464c886c86$export$51ec27881a1e3928, (v) => $cd231e464c886c86$export$51ec27881a1e3928 = v);
|
|
80
|
+
$parcel$export(module.exports, "spectrum-LabeledValue", () => $cd231e464c886c86$export$79f9a5e9dd010c8d, (v) => $cd231e464c886c86$export$79f9a5e9dd010c8d = v);
|
|
69
81
|
var $cd231e464c886c86$export$4ba534aba1836d;
|
|
70
82
|
var $cd231e464c886c86$export$e0f35d825088c098;
|
|
71
83
|
var $cd231e464c886c86$export$f39a09f249340e2a;
|
|
@@ -125,7 +137,36 @@ $cd231e464c886c86$export$11b8bc81fe551057 = `A-HlBa_spectrum-Form--positionTop`;
|
|
|
125
137
|
$cd231e464c886c86$export$51ec27881a1e3928 = `A-HlBa_spectrum-Form-itemLabel`;
|
|
126
138
|
$cd231e464c886c86$export$79f9a5e9dd010c8d = `A-HlBa_spectrum-LabeledValue`;
|
|
127
139
|
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
144
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
145
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
146
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
147
|
+
*
|
|
148
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
149
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
150
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
151
|
+
* governing permissions and limitations under the License.
|
|
152
|
+
*/ /// <reference types="css-module-types" />
|
|
153
|
+
/*
|
|
154
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
155
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
156
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
157
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
158
|
+
*
|
|
159
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
160
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
161
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
162
|
+
* governing permissions and limitations under the License.
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
128
168
|
|
|
169
|
+
var $hBWiT = parcelRequire("hBWiT");
|
|
129
170
|
let $ac118ceca79b8650$var$FormContext = /*#__PURE__*/ (0, $011V3$react).createContext(null);
|
|
130
171
|
function $ac118ceca79b8650$export$a6b5be5c6b451665(props) {
|
|
131
172
|
let ctx = (0, $011V3$useContext)($ac118ceca79b8650$var$FormContext);
|
|
@@ -145,13 +186,14 @@ const $ac118ceca79b8650$var$formPropNames = new Set([
|
|
|
145
186
|
]);
|
|
146
187
|
function $ac118ceca79b8650$var$Form(props, ref) {
|
|
147
188
|
props = (0, $011V3$useProviderProps)(props);
|
|
148
|
-
let { children: children, labelPosition: labelPosition = "top", labelAlign: labelAlign = "start", isRequired: isRequired, necessityIndicator: necessityIndicator, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isReadOnly: isReadOnly, validationState: validationState, ...otherProps } = props;
|
|
189
|
+
let { children: children, labelPosition: labelPosition = "top", labelAlign: labelAlign = "start", isRequired: isRequired, necessityIndicator: necessityIndicator, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isReadOnly: isReadOnly, validationState: validationState, validationBehavior: validationBehavior, validationErrors: validationErrors, ...otherProps } = props;
|
|
149
190
|
let { styleProps: styleProps } = (0, $011V3$useStyleProps)(otherProps);
|
|
150
191
|
let domRef = (0, $011V3$useDOMRef)(ref);
|
|
151
192
|
let ctx = {
|
|
152
193
|
labelPosition: labelPosition,
|
|
153
194
|
labelAlign: labelAlign,
|
|
154
|
-
necessityIndicator: necessityIndicator
|
|
195
|
+
necessityIndicator: necessityIndicator,
|
|
196
|
+
validationBehavior: validationBehavior
|
|
155
197
|
};
|
|
156
198
|
return /*#__PURE__*/ (0, $011V3$react).createElement("form", {
|
|
157
199
|
...(0, $011V3$filterDOMProps)(otherProps, {
|
|
@@ -159,9 +201,9 @@ function $ac118ceca79b8650$var$Form(props, ref) {
|
|
|
159
201
|
propNames: $ac118ceca79b8650$var$formPropNames
|
|
160
202
|
}),
|
|
161
203
|
...styleProps,
|
|
162
|
-
noValidate:
|
|
204
|
+
noValidate: validationBehavior !== "native",
|
|
163
205
|
ref: domRef,
|
|
164
|
-
className: (0, $011V3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
206
|
+
className: (0, $011V3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($hBWiT))), "spectrum-Form", {
|
|
165
207
|
"spectrum-Form--positionSide": labelPosition === "side",
|
|
166
208
|
"spectrum-Form--positionTop": labelPosition === "top"
|
|
167
209
|
}, styleProps.className)
|
|
@@ -174,7 +216,9 @@ function $ac118ceca79b8650$var$Form(props, ref) {
|
|
|
174
216
|
isReadOnly: isReadOnly,
|
|
175
217
|
isRequired: isRequired,
|
|
176
218
|
validationState: validationState
|
|
177
|
-
},
|
|
219
|
+
}, /*#__PURE__*/ (0, $011V3$react).createElement((0, $011V3$FormValidationContext).Provider, {
|
|
220
|
+
value: validationErrors || {}
|
|
221
|
+
}, children))));
|
|
178
222
|
}
|
|
179
223
|
/**
|
|
180
224
|
* Forms allow users to enter data that can be submitted while providing alignment and styling for form fields.
|
package/dist/main.js
CHANGED
|
@@ -1,74 +1,83 @@
|
|
|
1
1
|
require("./main.css");
|
|
2
2
|
var $eLNG1$reactspectrumutils = require("@react-spectrum/utils");
|
|
3
3
|
var $eLNG1$reactariautils = require("@react-aria/utils");
|
|
4
|
+
var $eLNG1$reactstatelyform = require("@react-stately/form");
|
|
4
5
|
var $eLNG1$reactspectrumprovider = require("@react-spectrum/provider");
|
|
5
6
|
var $eLNG1$react = require("react");
|
|
6
7
|
|
|
8
|
+
|
|
7
9
|
function $parcel$export(e, n, v, s) {
|
|
8
10
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
11
|
}
|
|
12
|
+
|
|
10
13
|
function $parcel$interopDefault(a) {
|
|
11
14
|
return a && a.__esModule ? a.default : a;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
$parcel$
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/ /// <reference types="css-module-types" />
|
|
27
|
-
/*
|
|
28
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
29
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
30
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
31
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
32
|
-
*
|
|
33
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
34
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
35
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
36
|
-
* governing permissions and limitations under the License.
|
|
37
|
-
*/
|
|
17
|
+
var $parcel$global = globalThis;
|
|
18
|
+
|
|
19
|
+
var $parcel$modules = {};
|
|
20
|
+
var $parcel$inits = {};
|
|
21
|
+
|
|
22
|
+
var parcelRequire = $parcel$global["parcelRequire7f0c"];
|
|
38
23
|
|
|
24
|
+
if (parcelRequire == null) {
|
|
25
|
+
parcelRequire = function(id) {
|
|
26
|
+
if (id in $parcel$modules) {
|
|
27
|
+
return $parcel$modules[id].exports;
|
|
28
|
+
}
|
|
29
|
+
if (id in $parcel$inits) {
|
|
30
|
+
var init = $parcel$inits[id];
|
|
31
|
+
delete $parcel$inits[id];
|
|
32
|
+
var module = {id: id, exports: {}};
|
|
33
|
+
$parcel$modules[id] = module;
|
|
34
|
+
init.call(module.exports, module, module.exports);
|
|
35
|
+
return module.exports;
|
|
36
|
+
}
|
|
37
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
38
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
39
|
+
throw err;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
parcelRequire.register = function register(id, init) {
|
|
43
|
+
$parcel$inits[id] = init;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
$parcel$global["parcelRequire7f0c"] = parcelRequire;
|
|
47
|
+
}
|
|
39
48
|
|
|
49
|
+
var parcelRegister = parcelRequire.register;
|
|
50
|
+
parcelRegister("kbTks", function(module, exports) {
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
$parcel$export(
|
|
44
|
-
$parcel$export(
|
|
45
|
-
$parcel$export(
|
|
46
|
-
$parcel$export(
|
|
47
|
-
$parcel$export(
|
|
48
|
-
$parcel$export(
|
|
49
|
-
$parcel$export(
|
|
50
|
-
$parcel$export(
|
|
51
|
-
$parcel$export(
|
|
52
|
-
$parcel$export(
|
|
53
|
-
$parcel$export(
|
|
54
|
-
$parcel$export(
|
|
55
|
-
$parcel$export(
|
|
56
|
-
$parcel$export(
|
|
57
|
-
$parcel$export(
|
|
58
|
-
$parcel$export(
|
|
59
|
-
$parcel$export(
|
|
60
|
-
$parcel$export(
|
|
61
|
-
$parcel$export(
|
|
62
|
-
$parcel$export(
|
|
63
|
-
$parcel$export(
|
|
64
|
-
$parcel$export(
|
|
65
|
-
$parcel$export(
|
|
66
|
-
$parcel$export(
|
|
67
|
-
$parcel$export(
|
|
68
|
-
$parcel$export(
|
|
69
|
-
$parcel$export(
|
|
70
|
-
$parcel$export($eb2fc0ee655eff6b$exports, "spectrum-Form-itemLabel", () => $eb2fc0ee655eff6b$export$51ec27881a1e3928, (v) => $eb2fc0ee655eff6b$export$51ec27881a1e3928 = v);
|
|
71
|
-
$parcel$export($eb2fc0ee655eff6b$exports, "spectrum-LabeledValue", () => $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d, (v) => $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d = v);
|
|
52
|
+
$parcel$export(module.exports, "contextualHelp", () => $eb2fc0ee655eff6b$export$4ba534aba1836d, (v) => $eb2fc0ee655eff6b$export$4ba534aba1836d = v);
|
|
53
|
+
$parcel$export(module.exports, "field", () => $eb2fc0ee655eff6b$export$e0f35d825088c098, (v) => $eb2fc0ee655eff6b$export$e0f35d825088c098 = v);
|
|
54
|
+
$parcel$export(module.exports, "focus-ring", () => $eb2fc0ee655eff6b$export$f39a09f249340e2a, (v) => $eb2fc0ee655eff6b$export$f39a09f249340e2a = v);
|
|
55
|
+
$parcel$export(module.exports, "helpText", () => $eb2fc0ee655eff6b$export$431a3b688422af44, (v) => $eb2fc0ee655eff6b$export$431a3b688422af44 = v);
|
|
56
|
+
$parcel$export(module.exports, "i18nFontFamily", () => $eb2fc0ee655eff6b$export$8c4ee2c50c22c514, (v) => $eb2fc0ee655eff6b$export$8c4ee2c50c22c514 = v);
|
|
57
|
+
$parcel$export(module.exports, "is-disabled", () => $eb2fc0ee655eff6b$export$d35bc1e505d1ebbf, (v) => $eb2fc0ee655eff6b$export$d35bc1e505d1ebbf = v);
|
|
58
|
+
$parcel$export(module.exports, "label", () => $eb2fc0ee655eff6b$export$1237798dc640739a, (v) => $eb2fc0ee655eff6b$export$1237798dc640739a = v);
|
|
59
|
+
$parcel$export(module.exports, "spectrum-Field", () => $eb2fc0ee655eff6b$export$f6d480ae1e56eba0, (v) => $eb2fc0ee655eff6b$export$f6d480ae1e56eba0 = v);
|
|
60
|
+
$parcel$export(module.exports, "spectrum-Field--alignEnd", () => $eb2fc0ee655eff6b$export$5354c9be7ada5f83, (v) => $eb2fc0ee655eff6b$export$5354c9be7ada5f83 = v);
|
|
61
|
+
$parcel$export(module.exports, "spectrum-Field--hasContextualHelp", () => $eb2fc0ee655eff6b$export$9ba23707a252cdd4, (v) => $eb2fc0ee655eff6b$export$9ba23707a252cdd4 = v);
|
|
62
|
+
$parcel$export(module.exports, "spectrum-Field--positionSide", () => $eb2fc0ee655eff6b$export$2963225c91179589, (v) => $eb2fc0ee655eff6b$export$2963225c91179589 = v);
|
|
63
|
+
$parcel$export(module.exports, "spectrum-Field--positionTop", () => $eb2fc0ee655eff6b$export$a4ea780a9064d7f9, (v) => $eb2fc0ee655eff6b$export$a4ea780a9064d7f9 = v);
|
|
64
|
+
$parcel$export(module.exports, "spectrum-Field-contextualHelp", () => $eb2fc0ee655eff6b$export$24fb860d16dd2d3f, (v) => $eb2fc0ee655eff6b$export$24fb860d16dd2d3f = v);
|
|
65
|
+
$parcel$export(module.exports, "spectrum-Field-field", () => $eb2fc0ee655eff6b$export$3ab8a3dc7f0563d, (v) => $eb2fc0ee655eff6b$export$3ab8a3dc7f0563d = v);
|
|
66
|
+
$parcel$export(module.exports, "spectrum-Field-labelCell", () => $eb2fc0ee655eff6b$export$9cde5aecff012641, (v) => $eb2fc0ee655eff6b$export$9cde5aecff012641 = v);
|
|
67
|
+
$parcel$export(module.exports, "spectrum-Field-labelWrapper", () => $eb2fc0ee655eff6b$export$a872a8c78b26c9e0, (v) => $eb2fc0ee655eff6b$export$a872a8c78b26c9e0 = v);
|
|
68
|
+
$parcel$export(module.exports, "spectrum-Field-wrapper", () => $eb2fc0ee655eff6b$export$127df0b7290eb8ef, (v) => $eb2fc0ee655eff6b$export$127df0b7290eb8ef = v);
|
|
69
|
+
$parcel$export(module.exports, "spectrum-FieldLabel", () => $eb2fc0ee655eff6b$export$493d18e796ae054, (v) => $eb2fc0ee655eff6b$export$493d18e796ae054 = v);
|
|
70
|
+
$parcel$export(module.exports, "spectrum-FieldLabel--alignEnd", () => $eb2fc0ee655eff6b$export$885efcc08143a987, (v) => $eb2fc0ee655eff6b$export$885efcc08143a987 = v);
|
|
71
|
+
$parcel$export(module.exports, "spectrum-FieldLabel--positionSide", () => $eb2fc0ee655eff6b$export$9e6f19dc21f22f2e, (v) => $eb2fc0ee655eff6b$export$9e6f19dc21f22f2e = v);
|
|
72
|
+
$parcel$export(module.exports, "spectrum-FieldLabel-requiredIcon", () => $eb2fc0ee655eff6b$export$7c47642c7d46f3c9, (v) => $eb2fc0ee655eff6b$export$7c47642c7d46f3c9 = v);
|
|
73
|
+
$parcel$export(module.exports, "spectrum-FocusRing-ring", () => $eb2fc0ee655eff6b$export$4109102f950813a6, (v) => $eb2fc0ee655eff6b$export$4109102f950813a6 = v);
|
|
74
|
+
$parcel$export(module.exports, "spectrum-FocusRing", () => $eb2fc0ee655eff6b$export$24c7f46a6e3605dd, (v) => $eb2fc0ee655eff6b$export$24c7f46a6e3605dd = v);
|
|
75
|
+
$parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $eb2fc0ee655eff6b$export$2927016961429360, (v) => $eb2fc0ee655eff6b$export$2927016961429360 = v);
|
|
76
|
+
$parcel$export(module.exports, "spectrum-Form", () => $eb2fc0ee655eff6b$export$94d2bcc94afabd89, (v) => $eb2fc0ee655eff6b$export$94d2bcc94afabd89 = v);
|
|
77
|
+
$parcel$export(module.exports, "spectrum-Form--positionSide", () => $eb2fc0ee655eff6b$export$7f44db659563c8f4, (v) => $eb2fc0ee655eff6b$export$7f44db659563c8f4 = v);
|
|
78
|
+
$parcel$export(module.exports, "spectrum-Form--positionTop", () => $eb2fc0ee655eff6b$export$11b8bc81fe551057, (v) => $eb2fc0ee655eff6b$export$11b8bc81fe551057 = v);
|
|
79
|
+
$parcel$export(module.exports, "spectrum-Form-itemLabel", () => $eb2fc0ee655eff6b$export$51ec27881a1e3928, (v) => $eb2fc0ee655eff6b$export$51ec27881a1e3928 = v);
|
|
80
|
+
$parcel$export(module.exports, "spectrum-LabeledValue", () => $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d, (v) => $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d = v);
|
|
72
81
|
var $eb2fc0ee655eff6b$export$4ba534aba1836d;
|
|
73
82
|
var $eb2fc0ee655eff6b$export$e0f35d825088c098;
|
|
74
83
|
var $eb2fc0ee655eff6b$export$f39a09f249340e2a;
|
|
@@ -128,7 +137,39 @@ $eb2fc0ee655eff6b$export$11b8bc81fe551057 = `A-HlBa_spectrum-Form--positionTop`;
|
|
|
128
137
|
$eb2fc0ee655eff6b$export$51ec27881a1e3928 = `A-HlBa_spectrum-Form-itemLabel`;
|
|
129
138
|
$eb2fc0ee655eff6b$export$79f9a5e9dd010c8d = `A-HlBa_spectrum-LabeledValue`;
|
|
130
139
|
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
$parcel$export(module.exports, "useFormProps", () => $d981bcab8e24f2f3$export$a6b5be5c6b451665);
|
|
144
|
+
$parcel$export(module.exports, "Form", () => $d981bcab8e24f2f3$export$a7fed597f4b8afd8);
|
|
145
|
+
/*
|
|
146
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
147
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
148
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
149
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
150
|
+
*
|
|
151
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
152
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
153
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
154
|
+
* governing permissions and limitations under the License.
|
|
155
|
+
*/ /// <reference types="css-module-types" />
|
|
156
|
+
/*
|
|
157
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
158
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
159
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
160
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
161
|
+
*
|
|
162
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
163
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
164
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
165
|
+
* governing permissions and limitations under the License.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
131
171
|
|
|
172
|
+
var $kbTks = parcelRequire("kbTks");
|
|
132
173
|
let $d981bcab8e24f2f3$var$FormContext = /*#__PURE__*/ (0, ($parcel$interopDefault($eLNG1$react))).createContext(null);
|
|
133
174
|
function $d981bcab8e24f2f3$export$a6b5be5c6b451665(props) {
|
|
134
175
|
let ctx = (0, $eLNG1$react.useContext)($d981bcab8e24f2f3$var$FormContext);
|
|
@@ -148,13 +189,14 @@ const $d981bcab8e24f2f3$var$formPropNames = new Set([
|
|
|
148
189
|
]);
|
|
149
190
|
function $d981bcab8e24f2f3$var$Form(props, ref) {
|
|
150
191
|
props = (0, $eLNG1$reactspectrumprovider.useProviderProps)(props);
|
|
151
|
-
let { children: children, labelPosition: labelPosition = "top", labelAlign: labelAlign = "start", isRequired: isRequired, necessityIndicator: necessityIndicator, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isReadOnly: isReadOnly, validationState: validationState, ...otherProps } = props;
|
|
192
|
+
let { children: children, labelPosition: labelPosition = "top", labelAlign: labelAlign = "start", isRequired: isRequired, necessityIndicator: necessityIndicator, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isReadOnly: isReadOnly, validationState: validationState, validationBehavior: validationBehavior, validationErrors: validationErrors, ...otherProps } = props;
|
|
152
193
|
let { styleProps: styleProps } = (0, $eLNG1$reactspectrumutils.useStyleProps)(otherProps);
|
|
153
194
|
let domRef = (0, $eLNG1$reactspectrumutils.useDOMRef)(ref);
|
|
154
195
|
let ctx = {
|
|
155
196
|
labelPosition: labelPosition,
|
|
156
197
|
labelAlign: labelAlign,
|
|
157
|
-
necessityIndicator: necessityIndicator
|
|
198
|
+
necessityIndicator: necessityIndicator,
|
|
199
|
+
validationBehavior: validationBehavior
|
|
158
200
|
};
|
|
159
201
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($eLNG1$react))).createElement("form", {
|
|
160
202
|
...(0, $eLNG1$reactariautils.filterDOMProps)(otherProps, {
|
|
@@ -162,9 +204,9 @@ function $d981bcab8e24f2f3$var$Form(props, ref) {
|
|
|
162
204
|
propNames: $d981bcab8e24f2f3$var$formPropNames
|
|
163
205
|
}),
|
|
164
206
|
...styleProps,
|
|
165
|
-
noValidate:
|
|
207
|
+
noValidate: validationBehavior !== "native",
|
|
166
208
|
ref: domRef,
|
|
167
|
-
className: (0, $eLNG1$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
209
|
+
className: (0, $eLNG1$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($kbTks))), "spectrum-Form", {
|
|
168
210
|
"spectrum-Form--positionSide": labelPosition === "side",
|
|
169
211
|
"spectrum-Form--positionTop": labelPosition === "top"
|
|
170
212
|
}, styleProps.className)
|
|
@@ -177,7 +219,9 @@ function $d981bcab8e24f2f3$var$Form(props, ref) {
|
|
|
177
219
|
isReadOnly: isReadOnly,
|
|
178
220
|
isRequired: isRequired,
|
|
179
221
|
validationState: validationState
|
|
180
|
-
},
|
|
222
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($eLNG1$react))).createElement((0, $eLNG1$reactstatelyform.FormValidationContext).Provider, {
|
|
223
|
+
value: validationErrors || {}
|
|
224
|
+
}, children))));
|
|
181
225
|
}
|
|
182
226
|
/**
|
|
183
227
|
* Forms allow users to enter data that can be submitted while providing alignment and styling for form f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L,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,6CAAK,GACL,iBACA;YACE,+BAA+B,kBAAkB;YACjD,8BAA8B,kBAAkB;QAClD,GACA,WAAW,SAAS;qBAGxB,0DAAC,kCAAY,QAAQ;QAAC,OAAO;qBAC3B,0DAAC,CAAA,GAAA,qCAAO;QACN,SAAS;QACT,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,iBAAiB;qBACjB,0DAAC,CAAA,GAAA,6CAAoB,EAAE,QAAQ;QAAC,OAAO,oBAAoB,CAAC;OACzD;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAQ,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;","sources":["packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","packages/@react-spectrum/form/src/index.ts","packages/@react-spectrum/form/src/Form.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {useFormProps, Form} from './Form';\nexport type {SpectrumFormProps} from '@react-types/form';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Alignment, DOMRef, LabelPosition, SpectrumLabelableProps} from '@react-types/shared';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormValidationContext} from '@react-stately/form';\nimport {Provider, useProviderProps} from '@react-spectrum/provider';\nimport React, {useContext} from 'react';\nimport {SpectrumFormProps} from '@react-types/form';\nimport styles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\n\ninterface FormContextValue extends SpectrumLabelableProps {\n validationBehavior?: 'aria' | 'native'\n}\n\nlet FormContext = React.createContext<FormContextValue | null>(null);\nexport function useFormProps<T extends SpectrumLabelableProps>(props: T): T {\n let ctx = useContext(FormContext);\n if (ctx) {\n return {...ctx, ...props};\n }\n\n return props;\n}\n\nconst formPropNames = new Set([\n 'action',\n 'autoComplete',\n 'encType',\n 'method',\n 'target',\n 'onSubmit'\n]);\n\nfunction Form(props: SpectrumFormProps, ref: DOMRef<HTMLFormElement>) {\n props = useProviderProps(props);\n let {\n children,\n labelPosition = 'top' as LabelPosition,\n labelAlign = 'start' as Alignment,\n isRequired,\n necessityIndicator,\n isQuiet,\n isEmphasized,\n isDisabled,\n isReadOnly,\n validationState,\n validationBehavior,\n validationErrors,\n ...otherProps\n } = props;\n\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n\n let ctx = {\n labelPosition,\n labelAlign,\n necessityIndicator,\n validationBehavior\n };\n\n return (\n <form\n {...filterDOMProps(otherProps, {labelable: true, propNames: formPropNames})}\n {...styleProps}\n noValidate={validationBehavior !== 'native'}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Form',\n {\n 'spectrum-Form--positionSide': labelPosition === 'side',\n 'spectrum-Form--positionTop': labelPosition === 'top'\n },\n styleProps.className\n )\n }>\n <FormContext.Provider value={ctx}>\n <Provider\n isQuiet={isQuiet}\n isEmphasized={isEmphasized}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n validationState={validationState}>\n <FormValidationContext.Provider value={validationErrors || {}}>\n {children}\n </FormValidationContext.Provider>\n </Provider>\n </FormContext.Provider>\n </form>\n );\n}\n\n/**\n * Forms allow users to enter data that can be submitted while providing alignment and styling for form fields.\n */\nconst _Form = React.forwardRef(Form);\nexport {_Form as Form};\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,71 +1,83 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {useStyleProps as $011V3$useStyleProps, useDOMRef as $011V3$useDOMRef, classNames as $011V3$classNames} from "@react-spectrum/utils";
|
|
3
3
|
import {filterDOMProps as $011V3$filterDOMProps} from "@react-aria/utils";
|
|
4
|
+
import {FormValidationContext as $011V3$FormValidationContext} from "@react-stately/form";
|
|
4
5
|
import {useProviderProps as $011V3$useProviderProps, Provider as $011V3$Provider} from "@react-spectrum/provider";
|
|
5
6
|
import $011V3$react, {useContext as $011V3$useContext} from "react";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
return a && a.__esModule ? a.default : a;
|
|
9
|
-
}
|
|
8
|
+
|
|
10
9
|
function $parcel$export(e, n, v, s) {
|
|
11
10
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
11
|
}
|
|
13
|
-
/*
|
|
14
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
-
* governing permissions and limitations under the License.
|
|
23
|
-
*/ /// <reference types="css-module-types" />
|
|
24
|
-
/*
|
|
25
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
26
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
27
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
28
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
-
*
|
|
30
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
31
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
32
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
33
|
-
* governing permissions and limitations under the License.
|
|
34
|
-
*/
|
|
35
12
|
|
|
13
|
+
function $parcel$interopDefault(a) {
|
|
14
|
+
return a && a.__esModule ? a.default : a;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var $parcel$global = globalThis;
|
|
18
|
+
|
|
19
|
+
var $parcel$modules = {};
|
|
20
|
+
var $parcel$inits = {};
|
|
21
|
+
|
|
22
|
+
var parcelRequire = $parcel$global["parcelRequire7f0c"];
|
|
36
23
|
|
|
24
|
+
if (parcelRequire == null) {
|
|
25
|
+
parcelRequire = function(id) {
|
|
26
|
+
if (id in $parcel$modules) {
|
|
27
|
+
return $parcel$modules[id].exports;
|
|
28
|
+
}
|
|
29
|
+
if (id in $parcel$inits) {
|
|
30
|
+
var init = $parcel$inits[id];
|
|
31
|
+
delete $parcel$inits[id];
|
|
32
|
+
var module = {id: id, exports: {}};
|
|
33
|
+
$parcel$modules[id] = module;
|
|
34
|
+
init.call(module.exports, module, module.exports);
|
|
35
|
+
return module.exports;
|
|
36
|
+
}
|
|
37
|
+
var err = new Error("Cannot find module '" + id + "'");
|
|
38
|
+
err.code = 'MODULE_NOT_FOUND';
|
|
39
|
+
throw err;
|
|
40
|
+
};
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
$parcel$
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$parcel$export(
|
|
49
|
-
$parcel$export(
|
|
50
|
-
$parcel$export(
|
|
51
|
-
$parcel$export(
|
|
52
|
-
$parcel$export(
|
|
53
|
-
$parcel$export(
|
|
54
|
-
$parcel$export(
|
|
55
|
-
$parcel$export(
|
|
56
|
-
$parcel$export(
|
|
57
|
-
$parcel$export(
|
|
58
|
-
$parcel$export(
|
|
59
|
-
$parcel$export(
|
|
60
|
-
$parcel$export(
|
|
61
|
-
$parcel$export(
|
|
62
|
-
$parcel$export(
|
|
63
|
-
$parcel$export(
|
|
64
|
-
$parcel$export(
|
|
65
|
-
$parcel$export(
|
|
66
|
-
$parcel$export(
|
|
67
|
-
$parcel$export(
|
|
68
|
-
$parcel$export(
|
|
42
|
+
parcelRequire.register = function register(id, init) {
|
|
43
|
+
$parcel$inits[id] = init;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
$parcel$global["parcelRequire7f0c"] = parcelRequire;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var parcelRegister = parcelRequire.register;
|
|
50
|
+
parcelRegister("hBWiT", function(module, exports) {
|
|
51
|
+
|
|
52
|
+
$parcel$export(module.exports, "contextualHelp", () => $cd231e464c886c86$export$4ba534aba1836d, (v) => $cd231e464c886c86$export$4ba534aba1836d = v);
|
|
53
|
+
$parcel$export(module.exports, "field", () => $cd231e464c886c86$export$e0f35d825088c098, (v) => $cd231e464c886c86$export$e0f35d825088c098 = v);
|
|
54
|
+
$parcel$export(module.exports, "focus-ring", () => $cd231e464c886c86$export$f39a09f249340e2a, (v) => $cd231e464c886c86$export$f39a09f249340e2a = v);
|
|
55
|
+
$parcel$export(module.exports, "helpText", () => $cd231e464c886c86$export$431a3b688422af44, (v) => $cd231e464c886c86$export$431a3b688422af44 = v);
|
|
56
|
+
$parcel$export(module.exports, "i18nFontFamily", () => $cd231e464c886c86$export$8c4ee2c50c22c514, (v) => $cd231e464c886c86$export$8c4ee2c50c22c514 = v);
|
|
57
|
+
$parcel$export(module.exports, "is-disabled", () => $cd231e464c886c86$export$d35bc1e505d1ebbf, (v) => $cd231e464c886c86$export$d35bc1e505d1ebbf = v);
|
|
58
|
+
$parcel$export(module.exports, "label", () => $cd231e464c886c86$export$1237798dc640739a, (v) => $cd231e464c886c86$export$1237798dc640739a = v);
|
|
59
|
+
$parcel$export(module.exports, "spectrum-Field", () => $cd231e464c886c86$export$f6d480ae1e56eba0, (v) => $cd231e464c886c86$export$f6d480ae1e56eba0 = v);
|
|
60
|
+
$parcel$export(module.exports, "spectrum-Field--alignEnd", () => $cd231e464c886c86$export$5354c9be7ada5f83, (v) => $cd231e464c886c86$export$5354c9be7ada5f83 = v);
|
|
61
|
+
$parcel$export(module.exports, "spectrum-Field--hasContextualHelp", () => $cd231e464c886c86$export$9ba23707a252cdd4, (v) => $cd231e464c886c86$export$9ba23707a252cdd4 = v);
|
|
62
|
+
$parcel$export(module.exports, "spectrum-Field--positionSide", () => $cd231e464c886c86$export$2963225c91179589, (v) => $cd231e464c886c86$export$2963225c91179589 = v);
|
|
63
|
+
$parcel$export(module.exports, "spectrum-Field--positionTop", () => $cd231e464c886c86$export$a4ea780a9064d7f9, (v) => $cd231e464c886c86$export$a4ea780a9064d7f9 = v);
|
|
64
|
+
$parcel$export(module.exports, "spectrum-Field-contextualHelp", () => $cd231e464c886c86$export$24fb860d16dd2d3f, (v) => $cd231e464c886c86$export$24fb860d16dd2d3f = v);
|
|
65
|
+
$parcel$export(module.exports, "spectrum-Field-field", () => $cd231e464c886c86$export$3ab8a3dc7f0563d, (v) => $cd231e464c886c86$export$3ab8a3dc7f0563d = v);
|
|
66
|
+
$parcel$export(module.exports, "spectrum-Field-labelCell", () => $cd231e464c886c86$export$9cde5aecff012641, (v) => $cd231e464c886c86$export$9cde5aecff012641 = v);
|
|
67
|
+
$parcel$export(module.exports, "spectrum-Field-labelWrapper", () => $cd231e464c886c86$export$a872a8c78b26c9e0, (v) => $cd231e464c886c86$export$a872a8c78b26c9e0 = v);
|
|
68
|
+
$parcel$export(module.exports, "spectrum-Field-wrapper", () => $cd231e464c886c86$export$127df0b7290eb8ef, (v) => $cd231e464c886c86$export$127df0b7290eb8ef = v);
|
|
69
|
+
$parcel$export(module.exports, "spectrum-FieldLabel", () => $cd231e464c886c86$export$493d18e796ae054, (v) => $cd231e464c886c86$export$493d18e796ae054 = v);
|
|
70
|
+
$parcel$export(module.exports, "spectrum-FieldLabel--alignEnd", () => $cd231e464c886c86$export$885efcc08143a987, (v) => $cd231e464c886c86$export$885efcc08143a987 = v);
|
|
71
|
+
$parcel$export(module.exports, "spectrum-FieldLabel--positionSide", () => $cd231e464c886c86$export$9e6f19dc21f22f2e, (v) => $cd231e464c886c86$export$9e6f19dc21f22f2e = v);
|
|
72
|
+
$parcel$export(module.exports, "spectrum-FieldLabel-requiredIcon", () => $cd231e464c886c86$export$7c47642c7d46f3c9, (v) => $cd231e464c886c86$export$7c47642c7d46f3c9 = v);
|
|
73
|
+
$parcel$export(module.exports, "spectrum-FocusRing-ring", () => $cd231e464c886c86$export$4109102f950813a6, (v) => $cd231e464c886c86$export$4109102f950813a6 = v);
|
|
74
|
+
$parcel$export(module.exports, "spectrum-FocusRing", () => $cd231e464c886c86$export$24c7f46a6e3605dd, (v) => $cd231e464c886c86$export$24c7f46a6e3605dd = v);
|
|
75
|
+
$parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $cd231e464c886c86$export$2927016961429360, (v) => $cd231e464c886c86$export$2927016961429360 = v);
|
|
76
|
+
$parcel$export(module.exports, "spectrum-Form", () => $cd231e464c886c86$export$94d2bcc94afabd89, (v) => $cd231e464c886c86$export$94d2bcc94afabd89 = v);
|
|
77
|
+
$parcel$export(module.exports, "spectrum-Form--positionSide", () => $cd231e464c886c86$export$7f44db659563c8f4, (v) => $cd231e464c886c86$export$7f44db659563c8f4 = v);
|
|
78
|
+
$parcel$export(module.exports, "spectrum-Form--positionTop", () => $cd231e464c886c86$export$11b8bc81fe551057, (v) => $cd231e464c886c86$export$11b8bc81fe551057 = v);
|
|
79
|
+
$parcel$export(module.exports, "spectrum-Form-itemLabel", () => $cd231e464c886c86$export$51ec27881a1e3928, (v) => $cd231e464c886c86$export$51ec27881a1e3928 = v);
|
|
80
|
+
$parcel$export(module.exports, "spectrum-LabeledValue", () => $cd231e464c886c86$export$79f9a5e9dd010c8d, (v) => $cd231e464c886c86$export$79f9a5e9dd010c8d = v);
|
|
69
81
|
var $cd231e464c886c86$export$4ba534aba1836d;
|
|
70
82
|
var $cd231e464c886c86$export$e0f35d825088c098;
|
|
71
83
|
var $cd231e464c886c86$export$f39a09f249340e2a;
|
|
@@ -125,7 +137,36 @@ $cd231e464c886c86$export$11b8bc81fe551057 = `A-HlBa_spectrum-Form--positionTop`;
|
|
|
125
137
|
$cd231e464c886c86$export$51ec27881a1e3928 = `A-HlBa_spectrum-Form-itemLabel`;
|
|
126
138
|
$cd231e464c886c86$export$79f9a5e9dd010c8d = `A-HlBa_spectrum-LabeledValue`;
|
|
127
139
|
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
144
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
145
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
146
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
147
|
+
*
|
|
148
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
149
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
150
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
151
|
+
* governing permissions and limitations under the License.
|
|
152
|
+
*/ /// <reference types="css-module-types" />
|
|
153
|
+
/*
|
|
154
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
155
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
156
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
157
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
158
|
+
*
|
|
159
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
160
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
161
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
162
|
+
* governing permissions and limitations under the License.
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
128
168
|
|
|
169
|
+
var $hBWiT = parcelRequire("hBWiT");
|
|
129
170
|
let $ac118ceca79b8650$var$FormContext = /*#__PURE__*/ (0, $011V3$react).createContext(null);
|
|
130
171
|
function $ac118ceca79b8650$export$a6b5be5c6b451665(props) {
|
|
131
172
|
let ctx = (0, $011V3$useContext)($ac118ceca79b8650$var$FormContext);
|
|
@@ -145,13 +186,14 @@ const $ac118ceca79b8650$var$formPropNames = new Set([
|
|
|
145
186
|
]);
|
|
146
187
|
function $ac118ceca79b8650$var$Form(props, ref) {
|
|
147
188
|
props = (0, $011V3$useProviderProps)(props);
|
|
148
|
-
let { children: children, labelPosition: labelPosition = "top", labelAlign: labelAlign = "start", isRequired: isRequired, necessityIndicator: necessityIndicator, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isReadOnly: isReadOnly, validationState: validationState, ...otherProps } = props;
|
|
189
|
+
let { children: children, labelPosition: labelPosition = "top", labelAlign: labelAlign = "start", isRequired: isRequired, necessityIndicator: necessityIndicator, isQuiet: isQuiet, isEmphasized: isEmphasized, isDisabled: isDisabled, isReadOnly: isReadOnly, validationState: validationState, validationBehavior: validationBehavior, validationErrors: validationErrors, ...otherProps } = props;
|
|
149
190
|
let { styleProps: styleProps } = (0, $011V3$useStyleProps)(otherProps);
|
|
150
191
|
let domRef = (0, $011V3$useDOMRef)(ref);
|
|
151
192
|
let ctx = {
|
|
152
193
|
labelPosition: labelPosition,
|
|
153
194
|
labelAlign: labelAlign,
|
|
154
|
-
necessityIndicator: necessityIndicator
|
|
195
|
+
necessityIndicator: necessityIndicator,
|
|
196
|
+
validationBehavior: validationBehavior
|
|
155
197
|
};
|
|
156
198
|
return /*#__PURE__*/ (0, $011V3$react).createElement("form", {
|
|
157
199
|
...(0, $011V3$filterDOMProps)(otherProps, {
|
|
@@ -159,9 +201,9 @@ function $ac118ceca79b8650$var$Form(props, ref) {
|
|
|
159
201
|
propNames: $ac118ceca79b8650$var$formPropNames
|
|
160
202
|
}),
|
|
161
203
|
...styleProps,
|
|
162
|
-
noValidate:
|
|
204
|
+
noValidate: validationBehavior !== "native",
|
|
163
205
|
ref: domRef,
|
|
164
|
-
className: (0, $011V3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
206
|
+
className: (0, $011V3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($hBWiT))), "spectrum-Form", {
|
|
165
207
|
"spectrum-Form--positionSide": labelPosition === "side",
|
|
166
208
|
"spectrum-Form--positionTop": labelPosition === "top"
|
|
167
209
|
}, styleProps.className)
|
|
@@ -174,7 +216,9 @@ function $ac118ceca79b8650$var$Form(props, ref) {
|
|
|
174
216
|
isReadOnly: isReadOnly,
|
|
175
217
|
isRequired: isRequired,
|
|
176
218
|
validationState: validationState
|
|
177
|
-
},
|
|
219
|
+
}, /*#__PURE__*/ (0, $011V3$react).createElement((0, $011V3$FormValidationContext).Provider, {
|
|
220
|
+
value: validationErrors || {}
|
|
221
|
+
}, children))));
|
|
178
222
|
}
|
|
179
223
|
/**
|
|
180
224
|
* Forms allow users to enter data that can be submitted while providing alignment and styling for form fields.
|
package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,GAAA,iBAAS,EACP,CAAA,GAAA,6CAAK,GACL,iBACA;YACE,+BAA+B,kBAAkB;YACjD,8BAA8B,kBAAkB;QAClD,GACA,WAAW,SAAS;qBAGxB,gCAAC,kCAAY,QAAQ;QAAC,OAAO;qBAC3B,gCAAC,CAAA,GAAA,eAAO;QACN,SAAS;QACT,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,iBAAiB;qBACjB,gCAAC,CAAA,GAAA,4BAAoB,EAAE,QAAQ;QAAC,OAAO,oBAAoB,CAAC;OACzD;AAMb;AAEA;;CAEC,GACD,MAAM,0DAAQ,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;","sources":["packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","packages/@react-spectrum/form/src/index.ts","packages/@react-spectrum/form/src/Form.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {useFormProps, Form} from './Form';\nexport type {SpectrumFormProps} from '@react-types/form';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Alignment, DOMRef, LabelPosition, SpectrumLabelableProps} from '@react-types/shared';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormValidationContext} from '@react-stately/form';\nimport {Provider, useProviderProps} from '@react-spectrum/provider';\nimport React, {useContext} from 'react';\nimport {SpectrumFormProps} from '@react-types/form';\nimport styles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\n\ninterface FormContextValue extends SpectrumLabelableProps {\n validationBehavior?: 'aria' | 'native'\n}\n\nlet FormContext = React.createContext<FormContextValue | null>(null);\nexport function useFormProps<T extends SpectrumLabelableProps>(props: T): T {\n let ctx = useContext(FormContext);\n if (ctx) {\n return {...ctx, ...props};\n }\n\n return props;\n}\n\nconst formPropNames = new Set([\n 'action',\n 'autoComplete',\n 'encType',\n 'method',\n 'target',\n 'onSubmit'\n]);\n\nfunction Form(props: SpectrumFormProps, ref: DOMRef<HTMLFormElement>) {\n props = useProviderProps(props);\n let {\n children,\n labelPosition = 'top' as LabelPosition,\n labelAlign = 'start' as Alignment,\n isRequired,\n necessityIndicator,\n isQuiet,\n isEmphasized,\n isDisabled,\n isReadOnly,\n validationState,\n validationBehavior,\n validationErrors,\n ...otherProps\n } = props;\n\n let {styleProps} = useStyleProps(otherProps);\n let domRef = useDOMRef(ref);\n\n let ctx = {\n labelPosition,\n labelAlign,\n necessityIndicator,\n validationBehavior\n };\n\n return (\n <form\n {...filterDOMProps(otherProps, {labelable: true, propNames: formPropNames})}\n {...styleProps}\n noValidate={validationBehavior !== 'native'}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Form',\n {\n 'spectrum-Form--positionSide': labelPosition === 'side',\n 'spectrum-Form--positionTop': labelPosition === 'top'\n },\n styleProps.className\n )\n }>\n <FormContext.Provider value={ctx}>\n <Provider\n isQuiet={isQuiet}\n isEmphasized={isEmphasized}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n validationState={validationState}>\n <FormValidationContext.Provider value={validationErrors || {}}>\n {children}\n </FormValidationContext.Provider>\n </Provider>\n </FormContext.Provider>\n </form>\n );\n}\n\n/**\n * Forms allow users to enter data that can be submitted while providing alignment and styling for form fields.\n */\nconst _Form = React.forwardRef(Form);\nexport {_Form as Form};\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;
|
|
1
|
+
{"mappings":";;;AA0BA,6BAA6B,CAAC,SAAS,sBAAsB,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAO1E;AAyED;;GAEG;AACH,OAAA,MAAM,0IAA8B,CAAC;AC9FrC,YAAY,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/form/src/packages/@react-spectrum/form/src/Form.tsx","packages/@react-spectrum/form/src/packages/@react-spectrum/form/src/index.ts","packages/@react-spectrum/form/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {useFormProps, Form} from './Form';\nexport type {SpectrumFormProps} from '@react-types/form';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/form",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.2531+068ecd12e",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
40
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
41
|
-
"@react-
|
|
42
|
-
"@react-types/
|
|
39
|
+
"@react-aria/utils": "3.0.0-nightly.2531+068ecd12e",
|
|
40
|
+
"@react-spectrum/utils": "3.0.0-nightly.2531+068ecd12e",
|
|
41
|
+
"@react-stately/form": "3.0.0-nightly.4242+068ecd12e",
|
|
42
|
+
"@react-types/form": "3.5.5-nightly.4242+068ecd12e",
|
|
43
|
+
"@react-types/shared": "3.0.0-nightly.2531+068ecd12e",
|
|
43
44
|
"@swc/helpers": "^0.5.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
47
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.2531+068ecd12e"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"@react-spectrum/provider": "^3.0.0",
|
|
@@ -52,5 +53,5 @@
|
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
|
54
55
|
},
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "068ecd12e8a8c61546dfda691b04ca87cbdae687"
|
|
56
57
|
}
|
package/src/Form.tsx
CHANGED
|
@@ -13,12 +13,17 @@
|
|
|
13
13
|
import {Alignment, DOMRef, LabelPosition, SpectrumLabelableProps} from '@react-types/shared';
|
|
14
14
|
import {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
|
|
15
15
|
import {filterDOMProps} from '@react-aria/utils';
|
|
16
|
+
import {FormValidationContext} from '@react-stately/form';
|
|
16
17
|
import {Provider, useProviderProps} from '@react-spectrum/provider';
|
|
17
18
|
import React, {useContext} from 'react';
|
|
18
19
|
import {SpectrumFormProps} from '@react-types/form';
|
|
19
20
|
import styles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
interface FormContextValue extends SpectrumLabelableProps {
|
|
23
|
+
validationBehavior?: 'aria' | 'native'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let FormContext = React.createContext<FormContextValue | null>(null);
|
|
22
27
|
export function useFormProps<T extends SpectrumLabelableProps>(props: T): T {
|
|
23
28
|
let ctx = useContext(FormContext);
|
|
24
29
|
if (ctx) {
|
|
@@ -50,6 +55,8 @@ function Form(props: SpectrumFormProps, ref: DOMRef<HTMLFormElement>) {
|
|
|
50
55
|
isDisabled,
|
|
51
56
|
isReadOnly,
|
|
52
57
|
validationState,
|
|
58
|
+
validationBehavior,
|
|
59
|
+
validationErrors,
|
|
53
60
|
...otherProps
|
|
54
61
|
} = props;
|
|
55
62
|
|
|
@@ -59,14 +66,15 @@ function Form(props: SpectrumFormProps, ref: DOMRef<HTMLFormElement>) {
|
|
|
59
66
|
let ctx = {
|
|
60
67
|
labelPosition,
|
|
61
68
|
labelAlign,
|
|
62
|
-
necessityIndicator
|
|
69
|
+
necessityIndicator,
|
|
70
|
+
validationBehavior
|
|
63
71
|
};
|
|
64
72
|
|
|
65
73
|
return (
|
|
66
74
|
<form
|
|
67
75
|
{...filterDOMProps(otherProps, {labelable: true, propNames: formPropNames})}
|
|
68
76
|
{...styleProps}
|
|
69
|
-
noValidate
|
|
77
|
+
noValidate={validationBehavior !== 'native'}
|
|
70
78
|
ref={domRef}
|
|
71
79
|
className={
|
|
72
80
|
classNames(
|
|
@@ -87,7 +95,9 @@ function Form(props: SpectrumFormProps, ref: DOMRef<HTMLFormElement>) {
|
|
|
87
95
|
isReadOnly={isReadOnly}
|
|
88
96
|
isRequired={isRequired}
|
|
89
97
|
validationState={validationState}>
|
|
90
|
-
{
|
|
98
|
+
<FormValidationContext.Provider value={validationErrors || {}}>
|
|
99
|
+
{children}
|
|
100
|
+
</FormValidationContext.Provider>
|
|
91
101
|
</Provider>
|
|
92
102
|
</FormContext.Provider>
|
|
93
103
|
</form>
|