@react-spectrum/label 3.16.5-nightly.4555 → 3.16.5-nightly.4560

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.
Files changed (79) hide show
  1. package/dist/Field.main.js +118 -0
  2. package/dist/Field.main.js.map +1 -0
  3. package/dist/Field.mjs +113 -0
  4. package/dist/Field.module.js +113 -0
  5. package/dist/Field.module.js.map +1 -0
  6. package/dist/HelpText.main.js +57 -0
  7. package/dist/HelpText.main.js.map +1 -0
  8. package/dist/HelpText.mjs +52 -0
  9. package/dist/HelpText.module.js +52 -0
  10. package/dist/HelpText.module.js.map +1 -0
  11. package/dist/Label.main.js +68 -0
  12. package/dist/Label.main.js.map +1 -0
  13. package/dist/Label.mjs +63 -0
  14. package/dist/Label.module.js +63 -0
  15. package/dist/Label.module.js.map +1 -0
  16. package/dist/ar-AE.mjs +1 -1
  17. package/dist/bg-BG.mjs +1 -1
  18. package/dist/cs-CZ.mjs +1 -1
  19. package/dist/da-DK.mjs +1 -1
  20. package/dist/de-DE.mjs +1 -1
  21. package/dist/el-GR.mjs +1 -1
  22. package/dist/en-US.mjs +1 -1
  23. package/dist/es-ES.mjs +1 -1
  24. package/dist/et-EE.mjs +1 -1
  25. package/dist/fi-FI.mjs +1 -1
  26. package/dist/fieldlabel_vars_css.main.js +95 -0
  27. package/dist/fieldlabel_vars_css.main.js.map +1 -0
  28. package/dist/fieldlabel_vars_css.mjs +97 -0
  29. package/dist/fieldlabel_vars_css.module.js +97 -0
  30. package/dist/fieldlabel_vars_css.module.js.map +1 -0
  31. package/dist/fr-FR.mjs +1 -1
  32. package/dist/he-IL.mjs +1 -1
  33. package/dist/helptext_vars_css.main.js +41 -0
  34. package/dist/helptext_vars_css.main.js.map +1 -0
  35. package/dist/helptext_vars_css.mjs +43 -0
  36. package/dist/helptext_vars_css.module.js +43 -0
  37. package/dist/helptext_vars_css.module.js.map +1 -0
  38. package/dist/hr-HR.mjs +1 -1
  39. package/dist/hu-HU.mjs +1 -1
  40. package/dist/import.mjs +3 -431
  41. package/dist/intlStrings.main.js +108 -0
  42. package/dist/intlStrings.main.js.map +1 -0
  43. package/dist/intlStrings.mjs +110 -0
  44. package/dist/intlStrings.module.js +110 -0
  45. package/dist/intlStrings.module.js.map +1 -0
  46. package/dist/it-IT.mjs +1 -1
  47. package/dist/ja-JP.mjs +1 -1
  48. package/dist/ko-KR.mjs +1 -1
  49. package/dist/lt-LT.mjs +1 -1
  50. package/dist/lv-LV.mjs +1 -1
  51. package/dist/main.js +6 -430
  52. package/dist/main.js.map +1 -1
  53. package/dist/module.js +3 -431
  54. package/dist/module.js.map +1 -1
  55. package/dist/nb-NO.mjs +1 -1
  56. package/dist/nl-NL.mjs +1 -1
  57. package/dist/pl-PL.mjs +1 -1
  58. package/dist/pt-BR.mjs +1 -1
  59. package/dist/pt-PT.mjs +1 -1
  60. package/dist/ro-RO.mjs +1 -1
  61. package/dist/ru-RU.mjs +1 -1
  62. package/dist/sk-SK.mjs +1 -1
  63. package/dist/sl-SI.mjs +1 -1
  64. package/dist/sr-SP.mjs +1 -1
  65. package/dist/sv-SE.mjs +1 -1
  66. package/dist/tr-TR.mjs +1 -1
  67. package/dist/types.d.ts +3 -3
  68. package/dist/types.d.ts.map +1 -1
  69. package/dist/uk-UA.mjs +1 -1
  70. package/dist/vars.0af2d804.css +117 -0
  71. package/dist/vars.0af2d804.css.map +1 -0
  72. package/dist/{main.css → vars.d58685ae.css} +1 -118
  73. package/dist/vars.d58685ae.css.map +1 -0
  74. package/dist/zh-CN.mjs +1 -1
  75. package/dist/zh-TW.mjs +1 -1
  76. package/package.json +11 -11
  77. package/dist/main.css.map +0 -1
  78. package/dist/module.css +0 -388
  79. package/dist/module.css.map +0 -1
@@ -0,0 +1,118 @@
1
+ var $2d1b5114e5b358b6$exports = require("./HelpText.main.js");
2
+ var $38a9afbd39356629$exports = require("./Label.main.js");
3
+ require("./vars.d58685ae.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
+ function $0e5410371a445d59$var$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
+ let $0e5410371a445d59$export$a455218a85c89869 = /*#__PURE__*/ (0, ($parcel$interopDefault($bW4vJ$react))).forwardRef($0e5410371a445d59$var$Field);
116
+
117
+
118
+ //# sourceMappingURL=Field.main.js.map
@@ -0,0 +1 @@
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} 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, RefObject} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction 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, {\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>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>\n );\n}\n\nlet _Field = React.forwardRef(Field);\nexport {_Field as Field};\n"],"names":[],"version":3,"file":"Field.main.js.map"}
package/dist/Field.mjs ADDED
@@ -0,0 +1,113 @@
1
+ import {HelpText as $8e50676506611310$export$a67c0bc59081311a} from "./HelpText.mjs";
2
+ import {Label as $00af9ba397a66f43$export$b04be29aa201d4f5} from "./Label.mjs";
3
+ import "./vars.d58685ae.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
+ function $b7ca5b4454a2009d$var$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
+ let $b7ca5b4454a2009d$export$a455218a85c89869 = /*#__PURE__*/ (0, $c6ZG4$react).forwardRef($b7ca5b4454a2009d$var$Field);
110
+
111
+
112
+ export {$b7ca5b4454a2009d$export$a455218a85c89869 as Field};
113
+ //# sourceMappingURL=Field.mjs.map
@@ -0,0 +1,113 @@
1
+ import {HelpText as $8e50676506611310$export$a67c0bc59081311a} from "./HelpText.module.js";
2
+ import {Label as $00af9ba397a66f43$export$b04be29aa201d4f5} from "./Label.module.js";
3
+ import "./vars.d58685ae.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
+ function $b7ca5b4454a2009d$var$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
+ let $b7ca5b4454a2009d$export$a455218a85c89869 = /*#__PURE__*/ (0, $c6ZG4$react).forwardRef($b7ca5b4454a2009d$var$Field);
110
+
111
+
112
+ export {$b7ca5b4454a2009d$export$a455218a85c89869 as Field};
113
+ //# sourceMappingURL=Field.module.js.map
@@ -0,0 +1 @@
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} 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, RefObject} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction 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, {\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>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>\n );\n}\n\nlet _Field = React.forwardRef(Field);\nexport {_Field as Field};\n"],"names":[],"version":3,"file":"Field.module.js.map"}
@@ -0,0 +1,57 @@
1
+ require("./vars.0af2d804.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
+ function $2d1b5114e5b358b6$var$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
+ * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.
54
+ */ const $2d1b5114e5b358b6$export$a67c0bc59081311a = /*#__PURE__*/ (0, ($parcel$interopDefault($7UMJk$react))).forwardRef($2d1b5114e5b358b6$var$HelpText);
55
+
56
+
57
+ //# sourceMappingURL=HelpText.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiBD,SAAS,+BAAS,KAAoB,EAAE,GAA2B;IACjE,IAAI,eACF,WAAW,gBACX,YAAY,mBACZ,eAAe,aACf,SAAS,cACT,UAAU,iBACV,aAAa,oBACb,gBAAgB,qBAChB,iBAAiB,EAClB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,iBAAiB,gBAAiB,CAAA,aAAa,oBAAoB,SAAQ;IAC/E,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAEjC,qBACE,0DAAC;QACE,GAAG,UAAU;QACd,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,qBACA,CAAC,mBAAmB,EAAE,iBAAiB,aAAa,UAAU,CAAC,EAC/D;YAAC,eAAe;QAAU,GAC1B,WAAW,SAAS;QAEtB,KAAK;OACJ,+BACC,sHACG,+BAAiB,0DAAC,CAAA,GAAA,2DAAU;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;sBACpE,0DAAC;QAAK,GAAG,iBAAiB;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACvD,+BAIL,0DAAC;QAAK,GAAG,gBAAgB;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACtD;AAKX;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/label/src/HelpText.tsx"],"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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, SpectrumFieldValidation, SpectrumHelpTextProps, StyleProps, Validation} from '@react-types/shared';\nimport React, {HTMLAttributes, ReactNode} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/helptext/vars.css';\n\ninterface HelpTextProps extends Omit<SpectrumHelpTextProps, 'errorMessage'>, Omit<Validation<any>, 'validationState'>, SpectrumFieldValidation<any>, StyleProps {\n /** Props for the help text description element. */\n descriptionProps?: HTMLAttributes<HTMLElement>,\n /** Props for the help text error message element. */\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n /** An error message for the field. */\n errorMessage?: ReactNode\n}\n\nfunction HelpText(props: HelpTextProps, ref: DOMRef<HTMLDivElement>) {\n let {\n description,\n errorMessage,\n validationState,\n isInvalid,\n isDisabled,\n showErrorIcon,\n descriptionProps,\n errorMessageProps\n } = props;\n let domRef = useDOMRef(ref);\n let isErrorMessage = errorMessage && (isInvalid || validationState === 'invalid');\n let {styleProps} = useStyleProps(props);\n\n return (\n <div\n {...styleProps}\n className={classNames(\n styles,\n 'spectrum-HelpText',\n `spectrum-HelpText--${isErrorMessage ? 'negative' : 'neutral'}`,\n {'is-disabled': isDisabled},\n styleProps.className\n )}\n ref={domRef}>\n {isErrorMessage ? (\n <>\n {showErrorIcon && <AlertMedium UNSAFE_className={classNames(styles, 'spectrum-HelpText-validationIcon')} />}\n <div {...errorMessageProps} className={classNames(styles, 'spectrum-HelpText-text')}>\n {errorMessage}\n </div>\n </>\n ) : (\n <div {...descriptionProps} className={classNames(styles, 'spectrum-HelpText-text')}>\n {description}\n </div>\n )}\n </div>\n );\n}\n\n/**\n * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.\n */\nconst _HelpText = React.forwardRef(HelpText);\nexport {_HelpText as HelpText};\n"],"names":[],"version":3,"file":"HelpText.main.js.map"}
@@ -0,0 +1,52 @@
1
+ import "./vars.0af2d804.css";
2
+ import $huWmf$helptext_vars_cssmodulejs from "./helptext_vars_css.mjs";
3
+ import $huWmf$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
4
+ import {useDOMRef as $huWmf$useDOMRef, useStyleProps as $huWmf$useStyleProps, classNames as $huWmf$classNames} from "@react-spectrum/utils";
5
+ import $huWmf$react from "react";
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+ /*
12
+ * Copyright 2021 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+
25
+ function $8e50676506611310$var$HelpText(props, ref) {
26
+ let { description: description, errorMessage: errorMessage, validationState: validationState, isInvalid: isInvalid, isDisabled: isDisabled, showErrorIcon: showErrorIcon, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = props;
27
+ let domRef = (0, $huWmf$useDOMRef)(ref);
28
+ let isErrorMessage = errorMessage && (isInvalid || validationState === "invalid");
29
+ let { styleProps: styleProps } = (0, $huWmf$useStyleProps)(props);
30
+ return /*#__PURE__*/ (0, $huWmf$react).createElement("div", {
31
+ ...styleProps,
32
+ className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText", `spectrum-HelpText--${isErrorMessage ? "negative" : "neutral"}`, {
33
+ "is-disabled": isDisabled
34
+ }, styleProps.className),
35
+ ref: domRef
36
+ }, isErrorMessage ? /*#__PURE__*/ (0, $huWmf$react).createElement((0, $huWmf$react).Fragment, null, showErrorIcon && /*#__PURE__*/ (0, $huWmf$react).createElement((0, $huWmf$spectrumiconsuiAlertMedium), {
37
+ UNSAFE_className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText-validationIcon")
38
+ }), /*#__PURE__*/ (0, $huWmf$react).createElement("div", {
39
+ ...errorMessageProps,
40
+ className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText-text")
41
+ }, errorMessage)) : /*#__PURE__*/ (0, $huWmf$react).createElement("div", {
42
+ ...descriptionProps,
43
+ className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText-text")
44
+ }, description));
45
+ }
46
+ /**
47
+ * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.
48
+ */ const $8e50676506611310$export$a67c0bc59081311a = /*#__PURE__*/ (0, $huWmf$react).forwardRef($8e50676506611310$var$HelpText);
49
+
50
+
51
+ export {$8e50676506611310$export$a67c0bc59081311a as HelpText};
52
+ //# sourceMappingURL=HelpText.mjs.map
@@ -0,0 +1,52 @@
1
+ import "./vars.0af2d804.css";
2
+ import $huWmf$helptext_vars_cssmodulejs from "./helptext_vars_css.module.js";
3
+ import $huWmf$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
4
+ import {useDOMRef as $huWmf$useDOMRef, useStyleProps as $huWmf$useStyleProps, classNames as $huWmf$classNames} from "@react-spectrum/utils";
5
+ import $huWmf$react from "react";
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+ /*
12
+ * Copyright 2021 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+
25
+ function $8e50676506611310$var$HelpText(props, ref) {
26
+ let { description: description, errorMessage: errorMessage, validationState: validationState, isInvalid: isInvalid, isDisabled: isDisabled, showErrorIcon: showErrorIcon, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = props;
27
+ let domRef = (0, $huWmf$useDOMRef)(ref);
28
+ let isErrorMessage = errorMessage && (isInvalid || validationState === "invalid");
29
+ let { styleProps: styleProps } = (0, $huWmf$useStyleProps)(props);
30
+ return /*#__PURE__*/ (0, $huWmf$react).createElement("div", {
31
+ ...styleProps,
32
+ className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText", `spectrum-HelpText--${isErrorMessage ? "negative" : "neutral"}`, {
33
+ "is-disabled": isDisabled
34
+ }, styleProps.className),
35
+ ref: domRef
36
+ }, isErrorMessage ? /*#__PURE__*/ (0, $huWmf$react).createElement((0, $huWmf$react).Fragment, null, showErrorIcon && /*#__PURE__*/ (0, $huWmf$react).createElement((0, $huWmf$spectrumiconsuiAlertMedium), {
37
+ UNSAFE_className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText-validationIcon")
38
+ }), /*#__PURE__*/ (0, $huWmf$react).createElement("div", {
39
+ ...errorMessageProps,
40
+ className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText-text")
41
+ }, errorMessage)) : /*#__PURE__*/ (0, $huWmf$react).createElement("div", {
42
+ ...descriptionProps,
43
+ className: (0, $huWmf$classNames)((0, ($parcel$interopDefault($huWmf$helptext_vars_cssmodulejs))), "spectrum-HelpText-text")
44
+ }, description));
45
+ }
46
+ /**
47
+ * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.
48
+ */ const $8e50676506611310$export$a67c0bc59081311a = /*#__PURE__*/ (0, $huWmf$react).forwardRef($8e50676506611310$var$HelpText);
49
+
50
+
51
+ export {$8e50676506611310$export$a67c0bc59081311a as HelpText};
52
+ //# sourceMappingURL=HelpText.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiBD,SAAS,+BAAS,KAAoB,EAAE,GAA2B;IACjE,IAAI,eACF,WAAW,gBACX,YAAY,mBACZ,eAAe,aACf,SAAS,cACT,UAAU,iBACV,aAAa,oBACb,gBAAgB,qBAChB,iBAAiB,EAClB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,iBAAiB,gBAAiB,CAAA,aAAa,oBAAoB,SAAQ;IAC/E,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IAEjC,qBACE,gCAAC;QACE,GAAG,UAAU;QACd,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,0DAAK,GACL,qBACA,CAAC,mBAAmB,EAAE,iBAAiB,aAAa,UAAU,CAAC,EAC/D;YAAC,eAAe;QAAU,GAC1B,WAAW,SAAS;QAEtB,KAAK;OACJ,+BACC,kEACG,+BAAiB,gCAAC,CAAA,GAAA,iCAAU;QAAE,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;sBACpE,gCAAC;QAAK,GAAG,iBAAiB;QAAE,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;OACvD,+BAIL,gCAAC;QAAK,GAAG,gBAAgB;QAAE,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;OACtD;AAKX;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/label/src/HelpText.tsx"],"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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, SpectrumFieldValidation, SpectrumHelpTextProps, StyleProps, Validation} from '@react-types/shared';\nimport React, {HTMLAttributes, ReactNode} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/helptext/vars.css';\n\ninterface HelpTextProps extends Omit<SpectrumHelpTextProps, 'errorMessage'>, Omit<Validation<any>, 'validationState'>, SpectrumFieldValidation<any>, StyleProps {\n /** Props for the help text description element. */\n descriptionProps?: HTMLAttributes<HTMLElement>,\n /** Props for the help text error message element. */\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n /** An error message for the field. */\n errorMessage?: ReactNode\n}\n\nfunction HelpText(props: HelpTextProps, ref: DOMRef<HTMLDivElement>) {\n let {\n description,\n errorMessage,\n validationState,\n isInvalid,\n isDisabled,\n showErrorIcon,\n descriptionProps,\n errorMessageProps\n } = props;\n let domRef = useDOMRef(ref);\n let isErrorMessage = errorMessage && (isInvalid || validationState === 'invalid');\n let {styleProps} = useStyleProps(props);\n\n return (\n <div\n {...styleProps}\n className={classNames(\n styles,\n 'spectrum-HelpText',\n `spectrum-HelpText--${isErrorMessage ? 'negative' : 'neutral'}`,\n {'is-disabled': isDisabled},\n styleProps.className\n )}\n ref={domRef}>\n {isErrorMessage ? (\n <>\n {showErrorIcon && <AlertMedium UNSAFE_className={classNames(styles, 'spectrum-HelpText-validationIcon')} />}\n <div {...errorMessageProps} className={classNames(styles, 'spectrum-HelpText-text')}>\n {errorMessage}\n </div>\n </>\n ) : (\n <div {...descriptionProps} className={classNames(styles, 'spectrum-HelpText-text')}>\n {description}\n </div>\n )}\n </div>\n );\n}\n\n/**\n * Help text provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.\n */\nconst _HelpText = React.forwardRef(HelpText);\nexport {_HelpText as HelpText};\n"],"names":[],"version":3,"file":"HelpText.module.js.map"}