intelicoreact 0.0.64 → 0.0.72

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 (89) hide show
  1. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +6 -2
  2. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +91 -60
  3. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +2 -1
  4. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +48 -17
  5. package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +21 -3
  6. package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +22 -6
  7. package/dist/Atomic/FormElements/Input/Input.js +15 -4
  8. package/dist/Atomic/FormElements/Input/Input.stories.js +7 -1
  9. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +17 -50
  10. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +98 -73
  11. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +5 -157
  12. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +17 -12
  13. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +5 -3
  14. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +3 -3
  15. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +7 -7
  16. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +7 -2
  17. package/dist/Atomic/FormElements/Table/Table.scss +1 -1
  18. package/dist/Atomic/FormElements/Textarea/Textarea.scss +1 -1
  19. package/dist/Atomic/MainMenu/MainMenu.scss +2 -2
  20. package/dist/Atomic/UI/Accordion/Accordion.scss +2 -2
  21. package/dist/Atomic/UI/Arrow/Arrow.js +7 -8
  22. package/dist/Atomic/UI/Calendar/Calendar.js +3 -2
  23. package/dist/Atomic/UI/Calendar/Calendar.stories.js +3 -2
  24. package/dist/Atomic/UI/Status/Status.scss +1 -1
  25. package/dist/Molecular/Datepicker/Datepicker.js +451 -0
  26. package/dist/Molecular/Datepicker/Datepicker.scss +8 -0
  27. package/dist/Molecular/Datepicker/Datepicker.stories.js +44 -0
  28. package/dist/Molecular/Datepicker/components/Calendar.js +156 -0
  29. package/dist/scss/_vars.scss +3 -1
  30. package/dist/scss/main.scss +1 -1
  31. package/package.json +6 -4
  32. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.js +12 -2
  33. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +91 -60
  34. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +4 -3
  35. package/src/Atomic/FormElements/Dropdown/Dropdown.js +53 -19
  36. package/src/Atomic/FormElements/Dropdown/Dropdown.scss +21 -3
  37. package/src/Atomic/FormElements/Dropdown/Dropdown.stories.js +28 -15
  38. package/src/Atomic/FormElements/Input/Input.js +4 -0
  39. package/src/Atomic/FormElements/Input/Input.stories.js +7 -1
  40. package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +187 -220
  41. package/src/Atomic/FormElements/InputDateRange/InputDateRange.scss +98 -73
  42. package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +35 -122
  43. package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +14 -8
  44. package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +6 -4
  45. package/src/Atomic/FormElements/InputDateRange/components/SelectItem.js +1 -1
  46. package/src/Atomic/FormElements/InputDateRange/dependencies.js +6 -6
  47. package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.js +5 -2
  48. package/src/Atomic/FormElements/Table/Table.scss +1 -1
  49. package/src/Atomic/FormElements/Textarea/Textarea.scss +1 -1
  50. package/src/Atomic/MainMenu/MainMenu.scss +2 -2
  51. package/src/Atomic/UI/Accordion/Accordion.scss +2 -2
  52. package/src/Atomic/UI/Arrow/Arrow.js +5 -5
  53. package/src/Atomic/UI/Calendar/Calendar.js +2 -2
  54. package/src/Atomic/UI/Calendar/Calendar.stories.js +2 -1
  55. package/src/Atomic/UI/Status/Status.scss +1 -1
  56. package/src/Molecular/Datepicker/Datepicker.js +346 -0
  57. package/src/Molecular/Datepicker/Datepicker.scss +8 -0
  58. package/src/Molecular/Datepicker/Datepicker.stories.js +27 -0
  59. package/src/Molecular/Datepicker/components/Calendar.js +118 -0
  60. package/src/scss/_vars.scss +3 -1
  61. package/src/scss/main.scss +1 -1
  62. package/dist/scss/anme/_anme-bootstrap-grid.scss +0 -748
  63. package/dist/scss/anme/_anme-elements.scss +0 -269
  64. package/dist/scss/anme/_anme-grid.scss +0 -111
  65. package/dist/scss/anme/_anme-justify.scss +0 -111
  66. package/dist/scss/anme/_anme-mixins-media.scss +0 -116
  67. package/dist/scss/anme/_anme-mixins.scss +0 -166
  68. package/dist/scss/anme/_anme-normalize.scss +0 -8
  69. package/dist/scss/anme/_anme-overall.scss +0 -34
  70. package/dist/scss/anme/_anme-padding-margins.scss +0 -419
  71. package/dist/scss/anme/_anme-table.scss +0 -81
  72. package/dist/scss/anme/_anme-theme.scss +0 -275
  73. package/dist/scss/anme/_anme-vars.scss +0 -91
  74. package/dist/scss/anme/_code-styling.scss +0 -23
  75. package/dist/scss/anme/styles.scss +0 -12
  76. package/src/scss/anme/_anme-bootstrap-grid.scss +0 -748
  77. package/src/scss/anme/_anme-elements.scss +0 -269
  78. package/src/scss/anme/_anme-grid.scss +0 -111
  79. package/src/scss/anme/_anme-justify.scss +0 -111
  80. package/src/scss/anme/_anme-mixins-media.scss +0 -116
  81. package/src/scss/anme/_anme-mixins.scss +0 -166
  82. package/src/scss/anme/_anme-normalize.scss +0 -8
  83. package/src/scss/anme/_anme-overall.scss +0 -34
  84. package/src/scss/anme/_anme-padding-margins.scss +0 -419
  85. package/src/scss/anme/_anme-table.scss +0 -81
  86. package/src/scss/anme/_anme-theme.scss +0 -275
  87. package/src/scss/anme/_anme-vars.scss +0 -91
  88. package/src/scss/anme/_code-styling.scss +0 -23
  89. package/src/scss/anme/styles.scss +0 -12
@@ -7,35 +7,48 @@ export default {
7
7
  component: Dropdown,
8
8
  argTypes: {
9
9
  className: {
10
- description: 'string'
10
+ description: 'string',
11
11
  },
12
- value: { description: 'string - current option'},
12
+ value: { description: 'string - current option' },
13
13
  isSearchable: {
14
14
  description: 'boolean - enable search',
15
15
  },
16
- onChange: { description: 'callback return selected value'}
17
- }
16
+ onChange: { description: 'callback return selected value' },
17
+ entity: {
18
+ description: 'string',
19
+ },
20
+ },
21
+ };
22
+
23
+ const buttonStyles={
24
+ border: 'solid 1px #000',
25
+ padding: '5px'
18
26
  };
19
27
 
20
- const Template = args => {
28
+ const Template = (args) => {
21
29
  const [value, setValue] = useState('');
22
30
  return (
23
- <div style={{ width: 200 }}>
24
- <Dropdown {...args} value={value} onChange={setValue} />
25
- </div>
31
+ <>
32
+ <div style={{ width: 200 }}>
33
+ <Dropdown {...args} value={value} onChange={setValue} />
34
+ </div>
35
+ <button style={buttonStyles} className='mt10' onClick={() => {console.log('click!'); setValue('')}} >Reset</button>
36
+ </>
26
37
  );
27
38
  };
28
39
 
29
40
  export const DropdownTemplate = Template.bind({});
30
41
 
31
42
  DropdownTemplate.args = {
43
+ entity: 'entity',
44
+ value: 'drop6',
32
45
  placeholder: 'Placeholder',
33
46
  isSearchable: true,
34
47
  options: [
35
- { label: 'Dropdown1', value: 'drop1', className: 'status status--approved' },
36
48
  { label: 'Dropdown2', value: 'drop2' },
37
49
  { label: 'Dropdown3', value: 'drop3', disabled: true },
38
50
  { label: 'Dropdown4', value: 'drop4' },
51
+ { label: 'Dropdown1', value: 'drop1', className: 'status status--approved' },
39
52
  { label: 'Dropdown5', value: 'drop5' },
40
53
  { label: 'Dropdown6', value: 'drop6' },
41
54
  {
@@ -43,17 +56,17 @@ DropdownTemplate.args = {
43
56
  items: [
44
57
  { label: 'Group 11', value: 'group11' },
45
58
  { label: 'Group 12', value: 'group12', disabled: true },
46
- { label: 'Group 13', value: 'group13' }
47
- ]
59
+ { label: 'Group 13', value: 'group13' },
60
+ ],
48
61
  },
49
62
  {
50
63
  label: 'Some Group 2',
51
64
  items: [
52
65
  { label: 'Group 21', value: 'group21' },
53
66
  { label: 'Group 22', value: 'group22' },
54
- { label: 'Group 23', value: 'group23' }
55
- ]
56
- }
67
+ { label: 'Group 23', value: 'group23' },
68
+ ],
69
+ },
57
70
  ],
58
- error: ''
71
+ error: '',
59
72
  };
@@ -21,6 +21,8 @@ const Input = ({
21
21
  onFocus,
22
22
  onKeyUp,
23
23
  mask,
24
+ maskChar,
25
+ formatChars,
24
26
  error,
25
27
  icon,
26
28
  symbolsLimit,
@@ -72,6 +74,8 @@ const Input = ({
72
74
  onKeyUp: handle.keyUp,
73
75
  min,
74
76
  max,
77
+ ...(maskChar ? { maskChar } : {}),
78
+ ...(formatChars ? { formatChars } : {}),
75
79
  };
76
80
 
77
81
  function renderInput() {
@@ -67,7 +67,13 @@ InputTemplate.args = {
67
67
  min: '0',
68
68
  max: '5',
69
69
  placeholder: 'Placeholder',
70
- mask: '',
70
+ // mask: 'nnnnn0129',
71
+ // maskChar: '_',
72
+ // formatChars: {
73
+ // 'n': '[0-9]',
74
+ // 's': '[A-Za-z]',
75
+ // '*': '[A-Za-z0-9]'
76
+ // },
71
77
  icon: <User />,
72
78
  symbolsLimit: 225
73
79
  };
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useRef, useMemo } from 'react';
1
+ import React, { useState, useEffect, useRef } from 'react';
2
2
  import cn from 'classnames';
3
3
  import moment from 'moment-timezone';
4
4
 
@@ -7,241 +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
- const {
14
- txt,
15
- id,
16
- label,
17
- className,
18
- buttonsTypes,
19
- value,
20
- onChange = () => {},
21
- error,
22
- disabled,
23
- isHoverable,
24
- short,
25
- isCompact = false,
26
- // isFocused = false,
27
- isIntervalsHidden = false,
28
- isCompareHidden = false,
29
- hideArrows = false,
30
- isOptionsRight,
31
- limitRange,
32
- isUseAbs,
33
- absTooltip,
34
- } = props;
35
-
36
- const actualValues = getActualDateRange(value);
37
- const { isToggled, toggle, toggleOn, toggleOff } = useToggle(false);
38
- const [current, setCurrent] = useState(actualValues?.intervalKey);
39
- const [isCompare, setIsCompare] = useState(actualValues?.compare);
40
-
41
- const ref = !isUseAbs ? useClickOutside(toggleOff) : useRef(null);
42
- const internalContainerRef = useRef(null);
43
- const isEndDateNearFuture = moment(actualValues?.end).isSameOrAfter(moment());
44
-
45
- const handleChange = input => {
46
- const newValue = getActualDateRange(input);
47
- const formatedValue = {
48
- intervalKey: newValue.intervalKey,
49
- start: newValue.start ? moment(newValue.start).format('YYYY-MM-DDTHH:mm') : newValue.start,
50
- end: newValue.end ? moment(newValue.end).format('YYYY-MM-DDTHH:mm') : newValue.end,
51
- ...(newValue.compare ? {compare: newValue.compare} : {}),
52
- ...(newValue.startPrevDate ? {startPrevDate: moment(newValue.startPrevDate).format('YYYY-MM-DDTHH:mm')} : {}),
53
- ...(newValue.endPrevDate ? {endPrevDate: moment(newValue.endPrevDate).format('YYYY-MM-DDTHH:mm')} : {}),
54
- };
55
-
56
- onChange(formatedValue);
57
- 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') } : {})
58
46
  };
59
47
 
60
- const Range = () => {
61
- const SYMBOLS_QUANTITY_IF_TIME_ADDED = 13;
62
- const { start, end } = actualValues;
63
- if (!start || !end) return null;
48
+ onChange(formatedValue);
49
+ return formatedValue;
50
+ };
64
51
 
65
- const startTime = moment(start).format('HH:mm');
66
- const endTime = moment(end).format('HH:mm');
52
+ useEffect(() => {
53
+ handleChange({ ...value });
54
+ }, []);
67
55
 
68
- const firstPart = `${moment(start).format('ll')} ${startTime !== '00:00' ? `(${startTime})` : ''}`;
69
- const secondPart = `${(endTime !== '00:00' ? moment(end) : moment(end).subtract(1, 'days')).format('ll')} ${
70
- endTime !== '00:00' ? `(${endTime})` : ''
71
- }`;
56
+ const Range = () => {
57
+ const SYMBOLS_QUANTITY_IF_TIME_ADDED = 13;
58
+ const { start, end } = actualValues;
59
+ if (!start || !end) return null;
72
60
 
73
- const getClasses = base => cn('date-range-input__range-text', {
74
- 'date-range-input__range-text_little': base.length > SYMBOLS_QUANTITY_IF_TIME_ADDED
75
- });
61
+ const startTime = moment(start).format('HH:mm');
62
+ const endTime = moment(end).format('HH:mm');
76
63
 
77
- return (
78
- <>
79
- <span className={getClasses(firstPart)}>
80
- {firstPart}
81
- {endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day') ? '' : ` - `}
82
- </span>
83
- {endTime === '00:00' && moment(end).isSame(moment(start).add(1, 'days'), 'day')
84
- ? null
85
- :<span className={getClasses(secondPart)}>{secondPart}</span>
86
-
87
- }
88
- </>
89
- )
90
- }
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
+ }`;
91
68
 
92
- const slideInterval = (direction = 'forward') => {
93
- const { start, end } = actualValues;
94
- const intervalHoursCount = moment(end).diff(start, 'hours');
95
- let newEnd, newStart;
96
- const endHours = moment(end).hours();
97
- const startHours = moment(start).hours();
98
- if (direction === 'forward') {
99
- newStart = moment(end)
100
- .add(endHours === 0 ? 0 : 1, 'day')
101
- .hours(startHours)
102
- .toDate();
103
- newEnd = moment(newStart).add(intervalHoursCount, 'hours');
104
- } else {
105
- newEnd = moment(start)
106
- .subtract(endHours === 0 ? 0 : 1, 'day')
107
- .hours(endHours)
108
- .toDate();
109
- newStart = moment(newEnd).subtract(intervalHoursCount, 'hours');
110
- }
111
- const startPrevDate = moment(newStart).subtract(intervalHoursCount, 'hours').subtract(1, 'seconds');
112
- const endPrevDate = moment(newEnd).subtract(1, 'seconds');
113
- handleChange({
114
- ...value,
115
- intervalKey: getActualDateRange({
116
- start: newStart,
117
- end: newEnd,
118
- })?.intervalKey,
119
- start: newStart,
120
- end: newEnd,
121
- startPrevDate,
122
- endPrevDate,
123
- });
124
- };
125
-
126
- const handleArrowClick = type => {
127
- slideInterval(type === 'right' ? 'forward' : 'back');
128
- toggleOff();
129
- };
130
-
131
- // const absData = useMemo(
132
- // () => ({
133
- // body: OpenedPart,
134
- // props: {
135
- // ...props,
136
- // key: `${actualValues.start}-${actualValues.end}-${actualValues.intervalKey}-${current}-${isCompare}`,
137
- // actualValues,
138
- // current,
139
- // setCurrent,
140
- // isCompare,
141
- // setIsCompare,
142
- // toggleOff,
143
- // onChange,
144
- // },
145
- // clickOutsideCallback: () => toggleOff(),
146
- // top: internalContainerRef.current?.getBoundingClientRect()?.bottom || 0,
147
- // left: internalContainerRef.current?.getBoundingClientRect()?.left || 0,
148
- // }),
149
- // [isToggled, value, actualValues, current, isCompare],
150
- // );
151
-
152
- // useEffect(() => {
153
- // if (current && isUseAbs && absTooltip) onChange(current, 'absTooltip/props/current');
154
- // }, [current]);
155
-
156
- // useEffect(() => {
157
- // if (isUseAbs) onChange(isToggled ? absData : null, 'absTooltip');
158
- // }, [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
+ });
159
73
 
160
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
+ >
161
145
  <div
162
- ref={internalContainerRef}
163
- className={cn('date-range-input', className, {
164
- 'date-range-input_compact': isCompact,
165
- 'date-range-input_hide-arrows': hideArrows,
166
- 'date-range-input_focused': isToggled,
167
- 'date-range-input_error': error,
168
- 'date-range-input_disabled': disabled,
169
- })}
146
+ className={cn('date-range-input__absolut-wraper', {
147
+ 'date-range-input__absolut-wraper_right-position': isOptionsRight
148
+ })}
170
149
  >
171
- <span className="date-range-input__label" >{label}</span>
172
- <div
173
- className="date-range-input__wraper"
174
- ref={ref}
175
- onMouseEnter={isHoverable && toggleOn}
176
- onMouseLeave={isHoverable && toggleOff}
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}
177
156
  >
178
- <div className={cn('date-range-input__absolut-wraper', {
179
- 'date-range-input__absolut-wraper_right-position': isOptionsRight,
180
- })}>
181
- <div className={cn('date-range-input__static-part')}>
182
- <button
183
- id={id}
184
- className={cn('date-range-input__toggle-button')}
185
- // className={cn(
186
- // 'date-range-input__toggle-button',
187
- // { 'form-select__input--disabled': disabled },
188
- // { 'form-select__input--opened': isToggled },
189
- // { 'form-select__input--focused': isToggled },
190
- // className,
191
- // )}
192
- disabled={disabled}
193
- onClick={!disabled && !isHoverable ? toggle : undefined}
194
- >
195
- <div className="date-range-input__interval-key">
196
- <span>
197
- {(txt?.labels && txt.labels[actualValues?.intervalKey]) ?? (INTERVALS[actualValues?.intervalKey]?.label || CUSTOM_INTERVAL_KEY_TEXT)}
198
- </span>
199
- {current !== ALL_TIME_KEY && <span>:</span>}
200
- </div>
201
- {!isCompact && <div className={cn('date-range-input__range', {})}><Range /></div>}
202
- </button>
203
- {!isCompact && !hideArrows && (
204
- <div className={cn('date-range-input__arrows-block')}>
205
- <Arrow
206
- type="left"
207
- className="date-range-input__arrow"
208
- onClick={() => handleArrowClick("left")}
209
- disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
210
- />
211
- <Arrow
212
- type="right"
213
- className="date-range-input__arrow"
214
- onClick={() => handleArrowClick("right")}
215
- disabled={
216
- disabled ||
217
- actualValues?.intervalKey === ALL_TIME_KEY ||
218
- actualValues?.intervalKey === 'today' ||
219
- moment(actualValues?.end)
220
- .add(moment(actualValues?.end).diff(actualValues?.start, 'hours'), 'hours')
221
- .isAfter(moment().add(1, 'day').startOf('day'))
222
- }
223
- />
224
- </div>
225
- )}
226
- </div>
227
- {isToggled && !isUseAbs && (
228
- <OpenedPart
229
- {...props}
230
- ref={internalContainerRef}
231
- actualValues={actualValues}
232
- current={current}
233
- setCurrent={setCurrent}
234
- isCompare={isCompare}
235
- setIsCompare={setIsCompare}
236
- toggleOff={toggleOff}
237
- onChange={handleChange}
238
- />
239
- )}
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 />
240
167
  </div>
241
- </div>
242
- {error && <span className="date-range-input__error-block">{error}</span>}
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
+ )}
243
207
  </div>
244
- );
208
+ </div>
209
+ {error && <span className="date-range-input__error-block">{error}</span>}
210
+ </div>
211
+ );
245
212
  };
246
213
 
247
214
  export default React.memo(InputDateRange);