@vchasno/ui-kit 0.4.16 → 0.4.17
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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.17] - 2024-10-03
|
|
11
|
+
|
|
12
|
+
## Added
|
|
13
|
+
|
|
14
|
+
- TextInput - add onClear prop for controlled state components
|
|
15
|
+
|
|
10
16
|
## [0.4.16] - 2024-10-03
|
|
11
17
|
|
|
12
18
|
## Fixed
|
|
@@ -5,6 +5,7 @@ import { DataQa } from '../types.js';
|
|
|
5
5
|
interface TextInputProps extends InputHTMLAttributes<HTMLInputElement>, Omit<InputProps, 'children'>, DataQa {
|
|
6
6
|
inputClassName?: string;
|
|
7
7
|
labelProps?: InputHTMLAttributes<HTMLLabelElement>;
|
|
8
|
+
onClear?: VoidFunction;
|
|
8
9
|
}
|
|
9
10
|
declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
10
11
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import r from"classnames";import{mergeRefs as t}from"../../utils/react.js";import a from"../Input/Input.js";var n=/*#__PURE__*/e.forwardRef(function(n,l){var
|
|
1
|
+
import e from"react";import r from"classnames";import{mergeRefs as t}from"../../utils/react.js";import a from"../Input/Input.js";var n=/*#__PURE__*/e.forwardRef(function(n,l){var o=n.className,i=n.disabled,u=n.startElement,s=n.endElement,c=n.error,d=n.label,p=n.hint,m=n.wide,f=n.required,b=n.loading,y=n.inputClassName,O=n.labelProps,h=n.hideEmptyMeta,E=n.dataQa,g=n.isClearable,v=n.onClear,j=n.placeholder,w=function(e,r){if(null==e)return{};var t,a,n=function(e,r){if(null==e)return{};var t,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)t=l[a],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)t=l[a],!(r.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}(n,["className","disabled","startElement","endElement","error","label","hint","wide","required","loading","inputClassName","labelProps","hideEmptyMeta","dataQa","isClearable","onClear","placeholder"]),P=e.useRef(null),C=t(P,l);return /*#__PURE__*/e.createElement(a,{dataQa:E,required:f,wide:m,className:o,loading:b,disabled:i,label:d,error:c,hint:p,endElement:s,startElement:u,labelProps:O,hideEmptyMeta:h,isClearable:g,onClear:function(){if("function"==typeof v){v();return}P.current&&(P.current.value="")}},/*#__PURE__*/e.createElement("input",function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.forEach(function(r){var a;a=t[r],r in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a})}return e}({disabled:i,className:r("vchasno-ui-text-input",y),required:f,ref:C,placeholder:void 0===j?" ":j},w)))});n.displayName="TextInput";export{n as default};
|
|
2
2
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["import React, { InputHTMLAttributes } from 'react';\n\nimport cn from 'classnames';\n\nimport { mergeRefs } from '../../utils/react';\nimport type { InputProps } from '../Input';\nimport Input from '../Input';\nimport { DataQa } from '../types';\n\nimport './TextInput.global.css';\n\nexport interface TextInputProps\n extends InputHTMLAttributes<HTMLInputElement>,\n Omit<InputProps, 'children'>,\n DataQa {\n inputClassName?: string;\n labelProps?: InputHTMLAttributes<HTMLLabelElement>;\n}\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n className,\n disabled,\n startElement,\n endElement,\n error,\n label,\n hint,\n wide,\n required,\n loading,\n inputClassName,\n labelProps,\n hideEmptyMeta,\n dataQa,\n isClearable,\n placeholder = ' ', //need \"space\" for correct label working\n ...rest\n },\n ref,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = mergeRefs(inputRef, ref);\n\n return (\n <Input\n dataQa={dataQa}\n required={required}\n wide={wide}\n className={className}\n loading={loading}\n disabled={disabled}\n label={label}\n error={error}\n hint={hint}\n endElement={endElement}\n startElement={startElement}\n labelProps={labelProps}\n hideEmptyMeta={hideEmptyMeta}\n isClearable={isClearable}\n onClear={() => {\n if (
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["import React, { InputHTMLAttributes } from 'react';\n\nimport cn from 'classnames';\n\nimport { mergeRefs } from '../../utils/react';\nimport type { InputProps } from '../Input';\nimport Input from '../Input';\nimport { DataQa } from '../types';\n\nimport './TextInput.global.css';\n\nexport interface TextInputProps\n extends InputHTMLAttributes<HTMLInputElement>,\n Omit<InputProps, 'children'>,\n DataQa {\n inputClassName?: string;\n labelProps?: InputHTMLAttributes<HTMLLabelElement>;\n onClear?: VoidFunction;\n}\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n (\n {\n className,\n disabled,\n startElement,\n endElement,\n error,\n label,\n hint,\n wide,\n required,\n loading,\n inputClassName,\n labelProps,\n hideEmptyMeta,\n dataQa,\n isClearable,\n onClear,\n placeholder = ' ', //need \"space\" for correct label working\n ...rest\n },\n ref,\n ) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = mergeRefs(inputRef, ref);\n\n return (\n <Input\n dataQa={dataQa}\n required={required}\n wide={wide}\n className={className}\n loading={loading}\n disabled={disabled}\n label={label}\n error={error}\n hint={hint}\n endElement={endElement}\n startElement={startElement}\n labelProps={labelProps}\n hideEmptyMeta={hideEmptyMeta}\n isClearable={isClearable}\n onClear={() => {\n if (typeof onClear === 'function') {\n onClear();\n return;\n }\n\n if (inputRef.current) {\n inputRef.current.value = '';\n }\n }}\n >\n <input\n disabled={disabled}\n className={cn('vchasno-ui-text-input', inputClassName)}\n required={required}\n ref={mergedRef}\n placeholder={placeholder}\n {...rest}\n />\n </Input>\n );\n },\n);\n\nTextInput.displayName = 'TextInput';\n\nexport default TextInput;\n"],"names":["TextInput","React","forwardRef","ref","className","disabled","startElement","endElement","error","label","hint","wide","required","loading","inputClassName","labelProps","hideEmptyMeta","dataQa","isClearable","onClear","placeholder","rest","inputRef","useRef","mergedRef","mergeRefs","Input","current","value","input","cn","displayName"],"mappings":"iIAoBA,IAAMA,EAAYC,WAAAA,EAAAA,EAAMC,UAAU,CAC9B,SAqBIC,CAAAA,CAAAA,CAAAA,EAnBIC,IAAAA,EAAAA,EAAAA,SACAC,CAAAA,EAAAA,EAAAA,QACAC,CAAAA,EAAAA,EAAAA,aACAC,EAAAA,EAAAA,UAAAA,CACAC,EAAAA,EAAAA,KAAAA,CACAC,EAAAA,EAAAA,KAAAA,CACAC,EAAAA,EAAAA,IAAAA,CACAC,IAAAA,IACAC,CAAAA,EAAAA,EAAAA,QACAC,CAAAA,EAAAA,EAAAA,OACAC,CAAAA,EAAAA,EAAAA,cACAC,CAAAA,EAAAA,EAAAA,WACAC,EAAAA,EAAAA,aAAAA,CACAC,EAAAA,EAAAA,MAAAA,CACAC,IAAAA,WACAC,CAAAA,EAAAA,EAAAA,OACAC,CAAAA,EAAAA,EAAAA,WAAAA,CACGC,EAAAA,sXAAAA,EAAAA,CAjBHjB,YACAC,WACAC,eACAC,aACAC,QACAC,QACAC,OACAC,OACAC,WACAC,UACAC,iBACAC,aACAC,gBACAC,SACAC,cACAC,UACAC,gBAKEE,EAAWrB,EAAMsB,MAAM,CAAmB,MAC1CC,EAAYC,EAAUH,EAAUnB,GAEtC,oBACIF,EAACyB,a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