intelicoreact 0.0.6 → 0.0.7
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/CheckboxInput/CheckboxInput.js +6 -2
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +91 -60
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +2 -1
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +40 -9
- package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +21 -3
- package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +22 -6
- package/dist/Atomic/FormElements/Input/Input.js +15 -4
- package/dist/Atomic/FormElements/Input/Input.stories.js +7 -1
- package/dist/Atomic/FormElements/InputDateRange/{components/InputDateRange.js → InputDateRange.js} +61 -50
- package/dist/Atomic/FormElements/InputDateRange/{components/InputDateRange.scss → InputDateRange.scss} +218 -222
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +11 -5
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +27 -6
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +20 -11
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +14 -6
- package/dist/Atomic/FormElements/InputDateRange/{index.js → dependencies.js} +18 -17
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +7 -2
- package/dist/Atomic/FormElements/Table/Table.scss +1 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.scss +1 -1
- package/dist/Atomic/MainMenu/MainMenu.scss +2 -2
- package/dist/Atomic/UI/Accordion/Accordion.scss +2 -2
- package/dist/Atomic/UI/Arrow/Arrow.scss +0 -3
- package/dist/Atomic/UI/Calendar/Calendar.js +3 -2
- package/dist/Atomic/UI/Calendar/Calendar.stories.js +3 -2
- package/dist/Atomic/UI/Status/Status.scss +1 -1
- package/dist/Molecular/Datepicker/Datepicker.js +451 -0
- package/dist/Molecular/Datepicker/Datepicker.scss +8 -0
- package/dist/Molecular/Datepicker/Datepicker.stories.js +44 -0
- package/dist/{Atomic/FormElements/Calendar → Molecular/Datepicker/components}/Calendar.js +50 -39
- package/dist/scss/_vars.scss +3 -1
- package/dist/scss/main.scss +1 -1
- package/package.json +3 -2
- package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.js +12 -2
- package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +91 -60
- package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +4 -3
- package/src/Atomic/FormElements/Dropdown/Dropdown.js +64 -27
- package/src/Atomic/FormElements/Dropdown/Dropdown.scss +21 -3
- package/src/Atomic/FormElements/Dropdown/Dropdown.stories.js +28 -15
- package/src/Atomic/FormElements/Input/Input.js +4 -0
- package/src/Atomic/FormElements/Input/Input.stories.js +7 -1
- package/src/Atomic/FormElements/InputDateRange/{components/InputDateRange.js → InputDateRange.js} +65 -54
- package/src/Atomic/FormElements/InputDateRange/{components/InputDateRange.scss → InputDateRange.scss} +218 -222
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +9 -2
- package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +42 -27
- package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +11 -6
- package/src/Atomic/FormElements/InputDateRange/components/SelectItem.js +5 -3
- package/src/Atomic/FormElements/InputDateRange/{index.js → dependencies.js} +15 -11
- package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.js +5 -2
- package/src/Atomic/FormElements/Table/Table.scss +1 -1
- package/src/Atomic/FormElements/Textarea/Textarea.scss +1 -1
- package/src/Atomic/MainMenu/MainMenu.scss +2 -2
- package/src/Atomic/UI/Accordion/Accordion.scss +2 -2
- package/src/Atomic/UI/Arrow/Arrow.scss +0 -3
- package/src/Atomic/UI/Calendar/Calendar.js +2 -2
- package/src/Atomic/UI/Calendar/Calendar.stories.js +2 -1
- package/src/Atomic/UI/Status/Status.scss +1 -1
- package/src/Molecular/Datepicker/Datepicker.js +346 -0
- package/src/Molecular/Datepicker/Datepicker.scss +8 -0
- package/src/Molecular/Datepicker/Datepicker.stories.js +27 -0
- package/src/Molecular/Datepicker/components/Calendar.js +118 -0
- package/src/scss/_vars.scss +3 -1
- package/src/scss/main.scss +1 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.scss +0 -543
- package/dist/Atomic/FormElements/Calendar/Calendar.stories.js +0 -33
- package/dist/scss/anme/_anme-bootstrap-grid.scss +0 -748
- package/dist/scss/anme/_anme-elements.scss +0 -269
- package/dist/scss/anme/_anme-grid.scss +0 -111
- package/dist/scss/anme/_anme-justify.scss +0 -111
- package/dist/scss/anme/_anme-mixins-media.scss +0 -116
- package/dist/scss/anme/_anme-mixins.scss +0 -166
- package/dist/scss/anme/_anme-normalize.scss +0 -8
- package/dist/scss/anme/_anme-overall.scss +0 -34
- package/dist/scss/anme/_anme-padding-margins.scss +0 -419
- package/dist/scss/anme/_anme-table.scss +0 -81
- package/dist/scss/anme/_anme-theme.scss +0 -275
- package/dist/scss/anme/_anme-vars.scss +0 -91
- package/dist/scss/anme/_code-styling.scss +0 -23
- package/dist/scss/anme/styles.scss +0 -12
- package/src/scss/anme/_anme-bootstrap-grid.scss +0 -748
- package/src/scss/anme/_anme-elements.scss +0 -269
- package/src/scss/anme/_anme-grid.scss +0 -111
- package/src/scss/anme/_anme-justify.scss +0 -111
- package/src/scss/anme/_anme-mixins-media.scss +0 -116
- package/src/scss/anme/_anme-mixins.scss +0 -166
- package/src/scss/anme/_anme-normalize.scss +0 -8
- package/src/scss/anme/_anme-overall.scss +0 -34
- package/src/scss/anme/_anme-padding-margins.scss +0 -419
- package/src/scss/anme/_anme-table.scss +0 -81
- package/src/scss/anme/_anme-theme.scss +0 -275
- package/src/scss/anme/_anme-vars.scss +0 -91
- package/src/scss/anme/_code-styling.scss +0 -23
- package/src/scss/anme/styles.scss +0 -12
package/src/Atomic/FormElements/InputDateRange/{components/InputDateRange.js → InputDateRange.js}
RENAMED
|
@@ -2,10 +2,10 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import moment from 'moment-timezone';
|
|
4
4
|
|
|
5
|
-
import { useClickOutside, useToggle, getActualDateRange, INTERVALS, ALL_TIME_KEY, CUSTOM_INTERVAL_KEY_TEXT } from '
|
|
5
|
+
import { useClickOutside, useToggle, getActualDateRange, INTERVALS, ALL_TIME_KEY, CUSTOM_INTERVAL_KEY_TEXT } from './dependencies';
|
|
6
6
|
|
|
7
|
-
import OpenedPart from './OpenedPart';
|
|
8
|
-
import Arrow from '
|
|
7
|
+
import OpenedPart from './components/OpenedPart';
|
|
8
|
+
import Arrow from '../../UI/Arrow/Arrow';
|
|
9
9
|
|
|
10
10
|
import './InputDateRange.scss'
|
|
11
11
|
|
|
@@ -15,6 +15,7 @@ const InputDateRange = props => {
|
|
|
15
15
|
id,
|
|
16
16
|
label,
|
|
17
17
|
className,
|
|
18
|
+
buttonsTypes,
|
|
18
19
|
value,
|
|
19
20
|
onChange = () => {},
|
|
20
21
|
error,
|
|
@@ -28,6 +29,7 @@ const InputDateRange = props => {
|
|
|
28
29
|
hideArrows = false,
|
|
29
30
|
isOptionsRight,
|
|
30
31
|
limitRange,
|
|
32
|
+
isShortWeekNames,
|
|
31
33
|
isUseAbs,
|
|
32
34
|
absTooltip,
|
|
33
35
|
} = props;
|
|
@@ -41,6 +43,21 @@ const InputDateRange = props => {
|
|
|
41
43
|
const internalContainerRef = useRef(null);
|
|
42
44
|
const isEndDateNearFuture = moment(actualValues?.end).isSameOrAfter(moment());
|
|
43
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;
|
|
59
|
+
};
|
|
60
|
+
|
|
44
61
|
const Range = () => {
|
|
45
62
|
const SYMBOLS_QUANTITY_IF_TIME_ADDED = 13;
|
|
46
63
|
const { start, end } = actualValues;
|
|
@@ -76,7 +93,6 @@ const InputDateRange = props => {
|
|
|
76
93
|
const slideInterval = (direction = 'forward') => {
|
|
77
94
|
const { start, end } = actualValues;
|
|
78
95
|
const intervalHoursCount = moment(end).diff(start, 'hours');
|
|
79
|
-
console.log(intervalHoursCount);
|
|
80
96
|
let newEnd, newStart;
|
|
81
97
|
const endHours = moment(end).hours();
|
|
82
98
|
const startHours = moment(start).hours();
|
|
@@ -95,7 +111,7 @@ const InputDateRange = props => {
|
|
|
95
111
|
}
|
|
96
112
|
const startPrevDate = moment(newStart).subtract(intervalHoursCount, 'hours').subtract(1, 'seconds');
|
|
97
113
|
const endPrevDate = moment(newEnd).subtract(1, 'seconds');
|
|
98
|
-
|
|
114
|
+
handleChange({
|
|
99
115
|
...value,
|
|
100
116
|
intervalKey: getActualDateRange({
|
|
101
117
|
start: newStart,
|
|
@@ -113,34 +129,34 @@ const InputDateRange = props => {
|
|
|
113
129
|
toggleOff();
|
|
114
130
|
};
|
|
115
131
|
|
|
116
|
-
const absData = useMemo(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
|
|
139
|
-
}, [current]);
|
|
140
|
-
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
|
|
143
|
-
}, [isToggled]);
|
|
132
|
+
// const absData = useMemo(
|
|
133
|
+
// () => ({
|
|
134
|
+
// body: OpenedPart,
|
|
135
|
+
// props: {
|
|
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]);
|
|
144
160
|
|
|
145
161
|
return (
|
|
146
162
|
<div
|
|
@@ -167,13 +183,6 @@ const InputDateRange = props => {
|
|
|
167
183
|
<button
|
|
168
184
|
id={id}
|
|
169
185
|
className={cn('date-range-input__toggle-button')}
|
|
170
|
-
// className={cn(
|
|
171
|
-
// 'date-range-input__toggle-button',
|
|
172
|
-
// { 'form-select__input--disabled': disabled },
|
|
173
|
-
// { 'form-select__input--opened': isToggled },
|
|
174
|
-
// { 'form-select__input--focused': isToggled },
|
|
175
|
-
// className,
|
|
176
|
-
// )}
|
|
177
186
|
disabled={disabled}
|
|
178
187
|
onClick={!disabled && !isHoverable ? toggle : undefined}
|
|
179
188
|
>
|
|
@@ -187,21 +196,23 @@ const InputDateRange = props => {
|
|
|
187
196
|
</button>
|
|
188
197
|
{!isCompact && !hideArrows && (
|
|
189
198
|
<div className={cn('date-range-input__arrows-block')}>
|
|
190
|
-
<Arrow
|
|
191
|
-
type="left"
|
|
192
|
-
className="date-range-input__arrow"
|
|
193
|
-
onClick={() => handleArrowClick("left")}
|
|
194
|
-
disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
|
|
199
|
+
<Arrow
|
|
200
|
+
type="left"
|
|
201
|
+
className="date-range-input__arrow"
|
|
202
|
+
onClick={() => handleArrowClick("left")}
|
|
203
|
+
disabled={disabled || actualValues?.intervalKey === ALL_TIME_KEY}
|
|
195
204
|
/>
|
|
196
|
-
<Arrow
|
|
197
|
-
type="right"
|
|
198
|
-
className="date-range-input__arrow"
|
|
199
|
-
onClick={() => handleArrowClick("right")}
|
|
205
|
+
<Arrow
|
|
206
|
+
type="right"
|
|
207
|
+
className="date-range-input__arrow"
|
|
208
|
+
onClick={() => handleArrowClick("right")}
|
|
200
209
|
disabled={
|
|
201
|
-
disabled ||
|
|
202
|
-
actualValues?.intervalKey === ALL_TIME_KEY ||
|
|
203
|
-
actualValues?.intervalKey === 'today' ||
|
|
204
|
-
moment(actualValues?.end)
|
|
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'))
|
|
205
216
|
}
|
|
206
217
|
/>
|
|
207
218
|
</div>
|
|
@@ -217,7 +228,7 @@ const InputDateRange = props => {
|
|
|
217
228
|
isCompare={isCompare}
|
|
218
229
|
setIsCompare={setIsCompare}
|
|
219
230
|
toggleOff={toggleOff}
|
|
220
|
-
onChange={
|
|
231
|
+
onChange={handleChange}
|
|
221
232
|
/>
|
|
222
233
|
)}
|
|
223
234
|
</div>
|