@dhis2-ui/calendar 10.0.0-alpha.6 → 10.0.0-alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- package/build/cjs/calendar/calendar.js +3 -8
- package/build/cjs/calendar-input/calendar-input.js +2 -0
- package/build/cjs/stories/calendar-story-wrapper.js +3 -8
- package/build/es/calendar/calendar.js +3 -8
- package/build/es/calendar-input/calendar-input.js +2 -0
- package/build/es/stories/calendar-story-wrapper.js +3 -8
- package/package.json +8 -8
@@ -19,10 +19,10 @@ const Calendar = _ref => {
|
|
19
19
|
dir,
|
20
20
|
locale,
|
21
21
|
numberingSystem,
|
22
|
-
weekDayFormat,
|
22
|
+
weekDayFormat = 'narrow',
|
23
23
|
timeZone,
|
24
|
-
width,
|
25
|
-
cellSize
|
24
|
+
width = '240px',
|
25
|
+
cellSize = '32px'
|
26
26
|
} = _ref;
|
27
27
|
const [selectedDateString, setSelectedDateString] = (0, _react.useState)(date);
|
28
28
|
const languageDirection = (0, _multiCalendarDates.useResolvedDirection)(dir, locale);
|
@@ -70,11 +70,6 @@ const Calendar = _ref => {
|
|
70
70
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_calendarContainer.CalendarContainer, calendarProps));
|
71
71
|
};
|
72
72
|
exports.Calendar = Calendar;
|
73
|
-
Calendar.defaultProps = {
|
74
|
-
cellSize: '32px',
|
75
|
-
width: '240px',
|
76
|
-
weekDayFormat: 'narrow'
|
77
|
-
};
|
78
73
|
const CalendarProps = exports.CalendarProps = {
|
79
74
|
/** 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 */
|
80
75
|
calendar: _propTypes.default.any.isRequired,
|
@@ -43,6 +43,7 @@ const CalendarInput = function () {
|
|
43
43
|
format,
|
44
44
|
strictValidation,
|
45
45
|
inputWidth,
|
46
|
+
dataTest = 'dhis2-uiwidgets-calendar-inputfield',
|
46
47
|
...rest
|
47
48
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
48
49
|
const ref = (0, _react.useRef)();
|
@@ -134,6 +135,7 @@ const CalendarInput = function () {
|
|
134
135
|
}, /*#__PURE__*/_react.default.createElement(_input.InputField, _extends({
|
135
136
|
label: _index.default.t('Pick a date')
|
136
137
|
}, rest, {
|
138
|
+
dataTest: dataTest,
|
137
139
|
type: "text",
|
138
140
|
onFocus: onFocus,
|
139
141
|
value: partialDate,
|
@@ -18,13 +18,13 @@ const {
|
|
18
18
|
} = _multiCalendarDates.constants;
|
19
19
|
const CalendarStoryWrapper = props => {
|
20
20
|
const {
|
21
|
-
calendar,
|
21
|
+
calendar = 'gregory',
|
22
22
|
locale,
|
23
23
|
timeZone,
|
24
24
|
dir,
|
25
|
-
component: Component,
|
25
|
+
component: Component = _calendar.Calendar,
|
26
26
|
date,
|
27
|
-
weekDayFormat
|
27
|
+
weekDayFormat = 'narrow'
|
28
28
|
} = props;
|
29
29
|
const [selectedCalendar, setSelectedCalendar] = (0, _react.useState)(calendar);
|
30
30
|
const [selectedNumberingSystem, setSelectedNumberingSystem] = (0, _react.useState)();
|
@@ -161,11 +161,6 @@ const CalendarStoryWrapper = props => {
|
|
161
161
|
}, selectedDate.calendarDateString)), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("label", null, "callback:"), JSON.stringify(selectedDate, null, 2))))));
|
162
162
|
};
|
163
163
|
exports.CalendarStoryWrapper = CalendarStoryWrapper;
|
164
|
-
CalendarStoryWrapper.defaultProps = {
|
165
|
-
calendar: 'gregorian',
|
166
|
-
component: _calendar.Calendar,
|
167
|
-
weekDayFormat: 'narrow'
|
168
|
-
};
|
169
164
|
CalendarStoryWrapper.propTypes = {
|
170
165
|
calendar: _propTypes.default.string.isRequired,
|
171
166
|
component: _propTypes.default.elementType.isRequired,
|
@@ -10,10 +10,10 @@ export const Calendar = _ref => {
|
|
10
10
|
dir,
|
11
11
|
locale,
|
12
12
|
numberingSystem,
|
13
|
-
weekDayFormat,
|
13
|
+
weekDayFormat = 'narrow',
|
14
14
|
timeZone,
|
15
|
-
width,
|
16
|
-
cellSize
|
15
|
+
width = '240px',
|
16
|
+
cellSize = '32px'
|
17
17
|
} = _ref;
|
18
18
|
const [selectedDateString, setSelectedDateString] = useState(date);
|
19
19
|
const languageDirection = useResolvedDirection(dir, locale);
|
@@ -60,11 +60,6 @@ export const Calendar = _ref => {
|
|
60
60
|
}, [cellSize, date, dir, locale, pickerResults, width, languageDirection]);
|
61
61
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CalendarContainer, calendarProps));
|
62
62
|
};
|
63
|
-
Calendar.defaultProps = {
|
64
|
-
cellSize: '32px',
|
65
|
-
width: '240px',
|
66
|
-
weekDayFormat: 'narrow'
|
67
|
-
};
|
68
63
|
export const CalendarProps = {
|
69
64
|
/** 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 */
|
70
65
|
calendar: PropTypes.any.isRequired,
|
@@ -34,6 +34,7 @@ export const CalendarInput = function () {
|
|
34
34
|
format,
|
35
35
|
strictValidation,
|
36
36
|
inputWidth,
|
37
|
+
dataTest = 'dhis2-uiwidgets-calendar-inputfield',
|
37
38
|
...rest
|
38
39
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
39
40
|
const ref = useRef();
|
@@ -125,6 +126,7 @@ export const CalendarInput = function () {
|
|
125
126
|
}, /*#__PURE__*/React.createElement(InputField, _extends({
|
126
127
|
label: i18n.t('Pick a date')
|
127
128
|
}, rest, {
|
129
|
+
dataTest: dataTest,
|
128
130
|
type: "text",
|
129
131
|
onFocus: onFocus,
|
130
132
|
value: partialDate,
|
@@ -9,13 +9,13 @@ const {
|
|
9
9
|
} = constants;
|
10
10
|
export const CalendarStoryWrapper = props => {
|
11
11
|
const {
|
12
|
-
calendar,
|
12
|
+
calendar = 'gregory',
|
13
13
|
locale,
|
14
14
|
timeZone,
|
15
15
|
dir,
|
16
|
-
component: Component,
|
16
|
+
component: Component = Calendar,
|
17
17
|
date,
|
18
|
-
weekDayFormat
|
18
|
+
weekDayFormat = 'narrow'
|
19
19
|
} = props;
|
20
20
|
const [selectedCalendar, setSelectedCalendar] = useState(calendar);
|
21
21
|
const [selectedNumberingSystem, setSelectedNumberingSystem] = useState();
|
@@ -151,11 +151,6 @@ export const CalendarStoryWrapper = props => {
|
|
151
151
|
"data-test": "storybook-calendar-result"
|
152
152
|
}, selectedDate.calendarDateString)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "callback:"), JSON.stringify(selectedDate, null, 2))))));
|
153
153
|
};
|
154
|
-
CalendarStoryWrapper.defaultProps = {
|
155
|
-
calendar: 'gregorian',
|
156
|
-
component: Calendar,
|
157
|
-
weekDayFormat: 'narrow'
|
158
|
-
};
|
159
154
|
CalendarStoryWrapper.propTypes = {
|
160
155
|
calendar: PropTypes.string.isRequired,
|
161
156
|
component: PropTypes.elementType.isRequired,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dhis2-ui/calendar",
|
3
|
-
"version": "10.0.0-alpha.
|
3
|
+
"version": "10.0.0-alpha.7",
|
4
4
|
"description": "UI Calendar",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -33,15 +33,15 @@
|
|
33
33
|
"styled-jsx": "^4"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@dhis2-ui/button": "10.0.0-alpha.
|
37
|
-
"@dhis2-ui/card": "10.0.0-alpha.
|
38
|
-
"@dhis2-ui/input": "10.0.0-alpha.
|
39
|
-
"@dhis2-ui/layer": "10.0.0-alpha.
|
40
|
-
"@dhis2-ui/popper": "10.0.0-alpha.
|
36
|
+
"@dhis2-ui/button": "10.0.0-alpha.7",
|
37
|
+
"@dhis2-ui/card": "10.0.0-alpha.7",
|
38
|
+
"@dhis2-ui/input": "10.0.0-alpha.7",
|
39
|
+
"@dhis2-ui/layer": "10.0.0-alpha.7",
|
40
|
+
"@dhis2-ui/popper": "10.0.0-alpha.7",
|
41
41
|
"@dhis2/multi-calendar-dates": "2.0.0-alpha.5",
|
42
42
|
"@dhis2/prop-types": "^3.1.2",
|
43
|
-
"@dhis2/ui-constants": "10.0.0-alpha.
|
44
|
-
"@dhis2/ui-icons": "10.0.0-alpha.
|
43
|
+
"@dhis2/ui-constants": "10.0.0-alpha.7",
|
44
|
+
"@dhis2/ui-icons": "10.0.0-alpha.7",
|
45
45
|
"classnames": "^2.3.1",
|
46
46
|
"prop-types": "^15.7.2"
|
47
47
|
},
|