@atlaskit/calendar 12.3.0 → 12.4.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 +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 +26 -16
- package/dist/cjs/internal/components/date.js +5 -4
- package/dist/cjs/internal/components/heading.js +13 -12
- package/dist/cjs/internal/components/week-days.js +7 -6
- package/dist/cjs/internal/components/week-header.js +7 -6
- 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 +14 -4
- package/dist/es2019/internal/components/date.js +4 -3
- package/dist/es2019/internal/components/heading.js +3 -2
- package/dist/es2019/internal/components/week-days.js +3 -2
- package/dist/es2019/internal/components/week-header.js +3 -2
- 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 +14 -4
- package/dist/esm/internal/components/date.js +4 -3
- package/dist/esm/internal/components/heading.js +3 -2
- package/dist/esm/internal/components/week-days.js +3 -2
- package/dist/esm/internal/components/week-header.js +3 -2
- 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 +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/internal/styles/date.d.ts +1 -1
- package/dist/types/types.d.ts +77 -31
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/calendar
|
|
2
2
|
|
|
3
|
+
## 12.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`764726e020b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/764726e020b) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 12.3.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
18
|
+
|
|
19
|
+
## 12.3.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`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
|
|
24
|
+
- [`6bf81ead961`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6bf81ead961) - Internal code change turning on new linting rules.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 12.3.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cjs/calendar.js
CHANGED
|
@@ -15,7 +15,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
15
15
|
|
|
16
16
|
var _react = require("react");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _react2 = require("@emotion/react");
|
|
19
19
|
|
|
20
20
|
var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
|
|
21
21
|
|
|
@@ -55,25 +55,25 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
55
55
|
|
|
56
56
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
57
57
|
|
|
58
|
-
var lightWrapperStyles = (0,
|
|
58
|
+
var lightWrapperStyles = (0, _react2.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'
|
|
66
66
|
});
|
|
67
|
-
var darkWrapperStyles = (0,
|
|
67
|
+
var darkWrapperStyles = (0, _react2.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'
|
|
75
75
|
});
|
|
76
|
-
var gridsContainerStyles = (0,
|
|
76
|
+
var gridsContainerStyles = (0, _react2.css)({
|
|
77
77
|
display: 'inline-block',
|
|
78
78
|
width: 289,
|
|
79
79
|
margin: 0,
|
|
@@ -83,7 +83,7 @@ var gridsContainerStyles = (0, _core.css)({
|
|
|
83
83
|
var analyticsAttributes = {
|
|
84
84
|
componentName: 'calendar',
|
|
85
85
|
packageName: "@atlaskit/calendar",
|
|
86
|
-
packageVersion: "12.
|
|
86
|
+
packageVersion: "12.4.0"
|
|
87
87
|
};
|
|
88
88
|
var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
|
|
89
89
|
var day = _ref.day,
|
|
@@ -229,7 +229,7 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
229
229
|
monthsLong = _useLocale.monthsLong,
|
|
230
230
|
daysShort = _useLocale.daysShort;
|
|
231
231
|
|
|
232
|
-
return (0,
|
|
232
|
+
return (0, _react2.jsx)("div", {
|
|
233
233
|
className: className,
|
|
234
234
|
style: style,
|
|
235
235
|
onBlur: handleContainerBlur,
|
|
@@ -238,17 +238,17 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
238
238
|
role: "presentation",
|
|
239
239
|
"data-testid": testId && "".concat(testId, "--container"),
|
|
240
240
|
ref: ref
|
|
241
|
-
}, (0,
|
|
241
|
+
}, (0, _react2.jsx)(_visuallyHidden.default, null, (0, _react2.jsx)("span", {
|
|
242
242
|
id: announceId,
|
|
243
243
|
"aria-live": "assertive",
|
|
244
244
|
"aria-relevant": "text"
|
|
245
|
-
}, announcerDate)), (0,
|
|
245
|
+
}, announcerDate)), (0, _react2.jsx)("div", {
|
|
246
246
|
css: !mode || mode === 'light' ? lightWrapperStyles : darkWrapperStyles,
|
|
247
247
|
"aria-describedby": announceId,
|
|
248
248
|
"aria-label": "calendar",
|
|
249
249
|
role: "grid",
|
|
250
250
|
tabIndex: tabIndex
|
|
251
|
-
}, (0,
|
|
251
|
+
}, (0, _react2.jsx)(_heading.default // The month number needs to be translated to index in the month
|
|
252
252
|
// name array e.g. 1 (January) -> 0
|
|
253
253
|
, {
|
|
254
254
|
monthLongTitle: monthsLong[monthValue - 1],
|
|
@@ -259,23 +259,33 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
|
|
|
259
259
|
handleClickPrev: handleClickPrev,
|
|
260
260
|
mode: mode,
|
|
261
261
|
testId: testId
|
|
262
|
-
}), (0,
|
|
262
|
+
}), (0, _react2.jsx)("div", {
|
|
263
263
|
css: gridsContainerStyles,
|
|
264
264
|
role: "presentation"
|
|
265
|
-
}, (0,
|
|
265
|
+
}, (0, _react2.jsx)(_weekHeader.default, {
|
|
266
266
|
daysShort: daysShort,
|
|
267
267
|
mode: mode
|
|
268
|
-
}), (0,
|
|
268
|
+
}), (0, _react2.jsx)(_weekDays.default, {
|
|
269
269
|
weeks: weeks,
|
|
270
270
|
handleClickDay: handleClickDay,
|
|
271
271
|
mode: mode,
|
|
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
|
-
return (0,
|
|
286
|
+
return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
|
|
277
287
|
var mode = _ref2.mode;
|
|
278
|
-
return (0,
|
|
288
|
+
return (0, _react2.jsx)(CalendarWithMode, (0, _extends2.default)({}, props, {
|
|
279
289
|
mode: mode,
|
|
280
290
|
ref: ref
|
|
281
291
|
}));
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
15
15
|
|
|
@@ -66,9 +66,9 @@ var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
66
66
|
}
|
|
67
67
|
}, [onClick]);
|
|
68
68
|
var dateCellStyles = (0, _react.useMemo)(function () {
|
|
69
|
-
return (0, _date.dateCellStyles)(mode);
|
|
69
|
+
return (0, _react2.css)((0, _date.dateCellStyles)(mode));
|
|
70
70
|
}, [mode]);
|
|
71
|
-
return (0,
|
|
71
|
+
return (0, _react2.jsx)("button", {
|
|
72
72
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
73
73
|
css: dateCellStyles,
|
|
74
74
|
"aria-selected": isSelected ? 'true' : 'false',
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
15
15
|
|
|
@@ -24,7 +24,7 @@ var headingColor = {
|
|
|
24
24
|
light: "var(--ds-text, ".concat(_colors.N800, ")"),
|
|
25
25
|
dark: "var(--ds-text, ".concat(_colors.DN800, ")")
|
|
26
26
|
};
|
|
27
|
-
var headingStyles = (0,
|
|
27
|
+
var headingStyles = (0, _react2.css)({
|
|
28
28
|
display: 'flex',
|
|
29
29
|
padding: '0 0 13px 0',
|
|
30
30
|
color: "var(--ds-text, ".concat(_colors.N800, ")"),
|
|
@@ -33,17 +33,17 @@ var headingStyles = (0, _core.css)({
|
|
|
33
33
|
|
|
34
34
|
var getMonthAndYearStyles = function getMonthAndYearStyles() {
|
|
35
35
|
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
|
|
36
|
-
return (0,
|
|
36
|
+
return (0, _react2.css)({
|
|
37
37
|
flexBasis: '100%',
|
|
38
38
|
color: headingColor[mode],
|
|
39
39
|
textAlign: 'center'
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
var arrowLeftStyles = (0,
|
|
43
|
+
var arrowLeftStyles = (0, _react2.css)({
|
|
44
44
|
marginLeft: 8
|
|
45
45
|
});
|
|
46
|
-
var arrowRightStyles = (0,
|
|
46
|
+
var arrowRightStyles = (0, _react2.css)({
|
|
47
47
|
marginRight: 8
|
|
48
48
|
});
|
|
49
49
|
var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
@@ -60,34 +60,34 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
|
|
|
60
60
|
var monthAndYearStyles = (0, _react.useMemo)(function () {
|
|
61
61
|
return getMonthAndYearStyles(mode);
|
|
62
62
|
}, [mode]);
|
|
63
|
-
return (0,
|
|
63
|
+
return (0, _react2.jsx)("div", {
|
|
64
64
|
css: headingStyles,
|
|
65
65
|
"aria-hidden": "true"
|
|
66
|
-
}, (0,
|
|
66
|
+
}, (0, _react2.jsx)(_standardButton.default, {
|
|
67
67
|
css: arrowLeftStyles,
|
|
68
68
|
appearance: "subtle",
|
|
69
69
|
spacing: "none",
|
|
70
70
|
tabIndex: -1,
|
|
71
71
|
onClick: handleClickPrev,
|
|
72
72
|
testId: testId && "".concat(testId, "--previous-month"),
|
|
73
|
-
iconBefore: (0,
|
|
73
|
+
iconBefore: (0, _react2.jsx)(_chevronLeftLarge.default, {
|
|
74
74
|
label: previousMonthLabel,
|
|
75
75
|
size: "medium",
|
|
76
76
|
primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
|
|
77
77
|
testId: testId && "".concat(testId, "--previous-month-icon")
|
|
78
78
|
})
|
|
79
|
-
}), (0,
|
|
79
|
+
}), (0, _react2.jsx)("div", {
|
|
80
80
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
81
81
|
css: monthAndYearStyles,
|
|
82
82
|
"data-testid": testId && "".concat(testId, "--current-month-year")
|
|
83
|
-
}, "".concat(monthLongTitle, " ").concat(year)), (0,
|
|
83
|
+
}, "".concat(monthLongTitle, " ").concat(year)), (0, _react2.jsx)(_standardButton.default, {
|
|
84
84
|
css: arrowRightStyles,
|
|
85
85
|
appearance: "subtle",
|
|
86
86
|
spacing: "none",
|
|
87
87
|
tabIndex: -1,
|
|
88
88
|
onClick: handleClickNext,
|
|
89
89
|
testId: testId && "".concat(testId, "--next-month"),
|
|
90
|
-
iconBefore: (0,
|
|
90
|
+
iconBefore: (0, _react2.jsx)(_chevronRightLarge.default, {
|
|
91
91
|
label: nextMonthLabel,
|
|
92
92
|
size: "medium",
|
|
93
93
|
primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
|
|
@@ -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;
|
|
@@ -9,12 +9,12 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _date = _interopRequireDefault(require("./date"));
|
|
15
15
|
|
|
16
16
|
/** @jsx jsx */
|
|
17
|
-
var daysGridStyles = (0,
|
|
17
|
+
var daysGridStyles = (0, _react2.css)({
|
|
18
18
|
display: 'grid',
|
|
19
19
|
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
20
20
|
border: 0
|
|
@@ -24,16 +24,16 @@ var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
|
|
|
24
24
|
handleClickDay = _ref.handleClickDay,
|
|
25
25
|
mode = _ref.mode,
|
|
26
26
|
testId = _ref.testId;
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, _react2.jsx)("div", {
|
|
28
28
|
role: "grid",
|
|
29
29
|
"data-testid": testId && "".concat(testId, "--month")
|
|
30
30
|
}, weeks.map(function (week) {
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, _react2.jsx)("div", {
|
|
32
32
|
role: "row",
|
|
33
33
|
key: week.id,
|
|
34
34
|
css: daysGridStyles
|
|
35
35
|
}, week.values.map(function (weekDay) {
|
|
36
|
-
return (0,
|
|
36
|
+
return (0, _react2.jsx)(_date.default, {
|
|
37
37
|
key: weekDay.id,
|
|
38
38
|
isDisabled: weekDay.isDisabled,
|
|
39
39
|
isFocused: weekDay.isFocused,
|
|
@@ -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;
|
|
@@ -7,17 +7,17 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
11
11
|
|
|
12
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
13
|
|
|
14
14
|
/** @jsx jsx */
|
|
15
|
-
var dayNameGridStyles = (0,
|
|
15
|
+
var dayNameGridStyles = (0, _react2.css)({
|
|
16
16
|
display: 'grid',
|
|
17
17
|
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
18
18
|
border: 0
|
|
19
19
|
});
|
|
20
|
-
var dayNameCellStyles = (0,
|
|
20
|
+
var dayNameCellStyles = (0, _react2.css)({
|
|
21
21
|
boxSizing: 'border-box',
|
|
22
22
|
minWidth: 40,
|
|
23
23
|
padding: '8px 8px',
|
|
@@ -31,15 +31,16 @@ var dayNameCellStyles = (0, _core.css)({
|
|
|
31
31
|
});
|
|
32
32
|
var WeekHeader = /*#__PURE__*/(0, _react.memo)(function WeekHeader(_ref) {
|
|
33
33
|
var daysShort = _ref.daysShort;
|
|
34
|
-
return (0,
|
|
34
|
+
return (0, _react2.jsx)("div", {
|
|
35
35
|
css: dayNameGridStyles
|
|
36
36
|
}, daysShort.map(function (shortDay) {
|
|
37
|
-
return (0,
|
|
37
|
+
return (0, _react2.jsx)("span", {
|
|
38
38
|
css: dayNameCellStyles,
|
|
39
39
|
key: shortDay
|
|
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
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { forwardRef, memo, useMemo } from 'react';
|
|
5
|
-
import { css, jsx } from '@emotion/
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
7
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
8
8
|
import { DN600, N0, N700, N900 } from '@atlaskit/theme/colors';
|
|
@@ -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.
|
|
51
|
+
packageVersion: "12.4.0"
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef, memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { dateCellStyles as getDateCellStyles } from '../styles/date';
|
|
6
6
|
const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
|
|
@@ -47,7 +47,7 @@ const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}, [onClick]);
|
|
50
|
-
const dateCellStyles = useMemo(() => getDateCellStyles(mode), [mode]);
|
|
50
|
+
const dateCellStyles = useMemo(() => css(getDateCellStyles(mode)), [mode]);
|
|
51
51
|
return jsx("button", {
|
|
52
52
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
53
53
|
css: dateCellStyles,
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import Button from '@atlaskit/button/standard-button';
|
|
5
5
|
import ArrowleftIcon from '@atlaskit/icon/glyph/chevron-left-large';
|
|
6
6
|
import ArrowrightIcon from '@atlaskit/icon/glyph/chevron-right-large';
|
|
@@ -74,5 +74,6 @@ const Heading = /*#__PURE__*/memo(function Heading({
|
|
|
74
74
|
})
|
|
75
75
|
}));
|
|
76
76
|
});
|
|
77
|
-
Heading.displayName = 'Heading';
|
|
77
|
+
Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
78
|
+
|
|
78
79
|
export default Heading;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import DateComponent from './date';
|
|
5
5
|
const daysGridStyles = css({
|
|
6
6
|
display: 'grid',
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
5
|
const dayNameGridStyles = css({
|
|
6
6
|
display: 'grid',
|
|
@@ -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
|
@@ -8,7 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
/** @jsx jsx */
|
|
10
10
|
import { forwardRef, memo, useMemo } from 'react';
|
|
11
|
-
import { css, jsx } from '@emotion/
|
|
11
|
+
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
13
13
|
import noop from '@atlaskit/ds-lib/noop';
|
|
14
14
|
import { DN600, N0, N700, N900 } from '@atlaskit/theme/colors';
|
|
@@ -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.
|
|
57
|
+
packageVersion: "12.4.0"
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef, memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { dateCellStyles as getDateCellStyles } from '../styles/date';
|
|
6
6
|
var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref, ref) {
|
|
@@ -53,7 +53,7 @@ var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref, ref) {
|
|
|
53
53
|
}
|
|
54
54
|
}, [onClick]);
|
|
55
55
|
var dateCellStyles = useMemo(function () {
|
|
56
|
-
return getDateCellStyles(mode);
|
|
56
|
+
return css(getDateCellStyles(mode));
|
|
57
57
|
}, [mode]);
|
|
58
58
|
return jsx("button", {
|
|
59
59
|
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import Button from '@atlaskit/button/standard-button';
|
|
5
5
|
import ArrowleftIcon from '@atlaskit/icon/glyph/chevron-left-large';
|
|
6
6
|
import ArrowrightIcon from '@atlaskit/icon/glyph/chevron-right-large';
|
|
@@ -80,5 +80,6 @@ var Heading = /*#__PURE__*/memo(function Heading(_ref) {
|
|
|
80
80
|
})
|
|
81
81
|
}));
|
|
82
82
|
});
|
|
83
|
-
Heading.displayName = 'Heading';
|
|
83
|
+
Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
84
|
+
|
|
84
85
|
export default Heading;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import DateComponent from './date';
|
|
5
5
|
var daysGridStyles = css({
|
|
6
6
|
display: 'grid',
|
|
@@ -38,5 +38,6 @@ var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
|
|
|
38
38
|
}));
|
|
39
39
|
}));
|
|
40
40
|
});
|
|
41
|
-
WeekDays.displayName = 'WeekDays';
|
|
41
|
+
WeekDays.displayName = 'WeekDays'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
42
|
+
|
|
42
43
|
export default WeekDays;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
5
|
var dayNameGridStyles = css({
|
|
6
6
|
display: 'grid',
|
|
@@ -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
|
-
|
|
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
|
+
*/
|
|
12
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "style" | "disabled" | "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "className" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | "onSelect" | "selected" | "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
|
+
"version": "12.4.0",
|
|
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,14 +25,14 @@
|
|
|
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
|
-
"@atlaskit/theme": "^12.
|
|
31
|
+
"@atlaskit/theme": "^12.2.0",
|
|
32
32
|
"@atlaskit/tokens": "^0.10.0",
|
|
33
|
-
"@atlaskit/visually-hidden": "^1.
|
|
33
|
+
"@atlaskit/visually-hidden": "^1.1.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
|
-
"@emotion/
|
|
35
|
+
"@emotion/react": "^11.7.1",
|
|
36
36
|
"date-fns": "^2.17.0",
|
|
37
37
|
"react-uid": "^2.2.0"
|
|
38
38
|
},
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@atlaskit/docs": "*",
|
|
44
|
-
"@atlaskit/select": "^15.
|
|
44
|
+
"@atlaskit/select": "^15.7.0",
|
|
45
45
|
"@atlaskit/ssr": "*",
|
|
46
46
|
"@atlaskit/visual-regression": "*",
|
|
47
47
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react-dom": "^16.8.0",
|
|
54
54
|
"react-test-renderer": "^16.8.0",
|
|
55
55
|
"storybook-addon-performance": "^0.16.0",
|
|
56
|
-
"typescript": "4.
|
|
56
|
+
"typescript": "4.3.5",
|
|
57
57
|
"wait-for-expect": "^1.2.0"
|
|
58
58
|
},
|
|
59
59
|
"techstack": {
|
|
@@ -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"
|