@atlaskit/calendar 13.2.0 → 13.2.2
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 +13 -0
- package/dist/cjs/calendar.js +1 -1
- package/dist/cjs/internal/components/header.js +28 -3
- package/dist/es2019/calendar.js +1 -1
- package/dist/es2019/internal/components/header.js +25 -4
- package/dist/esm/calendar.js +1 -1
- package/dist/esm/internal/components/header.js +29 -4
- package/dist/types/internal/components/header.d.ts +2 -2
- package/dist/types-ts4.5/internal/components/header.d.ts +2 -2
- package/package.json +3 -2
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/calendar
|
|
2
2
|
|
|
3
|
+
## 13.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ceedd1f27df`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ceedd1f27df) - [ux] Ensures month/year does not render as live region until it has changed or has otherwise been interacted with for better usability. Part of feature flag for keyboard accessibility.
|
|
8
|
+
|
|
9
|
+
## 13.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`fd6bb9c9184`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd6bb9c9184) - Delete version.json
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 13.2.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/cjs/calendar.js
CHANGED
|
@@ -37,7 +37,7 @@ var boxStyles = (0, _primitives.xcss)({
|
|
|
37
37
|
var analyticsAttributes = {
|
|
38
38
|
componentName: 'calendar',
|
|
39
39
|
packageName: "@atlaskit/calendar",
|
|
40
|
-
packageVersion: "13.2.
|
|
40
|
+
packageVersion: "13.2.2"
|
|
41
41
|
};
|
|
42
42
|
var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
|
|
43
43
|
var day = _ref.day,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
9
|
var _react = require("react");
|
|
9
10
|
var _react2 = require("@emotion/react");
|
|
10
11
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
@@ -32,6 +33,30 @@ var Header = /*#__PURE__*/(0, _react.memo)(function Header(_ref) {
|
|
|
32
33
|
tabIndex = _ref.tabIndex,
|
|
33
34
|
testId = _ref.testId;
|
|
34
35
|
var announceId = (0, _useUniqueId.default)('month-year-announce');
|
|
36
|
+
|
|
37
|
+
// All of this is because `aria-atomic` is not fully supported for different
|
|
38
|
+
// assistive technologies. We want the value of the current month and year to
|
|
39
|
+
// be announced, but *only* if that value has been interacted with since
|
|
40
|
+
// being mounted. This allows us to conditionally apply the `aria-live`
|
|
41
|
+
// attribute. Without this, the `aria-live` property is set on mount and
|
|
42
|
+
// overrides the default input's readout in downstream consumers (e.g.
|
|
43
|
+
// datetime picker).
|
|
44
|
+
var _useState = (0, _react.useState)(false),
|
|
45
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
|
+
hasInteractedWithMonth = _useState2[0],
|
|
47
|
+
setHasInteractedWithMonth = _useState2[1];
|
|
48
|
+
var handlePrevMonthInteraction = function handlePrevMonthInteraction(e) {
|
|
49
|
+
if (!hasInteractedWithMonth) {
|
|
50
|
+
setHasInteractedWithMonth(true);
|
|
51
|
+
}
|
|
52
|
+
handleClickPrev(e);
|
|
53
|
+
};
|
|
54
|
+
var handleNextMonthInteraction = function handleNextMonthInteraction(e) {
|
|
55
|
+
if (!hasInteractedWithMonth) {
|
|
56
|
+
setHasInteractedWithMonth(true);
|
|
57
|
+
}
|
|
58
|
+
handleClickNext(e);
|
|
59
|
+
};
|
|
35
60
|
var renderedHeading = (0, _react2.jsx)(_heading.default, {
|
|
36
61
|
level: "h400",
|
|
37
62
|
as: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? 'h2' : 'div',
|
|
@@ -49,7 +74,7 @@ var Header = /*#__PURE__*/(0, _react.memo)(function Header(_ref) {
|
|
|
49
74
|
appearance: "subtle",
|
|
50
75
|
spacing: "none",
|
|
51
76
|
tabIndex: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? tabIndex : -1,
|
|
52
|
-
onClick:
|
|
77
|
+
onClick: handlePrevMonthInteraction,
|
|
53
78
|
testId: testId && "".concat(testId, "--previous-month"),
|
|
54
79
|
iconBefore: (0, _react2.jsx)(_chevronLeftLarge.default, {
|
|
55
80
|
label: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? "".concat(previousMonthLabel, ", ").concat(previousHeading) : previousMonthLabel,
|
|
@@ -60,14 +85,14 @@ var Header = /*#__PURE__*/(0, _react.memo)(function Header(_ref) {
|
|
|
60
85
|
}), (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.calendar-keyboard-accessibility_967h1') ?
|
|
61
86
|
// This is required to ensure that the new month/year is announced when the previous/next month buttons are activated
|
|
62
87
|
(0, _react2.jsx)(_primitives.Box, {
|
|
63
|
-
"aria-live":
|
|
88
|
+
"aria-live": hasInteractedWithMonth ? 'polite' : undefined,
|
|
64
89
|
id: announceId,
|
|
65
90
|
testId: testId && "".concat(testId, "--current-month-year--container")
|
|
66
91
|
}, renderedHeading) : renderedHeading, (0, _react2.jsx)(_standardButton.default, {
|
|
67
92
|
appearance: "subtle",
|
|
68
93
|
spacing: "none",
|
|
69
94
|
tabIndex: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? tabIndex : -1,
|
|
70
|
-
onClick:
|
|
95
|
+
onClick: handleNextMonthInteraction,
|
|
71
96
|
testId: testId && "".concat(testId, "--next-month"),
|
|
72
97
|
iconBefore: (0, _react2.jsx)(_chevronRightLarge.default, {
|
|
73
98
|
label: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? "".concat(nextMonthLabel, ", ").concat(nextHeading) : nextMonthLabel,
|
package/dist/es2019/calendar.js
CHANGED
|
@@ -27,7 +27,7 @@ const boxStyles = xcss({
|
|
|
27
27
|
const analyticsAttributes = {
|
|
28
28
|
componentName: 'calendar',
|
|
29
29
|
packageName: "@atlaskit/calendar",
|
|
30
|
-
packageVersion: "13.2.
|
|
30
|
+
packageVersion: "13.2.2"
|
|
31
31
|
};
|
|
32
32
|
const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
|
|
33
33
|
day,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useState } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import Button from '@atlaskit/button/standard-button';
|
|
5
5
|
import Heading from '@atlaskit/heading';
|
|
@@ -23,6 +23,27 @@ const Header = /*#__PURE__*/memo(function Header({
|
|
|
23
23
|
testId
|
|
24
24
|
}) {
|
|
25
25
|
const announceId = useUniqueId('month-year-announce');
|
|
26
|
+
|
|
27
|
+
// All of this is because `aria-atomic` is not fully supported for different
|
|
28
|
+
// assistive technologies. We want the value of the current month and year to
|
|
29
|
+
// be announced, but *only* if that value has been interacted with since
|
|
30
|
+
// being mounted. This allows us to conditionally apply the `aria-live`
|
|
31
|
+
// attribute. Without this, the `aria-live` property is set on mount and
|
|
32
|
+
// overrides the default input's readout in downstream consumers (e.g.
|
|
33
|
+
// datetime picker).
|
|
34
|
+
const [hasInteractedWithMonth, setHasInteractedWithMonth] = useState(false);
|
|
35
|
+
const handlePrevMonthInteraction = e => {
|
|
36
|
+
if (!hasInteractedWithMonth) {
|
|
37
|
+
setHasInteractedWithMonth(true);
|
|
38
|
+
}
|
|
39
|
+
handleClickPrev(e);
|
|
40
|
+
};
|
|
41
|
+
const handleNextMonthInteraction = e => {
|
|
42
|
+
if (!hasInteractedWithMonth) {
|
|
43
|
+
setHasInteractedWithMonth(true);
|
|
44
|
+
}
|
|
45
|
+
handleClickNext(e);
|
|
46
|
+
};
|
|
26
47
|
const renderedHeading = jsx(Heading, {
|
|
27
48
|
level: "h400",
|
|
28
49
|
as: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? 'h2' : 'div',
|
|
@@ -40,7 +61,7 @@ const Header = /*#__PURE__*/memo(function Header({
|
|
|
40
61
|
appearance: "subtle",
|
|
41
62
|
spacing: "none",
|
|
42
63
|
tabIndex: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? tabIndex : -1,
|
|
43
|
-
onClick:
|
|
64
|
+
onClick: handlePrevMonthInteraction,
|
|
44
65
|
testId: testId && `${testId}--previous-month`,
|
|
45
66
|
iconBefore: jsx(ArrowleftIcon, {
|
|
46
67
|
label: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? `${previousMonthLabel}, ${previousHeading}` : previousMonthLabel,
|
|
@@ -51,14 +72,14 @@ const Header = /*#__PURE__*/memo(function Header({
|
|
|
51
72
|
}), getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ?
|
|
52
73
|
// This is required to ensure that the new month/year is announced when the previous/next month buttons are activated
|
|
53
74
|
jsx(Box, {
|
|
54
|
-
"aria-live":
|
|
75
|
+
"aria-live": hasInteractedWithMonth ? 'polite' : undefined,
|
|
55
76
|
id: announceId,
|
|
56
77
|
testId: testId && `${testId}--current-month-year--container`
|
|
57
78
|
}, renderedHeading) : renderedHeading, jsx(Button, {
|
|
58
79
|
appearance: "subtle",
|
|
59
80
|
spacing: "none",
|
|
60
81
|
tabIndex: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? tabIndex : -1,
|
|
61
|
-
onClick:
|
|
82
|
+
onClick: handleNextMonthInteraction,
|
|
62
83
|
testId: testId && `${testId}--next-month`,
|
|
63
84
|
iconBefore: jsx(ArrowrightIcon, {
|
|
64
85
|
label: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? `${nextMonthLabel}, ${nextHeading}` : nextMonthLabel,
|
package/dist/esm/calendar.js
CHANGED
|
@@ -31,7 +31,7 @@ var boxStyles = xcss({
|
|
|
31
31
|
var analyticsAttributes = {
|
|
32
32
|
componentName: 'calendar',
|
|
33
33
|
packageName: "@atlaskit/calendar",
|
|
34
|
-
packageVersion: "13.2.
|
|
34
|
+
packageVersion: "13.2.2"
|
|
35
35
|
};
|
|
36
36
|
var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
37
37
|
var day = _ref.day,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
/** @jsx jsx */
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
+
import { memo, useState } from 'react';
|
|
3
4
|
import { jsx } from '@emotion/react';
|
|
4
5
|
import Button from '@atlaskit/button/standard-button';
|
|
5
6
|
import Heading from '@atlaskit/heading';
|
|
@@ -24,6 +25,30 @@ var Header = /*#__PURE__*/memo(function Header(_ref) {
|
|
|
24
25
|
tabIndex = _ref.tabIndex,
|
|
25
26
|
testId = _ref.testId;
|
|
26
27
|
var announceId = useUniqueId('month-year-announce');
|
|
28
|
+
|
|
29
|
+
// All of this is because `aria-atomic` is not fully supported for different
|
|
30
|
+
// assistive technologies. We want the value of the current month and year to
|
|
31
|
+
// be announced, but *only* if that value has been interacted with since
|
|
32
|
+
// being mounted. This allows us to conditionally apply the `aria-live`
|
|
33
|
+
// attribute. Without this, the `aria-live` property is set on mount and
|
|
34
|
+
// overrides the default input's readout in downstream consumers (e.g.
|
|
35
|
+
// datetime picker).
|
|
36
|
+
var _useState = useState(false),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
hasInteractedWithMonth = _useState2[0],
|
|
39
|
+
setHasInteractedWithMonth = _useState2[1];
|
|
40
|
+
var handlePrevMonthInteraction = function handlePrevMonthInteraction(e) {
|
|
41
|
+
if (!hasInteractedWithMonth) {
|
|
42
|
+
setHasInteractedWithMonth(true);
|
|
43
|
+
}
|
|
44
|
+
handleClickPrev(e);
|
|
45
|
+
};
|
|
46
|
+
var handleNextMonthInteraction = function handleNextMonthInteraction(e) {
|
|
47
|
+
if (!hasInteractedWithMonth) {
|
|
48
|
+
setHasInteractedWithMonth(true);
|
|
49
|
+
}
|
|
50
|
+
handleClickNext(e);
|
|
51
|
+
};
|
|
27
52
|
var renderedHeading = jsx(Heading, {
|
|
28
53
|
level: "h400",
|
|
29
54
|
as: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? 'h2' : 'div',
|
|
@@ -41,7 +66,7 @@ var Header = /*#__PURE__*/memo(function Header(_ref) {
|
|
|
41
66
|
appearance: "subtle",
|
|
42
67
|
spacing: "none",
|
|
43
68
|
tabIndex: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? tabIndex : -1,
|
|
44
|
-
onClick:
|
|
69
|
+
onClick: handlePrevMonthInteraction,
|
|
45
70
|
testId: testId && "".concat(testId, "--previous-month"),
|
|
46
71
|
iconBefore: jsx(ArrowleftIcon, {
|
|
47
72
|
label: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? "".concat(previousMonthLabel, ", ").concat(previousHeading) : previousMonthLabel,
|
|
@@ -52,14 +77,14 @@ var Header = /*#__PURE__*/memo(function Header(_ref) {
|
|
|
52
77
|
}), getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ?
|
|
53
78
|
// This is required to ensure that the new month/year is announced when the previous/next month buttons are activated
|
|
54
79
|
jsx(Box, {
|
|
55
|
-
"aria-live":
|
|
80
|
+
"aria-live": hasInteractedWithMonth ? 'polite' : undefined,
|
|
56
81
|
id: announceId,
|
|
57
82
|
testId: testId && "".concat(testId, "--current-month-year--container")
|
|
58
83
|
}, renderedHeading) : renderedHeading, jsx(Button, {
|
|
59
84
|
appearance: "subtle",
|
|
60
85
|
spacing: "none",
|
|
61
86
|
tabIndex: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? tabIndex : -1,
|
|
62
|
-
onClick:
|
|
87
|
+
onClick: handleNextMonthInteraction,
|
|
63
88
|
testId: testId && "".concat(testId, "--next-month"),
|
|
64
89
|
iconBefore: jsx(ArrowrightIcon, {
|
|
65
90
|
label: getBooleanFF('platform.design-system-team.calendar-keyboard-accessibility_967h1') ? "".concat(nextMonthLabel, ", ").concat(nextHeading) : nextMonthLabel,
|
|
@@ -8,8 +8,8 @@ interface HeaderProps {
|
|
|
8
8
|
previousHeading: string;
|
|
9
9
|
nextMonthLabel?: string;
|
|
10
10
|
nextHeading: string;
|
|
11
|
-
handleClickNext
|
|
12
|
-
handleClickPrev
|
|
11
|
+
handleClickNext: (e: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
+
handleClickPrev: (e: React.MouseEvent<HTMLElement>) => void;
|
|
13
13
|
mode?: ThemeModes;
|
|
14
14
|
headerId: string;
|
|
15
15
|
tabIndex?: TabIndex;
|
|
@@ -8,8 +8,8 @@ interface HeaderProps {
|
|
|
8
8
|
previousHeading: string;
|
|
9
9
|
nextMonthLabel?: string;
|
|
10
10
|
nextHeading: string;
|
|
11
|
-
handleClickNext
|
|
12
|
-
handleClickPrev
|
|
11
|
+
handleClickNext: (e: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
+
handleClickPrev: (e: React.MouseEvent<HTMLElement>) => void;
|
|
13
13
|
mode?: ThemeModes;
|
|
14
14
|
headerId: string;
|
|
15
15
|
tabIndex?: TabIndex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.2",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/platform-feature-flags": "*",
|
|
42
42
|
"@atlaskit/primitives": "^1.2.0",
|
|
43
43
|
"@atlaskit/theme": "^12.5.0",
|
|
44
|
-
"@atlaskit/tokens": "^1.
|
|
44
|
+
"@atlaskit/tokens": "^1.15.0",
|
|
45
45
|
"@atlaskit/visually-hidden": "^1.2.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"@emotion/react": "^11.7.1",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"react": "^16.8.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
+
"@af/accessibility-testing": "*",
|
|
55
56
|
"@atlaskit/ssr": "*",
|
|
56
57
|
"@atlaskit/visual-regression": "*",
|
|
57
58
|
"@atlaskit/webdriver-runner": "*",
|
package/dist/cjs/version.json
DELETED
package/dist/es2019/version.json
DELETED