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.
Files changed (59) hide show
  1. package/Calendar/components/Month/Month.d.ts +1 -3
  2. package/Calendar/components/Month/Month.js +26 -12
  3. package/Calendar/components/Month/index.module.css +7 -3
  4. package/Calendar/index.js +99 -12
  5. package/Calendar/index.module.css +1 -0
  6. package/Calendar/index.props.d.ts +1 -0
  7. package/Chip/index.js +1 -1
  8. package/ClickOutside/index.d.ts +1 -1
  9. package/ClickOutside/index.js +3 -1
  10. package/Icons/Close.js +1 -0
  11. package/Icons/Exit.js +1 -0
  12. package/Icons/Help.js +1 -0
  13. package/InputRadio/index.js +1 -1
  14. package/Modal/Modal.module.css +1 -1
  15. package/Modal/components/Close/Close.module.css +11 -1
  16. package/Modal/components/Close/index.d.ts +4 -2
  17. package/Modal/components/Close/index.js +11 -9
  18. package/Modal/components/Content/Content.module.css +1 -1
  19. package/Modal/components/Content/index.d.ts +1 -1
  20. package/Modal/components/Content/index.js +0 -1
  21. package/Modal/components/Title/Title.module.css +1 -1
  22. package/Modal/components/Title/index.d.ts +1 -1
  23. package/Modal/components/Title/index.js +0 -1
  24. package/Modal/index.js +2 -2
  25. package/MultiSelect/index.js +1 -3
  26. package/TextArea/TextArea.module.css +1 -2
  27. package/TextArea/index.props.d.ts +1 -1
  28. package/esm/Calendar/components/Month/Month.d.ts +1 -3
  29. package/esm/Calendar/components/Month/Month.js +27 -13
  30. package/esm/Calendar/components/Month/index.module.css +7 -3
  31. package/esm/Calendar/index.js +99 -13
  32. package/esm/Calendar/index.module.css +1 -0
  33. package/esm/Calendar/index.props.d.ts +1 -0
  34. package/esm/Chip/index.js +1 -1
  35. package/esm/ClickOutside/index.d.ts +1 -1
  36. package/esm/ClickOutside/index.js +3 -1
  37. package/esm/Icons/Close.js +1 -0
  38. package/esm/Icons/Exit.js +1 -0
  39. package/esm/Icons/Help.js +1 -0
  40. package/esm/InputRadio/index.js +1 -1
  41. package/esm/Modal/Modal.module.css +1 -1
  42. package/esm/Modal/components/Close/Close.module.css +11 -1
  43. package/esm/Modal/components/Close/index.d.ts +4 -2
  44. package/esm/Modal/components/Close/index.js +11 -9
  45. package/esm/Modal/components/Content/Content.module.css +1 -1
  46. package/esm/Modal/components/Content/index.d.ts +1 -1
  47. package/esm/Modal/components/Content/index.js +0 -1
  48. package/esm/Modal/components/Title/Title.module.css +1 -1
  49. package/esm/Modal/components/Title/index.d.ts +1 -1
  50. package/esm/Modal/components/Title/index.js +0 -1
  51. package/esm/Modal/index.js +2 -2
  52. package/esm/MultiSelect/index.js +1 -3
  53. package/esm/TextArea/TextArea.module.css +1 -2
  54. package/esm/TextArea/index.props.d.ts +1 -1
  55. package/esm/libs/requestIdleCallback/index.d.ts +1 -1
  56. package/esm/libs/requestIdleCallback/index.js +0 -3
  57. package/libs/requestIdleCallback/index.d.ts +1 -1
  58. package/libs/requestIdleCallback/index.js +0 -3
  59. 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 (_, idx) {
14
- var index = idx + 1;
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 dayInnerActive = isActive ? "day-inner-active" : "";
60
- var bgStyle = isSelected ? SELECTED_BG_STYLE : TRANSPARENT_BG_STYLE;
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
- className: clsx(styles["day-inner"], dayInnerActive),
63
- style: bgStyle,
64
- role: "button",
71
+ ref: buttonRef,
72
+ className: clsx(styles["day-inner"], dayInnerActiveClass, _defineProperty({}, styles["day-focused"], isFocused)),
73
+ style: backgroundStyle,
65
74
  type: "button",
66
- onClick: isActive ? handleClick : undefined
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 key = "day-".concat(dayIndex);
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: 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: 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: 32px;
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
  }
@@ -1,5 +1,6 @@
1
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
- import React__default, { useRef, useReducer, useEffect, useCallback, useMemo } from 'react';
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 $root = useRef(null);
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 _a;
135
+ var rootElement = rootElementRef.current;
136
+ if (!rootElement) return;
113
137
  dispatch({
114
138
  type: "SET_CONTENT_WIDTH",
115
- payload: ((_a = $root.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0
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 commonAttrs = useMemo(function () {
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: $root
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 attrs = Object.assign(Object.assign({}, commonAttrs), {
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({}, attrs, {
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
- }, commonAttrs))), /*#__PURE__*/React__default.createElement("button", {
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 >= 11,
353
+ disabled: state.currentMonthOffset >= maxMonthOffset,
268
354
  type: "button",
269
355
  role: "button",
270
356
  "aria-label": "Next"
@@ -90,4 +90,5 @@
90
90
  .months > div {
91
91
  position: absolute;
92
92
  top: 0;
93
+ width: 100%;
93
94
  }
@@ -12,6 +12,7 @@ export type CalendarProps = {
12
12
  activeDates?: string[];
13
13
  datePresets?: Preset[];
14
14
  availableDates?: string[];
15
+ maxDate?: string;
15
16
  onChange?: (payload: CalendarPayload) => void;
16
17
  onCancel?: () => void;
17
18
  withContinueButton?: boolean;
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, jsx-a11y/no-static-element-interactions
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: (e: MouseEvent | TouchEvent) => void;
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
  });
@@ -12,6 +12,7 @@ var CloseIcon = (function (_a) {
12
12
  xmlns: "http://www.w3.org/2000/svg",
13
13
  width: width,
14
14
  height: height,
15
+ viewBox: "0 0 24 24",
15
16
  ref: ref
16
17
  }, props, {
17
18
  fill: "none"
package/esm/Icons/Exit.js CHANGED
@@ -14,6 +14,7 @@ var Exit = (function (_a) {
14
14
  xmlns: "http://www.w3.org/2000/svg",
15
15
  width: width,
16
16
  height: height,
17
+ viewBox: "0 0 24 24",
17
18
  ref: ref
18
19
  }, props, {
19
20
  fill: "none"
package/esm/Icons/Help.js CHANGED
@@ -12,6 +12,7 @@ var Help = (function (_a) {
12
12
  xmlns: "http://www.w3.org/2000/svg",
13
13
  width: width,
14
14
  height: height,
15
+ viewBox: "0 0 24 24",
15
16
  ref: ref
16
17
  }, props, {
17
18
  fill: "none"
@@ -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, jsx-a11y/no-static-element-interactions
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,
@@ -12,7 +12,7 @@
12
12
  border-bottom: 1px solid var(--palette-bg-2);
13
13
  display: flex;
14
14
  justify-content: space-between;
15
- padding-right: 20px;
15
+ padding: 16px 20px;
16
16
  }
17
17
 
18
18
  .close-wrapper {
@@ -1,3 +1,13 @@
1
- .close {
1
+ .close-button {
2
+ align-items: center;
3
+ background: none;
4
+ border: none;
5
+ box-sizing: content-box;
2
6
  cursor: pointer;
7
+ display: flex;
8
+ flex-shrink: 0;
9
+ justify-content: center;
10
+ line-height: 0;
11
+ outline: none;
12
+ padding: 8px;
3
13
  }
@@ -1,5 +1,7 @@
1
1
  import type { FC } from "react";
2
- declare const Close: FC<{
2
+ type CloseButtonProps = {
3
3
  onClick?: () => void;
4
- }>;
4
+ "aria-label"?: string;
5
+ };
6
+ declare const Close: FC<CloseButtonProps>;
5
7
  export default Close;
@@ -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
- return (
9
- /*#__PURE__*/
10
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
11
- React__default.createElement(CloseIcon, {
12
- className: styles.close,
13
- onClick: onClick
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 };
@@ -2,5 +2,5 @@
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  overflow-y: auto;
5
- padding: 10px;
5
+ padding: 16px 20px;
6
6
  }
@@ -1,3 +1,3 @@
1
1
  import type { FC, PropsWithChildren } from "react";
2
- declare const Content: FC<PropsWithChildren<{}>>;
2
+ declare const Content: FC<PropsWithChildren>;
3
3
  export default Content;
@@ -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", {
@@ -1,9 +1,9 @@
1
1
  .wrapper {
2
2
  display: flex;
3
- padding: 16px;
4
3
  }
5
4
 
6
5
  .title {
7
6
  margin: 0;
7
+ min-width: 0;
8
8
  padding: 0;
9
9
  }
@@ -1,3 +1,3 @@
1
1
  import type { FC, PropsWithChildren } from "react";
2
- declare const Title: FC<PropsWithChildren<{}>>;
2
+ declare const Title: FC<PropsWithChildren>;
3
3
  export default Title;
@@ -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, {
@@ -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 (e) {
28
- if (e.target === e.currentTarget) {
27
+ var handleOverlayClick = useCallback(function (event) {
28
+ if (event.target === event.currentTarget) {
29
29
  handleClose();
30
30
  }
31
31
  }, [handleClose]);
@@ -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, e: ChangeEvent<HTMLTextAreaElement>) => void;
10
+ onChange?: (value: string, event: ChangeEvent<HTMLTextAreaElement>) => void;
11
11
  inputRef?: ForwardedRef<HTMLTextAreaElement>;
12
12
  ref?: React.Ref<HTMLDivElement>;
13
13
  }
@@ -1,5 +1,5 @@
1
1
  type Options = {
2
2
  timeout: number;
3
3
  };
4
- export declare function requestIdleCallback(callback: Function, options?: Options): void;
4
+ export declare function requestIdleCallback(callback: () => void, options?: Options): void;
5
5
  export {};
@@ -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,5 +1,5 @@
1
1
  type Options = {
2
2
  timeout: number;
3
3
  };
4
- export declare function requestIdleCallback(callback: Function, options?: Options): void;
4
+ export declare function requestIdleCallback(callback: () => void, options?: Options): void;
5
5
  export {};
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.8.62",
3
+ "version": "0.8.63",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",