UNPKG

@carbon/react

Version:

React components for the Carbon Design System

135 lines (127 loc) 4.76 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js'); var PropTypes = require('prop-types'); var React = require('react'); var cx = require('classnames'); var TextArea = require('../TextArea/TextArea.js'); require('../TextArea/TextArea.Skeleton.js'); var deprecate = require('../../prop-types/deprecate.js'); var usePrefix = require('../../internal/usePrefix.js'); var FormContext = require('../FluidForm/FormContext.js'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx); const FluidTextArea = ({ className, ...other }) => { const prefix = usePrefix.usePrefix(); const classNames = cx__default["default"](`${prefix}--text-area--fluid`, className); return /*#__PURE__*/React__default["default"].createElement(FormContext.FormContext.Provider, { value: { isFluid: true } }, /*#__PURE__*/React__default["default"].createElement(TextArea["default"], _rollupPluginBabelHelpers["extends"]({ className: classNames }, other))); }; FluidTextArea.propTypes = { /** * Provide a custom className that is applied directly to the underlying * `<textarea>` node */ className: PropTypes__default["default"].string, /** * Specify the `cols` attribute for the underlying `<textarea>` node */ cols: PropTypes__default["default"].number, /** * Optionally provide the default value of the `<textarea>` */ defaultValue: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]), /** * Specify whether the control is disabled */ disabled: PropTypes__default["default"].bool, /** * Specify whether to display the character counter */ enableCounter: PropTypes__default["default"].bool, /** * Provide text that is used alongside the control label for additional help */ helperText: PropTypes__default["default"].node, /** * Specify whether you want the underlying label to be visually hidden */ hideLabel: PropTypes__default["default"].bool, /** * Provide a unique identifier for the control */ id: PropTypes__default["default"].string, /** * Specify whether the control is currently invalid */ invalid: PropTypes__default["default"].bool, /** * Provide the text that is displayed when the control is in an invalid state */ invalidText: PropTypes__default["default"].node, /** * Provide the text that will be read by a screen reader when visiting this * control */ labelText: PropTypes__default["default"].node.isRequired, /** * `true` to use the light version. For use on $ui-01 backgrounds only. * Don't use this to make tile background color same as container background color. */ light: deprecate["default"](PropTypes__default["default"].bool, 'The `light` prop for `FluidTextArea` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'), /** * Max character count allowed for the textarea. This is needed in order for enableCounter to display */ maxCount: PropTypes__default["default"].number, /** * Optionally provide an `onChange` handler that is called whenever `<textarea>` * is updated */ onChange: PropTypes__default["default"].func, /** * Optionally provide an `onClick` handler that is called whenever the * `<textarea>` is clicked */ onClick: PropTypes__default["default"].func, /** * Specify the placeholder attribute for the `<textarea>` */ placeholder: PropTypes__default["default"].string, /** * Specify the rows attribute for the `<textarea>` */ rows: PropTypes__default["default"].number, /** * Provide the current value of the `<textarea>` */ value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]), /** * Specify whether the control is currently in warning state */ warn: PropTypes__default["default"].bool, /** * Provide the text that is displayed when the control is in warning state */ warnText: PropTypes__default["default"].node, /** * Whether or not the component is readonly */ readOnly: PropTypes__default["default"].bool }; exports["default"] = FluidTextArea;