@react-aria/label 3.7.15 → 3.7.17

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.
@@ -28,7 +28,7 @@ function $ce7359c25a7dec1c$export$8467354a121f1b9f(props) {
28
28
  id: labelId,
29
29
  htmlFor: labelElementType === 'label' ? id : undefined
30
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');
31
+ } else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== 'production') console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
32
32
  let fieldProps = (0, $eXjoL$reactariautils.useLabels)({
33
33
  id: id,
34
34
  'aria-label': ariaLabel,
@@ -1 +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,GAAG,QAAQ,CAAC,EAAE,gBAAgB,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"}
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,GAAG,QAAQ,CAAC,EAAE,gBAAgB,GAAG;QACnE,aAAa;YACX,IAAI;YACJ,SAAS,qBAAqB,UAAU,KAAK;QAC/C;IACF,OAAO,IAAI,CAAC,kBAAkB,CAAC,aAAa,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACnE,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 && process.env.NODE_ENV !== 'production') {\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"}
package/dist/useLabel.mjs CHANGED
@@ -22,7 +22,7 @@ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
22
22
  id: labelId,
23
23
  htmlFor: labelElementType === 'label' ? id : undefined
24
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');
25
+ } else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== 'production') console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
26
26
  let fieldProps = (0, $83Elw$useLabels)({
27
27
  id: id,
28
28
  'aria-label': ariaLabel,
@@ -22,7 +22,7 @@ function $d191a55c9702f145$export$8467354a121f1b9f(props) {
22
22
  id: labelId,
23
23
  htmlFor: labelElementType === 'label' ? id : undefined
24
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');
25
+ } else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== 'production') console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
26
26
  let fieldProps = (0, $83Elw$useLabels)({
27
27
  id: id,
28
28
  'aria-label': ariaLabel,
@@ -1 +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,GAAG,QAAQ,CAAC,EAAE,gBAAgB,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"}
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,GAAG,QAAQ,CAAC,EAAE,gBAAgB,GAAG;QACnE,aAAa;YACX,IAAI;YACJ,SAAS,qBAAqB,UAAU,KAAK;QAC/C;IACF,OAAO,IAAI,CAAC,kBAAkB,CAAC,aAAa,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACnE,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 && process.env.NODE_ENV !== 'production') {\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.15",
3
+ "version": "3.7.17",
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.28.0",
26
- "@react-types/shared": "^3.28.0",
25
+ "@react-aria/utils": "^3.28.2",
26
+ "@react-types/shared": "^3.29.0",
27
27
  "@swc/helpers": "^0.5.0"
28
28
  },
29
29
  "peerDependencies": {
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
36
+ "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
37
37
  }
package/src/useLabel.ts CHANGED
@@ -52,7 +52,7 @@ export function useLabel(props: LabelAriaProps): LabelAria {
52
52
  id: labelId,
53
53
  htmlFor: labelElementType === 'label' ? id : undefined
54
54
  };
55
- } else if (!ariaLabelledby && !ariaLabel) {
55
+ } else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== 'production') {
56
56
  console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
57
57
  }
58
58