@react-aria/label 3.7.6 → 3.7.8

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 CHANGED
@@ -1,26 +1,7 @@
1
- import {useSlotId as $iD7q0$useSlotId, mergeProps as $iD7q0$mergeProps, useId as $iD7q0$useId, useLabels as $iD7q0$useLabels} from "@react-aria/utils";
1
+ import {useField as $2baaea4c71418dea$export$294aa081a6c6f55d} from "./useField.mjs";
2
+ import {useLabel as $d191a55c9702f145$export$8467354a121f1b9f} from "./useLabel.mjs";
2
3
 
3
4
  /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */ /*
14
- * Copyright 2021 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
- */ /*
24
5
  * Copyright 2020 Adobe. All rights reserved.
25
6
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
7
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -31,67 +12,6 @@ import {useSlotId as $iD7q0$useSlotId, mergeProps as $iD7q0$mergeProps, useId as
31
12
  * OF ANY KIND, either express or implied. See the License for the specific language
32
13
  * governing permissions and limitations under the License.
33
14
  */
34
- function $d191a55c9702f145$export$8467354a121f1b9f(props) {
35
- let { id: id, label: label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType: labelElementType = "label" } = props;
36
- id = (0, $iD7q0$useId)(id);
37
- let labelId = (0, $iD7q0$useId)();
38
- let labelProps = {};
39
- if (label) {
40
- ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
41
- labelProps = {
42
- id: labelId,
43
- htmlFor: labelElementType === "label" ? id : undefined
44
- };
45
- } else if (!ariaLabelledby && !ariaLabel) console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
46
- let fieldProps = (0, $iD7q0$useLabels)({
47
- id: id,
48
- "aria-label": ariaLabel,
49
- "aria-labelledby": ariaLabelledby
50
- });
51
- return {
52
- labelProps: labelProps,
53
- fieldProps: fieldProps
54
- };
55
- }
56
-
57
-
58
-
59
- function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
60
- let { description: description, errorMessage: errorMessage, isInvalid: isInvalid, validationState: validationState } = props;
61
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $d191a55c9702f145$export$8467354a121f1b9f)(props);
62
- let descriptionId = (0, $iD7q0$useSlotId)([
63
- Boolean(description),
64
- Boolean(errorMessage),
65
- isInvalid,
66
- validationState
67
- ]);
68
- let errorMessageId = (0, $iD7q0$useSlotId)([
69
- Boolean(description),
70
- Boolean(errorMessage),
71
- isInvalid,
72
- validationState
73
- ]);
74
- fieldProps = (0, $iD7q0$mergeProps)(fieldProps, {
75
- "aria-describedby": [
76
- descriptionId,
77
- // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
78
- errorMessageId,
79
- props["aria-describedby"]
80
- ].filter(Boolean).join(" ") || undefined
81
- });
82
- return {
83
- labelProps: labelProps,
84
- fieldProps: fieldProps,
85
- descriptionProps: {
86
- id: descriptionId
87
- },
88
- errorMessageProps: {
89
- id: errorMessageId
90
- }
91
- };
92
- }
93
-
94
-
95
15
 
96
16
 
97
17
 
package/dist/main.js CHANGED
@@ -1,33 +1,14 @@
1
- var $g2CPN$reactariautils = require("@react-aria/utils");
1
+ var $50e2f39368b9c636$exports = require("./useField.main.js");
2
+ var $ce7359c25a7dec1c$exports = require("./useLabel.main.js");
2
3
 
3
4
 
4
5
  function $parcel$export(e, n, v, s) {
5
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
7
  }
7
8
 
8
- $parcel$export(module.exports, "useField", () => $50e2f39368b9c636$export$294aa081a6c6f55d);
9
- $parcel$export(module.exports, "useLabel", () => $ce7359c25a7dec1c$export$8467354a121f1b9f);
9
+ $parcel$export(module.exports, "useField", () => $50e2f39368b9c636$exports.useField);
10
+ $parcel$export(module.exports, "useLabel", () => $ce7359c25a7dec1c$exports.useLabel);
10
11
  /*
11
- * Copyright 2020 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */ /*
21
- * Copyright 2021 Adobe. All rights reserved.
22
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
23
- * you may not use this file except in compliance with the License. You may obtain a copy
24
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
25
- *
26
- * Unless required by applicable law or agreed to in writing, software distributed under
27
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
28
- * OF ANY KIND, either express or implied. See the License for the specific language
29
- * governing permissions and limitations under the License.
30
- */ /*
31
12
  * Copyright 2020 Adobe. All rights reserved.
32
13
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
33
14
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -38,67 +19,6 @@ $parcel$export(module.exports, "useLabel", () => $ce7359c25a7dec1c$export$846735
38
19
  * OF ANY KIND, either express or implied. See the License for the specific language
39
20
  * governing permissions and limitations under the License.
40
21
  */
41
- function $ce7359c25a7dec1c$export$8467354a121f1b9f(props) {
42
- let { id: id, label: label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType: labelElementType = "label" } = props;
43
- id = (0, $g2CPN$reactariautils.useId)(id);
44
- let labelId = (0, $g2CPN$reactariautils.useId)();
45
- let labelProps = {};
46
- if (label) {
47
- ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
48
- labelProps = {
49
- id: labelId,
50
- htmlFor: labelElementType === "label" ? id : undefined
51
- };
52
- } else if (!ariaLabelledby && !ariaLabel) console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
53
- let fieldProps = (0, $g2CPN$reactariautils.useLabels)({
54
- id: id,
55
- "aria-label": ariaLabel,
56
- "aria-labelledby": ariaLabelledby
57
- });
58
- return {
59
- labelProps: labelProps,
60
- fieldProps: fieldProps
61
- };
62
- }
63
-
64
-
65
-
66
- function $50e2f39368b9c636$export$294aa081a6c6f55d(props) {
67
- let { description: description, errorMessage: errorMessage, isInvalid: isInvalid, validationState: validationState } = props;
68
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $ce7359c25a7dec1c$export$8467354a121f1b9f)(props);
69
- let descriptionId = (0, $g2CPN$reactariautils.useSlotId)([
70
- Boolean(description),
71
- Boolean(errorMessage),
72
- isInvalid,
73
- validationState
74
- ]);
75
- let errorMessageId = (0, $g2CPN$reactariautils.useSlotId)([
76
- Boolean(description),
77
- Boolean(errorMessage),
78
- isInvalid,
79
- validationState
80
- ]);
81
- fieldProps = (0, $g2CPN$reactariautils.mergeProps)(fieldProps, {
82
- "aria-describedby": [
83
- descriptionId,
84
- // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
85
- errorMessageId,
86
- props["aria-describedby"]
87
- ].filter(Boolean).join(" ") || undefined
88
- });
89
- return {
90
- labelProps: labelProps,
91
- fieldProps: fieldProps,
92
- descriptionProps: {
93
- id: descriptionId
94
- },
95
- errorMessageProps: {
96
- id: errorMessageId
97
- }
98
- };
99
- }
100
-
101
-
102
22
 
103
23
 
104
24
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;AA0BM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,MACF,EAAE,SACF,KAAK,EACL,mBAAmB,cAAc,EACjC,cAAc,SAAS,oBACvB,mBAAmB,SACpB,GAAG;IAEJ,KAAK,CAAA,GAAA,2BAAI,EAAE;IACX,IAAI,UAAU,CAAA,GAAA,2BAAI;IAClB,IAAI,aAAa,CAAC;IAClB,IAAI,OAAO;QACT,iBAAiB,iBAAiB,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe,CAAC,GAAG;QACnE,aAAa;YACX,IAAI;YACJ,SAAS,qBAAqB,UAAU,KAAK;QAC/C;IACF,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAC7B,QAAQ,IAAI,CAAC;IAGf,IAAI,aAAa,CAAA,GAAA,+BAAQ,EAAE;YACzB;QACA,cAAc;QACd,mBAAmB;IACrB;IAEA,OAAO;oBACL;oBACA;IACF;AACF;;CD1DC;;AAoBM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,eAAC,WAAW,gBAAE,YAAY,aAAE,SAAS,mBAAE,eAAe,EAAC,GAAG;IAC9D,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;IAExC,IAAI,gBAAgB,CAAA,GAAA,+BAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IACvG,IAAI,iBAAiB,CAAA,GAAA,+BAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IAExG,aAAa,CAAA,GAAA,gCAAS,EAAE,YAAY;QAClC,oBAAoB;YAClB;YACA,0LAA0L;YAC1L;YACA,KAAK,CAAC,mBAAmB;SAC1B,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;IACjC;IAEA,OAAO;oBACL;oBACA;QACA,kBAAkB;YAChB,IAAI;QACN;QACA,mBAAmB;YACjB,IAAI;QACN;IACF;AACF;;CD9CC","sources":["packages/@react-aria/label/src/index.ts","packages/@react-aria/label/src/useField.ts","packages/@react-aria/label/src/useLabel.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\nexport type {AriaFieldProps, FieldAria} from './useField';\nexport type {LabelAriaProps, LabelAria} from './useLabel';\n\nexport {useField} from './useField';\nexport {useLabel} from './useLabel';\n","/*\n * Copyright 2021 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 {DOMAttributes, HelpTextProps, Validation} from '@react-types/shared';\nimport {LabelAria, LabelAriaProps, useLabel} from './useLabel';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\n\nexport interface AriaFieldProps extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, 'isRequired'> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display a description or error message.\n * @param props - Props for the Field.\n */\nexport function useField(props: AriaFieldProps): FieldAria {\n let {description, errorMessage, isInvalid, validationState} = props;\n let {labelProps, fieldProps} = useLabel(props);\n\n let descriptionId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n let errorMessageId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n\n fieldProps = mergeProps(fieldProps, {\n 'aria-describedby': [\n descriptionId,\n // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n errorMessageId,\n props['aria-describedby']\n ].filter(Boolean).join(' ') || undefined\n });\n\n return {\n labelProps,\n fieldProps,\n descriptionProps: {\n id: descriptionId\n },\n errorMessageProps: {\n id: errorMessageId\n }\n };\n}\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 {AriaLabelingProps, DOMAttributes, DOMProps, LabelableProps} from '@react-types/shared';\nimport {ElementType, LabelHTMLAttributes} from 'react';\nimport {useId, useLabels} from '@react-aria/utils';\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: ElementType\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: DOMAttributes | LabelHTMLAttributes<HTMLLabelElement>,\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps\n}\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n * @param props - The props for labels and fields.\n */\nexport function useLabel(props: LabelAriaProps): LabelAria {\n let {\n id,\n label,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n labelElementType = 'label'\n } = props;\n\n id = useId(id);\n let labelId = useId();\n let labelProps = {};\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === 'label' ? id : undefined\n };\n } else if (!ariaLabelledby && !ariaLabel) {\n console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');\n }\n\n let fieldProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n });\n\n return {\n labelProps,\n fieldProps\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/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\nexport type {AriaFieldProps, FieldAria} from './useField';\nexport type {LabelAriaProps, LabelAria} from './useLabel';\n\nexport {useField} from './useField';\nexport {useLabel} from './useLabel';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,26 +1,7 @@
1
- import {useSlotId as $iD7q0$useSlotId, mergeProps as $iD7q0$mergeProps, useId as $iD7q0$useId, useLabels as $iD7q0$useLabels} from "@react-aria/utils";
1
+ import {useField as $2baaea4c71418dea$export$294aa081a6c6f55d} from "./useField.module.js";
2
+ import {useLabel as $d191a55c9702f145$export$8467354a121f1b9f} from "./useLabel.module.js";
2
3
 
3
4
  /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */ /*
14
- * Copyright 2021 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
- */ /*
24
5
  * Copyright 2020 Adobe. All rights reserved.
25
6
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
7
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -31,67 +12,6 @@ import {useSlotId as $iD7q0$useSlotId, mergeProps as $iD7q0$mergeProps, useId as
31
12
  * OF ANY KIND, either express or implied. See the License for the specific language
32
13
  * governing permissions and limitations under the License.
33
14
  */
34
- function $d191a55c9702f145$export$8467354a121f1b9f(props) {
35
- let { id: id, label: label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType: labelElementType = "label" } = props;
36
- id = (0, $iD7q0$useId)(id);
37
- let labelId = (0, $iD7q0$useId)();
38
- let labelProps = {};
39
- if (label) {
40
- ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
41
- labelProps = {
42
- id: labelId,
43
- htmlFor: labelElementType === "label" ? id : undefined
44
- };
45
- } else if (!ariaLabelledby && !ariaLabel) console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
46
- let fieldProps = (0, $iD7q0$useLabels)({
47
- id: id,
48
- "aria-label": ariaLabel,
49
- "aria-labelledby": ariaLabelledby
50
- });
51
- return {
52
- labelProps: labelProps,
53
- fieldProps: fieldProps
54
- };
55
- }
56
-
57
-
58
-
59
- function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
60
- let { description: description, errorMessage: errorMessage, isInvalid: isInvalid, validationState: validationState } = props;
61
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $d191a55c9702f145$export$8467354a121f1b9f)(props);
62
- let descriptionId = (0, $iD7q0$useSlotId)([
63
- Boolean(description),
64
- Boolean(errorMessage),
65
- isInvalid,
66
- validationState
67
- ]);
68
- let errorMessageId = (0, $iD7q0$useSlotId)([
69
- Boolean(description),
70
- Boolean(errorMessage),
71
- isInvalid,
72
- validationState
73
- ]);
74
- fieldProps = (0, $iD7q0$mergeProps)(fieldProps, {
75
- "aria-describedby": [
76
- descriptionId,
77
- // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
78
- errorMessageId,
79
- props["aria-describedby"]
80
- ].filter(Boolean).join(" ") || undefined
81
- });
82
- return {
83
- labelProps: labelProps,
84
- fieldProps: fieldProps,
85
- descriptionProps: {
86
- id: descriptionId
87
- },
88
- errorMessageProps: {
89
- id: errorMessageId
90
- }
91
- };
92
- }
93
-
94
-
95
15
 
96
16
 
97
17
 
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;AA0BM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,MACF,EAAE,SACF,KAAK,EACL,mBAAmB,cAAc,EACjC,cAAc,SAAS,oBACvB,mBAAmB,SACpB,GAAG;IAEJ,KAAK,CAAA,GAAA,YAAI,EAAE;IACX,IAAI,UAAU,CAAA,GAAA,YAAI;IAClB,IAAI,aAAa,CAAC;IAClB,IAAI,OAAO;QACT,iBAAiB,iBAAiB,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe,CAAC,GAAG;QACnE,aAAa;YACX,IAAI;YACJ,SAAS,qBAAqB,UAAU,KAAK;QAC/C;IACF,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAC7B,QAAQ,IAAI,CAAC;IAGf,IAAI,aAAa,CAAA,GAAA,gBAAQ,EAAE;YACzB;QACA,cAAc;QACd,mBAAmB;IACrB;IAEA,OAAO;oBACL;oBACA;IACF;AACF;;CD1DC;;AAoBM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,eAAC,WAAW,gBAAE,YAAY,aAAE,SAAS,mBAAE,eAAe,EAAC,GAAG;IAC9D,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;IAExC,IAAI,gBAAgB,CAAA,GAAA,gBAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IACvG,IAAI,iBAAiB,CAAA,GAAA,gBAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IAExG,aAAa,CAAA,GAAA,iBAAS,EAAE,YAAY;QAClC,oBAAoB;YAClB;YACA,0LAA0L;YAC1L;YACA,KAAK,CAAC,mBAAmB;SAC1B,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;IACjC;IAEA,OAAO;oBACL;oBACA;QACA,kBAAkB;YAChB,IAAI;QACN;QACA,mBAAmB;YACjB,IAAI;QACN;IACF;AACF;;CD9CC","sources":["packages/@react-aria/label/src/index.ts","packages/@react-aria/label/src/useField.ts","packages/@react-aria/label/src/useLabel.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\nexport type {AriaFieldProps, FieldAria} from './useField';\nexport type {LabelAriaProps, LabelAria} from './useLabel';\n\nexport {useField} from './useField';\nexport {useLabel} from './useLabel';\n","/*\n * Copyright 2021 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 {DOMAttributes, HelpTextProps, Validation} from '@react-types/shared';\nimport {LabelAria, LabelAriaProps, useLabel} from './useLabel';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\n\nexport interface AriaFieldProps extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, 'isRequired'> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display a description or error message.\n * @param props - Props for the Field.\n */\nexport function useField(props: AriaFieldProps): FieldAria {\n let {description, errorMessage, isInvalid, validationState} = props;\n let {labelProps, fieldProps} = useLabel(props);\n\n let descriptionId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n let errorMessageId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n\n fieldProps = mergeProps(fieldProps, {\n 'aria-describedby': [\n descriptionId,\n // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n errorMessageId,\n props['aria-describedby']\n ].filter(Boolean).join(' ') || undefined\n });\n\n return {\n labelProps,\n fieldProps,\n descriptionProps: {\n id: descriptionId\n },\n errorMessageProps: {\n id: errorMessageId\n }\n };\n}\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 {AriaLabelingProps, DOMAttributes, DOMProps, LabelableProps} from '@react-types/shared';\nimport {ElementType, LabelHTMLAttributes} from 'react';\nimport {useId, useLabels} from '@react-aria/utils';\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: ElementType\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: DOMAttributes | LabelHTMLAttributes<HTMLLabelElement>,\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps\n}\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n * @param props - The props for labels and fields.\n */\nexport function useLabel(props: LabelAriaProps): LabelAria {\n let {\n id,\n label,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n labelElementType = 'label'\n } = props;\n\n id = useId(id);\n let labelId = useId();\n let labelProps = {};\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === 'label' ? id : undefined\n };\n } else if (!ariaLabelledby && !ariaLabel) {\n console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');\n }\n\n let fieldProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n });\n\n return {\n labelProps,\n fieldProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/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\nexport type {AriaFieldProps, FieldAria} from './useField';\nexport type {LabelAriaProps, LabelAria} from './useLabel';\n\nexport {useField} from './useField';\nexport {useLabel} from './useLabel';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,58 @@
1
+ var $ce7359c25a7dec1c$exports = require("./useLabel.main.js");
2
+ var $iujgQ$reactariautils = require("@react-aria/utils");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useField", () => $50e2f39368b9c636$export$294aa081a6c6f55d);
10
+ /*
11
+ * Copyright 2021 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ function $50e2f39368b9c636$export$294aa081a6c6f55d(props) {
23
+ let { description: description, errorMessage: errorMessage, isInvalid: isInvalid, validationState: validationState } = props;
24
+ let { labelProps: labelProps, fieldProps: fieldProps } = (0, $ce7359c25a7dec1c$exports.useLabel)(props);
25
+ let descriptionId = (0, $iujgQ$reactariautils.useSlotId)([
26
+ Boolean(description),
27
+ Boolean(errorMessage),
28
+ isInvalid,
29
+ validationState
30
+ ]);
31
+ let errorMessageId = (0, $iujgQ$reactariautils.useSlotId)([
32
+ Boolean(description),
33
+ Boolean(errorMessage),
34
+ isInvalid,
35
+ validationState
36
+ ]);
37
+ fieldProps = (0, $iujgQ$reactariautils.mergeProps)(fieldProps, {
38
+ 'aria-describedby': [
39
+ descriptionId,
40
+ // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
41
+ errorMessageId,
42
+ props['aria-describedby']
43
+ ].filter(Boolean).join(' ') || undefined
44
+ });
45
+ return {
46
+ labelProps: labelProps,
47
+ fieldProps: fieldProps,
48
+ descriptionProps: {
49
+ id: descriptionId
50
+ },
51
+ errorMessageProps: {
52
+ id: errorMessageId
53
+ }
54
+ };
55
+ }
56
+
57
+
58
+ //# sourceMappingURL=useField.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAoBM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,eAAC,WAAW,gBAAE,YAAY,aAAE,SAAS,mBAAE,eAAe,EAAC,GAAG;IAC9D,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;IAExC,IAAI,gBAAgB,CAAA,GAAA,+BAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IACvG,IAAI,iBAAiB,CAAA,GAAA,+BAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IAExG,aAAa,CAAA,GAAA,gCAAS,EAAE,YAAY;QAClC,oBAAoB;YAClB;YACA,0LAA0L;YAC1L;YACA,KAAK,CAAC,mBAAmB;SAC1B,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;IACjC;IAEA,OAAO;oBACL;oBACA;QACA,kBAAkB;YAChB,IAAI;QACN;QACA,mBAAmB;YACjB,IAAI;QACN;IACF;AACF","sources":["packages/@react-aria/label/src/useField.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {DOMAttributes, HelpTextProps, Validation} from '@react-types/shared';\nimport {LabelAria, LabelAriaProps, useLabel} from './useLabel';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\n\nexport interface AriaFieldProps extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, 'isRequired'> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display a description or error message.\n * @param props - Props for the Field.\n */\nexport function useField(props: AriaFieldProps): FieldAria {\n let {description, errorMessage, isInvalid, validationState} = props;\n let {labelProps, fieldProps} = useLabel(props);\n\n let descriptionId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n let errorMessageId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n\n fieldProps = mergeProps(fieldProps, {\n 'aria-describedby': [\n descriptionId,\n // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n errorMessageId,\n props['aria-describedby']\n ].filter(Boolean).join(' ') || undefined\n });\n\n return {\n labelProps,\n fieldProps,\n descriptionProps: {\n id: descriptionId\n },\n errorMessageProps: {\n id: errorMessageId\n }\n };\n}\n"],"names":[],"version":3,"file":"useField.main.js.map"}
@@ -0,0 +1,53 @@
1
+ import {useLabel as $d191a55c9702f145$export$8467354a121f1b9f} from "./useLabel.mjs";
2
+ import {useSlotId as $2kC82$useSlotId, mergeProps as $2kC82$mergeProps} from "@react-aria/utils";
3
+
4
+ /*
5
+ * Copyright 2021 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
17
+ let { description: description, errorMessage: errorMessage, isInvalid: isInvalid, validationState: validationState } = props;
18
+ let { labelProps: labelProps, fieldProps: fieldProps } = (0, $d191a55c9702f145$export$8467354a121f1b9f)(props);
19
+ let descriptionId = (0, $2kC82$useSlotId)([
20
+ Boolean(description),
21
+ Boolean(errorMessage),
22
+ isInvalid,
23
+ validationState
24
+ ]);
25
+ let errorMessageId = (0, $2kC82$useSlotId)([
26
+ Boolean(description),
27
+ Boolean(errorMessage),
28
+ isInvalid,
29
+ validationState
30
+ ]);
31
+ fieldProps = (0, $2kC82$mergeProps)(fieldProps, {
32
+ 'aria-describedby': [
33
+ descriptionId,
34
+ // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
35
+ errorMessageId,
36
+ props['aria-describedby']
37
+ ].filter(Boolean).join(' ') || undefined
38
+ });
39
+ return {
40
+ labelProps: labelProps,
41
+ fieldProps: fieldProps,
42
+ descriptionProps: {
43
+ id: descriptionId
44
+ },
45
+ errorMessageProps: {
46
+ id: errorMessageId
47
+ }
48
+ };
49
+ }
50
+
51
+
52
+ export {$2baaea4c71418dea$export$294aa081a6c6f55d as useField};
53
+ //# sourceMappingURL=useField.module.js.map
@@ -0,0 +1,53 @@
1
+ import {useLabel as $d191a55c9702f145$export$8467354a121f1b9f} from "./useLabel.module.js";
2
+ import {useSlotId as $2kC82$useSlotId, mergeProps as $2kC82$mergeProps} from "@react-aria/utils";
3
+
4
+ /*
5
+ * Copyright 2021 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
17
+ let { description: description, errorMessage: errorMessage, isInvalid: isInvalid, validationState: validationState } = props;
18
+ let { labelProps: labelProps, fieldProps: fieldProps } = (0, $d191a55c9702f145$export$8467354a121f1b9f)(props);
19
+ let descriptionId = (0, $2kC82$useSlotId)([
20
+ Boolean(description),
21
+ Boolean(errorMessage),
22
+ isInvalid,
23
+ validationState
24
+ ]);
25
+ let errorMessageId = (0, $2kC82$useSlotId)([
26
+ Boolean(description),
27
+ Boolean(errorMessage),
28
+ isInvalid,
29
+ validationState
30
+ ]);
31
+ fieldProps = (0, $2kC82$mergeProps)(fieldProps, {
32
+ 'aria-describedby': [
33
+ descriptionId,
34
+ // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
35
+ errorMessageId,
36
+ props['aria-describedby']
37
+ ].filter(Boolean).join(' ') || undefined
38
+ });
39
+ return {
40
+ labelProps: labelProps,
41
+ fieldProps: fieldProps,
42
+ descriptionProps: {
43
+ id: descriptionId
44
+ },
45
+ errorMessageProps: {
46
+ id: errorMessageId
47
+ }
48
+ };
49
+ }
50
+
51
+
52
+ export {$2baaea4c71418dea$export$294aa081a6c6f55d as useField};
53
+ //# sourceMappingURL=useField.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAoBM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,eAAC,WAAW,gBAAE,YAAY,aAAE,SAAS,mBAAE,eAAe,EAAC,GAAG;IAC9D,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;IAExC,IAAI,gBAAgB,CAAA,GAAA,gBAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IACvG,IAAI,iBAAiB,CAAA,GAAA,gBAAQ,EAAE;QAAC,QAAQ;QAAc,QAAQ;QAAe;QAAW;KAAgB;IAExG,aAAa,CAAA,GAAA,iBAAS,EAAE,YAAY;QAClC,oBAAoB;YAClB;YACA,0LAA0L;YAC1L;YACA,KAAK,CAAC,mBAAmB;SAC1B,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,QAAQ;IACjC;IAEA,OAAO;oBACL;oBACA;QACA,kBAAkB;YAChB,IAAI;QACN;QACA,mBAAmB;YACjB,IAAI;QACN;IACF;AACF","sources":["packages/@react-aria/label/src/useField.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {DOMAttributes, HelpTextProps, Validation} from '@react-types/shared';\nimport {LabelAria, LabelAriaProps, useLabel} from './useLabel';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\n\nexport interface AriaFieldProps extends LabelAriaProps, HelpTextProps, Omit<Validation<any>, 'isRequired'> {}\n\nexport interface FieldAria extends LabelAria {\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for input fields.\n * Fields accept user input, gain context from their label, and may display a description or error message.\n * @param props - Props for the Field.\n */\nexport function useField(props: AriaFieldProps): FieldAria {\n let {description, errorMessage, isInvalid, validationState} = props;\n let {labelProps, fieldProps} = useLabel(props);\n\n let descriptionId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n let errorMessageId = useSlotId([Boolean(description), Boolean(errorMessage), isInvalid, validationState]);\n\n fieldProps = mergeProps(fieldProps, {\n 'aria-describedby': [\n descriptionId,\n // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268\n errorMessageId,\n props['aria-describedby']\n ].filter(Boolean).join(' ') || undefined\n });\n\n return {\n labelProps,\n fieldProps,\n descriptionProps: {\n id: descriptionId\n },\n errorMessageProps: {\n id: errorMessageId\n }\n };\n}\n"],"names":[],"version":3,"file":"useField.module.js.map"}
@@ -0,0 +1,44 @@
1
+ var $eXjoL$reactariautils = require("@react-aria/utils");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "useLabel", () => $ce7359c25a7dec1c$export$8467354a121f1b9f);
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+ function $ce7359c25a7dec1c$export$8467354a121f1b9f(props) {
21
+ let { id: id, label: label, 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabel, labelElementType: labelElementType = 'label' } = props;
22
+ id = (0, $eXjoL$reactariautils.useId)(id);
23
+ let labelId = (0, $eXjoL$reactariautils.useId)();
24
+ let labelProps = {};
25
+ if (label) {
26
+ ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
27
+ labelProps = {
28
+ id: labelId,
29
+ htmlFor: labelElementType === 'label' ? id : undefined
30
+ };
31
+ } else if (!ariaLabelledby && !ariaLabel) console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
32
+ let fieldProps = (0, $eXjoL$reactariautils.useLabels)({
33
+ id: id,
34
+ 'aria-label': ariaLabel,
35
+ 'aria-labelledby': ariaLabelledby
36
+ });
37
+ return {
38
+ labelProps: labelProps,
39
+ fieldProps: fieldProps
40
+ };
41
+ }
42
+
43
+
44
+ //# sourceMappingURL=useLabel.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AA0BM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,MACF,EAAE,SACF,KAAK,EACL,mBAAmB,cAAc,EACjC,cAAc,SAAS,oBACvB,mBAAmB,SACpB,GAAG;IAEJ,KAAK,CAAA,GAAA,2BAAI,EAAE;IACX,IAAI,UAAU,CAAA,GAAA,2BAAI;IAClB,IAAI,aAAa,CAAC;IAClB,IAAI,OAAO;QACT,iBAAiB,iBAAiB,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe,CAAC,GAAG;QACnE,aAAa;YACX,IAAI;YACJ,SAAS,qBAAqB,UAAU,KAAK;QAC/C;IACF,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAC7B,QAAQ,IAAI,CAAC;IAGf,IAAI,aAAa,CAAA,GAAA,+BAAQ,EAAE;YACzB;QACA,cAAc;QACd,mBAAmB;IACrB;IAEA,OAAO;oBACL;oBACA;IACF;AACF","sources":["packages/@react-aria/label/src/useLabel.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\nimport {AriaLabelingProps, DOMAttributes, DOMProps, LabelableProps} from '@react-types/shared';\nimport {ElementType, LabelHTMLAttributes} from 'react';\nimport {useId, useLabels} from '@react-aria/utils';\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: ElementType\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: DOMAttributes | LabelHTMLAttributes<HTMLLabelElement>,\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps\n}\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n * @param props - The props for labels and fields.\n */\nexport function useLabel(props: LabelAriaProps): LabelAria {\n let {\n id,\n label,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n labelElementType = 'label'\n } = props;\n\n id = useId(id);\n let labelId = useId();\n let labelProps = {};\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === 'label' ? id : undefined\n };\n } else if (!ariaLabelledby && !ariaLabel) {\n console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');\n }\n\n let fieldProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n });\n\n return {\n labelProps,\n fieldProps\n };\n}\n"],"names":[],"version":3,"file":"useLabel.main.js.map"}
@@ -0,0 +1,39 @@
1
+ import {useId as $83Elw$useId, useLabels as $83Elw$useLabels} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
15
+ let { id: id, label: label, 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabel, labelElementType: labelElementType = 'label' } = props;
16
+ id = (0, $83Elw$useId)(id);
17
+ let labelId = (0, $83Elw$useId)();
18
+ let labelProps = {};
19
+ if (label) {
20
+ ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
21
+ labelProps = {
22
+ id: labelId,
23
+ htmlFor: labelElementType === 'label' ? id : undefined
24
+ };
25
+ } else if (!ariaLabelledby && !ariaLabel) console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
26
+ let fieldProps = (0, $83Elw$useLabels)({
27
+ id: id,
28
+ 'aria-label': ariaLabel,
29
+ 'aria-labelledby': ariaLabelledby
30
+ });
31
+ return {
32
+ labelProps: labelProps,
33
+ fieldProps: fieldProps
34
+ };
35
+ }
36
+
37
+
38
+ export {$d191a55c9702f145$export$8467354a121f1b9f as useLabel};
39
+ //# sourceMappingURL=useLabel.module.js.map
@@ -0,0 +1,39 @@
1
+ import {useId as $83Elw$useId, useLabels as $83Elw$useLabels} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
15
+ let { id: id, label: label, 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabel, labelElementType: labelElementType = 'label' } = props;
16
+ id = (0, $83Elw$useId)(id);
17
+ let labelId = (0, $83Elw$useId)();
18
+ let labelProps = {};
19
+ if (label) {
20
+ ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
21
+ labelProps = {
22
+ id: labelId,
23
+ htmlFor: labelElementType === 'label' ? id : undefined
24
+ };
25
+ } else if (!ariaLabelledby && !ariaLabel) console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
26
+ let fieldProps = (0, $83Elw$useLabels)({
27
+ id: id,
28
+ 'aria-label': ariaLabel,
29
+ 'aria-labelledby': ariaLabelledby
30
+ });
31
+ return {
32
+ labelProps: labelProps,
33
+ fieldProps: fieldProps
34
+ };
35
+ }
36
+
37
+
38
+ export {$d191a55c9702f145$export$8467354a121f1b9f as useLabel};
39
+ //# sourceMappingURL=useLabel.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AA0BM,SAAS,0CAAS,KAAqB;IAC5C,IAAI,MACF,EAAE,SACF,KAAK,EACL,mBAAmB,cAAc,EACjC,cAAc,SAAS,oBACvB,mBAAmB,SACpB,GAAG;IAEJ,KAAK,CAAA,GAAA,YAAI,EAAE;IACX,IAAI,UAAU,CAAA,GAAA,YAAI;IAClB,IAAI,aAAa,CAAC;IAClB,IAAI,OAAO;QACT,iBAAiB,iBAAiB,CAAC,EAAE,QAAQ,CAAC,EAAE,eAAe,CAAC,GAAG;QACnE,aAAa;YACX,IAAI;YACJ,SAAS,qBAAqB,UAAU,KAAK;QAC/C;IACF,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAC7B,QAAQ,IAAI,CAAC;IAGf,IAAI,aAAa,CAAA,GAAA,gBAAQ,EAAE;YACzB;QACA,cAAc;QACd,mBAAmB;IACrB;IAEA,OAAO;oBACL;oBACA;IACF;AACF","sources":["packages/@react-aria/label/src/useLabel.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\nimport {AriaLabelingProps, DOMAttributes, DOMProps, LabelableProps} from '@react-types/shared';\nimport {ElementType, LabelHTMLAttributes} from 'react';\nimport {useId, useLabels} from '@react-aria/utils';\n\nexport interface LabelAriaProps extends LabelableProps, DOMProps, AriaLabelingProps {\n /**\n * The HTML element used to render the label, e.g. 'label', or 'span'.\n * @default 'label'\n */\n labelElementType?: ElementType\n}\n\nexport interface LabelAria {\n /** Props to apply to the label container element. */\n labelProps: DOMAttributes | LabelHTMLAttributes<HTMLLabelElement>,\n /** Props to apply to the field container element being labeled. */\n fieldProps: AriaLabelingProps & DOMProps\n}\n\n/**\n * Provides the accessibility implementation for labels and their associated elements.\n * Labels provide context for user inputs.\n * @param props - The props for labels and fields.\n */\nexport function useLabel(props: LabelAriaProps): LabelAria {\n let {\n id,\n label,\n 'aria-labelledby': ariaLabelledby,\n 'aria-label': ariaLabel,\n labelElementType = 'label'\n } = props;\n\n id = useId(id);\n let labelId = useId();\n let labelProps = {};\n if (label) {\n ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;\n labelProps = {\n id: labelId,\n htmlFor: labelElementType === 'label' ? id : undefined\n };\n } else if (!ariaLabelledby && !ariaLabel) {\n console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');\n }\n\n let fieldProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n });\n\n return {\n labelProps,\n fieldProps\n };\n}\n"],"names":[],"version":3,"file":"useLabel.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/label",
3
- "version": "3.7.6",
3
+ "version": "3.7.8",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,8 +22,8 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/utils": "^3.23.2",
26
- "@react-types/shared": "^3.22.1",
25
+ "@react-aria/utils": "^3.24.1",
26
+ "@react-types/shared": "^3.23.1",
27
27
  "@swc/helpers": "^0.5.0"
28
28
  },
29
29
  "peerDependencies": {
@@ -32,5 +32,5 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "de9f84a22583fc741c29b341d14cd35ef4cca161"
35
+ "gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
36
36
  }