@dhis2-ui/calendar 8.16.0 → 9.0.0-alpha.2
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 +13 -10
- package/types/index.d.ts +61 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/calendar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-alpha.2",
|
|
4
4
|
"description": "UI Calendar",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"main": "./build/cjs/index.js",
|
|
14
14
|
"module": "./build/es/index.js",
|
|
15
15
|
"exports": {
|
|
16
|
+
"types": "./types/index.d.ts",
|
|
16
17
|
"import": "./build/es/index.js",
|
|
17
18
|
"require": "./build/cjs/index.js"
|
|
18
19
|
},
|
|
@@ -32,25 +33,27 @@
|
|
|
32
33
|
"styled-jsx": "^4"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@dhis2-ui/button": "
|
|
36
|
-
"@dhis2-ui/card": "
|
|
37
|
-
"@dhis2-ui/input": "
|
|
38
|
-
"@dhis2-ui/layer": "
|
|
39
|
-
"@dhis2-ui/popper": "
|
|
36
|
+
"@dhis2-ui/button": "9.0.0-alpha.2",
|
|
37
|
+
"@dhis2-ui/card": "9.0.0-alpha.2",
|
|
38
|
+
"@dhis2-ui/input": "9.0.0-alpha.2",
|
|
39
|
+
"@dhis2-ui/layer": "9.0.0-alpha.2",
|
|
40
|
+
"@dhis2-ui/popper": "9.0.0-alpha.2",
|
|
40
41
|
"@dhis2/multi-calendar-dates": "1.0.2",
|
|
41
42
|
"@dhis2/prop-types": "^3.1.2",
|
|
42
|
-
"@dhis2/ui-constants": "
|
|
43
|
-
"@dhis2/ui-icons": "
|
|
43
|
+
"@dhis2/ui-constants": "9.0.0-alpha.2",
|
|
44
|
+
"@dhis2/ui-icons": "9.0.0-alpha.2",
|
|
44
45
|
"classnames": "^2.3.1",
|
|
45
46
|
"prop-types": "^15.7.2"
|
|
46
47
|
},
|
|
47
48
|
"files": [
|
|
48
|
-
"build"
|
|
49
|
+
"build",
|
|
50
|
+
"types"
|
|
49
51
|
],
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@dhis2/d2-i18n": "^1.1.0",
|
|
52
54
|
"react": "16.13",
|
|
53
55
|
"react-dom": "16.13",
|
|
54
56
|
"styled-jsx": "^4.0.1"
|
|
55
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"types": "types"
|
|
56
59
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { useDatePicker } from '@dhis2/multi-calendar-dates'
|
|
3
|
+
import { InputFieldProps } from '@dhis2-ui/input'
|
|
4
|
+
|
|
5
|
+
export type CalendarDir = 'ltr' | 'rtl'
|
|
6
|
+
|
|
7
|
+
type CalendarPickerParam = Parameters<typeof useDatePicker>[0]
|
|
8
|
+
type CalendarPickerOptions = CalendarPickerParam['options']
|
|
9
|
+
|
|
10
|
+
export interface CalendarProps {
|
|
11
|
+
/**
|
|
12
|
+
* 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
|
|
13
|
+
*/
|
|
14
|
+
calendar: CalendarPickerOptions['calendar']
|
|
15
|
+
/**
|
|
16
|
+
* 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`
|
|
17
|
+
*/
|
|
18
|
+
onDateSelect: CalendarPickerParam['onDateSelect']
|
|
19
|
+
/**
|
|
20
|
+
* the size of a single cell in the table forming the calendar
|
|
21
|
+
*/
|
|
22
|
+
cellSize?: string
|
|
23
|
+
/**
|
|
24
|
+
* the currently selected date using an iso-like format YYYY-MM-DD, in the calendar system provided (not iso8601)
|
|
25
|
+
*/
|
|
26
|
+
date?: string
|
|
27
|
+
/**
|
|
28
|
+
* the direction of the library - internally the library will use rtl for rtl-languages but this can be overridden here for more control
|
|
29
|
+
*/
|
|
30
|
+
dir?: CalendarDir
|
|
31
|
+
/**
|
|
32
|
+
* 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)
|
|
33
|
+
*/
|
|
34
|
+
locale?: string
|
|
35
|
+
/**
|
|
36
|
+
* numbering system to use - full list here https://github.com/dhis2/multi-calendar-dates/blob/main/src/constants/numberingSystems.ts
|
|
37
|
+
*/
|
|
38
|
+
numberingSystem?: CalendarPickerOptions['numberingSystem']
|
|
39
|
+
/**
|
|
40
|
+
* the timeZone to use
|
|
41
|
+
*/
|
|
42
|
+
timeZone?: CalendarPickerOptions['timeZone']
|
|
43
|
+
/**
|
|
44
|
+
* the format to display for the week day, i.e. Monday (long), Mon (short), M (narrow)
|
|
45
|
+
*/
|
|
46
|
+
weekDayFormat?: CalendarPickerOptions['weekDayFormat']
|
|
47
|
+
/**
|
|
48
|
+
* the width of the calendar component
|
|
49
|
+
*/
|
|
50
|
+
width?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const Calendar: React.FC<CalendarProps>
|
|
54
|
+
|
|
55
|
+
export type CalendarInputProps = Omit<
|
|
56
|
+
InputFieldProps,
|
|
57
|
+
'label' | 'type' | 'value'
|
|
58
|
+
> &
|
|
59
|
+
CalendarProps
|
|
60
|
+
|
|
61
|
+
export const CalendarInput: React.FC<CalendarInputProps>
|