colibri-ui 0.8.62 → 0.8.63
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/Calendar/components/Month/Month.d.ts +1 -3
- package/Calendar/components/Month/Month.js +26 -12
- package/Calendar/components/Month/index.module.css +7 -3
- package/Calendar/index.js +99 -12
- package/Calendar/index.module.css +1 -0
- package/Calendar/index.props.d.ts +1 -0
- package/Chip/index.js +1 -1
- package/ClickOutside/index.d.ts +1 -1
- package/ClickOutside/index.js +3 -1
- package/Icons/Close.js +1 -0
- package/Icons/Exit.js +1 -0
- package/Icons/Help.js +1 -0
- package/InputRadio/index.js +1 -1
- package/Modal/Modal.module.css +1 -1
- package/Modal/components/Close/Close.module.css +11 -1
- package/Modal/components/Close/index.d.ts +4 -2
- package/Modal/components/Close/index.js +11 -9
- package/Modal/components/Content/Content.module.css +1 -1
- package/Modal/components/Content/index.d.ts +1 -1
- package/Modal/components/Content/index.js +0 -1
- package/Modal/components/Title/Title.module.css +1 -1
- package/Modal/components/Title/index.d.ts +1 -1
- package/Modal/components/Title/index.js +0 -1
- package/Modal/index.js +2 -2
- package/MultiSelect/index.js +1 -3
- package/TextArea/TextArea.module.css +1 -2
- package/TextArea/index.props.d.ts +1 -1
- package/esm/Calendar/components/Month/Month.d.ts +1 -3
- package/esm/Calendar/components/Month/Month.js +27 -13
- package/esm/Calendar/components/Month/index.module.css +7 -3
- package/esm/Calendar/index.js +99 -13
- package/esm/Calendar/index.module.css +1 -0
- package/esm/Calendar/index.props.d.ts +1 -0
- package/esm/Chip/index.js +1 -1
- package/esm/ClickOutside/index.d.ts +1 -1
- package/esm/ClickOutside/index.js +3 -1
- package/esm/Icons/Close.js +1 -0
- package/esm/Icons/Exit.js +1 -0
- package/esm/Icons/Help.js +1 -0
- package/esm/InputRadio/index.js +1 -1
- package/esm/Modal/Modal.module.css +1 -1
- package/esm/Modal/components/Close/Close.module.css +11 -1
- package/esm/Modal/components/Close/index.d.ts +4 -2
- package/esm/Modal/components/Close/index.js +11 -9
- package/esm/Modal/components/Content/Content.module.css +1 -1
- package/esm/Modal/components/Content/index.d.ts +1 -1
- package/esm/Modal/components/Content/index.js +0 -1
- package/esm/Modal/components/Title/Title.module.css +1 -1
- package/esm/Modal/components/Title/index.d.ts +1 -1
- package/esm/Modal/components/Title/index.js +0 -1
- package/esm/Modal/index.js +2 -2
- package/esm/MultiSelect/index.js +1 -3
- package/esm/TextArea/TextArea.module.css +1 -2
- package/esm/TextArea/index.props.d.ts +1 -1
- package/esm/libs/requestIdleCallback/index.d.ts +1 -1
- package/esm/libs/requestIdleCallback/index.js +0 -3
- package/libs/requestIdleCallback/index.d.ts +1 -1
- package/libs/requestIdleCallback/index.js +0 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { useRef, useEffect, useCallback, useMemo } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { leadingZeros } from '../../../libs/numbers/leadingZeros.js';
|
|
6
6
|
import Typography from '../../../Typography/index.js';
|
|
@@ -10,8 +10,8 @@ import styles from './index.module.css';
|
|
|
10
10
|
|
|
11
11
|
var WEEK_DAYS = Array.from({
|
|
12
12
|
length: 7
|
|
13
|
-
}, function (_,
|
|
14
|
-
var index =
|
|
13
|
+
}, function (_, weekDayIndex) {
|
|
14
|
+
var index = weekDayIndex + 1;
|
|
15
15
|
return {
|
|
16
16
|
index: index,
|
|
17
17
|
name: getShortWeekDayNameByIndex(index),
|
|
@@ -49,21 +49,33 @@ var DayButton = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
49
49
|
var day = _ref2.day,
|
|
50
50
|
isActive = _ref2.isActive,
|
|
51
51
|
isSelected = _ref2.isSelected,
|
|
52
|
+
isFocused = _ref2.isFocused,
|
|
52
53
|
dateString = _ref2.dateString,
|
|
53
54
|
onDayClick = _ref2.onDayClick;
|
|
55
|
+
var buttonRef = useRef(null);
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
if (isFocused && buttonRef.current) {
|
|
58
|
+
buttonRef.current.focus({
|
|
59
|
+
preventScroll: true
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}, [isFocused]);
|
|
54
63
|
var handleClick = useCallback(function () {
|
|
55
64
|
if (isActive) {
|
|
56
65
|
onDayClick(dateString);
|
|
57
66
|
}
|
|
58
67
|
}, [isActive, dateString, onDayClick]);
|
|
59
|
-
var
|
|
60
|
-
var
|
|
68
|
+
var dayInnerActiveClass = isActive ? "day-inner-active" : "";
|
|
69
|
+
var backgroundStyle = isSelected ? SELECTED_BG_STYLE : TRANSPARENT_BG_STYLE;
|
|
61
70
|
return /*#__PURE__*/React.createElement("button", {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
ref: buttonRef,
|
|
72
|
+
className: clsx(styles["day-inner"], dayInnerActiveClass, _defineProperty({}, styles["day-focused"], isFocused)),
|
|
73
|
+
style: backgroundStyle,
|
|
65
74
|
type: "button",
|
|
66
|
-
|
|
75
|
+
tabIndex: isFocused ? 0 : -1,
|
|
76
|
+
onClick: isActive ? handleClick : undefined,
|
|
77
|
+
"aria-label": dateString,
|
|
78
|
+
"aria-pressed": isSelected
|
|
67
79
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
68
80
|
size: "s",
|
|
69
81
|
style: {
|
|
@@ -82,7 +94,8 @@ var Month = function Month(props) {
|
|
|
82
94
|
selectedDate = props.selectedDate,
|
|
83
95
|
selectedPeriod = props.selectedPeriod,
|
|
84
96
|
activeDays = props.activeDays,
|
|
85
|
-
availableDates = props.availableDates
|
|
97
|
+
availableDates = props.availableDates,
|
|
98
|
+
focusedDate = props.focusedDate;
|
|
86
99
|
var year = startDate.getFullYear();
|
|
87
100
|
var month = useMemo(function () {
|
|
88
101
|
return leadingZeros(startDate.getMonth() + 1, 2);
|
|
@@ -131,11 +144,11 @@ var Month = function Month(props) {
|
|
|
131
144
|
key: "week-".concat(weekIndex),
|
|
132
145
|
className: styles.week
|
|
133
146
|
}, days.map(function (day, dayIndex) {
|
|
134
|
-
var
|
|
147
|
+
var itemKey = "day-".concat(dayIndex);
|
|
135
148
|
if (day.isDummy) {
|
|
136
149
|
return /*#__PURE__*/React.createElement("li", {
|
|
137
150
|
className: styles.day,
|
|
138
|
-
key:
|
|
151
|
+
key: itemKey
|
|
139
152
|
});
|
|
140
153
|
}
|
|
141
154
|
var dateString = "".concat(year, "-").concat(month, "-").concat(leadingZeros(day.day, 2));
|
|
@@ -144,11 +157,12 @@ var Month = function Month(props) {
|
|
|
144
157
|
isEndOfSelection: day.isEndOfSelection,
|
|
145
158
|
isSelected: day.isSelected,
|
|
146
159
|
isInSelectedRange: day.isInSelectedRange,
|
|
147
|
-
key:
|
|
160
|
+
key: itemKey
|
|
148
161
|
}, /*#__PURE__*/React.createElement(DayButton, {
|
|
149
162
|
day: day.day,
|
|
150
163
|
isActive: Boolean(day.isActive),
|
|
151
164
|
isSelected: Boolean(day.isSelected),
|
|
165
|
+
isFocused: focusedDate === dateString,
|
|
152
166
|
dateString: dateString,
|
|
153
167
|
onDayClick: onDayClick
|
|
154
168
|
}));
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
min-height: 32px;
|
|
31
31
|
position: relative;
|
|
32
32
|
text-align: center;
|
|
33
|
-
width: 32px;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
.legend {
|
|
@@ -47,7 +46,6 @@
|
|
|
47
46
|
height: 32px;
|
|
48
47
|
position: relative;
|
|
49
48
|
text-align: center;
|
|
50
|
-
width: 32px;
|
|
51
49
|
z-index: 0;
|
|
52
50
|
}
|
|
53
51
|
.selected-range-day:hover {
|
|
@@ -123,12 +121,13 @@
|
|
|
123
121
|
border-radius: 6px;
|
|
124
122
|
display: inline-block;
|
|
125
123
|
height: 32px;
|
|
124
|
+
max-width: 32px;
|
|
126
125
|
outline: 0;
|
|
127
126
|
padding: 0;
|
|
128
127
|
position: relative;
|
|
129
128
|
text-align: center;
|
|
130
129
|
transition: background 0.3s ease;
|
|
131
|
-
width:
|
|
130
|
+
width: 100%;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
.day-inner-active {
|
|
@@ -136,4 +135,9 @@
|
|
|
136
135
|
}
|
|
137
136
|
.day-inner-active:hover {
|
|
138
137
|
background: var(--palette-bg-2);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.day-focused {
|
|
141
|
+
outline: 2px solid var(--palette-black, #000);
|
|
142
|
+
outline-offset: 2px;
|
|
139
143
|
}
|
package/esm/Calendar/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
-
import
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import React__default, { useRef, useMemo, useReducer, useEffect, useCallback } from 'react';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
5
|
import { requestIdleCallback } from '../libs/requestIdleCallback/index.js';
|
|
5
6
|
import { getDaysDiff } from '../helpers/date/index.js';
|
|
@@ -38,11 +39,21 @@ var calendarReducer = function calendarReducer(state, action) {
|
|
|
38
39
|
return Object.assign(Object.assign({}, state), {
|
|
39
40
|
isRangeCompleted: action.payload
|
|
40
41
|
});
|
|
42
|
+
case "SET_FOCUSED_DATE":
|
|
43
|
+
return Object.assign(Object.assign({}, state), {
|
|
44
|
+
focusedDate: action.payload
|
|
45
|
+
});
|
|
46
|
+
case "NAVIGATE_KEYBOARD":
|
|
47
|
+
return Object.assign(Object.assign({}, state), {
|
|
48
|
+
focusedDate: action.payload.focusedDate,
|
|
49
|
+
currentMonthOffset: Math.max(0, action.payload.monthOffset)
|
|
50
|
+
});
|
|
41
51
|
case "SELECT_DATE":
|
|
42
52
|
return Object.assign(Object.assign({}, state), {
|
|
43
53
|
selectedDate: action.payload.date,
|
|
44
54
|
selectedPeriod: action.payload.period,
|
|
45
55
|
isRangeCompleted: action.payload.rangeCompleted,
|
|
56
|
+
focusedDate: action.payload.date,
|
|
46
57
|
currentMonthOffset: getNumberOfMonthsBetweenDates(action.payload.startMonth, action.payload.date)
|
|
47
58
|
});
|
|
48
59
|
case "INCREMENT_MONTH_OFFSET":
|
|
@@ -75,6 +86,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
75
86
|
activeDates = _ref.activeDates,
|
|
76
87
|
datePresets = _ref.datePresets,
|
|
77
88
|
availableDates = _ref.availableDates,
|
|
89
|
+
maxDate = _ref.maxDate,
|
|
78
90
|
canSelectRange = _ref.canSelectRange,
|
|
79
91
|
onChange = _ref.onChange,
|
|
80
92
|
onCancel = _ref.onCancel,
|
|
@@ -85,11 +97,21 @@ var Calendar = function Calendar(_ref) {
|
|
|
85
97
|
className = _ref.className,
|
|
86
98
|
_ref$titleSize = _ref.titleSize,
|
|
87
99
|
titleSize = _ref$titleSize === void 0 ? "h3" : _ref$titleSize;
|
|
88
|
-
var
|
|
100
|
+
var rootElementRef = useRef(null);
|
|
89
101
|
var startMonth = getStartMonth({
|
|
90
102
|
today: today,
|
|
91
103
|
activeDates: activeDates
|
|
92
104
|
});
|
|
105
|
+
var maxMonthOffset = useMemo(function () {
|
|
106
|
+
var candidates = [];
|
|
107
|
+
if (maxDate) candidates.push(maxDate);
|
|
108
|
+
if (availableDates && availableDates.length > 0) {
|
|
109
|
+
candidates.push(_toConsumableArray(availableDates).sort().at(-1));
|
|
110
|
+
}
|
|
111
|
+
if (candidates.length === 0) return Infinity;
|
|
112
|
+
var lastDate = [].concat(candidates).sort().at(-1);
|
|
113
|
+
return getNumberOfMonthsBetweenDates(startMonth, lastDate);
|
|
114
|
+
}, [maxDate, availableDates, startMonth]);
|
|
93
115
|
var getInitialOffset = function getInitialOffset() {
|
|
94
116
|
if (initialSelectedDate) {
|
|
95
117
|
return getNumberOfMonthsBetweenDates(startMonth, initialSelectedDate);
|
|
@@ -103,17 +125,32 @@ var Calendar = function Calendar(_ref) {
|
|
|
103
125
|
selectedPeriod: initialSelectedPeriod,
|
|
104
126
|
currentMonthOffset: getInitialOffset(),
|
|
105
127
|
contentWidth: 0,
|
|
106
|
-
isRangeCompleted: true
|
|
128
|
+
isRangeCompleted: true,
|
|
129
|
+
focusedDate: initialSelectedDate
|
|
107
130
|
}),
|
|
108
131
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
109
132
|
state = _useReducer2[0],
|
|
110
133
|
dispatch = _useReducer2[1];
|
|
111
134
|
useEffect(function () {
|
|
112
|
-
var
|
|
135
|
+
var rootElement = rootElementRef.current;
|
|
136
|
+
if (!rootElement) return;
|
|
113
137
|
dispatch({
|
|
114
138
|
type: "SET_CONTENT_WIDTH",
|
|
115
|
-
payload:
|
|
139
|
+
payload: rootElement.offsetWidth
|
|
140
|
+
});
|
|
141
|
+
var observer = new ResizeObserver(function () {
|
|
142
|
+
var width = rootElement.offsetWidth;
|
|
143
|
+
if (width) {
|
|
144
|
+
dispatch({
|
|
145
|
+
type: "SET_CONTENT_WIDTH",
|
|
146
|
+
payload: width
|
|
147
|
+
});
|
|
148
|
+
}
|
|
116
149
|
});
|
|
150
|
+
observer.observe(rootElement);
|
|
151
|
+
return function () {
|
|
152
|
+
return observer.disconnect();
|
|
153
|
+
};
|
|
117
154
|
}, []);
|
|
118
155
|
var showPrevMonth = function showPrevMonth(event) {
|
|
119
156
|
event.preventDefault();
|
|
@@ -197,21 +234,66 @@ var Calendar = function Calendar(_ref) {
|
|
|
197
234
|
onCancel();
|
|
198
235
|
}
|
|
199
236
|
}, [onCancel]);
|
|
237
|
+
var shiftDate = useCallback(function (date, days) {
|
|
238
|
+
var shiftedDate = new Date(date);
|
|
239
|
+
shiftedDate.setDate(shiftedDate.getDate() + days);
|
|
240
|
+
var year = shiftedDate.getFullYear();
|
|
241
|
+
var month = String(shiftedDate.getMonth() + 1).padStart(2, "0");
|
|
242
|
+
var day = String(shiftedDate.getDate()).padStart(2, "0");
|
|
243
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
244
|
+
}, []);
|
|
245
|
+
var handleKeyDown = useCallback(function (event) {
|
|
246
|
+
var _a, _b;
|
|
247
|
+
var baseDateForNavigation = (_b = (_a = state.focusedDate) !== null && _a !== void 0 ? _a : state.selectedDate) !== null && _b !== void 0 ? _b : today;
|
|
248
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
var nextDate = shiftDate(baseDateForNavigation, event.key === "ArrowRight" ? 1 : 7);
|
|
251
|
+
var nextMonthOffset = getNumberOfMonthsBetweenDates(startMonth, nextDate);
|
|
252
|
+
if (nextMonthOffset <= maxMonthOffset) {
|
|
253
|
+
dispatch({
|
|
254
|
+
type: "NAVIGATE_KEYBOARD",
|
|
255
|
+
payload: {
|
|
256
|
+
focusedDate: nextDate,
|
|
257
|
+
monthOffset: nextMonthOffset
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
var prevDate = shiftDate(baseDateForNavigation, event.key === "ArrowLeft" ? -1 : -7);
|
|
264
|
+
var prevMonthOffset = getNumberOfMonthsBetweenDates(startMonth, prevDate);
|
|
265
|
+
if (prevMonthOffset >= 0) {
|
|
266
|
+
dispatch({
|
|
267
|
+
type: "NAVIGATE_KEYBOARD",
|
|
268
|
+
payload: {
|
|
269
|
+
focusedDate: prevDate,
|
|
270
|
+
monthOffset: prevMonthOffset
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
} else if (event.key === "Enter" || event.key === " ") {
|
|
275
|
+
event.preventDefault();
|
|
276
|
+
if (baseDateForNavigation) {
|
|
277
|
+
handleDayClick(baseDateForNavigation);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}, [state.focusedDate, state.selectedDate, today, startMonth, maxMonthOffset, shiftDate, handleDayClick]);
|
|
200
281
|
var getMonthStartDate = useCallback(function (shiftIndex) {
|
|
201
282
|
var startDate = new Date(startMonth);
|
|
202
283
|
startDate.setMonth(startDate.getMonth() + shiftIndex);
|
|
203
284
|
return startDate;
|
|
204
285
|
}, [startMonth]);
|
|
205
|
-
var
|
|
286
|
+
var commonMonthProps = useMemo(function () {
|
|
206
287
|
return {
|
|
207
288
|
selectedDate: state.selectedDate,
|
|
208
289
|
selectedPeriod: state.selectedPeriod,
|
|
209
290
|
activeDates: activeDates,
|
|
210
291
|
availableDates: availableDates,
|
|
211
292
|
isRangeCompleted: state.isRangeCompleted,
|
|
212
|
-
onDayClick: handleDayClick
|
|
293
|
+
onDayClick: handleDayClick,
|
|
294
|
+
focusedDate: state.focusedDate
|
|
213
295
|
};
|
|
214
|
-
}, [state.selectedDate, state.selectedPeriod, activeDates, availableDates, state.isRangeCompleted, handleDayClick]);
|
|
296
|
+
}, [state.selectedDate, state.selectedPeriod, activeDates, availableDates, state.isRangeCompleted, handleDayClick, state.focusedDate]);
|
|
215
297
|
useEffect(function () {
|
|
216
298
|
dispatch({
|
|
217
299
|
type: "SYNC_INITIAL_STATE",
|
|
@@ -228,7 +310,11 @@ var Calendar = function Calendar(_ref) {
|
|
|
228
310
|
minWidth: "".concat(minWidth, "px")
|
|
229
311
|
},
|
|
230
312
|
"data-testid": "calendar",
|
|
231
|
-
ref:
|
|
313
|
+
ref: rootElementRef,
|
|
314
|
+
role: "application",
|
|
315
|
+
"aria-label": "Calendar",
|
|
316
|
+
tabIndex: 0,
|
|
317
|
+
onKeyDown: handleKeyDown
|
|
232
318
|
}, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.contentWidth ? (/*#__PURE__*/React__default.createElement("div", {
|
|
233
319
|
"data-component": "Months",
|
|
234
320
|
className: styles.months,
|
|
@@ -238,12 +324,12 @@ var Calendar = function Calendar(_ref) {
|
|
|
238
324
|
}, [state.currentMonthOffset - 1, state.currentMonthOffset, state.currentMonthOffset + 1].filter(function (index) {
|
|
239
325
|
return index >= 0;
|
|
240
326
|
}).map(function (index) {
|
|
241
|
-
var
|
|
327
|
+
var monthProps = Object.assign(Object.assign({}, commonMonthProps), {
|
|
242
328
|
today: today,
|
|
243
329
|
startDate: getMonthStartDate(index),
|
|
244
330
|
offsetLeft: index * state.contentWidth
|
|
245
331
|
});
|
|
246
|
-
return /*#__PURE__*/React__default.createElement(Month, Object.assign({},
|
|
332
|
+
return /*#__PURE__*/React__default.createElement(Month, Object.assign({}, monthProps, {
|
|
247
333
|
titleSize: titleSize,
|
|
248
334
|
key: "month-".concat(index)
|
|
249
335
|
}));
|
|
@@ -252,7 +338,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
252
338
|
today: today,
|
|
253
339
|
startDate: getMonthStartDate(state.currentMonthOffset),
|
|
254
340
|
offsetLeft: 0
|
|
255
|
-
},
|
|
341
|
+
}, commonMonthProps))), /*#__PURE__*/React__default.createElement("button", {
|
|
256
342
|
className: clsx(styles["month-control"], styles["month-control-prev"]),
|
|
257
343
|
onClick: showPrevMonth,
|
|
258
344
|
disabled: state.currentMonthOffset <= 0,
|
|
@@ -264,7 +350,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
264
350
|
})), /*#__PURE__*/React__default.createElement("button", {
|
|
265
351
|
className: clsx(styles["month-control"], styles["month-control-next"]),
|
|
266
352
|
onClick: showNextMonth,
|
|
267
|
-
disabled: state.currentMonthOffset >=
|
|
353
|
+
disabled: state.currentMonthOffset >= maxMonthOffset,
|
|
268
354
|
type: "button",
|
|
269
355
|
role: "button",
|
|
270
356
|
"aria-label": "Next"
|
package/esm/Chip/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var Chip = function Chip(_a) {
|
|
|
31
31
|
className: styles["content-inner"]
|
|
32
32
|
}, children)), iconEnd && (
|
|
33
33
|
/*#__PURE__*/
|
|
34
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
34
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
35
35
|
React__default.createElement("span", {
|
|
36
36
|
className: styles["icon-right"],
|
|
37
37
|
role: "button",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FC, type PropsWithChildren } from "react";
|
|
2
2
|
type ClickOutsideProps = {
|
|
3
|
-
onClick: (
|
|
3
|
+
onClick: (event: MouseEvent | TouchEvent) => void;
|
|
4
4
|
};
|
|
5
5
|
declare const ClickOutside: FC<PropsWithChildren<ClickOutsideProps>>;
|
|
6
6
|
export default ClickOutside;
|
|
@@ -14,6 +14,7 @@ function useMergedRefs() {
|
|
|
14
14
|
if (!ref) continue;
|
|
15
15
|
if (typeof ref === "function") ref(node);else ref.current = node;
|
|
16
16
|
}
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
18
|
}, refs);
|
|
18
19
|
}
|
|
19
20
|
var ClickOutside = function ClickOutside(_ref) {
|
|
@@ -22,8 +23,9 @@ var ClickOutside = function ClickOutside(_ref) {
|
|
|
22
23
|
var _a;
|
|
23
24
|
var localRef = useRef(null);
|
|
24
25
|
useOnClickOutside(localRef, onClick);
|
|
26
|
+
var childRef = /*#__PURE__*/isValidElement(children) ? (_a = children.props) === null || _a === void 0 ? void 0 : _a.ref : undefined;
|
|
27
|
+
var mergedRef = useMergedRefs(localRef, childRef);
|
|
25
28
|
if (! /*#__PURE__*/isValidElement(children)) return null;
|
|
26
|
-
var mergedRef = useMergedRefs(localRef, (_a = children.props) === null || _a === void 0 ? void 0 : _a.ref);
|
|
27
29
|
return /*#__PURE__*/cloneElement(children, {
|
|
28
30
|
ref: mergedRef
|
|
29
31
|
});
|
package/esm/Icons/Close.js
CHANGED
package/esm/Icons/Exit.js
CHANGED
package/esm/Icons/Help.js
CHANGED
package/esm/InputRadio/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var InputRadio = /*#__PURE__*/memo(function (_a) {
|
|
|
27
27
|
rest = __rest(_a, ["checked", "children", "className", "containerClassName", "disabled", "error", "id", "name", "note", "onBlur", "onFocus", "onChange", "onClick", "onMouseEnter", "style", "text", "value", "testid"]);
|
|
28
28
|
return (
|
|
29
29
|
/*#__PURE__*/
|
|
30
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
30
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
31
31
|
React__default.createElement("label", {
|
|
32
32
|
className: clsx(styles.label, className),
|
|
33
33
|
htmlFor: id,
|
|
@@ -4,15 +4,17 @@ import CloseIcon from '../../../Icons/Close.js';
|
|
|
4
4
|
import styles from './Close.module.css';
|
|
5
5
|
|
|
6
6
|
var Close = function Close(_ref) {
|
|
7
|
-
var onClick = _ref.onClick
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
var onClick = _ref.onClick,
|
|
8
|
+
ariaLabel = _ref["aria-label"];
|
|
9
|
+
return /*#__PURE__*/React__default.createElement("button", {
|
|
10
|
+
type: "button",
|
|
11
|
+
onClick: onClick,
|
|
12
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Close",
|
|
13
|
+
className: styles["close-button"]
|
|
14
|
+
}, /*#__PURE__*/React__default.createElement(CloseIcon, {
|
|
15
|
+
width: 18,
|
|
16
|
+
height: 18
|
|
17
|
+
}));
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export { Close as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import styles from './Content.module.css';
|
|
3
3
|
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
4
|
var Content = function Content(_ref) {
|
|
6
5
|
var children = _ref.children;
|
|
7
6
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2,7 +2,6 @@ import React__default from 'react';
|
|
|
2
2
|
import Typography from '../../../Typography/index.js';
|
|
3
3
|
import styles from './Title.module.css';
|
|
4
4
|
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
6
5
|
var Title = function Title(_ref) {
|
|
7
6
|
var children = _ref.children;
|
|
8
7
|
return /*#__PURE__*/React__default.createElement(Typography, {
|
package/esm/Modal/index.js
CHANGED
|
@@ -24,8 +24,8 @@ var Modal = function Modal(_ref) {
|
|
|
24
24
|
var handleClose = useCallback(function () {
|
|
25
25
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
26
26
|
}, [onClose]);
|
|
27
|
-
var handleOverlayClick = useCallback(function (
|
|
28
|
-
if (
|
|
27
|
+
var handleOverlayClick = useCallback(function (event) {
|
|
28
|
+
if (event.target === event.currentTarget) {
|
|
29
29
|
handleClose();
|
|
30
30
|
}
|
|
31
31
|
}, [handleClose]);
|
package/esm/MultiSelect/index.js
CHANGED
|
@@ -76,9 +76,7 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
76
76
|
return preparedGroups.flatMap(function (_ref3) {
|
|
77
77
|
var groupVal = _ref3.value,
|
|
78
78
|
options = _ref3.options;
|
|
79
|
-
return options
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
81
|
-
.filter(function (_ref4) {
|
|
79
|
+
return options.filter(function (_ref4) {
|
|
82
80
|
var selected = _ref4.selected;
|
|
83
81
|
return selected;
|
|
84
82
|
}).map(
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
.textarea {
|
|
2
2
|
background: transparent;
|
|
3
3
|
border: none;
|
|
4
|
+
color: inherit;
|
|
4
5
|
flex: 1;
|
|
5
6
|
font: inherit;
|
|
6
7
|
outline: none;
|
|
7
|
-
overflow: auto;
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
padding: 7px 0;
|
|
10
10
|
resize: none;
|
|
11
|
-
text-overflow: unset;
|
|
12
11
|
text-overflow: ellipsis;
|
|
13
12
|
}
|
|
14
13
|
.textarea::placeholder {
|
|
@@ -7,7 +7,7 @@ export interface ITextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextArea
|
|
|
7
7
|
hint?: ReactNode;
|
|
8
8
|
hasError?: boolean;
|
|
9
9
|
required?: boolean;
|
|
10
|
-
onChange?: (value: string,
|
|
10
|
+
onChange?: (value: string, event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
11
11
|
inputRef?: ForwardedRef<HTMLTextAreaElement>;
|
|
12
12
|
ref?: React.Ref<HTMLDivElement>;
|
|
13
13
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2
1
|
function requestIdleCallback(callback, options) {
|
|
3
2
|
if (typeof window !== "undefined" && "requestIdleCallback" in window) {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
|
-
// @ts-expect-error
|
|
6
3
|
window.requestIdleCallback(callback, options);
|
|
7
4
|
}
|
|
8
5
|
setTimeout(callback, 10);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4
3
|
function requestIdleCallback(callback, options) {
|
|
5
4
|
if (typeof window !== "undefined" && "requestIdleCallback" in window) {
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
-
// @ts-expect-error
|
|
8
5
|
window.requestIdleCallback(callback, options);
|
|
9
6
|
}
|
|
10
7
|
setTimeout(callback, 10);
|