@dhis2-ui/calendar 8.14.9 → 8.15.0-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +12 -10
  2. 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": "8.14.9",
3
+ "version": "8.15.0-alpha.2",
4
4
  "description": "UI Calendar",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,25 +32,27 @@
32
32
  "styled-jsx": "^4"
33
33
  },
34
34
  "dependencies": {
35
- "@dhis2-ui/button": "8.14.9",
36
- "@dhis2-ui/card": "8.14.9",
37
- "@dhis2-ui/input": "8.14.9",
38
- "@dhis2-ui/layer": "8.14.9",
39
- "@dhis2-ui/popper": "8.14.9",
35
+ "@dhis2-ui/button": "8.15.0-alpha.2",
36
+ "@dhis2-ui/card": "8.15.0-alpha.2",
37
+ "@dhis2-ui/input": "8.15.0-alpha.2",
38
+ "@dhis2-ui/layer": "8.15.0-alpha.2",
39
+ "@dhis2-ui/popper": "8.15.0-alpha.2",
40
40
  "@dhis2/multi-calendar-dates": "1.0.2",
41
41
  "@dhis2/prop-types": "^3.1.2",
42
- "@dhis2/ui-constants": "8.14.9",
43
- "@dhis2/ui-icons": "8.14.9",
42
+ "@dhis2/ui-constants": "8.15.0-alpha.2",
43
+ "@dhis2/ui-icons": "8.15.0-alpha.2",
44
44
  "classnames": "^2.3.1",
45
45
  "prop-types": "^15.7.2"
46
46
  },
47
47
  "files": [
48
- "build"
48
+ "build",
49
+ "types"
49
50
  ],
50
51
  "devDependencies": {
51
52
  "@dhis2/d2-i18n": "^1.1.0",
52
53
  "react": "16.13",
53
54
  "react-dom": "16.13",
54
55
  "styled-jsx": "^4.0.1"
55
- }
56
+ },
57
+ "types": "types"
56
58
  }
@@ -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>