@atlaskit/calendar 12.3.0 → 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 +8 -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 +13 -3
- package/dist/cjs/internal/components/date.js +2 -1
- package/dist/cjs/internal/components/heading.js +2 -1
- 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 +13 -3
- package/dist/es2019/internal/components/date.js +2 -1
- package/dist/es2019/internal/components/heading.js +2 -1
- 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 +13 -3
- package/dist/esm/internal/components/date.js +2 -1
- package/dist/esm/internal/components/heading.js +2 -1
- 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 +9 -0
- package/dist/types/internal/components/date.d.ts +2 -2
- package/dist/types/internal/components/heading.d.ts +2 -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 +77 -31
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 12.3.0
|
|
4
12
|
|
|
5
13
|
### Minor 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.3.
|
|
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,
|
|
@@ -272,6 +272,16 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
272
272
|
testId: testId
|
|
273
273
|
}))));
|
|
274
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
|
+
|
|
275
285
|
var Calendar = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Calendar(props, ref) {
|
|
276
286
|
return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
|
|
277
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;
|
|
@@ -95,6 +95,7 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
|
95
95
|
})
|
|
96
96
|
}));
|
|
97
97
|
});
|
|
98
|
-
Heading.displayName = 'Heading';
|
|
98
|
+
Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
99
|
+
|
|
99
100
|
var _default = Heading;
|
|
100
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.3.
|
|
51
|
+
packageVersion: "12.3.1"
|
|
52
52
|
};
|
|
53
53
|
const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
54
54
|
day,
|
|
@@ -211,6 +211,16 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
|
211
211
|
testId: testId
|
|
212
212
|
}))));
|
|
213
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
|
+
|
|
214
224
|
const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
215
225
|
return jsx(GlobalTheme.Consumer, null, ({
|
|
216
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;
|
|
@@ -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.3.
|
|
57
|
+
packageVersion: "12.3.1"
|
|
58
58
|
};
|
|
59
59
|
var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
60
60
|
var day = _ref.day,
|
|
@@ -243,6 +243,16 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
243
243
|
testId: testId
|
|
244
244
|
}))));
|
|
245
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
|
+
|
|
246
256
|
var Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
247
257
|
return jsx(GlobalTheme.Consumer, null, function (_ref2) {
|
|
248
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;
|
|
@@ -30,5 +30,6 @@ var WeekHeader = /*#__PURE__*/memo(function WeekHeader(_ref) {
|
|
|
30
30
|
}, shortDay);
|
|
31
31
|
}));
|
|
32
32
|
});
|
|
33
|
-
WeekHeader.displayName = 'WeekHeader';
|
|
33
|
+
WeekHeader.displayName = 'WeekHeader'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
34
|
+
|
|
34
35
|
export default WeekHeader;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import useControlled from '@atlaskit/ds-lib/use-controlled';
|
|
3
3
|
import useLazyRef from '@atlaskit/ds-lib/use-lazy-ref';
|
|
4
|
-
import pad from '../utils/pad';
|
|
4
|
+
import pad from '../utils/pad'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
5
|
+
|
|
5
6
|
export default function useControlledDateState(_ref) {
|
|
6
7
|
var day = _ref.day,
|
|
7
8
|
defaultDay = _ref.defaultDay,
|
|
@@ -34,7 +34,8 @@ function useGetCalendarWithSixthWeek(calendar, _ref) {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
}, [calendarLastValue, month, shouldDisplaySixthWeek, weekStartDay, year]);
|
|
37
|
-
}
|
|
37
|
+
} // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
38
|
+
|
|
38
39
|
|
|
39
40
|
export default function useGetWeeks(_ref2) {
|
|
40
41
|
var day = _ref2.day,
|
|
@@ -42,7 +42,8 @@ var getPrevMonth = function getPrevMonth(monthValue, yearValue) {
|
|
|
42
42
|
month: month,
|
|
43
43
|
year: year
|
|
44
44
|
};
|
|
45
|
-
};
|
|
45
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
46
|
+
|
|
46
47
|
|
|
47
48
|
export default function useHandleDateChange(_ref) {
|
|
48
49
|
var _ref$day = _slicedToArray(_ref.day, 2),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { arrowKeys } from '../constants';
|
|
4
|
-
import dateToString from '../utils/date-to-string';
|
|
4
|
+
import dateToString from '../utils/date-to-string'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
5
|
+
|
|
5
6
|
export default function useHandleDateSelect(_ref) {
|
|
6
7
|
var _ref$day = _slicedToArray(_ref.day, 1),
|
|
7
8
|
dayValue = _ref$day[0],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
3
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
3
4
|
export default function useLocale(_ref) {
|
|
4
5
|
var locale = _ref.locale,
|
|
5
6
|
weekStartDay = _ref.weekStartDay;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useUIDSeed } from 'react-uid';
|
|
1
|
+
import { useUIDSeed } from 'react-uid'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
2
|
+
|
|
2
3
|
export default function useUniqueId(prefix) {
|
|
3
4
|
var seed = useUIDSeed();
|
|
4
5
|
return "".concat(prefix, "-").concat(seed(prefix));
|
package/dist/esm/version.json
CHANGED
package/dist/types/calendar.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CalendarProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Calendar__
|
|
5
|
+
*
|
|
6
|
+
* A calendar is used for date selection.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/calendar/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/calendar/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
11
|
+
*/
|
|
3
12
|
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
13
|
export default Calendar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
3
|
import type { DateObj } from '../types';
|
|
4
|
-
interface
|
|
4
|
+
interface DateProps {
|
|
5
5
|
children: number;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
isFocused?: boolean;
|
|
@@ -15,5 +15,5 @@ interface Props {
|
|
|
15
15
|
mode?: ThemeModes;
|
|
16
16
|
testId?: string;
|
|
17
17
|
}
|
|
18
|
-
declare const Date: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<
|
|
18
|
+
declare const Date: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<DateProps & import("react").RefAttributes<HTMLButtonElement>>>;
|
|
19
19
|
export default Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
-
interface
|
|
3
|
+
interface HeadingProps {
|
|
4
4
|
monthLongTitle: string;
|
|
5
5
|
year: number;
|
|
6
6
|
previousMonthLabel?: string;
|
|
@@ -10,5 +10,5 @@ interface Props {
|
|
|
10
10
|
mode?: ThemeModes;
|
|
11
11
|
testId?: string;
|
|
12
12
|
}
|
|
13
|
-
declare const Heading: import("react").NamedExoticComponent<
|
|
13
|
+
declare const Heading: import("react").NamedExoticComponent<HeadingProps>;
|
|
14
14
|
export default Heading;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
3
|
import { DateObj, Week } from '../types';
|
|
4
|
-
interface
|
|
4
|
+
interface WeekDaysProps {
|
|
5
5
|
weeks: Week[];
|
|
6
6
|
handleClickDay: (date: DateObj) => void;
|
|
7
7
|
mode?: ThemeModes;
|
|
8
8
|
testId?: string;
|
|
9
9
|
}
|
|
10
|
-
declare const WeekDays: import("react").NamedExoticComponent<
|
|
10
|
+
declare const WeekDays: import("react").NamedExoticComponent<WeekDaysProps>;
|
|
11
11
|
export default WeekDays;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
-
interface
|
|
3
|
+
interface WeekHeaderProps {
|
|
4
4
|
daysShort: string[];
|
|
5
5
|
mode?: ThemeModes;
|
|
6
6
|
}
|
|
7
|
-
declare const WeekHeader: import("react").NamedExoticComponent<
|
|
7
|
+
declare const WeekHeader: import("react").NamedExoticComponent<WeekHeaderProps>;
|
|
8
8
|
export default WeekHeader;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -11,58 +11,104 @@ export declare type SelectEvent = {
|
|
|
11
11
|
iso: ISODate;
|
|
12
12
|
} & DateObj;
|
|
13
13
|
export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The number of the day currently focused. Places border around the date. 0 highlights no date.
|
|
16
|
+
*/
|
|
15
17
|
day?: number;
|
|
16
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Default for `day`.
|
|
20
|
+
*/
|
|
17
21
|
defaultDay?: number;
|
|
18
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Default for `month`.
|
|
24
|
+
*/
|
|
19
25
|
defaultMonth?: number;
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Default for `previouslySelected`.
|
|
28
|
+
*/
|
|
21
29
|
defaultPreviouslySelected?: Array<string>;
|
|
22
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Default for `selected`.
|
|
32
|
+
*/
|
|
23
33
|
defaultSelected?: Array<string>;
|
|
24
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Default for `year`.
|
|
36
|
+
*/
|
|
25
37
|
defaultYear?: number;
|
|
26
|
-
/**
|
|
27
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates provided are greyed out.
|
|
40
|
+
* This does not prevent these dates being selected.
|
|
41
|
+
*/
|
|
28
42
|
disabled?: Array<string>;
|
|
29
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* A filter function that takes a date string in the format 'YYYY-MM-DD' and returns true if that date should be disabled.
|
|
45
|
+
*/
|
|
30
46
|
disabledDateFilter?: (date: string) => boolean;
|
|
31
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* The latest enabled date
|
|
49
|
+
*/
|
|
32
50
|
maxDate?: string;
|
|
33
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The earliest enabled date
|
|
53
|
+
*/
|
|
34
54
|
minDate?: string;
|
|
35
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The number of the month (from 1 to 12) which the calendar should be on.
|
|
57
|
+
*/
|
|
36
58
|
month?: number;
|
|
37
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The aria-label attribute associated with the next-month arrow.
|
|
61
|
+
*/
|
|
38
62
|
nextMonthLabel?: string;
|
|
39
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Function which is called when the calendar is no longer focused.
|
|
65
|
+
*/
|
|
40
66
|
onBlur?: React.FocusEventHandler;
|
|
41
|
-
/**
|
|
42
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Called when the calendar is navigated. This can be triggered by the keyboard, or by clicking the navigational buttons.
|
|
69
|
+
* The 'interface' property indicates the the direction the calendar was navigated whereas the 'iso' property is a string of the format YYYY-MM-DD.
|
|
70
|
+
*/
|
|
43
71
|
onChange?: (event: ChangeEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
44
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Called when the calendar receives focus. This could be from a mouse event on the container by tabbing into it.
|
|
74
|
+
*/
|
|
45
75
|
onFocus?: React.FocusEventHandler;
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Function called when a day is clicked on. Calls with an object that has
|
|
78
|
+
* a day, month and year property as numbers, representing the date just clicked.
|
|
79
|
+
* It also has an 'iso' property, which is a string of the selected date in the
|
|
80
|
+
* format YYYY-MM-DD.
|
|
81
|
+
*/
|
|
50
82
|
onSelect?: (event: SelectEvent, analyticsEvent: UIAnalyticsEvent) => void;
|
|
51
|
-
/**
|
|
52
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
85
|
+
* provided are given a background color.
|
|
86
|
+
*/
|
|
53
87
|
previouslySelected?: Array<string>;
|
|
54
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* The aria-label attribute associated with the previous-month arrow.
|
|
90
|
+
*/
|
|
55
91
|
previousMonthLabel?: string;
|
|
56
|
-
/**
|
|
57
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
|
94
|
+
* provided are given a background color.
|
|
95
|
+
*/
|
|
58
96
|
selected?: Array<string>;
|
|
59
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Value of current day, as a string in the format 'YYYY-MM-DD'.
|
|
99
|
+
*/
|
|
60
100
|
today?: string;
|
|
61
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Year to display the calendar for.
|
|
103
|
+
*/
|
|
62
104
|
year?: number;
|
|
63
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* BCP 47 language tag (e.g. ja-JP) that ensures dates are in the official format for the locale.
|
|
107
|
+
*/
|
|
64
108
|
locale?: string;
|
|
65
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Additional information to be included in the `context` of analytics events.
|
|
111
|
+
*/
|
|
66
112
|
analyticsContext?: Record<string, any>;
|
|
67
113
|
/**
|
|
68
114
|
* Start day of the week for the calendar.
|
|
@@ -84,7 +130,7 @@ export interface CalendarProps extends WithAnalyticsEventsProps {
|
|
|
84
130
|
* testId--next-month - Button to show previous month
|
|
85
131
|
* testId--current-month-year - Text containing the current month and year
|
|
86
132
|
* testId--selected-day - The currently selected day (may be missing if a date isn’t selected)
|
|
87
|
-
|
|
133
|
+
*/
|
|
88
134
|
testId?: string;
|
|
89
135
|
/**
|
|
90
136
|
* Class name to apply to the calendar
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.1",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"releaseModel": "scheduled",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
27
27
|
"@atlaskit/button": "^16.3.0",
|
|
28
|
-
"@atlaskit/ds-lib": "^2.
|
|
28
|
+
"@atlaskit/ds-lib": "^2.1.0",
|
|
29
29
|
"@atlaskit/icon": "^21.10.0",
|
|
30
30
|
"@atlaskit/locale": "^2.3.0",
|
|
31
31
|
"@atlaskit/theme": "^12.1.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@atlaskit/docs": "*",
|
|
44
|
-
"@atlaskit/select": "^15.
|
|
44
|
+
"@atlaskit/select": "^15.5.0",
|
|
45
45
|
"@atlaskit/ssr": "*",
|
|
46
46
|
"@atlaskit/visual-regression": "*",
|
|
47
47
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"@repo/internal": {
|
|
64
64
|
"dom-events": "use-bind-event-listener",
|
|
65
|
+
"design-system": "v1",
|
|
65
66
|
"ui-components": "lite-mode",
|
|
66
67
|
"analytics": "analytics-next",
|
|
67
68
|
"theming": "tokens",
|
|
@@ -73,8 +74,8 @@
|
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
"af:exports": {
|
|
76
|
-
"./types": "./src/entry-points/types.
|
|
77
|
-
".": "./src/index.
|
|
77
|
+
"./types": "./src/entry-points/types.tsx",
|
|
78
|
+
".": "./src/index.tsx"
|
|
78
79
|
},
|
|
79
80
|
"homepage": "https://atlassian.design/components/calendar/",
|
|
80
81
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|