@dhis2-ui/calendar 9.11.0 → 9.11.1-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/build/cjs/__e2e__/{calendar-input.stories.e2e.js → calendar-input.e2e.stories.js} +11 -20
- package/build/cjs/calendar/calendar-table-cell.js +2 -10
- package/build/cjs/calendar/calendar-table-days-header.js +3 -10
- package/build/cjs/calendar/calendar-table.js +3 -12
- package/build/cjs/calendar/calendar.js +5 -27
- package/build/cjs/calendar/navigation-container.js +9 -19
- package/build/cjs/calendar-input/calendar-input.js +6 -26
- package/build/cjs/features/supports_calendar_clear_button/supports_calendar_clear_button.js +1 -2
- package/build/cjs/features/supports_ethiopic_calendar/supports_ethiopic_calendar.js +2 -3
- package/build/cjs/features/supports_gregorian_calendar/supports_gregorian_calendar.js +2 -3
- package/build/cjs/features/supports_islamic_calendar/supports_islamic_calendar.js +1 -2
- package/build/cjs/features/supports_nepali_calendar/supports_nepali_calendar.js +3 -3
- package/build/cjs/index.js +0 -2
- package/build/cjs/locales/index.js +3 -9
- package/build/cjs/stories/{calendar-input.stories.js → calendar-input.prod.stories.js} +19 -34
- package/build/cjs/stories/calendar-story-wrapper.js +4 -23
- package/build/cjs/stories/{calendar.stories.js → calendar.prod.stories.js} +13 -18
- package/build/es/__e2e__/{calendar-input.stories.e2e.js → calendar-input.e2e.stories.js} +2 -3
- package/build/es/calendar/calendar-table-cell.js +1 -1
- package/build/es/calendar/calendar-table-days-header.js +2 -2
- package/build/es/calendar/calendar-table.js +2 -2
- package/build/es/calendar/calendar.js +1 -10
- package/build/es/calendar/navigation-container.js +8 -8
- package/build/es/calendar-input/calendar-input.js +3 -7
- package/build/es/features/supports_calendar_clear_button/supports_calendar_clear_button.js +1 -1
- package/build/es/features/supports_ethiopic_calendar/supports_ethiopic_calendar.js +2 -2
- package/build/es/features/supports_gregorian_calendar/supports_gregorian_calendar.js +2 -2
- package/build/es/features/supports_islamic_calendar/supports_islamic_calendar.js +1 -1
- package/build/es/features/supports_nepali_calendar/supports_nepali_calendar.js +3 -2
- package/build/es/stories/{calendar-input.stories.js → calendar-input.prod.stories.js} +10 -8
- package/build/es/stories/calendar-story-wrapper.js +1 -10
- package/build/es/stories/{calendar.stories.js → calendar.prod.stories.js} +11 -4
- package/package.json +11 -11
@@ -4,20 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = exports.NepaliWithNepali = exports.NepaliWithEnglish = exports.IslamicWithArabic = exports.GregorianWithEnglish = exports.GregorianWithArabic = exports.EthiopicWithEnglish = exports.EthiopicWithAmharic = exports.CalendarWithClearButton = void 0;
|
7
|
-
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
8
|
var _calendarInput = require("../calendar-input/calendar-input.js");
|
11
|
-
|
12
9
|
var _calendarStoryWrapper = require("./calendar-story-wrapper.js");
|
13
|
-
|
14
|
-
function
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
12
|
+
const subtitle = `[Experimental] Calendar Input is a wrapper around Calendar displaying an input that triggers the calendar`;
|
13
|
+
const description = `
|
14
|
+
Use a CalendarInput where there is a need to let the user input a date.
|
15
|
+
|
16
|
+
Note that it requires a parent, like [Box](../?path=/docs/layout-box--default), to define its size.
|
17
|
+
|
18
|
+
\`\`\`js
|
19
|
+
import { CalendarInput } from '@dhis2/ui'
|
20
|
+
\`\`\`
|
21
|
+
`;
|
22
|
+
var _default = exports.default = {
|
21
23
|
title: 'CalendarInput',
|
22
24
|
component: _calendarInput.CalendarInput,
|
23
25
|
parameters: {
|
@@ -29,8 +31,6 @@ var _default = {
|
|
29
31
|
}
|
30
32
|
}
|
31
33
|
};
|
32
|
-
exports.default = _default;
|
33
|
-
|
34
34
|
const buildCalendar = _ref => {
|
35
35
|
let {
|
36
36
|
date,
|
@@ -48,49 +48,37 @@ const buildCalendar = _ref => {
|
|
48
48
|
onDateSelect: () => {}
|
49
49
|
});
|
50
50
|
};
|
51
|
-
|
52
|
-
const EthiopicWithAmharic = buildCalendar({
|
51
|
+
const EthiopicWithAmharic = exports.EthiopicWithAmharic = buildCalendar({
|
53
52
|
calendar: 'ethiopic',
|
54
53
|
locale: 'am-ET',
|
55
54
|
date: '2014-02-03' // 13 Oct 2021
|
56
|
-
|
57
55
|
});
|
58
|
-
exports.
|
59
|
-
const EthiopicWithEnglish = buildCalendar({
|
56
|
+
const EthiopicWithEnglish = exports.EthiopicWithEnglish = buildCalendar({
|
60
57
|
calendar: 'ethiopian',
|
61
58
|
// using "ethiopian" rather than the correct "ethiopic" to immitate DHIS2 calendar types
|
62
59
|
locale: 'en-ET',
|
63
60
|
date: '2014-02-03' // 13 Oct 2021
|
64
|
-
|
65
61
|
});
|
66
|
-
exports.
|
67
|
-
const NepaliWithNepali = buildCalendar({
|
62
|
+
const NepaliWithNepali = exports.NepaliWithNepali = buildCalendar({
|
68
63
|
calendar: 'nepali',
|
69
64
|
locale: 'ne-NP',
|
70
65
|
date: '2078-06-27' // 13 Oct 2021
|
71
|
-
|
72
66
|
});
|
73
|
-
exports.
|
74
|
-
const NepaliWithEnglish = buildCalendar({
|
67
|
+
const NepaliWithEnglish = exports.NepaliWithEnglish = buildCalendar({
|
75
68
|
calendar: 'nepali',
|
76
69
|
locale: 'en-NP',
|
77
70
|
date: '2078-06-27' // 13 Oct 2021
|
78
|
-
|
79
71
|
});
|
80
|
-
exports.
|
81
|
-
const GregorianWithEnglish = buildCalendar({
|
72
|
+
const GregorianWithEnglish = exports.GregorianWithEnglish = buildCalendar({
|
82
73
|
calendar: 'gregorian',
|
83
74
|
locale: 'en-CA',
|
84
75
|
date: '2021-10-13'
|
85
76
|
});
|
86
|
-
exports.
|
87
|
-
const GregorianWithArabic = buildCalendar({
|
77
|
+
const GregorianWithArabic = exports.GregorianWithArabic = buildCalendar({
|
88
78
|
calendar: 'gregorian',
|
89
79
|
locale: 'ar-SD',
|
90
80
|
date: '2021-10-13'
|
91
81
|
});
|
92
|
-
exports.GregorianWithArabic = GregorianWithArabic;
|
93
|
-
|
94
82
|
const IslamicWithArabic = () => {
|
95
83
|
return /*#__PURE__*/_react.default.createElement("div", {
|
96
84
|
style: {
|
@@ -108,9 +96,7 @@ const IslamicWithArabic = () => {
|
|
108
96
|
onDateSelect: () => {}
|
109
97
|
}));
|
110
98
|
};
|
111
|
-
|
112
99
|
exports.IslamicWithArabic = IslamicWithArabic;
|
113
|
-
|
114
100
|
const CalendarWithClearButton = _ref2 => {
|
115
101
|
let {
|
116
102
|
calendar = 'gregory',
|
@@ -128,5 +114,4 @@ const CalendarWithClearButton = _ref2 => {
|
|
128
114
|
"data-test": "storybook-calendar-date-value"
|
129
115
|
}, date !== null && date !== void 0 ? date : 'undefined')));
|
130
116
|
};
|
131
|
-
|
132
117
|
exports.CalendarWithClearButton = CalendarWithClearButton;
|
@@ -4,31 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.CalendarStoryWrapper = void 0;
|
7
|
-
|
8
7
|
var _multiCalendarDates = require("@dhis2/multi-calendar-dates");
|
9
|
-
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
-
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
13
|
-
|
14
10
|
var _calendar = require("../calendar/calendar.js");
|
15
|
-
|
16
|
-
function
|
17
|
-
|
18
|
-
function
|
19
|
-
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
|
-
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
24
15
|
const {
|
25
16
|
calendars,
|
26
17
|
numberingSystems
|
27
18
|
} = _multiCalendarDates.constants;
|
28
|
-
|
29
19
|
const CalendarStoryWrapper = props => {
|
30
20
|
var _selectedDate$calenda;
|
31
|
-
|
32
21
|
const {
|
33
22
|
calendar,
|
34
23
|
locale,
|
@@ -46,7 +35,6 @@ const CalendarStoryWrapper = props => {
|
|
46
35
|
const [selectedDate, setSelectedDate] = (0, _react.useState)({
|
47
36
|
calendarDateString: date
|
48
37
|
});
|
49
|
-
|
50
38
|
const changeCalendar = _ref => {
|
51
39
|
let {
|
52
40
|
target: {
|
@@ -55,21 +43,18 @@ const CalendarStoryWrapper = props => {
|
|
55
43
|
} = _ref;
|
56
44
|
setSelectedCalendar(value);
|
57
45
|
};
|
58
|
-
|
59
46
|
const changeNumberingSystem = _ref2 => {
|
60
47
|
let {
|
61
48
|
target: {
|
62
49
|
value
|
63
50
|
}
|
64
51
|
} = _ref2;
|
65
|
-
|
66
52
|
if (value === '-1') {
|
67
53
|
setSelectedNumberingSystem(null);
|
68
54
|
} else {
|
69
55
|
setSelectedNumberingSystem(value);
|
70
56
|
}
|
71
57
|
};
|
72
|
-
|
73
58
|
const changeDirection = _ref3 => {
|
74
59
|
let {
|
75
60
|
target: {
|
@@ -78,7 +63,6 @@ const CalendarStoryWrapper = props => {
|
|
78
63
|
} = _ref3;
|
79
64
|
setSelectedDirection(value);
|
80
65
|
};
|
81
|
-
|
82
66
|
const changeWeekFormat = _ref4 => {
|
83
67
|
let {
|
84
68
|
target: {
|
@@ -87,7 +71,6 @@ const CalendarStoryWrapper = props => {
|
|
87
71
|
} = _ref4;
|
88
72
|
setWeekDayFormat(value);
|
89
73
|
};
|
90
|
-
|
91
74
|
const onLocaleChanged = _ref5 => {
|
92
75
|
let {
|
93
76
|
target: {
|
@@ -96,7 +79,6 @@ const CalendarStoryWrapper = props => {
|
|
96
79
|
} = _ref5;
|
97
80
|
setLocale(value);
|
98
81
|
};
|
99
|
-
|
100
82
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
101
83
|
style: {
|
102
84
|
fontSize: '0.8em',
|
@@ -182,7 +164,6 @@ const CalendarStoryWrapper = props => {
|
|
182
164
|
dateStyle: 'long'
|
183
165
|
}))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("label", null, "callback:"), JSON.stringify(selectedDate, null, 2))))));
|
184
166
|
};
|
185
|
-
|
186
167
|
exports.CalendarStoryWrapper = CalendarStoryWrapper;
|
187
168
|
CalendarStoryWrapper.defaultProps = {
|
188
169
|
calendar: 'gregorian',
|
@@ -4,20 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = exports.WithAnyCalendar = exports.Nepali = exports.Ethiopic = void 0;
|
7
|
-
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
8
|
var _calendar = require("../calendar/calendar.js");
|
11
|
-
|
12
9
|
var _calendarStoryWrapper = require("./calendar-story-wrapper.js");
|
13
|
-
|
14
|
-
function
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
12
|
+
const subtitle = `[Experimental] Calendar component is useful for creating a variety of calendars including Ethiopic, Islamic etc..`;
|
13
|
+
const description = `
|
14
|
+
Use a Calendar where there is a need to let the user select a date.
|
15
|
+
|
16
|
+
Note that it requires a parent, like [Box](../?path=/docs/layout-box--default), to define its size.
|
17
|
+
|
18
|
+
\`\`\`js
|
19
|
+
import { Calendar } from '@dhis2/ui'
|
20
|
+
\`\`\`
|
21
|
+
`;
|
22
|
+
var _default = exports.default = {
|
21
23
|
title: 'Calendar',
|
22
24
|
component: _calendar.Calendar,
|
23
25
|
parameters: {
|
@@ -29,8 +31,6 @@ var _default = {
|
|
29
31
|
}
|
30
32
|
}
|
31
33
|
};
|
32
|
-
exports.default = _default;
|
33
|
-
|
34
34
|
const Ethiopic = args => {
|
35
35
|
return /*#__PURE__*/_react.default.createElement(_calendarStoryWrapper.CalendarStoryWrapper, _extends({
|
36
36
|
calendar: "ethiopic",
|
@@ -41,9 +41,7 @@ const Ethiopic = args => {
|
|
41
41
|
timeZone: "Africa/Khartoum"
|
42
42
|
}, args));
|
43
43
|
};
|
44
|
-
|
45
44
|
exports.Ethiopic = Ethiopic;
|
46
|
-
|
47
45
|
const Nepali = args => {
|
48
46
|
return /*#__PURE__*/_react.default.createElement(_calendarStoryWrapper.CalendarStoryWrapper, _extends({
|
49
47
|
calendar: "nepali",
|
@@ -53,14 +51,11 @@ const Nepali = args => {
|
|
53
51
|
timeZone: "Africa/Khartoum"
|
54
52
|
}, args));
|
55
53
|
};
|
56
|
-
|
57
54
|
exports.Nepali = Nepali;
|
58
|
-
|
59
55
|
const WithAnyCalendar = args => {
|
60
56
|
return /*#__PURE__*/_react.default.createElement(_calendarStoryWrapper.CalendarStoryWrapper, _extends({
|
61
57
|
calendar: "gregory",
|
62
58
|
locale: "en-GB"
|
63
59
|
}, args));
|
64
60
|
};
|
65
|
-
|
66
61
|
exports.WithAnyCalendar = WithAnyCalendar;
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { CalendarInput as component } from '../index.js';
|
3
|
-
import { CalendarWithClearButton } from '../stories/calendar-input.stories.js';
|
3
|
+
import { CalendarWithClearButton } from '../stories/calendar-input.prod.stories.js';
|
4
4
|
export default {
|
5
5
|
title: 'CalendarInputTesting',
|
6
6
|
component
|
7
7
|
};
|
8
|
-
export { EthiopicWithAmharic, EthiopicWithEnglish, NepaliWithEnglish, NepaliWithNepali, GregorianWithArabic, GregorianWithEnglish, IslamicWithArabic } from '../stories/calendar-input.stories.js';
|
8
|
+
export { EthiopicWithAmharic, EthiopicWithEnglish, NepaliWithEnglish, NepaliWithNepali, GregorianWithArabic, GregorianWithEnglish, IslamicWithArabic } from '../stories/calendar-input.prod.stories.js';
|
9
9
|
export const TestCalendarWithClearButton = () => {
|
10
10
|
var _params$get, _params$get2;
|
11
|
-
|
12
11
|
const params = new URLSearchParams(location.search);
|
13
12
|
const calendar = (_params$get = params.get('calendar')) !== null && _params$get !== void 0 ? _params$get : 'gregory';
|
14
13
|
const initialDate = (_params$get2 = params.get('initialDate')) !== null && _params$get2 !== void 0 ? _params$get2 : null;
|
@@ -25,7 +25,7 @@ export const CalendarTableCell = _ref => {
|
|
25
25
|
}, day.label), /*#__PURE__*/React.createElement(_JSXStyle, {
|
26
26
|
id: "2052411850",
|
27
27
|
dynamic: [cellSize, cellSize, cellSize, cellSize, colors.grey900, dayHoverBackgroundColor, colors.grey300, selectedDayBackgroundColor, colors.teal600, colors.teal200, colors.grey600]
|
28
|
-
}, [
|
28
|
+
}, [`td.__jsx-style-dynamic-selector{width:${cellSize};height:100%;height:${cellSize};text-align:center;border:2px solid transparent;padding:0;}`, "td.__jsx-style-dynamic-selector span.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;padding:2px 2px;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border:2px solid transparent;min-width:16px;}", `button.__jsx-style-dynamic-selector{border:0;overflow:hidden;width:${cellSize};height:${cellSize};border:2px solid transparent;border-radius:3px;background:none;color:${colors.grey900};}`, `button.__jsx-style-dynamic-selector:hover{background-color:${dayHoverBackgroundColor};-webkit-text-decoration:underline;text-decoration:underline;cursor:pointer;}`, `button.__jsx-style-dynamic-selector:active{background-color:${colors.grey300};}`, `button.isSelected.__jsx-style-dynamic-selector,button.otherMonth.isSelected.__jsx-style-dynamic-selector{background-color:${selectedDayBackgroundColor};color:white;}`, "button.isToday.__jsx-style-dynamic-selector{position:relative;}", `button.isToday.__jsx-style-dynamic-selector::after{content:'';position:absolute;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);height:4px;width:4px;bottom:2px;left:50%;border-radius:100%;background-color:${colors.teal600};}`, `button.isSelected.isToday.__jsx-style-dynamic-selector::after{background-color:${colors.teal200};}`, `button.otherMonth.__jsx-style-dynamic-selector{color:${colors.grey600};}`]));
|
29
29
|
};
|
30
30
|
CalendarTableCell.propTypes = {
|
31
31
|
cellSize: PropTypes.string,
|
@@ -13,12 +13,12 @@ export const CalendarTableDaysHeader = _ref => {
|
|
13
13
|
className: _JSXStyle.dynamic([["1577512909", [dayNamesColor]]])
|
14
14
|
}, weekDayLabels.map((label, i) => /*#__PURE__*/React.createElement("th", {
|
15
15
|
scope: "col",
|
16
|
-
key:
|
16
|
+
key: `weekday-${i}`,
|
17
17
|
className: _JSXStyle.dynamic([["1577512909", [dayNamesColor]]])
|
18
18
|
}, label)))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
19
19
|
id: "1577512909",
|
20
20
|
dynamic: [dayNamesColor]
|
21
|
-
}, [
|
21
|
+
}, [`th.__jsx-style-dynamic-selector{color:${dayNamesColor};font-weight:300;font-style:normal;padding:8px 8px;background:none;font-size:0.85em;border:none;cursor:default;}`, "tr.__jsx-style-dynamic-selector{border:none;}"]));
|
22
22
|
};
|
23
23
|
CalendarTableDaysHeader.propTypes = {
|
24
24
|
weekDayLabels: PropTypes.arrayOf(PropTypes.string)
|
@@ -21,7 +21,7 @@ export const CalendarTable = _ref => {
|
|
21
21
|
}), /*#__PURE__*/React.createElement("tbody", {
|
22
22
|
className: _JSXStyle.dynamic([["452536960", [spacers.dp4, spacers.dp4]]])
|
23
23
|
}, calendarWeekDays.map((week, weekIndex) => /*#__PURE__*/React.createElement("tr", {
|
24
|
-
key:
|
24
|
+
key: `week-${weekIndex + 1}`,
|
25
25
|
className: _JSXStyle.dynamic([["452536960", [spacers.dp4, spacers.dp4]]])
|
26
26
|
}, week.map(day => /*#__PURE__*/React.createElement(CalendarTableCell, {
|
27
27
|
selectedDate: selectedDate,
|
@@ -32,7 +32,7 @@ export const CalendarTable = _ref => {
|
|
32
32
|
})))))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
33
33
|
id: "452536960",
|
34
34
|
dynamic: [spacers.dp4, spacers.dp4]
|
35
|
-
}, [
|
35
|
+
}, [`.calendar-table.__jsx-style-dynamic-selector{border:none;border-collapse:collapse;width:100%;margin-block:${spacers.dp4};}`, ".calendar-table.__jsx-style-dynamic-selector tr.__jsx-style-dynamic-selector,.calendar-table.__jsx-style-dynamic-selector td.__jsx-style-dynamic-selector{border:none;}", `.calendar-table-wrapper.__jsx-style-dynamic-selector{padding-inline:${spacers.dp4};}`]));
|
36
36
|
};
|
37
37
|
CalendarTable.propTypes = {
|
38
38
|
calendarWeekDays: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.shape({
|
@@ -62,7 +62,7 @@ export const Calendar = _ref => {
|
|
62
62
|
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
63
63
|
id: "2823859047",
|
64
64
|
dynamic: [backgroundColor, wrapperBorderColor, width]
|
65
|
-
}, [
|
65
|
+
}, [`.calendar-wrapper.__jsx-style-dynamic-selector{font-family:Roboto,sans-serif;font-weight:400;font-size:14px;background-color:${backgroundColor};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;border:1px solid ${wrapperBorderColor};border-radius:3px;min-width:${width};width:-webkit-max-content;width:-moz-max-content;width:max-content;box-shadow:0px 4px 6px -2px #2129340d;box-shadow:0px 10px 15px -3px #2129341a;}`]));
|
66
66
|
};
|
67
67
|
Calendar.defaultProps = {
|
68
68
|
cellSize: '32px',
|
@@ -72,31 +72,22 @@ Calendar.defaultProps = {
|
|
72
72
|
export const CalendarProps = {
|
73
73
|
/** the calendar to use such gregory, ethiopic, nepali - full supported list here: https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/calendars.ts */
|
74
74
|
calendar: PropTypes.any.isRequired,
|
75
|
-
|
76
75
|
/** Called with signature `(null)` \|\| `({ dateCalendarString: string, dateCalendar: Temporal.ZonedDateTime })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
77
76
|
onDateSelect: PropTypes.func.isRequired,
|
78
|
-
|
79
77
|
/** the size of a single cell in the table forming the calendar */
|
80
78
|
cellSize: PropTypes.string,
|
81
|
-
|
82
79
|
/** the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601) */
|
83
80
|
date: PropTypes.string,
|
84
|
-
|
85
81
|
/** the direction of the library - internally the library will use rtl for rtl-languages but this can be overridden here for more control */
|
86
82
|
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
87
|
-
|
88
83
|
/** any valid locale - if none provided, the internal library will fallback to the user locale (more info here: https://github.com/dhis2/multi-calendar-dates/blob/main/src/hooks/internal/useResolvedLocaleOptions.ts#L15) */
|
89
84
|
locale: PropTypes.string,
|
90
|
-
|
91
85
|
/** numbering system to use - full list here https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/numberingSystems.ts */
|
92
86
|
numberingSystem: PropTypes.string,
|
93
|
-
|
94
87
|
/** the timeZone to use */
|
95
88
|
timeZone: PropTypes.string,
|
96
|
-
|
97
89
|
/** the format to display for the week day, i.e. Monday (long), Mon (short), M (narrow) */
|
98
90
|
weekDayFormat: PropTypes.oneOf(['narrow', 'short', 'long']),
|
99
|
-
|
100
91
|
/** the width of the calendar component */
|
101
92
|
width: PropTypes.string
|
102
93
|
};
|
@@ -8,7 +8,6 @@ const wrapperBorderColor = colors.grey300;
|
|
8
8
|
const headerBackground = colors.grey050;
|
9
9
|
export const NavigationContainer = _ref => {
|
10
10
|
var _currYear$label;
|
11
|
-
|
12
11
|
let {
|
13
12
|
languageDirection,
|
14
13
|
pickerOptions
|
@@ -22,9 +21,10 @@ export const NavigationContainer = _ref => {
|
|
22
21
|
nextYear,
|
23
22
|
prevMonth,
|
24
23
|
prevYear
|
25
|
-
} = pickerOptions;
|
26
|
-
// there is an ongoing discussion in JS-Temporal polyfill whether the era should be included or not, but for our case, it's safer to remove it
|
24
|
+
} = pickerOptions;
|
27
25
|
|
26
|
+
// Ethiopic years - when localised to English - add the era (i.e. 2015 ERA1), which is redundant in practice (like writing AD for gregorian years)
|
27
|
+
// there is an ongoing discussion in JS-Temporal polyfill whether the era should be included or not, but for our case, it's safer to remove it
|
28
28
|
const currentYearLabel = (_currYear$label = currYear.label) === null || _currYear$label === void 0 ? void 0 : _currYear$label.toString().replace(/ERA1/, '');
|
29
29
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
30
30
|
className: _JSXStyle.dynamic([["3883083596", [spacers.dp4, colors.grey600, colors.grey200, colors.grey900, colors.grey300, spacers.dp8, spacers.dp4, wrapperBorderColor, headerBackground]]]) + " " + "navigation-container"
|
@@ -36,7 +36,7 @@ export const NavigationContainer = _ref => {
|
|
36
36
|
onClick: prevMonth.navigateTo,
|
37
37
|
name: "previous-month",
|
38
38
|
"data-test": "calendar-previous-month",
|
39
|
-
"aria-label":
|
39
|
+
"aria-label": `${i18n.t(`Go to ${prevMonth.label}`)}`,
|
40
40
|
type: "button",
|
41
41
|
className: _JSXStyle.dynamic([["3883083596", [spacers.dp4, colors.grey600, colors.grey200, colors.grey900, colors.grey300, spacers.dp8, spacers.dp4, wrapperBorderColor, headerBackground]]])
|
42
42
|
}, /*#__PURE__*/React.createElement(PreviousIcon, {
|
@@ -51,7 +51,7 @@ export const NavigationContainer = _ref => {
|
|
51
51
|
onClick: nextMonth.navigateTo,
|
52
52
|
"data-test": "calendar-next-month",
|
53
53
|
name: "next-month",
|
54
|
-
"aria-label":
|
54
|
+
"aria-label": `${i18n.t(`Go to ${nextMonth.label}`)}`,
|
55
55
|
type: "button",
|
56
56
|
className: _JSXStyle.dynamic([["3883083596", [spacers.dp4, colors.grey600, colors.grey200, colors.grey900, colors.grey300, spacers.dp8, spacers.dp4, wrapperBorderColor, headerBackground]]])
|
57
57
|
}, /*#__PURE__*/React.createElement(NextIcon, {
|
@@ -63,7 +63,7 @@ export const NavigationContainer = _ref => {
|
|
63
63
|
}, /*#__PURE__*/React.createElement("button", {
|
64
64
|
onClick: prevYear.navigateTo,
|
65
65
|
name: "previous-year",
|
66
|
-
"aria-label":
|
66
|
+
"aria-label": `${i18n.t('Go to previous year')}`,
|
67
67
|
type: "button",
|
68
68
|
className: _JSXStyle.dynamic([["3883083596", [spacers.dp4, colors.grey600, colors.grey200, colors.grey900, colors.grey300, spacers.dp8, spacers.dp4, wrapperBorderColor, headerBackground]]])
|
69
69
|
}, /*#__PURE__*/React.createElement(PreviousIcon, {
|
@@ -78,7 +78,7 @@ export const NavigationContainer = _ref => {
|
|
78
78
|
}, /*#__PURE__*/React.createElement("button", {
|
79
79
|
onClick: nextYear.navigateTo,
|
80
80
|
name: "next-year",
|
81
|
-
"aria-label":
|
81
|
+
"aria-label": `${i18n.t('Go to next year')}`,
|
82
82
|
type: "button",
|
83
83
|
className: _JSXStyle.dynamic([["3883083596", [spacers.dp4, colors.grey600, colors.grey200, colors.grey900, colors.grey300, spacers.dp8, spacers.dp4, wrapperBorderColor, headerBackground]]])
|
84
84
|
}, /*#__PURE__*/React.createElement(NextIcon, {
|
@@ -86,7 +86,7 @@ export const NavigationContainer = _ref => {
|
|
86
86
|
}))))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
87
87
|
id: "3883083596",
|
88
88
|
dynamic: [spacers.dp4, colors.grey600, colors.grey200, colors.grey900, colors.grey300, spacers.dp8, spacers.dp4, wrapperBorderColor, headerBackground]
|
89
|
-
}, ["button.__jsx-style-dynamic-selector{background:none;border:0;}", ".month.__jsx-style-dynamic-selector,.year.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:default;}", ".month.__jsx-style-dynamic-selector .curr.__jsx-style-dynamic-selector,.year.__jsx-style-dynamic-selector .curr.__jsx-style-dynamic-selector{-webkit-flex:2;-ms-flex:2;flex:2;white-space:nowrap;}", ".prev.__jsx-style-dynamic-selector,.next.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;text-align:center;}",
|
89
|
+
}, ["button.__jsx-style-dynamic-selector{background:none;border:0;}", ".month.__jsx-style-dynamic-selector,.year.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:default;}", ".month.__jsx-style-dynamic-selector .curr.__jsx-style-dynamic-selector,.year.__jsx-style-dynamic-selector .curr.__jsx-style-dynamic-selector{-webkit-flex:2;-ms-flex:2;flex:2;white-space:nowrap;}", ".prev.__jsx-style-dynamic-selector,.next.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;text-align:center;}", `.prev.__jsx-style-dynamic-selector button.__jsx-style-dynamic-selector,.next.__jsx-style-dynamic-selector button.__jsx-style-dynamic-selector{padding:${spacers.dp4};height:24px;width:24px;color:${colors.grey600};border-radius:3px;}`, ".prev.__jsx-style-dynamic-selector button.__jsx-style-dynamic-selector svg.__jsx-style-dynamic-selector,.next.__jsx-style-dynamic-selector button.__jsx-style-dynamic-selector svg.__jsx-style-dynamic-selector{width:16px;height:16px;}", `.prev.__jsx-style-dynamic-selector:hover button.__jsx-style-dynamic-selector,.next.__jsx-style-dynamic-selector:hover button.__jsx-style-dynamic-selector{background-color:${colors.grey200};color:${colors.grey900};cursor:pointer;}`, `.prev.__jsx-style-dynamic-selector button.__jsx-style-dynamic-selector:active,.next.__jsx-style-dynamic-selector button.__jsx-style-dynamic-selector:active{background-color:${colors.grey300};}`, ".label.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:4px 8px;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;min-height:16px;}", `.navigation-container.__jsx-style-dynamic-selector{gap:${spacers.dp8};padding:${spacers.dp4};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;border-bottom:1px solid ${wrapperBorderColor};background-color:${headerBackground};font-size:1.08em;}`]));
|
90
90
|
};
|
91
91
|
NavigationContainer.propTypes = {
|
92
92
|
languageDirection: PropTypes.oneOf(['ltr', 'rtl']),
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
2
|
-
|
3
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
|
-
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
5
3
|
import { Button } from '@dhis2-ui/button';
|
6
4
|
import { Card } from '@dhis2-ui/card';
|
7
5
|
import { InputField, InputFieldProps } from '@dhis2-ui/input';
|
@@ -39,7 +37,6 @@ export const CalendarInput = function () {
|
|
39
37
|
setOpen(false);
|
40
38
|
onDateSelect === null || onDateSelect === void 0 ? void 0 : onDateSelect(selectedDate);
|
41
39
|
};
|
42
|
-
|
43
40
|
return {
|
44
41
|
onDateSelect: onDateSelectWrapper,
|
45
42
|
calendar,
|
@@ -53,11 +50,9 @@ export const CalendarInput = function () {
|
|
53
50
|
cellSize
|
54
51
|
};
|
55
52
|
}, [calendar, cellSize, date, dir, locale, numberingSystem, onDateSelect, timeZone, weekDayFormat, width]);
|
56
|
-
|
57
53
|
const onFocus = () => {
|
58
54
|
setOpen(true);
|
59
55
|
};
|
60
|
-
|
61
56
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
62
57
|
ref: ref,
|
63
58
|
className: "jsx-862452676" + " " + "calendar-input-wrapper"
|
@@ -98,6 +93,7 @@ export const CalendarInput = function () {
|
|
98
93
|
CalendarInput.defaultProps = {
|
99
94
|
dataTest: 'dhis2-uiwidgets-calendar-inputfield'
|
100
95
|
};
|
101
|
-
CalendarInput.propTypes = {
|
96
|
+
CalendarInput.propTypes = {
|
97
|
+
...CalendarProps,
|
102
98
|
...InputFieldProps
|
103
99
|
};
|
@@ -9,7 +9,7 @@ Given('a "{word}" calendar is rendered with a selected date "{word}"', (calendar
|
|
9
9
|
cy.get('[data-test="storybook-calendar-date-value"]').should('have.text', initialDate);
|
10
10
|
});
|
11
11
|
Then('we should be able to clear it', () => {
|
12
|
-
cy.get(
|
12
|
+
cy.get(`[data-test="calendar-clear-button"]`).click();
|
13
13
|
cy.get('[data-test="storybook-calendar-date-value"]').should('have.text', 'undefined');
|
14
14
|
});
|
15
15
|
Then('show the current month afterwards', () => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
2
|
Given('an Ethiopic calendar is rendered in {word}', language => {
|
3
|
-
cy.visitStory('CalendarInputTesting',
|
3
|
+
cy.visitStory('CalendarInputTesting', `Ethiopic With ${language}`);
|
4
4
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"]').click();
|
5
5
|
cy.get('[data-test=calendar]').should('be.visible');
|
6
6
|
});
|
@@ -32,7 +32,7 @@ Then('the era should not be displayed in the year', () => {
|
|
32
32
|
});
|
33
33
|
Then('we should be able to select a day', () => {
|
34
34
|
const date = '2014-02-03';
|
35
|
-
cy.get(
|
35
|
+
cy.get(`[data-test="${date}"]`).click();
|
36
36
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"] input').should('have.value', date);
|
37
37
|
cy.get('[data-test="storybook-calendar-result"]').should('have.text', date);
|
38
38
|
cy.get('[data-test="storybook-calendar-result-iso"]').should('have.text', '13 October 2021');
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
2
|
Given('a Gregorian calendar is rendered in {word}', language => {
|
3
|
-
cy.visitStory('CalendarInputTesting',
|
3
|
+
cy.visitStory('CalendarInputTesting', `Gregorian With ${language}`);
|
4
4
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"]').click();
|
5
5
|
cy.get('[data-test=calendar]').should('be.visible');
|
6
6
|
});
|
@@ -29,7 +29,7 @@ Then('months should be rendered in "{word}" with navigation', language => {
|
|
29
29
|
});
|
30
30
|
Then('we should be able to select a day', () => {
|
31
31
|
const date = '2021-10-13';
|
32
|
-
cy.get(
|
32
|
+
cy.get(`[data-test="${date}"]`).click();
|
33
33
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"] input').should('have.value', date);
|
34
34
|
cy.get('[data-test="storybook-calendar-result"]').should('have.text', date);
|
35
35
|
cy.get('[data-test="storybook-calendar-result-iso"]').should('have.text', '13 October 2021');
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
2
|
Given('an Islamic calendar is rendered with Arabic locale', () => {
|
3
|
-
cy.visitStory('CalendarInputTesting',
|
3
|
+
cy.visitStory('CalendarInputTesting', `Islamic With Arabic`);
|
4
4
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"]').click();
|
5
5
|
cy.get('[data-test=calendar]').should('be.visible');
|
6
6
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
|
2
2
|
Given('a nepali calendar in "{word}" is rendered', language => {
|
3
|
-
cy.visitStory('CalendarInputTesting',
|
3
|
+
cy.visitStory('CalendarInputTesting', `Nepali With ${language}`);
|
4
4
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"]', {
|
5
5
|
timeout: 10000
|
6
6
|
}).click();
|
@@ -14,6 +14,7 @@ Then('nepali days should be rendered in "{word}"', language => {
|
|
14
14
|
});
|
15
15
|
Then('months should be rendered in "{word}" with navigation', language => {
|
16
16
|
//
|
17
|
+
|
17
18
|
const months = language === 'nepali' ? {
|
18
19
|
current: 'असोज',
|
19
20
|
previous: 'भदौ',
|
@@ -32,7 +33,7 @@ Then('months should be rendered in "{word}" with navigation', language => {
|
|
32
33
|
});
|
33
34
|
Then('we should be able to select a day', () => {
|
34
35
|
const nepaliDate = '2078-06-27';
|
35
|
-
cy.get(
|
36
|
+
cy.get(`[data-test="${nepaliDate}"]`).click();
|
36
37
|
cy.get('[data-test="dhis2-uiwidgets-calendar-inputfield"] input').should('have.value', nepaliDate);
|
37
38
|
cy.get('[data-test="storybook-calendar-result"]').should('have.text', nepaliDate);
|
38
39
|
cy.get('[data-test="storybook-calendar-result-iso"]').should('have.text', '13 October 2021');
|