input-style-one v1.5.1
WExport InputStyleOne
React-based input component, espessially created for WExport 2.0 project. 🚀
This component include following input types based on other popular npm packages:
- TEXT INPUT - simple input with wexport based styles
- TEXTAREA - thanks to author of npm package "react-textarea-autosize"
- SELECT - thanks to author of npm package "react-select"
- NUMBER FORMAT - thanks to author of npm package "react-number-format"
- DAY PICKER - thanks to author of npm package "react-day-picker"
Installation
$ npm install input-style-oneProps
@requiredlabel- set text above the input tag, placeholder ifplaceholdernot set and used in tooltip header. SetshowLabel = falseif you need to hide text above input.name- name property of input taghandleChange({name, value, label, isValid} => void)- HandleChange event of input.value- value of input tagname- name of input tag. Used on this.setState(name: value). Not necessary if you use React Hookslabel- used only wheninputType="select". this value return the select component label. Sometimes it is necessary to store the label of selected value. Example:selectOptions: [{value:1, label: "Option One"}, {value: "2", label: "Options Two"}]isValid- returntrueif input satisfy all rules.
@optionallayout?-@deprecated. It means that component always keep structurelabelinput. Iflayout="one",labelaboveinputwill be hidden,inputfield will be with iconiconUrlpropertyenableTooltip?-trueby default. Enable or dirable left side PopovershowLabel?-trueby default. Show or hidelabeltext above input.showOptionalLabel?-trueby default. Show or hide "optional" text inlabelno matterrequiredrule is accepted.inputType?-textby default. Available options:select,multi-select,password,textArea,datePickerandnumberFormatdisabled?-falseby default. Set this proptruewhenever input should be sidabledautocomplete?-trueby default. Set this proptruewhenever htmlautocompleteproperty should be enabled/disabledplaceholder?- equals tolabelby default.minRows?- minRow prop of text area autosize package. Will be moved totextAreaOptionsin the futuremaxRows?- maxRow prop of text area autosize package. Will be moved totextAreaOptionsin the futureinfoDescription?- pass "Custom information" message to tooltip if needediconUrl?- use this whenever need to add icon from leftside of inputrules- Array of rules where input value should be validated. Available rules:requiredemailcardintegerfloat[maxString, <integer>]- max symbols on input value[compare, <any>]- compare input value with definite variable. Example:repeatPassword[minAmountValue, <number>]- specific rule where minimal amount validated[lte, <number>]- check whenever input value less or equal than specific number[gte, <number>]- check whenever input value greater or equal than specific number[custom, <function>]- check whenever custom validation is realized. example:const validateUsernameExist = (value) => { const existUser = "example@example.com" if (value == existUser) { return { isValid: false, description: "This user is already exist in system" } } else { return { isValid: true, description: "All is Fine" } } } ... rules={['required', 'email', ['custom', validateUsernameExist]]}Now we have following rules but they will grow in the future 😆
datePickerOptions- all props related to DayPickerInput packages. All available props see "react-day-picker" package. Example:disabledDays,initialMonthselectOptions- all props related to ReactSelect packages. All available props see "react-select" packages. Example:options,value,isClearablenumberFormatOptions- all props related to NumberFormat packages. All available props see "react-number-format" package. Example:suffix,thousandSeparator,format,mask,type,allowNegative,allowZeroStart
The are a little "demo" how to use InputStyleOne component in project. In basic issues, IT'S RECOMMENDED to use functions (handleChange, isValidFields) described in demo. But if you know better approach, you are welcome :) If not, just do Ctrl+A Ctrl+C Ctrl+V 😆
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago