@atlaskit/calendar 12.4.5 → 13.0.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 +20 -0
- package/dist/cjs/calendar.js +24 -42
- package/dist/cjs/internal/components/date.js +19 -17
- package/dist/cjs/internal/components/{heading.js → header.js} +21 -45
- package/dist/cjs/internal/components/week-day-grid.js +34 -0
- package/dist/cjs/internal/components/week-days.js +7 -14
- package/dist/cjs/internal/components/week-header.js +28 -23
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/calendar.js +22 -42
- package/dist/es2019/internal/components/date.js +19 -17
- package/dist/es2019/internal/components/header.js +60 -0
- package/dist/es2019/internal/components/week-day-grid.js +23 -0
- package/dist/es2019/internal/components/week-days.js +7 -15
- package/dist/es2019/internal/components/week-header.js +23 -23
- package/dist/es2019/version.json +1 -1
- package/dist/esm/calendar.js +23 -42
- package/dist/esm/internal/components/date.js +19 -17
- package/dist/esm/internal/components/header.js +61 -0
- package/dist/esm/internal/components/week-day-grid.js +25 -0
- package/dist/esm/internal/components/week-days.js +7 -15
- package/dist/esm/internal/components/week-header.js +24 -24
- package/dist/esm/version.json +1 -1
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types/internal/components/{heading.d.ts → header.d.ts} +3 -3
- package/dist/types/internal/components/week-day-grid.d.ts +15 -0
- package/package.json +11 -4
- package/report.api.md +1 -1
- package/dist/es2019/internal/components/heading.js +0 -82
- package/dist/esm/internal/components/heading.js +0 -88
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import Button from '@atlaskit/button/standard-button';
|
|
5
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
6
|
+
import Inline from '@atlaskit/ds-explorations/inline';
|
|
7
|
+
import Heading from '@atlaskit/heading';
|
|
8
|
+
import ArrowleftIcon from '@atlaskit/icon/glyph/chevron-left-large';
|
|
9
|
+
import ArrowrightIcon from '@atlaskit/icon/glyph/chevron-right-large';
|
|
10
|
+
import { N70 } from '@atlaskit/theme/colors';
|
|
11
|
+
const Header = /*#__PURE__*/memo(function Header({
|
|
12
|
+
monthLongTitle,
|
|
13
|
+
year,
|
|
14
|
+
previousMonthLabel = 'Last month',
|
|
15
|
+
nextMonthLabel = 'Next month',
|
|
16
|
+
handleClickPrev,
|
|
17
|
+
handleClickNext,
|
|
18
|
+
testId
|
|
19
|
+
}) {
|
|
20
|
+
return jsx(Box, {
|
|
21
|
+
display: "block",
|
|
22
|
+
paddingInline: "scale.100",
|
|
23
|
+
"aria-hidden": "true"
|
|
24
|
+
}, jsx(Inline, {
|
|
25
|
+
gap: "scale.0",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "space-between"
|
|
28
|
+
}, jsx(Button, {
|
|
29
|
+
appearance: "subtle",
|
|
30
|
+
spacing: "none",
|
|
31
|
+
tabIndex: -1,
|
|
32
|
+
onClick: handleClickPrev,
|
|
33
|
+
testId: testId && `${testId}--previous-month`,
|
|
34
|
+
iconBefore: jsx(ArrowleftIcon, {
|
|
35
|
+
label: previousMonthLabel,
|
|
36
|
+
size: "medium",
|
|
37
|
+
primaryColor: `var(--ds-text-subtlest, ${N70})`,
|
|
38
|
+
testId: testId && `${testId}--previous-month-icon`
|
|
39
|
+
})
|
|
40
|
+
}), jsx(Heading, {
|
|
41
|
+
level: "h400",
|
|
42
|
+
as: "div",
|
|
43
|
+
testId: testId && `${testId}--current-month-year`
|
|
44
|
+
}, `${monthLongTitle} ${year}`), jsx(Button, {
|
|
45
|
+
appearance: "subtle",
|
|
46
|
+
spacing: "none",
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
onClick: handleClickNext,
|
|
49
|
+
testId: testId && `${testId}--next-month`,
|
|
50
|
+
iconBefore: jsx(ArrowrightIcon, {
|
|
51
|
+
label: nextMonthLabel,
|
|
52
|
+
size: "medium",
|
|
53
|
+
primaryColor: `var(--ds-text-subtlest, ${N70})`,
|
|
54
|
+
testId: testId && `${testId}--next-month-icon`
|
|
55
|
+
})
|
|
56
|
+
})));
|
|
57
|
+
});
|
|
58
|
+
Header.displayName = 'Header'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
59
|
+
|
|
60
|
+
export default Header;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
const gridStyles = css({
|
|
4
|
+
display: 'grid',
|
|
5
|
+
gridTemplateColumns: 'repeat(7, minmax(max-content, 1fr))'
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* __Week day grid__
|
|
10
|
+
*
|
|
11
|
+
* A week day grid aligns elements in a 7 wide grid layout.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
const WeekDayGrid = ({
|
|
15
|
+
testId,
|
|
16
|
+
children
|
|
17
|
+
}) => // eslint-disable-next-line @repo/internal/react/use-primitives
|
|
18
|
+
jsx("div", {
|
|
19
|
+
"data-testid": testId,
|
|
20
|
+
css: gridStyles
|
|
21
|
+
}, children);
|
|
22
|
+
|
|
23
|
+
export default WeekDayGrid;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
4
|
import DateComponent from './date';
|
|
5
|
-
|
|
6
|
-
display: 'grid',
|
|
7
|
-
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
8
|
-
border: 0
|
|
9
|
-
});
|
|
5
|
+
import WeekdayGrid from './week-day-grid';
|
|
10
6
|
const WeekDays = /*#__PURE__*/memo(function WeekDays({
|
|
11
7
|
weeks,
|
|
12
8
|
handleClickDay,
|
|
13
9
|
mode,
|
|
14
10
|
testId
|
|
15
11
|
}) {
|
|
16
|
-
return jsx(
|
|
12
|
+
return jsx(WeekdayGrid, {
|
|
17
13
|
role: "grid",
|
|
18
|
-
|
|
19
|
-
}, weeks.map(week => jsx(
|
|
20
|
-
|
|
21
|
-
key: week.id,
|
|
22
|
-
css: daysGridStyles
|
|
23
|
-
}, week.values.map(weekDay => jsx(DateComponent, {
|
|
24
|
-
key: weekDay.id,
|
|
14
|
+
testId: testId && `${testId}--month`
|
|
15
|
+
}, weeks.map(week => week.values.map(weekDay => jsx(DateComponent, {
|
|
16
|
+
key: `${week.id}-${weekDay.id}`,
|
|
25
17
|
isDisabled: weekDay.isDisabled,
|
|
26
18
|
isFocused: weekDay.isFocused,
|
|
27
19
|
isToday: weekDay.isToday,
|
|
@@ -33,7 +25,7 @@ const WeekDays = /*#__PURE__*/memo(function WeekDays({
|
|
|
33
25
|
year: weekDay.year,
|
|
34
26
|
mode: mode,
|
|
35
27
|
testId: testId
|
|
36
|
-
}, weekDay.day))))
|
|
28
|
+
}, weekDay.day))));
|
|
37
29
|
});
|
|
38
30
|
WeekDays.displayName = 'WeekDays'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
39
31
|
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
5
|
+
import Text from '@atlaskit/ds-explorations/text';
|
|
4
6
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
|
-
|
|
6
|
-
display: 'grid',
|
|
7
|
-
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
8
|
-
border: 0
|
|
9
|
-
});
|
|
10
|
-
const dayNameCellStyles = css({
|
|
11
|
-
boxSizing: 'border-box',
|
|
12
|
-
minWidth: 40,
|
|
13
|
-
padding: `${"var(--ds-scale-100, 8px)"} ${"var(--ds-scale-100, 8px)"}`,
|
|
14
|
-
border: 0,
|
|
15
|
-
color: `var(--ds-text-subtle, ${N200})`,
|
|
16
|
-
fontSize: 11,
|
|
17
|
-
fontWeight: 700,
|
|
18
|
-
textAlign: 'center',
|
|
19
|
-
textTransform: 'uppercase',
|
|
20
|
-
whiteSpace: 'nowrap'
|
|
21
|
-
});
|
|
7
|
+
import WeekDayGrid from './week-day-grid';
|
|
22
8
|
const WeekHeader = /*#__PURE__*/memo(function WeekHeader({
|
|
23
9
|
daysShort
|
|
24
10
|
}) {
|
|
25
|
-
return jsx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
return jsx(WeekDayGrid, null, daysShort.map(shortDay => jsx(Box, {
|
|
12
|
+
padding: "scale.100",
|
|
13
|
+
display: "block",
|
|
14
|
+
UNSAFE_style: {
|
|
15
|
+
minWidth: 40,
|
|
16
|
+
// Account for languages with short week day names
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
// Account for languages with long week day names
|
|
19
|
+
textAlign: 'center',
|
|
20
|
+
lineHeight: '16px',
|
|
21
|
+
color: `var(--ds-text-subtle, ${N200})` // Apply correct fallback to shortDay text
|
|
22
|
+
|
|
23
|
+
},
|
|
29
24
|
key: shortDay
|
|
30
|
-
},
|
|
25
|
+
}, jsx(Text, {
|
|
26
|
+
fontWeight: "700",
|
|
27
|
+
fontSize: "11px",
|
|
28
|
+
verticalAlign: "middle",
|
|
29
|
+
textTransform: "uppercase"
|
|
30
|
+
}, shortDay))));
|
|
31
31
|
});
|
|
32
32
|
WeekHeader.displayName = 'WeekHeader'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
33
33
|
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/calendar.js
CHANGED
|
@@ -8,13 +8,14 @@ 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 {
|
|
11
|
+
import { jsx } from '@emotion/react';
|
|
12
12
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
13
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
14
|
+
import Stack from '@atlaskit/ds-explorations/stack';
|
|
13
15
|
import noop from '@atlaskit/ds-lib/noop';
|
|
14
|
-
import { DN600, N0, N700, N900 } from '@atlaskit/theme/colors';
|
|
15
16
|
import GlobalTheme from '@atlaskit/theme/components';
|
|
16
17
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
17
|
-
import
|
|
18
|
+
import Header from './internal/components/header';
|
|
18
19
|
import WeekDaysComponent from './internal/components/week-days';
|
|
19
20
|
import WeekHeaderComponent from './internal/components/week-header';
|
|
20
21
|
import { blankStringArray } from './internal/constants';
|
|
@@ -26,38 +27,10 @@ import useHandleDateChange from './internal/hooks/use-handle-date-change';
|
|
|
26
27
|
import useHandleDateSelect from './internal/hooks/use-handle-date-select';
|
|
27
28
|
import useLocale from './internal/hooks/use-locale';
|
|
28
29
|
import useUniqueId from './internal/hooks/use-unique-id';
|
|
29
|
-
var lightWrapperStyles = css({
|
|
30
|
-
display: 'inline-block',
|
|
31
|
-
boxSizing: 'border-box',
|
|
32
|
-
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
33
|
-
padding: "var(--ds-scale-200, 16px)",
|
|
34
|
-
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(N0, ")"),
|
|
35
|
-
color: "var(--ds-text, ".concat(N900, ")"),
|
|
36
|
-
outline: 'none',
|
|
37
|
-
userSelect: 'none'
|
|
38
|
-
});
|
|
39
|
-
var darkWrapperStyles = css({
|
|
40
|
-
display: 'inline-block',
|
|
41
|
-
boxSizing: 'border-box',
|
|
42
|
-
// TODO Delete this comment after verifying spacing token -> previous value `16`
|
|
43
|
-
padding: "var(--ds-scale-200, 16px)",
|
|
44
|
-
backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(N700, ")"),
|
|
45
|
-
color: "var(--ds-text, ".concat(DN600, ")"),
|
|
46
|
-
outline: 'none',
|
|
47
|
-
userSelect: 'none'
|
|
48
|
-
});
|
|
49
|
-
var gridsContainerStyles = css({
|
|
50
|
-
display: 'inline-block',
|
|
51
|
-
width: 289,
|
|
52
|
-
// TODO Delete this comment after verifying spacing token -> previous value `0`
|
|
53
|
-
margin: "var(--ds-scale-0, 0px)",
|
|
54
|
-
marginBottom: 5,
|
|
55
|
-
textAlign: 'center'
|
|
56
|
-
});
|
|
57
30
|
var analyticsAttributes = {
|
|
58
31
|
componentName: 'calendar',
|
|
59
32
|
packageName: "@atlaskit/calendar",
|
|
60
|
-
packageVersion: "
|
|
33
|
+
packageVersion: "13.0.0"
|
|
61
34
|
};
|
|
62
35
|
var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
63
36
|
var day = _ref.day,
|
|
@@ -97,7 +70,8 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
97
70
|
weekStartDay = _ref$weekStartDay === void 0 ? 0 : _ref$weekStartDay,
|
|
98
71
|
testId = _ref.testId,
|
|
99
72
|
calendarRef = _ref.calendarRef,
|
|
100
|
-
mode = _ref.mode,
|
|
73
|
+
_ref$mode = _ref.mode,
|
|
74
|
+
mode = _ref$mode === void 0 ? 'light' : _ref$mode,
|
|
101
75
|
className = _ref.className,
|
|
102
76
|
style = _ref.style,
|
|
103
77
|
_ref$tabIndex = _ref.tabIndex,
|
|
@@ -203,26 +177,33 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
203
177
|
monthsLong = _useLocale.monthsLong,
|
|
204
178
|
daysShort = _useLocale.daysShort;
|
|
205
179
|
|
|
206
|
-
return jsx(
|
|
180
|
+
return jsx(Box, {
|
|
207
181
|
className: className,
|
|
208
|
-
|
|
182
|
+
UNSAFE_style: style,
|
|
183
|
+
backgroundColor: "elevation.surface",
|
|
209
184
|
onBlur: handleContainerBlur,
|
|
210
185
|
onFocus: handleContainerFocus,
|
|
211
186
|
onKeyDown: handleContainerKeyDown,
|
|
212
187
|
role: "presentation",
|
|
213
|
-
|
|
188
|
+
testId: testId && "".concat(testId, "--container"),
|
|
214
189
|
ref: ref
|
|
215
190
|
}, jsx(VisuallyHidden, null, jsx("span", {
|
|
216
191
|
id: announceId,
|
|
217
192
|
"aria-live": "assertive",
|
|
218
193
|
"aria-relevant": "text"
|
|
219
|
-
}, announcerDate)), jsx(
|
|
220
|
-
|
|
194
|
+
}, announcerDate)), jsx(Box, {
|
|
195
|
+
display: "inlineBlock",
|
|
196
|
+
padding: "scale.200",
|
|
197
|
+
UNSAFE_style: {
|
|
198
|
+
userSelect: 'none'
|
|
199
|
+
},
|
|
221
200
|
"aria-describedby": announceId,
|
|
222
201
|
"aria-label": "calendar",
|
|
223
202
|
role: "grid",
|
|
224
203
|
tabIndex: tabIndex
|
|
225
|
-
}, jsx(
|
|
204
|
+
}, jsx(Stack, {
|
|
205
|
+
gap: "scale.150"
|
|
206
|
+
}, jsx(Header // The month number needs to be translated to index in the month
|
|
226
207
|
// name array e.g. 1 (January) -> 0
|
|
227
208
|
, {
|
|
228
209
|
monthLongTitle: monthsLong[monthValue - 1],
|
|
@@ -233,8 +214,8 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
233
214
|
handleClickPrev: handleClickPrev,
|
|
234
215
|
mode: mode,
|
|
235
216
|
testId: testId
|
|
236
|
-
}), jsx(
|
|
237
|
-
|
|
217
|
+
}), jsx(Box, {
|
|
218
|
+
display: "block",
|
|
238
219
|
role: "presentation"
|
|
239
220
|
}, jsx(WeekHeaderComponent, {
|
|
240
221
|
daysShort: daysShort,
|
|
@@ -244,7 +225,7 @@ var CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar(_ref, ref) {
|
|
|
244
225
|
handleClickDay: handleClickDay,
|
|
245
226
|
mode: mode,
|
|
246
227
|
testId: testId
|
|
247
|
-
}))));
|
|
228
|
+
})))));
|
|
248
229
|
});
|
|
249
230
|
/**
|
|
250
231
|
* __Calendar__
|
|
@@ -55,23 +55,25 @@ var Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date(_ref, ref) {
|
|
|
55
55
|
var dateCellStyles = useMemo(function () {
|
|
56
56
|
return css(getDateCellStyles(mode));
|
|
57
57
|
}, [mode]);
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
59
|
+
jsx("button", {
|
|
60
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
61
|
+
css: dateCellStyles,
|
|
62
|
+
"aria-selected": isSelected ? 'true' : 'false',
|
|
63
|
+
tabIndex: isSelected ? 0 : -1,
|
|
64
|
+
type: "button",
|
|
65
|
+
role: "gridcell",
|
|
66
|
+
onClick: handleClick,
|
|
67
|
+
ref: ref,
|
|
68
|
+
"data-disabled": isDisabled || undefined,
|
|
69
|
+
"data-focused": isFocused || undefined,
|
|
70
|
+
"data-prev-selected": isPreviouslySelected || undefined,
|
|
71
|
+
"data-selected": isSelected || undefined,
|
|
72
|
+
"data-sibling": isSibling || undefined,
|
|
73
|
+
"data-today": isToday || undefined,
|
|
74
|
+
"data-testid": testId && isSelected ? "".concat(testId, "--selected-day") : undefined
|
|
75
|
+
}, day)
|
|
76
|
+
);
|
|
75
77
|
}));
|
|
76
78
|
Date.displayName = 'Date'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
77
79
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import Button from '@atlaskit/button/standard-button';
|
|
5
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
6
|
+
import Inline from '@atlaskit/ds-explorations/inline';
|
|
7
|
+
import Heading from '@atlaskit/heading';
|
|
8
|
+
import ArrowleftIcon from '@atlaskit/icon/glyph/chevron-left-large';
|
|
9
|
+
import ArrowrightIcon from '@atlaskit/icon/glyph/chevron-right-large';
|
|
10
|
+
import { N70 } from '@atlaskit/theme/colors';
|
|
11
|
+
var Header = /*#__PURE__*/memo(function Header(_ref) {
|
|
12
|
+
var monthLongTitle = _ref.monthLongTitle,
|
|
13
|
+
year = _ref.year,
|
|
14
|
+
_ref$previousMonthLab = _ref.previousMonthLabel,
|
|
15
|
+
previousMonthLabel = _ref$previousMonthLab === void 0 ? 'Last month' : _ref$previousMonthLab,
|
|
16
|
+
_ref$nextMonthLabel = _ref.nextMonthLabel,
|
|
17
|
+
nextMonthLabel = _ref$nextMonthLabel === void 0 ? 'Next month' : _ref$nextMonthLabel,
|
|
18
|
+
handleClickPrev = _ref.handleClickPrev,
|
|
19
|
+
handleClickNext = _ref.handleClickNext,
|
|
20
|
+
testId = _ref.testId;
|
|
21
|
+
return jsx(Box, {
|
|
22
|
+
display: "block",
|
|
23
|
+
paddingInline: "scale.100",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
}, jsx(Inline, {
|
|
26
|
+
gap: "scale.0",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: "space-between"
|
|
29
|
+
}, jsx(Button, {
|
|
30
|
+
appearance: "subtle",
|
|
31
|
+
spacing: "none",
|
|
32
|
+
tabIndex: -1,
|
|
33
|
+
onClick: handleClickPrev,
|
|
34
|
+
testId: testId && "".concat(testId, "--previous-month"),
|
|
35
|
+
iconBefore: jsx(ArrowleftIcon, {
|
|
36
|
+
label: previousMonthLabel,
|
|
37
|
+
size: "medium",
|
|
38
|
+
primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")"),
|
|
39
|
+
testId: testId && "".concat(testId, "--previous-month-icon")
|
|
40
|
+
})
|
|
41
|
+
}), jsx(Heading, {
|
|
42
|
+
level: "h400",
|
|
43
|
+
as: "div",
|
|
44
|
+
testId: testId && "".concat(testId, "--current-month-year")
|
|
45
|
+
}, "".concat(monthLongTitle, " ").concat(year)), jsx(Button, {
|
|
46
|
+
appearance: "subtle",
|
|
47
|
+
spacing: "none",
|
|
48
|
+
tabIndex: -1,
|
|
49
|
+
onClick: handleClickNext,
|
|
50
|
+
testId: testId && "".concat(testId, "--next-month"),
|
|
51
|
+
iconBefore: jsx(ArrowrightIcon, {
|
|
52
|
+
label: nextMonthLabel,
|
|
53
|
+
size: "medium",
|
|
54
|
+
primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")"),
|
|
55
|
+
testId: testId && "".concat(testId, "--next-month-icon")
|
|
56
|
+
})
|
|
57
|
+
})));
|
|
58
|
+
});
|
|
59
|
+
Header.displayName = 'Header'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
60
|
+
|
|
61
|
+
export default Header;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
var gridStyles = css({
|
|
4
|
+
display: 'grid',
|
|
5
|
+
gridTemplateColumns: 'repeat(7, minmax(max-content, 1fr))'
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* __Week day grid__
|
|
10
|
+
*
|
|
11
|
+
* A week day grid aligns elements in a 7 wide grid layout.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
var WeekDayGrid = function WeekDayGrid(_ref) {
|
|
15
|
+
var testId = _ref.testId,
|
|
16
|
+
children = _ref.children;
|
|
17
|
+
return (// eslint-disable-next-line @repo/internal/react/use-primitives
|
|
18
|
+
jsx("div", {
|
|
19
|
+
"data-testid": testId,
|
|
20
|
+
css: gridStyles
|
|
21
|
+
}, children)
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default WeekDayGrid;
|
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
4
|
import DateComponent from './date';
|
|
5
|
-
|
|
6
|
-
display: 'grid',
|
|
7
|
-
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
8
|
-
border: 0
|
|
9
|
-
});
|
|
5
|
+
import WeekdayGrid from './week-day-grid';
|
|
10
6
|
var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
|
|
11
7
|
var weeks = _ref.weeks,
|
|
12
8
|
handleClickDay = _ref.handleClickDay,
|
|
13
9
|
mode = _ref.mode,
|
|
14
10
|
testId = _ref.testId;
|
|
15
|
-
return jsx(
|
|
11
|
+
return jsx(WeekdayGrid, {
|
|
16
12
|
role: "grid",
|
|
17
|
-
|
|
13
|
+
testId: testId && "".concat(testId, "--month")
|
|
18
14
|
}, weeks.map(function (week) {
|
|
19
|
-
return
|
|
20
|
-
role: "row",
|
|
21
|
-
key: week.id,
|
|
22
|
-
css: daysGridStyles
|
|
23
|
-
}, week.values.map(function (weekDay) {
|
|
15
|
+
return week.values.map(function (weekDay) {
|
|
24
16
|
return jsx(DateComponent, {
|
|
25
|
-
key: weekDay.id,
|
|
17
|
+
key: "".concat(week.id, "-").concat(weekDay.id),
|
|
26
18
|
isDisabled: weekDay.isDisabled,
|
|
27
19
|
isFocused: weekDay.isFocused,
|
|
28
20
|
isToday: weekDay.isToday,
|
|
@@ -35,7 +27,7 @@ var WeekDays = /*#__PURE__*/memo(function WeekDays(_ref) {
|
|
|
35
27
|
mode: mode,
|
|
36
28
|
testId: testId
|
|
37
29
|
}, weekDay.day);
|
|
38
|
-
})
|
|
30
|
+
});
|
|
39
31
|
}));
|
|
40
32
|
});
|
|
41
33
|
WeekDays.displayName = 'WeekDays'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import Box from '@atlaskit/ds-explorations/box';
|
|
5
|
+
import Text from '@atlaskit/ds-explorations/text';
|
|
4
6
|
import { N200 } from '@atlaskit/theme/colors';
|
|
5
|
-
|
|
6
|
-
display: 'grid',
|
|
7
|
-
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
8
|
-
border: 0
|
|
9
|
-
});
|
|
10
|
-
var dayNameCellStyles = css({
|
|
11
|
-
boxSizing: 'border-box',
|
|
12
|
-
minWidth: 40,
|
|
13
|
-
padding: "var(--ds-scale-100, 8px)".concat(" ", "var(--ds-scale-100, 8px)"),
|
|
14
|
-
border: 0,
|
|
15
|
-
color: "var(--ds-text-subtle, ".concat(N200, ")"),
|
|
16
|
-
fontSize: 11,
|
|
17
|
-
fontWeight: 700,
|
|
18
|
-
textAlign: 'center',
|
|
19
|
-
textTransform: 'uppercase',
|
|
20
|
-
whiteSpace: 'nowrap'
|
|
21
|
-
});
|
|
7
|
+
import WeekDayGrid from './week-day-grid';
|
|
22
8
|
var WeekHeader = /*#__PURE__*/memo(function WeekHeader(_ref) {
|
|
23
9
|
var daysShort = _ref.daysShort;
|
|
24
|
-
return jsx(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
10
|
+
return jsx(WeekDayGrid, null, daysShort.map(function (shortDay) {
|
|
11
|
+
return jsx(Box, {
|
|
12
|
+
padding: "scale.100",
|
|
13
|
+
display: "block",
|
|
14
|
+
UNSAFE_style: {
|
|
15
|
+
minWidth: 40,
|
|
16
|
+
// Account for languages with short week day names
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
// Account for languages with long week day names
|
|
19
|
+
textAlign: 'center',
|
|
20
|
+
lineHeight: '16px',
|
|
21
|
+
color: "var(--ds-text-subtle, ".concat(N200, ")") // Apply correct fallback to shortDay text
|
|
22
|
+
|
|
23
|
+
},
|
|
29
24
|
key: shortDay
|
|
30
|
-
},
|
|
25
|
+
}, jsx(Text, {
|
|
26
|
+
fontWeight: "700",
|
|
27
|
+
fontSize: "11px",
|
|
28
|
+
verticalAlign: "middle",
|
|
29
|
+
textTransform: "uppercase"
|
|
30
|
+
}, shortDay));
|
|
31
31
|
}));
|
|
32
32
|
});
|
|
33
33
|
WeekHeader.displayName = 'WeekHeader'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
package/dist/esm/version.json
CHANGED
package/dist/types/calendar.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ import type { CalendarProps } from './types';
|
|
|
9
9
|
* - [Code](https://atlassian.design/components/calendar/code)
|
|
10
10
|
* - [Usage](https://atlassian.design/components/calendar/usage)
|
|
11
11
|
*/
|
|
12
|
-
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "
|
|
12
|
+
declare const Calendar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CalendarProps, "year" | "previousMonthLabel" | "nextMonthLabel" | "mode" | "testId" | "className" | "style" | "tabIndex" | "onFocus" | "onBlur" | "onChange" | "onSelect" | "disabled" | "selected" | "analyticsContext" | "day" | "defaultDay" | "defaultMonth" | "defaultPreviouslySelected" | "defaultSelected" | "defaultYear" | "disabledDateFilter" | "maxDate" | "minDate" | "month" | "previouslySelected" | "today" | "locale" | "weekStartDay" | "calendarRef" | "createAnalyticsEvent"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
13
13
|
export default Calendar;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
-
interface
|
|
3
|
+
interface HeaderProps {
|
|
4
4
|
monthLongTitle: string;
|
|
5
5
|
year: number;
|
|
6
6
|
previousMonthLabel?: string;
|
|
@@ -10,5 +10,5 @@ interface HeadingProps {
|
|
|
10
10
|
mode?: ThemeModes;
|
|
11
11
|
testId?: string;
|
|
12
12
|
}
|
|
13
|
-
declare const
|
|
14
|
-
export default
|
|
13
|
+
declare const Header: import("react").NamedExoticComponent<HeaderProps>;
|
|
14
|
+
export default Header;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
interface WeekDayGridProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
+
testId?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* __Week day grid__
|
|
10
|
+
*
|
|
11
|
+
* A week day grid aligns elements in a 7 wide grid layout.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
declare const WeekDayGrid: ({ testId, children }: WeekDayGridProps) => jsx.JSX.Element;
|
|
15
|
+
export default WeekDayGrid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/calendar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "An interactive calendar for date selection experiences.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
28
28
|
"@atlaskit/button": "^16.5.0",
|
|
29
|
+
"@atlaskit/ds-explorations": "^1.7.0",
|
|
29
30
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
31
|
+
"@atlaskit/heading": "^1.0.2",
|
|
30
32
|
"@atlaskit/icon": "^21.11.0",
|
|
31
33
|
"@atlaskit/locale": "^2.3.0",
|
|
32
34
|
"@atlaskit/theme": "^12.2.0",
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@atlaskit/docs": "*",
|
|
45
|
-
"@atlaskit/select": "^16.
|
|
47
|
+
"@atlaskit/select": "^16.1.0",
|
|
46
48
|
"@atlaskit/ssr": "*",
|
|
47
49
|
"@atlaskit/visual-regression": "*",
|
|
48
50
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -64,9 +66,14 @@
|
|
|
64
66
|
"@repo/internal": {
|
|
65
67
|
"dom-events": "use-bind-event-listener",
|
|
66
68
|
"design-system": "v1",
|
|
67
|
-
"ui-components":
|
|
69
|
+
"ui-components": [
|
|
70
|
+
"primitives",
|
|
71
|
+
"lite-mode"
|
|
72
|
+
],
|
|
68
73
|
"analytics": "analytics-next",
|
|
69
|
-
"design-tokens":
|
|
74
|
+
"design-tokens": [
|
|
75
|
+
"spacing"
|
|
76
|
+
],
|
|
70
77
|
"theming": "tokens",
|
|
71
78
|
"deprecation": "no-deprecated-imports",
|
|
72
79
|
"styling": [
|
package/report.api.md
CHANGED