intelicoreact 0.0.7 → 0.0.8

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.
Files changed (31) hide show
  1. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +20 -19
  2. package/dist/Atomic/FormElements/Input/Input.js +85 -46
  3. package/dist/Atomic/FormElements/Input/Input.stories.js +16 -22
  4. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +18 -43
  5. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +42 -10
  6. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +3 -156
  7. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +11 -9
  8. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +3 -3
  9. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +254 -0
  10. package/dist/Atomic/FormElements/NumericInput/NumericInput.scss +135 -0
  11. package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +121 -0
  12. package/dist/Atomic/UI/Arrow/Arrow.js +6 -6
  13. package/dist/Constants/index.constants.js +8 -0
  14. package/dist/Functions/inputExecutor.js +58 -0
  15. package/package.json +6 -5
  16. package/src/Atomic/FormElements/Dropdown/Dropdown.js +36 -39
  17. package/src/Atomic/FormElements/Input/Input.js +86 -36
  18. package/src/Atomic/FormElements/Input/Input.stories.js +40 -29
  19. package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +187 -214
  20. package/src/Atomic/FormElements/InputDateRange/InputDateRange.scss +42 -10
  21. package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +35 -123
  22. package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +10 -7
  23. package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +2 -2
  24. package/src/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -1
  25. package/src/Atomic/FormElements/NumericInput/NumericInput.js +220 -0
  26. package/src/Atomic/FormElements/NumericInput/NumericInput.scss +135 -0
  27. package/src/Atomic/FormElements/NumericInput/NumericInput.stories.js +94 -0
  28. package/src/Atomic/UI/Arrow/Arrow.js +4 -4
  29. package/src/Constants/index.constants.js +41 -0
  30. package/src/Functions/inputExecutor.js +62 -0
  31. package/src/Functions/utils.js +4 -1
@@ -1,4 +1,4 @@
1
- import React, { /*useEffect,*/ useState } from 'react';
1
+ import React, { /* useEffect, */ useState } from 'react';
2
2
  import InputDateRange from './InputDateRange';
3
3
  import Table from '../Table/Table';
4
4
 
@@ -17,133 +17,45 @@ export default {
17
17
  }
18
18
  };
19
19
 
20
- const tableData = {
21
- header: [
22
- { id: 1, label: 'state' },
23
- { id: 2, label: 'Tags' },
24
- { id: 3, label: 'status' },
25
- { id: 4, label: 'loanAmountApproved' },
26
- { id: 5, label: 'loanAmountRejected' },
27
- { id: 6, label: 'approveRate' },
28
- { id: 7, label: 'actions', type: 'actions' }
29
- ],
30
- rows: [
31
- {
32
- id: 1,
33
- link: { label: 'CA', link: '#s' },
34
- tags: [{ label: 'Label 1' }],
35
- status: { value: '90', status: 'active' },
36
- loanAmountApproved: { value: '$70,000' },
37
- loanAmountRejected: { value: '$30,000' },
38
- approveRate: { value: '70%' }
39
- },
40
- {
41
- id: 2,
42
- link: { label: 'NY', link: '#s' },
43
- advancedTags: [
44
- {
45
- labelLeft: 'home',
46
- labelRight: 'hoods',
47
- active: 3,
48
- pause: 1,
49
- merchants: 5
50
- },
51
- {
52
- labelRight: 'jewelry',
53
- active: 3,
54
- pause: 1,
55
- merchants: 5
56
- },
57
- {
58
- labelLeft: 'home',
59
- labelRight: 'improvement',
60
- active: 0,
61
- pause: 0,
62
- warnLeft: true,
63
- warnLeftMsg: 'landerNotIncluded',
64
- warnRightMsg: 'noMerchants'
65
- },
66
- {
67
- labelLeft: 'home',
68
- labelRight: 'hoods',
69
- active: 3,
70
- pause: 1,
71
- merchants: 5
72
- },
73
- {
74
- labelRight: 'jewelry',
75
- active: 3,
76
- pause: 1,
77
- merchants: 5
78
- }
79
- ],
80
- status: { label: 'Active', className: 'color--green-haze' },
81
- loanAmountApproved: { value: '$3,000' },
82
- loanAmountRejected: { value: '$7,000' },
83
- approveRate: { value: '30%' }
84
- },
85
- {
86
- id: 3,
87
- link: { label: 'NH', link: '#s' },
88
- tags: [{ label: 'Label 1' }, { label: 'Label 2' }, { label: 'Label 3' }],
89
- status: { status: 'error' },
90
- loanAmountApproved: { value: '$70,000' },
91
- loanAmountRejected: { value: '$30,000' },
92
- approveRate: { value: '70%' }
93
- }
94
- ]
95
- };
96
-
97
20
  const Template = args => {
98
- const { dateRange, ...restOfProps } = args;
99
- const [value, setValue] = useState(dateRange);
100
-
101
- const [state, setState] = useState(tableData);
102
-
103
- const rowsWithActions = state?.rows?.map(row => ({
104
- ...row,
105
- actions: row.isDeleted ? [{ type: 'undo' }] : [{ type: 'download' }, { type: 'edit' }, { type: 'delete' }]
106
- }));
107
-
108
- // useEffect(() => console.log(value), [value]);
109
-
110
- // return <InputDateRange {...restOfProps} value={value} onChange={setValue} />;
111
- return (
112
- <div>
113
- <div className="mb20">
114
- <InputDateRange {...restOfProps} value={value} onChange={setValue} />
115
- </div>
116
- <div>
117
- <Table header={state.header} rows={rowsWithActions} onChange={setState} />
118
- </div>
21
+ const { dateRange, ...restOfProps } = args;
22
+ const [value, setValue] = useState(dateRange);
23
+ // useEffect(() => console.log(value), [value]);
24
+
25
+ // return <InputDateRange {...restOfProps} value={value} onChange={setValue} />;
26
+ return (
27
+ <div>
28
+ <div className="mb20">
29
+ <InputDateRange {...restOfProps} value={value} onChange={setValue} />
119
30
  </div>
120
- );
31
+ </div>
32
+ );
121
33
  };
122
34
 
123
35
  export const InputDateRangeTemplate = Template.bind({});
124
36
 
125
37
  InputDateRangeTemplate.args = {
126
- txt: {},
127
- buttonsTypes: {
128
- // apply: 'ellipse-apply',
129
- cancel: 'bark-outline'
130
- },
131
- label: 'Date Range',
132
- dateRange: { intervalKey: 'today'},
133
- id: 'anyToggleButtonId',
134
- className: 'anyExternalContainerClassName',
135
- error: false,
136
- disabled: false,
137
- isHoverable: false,
138
- // short: true,
139
- isCompact: false,
140
- // isFocused: true,
141
- isIntervalsHidden: false,
142
- isCompareHidden: true,
143
- hideArrows: false,
144
- isOptionsRight: false,
145
- isShortWeekNames: false
146
- // limitRange,
147
- // isUseAbs,
148
- // absTooltip
38
+ txt: {},
39
+ buttonsTypes: {
40
+ // apply: 'ellipse-apply',
41
+ cancel: 'bark-outline'
42
+ },
43
+ label: 'Date Range',
44
+ dateRange: { intervalKey: 'today' },
45
+ id: 'anyToggleButtonId',
46
+ className: 'anyExternalContainerClassName',
47
+ error: false,
48
+ disabled: false,
49
+ isHoverable: false,
50
+ // short: true,
51
+ isCompact: false,
52
+ // isFocused: true,
53
+ isIntervalsHidden: false,
54
+ isCompareHidden: true,
55
+ hideArrows: false,
56
+ isOptionsRight: false,
57
+ isShortWeekNames: false
58
+ // limitRange,
59
+ // isUseAbs,
60
+ // absTooltip
149
61
  };
@@ -294,20 +294,23 @@ const Datepicker = props => {
294
294
  if (code === 27) doBlur(type, e);
295
295
  };
296
296
 
297
+ const startDateValue = startDate ? moment(startDate).format('ll') : '';
298
+ const endDateValue = endDate ? moment(endDate).subtract(1, 'm').format('ll') : '';
299
+
297
300
  return (
298
301
  <div className={cn('date-picker', className)}>
299
302
  <div className="date-picker__header">
300
303
  <div className="date-picker__inputs-block">
301
304
  <TextInput
302
305
  dataTest="datepicker_start-date-input"
303
- className={cn('date-picker__date-input', { 'date-picker__date-input_active': hoverStatus === 'start' })}
304
- value={isStartFocused ? startDateInput : moment(startDate).format('ll')}
305
- disabled={!startDate}
306
+ className={cn( { 'date-picker__date-input_active': hoverStatus === 'start' })}
307
+ value={isStartFocused ? startDateInput : startDateValue}
306
308
  onChange={value => setStartDateInput(handleDateInputOnChange(value))}
307
309
  onFocus={handleStartDateFocus}
310
+ disabled={!startDate}
308
311
  onBlur={handleStartDateBlur}
309
312
  onKeyUp={(code, e) => handleKeyPressed(code, e, 'start')}
310
- ref={startDateInputRef}
313
+ //ref={startDateInputRef}
311
314
  // mask={moment(startDate).format('L').replace(/[0-9]/g, '9')}
312
315
  />
313
316
  <SelectInput
@@ -322,14 +325,14 @@ const Datepicker = props => {
322
325
  <div className="date-picker__inputs-separator date-picker__header--gray">—</div>
323
326
  <TextInput
324
327
  dataTest="datepicker_end-date-input"
325
- className={cn('date-picker__date-input', { 'date-picker__date-input_active': hoverStatus === 'end' })}
326
- value={isEndFocused ? endDateInput : moment(subtractDay(endDate)).format('ll')}
328
+ className={cn({ 'date-picker__date-input_active': hoverStatus === 'end' })}
329
+ value={isEndFocused ? endDateInput : endDateValue}
327
330
  disabled={!endDate}
328
331
  onChange={value => setEndDateInput(handleDateInputOnChange(value))}
329
332
  onFocus={handleEndDateFocus}
330
333
  onBlur={handleEndDateBlur}
331
334
  onKeyUp={(code, e) => handleKeyPressed(code, e, 'end')}
332
- ref={endDateInputRef}
335
+ //ref={endDateInputRef}
333
336
  />
334
337
  <SelectInput
335
338
  dataTest="datepicker_end-hour-select-input"
@@ -27,9 +27,9 @@ const OpenedPart = React.forwardRef((props, ref) => {
27
27
  toggleOff,
28
28
  isShortWeekNames
29
29
  } = props;
30
-
30
+
31
31
  const items = isCompact ? [...Object.keys(intervals)] : [...Object.keys(intervals), customKey];
32
-
32
+
33
33
  const [activeInterval, setActiveInterval] = useState(actualValues.intervalKey);
34
34
 
35
35
  const handleItemClick = item => {
@@ -15,7 +15,7 @@ const SelectItem = ({ item, label, isActive, onItemClick, onMouseEnter, disabled
15
15
  >
16
16
  {isActive && (
17
17
  <svg className={cn('opened-part__intervals-item-icon-active')} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
18
- <path d="M13.3333 4L5.99999 11.3333L2.66666 8" stroke="black" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
18
+ <path d="M13.3333 4L5.99999 11.3333L2.66666 8" stroke="black" strokeWidth="1.33333" strokeLinecap="round" strokeLinejoin="round"/>
19
19
  </svg>
20
20
  )}
21
21
  {label}
@@ -0,0 +1,220 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import cn from 'classnames';
3
+ import { Minus, Plus } from 'react-feather';
4
+ import InputMask from 'react-input-mask';
5
+ import { KEYBOARD_SERVICE_KEYS } from '../../../Constants/index.constants';
6
+ import { formatInput } from '../../../Functions/inputExecutor';
7
+
8
+ import './NumericInput.scss';
9
+
10
+ const NumericInput = ({
11
+ onChange,
12
+ disabled,
13
+ withDelete,
14
+ numStep = 1,
15
+ min = 0,
16
+ max,
17
+ value,
18
+ placeholder,
19
+ className,
20
+ type = 'number',
21
+ onBlur,
22
+ onFocus,
23
+ onKeyUp,
24
+ mask,
25
+ maskChar,
26
+ formatChars,
27
+ error,
28
+ icon,
29
+ symbolsLimit,
30
+ isNotBlinkErrors,
31
+ blinkTime,
32
+ isPriceInput
33
+ }) => {
34
+ const DEFAULT_BLINK_TIME = 200;
35
+ // STATES
36
+ const [isFocused, setIsFocused] = useState(false);
37
+ const [isEditing, setEditing] = useState(false);
38
+ const inputRef = useRef(null);
39
+ const decRef = useRef(null);
40
+ const incRef = useRef(null);
41
+ const previousValueRef = useRef(value);
42
+ const [isAttemptToChange, setIsAttemptToChange] = useState(false);
43
+ const [isToHighlightError, setIsToHighlightError] = useState(false);
44
+
45
+ const [intMemoVal, setIntMemoVal] = useState(0);
46
+
47
+ const { onlyNumbers } = formatInput;
48
+ const { addCommas, removeComma } = formatInput.priceInput;
49
+
50
+ // HANDLES
51
+ const handle = {
52
+ change: (e) => {
53
+ let inputValue = e.target ? onlyNumbers(e.target.value) : e;
54
+ if (inputValue !== '') {
55
+ inputValue = parseFloat(inputValue) || '';
56
+ if (min && +min > inputValue) {
57
+ inputValue = min;
58
+ } else if (max && +max < inputValue) inputValue = max;
59
+ }
60
+ if (symbolsLimit) {
61
+ inputValue = inputValue.toString().substring(0, +symbolsLimit);
62
+ }
63
+
64
+ setIntMemoVal(parseFloat(inputValue));
65
+ onChange(inputValue.toString());
66
+ },
67
+ toggleEdit: () => {
68
+ setEditing(!isEditing);
69
+ onChange('');
70
+ },
71
+ focus: (e) => {
72
+ setIsFocused(true);
73
+ if (isPriceInput) onChange(removeComma(value));
74
+ if (onFocus) onFocus(e);
75
+ },
76
+ blur: (e) => {
77
+ setIsFocused(false);
78
+ setEditing(false);
79
+ if (isPriceInput) {
80
+ if (!isFinite(value)) {
81
+ value = intMemoVal;
82
+ }
83
+ onChange(addCommas(value));
84
+ }
85
+
86
+ if (onBlur) onBlur(e);
87
+ },
88
+ keyUp: (e) => {
89
+ if (!isNotBlinkErrors) {
90
+ const changedValue = '' + (value ?? '');
91
+ const previousValue = '' + (previousValueRef.current ?? '');
92
+ const currentSet = (() => {
93
+ if (previousValue.length < changedValue.length)
94
+ return value
95
+ .toString()
96
+ .slice(previousValue.length - changedValue.length);
97
+ else return changedValue.toString().includes(e.key) ? e.key : '';
98
+ })();
99
+
100
+ if (
101
+ !KEYBOARD_SERVICE_KEYS.includes(e.key) &&
102
+ changedValue === previousValue
103
+ )
104
+ setIsAttemptToChange(true);
105
+
106
+ if (KEYBOARD_SERVICE_KEYS.includes(e.key) || !currentSet)
107
+ previousValueRef.current = value;
108
+ else previousValueRef.current = previousValue + currentSet[0];
109
+ }
110
+
111
+ if (onKeyUp) onKeyUp(e.keyCode, e.target.value);
112
+ },
113
+ decrement: () => {
114
+ handle.change(intMemoVal - +numStep);
115
+ },
116
+ increment: () => {
117
+ handle.change(intMemoVal + +numStep);
118
+ }
119
+ };
120
+
121
+ const handleClickOutside = (event) => {
122
+ if (
123
+ inputRef.current &&
124
+ !inputRef.current.contains(event.target) &&
125
+ !decRef.current.contains(event.target) &&
126
+ !incRef.current.contains(event.target)
127
+ ) {
128
+ setTimeout(() => {
129
+ inputRef.current.focus();
130
+ inputRef.current.blur();
131
+ }, 0);
132
+ }
133
+ };
134
+
135
+ useEffect(() => {
136
+ if (!isNotBlinkErrors && isAttemptToChange) {
137
+ setIsAttemptToChange(false);
138
+ setIsToHighlightError(true);
139
+ setTimeout(() => {
140
+ setIsToHighlightError(false);
141
+ }, blinkTime || DEFAULT_BLINK_TIME);
142
+ }
143
+ }, [isAttemptToChange]);
144
+
145
+ useEffect(() => {
146
+ document.addEventListener('click', handleClickOutside, true);
147
+ return () =>
148
+ document.removeEventListener('click', handleClickOutside, true);
149
+ }, []);
150
+
151
+ useEffect(() => {
152
+ if (isNaN(intMemoVal)) setIntMemoVal(min || '');
153
+ }, [intMemoVal]);
154
+
155
+ useEffect(() => {
156
+ if (isEditing || isFocused) inputRef.current.focus();
157
+ }, [isEditing, isFocused]);
158
+
159
+ const uniProps = {
160
+ className: `input ${className}`,
161
+ placeholder,
162
+ value: value || '',
163
+ disabled,
164
+ onChange: handle.change,
165
+ onFocus: handle.focus,
166
+ onBlur: handle.blur,
167
+ onKeyUp: handle.keyUp,
168
+ min,
169
+ max,
170
+ ...(maskChar ? { maskChar } : {}),
171
+ ...(formatChars ? { formatChars } : {})
172
+ };
173
+
174
+ function renderInput() {
175
+ return (
176
+ <>
177
+ <input {...uniProps} ref={inputRef} type={type} />
178
+
179
+ <div className='input__nums'>
180
+ <button
181
+ ref={decRef}
182
+ onClick={() => handle.decrement()}
183
+ className={cn(`input__num-btn`, { disabled: +value <= min })}
184
+ >
185
+ <Minus />
186
+ </button>
187
+ <button
188
+ ref={incRef}
189
+ onClick={() => handle.increment()}
190
+ className={cn(`input__num-btn`, { disabled: +value >= max })}
191
+ >
192
+ <Plus />
193
+ </button>
194
+ </div>
195
+ </>
196
+ );
197
+ }
198
+
199
+ return (
200
+ <div
201
+ className={cn(
202
+ `input__wrap`,
203
+ { [`input__wrap_focus`]: isFocused },
204
+ { [`input__wrap_error`]: error || isToHighlightError },
205
+ { [`input__wrap_disabled`]: disabled }
206
+ )}
207
+ >
208
+ {renderInput()}
209
+ {icon}
210
+ {withDelete && (
211
+ <span
212
+ className={cn(`input__close`, { hidden: !value })}
213
+ onClick={handle.toggleEdit}
214
+ />
215
+ )}
216
+ </div>
217
+ );
218
+ };
219
+
220
+ export default NumericInput;
@@ -0,0 +1,135 @@
1
+ .input {
2
+ position: relative;
3
+ word-break: break-all;
4
+ border: none;
5
+ background: none;
6
+ padding: 0 10px;
7
+ width: 100%;
8
+ &::-webkit-outer-spin-button,
9
+ &::-webkit-inner-spin-button {
10
+ -webkit-appearance: none;
11
+ }
12
+
13
+ &__wrap {
14
+ display: flex;
15
+ align-items: center;
16
+ border: 1px solid #e2e5ec;
17
+ box-sizing: border-box;
18
+ background-color: #fff;
19
+ height: 28px;
20
+ border-radius: 4px;
21
+
22
+ &_focus {
23
+ border-color: #6b81dd;
24
+ filter: drop-shadow(0px 0px 4px rgba(93, 120, 255, 0.5));
25
+ }
26
+
27
+ &_disabled {
28
+ background: #f7f8fa;
29
+ opacity: 0.5;
30
+ border-color: #a6acb1;
31
+ pointer-events: none;
32
+ }
33
+
34
+ &_error {
35
+ border-color: #f06d8d;
36
+ }
37
+ }
38
+
39
+ &_disabled {
40
+ background: #f7f8fa;
41
+ opacity: 0.5;
42
+ border-color: #a6acb1;
43
+ pointer-events: none;
44
+ }
45
+
46
+ &_error {
47
+ border-color: #f06d8d;
48
+ }
49
+
50
+ svg {
51
+ margin-right: 4px;
52
+ }
53
+
54
+ &__input {
55
+ width: 100%;
56
+ height: 100%;
57
+ box-sizing: border-box;
58
+ font-size: 13px;
59
+ font-weight: 400;
60
+ color: #1e1e2d;
61
+ border: none;
62
+ padding: 0 5px;
63
+ border-radius: 4px;
64
+ }
65
+
66
+ &__close {
67
+ position: relative;
68
+ opacity: 0.6;
69
+ width: 14px;
70
+ height: 14px;
71
+ background: none;
72
+ cursor: pointer;
73
+ margin-right: 4px;
74
+ visibility: hidden;
75
+ pointer-events: none;
76
+ &:hover {
77
+ opacity: 1;
78
+ }
79
+
80
+ &:before,
81
+ &:after {
82
+ content: '';
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+ right: 0;
87
+ margin: auto;
88
+ height: 14px;
89
+ width: 2px;
90
+ background-color: #9aa0b9;
91
+ }
92
+
93
+ &:before {
94
+ transform: rotate(45deg);
95
+ }
96
+
97
+ &:after {
98
+ transform: rotate(-45deg);
99
+ }
100
+ }
101
+
102
+ &__nums {
103
+ display: flex;
104
+ align-items: center;
105
+ height: 100%;
106
+ }
107
+
108
+ &__num-btn {
109
+ cursor: pointer;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+ height: 100%;
114
+ width: 24px;
115
+ border-left: 1px solid #e2e5ec;
116
+ background: none;
117
+ font-size: 20px;
118
+ user-select: none;
119
+ &.disabled {
120
+ opacity: 0.3;
121
+ }
122
+ svg {
123
+ margin-right: 0;
124
+ }
125
+ }
126
+
127
+ &-label {
128
+ margin-bottom: 5px;
129
+ }
130
+ }
131
+
132
+ .input__wrap:hover .input__close {
133
+ visibility: visible;
134
+ pointer-events: all;
135
+ }
@@ -0,0 +1,94 @@
1
+ import React, { useState } from 'react';
2
+ import { User } from 'react-feather';
3
+ import NumericInput from './NumericInput';
4
+
5
+ global.lng = 'en';
6
+
7
+ export default {
8
+ title: 'Form Elements/NumericInput',
9
+ component: NumericInput,
10
+ argTypes: {
11
+ disabled: {
12
+ description: 'boolean'
13
+ },
14
+ isInitialFocus: {
15
+ description: 'boolean - if true, the input will be focused on mount'
16
+ },
17
+ error: {
18
+ description: 'text - coloring input if is errored'
19
+ },
20
+ isPriceInput: {
21
+ description: 'boolean - if true, the input will be styled as PriceInput'
22
+ },
23
+ withDelete: {
24
+ description: 'boolean - add clear-cross by hover'
25
+ },
26
+ numStep: {
27
+ description: 'number/text - plus/minus buttons factor (default: 1)'
28
+ },
29
+ min: {
30
+ description: 'number/text - minimal number for numeric input'
31
+ },
32
+ max: {
33
+ description: 'number/text - maximal number for numeric input'
34
+ },
35
+ placeholder: {
36
+ description: 'text'
37
+ },
38
+ type: {
39
+ description:
40
+ "'text', 'number', 'password', 'color', 'date', 'datetime-local', 'month', 'time', 'email', 'range'",
41
+ control: {
42
+ type: 'select',
43
+ options: [
44
+ 'text',
45
+ 'number',
46
+ 'password',
47
+ 'color',
48
+ 'date',
49
+ 'datetime-local',
50
+ 'month',
51
+ 'time',
52
+ 'email',
53
+ 'range'
54
+ ]
55
+ }
56
+ },
57
+ icon: { description: 'JSX' },
58
+ value: { description: '(* - required prop)' },
59
+ className: { description: 'string' },
60
+ mask: {
61
+ description:
62
+ 'string: force input to masked https://www.npmjs.com/package/react-input-mask'
63
+ },
64
+ symbolsLimit: {
65
+ description: 'Set limit of symbols in input, overhead will be ignored'
66
+ },
67
+ onBlur: { description: 'custom callback on blur' },
68
+ onFocus: { description: 'custom callback on focus' },
69
+ onKeyUp: { description: 'custom callback on keyup, returns event keyCode' }
70
+ }
71
+ };
72
+
73
+ const Template = (args) => {
74
+ const [value, setValue] = useState('');
75
+ return <NumericInput {...args} value={value} onChange={setValue} />;
76
+ };
77
+
78
+ export const NumericInputTemplate = Template.bind({});
79
+
80
+ NumericInputTemplate.args = {
81
+ type: 'text',
82
+ disabled: false,
83
+ error: '',
84
+ isPriceInput: false,
85
+ mask: '',
86
+ withDelete: true,
87
+ isNumeric: false,
88
+ numStep: 100,
89
+ min: '0',
90
+ max: '15000',
91
+ symbolsLimit: 2,
92
+ placeholder: 'Placeholder',
93
+ icon: <User />
94
+ };