@atlaskit/calendar 12.1.13 → 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 +22 -0
- package/dist/cjs/calendar.js +9 -3
- package/dist/cjs/internal/components/heading.js +10 -4
- package/dist/cjs/internal/styles/date.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/calendar.js +8 -3
- package/dist/es2019/internal/components/heading.js +8 -4
- package/dist/es2019/internal/styles/date.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/calendar.js +9 -3
- package/dist/esm/internal/components/heading.js +10 -4
- package/dist/esm/internal/styles/date.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types/internal/components/heading.d.ts +2 -0
- package/dist/types/types.d.ts +8 -0
- package/package.json +7 -5
- package/report.api.md +175 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
|
|
9
|
+
## 12.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`6f7a4353204`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6f7a4353204) - Added ability to provide custom aria-labels for next- and previous-month buttons using `nextMonthLabel` and `previousMonthLabel`
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 12.1.14
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`c8c7eec9fb8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c8c7eec9fb8) - [ux] Updates tokens used for selected hovered state
|
|
24
|
+
|
|
3
25
|
## 12.1.13
|
|
4
26
|
|
|
5
27
|
### Patch 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,
|
|
@@ -102,6 +102,7 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
102
102
|
minDate = _ref.minDate,
|
|
103
103
|
maxDate = _ref.maxDate,
|
|
104
104
|
month = _ref.month,
|
|
105
|
+
nextMonthLabel = _ref.nextMonthLabel,
|
|
105
106
|
_ref$onBlur = _ref.onBlur,
|
|
106
107
|
onBlur = _ref$onBlur === void 0 ? _noop.default : _ref$onBlur,
|
|
107
108
|
_ref$onChange = _ref.onChange,
|
|
@@ -111,6 +112,7 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
111
112
|
_ref$onSelect = _ref.onSelect,
|
|
112
113
|
onSelect = _ref$onSelect === void 0 ? _noop.default : _ref$onSelect,
|
|
113
114
|
previouslySelected = _ref.previouslySelected,
|
|
115
|
+
previousMonthLabel = _ref.previousMonthLabel,
|
|
114
116
|
selected = _ref.selected,
|
|
115
117
|
today = _ref.today,
|
|
116
118
|
_ref$locale = _ref.locale,
|
|
@@ -123,7 +125,9 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
123
125
|
calendarRef = _ref.calendarRef,
|
|
124
126
|
mode = _ref.mode,
|
|
125
127
|
className = _ref.className,
|
|
126
|
-
style = _ref.style
|
|
128
|
+
style = _ref.style,
|
|
129
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
130
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
127
131
|
|
|
128
132
|
var _useControlledDateSta = (0, _useControlledDateState.default)({
|
|
129
133
|
day: day,
|
|
@@ -243,12 +247,14 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
243
247
|
"aria-describedby": announceId,
|
|
244
248
|
"aria-label": "calendar",
|
|
245
249
|
role: "grid",
|
|
246
|
-
tabIndex:
|
|
250
|
+
tabIndex: tabIndex
|
|
247
251
|
}, (0, _core.jsx)(_heading.default // The month number needs to be translated to index in the month
|
|
248
252
|
// name array e.g. 1 (January) -> 0
|
|
249
253
|
, {
|
|
250
254
|
monthLongTitle: monthsLong[monthValue - 1],
|
|
251
255
|
year: yearValue,
|
|
256
|
+
nextMonthLabel: nextMonthLabel,
|
|
257
|
+
previousMonthLabel: previousMonthLabel,
|
|
252
258
|
handleClickNext: handleClickNext,
|
|
253
259
|
handleClickPrev: handleClickPrev,
|
|
254
260
|
mode: mode,
|
|
@@ -49,6 +49,10 @@ var arrowRightStyles = (0, _core.css)({
|
|
|
49
49
|
var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
50
50
|
var monthLongTitle = _ref.monthLongTitle,
|
|
51
51
|
year = _ref.year,
|
|
52
|
+
_ref$previousMonthLab = _ref.previousMonthLabel,
|
|
53
|
+
previousMonthLabel = _ref$previousMonthLab === void 0 ? 'Last month' : _ref$previousMonthLab,
|
|
54
|
+
_ref$nextMonthLabel = _ref.nextMonthLabel,
|
|
55
|
+
nextMonthLabel = _ref$nextMonthLabel === void 0 ? 'Next month' : _ref$nextMonthLabel,
|
|
52
56
|
handleClickPrev = _ref.handleClickPrev,
|
|
53
57
|
handleClickNext = _ref.handleClickNext,
|
|
54
58
|
mode = _ref.mode,
|
|
@@ -67,9 +71,10 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
|
67
71
|
onClick: handleClickPrev,
|
|
68
72
|
testId: testId && "".concat(testId, "--previous-month"),
|
|
69
73
|
iconBefore: (0, _core.jsx)(_chevronLeftLarge.default, {
|
|
70
|
-
label:
|
|
74
|
+
label: previousMonthLabel,
|
|
71
75
|
size: "medium",
|
|
72
|
-
primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")")
|
|
76
|
+
primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
|
|
77
|
+
testId: testId && "".concat(testId, "--previous-month-icon")
|
|
73
78
|
})
|
|
74
79
|
}), (0, _core.jsx)("div", {
|
|
75
80
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
@@ -83,9 +88,10 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
|
83
88
|
onClick: handleClickNext,
|
|
84
89
|
testId: testId && "".concat(testId, "--next-month"),
|
|
85
90
|
iconBefore: (0, _core.jsx)(_chevronRightLarge.default, {
|
|
86
|
-
label:
|
|
91
|
+
label: nextMonthLabel,
|
|
87
92
|
size: "medium",
|
|
88
|
-
primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")")
|
|
93
|
+
primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
|
|
94
|
+
testId: testId && "".concat(testId, "--next-month-icon")
|
|
89
95
|
})
|
|
90
96
|
}));
|
|
91
97
|
});
|
|
@@ -88,10 +88,10 @@ var dateCellStyles = function dateCellStyles() {
|
|
|
88
88
|
color: textColor[mode]
|
|
89
89
|
},
|
|
90
90
|
'&[data-selected]:hover': {
|
|
91
|
-
|
|
91
|
+
backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.B50, ")"),
|
|
92
|
+
color: "var(--ds-text-selected, ".concat(_colors.N600, ")")
|
|
92
93
|
},
|
|
93
94
|
'&[data-prev-selected]:hover': {
|
|
94
|
-
backgroundColor: "var(--ds-background-selected, ".concat(_colors.B50, ")"),
|
|
95
95
|
color: textColorMedium
|
|
96
96
|
},
|
|
97
97
|
'&[data-sibling]:hover': {
|
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,
|
|
@@ -62,11 +62,13 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
62
62
|
minDate,
|
|
63
63
|
maxDate,
|
|
64
64
|
month,
|
|
65
|
+
nextMonthLabel,
|
|
65
66
|
onBlur = noop,
|
|
66
67
|
onChange = noop,
|
|
67
68
|
onFocus = noop,
|
|
68
69
|
onSelect = noop,
|
|
69
70
|
previouslySelected,
|
|
71
|
+
previousMonthLabel,
|
|
70
72
|
selected,
|
|
71
73
|
today,
|
|
72
74
|
locale = 'en-US',
|
|
@@ -77,7 +79,8 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
77
79
|
calendarRef,
|
|
78
80
|
mode,
|
|
79
81
|
className,
|
|
80
|
-
style
|
|
82
|
+
style,
|
|
83
|
+
tabIndex = 0
|
|
81
84
|
}, ref) {
|
|
82
85
|
const {
|
|
83
86
|
day: [dayValue, setDayValue],
|
|
@@ -183,12 +186,14 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
183
186
|
"aria-describedby": announceId,
|
|
184
187
|
"aria-label": "calendar",
|
|
185
188
|
role: "grid",
|
|
186
|
-
tabIndex:
|
|
189
|
+
tabIndex: tabIndex
|
|
187
190
|
}, jsx(HeadingComponent // The month number needs to be translated to index in the month
|
|
188
191
|
// name array e.g. 1 (January) -> 0
|
|
189
192
|
, {
|
|
190
193
|
monthLongTitle: monthsLong[monthValue - 1],
|
|
191
194
|
year: yearValue,
|
|
195
|
+
nextMonthLabel: nextMonthLabel,
|
|
196
|
+
previousMonthLabel: previousMonthLabel,
|
|
192
197
|
handleClickNext: handleClickNext,
|
|
193
198
|
handleClickPrev: handleClickPrev,
|
|
194
199
|
mode: mode,
|
|
@@ -31,6 +31,8 @@ const arrowRightStyles = css({
|
|
|
31
31
|
const Heading = /*#__PURE__*/memo(function Heading({
|
|
32
32
|
monthLongTitle,
|
|
33
33
|
year,
|
|
34
|
+
previousMonthLabel = 'Last month',
|
|
35
|
+
nextMonthLabel = 'Next month',
|
|
34
36
|
handleClickPrev,
|
|
35
37
|
handleClickNext,
|
|
36
38
|
mode,
|
|
@@ -48,9 +50,10 @@ const Heading = /*#__PURE__*/memo(function Heading({
|
|
|
48
50
|
onClick: handleClickPrev,
|
|
49
51
|
testId: testId && `${testId}--previous-month`,
|
|
50
52
|
iconBefore: jsx(ArrowleftIcon, {
|
|
51
|
-
label:
|
|
53
|
+
label: previousMonthLabel,
|
|
52
54
|
size: "medium",
|
|
53
|
-
primaryColor: `var(--ds-text-subtlest, ${N70})
|
|
55
|
+
primaryColor: `var(--ds-text-subtlest, ${N70})`,
|
|
56
|
+
testId: testId && `${testId}--previous-month-icon`
|
|
54
57
|
})
|
|
55
58
|
}), jsx("div", {
|
|
56
59
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
@@ -64,9 +67,10 @@ const Heading = /*#__PURE__*/memo(function Heading({
|
|
|
64
67
|
onClick: handleClickNext,
|
|
65
68
|
testId: testId && `${testId}--next-month`,
|
|
66
69
|
iconBefore: jsx(ArrowrightIcon, {
|
|
67
|
-
label:
|
|
70
|
+
label: nextMonthLabel,
|
|
68
71
|
size: "medium",
|
|
69
|
-
primaryColor: `var(--ds-text-subtlest, ${N70})
|
|
72
|
+
primaryColor: `var(--ds-text-subtlest, ${N70})`,
|
|
73
|
+
testId: testId && `${testId}--next-month-icon`
|
|
70
74
|
})
|
|
71
75
|
}));
|
|
72
76
|
});
|
|
@@ -77,10 +77,10 @@ export const dateCellStyles = (mode = 'light') => ({
|
|
|
77
77
|
color: textColor[mode]
|
|
78
78
|
},
|
|
79
79
|
'&[data-selected]:hover': {
|
|
80
|
-
|
|
80
|
+
backgroundColor: `var(--ds-background-selected-hovered, ${B50})`,
|
|
81
|
+
color: `var(--ds-text-selected, ${N600})`
|
|
81
82
|
},
|
|
82
83
|
'&[data-prev-selected]:hover': {
|
|
83
|
-
backgroundColor: `var(--ds-background-selected, ${B50})`,
|
|
84
84
|
color: textColorMedium
|
|
85
85
|
},
|
|
86
86
|
'&[data-sibling]:hover': {
|
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,
|
|
@@ -73,6 +73,7 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
73
73
|
minDate = _ref.minDate,
|
|
74
74
|
maxDate = _ref.maxDate,
|
|
75
75
|
month = _ref.month,
|
|
76
|
+
nextMonthLabel = _ref.nextMonthLabel,
|
|
76
77
|
_ref$onBlur = _ref.onBlur,
|
|
77
78
|
onBlur = _ref$onBlur === void 0 ? noop : _ref$onBlur,
|
|
78
79
|
_ref$onChange = _ref.onChange,
|
|
@@ -82,6 +83,7 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
82
83
|
_ref$onSelect = _ref.onSelect,
|
|
83
84
|
onSelect = _ref$onSelect === void 0 ? noop : _ref$onSelect,
|
|
84
85
|
previouslySelected = _ref.previouslySelected,
|
|
86
|
+
previousMonthLabel = _ref.previousMonthLabel,
|
|
85
87
|
selected = _ref.selected,
|
|
86
88
|
today = _ref.today,
|
|
87
89
|
_ref$locale = _ref.locale,
|
|
@@ -94,7 +96,9 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
94
96
|
calendarRef = _ref.calendarRef,
|
|
95
97
|
mode = _ref.mode,
|
|
96
98
|
className = _ref.className,
|
|
97
|
-
style = _ref.style
|
|
99
|
+
style = _ref.style,
|
|
100
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
101
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
98
102
|
|
|
99
103
|
var _useControlledDateSta = useControlledDateState({
|
|
100
104
|
day: day,
|
|
@@ -214,12 +218,14 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
214
218
|
"aria-describedby": announceId,
|
|
215
219
|
"aria-label": "calendar",
|
|
216
220
|
role: "grid",
|
|
217
|
-
tabIndex:
|
|
221
|
+
tabIndex: tabIndex
|
|
218
222
|
}, jsx(HeadingComponent // The month number needs to be translated to index in the month
|
|
219
223
|
// name array e.g. 1 (January) -> 0
|
|
220
224
|
, {
|
|
221
225
|
monthLongTitle: monthsLong[monthValue - 1],
|
|
222
226
|
year: yearValue,
|
|
227
|
+
nextMonthLabel: nextMonthLabel,
|
|
228
|
+
previousMonthLabel: previousMonthLabel,
|
|
223
229
|
handleClickNext: handleClickNext,
|
|
224
230
|
handleClickPrev: handleClickPrev,
|
|
225
231
|
mode: mode,
|
|
@@ -34,6 +34,10 @@ var arrowRightStyles = css({
|
|
|
34
34
|
var Heading = /*#__PURE__*/memo(function Heading(_ref) {
|
|
35
35
|
var monthLongTitle = _ref.monthLongTitle,
|
|
36
36
|
year = _ref.year,
|
|
37
|
+
_ref$previousMonthLab = _ref.previousMonthLabel,
|
|
38
|
+
previousMonthLabel = _ref$previousMonthLab === void 0 ? 'Last month' : _ref$previousMonthLab,
|
|
39
|
+
_ref$nextMonthLabel = _ref.nextMonthLabel,
|
|
40
|
+
nextMonthLabel = _ref$nextMonthLabel === void 0 ? 'Next month' : _ref$nextMonthLabel,
|
|
37
41
|
handleClickPrev = _ref.handleClickPrev,
|
|
38
42
|
handleClickNext = _ref.handleClickNext,
|
|
39
43
|
mode = _ref.mode,
|
|
@@ -52,9 +56,10 @@ var Heading = /*#__PURE__*/memo(function Heading(_ref) {
|
|
|
52
56
|
onClick: handleClickPrev,
|
|
53
57
|
testId: testId && "".concat(testId, "--previous-month"),
|
|
54
58
|
iconBefore: jsx(ArrowleftIcon, {
|
|
55
|
-
label:
|
|
59
|
+
label: previousMonthLabel,
|
|
56
60
|
size: "medium",
|
|
57
|
-
primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")")
|
|
61
|
+
primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")"),
|
|
62
|
+
testId: testId && "".concat(testId, "--previous-month-icon")
|
|
58
63
|
})
|
|
59
64
|
}), jsx("div", {
|
|
60
65
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
@@ -68,9 +73,10 @@ var Heading = /*#__PURE__*/memo(function Heading(_ref) {
|
|
|
68
73
|
onClick: handleClickNext,
|
|
69
74
|
testId: testId && "".concat(testId, "--next-month"),
|
|
70
75
|
iconBefore: jsx(ArrowrightIcon, {
|
|
71
|
-
label:
|
|
76
|
+
label: nextMonthLabel,
|
|
72
77
|
size: "medium",
|
|
73
|
-
primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")")
|
|
78
|
+
primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")"),
|
|
79
|
+
testId: testId && "".concat(testId, "--next-month-icon")
|
|
74
80
|
})
|
|
75
81
|
}));
|
|
76
82
|
});
|
|
@@ -79,10 +79,10 @@ export var dateCellStyles = function dateCellStyles() {
|
|
|
79
79
|
color: textColor[mode]
|
|
80
80
|
},
|
|
81
81
|
'&[data-selected]:hover': {
|
|
82
|
-
|
|
82
|
+
backgroundColor: "var(--ds-background-selected-hovered, ".concat(B50, ")"),
|
|
83
|
+
color: "var(--ds-text-selected, ".concat(N600, ")")
|
|
83
84
|
},
|
|
84
85
|
'&[data-prev-selected]:hover': {
|
|
85
|
-
backgroundColor: "var(--ds-background-selected, ".concat(B50, ")"),
|
|
86
86
|
color: textColorMedium
|
|
87
87
|
},
|
|
88
88
|
'&[data-sibling]:hover': {
|
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" | "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
|
@@ -34,6 +34,8 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
34
34
|
minDate?: string;
|
|
35
35
|
/** The number of the month (from 1 to 12) which the calendar should be on. */
|
|
36
36
|
month?: number;
|
|
37
|
+
/** The aria-label attribute associated with the next-month arrow. */
|
|
38
|
+
nextMonthLabel?: string;
|
|
37
39
|
/** Function which is called when the calendar is no longer focused. */
|
|
38
40
|
onBlur?: React.FocusEventHandler;
|
|
39
41
|
/** Called when the calendar is navigated. This can be triggered by the keyboard, or by clicking the navigational buttons.
|
|
@@ -49,6 +51,8 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
49
51
|
/** Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
50
52
|
provided are given a background color. */
|
|
51
53
|
previouslySelected?: Array<string>;
|
|
54
|
+
/** The aria-label attribute associated with the previous-month arrow. */
|
|
55
|
+
previousMonthLabel?: string;
|
|
52
56
|
/** Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
53
57
|
provided are given a background color. */
|
|
54
58
|
selected?: Array<string>;
|
|
@@ -99,6 +103,10 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
99
103
|
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
100
104
|
*/
|
|
101
105
|
mode?: ThemeModes;
|
|
106
|
+
/**
|
|
107
|
+
* Tab index indicates if the calendar can be focused by keyboard or only programmatically.
|
|
108
|
+
*/
|
|
109
|
+
tabIndex?: number;
|
|
102
110
|
}
|
|
103
111
|
export interface CalendarRef {
|
|
104
112
|
navigate: (type: ArrowKeys) => void;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"releaseModel": "scheduled",
|
|
20
20
|
"website": {
|
|
21
|
-
"name": "Calendar"
|
|
21
|
+
"name": "Calendar",
|
|
22
|
+
"category": "Components"
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
26
27
|
"@atlaskit/button": "^16.3.0",
|
|
27
|
-
"@atlaskit/ds-lib": "^
|
|
28
|
+
"@atlaskit/ds-lib": "^2.0.0",
|
|
28
29
|
"@atlaskit/icon": "^21.10.0",
|
|
29
30
|
"@atlaskit/locale": "^2.3.0",
|
|
30
31
|
"@atlaskit/theme": "^12.1.0",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@atlaskit/docs": "*",
|
|
43
|
-
"@atlaskit/select": "^15.
|
|
44
|
+
"@atlaskit/select": "^15.3.0",
|
|
44
45
|
"@atlaskit/ssr": "*",
|
|
45
46
|
"@atlaskit/visual-regression": "*",
|
|
46
47
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"import-structure": "atlassian-conventions"
|
|
61
62
|
},
|
|
62
63
|
"@repo/internal": {
|
|
64
|
+
"dom-events": "use-bind-event-listener",
|
|
63
65
|
"ui-components": "lite-mode",
|
|
64
66
|
"analytics": "analytics-next",
|
|
65
67
|
"theming": "tokens",
|
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
|
+
```
|