@alfalab/core-components-input
Advanced tools
Comparing version 1.4.1 to 1.5.0
@@ -30,2 +30,6 @@ /// <reference types="react" /> | ||
/** | ||
* Ref для обертки input | ||
*/ | ||
wrapperRef?: React.MutableRefObject<HTMLDivElement | null>; | ||
/** | ||
* Слот слева | ||
@@ -81,2 +85,6 @@ */ | ||
/** | ||
* Ref для обертки input | ||
*/ | ||
wrapperRef?: React.MutableRefObject<HTMLDivElement | null> | undefined; | ||
/** | ||
* Слот слева | ||
@@ -83,0 +91,0 @@ */ |
@@ -51,3 +51,3 @@ 'use strict'; | ||
var styles = {"input":"input__input_tpbq0","hasLabel":"input__hasLabel_tpbq0","block":"input__block_tpbq0"}; | ||
var styles = {"input":"input__input_1j1k7","hasLabel":"input__hasLabel_1j1k7","block":"input__block_1j1k7"}; | ||
require('./index.css') | ||
@@ -57,3 +57,3 @@ | ||
var _b; | ||
var _c = _a.size, size = _c === void 0 ? 's' : _c, _d = _a.type, type = _d === void 0 ? 'text' : _d, _e = _a.block, block = _e === void 0 ? false : _e, bottomAddons = _a.bottomAddons, className = _a.className, dataTestId = _a.dataTestId, disabled = _a.disabled, error = _a.error, hint = _a.hint, inputClassName = _a.inputClassName, label = _a.label, leftAddons = _a.leftAddons, onFocus = _a.onFocus, onBlur = _a.onBlur, onChange = _a.onChange, rightAddons = _a.rightAddons, value = _a.value, restProps = __rest(_a, ["size", "type", "block", "bottomAddons", "className", "dataTestId", "disabled", "error", "hint", "inputClassName", "label", "leftAddons", "onFocus", "onBlur", "onChange", "rightAddons", "value"]); | ||
var _c = _a.size, size = _c === void 0 ? 's' : _c, _d = _a.type, type = _d === void 0 ? 'text' : _d, _e = _a.block, block = _e === void 0 ? false : _e, bottomAddons = _a.bottomAddons, className = _a.className, dataTestId = _a.dataTestId, disabled = _a.disabled, error = _a.error, hint = _a.hint, inputClassName = _a.inputClassName, label = _a.label, leftAddons = _a.leftAddons, onFocus = _a.onFocus, onBlur = _a.onBlur, onChange = _a.onChange, rightAddons = _a.rightAddons, value = _a.value, wrapperRef = _a.wrapperRef, restProps = __rest(_a, ["size", "type", "block", "bottomAddons", "className", "dataTestId", "disabled", "error", "hint", "inputClassName", "label", "leftAddons", "onFocus", "onBlur", "onChange", "rightAddons", "value", "wrapperRef"]); | ||
var _f = React.useState(false), focused = _f[0], setFocused = _f[1]; | ||
@@ -79,3 +79,3 @@ var _g = React.useState(value !== undefined && value !== ''), filled = _g[0], setFilled = _g[1]; | ||
}, [onChange]); | ||
return (React__default.createElement(coreComponentsFormControl.FormControl, { className: className, size: size, block: block, disabled: disabled, filled: filled || focused || !!value, focused: focused, error: error, label: label, hint: hint, leftAddons: leftAddons, rightAddons: rightAddons, bottomAddons: bottomAddons }, | ||
return (React__default.createElement(coreComponentsFormControl.FormControl, { ref: wrapperRef, className: className, size: size, block: block, disabled: disabled, filled: filled || focused || !!value, focused: focused, error: error, label: label, hint: hint, leftAddons: leftAddons, rightAddons: rightAddons, bottomAddons: bottomAddons }, | ||
React__default.createElement("input", __assign({}, restProps, { className: cn(styles.input, (_b = {}, | ||
@@ -82,0 +82,0 @@ _b[styles.hasLabel] = label, |
@@ -30,2 +30,6 @@ /// <reference types="react" /> | ||
/** | ||
* Ref для обертки input | ||
*/ | ||
wrapperRef?: React.MutableRefObject<HTMLDivElement | null>; | ||
/** | ||
* Слот слева | ||
@@ -81,2 +85,6 @@ */ | ||
/** | ||
* Ref для обертки input | ||
*/ | ||
wrapperRef?: React.MutableRefObject<HTMLDivElement | null> | undefined; | ||
/** | ||
* Слот слева | ||
@@ -83,0 +91,0 @@ */ |
@@ -5,6 +5,6 @@ import React, { useState, useCallback } from 'react'; | ||
var styles = {"input":"input__input_tpbq0","hasLabel":"input__hasLabel_tpbq0","block":"input__block_tpbq0"}; | ||
var styles = {"input":"input__input_1j1k7","hasLabel":"input__hasLabel_1j1k7","block":"input__block_1j1k7"}; | ||
require('./index.css') | ||
const Input = React.forwardRef(({ size = 's', type = 'text', block = false, bottomAddons, className, dataTestId, disabled, error, hint, inputClassName, label, leftAddons, onFocus, onBlur, onChange, rightAddons, value, ...restProps }, ref) => { | ||
const Input = React.forwardRef(({ size = 's', type = 'text', block = false, bottomAddons, className, dataTestId, disabled, error, hint, inputClassName, label, leftAddons, onFocus, onBlur, onChange, rightAddons, value, wrapperRef, ...restProps }, ref) => { | ||
const [focused, setFocused] = useState(false); | ||
@@ -30,3 +30,3 @@ const [filled, setFilled] = useState(value !== undefined && value !== ''); | ||
}, [onChange]); | ||
return (React.createElement(FormControl, { className: className, size: size, block: block, disabled: disabled, filled: filled || focused || !!value, focused: focused, error: error, label: label, hint: hint, leftAddons: leftAddons, rightAddons: rightAddons, bottomAddons: bottomAddons }, | ||
return (React.createElement(FormControl, { ref: wrapperRef, className: className, size: size, block: block, disabled: disabled, filled: filled || focused || !!value, focused: focused, error: error, label: label, hint: hint, leftAddons: leftAddons, rightAddons: rightAddons, bottomAddons: bottomAddons }, | ||
React.createElement("input", Object.assign({}, restProps, { className: cn(styles.input, { | ||
@@ -33,0 +33,0 @@ [styles.hasLabel]: label, |
{ | ||
"name": "@alfalab/core-components-input", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "", | ||
@@ -19,5 +19,5 @@ "keywords": [], | ||
"dependencies": { | ||
"@alfalab/core-components-form-control": "^1.1.1" | ||
"@alfalab/core-components-form-control": "^1.2.0" | ||
}, | ||
"gitHead": "44322d91560eccb0b7657cf23913e85c2a6c4e04" | ||
"gitHead": "f4dc483b1c30b3b8e69d7a175900240ee72fcac5" | ||
} |
Sorry, the diff of this file is not supported yet
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
25713
487