@atlaskit/calendar 12.2.0 → 12.3.0
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 +6 -0
- package/dist/cjs/calendar.js +5 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/calendar.js +4 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/calendar.js +5 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types/types.d.ts +4 -0
- package/package.json +1 -1
- package/report.api.md +175 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/calendar
|
|
2
2
|
|
|
3
|
+
## 12.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e1e33cfe0db`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e1e33cfe0db) - [ux] Adds tabIndex prop for `@atlaskit/calendar`, useful when needing to disable calendar from receiving focus by keyboard.
|
|
8
|
+
|
|
3
9
|
## 12.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cjs/calendar.js
CHANGED
|
@@ -83,7 +83,7 @@ var gridsContainerStyles = (0, _core.css)({
|
|
|
83
83
|
var analyticsAttributes = {
|
|
84
84
|
componentName: 'calendar',
|
|
85
85
|
packageName: "@atlaskit/calendar",
|
|
86
|
-
packageVersion: "12.
|
|
86
|
+
packageVersion: "12.3.0"
|
|
87
87
|
};
|
|
88
88
|
var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
|
|
89
89
|
var day = _ref.day,
|
|
@@ -125,7 +125,9 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
125
125
|
calendarRef = _ref.calendarRef,
|
|
126
126
|
mode = _ref.mode,
|
|
127
127
|
className = _ref.className,
|
|
128
|
-
style = _ref.style
|
|
128
|
+
style = _ref.style,
|
|
129
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
130
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
129
131
|
|
|
130
132
|
var _useControlledDateSta = (0, _useControlledDateState.default)({
|
|
131
133
|
day: day,
|
|
@@ -245,7 +247,7 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
245
247
|
"aria-describedby": announceId,
|
|
246
248
|
"aria-label": "calendar",
|
|
247
249
|
role: "grid",
|
|
248
|
-
tabIndex:
|
|
250
|
+
tabIndex: tabIndex
|
|
249
251
|
}, (0, _core.jsx)(_heading.default // The month number needs to be translated to index in the month
|
|
250
252
|
// name array e.g. 1 (January) -> 0
|
|
251
253
|
, {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/calendar.js
CHANGED
|
@@ -48,7 +48,7 @@ const gridsContainerStyles = css({
|
|
|
48
48
|
const analyticsAttributes = {
|
|
49
49
|
componentName: 'calendar',
|
|
50
50
|
packageName: "@atlaskit/calendar",
|
|
51
|
-
packageVersion: "12.
|
|
51
|
+
packageVersion: "12.3.0"
|
|
52
52
|
};
|
|
53
53
|
const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
54
54
|
day,
|
|
@@ -79,7 +79,8 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
79
79
|
calendarRef,
|
|
80
80
|
mode,
|
|
81
81
|
className,
|
|
82
|
-
style
|
|
82
|
+
style,
|
|
83
|
+
tabIndex = 0
|
|
83
84
|
}, ref) {
|
|
84
85
|
const {
|
|
85
86
|
day: [dayValue, setDayValue],
|
|
@@ -185,7 +186,7 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
185
186
|
"aria-describedby": announceId,
|
|
186
187
|
"aria-label": "calendar",
|
|
187
188
|
role: "grid",
|
|
188
|
-
tabIndex:
|
|
189
|
+
tabIndex: tabIndex
|
|
189
190
|
}, jsx(HeadingComponent // The month number needs to be translated to index in the month
|
|
190
191
|
// name array e.g. 1 (January) -> 0
|
|
191
192
|
, {
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/calendar.js
CHANGED
|
@@ -54,7 +54,7 @@ var gridsContainerStyles = css({
|
|
|
54
54
|
var analyticsAttributes = {
|
|
55
55
|
componentName: 'calendar',
|
|
56
56
|
packageName: "@atlaskit/calendar",
|
|
57
|
-
packageVersion: "12.
|
|
57
|
+
packageVersion: "12.3.0"
|
|
58
58
|
};
|
|
59
59
|
var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
60
60
|
var day = _ref.day,
|
|
@@ -96,7 +96,9 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
96
96
|
calendarRef = _ref.calendarRef,
|
|
97
97
|
mode = _ref.mode,
|
|
98
98
|
className = _ref.className,
|
|
99
|
-
style = _ref.style
|
|
99
|
+
style = _ref.style,
|
|
100
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
101
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
100
102
|
|
|
101
103
|
var _useControlledDateSta = useControlledDateState({
|
|
102
104
|
day: day,
|
|
@@ -216,7 +218,7 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
216
218
|
"aria-describedby": announceId,
|
|
217
219
|
"aria-label": "calendar",
|
|
218
220
|
role: "grid",
|
|
219
|
-
tabIndex:
|
|
221
|
+
tabIndex: tabIndex
|
|
220
222
|
}, jsx(HeadingComponent // The month number needs to be translated to index in the month
|
|
221
223
|
// name array e.g. 1 (January) -> 0
|
|
222
224
|
, {
|
package/dist/esm/version.json
CHANGED
package/dist/types/calendar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CalendarProps } from './types';
|
|
3
|
-
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "style" | "disabled" | "selected" | "className" | "onFocus" | "onBlur" | "onChange" | "onSelect" | "analyticsContext" | "day" | "month" | "defaultDay" | "defaultMonth" | "defaultYear" | "today" | "defaultSelected" | "previouslySelected" | "defaultPreviouslySelected" | "weekStartDay" | "disabledDateFilter" | "minDate" | "maxDate" | "locale" | "calendarRef" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
3
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "style" | "disabled" | "selected" | "className" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | "onSelect" | "analyticsContext" | "day" | "month" | "defaultDay" | "defaultMonth" | "defaultYear" | "today" | "defaultSelected" | "previouslySelected" | "defaultPreviouslySelected" | "weekStartDay" | "disabledDateFilter" | "minDate" | "maxDate" | "locale" | "calendarRef" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
4
4
|
export default Calendar;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -103,6 +103,10 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
103
103
|
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
104
104
|
*/
|
|
105
105
|
mode?: ThemeModes;
|
|
106
|
+
/**
|
|
107
|
+
* Tab index indicates if the calendar can be focused by keyboard or only programmatically.
|
|
108
|
+
*/
|
|
109
|
+
tabIndex?: number;
|
|
106
110
|
}
|
|
107
111
|
export interface CalendarRef {
|
|
108
112
|
navigate: (type: ArrowKeys) => void;
|
package/package.json
CHANGED
package/report.api.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/calendar"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
/// <reference types="react" />
|
|
7
|
+
|
|
8
|
+
import { CSSProperties } from 'react';
|
|
9
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
10
|
+
import { MemoExoticComponent } from 'react';
|
|
11
|
+
import { RefAttributes } from 'react';
|
|
12
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
13
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
14
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
15
|
+
|
|
16
|
+
declare type ArrowKeys = 'left' | 'up' | 'right' | 'down';
|
|
17
|
+
|
|
18
|
+
declare const Calendar: MemoExoticComponent<ForwardRefExoticComponent<
|
|
19
|
+
Pick<
|
|
20
|
+
CalendarProps,
|
|
21
|
+
| 'year'
|
|
22
|
+
| 'previousMonthLabel'
|
|
23
|
+
| 'nextMonthLabel'
|
|
24
|
+
| 'mode'
|
|
25
|
+
| 'testId'
|
|
26
|
+
| 'style'
|
|
27
|
+
| 'disabled'
|
|
28
|
+
| 'selected'
|
|
29
|
+
| 'className'
|
|
30
|
+
| 'onFocus'
|
|
31
|
+
| 'onBlur'
|
|
32
|
+
| 'onChange'
|
|
33
|
+
| 'onSelect'
|
|
34
|
+
| 'analyticsContext'
|
|
35
|
+
| 'day'
|
|
36
|
+
| 'month'
|
|
37
|
+
| 'defaultDay'
|
|
38
|
+
| 'defaultMonth'
|
|
39
|
+
| 'defaultYear'
|
|
40
|
+
| 'today'
|
|
41
|
+
| 'defaultSelected'
|
|
42
|
+
| 'previouslySelected'
|
|
43
|
+
| 'defaultPreviouslySelected'
|
|
44
|
+
| 'weekStartDay'
|
|
45
|
+
| 'disabledDateFilter'
|
|
46
|
+
| 'minDate'
|
|
47
|
+
| 'maxDate'
|
|
48
|
+
| 'locale'
|
|
49
|
+
| 'calendarRef'
|
|
50
|
+
| 'createAnalyticsEvent'
|
|
51
|
+
> &
|
|
52
|
+
RefAttributes<HTMLDivElement>
|
|
53
|
+
>>;
|
|
54
|
+
export default Calendar;
|
|
55
|
+
|
|
56
|
+
export declare interface CalendarProps extends WithAnalyticsEventsProps {
|
|
57
|
+
/** The number of the day currently focused. Places border around the date. 0 highlights no date. */
|
|
58
|
+
day?: number;
|
|
59
|
+
/** Default for `day`. */
|
|
60
|
+
defaultDay?: number;
|
|
61
|
+
/** Default for `month`. */
|
|
62
|
+
defaultMonth?: number;
|
|
63
|
+
/** Default for `previouslySelected`. */
|
|
64
|
+
defaultPreviouslySelected?: Array<string>;
|
|
65
|
+
/** Default for `selected`. */
|
|
66
|
+
defaultSelected?: Array<string>;
|
|
67
|
+
/** Default for `year`. */
|
|
68
|
+
defaultYear?: number;
|
|
69
|
+
/** Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates provided are greyed out.
|
|
70
|
+
This does not prevent these dates being selected. */
|
|
71
|
+
disabled?: Array<string>;
|
|
72
|
+
/** A filter function that takes a date string in the format 'YYYY-MM-DD' and returns true if that date should be disabled. */
|
|
73
|
+
disabledDateFilter?: (date: string) => boolean;
|
|
74
|
+
/** The latest enabled date */
|
|
75
|
+
maxDate?: string;
|
|
76
|
+
/** The earliest enabled date */
|
|
77
|
+
minDate?: string;
|
|
78
|
+
/** The number of the month (from 1 to 12) which the calendar should be on. */
|
|
79
|
+
month?: number;
|
|
80
|
+
/** The aria-label attribute associated with the next-month arrow. */
|
|
81
|
+
nextMonthLabel?: string;
|
|
82
|
+
/** Function which is called when the calendar is no longer focused. */
|
|
83
|
+
onBlur?: React.FocusEventHandler;
|
|
84
|
+
/** Called when the calendar is navigated. This can be triggered by the keyboard, or by clicking the navigational buttons.
|
|
85
|
+
The 'interface' property indicates the the direction the calendar was navigated whereas the 'iso' property is a string of the format YYYY-MM-DD. */
|
|
86
|
+
onChange?: (event: ChangeEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
87
|
+
/** Called when the calendar receives focus. This could be from a mouse event on the container by tabbing into it. */
|
|
88
|
+
onFocus?: React.FocusEventHandler;
|
|
89
|
+
/** Function called when a day is clicked on. Calls with an object that has
|
|
90
|
+
a day, month and year property as numbers, representing the date just clicked.
|
|
91
|
+
It also has an 'iso' property, which is a string of the selected date in the
|
|
92
|
+
format YYYY-MM-DD. */
|
|
93
|
+
onSelect?: (event: SelectEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
94
|
+
/** Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
95
|
+
provided are given a background color. */
|
|
96
|
+
previouslySelected?: Array<string>;
|
|
97
|
+
/** The aria-label attribute associated with the previous-month arrow. */
|
|
98
|
+
previousMonthLabel?: string;
|
|
99
|
+
/** Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
100
|
+
provided are given a background color. */
|
|
101
|
+
selected?: Array<string>;
|
|
102
|
+
/** Value of current day, as a string in the format 'YYYY-MM-DD'. */
|
|
103
|
+
today?: string;
|
|
104
|
+
/** Year to display the calendar for. */
|
|
105
|
+
year?: number;
|
|
106
|
+
/** BCP 47 language tag (e.g. ja-JP) that ensures dates are in the official format for the locale. */
|
|
107
|
+
locale?: string;
|
|
108
|
+
/** Additional information to be included in the `context` of analytics events. */
|
|
109
|
+
analyticsContext?: Record<string, any>;
|
|
110
|
+
/**
|
|
111
|
+
* Start day of the week for the calendar.
|
|
112
|
+
* - `0` sunday (default value)
|
|
113
|
+
* - `1` monday
|
|
114
|
+
* - `2` tuesday
|
|
115
|
+
* - `3` wednesday
|
|
116
|
+
* - `4` thursday
|
|
117
|
+
* - `5` friday
|
|
118
|
+
* - `6` saturday
|
|
119
|
+
*/
|
|
120
|
+
weekStartDay?: WeekDay;
|
|
121
|
+
/**
|
|
122
|
+
* 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
|
|
123
|
+
*
|
|
124
|
+
* testId--container - Outermost container containing everything inside calendar
|
|
125
|
+
* testId--month - Container containing all available days for the month
|
|
126
|
+
* testId--previous-month - Button to show next month
|
|
127
|
+
* testId--next-month - Button to show previous month
|
|
128
|
+
* testId--current-month-year - Text containing the current month and year
|
|
129
|
+
* testId--selected-day - The currently selected day (may be missing if a date isn’t selected)
|
|
130
|
+
* */
|
|
131
|
+
testId?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Class name to apply to the calendar
|
|
134
|
+
*/
|
|
135
|
+
className?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Style customization to apply to the calendar
|
|
138
|
+
*/
|
|
139
|
+
style?: CSSProperties;
|
|
140
|
+
/**
|
|
141
|
+
* @internal An additional ref which exposes Calendar's internal api's. We kept this for
|
|
142
|
+
* backward compatibility. PLEASE DO NOT USE THIS.
|
|
143
|
+
*/
|
|
144
|
+
calendarRef?: React.Ref<CalendarRef>;
|
|
145
|
+
/**
|
|
146
|
+
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
147
|
+
*/
|
|
148
|
+
mode?: ThemeModes;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export declare interface CalendarRef {
|
|
152
|
+
navigate: (type: ArrowKeys) => void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export declare type ChangeEvent = {
|
|
156
|
+
iso: ISODate;
|
|
157
|
+
type: 'left' | 'up' | 'right' | 'down' | 'prev' | 'next';
|
|
158
|
+
} & DateObj;
|
|
159
|
+
|
|
160
|
+
declare type DateObj = {
|
|
161
|
+
day: number;
|
|
162
|
+
month: number;
|
|
163
|
+
year: number;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
declare type ISODate = string;
|
|
167
|
+
|
|
168
|
+
export declare type SelectEvent = {
|
|
169
|
+
iso: ISODate;
|
|
170
|
+
} & DateObj;
|
|
171
|
+
|
|
172
|
+
declare type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
173
|
+
|
|
174
|
+
export {};
|
|
175
|
+
```
|