@atlaskit/calendar 13.3.2 → 14.0.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 +12 -0
- package/dist/cjs/calendar.js +5 -15
- package/dist/cjs/internal/components/date.js +24 -27
- package/dist/cjs/internal/components/week-days.js +0 -2
- package/dist/cjs/internal/hooks/use-handle-date-change.js +1 -1
- package/dist/cjs/internal/styles/date.js +9 -35
- package/dist/es2019/calendar.js +4 -12
- package/dist/es2019/internal/components/date.js +3 -4
- package/dist/es2019/internal/components/week-days.js +0 -2
- package/dist/es2019/internal/hooks/use-handle-date-change.js +1 -1
- package/dist/es2019/internal/styles/date.js +11 -36
- package/dist/esm/calendar.js +5 -15
- package/dist/esm/internal/components/date.js +25 -28
- package/dist/esm/internal/components/week-days.js +0 -2
- package/dist/esm/internal/hooks/use-handle-date-change.js +1 -1
- package/dist/esm/internal/styles/date.js +10 -36
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types/internal/components/date.d.ts +0 -2
- package/dist/types/internal/components/header.d.ts +0 -2
- package/dist/types/internal/components/week-days.d.ts +0 -2
- package/dist/types/internal/components/week-header.d.ts +0 -2
- package/dist/types/internal/hooks/use-handle-date-change.d.ts +1 -1
- package/dist/types/internal/styles/date.d.ts +1 -2
- package/dist/types/types.d.ts +0 -5
- package/dist/types-ts4.5/calendar.d.ts +1 -1
- package/dist/types-ts4.5/internal/components/date.d.ts +0 -2
- package/dist/types-ts4.5/internal/components/header.d.ts +0 -2
- package/dist/types-ts4.5/internal/components/week-days.d.ts +0 -2
- package/dist/types-ts4.5/internal/components/week-header.d.ts +0 -2
- package/dist/types-ts4.5/internal/hooks/use-handle-date-change.d.ts +1 -1
- package/dist/types-ts4.5/internal/styles/date.d.ts +1 -2
- package/dist/types-ts4.5/types.d.ts +0 -5
- package/package.json +5 -5
- package/report.api.md +0 -4
- package/tmp/api-report-tmp.d.ts +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/calendar
|
|
2
2
|
|
|
3
|
+
## 14.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#41791](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41791) [`ec7c2a38247`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ec7c2a38247) - Removed all remaining legacy theming logic from the Calendar, Form, InlineDialog, InlineEdit and InlineMessage components.
|
|
8
|
+
|
|
9
|
+
## 13.3.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42445](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42445) [`5645b5a1132`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5645b5a1132) - Fix TS errors for forge-ui in AFM
|
|
14
|
+
|
|
3
15
|
## 13.3.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/calendar.js
CHANGED
|
@@ -13,7 +13,6 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
|
|
14
14
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
15
15
|
var _primitives = require("@atlaskit/primitives");
|
|
16
|
-
var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
|
|
17
16
|
var _header = _interopRequireDefault(require("./internal/components/header"));
|
|
18
17
|
var _weekDays = _interopRequireDefault(require("./internal/components/week-days"));
|
|
19
18
|
var _weekHeader = _interopRequireDefault(require("./internal/components/week-header"));
|
|
@@ -35,9 +34,9 @@ var boxStyles = (0, _primitives.xcss)({
|
|
|
35
34
|
var analyticsAttributes = {
|
|
36
35
|
componentName: 'calendar',
|
|
37
36
|
packageName: "@atlaskit/calendar",
|
|
38
|
-
packageVersion: "
|
|
37
|
+
packageVersion: "14.0.0"
|
|
39
38
|
};
|
|
40
|
-
var
|
|
39
|
+
var InnerCalendar = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
|
|
41
40
|
var day = _ref.day,
|
|
42
41
|
_ref$defaultDay = _ref.defaultDay,
|
|
43
42
|
defaultDay = _ref$defaultDay === void 0 ? 0 : _ref$defaultDay,
|
|
@@ -75,8 +74,6 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
75
74
|
weekStartDay = _ref$weekStartDay === void 0 ? 0 : _ref$weekStartDay,
|
|
76
75
|
testId = _ref.testId,
|
|
77
76
|
calendarRef = _ref.calendarRef,
|
|
78
|
-
_ref$mode = _ref.mode,
|
|
79
|
-
mode = _ref$mode === void 0 ? 'light' : _ref$mode,
|
|
80
77
|
className = _ref.className,
|
|
81
78
|
style = _ref.style,
|
|
82
79
|
_ref$tabIndex = _ref.tabIndex,
|
|
@@ -218,7 +215,6 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
218
215
|
handleClickNext: handleClickNext,
|
|
219
216
|
handleClickPrev: handleClickPrev,
|
|
220
217
|
headerId: headerId,
|
|
221
|
-
mode: mode,
|
|
222
218
|
tabIndex: tabIndex,
|
|
223
219
|
testId: testId
|
|
224
220
|
}), (0, _react2.jsx)(_primitives.Box, {
|
|
@@ -229,12 +225,10 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
229
225
|
testId: testId && "".concat(testId, "--calendar-dates")
|
|
230
226
|
}, (0, _react2.jsx)(_weekHeader.default, {
|
|
231
227
|
daysShort: daysShort,
|
|
232
|
-
mode: mode,
|
|
233
228
|
testId: testId
|
|
234
229
|
}), (0, _react2.jsx)(_weekDays.default, {
|
|
235
230
|
weeks: weeks,
|
|
236
231
|
handleClickDay: handleClickDay,
|
|
237
|
-
mode: mode,
|
|
238
232
|
monthsLong: monthsLong,
|
|
239
233
|
shouldSetFocus: shouldSetFocus,
|
|
240
234
|
tabIndex: tabIndex,
|
|
@@ -252,13 +246,9 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
252
246
|
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
253
247
|
*/
|
|
254
248
|
var Calendar = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Calendar(props, ref) {
|
|
255
|
-
return (0, _react2.jsx)(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
mode: mode,
|
|
259
|
-
ref: ref
|
|
260
|
-
}));
|
|
261
|
-
});
|
|
249
|
+
return (0, _react2.jsx)(InnerCalendar, (0, _extends2.default)({}, props, {
|
|
250
|
+
ref: ref
|
|
251
|
+
}));
|
|
262
252
|
}));
|
|
263
253
|
Calendar.displayName = 'Calendar';
|
|
264
254
|
var _default = exports.default = Calendar;
|
|
@@ -12,30 +12,29 @@ var _primitives = require("@atlaskit/primitives");
|
|
|
12
12
|
var _date = require("../styles/date");
|
|
13
13
|
/** @jsx jsx */
|
|
14
14
|
|
|
15
|
-
var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Date(
|
|
16
|
-
var day =
|
|
17
|
-
|
|
18
|
-
isDisabled =
|
|
19
|
-
|
|
20
|
-
isFocused =
|
|
21
|
-
|
|
22
|
-
isToday =
|
|
23
|
-
dayLong =
|
|
24
|
-
month =
|
|
25
|
-
monthLong =
|
|
26
|
-
|
|
27
|
-
onClick =
|
|
28
|
-
|
|
29
|
-
isPreviouslySelected =
|
|
30
|
-
|
|
31
|
-
isSelected =
|
|
32
|
-
|
|
33
|
-
isSibling =
|
|
34
|
-
year =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
testId = _ref.testId;
|
|
15
|
+
var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Date(_ref2, _ref) {
|
|
16
|
+
var day = _ref2.children,
|
|
17
|
+
_ref2$isDisabled = _ref2.isDisabled,
|
|
18
|
+
isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
|
|
19
|
+
_ref2$isFocused = _ref2.isFocused,
|
|
20
|
+
isFocused = _ref2$isFocused === void 0 ? false : _ref2$isFocused,
|
|
21
|
+
_ref2$isToday = _ref2.isToday,
|
|
22
|
+
isToday = _ref2$isToday === void 0 ? false : _ref2$isToday,
|
|
23
|
+
dayLong = _ref2.dayLong,
|
|
24
|
+
month = _ref2.month,
|
|
25
|
+
monthLong = _ref2.monthLong,
|
|
26
|
+
_ref2$onClick = _ref2.onClick,
|
|
27
|
+
onClick = _ref2$onClick === void 0 ? _noop.default : _ref2$onClick,
|
|
28
|
+
_ref2$isPreviouslySel = _ref2.isPreviouslySelected,
|
|
29
|
+
isPreviouslySelected = _ref2$isPreviouslySel === void 0 ? false : _ref2$isPreviouslySel,
|
|
30
|
+
_ref2$isSelected = _ref2.isSelected,
|
|
31
|
+
isSelected = _ref2$isSelected === void 0 ? false : _ref2$isSelected,
|
|
32
|
+
_ref2$isSibling = _ref2.isSibling,
|
|
33
|
+
isSibling = _ref2$isSibling === void 0 ? false : _ref2$isSibling,
|
|
34
|
+
year = _ref2.year,
|
|
35
|
+
shouldSetFocus = _ref2.shouldSetFocus,
|
|
36
|
+
tabIndex = _ref2.tabIndex,
|
|
37
|
+
testId = _ref2.testId;
|
|
39
38
|
var dateRef = (0, _react.useRef)({
|
|
40
39
|
day: day,
|
|
41
40
|
month: month,
|
|
@@ -70,9 +69,7 @@ var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
71
|
}, [onClick]);
|
|
73
|
-
var dateCellStyles = (0,
|
|
74
|
-
return (0, _react2.css)((0, _date.dateCellStyles)(mode));
|
|
75
|
-
}, [mode]);
|
|
72
|
+
var dateCellStyles = (0, _react2.css)((0, _date.dateCellStyles)());
|
|
76
73
|
return (0, _react2.jsx)(_primitives.Grid, {
|
|
77
74
|
role: "gridcell",
|
|
78
75
|
alignItems: "center"
|
|
@@ -15,7 +15,6 @@ var _weekDayGrid = _interopRequireDefault(require("./week-day-grid"));
|
|
|
15
15
|
var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
|
|
16
16
|
var weeks = _ref.weeks,
|
|
17
17
|
handleClickDay = _ref.handleClickDay,
|
|
18
|
-
mode = _ref.mode,
|
|
19
18
|
monthsLong = _ref.monthsLong,
|
|
20
19
|
shouldSetFocus = _ref.shouldSetFocus,
|
|
21
20
|
tabIndex = _ref.tabIndex,
|
|
@@ -41,7 +40,6 @@ var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
|
|
|
41
40
|
isSelected: weekDay.isSelected,
|
|
42
41
|
isSibling: weekDay.isSiblingMonth,
|
|
43
42
|
year: weekDay.year,
|
|
44
|
-
mode: mode,
|
|
45
43
|
shouldSetFocus: shouldSetFocus,
|
|
46
44
|
tabIndex: tabIndex,
|
|
47
45
|
testId: testId
|
|
@@ -54,7 +54,7 @@ function useHandleDateChange(_ref) {
|
|
|
54
54
|
yearValue = _ref$year[0],
|
|
55
55
|
setYearValue = _ref$year[1],
|
|
56
56
|
_ref$shouldSetFocus = (0, _slicedToArray2.default)(_ref.shouldSetFocus, 2),
|
|
57
|
-
|
|
57
|
+
_shouldSetFocus = _ref$shouldSetFocus[0],
|
|
58
58
|
setShouldSetFocus = _ref$shouldSetFocus[1],
|
|
59
59
|
onChange = _ref.onChange;
|
|
60
60
|
var dateRef = (0, _react.useRef)({
|
|
@@ -5,33 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dateCellStyles = void 0;
|
|
7
7
|
var _colors = require("@atlaskit/theme/colors");
|
|
8
|
-
var textColor = {
|
|
9
|
-
light: "var(--ds-text, ".concat(_colors.N900, ")"),
|
|
10
|
-
dark: "var(--ds-text, ".concat(_colors.DN600, ")")
|
|
11
|
-
};
|
|
12
|
-
var textColorMedium = "var(--ds-text-subtle, ".concat(_colors.N600, ")");
|
|
13
|
-
var todayColor = {
|
|
14
|
-
light: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
|
|
15
|
-
dark: "var(--ds-text-selected, ".concat(_colors.B100, ")")
|
|
16
|
-
};
|
|
17
|
-
var hoverBackground = {
|
|
18
|
-
light: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")"),
|
|
19
|
-
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N800, ")")
|
|
20
|
-
};
|
|
21
|
-
var textSelected = {
|
|
22
|
-
light: "var(--ds-text-selected, ".concat(_colors.N0, ")"),
|
|
23
|
-
dark: "var(--ds-text-selected, ".concat(_colors.N700, ")")
|
|
24
|
-
};
|
|
25
|
-
var selectedBackground = {
|
|
26
|
-
light: "var(--ds-background-selected, ".concat(_colors.N500, ")"),
|
|
27
|
-
dark: "var(--ds-background-selected, ".concat(_colors.N0, ")")
|
|
28
|
-
};
|
|
29
|
-
var borderColorFocused = {
|
|
30
|
-
light: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
|
|
31
|
-
dark: "var(--ds-border-focused, ".concat(_colors.B100, ")")
|
|
32
|
-
};
|
|
33
8
|
var dateCellStyles = exports.dateCellStyles = function dateCellStyles() {
|
|
34
|
-
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
|
|
35
9
|
return {
|
|
36
10
|
all: 'unset',
|
|
37
11
|
display: 'block',
|
|
@@ -40,7 +14,7 @@ var dateCellStyles = exports.dateCellStyles = function dateCellStyles() {
|
|
|
40
14
|
backgroundColor: 'transparent',
|
|
41
15
|
border: '2px solid transparent',
|
|
42
16
|
borderRadius: 3,
|
|
43
|
-
color:
|
|
17
|
+
color: "var(--ds-text, ".concat(_colors.N900, ")"),
|
|
44
18
|
cursor: 'pointer',
|
|
45
19
|
flexGrow: 1,
|
|
46
20
|
fontSize: "var(--ds-font-size-100, 14px)",
|
|
@@ -49,7 +23,7 @@ var dateCellStyles = exports.dateCellStyles = function dateCellStyles() {
|
|
|
49
23
|
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
|
50
24
|
},
|
|
51
25
|
'&[data-today]': {
|
|
52
|
-
color:
|
|
26
|
+
color: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
|
|
53
27
|
fontWeight: "var(--ds-font-weight-bold, bold)",
|
|
54
28
|
'&::after': {
|
|
55
29
|
display: 'block',
|
|
@@ -67,30 +41,30 @@ var dateCellStyles = exports.dateCellStyles = function dateCellStyles() {
|
|
|
67
41
|
color: "var(--ds-text-subtle, ".concat(_colors.N600, ")")
|
|
68
42
|
},
|
|
69
43
|
'&[data-selected]': {
|
|
70
|
-
backgroundColor:
|
|
71
|
-
color:
|
|
44
|
+
backgroundColor: "var(--ds-background-selected, ".concat(_colors.N500, ")"),
|
|
45
|
+
color: "var(--ds-text-selected, ".concat(_colors.N0, ")")
|
|
72
46
|
},
|
|
73
47
|
'&[data-disabled]': {
|
|
74
48
|
color: "var(--ds-text-disabled, ".concat(_colors.N40, ")"),
|
|
75
49
|
cursor: 'not-allowed'
|
|
76
50
|
},
|
|
77
51
|
'&:focus-visible': {
|
|
78
|
-
border: "2px solid ".concat(
|
|
52
|
+
border: "2px solid ".concat("var(--ds-border-focused, ".concat(_colors.B200, ")"))
|
|
79
53
|
},
|
|
80
54
|
'&:hover': {
|
|
81
|
-
backgroundColor:
|
|
82
|
-
color:
|
|
55
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N30, ")"),
|
|
56
|
+
color: "var(--ds-text, ".concat(_colors.N900, ")")
|
|
83
57
|
},
|
|
84
58
|
'&:active': {
|
|
85
59
|
backgroundColor: "var(--ds-background-neutral-subtle-pressed, ".concat(_colors.B50, ")"),
|
|
86
|
-
color:
|
|
60
|
+
color: "var(--ds-text, ".concat(_colors.N900, ")")
|
|
87
61
|
},
|
|
88
62
|
'&[data-selected]:hover': {
|
|
89
63
|
backgroundColor: "var(--ds-background-selected-hovered, ".concat(_colors.B50, ")"),
|
|
90
64
|
color: "var(--ds-text-selected, ".concat(_colors.N600, ")")
|
|
91
65
|
},
|
|
92
66
|
'&[data-prev-selected]:hover': {
|
|
93
|
-
color:
|
|
67
|
+
color: "var(--ds-text-subtle, ".concat(_colors.N600, ")")
|
|
94
68
|
},
|
|
95
69
|
'&[data-sibling]:hover': {
|
|
96
70
|
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
package/dist/es2019/calendar.js
CHANGED
|
@@ -5,7 +5,6 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
6
6
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
7
|
import { Box, Stack, xcss } from '@atlaskit/primitives';
|
|
8
|
-
import GlobalTheme from '@atlaskit/theme/components';
|
|
9
8
|
import Header from './internal/components/header';
|
|
10
9
|
import WeekDaysComponent from './internal/components/week-days';
|
|
11
10
|
import WeekHeaderComponent from './internal/components/week-header';
|
|
@@ -25,9 +24,9 @@ const boxStyles = xcss({
|
|
|
25
24
|
const analyticsAttributes = {
|
|
26
25
|
componentName: 'calendar',
|
|
27
26
|
packageName: "@atlaskit/calendar",
|
|
28
|
-
packageVersion: "
|
|
27
|
+
packageVersion: "14.0.0"
|
|
29
28
|
};
|
|
30
|
-
const
|
|
29
|
+
const InnerCalendar = /*#__PURE__*/forwardRef(function Calendar({
|
|
31
30
|
day,
|
|
32
31
|
defaultDay = 0,
|
|
33
32
|
defaultMonth = 0,
|
|
@@ -54,7 +53,6 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
54
53
|
weekStartDay = 0,
|
|
55
54
|
testId,
|
|
56
55
|
calendarRef,
|
|
57
|
-
mode = 'light',
|
|
58
56
|
className,
|
|
59
57
|
style,
|
|
60
58
|
tabIndex = 0
|
|
@@ -189,7 +187,6 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
189
187
|
handleClickNext: handleClickNext,
|
|
190
188
|
handleClickPrev: handleClickPrev,
|
|
191
189
|
headerId: headerId,
|
|
192
|
-
mode: mode,
|
|
193
190
|
tabIndex: tabIndex,
|
|
194
191
|
testId: testId
|
|
195
192
|
}), jsx(Box, {
|
|
@@ -200,12 +197,10 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
200
197
|
testId: testId && `${testId}--calendar-dates`
|
|
201
198
|
}, jsx(WeekHeaderComponent, {
|
|
202
199
|
daysShort: daysShort,
|
|
203
|
-
mode: mode,
|
|
204
200
|
testId: testId
|
|
205
201
|
}), jsx(WeekDaysComponent, {
|
|
206
202
|
weeks: weeks,
|
|
207
203
|
handleClickDay: handleClickDay,
|
|
208
|
-
mode: mode,
|
|
209
204
|
monthsLong: monthsLong,
|
|
210
205
|
shouldSetFocus: shouldSetFocus,
|
|
211
206
|
tabIndex: tabIndex,
|
|
@@ -223,12 +218,9 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
223
218
|
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
224
219
|
*/
|
|
225
220
|
const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
226
|
-
return jsx(
|
|
227
|
-
mode
|
|
228
|
-
}) => jsx(CalendarWithMode, _extends({}, props, {
|
|
229
|
-
mode: mode,
|
|
221
|
+
return jsx(InnerCalendar, _extends({}, props, {
|
|
230
222
|
ref: ref
|
|
231
|
-
}))
|
|
223
|
+
}));
|
|
232
224
|
}));
|
|
233
225
|
Calendar.displayName = 'Calendar';
|
|
234
226
|
export default Calendar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { forwardRef, memo, useCallback, useEffect,
|
|
2
|
+
import { forwardRef, memo, useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { Grid } from '@atlaskit/primitives';
|
|
@@ -17,11 +17,10 @@ const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
|
|
|
17
17
|
isSelected = false,
|
|
18
18
|
isSibling = false,
|
|
19
19
|
year,
|
|
20
|
-
mode,
|
|
21
20
|
shouldSetFocus,
|
|
22
21
|
tabIndex,
|
|
23
22
|
testId
|
|
24
|
-
},
|
|
23
|
+
}, _ref) {
|
|
25
24
|
const dateRef = useRef({
|
|
26
25
|
day,
|
|
27
26
|
month,
|
|
@@ -57,7 +56,7 @@ const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
|
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
}, [onClick]);
|
|
60
|
-
const dateCellStyles =
|
|
59
|
+
const dateCellStyles = css(getDateCellStyles());
|
|
61
60
|
return jsx(Grid, {
|
|
62
61
|
role: "gridcell",
|
|
63
62
|
alignItems: "center"
|
|
@@ -7,7 +7,6 @@ import WeekdayGrid from './week-day-grid';
|
|
|
7
7
|
const WeekDays = /*#__PURE__*/memo(function WeekDays({
|
|
8
8
|
weeks,
|
|
9
9
|
handleClickDay,
|
|
10
|
-
mode,
|
|
11
10
|
monthsLong,
|
|
12
11
|
shouldSetFocus,
|
|
13
12
|
tabIndex,
|
|
@@ -32,7 +31,6 @@ const WeekDays = /*#__PURE__*/memo(function WeekDays({
|
|
|
32
31
|
isSelected: weekDay.isSelected,
|
|
33
32
|
isSibling: weekDay.isSiblingMonth,
|
|
34
33
|
year: weekDay.year,
|
|
35
|
-
mode: mode,
|
|
36
34
|
shouldSetFocus: shouldSetFocus,
|
|
37
35
|
tabIndex: tabIndex,
|
|
38
36
|
testId: testId
|
|
@@ -36,7 +36,7 @@ export default function useHandleDateChange({
|
|
|
36
36
|
day: [dayValue, setDayValue],
|
|
37
37
|
month: [monthValue, setMonthValue],
|
|
38
38
|
year: [yearValue, setYearValue],
|
|
39
|
-
shouldSetFocus: [
|
|
39
|
+
shouldSetFocus: [_shouldSetFocus, setShouldSetFocus],
|
|
40
40
|
onChange
|
|
41
41
|
}) {
|
|
42
42
|
const dateRef = useRef({
|
|
@@ -1,30 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
light: `var(--ds-text, ${N900})`,
|
|
4
|
-
dark: `var(--ds-text, ${DN600})`
|
|
5
|
-
};
|
|
6
|
-
const textColorMedium = `var(--ds-text-subtle, ${N600})`;
|
|
7
|
-
const todayColor = {
|
|
8
|
-
light: `var(--ds-text-selected, ${B400})`,
|
|
9
|
-
dark: `var(--ds-text-selected, ${B100})`
|
|
10
|
-
};
|
|
11
|
-
const hoverBackground = {
|
|
12
|
-
light: `var(--ds-background-neutral-subtle-hovered, ${N30})`,
|
|
13
|
-
dark: `var(--ds-background-neutral-subtle-hovered, ${N800})`
|
|
14
|
-
};
|
|
15
|
-
const textSelected = {
|
|
16
|
-
light: `var(--ds-text-selected, ${N0})`,
|
|
17
|
-
dark: `var(--ds-text-selected, ${N700})`
|
|
18
|
-
};
|
|
19
|
-
const selectedBackground = {
|
|
20
|
-
light: `var(--ds-background-selected, ${N500})`,
|
|
21
|
-
dark: `var(--ds-background-selected, ${N0})`
|
|
22
|
-
};
|
|
23
|
-
const borderColorFocused = {
|
|
24
|
-
light: `var(--ds-border-focused, ${B200})`,
|
|
25
|
-
dark: `var(--ds-border-focused, ${B100})`
|
|
26
|
-
};
|
|
27
|
-
export const dateCellStyles = (mode = 'light') => ({
|
|
1
|
+
import { B200, B400, B50, N0, N200, N30, N40, N500, N600, N900 } from '@atlaskit/theme/colors';
|
|
2
|
+
export const dateCellStyles = () => ({
|
|
28
3
|
all: 'unset',
|
|
29
4
|
display: 'block',
|
|
30
5
|
padding: `${"var(--ds-space-050, 4px)"} 9px`,
|
|
@@ -32,7 +7,7 @@ export const dateCellStyles = (mode = 'light') => ({
|
|
|
32
7
|
backgroundColor: 'transparent',
|
|
33
8
|
border: '2px solid transparent',
|
|
34
9
|
borderRadius: 3,
|
|
35
|
-
color:
|
|
10
|
+
color: `var(--ds-text, ${N900})`,
|
|
36
11
|
cursor: 'pointer',
|
|
37
12
|
flexGrow: 1,
|
|
38
13
|
fontSize: "var(--ds-font-size-100, 14px)",
|
|
@@ -41,7 +16,7 @@ export const dateCellStyles = (mode = 'light') => ({
|
|
|
41
16
|
color: `var(--ds-text-subtlest, ${N200})`
|
|
42
17
|
},
|
|
43
18
|
'&[data-today]': {
|
|
44
|
-
color:
|
|
19
|
+
color: `var(--ds-text-selected, ${B400})`,
|
|
45
20
|
fontWeight: "var(--ds-font-weight-bold, bold)",
|
|
46
21
|
'&::after': {
|
|
47
22
|
display: 'block',
|
|
@@ -59,30 +34,30 @@ export const dateCellStyles = (mode = 'light') => ({
|
|
|
59
34
|
color: `var(--ds-text-subtle, ${N600})`
|
|
60
35
|
},
|
|
61
36
|
'&[data-selected]': {
|
|
62
|
-
backgroundColor:
|
|
63
|
-
color:
|
|
37
|
+
backgroundColor: `var(--ds-background-selected, ${N500})`,
|
|
38
|
+
color: `var(--ds-text-selected, ${N0})`
|
|
64
39
|
},
|
|
65
40
|
'&[data-disabled]': {
|
|
66
41
|
color: `var(--ds-text-disabled, ${N40})`,
|
|
67
42
|
cursor: 'not-allowed'
|
|
68
43
|
},
|
|
69
44
|
'&:focus-visible': {
|
|
70
|
-
border: `2px solid ${
|
|
45
|
+
border: `2px solid ${`var(--ds-border-focused, ${B200})`}`
|
|
71
46
|
},
|
|
72
47
|
'&:hover': {
|
|
73
|
-
backgroundColor:
|
|
74
|
-
color:
|
|
48
|
+
backgroundColor: `var(--ds-background-neutral-subtle-hovered, ${N30})`,
|
|
49
|
+
color: `var(--ds-text, ${N900})`
|
|
75
50
|
},
|
|
76
51
|
'&:active': {
|
|
77
52
|
backgroundColor: `var(--ds-background-neutral-subtle-pressed, ${B50})`,
|
|
78
|
-
color:
|
|
53
|
+
color: `var(--ds-text, ${N900})`
|
|
79
54
|
},
|
|
80
55
|
'&[data-selected]:hover': {
|
|
81
56
|
backgroundColor: `var(--ds-background-selected-hovered, ${B50})`,
|
|
82
57
|
color: `var(--ds-text-selected, ${N600})`
|
|
83
58
|
},
|
|
84
59
|
'&[data-prev-selected]:hover': {
|
|
85
|
-
color:
|
|
60
|
+
color: `var(--ds-text-subtle, ${N600})`
|
|
86
61
|
},
|
|
87
62
|
'&[data-sibling]:hover': {
|
|
88
63
|
color: `var(--ds-text-subtlest, ${N200})`
|
package/dist/esm/calendar.js
CHANGED
|
@@ -9,7 +9,6 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
10
10
|
import noop from '@atlaskit/ds-lib/noop';
|
|
11
11
|
import { Box, Stack, xcss } from '@atlaskit/primitives';
|
|
12
|
-
import GlobalTheme from '@atlaskit/theme/components';
|
|
13
12
|
import Header from './internal/components/header';
|
|
14
13
|
import WeekDaysComponent from './internal/components/week-days';
|
|
15
14
|
import WeekHeaderComponent from './internal/components/week-header';
|
|
@@ -29,9 +28,9 @@ var boxStyles = xcss({
|
|
|
29
28
|
var analyticsAttributes = {
|
|
30
29
|
componentName: 'calendar',
|
|
31
30
|
packageName: "@atlaskit/calendar",
|
|
32
|
-
packageVersion: "
|
|
31
|
+
packageVersion: "14.0.0"
|
|
33
32
|
};
|
|
34
|
-
var
|
|
33
|
+
var InnerCalendar = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
35
34
|
var day = _ref.day,
|
|
36
35
|
_ref$defaultDay = _ref.defaultDay,
|
|
37
36
|
defaultDay = _ref$defaultDay === void 0 ? 0 : _ref$defaultDay,
|
|
@@ -69,8 +68,6 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
69
68
|
weekStartDay = _ref$weekStartDay === void 0 ? 0 : _ref$weekStartDay,
|
|
70
69
|
testId = _ref.testId,
|
|
71
70
|
calendarRef = _ref.calendarRef,
|
|
72
|
-
_ref$mode = _ref.mode,
|
|
73
|
-
mode = _ref$mode === void 0 ? 'light' : _ref$mode,
|
|
74
71
|
className = _ref.className,
|
|
75
72
|
style = _ref.style,
|
|
76
73
|
_ref$tabIndex = _ref.tabIndex,
|
|
@@ -212,7 +209,6 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
212
209
|
handleClickNext: handleClickNext,
|
|
213
210
|
handleClickPrev: handleClickPrev,
|
|
214
211
|
headerId: headerId,
|
|
215
|
-
mode: mode,
|
|
216
212
|
tabIndex: tabIndex,
|
|
217
213
|
testId: testId
|
|
218
214
|
}), jsx(Box, {
|
|
@@ -223,12 +219,10 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
223
219
|
testId: testId && "".concat(testId, "--calendar-dates")
|
|
224
220
|
}, jsx(WeekHeaderComponent, {
|
|
225
221
|
daysShort: daysShort,
|
|
226
|
-
mode: mode,
|
|
227
222
|
testId: testId
|
|
228
223
|
}), jsx(WeekDaysComponent, {
|
|
229
224
|
weeks: weeks,
|
|
230
225
|
handleClickDay: handleClickDay,
|
|
231
|
-
mode: mode,
|
|
232
226
|
monthsLong: monthsLong,
|
|
233
227
|
shouldSetFocus: shouldSetFocus,
|
|
234
228
|
tabIndex: tabIndex,
|
|
@@ -246,13 +240,9 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
246
240
|
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
247
241
|
*/
|
|
248
242
|
var Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
249
|
-
return jsx(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
mode: mode,
|
|
253
|
-
ref: ref
|
|
254
|
-
}));
|
|
255
|
-
});
|
|
243
|
+
return jsx(InnerCalendar, _extends({}, props, {
|
|
244
|
+
ref: ref
|
|
245
|
+
}));
|
|
256
246
|
}));
|
|
257
247
|
Calendar.displayName = 'Calendar';
|
|
258
248
|
export default Calendar;
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { forwardRef, memo, useCallback, useEffect,
|
|
2
|
+
import { forwardRef, memo, useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { Grid } from '@atlaskit/primitives';
|
|
6
6
|
import { dateCellStyles as getDateCellStyles } from '../styles/date';
|
|
7
|
-
var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(
|
|
8
|
-
var day =
|
|
9
|
-
|
|
10
|
-
isDisabled =
|
|
11
|
-
|
|
12
|
-
isFocused =
|
|
13
|
-
|
|
14
|
-
isToday =
|
|
15
|
-
dayLong =
|
|
16
|
-
month =
|
|
17
|
-
monthLong =
|
|
18
|
-
|
|
19
|
-
onClick =
|
|
20
|
-
|
|
21
|
-
isPreviouslySelected =
|
|
22
|
-
|
|
23
|
-
isSelected =
|
|
24
|
-
|
|
25
|
-
isSibling =
|
|
26
|
-
year =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
testId = _ref.testId;
|
|
7
|
+
var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref2, _ref) {
|
|
8
|
+
var day = _ref2.children,
|
|
9
|
+
_ref2$isDisabled = _ref2.isDisabled,
|
|
10
|
+
isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
|
|
11
|
+
_ref2$isFocused = _ref2.isFocused,
|
|
12
|
+
isFocused = _ref2$isFocused === void 0 ? false : _ref2$isFocused,
|
|
13
|
+
_ref2$isToday = _ref2.isToday,
|
|
14
|
+
isToday = _ref2$isToday === void 0 ? false : _ref2$isToday,
|
|
15
|
+
dayLong = _ref2.dayLong,
|
|
16
|
+
month = _ref2.month,
|
|
17
|
+
monthLong = _ref2.monthLong,
|
|
18
|
+
_ref2$onClick = _ref2.onClick,
|
|
19
|
+
onClick = _ref2$onClick === void 0 ? noop : _ref2$onClick,
|
|
20
|
+
_ref2$isPreviouslySel = _ref2.isPreviouslySelected,
|
|
21
|
+
isPreviouslySelected = _ref2$isPreviouslySel === void 0 ? false : _ref2$isPreviouslySel,
|
|
22
|
+
_ref2$isSelected = _ref2.isSelected,
|
|
23
|
+
isSelected = _ref2$isSelected === void 0 ? false : _ref2$isSelected,
|
|
24
|
+
_ref2$isSibling = _ref2.isSibling,
|
|
25
|
+
isSibling = _ref2$isSibling === void 0 ? false : _ref2$isSibling,
|
|
26
|
+
year = _ref2.year,
|
|
27
|
+
shouldSetFocus = _ref2.shouldSetFocus,
|
|
28
|
+
tabIndex = _ref2.tabIndex,
|
|
29
|
+
testId = _ref2.testId;
|
|
31
30
|
var dateRef = useRef({
|
|
32
31
|
day: day,
|
|
33
32
|
month: month,
|
|
@@ -62,9 +61,7 @@ var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref, ref) {
|
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
}, [onClick]);
|
|
65
|
-
var dateCellStyles =
|
|
66
|
-
return css(getDateCellStyles(mode));
|
|
67
|
-
}, [mode]);
|
|
64
|
+
var dateCellStyles = css(getDateCellStyles());
|
|
68
65
|
return jsx(Grid, {
|
|
69
66
|
role: "gridcell",
|
|
70
67
|
alignItems: "center"
|
|
@@ -7,7 +7,6 @@ import WeekdayGrid from './week-day-grid';
|
|
|
7
7
|
var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
|
|
8
8
|
var weeks = _ref.weeks,
|
|
9
9
|
handleClickDay = _ref.handleClickDay,
|
|
10
|
-
mode = _ref.mode,
|
|
11
10
|
monthsLong = _ref.monthsLong,
|
|
12
11
|
shouldSetFocus = _ref.shouldSetFocus,
|
|
13
12
|
tabIndex = _ref.tabIndex,
|
|
@@ -33,7 +32,6 @@ var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
|
|
|
33
32
|
isSelected: weekDay.isSelected,
|
|
34
33
|
isSibling: weekDay.isSiblingMonth,
|
|
35
34
|
year: weekDay.year,
|
|
36
|
-
mode: mode,
|
|
37
35
|
shouldSetFocus: shouldSetFocus,
|
|
38
36
|
tabIndex: tabIndex,
|
|
39
37
|
testId: testId
|
|
@@ -47,7 +47,7 @@ export default function useHandleDateChange(_ref) {
|
|
|
47
47
|
yearValue = _ref$year[0],
|
|
48
48
|
setYearValue = _ref$year[1],
|
|
49
49
|
_ref$shouldSetFocus = _slicedToArray(_ref.shouldSetFocus, 2),
|
|
50
|
-
|
|
50
|
+
_shouldSetFocus = _ref$shouldSetFocus[0],
|
|
51
51
|
setShouldSetFocus = _ref$shouldSetFocus[1],
|
|
52
52
|
onChange = _ref.onChange;
|
|
53
53
|
var dateRef = useRef({
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var textColor = {
|
|
3
|
-
light: "var(--ds-text, ".concat(N900, ")"),
|
|
4
|
-
dark: "var(--ds-text, ".concat(DN600, ")")
|
|
5
|
-
};
|
|
6
|
-
var textColorMedium = "var(--ds-text-subtle, ".concat(N600, ")");
|
|
7
|
-
var todayColor = {
|
|
8
|
-
light: "var(--ds-text-selected, ".concat(B400, ")"),
|
|
9
|
-
dark: "var(--ds-text-selected, ".concat(B100, ")")
|
|
10
|
-
};
|
|
11
|
-
var hoverBackground = {
|
|
12
|
-
light: "var(--ds-background-neutral-subtle-hovered, ".concat(N30, ")"),
|
|
13
|
-
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(N800, ")")
|
|
14
|
-
};
|
|
15
|
-
var textSelected = {
|
|
16
|
-
light: "var(--ds-text-selected, ".concat(N0, ")"),
|
|
17
|
-
dark: "var(--ds-text-selected, ".concat(N700, ")")
|
|
18
|
-
};
|
|
19
|
-
var selectedBackground = {
|
|
20
|
-
light: "var(--ds-background-selected, ".concat(N500, ")"),
|
|
21
|
-
dark: "var(--ds-background-selected, ".concat(N0, ")")
|
|
22
|
-
};
|
|
23
|
-
var borderColorFocused = {
|
|
24
|
-
light: "var(--ds-border-focused, ".concat(B200, ")"),
|
|
25
|
-
dark: "var(--ds-border-focused, ".concat(B100, ")")
|
|
26
|
-
};
|
|
1
|
+
import { B200, B400, B50, N0, N200, N30, N40, N500, N600, N900 } from '@atlaskit/theme/colors';
|
|
27
2
|
export var dateCellStyles = function dateCellStyles() {
|
|
28
|
-
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
|
|
29
3
|
return {
|
|
30
4
|
all: 'unset',
|
|
31
5
|
display: 'block',
|
|
@@ -34,7 +8,7 @@ export var dateCellStyles = function dateCellStyles() {
|
|
|
34
8
|
backgroundColor: 'transparent',
|
|
35
9
|
border: '2px solid transparent',
|
|
36
10
|
borderRadius: 3,
|
|
37
|
-
color:
|
|
11
|
+
color: "var(--ds-text, ".concat(N900, ")"),
|
|
38
12
|
cursor: 'pointer',
|
|
39
13
|
flexGrow: 1,
|
|
40
14
|
fontSize: "var(--ds-font-size-100, 14px)",
|
|
@@ -43,7 +17,7 @@ export var dateCellStyles = function dateCellStyles() {
|
|
|
43
17
|
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
44
18
|
},
|
|
45
19
|
'&[data-today]': {
|
|
46
|
-
color:
|
|
20
|
+
color: "var(--ds-text-selected, ".concat(B400, ")"),
|
|
47
21
|
fontWeight: "var(--ds-font-weight-bold, bold)",
|
|
48
22
|
'&::after': {
|
|
49
23
|
display: 'block',
|
|
@@ -61,30 +35,30 @@ export var dateCellStyles = function dateCellStyles() {
|
|
|
61
35
|
color: "var(--ds-text-subtle, ".concat(N600, ")")
|
|
62
36
|
},
|
|
63
37
|
'&[data-selected]': {
|
|
64
|
-
backgroundColor:
|
|
65
|
-
color:
|
|
38
|
+
backgroundColor: "var(--ds-background-selected, ".concat(N500, ")"),
|
|
39
|
+
color: "var(--ds-text-selected, ".concat(N0, ")")
|
|
66
40
|
},
|
|
67
41
|
'&[data-disabled]': {
|
|
68
42
|
color: "var(--ds-text-disabled, ".concat(N40, ")"),
|
|
69
43
|
cursor: 'not-allowed'
|
|
70
44
|
},
|
|
71
45
|
'&:focus-visible': {
|
|
72
|
-
border: "2px solid ".concat(
|
|
46
|
+
border: "2px solid ".concat("var(--ds-border-focused, ".concat(B200, ")"))
|
|
73
47
|
},
|
|
74
48
|
'&:hover': {
|
|
75
|
-
backgroundColor:
|
|
76
|
-
color:
|
|
49
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, ".concat(N30, ")"),
|
|
50
|
+
color: "var(--ds-text, ".concat(N900, ")")
|
|
77
51
|
},
|
|
78
52
|
'&:active': {
|
|
79
53
|
backgroundColor: "var(--ds-background-neutral-subtle-pressed, ".concat(B50, ")"),
|
|
80
|
-
color:
|
|
54
|
+
color: "var(--ds-text, ".concat(N900, ")")
|
|
81
55
|
},
|
|
82
56
|
'&[data-selected]:hover': {
|
|
83
57
|
backgroundColor: "var(--ds-background-selected-hovered, ".concat(B50, ")"),
|
|
84
58
|
color: "var(--ds-text-selected, ".concat(N600, ")")
|
|
85
59
|
},
|
|
86
60
|
'&[data-prev-selected]:hover': {
|
|
87
|
-
color:
|
|
61
|
+
color: "var(--ds-text-subtle, ".concat(N600, ")")
|
|
88
62
|
},
|
|
89
63
|
'&[data-sibling]:hover': {
|
|
90
64
|
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
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, "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabled" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "nextMonthLabel" | "onBlur" | "onChange" | "onFocus" | "onSelect" | "previouslySelected" | "previousMonthLabel" | "selected" | "today" | "year" | "locale" | "analyticsContext" | "weekStartDay" | "testId" | "className" | "style" | "calendarRef" | "
|
|
12
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabled" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "nextMonthLabel" | "onBlur" | "onChange" | "onFocus" | "onSelect" | "previouslySelected" | "previousMonthLabel" | "selected" | "today" | "year" | "locale" | "analyticsContext" | "weekStartDay" | "testId" | "className" | "style" | "calendarRef" | "tabIndex" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
13
13
|
export default Calendar;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
import type { TabIndex } from '../../types';
|
|
4
3
|
import type { DateObj } from '../types';
|
|
5
4
|
interface DateProps {
|
|
@@ -15,7 +14,6 @@ interface DateProps {
|
|
|
15
14
|
isSelected?: boolean;
|
|
16
15
|
isSibling?: boolean;
|
|
17
16
|
year: number;
|
|
18
|
-
mode?: ThemeModes;
|
|
19
17
|
shouldSetFocus: boolean;
|
|
20
18
|
tabIndex: TabIndex;
|
|
21
19
|
testId?: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
import { TabIndex } from '../../types';
|
|
4
3
|
interface HeaderProps {
|
|
5
4
|
monthLongTitle: string;
|
|
@@ -10,7 +9,6 @@ interface HeaderProps {
|
|
|
10
9
|
nextHeading: string;
|
|
11
10
|
handleClickNext: (e: React.MouseEvent<HTMLElement>) => void;
|
|
12
11
|
handleClickPrev: (e: React.MouseEvent<HTMLElement>) => void;
|
|
13
|
-
mode?: ThemeModes;
|
|
14
12
|
headerId: string;
|
|
15
13
|
tabIndex?: TabIndex;
|
|
16
14
|
testId?: string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
import type { TabIndex } from '../../types';
|
|
4
3
|
import { DateObj, Week } from '../types';
|
|
5
4
|
interface WeekDaysProps {
|
|
6
5
|
weeks: Week[];
|
|
7
6
|
handleClickDay: (date: DateObj) => void;
|
|
8
|
-
mode?: ThemeModes;
|
|
9
7
|
monthsLong: string[];
|
|
10
8
|
shouldSetFocus: boolean;
|
|
11
9
|
tabIndex: TabIndex;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
interface WeekHeaderProps {
|
|
4
3
|
daysShort: string[];
|
|
5
|
-
mode?: ThemeModes;
|
|
6
4
|
testId?: string;
|
|
7
5
|
}
|
|
8
6
|
declare const WeekHeader: import("react").NamedExoticComponent<WeekHeaderProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent } from '../../types';
|
|
2
2
|
import type { ArrowKeys } from '../types';
|
|
3
|
-
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [
|
|
3
|
+
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [_shouldSetFocus, setShouldSetFocus], onChange, }: {
|
|
4
4
|
day: readonly [number, (newValue: number) => void];
|
|
5
5
|
month: readonly [number, (newValue: number) => void];
|
|
6
6
|
year: readonly [number, (newValue: number) => void];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
4
3
|
import type { ArrowKeys, DateObj, ISODate } from './internal/types';
|
|
5
4
|
export type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
5
|
export type TabIndex = -1 | 0;
|
|
@@ -146,10 +145,6 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
146
145
|
* backward compatibility. PLEASE DO NOT USE THIS.
|
|
147
146
|
*/
|
|
148
147
|
calendarRef?: React.Ref<CalendarRef>;
|
|
149
|
-
/**
|
|
150
|
-
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
151
|
-
*/
|
|
152
|
-
mode?: ThemeModes;
|
|
153
148
|
/**
|
|
154
149
|
* Indicates if the calendar can be focused by keyboard or only
|
|
155
150
|
* programmatically. Defaults to "0".
|
|
@@ -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, "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabled" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "nextMonthLabel" | "onBlur" | "onChange" | "onFocus" | "onSelect" | "previouslySelected" | "previousMonthLabel" | "selected" | "today" | "year" | "locale" | "analyticsContext" | "weekStartDay" | "testId" | "className" | "style" | "calendarRef" | "
|
|
12
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabled" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "nextMonthLabel" | "onBlur" | "onChange" | "onFocus" | "onSelect" | "previouslySelected" | "previousMonthLabel" | "selected" | "today" | "year" | "locale" | "analyticsContext" | "weekStartDay" | "testId" | "className" | "style" | "calendarRef" | "tabIndex" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
13
13
|
export default Calendar;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
import type { TabIndex } from '../../types';
|
|
4
3
|
import type { DateObj } from '../types';
|
|
5
4
|
interface DateProps {
|
|
@@ -15,7 +14,6 @@ interface DateProps {
|
|
|
15
14
|
isSelected?: boolean;
|
|
16
15
|
isSibling?: boolean;
|
|
17
16
|
year: number;
|
|
18
|
-
mode?: ThemeModes;
|
|
19
17
|
shouldSetFocus: boolean;
|
|
20
18
|
tabIndex: TabIndex;
|
|
21
19
|
testId?: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
import { TabIndex } from '../../types';
|
|
4
3
|
interface HeaderProps {
|
|
5
4
|
monthLongTitle: string;
|
|
@@ -10,7 +9,6 @@ interface HeaderProps {
|
|
|
10
9
|
nextHeading: string;
|
|
11
10
|
handleClickNext: (e: React.MouseEvent<HTMLElement>) => void;
|
|
12
11
|
handleClickPrev: (e: React.MouseEvent<HTMLElement>) => void;
|
|
13
|
-
mode?: ThemeModes;
|
|
14
12
|
headerId: string;
|
|
15
13
|
tabIndex?: TabIndex;
|
|
16
14
|
testId?: string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
import type { TabIndex } from '../../types';
|
|
4
3
|
import { DateObj, Week } from '../types';
|
|
5
4
|
interface WeekDaysProps {
|
|
6
5
|
weeks: Week[];
|
|
7
6
|
handleClickDay: (date: DateObj) => void;
|
|
8
|
-
mode?: ThemeModes;
|
|
9
7
|
monthsLong: string[];
|
|
10
8
|
shouldSetFocus: boolean;
|
|
11
9
|
tabIndex: TabIndex;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
2
|
interface WeekHeaderProps {
|
|
4
3
|
daysShort: string[];
|
|
5
|
-
mode?: ThemeModes;
|
|
6
4
|
testId?: string;
|
|
7
5
|
}
|
|
8
6
|
declare const WeekHeader: import("react").NamedExoticComponent<WeekHeaderProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent } from '../../types';
|
|
2
2
|
import type { ArrowKeys } from '../types';
|
|
3
|
-
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [
|
|
3
|
+
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [_shouldSetFocus, setShouldSetFocus], onChange, }: {
|
|
4
4
|
day: readonly [
|
|
5
5
|
number,
|
|
6
6
|
(newValue: number) => void
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
4
3
|
import type { ArrowKeys, DateObj, ISODate } from './internal/types';
|
|
5
4
|
export type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
5
|
export type TabIndex = -1 | 0;
|
|
@@ -146,10 +145,6 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
146
145
|
* backward compatibility. PLEASE DO NOT USE THIS.
|
|
147
146
|
*/
|
|
148
147
|
calendarRef?: React.Ref<CalendarRef>;
|
|
149
|
-
/**
|
|
150
|
-
* @internal Legacy theme mode, can be either 'light' or 'dark'
|
|
151
|
-
*/
|
|
152
|
-
mode?: ThemeModes;
|
|
153
148
|
/**
|
|
154
149
|
* Indicates if the calendar can be focused by keyboard or only
|
|
155
150
|
* programmatically. Defaults to "0".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
27
|
-
"@atlaskit/button": "^16.
|
|
27
|
+
"@atlaskit/button": "^16.13.0",
|
|
28
28
|
"@atlaskit/ds-explorations": "^3.0.0",
|
|
29
29
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
30
30
|
"@atlaskit/heading": "^1.4.0",
|
|
31
31
|
"@atlaskit/icon": "^21.12.0",
|
|
32
|
-
"@atlaskit/locale": "^2.
|
|
33
|
-
"@atlaskit/primitives": "^1.
|
|
32
|
+
"@atlaskit/locale": "^2.6.0",
|
|
33
|
+
"@atlaskit/primitives": "^1.9.0",
|
|
34
34
|
"@atlaskit/theme": "^12.6.0",
|
|
35
|
-
"@atlaskit/tokens": "^1.
|
|
35
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"@emotion/react": "^11.7.1",
|
|
38
38
|
"date-fns": "^2.17.0",
|
package/report.api.md
CHANGED
|
@@ -21,7 +21,6 @@ import { CSSProperties } from 'react';
|
|
|
21
21
|
import { ForwardRefExoticComponent } from 'react';
|
|
22
22
|
import { MemoExoticComponent } from 'react';
|
|
23
23
|
import { RefAttributes } from 'react';
|
|
24
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
25
24
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
26
25
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
27
26
|
|
|
@@ -48,7 +47,6 @@ const Calendar: MemoExoticComponent<
|
|
|
48
47
|
| 'locale'
|
|
49
48
|
| 'maxDate'
|
|
50
49
|
| 'minDate'
|
|
51
|
-
| 'mode'
|
|
52
50
|
| 'month'
|
|
53
51
|
| 'nextMonthLabel'
|
|
54
52
|
| 'onBlur'
|
|
@@ -87,8 +85,6 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
87
85
|
locale?: string;
|
|
88
86
|
maxDate?: string;
|
|
89
87
|
minDate?: string;
|
|
90
|
-
// @internal
|
|
91
|
-
mode?: ThemeModes;
|
|
92
88
|
month?: number;
|
|
93
89
|
nextMonthLabel?: string;
|
|
94
90
|
onBlur?: React.FocusEventHandler;
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { CSSProperties } from 'react';
|
|
|
10
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
11
|
import { MemoExoticComponent } from 'react';
|
|
12
12
|
import { RefAttributes } from 'react';
|
|
13
|
-
import { ThemeModes } from '@atlaskit/theme/types';
|
|
14
13
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
15
14
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
16
15
|
|
|
@@ -18,7 +17,7 @@ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
|
18
17
|
type ArrowKeys = 'down' | 'left' | 'right' | 'up';
|
|
19
18
|
|
|
20
19
|
// @public
|
|
21
|
-
const Calendar: MemoExoticComponent<ForwardRefExoticComponent<Pick<CalendarProps, "analyticsContext" | "calendarRef" | "className" | "createAnalyticsEvent" | "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabled" | "disabledDateFilter" | "locale" | "maxDate" | "minDate" | "
|
|
20
|
+
const Calendar: MemoExoticComponent<ForwardRefExoticComponent<Pick<CalendarProps, "analyticsContext" | "calendarRef" | "className" | "createAnalyticsEvent" | "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabled" | "disabledDateFilter" | "locale" | "maxDate" | "minDate" | "month" | "nextMonthLabel" | "onBlur" | "onChange" | "onFocus" | "onSelect" | "previousMonthLabel" | "previouslySelected" | "selected" | "style" | "tabIndex" | "testId" | "today" | "weekStartDay" | "year"> & RefAttributes<HTMLDivElement>>>;
|
|
22
21
|
export default Calendar;
|
|
23
22
|
|
|
24
23
|
// @public (undocumented)
|
|
@@ -38,8 +37,6 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
38
37
|
locale?: string;
|
|
39
38
|
maxDate?: string;
|
|
40
39
|
minDate?: string;
|
|
41
|
-
// @internal
|
|
42
|
-
mode?: ThemeModes;
|
|
43
40
|
month?: number;
|
|
44
41
|
nextMonthLabel?: string;
|
|
45
42
|
onBlur?: React.FocusEventHandler;
|