@react-spectrum/textfield 3.0.0-nightly.1261 → 3.0.0-nightly.1277
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/main.js +4 -10
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/TextFieldBase.tsx +0 -4
package/dist/main.js
CHANGED
@@ -2,21 +2,17 @@ var {
|
|
2
2
|
useTextField
|
3
3
|
} = require("@react-aria/textfield");
|
4
4
|
|
5
|
-
var {
|
6
|
-
useControlledState
|
7
|
-
} = require("@react-stately/utils");
|
8
|
-
|
9
5
|
var {
|
10
6
|
useProviderProps
|
11
7
|
} = require("@react-spectrum/provider");
|
12
8
|
|
13
9
|
var {
|
14
|
-
|
15
|
-
} = require("@react-
|
10
|
+
useControlledState
|
11
|
+
} = require("@react-stately/utils");
|
16
12
|
|
17
13
|
var {
|
18
|
-
|
19
|
-
} = require("@react-
|
14
|
+
useHover
|
15
|
+
} = require("@react-aria/interactions");
|
20
16
|
|
21
17
|
var {
|
22
18
|
FocusRing
|
@@ -86,8 +82,6 @@ $d6ccebc39ce6c9807064e14b8824ec$exports = {
|
|
86
82
|
var $d6ccebc39ce6c9807064e14b8824ec$$interop$default = $parcel$interopDefault($d6ccebc39ce6c9807064e14b8824ec$exports);
|
87
83
|
|
88
84
|
function $e7a3dfeb4bff45d199cec4325445e2$var$TextFieldBase(props, ref) {
|
89
|
-
props = useProviderProps(props);
|
90
|
-
props = useFormProps(props);
|
91
85
|
let {
|
92
86
|
label,
|
93
87
|
validationState,
|
package/dist/main.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAA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E;AAH4D,MAI7EnD,QAJ6E,CAAhF;AAMA,sBACE,oEACMkC,UADN;AAEE,IAAA,GAAG,EAAElD,GAFP;AAGE,IAAA,QAAQ,EAAEgB,QAHZ;AAIE,IAAA,UAAU,EAAEJ,UAJd;AAKE,IAAA,UAAU,EAAEC,UALd;AAME,IAAA,gBAAgB,EAAEC,gBANpB;AAOE,IAAA,iBAAiB,EAAEC,iBAPrB;AAQE,IAAA,SAAS,MARX;AASE,IAAA,UAAU,EAAER,UATd;AAUE,IAAA,OAAO,EAAED,OAVX;AAWE,IAAA,UAAU,EAAEyC,UAXd;AAYE,IAAA,UAAU,EAAEC;AAZd,KADF;AAeD;AAED;;;;;;;AAKA,IAAIoB,QAAS,gBAAG1B,MAAK,CAACG,UAAN,CAAiBC,8CAAjB,CAAhB;;;;AChEA,SAASuB,4CAAT,CAAmBtE,KAAnB,EAAkDC,GAAlD,EAAgF;AAC9ED,EAAAA,KAAK,GAAGE,gBAAgB,CAACF,KAAD,CAAxB;AAEA,MAAIiB,QAAQ,GAAGQ,MAAM,EAArB;AACA,MAAI;AAACZ,IAAAA,UAAD;AAAaC,IAAAA,UAAb;AAAyBC,IAAAA,gBAAzB;AAA2CC,IAAAA;AAA3C,MAAgEkD,YAAY,CAAClE,KAAD,EAAQiB,QAAR,CAAhF;AACA,sBACE,oEACMjB,KADN;AAEE,IAAA,UAAU,EAAEa,UAFd;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,gBAAgB,EAAEC,gBAJpB;AAKE,IAAA,iBAAiB,EAAEC,iBALrB;AAME,IAAA,GAAG,EAAEf,GANP;AAOE,IAAA,QAAQ,EAAEgB;AAPZ,KADF;AAUD;AAED;;;;;;;AAKA,MAAMsD,SAAU,gBAAGzB,UAAU,CAACwB,4CAAD,CAA7B","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/textfield/vars.css","./packages/@react-spectrum/textfield/src/TextFieldBase.tsx","./packages/@react-spectrum/textfield/src/TextArea.tsx","./packages/@react-spectrum/textfield/src/TextField.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\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\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, createFocusableRef} from '@react-spectrum/utils';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressEvents} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, RefObject, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange'>, PressEvents {\n wrapperChildren?: ReactElement | ReactElement[],\n inputClassName?: string,\n validationIconClassName?: string,\n multiLine?: boolean,\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>,\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,\n descriptionProps?: HTMLAttributes<HTMLElement>,\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement>,\n loadingIndicator?: ReactElement,\n isLoading?: boolean\n}\n\nfunction TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n label,\n validationState,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n inputRef = inputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid';\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && icon.props.UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n });\n }\n\n let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n let textField = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid',\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} isTextInput autoFocus={autoFocus}>\n <ElementType\n {...mergeProps(inputProps, hoverProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={\n classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )\n } />\n </FocusRing>\n {icon}\n {validationState && !isLoading ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n if (label) {\n textField = React.cloneElement(textField, mergeProps(textField.props, {\n className: multiLine ? 'spectrum-Field-field--multiline' : ''\n }));\n }\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n}\n\nconst _TextFieldBase = forwardRef(TextFieldBase);\nexport {_TextFieldBase as TextFieldBase};\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 {chain, useLayoutEffect} from '@react-aria/utils';\nimport React, {RefObject, useCallback, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useControlledState} from '@react-stately/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextArea(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue, () => {});\n\n let inputRef = useRef<HTMLTextAreaElement>();\n\n let onHeightChange = useCallback(() => {\n if (isQuiet) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n input.style.height = `${input.scrollHeight}px`;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={ref}\n inputRef={inputRef}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = React.forwardRef(TextArea);\nexport {_TextArea as TextArea};\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 React, {forwardRef, RefObject, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextField(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n\n let inputRef = useRef<HTMLInputElement>();\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(props, inputRef);\n return (\n <TextFieldBase\n {...props}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n ref={ref}\n inputRef={inputRef} />\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n"],"names":["$parcel$interopDefault","a","__esModule","default","TextFieldBase","props","ref","useProviderProps","useFormProps","label","validationState","icon","isQuiet","isDisabled","multiLine","autoFocus","inputClassName","wrapperChildren","labelProps","inputProps","descriptionProps","errorMessageProps","inputRef","isLoading","loadingIndicator","validationIconClassName","hoverProps","isHovered","useHover","domRef","useRef","defaultInputRef","useImperativeHandle","createFocusableRef","select","current","getInputElement","ElementType","isInvalid","UNSAFE_className","classNames","cloneElement","size","validationIcon","validation","textField","mergeProps","undefined","React","className","_TextFieldBase","forwardRef","TextArea","isReadOnly","isRequired","onChange","otherProps","inputValue","setInputValue","useControlledState","value","defaultValue","onHeightChange","useCallback","input","prevAlignment","style","alignSelf","height","scrollHeight","useLayoutEffect","useTextField","chain","inputElementType","_TextArea","TextField","_TextField"],"version":3,"file":"main.js.map"}
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,0CAAiB;AACf,wBAAsB,2BADP;AAEf,+BAA6B,kCAFd;AAGf,mCAAiC,sCAHlB;AAIf,8BAA4B,iCAJb;AAKf,oBAAkB,uBALH;AAMf,gBAAc,mBANC;AAOf,+BAA6B,kCAPd;AAQf,iCAA+B,oCARhB;AASf,kCAAgC,qCATjB;AAUf,uCAAqC,0CAVtB;AAWf,6BAA2B,gCAXZ;AAYf,kCAAgC,qCAZjB;AAaf,qCAAmC,wCAbpB;AAcf,gBAAc,mBAdC;AAef,gBAAc,mBAfC;AAgBf,iBAAe;AAhBA,CAAjB;;;ACsCA,SAASG,iDAAT,CAAuBC,KAAvB,EAAkDC,GAAlD,EAA0E;AACxE,MAAI;AACFC,IAAAA,KADE;AAEFC,IAAAA,eAFE;AAGFC,IAAAA,IAHE;AAIFC,IAAAA,OAAO,GAAG,KAJR;AAKFC,IAAAA,UALE;AAMFC,IAAAA,SANE;AAOFC,IAAAA,SAPE;AAQFC,IAAAA,cARE;AASFC,IAAAA,eATE;AAUF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Qe,QAAR,CAAhF;AACA,sBACE,oEACMf,KADN;AAEE,IAAA,UAAU,EAAEW,UAFd;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,gBAAgB,EAAEC,gBAJpB;AAKE,IAAA,iBAAiB,EAAEC,iBALrB;AAME,IAAA,GAAG,EAAEb,GANP;AAOE,IAAA,QAAQ,EAAEc;AAPZ,KADF;AAUD;AAED;;;;;;;AAKA,MAAMuD,SAAU,gBAAG1B,UAAU,CAACyB,4CAAD,CAA7B","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/textfield/vars.css","./packages/@react-spectrum/textfield/src/TextFieldBase.tsx","./packages/@react-spectrum/textfield/src/TextArea.tsx","./packages/@react-spectrum/textfield/src/TextField.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\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\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, createFocusableRef} from '@react-spectrum/utils';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressEvents} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, RefObject, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useHover} from '@react-aria/interactions';\n\ninterface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange'>, PressEvents {\n wrapperChildren?: ReactElement | ReactElement[],\n inputClassName?: string,\n validationIconClassName?: string,\n multiLine?: boolean,\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>,\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,\n descriptionProps?: HTMLAttributes<HTMLElement>,\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement>,\n loadingIndicator?: ReactElement,\n isLoading?: boolean\n}\n\nfunction TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {\n let {\n label,\n validationState,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n inputRef = inputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid';\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && icon.props.UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n });\n }\n\n let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n let textField = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid',\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} isTextInput autoFocus={autoFocus}>\n <ElementType\n {...mergeProps(inputProps, hoverProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={\n classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )\n } />\n </FocusRing>\n {icon}\n {validationState && !isLoading ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n if (label) {\n textField = React.cloneElement(textField, mergeProps(textField.props, {\n className: multiLine ? 'spectrum-Field-field--multiline' : ''\n }));\n }\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n}\n\nconst _TextFieldBase = forwardRef(TextFieldBase);\nexport {_TextFieldBase as TextFieldBase};\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 {chain, useLayoutEffect} from '@react-aria/utils';\nimport React, {RefObject, useCallback, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useControlledState} from '@react-stately/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextArea(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue, () => {});\n\n let inputRef = useRef<HTMLTextAreaElement>();\n\n let onHeightChange = useCallback(() => {\n if (isQuiet) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n input.style.height = `${input.scrollHeight}px`;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={ref}\n inputRef={inputRef}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = React.forwardRef(TextArea);\nexport {_TextArea as TextArea};\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 React, {forwardRef, RefObject, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextField(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n\n let inputRef = useRef<HTMLInputElement>();\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(props, inputRef);\n return (\n <TextFieldBase\n {...props}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n ref={ref}\n inputRef={inputRef} />\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n"],"names":["$parcel$interopDefault","a","__esModule","default","TextFieldBase","props","ref","label","validationState","icon","isQuiet","isDisabled","multiLine","autoFocus","inputClassName","wrapperChildren","labelProps","inputProps","descriptionProps","errorMessageProps","inputRef","isLoading","loadingIndicator","validationIconClassName","hoverProps","isHovered","useHover","domRef","useRef","defaultInputRef","useImperativeHandle","createFocusableRef","select","current","getInputElement","ElementType","isInvalid","UNSAFE_className","classNames","cloneElement","size","validationIcon","validation","textField","mergeProps","undefined","React","className","_TextFieldBase","forwardRef","TextArea","useProviderProps","isReadOnly","isRequired","onChange","otherProps","inputValue","setInputValue","useControlledState","value","defaultValue","onHeightChange","useCallback","input","prevAlignment","style","alignSelf","height","scrollHeight","useLayoutEffect","useTextField","chain","inputElementType","_TextArea","TextField","_TextField"],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import { useTextField } from "@react-aria/textfield";
|
2
|
-
import { useControlledState } from "@react-stately/utils";
|
3
2
|
import { useProviderProps } from "@react-spectrum/provider";
|
3
|
+
import { useControlledState } from "@react-stately/utils";
|
4
4
|
import { useHover } from "@react-aria/interactions";
|
5
|
-
import { useFormProps } from "@react-spectrum/form";
|
6
5
|
import { FocusRing } from "@react-aria/focus";
|
7
6
|
import { Field } from "@react-spectrum/label";
|
8
7
|
import { classNames, createFocusableRef } from "@react-spectrum/utils";
|
@@ -41,8 +40,6 @@ $aa1c742e7a2a16aa7981ca9e2f4a89$exports = {
|
|
41
40
|
var $aa1c742e7a2a16aa7981ca9e2f4a89$$interop$default = $parcel$interopDefault($aa1c742e7a2a16aa7981ca9e2f4a89$exports);
|
42
41
|
|
43
42
|
function $bf4e8b5f6a6cf158db09231425531fea$var$TextFieldBase(props, ref) {
|
44
|
-
props = useProviderProps(props);
|
45
|
-
props = useFormProps(props);
|
46
43
|
let {
|
47
44
|
label,
|
48
45
|
validationState,
|
package/dist/module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,0CAAiB;AACf,wBAAsB,2BADP;AAEf,+BAA6B,kCAFd;AAGf,mCAAiC,sCAHlB;AAIf,8BAA4B,iCAJb;AAKf,oBAAkB,uBALH;AAMf,gBAAc,mBANC;AAOf,+BAA6B,kCAPd;AAQf,iCAA+B,oCARhB;AASf,kCAAgC,qCATjB;AAUf,uCAAqC,0CAVtB;AAWf,6BAA2B,gCAXZ;AAYf,kCAAgC,qCAZjB;AAaf,qCAAmC,wCAbpB;AAcf,gBAAc,mBAdC;AAef,gBAAc,mBAfC;AAgBf,iBAAe;AAhBA,CAAjB;;;ACwCA,SAASG,mDAAT,CAAuBC,KAAvB,EAAkDC,GAAlD,EAA0E;AACxED,EAAAA,KAAK,GAAGE,gBAAgB,CAACF,KAAD,CAAxB;AACAA,EAAAA,KAAK,GAAGG,YAAY,CAACH,KAAD,CAApB;AACA,MAAI;AACFI,IAAAA,KADE;AAEFC,IAAAA,eAFE;AAGFC,IAAAA,IAHE;AAIFC,IAAAA,OAAO,GAAG,KAJR;AAKFC,IAAAA,UALE;AAMFC,IAAAA,SANE;AAOFC,IAAAA,SAPE;AAQFC,IAAAA,cARE;AASFC,IAAAA,eATE;AAUFC,IAAAA,UAVE;AAWFC,IAAAA,UAXE;AAYFC,IAAAA,gBAZE;AAaFC,IAAAA,iBAbE;AAcFC,IAAAA,QAdE;AAeFC,IAAAA,SAfE;AAg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AJpB;AAKE,IAAA,iBAAiB,EAAEC,iBALrB;AAME,IAAA,GAAG,EAAEf,GANP;AAOE,IAAA,QAAQ,EAAEgB;AAPZ,KADF;AAUD;AAED;;;;;;;OAKA,MAAMsD,SAAU,gBAAGzB,UAAU,CAACwB,6CAAD,CAA7B","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/textfield/vars.css","./packages/@react-spectrum/textfield/src/TextFieldBase.tsx","./packages/@react-spectrum/textfield/src/TextArea.tsx","./packages/@react-spectrum/textfield/src/TextField.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\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\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, createFocusableRef} from '@react-spectrum/utils';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressEvents} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, RefObject, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange'>, PressEvents {\n wrapperChildren?: ReactElement | ReactElement[],\n inputClassName?: string,\n validationIconClassName?: string,\n multiLine?: boolean,\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>,\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,\n descriptionProps?: HTMLAttributes<HTMLElement>,\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement>,\n loadingIndicator?: ReactElement,\n isLoading?: boolean\n}\n\nfunction TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n label,\n validationState,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n inputRef = inputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid';\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && icon.props.UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n });\n }\n\n let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n let textField = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid',\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} isTextInput autoFocus={autoFocus}>\n <ElementType\n {...mergeProps(inputProps, hoverProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={\n classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )\n } />\n </FocusRing>\n {icon}\n {validationState && !isLoading ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n if (label) {\n textField = React.cloneElement(textField, mergeProps(textField.props, {\n className: multiLine ? 'spectrum-Field-field--multiline' : ''\n }));\n }\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n}\n\nconst _TextFieldBase = forwardRef(TextFieldBase);\nexport {_TextFieldBase as TextFieldBase};\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 {chain, useLayoutEffect} from '@react-aria/utils';\nimport React, {RefObject, useCallback, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useControlledState} from '@react-stately/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextArea(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue, () => {});\n\n let inputRef = useRef<HTMLTextAreaElement>();\n\n let onHeightChange = useCallback(() => {\n if (isQuiet) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n input.style.height = `${input.scrollHeight}px`;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={ref}\n inputRef={inputRef}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = React.forwardRef(TextArea);\nexport {_TextArea as TextArea};\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 React, {forwardRef, RefObject, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextField(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n\n let inputRef = useRef<HTMLInputElement>();\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(props, inputRef);\n return (\n <TextFieldBase\n {...props}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n ref={ref}\n inputRef={inputRef} />\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n"],"names":["$parcel$interopDefault","a","__esModule","default","TextFieldBase","props","ref","useProviderProps","useFormProps","label","validationState","icon","isQuiet","isDisabled","multiLine","autoFocus","inputClassName","wrapperChildren","labelProps","inputProps","descriptionProps","errorMessageProps","inputRef","isLoading","loadingIndicator","validationIconClassName","hoverProps","isHovered","useHover","domRef","useRef","defaultInputRef","useImperativeHandle","createFocusableRef","select","current","getInputElement","ElementType","isInvalid","UNSAFE_className","classNames","cloneElement","size","validationIcon","validation","textField","mergeProps","undefined","React","className","_TextFieldBase","forwardRef","TextArea","isReadOnly","isRequired","onChange","otherProps","inputValue","setInputValue","useControlledState","value","defaultValue","onHeightChange","useCallback","input","prevAlignment","style","alignSelf","height","scrollHeight","useLayoutEffect","useTextField","chain","inputElementType","_TextArea","TextField","_TextField"],"version":3,"file":"module.js.map"}
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,0CAAiB;AACf,wBAAsB,2BADP;AAEf,+BAA6B,kCAFd;AAGf,mCAAiC,sCAHlB;AAIf,8BAA4B,iCAJb;AAKf,oBAAkB,uBALH;AAMf,gBAAc,mBANC;AAOf,+BAA6B,kCAPd;AAQf,iCAA+B,oCARhB;AASf,kCAAgC,qCATjB;AAUf,uCAAqC,0CAVtB;AAWf,6BAA2B,gCAXZ;AAYf,kCAAgC,qCAZjB;AAaf,qCAAmC,wCAbpB;AAcf,gBAAc,mBAdC;AAef,gBAAc,mBAfC;AAgBf,iBAAe;AAhBA,CAAjB;;;ACsCA,S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kDC,GAAlD,EAAgF;AAC9ED,EAAAA,KAAK,GAAG8C,gBAAgB,CAAC9C,KAAD,CAAxB;AAEA,MAAIe,QAAQ,GAAGQ,MAAM,EAArB;AACA,MAAI;AAACZ,IAAAA,UAAD;AAAaC,IAAAA,UAAb;AAAyBC,IAAAA,gBAAzB;AAA2CC,IAAAA;AAA3C,MAAgEmD,YAAY,CAACjE,KAAD,EAAQe,QAAR,CAAhF;AACA,sBACE,uEACMf,KADN;AAEE,IAAA,UAAU,EAAEW,UAFd;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,gBAAgB,EAAEC,gBAJpB;AAKE,IAAA,iBAAiB,EAAEC,iBALrB;AAME,IAAA,GAAG,EAAEb,GANP;AAOE,IAAA,QAAQ,EAAEc;AAPZ,KADF;AAUD;AAED;;;;;;;OAKA,MAAMuD,SAAU,gBAAG1B,UAAU,CAACyB,6CAAD,CAA7B","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/textfield/vars.css","./packages/@react-spectrum/textfield/src/TextFieldBase.tsx","./packages/@react-spectrum/textfield/src/TextArea.tsx","./packages/@react-spectrum/textfield/src/TextField.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\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\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, createFocusableRef} from '@react-spectrum/utils';\nimport {Field} from '@react-spectrum/label';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressEvents} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, RefObject, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useHover} from '@react-aria/interactions';\n\ninterface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange'>, PressEvents {\n wrapperChildren?: ReactElement | ReactElement[],\n inputClassName?: string,\n validationIconClassName?: string,\n multiLine?: boolean,\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>,\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,\n descriptionProps?: HTMLAttributes<HTMLElement>,\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement>,\n loadingIndicator?: ReactElement,\n isLoading?: boolean\n}\n\nfunction TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {\n let {\n label,\n validationState,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n inputRef = inputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid';\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && icon.props.UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n });\n }\n\n let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n let textField = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid',\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine\n }\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} isTextInput autoFocus={autoFocus}>\n <ElementType\n {...mergeProps(inputProps, hoverProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={\n classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )\n } />\n </FocusRing>\n {icon}\n {validationState && !isLoading ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n if (label) {\n textField = React.cloneElement(textField, mergeProps(textField.props, {\n className: multiLine ? 'spectrum-Field-field--multiline' : ''\n }));\n }\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n}\n\nconst _TextFieldBase = forwardRef(TextFieldBase);\nexport {_TextFieldBase as TextFieldBase};\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 {chain, useLayoutEffect} from '@react-aria/utils';\nimport React, {RefObject, useCallback, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useControlledState} from '@react-stately/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextArea(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue, () => {});\n\n let inputRef = useRef<HTMLTextAreaElement>();\n\n let onHeightChange = useCallback(() => {\n if (isQuiet) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n input.style.height = `${input.scrollHeight}px`;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={ref}\n inputRef={inputRef}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = React.forwardRef(TextArea);\nexport {_TextArea as TextArea};\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 React, {forwardRef, RefObject, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextField(props: SpectrumTextFieldProps, ref: RefObject<TextFieldRef>) {\n props = useProviderProps(props);\n\n let inputRef = useRef<HTMLInputElement>();\n let {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(props, inputRef);\n return (\n <TextFieldBase\n {...props}\n labelProps={labelProps}\n inputProps={inputProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n ref={ref}\n inputRef={inputRef} />\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n"],"names":["$parcel$interopDefault","a","__esModule","default","TextFieldBase","props","ref","label","validationState","icon","isQuiet","isDisabled","multiLine","autoFocus","inputClassName","wrapperChildren","labelProps","inputProps","descriptionProps","errorMessageProps","inputRef","isLoading","loadingIndicator","validationIconClassName","hoverProps","isHovered","useHover","domRef","useRef","defaultInputRef","useImperativeHandle","createFocusableRef","select","current","getInputElement","ElementType","isInvalid","UNSAFE_className","classNames","cloneElement","size","validationIcon","validation","textField","mergeProps","undefined","React","className","_TextFieldBase","forwardRef","TextArea","useProviderProps","isReadOnly","isRequired","onChange","otherProps","inputValue","setInputValue","useControlledState","value","defaultValue","onHeightChange","useCallback","input","prevAlignment","style","alignSelf","height","scrollHeight","useLayoutEffect","useTextField","chain","inputElementType","_TextArea","TextField","_TextField"],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"A;A;A;
|
1
|
+
{"mappings":"A;A;A;AAwBA,4BAA6B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,EAAE,WAAW;IACxF,eAAe,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,GAAG,uBAAuB,mBAAmB,CAAC,CAAC;IAChG,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;IAC7D,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AA2HD,OAAA,MAAM,sGAA0C,CAAC;AClFjD;A;A;A;GAIG;AACH,OAAA,IAAI,qGAAsC,CAAC;AC/C3C;A;A;A;GAIG;AACH,OAAA,MAAM,sGAAkC,CAAC","sources":["./packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextFieldBase.tsx","./packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextArea.tsx","./packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextField.tsx","./packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/index.ts"],"sourcesContent":[null,null,null,null],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/textfield",
|
3
|
-
"version": "3.0.0-nightly.
|
3
|
+
"version": "3.0.0-nightly.1277+bd8c0996c",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -32,22 +32,21 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@babel/runtime": "^7.6.2",
|
35
|
-
"@react-aria/focus": "3.0.0-nightly.
|
36
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
37
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
38
|
-
"@react-aria/textfield": "3.0.0-nightly.
|
39
|
-
"@react-aria/utils": "3.0.0-nightly.
|
40
|
-
"@react-spectrum/
|
41
|
-
"@react-spectrum/
|
42
|
-
"@react-
|
43
|
-
"@react-
|
44
|
-
"@react-types/
|
45
|
-
"@
|
46
|
-
"@spectrum-icons/ui": "3.0.0-nightly.1261+2731ebc7d"
|
35
|
+
"@react-aria/focus": "3.0.0-nightly.1277+bd8c0996c",
|
36
|
+
"@react-aria/i18n": "3.0.0-nightly.1277+bd8c0996c",
|
37
|
+
"@react-aria/interactions": "3.0.0-nightly.1277+bd8c0996c",
|
38
|
+
"@react-aria/textfield": "3.0.0-nightly.1277+bd8c0996c",
|
39
|
+
"@react-aria/utils": "3.0.0-nightly.1277+bd8c0996c",
|
40
|
+
"@react-spectrum/label": "3.4.1-nightly.2963+bd8c0996c",
|
41
|
+
"@react-spectrum/utils": "3.0.0-nightly.1277+bd8c0996c",
|
42
|
+
"@react-stately/utils": "3.0.0-nightly.1277+bd8c0996c",
|
43
|
+
"@react-types/shared": "3.0.0-nightly.1277+bd8c0996c",
|
44
|
+
"@react-types/textfield": "3.0.0-nightly.1277+bd8c0996c",
|
45
|
+
"@spectrum-icons/ui": "3.0.0-nightly.1277+bd8c0996c"
|
47
46
|
},
|
48
47
|
"devDependencies": {
|
49
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
50
|
-
"@spectrum-icons/workflow": "3.0.0-nightly.
|
48
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.1277+bd8c0996c",
|
49
|
+
"@spectrum-icons/workflow": "3.0.0-nightly.1277+bd8c0996c"
|
51
50
|
},
|
52
51
|
"peerDependencies": {
|
53
52
|
"@react-spectrum/provider": "^3.0.0",
|
@@ -56,5 +55,5 @@
|
|
56
55
|
"publishConfig": {
|
57
56
|
"access": "public"
|
58
57
|
},
|
59
|
-
"gitHead": "
|
58
|
+
"gitHead": "bd8c0996c9c34e2873decdfdeca1eed8b176a106"
|
60
59
|
}
|
package/src/TextFieldBase.tsx
CHANGED
@@ -20,9 +20,7 @@ import {PressEvents} from '@react-types/shared';
|
|
20
20
|
import React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, RefObject, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';
|
21
21
|
import {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';
|
22
22
|
import styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';
|
23
|
-
import {useFormProps} from '@react-spectrum/form';
|
24
23
|
import {useHover} from '@react-aria/interactions';
|
25
|
-
import {useProviderProps} from '@react-spectrum/provider';
|
26
24
|
|
27
25
|
interface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange'>, PressEvents {
|
28
26
|
wrapperChildren?: ReactElement | ReactElement[],
|
@@ -39,8 +37,6 @@ interface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange'>, P
|
|
39
37
|
}
|
40
38
|
|
41
39
|
function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
|
42
|
-
props = useProviderProps(props);
|
43
|
-
props = useFormProps(props);
|
44
40
|
let {
|
45
41
|
label,
|
46
42
|
validationState,
|