1.5.1 • Published 4 years ago

input-style-one v1.5.1

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

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:

Installation

$ npm install input-style-one

Props

  • @required
    • label - set text above the input tag, placeholder if placeholder not set and used in tooltip header. Set showLabel = false if you need to hide text above input.
    • name - name property of input tag
    • handleChange({name, value, label, isValid} => void) - HandleChange event of input.
      • value - value of input tag
      • name - name of input tag. Used on this.setState(name: value). Not necessary if you use React Hooks
      • label - used only when inputType="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 - return true if input satisfy all rules.
  • @optional

    • layout? - @deprecated. It means that component always keep structure label input. If layout="one", label above input will be hidden, input field will be with icon iconUrl property
    • enableTooltip? - true by default. Enable or dirable left side Popover
    • showLabel? - true by default. Show or hide label text above input.
    • showOptionalLabel? - true by default. Show or hide "optional" text in label no matter required rule is accepted.
    • inputType? - text by default. Available options: select, multi-select, password, textArea, datePicker and numberFormat
    • disabled? - false by default. Set this prop true whenever input should be sidabled
    • autocomplete? - true by default. Set this prop true whenever html autocomplete property should be enabled/disabled
    • placeholder? - equals to label by default.
    • minRows? - minRow prop of text area autosize package. Will be moved to textAreaOptions in the future
    • maxRows? - maxRow prop of text area autosize package. Will be moved to textAreaOptions in the future
    • infoDescription? - pass "Custom information" message to tooltip if needed
    • iconUrl? - use this whenever need to add icon from leftside of input
    • rules - Array of rules where input value should be validated. Available rules:

      • required
      • email
      • card
      • integer
      • float
      • [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, initialMonth

    • selectOptions - all props related to ReactSelect packages. All available props see "react-select" packages. Example: options, value, isClearable
    • numberFormatOptions - 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 😆

1.5.1

4 years ago

1.4.13

4 years ago

1.4.12

4 years ago

1.4.14

4 years ago

1.4.11

4 years ago

1.4.10

4 years ago

1.4.9

4 years ago

1.4.8

4 years ago

1.4.6

4 years ago

1.4.7

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.20

4 years ago

1.2.19

4 years ago

1.2.18

4 years ago

1.2.17

4 years ago

1.2.16

4 years ago

1.2.15

4 years ago

1.2.14

4 years ago

1.2.13

4 years ago

1.2.12

4 years ago

1.2.11

4 years ago

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.31

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago