@atlaskit/calendar 13.3.1 → 13.3.3

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.
@@ -35,7 +35,7 @@ var boxStyles = (0, _primitives.xcss)({
35
35
  var analyticsAttributes = {
36
36
  componentName: 'calendar',
37
37
  packageName: "@atlaskit/calendar",
38
- packageVersion: "13.3.1"
38
+ packageVersion: "13.3.3"
39
39
  };
40
40
  var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
41
41
  var day = _ref.day,
@@ -191,58 +191,55 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
191
191
  return "".concat(monthsLong[previousMonth], " ").concat(showPreviousYear ? yearValue - 1 : yearValue);
192
192
  };
193
193
  var headerId = (0, _useUniqueId.default)('month-year-header');
194
- return (
195
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/no-static-element-interactions
196
- (0, _react2.jsx)("div", {
197
- className: className,
198
- style: style,
199
- onBlur: handleContainerBlur,
200
- onFocus: handleContainerFocus,
201
- "data-testid": testId && "".concat(testId, "--container"),
202
- ref: ref
203
- }, (0, _react2.jsx)(_primitives.Box, {
204
- xcss: boxStyles,
205
- padding: "space.200",
206
- "aria-label": "calendar",
207
- testId: testId && "".concat(testId, "--calendar")
208
- }, (0, _react2.jsx)(_primitives.Stack, {
209
- space: "space.150"
210
- }, (0, _react2.jsx)(_header.default
211
- // The month number needs to be translated to index in the month
212
- // name array e.g. 1 (January) -> 0
213
- , {
214
- monthLongTitle: monthsLong[monthValue - 1],
215
- year: yearValue,
216
- nextMonthLabel: nextMonthLabel,
217
- previousMonthLabel: previousMonthLabel,
218
- nextHeading: getNextHeading(),
219
- previousHeading: getPreviousHeading(),
220
- handleClickNext: handleClickNext,
221
- handleClickPrev: handleClickPrev,
222
- headerId: headerId,
223
- mode: mode,
224
- tabIndex: tabIndex,
225
- testId: testId
226
- }), (0, _react2.jsx)(_primitives.Box, {
227
- role: "grid",
228
- tabIndex: tabIndex,
229
- onKeyDown: handleContainerKeyDown,
230
- "aria-labelledby": headerId,
231
- testId: testId && "".concat(testId, "--calendar-dates")
232
- }, (0, _react2.jsx)(_weekHeader.default, {
233
- daysShort: daysShort,
234
- mode: mode,
235
- testId: testId
236
- }), (0, _react2.jsx)(_weekDays.default, {
237
- weeks: weeks,
238
- handleClickDay: handleClickDay,
239
- mode: mode,
240
- monthsLong: monthsLong,
241
- shouldSetFocus: shouldSetFocus,
242
- tabIndex: tabIndex,
243
- testId: testId
244
- })))))
245
- );
194
+ return (0, _react2.jsx)("div", {
195
+ className: className,
196
+ style: style,
197
+ onBlur: handleContainerBlur,
198
+ onFocus: handleContainerFocus,
199
+ "data-testid": testId && "".concat(testId, "--container"),
200
+ ref: ref
201
+ }, (0, _react2.jsx)(_primitives.Box, {
202
+ xcss: boxStyles,
203
+ padding: "space.200",
204
+ "aria-label": "calendar",
205
+ testId: testId && "".concat(testId, "--calendar")
206
+ }, (0, _react2.jsx)(_primitives.Stack, {
207
+ space: "space.150"
208
+ }, (0, _react2.jsx)(_header.default
209
+ // The month number needs to be translated to index in the month
210
+ // name array e.g. 1 (January) -> 0
211
+ , {
212
+ monthLongTitle: monthsLong[monthValue - 1],
213
+ year: yearValue,
214
+ nextMonthLabel: nextMonthLabel,
215
+ previousMonthLabel: previousMonthLabel,
216
+ nextHeading: getNextHeading(),
217
+ previousHeading: getPreviousHeading(),
218
+ handleClickNext: handleClickNext,
219
+ handleClickPrev: handleClickPrev,
220
+ headerId: headerId,
221
+ mode: mode,
222
+ tabIndex: tabIndex,
223
+ testId: testId
224
+ }), (0, _react2.jsx)(_primitives.Box, {
225
+ role: "grid",
226
+ tabIndex: tabIndex,
227
+ onKeyDown: handleContainerKeyDown,
228
+ "aria-labelledby": headerId,
229
+ testId: testId && "".concat(testId, "--calendar-dates")
230
+ }, (0, _react2.jsx)(_weekHeader.default, {
231
+ daysShort: daysShort,
232
+ mode: mode,
233
+ testId: testId
234
+ }), (0, _react2.jsx)(_weekDays.default, {
235
+ weeks: weeks,
236
+ handleClickDay: handleClickDay,
237
+ mode: mode,
238
+ monthsLong: monthsLong,
239
+ shouldSetFocus: shouldSetFocus,
240
+ tabIndex: tabIndex,
241
+ testId: testId
242
+ })))));
246
243
  });
247
244
 
248
245
  /**
@@ -264,5 +261,4 @@ var Calendar = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
264
261
  });
265
262
  }));
266
263
  Calendar.displayName = 'Calendar';
267
- var _default = Calendar;
268
- exports.default = _default;
264
+ var _default = exports.default = Calendar;
@@ -12,30 +12,30 @@ var _primitives = require("@atlaskit/primitives");
12
12
  var _date = require("../styles/date");
13
13
  /** @jsx jsx */
14
14
 
15
- var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Date(_ref, ref) {
16
- var day = _ref.children,
17
- _ref$isDisabled = _ref.isDisabled,
18
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
19
- _ref$isFocused = _ref.isFocused,
20
- isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
21
- _ref$isToday = _ref.isToday,
22
- isToday = _ref$isToday === void 0 ? false : _ref$isToday,
23
- dayLong = _ref.dayLong,
24
- month = _ref.month,
25
- monthLong = _ref.monthLong,
26
- _ref$onClick = _ref.onClick,
27
- onClick = _ref$onClick === void 0 ? _noop.default : _ref$onClick,
28
- _ref$isPreviouslySele = _ref.isPreviouslySelected,
29
- isPreviouslySelected = _ref$isPreviouslySele === void 0 ? false : _ref$isPreviouslySele,
30
- _ref$isSelected = _ref.isSelected,
31
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
32
- _ref$isSibling = _ref.isSibling,
33
- isSibling = _ref$isSibling === void 0 ? false : _ref$isSibling,
34
- year = _ref.year,
35
- mode = _ref.mode,
36
- shouldSetFocus = _ref.shouldSetFocus,
37
- tabIndex = _ref.tabIndex,
38
- testId = _ref.testId;
15
+ var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function Date(_ref2, _ref) {
16
+ var day = _ref2.children,
17
+ _ref2$isDisabled = _ref2.isDisabled,
18
+ isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
19
+ _ref2$isFocused = _ref2.isFocused,
20
+ isFocused = _ref2$isFocused === void 0 ? false : _ref2$isFocused,
21
+ _ref2$isToday = _ref2.isToday,
22
+ isToday = _ref2$isToday === void 0 ? false : _ref2$isToday,
23
+ dayLong = _ref2.dayLong,
24
+ month = _ref2.month,
25
+ monthLong = _ref2.monthLong,
26
+ _ref2$onClick = _ref2.onClick,
27
+ onClick = _ref2$onClick === void 0 ? _noop.default : _ref2$onClick,
28
+ _ref2$isPreviouslySel = _ref2.isPreviouslySelected,
29
+ isPreviouslySelected = _ref2$isPreviouslySel === void 0 ? false : _ref2$isPreviouslySel,
30
+ _ref2$isSelected = _ref2.isSelected,
31
+ isSelected = _ref2$isSelected === void 0 ? false : _ref2$isSelected,
32
+ _ref2$isSibling = _ref2.isSibling,
33
+ isSibling = _ref2$isSibling === void 0 ? false : _ref2$isSibling,
34
+ year = _ref2.year,
35
+ mode = _ref2.mode,
36
+ shouldSetFocus = _ref2.shouldSetFocus,
37
+ tabIndex = _ref2.tabIndex,
38
+ testId = _ref2.testId;
39
39
  var dateRef = (0, _react.useRef)({
40
40
  day: day,
41
41
  month: month,
@@ -99,5 +99,4 @@ var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
99
99
  Date.displayName = 'Date';
100
100
 
101
101
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
102
- var _default = Date;
103
- exports.default = _default;
102
+ var _default = exports.default = Date;
@@ -100,5 +100,4 @@ var Header = /*#__PURE__*/(0, _react.memo)(function Header(_ref) {
100
100
  Header.displayName = 'Header';
101
101
 
102
102
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
103
- var _default = Header;
104
- exports.default = _default;
103
+ var _default = exports.default = Header;
@@ -27,5 +27,4 @@ var WeekDayGrid = function WeekDayGrid(_ref) {
27
27
  "aria-hidden": "true"
28
28
  }, row) : row;
29
29
  };
30
- var _default = WeekDayGrid;
31
- exports.default = _default;
30
+ var _default = exports.default = WeekDayGrid;
@@ -20,42 +20,36 @@ var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
20
20
  shouldSetFocus = _ref.shouldSetFocus,
21
21
  tabIndex = _ref.tabIndex,
22
22
  testId = _ref.testId;
23
- return (
24
- // TODO: Determine if there is a better way to render the button (should be
25
- // fixed with introduction of keyboard accessibility of Calendar in
26
- // DSP-9939) (DSP-11588)
27
- (0, _react2.jsx)(_box.default, {
28
- role: "rowgroup",
29
- testId: testId && "".concat(testId, "--month")
30
- }, weeks.map(function (week, i) {
31
- return (0, _react2.jsx)(_weekDayGrid.default, {
32
- key: i,
33
- testId: testId && "".concat(testId, "--week")
34
- }, week.values.map(function (weekDay) {
35
- return (0, _react2.jsx)(_date.default, {
36
- key: "".concat(week.id, "-").concat(weekDay.id),
37
- isDisabled: weekDay.isDisabled,
38
- isFocused: weekDay.isFocused,
39
- isToday: weekDay.isToday,
40
- dayLong: weekDay.weekDayName,
41
- month: weekDay.month,
42
- monthLong: monthsLong[weekDay.month - 1],
43
- onClick: handleClickDay,
44
- isPreviouslySelected: weekDay.isPreviouslySelected,
45
- isSelected: weekDay.isSelected,
46
- isSibling: weekDay.isSiblingMonth,
47
- year: weekDay.year,
48
- mode: mode,
49
- shouldSetFocus: shouldSetFocus,
50
- tabIndex: tabIndex,
51
- testId: testId
52
- }, weekDay.day);
53
- }));
54
- }))
55
- );
23
+ return (0, _react2.jsx)(_box.default, {
24
+ role: "rowgroup",
25
+ testId: testId && "".concat(testId, "--month")
26
+ }, weeks.map(function (week, i) {
27
+ return (0, _react2.jsx)(_weekDayGrid.default, {
28
+ key: i,
29
+ testId: testId && "".concat(testId, "--week")
30
+ }, week.values.map(function (weekDay) {
31
+ return (0, _react2.jsx)(_date.default, {
32
+ key: "".concat(week.id, "-").concat(weekDay.id),
33
+ isDisabled: weekDay.isDisabled,
34
+ isFocused: weekDay.isFocused,
35
+ isToday: weekDay.isToday,
36
+ dayLong: weekDay.weekDayName,
37
+ month: weekDay.month,
38
+ monthLong: monthsLong[weekDay.month - 1],
39
+ onClick: handleClickDay,
40
+ isPreviouslySelected: weekDay.isPreviouslySelected,
41
+ isSelected: weekDay.isSelected,
42
+ isSibling: weekDay.isSiblingMonth,
43
+ year: weekDay.year,
44
+ mode: mode,
45
+ shouldSetFocus: shouldSetFocus,
46
+ tabIndex: tabIndex,
47
+ testId: testId
48
+ }, weekDay.day);
49
+ }));
50
+ }));
56
51
  });
57
52
  WeekDays.displayName = 'WeekDays';
58
53
 
59
54
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
60
- var _default = WeekDays;
61
- exports.default = _default;
55
+ var _default = exports.default = WeekDays;
@@ -46,5 +46,4 @@ var WeekHeader = /*#__PURE__*/(0, _react.memo)(function WeekHeader(_ref) {
46
46
  WeekHeader.displayName = 'WeekHeader';
47
47
 
48
48
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
49
- var _default = WeekHeader;
50
- exports.default = _default;
49
+ var _default = exports.default = WeekHeader;
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.monthsPerYear = exports.daysPerWeek = exports.blankStringArray = exports.arrowKeys = void 0;
7
- var arrowKeys = {
7
+ var arrowKeys = exports.arrowKeys = {
8
8
  ArrowDown: 'down',
9
9
  ArrowLeft: 'left',
10
10
  ArrowRight: 'right',
11
11
  ArrowUp: 'up'
12
12
  };
13
- exports.arrowKeys = arrowKeys;
14
- var daysPerWeek = 7;
15
- exports.daysPerWeek = daysPerWeek;
16
- var monthsPerYear = 12;
17
- exports.monthsPerYear = monthsPerYear;
18
- var blankStringArray = [];
19
- exports.blankStringArray = blankStringArray;
13
+ var daysPerWeek = exports.daysPerWeek = 7;
14
+ var monthsPerYear = exports.monthsPerYear = 12;
15
+ var blankStringArray = exports.blankStringArray = [];
@@ -54,7 +54,7 @@ function useHandleDateChange(_ref) {
54
54
  yearValue = _ref$year[0],
55
55
  setYearValue = _ref$year[1],
56
56
  _ref$shouldSetFocus = (0, _slicedToArray2.default)(_ref.shouldSetFocus, 2),
57
- shouldSetFocus = _ref$shouldSetFocus[0],
57
+ _shouldSetFocus = _ref$shouldSetFocus[0],
58
58
  setShouldSetFocus = _ref$shouldSetFocus[1],
59
59
  onChange = _ref.onChange;
60
60
  var dateRef = (0, _react.useRef)({
@@ -30,7 +30,7 @@ var borderColorFocused = {
30
30
  light: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
31
31
  dark: "var(--ds-border-focused, ".concat(_colors.B100, ")")
32
32
  };
33
- var dateCellStyles = function dateCellStyles() {
33
+ var dateCellStyles = exports.dateCellStyles = function dateCellStyles() {
34
34
  var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
35
35
  return {
36
36
  all: 'unset',
@@ -100,5 +100,4 @@ var dateCellStyles = function dateCellStyles() {
100
100
  color: "var(--ds-text-disabled, ".concat(_colors.N40, ")")
101
101
  }
102
102
  };
103
- };
104
- exports.dateCellStyles = dateCellStyles;
103
+ };
@@ -25,7 +25,7 @@ const boxStyles = xcss({
25
25
  const analyticsAttributes = {
26
26
  componentName: 'calendar',
27
27
  packageName: "@atlaskit/calendar",
28
- packageVersion: "13.3.1"
28
+ packageVersion: "13.3.3"
29
29
  };
30
30
  const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
31
31
  day,
@@ -162,58 +162,55 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
162
162
  return `${monthsLong[previousMonth]} ${showPreviousYear ? yearValue - 1 : yearValue}`;
163
163
  };
164
164
  const headerId = useUniqueId('month-year-header');
165
- return (
166
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/no-static-element-interactions
167
- jsx("div", {
168
- className: className,
169
- style: style,
170
- onBlur: handleContainerBlur,
171
- onFocus: handleContainerFocus,
172
- "data-testid": testId && `${testId}--container`,
173
- ref: ref
174
- }, jsx(Box, {
175
- xcss: boxStyles,
176
- padding: "space.200",
177
- "aria-label": "calendar",
178
- testId: testId && `${testId}--calendar`
179
- }, jsx(Stack, {
180
- space: "space.150"
181
- }, jsx(Header
182
- // The month number needs to be translated to index in the month
183
- // name array e.g. 1 (January) -> 0
184
- , {
185
- monthLongTitle: monthsLong[monthValue - 1],
186
- year: yearValue,
187
- nextMonthLabel: nextMonthLabel,
188
- previousMonthLabel: previousMonthLabel,
189
- nextHeading: getNextHeading(),
190
- previousHeading: getPreviousHeading(),
191
- handleClickNext: handleClickNext,
192
- handleClickPrev: handleClickPrev,
193
- headerId: headerId,
194
- mode: mode,
195
- tabIndex: tabIndex,
196
- testId: testId
197
- }), jsx(Box, {
198
- role: "grid",
199
- tabIndex: tabIndex,
200
- onKeyDown: handleContainerKeyDown,
201
- "aria-labelledby": headerId,
202
- testId: testId && `${testId}--calendar-dates`
203
- }, jsx(WeekHeaderComponent, {
204
- daysShort: daysShort,
205
- mode: mode,
206
- testId: testId
207
- }), jsx(WeekDaysComponent, {
208
- weeks: weeks,
209
- handleClickDay: handleClickDay,
210
- mode: mode,
211
- monthsLong: monthsLong,
212
- shouldSetFocus: shouldSetFocus,
213
- tabIndex: tabIndex,
214
- testId: testId
215
- })))))
216
- );
165
+ return jsx("div", {
166
+ className: className,
167
+ style: style,
168
+ onBlur: handleContainerBlur,
169
+ onFocus: handleContainerFocus,
170
+ "data-testid": testId && `${testId}--container`,
171
+ ref: ref
172
+ }, jsx(Box, {
173
+ xcss: boxStyles,
174
+ padding: "space.200",
175
+ "aria-label": "calendar",
176
+ testId: testId && `${testId}--calendar`
177
+ }, jsx(Stack, {
178
+ space: "space.150"
179
+ }, jsx(Header
180
+ // The month number needs to be translated to index in the month
181
+ // name array e.g. 1 (January) -> 0
182
+ , {
183
+ monthLongTitle: monthsLong[monthValue - 1],
184
+ year: yearValue,
185
+ nextMonthLabel: nextMonthLabel,
186
+ previousMonthLabel: previousMonthLabel,
187
+ nextHeading: getNextHeading(),
188
+ previousHeading: getPreviousHeading(),
189
+ handleClickNext: handleClickNext,
190
+ handleClickPrev: handleClickPrev,
191
+ headerId: headerId,
192
+ mode: mode,
193
+ tabIndex: tabIndex,
194
+ testId: testId
195
+ }), jsx(Box, {
196
+ role: "grid",
197
+ tabIndex: tabIndex,
198
+ onKeyDown: handleContainerKeyDown,
199
+ "aria-labelledby": headerId,
200
+ testId: testId && `${testId}--calendar-dates`
201
+ }, jsx(WeekHeaderComponent, {
202
+ daysShort: daysShort,
203
+ mode: mode,
204
+ testId: testId
205
+ }), jsx(WeekDaysComponent, {
206
+ weeks: weeks,
207
+ handleClickDay: handleClickDay,
208
+ mode: mode,
209
+ monthsLong: monthsLong,
210
+ shouldSetFocus: shouldSetFocus,
211
+ tabIndex: tabIndex,
212
+ testId: testId
213
+ })))));
217
214
  });
218
215
 
219
216
  /**
@@ -21,7 +21,7 @@ const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
21
21
  shouldSetFocus,
22
22
  tabIndex,
23
23
  testId
24
- }, ref) {
24
+ }, _ref) {
25
25
  const dateRef = useRef({
26
26
  day,
27
27
  month,
@@ -13,35 +13,30 @@ const WeekDays = /*#__PURE__*/memo(function WeekDays({
13
13
  tabIndex,
14
14
  testId
15
15
  }) {
16
- return (
17
- // TODO: Determine if there is a better way to render the button (should be
18
- // fixed with introduction of keyboard accessibility of Calendar in
19
- // DSP-9939) (DSP-11588)
20
- jsx(Box, {
21
- role: "rowgroup",
22
- testId: testId && `${testId}--month`
23
- }, weeks.map((week, i) => jsx(WeekdayGrid, {
24
- key: i,
25
- testId: testId && `${testId}--week`
26
- }, week.values.map(weekDay => jsx(DateComponent, {
27
- key: `${week.id}-${weekDay.id}`,
28
- isDisabled: weekDay.isDisabled,
29
- isFocused: weekDay.isFocused,
30
- isToday: weekDay.isToday,
31
- dayLong: weekDay.weekDayName,
32
- month: weekDay.month,
33
- monthLong: monthsLong[weekDay.month - 1],
34
- onClick: handleClickDay,
35
- isPreviouslySelected: weekDay.isPreviouslySelected,
36
- isSelected: weekDay.isSelected,
37
- isSibling: weekDay.isSiblingMonth,
38
- year: weekDay.year,
39
- mode: mode,
40
- shouldSetFocus: shouldSetFocus,
41
- tabIndex: tabIndex,
42
- testId: testId
43
- }, weekDay.day)))))
44
- );
16
+ return jsx(Box, {
17
+ role: "rowgroup",
18
+ testId: testId && `${testId}--month`
19
+ }, weeks.map((week, i) => jsx(WeekdayGrid, {
20
+ key: i,
21
+ testId: testId && `${testId}--week`
22
+ }, week.values.map(weekDay => jsx(DateComponent, {
23
+ key: `${week.id}-${weekDay.id}`,
24
+ isDisabled: weekDay.isDisabled,
25
+ isFocused: weekDay.isFocused,
26
+ isToday: weekDay.isToday,
27
+ dayLong: weekDay.weekDayName,
28
+ month: weekDay.month,
29
+ monthLong: monthsLong[weekDay.month - 1],
30
+ onClick: handleClickDay,
31
+ isPreviouslySelected: weekDay.isPreviouslySelected,
32
+ isSelected: weekDay.isSelected,
33
+ isSibling: weekDay.isSiblingMonth,
34
+ year: weekDay.year,
35
+ mode: mode,
36
+ shouldSetFocus: shouldSetFocus,
37
+ tabIndex: tabIndex,
38
+ testId: testId
39
+ }, weekDay.day)))));
45
40
  });
46
41
  WeekDays.displayName = 'WeekDays';
47
42
 
@@ -36,7 +36,7 @@ export default function useHandleDateChange({
36
36
  day: [dayValue, setDayValue],
37
37
  month: [monthValue, setMonthValue],
38
38
  year: [yearValue, setYearValue],
39
- shouldSetFocus: [shouldSetFocus, setShouldSetFocus],
39
+ shouldSetFocus: [_shouldSetFocus, setShouldSetFocus],
40
40
  onChange
41
41
  }) {
42
42
  const dateRef = useRef({