@alfalab/core-components-with-suffix
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -52,3 +52,3 @@ 'use strict'; | ||
var styles = {"suffixContainer":"with-suffix__suffixContainer_xbt73","suffixVisible":"with-suffix__suffixVisible_xbt73","hasSuffix":"with-suffix__hasSuffix_xbt73","spacer":"with-suffix__spacer_xbt73","suffix":"with-suffix__suffix_xbt73","disabled":"with-suffix__disabled_xbt73"}; | ||
var styles = {"suffixContainer":"with-suffix__suffixContainer_49owc","suffixVisible":"with-suffix__suffixVisible_49owc","hasSuffix":"with-suffix__hasSuffix_49owc","spacer":"with-suffix__spacer_49owc","suffix":"with-suffix__suffix_49owc","disabled":"with-suffix__disabled_49owc","readOnly":"with-suffix__readOnly_49owc"}; | ||
require('./index.css') | ||
@@ -59,3 +59,3 @@ | ||
var _b, _c; | ||
var value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onClear = _a.onClear, _d = _a.suffix, suffix = _d === void 0 ? '' : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, suffixContainerClassName = _a.suffixContainerClassName, restProps = __rest(_a, ["value", "defaultValue", "onChange", "onClear", "suffix", "placeholder", "className", "disabled", "suffixContainerClassName"]); | ||
var value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onClear = _a.onClear, _d = _a.suffix, suffix = _d === void 0 ? '' : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, readOnly = _a.readOnly, suffixContainerClassName = _a.suffixContainerClassName, restProps = __rest(_a, ["value", "defaultValue", "onChange", "onClear", "suffix", "placeholder", "className", "disabled", "readOnly", "suffixContainerClassName"]); | ||
var uncontrolled = value === undefined; | ||
@@ -85,3 +85,3 @@ var inputRef = React.useRef(null); | ||
return (React__default.createElement(React.Fragment, null, | ||
React__default.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, (_b = {}, | ||
React__default.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, readOnly: readOnly, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, (_b = {}, | ||
_b[styles.suffixVisible] = Boolean(visibleValue), | ||
@@ -93,3 +93,6 @@ _b[styles.hasSuffix] = suffix, | ||
React__default.createElement("span", { className: styles.spacer }, visibleValue), | ||
suffix && (React__default.createElement("div", { className: cn(styles.suffix, (_c = {}, _c[styles.disabled] = disabled, _c)) }, suffix)))))); | ||
suffix && (React__default.createElement("div", { className: cn(styles.suffix, (_c = {}, | ||
_c[styles.disabled] = disabled, | ||
_c[styles.readOnly] = readOnly, | ||
_c)) }, suffix)))))); | ||
}); | ||
@@ -96,0 +99,0 @@ }; |
@@ -56,3 +56,3 @@ 'use strict'; | ||
var _b, _c; | ||
var value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onClear = _a.onClear, _d = _a.suffix, suffix = _d === void 0 ? '' : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, suffixContainerClassName = _a.suffixContainerClassName, restProps = __rest(_a, ["value", "defaultValue", "onChange", "onClear", "suffix", "placeholder", "className", "disabled", "suffixContainerClassName"]); | ||
var value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onClear = _a.onClear, _d = _a.suffix, suffix = _d === void 0 ? '' : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, readOnly = _a.readOnly, suffixContainerClassName = _a.suffixContainerClassName, restProps = __rest(_a, ["value", "defaultValue", "onChange", "onClear", "suffix", "placeholder", "className", "disabled", "readOnly", "suffixContainerClassName"]); | ||
var uncontrolled = value === undefined; | ||
@@ -82,3 +82,3 @@ var inputRef = React.useRef(null); | ||
return (React__default.createElement(React.Fragment, null, | ||
React__default.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, (_b = {}, | ||
React__default.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, readOnly: readOnly, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, (_b = {}, | ||
_b[styles.suffixVisible] = Boolean(visibleValue), | ||
@@ -90,3 +90,6 @@ _b[styles.hasSuffix] = suffix, | ||
React__default.createElement("span", { className: styles.spacer }, visibleValue), | ||
suffix && (React__default.createElement("div", { className: cn(styles.suffix, (_c = {}, _c[styles.disabled] = disabled, _c)) }, suffix)))))); | ||
suffix && (React__default.createElement("div", { className: cn(styles.suffix, (_c = {}, | ||
_c[styles.disabled] = disabled, | ||
_c[styles.readOnly] = readOnly, | ||
_c)) }, suffix)))))); | ||
}); | ||
@@ -93,0 +96,0 @@ }; |
@@ -45,3 +45,3 @@ import React, { forwardRef, useRef, useState, useCallback, Fragment } from 'react'; | ||
var styles = {"suffixContainer":"with-suffix__suffixContainer_xbt73","suffixVisible":"with-suffix__suffixVisible_xbt73","hasSuffix":"with-suffix__hasSuffix_xbt73","spacer":"with-suffix__spacer_xbt73","suffix":"with-suffix__suffix_xbt73","disabled":"with-suffix__disabled_xbt73"}; | ||
var styles = {"suffixContainer":"with-suffix__suffixContainer_49owc","suffixVisible":"with-suffix__suffixVisible_49owc","hasSuffix":"with-suffix__hasSuffix_49owc","spacer":"with-suffix__spacer_49owc","suffix":"with-suffix__suffix_49owc","disabled":"with-suffix__disabled_49owc","readOnly":"with-suffix__readOnly_49owc"}; | ||
require('./index.css') | ||
@@ -52,3 +52,3 @@ | ||
var _b, _c; | ||
var value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onClear = _a.onClear, _d = _a.suffix, suffix = _d === void 0 ? '' : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, suffixContainerClassName = _a.suffixContainerClassName, restProps = __rest(_a, ["value", "defaultValue", "onChange", "onClear", "suffix", "placeholder", "className", "disabled", "suffixContainerClassName"]); | ||
var value = _a.value, defaultValue = _a.defaultValue, onChange = _a.onChange, onClear = _a.onClear, _d = _a.suffix, suffix = _d === void 0 ? '' : _d, placeholder = _a.placeholder, className = _a.className, disabled = _a.disabled, readOnly = _a.readOnly, suffixContainerClassName = _a.suffixContainerClassName, restProps = __rest(_a, ["value", "defaultValue", "onChange", "onClear", "suffix", "placeholder", "className", "disabled", "readOnly", "suffixContainerClassName"]); | ||
var uncontrolled = value === undefined; | ||
@@ -78,3 +78,3 @@ var inputRef = useRef(null); | ||
return (React.createElement(Fragment, null, | ||
React.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, (_b = {}, | ||
React.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, readOnly: readOnly, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, (_b = {}, | ||
_b[styles.suffixVisible] = Boolean(visibleValue), | ||
@@ -86,3 +86,6 @@ _b[styles.hasSuffix] = suffix, | ||
React.createElement("span", { className: styles.spacer }, visibleValue), | ||
suffix && (React.createElement("div", { className: cn(styles.suffix, (_c = {}, _c[styles.disabled] = disabled, _c)) }, suffix)))))); | ||
suffix && (React.createElement("div", { className: cn(styles.suffix, (_c = {}, | ||
_c[styles.disabled] = disabled, | ||
_c[styles.readOnly] = readOnly, | ||
_c)) }, suffix)))))); | ||
}); | ||
@@ -89,0 +92,0 @@ }; |
@@ -6,6 +6,6 @@ import React, { forwardRef, useRef, useState, useCallback, Fragment } from 'react'; | ||
var styles = {"suffixContainer":"with-suffix__suffixContainer_xbt73","suffixVisible":"with-suffix__suffixVisible_xbt73","hasSuffix":"with-suffix__hasSuffix_xbt73","spacer":"with-suffix__spacer_xbt73","suffix":"with-suffix__suffix_xbt73","disabled":"with-suffix__disabled_xbt73"}; | ||
var styles = {"suffixContainer":"with-suffix__suffixContainer_49owc","suffixVisible":"with-suffix__suffixVisible_49owc","hasSuffix":"with-suffix__hasSuffix_49owc","spacer":"with-suffix__spacer_49owc","suffix":"with-suffix__suffix_49owc","disabled":"with-suffix__disabled_49owc","readOnly":"with-suffix__readOnly_49owc"}; | ||
require('./index.css') | ||
const withSuffix = (Input) => forwardRef(({ value, defaultValue, onChange, onClear, suffix = '', placeholder, className, disabled, suffixContainerClassName, ...restProps }, ref) => { | ||
const withSuffix = (Input) => forwardRef(({ value, defaultValue, onChange, onClear, suffix = '', placeholder, className, disabled, readOnly, suffixContainerClassName, ...restProps }, ref) => { | ||
const uncontrolled = value === undefined; | ||
@@ -35,3 +35,3 @@ const inputRef = useRef(null); | ||
return (React.createElement(Fragment, null, | ||
React.createElement(Input, Object.assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, { | ||
React.createElement(Input, Object.assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, disabled: disabled, readOnly: readOnly, onChange: handleInputChange, onClear: handleClear, placeholder: placeholder, className: cn(className, { | ||
[styles.suffixVisible]: Boolean(visibleValue), | ||
@@ -43,5 +43,8 @@ [styles.hasSuffix]: suffix, | ||
React.createElement("span", { className: styles.spacer }, visibleValue), | ||
suffix && (React.createElement("div", { className: cn(styles.suffix, { [styles.disabled]: disabled }) }, suffix)))))); | ||
suffix && (React.createElement("div", { className: cn(styles.suffix, { | ||
[styles.disabled]: disabled, | ||
[styles.readOnly]: readOnly, | ||
}) }, suffix)))))); | ||
}); | ||
export { withSuffix }; |
{ | ||
"name": "@alfalab/core-components-with-suffix", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -19,8 +19,8 @@ "keywords": [], | ||
"dependencies": { | ||
"@alfalab/core-components-input": "^4.0.0", | ||
"@alfalab/core-components-portal": "^1.3.3", | ||
"@alfalab/core-components-input": "^4.1.0", | ||
"@alfalab/core-components-portal": "^1.4.0", | ||
"classnames": "^2.2.6", | ||
"react-merge-refs": "^1.1.0" | ||
}, | ||
"gitHead": "e97649d0b07de8060ade99ebf781408fdfb0b532" | ||
"gitHead": "6b303f53b28575eff35ef92e9438826324cde107" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
77118
932