@react-spectrum/textfield 3.1.6 → 3.3.1
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.css +1 -2
- package/dist/main.js +239 -285
- package/dist/main.js.map +1 -1
- package/dist/module.js +223 -237
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -15
- package/src/TextArea.tsx +3 -1
- package/src/TextField.tsx +3 -1
- package/src/TextFieldBase.tsx +22 -59
- package/dist/main.css.map +0 -1
package/dist/main.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,yCAAiB;AACf,yBAAuB,4BADR;AAEf,uCAAqC,0CAFtB;AAGf,sCAAoC,yCAHrB;AAIf,mCAAiC,sCAJlB;AAKf,oBAAkB,uBALH;AAMf,iCAA+B,oCANhB;AAOf,0BAAwB,6BAPT;AAQf,qCAAmC,wCARpB;AASf,kCAAgC,qCATjB;AAUf,mBAAiB,sBAVF;AAWf,iCAA+B,oCAXhB;AAYf,gCAA8B,mCAZf;AAaf,6BAA2B,gCAbZ;AAcf,iBAAe;AAdA,CAAjB;;;ACAA,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,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QAA7B,CAJY,CAAf;AAOA,MAAI;AAACF,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAA2BoD,YAAY,iCACtCtE,KADsC;AAEzCuD,IAAAA,QAAQ,EAAEgB,KAAK,CAAChB,QAAD,EAAWE,aAAX,CAF0B;AAGzCe,IAAAA,gBAAgB,EAAE;AAHuB,MAIxCrD,QAJwC,CAA3C;AAMA,sBACE,oEACMI,UADN;AAEE,IAAA,GAAG,EAAEtB,GAFP;AAGE,IAAA,QAAQ,EAAEkB,QAHZ;AAIE,IAAA,UAAU,EAAEF,UAJd;AAKE,IAAA,UAAU,EAAEC,UALd;AAME,IAAA,SAAS,MANX;AAOE,IAAA,UAAU,EAAEN,UAPd;AAQE,IAAA,OAAO,EAAED,OARX;AASE,IAAA,UAAU,EAAE2C,UATd;AAUE,IAAA,UAAU,EAAE/C;AAVd,KADF;AAaD;AAED;;;;;;;AAKA,IAAIkE,QAAS,gBAAGvB,MAAK,CAACE,UAAN,CAAiBC,8CAAjB,CAAhB;;;;AC9DA,SAASqB,4CAAT,CAAmB1E,KAAnB,EAAkDC,GAAlD,EAAgF;AAC9ED,EAAAA,KAAK,GAAGE,gBAAgB,CAACF,KAAD,CAAxB;AAEA,MAAImB,QAAQ,GAAGS,MAAM,EAArB;AACA,MAAI;AAACX,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAA2BoD,YAAY,CAACtE,KAAD,EAAQmB,QAAR,CAA3C;AACA,sBACE,oEACMnB,KADN;AAEE,IAAA,UAAU,EAAEiB,UAFd;AAGE,IAAA,UAAU,EAAEC,UAHd;AAIE,IAAA,GAAG,EAAEjB,GAJP;AAKE,IAAA,QAAQ,EAAEkB;AALZ,KADF;AAQD;AAED;;;;;;;AAKA,MAAMwD,SAAU,gBAAGvB,UAAU,CAACsB,4CAAD,CAA7B","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","./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\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 {\n classNames,\n createFocusableRef,\n useStyleProps\n} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {Label} from '@react-spectrum/label';\nimport {LabelPosition, PressEvents} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {cloneElement, forwardRef, 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 SpectrumTextFieldProps, 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 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 labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n validationState,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n inputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n ...otherProps\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 {styleProps} = useStyleProps(otherProps);\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 let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side'\n },\n styleProps.className\n );\n\n textField = React.cloneElement(textField, mergeProps(textField.props, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field',\n {\n 'spectrum-Field-field--multiline': multiLine\n }\n )\n }));\n\n return (\n <div\n {...styleProps}\n ref={domRef}\n className={labelWrapperClass}>\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}>\n {label}\n </Label>\n {textField}\n </div>\n );\n }\n\n return React.cloneElement(textField, mergeProps(textField.props, {\n ...styleProps,\n ref: domRef\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} = 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 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} = useTextField(props, inputRef);\n return (\n <TextFieldBase\n {...props}\n labelProps={labelProps}\n inputProps={inputProps}\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","labelPosition","labelAlign","isRequired","necessityIndicator","validationState","icon","isQuiet","isDisabled","multiLine","autoFocus","inputClassName","wrapperChildren","labelProps","inputProps","inputRef","isLoading","loadingIndicator","validationIconClassName","otherProps","hoverProps","isHovered","useHover","domRef","useRef","defaultInputRef","useImperativeHandle","createFocusableRef","select","current","getInputElement","styleProps","useStyleProps","ElementType","isInvalid","UNSAFE_className","classNames","cloneElement","size","validationIcon","validation","textField","mergeProps","undefined","labelWrapperClass","className","React","_TextFieldBase","forwardRef","TextArea","isReadOnly","onChange","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGAA,GAA0C;AAC1C,GAAoC;AACpC,GAA2C;AAC3C,GAA+C;AAC/C,GAAgC;AAChC,GAA4B;AAC5B,GAA2C;AAC3C,GAA6C;AAC7C,GAA8C;AAC9C,GAAmD;AACnD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;;;;SGhEhC,+BAAS,CAAC,KAA6B,EAAE,GAA4B,EAAE,CAAC;IAC/E,KAAK,GAAG,6CAAgB,CAAC,KAAK;IAE9B,GAAG,CAAC,QAAQ,GAAG,mBAAM;IACrB,GAAG,CAAC,CAAC,aAAA,UAAU,eAAE,UAAU,qBAAE,gBAAgB,sBAAE,iBAAiB,EAAA,CAAC,GAAG,sCAAY,CAAC,KAAK,EAAE,QAAQ;IAChG,MAAM,oEACH,yCAAa;WACR,KAAK;QACT,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,UAAU;QACtB,gBAAgB,EAAE,gBAAgB;QAClC,iBAAiB,EAAE,iBAAiB;QACpC,GAAG,EAAE,GAAG;QACR,QAAQ,EAAE,QAAQ;;AAExB,CAAC;AAED,EAIG,AAJH;;;;CAIG,AAJH,EAIG,CACH,KAAK,CAAC,yCAAU,iBAAG,uBAAU,CAAC,+BAAS;;","sources":["packages/@react-spectrum/textfield/src/index.ts","packages/@react-spectrum/textfield/src/TextArea.tsx","packages/@react-spectrum/textfield/src/TextFieldBase.tsx","packages/@adobe/spectrum-css-temp/components/textfield/vars.css","packages/@react-spectrum/textfield/src/TextField.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\n/// <reference types=\"css-module-types\" />\n\nexport * from './TextArea';\nexport * from './TextField';\nexport * from './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 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\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 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":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
@@ -1,259 +1,245 @@
|
|
1
|
-
import { useTextField } from "@react-aria/textfield";
|
2
|
-
import { useControlledState } from "@react-stately/utils";
|
3
|
-
import { useProviderProps } from "@react-spectrum/provider";
|
4
|
-
import { useHover } from "@react-aria/interactions";
|
5
|
-
import { useFormProps } from "@react-spectrum/form";
|
6
|
-
import { Label } from "@react-spectrum/label";
|
7
|
-
import { FocusRing } from "@react-aria/focus";
|
8
|
-
import { classNames, createFocusableRef, useStyleProps } from "@react-spectrum/utils";
|
9
|
-
import _spectrumIconsUiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
10
|
-
import _spectrumIconsUiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
11
|
-
import _react, { useCallback, useRef, cloneElement, forwardRef, useImperativeHandle } from "react";
|
12
|
-
import { chain, useLayoutEffect, mergeProps } from "@react-aria/utils";
|
13
|
-
import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
14
|
-
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
|
15
1
|
import "./main.css";
|
16
|
-
|
2
|
+
import {useLayoutEffect as $ebYMf$useLayoutEffect, chain as $ebYMf$chain, mergeProps as $ebYMf$mergeProps} from "@react-aria/utils";
|
3
|
+
import $ebYMf$react, {useRef as $ebYMf$useRef, useCallback as $ebYMf$useCallback, useImperativeHandle as $ebYMf$useImperativeHandle, cloneElement as $ebYMf$cloneElement, forwardRef as $ebYMf$forwardRef} from "react";
|
4
|
+
import {useControlledState as $ebYMf$useControlledState} from "@react-stately/utils";
|
5
|
+
import {useProviderProps as $ebYMf$useProviderProps} from "@react-spectrum/provider";
|
6
|
+
import {useTextField as $ebYMf$useTextField} from "@react-aria/textfield";
|
7
|
+
import $ebYMf$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
8
|
+
import $ebYMf$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
9
|
+
import {createFocusableRef as $ebYMf$createFocusableRef, classNames as $ebYMf$classNames} from "@react-spectrum/utils";
|
10
|
+
import {Field as $ebYMf$Field} from "@react-spectrum/label";
|
11
|
+
import {FocusRing as $ebYMf$FocusRing} from "@react-aria/focus";
|
12
|
+
import {useHover as $ebYMf$useHover} from "@react-aria/interactions";
|
13
|
+
|
14
|
+
function $parcel$export(e, n, v, s) {
|
15
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
16
|
+
}
|
17
17
|
function $parcel$interopDefault(a) {
|
18
18
|
return a && a.__esModule ? a.default : a;
|
19
19
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
$
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
var $
|
60
|
-
var $
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
hoverProps,
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
20
|
+
var $da8ab907384b5fd3$exports = {};
|
21
|
+
|
22
|
+
$parcel$export($da8ab907384b5fd3$exports, "TextArea", () => $da8ab907384b5fd3$export$f5c9f3c2c4054eec);
|
23
|
+
|
24
|
+
|
25
|
+
var $eea28bca1d6d81f9$exports = {};
|
26
|
+
|
27
|
+
$parcel$export($eea28bca1d6d81f9$exports, "TextFieldBase", () => $eea28bca1d6d81f9$export$d22444a338b6e3c2);
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
var $1b4d2ed8b766360d$exports = {};
|
36
|
+
|
37
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield-input", () => $1b4d2ed8b766360d$export$1ac009feb2b0bd0c, (v) => $1b4d2ed8b766360d$export$1ac009feb2b0bd0c = v);
|
38
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield", () => $1b4d2ed8b766360d$export$2c8a10299d8b3418, (v) => $1b4d2ed8b766360d$export$2c8a10299d8b3418 = v);
|
39
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield--quiet", () => $1b4d2ed8b766360d$export$bffd5e3d61a81737, (v) => $1b4d2ed8b766360d$export$bffd5e3d61a81737 = v);
|
40
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield--multiline", () => $1b4d2ed8b766360d$export$9699f1c538a448a0, (v) => $1b4d2ed8b766360d$export$9699f1c538a448a0 = v);
|
41
|
+
$parcel$export($1b4d2ed8b766360d$exports, "is-placeholder", () => $1b4d2ed8b766360d$export$e5b2f5233e4e5194, (v) => $1b4d2ed8b766360d$export$e5b2f5233e4e5194 = v);
|
42
|
+
$parcel$export($1b4d2ed8b766360d$exports, "is-hovered", () => $1b4d2ed8b766360d$export$b8813cd5d7824ce7, (v) => $1b4d2ed8b766360d$export$b8813cd5d7824ce7 = v);
|
43
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield--valid", () => $1b4d2ed8b766360d$export$c2abbc3f970170b7, (v) => $1b4d2ed8b766360d$export$c2abbc3f970170b7 = v);
|
44
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield--invalid", () => $1b4d2ed8b766360d$export$58e50b10d30123df, (v) => $1b4d2ed8b766360d$export$58e50b10d30123df = v);
|
45
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield--loadable", () => $1b4d2ed8b766360d$export$14fd30fea6f1348c, (v) => $1b4d2ed8b766360d$export$14fd30fea6f1348c = v);
|
46
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield-validationIcon", () => $1b4d2ed8b766360d$export$cf0ead5b44db0da3, (v) => $1b4d2ed8b766360d$export$cf0ead5b44db0da3 = v);
|
47
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield-icon", () => $1b4d2ed8b766360d$export$222d1ccd1870be1d, (v) => $1b4d2ed8b766360d$export$222d1ccd1870be1d = v);
|
48
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield-inputIcon", () => $1b4d2ed8b766360d$export$c1cdcaa5fe76a871, (v) => $1b4d2ed8b766360d$export$c1cdcaa5fe76a871 = v);
|
49
|
+
$parcel$export($1b4d2ed8b766360d$exports, "spectrum-Textfield-circleLoader", () => $1b4d2ed8b766360d$export$82a249fb4d6127, (v) => $1b4d2ed8b766360d$export$82a249fb4d6127 = v);
|
50
|
+
$parcel$export($1b4d2ed8b766360d$exports, "is-focused", () => $1b4d2ed8b766360d$export$e7dc768d35940237, (v) => $1b4d2ed8b766360d$export$e7dc768d35940237 = v);
|
51
|
+
$parcel$export($1b4d2ed8b766360d$exports, "focus-ring", () => $1b4d2ed8b766360d$export$f39a09f249340e2a, (v) => $1b4d2ed8b766360d$export$f39a09f249340e2a = v);
|
52
|
+
$parcel$export($1b4d2ed8b766360d$exports, "is-disabled", () => $1b4d2ed8b766360d$export$d35bc1e505d1ebbf, (v) => $1b4d2ed8b766360d$export$d35bc1e505d1ebbf = v);
|
53
|
+
var $1b4d2ed8b766360d$export$1ac009feb2b0bd0c;
|
54
|
+
var $1b4d2ed8b766360d$export$2c8a10299d8b3418;
|
55
|
+
var $1b4d2ed8b766360d$export$bffd5e3d61a81737;
|
56
|
+
var $1b4d2ed8b766360d$export$9699f1c538a448a0;
|
57
|
+
var $1b4d2ed8b766360d$export$e5b2f5233e4e5194;
|
58
|
+
var $1b4d2ed8b766360d$export$b8813cd5d7824ce7;
|
59
|
+
var $1b4d2ed8b766360d$export$c2abbc3f970170b7;
|
60
|
+
var $1b4d2ed8b766360d$export$58e50b10d30123df;
|
61
|
+
var $1b4d2ed8b766360d$export$14fd30fea6f1348c;
|
62
|
+
var $1b4d2ed8b766360d$export$cf0ead5b44db0da3;
|
63
|
+
var $1b4d2ed8b766360d$export$222d1ccd1870be1d;
|
64
|
+
var $1b4d2ed8b766360d$export$c1cdcaa5fe76a871;
|
65
|
+
var $1b4d2ed8b766360d$export$82a249fb4d6127;
|
66
|
+
var $1b4d2ed8b766360d$export$e7dc768d35940237;
|
67
|
+
var $1b4d2ed8b766360d$export$f39a09f249340e2a;
|
68
|
+
var $1b4d2ed8b766360d$export$d35bc1e505d1ebbf;
|
69
|
+
$1b4d2ed8b766360d$export$1ac009feb2b0bd0c = "spectrum-Textfield-input_73bc77";
|
70
|
+
$1b4d2ed8b766360d$export$2c8a10299d8b3418 = "spectrum-Textfield_73bc77";
|
71
|
+
$1b4d2ed8b766360d$export$bffd5e3d61a81737 = "spectrum-Textfield--quiet_73bc77";
|
72
|
+
$1b4d2ed8b766360d$export$9699f1c538a448a0 = "spectrum-Textfield--multiline_73bc77";
|
73
|
+
$1b4d2ed8b766360d$export$e5b2f5233e4e5194 = "is-placeholder_73bc77";
|
74
|
+
$1b4d2ed8b766360d$export$b8813cd5d7824ce7 = "is-hovered_73bc77";
|
75
|
+
$1b4d2ed8b766360d$export$c2abbc3f970170b7 = "spectrum-Textfield--valid_73bc77";
|
76
|
+
$1b4d2ed8b766360d$export$58e50b10d30123df = "spectrum-Textfield--invalid_73bc77";
|
77
|
+
$1b4d2ed8b766360d$export$14fd30fea6f1348c = "spectrum-Textfield--loadable_73bc77";
|
78
|
+
$1b4d2ed8b766360d$export$cf0ead5b44db0da3 = "spectrum-Textfield-validationIcon_73bc77";
|
79
|
+
$1b4d2ed8b766360d$export$222d1ccd1870be1d = "spectrum-Textfield-icon_73bc77";
|
80
|
+
$1b4d2ed8b766360d$export$c1cdcaa5fe76a871 = "spectrum-Textfield-inputIcon_73bc77";
|
81
|
+
$1b4d2ed8b766360d$export$82a249fb4d6127 = "spectrum-Textfield-circleLoader_73bc77";
|
82
|
+
$1b4d2ed8b766360d$export$e7dc768d35940237 = "is-focused_73bc77";
|
83
|
+
$1b4d2ed8b766360d$export$f39a09f249340e2a = "focus-ring_73bc77";
|
84
|
+
$1b4d2ed8b766360d$export$d35bc1e505d1ebbf = "is-disabled_73bc77";
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
function $eea28bca1d6d81f9$var$TextFieldBase(props, ref) {
|
89
|
+
let { label: label , validationState: validationState , icon: icon , isQuiet: isQuiet = false , isDisabled: isDisabled , multiLine: multiLine , autoFocus: autoFocus , inputClassName: inputClassName , wrapperChildren: wrapperChildren , labelProps: labelProps , inputProps: inputProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps , inputRef: inputRef , isLoading: isLoading , loadingIndicator: loadingIndicator , validationIconClassName: validationIconClassName } = props;
|
90
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = $ebYMf$useHover({
|
91
|
+
isDisabled: isDisabled
|
92
|
+
});
|
93
|
+
let domRef = $ebYMf$useRef(null);
|
94
|
+
let defaultInputRef = $ebYMf$useRef(null);
|
95
|
+
inputRef = inputRef || defaultInputRef;
|
96
|
+
// Expose imperative interface for ref
|
97
|
+
$ebYMf$useImperativeHandle(ref, ()=>({
|
98
|
+
...$ebYMf$createFocusableRef(domRef, inputRef),
|
99
|
+
select () {
|
100
|
+
if (inputRef.current) inputRef.current.select();
|
101
|
+
},
|
102
|
+
getInputElement () {
|
103
|
+
return inputRef.current;
|
104
|
+
}
|
105
|
+
})
|
106
|
+
);
|
107
|
+
let ElementType = multiLine ? 'textarea' : 'input';
|
108
|
+
let isInvalid = validationState === 'invalid';
|
109
|
+
if (icon) {
|
110
|
+
let UNSAFE_className = $ebYMf$classNames((/*@__PURE__*/$parcel$interopDefault($1b4d2ed8b766360d$exports)), icon.props && icon.props.UNSAFE_className, 'spectrum-Textfield-icon');
|
111
|
+
icon = /*#__PURE__*/ $ebYMf$cloneElement(icon, {
|
112
|
+
UNSAFE_className: UNSAFE_className,
|
113
|
+
size: 'S'
|
114
|
+
});
|
108
115
|
}
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
styleProps
|
113
|
-
} = useStyleProps(otherProps);
|
114
|
-
let ElementType = multiLine ? 'textarea' : 'input';
|
115
|
-
let isInvalid = validationState === 'invalid';
|
116
|
-
|
117
|
-
if (icon) {
|
118
|
-
let UNSAFE_className = classNames($aa1c742e7a2a16aa7981ca9e2f4a89$$interop$default, icon.props && icon.props.UNSAFE_className, 'spectrum-Textfield-icon');
|
119
|
-
icon = /*#__PURE__*/cloneElement(icon, {
|
120
|
-
UNSAFE_className,
|
121
|
-
size: 'S'
|
116
|
+
let validationIcon = isInvalid ? /*#__PURE__*/ $ebYMf$react.createElement($ebYMf$spectrumiconsuiAlertMedium, null) : /*#__PURE__*/ $ebYMf$react.createElement($ebYMf$spectrumiconsuiCheckmarkMedium, null);
|
117
|
+
let validation = /*#__PURE__*/ $ebYMf$cloneElement(validationIcon, {
|
118
|
+
UNSAFE_className: $ebYMf$classNames((/*@__PURE__*/$parcel$interopDefault($1b4d2ed8b766360d$exports)), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
122
119
|
});
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
'spectrum-Textfield-inputIcon': icon,
|
147
|
-
'is-hovered': isHovered
|
148
|
-
}, inputClassName)
|
149
|
-
}))), icon, validationState && !isLoading ? validation : null, isLoading && loadingIndicator, wrapperChildren);
|
150
|
-
|
151
|
-
if (label) {
|
152
|
-
let labelWrapperClass = classNames($c9fb1f4220ea2c59cb2e10f0e9828c6e$$interop$default, 'spectrum-Field', {
|
153
|
-
'spectrum-Field--positionTop': labelPosition === 'top',
|
154
|
-
'spectrum-Field--positionSide': labelPosition === 'side'
|
155
|
-
}, styleProps.className);
|
156
|
-
textField = /*#__PURE__*/_react.cloneElement(textField, mergeProps(textField.props, {
|
157
|
-
className: classNames($c9fb1f4220ea2c59cb2e10f0e9828c6e$$interop$default, 'spectrum-Field-field', {
|
158
|
-
'spectrum-Field-field--multiline': multiLine
|
159
|
-
})
|
120
|
+
let textField = /*#__PURE__*/ $ebYMf$react.createElement("div", {
|
121
|
+
className: $ebYMf$classNames((/*@__PURE__*/$parcel$interopDefault($1b4d2ed8b766360d$exports)), 'spectrum-Textfield', {
|
122
|
+
'spectrum-Textfield--invalid': isInvalid,
|
123
|
+
'spectrum-Textfield--valid': validationState === 'valid',
|
124
|
+
'spectrum-Textfield--loadable': loadingIndicator,
|
125
|
+
'spectrum-Textfield--quiet': isQuiet,
|
126
|
+
'spectrum-Textfield--multiline': multiLine
|
127
|
+
})
|
128
|
+
}, /*#__PURE__*/ $ebYMf$react.createElement($ebYMf$FocusRing, {
|
129
|
+
focusRingClass: $ebYMf$classNames((/*@__PURE__*/$parcel$interopDefault($1b4d2ed8b766360d$exports)), 'focus-ring'),
|
130
|
+
isTextInput: true,
|
131
|
+
autoFocus: autoFocus
|
132
|
+
}, /*#__PURE__*/ $ebYMf$react.createElement(ElementType, {
|
133
|
+
...$ebYMf$mergeProps(inputProps, hoverProps),
|
134
|
+
ref: inputRef,
|
135
|
+
rows: multiLine ? 1 : undefined,
|
136
|
+
className: $ebYMf$classNames((/*@__PURE__*/$parcel$interopDefault($1b4d2ed8b766360d$exports)), 'spectrum-Textfield-input', {
|
137
|
+
'spectrum-Textfield-inputIcon': icon,
|
138
|
+
'is-hovered': isHovered
|
139
|
+
}, inputClassName)
|
140
|
+
})), icon, validationState && !isLoading ? validation : null, isLoading && loadingIndicator, wrapperChildren);
|
141
|
+
if (label) textField = /*#__PURE__*/ $ebYMf$react.cloneElement(textField, $ebYMf$mergeProps(textField.props, {
|
142
|
+
className: multiLine ? 'spectrum-Field-field--multiline' : ''
|
160
143
|
}));
|
161
|
-
return
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
}), label), textField);
|
170
|
-
}
|
171
|
-
|
172
|
-
return /*#__PURE__*/_react.cloneElement(textField, mergeProps(textField.props, _babelRuntimeHelpersEsmExtends({}, styleProps, {
|
173
|
-
ref: domRef
|
174
|
-
})));
|
144
|
+
return(/*#__PURE__*/ $ebYMf$react.createElement($ebYMf$Field, {
|
145
|
+
...props,
|
146
|
+
labelProps: labelProps,
|
147
|
+
descriptionProps: descriptionProps,
|
148
|
+
errorMessageProps: errorMessageProps,
|
149
|
+
showErrorIcon: false,
|
150
|
+
ref: domRef
|
151
|
+
}, textField));
|
175
152
|
}
|
153
|
+
const $eea28bca1d6d81f9$export$d22444a338b6e3c2 = /*#__PURE__*/ $ebYMf$forwardRef($eea28bca1d6d81f9$var$TextFieldBase);
|
176
154
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
isDisabled = false,
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
function $da8ab907384b5fd3$var$TextArea(props, ref) {
|
160
|
+
props = $ebYMf$useProviderProps(props);
|
161
|
+
let { isDisabled: isDisabled = false , isQuiet: isQuiet = false , isReadOnly: isReadOnly = false , isRequired: isRequired = false , onChange: onChange , ...otherProps } = props;
|
162
|
+
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
163
|
+
let [inputValue, setInputValue] = $ebYMf$useControlledState(props.value, props.defaultValue, ()=>{
|
164
|
+
});
|
165
|
+
let inputRef = $ebYMf$useRef();
|
166
|
+
let onHeightChange = $ebYMf$useCallback(()=>{
|
167
|
+
if (isQuiet) {
|
168
|
+
let input = inputRef.current;
|
169
|
+
let prevAlignment = input.style.alignSelf;
|
170
|
+
input.style.alignSelf = 'start';
|
171
|
+
input.style.height = 'auto';
|
172
|
+
input.style.height = `${input.scrollHeight}px`;
|
173
|
+
input.style.alignSelf = prevAlignment;
|
174
|
+
}
|
175
|
+
}, [
|
176
|
+
isQuiet,
|
177
|
+
inputRef
|
178
|
+
]);
|
179
|
+
$ebYMf$useLayoutEffect(()=>{
|
180
|
+
if (inputRef.current) onHeightChange();
|
181
|
+
}, [
|
182
|
+
onHeightChange,
|
183
|
+
inputValue,
|
184
|
+
inputRef
|
185
|
+
]);
|
186
|
+
let { labelProps: labelProps , inputProps: inputProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $ebYMf$useTextField({
|
187
|
+
...props,
|
188
|
+
onChange: $ebYMf$chain(onChange, setInputValue),
|
189
|
+
inputElementType: 'textarea'
|
190
|
+
}, inputRef);
|
191
|
+
return(/*#__PURE__*/ $ebYMf$react.createElement($eea28bca1d6d81f9$export$d22444a338b6e3c2, {
|
192
|
+
...otherProps,
|
193
|
+
ref: ref,
|
194
|
+
inputRef: inputRef,
|
195
|
+
labelProps: labelProps,
|
196
|
+
inputProps: inputProps,
|
197
|
+
descriptionProps: descriptionProps,
|
198
|
+
errorMessageProps: errorMessageProps,
|
199
|
+
multiLine: true,
|
200
|
+
isDisabled: isDisabled,
|
201
|
+
isQuiet: isQuiet,
|
202
|
+
isReadOnly: isReadOnly,
|
203
|
+
isRequired: isRequired
|
204
|
+
}));
|
227
205
|
}
|
228
206
|
/**
|
229
207
|
* TextAreas are multiline text inputs, useful for cases where users have
|
230
208
|
* a sizable amount of text to enter. They allow for all customizations that
|
231
209
|
* are available to text fields.
|
232
|
-
*/
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
labelProps: labelProps,
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
210
|
+
*/ let $da8ab907384b5fd3$export$f5c9f3c2c4054eec = /*#__PURE__*/ $ebYMf$react.forwardRef($da8ab907384b5fd3$var$TextArea);
|
211
|
+
|
212
|
+
|
213
|
+
var $90dfba621f703b3f$exports = {};
|
214
|
+
|
215
|
+
$parcel$export($90dfba621f703b3f$exports, "TextField", () => $90dfba621f703b3f$export$2c73285ae9390cec);
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
function $90dfba621f703b3f$var$TextField(props, ref) {
|
221
|
+
props = $ebYMf$useProviderProps(props);
|
222
|
+
let inputRef = $ebYMf$useRef();
|
223
|
+
let { labelProps: labelProps , inputProps: inputProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $ebYMf$useTextField(props, inputRef);
|
224
|
+
return(/*#__PURE__*/ $ebYMf$react.createElement($eea28bca1d6d81f9$export$d22444a338b6e3c2, {
|
225
|
+
...props,
|
226
|
+
labelProps: labelProps,
|
227
|
+
inputProps: inputProps,
|
228
|
+
descriptionProps: descriptionProps,
|
229
|
+
errorMessageProps: errorMessageProps,
|
230
|
+
ref: ref,
|
231
|
+
inputRef: inputRef
|
232
|
+
}));
|
250
233
|
}
|
251
234
|
/**
|
252
235
|
* TextFields are text inputs that allow users to input custom text entries
|
253
236
|
* with a keyboard. Various decorations can be displayed around the field to
|
254
237
|
* communicate the entry requirements.
|
255
|
-
*/
|
238
|
+
*/ const $90dfba621f703b3f$export$2c73285ae9390cec = /*#__PURE__*/ $ebYMf$forwardRef($90dfba621f703b3f$var$TextField);
|
239
|
+
|
240
|
+
|
241
|
+
|
256
242
|
|
257
243
|
|
258
|
-
export
|
244
|
+
export {$da8ab907384b5fd3$export$f5c9f3c2c4054eec as TextArea, $90dfba621f703b3f$export$2c73285ae9390cec as TextField, $eea28bca1d6d81f9$export$d22444a338b6e3c2 as TextFieldBase};
|
259
245
|
//# sourceMappingURL=module.js.map
|