@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.
- package/CHANGELOG.md +78 -66
- package/codemods/utils.tsx +2 -1
- package/dist/cjs/calendar.js +51 -55
- package/dist/cjs/internal/components/date.js +25 -26
- package/dist/cjs/internal/components/header.js +1 -2
- package/dist/cjs/internal/components/week-day-grid.js +1 -2
- package/dist/cjs/internal/components/week-days.js +29 -35
- package/dist/cjs/internal/components/week-header.js +1 -2
- package/dist/cjs/internal/constants.js +4 -8
- package/dist/cjs/internal/hooks/use-handle-date-change.js +1 -1
- package/dist/cjs/internal/styles/date.js +2 -3
- package/dist/es2019/calendar.js +50 -53
- package/dist/es2019/internal/components/date.js +1 -1
- package/dist/es2019/internal/components/week-days.js +24 -29
- package/dist/es2019/internal/hooks/use-handle-date-change.js +1 -1
- package/dist/esm/calendar.js +50 -53
- package/dist/esm/internal/components/date.js +24 -24
- package/dist/esm/internal/components/week-days.js +28 -33
- package/dist/esm/internal/hooks/use-handle-date-change.js +1 -1
- package/dist/types/internal/hooks/use-handle-date-change.d.ts +1 -1
- package/dist/types-ts4.5/internal/hooks/use-handle-date-change.d.ts +1 -1
- package/package.json +7 -7
package/dist/esm/calendar.js
CHANGED
|
@@ -29,7 +29,7 @@ var boxStyles = xcss({
|
|
|
29
29
|
var analyticsAttributes = {
|
|
30
30
|
componentName: 'calendar',
|
|
31
31
|
packageName: "@atlaskit/calendar",
|
|
32
|
-
packageVersion: "13.3.
|
|
32
|
+
packageVersion: "13.3.3"
|
|
33
33
|
};
|
|
34
34
|
var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
35
35
|
var day = _ref.day,
|
|
@@ -185,58 +185,55 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
185
185
|
return "".concat(monthsLong[previousMonth], " ").concat(showPreviousYear ? yearValue - 1 : yearValue);
|
|
186
186
|
};
|
|
187
187
|
var headerId = useUniqueId('month-year-header');
|
|
188
|
-
return (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
testId: testId
|
|
238
|
-
})))))
|
|
239
|
-
);
|
|
188
|
+
return jsx("div", {
|
|
189
|
+
className: className,
|
|
190
|
+
style: style,
|
|
191
|
+
onBlur: handleContainerBlur,
|
|
192
|
+
onFocus: handleContainerFocus,
|
|
193
|
+
"data-testid": testId && "".concat(testId, "--container"),
|
|
194
|
+
ref: ref
|
|
195
|
+
}, jsx(Box, {
|
|
196
|
+
xcss: boxStyles,
|
|
197
|
+
padding: "space.200",
|
|
198
|
+
"aria-label": "calendar",
|
|
199
|
+
testId: testId && "".concat(testId, "--calendar")
|
|
200
|
+
}, jsx(Stack, {
|
|
201
|
+
space: "space.150"
|
|
202
|
+
}, jsx(Header
|
|
203
|
+
// The month number needs to be translated to index in the month
|
|
204
|
+
// name array e.g. 1 (January) -> 0
|
|
205
|
+
, {
|
|
206
|
+
monthLongTitle: monthsLong[monthValue - 1],
|
|
207
|
+
year: yearValue,
|
|
208
|
+
nextMonthLabel: nextMonthLabel,
|
|
209
|
+
previousMonthLabel: previousMonthLabel,
|
|
210
|
+
nextHeading: getNextHeading(),
|
|
211
|
+
previousHeading: getPreviousHeading(),
|
|
212
|
+
handleClickNext: handleClickNext,
|
|
213
|
+
handleClickPrev: handleClickPrev,
|
|
214
|
+
headerId: headerId,
|
|
215
|
+
mode: mode,
|
|
216
|
+
tabIndex: tabIndex,
|
|
217
|
+
testId: testId
|
|
218
|
+
}), jsx(Box, {
|
|
219
|
+
role: "grid",
|
|
220
|
+
tabIndex: tabIndex,
|
|
221
|
+
onKeyDown: handleContainerKeyDown,
|
|
222
|
+
"aria-labelledby": headerId,
|
|
223
|
+
testId: testId && "".concat(testId, "--calendar-dates")
|
|
224
|
+
}, jsx(WeekHeaderComponent, {
|
|
225
|
+
daysShort: daysShort,
|
|
226
|
+
mode: mode,
|
|
227
|
+
testId: testId
|
|
228
|
+
}), jsx(WeekDaysComponent, {
|
|
229
|
+
weeks: weeks,
|
|
230
|
+
handleClickDay: handleClickDay,
|
|
231
|
+
mode: mode,
|
|
232
|
+
monthsLong: monthsLong,
|
|
233
|
+
shouldSetFocus: shouldSetFocus,
|
|
234
|
+
tabIndex: tabIndex,
|
|
235
|
+
testId: testId
|
|
236
|
+
})))));
|
|
240
237
|
});
|
|
241
238
|
|
|
242
239
|
/**
|
|
@@ -4,30 +4,30 @@ import { css, jsx } from '@emotion/react';
|
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { Grid } from '@atlaskit/primitives';
|
|
6
6
|
import { dateCellStyles as getDateCellStyles } from '../styles/date';
|
|
7
|
-
var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(
|
|
8
|
-
var day =
|
|
9
|
-
|
|
10
|
-
isDisabled =
|
|
11
|
-
|
|
12
|
-
isFocused =
|
|
13
|
-
|
|
14
|
-
isToday =
|
|
15
|
-
dayLong =
|
|
16
|
-
month =
|
|
17
|
-
monthLong =
|
|
18
|
-
|
|
19
|
-
onClick =
|
|
20
|
-
|
|
21
|
-
isPreviouslySelected =
|
|
22
|
-
|
|
23
|
-
isSelected =
|
|
24
|
-
|
|
25
|
-
isSibling =
|
|
26
|
-
year =
|
|
27
|
-
mode =
|
|
28
|
-
shouldSetFocus =
|
|
29
|
-
tabIndex =
|
|
30
|
-
testId =
|
|
7
|
+
var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref2, _ref) {
|
|
8
|
+
var day = _ref2.children,
|
|
9
|
+
_ref2$isDisabled = _ref2.isDisabled,
|
|
10
|
+
isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
|
|
11
|
+
_ref2$isFocused = _ref2.isFocused,
|
|
12
|
+
isFocused = _ref2$isFocused === void 0 ? false : _ref2$isFocused,
|
|
13
|
+
_ref2$isToday = _ref2.isToday,
|
|
14
|
+
isToday = _ref2$isToday === void 0 ? false : _ref2$isToday,
|
|
15
|
+
dayLong = _ref2.dayLong,
|
|
16
|
+
month = _ref2.month,
|
|
17
|
+
monthLong = _ref2.monthLong,
|
|
18
|
+
_ref2$onClick = _ref2.onClick,
|
|
19
|
+
onClick = _ref2$onClick === void 0 ? noop : _ref2$onClick,
|
|
20
|
+
_ref2$isPreviouslySel = _ref2.isPreviouslySelected,
|
|
21
|
+
isPreviouslySelected = _ref2$isPreviouslySel === void 0 ? false : _ref2$isPreviouslySel,
|
|
22
|
+
_ref2$isSelected = _ref2.isSelected,
|
|
23
|
+
isSelected = _ref2$isSelected === void 0 ? false : _ref2$isSelected,
|
|
24
|
+
_ref2$isSibling = _ref2.isSibling,
|
|
25
|
+
isSibling = _ref2$isSibling === void 0 ? false : _ref2$isSibling,
|
|
26
|
+
year = _ref2.year,
|
|
27
|
+
mode = _ref2.mode,
|
|
28
|
+
shouldSetFocus = _ref2.shouldSetFocus,
|
|
29
|
+
tabIndex = _ref2.tabIndex,
|
|
30
|
+
testId = _ref2.testId;
|
|
31
31
|
var dateRef = useRef({
|
|
32
32
|
day: day,
|
|
33
33
|
month: month,
|
|
@@ -12,39 +12,34 @@ var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
|
|
|
12
12
|
shouldSetFocus = _ref.shouldSetFocus,
|
|
13
13
|
tabIndex = _ref.tabIndex,
|
|
14
14
|
testId = _ref.testId;
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
jsx(
|
|
20
|
-
|
|
21
|
-
testId: testId && "".concat(testId, "--
|
|
22
|
-
},
|
|
23
|
-
return jsx(
|
|
24
|
-
key:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
testId: testId
|
|
44
|
-
}, weekDay.day);
|
|
45
|
-
}));
|
|
46
|
-
}))
|
|
47
|
-
);
|
|
15
|
+
return jsx(Box, {
|
|
16
|
+
role: "rowgroup",
|
|
17
|
+
testId: testId && "".concat(testId, "--month")
|
|
18
|
+
}, weeks.map(function (week, i) {
|
|
19
|
+
return jsx(WeekdayGrid, {
|
|
20
|
+
key: i,
|
|
21
|
+
testId: testId && "".concat(testId, "--week")
|
|
22
|
+
}, week.values.map(function (weekDay) {
|
|
23
|
+
return jsx(DateComponent, {
|
|
24
|
+
key: "".concat(week.id, "-").concat(weekDay.id),
|
|
25
|
+
isDisabled: weekDay.isDisabled,
|
|
26
|
+
isFocused: weekDay.isFocused,
|
|
27
|
+
isToday: weekDay.isToday,
|
|
28
|
+
dayLong: weekDay.weekDayName,
|
|
29
|
+
month: weekDay.month,
|
|
30
|
+
monthLong: monthsLong[weekDay.month - 1],
|
|
31
|
+
onClick: handleClickDay,
|
|
32
|
+
isPreviouslySelected: weekDay.isPreviouslySelected,
|
|
33
|
+
isSelected: weekDay.isSelected,
|
|
34
|
+
isSibling: weekDay.isSiblingMonth,
|
|
35
|
+
year: weekDay.year,
|
|
36
|
+
mode: mode,
|
|
37
|
+
shouldSetFocus: shouldSetFocus,
|
|
38
|
+
tabIndex: tabIndex,
|
|
39
|
+
testId: testId
|
|
40
|
+
}, weekDay.day);
|
|
41
|
+
}));
|
|
42
|
+
}));
|
|
48
43
|
});
|
|
49
44
|
WeekDays.displayName = 'WeekDays';
|
|
50
45
|
|
|
@@ -47,7 +47,7 @@ export default function useHandleDateChange(_ref) {
|
|
|
47
47
|
yearValue = _ref$year[0],
|
|
48
48
|
setYearValue = _ref$year[1],
|
|
49
49
|
_ref$shouldSetFocus = _slicedToArray(_ref.shouldSetFocus, 2),
|
|
50
|
-
|
|
50
|
+
_shouldSetFocus = _ref$shouldSetFocus[0],
|
|
51
51
|
setShouldSetFocus = _ref$shouldSetFocus[1],
|
|
52
52
|
onChange = _ref.onChange;
|
|
53
53
|
var dateRef = useRef({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent } from '../../types';
|
|
2
2
|
import type { ArrowKeys } from '../types';
|
|
3
|
-
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [
|
|
3
|
+
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [_shouldSetFocus, setShouldSetFocus], onChange, }: {
|
|
4
4
|
day: readonly [number, (newValue: number) => void];
|
|
5
5
|
month: readonly [number, (newValue: number) => void];
|
|
6
6
|
year: readonly [number, (newValue: number) => void];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent } from '../../types';
|
|
2
2
|
import type { ArrowKeys } from '../types';
|
|
3
|
-
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [
|
|
3
|
+
export default function useHandleDateChange({ day: [dayValue, setDayValue], month: [monthValue, setMonthValue], year: [yearValue, setYearValue], shouldSetFocus: [_shouldSetFocus, setShouldSetFocus], onChange, }: {
|
|
4
4
|
day: readonly [
|
|
5
5
|
number,
|
|
6
6
|
(newValue: number) => void
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "13.3.
|
|
3
|
+
"version": "13.3.3",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
27
|
-
"@atlaskit/button": "^16.
|
|
28
|
-
"@atlaskit/ds-explorations": "^
|
|
27
|
+
"@atlaskit/button": "^16.13.0",
|
|
28
|
+
"@atlaskit/ds-explorations": "^3.0.0",
|
|
29
29
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
30
|
-
"@atlaskit/heading": "^1.
|
|
30
|
+
"@atlaskit/heading": "^1.4.0",
|
|
31
31
|
"@atlaskit/icon": "^21.12.0",
|
|
32
|
-
"@atlaskit/locale": "^2.
|
|
33
|
-
"@atlaskit/primitives": "^1.
|
|
32
|
+
"@atlaskit/locale": "^2.6.0",
|
|
33
|
+
"@atlaskit/primitives": "^1.9.0",
|
|
34
34
|
"@atlaskit/theme": "^12.6.0",
|
|
35
|
-
"@atlaskit/tokens": "^1.
|
|
35
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"@emotion/react": "^11.7.1",
|
|
38
38
|
"date-fns": "^2.17.0",
|