@dhis2-ui/calendar 10.0.0-alpha.1 → 10.0.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/build/cjs/calendar/calendar.js +1 -1
- package/build/cjs/calendar-input/calendar-input.js +10 -17
- package/build/cjs/stories/calendar-input.prod.stories.js +16 -14
- package/build/cjs/stories/calendar-story-wrapper.js +2 -1
- package/build/es/calendar/calendar.js +1 -1
- package/build/es/calendar-input/calendar-input.js +10 -17
- package/build/es/stories/calendar-input.prod.stories.js +15 -13
- package/build/es/stories/calendar-story-wrapper.js +2 -1
- package/package.json +9 -9
- package/types/index.d.ts +6 -4
@@ -78,7 +78,7 @@ Calendar.defaultProps = {
|
|
78
78
|
const CalendarProps = exports.CalendarProps = {
|
79
79
|
/** 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
80
|
calendar: _propTypes.default.any.isRequired,
|
81
|
-
/** Called with signature `(null)` \|\| `({ dateCalendarString: string })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
81
|
+
/** Called with signature `(null)` \|\| `({ dateCalendarString: string, validation: { error: boolean, warning: boolean, validationText: string} })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
82
82
|
onDateSelect: _propTypes.default.func.isRequired,
|
83
83
|
/** the size of a single cell in the table forming the calendar */
|
84
84
|
cellSize: _propTypes.default.string,
|
@@ -48,7 +48,6 @@ const CalendarInput = function () {
|
|
48
48
|
const ref = (0, _react.useRef)();
|
49
49
|
const [open, setOpen] = (0, _react.useState)(false);
|
50
50
|
const [partialDate, setPartialDate] = (0, _react.useState)(date);
|
51
|
-
const [isIconDisplayed, setIsIconDisplayed] = (0, _react.useState)(false);
|
52
51
|
const excludeRef = (0, _react.useRef)(null);
|
53
52
|
(0, _react.useEffect)(() => setPartialDate(date), [date]);
|
54
53
|
const useDatePickerOptions = (0, _react.useMemo)(() => ({
|
@@ -59,18 +58,17 @@ const CalendarInput = function () {
|
|
59
58
|
}), [calendar, locale, numberingSystem, weekDayFormat]);
|
60
59
|
const pickerResults = (0, _multiCalendarDates.useDatePicker)({
|
61
60
|
onDateSelect: result => {
|
62
|
-
const
|
61
|
+
const validation = (0, _multiCalendarDates.validateDateString)(result.calendarDateString, {
|
63
62
|
calendar,
|
64
63
|
format,
|
65
64
|
minDateString: minDate,
|
66
65
|
maxDateString: maxDate,
|
67
66
|
strictValidation
|
68
67
|
});
|
69
|
-
setIsIconDisplayed(validated.errorMessage || validated.warningMessage);
|
70
68
|
setOpen(false);
|
71
69
|
parentOnDateSelect === null || parentOnDateSelect === void 0 ? void 0 : parentOnDateSelect({
|
72
70
|
calendarDateString: result.calendarDateString,
|
73
|
-
|
71
|
+
validation
|
74
72
|
});
|
75
73
|
},
|
76
74
|
date,
|
@@ -85,17 +83,16 @@ const CalendarInput = function () {
|
|
85
83
|
setPartialDate(e.value);
|
86
84
|
};
|
87
85
|
const handleBlur = (_, e) => {
|
88
|
-
const
|
86
|
+
const validation = (0, _multiCalendarDates.validateDateString)(partialDate, {
|
89
87
|
calendar,
|
90
88
|
format,
|
91
89
|
minDateString: minDate,
|
92
90
|
maxDateString: maxDate,
|
93
91
|
strictValidation
|
94
92
|
});
|
95
|
-
setIsIconDisplayed(validated.errorMessage || validated.warningMessage);
|
96
93
|
parentOnDateSelect === null || parentOnDateSelect === void 0 ? void 0 : parentOnDateSelect({
|
97
94
|
calendarDateString: partialDate,
|
98
|
-
|
95
|
+
validation
|
99
96
|
});
|
100
97
|
if (excludeRef.current && !excludeRef.current.contains(e.relatedTarget)) {
|
101
98
|
setOpen(false);
|
@@ -124,7 +121,7 @@ const CalendarInput = function () {
|
|
124
121
|
}, [cellSize, date, pickerResults, width, languageDirection]);
|
125
122
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
126
123
|
ref: ref,
|
127
|
-
className: _style.default.dynamic([["
|
124
|
+
className: _style.default.dynamic([["423137534", [inputWidth, rest.error || rest.warning ? '36px' : '6px']]]) + " " + "calendar-input-wrapper"
|
128
125
|
}, /*#__PURE__*/_react.default.createElement(_input.InputField, _extends({
|
129
126
|
label: _index.default.t('Pick a date')
|
130
127
|
}, rest, {
|
@@ -133,12 +130,9 @@ const CalendarInput = function () {
|
|
133
130
|
value: partialDate,
|
134
131
|
onChange: handleChange,
|
135
132
|
onBlur: handleBlur,
|
136
|
-
validationText: pickerResults.errorMessage || pickerResults.warningMessage,
|
137
|
-
error: !!pickerResults.errorMessage,
|
138
|
-
warning: !!pickerResults.warningMessage,
|
139
133
|
inputWidth: inputWidth
|
140
134
|
})), clearable && /*#__PURE__*/_react.default.createElement("div", {
|
141
|
-
className: _style.default.dynamic([["
|
135
|
+
className: _style.default.dynamic([["423137534", [inputWidth, rest.error || rest.warning ? '36px' : '6px']]]) + " " + ((0, _classnames.default)('calendar-clear-button', {
|
142
136
|
'with-icon': rest.valid || rest.error || rest.warning || rest.loading,
|
143
137
|
'with-dense-wrapper': rest.dense
|
144
138
|
}) || "")
|
@@ -148,7 +142,6 @@ const CalendarInput = function () {
|
|
148
142
|
small: true,
|
149
143
|
onClick: () => {
|
150
144
|
parentOnDateSelect === null || parentOnDateSelect === void 0 ? void 0 : parentOnDateSelect(null);
|
151
|
-
setIsIconDisplayed(false);
|
152
145
|
},
|
153
146
|
type: "button"
|
154
147
|
}, _index.default.t('Clear')))), open && /*#__PURE__*/_react.default.createElement(_layer.Layer, {
|
@@ -163,9 +156,9 @@ const CalendarInput = function () {
|
|
163
156
|
excludedRef: excludeRef,
|
164
157
|
unfocusable: true
|
165
158
|
}))))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
166
|
-
id: "
|
167
|
-
dynamic: [inputWidth,
|
168
|
-
}, [`.calendar-input-wrapper.__jsx-style-dynamic-selector{position:relative;width:${inputWidth};}`, `.calendar-clear-button.__jsx-style-dynamic-selector{position:absolute;inset-inline-end:${
|
159
|
+
id: "423137534",
|
160
|
+
dynamic: [inputWidth, rest.error || rest.warning ? '36px' : '6px']
|
161
|
+
}, [`.calendar-input-wrapper.__jsx-style-dynamic-selector{position:relative;width:${inputWidth};}`, `.calendar-clear-button.__jsx-style-dynamic-selector{position:absolute;inset-inline-end:${rest.error || rest.warning ? '36px' : '6px'};-webkit-inset-block-start:27px;-ms-intb-rlock-start:27px;inset-block-start:27px;}`, ".calendar-clear-button.with-icon.__jsx-style-dynamic-selector{inset-inline-end:36px;}", ".calendar-clear-button.with-dense-wrapper.__jsx-style-dynamic-selector{-webkit-inset-block-start:23px;-ms-intb-rlock-start:23px;inset-block-start:23px;}"]));
|
169
162
|
};
|
170
163
|
exports.CalendarInput = CalendarInput;
|
171
164
|
CalendarInput.defaultProps = {
|
@@ -177,7 +170,7 @@ CalendarInput.defaultProps = {
|
|
177
170
|
CalendarInput.propTypes = {
|
178
171
|
/** 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 */
|
179
172
|
calendar: _propTypes.default.any.isRequired,
|
180
|
-
/** Called with signature `(null)` \|\| `({ dateCalendarString: string })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
173
|
+
/** Called with signature `(null)` \|\| `({ dateCalendarString: string, validation: { error: boolean, warning: boolean, validationText: string} })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
181
174
|
onDateSelect: _propTypes.default.func.isRequired,
|
182
175
|
/** the size of a single cell in the table forming the calendar */
|
183
176
|
cellSize: _propTypes.default.string,
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.CalendarWithClearButton = void 0;
|
7
|
+
exports.CalendarWithEditableInputReactForm = CalendarWithEditableInputReactForm;
|
7
8
|
exports.CalendarWithEditiableInput = CalendarWithEditiableInput;
|
8
|
-
exports.CalendarWithEditiableInputReactForm = CalendarWithEditiableInputReactForm;
|
9
9
|
exports.default = exports.NepaliWithNepali = exports.NepaliWithEnglish = exports.IslamicWithArabic = exports.GregorianWithEnglish = exports.GregorianWithArabic = exports.EthiopicWithEnglish = exports.EthiopicWithAmharic = void 0;
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
11
|
var _reactFinalForm = require("react-final-form");
|
@@ -135,11 +135,11 @@ function CalendarWithEditiableInput() {
|
|
135
135
|
clearable: true
|
136
136
|
})));
|
137
137
|
}
|
138
|
-
function
|
139
|
-
const [
|
138
|
+
function CalendarWithEditableInputReactForm() {
|
139
|
+
const [validation, setValidation] = (0, _react.useState)({});
|
140
140
|
const errored = () => {
|
141
141
|
return {
|
142
|
-
calendar:
|
142
|
+
calendar: validation.validationText
|
143
143
|
};
|
144
144
|
};
|
145
145
|
return /*#__PURE__*/_react.default.createElement(_reactFinalForm.Form, {
|
@@ -155,7 +155,8 @@ function CalendarWithEditiableInputReactForm() {
|
|
155
155
|
validate: errored
|
156
156
|
}, _ref3 => {
|
157
157
|
let {
|
158
|
-
handleSubmit
|
158
|
+
handleSubmit,
|
159
|
+
invalid
|
159
160
|
} = _ref3;
|
160
161
|
return /*#__PURE__*/_react.default.createElement("form", {
|
161
162
|
onSubmit: handleSubmit
|
@@ -166,19 +167,20 @@ function CalendarWithEditiableInputReactForm() {
|
|
166
167
|
meta: props.meta,
|
167
168
|
editable: true,
|
168
169
|
date: props.input.value,
|
169
|
-
calendar: "gregory"
|
170
|
+
calendar: "gregory"
|
171
|
+
}, validation, {
|
172
|
+
minDate: "2022-11-01",
|
170
173
|
onDateSelect: date => {
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
174
|
+
const validation = {
|
175
|
+
...date.validation,
|
176
|
+
validationText: date.validation.validationCode === 'WRONG_FORMAT' ? 'custom validation message for format' : date.validation.validationText
|
177
|
+
};
|
178
|
+
setValidation(validation);
|
176
179
|
props.input.onChange(date ? date === null || date === void 0 ? void 0 : date.calendarDateString : '');
|
177
|
-
}
|
178
|
-
timeZone: 'UTC'
|
180
|
+
}
|
179
181
|
}))), /*#__PURE__*/_react.default.createElement("button", {
|
180
182
|
type: "submit",
|
181
|
-
disabled:
|
183
|
+
disabled: invalid,
|
182
184
|
onClick: handleSubmit
|
183
185
|
}, "Submit"));
|
184
186
|
});
|
@@ -143,7 +143,8 @@ const CalendarStoryWrapper = props => {
|
|
143
143
|
date: selectedDate.calendarDateString,
|
144
144
|
onDateSelect: date => {
|
145
145
|
setSelectedDate(date);
|
146
|
-
}
|
146
|
+
}
|
147
|
+
}, selectedDate.validation, {
|
147
148
|
timeZone: timeZone,
|
148
149
|
weekDayFormat: selectedWeekFormat,
|
149
150
|
numberingSystem: selectedNumberingSystem
|
@@ -68,7 +68,7 @@ Calendar.defaultProps = {
|
|
68
68
|
export const CalendarProps = {
|
69
69
|
/** 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
70
|
calendar: PropTypes.any.isRequired,
|
71
|
-
/** Called with signature `(null)` \|\| `({ dateCalendarString: string })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
71
|
+
/** Called with signature `(null)` \|\| `({ dateCalendarString: string, validation: { error: boolean, warning: boolean, validationText: string} })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
72
72
|
onDateSelect: PropTypes.func.isRequired,
|
73
73
|
/** the size of a single cell in the table forming the calendar */
|
74
74
|
cellSize: PropTypes.string,
|
@@ -39,7 +39,6 @@ export const CalendarInput = function () {
|
|
39
39
|
const ref = useRef();
|
40
40
|
const [open, setOpen] = useState(false);
|
41
41
|
const [partialDate, setPartialDate] = useState(date);
|
42
|
-
const [isIconDisplayed, setIsIconDisplayed] = useState(false);
|
43
42
|
const excludeRef = useRef(null);
|
44
43
|
useEffect(() => setPartialDate(date), [date]);
|
45
44
|
const useDatePickerOptions = useMemo(() => ({
|
@@ -50,18 +49,17 @@ export const CalendarInput = function () {
|
|
50
49
|
}), [calendar, locale, numberingSystem, weekDayFormat]);
|
51
50
|
const pickerResults = useDatePicker({
|
52
51
|
onDateSelect: result => {
|
53
|
-
const
|
52
|
+
const validation = validateDateString(result.calendarDateString, {
|
54
53
|
calendar,
|
55
54
|
format,
|
56
55
|
minDateString: minDate,
|
57
56
|
maxDateString: maxDate,
|
58
57
|
strictValidation
|
59
58
|
});
|
60
|
-
setIsIconDisplayed(validated.errorMessage || validated.warningMessage);
|
61
59
|
setOpen(false);
|
62
60
|
parentOnDateSelect === null || parentOnDateSelect === void 0 ? void 0 : parentOnDateSelect({
|
63
61
|
calendarDateString: result.calendarDateString,
|
64
|
-
|
62
|
+
validation
|
65
63
|
});
|
66
64
|
},
|
67
65
|
date,
|
@@ -76,17 +74,16 @@ export const CalendarInput = function () {
|
|
76
74
|
setPartialDate(e.value);
|
77
75
|
};
|
78
76
|
const handleBlur = (_, e) => {
|
79
|
-
const
|
77
|
+
const validation = validateDateString(partialDate, {
|
80
78
|
calendar,
|
81
79
|
format,
|
82
80
|
minDateString: minDate,
|
83
81
|
maxDateString: maxDate,
|
84
82
|
strictValidation
|
85
83
|
});
|
86
|
-
setIsIconDisplayed(validated.errorMessage || validated.warningMessage);
|
87
84
|
parentOnDateSelect === null || parentOnDateSelect === void 0 ? void 0 : parentOnDateSelect({
|
88
85
|
calendarDateString: partialDate,
|
89
|
-
|
86
|
+
validation
|
90
87
|
});
|
91
88
|
if (excludeRef.current && !excludeRef.current.contains(e.relatedTarget)) {
|
92
89
|
setOpen(false);
|
@@ -115,7 +112,7 @@ export const CalendarInput = function () {
|
|
115
112
|
}, [cellSize, date, pickerResults, width, languageDirection]);
|
116
113
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
117
114
|
ref: ref,
|
118
|
-
className: _JSXStyle.dynamic([["
|
115
|
+
className: _JSXStyle.dynamic([["423137534", [inputWidth, rest.error || rest.warning ? '36px' : '6px']]]) + " " + "calendar-input-wrapper"
|
119
116
|
}, /*#__PURE__*/React.createElement(InputField, _extends({
|
120
117
|
label: i18n.t('Pick a date')
|
121
118
|
}, rest, {
|
@@ -124,12 +121,9 @@ export const CalendarInput = function () {
|
|
124
121
|
value: partialDate,
|
125
122
|
onChange: handleChange,
|
126
123
|
onBlur: handleBlur,
|
127
|
-
validationText: pickerResults.errorMessage || pickerResults.warningMessage,
|
128
|
-
error: !!pickerResults.errorMessage,
|
129
|
-
warning: !!pickerResults.warningMessage,
|
130
124
|
inputWidth: inputWidth
|
131
125
|
})), clearable && /*#__PURE__*/React.createElement("div", {
|
132
|
-
className: _JSXStyle.dynamic([["
|
126
|
+
className: _JSXStyle.dynamic([["423137534", [inputWidth, rest.error || rest.warning ? '36px' : '6px']]]) + " " + (cx('calendar-clear-button', {
|
133
127
|
'with-icon': rest.valid || rest.error || rest.warning || rest.loading,
|
134
128
|
'with-dense-wrapper': rest.dense
|
135
129
|
}) || "")
|
@@ -139,7 +133,6 @@ export const CalendarInput = function () {
|
|
139
133
|
small: true,
|
140
134
|
onClick: () => {
|
141
135
|
parentOnDateSelect === null || parentOnDateSelect === void 0 ? void 0 : parentOnDateSelect(null);
|
142
|
-
setIsIconDisplayed(false);
|
143
136
|
},
|
144
137
|
type: "button"
|
145
138
|
}, i18n.t('Clear')))), open && /*#__PURE__*/React.createElement(Layer, {
|
@@ -154,9 +147,9 @@ export const CalendarInput = function () {
|
|
154
147
|
excludedRef: excludeRef,
|
155
148
|
unfocusable: true
|
156
149
|
}))))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
157
|
-
id: "
|
158
|
-
dynamic: [inputWidth,
|
159
|
-
}, [`.calendar-input-wrapper.__jsx-style-dynamic-selector{position:relative;width:${inputWidth};}`, `.calendar-clear-button.__jsx-style-dynamic-selector{position:absolute;inset-inline-end:${
|
150
|
+
id: "423137534",
|
151
|
+
dynamic: [inputWidth, rest.error || rest.warning ? '36px' : '6px']
|
152
|
+
}, [`.calendar-input-wrapper.__jsx-style-dynamic-selector{position:relative;width:${inputWidth};}`, `.calendar-clear-button.__jsx-style-dynamic-selector{position:absolute;inset-inline-end:${rest.error || rest.warning ? '36px' : '6px'};-webkit-inset-block-start:27px;-ms-intb-rlock-start:27px;inset-block-start:27px;}`, ".calendar-clear-button.with-icon.__jsx-style-dynamic-selector{inset-inline-end:36px;}", ".calendar-clear-button.with-dense-wrapper.__jsx-style-dynamic-selector{-webkit-inset-block-start:23px;-ms-intb-rlock-start:23px;inset-block-start:23px;}"]));
|
160
153
|
};
|
161
154
|
CalendarInput.defaultProps = {
|
162
155
|
dataTest: 'dhis2-uiwidgets-calendar-inputfield',
|
@@ -167,7 +160,7 @@ CalendarInput.defaultProps = {
|
|
167
160
|
CalendarInput.propTypes = {
|
168
161
|
/** 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 */
|
169
162
|
calendar: PropTypes.any.isRequired,
|
170
|
-
/** Called with signature `(null)` \|\| `({ dateCalendarString: string })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
163
|
+
/** Called with signature `(null)` \|\| `({ dateCalendarString: string, validation: { error: boolean, warning: boolean, validationText: string} })` with `dateCalendarString` being the stringified date in the specified calendar in the format `yyyy-MM-dd` */
|
171
164
|
onDateSelect: PropTypes.func.isRequired,
|
172
165
|
/** the size of a single cell in the table forming the calendar */
|
173
166
|
cellSize: PropTypes.string,
|
@@ -122,11 +122,11 @@ export function CalendarWithEditiableInput() {
|
|
122
122
|
clearable: true
|
123
123
|
})));
|
124
124
|
}
|
125
|
-
export function
|
126
|
-
const [
|
125
|
+
export function CalendarWithEditableInputReactForm() {
|
126
|
+
const [validation, setValidation] = useState({});
|
127
127
|
const errored = () => {
|
128
128
|
return {
|
129
|
-
calendar:
|
129
|
+
calendar: validation.validationText
|
130
130
|
};
|
131
131
|
};
|
132
132
|
return /*#__PURE__*/React.createElement(Form, {
|
@@ -142,7 +142,8 @@ export function CalendarWithEditiableInputReactForm() {
|
|
142
142
|
validate: errored
|
143
143
|
}, _ref3 => {
|
144
144
|
let {
|
145
|
-
handleSubmit
|
145
|
+
handleSubmit,
|
146
|
+
invalid
|
146
147
|
} = _ref3;
|
147
148
|
return /*#__PURE__*/React.createElement("form", {
|
148
149
|
onSubmit: handleSubmit
|
@@ -153,19 +154,20 @@ export function CalendarWithEditiableInputReactForm() {
|
|
153
154
|
meta: props.meta,
|
154
155
|
editable: true,
|
155
156
|
date: props.input.value,
|
156
|
-
calendar: "gregory"
|
157
|
+
calendar: "gregory"
|
158
|
+
}, validation, {
|
159
|
+
minDate: "2022-11-01",
|
157
160
|
onDateSelect: date => {
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
161
|
+
const validation = {
|
162
|
+
...date.validation,
|
163
|
+
validationText: date.validation.validationCode === 'WRONG_FORMAT' ? 'custom validation message for format' : date.validation.validationText
|
164
|
+
};
|
165
|
+
setValidation(validation);
|
163
166
|
props.input.onChange(date ? date === null || date === void 0 ? void 0 : date.calendarDateString : '');
|
164
|
-
}
|
165
|
-
timeZone: 'UTC'
|
167
|
+
}
|
166
168
|
}))), /*#__PURE__*/React.createElement("button", {
|
167
169
|
type: "submit",
|
168
|
-
disabled:
|
170
|
+
disabled: invalid,
|
169
171
|
onClick: handleSubmit
|
170
172
|
}, "Submit"));
|
171
173
|
});
|
@@ -134,7 +134,8 @@ export const CalendarStoryWrapper = props => {
|
|
134
134
|
date: selectedDate.calendarDateString,
|
135
135
|
onDateSelect: date => {
|
136
136
|
setSelectedDate(date);
|
137
|
-
}
|
137
|
+
}
|
138
|
+
}, selectedDate.validation, {
|
138
139
|
timeZone: timeZone,
|
139
140
|
weekDayFormat: selectedWeekFormat,
|
140
141
|
numberingSystem: selectedNumberingSystem
|
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.3",
|
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.
|
41
|
-
"@dhis2/multi-calendar-dates": "2.0.0-alpha.
|
36
|
+
"@dhis2-ui/button": "10.0.0-alpha.3",
|
37
|
+
"@dhis2-ui/card": "10.0.0-alpha.3",
|
38
|
+
"@dhis2-ui/input": "10.0.0-alpha.3",
|
39
|
+
"@dhis2-ui/layer": "10.0.0-alpha.3",
|
40
|
+
"@dhis2-ui/popper": "10.0.0-alpha.3",
|
41
|
+
"@dhis2/multi-calendar-dates": "2.0.0-alpha.2",
|
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.3",
|
44
|
+
"@dhis2/ui-icons": "10.0.0-alpha.3",
|
45
45
|
"classnames": "^2.3.1",
|
46
46
|
"prop-types": "^15.7.2"
|
47
47
|
},
|
package/types/index.d.ts
CHANGED
@@ -20,6 +20,11 @@ export interface CalendarProps {
|
|
20
20
|
* the size of a single cell in the table forming the calendar
|
21
21
|
*/
|
22
22
|
cellSize?: string
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Add a "clear" button to delete the selected date
|
26
|
+
*/
|
27
|
+
clearable?: boolean
|
23
28
|
/**
|
24
29
|
* the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601)
|
25
30
|
*/
|
@@ -52,10 +57,7 @@ export interface CalendarProps {
|
|
52
57
|
|
53
58
|
export const Calendar: React.FC<CalendarProps>
|
54
59
|
|
55
|
-
export type CalendarInputProps = Omit<
|
56
|
-
InputFieldProps,
|
57
|
-
'label' | 'type' | 'value'
|
58
|
-
> &
|
60
|
+
export type CalendarInputProps = Omit<InputFieldProps, 'type' | 'value'> &
|
59
61
|
CalendarProps
|
60
62
|
|
61
63
|
export const CalendarInput: React.FC<CalendarInputProps>
|