@atlaskit/calendar 12.1.14 → 12.3.1
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 +24 -0
- package/codemods/{11.0.0-lite-mode.ts → 11.0.0-lite-mode.tsx} +0 -0
- package/codemods/__tests__/{11.0.0-lite-mode.ts → 11.0.0-lite-mode.tsx} +0 -0
- package/codemods/migrations/{flatten-certain-inner-props-as-prop.ts → flatten-certain-inner-props-as-prop.tsx} +0 -0
- package/codemods/migrations/{remove-inner-props.ts → remove-inner-props.tsx} +0 -0
- package/codemods/{utils.ts → utils.tsx} +0 -0
- package/dist/cjs/calendar.js +21 -5
- package/dist/cjs/internal/components/date.js +2 -1
- package/dist/cjs/internal/components/heading.js +12 -5
- package/dist/cjs/internal/components/week-days.js +2 -1
- package/dist/cjs/internal/components/week-header.js +2 -1
- package/dist/cjs/internal/hooks/use-calendar-ref.js +1 -0
- package/dist/cjs/internal/hooks/use-controlled-date-state.js +1 -0
- package/dist/cjs/internal/hooks/use-focusing.js +1 -0
- package/dist/cjs/internal/hooks/use-get-weeks.js +2 -1
- package/dist/cjs/internal/hooks/use-handle-date-change.js +2 -1
- package/dist/cjs/internal/hooks/use-handle-date-select.js +1 -0
- package/dist/cjs/internal/hooks/use-locale.js +1 -0
- package/dist/cjs/internal/hooks/use-unique-id.js +1 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/calendar.js +20 -5
- package/dist/es2019/internal/components/date.js +2 -1
- package/dist/es2019/internal/components/heading.js +10 -5
- package/dist/es2019/internal/components/week-days.js +2 -1
- package/dist/es2019/internal/components/week-header.js +2 -1
- package/dist/es2019/internal/hooks/use-calendar-ref.js +1 -0
- package/dist/es2019/internal/hooks/use-controlled-date-state.js +2 -1
- package/dist/es2019/internal/hooks/use-focusing.js +2 -1
- package/dist/es2019/internal/hooks/use-get-weeks.js +2 -1
- package/dist/es2019/internal/hooks/use-handle-date-change.js +2 -1
- package/dist/es2019/internal/hooks/use-handle-date-select.js +2 -1
- package/dist/es2019/internal/hooks/use-locale.js +1 -0
- package/dist/es2019/internal/hooks/use-unique-id.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/calendar.js +21 -5
- package/dist/esm/internal/components/date.js +2 -1
- package/dist/esm/internal/components/heading.js +12 -5
- package/dist/esm/internal/components/week-days.js +2 -1
- package/dist/esm/internal/components/week-header.js +2 -1
- package/dist/esm/internal/hooks/use-calendar-ref.js +1 -0
- package/dist/esm/internal/hooks/use-controlled-date-state.js +2 -1
- package/dist/esm/internal/hooks/use-focusing.js +2 -1
- package/dist/esm/internal/hooks/use-get-weeks.js +2 -1
- package/dist/esm/internal/hooks/use-handle-date-change.js +2 -1
- package/dist/esm/internal/hooks/use-handle-date-select.js +2 -1
- package/dist/esm/internal/hooks/use-locale.js +1 -0
- package/dist/esm/internal/hooks/use-unique-id.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/calendar.d.ts +10 -1
- package/dist/types/internal/components/date.d.ts +2 -2
- package/dist/types/internal/components/heading.d.ts +4 -2
- package/dist/types/internal/components/week-days.d.ts +2 -2
- package/dist/types/internal/components/week-header.d.ts +2 -2
- package/dist/types/types.d.ts +83 -29
- package/package.json +10 -7
- package/report.api.md +175 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/calendar
|
|
2
2
|
|
|
3
|
+
## 12.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`124a1b7532b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/124a1b7532b) - Remove calendar's background when design tokens are provided, to allow calendar to match the color of any surface in light or dark mode
|
|
8
|
+
- [`6bf81ead961`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6bf81ead961) - Internal code change turning on new linting rules.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 12.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`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.
|
|
16
|
+
|
|
17
|
+
## 12.2.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`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`
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 12.1.14
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cjs/calendar.js
CHANGED
|
@@ -59,7 +59,7 @@ var lightWrapperStyles = (0, _core.css)({
|
|
|
59
59
|
display: 'inline-block',
|
|
60
60
|
boxSizing: 'border-box',
|
|
61
61
|
padding: 16,
|
|
62
|
-
backgroundColor: "var(--ds-
|
|
62
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.N0, ")"),
|
|
63
63
|
color: "var(--ds-text, ".concat(_colors.N900, ")"),
|
|
64
64
|
outline: 'none',
|
|
65
65
|
userSelect: 'none'
|
|
@@ -68,7 +68,7 @@ var darkWrapperStyles = (0, _core.css)({
|
|
|
68
68
|
display: 'inline-block',
|
|
69
69
|
boxSizing: 'border-box',
|
|
70
70
|
padding: 16,
|
|
71
|
-
backgroundColor: "var(--ds-
|
|
71
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.N700, ")"),
|
|
72
72
|
color: "var(--ds-text, ".concat(_colors.DN600, ")"),
|
|
73
73
|
outline: 'none',
|
|
74
74
|
userSelect: 'none'
|
|
@@ -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.1
|
|
86
|
+
packageVersion: "12.3.1"
|
|
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,
|
|
@@ -266,6 +272,16 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
266
272
|
testId: testId
|
|
267
273
|
}))));
|
|
268
274
|
});
|
|
275
|
+
/**
|
|
276
|
+
* __Calendar__
|
|
277
|
+
*
|
|
278
|
+
* A calendar is used for date selection.
|
|
279
|
+
*
|
|
280
|
+
* - [Examples](https://atlassian.design/components/calendar/examples)
|
|
281
|
+
* - [Code](https://atlassian.design/components/calendar/code)
|
|
282
|
+
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
283
|
+
*/
|
|
284
|
+
|
|
269
285
|
var Calendar = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Calendar(props, ref) {
|
|
270
286
|
return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
|
|
271
287
|
var mode = _ref2.mode;
|
|
@@ -86,6 +86,7 @@ var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
86
86
|
"data-testid": testId && isSelected ? "".concat(testId, "--selected-day") : undefined
|
|
87
87
|
}, day);
|
|
88
88
|
}));
|
|
89
|
-
Date.displayName = 'Date';
|
|
89
|
+
Date.displayName = 'Date'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
90
|
+
|
|
90
91
|
var _default = Date;
|
|
91
92
|
exports.default = _default;
|
|
@@ -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,12 +88,14 @@ 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
|
});
|
|
92
|
-
Heading.displayName = 'Heading';
|
|
98
|
+
Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
99
|
+
|
|
93
100
|
var _default = Heading;
|
|
94
101
|
exports.default = _default;
|
|
@@ -50,6 +50,7 @@ var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
|
|
|
50
50
|
}));
|
|
51
51
|
}));
|
|
52
52
|
});
|
|
53
|
-
WeekDays.displayName = 'WeekDays';
|
|
53
|
+
WeekDays.displayName = 'WeekDays'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
54
|
+
|
|
54
55
|
var _default = WeekDays;
|
|
55
56
|
exports.default = _default;
|
|
@@ -40,6 +40,7 @@ var WeekHeader = /*#__PURE__*/(0, _react.memo)(function WeekHeader(_ref) {
|
|
|
40
40
|
}, shortDay);
|
|
41
41
|
}));
|
|
42
42
|
});
|
|
43
|
-
WeekHeader.displayName = 'WeekHeader';
|
|
43
|
+
WeekHeader.displayName = 'WeekHeader'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
44
|
+
|
|
44
45
|
var _default = WeekHeader;
|
|
45
46
|
exports.default = _default;
|
|
@@ -7,6 +7,7 @@ exports.default = useCalendarRef;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
10
11
|
function useCalendarRef(calendarRef, _ref) {
|
|
11
12
|
var navigate = _ref.navigate;
|
|
12
13
|
(0, _react.useImperativeHandle)(calendarRef, function () {
|
|
@@ -15,6 +15,7 @@ var _useLazyRef2 = _interopRequireDefault(require("@atlaskit/ds-lib/use-lazy-ref
|
|
|
15
15
|
|
|
16
16
|
var _pad = _interopRequireDefault(require("../utils/pad"));
|
|
17
17
|
|
|
18
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
18
19
|
function useControlledDateState(_ref) {
|
|
19
20
|
var day = _ref.day,
|
|
20
21
|
defaultDay = _ref.defaultDay,
|
|
@@ -47,7 +47,8 @@ function useGetCalendarWithSixthWeek(calendar, _ref) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}, [calendarLastValue, month, shouldDisplaySixthWeek, weekStartDay, year]);
|
|
50
|
-
}
|
|
50
|
+
} // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
51
|
+
|
|
51
52
|
|
|
52
53
|
function useGetWeeks(_ref2) {
|
|
53
54
|
var day = _ref2.day,
|
|
@@ -55,7 +55,8 @@ var getPrevMonth = function getPrevMonth(monthValue, yearValue) {
|
|
|
55
55
|
month: month,
|
|
56
56
|
year: year
|
|
57
57
|
};
|
|
58
|
-
};
|
|
58
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
59
|
+
|
|
59
60
|
|
|
60
61
|
function useHandleDateChange(_ref) {
|
|
61
62
|
var _ref$day = (0, _slicedToArray2.default)(_ref.day, 2),
|
|
@@ -15,6 +15,7 @@ var _constants = require("../constants");
|
|
|
15
15
|
|
|
16
16
|
var _dateToString = _interopRequireDefault(require("../utils/date-to-string"));
|
|
17
17
|
|
|
18
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
18
19
|
function useHandleDateSelect(_ref) {
|
|
19
20
|
var _ref$day = (0, _slicedToArray2.default)(_ref.day, 1),
|
|
20
21
|
dayValue = _ref$day[0],
|
|
@@ -7,6 +7,7 @@ exports.default = useUniqueId;
|
|
|
7
7
|
|
|
8
8
|
var _reactUid = require("react-uid");
|
|
9
9
|
|
|
10
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
10
11
|
function useUniqueId(prefix) {
|
|
11
12
|
var seed = (0, _reactUid.useUIDSeed)();
|
|
12
13
|
return "".concat(prefix, "-").concat(seed(prefix));
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/calendar.js
CHANGED
|
@@ -24,7 +24,7 @@ const lightWrapperStyles = css({
|
|
|
24
24
|
display: 'inline-block',
|
|
25
25
|
boxSizing: 'border-box',
|
|
26
26
|
padding: 16,
|
|
27
|
-
backgroundColor: `var(--ds-
|
|
27
|
+
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${N0})`,
|
|
28
28
|
color: `var(--ds-text, ${N900})`,
|
|
29
29
|
outline: 'none',
|
|
30
30
|
userSelect: 'none'
|
|
@@ -33,7 +33,7 @@ const darkWrapperStyles = css({
|
|
|
33
33
|
display: 'inline-block',
|
|
34
34
|
boxSizing: 'border-box',
|
|
35
35
|
padding: 16,
|
|
36
|
-
backgroundColor: `var(--ds-
|
|
36
|
+
backgroundColor: `var(--ds-UNSAFE_util-transparent, ${N700})`,
|
|
37
37
|
color: `var(--ds-text, ${DN600})`,
|
|
38
38
|
outline: 'none',
|
|
39
39
|
userSelect: 'none'
|
|
@@ -48,7 +48,7 @@ const gridsContainerStyles = css({
|
|
|
48
48
|
const analyticsAttributes = {
|
|
49
49
|
componentName: 'calendar',
|
|
50
50
|
packageName: "@atlaskit/calendar",
|
|
51
|
-
packageVersion: "12.1
|
|
51
|
+
packageVersion: "12.3.1"
|
|
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,
|
|
@@ -206,6 +211,16 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
206
211
|
testId: testId
|
|
207
212
|
}))));
|
|
208
213
|
});
|
|
214
|
+
/**
|
|
215
|
+
* __Calendar__
|
|
216
|
+
*
|
|
217
|
+
* A calendar is used for date selection.
|
|
218
|
+
*
|
|
219
|
+
* - [Examples](https://atlassian.design/components/calendar/examples)
|
|
220
|
+
* - [Code](https://atlassian.design/components/calendar/code)
|
|
221
|
+
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
222
|
+
*/
|
|
223
|
+
|
|
209
224
|
const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
210
225
|
return jsx(GlobalTheme.Consumer, null, ({
|
|
211
226
|
mode
|
|
@@ -66,5 +66,6 @@ const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
|
|
|
66
66
|
"data-testid": testId && isSelected ? `${testId}--selected-day` : undefined
|
|
67
67
|
}, day);
|
|
68
68
|
}));
|
|
69
|
-
Date.displayName = 'Date';
|
|
69
|
+
Date.displayName = 'Date'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
70
|
+
|
|
70
71
|
export default Date;
|
|
@@ -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,11 +67,13 @@ 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
|
});
|
|
73
|
-
Heading.displayName = 'Heading';
|
|
77
|
+
Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
78
|
+
|
|
74
79
|
export default Heading;
|
|
@@ -35,5 +35,6 @@ const WeekDays = /*#__PURE__*/memo(function WeekDays({
|
|
|
35
35
|
testId: testId
|
|
36
36
|
}, weekDay.day)))));
|
|
37
37
|
});
|
|
38
|
-
WeekDays.displayName = 'WeekDays';
|
|
38
|
+
WeekDays.displayName = 'WeekDays'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
39
|
+
|
|
39
40
|
export default WeekDays;
|
|
@@ -29,5 +29,6 @@ const WeekHeader = /*#__PURE__*/memo(function WeekHeader({
|
|
|
29
29
|
key: shortDay
|
|
30
30
|
}, shortDay)));
|
|
31
31
|
});
|
|
32
|
-
WeekHeader.displayName = 'WeekHeader';
|
|
32
|
+
WeekHeader.displayName = 'WeekHeader'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
33
|
+
|
|
33
34
|
export default WeekHeader;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import useControlled from '@atlaskit/ds-lib/use-controlled';
|
|
2
2
|
import useLazyRef from '@atlaskit/ds-lib/use-lazy-ref';
|
|
3
|
-
import pad from '../utils/pad';
|
|
3
|
+
import pad from '../utils/pad'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
4
|
+
|
|
4
5
|
export default function useControlledDateState({
|
|
5
6
|
day,
|
|
6
7
|
defaultDay,
|
|
@@ -26,7 +26,8 @@ function useGetCalendarWithSixthWeek(calendar, {
|
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
28
|
}, [calendarLastValue, month, shouldDisplaySixthWeek, weekStartDay, year]);
|
|
29
|
-
}
|
|
29
|
+
} // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
30
|
+
|
|
30
31
|
|
|
31
32
|
export default function useGetWeeks({
|
|
32
33
|
day,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import { arrowKeys } from '../constants';
|
|
3
|
-
import dateToString from '../utils/date-to-string';
|
|
3
|
+
import dateToString from '../utils/date-to-string'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
4
|
+
|
|
4
5
|
export default function useHandleDateSelect({
|
|
5
6
|
day: [dayValue],
|
|
6
7
|
month: [monthValue],
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/calendar.js
CHANGED
|
@@ -30,7 +30,7 @@ var lightWrapperStyles = css({
|
|
|
30
30
|
display: 'inline-block',
|
|
31
31
|
boxSizing: 'border-box',
|
|
32
32
|
padding: 16,
|
|
33
|
-
backgroundColor: "var(--ds-
|
|
33
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(N0, ")"),
|
|
34
34
|
color: "var(--ds-text, ".concat(N900, ")"),
|
|
35
35
|
outline: 'none',
|
|
36
36
|
userSelect: 'none'
|
|
@@ -39,7 +39,7 @@ var darkWrapperStyles = css({
|
|
|
39
39
|
display: 'inline-block',
|
|
40
40
|
boxSizing: 'border-box',
|
|
41
41
|
padding: 16,
|
|
42
|
-
backgroundColor: "var(--ds-
|
|
42
|
+
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(N700, ")"),
|
|
43
43
|
color: "var(--ds-text, ".concat(DN600, ")"),
|
|
44
44
|
outline: 'none',
|
|
45
45
|
userSelect: 'none'
|
|
@@ -54,7 +54,7 @@ var gridsContainerStyles = css({
|
|
|
54
54
|
var analyticsAttributes = {
|
|
55
55
|
componentName: 'calendar',
|
|
56
56
|
packageName: "@atlaskit/calendar",
|
|
57
|
-
packageVersion: "12.1
|
|
57
|
+
packageVersion: "12.3.1"
|
|
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,
|
|
@@ -237,6 +243,16 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
237
243
|
testId: testId
|
|
238
244
|
}))));
|
|
239
245
|
});
|
|
246
|
+
/**
|
|
247
|
+
* __Calendar__
|
|
248
|
+
*
|
|
249
|
+
* A calendar is used for date selection.
|
|
250
|
+
*
|
|
251
|
+
* - [Examples](https://atlassian.design/components/calendar/examples)
|
|
252
|
+
* - [Code](https://atlassian.design/components/calendar/code)
|
|
253
|
+
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
254
|
+
*/
|
|
255
|
+
|
|
240
256
|
var Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
241
257
|
return jsx(GlobalTheme.Consumer, null, function (_ref2) {
|
|
242
258
|
var mode = _ref2.mode;
|
|
@@ -73,5 +73,6 @@ var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref, ref) {
|
|
|
73
73
|
"data-testid": testId && isSelected ? "".concat(testId, "--selected-day") : undefined
|
|
74
74
|
}, day);
|
|
75
75
|
}));
|
|
76
|
-
Date.displayName = 'Date';
|
|
76
|
+
Date.displayName = 'Date'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
77
|
+
|
|
77
78
|
export default Date;
|
|
@@ -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,11 +73,13 @@ 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
|
});
|
|
77
|
-
Heading.displayName = 'Heading';
|
|
83
|
+
Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
84
|
+
|
|
78
85
|
export default Heading;
|