@atlaskit/calendar 12.4.0 → 12.4.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/CHANGELOG.md +12 -0
- package/dist/cjs/calendar.js +7 -4
- package/dist/cjs/internal/components/heading.js +6 -3
- package/dist/cjs/internal/components/week-header.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/calendar.js +7 -4
- package/dist/es2019/internal/components/heading.js +6 -3
- package/dist/es2019/internal/components/week-header.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/calendar.js +7 -4
- package/dist/esm/internal/components/heading.js +6 -3
- package/dist/esm/internal/components/week-header.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types-ts4.0/calendar.d.ts +13 -0
- package/dist/types-ts4.0/entry-points/types.d.ts +1 -0
- package/dist/types-ts4.0/index.d.ts +2 -0
- package/dist/types-ts4.0/internal/components/date.d.ts +19 -0
- package/dist/types-ts4.0/internal/components/heading.d.ts +14 -0
- package/dist/types-ts4.0/internal/components/week-days.d.ts +11 -0
- package/dist/types-ts4.0/internal/components/week-header.d.ts +8 -0
- package/dist/types-ts4.0/internal/constants.d.ts +5 -0
- package/dist/types-ts4.0/internal/hooks/use-calendar-ref.d.ts +5 -0
- package/dist/types-ts4.0/internal/hooks/use-controlled-date-state.d.ts +37 -0
- package/dist/types-ts4.0/internal/hooks/use-focusing.d.ts +8 -0
- package/dist/types-ts4.0/internal/hooks/use-get-weeks.d.ts +15 -0
- package/dist/types-ts4.0/internal/hooks/use-handle-date-change.d.ts +21 -0
- package/dist/types-ts4.0/internal/hooks/use-handle-date-select.d.ts +30 -0
- package/dist/types-ts4.0/internal/hooks/use-locale.d.ts +8 -0
- package/dist/types-ts4.0/internal/hooks/use-unique-id.d.ts +1 -0
- package/dist/types-ts4.0/internal/styles/date.d.ts +3 -0
- package/dist/types-ts4.0/internal/types.d.ts +26 -0
- package/dist/types-ts4.0/internal/utils/date-to-string.d.ts +6 -0
- package/dist/types-ts4.0/internal/utils/get-base-calendar.d.ts +10 -0
- package/dist/types-ts4.0/internal/utils/get-days-in-month.d.ts +1 -0
- package/dist/types-ts4.0/internal/utils/pad.d.ts +1 -0
- package/dist/types-ts4.0/types.d.ts +159 -0
- package/package.json +15 -5
- package/report.api.md +97 -35
- package/types/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/calendar
|
|
2
2
|
|
|
3
|
+
## 12.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bc989043572`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc989043572) - Internal changes to apply spacing tokens. This should be a no-op change.
|
|
8
|
+
|
|
9
|
+
## 12.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
14
|
+
|
|
3
15
|
## 12.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/calendar.js
CHANGED
|
@@ -58,7 +58,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
58
58
|
var lightWrapperStyles = (0, _react2.css)({
|
|
59
59
|
display: 'inline-block',
|
|
60
60
|
boxSizing: 'border-box',
|
|
61
|
-
|
|
61
|
+
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
62
|
+
padding: "var(--ds-scale-200, 16px)",
|
|
62
63
|
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.N0, ")"),
|
|
63
64
|
color: "var(--ds-text, ".concat(_colors.N900, ")"),
|
|
64
65
|
outline: 'none',
|
|
@@ -67,7 +68,8 @@ var lightWrapperStyles = (0, _react2.css)({
|
|
|
67
68
|
var darkWrapperStyles = (0, _react2.css)({
|
|
68
69
|
display: 'inline-block',
|
|
69
70
|
boxSizing: 'border-box',
|
|
70
|
-
|
|
71
|
+
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
72
|
+
padding: "var(--ds-scale-200, 16px)",
|
|
71
73
|
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.N700, ")"),
|
|
72
74
|
color: "var(--ds-text, ".concat(_colors.DN600, ")"),
|
|
73
75
|
outline: 'none',
|
|
@@ -76,14 +78,15 @@ var darkWrapperStyles = (0, _react2.css)({
|
|
|
76
78
|
var gridsContainerStyles = (0, _react2.css)({
|
|
77
79
|
display: 'inline-block',
|
|
78
80
|
width: 289,
|
|
79
|
-
|
|
81
|
+
// TODO Delete this comment after verifying spacing token -> previous value `0`
|
|
82
|
+
margin: "var(--ds-scale-0, 0px)",
|
|
80
83
|
marginBottom: 5,
|
|
81
84
|
textAlign: 'center'
|
|
82
85
|
});
|
|
83
86
|
var analyticsAttributes = {
|
|
84
87
|
componentName: 'calendar',
|
|
85
88
|
packageName: "@atlaskit/calendar",
|
|
86
|
-
packageVersion: "12.4.
|
|
89
|
+
packageVersion: "12.4.2"
|
|
87
90
|
};
|
|
88
91
|
var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
|
|
89
92
|
var day = _ref.day,
|
|
@@ -26,7 +26,8 @@ var headingColor = {
|
|
|
26
26
|
};
|
|
27
27
|
var headingStyles = (0, _react2.css)({
|
|
28
28
|
display: 'flex',
|
|
29
|
-
|
|
29
|
+
// TODO Delete this comment after verifying spacing tokens
|
|
30
|
+
padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-0, 0px)", " 13px ", "var(--ds-scale-0, 0px)"),
|
|
30
31
|
color: "var(--ds-text, ".concat(_colors.N800, ")"),
|
|
31
32
|
fontWeight: 'bold'
|
|
32
33
|
});
|
|
@@ -41,10 +42,12 @@ var getMonthAndYearStyles = function getMonthAndYearStyles() {
|
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
var arrowLeftStyles = (0, _react2.css)({
|
|
44
|
-
|
|
45
|
+
// TODO Delete this comment after verifying spacing token -> previous value `8`
|
|
46
|
+
marginLeft: "var(--ds-scale-100, 8px)"
|
|
45
47
|
});
|
|
46
48
|
var arrowRightStyles = (0, _react2.css)({
|
|
47
|
-
|
|
49
|
+
// TODO Delete this comment after verifying spacing token -> previous value `8`
|
|
50
|
+
marginRight: "var(--ds-scale-100, 8px)"
|
|
48
51
|
});
|
|
49
52
|
var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
50
53
|
var monthLongTitle = _ref.monthLongTitle,
|
|
@@ -20,7 +20,7 @@ var dayNameGridStyles = (0, _react2.css)({
|
|
|
20
20
|
var dayNameCellStyles = (0, _react2.css)({
|
|
21
21
|
boxSizing: 'border-box',
|
|
22
22
|
minWidth: 40,
|
|
23
|
-
padding:
|
|
23
|
+
padding: "var(--ds-scale-100, 8px)".concat(" ", "var(--ds-scale-100, 8px)"),
|
|
24
24
|
border: 0,
|
|
25
25
|
color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
|
|
26
26
|
fontSize: 11,
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/calendar.js
CHANGED
|
@@ -23,7 +23,8 @@ import useUniqueId from './internal/hooks/use-unique-id';
|
|
|
23
23
|
const lightWrapperStyles = css({
|
|
24
24
|
display: 'inline-block',
|
|
25
25
|
boxSizing: 'border-box',
|
|
26
|
-
|
|
26
|
+
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
27
|
+
padding: "var(--ds-scale-200, 16px)",
|
|
27
28
|
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${N0})`,
|
|
28
29
|
color: `var(--ds-text, ${N900})`,
|
|
29
30
|
outline: 'none',
|
|
@@ -32,7 +33,8 @@ const lightWrapperStyles = css({
|
|
|
32
33
|
const darkWrapperStyles = css({
|
|
33
34
|
display: 'inline-block',
|
|
34
35
|
boxSizing: 'border-box',
|
|
35
|
-
|
|
36
|
+
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
37
|
+
padding: "var(--ds-scale-200, 16px)",
|
|
36
38
|
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${N700})`,
|
|
37
39
|
color: `var(--ds-text, ${DN600})`,
|
|
38
40
|
outline: 'none',
|
|
@@ -41,14 +43,15 @@ const darkWrapperStyles = css({
|
|
|
41
43
|
const gridsContainerStyles = css({
|
|
42
44
|
display: 'inline-block',
|
|
43
45
|
width: 289,
|
|
44
|
-
|
|
46
|
+
// TODO Delete this comment after verifying spacing token -> previous value `0`
|
|
47
|
+
margin: "var(--ds-scale-0, 0px)",
|
|
45
48
|
marginBottom: 5,
|
|
46
49
|
textAlign: 'center'
|
|
47
50
|
});
|
|
48
51
|
const analyticsAttributes = {
|
|
49
52
|
componentName: 'calendar',
|
|
50
53
|
packageName: "@atlaskit/calendar",
|
|
51
|
-
packageVersion: "12.4.
|
|
54
|
+
packageVersion: "12.4.2"
|
|
52
55
|
};
|
|
53
56
|
const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
54
57
|
day,
|
|
@@ -11,7 +11,8 @@ const headingColor = {
|
|
|
11
11
|
};
|
|
12
12
|
const headingStyles = css({
|
|
13
13
|
display: 'flex',
|
|
14
|
-
|
|
14
|
+
// TODO Delete this comment after verifying spacing tokens
|
|
15
|
+
padding: `${"var(--ds-scale-0, 0px)"} ${"var(--ds-scale-0, 0px)"} 13px ${"var(--ds-scale-0, 0px)"}`,
|
|
15
16
|
color: `var(--ds-text, ${N800})`,
|
|
16
17
|
fontWeight: 'bold'
|
|
17
18
|
});
|
|
@@ -23,10 +24,12 @@ const getMonthAndYearStyles = (mode = 'light') => css({
|
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
const arrowLeftStyles = css({
|
|
26
|
-
|
|
27
|
+
// TODO Delete this comment after verifying spacing token -> previous value `8`
|
|
28
|
+
marginLeft: "var(--ds-scale-100, 8px)"
|
|
27
29
|
});
|
|
28
30
|
const arrowRightStyles = css({
|
|
29
|
-
|
|
31
|
+
// TODO Delete this comment after verifying spacing token -> previous value `8`
|
|
32
|
+
marginRight: "var(--ds-scale-100, 8px)"
|
|
30
33
|
});
|
|
31
34
|
const Heading = /*#__PURE__*/memo(function Heading({
|
|
32
35
|
monthLongTitle,
|
|
@@ -10,7 +10,7 @@ const dayNameGridStyles = css({
|
|
|
10
10
|
const dayNameCellStyles = css({
|
|
11
11
|
boxSizing: 'border-box',
|
|
12
12
|
minWidth: 40,
|
|
13
|
-
padding:
|
|
13
|
+
padding: `${"var(--ds-scale-100, 8px)"} ${"var(--ds-scale-100, 8px)"}`,
|
|
14
14
|
border: 0,
|
|
15
15
|
color: `var(--ds-text-subtle, ${N200})`,
|
|
16
16
|
fontSize: 11,
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/calendar.js
CHANGED
|
@@ -29,7 +29,8 @@ import useUniqueId from './internal/hooks/use-unique-id';
|
|
|
29
29
|
var lightWrapperStyles = css({
|
|
30
30
|
display: 'inline-block',
|
|
31
31
|
boxSizing: 'border-box',
|
|
32
|
-
|
|
32
|
+
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
33
|
+
padding: "var(--ds-scale-200, 16px)",
|
|
33
34
|
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(N0, ")"),
|
|
34
35
|
color: "var(--ds-text, ".concat(N900, ")"),
|
|
35
36
|
outline: 'none',
|
|
@@ -38,7 +39,8 @@ var lightWrapperStyles = css({
|
|
|
38
39
|
var darkWrapperStyles = css({
|
|
39
40
|
display: 'inline-block',
|
|
40
41
|
boxSizing: 'border-box',
|
|
41
|
-
|
|
42
|
+
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
43
|
+
padding: "var(--ds-scale-200, 16px)",
|
|
42
44
|
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(N700, ")"),
|
|
43
45
|
color: "var(--ds-text, ".concat(DN600, ")"),
|
|
44
46
|
outline: 'none',
|
|
@@ -47,14 +49,15 @@ var darkWrapperStyles = css({
|
|
|
47
49
|
var gridsContainerStyles = css({
|
|
48
50
|
display: 'inline-block',
|
|
49
51
|
width: 289,
|
|
50
|
-
|
|
52
|
+
// TODO Delete this comment after verifying spacing token -> previous value `0`
|
|
53
|
+
margin: "var(--ds-scale-0, 0px)",
|
|
51
54
|
marginBottom: 5,
|
|
52
55
|
textAlign: 'center'
|
|
53
56
|
});
|
|
54
57
|
var analyticsAttributes = {
|
|
55
58
|
componentName: 'calendar',
|
|
56
59
|
packageName: "@atlaskit/calendar",
|
|
57
|
-
packageVersion: "12.4.
|
|
60
|
+
packageVersion: "12.4.2"
|
|
58
61
|
};
|
|
59
62
|
var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
60
63
|
var day = _ref.day,
|
|
@@ -11,7 +11,8 @@ var headingColor = {
|
|
|
11
11
|
};
|
|
12
12
|
var headingStyles = css({
|
|
13
13
|
display: 'flex',
|
|
14
|
-
|
|
14
|
+
// TODO Delete this comment after verifying spacing tokens
|
|
15
|
+
padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-0, 0px)", " 13px ", "var(--ds-scale-0, 0px)"),
|
|
15
16
|
color: "var(--ds-text, ".concat(N800, ")"),
|
|
16
17
|
fontWeight: 'bold'
|
|
17
18
|
});
|
|
@@ -26,10 +27,12 @@ var getMonthAndYearStyles = function getMonthAndYearStyles() {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
var arrowLeftStyles = css({
|
|
29
|
-
|
|
30
|
+
// TODO Delete this comment after verifying spacing token -> previous value `8`
|
|
31
|
+
marginLeft: "var(--ds-scale-100, 8px)"
|
|
30
32
|
});
|
|
31
33
|
var arrowRightStyles = css({
|
|
32
|
-
|
|
34
|
+
// TODO Delete this comment after verifying spacing token -> previous value `8`
|
|
35
|
+
marginRight: "var(--ds-scale-100, 8px)"
|
|
33
36
|
});
|
|
34
37
|
var Heading = /*#__PURE__*/memo(function Heading(_ref) {
|
|
35
38
|
var monthLongTitle = _ref.monthLongTitle,
|
|
@@ -10,7 +10,7 @@ var dayNameGridStyles = css({
|
|
|
10
10
|
var dayNameCellStyles = css({
|
|
11
11
|
boxSizing: 'border-box',
|
|
12
12
|
minWidth: 40,
|
|
13
|
-
padding:
|
|
13
|
+
padding: "var(--ds-scale-100, 8px)".concat(" ", "var(--ds-scale-100, 8px)"),
|
|
14
14
|
border: 0,
|
|
15
15
|
color: "var(--ds-text-subtle, ".concat(N200, ")"),
|
|
16
16
|
fontSize: 11,
|
package/dist/esm/version.json
CHANGED
package/dist/types/calendar.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ import type { CalendarProps } from './types';
|
|
|
9
9
|
* - [Code](https://atlassian.design/components/calendar/code)
|
|
10
10
|
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
11
11
|
*/
|
|
12
|
-
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "
|
|
12
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "style" | "className" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | "onSelect" | "disabled" | "selected" | "analyticsContext" | "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "previouslySelected" | "today" | "locale" | "weekStartDay" | "calendarRef" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
13
13
|
export default Calendar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CalendarProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Calendar__
|
|
5
|
+
*
|
|
6
|
+
* A calendar is used for date selection.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/calendar/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/calendar/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
11
|
+
*/
|
|
12
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "style" | "className" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | "onSelect" | "disabled" | "selected" | "analyticsContext" | "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "previouslySelected" | "today" | "locale" | "weekStartDay" | "calendarRef" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
13
|
+
export default Calendar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { CalendarProps, ChangeEvent, SelectEvent, CalendarRef, WeekDay, } from '../types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
+
import type { DateObj } from '../types';
|
|
4
|
+
interface DateProps {
|
|
5
|
+
children: number;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
isFocused?: boolean;
|
|
8
|
+
isToday?: boolean;
|
|
9
|
+
month: number;
|
|
10
|
+
onClick?: ({ day, month, year }: DateObj) => void;
|
|
11
|
+
isPreviouslySelected?: boolean;
|
|
12
|
+
isSelected?: boolean;
|
|
13
|
+
isSibling?: boolean;
|
|
14
|
+
year: number;
|
|
15
|
+
mode?: ThemeModes;
|
|
16
|
+
testId?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const Date: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<DateProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
19
|
+
export default Date;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
+
interface HeadingProps {
|
|
4
|
+
monthLongTitle: string;
|
|
5
|
+
year: number;
|
|
6
|
+
previousMonthLabel?: string;
|
|
7
|
+
nextMonthLabel?: string;
|
|
8
|
+
handleClickNext?: () => void;
|
|
9
|
+
handleClickPrev?: () => void;
|
|
10
|
+
mode?: ThemeModes;
|
|
11
|
+
testId?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Heading: import("react").NamedExoticComponent<HeadingProps>;
|
|
14
|
+
export default Heading;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
+
import { DateObj, Week } from '../types';
|
|
4
|
+
interface WeekDaysProps {
|
|
5
|
+
weeks: Week[];
|
|
6
|
+
handleClickDay: (date: DateObj) => void;
|
|
7
|
+
mode?: ThemeModes;
|
|
8
|
+
testId?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const WeekDays: import("react").NamedExoticComponent<WeekDaysProps>;
|
|
11
|
+
export default WeekDays;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
+
interface WeekHeaderProps {
|
|
4
|
+
daysShort: string[];
|
|
5
|
+
mode?: ThemeModes;
|
|
6
|
+
}
|
|
7
|
+
declare const WeekHeader: import("react").NamedExoticComponent<WeekHeaderProps>;
|
|
8
|
+
export default WeekHeader;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default function useControlledDateState({ day, defaultDay, month, defaultMonth, year, defaultYear, today, selected, defaultSelected, previouslySelected, defaultPreviouslySelected, }: {
|
|
2
|
+
day?: number;
|
|
3
|
+
defaultDay: number;
|
|
4
|
+
month?: number;
|
|
5
|
+
defaultMonth: number;
|
|
6
|
+
year?: number;
|
|
7
|
+
defaultYear: number;
|
|
8
|
+
today?: string;
|
|
9
|
+
selected?: Array<string>;
|
|
10
|
+
defaultSelected: Array<string>;
|
|
11
|
+
previouslySelected?: Array<string>;
|
|
12
|
+
defaultPreviouslySelected: Array<string>;
|
|
13
|
+
}): {
|
|
14
|
+
readonly day: readonly [
|
|
15
|
+
number,
|
|
16
|
+
(newValue: number) => void
|
|
17
|
+
];
|
|
18
|
+
readonly month: readonly [
|
|
19
|
+
number,
|
|
20
|
+
(newValue: number) => void
|
|
21
|
+
];
|
|
22
|
+
readonly year: readonly [
|
|
23
|
+
number,
|
|
24
|
+
(newValue: number) => void
|
|
25
|
+
];
|
|
26
|
+
readonly today: readonly [
|
|
27
|
+
string
|
|
28
|
+
];
|
|
29
|
+
readonly selected: readonly [
|
|
30
|
+
string[],
|
|
31
|
+
(newValue: string[]) => void
|
|
32
|
+
];
|
|
33
|
+
readonly previous: readonly [
|
|
34
|
+
string[],
|
|
35
|
+
(newValue: string[]) => void
|
|
36
|
+
];
|
|
37
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function useFocusing({ onBlur, onFocus, }: {
|
|
3
|
+
onBlur: React.FocusEventHandler;
|
|
4
|
+
onFocus: React.FocusEventHandler;
|
|
5
|
+
}): {
|
|
6
|
+
handleContainerBlur: (event: React.FocusEvent) => void;
|
|
7
|
+
handleContainerFocus: (event: React.FocusEvent) => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WeekDay } from '../../types';
|
|
2
|
+
import type { Week } from '../types';
|
|
3
|
+
export default function useGetWeeks({ day, month, year, today, disabled, disabledDateFilter, minDate: minDateString, maxDate: maxDateString, selected, previouslySelected, weekStartDay, }: {
|
|
4
|
+
day: number;
|
|
5
|
+
month: number;
|
|
6
|
+
year: number;
|
|
7
|
+
today: string;
|
|
8
|
+
disabled?: string[];
|
|
9
|
+
disabledDateFilter?: (date: string) => boolean;
|
|
10
|
+
minDate?: string;
|
|
11
|
+
maxDate?: string;
|
|
12
|
+
selected: string[];
|
|
13
|
+
previouslySelected: string[];
|
|
14
|
+
weekStartDay: WeekDay;
|
|
15
|
+
}): Week[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChangeEvent } from '../../types';
|
|
2
|
+
import type { ArrowKeys } from '../types';
|
|
3
|
+
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], onChange, }: {
|
|
4
|
+
day: readonly [
|
|
5
|
+
number,
|
|
6
|
+
(newValue: number) => void
|
|
7
|
+
];
|
|
8
|
+
month: readonly [
|
|
9
|
+
number,
|
|
10
|
+
(newValue: number) => void
|
|
11
|
+
];
|
|
12
|
+
year: readonly [
|
|
13
|
+
number,
|
|
14
|
+
(newValue: number) => void
|
|
15
|
+
];
|
|
16
|
+
onChange: (event: ChangeEvent) => void;
|
|
17
|
+
}): {
|
|
18
|
+
navigate: (type: ArrowKeys) => void;
|
|
19
|
+
handleClickNext: () => void;
|
|
20
|
+
handleClickPrev: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectEvent } from '../../types';
|
|
3
|
+
import type { ArrowKeys, DateObj } from '../types';
|
|
4
|
+
export default function useHandleDateSelect({ day: [dayValue], month: [monthValue], year: [yearValue], selected: [selectedValue, setSelectedValue], previous: [, setPreviouslySelectedValue], onSelect, navigate, }: {
|
|
5
|
+
day: readonly [
|
|
6
|
+
number,
|
|
7
|
+
(newValue: number) => void
|
|
8
|
+
];
|
|
9
|
+
month: readonly [
|
|
10
|
+
number,
|
|
11
|
+
(newValue: number) => void
|
|
12
|
+
];
|
|
13
|
+
year: readonly [
|
|
14
|
+
number,
|
|
15
|
+
(newValue: number) => void
|
|
16
|
+
];
|
|
17
|
+
selected: [
|
|
18
|
+
string[],
|
|
19
|
+
(newValue: string[]) => void
|
|
20
|
+
];
|
|
21
|
+
previous: [
|
|
22
|
+
unknown,
|
|
23
|
+
(newValue: string[]) => void
|
|
24
|
+
];
|
|
25
|
+
onSelect: (event: SelectEvent) => void;
|
|
26
|
+
navigate: (type: ArrowKeys) => void;
|
|
27
|
+
}): {
|
|
28
|
+
handleClickDay: ({ year, month, day }: DateObj) => void;
|
|
29
|
+
handleContainerKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useUniqueId(prefix: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { WeekDay } from '../types';
|
|
2
|
+
export declare type ArrowKeys = 'left' | 'up' | 'right' | 'down';
|
|
3
|
+
export declare type DateObj = {
|
|
4
|
+
day: number;
|
|
5
|
+
month: number;
|
|
6
|
+
year: number;
|
|
7
|
+
};
|
|
8
|
+
export interface WeekDayState {
|
|
9
|
+
isDisabled: boolean;
|
|
10
|
+
isFocused: boolean;
|
|
11
|
+
isToday: boolean;
|
|
12
|
+
isPreviouslySelected: boolean;
|
|
13
|
+
isSelected: boolean;
|
|
14
|
+
isSiblingMonth: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface Week {
|
|
17
|
+
id: string;
|
|
18
|
+
values: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
} & DateObj & WeekDayState>;
|
|
21
|
+
}
|
|
22
|
+
export interface CalendarDate extends DateObj {
|
|
23
|
+
weekDay?: WeekDay;
|
|
24
|
+
siblingMonth?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare type ISODate = string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logic taken from https://github.com/WesSouza/calendar-base which is not maintained for quite sometime.
|
|
3
|
+
* This will help us fixing any issue we might get or any new functionality we might want to support.
|
|
4
|
+
* Not changing much code below. Just removed those parts which we don't need.
|
|
5
|
+
*/
|
|
6
|
+
import type { WeekDay } from '../../types';
|
|
7
|
+
import type { CalendarDate } from '../types';
|
|
8
|
+
export default function getBaseCalendar(year: number, month: number, { weekStartDay, }?: {
|
|
9
|
+
weekStartDay?: WeekDay;
|
|
10
|
+
}): CalendarDate[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getDaysInMonth(year: number, month: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function pad(num: number): string;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
4
|
+
import type { ArrowKeys, DateObj, ISODate } from './internal/types';
|
|
5
|
+
export declare type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
export declare type ChangeEvent = {
|
|
7
|
+
iso: ISODate;
|
|
8
|
+
type: 'left' | 'up' | 'right' | 'down' | 'prev' | 'next';
|
|
9
|
+
} & DateObj;
|
|
10
|
+
export declare type SelectEvent = {
|
|
11
|
+
iso: ISODate;
|
|
12
|
+
} & DateObj;
|
|
13
|
+
export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
14
|
+
/**
|
|
15
|
+
* The number of the day currently focused. Places border around the date. 0 highlights no date.
|
|
16
|
+
*/
|
|
17
|
+
day?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Default for `day`.
|
|
20
|
+
*/
|
|
21
|
+
defaultDay?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Default for `month`.
|
|
24
|
+
*/
|
|
25
|
+
defaultMonth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Default for `previouslySelected`.
|
|
28
|
+
*/
|
|
29
|
+
defaultPreviouslySelected?: Array<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Default for `selected`.
|
|
32
|
+
*/
|
|
33
|
+
defaultSelected?: Array<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Default for `year`.
|
|
36
|
+
*/
|
|
37
|
+
defaultYear?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates provided are greyed out.
|
|
40
|
+
* This does not prevent these dates being selected.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: Array<string>;
|
|
43
|
+
/**
|
|
44
|
+
* A filter function that takes a date string in the format 'YYYY-MM-DD' and returns true if that date should be disabled.
|
|
45
|
+
*/
|
|
46
|
+
disabledDateFilter?: (date: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The latest enabled date
|
|
49
|
+
*/
|
|
50
|
+
maxDate?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The earliest enabled date
|
|
53
|
+
*/
|
|
54
|
+
minDate?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The number of the month (from 1 to 12) which the calendar should be on.
|
|
57
|
+
*/
|
|
58
|
+
month?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The aria-label attribute associated with the next-month arrow.
|
|
61
|
+
*/
|
|
62
|
+
nextMonthLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Function which is called when the calendar is no longer focused.
|
|
65
|
+
*/
|
|
66
|
+
onBlur?: React.FocusEventHandler;
|
|
67
|
+
/**
|
|
68
|
+
* Called when the calendar is navigated. This can be triggered by the keyboard, or by clicking the navigational buttons.
|
|
69
|
+
* The 'interface' property indicates the the direction the calendar was navigated whereas the 'iso' property is a string of the format YYYY-MM-DD.
|
|
70
|
+
*/
|
|
71
|
+
onChange?: (event: ChangeEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Called when the calendar receives focus. This could be from a mouse event on the container by tabbing into it.
|
|
74
|
+
*/
|
|
75
|
+
onFocus?: React.FocusEventHandler;
|
|
76
|
+
/**
|
|
77
|
+
* Function called when a day is clicked on. Calls with an object that has
|
|
78
|
+
* a day, month and year property as numbers, representing the date just clicked.
|
|
79
|
+
* It also has an 'iso' property, which is a string of the selected date in the
|
|
80
|
+
* format YYYY-MM-DD.
|
|
81
|
+
*/
|
|
82
|
+
onSelect?: (event: SelectEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
85
|
+
* provided are given a background color.
|
|
86
|
+
*/
|
|
87
|
+
previouslySelected?: Array<string>;
|
|
88
|
+
/**
|
|
89
|
+
* The aria-label attribute associated with the previous-month arrow.
|
|
90
|
+
*/
|
|
91
|
+
previousMonthLabel?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
94
|
+
* provided are given a background color.
|
|
95
|
+
*/
|
|
96
|
+
selected?: Array<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Value of current day, as a string in the format 'YYYY-MM-DD'.
|
|
99
|
+
*/
|
|
100
|
+
today?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Year to display the calendar for.
|
|
103
|
+
*/
|
|
104
|
+
year?: number;
|
|
105
|
+
/**
|
|
106
|
+
* BCP 47 language tag (e.g. ja-JP) that ensures dates are in the official format for the locale.
|
|
107
|
+
*/
|
|
108
|
+
locale?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Additional information to be included in the `context` of analytics events.
|
|
111
|
+
*/
|
|
112
|
+
analyticsContext?: Record<string, any>;
|
|
113
|
+
/**
|
|
114
|
+
* Start day of the week for the calendar.
|
|
115
|
+
* - `0` sunday (default value)
|
|
116
|
+
* - `1` monday
|
|
117
|
+
* - `2` tuesday
|
|
118
|
+
* - `3` wednesday
|
|
119
|
+
* - `4` thursday
|
|
120
|
+
* - `5` friday
|
|
121
|
+
* - `6` saturday
|
|
122
|
+
*/
|
|
123
|
+
weekStartDay?: WeekDay;
|
|
124
|
+
/**
|
|
125
|
+
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
126
|
+
*
|
|
127
|
+
* testId--container - Outermost container containing everything inside calendar
|
|
128
|
+
* testId--month - Container containing all available days for the month
|
|
129
|
+
* testId--previous-month - Button to show next month
|
|
130
|
+
* testId--next-month - Button to show previous month
|
|
131
|
+
* testId--current-month-year - Text containing the current month and year
|
|
132
|
+
* testId--selected-day - The currently selected day (may be missing if a date isn’t selected)
|
|
133
|
+
*/
|
|
134
|
+
testId?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Class name to apply to the calendar
|
|
137
|
+
*/
|
|
138
|
+
className?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Style customization to apply to the calendar
|
|
141
|
+
*/
|
|
142
|
+
style?: CSSProperties;
|
|
143
|
+
/**
|
|
144
|
+
* @internal An additional ref which exposes Calendar's internal api's. We kept this for
|
|
145
|
+
* backward compatibility. PLEASE DO NOT USE THIS.
|
|
146
|
+
*/
|
|
147
|
+
calendarRef?: React.Ref<CalendarRef>;
|
|
148
|
+
/**
|
|
149
|
+
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
150
|
+
*/
|
|
151
|
+
mode?: ThemeModes;
|
|
152
|
+
/**
|
|
153
|
+
* Tab index indicates if the calendar can be focused by keyboard or only programmatically.
|
|
154
|
+
*/
|
|
155
|
+
tabIndex?: number;
|
|
156
|
+
}
|
|
157
|
+
export interface CalendarRef {
|
|
158
|
+
navigate: (type: ArrowKeys) => void;
|
|
159
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "12.4.
|
|
3
|
+
"version": "12.4.2",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,9 +12,18 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
">=4.0 <4.5": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.0/*",
|
|
19
|
+
"dist/types-ts4.0/index.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
15
23
|
"sideEffects": false,
|
|
16
24
|
"atlaskit:src": "src/index.tsx",
|
|
17
25
|
"atlassian": {
|
|
26
|
+
"disableProductCI": true,
|
|
18
27
|
"team": "Design System Team",
|
|
19
28
|
"releaseModel": "scheduled",
|
|
20
29
|
"website": {
|
|
@@ -26,7 +35,7 @@
|
|
|
26
35
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
27
36
|
"@atlaskit/button": "^16.3.0",
|
|
28
37
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
29
|
-
"@atlaskit/icon": "^21.
|
|
38
|
+
"@atlaskit/icon": "^21.11.0",
|
|
30
39
|
"@atlaskit/locale": "^2.3.0",
|
|
31
40
|
"@atlaskit/theme": "^12.2.0",
|
|
32
41
|
"@atlaskit/tokens": "^0.10.0",
|
|
@@ -46,14 +55,14 @@
|
|
|
46
55
|
"@atlaskit/visual-regression": "*",
|
|
47
56
|
"@atlaskit/webdriver-runner": "*",
|
|
48
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
49
|
-
"@testing-library/dom": "^
|
|
50
|
-
"@testing-library/react": "^
|
|
58
|
+
"@testing-library/dom": "^8.17.1",
|
|
59
|
+
"@testing-library/react": "^12.1.5",
|
|
51
60
|
"jest-in-case": "^1.0.2",
|
|
52
61
|
"jscodeshift": "^0.13.0",
|
|
53
62
|
"react-dom": "^16.8.0",
|
|
54
63
|
"react-test-renderer": "^16.8.0",
|
|
55
64
|
"storybook-addon-performance": "^0.16.0",
|
|
56
|
-
"typescript": "4.
|
|
65
|
+
"typescript": "4.5.5",
|
|
57
66
|
"wait-for-expect": "^1.2.0"
|
|
58
67
|
},
|
|
59
68
|
"techstack": {
|
|
@@ -65,6 +74,7 @@
|
|
|
65
74
|
"design-system": "v1",
|
|
66
75
|
"ui-components": "lite-mode",
|
|
67
76
|
"analytics": "analytics-next",
|
|
77
|
+
"design-tokens": "spacing",
|
|
68
78
|
"theming": "tokens",
|
|
69
79
|
"deprecation": "no-deprecated-imports",
|
|
70
80
|
"styling": [
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/calendar"
|
|
1
|
+
## API Report File for "@atlaskit/calendar".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
/// <reference types="react" />
|
|
@@ -15,6 +17,15 @@ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
|
15
17
|
|
|
16
18
|
declare type ArrowKeys = 'left' | 'up' | 'right' | 'down';
|
|
17
19
|
|
|
20
|
+
/**
|
|
21
|
+
* __Calendar__
|
|
22
|
+
*
|
|
23
|
+
* A calendar is used for date selection.
|
|
24
|
+
*
|
|
25
|
+
* - [Examples](https://atlassian.design/components/calendar/examples)
|
|
26
|
+
* - [Code](https://atlassian.design/components/calendar/code)
|
|
27
|
+
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
28
|
+
*/
|
|
18
29
|
declare const Calendar: MemoExoticComponent<ForwardRefExoticComponent<
|
|
19
30
|
Pick<
|
|
20
31
|
CalendarProps,
|
|
@@ -24,13 +35,14 @@ declare const Calendar: MemoExoticComponent<ForwardRefExoticComponent<
|
|
|
24
35
|
| 'mode'
|
|
25
36
|
| 'testId'
|
|
26
37
|
| 'style'
|
|
27
|
-
| 'disabled'
|
|
28
|
-
| 'selected'
|
|
29
38
|
| 'className'
|
|
39
|
+
| 'tabIndex'
|
|
30
40
|
| 'onFocus'
|
|
31
41
|
| 'onBlur'
|
|
32
42
|
| 'onChange'
|
|
33
43
|
| 'onSelect'
|
|
44
|
+
| 'disabled'
|
|
45
|
+
| 'selected'
|
|
34
46
|
| 'analyticsContext'
|
|
35
47
|
| 'day'
|
|
36
48
|
| 'month'
|
|
@@ -54,58 +66,104 @@ declare const Calendar: MemoExoticComponent<ForwardRefExoticComponent<
|
|
|
54
66
|
export default Calendar;
|
|
55
67
|
|
|
56
68
|
export declare interface CalendarProps extends WithAnalyticsEventsProps {
|
|
57
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The number of the day currently focused. Places border around the date. 0 highlights no date.
|
|
71
|
+
*/
|
|
58
72
|
day?: number;
|
|
59
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Default for `day`.
|
|
75
|
+
*/
|
|
60
76
|
defaultDay?: number;
|
|
61
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Default for `month`.
|
|
79
|
+
*/
|
|
62
80
|
defaultMonth?: number;
|
|
63
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Default for `previouslySelected`.
|
|
83
|
+
*/
|
|
64
84
|
defaultPreviouslySelected?: Array<string>;
|
|
65
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Default for `selected`.
|
|
87
|
+
*/
|
|
66
88
|
defaultSelected?: Array<string>;
|
|
67
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Default for `year`.
|
|
91
|
+
*/
|
|
68
92
|
defaultYear?: number;
|
|
69
|
-
/**
|
|
70
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates provided are greyed out.
|
|
95
|
+
* This does not prevent these dates being selected.
|
|
96
|
+
*/
|
|
71
97
|
disabled?: Array<string>;
|
|
72
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* A filter function that takes a date string in the format 'YYYY-MM-DD' and returns true if that date should be disabled.
|
|
100
|
+
*/
|
|
73
101
|
disabledDateFilter?: (date: string) => boolean;
|
|
74
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* The latest enabled date
|
|
104
|
+
*/
|
|
75
105
|
maxDate?: string;
|
|
76
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* The earliest enabled date
|
|
108
|
+
*/
|
|
77
109
|
minDate?: string;
|
|
78
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* The number of the month (from 1 to 12) which the calendar should be on.
|
|
112
|
+
*/
|
|
79
113
|
month?: number;
|
|
80
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* The aria-label attribute associated with the next-month arrow.
|
|
116
|
+
*/
|
|
81
117
|
nextMonthLabel?: string;
|
|
82
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Function which is called when the calendar is no longer focused.
|
|
120
|
+
*/
|
|
83
121
|
onBlur?: React.FocusEventHandler;
|
|
84
|
-
/**
|
|
85
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Called when the calendar is navigated. This can be triggered by the keyboard, or by clicking the navigational buttons.
|
|
124
|
+
* The 'interface' property indicates the the direction the calendar was navigated whereas the 'iso' property is a string of the format YYYY-MM-DD.
|
|
125
|
+
*/
|
|
86
126
|
onChange?: (event: ChangeEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
87
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Called when the calendar receives focus. This could be from a mouse event on the container by tabbing into it.
|
|
129
|
+
*/
|
|
88
130
|
onFocus?: React.FocusEventHandler;
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Function called when a day is clicked on. Calls with an object that has
|
|
133
|
+
* a day, month and year property as numbers, representing the date just clicked.
|
|
134
|
+
* It also has an 'iso' property, which is a string of the selected date in the
|
|
135
|
+
* format YYYY-MM-DD.
|
|
136
|
+
*/
|
|
93
137
|
onSelect?: (event: SelectEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
94
|
-
/**
|
|
95
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
140
|
+
* provided are given a background color.
|
|
141
|
+
*/
|
|
96
142
|
previouslySelected?: Array<string>;
|
|
97
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* The aria-label attribute associated with the previous-month arrow.
|
|
145
|
+
*/
|
|
98
146
|
previousMonthLabel?: string;
|
|
99
|
-
/**
|
|
100
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
149
|
+
* provided are given a background color.
|
|
150
|
+
*/
|
|
101
151
|
selected?: Array<string>;
|
|
102
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Value of current day, as a string in the format 'YYYY-MM-DD'.
|
|
154
|
+
*/
|
|
103
155
|
today?: string;
|
|
104
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Year to display the calendar for.
|
|
158
|
+
*/
|
|
105
159
|
year?: number;
|
|
106
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* BCP 47 language tag (e.g. ja-JP) that ensures dates are in the official format for the locale.
|
|
162
|
+
*/
|
|
107
163
|
locale?: string;
|
|
108
|
-
/**
|
|
164
|
+
/**
|
|
165
|
+
* Additional information to be included in the `context` of analytics events.
|
|
166
|
+
*/
|
|
109
167
|
analyticsContext?: Record<string, any>;
|
|
110
168
|
/**
|
|
111
169
|
* Start day of the week for the calendar.
|
|
@@ -127,7 +185,7 @@ export declare interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
127
185
|
* testId--next-month - Button to show previous month
|
|
128
186
|
* testId--current-month-year - Text containing the current month and year
|
|
129
187
|
* testId--selected-day - The currently selected day (may be missing if a date isn’t selected)
|
|
130
|
-
|
|
188
|
+
*/
|
|
131
189
|
testId?: string;
|
|
132
190
|
/**
|
|
133
191
|
* Class name to apply to the calendar
|
|
@@ -146,6 +204,10 @@ export declare interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
146
204
|
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
147
205
|
*/
|
|
148
206
|
mode?: ThemeModes;
|
|
207
|
+
/**
|
|
208
|
+
* Tab index indicates if the calendar can be focused by keyboard or only programmatically.
|
|
209
|
+
*/
|
|
210
|
+
tabIndex?: number;
|
|
149
211
|
}
|
|
150
212
|
|
|
151
213
|
export declare interface CalendarRef {
|
package/types/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/entry-points/types.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/entry-points/types.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/entry-points/types.d.ts"
|
|
7
|
+
"types": "../dist/types/entry-points/types.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/entry-points/types.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|