intelicoreact 0.0.92 → 0.0.93
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/components/DropdownLoader.js +1 -1
- package/dist/Atomic/FormElements/Dropdown/components/{Loader.scss → DropdownLoader.scss} +0 -0
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +7 -2
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.scss +18 -0
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +4 -3
- package/dist/Atomic/UI/Calendar/Calendar.js +8 -10
- package/dist/Atomic/UI/Calendar/Calendar.scss +23 -23
- package/package.json +1 -1
- package/src/Atomic/FormElements/Dropdown/components/DropdownLoader.js +1 -1
- package/src/Atomic/FormElements/Dropdown/components/{Loader.scss → DropdownLoader.scss} +0 -0
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.js +16 -2
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.scss +18 -0
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +4 -3
- package/src/Atomic/UI/Calendar/Calendar.js +9 -14
- package/src/Atomic/UI/Calendar/Calendar.scss +23 -23
|
File without changes
|
|
@@ -21,6 +21,8 @@ var _Calendar = _interopRequireDefault(require("../../UI/Calendar/Calendar"));
|
|
|
21
21
|
|
|
22
22
|
var _useClickOutside = require("../../../Functions/useClickOutside");
|
|
23
23
|
|
|
24
|
+
require("./InputCalendar.scss");
|
|
25
|
+
|
|
24
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
27
|
|
|
26
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -36,7 +38,8 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
36
38
|
placeholder = _ref$placeholder === void 0 ? 'mm/dd/yyyy' : _ref$placeholder,
|
|
37
39
|
_ref$mask = _ref.mask,
|
|
38
40
|
mask = _ref$mask === void 0 ? '99/99/9999' : _ref$mask,
|
|
39
|
-
|
|
41
|
+
isDontLimitFuture = _ref.isDontLimitFuture,
|
|
42
|
+
isListTop = _ref.isListTop;
|
|
40
43
|
|
|
41
44
|
var _useState = (0, _react.useState)(false),
|
|
42
45
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -77,6 +80,7 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
77
80
|
return setIsOpened(!isOpened);
|
|
78
81
|
}
|
|
79
82
|
}), isOpened ? /*#__PURE__*/_react.default.createElement(_Calendar.default, {
|
|
83
|
+
className: isListTop ? '' : '',
|
|
80
84
|
date: getCalendarValue(value),
|
|
81
85
|
setDate: function setDate(newDate) {
|
|
82
86
|
return changeCalendarDay(newDate);
|
|
@@ -85,7 +89,8 @@ var InputCalendar = function InputCalendar(_ref) {
|
|
|
85
89
|
minDate: minDate,
|
|
86
90
|
maxDate: maxDate
|
|
87
91
|
},
|
|
88
|
-
|
|
92
|
+
isDontLimitFuture: isDontLimitFuture,
|
|
93
|
+
isListTop: isListTop
|
|
89
94
|
}) : null);
|
|
90
95
|
};
|
|
91
96
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.calendar-container {
|
|
2
|
+
min-width: 200px;
|
|
3
|
+
position: relative;
|
|
4
|
+
|
|
5
|
+
.calendar {
|
|
6
|
+
position: absolute;
|
|
7
|
+
z-index: 9;
|
|
8
|
+
top: 100%;
|
|
9
|
+
padding: 10px 16px;
|
|
10
|
+
border: 1px solid var(--border-color);
|
|
11
|
+
|
|
12
|
+
&_list-top {
|
|
13
|
+
bottom: calc(100% + 4px);
|
|
14
|
+
top: auto;
|
|
15
|
+
box-shadow: 0 -3px 15px rgb(0 0 0 / 15%);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -51,7 +51,8 @@ var CalendarTemplate = Template.bind({});
|
|
|
51
51
|
exports.CalendarTemplate = CalendarTemplate;
|
|
52
52
|
CalendarTemplate.args = {
|
|
53
53
|
value: '',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
minDate: '01/01/1900',
|
|
55
|
+
maxDate: '01/01/2100',
|
|
56
|
+
isDontLimitFuture: true // isListTop: true,
|
|
57
|
+
|
|
57
58
|
};
|
|
@@ -38,7 +38,8 @@ function _default(props) {
|
|
|
38
38
|
allowNext = _props$allowNext === void 0 ? true : _props$allowNext,
|
|
39
39
|
params = props.params,
|
|
40
40
|
className = props.className,
|
|
41
|
-
|
|
41
|
+
isDontLimitFuture = props.isDontLimitFuture,
|
|
42
|
+
isListTop = props.isListTop; // const { minDate = '01/01/1900', maxDate = moment().format('MM/DD/YYYY') } = params;
|
|
42
43
|
|
|
43
44
|
var minDate = params.minDate,
|
|
44
45
|
maxDate = params.maxDate;
|
|
@@ -76,8 +77,6 @@ function _default(props) {
|
|
|
76
77
|
var showYear = (0, _react.useMemo)(function () {
|
|
77
78
|
return (0, _moment.default)(showDate).format('YYYY');
|
|
78
79
|
}, [date, showDate]);
|
|
79
|
-
console.log('date - ', date);
|
|
80
|
-
console.log('showDate - ', showDate);
|
|
81
80
|
(0, _react.useEffect)(function () {
|
|
82
81
|
var result = {};
|
|
83
82
|
var day = selectedDay.startOf('month');
|
|
@@ -108,12 +107,10 @@ function _default(props) {
|
|
|
108
107
|
});
|
|
109
108
|
var isFutureDay = day && maxDate ? (0, _moment.default)(day.date).isAfter((0, _moment.default)(maxDate || ''), 'day') : (0, _moment.default)(day.date).isAfter((0, _moment.default)(), 'day');
|
|
110
109
|
var isBeforeDay = day && (0, _moment.default)(day.date).isBefore((0, _moment.default)(minDate || ''), 'day');
|
|
111
|
-
console.log('isFutureDay - ', isFutureDay);
|
|
112
|
-
console.log('isBeforeDay - ', isBeforeDay);
|
|
113
110
|
var classNames = (0, _classnames.default)('calendar__day', {
|
|
114
111
|
'calendar__day--clickable': day
|
|
115
112
|
}, {
|
|
116
|
-
'calendar__day--disabled': !
|
|
113
|
+
'calendar__day--disabled': !isDontLimitFuture && isFutureDay
|
|
117
114
|
}, {
|
|
118
115
|
'calendar__day--disabled': isBeforeDay
|
|
119
116
|
}, {
|
|
@@ -122,7 +119,7 @@ function _default(props) {
|
|
|
122
119
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
120
|
key: "".concat(week, "_").concat(dayOfWeek),
|
|
124
121
|
className: classNames,
|
|
125
|
-
onClick: day && (
|
|
122
|
+
onClick: day && (isDontLimitFuture || !isFutureDay) ? function () {
|
|
126
123
|
return setDate((0, _moment.default)(day.date).format('L'));
|
|
127
124
|
} : null // onMouseOver={day && !isFutureDay ? () => onHover(day.date) : null}
|
|
128
125
|
// onMouseLeave={() => onHover(null)}
|
|
@@ -164,7 +161,9 @@ function _default(props) {
|
|
|
164
161
|
}
|
|
165
162
|
}, [isChangeYear]);
|
|
166
163
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
167
|
-
className:
|
|
164
|
+
className: (0, _classnames.default)('calendar', className, {
|
|
165
|
+
'calendar_list-top': isListTop
|
|
166
|
+
})
|
|
168
167
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
169
168
|
className: "calendar-header"
|
|
170
169
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -195,8 +194,7 @@ function _default(props) {
|
|
|
195
194
|
if (e.key === 'Enter') closeYearInput();
|
|
196
195
|
},
|
|
197
196
|
onChange: function onChange(e) {
|
|
198
|
-
|
|
199
|
-
setInputYearValue(e.target.value);
|
|
197
|
+
return setInputYearValue(e.target.value);
|
|
200
198
|
}
|
|
201
199
|
}) : "".concat(showYear))), /*#__PURE__*/_react.default.createElement("div", {
|
|
202
200
|
className: "calendar-header__next"
|
|
@@ -425,18 +425,19 @@
|
|
|
425
425
|
// box-shadow: 0 0 3px 0 rgb(0 123 255 / 50%);
|
|
426
426
|
// }
|
|
427
427
|
// }
|
|
428
|
-
.calendar-header {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
// .calendar-header {
|
|
429
|
+
// display: flex;
|
|
430
|
+
// justify-content: center;
|
|
431
|
+
// align-items: center;
|
|
432
|
+
|
|
433
|
+
// &__prev,
|
|
434
|
+
// &__next {
|
|
435
|
+
// display: flex;
|
|
436
|
+
// height: auto;
|
|
437
|
+
// cursor: pointer;
|
|
438
|
+
// }
|
|
439
|
+
// }
|
|
432
440
|
|
|
433
|
-
&__prev,
|
|
434
|
-
&__next {
|
|
435
|
-
display: flex;
|
|
436
|
-
height: auto;
|
|
437
|
-
cursor: pointer;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
441
|
.calendar {
|
|
441
442
|
background: #ffffff;
|
|
442
443
|
border: 1px solid #e2e5ec;
|
|
@@ -451,6 +452,10 @@
|
|
|
451
452
|
user-select: none;
|
|
452
453
|
|
|
453
454
|
&-header {
|
|
455
|
+
display: flex;
|
|
456
|
+
justify-content: center;
|
|
457
|
+
align-items: center;
|
|
458
|
+
|
|
454
459
|
box-sizing: border-box;
|
|
455
460
|
&__title {
|
|
456
461
|
&-month {
|
|
@@ -494,6 +499,13 @@
|
|
|
494
499
|
}
|
|
495
500
|
}
|
|
496
501
|
}
|
|
502
|
+
|
|
503
|
+
&__prev,
|
|
504
|
+
&__next {
|
|
505
|
+
display: flex;
|
|
506
|
+
height: auto;
|
|
507
|
+
cursor: pointer;
|
|
508
|
+
}
|
|
497
509
|
}
|
|
498
510
|
|
|
499
511
|
&__week {
|
|
@@ -563,18 +575,6 @@
|
|
|
563
575
|
}
|
|
564
576
|
}
|
|
565
577
|
|
|
566
|
-
&-container {
|
|
567
|
-
min-width: 200px;
|
|
568
|
-
position: relative;
|
|
569
|
-
.calendar {
|
|
570
|
-
position: absolute;
|
|
571
|
-
z-index: 9;
|
|
572
|
-
top: 100%;
|
|
573
|
-
padding: 10px 16px;
|
|
574
|
-
border: 1px solid var(--border-color);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
578
|
&-dropdown {
|
|
579
579
|
appearance: none;
|
|
580
580
|
background-color: white;
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -4,7 +4,19 @@ import InputMask from 'react-input-mask';
|
|
|
4
4
|
import Calendar from '../../UI/Calendar/Calendar';
|
|
5
5
|
import { useClickOutside } from '../../../Functions/useClickOutside';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import './InputCalendar.scss';
|
|
8
|
+
|
|
9
|
+
const InputCalendar = ({
|
|
10
|
+
value,
|
|
11
|
+
minDate,
|
|
12
|
+
maxDate,
|
|
13
|
+
onChange,
|
|
14
|
+
className = '',
|
|
15
|
+
placeholder = 'mm/dd/yyyy',
|
|
16
|
+
mask = '99/99/9999',
|
|
17
|
+
isDontLimitFuture,
|
|
18
|
+
isListTop,
|
|
19
|
+
}) => {
|
|
8
20
|
const [isOpened, setIsOpened] = useState(false);
|
|
9
21
|
const calendarRef = useRef(null);
|
|
10
22
|
|
|
@@ -38,10 +50,12 @@ const InputCalendar = ({ value, minDate, maxDate, onChange, className = '', plac
|
|
|
38
50
|
/>
|
|
39
51
|
{isOpened ? (
|
|
40
52
|
<Calendar
|
|
53
|
+
className={isListTop ? '' : ''}
|
|
41
54
|
date={getCalendarValue(value)}
|
|
42
55
|
setDate={(newDate) => changeCalendarDay(newDate)}
|
|
43
56
|
params={{ minDate, maxDate }}
|
|
44
|
-
|
|
57
|
+
isDontLimitFuture={isDontLimitFuture}
|
|
58
|
+
isListTop={isListTop}
|
|
45
59
|
/>
|
|
46
60
|
) : null}
|
|
47
61
|
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.calendar-container {
|
|
2
|
+
min-width: 200px;
|
|
3
|
+
position: relative;
|
|
4
|
+
|
|
5
|
+
.calendar {
|
|
6
|
+
position: absolute;
|
|
7
|
+
z-index: 9;
|
|
8
|
+
top: 100%;
|
|
9
|
+
padding: 10px 16px;
|
|
10
|
+
border: 1px solid var(--border-color);
|
|
11
|
+
|
|
12
|
+
&_list-top {
|
|
13
|
+
bottom: calc(100% + 4px);
|
|
14
|
+
top: auto;
|
|
15
|
+
box-shadow: 0 -3px 15px rgb(0 0 0 / 15%);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -23,7 +23,8 @@ export const CalendarTemplate = Template.bind({});
|
|
|
23
23
|
|
|
24
24
|
CalendarTemplate.args = {
|
|
25
25
|
value: '',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
minDate: '01/01/1900',
|
|
27
|
+
maxDate: '01/01/2100',
|
|
28
|
+
isDontLimitFuture: true,
|
|
29
|
+
// isListTop: true,
|
|
29
30
|
};
|
|
@@ -6,7 +6,7 @@ import { ChevronLeft, ChevronRight } from 'react-feather';
|
|
|
6
6
|
import './Calendar.scss';
|
|
7
7
|
|
|
8
8
|
export default function (props) {
|
|
9
|
-
const { date, setDate, allowPrev = true, allowNext = true, params, className,
|
|
9
|
+
const { date, setDate, allowPrev = true, allowNext = true, params, className, isDontLimitFuture, isListTop } = props;
|
|
10
10
|
// const { minDate = '01/01/1900', maxDate = moment().format('MM/DD/YYYY') } = params;
|
|
11
11
|
const { minDate, maxDate } = params;
|
|
12
12
|
const [days, setDays] = useState({});
|
|
@@ -26,9 +26,6 @@ export default function (props) {
|
|
|
26
26
|
const showMonth = useMemo(() => moment(showDate).format('MMM'), [date, showDate]);
|
|
27
27
|
const showYear = useMemo(() => moment(showDate).format('YYYY'), [date, showDate]);
|
|
28
28
|
|
|
29
|
-
console.log('date - ', date);
|
|
30
|
-
console.log('showDate - ', showDate);
|
|
31
|
-
|
|
32
29
|
useEffect(() => {
|
|
33
30
|
const result = {};
|
|
34
31
|
const day = selectedDay.startOf('month');
|
|
@@ -52,13 +49,10 @@ export default function (props) {
|
|
|
52
49
|
const isFutureDay = day && maxDate ? moment(day.date).isAfter(moment(maxDate || ''), 'day') : moment(day.date).isAfter(moment(), 'day');
|
|
53
50
|
const isBeforeDay = day && moment(day.date).isBefore(moment(minDate || ''), 'day');
|
|
54
51
|
|
|
55
|
-
console.log('isFutureDay - ', isFutureDay);
|
|
56
|
-
console.log('isBeforeDay - ', isBeforeDay);
|
|
57
|
-
|
|
58
52
|
const classNames = cn(
|
|
59
53
|
'calendar__day',
|
|
60
54
|
{ 'calendar__day--clickable': day },
|
|
61
|
-
{ 'calendar__day--disabled': !
|
|
55
|
+
{ 'calendar__day--disabled': !isDontLimitFuture && isFutureDay },
|
|
62
56
|
{ 'calendar__day--disabled': isBeforeDay },
|
|
63
57
|
{ 'calendar__day--selected': moment(date).format() === moment(day.date).format() }
|
|
64
58
|
);
|
|
@@ -67,7 +61,7 @@ export default function (props) {
|
|
|
67
61
|
<div
|
|
68
62
|
key={`${week}_${dayOfWeek}`}
|
|
69
63
|
className={classNames}
|
|
70
|
-
onClick={day && (
|
|
64
|
+
onClick={day && (isDontLimitFuture || !isFutureDay) ? () => setDate(moment(day.date).format('L')) : null}
|
|
71
65
|
// onMouseOver={day && !isFutureDay ? () => onHover(day.date) : null}
|
|
72
66
|
// onMouseLeave={() => onHover(null)}
|
|
73
67
|
>
|
|
@@ -112,7 +106,11 @@ export default function (props) {
|
|
|
112
106
|
}, [isChangeYear]);
|
|
113
107
|
|
|
114
108
|
return (
|
|
115
|
-
<div
|
|
109
|
+
<div
|
|
110
|
+
className={cn('calendar', className, {
|
|
111
|
+
'calendar_list-top': isListTop,
|
|
112
|
+
})}
|
|
113
|
+
>
|
|
116
114
|
<div className="calendar-header">
|
|
117
115
|
<div className="calendar-header__prev">
|
|
118
116
|
{allowPrev && (
|
|
@@ -139,10 +137,7 @@ export default function (props) {
|
|
|
139
137
|
if (e.key === 'Escape') setIsChangeYear(false);
|
|
140
138
|
if (e.key === 'Enter') closeYearInput();
|
|
141
139
|
}}
|
|
142
|
-
onChange={(e) =>
|
|
143
|
-
console.log(e.target.value);
|
|
144
|
-
setInputYearValue(e.target.value);
|
|
145
|
-
}}
|
|
140
|
+
onChange={(e) => setInputYearValue(e.target.value)}
|
|
146
141
|
/>
|
|
147
142
|
) : (
|
|
148
143
|
`${showYear}`
|
|
@@ -425,18 +425,19 @@
|
|
|
425
425
|
// box-shadow: 0 0 3px 0 rgb(0 123 255 / 50%);
|
|
426
426
|
// }
|
|
427
427
|
// }
|
|
428
|
-
.calendar-header {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
// .calendar-header {
|
|
429
|
+
// display: flex;
|
|
430
|
+
// justify-content: center;
|
|
431
|
+
// align-items: center;
|
|
432
|
+
|
|
433
|
+
// &__prev,
|
|
434
|
+
// &__next {
|
|
435
|
+
// display: flex;
|
|
436
|
+
// height: auto;
|
|
437
|
+
// cursor: pointer;
|
|
438
|
+
// }
|
|
439
|
+
// }
|
|
432
440
|
|
|
433
|
-
&__prev,
|
|
434
|
-
&__next {
|
|
435
|
-
display: flex;
|
|
436
|
-
height: auto;
|
|
437
|
-
cursor: pointer;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
441
|
.calendar {
|
|
441
442
|
background: #ffffff;
|
|
442
443
|
border: 1px solid #e2e5ec;
|
|
@@ -451,6 +452,10 @@
|
|
|
451
452
|
user-select: none;
|
|
452
453
|
|
|
453
454
|
&-header {
|
|
455
|
+
display: flex;
|
|
456
|
+
justify-content: center;
|
|
457
|
+
align-items: center;
|
|
458
|
+
|
|
454
459
|
box-sizing: border-box;
|
|
455
460
|
&__title {
|
|
456
461
|
&-month {
|
|
@@ -494,6 +499,13 @@
|
|
|
494
499
|
}
|
|
495
500
|
}
|
|
496
501
|
}
|
|
502
|
+
|
|
503
|
+
&__prev,
|
|
504
|
+
&__next {
|
|
505
|
+
display: flex;
|
|
506
|
+
height: auto;
|
|
507
|
+
cursor: pointer;
|
|
508
|
+
}
|
|
497
509
|
}
|
|
498
510
|
|
|
499
511
|
&__week {
|
|
@@ -563,18 +575,6 @@
|
|
|
563
575
|
}
|
|
564
576
|
}
|
|
565
577
|
|
|
566
|
-
&-container {
|
|
567
|
-
min-width: 200px;
|
|
568
|
-
position: relative;
|
|
569
|
-
.calendar {
|
|
570
|
-
position: absolute;
|
|
571
|
-
z-index: 9;
|
|
572
|
-
top: 100%;
|
|
573
|
-
padding: 10px 16px;
|
|
574
|
-
border: 1px solid var(--border-color);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
578
|
&-dropdown {
|
|
579
579
|
appearance: none;
|
|
580
580
|
background-color: white;
|