colibri-ui 0.7.152 → 0.7.153
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/index.js +8 -4
- package/Datepicker/components/DatePicker/index.d.ts +1 -1
- package/Datepicker/components/DatePicker/index.js +23 -10
- package/Datepicker/components/DatePicker/index.module.css +27 -20
- package/esm/Calendar/index.js +8 -4
- package/esm/Datepicker/components/DatePicker/index.d.ts +1 -1
- package/esm/Datepicker/components/DatePicker/index.js +23 -10
- package/esm/Datepicker/components/DatePicker/index.module.css +27 -20
- package/package.json +1 -1
package/Calendar/index.js
CHANGED
|
@@ -74,16 +74,20 @@ var Calendar = function Calendar(_a) {
|
|
|
74
74
|
var _a;
|
|
75
75
|
setContentWidth(((_a = $root.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0);
|
|
76
76
|
}, []);
|
|
77
|
-
var showPrevMonth =
|
|
77
|
+
var showPrevMonth = function showPrevMonth(event) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
event.stopPropagation();
|
|
78
80
|
setCurrentMonthOffset(function (prev) {
|
|
79
81
|
return prev - 1;
|
|
80
82
|
});
|
|
81
|
-
}
|
|
82
|
-
var showNextMonth =
|
|
83
|
+
};
|
|
84
|
+
var showNextMonth = function showNextMonth(event) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
event.stopPropagation();
|
|
83
87
|
setCurrentMonthOffset(function (prev) {
|
|
84
88
|
return prev + 1;
|
|
85
89
|
});
|
|
86
|
-
}
|
|
90
|
+
};
|
|
87
91
|
var selectDate = React.useCallback(function (date, period, rangeCompleted) {
|
|
88
92
|
setSelectedDate(date);
|
|
89
93
|
setSelectedPeriod(period);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DatePickerProps } from "./index.props";
|
|
3
|
-
declare const DatePicker:
|
|
3
|
+
declare const DatePicker: React.FC<DatePickerProps>;
|
|
4
4
|
export default DatePicker;
|
|
@@ -16,6 +16,20 @@ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
|
16
16
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
17
17
|
|
|
18
18
|
var clx = classNames__default.default.bind(styles__default.default);
|
|
19
|
+
var CalendarIcon = function CalendarIcon() {
|
|
20
|
+
return /*#__PURE__*/React__default.default.createElement("svg", {
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
fill: "none",
|
|
23
|
+
viewBox: "0 0 24 24",
|
|
24
|
+
className: clx("calendar-icon"),
|
|
25
|
+
strokeWidth: 1.5,
|
|
26
|
+
stroke: "currentColor"
|
|
27
|
+
}, /*#__PURE__*/React__default.default.createElement("path", {
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
19
33
|
var DatePicker = function DatePicker(_a) {
|
|
20
34
|
var className = _a.className,
|
|
21
35
|
_b = _a.selectedDate,
|
|
@@ -24,29 +38,28 @@ var DatePicker = function DatePicker(_a) {
|
|
|
24
38
|
var _c = React.useState(selectedDate),
|
|
25
39
|
date = _c[0],
|
|
26
40
|
setDate = _c[1];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
42
|
+
var handleDateChange = function handleDateChange(_a) {
|
|
43
|
+
var date = _a.date;
|
|
44
|
+
setDate(date);
|
|
45
|
+
onChangeDate === null || onChangeDate === void 0 ? void 0 : onChangeDate(date);
|
|
31
46
|
};
|
|
32
47
|
return /*#__PURE__*/React__default.default.createElement(index.default, {
|
|
33
48
|
placement: "bottom",
|
|
34
|
-
preventAutoClose: true,
|
|
35
|
-
preventOverflow: true,
|
|
36
49
|
fontSize: 14,
|
|
37
50
|
trigger: ["click"],
|
|
38
51
|
overlay: /*#__PURE__*/React__default.default.createElement(index$1.default, {
|
|
39
52
|
minWidth: 260,
|
|
40
|
-
className:
|
|
53
|
+
className: clx("calendar", className),
|
|
41
54
|
today: index$2.toISODate(new Date()),
|
|
42
55
|
titleSize: "h5",
|
|
43
56
|
selectedDate: date,
|
|
44
57
|
onChange: handleDateChange
|
|
45
58
|
})
|
|
46
59
|
}, /*#__PURE__*/React__default.default.createElement("div", {
|
|
47
|
-
className: clx(
|
|
60
|
+
className: clx("input-container", "input-date", className)
|
|
48
61
|
}, /*#__PURE__*/React__default.default.createElement("input", {
|
|
49
|
-
className: clx(
|
|
62
|
+
className: clx("input-field"),
|
|
50
63
|
tabIndex: 0,
|
|
51
64
|
"aria-expanded": "false",
|
|
52
65
|
"aria-haspopup": "true",
|
|
@@ -55,7 +68,7 @@ var DatePicker = function DatePicker(_a) {
|
|
|
55
68
|
maxLength: 7,
|
|
56
69
|
readOnly: true,
|
|
57
70
|
value: index$2.toDMYDate(date)
|
|
58
|
-
})));
|
|
71
|
+
}), /*#__PURE__*/React__default.default.createElement(CalendarIcon, null)));
|
|
59
72
|
};
|
|
60
73
|
|
|
61
74
|
exports.default = DatePicker;
|
|
@@ -1,49 +1,56 @@
|
|
|
1
1
|
.input-container {
|
|
2
|
-
align-items: center;
|
|
3
|
-
border-bottom: 1px solid var(--palette-bg-3);
|
|
4
|
-
border-bottom-right-radius: 0.375rem;
|
|
5
|
-
border-right: 1px solid var(--palette-bg-3);
|
|
6
|
-
border-top: 1px solid var(--palette-bg-3);
|
|
7
|
-
border-top-right-radius: 0.375rem;
|
|
8
|
-
box-sizing: border-box;
|
|
9
2
|
display: flex;
|
|
10
|
-
|
|
3
|
+
align-items: center;
|
|
11
4
|
justify-content: center;
|
|
5
|
+
height: 36px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
border: 1px solid var(--palette-bg-3);
|
|
8
|
+
border-top-right-radius: 0.375rem;
|
|
9
|
+
border-bottom-right-radius: 0.375rem;
|
|
10
|
+
border-left: none;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.input-field {
|
|
15
|
-
|
|
16
|
-
border: none;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
font-size: 1em;
|
|
14
|
+
width: 100%;
|
|
19
15
|
height: 100%;
|
|
20
|
-
outline: none;
|
|
21
16
|
padding: 4px;
|
|
22
17
|
text-align: center;
|
|
23
|
-
|
|
18
|
+
background: transparent;
|
|
19
|
+
border: none;
|
|
20
|
+
outline: none;
|
|
21
|
+
box-sizing: border-box;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
.input-date {
|
|
25
|
+
cursor: pointer;
|
|
27
26
|
flex: 3;
|
|
28
27
|
position: relative;
|
|
28
|
+
border-top: 1px solid var(--palette-bg-3);
|
|
29
|
+
border-right: 1px solid var(--palette-bg-3);
|
|
30
|
+
border-bottom: 1px solid var(--palette-bg-3);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.input-date:focus-within {
|
|
32
|
-
border-
|
|
33
|
-
border-right: 1px solid var(--palette-primary-3);
|
|
34
|
-
border-top: 1px solid var(--palette-primary-3);
|
|
34
|
+
border-color: var(--palette-primary-3);
|
|
35
35
|
box-shadow: 0 0 0 2px var(--palette-primary-2);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.input-date:focus-within::before {
|
|
39
|
-
background-color: var(--palette-primary-3);
|
|
40
39
|
content: "";
|
|
41
|
-
height: 100%;
|
|
42
|
-
left: 0;
|
|
43
40
|
position: absolute;
|
|
41
|
+
left: 0;
|
|
44
42
|
width: 1px;
|
|
43
|
+
height: 100%;
|
|
44
|
+
background-color: var(--palette-primary-3);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.calendar {
|
|
48
48
|
max-width: 250px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.calendar-icon {
|
|
52
|
+
width: 24px;
|
|
53
|
+
height: 24px;
|
|
54
|
+
margin-right: 10px;
|
|
55
|
+
cursor: pointer;
|
|
49
56
|
}
|
package/esm/Calendar/index.js
CHANGED
|
@@ -64,16 +64,20 @@ var Calendar = function Calendar(_a) {
|
|
|
64
64
|
var _a;
|
|
65
65
|
setContentWidth(((_a = $root.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0);
|
|
66
66
|
}, []);
|
|
67
|
-
var showPrevMonth =
|
|
67
|
+
var showPrevMonth = function showPrevMonth(event) {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
event.stopPropagation();
|
|
68
70
|
setCurrentMonthOffset(function (prev) {
|
|
69
71
|
return prev - 1;
|
|
70
72
|
});
|
|
71
|
-
}
|
|
72
|
-
var showNextMonth =
|
|
73
|
+
};
|
|
74
|
+
var showNextMonth = function showNextMonth(event) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
event.stopPropagation();
|
|
73
77
|
setCurrentMonthOffset(function (prev) {
|
|
74
78
|
return prev + 1;
|
|
75
79
|
});
|
|
76
|
-
}
|
|
80
|
+
};
|
|
77
81
|
var selectDate = useCallback(function (date, period, rangeCompleted) {
|
|
78
82
|
setSelectedDate(date);
|
|
79
83
|
setSelectedPeriod(period);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DatePickerProps } from "./index.props";
|
|
3
|
-
declare const DatePicker:
|
|
3
|
+
declare const DatePicker: React.FC<DatePickerProps>;
|
|
4
4
|
export default DatePicker;
|
|
@@ -6,6 +6,20 @@ import { toISODate, toDMYDate } from '../../../helpers/date/index.js';
|
|
|
6
6
|
import styles from './index.module.css';
|
|
7
7
|
|
|
8
8
|
var clx = classNames.bind(styles);
|
|
9
|
+
var CalendarIcon = function CalendarIcon() {
|
|
10
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
fill: "none",
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
className: clx("calendar-icon"),
|
|
15
|
+
strokeWidth: 1.5,
|
|
16
|
+
stroke: "currentColor"
|
|
17
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
18
|
+
strokeLinecap: "round",
|
|
19
|
+
strokeLinejoin: "round",
|
|
20
|
+
d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
9
23
|
var DatePicker = function DatePicker(_a) {
|
|
10
24
|
var className = _a.className,
|
|
11
25
|
_b = _a.selectedDate,
|
|
@@ -14,29 +28,28 @@ var DatePicker = function DatePicker(_a) {
|
|
|
14
28
|
var _c = useState(selectedDate),
|
|
15
29
|
date = _c[0],
|
|
16
30
|
setDate = _c[1];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
32
|
+
var handleDateChange = function handleDateChange(_a) {
|
|
33
|
+
var date = _a.date;
|
|
34
|
+
setDate(date);
|
|
35
|
+
onChangeDate === null || onChangeDate === void 0 ? void 0 : onChangeDate(date);
|
|
21
36
|
};
|
|
22
37
|
return /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
23
38
|
placement: "bottom",
|
|
24
|
-
preventAutoClose: true,
|
|
25
|
-
preventOverflow: true,
|
|
26
39
|
fontSize: 14,
|
|
27
40
|
trigger: ["click"],
|
|
28
41
|
overlay: /*#__PURE__*/React__default.createElement(Calendar, {
|
|
29
42
|
minWidth: 260,
|
|
30
|
-
className:
|
|
43
|
+
className: clx("calendar", className),
|
|
31
44
|
today: toISODate(new Date()),
|
|
32
45
|
titleSize: "h5",
|
|
33
46
|
selectedDate: date,
|
|
34
47
|
onChange: handleDateChange
|
|
35
48
|
})
|
|
36
49
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
37
|
-
className: clx(
|
|
50
|
+
className: clx("input-container", "input-date", className)
|
|
38
51
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
39
|
-
className: clx(
|
|
52
|
+
className: clx("input-field"),
|
|
40
53
|
tabIndex: 0,
|
|
41
54
|
"aria-expanded": "false",
|
|
42
55
|
"aria-haspopup": "true",
|
|
@@ -45,7 +58,7 @@ var DatePicker = function DatePicker(_a) {
|
|
|
45
58
|
maxLength: 7,
|
|
46
59
|
readOnly: true,
|
|
47
60
|
value: toDMYDate(date)
|
|
48
|
-
})));
|
|
61
|
+
}), /*#__PURE__*/React__default.createElement(CalendarIcon, null)));
|
|
49
62
|
};
|
|
50
63
|
|
|
51
64
|
export { DatePicker as default };
|
|
@@ -1,49 +1,56 @@
|
|
|
1
1
|
.input-container {
|
|
2
|
-
align-items: center;
|
|
3
|
-
border-bottom: 1px solid var(--palette-bg-3);
|
|
4
|
-
border-bottom-right-radius: 0.375rem;
|
|
5
|
-
border-right: 1px solid var(--palette-bg-3);
|
|
6
|
-
border-top: 1px solid var(--palette-bg-3);
|
|
7
|
-
border-top-right-radius: 0.375rem;
|
|
8
|
-
box-sizing: border-box;
|
|
9
2
|
display: flex;
|
|
10
|
-
|
|
3
|
+
align-items: center;
|
|
11
4
|
justify-content: center;
|
|
5
|
+
height: 36px;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
border: 1px solid var(--palette-bg-3);
|
|
8
|
+
border-top-right-radius: 0.375rem;
|
|
9
|
+
border-bottom-right-radius: 0.375rem;
|
|
10
|
+
border-left: none;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.input-field {
|
|
15
|
-
|
|
16
|
-
border: none;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
font-size: 1em;
|
|
14
|
+
width: 100%;
|
|
19
15
|
height: 100%;
|
|
20
|
-
outline: none;
|
|
21
16
|
padding: 4px;
|
|
22
17
|
text-align: center;
|
|
23
|
-
|
|
18
|
+
background: transparent;
|
|
19
|
+
border: none;
|
|
20
|
+
outline: none;
|
|
21
|
+
box-sizing: border-box;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
.input-date {
|
|
25
|
+
cursor: pointer;
|
|
27
26
|
flex: 3;
|
|
28
27
|
position: relative;
|
|
28
|
+
border-top: 1px solid var(--palette-bg-3);
|
|
29
|
+
border-right: 1px solid var(--palette-bg-3);
|
|
30
|
+
border-bottom: 1px solid var(--palette-bg-3);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.input-date:focus-within {
|
|
32
|
-
border-
|
|
33
|
-
border-right: 1px solid var(--palette-primary-3);
|
|
34
|
-
border-top: 1px solid var(--palette-primary-3);
|
|
34
|
+
border-color: var(--palette-primary-3);
|
|
35
35
|
box-shadow: 0 0 0 2px var(--palette-primary-2);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.input-date:focus-within::before {
|
|
39
|
-
background-color: var(--palette-primary-3);
|
|
40
39
|
content: "";
|
|
41
|
-
height: 100%;
|
|
42
|
-
left: 0;
|
|
43
40
|
position: absolute;
|
|
41
|
+
left: 0;
|
|
44
42
|
width: 1px;
|
|
43
|
+
height: 100%;
|
|
44
|
+
background-color: var(--palette-primary-3);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.calendar {
|
|
48
48
|
max-width: 250px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.calendar-icon {
|
|
52
|
+
width: 24px;
|
|
53
|
+
height: 24px;
|
|
54
|
+
margin-right: 10px;
|
|
55
|
+
cursor: pointer;
|
|
49
56
|
}
|