linear-react-components-ui 1.1.24-rc.0 → 1.1.24-rc.2
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/lib/assets/styles/calendar.scss +137 -32
- package/lib/assets/styles/datepicker2.scss +1 -4
- package/lib/assets/styles/file.scss +8 -0
- package/lib/calendar/base/index.js +120 -42
- package/lib/dialog/base/Content.js +4 -4
- package/lib/drawer/Drawer.js +1 -1
- package/lib/form2/index.d.ts +1 -1
- package/lib/form2/types.d.ts +4 -0
- package/lib/form2/useForm/index.js +2 -0
- package/lib/index-299f841a.d.ts +41 -0
- package/lib/index-cd005ed1.d.ts +26 -0
- package/lib/index-e71434f9.d.ts +15 -0
- package/lib/inputs/base/types.d.ts +1 -1
- package/lib/inputs/color/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +27 -27
- package/lib/inputs/file/File.js +1 -0
- package/lib/inputs/file/FileButtonSettings.js +0 -1
- package/lib/inputs/period/index.js +10 -8
- package/lib/inputs/period/types.d.ts +4 -1
- package/lib/inputs2/checkboxfield/index.d.ts +1 -1
- package/lib/inputs2/date/base/index.js +1 -2
- package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
- package/lib/inputs2/index.d.ts +3 -3
- package/lib/inputs2/radiofield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/item.d.ts +1 -1
- package/lib/inputs2/selectfield/listbox.d.ts +1 -1
- package/lib/inputs2/selectfield/options.d.ts +1 -1
- package/lib/inputs2/selectfield/search.d.ts +1 -1
- package/lib/inputs2/selectfield/selections.d.ts +1 -1
- package/lib/inputs2/slot/index.d.ts +2 -2
- package/package.json +1 -1
- package/lib/calendar/base/Day.d.ts +0 -8
- package/lib/calendar/base/Day.js +0 -35
- package/lib/calendar/base/Month.d.ts +0 -8
- package/lib/calendar/base/Month.js +0 -39
- package/lib/calendar/base/Week.d.ts +0 -8
- package/lib/calendar/base/Week.js +0 -35
- package/lib/index-11944b1a.d.ts +0 -26
- package/lib/index-789dd9a5.d.ts +0 -41
- package/lib/index-7ad68789.d.ts +0 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
1
|
@import "colors.scss";
|
|
3
2
|
@import "commons.scss";
|
|
4
3
|
|
|
5
4
|
$padding-size: 10px;
|
|
6
5
|
$border-radius-size: 5px;
|
|
6
|
+
|
|
7
7
|
.calendar-component {
|
|
8
8
|
width: auto;
|
|
9
9
|
height: 100%;
|
|
@@ -13,8 +13,9 @@ $border-radius-size: 5px;
|
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
border-radius: $border-radius-size;
|
|
15
15
|
border: 1px solid $component-border-color;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
>.calendarheader,
|
|
18
|
+
>.daynames {
|
|
18
19
|
width: auto;
|
|
19
20
|
height: 1.85rem;
|
|
20
21
|
display: grid;
|
|
@@ -22,7 +23,8 @@ $border-radius-size: 5px;
|
|
|
22
23
|
background-color: #f0f0f0;
|
|
23
24
|
grid-template-columns: 20px 1fr 30px;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
>.calendarheader {
|
|
26
28
|
width: auto;
|
|
27
29
|
height: 32px;
|
|
28
30
|
padding-top: 4px;
|
|
@@ -31,7 +33,8 @@ $border-radius-size: 5px;
|
|
|
31
33
|
justify-content: space-between;
|
|
32
34
|
border-top-left-radius: $border-radius-size;
|
|
33
35
|
border-top-right-radius: $border-radius-size;
|
|
34
|
-
|
|
36
|
+
|
|
37
|
+
>.navbutton {
|
|
35
38
|
width: 2rem;
|
|
36
39
|
height: 2rem;
|
|
37
40
|
padding: 0;
|
|
@@ -42,21 +45,26 @@ $border-radius-size: 5px;
|
|
|
42
45
|
background-color: transparent;
|
|
43
46
|
font-weight: bold;
|
|
44
47
|
border: none;
|
|
48
|
+
|
|
45
49
|
svg {
|
|
46
50
|
margin: 0;
|
|
47
51
|
}
|
|
52
|
+
|
|
48
53
|
&:hover {
|
|
49
54
|
background-color: $component-border-color;
|
|
50
55
|
}
|
|
56
|
+
|
|
51
57
|
&:focus {
|
|
52
58
|
-webkit-box-shadow: none !important;
|
|
53
59
|
box-shadow: none !important;
|
|
54
60
|
border: 1px solid $default-border-color;
|
|
55
61
|
background-color: $component-border-color;
|
|
56
62
|
}
|
|
63
|
+
|
|
57
64
|
transition: none;
|
|
58
65
|
}
|
|
59
|
-
|
|
66
|
+
|
|
67
|
+
>.monthname {
|
|
60
68
|
font-weight: bold;
|
|
61
69
|
vertical-align: middle;
|
|
62
70
|
text-align: center;
|
|
@@ -64,117 +72,209 @@ $border-radius-size: 5px;
|
|
|
64
72
|
font-size: 14px;
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
|
|
75
|
+
|
|
76
|
+
>.daynames {
|
|
68
77
|
padding-top: 4px;
|
|
69
78
|
border-bottom: 1px solid $component-border-color;
|
|
70
79
|
grid-template-columns: repeat(7, 1fr);
|
|
71
80
|
text-align: center;
|
|
72
81
|
}
|
|
73
|
-
|
|
82
|
+
|
|
83
|
+
>.calendarmonth {
|
|
74
84
|
width: 100%;
|
|
75
85
|
height: 100%;
|
|
76
86
|
flex: 1;
|
|
77
87
|
display: grid;
|
|
78
|
-
grid-template-rows: repeat(6, 1fr);
|
|
79
88
|
padding: 2px;
|
|
80
89
|
background-color: $font-color-second;
|
|
81
90
|
border-bottom-left-radius: $border-radius-size;
|
|
82
91
|
border-bottom-right-radius: $border-radius-size;
|
|
83
92
|
}
|
|
84
|
-
|
|
93
|
+
|
|
94
|
+
>.calendarmonth>.monthweek {
|
|
85
95
|
text-align: center;
|
|
86
96
|
display: grid;
|
|
87
97
|
grid-template-columns: repeat(7, 1fr)
|
|
88
98
|
}
|
|
89
|
-
|
|
99
|
+
|
|
100
|
+
.calendarmonth>.monthweek>.monthday {
|
|
90
101
|
height: auto;
|
|
91
102
|
width: auto;
|
|
92
103
|
text-align: center;
|
|
93
104
|
border-right: 0;
|
|
94
105
|
border-bottom: 0;
|
|
95
106
|
transition: all 0.2s ease-in-out;
|
|
96
|
-
|
|
107
|
+
|
|
108
|
+
>.daybutton {
|
|
97
109
|
height: 100%;
|
|
98
110
|
width: 100%;
|
|
99
111
|
padding: 0;
|
|
100
112
|
font-size: 13px;
|
|
101
113
|
border: none;
|
|
102
114
|
background-color: transparent;
|
|
115
|
+
|
|
103
116
|
&.-nowday {
|
|
104
117
|
font-weight: bold
|
|
105
118
|
}
|
|
119
|
+
|
|
106
120
|
&.-outmonth {
|
|
107
121
|
color: #777;
|
|
108
122
|
}
|
|
123
|
+
|
|
109
124
|
&:focus {
|
|
110
125
|
-webkit-box-shadow: none !important;
|
|
111
126
|
box-shadow: none !important;
|
|
112
127
|
border: 2px solid $default-border-color;
|
|
113
128
|
}
|
|
129
|
+
|
|
114
130
|
transition: none;
|
|
115
131
|
}
|
|
132
|
+
|
|
116
133
|
&:hover {
|
|
117
134
|
background-color: $component-border-color;
|
|
118
135
|
border-radius: 4px;
|
|
119
136
|
}
|
|
137
|
+
|
|
120
138
|
&.-selectedday {
|
|
121
139
|
background-color: $font-selected-color;
|
|
122
140
|
border-radius: 4px;
|
|
123
141
|
}
|
|
124
|
-
|
|
142
|
+
|
|
143
|
+
&.-selectedday>.daybutton {
|
|
125
144
|
color: $font-color-second;
|
|
126
145
|
}
|
|
127
146
|
}
|
|
128
147
|
}
|
|
129
148
|
|
|
130
149
|
.calendar-component {
|
|
131
|
-
|
|
132
|
-
|
|
150
|
+
|
|
151
|
+
&.-success,
|
|
152
|
+
&.-primary,
|
|
153
|
+
&.-info,
|
|
154
|
+
&.-warning,
|
|
155
|
+
&.-danger {
|
|
156
|
+
|
|
157
|
+
>.calendarheader,
|
|
158
|
+
>.daynames {
|
|
133
159
|
color: $font-color-second;
|
|
134
160
|
}
|
|
161
|
+
|
|
162
|
+
.navbutton {
|
|
163
|
+
svg {
|
|
164
|
+
fill: $font-color-second;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
135
167
|
}
|
|
168
|
+
|
|
136
169
|
&.-success {
|
|
137
|
-
|
|
138
|
-
|
|
170
|
+
|
|
171
|
+
>.calendarheader,
|
|
172
|
+
>.daynames {
|
|
139
173
|
background-color: $success-color;
|
|
140
174
|
}
|
|
175
|
+
|
|
176
|
+
.navbutton {
|
|
177
|
+
&:focus {
|
|
178
|
+
background-color: $success-actived-color;
|
|
179
|
+
border-color: $success-border-color;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&:hover {
|
|
183
|
+
background-color: $success-hover-color;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
141
186
|
}
|
|
187
|
+
|
|
142
188
|
&.-primary {
|
|
143
|
-
|
|
144
|
-
|
|
189
|
+
|
|
190
|
+
>.calendarheader,
|
|
191
|
+
>.daynames {
|
|
145
192
|
background-color: $primary-color;
|
|
146
193
|
}
|
|
194
|
+
|
|
195
|
+
.navbutton {
|
|
196
|
+
&:focus {
|
|
197
|
+
background-color: $primary-actived-color;
|
|
198
|
+
border-color: $primary-border-color;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&:hover {
|
|
202
|
+
background-color: $primary-hover-color;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
147
205
|
}
|
|
206
|
+
|
|
148
207
|
&.-info {
|
|
149
|
-
|
|
150
|
-
|
|
208
|
+
|
|
209
|
+
>.calendarheader,
|
|
210
|
+
>.daynames {
|
|
151
211
|
background-color: $info-color;
|
|
152
212
|
}
|
|
213
|
+
|
|
214
|
+
.navbutton {
|
|
215
|
+
&:focus {
|
|
216
|
+
background-color: $info-actived-color;
|
|
217
|
+
border-color: $info-border-color;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&:hover {
|
|
221
|
+
background-color: $info-hover-color;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
153
224
|
}
|
|
225
|
+
|
|
154
226
|
&.-warning {
|
|
155
|
-
|
|
156
|
-
|
|
227
|
+
|
|
228
|
+
>.calendarheader,
|
|
229
|
+
>.daynames {
|
|
157
230
|
background-color: $warning-color;
|
|
158
231
|
}
|
|
232
|
+
|
|
233
|
+
.navbutton {
|
|
234
|
+
&:focus {
|
|
235
|
+
background-color: $warning-actived-color;
|
|
236
|
+
border-color: $warning-border-color;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&:hover {
|
|
240
|
+
background-color: $warning-hover-color;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
159
243
|
}
|
|
244
|
+
|
|
160
245
|
&.-danger {
|
|
161
|
-
|
|
162
|
-
|
|
246
|
+
|
|
247
|
+
>.calendarheader,
|
|
248
|
+
>.daynames {
|
|
163
249
|
background-color: $danger-color;
|
|
164
250
|
}
|
|
251
|
+
|
|
252
|
+
.navbutton {
|
|
253
|
+
&:focus {
|
|
254
|
+
background-color: $danger-actived-color;
|
|
255
|
+
border-color: $danger-border-color;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&:hover {
|
|
259
|
+
background-color: $danger-hover-color;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
165
262
|
}
|
|
166
263
|
}
|
|
167
264
|
|
|
168
265
|
//Add border to days container
|
|
169
266
|
.calendar-component.-draw-grid-lines {
|
|
170
|
-
|
|
267
|
+
>.calendarmonth>.monthweek {
|
|
171
268
|
border-bottom: 1px solid $component-border-color;
|
|
269
|
+
|
|
172
270
|
&:first-child {
|
|
173
271
|
border-top: 1px solid $component-border-color;
|
|
174
272
|
}
|
|
175
273
|
}
|
|
176
|
-
|
|
274
|
+
|
|
275
|
+
>.calendarmonth>.monthweek>.monthday {
|
|
177
276
|
border-left: 1px solid $component-border-color;
|
|
277
|
+
|
|
178
278
|
&:last-child {
|
|
179
279
|
border-right: 1px solid $component-border-color;
|
|
180
280
|
}
|
|
@@ -183,24 +283,29 @@ $border-radius-size: 5px;
|
|
|
183
283
|
|
|
184
284
|
//Remove padding
|
|
185
285
|
.calendar-component.-unpadding {
|
|
186
|
-
|
|
286
|
+
|
|
287
|
+
>.calendarmonth,
|
|
288
|
+
>.daynames {
|
|
187
289
|
padding: 0;
|
|
188
290
|
}
|
|
189
|
-
|
|
291
|
+
|
|
292
|
+
>.calendarmonth>.monthweek {
|
|
190
293
|
&:first-child {
|
|
191
294
|
border-top: 0px;
|
|
192
295
|
}
|
|
296
|
+
|
|
193
297
|
&:last-child {
|
|
194
298
|
border-bottom: 0px;
|
|
195
299
|
}
|
|
196
300
|
}
|
|
197
|
-
|
|
301
|
+
|
|
302
|
+
>.calendarmonth>.monthweek>.monthday {
|
|
198
303
|
&:last-child {
|
|
199
304
|
border-right: 0px
|
|
200
305
|
}
|
|
306
|
+
|
|
201
307
|
&:first-child {
|
|
202
308
|
border-left: 0;
|
|
203
309
|
}
|
|
204
310
|
}
|
|
205
|
-
}
|
|
206
|
-
|
|
311
|
+
}
|
|
@@ -156,7 +156,7 @@ input::-webkit-inner-spin-button {
|
|
|
156
156
|
width: 22px;
|
|
157
157
|
height: 100%;
|
|
158
158
|
padding: 0;
|
|
159
|
-
margin: 0px
|
|
159
|
+
margin: 0px 2px;
|
|
160
160
|
outline: none;
|
|
161
161
|
border: none;
|
|
162
162
|
vertical-align: bottom;
|
|
@@ -175,9 +175,6 @@ input::-webkit-inner-spin-button {
|
|
|
175
175
|
&[data-state-valid-date-selected=false] {
|
|
176
176
|
visibility: hidden;
|
|
177
177
|
}
|
|
178
|
-
&[data-state-valid-date-selected=true] {
|
|
179
|
-
visibility: visible;
|
|
180
|
-
}
|
|
181
178
|
}
|
|
182
179
|
&[data-state-read-only=true],
|
|
183
180
|
&[data-state-disabled=true] {
|
|
@@ -4,20 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
require("../../assets/styles/calendar.scss");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _uuid = require("uuid");
|
|
9
9
|
var _moment = _interopRequireDefault(require("moment"));
|
|
10
|
-
var
|
|
11
|
-
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
10
|
+
var _uuid = require("uuid");
|
|
12
11
|
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
12
|
+
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
13
13
|
var _helpers = require("./helpers");
|
|
14
|
-
require("../../assets/styles/calendar.scss");
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
16
|
const arrowKeys = ['ArrowUp', 'ArrowRight', 'ArrowDown', 'ArrowLeft'];
|
|
18
17
|
const Calendar = props => {
|
|
19
18
|
const {
|
|
20
|
-
currentDate = (0, _moment.default)(),
|
|
19
|
+
currentDate: currentDateProp = (0, _moment.default)(),
|
|
21
20
|
onDateChange,
|
|
22
21
|
drawGridLines = false,
|
|
23
22
|
colorStyle,
|
|
@@ -27,47 +26,105 @@ const Calendar = props => {
|
|
|
27
26
|
currentDateButton,
|
|
28
27
|
calendarContainer
|
|
29
28
|
} = props;
|
|
30
|
-
const currentMonth = (0, _react.useRef)(null);
|
|
31
29
|
const currentCalendarRef = (0, _react.useRef)(null);
|
|
32
|
-
const
|
|
30
|
+
const calendarMonthsContainerRef = (0, _react.useRef)(null);
|
|
31
|
+
const currentDaySelectedContainerRef = (0, _react.useRef)(null);
|
|
32
|
+
const [currentDate, setCurrentDate] = (0, _react.useState)(currentDateProp);
|
|
33
|
+
const [currentMonth, setCurrentMonth] = (0, _react.useState)((0, _moment.default)(currentDateProp).format('MM-YYYY'));
|
|
33
34
|
const onDateChangeFunction = date => {
|
|
35
|
+
setCurrentDate(date);
|
|
34
36
|
if (onDateChange) onDateChange(date);
|
|
35
|
-
setDataAtual(date);
|
|
36
37
|
};
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const createCalendarWithWeeksAndDays = () => {
|
|
39
|
+
const firstDayOfMonth = (0, _moment.default)(currentMonth, 'MM-YYYY').startOf('month');
|
|
40
|
+
const lastDayOfMonth = (0, _moment.default)(currentMonth, 'MM-YYYY').endOf('month');
|
|
41
|
+
const startDate = firstDayOfMonth.clone().startOf('week');
|
|
42
|
+
const endDate = lastDayOfMonth.clone().endOf('week');
|
|
43
|
+
const days = [];
|
|
44
|
+
const day = startDate.clone();
|
|
45
|
+
while (day.isBefore(endDate, 'day') || day.isSame(endDate, 'day')) {
|
|
46
|
+
days.push({
|
|
47
|
+
date: day.clone(),
|
|
48
|
+
isDaySelected: day.isSame(currentDate)
|
|
49
|
+
});
|
|
50
|
+
day.add(1, 'day');
|
|
51
|
+
}
|
|
52
|
+
return days;
|
|
40
53
|
};
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
54
|
+
const changeMonth = amountMonthsToChange => {
|
|
55
|
+
const newDate = (0, _moment.default)(currentMonth, 'MM-YYYY').add(amountMonthsToChange, 'month').format('MM-YYYY');
|
|
56
|
+
setCurrentMonth(newDate);
|
|
57
|
+
};
|
|
58
|
+
const getFirstOrLastDayButtonOfCalendar = function () {
|
|
59
|
+
var _currentCalendarRef$c;
|
|
60
|
+
let firstOrLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first';
|
|
61
|
+
const listOfButtons = ((_currentCalendarRef$c = currentCalendarRef.current) === null || _currentCalendarRef$c === void 0 ? void 0 : _currentCalendarRef$c.getElementsByClassName('daybutton')) || [];
|
|
62
|
+
if (firstOrLast === 'first') return listOfButtons[0];
|
|
63
|
+
if (firstOrLast === 'last') return listOfButtons[listOfButtons.length - 1];
|
|
44
64
|
};
|
|
45
65
|
const navigateWithArrows = event => {
|
|
46
|
-
var
|
|
47
|
-
const sourceTarget = event.target;
|
|
48
|
-
const daysOfMonth = (_currentMonth$current = currentMonth.current) === null || _currentMonth$current === void 0 ? void 0 : _currentMonth$current.getElementsByClassName('daybutton');
|
|
66
|
+
var _currentCalendarRef$c2, _containerDaySelected, _currentCalendarRef$c3, _currentCalendarRef$c4, _calendarMonthsContai;
|
|
49
67
|
let indexCurrentDay = 0;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
const eventTarget = event.target;
|
|
69
|
+
indexCurrentDay = Number(eventTarget.getAttribute('data-day-index') || 0);
|
|
70
|
+
const containerDaySelected = (_currentCalendarRef$c2 = currentCalendarRef.current) === null || _currentCalendarRef$c2 === void 0 ? void 0 : _currentCalendarRef$c2.getElementsByClassName('-selectedday');
|
|
71
|
+
const buttonDaySelected = containerDaySelected === null || containerDaySelected === void 0 ? void 0 : (_containerDaySelected = containerDaySelected[0]) === null || _containerDaySelected === void 0 ? void 0 : _containerDaySelected.firstChild;
|
|
72
|
+
const daysOfMonth = (_currentCalendarRef$c3 = currentCalendarRef.current) === null || _currentCalendarRef$c3 === void 0 ? void 0 : _currentCalendarRef$c3.getElementsByClassName('daybutton');
|
|
73
|
+
const lastDayButtonElement = getFirstOrLastDayButtonOfCalendar('last');
|
|
74
|
+
if (!((_currentCalendarRef$c4 = currentCalendarRef.current) !== null && _currentCalendarRef$c4 !== void 0 && _currentCalendarRef$c4.contains(document.activeElement))) {
|
|
75
|
+
var _currentCalendarRef$c5;
|
|
76
|
+
if ((_currentCalendarRef$c5 = currentCalendarRef.current) !== null && _currentCalendarRef$c5 !== void 0 && _currentCalendarRef$c5.contains(buttonDaySelected)) {
|
|
77
|
+
buttonDaySelected.focus();
|
|
78
|
+
indexCurrentDay = Number(buttonDaySelected.getAttribute('data-day-index') || 0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if ((_calendarMonthsContai = calendarMonthsContainerRef.current) !== null && _calendarMonthsContai !== void 0 && _calendarMonthsContai.contains(document.activeElement)) {
|
|
82
|
+
const element = {
|
|
83
|
+
ArrowUp: daysOfMonth[indexCurrentDay - 7],
|
|
84
|
+
ArrowRight: daysOfMonth[indexCurrentDay + 1],
|
|
85
|
+
ArrowDown: daysOfMonth[indexCurrentDay + 7],
|
|
86
|
+
ArrowLeft: daysOfMonth[indexCurrentDay - 1]
|
|
87
|
+
}[event.code];
|
|
88
|
+
if (element) element.focus();
|
|
89
|
+
const lastButtonElementIndex = Number((lastDayButtonElement === null || lastDayButtonElement === void 0 ? void 0 : lastDayButtonElement.getAttribute('data-day-index')) || 0);
|
|
90
|
+
if (indexCurrentDay === 0 && event.code === 'ArrowLeft') {
|
|
91
|
+
setCurrentMonth(prevState => {
|
|
92
|
+
return (0, _moment.default)(prevState, 'MM-YYYY').subtract(1, 'month').format('MM-YYYY');
|
|
93
|
+
});
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
var _getFirstOrLastDayBut;
|
|
96
|
+
(_getFirstOrLastDayBut = getFirstOrLastDayButtonOfCalendar('last')) === null || _getFirstOrLastDayBut === void 0 ? void 0 : _getFirstOrLastDayBut.focus();
|
|
97
|
+
}, 1);
|
|
98
|
+
}
|
|
99
|
+
if (indexCurrentDay === lastButtonElementIndex && event.code === 'ArrowRight') {
|
|
100
|
+
setCurrentMonth(prevState => {
|
|
101
|
+
return (0, _moment.default)(prevState, 'MM-YYYY').add(1, 'month').format('MM-YYYY');
|
|
102
|
+
});
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
var _getFirstOrLastDayBut2;
|
|
105
|
+
(_getFirstOrLastDayBut2 = getFirstOrLastDayButtonOfCalendar('first')) === null || _getFirstOrLastDayBut2 === void 0 ? void 0 : _getFirstOrLastDayBut2.focus();
|
|
106
|
+
}, 1);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
var _calendarMonthsContai2;
|
|
110
|
+
if ((_calendarMonthsContai2 = calendarMonthsContainerRef.current) !== null && _calendarMonthsContai2 !== void 0 && _calendarMonthsContai2.contains(buttonDaySelected)) {
|
|
111
|
+
buttonDaySelected.focus();
|
|
112
|
+
} else {
|
|
113
|
+
var _getFirstOrLastDayBut3;
|
|
114
|
+
(_getFirstOrLastDayBut3 = getFirstOrLastDayButtonOfCalendar('first')) === null || _getFirstOrLastDayBut3 === void 0 ? void 0 : _getFirstOrLastDayBut3.focus();
|
|
115
|
+
}
|
|
54
116
|
}
|
|
55
|
-
const element = {
|
|
56
|
-
ArrowUp: daysOfMonth[indexCurrentDay - 7],
|
|
57
|
-
ArrowRight: daysOfMonth[indexCurrentDay + 1],
|
|
58
|
-
ArrowDown: daysOfMonth[indexCurrentDay + 7],
|
|
59
|
-
ArrowLeft: daysOfMonth[indexCurrentDay - 1]
|
|
60
|
-
}[event.code];
|
|
61
|
-
if (element) element.focus();
|
|
62
117
|
};
|
|
63
118
|
const contextValues = {
|
|
64
119
|
handleDateChange: onDateChangeFunction
|
|
65
120
|
};
|
|
66
121
|
(0, _react.useEffect)(() => {
|
|
122
|
+
setCurrentDate((0, _helpers.validDate)(currentDateProp));
|
|
67
123
|
calendarContainer === null || calendarContainer === void 0 ? void 0 : calendarContainer(currentCalendarRef === null || currentCalendarRef === void 0 ? void 0 : currentCalendarRef.current);
|
|
68
|
-
|
|
124
|
+
}, []);
|
|
125
|
+
(0, _react.useEffect)(() => {
|
|
69
126
|
document.addEventListener('keydown', event => {
|
|
70
|
-
if (event && event.code && arrowKeys.includes(event.code) &&
|
|
127
|
+
if (event && event.code && arrowKeys.includes(event.code) && document.contains(currentCalendarRef.current)) {
|
|
71
128
|
navigateWithArrows(event);
|
|
72
129
|
event.stopPropagation();
|
|
73
130
|
event.preventDefault();
|
|
@@ -77,13 +134,10 @@ const Calendar = props => {
|
|
|
77
134
|
document.removeEventListener('keydown', () => {});
|
|
78
135
|
};
|
|
79
136
|
}, []);
|
|
80
|
-
(0, _react.useEffect)(() => {
|
|
81
|
-
var _currentMonth$current2;
|
|
82
|
-
const daysOfMonth = (_currentMonth$current2 = currentMonth.current) === null || _currentMonth$current2 === void 0 ? void 0 : _currentMonth$current2.getElementsByClassName('-selectedday')[0];
|
|
83
|
-
currentDateButton === null || currentDateButton === void 0 ? void 0 : currentDateButton(daysOfMonth.firstChild);
|
|
84
|
-
}, [currentDate]);
|
|
85
137
|
const component = /*#__PURE__*/_react.default.createElement("div", {
|
|
86
138
|
ref: currentCalendarRef,
|
|
139
|
+
role: "grid",
|
|
140
|
+
"aria-label": String('calendar-container-').concat((0, _uuid.v1)()),
|
|
87
141
|
className: (0, _helpers.getCalendarCssClass)({
|
|
88
142
|
unpadding,
|
|
89
143
|
drawGridLines,
|
|
@@ -94,30 +148,54 @@ const Calendar = props => {
|
|
|
94
148
|
className: "calendarheader"
|
|
95
149
|
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
96
150
|
id: (0, _uuid.v1)(),
|
|
151
|
+
tabIndex: -1,
|
|
97
152
|
boxShadow: false,
|
|
98
153
|
iconName: "arrow_left",
|
|
99
154
|
customClass: "navbutton nav-arrow-left",
|
|
100
155
|
onClick: () => {
|
|
101
|
-
|
|
156
|
+
changeMonth(-1);
|
|
102
157
|
}
|
|
103
158
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
104
159
|
className: "monthname"
|
|
105
|
-
},
|
|
160
|
+
}, (0, _moment.default)(currentMonth, 'MM-YYYY').format('MMMM YYYY')), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
106
161
|
id: (0, _uuid.v1)(),
|
|
162
|
+
tabIndex: -1,
|
|
107
163
|
boxShadow: false,
|
|
108
164
|
iconName: "arrow_right",
|
|
109
165
|
customClass: "navbutton nav-arrow-right",
|
|
110
166
|
onClick: () => {
|
|
111
|
-
|
|
167
|
+
changeMonth(1);
|
|
112
168
|
}
|
|
113
169
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
114
170
|
className: "daynames"
|
|
115
171
|
}, (0, _helpers.dayNames)().map(name => /*#__PURE__*/_react.default.createElement("div", {
|
|
116
172
|
key: "day-".concat(name)
|
|
117
|
-
}, name))), /*#__PURE__*/_react.default.createElement(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
173
|
+
}, name))), /*#__PURE__*/_react.default.createElement("div", {
|
|
174
|
+
ref: calendarMonthsContainerRef,
|
|
175
|
+
className: "calendarmonth"
|
|
176
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
className: "monthweek"
|
|
178
|
+
}, createCalendarWithWeeksAndDays().map((_ref, index) => {
|
|
179
|
+
let {
|
|
180
|
+
date,
|
|
181
|
+
isDaySelected
|
|
182
|
+
} = _ref;
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
184
|
+
key: date.format('YYYY-MM-DD'),
|
|
185
|
+
ref: isDaySelected ? currentDaySelectedContainerRef : undefined,
|
|
186
|
+
className: (0, _helpers.getDayContainerCssClass)(currentDate, date)
|
|
187
|
+
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
188
|
+
"data-day-index": index,
|
|
189
|
+
id: (0, _uuid.v1)(),
|
|
190
|
+
type: "button",
|
|
191
|
+
buttonRef: ref => isDaySelected && ref ? currentDateButton === null || currentDateButton === void 0 ? void 0 : currentDateButton(ref) : undefined,
|
|
192
|
+
tabIndex: -1,
|
|
193
|
+
boxShadow: false,
|
|
194
|
+
label: date.date().toString(),
|
|
195
|
+
onClick: () => onDateChangeFunction(date),
|
|
196
|
+
customClass: " ".concat((0, _helpers.getDayCssClass)(currentDate, date), " numberdaycalendar")
|
|
197
|
+
}));
|
|
198
|
+
}))));
|
|
121
199
|
return /*#__PURE__*/_react.default.createElement(_helpers.CalendarContext.Provider, {
|
|
122
200
|
value: contextValues
|
|
123
201
|
}, !gridLayout ? component : /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
|
|
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
require("../../assets/styles/dialog.scss");
|
|
9
|
-
function
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const Content = _ref => {
|
|
11
11
|
let {
|
|
12
12
|
children,
|
|
13
13
|
styleForContent,
|
|
14
14
|
className = ''
|
|
15
15
|
} = _ref;
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
17
|
id: "modal-dialog-content",
|
|
18
18
|
className: "dialog-content ".concat(className),
|
|
19
19
|
style: styleForContent
|
|
20
|
-
}, children)
|
|
20
|
+
}, children);
|
|
21
21
|
};
|
|
22
22
|
var _default = exports.default = Content;
|
package/lib/drawer/Drawer.js
CHANGED
|
@@ -139,7 +139,7 @@ const BaseDrawer = _ref => {
|
|
|
139
139
|
className: "drawercontent ".concat(skeletonize ? '-skeletonized' : '', " ").concat(customClassForContent)
|
|
140
140
|
}, title && /*#__PURE__*/_react.default.createElement(_.DrawerHeader, _extends({}, headerProps, {
|
|
141
141
|
customClass: customClassForDrawer
|
|
142
|
-
})),
|
|
142
|
+
})), content ? /*#__PURE__*/_react.default.createElement(_.DrawerContent, null, content) : children, getSpinner())));
|
|
143
143
|
return /*#__PURE__*/_reactDom.default.createPortal(drawerContent(), drawerContainerEl.current);
|
|
144
144
|
};
|
|
145
145
|
var _default = exports.default = BaseDrawer;
|