@dhis2-ui/calendar 10.16.1 → 10.16.3-alpha.1
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/package.json +10 -9
- package/src/__e2e__/calendar-input.e2e.stories.js +22 -0
- package/src/calendar/calendar-container.js +99 -0
- package/src/calendar/calendar-table-cell.js +97 -0
- package/src/calendar/calendar-table-days-header.js +40 -0
- package/src/calendar/calendar-table.js +74 -0
- package/src/calendar/calendar.js +104 -0
- package/src/calendar/navigation-container.js +295 -0
- package/src/calendar-input/__tests__/calendar-input.test.js +344 -0
- package/src/calendar-input/calendar-input.js +262 -0
- package/src/features/supports_calendar_clear_button/supports_calendar_clear_button.js +64 -0
- package/src/features/supports_calendar_clear_button.feature +23 -0
- package/src/features/supports_ethiopic_calendar/supports_ethiopic_calendar.js +61 -0
- package/src/features/supports_ethiopic_calendar.feature +20 -0
- package/src/features/supports_gregorian_calendar/supports_gregorian_calendar.js +62 -0
- package/src/features/supports_gregorian_calendar.feature +19 -0
- package/src/features/supports_islamic_calendar/supports_islamic_calendar.js +17 -0
- package/src/features/supports_islamic_calendar.feature +5 -0
- package/src/features/supports_nepali_calendar/supports_nepali_calendar.js +60 -0
- package/src/features/supports_nepali_calendar.feature +19 -0
- package/src/index.js +2 -0
- package/src/locales/en/translations.json +6 -0
- package/src/locales/index.js +16 -0
- package/src/stories/calendar-input.prod.stories.js +255 -0
- package/src/stories/calendar-story-wrapper.js +161 -0
- package/src/stories/calendar.prod.stories.js +91 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/calendar",
|
|
3
|
-
"version": "10.16.1",
|
|
3
|
+
"version": "10.16.3-alpha.1",
|
|
4
4
|
"description": "UI Calendar",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,21 +33,22 @@
|
|
|
33
33
|
"styled-jsx": "^4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@dhis2-ui/button": "10.16.1",
|
|
37
|
-
"@dhis2-ui/card": "10.16.1",
|
|
38
|
-
"@dhis2-ui/input": "10.16.1",
|
|
39
|
-
"@dhis2-ui/layer": "10.16.1",
|
|
40
|
-
"@dhis2-ui/popper": "10.16.1",
|
|
36
|
+
"@dhis2-ui/button": "10.16.3-alpha.1",
|
|
37
|
+
"@dhis2-ui/card": "10.16.3-alpha.1",
|
|
38
|
+
"@dhis2-ui/input": "10.16.3-alpha.1",
|
|
39
|
+
"@dhis2-ui/layer": "10.16.3-alpha.1",
|
|
40
|
+
"@dhis2-ui/popper": "10.16.3-alpha.1",
|
|
41
41
|
"@dhis2/multi-calendar-dates": "2.1.2",
|
|
42
42
|
"@dhis2/prop-types": "^3.1.2",
|
|
43
|
-
"@dhis2/ui-constants": "10.16.1",
|
|
44
|
-
"@dhis2/ui-icons": "10.16.1",
|
|
43
|
+
"@dhis2/ui-constants": "10.16.3-alpha.1",
|
|
44
|
+
"@dhis2/ui-icons": "10.16.3-alpha.1",
|
|
45
45
|
"classnames": "^2.3.1",
|
|
46
46
|
"prop-types": "^15.7.2"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"build",
|
|
50
|
-
"types"
|
|
50
|
+
"types",
|
|
51
|
+
"src"
|
|
51
52
|
],
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { CalendarInput as component } from '../index.js'
|
|
3
|
+
import { CalendarWithClearButton } from '../stories/calendar-input.prod.stories.js'
|
|
4
|
+
export default { title: 'CalendarInputTesting', component }
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
EthiopicWithAmharic,
|
|
8
|
+
EthiopicWithEnglish,
|
|
9
|
+
NepaliWithEnglish,
|
|
10
|
+
NepaliWithNepali,
|
|
11
|
+
GregorianWithArabic,
|
|
12
|
+
GregorianWithEnglish,
|
|
13
|
+
IslamicWithArabic,
|
|
14
|
+
} from '../stories/calendar-input.prod.stories.js'
|
|
15
|
+
|
|
16
|
+
export const TestCalendarWithClearButton = () => {
|
|
17
|
+
const params = new URLSearchParams(location.search)
|
|
18
|
+
const calendar = params.get('calendar') ?? 'gregory'
|
|
19
|
+
const initialDate = params.get('initialDate') ?? null
|
|
20
|
+
|
|
21
|
+
return <CalendarWithClearButton calendar={calendar} date={initialDate} />
|
|
22
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { colors, elevations } from '@dhis2/ui-constants'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import React, { useMemo } from 'react'
|
|
4
|
+
import { CalendarTable, CalendarTableProps } from './calendar-table.js'
|
|
5
|
+
import {
|
|
6
|
+
NavigationContainer,
|
|
7
|
+
NavigationContainerProps,
|
|
8
|
+
} from './navigation-container.js'
|
|
9
|
+
|
|
10
|
+
const backgroundColor = colors.white
|
|
11
|
+
|
|
12
|
+
export const CalendarContainer = React.memo(function CalendarContainer({
|
|
13
|
+
date,
|
|
14
|
+
width = '240px',
|
|
15
|
+
cellSize = '32px',
|
|
16
|
+
calendarWeekDays,
|
|
17
|
+
weekDayLabels,
|
|
18
|
+
currMonth,
|
|
19
|
+
currYear,
|
|
20
|
+
nextMonth,
|
|
21
|
+
nextYear,
|
|
22
|
+
prevMonth,
|
|
23
|
+
prevYear,
|
|
24
|
+
navigateToYear,
|
|
25
|
+
navigateToMonth,
|
|
26
|
+
months,
|
|
27
|
+
years,
|
|
28
|
+
languageDirection,
|
|
29
|
+
calendarRef,
|
|
30
|
+
}) {
|
|
31
|
+
const navigationProps = useMemo(() => {
|
|
32
|
+
return {
|
|
33
|
+
currMonth,
|
|
34
|
+
currYear,
|
|
35
|
+
nextMonth,
|
|
36
|
+
nextYear,
|
|
37
|
+
prevMonth,
|
|
38
|
+
prevYear,
|
|
39
|
+
languageDirection,
|
|
40
|
+
navigateToYear,
|
|
41
|
+
navigateToMonth,
|
|
42
|
+
months,
|
|
43
|
+
years,
|
|
44
|
+
}
|
|
45
|
+
}, [
|
|
46
|
+
currMonth,
|
|
47
|
+
currYear,
|
|
48
|
+
languageDirection,
|
|
49
|
+
nextMonth,
|
|
50
|
+
nextYear,
|
|
51
|
+
prevMonth,
|
|
52
|
+
prevYear,
|
|
53
|
+
navigateToYear,
|
|
54
|
+
navigateToMonth,
|
|
55
|
+
months,
|
|
56
|
+
years,
|
|
57
|
+
])
|
|
58
|
+
return (
|
|
59
|
+
<div>
|
|
60
|
+
<div
|
|
61
|
+
className="calendar-wrapper"
|
|
62
|
+
dir={languageDirection}
|
|
63
|
+
data-test="calendar"
|
|
64
|
+
>
|
|
65
|
+
<div ref={calendarRef}>
|
|
66
|
+
<NavigationContainer {...navigationProps} />
|
|
67
|
+
<CalendarTable
|
|
68
|
+
selectedDate={date}
|
|
69
|
+
calendarWeekDays={calendarWeekDays}
|
|
70
|
+
weekDayLabels={weekDayLabels}
|
|
71
|
+
cellSize={cellSize}
|
|
72
|
+
width={width}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<style jsx>{`
|
|
77
|
+
.calendar-wrapper {
|
|
78
|
+
font-family: Roboto, sans-serif;
|
|
79
|
+
font-weight: 400;
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
background-color: ${backgroundColor};
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
border-radius: 3px;
|
|
85
|
+
min-width: ${width};
|
|
86
|
+
width: max-content;
|
|
87
|
+
box-shadow: ${elevations.popover};
|
|
88
|
+
}
|
|
89
|
+
`}</style>
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
CalendarContainer.propTypes = {
|
|
95
|
+
/** the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601) */
|
|
96
|
+
date: PropTypes.string,
|
|
97
|
+
...CalendarTableProps,
|
|
98
|
+
...NavigationContainerProps,
|
|
99
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { colors } from '@dhis2/ui-constants'
|
|
2
|
+
import cx from 'classnames'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
export const CalendarTableCell = ({ day, cellSize, selectedDate }) => {
|
|
7
|
+
const dayHoverBackgroundColor = colors.grey200
|
|
8
|
+
const selectedDayBackgroundColor = colors.teal700
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<td data-test={day?.dateValue} onClick={day.onClick}>
|
|
12
|
+
<button
|
|
13
|
+
name="day"
|
|
14
|
+
className={cx('day', {
|
|
15
|
+
isSelected: selectedDate === day?.dateValue,
|
|
16
|
+
isToday: day.isToday,
|
|
17
|
+
otherMonth: !day.isInCurrentMonth,
|
|
18
|
+
})}
|
|
19
|
+
>
|
|
20
|
+
{day.label}
|
|
21
|
+
</button>
|
|
22
|
+
<style jsx>{`
|
|
23
|
+
td {
|
|
24
|
+
width: ${cellSize};
|
|
25
|
+
height: 100%;
|
|
26
|
+
height: ${cellSize};
|
|
27
|
+
text-align: center;
|
|
28
|
+
border: 2px solid transparent;
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
31
|
+
td span {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
padding: 2px 2px;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
border: 2px solid transparent;
|
|
36
|
+
min-width: 16px;
|
|
37
|
+
}
|
|
38
|
+
button {
|
|
39
|
+
border: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
width: ${cellSize};
|
|
42
|
+
height: ${cellSize};
|
|
43
|
+
border: 2px solid transparent;
|
|
44
|
+
border-radius: 3px;
|
|
45
|
+
background: none;
|
|
46
|
+
color: ${colors.grey900};
|
|
47
|
+
}
|
|
48
|
+
button:hover {
|
|
49
|
+
background-color: ${dayHoverBackgroundColor};
|
|
50
|
+
text-decoration: underline;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
}
|
|
53
|
+
button:active {
|
|
54
|
+
background-color: ${colors.grey300};
|
|
55
|
+
}
|
|
56
|
+
button.isSelected,
|
|
57
|
+
button.otherMonth.isSelected {
|
|
58
|
+
background-color: ${selectedDayBackgroundColor};
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
button.isToday {
|
|
62
|
+
position: relative;
|
|
63
|
+
}
|
|
64
|
+
button.isToday::after {
|
|
65
|
+
content: '';
|
|
66
|
+
position: absolute;
|
|
67
|
+
transform: translateX(-50%);
|
|
68
|
+
height: 4px;
|
|
69
|
+
width: 4px;
|
|
70
|
+
bottom: 2px;
|
|
71
|
+
left: 50%;
|
|
72
|
+
border-radius: 100%;
|
|
73
|
+
background-color: ${colors.teal600};
|
|
74
|
+
}
|
|
75
|
+
button.isSelected.isToday::after {
|
|
76
|
+
background-color: ${colors.teal200};
|
|
77
|
+
}
|
|
78
|
+
button.otherMonth {
|
|
79
|
+
color: ${colors.grey600};
|
|
80
|
+
}
|
|
81
|
+
`}</style>
|
|
82
|
+
</td>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
CalendarTableCell.propTypes = {
|
|
87
|
+
cellSize: PropTypes.string,
|
|
88
|
+
day: PropTypes.shape({
|
|
89
|
+
dateValue: PropTypes.string,
|
|
90
|
+
isInCurrentMonth: PropTypes.bool,
|
|
91
|
+
isSelected: PropTypes.bool,
|
|
92
|
+
isToday: PropTypes.bool,
|
|
93
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
94
|
+
onClick: PropTypes.func,
|
|
95
|
+
}),
|
|
96
|
+
selectedDate: PropTypes.string,
|
|
97
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { colors } from '@dhis2/ui-constants'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
export const CalendarTableDaysHeader = ({ weekDayLabels }) => {
|
|
6
|
+
const dayNamesColor = colors.grey700
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<thead>
|
|
11
|
+
<tr>
|
|
12
|
+
{weekDayLabels.map((label, i) => (
|
|
13
|
+
<th scope="col" key={`weekday-${i}`}>
|
|
14
|
+
{label}
|
|
15
|
+
</th>
|
|
16
|
+
))}
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
<style jsx>{`
|
|
20
|
+
th {
|
|
21
|
+
color: ${dayNamesColor};
|
|
22
|
+
font-weight: 300;
|
|
23
|
+
font-style: normal;
|
|
24
|
+
padding: 8px 8px;
|
|
25
|
+
background: none;
|
|
26
|
+
font-size: 0.85em;
|
|
27
|
+
border: none;
|
|
28
|
+
cursor: default;
|
|
29
|
+
}
|
|
30
|
+
tr {
|
|
31
|
+
border: none;
|
|
32
|
+
}
|
|
33
|
+
`}</style>
|
|
34
|
+
</>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
CalendarTableDaysHeader.propTypes = {
|
|
39
|
+
weekDayLabels: PropTypes.arrayOf(PropTypes.string),
|
|
40
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { spacers } from '@dhis2/ui-constants'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { CalendarTableCell } from './calendar-table-cell.js'
|
|
5
|
+
import { CalendarTableDaysHeader } from './calendar-table-days-header.js'
|
|
6
|
+
|
|
7
|
+
export const CalendarTable = ({
|
|
8
|
+
weekDayLabels,
|
|
9
|
+
calendarWeekDays,
|
|
10
|
+
width,
|
|
11
|
+
cellSize,
|
|
12
|
+
selectedDate,
|
|
13
|
+
}) => (
|
|
14
|
+
<div className="calendar-table-wrapper">
|
|
15
|
+
<table className="calendar-table">
|
|
16
|
+
<CalendarTableDaysHeader weekDayLabels={weekDayLabels} />
|
|
17
|
+
<tbody>
|
|
18
|
+
{calendarWeekDays.map((week, weekIndex) => (
|
|
19
|
+
<tr key={`week-${weekIndex + 1}`}>
|
|
20
|
+
{week.map((day) => (
|
|
21
|
+
<CalendarTableCell
|
|
22
|
+
selectedDate={selectedDate}
|
|
23
|
+
day={day}
|
|
24
|
+
key={day?.dateValue}
|
|
25
|
+
cellSize={cellSize}
|
|
26
|
+
width={width}
|
|
27
|
+
/>
|
|
28
|
+
))}
|
|
29
|
+
</tr>
|
|
30
|
+
))}
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
33
|
+
<style jsx>{`
|
|
34
|
+
.calendar-table {
|
|
35
|
+
border: none;
|
|
36
|
+
border-collapse: collapse;
|
|
37
|
+
width: 100%;
|
|
38
|
+
margin-block: 0 ${spacers.dp4};
|
|
39
|
+
}
|
|
40
|
+
.calendar-table tr,
|
|
41
|
+
.calendar-table td {
|
|
42
|
+
border: none;
|
|
43
|
+
}
|
|
44
|
+
.calendar-table-wrapper {
|
|
45
|
+
padding-inline: ${spacers.dp4};
|
|
46
|
+
}
|
|
47
|
+
`}</style>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
export const CalendarTableProps = {
|
|
52
|
+
calendarWeekDays: PropTypes.arrayOf(
|
|
53
|
+
PropTypes.arrayOf(
|
|
54
|
+
PropTypes.shape({
|
|
55
|
+
calendarDate: PropTypes.string,
|
|
56
|
+
isInCurrentMonth: PropTypes.bool,
|
|
57
|
+
isSelected: PropTypes.bool,
|
|
58
|
+
isToday: PropTypes.bool,
|
|
59
|
+
label: PropTypes.oneOfType([
|
|
60
|
+
PropTypes.string,
|
|
61
|
+
PropTypes.number,
|
|
62
|
+
]),
|
|
63
|
+
zdt: PropTypes.object,
|
|
64
|
+
onClick: PropTypes.func,
|
|
65
|
+
}).isRequired
|
|
66
|
+
).isRequired
|
|
67
|
+
).isRequired,
|
|
68
|
+
cellSize: PropTypes.string,
|
|
69
|
+
selectedDate: PropTypes.string,
|
|
70
|
+
weekDayLabels: PropTypes.arrayOf(PropTypes.string),
|
|
71
|
+
width: PropTypes.string,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
CalendarTable.propTypes = CalendarTableProps
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDatePicker,
|
|
3
|
+
useResolvedDirection,
|
|
4
|
+
} from '@dhis2/multi-calendar-dates'
|
|
5
|
+
import PropTypes from 'prop-types'
|
|
6
|
+
import React, { useMemo, useState } from 'react'
|
|
7
|
+
import { CalendarContainer } from './calendar-container.js'
|
|
8
|
+
|
|
9
|
+
export const Calendar = ({
|
|
10
|
+
onDateSelect,
|
|
11
|
+
calendar,
|
|
12
|
+
date,
|
|
13
|
+
dir,
|
|
14
|
+
locale,
|
|
15
|
+
numberingSystem,
|
|
16
|
+
weekDayFormat = 'narrow',
|
|
17
|
+
timeZone,
|
|
18
|
+
width = '240px',
|
|
19
|
+
cellSize = '32px',
|
|
20
|
+
pastOnly,
|
|
21
|
+
}) => {
|
|
22
|
+
const [selectedDateString, setSelectedDateString] = useState(date)
|
|
23
|
+
const languageDirection = useResolvedDirection(dir, locale)
|
|
24
|
+
|
|
25
|
+
const options = {
|
|
26
|
+
locale,
|
|
27
|
+
calendar,
|
|
28
|
+
timeZone,
|
|
29
|
+
numberingSystem,
|
|
30
|
+
weekDayFormat,
|
|
31
|
+
pastOnly,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const pickerResults = useDatePicker({
|
|
35
|
+
onDateSelect: (result) => {
|
|
36
|
+
const { calendarDateString } = result
|
|
37
|
+
setSelectedDateString(calendarDateString)
|
|
38
|
+
onDateSelect(result)
|
|
39
|
+
},
|
|
40
|
+
date: selectedDateString,
|
|
41
|
+
options,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const calendarProps = useMemo(() => {
|
|
45
|
+
return {
|
|
46
|
+
date,
|
|
47
|
+
dir,
|
|
48
|
+
locale,
|
|
49
|
+
width,
|
|
50
|
+
cellSize,
|
|
51
|
+
// minDate,
|
|
52
|
+
// maxDate,
|
|
53
|
+
// validation, // todo: clarify how we use validation props (and format) in Calendar (not CalendarInput)
|
|
54
|
+
// format,
|
|
55
|
+
isValid: pickerResults.isValid,
|
|
56
|
+
calendarWeekDays: pickerResults.calendarWeekDays,
|
|
57
|
+
weekDayLabels: pickerResults.weekDayLabels,
|
|
58
|
+
currMonth: pickerResults.currMonth,
|
|
59
|
+
currYear: pickerResults.currYear,
|
|
60
|
+
nextMonth: pickerResults.nextMonth,
|
|
61
|
+
nextYear: pickerResults.nextYear,
|
|
62
|
+
prevMonth: pickerResults.prevMonth,
|
|
63
|
+
prevYear: pickerResults.prevYear,
|
|
64
|
+
navigateToYear: pickerResults.navigateToYear,
|
|
65
|
+
navigateToMonth: pickerResults.navigateToMonth,
|
|
66
|
+
months: pickerResults.months,
|
|
67
|
+
years: pickerResults.years,
|
|
68
|
+
languageDirection,
|
|
69
|
+
}
|
|
70
|
+
}, [cellSize, date, dir, locale, pickerResults, width, languageDirection])
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<CalendarContainer {...calendarProps} />
|
|
75
|
+
</div>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const CalendarProps = {
|
|
80
|
+
/** 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 */
|
|
81
|
+
calendar: PropTypes.any.isRequired,
|
|
82
|
+
/** 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` */
|
|
83
|
+
onDateSelect: PropTypes.func.isRequired,
|
|
84
|
+
/** the size of a single cell in the table forming the calendar */
|
|
85
|
+
cellSize: PropTypes.string,
|
|
86
|
+
/** the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601) */
|
|
87
|
+
date: PropTypes.string,
|
|
88
|
+
/** the direction of the library - internally the library will use rtl for rtl-languages but this can be overridden here for more control */
|
|
89
|
+
dir: PropTypes.oneOf(['ltr', 'rtl']),
|
|
90
|
+
/** 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) */
|
|
91
|
+
locale: PropTypes.string,
|
|
92
|
+
/** numbering system to use - full list here https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/numberingSystems.ts */
|
|
93
|
+
numberingSystem: PropTypes.string,
|
|
94
|
+
/** When true, only shows years in the past (current year and earlier) */
|
|
95
|
+
pastOnly: PropTypes.bool,
|
|
96
|
+
/** the timeZone to use */
|
|
97
|
+
timeZone: PropTypes.string,
|
|
98
|
+
/** the format to display for the week day, i.e. Monday (long), Mon (short), M (narrow) */
|
|
99
|
+
weekDayFormat: PropTypes.oneOf(['narrow', 'short', 'long']),
|
|
100
|
+
/** the width of the calendar component */
|
|
101
|
+
width: PropTypes.string,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
Calendar.propTypes = CalendarProps
|