@react-spectrum/label 3.16.22 → 3.17.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/dist/import.mjs +4 -4
- package/dist/main.js +6 -6
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -4
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +5 -0
- package/package.json +12 -32
- package/src/index.ts +6 -3
- package/dist/Field.main.js +0 -117
- package/dist/Field.main.js.map +0 -1
- package/dist/Field.mjs +0 -112
- package/dist/Field.module.js +0 -112
- package/dist/Field.module.js.map +0 -1
- package/dist/HelpText.main.js +0 -54
- package/dist/HelpText.main.js.map +0 -1
- package/dist/HelpText.mjs +0 -49
- package/dist/HelpText.module.js +0 -49
- package/dist/HelpText.module.js.map +0 -1
- package/dist/Label.main.js +0 -67
- package/dist/Label.main.js.map +0 -1
- package/dist/Label.mjs +0 -62
- package/dist/Label.module.js +0 -62
- package/dist/Label.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -7
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -9
- package/dist/ar-AE.module.js +0 -9
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -7
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -9
- package/dist/bg-BG.module.js +0 -9
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -7
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -9
- package/dist/cs-CZ.module.js +0 -9
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -7
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -9
- package/dist/da-DK.module.js +0 -9
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -7
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -9
- package/dist/de-DE.module.js +0 -9
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -7
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -9
- package/dist/el-GR.module.js +0 -9
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -7
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -9
- package/dist/en-US.module.js +0 -9
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -7
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -9
- package/dist/es-ES.module.js +0 -9
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -7
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -9
- package/dist/et-EE.module.js +0 -9
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -7
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -9
- package/dist/fi-FI.module.js +0 -9
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fieldlabel_vars_css.main.js +0 -95
- package/dist/fieldlabel_vars_css.main.js.map +0 -1
- package/dist/fieldlabel_vars_css.mjs +0 -97
- package/dist/fieldlabel_vars_css.module.js +0 -97
- package/dist/fieldlabel_vars_css.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -7
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -9
- package/dist/fr-FR.module.js +0 -9
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -7
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -9
- package/dist/he-IL.module.js +0 -9
- package/dist/he-IL.module.js.map +0 -1
- package/dist/helptext_vars_css.main.js +0 -41
- package/dist/helptext_vars_css.main.js.map +0 -1
- package/dist/helptext_vars_css.mjs +0 -43
- package/dist/helptext_vars_css.module.js +0 -43
- package/dist/helptext_vars_css.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -7
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -9
- package/dist/hr-HR.module.js +0 -9
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -7
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -9
- package/dist/hu-HU.module.js +0 -9
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -7
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -9
- package/dist/it-IT.module.js +0 -9
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -7
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -9
- package/dist/ja-JP.module.js +0 -9
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -7
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -9
- package/dist/ko-KR.module.js +0 -9
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/label.16985598.css +0 -117
- package/dist/label.16985598.css.map +0 -1
- package/dist/label.fb8aa6a3.css +0 -271
- package/dist/label.fb8aa6a3.css.map +0 -1
- package/dist/lt-LT.main.js +0 -7
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -9
- package/dist/lt-LT.module.js +0 -9
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -7
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -9
- package/dist/lv-LV.module.js +0 -9
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -7
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -9
- package/dist/nb-NO.module.js +0 -9
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -7
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -9
- package/dist/nl-NL.module.js +0 -9
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -7
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -9
- package/dist/pl-PL.module.js +0 -9
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -7
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -9
- package/dist/pt-BR.module.js +0 -9
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -7
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -9
- package/dist/pt-PT.module.js +0 -9
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -7
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -9
- package/dist/ro-RO.module.js +0 -9
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -7
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -9
- package/dist/ru-RU.module.js +0 -9
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -7
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -9
- package/dist/sk-SK.module.js +0 -9
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -7
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -9
- package/dist/sl-SI.module.js +0 -9
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -7
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -9
- package/dist/sr-SP.module.js +0 -9
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -7
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -9
- package/dist/sv-SE.module.js +0 -9
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -7
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -9
- package/dist/tr-TR.module.js +0 -9
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -19
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -7
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -9
- package/dist/uk-UA.module.js +0 -9
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -7
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -9
- package/dist/zh-CN.module.js +0 -9
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -7
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -9
- package/dist/zh-TW.module.js +0 -9
- package/dist/zh-TW.module.js.map +0 -1
- package/src/Field.tsx +0 -177
- package/src/HelpText.tsx +0 -71
- package/src/Label.tsx +0 -79
package/dist/import.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Field as $
|
|
2
|
-
import {Label as $
|
|
3
|
-
import {HelpText as $
|
|
1
|
+
import {Field as $02b849d28a370635$re_export$Field} from "@adobe/react-spectrum/private/label/Field";
|
|
2
|
+
import {Label as $02b849d28a370635$re_export$Label} from "@adobe/react-spectrum/private/label/Label";
|
|
3
|
+
import {HelpText as $02b849d28a370635$re_export$HelpText} from "@adobe/react-spectrum/private/label/HelpText";
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -18,5 +18,5 @@ import {HelpText as $8e50676506611310$export$a67c0bc59081311a} from "./HelpText.
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
export {$
|
|
21
|
+
export {$02b849d28a370635$re_export$Field as Field, $02b849d28a370635$re_export$Label as Label, $02b849d28a370635$re_export$HelpText as HelpText};
|
|
22
22
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
1
|
+
var $2ciTp$adobereactspectrumprivatelabelField = require("@adobe/react-spectrum/private/label/Field");
|
|
2
|
+
var $2ciTp$adobereactspectrumprivatelabelLabel = require("@adobe/react-spectrum/private/label/Label");
|
|
3
|
+
var $2ciTp$adobereactspectrumprivatelabelHelpText = require("@adobe/react-spectrum/private/label/HelpText");
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
function $parcel$export(e, n, v, s) {
|
|
7
7
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
$parcel$export(module.exports, "Field", ()
|
|
11
|
-
$parcel$export(module.exports, "Label", ()
|
|
12
|
-
$parcel$export(module.exports, "HelpText", ()
|
|
10
|
+
$parcel$export(module.exports, "Field", function () { return $2ciTp$adobereactspectrumprivatelabelField.Field; });
|
|
11
|
+
$parcel$export(module.exports, "Label", function () { return $2ciTp$adobereactspectrumprivatelabelLabel.Label; });
|
|
12
|
+
$parcel$export(module.exports, "HelpText", function () { return $2ciTp$adobereactspectrumprivatelabelHelpText.HelpText; });
|
|
13
13
|
/*
|
|
14
14
|
* Copyright 2020 Adobe. All rights reserved.
|
|
15
15
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/label/src/index.ts"],"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/// <reference types=\"css-module-types\" />\n\nexport {Field} from '
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/label/src/index.ts"],"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/// <reference types=\"css-module-types\" />\n\nexport {Field} from '@adobe/react-spectrum/private/label/Field';\n\nexport {Label} from '@adobe/react-spectrum/private/label/Label';\nexport {HelpText} from '@adobe/react-spectrum/private/label/HelpText';\nexport type {LabelProps, SpectrumLabelProps} from '@adobe/react-spectrum/private/label/Label';\nexport type {SpectrumFieldProps} from '@adobe/react-spectrum/private/label/Field';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Field as $
|
|
2
|
-
import {Label as $
|
|
3
|
-
import {HelpText as $
|
|
1
|
+
import {Field as $02b849d28a370635$re_export$Field} from "@adobe/react-spectrum/private/label/Field";
|
|
2
|
+
import {Label as $02b849d28a370635$re_export$Label} from "@adobe/react-spectrum/private/label/Label";
|
|
3
|
+
import {HelpText as $02b849d28a370635$re_export$HelpText} from "@adobe/react-spectrum/private/label/HelpText";
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -18,5 +18,5 @@ import {HelpText as $8e50676506611310$export$a67c0bc59081311a} from "./HelpText.
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
export {$
|
|
21
|
+
export {$02b849d28a370635$re_export$Field as Field, $02b849d28a370635$re_export$Label as Label, $02b849d28a370635$re_export$HelpText as HelpText};
|
|
22
22
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/label/src/index.ts"],"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/// <reference types=\"css-module-types\" />\n\nexport {Field} from '
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/label/src/index.ts"],"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/// <reference types=\"css-module-types\" />\n\nexport {Field} from '@adobe/react-spectrum/private/label/Field';\n\nexport {Label} from '@adobe/react-spectrum/private/label/Label';\nexport {HelpText} from '@adobe/react-spectrum/private/label/HelpText';\nexport type {LabelProps, SpectrumLabelProps} from '@adobe/react-spectrum/private/label/Label';\nexport type {SpectrumFieldProps} from '@adobe/react-spectrum/private/label/Field';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Field } from '@adobe/react-spectrum/private/label/Field';
|
|
2
|
+
export { Label } from '@adobe/react-spectrum/private/label/Label';
|
|
3
|
+
export { HelpText } from '@adobe/react-spectrum/private/label/HelpText';
|
|
4
|
+
export type { LabelProps, SpectrumLabelProps } from '@adobe/react-spectrum/private/label/Label';
|
|
5
|
+
export type { SpectrumFieldProps } from '@adobe/react-spectrum/private/label/Field';
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/label",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -24,42 +24,22 @@
|
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
26
|
"targets": {
|
|
27
|
-
"
|
|
28
|
-
"includeNodeModules": [
|
|
29
|
-
"@adobe/spectrum-css-temp"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"module": {
|
|
33
|
-
"includeNodeModules": [
|
|
34
|
-
"@adobe/spectrum-css-temp"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
27
|
+
"types": false
|
|
37
28
|
},
|
|
38
29
|
"repository": {
|
|
39
30
|
"type": "git",
|
|
40
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
41
32
|
},
|
|
42
33
|
"dependencies": {
|
|
43
|
-
"@react-
|
|
44
|
-
"@react-aria/utils": "^3.33.1",
|
|
45
|
-
"@react-spectrum/form": "^3.7.22",
|
|
46
|
-
"@react-spectrum/layout": "^3.6.22",
|
|
47
|
-
"@react-spectrum/utils": "^3.12.12",
|
|
48
|
-
"@react-types/label": "^3.9.17",
|
|
49
|
-
"@react-types/shared": "^3.33.1",
|
|
50
|
-
"@spectrum-icons/ui": "^3.6.23",
|
|
34
|
+
"@adobe/react-spectrum": "3.47.0",
|
|
51
35
|
"@swc/helpers": "^0.5.0"
|
|
52
36
|
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
55
|
-
},
|
|
56
37
|
"peerDependencies": {
|
|
57
|
-
"@react-spectrum/provider": "^3.0.0",
|
|
58
38
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
59
39
|
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
60
40
|
},
|
|
61
41
|
"publishConfig": {
|
|
62
42
|
"access": "public"
|
|
63
43
|
},
|
|
64
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
65
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
/// <reference types="css-module-types" />
|
|
14
14
|
|
|
15
|
-
export {Field} from '
|
|
16
|
-
|
|
17
|
-
export {
|
|
15
|
+
export {Field} from '@adobe/react-spectrum/private/label/Field';
|
|
16
|
+
|
|
17
|
+
export {Label} from '@adobe/react-spectrum/private/label/Label';
|
|
18
|
+
export {HelpText} from '@adobe/react-spectrum/private/label/HelpText';
|
|
19
|
+
export type {LabelProps, SpectrumLabelProps} from '@adobe/react-spectrum/private/label/Label';
|
|
20
|
+
export type {SpectrumFieldProps} from '@adobe/react-spectrum/private/label/Field';
|
package/dist/Field.main.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
var $2d1b5114e5b358b6$exports = require("./HelpText.main.js");
|
|
2
|
-
var $38a9afbd39356629$exports = require("./Label.main.js");
|
|
3
|
-
require("./label.fb8aa6a3.css");
|
|
4
|
-
var $eb2fc0ee655eff6b$exports = require("./fieldlabel_vars_css.main.js");
|
|
5
|
-
var $bW4vJ$reactspectrumutils = require("@react-spectrum/utils");
|
|
6
|
-
var $bW4vJ$reactspectrumlayout = require("@react-spectrum/layout");
|
|
7
|
-
var $bW4vJ$reactariautils = require("@react-aria/utils");
|
|
8
|
-
var $bW4vJ$react = require("react");
|
|
9
|
-
var $bW4vJ$reactspectrumform = require("@react-spectrum/form");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function $parcel$interopDefault(a) {
|
|
13
|
-
return a && a.__esModule ? a.default : a;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function $parcel$export(e, n, v, s) {
|
|
17
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
$parcel$export(module.exports, "Field", () => $0e5410371a445d59$export$a455218a85c89869);
|
|
21
|
-
/*
|
|
22
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
23
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
-
* governing permissions and limitations under the License.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const $0e5410371a445d59$export$a455218a85c89869 = /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).forwardRef(function Field(props, ref) {
|
|
40
|
-
let formProps = (0, $bW4vJ$reactspectrumform.useFormProps)(props);
|
|
41
|
-
let isInForm = formProps !== props;
|
|
42
|
-
props = formProps;
|
|
43
|
-
let { label: label, labelPosition: labelPosition = 'top', labelAlign: labelAlign, isRequired: isRequired, necessityIndicator: necessityIndicator, includeNecessityIndicatorInAccessibilityName: includeNecessityIndicatorInAccessibilityName, validationState: validationState, isInvalid: isInvalid, description: description, errorMessage: errorMessage = (e)=>e.validationErrors.join(' '), validationErrors: validationErrors, validationDetails: validationDetails, isDisabled: isDisabled, showErrorIcon: showErrorIcon, contextualHelp: contextualHelp, children: children, labelProps: labelProps = {}, descriptionProps: // Not every component that uses <Field> supports help text.
|
|
44
|
-
descriptionProps = {}, errorMessageProps: errorMessageProps = {}, elementType: elementType, wrapperClassName: wrapperClassName, wrapperProps: wrapperProps = {}, ...otherProps } = props;
|
|
45
|
-
let { styleProps: styleProps } = (0, $bW4vJ$reactspectrumutils.useStyleProps)(otherProps);
|
|
46
|
-
let errorMessageString = null;
|
|
47
|
-
if (typeof errorMessage === 'function') errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null ? errorMessage({
|
|
48
|
-
isInvalid: isInvalid,
|
|
49
|
-
validationErrors: validationErrors,
|
|
50
|
-
validationDetails: validationDetails
|
|
51
|
-
}) : null;
|
|
52
|
-
else errorMessageString = errorMessage;
|
|
53
|
-
let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');
|
|
54
|
-
let contextualHelpId = (0, $bW4vJ$reactariautils.useId)();
|
|
55
|
-
let fallbackLabelPropsId = (0, $bW4vJ$reactariautils.useId)();
|
|
56
|
-
if (label && contextualHelp && !labelProps.id) labelProps.id = fallbackLabelPropsId;
|
|
57
|
-
let labelWrapperClass = (0, $bW4vJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field', {
|
|
58
|
-
'spectrum-Field--positionTop': labelPosition === 'top',
|
|
59
|
-
'spectrum-Field--positionSide': labelPosition === 'side',
|
|
60
|
-
'spectrum-Field--alignEnd': labelAlign === 'end',
|
|
61
|
-
'spectrum-Field--hasContextualHelp': !!props.contextualHelp
|
|
62
|
-
}, styleProps.className, wrapperClassName);
|
|
63
|
-
children = /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).cloneElement(children, (0, $bW4vJ$reactariautils.mergeProps)(children.props, {
|
|
64
|
-
className: (0, $bW4vJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field-field')
|
|
65
|
-
}));
|
|
66
|
-
let renderHelpText = ()=>/*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement((0, $2d1b5114e5b358b6$exports.HelpText), {
|
|
67
|
-
descriptionProps: descriptionProps,
|
|
68
|
-
errorMessageProps: errorMessageProps,
|
|
69
|
-
description: description,
|
|
70
|
-
errorMessage: errorMessageString,
|
|
71
|
-
validationState: validationState,
|
|
72
|
-
isInvalid: isInvalid,
|
|
73
|
-
isDisabled: isDisabled,
|
|
74
|
-
showErrorIcon: showErrorIcon,
|
|
75
|
-
gridArea: (0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))).helpText
|
|
76
|
-
});
|
|
77
|
-
let renderChildren = ()=>{
|
|
78
|
-
if (labelPosition === 'side') return /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement((0, $bW4vJ$reactspectrumlayout.Flex), {
|
|
79
|
-
direction: "column",
|
|
80
|
-
UNSAFE_className: (0, $bW4vJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field-wrapper')
|
|
81
|
-
}, children, hasHelpText && renderHelpText());
|
|
82
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement((0, ($parcel$interopDefault($bW4vJ$react))).Fragment, null, children, hasHelpText && renderHelpText());
|
|
83
|
-
};
|
|
84
|
-
let labelAndContextualHelp = /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement((0, ($parcel$interopDefault($bW4vJ$react))).Fragment, null, label && /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement((0, $38a9afbd39356629$exports.Label), {
|
|
85
|
-
...labelProps,
|
|
86
|
-
labelPosition: labelPosition,
|
|
87
|
-
labelAlign: labelAlign,
|
|
88
|
-
isRequired: isRequired,
|
|
89
|
-
necessityIndicator: necessityIndicator,
|
|
90
|
-
includeNecessityIndicatorInAccessibilityName: includeNecessityIndicatorInAccessibilityName,
|
|
91
|
-
elementType: elementType
|
|
92
|
-
}, label), label && contextualHelp && /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement((0, $bW4vJ$reactspectrumutils.SlotProvider), {
|
|
93
|
-
slots: {
|
|
94
|
-
actionButton: {
|
|
95
|
-
UNSAFE_className: (0, $bW4vJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field-contextualHelp'),
|
|
96
|
-
id: contextualHelpId,
|
|
97
|
-
'aria-labelledby': (labelProps === null || labelProps === void 0 ? void 0 : labelProps.id) ? `${labelProps.id} ${contextualHelpId}` : undefined
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}, contextualHelp));
|
|
101
|
-
// Need to add an extra wrapper for the label and contextual help if labelPosition is side,
|
|
102
|
-
// so that the table layout works inside forms.
|
|
103
|
-
if (isInForm && labelPosition === 'side' && label && contextualHelp) labelAndContextualHelp = /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement("div", {
|
|
104
|
-
className: (0, $bW4vJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field-labelCell')
|
|
105
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement("div", {
|
|
106
|
-
className: (0, $bW4vJ$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), 'spectrum-Field-labelWrapper')
|
|
107
|
-
}, labelAndContextualHelp));
|
|
108
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).createElement("div", {
|
|
109
|
-
...styleProps,
|
|
110
|
-
...wrapperProps,
|
|
111
|
-
ref: ref,
|
|
112
|
-
className: labelWrapperClass
|
|
113
|
-
}, labelAndContextualHelp, renderChildren());
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//# sourceMappingURL=Field.main.js.map
|
package/dist/Field.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"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","sources":["packages/@react-spectrum/label/src/Field.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\nimport {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';\nimport {Flex} from '@react-spectrum/layout';\nimport {HelpText} from './HelpText';\nimport {Label} from './Label';\nimport {LabelPosition, RefObject} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode, Ref} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nexport const Field = React.forwardRef(function Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {\n let formProps = useFormProps(props);\n let isInForm = formProps !== props;\n props = formProps;\n let {\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n includeNecessityIndicatorInAccessibilityName,\n validationState,\n isInvalid,\n description,\n errorMessage = e => e.validationErrors.join(' '),\n validationErrors,\n validationDetails,\n isDisabled,\n showErrorIcon,\n contextualHelp,\n children,\n labelProps = {},\n // Not every component that uses <Field> supports help text.\n descriptionProps = {},\n errorMessageProps = {},\n elementType,\n wrapperClassName,\n wrapperProps = {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let errorMessageString: ReactNode = null;\n if (typeof errorMessage === 'function') {\n errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null\n ? errorMessage({\n isInvalid,\n validationErrors,\n validationDetails\n })\n : null;\n } else {\n errorMessageString = errorMessage;\n }\n let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');\n let contextualHelpId = useId();\n\n let fallbackLabelPropsId = useId();\n if (label && contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side',\n 'spectrum-Field--alignEnd': labelAlign === 'end',\n 'spectrum-Field--hasContextualHelp': !!props.contextualHelp\n },\n styleProps.className,\n wrapperClassName\n );\n\n children = React.cloneElement(children, mergeProps(children.props as any, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field'\n )\n }));\n\n let renderHelpText = () => (\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessageString}\n validationState={validationState}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n showErrorIcon={showErrorIcon}\n gridArea={labelStyles.helpText} />\n );\n\n let renderChildren = () => {\n if (labelPosition === 'side') {\n return (\n <Flex direction=\"column\" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n {children}\n {hasHelpText && renderHelpText()}\n </Flex>\n );\n }\n\n return (\n <>\n {children}\n {hasHelpText && renderHelpText()}\n </>\n );\n };\n\n let labelAndContextualHelp = (\n <>\n {label && (\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}\n elementType={elementType}>\n {label}\n </Label>\n )}\n {label && contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined\n }\n }}>\n {contextualHelp}\n </SlotProvider>\n }\n </>\n );\n\n // Need to add an extra wrapper for the label and contextual help if labelPosition is side,\n // so that the table layout works inside forms.\n if (isInForm && labelPosition === 'side' && label && contextualHelp) {\n labelAndContextualHelp = (\n <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>\n <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>\n {labelAndContextualHelp}\n </div>\n </div>\n );\n }\n\n return (\n (<div\n {...styleProps}\n {...wrapperProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>)\n );\n});\n"],"names":[],"version":3,"file":"Field.main.js.map"}
|
package/dist/Field.mjs
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import {HelpText as $8e50676506611310$export$a67c0bc59081311a} from "./HelpText.mjs";
|
|
2
|
-
import {Label as $00af9ba397a66f43$export$b04be29aa201d4f5} from "./Label.mjs";
|
|
3
|
-
import "./label.fb8aa6a3.css";
|
|
4
|
-
import $c6ZG4$fieldlabel_vars_cssmodulejs from "./fieldlabel_vars_css.mjs";
|
|
5
|
-
import {useStyleProps as $c6ZG4$useStyleProps, classNames as $c6ZG4$classNames, SlotProvider as $c6ZG4$SlotProvider} from "@react-spectrum/utils";
|
|
6
|
-
import {Flex as $c6ZG4$Flex} from "@react-spectrum/layout";
|
|
7
|
-
import {useId as $c6ZG4$useId, mergeProps as $c6ZG4$mergeProps} from "@react-aria/utils";
|
|
8
|
-
import $c6ZG4$react from "react";
|
|
9
|
-
import {useFormProps as $c6ZG4$useFormProps} from "@react-spectrum/form";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function $parcel$interopDefault(a) {
|
|
13
|
-
return a && a.__esModule ? a.default : a;
|
|
14
|
-
}
|
|
15
|
-
/*
|
|
16
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
-
*
|
|
21
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
-
* governing permissions and limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const $b7ca5b4454a2009d$export$a455218a85c89869 = /*#__PURE__*/ (0, $c6ZG4$react).forwardRef(function Field(props, ref) {
|
|
34
|
-
let formProps = (0, $c6ZG4$useFormProps)(props);
|
|
35
|
-
let isInForm = formProps !== props;
|
|
36
|
-
props = formProps;
|
|
37
|
-
let { label: label, labelPosition: labelPosition = 'top', labelAlign: labelAlign, isRequired: isRequired, necessityIndicator: necessityIndicator, includeNecessityIndicatorInAccessibilityName: includeNecessityIndicatorInAccessibilityName, validationState: validationState, isInvalid: isInvalid, description: description, errorMessage: errorMessage = (e)=>e.validationErrors.join(' '), validationErrors: validationErrors, validationDetails: validationDetails, isDisabled: isDisabled, showErrorIcon: showErrorIcon, contextualHelp: contextualHelp, children: children, labelProps: labelProps = {}, descriptionProps: // Not every component that uses <Field> supports help text.
|
|
38
|
-
descriptionProps = {}, errorMessageProps: errorMessageProps = {}, elementType: elementType, wrapperClassName: wrapperClassName, wrapperProps: wrapperProps = {}, ...otherProps } = props;
|
|
39
|
-
let { styleProps: styleProps } = (0, $c6ZG4$useStyleProps)(otherProps);
|
|
40
|
-
let errorMessageString = null;
|
|
41
|
-
if (typeof errorMessage === 'function') errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null ? errorMessage({
|
|
42
|
-
isInvalid: isInvalid,
|
|
43
|
-
validationErrors: validationErrors,
|
|
44
|
-
validationDetails: validationDetails
|
|
45
|
-
}) : null;
|
|
46
|
-
else errorMessageString = errorMessage;
|
|
47
|
-
let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');
|
|
48
|
-
let contextualHelpId = (0, $c6ZG4$useId)();
|
|
49
|
-
let fallbackLabelPropsId = (0, $c6ZG4$useId)();
|
|
50
|
-
if (label && contextualHelp && !labelProps.id) labelProps.id = fallbackLabelPropsId;
|
|
51
|
-
let labelWrapperClass = (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field', {
|
|
52
|
-
'spectrum-Field--positionTop': labelPosition === 'top',
|
|
53
|
-
'spectrum-Field--positionSide': labelPosition === 'side',
|
|
54
|
-
'spectrum-Field--alignEnd': labelAlign === 'end',
|
|
55
|
-
'spectrum-Field--hasContextualHelp': !!props.contextualHelp
|
|
56
|
-
}, styleProps.className, wrapperClassName);
|
|
57
|
-
children = /*#__PURE__*/ (0, $c6ZG4$react).cloneElement(children, (0, $c6ZG4$mergeProps)(children.props, {
|
|
58
|
-
className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-field')
|
|
59
|
-
}));
|
|
60
|
-
let renderHelpText = ()=>/*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $8e50676506611310$export$a67c0bc59081311a), {
|
|
61
|
-
descriptionProps: descriptionProps,
|
|
62
|
-
errorMessageProps: errorMessageProps,
|
|
63
|
-
description: description,
|
|
64
|
-
errorMessage: errorMessageString,
|
|
65
|
-
validationState: validationState,
|
|
66
|
-
isInvalid: isInvalid,
|
|
67
|
-
isDisabled: isDisabled,
|
|
68
|
-
showErrorIcon: showErrorIcon,
|
|
69
|
-
gridArea: (0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))).helpText
|
|
70
|
-
});
|
|
71
|
-
let renderChildren = ()=>{
|
|
72
|
-
if (labelPosition === 'side') return /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$Flex), {
|
|
73
|
-
direction: "column",
|
|
74
|
-
UNSAFE_className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-wrapper')
|
|
75
|
-
}, children, hasHelpText && renderHelpText());
|
|
76
|
-
return /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$react).Fragment, null, children, hasHelpText && renderHelpText());
|
|
77
|
-
};
|
|
78
|
-
let labelAndContextualHelp = /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$react).Fragment, null, label && /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $00af9ba397a66f43$export$b04be29aa201d4f5), {
|
|
79
|
-
...labelProps,
|
|
80
|
-
labelPosition: labelPosition,
|
|
81
|
-
labelAlign: labelAlign,
|
|
82
|
-
isRequired: isRequired,
|
|
83
|
-
necessityIndicator: necessityIndicator,
|
|
84
|
-
includeNecessityIndicatorInAccessibilityName: includeNecessityIndicatorInAccessibilityName,
|
|
85
|
-
elementType: elementType
|
|
86
|
-
}, label), label && contextualHelp && /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$SlotProvider), {
|
|
87
|
-
slots: {
|
|
88
|
-
actionButton: {
|
|
89
|
-
UNSAFE_className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-contextualHelp'),
|
|
90
|
-
id: contextualHelpId,
|
|
91
|
-
'aria-labelledby': (labelProps === null || labelProps === void 0 ? void 0 : labelProps.id) ? `${labelProps.id} ${contextualHelpId}` : undefined
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, contextualHelp));
|
|
95
|
-
// Need to add an extra wrapper for the label and contextual help if labelPosition is side,
|
|
96
|
-
// so that the table layout works inside forms.
|
|
97
|
-
if (isInForm && labelPosition === 'side' && label && contextualHelp) labelAndContextualHelp = /*#__PURE__*/ (0, $c6ZG4$react).createElement("div", {
|
|
98
|
-
className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-labelCell')
|
|
99
|
-
}, /*#__PURE__*/ (0, $c6ZG4$react).createElement("div", {
|
|
100
|
-
className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-labelWrapper')
|
|
101
|
-
}, labelAndContextualHelp));
|
|
102
|
-
return /*#__PURE__*/ (0, $c6ZG4$react).createElement("div", {
|
|
103
|
-
...styleProps,
|
|
104
|
-
...wrapperProps,
|
|
105
|
-
ref: ref,
|
|
106
|
-
className: labelWrapperClass
|
|
107
|
-
}, labelAndContextualHelp, renderChildren());
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export {$b7ca5b4454a2009d$export$a455218a85c89869 as Field};
|
|
112
|
-
//# sourceMappingURL=Field.module.js.map
|
package/dist/Field.module.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import {HelpText as $8e50676506611310$export$a67c0bc59081311a} from "./HelpText.module.js";
|
|
2
|
-
import {Label as $00af9ba397a66f43$export$b04be29aa201d4f5} from "./Label.module.js";
|
|
3
|
-
import "./label.fb8aa6a3.css";
|
|
4
|
-
import $c6ZG4$fieldlabel_vars_cssmodulejs from "./fieldlabel_vars_css.module.js";
|
|
5
|
-
import {useStyleProps as $c6ZG4$useStyleProps, classNames as $c6ZG4$classNames, SlotProvider as $c6ZG4$SlotProvider} from "@react-spectrum/utils";
|
|
6
|
-
import {Flex as $c6ZG4$Flex} from "@react-spectrum/layout";
|
|
7
|
-
import {useId as $c6ZG4$useId, mergeProps as $c6ZG4$mergeProps} from "@react-aria/utils";
|
|
8
|
-
import $c6ZG4$react from "react";
|
|
9
|
-
import {useFormProps as $c6ZG4$useFormProps} from "@react-spectrum/form";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function $parcel$interopDefault(a) {
|
|
13
|
-
return a && a.__esModule ? a.default : a;
|
|
14
|
-
}
|
|
15
|
-
/*
|
|
16
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
-
*
|
|
21
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
-
* governing permissions and limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const $b7ca5b4454a2009d$export$a455218a85c89869 = /*#__PURE__*/ (0, $c6ZG4$react).forwardRef(function Field(props, ref) {
|
|
34
|
-
let formProps = (0, $c6ZG4$useFormProps)(props);
|
|
35
|
-
let isInForm = formProps !== props;
|
|
36
|
-
props = formProps;
|
|
37
|
-
let { label: label, labelPosition: labelPosition = 'top', labelAlign: labelAlign, isRequired: isRequired, necessityIndicator: necessityIndicator, includeNecessityIndicatorInAccessibilityName: includeNecessityIndicatorInAccessibilityName, validationState: validationState, isInvalid: isInvalid, description: description, errorMessage: errorMessage = (e)=>e.validationErrors.join(' '), validationErrors: validationErrors, validationDetails: validationDetails, isDisabled: isDisabled, showErrorIcon: showErrorIcon, contextualHelp: contextualHelp, children: children, labelProps: labelProps = {}, descriptionProps: // Not every component that uses <Field> supports help text.
|
|
38
|
-
descriptionProps = {}, errorMessageProps: errorMessageProps = {}, elementType: elementType, wrapperClassName: wrapperClassName, wrapperProps: wrapperProps = {}, ...otherProps } = props;
|
|
39
|
-
let { styleProps: styleProps } = (0, $c6ZG4$useStyleProps)(otherProps);
|
|
40
|
-
let errorMessageString = null;
|
|
41
|
-
if (typeof errorMessage === 'function') errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null ? errorMessage({
|
|
42
|
-
isInvalid: isInvalid,
|
|
43
|
-
validationErrors: validationErrors,
|
|
44
|
-
validationDetails: validationDetails
|
|
45
|
-
}) : null;
|
|
46
|
-
else errorMessageString = errorMessage;
|
|
47
|
-
let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');
|
|
48
|
-
let contextualHelpId = (0, $c6ZG4$useId)();
|
|
49
|
-
let fallbackLabelPropsId = (0, $c6ZG4$useId)();
|
|
50
|
-
if (label && contextualHelp && !labelProps.id) labelProps.id = fallbackLabelPropsId;
|
|
51
|
-
let labelWrapperClass = (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field', {
|
|
52
|
-
'spectrum-Field--positionTop': labelPosition === 'top',
|
|
53
|
-
'spectrum-Field--positionSide': labelPosition === 'side',
|
|
54
|
-
'spectrum-Field--alignEnd': labelAlign === 'end',
|
|
55
|
-
'spectrum-Field--hasContextualHelp': !!props.contextualHelp
|
|
56
|
-
}, styleProps.className, wrapperClassName);
|
|
57
|
-
children = /*#__PURE__*/ (0, $c6ZG4$react).cloneElement(children, (0, $c6ZG4$mergeProps)(children.props, {
|
|
58
|
-
className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-field')
|
|
59
|
-
}));
|
|
60
|
-
let renderHelpText = ()=>/*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $8e50676506611310$export$a67c0bc59081311a), {
|
|
61
|
-
descriptionProps: descriptionProps,
|
|
62
|
-
errorMessageProps: errorMessageProps,
|
|
63
|
-
description: description,
|
|
64
|
-
errorMessage: errorMessageString,
|
|
65
|
-
validationState: validationState,
|
|
66
|
-
isInvalid: isInvalid,
|
|
67
|
-
isDisabled: isDisabled,
|
|
68
|
-
showErrorIcon: showErrorIcon,
|
|
69
|
-
gridArea: (0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))).helpText
|
|
70
|
-
});
|
|
71
|
-
let renderChildren = ()=>{
|
|
72
|
-
if (labelPosition === 'side') return /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$Flex), {
|
|
73
|
-
direction: "column",
|
|
74
|
-
UNSAFE_className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-wrapper')
|
|
75
|
-
}, children, hasHelpText && renderHelpText());
|
|
76
|
-
return /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$react).Fragment, null, children, hasHelpText && renderHelpText());
|
|
77
|
-
};
|
|
78
|
-
let labelAndContextualHelp = /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$react).Fragment, null, label && /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $00af9ba397a66f43$export$b04be29aa201d4f5), {
|
|
79
|
-
...labelProps,
|
|
80
|
-
labelPosition: labelPosition,
|
|
81
|
-
labelAlign: labelAlign,
|
|
82
|
-
isRequired: isRequired,
|
|
83
|
-
necessityIndicator: necessityIndicator,
|
|
84
|
-
includeNecessityIndicatorInAccessibilityName: includeNecessityIndicatorInAccessibilityName,
|
|
85
|
-
elementType: elementType
|
|
86
|
-
}, label), label && contextualHelp && /*#__PURE__*/ (0, $c6ZG4$react).createElement((0, $c6ZG4$SlotProvider), {
|
|
87
|
-
slots: {
|
|
88
|
-
actionButton: {
|
|
89
|
-
UNSAFE_className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-contextualHelp'),
|
|
90
|
-
id: contextualHelpId,
|
|
91
|
-
'aria-labelledby': (labelProps === null || labelProps === void 0 ? void 0 : labelProps.id) ? `${labelProps.id} ${contextualHelpId}` : undefined
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, contextualHelp));
|
|
95
|
-
// Need to add an extra wrapper for the label and contextual help if labelPosition is side,
|
|
96
|
-
// so that the table layout works inside forms.
|
|
97
|
-
if (isInForm && labelPosition === 'side' && label && contextualHelp) labelAndContextualHelp = /*#__PURE__*/ (0, $c6ZG4$react).createElement("div", {
|
|
98
|
-
className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-labelCell')
|
|
99
|
-
}, /*#__PURE__*/ (0, $c6ZG4$react).createElement("div", {
|
|
100
|
-
className: (0, $c6ZG4$classNames)((0, ($parcel$interopDefault($c6ZG4$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-labelWrapper')
|
|
101
|
-
}, labelAndContextualHelp));
|
|
102
|
-
return /*#__PURE__*/ (0, $c6ZG4$react).createElement("div", {
|
|
103
|
-
...styleProps,
|
|
104
|
-
...wrapperProps,
|
|
105
|
-
ref: ref,
|
|
106
|
-
className: labelWrapperClass
|
|
107
|
-
}, labelAndContextualHelp, renderChildren());
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export {$b7ca5b4454a2009d$export$a455218a85c89869 as Field};
|
|
112
|
-
//# sourceMappingURL=Field.module.js.map
|
package/dist/Field.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaM,MAAM,0DAAQ,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,MAAM,KAAyB,EAAE,GAAqB;IACnG,IAAI,YAAY,CAAA,GAAA,mBAAW,EAAE;IAC7B,IAAI,WAAW,cAAc;IAC7B,QAAQ;IACR,IAAI,SACF,KAAK,iBACL,gBAAgB,mBAChB,UAAU,cACV,UAAU,sBACV,kBAAkB,gDAClB,4CAA4C,mBAC5C,eAAe,aACf,SAAS,eACT,WAAW,gBACX,eAAe,CAAA,IAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,wBAC5C,gBAAgB,qBAChB,iBAAiB,cACjB,UAAU,iBACV,aAAa,kBACb,cAAc,YACd,QAAQ,cACR,aAAa,CAAC,qBACd,4DAA4D;IAC5D,mBAAmB,CAAC,sBACpB,oBAAoB,CAAC,gBACrB,WAAW,oBACX,gBAAgB,gBAChB,eAAe,CAAC,GAChB,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,qBAAgC;IACpC,IAAI,OAAO,iBAAiB,YAC1B,qBAAqB,aAAa,QAAQ,oBAAoB,QAAQ,qBAAqB,OACvF,aAAa;mBACb;0BACA;2BACA;IACF,KACE;SAEJ,qBAAqB;IAEvB,IAAI,cAAc,CAAC,CAAC,eAAe,sBAAuB,CAAA,aAAa,oBAAoB,SAAQ;IACnG,IAAI,mBAAmB,CAAA,GAAA,YAAI;IAE3B,IAAI,uBAAuB,CAAA,GAAA,YAAI;IAC/B,IAAI,SAAS,kBAAkB,CAAC,WAAW,EAAE,EAC3C,WAAW,EAAE,GAAG;IAGlB,IAAI,oBAAoB,CAAA,GAAA,iBAAS,EAC7B,CAAA,GAAA,4DAAU,GACV,kBACF;QACE,+BAA+B,kBAAkB;QACjD,gCAAgC,kBAAkB;QAClD,4BAA4B,eAAe;QAC3C,qCAAqC,CAAC,CAAC,MAAM,cAAc;IAC7D,GACE,WAAW,SAAS,EACpB;IAGJ,yBAAW,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,UAAU,CAAA,GAAA,iBAAS,EAAE,SAAS,KAAK,EAAS;QACxE,WAAW,CAAA,GAAA,iBAAS,EAChB,CAAA,GAAA,4DAAU,GACV;IAEN;IAEA,IAAI,iBAAiB,kBACnB,gCAAC,CAAA,GAAA,yCAAO;YACN,kBAAkB;YAClB,mBAAmB;YACnB,aAAa;YACb,cAAc;YACd,iBAAiB;YACjB,WAAW;YACX,YAAY;YACZ,eAAe;YACf,UAAU,CAAA,GAAA,4DAAU,EAAE,QAAQ;;IAGlC,IAAI,iBAAiB;QACnB,IAAI,kBAAkB,QACpB,qBACE,gCAAC,CAAA,GAAA,WAAG;YAAE,WAAU;YAAS,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;WAChE,UACA,eAAe;QAKtB,qBACE,kEACG,UACA,eAAe;IAGtB;IAEA,IAAI,uCACF,kEACG,uBACC,gCAAC,CAAA,GAAA,yCAAI;QACF,GAAG,UAAU;QACd,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,oBAAoB;QACpB,8CAA8C;QAC9C,aAAa;OACZ,QAGJ,SAAS,gCACR,gCAAC,CAAA,GAAA,mBAAW;QACV,OAAO;YACL,cAAc;gBACZ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;gBAC1C,IAAI;gBACJ,mBAAmB,CAAA,uBAAA,iCAAA,WAAY,EAAE,IAAG,GAAG,WAAW,EAAE,CAAC,CAAC,EAAE,kBAAkB,GAAG;YAC/E;QACF;OACC;IAMP,2FAA2F;IAC3F,+CAA+C;IACjD,IAAI,YAAY,kBAAkB,UAAU,SAAS,gBACnD,uCACE,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;qBACtC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;OACrC;IAMT,qBACG,gCAAC;QACC,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,KAAK;QACL,WAAW;OACV,wBACA;AAGP","sources":["packages/@react-spectrum/label/src/Field.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\nimport {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';\nimport {Flex} from '@react-spectrum/layout';\nimport {HelpText} from './HelpText';\nimport {Label} from './Label';\nimport {LabelPosition, RefObject} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode, Ref} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nexport const Field = React.forwardRef(function Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {\n let formProps = useFormProps(props);\n let isInForm = formProps !== props;\n props = formProps;\n let {\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n includeNecessityIndicatorInAccessibilityName,\n validationState,\n isInvalid,\n description,\n errorMessage = e => e.validationErrors.join(' '),\n validationErrors,\n validationDetails,\n isDisabled,\n showErrorIcon,\n contextualHelp,\n children,\n labelProps = {},\n // Not every component that uses <Field> supports help text.\n descriptionProps = {},\n errorMessageProps = {},\n elementType,\n wrapperClassName,\n wrapperProps = {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let errorMessageString: ReactNode = null;\n if (typeof errorMessage === 'function') {\n errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null\n ? errorMessage({\n isInvalid,\n validationErrors,\n validationDetails\n })\n : null;\n } else {\n errorMessageString = errorMessage;\n }\n let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');\n let contextualHelpId = useId();\n\n let fallbackLabelPropsId = useId();\n if (label && contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side',\n 'spectrum-Field--alignEnd': labelAlign === 'end',\n 'spectrum-Field--hasContextualHelp': !!props.contextualHelp\n },\n styleProps.className,\n wrapperClassName\n );\n\n children = React.cloneElement(children, mergeProps(children.props as any, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field'\n )\n }));\n\n let renderHelpText = () => (\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessageString}\n validationState={validationState}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n showErrorIcon={showErrorIcon}\n gridArea={labelStyles.helpText} />\n );\n\n let renderChildren = () => {\n if (labelPosition === 'side') {\n return (\n <Flex direction=\"column\" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n {children}\n {hasHelpText && renderHelpText()}\n </Flex>\n );\n }\n\n return (\n <>\n {children}\n {hasHelpText && renderHelpText()}\n </>\n );\n };\n\n let labelAndContextualHelp = (\n <>\n {label && (\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}\n elementType={elementType}>\n {label}\n </Label>\n )}\n {label && contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined\n }\n }}>\n {contextualHelp}\n </SlotProvider>\n }\n </>\n );\n\n // Need to add an extra wrapper for the label and contextual help if labelPosition is side,\n // so that the table layout works inside forms.\n if (isInForm && labelPosition === 'side' && label && contextualHelp) {\n labelAndContextualHelp = (\n <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>\n <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>\n {labelAndContextualHelp}\n </div>\n </div>\n );\n }\n\n return (\n (<div\n {...styleProps}\n {...wrapperProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>)\n );\n});\n"],"names":[],"version":3,"file":"Field.module.js.map"}
|
package/dist/HelpText.main.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require("./label.16985598.css");
|
|
2
|
-
var $680ab92507bf49aa$exports = require("./helptext_vars_css.main.js");
|
|
3
|
-
var $7UMJk$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
|
|
4
|
-
var $7UMJk$reactspectrumutils = require("@react-spectrum/utils");
|
|
5
|
-
var $7UMJk$react = require("react");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function $parcel$interopDefault(a) {
|
|
9
|
-
return a && a.__esModule ? a.default : a;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function $parcel$export(e, n, v, s) {
|
|
13
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
$parcel$export(module.exports, "HelpText", () => $2d1b5114e5b358b6$export$a67c0bc59081311a);
|
|
17
|
-
/*
|
|
18
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
19
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
-
* governing permissions and limitations under the License.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const $2d1b5114e5b358b6$export$a67c0bc59081311a = /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).forwardRef(function HelpText(props, ref) {
|
|
32
|
-
let { description: description, errorMessage: errorMessage, validationState: validationState, isInvalid: isInvalid, isDisabled: isDisabled, showErrorIcon: showErrorIcon, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = props;
|
|
33
|
-
let domRef = (0, $7UMJk$reactspectrumutils.useDOMRef)(ref);
|
|
34
|
-
let isErrorMessage = errorMessage && (isInvalid || validationState === 'invalid');
|
|
35
|
-
let { styleProps: styleProps } = (0, $7UMJk$reactspectrumutils.useStyleProps)(props);
|
|
36
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).createElement("div", {
|
|
37
|
-
...styleProps,
|
|
38
|
-
className: (0, $7UMJk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($680ab92507bf49aa$exports))), 'spectrum-HelpText', `spectrum-HelpText--${isErrorMessage ? 'negative' : 'neutral'}`, {
|
|
39
|
-
'is-disabled': isDisabled
|
|
40
|
-
}, styleProps.className),
|
|
41
|
-
ref: domRef
|
|
42
|
-
}, isErrorMessage ? /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).createElement((0, ($parcel$interopDefault($7UMJk$react))).Fragment, null, showErrorIcon && /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).createElement((0, ($parcel$interopDefault($7UMJk$spectrumiconsuiAlertMedium))), {
|
|
43
|
-
UNSAFE_className: (0, $7UMJk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($680ab92507bf49aa$exports))), 'spectrum-HelpText-validationIcon')
|
|
44
|
-
}), /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).createElement("div", {
|
|
45
|
-
...errorMessageProps,
|
|
46
|
-
className: (0, $7UMJk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($680ab92507bf49aa$exports))), 'spectrum-HelpText-text')
|
|
47
|
-
}, errorMessage)) : /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).createElement("div", {
|
|
48
|
-
...descriptionProps,
|
|
49
|
-
className: (0, $7UMJk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($680ab92507bf49aa$exports))), 'spectrum-HelpText-text')
|
|
50
|
-
}, description));
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=HelpText.main.js.map
|