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.
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +20 -19
- package/dist/Atomic/FormElements/Input/Input.js +85 -46
- package/dist/Atomic/FormElements/Input/Input.stories.js +16 -22
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +18 -43
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +42 -10
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +3 -156
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +11 -9
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +3 -3
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +254 -0
- package/dist/Atomic/FormElements/NumericInput/NumericInput.scss +135 -0
- package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +121 -0
- package/dist/Atomic/UI/Arrow/Arrow.js +6 -6
- package/dist/Constants/index.constants.js +8 -0
- package/dist/Functions/inputExecutor.js +58 -0
- package/package.json +6 -5
- package/src/Atomic/FormElements/Dropdown/Dropdown.js +36 -39
- package/src/Atomic/FormElements/Input/Input.js +86 -36
- package/src/Atomic/FormElements/Input/Input.stories.js +40 -29
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +187 -214
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.scss +42 -10
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +35 -123
- package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +10 -7
- package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +2 -2
- package/src/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -1
- package/src/Atomic/FormElements/NumericInput/NumericInput.js +220 -0
- package/src/Atomic/FormElements/NumericInput/NumericInput.scss +135 -0
- package/src/Atomic/FormElements/NumericInput/NumericInput.stories.js +94 -0
- package/src/Atomic/UI/Arrow/Arrow.js +4 -4
- package/src/Constants/index.constants.js +41 -0
- package/src/Functions/inputExecutor.js +62 -0
- package/src/Functions/utils.js +4 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {User} from 'react-feather';
|
|
2
|
+
import { User } from 'react-feather';
|
|
3
3
|
import Input from './Input';
|
|
4
4
|
|
|
5
5
|
global.lng = 'en';
|
|
@@ -9,48 +9,65 @@ export default {
|
|
|
9
9
|
component: Input,
|
|
10
10
|
argTypes: {
|
|
11
11
|
disabled: {
|
|
12
|
-
description: 'boolean'
|
|
12
|
+
description: 'boolean'
|
|
13
13
|
},
|
|
14
14
|
error: {
|
|
15
15
|
description: 'text - coloring input if is errored'
|
|
16
16
|
},
|
|
17
|
+
isPriceInput: {
|
|
18
|
+
description: 'boolean - if true, the input will be styled as PriceInput'
|
|
19
|
+
},
|
|
17
20
|
withDelete: {
|
|
18
21
|
description: 'boolean - add clear-cross by hover'
|
|
19
22
|
},
|
|
20
|
-
|
|
21
|
-
description: 'boolean -
|
|
22
|
-
},
|
|
23
|
-
numStep: {
|
|
24
|
-
description: 'number/text - plus/minus buttons factor (default: 1)'
|
|
23
|
+
isOnlyNumber: {
|
|
24
|
+
description: 'boolean - only numbers'
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
description: '
|
|
26
|
+
isOnlyString: {
|
|
27
|
+
description: 'boolean - only strings'
|
|
28
28
|
},
|
|
29
|
-
|
|
30
|
-
description: '
|
|
29
|
+
isTwoDigitAfterDot: {
|
|
30
|
+
description: 'boolean - only two digits after dot'
|
|
31
31
|
},
|
|
32
32
|
placeholder: {
|
|
33
33
|
description: 'text'
|
|
34
34
|
},
|
|
35
35
|
type: {
|
|
36
|
-
description:
|
|
36
|
+
description:
|
|
37
|
+
"'text', 'number', 'password', 'color', 'date', 'datetime-local', 'month', 'time', 'email', 'range'",
|
|
37
38
|
control: {
|
|
38
39
|
type: 'select',
|
|
39
|
-
options: [
|
|
40
|
+
options: [
|
|
41
|
+
'text',
|
|
42
|
+
'number',
|
|
43
|
+
'password',
|
|
44
|
+
'color',
|
|
45
|
+
'date',
|
|
46
|
+
'datetime-local',
|
|
47
|
+
'month',
|
|
48
|
+
'time',
|
|
49
|
+
'email',
|
|
50
|
+
'range'
|
|
51
|
+
]
|
|
40
52
|
}
|
|
41
53
|
},
|
|
42
54
|
icon: { description: 'JSX' },
|
|
43
55
|
value: { description: '(* - required prop)' },
|
|
44
56
|
className: { description: 'string' },
|
|
45
|
-
mask: {
|
|
46
|
-
|
|
57
|
+
mask: {
|
|
58
|
+
description:
|
|
59
|
+
'string: force input to masked https://www.npmjs.com/package/react-input-mask'
|
|
60
|
+
},
|
|
61
|
+
symbolsLimit: {
|
|
62
|
+
description: 'Set limit of symbols in input, overhead will be ignored'
|
|
63
|
+
},
|
|
47
64
|
onBlur: { description: 'custom callback on blur' },
|
|
48
65
|
onFocus: { description: 'custom callback on focus' },
|
|
49
66
|
onKeyUp: { description: 'custom callback on keyup, returns event keyCode' }
|
|
50
67
|
}
|
|
51
68
|
};
|
|
52
69
|
|
|
53
|
-
const Template = args => {
|
|
70
|
+
const Template = (args) => {
|
|
54
71
|
const [value, setValue] = useState('');
|
|
55
72
|
return <Input {...args} value={value} onChange={setValue} />;
|
|
56
73
|
};
|
|
@@ -59,21 +76,15 @@ export const InputTemplate = Template.bind({});
|
|
|
59
76
|
|
|
60
77
|
InputTemplate.args = {
|
|
61
78
|
type: 'text',
|
|
79
|
+
isOnlyNumber: false,
|
|
80
|
+
isOnlyString: false,
|
|
81
|
+
isPriceInput: false,
|
|
82
|
+
isTwoDigitAfterDot: false,
|
|
62
83
|
disabled: false,
|
|
63
84
|
error: '',
|
|
85
|
+
mask: '',
|
|
64
86
|
withDelete: true,
|
|
65
|
-
|
|
66
|
-
numStep: 1,
|
|
67
|
-
min: '0',
|
|
68
|
-
max: '5',
|
|
87
|
+
symbolsLimit: 255,
|
|
69
88
|
placeholder: 'Placeholder',
|
|
70
|
-
|
|
71
|
-
// maskChar: '_',
|
|
72
|
-
// formatChars: {
|
|
73
|
-
// 'n': '[0-9]',
|
|
74
|
-
// 's': '[A-Za-z]',
|
|
75
|
-
// '*': '[A-Za-z0-9]'
|
|
76
|
-
// },
|
|
77
|
-
icon: <User />,
|
|
78
|
-
symbolsLimit: 225
|
|
89
|
+
icon: <User />
|
|
79
90
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import moment from 'moment-timezone';
|
|
4
4
|
|
|
@@ -7,235 +7,208 @@ import { useClickOutside, useToggle, getActualDateRange, INTERVALS, ALL_TIME_KEY
|
|
|
7
7
|
import OpenedPart from './components/OpenedPart';
|
|
8
8
|
import Arrow from '../../UI/Arrow/Arrow';
|
|
9
9
|
|
|
10
|
-
import './InputDateRange.scss'
|
|
10
|
+
import './InputDateRange.scss';
|
|
11
11
|
|
|
12
12
|
const InputDateRange = props => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const handleChange = input => {
|
|
47
|
-
const newValue = getActualDateRange(input);
|
|
48
|
-
const formatedValue = {
|
|
49
|
-
intervalKey: newValue.intervalKey,
|
|
50
|
-
start: newValue.start ? moment(newValue.start).format('YYYY-MM-DDTHH:mm') : newValue.start,
|
|
51
|
-
end: newValue.end ? moment(newValue.end).format('YYYY-MM-DDTHH:mm') : newValue.end,
|
|
52
|
-
...(newValue.compare ? {compare: newValue.compare} : {}),
|
|
53
|
-
...(newValue.startPrevDate ? {startPrevDate: moment(newValue.startPrevDate).format('YYYY-MM-DDTHH:mm')} : {}),
|
|
54
|
-
...(newValue.endPrevDate ? {endPrevDate: moment(newValue.endPrevDate).format('YYYY-MM-DDTHH:mm')} : {}),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
onChange(formatedValue);
|
|
58
|
-
return formatedValue;
|
|
13
|
+
const {
|
|
14
|
+
txt,
|
|
15
|
+
id,
|
|
16
|
+
label,
|
|
17
|
+
className,
|
|
18
|
+
value,
|
|
19
|
+
onChange = () => {},
|
|
20
|
+
error,
|
|
21
|
+
disabled,
|
|
22
|
+
isHoverable,
|
|
23
|
+
isCompact = false,
|
|
24
|
+
hideArrows = false,
|
|
25
|
+
isOptionsRight,
|
|
26
|
+
isUseAbs,
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
const actualValues = getActualDateRange(value);
|
|
30
|
+
const { isToggled, toggle, toggleOn, toggleOff } = useToggle(false);
|
|
31
|
+
const [current, setCurrent] = useState(actualValues?.intervalKey);
|
|
32
|
+
const [isCompare, setIsCompare] = useState(actualValues?.compare);
|
|
33
|
+
|
|
34
|
+
const ref = !isUseAbs ? useClickOutside(toggleOff) : useRef(null);
|
|
35
|
+
const internalContainerRef = useRef(null);
|
|
36
|
+
|
|
37
|
+
const handleChange = input => {
|
|
38
|
+
const newValue = getActualDateRange(input);
|
|
39
|
+
const formatedValue = {
|
|
40
|
+
intervalKey: newValue.intervalKey,
|
|
41
|
+
start: newValue.start ? moment(newValue.start).format('YYYY-MM-DDTHH:mm') : newValue.start,
|
|
42
|
+
end: newValue.end ? moment(newValue.end).format('YYYY-MM-DDTHH:mm') : newValue.end,
|
|
43
|
+
...(newValue.compare ? { compare: newValue.compare } : {}),
|
|
44
|
+
...(newValue.startPrevDate ? { startPrevDate: moment(newValue.startPrevDate).format('YYYY-MM-DDTHH:mm') } : {}),
|
|
45
|
+
...(newValue.endPrevDate ? { endPrevDate: moment(newValue.endPrevDate).format('YYYY-MM-DDTHH:mm') } : {})
|
|
59
46
|
};
|
|
60
47
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!start || !end) return null;
|
|
48
|
+
onChange(formatedValue);
|
|
49
|
+
return formatedValue;
|
|
50
|
+
};
|
|
65
51
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
endTime !== '00:00' ? `(${endTime})` : ''
|
|
72
|
-
}`;
|
|
73
|
-
|
|
74
|
-
const getClasses = base => cn('date-range-input__range-text', {
|
|
75
|
-
'date-range-input__range-text_little': base.length > SYMBOLS_QUANTITY_IF_TIME_ADDED
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<>
|
|
80
|
-
<span className={getClasses(firstPart)}>
|
|
81
|
-
{firstPart}
|
|
82
|
-
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? '' : ` - `}
|
|
83
|
-
</span>
|
|
84
|
-
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day')
|
|
85
|
-
? null
|
|
86
|
-
:<span className={getClasses(secondPart)}>{secondPart}</span>
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
</>
|
|
90
|
-
)
|
|
52
|
+
const Range = () => {
|
|
53
|
+
const SYMBOLS_QUANTITY_IF_TIME_ADDED = 13;
|
|
54
|
+
if (!actualValues.start && value.start) {
|
|
55
|
+
actualValues.start = value.start;
|
|
56
|
+
actualValues.end = value.end || '';
|
|
91
57
|
}
|
|
58
|
+
const { start, end } = actualValues;
|
|
59
|
+
if (!start || !end) return null;
|
|
92
60
|
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const intervalHoursCount = moment(end).diff(start, 'hours');
|
|
96
|
-
let newEnd, newStart;
|
|
97
|
-
const endHours = moment(end).hours();
|
|
98
|
-
const startHours = moment(start).hours();
|
|
99
|
-
if (direction === 'forward') {
|
|
100
|
-
newStart = moment(end)
|
|
101
|
-
.add(endHours === 0 ? 0 : 1, 'day')
|
|
102
|
-
.hours(startHours)
|
|
103
|
-
.toDate();
|
|
104
|
-
newEnd = moment(newStart).add(intervalHoursCount, 'hours');
|
|
105
|
-
} else {
|
|
106
|
-
newEnd = moment(start)
|
|
107
|
-
.subtract(endHours === 0 ? 0 : 1, 'day')
|
|
108
|
-
.hours(endHours)
|
|
109
|
-
.toDate();
|
|
110
|
-
newStart = moment(newEnd).subtract(intervalHoursCount, 'hours');
|
|
111
|
-
}
|
|
112
|
-
const startPrevDate = moment(newStart).subtract(intervalHoursCount, 'hours').subtract(1, 'seconds');
|
|
113
|
-
const endPrevDate = moment(newEnd).subtract(1, 'seconds');
|
|
114
|
-
handleChange({
|
|
115
|
-
...value,
|
|
116
|
-
intervalKey: getActualDateRange({
|
|
117
|
-
start: newStart,
|
|
118
|
-
end: newEnd,
|
|
119
|
-
})?.intervalKey,
|
|
120
|
-
start: newStart,
|
|
121
|
-
end: newEnd,
|
|
122
|
-
startPrevDate,
|
|
123
|
-
endPrevDate,
|
|
124
|
-
});
|
|
125
|
-
};
|
|
61
|
+
const startTime = moment(start).format('HH:mm');
|
|
62
|
+
const endTime = moment(end).format('HH:mm');
|
|
126
63
|
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
64
|
+
const firstPart = `${moment(start).format('ll')} ${startTime !== '00:00' ? `(${startTime})` : ''}`;
|
|
65
|
+
const secondPart = `${(endTime !== '00:00' ? moment(end) : moment(end).subtract(1, 'days')).format('ll')} ${
|
|
66
|
+
endTime !== '00:00' ? `(${endTime})` : ''
|
|
67
|
+
}`;
|
|
131
68
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// ...props,
|
|
137
|
-
// key: `${actualValues.start}-${actualValues.end}-${actualValues.intervalKey}-${current}-${isCompare}`,
|
|
138
|
-
// actualValues,
|
|
139
|
-
// current,
|
|
140
|
-
// setCurrent,
|
|
141
|
-
// isCompare,
|
|
142
|
-
// setIsCompare,
|
|
143
|
-
// toggleOff,
|
|
144
|
-
// onChange,
|
|
145
|
-
// },
|
|
146
|
-
// clickOutsideCallback: () => toggleOff(),
|
|
147
|
-
// top: internalContainerRef.current?.getBoundingClientRect()?.bottom || 0,
|
|
148
|
-
// left: internalContainerRef.current?.getBoundingClientRect()?.left || 0,
|
|
149
|
-
// }),
|
|
150
|
-
// [isToggled, value, actualValues, current, isCompare],
|
|
151
|
-
// );
|
|
152
|
-
|
|
153
|
-
// useEffect(() => {
|
|
154
|
-
// if (current && isUseAbs && absTooltip) onChange(current, 'absTooltip/props/current');
|
|
155
|
-
// }, [current]);
|
|
156
|
-
|
|
157
|
-
// useEffect(() => {
|
|
158
|
-
// if (isUseAbs) onChange(isToggled ? absData : null, 'absTooltip');
|
|
159
|
-
// }, [isToggled]);
|
|
69
|
+
const getClasses = base =>
|
|
70
|
+
cn('date-range-input__range-text', {
|
|
71
|
+
'date-range-input__range-text_little': base.length > SYMBOLS_QUANTITY_IF_TIME_ADDED
|
|
72
|
+
});
|
|
160
73
|
|
|
161
74
|
return (
|
|
75
|
+
<>
|
|
76
|
+
<span className={getClasses(firstPart)}>
|
|
77
|
+
{firstPart}
|
|
78
|
+
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? '' : ` - `}
|
|
79
|
+
</span>
|
|
80
|
+
{endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? null : (
|
|
81
|
+
<span className={getClasses(secondPart)}>{secondPart}</span>
|
|
82
|
+
)}
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const slideInterval = (direction = 'forward') => {
|
|
88
|
+
const { start, end } = actualValues;
|
|
89
|
+
const intervalHoursCount = moment(end).diff(start, 'hours');
|
|
90
|
+
let newEnd;
|
|
91
|
+
let newStart;
|
|
92
|
+
const endHours = moment(end).hours();
|
|
93
|
+
const startHours = moment(start).hours();
|
|
94
|
+
if (direction === 'forward') {
|
|
95
|
+
newStart = moment(end)
|
|
96
|
+
.add(endHours === 0 ? 0 : 1, 'day')
|
|
97
|
+
.hours(startHours)
|
|
98
|
+
.toDate();
|
|
99
|
+
newEnd = moment(newStart).add(intervalHoursCount, 'hours');
|
|
100
|
+
} else {
|
|
101
|
+
newEnd = moment(start)
|
|
102
|
+
.subtract(endHours === 0 ? 0 : 1, 'day')
|
|
103
|
+
.hours(endHours)
|
|
104
|
+
.toDate();
|
|
105
|
+
newStart = moment(newEnd).subtract(intervalHoursCount, 'hours');
|
|
106
|
+
}
|
|
107
|
+
const startPrevDate = moment(newStart).subtract(intervalHoursCount, 'hours').subtract(1, 'seconds');
|
|
108
|
+
const endPrevDate = moment(newEnd).subtract(1, 'seconds');
|
|
109
|
+
handleChange({
|
|
110
|
+
...value,
|
|
111
|
+
intervalKey: getActualDateRange({
|
|
112
|
+
start: newStart,
|
|
113
|
+
end: newEnd
|
|
114
|
+
})?.intervalKey,
|
|
115
|
+
start: newStart,
|
|
116
|
+
end: newEnd,
|
|
117
|
+
startPrevDate,
|
|
118
|
+
endPrevDate
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const handleArrowClick = type => {
|
|
123
|
+
slideInterval(type === 'right' ? 'forward' : 'back');
|
|
124
|
+
toggleOff();
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
ref={internalContainerRef}
|
|
130
|
+
className={cn('date-range-input', className, {
|
|
131
|
+
'date-range-input_compact': isCompact,
|
|
132
|
+
'date-range-input_hide-arrows': hideArrows,
|
|
133
|
+
'date-range-input_focused': isToggled,
|
|
134
|
+
'date-range-input_error': error,
|
|
135
|
+
'date-range-input_disabled': disabled
|
|
136
|
+
})}
|
|
137
|
+
>
|
|
138
|
+
<span className="date-range-input__label">{label}</span>
|
|
139
|
+
<div
|
|
140
|
+
className="date-range-input__wraper"
|
|
141
|
+
ref={ref}
|
|
142
|
+
onMouseEnter={isHoverable ? toggleOn : () => null}
|
|
143
|
+
onMouseLeave={isHoverable ? toggleOff : () => null}
|
|
144
|
+
>
|
|
162
145
|
<div
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
'date-range-input_hide-arrows': hideArrows,
|
|
167
|
-
'date-range-input_focused': isToggled,
|
|
168
|
-
'date-range-input_error': error,
|
|
169
|
-
'date-range-input_disabled': disabled,
|
|
170
|
-
})}
|
|
146
|
+
className={cn('date-range-input__absolut-wraper', {
|
|
147
|
+
'date-range-input__absolut-wraper_right-position': isOptionsRight
|
|
148
|
+
})}
|
|
171
149
|
>
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
150
|
+
<div className={cn('date-range-input__static-part')}>
|
|
151
|
+
<button
|
|
152
|
+
id={id}
|
|
153
|
+
className={cn('date-range-input__toggle-button')}
|
|
154
|
+
disabled={disabled}
|
|
155
|
+
onClick={!disabled && !isHoverable ? toggle : undefined}
|
|
178
156
|
>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<div className="date-range-input__interval-key">
|
|
190
|
-
<span>
|
|
191
|
-
{(txt?.labels && txt.labels[actualValues?.intervalKey]) ?? (INTERVALS[actualValues?.intervalKey]?.label || CUSTOM_INTERVAL_KEY_TEXT)}
|
|
192
|
-
</span>
|
|
193
|
-
{current !== ALL_TIME_KEY && <span>:</span>}
|
|
194
|
-
</div>
|
|
195
|
-
{!isCompact && <div className={cn('date-range-input__range', {})}><Range /></div>}
|
|
196
|
-
</button>
|
|
197
|
-
{!isCompact && !hideArrows && (
|
|
198
|
-
<div className={cn('date-range-input__arrows-block')}>
|
|
199
|
-
<Arrow
|
|
200
|
-
type="left"
|
|
201
|
-
className="date-range-input__arrow"
|
|
202
|
-
onClick={() => handleArrowClick("left")}
|
|
203
|
-
disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
|
|
204
|
-
/>
|
|
205
|
-
<Arrow
|
|
206
|
-
type="right"
|
|
207
|
-
className="date-range-input__arrow"
|
|
208
|
-
onClick={() => handleArrowClick("right")}
|
|
209
|
-
disabled={
|
|
210
|
-
disabled ||
|
|
211
|
-
actualValues?.intervalKey === ALL_TIME_KEY ||
|
|
212
|
-
actualValues?.intervalKey === 'today' ||
|
|
213
|
-
moment(actualValues?.end)
|
|
214
|
-
.add(moment(actualValues?.end).diff(actualValues?.start, 'hours'), 'hours')
|
|
215
|
-
.isAfter(moment().add(1, 'day').startOf('day'))
|
|
216
|
-
}
|
|
217
|
-
/>
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
|
-
</div>
|
|
221
|
-
{isToggled && !isUseAbs && (
|
|
222
|
-
<OpenedPart
|
|
223
|
-
{...props}
|
|
224
|
-
ref={internalContainerRef}
|
|
225
|
-
actualValues={actualValues}
|
|
226
|
-
current={current}
|
|
227
|
-
setCurrent={setCurrent}
|
|
228
|
-
isCompare={isCompare}
|
|
229
|
-
setIsCompare={setIsCompare}
|
|
230
|
-
toggleOff={toggleOff}
|
|
231
|
-
onChange={handleChange}
|
|
232
|
-
/>
|
|
233
|
-
)}
|
|
157
|
+
<div className="date-range-input__interval-key">
|
|
158
|
+
<span>
|
|
159
|
+
{(txt?.labels && txt.labels[actualValues?.intervalKey]) ??
|
|
160
|
+
(INTERVALS[actualValues?.intervalKey]?.label || CUSTOM_INTERVAL_KEY_TEXT)}
|
|
161
|
+
</span>
|
|
162
|
+
{current !== ALL_TIME_KEY && <span>:</span>}
|
|
163
|
+
</div>
|
|
164
|
+
{!isCompact && (
|
|
165
|
+
<div className={cn('date-range-input__range', {})}>
|
|
166
|
+
<Range />
|
|
234
167
|
</div>
|
|
235
|
-
|
|
236
|
-
|
|
168
|
+
)}
|
|
169
|
+
</button>
|
|
170
|
+
{!isCompact && !hideArrows && (
|
|
171
|
+
<div className={cn('date-range-input__arrows-block')}>
|
|
172
|
+
<Arrow
|
|
173
|
+
type="left"
|
|
174
|
+
className="date-range-input__arrow"
|
|
175
|
+
onClick={() => handleArrowClick('left')}
|
|
176
|
+
disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
|
|
177
|
+
/>
|
|
178
|
+
<Arrow
|
|
179
|
+
type="right"
|
|
180
|
+
className="date-range-input__arrow"
|
|
181
|
+
onClick={() => handleArrowClick('right')}
|
|
182
|
+
disabled={
|
|
183
|
+
disabled ||
|
|
184
|
+
actualValues?.intervalKey === ALL_TIME_KEY ||
|
|
185
|
+
actualValues?.intervalKey === 'today' ||
|
|
186
|
+
moment(actualValues?.end)
|
|
187
|
+
.add(moment(actualValues?.end).diff(actualValues?.start, 'hours'), 'hours')
|
|
188
|
+
.isAfter(moment().add(1, 'day').startOf('day'))
|
|
189
|
+
}
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
)}
|
|
193
|
+
</div>
|
|
194
|
+
{isToggled && !isUseAbs && (
|
|
195
|
+
<OpenedPart
|
|
196
|
+
{...props}
|
|
197
|
+
ref={internalContainerRef}
|
|
198
|
+
actualValues={actualValues}
|
|
199
|
+
current={current}
|
|
200
|
+
setCurrent={setCurrent}
|
|
201
|
+
isCompare={isCompare}
|
|
202
|
+
setIsCompare={setIsCompare}
|
|
203
|
+
toggleOff={toggleOff}
|
|
204
|
+
onChange={handleChange}
|
|
205
|
+
/>
|
|
206
|
+
)}
|
|
237
207
|
</div>
|
|
238
|
-
|
|
208
|
+
</div>
|
|
209
|
+
{error && <span className="date-range-input__error-block">{error}</span>}
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
239
212
|
};
|
|
240
213
|
|
|
241
214
|
export default React.memo(InputDateRange);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import "../../node_modules/anme/scss/anme-mixins-media";
|
|
2
|
+
|
|
1
3
|
:root {
|
|
2
4
|
--input-height: 28px;
|
|
3
5
|
--label-line-height: 16px;
|
|
@@ -11,14 +13,14 @@
|
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
.date-range-input {
|
|
14
|
-
position: relative;
|
|
16
|
+
/*position: relative;
|
|
15
17
|
width: 335px;
|
|
16
|
-
height: calc(var(--input-height) + var(--label-line-height));
|
|
18
|
+
//height: calc(var(--input-height) + var(--label-line-height));
|
|
17
19
|
|
|
18
20
|
display: flex;
|
|
19
21
|
flex-flow: column nowrap;
|
|
20
22
|
justify-content: flex-end;
|
|
21
|
-
align-items: flex-start
|
|
23
|
+
align-items: flex-start;*/
|
|
22
24
|
|
|
23
25
|
input::-webkit-outer-spin-button,
|
|
24
26
|
input::-webkit-inner-spin-button {
|
|
@@ -205,7 +207,7 @@
|
|
|
205
207
|
border: 1px solid var(--border-color);
|
|
206
208
|
border-radius: var(--border-radius);
|
|
207
209
|
background: #FFFFFF;
|
|
208
|
-
|
|
210
|
+
box-shadow: 0 4px 25px rgba(0, 0, 0, 0.25);
|
|
209
211
|
&_right-position-once-element {
|
|
210
212
|
justify-content: flex-end;
|
|
211
213
|
}
|
|
@@ -222,15 +224,15 @@
|
|
|
222
224
|
position: relative;
|
|
223
225
|
|
|
224
226
|
width: 100%;
|
|
225
|
-
padding:
|
|
227
|
+
padding: 0 20px 0 30px;
|
|
226
228
|
|
|
227
229
|
text-transform: capitalize;
|
|
228
230
|
white-space: nowrap;
|
|
229
231
|
font-style: normal;
|
|
230
232
|
font-weight: 300;
|
|
231
233
|
font-family: var(--font-family);
|
|
232
|
-
font-size:
|
|
233
|
-
line-height:
|
|
234
|
+
font-size: 12px;
|
|
235
|
+
line-height: 24px;
|
|
234
236
|
cursor: pointer;
|
|
235
237
|
|
|
236
238
|
display: flex;
|
|
@@ -242,6 +244,9 @@
|
|
|
242
244
|
// background-color: rgba(128, 128, 128, 0.1);
|
|
243
245
|
background-color: #F2F2F8;
|
|
244
246
|
}
|
|
247
|
+
&_active {
|
|
248
|
+
background: #f2f2f8;
|
|
249
|
+
}
|
|
245
250
|
|
|
246
251
|
&-icon-active {
|
|
247
252
|
position: absolute;
|
|
@@ -293,7 +298,7 @@
|
|
|
293
298
|
|
|
294
299
|
&>div:not(.date-picker__inputs-separator) {
|
|
295
300
|
width: 110px;
|
|
296
|
-
height: 100%;
|
|
301
|
+
min-height: 100%;
|
|
297
302
|
margin-right: 9px;
|
|
298
303
|
|
|
299
304
|
border: 1px solid var(--border-color);
|
|
@@ -323,6 +328,9 @@
|
|
|
323
328
|
.date-picker__inputs-separator {
|
|
324
329
|
margin-right: 9px;
|
|
325
330
|
}
|
|
331
|
+
input {
|
|
332
|
+
font-weight: 300;
|
|
333
|
+
}
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
&__date-input {
|
|
@@ -348,7 +356,7 @@
|
|
|
348
356
|
|
|
349
357
|
&>.dropdown__trigger {
|
|
350
358
|
width: 100%;
|
|
351
|
-
height:
|
|
359
|
+
height: 28px;
|
|
352
360
|
padding-left: 10px;
|
|
353
361
|
padding-right: 15px;
|
|
354
362
|
|
|
@@ -420,7 +428,7 @@
|
|
|
420
428
|
|
|
421
429
|
font-size: calc(var(--font-size) + 2px);
|
|
422
430
|
line-height: calc(var(--line-height) + 4px);
|
|
423
|
-
|
|
431
|
+
|
|
424
432
|
font-style: normal;
|
|
425
433
|
font-weight: 500;
|
|
426
434
|
|
|
@@ -592,3 +600,27 @@
|
|
|
592
600
|
height: 100%;
|
|
593
601
|
}
|
|
594
602
|
}
|
|
603
|
+
|
|
604
|
+
@include lgDown {
|
|
605
|
+
.opened-part__intervals-list {
|
|
606
|
+
display: none;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
@include mdDown {
|
|
611
|
+
.date-picker__inputs-block {
|
|
612
|
+
flex-flow: wrap;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.date-picker__header {
|
|
616
|
+
flex-flow: row wrap
|
|
617
|
+
}
|
|
618
|
+
.date-picker__calendars-wrapper {
|
|
619
|
+
display: block;
|
|
620
|
+
margin: auto;
|
|
621
|
+
}
|
|
622
|
+
.date-picker__calendars .range-calendar {
|
|
623
|
+
margin: 0!important;
|
|
624
|
+
width: 100%;
|
|
625
|
+
}
|
|
626
|
+
}
|