@ausbom/form
Advanced tools
Comparing version 0.4.42 to 0.4.43
@@ -9,4 +9,4 @@ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _classnames=_interopRequireDefault(require("classnames"));var _react=_interopRequireDefault(require("react"));var _Label=_interopRequireDefault(require("../Label/Label"));var _Status=_interopRequireDefault(require("../Status/Status"));var _status=_interopRequireDefault(require("../../status"));function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=(0,_getPrototypeOf2["default"])(Derived),result;if(hasNativeReflectConstruct){var NewTarget=(0,_getPrototypeOf2["default"])(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return(0,_possibleConstructorReturn2["default"])(this,result)}}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}// istanbul ignore next (tricky to unit test, but covered in visual tests) | ||
_this2.textareaRef.current&&_this2.textareaRef.current.focus()},50)}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var _this$props2=this.props,value=_this$props2.value,multiLine=_this$props2.multiLine,autoHeight=_this$props2.autoHeight;var previousValue=prevProps.value;// istanbul ignore next (tricky to unit test, but covered in visual tests) | ||
if(multiLine&&autoHeight&&this.textareaRef.current&&value!==previousValue){adjustHeight(this.textareaRef.current)}}},{key:"render",value:function render(){var _this3=this;var _ref=this.props,id=_ref.id,helpText=_ref.helpText,autoHeight=_ref.autoHeight,className=_ref.className,label=_ref.label,hideLabel=_ref.hideLabel,multiLine=_ref.multiLine,small=_ref.small,status=_ref.status,statusMessage=_ref.statusMessage,labelAttributes=_ref.labelAttributes,innerRef=_ref.innerRef,restProps=(0,_objectWithoutProperties2["default"])(_ref,["id","helpText","autoHeight","className","label","hideLabel","multiLine","small","status","statusMessage","labelAttributes","innerRef"]);var classes=(0,_classnames["default"])(className,"bom-form-text",{"bom-form-text--error":status===_status["default"].Error,"bom-form-text--success":status===_status["default"].Success,"bom-form-text--small":small,"bom-form-text--hide-label":hideLabel});var optionalProps={};if(statusMessage){optionalProps["aria-describedby"]="".concat(id,"_status")}var Tag=multiLine?"textarea":"input";return/*#__PURE__*/_react["default"].createElement("div",{className:classes},/*#__PURE__*/_react["default"].createElement(_Label["default"],(0,_extends2["default"])({className:"bom-form-text__label",htmlFor:id,small:small,"data-testid":"bom-text-label"},restProps&&restProps["aria-hidden"]&&{"aria-hidden":restProps["aria-hidden"]},labelAttributes),label),/*#__PURE__*/_react["default"].createElement(Tag,(0,_extends2["default"])({id:id,type:!multiLine?"text":undefined,className:"bom-form-text__input","data-testid":"bom-text-input",onInput:function onInput(e){// istanbul ignore next (tricky to unit test, but covered in visual tests) | ||
if(multiLine&&autoHeight&&this.textareaRef.current&&value!==previousValue){adjustHeight(this.textareaRef.current)}}},{key:"render",value:function render(){var _this3=this;var _ref=this.props,id=_ref.id,helpText=_ref.helpText,autoHeight=_ref.autoHeight,className=_ref.className,label=_ref.label,hideLabel=_ref.hideLabel,multiLine=_ref.multiLine,small=_ref.small,status=_ref.status,statusMessage=_ref.statusMessage,labelAttributes=_ref.labelAttributes,innerRef=_ref.innerRef,restProps=(0,_objectWithoutProperties2["default"])(_ref,["id","helpText","autoHeight","className","label","hideLabel","multiLine","small","status","statusMessage","labelAttributes","innerRef"]);var classes=(0,_classnames["default"])(className,"bom-form-text",{"bom-form-text--error":status===_status["default"].Error,"bom-form-text--success":status===_status["default"].Success,"bom-form-text--small":small,"bom-form-text--hide-label":hideLabel});var optionalProps={};if(statusMessage){optionalProps["aria-describedby"]="".concat(id,"_status")}var Tag=multiLine?"textarea":"input";var tagClasses=(0,_classnames["default"])("bom-form-text__input",{"bom-form-text__input--no-resize":multiLine&&autoHeight});return/*#__PURE__*/_react["default"].createElement("div",{className:classes},/*#__PURE__*/_react["default"].createElement(_Label["default"],(0,_extends2["default"])({className:"bom-form-text__label",htmlFor:id,small:small,"data-testid":"bom-text-label"},restProps&&restProps["aria-hidden"]&&{"aria-hidden":restProps["aria-hidden"]},labelAttributes),label),/*#__PURE__*/_react["default"].createElement(Tag,(0,_extends2["default"])({id:id,type:!multiLine?"text":undefined,className:tagClasses,"data-testid":"bom-text-input",onInput:function onInput(e){// istanbul ignore next (tricky to unit test, but covered in visual tests) | ||
if(multiLine&&autoHeight&&_this3.textareaRef.current){adjustHeight(_this3.textareaRef.current)}// istanbul ignore next (tricky to unit test, but covered in visual tests) | ||
if(_this3.props.onInput&&typeof _this3.props.onInput==="function"){_this3.props.onInput(e)}},ref:this.textareaRef,"aria-invalid":status===_status["default"].Error},optionalProps,restProps)),statusMessage&&/*#__PURE__*/_react["default"].createElement(_Status["default"],{className:"bom-form-text__status",id:"".concat(id,"_status"),message:statusMessage,status:status,small:small}),helpText&&/*#__PURE__*/_react["default"].createElement(_Status["default"],{className:"bom-form-text__help",message:helpText,small:small}))}}]);return TextInput}(_react["default"].PureComponent);(0,_defineProperty2["default"])(TextInput,"defaultProps",{autoHeight:false,multiLine:false,small:false,hideLabel:false,autoFocus:false});var TextInputWithRef=/*#__PURE__*/_react["default"].forwardRef(function(props,ref){return/*#__PURE__*/_react["default"].createElement(TextInput,(0,_extends2["default"])({innerRef:ref},props))});TextInputWithRef.displayName="TextInput";var _default=TextInputWithRef;exports["default"]=_default; |
{ | ||
"name": "@ausbom/form", | ||
"version": "0.4.42", | ||
"version": "0.4.43", | ||
"description": "", | ||
@@ -45,3 +45,3 @@ "keywords": [], | ||
}, | ||
"gitHead": "6cf957bdaaa6b979b78e03e59e50e408b17a7c26" | ||
"gitHead": "c59f2d37d678417c66134c89fec34606eb8b1d54" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68504